Adam Johnson
13 years ago
29 changed files with 0 additions and 4234 deletions
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// 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 <stdio.h> |
|
||||||
#include <windows.h> |
|
||||||
#include <shlobj.h> |
|
||||||
#include <string> |
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
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; i<argc; i++) |
|
||||||
{ |
|
||||||
if (!varname) |
|
||||||
varname = args[i]; |
|
||||||
else if (stricmp(args[i],"-replace")==0) |
|
||||||
replace = true; |
|
||||||
else |
|
||||||
sprintf(prompt,"%s",args[i]); |
|
||||||
} |
|
||||||
if (prompt[0] == '\0') |
|
||||||
sprintf(prompt,"Set the '%s' environment variable by browsing to the desired folder and then click Ok:",varname); |
|
||||||
|
|
||||||
|
|
||||||
// open registry key
|
|
||||||
HKEY hEnvKey; |
|
||||||
RegOpenKeyEx(HKEY_CURRENT_USER,"Environment",0,KEY_WRITE|KEY_READ,&hEnvKey); |
|
||||||
|
|
||||||
// check if var already exists
|
|
||||||
char value[MAX_PATH]; |
|
||||||
DWORD bufsz = MAX_PATH; |
|
||||||
if(RegQueryValueEx(hEnvKey,varname,NULL,NULL,(LPBYTE)value,&bufsz) == ERROR_SUCCESS) |
|
||||||
{ |
|
||||||
// exit if already exists and not replace
|
|
||||||
if (!replace) |
|
||||||
{ |
|
||||||
RegCloseKey(hEnvKey); |
|
||||||
return EXIT_SUCCESS; |
|
||||||
} |
|
||||||
gCurrentValue = value; |
|
||||||
} |
|
||||||
|
|
||||||
TryAgain: |
|
||||||
// open browse for folder dialog
|
|
||||||
BROWSEINFO bInfo; |
|
||||||
LPITEMIDLIST itemList; |
|
||||||
LPMALLOC shMalloc; |
|
||||||
memset( &bInfo, 0, sizeof( bInfo ) ); |
|
||||||
bInfo.hwndOwner = NULL; |
|
||||||
bInfo.pidlRoot = NULL; |
|
||||||
bInfo.lpszTitle = prompt; |
|
||||||
bInfo.ulFlags = BIF_NEWDIALOGSTYLE; |
|
||||||
bInfo.pszDisplayName = NULL; |
|
||||||
bInfo.lpfn = BrosweForFolderCallbackProc; |
|
||||||
itemList = SHBrowseForFolder(&bInfo); |
|
||||||
if (!itemList) |
|
||||||
goto TryAgain; |
|
||||||
SHGetPathFromIDList(itemList,value); |
|
||||||
SHGetMalloc(&shMalloc); |
|
||||||
shMalloc->Free(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; |
|
||||||
} |
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
/******************************************************************************
|
|
||||||
ValdezInterface.h |
|
||||||
|
|
||||||
Eric Ellis |
|
||||||
******************************************************************************/ |
|
||||||
|
|
||||||
#ifndef _JV_VALDEZINTERFACE_H_ |
|
||||||
#define _JV_VALDEZINTERFACE_H_ |
|
||||||
|
|
||||||
#define MAXASS_CLASS_ID Class_ID(0x5c61b5a6, 0x3b298521) |
|
||||||
#define kMaxAssGetValdezInterface 33 |
|
||||||
|
|
||||||
#include <commdlg.h> |
|
||||||
#include <bmmlib.h> |
|
||||||
#include <guplib.h> |
|
||||||
#include <vector> |
|
||||||
#include <string> |
|
||||||
#include <comdef.h> |
|
||||||
|
|
||||||
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<string>& 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_ |
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
/**********************************************************************
|
|
||||||
*< |
|
||||||
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; |
|
||||||
} |
|
||||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
#ifndef __HSMAXLAYER_H |
|
||||||
#define __HSMAXLAYER_H |
|
||||||
|
|
||||||
#include <bmmlib.h> |
|
||||||
#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<BitmapInfo> mipmapInfo; // references
|
|
||||||
Tab<BOOL> mipmapOn; |
|
||||||
Tab<int> mipmapLevel; |
|
||||||
}; |
|
||||||
|
|
||||||
#endif |
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
#ifndef __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 |
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
#include "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 <map> |
|
||||||
|
|
||||||
class plMaterialUpdate : public UtilityObj |
|
||||||
{ |
|
||||||
protected: |
|
||||||
HWND fhPanel; |
|
||||||
Interface *fInterface; |
|
||||||
std::map<MtlBase*, MtlBase*> 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, |
|
||||||
*/ |
|
||||||
} |
|
@ -1,8 +0,0 @@ |
|||||||
LIBRARY |
|
||||||
EXPORTS |
|
||||||
LibDescription @1 |
|
||||||
LibNumberClasses @2 |
|
||||||
LibClassDesc @3 |
|
||||||
LibVersion @4 |
|
||||||
SECTIONS |
|
||||||
.data READ WRITE |
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
/**********************************************************************
|
|
||||||
*< |
|
||||||
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
|
|
@ -1,103 +0,0 @@ |
|||||||
//Microsoft Developer Studio generated resource script. |
|
||||||
// |
|
||||||
#include "resource.h" |
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN |
|
||||||
#include <windows.h> |
|
||||||
#define IDC_STATIC (-1) // all static controls |
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////// |
|
||||||
// English (U.S.) resources |
|
||||||
|
|
||||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) |
|
||||||
#ifdef _WIN32 |
|
||||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US |
|
||||||
#pragma code_page(1252) |
|
||||||
#endif //_WIN32 |
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////// |
|
||||||
// |
|
||||||
// Dialog |
|
||||||
// |
|
||||||
|
|
||||||
IDD_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 |
|
||||||
|
|
@ -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 |
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
// Migration.cpp : Defines the entry point for the application.
|
|
||||||
//
|
|
||||||
#include <windows.h> |
|
||||||
#include <windowsx.h> |
|
||||||
#include <process.h> |
|
||||||
#include <commctrl.h> |
|
||||||
#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; |
|
||||||
} |
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
#ifndef PLASMA_MIGRATION_TOOL |
|
||||||
#define PLASMA_MIGRATION_TOOL |
|
||||||
|
|
||||||
#include "MigrationTask.h" |
|
||||||
#include <vector> |
|
||||||
|
|
||||||
void LoadTasks(HWND hListView); |
|
||||||
unsigned int __stdcall RunTasks(void* args); |
|
||||||
|
|
||||||
class MigrationTaskList |
|
||||||
{ |
|
||||||
public: |
|
||||||
typedef std::vector<MigrationTask*> TaskList; |
|
||||||
private: |
|
||||||
TaskList fList; |
|
||||||
public: |
|
||||||
MigrationTaskList(); |
|
||||||
static MigrationTaskList* GetInstance(); |
|
||||||
TaskList* GetList() { return &fList; } |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif //PLASMA_MIGRATION_TOOL
|
|
Before Width: | Height: | Size: 1.1 KiB |
@ -1,113 +0,0 @@ |
|||||||
//Microsoft Developer Studio generated resource script. |
|
||||||
// |
|
||||||
#include "resource.h" |
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN |
|
||||||
#include <windows.h> |
|
||||||
#define IDC_STATIC (-1) // all static controls |
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////// |
|
||||||
// English (U.S.) resources |
|
||||||
|
|
||||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) |
|
||||||
#ifdef _WIN32 |
|
||||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US |
|
||||||
#pragma code_page(1252) |
|
||||||
#endif //_WIN32 |
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////// |
|
||||||
// |
|
||||||
// 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 |
|
||||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
#include "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; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
#ifndef MIGRATION_TASK_H |
|
||||||
#define MIGRATION_TASK_H |
|
||||||
|
|
||||||
#include <windows.h> |
|
||||||
|
|
||||||
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
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
#include "OptionalDialog.h" |
|
||||||
#include "resource.h" |
|
||||||
#include <windowsx.h> |
|
||||||
|
|
||||||
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; |
|
||||||
} |
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
#ifndef OPTIONAL_DIALOG_H |
|
||||||
#define OPTIONAL_DIALOG_H |
|
||||||
|
|
||||||
#include <windows.h> |
|
||||||
|
|
||||||
bool OptionalDialog(HINSTANCE hInstance, HWND hParent, char* desc, unsigned int timeoutsecs, bool defaultyes); |
|
||||||
|
|
||||||
#endif //OPTIONAL_DIALOG_H
|
|
@ -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 |
|
Before Width: | Height: | Size: 318 B |
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
#include "hsTypes.h" |
|
||||||
|
|
||||||
#include "../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 ); |
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// 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 <stdio.h> |
|
||||||
#include <stdlib.h> |
|
||||||
|
|
||||||
//// 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<plStrFilter *> &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<plStrFilter *> &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<plStrFilter *> fPageFilters; |
|
||||||
hsTArray<plStrFilter *> *fCurrFilterList = nil; |
|
||||||
|
|
||||||
hsTArray<plRegistryPageNode *> 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; |
|
||||||
} |
|
||||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// 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; |
|
||||||
} |
|
||||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// 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
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// 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() ); |
|
||||||
} |
|
||||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// 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
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// 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; |
|
||||||
} |
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// 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
|
|
Loading…
Reference in new issue