diff --git a/Sources/Plasma/Apps/plClient/CMakeLists.txt b/Sources/Plasma/Apps/plClient/CMakeLists.txt index d47f034e..55e903c7 100644 --- a/Sources/Plasma/Apps/plClient/CMakeLists.txt +++ b/Sources/Plasma/Apps/plClient/CMakeLists.txt @@ -80,7 +80,6 @@ target_link_libraries(plClient pfConditional) target_link_libraries(plClient pfConsole) target_link_libraries(plClient pfConsoleCore) target_link_libraries(plClient pfCrashHandler) -target_link_libraries(plClient pfCsrSrv) target_link_libraries(plClient pfGameGUIMgr) target_link_libraries(plClient pfGameMgr) target_link_libraries(plClient pfGameScoreMgr) @@ -138,7 +137,6 @@ target_link_libraries(plClient plVault) target_link_libraries(plClient pnAddrInfo) target_link_libraries(plClient pnAsyncCore) target_link_libraries(plClient pnAsyncCoreExe) -target_link_libraries(plClient pnCsrNet) target_link_libraries(plClient pnDispatch) target_link_libraries(plClient pnEncryption) target_link_libraries(plClient pnFactory) @@ -154,7 +152,6 @@ target_link_libraries(plClient pnNetProtocol) target_link_libraries(plClient pnNucleusInc) target_link_libraries(plClient pnProduct) target_link_libraries(plClient pnSceneObject) -target_link_libraries(plClient pnSimpleNet) target_link_libraries(plClient pnTimer) target_link_libraries(plClient pnUtils) target_link_libraries(plClient pnUtilsExe) diff --git a/Sources/Plasma/Apps/plClient/plClient.cpp b/Sources/Plasma/Apps/plClient/plClient.cpp index d4bbe01c..c4edea69 100644 --- a/Sources/Plasma/Apps/plClient/plClient.cpp +++ b/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" @@ -156,8 +155,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pfSecurePreloader/pfSecurePreloader.h" #include "pfLocalizationMgr/pfLocalizationMgr.h" -#include "pfCsrSrv/pfCsrSrv.h" - #include "plTweak.h" #define MSG_LOADING_BAR @@ -263,8 +260,6 @@ hsBool plClient::Shutdown() plSynchEnabler ps(false); // disable dirty state tracking during shutdown delete fProgressBar; - CsrSrvShutdown(); - // Just in case, clear this out (trying to fix a crash bug where this is still active at shutdown) plDispatch::SetMsgRecieveCallback(nil); @@ -2544,8 +2539,6 @@ void plClient::ICompleteInit () { plClientMsg* clientMsg = new plClientMsg(plClientMsg::kInitComplete); clientMsg->SetBCastFlag(plMessage::kBCastByType); clientMsg->Send(); - - CsrSrvInitialize(); } //============================================================================ diff --git a/Sources/Plasma/Apps/plClientKey/DllMain.cpp b/Sources/Plasma/Apps/plClientKey/DllMain.cpp deleted file mode 100644 index 2ec9652c..00000000 --- a/Sources/Plasma/Apps/plClientKey/DllMain.cpp +++ /dev/null @@ -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 . - -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 - -__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; -} diff --git a/Sources/Plasma/Apps/plClientKey/plClientKey.cpp b/Sources/Plasma/Apps/plClientKey/plClientKey.cpp deleted file mode 100644 index 370c43bd..00000000 --- a/Sources/Plasma/Apps/plClientKey/plClientKey.cpp +++ /dev/null @@ -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 . - -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; -} - diff --git a/Sources/Plasma/Apps/plClientKey/plClientKey.def b/Sources/Plasma/Apps/plClientKey/plClientKey.def deleted file mode 100644 index 9c464390..00000000 --- a/Sources/Plasma/Apps/plClientKey/plClientKey.def +++ /dev/null @@ -1,5 +0,0 @@ -LIBRARY -EXPORTS - GetKey @1 -SECTIONS - .data READ WRITE diff --git a/Sources/Plasma/Apps/plClientKey/plClientKey.h b/Sources/Plasma/Apps/plClientKey/plClientKey.h deleted file mode 100644 index 4c4faca2..00000000 --- a/Sources/Plasma/Apps/plClientKey/plClientKey.h +++ /dev/null @@ -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 . - -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 \ No newline at end of file diff --git a/Sources/Plasma/Apps/plPlasmaInstaller/Dirt.ICO b/Sources/Plasma/Apps/plPlasmaInstaller/Dirt.ICO deleted file mode 100644 index 057c6083..00000000 Binary files a/Sources/Plasma/Apps/plPlasmaInstaller/Dirt.ICO and /dev/null differ diff --git a/Sources/Plasma/Apps/plPlasmaInstaller/main.cpp b/Sources/Plasma/Apps/plPlasmaInstaller/main.cpp deleted file mode 100644 index 140e85e1..00000000 --- a/Sources/Plasma/Apps/plPlasmaInstaller/main.cpp +++ /dev/null @@ -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 . - -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; -} diff --git a/Sources/Plasma/Apps/plPlasmaInstaller/plInstallerReg.cpp b/Sources/Plasma/Apps/plPlasmaInstaller/plInstallerReg.cpp deleted file mode 100644 index 35048fc9..00000000 --- a/Sources/Plasma/Apps/plPlasmaInstaller/plInstallerReg.cpp +++ /dev/null @@ -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 . - -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 - -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; -} diff --git a/Sources/Plasma/Apps/plPlasmaInstaller/plInstallerReg.h b/Sources/Plasma/Apps/plPlasmaInstaller/plInstallerReg.h deleted file mode 100644 index 7163e4e6..00000000 --- a/Sources/Plasma/Apps/plPlasmaInstaller/plInstallerReg.h +++ /dev/null @@ -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 . - -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(); -} \ No newline at end of file diff --git a/Sources/Plasma/Apps/plPlasmaInstaller/plPlasmaInstaller.cpp b/Sources/Plasma/Apps/plPlasmaInstaller/plPlasmaInstaller.cpp deleted file mode 100644 index 50ef033d..00000000 --- a/Sources/Plasma/Apps/plPlasmaInstaller/plPlasmaInstaller.cpp +++ /dev/null @@ -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 . - -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 -#include - -#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); - } - } -} diff --git a/Sources/Plasma/Apps/plPlasmaInstaller/plPlasmaInstaller.h b/Sources/Plasma/Apps/plPlasmaInstaller/plPlasmaInstaller.h deleted file mode 100644 index 9da346cd..00000000 --- a/Sources/Plasma/Apps/plPlasmaInstaller/plPlasmaInstaller.h +++ /dev/null @@ -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 . - -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; } -}; \ No newline at end of file diff --git a/Sources/Plasma/Apps/plPlasmaInstaller/plPlasmaInstaller.rc b/Sources/Plasma/Apps/plPlasmaInstaller/plPlasmaInstaller.rc deleted file mode 100644 index 9c9bca40..00000000 --- a/Sources/Plasma/Apps/plPlasmaInstaller/plPlasmaInstaller.rc +++ /dev/null @@ -1,122 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define WIN32_LEAN_AND_MEAN -#include -#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 - diff --git a/Sources/Plasma/Apps/plPlasmaInstaller/plSetPlasmaPath.cpp b/Sources/Plasma/Apps/plPlasmaInstaller/plSetPlasmaPath.cpp deleted file mode 100644 index 41abf28d..00000000 --- a/Sources/Plasma/Apps/plPlasmaInstaller/plSetPlasmaPath.cpp +++ /dev/null @@ -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 . - -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 - -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); - } -} diff --git a/Sources/Plasma/Apps/plPlasmaInstaller/plSetPlasmaPath.h b/Sources/Plasma/Apps/plPlasmaInstaller/plSetPlasmaPath.h deleted file mode 100644 index b1b8ac2a..00000000 --- a/Sources/Plasma/Apps/plPlasmaInstaller/plSetPlasmaPath.h +++ /dev/null @@ -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 . - -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); diff --git a/Sources/Plasma/Apps/plPlasmaInstaller/plUnzip.cpp b/Sources/Plasma/Apps/plPlasmaInstaller/plUnzip.cpp deleted file mode 100644 index a979f753..00000000 --- a/Sources/Plasma/Apps/plPlasmaInstaller/plUnzip.cpp +++ /dev/null @@ -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 . - -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); -} diff --git a/Sources/Plasma/Apps/plPlasmaInstaller/plUnzip.h b/Sources/Plasma/Apps/plPlasmaInstaller/plUnzip.h deleted file mode 100644 index 6fe0c702..00000000 --- a/Sources/Plasma/Apps/plPlasmaInstaller/plUnzip.h +++ /dev/null @@ -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 . - -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 diff --git a/Sources/Plasma/Apps/plPlasmaInstaller/resource.h b/Sources/Plasma/Apps/plPlasmaInstaller/resource.h deleted file mode 100644 index 6f5b8afe..00000000 --- a/Sources/Plasma/Apps/plPlasmaInstaller/resource.h +++ /dev/null @@ -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 diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/Dirt.ICO b/Sources/Plasma/Apps/plPlasmaUpdate/Dirt.ICO deleted file mode 100644 index 057c6083..00000000 Binary files a/Sources/Plasma/Apps/plPlasmaUpdate/Dirt.ICO and /dev/null differ diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/main.cpp b/Sources/Plasma/Apps/plPlasmaUpdate/main.cpp deleted file mode 100644 index aa6d8f4b..00000000 --- a/Sources/Plasma/Apps/plPlasmaUpdate/main.cpp +++ /dev/null @@ -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 . - -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; -} diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/plFileGrabber.cpp b/Sources/Plasma/Apps/plPlasmaUpdate/plFileGrabber.cpp deleted file mode 100644 index bc9798f1..00000000 --- a/Sources/Plasma/Apps/plPlasmaUpdate/plFileGrabber.cpp +++ /dev/null @@ -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 . - -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; -} diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/plFileGrabber.h b/Sources/Plasma/Apps/plPlasmaUpdate/plFileGrabber.h deleted file mode 100644 index 69bde723..00000000 --- a/Sources/Plasma/Apps/plPlasmaUpdate/plFileGrabber.h +++ /dev/null @@ -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 . - -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 -#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 \ No newline at end of file diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/plManifest.cpp b/Sources/Plasma/Apps/plPlasmaUpdate/plManifest.cpp deleted file mode 100644 index 4d1dca94..00000000 --- a/Sources/Plasma/Apps/plPlasmaUpdate/plManifest.cpp +++ /dev/null @@ -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 . - -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; -} diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/plManifest.h b/Sources/Plasma/Apps/plPlasmaUpdate/plManifest.h deleted file mode 100644 index f9ff0162..00000000 --- a/Sources/Plasma/Apps/plPlasmaUpdate/plManifest.h +++ /dev/null @@ -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 . - -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 -#include - -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 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 \ No newline at end of file diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.cpp b/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.cpp deleted file mode 100644 index 2f5af516..00000000 --- a/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.cpp +++ /dev/null @@ -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 . - -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; -} diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.h b/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.h deleted file mode 100644 index 3890f257..00000000 --- a/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.h +++ /dev/null @@ -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 . - -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 - -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 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 diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.cpp b/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.cpp deleted file mode 100644 index 04b4f5b4..00000000 --- a/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.cpp +++ /dev/null @@ -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 . - -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 -#include -#include -#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; -} diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.h b/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.h deleted file mode 100644 index acaad271..00000000 --- a/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.h +++ /dev/null @@ -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 . - -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 -#include -#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 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; } -}; diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.rc b/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.rc deleted file mode 100644 index 5d5463be..00000000 --- a/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.rc +++ /dev/null @@ -1,131 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define WIN32_LEAN_AND_MEAN -#include -#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 - diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/resource.h b/Sources/Plasma/Apps/plPlasmaUpdate/resource.h deleted file mode 100644 index 9ff10772..00000000 --- a/Sources/Plasma/Apps/plPlasmaUpdate/resource.h +++ /dev/null @@ -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 diff --git a/Sources/Plasma/Apps/plUruLauncher/CMakeLists.txt b/Sources/Plasma/Apps/plUruLauncher/CMakeLists.txt index 758f828b..65228010 100644 --- a/Sources/Plasma/Apps/plUruLauncher/CMakeLists.txt +++ b/Sources/Plasma/Apps/plUruLauncher/CMakeLists.txt @@ -53,7 +53,6 @@ target_link_libraries(plUruLauncher pnNetCli) target_link_libraries(plUruLauncher pnNetCommon) target_link_libraries(plUruLauncher pnNetProtocol) target_link_libraries(plUruLauncher pnProduct) -target_link_libraries(plUruLauncher pnSimpleNet) target_link_libraries(plUruLauncher pnTimer) target_link_libraries(plUruLauncher pnUtils) target_link_libraries(plUruLauncher pnUtilsExe) diff --git a/Sources/Plasma/FeatureLib/CMakeLists.txt b/Sources/Plasma/FeatureLib/CMakeLists.txt index 2847d970..8b2b13a5 100644 --- a/Sources/Plasma/FeatureLib/CMakeLists.txt +++ b/Sources/Plasma/FeatureLib/CMakeLists.txt @@ -9,7 +9,6 @@ add_subdirectory(pfConditional) add_subdirectory(pfConsole) add_subdirectory(pfConsoleCore) add_subdirectory(pfCrashHandler) -add_subdirectory(pfCsrSrv) add_subdirectory(pfGameGUIMgr) add_subdirectory(pfGameMgr) add_subdirectory(pfGameScoreMgr) @@ -17,9 +16,6 @@ add_subdirectory(pfJournalBook) # pfKI is apparently just a historical oddity at this point # add_subdirectory(pfKI) add_subdirectory(pfLocalizationMgr) -# This is missing required parts in other plasma libraries. -# Also not referenced by any sln file -# add_subdirectory(pfLoginDialog) add_subdirectory(pfMessage) add_subdirectory(pfPython) add_subdirectory(pfSecurePreloader) diff --git a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCommandsCore.cpp b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCommandsCore.cpp index 3bdf7f76..36d16c3c 100644 --- a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCommandsCore.cpp +++ b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCommandsCore.cpp @@ -179,57 +179,6 @@ PF_CONSOLE_CMD( } -//============================================================================ -// Server.Csr group -PF_CONSOLE_SUBGROUP(Server, Csr) - -//============================================================================ -PF_CONSOLE_CMD( - Server_Csr, - Host, - "string address", - "Set the Csr Server address" -) { - SetCsrSrvHostname(params[0]); -} - -//============================================================================ -PF_CONSOLE_CMD( - Server_Csr, - N, - "string base64Key", - "Set the Csr Server N key" -) { - int baseLength = hsStrlen((const char *)params[0]); - if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) { - PrintStringF(PrintString, "Invalid key: should be exactly %u bytes", - kNetDiffieHellmanKeyBits / 8); - return; - } - - Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0], - kNetDiffieHellmanKeyBits / 8, kCsrDhNData); -} - -//============================================================================ -PF_CONSOLE_CMD( - Server_Csr, - X, - "string base64Key", - "Set the Csr Server X key" -) { - int baseLength = hsStrlen((const char *)params[0]); - if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) { - PrintStringF(PrintString, "Invalid key: should be exactly %u bytes", - kNetDiffieHellmanKeyBits / 8); - return; - } - - Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0], - kNetDiffieHellmanKeyBits / 8, kCsrDhXData); -} - - //============================================================================ // Server.Game group PF_CONSOLE_SUBGROUP(Server, Game) diff --git a/Sources/Plasma/FeatureLib/pfCsrSrv/CMakeLists.txt b/Sources/Plasma/FeatureLib/pfCsrSrv/CMakeLists.txt deleted file mode 100644 index dafa4cb6..00000000 --- a/Sources/Plasma/FeatureLib/pfCsrSrv/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -include_directories(../../CoreLib) -include_directories(../../FeatureLib) -include_directories(../../NucleusLib) -include_directories(../../NucleusLib/inc) -include_directories(../../PubUtilLib) - -set(pfCsrSrv_SOURCES - pfCsrSrv.cpp -) - -set(pfCsrSrv_HEADERS - Pch.h - pfCsrSrv.h -) - -add_library(pfCsrSrv STATIC ${pfCsrSrv_SOURCES} ${pfCsrSrv_HEADERS}) - -source_group("Source Files" FILES ${pfCsrSrv_SOURCES}) -source_group("Header Files" FILES ${pfCsrSrv_HEADERS}) diff --git a/Sources/Plasma/FeatureLib/pfCsrSrv/Pch.h b/Sources/Plasma/FeatureLib/pfCsrSrv/Pch.h deleted file mode 100644 index 14e72837..00000000 --- a/Sources/Plasma/FeatureLib/pfCsrSrv/Pch.h +++ /dev/null @@ -1,58 +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 . - -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==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/FeatureLib/pfCsrSrv/Pch.h -* -***/ - -#ifdef PLASMA20_SOURCES_PLASMA_FEATURELIB_PFCSRSRV_PCH_H -#error "Header $/Plasma20/Sources/Plasma/FeatureLib/pfCsrSrv/Pch.h included more than once" -#endif -#define PLASMA20_SOURCES_PLASMA_FEATURELIB_PFCSRSRV_PCH_H - - -#include "pfCsrSrv.h" - -#pragma warning(push, 0) -#include "pfConsole/pfConsole.h" -#pragma warning(pop) diff --git a/Sources/Plasma/FeatureLib/pfCsrSrv/pfCsrSrv.cpp b/Sources/Plasma/FeatureLib/pfCsrSrv/pfCsrSrv.cpp deleted file mode 100644 index 3c4c5a14..00000000 --- a/Sources/Plasma/FeatureLib/pfCsrSrv/pfCsrSrv.cpp +++ /dev/null @@ -1,160 +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 . - -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==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/FeatureLib/pfCsrSrv/pfCsrSrv.cpp -* -***/ - -#include "Pch.h" -#pragma hdrstop - - -/***************************************************************************** -* -* Local types -* -***/ - -/***************************************************************************** -* -* Local data -* -***/ - -static bool s_running; - - -/***************************************************************************** -* -* Local functions -* -***/ - -//============================================================================ -static bool Recv_ExecConsoleCmd ( - SimpleNetConn * , - CsrNet_ExecConsoleCmd * msg -) { - LogMsg(kLogPerf, L"pfCsrSrv: ExecConsoleCmd: %S", msg->cmd); - - pfConsole::RunCommandAsync(msg->cmd); - - return true; -} - -//============================================================================ -static bool OnMsg ( - SimpleNetConn * conn, - SimpleNet_MsgHeader * msg -) { - bool result; - - #define DISPATCH(a) case kCsrNet_##a: result = Recv_##a(conn, (CsrNet_##a *) msg); break - switch (msg->messageId) { - DISPATCH(ExecConsoleCmd); - default: - result = false; - } - #undef DISPATCH - - return result; -} - -//============================================================================ -static void OnError ( - SimpleNetConn * , - ENetError error -) { - LogMsg(kLogPerf, L"pfCsrSrv NetError: %s", NetErrorToString(error)); -} - -//============================================================================ -static bool QueryAccept ( - void * , - unsigned channel, - SimpleNetConn * , - const plNetAddress& addr -) { - plString str = addr.AsString(); - LogMsg(kLogPerf, L"pfCsrSrv: Accepted connection from %s", str.c_str()); - return channel == kSimpleNetChannelCsr; -} - - -/***************************************************************************** -* -* Exports -* -***/ - -//============================================================================ -void CsrSrvInitialize () { - -#ifdef PLASMA_ENABLE_CSR_EXTERNAL - - LogMsg(kLogPerf, L"pfCsrSrv: Initializing"); - - s_running = true; - - SimpleNetInitialize(); - SimpleNetCreateChannel(kSimpleNetChannelCsr, OnMsg, OnError); - SimpleNetStartListening(QueryAccept, nil); - -#endif -} - -//============================================================================ -void CsrSrvShutdown () { - -#ifdef PLASMA_ENABLE_CSR_EXTERNAL - - LogMsg(kLogPerf, L"pfCsrSrv: Shutting down"); - - s_running = false; - - SimpleNetStopListening(); - SimpleNetDestroyChannel(kSimpleNetChannelCsr); - SimpleNetShutdown(); - -#endif -} diff --git a/Sources/Plasma/FeatureLib/pfCsrSrv/pfCsrSrv.h b/Sources/Plasma/FeatureLib/pfCsrSrv/pfCsrSrv.h deleted file mode 100644 index bd39e8e0..00000000 --- a/Sources/Plasma/FeatureLib/pfCsrSrv/pfCsrSrv.h +++ /dev/null @@ -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 . - -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==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/FeatureLib/pfCsrSrv/pfCsrSrv.h -* -***/ - -#ifndef PLASMA20_SOURCES_PLASMA_FEATURELIB_PFCSRSRV_PFCSRSRV_H -#define PLASMA20_SOURCES_PLASMA_FEATURELIB_PFCSRSRV_PFCSRSRV_H - - -#include "pnCsrNet/pnCsrNet.h" - - -/***************************************************************************** -* -* pfCsrSrv -* - Executes remote CSR commands received through pnCsrNet -* -***/ - -void CsrSrvInitialize (); -void CsrSrvShutdown (); - - -#endif // PLASMA20_SOURCES_PLASMA_FEATURELIB_PFCSRSRV_PFCSRSRV_H diff --git a/Sources/Plasma/FeatureLib/pfLoginDialog/CMakeLists.txt b/Sources/Plasma/FeatureLib/pfLoginDialog/CMakeLists.txt deleted file mode 100644 index b2bc2227..00000000 --- a/Sources/Plasma/FeatureLib/pfLoginDialog/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -include_directories(../../CoreLib) -include_directories(../../NucleusLib) -include_directories(../../NucleusLib/inc) -include_directories(../../PubUtilLib) - -set(pfLoginDialog_SOURCES - plLoginDialog.cpp -) - -set(pfLoginDialog_HEADERS - plLoginDialog.h - resource.h -) - -set(pfLoginDialog_RESOURCES - pfLoginDialog.rc -) - -add_library(pfLoginDialog STATIC ${pfLoginDialog_SOURCES} ${pfLoginDialog_HEADERS} ${pfLoginDialog_RESOURCES}) - -source_group("Source Files" FILES ${pfLoginDialog_SOURCES}) -source_group("Header Files" FILES ${pfLoginDialog_HEADERS}) -source_group("Resource Files" FILES ${pfLoginDialog_RESOURCES}) diff --git a/Sources/Plasma/FeatureLib/pfLoginDialog/pfLoginDialog.rc b/Sources/Plasma/FeatureLib/pfLoginDialog/pfLoginDialog.rc deleted file mode 100644 index f4e94f94..00000000 --- a/Sources/Plasma/FeatureLib/pfLoginDialog/pfLoginDialog.rc +++ /dev/null @@ -1,103 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define WIN32_LEAN_AND_MEAN -#include -#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 - -#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 - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_DIALOG_LOGIN DIALOGEX 0, 0, 186, 114 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -EXSTYLE WS_EX_CONTROLPARENT -CAPTION "Login" -FONT 8, "Tahoma" -BEGIN - EDITTEXT IDC_LOGIN_USERNAME,55,7,98,12,ES_AUTOHSCROLL - EDITTEXT IDC_LOGIN_PASSWORD,55,23,98,12,ES_PASSWORD | - ES_AUTOHSCROLL - COMBOBOX IDC_LOGIN_LOBBYLIST,55,39,98,76,CBS_DROPDOWN | - CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON "Login",IDC_LOGIN_LOGIN,41,58,50,14 - PUSHBUTTON "Cancel",IDC_LOGIN_CANCEL,94,58,50,14 - LTEXT "Account:",IDC_STATIC,21,9,30,8,0,WS_EX_RIGHT - LTEXT "Password:",IDC_STATIC,17,25,34,8,0,WS_EX_RIGHT - LTEXT "Server:",IDC_LOGIN_STATIC_SERVER,27,41,24,8,0, - WS_EX_RIGHT - PUSHBUTTON "?",IDC_SERVER_QUERY_BTN,157,39,22,13,NOT WS_VISIBLE - CONTROL "Remember Password",IDC_REMEMBER_PASSWORD,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,18,79,119,12 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_DIALOG_LOGIN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 179 - TOPMARGIN, 7 - BOTTOMMARGIN, 107 - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/Sources/Plasma/FeatureLib/pfLoginDialog/plLoginDialog.cpp b/Sources/Plasma/FeatureLib/pfLoginDialog/plLoginDialog.cpp deleted file mode 100644 index 8d9cea2d..00000000 --- a/Sources/Plasma/FeatureLib/pfLoginDialog/plLoginDialog.cpp +++ /dev/null @@ -1,672 +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 . - -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 "plLoginDialog.h" -#include "resource.h" -#include "plNetCommon/plNetCommonConstants.h" -#include "plNetMessage/plNetMessage.h" -// #include "plHttpServer/plHttpResponse.h" -#include "plSDL/plSDL.h" -#include "plFile/hsFiles.h" -#include "plNetMessage/plNetCommonMessage.h" - -// 'this' : used in base member initializer list -#pragma warning(disable:4355) - -#define kAuthTimedOut WM_USER+2 - -plLoginDialog::plLoginDialog( HWND parentWnd ) -: plDialog(IDD_DIALOG_LOGIN) -, fParentWnd( parentWnd ) -, fLoginBtn(this, IDC_LOGIN_LOGIN, plDelegate(this,(TDelegate)ILogin)) -, fCancelBtn(this, IDC_LOGIN_CANCEL, plDelegate(this,(TDelegate)IExit)) -, fAccountName(this,IDC_LOGIN_USERNAME) -, fPassword(this,IDC_LOGIN_PASSWORD) -, fLobbyList(this,IDC_LOGIN_LOBBYLIST) -, fLobbyText(this, IDC_LOGIN_STATIC_SERVER) -, fRememberPassword(this, IDC_REMEMBER_PASSWORD, plDelegate(this, (TDelegate)IOnRememberPwdChanged)) -, fCancelled(false) -, fAutoLogin(false) -#ifndef PLASMA_EXTERNAL_RELEASE -, fServerQueryBtn(this, IDC_SERVER_QUERY_BTN) -#endif -{ - fLobbyList.fSelectionEndOkDelegate = plDelegate(this,(TDelegate)SelectedLobbyChanged); - fLobbyList.fEditUpdateDelegate = plDelegate(this,(TDelegate)SelectedLobbyTextEdited); - fLobbyList.fKillFocusDelegate = plDelegate(this,(TDelegate)OnLobbyListLostFocus); -#ifndef PLASMA_EXTERNAL_RELEASE - fServerQueryBtn.fClickDelegate = plDelegate(this,(TDelegate)ServerQueryBtnClicked); -#endif -} - -std::string plLoginDialog::MakeSafeLobbyServerName(const std::string & value) -{ - return ""; -} - - -void plLoginDialog::SelectedLobbyChanged() -{ - fLobbyVal.SetValue(fLobbyList.GetValue().c_str()); - fLobbyList.SetEdited(false); -} - -void plLoginDialog::SelectedLobbyTextEdited() -{ - fLobbyVal.SetValue(fLobbyList.GetValue().c_str()); - fLobbyList.SetEdited(true); -} - -// Ugh -#ifdef PLASMA_EXTERNAL_RELEASE -#include -#endif - -bool plLoginDialog::RefreshLobbyList() -{ - fStatusBar.SetText(L"Refreshing lobby server list..."); - - plStringList lobbies; - std::vector wLobbies; - GetLobbyList(lobbies); - - // Strip off the shard name and just leave the address - for (int i = 0; i < lobbies.size(); i++) - { - std::string& str = lobbies[i]; - - std::string::size_type endofname = str.find('\t'); - if (endofname != std::string::npos) - str.erase(str.begin() + endofname, str.end()); - - wchar_t *wLobby = hsStringToWString(str.c_str()); - wLobbies.push_back(wLobby); - delete [] wLobby; - } - - fLobbyList.Empty(); - -#ifdef PLASMA_EXTERNAL_RELEASE - // In release mode, put the user in a random lobby for rudimentary load balancing - int numLobbies = lobbies.size(); - if (numLobbies > 0) - { - srand(time(NULL)); - int rnum = rand(); - int whichLobby = rnum % numLobbies; - - fLobbyList.AddString(wLobbies[whichLobby].c_str()); - } - - fLobbyList.SetCurrent(0); -#else - if (AllowSinglePlayerLobby()) - fLobbyList.AddString(L"Single Player"); - fLobbyList.AddStrings(wLobbies); - - wchar_t *wLobby = hsStringToWString(fLobbyVal.GetValue().c_str()); - int index = fLobbyList.FindStringExact(wLobby); - if (index==LB_ERR && fLobbyVal.GetValue().length()>0) - { - fLobbyList.AddString(wLobby); - index = fLobbyList.FindStringExact(wLobby); - } - delete [] wLobby; - - fLobbyList.SetCurrent((index!=LB_ERR)?index:0); -#endif // PLASMA_EXTERNAL_RELEASE - - SelectedLobbyChanged(); - - fStatusBar.SetText(L""); - return true; -} - -void plLoginDialog::OnLobbyListLostFocus() -{ - std::string value = fLobbyList.GetValue(); - if (value.length()==0) - { - fLobbyList.SetCurrent(0); - fLobbyList.SetValue(MakeSafeLobbyServerName(fLobbyList.GetValue()).c_str()); - SelectedLobbyChanged(); - } -} - -#if 0 -void plLoginDialog::UpdateCtrls() -{ - bool networkEnabled = IsNetworkPlayEnabled(); - bool loggedIn = GetLoggedIn(); - bool loggingIn = GetLoggingIn(); - bool loggedOut = GetLoggedOut(); - if (!networkEnabled && (loggedIn || loggingIn)) - { - Logout(); - - // these don't do anything. need to set the vars in fMainDIalog? - loggedIn = false; - loggingIn = false; - loggedOut = true; - } -} -#endif - -bool plLoginDialog::IsNetworkPlayDisabled() -{ -#ifdef PLASMA_EXTERNAL_RELEASE - return false; -#else - xtl::istring tmp = fLobbyVal.GetValue().c_str(); - return (tmp.compare("single player")==0); -#endif -} - -bool plLoginDialog::IsNetworkPlayEnabled() -{ - return !IsNetworkPlayDisabled(); -} - -void plLoginDialog::OnInitDialog() -{ - plDialog::OnInitDialog(); - - if ( fParentWnd ) - SetParent( Handle(), fParentWnd ); - - fStatusBar.OpenWindow(this,true); - -#ifdef PLASMA_EXTERNAL_RELEASE - fLobbyList.Show(false); - fLobbyText.Show(false); -#endif - -#ifndef PLASMA_EXTERNAL_RELEASE - fServerQueryBtn.Show(true); -#endif - - bool rememberPwd = (fRememberPasswordVal.GetValue()=="true"); - fAccountName.SetValue(fAccountNameVal.GetValue().c_str()); - if (rememberPwd) - { - int len = atoi(fPasswordLen.GetValue().c_str()); - std::string fakePwd(len, '*'); - fPassword.SetValue(fakePwd.c_str()); - } - - fRememberPassword.Check(rememberPwd); - - RefreshLobbyList(); - - if ( fAutoLogin ) - fLoginBtn.Click(); - -// SetForegroundWindow(*this); -} - -bool plLoginDialog::Login() -{ - int ret = DoModal(); - if (ret<0) - { - hsAssert(false, xtl::format("plLoginDialog failed to initialize, err code %d, GetLastError %d", - ret, GetLastError()).c_str()); - } - - return (ret != 0); -} - -void plLoginDialog::ILogin() -{ - OnLoginClicked(); - - fAccountNameVal.SetValue(fAccountName.GetValue().c_str()); - - std::string pwd = fPassword.GetValue(); - int pwdSize = pwd.size(); - - std::string fakePwd = "*" + std::string(pwdSize-1, '*'); - if (pwd != fakePwd) // user has entered a real pwd - { - fPasswordLen.SetValue(xtl::format("%d",pwd.size()).c_str()); - // MD5 HASH the pwd - std::string hex; - plChallengeResponse::HashPassword(pwd.c_str(), hex); - fPasswordVal.SetValue(hex.c_str()); - } - - SetDataServerUserName(true, fAccountNameVal.GetValue().c_str()); - SetDataServerPassword(true, fPasswordVal.GetValue().c_str()); - SetDataServerUserName(false, fAccountNameVal.GetValue().c_str()); - SetDataServerPassword(false, fPasswordVal.GetValue().c_str()); - - if (IsNetworkPlayEnabled()) - StartLogin(); - else - CompleteLogin(); -} - -void plLoginDialog::IOnRememberPwdChanged() -{ - fRememberPasswordVal.SetValue(fRememberPassword.IsChecked() ? "true" : "false"); -} - -void plLoginDialog::IExit() -{ - fAccountNameVal.SetValue(fAccountName.GetValue().c_str()); - fPasswordVal.SetValue(fPassword.GetValue().c_str()); - fLobbyVal.SetValue(fLobbyList.GetValue().c_str()); - SetDataServerUserName(true, fAccountNameVal.GetValue().c_str()); - SetDataServerPassword(true, fPasswordVal.GetValue().c_str()); - SetDataServerUserName(false, fAccountNameVal.GetValue().c_str()); - SetDataServerPassword(false, fPasswordVal.GetValue().c_str()); - SHORT state = GetKeyState(VK_SHIFT); - if (state&0x8000) - EndDialogTrue(); - else - EndDialogFalse(); - fCancelled=true; -} - -int plLoginDialog::ICheckNetVersion(plNetMsgAuthenticateChallenge * msg) -{ - if (msg) - { - if (msg->GetVersionMajor() != plNetMessage::kVerMajor || - msg->GetVersionMinor() != plNetMessage::kVerMinor) - { - std::string str = xtl::format("Login Failed, client/server version mismatch, client %d.%d, server %d.%d", - plNetMessage::kVerMajor, plNetMessage::kVerMinor, - msg->GetVersionMajor(), - msg->GetVersionMinor()); - FailLogin(str.c_str()); - return hsFail; - } - return hsOK; - } - return hsFail; -} - -void plLoginDialog::HandleAuthChallenge(plNetMsgAuthenticateChallenge * msg) -{ - int cnt = msg->PeekBuffer(msg->GetNetCoreMsg()->GetData(),msg->GetNetCoreMsg()->GetLen()); - - // check protocol version first, in case msg contents are hosed - if (ICheckNetVersion(msg) == hsFail) - return; // version err - - if (msg->IsContinuing()) - { - // Respond to the Challenge - std::string hex = plChallengeResponse::GetBufferAsHexStr(msg->GetChallenge().data(), msg->GetChallenge().size(), true); - fChallengeResponse.SetChallenge(hex); - fChallengeResponse.GenerateResponse(fAccountNameVal.GetValue().c_str(),fPasswordVal.GetValue().c_str()); - KillTimer(*this,kAuthTimedOut); - SendAuthenticateResponse(); - } - else - { - FailLogin(msg->GetHelloResult()); - } -} - -void plLoginDialog::HandleAccountAuthenticated(plNetMsgAccountAuthenticated * msg) -{ - int cnt = msg->PeekBuffer(msg->GetNetCoreMsg()->GetData(),msg->GetNetCoreMsg()->GetLen()); - if (msg->IsAuthenticated()) - { - CompleteLogin(); - } - else - { - FailLogin(msg->GetAuthResult()); - } -} - - -void plLoginDialog::StartLogin() -{ - fLoginBtn.SetEnabled(false); - std::string value = fLobbyList.GetValue(); - if (value.length()==0) - { - fLobbyList.SetCurrent(0); - fLobbyList.SetValue(MakeSafeLobbyServerName(fLobbyList.GetValue()).c_str()); - SelectedLobbyChanged(); - } - fStatusBar.SetText(L"Authenticating..."); -// fMainDialog->InitNetCore(); -// fMainDialog->fLoginState = kLoggingIn; -// fAccountTab.UpdateCtrls(); -// fPlayerTab.SetPlayerVault(nil); - SendAuthenticateHello(); -} - -void plLoginDialog::CompleteLogin() -{ - if ( Handle() ) - fLoginBtn.SetEnabled(true); - - KillTimer(*this,kAuthTimedOut); - - fStatusBar.SetText(L""); - if (IsNetworkPlayEnabled()) - NotifyConnected(); - else - NotifyDisconnected(); - - EndDialogTrue(); - - GetClientManifests(); - UpdateAllCtrls(); -} - -void plLoginDialog::FailLogin(const char* str) -{ - fLoginBtn.SetEnabled(true); - KillTimer(*this, kAuthTimedOut); - fStatusBar.SetText(L""); - hsMessageBoxWithOwner((void*)*this,str,"Error",hsMessageBoxNormal); - Logout(); -} - -void plLoginDialog::FailLogin(int reasonCode) -{ - std::string str = xtl::format("Failed to login to lobby server %s: %s", - fLobbyVal.GetValue().c_str(), plNetMsgAccountAuthenticated::GetAuthResultString(reasonCode)); - FailLogin(str.c_str()); -} - -void plLoginDialog::TimeoutLogin() -{ - fLoginBtn.SetEnabled(true); - - wchar_t *wStr = hsStringToWString(xtl::format("Timed out logging into lobby server %s.", fLobbyVal.GetValue().c_str()).c_str()); - fStatusBar.SetText(wStr); - delete [] wStr; - - KillTimer(*this, kAuthTimedOut); - Logout(); -} - -void plLoginDialog::Logout() -{ - KillTimer(*this, kAuthTimedOut); - SendLobbyLeave(); - //fMainDialog->ShutdownNetCore(); - NotifyDisconnected(); -} - -void plLoginDialog::SendLobbyLeave() -{ - plNetMsgLeave msg; - msg.SetReason( plPlayerUpdateConstants::kPlayerQuitting ); - SendMsg(&msg,plNetAddress(fLobbyVal.GetValue().c_str(),plNetLobbyServerConstants::GetPort())); - RemoveLobbyPeer(); -} - -#define MSG_TIMEOUT 8000 -#include "../pnNetCommon/plNetAddress.h" - -void plLoginDialog::SendAuthenticateHello() -{ - SetTimer(*this,kAuthTimedOut,MSG_TIMEOUT,nil); - plNetMsgAuthenticateHello msg; - msg.SetAccountName(fAccountNameVal.GetValue().c_str()); - msg.SetMaxPacketSize(GetPacketSize()); - SendMsg(&msg,plNetAddress(fLobbyVal.GetValue().c_str(),plNetLobbyServerConstants::GetPort())); -} - -void plLoginDialog::SendAuthenticateResponse() -{ - SetTimer(*this,kAuthTimedOut,MSG_TIMEOUT,nil); - plNetMsgAuthenticateResponse msg; - msg.SetResponse(fChallengeResponse.GetResponse()); - SendMsg(&msg,plNetAddress(fLobbyVal.GetValue().c_str(),plNetLobbyServerConstants::GetPort())); -} - -int plLoginDialog::CallDefaultProc( unsigned int message, unsigned int wParam, LONG lParam ) -{ - switch (message) - { - case WM_TIMER: - switch (wParam) - { - case kAuthTimedOut: - TimeoutLogin(); - break; - } - } - - return 0; -} - - - - -///////////////////////////////////////////////////////////////////////////// -#ifndef PLASMA_EXTERNAL_RELEASE -#define kServerInfoFilename "server_info.html" - -static void StringToLines(std::string str, plStringList & lines, bool includeBlankLines=true) -{ - xtl::trim(str); - if (str.length()==0) - return; - str.append("\n"); - int pos; - while ((pos=str.find("\n"))!=std::string::npos) - { - std::string line = xtl::trim(str.substr(0,pos).c_str()); - str.erase(0,pos+1); - if (includeBlankLines || (!includeBlankLines && line.length()>0)) - lines.push_back(line); - } -} - -static void GetPathElements(std::string filename, plStringList & lst) -{ - int pos; - while ((pos=filename.find_first_of("\\/"))!=std::string::npos) - { - std::string element = filename.substr(0,pos); - filename.erase(0,pos+1); - if (element.length()) - lst.push_back(element); - } -} - -struct SDLInfoParser -{ - std::string fFilename; - std::string fDescriptorName; - int fVersion; - void ParseString( const char * s ) - { - std::string str = s; - int p = str.find(","); - fFilename = str.substr(0,p); - str.erase(0,p+1); - p = str.find(","); - fDescriptorName = str.substr(0,p); - str.erase(0,p+1); - fVersion = atoi(str.c_str()); - - p = fFilename.find_last_of("\\"); - if( p!=std::string::npos ) - fFilename.erase(0,p+1); - p = fFilename.find_last_of("/"); - if( p!=std::string::npos ) - fFilename.erase(0,p+1); - } -}; - - -struct DescriptorReport -{ - int fServerVersion; // 0 means the descriptor is missing - int fClientVersion; - DescriptorReport(): fServerVersion(0),fClientVersion(0){} -}; - -#define kStyleSheet \ - "" - -void plLoginDialog::ServerQueryBtnClicked() -{ - hsUNIXStream file; - file.Open( kServerInfoFilename, "wt" ); - file.WriteString(""kStyleSheet"\n"); - - try - { - typedef std::map< std::string, DescriptorReport > DescriptorReports; - typedef std::map< std::string, DescriptorReports > FileReports; - - FileReports fileReports; - - - /*plURL url; - plHttpRequest request; - plHttpResponse response; - - // read server build date etc. - url.SetHost( fLobbyList.GetValue().c_str() ); - url.SetPort( 7676 ); - url.SetFile( "VersionInfo" ); - request.SetUrl( url ); - request.SetType( plHttpRequest::kGet ); - if ( !request.MakeRequest( response ) ) - throw 0; - file.WriteString("

Server Info

\n" ); - file.WriteString( "
\n" );
-        file.WriteString( response.c_str() );
-        file.WriteString( "
\n" ); - - // get server's SDL info - url.SetFile( "SDLInfo" ); - request.SetUrl( url ); - if ( !request.MakeRequest( response ) ) - throw 0; - plStringList lines; - StringToLines( response, lines, false ); - SDLInfoParser parser; - {for ( plStringList::iterator ii=lines.begin(); ii!=lines.end(); ++ii ) - { - parser.ParseString( (*ii).c_str() ); - fileReports[ parser.fFilename ][ parser.fDescriptorName ].fServerVersion = parser.fVersion; - }} - - // get client's SDL info - plSDLMgr::GetInstance()->DeInit(); - plSDLMgr::GetInstance()->SetSDLDir( "SDL" ); - plSDLMgr::GetInstance()->Init(); - const plSDL::DescriptorList * cds = plSDLMgr::GetInstance()->GetDescriptors(); - {for ( plSDL::DescriptorList::const_iterator ii=cds->begin(); ii!=cds->end(); ++ii ) - { - plStateDescriptor * descriptor = *ii; - std::string filename = descriptor->GetFilename(); - int p = filename.find_last_of(PATH_SEPARATOR_STR); - if( p!=std::string::npos ) - filename.erase(0,p+1); - fileReports[ filename ][ descriptor->GetName() ].fClientVersion = descriptor->GetVersion(); - }} - - // write SDL comparison report - file.WriteString("

SDL File Comparison

\n" ); - file.WriteString("Version=0 means descriptor doesn't exist.

\n" ); - file.WriteString( "\n" ); - - - { for ( FileReports::iterator ii=fileReports.begin(); ii!=fileReports.end(); ++ii ) - { - std::string sdlFilename = ii->first; - DescriptorReports & descrReports = ii->second; - file.WriteFmt( "\n", sdlFilename.c_str() ); - { for ( DescriptorReports::iterator jj=descrReports.begin(); jj!=descrReports.end(); ++jj ) - { -#define kSDLBad "Bad" -#define kSDLOk "Ok" - std::string descrName = jj->first; - DescriptorReport & descrReport = jj->second; - file.WriteFmt( "\n", - descrName.c_str(), descrReport.fServerVersion, descrReport.fClientVersion, - ( descrReport.fServerVersion==descrReport.fClientVersion ) ? kSDLOk:kSDLBad ); - }} - }} - - file.WriteString("
FileServer VersionClient VersionStatus
%s
   %s%d%d%s
\n");*/ - } - catch (...) - { - file.WriteString("

An error occurred while querying the server.\n"); - } - - file.WriteString("\n"); - file.Close(); - - ShellExecute( nil, nil, kServerInfoFilename, nil, nil, SW_SHOWNORMAL ); -} -#endif -///////////////////////////////////////////////////////////////////////////// - - diff --git a/Sources/Plasma/FeatureLib/pfLoginDialog/plLoginDialog.h b/Sources/Plasma/FeatureLib/pfLoginDialog/plLoginDialog.h deleted file mode 100644 index af22dc80..00000000 --- a/Sources/Plasma/FeatureLib/pfLoginDialog/plLoginDialog.h +++ /dev/null @@ -1,138 +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 . - -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 plLoginDialog_h_inc -#define plLoginDialog_h_inc - -#include "plWndCtrls/plWndCtrls.h" -// #include "plEncryption/plChallengeResponse.h" -#include "pnNetCommon/plNetAddress.h" - -class plMainDialog; -class plNetMsgAuthenticateChallenge; -class plNetMsgAccountAuthenticated; -class plNetMessage; - -class plLoginDialog : public plDialog -{ - HWND fParentWnd; -public: - DECLARE_WINDOWCLASS(plLoginDialog, plDialog); - - plLoginDialog( HWND parentWnd=nil ); - - bool Login(); - - void OnInitDialog(); - - void HandleAuthChallenge(plNetMsgAuthenticateChallenge * msg); - void HandleAccountAuthenticated(plNetMsgAccountAuthenticated * msg); - void StartLogin(); - void CompleteLogin(); - void FailLogin(int reasonCode); - void FailLogin(const char* str); - void TimeoutLogin(); - void Logout(); - void SendAuthenticateHello(); - void SendAuthenticateResponse(); - - bool IsNetworkPlayDisabled(); - bool IsNetworkPlayEnabled(); -// void UpdateCtrls(); - void SelectedLobbyChanged(); - void SelectedLobbyTextEdited(); - void OnLobbyListLostFocus(); - void SendLobbyLeave(); - bool RefreshLobbyList(); - bool GetCancelled() const { return fCancelled; } - bool GetRememberPassword() const { return fRememberPassword.IsChecked(); } - - // callbacks - virtual void GetLobbyList(plStringList& lobbies) = 0; - virtual bool AllowSinglePlayerLobby() { return true; } // checked in non external-release build - virtual void SetDataServerUserName(bool local, const char* s) {} - virtual void SetDataServerPassword(bool local, const char* s) {} - virtual void RemoveLobbyPeer() {} - virtual void NotifyConnected() {} - virtual void NotifyDisconnected() {} - virtual void GetClientManifests() {} - virtual void UpdateAllCtrls() {} - virtual unsigned int GetPacketSize() = 0; - virtual bool SendMsg(plNetMessage * msg, plNetAddress & addr) = 0; - virtual void OnLoginClicked() {} - - std::string MakeSafeLobbyServerName(const std::string & value); - - int CallDefaultProc( unsigned int message, unsigned int wParam, LONG lParam ); - - plEdit fAccountName; - plEdit fPassword; - plChallengeResponse fChallengeResponse; - plComboBox fLobbyList; - plLabel fLobbyText; - plCheckBox fRememberPassword; - -#ifndef PLASMA_EXTERNAL_RELEASE - plButton fServerQueryBtn; - void ServerQueryBtnClicked(); -#endif - - plConfigValue fAccountNameVal; - plConfigValue fPasswordVal; // the pwd as a MD5 hash - plConfigValue fRememberPasswordVal; // the checkbox state - plConfigValue fPasswordLen; // the length of the original pwd - plConfigValue fLobbyVal; - bool fAutoLogin; - - plStatusBar fStatusBar; - -protected: - int ICheckNetVersion(plNetMsgAuthenticateChallenge * msg); - void ILogin(); - void IExit(); - void IOnRememberPwdChanged(); - - bool fCancelled; - plButton fLoginBtn; - plButton fCancelBtn; -}; - -#endif // plLoginDialog_h_inc diff --git a/Sources/Plasma/FeatureLib/pfLoginDialog/resource.h b/Sources/Plasma/FeatureLib/pfLoginDialog/resource.h deleted file mode 100644 index df4b2921..00000000 --- a/Sources/Plasma/FeatureLib/pfLoginDialog/resource.h +++ /dev/null @@ -1,24 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by pfLoginDialog.rc -// -#define IDD_DIALOG_LOGIN 326 -#define IDC_LOGIN_USERNAME 3029 -#define IDC_LOGIN_PASSWORD 3031 -#define IDC_LOGIN_LOBBYLIST 3033 -#define IDC_LOGIN_STATIC_SERVER 3127 -#define IDC_LOGIN_LOGIN 3130 -#define IDC_LOGIN_CANCEL 3131 -#define IDC_SERVER_QUERY_BTN 3132 -#define IDC_REMEMBER_PASSWORD 3133 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 327 -#define _APS_NEXT_COMMAND_VALUE 42001 -#define _APS_NEXT_CONTROL_VALUE 3134 -#define _APS_NEXT_SYMED_VALUE 327 -#endif -#endif diff --git a/Sources/Plasma/NucleusLib/CMakeLists.txt b/Sources/Plasma/NucleusLib/CMakeLists.txt index bbaebdea..06e94361 100644 --- a/Sources/Plasma/NucleusLib/CMakeLists.txt +++ b/Sources/Plasma/NucleusLib/CMakeLists.txt @@ -4,8 +4,6 @@ add_subdirectory(inc) add_subdirectory(pnAddrInfo) add_subdirectory(pnAsyncCore) add_subdirectory(pnAsyncCoreExe) -#add_subdirectory(pnCsrCli) # Not being used in any current sln -add_subdirectory(pnCsrNet) add_subdirectory(pnDispatch) add_subdirectory(pnEncryption) add_subdirectory(pnFactory) @@ -20,7 +18,6 @@ add_subdirectory(pnNetCommon) add_subdirectory(pnNetProtocol) add_subdirectory(pnProduct) add_subdirectory(pnSceneObject) -add_subdirectory(pnSimpleNet) add_subdirectory(pnTimer) add_subdirectory(pnUtils) add_subdirectory(pnUtilsExe) diff --git a/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcIo.h b/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcIo.h index 5fd04990..4d22c11e 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcIo.h +++ b/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcIo.h @@ -162,8 +162,8 @@ enum EConnType { kConnTypeSrvToState = 17, kConnTypeSrvToLog = 18, kConnTypeSrvToScore = 19, - kConnTypeCliToCsr = 20, - kConnTypeSimpleNet = 21, + kConnTypeCliToCsr = 20, // DEAD + kConnTypeSimpleNet = 21, // DEAD kConnTypeCliToGateKeeper = 22, // Text connections diff --git a/Sources/Plasma/NucleusLib/pnCsrCli/CMakeLists.txt b/Sources/Plasma/NucleusLib/pnCsrCli/CMakeLists.txt deleted file mode 100644 index da5b045d..00000000 --- a/Sources/Plasma/NucleusLib/pnCsrCli/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -include_directories(../../CoreLib) -include_directories(../../NucleusLib) - -set(pnCsrCli_SOURCES - pnCsrCli.cpp -) - -set(pnCsrCli_HEADERS - Pch.h - pnCsrCli.h -) - -add_library(pnCsrCli STATIC ${pnCsrCli_SOURCES} ${pnCsrCli_HEADERS}) - -source_group("Source Files" FILES ${pnCsrCli_SOURCES}) -source_group("Header Files" FILES ${pnCsrCli_HEADERS}) \ No newline at end of file diff --git a/Sources/Plasma/NucleusLib/pnCsrCli/Pch.h b/Sources/Plasma/NucleusLib/pnCsrCli/Pch.h deleted file mode 100644 index fe3ec30d..00000000 --- a/Sources/Plasma/NucleusLib/pnCsrCli/Pch.h +++ /dev/null @@ -1,56 +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 . - -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==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnCsrCli/Pch.h -* -***/ - -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNCSRCLI_PCH_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnCsrCli/Pch.h included more than once" -#endif -#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNCSRCLI_PCH_H - - -#include "pnCsrCli.h" - -#include diff --git a/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.cpp b/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.cpp deleted file mode 100644 index de85ebf0..00000000 --- a/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.cpp +++ /dev/null @@ -1,269 +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 . - -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==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.cpp -* -***/ - -#include "Pch.h" -#pragma hdrstop - - -/***************************************************************************** -* -* Local types -* -***/ - - -/***************************************************************************** -* -* Local data -* -***/ - -static bool s_running; -static CCritSect s_critsect; -static SimpleNetConn * s_conn; -static FCsrCliOnError s_onError; - - -/***************************************************************************** -* -* Local functions -* -***/ - -//============================================================================ -static SimpleNetConn * GetConnIncRef () { - - SimpleNetConn * conn; - s_critsect.Enter(); - { - if (nil != (conn = s_conn)) - SimpleNetConnIncRef(conn); - } - s_critsect.Leave(); - return conn; -} - -//============================================================================ -static bool SimpleNetOnMsg ( - SimpleNetConn * , - SimpleNet_MsgHeader * -) { - LogMsg(kLogPerf, L"pnCsrCli: Rcvd unexpected message from peer"); - return false; -} - -//============================================================================ -static void SimpleNetOnError ( - SimpleNetConn * , - ENetError error -) { - if (!s_running) - return; - - LogMsg(kLogPerf, L"pnCsrCli: NetError: %s", NetErrorToString(error)); - - if (error == kNetErrDisconnected) - CsrCliDisconnect(); - - s_onError(error); -} - -//============================================================================ -static void SimpleNetOnConnect ( - void * param, - SimpleNetConn * conn, - ENetError result -) { - FCsrCliOnConnect onConnect = (FCsrCliOnConnect)param; - - LogMsg(kLogPerf, L"pnCsrCli: OnConnect: %s", NetErrorToString(result)); - - if (s_conn) - CsrCliDisconnect(); - - if (IS_NET_SUCCESS(result)) { - s_critsect.Enter(); - { - s_conn = conn; - } - s_critsect.Leave(); - } - - if (onConnect) - onConnect(result); -} - -//============================================================================ -static void Send_ExecConsoleCmd (const char cmd[]) { - - SimpleNetConn * conn = GetConnIncRef(); - if (!conn) - return; - - unsigned cmdBytes = StrBytes(cmd); - - CsrNet_ExecConsoleCmd * msg; - - unsigned msgBytes - = sizeof(*msg) - - sizeof(msg->cmd) - + cmdBytes - + sizeof(cmd[0]) - ; - - msg = new(_alloca(msgBytes)) CsrNet_ExecConsoleCmd(); - msg->messageBytes = msgBytes; - - StrCopy(msg->cmd, cmd, cmdBytes / sizeof(cmd[0])); - msg->cmd[cmdBytes] = 0; - - SimpleNetSend(conn, msg); - SimpleNetConnDecRef(conn); -} - - -/***************************************************************************** -* -* Exports -* -***/ - -//============================================================================ -void CsrCliInitialize (FCsrCliOnError onError) { - - ASSERT(!s_running); - ASSERT(onError); - - s_running = true; - s_onError = onError; - - SimpleNetInitialize(); - SimpleNetCreateChannel(kSimpleNetChannelCsr, SimpleNetOnMsg, SimpleNetOnError); -}; - -//============================================================================ -void CsrCliShutdown () { - - s_running = false; - s_onError = nil; - - CsrCliDisconnect(); - SimpleNetDestroyChannel(kSimpleNetChannelCsr); - SimpleNetShutdown(); -} - -//============================================================================ -void CsrCliStartConnecting ( - const wchar_t addr[], - FCsrCliOnConnect onConnect -) { - ASSERT(s_running); - - CsrCliDisconnect(); - SimpleNetStartConnecting(kSimpleNetChannelCsr, addr, SimpleNetOnConnect, onConnect); -} - -//============================================================================ -void CsrCliDisconnect () { - - SimpleNetConn * conn = nil; - s_critsect.Enter(); - { - SWAP(conn, s_conn); - } - s_critsect.Leave(); - if (conn) - SimpleNetDisconnect(conn); -} - -//============================================================================ -void CsrCliToggleAvatarPhysical () { - - ASSERT(s_running); - - Send_ExecConsoleCmd("Avatar.Physics.TogglePhysical"); -} - -//============================================================================ -void CsrCliWarpPlayerHere (unsigned playerId) { - - ASSERT(s_running); - - char cmd[1024]; - StrPrintf(cmd, arrsize(cmd), "CCR.WarpPlayerHere %u", playerId); - Send_ExecConsoleCmd(cmd); -} - -//============================================================================ -void CsrCliWarpToPlayer (unsigned playerId) { - - ASSERT(s_running); - - char cmd[1024]; - StrPrintf(cmd, arrsize(cmd), "CCR.WarpToPlayer %u", playerId); - Send_ExecConsoleCmd(cmd); -} - -//============================================================================ -void CsrCliLinkPlayerHere (unsigned playerId) { - - ASSERT(s_running); - - char cmd[1024]; - StrPrintf(cmd, arrsize(cmd), "CCR.LinkPlayerHere %u", playerId); - Send_ExecConsoleCmd(cmd); -} - -//============================================================================ -void CsrCliLinkToPlayer (unsigned playerId) { - - ASSERT(s_running); - - char cmd[1024]; - StrPrintf(cmd, arrsize(cmd), "CCR.LinkToPlayer %u", playerId); - Send_ExecConsoleCmd(cmd); -} diff --git a/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.h b/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.h deleted file mode 100644 index 2a123f07..00000000 --- a/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.h +++ /dev/null @@ -1,83 +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 . - -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==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.h -* -***/ - -#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNCSRCLI_PNCSRCLI_H -#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNCSRCLI_PNCSRCLI_H - - -#include "pnCsrNet/pnCsrNet.h" - - -/***************************************************************************** -* -* pnCsrCli -* - Connects to pfCsrSrv in remote CSR client. -* - Sends commands to pfCsrSrv for remote execution. -* -***/ - -typedef void (*FCsrCliOnError) (ENetError error); - -void CsrCliInitialize (FCsrCliOnError onError); -void CsrCliShutdown (); - -typedef void (*FCsrCliOnConnect) (ENetError result); - -void CsrCliStartConnecting ( - const wchar_t addr[], - FCsrCliOnConnect onConnect -); -void CsrCliDisconnect (); - -void CsrCliToggleAvatarPhysical (); -void CsrCliWarpPlayerHere (unsigned playerId); -void CsrCliWarpToPlayer (unsigned playerId); -void CsrCliLinkPlayerHere (unsigned playerId); -void CsrCliLinkToPlayer (unsigned playerId); - - -#endif // PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNCSRCLI_PNCSRCLI_H diff --git a/Sources/Plasma/NucleusLib/pnCsrNet/CMakeLists.txt b/Sources/Plasma/NucleusLib/pnCsrNet/CMakeLists.txt deleted file mode 100644 index b942717b..00000000 --- a/Sources/Plasma/NucleusLib/pnCsrNet/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -include_directories(../../CoreLib) -include_directories(../../NucleusLib) - -set(pnCsrNet_SOURCES - pnCsrNet.cpp -) - -set(pnCsrNet_HEADERS - Pch.h - pnCsrNet.h -) - -add_library(pnCsrNet STATIC ${pnCsrNet_SOURCES} ${pnCsrNet_HEADERS}) - -source_group("Source Files" FILES ${pnCsrNet_SOURCES}) -source_group("Header Files" FILES ${pnCsrNet_HEADERS}) \ No newline at end of file diff --git a/Sources/Plasma/NucleusLib/pnCsrNet/Pch.h b/Sources/Plasma/NucleusLib/pnCsrNet/Pch.h deleted file mode 100644 index 1298d8d1..00000000 --- a/Sources/Plasma/NucleusLib/pnCsrNet/Pch.h +++ /dev/null @@ -1,54 +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 . - -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==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnCsrNet/Pch.h -* -***/ - -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNCSRNET_PCH_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnCsrNet/Pch.h included more than once" -#endif -#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNCSRNET_PCH_H - - -#include "pnCsrNet.h" diff --git a/Sources/Plasma/NucleusLib/pnCsrNet/pnCsrNet.cpp b/Sources/Plasma/NucleusLib/pnCsrNet/pnCsrNet.cpp deleted file mode 100644 index d68887a6..00000000 --- a/Sources/Plasma/NucleusLib/pnCsrNet/pnCsrNet.cpp +++ /dev/null @@ -1,49 +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 . - -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==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnCsrNet/pnCsrNet.cpp -* -***/ - -#include "Pch.h" -#pragma hdrstop diff --git a/Sources/Plasma/NucleusLib/pnCsrNet/pnCsrNet.h b/Sources/Plasma/NucleusLib/pnCsrNet/pnCsrNet.h deleted file mode 100644 index f5de1923..00000000 --- a/Sources/Plasma/NucleusLib/pnCsrNet/pnCsrNet.h +++ /dev/null @@ -1,88 +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 . - -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==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnCsrNet/pnCsrNet.h -* -***/ - -#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNCSRNET_PNCSRNET_H -#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNCSRNET_PNCSRNET_H - - -#include "pnSimpleNet/pnSimpleNet.h" - - -/***************************************************************************** -* -* CSR Client Automation - Types and Constants -* -***/ - -// Newer CSR game clients must remain compatible with older CSR tools, -// therefore these values may not change. Only append to this enum. -enum { - kCsrNet_ExecConsoleCmd, -}; - -//============================================================================ -// BEGIN PACKED DATA STRUCTURES -//============================================================================ -#pragma pack(push,1) - -#define CSRNET_MSG(a) \ - CsrNet_##a () : SimpleNet_MsgHeader(kSimpleNetChannelCsr, kCsrNet_##a) { } - -struct CsrNet_ExecConsoleCmd : SimpleNet_MsgHeader { - CSRNET_MSG (ExecConsoleCmd); - - char cmd[1]; // null-terminated string -}; - -#undef CSRNET_MSG -//============================================================================ -// END PACKED DATA STRUCTURES -//============================================================================ -#pragma pack(pop) - - -#endif // PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNCSRNET_PNCSRNET_H diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbConst.h b/Sources/Plasma/NucleusLib/pnNetBase/pnNbConst.h index 5700e2b2..ca26c243 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbConst.h +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbConst.h @@ -121,20 +121,6 @@ const AccountRoleInfo kAccountRoles[] = { { kAccountRolesAllUserFlags, "End" } }; - -/***************************************************************************** -* -* Csr -* -***/ - -enum ECsrFlags { - kCsrFlagAdmin = 1 << 0, - kCsrFlagDisabled = 1 << 1, - kCsrFlagServer = 1 << 2, -}; - - /***************************************************************************** * * Game Score Types diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbKeys.cpp b/Sources/Plasma/NucleusLib/pnNetBase/pnNbKeys.cpp index 689013c2..4c421a73 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbKeys.cpp +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbKeys.cpp @@ -46,10 +46,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com uint8_t kAuthDhNData[kNetDiffieHellmanKeyBits / 8] = {0}; uint8_t kAuthDhXData[kNetDiffieHellmanKeyBits / 8] = {0}; -// CSR Server -uint8_t kCsrDhNData[kNetDiffieHellmanKeyBits / 8] = {0}; -uint8_t kCsrDhXData[kNetDiffieHellmanKeyBits / 8] = {0}; - // Game Server uint8_t kGameDhNData[kNetDiffieHellmanKeyBits / 8] = {0}; uint8_t kGameDhXData[kNetDiffieHellmanKeyBits / 8] = {0}; diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbKeys.h b/Sources/Plasma/NucleusLib/pnNetBase/pnNbKeys.h index f5dce58b..235795f2 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbKeys.h +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbKeys.h @@ -51,11 +51,6 @@ static const unsigned kAuthDhGValue = 41; extern uint8_t kAuthDhNData[kNetDiffieHellmanKeyBits / 8]; extern uint8_t kAuthDhXData[kNetDiffieHellmanKeyBits / 8]; -// CSR Server -static const unsigned kCsrDhGValue = 97; -extern uint8_t kCsrDhNData[kNetDiffieHellmanKeyBits / 8]; -extern uint8_t kCsrDhXData[kNetDiffieHellmanKeyBits / 8]; - // Game Server static const unsigned kGameDhGValue = 73; extern uint8_t kGameDhNData[kNetDiffieHellmanKeyBits / 8]; diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbProtocol.cpp b/Sources/Plasma/NucleusLib/pnNetBase/pnNbProtocol.cpp index 80b5955d..a6946de0 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbProtocol.cpp +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbProtocol.cpp @@ -59,12 +59,12 @@ const wchar_t * NetProtocolToString (ENetProtocol protocol) { { kNetProtocolDebug, L"kNetProtocolDebug" }, // Client connections - { kNetProtocolCli2Csr, L"GateKeeper Server" }, - { kNetProtocolCli2Csr, L"Csr Server" }, - { kNetProtocolCli2Auth, L"Auth Server" }, - { kNetProtocolCli2Game, L"Game Server" }, - { kNetProtocolCli2File, L"File Server" }, - { kNetProtocolCli2Unused_01, L"kNetProtocolCli2Unused_01" }, + { kNetProtocolCli2GateKeeper, L"GateKeeper Server" }, + { kNetProtocolCli2Unused_02, L"kNetProtocolCli2Unused_02" }, + { kNetProtocolCli2Auth, L"Auth Server" }, + { kNetProtocolCli2Game, L"Game Server" }, + { kNetProtocolCli2File, L"File Server" }, + { kNetProtocolCli2Unused_01, L"kNetProtocolCli2Unused_01" }, // Server connections { kNetProtocolSrvConn, L"kNetProtocolSrvConn" }, diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbProtocol.h b/Sources/Plasma/NucleusLib/pnNetBase/pnNbProtocol.h index 63fa92cb..e3df91b3 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbProtocol.h +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbProtocol.h @@ -64,7 +64,7 @@ enum ENetProtocol { // Client connections kNetProtocolCli2GateKeeper = 2, - kNetProtocolCli2Csr = 3, + kNetProtocolCli2Unused_02 = 3, kNetProtocolCli2Auth = 4, kNetProtocolCli2Game = 5, kNetProtocolCli2File = 6, diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.cpp b/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.cpp index 47dfa188..0daab489 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.cpp +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.cpp @@ -65,12 +65,6 @@ static const char* s_fileAddrs[] = { }; -static char s_csrAddrConsole[64] = {0}; -static const char* s_csrAddrs[] = { - s_csrAddrConsole -}; - - static char s_gateKeeperAddrConsole[64] = {0}; static const char* s_gateKeeperAddrs[] = { s_gateKeeperAddrConsole @@ -113,22 +107,6 @@ void SetFileSrvHostname (const char addr[]) { strncpy(s_fileAddrConsole, addr, arrsize(s_fileAddrConsole)); } -//============================================================================ -// Csr -//============================================================================ -unsigned GetCsrSrvHostnames (const char*** addrs) { - - *addrs = s_csrAddrs; - return arrsize(s_csrAddrs); -} - -//============================================================================ -void SetCsrSrvHostname (const char addr[]) { - - strncpy(s_csrAddrConsole, addr, arrsize(s_csrAddrConsole)); -} - - //============================================================================ // GateKeeper //============================================================================ diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.h b/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.h index a7746e12..88850b0f 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.h +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.h @@ -68,7 +68,7 @@ enum ESrvType { kSrvTypeLog = 9, kSrvTypeDll = 10, kSrvTypeScore = 11, - kSrvTypeCsr = 12, + kSrvTypeCsr = 12, // DEAD kSrvTypeGateKeeper = 13, kNumSrvTypes, @@ -90,9 +90,6 @@ void SetAuthSrvHostname (const char addr[]); unsigned GetFileSrvHostnames (const char*** addrs); // returns addrCount void SetFileSrvHostname (const char addr[]); -unsigned GetCsrSrvHostnames (const char*** addrs); // returns addrCount -void SetCsrSrvHostname (const char addr[]); - unsigned GetGateKeeperSrvHostnames (const char*** addrs); // returns addrCount void SetGateKeeperSrvHostname (const char addr[]); diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/CMakeLists.txt b/Sources/Plasma/NucleusLib/pnNetProtocol/CMakeLists.txt index 4c936d2a..a6a65a51 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/CMakeLists.txt +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/CMakeLists.txt @@ -22,11 +22,6 @@ set(pnNetProtocol_PROTO_CLI2AUTH Private/Protocols/Cli2Auth/pnNpCli2Auth.cpp ) -set(pnNetProtocol_PROTO_CLI2CSR - Private/Protocols/Cli2Csr/pnNpCli2Csr.h - Private/Protocols/Cli2Csr/pnNpCli2Csr.cpp -) - set(pnNetProtocol_PROTO_CLI2FILE Private/Protocols/Cli2File/pnNpCli2File.h Private/Protocols/Cli2File/pnNpCli2File.cpp @@ -73,18 +68,16 @@ set(pnNetProtocol_PROTO_SRV2VAULT ) add_library(pnNetProtocol STATIC ${pnNetProtocol_HEADERS} ${pnNetProtocol_PRIVATE} - ${pnNetProtocol_PROTO_CLI2AUTH} ${pnNetProtocol_PROTO_CLI2CSR} - ${pnNetProtocol_PROTO_CLI2FILE} ${pnNetProtocol_PROTO_CLI2GAME} - ${pnNetProtocol_PROTO_CLI2GK} ${pnNetProtocol_PROTO_SRV2DB} - ${pnNetProtocol_PROTO_SRV2LOG} ${pnNetProtocol_PROTO_SRV2MCP} - ${pnNetProtocol_PROTO_SRV2SCORE} ${pnNetProtocol_PROTO_SRV2STATE} - ${pnNetProtocol_PROTO_SRV2VAULT} + ${pnNetProtocol_PROTO_CLI2AUTH} ${pnNetProtocol_PROTO_CLI2FILE} + ${pnNetProtocol_PROTO_CLI2GAME} ${pnNetProtocol_PROTO_CLI2GK} + ${pnNetProtocol_PROTO_SRV2DB} ${pnNetProtocol_PROTO_SRV2LOG} + ${pnNetProtocol_PROTO_SRV2MCP} ${pnNetProtocol_PROTO_SRV2SCORE} + ${pnNetProtocol_PROTO_SRV2STATE} ${pnNetProtocol_PROTO_SRV2VAULT} ) source_group("Header Files" FILES ${pnNetProtocol_HEADERS}) source_group("Private" FILES ${pnNetProtocol_PRIVATE}) source_group("Private\\Cli2Auth" FILES ${pnNetProtocol_PROTO_CLI2AUTH}) -source_group("Private\\Cli2Csr" FILES ${pnNetProtocol_PROTO_CLI2CSR}) source_group("Private\\Cli2File" FILES ${pnNetProtocol_PROTO_CLI2FILE}) source_group("Private\\Cli2Game" FILES ${pnNetProtocol_PROTO_CLI2GAME}) source_group("Private\\Cli2GateKeeper" FILES ${pnNetProtocol_PROTO_CLI2GK}) diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.cpp b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.cpp deleted file mode 100644 index cc73a041..00000000 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.cpp +++ /dev/null @@ -1,122 +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 . - -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==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.cpp -* -***/ - -#define USES_PROTOCOL_CLI2CSR -#include "../../../Pch.h" -#pragma hdrstop - - -namespace Cli2Csr { -/***************************************************************************** -* -* Cli2Csr message field definitions -* -***/ - -static const NetMsgField kPingRequestFields[] = { - kNetMsgFieldTransId, // transId - kNetMsgFieldTimeMs, // pingTimeMs - NET_MSG_FIELD_VAR_COUNT(1, 64 * 1024), // payloadBytes - NET_MSG_FIELD_VAR_PTR(), // payload -}; - -static const NetMsgField kRegisterRequestFields[] = { - kNetMsgFieldTransId, // transId -}; - -static const NetMsgField kLoginRequestFields[] = { - kNetMsgFieldTransId, // transId - NET_MSG_FIELD_DWORD(), // clientChallenge - kNetMsgFieldAccountName, // csrName - kNetMsgFieldShaDigest, // challenge -}; - - -/***************************************************************************** -* -* Csr2Cli message field definitions -* -***/ - -static const NetMsgField kPingReplyFields[] = { - kNetMsgFieldTransId, // transId - kNetMsgFieldTimeMs, // pingTimeMs - NET_MSG_FIELD_VAR_COUNT(1, 64 * 1024), // payloadBytes - NET_MSG_FIELD_VAR_PTR(), // payload -}; - -static const NetMsgField kRegisterReplyFields[] = { - kNetMsgFieldTransId, // transId - NET_MSG_FIELD_DWORD(), // serverChallenge - NET_MSG_FIELD_DWORD(), // latestBuildId -}; - -static const NetMsgField kLoginReplyFields[] = { - kNetMsgFieldTransId, // transId - kNetMsgFieldENetError, // result - kNetMsgFieldUuid, // csrId - NET_MSG_FIELD_DWORD(), // csrFlags -}; - - -} using namespace Cli2Csr; - - -/***************************************************************************** -* -* Exports -* -***/ - -const NetMsg kNetMsg_Cli2Csr_PingRequest = NET_MSG(kCli2Csr_PingRequest, kPingRequestFields); -const NetMsg kNetMsg_Cli2Csr_RegisterRequest = NET_MSG(kCli2Csr_RegisterRequest, kRegisterRequestFields); -const NetMsg kNetMsg_Cli2Csr_LoginRequest = NET_MSG(kCli2Csr_LoginRequest, kLoginRequestFields); - -const NetMsg kNetMsg_Csr2Cli_PingReply = NET_MSG(kCsr2Cli_PingReply, kPingReplyFields); -const NetMsg kNetMsg_Csr2Cli_RegisterReply = NET_MSG(kCsr2Cli_RegisterReply, kRegisterReplyFields); -const NetMsg kNetMsg_Csr2Cli_LoginReply = NET_MSG(kCsr2Cli_LoginReply, kLoginReplyFields); - diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.h deleted file mode 100644 index df373048..00000000 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.h +++ /dev/null @@ -1,178 +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 . - -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==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.h -* -***/ - -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_CLI2CSR_PNNPCLI2CSR_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.h included more than once" -#endif -#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_CLI2CSR_PNNPCLI2CSR_H - - -/***************************************************************************** -* -* kNetProtocolCli2Csr message ids -* -***/ - -// Because SrvCsr must remain backward compatible with all client builds, -// the following enum values may never change under any circumstances. - -//============================================================================ -// Cli2Csr - -enum { - // Misc - kCli2Csr_PingRequest = 0, - // Encrypt - kCli2Csr_RegisterRequest = 1, - // Login - kCli2Csr_LoginRequest = 2, - // Patch - kCli2Csr_PatchRequest = 3, - - kNumCli2CsrMessages -}; -COMPILER_ASSERT_HEADER(Cli2Scr, kNumCli2CsrMessages <= (uint16_t)-1); - - -//============================================================================ -// Csr2Cli - -enum { - // Misc - kCsr2Cli_PingReply = 0, - // Encrypt - kCsr2Cli_RegisterReply = 1, - // Login - kCsr2Cli_LoginReply = 2, - // Patch - kCli2Csr_PatchReply = 3, - - kNumCsr2CliMessages -}; -COMPILER_ASSERT_HEADER(Cli2Scr, kNumCsr2CliMessages <= (uint16_t)-1); - - -/***************************************************************************** -* -* Networked structures -* -***/ -#pragma pack(push,1) - -//============================================================================ -// Connect packet - -struct Cli2Csr_ConnData { - uint32_t dataBytes; -}; -struct Cli2Csr_Connect { - AsyncSocketConnectPacket hdr; - Cli2Csr_ConnData data; -}; - -//============================================================================ -// Message header - -struct Cli2Csr_MsgHeader { - uint32_t messageId; - uint32_t transId; -}; - -//============================================================================ -// Cli --> Csr message structures - -// PingRequest -extern const NetMsg kNetMsg_Cli2Csr_PingRequest; -struct Cli2Csr_PingRequest : Cli2Csr_MsgHeader { - uint32_t pingTimeMs; - uint32_t payloadBytes; - uint8_t payload[1]; // [payloadBytes] -}; - -// RegisterRequest -extern const NetMsg kNetMsg_Cli2Csr_RegisterRequest; -struct Cli2Csr_RegisterRequest : Cli2Csr_MsgHeader { -}; - -// LoginRequest -extern const NetMsg kNetMsg_Cli2Csr_LoginRequest; -struct Cli2Csr_LoginRequest : Cli2Csr_MsgHeader { - uint32_t clientChallenge; - wchar_t csrName[kMaxAccountNameLength]; - ShaDigest challengeHash; -}; - - -//============================================================================ -// Csr --> Cli message structures - -// PingReply -extern const NetMsg kNetMsg_Csr2Cli_PingReply; -struct Csr2Cli_PingReply : Cli2Csr_MsgHeader { - uint32_t pingTimeMs; - uint32_t payloadBytes; - uint8_t payload[1]; // [payloadBytes] -}; - -// RegisterReply -extern const NetMsg kNetMsg_Csr2Cli_RegisterReply; -struct Csr2Cli_RegisterReply : Cli2Csr_MsgHeader { - uint32_t serverChallenge; - uint32_t csrBuildId; // buildId of the latest csr client -}; - -// LoginReply -extern const NetMsg kNetMsg_Csr2Cli_LoginReply; -struct Csr2Cli_LoginReply : Cli2Csr_MsgHeader { - ENetError result; - Uuid csrId; - uint32_t csrFlags; -}; - - -#pragma pack(pop) - diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpAllIncludes.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpAllIncludes.h index 6526fe3c..10b64ca9 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpAllIncludes.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpAllIncludes.h @@ -76,10 +76,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com # include "Protocols/Cli2Game/pnNpCli2Game.h" # endif -# ifdef USES_PROTOCOL_CLI2CSR -# include "Protocols/Cli2Csr/pnNpCli2Csr.h" -# endif - # ifdef USES_PROTOCOL_CLI2GATEKEEPER # include "Protocols/Cli2GateKeeper/pnNpCli2GateKeeper.h" # endif diff --git a/Sources/Plasma/NucleusLib/pnSimpleNet/CMakeLists.txt b/Sources/Plasma/NucleusLib/pnSimpleNet/CMakeLists.txt deleted file mode 100644 index 77d60d72..00000000 --- a/Sources/Plasma/NucleusLib/pnSimpleNet/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -include_directories("../../CoreLib") -include_directories("../../NucleusLib") - -set(pnSimpleNet_HEADERS - pnSimpleNet.h -) - -set(pnSimpleNet_SOURCES - pnSimpleNet.cpp -) - -add_library(pnSimpleNet STATIC ${pnSimpleNet_HEADERS} ${pnSimpleNet_SOURCES}) - -source_group("Header Files" FILES ${pnSimpleNet_HEADERS}) -source_group("Source Files" FILES ${pnSimpleNet_SOURCES}) diff --git a/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.cpp b/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.cpp deleted file mode 100644 index 865dae2e..00000000 --- a/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.cpp +++ /dev/null @@ -1,658 +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 . - -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==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.cpp -* -***/ - -#include "pnSimpleNet.h" -#include "hsThread.h" - -#include -#include - -/***************************************************************************** -* -* Local types -* -***/ - -struct SimpleNetConn : AtomicRef { - AsyncSocket sock; - AsyncCancelId cancelId; - uint32_t channelId; - bool abandoned; - struct ConnectParam * connectParam; - - SimpleNet_MsgHeader * oversizeMsg; - ARRAY(uint8_t) oversizeBuffer; -}; - -struct SimpleNetChannel : AtomicRef { - FSimpleNetOnMsg onMsg; - FSimpleNetOnError onError; - uint32_t channelId; - std::list conns; - - SimpleNetChannel (uint32_t channel) : channelId(channel) { } - ~SimpleNetChannel () { - ASSERT(!conns.size()); - } -}; - -struct ConnectParam { - SimpleNetChannel * channel; - FSimpleNetOnConnect callback; - void * param; - - ~ConnectParam () { - if (channel) - channel->DecRef(); - } -}; - - -/***************************************************************************** -* -* Local data -* -***/ - -static bool s_running; -static hsMutex s_critsect; -static FSimpleNetQueryAccept s_queryAccept; -static void * s_queryAcceptParam; -static std::map s_channels; - - -/***************************************************************************** -* -* Local functions -* -***/ - -//============================================================================ -static void NotifyConnSocketConnect (SimpleNetConn * conn) { - - conn->TransferRef("Connecting", "Connected"); - - conn->connectParam->callback( - conn->connectParam->param, - conn, - kNetSuccess - ); - - delete conn->connectParam; - conn->connectParam = nil; -} - -//============================================================================ -static void NotifyConnSocketConnectFailed (SimpleNetConn * conn) { - - s_critsect.Lock(); - { - std::map::iterator it; - if ((it = s_channels.find(conn->channelId)) != s_channels.end()) { - it->second->conns.remove(conn); - } - } - s_critsect.Unlock(); - - conn->connectParam->callback( - conn->connectParam->param, - nil, - kNetErrConnectFailed - ); - - delete conn->connectParam; - conn->connectParam = nil; - - conn->DecRef("Connecting"); - conn->DecRef("Lifetime"); -} - -//============================================================================ -static void NotifyConnSocketDisconnect (SimpleNetConn * conn) { - - bool abandoned; - SimpleNetChannel* channel = nil; - s_critsect.Lock(); - { - abandoned = conn->abandoned; - std::map::iterator it; - if ((it = s_channels.find(conn->channelId)) != s_channels.end()) { - channel = it->second; - channel->IncRef(); - channel->conns.remove(conn); - } - } - s_critsect.Unlock(); - - if (channel && !abandoned) { - channel->onError(conn, kNetErrDisconnected); - channel->DecRef(); - } - - conn->DecRef("Connected"); -} - -//============================================================================ -static bool NotifyConnSocketRead (SimpleNetConn * conn, AsyncNotifySocketRead * read) { - - SimpleNetChannel* channel = nil; - s_critsect.Lock(); - { - std::map::iterator it; - if ((it = s_channels.find(conn->channelId)) != s_channels.end()) { - channel = it->second; - channel->IncRef(); - } - } - s_critsect.Unlock(); - - if (!channel) - return false; - - bool result = true; - - const uint8_t * curr = read->buffer; - const uint8_t * term = curr + read->bytes; - - while (curr < term) { - // Reading oversize msg? - if (conn->oversizeBuffer.Count()) { - unsigned spaceLeft = conn->oversizeMsg->messageBytes - conn->oversizeBuffer.Count(); - unsigned copyBytes = min(spaceLeft, term - curr); - conn->oversizeBuffer.Add(curr, copyBytes); - - curr += copyBytes; - - // Wait until we have received the entire message - if (copyBytes != spaceLeft) - break; - - // Dispatch oversize msg - if (!channel->onMsg(conn, conn->oversizeMsg)) { - result = false; - break; - } - - conn->oversizeBuffer.SetCount(0); - continue; - } - - // Wait until we receive the entire message header - if (term - curr < sizeof(SimpleNet_MsgHeader)) - break; - - SimpleNet_MsgHeader * msg = (SimpleNet_MsgHeader *) read->buffer; - - // Sanity check message size - if (msg->messageBytes < sizeof(*msg)) { - result = false; - break; - } - - // Handle oversized messages - if (msg->messageBytes > kAsyncSocketBufferSize) { - - conn->oversizeBuffer.SetCount(msg->messageBytes); - conn->oversizeMsg = (SimpleNet_MsgHeader *) conn->oversizeBuffer.Ptr(); - *conn->oversizeMsg = *msg; - - curr += sizeof(*msg); - continue; - } - - // Wait until we have received the entire message - const uint8_t * msgTerm = (const uint8_t *) curr + msg->messageBytes; - if (msgTerm > term) - break; - curr = msgTerm; - - // Dispatch msg - if (!channel->onMsg(conn, msg)) { - result = false; - break; - } - } - - // Return count of bytes we processed - read->bytesProcessed = curr - read->buffer; - - channel->DecRef(); - return result; -} - -//============================================================================ -static bool AsyncNotifySocketProc ( - AsyncSocket sock, - EAsyncNotifySocket code, - AsyncNotifySocket * notify, - void ** userState -) { - bool result = true; - SimpleNetConn * conn; - - switch (code) { - case kNotifySocketListenSuccess: { - - AsyncNotifySocketListen * listen = (AsyncNotifySocketListen *) notify; - - const SimpleNet_ConnData & connect = *(const SimpleNet_ConnData *) listen->buffer; - listen->bytesProcessed += sizeof(connect); - - SimpleNetChannel* channel = nil; - s_critsect.Lock(); - { - std::map::iterator it; - if ((it = s_channels.find(connect.channelId)) != s_channels.end()) { - channel = it->second; - channel->IncRef(); - } - } - s_critsect.Unlock(); - - if (!channel) - break; - - conn = NEWZERO(SimpleNetConn); - conn->channelId = channel->channelId; - conn->IncRef("Lifetime"); - conn->IncRef("Connected"); - conn->sock = sock; - *userState = conn; - - bool accepted = s_queryAccept( - s_queryAcceptParam, - channel->channelId, - conn, - listen->remoteAddr - ); - - if (!accepted) { - SimpleNetDisconnect(conn); - } - else { - s_critsect.Lock(); - { - channel->conns.push_back(conn); - } - s_critsect.Unlock(); - } - - channel->DecRef(); - } - break; - - case kNotifySocketConnectSuccess: { - conn = (SimpleNetConn *) notify->param; - *userState = conn; - bool abandoned; - - s_critsect.Lock(); - { - conn->sock = sock; - conn->cancelId = 0; - abandoned = conn->abandoned; - } - s_critsect.Unlock(); - - if (abandoned) - AsyncSocketDisconnect(sock, true); - else - NotifyConnSocketConnect(conn); - } - break; - - case kNotifySocketConnectFailed: - conn = (SimpleNetConn *) notify->param; - NotifyConnSocketConnectFailed(conn); - break; - - case kNotifySocketDisconnect: - conn = (SimpleNetConn *) *userState; - NotifyConnSocketDisconnect(conn); - break; - - case kNotifySocketRead: - conn = (SimpleNetConn *) *userState; - result = NotifyConnSocketRead(conn, (AsyncNotifySocketRead *) notify); - break; - - default: - break; - } - - return result; -} - -//============================================================================ -static void Connect(const plNetAddress& addr, ConnectParam * cp) { - - SimpleNetConn * conn = NEWZERO(SimpleNetConn); - conn->channelId = cp->channel->channelId; - conn->connectParam = cp; - conn->IncRef("Lifetime"); - conn->IncRef("Connecting"); - - s_critsect.Lock(); - { - cp->channel->conns.push_back(conn); - - SimpleNet_Connect connect; - connect.hdr.connType = kConnTypeSimpleNet; - connect.hdr.hdrBytes = sizeof(connect.hdr); - connect.hdr.buildId = BuildId(); - connect.hdr.buildType = BUILD_TYPE_LIVE; - connect.hdr.branchId = BranchId(); - connect.hdr.productId = ProductId(); - connect.data.channelId = cp->channel->channelId; - - AsyncSocketConnect( - &conn->cancelId, - addr, - AsyncNotifySocketProc, - conn, - &connect, - sizeof(connect) - ); - - conn = nil; - cp = nil; - } - s_critsect.Unlock(); - - delete conn; - delete cp; -} - -//============================================================================ -static void AsyncLookupCallback ( - void * param, - const char name[], - unsigned addrCount, - const plNetAddress addrs[] -) { - ConnectParam * cp = (ConnectParam *)param; - - if (!addrCount) { - if (cp->callback) - cp->callback(cp->param, nil, kNetErrNameLookupFailed); - delete cp; - return; - } - - Connect(addrs[0], (ConnectParam *)param); -} - - -/***************************************************************************** -* -* Exported functions -* -***/ - -//============================================================================ -void SimpleNetInitialize () { - - s_running = true; - - AsyncSocketRegisterNotifyProc( - kConnTypeSimpleNet, - AsyncNotifySocketProc - ); -} - -//============================================================================ -void SimpleNetShutdown () { - - s_running = false; - - ASSERT(!s_channels.size()); - - AsyncSocketUnregisterNotifyProc( - kConnTypeSimpleNet, - AsyncNotifySocketProc - ); -} - -//============================================================================ -void SimpleNetConnIncRef (SimpleNetConn * conn) { - - ASSERT(s_running); - ASSERT(conn); - - conn->IncRef(); -} - -//============================================================================ -void SimpleNetConnDecRef (SimpleNetConn * conn) { - - ASSERT(s_running); - ASSERT(conn); - - conn->DecRef(); -} - -//============================================================================ -bool SimpleNetStartListening ( - FSimpleNetQueryAccept queryAccept, - void * param -) { - ASSERT(s_running); - ASSERT(queryAccept); - ASSERT(!s_queryAccept); - - s_queryAccept = queryAccept; - s_queryAcceptParam = param; - - plNetAddress addr; - addr.SetPort(kNetDefaultSimpleNetPort); - addr.SetAnyAddr(); - return (0 != AsyncSocketStartListening(addr, nil)); -} - -//============================================================================ -void SimpleNetStopListening () { - - ASSERT(s_running); - - plNetAddress addr; - addr.SetPort(kNetDefaultSimpleNetPort); - addr.SetAnyAddr(); - AsyncSocketStopListening(addr, nil); - - s_queryAccept = nil; - s_queryAcceptParam = nil; -} - -//============================================================================ -void SimpleNetCreateChannel ( - unsigned channelId, - FSimpleNetOnMsg onMsg, - FSimpleNetOnError onError -) { - ASSERT(s_running); - - SimpleNetChannel * channel = NEWZERO(SimpleNetChannel)(channelId); - channel->IncRef(); - - s_critsect.Lock(); - { - #ifdef HS_DEBUGGING - { - std::map::iterator it = s_channels.find(channelId); - ASSERT(it == s_channels.end()); - } - #endif - - channel->onMsg = onMsg; - channel->onError = onError; - s_channels[channelId] = channel; - channel->IncRef(); - } - s_critsect.Unlock(); - - channel->DecRef(); -} - -//============================================================================ -void SimpleNetDestroyChannel (unsigned channelId) { - - ASSERT(s_running); - - SimpleNetChannel * channel; - s_critsect.Lock(); - { - std::map::iterator it; - if ((it = s_channels.find(channelId)) != s_channels.end()) { - channel = it->second; - - while (channel->conns.size()) { - SimpleNetConn* conn = channel->conns.front(); - SimpleNetDisconnect(conn); - - channel->conns.pop_front(); - } - - s_channels.erase(it); - } - } - s_critsect.Unlock(); - - if (channel) - channel->DecRef(); -} - -//============================================================================ -void SimpleNetStartConnecting ( - unsigned channelId, - const char addr[], - FSimpleNetOnConnect onConnect, - void * param -) { - ASSERT(s_running); - ASSERT(onConnect); - - ConnectParam * cp = new ConnectParam; - cp->callback = onConnect; - cp->param = param; - cp->channel = nil; - - s_critsect.Lock(); - { - std::map::iterator it; - if ((it = s_channels.find(channelId)) != s_channels.end()) { - cp->channel = it->second; - cp->channel->IncRef(); - } - } - s_critsect.Unlock(); - - ASSERT(cp->channel); - - // Do we need to lookup the address? - const char* name = addr; - while (unsigned ch = *name) { - ++name; - if (!(isdigit(ch) || ch == L'.' || ch == L':')) { - - AsyncCancelId cancelId; - AsyncAddressLookupName( - &cancelId, - AsyncLookupCallback, - addr, - kNetDefaultSimpleNetPort, - cp - ); - break; - } - } - if (!name[0]) { - plNetAddress netAddr(addr, kNetDefaultSimpleNetPort); - Connect(netAddr, cp); - } -} - -//============================================================================ -void SimpleNetDisconnect ( - SimpleNetConn * conn -) { - ASSERT(s_running); - ASSERT(conn); - - s_critsect.Lock(); - { - conn->abandoned = true; - if (conn->sock) { - AsyncSocketDisconnect(conn->sock, true); - conn->sock = nil; - } - else if (conn->cancelId) { - AsyncSocketConnectCancel(AsyncNotifySocketProc, conn->cancelId); - conn->cancelId = nil; - } - } - s_critsect.Unlock(); - - conn->DecRef("Lifetime"); -} - -//============================================================================ -void SimpleNetSend ( - SimpleNetConn * conn, - SimpleNet_MsgHeader * msg -) { - ASSERT(s_running); - ASSERT(msg); - ASSERT(msg->messageBytes != (uint32_t)-1); - ASSERT(conn); - - s_critsect.Lock(); - { - if (conn->sock) - AsyncSocketSend(conn->sock, msg, msg->messageBytes); - } - s_critsect.Unlock(); -} diff --git a/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.h b/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.h deleted file mode 100644 index b4c60f40..00000000 --- a/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.h +++ /dev/null @@ -1,185 +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 . - -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==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.h -* -***/ - -#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNSIMPLENET_PNSIMPLENET_H -#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNSIMPLENET_PNSIMPLENET_H - - -#include "pnUtils/pnUtils.h" -#include "pnProduct/pnProduct.h" -#include "pnNetBase/pnNetBase.h" -#include "pnAsyncCore/pnAsyncCore.h" -#include "pnNetCommon/plNetAddress.h" - -/***************************************************************************** -* -* SimpleNet: -* - TCP only, Nagle buffered only. -* - Asynchronous callbacks only. -* - Not encrypted, not compressed, no transaction support. -* - Good for trivial networked applications only. Examples include: -* - CSR client automation by CSR tools. -* - Bob and I (eap) talked about 3dsmax automating -* the client for the purpose of reloading reexported -* assets. With SimpleNet, the client could be running -* on a separate machine than Max. -* -***/ - -// Because newer clients must remain compatible with older servers, -// these values may never change. -enum ESimpleNetChannel { - kSimpleNetChannelNil = 0, - kSimpleNetChannelCsr = 1, - kSimpleNetChannelMax = 2, - - kMaxSimpleNetChannels -}; -COMPILER_ASSERT_HEADER(ESimpleNetChannel, kMaxSimpleNetChannels <= 0xff); - - -//============================================================================ -// BEGIN PACKED DATA STRUCTURES -//============================================================================ -#pragma pack(push,1) - -//============================================================================ -// Connect packet - -struct SimpleNet_ConnData { - unsigned channelId; -}; -struct SimpleNet_Connect { - AsyncSocketConnectPacket hdr; - SimpleNet_ConnData data; -}; - -//============================================================================ -// Message header - -struct SimpleNet_MsgHeader { -private: - uint32_t channelId; -public: - uint32_t messageId; - uint32_t messageBytes; - - SimpleNet_MsgHeader (uint32_t channelId, uint32_t messageId) - : channelId(channelId) - , messageId(messageId) - #ifdef HS_DEBUGGING - , messageBytes((uint32_t)-1) - #endif - { } -}; - - -/***************************************************************************** -* -* Simple Network API -* -***/ - -struct SimpleNetConn; - -void SimpleNetInitialize (); -void SimpleNetShutdown (); - -void SimpleNetConnIncRef (SimpleNetConn * conn); -void SimpleNetConnDecRef (SimpleNetConn * conn); - -typedef bool (*FSimpleNetOnMsg) ( // return false to disconnect socket - SimpleNetConn * conn, - SimpleNet_MsgHeader * msg -); -typedef void (*FSimpleNetOnError) ( - SimpleNetConn * conn, - ENetError error -); -typedef void (*FSimpleNetOnConnect) ( - void * param, - SimpleNetConn * conn, - ENetError result -); -typedef bool (*FSimpleNetQueryAccept) ( // return true to accept incoming connection - void * param, - unsigned channel, - SimpleNetConn * conn, - const plNetAddress& addr -); - -void SimpleNetCreateChannel ( - unsigned channel, - FSimpleNetOnMsg onMsg, - FSimpleNetOnError onError -); -void SimpleNetDestroyChannel ( - unsigned channel -); - -bool SimpleNetStartListening ( - FSimpleNetQueryAccept queryAccept, - void * param -); -void SimpleNetStopListening (); - -void SimpleNetStartConnecting ( - unsigned channel, - const wchar_t addr[], - FSimpleNetOnConnect onConnect, - void * param -); -void SimpleNetDisconnect ( - SimpleNetConn * conn -); -void SimpleNetSend ( - SimpleNetConn * conn, - SimpleNet_MsgHeader * msg -); -#pragma pack(pop) - -#endif // PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNSIMPLENET_PNSIMPLENET_H diff --git a/Sources/Plasma/PubUtilLib/CMakeLists.txt b/Sources/Plasma/PubUtilLib/CMakeLists.txt index 859d6d67..367e334d 100644 --- a/Sources/Plasma/PubUtilLib/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/CMakeLists.txt @@ -10,14 +10,10 @@ add_subdirectory(plClientResMgr) add_subdirectory(plClipboard) add_subdirectory(plCompression) add_subdirectory(plContainer) -#add_subdirectory(plDeviceSelector) # Not being used by any current slns add_subdirectory(plDrawable) add_subdirectory(plFile) -#add_subdirectory(plGClip) # Not being used by any current slns -#add_subdirectory(plGeometry) # Not being used by any current slns add_subdirectory(plGImage) add_subdirectory(plGLight) -#add_subdirectory(plGRenderProcs) # Not being used by any current slns add_subdirectory(plInputCore) add_subdirectory(plInterp) add_subdirectory(plIntersect) diff --git a/Sources/Plasma/PubUtilLib/plDeviceSelector/plDeviceSelector.cpp b/Sources/Plasma/PubUtilLib/plDeviceSelector/plDeviceSelector.cpp deleted file mode 100644 index 1bd6e2aa..00000000 --- a/Sources/Plasma/PubUtilLib/plDeviceSelector/plDeviceSelector.cpp +++ /dev/null @@ -1,587 +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 . - -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 "plDeviceSelector.h" -#include "hsStream.h" -#include "hsUtils.h" - -#include - -DeviceSelector::DeviceSelector() : - fSelDevType(hsG3DDeviceSelector::kDevTypeUnknown), - fSelDev(0), - fSelMode(0), - fDevDesc(0), - fModeDesc(0), - fPerformance(0), - fFilterBPP(0), - fFilterWidth(0), - fFilterHeight(0), - fWindowed(false) -{ - memset(fStr, 0x00, sizeof(fStr)); -} - -const char *DeviceSelector::GetErrorString( void ) -{ - return fSelector.GetErrorString(); -} - -hsBool DeviceSelector::Enumerate(HWND hWnd, hsBool expertMode ) -{ - plDemoDebugFile::Enable( true ); /// ALWAYS enable (well, for now at least) - - if( !fSelector.Init() ) - return false; - - fSelector.Enumerate(hWnd); - - // 11.25.2000 mcn - Now we are tough if we're not in expert mode - fSelector.RemoveUnusableDevModes( !expertMode ); - - // Sort the modes - hsTArray &recs = fSelector.GetDeviceRecords(); - for (int32_t i = 0; i < recs.Count(); i++) - { - hsTArray &modes = recs[i].GetModes(); - std::sort(modes.FirstIter(), modes.StopIter()); - } - - IRefreshFilter(); - - return true; -} - -void DeviceSelector::SetModeFilter( int bitDepth, int minWidth, int minHeight ) -{ - fFilterBPP = bitDepth; - fFilterWidth = minWidth; - fFilterHeight = minHeight; - - IRefreshFilter(); -} - -void DeviceSelector::IRefreshFilter( void ) -{ - if (fSelDev >= fRecords.Count() ) - return; - - // Make sure to preserve fSelMode if possible - const hsG3DDeviceMode *oldMode = nil; - if( fSelMode < fFilteredModes.GetCount() && fFilteredModes[ fSelMode ]GetColorDepth() ) - continue; - - if( mode->GetWidth() < fFilterWidth || mode->GetHeight() < fFilterHeight ) - continue; - - // Remove any non 4:3 modes - bool goodAspectRatio = (mode->GetWidth() / 4 == mode->GetHeight() / 3) && - (mode->GetWidth() % 4 == 0) && - (mode->GetHeight() % 3 == 0); - - if (!goodAspectRatio && !(mode->GetWidth() == 1280 && mode->GetHeight() == 1024)) - { - continue; - } - - // Add the remaining to our filter index - fFilteredModes.Append( i ); - } - - if( oldMode != nil ) - { - fSelMode = IFindFiltered( GetModeNum( oldMode ) ); - if( fSelMode == -1 ) - { - // Try w/o bpp - fSelMode = IFindFiltered( IGetModeNumNoBPP( oldMode ) ); - if( fSelMode == -1 ) - fSelMode = 0; - } - } - else - fSelMode = 0; - -} - -int DeviceSelector::IFindFiltered( int realIndex ) -{ - int idx = fFilteredModes.Find( realIndex ); - if( idx == fFilteredModes.kMissingIndex ) - return -1; - - return idx; -} - -hsBool DeviceSelector::CheckDeviceType(uint32_t type) -{ - hsTArray& records = fSelector.GetDeviceRecords(); - - for (int32_t i = 0; i < records.Count(); i++) - { - if (type == records[i].GetG3DDeviceType()) - return true; - } - - return false; -} - -hsBool DeviceSelector::IsDirect3DAvailable() -{ - return CheckDeviceType(hsG3DDeviceSelector::kDevTypeDirect3D); -} - -hsBool DeviceSelector::IsDirect3DTnLAvailable() -{ - return CheckDeviceType(hsG3DDeviceSelector::kDevTypeDirect3DTnL); -} - -hsBool DeviceSelector::IsGlideAvailable() -{ - return CheckDeviceType(hsG3DDeviceSelector::kDevTypeGlide); -} - -hsBool DeviceSelector::IsOpenGLAvailable() -{ - return CheckDeviceType(hsG3DDeviceSelector::kDevTypeOpenGL); -} - -void DeviceSelector::SetDirect3D() -{ - SetDeviceType(hsG3DDeviceSelector::kDevTypeDirect3D); -} - -void DeviceSelector::SetDirect3DTnL() -{ - SetDeviceType(hsG3DDeviceSelector::kDevTypeDirect3DTnL); -} - -void DeviceSelector::SetGlide() -{ - SetDeviceType(hsG3DDeviceSelector::kDevTypeGlide); -} - -void DeviceSelector::SetOpenGL() -{ - SetDeviceType(hsG3DDeviceSelector::kDevTypeOpenGL); -} - -void DeviceSelector::SetDeviceType (uint32_t type) -{ - int32_t i; - for(i = 0; i < fRecords.GetCount(); i++) - fRecords[i].Clear(); - fRecords.Reset(); - - hsTArray& records = fSelector.GetDeviceRecords(); - for (i = 0; i < records.Count(); i++) - { - if (records[i].GetG3DDeviceType() == type) - fRecords.Push(records[i]); - } - - fSelDevType = type; - fSelDev = 0; - fDevDesc = 0; - fModeDesc = 0; - - IRefreshFilter(); -} - -hsBool DeviceSelector::IsDirect3D() -{ - if (fSelDevType == hsG3DDeviceSelector::kDevTypeDirect3D) - return true; - else - return false; -} - -hsBool DeviceSelector::IsDirect3DTnL() -{ - return ( fSelDevType == hsG3DDeviceSelector::kDevTypeDirect3DTnL ) ? true : false; -} - -hsBool DeviceSelector::IsGlide() -{ - if (fSelDevType == hsG3DDeviceSelector::kDevTypeGlide) - return true; - else - return false; -} - -hsBool DeviceSelector::IsOpenGL() -{ - if (fSelDevType == hsG3DDeviceSelector::kDevTypeOpenGL) - return true; - else - return false; -} - -hsBool DeviceSelector::SetDevice(uint32_t index) -{ - if (index < fRecords.Count()) - { - fSelDev = index; - fSelMode = 0; - fSelRec = fRecords[index]; - fSelRec.SetMaxAnisotropicSamples(0); - - IRefreshFilter(); - return true; - } - - return false; -} - -hsBool DeviceSelector::SetMode(uint32_t index) -{ - if (fSelDev >= fRecords.Count()) - return false; - - if (index < fFilteredModes.GetCount()) - { - fSelMode = index; - return true; - } - - return false; -} - -char* DeviceSelector::GetDeviceDescription() -{ - if (fDevDesc == fRecords.Count()) - { - fDevDesc = 0; - return nil; - } - - sprintf(fStr, "%s [%s]", fRecords[fDevDesc].GetDriverDesc(), fRecords[fDevDesc].GetDeviceDesc()); - fDevDesc++; - return fStr; -} - -char* DeviceSelector::GetModeDescription( void ) -{ - if (fSelDev >= fRecords.Count() ) - return nil; - - if (fModeDesc == fFilteredModes.GetCount()) - { - fModeDesc = 0; - return nil; - } - - hsG3DDeviceMode* mode = fRecords[fSelDev].GetMode( fFilteredModes[ fModeDesc ] ); - fModeDesc++; - - if( fFilterBPP != 0 ) - sprintf( fStr, "%ux%u", mode->GetWidth(), mode->GetHeight() ); - else - sprintf(fStr, "%ux%u %u bit", mode->GetWidth(), mode->GetHeight(), mode->GetColorDepth()); - - return fStr; -} - -uint32_t DeviceSelector::GetNumModes() -{ - return fFilteredModes.GetCount(); -} - -void DeviceSelector::GetMode(uint32_t i, int& width, int& height, int& depth) -{ - if (i >= fFilteredModes.GetCount()) - return; - - hsG3DDeviceMode* mode = fRecords[fSelDev].GetMode(fFilteredModes[i]); - - width = mode->GetWidth(); - height = mode->GetHeight(); - depth = mode->GetColorDepth(); -} - -hsBool DeviceSelector::SetDefault() -{ - hsG3DDeviceModeRecord dmr; - if (fSelector.GetDefault(&dmr)) - { - SetDeviceType(dmr.GetDevice()->GetG3DDeviceType()); - fSelDev = GetDeviceNum(dmr.GetDevice()); - fSelMode = IFindFiltered( GetModeNum(dmr.GetMode()) ); - fSelRec = fRecords[fSelDev]; - fSelRec.SetMaxAnisotropicSamples( 0 ); // Also off unless explicitly requested - - // Set a default detail level based on the available memory - if (hsMemorySpec() == kBlows) - fPerformance = 25; - else - fPerformance = 100; - - IRefreshFilter(); - - return true; - } - - return false; -} - -hsBool DeviceSelector::Save() -{ - hsUNIXStream stream; - if (!stream.Open(DEV_MODE_DAT, "wb")) - return false; - - hsG3DDeviceRecord selRec = fSelRec; - hsG3DDeviceMode selMode = *(selRec.GetMode( fFilteredModes[ fSelMode ] )); - selRec.ClearModes(); - - selRec.Write(&stream); - - if (fWindowed) - selMode.SetColorDepth(0); - selMode.Write(&stream); - - stream.WriteSwap16(fPerformance); - - stream.Close(); - - return true; -} - -hsBool DeviceSelector::Load() -{ - hsUNIXStream stream; - if (!stream.Open(DEV_MODE_DAT, "rb")) - return false; - - hsG3DDeviceRecord LoadRec; // Device copy for reading/writing - hsG3DDeviceMode LoadMode; // Modes copy for reading/writing - - LoadRec.Read(&stream); - if (LoadRec.IsInvalid()) - { - stream.Close(); - return false; - } - - LoadMode.Read(&stream); - - fPerformance = stream.ReadSwap16(); - - stream.Close(); - - // If selected device is available use it, otherwise return false - if ((LoadRec.GetG3DDeviceType() == hsG3DDeviceSelector::kDevTypeDirect3D) && IsDirect3DAvailable()) - SetDirect3D(); - else if ((LoadRec.GetG3DDeviceType() == hsG3DDeviceSelector::kDevTypeDirect3DTnL) && IsDirect3DTnLAvailable()) - SetDirect3DTnL(); - else if ((LoadRec.GetG3DDeviceType() == hsG3DDeviceSelector::kDevTypeGlide) && IsGlideAvailable()) - SetGlide(); - else - return false; - - //////////////////////////////////////////////////////////////////////////// - // Attempt to match the saved device and mode to the ones that are currently - // available. - //////////////////////////////////////////////////////////////////////////// - int num = GetDeviceNum(&LoadRec); - if (num == -1) - return false; - SetDevice(num); - - // Copy the flags - fSelRec.SetCap(hsG3DDeviceSelector::kCapsCompressTextures, - LoadRec.GetCap(hsG3DDeviceSelector::kCapsCompressTextures)); - fSelRec.SetAASetting( LoadRec.GetAASetting() ); - fSelRec.SetMaxAnisotropicSamples( LoadRec.GetMaxAnisotropicSamples() ); - - if (LoadMode.GetColorDepth() == 0) - { - fWindowed = true; - LoadMode.SetColorDepth(32); - } - num = GetModeNum(&LoadMode); - if (num == -1) - return false; - - SetMode(IFindFiltered(num)); - - return true; -} - -int DeviceSelector::GetDeviceNum(const hsG3DDeviceRecord *pLoadRec) -{ - hsTArray& records = fRecords; - - for (int i = 0; i < records.Count(); i++) - { - if (!strcmp(records[i].GetDriverDesc(), pLoadRec->GetDriverDesc()) && - !strcmp(records[i].GetDriverName(), pLoadRec->GetDriverName()) && - !strcmp(records[i].GetDriverVersion(), pLoadRec->GetDriverVersion()) && - !strcmp(records[i].GetDeviceDesc(), pLoadRec->GetDeviceDesc())) - return i; - } - - return -1; -} - -int DeviceSelector::IGetModeNumNoBPP( const hsG3DDeviceMode *pLoadMode ) -{ - hsTArray& modes = fRecords[fSelDev].GetModes(); - - for (int i = 0; i < modes.Count(); i++) - { - if ((modes[i].GetWidth() == pLoadMode->GetWidth()) && - (modes[i].GetHeight() == pLoadMode->GetHeight()) - ) - { - if( fFilteredModes.Find( i ) != fFilteredModes.kMissingIndex ) - { -#ifndef M3DRELEASE - if (pLoadMode->GetColorDepth() == 0) - fSelRec.GetMode( i )->SetColorDepth(0); -#endif - return i; - } - } - } - - return -1; -} - -int DeviceSelector::GetModeNum(const hsG3DDeviceMode *pLoadMode) -{ - hsTArray& modes = fRecords[fSelDev].GetModes(); - - for (int i = 0; i < modes.Count(); i++) - { - if ((modes[i].GetWidth() == pLoadMode->GetWidth()) && - (modes[i].GetHeight() == pLoadMode->GetHeight()) && - (modes[i].GetColorDepth() == pLoadMode->GetColorDepth())) - { - return i; - } - } - - return -1; -} - -uint8_t DeviceSelector::CanAntiAlias() -{ - hsG3DDeviceMode *mode = fRecords[ fSelDev ].GetMode( fFilteredModes[ fSelMode ] ); - - return mode->GetNumFSAATypes(); -} - -uint8_t DeviceSelector::IsAntiAliased() -{ - return fSelRec.GetAASetting(); -} - -void DeviceSelector::SetAntiAlias(uint8_t numSamples) -{ - fSelRec.SetAASetting( numSamples ); -} - -uint8_t DeviceSelector::CanAnisotropicFilter() -{ - uint8_t hi = fRecords[ fSelDev ].GetMaxAnisotropicSamples(); - if( hi > 1 ) - return hi; - - return 0; -} - -uint8_t DeviceSelector::GetAnisotropicLevel() -{ - return fSelRec.GetMaxAnisotropicSamples(); -} - -void DeviceSelector::SetAnisotropicLevel( uint8_t level ) -{ - fSelRec.SetMaxAnisotropicSamples( level ); -} - -bool DeviceSelector::CanWindow () -{ - return !fSelRec.GetCap(hsG3DDeviceSelector::kCapsNoWindow); -} - -bool DeviceSelector::IsWindowed() -{ - return fWindowed; -} - -void DeviceSelector::SetWindowed(bool state) -{ - fWindowed = state; -} - -hsBool DeviceSelector::CanCompress () -{ - return fRecords[fSelDev].GetCap(hsG3DDeviceSelector::kCapsCompressTextures); -} - -hsBool DeviceSelector::IsCompressed() -{ - return fSelRec.GetCap(hsG3DDeviceSelector::kCapsCompressTextures); -} - -void DeviceSelector::SetCompressed(hsBool state) -{ - fSelRec.SetCap(hsG3DDeviceSelector::kCapsCompressTextures, state); -} - -bool DeviceSelector::GetCap(uint32_t cap) -{ - return fSelRec.GetCap(cap) != 0; -} diff --git a/Sources/Plasma/PubUtilLib/plDeviceSelector/plDeviceSelector.h b/Sources/Plasma/PubUtilLib/plDeviceSelector/plDeviceSelector.h deleted file mode 100644 index d88242c3..00000000 --- a/Sources/Plasma/PubUtilLib/plDeviceSelector/plDeviceSelector.h +++ /dev/null @@ -1,160 +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 . - -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 DEVICESELECTOR_H -#define DEVICESELECTOR_H - -#include "HeadSpin.h" -//#include "plRender.h" -#include "../../PubUtilLib/plPipeline/hsG3DDeviceSelector.h" - -#define DEV_MODE_DAT "dev_mode.dat" - -// -// A wrapper class to simplify hsG3DDeviceSelector. -// Make sure to call Enumerate before doing anything else. -// -class DeviceSelector -{ -protected: - uint32_t fSelDevType; // Current type of driver. Set by the SetDirect3D/Glide/OpenGL functions - uint32_t fSelDev; // Index of selected device. Set by SetDevice() or - uint32_t fSelMode; // Index of selected mode for current device - - int fDevDesc; // Used by GetDeviceDescription() to store index of current device - int fModeDesc; // Used by GetModeDescription() to store index of current mode - - char fStr[1024]; // Used to return text - - uint16_t fPerformance; // Performance level (0-100) - - int fFilterBPP, fFilterWidth, fFilterHeight; - - bool fWindowed; - - hsG3DDeviceSelector fSelector; - hsTArray fRecords; // Copy of all records for the current device type - hsG3DDeviceRecord fSelRec; // Device copy for reading/writing - - hsTArray fFilteredModes; - - void IRefreshFilter( void ); - int IFindFiltered( int realIndex ); - int IGetModeNumNoBPP( const hsG3DDeviceMode *pLoadMode ); // Returns index of passed in mode - -public: - DeviceSelector(); - - hsBool Enumerate(HWND hWnd, hsBool expertMode); // Enumerates all devices - const char *GetErrorString( void ); - - // Determines if any devices of the specified type are available - hsBool IsDirect3DAvailable(); - hsBool IsGlideAvailable(); - hsBool IsOpenGLAvailable(); - hsBool IsDirect3DTnLAvailable(); - - // Set current device type - void SetDirect3D(); - void SetGlide(); - void SetOpenGL(); - void SetDirect3DTnL(); - - // Returns true if current device is of the specified type - hsBool IsDirect3D(); - hsBool IsDirect3DTnL(); - hsBool IsGlide(); - hsBool IsOpenGL(); - - // Gets and sets the current device or mode. - uint32_t GetSelectedDevice() { return fSelDev; } - uint32_t GetSelectedMode() { return fSelMode; } - hsBool SetDevice(uint32_t index); - hsBool SetMode(uint32_t index); - - // Returns the device or mode descriptions. Call repeatedly until nil is returned. - char* GetDeviceDescription(); - char* GetModeDescription( void ); - - uint32_t GetNumModes(); - void GetMode(uint32_t i, int& width, int& height, int& depth); - - void SetModeFilter( int bitDepth = 0, int minWidth = 0, int minHeight = 0 ); - - void SetPerformance (uint16_t value) { fPerformance = value; } - uint16_t GetPerformance () { return fPerformance; } - - // Returns max number of samples allowed for AA - uint8_t CanAntiAlias (); - // Returns current # of samples selected for AA, 0 if none - uint8_t IsAntiAliased (); - void SetAntiAlias (uint8_t numSamples); - - uint8_t CanAnisotropicFilter(); - uint8_t GetAnisotropicLevel(); - void SetAnisotropicLevel( uint8_t level ); - - bool CanWindow(); - bool IsWindowed(); - void SetWindowed(bool state); - - hsBool CanCompress (); - hsBool IsCompressed (); - void SetCompressed (hsBool state); - - // Caps from hsG3DDeviceSelector - bool GetCap(uint32_t cap); - - // Save and load - hsBool Save(); // Returns false if output file can't be opened - hsBool Load(); // Returns false if input file can't be opened - hsBool SetDefault(); // Returns false if no suitable renderers are found - -protected: - hsBool CheckDeviceType(uint32_t type); // Used by the Is*Available() functions - void SetDeviceType(uint32_t type); // Used by SetDirect3D/Glide/OpenGL - - // Helpers for LoadDeviceMode() - int GetDeviceNum(const hsG3DDeviceRecord *pLoadRec); // Returns index of passed in device - int GetModeNum(const hsG3DDeviceMode *pLoadMode); // Returns index of passed in mode -}; - -#endif //DEVICESELECTOR_H diff --git a/Sources/Plasma/PubUtilLib/plGClip/placeholder.txt b/Sources/Plasma/PubUtilLib/plGClip/placeholder.txt deleted file mode 100644 index 87c03db2..00000000 --- a/Sources/Plasma/PubUtilLib/plGClip/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -What do you see? An empty folder. \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsGRenderProcs.cpp b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsGRenderProcs.cpp deleted file mode 100644 index 85817b25..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsGRenderProcs.cpp +++ /dev/null @@ -1,250 +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 . - -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 "hsUtils.h" -#include "hsScalar.h" -#include "hsMemory.h" -#include "hsGRenderProcs.h" -#include "hsStream.h" -#include "../plResMgr/plKey.h" -#include "../plResMgr/hsResMgr.h" - -hsGRenderProcs::hsGRenderProcs() -: fNext(nil), - fBack(nil), - fPipeline(nil), - fFlags(kNone), - fLinkCount(0) -{ -} - -hsGRenderProcs::~hsGRenderProcs() -{ -} - -hsGRenderProcs** hsGRenderProcs::IOneBeforeMe(hsGRenderProcs** base) -{ - hsAssert(base, "Searching for place in baseless list"); - - if( !*base ||((*base)->GetPriority() > GetPriority()) ) - return base; - - hsGRenderProcs* trav = *base; - - while( trav->fNext && (trav->fNext->GetPriority() > GetPriority()) ) - trav = trav->fNext; - - hsAssert((trav != this)&&(trav->fNext != this), "Found self in bad place"); - return &trav->fNext; -} - -void hsGRenderProcs::IInsert(hsGRenderProcs** ptr) -{ - hsAssert(*ptr != this, "Re-Inserting self"); - hsAssert(ptr, "Inserting into nil list"); - if( *ptr ) - (*ptr)->fBack = &fNext; - fNext = *ptr; - fBack = ptr; - *ptr = this; -} - -void hsGRenderProcs::IDetach() -{ - if( fNext ) - fNext->fBack = fBack; - *fBack = fNext; - - fNext = nil; - fBack = nil; -} - -void hsGRenderProcs::Enqueue(hsGRenderProcs** base) -{ - // Already linked? Just note another link. - if( fLinkCount++ ) - return; - - IInsert(IOneBeforeMe(base)); - Ref(); -} - -void hsGRenderProcs::Dequeue() -{ - if( fBack && !--fLinkCount ) - { - IDetach(); - UnRef(); - } -} - - -void hsGRenderProcs::Read(hsStream* s, hsResMgr* mgr) -{ - SetFlags(s->ReadSwap32()); - ReadObjectRefs(s, mgr); - Read(s); -} - -void hsGRenderProcs::ReadObjectRefs(hsStream* s, hsResMgr* mgr) -{ - if( fFlags & kObjectRefs ) - { - int n = s->ReadSwap32(); - fObjectRefs.SetCount(n); - int i; - for( i = 0; i < n; i++ ) - { - fObjectRefs[i] = mgr->ReadKey(s); - } - } -} - -void hsGRenderProcs::WriteObjectRefs(hsStream* s, hsResMgr* mgr) -{ - if( fFlags & kObjectRefs ) - { - s->WriteSwap32(fObjectRefs.GetCount()); - int i; - for( i = 0; i < fObjectRefs.GetCount(); i++ ) - { -// if( fObjectRefs[i] ) - { - mgr->WriteKey(s,fObjectRefs[i]); // writes nil any...right? - } -// else -// { -// mgr->WriteKey(s, nil); -// } - } - } -} - -void hsGRenderProcs::Write(hsStream* s, hsResMgr* mgr) -{ - s->WriteSwap32(fFlags); - - WriteObjectRefs(s, mgr); - Write(s); -} - -plDrawable* hsGRenderProcs::GetObjectRef(int i) -{ - return (plDrawable*)((i < fObjectRefs.GetCount()) && fObjectRefs[i] ? fObjectRefs[i]->GetObjectPtr() : nil); -} - -void hsGRenderProcs::SetNumObjectRefs(int n) -{ - if( n > fObjectRefs.GetCount() ) - { - int oldCnt = fObjectRefs.GetCount(); - fObjectRefs.SetCount(n); - int i; - for( i = oldCnt; i < n; i++ ) - fObjectRefs[i] = nil; - } -} - -void hsGRenderProcs::SetObjectRef(plKey* key, int i) -{ - if( i >= fObjectRefs.GetCount() ) - SetNumObjectRefs(i+1); - fObjectRefs[i] = key; - fFlags |= kObjectRefs; -} - -hsBool32 hsGRenderProcs::BeginTree(plPipeline* pipe, plDrawable* root) -{ - hsAssert(fFlags & kObjectRefsInit, "Should have had refs initialized on read"); - - fPipeline = pipe; - - if( Inclusive() ) - { - fColorizer.Init(pipe); - hsColorRGBA col = fColorizer.GetCurrentColor(); - if( !fColorizer.Colorizing() ) - { - col.r = col.g = col.b = 1.f; - } - if( !fColorizer.Alpharizing() ) - col.a = 0.999f; - fColorizer.PushColorize(col, !fColorizer.Colorizing() /* alpha only */); - } - return true; -} - -hsBool32 hsGRenderProcs::BeginObject(plPipeline* pipe, plDrawable* obj) -{ - hsAssert(fFlags & kObjectRefsInit, "Should have had refs initialized on read"); - - fPipeline = pipe; - - if( !Inclusive() ) - { - fColorizer.Init(pipe); - hsColorRGBA col = fColorizer.GetCurrentColor(); - if( !fColorizer.Colorizing() ) - { - col.r = col.g = col.b = 1.f; - } - if( !fColorizer.Alpharizing() ) - col.a = 0.999f; - fColorizer.PushColorize(col, !fColorizer.Colorizing() /* alpha only */); - } - return true; -} - -void hsGRenderProcs::EndObject() -{ - if( !Inclusive() ) - fColorizer.PopColorize(); -} - -void hsGRenderProcs::EndTree() -{ - if( Inclusive() ) - fColorizer.PopColorize(); - fPipeline = nil; -} - diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsGRenderProcs.h b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsGRenderProcs.h deleted file mode 100644 index e106997b..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsGRenderProcs.h +++ /dev/null @@ -1,218 +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 . - -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 hsGRenderProcs_inc -#define hsGRenderProcs_inc - -#include "hsRefCnt.h" -#include "hsScalar.h" -#include "hsMemory.h" -#include "hsBiExpander.h" -#include "../plPipeline/hsGColorizer.h" -#include "../plResMgr/plCreatable.h" - -class plPipeline; -class plDrawable; -class hsTriangle3; -struct hsGTriVertex; -struct hsGVertex3; -struct hsGShadeVertex; -struct hsGSplat3; -class hsStream; -class plKey; -class hsBounds3Ext; -class hsResMgr; - -class hsGRenderProcs : public plCreatable { -public: - enum { - kMaxLabelLen = 128 - }; - enum ProcType { - kTypeAngleFade, - kTypeDistFade, - kTypeMotionBlur1, - kTypeMotionBlur2, - kTypeIntenseAlpha, - kTypeGlobalShade, - kTypeObjDistFade, - kTypeDistShade, - kTypeObjDistShade - }; - enum { - kNone = 0x0, - kInclusive = 0x1, // Affect children - kNOP = 0x2, // Turned off (till EndObject) - kOpaque = 0x4, - kCulled = 0x8, - kObjectRefs = 0x10, - kObjectRefsInit = 0x20 - }; -private: - // Base class private stuff for managing the Queue of Procs on the device. - - uint32_t fLinkCount; - hsGRenderProcs* fNext; - hsGRenderProcs** fBack; - - hsGRenderProcs** IOneBeforeMe(hsGRenderProcs** base); - void IInsert(hsGRenderProcs** beforeMe); - void IDetach(); - -protected: - - uint32_t fFlags; - - hsGColorizer fColorizer; - - plPipeline* fPipeline; - - hsDynamicArray fObjectRefs; -public: - hsGRenderProcs(); - virtual ~hsGRenderProcs(); - - // BeginTree returns false if entire subtree is don't bother to draw, - // else true. Mostly a culling tool. - virtual hsBool32 BeginTree(plPipeline* pipe, plDrawable* root); - - // BeginObject returns true if the object should be drawn, false if - // don't bother. Can also do any initialization it wants. Should this - // get something more innocuous like a bound instead of the SceneObject? - // Is there anything else it might need to know? - virtual hsBool32 BeginObject(plPipeline* pipe, plDrawable* obj); - - // ProcessVerts takes the list of TriVerts and does what it will. - // I'll outline the hsGTriVertex below. The difference between - // the BaseVertex list and the UsedVertex list is interpolation. - // Shade values and generated Texture Coords are computed for - // the Base Triangle only, and then interpolated for vertices - // generated by clipping. So Shade Values and Texture Coordinates - // should only be computed in ProcessBaseVerts(). On the other - // hand, only the vertices from actual drawn triangles are - // transformed, and hence have a screen position to mess with. - // So any wiggling of the screen position should happen in - // ProcessUsedVerts(). These functions might be better named - // ProcessShadeVerts() and ProcessXformVerts(), except that - // vertex illumination (shade) is interpolated, but then - // the interpolated shade is fed into the material to calculate - // color. So messing with final color would happen in ProcessUsedVerts(), - // whereas messing with illumination's in ProcessBaseVerts(). Messing - // with UV's is equally valid in either. In general though, the number - // of BaseVerts is less than or equal to the number of UsedVerts. Most - // shaders would have one or the other a no-op. - - // Process list of unique vertices (with unique hsGXformVerts) which will be drawn to screen - virtual void ProcessScreenVerts(hsExpander& vList) {} - - // Take a list of verts and modulate shades for them. Care should be taken to only bother with verts that - // are not (hsGVertex3::kCulled|hsGVertex3::kDisabled). Also, any verts that this RenderProc causes - // to go completely transparent should be flagged hsGVertex3::kCulled (NOT DISABLED). - // See hsSfxDistFade for example (not exemplary) code. - - // Process list of unique vertices (unique hsGShadeVerts) before interpolation - virtual void ProcessPreInterpShadeVerts(hsExpander& vList) {} - // Process list of unique vertices (unique hsGShadeVerts) after interpolation - these will be drawn to screen - virtual void ProcessPostInterpShadeVerts(hsExpander& vList) {} - - // Process list of unique Pre or Post Interpolation TriVerts (with hsGShade and hsGXformVerts) - // While the TriVerts are unique, there may be sharing among constituents, i.e. position and uv. - // Care must be taken when accumulating effects. - virtual void ProcessPreInterpVerts(hsExpander& vList) {} - virtual void ProcessPostInterpVerts(hsExpander& vList) {} - - // Process list of triangles which are headed for the screen. vList is the full list of unique TriVerts - // used by these triangles. If triangles are added, any generated verts MUST be added to vList. If - // Triangles are removed, verts may be removed from vList (keeping in mind that vList verts may be - // shared between triangles). - virtual void ProcessPreClipTris(hsExpander& tList, hsExpander& vList) {} - virtual void ProcessPreInterpTris(hsExpander& tList, hsExpander& vList) {} - virtual void ProcessPostInterpTris(hsExpander& tList, hsExpander& vList) {} - - // Any cleanup for this object - virtual void EndObject(); - - // Any cleanup for this subtree - virtual void EndTree(); - - // Shaders can set their priority to affect order in which they are called - // When pushed onto device, device uses this priority to sort into queue - virtual hsScalar GetPriority() { return 0; } - - // When a shader is pushed onto the device (by an object), the object - // will pop it back off either before or after drawing its children, - // depending on Inclusive(). Not meaningful for mate - virtual hsBool32 Inclusive() { return fFlags & kInclusive; } - - virtual void Enqueue(hsGRenderProcs** list); - virtual void Dequeue(); - hsGRenderProcs* GetNext() { return fNext; } - - // External object references. Individual RenderProc type responsible for what they're used for. - void SetNumObjectRefs(int n); - uint32_t GetNumObjectRefs() { return fObjectRefs.GetCount(); } - void AddObjectRef(plKey* key) { fObjectRefs.Append(key); fFlags |= kObjectRefs; } - void SetObjectRef(plKey* key, int i=0); - void InsertObjectRef(int i, plKey* key) { fObjectRefs.InsertAtIndex(i, key); fFlags |= kObjectRefs; } - plDrawable* GetObjectRef(int i); - plKey* GetObjectRefKey(int i) { return fObjectRefs[i]; } - void ReadObjectRefs(hsStream* s, hsResMgr* mgr); - void WriteObjectRefs(hsStream* s, hsResMgr* mgr); - - - virtual void Read(hsStream* s, hsResMgr* mgr); - virtual void Write(hsStream* s, hsResMgr* mgr); - - virtual void Read(hsStream* s) = 0; - virtual void Write(hsStream* s) = 0; - - virtual const char* GetLabel() const = 0; - virtual ProcType GetType() const = 0; - - uint32_t GetFlags() { return fFlags; } - void SetFlags(uint32_t f) { fFlags = f; } - - CLASSNAME_REGISTER( hsGRenderProcs ); - GETINTERFACE_ANY( hsGRenderProcs, plCreatable ); -}; - -#endif // hsGRenderProcs_inc diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxAngleFade.cpp b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxAngleFade.cpp deleted file mode 100644 index bdcf98f6..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxAngleFade.cpp +++ /dev/null @@ -1,234 +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 . - -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 "hsMemory.h" -#include "hsSfxAngleFade.h" -#include "hsStream.h" -#include "../plPipeline/plPipeline.h" -//#include "../plPipeline/hsG3DDevice.h" -#include "../plGeometry/hsTriangle3.h" -#include "../plMath/hsFastMath.h" - -hsSfxAngleFade::hsSfxAngleFade() -{ -} - -hsSfxAngleFade::~hsSfxAngleFade() -{ -} - -hsScalar hsSfxAngleFade::IOpacFromDot(hsScalar dot) -{ - if( (fFlags & kTwoSided) - &&(dot < 0) ) - dot = -dot; - - if( dot <= fTable[0].fCosineDel ) - return fTable[0].fOpacity; - - int i; - for( i = 0; (i < fTable.GetCount()) && (dot >= fTable[i].fCosineDel); i++ ) - dot -= fTable[i].fCosineDel; - - if( i >= fTable.GetCount() ) - return fTable[fTable.GetCount()-1].fOpacity; - - dot *= fTable[i-1].fCosineNorm; - hsScalar opac0 = fTable[i-1].fOpacity; - hsScalar opac1 = fTable[i].fOpacity; - - return opac0 + dot * (opac1 - opac0); -} - -void hsSfxAngleFade::ProcessPreInterpTris(hsExpander& tList, hsExpander& vList) -{ - if( !(fFlags & kFaceNormals) ) - return; - -#if 0 // Taken out 2.26.2001 mcn 'cause it accesses the (now defunct) 3DDevice directly - - hsPoint3 vPos = fPipeline->GetViewPositionLocal(); - hsG3DDevice* dev = fPipeline->Get3DDevice(); - - fSetVector.Clear(); - - for( tList.First(); tList.More(); tList.Plus() ) - { - hsTriangle3* tri = tList.Current(); - hsVector3& norm = tri->fNormal; - - - hsScalar dot, opac; - hsGVertex3* vtx; - hsGShadeVertex* shade; - hsVector3 vDir; - - vtx = tri->GetVertex(0); - if( !fSetVector.IsBitSet(vtx->fShadeIdx) ) - { - vDir.Set(&vPos, &vtx->fLocalPos); - dot = hsFastMath::InvSqrtAppr(vDir.MagnitudeSquared()); - dot *= norm.InnerProduct(vDir); - - shade = dev->GetShadeEntry(vtx); - opac = IOpacFromDot(dot); - shade->fColor.a *= opac; - - fSetVector.SetBit(vtx->fShadeIdx); - } - - vtx = tri->GetVertex(1); - if( !fSetVector.IsBitSet(vtx->fShadeIdx) ) - { - vDir.Set(&vPos, &vtx->fLocalPos); - dot = hsFastMath::InvSqrtAppr(vDir.MagnitudeSquared()); - dot *= norm.InnerProduct(vDir); - - shade = dev->GetShadeEntry(vtx); - opac = IOpacFromDot(dot); - shade->fColor.a *= opac; - - fSetVector.SetBit(vtx->fShadeIdx); - } - - vtx = tri->GetVertex(2); - if( !fSetVector.IsBitSet(vtx->fShadeIdx) ) - { - vDir.Set(&vPos, &vtx->fLocalPos); - dot = hsFastMath::InvSqrtAppr(vDir.MagnitudeSquared()); - dot *= norm.InnerProduct(vDir); - - shade = dev->GetShadeEntry(vtx); - opac = IOpacFromDot(dot); - shade->fColor.a *= opac; - - fSetVector.SetBit(vtx->fShadeIdx); - } - - } -#endif -} - -void hsSfxAngleFade::ProcessPreInterpShadeVerts(hsExpander& vList) -{ - if( fFlags & kFaceNormals ) - return; - - hsVector3 vDir =fPipeline->GetViewDirLocal(); - hsPoint3 vPos = fPipeline->GetViewPositionLocal(); - - for( vList.First(); vList.More(); vList.Plus() ) - { - hsGShadeVertex* shade = vList.Current(); - - hsScalar dot; - if( !(fFlags & kDirectional) ) - { - vDir.Set(&vPos, &shade->fLocalPos); - dot = hsFastMath::InvSqrtAppr(vDir.MagnitudeSquared()); - dot *= shade->fNormal.InnerProduct(vDir); - } - else - { - dot = shade->fNormal.InnerProduct(vDir); - } - - hsScalar opac = IOpacFromDot(dot); - - shade->fShade.a *= opac; - } -} - -void hsSfxAngleFade::MakeTable(float* cosList, float* opacList, int num) -{ - fTable.Reset(); - if( !num ) - return; - - int i; - for( i = 0; i < num; i++ ) - { - hsSfxAfTableEntry* t = fTable.Append(); - t->fCosineDel = cosList[i]; - t->fOpacity = opacList[i]; - } - for( i = num-1; i > 0; i-- ) - fTable[i].fCosineDel -= fTable[i-1].fCosineDel; - for( i = 0; i < num-1; i++ ) - fTable[i].fCosineNorm = hsScalarInvert(fTable[i+1].fCosineDel); - fTable[num-1].fCosineNorm = 0; - hsAssert(fTable.GetCount() == num, "Mismatch making table"); -} - -void hsSfxAngleFade::Read(hsStream* s) -{ - fTable.Reset(); - - int32_t cnt = s->ReadSwap32(); - - if( cnt ) - { - hsSfxAfTableEntry* arr = new hsSfxAfTableEntry[cnt]; - int i; - for( i = 0; i < cnt; i++ ) - { - arr[i].fCosineDel = s->ReadSwapScalar(); - arr[i].fCosineNorm = s->ReadSwapScalar(); - arr[i].fOpacity = s->ReadSwapScalar(); - } - - fTable.SetArray(arr, cnt); - } -} - -void hsSfxAngleFade::Write(hsStream* s) -{ - s->WriteSwap32(fTable.GetCount()); - - for( fTable.First(); fTable.More(); fTable.Plus() ) - { - s->WriteSwapScalar(fTable.Current().fCosineDel); - s->WriteSwapScalar(fTable.Current().fCosineNorm); - s->WriteSwapScalar(fTable.Current().fOpacity); - } -} diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxAngleFade.h b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxAngleFade.h deleted file mode 100644 index 9f199898..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxAngleFade.h +++ /dev/null @@ -1,90 +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 . - -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 hsSfxAngleFade_inc -#define hsSfxAngleFade_inc - -#include "hsBiExpander.h" -#include "hsGRenderProcs.h" -#include "hsBitVector.h" - -class hsSfxAngleFade : public hsGRenderProcs { -public: - enum { - kDirectional = 0x10000, - kTargetRelative = 0x20000, - kTwoSided = 0x40000, - kFaceNormals = 0x80000 - }; - struct hsSfxAfTableEntry { - hsScalar fCosineDel; - hsScalar fCosineNorm; - hsScalar fOpacity; - }; -protected: - - hsBitVector fSetVector; - hsExpander fTable; - - hsScalar IOpacFromDot(hsScalar dot); -public: - hsSfxAngleFade(); - virtual ~hsSfxAngleFade(); - - virtual void ProcessPreInterpShadeVerts(hsExpander& vList); - virtual void ProcessPreInterpTris(hsExpander& tList, hsExpander& vList); - - void MakeTable(float* cosList, float* opacList, int num); // lists sorted from lowest cosine to highest - - virtual void Read(hsStream* s); - virtual void Write(hsStream* s); - - virtual const char* GetLabel() const { return "hsSfxAngleFade"; } - - virtual ProcType GetType() const { return kTypeAngleFade; } - - CLASSNAME_REGISTER( hsSfxAngleFade ); - GETINTERFACE_ANY( hsSfxAngleFade, hsGRenderProcs ); - -}; - -#endif // hsSfxAngleFade_inc diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistFade.cpp b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistFade.cpp deleted file mode 100644 index 7b40e092..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistFade.cpp +++ /dev/null @@ -1,331 +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 . - -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 "hsMemory.h" -#include "hsSfxDistFade.h" -#include "hsStream.h" -#include "../plPipeline/plPipeline.h" -#include "../plGeometry/hsTriangle3.h" -#include "../plDrawable/plDrawable.h" - -#include "../plIntersect/hsBounds.h" - - -static hsScalar globalScale = 1.f; - -hsSfxDistFade::hsSfxDistFade() -: fMinDist(0), fMaxDist(0) -{ -} - -hsSfxDistFade::~hsSfxDistFade() -{ -} - -hsScalar hsSfxDistFade::IOpacFromDist(hsScalar dist) -{ - if( dist <= fTable[0].fDistDel ) - return fTable[0].fOpacity; - - int i; - for( i = 0; (i < fTable.GetCount()) && (dist >= fTable[i].fDistDel); i++ ) - dist -= fTable[i].fDistDel; - - if( i >= fTable.GetCount() ) - return fTable[fTable.GetCount()-1].fOpacity; - - dist *= fTable[i-1].fDistNorm; - hsScalar opac0 = fTable[i-1].fOpacity; - hsScalar opac1 = fTable[i].fOpacity; - - return opac0 + dist * (opac1 - opac0); -} - -hsBool32 hsSfxDistFade::BeginObject(plPipeline* pipe, plDrawable* obj) -{ - hsGRenderProcs::BeginObject(pipe, obj); - - fFlags &= ~(kCulled | kNOP); - - hsPoint3 vPos; - if( GetObjectRef(1) ) - { - hsPoint3 wPos; - GetObjectRef(1)->GetLocalToWorld().GetTranslate(&wPos); - hsMatrix44 w2l = fPipeline->GetWorldToLocal(); - vPos = w2l * wPos; - } - else - { - vPos = fPipeline->GetViewPositionLocal(); - } - - hsScalar scale = 1.f / fPipeline->GetLocalScale(); - scale *= globalScale; - - const hsBounds3Ext& bnd = obj->GetLocalBounds(); - - hsPoint3 inner, outer; - bnd.ClosestPoint(vPos, inner, outer); - - hsScalar minDist, maxDist; - - minDist = hsVector3(&vPos, &inner).Magnitude(); - maxDist = hsVector3(&vPos, &outer).Magnitude(); - - minDist *= scale; - maxDist *= scale; - - if( (fFlags & kCullsBefore) - &&(maxDist <= fMinDist) ) - { - fFlags |= kCulled; - return false; - } - - if( (fFlags & kCullsBeyond) - &&(minDist > fMaxDist) ) - { - fFlags |= kCulled; - return false; - } - - if( (fFlags & kIdleBefore) - &&(maxDist < fMinIdle) ) - fFlags |= kNOP; - - if( (fFlags & kIdleBeyond) - &&(minDist > fMaxIdle) ) - fFlags |= kNOP; - - return true; -} - -void hsSfxDistFade::ProcessPreInterpShadeVerts(hsExpander& vList) -{ - if( fFlags & (kPostInterp | kNOP) ) - return; - - hsPoint3 vPos; - if( GetObjectRef(1) ) - { - hsPoint3 wPos; - GetObjectRef(1)->GetLocalToWorld().GetTranslate(&wPos); - hsMatrix44 w2l = fPipeline->GetWorldToLocal(); - vPos = w2l * wPos; - } - else - { - vPos = fPipeline->GetViewPositionLocal(); - } - hsScalar scale = 1.f / fPipeline->GetLocalScale(); - - scale *= globalScale; - - for( vList.First(); vList.More(); vList.Plus() ) - { - hsGShadeVertex* shade = vList.Current(); - - hsScalar dist = hsVector3(&shade->fLocalPos, &vPos).Magnitude(); - dist *= scale; - - hsScalar opac = IOpacFromDist(dist); - - if( opac > 0 ) - shade->fShade.a *= opac; - else - { - shade->fShade.a = 0; - shade->fBaseVertex->fFlags |= hsGVertex3::kCulled; - } - } -} - -void hsSfxDistFade::ProcessPostInterpShadeVerts(hsExpander& vList) -{ - if( !(fFlags & kPostInterp) ) - return; - - if( fFlags & kNOP ) - return; - - hsPoint3 vPos; - if( GetObjectRef(1) ) - { - hsPoint3 wPos; - GetObjectRef(1)->GetLocalToWorld().GetTranslate(&wPos); - hsMatrix44 w2l = fPipeline->GetWorldToLocal(); - vPos = w2l * wPos; - } - else - { - vPos = fPipeline->GetViewPositionLocal(); - } - hsScalar scale = 1.f / fPipeline->GetLocalScale(); - - for( vList.First(); vList.More(); vList.Plus() ) - { - hsGShadeVertex* shade = vList.Current(); - - hsScalar dist = hsVector3(&shade->fLocalPos, &vPos).Magnitude(); - dist *= scale; - - hsScalar opac = IOpacFromDist(dist); - - if( opac > 0 ) - shade->fColor.a *= opac; - else - { - shade->fColor.a = 0; - shade->fBaseVertex->fFlags |= hsGVertex3::kCulled; - } - } -} - -void hsSfxDistFade::MakeTable(float* distList, float* opacList, int num) -{ - fTable.Reset(); - if( !num ) - return; - - int i; - for( i = 0; i < num; i++ ) - { - hsSfxDfTableEntry* t = fTable.Append(); - t->fDistDel = distList[i]; - t->fOpacity = opacList[i]; - } - for( i = num-1; i > 0; i-- ) - fTable[i].fDistDel -= fTable[i-1].fDistDel; - for( i = 0; i < num-1; i++ ) - fTable[i].fDistNorm = hsScalarInvert(fTable[i+1].fDistDel); - fTable[num-1].fDistNorm = 0; - hsAssert(fTable.GetCount() == num, "Mismatch making table"); - - if( fTable[0].fOpacity <= 0 ) - fFlags |= kCullsBefore; - if( fTable[num-1].fOpacity <= 0 ) - fFlags |= kCullsBeyond; - if( fTable[0].fOpacity >= 1.f ) - fFlags |= kIdleBefore; - if( fTable[num-1].fOpacity >= 1.f ) - fFlags |= kIdleBeyond; - - int iMin; - for( iMin = 0; (iMin < fTable.GetCount())&&(fTable[iMin].fOpacity <= 0); iMin++ ); - fMinDist = fTable[0].fDistDel; - for( i = 1; i < iMin; i++ ) - fMinDist += fTable[i].fDistDel; - - for( iMin = 0; (iMin < fTable.GetCount())&&(fTable[iMin].fOpacity >= 1.f); iMin++ ); - fMinIdle = fTable[0].fDistDel; - for( i = 1; i < iMin; i++ ) - fMinIdle += fTable[i].fDistDel; - - int iMax; - for( iMax = fTable.GetCount()-1; (iMax >= 0)&&(fTable[iMax].fOpacity <= 0); iMax-- ); - if( ++iMax >= fTable.GetCount() ) - iMax = fTable.GetCount()-1; - fMaxDist = fTable[0].fDistDel; - for( i = 1; i <= iMax; i++ ) - fMaxDist += fTable[i].fDistDel; - - for( iMax = fTable.GetCount()-1; (iMax >= 0)&&(fTable[iMax].fOpacity >= 1.f); iMax-- ); - if( ++iMax >= fTable.GetCount() ) - iMax = fTable.GetCount()-1; - fMaxIdle = fTable[0].fDistDel; - for( i = 1; i <= iMax; i++ ) - fMaxIdle += fTable[i].fDistDel; -} - -void hsSfxDistFade::Read(hsStream* s) -{ - fTable.Reset(); - - fMinDist = s->ReadSwapScalar(); - fMaxDist = s->ReadSwapScalar(); - - if( fFlags & (kIdleBefore | kIdleBeyond) ) - { - fMinIdle = s->ReadSwapScalar(); - fMaxIdle = s->ReadSwapScalar(); - } - - int32_t cnt = s->ReadSwap32(); - - if( cnt ) - { - hsSfxDfTableEntry* arr = new hsSfxDfTableEntry[cnt]; - int i; - for( i = 0; i < cnt; i++ ) - { - arr[i].fDistDel = s->ReadSwapScalar(); - arr[i].fDistNorm = s->ReadSwapScalar(); - arr[i].fOpacity = s->ReadSwapScalar(); - } - - fTable.SetArray(arr, cnt); - } -} - -void hsSfxDistFade::Write(hsStream* s) -{ - s->WriteSwapScalar(fMinDist); - s->WriteSwapScalar(fMaxDist); - - if( fFlags & (kIdleBefore | kIdleBeyond) ) - { - s->WriteSwapScalar(fMinIdle); - s->WriteSwapScalar(fMaxIdle); - } - - s->WriteSwap32(fTable.GetCount()); - - for( fTable.First(); fTable.More(); fTable.Plus() ) - { - s->WriteSwapScalar(fTable.Current().fDistDel); - s->WriteSwapScalar(fTable.Current().fDistNorm); - s->WriteSwapScalar(fTable.Current().fOpacity); - } -} - diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistFade.h b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistFade.h deleted file mode 100644 index 7a52248d..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistFade.h +++ /dev/null @@ -1,107 +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 . - -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 hsSfxDistFade_inc -#define hsSfxDistFade_inc - -#include "hsBiExpander.h" -#include "hsGRenderProcs.h" - -class hsSfxDistFade : public hsGRenderProcs { -public: - enum { - kCullsBefore = 0x10000, - kCullsBeyond = 0x20000, - - kDistFromView = 0x40000, - kDistFromTarget = 0x80000, - kDistAlongX = 0x100000, - kDistAlongY = 0x200000, - kDistAlongZ = 0x400000, - kWorldDist = 0x800000, - - kPostInterp = 0x1000000, - - kIdleBefore = 0x2000000, - kIdleBeyond = 0x4000000 - }; - - struct hsSfxDfTableEntry { - hsScalar fDistDel; - hsScalar fDistNorm; - hsScalar fOpacity; - }; -protected: - - hsScalar fMinDist; - hsScalar fMaxDist; - - hsScalar fMinIdle; - hsScalar fMaxIdle; - - hsExpander fTable; - - hsScalar IOpacFromDist(hsScalar dist); -public: - hsSfxDistFade(); - virtual ~hsSfxDistFade(); - - virtual hsBool32 BeginObject(plPipeline* pipe, plDrawable* obj); - - virtual void ProcessPreInterpShadeVerts(hsExpander& vList); - virtual void ProcessPostInterpShadeVerts(hsExpander& vList); - - void MakeTable(float* distList, float* opacList, int num); // lists sorted from lowest cosine to highest - - virtual void Read(hsStream* s); - virtual void Write(hsStream* s); - - virtual const char* GetLabel() const { return "hsSfxDistFade"; } - - virtual ProcType GetType() const { return kTypeDistFade; } - - CLASSNAME_REGISTER( hsSfxDistFade ); - GETINTERFACE_ANY( hsSfxDistFade, hsGRenderProcs ); - -}; - -#endif // hsSfxDistFade_inc diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistShade.cpp b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistShade.cpp deleted file mode 100644 index 3e70ec80..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistShade.cpp +++ /dev/null @@ -1,292 +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 . - -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 "hsMemory.h" -#include "hsSfxDistShade.h" -#include "hsStream.h" -#include "../plGeometry/hsTriangle3.h" - -#include "../plIntersect/hsBounds.h" -#include "../plDrawable/plDrawable.h" -#include "../plPipeline/plPipeline.h" - -static hsScalar globalScale = 1.f; - -hsSfxDistShade::hsSfxDistShade() -: fMinDist(0), fMaxDist(0) -{ -} - -hsSfxDistShade::~hsSfxDistShade() -{ -} - -hsScalar hsSfxDistShade::IShadeFromDist(hsScalar dist) -{ - if( dist <= fTable[0].fDistDel ) - return fTable[0].fShade; - - int i; - for( i = 0; (i < fTable.GetCount()) && (dist >= fTable[i].fDistDel); i++ ) - dist -= fTable[i].fDistDel; - - if( i >= fTable.GetCount() ) - return fTable[fTable.GetCount()-1].fShade; - - dist *= fTable[i-1].fDistNorm; - hsScalar shade0 = fTable[i-1].fShade; - hsScalar shade1 = fTable[i].fShade; - - return shade0 + dist * (shade1 - shade0); -} - - - -hsBool32 hsSfxDistShade::BeginObject(plPipeline* pipe, plDrawable* obj) -{ - hsGRenderProcs::BeginObject(pipe, obj); - - fFlags &= ~(kCulled | kNOP); - - hsPoint3 vPos; - if( GetObjectRef(1) ) - { - hsPoint3 wPos; - GetObjectRef(1)->GetLocalToWorld().GetTranslate(&wPos); - hsMatrix44 w2l = pipe->GetWorldToLocal(); - vPos = w2l * wPos; - } - else - { - vPos = pipe->GetViewPositionLocal(); - } - hsVector3 vDir = -pipe->GetViewDirLocal(); - - hsScalar scale = 1.f / fPipeline->GetLocalScale(); - scale *= globalScale; - - hsScalar vD = -(vDir.InnerProduct(vPos)); - vD *= scale; - - const hsBounds3Ext& bnd = obj->GetLocalBounds(); - - hsPoint3 corner; - bnd.GetCorner(&corner); - hsVector3 axis[3]; - bnd.GetAxes(axis+0, axis+1, axis+2); - - hsScalar dist = vDir.InnerProduct(corner) + vD; - hsScalar minDist = dist; - hsScalar maxDist = dist; - - int i; - for( i = 0; i < 3; i++ ) - { - dist = vDir.InnerProduct(axis[i]); - if( dist < 0 ) - minDist += dist; - else - maxDist += dist; - } - - minDist *= scale; - maxDist *= scale; - - fFlags &= ~kShadeConstant; - if( maxDist < fMinDist ) - { - fFlags |= kShadeConstant; - fConstShade = fTable[0].fShade; - } - else if( minDist > fMaxDist ) - { - fFlags |= kShadeConstant; - fConstShade = fTable[fTable.GetCount()-1].fShade; - } - return true; -} - -void hsSfxDistShade::ProcessPreInterpShadeVerts(hsExpander& vList) -{ - if( fFlags & kShadeConstant ) - { - IConstShadeVerts(vList); - } - else - { - ICalcShadeVerts(vList); - } -} - -void hsSfxDistShade::IConstShadeVerts(hsExpander& vList) -{ - for( vList.First(); vList.More(); vList.Plus() ) - { - hsGShadeVertex* svtx = vList.Current(); - svtx->fShade.r *= fConstShade; - svtx->fShade.g *= fConstShade; - svtx->fShade.b *= fConstShade; - } -} - -void hsSfxDistShade::ICalcShadeVerts(hsExpander& vList) -{ - hsPoint3 vPos; - if( GetObjectRef(1) ) - { - hsPoint3 wPos; - GetObjectRef(1)->GetLocalToWorld().GetTranslate(&wPos); - hsMatrix44 w2l = fPipeline->GetWorldToLocal(); - vPos = w2l * wPos; - } - else - { - vPos = fPipeline->GetViewPositionLocal(); - } - hsVector3 vDir = fPipeline->GetViewDirLocal(); - - hsScalar vDist = vDir.InnerProduct(vPos); - - hsScalar scale = 1.f / fPipeline->GetLocalScale(); - scale *= globalScale; - - for( vList.First(); vList.More(); vList.Plus() ) - { - hsGShadeVertex* svtx = vList.Current(); - - hsScalar dist = -vDir.InnerProduct(svtx->fLocalPos); - dist += vDist; - dist *= scale; - - hsScalar shade = IShadeFromDist(dist); - - if( shade > 0 ) - { - svtx->fShade.r *= shade; - svtx->fShade.g *= shade; - svtx->fShade.b *= shade; - } - else - { - svtx->fShade.r = 0; - svtx->fShade.g = 0; - svtx->fShade.b = 0; - } - } -} - -void hsSfxDistShade::MakeTable(float* distList, float* shadeList, int num) -{ - fTable.Reset(); - if( !num ) - return; - - int i; - for( i = 0; i < num; i++ ) - { - hsSfxDfTableEntry* t = fTable.Append(); - t->fDistDel = distList[i]; - t->fShade = shadeList[i]; - } - for( i = num-1; i > 0; i-- ) - fTable[i].fDistDel -= fTable[i-1].fDistDel; - for( i = 0; i < num-1; i++ ) - fTable[i].fDistNorm = hsScalarInvert(fTable[i+1].fDistDel); - fTable[num-1].fDistNorm = 0; - hsAssert(fTable.GetCount() == num, "Mismatch making table"); - - int iMin; - for( iMin = 0; (iMin < fTable.GetCount())&&(fTable[iMin].fShade <= 0); iMin++ ); - fMinDist = fTable[0].fDistDel; - for( i = 1; i < iMin; i++ ) - fMinDist += fTable[i].fDistDel; - - int iMax; - for( iMax = fTable.GetCount()-1; (iMax >= 0)&&(fTable[iMax].fShade <= 0); iMax-- ); - if( ++iMax >= fTable.GetCount() ) - iMax = fTable.GetCount()-1; - fMaxDist = fTable[0].fDistDel; - for( i = 1; i <= iMax; i++ ) - fMaxDist += fTable[i].fDistDel; - -} - -void hsSfxDistShade::Read(hsStream* s) -{ - fTable.Reset(); - - fMinDist = s->ReadSwapScalar(); - fMaxDist = s->ReadSwapScalar(); - - int32_t cnt = s->ReadSwap32(); - - if( cnt ) - { - hsSfxDfTableEntry* arr = new hsSfxDfTableEntry[cnt]; - int i; - for( i = 0; i < cnt; i++ ) - { - arr[i].fDistDel = s->ReadSwapScalar(); - arr[i].fDistNorm = s->ReadSwapScalar(); - arr[i].fShade = s->ReadSwapScalar(); - } - - fTable.SetArray(arr, cnt); - } -} - -void hsSfxDistShade::Write(hsStream* s) -{ - s->WriteSwapScalar(fMinDist); - s->WriteSwapScalar(fMaxDist); - - s->WriteSwap32(fTable.GetCount()); - - for( fTable.First(); fTable.More(); fTable.Plus() ) - { - s->WriteSwapScalar(fTable.Current().fDistDel); - s->WriteSwapScalar(fTable.Current().fDistNorm); - s->WriteSwapScalar(fTable.Current().fShade); - } -} - diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistShade.h b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistShade.h deleted file mode 100644 index 368c6112..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistShade.h +++ /dev/null @@ -1,97 +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 . - -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 hsSfxDistShade_inc -#define hsSfxDistShade_inc - -#include "hsBiExpander.h" -#include "hsGRenderProcs.h" - -class hsSfxDistShade : public hsGRenderProcs { -public: - enum { - kShadeConstant = 0x10000 - }; - - struct hsSfxDfTableEntry { - hsScalar fDistDel; - hsScalar fDistNorm; - hsScalar fShade; - }; -protected: - - hsScalar fMinDist; - hsScalar fMaxDist; - - hsScalar fConstShade; - - hsScalar fMinIdle; - hsScalar fMaxIdle; - - hsExpander fTable; - - void IConstShadeVerts(hsExpander& vList); - void ICalcShadeVerts(hsExpander& vList); - hsScalar IShadeFromDist(hsScalar dist); -public: - hsSfxDistShade(); - virtual ~hsSfxDistShade(); - - virtual hsBool32 BeginObject(plPipeline* pipe, plDrawable* obj); - - virtual void ProcessPreInterpShadeVerts(hsExpander& vList); - - void MakeTable(float* distList, float* shadeList, int num); // lists sorted from lowest cosine to highest - - virtual void Read(hsStream* s); - virtual void Write(hsStream* s); - - virtual const char* GetLabel() const { return "hsSfxDistShade"; } - - virtual ProcType GetType() const { return kTypeDistShade; } - - CLASSNAME_REGISTER( hsSfxDistShade ); - GETINTERFACE_ANY( hsSfxDistShade, hsGRenderProcs ); - -}; - -#endif // hsSfxDistShade_inc diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxGlobalShade.cpp b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxGlobalShade.cpp deleted file mode 100644 index 8228ff7a..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxGlobalShade.cpp +++ /dev/null @@ -1,242 +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 . - -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 "hsMemory.h" -#include "hsSfxGlobalShade.h" -#include "hsStream.h" -//#include "../plPipeline/hsG3DDevice.h" -#include "../plPipeline/plPipeline.h" -#include "../plGLight/hsGProjector3.h" -#include "../plSurface/hsGLayer.h" -#include "../plSurface/hsGMaterial.h" -#include "../plDrawable/plDrawable.h" -#include "../plIntersect/hsBounds.h" - - -void hsSfxGlobalShade::ISetIntensity(hsPoint3& pos) -{ - if( fGSFlags & kFromFog ) - ISetFromFog(pos); - else - if( fGSFlags & kFromClear ) - ISetFromClear(pos); - else - if( fGSFlags & kFromLights ) - ISetFromLights(pos); - - fIntensity.a = hsMaximum(fIntensity.r, hsMaximum(fIntensity.g, fIntensity.b)); -} - -void hsSfxGlobalShade::ISetFromClear(hsPoint3& pos) -{ - fIntensity.Set(0,0,0,0); -#if 0 // Taken out 2.26.2001 mcn 'cause it accesses the (now defunct) 3DDevice directly - hsG3DDevice* dev = fPipeline->Get3DDevice(); - hsGEnvironment* env = dev->GetEnvironment(); - if( env && (env->GetFlags() & hsGEnvironment::kClearColorSet) ) - { - fIntensity = env->GetClearColor(); - } -#endif -} - -void hsSfxGlobalShade::ISetFromFog(hsPoint3& pos) -{ - fIntensity.Set(0,0,0,0); -#if 0 // Taken out 2.26.2001 mcn 'cause it accesses the (now defunct) 3DDevice directly - hsG3DDevice* dev = fPipeline->Get3DDevice(); - hsGEnvironment* env = dev->GetEnvironment(); - if( env && (env->GetFlags() & hsGEnvironment::kFogColorSet) ) - { - fIntensity = env->GetFogColor(); - } -#endif -} - -void hsSfxGlobalShade::ISetFromLights(hsPoint3& pos) -{ - fIntensity = ISumLights(pos); -} - -hsColorRGBA hsSfxGlobalShade::ISumLights(hsPoint3& pos) -{ - hsColorRGBA accum; - accum.Set(0,0,0,0); - -#if 0 // Taken out 2.26.2001 mcn 'cause it accesses the (now defunct) 3DDevice directly - hsG3DDevice* dev = fPipeline->Get3DDevice(); - for( dev->FirstProjector(); dev->MoreProjectors(); dev->IncProjector() ) - { - hsGProjector3* proj = dev->CurrProjector(); - - if( proj->IsOmni() ) - { - hsScalar intensity = proj->AttenuatePoint(&pos) * proj->GetIntensity(); - - if( intensity > 0.f ) - { - hsColorRGBA col = intensity * proj->GetLightColor(); - accum += col; - } - } - else - if( proj->IsPerspective() ) // spot - { - hsPoint4 ang; - uint32_t clips; - proj->GetNdcPoints(1, &pos, sizeof(pos), &ang, kClipAll, &clips); - - if( !clips - || !( proj->IsAttenuated() || proj->AttenuatesAlpha() || (clips & ~kClipYon) ) - ) - { - hsScalar intensity = proj->AttenuatePoint(&pos) * proj->GetIntensity(); - - if( intensity > 0.f ) - { - hsColorRGBA col = intensity * proj->GetLightColor(); - accum += col; - } - } - } - else // directional - { - hsColorRGBA col = proj->GetIntensity() * proj->GetLightColor(); - accum += col; - } - } -#endif - return accum; -} - -void hsSfxGlobalShade::ProcessPreInterpShadeVerts(hsExpander& vList) -{ - if( fCurrentLayer ) - { - if( fGSFlags & kAffectDiffuse ) - fCurrentLayer->SetColor(fRestoreColor.r, fRestoreColor.g, fRestoreColor.b, fRestoreColor.a); - else - fCurrentLayer->SetAmbientColor(fRestoreColor.r, fRestoreColor.g, fRestoreColor.b, fRestoreColor.a); - } - -#if 0 // Taken out 2.26.2001 mcn 'cause it accesses the (now defunct) 3DDevice directly - hsG3DDevice* dev = fPipeline->Get3DDevice(); - hsRefCnt_SafeAssign(fCurrentLayer, dev->GetCurrentLayer()); - if( fCurrentLayer ) - { - fRestoreColor = fGSFlags & kAffectDiffuse ? fCurrentLayer->GetColor() : fCurrentLayer->GetAmbientColor(); - hsColorRGBA col = fAmbient; - if( fGSFlags & kScalarIntensity ) - { - col.r += fDiffuse.r * fIntensity.a; - col.g += fDiffuse.g * fIntensity.a; - col.b += fDiffuse.b * fIntensity.a; - } - else - { - col.r += fDiffuse.r * fIntensity.r; - col.g += fDiffuse.g * fIntensity.g; - col.b += fDiffuse.b * fIntensity.b; - } - if( fGSFlags & kAffectDiffuse ) - fCurrentLayer->SetColor(col.r, col.g, col.b, fRestoreColor.a); - else - fCurrentLayer->SetAmbientColor(col.r, col.g, col.b, fRestoreColor.a); - } -#endif -} - -hsBool32 hsSfxGlobalShade::BeginObject(plPipeline* pipe, plDrawable* obj) -{ - hsBool32 retVal = hsGRenderProcs::BeginObject(pipe, obj); - - const hsBounds3Ext& bnd = obj->GetLocalBounds(); - hsPoint3 pos = bnd.GetCenter(); - ISetIntensity(pos); - - return retVal; -} - -void hsSfxGlobalShade::EndObject() -{ - hsGRenderProcs::EndObject(); - if( fCurrentLayer ) - { - if( fGSFlags & kAffectDiffuse ) - fCurrentLayer->SetColor(fRestoreColor.r, fRestoreColor.g, fRestoreColor.b, fRestoreColor.a); - else - fCurrentLayer->SetAmbientColor(fRestoreColor.r, fRestoreColor.g, fRestoreColor.b, fRestoreColor.a); - hsRefCnt_SafeUnRef(fCurrentLayer); - fCurrentLayer = nil; - } -} - -void hsSfxGlobalShade::Read(hsStream* s) -{ - fGSFlags = s->ReadSwap32(); - fAmbient.Read(s); - fDiffuse.Read(s); - if( fGSFlags & kFromLights ) - fGSFlags |= kAffectDiffuse; -} - -void hsSfxGlobalShade::Write(hsStream* s) -{ - s->WriteSwap32(fGSFlags); - fAmbient.Write(s); - fDiffuse.Write(s); -} - -hsSfxGlobalShade::hsSfxGlobalShade() -{ - fCurrentLayer = nil; - fGSFlags = 0; - fAmbient.Set(0,0,0,0); - fDiffuse.Set(1.f,1.f,1.f,1.f); -} - -hsSfxGlobalShade::~hsSfxGlobalShade() -{ - hsRefCnt_SafeUnRef(fCurrentLayer); // should be nil anyway unless we're destroyed during processing -} - diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxGlobalShade.h b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxGlobalShade.h deleted file mode 100644 index a243ed8a..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxGlobalShade.h +++ /dev/null @@ -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 . - -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 hsSfxGlobalShade_inc -#define hsSfxGlobalShade_inc - -#include "hsBiExpander.h" -#include "hsGRenderProcs.h" -#include "hsColorRGBA.h" -#include "hsGeometry3.h" - -class hsGLayer; - -class hsSfxGlobalShade : public hsGRenderProcs { -public: - enum { - kNone = 0x0, - kFromFog = 0x1, - kFromClear = 0x2, - kFromLights = 0x4, - kSourceMask = kFromFog | kFromClear | kFromLights, - kScalarIntensity = 0x8, - kAffectDiffuse = 0x10 - }; -protected: - - // Constants from which to work. - uint32_t fGSFlags; - - hsColorRGBA fAmbient; - hsColorRGBA fDiffuse; - - // Calculated each invocation. - hsColorRGBA fIntensity; - - hsGLayer* fCurrentLayer; - hsColorRGBA fRestoreColor; - - void ISetIntensity(hsPoint3& pos); - void ISetFromFog(hsPoint3& pos); - void ISetFromClear(hsPoint3& pos); - void ISetFromLights(hsPoint3& pos); - hsColorRGBA ISumLights(hsPoint3& pos); -public: - hsSfxGlobalShade(); - virtual ~hsSfxGlobalShade(); - - virtual void ProcessPreInterpShadeVerts(hsExpander& vList); - - virtual hsBool32 BeginObject(plPipeline* pipe, plDrawable* obj); - virtual void EndObject(); - - virtual void Read(hsStream* s); - virtual void Write(hsStream* s); - - virtual const char* GetLabel() const { return "hsSfxGlobalShade"; } - - virtual ProcType GetType() const { return kTypeGlobalShade; } - - void SetAmbient(const hsColorRGBA& col) { fAmbient = col; } - hsColorRGBA GetAmbient() const { return fAmbient; } - - void SetDiffuse(const hsColorRGBA& col) { fDiffuse = col; } - hsColorRGBA GetDiffuse() const { return fDiffuse; } - - void SetSource(uint32_t f) { fGSFlags &= ~kSourceMask; fGSFlags |= f; } - uint32_t GetSource() { return fGSFlags & kSourceMask; } - - void SetScalar(hsBool32 on) { if(on)fGSFlags |= kScalarIntensity; else fGSFlags &= ~kScalarIntensity; } - hsBool32 GetScalar() { return 0 != (fGSFlags & kScalarIntensity); } - - void SetAffectDiffuse(hsBool32 on) { if(on)fGSFlags |= kAffectDiffuse; else fGSFlags &= ~kAffectDiffuse; } - hsBool32 GetAffectDiffuse() { return 0 != (fGSFlags & kAffectDiffuse); } - - CLASSNAME_REGISTER( hsSfxGlobalShade ); - GETINTERFACE_ANY( hsSfxGlobalShade, hsGRenderProcs ); - -}; - -#endif // hsSfxGlobalShade_inc diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxIntenseAlpha.cpp b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxIntenseAlpha.cpp deleted file mode 100644 index 2130e69c..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxIntenseAlpha.cpp +++ /dev/null @@ -1,81 +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 . - -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 "hsGeometry3.h" -#include "hsSfxIntenseAlpha.h" -#include "../plGeometry/hsTriangle3.h" - - -hsSfxIntenseAlpha::hsSfxIntenseAlpha() -: fMinAlpha(0) -{ - fFlags |= kInclusive; -} - -hsSfxIntenseAlpha::~hsSfxIntenseAlpha() -{ -} - -void hsSfxIntenseAlpha::ProcessPreInterpShadeVerts(hsExpander& vList) -{ - hsScalar oScale = 1.f - fMinAlpha; - for( vList.First(); vList.More(); vList.Plus() ) - { - hsGShadeVertex* s = vList.Current(); - hsScalar o = hsMaximum(hsMaximum(s->fShade.r, s->fShade.g), s->fShade.b); - o *= oScale; - o += fMinAlpha; - s->fShade.a *= o; - } -} - -void hsSfxIntenseAlpha::Read(hsStream* s) -{ - fMinAlpha = s->ReadSwapScalar(); -} - -void hsSfxIntenseAlpha::Write(hsStream* s) -{ - s->WriteSwapScalar(fMinAlpha); -} diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxIntenseAlpha.h b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxIntenseAlpha.h deleted file mode 100644 index cd1572e4..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxIntenseAlpha.h +++ /dev/null @@ -1,82 +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 . - -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 hsSfxIntenseAlpha_inc -#define hsSfxIntenseAlpha_inc - -#include "hsGRenderProcs.h" -#include "hsGeometry3.h" - -class hsSfxIntenseAlpha : public hsGRenderProcs -{ -protected: - hsVector3 fDirViewPerp; - hsVector3 fDirScreen; - hsScalar fOpacityScale; - hsScalar fOpacityMax; - - hsScalar fMinAlpha; - -public: - hsSfxIntenseAlpha(); - virtual ~hsSfxIntenseAlpha(); - - void SetMinAlpha(hsScalar s) { fMinAlpha = s; } - hsScalar GetMinAlpha() { return fMinAlpha; } - - virtual void ProcessPreInterpShadeVerts(hsExpander& vList); - - virtual void Read(hsStream* s); - virtual void Write(hsStream* s); - - virtual const char* GetLabel() const { return "hsSfxIntenseAlpha"; } - - virtual ProcType GetType() const { return kTypeIntenseAlpha; } - - CLASSNAME_REGISTER( hsSfxIntenseAlpha ); - GETINTERFACE_ANY( hsSfxIntenseAlpha, hsGRenderProcs ); - -}; - - - -#endif // hsSfxIntenseAlpha_inc diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistFade.cpp b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistFade.cpp deleted file mode 100644 index 58a7f88c..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistFade.cpp +++ /dev/null @@ -1,320 +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 . - -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 "hsMemory.h" -#include "hsSfxObjDistFade.h" -#include "hsStream.h" -//#include "hsG3DDevice.h" -#include "../plPipeline/plPipeline.h" -#include "../plGeometry/hsTriangle3.h" - -#include "../plIntersect/hsBounds.h" -#include "../plDrawable/plDrawable.h" - -static hsScalar globalScale = 1.f; - -hsSfxObjDistFade::hsSfxObjDistFade() -: fMinDist(0), fMaxDist(0), fTreeCnt(0) -{ -} - -hsSfxObjDistFade::~hsSfxObjDistFade() -{ -} - -hsScalar hsSfxObjDistFade::IOpacFromDist(hsScalar dist) -{ - if( dist <= fTable[0].fDistDel ) - return fTable[0].fOpacity; - - int i; - for( i = 0; (i < fTable.GetCount()) && (dist >= fTable[i].fDistDel); i++ ) - dist -= fTable[i].fDistDel; - - if( i >= fTable.GetCount() ) - return fTable[fTable.GetCount()-1].fOpacity; - - dist *= fTable[i-1].fDistNorm; - hsScalar opac0 = fTable[i-1].fOpacity; - hsScalar opac1 = fTable[i].fOpacity; - - return opac0 + dist * (opac1 - opac0); -} - -hsBool32 hsSfxObjDistFade::ISetOpac(plDrawable* refObj) -{ - hsPoint3 refPos; - if( fFlags & kByBoundsCenter ) - { - const hsBounds3Ext& bnd = refObj->GetWorldBounds(); - if( kBoundsNormal != bnd.GetType() ) - return true; - refPos = bnd.GetCenter(); - } - else - { - refObj->GetLocalToWorld().GetTranslate(&refPos); - } - - fFlags &= ~(kCulled | kNOP); - - hsPoint3 vPos; - if( GetObjectRef(1) ) - { - GetObjectRef(1)->GetLocalToWorld().GetTranslate(&vPos); - } - else - { - vPos = fPipeline->GetViewPositionWorld(); - } - - hsScalar dist = hsVector3(&vPos, &refPos).Magnitude(); - - if( (fFlags & kCullsBefore) - &&(dist <= fMinDist) ) - { - fFlags |= kCulled; - return false; - } - - if( (fFlags & kCullsBeyond) - &&(dist > fMaxDist) ) - { - fFlags |= kCulled; - return false; - } - - if( (fFlags & kIdleBefore) - &&(dist < fMinIdle) ) - fFlags |= kNOP; - else - if( (fFlags & kIdleBeyond) - &&(dist > fMaxIdle) ) - fFlags |= kNOP; - else - { - hsScalar opac = IOpacFromDist(dist); - hsColorRGBA col = fColorizer.GetCurrentColor(); - if( fColorizer.Alpharizing() ) - col.a *= opac; - else - col.a = opac; - fColorizer.PushColorize(col, fColorizer.Colorizing()); - - if( fFlags & kNoZTrans ) - { - if( !(fPipeline->GetMaterialOverrideOff(hsGMatState::kZ) & hsGMatState::kZNoZWrite) ) - { - fRestoreOver = fPipeline->PushMaterialOverride(hsGMatState::kZ, hsGMatState::kZNoZWrite, true); - } - } - } - - return true; -} - -hsBool32 hsSfxObjDistFade::BeginObject(plPipeline* pipe, plDrawable* obj) -{ - if( Inclusive() ) - return true; - - hsGRenderProcs::BeginObject(pipe, obj); - -#if 0 - // This is bogus. We may want to fade something, but not fade it out entirely. - if( !(fFlags & (kCullsBefore | kCullsBeyond | kIdleBefore | kIdleBeyond)) ) - return true; -#endif - - plDrawable* refObj = fFlags & kObjectRefs ? GetObjectRef(0) : nil; - if( !refObj ) - refObj = obj; - - return ISetOpac(refObj); -} - -hsBool32 hsSfxObjDistFade::BeginTree(plPipeline* pipe, plDrawable* obj) -{ - if( !Inclusive() ) - return true; - - if( fTreeCnt++ ) - return true; - - hsGRenderProcs::BeginTree(pipe, obj); - - plDrawable* refObj = fFlags & kObjectRefs ? GetObjectRef(0) : nil; - if( !refObj ) - refObj = obj; - - return ISetOpac(refObj); -} - -void hsSfxObjDistFade::EndObject() -{ - if( !Inclusive() ) - { - fPipeline->PopMaterialOverride(fRestoreOver, true); - } - hsGRenderProcs::EndObject(); -} - -void hsSfxObjDistFade::EndTree() -{ - if( Inclusive() ) - { - fPipeline->PopMaterialOverride(fRestoreOver, true); - - fTreeCnt--; - hsAssert(fTreeCnt >= 0, "Push/Pop tree problem"); - } - hsGRenderProcs::EndTree(); -} - -void hsSfxObjDistFade::MakeTable(float* distList, float* opacList, int num) -{ - fTable.Reset(); - if( !num ) - return; - - int i; - for( i = 0; i < num; i++ ) - { - hsSfxDfTableEntry* t = fTable.Append(); - t->fDistDel = distList[i]; - t->fOpacity = opacList[i]; - } - for( i = num-1; i > 0; i-- ) - fTable[i].fDistDel -= fTable[i-1].fDistDel; - for( i = 0; i < num-1; i++ ) - fTable[i].fDistNorm = hsScalarInvert(fTable[i+1].fDistDel); - fTable[num-1].fDistNorm = 0; - hsAssert(fTable.GetCount() == num, "Mismatch making table"); - - if( fTable[0].fOpacity <= 0 ) - fFlags |= kCullsBefore; - if( fTable[num-1].fOpacity <= 0 ) - fFlags |= kCullsBeyond; - if( fTable[0].fOpacity >= 1.f ) - fFlags |= kIdleBefore; - if( fTable[num-1].fOpacity >= 1.f ) - fFlags |= kIdleBeyond; - - int iMin; - for( iMin = 0; (iMin < fTable.GetCount())&&(fTable[iMin].fOpacity <= 0); iMin++ ); - fMinDist = fTable[0].fDistDel; - for( i = 1; i < iMin; i++ ) - fMinDist += fTable[i].fDistDel; - - for( iMin = 0; (iMin < fTable.GetCount())&&(fTable[iMin].fOpacity >= 1.f); iMin++ ); - fMinIdle = fTable[0].fDistDel; - for( i = 1; i < iMin; i++ ) - fMinIdle += fTable[i].fDistDel; - - int iMax; - for( iMax = fTable.GetCount()-1; (iMax >= 0)&&(fTable[iMax].fOpacity <= 0); iMax-- ); - if( ++iMax >= fTable.GetCount() ) - iMax = fTable.GetCount()-1; - fMaxDist = fTable[0].fDistDel; - for( i = 1; i <= iMax; i++ ) - fMaxDist += fTable[i].fDistDel; - - for( iMax = fTable.GetCount()-1; (iMax >= 0)&&(fTable[iMax].fOpacity >= 1.f); iMax-- ); - if( ++iMax >= fTable.GetCount() ) - iMax = fTable.GetCount()-1; - fMaxIdle = fTable[0].fDistDel; - for( i = 1; i <= iMax; i++ ) - fMaxIdle += fTable[i].fDistDel; -} - -void hsSfxObjDistFade::Read(hsStream* s) -{ - fTable.Reset(); - - fMinDist = s->ReadSwapScalar(); - fMaxDist = s->ReadSwapScalar(); - - if( fFlags & (kIdleBefore | kIdleBeyond) ) - { - fMinIdle = s->ReadSwapScalar(); - fMaxIdle = s->ReadSwapScalar(); - } - - int32_t cnt = s->ReadSwap32(); - - if( cnt ) - { - hsSfxDfTableEntry* arr = new hsSfxDfTableEntry[cnt]; - int i; - for( i = 0; i < cnt; i++ ) - { - arr[i].fDistDel = s->ReadSwapScalar(); - arr[i].fDistNorm = s->ReadSwapScalar(); - arr[i].fOpacity = s->ReadSwapScalar(); - } - - fTable.SetArray(arr, cnt); - } -} - -void hsSfxObjDistFade::Write(hsStream* s) -{ - s->WriteSwapScalar(fMinDist); - s->WriteSwapScalar(fMaxDist); - - if( fFlags & (kIdleBefore | kIdleBeyond) ) - { - s->WriteSwapScalar(fMinIdle); - s->WriteSwapScalar(fMaxIdle); - } - - s->WriteSwap32(fTable.GetCount()); - - for( fTable.First(); fTable.More(); fTable.Plus() ) - { - s->WriteSwapScalar(fTable.Current().fDistDel); - s->WriteSwapScalar(fTable.Current().fDistNorm); - s->WriteSwapScalar(fTable.Current().fOpacity); - } -} - diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistFade.h b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistFade.h deleted file mode 100644 index e3e0d2a2..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistFade.h +++ /dev/null @@ -1,116 +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 . - -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 hsSfxObjDistFade_inc -#define hsSfxObjDistFade_inc - -#include "hsBiExpander.h" -#include "hsGRenderProcs.h" -#include "../plPipeline/hsGMatState.h" - -class hsSfxObjDistFade : public hsGRenderProcs { -public: - enum { - kCullsBefore = 0x10000, - kCullsBeyond = 0x20000, - - kDistFromView = 0x40000, - kDistFromTarget = 0x80000, - kDistAlongX = 0x100000, - kZOff = 0x200000, - kNoZTrans = 0x400000, - kByBoundsCenter = 0x800000, - - kPostInterp = 0x1000000, - - kIdleBefore = 0x2000000, - kIdleBeyond = 0x4000000, - - kZWasOff = 0x8000000 - }; - - struct hsSfxDfTableEntry { - hsScalar fDistDel; - hsScalar fDistNorm; - hsScalar fOpacity; - }; -protected: - - hsScalar fMinDist; - hsScalar fMaxDist; - - hsScalar fMinIdle; - hsScalar fMaxIdle; - - int32_t fTreeCnt; - - hsExpander fTable; - - hsGMatState fRestoreOver; - - hsBool32 ISetOpac(plDrawable* refObj); - hsScalar IOpacFromDist(hsScalar dist); -public: - hsSfxObjDistFade(); - virtual ~hsSfxObjDistFade(); - - virtual hsBool32 BeginTree(plPipeline* pipe, plDrawable* root); - virtual hsBool32 BeginObject(plPipeline* pipe, plDrawable* obj); - - virtual void EndObject(); - virtual void EndTree(); - - void MakeTable(float* distList, float* opacList, int num); // lists sorted from lowest cosine to highest - - virtual void Read(hsStream* s); - virtual void Write(hsStream* s); - - virtual const char* GetLabel() const { return "hsSfxObjDistFade"; } - - virtual ProcType GetType() const { return kTypeObjDistFade; } - - CLASSNAME_REGISTER( hsSfxObjDistFade ); - GETINTERFACE_ANY( hsSfxObjDistFade, hsGRenderProcs ); - -}; - -#endif // hsSfxObjDistFade_inc diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistShade.cpp b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistShade.cpp deleted file mode 100644 index ef3ed78f..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistShade.cpp +++ /dev/null @@ -1,217 +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 . - -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 "hsMemory.h" -#include "hsSfxObjDistShade.h" -#include "hsStream.h" -#include "../plPipeline/plPipeline.h" -#include "../plGeometry/hsTriangle3.h" - -#include "../plIntersect/hsBounds.h" -#include "../plDrawable/plDrawable.h" - -static hsScalar globalScale = 1.f; - -hsSfxObjDistShade::hsSfxObjDistShade() -: fMinDist(0), fMaxDist(0), fTreeCnt(0) -{ -} - -hsSfxObjDistShade::~hsSfxObjDistShade() -{ -} - -hsScalar hsSfxObjDistShade::IShadeFromDist(hsScalar dist) -{ - if( dist <= fTable[0].fDistDel ) - return fTable[0].fShade; - - int i; - for( i = 0; (i < fTable.GetCount()) && (dist >= fTable[i].fDistDel); i++ ) - dist -= fTable[i].fDistDel; - - if( i >= fTable.GetCount() ) - return fTable[fTable.GetCount()-1].fShade; - - dist *= fTable[i-1].fDistNorm; - hsScalar shade0 = fTable[i-1].fShade; - hsScalar shade1 = fTable[i].fShade; - - return shade0 + dist * (shade1 - shade0); -} - -hsBool32 hsSfxObjDistShade::ISetShade(plDrawable* refObj) -{ - hsPoint3 refPos; - if( fFlags & kByBoundsCenter ) - { - const hsBounds3Ext& bnd = refObj->GetWorldBounds(); - if( kBoundsNormal != bnd.GetType() ) - return true; - refPos = bnd.GetCenter(); - } - else - { - refObj->GetLocalToWorld().GetTranslate(&refPos); - } - - hsPoint3 vPos; - if( GetObjectRef(1) ) - { - GetObjectRef(1)->GetLocalToWorld().GetTranslate(&vPos); - } - else - { - vPos = fPipeline->GetViewPositionWorld(); - } - - hsScalar dist = hsVector3(&vPos, &refPos).Magnitude(); - - hsScalar shade = IShadeFromDist(dist); - - hsColorRGBA col = fColorizer.GetCurrentColor(); - if( fColorizer.Colorizing() ) - { - col.r *= shade; - col.g *= shade; - col.b *= shade; - } - else - { - col.r = shade; - col.g = shade; - col.b = shade; - } - fColorizer.PushColorize(col, false); - - return true; -} - - - -hsBool32 hsSfxObjDistShade::BeginObject(plPipeline* pipe, plDrawable* obj) -{ - hsGRenderProcs::BeginObject(pipe, obj); - - plDrawable* refObj = fFlags & kObjectRefs ? GetObjectRef(0) : nil; - if( !refObj ) - refObj = obj; - - return ISetShade(refObj); -} - -void hsSfxObjDistShade::MakeTable(float* distList, float* shadeList, int num) -{ - fTable.Reset(); - if( !num ) - return; - - int i; - for( i = 0; i < num; i++ ) - { - hsSfxDfTableEntry* t = fTable.Append(); - t->fDistDel = distList[i]; - t->fShade = shadeList[i]; - } - for( i = num-1; i > 0; i-- ) - fTable[i].fDistDel -= fTable[i-1].fDistDel; - for( i = 0; i < num-1; i++ ) - fTable[i].fDistNorm = hsScalarInvert(fTable[i+1].fDistDel); - fTable[num-1].fDistNorm = 0; - hsAssert(fTable.GetCount() == num, "Mismatch making table"); - - int iMin; - for( iMin = 0; (iMin < fTable.GetCount())&&(fTable[iMin].fShade <= 0); iMin++ ); - fMinDist = fTable[0].fDistDel; - for( i = 1; i < iMin; i++ ) - fMinDist += fTable[i].fDistDel; - - int iMax; - for( iMax = fTable.GetCount()-1; (iMax >= 0)&&(fTable[iMax].fShade <= 0); iMax-- ); - if( ++iMax >= fTable.GetCount() ) - iMax = fTable.GetCount()-1; - fMaxDist = fTable[0].fDistDel; - for( i = 1; i <= iMax; i++ ) - fMaxDist += fTable[i].fDistDel; - -} - -void hsSfxObjDistShade::Read(hsStream* s) -{ - fTable.Reset(); - - fMinDist = s->ReadSwapScalar(); - fMaxDist = s->ReadSwapScalar(); - - int32_t cnt = s->ReadSwap32(); - - if( cnt ) - { - hsSfxDfTableEntry* arr = new hsSfxDfTableEntry[cnt]; - int i; - for( i = 0; i < cnt; i++ ) - { - arr[i].fDistDel = s->ReadSwapScalar(); - arr[i].fDistNorm = s->ReadSwapScalar(); - arr[i].fShade = s->ReadSwapScalar(); - } - - fTable.SetArray(arr, cnt); - } -} - -void hsSfxObjDistShade::Write(hsStream* s) -{ - s->WriteSwapScalar(fMinDist); - s->WriteSwapScalar(fMaxDist); - - s->WriteSwap32(fTable.GetCount()); - - for( fTable.First(); fTable.More(); fTable.Plus() ) - { - s->WriteSwapScalar(fTable.Current().fDistDel); - s->WriteSwapScalar(fTable.Current().fDistNorm); - s->WriteSwapScalar(fTable.Current().fShade); - } -} - diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistShade.h b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistShade.h deleted file mode 100644 index 707eefc1..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistShade.h +++ /dev/null @@ -1,98 +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 . - -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 hsSfxObjDistShade_inc -#define hsSfxObjDistShade_inc - -#include "hsBiExpander.h" -#include "hsGRenderProcs.h" - -class hsSfxObjDistShade : public hsGRenderProcs { -public: - enum { - kShadeConstant = 0x10000, - kByBoundsCenter = 0x800000, - - }; - - struct hsSfxDfTableEntry { - hsScalar fDistDel; - hsScalar fDistNorm; - hsScalar fShade; - }; -protected: - - hsScalar fMinDist; - hsScalar fMaxDist; - - hsScalar fConstShade; - - hsScalar fMinIdle; - hsScalar fMaxIdle; - - int32_t fTreeCnt; - - hsExpander fTable; - - hsBool32 ISetShade(plDrawable* refObj); - hsScalar IShadeFromDist(hsScalar dist); -public: - hsSfxObjDistShade(); - virtual ~hsSfxObjDistShade(); - - virtual hsBool32 BeginObject(plPipeline* pipe, plDrawable* obj); - - void MakeTable(float* distList, float* shadeList, int num); // lists sorted from lowest cosine to highest - - virtual void Read(hsStream* s); - virtual void Write(hsStream* s); - - virtual const char* GetLabel() const { return "hsSfxObjDistShade"; } - - virtual ProcType GetType() const { return kTypeObjDistShade; } - - CLASSNAME_REGISTER( hsSfxObjDistShade ); - GETINTERFACE_ANY( hsSfxObjDistShade, hsGRenderProcs ); - -}; - -#endif // hsSfxObjDistShade_inc diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/plGRenderProcsCreatable.h b/Sources/Plasma/PubUtilLib/plGRenderProcs/plGRenderProcsCreatable.h deleted file mode 100644 index ab9c835b..00000000 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/plGRenderProcsCreatable.h +++ /dev/null @@ -1,80 +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 . - -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 plGRenderProcsCreatable_inc -#define plGRenderProcsCreatable_inc - -#include "../plResMgr/plCreator.h" - -#include "hsGRenderProcs.h" - -REGISTER_NONCREATABLE( hsGRenderProcs ); - -#include "hsSfxAngleFade.h" - -REGISTER_CREATABLE( hsSfxAngleFade ); - -#include "hsSfxDistFade.h" - -REGISTER_CREATABLE( hsSfxDistFade ); - -#include "hsSfxDistShade.h" - -REGISTER_CREATABLE( hsSfxDistShade ); - -#include "hsSfxGlobalShade.h" - -REGISTER_CREATABLE( hsSfxGlobalShade ); - -#include "hsSfxIntenseAlpha.h" - -REGISTER_CREATABLE( hsSfxIntenseAlpha ); - -#include "hsSfxObjDistFade.h" - -REGISTER_CREATABLE( hsSfxObjDistFade ); - -#include "hsSfxObjDistShade.h" - -REGISTER_CREATABLE( hsSfxObjDistShade ); - -#endif // plGRenderProcsCreatable_inc diff --git a/Sources/Plasma/PubUtilLib/plGeometry/hsOscillator.cpp b/Sources/Plasma/PubUtilLib/plGeometry/hsOscillator.cpp deleted file mode 100644 index 45c5874b..00000000 --- a/Sources/Plasma/PubUtilLib/plGeometry/hsOscillator.cpp +++ /dev/null @@ -1,763 +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 . - -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 "hsStream.h" -#include "hsOscillator.h" -#include "../plMath/hsFastMath.h" -#include "hsGTriMesh.h" -#include "hsTriangle3.h" -#include "../plPipeline/plPipeline.h" - -#if defined(__MWERKS__) && !defined(HS_DEBUGGING) -#pragma optimization_level 0 -#endif - -static hsScalar rnd0_1() -{ - return hsScalar(rand()) / hsScalar(RAND_MAX); -} - -void hsWave::Save(hsStream* s, hsScalar secs) -{ - fWorldCenter.Write(s); - - s->WriteSwapScalar(fWorldFrequency); - - s->WriteSwapScalar(fWorldAmplitude); - - s->WriteSwapScalar(fPhase); - s->WriteSwapScalar(fRate); - - s->WriteSwapScalar(secs - fStartSecs); - - s->WriteSwapScalar(fSecsToLive); -} - -void hsWave::Load(hsStream* s, hsScalar secs) -{ - fWorldCenter.Read(s); - - fWorldFrequency = s->ReadSwapScalar(); - - fWorldAmplitude = s->ReadSwapScalar(); - - fPhase = s->ReadSwapScalar(); - fRate = s->ReadSwapScalar(); - - fStartSecs = s->ReadSwapScalar(); - fStartSecs = secs - fStartSecs; - - fSecsToLive = s->ReadSwapScalar(); -} - -void hsWave::Init(hsScalar secs, hsPoint3& center, hsScalar per, hsScalar amp, hsScalar rate, hsScalar life, hsBool32 attenOut) -{ - fStartSecs = secs; - fWorldCenter = center; - fWorldFrequency = hsScalarInvert(per); - fWorldAmplitude = amp; - fRate = rate; - fSecsToLive = life; - AttenuateOut(attenOut); -} - -hsBool32 hsWave::IsSpent(hsScalar secs) const -{ - return secs - fStartSecs > fSecsToLive; -} - -void hsWave::Accumulate(const hsPoint3& pos, const hsVector3& localZ, hsVector3& accum, hsVector3& accumNorm) const -{ - hsVector3 del(&pos, &fLocalCenter); - hsScalar dot = del.InnerProduct(localZ); - dot *= -2.f; - del += localZ * dot; - - hsScalar dist = del.MagnitudeSquared(); - dist = hsFastMath::InvSqrtAppr(dist); - del *= dist; - dist = hsScalarInvert(dist); - - hsScalar ampl = fLocalAmplitude; - if( fAttenuateOutScale > 0 ) - { - if( dist > fInnerRadius ) - { - if( dist > fOuterRadius ) - return; - ampl *= fOuterRadius - dist; - ampl *= fAttenuateOutScale; - } - } - - dist *= fLocalFrequency; - dist += fPhase; - - hsScalar s, c; - hsFastMath::SinCosAppr(dist, s, c); - - s *= ampl; - s += ampl; - c *= ampl * fLocalFrequency; - -// accum += s * localZ; - accum.fZ += s / localZ.fZ; - - hsVector3 norm; - norm = localZ; - norm += del * -c; - accumNorm += norm; - - return; -} - -void hsWave::Update(hsScalar secs, const hsMatrix44& l2w, const hsMatrix44& w2l) -{ - if( l2w.fFlags & hsMatrix44::kIsIdent ) - { - fLocalCenter = fWorldCenter; - fLocalFrequency = fWorldFrequency; - fLocalAmplitude = fWorldAmplitude; - } - else - { - hsVector3 ax; - ax.Set(w2l.fMap[0][2], w2l.fMap[1][2], w2l.fMap[2][2]); - hsScalar ooScale = ax.MagnitudeSquared(); - ooScale = hsFastMath::InvSqrtAppr(ooScale); - - fLocalCenter = w2l * fWorldCenter; - fLocalFrequency = fWorldFrequency * ooScale; - - hsScalar scale = 1.f / ooScale; - fLocalAmplitude = fWorldAmplitude * scale; - } - fLocalAmplitude *= AgeScale(secs); - - if( fAttenuateOutScale > 0 ) - { - fInnerRadius = fRate * (secs - fStartSecs) * hsScalarPI * 2.f; - fOuterRadius = fInnerRadius * (5.f/4.f); - fAttenuateOutScale = hsScalarInvert(fOuterRadius - fInnerRadius); - } - - fPhase = -(secs - fStartSecs) * fRate * hsScalarPI * 2.f; -} - -hsScalar hsWave::ScaledAmplitude(hsScalar secs) const -{ - return fWorldAmplitude * AgeScale(secs); -} - -hsScalar hsWave::AgeScale(hsScalar secs) const -{ - hsScalar age = secs - fStartSecs; - extern int dbgCurrentTest; - if( dbgCurrentTest ) - { - age *= 4.f; - age -= 2.f * fSecsToLive; - if( age < 0 ) - age = -age; - age -= fSecsToLive; - } - else - { - age *= 2.f; - age -= fSecsToLive; - if( age < 0 ) - age = -age; - } - hsScalar ageScale = 1.f - age / fSecsToLive; - if( ageScale < 0 ) - ageScale = 0; - else if( ageScale > 1.f ) - ageScale = 1.f; - return ageScale; -} - -hsOscillator::hsOscillator() -{ -} - -hsOscillator::~hsOscillator() -{ -} - -hsWave& hsOscillator::GetWeakestWave(hsScalar secs) -{ - hsAssert(!GetDisabled(), "Shouldn't be messing with disabled oscillator system"); - int weakest = 0; - hsScalar amp = fWaves[0].ScaledAmplitude(secs); - int i; - for( i = 0; i < fWaves.GetCount(); i++ ) - { - hsScalar tAmp = fWaves[i].ScaledAmplitude(secs); - if( tAmp < amp ) - { - weakest = i; - amp = tAmp; - } - } - return fWaves[weakest]; -} - -hsWave& hsOscillator::GetTempWave(hsScalar secs) -{ - int i; - for( i = 0; i < fTempWaves.GetCount(); i++ ) - { - if( fTempWaves[i].IsSpent(secs) ) - return fTempWaves[i]; - } - fTempWaves.Push(); - return fTempWaves[fTempWaves.GetCount()-1]; -} - -void hsOscillator::ISpawnWave(hsScalar secs, int i) -{ - hsPoint3 corner; - fWorldCenterBounds.GetCorner(&corner); - hsVector3 ax[3]; - fWorldCenterBounds.GetAxes(ax+0, ax+1, ax+2); - hsScalar r; - r = rnd0_1(); - ax[0] *= r; - corner += ax[0]; - r = rnd0_1(); - ax[1] *= r; - corner += ax[1]; - r = rnd0_1(); - ax[2] *= r; - corner += ax[2]; - - hsScalar per = fMinPeriod; - r = rnd0_1(); - hsScalar rr = r; - r *= fMaxPeriod - fMinPeriod; - per += r; - - hsScalar amp = fMinAmplitude; - r = rr * rnd0_1(); - r *= fMaxAmplitude - fMinAmplitude; - amp += r; - - hsScalar life = fMinLife; - r = rnd0_1(); - r *= fMaxLife - fMinLife; - life += r; - - hsScalar rate = fMinRate; - r = rnd0_1(); - r *= fMaxRate - fMinRate; - rate += r; - - fWaves[i].Init(secs, corner, per, amp, rate, life); - -} - -void hsOscillator::IUpdate(hsScalar secs, plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l) -{ - if( GetDisabled() ) - return; - - fWorldCenter = pipe->GetViewPositionWorld(); - fWorldCenter.fZ = (fWorldCenterBounds.GetMins().fZ + fWorldCenterBounds.GetMaxs().fZ) * 0.5f; - fLocalCenter = w2l * fWorldCenter; - - fLocalToWorld = l2w; - fWorldToLocal = w2l; - - fLocalX.Set(w2l.fMap[0][0],w2l.fMap[1][0],w2l.fMap[2][0]); - fLocalX.Normalize(); - fLocalY.Set(w2l.fMap[0][1],w2l.fMap[1][1],w2l.fMap[2][1]); - fLocalY.Normalize(); - fLocalZ.Set(w2l.fMap[0][2],w2l.fMap[1][2],w2l.fMap[2][2]); - fLocalZ.Normalize(); - - hsVector3 ax; - hsScalar ooScale; - ax.Set(w2l.fMap[0][0], w2l.fMap[1][0], w2l.fMap[2][0]); - ooScale = ax.MagnitudeSquared(); - ooScale = hsFastMath::InvSqrtAppr(ooScale); - fLocalAttenScale.fX = fWorldAttenScale.fX * ooScale; - - ax.Set(w2l.fMap[0][1], w2l.fMap[1][1], w2l.fMap[2][1]); - ooScale = ax.MagnitudeSquared(); - ooScale = hsFastMath::InvSqrtAppr(ooScale); - fLocalAttenScale.fY = fWorldAttenScale.fY * ooScale; - - fLocalAttenScale.fZ = 0; - - int i; - for( i = 0; i < fWaves.GetCount(); i++ ) - { - if( fWaves[i].IsSpent(secs) ) - ISpawnWave(secs, i); - fWaves[i].Update(secs, l2w, w2l); - } - for( i = 0; i < fTempWaves.GetCount(); i++ ) - { - while( (i < fTempWaves.GetCount()) && fTempWaves[i].IsSpent(secs) ) - fTempWaves.Remove(i, 1); - if( i < fTempWaves.GetCount() ) - fTempWaves[i].Update(secs, l2w, w2l); - } -} - -hsScalar hsOscillator::IAttenuate(const hsPoint3& in) const -{ - const hsPoint3& cen = fLocalCenter; - hsVector3 del(&in, &cen); - - hsScalar atX = del.InnerProduct(fLocalX); - atX *= fLocalAttenScale.fX; - if( atX > 0 ) - atX = -atX; - atX += 1.f; - if( atX < 0 ) - atX = 0; - - hsScalar atY = del.InnerProduct(fLocalY); - atY *= fLocalAttenScale.fY; - if( atY > 0 ) - atY = -atY; - atY += 1.f; - if( atY < 0 ) - atY = 0; - - hsScalar at = atX * atY; - return at; -} - -void hsOscillator::AdjustWorldBounds(const hsMatrix44& l2w, const hsMatrix44& w2l, hsBounds3Ext& bnd) const -{ - if( GetDisabled() ) - return; - - hsVector3 adj; - adj.Set(0,1.f/fLocalZ.fZ,0); - adj = l2w * adj; - adj *= fMaxAmplitude * fWaves.GetCount(); - - bnd.Union(&adj); - adj = -adj; - bnd.Union(&adj); -} - -void hsOscillator::IPerterb(const hsPoint3& in, hsGVertex3& out) const -{ - hsPoint3 pos = in; - hsVector3 del(&pos, &fLocalCenter); - hsScalar dot = del.InnerProduct(fLocalZ); - pos += fLocalZ * -dot; - - hsVector3 accum; - hsVector3 accumNorm; - accum.Set(0,0,0); - accumNorm.Set(0,0,0); - int i; - for( i = 0; i < fWaves.GetCount(); i++ ) - { - fWaves[i].Accumulate(pos, fLocalZ, accum, accumNorm); - } - for( i = 0; i < fTempWaves.GetCount(); i++ ) - { - fTempWaves[i].Accumulate(pos, fLocalZ, accum, accumNorm); - } - hsScalar atten = IAttenuate(pos); - static int attenuating = 1; - if( attenuating ) // nuke me - accum *= atten; - out.fLocalPos = in + accum; - - hsScalar invNorm = hsFastMath::InvSqrtAppr(accumNorm.MagnitudeSquared()); - accumNorm *= invNorm; - out.fNormal = accumNorm; -} - -void hsOscillator::Read(hsStream* s) -{ - int n = s->ReadSwap32(); - SetNumWaves(n); - - fWorldAttenScale.Read(s); - fWorldCenterBounds.Read(s); - - fMinPeriod = s->ReadSwapScalar(); - fMaxPeriod = s->ReadSwapScalar(); - - fMinAmplitude = s->ReadSwapScalar(); - fMaxAmplitude = s->ReadSwapScalar(); - - fMinRate = s->ReadSwapScalar(); - fMaxRate = s->ReadSwapScalar(); - - fMinLife = s->ReadSwapScalar(); - fMaxLife = s->ReadSwapScalar(); - - int i; - for( i = 0; i < fWaves.GetCount(); i++ ) - fWaves[i].Kill(); - - fTempWaves.Reset(); -} - -void hsOscillator::Load(hsStream* s, hsScalar secs) -{ - Read(s); - - int i; - for( i = 0; i < fWaves.GetCount(); i++ ) - fWaves[i].Load(s, secs); - - fTempWaves.Reset(); -} - -void hsOscillator::Write(hsStream* s) -{ - s->WriteSwap32(fWaves.GetCount()); - - fWorldAttenScale.Write(s); - fWorldCenterBounds.Write(s); - - s->WriteSwapScalar(fMinPeriod); - s->WriteSwapScalar(fMaxPeriod); - - s->WriteSwapScalar(fMinAmplitude); - s->WriteSwapScalar(fMaxAmplitude); - - s->WriteSwapScalar(fMinRate); - s->WriteSwapScalar(fMaxRate); - - s->WriteSwapScalar(fMinLife); - s->WriteSwapScalar(fMaxLife); - -} - -void hsOscillator::Save(hsStream* s, hsScalar secs) -{ - Write(s); - - int i; - for( i = 0; i < fWaves.GetCount(); i++ ) - fWaves[i].Save(s, secs); -} - -void hsOscillator::SetNumWaves(int n) -{ - fWaves.SetCount(n); - int i; - for( i = 0; i < n; i++ ) - fWaves[i].Kill(); -} - -void hsOscillator::Init(int32_t nParams, hsScalar* params) -{ -// NumWaves = 1 -// AttenScale = 2 -// WorldCenterBounds = 6 -// Period = 2 -// Amp = 2 -// Rate = 2 -// Life = 2 - - hsAssert(17 == nParams, "Parameter input mismatch"); - - SetNumWaves(int(*params++)); - - fWorldAttenScale.fX = *params++; - fWorldAttenScale.fY = *params++; - fWorldAttenScale.fZ = 0; - - hsPoint3 pt; - hsBounds3Ext bnd; - pt.fX = *params++; - pt.fY = *params++; - pt.fZ = *params++; - bnd.Reset(&pt); - pt.fX = *params++; - pt.fY = *params++; - pt.fZ = *params++; - bnd.Union(&pt); - SetWorldCenterBounds(bnd); - - SetPeriodRange(params[0], params[1]); - params += 2; - - SetAmplitudeRange(params[0], params[1]); - params += 2; - - SetRateRange(params[0], params[1]); - params += 2; - - SetLifeRange(params[0], params[1]); - - fTempWaves.Reset(); -} - - -#if 1 -hsGTriMesh* hsOscillator::MakeWaveMesh(int nSpokes, const hsPoint3& center, hsScalar minRad, hsScalar maxRad, hsScalar uRange, hsScalar vRange, hsScalar attenStartFrac, hsBool32 stitch) -{ - hsGTriMesh* triMesh = new hsGTriMesh; - - hsTArray radii; - hsScalar cRad = 0; - while( cRad < maxRad ) - { - // OOPS - for the half circle, this should be PI*R/n, not 2PI. Don't fix until we've corrected the callers. Or we might want to leave it like - // this anyway, since we're looking obliquely at these faces anyway, and this error stretches the side that perspective compresses. May - // want to make the unstitched version wrong in the same way. - hsScalar tRad = 2.f * hsScalarPI * cRad / nSpokes; - if( tRad < minRad ) - tRad = minRad; - cRad += tRad; - radii.Append(cRad); - } - - int nShell = radii.GetCount(); - - int nTris = stitch - ? 2 * nSpokes * (nShell-1) + nSpokes - : 2 * (nSpokes-1) * (nShell-1) + (nSpokes-1); - int nVerts = nSpokes * nShell + 1; - triMesh->AllocatePointers(nTris, nVerts, nVerts, nVerts); - triMesh->SetNumTriVertex(nVerts); - triMesh->SetNumPoints(nVerts); - triMesh->SetNumUvs(nVerts); - triMesh->SetHasColors(true); - - *triMesh->GetPoint(0) = center; - triMesh->GetNormal(0)->Set(0,1.f,0); - triMesh->GetColor(0)->Set(0,0,0,1.f); - triMesh->GetUvs(0)->fX = triMesh->GetUvs(0)->fY = triMesh->GetUvs(0)->fZ = 0; - - hsScalar iToRadians = stitch - ? 2.f * hsScalarPI / nSpokes - : hsScalarPI / nSpokes; - hsScalar attenStart = maxRad * attenStartFrac; - hsScalar attenEnd = maxRad; - hsScalar attenScale = hsScalarInvert(attenEnd - attenStart); - int i, j; - for( i = 0; i < nSpokes; i++ ) - { - hsScalar s = hsSine(i * iToRadians); - hsScalar c = hsCosine(i * iToRadians); - for( j = 0; j < nShell; j++ ) - { - hsAssert(1 + i*nShell + j < nVerts, "Going out of range on verts"); - hsGVertex3* vtx = triMesh->GetVertex(1 + i*nShell + j); - hsColorRGBA* col = triMesh->GetColor(1 + i*nShell + j); - hsGUv* uv = triMesh->GetUvs(1 + i*nShell + j); - - hsScalar x = c * radii[j]; - hsScalar y = s * radii[j]; - - hsScalar u = x / uRange; - hsScalar v = y / vRange; - - vtx->fLocalPos.fX = center.fX + x; - vtx->fLocalPos.fY = center.fY + y; - vtx->fLocalPos.fZ = 0.f; - - vtx->fNormal.Set(0,0,1.f); - - uv->fX = u; - uv->fY = v; - uv->fZ = 0.f; - - if( radii[j] > attenStart ) - { - hsScalar a = (attenEnd - radii[j]) * attenScale; - if( a < 0 ) - a = 0; - else if( a > 1.f ) - a = 1.f; - col->Set(0,0,0,a); - } - else - col->Set(0,0,0,1.f); - } - } - - int spokeEnd = stitch ? nSpokes : nSpokes-1; - int nextTri = 0; - for( i = 0; i < spokeEnd; i++ ) - { - hsTriangle3* tri = triMesh->GetTriFromPool(nextTri); - tri->Zero(); - tri->fOrigTri = tri; - triMesh->SetTriangle(nextTri++, tri); - - tri->fVert[0] = triMesh->GetTriVertex(0); - tri->fVert[0]->fVtx = triMesh->GetVertex(0); - tri->fVert[0]->SetNumUvChannels(1); - tri->fVert[0]->fUvChan[0] = triMesh->GetUvs(0); - tri->fVert[0]->fVtxColor = triMesh->GetColor(0); - - int iv0 = 1 + i * nShell; - int iv1 = i < nSpokes - 1 ? 1 + (i+1)*nShell : 1; - hsAssert((iv0 < nVerts)&&(iv1 < nVerts), "Out of range on triverts"); - - tri->fVert[1] = triMesh->GetTriVertex(iv0); - tri->fVert[1]->fVtx = triMesh->GetVertex(iv0); - tri->fVert[1]->SetNumUvChannels(1); - tri->fVert[1]->fUvChan[0] = triMesh->GetUvs(iv0); - tri->fVert[1]->fVtxColor = triMesh->GetColor(iv0); - - tri->fVert[2] = triMesh->GetTriVertex(iv1); - tri->fVert[2]->fVtx = triMesh->GetVertex(iv1); - tri->fVert[2]->SetNumUvChannels(1); - tri->fVert[2]->fUvChan[0] = triMesh->GetUvs(iv1); - tri->fVert[2]->fVtxColor = triMesh->GetColor(iv1); - - tri->fVert[0]->fFlags = hsGTriVertex::kHasPointers - | hsGTriVertex::kHasVertexUvs - | hsGTriVertex::kHasVertexColors; - tri->fVert[1]->fFlags = hsGTriVertex::kHasPointers - | hsGTriVertex::kHasVertexUvs - | hsGTriVertex::kHasVertexColors; - tri->fVert[2]->fFlags = hsGTriVertex::kHasPointers - | hsGTriVertex::kHasVertexUvs - | hsGTriVertex::kHasVertexColors; - - tri->fFlags |= hsTriangle3::kHasVertexPosNorms - | hsTriangle3::kHasVertexUvs - | hsTriangle3::kHasVertexColors - | hsTriangle3::kHasPointers; - - int iv2 = iv0 + 1; - int iv3 = iv1 + 1; - hsAssert((iv1 < nVerts)&&(iv2 < nVerts), "Out of range on triverts"); - for( j = 0; j < nShell-1; j++ ) - { - tri = triMesh->GetTriFromPool(nextTri); - tri->Zero(); - tri->fOrigTri = tri; - triMesh->SetTriangle(nextTri++, tri); - - tri->fVert[0] = triMesh->GetTriVertex(iv0); - tri->fVert[0]->fVtx = triMesh->GetVertex(iv0); - tri->fVert[0]->SetNumUvChannels(1); - tri->fVert[0]->fUvChan[0] = triMesh->GetUvs(iv0); - tri->fVert[0]->fVtxColor = triMesh->GetColor(iv0); - - tri->fVert[1] = triMesh->GetTriVertex(iv2); - tri->fVert[1]->fVtx = triMesh->GetVertex(iv2); - tri->fVert[1]->SetNumUvChannels(1); - tri->fVert[1]->fUvChan[1] = triMesh->GetUvs(iv2); - tri->fVert[1]->fVtxColor = triMesh->GetColor(iv2); - - tri->fVert[2] = triMesh->GetTriVertex(iv3); - tri->fVert[2]->fVtx = triMesh->GetVertex(iv3); - tri->fVert[2]->SetNumUvChannels(1); - tri->fVert[2]->fUvChan[0] = triMesh->GetUvs(iv3); - tri->fVert[2]->fVtxColor = triMesh->GetColor(iv3); - - tri->fVert[0]->fFlags = hsGTriVertex::kHasPointers - | hsGTriVertex::kHasVertexUvs - | hsGTriVertex::kHasVertexColors; - tri->fVert[1]->fFlags = hsGTriVertex::kHasPointers - | hsGTriVertex::kHasVertexUvs - | hsGTriVertex::kHasVertexColors; - tri->fVert[2]->fFlags = hsGTriVertex::kHasPointers - | hsGTriVertex::kHasVertexUvs - | hsGTriVertex::kHasVertexColors; - - tri->fFlags |= hsTriangle3::kHasVertexPosNorms - | hsTriangle3::kHasVertexUvs - | hsTriangle3::kHasVertexColors - | hsTriangle3::kHasPointers; - - tri = triMesh->GetTriFromPool(nextTri); - tri->Zero(); - tri->fOrigTri = tri; - triMesh->SetTriangle(nextTri++, tri); - - tri->fVert[0] = triMesh->GetTriVertex(iv0); - tri->fVert[0]->fVtx = triMesh->GetVertex(iv0); - tri->fVert[0]->SetNumUvChannels(1); - tri->fVert[0]->fUvChan[0] = triMesh->GetUvs(iv0); - tri->fVert[0]->fVtxColor = triMesh->GetColor(iv0); - - tri->fVert[1] = triMesh->GetTriVertex(iv3); - tri->fVert[1]->fVtx = triMesh->GetVertex(iv3); - tri->fVert[1]->SetNumUvChannels(1); - tri->fVert[1]->fUvChan[0] = triMesh->GetUvs(iv3); - tri->fVert[1]->fVtxColor = triMesh->GetColor(iv3); - - tri->fVert[2] = triMesh->GetTriVertex(iv1); - tri->fVert[2]->fVtx = triMesh->GetVertex(iv1); - tri->fVert[2]->SetNumUvChannels(1); - tri->fVert[2]->fUvChan[0] = triMesh->GetUvs(iv1); - tri->fVert[2]->fVtxColor = triMesh->GetColor(iv1); - - tri->fVert[0]->fFlags = hsGTriVertex::kHasPointers - | hsGTriVertex::kHasVertexUvs - | hsGTriVertex::kHasVertexColors; - tri->fVert[1]->fFlags = hsGTriVertex::kHasPointers - | hsGTriVertex::kHasVertexUvs - | hsGTriVertex::kHasVertexColors; - tri->fVert[2]->fFlags = hsGTriVertex::kHasPointers - | hsGTriVertex::kHasVertexUvs - | hsGTriVertex::kHasVertexColors; - - tri->fFlags |= hsTriangle3::kHasVertexPosNorms - | hsTriangle3::kHasVertexUvs - | hsTriangle3::kHasVertexColors - | hsTriangle3::kHasPointers; - - iv0++; - iv1++; - iv2++; - iv3++; - } - } - hsAssert(nextTri <= nTris, "Out of range on tris"); - - triMesh->StoreOrigPoints(); - - return triMesh; -} -#endif \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plGeometry/hsOscillator.h b/Sources/Plasma/PubUtilLib/plGeometry/hsOscillator.h deleted file mode 100644 index c55ff2cd..00000000 --- a/Sources/Plasma/PubUtilLib/plGeometry/hsOscillator.h +++ /dev/null @@ -1,180 +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 . - -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 hsOscillator_inc -#define hsOscillator_inc - -#include "hsPerterber.h" -#include "hsTemplates.h" - -#include "hsGeometry3.h" -#include "../plIntersect/hsBounds.h" - -class hsStream; -class plPipeline; - -class hsWave -{ -protected: - hsPoint3 fWorldCenter; - hsPoint3 fLocalCenter; - - hsScalar fWorldFrequency; // 1.0 / Period - hsScalar fLocalFrequency; - - hsScalar fWorldAmplitude; - hsScalar fLocalAmplitude; - - hsScalar fPhase; - hsScalar fRate; // how long a crest takes to reach next crest - - hsScalar fStartSecs; - hsScalar fSecsToLive; - - hsScalar fInnerRadius; - hsScalar fOuterRadius; - hsScalar fAttenuateOutScale; - - hsScalar AgeScale(hsScalar secs) const; - -public: - void Accumulate(const hsPoint3& pos, const hsVector3& localZ, hsVector3& accum, hsVector3& accumNorm) const; - hsScalar ScaledAmplitude(hsScalar secs) const; - - void Init(hsScalar secs, hsPoint3& center, hsScalar per, hsScalar amp, hsScalar rate, hsScalar life, hsBool32 attenOut=false); - - void Update(hsScalar secs, const hsMatrix44& l2w, const hsMatrix44& w2l); - hsBool32 IsSpent(hsScalar secs) const; - void Kill() { fStartSecs = fSecsToLive = 0; } - void AttenuateOut(hsBool32 on) { fAttenuateOutScale = (on ? 1.f : 0); } - hsBool32 GetAttenuateOut() { return fAttenuateOutScale > 0; } - - void Save(hsStream* s, hsScalar secs); - void Load(hsStream* s, hsScalar secs); -}; - -class hsOscillator : public hsPerterber -{ -protected: - hsTArray fWaves; - hsTArray fTempWaves; - - hsMatrix44 fLocalToWorld; - hsMatrix44 fWorldToLocal; - - hsPoint3 fWorldCenter; - hsPoint3 fLocalCenter; - - hsVector3 fWorldAttenScale; - hsVector3 fLocalAttenScale; - - hsBounds3Ext fWorldCenterBounds; - - hsScalar fMinPeriod; - hsScalar fMaxPeriod; - - hsScalar fMinAmplitude; - hsScalar fMaxAmplitude; - - hsScalar fMinRate; - hsScalar fMaxRate; - - hsScalar fMinLife; - hsScalar fMaxLife; - - hsVector3 fLocalX; - hsVector3 fLocalY; - hsVector3 fLocalZ; - - hsScalar IAttenuate(const hsPoint3& in) const; - void ISpawnWave(hsScalar secs, int i); - - virtual void IUpdate(hsScalar secs, plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l); - - virtual void IPerterb(const hsPoint3& in, hsGVertex3& out) const; -public: - hsOscillator(); - virtual ~hsOscillator(); - - virtual void AdjustWorldBounds(const hsMatrix44& l2w, const hsMatrix44& w2l, hsBounds3Ext& bnd) const; - - virtual uint32_t GetType() const { return kTypeOscillator; } - - // Don't call these, use base class LabelAndWrite() and CreateAndRead() - virtual void Read(hsStream* s); - virtual void Write(hsStream* s); - - virtual void Load(hsStream* s, hsScalar secs); - virtual void Save(hsStream* s, hsScalar secs); - - void SetPeriodRange(hsScalar lo, hsScalar hi) { fMinPeriod = lo; fMaxPeriod = hi; } - void SetAmplitudeRange(hsScalar lo, hsScalar hi) { fMinAmplitude = lo; fMaxAmplitude = hi; } - void SetRateRange(hsScalar lo, hsScalar hi) { fMinRate = lo; fMaxRate = hi; } - void SetLifeRange(hsScalar lo, hsScalar hi) { fMinLife = lo; fMaxLife = hi; } - - hsScalar GetMinPeriod() const { return fMinPeriod; } - hsScalar GetMaxPeriod() const { return fMaxPeriod; } - hsScalar GetMinAmplitude() const { return fMinAmplitude; } - hsScalar GetMaxAmplitude() const { return fMaxAmplitude; } - hsScalar GetMinRate() const { return fMinRate; } - hsScalar GetMaxRate() const { return fMaxRate; } - hsScalar GetMinLife() const { return fMinLife; } - hsScalar GetMaxLife() const { return fMaxLife; } - - void SetWorldAttenScale(const hsVector3& s) { fWorldAttenScale = s; } - void SetWorldCenterBounds(const hsBounds3Ext& bnd) { fWorldCenterBounds = bnd; } - - const hsVector3& GetWorldAttenScale() const { return fWorldAttenScale; } - const hsBounds3Ext& GetWorldCenterBounds() const { return fWorldCenterBounds; } - - void SetNumWaves(int n); - uint32_t GetNumWaves() const { return fWaves.GetCount(); } - hsWave& GetWeakestWave(hsScalar secs); - hsWave& GetTempWave(hsScalar secs); - - virtual void Init(int32_t nParams, hsScalar* params); - - static hsGTriMesh* MakeWaveMesh(int nSpokes, const hsPoint3& center, hsScalar minRad, hsScalar maxRad, hsScalar uRange, hsScalar vRange, hsScalar attenStartFrac, hsBool32 stitch); - -}; - -#endif // hsOscillator_inc diff --git a/Sources/Plasma/PubUtilLib/plGeometry/hsPerterber.cpp b/Sources/Plasma/PubUtilLib/plGeometry/hsPerterber.cpp deleted file mode 100644 index 761c8d0e..00000000 --- a/Sources/Plasma/PubUtilLib/plGeometry/hsPerterber.cpp +++ /dev/null @@ -1,350 +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 . - -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 "hsStream.h" -#include "hsPerterber.h" -#include "hsOscillator.h" -#include "hsGMesh.h" -#if 0 // GET_RID_OF_SHAPE_LAYER_DEFER -#include "hsGShape3.h" -#include "hsGShape3MegaMesh.h" -#endif// GET_RID_OF_SHAPE_LAYER_DEFER -#include "../plResMgr/plKey.h" -#include "../plSurface/hsGMaterial.h" -#include "hsTimer.h" -#include "../plPipeline/plPipeline.h" - -hsBool32 hsPerterber::fDisabled = false; - -hsPerterber::hsPerterber() -{ -} - -hsPerterber::~hsPerterber() -{ -} - -void hsPerterber::IUpdate(hsScalar secs, plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l) -{ -} - -void hsPerterber::TimeStampAndSave(hsStream* s) -{ - hsScalar secs = hsTimer::GetSeconds(); - - hsKeyedObject::Save(s, nil); - - Save(s, secs); -} - -void hsPerterber::TimeStampAndLoad(hsStream* s) -{ - hsScalar secs = hsTimer::GetSeconds(); - - hsKeyedObject::Load(s, nil); - - Load(s, secs); -} - -void hsPerterber::LabelAndWrite(hsStream* s) -{ - s->WriteSwap32(GetType()); - Write(s); -} - -hsPerterber* hsPerterber::CreateAndRead(hsStream* s) -{ - hsPerterber* retVal = nil; - - uint32_t t = s->ReadSwap32(); - switch( t ) - { - case kTypeOscillator: - retVal = new hsOscillator; - break; - default: - hsAssert(false, "Unknown perterber type"); - return nil; - } - retVal->Read(s); - - return retVal; -} - -hsGMesh* hsPerterber::IGetMesh(hsGShape3* shape) -{ - hsGMesh* mesh = nil; -#if 0 // GET_RID_OF_SHAPE_LAYER_DEFER - if( shape->GetShapeType() == hsGShape3::kTypeTriMesh ) - { - hsGShape3TriMesh* shp = (hsGShape3TriMesh*)shape; - mesh = shp->GetMesh(); - -#if 0 // move to export - if( mesh->GetKey() && strstr(mesh->GetKey()->GetName(), "create") ) - { - - hsTArray matList; - shp->AppendMaterials(matList); - - hsGTriMesh* newMesh = hsOscillator::MakeWaveMesh(40, hsPoint3(0,0,0), 4.f, 75.f, 1200.f, 1200.f, 0.75f, false); - newMesh->SetMaterial(matList[0]); - hsRefCnt_SafeUnRef(matList[0]); - - shp->SetMesh(newMesh); - hsRefCnt_SafeUnRef(newMesh); - mesh = newMesh; - } - else if( mesh->GetKey() && strstr(mesh->GetKey()->GetName(), "destroy") ) - { - - hsTArray matList; - shp->AppendMaterials(matList); - - hsGTriMesh* newMesh = hsOscillator::MakeWaveMesh(50, hsPoint3(0,0,0), 1.5f, 30.f, 600.f, 600.f, 0.6f, true); - newMesh->SetMaterial(matList[0]); - hsRefCnt_SafeUnRef(matList[0]); - - shp->SetMesh(newMesh); - hsRefCnt_SafeUnRef(newMesh); - mesh = newMesh; - } - else -#endif // move to export - { - hsGTriMesh* triMesh = (hsGTriMesh*)shp->GetMesh(); - if( triMesh->GetTriangle(0)->fFlags & hsTriangle3::kHasFacePlane ) - triMesh->TrashPlanes(); - mesh = triMesh; - } - } - else if( shape->GetShapeType() == hsGShape3::kTypeMegaMesh ) - { - hsGShape3MegaMesh* mega = (hsGShape3MegaMesh*)shape; - hsGMegaMesh* megaMesh = (hsGMegaMesh*)mega->GetMegaMesh(); - hsGTriMesh* triMesh = (hsGTriMesh*)megaMesh->GetMesh(0); - if( triMesh->GetTriangle(0)->fFlags & hsTriangle3::kHasFacePlane ) - { - int iMesh; - for( iMesh = 0; iMesh < megaMesh->GetMeshCount(); iMesh++ ) - { - triMesh = (hsGTriMesh*)megaMesh->GetMesh(iMesh); - triMesh->TrashPlanes(); - } - } - mesh = mega->GetMegaMesh(); - } -#endif // GET_RID_OF_SHAPE_LAYER_DEFER - return mesh; -} - -void hsPerterber::Perterb(hsScalar secs, plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l, hsGShape3* shape) -{ - if( GetDisabled() ) - return; - - hsGMesh* mesh = IGetMesh(shape); - - IUpdate(secs, pipe, l2w, w2l); - - if( !mesh->HasOrigPoints() ) - mesh->StoreOrigPoints(); - int i; - for( i = 0; i < mesh->GetNumPoints(); i++ ) - { - IPerterb(*mesh->GetOrigPoint(i), *mesh->GetVertex(i)); - } -} - -const int kPertCount = 6; -const int kMaxPertParams = 32; - -struct hsPertDesc -{ - - char fName[256]; - uint32_t fType; - uint32_t fNumParams; - hsScalar fParams[kMaxPertParams]; -}; - -// NumWaves = 1 -// AttenScale = 2 -// WorldCenterBounds = 6 -// Period = 2 -// Amp = 2 -// Rate = 2 -// Life = 2 -// -hsPertDesc sPertTable[kPertCount] = -{ - { - "mystocean", - hsPerterber::kTypeOscillator, - 17, - { - 5.f, - 1.f/100.f, 1.f/100.f, - -100.f, 100.f, 0, 100.f, 150.f, 0, - 2.f, 5.f, - 0.5, 0.75f, - 0.68f, 0.68f, - 5.f, 10.f - } - }, - { - "stoneocean", - hsPerterber::kTypeOscillator, - 17, - { - 5.f, - 1.f/100.f, 1.f/100.f, - -100.f, 100.f, 0, 100.f, 150.f, 0, - 2.f, 5.f, - 0.5, 0.75f, - 0.68f, 0.68f, - 5.f, 10.f - } - }, - { - "seleniticocean", - hsPerterber::kTypeOscillator, - 17, - { - 5.f, - 1.f/100.f, 1.f/100.f, - -100.f, 100.f, 0, 100.f, 150.f, 0, - 2.f, 5.f, - 0.25, 0.45f, - 0.6f, 0.6f, - 5.f, 10.f - } - }, - { - "channelocean", - hsPerterber::kTypeOscillator, - 17, - { - 5.f, - 1.f/30.f, 1.f/30.f, - -100.f, -100.f, 0, 100.f, 100.f, 0, - 0.25f, 0.5f, - 0.1, 0.2f, - 0.4f, 0.8f, - 5.f, 10.f - } - }, - { - "mechocean", - hsPerterber::kTypeOscillator, - 17, - { - 5.f, - 1.f/100.f, 1.f/100.f, - -100.f, 100.f, 0, 100.f, 150.f, 0, - 2.f, 5.f, - 0.5, 0.4f, - 0.68f, 0.68f, - 5.f, 10.f - } - }, - { - "rimeocean", - hsPerterber::kTypeOscillator, - 17, - { - 5.f, - 1.f/100.f, 1.f/100.f, - -100.f, 100.f, 0, 100.f, 150.f, 0, - 2.f, 5.f, - 0.5, 0.75, - 0.68f, 0.68f, - 5.f, 10.f - } - } -}; - - - -#if 0 // Used Registry...need to change paulg -void hsPerterber::InitSystem(hsRegistry* reg) -{ - if( GetDisabled() ) - return; - - int i; - for( i = 0; i < kPertCount; i++ ) - { - switch( sPertTable[i].fType ) - { - case kTypeOscillator: - { - hsOscillator* oscar = new hsOscillator; - oscar->Init(sPertTable[i].fNumParams, sPertTable[i].fParams); - -#ifdef PAULFIX - oscar->Register(reg, sPertTable[i].fName, 0, true); -#endif - } - break; - default: - hsAssert(false, "Unknown perterber type"); - break; - } - } -} - -void hsPerterber::Shutdown(hsRegistry* reg) -{ -#ifdef PAULFIX - int i; - - for( i = 0; i < reg->GetNumKeys(); i++ ) - { - hsPerterber* pert = (hsPerterber*)(reg->GetKey(i)->GetObjectPtr()); - delete pert; - } -#endif -} - -#endif \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plGeometry/hsPerterber.h b/Sources/Plasma/PubUtilLib/plGeometry/hsPerterber.h deleted file mode 100644 index 0f0fee13..00000000 --- a/Sources/Plasma/PubUtilLib/plGeometry/hsPerterber.h +++ /dev/null @@ -1,107 +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 . - -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 hsPerterber_inc -#define hsPerterber_inc - -#include "../plResMgr/hsKeyedObject.h" -#include "hsGeometry3.h" - -class hsStream; -class hsGShape3; -class hsBounds3Ext; -class hsGMesh; -class plPipeline; -struct hsMatrix44; -struct hsGVertex3; - -class hsPerterber : public hsKeyedObject -{ -public: - enum { - kTypeUndefined = 0x0, - kTypeOscillator = 0x1 - }; -protected: - static hsBool32 fDisabled; - - virtual void IUpdate(hsScalar secs, plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l); - - virtual void IPerterb(const hsPoint3& in, hsGVertex3& out) const = 0; - - hsGMesh* IGetMesh(hsGShape3* shape); -public: - hsPerterber(); - virtual ~hsPerterber(); - - static void SetDisabled(hsBool32 on) { fDisabled = on; } - static void ToggleDisabled() { fDisabled = !fDisabled; } - static hsBool32 GetDisabled() { return fDisabled; } - - virtual void Perterb(hsScalar secs, plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l, hsGShape3* shape); - - virtual void AdjustWorldBounds(const hsMatrix44& l2w, const hsMatrix44& w2l, hsBounds3Ext& bnd) const = 0; - - virtual uint32_t GetType() const = 0; - - virtual void Write(hsStream* s) = 0; - virtual void Read(hsStream* s) = 0; - - virtual void Save(hsStream* s, hsScalar secs) = 0; - virtual void Load(hsStream* s, hsScalar secs) = 0; - - void TimeStampAndSave(hsStream* s); - void TimeStampAndLoad(hsStream* s); - - void LabelAndWrite(hsStream* s); - static hsPerterber* CreateAndRead(hsStream* s); - - virtual void Init(int32_t nParams, hsScalar* params) = 0; - -#if 0 // Used Registry...need to change paulg - static void InitSystem(plResMgr* reg); - - static void Shutdown(plResMgr* reg); -#endif -}; - -#endif hsPerterber_inc diff --git a/Sources/Plasma/PubUtilLib/plGeometry/plGeometryCreatable.h b/Sources/Plasma/PubUtilLib/plGeometry/plGeometryCreatable.h deleted file mode 100644 index 912253e4..00000000 --- a/Sources/Plasma/PubUtilLib/plGeometry/plGeometryCreatable.h +++ /dev/null @@ -1,70 +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 . - -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 plGeometryCreatable_inc -#define plGeometryCreatable_inc - -#include "../pnFactory/plCreator.h" - -/* Taken out 6.12.2001 mcn - You can remove this file entirely if you wish, I just left - it in in case we wanted to use it in the future... - -#include "hsGVertexPool.h" - -REGISTER_CREATABLE( hsGVertexPool ); - - -#include "hsGMesh.h" - -REGISTER_NONCREATABLE( hsGMesh ); - -#include "hsGTriMesh.h" - -REGISTER_CREATABLE( hsGTriMesh ); - - -#include "hsGMegaMesh.h" - -REGISTER_CREATABLE( hsGMegaMesh ); -*/ - -#endif plGeometryCreatable_inc diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plNetGameLib/CMakeLists.txt index 12c5cee4..6efb90e0 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/CMakeLists.txt @@ -9,8 +9,6 @@ set(plNetGameLib_PRIVATE Private/plNglAuth.cpp Private/plNglCore.h Private/plNglCore.cpp - Private/plNglCsr.h - Private/plNglCsr.cpp Private/plNglFile.h Private/plNglFile.cpp Private/plNglGame.h diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Intern.h b/Sources/Plasma/PubUtilLib/plNetGameLib/Intern.h index 11e43355..42f3c8e3 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Intern.h +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Intern.h @@ -118,19 +118,6 @@ bool FileQueryConnected (); unsigned FileGetConnId (); -/***************************************************************************** -* -* Csr -* -***/ - -void CsrInitialize (); -void CsrDestroy (bool wait); - -bool CsrQueryConnected (); -unsigned CsrGetConnId (); - - /***************************************************************************** * * GateKeeper @@ -208,11 +195,6 @@ enum ETransType { kDownloadRequestTrans, kFileRcvdFileDownloadChunkTrans, - //======================================================================== - // NglCsr.cpp transactions - kCsrConnectedNotifyTrans, - kCsrLoginTrans, - //======================================================================== // NglCore.cpp transactions kReportNetErrorTrans, @@ -280,10 +262,6 @@ static const char * s_transTypes[] = { "ManifestRequestTrans", "DownloadRequestTrans", "FileRcvdFileDownloadChunkTrans", - - // NglCsr.cpp - "CsrConnectedNotifyTrans", - "CsrLoginTrans", // NglCore.cpp "ReportNetErrorTrans", @@ -300,7 +278,6 @@ static long s_perfTransCount[kNumTransTypes]; namespace Auth { struct CliAuConn; } namespace Game { struct CliGmConn; } -namespace Csr { struct CliCsConn; } namespace File { struct CliFileConn; } namespace GateKeeper { struct CliGkConn; } @@ -364,17 +341,6 @@ struct NetFileTrans : NetTrans { void ReleaseConn (); }; -struct NetCsrTrans : NetTrans { - Csr::CliCsConn * m_conn; - - NetCsrTrans (ETransType transType); - ~NetCsrTrans (); - - bool AcquireConn (); - void ReleaseConn (); -}; - - struct NetGateKeeperTrans : NetTrans { GateKeeper::CliGkConn * m_conn; diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAllIncludes.h b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAllIncludes.h index efc92d13..ba8a2768 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAllIncludes.h +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAllIncludes.h @@ -58,5 +58,4 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plNglAuth.h" #include "plNglGame.h" #include "plNglFile.h" -#include "plNglCsr.h" #include "plNglGateKeeper.h" diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCore.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCore.cpp index 0e294e77..8890b699 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCore.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCore.cpp @@ -148,7 +148,6 @@ void NetClientInitialize () { AuthInitialize(); GameInitialize(); FileInitialize(); - CsrInitialize(); GateKeeperInitialize(); } } @@ -165,14 +164,12 @@ void NetClientDestroy (bool wait) { s_errorProc = nil; GateKeeperDestroy(false); - CsrDestroy(false); FileDestroy(false); GameDestroy(false); AuthDestroy(false); NetTransDestroy(false); if (wait) { GateKeeperDestroy(true); - CsrDestroy(true); FileDestroy(true); GameDestroy(true); AuthDestroy(true); diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.cpp deleted file mode 100644 index e3ed719b..00000000 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.cpp +++ /dev/null @@ -1,900 +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 . - -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==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.cpp -* -***/ - -#include "../Pch.h" -#pragma hdrstop - -#include "pnEncryption/plChallengeHash.h" - - -namespace Ngl { namespace Csr { -/***************************************************************************** -* -* Internal types -* -***/ - -struct ConnectParam { - FNetCliCsrConnectedCallback callback; - void * param; -}; - -//============================================================================ -// Connection record -//============================================================================ -struct CliCsConn : AtomicRef { - LINK(CliCsConn) link; - - CCritSect critsect; - AsyncSocket sock; - AsyncCancelId cancelId; - NetCli * cli; - plNetAddress addr; - unsigned seq; - bool abandoned; - unsigned serverChallenge; - unsigned latestBuildId; - ConnectParam * connectParam; - - // ping - AsyncTimer * pingTimer; - unsigned pingSendTimeMs; - unsigned lastHeardTimeMs; - - CliCsConn (); - ~CliCsConn (); - - void AutoPing (); - void StopAutoPing (); - void TimerPing (); - - void Send (const uintptr_t fields[], unsigned count); -}; - - -//============================================================================ -// Transaction objects -//============================================================================ -struct ConnectedNotifyTrans : NetNotifyTrans { - - ConnectParam * m_connectParam; - unsigned m_latestBuildId; - - ConnectedNotifyTrans (ConnectParam * cp, unsigned lbi) - : NetNotifyTrans(kCsrConnectedNotifyTrans) - , m_connectParam(cp) - , m_latestBuildId(lbi) - { } - ~ConnectedNotifyTrans () { - delete m_connectParam; - } - void Post (); -}; - -struct LoginRequestTrans : NetCsrTrans { - - wchar_t m_csrName[kMaxAccountNameLength]; - ShaDigest m_namePassHash; - FNetCliCsrLoginCallback m_callback; - void * m_param; - - Uuid m_csrId; - unsigned m_csrFlags; - - LoginRequestTrans ( - const wchar_t csrName[], - const ShaDigest & namePassHash, - FNetCliCsrLoginCallback callback, - void * param - ); - - bool Send (); - void Post (); - bool Recv ( - const uint8_t msg[], - unsigned bytes - ); -}; - - -/***************************************************************************** -* -* Internal data -* -***/ - -enum { - kPerfConnCount, - kPingDisabled, - kNumPerf -}; - -static bool s_running; -static CCritSect s_critsect; -static LISTDECL(CliCsConn, link) s_conns; -static CliCsConn * s_active; -static long s_perf[kNumPerf]; - - -/***************************************************************************** -* -* Internal functions -* -***/ - -//=========================================================================== -static unsigned GetNonZeroTimeMs () { - if (unsigned ms = TimeGetMs()) - return ms; - return 1; -} - -//============================================================================ -static CliCsConn * GetConnIncRef_CS (const char tag[]) { - - if (CliCsConn * conn = s_active) - if (conn->cli) { - conn->IncRef(tag); - return conn; - } - return nil; -} - -//============================================================================ -static CliCsConn * GetConnIncRef (const char tag[]) { - CliCsConn * conn; - s_critsect.Enter(); - { - conn = GetConnIncRef_CS(tag); - } - s_critsect.Leave(); - return conn; -} - -//============================================================================ -static void UnlinkAndAbandonConn_CS (CliCsConn * conn) { - - s_conns.Unlink(conn); - conn->abandoned = true; - if (conn->cancelId) { - AsyncSocketConnectCancel(nil, conn->cancelId); - conn->cancelId = 0; - } - else if (conn->sock) { - AsyncSocketDisconnect(conn->sock, true); - } - else { - conn->DecRef("Lifetime"); - } -} - -//============================================================================ -static void SendRegisterRequest (CliCsConn * conn) { - - const uintptr_t msg[] = { - kCli2Csr_RegisterRequest, - 0 - }; - - conn->Send(msg, arrsize(msg)); -} - -//============================================================================ -static bool ConnEncrypt (ENetError error, void * param) { - - CliCsConn * conn = (CliCsConn *) param; - - if (IS_NET_SUCCESS(error)) { - s_critsect.Enter(); - { - s_active = conn; - conn->AutoPing(); - conn->IncRef(); - } - s_critsect.Leave(); - - SendRegisterRequest(conn); - - conn->DecRef(); - } - - return IS_NET_SUCCESS(error); -} - -//============================================================================ -static void NotifyConnSocketConnect (CliCsConn * conn) { - - conn->cli = NetCliConnectAccept( - conn->sock, - kNetProtocolCli2Csr, - false, - ConnEncrypt, - 0, - nil, - conn - ); -} - -//============================================================================ -static void NotifyConnSocketConnectFailed (CliCsConn * conn) { - - bool notify; - s_critsect.Enter(); - { - conn->cancelId = 0; - s_conns.Unlink(conn); - - notify - = s_running - && !conn->abandoned - && (!s_active || conn == s_active); - - if (conn == s_active) - s_active = nil; - } - s_critsect.Leave(); - - NetTransCancelByConnId(conn->seq, kNetErrTimeout); - conn->DecRef("Connecting"); - conn->DecRef("Lifetime"); - - if (notify) - ReportNetError(kNetProtocolCli2Csr, kNetErrConnectFailed); -} - -//============================================================================ -static void NotifyConnSocketDisconnect (CliCsConn * conn) { - - conn->StopAutoPing(); - - bool notify; - s_critsect.Enter(); - { - s_conns.Unlink(conn); - - notify - = s_running - && !conn->abandoned - && (!s_active || conn == s_active); - - if (conn == s_active) - s_active = nil; - } - s_critsect.Leave(); - - // Cancel all transactions in process on this connection. - NetTransCancelByConnId(conn->seq, kNetErrTimeout); - conn->DecRef("Connected"); - conn->DecRef("Lifetime"); - - if (notify) - ReportNetError(kNetProtocolCli2Csr, kNetErrDisconnected); -} - -//============================================================================ -static bool NotifyConnSocketRead (CliCsConn * conn, AsyncNotifySocketRead * read) { - - conn->lastHeardTimeMs = GetNonZeroTimeMs(); - bool result = NetCliDispatch(conn->cli, read->buffer, read->bytes, conn); - read->bytesProcessed += read->bytes; - return result; -} - -//============================================================================ -static bool SocketNotifyCallback ( - AsyncSocket sock, - EAsyncNotifySocket code, - AsyncNotifySocket * notify, - void ** userState -) { - bool result = true; - CliCsConn * conn; - - switch (code) { - case kNotifySocketConnectSuccess: { - conn = (CliCsConn *) notify->param; - *userState = conn; - conn->TransferRef("Connecting", "Connected"); - bool abandoned = true; - - if (abandoned) - AsyncSocketDisconnect(sock, true); - else - NotifyConnSocketConnect(conn); - } - break; - - case kNotifySocketConnectFailed: - conn = (CliCsConn *) notify->param; - NotifyConnSocketConnectFailed(conn); - break; - - case kNotifySocketDisconnect: - conn = (CliCsConn *) *userState; - NotifyConnSocketDisconnect(conn); - break; - - case kNotifySocketRead: - conn = (CliCsConn *) *userState; - result = NotifyConnSocketRead(conn, (AsyncNotifySocketRead *) notify); - break; - } - - return result; -} - -//============================================================================ -static void Connect ( - const plNetAddress& addr, - ConnectParam * cp -) { - CliCsConn * conn = NEWZERO(CliCsConn); - conn->addr = addr; - conn->seq = ConnNextSequence(); - conn->lastHeardTimeMs = GetNonZeroTimeMs(); - conn->connectParam = cp; - - conn->IncRef("Lifetime"); - conn->IncRef("Connecting"); - - s_critsect.Enter(); - { - while (CliCsConn * conn = s_conns.Head()) - UnlinkAndAbandonConn_CS(conn); - s_conns.Link(conn); - } - s_critsect.Leave(); - - Cli2Csr_Connect connect; - connect.hdr.connType = kConnTypeCliToCsr; - connect.hdr.hdrBytes = sizeof(connect.hdr); - connect.hdr.buildId = BuildId(); - connect.hdr.buildType = BUILD_TYPE_LIVE; - connect.hdr.branchId = BranchId(); - connect.hdr.productId = ProductId(); - connect.data.dataBytes = sizeof(connect.data); - - AsyncSocketConnect( - &conn->cancelId, - addr, - SocketNotifyCallback, - conn, - &connect, - sizeof(connect), - 0, - 0 - ); -} - -//============================================================================ -static void AsyncLookupCallback ( - void * param, - const char name[], - unsigned addrCount, - const plNetAddress addrs[] -) { - if (!addrCount) { - ReportNetError(kNetProtocolCli2Auth, kNetErrNameLookupFailed); - return; - } - - // Only connect to one server - addrCount = MIN(addrCount, 1); - - for (unsigned i = 0; i < addrCount; ++i) { - Connect(addrs[i], (ConnectParam *)param); - } -} - - -/***************************************************************************** -* -* Message handlers -* -***/ - -//============================================================================ -static bool Recv_PingReply ( - const uint8_t msg[], - unsigned bytes, - void * -) { - const Csr2Cli_PingReply & reply = *(const Csr2Cli_PingReply *)msg; - - NetTransRecv(reply.transId, msg, bytes); - - return true; -} - -//============================================================================ -static bool Recv_RegisterReply ( - const uint8_t msg[], - unsigned , - void * param -) { - CliCsConn * conn = (CliCsConn *)param; - - const Csr2Cli_RegisterReply & reply = *(const Csr2Cli_RegisterReply *)msg; - - conn->serverChallenge = reply.serverChallenge; - conn->latestBuildId = reply.csrBuildId; - - ConnectedNotifyTrans * trans = new ConnectedNotifyTrans( - conn->connectParam, - conn->latestBuildId - ); - NetTransSend(trans); - - conn->connectParam = nil; - - return true; -} - -//============================================================================ -static bool Recv_LoginReply ( - const uint8_t msg[], - unsigned bytes, - void * -) { - const Csr2Cli_LoginReply & reply = *(const Csr2Cli_LoginReply *)msg; - - NetTransRecv(reply.transId, msg, bytes); - - return true; -} - - -/***************************************************************************** -* -* Protocol -* -***/ - -#define MSG(s) kNetMsg_Cli2Csr_##s -static NetMsgInitSend s_send[] = { - { MSG(PingRequest) }, - { MSG(RegisterRequest) }, - { MSG(LoginRequest) }, -}; -#undef MSG - -#define MSG(s) kNetMsg_Csr2Cli_##s, Recv_##s -static NetMsgInitRecv s_recv[] = { - { MSG(PingReply) }, - { MSG(RegisterReply) }, - { MSG(LoginReply) }, -}; -#undef MSG - - -/***************************************************************************** -* -* CliCsConn -* -***/ - -//=========================================================================== -static unsigned CliCsConnTimerDestroyed (void * param) { - - CliCsConn * conn = (CliCsConn *) param; - conn->DecRef("PingTimer"); - return kAsyncTimeInfinite; -} - -//=========================================================================== -static unsigned CliCsConnPingTimerProc (void * param) { - - ((CliCsConn *) param)->TimerPing(); - return kPingIntervalMs; -} - -//============================================================================ -CliCsConn::CliCsConn () { - - AtomicAdd(&s_perf[kPerfConnCount], 1); -} - -//============================================================================ -CliCsConn::~CliCsConn () { - - // Delete 'cli' after all refs have been removed - if (cli) - NetCliDelete(cli, true); - - delete connectParam; - - AtomicAdd(&s_perf[kPerfConnCount], -1); -} - -//============================================================================ -void CliCsConn::AutoPing () { - ASSERT(!pingTimer); - - IncRef("PingTimer"); - critsect.Enter(); - { - AsyncTimerCreate( - &pingTimer, - CliCsConnPingTimerProc, - sock ? 0 : kAsyncTimeInfinite, - this - ); - } - critsect.Leave(); -} - -//============================================================================ -void CliCsConn::StopAutoPing () { - critsect.Enter(); - { - if (AsyncTimer * timer = pingTimer) { - pingTimer = nil; - AsyncTimerDeleteCallback(timer, CliCsConnTimerDestroyed); - } - } - critsect.Leave(); -} - -//============================================================================ -void CliCsConn::TimerPing () { - - // Send a ping request - pingSendTimeMs = GetNonZeroTimeMs(); - - const uintptr_t msg[] = { - kCli2Auth_PingRequest, - 0, // not a transaction - pingSendTimeMs, - 0, // no payload - nil - }; - - Send(msg, arrsize(msg)); -} - -//============================================================================ -void CliCsConn::Send (const uintptr_t fields[], unsigned count) { - - critsect.Enter(); - { - NetCliSend(cli, fields, count); - NetCliFlush(cli); - } - critsect.Leave(); -} - - -/***************************************************************************** -* -* ConnectedNotifyTrans -* -***/ - -//============================================================================ -void ConnectedNotifyTrans::Post () { - - if (m_connectParam && m_connectParam->callback) - m_connectParam->callback(m_connectParam->param, m_latestBuildId); -} - - -/***************************************************************************** -* -* LoginRequestTrans -* -***/ - -//============================================================================ -LoginRequestTrans::LoginRequestTrans ( - const wchar_t csrName[], - const ShaDigest & namePassHash, - FNetCliCsrLoginCallback callback, - void * param -) : NetCsrTrans(kCsrLoginTrans) -, m_callback(callback) -, m_param(param) -{ - ASSERT(callback); - memcpy(m_namePassHash, namePassHash, sizeof(ShaDigest)); - StrCopy(m_csrName, csrName, arrsize(m_csrName)); -} - -//============================================================================ -bool LoginRequestTrans::Send () { - - if (!AcquireConn()) - return false; - - ShaDigest challengeHash; - uint32_t clientChallenge = 0; - - CryptCreateRandomSeed( - sizeof(clientChallenge), - (uint8_t *) &clientChallenge - ); - - CryptHashPasswordChallenge( - clientChallenge, - s_active->serverChallenge, - m_namePassHash, - challengeHash - ); - - const uintptr_t msg[] = { - kCli2Csr_LoginRequest, - m_transId, - clientChallenge, - (uintptr_t) m_csrName, - (uintptr_t) &challengeHash - }; - - m_conn->Send(msg, arrsize(msg)); - - return true; -} - -//============================================================================ -void LoginRequestTrans::Post () { - m_callback( - m_result, - m_param, - m_csrId, - m_csrFlags - ); -} - -//============================================================================ -bool LoginRequestTrans::Recv ( - const uint8_t msg[], - unsigned bytes -) { - const Csr2Cli_LoginReply & reply = *(const Csr2Cli_LoginReply *) msg; - - m_result = reply.result; - m_csrId = reply.csrId; - m_csrFlags = reply.csrFlags; - - m_state = kTransStateComplete; - - return true; -} - - -} using namespace Csr; - - -/***************************************************************************** -* -* NetCsrTrans -* -***/ - -//============================================================================ -NetCsrTrans::NetCsrTrans (ETransType transType) -: NetTrans(kNetProtocolCli2Csr, transType) -, m_conn(nil) -{ -} - -//============================================================================ -NetCsrTrans::~NetCsrTrans () { - ReleaseConn(); -} - -//============================================================================ -bool NetCsrTrans::AcquireConn () { - if (!m_conn) - m_conn = GetConnIncRef("AcquireConn"); - return m_conn != nil; -} - -//============================================================================ -void NetCsrTrans::ReleaseConn () { - if (m_conn) { - m_conn->DecRef("AcquireConn"); - m_conn = nil; - } -} - - -/***************************************************************************** -* -* Module functions -* -***/ - -//============================================================================ -void CsrInitialize () { - - s_running = true; - - NetMsgProtocolRegister( - kNetProtocolCli2Csr, - false, - s_send, arrsize(s_send), - s_recv, arrsize(s_recv), - kCsrDhGValue, - plBigNum(sizeof(kCsrDhXData), kCsrDhXData), - plBigNum(sizeof(kCsrDhNData), kCsrDhNData) - ); -} - -//============================================================================ -void CsrDestroy (bool wait) { - - s_running = false; - - NetTransCancelByProtocol( - kNetProtocolCli2Csr, - kNetErrRemoteShutdown - ); - NetMsgProtocolDestroy( - kNetProtocolCli2Csr, - false - ); - - s_critsect.Enter(); - { - while (CliCsConn * conn = s_conns.Head()) - UnlinkAndAbandonConn_CS(conn); - s_active = nil; - } - s_critsect.Leave(); - - if (!wait) - return; - - while (s_perf[kPerfConnCount]) { - NetTransUpdate(); - AsyncSleep(10); - } -} - -//============================================================================ -bool CsrQueryConnected () { - - bool result; - s_critsect.Enter(); - { - if (nil != (result = s_active)) - result &= (nil != s_active->cli); - } - s_critsect.Leave(); - return result; -} - -//============================================================================ -unsigned CsrGetConnId () { - - unsigned connId; - s_critsect.Enter(); - { - connId = (s_active) ? s_active->seq : 0; - } - s_critsect.Leave(); - return connId; -} - -} using namespace Ngl; - - -/***************************************************************************** -* -* Exports -* -***/ - -//============================================================================ -void NetCliCsrStartConnect ( - const char* addrList[], - uint32_t addrCount, - FNetCliCsrConnectedCallback callback, - void * param -) { - // Only connect to one server - addrCount = min(addrCount, 1); - - for (unsigned i = 0; i < addrCount; ++i) { - // Do we need to lookup the address? - const char* name = addrList[i]; - while (unsigned ch = *name) { - ++name; - if (!(isdigit(ch) || ch == L'.' || ch == L':')) { - ConnectParam * cp = new ConnectParam; - cp->callback = callback; - cp->param = param; - - AsyncCancelId cancelId; - AsyncAddressLookupName( - &cancelId, - AsyncLookupCallback, - addrList[i], - kNetDefaultClientPort, - cp - ); - break; - } - } - if (!name[0]) { - plNetAddress addr(addrList[i], kNetDefaultClientPort); - - ConnectParam * cp = new ConnectParam; - cp->callback = callback; - cp->param = param; - - Connect(addr, cp); - } - } -} - -//============================================================================ -void NetCliCsrDisconnect () { - - s_critsect.Enter(); - { - while (CliCsConn * conn = s_conns.Head()) - UnlinkAndAbandonConn_CS(conn); - s_active = nil; - } - s_critsect.Leave(); -} - -//============================================================================ -void NetCliCsrLoginRequest ( - const wchar_t csrName[], - const ShaDigest & namePassHash, - FNetCliCsrLoginCallback callback, - void * param -) { - LoginRequestTrans * trans = new LoginRequestTrans( - csrName, - namePassHash, - callback, - param - ); - NetTransSend(trans); -} diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.h b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.h deleted file mode 100644 index 2b4ab2c5..00000000 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.h +++ /dev/null @@ -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 . - -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==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.h -* -***/ - -#ifdef PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLCSR_H -#error "Header $/Plasma20/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.h included more than once" -#endif -#define PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLCSR_H - - -/***************************************************************************** -* -* Client-side CSR functions -* -***/ - -typedef void (*FNetCliCsrConnectedCallback) ( - void * param, - unsigned latestBuildId -); -void NetCliCsrStartConnect ( - const char* addrList[], - uint32_t addrCount, - FNetCliCsrConnectedCallback callback = nil, - void * param = nil -); -void NetCliCsrDisconnect (); - -typedef void (*FNetCliCsrLoginCallback)( - ENetError result, - void * param, - const Uuid & csrId, - unsigned csrFlags -); -void NetCliCsrLoginRequest ( - const wchar_t csrName[], - const ShaDigest & namePassHash, - FNetCliCsrLoginCallback callback, - void * param -); - -typedef void (*FNetCliCsrSetTicketFilterCallback)( - ENetError result, - void * param -); -void NetCliCsrSetTicketFilter ( - const wchar_t filterSpec[], - FNetCliCsrSetTicketFilterCallback callback, - void * param -); - diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglMisc.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglMisc.cpp index 035ee986..d0aa8d51 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglMisc.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglMisc.cpp @@ -79,7 +79,6 @@ unsigned ConnGetId (ENetProtocol protocol) { case kNetProtocolCli2Auth: return AuthGetConnId(); case kNetProtocolCli2Game: return GameGetConnId(); case kNetProtocolCli2File: return FileGetConnId(); - case kNetProtocolCli2Csr: return CsrGetConnId(); case kNetProtocolCli2GateKeeper: return GateKeeperGetConnId(); DEFAULT_FATAL(protocol); } diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglTrans.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglTrans.cpp index eb3bfea1..cd953251 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglTrans.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglTrans.cpp @@ -144,7 +144,6 @@ bool NetTrans::CanStart () const { case kNetProtocolCli2Auth: return AuthQueryConnected(); case kNetProtocolCli2Game: return GameQueryConnected(); case kNetProtocolCli2File: return FileQueryConnected(); - case kNetProtocolCli2Csr: return CsrQueryConnected(); case kNetProtocolCli2GateKeeper: return GateKeeperQueryConnected(); DEFAULT_FATAL(m_protocol); } diff --git a/Sources/Plasma/PythonLib/Cypython/PC/placeholder.txt b/Sources/Plasma/PythonLib/Cypython/PC/placeholder.txt deleted file mode 100644 index 87c03db2..00000000 --- a/Sources/Plasma/PythonLib/Cypython/PC/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -What do you see? An empty folder. \ No newline at end of file diff --git a/Sources/Plasma/PythonLib/Cypython/placeholder.txt b/Sources/Plasma/PythonLib/Cypython/placeholder.txt deleted file mode 100644 index 87c03db2..00000000 --- a/Sources/Plasma/PythonLib/Cypython/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -What do you see? An empty folder. \ No newline at end of file diff --git a/Sources/Plasma/PythonLib/pyNetClientComm/PythonLib/placeholder.txt b/Sources/Plasma/PythonLib/pyNetClientComm/PythonLib/placeholder.txt deleted file mode 100644 index 87c03db2..00000000 --- a/Sources/Plasma/PythonLib/pyNetClientComm/PythonLib/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -What do you see? An empty folder. \ No newline at end of file diff --git a/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.cpp b/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.cpp deleted file mode 100644 index 92b6970d..00000000 --- a/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.cpp +++ /dev/null @@ -1,332 +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 . - -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 "pyNetClientComm.h" -#include "../pfPython/pyAgeLinkStruct.h" -#include "../pfPython/pyNetServerSessionInfo.h" -#include "../pfPython/pyStatusLog.h" -#include "../plNetCommon/plCreatePlayerFlags.h" -#include "../pnNetCommon/plGenericVar.h" -#include "hsStlUtils.h" -#include "hsTimer.h" - -#include - -//////////////////////////////////////////////////////////////////// - -class pyNetClientCommCallback : public plNetClientComm::Callback -{ -public: - PyObject * fPyObject; - pyNetClientCommCallback( PyObject * pyObject ) - : fPyObject( pyObject ) - { - Py_XINCREF( fPyObject ); - } - ~pyNetClientCommCallback() - { - Py_XDECREF( fPyObject ); - } - void OperationStarted( uint32_t context ) - { - if ( fPyObject ) - { - // Call the callback. - PyObject* func = PyObject_GetAttrString( fPyObject, "operationStarted" ); - if ( func ) - { - if ( PyCallable_Check(func)>0 ) - { - PyObject* retVal = PyObject_CallMethod(fPyObject, "operationStarted", "l", context); - Py_XDECREF(retVal); - } - } - } - } - void OperationComplete( uint32_t context, int resultCode ) - { - if ( fPyObject ) - { - // Pass args. - PyObject* pyArgs = PyObject_GetAttrString( fPyObject, "fCbArgs" ); - if ( pyArgs ) - { - PyObject* pyDict = PyDict_New(); - std::map args; - fCbArgs.GetItems( args ); - for ( std::map::iterator ii=args.begin(); ii!=args.end(); ++ii ) - { - uint16_t key = ii->first; - PyObject* keyObj = PyInt_FromLong(key); - char* strTemp = NULL; - plCreatable* arg = ii->second; - plCreatableGenericValue * genValue = plCreatableGenericValue::ConvertNoRef( arg ); - if ( genValue ) - { - PyObject* valueObj; - plGenericType & value = genValue->Value(); - switch ( value.GetType() ) - { - case plGenericType::kInt: - valueObj = PyLong_FromLong((int32_t)value); - PyDict_SetItem(pyDict, keyObj, valueObj); - Py_DECREF(valueObj); - break; - case plGenericType::kUInt: - valueObj = PyLong_FromUnsignedLong((uint32_t)value); - PyDict_SetItem(pyDict, keyObj, valueObj); - Py_DECREF(valueObj); - break; - case plGenericType::kFloat: - valueObj = PyFloat_FromDouble((float)value); - PyDict_SetItem(pyDict, keyObj, valueObj); - Py_DECREF(valueObj); - break; - case plGenericType::kDouble: - valueObj = PyFloat_FromDouble((double)value); - PyDict_SetItem(pyDict, keyObj, valueObj); - Py_DECREF(valueObj); - break; - case plGenericType::kBool: - if ((bool)value) - valueObj = PyInt_FromLong(1); - else - valueObj = PyInt_FromLong(0); - PyDict_SetItem(pyDict, keyObj, valueObj); - Py_DECREF(valueObj); - break; - case plGenericType::kChar: - strTemp = new char[2]; - strTemp[0] = (char)value; - strTemp[1] = 0; - valueObj = PyString_FromString(strTemp); - PyDict_SetItem(pyDict, keyObj, valueObj); - Py_DECREF(valueObj); - delete [] strTemp; - break; - case plGenericType::kString: - valueObj = PyString_FromString((const char*)value); - PyDict_SetItem(pyDict, keyObj, valueObj); - Py_DECREF(valueObj); - break; - case plGenericType::kAny: - break; - case plGenericType::kNone: - break; - } - } - plNetServerSessionInfo * serverInfo = plNetServerSessionInfo::ConvertNoRef( arg ); - if ( serverInfo ) - { - PyObject* valueObj = pyNetServerSessionInfo::New(*serverInfo); - PyDict_SetItem(pyDict, keyObj, valueObj); - Py_DECREF(valueObj); - } - Py_DECREF(keyObj); - } - PyObject_SetAttrString( fPyObject, "fCbArgs", pyDict ); - Py_DECREF(pyDict); - } - - // Call the callback. - PyObject* func = PyObject_GetAttrString( fPyObject, "operationComplete" ); - if ( func ) - { - if ( PyCallable_Check(func)>0 ) - { - PyObject* retVal = PyObject_CallMethod(fPyObject, "operationComplete", "li", context, resultCode); - Py_XDECREF(retVal); - } - } - } - delete this; - } -}; - -//////////////////////////////////////////////////////////////////// - -// Error handler - throws exception in python script -class pyNetClientCommErrorHandler : public plNetClientComm::ErrorHandler -{ -public: - void HandleError( Error err, int result ) - { - std::string msg; - xtl::format( msg, "pyNetClientComm: Error: %s", plNetClientComm::ErrorHandler::ErrorStr( err ) ); - PyErr_SetString(PyExc_KeyError, msg.c_str()); - } -} ThePyNetClientCommErrorHandler; - -//////////////////////////////////////////////////////////////////// - -// pyNetClientComm ---------------------------------------------- -pyNetClientComm::pyNetClientComm() -{ - fNetClient.SetErrorHandler( &ThePyNetClientCommErrorHandler ); -} - -// ~pyNetClientComm ---------------------------------------------- -pyNetClientComm::~pyNetClientComm() -{ -} - -// NetAuthenticate ---------------------------------------------- -int pyNetClientComm::NetAuthenticate( double maxAuthSecs, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) -{ - return fNetClient.NetAuthenticate( maxAuthSecs, new pyNetClientCommCallback( cbClass ), cbContext ); -} - -// NetLeave ---------------------------------------------- -int pyNetClientComm::NetLeave( uint8_t reason, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) -{ - return fNetClient.NetLeave( reason, new pyNetClientCommCallback( cbClass ), cbContext ); -} - -// NetPing ---------------------------------------------- -int pyNetClientComm::NetPing( int serverType, int timeoutSecs/*=0*/, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) -{ - return fNetClient.NetPing( serverType, timeoutSecs, new pyNetClientCommCallback( cbClass ), cbContext ); -} - -// NetFindAge ---------------------------------------------- -int pyNetClientComm::NetFindAge( const pyAgeLinkStruct* linkInfo, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) -{ - return fNetClient.NetFindAge( linkInfo->GetAgeLink(), new pyNetClientCommCallback( cbClass ), cbContext ); -} - -// NetGetPlayerList ---------------------------------------------- -int pyNetClientComm::NetGetPlayerList( PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) -{ - return fNetClient.NetGetPlayerList( new pyNetClientCommCallback( cbClass ), cbContext ); -} - -// NetSetActivePlayer ---------------------------------------------- -int pyNetClientComm::NetSetActivePlayer( uint32_t playerID, const char* playerName, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) -{ - return fNetClient.NetSetActivePlayer( playerID, playerName, 0 /*ccrLevel*/, new pyNetClientCommCallback( cbClass ), cbContext ); -} - -// NetCreatePlayer ---------------------------------------------- -int pyNetClientComm::NetCreatePlayer( const char* playerName, const char* avatarShape, uint32_t createFlags, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) -{ - return fNetClient.NetCreatePlayer( playerName, avatarShape, createFlags, nil, nil, nil, new pyNetClientCommCallback( cbClass ), cbContext ); -} - -// NetJoinAge ---------------------------------------------- -int pyNetClientComm::NetJoinAge( PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) -{ - return fNetClient.NetJoinAge( true /*tryP2P*/, true /*allowTimeout*/, new pyNetClientCommCallback( cbClass ), cbContext ); -} - -// NetSetTimeout ---------------------------------------------- -int pyNetClientComm::NetSetTimeout( float timeoutSecs, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) -{ - return fNetClient.NetSetTimeout( timeoutSecs, new pyNetClientCommCallback( cbClass ), cbContext ); -} - -// SetLogLevel ---------------------------------------------- -void pyNetClientComm::SetLogLevel( int logLevel ) -{ - fNetClient.SetLogLevel( logLevel ); -} - -// Startup ---------------------------------------------- -int pyNetClientComm::Init( bool threaded/*=true */, int logLevel/*=0 */) -{ - return fNetClient.Init( threaded, logLevel ); -} - -// Shutdown ---------------------------------------------- -int pyNetClientComm::Fini( float flushMsgsSecs/*=0.f */) -{ - return fNetClient.Fini( flushMsgsSecs ); -} - -// Update ---------------------------------------------- -int pyNetClientComm::Update() -{ - return fNetClient.Update( hsTimer::GetSeconds() ); -} - -// SetActiveServer ---------------------------------------------- -int pyNetClientComm::SetActiveServer( pyNetServerSessionInfo* nfo ) -{ - return fNetClient.SetActiveServer( &nfo->ServerInfo() ); -} - -// SetActiveServer2 ---------------------------------------------- -int pyNetClientComm::SetActiveServer2( const char * addr, int port ) -{ - plNetServerSessionInfo nfo; - nfo.SetServerAddr( addr ); - nfo.SetServerPort( port ); - return fNetClient.SetActiveServer( &nfo ); -} - - -// SetAuthInfo ---------------------------------------------- -int pyNetClientComm::SetAuthInfo( const char* acctName, const char* password ) -{ - return fNetClient.SetAuthInfo( acctName, password ); -} - -// SetLogByName ---------------------------------------------- -void pyNetClientComm::SetLogByName( const char * name, uint32_t flags ) -{ - plStatusLog * log = plStatusLogMgr::GetInstance().CreateStatusLog( 80, name, - flags | plStatusLog::kTimestamp | plStatusLog::kDeleteForMe ); - fNetClient.SetLog( log ); -} - -// GetLog ---------------------------------------------- -PyObject* pyNetClientComm::GetLog() const -{ - return pyStatusLog::New( fNetClient.GetLog() ); -} - -// SetServerSilenceTime ---------------------------------------------- -void pyNetClientComm::SetServerSilenceTime( float secs ) -{ - fNetClient.SetServerSilenceTime( secs ); -} - -//////////////////////////////////////////////////////////////////// -// End. diff --git a/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.h b/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.h deleted file mode 100644 index 945d5659..00000000 --- a/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.h +++ /dev/null @@ -1,209 +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 . - -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==*/ -//////////////////////////////////////////////////////////////////// -// pyNetClientComm - python wrapper for plNetClientComm class. - -#ifndef pyNetClientComm_h_inc -#define pyNetClientComm_h_inc - -#include "../plNetClientComm/plNetClientComm.h" -#include "../plStatusLog/plStatusLog.h" - -#include "../FeatureLib/pfPython/pyGlueHelpers.h" -#include - -//////////////////////////////////////////////////////////////////// - -class pyAgeLinkStruct; -class pyNetServerSessionInfo; -class pyStatusLog; -class pyNetCore; - -//////////////////////////////////////////////////////////////// -// plNetClientComm Callback Wrappers - -// Message handler for unsolicited msgs or registered -// for specific msg types. -class pyNetClientCommMsgHandler : public plNetClientComm::MsgHandler -{ -public: - PyObject* fPyObject; - pyNetClientCommMsgHandler( PyObject* pyObject ): fPyObject( pyObject ) {} - int HandleMessage( plNetMessage* msg ); -}; - -// Receipt handler for changed msg receipts. -class pyNetClientCommRcptHandler : public plNetClientComm::RcptHandler -{ -public: - PyObject* fPyObject; - pyNetClientCommRcptHandler( PyObject* pyObject ): fPyObject( pyObject ) {} - void HandleMsgReceipt( plNetCoreMsgReceipt* rcpt ); -}; - -//////////////////////////////////////////////////////////////////// - -class pyNetClientComm -{ - // We contain the plNetClientComm we are wrapping. - plNetClientComm fNetClient; - -protected: - - //////////////////////////////////////////////////////////////// - - pyNetClientComm(); - -public: - ~pyNetClientComm(); - - // required functions for PyObject interoperability - PYTHON_CLASS_NEW_FRIEND(ptNetClientComm); - PYTHON_CLASS_NEW_DEFINITION; - PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyNetClientComm object - PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyNetClientComm); // converts a PyObject to a pyNetClientComm (throws error if not correct type) - - static void AddPlasmaClasses(PyObject *m); - - plNetClientComm * GetNetClientComm() { return &fNetClient; } - - //////////////////////////////////////////////////////////////// - // NETWORK OPERATIONS - - // Auth with active server using auth info set earlier. - // Will timeout after maxAuthSecs elapsed. - int NetAuthenticate( double maxAuthSecs, PyObject* cbClass=nil, uint32_t cbContext=0 ); - // Leave the active server. - int NetLeave( uint8_t reason, PyObject* cbClass=nil, uint32_t cbContext=0 ); - // Ping the specified server. - int NetPing( int serverType, int timeoutSecs=0, PyObject* cbClass=nil, uint32_t cbContext=0 ); - // Spawn a game for us. - int NetFindAge( const pyAgeLinkStruct* linkInfo, PyObject* cbClass=nil, uint32_t cbContext=0 ); - // Get player list. - int NetGetPlayerList( PyObject* cbClass=nil, uint32_t cbContext=0 ); - // Set the active player. - int NetSetActivePlayer( uint32_t playerID, const char* playerName, PyObject* cbClass=nil, uint32_t cbContext=0 ); - // Create a player - int NetCreatePlayer( const char* playerName, const char* avatarShape, uint32_t createFlags, PyObject* cbClass=nil, uint32_t cbContext=0 ); - // Join age - int NetJoinAge( PyObject* cbClass=nil, uint32_t cbContext=0 ); - // Set server-side timeout - int NetSetTimeout( float timeoutSecs, PyObject* cbClass=nil, uint32_t cbContext=0 ); - - //////////////////////////////////////////////////////////////// - - // Calls ErrorHandler, if set. Returns value of result - // that was passed in (for use in return/compound statements). - int ReportError( int err, int result ); - - //////////////////////////////////////////////////////////////// - - // Get/Set Log object - void SetLog( pyStatusLog* log ); - void SetLogByName( const char * name, uint32_t flags=0 ); - PyObject* GetLog() const; // return pyStatusLog - - // NetCore log level - void SetLogLevel( int logLevel ); - - // Startup/Shutdown this object - int Init( bool threaded=true, int logLevel=0 ); - // flushMsgsSecs: time to spend flushing net msgs queued in net core. - // <0 means no time limit. spin until all msgs are flushed. - int Fini( float flushMsgsSecs=0.f ); - - // Call this in your update loop. - int Update(); - - // Access to the NetCore object. - pyNetCore* GetNetCore() const; - - // Get/Set Authentication info - int SetAuthInfo( const char* acctName, const char* password ); - const char* GetAcctName() const; - const char* GetPassword() const; - - // Sets the server we want to communicate with. - int SetActiveServer( pyNetServerSessionInfo* nfo ); - int SetActiveServer2( const char * addr, int port ); - const pyNetServerSessionInfo* GetActiveServer() const; - - // Sets/clears receipt tracking for given message class. - void SetReceiptTrackingForType( uint16_t msgClassIdx, bool on ); - - // Adds a msg handler for a msg that is convertable to specified type. - void AddMsgHandlerForType( uint16_t msgClassIdx, pyNetClientCommMsgHandler* handler ); - - // Adds a msg handler for a specific msg type. - void AddMsgHandlerForExactType( uint16_t msgClassIdx, pyNetClientCommMsgHandler* handler ); - - void RemoveMsgHandler( pyNetClientCommMsgHandler* handler ); - - // Msgs not part of a task controlled by this - // object, and doesn't have a handler set for its type - // are sent to this handler (if set). - void SetDefaultHandler( pyNetClientCommMsgHandler* msgHandler ); - - // Changed message rcpts are sent to this handler if set. - void SetMsgReceiptHandler( pyNetClientCommRcptHandler* rcptHandler ); - - // Send a message to the server. - int SendMsg( plNetMessage* msg, uint32_t sendFlags=0 ); - // Send a message to specified peer - int SendMsg( plNetMessage* msg, plNetCore::PeerID peerID, uint32_t sendFlags=0 ); - - // Set the alive message send frequency. 0 means don't send periodic alive msgs. - void SetAliveFreq( float secs ); - float GetAliveFreq() const; - - // Set the amount of time before we declare server-silence. - void SetServerSilenceTime( float secs ); - float GetServerSilenceTime() const; - - // Set the maximum amount of time to spend processing - // incoming msgs per call to Update(). - void SetMaxMsgProcessingTime( float secs ); - -}; - -//////////////////////////////////////////////////////////////////// -#endif // pyNetClientComm_h_inc diff --git a/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientCommGlue.cpp b/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientCommGlue.cpp deleted file mode 100644 index c276435c..00000000 --- a/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientCommGlue.cpp +++ /dev/null @@ -1,336 +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 . - -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 "pyNetClientComm.h" -#include "../FeatureLib/pfPython/pyEnum.h" -#include "../FeatureLib/pfPython/pyNetServerSessionInfo.h" -#include "../FeatureLib/pfPython/pyAgeLinkStruct.h" - -#include "../plNetCommon/plCreatePlayerFlags.h" -#include - -// glue functions -PYTHON_CLASS_DEFINITION(ptNetClientComm, pyNetClientComm); - -PYTHON_DEFAULT_NEW_DEFINITION(ptNetClientComm, pyNetClientComm) -PYTHON_DEFAULT_DEALLOC_DEFINITION(ptNetClientComm) - -PYTHON_INIT_DEFINITION(ptNetClientComm, args, keywords) -{ - PYTHON_RETURN_INIT_OK; -} - -PYTHON_METHOD_DEFINITION(ptNetClientComm, initObj, args) -{ - char threaded = 1; - int logLevel = 0; - if (!PyArg_ParseTuple(args, "bi", &threaded, &logLevel)) - { - PyErr_SetString(PyExc_TypeError, "initObj expects a boolean and an int"); - PYTHON_RETURN_ERROR; - } - return PyInt_FromLong(self->fThis->Init(threaded != 0, logLevel)); -} - -PYTHON_METHOD_DEFINITION(ptNetClientComm, fini, args) -{ - float flushMsgsSecs = 0; - if (!PyArg_ParseTuple(args, "f", &flushMsgsSecs)) - { - PyErr_SetString(PyExc_TypeError, "fini expects a float"); - PYTHON_RETURN_ERROR; - } - return PyInt_FromLong(self->fThis->Fini(flushMsgsSecs)); -} - -PYTHON_METHOD_DEFINITION_NOARGS(ptNetClientComm, update) -{ - return PyInt_FromLong(self->fThis->Update()); -} - -PYTHON_METHOD_DEFINITION(ptNetClientComm, setActiveServer, args) -{ - PyObject* arg1; - int port = 0; - if (!PyArg_ParseTuple(args, "O|i", &arg1, &port)) - { - PyErr_SetString(PyExc_TypeError, "setActiveServer expects a string and an int, or a ptNetServerSessionInfo"); - PYTHON_RETURN_ERROR; - } - if (pyNetServerSessionInfo::Check(arg1)) - { - pyNetServerSessionInfo* info = pyNetServerSessionInfo::ConvertFrom(arg1); - return PyInt_FromLong(self->fThis->SetActiveServer(info)); - } - else if (PyString_Check(arg1)) - { - char* addr = PyString_AsString(arg1); - return PyInt_FromLong(self->fThis->SetActiveServer2(addr, port)); - } - PyErr_SetString(PyExc_TypeError, "setActiveServer expects a string and an int, or a ptNetServerSessionInfo"); - PYTHON_RETURN_ERROR; -} - -PYTHON_METHOD_DEFINITION(ptNetClientComm, setAuthInfo, args) -{ - char* account; - char* password; - if (!PyArg_ParseTuple(args, "ss", &account, &password)) - { - PyErr_SetString(PyExc_TypeError, "setAuthInfo expects two strings"); - PYTHON_RETURN_ERROR; - } - return PyInt_FromLong(self->fThis->SetAuthInfo(account, password)); -} - -PYTHON_METHOD_DEFINITION(ptNetClientComm, authenticate, args) -{ - double maxAuthSecs; - PyObject* cb = NULL; - unsigned long context = 0; - if (!PyArg_ParseTuple(args, "d|Ol", &maxAuthSecs, &cb, &context)) - { - PyErr_SetString(PyExc_TypeError, "authenticate expects a double, an optional object and an optional unsigned long"); - PYTHON_RETURN_ERROR; - } - return PyInt_FromLong(self->fThis->NetAuthenticate(maxAuthSecs, cb, context)); -} - -PYTHON_METHOD_DEFINITION(ptNetClientComm, getPlayerList, args) -{ - PyObject* cb = NULL; - unsigned long context = 0; - if (!PyArg_ParseTuple(args, "|Ol", &cb, &context)) - { - PyErr_SetString(PyExc_TypeError, "getPlayerList expects an optional object and an optional unsigned long"); - PYTHON_RETURN_ERROR; - } - return PyInt_FromLong(self->fThis->NetGetPlayerList(cb, context)); -} - -PYTHON_METHOD_DEFINITION(ptNetClientComm, setActivePlayer, args) -{ - unsigned long playerID; - char* playerName; - PyObject* cb = NULL; - unsigned long context = 0; - if (!PyArg_ParseTuple(args, "ls|Ol", &playerID, &playerName, &cb, &context)) - { - PyErr_SetString(PyExc_TypeError, "setActivePlayer expects a double, a string, an optional object and an optional unsigned long"); - PYTHON_RETURN_ERROR; - } - return PyInt_FromLong(self->fThis->NetSetActivePlayer(playerID, playerName, cb, context)); -} - -PYTHON_METHOD_DEFINITION(ptNetClientComm, createPlayer, args) -{ - char* playerName; - char* avatarShape; - unsigned long createFlags; - PyObject* cb = NULL; - unsigned long context = 0; - if (!PyArg_ParseTuple(args, "ssl|Ol", &playerName, &avatarShape, &createFlags, &cb, &context)) - { - PyErr_SetString(PyExc_TypeError, "createPlayer expects two strings, a double, an optional object and an optional unsigned long"); - PYTHON_RETURN_ERROR; - } - return PyInt_FromLong(self->fThis->NetCreatePlayer(playerName, avatarShape, createFlags, cb, context)); -} - -PYTHON_METHOD_DEFINITION(ptNetClientComm, findAge, args) -{ - PyObject* linkObj = NULL; - PyObject* cb = NULL; - unsigned long context = 0; - if (!PyArg_ParseTuple(args, "O|Ol", &linkObj, &cb, &context)) - { - PyErr_SetString(PyExc_TypeError, "findAge expects a ptAgeLinkStruct, an optional object and an optional unsigned long"); - PYTHON_RETURN_ERROR; - } - if (!pyAgeLinkStruct::Check(linkObj)) - { - PyErr_SetString(PyExc_TypeError, "findAge expects a ptAgeLinkStruct, an optional object and an optional unsigned long"); - PYTHON_RETURN_ERROR; - } - pyAgeLinkStruct* link = pyAgeLinkStruct::ConvertFrom(linkObj); - return PyInt_FromLong(self->fThis->NetFindAge(link, cb, context)); -} - -PYTHON_METHOD_DEFINITION(ptNetClientComm, joinAge, args) -{ - PyObject* cb = NULL; - unsigned long context = 0; - if (!PyArg_ParseTuple(args, "|Ol", &cb, &context)) - { - PyErr_SetString(PyExc_TypeError, "joinAge expects an optional object and an optional unsigned long"); - PYTHON_RETURN_ERROR; - } - return PyInt_FromLong(self->fThis->NetJoinAge(cb, context)); -} - -PYTHON_METHOD_DEFINITION(ptNetClientComm, leave, args) -{ - unsigned char reason; - PyObject* cb = NULL; - unsigned long context = 0; - if (!PyArg_ParseTuple(args, "b|Ol", &reason, &cb, &context)) - { - PyErr_SetString(PyExc_TypeError, "leave expects an unsigned 8-bit int, an optional object and an optional unsigned long"); - PYTHON_RETURN_ERROR; - } - return PyInt_FromLong(self->fThis->NetLeave(reason, cb, context)); -} - -PYTHON_METHOD_DEFINITION(ptNetClientComm, ping, args) -{ - int serverType; - int timeoutSecs = 0; - PyObject* cb = NULL; - unsigned long context = 0; - if (!PyArg_ParseTuple(args, "i|iOl", &serverType, &timeoutSecs, &cb, &context)) - { - PyErr_SetString(PyExc_TypeError, "ping expects an int, and optional int, an optional object and an optional unsigned long"); - PYTHON_RETURN_ERROR; - } - return PyInt_FromLong(self->fThis->NetPing(serverType, timeoutSecs, cb, context)); -} - -PYTHON_METHOD_DEFINITION(ptNetClientComm, setTimeout, args) -{ - float timeoutSecs; - PyObject* cb = NULL; - unsigned long context = 0; - if (!PyArg_ParseTuple(args, "f|Ol", &timeoutSecs, &cb, &context)) - { - PyErr_SetString(PyExc_TypeError, "setTimeout expects a float, an optional object and an optional unsigned long"); - PYTHON_RETURN_ERROR; - } - return PyInt_FromLong(self->fThis->NetSetTimeout(timeoutSecs, cb, context)); -} - -PYTHON_METHOD_DEFINITION(ptNetClientComm, setLog, args) -{ - char* name; - unsigned long flags = 0; - if (!PyArg_ParseTuple(args, "s|l", &name, &flags)) - { - PyErr_SetString(PyExc_TypeError, "setLog expects a string and an optional unsigned long"); - PYTHON_RETURN_ERROR; - } - self->fThis->SetLogByName(name, flags); - PYTHON_RETURN_NONE; -} - -PYTHON_METHOD_DEFINITION_NOARGS(ptNetClientComm, getLog) -{ - return self->fThis->GetLog(); -} - -PYTHON_METHOD_DEFINITION(ptNetClientComm, setLogLevel, args) -{ - int level; - if (!PyArg_ParseTuple(args, "i", &level)) - { - PyErr_SetString(PyExc_TypeError, "setLogLevel expects an integer"); - PYTHON_RETURN_ERROR; - } - self->fThis->SetLogLevel(level); - PYTHON_RETURN_NONE; -} - -PYTHON_METHOD_DEFINITION(ptNetClientComm, setServerSilenceTime, args) -{ - float secs; - if (!PyArg_ParseTuple(args, "f", &secs)) - { - PyErr_SetString(PyExc_TypeError, "setServerSilenceTime expects a float"); - PYTHON_RETURN_ERROR; - } - self->fThis->SetServerSilenceTime(secs); - PYTHON_RETURN_NONE; -} - -PYTHON_START_METHODS_TABLE(ptNetClientComm) - PYTHON_METHOD(ptNetClientComm, initObj, "Params: threaded=1,logLevel=0\nInitialize this object"), - PYTHON_METHOD(ptNetClientComm, fini, "Params: flushMsgsSecs=0\nFinalize this object"), - PYTHON_METHOD_NOARGS(ptNetClientComm, update, "Update this object"), - PYTHON_METHOD(ptNetClientComm, setActiveServer, "Params: addr,port\nAlso accepts a ptNetServerSessionInfo instead of address and port"), - PYTHON_METHOD(ptNetClientComm, setAuthInfo, "Params: accountName,password\nSets the authentication info"), - PYTHON_METHOD(ptNetClientComm, authenticate, "Params: maxAuthSecs,callback=None,cbContext=0\nAuthenticate with the server"), - PYTHON_METHOD(ptNetClientComm, getPlayerList, "Params: callback=None,cbContext=0\nGets a list of players and uses the callback"), - PYTHON_METHOD(ptNetClientComm, setActivePlayer, "Params: playerID,playerName,callback=None,cbContext=0\nSets the current active player"), - PYTHON_METHOD(ptNetClientComm, createPlayer, "Params: playerName,avatarShape,createFlags,callback=None,cbContext=0\nCreates a new player"), - PYTHON_METHOD(ptNetClientComm, findAge, "Params: ageLink,callback=None,cbContext=0\nFinds an age based on a ptAgeLinkStruct"), - PYTHON_METHOD(ptNetClientComm, joinAge, "Params: callback=None,cbContext=0\nUNKNOWN"), - PYTHON_METHOD(ptNetClientComm, leave, "Params: reason,callback=None,cbContext=0\nLeaves the lobby"), - PYTHON_METHOD(ptNetClientComm, ping, "Params: serverType,timeoutSecs=0,callback=None,cbContext=0\nPings a server"), - PYTHON_METHOD(ptNetClientComm, setTimeout, "Params: timeoutSecs,callback=None,cbContext=0\nSets the timeout duration"), - PYTHON_METHOD(ptNetClientComm, setLog, "Params: name,flags=0\nUNKNOWN"), - PYTHON_METHOD_NOARGS(ptNetClientComm, getLog, "UNKNOWN"), - PYTHON_METHOD(ptNetClientComm, setLogLevel, "Params: level\nSets the logging level"), - PYTHON_METHOD(ptNetClientComm, setServerSilenceTime, "Params: secs\nUNKNOWN"), -PYTHON_END_METHODS_TABLE; - -// Type structure definition -PLASMA_DEFAULT_TYPE(ptNetClientComm, "UNKNOWN"); - -// required functions for PyObject interoperability -PYTHON_CLASS_NEW_IMPL(ptNetClientComm, pyNetClientComm) - -PYTHON_CLASS_CHECK_IMPL(ptNetClientComm, pyNetClientComm) -PYTHON_CLASS_CONVERT_FROM_IMPL(ptNetClientComm, pyNetClientComm) - -/////////////////////////////////////////////////////////////////////////// -// -// AddPlasmaClasses - the python module definitions -// -void pyNetClientComm::AddPlasmaClasses(PyObject *m) -{ - PYTHON_CLASS_IMPORT_START(m); - PYTHON_CLASS_IMPORT(m, ptNetClientComm); - PYTHON_CLASS_IMPORT_END(m); - - PYTHON_ENUM_START(PtCreatePlayerFlags); - PYTHON_ENUM_ELEMENT(PtCreatePlayerFlags, kDefaultFlags, plCreatePlayerFlags::kDefaultFlags); - PYTHON_ENUM_ELEMENT(PtCreatePlayerFlags, kNoNeighborhood, plCreatePlayerFlags::kNoNeighborhood); - PYTHON_ENUM_ELEMENT(PtCreatePlayerFlags, kNoCityLink, plCreatePlayerFlags::kNoCityLink); - PYTHON_ENUM_END(m, PtCreatePlayerFlags); -} \ No newline at end of file diff --git a/Sources/Plasma/PythonLib/pyNetClientGame/pyNetClientGame.cpp b/Sources/Plasma/PythonLib/pyNetClientGame/pyNetClientGame.cpp deleted file mode 100644 index 19828919..00000000 --- a/Sources/Plasma/PythonLib/pyNetClientGame/pyNetClientGame.cpp +++ /dev/null @@ -1,41 +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 . - -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==*/ diff --git a/Sources/Plasma/PythonLib/pyNetClientGame/pyNetClientGame.h b/Sources/Plasma/PythonLib/pyNetClientGame/pyNetClientGame.h deleted file mode 100644 index 19828919..00000000 --- a/Sources/Plasma/PythonLib/pyNetClientGame/pyNetClientGame.h +++ /dev/null @@ -1,41 +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 . - -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==*/ diff --git a/Sources/Plasma/PythonLib/pyPlasma/creatables.cpp b/Sources/Plasma/PythonLib/pyPlasma/creatables.cpp deleted file mode 100644 index 1dd0b51e..00000000 --- a/Sources/Plasma/PythonLib/pyPlasma/creatables.cpp +++ /dev/null @@ -1,49 +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 . - -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 "plNetClientComm/plNetClientCommCreatable.h" -#include "pnKeyedObject/pnKeyedObjectCreatable.h" -#include "pnNetCommon/pnNetCommonCreatable.h" -#include "pnMessage/pnMessageCreatable.h" -#include "plNetMessage/plNetMessageCreatable.h" -#include "plNetCommon/plNetCommonCreatable.h" -#include "plVault/plVaultCreatable.h" -#include "plSDL/plSDLCreatable.h" diff --git a/Sources/Plasma/PythonLib/pyPlasma/dllmain.cpp b/Sources/Plasma/PythonLib/pyPlasma/dllmain.cpp deleted file mode 100644 index 9707a3ea..00000000 --- a/Sources/Plasma/PythonLib/pyPlasma/dllmain.cpp +++ /dev/null @@ -1,155 +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 . - -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 "hsConfig.h" -#include "../plSDL/plSDL.h" -#include "../plVault/plVaultCache.h" -#include "../pyNetClientComm/pyNetClientComm.h" -#include "../pyVault/pyVNodeMgr.h" -#include "../pfPython/pyNetServerSessionInfo.h" -#include "../pfPython/pyVault.h" -#include "../pfPython/pyVaultNodeRef.h" -#include "../pfPython/pyVaultAgeInfoListNode.h" -#include "../pfPython/pyVaultAgeInfoNode.h" -#include "../pfPython/pyVaultAgeLinkNode.h" -#include "../pfPython/pyVaultChronicleNode.h" -#include "../pfPython/pyVaultFolderNode.h" -#include "../pfPython/pyVaultImageNode.h" -#include "../pfPython/pyVaultMarkerNode.h" -#include "../pfPython/pyVaultPlayerInfoListNode.h" -#include "../pfPython/pyVaultPlayerInfoNode.h" -#include "../pfPython/pyVaultPlayerNode.h" -#include "../pfPython/pySDL.h" -#include "../pfPython/pyVaultSDLNode.h" -#include "../pfPython/pyVaultTextNoteNode.h" -#include "../pfPython/pySpawnPointInfo.h" -#include "../pfPython/pyAgeInfoStruct.h" -#include "../pfPython/pyAgeLinkStruct.h" -#include "../pfPython/pyDniCoordinates.h" -#include "../pfPython/pyImage.h" -#include "../pfPython/pyNetLinkingMgr.h" -#include "../pfPython/pyStatusLog.h" -#include "../pfPython/pyColor.h" - -#include "../pfPython/pyEnum.h" -#include "../pfPython/pyGlueHelpers.h" - -#include - -extern "C" __declspec(dllexport) void PyInit_pyPlasma(void) -{ - // If a glue function (AddPlasmaClasses, AddPlasmaMethds, etc) is commented out, it is included - // in the source in this project... but the original version of this function did not call the - // function. So in order to keep the module identical, those specified classes/functions are not - // added, but can be un-commented in the future if needed - - std::vector methods; // this is temporary, for easy addition of new methods - //pyImage::AddPlasmaMethods(methods); - pySpawnPointInfo::AddPlasmaMethods(methods); - - // now copy the data to our real method definition structure - PyMethodDef* plasmaMethods = new PyMethodDef[methods.size() + 1]; - for (int curMethod = 0; curMethod < methods.size(); curMethod++) - plasmaMethods[curMethod] = methods[curMethod]; - PyMethodDef terminator = {NULL}; - plasmaMethods[methods.size()] = terminator; // add the terminator - - // Init the module - PyObject *m = Py_InitModule("pyPlasma", plasmaMethods); - - // Inits - plSDLMgr::GetInstance()->Init(); - plVaultCache::GetInstance()->SetEnabled( true ); - - // Enum - pyEnum::AddPlasmaConstantsClasses(m); - - // Classes - pyAgeInfoStruct::AddPlasmaClasses(m); - pyAgeInfoStructRef::AddPlasmaClasses(m); - pyAgeLinkStruct::AddPlasmaClasses(m); - pyAgeLinkStructRef::AddPlasmaClasses(m); - pyColor::AddPlasmaClasses(m); - //pyDniCoordinates::AddPlasmaClasses(m); - //pyPoint3::AddPlasmaClasses(m); - //pyVector3::AddPlasmaClasses(m); - //pyImage::AddPlasmaClasses(m); - //pyMatrix44::AddPlasmaClasses(m); - pyNetClientComm::AddPlasmaClasses(m); - pyNetServerSessionInfo::AddPlasmaClasses(m); - pyNetServerSessionInfoRef::AddPlasmaClasses(m); - pySDLStateDataRecord::AddPlasmaClasses(m); - pySimpleStateVariable::AddPlasmaClasses(m); - pySpawnPointInfo::AddPlasmaClasses(m); - pySpawnPointInfoRef::AddPlasmaClasses(m); - pyStatusLog::AddPlasmaClasses(m); - - pyVNodeMgr::AddPlasmaClasses(m); - pyAdminVNodeMgr::AddPlasmaClasses(m); - pyAgeVNodeMgr::AddPlasmaClasses(m); - pyPlayerVNodeMgr::AddPlasmaClasses(m); - - pyVaultNode::AddPlasmaClasses(m); - pyVaultNodeRef::AddPlasmaClasses(m); - pyVaultFolderNode::AddPlasmaClasses(m); - - pyVaultAgeInfoListNode::AddPlasmaClasses(m); - pyVaultAgeInfoNode::AddPlasmaClasses(m); - pyVaultAgeLinkNode::AddPlasmaClasses(m); - pyVaultChronicleNode::AddPlasmaClasses(m); - pyVaultImageNode::AddPlasmaClasses(m); - //pyVaultMarkerListNode::AddPlasmaClasses(m); - pyVaultMarkerNode::AddPlasmaClasses(m); - pyVaultPlayerInfoListNode::AddPlasmaClasses(m); - pyVaultPlayerInfoNode::AddPlasmaClasses(m); - pyVaultPlayerNode::AddPlasmaClasses(m); - pyVaultSDLNode::AddPlasmaClasses(m); - //pyVaultSystemNode::AddPlasmaClasses(m); - pyVaultTextNoteNode::AddPlasmaClasses(m); - - // Constants - pyNetLinkingMgr::AddPlasmaConstantsClasses(m); - pySDL::AddPlasmaConstantsClasses(m); - pyStatusLog::AddPlasmaConstantsClasses(m); - pyVault::AddPlasmaConstantsClasses(m); - - delete [] plasmaMethods; // cleanup -} \ No newline at end of file diff --git a/Sources/Plasma/PythonLib/pyPlasma/pyPlasmaTest.py b/Sources/Plasma/PythonLib/pyPlasma/pyPlasmaTest.py deleted file mode 100644 index 2e3cb7d0..00000000 --- a/Sources/Plasma/PythonLib/pyPlasma/pyPlasmaTest.py +++ /dev/null @@ -1,163 +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 . - -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==* """ -from pyPlasma import * -from pyPlasmaHelpers import * -from traceback import print_exc - -kLogToDebugger = 32 -kPeristentNode = 1 -kTransientNode = 0 -kQuittingGame = 7 -kLinkingOut = 8 -kExitingLobby = 9 - -#------------------------------------- - -print "BEGIN" - -# create client-side networking -net = ptNetClientComm() -# init log. this must be done before creating the vault manager -net.setLog("pyPlasmaTest.log", kLogToDebugger ) -# create vault manager -#vault = ptPlayerVNodeMgr(net) -vault = ptAdminVNodeMgr(net) -vault.setWantGlobalSDL(1) -vault.setWantAllPlayers(1) -# create the NetClientMgr. -nc = NetClientMgr(net) -# create the VaultConnectMgr -vc = VaultConnectMgr(vault) - -# startup networking -print "Net: starting up..." -net.init() -print "Net: started" - -# point to lobby server -net.setActiveServer('ea1-2k',5000) -# set acct username/password -net.setAuthInfo('reseng0221','tooann42') -# specify the name of player we want to use. -nc.setDesiredPlayer('Scooby5',1) - -#------------------ -success = 0 - -while 1: - try: - # login to the lobby server - if nc.login(NetClientMgr.kLobby)<0: break - - # connect to vault - if vc.connect()<0: break - # get root node - rootNode = vault.getRootNode() - print rootNode - # create a template node for finding the global sdl folder node - tmpNode = vault.createNode(PtVaultNodeTypes.kFolderNode,kTransientNode).upcastToFolderNode() - tmpNode.setFolderType(PtVaultStandardNodes.kAllAgeGlobalSDLNodesFolder) - # find global SDL folder - globalSDLFolder = vault.findNode(tmpNode) - if globalSDLFolder: - globalSDLFolder = globalSDLFolder.upcastToFolderNode() - print globalSDLFolder - - # startup an age or three (forces global sdl nodes to initialize) - ageLink = ptAgeLinkStruct() - # ageLink.getAgeInfo().setAgeFilename('Teledahn') - # nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete - # ageLink.getAgeInfo().setAgeFilename('city') - # nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete - # ageLink.getAgeInfo().setAgeFilename('Personal') - # nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete - # ageLink.getAgeInfo().setAgeFilename('Garden') - # nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete - # ageLink.getAgeInfo().setAgeFilename('BaronCityOffice') - # nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete - # ageLink.getAgeInfo().setAgeFilename('Kadish') - # nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete - # ageLink.getAgeInfo().setAgeFilename('Neighborhood') - # nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete - # ageLink.getAgeInfo().setAgeFilename('Cleft') - # nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete - # ageLink.getAgeInfo().setAgeFilename('Garrison') - # nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete - - # spawn a game - ageLink.getAgeInfo().setAgeFilename('Teledahn') - ageLink.setLinkingRules(PtLinkingRules.kOriginalBook) - if nc.findAge(ageLink)<0: break - serverInfo = nc.fCbArgs[0] - - # leave the lobby - nc.logout(kExitingLobby) - - # log into the game server - net.setActiveServer(serverInfo) - if nc.login(NetClientMgr.kGame)<0: break - - # join the age - if nc.joinAge()<0: break - - # done trying things - success = 1 - break - except: - print_exc() - break - -# disconnect from vault -vc.disconnect() -# leave the server -nc.logout(kQuittingGame) - -#------------------ - -# shutdown networking. only flush msgs if all went well (not required, but speeds up shutdown on error) -print "Net: shutting down..." -net.fini(success) -print "Net: shut down" - - -print "END" -raw_input("\npress return") diff --git a/Sources/Plasma/PythonLib/pyPloticus/dllmain.cpp b/Sources/Plasma/PythonLib/pyPloticus/dllmain.cpp deleted file mode 100644 index 6c1cd4b2..00000000 --- a/Sources/Plasma/PythonLib/pyPloticus/dllmain.cpp +++ /dev/null @@ -1,55 +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 . - -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 "pyPloticus.h" - -#pragma warning(push) -// disable warnings that appear in boost -# pragma warning(disable:4800) // disable int to bool performance warning -# pragma warning(disable:4275) // disable non dll-interface warning -# pragma warning(disable:4251) // similar to above warning -# include -#pragma warning(pop) - -BOOST_PYTHON_MODULE(pyPloticus) -{ - pyPloticus::PythonModDef(); -} diff --git a/Sources/Plasma/PythonLib/pyPloticus/pyPloticus.cpp b/Sources/Plasma/PythonLib/pyPloticus/pyPloticus.cpp deleted file mode 100644 index 2aba07ba..00000000 --- a/Sources/Plasma/PythonLib/pyPloticus/pyPloticus.cpp +++ /dev/null @@ -1,216 +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 . - -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 "pyPloticus.h" - -#include "../pfPython/pyGlueHelpers.h" -#include - -#include - -//////////////////////////////////////////////////////////////////// - -extern "C" { -// Ploticus C API -int ploticus_init(char *, char *); -int ploticus_arg(char *, char *); -int ploticus_begin(); -void ploticus_end(); -void ploticus_execline(char *); -int ploticus_execscript(char *, int); -int ploticus_getvar(char *, char *); -void ploticus_setvar(char *, char *); -} - -//////////////////////////////////////////////////////////////////// - -void pyPloticus::Init(char* device, char* outfilename) -{ - ploticus_init( device, outfilename ); -} - -void pyPloticus::Arg(char* name, char* value) -{ - ploticus_arg( name, value ); -} - -void pyPloticus::Begin() -{ - ploticus_begin(); -} - -void pyPloticus::End() -{ - ploticus_end(); -} - -void pyPloticus::ExecLine(char* line) -{ - ploticus_execline( line ); -} - -void pyPloticus::ExecScript(char* scriptfile, int prefab) -{ - ploticus_execscript( scriptfile, prefab ); -} - -void pyPloticus::GetVar(char* name, char* value) -{ - ploticus_getvar( name, value ); -} - -void pyPloticus::SetVar(char* name, char* value) -{ - ploticus_setvar( name, value ); -} - -PYTHON_GLOBAL_METHOD_DEFINITION(init, args, "Params: device,outfilename\nUNKNOWN") -{ - char* device; - char* outfilename; - if (!PyArg_ParseTuple(args, "ss", &device, &outfilename)) - { - PyErr_SetString(PyExc_TypeError, "init expects two strings"); - PYTHON_RETURN_ERROR; - } - pyPloticus::Init(device, outfilename); - PYTHON_RETURN_NONE; -} - -PYTHON_GLOBAL_METHOD_DEFINITION(arg, args, "Params: name,value\nUNKNOWN") -{ - char* name; - char* value; - if (!PyArg_ParseTuple(args, "ss", &name, &value)) - { - PyErr_SetString(PyExc_TypeError, "arg expects two strings"); - PYTHON_RETURN_ERROR; - } - pyPloticus::Arg(name, value); - PYTHON_RETURN_NONE; -} - -PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(begin, pyPloticus::Begin, "UNKNOWN") -PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(end, pyPloticus::End, "UNKNOWN") - -PYTHON_GLOBAL_METHOD_DEFINITION(execLine, args, "Params: line\nUNKNOWN") -{ - char* line; - if (!PyArg_ParseTuple(args, "s", &line)) - { - PyErr_SetString(PyExc_TypeError, "execLine expects a string"); - PYTHON_RETURN_ERROR; - } - pyPloticus::ExecLine(line); - PYTHON_RETURN_NONE; -} - -PYTHON_GLOBAL_METHOD_DEFINITION(execScript, args, "Params: file,prefab\nUNKNOWN") -{ - char* file; - int prefab; - if (!PyArg_ParseTuple(args, "si", &file, &prefab)) - { - PyErr_SetString(PyExc_TypeError, "execScript expects a string and an int"); - PYTHON_RETURN_ERROR; - } - pyPloticus::ExecScript(file, prefab); - PYTHON_RETURN_NONE; -} - -PYTHON_GLOBAL_METHOD_DEFINITION(getVar, args, "Params: name,value\nUNKNOWN") -{ - char* name; - char* value; - if (!PyArg_ParseTuple(args, "ss", &name, &value)) - { - PyErr_SetString(PyExc_TypeError, "getVar expects two strings"); - PYTHON_RETURN_ERROR; - } - pyPloticus::GetVar(name, value); - PYTHON_RETURN_NONE; -} - -PYTHON_GLOBAL_METHOD_DEFINITION(setVar, args, "Params: name,value\nUNKNOWN") -{ - char* name; - char* value; - if (!PyArg_ParseTuple(args, "ss", &name, &value)) - { - PyErr_SetString(PyExc_TypeError, "setVar expects two strings"); - PYTHON_RETURN_ERROR; - } - pyPloticus::SetVar(name, value); - PYTHON_RETURN_NONE; -} - -void AddPlasmaMethods(std::vector &methods) -{ - PYTHON_GLOBAL_METHOD(methods, init); - PYTHON_GLOBAL_METHOD(methods, arg); - PYTHON_BASIC_GLOBAL_METHOD(methods, begin); - PYTHON_BASIC_GLOBAL_METHOD(methods, end); - PYTHON_GLOBAL_METHOD(methods, execLine); - PYTHON_GLOBAL_METHOD(methods, execScript); - PYTHON_GLOBAL_METHOD(methods, getVar); - PYTHON_GLOBAL_METHOD(methods, setVar); -} - -//////////////////////////////////////////////////////////////////// -extern "C" __declspec(dllexport) void PyInit_pyPloticus(void) -{ - std::vector methods; // this is temporary, for easy addition of new methods - AddPlasmaMethods(methods); - - // now copy the data to our real method definition structure - PyMethodDef* plasmaMethods = new PyMethodDef[methods.size() + 1]; - for (int curMethod = 0; curMethod < methods.size(); curMethod++) - plasmaMethods[curMethod] = methods[curMethod]; - PyMethodDef terminator = {NULL}; - plasmaMethods[methods.size()] = terminator; // add the terminator - - // Init the module - PyObject *m = Py_InitModule("pyPloticus", plasmaMethods); - - delete [] plasmaMethods; // clean up -} - -//////////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/PythonLib/pyPloticus/pyPloticus.h b/Sources/Plasma/PythonLib/pyPloticus/pyPloticus.h deleted file mode 100644 index 12f3630f..00000000 --- a/Sources/Plasma/PythonLib/pyPloticus/pyPloticus.h +++ /dev/null @@ -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 . - -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 pyPloticus_h_inc -#define pyPloticus_h_inc - -#include "hsTypes.h" -#include "Python.h" - -// Ploticus C API - -class pyPloticus -{ -public: - static void Init(char* device, char* outfilename); - static void Arg(char* name, char* value); - static void Begin(); - static void End(); - static void ExecLine(char* line); - static void ExecScript(char* scriptfile, int prefab); - static void GetVar(char* name, char* value); - static void SetVar(char* name, char* value); -}; - -#endif // pyPloticus_h_inc diff --git a/Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.cpp b/Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.cpp deleted file mode 100644 index fd70c132..00000000 --- a/Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.cpp +++ /dev/null @@ -1,503 +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 . - -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 "pyVNodeMgr.h" -#include "../plVault/plVaultCallback.h" -#include "../plVault/plVaultInitTasks.h" -#include "../pfPython/pyVaultNode.h" -#include "../pfPython/pyVaultFolderNode.h" -#include "../pyNetClientComm/pyNetClientComm.h" -#include "../plNetMessage/plNetMessage.h" -#include "../plStatusLog/plStatusLog.h" - -//////////////////////////////////////////////////////////////////// - -class pyVaultOperationCallback : public plVaultOperationCallback -{ -public: - PyObject * fPyObject; - pyVaultOperationCallback( PyObject * pyObject ) - : fPyObject( pyObject ) - { - Py_XINCREF( fPyObject ); - } - ~pyVaultOperationCallback() - { - Py_XDECREF( fPyObject ); - } - void VaultOperationStarted( uint32_t context ) - { - if ( fPyObject ) - { - // Do callback - PyObject* func = PyObject_GetAttrString( fPyObject, "operationStarted" ); - if ( func ) - { - if ( PyCallable_Check(func)>0 ) - { - PyObject* retVal = PyObject_CallMethod(fPyObject, "operationStarted", "l", context); - Py_XDECREF(retVal); - } - } - } - } - void VaultOperationComplete( uint32_t context, int resultCode ) - { - if ( fPyObject ) - { - // Pass args. -// PyObject* pyArgs = PyObject_GetAttrString( fPyObject, "fCbArgs" ); -// if ( pyArgs ) -// { -// dict pyDict = dict(); -// std::map args; -// fCbArgs.GetItems( args ); -// for ( std::map::iterator ii=args.begin(); ii!=args.end(); ++ii ) -// { -// uint16_t key = ii->first; -// plCreatable* arg = ii->second; -// plCreatableGenericValue * genValue = plCreatableGenericValue::ConvertNoRef( arg ); -// if ( genValue ) -// { -// plGenericType & value = genValue->Value(); -// switch ( value.GetType() ) -// { -// case plGenericType::kInt: -// pyDict[key] = (int)value; -// break; -// case plGenericType::kUInt: -// pyDict[key] = (unsigned int)value; -// break; -// case plGenericType::kFloat: -// pyDict[key] = (float)value; -// break; -// case plGenericType::kDouble: -// pyDict[key] = (double)value; -// break; -// case plGenericType::kBool: -// pyDict[key] = (bool)value; -// break; -// case plGenericType::kChar: -// pyDict[key] = (char)value; -// break; -// case plGenericType::kString: -// pyDict[key] = (const char *)value; -// break; -// case plGenericType::kAny: -// break; -// case plGenericType::kNone: -// break; -// } -// } -// } -// PyObject_SetAttrString( fPyObject, "fCbArgs", pyDict.ptr() ); -// } - // Do callback - PyObject* func = PyObject_GetAttrString( fPyObject, "operationComplete" ); - if ( func ) - { - if ( PyCallable_Check(func)>0 ) - { - PyObject* retVal = PyObject_CallMethod(fPyObject, "operationComplete", "li", context, resultCode); - Py_XDECREF(retVal); - } - } - } - delete this; - } -}; - - -class pyVaultCallback : public plVaultStubbedCallback -{ -public: - PyObject * fPyObject; - pyVaultCallback( PyObject * pyObject ) - : fPyObject( pyObject ) - { - Py_XINCREF( fPyObject ); - } - ~pyVaultCallback() - { - Py_XDECREF( fPyObject ); - } -}; - - -//////////////////////////////////////////////////////////////////// - -int pyVNodeMgr::VaultMsgHandler::HandleMessage( plNetMessage* msg ) -{ - plNetMsgVault * vaultMsg = plNetMsgVault::ConvertNoRef( msg ); - - if ( vaultMsg ) - { - plNetCoreMessage * ncmsg = (plNetCoreMessage*)msg->GetNetCoreMsg(); - msg->PeekBuffer( ncmsg->GetData(), ncmsg->GetLen() ); - fMyVNodeMgr->GetStatusLog()->AddLineF( "\t%s", msg->AsStdString().c_str() ); - plVault::ProcessMsg( vaultMsg ); - return plNetClientComm::kOK_MsgConsumed; - } - - return hsFail; -} - - -// pyVNodeMgr ---------------------------------------------- -pyVNodeMgr::pyVNodeMgr( PyObject* thaComm ) -{ - if (!pyNetClientComm::Check(thaComm)) - { - fMyCommObj = NULL; - return; // screwed! - } - - fMsgHandler.setMgr(this); - - fMyCommObj = thaComm; - Py_INCREF(fMyCommObj); - fMyComm = pyNetClientComm::ConvertFrom(fMyCommObj); - fMyComm->GetNetClientComm()->AddMsgHandlerForType( plNetMsgVault::Index(), &fMsgHandler ); - plVNodeMgr::SetStatusLog( fMyComm->GetNetClientComm()->GetLog(), false ); -} - -// ~pyVNodeMgr ---------------------------------------------- -pyVNodeMgr::~pyVNodeMgr() -{ - fMyComm->GetNetClientComm()->RemoveMsgHandler( &fMsgHandler ); - Py_DECREF(fMyCommObj); -} - -void pyVNodeMgr::setMyComm(PyObject* thaComm) -{ - if (fMyComm) - { - fMyComm->GetNetClientComm()->RemoveMsgHandler(&fMsgHandler); - Py_DECREF(fMyCommObj); - fMyCommObj = NULL; - fMyComm = NULL; - } - if (!pyNetClientComm::Check(thaComm)) - return; // screwed! - - fMyCommObj = thaComm; - Py_INCREF(fMyCommObj); - fMyComm = pyNetClientComm::ConvertFrom(fMyCommObj); - fMyComm->GetNetClientComm()->AddMsgHandlerForType(plNetMsgVault::Index(), &fMsgHandler); - plVNodeMgr::SetStatusLog(fMyComm->GetNetClientComm()->GetLog(), false); -} - -// IAmOnline ---------------------------------------------- -bool pyVNodeMgr::IAmOnline() const -{ - return true; -} - -// IIsThisMe ---------------------------------------------- -bool pyVNodeMgr::IIsThisMe( plVaultPlayerInfoNode* node ) const -{ - return ( fMyComm->GetNetClientComm()->GetPlayerID()==node->GetPlayerID() ); -} - -// IIsThisMe ---------------------------------------------- -bool pyVNodeMgr::IIsThisMe( plVaultPlayerNode * node ) const -{ - return ( fMyComm->GetNetClientComm()->GetPlayerID()==node->GetID() ); -} - -// ISendNetMsg ---------------------------------------------- -int pyVNodeMgr::ISendNetMsg( plNetMsgVault* msg, uint32_t sendFlags/*=0 */) -{ - return fMyComm->GetNetClientComm()->SendMsg( msg, sendFlags ); -} - -// IGetPlayerID ---------------------------------------------- -uint32_t pyVNodeMgr::IGetPlayerID() const -{ - return fMyComm->GetNetClientComm()->GetPlayerID(); -} - -// Update ---------------------------------------------- -int pyVNodeMgr::Update( double secs ) -{ - return plVNodeMgr::Update( secs ); -} - -// Startup ---------------------------------------------- -void pyVNodeMgr::Startup() -{ - plVNodeMgr::Startup(); -} - -// Shutdown ---------------------------------------------- -void pyVNodeMgr::Shutdown() -{ - plVNodeMgr::Shutdown(); -} - - -// IsConnected ---------------------------------------------- -bool pyVNodeMgr::IsConnected() -{ - return plVNodeMgr::IsConnected(); -} - -// Disconnect ---------------------------------------------- -void pyVNodeMgr::Disconnect( PyObject* cb/*=nil*/, uint32_t cbContext/*=0 */) -{ - // disconnect from allplayers and globalsdl folders - plVaultNodeRef * out; - plVaultNode * root = plVNodeMgr::GetRootNode(); - if ( root ) - { - plVaultFolderNode tmpGlobalSDL; - tmpGlobalSDL.SetFolderType( plVault::kAllAgeGlobalSDLNodesFolder ); - if ( root->FindNode( &tmpGlobalSDL, out ) ) - root->RemoveNode( out->GetChildID() ); - plVaultFolderNode tmpAllPlayers; - tmpAllPlayers.SetFolderType( plVault::kAllPlayersFolder ); - if ( root->FindNode( &tmpAllPlayers, out ) ) - root->RemoveNode( out->GetChildID() ); - } - plVNodeMgr::Disconnect( new pyVaultOperationCallback( cb ), cbContext ); -} - -// Connect ---------------------------------------------- -void pyVNodeMgr::Connect( int childFetchLevel/*=plVault::kFetchAllChildren*/, PyObject* cb/*=nil*/, uint32_t cbContext/*=0 */) -{ - plVNodeMgr::Connect( childFetchLevel, new pyVaultOperationCallback( cb ), cbContext ); -} - -// FetchNode ---------------------------------------------- -bool pyVNodeMgr::FetchNode( uint32_t nodeID, - int childFetchLevel/*=plVault::kFetchAllChildren*/, - PyObject* cb/*=nil*/, - uint32_t cbContext/*=0 */) -{ - return plVNodeMgr::FetchNode( nodeID, childFetchLevel, new pyVaultOperationCallback( cb ), cbContext ); -} - -// GetRootNode ---------------------------------------------- -PyObject* pyVNodeMgr::GetRootNode() const -{ - return pyVaultNode::New( plVNodeMgr::GetRootNode() ); -} - -// GetClientID ---------------------------------------------- -uint32_t pyVNodeMgr::GetClientID() const -{ - return plVNodeMgr::GetClientID(); -} - -// GetNode ---------------------------------------------- -PyObject* pyVNodeMgr::GetNode( uint32_t id ) const -{ - plVaultNode * tmp; - if ( plVNodeMgr::GetNode( id, tmp ) ) - return pyVaultNode::New( tmp ); - PYTHON_RETURN_NONE; -} - -// FindNode ---------------------------------------------- -PyObject* pyVNodeMgr::FindNode( pyVaultNode* templateNode ) const -{ - plVaultNode * node; - if ( plVNodeMgr::FindNode( templateNode->GetNode(), node ) ) - return pyVaultNode::New( node ); - PYTHON_RETURN_NONE; -} - -// EnableCallbacks ---------------------------------------------- -bool pyVNodeMgr::EnableCallbacks( bool b ) -{ - return plVNodeMgr::EnableCallbacks( b ); -} - -// AddCallback ---------------------------------------------- -void pyVNodeMgr::AddCallback( PyObject* cb ) -{ - pyVaultCallback * pycb = new pyVaultCallback( cb ); - fPyCallbacks.push_back( pycb ); - plVNodeMgr::AddCallback( pycb ); -} - -// RemoveCallback ---------------------------------------------- -void pyVNodeMgr::RemoveCallback( PyObject* cb ) -{ - PyCallbackVec tmp; - for ( int i=0; ifPyObject==cb ) - tmp.push_back( fPyCallbacks[i] ); - } - for ( int i=0; iGetArgs()->AddInt( plVault::kArg_NodeMgrType, plVault::kNodeType_VNodeMgrPlayer ); - msg->GetArgs()->AddInt( plVault::kArg_NodeMgrID, fMyComm->GetNetClientComm()->GetPlayerID() ); -} - -// IGetNodeInitializationTask ---------------------------------------------- -plVNodeInitTask * pyPlayerVNodeMgr::IGetNodeInitializationTask( plVaultNode * node ) -{ - if ( plVaultPlayerNode::ConvertNoRef( node ) ) - return new plVaultPlayerInitializationTask( this, node, true ); - return nil; -} - -//////////////////////////////////////////////////////////////////////// - -pyAgeVNodeMgr::pyAgeVNodeMgr( PyObject* thaComm ) -: pyVNodeMgr( thaComm ) -{} - -// IAmSuperUser ---------------------------------------------- -bool pyAgeVNodeMgr::IAmSuperUser( void ) const -{ - return false; -} - -// IFillOutConnectFields ---------------------------------------------- -void pyAgeVNodeMgr::IFillOutConnectFields( plNetMsgVault* msg ) const -{ - msg->GetArgs()->AddInt( plVault::kArg_NodeMgrType, plVault::kNodeType_VNodeMgrAge ); - msg->GetArgs()->AddString( plVault::kArg_NodeMgrAgeInstanceName, fAgeFilename.c_str() ); - msg->GetArgs()->AddItem( plVault::kArg_NodeMgrAgeGuid, &fAgeInstanceGuid ); -} - -// IGetNodeInitializationTask ---------------------------------------------- -plVNodeInitTask * pyAgeVNodeMgr::IGetNodeInitializationTask( plVaultNode * node ) -{ - if ( plVaultAgeNode::ConvertNoRef( node ) ) - return new plVaultAgeInitializationTask( this, node, nil, true ); - if ( plVaultAgeInfoNode::ConvertNoRef( node ) ) - return new plVaultAgeInfoInitializationTask( this, node ); - return nil; -} - -// SetAgeInfo ---------------------------------------------- -void pyAgeVNodeMgr::SetAgeInfo( const char * ageFilename, const char * ageInstanceGuid ) -{ - fAgeFilename = ageFilename; - fAgeInstanceGuid.FromString( ageInstanceGuid ); -} - -//////////////////////////////////////////////////////////////////////// - -pyAdminVNodeMgr::pyAdminVNodeMgr( PyObject* thaComm ) -: pyVNodeMgr( thaComm ) -, fWantGlobalSDL( true ) -, fWantAllPlayers( false ) -{} - -// IAmSuperUser ---------------------------------------------- -bool pyAdminVNodeMgr::IAmSuperUser( void ) const -{ - return true; -} - -// IFillOutConnectFields ---------------------------------------------- -void pyAdminVNodeMgr::IFillOutConnectFields( plNetMsgVault* msg ) const -{ - msg->GetArgs()->AddInt( plVault::kArg_NodeMgrType, plVault::kNodeType_VNodeMgrAdmin ); - msg->GetArgs()->AddInt( plVault::kArg_NodeMgrID, fMyComm->GetNetClientComm()->GetPlayerID() ); -} - -// IGetNodeInitializationTask ---------------------------------------------- -plVNodeInitTask * pyAdminVNodeMgr::IGetNodeInitializationTask( plVaultNode * node ) -{ - if ( plVaultAdminNode::ConvertNoRef( node ) ) - return new plVaultAdminInitializationTask( this, node, fWantGlobalSDL, fWantAllPlayers ); - return nil; -} - -// GetGlobalInbox ---------------------------------------------- -PyObject * pyAdminVNodeMgr::GetGlobalInbox() const -{ - plVaultFolderNode tmp; - tmp.SetFolderType( plVault::kGlobalInboxFolder ); - plVaultNode * node; - if ( plVNodeMgr::FindNode( &tmp, node ) ) - { - return pyVaultFolderNode::New( plVaultFolderNode::ConvertNoRef( node ) ); - } - PYTHON_RETURN_NONE; -} - -//////////////////////////////////////////////////////////////////// -// End. diff --git a/Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.h b/Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.h deleted file mode 100644 index 0cbefa13..00000000 --- a/Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.h +++ /dev/null @@ -1,247 +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 . - -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==*/ -//////////////////////////////////////////////////////////////////// -// pyVNodeMgr - python wrapper for plVNodeMgr class. - -#ifndef pyVNodeMgr_h_inc -#define pyVNodeMgr_h_inc - -#include "../plVault/plVaultClient.h" -#include "../plNetClientComm/plNetClientComm.h" - -#include "../FeatureLib/pfPython/pyGlueHelpers.h" -#include - -//////////////////////////////////////////////////////////////////// - -class pyVaultNode; -class pyVaultCallback; -class pyStatusLog; -class pyNetClientComm; -class pyVaultFolderNode; - -//////////////////////////////////////////////////////////////////// - -class pyVNodeMgr : public plVNodeMgr -{ -private: - typedef std::vector PyCallbackVec; - PyCallbackVec fPyCallbacks; - - class VaultMsgHandler : public plNetClientComm::MsgHandler - { - private: - pyVNodeMgr * fMyVNodeMgr; - int HandleMessage( plNetMessage* msg ); - public: - VaultMsgHandler(): fMyVNodeMgr(nil) {} - void setMgr(pyVNodeMgr * thaNodeMgr) {fMyVNodeMgr = thaNodeMgr;} - }; - friend class VaultMsgHandler; - VaultMsgHandler fMsgHandler; - -protected: - PyObject* fMyCommObj; - pyNetClientComm* fMyComm; // pointer to object stored in fMyCommObj - - bool IAmOnline() const; - bool IIsThisMe( plVaultPlayerInfoNode* node ) const; - bool IIsThisMe( plVaultPlayerNode * node ) const; - int ISendNetMsg( plNetMsgVault* msg, uint32_t sendFlags=0 ); - uint32_t IGetPlayerID() const; - - pyVNodeMgr(): fMyComm(nil) {fMsgHandler.setMgr(this);} // for python glue only, do NOT call - pyVNodeMgr( PyObject* thaComm ); - -public: - ~pyVNodeMgr(); - - void setMyComm(PyObject* thaComm); // for python glue only, do NOT call - - // required functions for PyObject interoperability - PYTHON_EXPOSE_TYPE; - PYTHON_CLASS_NEW_FRIEND(ptVNodeMgr); - static PyObject* New(PyObject* thaComm); - PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVNodeMgr object - PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVNodeMgr); // converts a PyObject to a pyVNodeMgr (throws error if not correct type) - - static void AddPlasmaClasses(PyObject *m); - - PyObject * GetNetClient() const { Py_INCREF(fMyCommObj); return fMyCommObj; } // returns pyNetClientComm - - ///////////////////////////////////////////////// - // Vault Client API - - int Update( double secs ); - - void Startup(); - void Shutdown(); - - // connect/disconnect - bool IsConnected(); - void Disconnect( - PyObject* cb=nil, - uint32_t cbContext=0 ); - void Connect( - int childFetchLevel=plVault::kFetchAllChildren, - PyObject* cb=nil, - uint32_t cbContext=0 ); - // TODO: Glue this. - // Fetch matching node from server and hold onto it. - // Note: You won't receive notifications about the fetched node or - // it's children until it has been added to your root node or any - // of it's children. -// bool FetchNode( -// pyVaultNode* templateNode, -// int childFetchLevel=plVault::kFetchAllChildren, -// bool allowCreate = false, -// PyObject* cb=nil, -// uint32_t cbContext=0 ); - bool FetchNode( uint32_t nodeID, - int childFetchLevel=plVault::kFetchAllChildren, - PyObject* cb=nil, - uint32_t cbContext=0 ); - - // get our root node - PyObject* GetRootNode() const; // returns pyVaultNode - // get the client node ID returned to us by the server ( if we didn't - // fetch when we connected then we have to use this to identify ourselves ). - uint32_t GetClientID() const; - // search all nodes in client locally - PyObject* GetNode( uint32_t id ) const; // returns pyVaultNode - // TODO: Glue these. - PyObject* FindNode( pyVaultNode* templateNode ) const; // returns pyVaultNode -// bool FindNodes( const pyVaultNode* templateNode, PyObject * out ) const; - // callback management - bool EnableCallbacks( bool b ); // returns previous enabled setting. - void AddCallback( PyObject* cb ); - void RemoveCallback( PyObject* cb ); - - // create a node of the given type. - PyObject* CreateNode( int nodeType, bool persistent ); // returns pyVaultNode - - // dump contents to log - void Dump() const; -}; - -//////////////////////////////////////////////////////////////////// - -class pyPlayerVNodeMgr : public pyVNodeMgr -{ -protected: - bool IAmSuperUser( void ) const; - void IFillOutConnectFields( plNetMsgVault* msg ) const; - plVNodeInitTask * IGetNodeInitializationTask( plVaultNode * node ); - - pyPlayerVNodeMgr(): pyVNodeMgr() {} // for python glue only, do NOT call - pyPlayerVNodeMgr( PyObject* thaComm ); - -public: - // required functions for PyObject interoperability - PYTHON_CLASS_NEW_FRIEND(ptPlayerVNodeMgr); - static PyObject* New(PyObject* thaComm); - PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyPlayerVNodeMgr object - PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyPlayerVNodeMgr); // converts a PyObject to a pyPlayerVNodeMgr (throws error if not correct type) - - static void AddPlasmaClasses(PyObject *m); -}; - -//////////////////////////////////////////////////////////////////// - -class pyAgeVNodeMgr : public pyVNodeMgr -{ - std::string fAgeFilename; - plServerGuid fAgeInstanceGuid; - -protected: - bool IAmSuperUser( void ) const; - void IFillOutConnectFields( plNetMsgVault* msg ) const; - plVNodeInitTask * IGetNodeInitializationTask( plVaultNode * node ); - - pyAgeVNodeMgr(): pyVNodeMgr() {} // for python glue only, do NOT call - pyAgeVNodeMgr( PyObject* thaComm ); - -public: - // required functions for PyObject interoperability - PYTHON_CLASS_NEW_FRIEND(ptAgeVNodeMgr); - static PyObject* New(PyObject* thaComm); - PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyAgeVNodeMgr object - PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyAgeVNodeMgr); // converts a PyObject to a pyAgeVNodeMgr (throws error if not correct type) - - static void AddPlasmaClasses(PyObject *m); - - void SetAgeInfo( const char * ageFilename, const char * ageInstanceGuid ); -}; - -//////////////////////////////////////////////////////////////////// - -class pyAdminVNodeMgr : public pyVNodeMgr -{ -private: - bool fWantGlobalSDL; - bool fWantAllPlayers; - -protected: - bool IAmSuperUser( void ) const; - void IFillOutConnectFields( plNetMsgVault* msg ) const; - plVNodeInitTask * IGetNodeInitializationTask( plVaultNode * node ); - - pyAdminVNodeMgr(): pyVNodeMgr(), fWantGlobalSDL(true), fWantAllPlayers(false) {} // for python glue only, do NOT call - pyAdminVNodeMgr( PyObject* thaComm ); - -public: - // required functions for PyObject interoperability - PYTHON_CLASS_NEW_FRIEND(ptAdminVNodeMgr); - static PyObject* New(PyObject* thaComm); - PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyAdminVNodeMgr object - PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyAdminVNodeMgr); // converts a PyObject to a pyAdminVNodeMgr (throws error if not correct type) - - static void AddPlasmaClasses(PyObject *m); - - void SetWantGlobalSDL( bool v ) { fWantGlobalSDL=v; } - void SetWantAllPlayers( bool v ) { fWantAllPlayers=v; } - - PyObject * GetGlobalInbox() const; // returns pyVaultFolderNode -}; - -//////////////////////////////////////////////////////////////////// -#endif // pyVNodeMgr_h_inc diff --git a/Sources/Plasma/PythonLib/pyVault/pyVNodeMgrGlue.cpp b/Sources/Plasma/PythonLib/pyVault/pyVNodeMgrGlue.cpp deleted file mode 100644 index f722f9cd..00000000 --- a/Sources/Plasma/PythonLib/pyVault/pyVNodeMgrGlue.cpp +++ /dev/null @@ -1,477 +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 . - -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 "pyVNodeMgr.h" -#include "../FeatureLib/pfPython/pyVaultNode.h" -#include "../pyNetClientComm/pyNetClientComm.h" - -#include - -// glue functions -PYTHON_CLASS_DEFINITION(ptVNodeMgr, pyVNodeMgr); - -PYTHON_DEFAULT_NEW_DEFINITION(ptVNodeMgr, pyVNodeMgr) -PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVNodeMgr) - -PYTHON_NO_INIT_DEFINITION(ptVNodeMgr) - -PYTHON_METHOD_DEFINITION(ptVNodeMgr, update, args) -{ - double secs; - if (!PyArg_ParseTuple(args, "d", &secs)) - { - PyErr_SetString(PyExc_TypeError, "update expects a double"); - PYTHON_RETURN_ERROR; - } - return PyInt_FromLong(self->fThis->Update(secs)); -} - -PYTHON_BASIC_METHOD_DEFINITION(ptVNodeMgr, startup, Startup) -PYTHON_BASIC_METHOD_DEFINITION(ptVNodeMgr, shutdown, Shutdown) - -PYTHON_METHOD_DEFINITION_NOARGS(ptVNodeMgr, isConnected) -{ - PYTHON_RETURN_BOOL(self->fThis->IsConnected()); -} - -PYTHON_METHOD_DEFINITION(ptVNodeMgr, disconnect, args) -{ - PyObject* cb = NULL; - unsigned long context = 0; - if (!PyArg_ParseTuple(args, "|Ol", &cb, &context)) - { - PyErr_SetString(PyExc_TypeError, "disconnect expects an optional object, and an optional unsigned long"); - PYTHON_RETURN_ERROR; - } - self->fThis->Disconnect(cb, context); - PYTHON_RETURN_NONE; -} - -PYTHON_METHOD_DEFINITION(ptVNodeMgr, connect, args) -{ - int childFetchLevel = -1; - PyObject* cb = NULL; - unsigned long context = 0; - if (!PyArg_ParseTuple(args, "|iOl", &childFetchLevel, &cb, &context)) - { - PyErr_SetString(PyExc_TypeError, "connect expects an optional int, an optional object, and an optional unsigned long"); - PYTHON_RETURN_ERROR; - } - self->fThis->Connect(childFetchLevel, cb, context); - PYTHON_RETURN_NONE; -} - -PYTHON_METHOD_DEFINITION(ptVNodeMgr, fetchNode, args) -{ - unsigned long nodeID; - int childFetchLevel = -1; - PyObject* cb = NULL; - unsigned long context = 0; - if (!PyArg_ParseTuple(args, "l|iOl", &nodeID, &childFetchLevel, &cb, &context)) - { - PyErr_SetString(PyExc_TypeError, "fetchNode expects an unsigned long, an optional int, an optional object, and an optional unsigned long"); - PYTHON_RETURN_ERROR; - } - PYTHON_RETURN_BOOL(self->fThis->FetchNode(nodeID, childFetchLevel, cb, context)); -} - -PYTHON_METHOD_DEFINITION_NOARGS(ptVNodeMgr, getRootNode) -{ - return self->fThis->GetRootNode(); -} - -PYTHON_METHOD_DEFINITION_NOARGS(ptVNodeMgr, getClientID) -{ - return PyLong_FromUnsignedLong(self->fThis->GetClientID()); -} - -PYTHON_METHOD_DEFINITION(ptVNodeMgr, getNode, args) -{ - unsigned long nodeID; - if (!PyArg_ParseTuple(args, "l", &nodeID)) - { - PyErr_SetString(PyExc_TypeError, "getNode expects an unsigned long"); - PYTHON_RETURN_ERROR; - } - return self->fThis->GetNode(nodeID); -} - -PYTHON_METHOD_DEFINITION(ptVNodeMgr, findNode, args) -{ - PyObject* templateObj = NULL; - if (!PyArg_ParseTuple(args, "O", &templateObj)) - { - PyErr_SetString(PyExc_TypeError, "findNode expects a ptVaultNode"); - PYTHON_RETURN_ERROR; - } - if (!pyVaultNode::Check(templateObj)) - { - PyErr_SetString(PyExc_TypeError, "findNode expects a ptVaultNode"); - PYTHON_RETURN_ERROR; - } - pyVaultNode* templateNode = pyVaultNode::ConvertFrom(templateObj); - return self->fThis->FindNode(templateNode); -} - -PYTHON_METHOD_DEFINITION(ptVNodeMgr, enableCallbacks, args) -{ - char enable; - if (!PyArg_ParseTuple(args, "b", &enable)) - { - PyErr_SetString(PyExc_TypeError, "enableCallbacks expects a boolean"); - PYTHON_RETURN_ERROR; - } - PYTHON_RETURN_BOOL(self->fThis->EnableCallbacks(enable != 0)); -} - -PYTHON_METHOD_DEFINITION(ptVNodeMgr, addCallback, args) -{ - PyObject* cb = NULL; - if (!PyArg_ParseTuple(args, "O", &cb)) - { - PyErr_SetString(PyExc_TypeError, "addCallback expects an object"); - PYTHON_RETURN_ERROR; - } - self->fThis->AddCallback(cb); - PYTHON_RETURN_NONE; -} - -PYTHON_METHOD_DEFINITION(ptVNodeMgr, removeCallback, args) -{ - PyObject* cb = NULL; - if (!PyArg_ParseTuple(args, "O", &cb)) - { - PyErr_SetString(PyExc_TypeError, "removeCallback expects an object"); - PYTHON_RETURN_ERROR; - } - self->fThis->RemoveCallback(cb); - PYTHON_RETURN_NONE; -} - -PYTHON_METHOD_DEFINITION(ptVNodeMgr, createNode, args) -{ - int nodeType; - bool persistent; - if (!PyArg_ParseTuple(args, "ib", &nodeType, &persistent)) - { - PyErr_SetString(PyExc_TypeError, "createNode expects an int and a boolean"); - PYTHON_RETURN_ERROR; - } - return self->fThis->CreateNode(nodeType, persistent != 0); -} - -PYTHON_METHOD_DEFINITION_NOARGS(ptVNodeMgr, getNetClient) -{ - return self->fThis->GetNetClient(); -} - -PYTHON_BASIC_METHOD_DEFINITION(ptVNodeMgr, dump, Dump) - -PYTHON_START_METHODS_TABLE(ptVNodeMgr) - PYTHON_METHOD(ptVNodeMgr, update, "Params: secs\nUNKNOWN"), - PYTHON_BASIC_METHOD(ptVNodeMgr, startup, "UNKNOWN"), - PYTHON_BASIC_METHOD(ptVNodeMgr, shutdown, "UNKNOWN"), - PYTHON_METHOD_NOARGS(ptVNodeMgr, isConnected, "Are we connected to the vault?"), - PYTHON_METHOD(ptVNodeMgr, disconnect, "Params: callback=None,cbContext=0\nDisconnects us from the vault"), - PYTHON_METHOD(ptVNodeMgr, connect, "Params: childFetchLevel=-1,callback=None,cbContext=0\nConnects us ti the vault"), - PYTHON_METHOD(ptVNodeMgr, fetchNode, "Params: nodeID,childFetchLevel=-1,callback=None,cbContext=0\nFetchs the specified node"), - PYTHON_METHOD_NOARGS(ptVNodeMgr, getRootNode, "Returns the root node"), - PYTHON_METHOD_NOARGS(ptVNodeMgr, getClientID, "Returns the client ID number"), - PYTHON_METHOD(ptVNodeMgr, getNode, "Params: nodeID\nReturns the specified node"), - PYTHON_METHOD(ptVNodeMgr, findNode, "Params: templateNode\nLocates a node matching the template"), - PYTHON_METHOD(ptVNodeMgr, enableCallbacks, "Params: enable\nEnable/disable callbacks"), - PYTHON_METHOD(ptVNodeMgr, addCallback, "Params: callback\nUNKNOWN"), - PYTHON_METHOD(ptVNodeMgr, removeCallback, "Params: callback\nUNKNOWN"), - PYTHON_METHOD(ptVNodeMgr, createNode, "Params: nodeType,persistent\nCreates a new node"), - PYTHON_METHOD(ptVNodeMgr, getNetClient, "Returns our internal ptNetClientComm"), - PYTHON_BASIC_METHOD(ptVNodeMgr, dump, "Dump contents to our log"), -PYTHON_END_METHODS_TABLE; - -// Type structure definition -PLASMA_DEFAULT_TYPE(ptVNodeMgr, "UNKNOWN"); -PYTHON_EXPOSE_TYPE_DEFINITION(ptVNodeMgr, pyVNodeMgr); - -// required functions for PyObject interoperability -PyObject *pyVNodeMgr::New(PyObject* thaComm) -{ - ptVNodeMgr *newObj = (ptVNodeMgr*)ptVNodeMgr_type.tp_new(&ptVNodeMgr_type, NULL, NULL); - if (!pyNetClientComm::Check(thaComm)) - { - Py_DECREF(newObj); - return NULL; // bad parameter - } - newObj->fThis->setMyComm(thaComm); - return (PyObject*)newObj; -} - -PYTHON_CLASS_CHECK_IMPL(ptVNodeMgr, pyVNodeMgr) -PYTHON_CLASS_CONVERT_FROM_IMPL(ptVNodeMgr, pyVNodeMgr) - -/////////////////////////////////////////////////////////////////////////// -// -// AddPlasmaClasses - the python module definitions -// -void pyVNodeMgr::AddPlasmaClasses(PyObject *m) -{ - PYTHON_CLASS_IMPORT_START(m); - PYTHON_CLASS_IMPORT(m, ptVNodeMgr); - PYTHON_CLASS_IMPORT_END(m); -} - -/////////////////////////////////////////////////////////////////////////////// - -// glue functions -PYTHON_CLASS_DEFINITION(ptPlayerVNodeMgr, pyPlayerVNodeMgr); - -PYTHON_DEFAULT_NEW_DEFINITION(ptPlayerVNodeMgr, pyPlayerVNodeMgr) -PYTHON_DEFAULT_DEALLOC_DEFINITION(ptPlayerVNodeMgr) - -PYTHON_INIT_DEFINITION(ptPlayerVNodeMgr, args, keywords) -{ - PyObject* netClientComm = NULL; - if (!PyArg_ParseTuple(args, "O", &netClientComm)) - { - PyErr_SetString(PyExc_TypeError, "__init__ expects a ptNetClientComm"); - PYTHON_RETURN_INIT_ERROR; - } - if (!pyNetClientComm::Check(netClientComm)) - { - PyErr_SetString(PyExc_TypeError, "__init__ expects a ptNetClientComm"); - PYTHON_RETURN_INIT_ERROR; - } - self->fThis->setMyComm(netClientComm); - PYTHON_RETURN_INIT_OK; -} - -PYTHON_START_METHODS_TABLE(ptPlayerVNodeMgr) -PYTHON_END_METHODS_TABLE; - -// Type structure definition -PLASMA_DEFAULT_TYPE_WBASE(ptPlayerVNodeMgr, pyVNodeMgr, "UNKNOWN"); - -// required functions for PyObject interoperability -PyObject *pyPlayerVNodeMgr::New(PyObject* thaComm) -{ - ptPlayerVNodeMgr *newObj = (ptPlayerVNodeMgr*)ptPlayerVNodeMgr_type.tp_new(&ptPlayerVNodeMgr_type, NULL, NULL); - if (!pyNetClientComm::Check(thaComm)) - { - Py_DECREF(newObj); - return NULL; // bad parameter - } - newObj->fThis->setMyComm(thaComm); - return (PyObject*)newObj; -} - -PYTHON_CLASS_CHECK_IMPL(ptPlayerVNodeMgr, pyPlayerVNodeMgr) -PYTHON_CLASS_CONVERT_FROM_IMPL(ptPlayerVNodeMgr, pyPlayerVNodeMgr) - -/////////////////////////////////////////////////////////////////////////// -// -// AddPlasmaClasses - the python module definitions -// -void pyPlayerVNodeMgr::AddPlasmaClasses(PyObject *m) -{ - PYTHON_CLASS_IMPORT_START(m); - PYTHON_CLASS_IMPORT(m, ptPlayerVNodeMgr); - PYTHON_CLASS_IMPORT_END(m); -} - -/////////////////////////////////////////////////////////////////////////////// - -// glue functions -PYTHON_CLASS_DEFINITION(ptAgeVNodeMgr, pyAgeVNodeMgr); - -PYTHON_DEFAULT_NEW_DEFINITION(ptAgeVNodeMgr, pyAgeVNodeMgr) -PYTHON_DEFAULT_DEALLOC_DEFINITION(ptAgeVNodeMgr) - -PYTHON_INIT_DEFINITION(ptAgeVNodeMgr, args, keywords) -{ - PyObject* netClientComm = NULL; - if (!PyArg_ParseTuple(args, "O", &netClientComm)) - { - PyErr_SetString(PyExc_TypeError, "__init__ expects a ptNetClientComm"); - PYTHON_RETURN_INIT_ERROR; - } - if (!pyNetClientComm::Check(netClientComm)) - { - PyErr_SetString(PyExc_TypeError, "__init__ expects a ptNetClientComm"); - PYTHON_RETURN_INIT_ERROR; - } - self->fThis->setMyComm(netClientComm); - PYTHON_RETURN_INIT_OK; -} - -PYTHON_METHOD_DEFINITION(ptAgeVNodeMgr, setAgeInfo, args) -{ - char* filename; - char* guid; - if (!PyArg_ParseTuple(args, "ss", &filename, &guid)) - { - PyErr_SetString(PyExc_TypeError, "setAgeInfo expects two strings"); - PYTHON_RETURN_ERROR; - } - self->fThis->SetAgeInfo(filename, guid); - PYTHON_RETURN_NONE; -} - -PYTHON_START_METHODS_TABLE(ptAgeVNodeMgr) - PYTHON_METHOD(ptAgeVNodeMgr, setAgeInfo, "Params: filename,guid\nUNKNOWN"), -PYTHON_END_METHODS_TABLE; - -// Type structure definition -PLASMA_DEFAULT_TYPE_WBASE(ptAgeVNodeMgr, pyVNodeMgr, "UNKNOWN"); - -// required functions for PyObject interoperability -PyObject *pyAgeVNodeMgr::New(PyObject* thaComm) -{ - ptAgeVNodeMgr *newObj = (ptAgeVNodeMgr*)ptAgeVNodeMgr_type.tp_new(&ptAgeVNodeMgr_type, NULL, NULL); - if (!pyNetClientComm::Check(thaComm)) - { - Py_DECREF(newObj); - return NULL; // bad parameter - } - newObj->fThis->setMyComm(thaComm); - return (PyObject*)newObj; -} - -PYTHON_CLASS_CHECK_IMPL(ptAgeVNodeMgr, pyAgeVNodeMgr) -PYTHON_CLASS_CONVERT_FROM_IMPL(ptAgeVNodeMgr, pyAgeVNodeMgr) - -/////////////////////////////////////////////////////////////////////////// -// -// AddPlasmaClasses - the python module definitions -// -void pyAgeVNodeMgr::AddPlasmaClasses(PyObject *m) -{ - PYTHON_CLASS_IMPORT_START(m); - PYTHON_CLASS_IMPORT(m, ptAgeVNodeMgr); - PYTHON_CLASS_IMPORT_END(m); -} - -/////////////////////////////////////////////////////////////////////////////// - -// glue functions -PYTHON_CLASS_DEFINITION(ptAdminVNodeMgr, pyAdminVNodeMgr); - -PYTHON_DEFAULT_NEW_DEFINITION(ptAdminVNodeMgr, pyAdminVNodeMgr) -PYTHON_DEFAULT_DEALLOC_DEFINITION(ptAdminVNodeMgr) - -PYTHON_INIT_DEFINITION(ptAdminVNodeMgr, args, keywords) -{ - PyObject* netClientComm = NULL; - if (!PyArg_ParseTuple(args, "O", &netClientComm)) - { - PyErr_SetString(PyExc_TypeError, "__init__ expects a ptNetClientComm"); - PYTHON_RETURN_INIT_ERROR; - } - if (!pyNetClientComm::Check(netClientComm)) - { - PyErr_SetString(PyExc_TypeError, "__init__ expects a ptNetClientComm"); - PYTHON_RETURN_INIT_ERROR; - } - self->fThis->setMyComm(netClientComm); - PYTHON_RETURN_INIT_OK; -} - -PYTHON_METHOD_DEFINITION(ptAdminVNodeMgr, setWantGlobalSDL, args) -{ - bool flag; - if (!PyArg_ParseTuple(args, "b", &flag)) - { - PyErr_SetString(PyExc_TypeError, "setWantGlobalSDL expects a boolean"); - PYTHON_RETURN_ERROR; - } - self->fThis->SetWantGlobalSDL(flag != 0); - PYTHON_RETURN_NONE; -} - -PYTHON_METHOD_DEFINITION(ptAdminVNodeMgr, setWantAllPlayers, args) -{ - bool flag; - if (!PyArg_ParseTuple(args, "b", &flag)) - { - PyErr_SetString(PyExc_TypeError, "setWantAllPlayers expects a boolean"); - PYTHON_RETURN_ERROR; - } - self->fThis->SetWantAllPlayers(flag != 0); - PYTHON_RETURN_NONE; -} - -PYTHON_METHOD_DEFINITION_NOARGS(ptAdminVNodeMgr, getGlobalInbox) -{ - return self->fThis->GetGlobalInbox(); -} - -PYTHON_START_METHODS_TABLE(ptAdminVNodeMgr) - PYTHON_METHOD(ptAdminVNodeMgr, setWantGlobalSDL, "Params: flag\nUNKNOWN"), - PYTHON_METHOD(ptAdminVNodeMgr, setWantAllPlayers, "Params: flag\nUNKNOWN"), - PYTHON_METHOD_NOARGS(ptAdminVNodeMgr, getGlobalInbox, "UNKNOWN"), -PYTHON_END_METHODS_TABLE; - -// Type structure definition -PLASMA_DEFAULT_TYPE_WBASE(ptAdminVNodeMgr, pyVNodeMgr, "UNKNOWN"); - -// required functions for PyObject interoperability -PyObject *pyAdminVNodeMgr::New(PyObject* thaComm) -{ - ptAdminVNodeMgr *newObj = (ptAdminVNodeMgr*)ptAdminVNodeMgr_type.tp_new(&ptAdminVNodeMgr_type, NULL, NULL); - if (!pyNetClientComm::Check(thaComm)) - { - Py_DECREF(newObj); - return NULL; // bad parameter - } - newObj->fThis->setMyComm(thaComm); - return (PyObject*)newObj; -} - -PYTHON_CLASS_CHECK_IMPL(ptAdminVNodeMgr, pyAdminVNodeMgr) -PYTHON_CLASS_CONVERT_FROM_IMPL(ptAdminVNodeMgr, pyAdminVNodeMgr) - -/////////////////////////////////////////////////////////////////////////// -// -// AddPlasmaClasses - the python module definitions -// -void pyAdminVNodeMgr::AddPlasmaClasses(PyObject *m) -{ - PYTHON_CLASS_IMPORT_START(m); - PYTHON_CLASS_IMPORT(m, ptAdminVNodeMgr); - PYTHON_CLASS_IMPORT_END(m); -} \ No newline at end of file diff --git a/Sources/Tools/CMakeLists.txt b/Sources/Tools/CMakeLists.txt index ffc86803..67111a9a 100644 --- a/Sources/Tools/CMakeLists.txt +++ b/Sources/Tools/CMakeLists.txt @@ -1,5 +1,3 @@ -#add_subdirectory(Migration) -#add_subdirectory(plDatMerger) add_subdirectory(plLocalizationEditor) add_subdirectory(plResBrowser) @@ -15,7 +13,6 @@ if(3dsm_BUILD_PLUGIN) add_subdirectory(MaxConvert) add_subdirectory(MaxExport) add_subdirectory(MaxMain) - #add_subdirectory(MaxMtlUpdate) add_subdirectory(MaxPlasmaLights) add_subdirectory(MaxPlasmaMtls) #add_subdirectory(MaxSceneViewer) # NOTE: Uses Plasma classes that do not exist diff --git a/Sources/Tools/CheckFolderVar/CheckFolderVar.cpp b/Sources/Tools/CheckFolderVar/CheckFolderVar.cpp deleted file mode 100644 index 73152195..00000000 --- a/Sources/Tools/CheckFolderVar/CheckFolderVar.cpp +++ /dev/null @@ -1,166 +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 . - -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==*/ -//////////////////////////////////////////////////////////////////// -// This little app checks to see if the specified envrionment -// variable exists, creating it if necessary. If the variable -// doesn't exist, the app prompts the user with the Browse for -// Folder dialog box then sets the envrionment variable, using the -// selected folder as the value. -// -// Example: -// C:\>CheckFolderVar maxr4dir "Select the folder where max is installed then click Ok." -// - - -//////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include - -//////////////////////////////////////////////////////////////////// - -std::string gCurrentValue; - -// get window handle of cancel button so we can disable it. -BOOL CALLBACK EnumChildWindowsCallbackProc(HWND hwnd,LPARAM lParam) -{ - char text[256]; - GetWindowText(hwnd,text,256); - if (stricmp(text,"Cancel")==0) - { - *((HWND*)lParam) = hwnd; - return FALSE; - } - return TRUE; -} - -int CALLBACK BrosweForFolderCallbackProc(HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData) -{ - switch(uMsg) - { - case BFFM_INITIALIZED: - // disable cancel button - HWND hCancelBtn = NULL; - EnumChildWindows(hwnd,EnumChildWindowsCallbackProc,(LPARAM)&hCancelBtn); - EnableWindow(hCancelBtn,FALSE); - SendMessage(hwnd,BFFM_SETSELECTION,true,(LPARAM)gCurrentValue.data()); - break; - } - return 0; -} - -//////////////////////////////////////////////////////////////////// -int main(int argc, char ** argv) -{ - if (argc<2) - { - fprintf(stderr,"Usage: CheckFolderVar varname [-replace] [\"prompt msg\"]\n"); - return EXIT_FAILURE; - } - - // read cmdline - char ** args = argv; - char * varname = NULL; - bool replace = false; - char prompt[1024] = ""; - for (int i=1; iFree(itemList); - shMalloc->Release(); - - // set environment var - RegSetValueEx(hEnvKey,varname,0,REG_SZ,(const BYTE*)value,strlen(value)); - - // close registry key - RegCloseKey(hEnvKey); - - // bubbye - return EXIT_SUCCESS; -} diff --git a/Sources/Tools/MaxAss/ValdezInterface.h b/Sources/Tools/MaxAss/ValdezInterface.h deleted file mode 100644 index c67f6187..00000000 --- a/Sources/Tools/MaxAss/ValdezInterface.h +++ /dev/null @@ -1,112 +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 . - -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==*/ -/****************************************************************************** - ValdezInterface.h - - Eric Ellis -******************************************************************************/ - -#ifndef _JV_VALDEZINTERFACE_H_ -#define _JV_VALDEZINTERFACE_H_ - -#define MAXASS_CLASS_ID Class_ID(0x5c61b5a6, 0x3b298521) -#define kMaxAssGetValdezInterface 33 - -#include -#include -#include -#include -#include -#include - -using std::vector; -using std::string; - -#pragma warning(disable:4786) - - -#define kAssetTypeIdTexure 1 -#define kAssetTypeIdSound 2 -#define kAssetTypeIdMaxFile 4 -#define kAssetTypeIdAge 7 - -#define kStatusIdDraft 1 -#define kStatusIdStable 2 - - - -class jvValdezInterface -{ -public: - // MAX File Replacement Operations - virtual int ChooseAssetAndOpen() = 0; - virtual int Save() = 0; - virtual int SaveAs() = 0; - virtual int Add() = 0; - virtual int OpenBitmapDlg(VARIANT* assetId, TCHAR* localFilenameRet, int localFilenameBufSize) = 0; - virtual int OpenSoundDlg(VARIANT* assetId, TCHAR* localFilenameRet, int localFilenameBufSize) = 0; - virtual int NewAgeDlg(VARIANT* assetId, TCHAR* localFilenameRet, int localFilenameBufSize) = 0; - virtual int NewTextureDlg(VARIANT* assetId, TCHAR* localFilenameRet, int localFilenameBufSize) = 0; - - // Asset Database Operations - virtual int GetLatestVersionFile(VARIANT& assetId, TCHAR* localFilenameRet, int localFilenameBufSize) = 0; - virtual int GetAssetsByType(int assetTypeId, vector<_variant_t>& assetIds, vector& assetNames) = 0; - virtual int CheckOutAsset(VARIANT& assetId, TCHAR* localFilenameRet, int localFilenameBufSize) = 0; - virtual int CheckInAsset(VARIANT& assetId, TCHAR* localFilename, int statusId, TCHAR* comments) = 0; - - virtual int FindAndCompareAssetByFilename(const TCHAR* localFilename, VARIANT* assetId, bool* filesMatch) = 0; - virtual int FindAssetsByFilename(const TCHAR* filename, vector<_variant_t>& assets) = 0; - - virtual int IsAssetCheckedOutLocally(VARIANT& assetId, bool& checkedOut) = 0; -}; - - -inline jvValdezInterface* GetValdezInterface() -{ - GUP* maxAssGup = OpenGupPlugIn(MAXASS_CLASS_ID); - - if(!maxAssGup) return NULL; - - return (jvValdezInterface*)maxAssGup->Control(kMaxAssGetValdezInterface); -} - -#endif _JV_VALDEZINTERFACE_H_ diff --git a/Sources/Tools/MaxMain/CMakeLists.txt b/Sources/Tools/MaxMain/CMakeLists.txt index b4bc8747..8eb3773f 100644 --- a/Sources/Tools/MaxMain/CMakeLists.txt +++ b/Sources/Tools/MaxMain/CMakeLists.txt @@ -117,7 +117,6 @@ target_link_libraries(MaxMain pfCCR) target_link_libraries(MaxMain pfCharacter) target_link_libraries(MaxMain pfConditional) target_link_libraries(MaxMain pfConsole) -target_link_libraries(MaxMain pfCsrSrv) target_link_libraries(MaxMain pfGameGUIMgr) target_link_libraries(MaxMain pfGameMgr) target_link_libraries(MaxMain pfGameScoreMgr) @@ -175,7 +174,6 @@ target_link_libraries(MaxMain plVault) target_link_libraries(MaxMain pnAddrInfo) target_link_libraries(MaxMain pnAsyncCore) target_link_libraries(MaxMain pnAsyncCoreExe) -target_link_libraries(MaxMain pnCsrNet) target_link_libraries(MaxMain pnDispatch) target_link_libraries(MaxMain pnEncryption) target_link_libraries(MaxMain pnFactory) @@ -191,7 +189,6 @@ target_link_libraries(MaxMain pnNetProtocol) target_link_libraries(MaxMain pnNucleusInc) target_link_libraries(MaxMain pnProduct) target_link_libraries(MaxMain pnSceneObject) -target_link_libraries(MaxMain pnSimpleNet) target_link_libraries(MaxMain pnTimer) target_link_libraries(MaxMain pnUtils) target_link_libraries(MaxMain pnUtilsExe) diff --git a/Sources/Tools/MaxMtlUpdate/DllEntry.cpp b/Sources/Tools/MaxMtlUpdate/DllEntry.cpp deleted file mode 100644 index 28c3afe2..00000000 --- a/Sources/Tools/MaxMtlUpdate/DllEntry.cpp +++ /dev/null @@ -1,107 +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 . - -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==*/ -/********************************************************************** - *< - FILE: DllEntry.cpp - - DESCRIPTION: Contains the Dll Entry stuff - - CREATED BY: - - HISTORY: - - *> Copyright (c) 2000, All Rights Reserved. - **********************************************************************/ -#include "plMaterialUpdate.h" - -extern ClassDesc2* GetMaterialUpdateDesc(); - -HINSTANCE hInstance; -int controlsInit = FALSE; - - -BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) -{ - hInstance = hinstDLL; // Hang on to this DLL's instance handle. - - if (!controlsInit) { - controlsInit = TRUE; - InitCustomControls(hInstance); // Initialize MAX's custom controls - InitCommonControls(); // Initialize Win95 controls - } - - return (TRUE); -} - -__declspec( dllexport ) const TCHAR* LibDescription() -{ - return GetString(IDS_LIBDESCRIPTION); -} - -//TODO: Must change this number when adding a new class -__declspec( dllexport ) int LibNumberClasses() -{ - return 1; -} - -__declspec( dllexport ) ClassDesc* LibClassDesc(int i) -{ - switch(i) { - case 0: return GetMaterialUpdateDesc(); - default: return 0; - } -} - -__declspec( dllexport ) ULONG LibVersion() -{ - return VERSION_3DSMAX; -} - -TCHAR *GetString(int id) -{ - static TCHAR buf[256]; - - if (hInstance) - return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL; - return NULL; -} - diff --git a/Sources/Tools/MaxMtlUpdate/OldMat/hsMaxLayer.h b/Sources/Tools/MaxMtlUpdate/OldMat/hsMaxLayer.h deleted file mode 100644 index 78f973bc..00000000 --- a/Sources/Tools/MaxMtlUpdate/OldMat/hsMaxLayer.h +++ /dev/null @@ -1,437 +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 . - -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 __HSMAXLAYER_H -#define __HSMAXLAYER_H - -#include -#include "hsMaxLayerBase.h" -//#include "hsMaxMtlRes.h" - -//========================================================================================= -// Flags and constants... -//========================================================================================= - -// ParamBlock entries -#define PB_LAYER_CLIPU 0 -#define PB_LAYER_CLIPV 1 -#define PB_LAYER_CLIPW 2 -#define PB_LAYER_CLIPH 3 -#define PB_LAYER_JITTER 4 -#define PB_LAYER_AMBIENT 5 -#define PB_LAYER_COLOR 6 -#define PB_LAYER_SHININESS 7 -#define PB_LAYER_SHIN_STR 8 -#define PB_LAYER_SELFI 9 -#define PB_LAYER_OPAC 10 -#define PB_LAYER_OPFALL 11 -#define PB_LAYER_FILTER 12 -#define PB_LAYER_WIRESZ 13 -#define PB_LAYER_IOR 14 -#define PB_LAYER_BOUNCE 15 -#define PB_LAYER_STATFRIC 16 -#define PB_LAYER_SLIDFRIC 17 -#define PB_LAYER_DIMLEV 18 -#define PB_LAYER_DIMMULT 19 -#define PB_LAYER_MAPPERCENT 20 -#define PB_LAYER_MIPMAPBLUR 21 -#define PB_LAYER_LODBIAS 22 -#define PB_LAYER_DETAILBIAS 23 -#define PB_LAYER_DETAILMAX 24 -#define PB_LAYER_ENVIRONMAPSIZE 25 -#define LAYER_NPARAMS 26 - -#define HSMAX_LAYER_LOCK_AD 0x1 - -class hsMaxLayer; -class hsMaxLayerDlg; - -static LRESULT CALLBACK HiliteWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); - -// which edit control enum -enum EditControl {Hc, Sc, Vc, Rc, Gc, Bc}; - -void GetBMName(BitmapInfo& bi, TSTR &fname); - -//========================================================================================= -// BMSampler -//========================================================================================= - -class BMSampler : public MapSampler { - Bitmap *bm; - hsMaxLayer *tex; - int alphaSource; - float u0,v0,u1,v1,ufac,vfac,ujit,vjit; - int bmw,bmh,clipx, clipy, cliph; - float fclipw,fcliph, fbmh, fbmw; -public: - BMSampler() { bm = NULL; } - void Init(hsMaxLayer *bmt); - int PlaceUV(ShadeContext& sc, float &u, float &v, int iu, int iv); - void PlaceUVFilter(ShadeContext& sc, float &u, float &v, int iu, int iv); - AColor Sample(ShadeContext& sc, float u,float v); - AColor SampleFilter(ShadeContext& sc, float u,float v, float du, float dv); - // float SampleMono(ShadeContext& sc, float u,float v); - // float SampleMonoFilter(ShadeContext& sc, float u,float v, float du, float dv); -}; - -//========================================================================================= -// BM\AlphaSampler -//========================================================================================= -class BMAlphaSampler : public MapSampler { - Bitmap *bm; - hsMaxLayer *tex; - float u0,v0,u1,v1,ufac,vfac,ujit,vjit; - int bmw,bmh,clipx, clipy, cliph; - float fclipw,fcliph, fbmh, fbmw; -public: - BMAlphaSampler() { bm = NULL; } - void Init(hsMaxLayer *bmt); - int PlaceUV(ShadeContext &sc, float &u, float &v, int iu, int iv); - void PlaceUVFilter(ShadeContext &sc, float &u, float &v, int iu, int iv); - AColor Sample(ShadeContext& sc, float u,float v) { return AColor(0,0,0,0);} - AColor SampleFilter(ShadeContext& sc, float u,float v, float du, float dv) { return AColor(0,0,0,0);} - float SampleMono(ShadeContext& sc, float u,float v); - float SampleMonoFilter(ShadeContext& sc, float u,float v, float du, float dv); -}; - -//========================================================================================= -// hsMaxLayerNotify... this calls hsMaxLayer::NotifyChanged when a bitmap changes -//========================================================================================= - -class hsMaxLayerNotify : public BitmapNotify { -public: - void SetTex(hsMaxLayer *tx) { tex = tx; } - int Changed(ULONG flags); - -private: - hsMaxLayer *tex; -}; - -//========================================================================================= -// hsMaxLayer: a material layer with (possibly) texture info, blending info and shading info -//========================================================================================= - -class hsMaxLayer : public hsMaxLayerBase { - friend class hsMaxLayerPostLoad; - friend class hsMaxLayerDlg; - friend class BMSampler; - friend class BMAlphaSampler; - friend class BMCropper; -public: - hsMaxLayer(); - ~hsMaxLayer(); - - ParamDlg* CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp); - void Update(TimeValue t, Interval& valid); - void Reset(); - Interval Validity(TimeValue t) { Interval v; Update(t,v); return ivalid; } - TSTR GetFullName(); - - void SetOutputLevel(TimeValue t, float v) { } - void SetFilterType(int ft); - void SetAlphaSource(int as); - void SetEndCondition(int endcond) { endCond = endcond; } - void SetAlphaAsMono(BOOL onoff) { alphaAsMono = onoff; } - void SetAlphaAsRGB(BOOL onoff) { alphaAsRGB = onoff; } - void SetPremultAlpha(BOOL onoff) { premultAlpha = onoff; } - void SetMapName(TCHAR *name) { - bi.SetName(name); - FreeBitmap(); - if (paramDlg) - ReloadBitmap(); - } - void SetStartTime(TimeValue t) { startTime = t; } - void SetPlaybackRate(float r) { pbRate = r; } - - void SetClipU(TimeValue t, float f) { clipu = f; pblock->SetValue( PB_LAYER_CLIPU, t, f); } - void SetClipV(TimeValue t, float f) { clipv = f; pblock->SetValue( PB_LAYER_CLIPV, t, f); } - void SetClipW(TimeValue t, float f) { clipw = f; pblock->SetValue( PB_LAYER_CLIPW, t, f); } - void SetClipH(TimeValue t, float f) { cliph = f; pblock->SetValue( PB_LAYER_CLIPH, t, f); } - void SetJitter(TimeValue t, float f) { cliph = f; pblock->SetValue( PB_LAYER_JITTER, t, f); } - - int GetFilterType() { return filterType; } - int GetAlphaSource() { return alphaSource; } - int GetEndCondition() { return endCond; } - BOOL GetAlphaAsMono(BOOL onoff) { return alphaAsMono; } - BOOL GetAlphaAsRGB(BOOL onoff) { return alphaAsRGB; } - BOOL GetPremultAlpha(BOOL onoff) { return premultAlpha; } - TCHAR *GetMapName() { return (TCHAR *)bi.Name(); } - TimeValue GetStartTime() { return startTime; } - float GetPlaybackRate() { return pbRate; } - StdUVGen* GetUVGen() { return (StdUVGen*)uvGen; } - TextureOutput* GetTexout() { return 0; } - Bitmap *GetBitmap(TimeValue t) { LoadBitmap(t); return thebm; } - float GetClipU(TimeValue t) { return pblock->GetFloat( PB_LAYER_CLIPU, t); } - float GetClipV(TimeValue t) { return pblock->GetFloat( PB_LAYER_CLIPV, t); } - float GetClipW(TimeValue t) { return pblock->GetFloat( PB_LAYER_CLIPW, t); } - float GetClipH(TimeValue t) { return pblock->GetFloat( PB_LAYER_CLIPH, t); } - float GetJitter(TimeValue t) { return pblock->GetFloat( PB_LAYER_JITTER, t); } - void StuffCropValues(); // stuff new values into the cropping VFB - - void UpdtSampler() { - mysamp.Init(this); - alphasamp.Init(this); - } - - void NotifyChanged(); - Bitmap* BuildBitmap(int size); - void FreeBitmap(); - BMMRES LoadBitmap(TimeValue t); - int CalcFrame(TimeValue t); - void ScaleBitmapBumpAmt(float f); - void ReloadBitmap(); - - // Evaluate the color of map for the context. - RGBA EvalColor(ShadeContext& sc); - float EvalMono(ShadeContext& sc); - Point3 EvalNormalPerturb(ShadeContext& sc); - - void DiscardTexHandle(); - - BOOL SupportTexDisplay() { return TRUE; } - void ActivateTexDisplay(BOOL onoff); - DWORD GetActiveTexHandle(TimeValue t, TexHandleMaker& thmaker); - void GetUVTransform(Matrix3 &uvtrans) { uvGen->GetUVTransform(uvtrans); } - int GetTextureTiling() { return uvGen->GetTextureTiling(); } - int GetUVWSource() { return uvGen->GetUVWSource(); } - UVGen *GetTheUVGen() { return uvGen; } -#ifdef MAXR3 - int GetMapChannel () { return uvGen->GetMapChannel(); } -#endif // MAXR3 - - int RenderBegin(TimeValue t, ULONG flags) { - inRender = TRUE; - return 1; - } - int RenderEnd(TimeValue t) { - inRender = FALSE; - return 1; - } - int LoadMapFiles(TimeValue t) { LoadBitmap(t); return 1; } - void RenderBitmap(TimeValue t, Bitmap *bm, float scale3D, BOOL filter); - - Class_ID ClassID() { return hsMaxLayerClassID; } - SClass_ID SuperClassID() { return TEXMAP_CLASS_ID; } -#ifdef HS_DEBUGGING - void GetClassName(TSTR& s) { s= GetString(IDS_DS_LAYER_DEBUG); } -#else - void GetClassName(TSTR& s) { s= "";}//GetString(IDS_DS_LAYER); } -#endif - void DeleteThis() { delete this; } - - // Requirements - ULONG LocalRequirements(int subMtlNum); - - int NumSubs() { return 2; } - Animatable* SubAnim(int i); - TSTR SubAnimName(int i); - int SubNumToRefNum(int subNum) { return subNum; } - void InitSlotType(int sType) { if (uvGen) uvGen->InitSlotType(sType); } - - // From ref - int NumRefs() { return 2; } - RefTargetHandle GetReference(int i); - void SetReference(int i, RefTargetHandle rtarg); - - RefTargetHandle Clone(RemapDir &remap = NoRemap()); - RefResult NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget, - PartID& partID, RefMessage message ); - - // From Animatable - void EnumAuxFiles(NameEnumCallback& nameEnum, DWORD flags) { - bi.EnumAuxFiles(nameEnum,flags); - } - int SetProperty(ULONG id, void *data); - void FreeAllBitmaps() { - FreeBitmap(); - } - - int GetFlag(ULONG f) { return (flags&f)?1:0; } - void SetFlag(ULONG f, ULONG val); - - // from hsMaxLayerBase - BOOL KeyAtTime(int id,TimeValue t) { return pblock->KeyFrameAtTime(id,t); } - Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE); - Color GetColor(int mtlNum=0, BOOL backFace=FALSE); - - float GetShininess(int mtlNum=0, BOOL backFace=FALSE) { return 0.f; } - float GetShinStr(int mtlNum=0, BOOL backFace=FALSE) { return 0.f; } - float GetMapPercent(int mtlNum=0, BOOL backFace=FALSE) { return 0.f; } - float GetOpacity(int mtlNum=0, BOOL backFace=FALSE) { return 0.f; } - float GetMipMapBlur(int mtlNum=0, BOOL backFace=FALSE) { return pblock->GetFloat(PB_LAYER_MIPMAPBLUR, 0); } - float GetLODBias(int mtlNum=0, BOOL backFace=FALSE) { return pblock->GetFloat(PB_LAYER_LODBIAS, 0); } - int GetEnvironMapSize(int mtlNum=0, BOOL backFace=FALSE) { return 0; } - - Color GetAmbient(TimeValue t) const; - Color GetColor(TimeValue t) const; - - float GetShininess(TimeValue t) const; - float GetShinStr(TimeValue t) const; - float GetMapPercent(TimeValue t) const; - float GetOpacity(TimeValue t) const; - float GetMipMapBlur(TimeValue t) const; - float GetLODBias(TimeValue t) const; - float GetDetailDropoffStart(TimeValue t) const; - float GetDetailDropoffStop(TimeValue t) const; - float GetDetailMax(TimeValue t) const; - float GetDetailMin(TimeValue t) const; - int GetEnvironMapSize(TimeValue t) const; - - int GetNumExplicitMipmaps() const { return mipmapInfo.Count(); } - TCHAR *GetExplicitMipmapName(int i) const { return mipmapOn[i] ? (TCHAR *)mipmapInfo[i].Name() : 0; } - BOOL ExplicitMipmapEnabled(int i) const { return mipmapOn[i]; } - int GetExplicitMipmapLevel(int i) const { return mipmapLevel[i]; } - - BOOL GetDirty() const { return dirty; } - ULONG GetBlendFlags() const { return blendFlags; } - ULONG GetZFlags() const { return zFlags; } - ULONG GetShadeFlags() const { return shadeFlags; } - ULONG GetMiscFlags() const { return miscFlags; } - ProcType GetProcType() const { return procType; } - hsMatUsage GetUsage() const { return usageType; } - - // Setting the things in hsMaxLayerBase - void SetShininess(float v, TimeValue t); - void SetShinStr(float v, TimeValue t); - void SetMapPercent(float v, TimeValue t); - void SetOpacity(float v, TimeValue t); - void SetAmbient(Color c, TimeValue t); - void SetColor(Color c, TimeValue t); - void SetMipMapBlur(float f, TimeValue t); - void SetLODBias(float f, TimeValue t); - void SetDetailDropoffStart(float f, TimeValue t); - void SetDetailDropoffStop(float f, TimeValue t); - void SetDetailMax(float f, TimeValue t); - void SetDetailMin(float f, TimeValue t); - void SetEnvironMapSize(int i, TimeValue t); - - void SetNumExplicitMipmaps(int n); - void SetExplicitMipmapName(int i, const char *n) { mipmapInfo[i].SetName(n); } - void EnableExplicitMipmap(int i, BOOL state) { mipmapOn[i] = state; } - void SetExplicitMipmapLevel(int i, int l) { mipmapLevel[i] = l; } - - void SetDirty(BOOL state) { dirty = state; } - void SetBlendFlag(int i, BOOL state); - void SetZFlag(int flag, BOOL state); - void SetShadeFlag(int flag, BOOL state); - void SetMiscFlag(int flag, BOOL state); - void SetProcType(ProcType type); - void SetUsage(hsMatUsage use); - void GuessUsage(); - - // IO - IOResult Save(ISave *isave); - IOResult Load(ILoad *iload); - - // Colin Hack - BOOL GetApplyCrop() { return applyCrop; } - BOOL GetPlaceImage() { return placeImage; } - -private: - UVGen *uvGen; // ref #0 - IParamBlock *pblock; // ref #1 - BitmapInfo bi; - TSTR bmName; // for loading old files only - Bitmap *thebm; - hsMaxLayerNotify bmNotify; - TexHandle *texHandle; - float pbRate; - TimeValue startTime; - Interval ivalid; - - // Samplers - BMSampler mysamp; - BMAlphaSampler alphasamp; - - BOOL applyCrop; - BOOL loadingOld; - BOOL placeImage; - BOOL randPlace; - int filterType; - int alphaSource; - int endCond; - int alphaAsMono; - int alphaAsRGB; - float clipu, clipv, clipw, cliph, jitter; - BOOL premultAlpha; - BOOL isNew; - BOOL loadFailed; - BOOL inRender; - hsMaxLayerDlg *paramDlg; - int texTime; - Interval texValid; - Interval clipValid; - float rumax,rumin,rvmax,rvmin; - - // ADDED - ULONG flags; - - Color ambient; - Color color; - - float opacity; - float shine_str; - float shininess; - float mapPercent; - float mipMapBlur; - float lodBias; - float detailDropoffStart; - float detailDropoffStop; - float detailMax; - float detailMin; - int environMapSize; - - BOOL dirty; - - ULONG blendFlags; - ULONG zFlags; - ULONG shadeFlags; - ULONG miscFlags; - ProcType procType; - hsMatUsage usageType; - - Tab mipmapInfo; // references - Tab mipmapOn; - Tab mipmapLevel; -}; - -#endif \ No newline at end of file diff --git a/Sources/Tools/MaxMtlUpdate/OldMat/hsMaxLayerBase.h b/Sources/Tools/MaxMtlUpdate/OldMat/hsMaxLayerBase.h deleted file mode 100644 index 029bd75a..00000000 --- a/Sources/Tools/MaxMtlUpdate/OldMat/hsMaxLayerBase.h +++ /dev/null @@ -1,206 +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 . - -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 __HSMAXLAYERBASE_H -#define __HSMAXLAYERBASE_H - -#include "stdmat.h" - -#define HSMAX_LAYER_CLASS_ID 0x41990fe7 - -const Class_ID hsMaxLayerClassID(HSMAX_LAYER_CLASS_ID, 0x72404998); -const Class_ID hsMaxMtlClassID(0x2f335902, 0x111d2ea7); -const Class_ID hsEnvironMapMtlClassID(0x98777b3, 0x5eb270dd); - -class hsMaxLayerBase : public BitmapTex { -public: - enum hsMatBlendFlags { - kBlendTest = 0x1, // dev - // Rest of blends are mutually exclusive - kBlendAlpha = 0x2, // dev - kBlendMult = 0x4, // dev - kBlendAdd = 0x8, // dev - kBlendMultColorPlusMultAlpha = 0x10, // dev - kBlendAntiAlias = 0x20, - kBlendDetail = 0x40, - kBlendDetailAdd = 0x80, - kBlendMask = kBlendAlpha - | kBlendMult - | kBlendAdd - | kBlendMultColorPlusMultAlpha - | kBlendAntiAlias - | kBlendDetail - | kBlendDetailAdd, - kBlendInvertAlpha = 0x1000, // dev - kBlendInvertColor = 0x2000, // dev - kBlendAlphaMult = 0x4000, - kBlendAlphaAdd = 0x8000, - kBlendNoColor = 0x10000, - kBlendNoVtxAlpha = 0x20000 - }; - - enum hsMatZFlags { - kZIncLayer = 0x1, // dev - kZOnlyZ = 0x2, // dev - kZClearZ = 0x4, // dev - kZNoZRead = 0x8, // dev - kZNoZWrite = 0x10, - kZMask = kZNoZWrite | kZClearZ | kZNoZRead, - kZLODBias = 0x20 - }; - - enum hsMatShadeFlags { - kShadeSoftShadow = 0x1, // view, dev - kShadeNoProjectors = 0x2, // projector - kShadeVertexShade = 0x20, // dev - kShadeNoShade = 0x40, // view,dev - kShadeBlack = kShadeNoShade, - kShadeSpecular = 0x80, // view, dev - kShadeNoFog = 0x100, // dev - kShadeWhite = 0x200, - kShadeSpecularAlpha = 0x400, - kShadeSpecularColor = 0x800, - kShadeSpecularHighlight = 0x1000, - kShadeVertColShade = 0x2000, - kShadeInherit = 0x4000 - }; - - enum hsMatMiscFlags { - kMiscWireFrame = 0x1, // dev (running out of bits) - kMiscDrawMeshOutlines = 0x2, // dev, currently unimplemented - kMiscTwoSided = 0x4, // view,dev - kMiscDrawAsSplats = 0x8, // dev? bwt - kMiscMipMap = 0x10, - kMiscUseBitmap = 0x20, - kMiscIntensityOnly = 0x40, - kMiscAutoStart = 0x80, - kMiscDetailBias = 0x100, // obsolete... - kMiscDetailMax = 0x200, // obsolete... - kMiscExplicitMipmap = 0x400, - kMiscAdjustPlane = 0x800, - kMiscAdjustCylinder = 0x1000, - kMiscAdjustSphere = 0x2000, - kMiscTroubledLoner = 0x4000, - kMiscBindSkip = 0x8000, - kMiscBindMask = 0x10000, - kMiscForceNonCompressed = 0x20000, - kMiscNoMaxSize = 0x40000, - kMiscHalfSize = 0x80000, - kMiscBindNext = 0x100000, - kMiscBindPrev = 0x200000, - kMiscReserved = 0x400000 - }; - - enum ProcType { - kProcTypeDefault, - kProcTypeWater - }; - - enum hsMatUsage { - kUseNone = 0x0, - kUseBase = 0x1, - kUseDetail = 0x2, - kUseGrime = 0x4, - kUseTransition = 0x8, - kUseHighlight = 0x10, - kUseMask = 0x20, - kUseShadowLight = 0x40, - kUseHelper = 0x80, - - kUseGuess = 0x10000000 - }; - -public: - // For hsMaxMtl... Special case for higher layers. Sigh. - virtual void SetDirty(BOOL state) = 0; - virtual void SetBlendFlag(int i, BOOL state) = 0; - virtual void SetZFlag(int flag, BOOL state) = 0; - virtual void SetShadeFlag(int flag, BOOL state) = 0; - virtual void SetMiscFlag(int flag, BOOL state) = 0; - virtual void SetProcType(ProcType type) = 0; - virtual void SetUsage(hsMatUsage use) = 0; - virtual void GuessUsage() = 0; - - // For interactive renderer - virtual Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE) = 0; - virtual Color GetColor(int mtlNum=0, BOOL backFace=FALSE) = 0; - - virtual float GetShininess(int mtlNum=0, BOOL backFace=FALSE) = 0; - virtual float GetShinStr(int mtlNum=0, BOOL backFace=FALSE) = 0; - virtual float GetOpacity(int mtlNum=0, BOOL backFace=FALSE) = 0; - - // For exporter - virtual Color GetAmbient(TimeValue t) const = 0; - virtual Color GetColor(TimeValue t) const = 0; - - virtual float GetShininess(TimeValue t) const = 0; - virtual float GetShinStr(TimeValue t) const = 0; - virtual float GetMapPercent(TimeValue t) const = 0; - virtual float GetOpacity(TimeValue t) const = 0; - virtual float GetMipMapBlur(TimeValue t) const = 0; - virtual float GetLODBias(TimeValue t) const = 0; - virtual float GetDetailDropoffStart(TimeValue t) const = 0; - virtual float GetDetailDropoffStop(TimeValue t) const = 0; - virtual float GetDetailMax(TimeValue t) const = 0; - virtual float GetDetailMin(TimeValue t) const = 0; - virtual int GetEnvironMapSize(TimeValue t) const = 0; - - virtual BOOL GetDirty() const = 0; - virtual ULONG GetBlendFlags() const = 0; - virtual ULONG GetZFlags() const = 0; - virtual ULONG GetShadeFlags() const = 0; - virtual ULONG GetMiscFlags() const = 0; - virtual ProcType GetProcType() const = 0; - virtual hsMatUsage GetUsage() const = 0; - - virtual int GetNumExplicitMipmaps() const = 0; - virtual TCHAR *GetExplicitMipmapName(int i) const = 0; - virtual BOOL ExplicitMipmapEnabled(int i) const = 0; - virtual int GetExplicitMipmapLevel(int i) const = 0; - -#ifdef MAXR4 - // KLUDGE - Had to do this to compile under MAX4 beta - virtual void fnReload() {}; - virtual void fnViewImage() {}; -#endif -}; - -#endif diff --git a/Sources/Tools/MaxMtlUpdate/plMaterialUpdate.cpp b/Sources/Tools/MaxMtlUpdate/plMaterialUpdate.cpp deleted file mode 100644 index 55a9efd6..00000000 --- a/Sources/Tools/MaxMtlUpdate/plMaterialUpdate.cpp +++ /dev/null @@ -1,411 +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 . - -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 "plMaterialUpdate.h" - -#define MAXR3 -#define MAXR4 - -//#include "OldMat/hsMaxMtl.h" -#include "OldMat/hsMaxLayer.h" - -#include "../MaxPlasmaMtls/Layers/plLayerTex.h" -#include "../MaxPlasmaMtls/Layers/plLayerTexBitmapPB.h" - -#include "../MaxPlasmaMtls/Materials/plPassMtl.h" -#include "../MaxPlasmaMtls/Materials/plPassMtlBase.h" -#include "../MaxPlasmaMtls/Materials/plPassMtlBasicPB.h" -#include "../MaxPlasmaMtls/Materials/plPassMtlAdvPB.h" -#include "../MaxPlasmaMtls/Materials/plPassMtlLayersPB.h" - -#include "../MaxExport/plExportProgressBar.h" - -#define PLMATERIALUPDATE_CLASS_ID Class_ID(0x70acddfe, 0x68f42f3f) - -#include - -class plMaterialUpdate : public UtilityObj -{ -protected: - HWND fhPanel; - Interface *fInterface; - std::map fDoneMaterials; - bool fConvertSecondLayer; - - plMaterialUpdate(); - -public: - static plMaterialUpdate &Instance(); - - ~plMaterialUpdate(); - void DeleteThis() {} - - void BeginEditParams(Interface *ip,IUtil *iu); - void EndEditParams(Interface *ip,IUtil *iu); - - bool ConvertAllMtls(INode *node, plExportProgressBar *bar); - -protected: - static BOOL CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); - - void IRenameMtls(MtlBase *oldMtl, MtlBase *newMtl); - - void IConvert(INode *node); - plPassMtl *IConvertMtl(Mtl *mtl, Mtl *multi=NULL, int subNum=-1); - plLayerTex *IConvertLayer(hsMaxLayer *layer); - - void ICopyMtlParams(plPassMtl *mtl, hsMaxLayer *layer); -}; - -class plMaterialUpdateClassDesc:public ClassDesc2 { - public: - int IsPublic() { return TRUE; } - void * Create(BOOL loading = FALSE) { return &plMaterialUpdate::Instance(); } - const TCHAR * ClassName() { return "Plasma Material Converter"; } - SClass_ID SuperClassID() { return UTILITY_CLASS_ID; } - Class_ID ClassID() { return PLMATERIALUPDATE_CLASS_ID; } - const TCHAR* Category() { return GetString(IDS_CATEGORY); } - - const TCHAR* InternalName() { return _T("plMaterialConverter"); } // returns fixed parsable name (scripter-visible name) - HINSTANCE HInstance() { return hInstance; } // returns owning module handle -}; - -static plMaterialUpdateClassDesc plMaterialUpdateDesc; -ClassDesc2* GetMaterialUpdateDesc() { return &plMaterialUpdateDesc; } - -plMaterialUpdate &plMaterialUpdate::Instance() -{ - static plMaterialUpdate theInstance; - return theInstance; -} - -plMaterialUpdate::plMaterialUpdate() : fInterface(NULL), fhPanel(NULL), fConvertSecondLayer(false) -{ -} - -plMaterialUpdate::~plMaterialUpdate() -{ -} - -BOOL plMaterialUpdate::DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - case WM_COMMAND: - if (LOWORD(wParam) == IDC_BUTTON1 && HIWORD(wParam) == BN_CLICKED) - { - plMaterialUpdate &p = Instance(); - - plExportProgressBar bar; - bar.Start("Convert Materials"); - - if (IsDlgButtonChecked(hWnd, IDC_CHECK1) == BST_CHECKED) - p.fConvertSecondLayer = true; - - p.ConvertAllMtls(p.fInterface->GetRootNode(), &bar); - - p.fInterface->RedrawViews(p.fInterface->GetTime()); - p.fDoneMaterials.clear(); - return TRUE; - } - break; - } - - return FALSE; -} - -void plMaterialUpdate::BeginEditParams(Interface *ip, IUtil *iu) -{ - fInterface = ip; - fhPanel = fInterface->AddRollupPage( - hInstance, - MAKEINTRESOURCE(IDD_PANEL), - DlgProc, - GetString(IDS_PARAMS), - 0); -} - -void plMaterialUpdate::EndEditParams(Interface *ip, IUtil *iu) -{ - fInterface->DeleteRollupPage(fhPanel); - fInterface = NULL; - fhPanel = NULL; -} - -bool plMaterialUpdate::ConvertAllMtls(INode *node, plExportProgressBar *bar) -{ - IConvert(node); - - bool cancel = bar->Update(); - if (cancel) - return false; - - for (int i = 0; i < node->NumChildren(); i++) - { - if (!ConvertAllMtls(node->GetChildNode(i), bar)) - return false; - } - - return true; -} - -void plMaterialUpdate::IConvert(INode *node) -{ - Mtl *mtl = node->GetMtl(); - if (!mtl) - return; - - if (mtl->ClassID() == hsMaxMtlClassID) - { - plPassMtl *pass = IConvertMtl(mtl); - node->SetMtl(pass); - } - else if (mtl->ClassID() == Class_ID(MULTI_CLASS_ID,0)) - { - for (int i = 0; i < mtl->NumSubMtls(); i++) - { - Mtl *subMtl = mtl->GetSubMtl(i); - if (subMtl->ClassID() == hsMaxMtlClassID) - { - plPassMtl *pass = IConvertMtl(subMtl, mtl, i); - mtl->SetSubMtl(i, pass); - } - } - } -} - -void plMaterialUpdate::IRenameMtls(MtlBase *oldMtl, MtlBase *newMtl) -{ - char buf[256]; - const char *name = oldMtl->GetName(); - newMtl->SetName(name); - strcpy(buf, name); - strcat(buf, " old"); - oldMtl->SetName(buf); -} - -plPassMtl *plMaterialUpdate::IConvertMtl(Mtl *mtl, Mtl *multi, int subNum) -{ - // We've already converted this material, use the new one we already made - if (fDoneMaterials.find(mtl) != fDoneMaterials.end()) - return (plPassMtl*)fDoneMaterials[mtl]; - - plPassMtl *newMtl = (plPassMtl*)CreateInstance(MATERIAL_CLASS_ID, PASS_MTL_CLASS_ID); - IParamBlock2 *layersPB = newMtl->GetParamBlockByID(plPassMtl::kBlkLayers); - - IRenameMtls(mtl, newMtl); - - if (mtl->NumSubTexmaps() > 0) - { - Texmap *map = mtl->GetSubTexmap(0); - if (map->ClassID() == hsMaxLayerClassID) - { - plLayerTex *layer = IConvertLayer((hsMaxLayer*)map); - -// layer->SetMtlFlag(MTL_TEX_DISPLAY_ENABLED, TRUE); -// layer->ActivateTexDisplay(TRUE); - - newMtl->SetSubTexmap(0, layer); -/* newMtl->SetActiveTexmap(layer); - newMtl->SetMtlFlag(MTL_TEX_DISPLAY_ENABLED, TRUE); - - if (multi) - GetCOREInterface()->ActivateTexture(layer, multi, subNum); - else - GetCOREInterface()->ActivateTexture(layer, newMtl); -*/ - ICopyMtlParams(newMtl, (hsMaxLayer*)map); - } - } - - if (mtl->NumSubTexmaps() > 1 && fConvertSecondLayer && mtl->SubTexmapOn(1)) - { - Texmap *map = mtl->GetSubTexmap(1); - if (map->ClassID() == hsMaxLayerClassID) - { - hsMaxLayer *oldLayer = (hsMaxLayer*)map; - plLayerTex *layer = IConvertLayer(oldLayer); - newMtl->SetSubTexmap(1, layer); - - IParamBlock2 *layersPB = newMtl->GetParamBlockByID(plPassMtl::kBlkLayers); - layersPB->SetValue(kPassLayTopOn, 0, TRUE); - - if (oldLayer->GetBlendFlags() & hsMaxLayerBase::kBlendAlpha) - layersPB->SetValue(kPassLayBlend, 0, plPassMtlBase::kBlendAlpha); - else if (oldLayer->GetBlendFlags() & hsMaxLayerBase::kBlendAdd) - layersPB->SetValue(kPassLayBlend, 0, plPassMtlBase::kBlendAdd); - } - } - -//MtlBaseLib& Interface::GetMaterialLibrary() - - // Add this to our converted materials - fDoneMaterials[mtl] = newMtl; - - return newMtl; -} - -plLayerTex *plMaterialUpdate::IConvertLayer(hsMaxLayer *layer) -{ - plLayerTex *newLayer = (plLayerTex*)CreateInstance(TEXMAP_CLASS_ID, LAYER_TEX_CLASS_ID); - IParamBlock2 *bitmapPB = newLayer->GetParamBlockByID(plLayerTex::kBlkBitmap); - - IRenameMtls(layer, newLayer); - - // Copy the bitmap - if (layer->GetMiscFlags() & hsMaxLayerBase::kMiscUseBitmap) - { - bitmapPB->SetValue(kBmpUseBitmap, 0, 1); - - const char *name = layer->GetMapName(); - PBBitmap pbb; - pbb.bi.SetName(name); - - // Disable annoying missing texture warning - BOOL bmmSilentMode = TheManager->SilentMode(); - TheManager->SetSilentMode(TRUE); - - bitmapPB->SetValue(kBmpBitmap, 0, &pbb); - - TheManager->SetSilentMode(bmmSilentMode); - } - - // Copy the UVGen - newLayer->ReplaceReference(plLayerTex::kRefUVGen, layer->GetUVGen()); - - // Copy the cropping - if (layer->GetApplyCrop()) - { - bitmapPB->SetValue(kBmpApply, 0, TRUE); - bitmapPB->SetValue(kBmpCropPlace, 0, layer->GetPlaceImage()); - - bitmapPB->SetValue(kBmpClipU, 0, layer->GetClipU(0)); - bitmapPB->SetValue(kBmpClipV, 0, layer->GetClipV(0)); - bitmapPB->SetValue(kBmpClipW, 0, layer->GetClipW(0)); - bitmapPB->SetValue(kBmpClipH, 0, layer->GetClipH(0)); - } - - // Misc - if (layer->GetBlendFlags() & hsMaxLayerBase::kBlendNoColor) - bitmapPB->SetValue(kBmpDiscardColor, 0, TRUE); - if (layer->GetBlendFlags() & hsMaxLayerBase::kBlendInvertColor) - bitmapPB->SetValue(kBmpInvertColor, 0, TRUE); - if (layer->GetAlphaSource() == 2) - bitmapPB->SetValue(kBmpDiscardAlpha, 0, TRUE); - if (layer->GetBlendFlags() & hsMaxLayerBase::kBlendInvertAlpha) - bitmapPB->SetValue(kBmpInvertAlpha, 0, TRUE); - -/* - // Texture quality - kBmpNonCompressed, - kBmpScaling, -*/ - - // Mipmap - if (layer->GetFilterType() == 2) - bitmapPB->SetValue(kBmpNoFilter, 0, TRUE); - - float blur = layer->GetMipMapBlur(TimeValue(0)); - bitmapPB->SetValue(kBmpMipBlur, 0, blur); - - if (layer->GetZFlags() & hsMaxLayerBase::kZLODBias) - { - bitmapPB->SetValue(kBmpMipBias, 0, TRUE); - bitmapPB->SetValue(kBmpMipBiasAmt, 0, layer->GetLODBias(TimeValue(0))); - } - - // Detail - if (layer->GetBlendFlags() & hsMaxLayerBase::kBlendDetail || - layer->GetBlendFlags() & hsMaxLayerBase::kBlendDetailAdd) - { - bitmapPB->SetValue(kBmpUseDetail, 0, TRUE); - - bitmapPB->SetValue(kBmpDetailStartSize, 0, layer->GetDetailDropoffStart(0)); - bitmapPB->SetValue(kBmpDetailStopSize, 0, layer->GetDetailDropoffStop(0)); - bitmapPB->SetValue(kBmpDetailStartOpac, 0, layer->GetDetailMax(0)); - bitmapPB->SetValue(kBmpDetailStopOpac, 0, layer->GetDetailMin(0)); - } - - return newLayer; -} - -void plMaterialUpdate::ICopyMtlParams(plPassMtl *mtl, hsMaxLayer *layer) -{ - IParamBlock2 *basicPB = mtl->GetParamBlockByID(plPassMtl::kBlkBasic); - IParamBlock2 *layersPB = mtl->GetParamBlockByID(plPassMtl::kBlkLayers); - - basicPB->SetValue(kPassBasColorAmb, 0, layer->GetAmbient()); - basicPB->SetValue(kPassBasColor, 0, layer->GetColor()); - - basicPB->SetValue(kPassBasOpacity, 0, int(layer->GetOpacity(0)*100.f)); - - if (layer->GetBlendFlags() & hsMaxLayerBase::kBlendAlpha) - layersPB->SetValue(kPassLayOutputBlend, 0, plPassMtlBase::kBlendAlpha); - else if (layer->GetBlendFlags() & hsMaxLayerBase::kBlendAdd) - layersPB->SetValue(kPassLayOutputBlend, 0, plPassMtlBase::kBlendAdd); - -/* - kPassAdvUseSpec, - kPassAdvSpecType, - kPassAdvShine, - kPassAdvShineStr, - - // Misc - kPassAdvWire, - kPassAdvMeshOutlines, - kPassAdvTwoSided, - - // Shading - kPassAdvSoftShadow, - kPassAdvNoProj, - kPassAdvVertexShade, - kPassAdvNoShade, - kPassAdvNoFog, - kPassAdvWhite, - - // Z - kPassAdvZOnly, - kPassAdvZClear, - kPassAdvZNoRead, - kPassAdvZNoWrite, - kPassAdvZInc, -*/ -} diff --git a/Sources/Tools/MaxMtlUpdate/plMaterialUpdate.def b/Sources/Tools/MaxMtlUpdate/plMaterialUpdate.def deleted file mode 100644 index 53daf611..00000000 --- a/Sources/Tools/MaxMtlUpdate/plMaterialUpdate.def +++ /dev/null @@ -1,8 +0,0 @@ -LIBRARY -EXPORTS - LibDescription @1 - LibNumberClasses @2 - LibClassDesc @3 - LibVersion @4 -SECTIONS - .data READ WRITE diff --git a/Sources/Tools/MaxMtlUpdate/plMaterialUpdate.h b/Sources/Tools/MaxMtlUpdate/plMaterialUpdate.h deleted file mode 100644 index 139f967b..00000000 --- a/Sources/Tools/MaxMtlUpdate/plMaterialUpdate.h +++ /dev/null @@ -1,71 +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 . - -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==*/ -/********************************************************************** - *< - FILE: plMaterialUpdate.h - - DESCRIPTION: Includes for Plugins - - CREATED BY: - - HISTORY: - - *> Copyright (c) 2000, All Rights Reserved. - **********************************************************************/ - -#ifndef __PLMATERIALUPDATE__H -#define __PLMATERIALUPDATE__H - -#include "Max.h" -#include "resource.h" -#include "istdplug.h" -#include "iparamb2.h" -#include "iparamm2.h" - -#include "utilapi.h" - - -extern TCHAR *GetString(int id); - -extern HINSTANCE hInstance; - -#endif // __PLMATERIALUPDATE__H diff --git a/Sources/Tools/MaxMtlUpdate/plMaterialUpdate.rc b/Sources/Tools/MaxMtlUpdate/plMaterialUpdate.rc deleted file mode 100644 index d3738171..00000000 --- a/Sources/Tools/MaxMtlUpdate/plMaterialUpdate.rc +++ /dev/null @@ -1,103 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define WIN32_LEAN_AND_MEAN -#include -#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_PANEL DIALOG DISCARDABLE 0, 0, 108, 45 -STYLE WS_CHILD | WS_VISIBLE -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "Convert All",IDC_BUTTON1,29,9,48,15 - CONTROL "Convert 2nd layer",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,18,29,71,10 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_PANEL, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 101 - TOPMARGIN, 7 - BOTTOMMARGIN, 38 - 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 - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_CLASS_NAME "plMaterialUpdate" - IDS_PARAMS "Parameters" - IDS_SPIN "Spin" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/Sources/Tools/MaxMtlUpdate/resource.h b/Sources/Tools/MaxMtlUpdate/resource.h deleted file mode 100644 index 6436272e..00000000 --- a/Sources/Tools/MaxMtlUpdate/resource.h +++ /dev/null @@ -1,28 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by plMaterialUpdate.rc -// -#define IDS_LIBDESCRIPTION 1 -#define IDS_CATEGORY 2 -#define IDS_CLASS_NAME 3 -#define IDS_PARAMS 4 -#define IDS_SPIN 5 -#define IDD_PANEL 101 -#define IDC_CLOSEBUTTON 1000 -#define IDC_DOSTUFF 1000 -#define IDC_BUTTON1 1001 -#define IDC_CHECK1 1002 -#define IDC_COLOR 1456 -#define IDC_EDIT 1490 -#define IDC_SPIN 1496 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1003 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/Sources/Tools/MaxPlasmaLights/CMakeLists.txt b/Sources/Tools/MaxPlasmaLights/CMakeLists.txt index a5177518..0506efa1 100644 --- a/Sources/Tools/MaxPlasmaLights/CMakeLists.txt +++ b/Sources/Tools/MaxPlasmaLights/CMakeLists.txt @@ -53,7 +53,6 @@ target_link_libraries(MaxPlasmaLights pfCCR) target_link_libraries(MaxPlasmaLights pfCharacter) target_link_libraries(MaxPlasmaLights pfConditional) target_link_libraries(MaxPlasmaLights pfConsole) -target_link_libraries(MaxPlasmaLights pfCsrSrv) target_link_libraries(MaxPlasmaLights pfGameGUIMgr) target_link_libraries(MaxPlasmaLights pfGameMgr) target_link_libraries(MaxPlasmaLights pfGameScoreMgr) @@ -108,7 +107,6 @@ target_link_libraries(MaxPlasmaLights plVault) target_link_libraries(MaxPlasmaLights pnAddrInfo) target_link_libraries(MaxPlasmaLights pnAsyncCore) target_link_libraries(MaxPlasmaLights pnAsyncCoreExe) -target_link_libraries(MaxPlasmaLights pnCsrNet) target_link_libraries(MaxPlasmaLights pnDispatch) target_link_libraries(MaxPlasmaLights pnEncryption) target_link_libraries(MaxPlasmaLights pnFactory) @@ -123,7 +121,6 @@ target_link_libraries(MaxPlasmaLights pnNetCommon) target_link_libraries(MaxPlasmaLights pnNucleusInc) target_link_libraries(MaxPlasmaLights pnProduct) target_link_libraries(MaxPlasmaLights pnSceneObject) -target_link_libraries(MaxPlasmaLights pnSimpleNet) target_link_libraries(MaxPlasmaLights pnTimer) target_link_libraries(MaxPlasmaLights pnUtils) target_link_libraries(MaxPlasmaLights pnUtilsExe) diff --git a/Sources/Tools/Migration/Migration.cpp b/Sources/Tools/Migration/Migration.cpp deleted file mode 100644 index 1998a26f..00000000 --- a/Sources/Tools/Migration/Migration.cpp +++ /dev/null @@ -1,248 +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 . - -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==*/ -// Migration.cpp : Defines the entry point for the application. -// -#include -#include -#include -#include -#include "resource.h" -#include "Migration.h" - -HINSTANCE gInstance; -HWND gDlg; -unsigned int gThreadID; - -int gTaskItem = -1; -bool gTasksRunning = false; - -LRESULT CALLBACK DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); - -int APIENTRY WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow) -{ - InitCommonControls(); - - HWND hWnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_MAINDIALOG), NULL, (DLGPROC) DlgProc); - - gInstance = hInstance; - gDlg = hWnd; - - ShowWindow(hWnd, SW_SHOW); - - // Main message loop: - MSG msg; - while (GetMessage(&msg, NULL, 0, 0)) - { - if (!IsWindow(hWnd) || !IsDialogMessage(hWnd, &msg)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - - return msg.wParam; -} - - -// Mesage handler for dlg box. -LRESULT CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - LRESULT ret = FALSE; - switch (message) - { - case WM_INITDIALOG: - { - HWND hListView = GetDlgItem(hDlg,IDC_TASKLIST); - ListView_SetExtendedListViewStyleEx(hListView, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES); - LoadTasks(hListView); - LoadTasks(hDlg); - Button_SetCheck(GetDlgItem(hDlg,IDC_RADIOTEST),BST_CHECKED); - ret = TRUE; - } - break; - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_START: - // Start the migration Tasks - SetCursor(LoadCursor(NULL,IDC_WAIT)); - Button_Enable(GetDlgItem(hDlg,IDC_START),FALSE); - Button_Enable(GetDlgItem(hDlg,IDC_STOP),TRUE); - Button_Enable(GetDlgItem(hDlg,IDC_RADIOTEST),FALSE); - Button_Enable(GetDlgItem(hDlg,IDC_RADIOLAST),FALSE); - Button_Enable(GetDlgItem(hDlg,IDC_RADIOBRANCH),FALSE); - _beginthreadex(NULL,0,RunTasks,NULL,0,&gThreadID); - gTasksRunning = true; - ret = TRUE; - break; - case IDC_STOP: - // Stop the migration Tasks - SetCursor(LoadCursor(NULL,IDC_ARROW)); - Button_Enable(GetDlgItem(hDlg,IDC_START),TRUE); - Button_Enable(GetDlgItem(hDlg,IDC_STOP),FALSE); - Button_Enable(GetDlgItem(hDlg,IDC_RADIOTEST),TRUE); - Button_Enable(GetDlgItem(hDlg,IDC_RADIOLAST),TRUE); - Button_Enable(GetDlgItem(hDlg,IDC_RADIOBRANCH),TRUE); - ListBox_SetCurSel(GetDlgItem(hDlg,IDC_TASKLIST),gTaskItem); - gTasksRunning = false; - ret = TRUE; - break; - default: - break; - } - } - break; - case WM_NOTIFY: - { - switch ((int)wParam) - { - case IDC_TASKLIST: - { - NMHDR* hdr = (NMHDR*)lParam; - switch (hdr->code) - { - case LVN_ITEMCHANGED: - { - NMLISTVIEW* note = (NMLISTVIEW*)lParam; - if (note->iItem != -1) - { - Static_SetText(GetDlgItem(hDlg,IDC_DESCRIPTION),(*(MigrationTaskList::GetInstance()->GetList()))[note->iItem]->GetDescription()); - (*(MigrationTaskList::GetInstance()->GetList()))[note->iItem]->SetEnabled(ListView_GetCheckState(hdr->hwndFrom, note->iItem) != 0); - ret = true; - } - } - break; - } - } - break; - } - } - break; - case WM_CLOSE: - PostQuitMessage(-1); - break; - } - return ret; -} - - -MigrationTaskList::MigrationTaskList() -{ - static MigrationTask_Backup backup; - static MigrationTask_CleanUp cleanUp; - static MigrationTask_PatchBuilder patchBuilder; - static MigrationTask_DataMigration dataMigration; - static MigrationTask_InstallClient installClient; - static MigrationTask_GenerateClientManifest generateClientManifest; - static MigrationTask_DropStoredGames dropStoredGames; - static MigrationTask_InstallAges installAges; - static MigrationTask_CopyTestServers copyTestServers; - static MigrationTask_StartLiveServers startLiveServers; - - fList.push_back(&backup); - fList.push_back(&cleanUp); - fList.push_back(&patchBuilder); - fList.push_back(&dataMigration); - fList.push_back(&installClient); - fList.push_back(&generateClientManifest); - fList.push_back(&dropStoredGames); - fList.push_back(&installAges); - fList.push_back(©TestServers); - fList.push_back(&startLiveServers); -} - -MigrationTaskList* MigrationTaskList::GetInstance() -{ - static MigrationTaskList mlist; - return &mlist; -} - -void LoadTasks(HWND hListView) -{ - MigrationTaskList::TaskList* tasktlist = MigrationTaskList::GetInstance()->GetList(); - - MigrationTaskList::TaskList::iterator it = tasktlist->begin(); - int index = 0; - while (it != tasktlist->end()) - { - LVITEM item; - ZeroMemory(&item,sizeof(item)); - item.pszText = (*it)->GetName(); - item.mask = LVIF_TEXT; - item.iItem = index; - ListView_InsertItem(hListView,&item); - it++; index++; - } -} - -unsigned int __stdcall RunTasks(void* args) -{ - gTaskItem = 0; - MigrationTaskList::TaskList* tasktlist = MigrationTaskList::GetInstance()->GetList(); - - while(gTasksRunning && gTaskItem < tasktlist->size()) - { - if ((*tasktlist)[gTaskItem]->GetEnabled()) - { - if (Button_GetCheck(GetDlgItem(gDlg,IDC_RADIOTEST)) == BST_CHECKED) - (*tasktlist)[gTaskItem]->SetServer(MigrationTask::kTest); - if (Button_GetCheck(GetDlgItem(gDlg,IDC_RADIOLAST)) == BST_CHECKED) - (*tasktlist)[gTaskItem]->SetServer(MigrationTask::kLast); - if (Button_GetCheck(GetDlgItem(gDlg,IDC_RADIOBRANCH)) == BST_CHECKED) - (*tasktlist)[gTaskItem]->SetServer(MigrationTask::kBranch); - - ListBox_SetCurSel(GetDlgItem(gDlg,IDC_TASKLIST),gTaskItem); - Static_SetText(GetDlgItem(gDlg,IDC_DESCRIPTION),(*tasktlist)[gTaskItem]->GetDescription()); - gTasksRunning = (*tasktlist)[gTaskItem]->Run(gInstance,gDlg) == 0; - } - gTaskItem++; - } - - gTaskItem = -1; - SendMessage(gDlg,WM_COMMAND,MAKEWPARAM(IDC_STOP,BN_CLICKED),WPARAM(GetDlgItem(gDlg,IDC_STOP))); - - return 0; -} \ No newline at end of file diff --git a/Sources/Tools/Migration/Migration.h b/Sources/Tools/Migration/Migration.h deleted file mode 100644 index 40cc5b8b..00000000 --- a/Sources/Tools/Migration/Migration.h +++ /dev/null @@ -1,65 +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 . - -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 PLASMA_MIGRATION_TOOL -#define PLASMA_MIGRATION_TOOL - -#include "MigrationTask.h" -#include - -void LoadTasks(HWND hListView); -unsigned int __stdcall RunTasks(void* args); - -class MigrationTaskList -{ -public: - typedef std::vector TaskList; -private: - TaskList fList; -public: - MigrationTaskList(); - static MigrationTaskList* GetInstance(); - TaskList* GetList() { return &fList; } -}; - - - -#endif //PLASMA_MIGRATION_TOOL diff --git a/Sources/Tools/Migration/Migration.ico b/Sources/Tools/Migration/Migration.ico deleted file mode 100644 index 38688352..00000000 Binary files a/Sources/Tools/Migration/Migration.ico and /dev/null differ diff --git a/Sources/Tools/Migration/Migration.rc b/Sources/Tools/Migration/Migration.rc deleted file mode 100644 index 1c630d3b..00000000 --- a/Sources/Tools/Migration/Migration.rc +++ /dev/null @@ -1,113 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define WIN32_LEAN_AND_MEAN -#include -#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 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_MIGRATION ICON DISCARDABLE "Migration.ICO" -IDI_SMALL ICON DISCARDABLE "SMALL.ICO" - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_MAINDIALOG DIALOG DISCARDABLE 0, 0, 290, 221 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Migrate the Test Servers to Live" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "Start",IDC_START,207,13,50,14 - PUSHBUTTON "Stop",IDC_STOP,207,30,50,14,WS_DISABLED - LTEXT "Tasks to perform:",IDC_STATIC,19,13,93,8 - LTEXT "Description:",IDC_STATIC,190,51,45,9 - EDITTEXT IDC_DESCRIPTION,192,67,81,98,ES_MULTILINE | - ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN - CONTROL "List1",IDC_TASKLIST,"SysListView32",LVS_LIST | - LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,19,26,158,179 - GROUPBOX "From Server:",IDC_STATIC,189,168,94,39 - CONTROL "Test",IDC_RADIOTEST,"Button",BS_AUTORADIOBUTTON,199,176, - 31,13 - CONTROL "Last",IDC_RADIOLAST,"Button",BS_AUTORADIOBUTTON,241,176, - 29,13 - CONTROL "Branch",IDC_RADIOBRANCH,"Button",BS_AUTORADIOBUTTON,217, - 189,38,13 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_MAINDIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 283 - TOPMARGIN, 7 - BOTTOMMARGIN, 214 - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/Sources/Tools/Migration/MigrationTask.cpp b/Sources/Tools/Migration/MigrationTask.cpp deleted file mode 100644 index ebd3b36c..00000000 --- a/Sources/Tools/Migration/MigrationTask.cpp +++ /dev/null @@ -1,435 +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 . - -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 "MigrationTask.h" -#include "OptionalDialog.h" -#include "commctrl.h" -#include "resource.h" -#include "windowsx.h" -#include "shellapi.h" - -#define SHARENAME "\\\\data.dni\\Parable-Root" -#define LIVECLIENTDIR "\\dataservers\\live\\game_Clients\\drcExplorer" -#define LIVEEXPANDEDINSTALLDIR "\\dataservers\\live\\game_Install\\Expanded" - - -int MigrationTask_Backup::Run(HINSTANCE hInst, HWND hDlg) -{ - int ret = 0; - - // SSH In & Run the backup Script... - STARTUPINFO si; - PROCESS_INFORMATION pi; - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - si.dwFlags = STARTF_USECOUNTCHARS | STARTF_USESHOWWINDOW; - si.wShowWindow = SW_MINIMIZE; - si.lpTitle = "Server Backup Running"; - si.dwXCountChars = 80; - si.dwYCountChars = 25; - ZeroMemory( &pi, sizeof(pi) ); - ret = !CreateProcess(NULL,"ssh2 parable@build.bone.cyan.com \"backuplive.sh\"",NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); - WaitForSingleObject(pi.hProcess,INFINITE); - - return ret; -} - - -int MigrationTask_CleanUp::Run(HINSTANCE hInst, HWND hDlg) -{ - int ret = 0; - - // Clean up the Test Directory - char* dataloc; - - switch (GetServer()) - { - case kTest: - dataloc = SHARENAME "\\dataservers\\test\\game_Data"; - break; - case kLast: - dataloc = SHARENAME "\\dataservers\\test-last\\game_Data"; - break; - case kBranch: - dataloc = SHARENAME "\\dataservers\\branch\\game_Data"; - break; - } - - - ShellExecute(hDlg,"open",dataloc,NULL,NULL,SW_SHOWNORMAL); - - if (MessageBox(hDlg, "Press OK to Continue...","Continue", MB_OKCANCEL) == IDCANCEL) - ret = -1; - - return ret; -} - - - -int MigrationTask_PatchBuilder::Run(HINSTANCE hInst, HWND hDlg) -{ - // Connect to the Data Servers by mapping the share - - // Run the patch builder on the Test and Live directories - - return 0; -} - - -int MigrationTask_DataMigration::Run(HINSTANCE hInst, HWND hDlg) -{ - int ret = 0; - - // SSH In; Copy the Data to the live - - STARTUPINFO si; - PROCESS_INFORMATION pi; - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - si.dwFlags = STARTF_USECOUNTCHARS | STARTF_USESHOWWINDOW; - si.wShowWindow = SW_MINIMIZE; - si.lpTitle = "Migrate the Data sets"; - si.dwXCountChars = 80; - si.dwYCountChars = 25; - ZeroMemory( &pi, sizeof(pi) ); - - char* migratecmd; - switch (GetServer()) - { - case kTest: - migratecmd = "ssh2 parable@build.bone.cyan.com \"migrate-test-data-live.sh\""; - break; - case kLast: - migratecmd = "ssh2 parable@build.bone.cyan.com \"migrate-test-last-data-live.sh\""; - break; - case kBranch: - migratecmd = "ssh2 parable@build.bone.cyan.com \"migrate-branch-data-live.sh\""; - break; - } - - ret = !CreateProcess(NULL,migratecmd,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); - WaitForSingleObject(pi.hProcess,INFINITE); - - return ret; -} - - -int MigrationTask_InstallClient::Run(HINSTANCE hInst, HWND hDlg) -{ - int ret = 0; - - // migrate the client support files - STARTUPINFO si; - PROCESS_INFORMATION pi; - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - si.dwFlags = STARTF_USECOUNTCHARS | STARTF_USESHOWWINDOW; - si.wShowWindow = SW_MINIMIZE; - si.lpTitle = "Migrate Client Support"; - si.dwXCountChars = 80; - si.dwYCountChars = 25; - ZeroMemory( &pi, sizeof(pi) ); - - char* migratecmd; - switch (GetServer()) - { - case kTest: - migratecmd = "ssh2 parable@build.bone.cyan.com \"migrate-test-client-live.sh\""; - break; - case kLast: - migratecmd = "ssh2 parable@build.bone.cyan.com \"migrate-test-last-client-live.sh\""; - break; - case kBranch: - migratecmd = "ssh2 parable@build.bone.cyan.com \"migrate-branch-client-live.sh\""; - break; - } - - ret = CreateProcess(NULL,migratecmd,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); - WaitForSingleObject(pi.hProcess,INFINITE); - - // Connect to the Data Servers by mapping the share - NETRESOURCE netres; - memset(&netres,0,sizeof(netres)); - netres.lpRemoteName = SHARENAME; - netres.dwDisplayType = RESOURCETYPE_DISK; - ret = (WNetAddConnection3(hDlg,&netres,NULL,NULL,CONNECT_INTERACTIVE) != NO_ERROR); - - if (ret == 0) - { - char exe[MAX_PATH]; - OPENFILENAME ofn; - SHFILEOPSTRUCT shFileOpt; - // Choose a client to copy across - memset(&exe, 0, sizeof(exe)); - memset(&ofn, 0, sizeof(OPENFILENAME)); - ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = hDlg; - ofn.lpstrFile = exe; - ofn.nMaxFile = sizeof(exe); - ofn.lpstrFilter = "Executable (*.EXE)\0*.EXE\0All (*.*)\0*.*\0"; - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = "Choose client exe to be used as drcExplorer.exe"; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; - while(!GetOpenFileName(&ofn)); - - // copy the client across - memset(&shFileOpt,0,sizeof(shFileOpt)); - shFileOpt.hwnd = hDlg; - shFileOpt.wFunc = FO_COPY; - shFileOpt.pFrom = exe; - shFileOpt.pTo = SHARENAME LIVECLIENTDIR "\\drcExplorer.exe\0"; - ret = SHFileOperation(&shFileOpt); - - // Choose a client config to copy across - memset(&exe, 0, sizeof(exe)); - memset(&ofn, 0, sizeof(OPENFILENAME)); - ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = hDlg; - ofn.lpstrFile = exe; - ofn.nMaxFile = sizeof(exe); - ofn.lpstrFilter = "Executable (*.EXE)\0*.EXE\0All (*.*)\0*.*\0"; - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = "Choose client setup exe to be used as drcConfig.exe"; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; - while(!GetOpenFileName(&ofn)); - - // copy the client across - memset(&shFileOpt,0,sizeof(shFileOpt)); - shFileOpt.hwnd = hDlg; - shFileOpt.wFunc = FO_COPY; - shFileOpt.pFrom = exe; - shFileOpt.pTo = SHARENAME LIVEEXPANDEDINSTALLDIR "\\drcConfig.exe\0"; - ret = SHFileOperation(&shFileOpt); - - // Choose a patcher to copy across - memset(&exe, 0, sizeof(exe)); - memset(&ofn, 0, sizeof(OPENFILENAME)); - ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = hDlg; - ofn.lpstrFile = exe; - ofn.nMaxFile = sizeof(exe); - ofn.lpstrFilter = "Executable (*.EXE)\0*.EXE\0All (*.*)\0*.*\0"; - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = "Choose patcher exe to be used as drcPatcher.exe"; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; - while(!GetOpenFileName(&ofn)); - - // copy the client across - memset(&shFileOpt,0,sizeof(shFileOpt)); - shFileOpt.hwnd = hDlg; - shFileOpt.wFunc = FO_COPY; - shFileOpt.pFrom = exe; - shFileOpt.pTo = SHARENAME LIVEEXPANDEDINSTALLDIR "\\drcPatcher.exe\0"; - ret = SHFileOperation(&shFileOpt); - - // Choose a python.dll to copy across - memset(&exe, 0, sizeof(exe)); - memset(&ofn, 0, sizeof(OPENFILENAME)); - ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = hDlg; - ofn.lpstrFile = exe; - ofn.nMaxFile = sizeof(exe); - ofn.lpstrFilter = "Dynamic Lib (*.DLL)\0*.DLL\0All (*.*)\0*.*\0"; - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = "Choose python dll to be used as cypython21.dll"; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; - while(!GetOpenFileName(&ofn)); - - // copy the client across - memset(&shFileOpt,0,sizeof(shFileOpt)); - shFileOpt.hwnd = hDlg; - shFileOpt.wFunc = FO_COPY; - shFileOpt.pFrom = exe; - shFileOpt.pTo = SHARENAME LIVEEXPANDEDINSTALLDIR "\\cypython21.dll\0"; - ret = SHFileOperation(&shFileOpt); - } - - return ret; -} - - -int MigrationTask_GenerateClientManifest::Run(HINSTANCE hInst, HWND hDlg) -{ - int ret = 0; - - // Run generate manifest on the directoy on the server - // Connect to the Data Servers by mapping the share - NETRESOURCE netres; - memset(&netres,0,sizeof(netres)); - netres.lpRemoteName = SHARENAME; - netres.dwDisplayType = RESOURCETYPE_DISK; - ret = (WNetAddConnection3(hDlg,&netres,NULL,NULL,CONNECT_INTERACTIVE) != NO_ERROR); - - if (ret == 0) - { - STARTUPINFO si; - PROCESS_INFORMATION pi; - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - ZeroMemory( &pi, sizeof(pi) ); - ret = !CreateProcess(NULL,"plGenClientManifest.exe client=drcExplorer.exe dir=" SHARENAME LIVECLIENTDIR,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); - WaitForSingleObject(pi.hProcess,INFINITE); - } - - return ret; -} - - -int MigrationTask_DropStoredGames::Run(HINSTANCE hInst, HWND hDlg) -{ - int ret = 0; - - // SSH In & Run the drop Script... - STARTUPINFO si; - PROCESS_INFORMATION pi; - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - si.dwFlags = STARTF_USECOUNTCHARS | STARTF_USESHOWWINDOW; - si.wShowWindow = SW_MINIMIZE; - si.lpTitle = "Live Game Reset"; - si.dwXCountChars = 80; - si.dwYCountChars = 25; - ZeroMemory( &pi, sizeof(pi) ); - ret = CreateProcess(NULL,"ssh2 parable@build.bone.cyan.com \"reset-live-games.sh\"",NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); - WaitForSingleObject(pi.hProcess,INFINITE); - - return ret; -} - - -int MigrationTask_InstallAges::Run(HINSTANCE hInst, HWND hDlg) -{ - int ret = 0; - - // SSH In; Copy the Age Files from the data to the server AgeFiles folder - - STARTUPINFO si; - PROCESS_INFORMATION pi; - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - si.dwFlags = STARTF_USECOUNTCHARS | STARTF_USESHOWWINDOW; - si.wShowWindow = SW_MINIMIZE; - si.lpTitle = "Install Ages"; - si.dwXCountChars = 80; - si.dwYCountChars = 25; - ZeroMemory( &pi, sizeof(pi) ); - ret = !CreateProcess(NULL,"ssh2 parable@build.bone.cyan.com \"install-live-ages.sh\"",NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); - WaitForSingleObject(pi.hProcess,INFINITE); - - return ret; -} - - -int MigrationTask_CopyTestServers::Run(HINSTANCE hInst, HWND hDlg) -{ - int ret = 0; - - // SSH In; Delete ~/Servers; copy ~/Servers-Test to ~/Servers - - STARTUPINFO si; - PROCESS_INFORMATION pi; - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - si.dwFlags = STARTF_USECOUNTCHARS | STARTF_USESHOWWINDOW; - si.wShowWindow = SW_MINIMIZE; - si.lpTitle = "Copy Test Servers"; - si.dwXCountChars = 80; - si.dwYCountChars = 25; - ZeroMemory( &pi, sizeof(pi) ); - switch (GetServer()) - { - case kTest: - ret = !CreateProcess(NULL, - "ssh2 parable@build.bone.cyan.com \"rm -frv ~/Servers; cp -rv ~/Servers-Test ~/Servers\"", - NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); - break; - case kLast: - ret = !CreateProcess(NULL, - "ssh2 parable@build.bone.cyan.com \"rm -frv ~/Servers; cp -rv ~/Servers-Test-Last ~/Servers\"", - NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); - break; - case kBranch: - ret = !CreateProcess(NULL, - "ssh2 parable@build.bone.cyan.com \"rm -frv ~/Servers; cp -rv ~/Servers-Branch ~/Servers\"", - NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); - break; - } - WaitForSingleObject(pi.hProcess,INFINITE); - - return ret; -} - - -int MigrationTask_StartLiveServers::Run(HINSTANCE hInst, HWND hDlg) -{ - int ret = 0; - - // SSH In; Start the Live Servers - - STARTUPINFO si; - PROCESS_INFORMATION pi; - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - si.dwFlags = STARTF_USECOUNTCHARS | STARTF_USESHOWWINDOW; - si.wShowWindow = SW_MINIMIZE; - si.lpTitle = "Start Live Servers"; - si.dwXCountChars = 80; - si.dwYCountChars = 25; - ZeroMemory( &pi, sizeof(pi) ); - ret = !CreateProcess(NULL,"ssh2 parable@build.bone.cyan.com \"start-live-servers.sh\"",NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); - WaitForSingleObject(pi.hProcess,INFINITE); - - return ret; -} - - diff --git a/Sources/Tools/Migration/MigrationTask.h b/Sources/Tools/Migration/MigrationTask.h deleted file mode 100644 index 7e4b6846..00000000 --- a/Sources/Tools/Migration/MigrationTask.h +++ /dev/null @@ -1,155 +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 . - -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 MIGRATION_TASK_H -#define MIGRATION_TASK_H - -#include - -class MigrationTask -{ -public: - enum Servers - { - kTest, - kLast, - kBranch - }; -private: - bool fEnabled; - Servers fServer; -public: - MigrationTask() : fEnabled(false) {} - - virtual char* GetName() = 0; - virtual char* GetDescription() = 0; - bool GetEnabled() const { return fEnabled; } - void SetEnabled(bool val) { fEnabled = val; } - Servers GetServer() const { return fServer; } - void SetServer(Servers server) { fServer = server; } - virtual int Run(HINSTANCE hInst, HWND hDlg) = 0; -}; - - -class MigrationTask_Backup : public MigrationTask -{ -public: - char* GetName() { return "Backup Task"; } - char* GetDescription() { return "Backing up Live Data and Live Servers."; } - int Run(HINSTANCE hInst, HWND hDlg); -}; - - -class MigrationTask_CleanUp : public MigrationTask -{ -public: - char* GetName() { return "Test Data Clean-Up"; } - char* GetDescription() { return "Clean up the test data for copying to the live server."; } - int Run(HINSTANCE hInst, HWND hDlg); -}; - - -class MigrationTask_PatchBuilder : public MigrationTask -{ -public: - char* GetName() { return "Patch Building Task"; } - char* GetDescription() { return "Building the patch set to upgrade the client's data."; } - int Run(HINSTANCE hInst, HWND hDlg); -}; - - -class MigrationTask_DataMigration : public MigrationTask -{ -public: - char* GetName() { return "Data Migration Task"; } - char* GetDescription() { return "Copying the data from the Test Server to the Live Server"; } - int Run(HINSTANCE hInst, HWND hDlg); -}; - -class MigrationTask_InstallClient : public MigrationTask -{ -public: - char* GetName() { return "Install the Client Files"; } - char* GetDescription() { return "Installs the Client files from a specified directory."; } - int Run(HINSTANCE hInst, HWND hDlg); -}; - -class MigrationTask_GenerateClientManifest : public MigrationTask -{ -public: - char* GetName() { return "Generate The Client Manifest"; } - char* GetDescription() { return "Generates the Client Manifest from the Client Files on the Server."; } - int Run(HINSTANCE hInst, HWND hDlg); -}; - -class MigrationTask_DropStoredGames : public MigrationTask -{ -public: - char* GetName() { return "Drop Live Stored Games"; } - char* GetDescription() { return "Drops the Stored Games that are on the live server."; } - int Run(HINSTANCE hInst, HWND hDlg); -}; - -class MigrationTask_InstallAges : public MigrationTask -{ -public: - char* GetName() { return "Install the Ages"; } - char* GetDescription() { return "Installs the Ages from the live data into the Lookup Server."; } - int Run(HINSTANCE hInst, HWND hDlg); -}; - -class MigrationTask_CopyTestServers : public MigrationTask -{ -public: - char* GetName() { return "Copy the Test Servers to Live"; } - char* GetDescription() { return "Copy the Test server executables to the Live server."; } - int Run(HINSTANCE hInst, HWND hDlg); -}; - -class MigrationTask_StartLiveServers : public MigrationTask -{ -public: - char* GetName() { return "Start the Live Servers"; } - char* GetDescription() { return "Starts the Live Servers."; } - int Run(HINSTANCE hInst, HWND hDlg); -}; - -#endif //MIGRATION_TASK_H diff --git a/Sources/Tools/Migration/OptionalDialog.cpp b/Sources/Tools/Migration/OptionalDialog.cpp deleted file mode 100644 index 2ce10bab..00000000 --- a/Sources/Tools/Migration/OptionalDialog.cpp +++ /dev/null @@ -1,122 +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 . - -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 "OptionalDialog.h" -#include "resource.h" -#include - -LRESULT CALLBACK OptionalDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); - - -bool OptionalDialog(HINSTANCE hInstance, HWND hParent, char* desc, unsigned int timeoutsecs, bool defaultyes) -{ - HWND hWnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_OPTIONALDIALOG), hParent, (DLGPROC) OptionalDialogProc); - - ShowWindow(hWnd, SW_SHOW); - - if (timeoutsecs > 0) - { - // Set up timer - SetTimer(hWnd,WM_USER+1,timeoutsecs*1000,NULL); - char timeStr[20]; - Static_SetText(GetDlgItem(hWnd,IDC_TIMELEFT),itoa(timeoutsecs,timeStr,10)); - } - - Static_SetText(GetDlgItem(hWnd,IDC_DESCRIPTION),desc); - if (defaultyes) - { - SetWindowLong(GetDlgItem(hWnd,IDC_BUTTON_YES),GWL_STYLE, - GetWindowLong(GetDlgItem(hWnd,IDC_BUTTON_YES),GWL_STYLE) | BS_DEFPUSHBUTTON); - Static_SetText(GetDlgItem(hWnd,IDC_DEFAULT),"Default: Yes"); - } - else - { - SetWindowLong(GetDlgItem(hWnd,IDC_BUTTON_NO),GWL_STYLE, - GetWindowLong(GetDlgItem(hWnd,IDC_BUTTON_NO),GWL_STYLE) | BS_DEFPUSHBUTTON); - Static_SetText(GetDlgItem(hWnd,IDC_DEFAULT),"Default: No"); - } - - // Main message loop: - MSG msg; - while (GetMessage(&msg, NULL, 0, 0)) - { - if (!IsWindow(hWnd) || !IsDialogMessage(hWnd, &msg)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - - DestroyWindow(hWnd); - - return msg.wParam == -1 ? defaultyes : (bool)(msg.wParam); -} - -// Mesage handler for about box. -LRESULT CALLBACK OptionalDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WM_INITDIALOG: - return TRUE; - - case WM_TIMER: - PostQuitMessage(-1); - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case IDC_BUTTON_YES: - PostQuitMessage(1); - return TRUE; - - case IDC_BUTTON_NO: - PostQuitMessage(0); - return TRUE; - - default: - return FALSE; - } - break; - } - return FALSE; -} diff --git a/Sources/Tools/Migration/OptionalDialog.h b/Sources/Tools/Migration/OptionalDialog.h deleted file mode 100644 index a255c13e..00000000 --- a/Sources/Tools/Migration/OptionalDialog.h +++ /dev/null @@ -1,49 +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 . - -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 OPTIONAL_DIALOG_H -#define OPTIONAL_DIALOG_H - -#include - -bool OptionalDialog(HINSTANCE hInstance, HWND hParent, char* desc, unsigned int timeoutsecs, bool defaultyes); - -#endif //OPTIONAL_DIALOG_H diff --git a/Sources/Tools/Migration/resource.h b/Sources/Tools/Migration/resource.h deleted file mode 100644 index 19fb9751..00000000 --- a/Sources/Tools/Migration/resource.h +++ /dev/null @@ -1,30 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Migration.rc -// -#define IDD_MIGRATION_DIALOG 102 -#define IDI_MIGRATION 107 -#define IDI_SMALL 108 -#define IDD_MAINDIALOG 129 -#define IDD_OPTIONALDIALOG 130 -#define IDC_TASKLIST 1005 -#define IDC_START 1008 -#define IDC_STOP 1009 -#define IDC_DESCRIPTION 1010 -#define IDC_BUTTON_YES 1011 -#define IDC_BUTTON_NO 1012 -#define IDC_RADIOTEST 1018 -#define IDC_RADIOLAST 1019 -#define IDC_RADIOBRANCH 1020 -#define IDC_STATIC -1 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 131 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1020 -#define _APS_NEXT_SYMED_VALUE 110 -#endif -#endif diff --git a/Sources/Tools/Migration/small.ico b/Sources/Tools/Migration/small.ico deleted file mode 100644 index 8f94d9aa..00000000 Binary files a/Sources/Tools/Migration/small.ico and /dev/null differ diff --git a/Sources/Tools/plDatMerger/plAllCreatables.cpp b/Sources/Tools/plDatMerger/plAllCreatables.cpp deleted file mode 100644 index 327badef..00000000 --- a/Sources/Tools/plDatMerger/plAllCreatables.cpp +++ /dev/null @@ -1,74 +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 . - -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 "../pnFactory/plCreator.h" - -#include "plAudible.h" -REGISTER_NONCREATABLE( plAudible ); - -#include "plDrawable.h" -REGISTER_NONCREATABLE( plDrawable ); - -#include "plPhysical.h" -REGISTER_NONCREATABLE( plPhysical ); - -#include "plgDispatch.h" -REGISTER_NONCREATABLE( plDispatchBase ); - -#include "../pnDispatch/pnDispatchCreatable.h" -#include "../pnKeyedObject/pnKeyedObjectCreatable.h" -#include "../pnMessage/pnMessageCreatable.h" -#include "../pnModifier/pnModifierCreatable.h" -#include "../pnNetCommon/pnNetCommonCreatable.h" -#include "../plNetMessage/plNetMessageCreatable.h" -#include "../pnTimer/pnTimerCreatable.h" -#include "../plVault/plVaultCreatable.h" -#include "../plNetCommon/plNetCommonCreatable.h" - -#include "../plResMgr/plResMgrCreatable.h" - -#include "../plMessage/plResMgrHelperMsg.h" -REGISTER_CREATABLE(plResMgrHelperMsg); - -#include "../plUnifiedTime/plUnifiedTime.h" -REGISTER_CREATABLE( plUnifiedTime ); diff --git a/Sources/Tools/plDatMerger/plDatMerger.cpp b/Sources/Tools/plDatMerger/plDatMerger.cpp deleted file mode 100644 index c18bfba4..00000000 --- a/Sources/Tools/plDatMerger/plDatMerger.cpp +++ /dev/null @@ -1,445 +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 . - -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==*/ -////////////////////////////////////////////////////////////////////////////// -// -// plDatMerger - Command line utility app that takes multiple dat files -// and merges them into one -// -////////////////////////////////////////////////////////////////////////////// - -#include "hsTypes.h" -#include "hsStream.h" -#include "hsUtils.h" -#include "hsTimer.h" -#include "../plFile/hsFiles.h" -#include "plRawResManager.h" -#include "plRawPageAccessor.h" -#include "../plResMgr/plRegistryDiskSource.h" -#include "../plResMgr/plRegistryDiskMergedSourceData.h" -#include "../plResMgr/plRegistryHelpers.h" -#include "../plResMgr/plRegistry.h" -#include "../plResMgr/plRegistryNode.h" -#include "../plResMgr/plResMgrSettings.h" -#include "../plResMgr/plPageInfo.h" -#include "../plAgeDescription/plAgeDescription.h" -#include "../plFile/hsFiles.h" -#include "../plFile/plFileUtils.h" -#include "../pnKeyedObject/plKey.h" - -#include -#include - -//// Tiny String Filter Class //////////////////////////////////////////////// - -class plStrFilter -{ - protected: - - hsBool fWildCardSuffix, fInvert; - char *fStr; - - plStrFilter *fChapFilter, *fPageFilter; - - - hsBool IPass( const char *string ) - { - if( fWildCardSuffix ) - { - if( strnicmp( fStr, string, strlen( fStr ) ) == 0 ) - return true; - } - else - { - if( stricmp( fStr, string ) == 0 ) - return true; - } - return false; - } - - public: - plStrFilter() { fWildCardSuffix = fInvert = false; fStr = nil; fChapFilter = fPageFilter = nil; } - - plStrFilter( const char *initLine ) - { - if( initLine[ 0 ] == '-' ) - { - fInvert = true; - initLine++; - } - else if( initLine[ 0 ] == '+' ) - { - initLine++; - fInvert = false; - } - else - fInvert = false; - - fWildCardSuffix = false; - fStr = hsStrcpy( initLine ); - - fChapFilter = fPageFilter = nil; - char *comma = strchr( fStr, ',' ); - if( comma != nil ) - { - char *next = comma + 1; - *comma = 0; - comma = strchr( next, ',' ); - if( comma != nil ) - { - fPageFilter = new plStrFilter( comma + 1 ); - *comma = 0; - } - - fChapFilter = new plStrFilter( next ); - } - - if( fStr[ strlen( fStr ) - 1 ] == '*' ) - { - fWildCardSuffix = true; - fStr[ strlen( fStr ) - 1 ] = 0; - } - } - - ~plStrFilter() - { - delete [] fStr; - delete fChapFilter; - delete fPageFilter; - } - - hsBool Pass( const char *string ) - { - hsBool ret = IPass( string ); - - if( fInvert ) - ret = !ret; - - return ret; - } - - hsBool Pass( const plPageInfo &page ) - { - hsBool ret = IPass( page.GetAge() ) && - fChapFilter->IPass( page.GetChapter() ) && - fPageFilter->IPass( page.GetPage() ); - if( fInvert ) - ret = !ret; - - return ret; - } - - static hsBool Passes( const char *string, hsTArray &filters ) - { - uint32_t i; - - - for( i = 0; i < filters.GetCount(); i++ ) - { - if( !filters[ i ]->Pass( string ) ) - return false; - } - - return true; - } - - static hsBool Passes( const plPageInfo &page, hsTArray &filters ) - { - uint32_t i; - - - for( i = 0; i < filters.GetCount(); i++ ) - { - if( !filters[ i ]->Pass( page ) ) - return false; - } - - return true; - } -}; - -//// Globals ///////////////////////////////////////////////////////////////// - -plRawResManager *gResManager = nil; - -char gDatDirectory[ kFolderIterator_MaxPath ] = "."; -char gDestFileName[ kFolderIterator_MaxPath ]; - -hsTArray fPageFilters; -hsTArray *fCurrFilterList = nil; - -hsTArray fSourcePages; - -plRegistryDiskMergedSourceData *gDestMergeData = nil; - - -//// PrintHelp /////////////////////////////////////////////////////////////// - -int PrintHelp( void ) -{ - puts( "" ); - puts( "Usage:\tplDatMerger [oldDir] [newDir] [patchDir] |-na| |-np| |-fp| |-lAgeName| |-anewAgeDir|" ); - puts( "Where:" ); - puts( "\toldDir is the directory containing the old data files" ); - puts( "\tnewDir is the directory containing the new data files" ); - puts( "\tpatchDir is the directory where the patch files will go" ); - puts( "\t WARNING: This should point to a 'patches'" ); - puts( "\t subdir under 'newDir'; don't use anything else" ); - puts( "\t unless you REALLY know what you're doing." ); - puts( "\t-na is a flag that keeps the builder from updating the" ); - puts( "\t version numbers in the age files (for generating" ); - puts( "\t previous patch versions, for example." ); - puts( "\t-np is a flag that keeps the builder from actually creating the" ); - puts( "\t patch files. Usually helpful when you want to" ); - puts( "\t only update version numbers in the dat files" ); - puts( "\t and the age files. -na and -np are mutually" ); - puts( "\t exclusive." ); - puts( "\t-fp forces writing of entire objects instead of just difference" ); - puts( "\t buffers, for debugging purposes." ); - puts( "\t-l limits processing to the single age given. Don't put a space between the l." ); - puts( "\t and the age name." ); - puts( "\t-a specifies a different directory to put the modified age files in. If not" ); - puts( "\t specified, age files are overwritten in the newDir." ); - puts( "" ); - - return -1; -} - -hsBool ReadConfig( const char *filename ) -{ - hsUNIXStream config; - - - if( !config.Open( filename, "rt" ) ) - return false; - - char line[ 512 ]; - int lineNum = 1; - - while( config.ReadLn( line, sizeof( line ) ) ) - { - // Switch based on command - if( stricmp( line, "[pageFilters]" ) == 0 ) - fCurrFilterList = &fPageFilters; - else if( fCurrFilterList != nil ) - { - fCurrFilterList->Append( new plStrFilter( line ) ); - } - else - { - - char *tok = strtok( line, " \t=" ); - if( tok != nil ) - { - if( stricmp( tok, "datDir" ) == 0 ) - { - tok = strtok( nil, " \t=" ); - if( tok != nil ) - strcpy( gDatDirectory, tok ); - else - { - printf( "Parse error in init file, line %d", lineNum ); - return false; - } - } - else if( stricmp( tok, "destFile" ) == 0 ) - { - tok = strtok( nil, "\n\r" ); - if( tok == nil ) - { - printf( "Parse error in init file, line %d", lineNum ); - return false; - } - strcpy( gDestFileName, tok ); - } - else - { - printf( "Parse error in init file, line %d", lineNum ); - } - } - } - lineNum++; - } - - config.Close(); - return true; -} - -//// Our Main Page Iterator ////////////////////////////////////////////////// - -class plPageStuffer : public plRegistryPageIterator -{ - public: - - virtual hsBool EatPage( plRegistryPageNode *page ) - { - const plPageInfo &info = page->GetPageInfo(); - if( plStrFilter::Passes( info, fPageFilters ) ) - fSourcePages.Append( page ); - return true; - } -}; - -//// IShutdown /////////////////////////////////////////////////////////////// - -void IShutdown( int retCode ) -{ - uint32_t i; - - for( i = 0; i < fPageFilters.GetCount(); i++ ) - delete fPageFilters[ i ]; - - delete gDestMergeData; - - hsgResMgr::Shutdown(); - - if( retCode == 0 ) - printf( "Finished!\n" ); - else - exit( retCode ); -} - -//// main //////////////////////////////////////////////////////////////////// - -int main( int argc, char *argv[] ) -{ - puts( "-----------------------------------------------------" ); - puts( "plDatMerger - Plasma 2 dat file merging utility" ); - puts( "-----------------------------------------------------" ); - - if( argc < 1 || argc > 8 ) - return PrintHelp(); - - // Read our config - ReadConfig( argv[ 1 ] ); - - plResMgrSettings::Get().SetFilterNewerPageVersions( false ); - plResMgrSettings::Get().SetFilterOlderPageVersions( false ); - - // Init our special resMgr - puts( "Initializing resManager..." ); - gResManager = new plRawResManager; - hsgResMgr::Init( gResManager ); - - // Load the registry in to work with - printf( "Loading registry from directory \"%s\"...\n", gDatDirectory ); - gResManager->AddSource( new plRegistryDiskSource( gDatDirectory ) ); - - // Iterate and collect pages to merge - printf( "Collecting pages...\n" ); - plPageStuffer pageIter; - gResManager->IterateAllPages( &pageIter ); - - if( fSourcePages.GetCount() == 0 ) - { - puts( "ERROR: No source pages found to merge!" ); - IShutdown( -1 ); - } - - - // Create a merged data source to represent our dest page - printf( "Merging %d pages to file(s) %s...\n", fSourcePages.GetCount(), gDestFileName ); - - gDestMergeData = new plRegistryDiskMergedSourceData( gDestFileName ); - gDestMergeData->SetNumEntries( fSourcePages.GetCount() ); - - // Open the dest merged streams and write out our initial, incorrect, entry table so we can get positions right - hsStream *destIdxStream = gDestMergeData->WriteEntries( true ); - hsStream *destDatStream = gDestMergeData->OpenData( (uint32_t)-1, "wb" ); - - uint32_t i, bytesRead; - static uint8_t scratchBuffer[ 1024 * 64 ]; // 32k in size - for( i = 0; i < fSourcePages.GetCount(); i++ ) - { - printf( " Merging %s>%s...\n", fSourcePages[ i ]->GetPageInfo().GetAge(), fSourcePages[ i ]->GetPageInfo().GetPage() ); - - // For each page, we open the source streams, read the ENTIRE thing in, front to back, and append it - // to the dest stream. We then update the entry in the mergeData to reflect our info - plMSDEntry &entry = gDestMergeData->GetEntry( i ); - - entry.fIdxOffset = destIdxStream->GetPosition(); - entry.fDatOffset = destDatStream->GetPosition(); - - /// Actually transfer the data - plRegistrySource *srcSource = fSourcePages[ i ]->GetSource(); - - // Idx first - hsStream *srcStream = srcSource->OpenIndexStream( fSourcePages[ i ] ); - uint32_t size = srcStream->GetEOF(); - do - { - bytesRead = srcStream->Read( size > sizeof( scratchBuffer ) ? sizeof( scratchBuffer ) : size, scratchBuffer ); - if( bytesRead > 0 ) - destIdxStream->Write( bytesRead, scratchBuffer ); - size -= bytesRead; - } while( size > 0 && bytesRead > 0 ); - srcSource->CloseIndexStream( fSourcePages[ i ] ); - - // Now dat - srcStream = srcSource->OpenDataStream( fSourcePages[ i ] ); - size = srcStream->GetEOF(); - do - { - bytesRead = srcStream->Read( size > sizeof( scratchBuffer ) ? sizeof( scratchBuffer ) : size, scratchBuffer ); - if( bytesRead > 0 ) - destDatStream->Write( bytesRead, scratchBuffer ); - size -= bytesRead; - } while( size > 0 && bytesRead > 0 ); - srcSource->CloseDataStream( fSourcePages[ i ] ); - - // Update lengths - entry.fIdxLength = destIdxStream->GetPosition() - entry.fIdxOffset; - entry.fDatLength = destDatStream->GetPosition() - entry.fDatOffset; - } - - printf( "Closing destination files...\n" ); - destIdxStream->Close(); - destDatStream->Close(); - - // Re-write the entry table, now that it's correct - printf( "Updating merged table...\n" ); - gDestMergeData->WriteEntries( false ); - - puts( "Shutting down..." ); - IShutdown( 0 ); - return 0; -} - diff --git a/Sources/Tools/plDatMerger/plRawKeyedObject.cpp b/Sources/Tools/plDatMerger/plRawKeyedObject.cpp deleted file mode 100644 index 1a09a299..00000000 --- a/Sources/Tools/plDatMerger/plRawKeyedObject.cpp +++ /dev/null @@ -1,225 +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 . - -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==*/ -////////////////////////////////////////////////////////////////////////////// -// -// plRawPageAccessor - Dangerous little class that lets you take a -// plRegistryPageNode and load the objects in raw (i.e. -// as block memory buffers). -// This should NOT be used in any normal app, only -// utility apps that don't want to load objects in -// normally (which basically means if you're not mcn, -// don't use this!) -// -//// Why We're Bad /////////////////////////////////////////////////////////// -// -// To store all the raw buffers, we stuff them as pointers into the keys -// themselves. This is Way Bad(tm) because those pointers are expecting -// hsKeyedObjects, and what we're giving them certainly ain't those. -// This is why it's only safe to use this class in a very small, controlled -// environment, one where we know the keys won't be accessed in a normal -// fashion so we know nobody will try to use our pointers in a bad way. -// -////////////////////////////////////////////////////////////////////////////// - -#include "hsTypes.h" -#include "hsStream.h" -#include "hsResMgr.h" -#include "plRawKeyedObject.h" -#include "../pnKeyedObject/plKeyImp.h" - - -//// Tiny Yet Now Famous Key Hack //////////////////////////////////////////// - -class plPublicKeyImp : public plKeyImp -{ - public: - - void SetObjectPtrDirect( hsKeyedObject *obj ) - { - fObjectPtr = obj; - } - - void SetAsEmpty( void ) - { - fStartPos = (uint32_t)-1; - fDataLen = (uint32_t)-1; - } - - void SetStartPosFromStream( hsStream *stream ) - { - fStartPos = stream->GetPosition(); - } - - void SetLengthFromStream( hsStream *stream ) - { - fDataLen = stream->GetPosition() - fStartPos; - } -}; - -//// Constructor/Destructor ////////////////////////////////////////////////// - -plRawKeyedObject::plRawKeyedObject() -{ - fSrcKey = nil; - fBuffer = nil; - fBufferSize = 0; -} - -plRawKeyedObject::plRawKeyedObject( const plKey &key, uint32_t size, uint8_t *data ) -{ - fSrcKey = key; - ( (plPublicKeyImp *)(plKeyImp *)key )->SetObjectPtrDirect( this ); - - fBuffer = nil; - fBufferSize = 0; - - SetBuffer( size, data ); -} - -plRawKeyedObject::~plRawKeyedObject() -{ - if( fSrcKey != nil ) - { - ( (plPublicKeyImp *)(plKeyImp *)fSrcKey )->SetObjectPtrDirect( nil ); - fSrcKey = nil; - } - - delete [] fBuffer; -} - -void plRawKeyedObject::SetBuffer( uint32_t size, uint8_t *data ) -{ - delete [] fBuffer; - - if( data == nil ) - { - fBufferSize = 0; - fBuffer = nil; - return; - } - - fBufferSize = size; - fBuffer = new uint8_t[ size ]; - memcpy( fBuffer, data, size ); -} - -void plRawKeyedObject::SetKey( plKey k ) -{ - if( fSrcKey != nil ) - { - ( (plPublicKeyImp *)(plKeyImp *)fSrcKey )->SetObjectPtrDirect( nil ); - } - - fSrcKey = k; - if( fSrcKey != nil ) - { - ( (plPublicKeyImp *)(plKeyImp *)fSrcKey )->SetObjectPtrDirect( this ); - } -} - -void plRawKeyedObject::MarkAsEmpty( plKey &key ) -{ - ( (plPublicKeyImp *)(plKeyImp *)key )->SetAsEmpty(); -} - -void plRawKeyedObject::Write( hsStream *stream ) -{ - // BEFORE we write out, somewhere at the top of our buffer is the key to ourselves - // that all hsKeyedObjects write out as part of their Write() function. We need - // to REPLACE that key with our new key, since our location has now changed. Note - // that this will ONLY work if our location changes, NOT if our name changes, - // because we're relying on the fact that the written size of our key is not - // going to change!!! - { - hsWriteOnlyStream replaceStream( fBufferSize, fBuffer ); - - // Here's the part that REALLY sucks, 'cause it assumes our written format will never change!!!! - // It ALSO assumes, VERY dangerously, that ReadSwap16() will ALWAYS read a size uint16_t - - replaceStream.SetPosition( sizeof( uint16_t ) ); // Get past creatable class that resManager writes out - - hsgResMgr::ResMgr()->WriteKey( &replaceStream, fSrcKey, hsResMgr::kWriteNoCheck ); - } - - ( (plPublicKeyImp *)(plKeyImp *)fSrcKey )->SetStartPosFromStream( stream ); - - stream->Write( fBufferSize, fBuffer ); - - ( (plPublicKeyImp *)(plKeyImp *)fSrcKey )->SetLengthFromStream( stream ); -} - - -//// Warning Stubs /////////////////////////////////////////////////////////// - -void plRawKeyedObject::Validate() -{ - hsAssert( false, "Invalid call on plRawKeyedObject" ); -} - -hsBool plRawKeyedObject::IsFinal() -{ - hsAssert( false, "Invalid call on plRawKeyedObject" ); - return false; -} - -void plRawKeyedObject::Read(hsStream *s, hsResMgr *mgr ) -{ - hsAssert( false, "Invalid call on plRawKeyedObject" ); -} - -void plRawKeyedObject::Write(hsStream *s, hsResMgr *mgr ) -{ - hsAssert( false, "Invalid call on plRawKeyedObject" ); -} - -hsBool plRawKeyedObject::MsgReceive( plMessage *msg ) -{ - hsAssert( false, "Invalid call on plRawKeyedObject" ); - return false; -} - -hsKeyedObject *plRawKeyedObject::GetSharedObject() -{ - hsAssert( false, "Invalid call on plRawKeyedObject" ); - return nil; -} - diff --git a/Sources/Tools/plDatMerger/plRawKeyedObject.h b/Sources/Tools/plDatMerger/plRawKeyedObject.h deleted file mode 100644 index bd166fa8..00000000 --- a/Sources/Tools/plDatMerger/plRawKeyedObject.h +++ /dev/null @@ -1,92 +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 . - -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==*/ -////////////////////////////////////////////////////////////////////////////// -// -// plRawKeyedObject - A fake keyed object type that really just stores itself -// as a raw data buffer. See plRawPageAccessor for details. -// -// Derived from hsKeyedObject so we can try to put some -// warning asserts in where needed. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef _plRawKeyedObject_h -#define _plRawKeyedObject_h - -#include "hsTypes.h" -#include "hsStream.h" -#include "../pnKeyedObject/hsKeyedObject.h" - -class plRawKeyedObject : public hsKeyedObject -{ - protected: - - plKey fSrcKey; - uint32_t fBufferSize; - uint8_t *fBuffer; - - public: - - plRawKeyedObject(); - plRawKeyedObject( const plKey &key, uint32_t size, uint8_t *buffer ); - virtual ~plRawKeyedObject(); - - void SetBuffer( uint32_t size, uint8_t *data ); - uint32_t GetBufferSize( void ) const { return fBufferSize; } - uint8_t *GetBuffer( void ) const { return fBuffer; } - - void SetKey( plKey k ); - void Write( hsStream *stream ); - - static void MarkAsEmpty( plKey &key ); - - // None of the following should ever be called (hence our asserts) - virtual void Validate(); - virtual hsBool IsFinal(); - virtual void Read(hsStream *s, hsResMgr *mgr ); - virtual void Write(hsStream *s, hsResMgr *mgr ); - virtual hsBool MsgReceive( plMessage *msg ); - virtual hsKeyedObject *GetSharedObject(); -}; - - -#endif //_plRawKeyedObject_h diff --git a/Sources/Tools/plDatMerger/plRawPageAccessor.cpp b/Sources/Tools/plDatMerger/plRawPageAccessor.cpp deleted file mode 100644 index 722f7f1d..00000000 --- a/Sources/Tools/plDatMerger/plRawPageAccessor.cpp +++ /dev/null @@ -1,240 +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 . - -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==*/ -////////////////////////////////////////////////////////////////////////////// -// -// plRawPageAccessor - Dangerous little class that lets you take a -// plRegistryPageNode and load the objects in raw (i.e. -// as block memory buffers). -// This should NOT be used in any normal app, only -// utility apps that don't want to load objects in -// normally (which basically means if you're not mcn, -// don't use this!) -// -//// Why We're Bad /////////////////////////////////////////////////////////// -// -// To store all the raw buffers, we stuff them as pointers into the keys -// themselves. This is Way Bad(tm) because those pointers are expecting -// hsKeyedObjects, and what we're giving them certainly ain't those. -// This is why it's only safe to use this class in a very small, controlled -// environment, one where we know the keys won't be accessed in a normal -// fashion so we know nobody will try to use our pointers in a bad way. -// -// Also assumes the current global resManager is a plRawResManager! -// -////////////////////////////////////////////////////////////////////////////// - -#include "hsTypes.h" -#include "hsStream.h" -#include "plRawPageAccessor.h" -#include "plRawResManager.h" -#include "plRawKeyedObject.h" - -#include "hsTemplates.h" -#include "../pnKeyedObject/plKeyImp.h" -#include "../plResMgr/plRegistryNode.h" -#include "../plResMgr/plRegistryHelpers.h" -#include "../plResMgr/plRegistrySource.h" - - -//// Constructor/Destructor ////////////////////////////////////////////////// - -plRawPageAccessor::plRawPageAccessor( plRegistryPageNode *source, hsBool read ) -{ - fSource = source; - if( read ) - ReadFromSource(); -} - -plRawPageAccessor::~plRawPageAccessor() -{ - Release(); -} - -//// Iterators /////////////////////////////////////////////////////////////// - -class plRawReaderIter : public plRegistryKeyIterator -{ - public: - - virtual hsBool EatKey( plKey key ) - { - plRawResManager *mgr = (plRawResManager *)hsgResMgr::ResMgr(); - - uint32_t len; - plKeyImp *imp = (plKeyImp *)key; - uint8_t *buffer = mgr->ReadObjectBuffer( imp, len ); - - // This will also set the object ptr in the key - plRawKeyedObject *obj = new plRawKeyedObject( key, len, buffer ); - delete [] buffer; // rawKeyedObject keeps a copy - - return true; - } -}; - -class plRawWriterIter : public plRegistryKeyIterator -{ - hsStream *fStream; - - public: - - plRawWriterIter( hsStream *stream ) : fStream( stream ) {} - - virtual hsBool EatKey( plKey key ) - { - plRawResManager *mgr = (plRawResManager *)hsgResMgr::ResMgr(); - - plRawKeyedObject *obj = (plRawKeyedObject *)key->ObjectIsLoaded(); - if( obj == nil ) - { - // Mark the key as not written - plRawKeyedObject::MarkAsEmpty( key ); - return true; - } - - obj->Write( fStream ); - return true; - } -}; - -class plRawReleaseIter : public plRegistryKeyIterator -{ - public: - - virtual hsBool EatKey( plKey key ) - { - plRawKeyedObject *obj = (plRawKeyedObject *)key->ObjectIsLoaded(); - delete obj; - - return true; - } -}; - - -//// Various Functions /////////////////////////////////////////////////////// - -void plRawPageAccessor::ReadFromSource( void ) -{ - if( !fSource->IsLoaded() ) - fSource->LoadKeysFromSource(); - - plRawReaderIter iter; - fSource->IterateKeys( &iter ); -} - -void plRawPageAccessor::WriteToSource( void ) -{ - if( fSource->GetSource() == nil ) - { - hsAssert( false, "Unable to write accessor to disk; no source defined!" ); - return; - } - - // Write out objects first - hsStream *stream = fSource->GetSource()->OpenDataStream( fSource, true ); - if( stream == nil ) - return; - - plRawWriterIter writer( stream ); - fSource->IterateKeys( &writer ); - - fSource->GetSource()->CloseDataStream( fSource ); - - // Now write out the keys - fSource->WriteKeysToSource(); -} - -void plRawPageAccessor::Release( void ) -{ - plRawReleaseIter iter; - fSource->IterateKeys( &iter ); - - fSource->ClearKeyLists(); -} - -void plRawPageAccessor::AddCopy( const plKey &origKey ) -{ - plRawResManager *mgr = (plRawResManager *)hsgResMgr::ResMgr(); - plKey newKey; - - - // Get the source object - plRawKeyedObject *srcObj = (plRawKeyedObject *)origKey->ObjectIsLoaded(); - - // Construct a new uoid - plUoid newUoid( fSource->GetPageInfo().GetLocation(), - origKey->GetUoid().GetClassType(), - origKey->GetUoid().GetObjectName() ); - - // Does it already exist? - newKey = mgr->FindKey( newUoid ); - if( newKey != nil ) - { - // Yup, gotta get rid of old object (if there is one) - plRawKeyedObject *obj = (plRawKeyedObject *)newKey->ObjectIsLoaded(); - delete obj; - } - else - { - // Nope, gotta create key first - newKey = mgr->NewBlankKey( newUoid ); - } - - // Force the key's uoid to the right uoid, now that it's in the right page - ( (plKeyImp *)newKey )->SetUoid( origKey->GetUoid() ); - - // Assign a new buffer to the key - if( srcObj != nil ) - { - // Will set obj pointer in key - plRawKeyedObject *obj = new plRawKeyedObject( newKey, srcObj->GetBufferSize(), srcObj->GetBuffer() ); - } -} - -void plRawPageAccessor::UpdateDataVersion( plRegistryPageNode *from ) -{ - plPageInfo &orig = from->GetPageInfo(); - - fSource->GetPageInfo().SetVersion( orig.GetMajorVersion(), orig.GetMinorVersion() ); - fSource->GetPageInfo().SetReleaseVersion( orig.GetReleaseVersion() ); -} - diff --git a/Sources/Tools/plDatMerger/plRawPageAccessor.h b/Sources/Tools/plDatMerger/plRawPageAccessor.h deleted file mode 100644 index f6174e64..00000000 --- a/Sources/Tools/plDatMerger/plRawPageAccessor.h +++ /dev/null @@ -1,85 +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 . - -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==*/ -////////////////////////////////////////////////////////////////////////////// -// -// plRawPageAccessor - Dangerous little class that lets you take a -// plRegistryPageNode and load the objects in raw (i.e. -// as block memory buffers). -// This should NOT be used in any normal app, only -// utility apps that don't want to load objects in -// normally (which basically means if you're not mcn, -// don't use this!) -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef _plRawPageAccessor_h -#define _plRawPageAccessor_h - -#include "hsTypes.h" -#include "hsStream.h" - -class plRegistryPageNode; -class plKey; - -class plRawPageAccessor -{ - protected: - - plRegistryPageNode *fSource; - - public: - - plRawPageAccessor( plRegistryPageNode *source, hsBool read = true ); - virtual ~plRawPageAccessor(); - - void ReadFromSource( void ); - void WriteToSource( void ); - void Release( void ); - - void UpdateDataVersion( plRegistryPageNode *from ); - - void AddCopy( const plKey &origKey ); - -}; - - -#endif //_plRawPageAccessor_h diff --git a/Sources/Tools/plDatMerger/plRawResManager.cpp b/Sources/Tools/plDatMerger/plRawResManager.cpp deleted file mode 100644 index b0aabbd6..00000000 --- a/Sources/Tools/plDatMerger/plRawResManager.cpp +++ /dev/null @@ -1,132 +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 . - -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==*/ -////////////////////////////////////////////////////////////////////////////// -// -// plRawResManager - Small public resManager thingy for reading/writing -// objects raw. -// -////////////////////////////////////////////////////////////////////////////// - -#include "hsTypes.h" -#include "hsStream.h" -#include "plRawResManager.h" - -#include "../plResMgr/plRegistry.h" -#include "../plResMgr/plPageInfo.h" -#include "../plResMgr/plRegistrySource.h" -#include "../plResMgr/plRegistryNode.h" -#include "../plResMgr/plRegistryHelpers.h" -#include "../pnKeyedObject/plKeyImp.h" - - -plRegistryPageNode *plRawResManager::FindPage( const char *age, const char *chapter, const char *page ) -{ - return fRegistry->FindPage( age, chapter, page ); -} - -plRegistryPageNode *plRawResManager::CreatePage( const plPageInfo &info ) -{ - plRegistryPageNode *page = fRegistry->CreatePage( info.GetLocation(), info.GetAge(), info.GetChapter(), info.GetPage() ); - - if( page != nil ) - { - page->SetLoaded( true ); // We're "loaded", i.e. constructing this at runtime - fIOSources[ 0 ]->AddLocToSource( page ); - } - - return page; -} - -uint8_t *plRawResManager::ReadObjectBuffer( plKeyImp *pKey, uint32_t &retBuffLength ) -{ - uint8_t *buffer = nil; - - - hsAssert( pKey, "Null Key" ); - hsAssert( pKey->GetStartPos() != (uint32_t)-1, "Missing StartPos" ); - hsAssert( pKey->GetDataLen() != (uint32_t)-1, "Missing Data Length" ); - - if( pKey->GetStartPos() == (uint32_t)-1 || pKey->GetDataLen() == (uint32_t)-1 ) - { - // Try to recover from this by just not reading an object - retBuffLength = 0; - return nil; - } - - plRegistryDataStream *dataStream = fRegistry->OpenPageDataStream( pKey->GetUoid().GetLocation(), false ); - - if( dataStream != nil && dataStream->GetStream() != nil ) - { - hsStream *stream = dataStream->GetStream(); - - uint32_t oldPos = stream->GetPosition(); - stream->SetPosition( pKey->GetStartPos() ); - - buffer = new uint8_t[ pKey->GetDataLen() ]; - if( buffer != nil ) - { - *( (uint32_t *)buffer ) = pKey->GetDataLen(); - stream->Read( pKey->GetDataLen(), (uint8_t *)buffer ); - retBuffLength = pKey->GetDataLen(); - } - else - retBuffLength = 0; - - // Restore old position now - stream->SetPosition( oldPos ); - } - delete dataStream; - - return buffer; -} - -plKey plRawResManager::NewBlankKey( const plUoid &newUoid ) -{ - plKeyImp *newKey = new plKeyImp; - - - newKey->SetUoid( newUoid ); - fRegistry->AddKey( newKey ); - - plKey keyPtr = plKey::Make( newKey ); - return keyPtr; -} diff --git a/Sources/Tools/plDatMerger/plRawResManager.h b/Sources/Tools/plDatMerger/plRawResManager.h deleted file mode 100644 index 69083e00..00000000 --- a/Sources/Tools/plDatMerger/plRawResManager.h +++ /dev/null @@ -1,72 +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 . - -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==*/ -////////////////////////////////////////////////////////////////////////////// -// -// plRawResManager - Small public resManager thingy for reading/writing -// objects raw. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef _plRawResManager_h -#define _plRawResManager_h - -#include "hsTypes.h" -#include "hsStream.h" -#include "../plResMgr/plResManager.h" - -class plPageInfo; -class plKeyImp; - -class plRawResManager : public plResManager -{ - public: - - plRegistryPageNode *FindPage( const char *age, const char *chapter, const char *page ); - plRegistryPageNode *CreatePage( const plPageInfo &info ); - - uint8_t *ReadObjectBuffer( plKeyImp *key, uint32_t &retLength ); - - plKey NewBlankKey( const plUoid &newUoid ); -}; - - -#endif //_plRawResManager_h