Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,280 @@
# Microsoft Developer Studio Project File - Name="BinaryTool" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=BinaryTool - 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 "BinaryTool.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 "BinaryTool.mak" CFG="BinaryTool - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "BinaryTool - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "BinaryTool - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/Appli/BinaryTool2", DYBBAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "BinaryTool - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# 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 /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "inc" /I "res" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /YX"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 x:\cpa\lib\scrp5_vr.lib x:\cpa\lib\mmgp5_vr.lib x:\cpa\lib\ermp5_vr.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"LIBC" /out:"x:\cpa\exe\main\BinaryTool.exe"
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# 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 /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "inc" /I "res" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "USE_PROFILER" /YX"StdAfx.h" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 x:\cpa\lib\scrp5_vd.lib x:\cpa\lib\mmgp5_vd.lib x:\cpa\lib\ermp5_vd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"LIBCD" /nodefaultlib:"MSVCRT" /out:"x:\cpa\exe\main\BinaryTool.exe" /pdbtype:sept
# SUBTRACT LINK32 /nodefaultlib
!ENDIF
# Begin Target
# Name "BinaryTool - Win32 Release"
# Name "BinaryTool - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter ".c;.cpp"
# Begin Source File
SOURCE=".\src\BinaryTool.cpp"
# End Source File
# Begin Source File
SOURCE=.\res\BinaryTool.rc
# End Source File
# Begin Source File
SOURCE=".\src\BinaryToolDlg.cpp"
# End Source File
# Begin Source File
SOURCE=.\src\file.cpp
# End Source File
# Begin Source File
SOURCE=.\src\Panel.cpp
# End Source File
# Begin Source File
SOURCE=.\src\panelafter.cpp
# End Source File
# Begin Source File
SOURCE=.\src\PanelBeforeBin.cpp
# End Source File
# Begin Source File
SOURCE=.\src\PanelLevels.cpp
# End Source File
# Begin Source File
SOURCE=.\src\PanelResults.cpp
# End Source File
# Begin Source File
SOURCE=.\src\PanelSettings.cpp
# End Source File
# Begin Source File
SOURCE=.\src\Process.cpp
# End Source File
# Begin Source File
SOURCE=.\src\Scripts.cpp
# End Source File
# Begin Source File
SOURCE=.\src\StdAfx.cpp
!IF "$(CFG)" == "BinaryTool - Win32 Release"
# ADD CPP /YX
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\src\Tasks.cpp
# End Source File
# Begin Source File
SOURCE=.\src\ThreadAnim.cpp
# End Source File
# Begin Source File
SOURCE=.\src\ThreadBinarize.cpp
# End Source File
# Begin Source File
SOURCE=.\src\ThreadTextures.cpp
# End Source File
# Begin Source File
SOURCE=.\src\util.cpp
# End Source File
# End Group
# Begin Group "Include Files"
# PROP Default_Filter ".h;.hpp"
# Begin Source File
SOURCE=".\inc\BinaryTool.h"
# End Source File
# Begin Source File
SOURCE=".\inc\BinaryToolDlg.h"
# End Source File
# Begin Source File
SOURCE=.\inc\file.h
# End Source File
# Begin Source File
SOURCE=.\inc\GlobalData.h
# End Source File
# Begin Source File
SOURCE=.\inc\Panel.h
# End Source File
# Begin Source File
SOURCE=.\inc\panelafter.h
# End Source File
# Begin Source File
SOURCE=.\inc\PanelBeforeBin.h
# End Source File
# Begin Source File
SOURCE=.\inc\PanelLevels.h
# End Source File
# Begin Source File
SOURCE=.\inc\PanelResults.h
# End Source File
# Begin Source File
SOURCE=.\inc\PanelSettings.h
# End Source File
# Begin Source File
SOURCE=.\inc\Process.h
# End Source File
# Begin Source File
SOURCE=.\res\resource.h
# End Source File
# Begin Source File
SOURCE=.\inc\Scripts.h
# End Source File
# Begin Source File
SOURCE=.\inc\StdAfx.h
# End Source File
# Begin Source File
SOURCE=.\inc\Tasks.h
# End Source File
# Begin Source File
SOURCE=.\inc\Threads.h
# End Source File
# Begin Source File
SOURCE=.\inc\util.h
# End Source File
# End Group
# Begin Group "Resources Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\res\BinaryTool.clw
# End Source File
# Begin Source File
SOURCE=".\res\BinaryTool.ico"
# End Source File
# Begin Source File
SOURCE=".\res\BinaryTool.rc2"
# End Source File
# Begin Source File
SOURCE=.\res\case_checked.bmp
# End Source File
# Begin Source File
SOURCE=.\res\case_vide.bmp
# End Source File
# Begin Source File
SOURCE=.\res\croix.bmp
# End Source File
# End Group
# Begin Source File
SOURCE=".\BinaryTool.mak"
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,979 @@
# Microsoft Developer Studio Generated NMAKE File, Based on BinaryTool.dsp
!IF "$(CFG)" == ""
CFG=BinaryTool - Win32 Debug
!MESSAGE No configuration specified. Defaulting to BinaryTool - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "BinaryTool - Win32 Release" && "$(CFG)" !=\
"BinaryTool - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!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 "BinaryTool.mak" CFG="BinaryTool - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "BinaryTool - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "BinaryTool - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "BinaryTool - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
!IF "$(RECURSE)" == "0"
ALL : "..\..\exe\main\BinaryTool.exe"
!ELSE
ALL : "..\..\exe\main\BinaryTool.exe"
!ENDIF
CLEAN :
-@erase "$(INTDIR)\BinaryTool.obj"
-@erase "$(INTDIR)\BinaryTool.res"
-@erase "$(INTDIR)\BinaryToolDlg.obj"
-@erase "$(INTDIR)\file.obj"
-@erase "$(INTDIR)\Panel.obj"
-@erase "$(INTDIR)\panelafter.obj"
-@erase "$(INTDIR)\PanelBeforeBin.obj"
-@erase "$(INTDIR)\PanelLevels.obj"
-@erase "$(INTDIR)\PanelResults.obj"
-@erase "$(INTDIR)\PanelSettings.obj"
-@erase "$(INTDIR)\Process.obj"
-@erase "$(INTDIR)\Scripts.obj"
-@erase "$(INTDIR)\StdAfx.obj"
-@erase "$(INTDIR)\Tasks.obj"
-@erase "$(INTDIR)\ThreadAnim.obj"
-@erase "$(INTDIR)\ThreadBinarize.obj"
-@erase "$(INTDIR)\ThreadTextures.obj"
-@erase "$(INTDIR)\util.obj"
-@erase "$(INTDIR)\vc50.idb"
-@erase "..\..\exe\main\BinaryTool.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "inc" /I "res" /D "WIN32" /D "NDEBUG" /D\
"_WINDOWS" /D "_AFXDLL" /Fp"$(INTDIR)\BinaryTool.pch" /YX"stdafx.h"\
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Release/
CPP_SBRS=.
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
RSC=rc.exe
RSC_PROJ=/l 0x40c /fo"$(INTDIR)\BinaryTool.res" /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\BinaryTool.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=x:\cpa\lib\scrp5_vr.lib x:\cpa\lib\mmgp5_vr.lib\
x:\cpa\lib\ermp5_vr.lib /nologo /subsystem:windows /incremental:no\
/pdb:"$(OUTDIR)\BinaryTool.pdb" /machine:I386 /nodefaultlib:"LIBC"\
/out:"x:\cpa\exe\main\BinaryTool.exe"
LINK32_OBJS= \
"$(INTDIR)\BinaryTool.obj" \
"$(INTDIR)\BinaryTool.res" \
"$(INTDIR)\BinaryToolDlg.obj" \
"$(INTDIR)\file.obj" \
"$(INTDIR)\Panel.obj" \
"$(INTDIR)\panelafter.obj" \
"$(INTDIR)\PanelBeforeBin.obj" \
"$(INTDIR)\PanelLevels.obj" \
"$(INTDIR)\PanelResults.obj" \
"$(INTDIR)\PanelSettings.obj" \
"$(INTDIR)\Process.obj" \
"$(INTDIR)\Scripts.obj" \
"$(INTDIR)\StdAfx.obj" \
"$(INTDIR)\Tasks.obj" \
"$(INTDIR)\ThreadAnim.obj" \
"$(INTDIR)\ThreadBinarize.obj" \
"$(INTDIR)\ThreadTextures.obj" \
"$(INTDIR)\util.obj"
"..\..\exe\main\BinaryTool.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
!IF "$(RECURSE)" == "0"
ALL : "..\..\exe\main\BinaryTool.exe"
!ELSE
ALL : "..\..\exe\main\BinaryTool.exe"
!ENDIF
CLEAN :
-@erase "$(INTDIR)\BinaryTool.obj"
-@erase "$(INTDIR)\BinaryTool.res"
-@erase "$(INTDIR)\BinaryToolDlg.obj"
-@erase "$(INTDIR)\file.obj"
-@erase "$(INTDIR)\Panel.obj"
-@erase "$(INTDIR)\panelafter.obj"
-@erase "$(INTDIR)\PanelBeforeBin.obj"
-@erase "$(INTDIR)\PanelLevels.obj"
-@erase "$(INTDIR)\PanelResults.obj"
-@erase "$(INTDIR)\PanelSettings.obj"
-@erase "$(INTDIR)\Process.obj"
-@erase "$(INTDIR)\Scripts.obj"
-@erase "$(INTDIR)\StdAfx.obj"
-@erase "$(INTDIR)\Tasks.obj"
-@erase "$(INTDIR)\ThreadAnim.obj"
-@erase "$(INTDIR)\ThreadBinarize.obj"
-@erase "$(INTDIR)\ThreadTextures.obj"
-@erase "$(INTDIR)\util.obj"
-@erase "$(INTDIR)\vc50.idb"
-@erase "$(INTDIR)\vc50.pdb"
-@erase "$(OUTDIR)\BinaryTool.pdb"
-@erase "..\..\exe\main\BinaryTool.exe"
-@erase "..\..\exe\main\BinaryTool.ilk"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "inc" /I "res" /D "WIN32" /D\
"_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "USE_PROFILER"\
/Fp"$(INTDIR)\BinaryTool.pch" /YX"StdAfx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\"\
/FD /c
CPP_OBJS=.\Debug/
CPP_SBRS=.
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
RSC=rc.exe
RSC_PROJ=/l 0x40c /fo"$(INTDIR)\BinaryTool.res" /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\BinaryTool.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=x:\cpa\lib\scrp5_vd.lib x:\cpa\lib\mmgp5_vd.lib\
x:\cpa\lib\ermp5_vd.lib /nologo /subsystem:windows /incremental:yes\
/pdb:"$(OUTDIR)\BinaryTool.pdb" /debug /machine:I386 /nodefaultlib:"LIBCD"\
/nodefaultlib:"MSVCRT" /out:"x:\cpa\exe\main\BinaryTool.exe" /pdbtype:sept
LINK32_OBJS= \
"$(INTDIR)\BinaryTool.obj" \
"$(INTDIR)\BinaryTool.res" \
"$(INTDIR)\BinaryToolDlg.obj" \
"$(INTDIR)\file.obj" \
"$(INTDIR)\Panel.obj" \
"$(INTDIR)\panelafter.obj" \
"$(INTDIR)\PanelBeforeBin.obj" \
"$(INTDIR)\PanelLevels.obj" \
"$(INTDIR)\PanelResults.obj" \
"$(INTDIR)\PanelSettings.obj" \
"$(INTDIR)\Process.obj" \
"$(INTDIR)\Scripts.obj" \
"$(INTDIR)\StdAfx.obj" \
"$(INTDIR)\Tasks.obj" \
"$(INTDIR)\ThreadAnim.obj" \
"$(INTDIR)\ThreadBinarize.obj" \
"$(INTDIR)\ThreadTextures.obj" \
"$(INTDIR)\util.obj"
"..\..\exe\main\BinaryTool.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(CFG)" == "BinaryTool - Win32 Release" || "$(CFG)" ==\
"BinaryTool - Win32 Debug"
SOURCE=".\src\BinaryTool.cpp"
!IF "$(CFG)" == "BinaryTool - Win32 Release"
DEP_CPP_BINAR=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\Scripts.h"\
".\inc\StdAfx.h"\
"$(INTDIR)\BinaryTool.obj" : $(SOURCE) $(DEP_CPP_BINAR) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
DEP_CPP_BINAR=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\Scripts.h"\
".\inc\StdAfx.h"\
"$(INTDIR)\BinaryTool.obj" : $(SOURCE) $(DEP_CPP_BINAR) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
SOURCE=.\res\BinaryTool.rc
DEP_RSC_BINARY=\
".\res\BinaryTool.ico"\
".\res\BinaryTool.rc2"\
".\res\case_checked.bmp"\
".\res\case_vide.bmp"\
".\res\croix.bmp"\
!IF "$(CFG)" == "BinaryTool - Win32 Release"
"$(INTDIR)\BinaryTool.res" : $(SOURCE) $(DEP_RSC_BINARY) "$(INTDIR)"
$(RSC) /l 0x40c /fo"$(INTDIR)\BinaryTool.res" /i "res" /d "NDEBUG" /d\
"_AFXDLL" $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
"$(INTDIR)\BinaryTool.res" : $(SOURCE) $(DEP_RSC_BINARY) "$(INTDIR)"
$(RSC) /l 0x40c /fo"$(INTDIR)\BinaryTool.res" /i "res" /d "_DEBUG" /d\
"_AFXDLL" $(SOURCE)
!ENDIF
SOURCE=".\src\BinaryToolDlg.cpp"
!IF "$(CFG)" == "BinaryTool - Win32 Release"
DEP_CPP_BINARYT=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\panelafter.h"\
".\inc\PanelBeforeBin.h"\
".\inc\PanelLevels.h"\
".\inc\PanelResults.h"\
".\inc\PanelSettings.h"\
".\inc\Scripts.h"\
".\inc\StdAfx.h"\
".\inc\util.h"\
"$(INTDIR)\BinaryToolDlg.obj" : $(SOURCE) $(DEP_CPP_BINARYT) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
DEP_CPP_BINARYT=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\panelafter.h"\
".\inc\PanelBeforeBin.h"\
".\inc\PanelLevels.h"\
".\inc\PanelResults.h"\
".\inc\PanelSettings.h"\
".\inc\Scripts.h"\
".\inc\StdAfx.h"\
".\inc\util.h"\
"$(INTDIR)\BinaryToolDlg.obj" : $(SOURCE) $(DEP_CPP_BINARYT) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
SOURCE=.\src\file.cpp
!IF "$(CFG)" == "BinaryTool - Win32 Release"
DEP_CPP_FILE_=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\file.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\StdAfx.h"\
".\inc\util.h"\
"$(INTDIR)\file.obj" : $(SOURCE) $(DEP_CPP_FILE_) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
DEP_CPP_FILE_=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\file.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\StdAfx.h"\
".\inc\util.h"\
"$(INTDIR)\file.obj" : $(SOURCE) $(DEP_CPP_FILE_) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
SOURCE=.\src\Panel.cpp
!IF "$(CFG)" == "BinaryTool - Win32 Release"
DEP_CPP_PANEL=\
".\inc\BinaryTool.h"\
".\inc\Panel.h"\
".\inc\StdAfx.h"\
"$(INTDIR)\Panel.obj" : $(SOURCE) $(DEP_CPP_PANEL) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
DEP_CPP_PANEL=\
".\inc\BinaryTool.h"\
".\inc\Panel.h"\
".\inc\StdAfx.h"\
"$(INTDIR)\Panel.obj" : $(SOURCE) $(DEP_CPP_PANEL) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
SOURCE=.\src\panelafter.cpp
!IF "$(CFG)" == "BinaryTool - Win32 Release"
DEP_CPP_PANELA=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\panelafter.h"\
".\inc\StdAfx.h"\
".\inc\util.h"\
"$(INTDIR)\panelafter.obj" : $(SOURCE) $(DEP_CPP_PANELA) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
DEP_CPP_PANELA=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\panelafter.h"\
".\inc\StdAfx.h"\
".\inc\util.h"\
"$(INTDIR)\panelafter.obj" : $(SOURCE) $(DEP_CPP_PANELA) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
SOURCE=.\src\PanelBeforeBin.cpp
!IF "$(CFG)" == "BinaryTool - Win32 Release"
DEP_CPP_PANELB=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\file.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\PanelBeforeBin.h"\
".\inc\StdAfx.h"\
".\inc\Threads.h"\
".\inc\util.h"\
"$(INTDIR)\PanelBeforeBin.obj" : $(SOURCE) $(DEP_CPP_PANELB) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
DEP_CPP_PANELB=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\file.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\PanelBeforeBin.h"\
".\inc\StdAfx.h"\
".\inc\Threads.h"\
".\inc\util.h"\
"$(INTDIR)\PanelBeforeBin.obj" : $(SOURCE) $(DEP_CPP_PANELB) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
SOURCE=.\src\PanelLevels.cpp
!IF "$(CFG)" == "BinaryTool - Win32 Release"
DEP_CPP_PANELL=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\PanelLevels.h"\
".\inc\Scripts.h"\
".\inc\StdAfx.h"\
".\inc\Tasks.h"\
".\inc\Threads.h"\
".\inc\util.h"\
"$(INTDIR)\PanelLevels.obj" : $(SOURCE) $(DEP_CPP_PANELL) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
DEP_CPP_PANELL=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\PanelLevels.h"\
".\inc\Scripts.h"\
".\inc\StdAfx.h"\
".\inc\Tasks.h"\
".\inc\Threads.h"\
".\inc\util.h"\
"$(INTDIR)\PanelLevels.obj" : $(SOURCE) $(DEP_CPP_PANELL) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
SOURCE=.\src\PanelResults.cpp
!IF "$(CFG)" == "BinaryTool - Win32 Release"
DEP_CPP_PANELR=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\PanelResults.h"\
".\inc\StdAfx.h"\
"$(INTDIR)\PanelResults.obj" : $(SOURCE) $(DEP_CPP_PANELR) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
DEP_CPP_PANELR=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\PanelResults.h"\
".\inc\StdAfx.h"\
"$(INTDIR)\PanelResults.obj" : $(SOURCE) $(DEP_CPP_PANELR) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
SOURCE=.\src\PanelSettings.cpp
!IF "$(CFG)" == "BinaryTool - Win32 Release"
DEP_CPP_PANELS=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\file.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\PanelSettings.h"\
".\inc\StdAfx.h"\
".\inc\Tasks.h"\
".\inc\util.h"\
"$(INTDIR)\PanelSettings.obj" : $(SOURCE) $(DEP_CPP_PANELS) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
DEP_CPP_PANELS=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\file.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\PanelSettings.h"\
".\inc\StdAfx.h"\
".\inc\Tasks.h"\
".\inc\util.h"\
"$(INTDIR)\PanelSettings.obj" : $(SOURCE) $(DEP_CPP_PANELS) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
SOURCE=.\src\Process.cpp
!IF "$(CFG)" == "BinaryTool - Win32 Release"
DEP_CPP_PROCE=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\StdAfx.h"\
".\inc\util.h"\
"$(INTDIR)\Process.obj" : $(SOURCE) $(DEP_CPP_PROCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
DEP_CPP_PROCE=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\StdAfx.h"\
".\inc\util.h"\
"$(INTDIR)\Process.obj" : $(SOURCE) $(DEP_CPP_PROCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
SOURCE=.\src\Scripts.cpp
!IF "$(CFG)" == "BinaryTool - Win32 Release"
DEP_CPP_SCRIP=\
"..\..\public\cpa_dep.h"\
"..\..\public\cpa_std.h"\
"..\..\Public\ERM.h"\
"..\..\Public\Erm\CpaError.h"\
"..\..\public\mmg.h"\
"..\..\public\mmg\cpammg.h"\
"..\..\public\mmg\errmmg.h"\
"..\..\public\mmg\rastmmg.h"\
"..\..\public\scr.h"\
"..\..\public\scr\errscr.h"\
"..\..\public\scr\mmgscr.h"\
"..\..\public\scr\scr_anl.h"\
"..\..\public\scr\scr_bin.h"\
"..\..\public\scr\scr_cfg.h"\
"..\..\public\scr\scr_cfil.h"\
"..\..\public\scr\scr_cxt.h"\
"..\..\public\scr\scr_dbg.h"\
"..\..\public\scr\scr_dyar.h"\
"..\..\public\scr\scr_err.h"\
"..\..\public\scr\scr_file.h"\
"..\..\public\scr\scr_hash.h"\
"..\..\public\scr\scr_link.h"\
"..\..\public\scr\scr_mem.h"\
"..\..\public\scr\scr_ntfy.h"\
"..\..\public\scr\scr_page.h"\
"..\..\public\scr\scr_pars.h"\
"..\..\public\scr\scr_rdl0.h"\
"..\..\public\scr\scr_sect.h"\
"..\..\public\scr\scr_svl0.h"\
"..\..\public\scr\scr_svl1.h"\
"..\..\public\scr\scr_vars.h"\
"..\..\public\scr\scr_xxxx.h"\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\StdAfx.h"\
"$(INTDIR)\Scripts.obj" : $(SOURCE) $(DEP_CPP_SCRIP) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
DEP_CPP_SCRIP=\
"..\..\public\cpa_dep.h"\
"..\..\public\cpa_std.h"\
"..\..\Public\ERM.h"\
"..\..\Public\Erm\CpaError.h"\
"..\..\public\mmg.h"\
"..\..\public\mmg\cpammg.h"\
"..\..\public\mmg\errmmg.h"\
"..\..\public\mmg\rastmmg.h"\
"..\..\public\scr.h"\
"..\..\public\scr\errscr.h"\
"..\..\public\scr\mmgscr.h"\
"..\..\public\scr\scr_anl.h"\
"..\..\public\scr\scr_bin.h"\
"..\..\public\scr\scr_cfg.h"\
"..\..\public\scr\scr_cfil.h"\
"..\..\public\scr\scr_cxt.h"\
"..\..\public\scr\scr_dbg.h"\
"..\..\public\scr\scr_dyar.h"\
"..\..\public\scr\scr_err.h"\
"..\..\public\scr\scr_file.h"\
"..\..\public\scr\scr_hash.h"\
"..\..\public\scr\scr_link.h"\
"..\..\public\scr\scr_mem.h"\
"..\..\public\scr\scr_ntfy.h"\
"..\..\public\scr\scr_page.h"\
"..\..\public\scr\scr_pars.h"\
"..\..\public\scr\scr_rdl0.h"\
"..\..\public\scr\scr_sect.h"\
"..\..\public\scr\scr_svl0.h"\
"..\..\public\scr\scr_svl1.h"\
"..\..\public\scr\scr_vars.h"\
"..\..\public\scr\scr_xxxx.h"\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\StdAfx.h"\
"$(INTDIR)\Scripts.obj" : $(SOURCE) $(DEP_CPP_SCRIP) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
SOURCE=.\src\StdAfx.cpp
DEP_CPP_STDAF=\
".\inc\StdAfx.h"\
!IF "$(CFG)" == "BinaryTool - Win32 Release"
CPP_SWITCHES=/nologo /MD /W3 /GX /O2 /I "inc" /I "res" /D "WIN32" /D "NDEBUG"\
/D "_WINDOWS" /D "_AFXDLL" /Fp"$(INTDIR)\BinaryTool.pch" /YX"stdafx.h"\
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(CPP) @<<
$(CPP_SWITCHES) $(SOURCE)
<<
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "inc" /I "res" /D "WIN32" /D\
"_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "USE_PROFILER"\
/Fp"$(INTDIR)\BinaryTool.pch" /YX"StdAfx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\"\
/FD /c
"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(CPP) @<<
$(CPP_SWITCHES) $(SOURCE)
<<
!ENDIF
SOURCE=.\src\Tasks.cpp
!IF "$(CFG)" == "BinaryTool - Win32 Release"
DEP_CPP_TASKS=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\file.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\Scripts.h"\
".\inc\StdAfx.h"\
".\inc\Threads.h"\
".\inc\util.h"\
"$(INTDIR)\Tasks.obj" : $(SOURCE) $(DEP_CPP_TASKS) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
DEP_CPP_TASKS=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\file.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\Scripts.h"\
".\inc\StdAfx.h"\
".\inc\Threads.h"\
".\inc\util.h"\
"$(INTDIR)\Tasks.obj" : $(SOURCE) $(DEP_CPP_TASKS) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
SOURCE=.\src\ThreadAnim.cpp
!IF "$(CFG)" == "BinaryTool - Win32 Release"
DEP_CPP_THREA=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\file.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\StdAfx.h"\
".\inc\util.h"\
"$(INTDIR)\ThreadAnim.obj" : $(SOURCE) $(DEP_CPP_THREA) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
DEP_CPP_THREA=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\file.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\StdAfx.h"\
".\inc\util.h"\
"$(INTDIR)\ThreadAnim.obj" : $(SOURCE) $(DEP_CPP_THREA) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
SOURCE=.\src\ThreadBinarize.cpp
!IF "$(CFG)" == "BinaryTool - Win32 Release"
DEP_CPP_THREAD=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\file.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\StdAfx.h"\
".\inc\util.h"\
"$(INTDIR)\ThreadBinarize.obj" : $(SOURCE) $(DEP_CPP_THREAD) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
DEP_CPP_THREAD=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\file.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\StdAfx.h"\
".\inc\util.h"\
"$(INTDIR)\ThreadBinarize.obj" : $(SOURCE) $(DEP_CPP_THREAD) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
SOURCE=.\src\ThreadTextures.cpp
!IF "$(CFG)" == "BinaryTool - Win32 Release"
DEP_CPP_THREADT=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\file.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\StdAfx.h"\
".\inc\util.h"\
"$(INTDIR)\ThreadTextures.obj" : $(SOURCE) $(DEP_CPP_THREADT) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
DEP_CPP_THREADT=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\file.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\StdAfx.h"\
".\inc\util.h"\
"$(INTDIR)\ThreadTextures.obj" : $(SOURCE) $(DEP_CPP_THREADT) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
SOURCE=.\src\util.cpp
!IF "$(CFG)" == "BinaryTool - Win32 Release"
DEP_CPP_UTIL_=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\file.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\StdAfx.h"\
".\inc\util.h"\
"$(INTDIR)\util.obj" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "BinaryTool - Win32 Debug"
DEP_CPP_UTIL_=\
".\inc\BinaryTool.h"\
".\inc\BinaryToolDlg.h"\
".\inc\file.h"\
".\inc\GlobalData.h"\
".\inc\Panel.h"\
".\inc\StdAfx.h"\
".\inc\util.h"\
"$(INTDIR)\util.obj" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
!ENDIF

View File

@@ -0,0 +1,49 @@
// BinaryTool.h : main header file for the BINARY TOOL application
//
#if !defined(AFX_BINARYTOOL_H__6B8ECEAE_CC90_11D2_BB42_00E029219C3C__INCLUDED_)
#define AFX_BINARYTOOL_H__6B8ECEAE_CC90_11D2_BB42_00E029219C3C__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CBinaryToolApp:
// See BinaryTool.cpp for the implementation of this class
//
class CBinaryToolApp : public CWinApp
{
public:
CBinaryToolApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBinaryToolApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CBinaryToolApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_BINARYTOOL_H__6B8ECEAE_CC90_11D2_BB42_00E029219C3C__INCLUDED_)

View File

@@ -0,0 +1,74 @@
// BinaryToolDlg.h : header file
//
#if !defined(AFX_BINARYTOOLDLG_H__6B8ECEB0_CC90_11D2_BB42_00E029219C3C__INCLUDED_)
#define AFX_BINARYTOOLDLG_H__6B8ECEB0_CC90_11D2_BB42_00E029219C3C__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "Panel.h"
/////////////////////////////////////////////////////////////////////////////
// CBinaryToolDlg dialog
class CBinaryToolDlg : public CDialog
{
// Construction
public:
CBinaryToolDlg(CWnd* pParent = NULL); // standard constructor
~CBinaryToolDlg();
// Dialog Data
//{{AFX_DATA(CBinaryToolDlg)
enum { IDD = IDD_BINARYTOOL_DIALOG };
CTabCtrl m_TabControl;
//}}AFX_DATA
void m_fn_vNotifyStartOfWork();
void m_fn_vNotifyEndOfWork( BOOL _bKeepDisplayResultPanel );
void m_fn_vCancelStopWorkInProgress();
BOOL m_fn_bRefreshLevelList();
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBinaryToolDlg)
public:
virtual BOOL DestroyWindow();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
CString m_csDlgTitle;
// Generated message map functions
//{{AFX_MSG(CBinaryToolDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnSelchangeTabPanel(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnQuit();
afx_msg void OnClose();
afx_msg void OnStopWorkInProgress();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// For panels management
CPanel *m_a_pPanels[10];
int m_iNumberOfPanels;
int m_iCurrentPanel;
int m_iPanelBeforeStartOfWork;
int m_iResultPanel;
void m_fn_vSetCurrentPanel( int _iNewPanel );
virtual void OnOK();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_BINARYTOOLDLG_H__6B8ECEB0_CC90_11D2_BB42_00E029219C3C__INCLUDED_)

View File

@@ -0,0 +1,61 @@
#ifndef _GLOBALDATA_H_
#define _GLOBALDATA_H_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "BinaryTool.h"
#include "BinaryToolDlg.h"
typedef struct tdstGlobalData_
{
// Info on main window
CBinaryToolDlg *p_oMainDlg;
CEdit *p_oEditResults;
// Directory where Binary Tool was launched
CString csStartupDirectory;
// Event set when user wants to stop a work in progress
HANDLE hEventStop;
BOOL bStopWork; // Same thing as EventStop (set and reset at the same time)
// User settings
CString csBinDirectory; // Path of binary data directory (ex: x:\cpa\exe\main\Bindatas)
CString csMainDirectory; // Path of main directory (ex: x:\cpa\exe\main)
CString csExeName; // Name of game executable without path (ex: MainWinR.exe )
BOOL bDebugVersion; // True if debug, false if release
CString csTempTextureDirectory; // A temporary directory for texture bigfile.
// All possible executables (one per version (debug or release)
CStringArray csExecutableNames;
// From version.ini
CStringArray a_csVersionDirectories;
// From soundversion.ini
CStringArray a_csSoundVersionDirectories;
// From game.dsc
CStringArray a_csLevelNames;
// Binarized levels (array of booleans)
CByteArray a_cLevelsSelectedForBinarization;
CByteArray a_cBinarizedLevels;
// Used when binarizing :
BOOL bCommonFilesAreCopied; // The files common to all levels have been copied (vignettes, options and such)
BOOL bStopBinarizeOnError; // Stop if binarization fails on one map ?
BOOL bAutoTestMaps; // Launch automatic test after binarize ?
// When spawning programs.
BOOL bAutoDetectErrors; // Automaticaly close spawned programs on error.
} tdstGlobalData;
extern struct tdstGlobalData_ g_stTheGlobalData; // Defined in BinaryTool.cpp
#endif /* _GLOBALDATA_H_ */

View File

@@ -0,0 +1,60 @@
#if !defined(AFX_PANEL_H__89CC65A9_D186_11D2_BB48_00E029219C3C__INCLUDED_)
#define AFX_PANEL_H__89CC65A9_D186_11D2_BB48_00E029219C3C__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// Panel.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CPanel dialog
class CPanel : public CDialog
{
// Construction
public:
CPanel(UINT nIDTemplate, CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CPanel)
enum { IDD = IDD_ABOUTBOX };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
TCHAR m_szTitle[64];
virtual BOOL Create( CWnd* pParentWnd );
virtual void m_fn_vUpdateRegistry();
virtual void m_fn_vEnableAllControls( BOOL bEnable );
// Methods To control departure from and arrival to a panel
// Test if can leave this panel
virtual BOOL m_fn_bCanChangePanel();
// Called when we arrive in panel (just before displaying it).
virtual void m_fn_vOnDisplayPanel();
virtual void m_fn_vLevelListHasChanged( BOOL _bErrorWhileReadingGameDsc );
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPanel)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CPanel)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
virtual void OnOk();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PANEL_H__89CC65A9_D186_11D2_BB48_00E029219C3C__INCLUDED_)

View File

@@ -0,0 +1,59 @@
#if !defined(AFX_PANELBEFOREBIN_H__6B8ECEB8_CC90_11D2_BB42_00E029219C3C__INCLUDED_)
#define AFX_PANELBEFOREBIN_H__6B8ECEB8_CC90_11D2_BB42_00E029219C3C__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// PanelBeforeBin.h : header file
//
#include "Panel.h"
/////////////////////////////////////////////////////////////////////////////
// CPanelBeforeBin dialog
class CPanelBeforeBin : public CPanel
{
// Construction
public:
CPanelBeforeBin(CWnd* pParent=NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CPanelBeforeBin)
enum { IDD = IDD_DIALOG_BeforeBinarization };
CEdit m_oEditTempDirForTextures;
//}}AFX_DATA
virtual BOOL Create( CWnd* pParentWnd );
virtual void m_fn_vUpdateRegistry();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPanelBeforeBin)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CPanelBeforeBin)
afx_msg void OnMakeSoundBanks();
virtual BOOL OnInitDialog();
afx_msg void OnCopySound();
afx_msg void OnMakeGF();
afx_msg void OnBrowseTempTextureDirectory();
afx_msg void OnMakeBigFile();
afx_msg void OnMakeA3i();
afx_msg void OnKillfocusEDITTempTextureDirectory();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
void m_fn_vValidateTempTextureDirectory();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PANELBEFOREBIN_H__6B8ECEB8_CC90_11D2_BB42_00E029219C3C__INCLUDED_)

View File

@@ -0,0 +1,116 @@
#if !defined(AFX_PANELLEVELS_H__90CBA234_D209_11D2_BB49_00E029219C3C__INCLUDED_)
#define AFX_PANELLEVELS_H__90CBA234_D209_11D2_BB49_00E029219C3C__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// PanelLevels.h : header file
//
#include "Panel.h"
#include "util.h"
/////////////////////////////////////////////////////////////////////////////
// CListLevels window
class CListLevels : public CListBox
{
// Construction
public:
CListLevels();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CListLevels)
public:
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CListLevels();
// Generated message map functions
protected:
//{{AFX_MSG(CListLevels)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CPanelLevels dialog
class CPanelLevels : public CPanel
{
// Construction
public:
CPanelLevels(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CPanelLevels)
enum { IDD = IDD_DIALOG_Levels };
CButton m_CheckAutoTest;
CButton m_CheckStopOnError;
CListBox m_ListLevels;
//}}AFX_DATA
virtual BOOL Create( CWnd* pParentWnd );
virtual void m_fn_vUpdateRegistry();
virtual void m_fn_vLevelListHasChanged( BOOL _bErrorWhileReadingGameDsc );
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPanelLevels)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
///CByteArray m_oSelectedLevels;
// To display a cross in front of selected levels.
CDC m_oCrossDC;
CBitmap m_oCrossBitmap;
CBitmap m_oEmptyBoxBitmap;
// Generated message map functions
//{{AFX_MSG(CPanelLevels)
afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
afx_msg void OnSelectAllLevels();
afx_msg void OnClearAllLevels();
afx_msg void OnBinarize();
afx_msg void OnCHECKAutoTest();
afx_msg void OnTestMaps();
afx_msg void OnBUTTONRefreshLevelList();
afx_msg void OnCHECKStopOnError();
afx_msg void OnBUTTONEditGameDsc();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
BOOL m_fn_bOnLButtonDownListBoxLevels( MSG *pMsg );
BOOL m_fn_bOnKeyDownListBoxLevels( MSG *pMsg );
void m_fn_vOnDrawItemListBoxLevels( LPDRAWITEMSTRUCT lpDIS );
virtual void OnOk();
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PANELLEVELS_H__90CBA234_D209_11D2_BB49_00E029219C3C__INCLUDED_)

View File

@@ -0,0 +1,49 @@
#if !defined(AFX_PANELRESULTS_H__89CC65A8_D186_11D2_BB48_00E029219C3C__INCLUDED_)
#define AFX_PANELRESULTS_H__89CC65A8_D186_11D2_BB48_00E029219C3C__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// PanelResults.h : header file
//
#include "Panel.h"
/////////////////////////////////////////////////////////////////////////////
// CPanelResults dialog
class CPanelResults : public CPanel
{
// Construction
public:
CPanelResults(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CPanelResults)
enum { IDD = IDD_DIALOG_Results };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
virtual BOOL Create( CWnd* pParentWnd );
virtual void m_fn_vUpdateRegistry();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPanelResults)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CPanelResults)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PANELRESULTS_H__89CC65A8_D186_11D2_BB48_00E029219C3C__INCLUDED_)

View File

@@ -0,0 +1,72 @@
#if !defined(AFX_PANELSETTINGS_H__90CBA232_D209_11D2_BB49_00E029219C3C__INCLUDED_)
#define AFX_PANELSETTINGS_H__90CBA232_D209_11D2_BB49_00E029219C3C__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// PanelSettings.h : header file
//
#include "Panel.h"
/////////////////////////////////////////////////////////////////////////////
// CPanelSettings dialog
class CPanelSettings : public CPanel
{
// Construction
public:
CPanelSettings(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CPanelSettings)
enum { IDD = IDD_DIALOG_Settings };
CButton m_CheckAutoDetectErrors;
CEdit m_EditMainDirectory;
CEdit m_EditBinDirectory;
CEdit m_EditExeName;
//}}AFX_DATA
BOOL Create( CWnd* pParentWnd );
virtual void m_fn_vUpdateRegistry();
BOOL m_fn_bCanChangePanel();
void m_fn_vOnDisplayPanel();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPanelSettings)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CPanelSettings)
afx_msg void OnBrowseMainDirectory();
afx_msg void OnBrowseBinaryDirectory();
afx_msg void OnBrowseExeName();
afx_msg void OnChangeMainDirectory();
afx_msg void OnChangeBinaryDirectory();
afx_msg void OnChangeExeName();
afx_msg void OnRADIODebugOrRelease();
afx_msg void OnDropFiles(HDROP hDropInfo);
afx_msg void OnCHECKAutoDetectErrors();
afx_msg void OnBUTTONMakeVersion();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
BOOL m_fn_bValidateMainDirectorySetting();
BOOL m_fn_bValidateBinDirectorySetting();
BOOL m_fn_bValidateGameExeSetting();
BOOL m_bMainDirectoryIsValid;
BOOL m_bBinDirectoryIsValid;
BOOL m_bGameExeIsValid;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PANELSETTINGS_H__90CBA232_D209_11D2_BB49_00E029219C3C__INCLUDED_)

View File

@@ -0,0 +1,23 @@
#ifndef _PROCESS_H_
#define _PROCESS_H_
#include "util.h"
// Launch a new process using CreateProcess and return immediatly
// return TRUE if process was created normally or FALSE if not.
// Also fill _p_Info with process informations (handle...)
// Display a dialog box to the user in case of error on CreateProcess.
BOOL fn_bSpawnProcess( char *_szExeName, char *_szCommandLine, LPPROCESS_INFORMATION _p_Info );
void fn_vCloseProcessHandles( LPPROCESS_INFORMATION _p_stProcess );
BOOL fn_bCloseSytemErrorDialogBox( char *_szExeName, BOOL bForceClose = FALSE );
tdeStatus fn_eWaitForMultipleProcesses( int _iNbProcesses, LPPROCESS_INFORMATION _pa_stInfo, LPCTSTR _szExeNames[], int *_p_iProcessesEnded );
tdeStatus fn_eSpawnAndWaitForProcess( char *_szExeName, char *_szCommandLine, HANDLE _hEventStop = INVALID_HANDLE_VALUE );
tdeStatus fn_eSpawnAndWaitForProcessWithInputEvents( char *_szExeName, char *_szCommandLine );
tdeStatus fn_eSpawnAndWaitForProcessWithTimeout( char *_szExeName, char *_szCommandLine, DWORD dwMilliseconds = INFINITE );
tdeStatus fn_eSpawnThreadAndWaitWithInputEvents( AFX_THREADPROC _p_fn_uiThread, LPVOID _p_vParamForThread );
#endif

View File

@@ -0,0 +1,15 @@
#ifndef _SCRIPTS_H_
#define _SCRIPTS_H_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// Init acp modules for script parsing.
void fn_vInitScr();
void fn_vDesinitScr();
BOOL fn_bReadGameDsc();
#endif // _SCRIPTS_H_

View File

@@ -0,0 +1,27 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__6B8ECEB2_CC90_11D2_BB42_00E029219C3C__INCLUDED_)
#define AFX_STDAFX_H__6B8ECEB2_CC90_11D2_BB42_00E029219C3C__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <Afxdisp.h>
#include <afxmt.h>
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__6B8ECEB2_CC90_11D2_BB42_00E029219C3C__INCLUDED_)

View File

@@ -0,0 +1,9 @@
#ifndef _TASKS_H_
#define _TASKS_H_
tdeStatus fn_e_TASK_Binarize( CByteArray &a_cSelectedLevels );
tdeStatus fn_e_TASK_TestBinarizedMaps( CByteArray &a_cBinarizedLevels );
tdeStatus fn_e_TASK_Version();
#endif // _TASKS_H_

View File

@@ -0,0 +1,10 @@
#ifndef _THREAD_H_
#define _THREAD_H_
UINT fn_uiThreadBinarize( LPVOID _p_stParam );
UINT fn_uiThreadMakeGFTextures( LPVOID _p_vParam );
UINT fn_uiThreadMakeBigFileTextures( LPVOID _p_vParam );
UINT fn_uiThreadAnims( LPVOID _p_vParam );
#endif

View File

@@ -0,0 +1,53 @@
#ifndef _FILE_H_
#define _FILE_H_
#include "util.h"
tdeStatus fn_eCreateDirectory( const char *_szDirectory );
// Copy a file or a directory (no '\' at end of directory name !)
// Source may contain wilcards. Dest must be a path to a directory !
// If source is a directory, the copy is recursive.
tdeStatus fn_eCopyFileOrDirectory( const char *_szSource, const char *_szDest );
// Copy some files to a directory. Function will also search for files in sub-dirs of source.
// Source may contain wilcards. Dest must be a path to a directory !
tdeStatus fn_eRecursiveFileCopy( const char *_szSource, const char *_szDest );
// Moves file(s) or a directory (no '\' at end of directory name !)
// Source may contain wilcards. Dest must be a path to a directory !
tdeStatus fn_eMoveFileOrDirectory( const char *_szSource, const char *_szDest );
// Deletes file(s) or directory (no '\' at end of directory name !)
// Source may contain wilcards.
// If source is a directory, the delete is recursive.
tdeStatus fn_eDeleteFileOrDirectory( const char *_szSource );
typedef struct tdstCopyFileContext_
{
CString csMainDirectory;
CString csBinDirectory;
CString csLevelName;
} tdstCopyFileContext;
// Execute copy/move/deletes/rename commands in given array
// See file.cpp for exemples.
// stContext contains strings used when replacing %bin%, %level%....
tdeStatus fn_eTreatArrayOfFiles( char *_a_szFileCommands[], tdstCopyFileContext *_p_stContext );
// The arrays for fn_bTreatArrayOfFiles
extern char *g_a_szCommonFiles[];
extern char *g_a_szFilesAfterFirstPass[];
extern char *g_a_szFilesAfterSecondPass[];
extern char *g_a_szFixFilesAfterCRB[];
extern char *g_a_szDeleteFixFilesAfterCRB[];
extern char *g_a_szLevelFilesAfterCRB[];
extern char *g_a_szFilesBeforeBinarize[];
extern char *g_a_szDeleteFilesAfterBinarize[];
#endif

View File

@@ -0,0 +1,53 @@
#if !defined(AFX_PANELAFTER_H__8AA7F79E_F23D_11D2_BB70_00E029219C3C__INCLUDED_)
#define AFX_PANELAFTER_H__8AA7F79E_F23D_11D2_BB70_00E029219C3C__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// panelafter.h : header file
//
#include "Panel.h"
#include "util.h"
/////////////////////////////////////////////////////////////////////////////
// CPanelAfter dialog
class CPanelAfter : public CPanel
{
// Construction
public:
CPanelAfter(CWnd* pParent = NULL); // standard constructor
virtual BOOL Create( CWnd* pParentWnd );
virtual void m_fn_vUpdateRegistry();
// Dialog Data
//{{AFX_DATA(CPanelAfter)
enum { IDD = IDD_DIALOG_AfterBinarization };
CEdit m_EditSizeOfBigFile;
CButton m_CheckDeleteRelocTables;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPanelAfter)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CPanelAfter)
afx_msg void OnBUTTONGenerateBigFile();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PANELAFTER_H__8AA7F79E_F23D_11D2_BB70_00E029219C3C__INCLUDED_)

View File

@@ -0,0 +1,55 @@
#ifndef _UTIL_H_
#define _UTIL_H_
typedef enum tdeStatus_
{
STATUS_C_OK,
STATUS_C_Error,
STATUS_C_UserBreak
} tdeStatus;
// Ask the user to choose a directory and return the selected directory.
// Return an empty string if no dir selected.
// Parameter is the string that will be displayed in dlg box (ie: "Choose directory" )
CString fn_csBrowseDirectory( LPCTSTR _p_szTitle, LPCTSTR _p_szDefaultDir = NULL );
// Add a line of text in the CEdit control used for displaying results.
// Line must be terminated by "\r\n" for carriage return.
void fn_vOutputLine( const TCHAR *_p_szLine );
// Read version.ini file and update GlobalData
BOOL fn_bReadVersionFile();
// Read SoundVersion.ini file and update GlobalData
BOOL fn_bReadSoundVersionFile();
// Copy sound directories into bin directory
UINT fn_uiThreadCopySoundDirectory( LPVOID _p_stParam );
// Update the file startprg.ini
void fn_vUpdateStartPrg();
// Update the file startprg.ini
void fn_vUpdateStartPrg_old();
// Disable use of bigfile for relocation tables (in startprg.ini)
void fn_vDisableRelocTableBigFile();
// Find a substring in szString1.
// Comparaison is case INSENSITIVE.
const char *stristr( const char *szString, const char *szSubString );
BOOL fn_bCheckFileExistanceInStartupDir( CString csFileName );
BOOL fn_bValidateMainDirectorySetting();
BOOL fn_bValidateBinDirectorySetting();
BOOL fn_bValidateGameExeSetting();
void fn_vMakeSndParserCommandLine( char *szCommandLine );
void fn_vGetShortExeName( char *_szShortExeName, char *_szLongExeName );
#endif

View File

@@ -0,0 +1,9 @@
SCC = This is a Source Code Control file
[BinaryTool.dsp]
SCC_Aux_Path = "\\srvprojets-ma\Rayman4_DS\Versions\Rayman4DS\Tools"
SCC_Project_Name = "$/CPA/Appli/BinaryTool2", ADAAAAAA
[BinaryTool.mak]
SCC_Aux_Path = "\\srvprojets-ma\Rayman4_DS\Versions\Rayman4DS\Tools"
SCC_Project_Name = "$/CPA/Appli/BinaryTool2", ADAAAAAA

View File

@@ -0,0 +1,194 @@
; CLW file contains information for the MFC ClassWizard
[General Info]
Version=1
LastClass=CPanelSettings
LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "binarytool.h"
LastPage=0
ClassCount=8
Class1=CBinaryToolApp
Class2=CBinaryToolDlg
Class3=CPanel
Class4=CPanelBeforeBin
Class5=CPanelLevels
Class6=CPanelResults
Class7=CPanelSettings
Class8=CAboutDlg
ResourceCount=7
Resource1=IDD_ABOUTBOX (Neutral (Default))
Resource2=IDD_DIALOG_Results
Resource3=IDD_DIALOG_BeforeBinarization
Resource4=IDD_BINARYTOOL_DIALOG (Neutral (Default))
Resource5=IDD_DIALOG_Levels
Resource6=IDD_DIALOG_AfterBinarization
Resource7=IDD_DIALOG_Settings
[CLS:CBinaryToolApp]
Type=0
BaseClass=CWinApp
HeaderFile=\cpa\Appli\BinaryTool2\inc\BinaryTool.h
ImplementationFile=\cpa\Appli\BinaryTool2\src\BinaryTool.cpp
LastObject=CBinaryToolApp
Filter=N
VirtualFilter=AC
[CLS:CBinaryToolDlg]
Type=0
BaseClass=CDialog
HeaderFile=\cpa\Appli\BinaryTool2\inc\BinaryToolDlg.h
ImplementationFile=\cpa\Appli\BinaryTool2\src\BinaryToolDlg.cpp
LastObject=CBinaryToolDlg
[CLS:CPanel]
Type=0
BaseClass=CDialog
HeaderFile=\cpa\Appli\BinaryTool2\inc\Panel.h
ImplementationFile=\cpa\Appli\BinaryTool2\src\Panel.cpp
LastObject=CPanel
[CLS:CPanelBeforeBin]
Type=0
BaseClass=CDialog
HeaderFile=\cpa\Appli\BinaryTool2\inc\PanelBeforeBin.h
ImplementationFile=\cpa\Appli\BinaryTool2\src\PanelBeforeBin.cpp
Filter=D
VirtualFilter=dWC
LastObject=CPanelBeforeBin
[CLS:CPanelLevels]
Type=0
BaseClass=CDialog
HeaderFile=\cpa\Appli\BinaryTool2\inc\PanelLevels.h
ImplementationFile=\cpa\Appli\BinaryTool2\src\PanelLevels.cpp
LastObject=CPanelLevels
Filter=D
VirtualFilter=dWC
[CLS:CPanelResults]
Type=0
BaseClass=CDialog
HeaderFile=\cpa\Appli\BinaryTool2\inc\PanelResults.h
ImplementationFile=\cpa\Appli\BinaryTool2\src\PanelResults.cpp
[CLS:CPanelSettings]
Type=0
BaseClass=CDialog
HeaderFile=\cpa\Appli\BinaryTool2\inc\PanelSettings.h
ImplementationFile=\cpa\Appli\BinaryTool2\src\PanelSettings.cpp
LastObject=CPanelSettings
Filter=D
VirtualFilter=dWC
[CLS:CAboutDlg]
Type=0
BaseClass=CDialog
HeaderFile=\cpa\Appli\BinaryTool2\src\BinaryToolDlg.cpp
ImplementationFile=\cpa\Appli\BinaryTool2\src\BinaryToolDlg.cpp
[DLG:IDD_BINARYTOOL_DIALOG]
Type=1
Class=CBinaryToolDlg
[DLG:IDD_ABOUTBOX]
Type=1
Class=CPanel
[DLG:IDD_DIALOG_BeforeBinarization]
Type=1
Class=CPanelBeforeBin
ControlCount=15
Control1=IDC_GROUPSoundBanks,button,1342177287
Control2=IDC_BUTTON_MakeSoundBanks,button,1342242816
Control3=IDC_BUTTON_CopySound,button,1342242816
Control4=IDC_GOUPTextures,button,1342177287
Control5=IDC_STATIC,static,1342308352
Control6=IDC_EDIT_TempTextureDirectory,edit,1350631552
Control7=IDC_BUTTON_BrowseTempTextureDirectory,button,1342242816
Control8=IDC_BUTTON_MakeGF,button,1342242816
Control9=IDC_BUTTON_MakeBigFile,button,1342242816
Control10=IDC_STATIC,button,1342177287
Control11=IDC_RADIO_OptimizedAnims,button,1342308361
Control12=IDC_RADIO_NonOptimizedAnims,button,1342177289
Control13=IDC_BUTTON_MakeA3i,button,1342242816
Control14=IDC_STATIC,static,1342308353
Control15=IDC_STATIC,static,1342308352
[DLG:IDD_DIALOG_Levels]
Type=1
Class=CPanelLevels
ControlCount=13
Control1=IDC_STATIC,static,1342308352
Control2=IDC_LIST_Levels,listbox,1352730961
Control3=IDC_STATIC,button,1342177287
Control4=IDC_BUTTON_SelectAll,button,1342242816
Control5=IDC_BUTTON_ClearAll,button,1342242816
Control6=IDC_STATIC,button,1342177287
Control7=IDC_CHECK_AutoTest,button,1342242819
Control8=IDC_CHECK_StopOnError,button,1342242819
Control9=IDC_BUTTON_Binarize,button,1342242817
Control10=IDC_BUTTON_TestMaps,button,1342242816
Control11=IDC_BUTTON_Refresh,button,1342242816
Control12=IDC_BUTTON_EditGameDsc,button,1342242816
Control13=IDC_STATIC,button,1342177287
[DLG:IDD_DIALOG_Results]
Type=1
Class=CPanelResults
ControlCount=1
Control1=IDC_EDIT_Results,edit,1352734788
[DLG:IDD_DIALOG_Settings]
Type=1
Class=CPanelSettings
ControlCount=15
Control1=IDC_STATIC,button,1342177287
Control2=IDC_STATIC,static,1342177280
Control3=IDC_EDIT_MainDirectory,edit,1350631552
Control4=IDC_BUTTON_BrowseMainDirectory,button,1342242816
Control5=IDC_STATIC,static,1342177280
Control6=IDC_EDIT_BinaryDirectory,edit,1350631552
Control7=IDC_BUTTON_BrowseBinaryDirectory,button,1342242816
Control8=IDC_EDIT_ExeName,edit,1350631552
Control9=IDC_BUTTON_BrowseExeName,button,1342242816
Control10=IDC_STATIC,button,1342177287
Control11=IDC_RADIO_Debug,button,1342308361
Control12=IDC_RADIO_Release,button,1342177289
Control13=IDC_CHECK_AutoDetectErrors,button,1342242819
Control14=IDC_STATIC,button,1342177287
Control15=IDC_BUTTON_MakeVersion,button,1342242816
[DLG:IDD_ABOUTBOX (Neutral (Default))]
Type=1
Class=?
ControlCount=6
Control1=IDC_STATIC,static,1342177283
Control2=IDC_STATIC,static,1342308480
Control3=IDC_STATIC,static,1342308352
Control4=IDOK,button,1342373889
Control5=IDC_STATIC,static,1342308352
Control6=IDC_STATIC,static,1342308352
[DLG:IDD_BINARYTOOL_DIALOG (Neutral (Default))]
Type=1
Class=?
ControlCount=4
Control1=ID_BOUTON_Quit,button,1342242816
Control2=IDC_TAB_Panel,SysTabControl32,1342242816
Control3=IDC_STATIC_Version,static,1342308352
Control4=ID_BUTTON_Stop,button,1073807360
[DLG:IDD_DIALOG_AfterBinarization]
Type=1
Class=?
ControlCount=6
Control1=IDC_STATIC,button,1342177287
Control2=IDC_EDIT_SizeOfBigFile,edit,1350639744
Control3=IDC_STATIC,static,1342308352
Control4=IDC_STATIC,static,1342308352
Control5=IDC_CHECK_DeleteRelocTables,button,1342242851
Control6=IDC_BUTTON_GenerateBigFile,button,1342242816

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -0,0 +1,414 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Neutral (Default) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD)
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 217, 87
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About BinaryTool"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "BinaryTool Version 2.40",IDC_STATIC,40,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C)Ubi Simulation 1999",IDC_STATIC,40,25,119,
8
DEFPUSHBUTTON "OK",IDOK,178,7,32,14,WS_GROUP
LTEXT "E-mail: gsouchet@ubisoft.fr",IDC_STATIC,40,62,87,8
LTEXT "By Mihaela Tancu && Guillaume Souchet",IDC_STATIC,40,38,
126,8
END
IDD_BINARYTOOL_DIALOG DIALOGEX 0, 0, 314, 290
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES | WS_EX_CONTROLPARENT | WS_EX_APPWINDOW
CAPTION "Binary Converting Tool"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "Quit",ID_BOUTON_Quit,239,269,50,14
CONTROL "Tab1",IDC_TAB_Panel,"SysTabControl32",WS_TABSTOP,7,7,
300,254,WS_EX_ACCEPTFILES
LTEXT "BinaryTool v2.40",IDC_STATIC_Version,72,272,60,8
PUSHBUTTON "Stop !",ID_BUTTON_Stop,163,269,50,14,NOT WS_VISIBLE
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 210
TOPMARGIN, 7
BOTTOMMARGIN, 80
END
IDD_BINARYTOOL_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 307
TOPMARGIN, 7
BOTTOMMARGIN, 283
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_BITMAP_VIDE BITMAP DISCARDABLE "case_vide.bmp"
IDB_BITMAP_CHECK BITMAP DISCARDABLE "case_checked.bmp"
#endif // Neutral (Default) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// 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
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 2,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "BinaryTool MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "BinaryTool\0"
VALUE "LegalCopyright", "Copyright (C) 1999\0"
VALUE "OriginalFilename", "BinaryTool.EXE\0"
VALUE "ProductName", "BinaryTool Application\0"
VALUE "ProductVersion", "2, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ABOUTBOX "&About BinaryTool..."
IDS_Registry "Ubi Simulation"
IDS_AppTitle "Binary Converting Tool"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// French (France) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOG_BeforeBinarization DIALOGEX 0, 0, 300, 236
STYLE WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
GROUPBOX "Sound Banks",IDC_GROUPSoundBanks,22,11,262,41
PUSHBUTTON "Make sound banks",IDC_BUTTON_MakeSoundBanks,36,28,85,14
PUSHBUTTON "Copy sound directory",IDC_BUTTON_CopySound,160,28,85,14
GROUPBOX "Textures",IDC_GOUPTextures,22,68,260,72
LTEXT "Temporary directory for bigfile",IDC_STATIC,35,84,93,8
EDITTEXT IDC_EDIT_TempTextureDirectory,35,95,155,14,
ES_AUTOHSCROLL
PUSHBUTTON "Browse...",IDC_BUTTON_BrowseTempTextureDirectory,197,95,
50,14
PUSHBUTTON "Make GF textures",IDC_BUTTON_MakeGF,52,119,74,14
PUSHBUTTON "Make bigfile",IDC_BUTTON_MakeBigFile,154,119,74,14
GROUPBOX "Animations (optional)",IDC_STATIC,22,155,260,46
CONTROL "Optimized",IDC_RADIO_OptimizedAnims,"Button",
BS_AUTORADIOBUTTON | WS_GROUP,40,168,62,10
CONTROL "Non Optimized",IDC_RADIO_NonOptimizedAnims,"Button",
BS_AUTORADIOBUTTON,40,182,62,10
PUSHBUTTON "Make all a3i",IDC_BUTTON_MakeA3i,154,172,74,14
CTEXT "Or",IDC_STATIC,135,122,8,8
LTEXT "then",IDC_STATIC,133,31,15,8
END
IDD_DIALOG_Results DIALOGEX 0, 0, 300, 242
STYLE WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
EDITTEXT IDC_EDIT_Results,7,7,286,228,ES_MULTILINE |
ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN |
WS_VSCROLL
END
IDD_DIALOG_Settings DIALOGEX 0, 0, 300, 239
STYLE WS_CHILD
EXSTYLE WS_EX_ACCEPTFILES | WS_EX_CONTROLPARENT
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
GROUPBOX "Locations",IDC_STATIC,17,14,269,145
LTEXT "Main directory",IDC_STATIC,31,33,45,8,NOT WS_GROUP
EDITTEXT IDC_EDIT_MainDirectory,34,47,174,14,ES_AUTOHSCROLL,
WS_EX_ACCEPTFILES
PUSHBUTTON "Browse...",IDC_BUTTON_BrowseMainDirectory,215,47,50,14
LTEXT "Directory of binary data",IDC_STATIC,31,72,74,8,NOT
WS_GROUP
EDITTEXT IDC_EDIT_BinaryDirectory,34,84,174,14,ES_AUTOHSCROLL,
WS_EX_ACCEPTFILES
PUSHBUTTON "Browse...",IDC_BUTTON_BrowseBinaryDirectory,215,84,50,
14
EDITTEXT IDC_EDIT_ExeName,93,119,115,14,ES_AUTOHSCROLL,
WS_EX_ACCEPTFILES
PUSHBUTTON "Browse...",IDC_BUTTON_BrowseExeName,215,118,50,14
GROUPBOX "Engine",IDC_STATIC,28,106,246,44
CONTROL "Debug",IDC_RADIO_Debug,"Button",BS_AUTORADIOBUTTON |
WS_GROUP,35,118,49,12
CONTROL "Release",IDC_RADIO_Release,"Button",BS_AUTORADIOBUTTON,
35,132,49,12
CONTROL "Autodetect errors when executing others programs",
IDC_CHECK_AutoDetectErrors,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,35,177,174,10
GROUPBOX "General options",IDC_STATIC,17,162,269,36
PUSHBUTTON "Make Version",IDC_BUTTON_MakeVersion,124,206,50,14
END
IDD_DIALOG_Levels DIALOGEX 0, 0, 300, 239
STYLE WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
LTEXT "List of levels in game.dsc",IDC_STATIC,14,15,80,8
LISTBOX IDC_LIST_Levels,17,24,141,196,LBS_OWNERDRAWFIXED |
LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL |
WS_VSCROLL | WS_TABSTOP
GROUPBOX "Level selection",IDC_STATIC,166,11,121,56
PUSHBUTTON "Select all",IDC_BUTTON_SelectAll,194,25,66,14
PUSHBUTTON "Clear all",IDC_BUTTON_ClearAll,194,47,66,14
GROUPBOX "Options",IDC_STATIC,165,130,121,45
CONTROL "Auto test map(s) after binarize",IDC_CHECK_AutoTest,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,173,142,109,10
CONTROL "Stop binarize on error",IDC_CHECK_StopOnError,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,173,157,83,10
DEFPUSHBUTTON "Binarize !",IDC_BUTTON_Binarize,193,180,66,14
PUSHBUTTON "Test maps",IDC_BUTTON_TestMaps,193,206,66,14
PUSHBUTTON "Refresh level list",IDC_BUTTON_Refresh,194,108,66,14
PUSHBUTTON "Edit Game.dsc",IDC_BUTTON_EditGameDsc,194,86,66,14
GROUPBOX "Game.dsc",IDC_STATIC,167,73,119,54
END
IDD_DIALOG_AfterBinarization DIALOGEX 0, 0, 300, 236
STYLE WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
GROUPBOX "BigFile for relocation tables",IDC_STATIC,18,20,262,66
EDITTEXT IDC_EDIT_SizeOfBigFile,130,31,40,14,ES_AUTOHSCROLL |
ES_NUMBER
LTEXT "Size of bigfile",IDC_STATIC,49,35,42,8
LTEXT "Mo",IDC_STATIC,174,34,11,8
CONTROL "Delete relocation tables",IDC_CHECK_DeleteRelocTables,
"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,49,
50,90,10
PUSHBUTTON "Generate BigFile",IDC_BUTTON_GenerateBigFile,198,65,64,
14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_DIALOG_BeforeBinarization, DIALOG
BEGIN
RIGHTMARGIN, 291
BOTTOMMARGIN, 226
END
IDD_DIALOG_Results, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 293
TOPMARGIN, 7
BOTTOMMARGIN, 235
END
IDD_DIALOG_Settings, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 293
TOPMARGIN, 7
BOTTOMMARGIN, 232
END
IDD_DIALOG_Levels, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 293
TOPMARGIN, 7
BOTTOMMARGIN, 232
END
IDD_DIALOG_AfterBinarization, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 293
TOPMARGIN, 7
BOTTOMMARGIN, 229
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_BITMAP_CROIX BITMAP DISCARDABLE "croix.bmp"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif\r\n"
"#include ""BinaryTool.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "BinaryTool.ico"
#endif // French (France) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif
#include "BinaryTool.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,13 @@
//
// BINARY TOOL.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,71 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by BinaryTool.rc
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_BINARYTOOL_DIALOG 102
#define IDS_Registry 102
#define IDS_AppTitle 104
#define IDR_MAINFRAME 128
#define IDD_DIALOG_BeforeBinarization 129
#define IDD_DIALOG_Results 130
#define IDD_DIALOG_Settings 131
#define IDD_DIALOG_Levels 132
#define IDB_BITMAP_VIDE 135
#define IDB_BITMAP_CROIX 136
#define IDB_BITMAP_CHECK 138
#define IDB_BITMAP_TRUC 139
#define IDD_DIALOG_AfterBinarization 142
#define IDC_TAB_Panel 1000
#define IDC_GROUPSoundBanks 1001
#define IDC_BUTTON_MakeSoundBanks 1002
#define IDC_GOUPTextures 1003
#define IDC_EDIT_TempTextureDirectory 1005
#define IDC_BUTTON_BrowseTempTextureDirectory 1007
#define IDC_BUTTON_MakeGF 1008
#define IDC_BUTTON_MakeBigFile 1009
#define IDC_RADIO_OptimizedAnims 1010
#define IDC_RADIO_NonOptimizedAnims 1011
#define IDC_BUTTON_MakeA3i 1012
#define IDC_STATIC_TabZone 1013
#define IDC_STATIC_Version 1019
#define IDC_EDIT_Results 1020
#define IDC_BUTTON_CopySound 1021
#define IDC_EDIT_MainDirectory 1022
#define IDC_EDIT_BinaryDirectory 1023
#define IDC_EDIT_ExeName 1024
#define IDC_BUTTON_BrowseMainDirectory 1025
#define ID_BOUTON_Quit 1026
#define IDC_BUTTON_BrowseBinaryDirectory 1027
#define IDC_BUTTON_BrowseExeName 1028
#define IDC_LIST_Levels 1028
#define IDC_BUTTON_SelectAll 1029
#define IDC_BUTTON_AutoIni 1030
#define IDC_BUTTON_Binarize 1031
#define IDC_BUTTON_ClearAll 1032
#define IDC_CHECK_AutoTest 1033
#define IDC_CHECK_StopOnError 1034
#define ID_BUTTON_Stop 1035
#define IDC_RADIO_Debug 1037
#define IDC_RADIO_Release 1038
#define IDC_BUTTON_TestMaps 1039
#define IDC_CHECK_AutoDetectErrors 1040
#define IDC_BUTTON_Refresh 1041
#define IDC_EDIT_SizeOfBigFile 1043
#define IDC_CHECK_DeleteRelocTables 1044
#define IDC_BUTTON_GenerateBigFile 1045
#define IDC_BUTTON_MakeVersion 1046
#define IDC_BUTTON_EditGameDsc 1047
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 143
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1048
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,103 @@
// BinaryTool.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "BinaryTool.h"
#include "BinaryToolDlg.h"
#include "GlobalData.h"
#include "Scripts.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBinaryToolApp
BEGIN_MESSAGE_MAP(CBinaryToolApp, CWinApp)
//{{AFX_MSG_MAP(CBinaryToolApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBinaryToolApp construction
CBinaryToolApp::CBinaryToolApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CBinaryToolApp object
CBinaryToolApp theApp;
struct tdstGlobalData_ g_stTheGlobalData;
/////////////////////////////////////////////////////////////////////////////
// CBinaryToolApp initialization
BOOL CBinaryToolApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Set up base registry key
CString csReg;
csReg.LoadString( IDS_Registry );
SetRegistryKey( csReg );
g_stTheGlobalData.hEventStop = CreateEvent( NULL, TRUE, FALSE, NULL );
g_stTheGlobalData.bCommonFilesAreCopied = FALSE;
// Setup initial directory
GetCurrentDirectory( _MAX_PATH, g_stTheGlobalData.csStartupDirectory.GetBuffer(_MAX_PATH) );
g_stTheGlobalData.csStartupDirectory.ReleaseBuffer();
// If event can't be created, display an error and exit
if( g_stTheGlobalData.hEventStop == NULL )
{
AfxMessageBox( "Can't create event ressource.\nInitialisation failed !", MB_OK | MB_ICONEXCLAMATION );
return FALSE;
}
// Init module scr for script parsing.
fn_vInitScr();
// Display main dialog.
CBinaryToolDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
/*
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
*/
fn_vDesinitScr();
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}

View File

@@ -0,0 +1,419 @@
// BinaryToolDlg.cpp : implementation file
//
#include "stdafx.h"
#include "BinaryTool.h"
#include "BinaryToolDlg.h"
#include "GlobalData.h"
#include "PanelBeforeBin.h"
#include "PanelResults.h"
#include "PanelSettings.h"
#include "PanelLevels.h"
#include "PanelAfter.h"
#include "scripts.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// CBinaryToolDlg Creation and initialisation
CBinaryToolDlg::CBinaryToolDlg(CWnd* pParent /*=NULL*/)
: CDialog(CBinaryToolDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CBinaryToolDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
memset( m_a_pPanels, 0, sizeof(m_a_pPanels) );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CBinaryToolDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBinaryToolDlg)
DDX_Control(pDX, IDC_TAB_Panel, m_TabControl);
//}}AFX_DATA_MAP
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BEGIN_MESSAGE_MAP(CBinaryToolDlg, CDialog)
//{{AFX_MSG_MAP(CBinaryToolDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_Panel, OnSelchangeTabPanel)
ON_BN_CLICKED(ID_BOUTON_Quit, OnQuit)
ON_WM_CLOSE()
ON_BN_CLICKED(ID_BUTTON_Stop, OnStopWorkInProgress)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CBinaryToolDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
m_csDlgTitle.LoadString( IDS_AppTitle );
SetWindowText( m_csDlgTitle );
// Init part of GlobalData struct
g_stTheGlobalData.p_oMainDlg = this;
// Create all panels for tabcontrol :
// Get rectangle for tabcontrol
RECT stPanelRectangle;
TC_ITEM TabCtrlItem;
m_TabControl.GetWindowRect( &stPanelRectangle );
stPanelRectangle.right -= 10;
stPanelRectangle.bottom -= 30;
m_iNumberOfPanels = 0;
m_a_pPanels[m_iNumberOfPanels++] = new CPanelSettings( this );
m_a_pPanels[m_iNumberOfPanels++] = new CPanelBeforeBin( this );
m_a_pPanels[m_iNumberOfPanels++] = new CPanelLevels( this );
m_a_pPanels[m_iNumberOfPanels++] = new CPanelAfter( this );
m_a_pPanels[m_iNumberOfPanels++] = new CPanelResults( this ); // This panel must be the last one
m_iResultPanel = m_iNumberOfPanels - 1;
m_iPanelBeforeStartOfWork = 0;
m_iCurrentPanel = 0;
for( int i=0; i<m_iNumberOfPanels; i++ )
{
// Create the tab panel
m_a_pPanels[i]->Create( this );
m_a_pPanels[i]->MoveWindow( &stPanelRectangle, FALSE );
// Insert it in the tab control
TabCtrlItem.mask = TCIF_TEXT;
TabCtrlItem.pszText = m_a_pPanels[i]->m_szTitle;
m_TabControl.InsertItem( i, &TabCtrlItem );
}
m_a_pPanels[m_iCurrentPanel]->ShowWindow( SW_SHOW );
DragAcceptFiles( TRUE );
if( stristr( GetCommandLine(), "-MakeVersion" ) )
{
m_a_pPanels[0]->PostMessage(
WM_COMMAND,
MAKEWPARAM(IDC_BUTTON_MakeVersion,BN_CLICKED),
(LPARAM)m_a_pPanels[0]->GetDlgItem(IDC_BUTTON_MakeVersion)->m_hWnd );
}
return TRUE; // return TRUE unless you set the focus to a control
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CBinaryToolDlg::~CBinaryToolDlg()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CBinaryToolDlg::DestroyWindow()
{
for( int i=0; i<m_iNumberOfPanels; i++ )
{
if( m_a_pPanels[i] )
{
m_a_pPanels[i]->m_fn_vUpdateRegistry();
m_a_pPanels[i]->DestroyWindow();
delete m_a_pPanels[i];
}
}
return CDialog::DestroyWindow();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// CBinaryToolDlg message handlers
void CBinaryToolDlg::OnOK()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CBinaryToolDlg::OnQuit()
{
CDialog::OnOK();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CBinaryToolDlg::OnClose()
{
CDialog::OnClose();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CBinaryToolDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CBinaryToolDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CBinaryToolDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CBinaryToolDlg::OnSelchangeTabPanel(NMHDR* pNMHDR, LRESULT* pResult)
{
if( m_a_pPanels[m_iCurrentPanel]->m_fn_bCanChangePanel() )
{
int iNextPanel = m_TabControl.GetCurSel();
m_a_pPanels[iNextPanel]->m_fn_vOnDisplayPanel();
m_fn_vSetCurrentPanel( iNextPanel );
}
else
m_TabControl.SetCurSel( m_iCurrentPanel );
*pResult = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// CBinaryToolDlg user methods
// When a new job begin, display the result panel
// and disable all controls
void CBinaryToolDlg::m_fn_vNotifyStartOfWork()
{
m_iPanelBeforeStartOfWork = m_iCurrentPanel;
m_fn_vSetCurrentPanel( m_iResultPanel );
GetDlgItem( IDC_TAB_Panel ) -> EnableWindow( FALSE );
GetDlgItem( ID_BOUTON_Quit ) -> EnableWindow( FALSE );
ResetEvent( g_stTheGlobalData.hEventStop );
g_stTheGlobalData.bStopWork = FALSE;
// Show the button stop.
GetDlgItem( ID_BUTTON_Stop ) -> EnableWindow( TRUE );
GetDlgItem( ID_BUTTON_Stop ) -> ShowWindow( SW_SHOW );
// Change title
TCHAR szTitle[256];
_stprintf( szTitle, "%s - Working...", (LPCTSTR)m_csDlgTitle );
SetWindowText( szTitle );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// When a job is finished, restore control and panel
// (except if caller wish to keep the result panel on, in case of error for example)
void CBinaryToolDlg::m_fn_vNotifyEndOfWork( BOOL _bKeepDisplayResultPanel )
{
if( ! _bKeepDisplayResultPanel )
{
m_fn_vSetCurrentPanel( m_iPanelBeforeStartOfWork );
}
ResetEvent( g_stTheGlobalData.hEventStop );
g_stTheGlobalData.bStopWork = FALSE;
GetDlgItem( IDC_TAB_Panel ) -> EnableWindow( TRUE );
GetDlgItem( ID_BOUTON_Quit ) -> EnableWindow( TRUE );
// Hide the button stop.
GetDlgItem( ID_BUTTON_Stop ) -> ShowWindow( SW_HIDE );
SetWindowText( m_csDlgTitle );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Button stop is pressed : user wants to stop a job in progress.
void CBinaryToolDlg::OnStopWorkInProgress()
{
// Tell to other threads to stop.
SetEvent( g_stTheGlobalData.hEventStop );
g_stTheGlobalData.bStopWork = TRUE;
// Gray the button stop
GetDlgItem( ID_BUTTON_Stop ) -> EnableWindow( FALSE );
// Change title
TCHAR szTitle[256];
_stprintf( szTitle, "%s - Stopping...", (LPCTSTR)m_csDlgTitle );
SetWindowText( szTitle );
}
// The user doesn't want to stop work in progress anymore
void CBinaryToolDlg::m_fn_vCancelStopWorkInProgress()
{
ResetEvent( g_stTheGlobalData.hEventStop );
g_stTheGlobalData.bStopWork = FALSE;
// Enable the button stop
GetDlgItem( ID_BUTTON_Stop ) -> EnableWindow( TRUE );
// Change title
TCHAR szTitle[256];
_stprintf( szTitle, "%s - Working...", (LPCTSTR)m_csDlgTitle );
SetWindowText( szTitle );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CBinaryToolDlg::m_fn_vSetCurrentPanel( int _iNewPanel )
{
if( _iNewPanel != m_iCurrentPanel )
{
m_a_pPanels[m_iCurrentPanel]->ShowWindow( SW_HIDE );
m_iCurrentPanel = _iNewPanel;
m_a_pPanels[m_iCurrentPanel]->ShowWindow( SW_SHOW );
m_TabControl.SetCurSel( _iNewPanel );
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CBinaryToolDlg::m_fn_bRefreshLevelList()
{
// Read game.dsc
BOOL bResult = fn_bReadGameDsc();
// Tell the panels that level list was refreshed
for( int i=0; i<m_iNumberOfPanels; i++ )
{
// Create the tab panel
m_a_pPanels[i]->m_fn_vLevelListHasChanged( ! bResult );
}
return bResult;
}

View File

@@ -0,0 +1,94 @@
// Panel.cpp : implementation file
//
#include "stdafx.h"
#include "binarytool.h"
#include "Panel.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPanel dialog
CPanel::CPanel(UINT nIDTemplate, CWnd* pParent /*=NULL*/)
: CDialog(nIDTemplate, pParent)
{
//{{AFX_DATA_INIT(CPanel)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CPanel::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPanel)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPanel, CDialog)
//{{AFX_MSG_MAP(CPanel)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPanel user methods
// Here are the default behaviour for every panels
// Override these function for custom behaviour
// This function MUST be overridden.
BOOL CPanel::Create( CWnd* pParentWnd )
{
return FALSE;
}
// Called at end of program, to allow a panel to store infos in registry
void CPanel::m_fn_vUpdateRegistry()
{
}
// By default, a panel does nothing when enter is hit.
// Moreover, it should NOT call EndDialog()
void CPanel::OnOk()
{
}
// called when user wants to leave the panel to go to another one.
BOOL CPanel::m_fn_bCanChangePanel()
{
return TRUE;
}
// Called just before the panel is displayed (when user click on it's title)
void CPanel::m_fn_vOnDisplayPanel()
{
}
// To enable/disable all controls of a panel.
void CPanel::m_fn_vEnableAllControls( BOOL bEnable )
{
CWnd *p_Win = GetTopWindow();
while( p_Win )
{
p_Win -> EnableWindow( bEnable );
p_Win = p_Win -> GetNextWindow( GW_HWNDNEXT );
}
}
// Called after game.dsc has been read for list of map.
void CPanel::m_fn_vLevelListHasChanged( BOOL _bErrorWhileReadingGameDsc )
{
_bErrorWhileReadingGameDsc = _bErrorWhileReadingGameDsc;
}

View File

@@ -0,0 +1,267 @@
// PanelBeforeBin.cpp : implementation file
//
#include "stdafx.h"
#include "BinaryTool.h"
#include "PanelBeforeBin.h"
#include "GlobalData.h"
#include "util.h"
#include "file.h"
#include "Process.h"
#include "Threads.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// CPanelBeforeBin creation and initialisation
CPanelBeforeBin::CPanelBeforeBin(CWnd* pParent /*=NULL*/ )
: CPanel(IDD, pParent)
{
//{{AFX_DATA_INIT(CPanelBeforeBin)
//}}AFX_DATA_INIT
_tcscpy( m_szTitle, _T("Preparation") );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelBeforeBin::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPanelBeforeBin)
DDX_Control(pDX, IDC_EDIT_TempTextureDirectory, m_oEditTempDirForTextures);
//}}AFX_DATA_MAP
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BEGIN_MESSAGE_MAP(CPanelBeforeBin, CDialog)
//{{AFX_MSG_MAP(CPanelBeforeBin)
ON_BN_CLICKED(IDC_BUTTON_MakeSoundBanks, OnMakeSoundBanks)
ON_BN_CLICKED(IDC_BUTTON_CopySound, OnCopySound)
ON_BN_CLICKED(IDC_BUTTON_MakeGF, OnMakeGF)
ON_BN_CLICKED(IDC_BUTTON_BrowseTempTextureDirectory, OnBrowseTempTextureDirectory)
ON_BN_CLICKED(IDC_BUTTON_MakeBigFile, OnMakeBigFile)
ON_BN_CLICKED(IDC_BUTTON_MakeA3i, OnMakeA3i)
ON_EN_KILLFOCUS(IDC_EDIT_TempTextureDirectory, OnKillfocusEDITTempTextureDirectory)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CPanelBeforeBin::Create( CWnd* pParentWnd )
{
return CDialog::Create( IDD, pParentWnd );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CPanelBeforeBin::OnInitDialog()
{
CDialog::OnInitDialog();
// Read registry
CWinApp *p_oApp = AfxGetApp();
CString csSection = m_szTitle;
m_oEditTempDirForTextures.SetWindowText( p_oApp -> GetProfileString( csSection, _T("TmpDir"), NULL ) );
m_fn_vValidateTempTextureDirectory();
BOOL bOptimizedAnims = p_oApp -> GetProfileInt( csSection, _T("OptimizedAnims"), 1 );
((CButton *)GetDlgItem( IDC_RADIO_OptimizedAnims ))->SetCheck( bOptimizedAnims );
((CButton *)GetDlgItem( IDC_RADIO_NonOptimizedAnims ))->SetCheck( ! bOptimizedAnims );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// CPanelBeforeBin message handlers
void CPanelBeforeBin::OnMakeSoundBanks()
{
char szSndParserExeName[512];
char szCommandLine[1024];
// Notify main dlg for beginning of work
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyStartOfWork();
fn_vOutputLine( "Making sound banks...\r\n" );
sprintf( szSndParserExeName, "%s\\rm2SndParser.exe", (const char *)g_stTheGlobalData.csStartupDirectory );
fn_vMakeSndParserCommandLine( szCommandLine );
switch( fn_eSpawnAndWaitForProcessWithInputEvents( szSndParserExeName, szCommandLine ) )
{
case STATUS_C_Error:
fn_vOutputLine( "\tBreak on error.\r\n" );
break;
default:
break;
}
fn_vOutputLine( "\r\n" );
// Notify main dlg for end of work
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyEndOfWork( FALSE );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelBeforeBin::OnCopySound()
{
// MSG stMsg;
// Notify main dlg for beginning of work
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyStartOfWork();
fn_eSpawnThreadAndWaitWithInputEvents( fn_uiThreadCopySoundDirectory, NULL );
// Notify main dlg for end of work
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyEndOfWork( FALSE );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelBeforeBin::OnBrowseTempTextureDirectory()
{
CString csTextureDir;
m_oEditTempDirForTextures.GetWindowText( csTextureDir );
CString csNewDir = fn_csBrowseDirectory( "Select temp directory", csTextureDir );
if( ! csNewDir.IsEmpty() )
{
m_oEditTempDirForTextures.SetWindowText( csNewDir );
m_fn_vValidateTempTextureDirectory();
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelBeforeBin::OnMakeGF()
{
BOOL bKeepDisplayResults;
// Notify main dlg for beginning of work
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyStartOfWork();
if( fn_eSpawnThreadAndWaitWithInputEvents( fn_uiThreadMakeGFTextures, NULL ) == STATUS_C_Error )
bKeepDisplayResults = TRUE;
// Notify main dlg for end of work
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyEndOfWork( bKeepDisplayResults );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelBeforeBin::OnMakeBigFile()
{
BOOL bKeepDisplayResults = FALSE;
CString csTextureDir;
// Notify main dlg for beginning of work
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyStartOfWork();
m_oEditTempDirForTextures.GetWindowText( csTextureDir );
if( fn_eSpawnThreadAndWaitWithInputEvents( fn_uiThreadMakeBigFileTextures, (void *)(LPCTSTR)csTextureDir ) == STATUS_C_Error )
bKeepDisplayResults = TRUE;
// Notify main dlg for end of work
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyEndOfWork( bKeepDisplayResults );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelBeforeBin::OnMakeA3i()
{
BOOL bKeepDisplayResults = FALSE;
CString csTextureDir;
// Notify main dlg for beginning of work
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyStartOfWork();
BOOL bOptimizedAnims = ((CButton *)GetDlgItem( IDC_RADIO_OptimizedAnims ))->GetCheck();
if( fn_eSpawnThreadAndWaitWithInputEvents( fn_uiThreadAnims, (LPVOID)&bOptimizedAnims ) == STATUS_C_Error )
bKeepDisplayResults = TRUE;
// Notify main dlg for end of work
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyEndOfWork( bKeepDisplayResults );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelBeforeBin::OnKillfocusEDITTempTextureDirectory()
{
m_fn_vValidateTempTextureDirectory();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// User methods
void CPanelBeforeBin::m_fn_vUpdateRegistry()
{
CWinApp *p_oApp = AfxGetApp();
CString csSection = m_szTitle;
p_oApp -> WriteProfileString( csSection, _T("TmpDir"), g_stTheGlobalData.csTempTextureDirectory );
BOOL bOptimizedAnims = ((CButton *)GetDlgItem( IDC_RADIO_OptimizedAnims ))->GetCheck();
p_oApp -> WriteProfileInt( csSection, _T("OptimizedAnims"), bOptimizedAnims );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelBeforeBin::m_fn_vValidateTempTextureDirectory()
{
CString csTextureDir;
m_oEditTempDirForTextures.GetWindowText( csTextureDir );
if( csTextureDir.Compare( g_stTheGlobalData.csTempTextureDirectory ) == 0 )
return;
// If temp path is not found get the window temp path
if( csTextureDir.IsEmpty() )
{
DWORD dwRes = GetTempPath( _MAX_PATH, csTextureDir.GetBuffer( _MAX_PATH ) );
csTextureDir.ReleaseBuffer();
if( dwRes== 0 )
{
csTextureDir.Empty();
}
}
// Remove trailing '\'
int iLength = csTextureDir.GetLength() - 1;
if( iLength > 0 && csTextureDir[iLength] == '\\' )
csTextureDir.SetAt( iLength, 0 );
g_stTheGlobalData.csTempTextureDirectory = csTextureDir;
m_oEditTempDirForTextures.SetWindowText( csTextureDir );
}

View File

@@ -0,0 +1,447 @@
// PanelLevels.cpp : implementation file
//
#include "stdafx.h"
#include "binarytool.h"
#include "PanelLevels.h"
#include "GlobalData.h"
#include "Scripts.h"
#include "util.h"
#include "Threads.h"
#include "Process.h"
#include "Tasks.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// CPanelLevels dialog
CPanelLevels::CPanelLevels(CWnd* pParent /*=NULL*/)
: CPanel(CPanelLevels::IDD, pParent)
{
//{{AFX_DATA_INIT(CPanelLevels)
//}}AFX_DATA_INIT
_tcscpy( m_szTitle, _T("Binarization") );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelLevels::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPanelLevels)
DDX_Control(pDX, IDC_CHECK_AutoTest, m_CheckAutoTest);
DDX_Control(pDX, IDC_CHECK_StopOnError, m_CheckStopOnError);
DDX_Control(pDX, IDC_LIST_Levels, m_ListLevels);
//}}AFX_DATA_MAP
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BEGIN_MESSAGE_MAP(CPanelLevels, CDialog)
//{{AFX_MSG_MAP(CPanelLevels)
ON_WM_DRAWITEM()
ON_BN_CLICKED(IDC_BUTTON_SelectAll, OnSelectAllLevels)
ON_BN_CLICKED(IDC_BUTTON_ClearAll, OnClearAllLevels)
ON_BN_CLICKED(IDC_BUTTON_Binarize, OnBinarize)
ON_BN_CLICKED(IDC_CHECK_AutoTest, OnCHECKAutoTest)
ON_BN_CLICKED(IDC_BUTTON_TestMaps, OnTestMaps)
ON_BN_CLICKED(IDC_BUTTON_Refresh, OnBUTTONRefreshLevelList)
ON_BN_CLICKED(IDC_CHECK_StopOnError, OnCHECKStopOnError)
ON_BN_CLICKED(IDC_BUTTON_EditGameDsc, OnBUTTONEditGameDsc)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CPanelLevels::Create( CWnd* pParentWnd )
{
BOOL bResult = CDialog::Create( IDD, pParentWnd );
if( bResult )
{
// Init bitmap
m_oCrossDC.CreateCompatibleDC( NULL );
m_oCrossBitmap.LoadBitmap( IDB_BITMAP_CHECK );
m_oEmptyBoxBitmap.LoadBitmap( IDB_BITMAP_VIDE );
// Read registry, update controls
CWinApp *p_oApp = AfxGetApp();
CString csSection = m_szTitle;
m_CheckAutoTest.SetCheck( p_oApp -> GetProfileInt( csSection, _T("AutoTest"), 0 ) );
g_stTheGlobalData.bAutoTestMaps = m_CheckAutoTest.GetCheck();
m_CheckStopOnError.SetCheck( p_oApp -> GetProfileInt( csSection, _T("StopOnError"), 1 ) );
OnCHECKStopOnError();
}
return bResult;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelLevels::m_fn_vUpdateRegistry()
{
CWinApp *p_oApp = AfxGetApp();
CString csSection = m_szTitle;
p_oApp -> WriteProfileInt( csSection, _T("AutoTest"), m_CheckAutoTest.GetCheck() );
p_oApp -> WriteProfileInt( csSection, _T("StopOnError"), m_CheckStopOnError.GetCheck() );
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// CPanelLevels message handlers
void CPanelLevels::OnOk()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CPanelLevels::PreTranslateMessage(MSG* pMsg)
{
if( pMsg->hwnd == m_ListLevels.m_hWnd )
{
switch ( pMsg->message )
{
case WM_LBUTTONDOWN:
if( m_fn_bOnLButtonDownListBoxLevels( pMsg ) ) return TRUE;
break;
case WM_KEYDOWN:
if( m_fn_bOnKeyDownListBoxLevels( pMsg ) ) return TRUE;
break;
default:
break;
}
}
if( pMsg->message == WM_KEYDOWN && (int)pMsg -> wParam == VK_RETURN )
{
OnBinarize();
return TRUE;
}
return CDialog::PreTranslateMessage(pMsg);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelLevels::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if( nIDCtl == IDC_LIST_Levels )
m_fn_vOnDrawItemListBoxLevels( lpDrawItemStruct );
else
CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelLevels::OnSelectAllLevels()
{
int iNb = m_ListLevels.GetCount();
for( int i=0; i<iNb; i++ )
{
g_stTheGlobalData.a_cLevelsSelectedForBinarization.SetAt( i, 1 );
}
m_ListLevels.Invalidate( FALSE );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelLevels::OnClearAllLevels()
{
int iNb = m_ListLevels.GetCount();
for( int i=0; i<iNb; i++ )
{
g_stTheGlobalData.a_cLevelsSelectedForBinarization.SetAt( i, 0 );
}
m_ListLevels.Invalidate( FALSE );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelLevels::OnBinarize()
{
// Count the number of selected levels
BOOL bAtLeastOneLevel = FALSE;
int iNb = m_ListLevels.GetCount();
for( int i=0; i<iNb; i++ )
{
if( g_stTheGlobalData.a_cLevelsSelectedForBinarization[i] )
{
bAtLeastOneLevel = TRUE;
break;
}
}
if( bAtLeastOneLevel )
{
// Display result panel, button stop, etc...
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyStartOfWork();
// Start binarization
if( fn_e_TASK_Binarize( g_stTheGlobalData.a_cLevelsSelectedForBinarization ) == STATUS_C_OK )
// Then, if we must test the maps, test them.
if( g_stTheGlobalData.bAutoTestMaps )
{
fn_e_TASK_TestBinarizedMaps( g_stTheGlobalData.a_cBinarizedLevels );
}
// For binarization of levels, always keep the result screen displayed.
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyEndOfWork( TRUE );
}
else
{
AfxMessageBox( "Please select at least one level to binarize.", MB_OK | MB_ICONSTOP );
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// CPanelLevels user methods
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelLevels::m_fn_vLevelListHasChanged( BOOL _bErrorWhileReadingGameDsc )
{
m_ListLevels.ResetContent();
if( ! _bErrorWhileReadingGameDsc )
{
int iSize = g_stTheGlobalData.a_csLevelNames.GetSize();
for( int i=0; i<iSize; i++ )
{
m_ListLevels.AddString( g_stTheGlobalData.a_csLevelNames[i] );
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CPanelLevels::m_fn_bOnKeyDownListBoxLevels( MSG *pMsg )
{
return FALSE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CPanelLevels::m_fn_bOnLButtonDownListBoxLevels( MSG *pMsg )
{
POINT xPos;
CRect oRect;
BOOL bOutside;
int iIndex;
CUIntArray oSelectedItems;
UINT uiNbSelectedItems;
BOOL bSelect;
// Get the x and y coordinates
xPos.x = LOWORD( pMsg->lParam );
xPos.y = HIWORD( pMsg->lParam );
// Determine the object under the cursor in front of which the user clicked
iIndex = m_ListLevels.ItemFromPoint( xPos, bOutside );
if( bOutside )
return FALSE;
m_ListLevels.GetItemRect ( iIndex , &oRect );
if( (oRect.PtInRect( xPos )) && (xPos.x < 16) )
{
oSelectedItems.SetSize( m_ListLevels.GetCount() );
// Get list of selected items
uiNbSelectedItems = m_ListLevels.GetSelItems( m_ListLevels.GetCount(), (int *)oSelectedItems.GetData() );
// Determine if we must select or deselect the items.
bSelect = ( g_stTheGlobalData.a_cLevelsSelectedForBinarization.GetAt( iIndex ) == 0);
BOOL bClickedItemIsSelected = FALSE;
for( UINT i=0; i<uiNbSelectedItems; i++ )
if( oSelectedItems[i] == (BYTE)iIndex )
{
bClickedItemIsSelected = TRUE;
break;
}
if( bClickedItemIsSelected )
{
// Select or deselect the items.
// Note: the cross in front of the item will be drawn by OnDrawItem
for( UINT i=0; i<uiNbSelectedItems; i++ )
{
g_stTheGlobalData.a_cLevelsSelectedForBinarization.SetAt( oSelectedItems.GetAt(i), (BYTE)bSelect );
}
}
else
{
g_stTheGlobalData.a_cLevelsSelectedForBinarization.SetAt( iIndex, (BYTE)bSelect );
}
m_ListLevels.Invalidate( FALSE );
return TRUE;
}
return FALSE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelLevels::m_fn_vOnDrawItemListBoxLevels( LPDRAWITEMSTRUCT lpDIS )
{
CDC *pDC = CDC::FromHandle( lpDIS->hDC );
BOOL bSelected = (lpDIS->itemState & ODS_SELECTED );
CString csItem;
pDC->FillSolidRect( &lpDIS->rcItem, GetSysColor( COLOR_WINDOW ));
if( lpDIS->itemID < (UINT)m_ListLevels.GetCount() )
{
m_ListLevels.GetText( lpDIS->itemID, csItem );
// if item is selected, draw a cross, else draw an empty box
if( g_stTheGlobalData.a_cLevelsSelectedForBinarization[lpDIS->itemID] )
m_oCrossDC.SelectObject( m_oCrossBitmap );
else
m_oCrossDC.SelectObject( m_oEmptyBoxBitmap );
pDC->BitBlt( lpDIS->rcItem.left + 2, lpDIS->rcItem.top + 1, 12, 12, &m_oCrossDC, 0, 0, SRCAND );
pDC->SetBkMode( TRANSPARENT);
pDC->SetTextColor( GetSysColor( COLOR_WINDOWTEXT ) );
lpDIS->rcItem.left += 16;
pDC->DrawText( csItem, &lpDIS->rcItem, DT_SINGLELINE | DT_LEFT | DT_VCENTER );
// Invert item if selected
if (bSelected)
{
lpDIS->rcItem.left -= 1;
pDC->InvertRect( &lpDIS->rcItem );
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelLevels::OnCHECKAutoTest()
{
g_stTheGlobalData.bAutoTestMaps = m_CheckAutoTest.GetCheck();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelLevels::OnCHECKStopOnError()
{
g_stTheGlobalData.bStopBinarizeOnError = m_CheckStopOnError.GetCheck();
// If user wants the binarization to continue on error, we need to detect errors !
if( ! g_stTheGlobalData.bStopBinarizeOnError )
{
g_stTheGlobalData.bAutoDetectErrors = TRUE;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelLevels::OnBUTTONRefreshLevelList()
{
g_stTheGlobalData.p_oMainDlg -> m_fn_bRefreshLevelList();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelLevels::OnTestMaps()
{
BOOL bAtLeastOneLevel = FALSE;
int iNb = m_ListLevels.GetCount();
for( int i=0; i<iNb; i++ )
{
if( g_stTheGlobalData.a_cLevelsSelectedForBinarization[i] )
{
bAtLeastOneLevel = TRUE;
break;
}
}
if( bAtLeastOneLevel )
{
// Display result panel, button stop, etc...
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyStartOfWork();
// Start test
fn_e_TASK_TestBinarizedMaps( g_stTheGlobalData.a_cLevelsSelectedForBinarization );
// For test on levels, always keep the result screen displayed.
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyEndOfWork( TRUE );
}
else
{
AfxMessageBox( "Please select at least one level to test.", MB_OK | MB_ICONSTOP );
}
}
void CPanelLevels::OnBUTTONEditGameDsc()
{
PROCESS_INFORMATION stProcess;
char szExeName[512], szCommandLine[512];
UINT uiLength;
uiLength = GetSystemDirectory( szExeName, 512 );
if( uiLength == 0 )
{
AfxMessageBox( "Can't get system directory !!.", MB_OK | MB_ICONSTOP );
return;
}
if( szExeName[uiLength-1] != '\\' )
{
szExeName[uiLength++] = '\\';
szExeName[uiLength++] = 0;
}
strcpy( &szExeName[uiLength-1], "notepad.exe" );
sprintf( szCommandLine, "notepad.exe %s\\Gamedata\\Game.dsc", (LPCTSTR)g_stTheGlobalData.csMainDirectory );
fn_bSpawnProcess( szExeName, szCommandLine, &stProcess );
fn_vCloseProcessHandles( &stProcess );
}

View File

@@ -0,0 +1,67 @@
// PanelResults.cpp : implementation file
//
#include "stdafx.h"
#include "binarytool.h"
#include "PanelResults.h"
#include "GlobalData.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// CPanelResults creation and initialisation
CPanelResults::CPanelResults(CWnd* pParent /*=NULL*/)
: CPanel(CPanelResults::IDD, pParent)
{
//{{AFX_DATA_INIT(CPanelResults)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
_tcscpy( m_szTitle, _T("Results") );
}
void CPanelResults::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPanelResults)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPanelResults, CDialog)
//{{AFX_MSG_MAP(CPanelResults)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CPanelResults::Create( CWnd* pParentWnd )
{
BOOL bResult = CDialog::Create( IDD, pParentWnd );
if( bResult )
g_stTheGlobalData.p_oEditResults = (CEdit *)GetDlgItem( IDC_EDIT_Results );
return bResult;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// CPanelResults message handlers
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// CPanelResults user methods
void CPanelResults::m_fn_vUpdateRegistry()
{
}

View File

@@ -0,0 +1,316 @@
// PanelSettings.cpp : implementation file
//
#include "stdafx.h"
#include <io.h>
#include "binarytool.h"
#include "PanelSettings.h"
#include "GlobalData.h"
#include "util.h"
#include "file.h"
#include "Tasks.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// CPanelSettings creation and initialisation
CPanelSettings::CPanelSettings(CWnd* pParent /*=NULL*/)
: CPanel(CPanelSettings::IDD, pParent)
{
//{{AFX_DATA_INIT(CPanelSettings)
//}}AFX_DATA_INIT
_tcscpy( m_szTitle, _T("Settings") );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelSettings::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPanelSettings)
DDX_Control(pDX, IDC_CHECK_AutoDetectErrors, m_CheckAutoDetectErrors);
DDX_Control(pDX, IDC_EDIT_MainDirectory, m_EditMainDirectory);
DDX_Control(pDX, IDC_EDIT_BinaryDirectory, m_EditBinDirectory);
DDX_Control(pDX, IDC_EDIT_ExeName, m_EditExeName);
//}}AFX_DATA_MAP
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BEGIN_MESSAGE_MAP(CPanelSettings, CDialog)
//{{AFX_MSG_MAP(CPanelSettings)
ON_BN_CLICKED(IDC_BUTTON_BrowseMainDirectory, OnBrowseMainDirectory)
ON_BN_CLICKED(IDC_BUTTON_BrowseBinaryDirectory, OnBrowseBinaryDirectory)
ON_BN_CLICKED(IDC_BUTTON_BrowseExeName, OnBrowseExeName)
ON_EN_CHANGE(IDC_EDIT_MainDirectory, OnChangeMainDirectory)
ON_EN_CHANGE(IDC_EDIT_BinaryDirectory, OnChangeBinaryDirectory)
ON_EN_CHANGE(IDC_EDIT_ExeName, OnChangeExeName)
ON_BN_CLICKED(IDC_RADIO_Release, OnRADIODebugOrRelease)
ON_WM_DROPFILES()
ON_BN_CLICKED(IDC_CHECK_AutoDetectErrors, OnCHECKAutoDetectErrors)
ON_BN_CLICKED(IDC_RADIO_Debug, OnRADIODebugOrRelease)
ON_BN_CLICKED(IDC_BUTTON_MakeVersion, OnBUTTONMakeVersion)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CPanelSettings::Create( CWnd* pParentWnd )
{
BOOL bResult = CDialog::Create( IDD, pParentWnd );
if( bResult )
{
CWinApp *p_oApp = AfxGetApp();
CString csSection = m_szTitle;
// Read registry, update global data and controls
m_CheckAutoDetectErrors.SetCheck( p_oApp -> GetProfileInt( csSection, _T("AutoDetectErrors"), 1 ) );
g_stTheGlobalData.bAutoDetectErrors = m_CheckAutoDetectErrors.GetCheck();
g_stTheGlobalData.bDebugVersion = p_oApp -> GetProfileInt( csSection, _T("Version"), (int)FALSE );
((CButton *)GetDlgItem( IDC_RADIO_Debug ))->SetCheck( g_stTheGlobalData.bDebugVersion );
((CButton *)GetDlgItem( IDC_RADIO_Release ))->SetCheck( ! g_stTheGlobalData.bDebugVersion );
g_stTheGlobalData.csMainDirectory = p_oApp -> GetProfileString( csSection, _T("MainDirectory"), NULL );
g_stTheGlobalData.csBinDirectory = p_oApp -> GetProfileString( csSection, _T("BinDirectory"), NULL );
g_stTheGlobalData.csExecutableNames.SetSize(2);
g_stTheGlobalData.csExecutableNames[0] = p_oApp -> GetProfileString( csSection, _T("ExeRelease"), NULL );
g_stTheGlobalData.csExecutableNames[1] = p_oApp -> GetProfileString( csSection, _T("ExeDebug"), NULL );
if( g_stTheGlobalData.csExecutableNames[0].IsEmpty() )
g_stTheGlobalData.csExecutableNames[0] = "MainWinR.exe";
if( g_stTheGlobalData.csExecutableNames[1].IsEmpty() )
g_stTheGlobalData.csExecutableNames[1] = "MainWinD.exe";
g_stTheGlobalData.csExeName = g_stTheGlobalData.bDebugVersion ? g_stTheGlobalData.csExecutableNames[1] : g_stTheGlobalData.csExecutableNames[0];
m_EditExeName.SetWindowText( g_stTheGlobalData.csExeName );
m_EditMainDirectory.SetWindowText( g_stTheGlobalData.csMainDirectory );
m_EditBinDirectory.SetWindowText( g_stTheGlobalData.csBinDirectory );
m_bMainDirectoryIsValid = FALSE;
m_bBinDirectoryIsValid = FALSE;
m_bGameExeIsValid = FALSE;
DragAcceptFiles( TRUE );
}
return bResult;
}
void CPanelSettings::m_fn_vUpdateRegistry()
{
CWinApp *p_oApp = AfxGetApp();
CString csSection = m_szTitle;
p_oApp -> WriteProfileInt( csSection, _T("AutoDetectErrors"), g_stTheGlobalData.bAutoDetectErrors );
p_oApp -> WriteProfileInt( csSection, _T("Version"), g_stTheGlobalData.bDebugVersion );
p_oApp -> WriteProfileString( csSection, _T("MainDirectory"), g_stTheGlobalData.csMainDirectory );
p_oApp -> WriteProfileString( csSection, _T("BinDirectory"), g_stTheGlobalData.csBinDirectory );
p_oApp -> WriteProfileString( csSection, _T("ExeRelease"), g_stTheGlobalData.csExecutableNames[0] );
p_oApp -> WriteProfileString( csSection, _T("ExeDebug"), g_stTheGlobalData.csExecutableNames[1] );
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// CPanelSettings message handlers
void CPanelSettings::OnBrowseMainDirectory()
{
CString csNewDir = fn_csBrowseDirectory( "Select main directory", g_stTheGlobalData.csMainDirectory );
if( ! csNewDir.IsEmpty() )
{
g_stTheGlobalData.csMainDirectory = csNewDir;
m_EditMainDirectory.SetWindowText( csNewDir );
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelSettings::OnBrowseBinaryDirectory()
{
CString csNewDir = fn_csBrowseDirectory( "Select binary directory", g_stTheGlobalData.csBinDirectory );
if( ! csNewDir.IsEmpty() )
{
g_stTheGlobalData.csBinDirectory = csNewDir;
m_EditBinDirectory.SetWindowText( csNewDir );
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelSettings::OnBrowseExeName()
{
CString csBaseDir;
CFileDialog *p_oFileDlg =
new CFileDialog(
TRUE, NULL, "MainWinR.exe",
OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_LONGNAMES|OFN_EXPLORER|OFN_HIDEREADONLY,
"Exe files (*.exe)|*.exe|All files|*||", NULL );
m_EditMainDirectory.GetWindowText( csBaseDir );
if( ! csBaseDir.IsEmpty() && _access( csBaseDir, 04 ) != -1 )
{
p_oFileDlg->m_ofn.lpstrInitialDir = csBaseDir;
}
if( p_oFileDlg->DoModal() == IDOK )
{
g_stTheGlobalData.csExeName = p_oFileDlg->GetFileName();
m_EditExeName.SetWindowText( p_oFileDlg->GetFileName() );
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelSettings::OnChangeMainDirectory()
{
m_bMainDirectoryIsValid = FALSE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelSettings::OnChangeBinaryDirectory()
{
m_bBinDirectoryIsValid = FALSE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelSettings::OnChangeExeName()
{
m_bGameExeIsValid = FALSE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelSettings::OnRADIODebugOrRelease()
{
if( g_stTheGlobalData.bDebugVersion )
m_EditExeName.GetWindowText( g_stTheGlobalData.csExecutableNames[1] );
else
m_EditExeName.GetWindowText( g_stTheGlobalData.csExecutableNames[0] );
g_stTheGlobalData.bDebugVersion = ((CButton *)GetDlgItem( IDC_RADIO_Debug ))->GetCheck();
if( g_stTheGlobalData.bDebugVersion )
m_EditExeName.SetWindowText( g_stTheGlobalData.csExecutableNames[1] );
else
m_EditExeName.SetWindowText( g_stTheGlobalData.csExecutableNames[0] );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// user drag and drop file(s) on dialog...
void CPanelSettings::OnDropFiles(HDROP hDropInfo)
{
char szFile[256];
// get first dropped file
DragQueryFile( hDropInfo, 0, szFile, 256 );
// If file is not a directory => set exe
if( ! (GetFileAttributes( szFile ) & FILE_ATTRIBUTE_DIRECTORY) )
{
m_EditExeName.SetWindowText( szFile );
return;
}
// Else
CDialog::OnDropFiles(hDropInfo);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelSettings::OnCHECKAutoDetectErrors()
{
g_stTheGlobalData.bAutoDetectErrors = m_CheckAutoDetectErrors.GetCheck();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// CPanelSettings user methods
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// When user wants to go to another panel, we make sure all settings are valid.
BOOL CPanelSettings::m_fn_bCanChangePanel()
{
if( ! m_bMainDirectoryIsValid )
{
m_EditMainDirectory.GetWindowText( g_stTheGlobalData.csMainDirectory );
if( ! (m_bMainDirectoryIsValid = fn_bValidateMainDirectorySetting()) )
return FALSE;
}
if( ! m_bBinDirectoryIsValid )
{
m_EditBinDirectory.GetWindowText( g_stTheGlobalData.csBinDirectory );
if( ! (m_bBinDirectoryIsValid = fn_bValidateBinDirectorySetting()) )
return FALSE;
}
if( ! m_bGameExeIsValid )
{
m_EditExeName.GetWindowText( g_stTheGlobalData.csExeName );
if( ! (m_bGameExeIsValid = fn_bValidateGameExeSetting()) )
return FALSE;
}
return TRUE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// When displaying panel, we update the state of error autodetection
// because it can be changed from another panel.
void CPanelSettings::m_fn_vOnDisplayPanel()
{
m_CheckAutoDetectErrors.SetCheck( g_stTheGlobalData.bAutoDetectErrors );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Here, the user wants binarytool to make the whole version by itself
// (what a lasy user !)
// We launch rm2sndparser, textures and binarisation....
void CPanelSettings::OnBUTTONMakeVersion()
{
// Notify main dlg for beginning of work
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyStartOfWork();
// Do all the work
fn_e_TASK_Version();
// Empty the map list => it will be filled when displaying panel levels.
g_stTheGlobalData.a_csLevelNames.SetSize( 0 );
// End of work ! We keep the result screen displayed.
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyEndOfWork( TRUE );
}

View File

@@ -0,0 +1,710 @@
#include "stdafx.h"
#include "GlobalData.h"
#include "Process.h"
#include "util.h"
#define C_szUserBreakString "\tUser break.\r\n"
#define C_lTimeIntervalForErrorChecking 2000
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Launch a new process using CreateProcess and return immediatly
// _szExeName contains the name of the executable with FULL PATH.
// Note: _szCommandLine can be NULL.
// return TRUE if process was created normally or FALSE if not.
// Also fill _p_Info with process informations (handle...)
// Display a dialog box to the user in case of error on CreateProcess.
BOOL fn_bSpawnProcess( char *_szExeName, char *_szCommandLine, LPPROCESS_INFORMATION _p_Info )
{
STARTUPINFO stWinInfo;
char szDirectory[512];
CString csMessage;
int iPathLength;
// Spawn process
GetStartupInfo( &stWinInfo );
// Get path of executable
iPathLength = strrchr( _szExeName, '\\' ) - _szExeName;
strncpy( szDirectory, _szExeName, iPathLength );
szDirectory[iPathLength] = 0;
// Create process.
if( ! CreateProcess( _szExeName, _szCommandLine, NULL, NULL, FALSE, 0, NULL, szDirectory, &stWinInfo, _p_Info ) )
{
csMessage = _T("Can't execute '");
csMessage += _szExeName;
csMessage += _T("' !\nMake sure path is correct and executable does exist.");
AfxMessageBox( csMessage, MB_OK | MB_ICONSTOP );
ZeroMemory( _p_Info, sizeof(_p_Info) );
return FALSE;
}
return TRUE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void fn_vCloseProcessHandles( LPPROCESS_INFORMATION _p_stProcess )
{
if( _p_stProcess->hProcess )
CloseHandle( _p_stProcess->hProcess );
if( _p_stProcess->hThread )
CloseHandle( _p_stProcess->hThread );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tdeStatus fn_eSpawnAndWaitForProcess( char *_szExeName, char *_szCommandLine, HANDLE _hEventStop /*= INVALID_HANDLE_VALUE*/ )
{
HANDLE a_hObjectsToWaitFor[2];
int iNbObjectsToWaitFor;
DWORD dwWaitReturn, dwExitCode;
char szMessage[1024];
PROCESS_INFORMATION stProcess;
char szShortExeName[128];
fn_vGetShortExeName( szShortExeName, _szExeName );
// spawn process
if( ! fn_bSpawnProcess( _szExeName, _szCommandLine, &stProcess ) )
{
sprintf( szMessage, "\tError launching %s\r\n", _szExeName );
fn_vOutputLine( szMessage );
fn_vCloseProcessHandles( &stProcess );
return STATUS_C_Error;
}
// Prepare to wait for end of process
iNbObjectsToWaitFor = 0;
a_hObjectsToWaitFor[iNbObjectsToWaitFor++] = stProcess.hProcess;
// Test if we must wait for abort event too.
if( _hEventStop != INVALID_HANDLE_VALUE )
a_hObjectsToWaitFor[iNbObjectsToWaitFor++] = _hEventStop;
do
{
// Wait for process or abort
dwWaitReturn = WaitForMultipleObjects( iNbObjectsToWaitFor, a_hObjectsToWaitFor, FALSE, C_lTimeIntervalForErrorChecking );
// Test if user wants to stop (=abort)
if( iNbObjectsToWaitFor > 1 && (dwWaitReturn == WAIT_OBJECT_0+1 || dwWaitReturn == WAIT_ABANDONED_0+1) )
{
// Ask for confirmation
sprintf( szMessage, "Are you sure you want to terminate '%s' ?", _szExeName );
if( AfxMessageBox( szMessage, MB_YESNO | MB_ICONQUESTION ) == IDYES )
{
// Abort is confirmed, we kill the process
PostThreadMessage( stProcess.dwThreadId, WM_QUIT, 0, NULL );
dwWaitReturn = WaitForSingleObject( stProcess.hProcess, 3500 );
if( dwWaitReturn == WAIT_TIMEOUT )
TerminateProcess( stProcess.hProcess, 199 );
// We exit if process was killed
fn_vCloseProcessHandles( &stProcess );
fn_vOutputLine( C_szUserBreakString );
fn_bCloseSytemErrorDialogBox( szShortExeName, TRUE );
return STATUS_C_UserBreak;
}
else
g_stTheGlobalData.p_oMainDlg -> m_fn_vCancelStopWorkInProgress();
// User does not want to stop anymore, we go for another wait.
ResetEvent( _hEventStop );
}
else if( dwWaitReturn == WAIT_OBJECT_0 || dwWaitReturn == WAIT_ABANDONED_0 )
{
GetExitCodeProcess( stProcess.hProcess, &dwExitCode );
if( dwExitCode != 0 )
{
sprintf( szMessage, "\t'%s' has exited with error code %i\r\n", _szExeName, dwExitCode );
fn_vOutputLine( szMessage );
fn_vCloseProcessHandles( &stProcess );
return STATUS_C_Error;
}
// Process has exited normally. We exit the wait loop.
break;
}
else if( dwWaitReturn == WAIT_TIMEOUT )
{
// Here, the time has come to check if an error occured.
// We try to find and close any system error dialog box related with the exe
if( fn_bCloseSytemErrorDialogBox( szShortExeName ) )
{
// if we found one of these boxes, we kill the process and exit.
TerminateProcess( stProcess.hProcess, 199 );
fn_vCloseProcessHandles( &stProcess );
sprintf( szMessage, "\tError detected with '%s'\r\n", _szExeName );
fn_vOutputLine( szMessage );
return STATUS_C_Error;
}
// We found nothing... We go for another wait.
}
else
{
// Error.
fn_vOutputLine( "\r\n\tInternal error: Error on WaitForMultipleObjects !!!\r\n" );
fn_vCloseProcessHandles( &stProcess );
return STATUS_C_Error;
}
} while( 1 );
fn_vCloseProcessHandles( &stProcess );
// we deal we an enventual dialog box (saying "access violation" or whatever)
if( fn_bCloseSytemErrorDialogBox( szShortExeName ) )
{
// If there was an error dialog box, we return an error.
sprintf( szMessage, "\tError detected with '%s'\r\n", _szExeName );
fn_vOutputLine( szMessage );
return STATUS_C_Error;
}
return STATUS_C_OK;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tdeStatus fn_eWaitForMultipleProcesses( int _iNbProcesses, LPPROCESS_INFORMATION _pa_stInfo, LPCTSTR _szExeNames[], int *_p_iProcessesEnded )
{
HANDLE a_hObjectsToWaitFor[64];
int i;
DWORD dwWaitReturn, dwExitCode;
char szMessage[1024];
// Prepare to wait for end of process
for( i=0; i<_iNbProcesses; i ++ )
{
a_hObjectsToWaitFor[i] = _pa_stInfo[i].hProcess;
}
// we must also wait for abort event.
a_hObjectsToWaitFor[_iNbProcesses] = g_stTheGlobalData.hEventStop;
// Wait for the end of one process or abort
dwWaitReturn = WaitForMultipleObjects( _iNbProcesses+1, a_hObjectsToWaitFor, FALSE, INFINITE );
// Test if user wants to stop (=abort)
if( dwWaitReturn == WAIT_OBJECT_0+_iNbProcesses || dwWaitReturn == WAIT_ABANDONED_0+_iNbProcesses )
{
// Abort is confirmed, we kill the process
for( i=0; i<_iNbProcesses; i ++ )
{
PostThreadMessage( _pa_stInfo[i].dwThreadId, WM_QUIT, 0, NULL );
}
dwWaitReturn = WaitForMultipleObjects( _iNbProcesses, a_hObjectsToWaitFor, TRUE, 3500 );
if( dwWaitReturn == WAIT_TIMEOUT )
{
for( i=0; i<_iNbProcesses; i ++ )
TerminateProcess( _pa_stInfo[i].hProcess, 199 );
}
// We exit if processes were killed
for( i=0; i<_iNbProcesses; i ++ )
fn_vCloseProcessHandles( &_pa_stInfo[i] );
fn_vOutputLine( C_szUserBreakString );
return STATUS_C_UserBreak;
}
else
{
for( i=0; i<_iNbProcesses; i ++ )
{
if( dwWaitReturn == WAIT_OBJECT_0+i )
{
// Mark witch process has exited.
*_p_iProcessesEnded = i;
GetExitCodeProcess( _pa_stInfo[i].hProcess, &dwExitCode );
fn_vCloseProcessHandles( &_pa_stInfo[i] );
if( dwExitCode != 0 )
{
sprintf( szMessage, "\t'%s' has exited with error code %i\r\n", _szExeNames[i], dwExitCode );
fn_vOutputLine( szMessage );
return STATUS_C_Error;
}
break;
}
}
if( i == _iNbProcesses )
{
// Error.
fn_vOutputLine( "\r\n\tInternal error: Error on WaitForMultipleObjects !!!\r\n" );
for( i=0; i<_iNbProcesses; i ++ )
fn_vCloseProcessHandles( &_pa_stInfo[i] );
return STATUS_C_Error;
}
}
return STATUS_C_OK;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tdeStatus fn_eSpawnAndWaitForProcessWithTimeout( char *_szExeName, char *_szCommandLine, DWORD _dwMilliseconds /*=INFINITE*/ )
{
HANDLE a_hObjectsToWaitFor[2];
DWORD dwWaitReturn, dwExitCode;
char szMessage[1024];
PROCESS_INFORMATION stProcess;
DWORD dwStartTime = GetTickCount();
DWORD dwElapsedTime = 0;
char szShortExeName[128];
fn_vGetShortExeName( szShortExeName, _szExeName );
// spawn process
if( ! fn_bSpawnProcess( _szExeName, _szCommandLine, &stProcess ) )
{
sprintf( szMessage, "\tError launching %s\r\n", _szExeName );
fn_vOutputLine( szMessage );
fn_vCloseProcessHandles( &stProcess );
return STATUS_C_Error;
}
// Prepare to wait for end of process
a_hObjectsToWaitFor[0] = stProcess.hProcess;
a_hObjectsToWaitFor[1] = g_stTheGlobalData.hEventStop;
do
{
// Wait for process, abort or timeout
// We wait for 1500 millisecond, then we check for a system error dialog box.
dwWaitReturn = WaitForMultipleObjects( 2, a_hObjectsToWaitFor, FALSE, C_lTimeIntervalForErrorChecking );
dwElapsedTime = GetTickCount() - dwStartTime;
// If total time is greater than user timeout, we kill the process
if( dwElapsedTime >= _dwMilliseconds )
{
fn_vOutputLine( "\t*** Timeout! Killing process...***\r\n" );
PostThreadMessage( stProcess.dwThreadId, WM_QUIT, 0, NULL );
dwWaitReturn = WaitForSingleObject( stProcess.hProcess, 1500 );
if( dwWaitReturn == WAIT_TIMEOUT )
TerminateProcess( stProcess.hProcess, 199 );
fn_vCloseProcessHandles( &stProcess );
// Ok, now we deal we an enventual dialog box (saying "acces violation" or whatever)
fn_bCloseSytemErrorDialogBox( szShortExeName, TRUE );
// We exit
return STATUS_C_Error;
}
// Test if user wants to stop (=abort)
if( dwWaitReturn == WAIT_OBJECT_0+1 || dwWaitReturn == WAIT_ABANDONED_0+1 )
{
// Ask for confirmation
sprintf( szMessage, "Are you sure you want to terminate '%s' ?", _szExeName );
if( AfxMessageBox( szMessage, MB_YESNO | MB_ICONQUESTION ) == IDYES )
{
// Abort is confirmed, we kill the process
PostThreadMessage( stProcess.dwThreadId, WM_QUIT, 0, NULL );
dwWaitReturn = WaitForSingleObject( stProcess.hProcess, 3500 );
if( dwWaitReturn == WAIT_TIMEOUT )
TerminateProcess( stProcess.hProcess, 199 );
// We exit if process was killed
fn_vCloseProcessHandles( &stProcess );
fn_vOutputLine( C_szUserBreakString );
// we deal we an enventual dialog box (saying "acces violation" or whatever)
fn_bCloseSytemErrorDialogBox( szShortExeName, TRUE );
return STATUS_C_UserBreak;
}
else
g_stTheGlobalData.p_oMainDlg -> m_fn_vCancelStopWorkInProgress();
// User does not want to stop anymore, we go for another wait.
ResetEvent( g_stTheGlobalData.hEventStop );
}
else if( dwWaitReturn == WAIT_OBJECT_0 || dwWaitReturn == WAIT_ABANDONED_0 )
{
GetExitCodeProcess( stProcess.hProcess, &dwExitCode );
if( dwExitCode != 0 )
{
sprintf( szMessage, "\t'%s' has exited with error code %i\r\n", _szExeName, dwExitCode );
fn_vOutputLine( szMessage );
fn_vCloseProcessHandles( &stProcess );
// we deal we an enventual dialog box (saying "acces violation" or whatever)
fn_bCloseSytemErrorDialogBox( szShortExeName );
return STATUS_C_Error;
}
// Process has exited normally. We exit the wait loop.
break;
}
else if( dwWaitReturn == WAIT_TIMEOUT )
{
// Here, the time has come to check if an error occured.
// We try to find and close any system error dialog box related with the exe
if( fn_bCloseSytemErrorDialogBox( szShortExeName ) )
{
// if we found one of these boxes, we kill the process and exit.
TerminateProcess( stProcess.hProcess, 199 );
fn_vCloseProcessHandles( &stProcess );
sprintf( szMessage, "\tError detected with '%s'\r\n", _szExeName );
fn_vOutputLine( szMessage );
return STATUS_C_Error;
}
// We found nothing... We go for another wait.
}
else
{
// Error.
fn_vOutputLine( "\r\n\tInternal error: Error on WaitForMultipleObjects !!!\r\n" );
fn_vCloseProcessHandles( &stProcess );
return STATUS_C_Error;
}
} while( 1 );
fn_vCloseProcessHandles( &stProcess );
// we deal we an enventual dialog box (saying "access violation" or whatever)
if( fn_bCloseSytemErrorDialogBox( szShortExeName ) )
{
// If there was an error dialog box, we return an error.
sprintf( szMessage, "\tError detected with '%s'\r\n", _szExeName );
fn_vOutputLine( szMessage );
return STATUS_C_Error;
}
return STATUS_C_OK;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tdeStatus fn_eSpawnAndWaitForProcessWithInputEvents( char *_szExeName, char *_szCommandLine )
{
HANDLE a_hObjectsToWaitFor[32];
DWORD dwWaitReturn, dwExitCode;
char szMessage[1024];
PROCESS_INFORMATION stProcess;
MSG stMsg;
char szShortExeName[128];
fn_vGetShortExeName( szShortExeName, _szExeName );
// spawn process
if( ! fn_bSpawnProcess( _szExeName, _szCommandLine, &stProcess ) )
{
sprintf( szMessage, "\tError launching %s\r\n", _szExeName );
fn_vOutputLine( szMessage );
fn_vCloseProcessHandles( &stProcess );
return STATUS_C_Error;
}
// Prepare to wait for end of process
a_hObjectsToWaitFor[0] = stProcess.hProcess;
a_hObjectsToWaitFor[1] = g_stTheGlobalData.hEventStop;
do
{
// Wait for process or abort
dwWaitReturn = MsgWaitForMultipleObjects( 2, a_hObjectsToWaitFor, FALSE, C_lTimeIntervalForErrorChecking, QS_ALLINPUT );
// Test if user wants to stop (=abort)
if( dwWaitReturn == WAIT_OBJECT_0+1 || dwWaitReturn == WAIT_ABANDONED_0+1 )
{
// Ask for confirmation
sprintf( szMessage, "Are you sure you want to terminate '%s' ?", _szExeName );
if( AfxMessageBox( szMessage, MB_YESNO | MB_ICONQUESTION ) == IDYES )
{
// Abort is confirmed, we kill the process
PostThreadMessage( stProcess.dwThreadId, WM_QUIT, 0, NULL );
dwWaitReturn = WaitForSingleObject( stProcess.hProcess, 3500 );
if( dwWaitReturn == WAIT_TIMEOUT )
TerminateProcess( stProcess.hProcess, 199 );
// We exit if process was killed
fn_vCloseProcessHandles( &stProcess );
fn_bCloseSytemErrorDialogBox( szShortExeName, TRUE );
fn_vOutputLine( C_szUserBreakString );
return STATUS_C_UserBreak;
}
else
g_stTheGlobalData.p_oMainDlg -> m_fn_vCancelStopWorkInProgress();
// User does not want to stop anymore, we go for another wait.
ResetEvent( g_stTheGlobalData.hEventStop );
}
else if( dwWaitReturn == WAIT_OBJECT_0 || dwWaitReturn == WAIT_ABANDONED_0 )
{
GetExitCodeProcess( stProcess.hProcess, &dwExitCode );
if( dwExitCode != 0 )
{
sprintf( szMessage, "\t'%s' has exited with error code %i\r\n", _szExeName, dwExitCode );
fn_vOutputLine( szMessage );
fn_vCloseProcessHandles( &stProcess );
return STATUS_C_Error;
}
// Process has exited normally. We exit the wait loop.
break;
}
else if( dwWaitReturn == WAIT_OBJECT_0 + 2 )
{
// Else, a user event has arrived: treat it.
while( PeekMessage( &stMsg, g_stTheGlobalData.p_oMainDlg -> m_hWnd, 0, 0, PM_REMOVE ) )
if( ! g_stTheGlobalData.p_oMainDlg -> PreTranslateMessage( &stMsg ) )
DispatchMessage( &stMsg );
}
else if( dwWaitReturn == WAIT_TIMEOUT )
{
// Here, the time has come to check if an error occured.
// We try to find and close any system error dialog box related with the exe
if( fn_bCloseSytemErrorDialogBox( szShortExeName ) )
{
// if we found one of these boxes, we kill the process and exit.
TerminateProcess( stProcess.hProcess, 199 );
fn_vCloseProcessHandles( &stProcess );
sprintf( szMessage, "\tError detected with '%s'\r\n", _szExeName );
fn_vOutputLine( szMessage );
return STATUS_C_Error;
}
// We found nothing... We go for another wait.
}
else
{
// Error.
fn_vOutputLine( "\r\n\tInternal error: Error on MsgWaitForMultipleObjects !!!\r\n" );
fn_vCloseProcessHandles( &stProcess );
return STATUS_C_Error;
}
} while( 1 );
fn_vCloseProcessHandles( &stProcess );
// we deal we an enventual dialog box (saying "access violation" or whatever)
if( fn_bCloseSytemErrorDialogBox( szShortExeName ) )
{
// If there was an error dialog box, we return an error.
sprintf( szMessage, "\tError detected with '%s'\r\n", _szExeName );
fn_vOutputLine( szMessage );
return STATUS_C_Error;
}
return STATUS_C_OK;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tdeStatus fn_eSpawnThreadAndWaitWithInputEvents( AFX_THREADPROC _p_fn_uiThread, LPVOID _p_vParamForThread )
{
HANDLE a_hEvents[64];
DWORD dwWaitReturn;
MSG stMessage;
DWORD dwExitCode = 0;
CWinThread *p_oThread = AfxBeginThread( _p_fn_uiThread, _p_vParamForThread );
if( p_oThread == NULL )
{
AfxMessageBox( "Unable to create thread !.", MB_OK | MB_ICONEXCLAMATION );
return STATUS_C_Error;
}
// Disable autodelete (to use handle to thread after it is terminated).
p_oThread->m_bAutoDelete = FALSE;
// Now, we enter wait loop that wait either for thread end or for input message
a_hEvents[0] = p_oThread->m_hThread;
while( 1 )
{
dwWaitReturn = MsgWaitForMultipleObjects( 1, a_hEvents, FALSE, INFINITE, QS_ALLINPUT );
// If an input event has arrived, we dispatch it.
if( dwWaitReturn == WAIT_OBJECT_0 + 1 )
{
while( PeekMessage( &stMessage, g_stTheGlobalData.p_oMainDlg->m_hWnd, 0, 0, PM_REMOVE ) )
if( g_stTheGlobalData.p_oMainDlg -> PreTranslateMessage( &stMessage ) == 0 )
DispatchMessage( &stMessage );
}
// if thread has exited
else if( dwWaitReturn == WAIT_OBJECT_0 || dwWaitReturn == WAIT_ABANDONED_0 )
{
break;
}
else
{
// Error.
TCHAR szMessage[1024];
::FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM,
NULL, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
szMessage, 1024, NULL );
fn_vOutputLine( "\r\n\tInternal error: Error on MsgWaitForMultipleObjects :\r\n\t" );
fn_vOutputLine( szMessage );
fn_vOutputLine( "\r\n" );
delete p_oThread;
return STATUS_C_Error;
}
}
GetExitCodeThread( p_oThread->m_hThread, &dwExitCode );
// if( dwExitCode == STATUS_C_UserBreak )
// fn_vOutputLine( C_szUserBreakString );
delete p_oThread;
return (tdeStatus)dwExitCode;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
typedef struct tdstEnumWinStruct_
{
char *p_szExeName;
BOOL bActionDone;
UINT uiNumberOfButton;
} tdstEnumWinStruct;
// Callback to enumerate all controls in a window.
BOOL CALLBACK EnumChildWindowProc( HWND _hwnd, LPARAM _p_stParam )
{
char szTitle[512];
tdstEnumWinStruct *p_stEnumChild = (tdstEnumWinStruct *)_p_stParam;
DWORD dwID = GetClassLong( _hwnd, GCW_ATOM );
// We only check statics
switch( dwID )
{
case 0xC01B :
GetWindowText( _hwnd, szTitle, 512 );
// Check if caption contains the name of the exe
if( stristr( szTitle, p_stEnumChild->p_szExeName ) != NULL )
{
// Name is detected
p_stEnumChild->bActionDone = TRUE;
}
break;
case 0xC015:
p_stEnumChild->uiNumberOfButton++;
break;
default:
break;
}
return TRUE;
}
BOOL fn_bCheckWindow( HWND _hMessageBox, char *_szString, UINT *_p_uiNbButtons = NULL )
{
tdstEnumWinStruct stEnumChild;
stEnumChild.p_szExeName = _szString;
stEnumChild.bActionDone = FALSE;
stEnumChild.uiNumberOfButton = 0;
// Search in controls if one of them contains the given string
EnumChildWindows( _hMessageBox, EnumChildWindowProc, (LPARAM)&stEnumChild );
if( _p_uiNbButtons )
*_p_uiNbButtons = stEnumChild.uiNumberOfButton;
return stEnumChild.bActionDone;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Callback to enumerate all windows.
// (called by fn_bCloseSytemErrorDialogBox)
BOOL CALLBACK EnumWindowProc( HWND _hwnd, LPARAM _p_stParam )
{
char szTitle[512];
DWORD dwID = GetClassLong( _hwnd, GCW_ATOM );
tdstEnumWinStruct *p_stEnumWin = (tdstEnumWinStruct *)_p_stParam;
UINT uiNbButtons;
GetWindowText( _hwnd, szTitle, 512 );
// If window is a dialog box
if( dwID == 0x8002 )
{
// Check if it's an "application error" box.
if( stristr( szTitle, p_stEnumWin->p_szExeName )
&& (stristr( szTitle, "erreur d'application" ) || stristr( szTitle, "application error" )) )
{
// Now, we close that box !
::PostMessage( _hwnd, WM_CLOSE, 0, 0 );
p_stEnumWin->bActionDone = TRUE;
// Return FALSE to stop enumeration
return FALSE;
}
// Else, it may be an assert box.
else if( (stristr( szTitle, "Debug Lib" ) || stristr( szTitle, "Runtime Lib" ))
&& fn_bCheckWindow( _hwnd, "??" )
&& fn_bCheckWindow( _hwnd, p_stEnumWin->p_szExeName, &uiNbButtons )
&& uiNbButtons == 3 )
{
::PostMessage( _hwnd, WM_CLOSE, 0, 0 );
p_stEnumWin->bActionDone = TRUE;
// Return FALSE to stop enumeration
return FALSE;
}
// Check if it's an "illegal operation" box.
else
{
char *p_szExtension = strrchr( p_stEnumWin->p_szExeName, '.' );
if( p_szExtension ) *p_szExtension = 0;
if( stristr( szTitle, p_stEnumWin->p_szExeName )
&& fn_bCheckWindow( _hwnd, "Op<EFBFBD>ration non conforme", &uiNbButtons )
&& uiNbButtons >= 2 && uiNbButtons < 4 )
{
// Now, we close that box !
::PostMessage( _hwnd, WM_CLOSE, 0, 0 );
p_stEnumWin->bActionDone = TRUE;
// Return FALSE to stop enumeration
return FALSE;
}
if( p_szExtension ) *p_szExtension = '.';
}
}
// We also handle dr watson's windows...
else if( stristr( szTitle, "Watson" ) != NULL )
{
// Check if this dr. Watson's window talks about us !
if( fn_bCheckWindow( _hwnd, p_stEnumWin->p_szExeName ) )
{
::PostMessage( _hwnd, WM_CLOSE, 0, 0 );
p_stEnumWin->bActionDone = TRUE;
// Return FALSE to stop enumeration
return FALSE;
}
}
// Window not found, we continue
return TRUE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Get all windows, check if this is a system or dr. watson's window
// and it is related to ExeName, then eventually close it.
// Return TRUE if a window was closed, FALSE otherwise.
BOOL fn_bCloseSytemErrorDialogBox( char *_szExeName, BOOL bForceClose /*=FALSE*/)
{
tdstEnumWinStruct stEnumWin;
if( ! g_stTheGlobalData.bAutoDetectErrors && ! bForceClose )
return FALSE;
stEnumWin.p_szExeName = _szExeName;
stEnumWin.bActionDone = FALSE;
EnumWindows( EnumWindowProc, (LPARAM)&stEnumWin );
return stEnumWin.bActionDone;
}

View File

@@ -0,0 +1,118 @@
#include "stdafx.h"
#include "GlobalData.h"
#include "/cpa/public/scr.h"
#define M_IsTitle (_eAction==SCR_EA_Anl_BeginSection)
#define M_IsEnd (_eAction==SCR_EA_Anl_EndSection)
#define M_IsBegSubSection (_eAction==SCR_EA_Anl_BeginSubSection)
#define M_IsEndSubSection (_eAction==SCR_EA_Anl_EndSubSection)
#define M_IsEntry (_eAction==SCR_EA_Anl_Entry)
#define M_ActionIs(szActionAsked) (!strcmpi(_p_szName,szActionAsked))
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Callback function to analyse the section "LevelNames" in game.dsc
SCR_tde_Anl_ReturnValue fn_eScriptCallBackFirstLevel(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action _eAction)
{
SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
_p_stFile=_p_stFile;
if (M_IsTitle)
{
g_stTheGlobalData.a_csLevelNames.RemoveAll();
g_stTheGlobalData.a_csLevelNames.SetSize( 0, 50 );
}
if (M_IsEntry)
{
if (M_ActionIs("LevelName"))
{
char *p_cDelimiter = strchr( _ap_szParams[0], '$' );
if( p_cDelimiter ) *p_cDelimiter = 0;
g_stTheGlobalData.a_csLevelNames.Add( _ap_szParams[0] );
}
}
else if ( M_IsEnd )
{
}
return(eReturnValue);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Init acp modules for script parsing.
unsigned long g_SCR_a9MemTable[9] = {0,0,0,0,0,0,0,0,0};
void fn_vInitScr()
{
Erm_M_InitErrMsg(Erm);
Erm_M_InitErrMsg(Mmg);
Mmg_fn_vFirstInitMmgModule(10);
SCR_fn_v_RdL0_Init();
g_SCR_a9MemTable[1] = 1000000;
SCR_fn_v_Mem_InitWithMemLevel(g_SCR_a9MemTable);
SCR_fn_v_RdL0_RegisterCallback( "FirstLevelDescription", fn_eScriptCallBackFirstLevel, SCR_CRC_c_RdL0_ForSection );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void fn_vDesinitScr()
{
// SCR_fn_v_RdL0_DeleteRegisterCallback( "FirstLevelDescription", SCR_CRC_c_RdL0_ForSection , );
SCR_fn_v_RdL0_Close();
Mmg_fn_vStopMmgModule();
MMG_fn_vDesinitMemoryRasterDeclaration ();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Analyse game.dsc
BOOL fn_bReadGameDsc()
{
char szText[1024];
char szFileName[512];
char szSectionName[512];
// Compute long name of game.dsc
sprintf( szFileName, "%s\\Gamedata\\Game.dsc", (const char *)g_stTheGlobalData.csMainDirectory );
g_stTheGlobalData.a_cLevelsSelectedForBinarization.RemoveAll();
g_stTheGlobalData.a_cBinarizedLevels.RemoveAll();
// We need read acces on the file
if( _access( szFileName, 04 ) == -1 )
{
sprintf( szText, "Can't read level list: '%s' is not accessible !\n(Does not exist or no read permission)", szFileName );
AfxMessageBox( szText, MB_OK | MB_ICONSTOP );
return FALSE;
}
// Analyse only the section describing the list of levels
sprintf( szSectionName, "%s^FirstLevelDescription", szFileName );
SCR_fnp_st_RdL0_AnalyseSection( szSectionName, SCR_CDF_uw_Anl_ForceAnalyse );
SCR_fn_v_RdL0_DeleteOpenSection( szSectionName, SCR_CDR_c_RdL0_Match );
int iSize = g_stTheGlobalData.a_csLevelNames.GetSize();
g_stTheGlobalData.a_cLevelsSelectedForBinarization.SetSize( iSize );
g_stTheGlobalData.a_cBinarizedLevels.SetSize( iSize );
for( iSize--; iSize >= 0; iSize-- )
{
// clear the list of selected levels.
g_stTheGlobalData.a_cLevelsSelectedForBinarization.SetAt( iSize, 0 );
// clear the list of binarized levels.
g_stTheGlobalData.a_cBinarizedLevels.SetAt( iSize, 0 );
}
// If no level found, print a warning.
if( g_stTheGlobalData.a_csLevelNames.GetSize() == 0 )
{
sprintf( szText, "The list of level in '%s' is empty !", szFileName );
AfxMessageBox( szText, MB_OK | MB_ICONEXCLAMATION );
return FALSE;
}
return TRUE;
}

View File

@@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// BinaryTool.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,230 @@
#include "stdafx.h"
//#include <stdio.h>
#include "util.h"
#include "GlobalData.h"
#include "file.h"
#include "Process.h"
#include "Threads.h"
#include "scripts.h"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tdeStatus fn_e_TASK_Binarize( CByteArray &a_cSelectedLevels )
{
if( ! fn_bCheckFileExistanceInStartupDir( "crb.exe" ) )
return STATUS_C_Error;
// Reset list of binarized levels
for( int i=g_stTheGlobalData.a_cBinarizedLevels.GetSize()-1; i>=0; i-- )
{
g_stTheGlobalData.a_cBinarizedLevels.SetAt( i, 0 );
}
// Before binarizing, we disable BigFile for reloc tables,
// because user must regenerate it after binarizing
fn_vDisableRelocTableBigFile();
// Start binarization !
tdeStatus eStatus = fn_eSpawnThreadAndWaitWithInputEvents( fn_uiThreadBinarize, &a_cSelectedLevels );
if( eStatus == STATUS_C_OK )
{
// If no error, update startprg.ini
// fn_vUpdateStartPrg();
fn_vUpdateStartPrg_old();
}
return eStatus;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tdeStatus fn_e_TASK_TestBinarizedMaps( CByteArray &a_cBinarizedLevels )
{
CString csOutput, csSequence;
BOOL bAllMaps;
int iSequenceNumber, iSizeOfSequence;
int iNumberOfMap=0, iFirstMap=-1;
CString csFileName = g_stTheGlobalData.csMainDirectory + "\\Test.ini";
tdeStatus eStatus;
fn_vOutputLine( "Testing levels...\r\n" );
bAllMaps = TRUE;
iSequenceNumber = 1;
iSizeOfSequence = 0;
csSequence = "SEQUENCE1=";
for( int i=0; i<a_cBinarizedLevels.GetSize(); i++ )
{
if( a_cBinarizedLevels[i] != 0 )
{
iNumberOfMap++;
if( iFirstMap == -1 )
{
// Get first map number.
iFirstMap = i;
csOutput = "\t" + g_stTheGlobalData.a_csLevelNames[i] + "\r\n";
fn_vOutputLine( csOutput );
}
else
{
// Insert level into a sequence (except the first one)
if( iSizeOfSequence > 250 )
{
char szSeq[5];
iSequenceNumber ++;
iSizeOfSequence = 0;
sprintf( szSeq, "%i", iSequenceNumber );
csSequence += "\nSEQUENCE";
csSequence += szSeq;
csSequence += "=";
}
csSequence += g_stTheGlobalData.a_csLevelNames[i] + " ";
iSizeOfSequence += g_stTheGlobalData.a_csLevelNames[i].GetLength() + 1;
csOutput = "\t" + g_stTheGlobalData.a_csLevelNames[i] + "\r\n";
fn_vOutputLine( csOutput );
}
}
else
bAllMaps = FALSE;
}
csSequence += "\n";
// if nothing to do...
if( iNumberOfMap == 0 )
return STATUS_C_OK;
// if there is only one map, no test.ini
if( iNumberOfMap > 1 )
{
CStdioFile fTestIni;
// Generate Test.ini
if( ! fTestIni.Open( csFileName, CFile::modeWrite | CFile::modeCreate ) )
{
csOutput = "\tError: Can't create '" + csFileName + "'";
fn_vOutputLine( csOutput );
return STATUS_C_Error;
}
if( bAllMaps )
fTestIni.WriteString( "[TEST]\nMODE=ALLMAPSONLY\nWAITMIN=35\nWAITMAX=45\nWITHRESTART=0\nSTAT=1\n" );
else
{
fTestIni.WriteString( "[TEST]\nMODE=SEQUENCE\nWAITMIN=35\nWAITMAX=45\nWITHRESTART=0\nSTAT=1\n" );
fTestIni.WriteString( csSequence );
}
fTestIni.Close();
}
char szExe[512];
char szCommandLine[128];
sprintf( szExe, "%s\\%s", g_stTheGlobalData.csMainDirectory, g_stTheGlobalData.csExeName );
sprintf( szCommandLine, "%s -level:%s", szExe, g_stTheGlobalData.a_csLevelNames[iFirstMap] );
eStatus = fn_eSpawnAndWaitForProcessWithInputEvents( szExe, szCommandLine );
if( iNumberOfMap > 1 )
DeleteFile( csFileName );
if( eStatus == STATUS_C_OK )
{
fn_vOutputLine( "\tTest is sucessful !\r\n\r\n" );
}
else
{
fn_vOutputLine( "\r\n" );
}
return eStatus;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tdeStatus fn_e_TASK_Version()
{
char szExeName[512];
char szCommandLine[1024];
int i;
tdeStatus eStatus = STATUS_C_OK;
fn_vOutputLine( "\r\n* * Making version * * * * * * * * * * * * * * * \r\n" );
if( ! fn_bCheckFileExistanceInStartupDir( "rm2sndparser.exe" )
|| ! fn_bCheckFileExistanceInStartupDir( "convimg.exe" )
|| ! fn_bCheckFileExistanceInStartupDir( "concat.exe" )
|| ! fn_bCheckFileExistanceInStartupDir( "crb.exe" ) )
return STATUS_C_Error;
if( ! fn_bValidateMainDirectorySetting() )
return STATUS_C_Error;
if( ! fn_bValidateBinDirectorySetting() )
return STATUS_C_Error;
if( ! fn_bValidateGameExeSetting() )
return STATUS_C_Error;
// Select all levels for binarization.
int iSize = g_stTheGlobalData.a_csLevelNames.GetSize();
for( i=0; i<iSize; i++ )
{
g_stTheGlobalData.a_cLevelsSelectedForBinarization.SetAt( i, 1 );
}
// Now it's time to make the sound banks.
fn_vOutputLine( "Making sound banks...\r\n" );
sprintf( szExeName, "%s\\rm2SndParser.exe", (LPCTSTR)g_stTheGlobalData.csStartupDirectory );
fn_vMakeSndParserCommandLine( szCommandLine );
strcat( szCommandLine, " -ParseAllMaps -ParseFix -GenerateBanks" );
eStatus = fn_eSpawnAndWaitForProcessWithInputEvents( szExeName, szCommandLine );
if( eStatus != STATUS_C_OK )
return eStatus;
// Then, we copy the sound directory
eStatus = fn_eSpawnThreadAndWaitWithInputEvents( fn_uiThreadCopySoundDirectory, NULL );
if( eStatus != STATUS_C_OK )
return eStatus;
// Texture time...
eStatus = fn_eSpawnThreadAndWaitWithInputEvents(
fn_uiThreadMakeBigFileTextures,
(void *)(LPCTSTR)g_stTheGlobalData.csTempTextureDirectory );
if( eStatus != STATUS_C_OK )
return eStatus;
// Now we binarize all levels.
eStatus = fn_e_TASK_Binarize( g_stTheGlobalData.a_cLevelsSelectedForBinarization );
if( eStatus != STATUS_C_OK )
return eStatus;
// Now we test the binarized maps.
if( g_stTheGlobalData.bAutoTestMaps )
{
fn_e_TASK_TestBinarizedMaps( g_stTheGlobalData.a_cBinarizedLevels );
}
return STATUS_C_OK;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@@ -0,0 +1,111 @@
#include "stdafx.h"
#include <io.h>
#include "util.h"
#include "file.h"
#include "process.h"
#include "globaldata.h"
UINT fn_uiThreadAnims( LPVOID _p_vParam )
{
BOOL bOptimizedAnims;
HANDLE hFindhandle;
WIN32_FIND_DATA stFindData;
CString csFind;
tdeStatus eStatus;
char szMakeAnimExeName[512];
char szMakeAnimCommandLine[512];
char szTblName[512];
int iNbProcesses = 0;
PROCESS_INFORMATION a2_stMakeanimProcesses[2];
const char *a_szProcessNames[] = { "Makeanim", "Makeanim" };
int iWaitReturn;
bOptimizedAnims = *(BOOL *)_p_vParam;
fn_vOutputLine( "Making all anims...\r\n" );
sprintf( szMakeAnimExeName, "%s\\makeanim.exe", (LPCTSTR)g_stTheGlobalData.csMainDirectory );
// No families found, nothing to do...
csFind = g_stTheGlobalData.csMainDirectory + "\\Gamedata\\World\\Levels\\_Common\\Families\\*.*";
if( (hFindhandle = FindFirstFile( csFind, &stFindData )) == INVALID_HANDLE_VALUE )
return STATUS_C_OK;
// For each family in gamedata, we execute makeanim on it.
do
{
// Skip . and ..
if( (stFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
&& ( (strcmp( stFindData.cFileName, ".") == 0)
|| strcmp( stFindData.cFileName, "..") == 0) )
continue;
if( (stFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
{
csFind = "\t";
csFind += stFindData.cFileName;
csFind += "\r\n";
fn_vOutputLine( csFind );
for( int i=0; i<g_stTheGlobalData.a_csVersionDirectories.GetSize(); i++ )
{
sprintf(
szTblName,
"%s\\%s\\World\\Levels\\_Common\\Families\\%s\\%s.tbl",
(LPCTSTR)g_stTheGlobalData.csMainDirectory,
(LPCTSTR)g_stTheGlobalData.a_csVersionDirectories[i],
stFindData.cFileName,
stFindData.cFileName );
if( GetFileAttributes( szTblName ) != 0xffffffff )
{
if( bOptimizedAnims )
sprintf( szMakeAnimCommandLine, "Makeanim.exe -z -b %s", stFindData.cFileName );
else
sprintf( szMakeAnimCommandLine, "Makeanim.exe -b %s", stFindData.cFileName );
// Spawn process Makeanim
if( ! fn_bSpawnProcess( szMakeAnimExeName, szMakeAnimCommandLine, &a2_stMakeanimProcesses[iNbProcesses] ) )
{
FindClose( hFindhandle );
AfxEndThread( STATUS_C_Error );
}
// increment spawned process count
iNbProcesses++;
// If we have 2 processes running, wait for end of one of them.
if( iNbProcesses > 1 )
{
if( (eStatus =
fn_eWaitForMultipleProcesses( iNbProcesses, a2_stMakeanimProcesses, a_szProcessNames, &iWaitReturn ) )
!= STATUS_C_OK )
{
FindClose( hFindhandle );
AfxEndThread( eStatus );
}
iNbProcesses--;
if( iWaitReturn == 0 )
{
a2_stMakeanimProcesses[0] = a2_stMakeanimProcesses[1];
}
}
break;
}
}
}
} while( FindNextFile( hFindhandle, &stFindData ) );
FindClose( hFindhandle );
fn_vOutputLine( "\tMakeAnim complete !\r\n" );
AfxEndThread( STATUS_C_OK );
return STATUS_C_OK;
}

View File

@@ -0,0 +1,215 @@
#include "stdafx.h"
#include "GlobalData.h"
#include "util.h"
#include "file.h"
#include "process.h"
// Timeout is 10 min for engine
#define C_TimeOutForEngine (1000 * 60 * 10)
//#define C_TimeOutForEngine (1000 * 15)
// Timeout is 1 min for crb
#define C_TimeOutForCRB (1000 * 60 * 1)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tdeStatus fn_eBinarizeOneLevel( CString _csLevelName, BOOL _bTakeCareOfFix )
{
char szExe[512];
char szCommandLine[512];
tdeStatus eStatus;
tdstCopyFileContext stCopyContext;
CString csOutput;
csOutput = "Starting binarize level '" + _csLevelName + "'\r\n";
fn_vOutputLine( csOutput );
// Will be used by fn_bTreatArrayOfFiles
stCopyContext.csMainDirectory = g_stTheGlobalData.csMainDirectory;
stCopyContext.csBinDirectory = g_stTheGlobalData.csBinDirectory;
stCopyContext.csLevelName = _csLevelName;
// Clean main directory and bin level directory
if( (eStatus = fn_eTreatArrayOfFiles( g_a_szFilesBeforeBinarize, &stCopyContext )) != STATUS_C_OK )
return eStatus;
csOutput = "\tFirst pass for " + g_stTheGlobalData.csExeName + "\r\n";
fn_vOutputLine( csOutput );
sprintf( szExe, "%s\\%s", (const char *)g_stTheGlobalData.csMainDirectory, (const char *)g_stTheGlobalData.csExeName );
sprintf(
szCommandLine,
"%s -bin:2 -dsc:2 -mem:2 -level:%s",
(const char *)g_stTheGlobalData.csExeName,
(const char *)_csLevelName );
// First pass for engine
// Wait for end of engine or for user break.
eStatus = fn_eSpawnAndWaitForProcessWithTimeout( szExe, szCommandLine, C_TimeOutForEngine );
if( eStatus != STATUS_C_OK )
return eStatus;
// Here, everything went ok, so we continue.
// fn_vOutputLine( "\tCopying binarized files from first pass\r\n" );
if( (eStatus = fn_eTreatArrayOfFiles( g_a_szFilesAfterFirstPass, &stCopyContext )) != STATUS_C_OK )
return eStatus;
// Second pass for engine.
csOutput = "\tSecond pass for " + g_stTheGlobalData.csExeName + "\r\n";
fn_vOutputLine( csOutput );
sprintf(
szCommandLine,
"%s -bin:2 -dsc:2 -mem:3 -level:%s",
(const char *)g_stTheGlobalData.csExeName,
(const char *)_csLevelName );
if( (eStatus = fn_eSpawnAndWaitForProcessWithTimeout( szExe, szCommandLine, C_TimeOutForEngine )) != STATUS_C_OK )
return eStatus;
// fn_vOutputLine( "\tCopying binarized files from second pass\r\n" );
if( (eStatus = fn_eTreatArrayOfFiles( g_a_szFilesAfterSecondPass, &stCopyContext )) != STATUS_C_OK )
return eStatus;
if( _bTakeCareOfFix )
{
// Now, execute CRB on fix.
fn_vOutputLine( "\tBuild relocation table for Fix\r\n" );
sprintf( szExe, "%s\\crb.exe", (const char *)g_stTheGlobalData.csMainDirectory );
if( (eStatus = fn_eSpawnAndWaitForProcessWithTimeout( szExe, "crb.exe FIX -s", C_TimeOutForCRB )) != STATUS_C_OK )
return eStatus;
// fn_vOutputLine( "\tCopying fix files to bin directory\r\n" );
if( (eStatus = fn_eTreatArrayOfFiles( g_a_szFixFilesAfterCRB, &stCopyContext )) != STATUS_C_OK )
return eStatus;
}
else
{
if( (eStatus = fn_eTreatArrayOfFiles( g_a_szDeleteFixFilesAfterCRB, &stCopyContext )) != STATUS_C_OK )
return eStatus;
}
// Now, execute CRB on level.
fn_vOutputLine( "\tBuild relocation table for Level\r\n" );
sprintf( szExe, "%s\\crb.exe", (const char *)g_stTheGlobalData.csMainDirectory );
sprintf( szCommandLine, "crb.exe %s -s", (const char *)_csLevelName );
if( (eStatus = fn_eSpawnAndWaitForProcessWithTimeout( szExe, szCommandLine, C_TimeOutForCRB )) != STATUS_C_OK )
return eStatus;
// fn_vOutputLine( "\tCopying level files to bin directory\r\n" );
if( (eStatus = fn_eTreatArrayOfFiles( g_a_szLevelFilesAfterCRB, &stCopyContext )) != STATUS_C_OK )
return eStatus;
if( (eStatus = fn_eTreatArrayOfFiles( g_a_szDeleteFilesAfterBinarize, &stCopyContext )) != STATUS_C_OK )
return eStatus;
csOutput = "\tBinarization is finished for level '" + _csLevelName + "'\r\n\r\n";
fn_vOutputLine( csOutput );
return STATUS_C_OK;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Thread for binarization ;
// Launch MainWinX two times (with different parameters)
// then execute crb two times
// then move binary files to destination directory.
UINT fn_uiThreadBinarize( LPVOID _p_stParam )
{
CByteArray *p_oSelectedLevels = (CByteArray *)_p_stParam;
CString csOutput;
tdeStatus eBinarizationOK;
BOOL bALevelHasBeenSkipped = FALSE;
BOOL bALevelWasBinarizedOK = FALSE;
tdstCopyFileContext stCopyContext;
BOOL bTakeCareOfFix = TRUE;
fn_vOutputLine( "\r\n=== New binarization task =======================\r\n" );
stCopyContext.csMainDirectory = g_stTheGlobalData.csMainDirectory;
stCopyContext.csBinDirectory = g_stTheGlobalData.csBinDirectory;
stCopyContext.csLevelName = "";
if( ! g_stTheGlobalData.bCommonFilesAreCopied )
{
if( (eBinarizationOK = fn_eTreatArrayOfFiles( g_a_szCommonFiles, &stCopyContext )) != STATUS_C_OK )
return eBinarizationOK;
g_stTheGlobalData.bCommonFilesAreCopied = TRUE;
}
for( int i=0; i<p_oSelectedLevels->GetSize(); i++ )
{
// if level is not selected for binarization, go to next one.
if( (*p_oSelectedLevels)[i] == 0 )
continue;
eBinarizationOK = fn_eBinarizeOneLevel( g_stTheGlobalData.a_csLevelNames[i], bTakeCareOfFix );
// We build reloc tables for fix for first level only.
if( eBinarizationOK == STATUS_C_OK )
bTakeCareOfFix = FALSE;
// if an error accured during binarization,
// test if we have to continue with binarization.
if( eBinarizationOK != STATUS_C_OK )
{
if( eBinarizationOK == STATUS_C_UserBreak )
{
fn_vOutputLine( "\tBinarization aborted by user.\r\n\r\n\r\n" );
// If we don't continue, exit binarization processs.
AfxEndThread( (UINT)STATUS_C_UserBreak );
}
else // eBinarizationOK == STATUS_C_Error
{
if( g_stTheGlobalData.bStopBinarizeOnError )
{
fn_vOutputLine( "\r\nBinarization aborted.\r\n\r\n\r\n" );
// If we don't continue, exit binarization processs.
AfxEndThread( (UINT)STATUS_C_Error );
}
// Else, go with next level.
else
{
fn_vOutputLine( "\tSkipping level....\r\n" );
bALevelHasBeenSkipped = TRUE;
// Before we go for next level, wait for a few moments
// to allow program to terminate.
SleepEx( 1250, FALSE );
}
}
}
else // eBinarizationOK == STATUS_C_OK
{
// Level was binarized, we deselect it.
p_oSelectedLevels->SetAt( i, 0 );
// and we add it to the list of binarized levels
g_stTheGlobalData.a_cBinarizedLevels.SetAt( i, 1 );
bALevelWasBinarizedOK = TRUE;
}
fn_vOutputLine( "\r\n" );
} // End for each level
if( bALevelHasBeenSkipped )
{
fn_vOutputLine( "\r\nWarning : At least one level was not binarized because of errors.\r\n" );
}
else
{
fn_vOutputLine( "\r\nThe binarization is successful !.\r\n" );
}
fn_vOutputLine( "\r\n" );
if( bALevelWasBinarizedOK )
return (UINT)STATUS_C_OK;
else
return STATUS_C_Error;
}

View File

@@ -0,0 +1,263 @@
#include "stdafx.h"
#include <io.h>
#include "util.h"
#include "file.h"
#include "process.h"
#include "globaldata.h"
UINT fn_uiThreadMakeGFTextures( LPVOID _p_vParam )
{
CStringArray a_csSourceDirectories;
CStringArray a_csDestDirectories;
CString csTmp, csTmp2;
CString csOutput;
BOOL bKeepDisplayResults = FALSE;
tdeStatus eStatus;
_p_vParam = _p_vParam;
fn_vOutputLine( "Making gf textures...\r\n" );
if( ! fn_bCheckFileExistanceInStartupDir( "convimg.exe" ) )
AfxEndThread( STATUS_C_Error );
// Build array of dirs to execute convimg on.
a_csSourceDirectories.SetSize( 0, 5 );
a_csDestDirectories.SetSize( 0, 5 );
// First, the vignettes.
a_csSourceDirectories.Add( "\\Gamedata\\Vignette" );
a_csDestDirectories.Add( "\\Vignette" );
// Then, specific textures (starting from last dir to first dir in version.ini)
for( int i=g_stTheGlobalData.a_csVersionDirectories.GetSize()-1; i>=0; i-- )
{
csTmp = "\\" + g_stTheGlobalData.a_csVersionDirectories[i] + "\\World\\Graphics\\Textures";
a_csSourceDirectories.Add( csTmp );
a_csDestDirectories.Add( "\\World\\Graphics\\Textures" );
}
// Then, common textures.
// Common textures will be copied AFTER, so they will be chosen BEFORE specific textures.
a_csSourceDirectories.Add( "\\Gamedata\\World\\Graphics\\Textures" );
a_csDestDirectories.Add( "\\World\\Graphics\\Textures" );
char szComvImgExeName[512];
char szComvImgCommandLine[512];
sprintf( szComvImgExeName, "%s\\ConvImg.exe", (const char *)g_stTheGlobalData.csStartupDirectory );
for( i=0; i<a_csSourceDirectories.GetSize(); i++ )
{
csTmp = g_stTheGlobalData.csMainDirectory + a_csSourceDirectories[i];
csTmp2 = g_stTheGlobalData.csBinDirectory + a_csDestDirectories[i];
sprintf(
szComvImgCommandLine,
"ConvImg.exe -SrcPath:%s -DstPath:%s -BMP -TGA",
(const char *)csTmp,
(const char *)csTmp );
csOutput = "\tConverting '" + a_csSourceDirectories[i] + "'\r\n";
fn_vOutputLine( csOutput );
// We make the gf textures in the source directory (for engine)
if( (eStatus = fn_eSpawnAndWaitForProcessWithInputEvents( szComvImgExeName, szComvImgCommandLine )) != STATUS_C_OK )
AfxEndThread( eStatus );
// Now, we copy them to bin directory
csOutput = "\tCopying '" + a_csSourceDirectories[i] + "' to bin directory\r\n";
fn_vOutputLine( csOutput );
csTmp += "\\*.gf";
if( (eStatus = fn_eRecursiveFileCopy( csTmp, csTmp2 )) != STATUS_C_OK )
AfxEndThread( eStatus );
} /* End loop on a_csSourceDirectories */
fn_vOutputLine( "\tTexture copy is successful !\r\n\r\n" );
AfxEndThread( (UINT)STATUS_C_OK );
return STATUS_C_OK;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tdeStatus fn_eEditGameDscForBigFile()
{
CString csFileName;
CString csLine;
CString csOutput;
CStdioFile fGameDsc;
DWORD dwCurrentSeek;
BOOL bFound;
CString csLineToFind( "Textures(\"\\Textures.cnt\")" );
CString csEditYourself( "\tYou'll have to edit game.dsc for yourself...\r\n" );
fn_vOutputLine( "\tEditing game.dsc\r\n" );
csFileName = g_stTheGlobalData.csMainDirectory + "\\Gamedata\\Game.dsc";
if( ! fGameDsc.Open( csFileName, CFile::modeReadWrite ) )
{
AfxMessageBox( "Unable to open game.dsc !", MB_OK | MB_ICONSTOP );
fn_vOutputLine( "\tUnable to open game.dsc !\r\n" );
fn_vOutputLine( csEditYourself );
return STATUS_C_Error;
}
bFound = FALSE;
while( !bFound )
{
dwCurrentSeek = fGameDsc.GetPosition();
if( ! fGameDsc.ReadString( csLine ) )
{
csOutput = "\tThe line " + csLineToFind + " was not found in game.dsc.\r\n";
fn_vOutputLine( csOutput );
fn_vOutputLine( csEditYourself );
return STATUS_C_Error;
}
if( csLine.Find( csLineToFind ) != -1 )
{
int iFind = csLine.Find( ';' );
if( iFind != -1 )
{
csLine.SetAt( iFind, ' ' );
fGameDsc.Seek( dwCurrentSeek, CFile::begin );
fGameDsc.WriteString( csLine );
}
bFound = TRUE;
}
} // End while
fGameDsc.Close();
return STATUS_C_OK;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
UINT fn_uiThreadMakeBigFileTextures( LPVOID _p_vParam )
{
CString csSourceDirectory;
CString csDestDirectory;
CString csTmp, csTmp2;
CString csOutput;
char szExeName[512];
char szCommandLine[512];
tdeStatus eStatus;
fn_vOutputLine( "Making gf textures bigfile...\r\n" );
if( ! fn_bCheckFileExistanceInStartupDir( "convimg.exe" )
|| ! fn_bCheckFileExistanceInStartupDir( "concat.exe" ) )
AfxEndThread( (UINT)STATUS_C_Error );
csDestDirectory = (LPCTSTR)_p_vParam;
// Get and test temp directory
int iLength = csDestDirectory.GetLength() - 1;
if( iLength > 0 && csDestDirectory[iLength] == '\\' )
csDestDirectory.SetAt( iLength, 0 );
if( _access( csDestDirectory, 06 ) == -1 )
{
csOutput = "Error: Temp directory is not valid !\n(The directory '" + csDestDirectory + "' is not accessible.)";
AfxMessageBox( csOutput, MB_OK | MB_ICONSTOP );
fn_vOutputLine( "\tInvalid temp directory\r\n" );
AfxEndThread( STATUS_C_Error );
}
csDestDirectory += "\\textures";
fn_vOutputLine( "\tDeleting previous textures in temp directory\r\n" );
csTmp = csDestDirectory + "\\*.*";
if( (eStatus = fn_eDeleteFileOrDirectory( csTmp )) == STATUS_C_Error )
{
fn_vOutputLine( "\tUnable to clean temp directory\r\n" );
AfxEndThread( STATUS_C_Error );
}
if( eStatus == STATUS_C_UserBreak )
AfxEndThread( eStatus );
// First, convert and copy Gamedata\Vignette
fn_vOutputLine( "\tConverting Vignettes\r\n" );
sprintf( szExeName, "%s\\ConvImg.exe", (LPCTSTR)g_stTheGlobalData.csStartupDirectory );
csTmp = g_stTheGlobalData.csMainDirectory + "\\Gamedata\\Vignette";
sprintf(
szCommandLine,
"ConvImg.exe -SrcPath:%s -DstPath:%s -BMP -TGA",
(LPCTSTR)csTmp,
(LPCTSTR)csTmp );
if( (eStatus = fn_eSpawnAndWaitForProcessWithInputEvents( szExeName, szCommandLine )) != STATUS_C_OK )
AfxEndThread( eStatus );
csTmp += "\\*.gf";
csTmp2 = g_stTheGlobalData.csBinDirectory + "\\Vignette";
if( (eStatus = fn_eRecursiveFileCopy( csTmp, csTmp2 )) != STATUS_C_OK )
AfxEndThread( eStatus );
// Then convert all textures directories
for( int i=g_stTheGlobalData.a_csVersionDirectories.GetSize()-1; i>=0; i-- )
{
csOutput = "\tConverting textures from '" + g_stTheGlobalData.a_csVersionDirectories[i] + "'\r\n";
fn_vOutputLine( csOutput );
csTmp = g_stTheGlobalData.csMainDirectory + "\\" + g_stTheGlobalData.a_csVersionDirectories[i] + "\\World\\Graphics\\Textures";
sprintf(
szCommandLine,
"ConvImg.exe -SrcPath:%s -DstPath:%s -BMP -TGA",
(LPCTSTR)csTmp,
(LPCTSTR)csDestDirectory );
if( (eStatus = fn_eSpawnAndWaitForProcessWithInputEvents( szExeName, szCommandLine )) != STATUS_C_OK )
AfxEndThread( eStatus );
}
// Then, execute concat to make the bigfile.
fn_vOutputLine( "\tMaking file Gamedata\\Textures.cnt\r\n" );
sprintf( szExeName, "%s\\Concat.exe", (const char *)g_stTheGlobalData.csStartupDirectory );
csTmp = g_stTheGlobalData.csMainDirectory + "\\GameData\\Textures.cnt";
sprintf(
szCommandLine,
"Concat.exe -SrcPath:%s -DstFile:%s -SrcFlt:*.gf -Check -Xor",
(LPCTSTR)csDestDirectory,
(LPCTSTR)csTmp );
if( (eStatus = fn_eSpawnAndWaitForProcessWithInputEvents( szExeName, szCommandLine )) != STATUS_C_OK )
AfxEndThread( eStatus );
// Then, copy the bigfile into bin directory
fn_vOutputLine( "\tCopying Bigfile to bin directory\r\n" );
if( (eStatus = fn_eCopyFileOrDirectory( csTmp, g_stTheGlobalData.csBinDirectory )) != STATUS_C_OK )
AfxEndThread( eStatus );
// Clean the temporary directory.
fn_vOutputLine( "\tCleaning temp directory\r\n" );
csTmp = csDestDirectory + "\\*.*";
if( (eStatus = fn_eDeleteFileOrDirectory( csTmp )) == STATUS_C_Error )
{
fn_vOutputLine( "\tUnable to clean up temp directory\r\n" );
AfxEndThread( STATUS_C_Error );
}
if( eStatus == STATUS_C_UserBreak )
AfxEndThread( eStatus );
// At least, edit game.dsc to allow engine to load textures from bigfile.
if( (eStatus = fn_eEditGameDscForBigFile()) == STATUS_C_Error )
AfxEndThread( eStatus );
fn_vOutputLine( "\tBigfile making is successful !\r\n\r\n" );
AfxEndThread( STATUS_C_OK );
return STATUS_C_OK;
}

View File

@@ -0,0 +1,544 @@
#include "stdafx.h"
#include "file.h"
#include "globaldata.h"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tdeStatus fn_eCreateDirectory( const char *_szDirectory )
{
if ( (!CreateDirectory( _szDirectory, NULL )) && (GetLastError() != ERROR_ALREADY_EXISTS) )
{
char *p_szCur;
p_szCur = strchr( _szDirectory, '\\');
while (p_szCur != NULL)
{
*p_szCur = 0;
if ((!CreateDirectory (_szDirectory, NULL)) && (GetLastError() != ERROR_ALREADY_EXISTS) )
{
char szMessage[ 512 ];
sprintf( szMessage, "Can't create local path '%s'", _szDirectory );
AfxMessageBox( szMessage, MB_OK | MB_ICONSTOP );
return STATUS_C_Error;
}
*p_szCur++ = '\\';
p_szCur = strchr( p_szCur, '\\');
};
if ((!CreateDirectory (_szDirectory, NULL)) && (GetLastError() != ERROR_ALREADY_EXISTS) )
{
char szMessage[ 512 ];
sprintf( szMessage, "Can't create local path '%s'", _szDirectory );
AfxMessageBox( szMessage, MB_OK | MB_ICONSTOP );
return STATUS_C_Error;
}
}
return STATUS_C_OK;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Copy a file or a directory (no '\' at end of directory name !)
// Source may contain wilcards. Dest must be a path to a directory !
// If source is a directory, the copy is recursive
tdeStatus fn_eCopyFileOrDirectory( const char *_szSource, const char *_szDest )
{
HANDLE hCopyhandle;
WIN32_FIND_DATA stFindData;
int iNbCharactersForSourcePath;
char szSource[512];
char szDest[512];
tdeStatus eStatus;
if( (eStatus = fn_eCreateDirectory( _szDest )) != STATUS_C_OK )
return eStatus;
// No file to copy, nothing to do...
if( (hCopyhandle = FindFirstFile( _szSource, &stFindData )) == INVALID_HANDLE_VALUE )
return STATUS_C_OK;
iNbCharactersForSourcePath = (strrchr( _szSource, '\\' ) - _szSource);
do
{
// Skip . and ..
if( (stFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
&& ( (strcmp( stFindData.cFileName, ".") == 0)
|| strcmp( stFindData.cFileName, "..") == 0) )
continue;
strncpy( szSource, _szSource, iNbCharactersForSourcePath+1 );
szSource[iNbCharactersForSourcePath+1] = 0;
strcat( szSource, stFindData.cFileName );
sprintf( szDest, "%s\\%s", _szDest, stFindData.cFileName );
// If file is a directory
if( (stFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
{
strcat( szSource, "\\*.*" );
if( (eStatus = fn_eCopyFileOrDirectory( szSource, szDest )) != STATUS_C_OK )
return eStatus;
}
else
{
if( ! CopyFile( szSource, szDest, FALSE ) )
{
char szMessage[1024];
sprintf( szMessage, "Copy failed: '%s' to '%s", szSource, szDest );
AfxMessageBox( szMessage, MB_OK | MB_ICONSTOP );
return STATUS_C_Error;
}
}
// Test for end of work.
if( g_stTheGlobalData.bStopWork )
return STATUS_C_UserBreak;
} while( FindNextFile( hCopyhandle, &stFindData ) );
FindClose( hCopyhandle );
return STATUS_C_OK;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Copy some files to a directory. Function will also seach for files in sub-dirs of source.
// Source may contain wilcards. Dest must be a path to a directory !
tdeStatus fn_eRecursiveFileCopy( const char *_szSource, const char *_szDest )
{
HANDLE hDirectoryHandle;
WIN32_FIND_DATA stFindData;
int iNbCharactersForSourcePath;
char szSource[512];
char szDest[512];
tdeStatus eStatus;
// Copy this level of directory
if( (eStatus = fn_eCopyFileOrDirectory( _szSource, _szDest )) != STATUS_C_OK )
return eStatus;
// Now we are going to check for subdirs.
iNbCharactersForSourcePath = (strrchr( _szSource, '\\' ) - _szSource);
strncpy( szSource, _szSource, iNbCharactersForSourcePath+1 );
szSource[iNbCharactersForSourcePath+1] = 0;
strcat( szSource, "*.*" );
// No files in directory, nothing to do...
if( (hDirectoryHandle = FindFirstFile( szSource, &stFindData )) == INVALID_HANDLE_VALUE )
return STATUS_C_OK;
do
{
// Skip . and ..
if( (stFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
&& ( (strcmp( stFindData.cFileName, ".") == 0)
|| strcmp( stFindData.cFileName, "..") == 0) )
continue;
// We treat only directories
if( (stFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
{
strncpy( szSource, _szSource, iNbCharactersForSourcePath+1 );
szSource[iNbCharactersForSourcePath+1] = 0;
strcat( szSource, stFindData.cFileName );
strcat( szSource, _szSource+iNbCharactersForSourcePath );
sprintf( szDest, "%s\\%s", _szDest, stFindData.cFileName );
if( (eStatus = fn_eRecursiveFileCopy( szSource, szDest )) != STATUS_C_OK )
return eStatus;
}
// Test for end of work.
if( g_stTheGlobalData.bStopWork )
return STATUS_C_UserBreak;
} while( FindNextFile( hDirectoryHandle, &stFindData ) );
FindClose( hDirectoryHandle );
return STATUS_C_OK;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Moves file(s) or a directory (no '\' at end of directory name !)
// Source may contain wilcards. Dest must be a path to a directory !
tdeStatus fn_eMoveFileOrDirectory( const char *_szSource, const char *_szDest )
{
HANDLE hCopyhandle;
WIN32_FIND_DATA stFindData;
int iNbCharactersForSourcePath;
char szSource[512], szDest[512];
tdeStatus eStatus;
if( (eStatus = fn_eCreateDirectory( _szDest )) != STATUS_C_OK )
return eStatus;
// No file to copy, nothing to do...
if( (hCopyhandle = FindFirstFile( _szSource, &stFindData )) == INVALID_HANDLE_VALUE )
return STATUS_C_OK;
iNbCharactersForSourcePath = (strrchr( _szSource, '\\' ) - _szSource);
do
{
// Skip . and ..
if( (stFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
&& ( (strcmp( stFindData.cFileName, ".") == 0)
|| strcmp( stFindData.cFileName, "..") == 0) )
continue;
strncpy( szSource, _szSource, iNbCharactersForSourcePath+1 );
szSource[iNbCharactersForSourcePath+1] = 0;
strcat( szSource, stFindData.cFileName );
sprintf( szDest, "%s\\%s", _szDest, stFindData.cFileName );
if( ! MoveFile( szSource, szDest ) )
{
char szMessage[1024];
sprintf( szMessage, "Move failed: '%s' to '%s", szSource, szDest );
AfxMessageBox( szMessage, MB_OK | MB_ICONSTOP );
return STATUS_C_Error;
}
// Test for end of work.
if( g_stTheGlobalData.bStopWork )
return STATUS_C_UserBreak;
} while( FindNextFile( hCopyhandle, &stFindData ) );
FindClose( hCopyhandle );
return STATUS_C_OK;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Deletes file(s) or directory (no '\' at end of directory name !)
// Source may contain wilcards.
// If source is a directory, the delete is recursive.
tdeStatus fn_eDeleteFileOrDirectory( const char *_szSource )
{
HANDLE hDeletehandle;
WIN32_FIND_DATA stFindData;
int iNbCharactersForSourcePath;
char szSource[512];
tdeStatus eStatus;
// No file to delete, nothing to do...
if( (hDeletehandle = FindFirstFile( _szSource, &stFindData )) == INVALID_HANDLE_VALUE )
return STATUS_C_OK;
iNbCharactersForSourcePath = (strrchr( _szSource, '\\' ) - _szSource);
do
{
// Skip . and ..
if( (stFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
&& ( (strcmp( stFindData.cFileName, ".") == 0)
|| strcmp( stFindData.cFileName, "..") == 0) )
continue;
strncpy( szSource, _szSource, iNbCharactersForSourcePath+1 );
szSource[iNbCharactersForSourcePath+1] = 0;
strcat( szSource, stFindData.cFileName );
// If file is a directory
if( (stFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
{
strcat( szSource, "\\*.*" );
if( (eStatus = fn_eDeleteFileOrDirectory( szSource )) != STATUS_C_OK )
return eStatus;
*strrchr( szSource, '\\' ) = 0;
if( ! RemoveDirectory( szSource ) )
{
char szMessage[1024];
sprintf( szMessage, "Delete failed on '%s'", szSource );
AfxMessageBox( szMessage, MB_OK | MB_ICONSTOP );
return STATUS_C_Error;
}
}
else if( ! DeleteFile( szSource ) )
{
char szMessage[1024];
sprintf( szMessage, "Delete failed on '%s'", szSource );
AfxMessageBox( szMessage, MB_OK | MB_ICONSTOP );
return STATUS_C_Error;
}
// Test for end of work.
if( g_stTheGlobalData.bStopWork )
return STATUS_C_UserBreak;
} while( FindNextFile( hDeletehandle, &stFindData ) );
FindClose( hDeletehandle );
return STATUS_C_OK;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// This part deals with batch copy/move of files :
// Common files for all binarised maps (no files generated by binarisation nor sound or textures)
// files relative to main directory
char *g_a_szCommonFiles[] =
{
"Copy", "Gamedata\\Options\\current.cfg", "%bin%\\Options",
"End"
};
char *g_a_szFilesBeforeBinarize[] =
{
// Make sure main directory is clean
"Delete", "fix*.sna",
"Delete", "fix*.snd",
"Delete", "fix*.ptx",
"Delete", "fix*.gpt",
"Delete", "fix.rt?",
"Delete", "%level%*.sna",
"Delete", "%level%*.snd",
"Delete", "%level%*.ptx",
"Delete", "%level%*.gpt",
"Delete", "%level%.rt?",
"End"
};
char *g_a_szFilesAfterFirstPass[] =
{
// Get fix files from gamedata\world\levels
"Move", "Gamedata\\World\\Levels\\fix*", "",
"Rename", "Fix.sna", "Fix0.sna",
"Rename", "Fix.snd", "Fix0.snd",
"Rename", "Fix.ptx", "Fix0.ptx",
"Rename", "Fix.gpt", "Fix0.gpt",
// Get level files from gamedata\world\levels\<LevelName>
"Rename", "Gamedata\\World\\Levels\\%level%\\%level%.sna", "%level%0.sna",
"Rename", "Gamedata\\World\\Levels\\%level%\\%level%.snd", "%level%0.snd",
"Rename", "Gamedata\\World\\Levels\\%level%\\%level%.ptx", "%level%0.ptx",
"Rename", "Gamedata\\World\\Levels\\%level%\\%level%.gpt", "%level%0.gpt",
"End"
};
char *g_a_szFilesAfterSecondPass[] =
{
// Get fix files from gamedata\world\levels
"Move", "Gamedata\\World\\Levels\\fix*", "",
"Rename", "Fix.sna", "Fix1.sna",
"Rename", "Fix.snd", "Fix1.snd",
"Rename", "Fix.ptx", "Fix1.ptx",
"Rename", "Fix.gpt", "Fix1.gpt",
// Get level files from gamedata\world\levels\<LevelName>
"Rename", "Gamedata\\World\\Levels\\%level%\\%level%.sna", "%level%1.sna",
"Rename", "Gamedata\\World\\Levels\\%level%\\%level%.snd", "%level%1.snd",
"Rename", "Gamedata\\World\\Levels\\%level%\\%level%.ptx", "%level%1.ptx",
"Rename", "Gamedata\\World\\Levels\\%level%\\%level%.gpt", "%level%1.gpt",
"End"
};
char *g_a_szFixFilesAfterCRB[] =
{
// Delete previous fix files
"Delete", "%bin%\\World\\Levels\\fix*",
"Delete", "%bin%\\Game.dsb",
// Delete files from second pass
"Delete", "Fix1.*",
// We will use files from first pass.
"Rename", "Fix0.sna", "Fix.sna",
"Rename", "Fix0.snd", "Fix.snd",
"Rename", "Fix0.ptx", "Fix.ptx",
"Rename", "Fix0.gpt", "Fix.gpt",
"Move", "Fix.*", "%bin%\\World\\Levels",
// "Move", "Fix.rt?", "%bin%\\World\\Levels",
"Move", "Gamedata\\Game.dsb", "%bin%",
"End"
};
char *g_a_szDeleteFixFilesAfterCRB[] =
{
// Delete fix files
"Delete", "fix*.sna",
"Delete", "fix*.snd",
"Delete", "fix*.ptx",
"Delete", "fix*.gpt",
"Delete", "fix.rt?",
"End"
};
char *g_a_szLevelFilesAfterCRB[] =
{
// Delete files from second pass
"Delete", "%level%1.*",
// We will use files from first pass.
"Rename", "%level%0.sna", "%level%.sna",
"Rename", "%level%0.snd", "%level%.snd",
"Rename", "%level%0.ptx", "%level%.ptx",
"Rename", "%level%0.gpt", "%level%.gpt",
// Delete bin level directory
"Delete", "%bin%\\World\\Levels\\%level%\\*.*",
// Move all files to destination directory
"Move", "%level%*", "%bin%\\World\\Levels\\%level%",
"Move", "Gamedata\\World\\Levels\\%level%\\%level%.dsb", "%bin%\\World\\Levels\\%level%",
"End"
};
char *g_a_szDeleteFilesAfterBinarize[] =
{
// Delete all remaining files in main directory
"Delete", "fix*.sna",
"Delete", "fix*.snd",
"Delete", "fix*.ptx",
"Delete", "fix*.gpt",
"Delete", "fix.rt?",
"Delete", "%level%*.sna",
"Delete", "%level%*.snd",
"Delete", "%level%*.ptx",
"Delete", "%level%*.gpt",
"Delete", "%level%.rt?",
// Also delete files in level
"Delete", "Gamedata\\Game.dsb",
"Delete", "Gamedata\\World\\Levels\\%level%\\%level%.dsb",
"End"
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Analyse keyword
// Used by fn_eTreatArrayOfFiles
int fn_iGetKeyword( char *_szKeyword )
{
if( stricmp( _szKeyword, "Copy" )==0 )
return 0;
else if( stricmp( _szKeyword, "Move" )==0 )
return 1;
else if( stricmp( _szKeyword, "Rename" )==0 )
return 2;
else if( stricmp( _szKeyword, "Delete" )==0 )
return 3;
else if( stricmp( _szKeyword, "End" )==0 )
return 4;
return -1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Analyse parameter
// Used by fn_eTreatArrayOfFiles
void fn_vGetParameter( char *_szResult, char *_szParam, tdstCopyFileContext *_p_stContext )
{
char *p_cSource = _szParam, *p_cDest = _szResult;
// hack: if no %bin%, assume path is main directory
if( strnicmp( p_cSource, "%bin%", 5 ) == 0 )
{
strcpy( p_cDest, _p_stContext->csBinDirectory );
p_cDest += strlen( p_cDest );
p_cSource += 5;
}
else
{
strcpy( p_cDest, _p_stContext->csMainDirectory );
p_cDest += strlen( p_cDest );
if( *p_cSource ) *p_cDest++ = '\\';
}
while( *p_cSource )
{
if( strnicmp( p_cSource, "%level%", 7 ) == 0 )
{
strcpy( p_cDest, _p_stContext->csLevelName );
p_cDest += strlen( p_cDest );
p_cSource += 7;
}
else
{
*p_cDest++ = *p_cSource++;
}
}
*p_cDest = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Execute copy/move/deletes/rename commands in given array
// See above for exemples.
// stContext contains strings used when replacing %bin%, %level%....
tdeStatus fn_eTreatArrayOfFiles( char *_a_szFileCommands[], tdstCopyFileContext *_p_stContext )
{
char szSource[512], szDest[512];
int iKeyWord;
tdeStatus eCommandOK;
char **p_szCommand = _a_szFileCommands;
do
{
switch( fn_iGetKeyword( *p_szCommand++ ) )
{
case 0: // Copy
fn_vGetParameter( szSource, *p_szCommand++, _p_stContext );
fn_vGetParameter( szDest, *p_szCommand++, _p_stContext );
eCommandOK = fn_eCopyFileOrDirectory( szSource, szDest );
break;
case 1: // Move
fn_vGetParameter( szSource, *p_szCommand++, _p_stContext );
fn_vGetParameter( szDest, *p_szCommand++, _p_stContext );
eCommandOK = fn_eMoveFileOrDirectory( szSource, szDest );
break;
case 2: // Rename
fn_vGetParameter( szSource, *p_szCommand++, _p_stContext );
fn_vGetParameter( szDest, *p_szCommand++, _p_stContext );
eCommandOK = STATUS_C_OK;
if( ! MoveFile( szSource, szDest ) )
{
char szMessage[1024];
sprintf( szMessage, "Move failed: '%s' to '%s", szSource, szDest );
AfxMessageBox( szMessage, MB_OK | MB_ICONSTOP );
eCommandOK = STATUS_C_Error;
}
break;
case 3: // Delete
fn_vGetParameter( szSource, *p_szCommand++, _p_stContext );
eCommandOK = fn_eDeleteFileOrDirectory( szSource );
break;
case 4: // End
return STATUS_C_OK;
break;
default: // Error in array !
ASSERT(0);
iKeyWord = -1;
eCommandOK = STATUS_C_Error;
break;
}
} while( eCommandOK == STATUS_C_OK );
return eCommandOK;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@@ -0,0 +1,131 @@
// panelafter.cpp : implementation file
//
#include "stdafx.h"
#include "binarytool.h"
#include "globaldata.h"
#include "process.h"
#include "panelafter.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPanelAfter dialog
CPanelAfter::CPanelAfter(CWnd* pParent /*=NULL*/)
: CPanel(CPanelAfter::IDD, pParent)
{
//{{AFX_DATA_INIT(CPanelAfter)
//}}AFX_DATA_INIT
_tcscpy( m_szTitle, _T("Post-Binarization") );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelAfter::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPanelAfter)
DDX_Control(pDX, IDC_EDIT_SizeOfBigFile, m_EditSizeOfBigFile);
DDX_Control(pDX, IDC_CHECK_DeleteRelocTables, m_CheckDeleteRelocTables);
//}}AFX_DATA_MAP
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BEGIN_MESSAGE_MAP(CPanelAfter, CDialog)
//{{AFX_MSG_MAP(CPanelAfter)
ON_BN_CLICKED(IDC_BUTTON_GenerateBigFile, OnBUTTONGenerateBigFile)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CPanelAfter::Create( CWnd* pParentWnd )
{
BOOL bResult = CDialog::Create( IDD, pParentWnd );
if( bResult )
{
// Read registry, update controls
CWinApp *p_oApp = AfxGetApp();
CString csSection = m_szTitle;
UINT uiSize = p_oApp -> GetProfileInt( csSection, _T("BigFileSize"), 1 );
CString csSize;
csSize.Format( "%u", uiSize );
m_EditSizeOfBigFile.SetWindowText( csSize );
m_CheckDeleteRelocTables.SetCheck( p_oApp -> GetProfileInt( csSection, _T("DeleteRelocTables"), 0 ) );
}
return bResult;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPanelAfter::m_fn_vUpdateRegistry()
{
CWinApp *p_oApp = AfxGetApp();
CString csSection = m_szTitle;
CString csSize;
m_EditSizeOfBigFile.GetWindowText( csSize );
p_oApp -> WriteProfileInt( csSection, _T("BigFileSize"), atoi(csSize) );
p_oApp -> WriteProfileInt( csSection, _T("DeleteRelocTables"), m_CheckDeleteRelocTables.GetCheck() );
}
/////////////////////////////////////////////////////////////////////////////
// CPanelAfter message handlers
void CPanelAfter::OnBUTTONGenerateBigFile()
{
char szCommandLine[512];
char szExeName[512];
CString csGamedata;
CString csBigFileSize;
m_EditSizeOfBigFile.GetWindowText( csBigFileSize );
UINT uiBigFileSize = atoi( csBigFileSize );
if( uiBigFileSize == 0 )
{
AfxMessageBox( "Please specify a size for the bigfile", MB_OK | MB_ICONSTOP );
return;
}
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyStartOfWork();
fn_vOutputLine( "Generating BigFile for relocation tables...\r\n" );
csGamedata = g_stTheGlobalData.csMainDirectory + "\\Gamedata";
sprintf( szExeName, "%s\\BigFileTool.exe", (LPCTSTR)g_stTheGlobalData.csStartupDirectory );
sprintf(
szCommandLine,
"%s -scriptpath:%s -binarypath:%s -bigfilesize:%s -autorun -generateinfo -startprg",
szExeName,
(LPCTSTR)csGamedata,
(LPCTSTR)g_stTheGlobalData.csBinDirectory,
(LPCTSTR)csBigFileSize );
if( fn_eSpawnAndWaitForProcessWithInputEvents( szExeName, szCommandLine ) == STATUS_C_Error )
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyEndOfWork( TRUE );
else
g_stTheGlobalData.p_oMainDlg -> m_fn_vNotifyEndOfWork( FALSE );
}

View File

@@ -0,0 +1,577 @@
#include "stdafx.h"
#include <stdio.h>
#include <shlobj.h>
#include <io.h>
#include "util.h"
#include "GlobalData.h"
#include "file.h"
int __stdcall BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
LPCTSTR p_szInitialDir = (LPCTSTR)lpData;
if( uMsg == BFFM_INITIALIZED && p_szInitialDir && strlen( p_szInitialDir ) > 0 )
{
::SendMessage( hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)p_szInitialDir );
}
return 0;
}
// Ask the user to choose a directory and return the selected directory.
// Return an empty string if no dir selected.
// Parameter is the string that willl be displayed in dlg box (ie: "Choose directory" )
CString fn_csBrowseDirectory( LPCTSTR _p_szTitle, LPCTSTR _p_szDefaultDir /*= NULL*/ )
{
BROWSEINFO stOpen;
ITEMIDLIST *p_stItem;
TCHAR szDirName[_MAX_PATH];
memset( &stOpen, 0, sizeof(stOpen) );
stOpen.hwndOwner = g_stTheGlobalData.p_oMainDlg->m_hWnd;
stOpen.pidlRoot = NULL;
stOpen.pszDisplayName = szDirName;
stOpen.lpszTitle = _p_szTitle;
stOpen.ulFlags = BIF_RETURNFSANCESTORS|BIF_RETURNONLYFSDIRS|BIF_DONTGOBELOWDOMAIN;
stOpen.lpfn = BrowseCallbackProc;
stOpen.lParam = (LPARAM)_p_szDefaultDir;
stOpen.iImage = 0;
if( (p_stItem = SHBrowseForFolder( &stOpen )) != NULL )
{
SHGetPathFromIDList( p_stItem, szDirName );
return CString( szDirName );
}
return CString( _T("") );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Read version.ini file and update GlobalData
BOOL fn_bReadVersionFile()
{
TCHAR szText[1024];
char szFileName[512];
FILE *hVersion;
// Empty array of directory
g_stTheGlobalData.a_csVersionDirectories.RemoveAll();
g_stTheGlobalData.a_csVersionDirectories.SetSize( 0, 5 );
sprintf( szFileName, "%s\\version.ini", (const char *)g_stTheGlobalData.csMainDirectory );
hVersion = fopen( szFileName, "rb" );
if( ! hVersion )
{
/*
sprintf( szText, "Error: Cannot read file '%s'", szFileName );
AfxMessageBox( szText, MB_OK | MB_ICONSTOP );
return FALSE;
*/
// Assuming all game data is in GameData.
return TRUE;
}
// Check directories in version.ini
char szOtherDataDirs[255];
char *szToken;
char szDelimiters[] = " ;,\t";
fgets( szOtherDataDirs, 255, hVersion );
fclose( hVersion );
// suppress last char (EOL)
szOtherDataDirs[strlen(szOtherDataDirs)-2] = NULL;
// get all directories
szToken = strtok( szOtherDataDirs, szDelimiters );
for( ; szToken; szToken = strtok( NULL, szDelimiters ) )
{
g_stTheGlobalData.a_csVersionDirectories.Add( szToken );
// Test access to directories in version.ini
sprintf( szFileName, "%s\\%s", (const char *)g_stTheGlobalData.csMainDirectory, szToken );
DWORD dwAttr = GetFileAttributes( szFileName );
if( (dwAttr | FILE_ATTRIBUTE_DIRECTORY) == 0 || dwAttr == 0xffffffff )
{
g_stTheGlobalData.a_csVersionDirectories.RemoveAll();
sprintf( szText, "Error: Version.ini contains reference to directory '%s', that is not acessible.", szFileName );
AfxMessageBox( szText, MB_OK | MB_ICONSTOP );
return FALSE;
}
}
return TRUE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Read SoundVersion.ini file and update GlobalData
BOOL fn_bReadSoundVersionFile()
{
TCHAR szText[1024];
char szFileName[512];
FILE *hVersion;
// Empty array of directory
g_stTheGlobalData.a_csSoundVersionDirectories.RemoveAll();
g_stTheGlobalData.a_csSoundVersionDirectories.SetSize( 0, 5 );
sprintf( szFileName, "%s\\SoundVersion.ini", (const char *)g_stTheGlobalData.csMainDirectory );
hVersion = fopen( szFileName, "rb" );
if( ! hVersion )
{
// No SoundVersion.ini, check version.ini
if( g_stTheGlobalData.a_csVersionDirectories.GetSize() > 0 )
{
g_stTheGlobalData.a_csSoundVersionDirectories.Copy( g_stTheGlobalData.a_csVersionDirectories );
}
// else, we assume all sound data is in GameData.
return TRUE;
}
// Check directories in version.ini
char szOtherDataDirs[255];
char *szToken;
char szDelimiters[] = " ;,\t";
fgets( szOtherDataDirs, 255, hVersion );
fclose( hVersion );
// suppress last char (EOL)
szOtherDataDirs[strlen(szOtherDataDirs)-2] = NULL;
// get all directories
szToken = strtok( szOtherDataDirs, szDelimiters );
for( ; szToken; szToken = strtok( NULL, szDelimiters ) )
{
g_stTheGlobalData.a_csSoundVersionDirectories.Add( szToken );
// Test access to directories in version.ini
sprintf( szFileName, "%s\\%s", (const char *)g_stTheGlobalData.csMainDirectory, szToken );
DWORD dwAttr = GetFileAttributes( szFileName );
if( (dwAttr | FILE_ATTRIBUTE_DIRECTORY) == 0 || dwAttr == 0xffffffff )
{
g_stTheGlobalData.a_csSoundVersionDirectories.RemoveAll();
sprintf( szText, "Error: SoundVersion.ini contains reference to directory '%s' that is not acessible.", szFileName );
AfxMessageBox( szText, MB_OK | MB_ICONSTOP );
return FALSE;
}
}
return TRUE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Add a line of text in the CEdit control used for displaying results.
// Line must be terminated by "\r\n" for carriage return.
void fn_vOutputLine( const TCHAR *_p_szLine )
{
int iTxtLen = g_stTheGlobalData.p_oEditResults -> GetWindowTextLength();
g_stTheGlobalData.p_oEditResults -> SetSel( iTxtLen, iTxtLen, TRUE );
g_stTheGlobalData.p_oEditResults -> ReplaceSel( _p_szLine );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
UINT fn_uiThreadCopySoundDirectory( LPVOID _p_stParam )
{
char szSourceDir[512], szTargetDir[512];
tdeStatus eStatus;
_p_stParam = _p_stParam;
fn_vOutputLine( "Copying sound directory...\r\n" );
sprintf( szTargetDir, "%s\\World\\Sound", (const char *)g_stTheGlobalData.csBinDirectory );
// Copy from all directories of soundversion.ini
for( int i=g_stTheGlobalData.a_csSoundVersionDirectories.GetSize()-1; i>=0; i-- )
{
sprintf( szSourceDir, "\tCopying sound from %s\r\n", (LPCTSTR)g_stTheGlobalData.a_csSoundVersionDirectories[i] );
fn_vOutputLine( szSourceDir );
sprintf( szSourceDir, "%s\\%s\\World\\Sound\\*.*", (const char *)g_stTheGlobalData.csMainDirectory, (LPCTSTR)g_stTheGlobalData.a_csSoundVersionDirectories[i] );
if( (eStatus = fn_eCopyFileOrDirectory( szSourceDir, szTargetDir )) != STATUS_C_OK )
AfxEndThread( (UINT)eStatus );
}
// Copy sound from Gamedata
fn_vOutputLine( "\tCopying sound from Gamedata\r\n" );
sprintf( szSourceDir, "%s\\Gamedata\\World\\Sound\\*.*", (const char *)g_stTheGlobalData.csMainDirectory );
if( (eStatus = fn_eCopyFileOrDirectory( szSourceDir, szTargetDir )) != STATUS_C_OK )
AfxEndThread( eStatus );
fn_vOutputLine( "\tCopy complete !\r\n\r\n" );
AfxEndThread( STATUS_C_OK );
return STATUS_C_OK;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Update the file startprg.ini (old version)
void fn_vUpdateStartPrg_old()
{
char szStartPrg[512];
char szSection[20];
char szVersion[20];
char szKey[50];
/*
[Start]
DscCreated=1
AskAtEachTime=1
UseBinaryData=1
GDReleaseBin=databin
BinReleaseIsOk=1
*/
sprintf( szStartPrg, "%s\\StartPrg.ini", (const char *)g_stTheGlobalData.csMainDirectory );
strcpy( szSection, "START") ;
if( g_stTheGlobalData.bDebugVersion )
strcpy( szVersion, "Debug" );
else
strcpy( szVersion, "Release" );
WritePrivateProfileString( szSection, "DscCreated", "1", szStartPrg );
WritePrivateProfileString( szSection, "UseBinaryData", "1", szStartPrg );
sprintf( szKey, "Bin%sIsOk", szVersion );
WritePrivateProfileString( szSection, szKey, "1", szStartPrg );
// If bin directory is a subdir of main
int iMainLength = g_stTheGlobalData.csMainDirectory.GetLength();
int iBinLength = g_stTheGlobalData.csBinDirectory.GetLength();
CString csDir;
if( strnicmp( g_stTheGlobalData.csBinDirectory, g_stTheGlobalData.csMainDirectory, iMainLength ) == 0 )
{
if( iMainLength == iBinLength )
csDir = ".";
else
csDir = g_stTheGlobalData.csBinDirectory.Mid( iMainLength+1 );
}
else
{
csDir = g_stTheGlobalData.csBinDirectory;
}
sprintf( szKey, "GD%sBin", szVersion );
WritePrivateProfileString( szSection, szKey, csDir, szStartPrg );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Update the file startprg.ini
void fn_vUpdateStartPrg()
{
char szStartPrg[512];
char szSection[20];
sprintf( szStartPrg, "%s\\StartPrg.ini", (const char *)g_stTheGlobalData.csMainDirectory );
if( g_stTheGlobalData.bDebugVersion )
strcpy( szSection, "DEBUG" );
else
strcpy( szSection, "RELEASE" );
WritePrivateProfileString( szSection, "DscCreated", "1", szStartPrg );
WritePrivateProfileString( szSection, "BinDataIsOk", "1", szStartPrg );
// If bin directory is a subdir of main
int iMainLength = g_stTheGlobalData.csMainDirectory.GetLength();
int iBinLength = g_stTheGlobalData.csBinDirectory.GetLength();
CString csDir;
if( strnicmp( g_stTheGlobalData.csBinDirectory, g_stTheGlobalData.csMainDirectory, iMainLength ) == 0 )
{
if( iMainLength == iBinLength )
csDir = ".";
else
csDir = g_stTheGlobalData.csBinDirectory.Mid( iMainLength+1 );
}
else
{
csDir = g_stTheGlobalData.csBinDirectory;
}
WritePrivateProfileString( szSection, "BinDirectory", csDir, szStartPrg );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Try to find szSubString in szString.
// Comparaison is case INSENSITIVE.
const char *stristr( const char *szString, const char *szSubString )
{
const char *p_szSrcCur;
const char *p_szToFindCur;
const char *p_szSrcStartFind;
p_szSrcStartFind = szString;
p_szToFindCur = szSubString;
for( p_szSrcCur = szString; *p_szSrcCur && *p_szToFindCur; p_szSrcCur++ )
{
if( tolower( *p_szSrcCur ) == tolower( *p_szToFindCur ) )
{
if( ! p_szSrcStartFind )
p_szSrcStartFind = p_szSrcCur;
p_szToFindCur ++;
}
else
{
p_szToFindCur = szSubString;
p_szSrcStartFind = NULL;
}
}
if( *p_szToFindCur == '\0' )
return p_szSrcStartFind;
return NULL;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void fn_vDisableRelocTableBigFile()
{
char szFile[512];
sprintf( szFile, "%s\\StartPrg.ini", (LPCTSTR)g_stTheGlobalData.csMainDirectory );
WritePrivateProfileString( "Start", "UsesBigFile", "No", szFile );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fn_bCheckFileExistanceInStartupDir( CString csFileName )
{
char szFileName[512];
sprintf( szFileName, "%s\\%s", (LPCTSTR)g_stTheGlobalData.csStartupDirectory, (LPCTSTR)csFileName );
if( _access( szFileName, 4 ) == 0 )
return TRUE;
fn_vOutputLine( "\tFile '" );
fn_vOutputLine( szFileName );
fn_vOutputLine( "' is missing.\r\n" );
return FALSE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// When user changes main directory, we validate his choice
// and we read some usefull files (ie: version.ini, soundversion.ini)
// Note: game.dsc is red later, when user goes into the panel "Levels"
BOOL fn_bValidateMainDirectorySetting()
{
TCHAR szFilename[512];
TCHAR szText[1024];
// Clear associated settings
g_stTheGlobalData.a_csLevelNames.RemoveAll();
g_stTheGlobalData.a_csSoundVersionDirectories.RemoveAll();
g_stTheGlobalData.a_csVersionDirectories.RemoveAll();
// Get new directory
g_stTheGlobalData.csMainDirectory.TrimLeft();
g_stTheGlobalData.csMainDirectory.TrimRight();
if( g_stTheGlobalData.csMainDirectory.IsEmpty() )
{
AfxMessageBox( "Please choose a path for main directory.", MB_OK | MB_ICONSTOP );
return FALSE;
}
// Remove trailing '\' if it exists
int iLength = g_stTheGlobalData.csMainDirectory.GetLength();
if( iLength > 0 && g_stTheGlobalData.csMainDirectory.GetAt( iLength-1 ) == '\\' )
{
g_stTheGlobalData.csMainDirectory.SetAt( iLength-1, ' ' );
g_stTheGlobalData.csMainDirectory.TrimRight();
}
// Test if we can write in this directory
if( _access( g_stTheGlobalData.csMainDirectory, 06 ) == -1 )
{
sprintf( szText, "Error: Main directory is not valid !\n(The directory '%s' is not accessible.)", (const char *)g_stTheGlobalData.csMainDirectory );
AfxMessageBox( szText, MB_OK | MB_ICONSTOP );
return FALSE;
}
// Test if the directory gamedata is present
sprintf( szFilename, "%s\\Gamedata", (const char *)g_stTheGlobalData.csMainDirectory );
if( _access( szFilename, 04) == -1 )
{
sprintf( szText, "Error: Main directory is not valid !\nThe directory '%s' is not accessible.", szFilename );
AfxMessageBox( szText, MB_OK | MB_ICONSTOP );
return FALSE;
}
// Read version.ini
if( ! fn_bReadVersionFile() ) return FALSE;
// Read SoundVersion.ini. Must be read after version.ini because it can use directory found in it
if( ! fn_bReadSoundVersionFile() ) return FALSE;
// We read game.dsc for list of maps
if( ! g_stTheGlobalData.p_oMainDlg -> m_fn_bRefreshLevelList() )
return FALSE;
// We have read everything, all seems to be ok.
return TRUE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Test validity of selected binary directory.
BOOL fn_bValidateBinDirectorySetting()
{
g_stTheGlobalData.csBinDirectory.TrimLeft();
g_stTheGlobalData.csBinDirectory.TrimRight();
if( g_stTheGlobalData.csBinDirectory.IsEmpty() )
{
AfxMessageBox( "Please choose a path for binary directory.", MB_OK | MB_ICONSTOP );
return FALSE;
}
// Remove trailing '\' if it exists
int iLength = g_stTheGlobalData.csBinDirectory.GetLength();
if( iLength > 0 && g_stTheGlobalData.csBinDirectory.GetAt( iLength-1 ) == '\\' )
{
g_stTheGlobalData.csBinDirectory.SetAt( iLength-1, ' ' );
g_stTheGlobalData.csBinDirectory.TrimRight();
}
// Try to create the directory
if( fn_eCreateDirectory( g_stTheGlobalData.csBinDirectory ) == STATUS_C_Error )
{
AfxMessageBox( "Error: Unable to create binary directory !", MB_OK | MB_ICONSTOP );
return FALSE;
}
// We need write access on this directory
if( _access( g_stTheGlobalData.csBinDirectory, 06 ) == -1 )
{
TCHAR szText[1024];
sprintf( szText, "Error: Binary directory is not valid !\n(The directory '%s' is not accessible.)", (const char *)g_stTheGlobalData.csBinDirectory );
AfxMessageBox( szText, MB_OK | MB_ICONSTOP );
return FALSE;
}
return TRUE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Test validity of selected game executable
BOOL fn_bValidateGameExeSetting()
{
TCHAR szFilename[512];
// Get new file name
g_stTheGlobalData.csExeName.TrimLeft();
g_stTheGlobalData.csExeName.TrimRight();
if( g_stTheGlobalData.csExeName.IsEmpty() )
{
AfxMessageBox( "Please choose the engine executable.", MB_OK | MB_ICONSTOP );
return FALSE;
}
if( g_stTheGlobalData.bDebugVersion )
g_stTheGlobalData.csExecutableNames[1] = g_stTheGlobalData.csExeName;
else
g_stTheGlobalData.csExecutableNames[0] = g_stTheGlobalData.csExeName;
sprintf( szFilename, "%s\\%s", g_stTheGlobalData.csMainDirectory, g_stTheGlobalData.csExeName );
// We need read access on this file
if( _access( szFilename, 06 ) == -1 )
{
TCHAR szText[1024];
sprintf( szText, "Error: File '%s' is not valid ! (not accessible)", szFilename );
AfxMessageBox( szText, MB_OK | MB_ICONSTOP );
return FALSE;
}
return TRUE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void fn_vMakeSndParserCommandLine( char *szCommandLine )
{
int iCmdLineCount = 0;
iCmdLineCount = sprintf(
szCommandLine,
"%s\\rm2SndParser.exe -TableType:0 -Language:English -Anims:\"%s\\Gamedata\\World\\Graphics\\Anims\" -Anims:\"%s\\Gamedata\\World\\Levels\\_common\\families\"",
(LPCTSTR)g_stTheGlobalData.csStartupDirectory,
(LPCTSTR)g_stTheGlobalData.csMainDirectory,
(LPCTSTR)g_stTheGlobalData.csMainDirectory );
// Add specific gamedata to command line
if( g_stTheGlobalData.a_csSoundVersionDirectories.GetSize() > 0 )
{
iCmdLineCount += sprintf( szCommandLine+iCmdLineCount,
" -CommonGamedata:\"%s\\Gamedata\" -Gamedata:\"%s\\%s\" -LcbFile:\"%s\\%s\\World\\Sound\\Rayman2.lcb\"",
(LPCTSTR)g_stTheGlobalData.csMainDirectory,
(LPCTSTR)g_stTheGlobalData.csMainDirectory,
(LPCTSTR)g_stTheGlobalData.a_csSoundVersionDirectories[0],
(LPCTSTR)g_stTheGlobalData.csMainDirectory,
(LPCTSTR)g_stTheGlobalData.a_csSoundVersionDirectories[0] );
}
else
{
iCmdLineCount += sprintf( szCommandLine+iCmdLineCount,
" -Gamedata:\"%s\\Gamedata\" -LcbFile:\"%s\\%s\\World\\Sound\\Rayman2.lcb\"",
(LPCTSTR)g_stTheGlobalData.csMainDirectory,
(LPCTSTR)g_stTheGlobalData.csMainDirectory,
(LPCTSTR)g_stTheGlobalData.csMainDirectory );
}
// Add specific anim paths to command line
for( int i=0; i<g_stTheGlobalData.a_csVersionDirectories.GetSize(); i++ )
{
iCmdLineCount += sprintf( szCommandLine+iCmdLineCount,
" -Anims:\"%s\\%s\\World\\Graphics\\Anims\" -Anims:\"%s\\%s\\World\\Levels\\_common\\families\"",
(LPCTSTR)g_stTheGlobalData.csMainDirectory,
(LPCTSTR)g_stTheGlobalData.a_csVersionDirectories[i],
(LPCTSTR)g_stTheGlobalData.csMainDirectory,
(LPCTSTR)g_stTheGlobalData.a_csVersionDirectories[i] );
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// compute short name of exe (without path and extension).
void fn_vGetShortExeName( char *_szShortExeName, char *_szLongExeName )
{
int iPathLength, iExeNameLength;
if( (iPathLength = strrchr( _szLongExeName, '\\' ) - _szLongExeName) < 0 )
iPathLength = -1;
if( (iExeNameLength = strrchr( _szLongExeName, '.' ) - _szLongExeName - (iPathLength > 0 ? iPathLength : 0) - 1) > 0 )
{
strncpy( _szShortExeName, &_szLongExeName[iPathLength+1], iExeNameLength );
_szShortExeName[iExeNameLength] = '\0';
}
else
strcpy( _szShortExeName, &_szLongExeName[iPathLength+1] );
}