Browse Source

Remove programs/libraries that have been obsoleted or make no sense

outside of Cyan's build environment
Adam Johnson 12 years ago
parent
commit
c4190c50de
  1. 1
      Sources/Plasma/Apps/plClient/plClient.cpp
  2. 51
      Sources/Plasma/Apps/plClientKey/DllMain.cpp
  3. 63
      Sources/Plasma/Apps/plClientKey/plClientKey.cpp
  4. 5
      Sources/Plasma/Apps/plClientKey/plClientKey.def
  5. 59
      Sources/Plasma/Apps/plClientKey/plClientKey.h
  6. BIN
      Sources/Plasma/Apps/plPlasmaInstaller/Dirt.ICO
  7. 63
      Sources/Plasma/Apps/plPlasmaInstaller/main.cpp
  8. 113
      Sources/Plasma/Apps/plPlasmaInstaller/plInstallerReg.cpp
  9. 50
      Sources/Plasma/Apps/plPlasmaInstaller/plInstallerReg.h
  10. 408
      Sources/Plasma/Apps/plPlasmaInstaller/plPlasmaInstaller.cpp
  11. 73
      Sources/Plasma/Apps/plPlasmaInstaller/plPlasmaInstaller.h
  12. 122
      Sources/Plasma/Apps/plPlasmaInstaller/plPlasmaInstaller.rc
  13. 120
      Sources/Plasma/Apps/plPlasmaInstaller/plSetPlasmaPath.cpp
  14. 42
      Sources/Plasma/Apps/plPlasmaInstaller/plSetPlasmaPath.h
  15. 169
      Sources/Plasma/Apps/plPlasmaInstaller/plUnzip.cpp
  16. 66
      Sources/Plasma/Apps/plPlasmaInstaller/plUnzip.h
  17. 30
      Sources/Plasma/Apps/plPlasmaInstaller/resource.h
  18. BIN
      Sources/Plasma/Apps/plPlasmaUpdate/Dirt.ICO
  19. 67
      Sources/Plasma/Apps/plPlasmaUpdate/main.cpp
  20. 186
      Sources/Plasma/Apps/plPlasmaUpdate/plFileGrabber.cpp
  21. 89
      Sources/Plasma/Apps/plPlasmaUpdate/plFileGrabber.h
  22. 361
      Sources/Plasma/Apps/plPlasmaUpdate/plManifest.cpp
  23. 93
      Sources/Plasma/Apps/plPlasmaUpdate/plManifest.h
  24. 94
      Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.cpp
  25. 75
      Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.h
  26. 514
      Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.cpp
  27. 94
      Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.h
  28. 131
      Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.rc
  29. 27
      Sources/Plasma/Apps/plPlasmaUpdate/resource.h

1
Sources/Plasma/Apps/plClient/plClient.cpp

@ -144,7 +144,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plAvatar/plAGAnimInstance.h"
#include "plAgeLoader/plAgeLoader.h"
#include "plClientKey/plClientKey.h"
#include "plQuality.h"
#include "plGLight/plShadowCaster.h"

51
Sources/Plasma/Apps/plClientKey/DllMain.cpp

@ -1,51 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include <windows.h>
__declspec(dllexport) const unsigned long* GetKey()
{
// So the crackers know who the tard is
static const char* tauntText = "My copy protection is uncrackable! -Brice";
static const unsigned long kDefaultKey[4] = { 0x6c0a5452, 0x3827d0f, 0x3a170b92, 0x16db7fc2 };
return kDefaultKey;
}

63
Sources/Plasma/Apps/plClientKey/plClientKey.cpp

@ -1,63 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "plClientKey.h"
typedef const uint32_t* (*GETKEY)();
const uint32_t* plClientKey::GetKey()
{
HMODULE hDll = LoadLibrary("sp.dll");
if (hDll)
{
GETKEY getKey = (GETKEY)GetProcAddress(hDll, "GetKey");
if (getKey)
{
static uint32_t key[4];
memcpy(key, getKey(), sizeof(key));
FreeLibrary(hDll);
return key;
}
}
return nil;
}

5
Sources/Plasma/Apps/plClientKey/plClientKey.def

@ -1,5 +0,0 @@
LIBRARY
EXPORTS
GetKey @1
SECTIONS
.data READ WRITE

59
Sources/Plasma/Apps/plClientKey/plClientKey.h

@ -1,59 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef plClientKey_h_inc
#define plClientKey_h_inc
#include "HeadSpin.h"
//
// For getting the "SafeDisc protected" encryption key in single player mode
//
// Include plClientKey.cpp/h in your project and call plClientKey::GetKey
// It will load the Dll and get the key for you
// Returns nil if it fails
//
namespace plClientKey
{
const uint32_t* GetKey();
}
#endif // plClientKey_h_inc

BIN
Sources/Plasma/Apps/plPlasmaInstaller/Dirt.ICO

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

63
Sources/Plasma/Apps/plPlasmaInstaller/main.cpp

@ -1,63 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "HeadSpin.h"
#include "plPlasmaInstaller.h"
#include "jvCoreUtil.h"
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
jvCoreUtil::SetHInstance(hInstance);
plPlasmaInstaller installer;
installer.Create();
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
if (!IsDialogMessage(installer.GetHWnd(), &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.wParam;
}

113
Sources/Plasma/Apps/plPlasmaInstaller/plInstallerReg.cpp

@ -1,113 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "HeadSpin.h"
#include "plInstallerReg.h"
#include <windows.h>
static HKEY GetInstallerKey()
{
HKEY hSoftKey = NULL;
HKEY hCompanyKey = NULL;
HKEY hAppKey = NULL;
if(RegOpenKeyEx(HKEY_CURRENT_USER, "software", 0, KEY_WRITE|KEY_READ,
&hSoftKey) == ERROR_SUCCESS)
{
DWORD dw;
if(RegCreateKeyEx(hSoftKey, "Cyan", 0, REG_NONE,
REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_READ, NULL,
&hCompanyKey, &dw) == ERROR_SUCCESS)
{
RegCreateKeyEx(hCompanyKey, "PlasmaInstaller", 0, REG_NONE,
REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_READ, NULL,
&hAppKey, &dw);
}
}
if (hSoftKey != NULL)
RegCloseKey(hSoftKey);
if (hCompanyKey != NULL)
RegCloseKey(hCompanyKey);
return hAppKey;
}
static void WriteRegString(const char* valueName, const char* value)
{
HKEY installKey = GetInstallerKey();
RegSetValueEx(installKey, valueName, 0, REG_SZ, (const BYTE*)value, strlen(value)+1);
RegCloseKey(installKey);
}
static bool ReadRegString(const char* valueName, char* value, DWORD size)
{
HKEY installKey = GetInstallerKey();
bool ret = (RegQueryValueEx(installKey, valueName, NULL, NULL, (LPBYTE)value, &size) == ERROR_SUCCESS);
RegCloseKey(installKey);
return ret;
}
void plInstallerReg::SetClientDir(const char* dir)
{
WriteRegString("Client", dir);
}
void plInstallerReg::SetMaxDir(const char* dir)
{
WriteRegString("3dsmax", dir);
}
const char* plInstallerReg::GetClientDir()
{
static char dir[MAX_PATH];
if (!ReadRegString("Client", dir, sizeof(dir)))
strcpy(dir, "C:\\PlasmaClient");
return dir;
}
const char* plInstallerReg::GetMaxDir()
{
static char dir[MAX_PATH];
dir[0] = '\0';
ReadRegString("3dsmax", dir, sizeof(dir));
return dir;
}

50
Sources/Plasma/Apps/plPlasmaInstaller/plInstallerReg.h

@ -1,50 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
namespace plInstallerReg
{
void SetClientDir(const char* dir);
void SetMaxDir(const char* dir);
const char* GetClientDir();
const char* GetMaxDir();
}

408
Sources/Plasma/Apps/plPlasmaInstaller/plPlasmaInstaller.cpp

@ -1,408 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "HeadSpin.h"
#include "plPlasmaInstaller.h"
#include "resource.h"
#include <windowsx.h>
#include <commctrl.h>
#include "../plFile/hsFiles.h"
#include "plUnzip.h"
#include "plInstallerReg.h"
#include "../plFile/plBrowseFolder.h"
#include "plSetPlasmaPath.h"
plPlasmaInstaller::plPlasmaInstaller()
{
fDailyDir[0] = '\0';
fDidGet = false;
fStatusList = nil;
INITCOMMONCONTROLSEX icc = {0};
icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
icc.dwICC = ICC_DATE_CLASSES;
InitCommonControlsEx(&icc);
}
void plPlasmaInstaller::Create()
{
ICreateDialog(IDD_INSTALLER, NULL);
}
static const char* kAllClientExes = "AllClientExes.zip";
static const char* kAllDllsRelease = "AllDllsRelease.zip";
static const char* kScripts = "Scripts.zip";
static const char* kTools = "AllToolsRelease.zip";
bool FileExists(const char* path, const char* filename)
{
char fullpath[MAX_PATH];
sprintf(fullpath, "%s%s", path, filename);
HANDLE hFile = CreateFile(fullpath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
CloseHandle(hFile);
return true;
}
return false;
}
bool plPlasmaInstaller::IGetDailyDir()
{
// Get the branch
HWND hBuild = GetDlgItem(fDlg, IDC_BUILD_COMBO);
int idx = ComboBox_GetCurSel(hBuild);
int buildServer = ComboBox_GetItemData(hBuild, idx);
HWND hTime = GetDlgItem(fDlg, IDC_TIME_COMBO);
idx = ComboBox_GetCurSel(hTime);
int time = ComboBox_GetItemData(hTime, idx);
// Get the build date
SYSTEMTIME date;
DateTime_GetSystemtime(GetDlgItem(fDlg, IDC_BRANCH_DATE), &date);
char dateStr[] = "xx-xx-xxxx";
sprintf(dateStr, "%02d-%02d-%04d", date.wMonth, date.wDay, date.wYear);
fDailyDir[0] = '\0';
IAddStatusLine("Searching for %s build...", dateStr);
char buildDir[MAX_PATH];
static const char* kMainBuild = "\\\\Plasmabuild\\Output\\";
static const char* kBranchBuild = "\\\\Branchbuild\\Output\\";
static const char* kActiveBuild = "\\\\Activebuild\\Output\\";
static const char* kInternalMain = "Main-Internal\\";
static const char* kInternalBranch = "Branch-Internal\\";
static const char* kInternalActive = "Active-Internal\\";
switch (buildServer)
{
case kBuildMain: strcpy(buildDir, kMainBuild); break;
case kBuildBranch: strcpy(buildDir, kBranchBuild); break;
case kBuildActive: strcpy(buildDir, kActiveBuild); break;
}
switch (time)
{
case kNightly:
strcat(buildDir, "Nightly\\");
break;
case kAfternoon:
strcat(buildDir, "Afternoon\\");
break;
case kEvening:
strcat(buildDir, "Evening\\");
break;
}
strcat(buildDir, dateStr);
strcat(buildDir, "\\");
switch (buildServer)
{
case kBuildMain: strcat(buildDir, kInternalMain); break;
case kBuildBranch: strcat(buildDir, kInternalBranch); break;
case kBuildActive: strcat(buildDir, kInternalActive); break;
}
if (FileExists(buildDir, kAllClientExes) && FileExists(buildDir, kAllDllsRelease) && FileExists(buildDir, kScripts))
{
strcpy(fDailyDir, buildDir);
const char* serverName = nil;
switch (buildServer)
{
case kBuildMain: serverName = "Main"; break;
case kBuildBranch: serverName = "Branch"; break;
case kBuildActive: serverName = "Active"; break;
}
IAddStatusLine("Found %s at %s", serverName, fDailyDir);
EnableWindow(GetDlgItem(fDlg, IDC_GET_BUTTON), TRUE);
return true;
}
IAddStatusLine("Couldn't find build");
EnableWindow(GetDlgItem(fDlg, IDC_GET_BUTTON), FALSE);
return false;
}
void plPlasmaInstaller::IInit()
{
const char* clientDir = plInstallerReg::GetClientDir();
SetDlgItemText(fDlg, IDC_CLIENT_EDIT, clientDir);
const char* maxDir = plInstallerReg::GetMaxDir();
SetDlgItemText(fDlg, IDC_3DSMAX_EDIT, maxDir);
fStatusList = GetDlgItem(fDlg, IDC_STATUS_LIST);
HWND hCombo = GetDlgItem(fDlg, IDC_BUILD_COMBO);
int idx = ComboBox_AddString(hCombo, "Main");
ComboBox_SetItemData(hCombo, idx, kBuildMain);
ComboBox_SetCurSel(hCombo, idx);
idx = ComboBox_AddString(hCombo, "Branch");
ComboBox_SetItemData(hCombo, idx, kBuildBranch);
idx = ComboBox_AddString(hCombo, "Active");
ComboBox_SetItemData(hCombo, idx, kBuildActive);
HWND hTime = GetDlgItem(fDlg, IDC_TIME_COMBO);
idx = ComboBox_AddString(hTime, "Nightly");
ComboBox_SetItemData(hTime, idx, kNightly);
ComboBox_SetCurSel(hTime, idx);
idx = ComboBox_AddString(hTime, "Afternoon");
ComboBox_SetItemData(hTime, idx, kAfternoon);
idx = ComboBox_AddString(hTime, "Evening");
ComboBox_SetItemData(hTime, idx, kEvening);
CheckDlgButton(fDlg, IDC_CLIENT_CHECK, BST_CHECKED);
CheckDlgButton(fDlg, IDC_SCRIPTS_CHECK, BST_CHECKED);
CheckDlgButton(fDlg, IDC_PLUGINS_CHECK, BST_CHECKED);
ShowWindow(fDlg, SW_SHOW);
IGetDailyDir();
}
BOOL plPlasmaInstaller::IDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_INITDIALOG:
IInit();
SetFocus(GetDlgItem(fDlg, IDC_GET_BUTTON));
return FALSE;
case WM_CLOSE:
DestroyWindow(hDlg);
return TRUE;
case WM_DESTROY:
PostQuitMessage(0);
return TRUE;
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED)
{
switch (LOWORD(wParam))
{
case IDCANCEL:
PostMessage(hDlg, WM_CLOSE, 0, 0);
return TRUE;
case IDC_BROWSE_3DSMAX:
case IDC_BROWSE_CLIENT:
IGetFolder(LOWORD(wParam) == IDC_BROWSE_CLIENT);
return TRUE;
case IDC_GET_BUTTON:
if (fDidGet)
PostMessage(hDlg, WM_CLOSE, 0, 0);
else
IGet();
return TRUE;
}
}
else if (HIWORD(wParam) == CBN_SELCHANGE && (LOWORD(wParam) == IDC_TIME_COMBO || LOWORD(wParam) == IDC_BUILD_COMBO))
{
IGetDailyDir();
return TRUE;
}
break;
case WM_NOTIFY:
{
NMHDR* nmhdr = (NMHDR*)lParam;
if (nmhdr->idFrom == IDC_BRANCH_DATE && nmhdr->code == DTN_CLOSEUP/*DTN_DATETIMECHANGE*/)
{
IGetDailyDir();
return TRUE;
}
}
break;
}
return FALSE;
}
void plPlasmaInstaller::IExtractZip(const char* filename, const char* dest)
{
plUnzip unzip;
if (unzip.Open(filename))
{
IAddStatusLine("Extracting %s...", filename);
char buf[MAX_PATH];
while (unzip.ExtractNext(dest, buf))
IAddStatusLine(" %s", buf);
IAddStatusLine(" %s", buf);
unzip.Close();
}
}
void plPlasmaInstaller::IGet()
{
bool getClient = (IsDlgButtonChecked(fDlg, IDC_CLIENT_CHECK) == BST_CHECKED);
bool getScripts = (IsDlgButtonChecked(fDlg, IDC_SCRIPTS_CHECK) == BST_CHECKED);
bool getPlugins = (IsDlgButtonChecked(fDlg, IDC_PLUGINS_CHECK) == BST_CHECKED);
bool getTools = (IsDlgButtonChecked(fDlg, IDC_TOOLS_CHECK) == BST_CHECKED);
const char* clientDir = plInstallerReg::GetClientDir();
if (*clientDir == '\0' && (getClient || getScripts))
{
MessageBox(fDlg, "You need to set your client directory", "Plasma Installer", MB_OK | MB_ICONASTERISK);
return;
}
const char* maxDir = plInstallerReg::GetMaxDir();
if (*maxDir == '\0' && getPlugins)
{
MessageBox(fDlg, "You need to set your 3dsmax directory", "Plasma Installer", MB_OK | MB_ICONASTERISK);
return;
}
HWND hGetButton = GetDlgItem(fDlg, IDC_GET_BUTTON);
EnableWindow(hGetButton, FALSE);
HCURSOR hOldCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
char buf[MAX_PATH];
if (getScripts)
{
sprintf(buf, "%s%s", fDailyDir, kScripts);
IExtractZip(buf, clientDir);
}
if (getClient)
{
sprintf(buf, "%s%s", fDailyDir, kAllClientExes);
IExtractZip(buf, clientDir);
}
if (getPlugins)
{
sprintf(buf, "%s%s", fDailyDir, kAllDllsRelease);
char pluginDir[MAX_PATH];
sprintf(pluginDir, "%s\\plugins", maxDir);
IExtractZip(buf, pluginDir);
IAddStatusLine("Updating PlasmaMAX2.ini...");
sprintf(buf, "%s\\plugcfg\\PlasmaMAX2.ini", maxDir);
WritePrivateProfileString("SceneViewer", "Directory", clientDir, buf);
}
if (getTools)
{
sprintf(buf, "%s%s", fDailyDir, kTools);
char toolBuf[MAX_PATH];
sprintf(toolBuf, "%s\\Tools", clientDir);
IExtractZip(buf, toolBuf);
}
IAddStatusLine("Updating path...");
SetPlasmaPath(clientDir);
IAddStatusLine("Done");
SetCursor(hOldCursor);
fDidGet = true;
SetWindowText(hGetButton, "Close");
EnableWindow(hGetButton, TRUE);
}
void plPlasmaInstaller::IGetFolder(bool client)
{
char path[MAX_PATH];
if (client)
strcpy(path, plInstallerReg::GetClientDir());
else
strcpy(path, plInstallerReg::GetMaxDir());
if (plBrowseFolder::GetFolder(path, path))
{
if (client)
{
SetDlgItemText(fDlg, IDC_CLIENT_EDIT, path);
plInstallerReg::SetClientDir(path);
}
else
{
SetDlgItemText(fDlg, IDC_3DSMAX_EDIT, path);
plInstallerReg::SetMaxDir(path);
}
}
}
void plPlasmaInstaller::IAddStatusLine(const char* format, ...)
{
if (!format || *format == '\0')
return;
va_list args;
va_start(args, format);
char buf[2048];
int numWritten = _vsnprintf(buf, sizeof(buf), format, args);
hsAssert(numWritten > 0, "Buffer too small");
va_end(args);
int idx = ListBox_AddString(fStatusList, buf);
ListBox_SetCurSel(fStatusList, idx);
// Pump the message queue
MSG msg;
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (!IsDialogMessage(&msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}

73
Sources/Plasma/Apps/plPlasmaInstaller/plPlasmaInstaller.h

@ -1,73 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "jvBaseDlg.h"
class plPlasmaInstaller : public jvBaseDlg
{
protected:
char fDailyDir[MAX_PATH];
bool fDidGet;
HWND fStatusList;
enum { kBuildMain, kBuildBranch, kBuildActive };
enum { kNightly, kAfternoon, kEvening };
virtual BOOL IDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
bool IGetDailyDir();
void IGetFolder(bool client);
void IGet();
void IInit();
void IExtractZip(const char* filename, const char* dest);
void IAddStatusLine(const char* format, ...);
public:
plPlasmaInstaller();
void Create();
HWND GetHWnd() { return fDlg; }
};

122
Sources/Plasma/Apps/plPlasmaInstaller/plPlasmaInstaller.rc

@ -1,122 +0,0 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define IDC_STATIC (-1) // all static controls
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_INSTALLER DIALOG DISCARDABLE 0, 0, 241, 170
STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "Plasma Installer"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Build:",IDC_STATIC,7,8,18,8
COMBOBOX IDC_TIME_COMBO,27,6,46,167,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
LTEXT "3dsmax Directory:",IDC_STATIC,7,26,57,8
EDITTEXT IDC_3DSMAX_EDIT,7,36,173,12,ES_AUTOHSCROLL | ES_READONLY
PUSHBUTTON "Browse...",IDC_BROWSE_3DSMAX,183,35,50,14
LTEXT "Client Directory:",IDC_STATIC,7,53,50,8
EDITTEXT IDC_CLIENT_EDIT,7,63,173,12,ES_AUTOHSCROLL | ES_READONLY
PUSHBUTTON "Browse...",IDC_BROWSE_CLIENT,183,62,50,14
DEFPUSHBUTTON "Get",IDC_GET_BUTTON,93,146,56,16,WS_DISABLED
LISTBOX IDC_STATUS_LIST,7,85,226,54,LBS_NOSEL | WS_VSCROLL |
WS_TABSTOP
CONTROL "DateTimePicker1",IDC_BRANCH_DATE,"SysDateTimePick32",
DTS_RIGHTALIGN | WS_TABSTOP,125,6,55,12
COMBOBOX IDC_BUILD_COMBO,76,6,46,167,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
CONTROL "Client",IDC_CLIENT_CHECK,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,159,144,33,10
CONTROL "Scripts",IDC_SCRIPTS_CHECK,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,159,154,37,10
CONTROL "Plugins",IDC_PLUGINS_CHECK,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,197,144,39,10
CONTROL "Tools",IDC_TOOLS_CHECK,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,197,154,33,10
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_INSTALLER, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 234
TOPMARGIN, 7
BOTTOMMARGIN, 163
END
END
#endif // APSTUDIO_INVOKED
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON DISCARDABLE "Dirt.ICO"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

120
Sources/Plasma/Apps/plPlasmaInstaller/plSetPlasmaPath.cpp

@ -1,120 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "HeadSpin.h"
#include <windows.h>
static HKEY GetEnvironKey()
{
HKEY hSystemKey = NULL;
HKEY hControlSetKey = NULL;
HKEY hControlKey = NULL;
HKEY hSessionKey = NULL;
HKEY hEnvironKey = NULL;
if ((RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SYSTEM", 0, KEY_READ, &hSystemKey) == ERROR_SUCCESS) &&
(RegOpenKeyEx(hSystemKey, "CurrentControlSet", 0, KEY_READ, &hControlSetKey) == ERROR_SUCCESS) &&
(RegOpenKeyEx(hControlSetKey, "Control", 0, KEY_READ, &hControlKey) == ERROR_SUCCESS) &&
(RegOpenKeyEx(hControlKey, "Session Manager", 0, KEY_READ, &hSessionKey) == ERROR_SUCCESS))
{
RegOpenKeyEx(hSessionKey, "Environment", 0, KEY_READ | KEY_WRITE, &hEnvironKey);
}
if (hSystemKey != NULL)
RegCloseKey(hSystemKey);
if (hControlSetKey != NULL)
RegCloseKey(hControlSetKey);
if (hControlKey != NULL)
RegCloseKey(hControlKey);
if (hSessionKey != NULL)
RegCloseKey(hSessionKey);
return hEnvironKey;
}
void SetPlasmaPath(const char* plasmaPath)
{
bool pathSet = false;
HKEY hEnvironKey = GetEnvironKey();
if (hEnvironKey)
{
// Make sure the PlasmaGameDir var is in the path
DWORD size = 0;
if (ERROR_SUCCESS == RegQueryValueEx(hEnvironKey, "Path", NULL, NULL, NULL, &size))
{
char* oldPath = new char[size];
static const char* kPlasmaVar = "%PlasmaGameDir%";
if (ERROR_SUCCESS == RegQueryValueEx(hEnvironKey, "Path", NULL, NULL, (BYTE*)oldPath, &size))
{
pathSet = (strstr(oldPath, kPlasmaVar) != NULL);
if (!pathSet)
{
char* newPath = new char[size+strlen(kPlasmaVar)+1];
strcpy(newPath, oldPath);
strcat(newPath, ";");
strcat(newPath, kPlasmaVar);
RegSetValueEx(hEnvironKey, "Path", 0, REG_EXPAND_SZ, (BYTE*)newPath, strlen(newPath)+1);
delete [] newPath;
}
}
delete [] oldPath;
}
// Set the PlasmaGameDir var
RegSetValueEx(hEnvironKey, "PlasmaGameDir", 0, REG_SZ, (BYTE*)plasmaPath, strlen(plasmaPath)+1);
// Notify command prompts and stuff that environ changed
DWORD ret;
SendMessageTimeout(HWND_BROADCAST,
WM_SETTINGCHANGE,
0,
(LPARAM)"Environment",
SMTO_ABORTIFHUNG,
5000,
&ret);
}
}

42
Sources/Plasma/Apps/plPlasmaInstaller/plSetPlasmaPath.h

@ -1,42 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
void SetPlasmaPath(const char* plasmaPath);

169
Sources/Plasma/Apps/plPlasmaInstaller/plUnzip.cpp

@ -1,169 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "HeadSpin.h"
#include "plUnzip.h"
#include "hsTypes.h"
#include "hsWindows.h"
#include "hsStream.h"
plUnzip::plUnzip() : fFile(nil)
{
}
bool plUnzip::Open(const char* filename)
{
fFile = unzOpen(filename);
return (fFile != nil);
}
bool plUnzip::Close()
{
bool ret = false;
if (fFile != nil)
{
ret = (UNZ_OK == unzClose(fFile));
fFile = nil;
}
return ret;
}
void plUnzip::IGetFullPath(const char* destDir, const char* filename, char* outFilename)
{
// Make sure the dest ends with a slash
strcpy(outFilename, destDir);
char lastChar = outFilename[strlen(outFilename)-1];
if (lastChar != '\\' && lastChar != '/')
strcat(outFilename, "\\");
// Check if the output filename has any directories in it
const char* forward = strrchr(filename, '/');
const char* backward = strrchr(filename, '\\');
if (!forward && !backward)
{
CreateDirectory(outFilename, NULL);
strcat(outFilename, filename);
}
else
{
const char* fileOnly = (forward > backward) ? forward+1 : backward+1;
strncat(outFilename, filename, fileOnly-filename);
CreateDirectory(outFilename, NULL);
strcat(outFilename, fileOnly);
}
}
void plUnzip::IExtractCurrent(const char* destDir, char* fileName)
{
char filename[MAX_PATH];
if (unzGetCurrentFileInfo(fFile, nil, filename, sizeof(filename), nil, 0, nil, 0) == UNZ_OK)
{
strcpy(fileName, filename);
if (unzOpenCurrentFile(fFile) == UNZ_OK)
{
char outFilename[MAX_PATH];
IGetFullPath(destDir, filename, outFilename);
// Make sure to take off the read-only flag if the file exists, and is RO
DWORD attrs = GetFileAttributes(outFilename);
if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_READONLY))
SetFileAttributes(outFilename, attrs & ~FILE_ATTRIBUTE_READONLY);
hsUNIXStream outFile;
if (outFile.Open(outFilename, "wb"))
{
char buf[2048];
int numRead;
while ((numRead = unzReadCurrentFile(fFile, buf, sizeof(buf))) > 0)
{
outFile.Write(numRead, buf);
}
outFile.Close();
unz_file_info_s info;
unzGetCurrentFileInfo(fFile, &info, NULL, 0, NULL, 0, NULL, 0);
SYSTEMTIME sysTime = {0};
sysTime.wDay = info.tmu_date.tm_mday;
sysTime.wMonth = info.tmu_date.tm_mon+1;
sysTime.wYear = info.tmu_date.tm_year;
sysTime.wHour = info.tmu_date.tm_hour;
sysTime.wMinute = info.tmu_date.tm_min;
sysTime.wSecond = info.tmu_date.tm_sec;
FILETIME localFileTime, utcFileTime;
SystemTimeToFileTime(&sysTime, &localFileTime);
LocalFileTimeToFileTime(&localFileTime, &utcFileTime);
HANDLE hFile = CreateFile(outFilename, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
SetFileTime(hFile, NULL, NULL, &utcFileTime);
CloseHandle(hFile);
}
unzCloseCurrentFile(fFile);
}
}
}
void plUnzip::ExtractAll(const char* destDir)
{
if (unzGoToFirstFile(fFile) != UNZ_OK)
return;
do
{
IExtractCurrent(destDir);
}
while (unzGoToNextFile(fFile) == UNZ_OK);
}
bool plUnzip::ExtractNext(const char* destDir, char* fileName)
{
IExtractCurrent(destDir, fileName);
return (unzGoToNextFile(fFile) == UNZ_OK);
}

66
Sources/Plasma/Apps/plPlasmaInstaller/plUnzip.h

@ -1,66 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef plUnzip_h_inc
#define plUnzip_h_inc
#include "hsTypes.h"
#include "../src/contrib/minizip/unzip.h"
class plUnzip
{
protected:
unzFile fFile;
void IGetFullPath(const char* destDir, const char* filename, char* outFilename);
void IExtractCurrent(const char* destDir, char* fileName=nil);
public:
plUnzip();
bool Open(const char* filename);
bool Close();
void ExtractAll(const char* destDir);
bool ExtractNext(const char* destDir, char* fileName);
};
#endif // plUnzip_h_inc

30
Sources/Plasma/Apps/plPlasmaInstaller/resource.h

@ -1,30 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by plPlasmaInstaller.rc
//
#define IDD_INSTALLER 101
#define IDI_ICON1 102
#define IDC_3DSMAX_EDIT 1000
#define IDC_BROWSE_3DSMAX 1001
#define IDC_TIME_COMBO 1002
#define IDC_CLIENT_EDIT 1003
#define IDC_BROWSE_CLIENT 1004
#define IDC_GET_BUTTON 1005
#define IDC_STATUS_LIST 1006
#define IDC_BRANCH_DATE 1007
#define IDC_BUILD_COMBO 1008
#define IDC_CLIENT_CHECK 1009
#define IDC_SCRIPTS_CHECK 1010
#define IDC_PLUGINS_CHECK 1011
#define IDC_TOOLS_CHECK 1012
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1013
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

BIN
Sources/Plasma/Apps/plPlasmaUpdate/Dirt.ICO

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

67
Sources/Plasma/Apps/plPlasmaUpdate/main.cpp

@ -1,67 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "HeadSpin.h"
#include "plPlasmaUpdate.h"
#include "jvCoreUtil.h"
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
jvCoreUtil::SetHInstance(hInstance);
plPlasmaUpdate installer;
if (!installer.Create())
return 0;
if (!stricmp(lpCmdLine, "AutoDownload"))
installer.SetAutoDownload();
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
if (!jvBaseDlg::IsDialogMessage(&msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return 0;
}

186
Sources/Plasma/Apps/plPlasmaUpdate/plFileGrabber.cpp

@ -1,186 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "plFileGrabber.h"
/* Not needed currently - if we want it again we'll have to reimplement HTTP comm
plHttpFileGrabber::plHttpFileGrabber()
{
fRequestMgr.SetHostname("");
}
bool plHttpFileGrabber::FileToStream(const char* path, hsStream* stream)
{
std::string pathStr(path);
bool retVal = fRequestMgr.GetFileToStream(path, stream);
stream->SetPosition(0);
return retVal;
}
void plHttpFileGrabber::SetServer(const char* server)
{
std::string serverPath(server);
fRequestMgr.SetHostname(serverPath);
}
void plHttpFileGrabber::MakeProperPath(char* path)
{
char* slash = NULL;
do {
slash = strchr(path, '\\');
if (slash)
*slash = '/';
} while(slash != NULL);
}
void plHttpFileGrabber::SetUsernamePassword(const std::string& username, const std::string& password)
{
fRequestMgr.SetUsername(username);
fRequestMgr.SetPassword(password);
}
bool plHttpFileGrabber::IsServerAvailable(const char* serverName)
{
bool retVal = false;
HINTERNET hInternet = InternetOpen("Parable Patcher",INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,0);
if (hInternet)
{
HINTERNET hHttp = InternetConnect(hInternet,serverName,8080,fUserName.c_str(),fPassword.c_str(),INTERNET_SERVICE_HTTP,0,0);
if (hHttp)
{
HINTERNET hRequest = HttpOpenRequest(hHttp, "GET", "/Current/Current.txt", NULL, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_KEEP_CONNECTION, 0);
if (hRequest)
{
DWORD dwCode;
DWORD dwSize = sizeof(dwCode);
HttpSendRequest(hRequest, NULL, 0, NULL, 0);
HttpQueryInfo(hRequest, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &dwCode, &dwSize, NULL);
if (dwCode >= 200 && dwCode < 300)
{
retVal = true;
}
InternetCloseHandle(hRequest);
}
InternetCloseHandle(hHttp);
}
InternetCloseHandle(hInternet);
}
return retVal;
}
*/
plNetShareFileGrabber::plNetShareFileGrabber()
{
}
#define BUFFER_SIZE 1024*1024
bool plNetShareFileGrabber::FileToStream(const char* path, hsStream* stream)
{
hsUNIXStream fileStream;
std::string filePath = fServerName + path;
if (fileStream.Open(filePath.c_str()))
{
char* buffer = new char[BUFFER_SIZE];
uint32_t streamSize = fileStream.GetSizeLeft();
while (streamSize > (BUFFER_SIZE))
{
fileStream.Read(BUFFER_SIZE, buffer);
stream->Write(BUFFER_SIZE, buffer);
streamSize = fileStream.GetSizeLeft();
}
if (streamSize > 0)
{
fileStream.Read(streamSize, buffer);
stream->Write(streamSize, buffer);
}
stream->Rewind();
fileStream.Close();
delete [] buffer;
return true;
}
return false;
}
void plNetShareFileGrabber::SetServer(const char* server)
{
fServerName = "\\\\";
fServerName += server;
}
void plNetShareFileGrabber::MakeProperPath(char* path)
{
char* slash = NULL;
do {
slash = strchr(path, '/');
if (slash)
*slash = '\\';
} while(slash != NULL);
}
bool plNetShareFileGrabber::IsServerAvailable(const char* serverName, const char* currentDir)
{
bool retVal = false;
char serverPath[MAX_PATH];
sprintf(serverPath, "\\\\%s\\%s\\Current.txt", serverName, currentDir);
hsUNIXStream si;
if (si.Open(serverPath, "rb"))
{
retVal = true;
si.Close();
}
return retVal;
}

89
Sources/Plasma/Apps/plPlasmaUpdate/plFileGrabber.h

@ -1,89 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef plFileGrabber_h_inc
#define plFileGrabber_h_inc
#include <string>
#include "hsStream.h"
class plFileGrabber
{
public:
virtual bool IsServerAvailable(const char* serverName, const char* currentDir) = 0;
virtual bool FileToStream(const char* path, hsStream* stream) = 0;
virtual void SetServer(const char* server) = 0;
virtual void MakeProperPath(char* path) = 0;
virtual bool NeedsAuth() { return false; }
virtual void SetUsernamePassword(const std::string& username, const std::string& password) {}
};
/* Not needed currently - if we want it again we'll have to reimplement HTTP comm
class plHttpFileGrabber : public plFileGrabber
{
private:
plHttpDiverseRequestMgr fRequestMgr;
public:
plHttpFileGrabber();
virtual bool IsServerAvailable(const char* serverName);
virtual bool FileToStream(const char* path, hsStream* stream);
virtual void SetServer(const char* server);
virtual void MakeProperPath(char* path);
virtual bool NeedsAuth() { return true; }
virtual void SetUsernamePassword(const std::string& username, const std::string& password);
};
*/
class plNetShareFileGrabber : public plFileGrabber
{
private:
std::string fServerName;
public:
plNetShareFileGrabber();
virtual bool IsServerAvailable(const char* serverName, const char* currentDir);
virtual bool FileToStream(const char* path, hsStream* stream);
virtual void SetServer(const char* server);
virtual void MakeProperPath(char* path);
};
#endif

361
Sources/Plasma/Apps/plPlasmaUpdate/plManifest.cpp

@ -1,361 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "HeadSpin.h"
#include "plManifest.h"
#include "../pnEncryption/plChecksum.h"
#include "../plCompression/plZlibStream.h"
#include "../plFile/plEncryptedStream.h"
#include "../plFile/plFileUtils.h"
#include "../plUnifiedTime/plUnifiedTime.h"
class plManifestFile
{
public:
char* fFilename;
plMD5Checksum fSum;
plMD5Checksum fLocalSum;
uint32_t fSize;
uint32_t fCompressedSize;
uint32_t fFlags;
};
plManifest::plManifest(LogFunc log) :
fDownloadFiles(0),
fDownloadBytes(0),
fDirtySums(false),
fLog(log)
{
}
plManifest::~plManifest()
{
if (fDirtySums)
IWriteCache();
delete [] fManifestName;
for (int i = 0; i < fFiles.size(); i++)
{
delete [] fFiles[i]->fFilename;
delete fFiles[i];
}
}
bool plManifest::Read(hsStream* mfsStream, const char* basePath, const char* mfsName)
{
fBasePath = basePath;
fManifestName = hsStrcpy(mfsName);
fLog("--- Reading manifest for %s", fManifestName);
char buf[256];
while (mfsStream->ReadLn(buf, sizeof(buf)))
{
plManifestFile* file = new plManifestFile;
char* tok = strtok(buf, "\t");
file->fFilename = hsStrcpy(tok);
tok = strtok(nil, "\t");
file->fSum.SetFromHexString(tok);
tok = strtok(nil, "\t");
file->fSize = atoi(tok);
tok = strtok(nil, "\t");
file->fCompressedSize = atoi(tok);
tok = strtok(nil, "\t");
file->fFlags = atoi(tok);
fFiles.push_back(file);
}
return true;
}
void plManifest::ValidateFiles(ProgressFunc progress)
{
if (fFiles.empty())
return;
fLog("--- Validating files for %s", fManifestName);
IReadCache(progress);
fDownloadFiles = 0;
fDownloadBytes = 0;
for (int i = 0; i < fFiles.size(); i++)
{
plManifestFile* file = fFiles[i];
// If the local checksum is invalid, this file wasn't in our cache.
// Get the sum, and update the progress bar.
if (!file->fLocalSum.IsValid())
{
fLog(" No sum for %s, calculating", file->fFilename);
file->fLocalSum.CalcFromFile(file->fFilename);
fDirtySums = true;
progress(file->fFilename, 1);
}
if (file->fLocalSum != file->fSum)
{
fLog(" Incorrect sum for %s", file->fFilename);
fDownloadFiles++;
fDownloadBytes += file->fCompressedSize;
}
}
fLog("--- Need to download %d files, %.1f MB", fDownloadFiles, float(fDownloadBytes) / (1024.f*1024.f));
}
void plManifest::DownloadUpdates(ProgressFunc progress, plFileGrabber* grabber)
{
for (int i = 0; i < fFiles.size(); i++)
{
plManifestFile* file = fFiles[i];
if (file->fLocalSum != file->fSum)
{
char serverPath[MAX_PATH];
sprintf(serverPath, "%s%s.gz", fBasePath.c_str(), file->fFilename);
grabber->MakeProperPath(serverPath);
hsRAMStream serverStream;
if (grabber->FileToStream(serverPath, &serverStream))
{
plFileUtils::EnsureFilePathExists(file->fFilename);
plFileUtils::RemoveFile(file->fFilename, true);
plZlibStream localStream;
if (localStream.Open(file->fFilename, "wb"))
{
char dataBuf[1024];
uint32_t sizeLeft = serverStream.GetSizeLeft();
while (uint32_t amtRead = serverStream.Read( (sizeof(dataBuf) > sizeLeft) ? sizeLeft : sizeof(dataBuf), dataBuf))
{
progress(file->fFilename, amtRead);
localStream.Write(amtRead, dataBuf);
sizeLeft = serverStream.GetSizeLeft();
}
localStream.Close();
// FIXME - Should we recalc this?
file->fLocalSum = file->fSum;
fDirtySums = true;
if (file->fFlags != 0)
IDecompressSound(file);
}
}
}
}
}
plManifestFile* plManifest::IFindFile(const char* name)
{
// FIXME
for (int i = 0; i < fFiles.size(); i++)
{
if (hsStrEQ(fFiles[i]->fFilename, name))
return fFiles[i];
}
return nil;
}
// KLUDGE - Put age checksums in the dat dir, for backwards compatability
const char* plManifest::IGetCacheDir()
{
const char* prefix = "";
if (strncmp(fFiles[0]->fFilename, "dat\\", strlen("dat\\")) == 0)
return "dat\\";
else
return "";
}
#define kCacheFileVersion 1
void plManifest::IWriteCache()
{
plEncryptedStream s;
bool openedFile = false;
uint32_t numFiles = 0;
for (int i = 0; i < fFiles.size(); i++)
{
plManifestFile* file = fFiles[i];
plUnifiedTime modifiedTime;
if (file->fLocalSum.IsValid() &&
plFileUtils::GetFileTimes(file->fFilename, nil, &modifiedTime))
{
if (!openedFile)
{
openedFile = true;
char buf[256];
sprintf(buf, "%s%s.sum", IGetCacheDir(), fManifestName);
s.Open(buf, "wb");
s.WriteSwap32(0);
s.WriteSwap32(kCacheFileVersion);
}
s.WriteSafeString(file->fFilename);
plMD5Checksum& checksum = file->fLocalSum;
s.Write(checksum.GetSize(), checksum.GetValue());
modifiedTime.Write(&s);
numFiles++;
}
}
if (openedFile)
{
s.Rewind();
s.WriteSwap32(numFiles);
s.Close();
}
}
void plManifest::IReadCache(ProgressFunc progress)
{
//
// Load valid cached checksums
//
char buf[256];
sprintf(buf, "%s%s.sum", IGetCacheDir(), fManifestName);
hsStream* s = plEncryptedStream::OpenEncryptedFile(buf);
if (s)
{
uint32_t numCached = s->ReadSwap32();
uint32_t cacheFileVersion = s->ReadSwap32();
if (cacheFileVersion != kCacheFileVersion)
{
s->Close();
delete s;
return;
}
fLog(" Reading cache...found %d cached sums", numCached);
for (int i = 0; i < numCached; i++)
{
char* name = s->ReadSafeString();
uint8_t checksumBuf[MD5_DIGEST_LENGTH];
s->Read(sizeof(checksumBuf), checksumBuf);
plMD5Checksum checksum;
checksum.SetValue(checksumBuf);
plUnifiedTime modifiedTime;
modifiedTime.Read(s);
plManifestFile* file = IFindFile(name);
if (file)
{
plUnifiedTime curModifiedTime;
if (plFileUtils::GetFileTimes(file->fFilename, nil, &curModifiedTime))
{
if (curModifiedTime == modifiedTime)
file->fLocalSum = checksum;
else
fLog(" Invalid modified time for %s", name);
}
else
fLog(" Couldn't get modified time for %s", name);
progress(file->fFilename, 1);
}
else
fLog(" Couldn't find cached file '%s' in manifest, discarding", name);
delete [] name;
}
s->Close();
delete s;
}
}
#include "../plAudioCore/plAudioFileReader.h"
#include "../plAudio/plOGGCodec.h"
#include "../plAudio/plWavFile.h"
bool plManifest::IDecompressSound(plManifestFile* file)
{
enum
{
kSndFlagCacheSplit = 1<<0,
kSndFlagCacheStereo = 1<<2,
};
if (hsCheckBits(file->fFlags, kSndFlagCacheSplit) ||
hsCheckBits(file->fFlags, kSndFlagCacheStereo))
{
plAudioFileReader* reader = plAudioFileReader::CreateReader(file->fFilename, plAudioCore::kAll, plAudioFileReader::kStreamNative);
if (!reader)
return false;
uint32_t size = reader->GetDataSize();
delete reader;
if (hsCheckBits(file->fFlags, kSndFlagCacheSplit))
plAudioFileReader::CacheFile(file->fFilename, true);
if (hsCheckBits(file->fFlags, kSndFlagCacheStereo))
plAudioFileReader::CacheFile(file->fFilename, false);
}
return true;
}

93
Sources/Plasma/Apps/plPlasmaUpdate/plManifest.h

@ -1,93 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef plManifest_h_inc
#define plManifest_h_inc
#include "HeadSpin.h"
#include "plFileGrabber.h"
#include <vector>
#include <string>
class plManifestFile;
typedef void (*ProgressFunc)(const char* name, int progDelta);
typedef void (*LogFunc)(const char* format, ...);
class plManifest
{
protected:
std::string fBasePath;
char* fManifestName;
typedef std::vector<plManifestFile*> FileVec;
FileVec fFiles;
uint32_t fDownloadFiles;
uint32_t fDownloadBytes;
bool fDirtySums;
LogFunc fLog;
bool IDecompressSound(plManifestFile* file);
plManifestFile* IFindFile(const char* name);
const char* IGetCacheDir();
void IReadCache(ProgressFunc progress);
void IWriteCache();
public:
plManifest(LogFunc log);
~plManifest();
bool Read(hsStream* mfsStream, const char* basePath, const char* mfsName);
void ValidateFiles(ProgressFunc progress);
void DownloadUpdates(ProgressFunc progress, plFileGrabber* grabber);
int NumFiles() { return fFiles.size(); }
uint32_t NumDownloadFiles() { return fDownloadFiles; }
uint32_t DownloadSize() { return fDownloadBytes; }
};
#endif // plManifest_h_inc

94
Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.cpp

@ -1,94 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "plPlasmaServers.h"
#include "hsStream.h"
bool plPlasmaServers::GetServerInfo()
{
bool ret = true;
hsUNIXStream si;
if (si.Open("\\\\dirtcake\\ServerInfo\\ServerInfo.txt", "rb"))
{
char line[256];
// Make sure we've got the latest version
if (si.ReadLn(line, sizeof(line)))
{
int version = atoi(line);
si.ReadLn(line, sizeof(line));
if (version != 4)
{
char errorMsg[512];
sprintf(errorMsg, "This installer is out of date.\nPlease get the latest version from:\n\n%s", line);
hsMessageBox(errorMsg, "Error", hsMessageBoxNormal, hsMessageBoxIconError);
ret = false;
}
}
else
ret = false;
// Read in the servers, one per line
while (ret && si.ReadLn(line, sizeof(line)))
{
ServerInfo info;
info.fServerAddress = strtok(line, ",");
info.fServerName = strtok(nil, ",");
info.fURLBase = strtok(nil, ",");
info.fOutputDir = strtok(nil, ",");
info.fCurrentDir = strtok(nil, ",");
info.fCodeDir = strtok(nil, ",");
fServers.push_back(info);
}
si.Close();
}
else
{
hsMessageBox("Couldn't find server info", "Error", hsMessageBoxNormal, hsMessageBoxIconError);
ret = false;
}
return ret;
}

75
Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.h

@ -1,75 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef plPlasmaServers_h_inc
#define plPlasmaServers_h_inc
#include "HeadSpin.h"
#include <vector>
class plPlasmaServers
{
protected:
class ServerInfo
{
public:
std::string fServerAddress;
std::string fServerName;
std::string fURLBase;
std::string fOutputDir;
std::string fCurrentDir;
std::string fCodeDir;
};
std::vector<ServerInfo> fServers;
public:
bool GetServerInfo();
int GetNumServers() { return fServers.size(); }
std::string& GetServerAddress(int i) { return fServers[i].fServerAddress; }
std::string& GetServerName(int i) { return fServers[i].fServerName; }
std::string& GetServerURLBase(int i) { return fServers[i].fURLBase; }
std::string& GetServerOutputDir(int i) { return fServers[i].fOutputDir; }
std::string& GetServerCurrentDir(int i) { return fServers[i].fCurrentDir; }
std::string& GetServerCodeDir(int i) { return fServers[i].fCodeDir; }
};
#endif // plPlasmaServers_h_inc

514
Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.cpp

@ -1,514 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "HeadSpin.h"
#include "plPlasmaUpdate.h"
#include "resource.h"
#include <windowsx.h>
#include <commctrl.h>
#include <direct.h>
#include "jvCoreUtil.h"
#include "jvDialogResizer.h"
#include "hsTypes.h"
#include "../plFile/plFileUtils.h"
#include "../plUnifiedTime/plUnifiedTime.h"
#include "hsStream.h"
#include "plManifest.h"
#include "../plStatusLog/plStatusLog.h"
static plPlasmaUpdate* gInst = nil;
#define WM_UPDATE_SERVER WM_APP+1
std::string plPlasmaUpdate::fUserName = "dataserver";
std::string plPlasmaUpdate::fPassword = "parabledata";
plPlasmaUpdate::plPlasmaUpdate() : fCanExit(true), fProgressType(kValidating), fResizer(nil), fAutoDownload(false)
{
INITCOMMONCONTROLSEX icc = {0};
icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
icc.dwICC = ICC_PROGRESS_CLASS;
InitCommonControlsEx(&icc);
gInst = this;
_getcwd(fIniPath, sizeof(fIniPath));
char lastChar = fIniPath[strlen(fIniPath)];
if (lastChar != '\\' && lastChar != '/')
strcat(fIniPath, "\\");
strcat(fIniPath, "ParableUpdate.ini");
fFileGrabber = new plNetShareFileGrabber;
}
plPlasmaUpdate::~plPlasmaUpdate()
{
delete fResizer;
if (fFileGrabber)
delete fFileGrabber;
}
bool plPlasmaUpdate::Create()
{
if (!fServers.GetServerInfo())
return false;
ICreateDialog(IDD_UPDATE, NULL);
return true;
}
BOOL CALLBACK plPlasmaUpdate::ILoginWinProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch( msg )
{
case WM_INITDIALOG:
SetFocus(GetDlgItem(hDlg, IDC_USERNAME));
break;
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED && (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL))
{
bool ok = (LOWORD(wParam) == IDOK);
if (ok)
{
char username[25];
char password[25];
GetDlgItemText(hDlg, IDC_USERNAME, username, 25);
GetDlgItemText(hDlg, IDC_PASSWORD, password, 25);
fUserName = username;
hsAssert(false, "who uses this program?");
// plChallengeResponse::HashPassword(password, fPassword);
}
EndDialog(hDlg, ok);
return TRUE;
}
break;
}
return FALSE;
}
void plPlasmaUpdate::IInit()
{
char curServerAddress[256];
GetPrivateProfileString("PlasmaUpdate", "ServerAddress", "", curServerAddress, sizeof(curServerAddress), fIniPath);
bool external = (GetPrivateProfileInt("PlasmaUpdate", "External", 0, fIniPath) != 0);
HWND hCombo = GetDlgItem(fDlg, IDC_BUILD_COMBO);
for (int i = 0; i < fServers.GetNumServers(); i++)
{
std::string& serverAddress = fServers.GetServerAddress(i);
std::string& serverName = fServers.GetServerName(i);
std::string& currentDir = fServers.GetServerCurrentDir(i);
if (!fFileGrabber->IsServerAvailable(serverAddress.c_str(), currentDir.c_str()))
continue;
bool thisServer = (serverAddress == curServerAddress);
int idx = ComboBox_AddString(hCombo, serverName.c_str());
ComboBox_SetItemData(hCombo, idx, MAKELPARAM(i, 0));
if (thisServer && !external)
ComboBox_SetCurSel(hCombo, idx);
std::string extName = serverName + " (External)";
idx = ComboBox_AddString(hCombo, extName.c_str());
ComboBox_SetItemData(hCombo, idx, MAKELPARAM(i, 1));
if (thisServer && external)
ComboBox_SetCurSel(hCombo, idx);
}
if (ComboBox_GetCurSel(hCombo) == -1)
ComboBox_SetCurSel(hCombo, 0);
SendMessage(fDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(jvCoreUtil::GetHInstance(), MAKEINTRESOURCE(IDI_ICON)));
SendMessage(fDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(jvCoreUtil::GetHInstance(), MAKEINTRESOURCE(IDI_ICON)));
fResizer = new jvDialogResizer(fDlg);
fResizer->AddControl(IDC_BUILD_COMBO, jvDialogResizer::kResizeX);
fResizer->AddControl(IDC_STATUS_LIST, jvDialogResizer::kResizeX | jvDialogResizer::kResizeY);
fResizer->AddControl(IDC_PROGRESS, jvDialogResizer::kLockBottom | jvDialogResizer::kResizeX);
fResizer->AddControl(IDC_DL_TEXT, jvDialogResizer::kLockBottom | jvDialogResizer::kResizeX);
fResizer->AddControl(IDC_DL_BUTTON, jvDialogResizer::kLockBottom | jvDialogResizer::kCenterX);
fResizer->SetSize(360, 320);
fResizer->LoadPosAndSize("PlasmaUpdate");
bool goTime = true;
if (fFileGrabber->NeedsAuth())
{
/*
if (!DialogBox(NULL, MAKEINTRESOURCE(IDD_PLASMAUPDATE_LOGIN), fDlg, ILoginWinProc))
goTime = false;
else
*/
fFileGrabber->SetUsernamePassword(fUserName, fPassword);
}
if (goTime)
{
ShowWindow(fDlg, SW_SHOW);
PostMessage(fDlg, WM_UPDATE_SERVER, 0, 0);
}
else
PostQuitMessage(0);
}
void plPlasmaUpdate::IShutdown()
{
fResizer->SavePosAndSize("PlasmaUpdate");
delete fResizer;
fResizer = NULL;
IDeleteManifests();
}
void plPlasmaUpdate::IEnableCtrls(bool enable)
{
fCanExit = enable;
EnableWindow(GetDlgItem(fDlg, IDC_BUILD_COMBO), enable);
HWND hDlButton = GetDlgItem(fDlg, IDC_DL_BUTTON);
if (fManifests.empty())
SetWindowText(hDlButton, "Close");
else
SetWindowText(hDlButton, "Download");
EnableWindow(hDlButton, enable);
if (enable)
SetFocus(hDlButton);
}
void plPlasmaUpdate::IDeleteManifests()
{
for (int i = 0; i < fManifests.size(); i++)
delete fManifests[i];
fManifests.clear();
}
bool plPlasmaUpdate::IGetManifests(const char* serverRoot, bool external)
{
IDeleteManifests();
char filePath[MAX_PATH];
sprintf(filePath, "%sCurrent.txt", serverRoot);
enum Sections
{
kVersion,
kInternal,
kExternal,
kAll
};
int curSection = kVersion;
hsRAMStream s;
hsRAMStream manifestStream;
if (fFileGrabber->FileToStream(filePath, &s))
{
char buf[256];
while (s.ReadLn(buf, sizeof(buf)))
{
if (buf[0] == '[')
{
if (hsStrEQ(buf, "[Version]"))
curSection = kVersion;
else if (hsStrEQ(buf, "[Internal]"))
curSection = kInternal;
else if (hsStrEQ(buf, "[External]"))
curSection = kExternal;
else if (hsStrEQ(buf, "[All]"))
curSection = kAll;
}
else
{
if (curSection == kVersion)
{
int version = atoi(buf);
if (version != 1)
{
hsMessageBox("Your copy of PlasmaUpdate is out of date.\nPlease get the latest version.", "Error", hsMessageBoxNormal, hsMessageBoxIconError);
return false;
}
}
else if ((!external && curSection == kInternal)
|| (external && curSection == kExternal)
|| curSection == kAll)
{
//if (curSection == kAll && !(!strcmp(buf, "Data\\Movies.mfs") || !strcmp(buf, "Data\\Sounds.mfs")))
// continue;
sprintf(filePath, "%s%s", serverRoot, buf);
fFileGrabber->MakeProperPath(filePath);
manifestStream.Reset();
fFileGrabber->FileToStream(filePath, &manifestStream);
plFileUtils::StripFile(filePath);
plManifest* manifest = new plManifest(ILog);
manifest->Read(&manifestStream, filePath, buf);
fManifests.push_back(manifest);
}
}
}
return true;
}
return false;
}
void plPlasmaUpdate::IUpdateServer()
{
char buf[256];
IEnableCtrls(false);
SetDlgItemText(fDlg, IDC_DL_TEXT, "Checking for updates...");
//
// Figure out what server we're checking
//
bool external = false;
char serverRoot[MAX_PATH];
{
HWND hCombo = GetDlgItem(fDlg, IDC_BUILD_COMBO);
int idx = ComboBox_GetCurSel(hCombo);
LPARAM data = ComboBox_GetItemData(hCombo, idx);
int server = LOWORD(data);
external = (HIWORD(data) != 0);
sprintf(serverRoot, "/%s/", fServers.GetServerCurrentDir(server).c_str());
const char* serverName = fServers.GetServerAddress(server).c_str();
ILog("===== Server set to %s %s =====", serverName, external ? "external" : "internal");
WritePrivateProfileString("PlasmaUpdate", "ServerAddress", serverName, fIniPath);
WritePrivateProfileString("PlasmaUpdate", "External", external ? "1" : "0", fIniPath);
fFileGrabber->SetServer(serverName);
}
//
// Get the latest publish notes
//
{
HWND hList = GetDlgItem(fDlg, IDC_STATUS_LIST);
ListBox_ResetContent(hList);
char updateFile[MAX_PATH];
if (external)
sprintf(updateFile, "%sUpdates-External.txt", serverRoot);
else
sprintf(updateFile, "%sUpdates-Internal.txt", serverRoot);
hsRAMStream updates;
fFileGrabber->MakeProperPath(updateFile);
if (fFileGrabber->FileToStream(updateFile, &updates))
{
while (updates.ReadLn(buf, sizeof(buf)))
ListBox_InsertString(hList, 0, buf);
}
}
//
// Get the manifests
//
bool gotManifests = IGetManifests(serverRoot, external);
uint32_t dlSize = 0;
fProgressType = kValidating;
if (gotManifests)
{
int i;
uint32_t numFiles = 0;
for (i = 0; i < fManifests.size(); i++)
numFiles += fManifests[i]->NumFiles();
HWND hProgress = GetDlgItem(fDlg, IDC_PROGRESS);
SendMessage(hProgress, PBM_SETRANGE32, 0, numFiles);
for (i = 0; i < fManifests.size(); i++)
{
fManifests[i]->ValidateFiles(ProgressFunc);
dlSize += fManifests[i]->DownloadSize();
}
SendMessage(hProgress, PBM_SETPOS, 0, 0);
}
// Print how many megs there are to download
if (dlSize == 0)
{
strcpy(buf, "No updates to download");
IDeleteManifests();
}
else
{
float dlMegs = float(dlSize) / (1024.f*1024.f);
if (dlMegs < .1)
dlMegs = .1;
sprintf(buf, "%.1f MB of updates to download", dlMegs);
}
SetDlgItemText(fDlg, IDC_DL_TEXT, buf);
IEnableCtrls(true);
if (fAutoDownload)
PostMessage(fDlg, WM_COMMAND, MAKEWPARAM(IDC_DL_BUTTON, BN_CLICKED), LPARAM(GetDlgItem(fDlg, IDC_DL_BUTTON)));
}
void plPlasmaUpdate::IDownloadUpdates()
{
fProgressType = kDownloading;
IEnableCtrls(false);
int i;
uint32_t dlSize = 0;
for (i = 0; i < fManifests.size(); i++)
dlSize += fManifests[i]->DownloadSize();
HWND hProgress = GetDlgItem(fDlg, IDC_PROGRESS);
SendMessage(hProgress, PBM_SETRANGE32, 0, dlSize);
for (i = 0; i < fManifests.size(); i++)
fManifests[i]->DownloadUpdates(ProgressFunc, fFileGrabber);
SendMessage(hProgress, PBM_SETPOS, 0, 0);
EnableWindow(GetDlgItem(fDlg, IDC_DL_BUTTON), false);
SetDlgItemText(fDlg, IDC_DL_TEXT, "No updates to download");
IDeleteManifests();
IEnableCtrls(true);
if (fAutoDownload)
PostMessage(fDlg, WM_COMMAND, MAKEWPARAM(IDC_DL_BUTTON, BN_CLICKED), LPARAM(GetDlgItem(fDlg, IDC_DL_BUTTON)));
}
void plPlasmaUpdate::ProgressFunc(const char* name, int delta)
{
static const char* lastName = nil;
if (lastName != name)
{
lastName = name;
char buf[256];
if (gInst->fProgressType == kValidating)
strcpy(buf, "Checking ");
else
strcpy(buf, "Downloading ");
strcat(buf, name);
SetDlgItemText(gInst->fDlg, IDC_DL_TEXT, buf);
}
SendDlgItemMessage(gInst->fDlg, IDC_PROGRESS, PBM_DELTAPOS, delta, 0);
jvBaseDlg::PumpQueue();
}
void plPlasmaUpdate::ILog(const char* format, ...)
{
static plStatusLog* log = nil;
if (!log)
log = plStatusLogMgr::GetInstance().CreateStatusLog(0, "PlasmaUpdate.log");
va_list args;
va_start(args, format);
log->AddLineV(format, args);
va_end(args);
}
BOOL plPlasmaUpdate::IDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_INITDIALOG:
IInit();
SetFocus(GetDlgItem(fDlg, IDC_DL_BUTTON));
return FALSE;
case WM_CLOSE:
if (fCanExit)
DestroyWindow(hDlg);
return TRUE;
case WM_DESTROY:
IShutdown();
PostQuitMessage(0);
return TRUE;
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_DL_BUTTON)
{
if (fManifests.empty())
SendMessage(fDlg, WM_CLOSE, 0, 0);
else
IDownloadUpdates();
return TRUE;
}
else if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_BUILD_COMBO)
{
IUpdateServer();
return TRUE;
}
break;
case WM_UPDATE_SERVER:
IUpdateServer();
return TRUE;
}
return FALSE;
}

94
Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.h

@ -1,94 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "hsTypes.h"
#include "jvBaseDlg.h"
#include <vector>
#include <string>
#include "plPlasmaServers.h"
#include "plFileGrabber.h"
class plManifest;
class jvDialogResizer;
class plPlasmaUpdate : public jvBaseDlg
{
protected:
static BOOL CALLBACK ILoginWinProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static std::string fUserName;
static std::string fPassword;
std::vector<plManifest*> fManifests;
char fIniPath[MAX_PATH];
bool fCanExit;
enum ProgressType { kValidating, kDownloading };
ProgressType fProgressType;
jvDialogResizer* fResizer;
plPlasmaServers fServers;
bool fAutoDownload;
plFileGrabber* fFileGrabber;
void IInit();
void IShutdown();
bool IReadServerInfo();
void IEnableCtrls(bool enable);
BOOL IDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static void ProgressFunc(const char* name, int delta);
static void ILog(const char* format, ...);
void IUpdateServer();
void IDeleteManifests();
bool IGetManifests(const char* serverRoot, bool external);
void IDownloadUpdates();
public:
plPlasmaUpdate();
virtual ~plPlasmaUpdate();
bool Create();
void SetAutoDownload() { fAutoDownload = true; }
};

131
Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.rc

@ -1,131 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define IDC_STATIC (-1) // all static controls
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_UPDATE DIALOGEX 0, 0, 128, 105
STYLE DS_SETFONT | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU |
WS_THICKFRAME
CAPTION "Parable Update"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
LTEXT "Build:",IDC_STATIC,7,8,18,8
COMBOBOX IDC_BUILD_COMBO,27,6,90,167,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "Download",IDC_DL_BUTTON,34,86,56,16,WS_DISABLED
LISTBOX IDC_STATUS_LIST,7,36,110,11,LBS_NOINTEGRALHEIGHT |
LBS_NOSEL | WS_VSCROLL | WS_TABSTOP
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER |
0x1,7,54,110,16
LTEXT "Latest Updates:",IDC_STATIC,7,26,51,8
CONTROL "xx.x MB of updates to download",IDC_DL_TEXT,"Static",
SS_LEFTNOWORDWRAP | WS_GROUP,7,74,110,8
END
IDD_PLASMAUPDATE_LOGIN DIALOGEX 0, 0, 150, 102
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "Login"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,48,62,50,14
PUSHBUTTON "Cancel",IDCANCEL,48,80,50,14
EDITTEXT IDC_USERNAME,7,17,135,12,ES_AUTOHSCROLL
EDITTEXT IDC_PASSWORD,7,45,135,12,ES_PASSWORD | ES_AUTOHSCROLL
LTEXT "Username",IDC_STATIC,7,7,134,8
LTEXT "Password",IDC_STATIC,7,35,136,10
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_UPDATE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 121
TOPMARGIN, 7
BOTTOMMARGIN, 98
END
IDD_PLASMAUPDATE_LOGIN, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 143
TOPMARGIN, 7
BOTTOMMARGIN, 95
END
END
#endif // APSTUDIO_INVOKED
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON ICON "Dirt.ICO"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

27
Sources/Plasma/Apps/plPlasmaUpdate/resource.h

@ -1,27 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by plPlasmaUpdate.rc
//
#define IDD_UPDATE 101
#define IDI_ICON1 102
#define IDI_ICON 102
#define IDD_PLASMAUPDATE_LOGIN 103
#define IDC_DL_BUTTON 1005
#define IDC_STATUS_LIST 1006
#define IDC_BUILD_COMBO 1008
#define IDC_PROGRESS 1014
#define IDC_DL_TEXT 1015
#define IDC_EDIT1 1016
#define IDC_USERNAME 1016
#define IDC_PASSWORD 1017
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 104
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1018
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
Loading…
Cancel
Save