2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

Initial Commit of CyanWorlds.com Engine Open Source Client/Plugin

This commit is contained in:
JWPlatt
2011-03-12 12:34:52 -05:00
commit a20a222fc2
3976 changed files with 1301356 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,47 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
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;
}

View File

@ -0,0 +1,97 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "HeadSpin.h"
#include "plInstallerReg.h"
#include <windows.h>
static HKEY GetInstallerKey()
{
HKEY hSoftKey = NULL;
HKEY hCompanyKey = NULL;
HKEY hAppKey = NULL;
if(RegOpenKeyEx(HKEY_CURRENT_USER, "software", 0, KEY_WRITE|KEY_READ,
&hSoftKey) == ERROR_SUCCESS)
{
DWORD dw;
if(RegCreateKeyEx(hSoftKey, "Cyan", 0, REG_NONE,
REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_READ, NULL,
&hCompanyKey, &dw) == ERROR_SUCCESS)
{
RegCreateKeyEx(hCompanyKey, "PlasmaInstaller", 0, REG_NONE,
REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_READ, NULL,
&hAppKey, &dw);
}
}
if (hSoftKey != NULL)
RegCloseKey(hSoftKey);
if (hCompanyKey != NULL)
RegCloseKey(hCompanyKey);
return hAppKey;
}
static void WriteRegString(const char* valueName, const char* value)
{
HKEY installKey = GetInstallerKey();
RegSetValueEx(installKey, valueName, 0, REG_SZ, (const BYTE*)value, strlen(value)+1);
RegCloseKey(installKey);
}
static bool ReadRegString(const char* valueName, char* value, DWORD size)
{
HKEY installKey = GetInstallerKey();
bool ret = (RegQueryValueEx(installKey, valueName, NULL, NULL, (LPBYTE)value, &size) == ERROR_SUCCESS);
RegCloseKey(installKey);
return ret;
}
void plInstallerReg::SetClientDir(const char* dir)
{
WriteRegString("Client", dir);
}
void plInstallerReg::SetMaxDir(const char* dir)
{
WriteRegString("3dsmax", dir);
}
const char* plInstallerReg::GetClientDir()
{
static char dir[MAX_PATH];
if (!ReadRegString("Client", dir, sizeof(dir)))
strcpy(dir, "C:\\PlasmaClient");
return dir;
}
const char* plInstallerReg::GetMaxDir()
{
static char dir[MAX_PATH];
dir[0] = '\0';
ReadRegString("3dsmax", dir, sizeof(dir));
return dir;
}

View File

@ -0,0 +1,34 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
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();
}

View File

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

View File

@ -0,0 +1,57 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
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; }
};

View File

@ -0,0 +1,129 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// 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
"#include ""afxres.h""\r\n"
"\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

View File

@ -0,0 +1,104 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "HeadSpin.h"
#include <windows.h>
static HKEY GetEnvironKey()
{
HKEY hSystemKey = NULL;
HKEY hControlSetKey = NULL;
HKEY hControlKey = NULL;
HKEY hSessionKey = NULL;
HKEY hEnvironKey = NULL;
if ((RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SYSTEM", 0, KEY_READ, &hSystemKey) == ERROR_SUCCESS) &&
(RegOpenKeyEx(hSystemKey, "CurrentControlSet", 0, KEY_READ, &hControlSetKey) == ERROR_SUCCESS) &&
(RegOpenKeyEx(hControlSetKey, "Control", 0, KEY_READ, &hControlKey) == ERROR_SUCCESS) &&
(RegOpenKeyEx(hControlKey, "Session Manager", 0, KEY_READ, &hSessionKey) == ERROR_SUCCESS))
{
RegOpenKeyEx(hSessionKey, "Environment", 0, KEY_READ | KEY_WRITE, &hEnvironKey);
}
if (hSystemKey != NULL)
RegCloseKey(hSystemKey);
if (hControlSetKey != NULL)
RegCloseKey(hControlSetKey);
if (hControlKey != NULL)
RegCloseKey(hControlKey);
if (hSessionKey != NULL)
RegCloseKey(hSessionKey);
return hEnvironKey;
}
void SetPlasmaPath(const char* plasmaPath)
{
bool pathSet = false;
HKEY hEnvironKey = GetEnvironKey();
if (hEnvironKey)
{
// Make sure the PlasmaGameDir var is in the path
DWORD size = 0;
if (ERROR_SUCCESS == RegQueryValueEx(hEnvironKey, "Path", NULL, NULL, NULL, &size))
{
char* oldPath = new char[size];
static const char* kPlasmaVar = "%PlasmaGameDir%";
if (ERROR_SUCCESS == RegQueryValueEx(hEnvironKey, "Path", NULL, NULL, (BYTE*)oldPath, &size))
{
pathSet = (strstr(oldPath, kPlasmaVar) != NULL);
if (!pathSet)
{
char* newPath = new char[size+strlen(kPlasmaVar)+1];
strcpy(newPath, oldPath);
strcat(newPath, ";");
strcat(newPath, kPlasmaVar);
RegSetValueEx(hEnvironKey, "Path", 0, REG_EXPAND_SZ, (BYTE*)newPath, strlen(newPath)+1);
delete [] newPath;
}
}
delete [] oldPath;
}
// Set the PlasmaGameDir var
RegSetValueEx(hEnvironKey, "PlasmaGameDir", 0, REG_SZ, (BYTE*)plasmaPath, strlen(plasmaPath)+1);
// Notify command prompts and stuff that environ changed
DWORD ret;
SendMessageTimeout(HWND_BROADCAST,
WM_SETTINGCHANGE,
0,
(LPARAM)"Environment",
SMTO_ABORTIFHUNG,
5000,
&ret);
}
}

View File

@ -0,0 +1,26 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
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);

View File

@ -0,0 +1,153 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
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);
}

View File

@ -0,0 +1,50 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
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

View File

@ -0,0 +1,30 @@
//{{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