1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

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

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

View File

@ -0,0 +1,114 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#define CLASSNAME "plResBrowser" // Used in WinInit()
#define WINDOWNAME "plResBrowser"
#include "HeadSpin.h"
#include "hsTypes.h"
#include <windows.h>
#include "res/resource.h"
#include "pnAllCreatables.h"
#include "../plResMgr/plResMgrCreatable.h"
#include "../plResMgr/plResManager.h"
#include "../plResMgr/plResMgrSettings.h"
#include "../plMessage/plResMgrHelperMsg.h"
#include "../plUnifiedTime/plUnifiedTimeCreatable.h"
REGISTER_CREATABLE(plResMgrHelperMsg);
HINSTANCE gInstance;
char *gCommandLine = nil;
HWND gMainWindow = nil;
LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
BOOL WinInit( HINSTANCE hInst, int nCmdShow );
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
MSG msg;
HACCEL accelTable = LoadAccelerators( hInstance, MAKEINTRESOURCE( IDR_ACCELERATOR1 ) );
plResMgrSettings::Get().SetFilterNewerPageVersions( false );
plResMgrSettings::Get().SetFilterOlderPageVersions( false );
gCommandLine = (char *)lpCmdLine;
plResManager *rMgr = TRACKED_NEW plResManager;
hsgResMgr::Init( rMgr );
if( !WinInit( hInstance, nCmdShow ) )
return -1;
while( GetMessage( &msg, NULL, 0, 0 ) )
{
if( !TranslateAccelerator( gMainWindow, accelTable, &msg ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
hsgResMgr::Shutdown();
return 0;
}
BOOL WinInit(HINSTANCE hInst, int nCmdShow)
{
gInstance = hInst;
// Fill out WNDCLASS info
WNDCLASS wndClass;
wndClass.style = 0; // CS_HREDRAW | CS_VREDRAW;
wndClass.lpfnWndProc = WndProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = hInst;
wndClass.hIcon = LoadIcon( hInst, MAKEINTRESOURCE( IDI_APPICON ) );
wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)GetSysColorBrush( COLOR_3DFACE );
wndClass.lpszMenuName = MAKEINTRESOURCE( IDR_APPMENU );
wndClass.lpszClassName = CLASSNAME;
// can only run one at a time anyway, so just quit if another is running
if (!RegisterClass(&wndClass))
return FALSE;
DWORD dwStyle = WS_POPUP | WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE;
DWORD dwExStyle = WS_EX_ACCEPTFILES;
// Create a window
gMainWindow = CreateWindowEx(dwExStyle, CLASSNAME, WINDOWNAME,
dwStyle, 10, 10,
800,
600,
NULL, NULL, hInst, NULL);
return TRUE;
}

View File

@ -0,0 +1,175 @@
# Microsoft Developer Studio Project File - Name="plResBrowser" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=plResBrowser - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "plResBrowser.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "plResBrowser.mak" CFG="plResBrowser - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "plResBrowser - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "plResBrowser - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "plResBrowser - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../../Sources/Plasma/NucleusLib/inc" /I "..\..\..\Sources\Plasma\PubUtilLib\inc" /I "..\..\..\Sources\Plasma\CoreLib" /I "../../../Sources/Plasma/FeatureLib/inc" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 ws2_32.lib wininet.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib Shlwapi.lib libcrypto.a /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /libpath:"..\..\..\..\StaticSDKs\Win32\OpenSSL\lib"
# Begin Special Build Tool
TargetPath=.\Release\plResBrowser.exe
SOURCE="$(InputPath)"
PostBuild_Cmds=xcopy /Y $(TargetPath) ..\..\..\tools\
# End Special Build Tool
!ELSEIF "$(CFG)" == "plResBrowser - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm- /GX /ZI /Od /I "../../../Sources/Plasma/NucleusLib/inc" /I "..\..\..\Sources\Plasma\PubUtilLib\inc" /I "..\..\..\Sources\Plasma\CoreLib" /I "../../../Sources/Plasma/FeatureLib/inc" /D "WIN32" /D "_DEBUG" /D "_LIB" /D "_MBCS" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 ws2_32.lib wininet.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib Shlwapi.lib libcrypto.a /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc.lib" /pdbtype:sept /libpath:"..\..\..\..\StaticSDKs\Win32\OpenSSL\lib"
# Begin Special Build Tool
TargetPath=.\Debug\plResBrowser.exe
SOURCE="$(InputPath)"
PostBuild_Cmds=xcopy /Y $(TargetPath) ..\..\..\tools\
# End Special Build Tool
!ENDIF
# Begin Target
# Name "plResBrowser - Win32 Release"
# Name "plResBrowser - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\plPatchDetail.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Sources\Tools\plResBrowser\plResBrowser.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Sources\Tools\plResBrowser\plResBrowserWndProc.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Sources\Tools\plResBrowser\plResTreeView.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Sources\Tools\plResBrowser\plWinRegistryTools.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\..\..\Sources\Tools\plResBrowser\plResTreeView.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Sources\Tools\plResBrowser\plWinRegistryTools.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\dataicon.ico
# End Source File
# Begin Source File
SOURCE=..\..\..\Sources\Tools\plResBrowser\res\icon1.ico
# End Source File
# Begin Source File
SOURCE=.\res\icon2.ico
# End Source File
# Begin Source File
SOURCE=.\res\indexico.ico
# End Source File
# Begin Source File
SOURCE=.\res\mergedda.ico
# End Source File
# Begin Source File
SOURCE=.\res\mergedin.ico
# End Source File
# Begin Source File
SOURCE=..\..\..\Sources\Tools\plResBrowser\res\plResBrowser.rc
# End Source File
# Begin Source File
SOURCE=..\..\..\Sources\Tools\plResBrowser\res\resource.h
# End Source File
# End Group
# End Target
# End Project

View File

@ -0,0 +1,292 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="plResBrowser"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../Sources/Plasma/NucleusLib/inc;..\..\..\Sources\Plasma\PubUtilLib\inc;..\..\..\Sources\Plasma\CoreLib;../../../Sources/Plasma/FeatureLib/inc"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
ForceConformanceInForLoopScope="TRUE"
PrecompiledHeaderFile=".\Debug/plResBrowser.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="ws2_32.lib wininet.lib winmm.lib odbc32.lib odbccp32.lib comctl32.lib Shlwapi.lib libcrypto.a Rpcrt4.lib"
OutputFile=".\Debug/plResBrowser.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\..\..\..\StaticSDKs\Win32\OpenSSL\lib"
IgnoreDefaultLibraryNames="libc.lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/plResBrowser.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Debug/plResBrowser.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="xcopy /Y &quot;$(TargetPath)&quot; ..\..\..\tools\"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../../../Sources/Plasma/NucleusLib/inc;..\..\..\Sources\Plasma\PubUtilLib\inc;..\..\..\Sources\Plasma\CoreLib;../../../Sources/Plasma/FeatureLib/inc"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
ForceConformanceInForLoopScope="TRUE"
PrecompiledHeaderFile=".\Release/plResBrowser.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="ws2_32.lib wininet.lib winmm.lib odbc32.lib odbccp32.lib comctl32.lib Shlwapi.lib libcrypto.a Rpcrt4.lib"
OutputFile=".\Release/plResBrowser.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\..\..\..\StaticSDKs\Win32\OpenSSL\lib"
IgnoreDefaultLibraryNames="libc.lib"
ProgramDatabaseFile=".\Release/plResBrowser.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Release/plResBrowser.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="xcopy /Y &quot;$(TargetPath)&quot; ..\..\..\tools\"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="plResBrowser.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="plResBrowserWndProc.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="plResTreeView.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="plWinRegistryTools.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="plResTreeView.h">
</File>
<File
RelativePath="plWinRegistryTools.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath="res\dataicon.ico">
</File>
<File
RelativePath="res\icon1.ico">
</File>
<File
RelativePath="res\icon2.ico">
</File>
<File
RelativePath="res\indexico.ico">
</File>
<File
RelativePath="res\mergedda.ico">
</File>
<File
RelativePath="res\mergedin.ico">
</File>
<File
RelativePath="res\plResBrowser.rc">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="res"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="res"/>
</FileConfiguration>
</File>
<File
RelativePath="res\resource.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,424 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "hsTypes.h"
#include "hsTemplates.h"
#include <windows.h>
#include "afxres.h"
#include "res/resource.h"
#include <commctrl.h>
#include <shlwapi.h>
#include <shlobj.h>
#include "plResTreeView.h"
#include "../plResMgr/plResManager.h"
#include "../plResMgr/plResMgrSettings.h"
#include "plWinRegistryTools.h"
#include "../plFile/hsFiles.h"
#define IDC_REGTREEVIEW 1000
extern HINSTANCE gInstance;
extern char *gCommandLine;
HWND gTreeView;
HWND gInfoDlg;
class plWaitCursor
{
HCURSOR fOrig;
public:
plWaitCursor()
{
fOrig = ::SetCursor( ::LoadCursor( nil, IDC_WAIT ) );
}
~plWaitCursor()
{
::SetCursor( fOrig );
}
};
void SetWindowTitle( HWND hWnd, char *path )
{
char fun[ MAX_PATH + 50 ];
sprintf( fun, "plResBrowser%s%s", path != nil ? " - " : "", path != nil ? path : "" );
SetWindowText( hWnd, fun );
}
BOOL CALLBACK AboutDialogProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
if( msg == WM_COMMAND )
EndDialog( hWnd, 0 );
return 0;
}
LRESULT CALLBACK HandleCommand( HWND hWnd, WPARAM wParam, LPARAM lParam )
{
OPENFILENAME openInfo;
char fileName[ MAX_PATH ];
char path[ MAX_PATH ];
static bool filter = true;
switch( LOWORD( wParam ) )
{
case ID_FILE_EXIT:
PostQuitMessage( 0 );
break;
case ID_FILE_OPENDIRECTORY:
BROWSEINFO bInfo;
LPITEMIDLIST itemList;
LPMALLOC shMalloc;
memset( &bInfo, 0, sizeof( bInfo ) );
bInfo.hwndOwner = hWnd;
bInfo.pidlRoot = NULL;
bInfo.pszDisplayName = path;
bInfo.lpszTitle = "Select a Plasma 2 Data Directory:";
bInfo.ulFlags = BIF_EDITBOX;
itemList = SHBrowseForFolder( &bInfo );
if( itemList != NULL )
{
plWaitCursor myWaitCursor;
SHGetPathFromIDList( itemList, path );
SHGetMalloc( &shMalloc );
shMalloc->Free( itemList );
shMalloc->Release();
hsgResMgr::Reset();
plResTreeView::ClearTreeView( gTreeView );
// Load that source
plResManager *mgr = (plResManager *)hsgResMgr::ResMgr();
hsFolderIterator pathIterator(path);
while (pathIterator.NextFileSuffix(".prp"))
{
char fileName[kFolderIterator_MaxPath];
pathIterator.GetPathAndName(fileName);
mgr->AddSinglePage(fileName);
}
plResTreeView::FillTreeViewFromRegistry( gTreeView );
SetWindowTitle( hWnd, path );
}
break;
case ID_FILE_OPEN:
fileName[ 0 ] = 0;
memset( &openInfo, 0, sizeof( OPENFILENAME ) );
openInfo.hInstance = gInstance;
openInfo.hwndOwner = hWnd;
openInfo.lStructSize = sizeof( OPENFILENAME );
openInfo.lpstrFile = fileName;
openInfo.nMaxFile = sizeof( fileName );
openInfo.lpstrFilter = "Plasma 2 Pack Files\0*.prp\0All Files\0*.*\0";
openInfo.lpstrTitle = "Choose a file to browse:";
openInfo.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
if( GetOpenFileName( &openInfo ) )
{
plWaitCursor myWaitCursor;
hsgResMgr::Reset();
plResTreeView::ClearTreeView( gTreeView );
// Load that source
plResManager *mgr = (plResManager *)hsgResMgr::ResMgr();
mgr->AddSinglePage(fileName);
plResTreeView::FillTreeViewFromRegistry( gTreeView );
SetWindowTitle( hWnd, fileName );
}
break;
case ID_FILE_ABOUT:
DialogBox( gInstance, MAKEINTRESOURCE( IDD_ABOUT ), hWnd, AboutDialogProc );
break;
case ID_FILE_FINDOBJECT:
plResTreeView::FindObject( gTreeView );
break;
case ID_FILE_FINDNEXT:
plResTreeView::FindNextObject( gTreeView );
break;
case ID_FILE_VERIFYPAGE:
plResTreeView::VerifyCurrentPage( gTreeView );
break;
case IDC_SHOWASHEX:
plResTreeView::UpdateInfoDlg( gTreeView );
break;
case ID_FILE_ONLYLOAD:
filter = !filter;
plResTreeView::FilterLoadables( filter, gTreeView );
{
HMENU menu = ::GetMenu( hWnd );
menu = ::GetSubMenu( menu, 0 );
::CheckMenuItem( menu, ID_FILE_ONLYLOAD, MF_BYCOMMAND | ( filter ? MF_CHECKED : MF_UNCHECKED ) );
}
break;
case ID_FILE_SAVESELECTED:
plResTreeView::SaveSelectedObject(gTreeView);
break;
default:
return DefWindowProc( hWnd, WM_COMMAND, wParam, lParam );
}
return 0;
}
void SizeControls( HWND parent )
{
RECT clientRect, infoRect;
GetClientRect( parent, &clientRect );
GetClientRect( gInfoDlg, &infoRect );
SetWindowPos( gTreeView, NULL, 0, 0, clientRect.right - infoRect.right - 4, clientRect.bottom, 0 );
OffsetRect( &infoRect, clientRect.right - infoRect.right, ( clientRect.bottom >> 1 ) - ( infoRect.bottom >> 1 ) );
SetWindowPos( gInfoDlg, NULL, infoRect.left, infoRect.top, 0, 0, SWP_NOSIZE );
}
void InitWindowControls( HWND hWnd )
{
RECT clientRect;
GetClientRect( hWnd, &clientRect );
gTreeView = CreateWindowEx( WS_EX_CLIENTEDGE, WC_TREEVIEW, "Tree View", WS_VISIBLE | WS_CHILD | WS_BORDER |
TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT | TVS_SHOWSELALWAYS,
0, 0, 0, 0,
hWnd, (HMENU)IDC_REGTREEVIEW, gInstance, NULL );
gInfoDlg = CreateDialog( gInstance, MAKEINTRESOURCE( IDD_INFODLG ), hWnd, plResTreeView::InfoDlgProc );
SizeControls( hWnd );
}
static bool sFileTypesRegistered = false;
void RegisterFileTypes( HWND mainWnd )
{
if( sFileTypesRegistered )
return;
// Make sure our file types are created
char path[ MAX_PATH ];
if( ::GetModuleFileName( nil, path, sizeof( path ) ) == 0 )
return;
//plWinRegistryTools::AssociateFileType( "PlasmaIdxFile", "Plasma 2 Index File", path, 1 );
//plWinRegistryTools::AssociateFileType( "PlasmaDatFile", "Plasma 2 Data File", path, 2 );
//plWinRegistryTools::AssociateFileType( "PlasmaPatchFile", "Plasma 2 Patch File", path, 3 );
plWinRegistryTools::AssociateFileType( "PlasmaPackFile", "Plasma 2 Packfile", path, 4 );
// Check our file extensions
char prpAssoc[ 512 ];
hsBool needToRegister = true;
if( plWinRegistryTools::GetCurrentFileExtensionAssociation( ".prp", prpAssoc, sizeof( prpAssoc ) ) )
{
if( strcmp( prpAssoc, "PlasmaPackFile" ) == 0 )
needToRegister = false;
}
if( needToRegister )
{
if( MessageBox( nil, "The Plasma 2 packed data file extension .prp is not currently associated with "
"plResBrowser. Would you like to associate it now?", "plResBrowser File Type Association",
MB_YESNO | MB_ICONQUESTION) == IDYES )
{
// Associate 'em
plWinRegistryTools::AssociateFileExtension( ".prp", "PlasmaPackFile" );
}
}
sFileTypesRegistered = true;
}
LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
switch( message )
{
case WM_CREATE:
InitCommonControls();
InitWindowControls( hWnd );
RegisterFileTypes( hWnd );
plResMgrSettings::Get().SetLoadPagesOnInit(false);
{
plResTreeView::FilterLoadables( true, gTreeView );
HMENU menu = ::GetMenu( hWnd );
menu = ::GetSubMenu( menu, 0 );
::CheckMenuItem( menu, ID_FILE_ONLYLOAD, MF_BYCOMMAND | MF_CHECKED );
}
if( gCommandLine != nil )
{
plWaitCursor myWaitCursor;
char path[ MAX_PATH ];
if( gCommandLine[ 0 ] == '"' )
{
strcpy( path, gCommandLine + 1 );
char *c = strchr( path, '"' );
if( c != nil )
*c = 0;
}
else
strcpy( path, gCommandLine );
if( stricmp( PathFindExtension( path ), ".prp" ) == 0 )
{
hsgResMgr::Reset();
plResTreeView::ClearTreeView( gTreeView );
plResManager *mgr = (plResManager *)hsgResMgr::ResMgr();
mgr->AddSinglePage(path);
plResTreeView::FillTreeViewFromRegistry( gTreeView );
SetWindowTitle( hWnd, path );
}
}
break;
case WM_CLOSE:
DestroyWindow( hWnd );
break;
case WM_DESTROY:
plResTreeView::ClearTreeView( gTreeView );
PostQuitMessage(0);
break;
case WM_SIZING:
case WM_SIZE:
SizeControls( hWnd );
break;
case WM_NOTIFY:
if( wParam == IDC_REGTREEVIEW )
{
NMHDR *hdr = (NMHDR *)lParam;
if( hdr->code == TVN_SELCHANGED )
{
plResTreeView::UpdateInfoDlg( gTreeView );
//NMTREEVIEW *tv = (NMTREEVIEW *)hdr;
}
else if( hdr->code == NM_DBLCLK )
{
plResTreeView::SelectionDblClicked( gTreeView );
}
}
break;
case WM_DROPFILES:
{
int i, j, fileCount = DragQueryFile( (HDROP)wParam, -1, nil, nil );
char path[ MAX_PATH ];
plWaitCursor myWaitCursor;
hsgResMgr::Reset();
plResTreeView::ClearTreeView( gTreeView );
plResManager *mgr = (plResManager *)hsgResMgr::ResMgr();
if( fileCount == 1 && DragQueryFile( (HDROP)wParam, 0, path, sizeof( path ) ) > 0 &&
( (char *)PathFindExtension( path ) )[ 0 ] == 0 )
{
// Must be a directory
hsFolderIterator pathIterator(path);
while (pathIterator.NextFileSuffix(".prp"))
{
char fileName[kFolderIterator_MaxPath];
pathIterator.GetPathAndName(fileName);
mgr->AddSinglePage(fileName);
}
}
else
{
hsTArray<char *> filesAdded;
filesAdded.Reset();
for( i = 0; i < fileCount; i++ )
{
if( DragQueryFile( (HDROP)wParam, i, path, sizeof( path ) ) > 0 )
{
// Check for duplicates
for( j = 0; j < filesAdded.GetCount(); j++ )
{
if( stricmp( filesAdded[ j ], path ) == 0 )
break;
}
if( j < filesAdded.GetCount() )
continue;
if( stricmp( PathFindExtension( path ), ".prp" ) == 0 )
{
mgr->AddSinglePage(path);
filesAdded.Append( hsStrcpy( path ) );
}
}
}
for( j = 0; j < filesAdded.GetCount(); j++ )
delete [] filesAdded[ j ];
}
plResTreeView::FillTreeViewFromRegistry( gTreeView );
PathRemoveFileSpec( path );
SetWindowTitle( hWnd, path );
}
break;
case WM_COMMAND:
return HandleCommand( hWnd, wParam, lParam );
}
return DefWindowProc( hWnd, message, wParam, lParam );
}

View File

@ -0,0 +1,506 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "hsTypes.h"
#include "hsWindows.h"
#include "plResTreeView.h"
#include "../plResMgr/plResManager.h"
#include "../plResMgr/plRegistryHelpers.h"
#include "../plResMgr/plRegistryNode.h"
#include "../plResMgr/plPageInfo.h"
#include "../pnKeyedObject/plUoid.h"
#include "../pnKeyedObject/plKey.h"
#include "../pnKeyedObject/plKeyImp.h"
#include "../pnFactory/plFactory.h"
#include <windows.h>
#include <commctrl.h>
#include <shlwapi.h>
#include "res\resource.h"
extern HINSTANCE gInstance;
HWND plResTreeView::fInfoDlg = nil;
bool plResTreeView::fFilter = false;
static char gSearchString[ 512 ];
static HTREEITEM fFoundItem = nil;
extern void ViewPatchDetails( plKey &patchKey );
BOOL CALLBACK FindDialogProc( HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch( msg )
{
case WM_INITDIALOG:
return true;
case WM_COMMAND:
if( LOWORD( wParam ) == IDOK )
{
GetDlgItemText( dlg, IDC_SEARCHSTRING, gSearchString, sizeof( gSearchString ) );
fFoundItem = nil;
EndDialog( dlg, IDOK );
}
else if( LOWORD( wParam ) == IDCANCEL )
EndDialog( dlg, IDCANCEL );
return -1;
}
return 0;
}
struct plKeyInfo
{
plKey fKey;
plRegistryPageNode *fPage;
plKeyInfo( plKey k, plRegistryPageNode *p ) : fKey( k ), fPage( p ) {}
};
// How's this for functionality?
class plResDlgLoader : public plRegistryPageIterator, public plRegistryKeyIterator
{
protected:
HWND fTree;
HTREEITEM fCurrItem, fCurrTypeItem;
UInt16 fCurrType;
bool fFilter;
plRegistryPageNode *fCurrPage;
HTREEITEM AddLeaf(HWND hTree, HTREEITEM hParent, const char *text, plKeyInfo *info )
{
TVITEM tvi = {0};
tvi.mask = TVIF_TEXT | TVIF_PARAM;
tvi.pszText = text ? (char*)text : "<NULL>";
tvi.cchTextMax = text ? strlen(text) : 7;
tvi.lParam = (LPARAM)info;
TVINSERTSTRUCT tvins = {0};
tvins.item = tvi;
tvins.hParent = hParent;
tvins.hInsertAfter = TVI_SORT;
return TreeView_InsertItem(hTree, &tvins);
}
public:
plResDlgLoader( HWND hTree, bool filter )
{
fFilter = filter;
fTree = hTree;
((plResManager *)hsgResMgr::ResMgr())->IterateAllPages( this );
}
virtual hsBool EatPage( plRegistryPageNode *page )
{
char str[ 512 ];
fCurrPage = page;
const plPageInfo &info = page->GetPageInfo();
sprintf( str, "%s->%s->%s", info.GetAge(), info.GetPage() );
fCurrItem = AddLeaf( fTree, NULL, str, new plKeyInfo( nil, fCurrPage ) );
fCurrType = (UInt16)-1;
page->LoadKeys();
page->IterateKeys( this );
return true;
}
virtual hsBool EatKey( const plKey& key )
{
if( fCurrType != key->GetUoid().GetClassType() )
{
fCurrType = key->GetUoid().GetClassType();
const char *className = plFactory::GetNameOfClass( fCurrType );
fCurrTypeItem = AddLeaf( fTree, fCurrItem, className != nil ? className : "<unknown>", nil );
}
if( !fFilter )
AddLeaf( fTree, fCurrTypeItem, key->GetUoid().GetObjectName(), new plKeyInfo( key, fCurrPage ) );
return true;
}
};
void plResTreeView::FillTreeViewFromRegistry( HWND hWnd )
{
plResDlgLoader loader( hWnd, fFilter );
}
HTREEITEM IGetNextTreeItem( HWND tree, HTREEITEM item )
{
// First try child items of this one
HTREEITEM next = TreeView_GetChild( tree, item );
if( next == nil )
// If no child items, try next sibling
next = TreeView_GetNextSibling( tree, item );
if( next == nil )
{
// If no siblings, go up to the parent and keep searching until we find a parent with a sibling
next = item;
while( true )
{
next = TreeView_GetParent( tree, next );
if( next == nil )
{
// No parent; not found, so stop
break;
}
else if( TreeView_GetNextSibling( tree, next ) != nil )
{
next = TreeView_GetNextSibling( tree, next );
break;
}
}
}
return next;
}
void plResTreeView::FindNextObject( HWND tree )
{
if( fFoundItem == nil )
FindObject( tree );
else
{
fFoundItem = IGetNextTreeItem( tree, fFoundItem );
IFindNextObject( tree );
}
}
void plResTreeView::FindObject( HWND tree )
{
if( DialogBox( gInstance, MAKEINTRESOURCE( IDD_FINDOBJ ), tree, FindDialogProc ) == IDOK )
{
fFoundItem = TreeView_GetRoot( tree );
IFindNextObject( tree );
}
}
void plResTreeView::IFindNextObject( HWND tree )
{
while( fFoundItem != nil )
{
// Get the item
TVITEM itemInfo;
itemInfo.mask = TVIF_PARAM | TVIF_HANDLE;
itemInfo.hItem = fFoundItem;
TreeView_GetItem( tree, &itemInfo );
plKeyInfo *keyInfo = (plKeyInfo *)itemInfo.lParam;
if( keyInfo != nil && keyInfo->fKey != nil )
{
if( StrStrI( keyInfo->fKey->GetUoid().GetObjectName(), gSearchString ) != nil )
{
/// FOUND
TreeView_SelectItem( tree, fFoundItem );
return;
}
}
// Keep searching. First try child items of this one
fFoundItem = IGetNextTreeItem( tree, fFoundItem );
}
MessageBox( tree, "No objects found", "Find Object", MB_OK );
}
void IDeleteRecurse( HWND tree, HTREEITEM item )
{
while( item != nil )
{
HTREEITEM child = TreeView_GetChild( tree, item );
if( child != nil )
IDeleteRecurse( tree, child );
TVITEM itemInfo;
itemInfo.mask = TVIF_PARAM | TVIF_HANDLE;
itemInfo.hItem = item;
TreeView_GetItem( tree, &itemInfo );
plKeyInfo *keyInfo = (plKeyInfo *)itemInfo.lParam;
if( keyInfo != nil )
{
delete keyInfo;
itemInfo.lParam = 0;
TreeView_SetItem( tree, &itemInfo );
}
item = TreeView_GetNextSibling( tree, item );
}
}
void plResTreeView::ClearTreeView( HWND hWnd )
{
HTREEITEM root = TreeView_GetRoot( hWnd );
if( root != nil )
IDeleteRecurse( hWnd, root );
TreeView_DeleteAllItems( hWnd );
}
void plResTreeView::SelectionDblClicked( HWND treeCtrl )
{
HTREEITEM sel = TreeView_GetSelection( treeCtrl );
if( sel != nil )
{
TVITEM item;
item.mask = TVIF_PARAM | TVIF_HANDLE;
item.hItem = sel;
if( !TreeView_GetItem( treeCtrl, &item ) )
return;
}
}
void plResTreeView::FilterLoadables( bool filter, HWND treeCtrl )
{
fFilter = filter;
ClearTreeView( treeCtrl );
FillTreeViewFromRegistry( treeCtrl );
}
BOOL CALLBACK plResTreeView::InfoDlgProc( HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch( msg )
{
case WM_INITDIALOG:
fInfoDlg = dlg;
break;
case WM_COMMAND:
return SendMessage( GetParent( dlg ), msg, wParam, lParam );
}
return 0;
}
void plResTreeView::VerifyCurrentPage( HWND treeCtrl )
{
HTREEITEM sel = TreeView_GetSelection( treeCtrl );
if( sel != nil )
{
TVITEM item;
item.mask = TVIF_PARAM | TVIF_HANDLE;
item.hItem = sel;
if( !TreeView_GetItem( treeCtrl, &item ) )
return;
plKeyInfo *info = (plKeyInfo *)item.lParam;
if( info != nil )
{
if( info->fPage != nil )
{
// TODO: FIXME
/*
/// HACK. Live with it
class plHackResManager : public plResManager
{
public:
plRegistry *GetRegistry( void ) { return IGetRegistry(); }
};
plRegistry *registry = ((plHackResManager *)hsgResMgr::ResMgr())->GetRegistry();
plRegistry::plPageCond result = registry->VerifyOnePage( info->fPage );
char msg[ 512 ];
if( result == plRegistry::kOK || result == plRegistry::kTooNew )
strcpy( msg, "Page verifies OK" );
else if( result == plRegistry::kChecksumInvalid )
strcpy( msg, "Checksums for page are invalid" );
else if( result == plRegistry::kOutOfDate )
strcpy( msg, "Page is older than the current data version" );
hsMessageBox( msg, "Verification Results", hsMessageBoxNormal );
*/
}
}
}
}
void plResTreeView::UpdateInfoDlg( HWND treeCtrl )
{
hsBool showAsHex = (hsBool)IsDlgButtonChecked( fInfoDlg, IDC_SHOWASHEX );
SetDlgItemText( fInfoDlg, IDC_NAME, "" );
SetDlgItemText( fInfoDlg, IDC_CLASS, "" );
SetDlgItemText( fInfoDlg, IDC_LENGTH, "" );
SetDlgItemText( fInfoDlg, IDC_STARTPOS, "" );
EnableWindow( GetDlgItem( fInfoDlg, ID_FILE_VERIFYPAGE ), FALSE );
HTREEITEM sel = TreeView_GetSelection( treeCtrl );
if( sel != nil )
{
TVITEM item;
item.mask = TVIF_PARAM | TVIF_HANDLE;
item.hItem = sel;
if( !TreeView_GetItem( treeCtrl, &item ) )
return;
plKeyInfo *info = (plKeyInfo *)item.lParam;
if( info != nil )
{
if( info->fPage != nil )
{
const plPageInfo &pageInfo = info->fPage->GetPageInfo();
char tempStr[ 32 ];
SetDlgItemText( fInfoDlg, IDC_AGE, pageInfo.GetAge() );
SetDlgItemText( fInfoDlg, IDC_PAGE, pageInfo.GetPage() );
SetDlgItemText( fInfoDlg, IDC_LOCATION, pageInfo.GetLocation().StringIze( tempStr ) );
CheckDlgButton(fInfoDlg, IDC_RESERVED, (pageInfo.GetLocation().GetFlags() & plLocation::kReserved) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(fInfoDlg, IDC_BUILTIN, (pageInfo.GetLocation().GetFlags() & plLocation::kBuiltIn) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(fInfoDlg, IDC_VOLATILE, (pageInfo.GetLocation().GetFlags() & plLocation::kVolatile) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(fInfoDlg, IDC_LOCAL_ONLY, (pageInfo.GetLocation().GetFlags() & plLocation::kLocalOnly) ? BST_CHECKED : BST_UNCHECKED);
sprintf( tempStr, "%d", pageInfo.GetMajorVersion());
SetDlgItemText( fInfoDlg, IDC_DATAVERSION, tempStr );
SetDlgItemText( fInfoDlg, IDC_CHECKSUMTYPE, "Basic (file size)" );
EnableWindow( GetDlgItem( fInfoDlg, ID_FILE_VERIFYPAGE ), TRUE );
}
if( info->fKey != nil )
{
char str[ 128 ];
SetDlgItemText( fInfoDlg, IDC_NAME, info->fKey->GetUoid().GetObjectName() );
const char *name = plFactory::GetNameOfClass( info->fKey->GetUoid().GetClassType() );
sprintf( str, "%s (%d)", name != nil ? name : "<unknown>", info->fKey->GetUoid().GetClassType() );
SetDlgItemText( fInfoDlg, IDC_CLASS, str );
plKeyImp *imp = (plKeyImp *)info->fKey;
EnableWindow( GetDlgItem( fInfoDlg, IDC_STARTPOS_LABEL ), true );
EnableWindow( GetDlgItem( fInfoDlg, IDC_SIZE_LABEL ), true );
if( showAsHex )
sprintf( str, "0x%X", imp->GetStartPos() );
else
sprintf( str, "%d", imp->GetStartPos() );
SetDlgItemText( fInfoDlg, IDC_STARTPOS, str );
if( imp->GetDataLen() < 1024 )
sprintf( str, "%d bytes", imp->GetDataLen() );
else if( imp->GetDataLen() < 1024 * 1024 )
sprintf( str, "%4.2f kB", imp->GetDataLen() / 1024.f );
else
sprintf( str, "%4.2f MB", imp->GetDataLen() / 1024.f / 1024.f );
SetDlgItemText( fInfoDlg, IDC_LENGTH, str );
}
}
}
}
#include "hsStream.h"
#include <commdlg.h>
void plResTreeView::SaveSelectedObject(HWND treeCtrl)
{
// TODO: FIXME
/*
plKey itemKey = nil;
HTREEITEM sel = TreeView_GetSelection(treeCtrl);
if (sel != nil)
{
TVITEM item;
item.mask = TVIF_PARAM | TVIF_HANDLE;
item.hItem = sel;
if (TreeView_GetItem(treeCtrl, &item))
{
plKeyInfo *info = (plKeyInfo*)item.lParam;
if (info != nil)
itemKey = info->fKey;
}
}
if (!itemKey)
return;
char fileName[MAX_PATH];
sprintf(fileName, "%s.bin", itemKey->GetName());
OPENFILENAME openInfo;
memset( &openInfo, 0, sizeof( OPENFILENAME ) );
// openInfo.hInstance = gInstance;
// openInfo.hwndOwner = hWnd;
openInfo.lStructSize = sizeof( OPENFILENAME );
openInfo.lpstrFile = fileName;
openInfo.nMaxFile = sizeof( fileName );
openInfo.lpstrFilter = "Binary Files\0*.bin\0All Files\0*.*\0";
// openInfo.lpstrTitle = "Choose a pack index file to browse:";
// openInfo.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
if (GetSaveFileName(&openInfo))
{
plKeyImp* keyImp = (plKeyImp*)itemKey;
if (keyImp->GetDataLen() <= 0)
return;
plResManager* resMgr = (plResManager*)hsgResMgr::ResMgr();
const plPageInfo& pageInfo = resMgr->FindPage(keyImp->GetUoid().GetLocation())->GetPageInfo();
plRegistryDataStream *stream = registry->OpenPageDataStream( keyImp->GetUoid().GetLocation(), false );
if( stream == nil )
return;
hsStream *dataStream = stream->GetStream();
UInt8 *buffer = TRACKED_NEW UInt8[ keyImp->GetDataLen() ];
if( buffer != nil )
{
dataStream->SetPosition( keyImp->GetStartPos() );
dataStream->Read( keyImp->GetDataLen(), buffer );
}
delete stream;
if( buffer == nil )
return;
hsUNIXStream outStream;
outStream.Open(fileName, "wb");
outStream.Write(keyImp->GetDataLen(), buffer);
outStream.Close();
delete [] buffer;
}
*/
}

View File

@ -0,0 +1,59 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef _plResTreeView_h
#define _plResTreeView_h
class plResTreeView
{
protected:
static HWND fInfoDlg;
static bool fFilter;
static void IFindNextObject( HWND tree );
public:
static void FindObject( HWND tree );
static void FindNextObject( HWND tree );
static void FillTreeViewFromRegistry( HWND hWnd );
static void ClearTreeView( HWND hWnd );
static BOOL CALLBACK InfoDlgProc( HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam );
static void UpdateInfoDlg( HWND treeCtrl );
static void VerifyCurrentPage( HWND treeCtrl );
static void SelectionDblClicked( HWND treeCtrl );
static void FilterLoadables( bool filter, HWND treeCtrl );
static void SaveSelectedObject(HWND treeCtrl);
};
#endif //_plResTreeView_h

View File

@ -0,0 +1,162 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
//
// plWinRegistryTools
// Utility class for doing various usefull things in Win32
// Written by Mathew Burrack
// 4.23.2002
//
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "plWinRegistryTools.h"
#include "hsWindows.h"
//////////////////////////////////////////////////////////////////////////////
//// Static Utility Functions ////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//// ISetRegKey //////////////////////////////////////////////////////////////
// Sets the given registry key to the given string value. If valueName = nil,
// sets the (default) value
static hsBool ISetRegKey( const char *keyName, const char *value, const char *valueName = nil )
{
HKEY regKey;
DWORD result;
// Create the key (just opens if it already exists)
if( ::RegCreateKeyEx( HKEY_CLASSES_ROOT, keyName, 0, nil, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
nil, &regKey, &result ) != ERROR_SUCCESS )
{
hsStatusMessageF( "Warning: Registry database open failed for key '%s'.\n", keyName );
return false;
}
// Assign the "default" subkey value
LONG lResult = ::RegSetValueEx( regKey, valueName, 0, REG_SZ, (const BYTE *)value, ( lstrlen( value ) + 1 ) * sizeof( TCHAR ) );
if( ::RegCloseKey( regKey ) == ERROR_SUCCESS && lResult == ERROR_SUCCESS )
return true;
hsStatusMessageF( "Warning: Registry database update failed for key '%s'.\n", keyName );
return false;
}
//////////////////////////////////////////////////////////////////////////////
//// Public Utility Functions ////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//// AssociateFileType ///////////////////////////////////////////////////////
// Associates a given file type in the Win32 registry with the given
// application. Also assigns a default icon if iconIndex != -1
//
// To do this, we create a set of keys in the registry under CLASSES_ROOT that
// looks like this:
// fileTypeID (value = fileTypeName)
// |
// |--- DefaultIcon (value = path,index) [omit this one if you don't
// | want a default icon]
// |
// |--- shell
// |
// |--- open
// |
// |--- command (value = command line)
//
hsBool plWinRegistryTools::AssociateFileType( const char *fileTypeID, const char *fileTypeName, const char *appPath, int iconIndex )
{
char keyName[ 512 ], keyValue[ 512 ];
// Root key
if( !ISetRegKey( fileTypeID, fileTypeName ) )
return false;
// DefaultIcon key, if we want one
if( iconIndex != -1 )
{
sprintf( keyName, "%s\\DefaultIcon", fileTypeID );
sprintf( keyValue, "%s,%d", appPath, iconIndex );
if( !ISetRegKey( keyName, keyValue ) )
return false;
}
// shell/open/command key
sprintf( keyName, "%s\\shell\\open\\command", fileTypeID );
sprintf( keyValue, "\"%s\" \"%%1\"", appPath );
if( !ISetRegKey( keyName, keyValue ) )
return false;
// Success!
return true;
}
//// AssociateFileExtension //////////////////////////////////////////////////
// Assigns a given file extension to a previously registered Win32 file type
// (using the above function)
//
// We do this by creating a key entry under CLASSES_ROOT of the following
// structure:
//
// fileExtension (value = fileTypeID)
//
// where fileExtension includes the leading . and fileTypeID is the same
// typeID registered with the above function
hsBool plWinRegistryTools::AssociateFileExtension( const char *fileExtension, const char *fileTypeID )
{
return ISetRegKey( fileExtension, fileTypeID );
}
//// GetCurrentFileExtensionAssociation //////////////////////////////////////
// Obtains the current fileTypeID associated with the given file extension,
// or a null string if it isn't yet associated.
hsBool plWinRegistryTools::GetCurrentFileExtensionAssociation( const char *extension, char *buffer, int bufferLen )
{
long dataLen;
buffer[ 0 ] = 0;
dataLen = bufferLen;
LONG retVal = ::RegQueryValue( HKEY_CLASSES_ROOT, extension, buffer, &dataLen );
if( retVal != ERROR_SUCCESS )
{
char msg[ 512 ];
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, 0, retVal, 0, msg, sizeof( msg ), nil );
hsStatusMessageF( "Error querying registry key '%s' : %s\n", extension, msg );
return false;
}
return true;
}

View File

@ -0,0 +1,52 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
//
// plWinRegistryTools
// Utility class for doing various usefull things in Win32
// Written by Mathew Burrack
// 4.23.2002
//
//////////////////////////////////////////////////////////////////////////////
#ifndef _plWinRegistryTools_h
#define _plWinRegistryTools_h
class plWinRegistryTools
{
public:
// Associates a given file type in the Win32 registry with the given application. Also assigns a default icon if iconIndex != -1
static hsBool AssociateFileType( const char *fileTypeID, const char *fileTypeName, const char *appPath, int iconIndex = -1 );
// Assigns a given file extension to a previously registered Win32 file type (using the above function)
static hsBool AssociateFileExtension( const char *fileExtension, const char *fileTypeID );
// Obtains the current fileTypeID associated with the given file extension, or a null string if it isn't yet associated
static hsBool GetCurrentFileExtensionAssociation( const char *extension, char *buffer, int bufferLen );
};
#endif //_plWinRegistryTools_h

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -0,0 +1,214 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_APPICON ICON "icon1.ico"
IDI_INDEXICON ICON "icon2.ico"
IDI_DATAICON ICON "indexico.ico"
IDI_PATCHICON ICON "dataicon.ico"
IDI_MERGEDDATAICON ICON "mergedda.ico"
IDI_MERGEDINDEXICON ICON "mergedin.ico"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_APPMENU MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Open...", ID_FILE_OPEN
MENUITEM "Open &Directory...", ID_FILE_OPENDIRECTORY
MENUITEM SEPARATOR
MENUITEM "Save Selected Object", ID_FILE_SAVESELECTED
MENUITEM SEPARATOR
MENUITEM "Find Object...\tCtrl+F", ID_FILE_FINDOBJECT
MENUITEM "Find Next\tF3", ID_FILE_FINDNEXT
MENUITEM "Show Only Loadable", ID_FILE_ONLYLOAD
MENUITEM SEPARATOR
MENUITEM "About...", ID_FILE_ABOUT
MENUITEM "Exit", ID_FILE_EXIT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_INFODLG DIALOGEX 0, 0, 186, 281
STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
GROUPBOX "Object Information",IDC_STATIC,4,168,178,67
RTEXT "Name:",IDC_STATIC,17,180,22,8
LTEXT "",IDC_NAME,42,179,129,10,SS_SUNKEN | NOT WS_GROUP
GROUPBOX "Page Information",IDC_STATIC,4,2,178,163
RTEXT "Age:",IDC_STATIC,45,14,16,8
LTEXT "",IDC_AGE,63,14,107,10,SS_SUNKEN | NOT WS_GROUP
RTEXT "Page:",IDC_STATIC,41,28,20,8
LTEXT "",IDC_PAGE,63,28,107,10,SS_SUNKEN | NOT WS_GROUP
RTEXT "Location:",IDC_STATIC,31,43,30,8
LTEXT "",IDC_LOCATION,64,43,74,10,SS_SUNKEN | NOT WS_GROUP
CONTROL "Reserved",IDC_RESERVED,"Button",BS_AUTOCHECKBOX |
WS_DISABLED | WS_TABSTOP,64,66,10,10
RTEXT "Class:",IDC_STATIC,19,195,20,8
LTEXT "",IDC_CLASS,42,194,129,10,SS_SUNKEN | NOT WS_GROUP
RTEXT "Start Pos:",IDC_STARTPOS_LABEL,7,221,32,8
LTEXT "",IDC_STARTPOS,42,220,55,10,SS_SUNKEN | NOT WS_GROUP
RTEXT "Size:",IDC_SIZE_LABEL,103,221,17,8
LTEXT "",IDC_LENGTH,124,220,47,10,SS_SUNKEN | NOT WS_GROUP
LTEXT "Reserved",IDC_STATIC,76,67,31,8
PUSHBUTTON "Find",ID_FILE_FINDOBJECT,4,259,50,14
PUSHBUTTON "Find Next",ID_FILE_FINDNEXT,58,259,50,14
RTEXT "Data Version:",IDC_STATIC,17,79,44,8
LTEXT "",IDC_DATAVERSION,64,79,48,10,SS_SUNKEN | NOT WS_GROUP
RTEXT "Checksum:",IDC_STATIC,25,139,36,8
LTEXT "",IDC_IDXCHECKSUM,64,139,53,10,SS_SUNKEN | NOT WS_GROUP
PUSHBUTTON "Verify Page",ID_FILE_VERIFYPAGE,130,259,50,14
RTEXT "Checksum type:",IDC_STATIC,9,151,52,8
LTEXT "",IDC_CHECKSUMTYPE,64,152,89,10,SS_SUNKEN | NOT
WS_GROUP
CONTROL "View values as hex",IDC_SHOWASHEX,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,105,241,77,10
CONTROL "",IDC_LOCAL_ONLY,"Button",BS_AUTOCHECKBOX | WS_DISABLED |
WS_TABSTOP,64,57,11,8
LTEXT "Local Only",IDC_STATIC,76,57,34,8
CONTROL "",IDC_BUILTIN,"Button",BS_AUTOCHECKBOX | WS_DISABLED |
WS_TABSTOP,116,67,11,8
CONTROL "",IDC_VOLATILE,"Button",BS_AUTOCHECKBOX | WS_DISABLED |
WS_TABSTOP,116,57,11,8
LTEXT "Built-In",IDC_STATIC,129,67,22,8
LTEXT "Volatile",IDC_STATIC,129,57,24,8
END
IDD_ABOUT DIALOG 0, 0, 247, 57
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About plResBrowser"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,190,7,50,14
ICON IDI_APPICON,IDC_STATIC,11,8,21,20
LTEXT "plResBrowser\nA simple Plasma 2.0 packfile browsing utility\nCopyright (C) 2002 Cyan Worlds, Inc.\n\nWho needs log files?",
IDC_STATIC,40,7,140,43
END
IDD_FINDOBJ DIALOG 0, 0, 228, 46
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Find Object"
FONT 8, "MS Sans Serif"
BEGIN
EDITTEXT IDC_SEARCHSTRING,13,19,146,14,ES_AUTOHSCROLL
DEFPUSHBUTTON "Find",IDOK,171,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,171,24,50,14
GROUPBOX "Object Name",IDC_STATIC,7,7,157,32
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_ABOUT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 240
TOPMARGIN, 7
BOTTOMMARGIN, 50
END
IDD_FINDOBJ, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 221
TOPMARGIN, 7
BOTTOMMARGIN, 39
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_ACCELERATOR1 ACCELERATORS
BEGIN
"F", ID_FILE_FINDOBJECT, VIRTKEY, CONTROL, NOINVERT
VK_F3, ID_FILE_FINDNEXT, VIRTKEY, NOINVERT
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,67 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by plResBrowser.rc
//
#define IDI_ICON1 101
#define IDI_APPICON 101
#define IDR_APPMENU 102
#define IDD_INFODLG 103
#define IDD_ABOUT 104
#define IDR_ACCELERATOR1 106
#define IDD_FINDOBJ 107
#define IDI_INDEXICON 108
#define IDI_DATAICON 109
#define IDI_PATCHICON 110
#define IDI_MERGEDDATAICON 111
#define IDI_MERGEDINDEXICON 112
#define IDC_NAME 1000
#define IDC_AGE 1001
#define IDC_CHAPTER 1002
#define IDC_PAGE 1003
#define IDC_LOCATION 1004
#define IDC_RESERVED 1005
#define IDC_CLASS 1006
#define IDC_STARTPOS 1007
#define IDC_LENGTH 1008
#define IDC_CANLOAD 1009
#define IDC_STARTPOS_LABEL 1010
#define IDC_SIZE_LABEL 1011
#define IDC_INTERLEAVED 1012
#define IDC_RELVERSION 1013
#define IDC_SEARCHSTRING 1014
#define IDC_DATAVERSION 1014
#define IDC_IDXCHECKSUM 1015
#define IDC_DATACHECKSUM 1016
#define IDC_CHECKSUMTYPE 1017
#define IDC_SHOWASHEX 1018
#define IDC_SCROLLBAR 1019
#define IDC_PARTIALPATCH 1019
#define IDC_FRAME 1020
#define IDC_HEADERPATCH 1020
#define IDC_COPIED 1021
#define IDC_NEW 1022
#define IDC_ZOOM 1023
#define IDC_ZOOMSLIDER 1024
#define IDC_SEGINFO 1025
#define IDC_LOCAL_ONLY 1025
#define IDC_BUILTIN 1026
#define IDC_VOLATILE 1027
#define ID_FILE_EXIT 40002
#define ID_FILE_OPENDIRECTORY 40003
#define ID_FILE_ABOUT 40004
#define ID_FILE_FINDOBJECT 40005
#define ID_FILE_FINDNEXT 40006
#define ID_FILE_VERIFYPAGE 40007
#define ID_FILE_ONLYLOAD 40008
#define ID_FILE_SAVESELECTED 40009
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 110
#define _APS_NEXT_COMMAND_VALUE 40010
#define _APS_NEXT_CONTROL_VALUE 1026
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif