From 2a4d990a91310cdaf067375ac1b3fe2984bd6e0c Mon Sep 17 00:00:00 2001
From: xezon <4720891+xezon@users.noreply.github.com>
Date: Mon, 21 Apr 2025 16:56:51 +0200
Subject: [PATCH 1/2] [GEN][ZH] Unify the Autorun tool with changes from JFS
(#739)
---
Generals/Code/CMakeLists.txt | 4 +
Generals/Code/Tools/Autorun/AUTORUN.RC | 25 ++++-
Generals/Code/Tools/Autorun/CMakeLists.txt | 2 +-
Generals/Code/Tools/Autorun/ViewHTML.cpp | 14 ++-
Generals/Code/Tools/Autorun/autorun.cpp | 125 +++++++++++++--------
Generals/Code/Tools/Autorun/autorun.h | 32 ++++--
Generals/Code/Tools/Autorun/resource.h | 34 ++++--
GeneralsMD/Code/CMakeLists.txt | 4 +
GeneralsMD/Code/Tools/Autorun/AUTORUN.RC | 1 +
GeneralsMD/Code/Tools/Autorun/CDCNTRL.CPP | 2 +-
GeneralsMD/Code/Tools/Autorun/autorun.cpp | 6 +-
GeneralsMD/Code/Tools/Autorun/autorun.h | 18 ++-
12 files changed, 185 insertions(+), 82 deletions(-)
diff --git a/Generals/Code/CMakeLists.txt b/Generals/Code/CMakeLists.txt
index df161451123..838818eff2f 100644
--- a/Generals/Code/CMakeLists.txt
+++ b/Generals/Code/CMakeLists.txt
@@ -19,6 +19,10 @@ target_include_directories(gi_libraries_source_wwvegas_ww3d2 INTERFACE "Librarie
target_include_directories(gi_libraries_source_wwvegas_wwmath INTERFACE "Libraries/Source/WWVegas/WWMath")
target_include_directories(gi_libraries_source_wwvegas_wwsaveload INTERFACE "Libraries/Source/WWVegas/WWSaveLoad")
target_include_directories(gi_main INTERFACE "Main")
+
+target_compile_definitions(gi_always INTERFACE
+ RTS_GENERALS=1
+)
target_link_libraries(gi_always INTERFACE
core_utility
gi_libraries_include
diff --git a/Generals/Code/Tools/Autorun/AUTORUN.RC b/Generals/Code/Tools/Autorun/AUTORUN.RC
index 32b103f665f..5b6b27f1ab1 100644
--- a/Generals/Code/Tools/Autorun/AUTORUN.RC
+++ b/Generals/Code/Tools/Autorun/AUTORUN.RC
@@ -138,9 +138,29 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Bitmap
//
+#if defined(APSTUDIO_INVOKED) || defined(_ENGLISH)
+#if defined(APSTUDIO_INVOKED)
+BACKGROUND$(_ENGLISH) BITMAP DISCARDABLE "Autorun_BG.bmp"
+#else
BACKGROUND BITMAP DISCARDABLE "Autorun_BG.bmp"
+#endif
+#endif
BUTTON_SEL BITMAP DISCARDABLE "ARButton_Sel.bmp"
BUTTON_REG BITMAP DISCARDABLE "ARButton_Reg.bmp"
+#if defined(APSTUDIO_INVOKED) || defined(_FRENCH)
+#if defined(APSTUDIO_INVOKED)
+BACKGROUND$(_FRENCH) BITMAP DISCARDABLE "AutoRun_Frn.bmp"
+#else
+BACKGROUND BITMAP DISCARDABLE "AutoRun_Frn.bmp"
+#endif
+#endif
+#if defined(APSTUDIO_INVOKED) || defined(_GERMAN)
+#if defined(APSTUDIO_INVOKED)
+BACKGROUND$(_GERMAN) BITMAP DISCARDABLE "AutoRun_Ger.bmp"
+#else
+BACKGROUND BITMAP DISCARDABLE "AutoRun_Ger.bmp"
+#endif
+#endif
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -150,13 +170,12 @@ BUTTON_REG BITMAP DISCARDABLE "ARButton_Reg.bmp"
1 TEXTINCLUDE DISCARDABLE
BEGIN
- "..\\resource.h\0"
+ "resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
+ "#include ""afxres.h""\0"
END
3 TEXTINCLUDE DISCARDABLE
diff --git a/Generals/Code/Tools/Autorun/CMakeLists.txt b/Generals/Code/Tools/Autorun/CMakeLists.txt
index ca4a5f09926..37ed3900d22 100644
--- a/Generals/Code/Tools/Autorun/CMakeLists.txt
+++ b/Generals/Code/Tools/Autorun/CMakeLists.txt
@@ -54,8 +54,8 @@ macro(setup_autorun appname)
target_sources(${appname} PRIVATE ${AUTORUN_SRC})
target_link_libraries(${appname} PRIVATE
- gi_always
core_config
+ gi_always
winmm
)
diff --git a/Generals/Code/Tools/Autorun/ViewHTML.cpp b/Generals/Code/Tools/Autorun/ViewHTML.cpp
index 4ea3f7d7558..a913eb514ba 100644
--- a/Generals/Code/Tools/Autorun/ViewHTML.cpp
+++ b/Generals/Code/Tools/Autorun/ViewHTML.cpp
@@ -79,18 +79,28 @@ bool ViewHTML(const char* url, bool wait, const CallbackHook& callback)
//--------------------------------------------------------------------------
// Create unique temporary HTML filename
+ // JFS: Fixed so that it would go to the temp folder which was crashing
+ // on limited users.
//--------------------------------------------------------------------------
char tempPath[MAX_PATH];
- GetWindowsDirectory(tempPath, MAX_PATH);
-
char filename1[MAX_PATH];
char filename2[MAX_PATH];
+
+ // Expand the TMP environment variable.
+ {
+ DWORD dwResult;
+ dwResult = ExpandEnvironmentStrings( "%TEMP%", tempPath, MAX_PATH);
+ if(dwResult == 0)
+ return false;
+ }
+
GetTempFileName(tempPath, "WS", 0, filename1);
strcpy( filename2, filename1 );
char* extPtr = strrchr(filename2, '.');
strcpy(extPtr, ".html");
+
// DebugPrint(filename);
Msg( __LINE__, TEXT(__FILE__), TEXT("filename = %s"), filename2 );
diff --git a/Generals/Code/Tools/Autorun/autorun.cpp b/Generals/Code/Tools/Autorun/autorun.cpp
index c2234b89e52..76c21d25ed5 100644
--- a/Generals/Code/Tools/Autorun/autorun.cpp
+++ b/Generals/Code/Tools/Autorun/autorun.cpp
@@ -149,8 +149,8 @@
#define SHOW_MOH_DEMO FALSE
#define BFAVI_FILENAME "Autorun\\BF1942RTR.avi"
-#define SC4AVI_FILENAME "Autorun\\SimCity4.avi"
-#define HELP_FILENAME "HELP:FILENAME"//"Support\\eahelp.hlp"
+#define SC4AVI_FILENAME "Autorun\\Preview.avi"
+#define HELP_FILENAME "HELP:FILENAME"//"Support\\eahelp.hlp"
#define SHOW_GAMESPY_BUTTON FALSE
#define GAMESPY_WEBSITE "http://www.gamespyarcade.com/features/launch.asp?svcname=ccrenegade&distID=391"
@@ -159,6 +159,8 @@
#define SETUP_INI_FILE1 "Setup\\Setup.ini"
#define SETUP_INI_FILE2 "Setup.ini"
+#define UNINSTALL_EXECUTABLE "IDriver.exe" // JFS
+
//-----------------------------------------------------------------------------
// These defines need the Product name from Setup.ini to complete.
//-----------------------------------------------------------------------------
@@ -170,8 +172,8 @@
#define GAME_WEBSITE "http://generals.ea.com"
#define AUTORUN_MUTEX_OBJECT "01AF9993-3492-11d3-8F6F-0060089C05B1"
-//#define GAME_MUTEX_OBJECT "C6D925A3-7A9B-4ca3-866D-8B4D506C3665"
-#define GAME_MUTEX_OBJECT "685EAFF2-3216-4265-B047-251C5F4B82F3"
+//#define GAME_MUTEX_OBJECT "C6D925A3-7A9B-4ca3-866D-8B4D506C3665"
+#define GAME_MUTEX_OBJECT "685EAFF2-3216-4265-B047-251C5F4B82F3"
#define PRODUCT_VOLUME_CD1 "Generals1"
#define PRODUCT_VOLUME_CD2 "Generals2"
@@ -201,6 +203,7 @@ char szWorldbuilderPath [_MAX_PATH];
char szPatchgetPath [_MAX_PATH];
char szSetupPath [_MAX_PATH];
char szUninstallPath [_MAX_PATH];
+char szUninstallCommandLine[_MAX_PATH]; // JFS: Returned value contains parameters needed.
char szRegisterPath [_MAX_PATH];
char szButtonWav [_MAX_PATH ];
char szSpeechWav [_MAX_PATH ];
@@ -568,7 +571,7 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd
Locale_GetString( "Autorun:Command&ConquerGenerals", szFullProductName );
//Locale_GetString( IDS_GAME_TITLE, szProductName );
//Locale_GetString( IDS_FULL_GAME_TITLE, szFullProductName );
-// Locale_GetString( IDS_REGISTRY_KEY, szRegistryKey );
+// Locale_GetString( IDS_REGISTRY_KEY, szRegistryKey ); // jfs
// Locale_GetString( IDS_MAIN_WINDOW, szGameWindow );
@@ -727,6 +730,16 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd
return 0;
}
+ //---------------------------------------------------------------------
+ // Check if another installshield session is already running. This happens
+ // because we ask the user to insert CD-1 again at the end of the install
+ // to prevent a crash on Windows ME where it tries to access CD-1 again.
+ //---------------------------------------------------------------------
+ prev = FindWindow( NULL,"InstallShield Wizard");
+ if( prev ){
+ return 0;
+ }
+
//=========================================================================
// Select Sounds.
//=========================================================================
@@ -1220,6 +1233,7 @@ BOOL MainWindow::Is_Product_Registered( void )
char key [_MAX_PATH];
wchar_t szPath [_MAX_PATH];
+ char aName [_MAX_PATH]; //jfs
unsigned long Type;
unsigned long Size = _MAX_PATH;
@@ -1232,7 +1246,8 @@ BOOL MainWindow::Is_Product_Registered( void )
memset( szSetupPath, '\0', sizeof( szSetupPath ));
memset( szRegisterPath, '\0', sizeof( szRegisterPath ));
memset( szInternetPath, '\0', sizeof( szInternetPath ));
- memset( szUninstallPath, '\0', sizeof( szUninstallPath ));
+ memset( szUninstallPath, '\0', sizeof( szUninstallPath ));
+ memset( szUninstallCommandLine, '\0', sizeof( szUninstallCommandLine ));
memset( FindFileData.cFileName, '\0', sizeof( FindFileData.cFileName ));
memset( FindFileData.cAlternateFileName, '\0', sizeof( FindFileData.cAlternateFileName ));
@@ -1257,7 +1272,7 @@ BOOL MainWindow::Is_Product_Registered( void )
// Get Full path\filename of product to execute ("Play").
//-----------------------------------------------------------------------
Size = _MAX_PATH;
- if ( RegQueryValueEx( phKey, INSTALL_PATH_KEY, NULL, &Type, (unsigned char *)szGamePath, &Size ) == ERROR_SUCCESS ) {
+ if ( RegQueryValueEx( phKey, INSTALL_PATH_KEY, NULL, &Type, (unsigned char *)szGamePath, &Size ) == ERROR_SUCCESS ) {
_tcscpy(szWorldbuilderPath, szGamePath);
_tcscpy(szPatchgetPath, szGamePath);
_tcscat(szGamePath, LAUNCHER_FILENAME);
@@ -1288,11 +1303,27 @@ BOOL MainWindow::Is_Product_Registered( void )
if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, key, 0, KEY_ALL_ACCESS, &phKey ) == ERROR_SUCCESS ) {
Size = _MAX_PATH;
- if ( RegQueryValueEx( phKey, UNINSTALL_STRING_SUBKEY, NULL, &Type, (unsigned char *)szUninstallPath, &Size ) == ERROR_SUCCESS ) {
-
- //--------------------------------------------------------------------
+ if ( RegQueryValueEx( phKey, UNINSTALL_STRING_SUBKEY, NULL, &Type, (unsigned char *)aName, &Size ) == ERROR_SUCCESS )
+ {
+ //------------------------------------------------------------------------------------------------------
// Look for the uninstall program. If found, set flag.
- //--------------------------------------------------------------------
+ // JFS... need to extract path and command line... 8/26/03
+ // JFS... further verify that we use a very limited uninstall based on the presence of "IDriver.exe"
+ //------------------------------------------------------------------------------------------------------
+ if(strstr(aName,UNINSTALL_EXECUTABLE) != NULL)
+ {
+ char *sp;
+
+ strcpy( szUninstallPath, aName );
+ sp = strchr(szUninstallPath,'/');
+ if(*sp != NULL)
+ {
+ strcpy( szUninstallCommandLine, sp );
+ strcpy( szUninstallPath, aName );
+ *sp = '\0';
+ }
+ }
+
handle = FindFirstFile( szUninstallPath, &FindFileData );
if ( handle != INVALID_HANDLE_VALUE ) {
UninstallAvailable = TRUE;
@@ -2002,11 +2033,11 @@ unsigned int MainWindow::Run_Auto_Update ( HWND hWnd, RECT *rect )
unsigned int MainWindow::Run_Uninstall( HWND hWnd, RECT *rect )
{
- MSG msg;
+// MSG msg;
UINT result = 0;
// int done = 0;
- DWORD dwTimeout = 1500;
- DWORD dwRC = WAIT_TIMEOUT;
+// DWORD dwTimeout = 1500;
+// DWORD dwRC = WAIT_TIMEOUT;
DWORD lpExitCode;
STARTUPINFO startupinfo;
@@ -2040,13 +2071,12 @@ unsigned int MainWindow::Run_Uninstall( HWND hWnd, RECT *rect )
result = CreateProcess(
szUninstallPath, // address of module name
- szUninstallPath, // address of command line
+ szUninstallCommandLine, // address of command line
NULL, // address of process security attributes
NULL, // address of thread security attributes
0, // new process inherits handles
0,
NULL, // address of new environment block
-// _TEXT("."),
szCurDir,
&startupinfo, // address of STARTUPINFO
&processinfo ); // address of PROCESS_INFORMATION
@@ -2071,25 +2101,29 @@ unsigned int MainWindow::Run_Uninstall( HWND hWnd, RECT *rect )
return( result );
}
+ // JFS: 8-26-03... Can't have auto run going during an uninstall!
+#if 0
//--------------------------------------------------------------------------
// Wait for App to shutdown
//--------------------------------------------------------------------------
- while (dwRC == WAIT_TIMEOUT) {
+ while (dwRC == WAIT_TIMEOUT)
+ {
//-----------------------------------------------------------------------
// Wait for object
//-----------------------------------------------------------------------
dwRC = WaitForSingleObject( processinfo.hProcess, dwTimeout );
+
//-----------------------------------------------------------------------
// Flush the Queue
//-----------------------------------------------------------------------
while (PeekMessage( &msg, NULL, 0, 0, PM_REMOVE )) {
TranslateMessage( &msg );
- DispatchMessage( &msg );
+// DispatchMessage( &msg );
}
}
-
+#endif
//--------------------------------------------------------------------------
// If the specified process has not terminated, the termination status
// returned is STILL_ACTIVE.
@@ -2137,8 +2171,6 @@ void MainWindow::Create_Buttons( HWND hWnd, RECT *dlg_rect )
int y_pos = 0;
int width = 0;
int height = 0;
-// int avg_width = 0;
-// int space_between = 5;
int button_index = 0;
HBITMAP hButtonBitmap = 0;
@@ -2175,13 +2207,8 @@ void MainWindow::Create_Buttons( HWND hWnd, RECT *dlg_rect )
//--------------------------------------------------------------------------
if( b640X480 || b800X600 ) {
-// x_pos = 0;
-// y_pos = 340;
x_pos = 410;
y_pos = 90;
-// width = 123;
-// height = 42;
-
} else {
x_pos = 540;
y_pos = 117;
@@ -2189,15 +2216,16 @@ void MainWindow::Create_Buttons( HWND hWnd, RECT *dlg_rect )
for ( i = 0; i < NUM_BUTTONS; i++ ) {
- if ( ButtonList[i] ) {
+ if ( ButtonList[i] )
+ {
delete( ButtonList[i] );
}
+
ButtonList[i] = NULL;
ButtonSizes[i].left = x_pos; // X position.
ButtonSizes[i].top = y_pos; // Y position.
ButtonSizes[i].right = width; // Button's width.
ButtonSizes[i].bottom = height; // Button's height.
-// x_pos -= /*height*/ 16;
y_pos += height + 4;
Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonSizes[%d] = ( %d, %d, %d, %d )"),
@@ -2207,8 +2235,6 @@ void MainWindow::Create_Buttons( HWND hWnd, RECT *dlg_rect )
//==========================================================================
// Create the "Buttons"
//==========================================================================
-// i = NUM_BUTTONS-1;
-// j = NUM_BUTTONS-1;
i = 0;
j = 0;
@@ -2223,7 +2249,6 @@ void MainWindow::Create_Buttons( HWND hWnd, RECT *dlg_rect )
if ( InstallProduct ) {
count--; // No Website button.
}
-// button_index = NUM_BUTTONS - (( NUM_BUTTONS - count ) / 2 ) - 1;
button_index = 0;
strcpy( next_button_name, ButtonImages[button_index] );
@@ -2231,7 +2256,6 @@ void MainWindow::Create_Buttons( HWND hWnd, RECT *dlg_rect )
button_size = ButtonSizes;
i = j = button_index;
-// button_index--;
Msg( __LINE__, TEXT(__FILE__), TEXT("count = %d."), count );
Msg( __LINE__, TEXT(__FILE__), TEXT("button_index = %d."), button_index );
@@ -2323,10 +2347,8 @@ void MainWindow::Create_Buttons( HWND hWnd, RECT *dlg_rect )
// (7) EXPLORE CD
//-------------------------------------------------------------------------
Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonList[%d]: Id=%d, ButtonSizes=%d, String=%s."), i, IDD_EXPLORE, j, "Explore" );
-// ButtonList[i--] = new DrawButton (
ButtonList[i++] = new DrawButton (
IDD_EXPLORE,
-// button_size[j--],
button_size[j++],
BUTTON_REG,
BUTTON_SEL,
@@ -2346,10 +2368,8 @@ void MainWindow::Create_Buttons( HWND hWnd, RECT *dlg_rect )
// (3) WebSite button.
//-----------------------------------------------------------------------
Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonList[%d]: Id=%d, ButtonSizes=%d, String=%s."), i, IDD_OK, j, "Install" );
-// ButtonList[i--] = new DrawButton(
ButtonList[i++] = new DrawButton(
IDD_INTERNET,
-// button_size[j--],
button_size[j++],
BUTTON_REG,
BUTTON_SEL,
@@ -2371,10 +2391,8 @@ void MainWindow::Create_Buttons( HWND hWnd, RECT *dlg_rect )
//--------------------------------------------------------------------------
if ( UninstallAvailable && !InstallProduct ) {
Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonList[%d]: Id=%d, ButtonSizes=%d, String=%s."), i, IDD_UNINSTALL, j, "Uninstall" );
-// ButtonList[i--] = new DrawButton(
ButtonList[i++] = new DrawButton(
IDD_UNINSTALL,
-// button_size[j--],
button_size[j++],
BUTTON_REG,
BUTTON_SEL,
@@ -2429,10 +2447,8 @@ void MainWindow::Create_Buttons( HWND hWnd, RECT *dlg_rect )
// (1) CANCEL?
//--------------------------------------------------------------------------
Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonList[%d]: Id=%d, ButtonSizes=%d, String=%s."), i, IDD_CANCEL, j, "Cancel" );
-// ButtonList[i--] = new DrawButton(
ButtonList[i++] = new DrawButton(
IDD_CANCEL,
-// button_size[j--],
button_size[j++],
BUTTON_REG,
BUTTON_SEL,
@@ -2912,6 +2928,12 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param
//-----------------------------------------------------------------------
GetClientRect( window_handle, &dlg_rect );
+
+ //=======================================================================================
+ // JFS: 8/26/03 -- This was not getting cleared so if the button cnt were reduced...
+ //=======================================================================================
+ memset( BackgroundRect, 0, sizeof ( BackgroundRect ) );
+
//=======================================================================
// These are the areas of the Background to paint minus the Button Area.
// This will prevent "flickering".
@@ -5032,17 +5054,27 @@ HBITMAP LoadResourceButton( HINSTANCE hInstance, LPCTSTR lpString, HPALETTE FAR
// WARNINGS:
//
// HISTORY: Found this routine on MS Developmemt CD, July 1996.
-// 09/26/1996 MML : Created.
+// 09/26/1996 MML : Created.
+// 08/27/2003 JFS : Repaired!
//=============================================================================
void Cant_Find_MessageBox ( HINSTANCE hInstance, const char *szPath )
{
+ //
+ // JFS... Added functionality to make this work in wide characters.
+ //
#ifdef LEAN_AND_MEAN
-
- Locale_GetString( "Autorun:AutorunTitle", szWideBuffer );
- swprintf( szWideBuffer2, szWideBuffer, szProductName );
- Locale_GetString( "Autorun:CantFind", szWideBuffer3 );
+ {
+ Locale_GetString( "Autorun:AutorunTitle", szWideBuffer );
+ swprintf( szWideBuffer3, szWideBuffer, szProductName );
+
+ Locale_GetString( "Autorun:CantFind", szWideBuffer );
+ MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, szPath, _MAX_PATH, szWideBuffer0, _MAX_PATH );
+ swprintf( szWideBuffer2, szWideBuffer, szWideBuffer0 );
+
+ MessageBoxW( NULL, szWideBuffer2, szWideBuffer3, MB_APPLMODAL | MB_OK );
+ }
#else
@@ -5053,7 +5085,6 @@ void Cant_Find_MessageBox ( HINSTANCE hInstance, const char *szPath )
WideCharToMultiByte( CodePage, 0, wideBuffer3.str(), wideBuffer3.getLength()+1, szBuffer3, _MAX_PATH, NULL, NULL );
WideCharToMultiByte( CodePage, 0, wideBuffer2.str(), wideBuffer2.getLength()+1, szBuffer2, _MAX_PATH, NULL, NULL );
-#endif
sprintf( szBuffer1, szBuffer3, szPath );
@@ -5083,6 +5114,8 @@ void Cant_Find_MessageBox ( HINSTANCE hInstance, const char *szPath )
MessageBox( NULL, szBuffer1, szBuffer2, MB_APPLMODAL | MB_OK );
+#endif
+
}
diff --git a/Generals/Code/Tools/Autorun/autorun.h b/Generals/Code/Tools/Autorun/autorun.h
index f249b5f520e..089bd18b9b9 100644
--- a/Generals/Code/Tools/Autorun/autorun.h
+++ b/Generals/Code/Tools/Autorun/autorun.h
@@ -89,8 +89,12 @@ typedef enum {
#define SETUP_NAME "Setup.exe"
#define UNINSTALL_NAME "Uninst.exe"
-#define SHELL_FOLDERS_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
-#define SHELL_UNINSTALL_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
+//#define SHELL_FOLDERS_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
+#if RTS_GENERALS
+# define SHELL_UNINSTALL_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
+#elif RTS_ZEROHOUR
+# define SHELL_UNINSTALL_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\InstallShield_{F3E9C243-122E-4D6B-ACC1-E1FEC02F6CA1}"
+#endif
#define SHELL_APP_PATHS_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths"
#define PROGRAMS_SUBKEY "Programs"
#define COMMON_PROGRAMS_SUBKEY "Common Programs"
@@ -101,21 +105,27 @@ typedef enum {
#define WESTWOOD_WOLAPI_KEY "Software\\Westwood\\WOLAPI"
#define WESTWOOD_REGISTER_KEY "Software\\Westwood\\Register"
*/
-#define ELECTRONICARTS_SUBKEY "Electronic Arts"
+#define ELECTRONICARTS_SUBKEY "Electronic Arts"
#define EAGAMES_SUBKEY "EA Games"
-#define GENERALS_SUBKEY "Generals"
-#define SOFTWARE_EAGAMES_KEY "Software\\Electronic Arts\\EA Games\\"
-#define EAGAMES_GENERALS_KEY "Software\\Electronic Arts\\EA Games\\Generals"
-#define EAGAMES_ERGC_KEY "Software\\Electronic Arts\\EA Games\\Generals\\ergc"
+#define SOFTWARE_EAGAMES_KEY "Software\\Electronic Arts\\EA Games\\"
+#if RTS_GENERALS
+# define GENERALS_SUBKEY "Generals"
+# define EAGAMES_GENERALS_KEY "Software\\Electronic Arts\\EA Games\\Generals"
+# define EAGAMES_ERGC_KEY "Software\\Electronic Arts\\EA Games\\Generals\\ergc"
+#elif RTS_ZEROHOUR
+# define GENERALS_SUBKEY "Command and Conquer Generals Zero Hour"
+# define EAGAMES_GENERALS_KEY "Software\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour"
+# define EAGAMES_ERGC_KEY "Software\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour\\ergc"
+#endif
#define LAUNCHER_FILENAME "Generals.exe"
-#define WORLDBUILDER_FILENAME "WorldBuilder.exe"
+#define WORLDBUILDER_FILENAME "WorldBuilder.exe"
#define PATCHGET_FILENAME "patchget.dat"
-#define UNINSTALL_STRING_SUBKEY "UninstallString"
-#define INSTALLPATH_SUBKEY "InstallPath"
+#define UNINSTALL_STRING_SUBKEY "UninstallString"
+#define INSTALLPATH_SUBKEY "InstallPath"
#define VERSION_SUBKEY "Version"
#define LANGUAGE_SUBKEY "Language"
-#define MAPPACKVERSION_SUBKEY "MapPackVersion"
+#define MAPPACKVERSION_SUBKEY "MapPackVersion"
#define DDRAW "DDRAW.DLL"
#define DSOUND "DSOUND.DLL"
diff --git a/Generals/Code/Tools/Autorun/resource.h b/Generals/Code/Tools/Autorun/resource.h
index 0be22e51f56..1acd64ba8c4 100644
--- a/Generals/Code/Tools/Autorun/resource.h
+++ b/Generals/Code/Tools/Autorun/resource.h
@@ -1,6 +1,24 @@
+/*
+** Command & Conquer Generals Zero Hour(tm)
+** Copyright 2025 Electronic Arts Inc.
+**
+** This program is free software: you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program. If not, see .
+*/
+
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
-// Used by D:\Projects\Renegade\Autorun\English\AUTORUN.RC
+// Used by AUTORUN.RC
//
#define IDD_OK 100
#define IDD_OK2 101
@@ -11,14 +29,12 @@
#define IDD_UNINSTALL 106
#define IDD_UPDATE 107
#define IDD_NEW_ACCOUNT 108
-#define IDD_VIEW_DEMO 109
-#define IDD_GAMESPY 110
-#define IDD_OK3 111
-#define IDD_OK4 112
-#define IDD_PREVIEWS 113
-#define IDD_HELP 114
-
-
+#define IDD_VIEW_DEMO 109
+#define IDD_GAMESPY 110
+#define IDD_OK3 111
+#define IDD_OK4 112
+#define IDD_PREVIEWS 113
+#define IDD_HELP 114
#define IDS_VERSION_STRING 120
#define IDS_CANT_FIND_FILE 121
diff --git a/GeneralsMD/Code/CMakeLists.txt b/GeneralsMD/Code/CMakeLists.txt
index 3133dbe74d3..856b64d0b76 100644
--- a/GeneralsMD/Code/CMakeLists.txt
+++ b/GeneralsMD/Code/CMakeLists.txt
@@ -19,6 +19,10 @@ target_include_directories(zi_libraries_source_wwvegas_ww3d2 INTERFACE "Librarie
target_include_directories(zi_libraries_source_wwvegas_wwmath INTERFACE "Libraries/Source/WWVegas/WWMath")
target_include_directories(zi_libraries_source_wwvegas_wwsaveload INTERFACE "Libraries/Source/WWVegas/WWSaveLoad")
target_include_directories(zi_main INTERFACE "Main")
+
+target_compile_definitions(zi_always INTERFACE
+ RTS_ZEROHOUR=1
+)
target_link_libraries(zi_always INTERFACE
core_utility
zi_libraries_include
diff --git a/GeneralsMD/Code/Tools/Autorun/AUTORUN.RC b/GeneralsMD/Code/Tools/Autorun/AUTORUN.RC
index d86646e6549..5b6b27f1ab1 100644
--- a/GeneralsMD/Code/Tools/Autorun/AUTORUN.RC
+++ b/GeneralsMD/Code/Tools/Autorun/AUTORUN.RC
@@ -8,6 +8,7 @@
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
+
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
diff --git a/GeneralsMD/Code/Tools/Autorun/CDCNTRL.CPP b/GeneralsMD/Code/Tools/Autorun/CDCNTRL.CPP
index 82906f01de1..3124c2ffce2 100644
--- a/GeneralsMD/Code/Tools/Autorun/CDCNTRL.CPP
+++ b/GeneralsMD/Code/Tools/Autorun/CDCNTRL.CPP
@@ -1079,7 +1079,7 @@ bool WINAPI CDControlClass::Unlock_Logical_Volume (HANDLE vwin32, char drive)
* 6/24/99 4:44PM MML : Created *
*==============================================================================================*/
-void Last_Error_Text ( LPCTSTR szPrefix, HRESULT hr )
+void Last_Error_Text ( LPCTSTR szPrefix, HRESULT hr )
{
LPVOID szMessage;
char szDisplay[1000];
diff --git a/GeneralsMD/Code/Tools/Autorun/autorun.cpp b/GeneralsMD/Code/Tools/Autorun/autorun.cpp
index ac8f18b8c9b..5492b5ae29b 100644
--- a/GeneralsMD/Code/Tools/Autorun/autorun.cpp
+++ b/GeneralsMD/Code/Tools/Autorun/autorun.cpp
@@ -122,8 +122,6 @@
#include "Win32Device/Common/Win32BIGFileSystem.h"
#endif
-
-
//-----------------------------------------------------------------------------
// DEFINES
//-----------------------------------------------------------------------------
@@ -2750,7 +2748,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param
} else if( b800X600 ) {
- strcpy( szBitmap, _TEXT( "BacKground" ));
+ strcpy( szBitmap, _TEXT( "Background" ));
if ( LANG_FRE == LanguageID ) {
strcpy( szLicense, _TEXT( "License_FRENCH2" ));
@@ -3963,11 +3961,9 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param
// Uninstll.exe which in turn launches Uninst.exe thus
// ::Run_Install ends before Uninst.exe is done.
//---------------------------------------------------------------
-#if 1
if ( result ) {
end_dialog = true;
}
-#endif
break;
default:
diff --git a/GeneralsMD/Code/Tools/Autorun/autorun.h b/GeneralsMD/Code/Tools/Autorun/autorun.h
index eccdefa30cf..888690b20a6 100644
--- a/GeneralsMD/Code/Tools/Autorun/autorun.h
+++ b/GeneralsMD/Code/Tools/Autorun/autorun.h
@@ -90,7 +90,11 @@ typedef enum {
#define UNINSTALL_NAME "Uninst.exe"
//#define SHELL_FOLDERS_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
-#define SHELL_UNINSTALL_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\InstallShield_{F3E9C243-122E-4D6B-ACC1-E1FEC02F6CA1}"
+#if RTS_GENERALS
+# define SHELL_UNINSTALL_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
+#elif RTS_ZEROHOUR
+# define SHELL_UNINSTALL_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\InstallShield_{F3E9C243-122E-4D6B-ACC1-E1FEC02F6CA1}"
+#endif
#define SHELL_APP_PATHS_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths"
#define PROGRAMS_SUBKEY "Programs"
#define COMMON_PROGRAMS_SUBKEY "Common Programs"
@@ -103,10 +107,16 @@ typedef enum {
*/
#define ELECTRONICARTS_SUBKEY "Electronic Arts"
#define EAGAMES_SUBKEY "EA Games"
-#define GENERALS_SUBKEY "Command and Conquer Generals Zero Hour"
#define SOFTWARE_EAGAMES_KEY "Software\\Electronic Arts\\EA Games\\"
-#define EAGAMES_GENERALS_KEY "Software\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour"
-#define EAGAMES_ERGC_KEY "Software\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour\\ergc"
+#if RTS_GENERALS
+# define GENERALS_SUBKEY "Generals"
+# define EAGAMES_GENERALS_KEY "Software\\Electronic Arts\\EA Games\\Generals"
+# define EAGAMES_ERGC_KEY "Software\\Electronic Arts\\EA Games\\Generals\\ergc"
+#elif RTS_ZEROHOUR
+# define GENERALS_SUBKEY "Command and Conquer Generals Zero Hour"
+# define EAGAMES_GENERALS_KEY "Software\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour"
+# define EAGAMES_ERGC_KEY "Software\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour\\ergc"
+#endif
#define LAUNCHER_FILENAME "Generals.exe"
#define WORLDBUILDER_FILENAME "WorldBuilder.exe"
#define PATCHGET_FILENAME "patchget.dat"
From 56d1e794d8aa25879df07c5dce303240c0ded2bc Mon Sep 17 00:00:00 2001
From: xezon <4720891+xezon@users.noreply.github.com>
Date: Mon, 21 Apr 2025 17:27:18 +0200
Subject: [PATCH 2/2] [CORE] Move Autorun tool files to Core (#739)
---
Core/CMakeLists.txt | 4 +-
.../Tools/Autorun/ARButton_Reg.bmp | Bin
.../Tools/Autorun/ARButton_Sel.bmp | Bin
.../Code => Core}/Tools/Autorun/ARGS.CPP | 0
.../Code => Core}/Tools/Autorun/ARGS.H | 0
.../Code => Core}/Tools/Autorun/AUTORUN.RC | 0
.../Tools/Autorun/AutoRun_Frn.bmp | Bin
.../Tools/Autorun/AutoRun_Ger.bmp | Bin
.../Code => Core}/Tools/Autorun/Autorun.ICO | Bin
.../Tools/Autorun/Autorun_BG.bmp | Bin
.../Code => Core}/Tools/Autorun/Bullet.bmp | Bin
.../Code => Core}/Tools/Autorun/CDCNTRL.CPP | 0
.../Code => Core}/Tools/Autorun/CDCNTRL.H | 0
Core/Tools/Autorun/CMakeLists.txt | 62 +
.../Tools/Autorun/CallbackHook.h | 0
.../Tools/Autorun/DrawButton.cpp | 0
.../Code => Core}/Tools/Autorun/DrawButton.h | 0
.../Code => Core}/Tools/Autorun/EZGIMEX.cpp | 0
.../Tools/Autorun/English/Present.wav | 0
.../Tools/Autorun/English/Rock-n-Roll.wav | 0
.../Code => Core}/Tools/Autorun/GETCD.CPP | 0
.../Code => Core}/Tools/Autorun/GameText.cpp | 0
.../Code => Core}/Tools/Autorun/GameText.h | 0
.../Code => Core}/Tools/Autorun/GetCD.h | 0
.../Code => Core}/Tools/Autorun/IGR.cpp | 0
{GeneralsMD/Code => Core}/Tools/Autorun/IGR.h | 0
.../Code => Core}/Tools/Autorun/JSUPPORT.H | 0
.../Code => Core}/Tools/Autorun/Jsupport.cpp | 0
.../Tools/Autorun/License French.bmp | Bin
.../Tools/Autorun/License French2.bmp | Bin
.../Tools/Autorun/License German.bmp | Bin
.../Tools/Autorun/License German2.bmp | Bin
.../Tools/Autorun/License USA.bmp | Bin
.../Tools/Autorun/License USA2.bmp | Bin
.../Tools/Autorun/Locale_API.cpp | 0
.../Code => Core}/Tools/Autorun/Locale_API.h | 0
.../Code => Core}/Tools/Autorun/POINT.h | 0
.../Code => Core}/Tools/Autorun/RECT.h | 0
.../Code => Core}/Tools/Autorun/TTFont.cpp | 0
.../Code => Core}/Tools/Autorun/TTFont.h | 0
.../Code => Core}/Tools/Autorun/Utils.cpp | 0
.../Code => Core}/Tools/Autorun/Utils.h | 0
.../Code => Core}/Tools/Autorun/ViewHTML.cpp | 0
.../Code => Core}/Tools/Autorun/ViewHTML.h | 0
.../Code => Core}/Tools/Autorun/WSYS_File.cpp | 0
.../Tools/Autorun/WSYS_FileSystem.cpp | 0
.../Tools/Autorun/WSYS_FileSystem.h | 0
.../Tools/Autorun/WSYS_RAMFile.cpp | 0
.../Tools/Autorun/WSYS_RAMFile.h | 0
.../Tools/Autorun/WSYS_StdFile.cpp | 0
.../Tools/Autorun/WSYS_StdFile.h | 0
.../Tools/Autorun/WSYS_StdFileSystem.cpp | 0
.../Tools/Autorun/WSYS_StdFileSystem.h | 0
.../Code => Core}/Tools/Autorun/WSYS_file.h | 0
.../Code => Core}/Tools/Autorun/WinFix.CPP | 0
.../Code => Core}/Tools/Autorun/WinFix.H | 0
.../Code => Core}/Tools/Autorun/Wnd_File.h | 0
.../Code => Core}/Tools/Autorun/Wnd_file.cpp | 0
.../Code => Core}/Tools/Autorun/arrow.cur | Bin
.../Code => Core}/Tools/Autorun/autorun.cpp | 0
.../Code => Core}/Tools/Autorun/autorun.h | 0
.../Code => Core}/Tools/Autorun/gimex.h | 0
.../Tools/Autorun/leanAndMeanAutorun.h | 0
.../Code => Core}/Tools/Autorun/locale.cpp | 0
.../Code => Core}/Tools/Autorun/locale.h | 0
Core/Tools/Autorun/mouse.wav | 1 +
.../Code => Core}/Tools/Autorun/resource.h | 0
Core/Tools/CMakeLists.txt | 9 +
Generals/Code/Tools/Autorun/ARGS.CPP | 352 --
Generals/Code/Tools/Autorun/ARGS.H | 70 -
Generals/Code/Tools/Autorun/CDCNTRL.CPP | 1116 ----
Generals/Code/Tools/Autorun/CDCNTRL.H | 156 -
Generals/Code/Tools/Autorun/CMakeLists.txt | 59 +-
Generals/Code/Tools/Autorun/CallbackHook.h | 85 -
Generals/Code/Tools/Autorun/DrawButton.cpp | 417 --
Generals/Code/Tools/Autorun/DrawButton.h | 108 -
Generals/Code/Tools/Autorun/EZGIMEX.cpp | 213 -
Generals/Code/Tools/Autorun/GETCD.CPP | 414 --
Generals/Code/Tools/Autorun/GameText.cpp | 1152 ----
Generals/Code/Tools/Autorun/GameText.h | 82 -
Generals/Code/Tools/Autorun/GetCD.h | 323 -
Generals/Code/Tools/Autorun/IGR.cpp | 181 -
Generals/Code/Tools/Autorun/IGR.h | 75 -
Generals/Code/Tools/Autorun/JSUPPORT.H | 21 -
Generals/Code/Tools/Autorun/Jsupport.cpp | 158 -
Generals/Code/Tools/Autorun/Locale_API.cpp | 419 --
Generals/Code/Tools/Autorun/Locale_API.h | 67 -
Generals/Code/Tools/Autorun/POINT.h | 242 -
Generals/Code/Tools/Autorun/RECT.h | 308 -
Generals/Code/Tools/Autorun/TTFont.cpp | 1475 -----
Generals/Code/Tools/Autorun/TTFont.h | 304 -
Generals/Code/Tools/Autorun/Utils.cpp | 669 --
Generals/Code/Tools/Autorun/Utils.h | 75 -
Generals/Code/Tools/Autorun/ViewHTML.cpp | 202 -
Generals/Code/Tools/Autorun/ViewHTML.h | 42 -
Generals/Code/Tools/Autorun/WSYS_File.cpp | 268 -
.../Code/Tools/Autorun/WSYS_FileSystem.cpp | 106 -
Generals/Code/Tools/Autorun/WSYS_FileSystem.h | 96 -
Generals/Code/Tools/Autorun/WSYS_RAMFile.cpp | 289 -
Generals/Code/Tools/Autorun/WSYS_RAMFile.h | 100 -
Generals/Code/Tools/Autorun/WSYS_StdFile.cpp | 256 -
Generals/Code/Tools/Autorun/WSYS_StdFile.h | 97 -
.../Code/Tools/Autorun/WSYS_StdFileSystem.cpp | 122 -
.../Code/Tools/Autorun/WSYS_StdFileSystem.h | 92 -
Generals/Code/Tools/Autorun/WSYS_file.h | 167 -
Generals/Code/Tools/Autorun/WinFix.CPP | 350 --
Generals/Code/Tools/Autorun/WinFix.H | 149 -
Generals/Code/Tools/Autorun/Wnd_File.h | 216 -
Generals/Code/Tools/Autorun/Wnd_file.cpp | 1625 -----
Generals/Code/Tools/Autorun/autorun.cpp | 5470 -----------------
Generals/Code/Tools/Autorun/autorun.h | 256 -
Generals/Code/Tools/Autorun/gimex.h | 307 -
.../Code/Tools/Autorun/leanAndMeanAutorun.h | 31 -
Generals/Code/Tools/Autorun/locale.cpp | 864 ---
Generals/Code/Tools/Autorun/locale.h | 72 -
.../Code/Tools/Autorun/ARButton_Reg.bmp | Bin 66 -> 0 bytes
.../Code/Tools/Autorun/ARButton_Sel.bmp | Bin 66 -> 0 bytes
GeneralsMD/Code/Tools/Autorun/AUTORUN.RC | 301 -
GeneralsMD/Code/Tools/Autorun/AutoRun_Frn.bmp | Bin 66 -> 0 bytes
GeneralsMD/Code/Tools/Autorun/AutoRun_Ger.bmp | Bin 66 -> 0 bytes
GeneralsMD/Code/Tools/Autorun/Autorun.ICO | Bin 1078 -> 0 bytes
GeneralsMD/Code/Tools/Autorun/Autorun_BG.bmp | Bin 66 -> 0 bytes
GeneralsMD/Code/Tools/Autorun/Bullet.bmp | Bin 66 -> 0 bytes
GeneralsMD/Code/Tools/Autorun/CMakeLists.txt | 59 +-
.../Code/Tools/Autorun/License French.bmp | Bin 66 -> 0 bytes
.../Code/Tools/Autorun/License French2.bmp | Bin 66 -> 0 bytes
.../Code/Tools/Autorun/License German.bmp | Bin 66 -> 0 bytes
.../Code/Tools/Autorun/License German2.bmp | Bin 66 -> 0 bytes
GeneralsMD/Code/Tools/Autorun/License USA.bmp | Bin 66 -> 0 bytes
.../Code/Tools/Autorun/License USA2.bmp | Bin 66 -> 0 bytes
GeneralsMD/Code/Tools/Autorun/arrow.cur | Bin 766 -> 0 bytes
GeneralsMD/Code/Tools/Autorun/resource.h | 50 -
132 files changed, 75 insertions(+), 20129 deletions(-)
rename {Generals/Code => Core}/Tools/Autorun/ARButton_Reg.bmp (100%)
rename {Generals/Code => Core}/Tools/Autorun/ARButton_Sel.bmp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/ARGS.CPP (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/ARGS.H (100%)
rename {Generals/Code => Core}/Tools/Autorun/AUTORUN.RC (100%)
rename {Generals/Code => Core}/Tools/Autorun/AutoRun_Frn.bmp (100%)
rename {Generals/Code => Core}/Tools/Autorun/AutoRun_Ger.bmp (100%)
rename {Generals/Code => Core}/Tools/Autorun/Autorun.ICO (100%)
rename {Generals/Code => Core}/Tools/Autorun/Autorun_BG.bmp (100%)
rename {Generals/Code => Core}/Tools/Autorun/Bullet.bmp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/CDCNTRL.CPP (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/CDCNTRL.H (100%)
create mode 100644 Core/Tools/Autorun/CMakeLists.txt
rename {GeneralsMD/Code => Core}/Tools/Autorun/CallbackHook.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/DrawButton.cpp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/DrawButton.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/EZGIMEX.cpp (100%)
rename Generals/Code/Tools/Autorun/mouse.wav => Core/Tools/Autorun/English/Present.wav (100%)
rename GeneralsMD/Code/Tools/Autorun/mouse.wav => Core/Tools/Autorun/English/Rock-n-Roll.wav (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/GETCD.CPP (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/GameText.cpp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/GameText.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/GetCD.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/IGR.cpp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/IGR.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/JSUPPORT.H (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/Jsupport.cpp (100%)
rename {Generals/Code => Core}/Tools/Autorun/License French.bmp (100%)
rename {Generals/Code => Core}/Tools/Autorun/License French2.bmp (100%)
rename {Generals/Code => Core}/Tools/Autorun/License German.bmp (100%)
rename {Generals/Code => Core}/Tools/Autorun/License German2.bmp (100%)
rename {Generals/Code => Core}/Tools/Autorun/License USA.bmp (100%)
rename {Generals/Code => Core}/Tools/Autorun/License USA2.bmp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/Locale_API.cpp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/Locale_API.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/POINT.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/RECT.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/TTFont.cpp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/TTFont.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/Utils.cpp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/Utils.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/ViewHTML.cpp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/ViewHTML.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/WSYS_File.cpp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/WSYS_FileSystem.cpp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/WSYS_FileSystem.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/WSYS_RAMFile.cpp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/WSYS_RAMFile.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/WSYS_StdFile.cpp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/WSYS_StdFile.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/WSYS_StdFileSystem.cpp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/WSYS_StdFileSystem.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/WSYS_file.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/WinFix.CPP (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/WinFix.H (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/Wnd_File.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/Wnd_file.cpp (100%)
rename {Generals/Code => Core}/Tools/Autorun/arrow.cur (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/autorun.cpp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/autorun.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/gimex.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/leanAndMeanAutorun.h (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/locale.cpp (100%)
rename {GeneralsMD/Code => Core}/Tools/Autorun/locale.h (100%)
create mode 100644 Core/Tools/Autorun/mouse.wav
rename {Generals/Code => Core}/Tools/Autorun/resource.h (100%)
delete mode 100644 Generals/Code/Tools/Autorun/ARGS.CPP
delete mode 100644 Generals/Code/Tools/Autorun/ARGS.H
delete mode 100644 Generals/Code/Tools/Autorun/CDCNTRL.CPP
delete mode 100644 Generals/Code/Tools/Autorun/CDCNTRL.H
delete mode 100644 Generals/Code/Tools/Autorun/CallbackHook.h
delete mode 100644 Generals/Code/Tools/Autorun/DrawButton.cpp
delete mode 100644 Generals/Code/Tools/Autorun/DrawButton.h
delete mode 100644 Generals/Code/Tools/Autorun/EZGIMEX.cpp
delete mode 100644 Generals/Code/Tools/Autorun/GETCD.CPP
delete mode 100644 Generals/Code/Tools/Autorun/GameText.cpp
delete mode 100644 Generals/Code/Tools/Autorun/GameText.h
delete mode 100644 Generals/Code/Tools/Autorun/GetCD.h
delete mode 100644 Generals/Code/Tools/Autorun/IGR.cpp
delete mode 100644 Generals/Code/Tools/Autorun/IGR.h
delete mode 100644 Generals/Code/Tools/Autorun/JSUPPORT.H
delete mode 100644 Generals/Code/Tools/Autorun/Jsupport.cpp
delete mode 100644 Generals/Code/Tools/Autorun/Locale_API.cpp
delete mode 100644 Generals/Code/Tools/Autorun/Locale_API.h
delete mode 100644 Generals/Code/Tools/Autorun/POINT.h
delete mode 100644 Generals/Code/Tools/Autorun/RECT.h
delete mode 100644 Generals/Code/Tools/Autorun/TTFont.cpp
delete mode 100644 Generals/Code/Tools/Autorun/TTFont.h
delete mode 100644 Generals/Code/Tools/Autorun/Utils.cpp
delete mode 100644 Generals/Code/Tools/Autorun/Utils.h
delete mode 100644 Generals/Code/Tools/Autorun/ViewHTML.cpp
delete mode 100644 Generals/Code/Tools/Autorun/ViewHTML.h
delete mode 100644 Generals/Code/Tools/Autorun/WSYS_File.cpp
delete mode 100644 Generals/Code/Tools/Autorun/WSYS_FileSystem.cpp
delete mode 100644 Generals/Code/Tools/Autorun/WSYS_FileSystem.h
delete mode 100644 Generals/Code/Tools/Autorun/WSYS_RAMFile.cpp
delete mode 100644 Generals/Code/Tools/Autorun/WSYS_RAMFile.h
delete mode 100644 Generals/Code/Tools/Autorun/WSYS_StdFile.cpp
delete mode 100644 Generals/Code/Tools/Autorun/WSYS_StdFile.h
delete mode 100644 Generals/Code/Tools/Autorun/WSYS_StdFileSystem.cpp
delete mode 100644 Generals/Code/Tools/Autorun/WSYS_StdFileSystem.h
delete mode 100644 Generals/Code/Tools/Autorun/WSYS_file.h
delete mode 100644 Generals/Code/Tools/Autorun/WinFix.CPP
delete mode 100644 Generals/Code/Tools/Autorun/WinFix.H
delete mode 100644 Generals/Code/Tools/Autorun/Wnd_File.h
delete mode 100644 Generals/Code/Tools/Autorun/Wnd_file.cpp
delete mode 100644 Generals/Code/Tools/Autorun/autorun.cpp
delete mode 100644 Generals/Code/Tools/Autorun/autorun.h
delete mode 100644 Generals/Code/Tools/Autorun/gimex.h
delete mode 100644 Generals/Code/Tools/Autorun/leanAndMeanAutorun.h
delete mode 100644 Generals/Code/Tools/Autorun/locale.cpp
delete mode 100644 Generals/Code/Tools/Autorun/locale.h
delete mode 100644 GeneralsMD/Code/Tools/Autorun/ARButton_Reg.bmp
delete mode 100644 GeneralsMD/Code/Tools/Autorun/ARButton_Sel.bmp
delete mode 100644 GeneralsMD/Code/Tools/Autorun/AUTORUN.RC
delete mode 100644 GeneralsMD/Code/Tools/Autorun/AutoRun_Frn.bmp
delete mode 100644 GeneralsMD/Code/Tools/Autorun/AutoRun_Ger.bmp
delete mode 100644 GeneralsMD/Code/Tools/Autorun/Autorun.ICO
delete mode 100644 GeneralsMD/Code/Tools/Autorun/Autorun_BG.bmp
delete mode 100644 GeneralsMD/Code/Tools/Autorun/Bullet.bmp
delete mode 100644 GeneralsMD/Code/Tools/Autorun/License French.bmp
delete mode 100644 GeneralsMD/Code/Tools/Autorun/License French2.bmp
delete mode 100644 GeneralsMD/Code/Tools/Autorun/License German.bmp
delete mode 100644 GeneralsMD/Code/Tools/Autorun/License German2.bmp
delete mode 100644 GeneralsMD/Code/Tools/Autorun/License USA.bmp
delete mode 100644 GeneralsMD/Code/Tools/Autorun/License USA2.bmp
delete mode 100644 GeneralsMD/Code/Tools/Autorun/arrow.cur
delete mode 100644 GeneralsMD/Code/Tools/Autorun/resource.h
diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt
index fbcf68a3e40..43704d6a696 100644
--- a/Core/CMakeLists.txt
+++ b/Core/CMakeLists.txt
@@ -32,6 +32,4 @@ add_subdirectory(Libraries)
# Platform specific GameEngine code
# add_subdirectory(GameEngineDevice)
-if (RTS_BUILD_CORE_TOOLS OR RTS_BUILD_CORE_EXTRAS)
- add_subdirectory(Tools)
-endif()
\ No newline at end of file
+add_subdirectory(Tools)
diff --git a/Generals/Code/Tools/Autorun/ARButton_Reg.bmp b/Core/Tools/Autorun/ARButton_Reg.bmp
similarity index 100%
rename from Generals/Code/Tools/Autorun/ARButton_Reg.bmp
rename to Core/Tools/Autorun/ARButton_Reg.bmp
diff --git a/Generals/Code/Tools/Autorun/ARButton_Sel.bmp b/Core/Tools/Autorun/ARButton_Sel.bmp
similarity index 100%
rename from Generals/Code/Tools/Autorun/ARButton_Sel.bmp
rename to Core/Tools/Autorun/ARButton_Sel.bmp
diff --git a/GeneralsMD/Code/Tools/Autorun/ARGS.CPP b/Core/Tools/Autorun/ARGS.CPP
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/ARGS.CPP
rename to Core/Tools/Autorun/ARGS.CPP
diff --git a/GeneralsMD/Code/Tools/Autorun/ARGS.H b/Core/Tools/Autorun/ARGS.H
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/ARGS.H
rename to Core/Tools/Autorun/ARGS.H
diff --git a/Generals/Code/Tools/Autorun/AUTORUN.RC b/Core/Tools/Autorun/AUTORUN.RC
similarity index 100%
rename from Generals/Code/Tools/Autorun/AUTORUN.RC
rename to Core/Tools/Autorun/AUTORUN.RC
diff --git a/Generals/Code/Tools/Autorun/AutoRun_Frn.bmp b/Core/Tools/Autorun/AutoRun_Frn.bmp
similarity index 100%
rename from Generals/Code/Tools/Autorun/AutoRun_Frn.bmp
rename to Core/Tools/Autorun/AutoRun_Frn.bmp
diff --git a/Generals/Code/Tools/Autorun/AutoRun_Ger.bmp b/Core/Tools/Autorun/AutoRun_Ger.bmp
similarity index 100%
rename from Generals/Code/Tools/Autorun/AutoRun_Ger.bmp
rename to Core/Tools/Autorun/AutoRun_Ger.bmp
diff --git a/Generals/Code/Tools/Autorun/Autorun.ICO b/Core/Tools/Autorun/Autorun.ICO
similarity index 100%
rename from Generals/Code/Tools/Autorun/Autorun.ICO
rename to Core/Tools/Autorun/Autorun.ICO
diff --git a/Generals/Code/Tools/Autorun/Autorun_BG.bmp b/Core/Tools/Autorun/Autorun_BG.bmp
similarity index 100%
rename from Generals/Code/Tools/Autorun/Autorun_BG.bmp
rename to Core/Tools/Autorun/Autorun_BG.bmp
diff --git a/Generals/Code/Tools/Autorun/Bullet.bmp b/Core/Tools/Autorun/Bullet.bmp
similarity index 100%
rename from Generals/Code/Tools/Autorun/Bullet.bmp
rename to Core/Tools/Autorun/Bullet.bmp
diff --git a/GeneralsMD/Code/Tools/Autorun/CDCNTRL.CPP b/Core/Tools/Autorun/CDCNTRL.CPP
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/CDCNTRL.CPP
rename to Core/Tools/Autorun/CDCNTRL.CPP
diff --git a/GeneralsMD/Code/Tools/Autorun/CDCNTRL.H b/Core/Tools/Autorun/CDCNTRL.H
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/CDCNTRL.H
rename to Core/Tools/Autorun/CDCNTRL.H
diff --git a/Core/Tools/Autorun/CMakeLists.txt b/Core/Tools/Autorun/CMakeLists.txt
new file mode 100644
index 00000000000..73f0f8965ed
--- /dev/null
+++ b/Core/Tools/Autorun/CMakeLists.txt
@@ -0,0 +1,62 @@
+set(AUTORUN_SRC
+ "ARGS.CPP"
+ "ARGS.H"
+ "autorun.cpp"
+ "autorun.h"
+ "CallbackHook.h"
+ "CDCNTRL.CPP"
+ "CDCNTRL.H"
+ "DrawButton.cpp"
+ "DrawButton.h"
+ "EZGIMEX.cpp"
+ "GameText.cpp"
+ "GameText.h"
+ "GETCD.CPP"
+ "GetCD.h"
+ "gimex.h"
+ "IGR.cpp"
+ "IGR.h"
+ "Jsupport.cpp"
+ "JSUPPORT.H"
+ "leanAndMeanAutorun.h"
+ "Locale_API.cpp"
+ "Locale_API.h"
+ "locale.cpp"
+ "locale.h"
+ "POINT.h"
+ "RECT.h"
+ "resource.h"
+ "TTFont.cpp"
+ "TTFont.h"
+ "Utils.cpp"
+ "Utils.h"
+ "ViewHTML.cpp"
+ "ViewHTML.h"
+ "WinFix.CPP"
+ "WinFix.H"
+ "Wnd_file.cpp"
+ "Wnd_File.h"
+ "WSYS_File.cpp"
+ "WSYS_file.h"
+ "WSYS_FileSystem.cpp"
+ "WSYS_FileSystem.h"
+ "WSYS_RAMFile.cpp"
+ "WSYS_RAMFile.h"
+ "WSYS_StdFile.cpp"
+ "WSYS_StdFile.h"
+ "WSYS_StdFileSystem.cpp"
+ "WSYS_StdFileSystem.h"
+)
+
+add_library(corei_autorun INTERFACE)
+
+target_sources(corei_autorun INTERFACE ${AUTORUN_SRC})
+
+target_link_libraries(corei_autorun INTERFACE
+ core_config
+ winmm
+)
+
+if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")
+ target_sources(corei_autorun INTERFACE AUTORUN.RC)
+endif()
diff --git a/GeneralsMD/Code/Tools/Autorun/CallbackHook.h b/Core/Tools/Autorun/CallbackHook.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/CallbackHook.h
rename to Core/Tools/Autorun/CallbackHook.h
diff --git a/GeneralsMD/Code/Tools/Autorun/DrawButton.cpp b/Core/Tools/Autorun/DrawButton.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/DrawButton.cpp
rename to Core/Tools/Autorun/DrawButton.cpp
diff --git a/GeneralsMD/Code/Tools/Autorun/DrawButton.h b/Core/Tools/Autorun/DrawButton.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/DrawButton.h
rename to Core/Tools/Autorun/DrawButton.h
diff --git a/GeneralsMD/Code/Tools/Autorun/EZGIMEX.cpp b/Core/Tools/Autorun/EZGIMEX.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/EZGIMEX.cpp
rename to Core/Tools/Autorun/EZGIMEX.cpp
diff --git a/Generals/Code/Tools/Autorun/mouse.wav b/Core/Tools/Autorun/English/Present.wav
similarity index 100%
rename from Generals/Code/Tools/Autorun/mouse.wav
rename to Core/Tools/Autorun/English/Present.wav
diff --git a/GeneralsMD/Code/Tools/Autorun/mouse.wav b/Core/Tools/Autorun/English/Rock-n-Roll.wav
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/mouse.wav
rename to Core/Tools/Autorun/English/Rock-n-Roll.wav
diff --git a/GeneralsMD/Code/Tools/Autorun/GETCD.CPP b/Core/Tools/Autorun/GETCD.CPP
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/GETCD.CPP
rename to Core/Tools/Autorun/GETCD.CPP
diff --git a/GeneralsMD/Code/Tools/Autorun/GameText.cpp b/Core/Tools/Autorun/GameText.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/GameText.cpp
rename to Core/Tools/Autorun/GameText.cpp
diff --git a/GeneralsMD/Code/Tools/Autorun/GameText.h b/Core/Tools/Autorun/GameText.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/GameText.h
rename to Core/Tools/Autorun/GameText.h
diff --git a/GeneralsMD/Code/Tools/Autorun/GetCD.h b/Core/Tools/Autorun/GetCD.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/GetCD.h
rename to Core/Tools/Autorun/GetCD.h
diff --git a/GeneralsMD/Code/Tools/Autorun/IGR.cpp b/Core/Tools/Autorun/IGR.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/IGR.cpp
rename to Core/Tools/Autorun/IGR.cpp
diff --git a/GeneralsMD/Code/Tools/Autorun/IGR.h b/Core/Tools/Autorun/IGR.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/IGR.h
rename to Core/Tools/Autorun/IGR.h
diff --git a/GeneralsMD/Code/Tools/Autorun/JSUPPORT.H b/Core/Tools/Autorun/JSUPPORT.H
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/JSUPPORT.H
rename to Core/Tools/Autorun/JSUPPORT.H
diff --git a/GeneralsMD/Code/Tools/Autorun/Jsupport.cpp b/Core/Tools/Autorun/Jsupport.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/Jsupport.cpp
rename to Core/Tools/Autorun/Jsupport.cpp
diff --git a/Generals/Code/Tools/Autorun/License French.bmp b/Core/Tools/Autorun/License French.bmp
similarity index 100%
rename from Generals/Code/Tools/Autorun/License French.bmp
rename to Core/Tools/Autorun/License French.bmp
diff --git a/Generals/Code/Tools/Autorun/License French2.bmp b/Core/Tools/Autorun/License French2.bmp
similarity index 100%
rename from Generals/Code/Tools/Autorun/License French2.bmp
rename to Core/Tools/Autorun/License French2.bmp
diff --git a/Generals/Code/Tools/Autorun/License German.bmp b/Core/Tools/Autorun/License German.bmp
similarity index 100%
rename from Generals/Code/Tools/Autorun/License German.bmp
rename to Core/Tools/Autorun/License German.bmp
diff --git a/Generals/Code/Tools/Autorun/License German2.bmp b/Core/Tools/Autorun/License German2.bmp
similarity index 100%
rename from Generals/Code/Tools/Autorun/License German2.bmp
rename to Core/Tools/Autorun/License German2.bmp
diff --git a/Generals/Code/Tools/Autorun/License USA.bmp b/Core/Tools/Autorun/License USA.bmp
similarity index 100%
rename from Generals/Code/Tools/Autorun/License USA.bmp
rename to Core/Tools/Autorun/License USA.bmp
diff --git a/Generals/Code/Tools/Autorun/License USA2.bmp b/Core/Tools/Autorun/License USA2.bmp
similarity index 100%
rename from Generals/Code/Tools/Autorun/License USA2.bmp
rename to Core/Tools/Autorun/License USA2.bmp
diff --git a/GeneralsMD/Code/Tools/Autorun/Locale_API.cpp b/Core/Tools/Autorun/Locale_API.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/Locale_API.cpp
rename to Core/Tools/Autorun/Locale_API.cpp
diff --git a/GeneralsMD/Code/Tools/Autorun/Locale_API.h b/Core/Tools/Autorun/Locale_API.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/Locale_API.h
rename to Core/Tools/Autorun/Locale_API.h
diff --git a/GeneralsMD/Code/Tools/Autorun/POINT.h b/Core/Tools/Autorun/POINT.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/POINT.h
rename to Core/Tools/Autorun/POINT.h
diff --git a/GeneralsMD/Code/Tools/Autorun/RECT.h b/Core/Tools/Autorun/RECT.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/RECT.h
rename to Core/Tools/Autorun/RECT.h
diff --git a/GeneralsMD/Code/Tools/Autorun/TTFont.cpp b/Core/Tools/Autorun/TTFont.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/TTFont.cpp
rename to Core/Tools/Autorun/TTFont.cpp
diff --git a/GeneralsMD/Code/Tools/Autorun/TTFont.h b/Core/Tools/Autorun/TTFont.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/TTFont.h
rename to Core/Tools/Autorun/TTFont.h
diff --git a/GeneralsMD/Code/Tools/Autorun/Utils.cpp b/Core/Tools/Autorun/Utils.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/Utils.cpp
rename to Core/Tools/Autorun/Utils.cpp
diff --git a/GeneralsMD/Code/Tools/Autorun/Utils.h b/Core/Tools/Autorun/Utils.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/Utils.h
rename to Core/Tools/Autorun/Utils.h
diff --git a/GeneralsMD/Code/Tools/Autorun/ViewHTML.cpp b/Core/Tools/Autorun/ViewHTML.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/ViewHTML.cpp
rename to Core/Tools/Autorun/ViewHTML.cpp
diff --git a/GeneralsMD/Code/Tools/Autorun/ViewHTML.h b/Core/Tools/Autorun/ViewHTML.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/ViewHTML.h
rename to Core/Tools/Autorun/ViewHTML.h
diff --git a/GeneralsMD/Code/Tools/Autorun/WSYS_File.cpp b/Core/Tools/Autorun/WSYS_File.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/WSYS_File.cpp
rename to Core/Tools/Autorun/WSYS_File.cpp
diff --git a/GeneralsMD/Code/Tools/Autorun/WSYS_FileSystem.cpp b/Core/Tools/Autorun/WSYS_FileSystem.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/WSYS_FileSystem.cpp
rename to Core/Tools/Autorun/WSYS_FileSystem.cpp
diff --git a/GeneralsMD/Code/Tools/Autorun/WSYS_FileSystem.h b/Core/Tools/Autorun/WSYS_FileSystem.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/WSYS_FileSystem.h
rename to Core/Tools/Autorun/WSYS_FileSystem.h
diff --git a/GeneralsMD/Code/Tools/Autorun/WSYS_RAMFile.cpp b/Core/Tools/Autorun/WSYS_RAMFile.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/WSYS_RAMFile.cpp
rename to Core/Tools/Autorun/WSYS_RAMFile.cpp
diff --git a/GeneralsMD/Code/Tools/Autorun/WSYS_RAMFile.h b/Core/Tools/Autorun/WSYS_RAMFile.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/WSYS_RAMFile.h
rename to Core/Tools/Autorun/WSYS_RAMFile.h
diff --git a/GeneralsMD/Code/Tools/Autorun/WSYS_StdFile.cpp b/Core/Tools/Autorun/WSYS_StdFile.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/WSYS_StdFile.cpp
rename to Core/Tools/Autorun/WSYS_StdFile.cpp
diff --git a/GeneralsMD/Code/Tools/Autorun/WSYS_StdFile.h b/Core/Tools/Autorun/WSYS_StdFile.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/WSYS_StdFile.h
rename to Core/Tools/Autorun/WSYS_StdFile.h
diff --git a/GeneralsMD/Code/Tools/Autorun/WSYS_StdFileSystem.cpp b/Core/Tools/Autorun/WSYS_StdFileSystem.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/WSYS_StdFileSystem.cpp
rename to Core/Tools/Autorun/WSYS_StdFileSystem.cpp
diff --git a/GeneralsMD/Code/Tools/Autorun/WSYS_StdFileSystem.h b/Core/Tools/Autorun/WSYS_StdFileSystem.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/WSYS_StdFileSystem.h
rename to Core/Tools/Autorun/WSYS_StdFileSystem.h
diff --git a/GeneralsMD/Code/Tools/Autorun/WSYS_file.h b/Core/Tools/Autorun/WSYS_file.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/WSYS_file.h
rename to Core/Tools/Autorun/WSYS_file.h
diff --git a/GeneralsMD/Code/Tools/Autorun/WinFix.CPP b/Core/Tools/Autorun/WinFix.CPP
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/WinFix.CPP
rename to Core/Tools/Autorun/WinFix.CPP
diff --git a/GeneralsMD/Code/Tools/Autorun/WinFix.H b/Core/Tools/Autorun/WinFix.H
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/WinFix.H
rename to Core/Tools/Autorun/WinFix.H
diff --git a/GeneralsMD/Code/Tools/Autorun/Wnd_File.h b/Core/Tools/Autorun/Wnd_File.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/Wnd_File.h
rename to Core/Tools/Autorun/Wnd_File.h
diff --git a/GeneralsMD/Code/Tools/Autorun/Wnd_file.cpp b/Core/Tools/Autorun/Wnd_file.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/Wnd_file.cpp
rename to Core/Tools/Autorun/Wnd_file.cpp
diff --git a/Generals/Code/Tools/Autorun/arrow.cur b/Core/Tools/Autorun/arrow.cur
similarity index 100%
rename from Generals/Code/Tools/Autorun/arrow.cur
rename to Core/Tools/Autorun/arrow.cur
diff --git a/GeneralsMD/Code/Tools/Autorun/autorun.cpp b/Core/Tools/Autorun/autorun.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/autorun.cpp
rename to Core/Tools/Autorun/autorun.cpp
diff --git a/GeneralsMD/Code/Tools/Autorun/autorun.h b/Core/Tools/Autorun/autorun.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/autorun.h
rename to Core/Tools/Autorun/autorun.h
diff --git a/GeneralsMD/Code/Tools/Autorun/gimex.h b/Core/Tools/Autorun/gimex.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/gimex.h
rename to Core/Tools/Autorun/gimex.h
diff --git a/GeneralsMD/Code/Tools/Autorun/leanAndMeanAutorun.h b/Core/Tools/Autorun/leanAndMeanAutorun.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/leanAndMeanAutorun.h
rename to Core/Tools/Autorun/leanAndMeanAutorun.h
diff --git a/GeneralsMD/Code/Tools/Autorun/locale.cpp b/Core/Tools/Autorun/locale.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/locale.cpp
rename to Core/Tools/Autorun/locale.cpp
diff --git a/GeneralsMD/Code/Tools/Autorun/locale.h b/Core/Tools/Autorun/locale.h
similarity index 100%
rename from GeneralsMD/Code/Tools/Autorun/locale.h
rename to Core/Tools/Autorun/locale.h
diff --git a/Core/Tools/Autorun/mouse.wav b/Core/Tools/Autorun/mouse.wav
new file mode 100644
index 00000000000..2995a4d0e74
--- /dev/null
+++ b/Core/Tools/Autorun/mouse.wav
@@ -0,0 +1 @@
+dummy
\ No newline at end of file
diff --git a/Generals/Code/Tools/Autorun/resource.h b/Core/Tools/Autorun/resource.h
similarity index 100%
rename from Generals/Code/Tools/Autorun/resource.h
rename to Core/Tools/Autorun/resource.h
diff --git a/Core/Tools/CMakeLists.txt b/Core/Tools/CMakeLists.txt
index 542db74c0c5..55b529f0d2e 100644
--- a/Core/Tools/CMakeLists.txt
+++ b/Core/Tools/CMakeLists.txt
@@ -20,3 +20,12 @@ if(RTS_BUILD_CORE_EXTRAS)
add_subdirectory(wolSetup)
add_subdirectory(WW3D)
endif()
+
+# Add library interfaces here
+if(RTS_BUILD_GENERALS_TOOLS OR RTS_BUILD_ZEROHOUR_TOOLS)
+endif()
+
+# Add library interfaces here
+if(RTS_BUILD_GENERALS_EXTRAS OR RTS_BUILD_ZEROHOUR_EXTRAS)
+ add_subdirectory(Autorun)
+endif()
diff --git a/Generals/Code/Tools/Autorun/ARGS.CPP b/Generals/Code/Tools/Autorun/ARGS.CPP
deleted file mode 100644
index bfacd4caec9..00000000000
--- a/Generals/Code/Tools/Autorun/ARGS.CPP
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//======================================================================================
-//
-// @@@@@ @@ @ @@@@ @@@@ @@@@ @@ @ @@@@ @@@@ @@@@@ @@@@@ @@@@ @@ @
-// @@ @ @@ @ @@ @ @@ @ @@ @ @@@ @ @@ @ @@ @ @@ @ @@ @ @@ @ @@ @
-// @@@@@ @@ @ @@ @@ @@@@@@ @@ @ @ @@@@ @@@@ @@@@@ @@@@@ @@@@@@ @@
-// @@ @ @@ @ @@ @ @@ @ @@ @ @@ @@ @@ @ @@ @ @@ @ @@ @ @@ @ @@
-// @@@@@ @@@@ @@@@ @@@@ @@ @ @@ @ @@@@ @@@@ @@ @ @@@@@ @@ @ @@
-//
-// Copyright (c) 1998, 1999 Westwood Studios -- CONFIDENTIAL
-//
-// ArgC_ArgV.cpp
-//
-//======================================================================================
-
-//-----------------------------------------------------------------------------
-// INCLUDES
-//-----------------------------------------------------------------------------
-#define STRICT
-#include
-#include
-#include
-#include
-#include
-
-#include "ARGS.H"
-
-//-----------------------------------------------------------------------------
-// GLOBALS
-//-----------------------------------------------------------------------------
-
-Command_Line_Arguments *Args = NULL;
-
-//*****************************************************************************
-// COMMAND_LINE_ARGUMENTS::COMMAND_LINE_ARGUMENTS -- Constructor.
-//
-// INPUT: HINSTANCE hInstance
-// LPSTR lpszCmdLine
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 09/01/1997 ML/MG : Created.
-//=============================================================================
-
-Command_Line_Arguments::Command_Line_Arguments (
- HINSTANCE current_instance_handle,
- LPTSTR windows_command_line_string )
-{
- //--------------------------------------------------------------------------
- // debug checks...
- //--------------------------------------------------------------------------
- assert( windows_command_line_string != NULL );
-
- //--------------------------------------------------------------------------
- // reset all class data
- //--------------------------------------------------------------------------
- memset( ArgV, 0, sizeof( ArgV ) );
-
- //--------------------------------------------------------------------------
- // Store the program name in ArgV[ 0 ].
- //--------------------------------------------------------------------------
- GetModuleFileName( current_instance_handle, ArgV[ 0 ], MAX_ARGUMENT_LENGTH );
-
- const char * ptr = windows_command_line_string;
- bool potentially_forever = true;
-
- ArgC = 1;
-
- while( potentially_forever ) {
-
- //-----------------------------------------------------------------------
- // Find the next non-whitespace character in the string.
- //-----------------------------------------------------------------------
- while ( *ptr == ' ' ) {
- ++ ptr;
- }
-
- //-----------------------------------------------------------------------
- // If we're at the end of the string, quit.
- //-----------------------------------------------------------------------
- if ( *ptr == '\0' ) {
- break;
- }
-
- //-----------------------------------------------------------------------
- // Store a command-line argument.
- //-----------------------------------------------------------------------
- int i = 0;
-
- if ( *ptr == '"' ) {
-
- //--------------------------------------------------------------------
- // Skip the opening quotation mark.
- //--------------------------------------------------------------------
- ++ ptr;
-
- //--------------------------------------------------------------------
- // Collect characters until another quotation mark is encountered.
- //--------------------------------------------------------------------
- while ( *ptr != '\0' && *ptr != '"' ) {
- if ( i < MAX_ARGUMENT_LENGTH - 1 ) {
- ArgV [ ArgC ][ i ] = *ptr;
- ++ i;
- }
- ++ ptr;
- }
-
- //--------------------------------------------------------------------
- // Skip the closing quotation mark.
- //--------------------------------------------------------------------
- if ( *ptr == '"' ) {
- ++ ptr;
- }
-
- } else {
-
- //--------------------------------------------------------------------
- // Collect characters until a whitespace character is encountered.
- //--------------------------------------------------------------------
- while ( *ptr != '\0' && *ptr != ' ' ) {
- if ( i < MAX_ARGUMENT_LENGTH - 1 ) {
- ArgV [ ArgC ][ i ] = *ptr;
- ++ i;
- }
- ++ ptr;
- }
- }
-
- ArgV [ ArgC ][ i ] = '\0';
- ++ ArgC;
- }
-}
-
-//*****************************************************************************
-// COMMAND_LINE_ARGUMENTS::COMMAND_LINE_ARGUMENTS -- Constructor.
-//
-// INPUT: HINSTANCE hInstance
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 09/01/1997 ML/MG : Created.
-//=============================================================================
-
-Command_Line_Arguments::Command_Line_Arguments ( HINSTANCE current_instance_handle )
-{
-
- char * windows_command_line_string = GetCommandLine();
-
- //--------------------------------------------------------------------------
- // debug checks...
- //--------------------------------------------------------------------------
- assert( windows_command_line_string != NULL );
-
- //--------------------------------------------------------------------------
- // reset all class data
- //--------------------------------------------------------------------------
- memset( ArgV, 0, sizeof( ArgV ) );
-
- const char * ptr = windows_command_line_string;
- bool potentially_forever = true;
-
- ArgC = 1;
-
- while( potentially_forever ) {
-
- //-----------------------------------------------------------------------
- // Find the next non-whitespace character in the string.
- //-----------------------------------------------------------------------
- while ( *ptr == ' ' ) {
- ++ ptr;
- }
-
- //-----------------------------------------------------------------------
- // If we're at the end of the string, quit.
- //-----------------------------------------------------------------------
- if ( *ptr == '\0' ) {
- break;
- }
-
- //-----------------------------------------------------------------------
- // Store a command-line argument.
- //-----------------------------------------------------------------------
- int i = 0;
-
- if ( *ptr == '"' ) {
-
- //--------------------------------------------------------------------
- // Skip the opening quotation mark.
- //--------------------------------------------------------------------
- ++ ptr;
-
- //--------------------------------------------------------------------
- // Collect characters until another quotation mark is encountered.
- //--------------------------------------------------------------------
- while ( *ptr != '\0' && *ptr != '"' ) {
- if ( i < MAX_ARGUMENT_LENGTH - 1 ) {
- ArgV [ ArgC ][ i ] = *ptr;
- ++ i;
- }
- ++ ptr;
- }
-
- //--------------------------------------------------------------------
- // Skip the closing quotation mark.
- //--------------------------------------------------------------------
- if ( *ptr == '"' ) {
- ++ ptr;
- }
-
- } else {
-
- //--------------------------------------------------------------------
- // Collect characters until a whitespace character is encountered.
- //--------------------------------------------------------------------
- while ( *ptr != '\0' && *ptr != ' ' ) {
- if ( i < MAX_ARGUMENT_LENGTH - 1 ) {
- ArgV [ ArgC ][ i ] = *ptr;
- ++ i;
- }
- ++ ptr;
- }
- }
-
- ArgV [ ArgC ][ i ] = '\0';
- ++ ArgC;
- }
-}
-
-//*****************************************************************************
-// COMMAND_LINE_ARGUMENTS::~COMMAND_LINE_ARGUMENTS -- Destructor.
-//
-// INPUT: HINSTANCE hInstance
-// LPSTR lpszCmdLine
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 09/01/1997 ML/MG : Created.
-//=============================================================================
-
-Command_Line_Arguments::~Command_Line_Arguments ( void )
-{
- //--------------------------------------------------------------------------
- // reset all data...
- //--------------------------------------------------------------------------
- ArgC = -1;
- memset( ArgV, 0, sizeof( ArgV ) );
-}
-
-//*****************************************************************************
-// COMMAND_LINE_ARGUMENTS::GET_ARGC -- Return ArgC.
-//
-// INPUT: none.
-//
-// OUTPUT: int ArgC.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 09/01/1997 ML/MG : Created.
-//=============================================================================
-
-int Command_Line_Arguments::Get_argc ( void )
-{
- //--------------------------------------------------------------------------
- // debug checks - make sure we at least have the application name
- //--------------------------------------------------------------------------
- assert( ArgC >= 1 );
-
- //--------------------------------------------------------------------------
- // return how many string parameters there are in the "argv" list
- //--------------------------------------------------------------------------
- return( ArgC );
-}
-
-//*****************************************************************************
-// COMMAND_LINE_ARGUMENTS::GET_ARGV -- Return ArgV.
-//
-// INPUT: none.
-//
-// OUTPUT: int ArgV.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 09/01/1997 ML/MG : Created.
-//=============================================================================
-
-const char *Command_Line_Arguments::Get_argv ( int argument_index )
-{
- //--------------------------------------------------------------------------
- // debug checks - make sure we at least have the application name
- //--------------------------------------------------------------------------
- assert( argument_index >= 0 );
- assert( argument_index < MAX_COMMAND_LINE_ARGUMENTS );
- assert( argument_index < ArgC );
- assert( ArgC >= 1 );
-
- //--------------------------------------------------------------------------
- // return
- //--------------------------------------------------------------------------
- return( ArgV[ argument_index ] );
-}
-
-void Command_Line_Arguments::Set_argv( int argument_index, char *arg )
-{
- if( arg == NULL || *arg == '\0' ) {
- return;
- }
-
- //--------------------------------------------------------------------------
- // debug checks - make sure we at least have the application name
- //--------------------------------------------------------------------------
- assert( argument_index >= 0 );
- assert( argument_index < MAX_COMMAND_LINE_ARGUMENTS );
- assert( argument_index < ArgC );
- assert( ArgC >= 1 );
-
- if (( argument_index >= 0 ) &&
- ( argument_index < MAX_COMMAND_LINE_ARGUMENTS ) &&
- ( argument_index < ArgC )) {
-
- strcpy( ArgV[ argument_index ], arg );
- }
-}
-
-
diff --git a/Generals/Code/Tools/Autorun/ARGS.H b/Generals/Code/Tools/Autorun/ARGS.H
deleted file mode 100644
index 49e95b102f1..00000000000
--- a/Generals/Code/Tools/Autorun/ARGS.H
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//================================================================================================
-//
-// @@@@@ @@ @ @@@@ @@@@ @@@@ @@ @ @@@@ @@@@ @@@@@ @@@@@ @@@@ @@ @
-// @@ @ @@ @ @@ @ @@ @ @@ @ @@@ @ @@ @ @@ @ @@ @ @@ @ @@ @ @@ @
-// @@@@@ @@ @ @@ @@ @@@@@@ @@ @ @ @@@@ @@@@ @@@@@ @@@@@ @@@@@@ @@
-// @@ @ @@ @ @@ @ @@ @ @@ @ @@ @@ @@ @ @@ @ @@ @ @@ @ @@ @ @@
-// @@@@@ @@@@ @@@@ @@@@ @@ @ @@ @ @@@@ @@@@ @@ @ @@@@@ @@ @ @@
-//
-// Copyright (c) 1998, 1999 Westwood Studios -- CONFIDENTIAL
-//
-// ArgC_ArgV.h
-//
-//================================================================================================
-
-#ifndef ARGS_H
-#define ARGS_H
-
-//----------------------------------------------------------------------------
-// INCLUDES
-//----------------------------------------------------------------------------
-#include
-//#include "autorun.h"
-
-//----------------------------------------------------------------------------
-// DEFINES
-//----------------------------------------------------------------------------
-#define MAX_COMMAND_LINE_ARGUMENTS 10
-#define MAX_ARGUMENT_LENGTH 80
-
-//----------------------------------------------------------------------------
-// CLASS
-//----------------------------------------------------------------------------
-class Command_Line_Arguments
-{
- public:
- Command_Line_Arguments ( HINSTANCE, LPTSTR );
- Command_Line_Arguments ( LPTSTR ) {};
- Command_Line_Arguments ( HINSTANCE );
- ~Command_Line_Arguments( void );
-
- const char * Get_argv( int argument_index );
- int Get_argc();
- void Set_argv( int argument_index, char*arg );
-
- private:
- int ArgC;
- char ArgV[ MAX_COMMAND_LINE_ARGUMENTS ][ MAX_ARGUMENT_LENGTH ];
-};
-
-extern Command_Line_Arguments *Args;
-
-#endif // ARGC_ARGV_H
\ No newline at end of file
diff --git a/Generals/Code/Tools/Autorun/CDCNTRL.CPP b/Generals/Code/Tools/Autorun/CDCNTRL.CPP
deleted file mode 100644
index a8185a0495c..00000000000
--- a/Generals/Code/Tools/Autorun/CDCNTRL.CPP
+++ /dev/null
@@ -1,1116 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Command & Conquer *
- * *
- * $Archive:: /Renegade Setup/Autorun/CDCNTRL.CPP $*
- * *
- * $Author:: Maria_l $*
- * *
- * $Modtime:: 10/18/01 5:33p $*
- * *
- * $Revision:: 5 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * *
- * CDControlClass::Auto_Eject_Volume -- Eject the removable media *
- * CDControlClass::Auto_Eject_Volume_95 -- Eject the specified CD drive *
- * CDControlClass::CDControlClass -- Class constructor *
- * CDControlClass::Close_Removable_Volume -- Close the handle to a removable volume *
- * CDControlClass::Close_VWin32 -- Closes the handle opened by Open_VWin32. *
- * CDControlClass::Dismount_Volume -- Dismount the given volume *
- * CDControlClass::Eject_CD -- Force the CD drive to eject *
- * CDControlClass::Eject_CD_Win95 -- Eject the cd in the given drive *
- * CDControlClass::Force_CD_Eject -- Ppen the CD tray on the given drive *
- * CDControlClass::Lock_CD_Drive -- Lock the CD tray and prevent ejection *
- * CDControlClass::Lock_CD_Drive_95 -- Prevent the user from ejecting the cd in the given driv*
- * CDControlClass::Lock_CD_Tray -- Prevent CD ejection on the specified drive *
- * CDControlClass::Lock_Logical_Volume -- Take a lock on a logical volume *
- * CDControlClass::Lock_Volume -- Prevent access by other threads to a given volume *
- * CDControlClass::Lock_Volume_95 -- Locks removable media so that it can't be ejected *
- * CDControlClass::Open_Removable_Volume -- Fetch a handle to a removable drive *
- * CDControlClass::Open_VWin32 -- Opens a handle to VWIN32 to issue low-level disk I/O *
- * CDControlClass::Prevent_Removal_Of_Volume -- Disable the eject button on the given drive *
- * CDControlClass::Unlock_CD_Drive -- Unlock the CD tray and allow ejection *
- * CDControlClass::Unlock_CD_Drive_95 -- Allow the user to eject the cd in the given drive *
- * CDControlClass::Unlock_CD_Tray -- Allow CD ejection on the specified drive *
- * CDControlClass::Unlock_Logical_Volume -- Unlocks a logical volume *
- * CDControlClass::Unlock_Volume -- Allow access by other threads to a given volume *
- * CDControlClass::Unlock_Volume_95 -- Unlocks removable media so that it can be ejected *
- * CDControlClass::~CDControlClass -- Class destructor *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "assert.h"
-#include "CDCNTRL.H"
-#include "WinFix.H"
-#include "Wnd_File.h"
-#pragma warning(disable : 4201)
-#include
-#include
-#include
-
-
-CDControlClass CDControl;
-
-
-void Last_Error_Text ( LPCTSTR szPrefix, HRESULT hr );
-
-
-/***********************************************************************************************
- * CDControlClass::CDControlClass -- Class constructor *
- * *
- * INPUT: Nothing *
- * *
- * OUTPUT: Nothing *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/17/99 2:03AM ST : Created *
- *=============================================================================================*/
-CDControlClass::CDControlClass(void)
-{
-}
-
-
-/***********************************************************************************************
- * CDControlClass::~CDControlClass -- Class destructor *
- * *
- * INPUT: Nothing *
- * *
- * OUTPUT: Nothing *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/17/99 2:03AM ST : Created *
- *=============================================================================================*/
-CDControlClass::~CDControlClass(void)
-{
-}
-
-/***********************************************************************************************
- * CDControlClass::Force_CD_Eject -- Ppen the CD tray on the given drive *
- * *
- * INPUT: Drive number (0=a, 1=b etc) *
- * *
- * OUTPUT: Nothing *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/17/99 1:17AM ST : Created *
- *=============================================================================================*/
-void CDControlClass::Force_CD_Eject(int drive)
-{
- if ( WinVersion.Is_Win9x() ) {
- Eject_CD_Win95(drive);
- }else{
- Eject_CD(drive);
- }
-}
-
-/***********************************************************************************************
- * CDControlClass::Lock_CD_Tray -- Prevent CD ejection on the specified drive *
- * *
- * INPUT: drive number (0=a: etc) *
- * *
- * OUTPUT: true if locked *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/17/99 1:56AM ST : Created *
- *=============================================================================================*/
-bool CDControlClass::Lock_CD_Tray (int drive)
-{
- if ( WinVersion.Is_Win9x() ) {
- return (Lock_CD_Drive_95(drive));
- }else{
- return (Lock_CD_Drive(drive));
- }
-}
-
-/***********************************************************************************************
- * CDControlClass::Unlock_CD_Tray -- Allow CD ejection on the specified drive *
- * *
- * INPUT: drive number (0=a: etc) *
- * *
- * OUTPUT: true if unlocked OK *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/17/99 1:57AM ST : Created *
- *=============================================================================================*/
-bool CDControlClass::Unlock_CD_Tray (int drive)
-{
- if ( WinVersion.Is_Win9x() ) {
- return (Unlock_CD_Drive_95(drive));
- }else{
- return (Unlock_CD_Drive(drive));
- }
-}
-
-/***********************************************************************************************
- * CDControlClass::Open_Removable_Volume -- Fetch a handle to a removable drive *
- * *
- * INPUT: Nothing *
- * *
- * OUTPUT: Nothing *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/16/99 11:25PM ST : Created *
- *=============================================================================================*/
-HANDLE CDControlClass::Open_Removable_Volume( char drive )
-{
- assert (WinVersion.Is_WinNT());
-
- HANDLE volume;
- unsigned drivetype;
- char volume_name[8];
- char rootname[5];
- unsigned long access_flags;
-
- /*----------------------------------------------------------------------------------------
- ** Get the drive type to ensure that this is a removable volume.
- */
- _stprintf (rootname, _TEXT( "%c:\\" ), drive + 'A');
- drivetype = GetDriveType( rootname );
-
- switch( drivetype ) {
-
- case DRIVE_REMOVABLE:
- access_flags = GENERIC_READ | GENERIC_WRITE;
- break;
-
- case DRIVE_CDROM:
- access_flags = GENERIC_READ;
- break;
-
- default:
-// DebugString ("Attempt to open non-removable volume for locking or ejection\n");
- Msg( __LINE__, TEXT(__FILE__), TEXT("Attempt to open non-removable volume for locking or ejection" ));
- return( INVALID_HANDLE_VALUE );
- }
-
- /*----------------------------------------------------------------------------------------
- ** Get a handle to the volume.
- */
- _stprintf( volume_name, _TEXT( "\\\\.\\%c:" ), drive + 'A' );
- volume = CreateFile( volume_name, access_flags, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
-
-// assert (volume != INVALID_HANDLE_VALUE);
-
- if ( volume == INVALID_HANDLE_VALUE ) {
-// DebugString ("Unable to open drive %c: for ejection\n", drive + 'A');
- Msg( __LINE__, TEXT(__FILE__), TEXT("Unable to open drive %c: for ejection"), drive + 'A' - 1 );
- }
- return( volume );
-}
-
-/***********************************************************************************************
- * CDControlClass::Close_Removable_Volume -- Close the handle to a removable volume *
- * *
- * INPUT: HANDLE of volume to close *
- * *
- * OUTPUT: Nothing *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/16/99 11:27PM ST : Created *
- *=============================================================================================*/
-bool CDControlClass::Close_Removable_Volume(HANDLE volume)
-{
- assert (WinVersion.Is_WinNT());
- return ((CloseHandle(volume)) ? true : false);
-}
-
-/***********************************************************************************************
- * CDControlClass::Lock_Volume -- Prevent access by other threads to a given volume *
- * *
- * INPUT: HANDLE to volume *
- * *
- * OUTPUT: true if locked *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/16/99 11:29PM ST : Created *
- *=============================================================================================*/
-bool CDControlClass::Lock_Volume( HANDLE volume )
-{
- assert( WinVersion.Is_WinNT( ));
-
- unsigned long bytes_returned = 0;
- unsigned long sleep_amount = LOCK_TIMEOUT / LOCK_RETRIES;
-
- /*
- ** Do this in a loop until a timeout period has expired
- */
- for ( int trycount = 0; trycount < LOCK_RETRIES; trycount++ ) {
-
- if ( DeviceIoControl( volume, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &bytes_returned, NULL )) {
- return( true );
- }
-// Msg( __LINE__, TEXT(__FILE__), TEXT("DeviceIoControl failed to lock volume. Error %d - %s"), GetLastError(), Last_Error_Text());
- Last_Error_Text( _TEXT( "DeviceIoControl failed to lock volume." ), GetLastError());
-// Sleep( sleep_amount );
- Sleep( LOCK_TIMEOUT );
- }
- return( false );
-}
-
-/***********************************************************************************************
- * CDControlClass::Unlock_Volume -- Allow access by other threads to a given volume *
- * *
- * INPUT: HANDLE to volume *
- * *
- * OUTPUT: true if unlocked *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/16/99 11:29PM ST : Created *
- *=============================================================================================*/
-bool CDControlClass::Unlock_Volume(HANDLE volume)
-{
- assert( WinVersion.Is_WinNT());
-
- unsigned long bytes_returned;
- unsigned long sleep_amount = LOCK_TIMEOUT / LOCK_RETRIES;
-
- /*
- ** Do this in a loop until a timeout period has expired
- */
- for ( int trycount = 0; trycount < LOCK_RETRIES; trycount++ ) {
-
- if ( DeviceIoControl( volume, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL, 0, &bytes_returned, NULL )) return( true );
-// DebugString ("DeviceIoControl failed to unlock volume. Error %d - %s\n", GetLastError(), Last_Error_Text());
-// Msg( __LINE__, __FILE__, "DeviceIoControl failed to unlock volume. Error %d - %s", GetLastError(), Last_Error_Text());
- Last_Error_Text( _TEXT( "DeviceIoControl failed to unlock volume." ), GetLastError());
-// Sleep( sleep_amount );
- Sleep( LOCK_TIMEOUT );
- }
- return( false );
-}
-
-/***********************************************************************************************
- * CDControlClass::Dismount_Volume -- Dismount the given volume *
- * *
- * INPUT: HANDLE of volume to dismount *
- * *
- * OUTPUT: true if volume dismounted OK *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/16/99 11:31PM ST : Created *
- *=============================================================================================*/
-bool CDControlClass::Dismount_Volume(HANDLE volume)
-{
- assert( WinVersion.Is_WinNT());
-
- unsigned long bytes_returned;
- bool result = ((DeviceIoControl( volume, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0, &bytes_returned, NULL)) ? true : false );
-
- if (result == false) {
-// DebugString ("DeviceIoControl failed to dismount volume. Error %d - %s\n", GetLastError(), Last_Error_Text());
-// Msg( __LINE__, __FILE__, "DeviceIoControl failed to dismount volume. Error %d - %s", GetLastError(), Last_Error_Text());
- Last_Error_Text( _TEXT( "DeviceIoControl failed to dismount volume." ), GetLastError());
- }
- return( result );
-}
-
-/***********************************************************************************************
- * CDControlClass::Prevent_Removal_Of_Volume -- Disable the eject button on the given drive *
- * *
- * INPUT: HANDLE of volume to enable/disable *
- * true to prevent removal. false to allow it. *
- * *
- * OUTPUT: true if status changed OK *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/16/99 11:32PM ST : Created *
- *=============================================================================================*/
-bool CDControlClass::Prevent_Removal_Of_Volume( HANDLE volume, bool prevent )
-{
- assert( WinVersion.Is_WinNT());
-
- unsigned long bytes_returned;
- PREVENT_MEDIA_REMOVAL pmrbuffer;
-
- pmrbuffer.PreventMediaRemoval = prevent;
-
- bool result = ((DeviceIoControl( volume, IOCTL_STORAGE_MEDIA_REMOVAL, &pmrbuffer, sizeof(PREVENT_MEDIA_REMOVAL), NULL, 0, &bytes_returned, NULL)) ? true : false);
-
- if (result == false) {
-// DebugString ("DeviceIoControl failed to prevent media removal. Error %d - %s\n", GetLastError(), Last_Error_Text());
-// Msg( __LINE__, __FILE__, "DeviceIoControl failed to prevent media removal. Error %d - %s", GetLastError(), Last_Error_Text());
- Last_Error_Text( _TEXT( "DeviceIoControl failed to prevent media removal." ), GetLastError());
- }
- return( result );
-}
-
-/***********************************************************************************************
- * CDControlClass::Auto_Eject_Volume -- Eject the removable media *
- * *
- * INPUT: HANDLE of volume to eject *
- * *
- * OUTPUT: true if ejection occured *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/16/99 11:34PM ST : Created *
- *=============================================================================================*/
-bool CDControlClass::Auto_Eject_Volume(HANDLE volume)
-{
- assert (WinVersion.Is_WinNT());
- unsigned long bytes_returned;
- bool result = ((DeviceIoControl( volume, IOCTL_STORAGE_EJECT_MEDIA, NULL, 0, NULL, 0, &bytes_returned, NULL)) ? true : false);
-
- if (result == false) {
-// DebugString ("DeviceIoControl failed to eject media. Error %d - %s\n", GetLastError(), Last_Error_Text());
-// Msg( __LINE__, __FILE__, "DeviceIoControl failed to eject media. Error %d - %s", GetLastError(), Last_Error_Text());
- Last_Error_Text( TEXT("DeviceIoControl failed to eject media."), GetLastError());
- }
- return (result);
-}
-
-/***********************************************************************************************
- * CDControlClass::Eject_CD -- Force the CD drive to eject *
- * *
- * INPUT: drive number *
- * *
- * OUTPUT: true if ejected *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/16/99 11:35PM ST : Created *
- *=============================================================================================*/
-bool CDControlClass::Eject_CD(char drive)
-{
- assert (WinVersion.Is_WinNT());
- HANDLE volume;
- bool ejected = false;
-
- volume = Open_Removable_Volume(drive);
-
- if (volume == INVALID_HANDLE_VALUE) return (false);
-
- /*
- ** Lock and dismount the volume.
- */
- if (Lock_Volume(volume) && Dismount_Volume(volume)) {
-
- /*
- ** Set prevent removal to false and eject the volume.
- */
- if (Prevent_Removal_Of_Volume(volume, false) && Auto_Eject_Volume(volume)) {
- ejected = true;
- }
- }
-
- /*
- ** Close the volume so other processes can use the drive.
- */
- Close_Removable_Volume(volume);
-
- return (ejected);
-}
-
-/***********************************************************************************************
- * CDControlClass::Lock_CD_Drive -- Lock the CD tray and prevent ejection *
- * *
- * INPUT: drive number *
- * *
- * OUTPUT: true if locked *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/17/99 0:11AM ST : Created *
- *=============================================================================================*/
-bool CDControlClass::Lock_CD_Drive(char drive)
-{
- assert (WinVersion.Is_WinNT());
- HANDLE volume;
- bool retval = false;
-
- volume = Open_Removable_Volume(drive);
-
- if (volume == INVALID_HANDLE_VALUE) return (false);
-
- /*
- ** Lock the volume.
- */
- if (Lock_Volume(volume)) {
-
- /*
- ** Set prevent removal to false
- */
- if (Prevent_Removal_Of_Volume(volume, true)) {
- retval = true;
- }
- }
-
- /*
- ** Close the volume so other processes can use the drive.
- */
- Unlock_Volume(volume);
- Close_Removable_Volume(volume);
-
- return (true);
-}
-
-/***********************************************************************************************
- * CDControlClass::Unlock_CD_Drive -- Unlock the CD tray and allow ejection *
- * *
- * INPUT: drive number *
- * *
- * OUTPUT: true if unlocked *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/17/99 0:11AM ST : Created *
- *=============================================================================================*/
-bool CDControlClass::Unlock_CD_Drive(char drive)
-{
- assert (WinVersion.Is_WinNT());
- HANDLE volume;
- bool retval = false;
-
- volume = Open_Removable_Volume(drive);
-
- if (volume == INVALID_HANDLE_VALUE) return (false);
-
- /*
- ** Lock the volume.
- */
- if (Lock_Volume(volume)) {
-
- /*
- ** Set prevent removal to false
- */
- if (Prevent_Removal_Of_Volume(volume, false)) {
- retval = true;
- }
- }
-
- /*
- ** Close the volume so other processes can use the drive.
- */
- Unlock_Volume(volume);
- Close_Removable_Volume(volume);
-
- return (true);
-}
-
-/***********************************************************************************************
- * CDControlClass::Eject_CD_Win95 -- Eject the cd in the given drive *
- * *
- * INPUT: drive. 0=a etc. *
- * *
- * OUTPUT: Nothing *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/17/99 1:04AM ST : Created *
- *=============================================================================================*/
-void CDControlClass::Eject_CD_Win95 (char drive)
-{
- assert (WinVersion.Is_Win9x());
- HANDLE vwin32 = INVALID_HANDLE_VALUE;
-
- drive++;
- vwin32 = Open_VWin32 ();
- assert (vwin32 != INVALID_HANDLE_VALUE);
-
- /*
- ** Make sure no other applications are using the drive.
- */
- bool drive_locked = Lock_Logical_Volume (vwin32, drive, 0, 0);
-// assert (drive_locked);
- if (!drive_locked) {
-// DebugString("Unable to lock volume %c:\n", 'A' + drive - 1);
- Msg( __LINE__, TEXT(__FILE__), TEXT("Unable to lock volume %c: "), 'A' + drive - 1 );
- return;
- }
-
- /*
- ** Make sure there is no software lock keeping the media in the drive.
- */
- if (!Unlock_Volume_95 (vwin32, drive)) {
-// DebugString("Could not unlock media from drive %c:\n", 'A' + drive - 1);
- Msg( __LINE__, TEXT(__FILE__), TEXT("Could not unlock media from drive %c: "), 'A' + drive - 1 );
- Unlock_Logical_Volume (vwin32, drive);
- return;
- }
-
- /*
- ** Eject!
- */
- if (!Auto_Eject_Volume_95 (vwin32, drive)) {
-// DebugString("Could not eject media from drive %c:\n", 'A' + drive - 1);
- Msg( __LINE__, TEXT(__FILE__), TEXT("Could not eject media from drive %c: "), 'A' + drive - 1 );
- }
-
- Unlock_Logical_Volume (vwin32, drive);
- Close_VWin32 (vwin32);
-}
-
-/***********************************************************************************************
- * CDControlClass::Lock_CD_Drive_95 -- Prevent the user from ejecting the cd in the given drive*
- * *
- * INPUT: drive. 0=a etc. *
- * *
- * OUTPUT: Nothing *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/17/99 1:04AM ST : Created *
- *=============================================================================================*/
-bool CDControlClass::Lock_CD_Drive_95 (char drive)
-{
-// DebugString ("CDControlClass::Lock_CD_Drive_95\n");
- Msg( __LINE__, TEXT(__FILE__), TEXT("CDControlClass::Lock_CD_Drive_95." ));
-
- bool retval = true;
- assert (WinVersion.Is_Win9x());
- HANDLE vwin32 = INVALID_HANDLE_VALUE;
-
-// DebugString ("Preventing ejection on CD drive %c\n", drive + 'A');
- Msg( __LINE__, TEXT(__FILE__), TEXT("Preventing ejection on CD drive %c: "), 'A' + drive -1 );
-
- drive++;
- vwin32 = Open_VWin32();
- assert (vwin32 != INVALID_HANDLE_VALUE);
-
- /*
- ** Make sure no other applications are using the drive.
- */
-// DebugString ("About to lock logical volume to enable exclusive access\n");
- Msg( __LINE__, TEXT(__FILE__), TEXT("About to lock logical volume to enable exclusive access." ));
-
- bool drive_locked = Lock_Logical_Volume (vwin32, drive, 0, 0);
-// assert (drive_locked);
- if (!drive_locked) {
-// DebugString("Unable to lock volume %c:\n", 'A' + drive - 1);
- Msg( __LINE__, TEXT(__FILE__), TEXT("Unable to lock volume %c:"), 'A' + drive - 1 );
- return(false);
- }
-// DebugString ("Volume locked OK\n");
- Msg( __LINE__, TEXT(__FILE__), TEXT("Volume locked OK." ));
-
- /*
- ** Lock the tray in the closed position.
- */
-// DebugString ("About to prevent CD tray ejection\n");
- Msg( __LINE__, TEXT(__FILE__), TEXT("About to prevent CD tray ejection." ));
-
- if (!Lock_Volume_95 (vwin32, drive)) {
-// DebugString("Could not lock CD tray in drive %c:\n", 'A' + drive - 1);
- Msg( __LINE__, TEXT(__FILE__), TEXT("Could not lock CD tray in drive %c:"), 'A' + drive - 1 );
- retval = false;
- }else{
-// DebugString ("CD tray ejection disabled OK\n");
- Msg( __LINE__, TEXT(__FILE__), TEXT("CD tray ejection disabled OK." ));
- }
-
- Unlock_Logical_Volume (vwin32, drive);
- Close_VWin32 (vwin32);
-
-// DebugString ("CDControlClass::Lock_CD_Drive_95 returning %s\n", retval ? "true" : "false");
- Msg( __LINE__, TEXT(__FILE__), TEXT("CDControlClass::Lock_CD_Drive_95 returning %s."), retval ? "true" : "false" );
-
- return (retval);
-}
-
-/***********************************************************************************************
- * CDControlClass::Unlock_CD_Drive_95 -- Allow the user to eject the cd in the given drive *
- * *
- * INPUT: drive. 0=a etc. *
- * *
- * OUTPUT: Nothing *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/17/99 1:04AM ST : Created *
- *=============================================================================================*/
-bool CDControlClass::Unlock_CD_Drive_95 (char drive)
-{
-// DebugString ("CDControlClass::Unlock_CD_Drive_95\n");
- Msg( __LINE__, TEXT(__FILE__), TEXT("CDControlClass::Unlock_CD_Drive_95 returning %s." ));
-
- bool retval = true;
- assert (WinVersion.Is_Win9x());
- HANDLE vwin32 = INVALID_HANDLE_VALUE;
-
-// DebugString ("Allowing ejection on CD drive %c\n", drive + 'A');
- Msg( __LINE__, TEXT(__FILE__), TEXT("Allowing ejection on CD drive %c."), drive + 'A' - 1 );
-
- drive++;
- vwin32 = Open_VWin32();
- assert (vwin32 != INVALID_HANDLE_VALUE);
-
- /*
- ** Make sure no other applications are using the drive.
- */
-// DebugString ("About to lock logical volume to enable exclusive access\n");
- Msg( __LINE__, TEXT(__FILE__), TEXT("About to lock logical volume to enable exclusive access." ));
-
- bool drive_locked = Lock_Logical_Volume (vwin32, drive, 0, 0);
-// assert (drive_locked);
- if (!drive_locked) {
-// DebugString("Unable to lock volume %c:\n", 'A' + drive - 1);
- Msg( __LINE__, TEXT(__FILE__), TEXT("Unable to lock volume %c:."), 'A' + drive - 1 );
- return(false);
- }
-// DebugString ("Volume locked OK\n");
- Msg( __LINE__, TEXT(__FILE__), TEXT("Volume locked OK." ));
-
- /*
- ** Unlock the tray to allow ejection.
- */
-// DebugString ("About to allow CD tray ejection\n");
- Msg( __LINE__, TEXT(__FILE__), TEXT("About to allow CD tray ejection." ));
-
- if (!Unlock_Volume_95 (vwin32, drive)) {
-// DebugString("Could not unlock CD tray in drive %c:\n", 'A' + drive - 1);
- Msg( __LINE__, TEXT(__FILE__), TEXT("Could not unlock CD tray in drive %c:"), 'A' + drive - 1 );
- retval = false;
- }else{
-// DebugString ("CD tray ejection enabled OK\n");
- Msg( __LINE__, TEXT(__FILE__), TEXT("CD tray ejection enabled OK." ));
- }
-
- Unlock_Logical_Volume (vwin32, drive);
- Close_VWin32 (vwin32);
-
-// DebugString ("CDControlClass::Unlock_CD_Drive_95 returning %s\n", retval ? "true" : "false");
- Msg( __LINE__, TEXT(__FILE__), TEXT("CDControlClass::Unlock_CD_Drive_95 returning %s."), retval ? "true" : "false" );
- return (retval);
-}
-
-/***********************************************************************************************
- * CDControlClass::Unlock_Volume_95 -- Unlocks removable media so that it can be ejected *
- * *
- * INPUT: Handle to VWIN32 *
- * drive to unlock (DOS format) *
- * *
- * OUTPUT: true if unlocked *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/17/99 0:19AM ST : Created *
- *=============================================================================================*/
-bool CDControlClass::Unlock_Volume_95 (HANDLE vwin32, char drive)
-{
- assert (WinVersion.Is_Win9x());
- DIOC_REGISTERS regs = {0};
- PARAMBLOCK unlock_params = {0};
- bool result;
- unsigned long cb;
-
- /*
- ** First, check the lock status. This way, we'll know the number of pending locks we must unlock.
- */
- unlock_params.bOperation = 2; // return lock/unlock status
-
- regs.reg_EAX = 0x440D;
- regs.reg_EBX = drive;
- regs.reg_ECX = MAKEWORD(0x48, 0x08);
- regs.reg_EDX = (unsigned long)&unlock_params;
-
- result = (DeviceIoControl (vwin32, VWIN32_DIOC_DOS_IOCTL, ®s, sizeof(regs), ®s, sizeof(regs), &cb, 0)) ? true : false;
-
- if (result) {
-
- /*
- ** DeviceIoControl succeeded. Now see if the unlock succeeded. It
- ** succeeded if the carry flag is not set, or if the carry flag is
- ** set but EAX is 0x01 or 0xB0.
- **
- ** It failed if the carry flag is set and EAX is not 0x01 or 0xB0.
- **
- ** If the carry flag is clear, then unlock succeeded. However, you
- ** don't need to set fResult because it is already TRUE when you get
- ** in here.
- */
- if (regs.reg_Flags & CARRY_FLAG) {
- result = (regs.reg_EAX == 0xB0) || (regs.reg_EAX == 0x01);
- }
-
- } else {
-// DebugString ("DeviceIoControl failed to perform DOS IO control function. Error %d - %s\n", GetLastError(), Last_Error_Text());
-// Msg( __LINE__, __FILE__, "DeviceIoControl failed to perform DOS IO control function. Error %d - %s.", GetLastError(), Last_Error_Text() );
- Last_Error_Text( TEXT("DeviceIoControl failed to perform DOS IO control function.."), GetLastError());
- }
-
- if (!result) return (false);
-
- /*
- ** Now we have to unlock the media for every time it was locked. This gets us a lock count of
- ** 0 and totally unlocked media.
- */
- for (int i = 0; i < unlock_params.bNumLocks; ++i) {
- unlock_params.bOperation = 1; // unlock the media
- regs.reg_EAX = 0x440D;
- regs.reg_EBX = drive;
- regs.reg_ECX = MAKEWORD(0x48, 0x08); // LOCK/UNLOCK
- regs.reg_EDX = (unsigned long)&unlock_params;
-
- result = (DeviceIoControl (vwin32, VWIN32_DIOC_DOS_IOCTL, ®s, sizeof(regs), ®s, sizeof(regs), &cb, 0)) ? true : false;
- if (result == false) {
-// DebugString ("DeviceIoControl failed to perform DOS IO control function. Error %d - %s\n", GetLastError(), Last_Error_Text());
-// Msg( __LINE__, __FILE__, "DeviceIoControl failed to perform DOS IO control function. Error %d - %s.", GetLastError(), Last_Error_Text() );
- Last_Error_Text( TEXT("DeviceIoControl failed to perform DOS IO control function.."), GetLastError());
- }
-
- /*
- ** See if DeviceIoControl and the lock succeeded
- */
- result = result && !(regs.reg_Flags & CARRY_FLAG);
- if (!result) break;
- }
- return (result);
-}
-
-/***********************************************************************************************
- * CDControlClass::Lock_Volume_95 -- Locks removable media so that it can't be ejected *
- * *
- * INPUT: Handle to VWIN32 *
- * drive to lock (DOS format) *
- * *
- * OUTPUT: true if unlocked *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/17/99 0:19AM ST : Created *
- *=============================================================================================*/
-bool CDControlClass::Lock_Volume_95 (HANDLE vwin32, char drive)
-{
- assert (WinVersion.Is_Win9x());
- DIOC_REGISTERS regs = {0};
- PARAMBLOCK unlock_params = {0};
- bool result;
- unsigned long cb;
-
- /*
- ** Bring the lock count down to 0.
- */
- Unlock_Volume_95(vwin32, drive);
-
- /*
- ** Increment the lock count.
- */
- unlock_params.bOperation = 0; // lock the media
- regs.reg_EAX = 0x440D;
- regs.reg_EBX = drive;
- regs.reg_ECX = MAKEWORD(0x48, 0x08); // LOCK/UNLOCK
- regs.reg_EDX = (unsigned long)&unlock_params;
-
- result = (DeviceIoControl (vwin32, VWIN32_DIOC_DOS_IOCTL, ®s, sizeof(regs), ®s, sizeof(regs), &cb, 0)) ? true : false;
- if (result == false) {
-// DebugString ("DeviceIoControl failed to perform DOS IO control function. Error %d - %s\n", GetLastError(), Last_Error_Text());
-// Msg( __LINE__, __FILE__, "DeviceIoControl failed to perform DOS IO control function. Error %d - %s.", GetLastError(), Last_Error_Text() );
- Last_Error_Text( TEXT("DeviceIoControl failed to perform DOS IO control function."), GetLastError());
- }
-
- /*
- ** See if DeviceIoControl and the lock succeeded
- */
- result = result && !(regs.reg_Flags & CARRY_FLAG);
- return (result);
-}
-
-/***********************************************************************************************
- * CDControlClass::Auto_Eject_Volume_95 -- Eject the specified CD drive *
- * *
- * INPUT: Handle to VWIN32 *
- * Drive number (DOS format) *
- * *
- * OUTPUT: True if ejected *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/17/99 0:24AM ST : Created *
- *=============================================================================================*/
-bool CDControlClass::Auto_Eject_Volume_95 (HANDLE vwin32, char drive)
-{
- assert (WinVersion.Is_Win9x());
- DIOC_REGISTERS regs = {0};
- bool result;
- unsigned long cb;
-
- regs.reg_EAX = 0x440D;
- regs.reg_EBX = drive;
- regs.reg_ECX = MAKEWORD(0x49, 0x08); //EJECT
-
- result = (DeviceIoControl (vwin32, VWIN32_DIOC_DOS_IOCTL, ®s, sizeof(regs), ®s, sizeof(regs), &cb, 0)) ? true : false;
- if (result == false) {
-// DebugString ("DeviceIoControl failed to perform DOS IO control function. Error %d - %s\n", GetLastError(), Last_Error_Text());
-// Msg( __LINE__, __FILE__, "DeviceIoControl failed to perform DOS IO control function. Error %d - %s.", GetLastError(), Last_Error_Text() );
- Last_Error_Text( TEXT("DeviceIoControl failed to perform DOS IO control function."), GetLastError());
- }
-
- /*
- ** See if we ejected OK
- */
- result = result && !(regs.reg_Flags & CARRY_FLAG);
-
- return (result);
-}
-
-/***********************************************************************************************
- * CDControlClass::Open_VWin32 -- Opens a handle to VWIN32 to issue low-level disk I/O *
- * *
- * INPUT: Nothing *
- * *
- * OUTPUT: HANDLE to VWin32 *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/17/99 0:26AM ST : Created *
- *=============================================================================================*/
-HANDLE WINAPI CDControlClass::Open_VWin32 (void)
-{
- assert (WinVersion.Is_Win9x());
- HANDLE result = CreateFile ( TEXT("\\\\.\\vwin32"), 0, 0, NULL, 0, FILE_FLAG_DELETE_ON_CLOSE, NULL);
- assert (result != INVALID_HANDLE_VALUE);
- return (result);
-}
-
-/***********************************************************************************************
- * CDControlClass::Close_VWin32 -- Closes the handle opened by Open_VWin32. *
- * *
- * INPUT: Handle to VWin32 *
- * *
- * OUTPUT: Nothing *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/17/99 0:26AM ST : Created *
- *=============================================================================================*/
-bool WINAPI CDControlClass::Close_VWin32 (HANDLE vwin32)
-{
- assert (WinVersion.Is_Win9x());
- return ((CloseHandle (vwin32)) ? true : false);
-}
-
-/***********************************************************************************************
- * CDControlClass::Lock_Logical_Volume -- Take a lock on a logical volume *
- * *
- * INPUT: Handle to VWin32 *
- * drive number (DOS format) *
- * lock level *
- * permissions *
- * *
- * OUTPUT: true if locked *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 2/17/99 0:33AM ST : Created *
- *=============================================================================================*/
-bool WINAPI CDControlClass::Lock_Logical_Volume (HANDLE vwin32, char drive, char lock_level, short permissions)
-{
- assert (WinVersion.Is_Win9x());
- bool result;
- DIOC_REGISTERS regs = {0};
- char device_cat; // can be either 0x48 or 0x08
- unsigned long cb;
-
- /*
- ** lock_level
- ** Can be 0, 1, 2, or 3. Level 0 is an exclusive lock that can only
- ** be taken when there are no open files on the specified drive.
- ** Levels 1 through 3 form a hierarchy where 1 must be taken before
- ** 2, which must be taken before 3.
- **
- ** permissions
- ** Specifies how the lock will affect file operations when lock levels
- ** 1 through 3 are taken. Also specifies whether a formatting lock
- ** should be taken after a level 0 lock.
- */
-
- /*
- ** Try first with device category 0x48 for FAT32 volumes. If it
- ** doesn't work, try again with device category 0x08. If that
- ** doesn't work, then the lock failed.
- */
- device_cat = 0;
-
- do {
- if (device_cat == 0) {
- device_cat = 0x48;
- }else{
- device_cat = 0x08;
- }
-
- /*
- ** Set up the parameters for the call.
- */
- regs.reg_EAX = 0x440D;
- regs.reg_EBX = MAKEWORD(drive, lock_level);
- regs.reg_ECX = MAKEWORD(0x4A, device_cat);
- regs.reg_EDX = permissions;
-
- result = (DeviceIoControl (vwin32, VWIN32_DIOC_DOS_IOCTL, ®s, sizeof(regs), ®s, sizeof(regs), &cb, 0)) ? true : false;
- if (result == false) {
-// DebugString ("DeviceIoControl failed to perform DOS IO control function. Error %d - %s\n", GetLastError(), Last_Error_Text());
-// Msg( __LINE__, __FILE__, "DeviceIoControl failed to perform DOS IO control function. Error %d - %s.", GetLastError(), Last_Error_Text() );
- Last_Error_Text( TEXT("DeviceIoControl failed to perform DOS IO control function."), GetLastError());
- }
- result = result && !(regs.reg_Flags & CARRY_FLAG);
-
- } while (result == false && device_cat != 0x08);
-
- return (result);
-}
-
-/***********************************************************************************************
- * CDControlClass::Unlock_Logical_Volume -- Unlocks a logical volume *
- * *
- * INPUT: Handle to VWin32 *
- * drive number (DOS format) *
- * *
- * OUTPUT: true if unlocked *
- * *
- * WARNINGS: None *
- * *
- * Must be called the same number of times as LockLogicalVolume() to *
- * completely unlock a volume. *
- * *
- * Only the lock owner can unlock a volume. *
- * *
- * HISTORY: *
- * 2/17/99 0:39AM ST : Created *
- *=============================================================================================*/
-bool WINAPI CDControlClass::Unlock_Logical_Volume (HANDLE vwin32, char drive)
-{
- assert (WinVersion.Is_Win9x());
- bool result;
- DIOC_REGISTERS regs = {0};
- char device_cat; // can be either 0x48 or 0x08
- unsigned long cb;
-
- /*
- ** Try first with device category 0x48 for FAT32 volumes. If it
- ** doesn't work, try again with device category 0x08. If that
- ** doesn't work, then the unlock failed.
- */
- device_cat = 0;
-
- do {
- if (device_cat == 0) {
- device_cat = 0x48;
- }else{
- device_cat = 0x08;
- }
-
- /*
- ** Set up the parameters for the call.
- */
- regs.reg_EAX = 0x440D;
- regs.reg_EBX = drive;
- regs.reg_ECX = MAKEWORD(0x6A, device_cat);
-
- result = (DeviceIoControl (vwin32, VWIN32_DIOC_DOS_IOCTL, ®s, sizeof(regs), ®s, sizeof(regs), &cb, 0)) ? true : false;
- if (result == false) {
-// DebugString ("DeviceIoControl failed to perform DOS IO control function. Error %d - %s\n", GetLastError(), Last_Error_Text());
-// Msg( __LINE__, __FILE__, "DeviceIoControl failed to perform DOS IO control function. Error %d - %s.", GetLastError(), Last_Error_Text());
- Last_Error_Text( TEXT("DeviceIoControl failed to perform DOS IO control function."), GetLastError());
- }
- result = result && !(regs.reg_Flags & CARRY_FLAG);
-
- } while (result == false && device_cat != 0x08);
-
- return (result);
-}
-
-/************************************************************************************************
- * Last_Error_Text -- Display error messages based on FormatMessage() and GetLastError(). *
- * *
- * INPUT: LPSTR - title. *
- * HRESULT - last error message. *
- * *
- * OUTPUT: None *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 6/24/99 4:44PM MML : Created *
- *==============================================================================================*/
-
-void Last_Error_Text ( LPCTSTR szPrefix, HRESULT hr )
-{
- LPVOID szMessage;
- char szDisplay[1000];
-
- if ( hr == S_OK ) {
- _stprintf( szDisplay, TEXT("%s"), szPrefix );
-// MessageBox( NULL, szDisplay, TEXT("Msg"),0 );
- return;
- }
-
- if ( HRESULT_FACILITY( hr ) == FACILITY_WIN32 ) {
- hr = HRESULT_CODE( hr );
- }
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- hr,
- MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ),
- (LPTSTR)&szMessage,
- 0,
- NULL );
-
- _stprintf( szDisplay, TEXT( "%s: %s(%lx)" ), szPrefix, szMessage, hr );
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("GetLastError: %s"), szDisplay );
-// MessageBox( NULL, szDisplay, TEXT( "GetLastError" ), MB_OK );
-
- LocalFree( szMessage );
-
-}
-
-
-
-
diff --git a/Generals/Code/Tools/Autorun/CDCNTRL.H b/Generals/Code/Tools/Autorun/CDCNTRL.H
deleted file mode 100644
index 5b5b530a441..00000000000
--- a/Generals/Code/Tools/Autorun/CDCNTRL.H
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Command & Conquer *
- * *
- * $Archive:: /Renegade Setup/Autorun/CDCNTRL.H $*
- * *
- * $Author:: Maria_l $*
- * *
- * $Modtime:: 4/20/01 2:07p $*
- * *
- * $Revision:: 3 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#pragma once
-
-
-#ifndef _CDCNTRL
-#define _CDCNTRL
-
-
-//#include "always.h"
-//#include
-#define STRICT
-#include
-#include
-#include
-
-
-
-class CDControlClass {
-
- public:
- CDControlClass(void);
- ~CDControlClass(void);
-
- /*
- ** Force the CD tray to open on the specified drive.
- */
- void Force_CD_Eject(int drive);
-
- /*
- ** Prevent the user from ejecting the CD in the specified drive.
- */
- bool Lock_CD_Tray(int drive);
-
- /*
- ** Allow the user to eject the CD in the specified drive.
- */
- bool Unlock_CD_Tray(int drive);
-
-
- private:
- /*
- ** NT functions.
- */
- bool Eject_CD(char drive);
- HANDLE Open_Removable_Volume(char drive);
- bool Lock_Volume(HANDLE volume);
- bool Unlock_Volume(HANDLE volume);
- bool Dismount_Volume(HANDLE volume);
- bool Prevent_Removal_Of_Volume(HANDLE volume, bool prevent);
- bool Auto_Eject_Volume(HANDLE volume);
- bool Close_Removable_Volume(HANDLE volume);
- bool Lock_CD_Drive(char drive);
- bool Unlock_CD_Drive(char drive);
-
- /*
- ** Win9x functions.
- */
- HANDLE WINAPI Open_VWin32 (void);
- bool WINAPI Close_VWin32 (HANDLE vwin32);
- bool WINAPI Unlock_Logical_Volume (HANDLE vwin32, char drive);
- bool WINAPI Lock_Logical_Volume (HANDLE vwin32, char drive, char lock_level, short permissions);
- bool Lock_Volume_95 (HANDLE vwin32, char drive);
- bool Unlock_Volume_95 (HANDLE vwin32, char drive);
- bool Auto_Eject_Volume_95 (HANDLE vwin32, char drive);
- void Eject_CD_Win95 (char drive);
- bool Lock_CD_Drive_95(char drive);
- bool Unlock_CD_Drive_95(char drive);
-
-};
-
-extern CDControlClass CDControl;
-
-
-#define LOCK_TIMEOUT 2000 // 2 Seconds
-#define LOCK_RETRIES 2 // 2 times
-
-/*
-** Low level structures for Win9x.
-**
-** DeviceIoControl infrastructure
-*/
-#if !defined (VWIN32_DIOC_DOS_IOCTL)
-#define VWIN32_DIOC_DOS_IOCTL 1
-
-typedef struct _DIOC_REGISTERS {
- DWORD reg_EBX;
- DWORD reg_EDX;
- DWORD reg_ECX;
- DWORD reg_EAX;
- DWORD reg_EDI;
- DWORD reg_ESI;
- DWORD reg_Flags;
-} DIOC_REGISTERS, *PDIOC_REGISTERS;
-
-#endif
-
-/*
-** Intel x86 processor status flags
-*/
-#define CARRY_FLAG 0x0001
-
-/*
-** DOS IOCTL function support
-*/
-
-#pragma pack(1)
-
-/*
-** Parameters for locking/unlocking removable media
-*/
-typedef struct _PARAMBLOCK {
- BYTE bOperation;
- BYTE bNumLocks;
-} PARAMBLOCK, *PPARAMBLOCK;
-
-#pragma pack()
-
-
-
-#endif //_CDCNTRL
-
diff --git a/Generals/Code/Tools/Autorun/CMakeLists.txt b/Generals/Code/Tools/Autorun/CMakeLists.txt
index 37ed3900d22..c75ab9f1473 100644
--- a/Generals/Code/Tools/Autorun/CMakeLists.txt
+++ b/Generals/Code/Tools/Autorun/CMakeLists.txt
@@ -1,67 +1,10 @@
-set(AUTORUN_SRC
- "ARGS.CPP"
- "ARGS.H"
- "autorun.cpp"
- "autorun.h"
- "CallbackHook.h"
- "CDCNTRL.CPP"
- "CDCNTRL.H"
- "DrawButton.cpp"
- "DrawButton.h"
- "EZGIMEX.cpp"
- "GameText.cpp"
- "GameText.h"
- "GETCD.CPP"
- "GetCD.h"
- "gimex.h"
- "IGR.cpp"
- "IGR.h"
- "Jsupport.cpp"
- "JSUPPORT.H"
- "leanAndMeanAutorun.h"
- "Locale_API.cpp"
- "Locale_API.h"
- "locale.cpp"
- "locale.h"
- "POINT.h"
- "RECT.h"
- "resource.h"
- "TTFont.cpp"
- "TTFont.h"
- "Utils.cpp"
- "Utils.h"
- "ViewHTML.cpp"
- "ViewHTML.h"
- "WinFix.CPP"
- "WinFix.H"
- "Wnd_file.cpp"
- "Wnd_File.h"
- "WSYS_File.cpp"
- "WSYS_file.h"
- "WSYS_FileSystem.cpp"
- "WSYS_FileSystem.h"
- "WSYS_RAMFile.cpp"
- "WSYS_RAMFile.h"
- "WSYS_StdFile.cpp"
- "WSYS_StdFile.h"
- "WSYS_StdFileSystem.cpp"
- "WSYS_StdFileSystem.h"
-)
-
macro(setup_autorun appname)
add_executable(${appname} WIN32)
- target_sources(${appname} PRIVATE ${AUTORUN_SRC})
-
target_link_libraries(${appname} PRIVATE
- core_config
+ corei_autorun
gi_always
- winmm
)
-
- if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")
- target_sources(${appname} PRIVATE AUTORUN.RC)
- endif()
endmacro()
setup_autorun(g_autorun_en)
diff --git a/Generals/Code/Tools/Autorun/CallbackHook.h b/Generals/Code/Tools/Autorun/CallbackHook.h
deleted file mode 100644
index a97272ed657..00000000000
--- a/Generals/Code/Tools/Autorun/CallbackHook.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/******************************************************************************
-*
-* FILE
-* $Archive: /Renegade Setup/Autorun/CallbackHook.h $
-*
-* DESCRIPTION
-*
-* PROGRAMMER
-* Steven Clinard
-* $Author: Maria_l $
-*
-* VERSION INFO
-* $Modtime: 8/14/00 7:52p $
-* $Revision: 2 $
-*
-******************************************************************************/
-
-#ifndef CALLBACKHOOK_H
-#define CALLBACKHOOK_H
-
-class CallbackHook
- {
- public:
- CallbackHook()
- {}
-
- virtual ~CallbackHook()
- {}
-
- virtual bool DoCallback(void) const
- {return false;}
-
- protected:
- CallbackHook(const CallbackHook&);
- const CallbackHook& operator=(const CallbackHook&);
- };
-
-
-template class Callback : public CallbackHook
- {
- public:
- Callback(bool (*callback)(T), T userdata)
- : mCallback(callback),
- mUserData(userdata)
- {
- }
-
- virtual ~Callback()
- {
- }
-
- virtual bool DoCallback(void) const
- {
- if (mCallback != NULL)
- {
- return mCallback(mUserData);
- }
-
- return false;
- }
-
- private:
- bool (*mCallback)(T);
- T mUserData;
- };
-
-#endif // CALLBACKHOOK_H
diff --git a/Generals/Code/Tools/Autorun/DrawButton.cpp b/Generals/Code/Tools/Autorun/DrawButton.cpp
deleted file mode 100644
index abac0db17ed..00000000000
--- a/Generals/Code/Tools/Autorun/DrawButton.cpp
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/******************************************************************************
- ** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ******************************************************************************
- * *
- * Project Name : Autorun *
- * *
- * File Name : AUTORUN.CPP *
- * *
- * Programmers: Maria del Mar McCready Legg *
- * *
- * Start Date : September 5, 1997 *
- * *
- * Last Update : October 2, 2000 [MML] *
- * *
- *----------------------------------------------------------------------------*
- * Functions: *
- * DrawButton::DrawButton *
- * DrawButton::Is_Mouse_In_Region *
- * DrawButton::Return_Bitmap *
- * DrawButton::Return_Area *
- * DrawButton::Set_Stretched_Width *
- * DrawButton::Set_Stretched_Height *
- *----------------------------------------------------------------------------*/
-
-
-#define STRICT
-#include
-#include
-#include "autorun.h"
-#include "DrawButton.h"
-#include "Locale_API.h"
-#include "Wnd_File.h"
-
-
-
-#include "leanAndMeanAutorun.h"
-
-#ifndef LEAN_AND_MEAN
-///////GAMEENGINE HEADERS////////////
-#include "Common/UnicodeString.h"
-#include "Common/SubsystemInterface.h"
-#include "GameClient/GameText.h"
-#endif
-
-
-//*****************************************************************************
-// DrawButton::DrawButton -- Constructor for custom "Button" type.
-//
-// This custom button is drawn by the dialog, and uses the WM_MOUSEMOVE,
-// WM_LBUTTONUP, and WM_LBUTTONDOWN to trigger actions.
-//
-// INPUT: int id -- button id handle
-// int x -- x position
-// int y -- y position
-// int w -- width of button
-// int h -- height of button
-// char *normal -- name of normal button bitmap
-// char *pressed -- name of pressed button bitmap
-// char *focus -- name of focus button bitmap
-//
-// OUTPUT: none.
-//
-// WARNINGS: No keyboard/mouse/paint handling built in. Do manually.
-//
-// HISTORY:
-// 07/15/1996 MML : Created.
-//=============================================================================
-
-DrawButton::DrawButton ( int id, RECT button_rect, const char *normal, const char *focus, const char *pressed, const char * string, TTFontClass *fontptr )
-{
- Id = id;
-
- //--------------------------------------------------------------------------
- // Set default rectangle settings.
- //--------------------------------------------------------------------------
- rect.left = button_rect.left;
- rect.top = button_rect.top;
- rect.right = button_rect.left + button_rect.right;
- rect.bottom = button_rect.top + button_rect.bottom;
-
- MyRect.X = button_rect.left;
- MyRect.Y = button_rect.top;
- MyRect.Width = rect.right - rect.left;
- MyRect.Height = rect.bottom - rect.top;
-
- TextRect.X = button_rect.left;
- TextRect.Y = button_rect.top;
- TextRect.Width = rect.right - rect.left;
- TextRect.Height = rect.bottom - rect.top;
-
- StretchedWidth = rect.right - rect.left;
- StretchedHeight = rect.bottom - rect.top;
-
- //--------------------------------------------------------------------------
- // Set the string variables.
- //--------------------------------------------------------------------------
- memset( String, '\0', MAX_PATH );
-// if ( string != NULL ) {
-// wcscpy( String, Locale_GetString( string_num, String ));
-
-
-#ifdef LEAN_AND_MEAN
-#else
- UnicodeString tempString = TheGameText->fetch(string);
- wcscpy(String, tempString.str());
-#endif
-// }
-
- //--------------------------------------------------------------------------
- // Set the font pointer.
- //--------------------------------------------------------------------------
- MyFontPtr = NULL;
-
- if ( fontptr != NULL ) {
- MyFontPtr = fontptr;
- }
-
- //--------------------------------------------------------------------------
- // Set Button Backgrounds.
- //--------------------------------------------------------------------------
- _tcscpy( NormalBitmap, normal );
- _tcscpy( PressedBitmap, pressed );
- _tcscpy( FocusBitmap, focus );
-
- if( NormalBitmap[0] != '\0' ) {
- UseBitmaps = true; // determines how to draw button.
- }
-
- //--------------------------------------------------------------------------
- // Start in normal mode.
- //--------------------------------------------------------------------------
- ButtonState = NORMAL_STATE;
-
- Msg( __LINE__, TEXT(__FILE__), TEXT(" rect = [%d,%d,%d,%d]"), rect.left, rect.top, rect.right, rect.bottom );
- Msg( __LINE__, TEXT(__FILE__), TEXT(" MyRect = [%d,%d,%d,%d]"), MyRect.X, MyRect.Y, MyRect.Width, MyRect.Height );
-}
-
-DrawButton::DrawButton ( int id, RECT button_rect, const char *normal, const char *focus, const char *pressed, const wchar_t *string, TTFontClass *fontptr )
-{
- Id = id;
-
- //--------------------------------------------------------------------------
- // Set default rectangle settings.
- //--------------------------------------------------------------------------
- rect.left = button_rect.left;
- rect.top = button_rect.top;
- rect.right = button_rect.left + button_rect.right;
- rect.bottom = button_rect.top + button_rect.bottom;
-
- MyRect.X = button_rect.left;
- MyRect.Y = button_rect.top;
- MyRect.Width = rect.right - rect.left;
- MyRect.Height = rect.bottom - rect.top;
-
- TextRect.X = button_rect.left;
- TextRect.Y = button_rect.top;
- TextRect.Width = rect.right - rect.left;
- TextRect.Height = rect.bottom - rect.top;
-
- StretchedWidth = rect.right - rect.left;
- StretchedHeight = rect.bottom - rect.top;
-
- //--------------------------------------------------------------------------
- // Set the string variables.
- //--------------------------------------------------------------------------
- memset( String, '\0', MAX_PATH );
- if ( string != NULL ) {
- wcscpy( String, string );
- }
-
- //--------------------------------------------------------------------------
- // Set the font pointer.
- //--------------------------------------------------------------------------
- MyFontPtr = NULL;
-
- if ( fontptr != NULL ) {
- MyFontPtr = fontptr;
- }
-
- //--------------------------------------------------------------------------
- // Set Button Backgrounds.
- //--------------------------------------------------------------------------
- _tcscpy( NormalBitmap, normal );
- _tcscpy( PressedBitmap, pressed );
- _tcscpy( FocusBitmap, focus );
-
- if( NormalBitmap[0] != '\0' ) {
- UseBitmaps = true; // determines how to draw button.
- }
-
- //--------------------------------------------------------------------------
- // Start in normal mode.
- //--------------------------------------------------------------------------
- ButtonState = NORMAL_STATE;
-
- Msg( __LINE__, TEXT(__FILE__), TEXT(" rect = [%d,%d,%d,%d]"), rect.left, rect.top, rect.right, rect.bottom );
- Msg( __LINE__, TEXT(__FILE__), TEXT(" MyRect = [%d,%d,%d,%d]"), MyRect.X, MyRect.Y, MyRect.Width, MyRect.Height );
-}
-
-//*****************************************************************************
-// DrawButton::Draw_Text -- Check if mouse values are in button area.
-//
-// INPUT: HDC hDC -- DC to paint to.
-//
-// OUTPUT: none.
-//
-// WARNINGS:
-//
-// HISTORY:
-// 01/18/2002 MML : Created.
-//=============================================================================
-
-void DrawButton::Draw_Text ( HDC hDC )
-{
- RECT outline_rect;
- Rect rect;
-
- if( hDC == NULL ) {
- return;
- }
-
- Return_Area( &outline_rect );
- Return_Text_Area( &rect );
-
- /*
- ** This function was combining the pixel color with the background,
- ** so it never looked correct.
- */
-// SetTextColor( hDC, RGB( 0, 240, 0 ));
-// DrawFocusRect( hDC, &dst_rect );
-
- if ( Get_State() == DrawButton::PRESSED_STATE ) {
- MyFontPtr->Print(
- hDC,
- String,
- rect,
- TEXT_PRESSED_COLOR,
- TEXT_PRESSED_SHADOW_COLOR,
- TPF_BUTTON,
- TPF_SHADOW );
-
- } else if ( Get_State() == DrawButton::FOCUS_STATE ) {
- MyFontPtr->Print(
- hDC,
- String,
- rect,
- TEXT_FOCUSED_COLOR,
- TEXT_FOCUSED_SHADOW_COLOR,
- TPF_BUTTON,
- TPF_SHADOW );
-
- } else {
- MyFontPtr->Print(
- hDC,
- String,
- rect,
- TEXT_NORMAL_COLOR,
- TEXT_NORMAL_SHADOW_COLOR,
- TPF_BUTTON,
- TPF_SHADOW );
- }
-}
-
-
-//*****************************************************************************
-// DrawButton::Is_Mouse_In_Region -- Check if mouse values are in button area.
-//
-// INPUT: int mouse_x -- mouse x position
-// int mouse_y -- mouse y position
-//
-// OUTPUT: bool -- true of false.
-//
-// WARNINGS: No keyboard/mouse/paint handling built in. Do manually.
-// Note: width is shortened below to accomodate actual bitmap area.
-//
-// HISTORY:
-// 07/15/1996 MML : Created.
-//=============================================================================
-
-bool DrawButton::Is_Mouse_In_Region ( int mouse_x, int mouse_y )
-{
- if ( mouse_x < 0 || mouse_y < 0 ) {
- return( false );
- }
-
- if (( mouse_x >= rect.left ) &&
- ( mouse_y >= rect.top ) &&
- ( mouse_x <= rect.left + StretchedWidth ) &&
- ( mouse_y <= rect.top + StretchedHeight )) {
- return ( TRUE );
- }
- return ( FALSE );
-}
-
-//*****************************************************************************
-// DrawButton::Return_Bitmap
-//
-// Return name of correct bitmap based on state of button.
-//
-// INPUT: none.
-//
-// OUTPUT: char *bitmap -- name of bitmap file.
-//
-// WARNINGS: No keyboard/mouse/paint handling built in. Do manually.
-//
-// HISTORY:
-// 07/15/1996 MML : Created.
-//=============================================================================
-
-char *DrawButton::Return_Bitmap ( void )
-{
- if ( ButtonState == PRESSED_STATE ) {
- return ( PressedBitmap );
- } else if ( ButtonState == FOCUS_STATE ) {
- return ( FocusBitmap );
- } else {
- return ( NormalBitmap );
- }
-}
-
-//*****************************************************************************
-// DrawButton::Return_Area -- Return x, y and width and height of button.
-//
-// INPUT: RECT area -- holds the x,y,width,height information.
-//
-// OUTPUT: none.
-//
-// WARNINGS: No keyboard/mouse/paint handling built in. Do manually.
-//
-// HISTORY:
-// 07/15/1996 MML : Created.
-//=============================================================================
-
-void DrawButton::Return_Area ( RECT *area )
-{
- area->left = rect.left;
- area->top = rect.top;
- area->right = rect.left + StretchedWidth;
- area->bottom = rect.top + StretchedHeight;
-}
-
-void DrawButton::Return_Area ( Rect *area )
-{
- area->X = MyRect.X;
- area->Y = MyRect.Y;
- area->Width = MyRect.Width;
- area->Height = MyRect.Height;
-}
-
-void DrawButton::Return_Text_Area ( Rect *area )
-{
- area->X = TextRect.X;
- area->Y = TextRect.Y;
- area->Width = TextRect.Width;
- area->Height = TextRect.Height;
-}
-
-
-//*****************************************************************************
-// DrawButton::Set_Stretched_Width -- Set draw width of button.
-//
-// INPUT: int value -- destination width size.
-//
-//OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY: 08/12/1996 MML : Created.
-//=============================================================================
-
-int DrawButton::Set_Stretched_Width ( int value )
-{
- int nWidth = StretchedWidth;
-
- StretchedWidth = value;
- return ( nWidth );
-}
-
-//*****************************************************************************
-// DrawButton::Set_Stretched_Height -- Set draw height of button.
-//
-// INPUT: int value -- destination height size.
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY: 08/12/1996 MML : Created.
-//=============================================================================
-
-int DrawButton::Set_Stretched_Height ( int value )
-{
- int nHeight = StretchedHeight;
-
- StretchedHeight = value;
- return( nHeight );
-}
-
-
diff --git a/Generals/Code/Tools/Autorun/DrawButton.h b/Generals/Code/Tools/Autorun/DrawButton.h
deleted file mode 100644
index 520ce3fdeff..00000000000
--- a/Generals/Code/Tools/Autorun/DrawButton.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/************************************************************************
- ** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
- ************************************************************************
- * *
- * Project Name : DrawButton *
- * *
- * File Name : DRAWBUTTON.H *
- * *
- * Programmer : Maria del Mar McCready Legg *
- * *
- * Start Date : May 10, 1994 *
- * *
- * Last Update : October 5, 2000 [MML] *
- *----------------------------------------------------------------------*/
-
-#ifndef DRAWBUTTONS_H
-#define DRAWBUTTONS_H
-
-#include
-#include
-#include "TTFont.h"
-
-
-//-------------------------------------------------------------------------
-// Custom "Button" Class
-//-------------------------------------------------------------------------
-class DrawButton
-{
- public:
-
- enum BUTTON_STATE {
- NORMAL_STATE = 0,
- PRESSED_STATE,
- FOCUS_STATE
- };
-
- DrawButton ( int id, RECT button_rect, const char *normal, const char *focus, const char *pressed, const char *string, TTFontClass *fontptr );
- DrawButton ( int id, RECT button_rect, const char *normal, const char *focus, const char *pressed, const wchar_t *string, TTFontClass *fontptr );
-
- char *Return_Normal_Bitmap ( void ) { return NormalBitmap; };
- char *Return_Pressed_Bitmap ( void ) { return PressedBitmap; };
- char *Return_Focus_Bitmap ( void ) { return FocusBitmap; };
- char *Return_Bitmap ( void );
-
- bool Draw_Bitmaps ( void ) { return( UseBitmaps ); };
-
- void Draw_Text ( HDC hDC );
-
- BUTTON_STATE Get_State ( void ) { return ButtonState; };
- bool Is_Mouse_In_Region ( int mouse_x, int mouse_y );
- int Return_Id ( void ) { return Id; };
- int Return_X_Pos ( void ) { return rect.left; };
- int Return_Y_Pos ( void ) { return rect.top; };
- int Return_Width ( void ) { return( rect.right - rect.left ); };
- int Return_Height ( void ) { return( rect.bottom - rect.top ); };
- int Return_Stretched_Width ( void ) { return( StretchedWidth ); };
- int Return_Stretched_Height ( void ) { return( StretchedHeight ); };
- void Return_Area ( RECT *area );
- void Return_Area ( Rect *area );
- void Return_Text_Area ( Rect *area );
- TTFontClass *Return_Font_Ptr ( void ) { return( MyFontPtr ); };
- wchar_t *Return_Text ( void ) { return( String ); };
- void Set_State ( BUTTON_STATE state ) { ButtonState = state; };
- int Set_Stretched_Width ( int );
- int Set_Stretched_Height ( int );
-
- protected:
-
- int Id;
- Rect MyRect;
- Rect TextRect;
- RECT rect;
- BUTTON_STATE ButtonState;
- int StretchedWidth;
- int StretchedHeight;
- bool UseBitmaps;
- TTFontClass *MyFontPtr;
-
- wchar_t String[ MAX_PATH ];
- char NormalBitmap [ _MAX_FNAME ];
- char PressedBitmap[ _MAX_FNAME ];
- char FocusBitmap [ _MAX_FNAME ];
-};
-
-
-
-
-
-
-#endif
diff --git a/Generals/Code/Tools/Autorun/EZGIMEX.cpp b/Generals/Code/Tools/Autorun/EZGIMEX.cpp
deleted file mode 100644
index 47ca1223104..00000000000
--- a/Generals/Code/Tools/Autorun/EZGIMEX.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* Copyright (C) Electronic Arts Canada Inc. 1994-1998. All rights reserved. */
-
-/*------------------------------------------------------------------*/
-/* */
-/* ANSI Standard File and Memory Interface v1.04 */
-/* */
-/* by FrANK G. Barchard, EAC */
-/* */
-/* Code Module - May 24, 1995 */
-/* */
-/*------------------------------------------------------------------*/
-/* */
-/* Module Notes: */
-/* ------------- */
-/* This modules makes an easy basis for new Gimex low level */
-/* functions. You will need to make the following changes: */
-/* */
-/* function what to change */
-/* -------- -------------- */
-/* galloc/free put in your memory manager */
-/* LIBHANDLE.handle handle for your file system */
-/* gopen/gwopen fopen, fseek, ftell (find file size) */
-/* gclose fclose */
-/* gread fread and possibly memcpy */
-/* gwrite fwrite */
-/* gseek fseek */
-/* */
-/* The other routines should not need changing. */
-/* */
-/*------------------------------------------------------------------*/
-
-/* And increase stream buffer */
-/*
- setvbuf(f, NULL, _IOFBF, FILE_BUFFER_SIZE);
-*/
-
-#define __NOINLINE__ 1
-#include
-#include
-#include
-#include "gimex.h"
-#include "Wnd_File.h"
-
-/* Memory Functions */
-
-int galloccount=0;
-
-void * GCALL galloc(long size)
-{
- ++galloccount;
- return(malloc((size_t)size));
-}
-
-int GCALL gfree(void *memptr)
-{
- --galloccount;
- free(memptr);
- return(1);
-}
-
-/* get motorola memory */
-
-unsigned long ggetm(void *src, int bytes)
-{
- unsigned char *s = (unsigned char *) src;
- unsigned long value;
-
- value = 0L;
- while (bytes--)
- {
- value = (value<<8) + ((*s++));
- }
- return(value);
-}
-
-/* get intel memory */
-
-unsigned long ggeti(void *src, int bytes)
-{
- unsigned char *s = (unsigned char *) src;
- int i = 0;
- unsigned long value;
-
- value = 0L;
- while (bytes--)
- {
- value += ((*s++)) << (i);
- i += 8;
- }
- return(value);
-}
-
-/* put motorolla memory */
-
-void gputm(void *dst, unsigned long data, int bytes)
-{
- unsigned char *d = (unsigned char *) dst;
- unsigned long pval;
-
- data <<= (4-bytes)*8;
- while (bytes)
- {
- pval = data >> 24;
- *d++ = (unsigned char) pval;
- data <<= 8;
- --bytes;
- }
-}
-
-/* put intel memory */
-
-void gputi(void *dst, unsigned long data, int bytes)
-{
- unsigned char *d = (unsigned char *) dst;
- unsigned long pval;
-
- while (bytes)
- {
- pval = data;
- *d++ = (unsigned char) pval;
- data >>= 8;
- --bytes;
- }
-}
-
-/* File Functions */
-
-GSTREAM * GCALL gopen(const char *filename)
-{
- FILE *handle;
-
- Msg( __LINE__, __FILE__, "gopen:: %s.", filename );
-
- handle = fopen( filename, "r+b" );
-
- Msg( __LINE__, __FILE__, "gopen:: handle = %d", (( handle != NULL )? 1 : 0 ));
-
- if ( !handle ) {
-
- handle = fopen( filename, "rb" );
-
- Msg( __LINE__, __FILE__, "gopen:: handle = %d", (( handle != NULL )? 1 : 0 ));
- }
- return((GSTREAM *) handle);
-}
-
-GSTREAM * GCALL gwopen(const char *filename)
-{
- FILE *handle;
-
- handle = fopen(filename,"w+b");
- if (!handle)
- handle = fopen(filename,"wb");
-
- return((GSTREAM *) handle);
-}
-
-int GCALL gclose(GSTREAM *g)
-{
- int ok=1;
- if (g)
- ok = !fclose((FILE*) g);
- return(ok);
-}
-
-int GCALL gread(GSTREAM *g, void *buf, long size)
-{
- return(fread(buf, (size_t) 1, (size_t) size, (FILE *) g));
-}
-
-int GCALL gwrite(GSTREAM *g, void *buf, long size)
-{
- return(fwrite(buf, (size_t)1, (size_t)size, (FILE *) g));
-}
-
-int GCALL gseek(GSTREAM *g, long offset)
-{
- return(!fseek((FILE *) g, offset, SEEK_SET));
-}
-
-long GCALL glen(GSTREAM *g)
-{
- long len;
- long oldpos = gtell(g);
- fseek((FILE *)g, 0, SEEK_END);
- len = gtell(g);
- fseek((FILE *)g, oldpos, SEEK_SET);
- return(len);
-}
-
-long GCALL gtell(GSTREAM *g)
-{
- return(ftell((FILE *) g));
-}
-
diff --git a/Generals/Code/Tools/Autorun/GETCD.CPP b/Generals/Code/Tools/Autorun/GETCD.CPP
deleted file mode 100644
index dbc3c41daa5..00000000000
--- a/Generals/Code/Tools/Autorun/GETCD.CPP
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/****************************************************************************
- ***** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S *****
- ****************************************************************************
- * Project Name:: Command & Conquer *
- * $Archive:: /Renegade Setup/Autorun/GETCD.CPP $Author:: Steve_t *
- * $Modtime:: 1/28/02 10:54a $Revision:: 20 *
- *--------------------------------------------------------------------------*
- * Functions: *
- * GetCDClass::GetCDClass -- default constructor *
- * GetCDClass::~GetCDClass -- destructor *
- * GetCDClass::GetCDDrive -- returns the logical CD drive *
- * CD_Volume_Verification -- Check label of the CDRom. *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-
-#include
-#include
-//#include "always.h"
-#include "GetCD.h"
-//#include "timer.h"
-#include "Wnd_File.h"
-//#include "missiondisk.h"
-#include "WinFix.H"
-
-#ifndef ROR_NOT_READY
-#define ROR_NOT_READY 21
-#endif
-
-/**********************************************************************
-** This macro serves as a general way to determine the number of elements
-** within an array.
-*/
-#define ARRAY_SIZE(x) int(sizeof(x)/sizeof(x[0]))
-#define size_of(typ,id) sizeof(((typ*)0)->id)
-
-//-----------------------------------------------------------------------------
-// Global Variables
-//-----------------------------------------------------------------------------
-#if ( MISSION_DISK )
-
-static const char * _CD_Volume_Label[] = {
- "Renegade Mission", // Yuri's Revenge (mission disk)
-};
-
-#else
-
-static const char * _CD_Volume_Label[] = {
- "Renegade Game", // Red Alert 2
- "Renegade Data", // Red Alert 2
-};
-
-#endif
-
-
-static int _Num_Volumes = ARRAY_SIZE( _CD_Volume_Label );
-
-GetCDClass CDList;
-
-
-/****************************************************************************
- * GetCDClass -- default constructor *
- * *
- * INPUT: *
- * none *
- * OUTPUT: *
- * none *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 05/26/1994 SW : Created. *
- * 12/04/1995 ST : fixed for Win95 *
- *==========================================================================*/
-GetCDClass::GetCDClass( void )
-{
- char path[]={ "a:\\" };
-
- CDCount = 0;
- CDIndex = 0;
-
- Msg( __LINE__, __FILE__, "GetCDClass constructor\n" );
-
- /*--------------------------------------------------------------------------
- ** Set all CD drive placeholders to empty
- */
- for( int j = 0; j < MAX_CD_DRIVES; j++ ) {
- CDDrives[j] = NO_CD_DRIVE;
- }
-
- for( char i = 'c'; i <= 'z'; i++ ) {
-
- path[0] = i;
-
- if ( GetDriveType( path ) == DRIVE_CDROM ) {
- CDDrives[ CDCount++ ] = (int)( i-'a' );
- Msg( __LINE__, __FILE__, "CD drive found - %c:\n", i +'A'-'a' );
- }
- }
-
- /*--------------------------------------------------------------------------
- ** Catch the case when there are NO CD-ROM drives available
- */
- if ( CDCount == 0 ) {
- for ( char i = 'a'; i <= 'b'; i++ ) {
- path[0] = i;
- if ( GetDriveType( path ) == DRIVE_CDROM ) {
- CDDrives[ CDCount++ ] = (int)( i-'a' );
- }
- }
- }
- if ( CDCount == 0 ) {
- Msg( __LINE__, __FILE__, "No CD drives found\n");
- }
-}
-
-/********************************************************************************
- * GetCDClass -- destructor *
- * *
- * INPUT: none *
- * *
- * OUTPUT: none *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 05/26/1994 SW: Created. *
- * 12/4/95 ST: fixed for Win95 *
- *==============================================================================*/
-GetCDClass::~GetCDClass(void)
-{
-// if(cdDrive_addrp.seg)
-// DPMI_real_free(cdDrive_addrp); // free up those conventional buffers
-}
-
-/********************************************************************************
- * GetCDClass -- Get_CD_Drive_For_This_Volume *
- * *
- * INPUT: char *volume_name *
- * *
- * OUTPUT: int *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/18/2000 MML: Created. *
- *==============================================================================*/
-
-int GetCDClass::Get_CD_Drive_For_This_Volume ( const char *volume_label )
-{
- char volume_name[128] = "";
- int count = 0;
- char buffer[128];
- unsigned misc_dword;
- unsigned filename_length;
- int cd_drive;
-
- CDIndex = 0;
-
- while( CDIndex < CDCount ) {
-
- //---------------------------------------------------------------------
- // NOTE: A=0, B=1, C=2, D=3, etc...
- //---------------------------------------------------------------------
- cd_drive = CDDrives[ CDIndex++ ];
- wsprintf( buffer, "%c:\\", 'A' + cd_drive );
-
- if ( GetVolumeInformation(
- (char const *)buffer,
- &volume_name[0],
- (unsigned long)sizeof(volume_name)-1,
- (unsigned long *)NULL,
- (unsigned long *)&filename_length,
- (unsigned long *)&misc_dword,
- (char *)NULL,
- (unsigned long)0 )) {
-
- //---------------------------------------------------------------------
- // Windows '95 appears to have a volume name limit of 11 characters.
- // I cannot find a Win32 call that will return the maximum volume name
- // length so the value '11' is hard-coded here and the assumption made
- // that all OS's have this length or better.
- //---------------------------------------------------------------------
- if( WinVersion.Is_Win95()) {
- volume_name[11] = '\0';
- }
-
- if ( !_stricmp( volume_label, volume_name )) {
- return( cd_drive );
- }
-
- } else {
-
-#if _DEBUG
- LPVOID lpMsgBuf;
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR) &lpMsgBuf,
- 0,
- NULL
- );
- Msg( __LINE__, __FILE__, (LPTSTR)lpMsgBuf );
- LocalFree( lpMsgBuf );
-#endif
-
- }
- }
- return( Get_First_CD_Drive());
-}
-
-/********************************************************************************
- * GetCDClass -- Get_Volume_Label *
- * *
- * INPUT: int index *
- * *
- * OUTPUT: char * *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/31/2000 MML: Created. * Happy Halloween! * *
- *==============================================================================*/
-
-const char * GetCDClass::Get_Volume_Label ( int index )
-{
- if( index >= 0 && index < _Num_Volumes ) {
- return( _CD_Volume_Label[ index ]);
- }
- return( _CD_Volume_Label[0]);
-}
-
-/********************************************************************************
- * GetCDClass -- Get_Volume_For_This_CD_Drive *
- * *
- * INPUT: char *volume_name *
- * char *path *
- * *
- * OUTPUT: int *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/31/2000 MML: Created. * Happy Halloween! * *
- *==============================================================================*/
-
-const char *GetCDClass::Get_Volume_For_This_CD_Drive ( const char *path, char *volume_name )
-{
- char buffer[128];
- unsigned misc_dword;
- unsigned filename_length;
- static char volume_label[ MAX_PATH ] = ""; // [OYO] add static
-
- if ( path == NULL || volume_name == NULL ) {
- return( NULL );
- }
-
- memset( volume_name, '\0', sizeof( volume_name ));
- wsprintf( buffer, "%c:\\", path[0] );
-
- if ( GetVolumeInformation(
- (char const *)buffer,
- &volume_label[0],
- (unsigned long)sizeof(volume_label)-1,
- (unsigned long *)NULL,
- (unsigned long *)&filename_length,
- (unsigned long *)&misc_dword,
- (char *)NULL,
- (unsigned long)0 )) {
-
- strcpy( volume_name, volume_label );
-
- } else {
-
- LPVOID lpMsgBuf;
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR) &lpMsgBuf,
- 0,
- NULL
- );
- Msg( __LINE__, __FILE__, (LPTSTR)lpMsgBuf );
- LocalFree( lpMsgBuf );
-
- strcpy( volume_name, _CD_Volume_Label[0] );
- }
-
- //-------------------------------------------------------------------------
- // Windows '95 appears to have a volume name limit of 11 characters.
- // I cannot find a Win32 call that will return the maximum volume name
- // length so the value '11' is hard-coded here and the assumption made
- // that all OS's have this length or better.
- //-------------------------------------------------------------------------
- bool winversion = WinVersion.Is_Win95();
-
- if( winversion ) {
- volume_name[11] = '\0';
- }
-
- return( volume_name );
-}
-
-/********************************************************************************
- * CD_VOLUME_VERIFICATION -- Check volume label of the CD in the given drive. *
- * *
- * INPUT: int drive_number *
- * char *lable *
- * *
- * OUTPUT: TRUE/FALSE *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 01/11/99 4:20PM MML : Created *
- *==============================================================================*/
-
-bool CD_Volume_Verification ( int cd_drive, char *volume_label, char *volume_to_find )
-{
- char volume_name[128] = "";
- int count = 0;
- char buffer[128];
- unsigned misc_dword;
- unsigned filename_length;
-
- /***************************************************************************
- ** Get the volume label. If we get a 'not ready' error then retry for the
- ** timeout period.
- */
- for (;;) {
-
- //---------------------------------------------------------------------
- // NOTE: A=0, B=1, C=2, D=3, etc...
- //---------------------------------------------------------------------
- wsprintf( buffer, "%c:\\", 'A' + cd_drive );
-
- if ( GetVolumeInformation(
- (char const *)buffer,
- &volume_name[0],
- (unsigned long)sizeof(volume_name)-1,
- (unsigned long *)NULL,
- (unsigned long *)&filename_length,
- (unsigned long *)&misc_dword,
- (char *)NULL,
- (unsigned long)0 )) {
-
- /******************************************************************
- ** Match the volume label to the list of known volume labels.
- */
-
- //---------------------------------------------------------------------
- // Windows '95 appears to have a volume name limit of 11 characters.
- // I cannot find a Win32 call that will return the maximum volume name
- // length so the value '11' is hard-coded here and the assumption made
- // that all OS's have this length or better.
- //---------------------------------------------------------------------
- if( WinVersion.Is_Win95()) {
- volume_name[11] = '\0';
- }
-
- if ( volume_label != NULL ) {
- strncpy( volume_label, volume_name, 128 );
- }
-
- if ( !_stricmp( volume_to_find, volume_name )) {
- return TRUE;
- }
-
- if ( !count ) {
- count++;
- } else {
- return FALSE;
- }
-
- } else {
-
- /*********************************************************************
- ** Failed to get the volume label on a known CD drive. If this is a
- ** CD changer it may require time to swap the disks so don't return
- ** immediately if the error is ROR_NOT_READY
- */
- return FALSE;
- }
- }
-}
-
-
-
-
-/* ==================================================================== */
-
diff --git a/Generals/Code/Tools/Autorun/GameText.cpp b/Generals/Code/Tools/Autorun/GameText.cpp
deleted file mode 100644
index 2b163b7c32b..00000000000
--- a/Generals/Code/Tools/Autorun/GameText.cpp
+++ /dev/null
@@ -1,1152 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//----------------------------------------------------------------------------
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright(C) 2001 - All Rights Reserved
-//
-//----------------------------------------------------------------------------
-//
-// Project: RTS3
-//
-// File name: GameText.cpp
-//
-// Created: 11/07/01
-//
-//----------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------------
-
-#include
-#include
-#include
-#include
-
-#include
-
-#include
-#include "GameText.h"
-
-#define DEBUG_LOG(x) {}
-#define DEBUG_ASSERTCRASH(x, y) {}
-
-//#include
-//#include
-//#include
-//#include
-//#include
-#include "WSYS_file.h"
-#include "WSYS_RAMFile.h"
-
-
-
-//----------------------------------------------------------------------------
-// Externals
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Defines
-//----------------------------------------------------------------------------
-
-#define CSF_ID ( ('C'<<24) | ('S'<<16) | ('F'<<8) | (' ') )
-#define CSF_LABEL ( ('L'<<24) | ('B'<<16) | ('L'<<8) | (' ') )
-#define CSF_STRING ( ('S'<<24) | ('T'<<16) | ('R'<<8) | (' ') )
-#define CSF_STRINGWITHWAVE ( ('S'<<24) | ('T'<<16) | ('R'<<8) | ('W') )
-#define CSF_VERSION 3
-
-#define STRING_FILE 0
-#define CSF_FILE 1
-#define MAX_UITEXT_LENGTH (10*1024)
-//----------------------------------------------------------------------------
-// Private Types
-//----------------------------------------------------------------------------
-
-//===============================
-// StringInfo
-//===============================
-
-struct StringInfo
-{
- std::string label;
- std::wstring text;
- std::string speech;
-};
-
-struct StringLookUp
-{
- std::string *label;
- StringInfo *info;
-};
-
-//===============================
-// CSFHeader
-//===============================
-
-struct CSFHeader
-{
- Int id;
- Int version;
- Int num_labels;
- Int num_strings;
- Int skip;
- Int langid;
-
-};
-
-//===============================
-// struct NoString
-//===============================
-
-struct NoString
-{
- struct NoString *next;
- std::wstring text;
-};
-
-
-//===============================
-// GameTextManager
-//===============================
-
-class GameTextManager : public GameTextInterface
-{
- public:
-
- GameTextManager();
- virtual ~GameTextManager();
-
- virtual void init( void ); ///< Initlaizes the text system
- virtual void deinit( void ); ///< De-initlaizes the text system
- virtual void update( void ) {}; ///< update text manager
- virtual void reset( void ); ///< Resets the text system
-
- virtual const wchar_t * fetch( const Char *label ); ///< Returns the associated labeled unicode text
- protected:
-
- Int m_textCount;
- Int m_maxLabelLen;
- Char m_buffer[MAX_UITEXT_LENGTH];
- Char m_buffer2[MAX_UITEXT_LENGTH];
- Char m_buffer3[MAX_UITEXT_LENGTH];
- WideChar m_tbuffer[MAX_UITEXT_LENGTH*2];
-
- StringInfo *m_stringInfo;
- StringLookUp *m_stringLUT;
- Bool m_initialized;
- Bool m_jabberWockie;
- Bool m_munkee;
- NoString *m_noStringList;
- Int m_useStringFile;
- std::wstring m_failed;
-
- void stripSpaces ( WideChar *string );
- void removeLeadingAndTrailing ( Char *m_buffer );
- void readToEndOfQuote( File *file, Char *in, Char *out, Char *wavefile, Int maxBufLen );
- void reverseWord ( Char *file, Char *lp );
- void translateCopy( WideChar *outbuf, Char *inbuf );
- Bool getStringCount( Char *filename);
- Bool getCSFInfo ( Char *filename );
- Bool parseCSF( Char *filename );
- Bool parseStringFile( char *filename );
- Bool readLine( char *buffer, Int max, File *file );
- Char readChar( File *file );
-};
-
-static int _cdecl compareLUT ( const void *, const void*);
-//----------------------------------------------------------------------------
-// Private Data
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Public Data
-//----------------------------------------------------------------------------
-
-GameTextInterface *TheGameText = NULL;
-
-//----------------------------------------------------------------------------
-// Private Prototypes
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Functions
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Public Functions
-//----------------------------------------------------------------------------
-
-//============================================================================
-// CreateGameTextInterface
-//============================================================================
-
-GameTextInterface* CreateGameTextInterface( void )
-{
- return new GameTextManager;
-}
-
-
-//============================================================================
-// GameTextManager::GameTextManager
-//============================================================================
-
-GameTextManager::GameTextManager()
-: m_textCount(0),
- m_maxLabelLen(0),
- m_stringInfo(NULL),
- m_stringLUT(NULL),
- m_initialized(FALSE),
- m_jabberWockie(FALSE),
- m_munkee(FALSE),
- m_noStringList(NULL),
- m_useStringFile(TRUE),
- m_failed(L"***FATAL*** String Manager failed to initilaized properly")
-{
-}
-
-//============================================================================
-// GameTextManager::~GameTextManager
-//============================================================================
-
-GameTextManager::~GameTextManager()
-{
- deinit();
-}
-
-//============================================================================
-// GameTextManager::init
-//============================================================================
-
-extern char szArgvPath[];
-
-void GameTextManager::init( void )
-{
- const Char *strFile = "autorun.str";
- const Char *csfFile = "autorun.csf";
- Int format;
-
- Char realStrFile[_MAX_PATH];
- Char realCsfFile[_MAX_PATH];
-
- strncpy(realStrFile, szArgvPath, _MAX_PATH);
- strncpy(realCsfFile, szArgvPath, _MAX_PATH);
-
- strncat(realStrFile, strFile, _MAX_PATH - strlen(realStrFile));
- strncat(realCsfFile, csfFile, _MAX_PATH - strlen(realCsfFile));
-
- if ( m_initialized )
- {
- return;
- }
-
- m_initialized = TRUE;
-
- m_maxLabelLen = 0;
- m_jabberWockie = FALSE;
- m_munkee = FALSE;
-
- if ( m_useStringFile && getStringCount( realStrFile) )
- {
- format = STRING_FILE;
- }
- else if ( getCSFInfo ( realCsfFile ) )
- {
- format = CSF_FILE;
- }
- else
- {
- return;
- }
-
- if( (m_textCount == 0) )
- {
- return;
- }
-
- //Allocate StringInfo Array
-
- m_stringInfo = new StringInfo[m_textCount];
-
- if( m_stringInfo == NULL )
- {
- deinit();
- return;
- }
-
- if ( format == STRING_FILE )
- {
- if( parseStringFile( realStrFile ) == FALSE )
- {
- deinit();
- return;
- }
- }
- else
- {
- if ( !parseCSF ( realCsfFile ) )
- {
- deinit();
- return;
- }
- }
-
- m_stringLUT = new StringLookUp[m_textCount];
-
- StringLookUp *lut = m_stringLUT;
- StringInfo *info = m_stringInfo;
-
- for ( Int i = 0; i < m_textCount; i++ )
- {
- lut->info = info;
- lut->label = &info->label;
- lut++;
- info++;
- }
-
- qsort( m_stringLUT, m_textCount, sizeof(StringLookUp), compareLUT );
-
-}
-
-//============================================================================
-// GameTextManager::deinit
-//============================================================================
-
-void GameTextManager::deinit( void )
-{
-
- if( m_stringInfo != NULL )
- {
- delete [] m_stringInfo;
- m_stringInfo = NULL;
- }
-
- if( m_stringLUT != NULL )
- {
- delete [] m_stringLUT;
- m_stringLUT = NULL;
- }
-
- m_textCount = 0;
-
- NoString *noString = m_noStringList;
-
- DEBUG_LOG(("\n*** Missing strings ***\n"));
- while ( noString )
- {
- DEBUG_LOG(("*** %ls ***\n", noString->text.str()));
- NoString *next = noString->next;
- delete noString;
- noString = next;
- }
- DEBUG_LOG(("*** End missing strings ***\n\n"));
-
- m_noStringList = NULL;
-
- m_initialized = FALSE;
-}
-
-//============================================================================
-// GameTextManager::reset
-//============================================================================
-
-void GameTextManager::reset( void )
-{
-}
-
-
-//============================================================================
-// GameTextManager::stripSpaces
-//============================================================================
-
-void GameTextManager::stripSpaces ( WideChar *string )
-{
- WideChar *str, *ptr;
- WideChar ch, last = 0;
- Int skipall = TRUE;
-
- str = ptr = string;
-
- while ( (ch = *ptr++) != 0 )
- {
- if ( ch == ' ' )
- {
- if ( last == ' ' || skipall )
- {
- continue;
- }
- }
-
- if ( ch == '\n' || ch == '\t' )
- {
- // remove last space
- if ( last == ' ' )
- {
- str--;
- }
-
- skipall = TRUE; // skip all spaces
- last = *str++ = ch;
- continue;
- }
-
- last = *str++ = ch;
- skipall = FALSE;
- }
-
- if ( last == ' ' )
- {
- str--;
- }
-
- *str = 0;
-}
-
-//============================================================================
-// GameTextManager::removeLeadingAndTrailing
-//============================================================================
-
-void GameTextManager::removeLeadingAndTrailing ( Char *buffer )
-{
- Char *first, *ptr;
- Char ch;
-
- ptr = first = buffer;
-
- while ( (ch = *first) != 0 && iswspace ( ch ))
- {
- first++;
- }
-
- while ( (*ptr++ = *first++) != 0 );
-
- ptr -= 2;;
-
- while ( (ptr > buffer) && (ch = *ptr) != 0 && iswspace ( ch ) )
- {
- ptr--;
- }
-
- ptr++;
- *ptr = 0;
-}
-
-//============================================================================
-// GameTextManager::readToEndOfQuote
-//============================================================================
-
-void GameTextManager::readToEndOfQuote( File *file, Char *in, Char *out, Char *wavefile, Int maxBufLen )
-{
- Int slash = FALSE;
- Int state = 0;
- Int line_start = FALSE;
- Char ch;
- Int ccount = 0;
- Int len = 0;
- Int done = FALSE;
-
- while ( maxBufLen )
- {
- // get next Char
-
- if ( in )
- {
- if ( (ch = *in++) == 0 )
- {
- in = NULL; // have exhausted the input m_buffer
- ch = readChar ( file );
- }
- }
- else
- {
- ch = readChar ( file );
- }
-
- if ( ch == EOF )
- {
- return ;
- }
-
- if ( ch == '\n' )
- {
- line_start = TRUE;
- slash = FALSE;
- ccount = 0;
- ch = ' ';
- }
- else if ( ch == '\\' && !slash)
- {
- slash = TRUE;
- }
- else if ( ch == '\\' && slash)
- {
- slash = FALSE;
- }
- else if ( ch == '"' && !slash )
- {
- break; // done
- }
- else
- {
- slash = FALSE;
- }
-
- if ( iswspace ( ch ))
- {
- ch = ' ';
- }
-
- *out++ = ch;
- maxBufLen--;
- }
-
- *out = 0;
-
- while ( !done )
- {
- // get next Char
-
- if ( in )
- {
- if ( (ch = *in++) == 0 )
- {
- in = NULL; // have exhausted the input m_buffer
- ch = readChar ( file );
- }
- }
- else
- {
- ch = readChar ( file );
- }
-
- if ( ch == '\n' || ch == EOF )
- {
- break;
- }
-
- switch ( state )
- {
-
- case 0:
- if ( iswspace ( ch ) || ch == '=' )
- {
- break;
- }
-
- state = 1;
- case 1:
- if ( ( ch >= 'a' && ch <= 'z') || ( ch >= 'A' && ch <='Z') || (ch >= '0' && ch <= '9') || ch == '_' )
- {
- *wavefile++ = ch;
- len++;
- break;
- }
- state = 2;
- case 2:
- break;
- }
- }
-
- *wavefile = 0;
-
- if ( len )
- {
- if ( ( ch = *(wavefile-1)) >= '0' && ch <= '9' )
- {
- *wavefile++ = 'e';
- *wavefile = 0;
- }
- }
-
-}
-
-
-//============================================================================
-// GameTextManager::reverseWord
-//============================================================================
-
-void GameTextManager::reverseWord ( Char *file, Char *lp )
-{
- Int first = TRUE;
- Char f, l;
- Int ok = TRUE ;
-
- while ( ok )
- {
- if ( file >= lp )
- {
- return;
- }
-
- f = *file;
- l = *lp;
-
- if ( first )
- {
- if ( f >= 'A' && f <= 'Z' )
- {
- if ( l >= 'a' && l <= 'z' )
- {
- f = (f - 'A') + 'a';
- l = (l - 'a') + 'A';
- }
- }
-
- first = FALSE;
- }
-
- *lp-- = f;
- *file++ = l;
-
- }
-
-}
-
-//============================================================================
-// GameTextManager::translateCopy
-//============================================================================
-
-void GameTextManager::translateCopy( WideChar *outbuf, Char *inbuf )
-{
- Bool slash = FALSE;
-
- if ( m_jabberWockie )
- {
- static Char buffer[MAX_UITEXT_LENGTH*2];
- Char *firstLetter = NULL, *lastLetter;
- Char *b = buffer;
- Int formatWord = FALSE;
- Char ch;
-
- while ( (ch = *inbuf++) != 0 )
- {
- if ( ! (( ch >= 'a' && ch <= 'z') || ( ch >= 'A' && ch <= 'Z' )))
- {
- if ( firstLetter )
- {
- if ( !formatWord )
- {
- lastLetter = b-1;
- reverseWord ( firstLetter, lastLetter );
- }
- firstLetter = NULL;
- formatWord = FALSE;
- }
- *b++ = ch;
- if ( ch == '\\' )
- {
- *b++ = *inbuf++;
- }
- if ( ch == '%' )
- {
- while ( (ch = *inbuf++) != 0 && !( (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')))
- {
- *b++ = ch;
- }
- *b++ = ch;
- }
- }
- else
- {
- if ( !firstLetter )
- {
- firstLetter = b;
- }
-
- *b++ = ch;
-
- }
- }
-
- if ( firstLetter )
- {
- lastLetter = b-1;
- reverseWord ( firstLetter, lastLetter );
- }
-
- *b++ = 0;
- inbuf = buffer;
- }
- else if( m_munkee )
- {
- wcscpy(outbuf, L"Munkee");
- return;
- }
-
- while( *inbuf != '\0' )
- {
- if( slash == TRUE )
- {
- slash = FALSE;
-
- switch( *inbuf )
- {
- // in case end of string is reached
- // should never happen!!!
- case '\0':
- return;
-
- case '\\':
- *outbuf++ = '\\';
- break;
-
- case '\'':
- *outbuf++ = '\'';
- break;
-
- case '\"':
- *outbuf++ = '\"';
- break;
-
- case '\?':
- *outbuf++ = '\?';
- break;
-
- case 't':
- *outbuf++ = '\t';
- break;
-
- case 'n':
- *outbuf++ = '\n';
- break;
-
- default:
- *outbuf++ = *inbuf & 0x00FF;
- break;
- }
- }
- else if( *inbuf != '\\' )
- {
- *outbuf++ = *inbuf & 0x00FF;
- }
- else
- slash = TRUE;
-
- inbuf++;
- }
- *outbuf= 0;
-}
-
-//============================================================================
-// GameTextManager::getStringCount
-//============================================================================
-
-Bool GameTextManager::getStringCount( char *filename )
-{
- Int ok = TRUE;
-
- m_textCount = 0;
-
- RAMFile file;
-
- if ( !file.open( filename, File::READ | File::TEXT ))
- {
- return FALSE;
- }
-
- while(ok)
- {
- if( !readLine( m_buffer, sizeof( m_buffer) -1, &file ) )
- break;
- removeLeadingAndTrailing ( m_buffer );
-
- if( m_buffer[0] == '"' )
- {
- Int len = strlen(m_buffer);
- m_buffer[ len ] = '\n';
- m_buffer[ len+1] = 0;
- readToEndOfQuote( &file, &m_buffer[1], m_buffer2, m_buffer3, MAX_UITEXT_LENGTH );
- }
- else if( !stricmp( m_buffer, "END") )
- {
- m_textCount++;
- }
- }
-
- m_textCount += 500;
- file.close();
- return TRUE;
-}
-
-//============================================================================
-// GameTextManager::getCSFInfo
-//============================================================================
-
-Bool GameTextManager::getCSFInfo ( Char *filename )
-{
- CSFHeader header;
- Int ok = FALSE;
- RAMFile file;
-
- if ( file.open( filename, File::READ | File::BINARY ) )
- {
- if ( file.read( &header, sizeof ( header )) == sizeof ( header ) )
- {
- if ( header.id == CSF_ID )
- {
- m_textCount = header.num_labels;
-
- ok = TRUE;
- }
- }
-
- file.close();
- }
-
- return ok;
-}
-
-//============================================================================
-// GameTextManager::parseCSF
-//============================================================================
-
-Bool GameTextManager::parseCSF( Char *filename )
-{
- RAMFile file;
- Int id;
- Int len;
- Int listCount = 0;
- Bool ok = FALSE;
- CSFHeader header;
-
- if ( !file.open( filename, File::READ | File::BINARY ) )
- {
- return FALSE;
- }
-
- if ( file.read ( &header, sizeof ( CSFHeader)) != sizeof ( CSFHeader) )
- {
- return FALSE;
- }
-
- while( file.read ( &id, sizeof (id)) == sizeof ( id) )
- {
- Int num;
- Int num_strings;
-
- if ( id != CSF_LABEL )
- {
- goto quit;
- }
-
- file.read ( &num_strings, sizeof ( Int ));
-
- file.read ( &len, sizeof ( Int ) );
-
- if ( len )
- {
- file.read ( m_buffer, len );
- }
-
- m_buffer[len] = 0;
-
- m_stringInfo[listCount].label = m_buffer;
-
-
- if ( len > m_maxLabelLen )
- {
- m_maxLabelLen = len;
- }
-
- num = 0;
-
- while ( num < num_strings )
- {
- file.read ( &id, sizeof ( Int ) );
-
- if ( id != CSF_STRING && id != CSF_STRINGWITHWAVE )
- {
- goto quit;
- }
-
- file.read ( &len, sizeof ( Int ) );
-
- if ( len )
- {
- file.read ( m_tbuffer, len*sizeof(WideChar) );
- }
-
- if ( num == 0 )
- {
- // only use the first string found
- m_tbuffer[len] = 0;
-
- {
- WideChar *ptr;
-
- ptr = m_tbuffer;
-
- while ( *ptr )
- {
- *ptr = ~*ptr;
- ptr++;
- }
- }
-
- stripSpaces ( m_tbuffer );
- m_stringInfo[listCount].text = m_tbuffer;
- }
-
- if ( id == CSF_STRINGWITHWAVE )
- {
- file.read ( &len, sizeof ( Int ) );
- if ( len )
- {
- file.read ( m_buffer, len );
- }
- m_buffer[len] = 0;
-
- if ( num == 0 && len )
- {
- // only use the first string found
- m_stringInfo[listCount].speech = m_buffer;
- }
-
- }
-
- num++;
- }
-
- listCount++;
- }
-
- ok = TRUE;
-
-quit:
-
- file.close();
-
- return ok;
-}
-
-
-//============================================================================
-// GameTextManager::parseStringFile
-//============================================================================
-
-Bool GameTextManager::parseStringFile( char *filename )
-{
- Int listCount = 0;
- Int ok = TRUE;
-
- RAMFile file;
-
- if ( !file.open( filename, File::READ | File::TEXT ) )
- {
- return FALSE;
- }
-
- while( ok )
- {
- Int len;
- if( !readLine( m_buffer, MAX_UITEXT_LENGTH, &file ))
- {
- break;
- }
-
- removeLeadingAndTrailing ( m_buffer );
-
- if( ( *(unsigned short *)m_buffer == 0x2F2F) || !m_buffer[0]) // 0x2F2F is Hex for //
- continue;
-
- // make sure label is unique
-
- for ( Int i = 0; i < listCount; i++ )
- {
- if ( !stricmp ( m_stringInfo[i].label.c_str(), m_buffer ))
- {
- DEBUG_ASSERTCRASH ( FALSE, ("String label '%s' multiply defined!", m_buffer ));
- }
- }
-
- m_stringInfo[listCount].label = m_buffer;
- len = strlen ( m_buffer );
-
-
- if ( len > m_maxLabelLen )
- {
- m_maxLabelLen = len;
- }
-
- Bool readString = FALSE;
- while( ok )
- {
- if (!readLine ( m_buffer, sizeof(m_buffer)-1, &file ))
- {
- DEBUG_ASSERTCRASH (FALSE, ("Unexpected end of string file"));
- ok = FALSE;
- goto quit;
- }
-
- removeLeadingAndTrailing ( m_buffer );
-
- if( m_buffer[0] == '"' )
- {
- len = strlen(m_buffer);
- m_buffer[ len ] = '\n';
- m_buffer[ len+1] = 0;
- readToEndOfQuote( &file, &m_buffer[1], m_buffer2, m_buffer3, MAX_UITEXT_LENGTH );
-
-
- if ( readString )
- {
- // only one string per label allows
- DEBUG_ASSERTCRASH ( FALSE, ("String label '%s' has more than one string defined!", m_stringInfo[listCount].label.str()));
- }
- else
- {
- // Copy string into new home
- translateCopy( m_tbuffer, m_buffer2 );
- stripSpaces ( m_tbuffer );
-
- m_stringInfo[listCount].text = m_tbuffer ;
- m_stringInfo[listCount].speech = m_buffer3;
- readString = TRUE;
- }
- }
- else if ( !stricmp ( m_buffer, "END" ))
- {
- break;
- }
- }
-
- listCount++;
- }
-
-quit:
-
- file.close();
-
- return ok;
-}
-
-//============================================================================
-// *GameTextManager::fetch
-//============================================================================
-
-const wchar_t * GameTextManager::fetch( const Char *label )
-{
- DEBUG_ASSERTCRASH ( m_initialized, ("String Manager has not been m_initialized") );
-
- if( m_stringInfo == NULL )
- {
- return m_failed.c_str();
- }
-
- StringLookUp *lookUp;
- StringLookUp key;
- std::string lb;
- lb = label;
- key.info = NULL;
- key.label = &lb;
-
- lookUp = (StringLookUp *) bsearch( &key, (void*) m_stringLUT, m_textCount, sizeof(StringLookUp), compareLUT );
-
- if( lookUp == NULL )
- {
- // See if we already have the missing string
- wchar_t tmp[256];
- _snwprintf(tmp, 256, L"MISSING: '%hs'", label);
- tmp[255] = 0;
- std::wstring missingString = tmp;
-
- NoString *noString = m_noStringList;
-
- while ( noString )
- {
- if (noString->text == missingString)
- return missingString.c_str();
-
- noString = noString->next;
- }
-
- //DEBUG_LOG(("*** MISSING:'%s' ***\n", label));
- // Remember file could have been altered at this point.
- noString = new NoString;
- noString->text = missingString;
- noString->next = m_noStringList;
- m_noStringList = noString;
- return noString->text.c_str();
- }
- return lookUp->info->text.c_str();
-}
-
-//============================================================================
-// GameTextManager::readLine
-//============================================================================
-
-Bool GameTextManager::readLine( char *buffer, Int max, File *file )
-{
- Int ok = FALSE;
-
- while ( max && file->read( buffer, 1 ) == 1 )
- {
- ok = TRUE;
-
- if ( *buffer == '\n' )
- {
- break;
- }
-
- buffer++;
- max--;
- }
-
- *buffer = 0;
-
- return ok;
-}
-
-//============================================================================
-// GameTextManager::readChar
-//============================================================================
-
-Char GameTextManager::readChar( File *file )
-{
- Char ch;
-
- if ( file->read( &ch, 1 ) == 1 )
- {
- return ch;
- }
-
- return 0;
-}
-
-//============================================================================
-// GameTextManager::compareLUT
-//============================================================================
-
-static int __cdecl compareLUT ( const void *i1, const void*i2)
-{
- StringLookUp *lut1 = (StringLookUp*) i1;
- StringLookUp *lut2 = (StringLookUp*) i2;
-
- return stricmp( lut1->label->c_str(), lut2->label->c_str());
-}
diff --git a/Generals/Code/Tools/Autorun/GameText.h b/Generals/Code/Tools/Autorun/GameText.h
deleted file mode 100644
index 2008936b1e5..00000000000
--- a/Generals/Code/Tools/Autorun/GameText.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//----------------------------------------------------------------------------
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright (C) 2001 - All Rights Reserved
-//
-//----------------------------------------------------------------------------
-//
-// Project: RTS 3
-//
-// File name: GameClient/GameText.h
-//
-// Created: 11/07/01
-//
-//----------------------------------------------------------------------------
-
-#pragma once
-
-#ifndef __GAMECLIENT_GAMETEXT_H_
-#define __GAMECLIENT_GAMETEXT_H_
-
-
-//----------------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------
-// Forward References
-//----------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------
-// Type Defines
-//----------------------------------------------------------------------------
-
-//===============================
-// GameTextInterface
-//===============================
-/** Game text interface object for localised text.
- */
-//===============================
-
-class GameTextInterface
-{
-
- public:
-
- virtual ~GameTextInterface() {};
-
- virtual void init( void ) = 0; ///< Initlaizes the text system
- virtual const wchar_t * fetch( const char *label ) = 0; ///< Returns the associated labeled unicode text
-
-};
-
-
-extern GameTextInterface *TheGameText;
-extern GameTextInterface* CreateGameTextInterface( void );
-
-//----------------------------------------------------------------------------
-// Inlining
-//----------------------------------------------------------------------------
-
-
-#endif // __GAMECLIENT_GAMETEXT_H_
diff --git a/Generals/Code/Tools/Autorun/GetCD.h b/Generals/Code/Tools/Autorun/GetCD.h
deleted file mode 100644
index 72c3130510a..00000000000
--- a/Generals/Code/Tools/Autorun/GetCD.h
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/************************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ****
- ************************************************************************************************
- * *
- * Project Name : Command & Conquer *
- * *
- * $Archive:: /Renegade Setup/Autorun/GetCD.h $Author:: Denzil_l *
- * $Modtime:: 1/08/02 3:38p $Revision:: 20 *
- * *
- *----------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-
-#pragma once
-
-#ifndef GETCD_H
-#define GETCD_H
-
-
-extern const char * _CD_Volume_Label[];
-extern int _Num_Volumes;
-
-
-
-#ifdef NOT_FOR_WIN95
-
-/* ==================================================================== */
-/* Defines */
-/* ==================================================================== */
-#define CHLEFT 0
-#define CHRIGHT 1
-#define CHBOTH 2
-#define AUDIO_START_MIN 1
-#define AUDIO_START_SEC 44
-
-struct SEGSEL {
- unsigned short seg ;
- unsigned short sel ;
-};
-
-extern "C" int DPMI_real_alloc ( UINT , SEGSEL * , USHORT * ) ;
-extern "C" int DPMI_real_free ( SEGSEL ) ;
-extern "C" void DPMI_real_intr ( int , union REGS * , struct SREGS * );
-extern "C" void DPMI_real_call ( void * funct , union REGS * , struct SREGS * );
-
-/* ==================================================================== */
-/* Data structures */
-/* ==================================================================== */
-
-//-----------------------------------------------------------------------------
-// Audio Track Info request block
-//-----------------------------------------------------------------------------
-#pragma pack(push, 1)
-struct TinfoType {
- UBYTE Length;
- UBYTE SubCd;
- UBYTE Command;
- UWORD Status;
- UBYTE Rsvd[8];
- UBYTE MDescr;
-
- UWORD TrnsAdOff;
- UWORD TrnsAdSeg;
-
- UWORD CntTrns;
- UWORD StSect;
-
- UWORD VolIDOff;
- UWORD VolIDSeg;
-
- UBYTE TrInfo;
- UBYTE Track;
- ULONG Start;
- UBYTE TrCtrl;
-};
-#pragma pack(pop)
-
-//-----------------------------------------------------------------------------
-// Audio Track Status Control Block
-//-----------------------------------------------------------------------------
-#pragma pack(push, 1)
-struct StatType {
- UBYTE Length;
- UBYTE SubCd;
- UBYTE Command;
- UWORD Status;
- UBYTE Rsvd[8];
- UBYTE MDescr;
-
- UWORD TrnsAdOff;
- UWORD TrnsAdSeg;
-
- UWORD CntTrns;
- UWORD StSect;
-
- UWORD VolIDOff;
- UWORD VolIDSeg;
-
- UBYTE StatInfo;
- UWORD Stat;
- ULONG Start;
- ULONG End;
-};
-#pragma pack(pop)
-
-//-----------------------------------------------------------------------------
-// Audio Track Volume control block
-//-----------------------------------------------------------------------------
-#pragma pack(push, 1)
-struct VolmType {
- UBYTE Length;
- UBYTE SubCd;
- UBYTE Command;
- UWORD Status;
- UBYTE Rsvd[8];
- UBYTE MDescr;
-
- UWORD TrnsAdOff;
- UWORD TrnsAdSeg;
-
- UWORD CntTrns;
- UWORD StSect;
-
- UWORD VolIDOff;
- UWORD VolIDSeg;
-
- UBYTE TrInfo;
- UBYTE In0;
- UBYTE Vol0;
- UBYTE In1;
- UBYTE Vol1;
- UBYTE In2;
- UBYTE Vol2;
- UBYTE In3;
- UBYTE Vol3;
-};
-#pragma pack(pop)
-
-//-----------------------------------------------------------------------------
-// Audio Track Play request block
-//-----------------------------------------------------------------------------
-#pragma pack(push, 1)
-struct PlayType {
- UBYTE Length;
- UBYTE SubCd;
- UBYTE Command;
- UWORD Status;
- UBYTE Rsvd[8];
- UBYTE AddrMd;
- ULONG Start;
- ULONG CntSect;
-};
-#pragma pack(pop)
-
-
-//-----------------------------------------------------------------------------
-// Audio Track Stop request block
-//-----------------------------------------------------------------------------
-#pragma pack(push, 1)
-struct StopType {
- UBYTE Length;
- UBYTE SubCd;
- UBYTE Command;
- UWORD Status;
- UBYTE Rsvd[8];
-};
-#pragma pack(pop)
-
-#endif //NOT_FOR_WIN95
-
-
-/****************************************************************************
- * GetCDClass -- object which will return logical CD drive *
- * *
- * HISTORY: *
- * 06/04/1994 SW : Created. *
- *==========================================================================*/
-
-#define MAX_CD_DRIVES 26
-#define NO_CD_DRIVE -1
-
-class GetCDClass
-{
- public:
- GetCDClass ( void ); // This is the default constructor
- ~GetCDClass ( void ); // This is the destructor
-
- inline int Get_First_CD_Drive ( void );
- inline int Get_Next_CD_Drive ( void );
- inline int Get_Number_Of_Drives ( void ) { return( CDCount ); };
- inline int Get_Index ( void ) { return( CDIndex ); };
- inline void Reset_Index ( void ) { CDIndex = 0; };
-
- int Get_CD_Drive_For_This_Volume ( const char *volume_name );
- const char * Get_Volume_For_This_CD_Drive ( const char *path, char *volume_name );
- const char * Get_Volume_Label ( int index );
-
- protected:
-
- int CDDrives[ MAX_CD_DRIVES ]; //Array containing CD drive letters
- int CDCount; //Number of available CD drives
- int CDIndex; //Index of current location
-};
-
-/****************************************************************************
- * GCDC::Get_First_CD_Drive -- return the number of the first CD drive *
- * *
- * INPUT: none *
- * *
- * OUTPUT: logical drive number *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 05/26/1994 SW : Created. *
- * 12/4/95 ST : fixed for Win95 *
- *==========================================================================*/
-
-inline int GetCDClass::Get_First_CD_Drive(void)
-{
- CDIndex = 0;
- return (Get_Next_CD_Drive());
-}
-
-/************************************************************************************
- * GCDC::Get_Next_CD_Drive -- return the logical drive number of the next CD drive *
- * *
- * INPUT: Nothing *
- * *
- * OUTPUT: Logical drive number of a cd drive or -1 if none *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 5/21/96 3:50PM ST : Created *
- *==================================================================================*/
-
-inline int GetCDClass::Get_Next_CD_Drive(void)
-{
- if (CDCount){
- if (CDIndex >= CDCount) {
- CDIndex = 0;
- }
- return (CDDrives[CDIndex++]);
- } else {
- return (-1);
- }
-}
-
-
-/************************************************************************************
- * RedBookClass -- adds red book functionality *
- * *
- * this class inherits from GetCDClass and adds red book play functionality *
- * *
- * *
- * HISTORY: *
- * 06/04/1994 SW : Created. *
- *==================================================================================*/
-
-#ifdef NOT_FOR_WIN95
-class RedBookClass : public GetCDClass
-{
- public:
-
- RedBookClass(void); // This is the default constructor
- ~RedBookClass(void); // This is the destructor
- ULONG RedToHS(ULONG i);
- ULONG MSFtoRed(UBYTE m, UBYTE s, UBYTE f);
- void FullCDVolume(UBYTE chan);
- void PlayTrack(UWORD track);
- void Play_CD_MSL(UWORD min_sec, UWORD len);
- void PlayMSF(UBYTE startM, UBYTE startS, UBYTE startF,
- UBYTE endM, UBYTE endS, UBYTE endF, UBYTE chan);
- UWORD CheckCDMusic(void);
- void StopCDMusic(void);
-
- private:
-
- SEGSEL Tinfo_addrp;
- SEGSEL Stat_addrp;
- SEGSEL Stop_addrp;
- SEGSEL Volm_addrp;
- SEGSEL Play_addrp;
-
- StopType Stop;
- PlayType Play;
- VolmType Volm;
- StatType Stat;
- TinfoType Tinfo;
-};
-
-#endif //NOT_FOR_WIN95
-
-/***************************** End of Playcd.h ****************************/
-
-extern GetCDClass CDList;
-
-//-----------------------------------------------------------------------------
-// Functions
-//-----------------------------------------------------------------------------
-bool CD_Volume_Verification ( int cd_drive, char *volume_label, char *volume_to_find );
-
-
-#endif // PLAYCD_H
diff --git a/Generals/Code/Tools/Autorun/IGR.cpp b/Generals/Code/Tools/Autorun/IGR.cpp
deleted file mode 100644
index 303480840cf..00000000000
--- a/Generals/Code/Tools/Autorun/IGR.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//
-// IGR.cpp - A class used to access the IGR registry settings.
-//
-// JeffB 7/5/00
-//
-
-#include
-#include
-#include
-//#include "always.h"
-#include "IGR.h"
-
-
-IGROptionsClass *OnlineOptions = NULL;
-
-
-/*********************************************************************************************
- * IGROptions::Init -- Class initializer. Reads from the registry *
- * *
- * INPUT: None *
- * *
- * OUTPUT: bool; Did we read everything OK? *
- * *
- * WARNINGS: none *
- * *
- * HISTORY: *
- * 07/05/00 JeffB: Initial coding *
- *===========================================================================================*/
-bool IGROptionsClass::Init( void )
-{
- int size;
- int returnValue;
- HKEY handle;
- char key[128];
- unsigned long type;
-
- valid = false;
-
- // Load the options from the registry
- size = sizeof( int );
-
- // Setup the key
- strcpy( key, WOLAPI_REG_KEY_BOTTOM );
-
- // Get a handle to the WOLAPI entry
- if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, key, 0, KEY_ALL_ACCESS, &handle ) == ERROR_SUCCESS ) {
-
- // If successful, get the options
- IGROptionsType ReadOptions = 0;
-
- returnValue = RegQueryValueEx(handle, WOLAPI_REG_KEY_OPTIONS, NULL,
- (unsigned long *) &type, (unsigned char *) &ReadOptions, (unsigned long *)&size);
-
- if (returnValue == ERROR_SUCCESS) {
-
- // If successful, and we got a DWORD, store options and set the valid flage
- if (type == REG_DWORD) {
- options = ReadOptions;
- valid = true;
- }
- }
-
- // Clean up
- RegCloseKey( handle );
- }
- return ( valid );
-}
-
-/***********************************************************************************************
- * IGROptions::Is_Auto_Login_Allowed -- Set the passed options in the registry *
- * *
- * INPUT: None *
- * *
- * OUTPUT: bool; Is the option set *
- * *
- * WARNINGS: none *
- * *
- * HISTORY: *
- * 07/05/00 JeffB: Initial coding *
- *=============================================================================================*/
-bool IGROptionsClass::Is_Auto_Login_Allowed( void )
-{
- return(( options & IGR_NO_AUTO_LOGIN ) == 0 );
-}
-
-/***********************************************************************************************
- * IGROptions::Is_Storing_Nicks_Allowed -- Set the passed options in the registry *
- * *
- * INPUT: None *
- * *
- * OUTPUT: bool; Is the option set *
- * *
- * WARNINGS: none *
- * *
- * HISTORY: *
- * 07/05/00 JeffB: Initial coding *
- *=============================================================================================*/
-bool IGROptionsClass::Is_Storing_Nicks_Allowed( void )
-{
- return(( options & IGR_NEVER_STORE_NICKS ) == 0 );
-}
-
-/***********************************************************************************************
- * IGROptions::Is_Running_Reg_App_Allowed -- Set the passed options in the registry *
- * *
- * INPUT: None *
- * *
- * OUTPUT: bool; Is the option set *
- * *
- * WARNINGS: none *
- * *
- * HISTORY: *
- * 07/05/00 JeffB: Initial coding *
- *=============================================================================================*/
-bool IGROptionsClass::Is_Running_Reg_App_Allowed( void )
-{
- return(( options & IGR_NEVER_RUN_REG_APP ) == 0 );
-}
-
-/*********************************************************************************************
- * IGROptions::Set_Options -- Set the passed options in the registry *
- * *
- * INPUT: Options to set *
- * *
- * OUTPUT: bool; Did we set the options successfully *
- * *
- * WARNINGS: none *
- * *
- * HISTORY: *
- * 07/05/00 JeffB: Initial coding *
- *===========================================================================================*/
-bool IGROptionsClass::Set_Options( IGROptionsType options )
-{
- bool ReturnValue = false;
- HKEY handle;
- int disp;
- char key[ 128 ];
-
- // We don't care if it's valid, we'll MAKE it valid.
- strcpy( key, WOLAPI_REG_KEY_BOTTOM );
-
- // Do they have the WOLAPI key?
- if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, key, 0, KEY_ALL_ACCESS, &handle ) != ERROR_SUCCESS ) {
-
- // If not, make the WOLAPI key
- if( RegCreateKeyEx( HKEY_LOCAL_MACHINE, key, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
- NULL, &handle, (unsigned long *)&disp ) != ERROR_SUCCESS )
- return false;
- }
-
- if( RegSetValueEx( handle, WOLAPI_REG_KEY_OPTIONS, 0, REG_DWORD, (unsigned char *)&options, sizeof(int))
- == ERROR_SUCCESS ) {
- ReturnValue = true;
- }
- RegCloseKey( handle );
-
- // Reinit the class to make sure we have these settings for later queries.
- Init();
-
- assert( valid == TRUE );
-
- return ReturnValue;
-}
diff --git a/Generals/Code/Tools/Autorun/IGR.h b/Generals/Code/Tools/Autorun/IGR.h
deleted file mode 100644
index 1665e4c07bf..00000000000
--- a/Generals/Code/Tools/Autorun/IGR.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//
-// IGR.h - A class used to access the IGR registry settings.
-//
-// JeffB 7/5/00
-//
-
-//
-// Registry Path
-//
-#define WOLAPI_REG_KEY_TOP "HKEY_LOCAL_MACHINE"
-#define WOLAPI_REG_KEY_WOLAPI "SOFTWARE\\Westwood\\WOLAPI"
-#define WOLAPI_REG_KEY_BOTTOM WOLAPI_REG_KEY_WOLAPI "\\"
-#define WOLAPI_REG_KEY_OPTIONS "Options"
-#define WOLAPI_REG_KEY WOLAPI_REG_KEY_TOP "\\" WOLAPI_REG_KEY_BOTTOM
-#define WOLAPI_KEY "WOLAPI"
-
-//
-// Option Bits for Options key
-//
-#define IGR_NO_AUTO_LOGIN 0x01
-#define IGR_NEVER_STORE_NICKS 0x02
-#define IGR_NEVER_RUN_REG_APP 0x04
-#define IGR_ALL IGR_NO_AUTO_LOGIN | IGR_NEVER_STORE_NICKS | IGR_NEVER_RUN_REG_APP
-#define IGR_NONE 0x00
-
-typedef unsigned int IGROptionsType;
-
-class IGROptionsClass
-{
- public:
- // Constructor
- IGROptionsClass( void ) : valid( false ), options( 0 ) {};
-
- // Destructor
- ~IGROptionsClass( void ) {};
-
- // Initialize. Read value(s) from registry
- bool Init( void );
-
- // Check various options
- bool Is_Auto_Login_Allowed( void );
- bool Is_Storing_Nicks_Allowed( void );
- bool Is_Running_Reg_App_Allowed( void );
-
- // Set various options
- bool Set_Options( IGROptionsType options );
-
- private:
-
- // Private options
- IGROptionsType options;
-
- // Is the data valid?
- bool valid;
-};
-
-extern IGROptionsClass *OnlineOptions;
\ No newline at end of file
diff --git a/Generals/Code/Tools/Autorun/JSUPPORT.H b/Generals/Code/Tools/Autorun/JSUPPORT.H
deleted file mode 100644
index ee14fe67b95..00000000000
--- a/Generals/Code/Tools/Autorun/JSUPPORT.H
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-// JSUPPORT.H
-// DBCS Support Header
-extern int nGetWord( char *,int );
diff --git a/Generals/Code/Tools/Autorun/Jsupport.cpp b/Generals/Code/Tools/Autorun/Jsupport.cpp
deleted file mode 100644
index 2dcfb730a01..00000000000
--- a/Generals/Code/Tools/Autorun/Jsupport.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-// JSUPPORT.CPP
-// DBCS Support Codes
-
-#include
-#include "JSUPPORT.H"
-
-// �O�u�֑�����
-// Can't set these characters on top of line
-static BOOL IsDBCSInvalidAtTop(unsigned int c)
-{
- static BYTE * dtbl = (BYTE *)"�����f�h�����A�B�X�r�t�v�x�z�l�����������������J�K�T�U�@�B�D�F�H�b�������������E�[�R�S�I���j�C�D�F�G�H�n�p";
- static BYTE * stbl = (BYTE *)"!%),.:;?]}������";
-
- if(c<0x100)
- {
- if(strchr((char *)stbl,(char)c))
- return TRUE;
- }
- else
- {
- BYTE c1,c2,*p;
- c1 = (BYTE)(c >> 8);
- c2 = (BYTE)(c & 0xff);
- p = dtbl;
- while(*p)
- {
- if((*p==c1)&&(*(p+1)==c2))
- return TRUE;
- p+=2;
- }
- }
- return FALSE;
-}
-
-// ��u�֑�����
-// Can't set these characters on end of line
-static BOOL IsDBCSInvalidAtEnd( unsigned int c )
-{
- static BYTE * dtbl = (BYTE *)"�e�g�q�s�u�w�y�k�i�m�o������";
- static BYTE * stbl = (BYTE *)"�({[";
-
- if(c<0x100)
- {
- if(strchr((char *)stbl,(char)c))
- return TRUE;
- }
- else
- {
- BYTE c1,c2,*p;
- c1 = (BYTE)(c >> 8);
- c2 = (BYTE)(c & 0xff);
- p = dtbl;
- while(*p)
- {
- if((*p==c1)&&(*(p+1)==c2))
- return TRUE;
- p+=2;
- }
- }
- return FALSE;
-}
-
-int nGetWord( char *string, int fdbcs )
-{
- BOOL bCiae0, bCiat1, bDbcs0, bDbcs1;
- BYTE *p = (BYTE *)string;
- UINT c0, c1, c;
-
- //--------------------------------------------------------------------------
- // If no string was passed in, exit.
- //--------------------------------------------------------------------------
- if( !p || !( c0 = *p++ )) {
-// if(( p == NULL ) || ( *p == '\0' )) {
- return 0;
- }
-// c0 = *p;
-
- //--------------------------------------------------------------------------
- // If we are NOT a double-byte language, then just parse first word.
- //--------------------------------------------------------------------------
- if( !fdbcs ) {
-
- int n = 0;
-
- while( *p >' ' ) {
- n++;
- p++;
- }
-
- if( *p ) {
- n++;
- }
- return n;
- }
-
- //--------------------------------------------------------------------------
- // If we are a double-byte language...
- //--------------------------------------------------------------------------
- bDbcs0 = IsDBCSLeadByte( c0 ) && *p;
-
- if( bDbcs0 ) {
- c0 = ( c0 << 8 ) | *p++;
- }
-
- bCiae0 = IsDBCSInvalidAtEnd( c0 );
-
- while( c1 = *p ) {
-
- bDbcs1 = ( IsDBCSLeadByte( c1 ) && ( c = *( p + 1 )));
- if( bDbcs1 ) {
- c1 = ( c1<<8 ) | c;
- }
-
- if(( bDbcs0 || bDbcs1 ) && !( bDbcs0 && bDbcs1 )) { // XOR
- break;
- }
-
- if( bDbcs1 ) {
-
- bCiat1 = IsDBCSInvalidAtTop( c1 );
-
- if( !( bCiae0 || bCiat1 )) {
- break;
- }
- bCiae0 = IsDBCSInvalidAtEnd( c1 );
- p+=2;
-
- } else {
-
- if( c0<=' ' ) {
- break;
- }
- p++;
- }
-
- bDbcs0 = bDbcs1;
- c0 = c1;
- }
- return( p - (BYTE *)string );
-}
diff --git a/Generals/Code/Tools/Autorun/Locale_API.cpp b/Generals/Code/Tools/Autorun/Locale_API.cpp
deleted file mode 100644
index fce4991cfb8..00000000000
--- a/Generals/Code/Tools/Autorun/Locale_API.cpp
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/*****************************************************************************
-* C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S *
-******************************************************************************
-*
-* FILE
-* $Archive: /Renegade Setup/Autorun/Locale_API.cpp $
-*
-* DESCRIPTION
-*
-* PROGRAMMER
-* $Author: Maria_l $
-*
-* VERSION INFO
-* $Modtime: 1/22/02 5:41p $
-* $Revision: 12 $
-*
-*****************************************************************************/
-
-#include "locale.h"
-#include "Locale_API.h"
-#include "Utils.h"
-#include "Wnd_File.h"
-//#include "resources.h"
-
-#include "GameText.h"
-
-#define MISSING_STRING_HINTS_MAX (20)
-
-const wchar_t *localeStringsMissing[ MISSING_STRING_HINTS_MAX ] =
-{
- { L"0 MissingInstall" },
- { L"1 MissingExplore" },
- { L"2 MissingPreviews" },
- { L"3 MissingCancel" },
- { L"4 MissingAutoRunTitle" },
- { L"5 MissingNoExplorer" },
- { L"6 MissingWinVersionText" },
- { L"7 MissingWinVersionTitle" },
- { L"8 MissingCantFind" },
- { L"9 MissingUninstall" },
- { L"10 MissingWebsite" },
- { L"11 MissingCheckForUpdates" },
- { L"12 MissingWorldBuilder" },
- { L"13 MissingPlay" },
- { L"14 MissingGameTitle" },
- { L"15 MissingFullGameTitle" },
- { L"16 MissingRegistryKey" },
- { L"17 MissingMainWindow" },
- { L"18 MissingThing" },
- { L"19 UNKNOWN MESSAGE" }
-};
-
-
-
-
-
-
-
-
-
-/****************************************************************************/
-/* DEFINES */
-/****************************************************************************/
-
-//----------------------------------------------------------------------------
-// NOTE: if USE_MULTI_FILE_FORMAT is "true", then a .lOC file must be in
-// the same directory as this file.
-//----------------------------------------------------------------------------
-#define USE_MULTI_FILE_FORMAT FALSE
-
-#define LANGUAGE_IS_DBCS(l) (((l)==IDL_JAPANESE)||((l)==IDL_KOREAN)||((l)==IDL_CHINESE)) // [OYO]
-#define CODEPAGE_IS_DBCS(C) ((C==932)||(C==949)||(C==950)) // [OYO]
-
-
-/****************************************************************************/
-/* GLOBAL VARIABLES */
-/****************************************************************************/
-char LanguageFile[ _MAX_PATH ];
-void * LocaleFile = NULL;
-int CodePage = GetACP();
-int LanguageID = 0;
-int PrimaryLanguage = LANG_NEUTRAL;
-int SubLanguage = SUBLANG_DEFAULT;
-
-
-/****************************************************************************/
-/* LOCALE API */
-/****************************************************************************/
-wchar_t * Remove_Quotes_Around_String ( wchar_t *old_string );
-
-
-//=============================================================================
-// These are wrapper functions around the LOCALE_ functions. I made these to
-// make using the single vs. multi language files more transparent to the program.
-//=============================================================================
-
-bool Locale_Use_Multi_Language_Files ( void )
-{
-#if( USE_MULTI_FILE_FORMAT )
- return true;
-#else
- return false;
-#endif
-}
-
-
-/****************************************************************************/
-/* initialization */
-/****************************************************************************/
-
-int Locale_Init ( int language, char *file )
-{
- int result = 0;
-
- TheGameText = CreateGameTextInterface();
- TheGameText->init();
-
-/*
- //-------------------------------------------------------------------------
- // Check for valid language range.
- //-------------------------------------------------------------------------
- if( language < 0 || language >= LANG_NUM ) {
- language = 0;
- }
-
- //-------------------------------------------------------------------------
- // Check for a file passed in.
- //-------------------------------------------------------------------------
- if( file == NULL || file[0] == '/0' ) {
- return 0;
- }
- strcpy( LanguageFile, file );
- LanguageID = language;
-
- Msg( __LINE__, __FILE__, "LanguageID = %d", LanguageID );
- Msg( __LINE__, __FILE__, "CodePage = %d.", CodePage );
- Msg( __LINE__, __FILE__, "LanguageFile = %s.", LanguageFile );
-
- //-------------------------------------------------------------------------
- // Initialize the lx object.
- //-------------------------------------------------------------------------
- LOCALE_init();
-
- #if( USE_MULTI_FILE_FORMAT )
-
- //---------------------------------------------------------------------
- // Set bank to use and load the appropriate table.
- //---------------------------------------------------------------------
- LOCALE_setbank(0);
- result = LOCALE_loadtable( LanguageFile, LanguageID );
-
- #else
-
- //---------------------------------------------------------------------
- // Create a file buffer that holds all the strings in the file.
- //---------------------------------------------------------------------
- long filesize;
- HRSRC hRsrc;
- HGLOBAL hGlobal;
-
- HMODULE module = GetModuleHandle( NULL );
-
- //-------------------------------------------------------------------------
- // Find the string file in this program's resources.
- //-------------------------------------------------------------------------
- switch( CodePage ) {
-
- // Japanese
- case 932:
- PrimaryLanguage = LANG_JAPANESE;
- SubLanguage = SUBLANG_DEFAULT;
- break;
-
- // Korean
- case 949:
- PrimaryLanguage = LANG_KOREAN;
- SubLanguage = SUBLANG_DEFAULT;
- break;
-
- // Chinese
- case 950:
- PrimaryLanguage = LANG_CHINESE;
- SubLanguage = SUBLANG_DEFAULT;
- break;
-
- // English, French, and German
- case 1252:
-
- switch( LanguageID ) {
-
- case LANG_GERMAN:
- PrimaryLanguage = LANG_GERMAN;
- SubLanguage = SUBLANG_GERMAN;
- break;
-
- case LANG_FRENCH:
- PrimaryLanguage = LANG_FRENCH;
- SubLanguage = SUBLANG_FRENCH;
- break;
-
- case LANG_ENGLISH:
- PrimaryLanguage = LANG_ENGLISH;
- SubLanguage = SUBLANG_ENGLISH_US;
- break;
- }
- break;
- }
-
- hRsrc = FindResourceEx( module, RT_RCDATA, "STRINGS", MAKELANGID( PrimaryLanguage, SubLanguage ));
- if ( hRsrc == NULL ) {
- hRsrc = FindResourceEx( module, RT_RCDATA, "STRINGS", MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ));
- }
- if ( hRsrc ) {
-
- //---------------------------------------------------------------------
- // Load the resource, lock the memory, grab a DC.
- //---------------------------------------------------------------------
- hGlobal = LoadResource( module, hRsrc );
- filesize = SizeofResource( module, hRsrc );
-
- LocaleFile = (void*)malloc( filesize + 1 );
- memset( LocaleFile, '\0', filesize + 1 );
- memcpy( LocaleFile, (const void *)hGlobal, filesize );
-
- //---------------------------------------------------------------------
- // Free DS and memory used.
- //---------------------------------------------------------------------
- UnlockResource( hGlobal );
- FreeResource( hGlobal );
- }
-
- if( LocaleFile == NULL ) {
- LocaleFile = Load_File( LanguageFile, &filesize );
- }
-
- if( LocaleFile != NULL ) {
- result = 1;
- }
-
- //---------------------------------------------------------------------
- // Set the LanguageID because we may need this later.
- //---------------------------------------------------------------------
-// CHAR buffer[ _MAX_PATH ];
-
-// Locale_GetString( LANG_NUM, buffer );
-// LanguageID = atoi( buffer );
-
- LanguageID = 0;
-
-#if(_DEBUG)
- switch( LanguageID ) {
- case 6:
- CodePage = 932;
- break;
- case 9:
- CodePage = 949;
- break;
- case 10:
- CodePage = 950;
- break;
- }
-#endif
-
- #endif
-*/
- return result;
-}
-
-/************************************************************************/
-/* restore */
-/************************************************************************/
-
-void Locale_Restore ( void )
-{
- if (TheGameText)
- {
- delete TheGameText;
- TheGameText = NULL;
- }
-
- #if( USE_MULTI_FILE_FORMAT )
- LOCALE_freetable();
- LOCALE_restore();
- #else
- if( LocaleFile ) {
- free( LocaleFile );
- LocaleFile = NULL;
- }
- #endif
-}
-
-/****************************************************************************/
-/* retreiving strings */
-/****************************************************************************/
-
-const char* Locale_GetString( int StringID, char *String )
-{
- static char buffer[ _MAX_PATH ];
- static wchar_t wide_buffer[ _MAX_PATH ];
-
- memset( buffer, '\0', _MAX_PATH );
- memset( wide_buffer, '\0', _MAX_PATH );
-
- #if( USE_MULTI_FILE_FORMAT )
- wcscpy( wide_buffer, (wchar_t *)LOCALE_getstring( StringID ));
- #else
- wcscpy( wide_buffer, (wchar_t *)LOCALE_getstr( LocaleFile, StringID ));
- #endif
-
- Remove_Quotes_Around_String( wide_buffer );
- WideCharToMultiByte( CodePage, 0, wide_buffer, _MAX_PATH, buffer, _MAX_PATH, NULL, NULL );
-
- if( String != NULL ) {
- strncpy( String, buffer, _MAX_PATH );
- }
-
- return buffer;
-}
-
-const wchar_t* Locale_GetString( const char *id, wchar_t *buffer, int size )
-{
- if (TheGameText)
- {
- const wchar_t *fetched = TheGameText->fetch(id);
- if (buffer)
- {
- wcsncpy(buffer, fetched, size);
- buffer[size-1] = 0;
- }
- return fetched;
- }
- return L"No String Manager";
-}
-
-/*
-const wchar_t* Locale_GetString( int StringID, wchar_t *String )
-{
- static wchar_t wide_buffer[ _MAX_PATH ];
-
- memset( wide_buffer, '\0', _MAX_PATH );
-
- #if( USE_MULTI_FILE_FORMAT )
- wcscpy( wide_buffer, (wchar_t *)LOCALE_getstring( StringID ));
- #else
-
- wchar_t *localeStr = NULL;
-
- if (TheGameText != NULL)
- localeStr = (wchar_t *)TheGameText->fetch( s_stringLabels[StringID] );
-
- if (localeStr == NULL)
- {
- return localeStringsMissing[ min( MISSING_STRING_HINTS_MAX - 1, StringID ) ];
- }
- else
- {
- wcscpy( wide_buffer, localeStr);
- }
- #endif
-
- Remove_Quotes_Around_String( wide_buffer );
-
- if( String != NULL ) {
- wcsncpy( String, wide_buffer, _MAX_PATH );
- }
-
- return wide_buffer;
-}
-*/
-
-/****************************************************************************/
-/* formating strings */
-/****************************************************************************/
-
-wchar_t *Remove_Quotes_Around_String ( wchar_t *old_string )
-{
- wchar_t wide_buffer[ _MAX_PATH ];
- wchar_t *letter = old_string;
- int length;
-
- //----------------------------------------------------------------------
- // If string is not NULL...
- //----------------------------------------------------------------------
- if ( *letter == '"' ) {
-
- letter++;
- wcscpy( wide_buffer, letter );
-
- length = wcslen( wide_buffer );
-
- if ( wide_buffer[ wcslen( wide_buffer )-1 ] == '"' ) {
- wide_buffer[ wcslen( wide_buffer )-1 ] = '\0';
- }
- wcscpy( old_string, wide_buffer );
- }
-
- return( old_string );
-}
-
-
-
diff --git a/Generals/Code/Tools/Autorun/Locale_API.h b/Generals/Code/Tools/Autorun/Locale_API.h
deleted file mode 100644
index 66c252f7e54..00000000000
--- a/Generals/Code/Tools/Autorun/Locale_API.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/************************************************************************************************
-* C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S *
-*************************************************************************************************
-*
-* FILE
-* $Archive: /Renegade Setup/Autorun/Locale_API.h $
-*
-* DESCRIPTION
-*
-* PROGRAMMER
-* $Author: Maria_l $
-*
-* VERSION INFO
-* $Modtime: 1/15/02 2:16p $
-* $Revision: 5 $
-*
-*************************************************************************************************/
-
-#pragma once
-
-#ifndef LOCALE_API_H
-#define LOCALE_API_H
-
-#include
-
-/****************************************************************************/
-/* GLOBAL VARIABLES */
-/****************************************************************************/
-extern int CodePage;
-extern void * LocaleFile;
-extern int LanguageID;
-extern char LanguageFile[];
-extern int PrimaryLanguage;
-extern int SubLanguage;
-
-/****************************************************************************/
-/* LOCALE API */
-/****************************************************************************/
-int Locale_Init ( int language, char *file );
-void Locale_Restore ( void );
-const wchar_t* Locale_GetString( const char *id, wchar_t *buffer = NULL, int size = _MAX_PATH );
-/*
-const char* Locale_GetString ( int StringID, char *String );
-const wchar_t* Locale_GetString ( int StringID, wchar_t *String=NULL );
-*/
-bool Locale_Use_Multi_Language_Files ( void );
-//int Locale_Get_Language_ID ( void ) { return LanguageID; };
-
-#endif
\ No newline at end of file
diff --git a/Generals/Code/Tools/Autorun/POINT.h b/Generals/Code/Tools/Autorun/POINT.h
deleted file mode 100644
index 5c4221013ec..00000000000
--- a/Generals/Code/Tools/Autorun/POINT.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name: Command & Conquer *
- * *
- * Archive: /Sun/Point.h *
- * *
- * Author: Joe_b *
- * *
- * Modtime: 2/02/98 10:09a *
- * *
- * Revision: 24 *
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-#pragma once
-
-#ifndef POINT_H
-#define POINT_H
-
-#include
-//#include "always.h"
-//#include "cctypes.h"
-
-//#ifdef __cplusplus
-//extern "C"{
-//#endif
-
-//#pragma pack(1)
-
-typedef struct Point2DStruct
-{
- int X;
- int Y;
-} Point2DStruct;
-
-//#pragma pack()
-
-//#ifdef __cplusplus
-//}
-//#endif
-
-
-
-template class TRect;
-
-/***********************************************************************************************
-** This class describes a point in 2 dimensional space using arbitrary
-** components. The interpretation of which is outside the scope
-** of this class. This class is the successor to the old style COORDINATE
-** and CELL types but also serves anywhere an X and Y value are treated
-** as a logical object (e.g., pixel location).
-*/
-template
-class TPoint2D {
- public:
- TPoint2D(void) {} // Default constructor does nothing by design.
- TPoint2D(T x, T y) : X(x), Y(y) {}
-
- // Equality comparison operators.
- bool operator == (TPoint2D const & rvalue) const {return(X==rvalue.X && Y==rvalue.Y);}
- bool operator != (TPoint2D const & rvalue) const {return(X!=rvalue.X || Y!=rvalue.Y);}
-
- // Addition and subtraction operators.
- TPoint2D const & operator += (TPoint2D const & rvalue) {X += rvalue.X;Y += rvalue.Y;return(*this);}
- TPoint2D const & operator -= (TPoint2D const & rvalue) {X -= rvalue.X;Y -= rvalue.Y;return(*this);}
- TPoint2D const operator - (TPoint2D const & rvalue) const {return(TPoint2D(T(X - rvalue.X), T(Y - rvalue.Y)));}
- TPoint2D const operator + (TPoint2D const & rvalue) const {return(TPoint2D(T(X + rvalue.X), T(Y + rvalue.Y)));}
-
- // Scalar multiplication and division.
- TPoint2D const operator * (T rvalue) const {return(TPoint2D(T(X * rvalue), T(Y * rvalue)));}
- TPoint2D const & operator *= (T rvalue) {X *= rvalue; Y *= rvalue;return(*this);}
- TPoint2D const operator / (T rvalue) const {if (rvalue == T(0)) return(TPoint2D(0,0));return(TPoint2D(T(X / rvalue), T(Y / rvalue)));}
- TPoint2D const & operator /= (T rvalue) {if (rvalue != T(0)) {X /= rvalue;Y /= rvalue;}return(*this);}
-
- // Dot and cross product.
- TPoint2D const operator * (TPoint2D const & rvalue) const {return(TPoint2D(T(X * rvalue.X), T(Y * rvalue.Y)));}
- T Dot_Product(TPoint2D const & rvalue) const {return((T(X * rvalue.X + Y * rvalue.Y)));}
- TPoint2D const Cross_Product(TPoint2D const & rvalue) const {return(TPoint2D(T(Y - rvalue.Y), T(rvalue.X - X)));}
-
- // Negation operator -- simple and effective
- TPoint2D const operator - (void) const {return(TPoint2D(T(-X), T(-Y)));}
-
- // Vector support functions.
- T Length(void) const {return(T(sqrt(double(X*X + Y*Y))));}
- TPoint2D const Normalize(void) const {
- double len = sqrt(X*X + Y*Y);
- if (len != 0.0) {
- return(TPoint2D((T)(X / len), (T)(Y / len)));
- } else {
- return(*this);
- }
- }
-
- // Find distance between points.
- T Distance_To(TPoint2D const & point) const {return((*this - point).Length());}
-
- public:
- T X;
- T Y;
-};
-
-
-/***********************************************************************************************
-** This typedef provides an uncluttered type name for use by simple integer points.
-*/
-class Point2D : public TPoint2D
-{
- public:
- Point2D(void) {} // Default constructor does nothing by design.
- Point2D(int x, int y) : TPoint2D(x, y) {}
- Point2D(Point2DStruct const & rvalue) : TPoint2D(rvalue.X, rvalue.Y) {}
- Point2D(TPoint2D const & rvalue) : TPoint2D(rvalue) {}
-
- operator Point2DStruct (void) const {Point2DStruct pt;pt.X = X;pt.Y = Y;return(pt);}
-
- Point2D const & operator += (Point2D const & rvalue) {X += rvalue.X;Y += rvalue.Y;return(*this);}
- Point2D const & operator -= (Point2D const & rvalue) {X -= rvalue.X;Y -= rvalue.Y;return(*this);}
- Point2D const operator - (Point2D const & rvalue) const {return(Point2D(int(X - rvalue.X), int(Y - rvalue.Y)));}
- Point2D const operator + (Point2D const & rvalue) const {return(Point2D(int(X + rvalue.X), int(Y + rvalue.Y)));}
-};
-
-
-template
-T Distance(TPoint2D const & point1, TPoint2D const & point2)
-{
- return((point1 - point2).Length());
-}
-
-
-template
-TPoint2D const Cross_Product(TPoint2D const & lvalue, TPoint2D const & rvalue)
-{
- return(lvalue.Cross_Product(rvalue));
-}
-
-
-/***********************************************************************************************
-** This describes a point in 3 dimensional space using arbitrary
-** components. This is the successor to the COORDINATE type for those
-** times when height (Z axis) needs to be tracked.
-**
-** Notice that it is NOT implemented as a virtually derived class. This
-** is for efficiency reasons. This class chooses to be smaller and faster at the
-** expense of polymorphism. However, since it is publicly derived, inheritance is
-** the next best thing.
-*/
-template
-class TPoint3D : public TPoint2D {
- typedef TPoint2D BASECLASS;
-
- public:
- using BASECLASS::X;
- using BASECLASS::Y;
-
- public:
- TPoint3D(void) {} // Default constructor does nothing by design.
- TPoint3D(T x, T y, T z) : BASECLASS(x, y), Z(z) {}
- TPoint3D(BASECLASS const & rvalue, T z /*= 0*/) : BASECLASS(rvalue), Z(z) {}
-
- // Equality comparison operators.
- bool operator == (TPoint3D const & rvalue) const {return(X==rvalue.X && Y==rvalue.Y && Z==rvalue.Z);}
- bool operator != (TPoint3D const & rvalue) const {return(X!=rvalue.X || Y!=rvalue.Y || Z!=rvalue.Z);}
-
- // Addition and subtraction operators.
- TPoint3D const & operator += (TPoint3D const & rvalue) {X += rvalue.X;Y += rvalue.Y;Z += rvalue.Z;return(*this);}
- TPoint2D const & operator += (TPoint2D const & rvalue) {BASECLASS::operator += (rvalue);return(*this);}
- TPoint3D const & operator -= (TPoint3D const & rvalue) {X -= rvalue.X;Y -= rvalue.Y;Z -= rvalue.Z;return(*this);}
- TPoint2D const & operator -= (TPoint2D const & rvalue) {BASECLASS::operator -= (rvalue);return(*this);}
- TPoint3D const operator - (TPoint3D const & rvalue) const {return(TPoint3D(X - rvalue.X, Y - rvalue.Y, Z - rvalue.Z));}
- TPoint3D const operator - (TPoint2D const & rvalue) const {return(TPoint3D(X - rvalue.X, Y - rvalue.Y, Z));}
- TPoint3D const operator + (TPoint3D const & rvalue) const {return(TPoint3D(X + rvalue.X, Y + rvalue.Y, Z + rvalue.Z));}
- TPoint3D const operator + (TPoint2D const & rvalue) const {return(TPoint3D(X + rvalue.X, Y + rvalue.Y, Z));}
-
- // Scalar multiplication and division.
- TPoint3D const operator * (T rvalue) const {return(TPoint3D(X * rvalue, Y * rvalue, Z * rvalue));}
- TPoint3D const & operator *= (T rvalue) {X *= rvalue;Y *= rvalue;Z *= rvalue;return(*this);}
- TPoint3D const operator / (T rvalue) const {if (rvalue == T(0)) return(TPoint3D(0,0,0));return(TPoint3D(X / rvalue, Y / rvalue, Z / rvalue));}
- TPoint3D const & operator /= (T rvalue) {if (rvalue != T(0)) {X /= rvalue;Y /= rvalue;Z /= rvalue;}return(*this);}
-
- // Dot and cross product.
- TPoint3D const operator * (TPoint3D const & rvalue) const {return(TPoint3D(X * rvalue.X, Y * rvalue.Y, Z * rvalue.Z));}
- T Dot_Product(TPoint3D const & rvalue) const {return(T(X * rvalue.X + Y * rvalue.Y + Z * rvalue.Z));}
- TPoint3D const Cross_Product(TPoint3D const & rvalue) const {return TPoint3D(Y * rvalue.Z - Z * rvalue.Y, Z * rvalue.X - X * rvalue.Z, X * rvalue.Y - Y * rvalue.X);}
-
- // Negation operator -- simple and effective
- TPoint3D const operator - (void) const {return(TPoint3D(-X, -Y, -Z));}
-
- // Vector support functions.
- T Length(void) const {return(T(sqrt(double(X*X + Y*Y + Z*Z))));}
- TPoint3D const Normalize(void) const {
- double len = sqrt(X*X + Y*Y + Z*Z);
- if (len != 0.0) {
- return(TPoint3D((T)(X / len), (T)(Y / len), (T)(Z / len)));
- } else {
- return(*this);
- }
- }
-
- public:
-
- /*
- ** The Z component of this point.
- */
- T Z;
-};
-
-
-/***********************************************************************************************
-** This typedef provides a simple uncluttered type name for use by
-** integer 3D points.
-*/
-typedef TPoint3D Point3D;
-
-template
-TPoint3D const Cross_Product(TPoint3D const & lvalue, TPoint3D const & rvalue)
-{
- return(lvalue.Cross_Product(rvalue));
-}
-
-
-#endif
diff --git a/Generals/Code/Tools/Autorun/RECT.h b/Generals/Code/Tools/Autorun/RECT.h
deleted file mode 100644
index 0ca194c9550..00000000000
--- a/Generals/Code/Tools/Autorun/RECT.h
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Command & Conquer *
- * *
- * Archive : /Sun/RECT.H *
- * *
- * Author : Joe_b *
- * *
- * Modtime : 11/21/97 4:40p *
- * *
- * Revision : 20 *
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * Union -- Combines two rectangles into one larger one. *
- * Intersect -- Find the intersection between two rectangles. *
- * Intersect -- Simple intersect between two rectangles. *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-#pragma once
-
-#ifndef RECT_H
-#define RECT_H
-
-#include
-#include "POINT.h"
-
-
-/*
-** This class manages a rectangle. Typically, this is used for tracking regions on a surface
-** and for clipping operations. This is a lightweight class in that it defines few support
-** functions and exposes the member variables for direct access.
-*/
-template
-class TRect
-{
- public:
- TRect(void) {} // Default constructor does nothing by design.
- TRect(T x, T y, T w, T h) : X(x), Y(y), Width(w), Height(h) {}
- TRect(TPoint2D const & point, T w, T h) : X(point.X), Y(point.Y), Width(w), Height(h) {}
-
- // Equality comparison operators.
- bool operator == (TRect const & rvalue) const {return(X==rvalue.X && Y==rvalue.Y && Width==rvalue.Width && Height==rvalue.Height);}
- bool operator != (TRect const & rvalue) const {return(X!=rvalue.X || Y!=rvalue.Y || Width!=rvalue.Width || Height!=rvalue.Height);}
-
- // Addition and subtraction operators.
- TRect const & operator += (TPoint2D const & point) {X += point.X;Y += point.Y;return(*this);}
- TRect const & operator -= (TPoint2D const & point) {X -= point.X;Y -= point.Y;return(*this);}
- TRect const operator + (TPoint2D const & point) {return(TRect(Top_Left() + point, Width, Height));}
- TRect const operator - (TPoint2D const & point) {return(TRect(Top_Left() - point, Width, Height));}
-
- /*
- ** Bias this rectangle within another.
- */
- TRect const Bias_To(TRect const & rect) const {return(TRect(Top_Left() + rect.Top_Left(), Width, Height));}
-
- // Assign values
- void Set(T x, T y, T w, T h) {X = x; Y = y; Width = w; Height = h;}
-
- /*
- ** Determine if two rectangles overlap.
- */
- bool Is_Overlapping(TRect const & rect) const {return(X < rect.X+rect.Width && Y < rect.Y+rect.Height && X+Width > rect.X && Y+Height > rect.Y);}
-
- /*
- ** Determine is rectangle is valid.
- */
- bool Is_Valid(void) const {return(Width > 0 && Height > 0);}
- __declspec(property(get=Is_Valid)) bool IsValid;
-
- /*
- ** Returns size of rectangle if each discrete location within it is presumed
- ** to be of size 1.
- */
- int Size(void) const {return(int(Width) * int(Height));}
-
- /*
- ** Fetch points of rectangle (used as a convenience for the programmer).
- */
- TPoint2D Top_Left(void) const {return(TPoint2D(X, Y));}
- __declspec(property(get=Top_Left)) TPoint2D TopLeft;
-
- TPoint2D Top_Right(void) const {return(TPoint2D(T(X + Width - 1), Y));}
- __declspec(property(get=Top_Right)) TPoint2D TopRight;
-
- TPoint2D Bottom_Left(void) const {return(TPoint2D(X, T(Y + Height - 1)));}
- __declspec(property(get=Bottom_Left)) TPoint2D BottomLeft;
-
- TPoint2D Bottom_Right(void) const {return(TPoint2D(T(X + Width - 1), T(Y + Height - 1)));}
- __declspec(property(get=Bottom_Right)) TPoint2D BottomRight;
-
-
- /*
- ** Determine if a point lies within the rectangle.
- */
- bool Is_Point_Within(TPoint2D const & point) const {return(point.X >= X && point.X < X+Width && point.Y >= Y && point.Y < Y+Height);}
-
- public:
-
- /*
- ** Coordinate of upper left corner of rectangle.
- */
- T X;
- T Y;
-
- /*
- ** Dimensions of rectangle. If the width or height is less than or equal to
- ** zero, then the rectangle is in an invalid state.
- */
- T Width;
- T Height;
-};
-
-
-template
-TPoint2D const Bias_To(TPoint2D const & point, TRect const & rect)
-{
- return(TPoint2D(T(point.X + rect.X), T(point.Y + rect.Y)));
-}
-
-
-/***********************************************************************************************
- * Union -- Combines two rectangles into one larger one. *
- * *
- * This routine will combine the two specified rectangles such that a larger one is *
- * returned that encompasses both rectangles. *
- * *
- * INPUT: rect1 -- One rectangle to combine. *
- * rect2 -- The other rectangle to combine. *
- * *
- * OUTPUT: Returns with the smallest rectangle that encompasses both specified rectangles. *
- * *
- * WARNINGS: none *
- * *
- * HISTORY: *
- * 06/04/1997 JLB : Created. *
- *=============================================================================================*/
-template
-TRect const Union(TRect const & rect1, TRect const & rect2)
-{
- if (rect1.Is_Valid()) {
- if (rect2.Is_Valid()) {
- TRect result = rect1;
-
- if (result.X > rect2.X) {
- result.Width += T(result.X-rect2.X);
- result.X = rect2.X;
- }
- if (result.Y > rect2.Y) {
- result.Height += T(result.Y-rect2.Y);
- result.Y = rect2.Y;
- }
- if (result.X+result.Width < rect2.X+rect2.Width) {
- result.Width = T(((rect2.X+rect2.Width)-result.X)+1);
- }
- if (result.Y+result.Height < rect2.Y+rect2.Height) {
- result.Height = T(((rect2.Y+rect2.Height)-result.Y)+1);
- }
- return(result);
- }
- return(rect1);
- }
- return(rect2);
-}
-
-
-/***********************************************************************************************
- * Intersect -- Find the intersection between two rectangles. *
- * *
- * This routine will take two rectangles and return the intersecting rectangle. It also *
- * tracks how much on rectangle was clipped off of the top and left edges and returns *
- * these values. It can be handy to use these returned clipping values for blit operations *
- * between rectangles. *
- * *
- * INPUT: bounding_rect -- The rectangle of the bounding box (clipping rectangle). *
- * *
- * draw_rect -- The rectangle that will be clipped into the bounding rectangle. *
- * *
- * x,y -- Place to store the clipping offset performed on the draw_rect. *
- * If this offset is applied to a subsiquent blit operation from *
- * the draw_rect source, it will appear to be properly clipped *
- * against the clipping rectangle rather than offset to the *
- * clipping rectangle. *
- * *
- * OUTPUT: Returns with the rectangle that is the intersection of the two rectangles. *
- * *
- * WARNINGS: The returned rectangle may be clipped into nothingness. Check for Is_Valid *
- * to catch this case. *
- * *
- * HISTORY: *
- * 06/04/1997 JLB : Created. *
- *=============================================================================================*/
-template
-TRect const Intersect(TRect const & bounding_rect, TRect const & draw_rect, T * x, T * y)
-{
- TRect bad_rect(0, 0, 0, 0); // Dummy (illegal) draw_rect.
- TRect new_draw_rect = draw_rect; // Working draw_rect.
-
- /*
- ** Both draw_rects must be valid or else no intersection can occur. In such
- ** a case, return an illegal draw_rect.
- */
- if (!bounding_rect.Is_Valid() || !draw_rect.Is_Valid()) return(bad_rect);
-
- /*
- ** The draw_rect spills past the left edge.
- */
- if (new_draw_rect.X < bounding_rect.X) {
- new_draw_rect.Width -= T(bounding_rect.X - new_draw_rect.X);
- new_draw_rect.X = bounding_rect.X;
- }
- if (new_draw_rect.Width < 1) return(bad_rect);
-
- /*
- ** The draw_rect spills past top edge.
- */
- if (new_draw_rect.Y < bounding_rect.Y) {
- new_draw_rect.Height -= T(bounding_rect.Y - new_draw_rect.Y);
- new_draw_rect.Y = bounding_rect.Y;
- }
- if (new_draw_rect.Height < 1) return(bad_rect);
-
- /*
- ** The draw_rect spills past the right edge.
- */
- if (new_draw_rect.X + new_draw_rect.Width > bounding_rect.X + bounding_rect.Width) {
- new_draw_rect.Width -= T((new_draw_rect.X + new_draw_rect.Width) - (bounding_rect.X + bounding_rect.Width));
- }
- if (new_draw_rect.Width < 1) return(bad_rect);
-
- /*
- ** The draw_rect spills past the bottom edge.
- */
- if (new_draw_rect.Y + new_draw_rect.Height > bounding_rect.Y + bounding_rect.Height) {
- new_draw_rect.Height -= T((new_draw_rect.Y + new_draw_rect.Height) - (bounding_rect.Y + bounding_rect.Height));
- }
- if (new_draw_rect.Height < 1) return(bad_rect);
-
- /*
- ** Adjust Height relative draw position according to Height new draw_rect
- ** union.
- */
- if (x != NULL) {
- *x -= T(new_draw_rect.X - draw_rect.X);
- }
- if (y != NULL) {
- *y -= T(new_draw_rect.Y - draw_rect.Y);
- }
-
- return(new_draw_rect);
-}
-
-
-/***********************************************************************************************
- * Intersect -- Simple intersect between two rectangles. *
- * *
- * This will return with the rectangle that represents the intersection of the two *
- * rectangles specified. *
- * *
- * INPUT: rect1 -- The first rectangle. *
- * *
- * rect2 -- The second rectangle. *
- * *
- * OUTPUT: Returns with the intersecting rectangle between the two rectangles specified. *
- * *
- * WARNINGS: If there is no valid intersection between the two rectangles, then a rectangle *
- * of illegal value is returned. Check for this case by using the Is_Valid() *
- * function. *
- * *
- * HISTORY: *
- * 06/04/1997 JLB : Created. *
- *=============================================================================================*/
-template
-TRect const Intersect(TRect const & rect1, TRect const & rect2)
-{
- return(Intersect(rect1, rect2, (T*)NULL, (T*)NULL));
-}
-
-
-/*
-** This typedef provides an uncluttered type name for a rectangle that
-** is composed of integers.
-*/
-typedef TRect Rect;
-
-const Rect RECT_NONE(0,0,0,0);
-
-#endif
-
diff --git a/Generals/Code/Tools/Autorun/TTFont.cpp b/Generals/Code/Tools/Autorun/TTFont.cpp
deleted file mode 100644
index 31be82fb6e4..00000000000
--- a/Generals/Code/Tools/Autorun/TTFont.cpp
+++ /dev/null
@@ -1,1475 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/************************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ************************************************************************************************
- * *
- * Project Name: Setup *
- * *
- * Archive: TTFont.cpp *
- * *
- * Author: Maria del Mar McCready Legg *
- * *
- * Modtime: 8/24/99 3:44pm *
- * *
- * Revision: 01 *
- * *
- *----------------------------------------------------------------------------------------------*
- * Functions: *
- * TTFontClass::TTFontClass -- Constructor for a font class object. *
- * TTFontClass::Char_Pixel_Width -- Fetch the pixel width of the character specified. *
- * TTFontClass::Find_Text_VLength -- Finds length of text in pixels *
- * TTFontClass::Get_Height -- Fetch the normalized height of the nominal font character. *
- * TTFontClass::Get_Width -- Get normalized width of the nominal font character. *
- * TTFontClass::Print -- Print text to the surface specified. *
- * TTFontClass::Raw_Height -- Fetch the height of the font. *
- * TTFontClass::Raw_Width -- Fetch the raw width of a character. *
- * TTFontClass::Set_XSpacing -- Set the X spacing override value. *
- * TTFontClass::Set_YSpacing -- Set the vertical (Y) spacing override value. *
- * TTFontClass::String_Pixel_Width -- Determines the width of the string in pixels. *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-
-
-#define STRICT
-#include
-#include
-#include
-#include
-#include
-#include "ARGS.H"
-#include "autorun.h"
-#include "RECT.h"
-#include "Wnd_File.h"
-#include "TTFont.h"
-#include "JSUPPORT.H" // [OYO]
-#include "Locale_API.h"
-
-
-#define FONTINFOMAXHEIGHT 4
-#define FONTINFOMAXWIDTH 5
-#define FUDGEDIV 16
-
-//-------------------------------------------------------------------------
-// Text Fonts.
-//-------------------------------------------------------------------------
-TTFontClass *TTButtonFontPtr = NULL;
-TTFontClass *TTButtonFontPtrSmall = NULL;
-TTFontClass *TTTextFontPtr = NULL;
-TTFontClass *TTTextFontPtr640 = NULL;
-TTFontClass *TTTextFontPtr800 = NULL;
-TTFontClass *TTLicenseFontPtr = NULL;
-
-FontManagerClass * FontManager = NULL;
-
-//unsigned long TEXT_COLOR = RGB( 247, 171, 11 );
-//unsigned long SHADOW_COLOR = RGB( 40, 8, 8 );
-unsigned long TEXT_COLOR = RGB( 255, 204, 51 );
-unsigned long SHADOW_COLOR = RGB( 40, 8, 8 );
-
-unsigned long TEXT_NORMAL_COLOR = RGB( 255, 204, 51 );
-unsigned long TEXT_NORMAL_SHADOW_COLOR = RGB( 40, 8, 8 );
-unsigned long TEXT_FOCUSED_COLOR = RGB( 255, 204, 51 );
-unsigned long TEXT_FOCUSED_SHADOW_COLOR = RGB( 40, 8, 8 );
-unsigned long TEXT_PRESSED_COLOR = RGB( 194, 79, 32 );
-unsigned long TEXT_PRESSED_SHADOW_COLOR = RGB( 70, 55, 49 );
-
-
-unsigned long BLACK_COLOR = RGB( 0, 0, 0 );
-unsigned long WHITE_COLOR = RGB( 255, 255, 255 );
-unsigned long RED_COLOR = RGB( 255, 0, 0 );
-unsigned long ORANGE_COLOR = RGB( 199, 91, 0 );
-unsigned long YELLOW_COLOR = RGB( 255, 247, 0 );
-unsigned long GREEN_COLOR = RGB( 0, 255, 0 );
-unsigned long BLUE_COLOR = RGB( 0, 0, 255 );
-unsigned long INDIGO_COLOR = RGB( 90, 2, 253 );
-unsigned long VIOLET_COLOR = RGB( 128, 0, 255 );
-
-
-/************************************************************************************
- * TTFontClass::TTFontClass -- Constructor for a font class object. *
- * *
- * This constructs a font object as it is based upon the true type windows fonts. *
- * *
- * INPUT: char *filename -- True Type Windows font file to open. *
- * char *facename -- It's face name. *
- * int height -- The height requested. *
- * *
- * OUTPUT: none *
- * *
- * WARNINGS: none *
- * *
- * HISTORY: *
- * 08/24/1999 MML : Created. *
- *==================================================================================*/
-TTFontClass::TTFontClass(
- HDC hdc,
- char *filename,
- char *facename,
- int height,
- int weight,
- BYTE charset,
- int width,
- int escapement,
- int orientation,
- BYTE italic,
- BYTE underline,
- BYTE strikeout,
- BYTE outputPrecision,
- BYTE clipPrecision,
- BYTE quality,
- BYTE pitchAndFamily )
-{
- HGDIOBJ old_object;
- TEXTMETRIC tm;
- char real_facename[MAX_PATH];
-
- //--------------------------------------------------------------------------
- // Get or Set a Font filename.
- //--------------------------------------------------------------------------
- if (( filename == NULL ) || ( filename[0] == '\0' )) {
- strcpy( szFilename, "Arial.ttf" );
- } else {
- strcpy( szFilename, filename );
- }
-
- //--------------------------------------------------------------------------
- // Get or Set a Font facename.
- //--------------------------------------------------------------------------
- if (( facename == NULL ) || ( facename[0] == '\0' )) {
- strcpy( szFacename, "Arial" );
- } else {
- strcpy( szFacename, facename );
- }
- real_facename[0] = '\0';
-
- Msg( __LINE__, __FILE__, "TTFontClass -- filename=%s, facename=%s, height=%d.", filename, facename, height );
-
- //--------------------------------------------------------------------------
- // Make sure the font file is "Registered". Then create the font.
- //--------------------------------------------------------------------------
- AddFontResource( szFilename );
- Font = CreateFont(
- height,
- width,
- escapement,
- orientation,
- weight,
- italic,
- underline,
- strikeout,
- charset,
- outputPrecision,
- clipPrecision,
- quality,
- pitchAndFamily,
- szFacename );
-
- if ( hdc && ( Font != NULL )) {
-
- //----------------------------------------------------------------------
- // The GetTextFace function lets a program determine the face name of
- // THE font currently selected in the device context:
- //----------------------------------------------------------------------
- old_object = SelectObject( hdc, Font );
- GetTextFace( hdc, ( sizeof( real_facename ) / sizeof( TCHAR )), real_facename );
-
- if( _stricmp( real_facename, szFacename ) != 0 ) {
-
- strcpy( szFilename, "Arial.ttf" );
- strcpy( szFacename, "Arial" );
-
- SelectObject( hdc, old_object );
- DeleteObject( Font );
- Font = NULL;
-
- Font = CreateFont(
- height, // height of font
- width, // average character width
- escapement, // angle of escapement
- orientation, // base-line orientation angle
- weight, // font weight
- italic, // italic attribute option
- underline, // underline attribute option
- strikeout, // strikeout attribute option
- charset, // character set identifier
- outputPrecision, // output precision
- clipPrecision, // clipping precision
- quality, // output quality
- pitchAndFamily, // pitch and family
- szFacename ); // typeface name
-
- real_facename[0] = '\0';
- old_object = SelectObject( hdc, Font );
- GetTextFace( hdc, ( sizeof( real_facename ) / sizeof( TCHAR )), real_facename );
- }
- }
-
- //--------------------------------------------------------------------------
- // Save off the height.
- //--------------------------------------------------------------------------
- Height = height;
-
- if ( hdc ) {
-
- //-----------------------------------------------------------------------
- // Get info from the font in BackBuffer's DC.
- //-----------------------------------------------------------------------
- old_object = SelectObject( hdc, Font );
- GetTextMetrics( hdc, &tm );
-
- FontXSpacing = GetTextCharacterExtra( hdc );
- Ascent = tm.tmAscent;
- Descent = tm.tmDescent;
- InternalLeading = tm.tmInternalLeading;
- ExternalLeading = tm.tmExternalLeading;
- AveCharWidth = tm.tmAveCharWidth;
- MaxCharWidth = tm.tmMaxCharWidth;
- Overhang = tm.tmOverhang;
- Italic = tm.tmItalic;
- Underlined = tm.tmUnderlined;
- StruckOut = tm.tmStruckOut;
- CharSet = tm.tmCharSet; // [OYO] It is important to support Double Byte Chars
- SelectObject( hdc, old_object );
-
- } else {
-
- //-----------------------------------------------------------------------
- // Set default values.
- //-----------------------------------------------------------------------
- Ascent = 0;
- Descent = 0;
- InternalLeading = 0;
- ExternalLeading = 0;
- AveCharWidth = 0;
- MaxCharWidth = 0;
- Overhang = 0;
- Italic = 0;
- Underlined = 0;
- StruckOut = 0;
- CharSet = 0; // [OYO]
- FontXSpacing = 0;
- }
-}
-
-
-/***********************************************************************************************
- * TTFontClass::Char_Pixel_Width -- Fetch the pixel width of the character specified. *
- * *
- * This will return with the pixel width of the character specified. *
- * *
- * INPUT: c -- The character to determine the pixel width for. *
- * *
- * OUTPUT: Returns with the pixel width of the character. *
- * *
- * WARNINGS: The return width is the screen real estate width which may differ from the *
- * actual pixels of the character. This difference is controlled by the font *
- * X spacing. *
- * *
- * HISTORY: *
- * 05/26/1997 JLB : Created. *
- *=============================================================================================*/
-
-int TTFontClass::Char_Pixel_Width( HDC hdc, UINT c ) const
-{
- HGDIOBJ old_object;
- ABC abc;
-
- abc.abcA = 0;
- abc.abcB = 0;
- abc.abcC = 0;
-
- if ( hdc ) {
- old_object = SelectObject( hdc, Font );
- GetCharABCWidths( hdc, c, c, &abc );
- SelectObject( hdc, old_object );
- }
- return( abc.abcA + abc.abcB + abc.abcC );
-}
-
-/************************************************************************************************
- * TTFontClass::Char_Pixel_Width -- Fetch the pixel width of the character specified.
- *
- * This will return with the pixel width of the character specified.
- *
- * INPUT: HDC hdc -- must be passed in from calling function.
- * char const * string -- the pointer to the character in the string.
- * int *num_bytes -- return number of bytes this character has: 1 or 2.
- *
- * OUTPUT: Returns with the pixel width of the character.
- *
- * WARNINGS: The return width is the screen real estate width which may differ from the
- * actual pixels of the character. This difference is controlled by the font
- * X spacing.
- *
- * NOTE: This is function determines if the character is a double-byte or single-byte
- * character, then calls the standard Char_Pixel_Width.
- *
- * HISTORY:
- * 05/26/1997 JLB : Created.
- *==============================================================================================*/
-//
-// [OYO] Supports DBCS ( multi-byte characters ).
-//
-int TTFontClass::Char_Pixel_Width ( HDC hdc, char const * string, int *num_bytes ) const
-{
- char const *letter = string;
- int length = 0;
- UINT c;
-
- //--------------------------------------------------------------------------
- // These values must be passed in.
- //--------------------------------------------------------------------------
- if ( string == NULL || *string == '\0' || hdc == NULL ) {
- return( 0 );
- }
-
- //--------------------------------------------------------------------------
- // If this value is passed in, the set the default value (1=single).
- //--------------------------------------------------------------------------
- if ( num_bytes!= NULL ) {
- *num_bytes = 1;
- }
-
- //--------------------------------------------------------------------------
- // Get the pixel width of the character. If it is a double-byte character,
- // then num_bytes will come back as '2'.
- //--------------------------------------------------------------------------
- if( IsFontDBCS() && IsDBCSLeadByte( *letter )){
- c = Get_Double_Byte_Char( letter, num_bytes );
- length += Char_Pixel_Width( hdc, c ); // pixel length of double-byte character.
- } else {
- length += Char_Pixel_Width( hdc, *letter ); // pixel length of single-byte character.
- }
- return( length );
-}
-
-
-/************************************************************************************************
- * TTFontClass::String_Pixel_Width -- Determines the width of the string in pixels. *
- * *
- * This routine is used to determine how many pixels wide the string will be if it were *
- * printed. *
- * *
- * INPUT: string -- The string to convert into its pixel width. *
- * *
- * OUTPUT: Returns with the number of pixels the string would span if it were printed. *
- * *
- * WARNINGS: This routine does not take into account clipping. *
- * *
- * HISTORY: *
- * 05/26/1997 JLB : Created. *
- *==============================================================================================*/
-
-int TTFontClass::String_Pixel_Width( HDC hdc, char const * string ) const
-{
- if ( string == NULL ) {
- return(0);
- }
-
- int largest = 0; // Largest recorded width of the string.
- int width = 0;
- HGDIOBJ old_object;
- int length;
- SIZE size;
- bool make_dc = FALSE;
- HDC localDC = hdc;
-
- size.cx = 0;
-
- if ( localDC == NULL ) {
- return( size.cx );
- }
-
- if ( localDC ) {
- length = strlen( string );
- old_object = SelectObject( localDC, Font );
- GetTextExtentPoint32( localDC, string, length, &size );
- SelectObject( localDC, old_object );
- }
- return( size.cx );
-}
-
-/****************************************************************************
-*
-* NAME
-* String_Pixel_Bounds(String, Bounds)
-*
-* DESCRIPTION
-* Calculate the bounding box for the specified string.
-*
-* INPUTS
-* String - String to calculate bounds for
-* Bounds - Rect to fill with bounds
-*
-* RESULT
-* NONE
-*
-****************************************************************************/
-//
-// [OYO] Supports DBCS ( multi-byte characters ).
-//
-void TTFontClass::String_Pixel_Bounds( HDC hdc, const char* string, Rect& bounds ) const
-{
- int width;
- int height;
-
- bounds.Width = 0;
- bounds.Height = 0;
-
- if ( string == NULL ) {
- return;
- }
-
- if ( hdc == NULL ) {
- return;
- }
-
- width = 0;
- height = Get_Height();
-
- while ( *string != 0 ) {
-
- if (( *string == '\r' ) || ( *string == '\n' )) {
-
- string++;
- height += Get_Height();
- bounds.Width = max( bounds.Width, width );
- width = 0;
-
- } else if( IsFontDBCS()){
-
-#if(0)
- //--------------------------------------------------------------------
- // Using one of those _tc functions:
- // Get a character, get the width of that character, then
- // move the pointer to the next character.
- //--------------------------------------------------------------------
- UINT c = Get_Double_Byte_Char( string );
- width += Char_Pixel_Width( hdc, c );
- string = _tcsinc( string );
-#else
- //--------------------------------------------------------------------
- // MBCS way: Get a byte. If byte is a "Lead" byte, get the second half,
- // combine them into one character, then get the width of that character.
- //--------------------------------------------------------------------
- UINT c = *(BYTE*)string++;
- if( IsDBCSLeadByte( c )&& *string ) {
- c = ( c << 8 ) | *(BYTE *)string++;
- }
- width += Char_Pixel_Width( hdc, c );
-#endif
-
- } else {
- width += Char_Pixel_Width( hdc, *string++ );
- }
- }
-
- bounds.Width = max( bounds.Width, width );
- bounds.Height = height;
-}
-
-/***********************************************************************************************
- * TTFontClass::Get_Double_Byte_Char -- Get the first character even if DBSC.
- *
- * INPUT: char * -- string to look at.
- *
- * OUTPUT: Returns with the normalized width of the character in the font.
- *
- * WARNINGS: I added this function based on code provided by Ikeda-san.
- *
- * HISTORY:
- * 06/05/2000 MML : Created.
- *=============================================================================================*/
-//
-// [OYO] Supports DBCS ( multi-byte characters ).
-//
-UINT TTFontClass::Get_Double_Byte_Char ( const char *string, int *num_bytes ) const
-{
- if ( string == NULL || *string == '\0' ) {
- return( 0 );
- }
-
- const char *ptr = string;
- UINT c = *(BYTE *)ptr++;
-
- if ( num_bytes != NULL ) {
- *num_bytes = 1;
- }
-
- //--------------------------------------------------------------------------
- // The IsDBCSLeadByte function determines whether a character is a
- // lead byte - that is, the first byte of a character in a double-byte
- // character set (DBCS).
- //
- // BOOL IsDBCSLeadByte( BYTE TestChar /* character to test */ );
- //
- // TestChar -- Specifies the character to be tested.
- //
- // Return Values
- // If the character is a lead byte, the return value is nonzero.
- // If the character is not a lead byte, the return value is zero.
- // To get extended error information, call GetLastError.
- // Remarks
- // Lead bytes are unique to double-byte character sets.
- // A lead byte introduces a double-byte character. Lead bytes
- // occupy a specific range of byte values. The IsDBCSLeadByte
- // function uses the ANSI code page to check lead-byte ranges.
- // To specify a different code page, use the IsDBCSLeadByteEx function.
- //
- // Declared in winnls.h.
- //--------------------------------------------------------------------------
- if( IsDBCSLeadByte( c )&& *ptr ) { // [OYO]
- c = ( c << 8 ) | *(BYTE *)ptr++;
- if ( num_bytes != NULL ) {
- *num_bytes = 2;
- }
- }
- return( c );
-}
-
-
-/***********************************************************************************************
- * TTFontClass::Get_Width -- Get normalized width of the nominal font character. *
- * *
- * This routine is used to fetch the width of the widest character in the font but the *
- * width has been biased according to any X spacing override present. *
- * *
- * INPUT: none *
- * *
- * OUTPUT: Returns with the normalized width of the widest character in the font. *
- * *
- * WARNINGS: none *
- * *
- * HISTORY: *
- * 05/26/1997 JLB : Created. *
- *=============================================================================================*/
-int TTFontClass::Get_Width( void ) const
-{
- return( MaxCharWidth - Overhang );
-}
-
-/***********************************************************************************************
- * TTFontClass::Get_Height -- Fetch the normalized height of the nominal font character. *
- * *
- * This will return the height of the font but the returned height will be adjusted by any *
- * Y spacing override present. *
- * *
- * INPUT: none *
- * *
- * OUTPUT: Returns with the height of the font normalized by any spacing overrides. *
- * *
- * WARNINGS: none *
- * *
- * HISTORY: *
- * 05/26/1997 JLB : Created. *
- *=============================================================================================*/
-int TTFontClass::Get_Height( void ) const
-{
- return( Height );
-}
-
-/***********************************************************************************************
- * TTFontClass::Set_XSpacing -- Set the X spacing override value. *
- * *
- * Use this routine to control the horizontal spacing override for this font. If the value *
- * is negative, the font becomes compressed. If the value is positive, then the font *
- * becomes expanded. *
- * *
- * INPUT: x -- The X spacing override to use for this font. *
- * *
- * OUTPUT: Returns with the old X spacing override value. *
- * *
- * WARNINGS: none *
- * *
- * HISTORY: *
- * 05/26/1997 JLB : Created. *
- *=============================================================================================*/
-int TTFontClass::Set_XSpacing( HDC hdc, int x )
-{
-// HGDIOBJ old_object;
-// int answer = 0;
-
-// if ( hdc ) {
-// old_object = SelectObject( hdc, Font );
-// answer = SetTextCharacterExtra( hdc, x );
-// SelectObject( hdc, old_object );
-// }
- FontXSpacing = x;
- return( x );
-}
-
-
-/***********************************************************************************************
- * TTFontClass::Set_YSpacing -- Set the vertical (Y) spacing override value. *
- * *
- * Use this routine to control the "line spacing" of a font. If the Y spacing is negative *
- * then the font becomes closer to the line above it. If value is positive, then more *
- * space occurs between lines. *
- * *
- * INPUT: y -- The Y spacing override to use for this font. *
- * *
- * OUTPUT: Returns with the old Y spacing override value. *
- * *
- * WARNINGS: none *
- * *
- * HISTORY: *
- * 05/26/1997 JLB : Created. *
- *=============================================================================================*/
-int TTFontClass::Set_YSpacing( int y )
-{
- FontYSpacing = y;
- return(y);
-}
-
-
-/***********************************************************************************************
- * TTFontClass::Print -- Print text to the surface specified. WCHAR Version. *
- * *
- * This displays text to the surface specified and with the attributes specified. *
- * *
- * INPUT: string -- The string to display to the surface. *
- * surface -- The surface to display the text upon. *
- * cliprect -- The clipping rectangle that both clips the text and biases the print *
- * location to. *
- * point -- The draw position for the upper left corner of the first character. *
- * convert -- The pixel convert object that is used to draw the correct colors to *
- * the destination surface. *
- * remap -- Auxiliary remap table for font colors. *
- * *
- * OUTPUT: Returns with the point where the next print should begin if it is to smoothly *
- * continue where this print operation left off. *
- * *
- * WARNINGS: There are two separate drawing routines; one for old fonts and one for new fonts. *
- * *
- * HISTORY: *
- * 05/26/1997 JLB : Created. *
- * 06/20/1887 BNA : Modified to handle new fonts. *
- *=============================================================================================*/
-
-#if(NDEBUG)
-
-Point2D TTFontClass::Print(
- HDC hdc,
- wchar_t const * string,
- Rect const & cliprect,
- COLORREF forecolor, /* = TEXT_COLOR, */
- COLORREF backcolor, /* = TEXT_SHADOW_COLOR, */
- TextFormatType flag, /* = TPF_DEFAULT, */
- TextShadowType shadow ) /* = TPF_FULLSHADOW */
-{
- char buffer[ _MAX_PATH ];
- int length = wcslen( string );
-
- memset( buffer, '\0', _MAX_PATH );
- WideCharToMultiByte( CodePage, 0, string, length, buffer, _MAX_PATH, NULL, NULL );
-
- return( Print( hdc, buffer, cliprect, forecolor, backcolor, flag, shadow ));
-}
-
-#else
-
-Point2D TTFontClass::Print(
- HDC hdc,
- wchar_t const * string,
- Rect const & cliprect,
- COLORREF forecolor, /* = TEXT_COLOR, */
- COLORREF backcolor, /* = TEXT_SHADOW_COLOR, */
- TextFormatType flag, /* = TPF_DEFAULT, */
- TextShadowType shadow ) /* = TPF_FULLSHADOW */
-{
- Point2D point( cliprect.X, cliprect.Y );
- RECT rect;
- HGDIOBJ old_object;
- SIZE size;
- int length = 0;
- int result = 0;
-
- //--------------------------------------------------------------------------
- // If no string, why continue?
- //--------------------------------------------------------------------------
- assert( string != NULL );
- assert( hdc != NULL );
-
- if (( string == NULL ) || ( string[0] == '\0' )) {
- return( point );
- }
-
- //--------------------------------------------------------------------------
- // Set up rectangle print regions for the "shadow" and the main color.
- //--------------------------------------------------------------------------
- length = wcslen( string );
- rect.left = cliprect.X;
- rect.top = cliprect.Y;
- rect.right = cliprect.X + cliprect.Width;
- rect.bottom = cliprect.Y + cliprect.Height;
-
- Msg( __LINE__, __FILE__, "TTFontClass::Print -- string = %s.", string );
- Msg( __LINE__, __FILE__, "TTFontClass::Print -- strlen = %d.", length );
- Msg( __LINE__, __FILE__, "TTFontClass::Print -- rect = [%d, %d, %d, %d].", rect.left, rect.top, rect.right, rect.bottom );
-// Msg( __LINE__, __FILE__, "TTFontClass::Print -- rect2 = [%d, %d, %d, %d].", rect.left, rect.top, rect.right, rect.bottom );
-
- //--------------------------------------------------------------------------
- // Print the "Shadow" depending on style desired, then the text in the requested color.
- //--------------------------------------------------------------------------
- if ( hdc ) {
-
- assert( Font != NULL );
-
- old_object = SelectObject( hdc, Font );
-
- SetTextCharacterExtra( hdc, FontXSpacing );
- SetTextAlign( hdc, TA_LEFT | TA_TOP );
- SetBkMode( hdc, TRANSPARENT );
-
- SetTextColor( hdc, forecolor );
-
-// result = ExtTextOutW(
-// hdc, // handle to DC
-// rect.left, // x-coordinate of reference point
-// rect.top, // y-coordinate of reference point
-// ETO_CLIPPED, // text-output options
-// &rect, // optional dimensions
-// string, // string
-// length, // number of characters in string
-// NULL // array of spacing values
-// );
-
-// result = TextOutW(
-// hdc, // handle to DC
-// rect.left, // x-coordinate of starting position
-// rect.top, // y-coordinate of starting position
-// string, // character string
-// length // number of characters
-// );
-
- result = DrawTextW(
- hdc,
- string,
- length,
- &rect,
- flag );
-
- GetTextExtentPointW( hdc, string, length, &size );
- SelectObject( hdc, old_object );
- }
- point.X += size.cx;
- return( point );
-}
-
-#endif
-
-/***********************************************************************************************
- * TTFontClass::Print -- Print text to the surface specified. CHAR version. *
- * *
- * This displays text to the surface specified and with the attributes specified. *
- * *
- * INPUT: string -- The string to display to the surface. *
- * surface -- The surface to display the text upon. *
- * cliprect -- The clipping rectangle that both clips the text and biases the print *
- * location to. *
- * point -- The draw position for the upper left corner of the first character. *
- * convert -- The pixel convert object that is used to draw the correct colors to *
- * the destination surface. *
- * remap -- Auxiliary remap table for font colors. *
- * *
- * OUTPUT: Returns with the point where the next print should begin if it is to smoothly *
- * continue where this print operation left off. *
- * *
- * WARNINGS: There are two separate drawing routines; one for old fonts and one for new fonts. *
- * *
- * HISTORY: *
- * 05/26/1997 JLB : Created. *
- * 06/20/1887 BNA : Modified to handle new fonts. *
- *=============================================================================================*/
-
-Point2D TTFontClass::Print(
- HDC hdc,
- char const * string,
- Rect const & cliprect,
- COLORREF forecolor, /* = TEXT_COLOR, */
- COLORREF backcolor, /* = TEXT_SHADOW_COLOR, */
- TextFormatType flag, /* = TPF_DEFAULT, */
- TextShadowType shadow ) /* = TPF_FULLSHADOW */
-{
- Point2D point( cliprect.X, cliprect.Y );
- RECT rect, rect2;
- HGDIOBJ old_object;
- SIZE size;
- int length = 0;
- int result = 0;
-
- //--------------------------------------------------------------------------
- // If no string, why continue?
- //--------------------------------------------------------------------------
- assert( string != NULL );
- assert( hdc != NULL );
-
- if (( string == NULL ) || ( string[0] == '\0' )) {
- return( point );
- }
-
- //--------------------------------------------------------------------------
- // Set up rectangle print regions for the "shadow" and the main color.
- //--------------------------------------------------------------------------
- length = strlen( string );
- rect.left = cliprect.X;
- rect.top = cliprect.Y;
- rect.right = cliprect.X + cliprect.Width;
- rect.bottom = cliprect.Y + cliprect.Height;
-
- // Shadow
- rect2.left = rect.left - 1;
- rect2.top = rect.top - 1;
- rect2.right = rect.right - 1;
- rect2.bottom= rect.bottom - 1;
-
-// Msg( __LINE__, __FILE__, "TTFontClass::Print -- strlen = %d.", length );
-// Msg( __LINE__, __FILE__, "TTFontClass::Print -- rect = [%d, %d, %d, %d].", rect.left, rect.top, rect.right, rect.bottom );
-// Msg( __LINE__, __FILE__, "TTFontClass::Print -- rect2 = [%d, %d, %d, %d].", rect.left, rect.top, rect.right, rect.bottom );
-
- //--------------------------------------------------------------------------
- // Print the "Shadow" depending on style desired, then the text in the requested color.
- //--------------------------------------------------------------------------
- if ( hdc ) {
-
- assert( Font != NULL );
-
- old_object = SelectObject( hdc, Font );
-
- SetTextCharacterExtra( hdc, FontXSpacing );
- SetTextAlign( hdc, TA_LEFT | TA_TOP );
- SetBkMode( hdc, TRANSPARENT );
- SetTextColor( hdc, backcolor );
-
- if ( shadow == TPF_SHADOW ) {
-
- // One left, One up.
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // One left.
- rect2.left = rect.left - 1;
- rect2.top = rect.top;
- rect2.right = rect.right - 1;
- rect2.bottom = rect.bottom;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // One up.
- rect2.left = rect.left;
- rect2.top = rect.top - 1;
- rect2.right = rect.right;
- rect2.bottom = rect.bottom - 1;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- } else if ( shadow == TPF_DOUBLESHADOW ) {
-
- // One left, One up.
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // One left.
- rect2.left = rect.left - 1;
- rect2.top = rect.top;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // One up.
- rect2.left = rect.left;
- rect2.top = rect.top - 1;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // Two left, Two up.
- rect2.left = rect.left - 2;
- rect2.top = rect.top - 2;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // Two left.
- rect2.left = rect.left - 2;
- rect2.top = rect.top;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // Two up.
- rect2.left = rect.left;
- rect2.top = rect.top - 2;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- } else if ( shadow == TPF_FULLSHADOW ) {
-
- // One left, One up.
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // One right, One up.
- rect2.left = rect.left + 1;
- rect2.top = rect.top - 1;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // One left, One down.
- rect2.left = rect.left - 1;
- rect2.top = rect.top + 1;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // One right, One down.
- rect2.left = rect.left + 1;
- rect2.top = rect.top + 1;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // One left.
- rect2.left = rect.left - 1;
- rect2.top = rect.top;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // One right.
- rect2.left = rect.left + 1;
- rect2.top = rect.top;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // One up.
- rect2.left = rect.left;
- rect2.top = rect.top - 1;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // One down.
- rect2.left = rect.left;
- rect2.top = rect.top + 1;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // Two right.
- rect2.left = rect.left + 2;
- rect2.top = rect.top;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // Two down.
- rect2.left = rect.left;
- rect2.top = rect.top + 2;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // Two right, One up.
- rect2.left = rect.left + 2;
- rect2.top = rect.top - 2;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // Two right, One down.
- rect2.left = rect.left + 2;
- rect2.top = rect.top + 2;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
-
- // Three right.
- rect2.left = rect.left + 3;
- rect2.top = rect.top;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // Three down.
- rect2.left = rect.left;
- rect2.top = rect.top + 3;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // Three right, One up.
- rect2.left = rect.left + 3;
- rect2.top = rect.top - 3;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
-
- // Three right, One down.
- rect2.left = rect.left + 3;
- rect2.top = rect.top + 3;
- result = DrawText( hdc, string, length, &rect2, flag );
- assert( result != 0 );
- }
-
- SetTextColor( hdc, forecolor );
- result = DrawText( hdc, string, length, &rect, flag );
- assert( result != 0 );
-
- GetTextExtentPoint( hdc, string, length, &size );
- SelectObject( hdc, old_object );
- }
- point.X += size.cx;
- return( point );
-}
-
-/***************************************************************************
- * TTFontClass::FIND_TEXT_VLENGTH -- Finds length of text in pixels *
- * *
- * INPUT: BYTE *string - the strength to find the vertical length of *
- * int width - the width of the region to fit it in *
- * *
- * OUTPUT: int -- the number of pixels it takes up veritcally. *
- * *
- * HISTORY: *
- * 09/27/1994 PWG : Created. *
- *=========================================================================*/
-//
-// [OYO] Supports DBCS ( multi-byte characters ).
-//
-int TTFontClass::Find_Text_VLength( HDC hdc, char *str, int width )
-{
- int curlen = 0;
- int lastlen = 0;
- int lines = Get_Height();
- char *letter = str;
- bool make_dc = FALSE;
- HDC localDC = hdc;
-
- if ( *str == '\0' || str == NULL ) {
- return( 0 );
- }
-
- //--------------------------------------------------------------------------
- // If no DC was passed in, then we need to get one.
- //--------------------------------------------------------------------------
- if ( localDC == NULL ) {
- return( 0 );
- }
-
- //==========================================================================
- // Process languages EXCEPT Double-byte languages.
- //==========================================================================
- if( !(IS_LANGUAGE_DBCS( LanguageID ))) {
-
- //-----------------------------------------------------------------------
- // Get the pixel length of the string.
- //-----------------------------------------------------------------------
- curlen = String_Pixel_Width( localDC, str );
- lines = 0;
-
- //-----------------------------------------------------------------------
- // If the string in longer than the width given, calculate the number of
- // lines needed in pixels (height of string in pixels ).
- //-----------------------------------------------------------------------
- if ( curlen > width ) {
-
- while( curlen > 0 ) {
- if ( curlen > width ) {
- curlen -= width;
- } else {
- curlen = 0;
- }
- lines += Get_Height();
- }
-
- } else {
- lines = Get_Height();
- }
-
- //-----------------------------------------------------------------------
- // Check for any newlines. Add one line per newline.
- //-----------------------------------------------------------------------
- letter = str;
- while ( *letter ) {
- if ( *letter == '\n') {
- lines += Get_Height();
- }
- letter++;
- }
-
- } else {
-
- //=======================================================================
- // Process Double-Byte language text.
- //=======================================================================
- int i, n, wspc;
- UINT c;
- int fdbcs = IsFontDBCS();
-
- lines = 0;
-
- //-----------------------------------------------------------------------
- // For each word...
- //-----------------------------------------------------------------------
- while ( n = nGetWord( letter, fdbcs )) {
-
- //--------------------------------------------------------------------
- // For each character in the word...
- //--------------------------------------------------------------------
- for ( c=0, wspc=0, curlen=0, i=0; i < n; i++ ) {
-
- if ( c ) {
- //--------------------------------------------------------------
- // Double-byte character.
- //--------------------------------------------------------------
- c = ( c<<8 )|(UINT)(BYTE)letter[i];
- curlen += Char_Pixel_Width( localDC, c ) + wspc;
- c = 0;
- wspc = 0;
-
- } else if( fdbcs && IsDBCSLeadByte((BYTE)letter[i])) {
- //--------------------------------------------------------------
- // First half of a Double-byte character.
- //--------------------------------------------------------------
- c = (UINT)(BYTE)letter[i];
-
- } else if((BYTE)letter[i] > ' ' ) {
- //--------------------------------------------------------------
- // Single-byte character.
- //--------------------------------------------------------------
- curlen += Char_Pixel_Width( localDC, (UINT)(BYTE)letter[i] ) + wspc;
- wspc = 0;
-
- } else if( letter[i] == ' ') {
- //--------------------------------------------------------------
- // Space character.
- //--------------------------------------------------------------
- wspc += Char_Pixel_Width( localDC, ' ' );
- }
- } // end-of-for
-
- //--------------------------------------------------------------------
- //
- //--------------------------------------------------------------------
- if( lastlen + curlen > width ) {
- lines += Get_Height();
- lastlen = 0;
- }
-
- //--------------------------------------------------------------------
- // !!! If one block length bigger than available width,
- // next line will be overflow. but never endless loop. !!!
- //--------------------------------------------------------------------
- lastlen += curlen + wspc;
-
- //--------------------------------------------------------------------
- //
- //--------------------------------------------------------------------
- if( letter[i] == '\n' ) {
- lines += Get_Height();
- lastlen = 0;
- }
- letter += n;
-
- } // end-of-while
-
- //-----------------------------------------------------------------------
- // Left over, add a line.
- //-----------------------------------------------------------------------
- if( lastlen ) {
- lines += Get_Height();
- }
- }
-
- //--------------------------------------------------------------------------
- // Return the number of lines.
- //--------------------------------------------------------------------------
- if ( !lines ) {
- lines = Get_Height();
- }
- return( lines );
-}
-
-/***********************************************************************************************
- * FontManagerClass::FontManagerClass -- Constructor for FontManager class. *
- * *
- * INPUT: none. *
- * *
- * OUTPUT: none *
- * *
- * WARNINGS: none *
- * *
- * HISTORY: *
- * 03/26/1998 MML : Created. *
- *=============================================================================================*/
-FontManagerClass::FontManagerClass ( HDC hdc )
-{
- //--------------------------------------------------------------------------
- // Open a DC to the BackBuffer.
- //--------------------------------------------------------------------------
- if ( hdc ) {
-
- char szPath[ MAX_PATH ];
- char szFile[ MAX_PATH ];
- char szFacename[ MAX_PATH ];
- char drive[ _MAX_DRIVE ];
- char dir[ _MAX_DIR ];
- bool b640X480 = false;
- RECT rect; // Desktop Window ( used once ).
-
- strcpy( szFile, "Arial.ttf" );
- strcpy( szFacename, "Arial" );
-
- strcpy( szPath, Args->Get_argv(0));
- _splitpath( szPath, drive, dir, NULL, NULL );
- _makepath( szPath, drive, dir, "Setup\\Setup", ".ini" );
-
- GetPrivateProfileString( "Fonts", "Font", "Arial.tff", szFile, MAX_PATH, szPath );
- GetPrivateProfileString( "Fonts", "Fontname", "Arial", szFacename, MAX_PATH, szPath );
-
- //---------------------------------------------------------------------
- // Use codepage set by Locomoto class.
- //---------------------------------------------------------------------
- UINT codepage = CodePage; // GetACP();
-
- GetClientRect( GetDesktopWindow(), &rect );
- if( rect.right <= 640 ) {
- b640X480 = TRUE;
- }
-
- Msg( __LINE__, __FILE__, "FontManagerClass -- szFile = %s, szFilename = %s.", szFile, szFacename );
-
- //---------------------------------------------------------------------
- // Create the True Type Fonts.
- //
- // Value Weight
- // ____________________________
- // FW_DONTCARE 0
- // FW_THIN 100
- // FW_EXTRALIGHT 200
- // FW_ULTRALIGHT 200
- // FW_LIGHT 300
- // FW_NORMAL 400
- // FW_REGULAR 400
- // FW_MEDIUM 500
- // FW_SEMIBOLD 600
- // FW_DEMIBOLD 600
- // FW_BOLD 700
- // FW_EXTRABOLD 800
- // FW_ULTRABOLD 800
- // FW_HEAVY 900
- // FW_BLACK 900
- //---------------------------------------------------------------------
-
- switch( LanguageID ) { // [OYO] Add this line if you wish to support another languages
-
- //=================================================================
- // JAPANESE
- //=================================================================
- case LANG_JAP: // [OYO] Use MS PGothic for Japanese Win9x
-
- if( codepage == 932 ) {
-
- strcpy( szFile, "MSGothic.ttc" );
- strcpy( szFacename, "MS PGothic" );
-
- TTButtonFontPtr = new TTFontClass( hdc, szFile, szFacename, 20, FW_NORMAL, SHIFTJIS_CHARSET );
- TTButtonFontPtrSmall= new TTFontClass( hdc, szFile, szFacename, 12, FW_NORMAL, SHIFTJIS_CHARSET );
-
- TTTextFontPtr = new TTFontClass( hdc, szFile, szFacename, 16, FW_MEDIUM, SHIFTJIS_CHARSET );
- TTTextFontPtr640 = new TTFontClass( hdc, szFile, szFacename, 14, FW_MEDIUM, SHIFTJIS_CHARSET );
- TTTextFontPtr800 = new TTFontClass( hdc, szFile, szFacename, 14, FW_MEDIUM, SHIFTJIS_CHARSET );
- TTLicenseFontPtr = new TTFontClass( hdc, szFile, szFacename, 12, FW_NORMAL, SHIFTJIS_CHARSET );
- }
- break;
-
- //=================================================================
- // KOREAN
- //=================================================================
- case LANG_KOR: // [OYO] Use GulimChe for Korean Win9x
-
- if ( codepage == 949 ) {
-
- strcpy( szFile, "Gulim.tff" );
- strcpy( szFacename, "Gulim" );
-
- TTButtonFontPtr = new TTFontClass( hdc, szFile, szFacename, 20, FW_NORMAL, HANGEUL_CHARSET );
- TTButtonFontPtrSmall= new TTFontClass( hdc, szFile, szFacename, 20, FW_NORMAL, HANGEUL_CHARSET );
-
- TTTextFontPtr = new TTFontClass( hdc, szFile, szFacename, 16, FW_MEDIUM, HANGEUL_CHARSET );
- TTTextFontPtr640 = new TTFontClass( hdc, szFile, szFacename, 14, FW_MEDIUM, HANGEUL_CHARSET );
- TTTextFontPtr800 = new TTFontClass( hdc, szFile, szFacename, 14, FW_MEDIUM, HANGEUL_CHARSET );
- TTLicenseFontPtr = new TTFontClass( hdc, szFile, szFacename, 12, FW_NORMAL, HANGEUL_CHARSET );
- }
- break;
-
- //=================================================================
- // CHINESE
- //=================================================================
- case LANG_CHI:
-
- if ( codepage == 950 ) {
-
- strcpy( szFile, "mingliu.ttc" );
- strcpy( szFacename, "mingliu" );
-
- TTButtonFontPtr = new TTFontClass( hdc, szFile, szFacename, 20, FW_NORMAL, CHINESEBIG5_CHARSET );
- TTButtonFontPtrSmall= new TTFontClass( hdc, szFile, szFacename, 14, FW_NORMAL, CHINESEBIG5_CHARSET );
-
- TTTextFontPtr = new TTFontClass( hdc, szFile, szFacename, 16, FW_MEDIUM, CHINESEBIG5_CHARSET );
- TTTextFontPtr640 = new TTFontClass( hdc, szFile, szFacename, 14, FW_MEDIUM, CHINESEBIG5_CHARSET );
- TTTextFontPtr800 = new TTFontClass( hdc, szFile, szFacename, 14, FW_MEDIUM, CHINESEBIG5_CHARSET );
- TTLicenseFontPtr = new TTFontClass( hdc, szFile, szFacename, 12, FW_NORMAL, CHINESEBIG5_CHARSET );
- }
- break;
-
- //=================================================================
- // ENGLISH, FRENCH, GERMAN
- //=================================================================
- case LANG_GER:
- case LANG_FRE:
- case LANG_USA:
- default:
-
- TTButtonFontPtr = new TTFontClass( hdc, szFile, szFacename, 22, FW_SEMIBOLD, ANSI_CHARSET, 0, 0, 0, FALSE );
-
- if( LANG_FRE == LanguageID ) {
- TTButtonFontPtrSmall= new TTFontClass( hdc, szFile, szFacename, 20, FW_SEMIBOLD, ANSI_CHARSET, 0, 0, 0, FALSE );
- } else {
- TTButtonFontPtrSmall= new TTFontClass( hdc, szFile, szFacename, 22, FW_SEMIBOLD, ANSI_CHARSET, 0, 0, 0, FALSE );
- }
-
- TTTextFontPtr = new TTFontClass( hdc, szFile, szFacename, 16, FW_SEMIBOLD, ANSI_CHARSET, 0, 0, 0, FALSE );
- TTTextFontPtr640 = new TTFontClass( hdc, szFile, szFacename, 14, FW_SEMIBOLD, ANSI_CHARSET, 0, 0, 0, FALSE );
- TTTextFontPtr800 = new TTFontClass( hdc, szFile, szFacename, 14, FW_SEMIBOLD, ANSI_CHARSET, 0, 0, 0, FALSE );
- TTLicenseFontPtr = new TTFontClass( hdc, szFile, szFacename, 12, FW_MEDIUM, ANSI_CHARSET, 0, 0, 0, FALSE );
- break;
- }
-
- //----------------------------------------------------------------------
- // If we fell through...
- //----------------------------------------------------------------------
- if( TTButtonFontPtr == NULL || TTTextFontPtr == NULL ) {
-
- strcpy( szFile, "Arial.tff" );
- strcpy( szFacename, "Arial" );
-
- if( TTButtonFontPtr == NULL ) {
- TTButtonFontPtr = new TTFontClass( hdc, szFile, szFacename, 22, FW_SEMIBOLD, ANSI_CHARSET, 0, 0, 0, FALSE );
- }
- if( TTButtonFontPtrSmall == NULL ) {
- TTButtonFontPtrSmall= new TTFontClass( hdc, szFile, szFacename, 22, FW_SEMIBOLD, ANSI_CHARSET, 0, 0, 0, FALSE );
- }
- if( TTTextFontPtr == NULL ) {
- TTTextFontPtr = new TTFontClass( hdc, szFile, szFacename, 16, FW_SEMIBOLD, ANSI_CHARSET, 0, 0, 0, FALSE );
- }
- if( TTTextFontPtr640 == NULL ) {
- TTTextFontPtr640 = new TTFontClass( hdc, szFile, szFacename, 14, FW_SEMIBOLD, ANSI_CHARSET, 0, 0, 0, FALSE );
- }
- if( TTTextFontPtr800 == NULL ) {
- TTTextFontPtr800 = new TTFontClass( hdc, szFile, szFacename, 14, FW_SEMIBOLD, ANSI_CHARSET, 0, 0, 0, FALSE );
- }
- if( TTLicenseFontPtr == NULL ) {
- TTLicenseFontPtr = new TTFontClass( hdc, szFile, szFacename, 12, FW_MEDIUM, ANSI_CHARSET, 0, 0, 0, FALSE );
- }
- }
- }
- assert( TTTextFontPtr != NULL );
- assert( TTTextFontPtr640 != NULL );
- assert( TTTextFontPtr800 != NULL );
- assert( TTButtonFontPtr != NULL );
- assert( TTButtonFontPtrSmall != NULL );
- assert( TTLicenseFontPtr != NULL );
-}
-
-/***********************************************************************************************
- * FontManagerClass::~FontManagerClass -- Destructor for FontManager class. *
- * *
- * INPUT: none. *
- * *
- * OUTPUT: none *
- * *
- * WARNINGS: none *
- * *
- * HISTORY: *
- * 03/26/1998 MML : Created. *
- *=============================================================================================*/
-FontManagerClass::~FontManagerClass ( void )
-{
- if ( TTButtonFontPtr != NULL ) {
- delete TTButtonFontPtr;
- TTButtonFontPtr = NULL;
- }
- if ( TTTextFontPtr != NULL ) {
- delete TTTextFontPtr;
- TTTextFontPtr = NULL;
- }
-}
-
-
-/***********************************************************************************************
- * Font_From_TPF -- Convert flags into a font pointer. *
- * *
- * This routine will examine the specified flags and return with a pointer to the font *
- * that the flags represent. *
- * *
- * INPUT: flags -- The flags to convert into a font pointer. *
- * *
- * OUTPUT: Returns with a font pointer that matches the flags. *
- * *
- * WARNINGS: If no match could be found, a default font pointer is returned. *
- * *
- * HISTORY: *
- * 05/26/1997 JLB : Created. *
- *=============================================================================================*/
-TTFontClass * Font_From_TPF ( TextPrintType flags )
-{
- TTFontClass *fontptr= NULL;
-
- switch (flags & 0x000F) {
-
- case TPF_BUTTON_FONT:
- fontptr = TTButtonFontPtr;
- break;
-
- case TPF_TEXT_FONT:
- fontptr = TTTextFontPtr;
- break;
-
- default:
- fontptr = TTTextFontPtr;
- break;
- }
- return( fontptr );
-}
-
-
-/************************************************************************************************
- * Is_True_Type_Font -- Convert flags into a font pointer. *
- * *
- * This routine will examine the specified flags and return with a pointer to the font *
- * that the flags represent. *
- * *
- * INPUT: flags -- The flags to convert into a font pointer. *
- * *
- * OUTPUT: Returns with a font pointer that matches the flags. *
- * *
- * WARNINGS: If no match could be found, a default font pointer is returned. *
- * *
- * HISTORY: *
- * 05/26/1997 JLB : Created. *
- *==============================================================================================*/
-
-bool Is_True_Type_Font( TextPrintType flags )
-{
- if (( flags == TPF_BUTTON_FONT ) || ( flags == TPF_TEXT_FONT )) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-
-
diff --git a/Generals/Code/Tools/Autorun/TTFont.h b/Generals/Code/Tools/Autorun/TTFont.h
deleted file mode 100644
index 40e493d64b5..00000000000
--- a/Generals/Code/Tools/Autorun/TTFont.h
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/************************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ************************************************************************************************
- * *
- * Project Name: Setup *
- * *
- * Archive: ttfont.h *
- * *
- * Author: Joe_b *
- * *
- * Modtime: 6/23/97 3:14p *
- * *
- * Updated: 08/01/2000 [MML] *
- * *
- * Revision: 22 *
- * *
- *----------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-#pragma once
-
-#ifndef TTFONT_H
-#define TTFONT_H
-
-#include
-#include "POINT.h"
-#include "RECT.h"
-
-
-/******************************************************************************
-** These are the control flags for Fancy_Text_Print function.
-*/
-typedef enum TextPrintType {
-
- TPF_LASTPOINT = 0x0000, // Use previous font point value.
- TPF_TT_10POINT = 0x0001, // True Type Font - 10 point
- TPF_TT_12POINT = 0x0002, // True Type Font - 12 point
- TPF_TT_14POINT = 0x000A, // True Type Font - 14 point
- TPF_TT_16POINT = 0x000B, // True Type Font - 16 point
- TPF_TT_18POINT = 0x000C, // True Type Font - 18 point
- TPF_TT_20POINT = 0x000D, // True Type Font - 20 point
- TPF_TT_22POINT = 0x000E, // True Type Font - 22 point
- TPF_TT_24POINT = 0x000F, // True Type Font - 24 point
-
- TPF_BUTTON_FONT = 0x0010,
- TPF_TEXT_FONT = 0x0020,
-
-} TextPrintType;
-
-typedef enum TextShadowType {
-
- TPF_NOSHADOW = 0x0000,
- TPF_DROPSHADOW = 0x0001, // Use a simple drop shadow.
- TPF_LIGHTSHADOW = 0x0002,
- TPF_FULLSHADOW = 0x0004, // Use a full outline shadow.
- TPF_DOUBLESHADOW = 0x0008, // Use a simple drop shadow.
- TPF_SHADOW = 0x0010, // Print twice, using backcolor.
-
-} TextShadowType;
-
-typedef enum TextFormatType {
-
- TPF_TOP = DT_TOP, // Use with DT_SINGLELINE. Top-justifies text.
- TPF_VCENTER = DT_VCENTER, // Use with DT_SINGLELINE. Centers text vertically.
- TPF_BOTTOM = DT_BOTTOM, // Use with DT_SINGLELINE. Justifies test to the bottom of the rectangle.
- TPF_LEFT = DT_LEFT, // Aligns text to the left.
- TPF_CENTER = DT_CENTER, // Centers text horizontally in the rectangle.
- TPF_RIGHT = DT_RIGHT, // Right justify text.
- TPF_WORDBREAK = DT_WORDBREAK, // Lines are automatically broken between words.
- TPF_SINGLE_LINE = DT_SINGLELINE, // All text on one line only.
- TPF_NO_PREFIX = DT_NOPREFIX, // Turns off processing of prefix characters.
- TPF_PATH_ELLIPSIS = DT_PATH_ELLIPSIS, // For displayed text, replaces characters in the middle of the string with ellipses so that the result fits in the specified rectangle.
-
-} TextFormatType;
-
-/******************************************************************************
-** Standard button text print flags.
-*/
-//#define TPF_BUTTON (TextFormatType)( DT_VCENTER | DT_CENTER | DT_SINGLELINE )
-//#define TPF_CENTER_FORMAT (TextFormatType)( DT_VCENTER | DT_CENTER | DT_WORDBREAK )
-//#define TPF_CHECKBOX (TextFormatType)( DT_LEFT | DT_VCENTER | DT_WORDBREAK )
-//#define TPF_EDIT (TextFormatType)( DT_LEFT | DT_VCENTER )
-//#define TPF_DEFAULT (TextFormatType)( DT_LEFT | DT_WORDBREAK )
-
-#define TPF_BUTTON (TextFormatType)( DT_CENTER | DT_VCENTER | DT_SINGLELINE )
-#define TPF_EDITBOX (TextFormatType)( DT_LEFT | DT_VCENTER | DT_SINGLELINE )
-#define TPF_RADIO (TextFormatType)( DT_LEFT | DT_WORDBREAK )
-#define TPF_CHECKBOX (TextFormatType)( DT_LEFT | DT_WORDBREAK )
-#define TPF_OUTER_SCROLL (TextFormatType)( DT_LEFT | DT_WORDBREAK )
-#define TPF_INNER_SCROLL (TextFormatType)( DT_LEFT | DT_SINGLELINE )
-
-#define TPF_LEFT_TEXT (TextFormatType)( DT_LEFT | DT_WORDBREAK )
-#define TPF_CENTER_TEXT (TextFormatType)( DT_CENTER | DT_WORDBREAK )
-#define TPF_RIGHT_TEXT (TextFormatType)( DT_RIGHT | DT_WORDBREAK )
-
-#define TPF_LEFT_TOP_ALIGNMENT (TextFormatType)( DT_LEFT | DT_TOP | DT_SINGLELINE )
-#define TPF_LEFT_BOTTOM_ALIGNMENT (TextFormatType)( DT_LEFT | DT_BOTTOM | DT_SINGLELINE )
-#define TPF_LEFT_JUSTIFY (TextFormatType)( DT_LEFT | DT_VCENTER | DT_SINGLELINE )
-
-#define TPF_RIGHT_TOP_ALIGNMENT (TextFormatType)( DT_RIGHT | DT_TOP | DT_SINGLELINE )
-#define TPF_RIGHT_BOTTOM_ALIGNMENT (TextFormatType)( DT_RIGHT | DT_BOTTOM | DT_SINGLELINE )
-#define TPF_RIGHT_JUSTIFY (TextFormatType)( DT_RIGHT | DT_VCENTER | DT_SINGLELINE )
-
-#define TPF_CENTER_TOP_ALIGNMENT (TextFormatType)( DT_CENTER | DT_TOP | DT_SINGLELINE )
-#define TPF_CENTER_BOTTOM_ALIGNMENT (TextFormatType)( DT_CENTER | DT_BOTTOM | DT_SINGLELINE )
-#define TPF_CENTER_JUSTIFY (TextFormatType)( DT_CENTER | DT_VCENTER | DT_SINGLELINE )
-
-
-
-/******************************************************************************
-** These are the control flags for Fancy_Text_Print function.
-*/
-typedef enum SpecialEffectType {
- TPF_NONE =0x0000, // No special effects needed.
- TPF_CUTOFF_AT_WIDTH =0x0001, // Don't print past the allowed width.
- TPF_BURST_MODE =0x0002, // Print text one letter at a time like a typewriter.
- TPF_SPECIAL_WRAP =0x0003, // Begin at a specified point but start next line at a point before the starting point.
-} SpecialEffectType;
-
-
-/******************************************************************************
-** Global DC. Use it or create your own!
-*/
-extern HDC BackBufferDC;
-
-/******************************************************************************
-** Global Colors for use throughout program.
-*/
-extern unsigned long TEXT_COLOR;
-extern unsigned long SHADOW_COLOR;
-extern unsigned long TEXT_NORMAL_COLOR;
-extern unsigned long TEXT_FOCUSED_COLOR;
-extern unsigned long TEXT_PRESSED_COLOR;
-extern unsigned long TEXT_NORMAL_SHADOW_COLOR;
-extern unsigned long TEXT_FOCUSED_SHADOW_COLOR;
-extern unsigned long TEXT_PRESSED_SHADOW_COLOR;
-
-extern unsigned long WHITE_COLOR;
-extern unsigned long BLACK_COLOR;
-extern unsigned long RED_COLOR;
-extern unsigned long ORANGE_COLOR;
-extern unsigned long YELLOW_COLOR;
-extern unsigned long GREEN_COLOR;
-extern unsigned long BLUE_COLOR;
-extern unsigned long INDIGO_COLOR;
-extern unsigned long VIOLET_COLOR;
-
-
-/******************************************************************************
-** This is a True Type Font class object to create and use True Type fonts.
-******************************************************************************/
-// Font Weight - Specifies the weight of the font in the range 0 through 1000.
-// For example, 400 is normal and 700 is bold.
-// If this value is zero, a default weight is used.
-//
-// The following values are defined for convenience:
-// FW_DONTCARE 0 FW_SEMIBOLD 600
-// FW_THIN 100 FW_DEMIBOLD 600
-// FW_EXTRALIGHT 200 FW_BOLD 700
-// FW_ULTRALIGHT 200 FW_EXTRABOLD 800
-// FW_LIGHT 300 FW_ULTRABOLD 800
-// FW_NORMAL 400 FW_HEAVY 900
-// FW_REGULAR 400 FW_BLACK 900
-// FW_MEDIUM 500
-//-----------------------------------------------------------------------------
-
-class TTFontClass
-{
- public:
-
- TTFontClass (
- HDC hdc,
- char * filename,
- char * facename,
- int height,
- int weight = FW_NORMAL,
- BYTE charset = ANSI_CHARSET,
- int width = 0,
- int escapement = 0,
- int orientation = 0,
- BYTE italic = FALSE,
- BYTE underline = FALSE,
- BYTE strikeout = FALSE,
- BYTE outputPrecision = OUT_TT_ONLY_PRECIS,
- BYTE clipPrecision = CLIP_DEFAULT_PRECIS,
- BYTE quality = PROOF_QUALITY,
- BYTE pitchAndFamily = FF_DONTCARE );
-
- virtual ~TTFontClass(void)
- {
- if ( Font != NULL ) {
- DeleteObject( Font );
- Font = NULL;
- }
- RemoveFontResource( szFilename );
- };
-
- virtual int Char_Pixel_Width ( HDC hdc, UINT c ) const;
- virtual int Char_Pixel_Width ( HDC hdc, char const * string, int *num_bytes=NULL ) const;
- virtual int String_Pixel_Width ( HDC hdc, char const * string ) const;
- virtual void String_Pixel_Bounds ( HDC hdc, const char * string, Rect& bounds ) const;
- virtual int Get_Width ( void ) const;
- virtual int Get_Height ( void ) const;
- virtual int Set_XSpacing ( HDC hdc, int x );
- virtual int Set_YSpacing ( int y );
- virtual int Find_Text_VLength ( HDC hdc, char *str, int width );
- virtual HFONT Get_Font_Ptr ( void ) { return Font; };
- virtual int IsFontDBCS ( void ) const { return ((CharSet==SHIFTJIS_CHARSET)||(CharSet==HANGEUL_CHARSET)||(CharSet==CHINESEBIG5_CHARSET)); }; // [OYO]
- virtual UINT Get_Double_Byte_Char ( const char *string, int *num_bytes=NULL ) const;
-
- virtual Point2D Print(
- HDC hdc,
- char const * string,
- Rect const & cliprect,
- COLORREF forecolor = TEXT_COLOR,
- COLORREF backcolor = TEXT_NORMAL_SHADOW_COLOR,
- TextFormatType flag = TPF_LEFT_TEXT,
- TextShadowType shadow = TPF_NOSHADOW );
-
- virtual Point2D Print(
- HDC hdc,
- wchar_t const * string,
- Rect const & cliprect,
- COLORREF forecolor = TEXT_COLOR,
- COLORREF backcolor = TEXT_NORMAL_SHADOW_COLOR,
- TextFormatType flag = TPF_LEFT_TEXT,
- TextShadowType shadow = TPF_NOSHADOW );
-
- private:
-
- HFONT Font;
- long Height;
- long Ascent;
- long Descent;
- long InternalLeading;
- long ExternalLeading;
- long AveCharWidth;
- long MaxCharWidth;
- long Overhang;
- long Italic;
- long Underlined;
- long StruckOut;
- int CharSet; // [OYO]
- int FontXSpacing; // GetTextCharacterExtra;
- int FontYSpacing;
- char szFacename[ MAX_PATH ];
- char szFilename[ MAX_PATH ];
-};
-
-
-//-------------------------------------------------------------------------
-// Global functions.
-//-------------------------------------------------------------------------
-TTFontClass * Font_From_TPF ( TextPrintType flags ); // Returns FontPtr based on flags passed in.
-bool Is_True_Type_Font ( TextPrintType flags ); // True Type???
-
-//-------------------------------------------------------------------------
-// This class is a wrapper around all the fonts that we want to be available.
-// The constructer will make them, and the destructor will remove them for us.
-//-------------------------------------------------------------------------
-class FontManagerClass
-{
- public:
- FontManagerClass ( HDC hdc );
- ~FontManagerClass ( void );
- TTFontClass * Get_Font ( TextPrintType flags ) { return( Font_From_TPF( flags )); };
-};
-
-
-/******************************************************************************
-** FontManager Class Pointer.
-*/
-extern FontManagerClass *FontManager;
-
-/******************************************************************************
-** Loaded data file pointers.
-*/
-extern TTFontClass *TTButtonFontPtr;
-extern TTFontClass *TTButtonFontPtrSmall;
-extern TTFontClass *TTTextFontPtr;
-extern TTFontClass *TTTextFontPtr640;
-extern TTFontClass *TTTextFontPtr800;
-extern TTFontClass *TTLicenseFontPtr;
-
-
-#endif
diff --git a/Generals/Code/Tools/Autorun/Utils.cpp b/Generals/Code/Tools/Autorun/Utils.cpp
deleted file mode 100644
index d9a185d9b5a..00000000000
--- a/Generals/Code/Tools/Autorun/Utils.cpp
+++ /dev/null
@@ -1,669 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/****************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ****************************************************************************
- * *
- * Project Name : Setup *
- * *
- * File Name : UTILS.C *
- * *
- * Programmers: Maria del Mar McCready Legg *
- * *
- * Start Date : December 12, 1992 *
- * *
- * Last Update : March 16, 1998 [MML] *
- * *
- *--------------------------------------------------------------------------*
- * Functions: *
- * *
- * Clip_Line_To_Rect -- Clips a line (two points) against a *
- * rectangle, using CS algorithm. *
- * Compute_Code -- computes line clipping bit code for *
- * point & rectangle. *
- * Copy_File -- Copies a file from one dir to another. *
- * Convert_Hex_To_Version -- Converts a hex num obtained from the *
- * Registry, into a string *
- * representation of a version *
- * number ( XX.XX ). *
- * Convert_Version_To_Hex -- Converts a string to an unsigned long. *
- * Convert_To_Version_Format -- Converts version string's "," to "."s *
- * Dialog_Box -- draws a dialog background box *
- * Draw_Box -- Displays a highlighted box. *
- * Fatal -- General purpose fatal error handler. *
- * Get_Version -- Retrieves a version string from a file. *
- * Get_String -- Returns a pointer to the undipped text. *
- * Is_File_Available -- Use both FindFirst to check that CD is *
- * in drive & if File_Exists() to *
- * determine if file is really there. *
- * Pad_With_Zeros -- Adds zeros to the beginning of string. *
- * String_Width -- Calculate with of the string. *
- * Strip_Newlines -- Remove '\r' from string passed in. *
- * TextPtr -- Returns a pointer to the undipped text. *
- * Path_Name_Valid -- Validate that the path has the correct *
- * number of chars between '\' in the *
- * path. *
- * Path_Get_Next_Directory -- Return the next dir path from string. *
- * Path_Add_Back_Slash -- Add a "\\" to the end of the string. *
- * Path_Remove_Back_Slash -- Remove a '\\' at the end of the string. *
- * Path_Trim_Blanks -- Trim lead/trail white spaces off string *
- * Pad_With_Zeros -- Adds zeros to the beginning of string. *
- * Remove_Ending_Spaces -- Remove any blank spaces at end of string*
- * Remove_Spaces -- Remove spaces from string passed in. *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-
-#include
-#include "ARGS.H"
-#include "assert.h"
-#include "Locale_API.h"
-#include "resource.h"
-#include "Utils.h"
-#include "WinFix.H"
-#include "Wnd_File.h"
-#include
-#include
-//#include "resources.h"
-
-
-
-//----------------------------------------------------------------------------
-//
-// Function: Fix_Single_Ampersands()
-//
-// Purpose: To replace each "&" with "&&" for display in a dialog.
-// Some dialogs mistake a single "&" for an accelerator key.
-//
-// Input: pszString - any NULL terminated string.
-//
-// Returns: VOID (returns nothing)
-//
-// Comments: Modifies the characters in pszString.
-//
-//---------------------------------------------------------------------------
-
-void Fix_Single_Ampersands ( LPSTR pszString, bool upper_case )
-{
- char pszTemp[ MAX_PATH ]; // variable to hold the string passed
- char pszOld[ MAX_PATH ]; // variable to hold the string passed
- char * letter;
- int i = 0;
-
- lstrcpy((LPSTR)pszOld, (LPSTR)pszString );
- letter = pszOld;
- memset ( pszTemp, '\0', MAX_PATH );
-
- //----------------------------------------------------------------------
- // While our ptr has not passed the end of the string...
- //----------------------------------------------------------------------
- while (*letter != '\0') {
-
- if (*letter == '&') {
-
- pszTemp[i++] = '&';
- pszTemp[i++] = '&';
- letter++;
-
- } else {
-
- if ( upper_case ) {
- pszTemp[i++] = (char) toupper( *( letter++ ));
- } else {
- pszTemp[i++] = *(letter++);
- }
- }
- }
- strcpy((LPSTR)pszString, (LPSTR)pszTemp );
-}
-
-void Fix_Single_Ampersands ( wchar_t *pszString, bool upper_case )
-{
- wchar_t pszTemp[ MAX_PATH ]; // variable to hold the string passed
- wchar_t pszOld[ MAX_PATH ]; // variable to hold the string passed
- wchar_t *letter;
- int i = 0;
-
- wcscpy( pszOld, pszString );
- letter = pszOld;
- memset ( pszTemp, '\0', MAX_PATH );
-
- //----------------------------------------------------------------------
- // While our ptr has not passed the end of the string...
- //----------------------------------------------------------------------
- while (*letter != '\0') {
-
- if (*letter == '&') {
-
- pszTemp[i++] = '&';
- pszTemp[i++] = '&';
- letter++;
-
- } else {
-
- if ( upper_case ) {
- pszTemp[i++] = (char) toupper( *( letter++ ));
- } else {
- pszTemp[i++] = *(letter++);
- }
- }
- }
- wcscpy( pszString, pszTemp );
-}
-
-////////////////UnicodeString Fix_Single_Ampersands( UnicodeString string, bool upper_case)
-////////////////{
-//////////////// UnicodeString retval;
-////////////////
-//////////////// Int i = 0;
-//////////////// while (i < string.getLength()) {
-//////////////// if (upper_case) {
-//////////////// retval.concat(toupper(string.getCharAt(i)));
-//////////////// } else {
-//////////////// retval.concat(string.getCharAt(i));
-//////////////// }
-//////////////// if (string.getCharAt(i) == L'&') {
-//////////////// retval.concat(string.getCharAt(i));
-//////////////// }
-//////////////// ++i;
-//////////////// }
-////////////////
-//////////////// return retval;
-////////////////}
-
-//----------------------------------------------------------------------------
-//
-// Function: Fix_Double_Ampersands()
-//
-// Purpose: To replace each "&&" with "&" for display in a dialog.
-// Some dialogs mistake a single "&" for an accelerator key.
-//
-// Input: pszString - any NULL terminated string.
-//
-// Returns: VOID (returns nothing)
-//
-// Comments: Modifies the characters in pszString.
-//
-//---------------------------------------------------------------------------
-
-void Fix_Double_Ampersands ( LPSTR pszString, bool upper_case )
-{
- char pszTemp[ MAX_PATH ]; // variable to hold the string passed
- char pszOld[ MAX_PATH ]; // variable to hold the string passed
- char *letter;
- int i = 0;
-
- lstrcpy( (LPSTR)pszOld, (LPSTR)pszString );
- letter = pszOld;
- memset ( pszTemp, '\0', MAX_PATH );
-
- //----------------------------------------------------------------------
- // While our ptr has not passed the end of the string...
- //----------------------------------------------------------------------
- while (*letter != '\0') {
-
- if ((*letter == '&') && (*( letter+1 ) == '&')) {
-
- pszTemp[i++] = '&';
- letter = letter + 2;
-
- } else {
-
- if ( upper_case ) {
- pszTemp[i++] = (char) toupper( *( letter++ ));
- } else {
- pszTemp[i++] = *(letter++);
- }
- }
- }
- strcpy((LPSTR)pszString, (LPSTR)pszTemp );
-}
-
-
-/******************************************************************************
- * Load_Alloc_Data -- Allocates a buffer and loads the file into it. *
- * *
- * This is the C++ replacement for the Load_Alloc_Data function. It will *
- * allocate the memory big enough to hold the file & read the file into it. *
- * *
- * INPUT: file -- The file to read. *
- * mem -- The memory system to use for allocation. *
- * *
- * OUTPUT: Returns with a pointer to the allocated and filled memory block. *
- * *
- * WARNINGS: none *
- * *
- * HISTORY: *
- * 10/17/1994 JLB : Created. *
- *============================================================================*/
-
-void * Load_Alloc_Data( char *filename, long *filesize )
-{
- int size, bytes_read;
- void *ptr = NULL;
- StandardFileClass file;
-
- //-------------------------------------------------------------------------
- // Open file in READ ONLY mode. If fails, exit.
- //-------------------------------------------------------------------------
- file.Open( filename, MODE_READ_ONLY );
- if ( !file.Query_Open()) {
- return( NULL );
- }
-
- //-------------------------------------------------------------------------
- // Get filesize and create a buffer.
- //-------------------------------------------------------------------------
- size = file.Query_Size();
- ptr = (void*)malloc(size + 1);
- if ( !ptr ) {
- return( NULL );
- }
-
- //-------------------------------------------------------------------------
- // Read data into the buffer, close the file.
- //-------------------------------------------------------------------------
- memset( ptr, '\0', size + 1 );
- bytes_read = file.Read( ptr, size );
- file.Close();
-
- //-------------------------------------------------------------------------
- // Check return bytes. It should match the file size.
- //-------------------------------------------------------------------------
- assert( bytes_read == size );
- if ( bytes_read != size ) {
- free(ptr);
- return( NULL );
- }
-
- if ( filesize != NULL ) {
- *filesize = (long)size;
- }
- return( ptr );
-}
-
-/****************************************************************************
- * MIXFILECLASS::LOAD_FILE -- Returns a buffer loaded with file desired. *
- * *
- * INPUT: none. * *
- * *
- * OUTPUT: none. *
- * *
- * WARNINGS: Searches MixFile first, then local directory. *
- * Use free() to release buffer. * *
- * *
- * HISTORY: *
- * 04/13/1998 ML/MG : Created. *
- *==========================================================================*/
-
-void *Load_File ( char *filename, long *filesize )
-{
- void *ptr = NULL;
-
- if ( filename == NULL || filename[0] == '\0' ) {
- return( NULL );
- }
-
- //-------------------------------------------------------------------------
- // Try loading from local directory.
- //-------------------------------------------------------------------------
- ptr = Load_Alloc_Data( filename, filesize );
-
- return( ptr );
-}
-
-
-/****************************************************************************
- * MAKE_CURRENT_PATH_TO -- Returns a buffer to path desired. *
- * *
- * INPUT: none. * *
- * *
- * OUTPUT: none. *
- * *
- * WARNINGS: * *
- * *
- * HISTORY: *
- * 10/08/2001 MML : Created. *
- *==========================================================================*/
-
-char *Make_Current_Path_To ( const char *filename, char *path )
-{
- char szPath [ _MAX_PATH ];
- char drive [ _MAX_DRIVE];
- char dir [ _MAX_DIR ];
-
- strcpy( szPath, Args->Get_argv(0));
- _splitpath( szPath, drive, dir, NULL, NULL );
- _makepath( szPath, drive, dir, NULL, NULL );
- Path_Add_Back_Slash( szPath );
- strcat( szPath, filename );
-
- if( path != NULL ) {
- strcpy( path, szPath );
- }
- return( path );
-}
-
-wchar_t *Make_Current_Path_To ( const wchar_t *filename, wchar_t *path )
-{
- wchar_t szPath [ _MAX_PATH ];
- wchar_t drive [ _MAX_DRIVE];
- wchar_t dir [ _MAX_DIR ];
-
- wcscpy( szPath, (wchar_t *)Args->Get_argv(0));
- _wsplitpath( szPath, drive, dir, NULL, NULL );
- _wmakepath( szPath, drive, dir, NULL, NULL );
- Path_Add_Back_Slash( szPath );
- wcscat( szPath, filename );
-
- if( path != NULL ) {
- wcscpy( path, szPath );
- }
- return( path );
-}
-
-
-/******************************************************************************
- * Path_Add_Back_Slash -- Add a '\\' to the end of the path.
- *
- * INPUT: char * path -- Pointer to the string to be modified.
- *
- * OUTPUT: char * path
- *
- * WARNINGS: none
- *
- * HISTORY:
- * 08/14/1998 MML : Created.
- *============================================================================*/
-
-char *Path_Add_Back_Slash ( char *path )
-{
- if ( path != NULL && *path != '\0' ) {
- if ( path[ strlen( path )-1 ] != '\\' ) {
- strcat( path, "\\" );
- }
- }
- return( path );
-}
-
-wchar_t *Path_Add_Back_Slash ( wchar_t *path )
-{
- if ( path != NULL && *path != '\0' ) {
- if ( path[ wcslen( path )-1 ] != '\\' ) {
- wcscat( path, L"\\" );
- }
- }
- return( path );
-}
-
-
-/******************************************************************************
- * Path_Remove_Back_Slash -- Remove a '\\' from the end of the path.
- *
- * INPUT: char * path -- Pointer to the string to be modified.
- *
- * OUTPUT: char * path
- *
- * WARNINGS: none
- *
- * HISTORY:
- * 08/14/1998 MML : Created.
- *============================================================================*/
-
-char *Path_Remove_Back_Slash ( char *path )
-{
- if ( path != NULL && *path != '\0' ) {
- if ( path[ strlen( path )-1 ] == '\\' ) {
- path[ strlen( path )-1 ] = '\0';
- }
- }
- return( path );
-}
-
-wchar_t *Path_Remove_Back_Slash ( wchar_t *path )
-{
- if ( path != NULL && *path != '\0' ) {
- if ( path[ wcslen( path )-1 ] == L'\\' ) {
- path[ wcslen( path )-1 ] = L'\0';
- }
- }
- return( path );
-}
-
-/*--------------------------------------------------------------------------*/
-/* Function: PlugInProductName */
-/* */
-/* Descrip: The function plugs the product name defined in */
-/* SdProductName() into %P found in the static message. */
-/* It will search for the first nMax controls only. */
-/* Misc: */
-/* */
-/*--------------------------------------------------------------------------*/
-
-void PlugInProductName ( char *szString, char *szName )
-{
- int nCount, nMsgLength;
- char szTextBuf[ MAX_PATH ];
- char szOut[ MAX_PATH ];
- char szProduct[ MAX_PATH ];
- char * temp = NULL;
- char * next = NULL;
-
- if ( szName == NULL || szName[0] == '\0' ) {
- return;
- }
-
- //--------------------------------------------------------------------------
- // Find the first appearance of "%P".
- //--------------------------------------------------------------------------
- strcpy( szProduct, szName );
- strcpy( szTextBuf, szString );
- nMsgLength = strlen( szTextBuf );
- nCount = 0;
- temp = strstr( szTextBuf, "%s" );
-
- //-------------------------------------------------------------
- // Substitute each "%P" with "%s". nStrReturn is the index
- // into the buffer where "%P" was found.
- //-------------------------------------------------------------
- while ( temp != NULL && nCount < 6) {
- next = temp+1;
- nCount = nCount + 1;
- temp = strstr( next, "%s" );
- }
-
- //-------------------------------------------------------------
- // Only support up to 5 product name per message.
- // Do the substitution of the product name and store in szOut.
- //-------------------------------------------------------------
- switch( nCount ) {
- case 1:
- sprintf( szOut, szTextBuf, szProduct );
- break;
- case 2:
- sprintf( szOut, szTextBuf, szProduct, szProduct );
- break;
- case 3:
- sprintf( szOut, szTextBuf, szProduct, szProduct, szProduct );
- break;
- case 4:
- sprintf( szOut, szTextBuf, szProduct, szProduct, szProduct, szProduct );
- break;
- case 5:
- sprintf( szOut, szTextBuf, szProduct, szProduct, szProduct, szProduct, szProduct, szProduct );
- break;
- }
-
- //-------------------------------------------------------------
- // Replace szTextBuf with szOut.
- //-------------------------------------------------------------
- if ( nCount >= 1 ) {
- strcpy( szString, szOut );
- }
-}
-
-/*--------------------------------------------------------------------------*/
-/* Function: PlugInProductName */
-/* */
-/* Descrip: The function plugs the product name defined in */
-/* SdProductName() into %P found in the static message. */
-/* It will search for the first nMax controls only. */
-/* Misc: */
-/* */
-/*--------------------------------------------------------------------------*/
-
-void PlugInProductName( char *szString, int nName )
-{
-/*
- int nCount, nMsgLength;
- char szTextBuf[ MAX_PATH ];
- char szOut[ MAX_PATH ];
- char szProduct[ MAX_PATH ];
- char * temp = NULL;
- char * next = NULL;
-
- if ( nName <= STRNONE ) {
- nName = STRNONE;
- }
-
- //--------------------------------------------------------------------------
- // Find the first appearance of "%P".
- //-------------------------------------------------------------
-// LoadString( Main::hInstance, nName, szProduct, MAX_PATH );
- Locale_GetString( nName, szProduct );
-
- strcpy( szTextBuf, szString );
- nMsgLength = strlen( szTextBuf );
- nCount = 0;
- temp = strstr( szTextBuf, "%s" );
-
- //-------------------------------------------------------------
- // Substitute each "%P" with "%s". nStrReturn is the index
- // into the buffer where "%P" was found.
- //-------------------------------------------------------------
- while ( temp != NULL && nCount < 6) {
- next = temp+1;
- nCount = nCount + 1;
- temp = strstr( next, "%s" );
- }
-
- //-------------------------------------------------------------
- // Only support up to 5 product name per message.
- // Do the substitution of the product name and store in szOut.
- //-------------------------------------------------------------
- switch( nCount ) {
- case 1:
- sprintf( szOut, szTextBuf, szProduct );
- break;
- case 2:
- sprintf( szOut, szTextBuf, szProduct, szProduct );
- break;
- case 3:
- sprintf( szOut, szTextBuf, szProduct, szProduct, szProduct );
- break;
- case 4:
- sprintf( szOut, szTextBuf, szProduct, szProduct, szProduct, szProduct );
- break;
- case 5:
- sprintf( szOut, szTextBuf, szProduct, szProduct, szProduct, szProduct, szProduct, szProduct );
- break;
- }
-
- //-------------------------------------------------------------
- // Replace szTextBuf with szOut.
- //-------------------------------------------------------------
- if ( nCount >= 1 ) {
- strcpy( szString, szOut );
- }
-*/
-}
-
-/*--------------------------------------------------------------------------*/
-/* Function: PlugInProductName */
-/* */
-/* Descrip: The function plugs the product name defined in */
-/* SdProductName() into %P found in the static message. */
-/* It will search for the first nMax controls only. */
-/* Misc: */
-/* */
-/*--------------------------------------------------------------------------*/
-
-void PlugInProductName ( wchar_t *szString, const wchar_t *szName )
-{
- int nCount, nMsgLength;
- wchar_t szTextBuf[ MAX_PATH ];
- wchar_t szOut[ MAX_PATH ];
- wchar_t szProduct[ MAX_PATH ];
- wchar_t *temp = NULL;
- wchar_t *next = NULL;
-
- if ( szName == NULL || szName[0] == '\0' ) {
- return;
- }
-
- //--------------------------------------------------------------------------
- // Find the first appearance of "%P".
- //--------------------------------------------------------------------------
- wcscpy( szProduct, szName );
- wcscpy( szTextBuf, szString );
- nMsgLength = wcslen( szTextBuf );
- nCount = 0;
- temp = wcsstr( szTextBuf, L"%s" );
-
- //-------------------------------------------------------------
- // Substitute each "%P" with "%s". nStrReturn is the index
- // into the buffer where "%P" was found.
- //-------------------------------------------------------------
- while ( temp != NULL && nCount < 6) {
- next = temp+1;
- nCount = nCount + 1;
- temp = wcsstr( next, L"%s" );
- }
-
- //-------------------------------------------------------------
- // Only support up to 5 product name per message.
- // Do the substitution of the product name and store in szOut.
- //-------------------------------------------------------------
- switch( nCount ) {
- case 1:
- swprintf( szOut, szTextBuf, szProduct );
- break;
- case 2:
- swprintf( szOut, szTextBuf, szProduct, szProduct );
- break;
- case 3:
- swprintf( szOut, szTextBuf, szProduct, szProduct, szProduct );
- break;
- case 4:
- swprintf( szOut, szTextBuf, szProduct, szProduct, szProduct, szProduct );
- break;
- case 5:
- swprintf( szOut, szTextBuf, szProduct, szProduct, szProduct, szProduct, szProduct, szProduct );
- break;
- }
-
- //-------------------------------------------------------------
- // Replace szTextBuf with szOut.
- //-------------------------------------------------------------
- if ( nCount >= 1 ) {
- wcscpy( szString, szOut );
- }
-}
-
-
-
-
diff --git a/Generals/Code/Tools/Autorun/Utils.h b/Generals/Code/Tools/Autorun/Utils.h
deleted file mode 100644
index c349700482f..00000000000
--- a/Generals/Code/Tools/Autorun/Utils.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***************************************************************************
- * *
- * Project Name : Setup *
- * *
- * File Name : UTILS.H *
- * *
- * Programmers: Maria del Mar McCready Legg *
- * *
- * Start Date : December 20, 1994 *
- * *
- * Last Update : April 06, 1998 [MML] *
- * *
- *-------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-#pragma once
-
-#ifndef UTILS_H
-#define UTILS_H
-
-#include
-
-
-/******************************************************************************
-** Swaps two objects.
-*/
-template
-void swap( T & left, T & right )
-{
- T temp;
-
- temp = left;
- left = right;
- right = temp;
-}
-
-
-void Fix_Single_Ampersands ( LPSTR pszString, bool upper_case );
-void Fix_Single_Ampersands ( wchar_t *pszString, bool upper_case );
-//UnicodeString Fix_Single_Ampersands ( UnicodeString string, bool upper_case);
-void Fix_Double_Ampersands ( LPSTR string, bool upper_case );
-void * Load_Alloc_Data ( char *filename, long *filesize=0 );
-void * Load_File ( char *filename, long *filesize=0 );
-char * Make_Current_Path_To ( const char *filename, char *path );
-wchar_t * Make_Current_Path_To ( const wchar_t *filename, wchar_t *path );
-char * Path_Add_Back_Slash ( char *path );
-char * Path_Remove_Back_Slash ( char *path );
-wchar_t * Path_Add_Back_Slash ( wchar_t *path );
-wchar_t * Path_Remove_Back_Slash ( wchar_t *path );
-void PlugInProductName ( char *szString, int nName );
-void PlugInProductName ( char *szString, char *szName );
-void PlugInProductName ( wchar_t *szString, const wchar_t *szName );
-
-
-#endif
\ No newline at end of file
diff --git a/Generals/Code/Tools/Autorun/ViewHTML.cpp b/Generals/Code/Tools/Autorun/ViewHTML.cpp
deleted file mode 100644
index a913eb514ba..00000000000
--- a/Generals/Code/Tools/Autorun/ViewHTML.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/******************************************************************************
-*
-* FILE
-* $Archive: /Renegade Setup/Autorun/ViewHTML.cpp $
-*
-* DESCRIPTION
-*
-* PROGRAMMER
-* $Author: Maria_l $
-*
-* VERSION INFO
-* $Modtime: 2/16/01 11:32a $
-* $Revision: 3 $
-*
-******************************************************************************/
-
-#pragma warning(disable : 4201 4310)
-#include
-
-#include "ViewHTML.h"
-//#include "..\win.h"
-#include
-//#include "debugprint.h"
-#include "Wnd_File.h"
-
-
-/******************************************************************************
-*
-* NAME
-* ViewHTML
-*
-* DESCRIPTION
-* Launch the default browser to view the specified URL
-*
-* INPUTS
-* URL - Website address
-* Wait - Wait for user to close browser (default = false)
-* Callback - User callback to invoke during wait (default = NULL callback)
-*
-* RESULT
-* Success - True if successful; otherwise false
-*
-******************************************************************************/
-
-bool ViewHTML(const char* url, bool wait, const CallbackHook& callback)
- {
-// DebugPrint("ViewHTML()\n");
- Msg( __LINE__, TEXT(__FILE__), TEXT("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ));
- Msg( __LINE__, TEXT(__FILE__), TEXT("ViewHTML()" ));
- Msg( __LINE__, TEXT(__FILE__), TEXT("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ));
-
- //--------------------------------------------------------------------------
- // Just return if no URL specified
- //--------------------------------------------------------------------------
- if ((url == NULL) || (strlen(url) == 0))
- {
-// DebugPrint("***** No URL specified.\n");
- Msg( __LINE__, TEXT(__FILE__), TEXT("***** No URL specified." ));
- return false;
- }
-
- //--------------------------------------------------------------------------
- // Create unique temporary HTML filename
- // JFS: Fixed so that it would go to the temp folder which was crashing
- // on limited users.
- //--------------------------------------------------------------------------
- char tempPath[MAX_PATH];
- char filename1[MAX_PATH];
- char filename2[MAX_PATH];
-
- // Expand the TMP environment variable.
- {
- DWORD dwResult;
- dwResult = ExpandEnvironmentStrings( "%TEMP%", tempPath, MAX_PATH);
- if(dwResult == 0)
- return false;
- }
-
- GetTempFileName(tempPath, "WS", 0, filename1);
-
- strcpy( filename2, filename1 );
- char* extPtr = strrchr(filename2, '.');
- strcpy(extPtr, ".html");
-
-
-// DebugPrint(filename);
- Msg( __LINE__, TEXT(__FILE__), TEXT("filename = %s"), filename2 );
-
- //--------------------------------------------------------------------------
- // Create file
- //--------------------------------------------------------------------------
- HANDLE file = CreateFile(
- filename2,
- GENERIC_WRITE,
- 0,
- NULL,
- CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
-
- if (file == INVALID_HANDLE_VALUE)
- {
-// DebugPrint("***** Unable to create temporary HTML file '%s'\n", filename);
- Msg( __LINE__, TEXT(__FILE__), TEXT("***** Unable to create temporary HTML file '%s"), filename2 );
- return false;
- }
-
- // Write generic contents
- const char* contents = "ViewHTML";
- DWORD written;
- WriteFile(file, contents, strlen(contents), &written, NULL);
- CloseHandle(file);
-
- // Find the executable that can launch this file
- char exeName[MAX_PATH];
- HINSTANCE hInst = FindExecutable(filename2, NULL, exeName);
-
- // Delete temporary file
- DeleteFile(filename2);
- DeleteFile(filename1);
-
- if ((int)hInst <= 32)
- {
-// DebugPrint("***** Unable to find executable that will display HTML files.\n");
- Msg( __LINE__, TEXT(__FILE__), TEXT("***** Unable to find executable that will display HTML files."));
- return false;
- }
-
- // Launch browser with specified URL
- char commandLine[MAX_PATH];
- sprintf(commandLine, "[open] %s", url);
-
- STARTUPINFO startupInfo;
- memset(&startupInfo, 0, sizeof(startupInfo));
- startupInfo.cb = sizeof(startupInfo);
-
- PROCESS_INFORMATION processInfo;
-
- BOOL createSuccess = CreateProcess(
- exeName,
- commandLine,
- NULL,
- NULL,
- FALSE,
- 0,
- NULL,
- NULL,
- &startupInfo,
- &processInfo);
-
- if (createSuccess == FALSE)
- {
-// DebugPrint("\t**** Failed to CreateProcess(%s, %s)\n", exeName, commandLine);
- Msg( __LINE__, TEXT(__FILE__), TEXT("\t**** Failed to CreateProcess(%s, %s)"), exeName, commandLine );
- return false;
- }
-
- if (wait == true)
- {
- WaitForInputIdle(processInfo.hProcess, 5000);
-
- bool waiting = true;
-
- while (waiting == true)
- {
- if (callback.DoCallback() == true)
- {
- break;
- }
-
- Sleep(100);
-
- DWORD exitCode;
- GetExitCodeProcess(processInfo.hProcess, &exitCode);
-
- if (exitCode != STILL_ACTIVE)
- {
- waiting = false;
- }
- }
- }
-
- return true;
- }
diff --git a/Generals/Code/Tools/Autorun/ViewHTML.h b/Generals/Code/Tools/Autorun/ViewHTML.h
deleted file mode 100644
index ede5b562bd6..00000000000
--- a/Generals/Code/Tools/Autorun/ViewHTML.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/******************************************************************************
-*
-* FILE
-* $Archive: /Renegade Setup/Autorun/ViewHTML.h $
-*
-* DESCRIPTION
-*
-* PROGRAMMER
-* $Author: Maria_l $
-*
-* VERSION INFO
-* $Modtime: 8/14/00 7:53p $
-* $Revision: 3 $
-*
-******************************************************************************/
-
-#ifndef VIEWHTML_H
-#define VIEWHTML_H
-
-#include "CallbackHook.h"
-
-bool ViewHTML(const char* url, bool wait = false, const CallbackHook& callback = CallbackHook());
-
-#endif // VIEWHTML_H
diff --git a/Generals/Code/Tools/Autorun/WSYS_File.cpp b/Generals/Code/Tools/Autorun/WSYS_File.cpp
deleted file mode 100644
index d3c3200babd..00000000000
--- a/Generals/Code/Tools/Autorun/WSYS_File.cpp
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//----------------------------------------------------------------------------
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright(C) 2001 - All Rights Reserved
-//
-//----------------------------------------------------------------------------
-//
-// Project: WSYS Library
-//
-// Module: IO_
-//
-// File name: IO_File.cpp
-//
-// Created: 4/23/01
-//
-//----------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------------
-
-#include
-#include
-#include
-#include
-
-
-#include "WSYS_file.h"
-
-
-//----------------------------------------------------------------------------
-// Externals
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Defines
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Types
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Data
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Public Data
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Prototypes
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Functions
-//----------------------------------------------------------------------------
-
-//=================================================================
-// File::File
-//=================================================================
-
-File::File()
-: m_open(FALSE),
- m_deleteOnClose(FALSE),
- m_access(NONE)
-{
-
- setName("");
-
-}
-
-
-//----------------------------------------------------------------------------
-// Public Functions
-//----------------------------------------------------------------------------
-
-
-//=================================================================
-// File::~File
-//=================================================================
-
-File::~File()
-{
- close();
-}
-
-//=================================================================
-// File::open
-//=================================================================
-/**
- * Any derived open() members must first call File::open. If File::open
- * succeeds but the derived class's open failes then make sure to call
- * File::close() before returning.
- */
-//=================================================================
-
-Bool File::open( const Char *filename, Int access )
-{
- if( m_open )
- {
- return FALSE;
- }
-
- setName( filename );
-
- if( (access & ( TEXT | BINARY)) == ( TEXT | BINARY ))
- {
- // illegal access
- return FALSE;
- }
-
- if ( !(access & (READ|APPEND)) )
- {
- access |= TRUNCATE;
- }
-
- if ( (access & (READ|WRITE)) == 0 )
- {
- access = READ;
- }
-
- if ( (access & (TEXT|BINARY)) == 0 )
- {
- access = BINARY;
- }
-
- m_access = access;
- m_open = TRUE;
- return TRUE;
-}
-
-//=================================================================
-// File::close
-//=================================================================
-/**
- * Must call File::close() for each successful File::open() call.
- */
-//=================================================================
-
-void File::close( void )
-{
- if( m_open )
- {
- setName( "" );
- m_open = FALSE;
- if ( m_deleteOnClose )
- {
- delete this; // on special cases File object will delete itself when closing
- }
- }
-}
-
-//=================================================================
-// File::size
-//=================================================================
-/**
- * Default implementation of File::size. Derived classes can optimize
- * this member function.
- */
-//=================================================================
-
-Int File::size( void )
-{
- Int pos = seek( 0, CURRENT );
- Int size = seek( 0, END );
-
- seek( pos, START );
-
- return size < 0 ? 0 : size;
-}
-
-//============================================================================
-// File::position
-//============================================================================
-
-Int File::position( void )
-{
- return seek(0, CURRENT);
-}
-
-//=================================================================
-// File::setName
-//=================================================================
-
-void File::setName( const Char *name )
-{
- strncpy( m_name, name, sizeof( m_name ));
- m_name[sizeof(m_name)-1] = 0;
-
-}
-
-//=================================================================
-// File::getName
-//=================================================================
-
-Bool File::getName( Char *buffer, Int max )
-{
- if( buffer && max > 0 && (strlen( m_name ) < (UnsignedInt) max))
- {
- strcpy( buffer, m_name );
- return TRUE;
- }
-
- return FALSE;
-}
-
-//============================================================================
-// File::printf
-//============================================================================
-
-Bool File::printf ( const Char *format, ...)
-{
- Char buffer[10*1024];
- Int len;
-
- if ( ! (m_access & TEXT ) )
- {
- return FALSE;
- }
-
- va_list args;
- va_start( args, format ); /* Initialize variable arguments. */
- len = vsprintf( buffer, format, args );
- va_end( args );
-
- if ( len >= sizeof(buffer) )
- {
- // Big Problem
- assert( FALSE );
- return FALSE;
- }
-
- return (write ( buffer, len ) == len);
-}
-
diff --git a/Generals/Code/Tools/Autorun/WSYS_FileSystem.cpp b/Generals/Code/Tools/Autorun/WSYS_FileSystem.cpp
deleted file mode 100644
index cd261f60d83..00000000000
--- a/Generals/Code/Tools/Autorun/WSYS_FileSystem.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//----------------------------------------------------------------------------
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright(C) 2001 - All Rights Reserved
-//
-//----------------------------------------------------------------------------
-//
-// Project: WSYS Library
-//
-// Module: IO
-//
-// File name: IO_FileSystem.cpp
-//
-// Created: 4/23/01
-//
-//----------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------------
-
-#include "WSYS_FileSystem.h"
-
-#include "WSYS_StdFileSystem.h"
-
-//----------------------------------------------------------------------------
-// Externals
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Defines
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Types
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Data
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Public Data
-//----------------------------------------------------------------------------
-
-//===============================
-// TheFileSystem
-//===============================
-/**
- * This is the FileSystem's singleton class. All file access
- * should be through TheFileSystem, unless code needs to use an explicit
- * File or FileSystem derivative.
- *
- * Using TheFileSystem->open and File exclusively for file access, particularly
- * in library or modular code, allows applications to transparently implement
- * file access as they see fit. This is particularly important for code that
- * needs to be shared between applications, such as games and tools.
- */
-//===============================
-
-FileSystem *TheFileSystem = NULL;
-
-//----------------------------------------------------------------------------
-// Private Prototypes
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Functions
-//----------------------------------------------------------------------------
-
-
-//----------------------------------------------------------------------------
-// Public Functions
-//----------------------------------------------------------------------------
-
-
diff --git a/Generals/Code/Tools/Autorun/WSYS_FileSystem.h b/Generals/Code/Tools/Autorun/WSYS_FileSystem.h
deleted file mode 100644
index 6358c9c17dc..00000000000
--- a/Generals/Code/Tools/Autorun/WSYS_FileSystem.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//----------------------------------------------------------------------------=
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright(C) 2001 - All Rights Reserved
-//
-//----------------------------------------------------------------------------
-//
-// Project: WSYS Library
-//
-// Module: IO
-//
-// File name: wsys/FileSystem.h
-//
-// Created:
-//
-//----------------------------------------------------------------------------
-
-#pragma once
-
-#ifndef __WSYS_FILESYSTEM_H
-#define __WSYS_FILESYSTEM_H
-
-
-
-//----------------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------------
-
-#ifndef __WSYS_FILE_H
-#include "WSYS_file.h"
-#endif
-
-
-//----------------------------------------------------------------------------
-// Forward References
-//----------------------------------------------------------------------------
-
-
-//----------------------------------------------------------------------------
-// Type Defines
-//----------------------------------------------------------------------------
-
-//===============================
-// FileSystem
-//===============================
-/**
- * FileSystem is an interface class for creating specific FileSystem objects.
- *
- * A FileSystem object's implemenation decides what derivative of File object needs to be
- * created when FileSystem::Open() gets called.
- */
-//===============================
-
-class FileSystem
-{
- protected:
-
- public:
-
- virtual ~FileSystem() {};
- virtual File* open( const Char *filename, Int access = 0 ) = NULL ; ///< opens a File interface to the specified file
-
-
-};
-
-extern FileSystem* TheFileSystem;
-
-
-
-//----------------------------------------------------------------------------
-// Inlining
-//----------------------------------------------------------------------------
-
-
-
-#endif // __WSYS_FILESYSTEM_H
diff --git a/Generals/Code/Tools/Autorun/WSYS_RAMFile.cpp b/Generals/Code/Tools/Autorun/WSYS_RAMFile.cpp
deleted file mode 100644
index 5a0ffaaee0b..00000000000
--- a/Generals/Code/Tools/Autorun/WSYS_RAMFile.cpp
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//----------------------------------------------------------------------------
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright(C) 2001 - All Rights Reserved
-//
-//----------------------------------------------------------------------------
-//
-// Project: WSYS Library
-//
-// Module: IO
-//
-// File name: WSYS_RAMFile.cpp
-//
-// Created: 11/08/01
-//
-//----------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------------
-
-#include
-#include
-#include
-#include
-#include
-
-#include "WSYS_FileSystem.h"
-#include "WSYS_RAMFile.h"
-
-
-//----------------------------------------------------------------------------
-// Externals
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Defines
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Types
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Data
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Public Data
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Prototypes
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Functions
-//----------------------------------------------------------------------------
-
-//=================================================================
-// RAMFile::RAMFile
-//=================================================================
-
-RAMFile::RAMFile()
-: m_size(0),
- m_data(NULL)
-{
-
-}
-
-
-//----------------------------------------------------------------------------
-// Public Functions
-//----------------------------------------------------------------------------
-
-
-//=================================================================
-// RAMFile::~RAMFile
-//=================================================================
-
-RAMFile::~RAMFile()
-{
- delete [] m_data;
-
- File::close();
-
-}
-
-//=================================================================
-// RAMFile::open
-//=================================================================
-/**
- * This function opens a file using the standard C open() call. Access flags
- * are mapped to the appropriate open flags. Returns true if file was opened
- * successfully.
- */
-//=================================================================
-
-Bool RAMFile::open( const Char *filename, Int access )
-{
- File *file = TheFileSystem->open( filename, access );
-
- if ( file == NULL )
- {
- return FALSE;
- }
-
- Bool result = open( file );
-
- file->close();
-
- return result;
-
- return TRUE;
-}
-
-//============================================================================
-// RAMFile::open
-//============================================================================
-
-Bool RAMFile::open( File *file )
-{
- if ( file == NULL )
- {
- return NULL;
- }
-
- Int access = file->getAccess();
-
- if ( !File::open( file->getName(), access ))
- {
- return FALSE;
- }
-
- // read whole file in to memory
- m_size = file->size();
- m_data = new char [ m_size ];
-
- if ( m_data == NULL )
- {
- return FALSE;
- }
-
- m_size = file->read( m_data, m_size );
-
- if ( m_size < 0 )
- {
- delete [] m_data;
- m_data = NULL;
- return FALSE;
- }
-
- m_pos = 0;
-
- return TRUE;
-}
-
-//=================================================================
-// RAMFile::close
-//=================================================================
-/**
- * Closes the current file if it is open.
- * Must call RAMFile::close() for each successful RAMFile::open() call.
- */
-//=================================================================
-
-void RAMFile::close( void )
-{
- if ( m_data )
- {
- delete [] m_data;
- m_data = NULL;
- }
-
- File::close();
-}
-
-//=================================================================
-// RAMFile::read
-//=================================================================
-
-Int RAMFile::read( void *buffer, Int bytes )
-{
- if( m_data == NULL )
- {
- return -1;
- }
-
- Int bytesLeft = m_size - m_pos ;
-
- if ( bytes > bytesLeft )
- {
- bytes = bytesLeft;
- }
-
- if ( bytes > 0 )
- {
- memcpy ( buffer, &m_data[m_pos], bytes );
- }
- else
- {
- bytes = 0;
- }
-
- m_pos += bytes;
-
- return bytes;
-}
-
-//=================================================================
-// RAMFile::write
-//=================================================================
-
-Int RAMFile::write( void *buffer, Int bytes )
-{
- return -1;
-}
-
-//=================================================================
-// RAMFile::seek
-//=================================================================
-
-Int RAMFile::seek( Int pos, seekMode mode)
-{
- Int newPos;
-
- switch( mode )
- {
- case START:
- newPos = pos;
- break;
- case CURRENT:
- newPos = m_pos + pos;
- break;
- case END:
- newPos = m_size - pos - 1;
- break;
- default:
- // bad seek mode
- return -1;
- }
-
- if ( newPos < 0 )
- {
- newPos = 0;
- }
- else if ( newPos > m_size - 1 )
- {
- newPos = m_size - 1;
- }
-
- m_pos = newPos;
-
- return m_pos;
-
-}
-
diff --git a/Generals/Code/Tools/Autorun/WSYS_RAMFile.h b/Generals/Code/Tools/Autorun/WSYS_RAMFile.h
deleted file mode 100644
index 8b7040e6e97..00000000000
--- a/Generals/Code/Tools/Autorun/WSYS_RAMFile.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//----------------------------------------------------------------------------=
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright(C) 2001 - All Rights Reserved
-//
-//----------------------------------------------------------------------------
-//
-// Project: WSYS Library
-//
-// Module: IO
-//
-// File name: wsys/RAMFile.h
-//
-// Created: 11/08/01
-//
-//----------------------------------------------------------------------------
-
-#pragma once
-
-#ifndef __WSYS_RAMFILE_H
-#define __WSYS_RAMFILE_H
-
-
-
-//----------------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------------
-
-#include "WSYS_file.h"
-
-//----------------------------------------------------------------------------
-// Forward References
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Type Defines
-//----------------------------------------------------------------------------
-
-//===============================
-// RAMFile
-//===============================
-/**
- * File abstraction for standard C file operators: open, close, lseek, read, write
- */
-//===============================
-
-class RAMFile : public File
-{
- protected:
-
- Char *m_data; ///< File data in memory
- Int m_pos; ///< current read position
- Int m_size; ///< size of file in memory
-
- public:
-
- RAMFile();
- virtual ~RAMFile();
-
-
- virtual Bool open( const Char *filename, Int access = 0 ); ///< Open a file for access
- virtual void close( void ); ///< Close the file
- virtual Int read( void *buffer, Int bytes ); ///< Read the specified number of bytes in to buffer: See File::read
- virtual Int write( void *buffer, Int bytes ); ///< Write the specified number of bytes from the buffer: See File::write
- virtual Int seek( Int new_pos, seekMode mode = CURRENT ); ///< Set file position: See File::seek
-
- Bool open( File *file ); ///< Open file for fast RAM access
-};
-
-
-
-
-//----------------------------------------------------------------------------
-// Inlining
-//----------------------------------------------------------------------------
-
-
-#endif // __WSYS_RAMFILE_H
diff --git a/Generals/Code/Tools/Autorun/WSYS_StdFile.cpp b/Generals/Code/Tools/Autorun/WSYS_StdFile.cpp
deleted file mode 100644
index 9be2ae0e5e2..00000000000
--- a/Generals/Code/Tools/Autorun/WSYS_StdFile.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//----------------------------------------------------------------------------
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright(C) 2001 - All Rights Reserved
-//
-//----------------------------------------------------------------------------
-//
-// Project: WSYS Library
-//
-// Module: IO_
-//
-// File name: IO_StdFile.cpp
-//
-// Created: 4/23/01
-//
-//----------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------------
-
-#include
-#include
-#include
-#include
-#include
-
-#include "WSYS_StdFile.h"
-
-
-//----------------------------------------------------------------------------
-// Externals
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Defines
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Types
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Data
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Public Data
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Prototypes
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Functions
-//----------------------------------------------------------------------------
-
-//=================================================================
-// StdFile::StdFile
-//=================================================================
-
-StdFile::StdFile()
-: m_handle(-1)
-{
-
-}
-
-
-//----------------------------------------------------------------------------
-// Public Functions
-//----------------------------------------------------------------------------
-
-
-//=================================================================
-// StdFile::~StdFile
-//=================================================================
-
-StdFile::~StdFile()
-{
- if( m_handle != -1 )
- {
- _close( m_handle );
- m_handle = -1;
- }
-
- File::close();
-
-}
-
-//=================================================================
-// StdFile::open
-//=================================================================
-/**
- * This function opens a file using the standard C open() call. Access flags
- * are mapped to the appropriate open flags. Returns true if file was opened
- * successfully.
- */
-//=================================================================
-
-Bool StdFile::open( const Char *filename, Int access )
-{
- if( !File::open( filename, access) )
- {
- return FALSE;
- }
-
- /* here we translate WSYS file access to the std C equivalent */
-
- int flags = 0;
-
- if(m_access & CREATE) flags |= _O_CREAT;
- if(m_access & TRUNCATE) flags |= _O_TRUNC;
- if(m_access & APPEND) flags |= _O_APPEND;
- if(m_access & TEXT) flags |= _O_TEXT;
- if(m_access & BINARY) flags |= _O_BINARY;
-
- if((m_access & READWRITE )== READWRITE )
- {
- flags |= _O_RDWR;
- }
- else if(m_access & WRITE)
- {
- flags |= _O_WRONLY;
- }
- else
- flags |= _O_RDONLY;
-
- m_handle = _open( filename, flags , _S_IREAD | _S_IWRITE);
-
- if( m_handle == -1 )
- {
- goto error;
- }
-
- if ( m_access & APPEND )
- {
- if ( seek ( 0, END ) < 0 )
- {
- goto error;
- }
- }
-
- return TRUE;
-
-error:
-
- close();
-
- return FALSE;
-}
-
-//=================================================================
-// StdFile::close
-//=================================================================
-/**
- * Closes the current file if it is open.
- * Must call StdFile::close() for each successful StdFile::open() call.
- */
-//=================================================================
-
-void StdFile::close( void )
-{
- File::close();
-}
-
-//=================================================================
-// StdFile::read
-//=================================================================
-
-Int StdFile::read( void *buffer, Int bytes )
-{
- if( !m_open || !buffer )
- {
- return -1;
- }
-
- return _read( m_handle, buffer, bytes );
-}
-
-//=================================================================
-// StdFile::write
-//=================================================================
-
-Int StdFile::write( void *buffer, Int bytes )
-{
-
- if( !m_open || !buffer )
- {
- return -1;
- }
-
- return _write( m_handle, buffer, bytes );
-
-}
-
-//=================================================================
-// StdFile::seek
-//=================================================================
-
-Int StdFile::seek( Int pos, seekMode mode)
-{
- int lmode;
-
- switch( mode )
- {
- case START:
- lmode = SEEK_SET;
- break;
- case CURRENT:
- lmode = SEEK_CUR;
- break;
- case END:
- lmode = SEEK_END;
- break;
- default:
- // bad seek mode
- return -1;
- }
-
- return _lseek( m_handle, pos, lmode );
-
-}
-
diff --git a/Generals/Code/Tools/Autorun/WSYS_StdFile.h b/Generals/Code/Tools/Autorun/WSYS_StdFile.h
deleted file mode 100644
index b212cae9c91..00000000000
--- a/Generals/Code/Tools/Autorun/WSYS_StdFile.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//----------------------------------------------------------------------------=
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright(C) 2001 - All Rights Reserved
-//
-//----------------------------------------------------------------------------
-//
-// Project: WSYS Library
-//
-// Module: IO
-//
-// File name: wsys/StdFile.h
-//
-// Created: 4/23/01
-//
-//----------------------------------------------------------------------------
-
-#pragma once
-
-#ifndef __WSYS_STDFILE_H
-#define __WSYS_STDFILE_H
-
-
-
-//----------------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------------
-
-#include "WSYS_file.h"
-
-//----------------------------------------------------------------------------
-// Forward References
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Type Defines
-//----------------------------------------------------------------------------
-
-//===============================
-// StdFile
-//===============================
-/**
- * File abstraction for standard C file operators: open, close, lseek, read, write
- */
-//===============================
-
-class StdFile : public File
-{
- protected:
-
- int m_handle; ///< Std C file handle
-
- public:
-
- StdFile();
- virtual ~StdFile();
-
-
- virtual Bool open( const Char *filename, Int access = 0 ); ///< Open a fioe for access
- virtual void close( void ); ///< Close the file
- virtual Int read( void *buffer, Int bytes ); ///< Read the specified number of bytes in to buffer: See File::read
- virtual Int write( void *buffer, Int bytes ); ///< Write the specified number of bytes from the buffer: See File::write
- virtual Int seek( Int new_pos, seekMode mode = CURRENT ); ///< Set file position: See File::seek
-
-};
-
-
-
-
-//----------------------------------------------------------------------------
-// Inlining
-//----------------------------------------------------------------------------
-
-
-#endif // __WSYS_STDFILE_H
diff --git a/Generals/Code/Tools/Autorun/WSYS_StdFileSystem.cpp b/Generals/Code/Tools/Autorun/WSYS_StdFileSystem.cpp
deleted file mode 100644
index 47272a5d6f3..00000000000
--- a/Generals/Code/Tools/Autorun/WSYS_StdFileSystem.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//----------------------------------------------------------------------------
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright(C) 2001 - All Rights Reserved
-//
-//----------------------------------------------------------------------------
-//
-// Project: WSYS Library
-//
-// Module: IO
-//
-// File name: IO_StdFileSystem.cpp
-//
-// Created: 4/23/01
-//
-//----------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------------
-
-#include "WSYS_StdFileSystem.h"
-#include "WSYS_StdFile.h"
-
-//----------------------------------------------------------------------------
-// Externals
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Defines
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Types
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Data
-//----------------------------------------------------------------------------
-
-
-//----------------------------------------------------------------------------
-// Public Data
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Prototypes
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Functions
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Public Functions
-//----------------------------------------------------------------------------
-
-//=================================================================
-// StdFileSystem::~StdFileSystem
-//=================================================================
-
-StdFileSystem::~StdFileSystem()
-{
-
-}
-
-//=================================================================
-// StdFileSystem::open
-//=================================================================
-/**
- * This simply creates a StdFile object and calls its open function.
- */
-//=================================================================
-
-File* StdFileSystem::open( const Char *filename, Int access )
-{
- StdFile *file = new StdFile();
-
- if( file->open( filename, access ))
- {
- file->deleteOnClose(); // File object not created by the user so delete it when the user is finished with it
- }
- else
- {
- delete file;
- file = NULL;
- }
-
- return (File*) file;
-}
\ No newline at end of file
diff --git a/Generals/Code/Tools/Autorun/WSYS_StdFileSystem.h b/Generals/Code/Tools/Autorun/WSYS_StdFileSystem.h
deleted file mode 100644
index f1e30ea0aa1..00000000000
--- a/Generals/Code/Tools/Autorun/WSYS_StdFileSystem.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//----------------------------------------------------------------------------=
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright(C) 2001 - All Rights Reserved
-//
-//----------------------------------------------------------------------------
-//
-// Project: WSYS Library
-//
-// Module: IO
-//
-// File name: wsys/StdFileSystem.h
-//
-// Created:
-//
-//----------------------------------------------------------------------------
-
-#pragma once
-
-#ifndef __WSYS_STDFILESYSTEM_H
-#define __WSYS_STDFILESYSTEM_H
-
-
-
-//----------------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------------
-
-#ifndef __WSYS_FILE_H
-#include "WSYS_file.h"
-#endif
-
-#ifndef __WSYS_FILESYSTEM_H
-#include "WSYS_FileSystem.h"
-#endif
-
-
-//----------------------------------------------------------------------------
-// Forward References
-//----------------------------------------------------------------------------
-
-
-//----------------------------------------------------------------------------
-// Type Defines
-//----------------------------------------------------------------------------
-
-//===============================
-// StdFileSystem
-//===============================
-/**
- * FileSystem that maps directly to StdFile files.
- */
-//===============================
-
-class StdFileSystem : public FileSystem
-{
-
- public:
-
- virtual ~StdFileSystem();
- virtual File* open( const Char *filename, Int access = 0 ); ///< Creates a StdFile object and opens the file with it: See FileSystem::open
-
-
-};
-
-//----------------------------------------------------------------------------
-// Inlining
-//----------------------------------------------------------------------------
-
-
-
-#endif // __WSYS_STDFILESYSTEM_H
diff --git a/Generals/Code/Tools/Autorun/WSYS_file.h b/Generals/Code/Tools/Autorun/WSYS_file.h
deleted file mode 100644
index af93beefe0c..00000000000
--- a/Generals/Code/Tools/Autorun/WSYS_file.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//----------------------------------------------------------------------------=
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright(C) 2001 - All Rights Reserved
-//
-//----------------------------------------------------------------------------
-//
-// Project: WSYS Library
-//
-// Module: IO
-//
-// File name: wsys/File.h
-//
-// Created: 4/23/01
-//
-//----------------------------------------------------------------------------
-
-#pragma once
-
-#ifndef __WSYS_FILE_H
-#define __WSYS_FILE_H
-
-
-
-//----------------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------------
-
-#include "Lib/BaseType.h"
-
-//----------------------------------------------------------------------------
-// Forward References
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Type Defines
-//----------------------------------------------------------------------------
-
-#define IO_MAX_PATH (2*1024) ///< Maximum allowable path legnth
-
-//===============================
-// File
-//===============================
-/**
- * File is an interface class for basic file operations.
- *
- * All code should use the File class and not its derivatives, unless
- * absolutely necessary. Also FS::Open should be used to create File objects and open files.
- */
-//===============================
-
-class File
-{
- friend class FileSystem;
-
- public:
-
- enum access
- {
- NONE = 0x00000000,
- READ = 0x00000001, ///< Access file for reading
- WRITE = 0x00000002, ///< Access file for writing
- APPEND = 0x00000004, ///< Seek to end of file on open
- CREATE = 0x00000008, ///< Create file if it does not exist
- TRUNCATE = 0x00000010, ///< Delete all data in file when opened
- TEXT = 0x00000020, ///< Access file as text data
- BINARY = 0x00000040, ///< Access file as binary data
- READWRITE = (READ | WRITE),
- NEW = 0x00000080 ///< Only create file if it does not exist
- };
-
- enum seekMode
- {
- START, ///< Seek position is relative to start of file
- CURRENT, ///< Seek position is relative to current file position
- END ///< Seek position is relative from the end of the file
- };
-
- protected:
-
- Char m_name[IO_MAX_PATH+1]; ///< Stores file name
- Bool m_open; ///< Has the file been opened
- Bool m_deleteOnClose; ///< delete File object on close()
- Int m_access; ///< How the file was opened
-
-
- File(); ///< This class can only used as a base class
- virtual ~File();
-
- public:
-
-
-
- virtual Bool open( const Char *filename, Int access = 0 ); ///< Open a file for access
- virtual void close( void ); ///< Close the file !!! File object no longer valid after this call !!!
-
- virtual Int read( void *buffer, Int bytes ) = NULL ; /**< Read the specified number of bytes from the file in to the
- * memory pointed at by buffer. Returns the number of bytes read.
- * Returns -1 if an error occured.
- */
- virtual Int write( void *buffer, Int bytes ) = NULL ; /**< Write the specified number of bytes from the
- * memory pointed at by buffer to the file. Returns the number of bytes written.
- * Returns -1 if an error occured.
- */
- virtual Int seek( Int bytes, seekMode mode = CURRENT ) = NULL; /**< Sets the file position of the next read/write operation. Returns the new file
- * position as the number of bytes from the start of the file.
- * Returns -1 if an error occured.
- *
- * seekMode determines how the seek is done:
- *
- * START : means seek to the specified number of bytes from the start of the file
- * CURRENT: means seek the specified the number of bytes from the current file position
- * END: means seek the specified number of bytes back from the end of the file
- */
- virtual Bool printf ( const Char *format, ...); ///< Prints formated string to text file
- virtual Int size( void ); ///< Returns the size of the file
- virtual Int position( void ); ///< Returns the current read/write position
-
-
- void setName( const Char *name ); ///< Set the name of the file
- Char* getName( void ); ///< Returns a pointer to the name of the file
- Bool getName( Char *buffer, Int max ); ///< Copies the name of the file to the buffer
- Int getAccess( void ); ///< Returns file's access flags
-
- void deleteOnClose ( void ); ///< Causes the File object to delete itself when it closes
-};
-
-
-
-
-//----------------------------------------------------------------------------
-// Inlining
-//----------------------------------------------------------------------------
-
-inline Char* File::getName( void ) { return m_name;};
-inline Int File::getAccess( void ) { return m_access;};
-inline void File::deleteOnClose( void ) { m_deleteOnClose = TRUE;};
-
-
-
-// include FileSystem.h as it will be used alot with File.h
-//#include "wsys/FileSystem.h"
-
-
-#endif // __WSYS_FILE_H
diff --git a/Generals/Code/Tools/Autorun/WinFix.CPP b/Generals/Code/Tools/Autorun/WinFix.CPP
deleted file mode 100644
index b69dbc3b727..00000000000
--- a/Generals/Code/Tools/Autorun/WinFix.CPP
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Command & Conquer *
- * *
- * $Archive:: /Renegade Setup/Autorun/WinFix.CPP $*
- * *
- * $Author:: Maria_l $*
- * *
- * $Modtime:: 11/15/01 10:44a $*
- * *
- * $Revision:: 6 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * Make_Identifier -- Creates a temporary string identifer. *
- * WindowsVersionInfo::WindowsVersionInfo -- Windows Version Info constructor. *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#define STRICT
-#include
-#include
-#pragma hdrstop
-
-//#include
-//#include
-#include
-#include
-#include "WinFix.H"
-#include "Wnd_File.h"
-
-/***************************************************************************
-** Windows Version Info global object.
-*/
-WindowsVersionInfo WinVersion;
-
-
-
-/***********************************************************************************************
- * WindowsVersionInfo::WindowsVersionInfo -- Windows Version Info constructor. *
- * *
- * This routine will examine the system to determine the OS, version, and patch level of *
- * the current OS. *
- * *
- * INPUT: none *
- * *
- * OUTPUT: none *
- * *
- * WARNINGS: Don't try and use this class until after WinMain, because it won't be *
- * initialized until all the global objects have been constructed. *
- * *
- * HISTORY: *
- * 04/09/98 jdl : Created. *
- *=============================================================================================*/
-WindowsVersionInfo::WindowsVersionInfo(void) :
- WindowsVersion(0),
- MajorVersionNumber(0),
- MinorVersionNumber(0),
- RunningOSR2(0),
- BuildNumber(0),
- IsWin9x(false),
- IsWin95(false),
- IsWin98(false),
- IsWin2000(false),
- IsWinNT(false),
- IsWinXP(false)
-{
- OSVERSIONINFO version_info;
-
- VersionName[0] = '\0';
- AdditionalInfo[0] = '\0';
-
- //--------------------------------------------------------------------------
- // Start recording messages.
- //--------------------------------------------------------------------------
- Delete_Msg_File();
- Msg( __LINE__, __FILE__, "----------------------------------------------", NULL );
- Msg( __LINE__, __FILE__, "------------------ Setup -----------------", NULL );
- Msg( __LINE__, __FILE__, "----------------------------------------------", NULL );
-
- //--------------------------------------------------------------------------
- // Get the version info from the OS.
- //
- // typedef struct _OSVERSIONINFO{
- // DWORD dwOSVersionInfoSize;
- // DWORD dwMajorVersion;
- // DWORD dwMinorVersion;
- // DWORD dwBuildNumber;
- // DWORD dwPlatformId;
- // TCHAR szCSDVersion[ 128 ];
- // } OSVERSIONINFO;
- //
- // typedef struct _OSVERSIONINFOEX {
- // DWORD dwOSVersionInfoSize;
- // DWORD dwMajorVersion;
- // DWORD dwMinorVersion;
- // DWORD dwBuildNumber;
- // DWORD dwPlatformId;
- // TCHAR szCSDVersion[ 128 ];
- // WORD wServicePackMajor;
- // WORD wServicePackMinor;
- // WORD wSuiteMask;
- // BYTE wProductType;
- // BYTE wReserved;
- // } OSVERSIONINFOEX, *POSVERSIONINFOEX, *LPOSVERSIONINFOEX;
- //--------------------------------------------------------------------------
- ZeroMemory( &version_info, sizeof( version_info ));
- version_info.dwOSVersionInfoSize = sizeof( version_info );
-
- int result = GetVersionEx( &version_info );
- assert( result != 0 );
-
- //--------------------------------------------------------------------------
- // Save the major/minor version numbers
- //--------------------------------------------------------------------------
- MajorVersionNumber = (int)version_info.dwMajorVersion;
- MinorVersionNumber = (int)version_info.dwMinorVersion;
- WindowsVersion = ( MajorVersionNumber * 100 ) + MinorVersionNumber;
-
- //--------------------------------------------------------------------------
- // Save the build number
- //--------------------------------------------------------------------------
- BuildNumber = (int)version_info.dwBuildNumber;
-
- //--------------------------------------------------------------------------
- // Check for Win9x
- //--------------------------------------------------------------------------
- if ( version_info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) {
-
- IsWin9x = true;
-
- if ( MajorVersionNumber == 4 && MinorVersionNumber == 0 ) {
- IsWin95 = true;
- }
- if (( MajorVersionNumber > 4 ) || (( MajorVersionNumber == 4 ) && ( MinorVersionNumber > 0 ))) {
- IsWin98 = true;
- }
-
- if ( LOWORD( version_info.dwPlatformId ) > 1000 ) {
- RunningOSR2 = TRUE;
- }
- }
-
- //--------------------------------------------------------------------------
- // Check for WinNT
- //--------------------------------------------------------------------------
- if ( version_info.dwPlatformId == VER_PLATFORM_WIN32_NT ) {
-
- IsWinNT = true;
-
- if (( MajorVersionNumber >= 5 ) && ( MinorVersionNumber >= 1 )) {
- IsWinXP = true;
-// if ( version_info.wSuiteMask == VER_SUITE_PERSONAL ) {
-// }
- } else if (( MajorVersionNumber == 5 ) && ( MinorVersionNumber == 0 )) {
- IsWin2000 = true;
- }
-
-// if( bOsVersionInfoEx )
-// {
-// if ( osvi.wProductType == VER_NT_WORKSTATION )
-// printf ( "Professional " );
-//
-// if ( osvi.wProductType == VER_NT_SERVER )
-// printf ( "Server " );
-
-// } else {
-
- #if( _DEBUG )
- HKEY hKey;
- char szProductType[80];
- DWORD dwBufLen;
-
- RegOpenKeyEx( HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\ProductOptions", 0, KEY_QUERY_VALUE, &hKey );
- RegQueryValueEx( hKey, "ProductType", NULL, NULL, (LPBYTE) szProductType, &dwBufLen);
- RegCloseKey( hKey );
-
- if ( lstrcmpi( "WINNT", szProductType) == 0 )
- Msg( __LINE__, __FILE__, "WinNT Workstation." );
- if ( lstrcmpi( "SERVERNT", szProductType) == 0 )
- Msg( __LINE__, __FILE__, "WinNT Server." );
- #endif
-// }
- }
-
-#ifdef DEV_VERSION
-
- //--------------------------------------------------------------------------
- // For developmental versions, just use the major & minor version #'s
- //--------------------------------------------------------------------------
- sprintf( VersionName, "%x.%x", MajorVersionNumber, MinorVersionNumber );
-
-#else
-
- //--------------------------------------------------------------------------
- // For final versions, trim 0's off the minor version
- //--------------------------------------------------------------------------
- unsigned short adjusted_minor;
- int i;
-
- adjusted_minor = MinorVersionNumber;
- for (i = 0; i < 4; i++) {
- if ((adjusted_minor & 0x000f) != 0) {
- break;
- }
- adjusted_minor >>= 4;
- }
- sprintf( VersionName, "%x.%x", MajorVersionNumber, adjusted_minor );
-
-#endif
-
- //--------------------------------------------------------------------------
- // Save off the additional version information string
- // (used to indicated additional info or patch level, i.e. for NT 4.0 SP3
- // it would contain the string 'Service Pack 3')
- //--------------------------------------------------------------------------
- strncpy( AdditionalInfo, version_info.szCSDVersion, sizeof(AdditionalInfo) - 1 );
- AdditionalInfo[sizeof(AdditionalInfo) - 1] = '\x0';
-
- //--------------------------------------------------------------------------
- // Send all info found to the debug output file.
- //--------------------------------------------------------------------------
-#if ( _DEBUG )
- Msg( __LINE__, __FILE__, "MajorVersionNumber = %d", MajorVersionNumber );
- Msg( __LINE__, __FILE__, "MinorVersionNumber = %d", MinorVersionNumber );
- Msg( __LINE__, __FILE__, "WindowsVersion = %d", WindowsVersion );
- Msg( __LINE__, __FILE__, "BuildNumber = %d", BuildNumber );
- Msg( __LINE__, __FILE__, "IsWin9x = %d", IsWin9x );
- Msg( __LINE__, __FILE__, "IsWin95 = %d", IsWin95 );
- Msg( __LINE__, __FILE__, "IsWin98 = %d", IsWin98 );
- Msg( __LINE__, __FILE__, "IsWin2000 = %d", IsWin2000 );
- Msg( __LINE__, __FILE__, "RunningOSR2 = %d", RunningOSR2 );
- Msg( __LINE__, __FILE__, "IsWinNT = %d", IsWinNT );
- Msg( __LINE__, __FILE__, "AdditionalInfo = %s", AdditionalInfo );
- Msg( __LINE__, __FILE__, "VersionName = %s", VersionName );
-#endif
-}
-
-/***********************************************************************************************
- * WindowsVersionInfo::Version_String -- Get the version number in human readable form *
- * *
- * INPUT: Nothing *
- * *
- * OUTPUT: Ptr to string containing version info *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 3/30/99 10:29PM ST : Created *
- *=============================================================================================*/
-char *WindowsVersionInfo::Version_String(void)
-{
- static char _ver95[] = {"Windows 95 "};
- static char _ver98[] = {"Windows 98 "};
- static char _verNT4[] = {"Windows NT 4 "};
- static char _verNT5[] = {"Windows 2000 "};
- static char _verXP[] = {"Windows XP "};
- static char _unknown[] = {"Unknown "};
-
- static char version[256];
-
- if (Is_Win95()) {
- strcpy (version, _ver95);
- }
-
- if (Is_Win98()) {
- strcpy (version, _ver98);
- }
-
- if (Is_WinNT()) {
- strcpy (version, _verNT4);
- }
-
- if (Is_WinNT5() || Is_Win_2000()) {
- strcpy (version, _verNT5);
- }
-
- if (Is_Win_XP()) {
- strcpy (version, _verXP);
- }
-
- strcat (version, AdditionalInfo);
-
- return (version);
-}
-
-/***************************************************************************
- * WindowsVersionClass::Version_Name -- returns version # as char string *
- * *
- * INPUT: *
- * none. *
- * *
- * OUTPUT: *
- * ptr to name *
- * *
- * WARNINGS: *
- * none. *
- * *
- * HISTORY: *
- * 10/30/1995 BRR : Created. *
- *=========================================================================*/
-
-char * WindowsVersionInfo::Version_Name(void)
-{
- return ( VersionName );
-}
-
-/****************************************************************************
- * WindowsVersionClass::Meets_Minimum_Version_Requirements *
- * *
- * INPUT: *
- * none. *
- * *
- * OUTPUT: *
- * ptr to name *
- * *
- * WARNINGS: *
- * none. *
- * *
- * HISTORY: *
- * 10/30/1995 BRR : Created. *
- *==========================================================================*/
-
-bool WindowsVersionInfo::Meets_Minimum_Version_Requirements ( void )
-{
-// return(( !IsWin95 && ( Version() >= 400 ))? true : false );
- return(( Version() >= 400 )? true : false );
-}
-
-
-
diff --git a/Generals/Code/Tools/Autorun/WinFix.H b/Generals/Code/Tools/Autorun/WinFix.H
deleted file mode 100644
index fc71663a7ba..00000000000
--- a/Generals/Code/Tools/Autorun/WinFix.H
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Command & Conquer *
- * *
- * $Archive:: /Renegade Setup/Autorun/WinFix.H $*
- * *
- * $Author:: Maria_l $*
- * *
- * $Modtime:: 11/07/01 5:57p $*
- * *
- * $Revision:: 6 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * WindowsVersionInfo::Major -- Get the major version of the OS *
- * WindowsVersionInfo::Minor -- Get the minor version of the OS *
- * WindowsVersionInfo::Build -- Get the build level of the OS *
- * WindowsVersionInfo::Info -- Get additional system information *
- * WindowsVersionInfo::Is_Win9x -- Determine if we are running on a non-NT system. *
- * WindowsVersionInfo::Is_Win95 -- Determine if we are running on a Win95 system. *
- * WindowsVersionInfo::Is_Win98 -- Determine if we are running on a Win98 system. *
- * WindowsVersionInfo::Is_WinNT -- Determine if we are running on an NT system. *
- * WindowsVersionInfo::Is_WinNT5 -- Determine if we are running on an NT 5 system. *
- * WindowsVersionInfo::Version -- *
- * WindowsVersionInfo::IsOSR2Release -- *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#pragma once
-
-#ifndef WINFIX_H
-#define WINFIX_H
-
-
-/*-----------------------------------------------------------------------------
-** Windows Version Information class. This is a global object that is used to
-** store information about the specific OS that we are running under. This can
-** be used to make special allowances for differences between OS's, such as when
-** using the registry, or trying to work around a limitaion of a particular OS
-** (their APIs are slightly different...)
-**-----------------------------------------------------------------------------*/
-class WindowsVersionInfo
-{
- public:
- WindowsVersionInfo (void);
- ~WindowsVersionInfo (void) {}
-
- int Major ( void ) const { return( MajorVersionNumber ); }
- int Minor ( void ) const { return( MinorVersionNumber ); }
- int Build ( void ) const { return( BuildNumber ); }
- bool Is_Win9x ( void ) const { return( IsWin9x ); } // Win 9x
- bool Is_Win95 ( void ) const { return( IsWin95 ); } // Win 95
- bool Is_Win98 ( void ) const { return( IsWin98 ); } // Win 98
- bool Is_WinNT ( void ) const { return( IsWinNT ); } // Win NT
- bool Is_WinNT4 ( void ) const { return( IsWinNT && MajorVersionNumber == 4 ); } // Win NT
- bool Is_WinNT5 ( void ) const { return( IsWinNT && MajorVersionNumber == 5 ); } // Win NT
- bool Is_Win_2000 ( void ) const { return( IsWin2000 ); } // Win 2000
- bool Is_Win_XP ( void ) const { return( IsWinXP ); } // Win XP
- int Version ( void ) const { return( WindowsVersion ); }
- int IsOSR2Release ( void ) const { return( RunningOSR2 ); }
- const char * Info ( void ) const { return( &AdditionalInfo[0] ); }
- char * Version_String ( void );
- char * Version_Name ( void );
- bool Meets_Minimum_Version_Requirements ( void );
-
- private:
- /*-----------------------------------------------------------------------
- ** Major version number; i.e. for 4.10.1721 this would be '4'
- */
- int MajorVersionNumber;
-
- /*-----------------------------------------------------------------------
- ** Minor version number; i.e. for 4.10.1721 this would be '10'
- */
- int MinorVersionNumber;
-
- /*-----------------------------------------------------------------------
- ** Version number expressed as a DWORD; i.e. for 4.10 this would be '410'
- */
- int WindowsVersion;
-
- /*-----------------------------------------------------------------------
- ** Build number; i.e. for 4.10.1721 this would be '1721'
- */
- int BuildNumber;
-
- /*-----------------------------------------------------------------------
- ** Is the system running OSR 2 or later release of Windows95.
- */
- int RunningOSR2;
-
- /*-----------------------------------------------------------------------
- ** Additional Info; i.e. for NT 4.0 with SP3, this would be
- ** the string 'Service Pack 3'
- */
- char AdditionalInfo[128];
-
- /*-----------------------------------------------------------------------
- ** Windows 9x flag; true if running on non-NT system
- */
- bool IsWin9x;
- bool IsWin95;
- bool IsWin98;
-
- /*-----------------------------------------------------------------------
- ** Windows NT flag; true if running on Windows NT system
- */
- bool IsWinNT;
-
- /*-----------------------------------------------------------------------
- ** Windows 2000 (Formerly Windows NT 5.0)
- ** As you've no doubt heard by now, Windows NT 5.0 has been officially
- ** christened "Windows 2000."
- */
- bool IsWin2000;
-
- /*-----------------------------------------------------------------------
- ** Windows XP flag; true if running on Windows NT system
- */
- bool IsWinXP;
-
- /*-----------------------------------------------------------------------
- ** This array is used for formatting the version # as a string
- */
- char VersionName[30];
-};
-
-extern WindowsVersionInfo WinVersion;
-
-#endif
\ No newline at end of file
diff --git a/Generals/Code/Tools/Autorun/Wnd_File.h b/Generals/Code/Tools/Autorun/Wnd_File.h
deleted file mode 100644
index b8c4ff3666b..00000000000
--- a/Generals/Code/Tools/Autorun/Wnd_File.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//****************************************************************************
-// C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
-//****************************************************************************
-//
-// Project name: Blade Runner CD-ROM Windows 95
-//
-// File name: WND_FILE.H
-//
-// Source code: WND_FILE.CPP
-//
-// Compatibility: Microsoft Visual C++ 4.0
-// Borland C++ 5.0
-// Watcom C++ 10.6
-//
-// Start Date: See comments in version control log
-// Last Update: See comments in version control log
-//
-// Programmer(s): Michael Legg
-// Mike Grayford
-// James McNeill
-//
-//****************************************************************************
-#pragma once
-
-#ifndef WND_FILE_H
-#define WND_FILE_H
-
-//------------------------------------------------------------------------------
-// include files...
-//------------------------------------------------------------------------------
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define BOOL int
-#define ASSERT(x) assert(x)
-#define VERIFY(X) assert(X)
-
-
-//------------------------------------------------------------------------------
-// defines...
-//------------------------------------------------------------------------------
-
-//
-// it's one or the other!
-//
-#define SUPPORT_STREAMS TRUE // Normally this!
-#define SUPPORT_HANDLES FALSE // This is a test!
-
-#define MODE_READ_ONLY 0
-#define MODE_WRITE_ONLY 1
-#define MODE_READ_AND_WRITE 2
-
-#define MODE_WRITE_TRUNCATE MODE_WRITE_ONLY
-#define MODE_WRITE_APPEND 3
-#define MODE_WRITE_UPDATE 4
-
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#define SEEK_END 2
-
-// #define INVALID_FILE_HANDLE -1
-#define INVALID_FILE_HANDLE INVALID_HANDLE_VALUE
-#define MAX_PATH_SIZE _MAX_PATH
-
-
-#define STRING_IT(a) #a
-#define TOKEN_IT(a) STRING_IT(,##a)
-#define MESSAGE(a) message (__FILE__ "(" TOKEN_IT(__LINE__) ") : " a)
-
-//#pragma MESSAGE("What does it do?")
-
-
-
-#ifdef _DEBUG
-void __cdecl Msg( int line, const char *file, const char *fmt, ... );
-void __cdecl Msg( int line, const char *filename, const wchar_t *fmt, unsigned int codepage=1252, ... );
-void Delete_Msg_File( void );
-#else
-#define Msg
-#define Delete_Msg_File()
-#endif
-
-
-//------------------------------------------------------------------------------
-// file class definition
-//------------------------------------------------------------------------------
-
-class StandardFileClass
-{
- public:
-
- //
- // public class functions...
- //
- StandardFileClass();
- ~StandardFileClass();
- bool Open ( const char *file_name, int open_mode );
- bool Close ( void );
- int Read ( void *buffer, unsigned long int bytes_to_read );
- int Write ( void *buffer, unsigned long int bytes_to_write );
- bool Seek ( int distance, int seek_file_position );
- int Tell ( void );
- int Query_Size ( void );
- bool Query_Open ( void );
- char * Query_Name_String ( void );
- int End_Of_File ( void );
- int Flush ( void );
-
- #if( SUPPORT_STREAMS )
- FILE *Query_File_Stream_Pointer( void );
- #endif
-
- private:
-
- //
- // private class functions...
- //
- void Reset( void );
- //
- // private class data...
- //
- #if( SUPPORT_HANDLES )
- HANDLE File_Handle;
- #endif
-
- #if( SUPPORT_STREAMS )
- //--------------------------------------------------------------------
- // The _stat structure, defined in SYS\STAT.H, includes these fields.
- // st_atime Time of last access of file ( time_t ).
- // st_ctime Time of creation of file ( time_t ).
- // st_dev Drive number of the disk containing the file (same as st_rdev).
- // st_rdev Drive number of the disk containing the file (same as st_dev).
- // st_mode Bit mask for file-mode information.
- // _S_IFDIR bit is set if path specifies a directory;
- // _S_IFREG bit is set if path specifies an ordinary file or a device.
- // User read/write bits are set according to the file's permission
- // mode; user execute bits are set according to the filename extension.
- // st_mtime Time of last modification of file.
- // st_nlink Always 1 on non-NTFS file systems.
- // st_size Size of the file in bytes; a 64-bit integer for _stati64 and _wstati64
- //--------------------------------------------------------------------
- FILE *File_Stream_Ptr;
- struct stat File_Statistics;
- #endif
-
- char File_Name[ MAX_PATH_SIZE ];
- bool Currently_Open;
-};
-
-//------------------------------------------------------------------------------
-// non-class public functions...
-//------------------------------------------------------------------------------
-
-#if( SUPPORT_HANDLES )
- HANDLE Open_File( char const *file_name, int mode );
- bool Close_File( HANDLE handle );
- int Read_File( HANDLE handle,
- void *buffer,
- unsigned long int bytes_to_read );
- int Write_File( HANDLE handle,
- void const *buffer,
- unsigned long int bytes_to_write );
- bool Seek_File( HANDLE handle,
- int distance,
- int seek_file_location );
- int Tell_File( HANDLE handle );
- int File_Size( HANDLE handle );
- //
- // include path in name
- //
- bool Full_Path_File_Exists( char const *file_name );
- //
- // don't include path in name
- //
- bool HD_File_Exists( char const *file_name );
- bool CD_File_Exists( char const *file_name );
- // bool Find_File( char const *file_name );
-#endif
-
-#if( SUPPORT_STREAMS )
- //
- // include path in name
- //
- bool Full_Path_File_Exists( char const *file_name );
- //
- // don't include path in name
- //
- bool HD_File_Exists( char const *file_name );
- bool CD_File_Exists( char const *file_name );
- // bool Find_File( char const *file_name );
-#endif
-
-#endif // WND_FILE_H
diff --git a/Generals/Code/Tools/Autorun/Wnd_file.cpp b/Generals/Code/Tools/Autorun/Wnd_file.cpp
deleted file mode 100644
index 006fc5c5774..00000000000
--- a/Generals/Code/Tools/Autorun/Wnd_file.cpp
+++ /dev/null
@@ -1,1625 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-//*****************************************************************************
-// C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
-//*****************************************************************************
-//
-// Project name: Blade Runner CD-ROM Windows 95
-//
-// File name: WND_FILE.CPP
-//
-// Functions: WND_FILE.H
-//
-// Compatibility: Microsoft Visual C++ 4.0
-// Borland C++ 5.0
-// Watcom C++ 10.6
-//
-// Start Date: See comments in version control log
-// Last Update: See comments in version control log
-//
-// Programmer(s): Michael Legg
-// Mike Grayford
-//
-//*****************************************************************************
-
-//-----------------------------------------------------------------------------
-// include files...
-//-----------------------------------------------------------------------------
-#include "windows.h"
-#include
-#include
-#include "Wnd_File.h"
-#include "WinFix.H"
-//#include "autorun.h"
-
-
-//-----------------------------------------------------------------------------
-// private defines...
-//-----------------------------------------------------------------------------
-#define DEBUG_FILE "DebugAutorun.txt"
-
-// TC? This is non-Westwood Library 32-bit file access!
-#define MAX_FILES_OPEN_AT_A_TIME 25 // includes .MIX files
-
-//-----------------------------------------------------------------------------
-// private data...
-//-----------------------------------------------------------------------------
-char HD_Path [ MAX_PATH ] = { '\0' };
-char CD_Path [ MAX_PATH ] = { '\0' };
-char DebugFile [ MAX_PATH ] = { '\0' };
-
-// HANDLE Windows_File_Handles[ MAX_FILES_OPEN_AT_A_TIME ];
-// #if( SUPPORT_STREAMS )
-// FILE *Windows_File_Streams[ MAX_FILES_OPEN_AT_A_TIME ];
-// #endif
-
-
-//-----------------------------------------------------------------------------
-// non-class private functions in this module...
-//-----------------------------------------------------------------------------
-// int Get_Internal_File_Handle( void );
-// #if( SUPPORT_STREAMS )
-// FILE *Get_Internal_File_Stream( void );
-// #endif
-
-
-//-----------------------------------------------------------------------------
-// public file class functions...
-//-----------------------------------------------------------------------------
-#if(0)
-#ifndef _DEBUG
-void __cdecl Msg( int, char *, char *, ... ) { }; // line, file, fmt
-void Delete_Msg_File ( void ) { };
-#endif
-#endif
-
-
-#ifdef _DEBUG
-
-/****************************************************************************
- * MSG -- Write Message to Debug file with line and filename. *
- * *
- * INPUT: int line -- line where message originated. *
- * char *filename -- file where message originated. *
- * char *fmt -- variable argument list. *
- * *
- * OUTPUT: none. *
- * *
- * WARNINGS: none. *
- * *
- * HISTORY: *
- * 08/19/1998 MML : Created. *
- *==========================================================================*/
-
-void __cdecl Msg( int line, const char *filename, const char *fmt, ... )
-{
- char szBuffer1[ MAX_PATH * 3 ];
- char szBuffer2[ MAX_PATH * 2 ];
- char szFile[ MAX_PATH ];
- va_list va;
- DWORD nBytes;
- StandardFileClass file;
-
- //----------------------------------------------------------------------
- // Variable Arguments
- //----------------------------------------------------------------------
- va_start( va, fmt );
-
- if ( DebugFile[0] == '\0' ) {
- return;
- }
- if ( filename[0] == '\0' ) {
- return;
- }
-
- //----------------------------------------------------------------------
- // Make filename.
- //----------------------------------------------------------------------
- const char *temp = strrchr( filename, '\\' );
- if ( temp != NULL || temp[0] != '\0' ) {
- temp++;
- strcpy( szFile, temp );
- }
-
- //----------------------------------------------------------------------
- // format message with header
- //----------------------------------------------------------------------
- memset( szBuffer1, '\0', MAX_PATH * 3 );
- memset( szBuffer2, '\0', MAX_PATH * 2 );
- wvsprintf( szBuffer2, fmt, va );
- wsprintf( szBuffer1, "%4d %14s %s\n", line, szFile, szBuffer2 );
-
- //----------------------------------------------------------------------
- // Open debug file and write to it.
- //----------------------------------------------------------------------
- file.Open( DebugFile, MODE_WRITE_APPEND );
- if ( file.Query_Open( )) {
-
- int length = strlen( szBuffer1 );
- nBytes = file.Write( szBuffer1, length );
- if ( nBytes != strlen( szBuffer1 )) {
- }
- file.Close();
- }
-
- //----------------------------------------------------------------------
- // To the debugger unless we need to be quiet
- //----------------------------------------------------------------------
- OutputDebugString( szBuffer1 );
-
-} /* Msg */
-
-
-/****************************************************************************
- * MSG -- Write Message to Debug file with line and filename. *
- * *
- * INPUT: int line -- line where message originated. *
- * wchar_t *filename -- file where message originated. *
- * wchar_t *fmt -- variable argument list. *
- * *
- * OUTPUT: none. *
- * *
- * WARNINGS: none. *
- * *
- * HISTORY: *
- * 08/19/1998 MML : Created. *
- *==========================================================================*/
-
-void __cdecl Msg( int line, const char *filename, const wchar_t *fmt, UINT codepage, ... )
-{
- wchar_t szBuffer1[ MAX_PATH * 3 ];
- wchar_t szBuffer2[ MAX_PATH * 3 ];
- char szBuffer3[ MAX_PATH * 3 ];
- wchar_t szFile[ MAX_PATH ];
- wchar_t szArgs[ MAX_PATH ];
- va_list va;
- int length;
- DWORD nBytes;
- StandardFileClass file;
-
- //----------------------------------------------------------------------
- // Variable Arguments
- //----------------------------------------------------------------------
-// va_start( va, fmt );
- va_start( va, codepage );
- memset( szArgs, '\0', MAX_PATH );
- memset( szFile, '\0', MAX_PATH );
- memset( szBuffer1, '\0', MAX_PATH * 3 );
- memset( szBuffer2, '\0', MAX_PATH * 2 );
-
- if ( DebugFile == NULL ) {
- return;
- }
- if ( filename == NULL ) {
- return;
- }
-
- //----------------------------------------------------------------------
- // Make filename.
- //----------------------------------------------------------------------
- const char *temp = strrchr( filename, '\\' );
- if ( temp != NULL || temp[0] != '\0' ) {
- temp++;
- length = strlen( temp );
- mbstowcs( szFile, temp, length );
- }
-
- //----------------------------------------------------------------------
- // format message with header
- //----------------------------------------------------------------------
- vswprintf( szBuffer2, fmt, va );
- swprintf( szBuffer1, L"%4d %14s %s\n", line, szFile, szBuffer2 );
-
- //----------------------------------------------------------------------
- // Open debug file and write to it.
- //----------------------------------------------------------------------
- file.Open( DebugFile, MODE_WRITE_APPEND );
-
- if ( file.Query_Open( )) {
-
- //---------------------------------------------------------------------
- // Identifier Meaning
- // 932 Japan
- // 949 Korean
- // 950 Chinese (Taiwan; Hong Kong SAR, PRC)
- // 1252 Windows 3.1 Latin 1 (US, Western Europe)
- //---------------------------------------------------------------------
- WideCharToMultiByte( codepage, 0, szBuffer1, -1, szBuffer3, MAX_PATH*3, NULL, NULL );
-
- length = strlen( szBuffer3 );
- nBytes = file.Write( szBuffer3, length );
- if ( nBytes != strlen( szBuffer3 )) {
- }
- file.Close();
- }
-
- //----------------------------------------------------------------------
- // To the debugger unless we need to be quiet
- //----------------------------------------------------------------------
- OutputDebugString( szBuffer3 );
-
-} /* Msg */
-
-
-/***************************************************************************
- * DELETE_MSG_FILE -- Delete the Debug file. *
- * *
- * INPUT: none. *
- * *
- * OUTPUT: none. *
- * *
- * WARNINGS: none. *
- * *
- * HISTORY: *
- * 08/19/1998 MML : Created. *
- *=========================================================================*/
-
-//----------------------------------------------------------------------
-// Delete_Msg_File
-//----------------------------------------------------------------------
-
-void Delete_Msg_File ( void )
-{
- DWORD nBytes;
- char buff [ 300 ];
- char date [ 50 ];
- char time [ 30 ];
- StandardFileClass file;
-
- //----------------------------------------------------------------------
- // Make path to debug file.
- //----------------------------------------------------------------------
-// strcat( strcpy( DebugFile, ".\\" ), DEBUG_FILE );
- GetWindowsDirectory( DebugFile, MAX_PATH );
- if ( DebugFile[ strlen( DebugFile )-1 ] != '\\' ) {
- strcat( DebugFile, "\\" );
- }
- strcat( DebugFile, DEBUG_FILE );
-
- //--------------------------------------------------------------------------
- // Delete previous file.
- //--------------------------------------------------------------------------
- DeleteFile( DebugFile );
-
- //--------------------------------------------------------------------------
- // Create/Open new file.
- //--------------------------------------------------------------------------
- file.Open( DebugFile, MODE_WRITE_TRUNCATE );
- if ( file.Query_Open( )) {
-
- wsprintf( buff, "===========================================================\r\n" );
- nBytes = file.Write( buff, strlen( buff ));
-
- GetDateFormat( LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, date, 50 );
-// GetTimeFormat( LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, time, 30 );
- GetTimeFormat( LOCALE_USER_DEFAULT, NULL, NULL, "hh':'mm':'ss tt", time, 30 );
- wsprintf( buff, "SETUP: File: %s Date: %s Time: %s.\r\n", DebugFile, date, time );
- nBytes = file.Write( buff, strlen( buff ));
-
- wsprintf( buff, "===========================================================\r\n\r\n" );
- nBytes = file.Write( buff, strlen( buff ));
-
- file.Close();
- }
-}
-
-#endif
-
-
-//------------------------------------------------------------------------------
-// StandardFileClass::StandardFileClass
-//------------------------------------------------------------------------------
-
-StandardFileClass::StandardFileClass( void )
-{
- //
- // reset all internal data
- //
- Reset();
-}
-
-//------------------------------------------------------------------------------
-// StandardFileClass::~StandardFileClass
-//------------------------------------------------------------------------------
-
-StandardFileClass::~StandardFileClass( void )
-{
- //
- // make sure this file got shut down before we destruct
- //
- #if( SUPPORT_HANDLES )
- ASSERT( File_Handle == INVALID_FILE_HANDLE );
- #endif
- #if( SUPPORT_STREAMS )
- ASSERT( File_Stream_Ptr == NULL );
- #endif
- ASSERT( Currently_Open == FALSE );
-
- //
- // reset all internal data
- //
- Reset();
-}
-
-//------------------------------------------------------------------------------
-// bool StandardFileClass::Open
-//------------------------------------------------------------------------------
-
-bool StandardFileClass::Open( const char *no_path_file_name, int open_mode )
-{
- int test;
- const char *attributes;
- char pathed_file_name[ MAX_PATH_SIZE ];
-
- //
- // debug checks...
- //
- ASSERT( no_path_file_name != NULL );
- ASSERT( Currently_Open == FALSE );
- ASSERT( strlen( no_path_file_name ) < MAX_PATH );
- ASSERT( open_mode == MODE_READ_ONLY ||
- open_mode == MODE_WRITE_ONLY ||
- open_mode == MODE_READ_AND_WRITE ||
- open_mode == MODE_WRITE_TRUNCATE ||
- open_mode == MODE_WRITE_APPEND );
-
- //
- // open the file
- //
- #if( SUPPORT_HANDLES )
-
- ASSERT( File_Handle == INVALID_FILE_HANDLE );
-
- //
- // try HD open
- //
- strcpy( pathed_file_name, HD_Path );
- strcat( pathed_file_name, no_path_file_name );
- File_Handle = Open_File( pathed_file_name, open_mode );
-
- //
- // if not success with HD open, try CD
- //
- if ( File_Handle == INVALID_FILE_HANDLE ) {
-
- //
- // try CD open
- //
- strcpy( pathed_file_name, CD_Path );
- strcat( pathed_file_name, no_path_file_name );
- File_Handle = Open_File( pathed_file_name, open_mode );
- }
-
- //
- // not successful HD or CD open?
- //
- if ( File_Handle == INVALID_FILE_HANDLE ) {
- ASSERT( FALSE );
- return( FALSE );
- }
-
- #endif
-
- #if( SUPPORT_STREAMS )
-
- ASSERT( File_Stream_Ptr == NULL );
-
- //
- // "r" - open existing file for reading.
- // "w" - create new file, or truncate existing one, for output.
- // "a" - create new file, or append to if existing, for output.
- // "r+" - open existing file for read and write, starting at beginning of file. File must exist.
- // "w+" - create new file, or truncate if existing, for read and write.
- // "a+" - create new file, or append to existing, for read and write.
- //
- // add "b" to any string for binary instead of text
- //
- if ( open_mode == MODE_READ_ONLY ) {
- //
- // open existing file for input (binary)
- //
- attributes = "rb";
- }
- else if ( open_mode == MODE_WRITE_ONLY || open_mode == MODE_WRITE_TRUNCATE ) {
- //
- // create new or open/truncate existing file for output (binary)
- //
- attributes = "wb";
- }
- else if ( open_mode == MODE_READ_AND_WRITE ) {
- //
- // open existing for for read and write, starting at beginning of file
- //
- attributes = "r+b";
- }
- else if ( open_mode == MODE_WRITE_UPDATE ) {
- //
- // Create a new file for update (reading and writing). If a file by
- // that name already exists, it will be overwritten.
- //
- attributes = "w+b";
- }
- else if ( open_mode == MODE_WRITE_APPEND ) {
- //
- // append to existing file for output (binary)
- //
- attributes = "a";
- }
- else {
- ASSERT( FALSE );
- }
-
- //
- // try HD open
- //
- strcpy( pathed_file_name, HD_Path );
- strcat( pathed_file_name, no_path_file_name );
- File_Stream_Ptr = fopen( pathed_file_name, attributes );
-
- //
- // if not success with HD open, try CD
- //
- if ( File_Stream_Ptr == NULL ) {
-
- //
- // try CD open
- //
- strcpy( pathed_file_name, CD_Path );
- strcat( pathed_file_name, no_path_file_name );
- File_Stream_Ptr = fopen( pathed_file_name, attributes );
- }
-
- //
- // not successful?
- //
- if ( File_Stream_Ptr == NULL ) {
- return( FALSE );
- }
-
- //
- // get file stats
- //
- test = stat( pathed_file_name, &File_Statistics );
- ASSERT( test == 0 );
-
- #endif
-
- //
- // successful, set name and open status
- //
- strncpy( File_Name, pathed_file_name, MAX_PATH_SIZE-1 );
- Currently_Open = TRUE;
-
- //
- // success!
- //
- return( TRUE );
-}
-
-//------------------------------------------------------------------------------
-// bool StandardFileClass::Close
-//------------------------------------------------------------------------------
-
-bool StandardFileClass::Close( void )
-{
- int status;
-
- #if( SUPPORT_HANDLES )
- bool success;
- #endif
-
- //
- // debug checks...
- //
- ASSERT( Currently_Open == TRUE );
-
- #if( SUPPORT_HANDLES )
-
- ASSERT( File_Handle > INVALID_FILE_HANDLE );
-
- //
- // error?
- //
- if ( File_Handle == INVALID_FILE_HANDLE || Currently_Open == FALSE ) {
- //
- // no success
- //
- ASSERT( FALSE );
- return( FALSE );
- }
-
- //
- // close file
- //
- // status = Close_File( File_Handle );
- success = Close_File( File_Handle );
- ASSERT( success == TRUE );
-
- //
- // reset file data
- //
- File_Handle = INVALID_FILE_HANDLE;
- Currently_Open = FALSE;
-
- //
- // error on close?
- //
- // if ( status == INVALID_FILE_HANDLE ) {
- // return( FALSE );
- // }
- return( success );
-
- #endif
-
- #if( SUPPORT_STREAMS )
-
- ASSERT( File_Stream_Ptr != NULL );
-
- //
- // error?
- //
- if ( File_Stream_Ptr == NULL || Currently_Open == FALSE ) {
- //
- // no success
- //
- ASSERT( FALSE );
- return( FALSE );
- }
-
- //
- // close file
- //
- status = fclose( File_Stream_Ptr );
- ASSERT( status == 0 );
-
- //
- // reset file data
- //
- File_Stream_Ptr = NULL;
- Currently_Open = FALSE;
-
- //
- // error on close?
- //
- if ( status != 0 ) {
- return( FALSE );
- }
- #endif
-
- //
- // success!
- //
- return( TRUE );
-}
-
-//------------------------------------------------------------------------------
-// int StandardFileClass::Read
-//------------------------------------------------------------------------------
-int StandardFileClass::Read( void *buffer, unsigned long int bytes_to_read )
-{
- int bytes_read;
- int items_read;
-
- //
- // debug checks ( Fails if condition is FALSE ).
- //
- ASSERT( buffer != NULL );
- ASSERT( bytes_to_read > 0 );
- ASSERT( Currently_Open == TRUE );
-
-#if( SUPPORT_HANDLES )
-
- ASSERT( File_Handle != INVALID_FILE_HANDLE );
- //
- // error?
- //
- if ( File_Handle == INVALID_FILE_HANDLE || Currently_Open == FALSE ) {
- //
- // nothing read
- //
- return( 0 );
- }
-
- //
- // read in the bytes
- //
- bytes_read = Read_File( File_Handle, buffer, bytes_to_read );
-#endif
-
-#if( SUPPORT_STREAMS )
-
- ASSERT( File_Stream_Ptr != NULL );
- //
- // error?
- //
- if ( File_Stream_Ptr == NULL || Currently_Open == FALSE ) {
- //
- // nothing read
- //
- return( 0 );
- }
-
- //
- // read in the bytes
- //
- items_read = fread( buffer, bytes_to_read, 1, File_Stream_Ptr );
-// Msg( __LINE__, __FILE__, "Read --- bytes_to_read = %d, items_read = %d.", bytes_to_read, items_read );
-
- //
- // &&& we should leave this enabled!
- //
- // The TRR system causes an error when we load strings into RAM
- // IF the strings are kept on disk, then no error occurs!
- //
- ASSERT( items_read == 1 );
-
- bytes_read = items_read * bytes_to_read;
-#endif
-
- //
- // return how many bytes we read
- //
- return( bytes_read );
-}
-
-//------------------------------------------------------------------------------
-// int StandardFileClass::Write
-//------------------------------------------------------------------------------
-
-int StandardFileClass::Write( void *buffer, unsigned long int bytes_to_write )
-{
- int items_written;
- int bytes_written;
-
- //
- // debug checks
- //
- ASSERT( buffer != NULL );
- ASSERT( bytes_to_write > 0 );
- ASSERT( Currently_Open == TRUE );
-
- if ( buffer == NULL ) {
- return( 0 );
- }
- if ( bytes_to_write < 1 ) {
- return( 0 );
- }
-
- #if( SUPPORT_HANDLES )
-
- ASSERT( File_Handle != INVALID_FILE_HANDLE );
-
- //
- // error?
- //
- if ( File_Handle == INVALID_FILE_HANDLE || Currently_Open == FALSE ) {
- //
- // nothing written
- //
- return( 0 );
- }
-
- //
- // write out the bytes
- //
- bytes_written = Write_File( File_Handle, buffer, bytes_to_write );
- ASSERT( bytes_written == bytes_to_write );
- #endif
-
- #if( SUPPORT_STREAMS )
-
- ASSERT( File_Stream_Ptr != NULL );
- //
- // error?
- //
- if ( File_Stream_Ptr == NULL || Currently_Open == FALSE ) {
- //
- // nothing written
- //
- return( 0 );
- }
-
- //
- // write out the bytes
- //
- items_written = fwrite( buffer, bytes_to_write, 1, File_Stream_Ptr );
- ASSERT( items_written == 1 );
- bytes_written = items_written * bytes_to_write;
- #endif
-
- //
- // return how many bytes we wrote
- //
- return( bytes_written );
-}
-
-//------------------------------------------------------------------------------
-// bool StandardFileClass::Seek
-//------------------------------------------------------------------------------
-
-bool StandardFileClass::Seek( int distance, int seek_file_position )
-{
- //
- // debug checks...
- //
- ASSERT( Currently_Open == TRUE );
- ASSERT( seek_file_position == SEEK_SET ||
- seek_file_position == SEEK_CUR ||
- seek_file_position == SEEK_END );
-
- #if( SUPPORT_HANDLES )
-
- bool success;
-
- ASSERT( File_Handle != INVALID_FILE_HANDLE );
- //
- // error?
- //
- if ( File_Handle == INVALID_FILE_HANDLE || Currently_Open == FALSE ) {
- //
- // error
- //
- return( FALSE );
- }
-
- //
- // do the seek!
- //
- success = Seek_File( File_Handle, distance, seek_file_position );
- ASSERT( success == TRUE );
- return( success );
- #endif
-
- #if( SUPPORT_STREAMS )
-
- ASSERT( File_Stream_Ptr != NULL );
-
- //
- // error?
- //
- if ( File_Stream_Ptr == NULL || Currently_Open == FALSE ) {
- //
- // error
- //
- return( FALSE );
- }
-
- //
- // do the seek!
- //
- int result = fseek( File_Stream_Ptr, distance, seek_file_position );
-
- ASSERT( result == 0 );
- if ( ! result ) {
- return( TRUE );
- }
- return( FALSE );
- #endif
-}
-
-//------------------------------------------------------------------------------
-// int StandardFileClass::Tell
-//------------------------------------------------------------------------------
-//
-// return file position
-//
-int StandardFileClass::Tell( void )
-{
- int file_pos;
-
- //
- // debug checks...
- //
- ASSERT( Currently_Open == TRUE );
-
- #if( SUPPORT_HANDLES )
-
- ASSERT( File_Handle != INVALID_FILE_HANDLE );
- //
- // error?
- //
- if ( File_Handle == INVALID_FILE_HANDLE || Currently_Open == FALSE ) {
- //
- // error
- //
- return( -1 );
- }
-
- //
- // do the tell
- //
- file_pos = Tell_File( File_Handle );
-
- ASSERT( file_pos != -1 );
- return( file_pos );
-
- #endif
-
- #if( SUPPORT_STREAMS )
-
- ASSERT( File_Stream_Ptr != NULL );
- //
- // error?
- //
- if ( File_Stream_Ptr == NULL || Currently_Open == FALSE ) {
- //
- // error
- //
- return( -1 );
- }
-
- //
- // do the tell!
- //
- file_pos = ftell( File_Stream_Ptr );
-
- ASSERT( file_pos != -1 );
- return( file_pos );
-
- #endif
-}
-
-//------------------------------------------------------------------------------
-// int StandardFileClass::Query_Size
-//------------------------------------------------------------------------------
-
-int StandardFileClass::Query_Size( void )
-{
- int size;
-
- //
- // debug checks...
- //
- ASSERT( Currently_Open == TRUE );
-
- #if( SUPPORT_HANDLES )
-
- ASSERT( File_Handle != INVALID_FILE_HANDLE );
- //
- // error?
- //
- if ( File_Handle == INVALID_FILE_HANDLE || Currently_Open == FALSE ) {
- //
- // error
- //
- return( -1 );
- }
-
- size = File_Size( File_Handle );
- ASSERT( size > -1 );
- #endif
-
- #if( SUPPORT_STREAMS )
- ASSERT( File_Stream_Ptr != NULL );
- //
- // error?
- //
- if ( File_Stream_Ptr == NULL || Currently_Open == FALSE ) {
- //
- // error
- //
- return( -1 );
- }
-
- size = File_Statistics.st_size;
- ASSERT( size > -1 );
- #endif
-
- return( size );
-}
-
-//------------------------------------------------------------------------------
-// int StandardFileClass::Query_Size
-//------------------------------------------------------------------------------
-
-bool StandardFileClass::Query_Open( void )
-{
- return( Currently_Open );
-}
-
-//------------------------------------------------------------------------------
-// char *StandardFileClass::Query_Name_String
-//------------------------------------------------------------------------------
-
-char *StandardFileClass::Query_Name_String( void )
-{
- return( File_Name );
-}
-
-
-#if( SUPPORT_STREAMS )
-
-//------------------------------------------------------------------------------
-// FILE *StandardFileClass::Query_File_Stream_Pointer
-//------------------------------------------------------------------------------
-
-FILE *StandardFileClass::Query_File_Stream_Pointer( void )
-{
- return( File_Stream_Ptr );
-}
-
-#endif
-
-//------------------------------------------------------------------------------
-// private file class functions...
-//------------------------------------------------------------------------------
-
-
-//------------------------------------------------------------------------------
-// void StandardFileClass::Reset
-//------------------------------------------------------------------------------
-
-void StandardFileClass::Reset( void )
-{
- //
- // reset all internal data
- //
- #if( SUPPORT_HANDLES )
- File_Handle = INVALID_FILE_HANDLE;
- #endif
- #if( SUPPORT_STREAMS )
- File_Stream_Ptr = NULL;
- #endif
- Currently_Open = FALSE;
- File_Name[ 0 ] = '\0';
-}
-
-
-int StandardFileClass::End_Of_File ( void )
-{
- #if( SUPPORT_HANDLES )
- return( TRUE );
- #endif
-
- #if( SUPPORT_STREAMS )
- ASSERT( File_Stream_Ptr != NULL );
- if ( File_Stream_Ptr == NULL || Currently_Open == FALSE ) {
- return( -1 );
- }
- return( feof( File_Stream_Ptr ));
- #endif
-}
-
-int StandardFileClass::Flush ( void )
-{
- #if( SUPPORT_STREAMS )
- ASSERT( File_Stream_Ptr != NULL );
- if ( File_Stream_Ptr == NULL || Currently_Open == FALSE ) {
- return( -1 );
- }
- return( fflush( File_Stream_Ptr ));
- #endif
-}
-
-
-//------------------------------------------------------------------------------
-// non-class public functions from wnd_file.h
-//------------------------------------------------------------------------------
-
-#if( SUPPORT_HANDLES )
-
-//------------------------------------------------------------------------------
-// int Open_File
-//------------------------------------------------------------------------------
-
-// &&& - if enabled, must handle read and write combined
-
-HANDLE Open_File( char const *file_name, int mode )
-{
- HANDLE windows_file_handle;
- DWORD access;
- DWORD creation;
- DWORD share;
- // int fh;
-
- //
- // debug checks...
- //
- ASSERT( file_name != NULL );
- // ASSERT( mode == READ || mode == WRITE );
- ASSERT( mode == MODE_READ_ONLY ||
- mode == MODE_WRITE_ONLY ||
- mode == MODE_READ_AND_WRITE );
-
- //
- // get an available file handle
- //
- // fh = Get_Internal_File_Handle();
- // ASSERT( fh > INVALID_FILE_HANDLE );
- // if ( fh == INVALID_FILE_HANDLE ) {
- // return( INVALID_FILE_HANDLE );
- // }
-
- //
- // set the attributes based on read or write for the open
- //
- // if ( mode == READ ) {
- if ( mode == MODE_READ_ONLY ) {
- access = GENERIC_READ;
- share = FILE_SHARE_READ;
- creation = OPEN_EXISTING;
- }
- // else if ( mode == WRITE ) {
- else if ( mode == MODE_WRITE_ONLY ) {
- access = GENERIC_WRITE;
- share = 0;
- creation = CREATE_ALWAYS;
- }
- else if ( mode == MODE_READ_AND_WRITE ) {
- //
- // &&& are these correct?
- //
- access = GENERIC_READ | GENERIC_WRITE;
- share = FILE_SHARE_READ | FILE_SHARE_WRITE;
- creation = OPEN_EXISTING;
- }
- else {
- //
- // error;
- //
- ASSERT( FALSE );
- }
-
- //
- // 32-bit open file
- //
- windows_file_handle = CreateFile( file_name,
- access,
- share,
- NULL,
- creation,
- FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
- NULL );
- //
- // error?
- //
- // we don't want to assert because we may be looking for a file
- // to just see if it is there...
- //
- // ASSERT( windows_file_handle != INVALID_HANDLE_VALUE );
- //
- // error!
- //
- if ( windows_file_handle == INVALID_HANDLE_VALUE ) {
- // #if( _DEBUG )
- // Debug_Printf( "%s: Create file error is %d\r\n", file_name, GetLastError());
- // #endif
- return( INVALID_FILE_HANDLE );
- }
-
- //
- // store the windows handle
- //
- // Windows_File_Handles[ fh ] = windows_file_handle;
- //
- // return our internal file handle
- //
- // return( fh );
-
- //
- // &&& this should be HANDLE, not int
- //
- // return( windows_file_handle );
- return( windows_file_handle );
-}
-
-//------------------------------------------------------------------------------
-// int Close_File
-//------------------------------------------------------------------------------
-
-bool Close_File( HANDLE handle )
-{
- bool success;
-
- //
- // debug checks...
- //
- // ASSERT( handle > INVALID_FILE_HANDLE );
- // ASSERT( Windows_File_Handles[ handle ] != NULL );
- ASSERT( handle != INVALID_FILE_HANDLE );
-
- //
- // close the file
- //
- // success = CloseHandle( Windows_File_Handles[ handle ] );
- //
- // &&& - this should be an actual HANDLE
- //
- success = CloseHandle( (HANDLE) handle );
- ASSERT( success == TRUE );
-
- // Debug_Printf( "File %d closed.\r\n", handle );
-
- //
- // free the entry
- //
- // Windows_File_Handles[ handle ] = NULL;
-
- //
- // return success or not
- //
- // if ( success == TRUE ) {
- // //
- // // return the invalid handle that closed
- // //
- // return( handle );
- // }
- // //
- // // error
- // //
- // return( INVALID_FILE_HANDLE );
- return( success );
-}
-
-//------------------------------------------------------------------------------
-// int Read_File
-//------------------------------------------------------------------------------
-
-int Read_File( HANDLE handle, void *buffer, unsigned long int bytes_to_read )
-{
- bool success;
- DWORD bytes_actually_read;
-
- //
- // debug checks...
- //
- ASSERT( handle > INVALID_FILE_HANDLE );
- ASSERT( buffer != NULL );
- // ASSERT( bytes_to_read > 0 );
- // ASSERT( Windows_File_Handles[ handle ] != NULL );
-
- // Debug_Printf( "Reading file %d\r\n", handle );
-
- // success = ReadFile( Windows_File_Handles[ handle ],
- // (void *) buffer,
- // (DWORD) bytes_to_read,
- // (DWORD *) &bytes_actually_read,
- // NULL );
-
- //
- // &&& use real HANDLE
- //
- success = ReadFile( (HANDLE) handle,
- (void *) buffer,
- (DWORD) bytes_to_read,
- (DWORD *) &bytes_actually_read,
- NULL );
-
- ASSERT( success == TRUE );
-
- if ( success == FALSE ) {
- //
- // no bytes read
- //
- return( 0 );
- }
-
- return( bytes_actually_read );
-}
-
-//------------------------------------------------------------------------------
-// int Write_File
-//------------------------------------------------------------------------------
-
-int Write_File( HANDLE handle, void const *buffer, unsigned long int bytes_to_write )
-{
- bool success;
- DWORD bytes_actually_written;
-
- //
- // debug checks...
- //
- ASSERT( handle != INVALID_FILE_HANDLE );
- ASSERT( buffer != NULL );
- // ASSERT( bytes_to_write > 0 );
- // ASSERT( Windows_File_Handles[ handle ] != NULL );
-
- // Debug_Printf( "Writing file %d\r\n", handle );
-
- // success = WriteFile( Windows_File_Handles[ handle ],
- // buffer,
- // (DWORD) bytes_to_write,
- // (DWORD *) &bytes_actually_written,
- // NULL );
-
- //
- // &&& make this a real handle
- //
- success = WriteFile( (HANDLE) handle,
- buffer,
- (DWORD) bytes_to_write,
- (DWORD *) &bytes_actually_written,
- NULL );
-
- ASSERT( success == TRUE );
- ASSERT( bytes_actually_written == bytes_to_write );
-
- if ( success == FALSE ) {
- //
- // no bytes written
- //
- return( 0 );
- }
-
- return( bytes_actually_written );
-}
-
-//------------------------------------------------------------------------------
-// bool Seek_File
-//------------------------------------------------------------------------------
-
-bool Seek_File( HANDLE handle, int distance, int seek_file_location )
-{
- DWORD success;
- int move_method;
-
- //
- // debug checks...
- //
- ASSERT( handle != INVALID_FILE_HANDLE );
- // ASSERT( distance >= 0 );
- ASSERT( seek_file_location == SEEK_SET ||
- seek_file_location == SEEK_CUR ||
- seek_file_location == SEEK_END );
- // ASSERT( Windows_File_Handles[ handle ] != NULL );
-
- //
- // set the seek movement method
- //
- if ( seek_file_location == SEEK_SET ) {
- move_method = FILE_BEGIN;
- }
- else if ( seek_file_location == SEEK_CUR ) {
- move_method = FILE_CURRENT;
- }
- else if ( seek_file_location == SEEK_END ) {
- move_method = FILE_END;
- }
-
- // success = SetFilePointer( Windows_File_Handles[ handle ],
- // distance,
- // NULL,
- // move_method );
-
- //
- // make this a real handle
- //
- success = SetFilePointer( (HANDLE) handle,
- distance,
- NULL,
- move_method );
-
- if ( success == 0xFFFFFFFF ) {
- return( FALSE );
- }
- return( TRUE );
-}
-
-//------------------------------------------------------------------------------
-// int Tell_File
-//------------------------------------------------------------------------------
-
-int Tell_File( HANDLE handle )
-{
- int move_method;
- int pos;
-
- //
- // debug checks...
- //
- ASSERT( handle != INVALID_FILE_HANDLE );
- // ASSERT( Windows_File_Handles[ handle ] != NULL );
-
- //
- // set the seek movement method
- //
- move_method = FILE_CURRENT;
-
- //
- // move nowhere
- //
- pos = SetFilePointer( handle,
- 0, // distance to move
- NULL,
- move_method );
-
- if ( pos == 0xFFFFFFFF ) {
- return( -1 );
- }
- return( pos );
-}
-
-//------------------------------------------------------------------------------
-// int File_Size
-//------------------------------------------------------------------------------
-
-int File_Size( HANDLE handle )
-{
- DWORD file_size;
-
- //
- // debug checks...
- //
- ASSERT( handle != INVALID_FILE_HANDLE );
- // ASSERT( Windows_File_Handles[ handle ] != NULL );
-
- file_size = GetFileSize( handle, NULL );
- ASSERT( file_size != 0xFFFFFFFF );
-
- //
- // error!
- //
- if ( file_size == 0xFFFFFFFF ) {
- return( -1 );
- }
-
- //
- // return size
- //
- return( (int) file_size );
-}
-
-//------------------------------------------------------------------------------
-// bool Full_Path_File_Exists
-//------------------------------------------------------------------------------
-
-bool Full_Path_File_Exists( char const *file_name )
-{
- HANDLE fh;
-
- //
- // debug checks...
- //
- ASSERT( file_name != NULL );
-
- //
- // if we can open the file for read, it exists...
- //
- fh = Open_File( file_name, MODE_READ_ONLY );
- //
- // don't assert, because the we might be checking for a file
- // that actually does not exist!
- //
- // ASSERT( fh > INVALID_FILE_HANDLE );
-
- //
- // close the file and return success if opened
- //
- if ( fh != INVALID_FILE_HANDLE ) {
- Close_File( fh );
- return( TRUE );
- }
-
- //
- // no success if file was not opened
- //
- return( FALSE );
-}
-
-//------------------------------------------------------------------------------
-// bool HD_File_Exists
-//------------------------------------------------------------------------------
-
-bool HD_File_Exists( char const *file_name )
-{
- HANDLE fh;
- char full_path[ MAX_PATH_SIZE ];
-
- //
- // debug checks...
- //
- ASSERT( file_name != NULL );
- strcpy( full_path, HD_Path );
- strcat( full_path, file_name );
-
- //
- // if we can open the file for read, it exists...
- //
- fh = Open_File( full_path, MODE_READ_ONLY );
- //
- // don't assert, because the we might be checking for a file
- // that actually does not exist!
- //
-
- //
- // close the file and return success if opened
- //
- if ( fh != INVALID_FILE_HANDLE ) {
- Close_File( fh );
- return( TRUE );
- }
-
- //
- // no success if file was not opened
- //
- return( FALSE );
-}
-
-//------------------------------------------------------------------------------
-// bool CD_File_Exists
-//------------------------------------------------------------------------------
-
-bool CD_File_Exists( char const *file_name )
-{
- HANDLE fh;
- char full_path[ MAX_PATH_SIZE ];
-
- //
- // debug checks...
- //
- ASSERT( file_name != NULL );
- strcpy( full_path, CD_Path );
- strcat( full_path, file_name );
-
- //
- // if we can open the file for read, it exists...
- //
- fh = Open_File( full_path, MODE_READ_ONLY );
- //
- // don't assert, because the we might be checking for a file
- // that actually does not exist!
- //
-
- //
- // close the file and return success if opened
- //
- if ( fh != INVALID_FILE_HANDLE ) {
- Close_File( fh );
- return( TRUE );
- }
-
- //
- // no success if file was not opened
- //
- return( FALSE );
-}
-
-#if( 0 )
-//------------------------------------------------------------------------------
-// bool Find_File
-//------------------------------------------------------------------------------
-bool Find_File( char const *file_name )
-{
- return( File_Exists( file_name ) );
-}
-#endif
-
-#if( 0 )
-//------------------------------------------------------------------------------
-// int Get_Internal_File_Handle
-//------------------------------------------------------------------------------
-//
-// private...
-//
-int Get_Internal_File_Handle( void )
-{
- static bool _initialized = FALSE;
- int i;
-
- //
- // initialize file handle table once!
- //
- if ( ! _initialized ) {
- for ( i = 0; i < MAX_FILES_OPEN_AT_A_TIME; i ++ ) {
- Windows_File_Handles[ i ] = NULL;
- }
- _initialized = TRUE;
- }
-
- //
- // look for free slot
- //
- for ( i = 0; i < MAX_FILES_OPEN_AT_A_TIME; i ++ ) {
- if ( Windows_File_Handles[ i ] == NULL ) {
- return( i );
- }
- }
-
- //
- // no free slot found
- //
- ASSERT( FALSE );
- return( INVALID_FILE_HANDLE );
-}
-#endif
-
-
-#endif // SUPPORT_HANDLES
-
-#if( SUPPORT_STREAMS )
-
-//------------------------------------------------------------------------------
-// bool Full_Path_File_Exists
-//------------------------------------------------------------------------------
-
-bool Full_Path_File_Exists( char const *file_name )
-{
- FILE *file_stream_ptr;
-
- file_stream_ptr = fopen( file_name, "rb" );
- if ( file_stream_ptr != NULL ) {
- fclose( file_stream_ptr );
- return( TRUE );
- }
- return( FALSE );
-}
-
-//------------------------------------------------------------------------------
-// bool HD_File_Exists
-//------------------------------------------------------------------------------
-
-bool HD_File_Exists( char const *file_name )
-{
- FILE *file_stream_ptr;
- char full_path[ MAX_PATH_SIZE ];
-
- //
- // debug checks...
- //
- ASSERT( file_name != NULL );
-
- strcpy( full_path, HD_Path );
- strcat( full_path, file_name );
-
- file_stream_ptr = fopen( full_path, "rb" );
- if ( file_stream_ptr != NULL ) {
- fclose( file_stream_ptr );
- return( TRUE );
- }
- return( FALSE );
-}
-
-//------------------------------------------------------------------------------
-// bool CD_File_Exists
-//------------------------------------------------------------------------------
-
-bool CD_File_Exists( char const *file_name )
-{
- FILE *file_stream_ptr;
- char full_path[ MAX_PATH_SIZE ];
-
- //
- // debug checks...
- //
- ASSERT( file_name != NULL );
-
- strcpy( full_path, CD_Path );
- strcat( full_path, file_name );
-
- file_stream_ptr = fopen( full_path, "rb" );
- if ( file_stream_ptr != NULL ) {
- fclose( file_stream_ptr );
- return( TRUE );
- }
- return( FALSE );
-}
-
-
-#if( 0 )
-//------------------------------------------------------------------------------
-// bool Find_File
-//------------------------------------------------------------------------------
-bool Find_File( char const *file_name )
-{
- return( File_Exists( file_name ) );
-}
-#endif
-
-#endif // SUPPORT_STREAMS
-
diff --git a/Generals/Code/Tools/Autorun/autorun.cpp b/Generals/Code/Tools/Autorun/autorun.cpp
deleted file mode 100644
index 76c21d25ed5..00000000000
--- a/Generals/Code/Tools/Autorun/autorun.cpp
+++ /dev/null
@@ -1,5470 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/****************************************************************************
- ** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ****************************************************************************
- * *
- * Project Name : Autorun *
- * *
- * File Name : AUTORUN.CPP *
- * *
- * Programmers: Maria del Mar McCready Legg *
- * *
- * Start Date : September 5, 1997 *
- * *
- * Last Update : October 15, 2001 [MML] *
- * *
- *--------------------------------------------------------------------------*
- * Functions: *
- * WinMain *
- * Main::MessageLoop *
- * MainWindow::Register *
- * MainWindow::MainWindow *
- * MainWindow::Window_Proc *
- * MainWindow::Is_Product_Registered *
- * MainWindow::Run_Explorer *
- * MainWindow::Run_Game *
- * MainWindow::Run_Setup *
- * MainWindow::Run_New_Account *
- * MainWindow::Run_Register *
- * MainWindow::Run_Auto_Update *
- * MainWindow::Run_Uninstall *
- * MainWindow::Create_Buttons *
- * Wnd_Proc *
- * Dialog_Box_Proc *
- * Stop_Sound_Playing *
- * Options *
- * Valid_Environment *
- * LoadResourceBitmap *
- * CreateDIBPalette *
- * LoadResourceButton *
- * Cant_Find_MessageBox *
- * Error_Message *
- * Path_Add_Back_Slash *
- * Path_Remove_Back_Slash *
- * PlugInProductName *
- * Fix_Single_Ampersands *
- * Fix_Double_Ampersands *
- * LaunchObjectClass::LaunchObjectClass *
- * LaunchObjectClass::SetPath *
- * LaunchObjectClass::SetArgs *
- * LaunchObjectClass::Launch *
- *--------------------------------------------------------------------------*/
-
-
-#define STRICT
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "ARGS.H"
-#include "autorun.h"
-#include "DrawButton.h"
-#include "resource.h"
-#include "Wnd_File.h"
-//#include "visualc.h"
-#include "WinFix.H"
-#include "CDCNTRL.H"
-#include "IGR.h"
-#include "ViewHTML.h"
-
-#include "Utils.h"
-#include "Locale_API.h"
-//#include "resources.h"
-#include "GetCD.h"
-
-#include "WSYS_FileSystem.h"
-#include "WSYS_StdFileSystem.h"
-
-#include
-#include "GameText.h"
-
-#include "leanAndMeanAutorun.h"
-
-#ifndef LEAN_AND_MEAN
-#include "Common/SubsystemInterface.h"
-#include "GameClient/GameText.h"
-#include "Common/UnicodeString.h"
-#include "Win32Device/Common/Win32LocalFileSystem.h"
-#include "Win32Device/Common/Win32BIGFileSystem.h"
-#endif
-
-//-----------------------------------------------------------------------------
-// DEFINES
-//-----------------------------------------------------------------------------
-#define PRETEND_ON_CD_TEST FALSE // should be FALSE
-//#define PRETEND_ON_CD_TEST TRUE // should be FALSE
-
-#define WINDOW_BRUSH FALSE
-#define BACKGROUND_BITMAP TRUE
-#define USE_MOUSE_MOVES TRUE
-#define DISABLE_KEYBOARD FALSE
-
-#define BUTTON_WIDTH 150
-#define BUTTON_HEIGHT 45
-#define NUM_BUTTONS 10
-#define NUM_ARGUMENTS 10
-#define NUM_SONGS 2 //32 //16
-#define NUM_FLICKER_FRAMES 1
-#define NUM_FLICKER_POSITIONS 15
-
-#define MOUSE_WAV "MouseMove"
-#define SOUND_FILE1 "SPEECH_FILE1"
-#define SOUND_FILE2 "SPEECH_FILE2"
-
-#define MOH_DEMO_PROGRAM "MOHAADEMO\\SETUP.EXE"
-#define SHOW_MOH_DEMO FALSE
-
-#define BFAVI_FILENAME "Autorun\\BF1942RTR.avi"
-#define SC4AVI_FILENAME "Autorun\\Preview.avi"
-#define HELP_FILENAME "HELP:FILENAME"//"Support\\eahelp.hlp"
-
-#define SHOW_GAMESPY_BUTTON FALSE
-#define GAMESPY_WEBSITE "http://www.gamespyarcade.com/features/launch.asp?svcname=ccrenegade&distID=391"
-
-#define RESOURCE_FILE "Autorun.loc"
-#define SETUP_INI_FILE1 "Setup\\Setup.ini"
-#define SETUP_INI_FILE2 "Setup.ini"
-
-#define UNINSTALL_EXECUTABLE "IDriver.exe" // JFS
-
-//-----------------------------------------------------------------------------
-// These defines need the Product name from Setup.ini to complete.
-//-----------------------------------------------------------------------------
-#define SETUP_MAIN_WINDOW_NAME "%s Setup"
-#define CLASS_NAME "%s Autorun"
-#define GAME_MAIN_WINDOW_NAME "%s Game Window"
-
-//#define GAME_WEBSITE "http://www.westwood.com/"
-#define GAME_WEBSITE "http://generals.ea.com"
-
-#define AUTORUN_MUTEX_OBJECT "01AF9993-3492-11d3-8F6F-0060089C05B1"
-//#define GAME_MUTEX_OBJECT "C6D925A3-7A9B-4ca3-866D-8B4D506C3665"
-#define GAME_MUTEX_OBJECT "685EAFF2-3216-4265-B047-251C5F4B82F3"
-#define PRODUCT_VOLUME_CD1 "Generals1"
-#define PRODUCT_VOLUME_CD2 "Generals2"
-
-
-//-----------------------------------------------------------------------------
-// Global Variables
-//-----------------------------------------------------------------------------
-LaunchObjectClass LaunchObject;
-MainWindow *GlobalMainWindow = NULL;
-int Language = 0;
-int LanguageToUse = 0;
-
-DrawButton *ButtonList [ NUM_BUTTONS ];
-RECT ButtonSizes [ NUM_BUTTONS ];
-char ButtonImages [ NUM_BUTTONS ][ MAX_PATH ];
-CHAR szSongPath [ MAX_PATH ];
-char FocusedButtonImages [ NUM_BUTTONS ][ MAX_PATH ];
-char Arguments [ NUM_ARGUMENTS ][ 30 ];
-char szWavs [ NUM_SONGS][ _MAX_PATH ];
-char szBuffer [ MAX_PATH ];
-char szBuffer1 [ MAX_PATH ];
-char szBuffer2 [ MAX_PATH ];
-char szBuffer3 [ MAX_PATH * 2];
-char szInternetPath [_MAX_PATH];
-char szGamePath [_MAX_PATH];
-char szWorldbuilderPath [_MAX_PATH];
-char szPatchgetPath [_MAX_PATH];
-char szSetupPath [_MAX_PATH];
-char szUninstallPath [_MAX_PATH];
-char szUninstallCommandLine[_MAX_PATH]; // JFS: Returned value contains parameters needed.
-char szRegisterPath [_MAX_PATH];
-char szButtonWav [_MAX_PATH ];
-char szSpeechWav [_MAX_PATH ];
-char szArgvPath [_MAX_PATH ];
-char drive [_MAX_DRIVE];
-char dir [_MAX_DIR ];
-char szSetupWindow [_MAX_PATH];
-char szGameWindow [_MAX_PATH];
-char szRegistryKey [_MAX_PATH];
-char szClassName [_MAX_PATH];
-char szVolumeName [_MAX_PATH];
-
-char szProduct_Name [ _MAX_PATH ];
-
-
-#ifdef LEAN_AND_MEAN
-
-wchar_t szWideBuffer [ _MAX_PATH ];
-wchar_t szWideBuffer0 [ _MAX_PATH ];
-wchar_t szWideBuffer2 [ _MAX_PATH ];
-wchar_t szWideBuffer3 [ _MAX_PATH ];
-wchar_t szProductName [ _MAX_PATH ];
-wchar_t szFullProductName [ _MAX_PATH ];
-
-/*
-enum
-{
- IDS_INSTALL,
- IDS_EXPLORE_CD,
- IDS_PREVIEWS,
- IDS_CANCEL,
- IDS_AUTORUN_TITLE,
- IDS_CANT_FIND_IEXPLORER,
- IDS_WINDOWS_VERSION_TEXT,
- IDS_WINDOWS_VERSION_TITLE,
- IDS_CANT_FIND,
- IDS_UNINSTALL,
- IDS_WEBSITE,
- IDS_CHECKFORUPDATES,
- IDS_WORLDBUILDER,
- IDS_PLAY,
-
- IDS_GAME_TITLE,
- IDS_FULL_GAME_TITLE,
- IDS_REGISTRY_KEY,
- IDS_MAIN_WINDOW,
-
-
- IDS_COUNT // keep this last
-};
-*/
-
-#else
-
-UnicodeString wideBuffer;
-UnicodeString wideBuffer0;
-UnicodeString wideBuffer2;
-UnicodeString wideBuffer3;
-UnicodeString productName;
-UnicodeString fullProductName;
-
-#endif
-
-
-
-bool IsEnglish = FALSE;
-bool UseSounds = FALSE;
-bool b640X480 = FALSE;
-bool b800X600 = FALSE;
-BOOL OnCDRom = FALSE;
-BOOL IAmWindows95 = FALSE;
-BOOL InstallProduct = TRUE;
-BOOL UninstallAvailable = FALSE;
-BOOL IsUserRegistered = FALSE;
-BOOL DisplayRegisterButton = FALSE;
-BOOL IsWolapiAvailable = FALSE;
-BOOL CDLocked = FALSE;
-int WindowsVersion = 0;
-int NumberArguments = 0;
-int SongNumber = 0;
-HANDLE AppMutex = NULL;
-HANDLE GameAppMutex = NULL;
-HANDLE SetupAppMutex = NULL;
-
-
-
-
-#ifdef LEAN_AND_MEAN
-
-extern FileSystem *TheFileSystem;
-
-#else
-
-extern GameTextInterface *TheGameText;
-extern LocalFileSystem *TheLocalFileSystem;
-extern ArchiveFileSystem *TheArchiveFileSystem;
-
-#endif
-
-// stuff needed to compile.
-HWND ApplicationHWnd = NULL;
-HINSTANCE ApplicationHInstance; ///< main application instance
-
-const char *g_strFile = "Autorun.str";
-const char *g_csfFile = "Autorun.csf";
-
-const char *gAppPrefix = "ar_"; // prefix to the debug log.
-
-int FlickerPositions[ NUM_FLICKER_POSITIONS ][2];
-
-#if( _DEBUG )
-char szCDDrive[ MAX_PATH ];
-#endif
-
-
-//-----------------------------------------------------------------------------
-// Global Function Definitions
-//-----------------------------------------------------------------------------
-void Cant_Find_MessageBox ( HINSTANCE hInstance, const char *szPath );
-HPALETTE CreateDIBPalette ( LPBITMAPINFO lpbmi, LPINT lpiNumColors );
-void Debug_Date_And_Time_Stamp ( void );
-
-void Error_Message ( HINSTANCE hInstance, int title, int string, const char *path );
-void Error_Message ( HINSTANCE hInstance, const char * title, const char * string, const char *path );
-
-bool Is_On_CD ( const char * );
-HBITMAP LoadResourceBitmap ( HMODULE hInstance, LPCTSTR lpString, HPALETTE FAR *lphPalette, bool loading_a_button=FALSE );
-HBITMAP LoadResourceButton ( HMODULE hInstance, LPCTSTR lpString, HPALETTE FAR lphPalette );
-BOOL Options ( Command_Line_Arguments *Orgs );
-void Prog_End ( void );
-bool Prompt_For_CD ( HWND window_handle, char *volume_name, const char * message1, const char * message2, int *cd_drive );
-void Reformat_Volume_Name ( const char *volume_name, char *new_volume_name );
-int Show_Message ( HWND window_handle, const char * message_num1, const char * message_num2 );
-int Show_Message ( HWND window_handle, int message_num1 );
-void Stop_Sound_Playing ( void );
-BOOL Valid_Environment ( void );
-
-BOOL CALLBACK Dialog_Box_Proc ( HWND window_handle, UINT message, WPARAM w_param, LPARAM l_param );
-LRESULT CALLBACK Wnd_Proc ( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam );
-
-
-//-----------------------------------------------------------------------------
-// Main & MainWindow Public Variables
-//-----------------------------------------------------------------------------
-HINSTANCE Main::hInstance = 0;
-HINSTANCE Main::hPrevInstance = 0;
-HMODULE Main::hModule = 0;
-int Main::nCmdShow = 0;
-char MainWindow::szClassName[] = CLASS_NAME;
-
-
-//*****************************************************************************
-// WinMain -- Main Program Loop.
-//
-// INPUT: HINSTANCE hInstance
-// HINSTANCE hPrevInstance
-// LPTSTR lpszCmdLine
-// int nCmdShow
-//
-// OUTPUT: int.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmdLine, int nCmdShow )
-{
-
- int i = 0;
- char szPath[ _MAX_PATH ];
- char szIniPath[ _MAX_PATH ];
-
- HANDLE handle;
- WIN32_FIND_DATA FindFileData;
-
- Main::hInstance = hInstance;
- ApplicationHInstance = hInstance;
- Main::hPrevInstance = hPrevInstance;
- Main::nCmdShow = nCmdShow;
- Main::hModule = GetModuleHandle( NULL );
-
- memset( szSetupWindow, '\0', MAX_PATH );
- memset( szGameWindow, '\0', MAX_PATH );
- memset( szProductName, '\0', MAX_PATH );
- memset( szFullProductName, '\0', MAX_PATH );
- memset( szRegistryKey, '\0', MAX_PATH );
- memset( szClassName, '\0', MAX_PATH );
- memset( szVolumeName, '\0', MAX_PATH );
-
- Msg( __LINE__, __FILE__, "Entering WinMain." );
-
- //-------------------------------------------------------------------------
- // Set Cleanup function.
- //-------------------------------------------------------------------------
- atexit( Prog_End );
-
- //-------------------------------------------------------------------------
- // Clear Argument Array.
- //-------------------------------------------------------------------------
- for ( i = 0; i < NUM_ARGUMENTS; i++ ) {
- memset( Arguments[i], '\0', sizeof( Arguments[i] ));
- }
- for ( i = 0; i < NUM_SONGS; i++ ) {
- memset( szWavs[i], '\0', sizeof( szWavs[i] ));
- }
-
- //-------------------------------------------------------------------------
- // Init Args class.
- //-------------------------------------------------------------------------
- Args = new Command_Line_Arguments( hInstance, GetCommandLine());
- if ( Args == NULL ) {
-// Error_Message( hInstance, IDS_ERROR, IDS_COMMAND_LINE_ERR, NULL );
- Error_Message( hInstance, "Autorun:Error", "Autorun:CommandLineError", NULL );
- return( 0 );
- }
- Msg( __LINE__, __FILE__, "Args Created." );
-
-#if( PRETEND_ON_CD_TEST )
- strcpy( szCDDrive, "E:\\" );
- Options( Args );
- strcat( szCDDrive, "autorun.exe" );
- Msg( __LINE__, __FILE__, "szCDDrive = %s.", szCDDrive );
- Args->Set_argv( 0, szCDDrive );
-#endif
-
- //-------------------------------------------------------------------------
- // Get the CD volume to check on which CD in the product we are on.
- //-------------------------------------------------------------------------
- strcpy( szBuffer, Args->Get_argv(0));
- CDList.Get_Volume_For_This_CD_Drive( szBuffer, szVolumeName );
-
- Msg( __LINE__, __FILE__, "szVolumeName = %s.", szVolumeName );
-
-
-#ifdef LEAN_AND_MEAN
-
- TheFileSystem = new StdFileSystem;
-
-#else
-
- // create singletons
- TheFileSystem->init();
- TheLocalFileSystem = new Win32LocalFileSystem;
- TheArchiveFileSystem = new Win32BIGFileSystem;
- TheGameText = CreateGameTextInterface();
- TheGameText->init();
-
-#endif
-
- //=========================================================================
- // Make paths to .INI and .LOC files.
- //=========================================================================
- Make_Current_Path_To( RESOURCE_FILE, szPath );
- Make_Current_Path_To( SETUP_INI_FILE1, szIniPath );
-
- handle = FindFirstFile( szIniPath, &FindFileData );
- if ( handle == INVALID_HANDLE_VALUE ) {
-
- //---------------------------------------------------------------------
- // This might be a secondary CD.
- //---------------------------------------------------------------------
- Make_Current_Path_To( SETUP_INI_FILE2, szIniPath );
- }
- FindClose( handle );
-
- Msg( __LINE__, __FILE__, "Resource file = %s.", szPath );
- Msg( __LINE__, __FILE__, "Setup.ini file = %s.", szIniPath );
-
- //--------------------------------------------------------------------------
- // Get the language we are using from the Setup.ini file.
- //--------------------------------------------------------------------------
- Language = GetPrivateProfileInt( "Setup", "Language", 0, szIniPath );
-
- if( Language == 0 ) {
- IsEnglish = true;
- }
-
- Msg( __LINE__, __FILE__, "Language = %d.", Language );
- Msg( __LINE__, __FILE__, "IsEnglish = %d.", IsEnglish );
-
- //--------------------------------------------------------------------------
- // Set language to use.
- //--------------------------------------------------------------------------
- if( Locale_Use_Multi_Language_Files()) {
-
- if( IS_LANGUAGE_DBCS( Language ) && !IS_CODEPAGE_DBCS( CodePage )) {
- Language = LANG_USA;
- }
-
- /*switch( Language ) {
-
- case LANG_GER:
- LanguageToUse = IDL_GERMAN;
- break;
-
- case LANG_FRE:
- LanguageToUse = IDL_FRENCH;
- break;
-
- case LANG_JAP:
- LanguageToUse = IDL_JAPANESE;
- break;
-
- case LANG_KOR:
- LanguageToUse = IDL_KOREAN;
- break;
-
- case LANG_CHI:
- LanguageToUse = IDL_CHINESE;
- break;
-
- case LANG_USA:
- default:
- LanguageToUse = IDL_ENGLISH;
- break;
- }
- */
- LanguageToUse = Language;
-
- }
- Msg( __LINE__, __FILE__, "LanguageToUse = %d.", LanguageToUse );
-
- //-------------------------------------------------------------------------
- // Process the Command Line Options. This may change the language id.
- //-------------------------------------------------------------------------
- if ( !Options( Args )) {
- return( 0 );
- }
-
- //-------------------------------------------------------------------------
- // Save off the Current path for use by other stuff.
- //-------------------------------------------------------------------------
- _tcscpy( szArgvPath, Args->Get_argv(0));
- _tsplitpath( szArgvPath, drive, dir, NULL, NULL );
- _tmakepath ( szArgvPath, drive, dir, NULL, NULL );
- Path_Add_Back_Slash( szArgvPath );
- Msg( __LINE__, TEXT(__FILE__), TEXT("szArgvPath = %s."), szArgvPath );
-
- Msg( __LINE__, __FILE__, "About to Init text strings." );
-
- //=========================================================================
- // Init the strings chosen.
- //=========================================================================
-
-
- Locale_Init( LanguageToUse, szPath );
-
- /*
- if( !Locale_Init( LanguageToUse, szPath )) {
- LoadString( Main::hInstance, IDS_CANT_FIND_FILE, szBuffer1, _MAX_PATH );
- MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, szPath, _MAX_PATH, szWideBuffer0, _MAX_PATH );
- sprintf( szBuffer2, szBuffer1, szWideBuffer0 );
- MessageBox( NULL, szBuffer2, "Autorun", MB_APPLMODAL | MB_OK );
- return 0;
- }
- */
-
-
- //-------------------------------------------------------------------------
- // Get some pertinent strings.
- //-------------------------------------------------------------------------
- Locale_GetString( "Autorun:Title", szProductName );
- Locale_GetString( "Autorun:Command&ConquerGenerals", szFullProductName );
- //Locale_GetString( IDS_GAME_TITLE, szProductName );
- //Locale_GetString( IDS_FULL_GAME_TITLE, szFullProductName );
-// Locale_GetString( IDS_REGISTRY_KEY, szRegistryKey ); // jfs
-// Locale_GetString( IDS_MAIN_WINDOW, szGameWindow );
-
-
- //-------------------------------------------------------------------------
- // Set other variables used through out.
- //-------------------------------------------------------------------------
-#ifdef LEAN_AND_MEAN
-
- //Fix_Single_Ampersands( &szProductName[0], false );
- //Fix_Single_Ampersands( &szFullProductName[0], false );
- Msg( __LINE__, __FILE__, "szProductName = %s.", szProductName );
- WideCharToMultiByte( CodePage, 0, szProductName, _MAX_PATH, szProduct_Name, _MAX_PATH, NULL, NULL );
-
-#else
-
- productName = TheGameText->fetch("Autorun:Generals");
- fullProductName = TheGameText->fetch("Autorun:Command&ConquerGenerals");
- Msg( __LINE__, __FILE__, "Product Name = %ls.", productName.str() );
- Msg( __LINE__, __FILE__, "Full Product Name = %ls.", fullProductName.str() );
- Msg( __LINE__, __FILE__, "szRegistryKey = %s.", szRegistryKey );
- Msg( __LINE__, __FILE__, "szGameWindow = %s.", szGameWindow );
- WideCharToMultiByte( CodePage, 0, productName.str(), productName.getLength()+1, szProduct_Name, _MAX_PATH, NULL, NULL );
-
-#endif
-
- sprintf( szClassName, CLASS_NAME, szProduct_Name );
- MainWindow::Reset_Class_Name( szClassName );
- sprintf( szSetupWindow, SETUP_MAIN_WINDOW_NAME, szProduct_Name );
-
- Msg( __LINE__, __FILE__, "szClassName = %s.", szClassName );
- Msg( __LINE__, __FILE__, "szSetupWindow = %s.", szSetupWindow );
-
- //=========================================================================
- // Create a mutex with a unique name to Autorun in order to determine if
- // our app is already running.
- //
- // Return Values:
- // If the function succeeds, the return value is a handle to the mutex object.
- // If the named mutex object existed before the function call, the function returns
- // a handle to the existing object and GetLastError returns ERROR_ALREADY_EXISTS.
- // Otherwise, the caller created the mutex.
- // If the function fails, the return value is NULL. To get extended error
- // information, call GetLastError.
- //
- // WARNING: DO NOT use this number for any other application except Autorun
- //=========================================================================
- if( WinVersion.Is_Win_XP() || WinVersion.Version() > 500 ) {
- strcat( strcpy( szBuffer, "Global\\" ), AUTORUN_MUTEX_OBJECT );
- } else {
- strcpy( szBuffer, AUTORUN_MUTEX_OBJECT );
- }
- AppMutex = CreateMutex( NULL, FALSE, szBuffer );
-
- if ( AppMutex != NULL && ( GetLastError() == ERROR_ALREADY_EXISTS )) {
-
- Msg( __LINE__, __FILE__, "AppMutex of %s already exists. Exit here.", szBuffer );
-
- //---------------------------------------------------------------------
- // Handle is closed in the ProgEnd().
- //---------------------------------------------------------------------
-
- //---------------------------------------------------------------------
- // Check if Game/Setup is already running, and is looking for the CDRom.
- //---------------------------------------------------------------------
- HWND prev = FindWindow( szClassName, NULL );
- if( prev ){
- //if( IsIconic( prev )){
- //ShowWindow( prev, SW_RESTORE );
- //}
- SetForegroundWindow( prev );
- }
- return 0;
- }
- Msg( __LINE__, __FILE__, "AppMutex of %s created.", szBuffer );
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // if AppMutex was NULL, let through. Perhaps in future we want to trap it?
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- if ( AppMutex == NULL ) {
- }
-
- //=========================================================================
- // Create a mutex with a unique name to Game/Setup in order to
- // determine if our app is already running.
- //
- // Return Values
- // If the function succeeds, the return value is a handle to the mutex object.
- // If the function fails, the return value is NULL. To get extended error
- // information, call GetLastError.
- //
- // WARNING: DO NOT use this number for any other application except Game/Setup.
- //=========================================================================
- if( WinVersion.Is_Win_XP() || WinVersion.Version() > 500 ) {
- strcat( strcpy( szBuffer, "Global\\" ), GAME_MUTEX_OBJECT );
- } else {
- strcpy( szBuffer, GAME_MUTEX_OBJECT );
- }
- GameAppMutex = OpenMutex( MUTEX_ALL_ACCESS, FALSE, szBuffer );
-
- if ( GameAppMutex != NULL ) {
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("Mutex Object of game found."));
- Msg( __LINE__, TEXT(__FILE__), TEXT("Looking for Game Window."));
-
- HWND ccwindow = FindWindow( szGameWindow, NULL );
- if ( ccwindow ) {
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("Found Game Window."));
-
- if( IsIconic( ccwindow )){
- ShowWindow( ccwindow, SW_RESTORE );
- }
- SetForegroundWindow( ccwindow );
-
- } else {
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("Looking for Setup Window."));
-
- ccwindow = FindWindow( szSetupWindow, NULL );
- if ( ccwindow ) {
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("Found Setup Window."));
-
- if( IsIconic( ccwindow )){
- ShowWindow( ccwindow, SW_RESTORE );
- }
- BOOL result = SetForegroundWindow( ccwindow );
- Msg( __LINE__, TEXT(__FILE__), TEXT("SetForegroundWindow = %d."), result );
- }
- }
-
- //---------------------------------------------------------------------
- // Handle(s) are closed in the ProgEnd().
- //---------------------------------------------------------------------
-
- return 0;
- }
-
- //---------------------------------------------------------------------
- // Check if Game/Setup is already running, and is looking for the CDRom.
- //---------------------------------------------------------------------
- HWND prev = FindWindow( szClassName, NULL );
- if ( prev == NULL ) {
- prev = FindWindow( szGameWindow, NULL );
- if ( prev == NULL ) {
- prev = FindWindow( szSetupWindow, NULL );
- }
- }
- if( prev ){
- if( IsIconic( prev )){
- ShowWindow( prev, SW_RESTORE );
- }
- SetForegroundWindow( prev );
-
- Msg( __LINE__, __FILE__, "Either same app, game or setup was found. Exit and set window to foreground." );
- return 0;
- }
-
- //---------------------------------------------------------------------
- // Check if another installshield session is already running. This happens
- // because we ask the user to insert CD-1 again at the end of the install
- // to prevent a crash on Windows ME where it tries to access CD-1 again.
- //---------------------------------------------------------------------
- prev = FindWindow( NULL,"InstallShield Wizard");
- if( prev ){
- return 0;
- }
-
- //=========================================================================
- // Select Sounds.
- //=========================================================================
- memset( szButtonWav, '\0', _MAX_PATH );
- _tcscpy( szButtonWav, _TEXT( MOUSE_WAV ));
-
-// memset( szSpeechWav, '\0', _MAX_PATH );
-// _tcscpy( szSpeechWav, _TEXT( AUTORUN_WAV ));
-
- if( LanguageID == LANG_USA ) {
-
- strcpy( szWavs[0], SOUND_FILE1 );
- strcpy( szWavs[1], SOUND_FILE2 );
-
- // Pick a number between 0 and 1. ( NUM_SONGS - 1 )
- // Seed the random-number generator with current time so that
- // the numbers will be different every time we run.
-
- Msg( __LINE__, __FILE__, "szWav[0] = %s.", szWavs[0] );
- Msg( __LINE__, __FILE__, "szWav[1] = %s.", szWavs[1] );
-
- srand(( unsigned )time( NULL ));
- SongNumber = rand() & 1;
-// UseSounds = TRUE;
-
- Msg( __LINE__, __FILE__, "SongNumber = %d.", SongNumber );
- Msg( __LINE__, __FILE__, "UseSounds = %d.", UseSounds );
- }
-
- //-------------------------------------------------------------------------
- // Get the CD volume to check on which CD in the product we are on.
- //-------------------------------------------------------------------------
-// strcpy( szBuffer, Args->Get_argv(0));
-// CDList.Get_Volume_For_This_CD_Drive( szBuffer, szVolumeName );
-
-// Msg( __LINE__, __FILE__, "szVolumeName = %s.", szVolumeName );
-
- //-------------------------------------------------------------------------
- // Check if we are on the CD-ROM and in Windows 95.
- //-------------------------------------------------------------------------
- if ( !Valid_Environment( )) {
- return( -1 );
- }
-
- //=========================================================================
- // Lock the CD!
- //=========================================================================
-// memset( szPath, '\0', _MAX_PATH );
-// szPath[0] = (char)( toupper( szArgvPath[0] ));
-// strcat( szPath, ":\\" );
-
- //-------------------------------------------------------------------------
- // NOTE: Based on A=0, B=1, etc.
- //-------------------------------------------------------------------------
-//#if(!PRETEND_ON_CD_TEST)
- char driveLetter = Args->Get_argv(0)[0];
- Msg( __LINE__, TEXT(__FILE__), TEXT("About to lock on CD: %c:\\ "), toupper( driveLetter ));
-// CDLocked = CDControl.Lock_CD_Tray((unsigned)( toupper( szPath[0] ) - 'A' ));
- CDLocked = CDControl.Lock_CD_Tray((unsigned)( toupper( driveLetter ) - 'A' ));
- Msg( __LINE__, TEXT(__FILE__), TEXT("CDLocked = %d. "), CDLocked );
-//#endif
-
- //=========================================================================
- // Set the buttons images. Use when images are unique for each button.
- //=========================================================================
- strcpy( ButtonImages[0], BUTTON_REG );
- strcpy( ButtonImages[1], BUTTON_REG );
- strcpy( ButtonImages[2], BUTTON_REG );
- strcpy( ButtonImages[3], BUTTON_REG );
- strcpy( ButtonImages[4], BUTTON_REG );
- strcpy( ButtonImages[5], BUTTON_REG );
- strcpy( ButtonImages[6], BUTTON_REG );
- strcpy( ButtonImages[7], BUTTON_REG );
- strcpy( ButtonImages[8], BUTTON_REG );
- strcpy( ButtonImages[9], BUTTON_REG );
-
- strcpy( FocusedButtonImages[0], BUTTON_SEL );
- strcpy( FocusedButtonImages[1], BUTTON_SEL );
- strcpy( FocusedButtonImages[2], BUTTON_SEL );
- strcpy( FocusedButtonImages[3], BUTTON_SEL );
- strcpy( FocusedButtonImages[4], BUTTON_SEL );
- strcpy( FocusedButtonImages[5], BUTTON_SEL );
- strcpy( FocusedButtonImages[6], BUTTON_SEL );
- strcpy( FocusedButtonImages[7], BUTTON_SEL );
- strcpy( FocusedButtonImages[8], BUTTON_SEL );
- strcpy( FocusedButtonImages[9], BUTTON_SEL );
-
- //=========================================================================
- // A Windows class should be registered with Windows before any windows
- // of that type are created. Register here all Windows classes that
- // will be used in the program.
- //-------------------------------------------------------------------------
- // Register the class only AFTER WinMain assigns appropriate values to
- // static members of Main and only if no previous instances of the program
- // exist (a previous instance would have already performed the registration).
- //=========================================================================
- if ( !Main::hPrevInstance ) {
- MainWindow::Register();
- }
-
- //-------------------------------------------------------------------------
- // Create MainWnd, calls MainWindow Constructor.
- //-------------------------------------------------------------------------
- MainWindow MainWnd;
-
- //-------------------------------------------------------------------------
- // Begin processing Window Messages.
- //-------------------------------------------------------------------------
- return( Main::MessageLoop( ));
-}
-
-//*****************************************************************************
-// Prog_End -- Close all objects that were created.
-//
-// INPUT: none.
-//
-// OUTPUT: int.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 01/22/2001 MML : Created.
-//=============================================================================
-
-void Prog_End ( void )
-{
- //==========================================================================
- // UnLock the CD!
- //==========================================================================
- if( CDLocked ) {
- CDControl.Unlock_CD_Tray((unsigned)( toupper( szArgvPath[0] ) - 'A' ));
- CDLocked = false;
- }
-
- if( Args != NULL ) {
- delete( Args );
- Args = NULL;
- Msg( __LINE__, __FILE__, "Args deleted." );
- }
-
- if ( AppMutex != NULL ) {
- CloseHandle( AppMutex );
- AppMutex = NULL;
- Msg( __LINE__, __FILE__, "AppMutex deleted." );
- }
-
- if ( GameAppMutex != NULL) {
- CloseHandle( GameAppMutex );
- GameAppMutex = NULL;
- }
-
- if ( FontManager != NULL ) {
- delete( FontManager );
- FontManager = NULL;
- Msg( __LINE__, __FILE__, "FontManager deleted." );
- }
-
- if ( OnlineOptions != NULL ) {
- delete( OnlineOptions );
- OnlineOptions = NULL;
- Msg( __LINE__, __FILE__, "OnlineOptions deleted." );
- }
-
- //-------------------------------------------------------------------------
- // Delete language resource file.
- //-------------------------------------------------------------------------
- Locale_Restore();
-
- Debug_Date_And_Time_Stamp();
-}
-
-
-//*****************************************************************************
-// Main::MessageLoop -- Dispatch Message Loop.
-//
-// INPUT: none.
-//
-// OUTPUT: int.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-int Main::MessageLoop( void )
-{
- MSG msg;
-
- while( GetMessage( &msg, NULL, 0, 0 )) {
- TranslateMessage( &msg );
- DispatchMessage( &msg );
- }
-
- //--------------------------------------------------------------------------
- // Stop the sound if still going.
- //--------------------------------------------------------------------------
- Stop_Sound_Playing();
-
- //==========================================================================
- // UnLock the CD!
- //==========================================================================
-//#if(!PRETEND_ON_CD_TEST)
- if( CDLocked ) {
- CDControl.Unlock_CD_Tray((unsigned)( toupper( szArgvPath[0] ) - 'A' ));
- CDLocked = false;
- }
-//#endif
-
- //==========================================================================
- // Something to launch?
- //==========================================================================
- if( LaunchObject.Launch_A_Program()) {
- LaunchObject.Launch();
- }
-
- return( msg.wParam );
-}
-
-
-//*****************************************************************************
-// MainWindow::Register -- Register the Main Window.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-void MainWindow::Register( void )
-{
- //--------------------------------------------------------------------------
- // Structure used to register Windows class.
- //--------------------------------------------------------------------------
- WNDCLASSEX wndclass;
-
- //--------------------------------------------------------------------------
- // set up and register window class
- //--------------------------------------------------------------------------
- wndclass.cbSize = sizeof(WNDCLASSEX);
- wndclass.style = CS_HREDRAW | CS_VREDRAW;
- wndclass.lpfnWndProc = Wnd_Proc;
- wndclass.cbClsExtra = 0;
-
- //--------------------------------------------------------------------------
- // Reserve extra bytes for each instance of the window. We will use these
- // bytes to store a pointer to the C++ (MainWindow) object corresponding
- // to the window. The size of a 'this' pointer depends on the memory model.
- //--------------------------------------------------------------------------
- wndclass.cbWndExtra = sizeof( MainWindow * );
- wndclass.hInstance = Main::hInstance;
- wndclass.hIcon = LoadIcon( Main::hInstance, MAKEINTRESOURCE(1));
-
-// strcpy( szBuffer, "C&C2.ICO" );
-// wndclass.hIcon = (HICON)LoadImage( NULL, szBuffer, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE );
-
- wndclass.hCursor = LoadCursor( Main::hInstance, MAKEINTRESOURCE(2) );
- wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
- wndclass.lpszMenuName = szClassName;
- wndclass.lpszClassName = szClassName;
- wndclass.hIconSm = LoadIcon( Main::hInstance, MAKEINTRESOURCE(1));
-
- if ( !RegisterClassEx((const WNDCLASSEX *) &wndclass ) ) {
-
- #if(_DEBUG)
- LPVOID szMessage;
-
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- GetLastError(),
- MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ),
- (LPTSTR)&szMessage,
- 0,
- NULL );
-
- _stprintf( szBuffer, TEXT( "%s(%lx)" ), szMessage, GetLastError());
- Msg( __LINE__, TEXT(__FILE__), TEXT("GetLastError: %s"), szBuffer );
- #endif
-
- exit( FALSE );
- }
-}
-
-//*****************************************************************************
-// MainWindow::MainWindow -- Main Window Constructor function.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-MainWindow::MainWindow( void )
-{
- char szTitle[ _MAX_PATH ];
- hWnd = 0;
-
-#ifdef LEAN_AND_MEAN
-
- WideCharToMultiByte( CodePage, 0, szFullProductName, _MAX_PATH, szBuffer, _MAX_PATH, NULL, NULL );
-
-#else
-
- WideCharToMultiByte( CodePage, 0, fullProductName.str(), fullProductName.getLength()+1, szBuffer, _MAX_PATH, NULL, NULL );
-
-#endif
-
- memset( szTitle, '\0', _MAX_PATH );
- sprintf( szTitle, CLASS_NAME, szBuffer );
-
- //--------------------------------------------------------------------------
- // Create the MainWindow.
- // Pass 'this' pointer in lpParam of CreateWindow().
- //--------------------------------------------------------------------------
- hWnd = CreateWindowEx(
- 0,
- szClassName,
- szClassName,
- WS_POPUPWINDOW | WS_MINIMIZE | !WS_VISIBLE,
- 0,
- 0,
- 640,
- 480,
- NULL,
- NULL,
- Main::hInstance,
- (LPTSTR) this );
-
- if ( !hWnd ) {
- Stop_Sound_Playing();
- exit( FALSE );
- }
-
- ApplicationHWnd = hWnd;
-
- //-------------------------------------------------------------------------
- // Save the pointer so we can access it globally.
- //-------------------------------------------------------------------------
- GlobalMainWindow = this;
-
- //--------------------------------------------------------------------------
- // If you want to see the Background Window, enable these.
- //--------------------------------------------------------------------------
-// Show( Main::nCmdShow );
-// Update();
-}
-
-//*****************************************************************************
-// MainWindow::Window_Proc -- Main Window Procedure fnc to process msgs.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-LRESULT MainWindow::Window_Proc( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam )
-{
- static RECT rect;
- static int cxChar, cyChar;
- static HBRUSH hBrush = 0;
- static POINT point;
- int decision;
- static int bits_pixel = 0;
-
- switch( iMessage ) {
-
- //-----------------------------------------------------------------------
- // Create Message.
- //-----------------------------------------------------------------------
- case WM_CREATE:
- #if(0)
- hBrush = CreateSolidBrush( GetSysColor( COLOR_WINDOW ));
- #endif
- GetClientRect( GetDesktopWindow(), &rect );
- SendMessage( hWnd, WM_GO, wParam, lParam );
- break;
-
- //-----------------------------------------------------------------------
- // Go!
- //-----------------------------------------------------------------------
- case WM_GO:
-
- decision = DialogBox( Main::hInstance, _TEXT( "BitmapDialog" ), hWnd, Dialog_Box_Proc );
-
- if ( Args ) {
- delete( Args );
- Args = NULL;
- }
- Stop_Sound_Playing();
-
- MoveWindow( hWnd, 0, 0, 0, 0, TRUE );
- SendMessage( hWnd, WM_DESTROY, wParam, lParam );
- Msg( __LINE__, TEXT(__FILE__), TEXT("---------------------- end of WM_GO ---------------------" ));
- break;
-
- //-----------------------------------------------------------------------
- // WM_CTLCOLOR Message.
- // wParam Handle to Child Window's device context
- // LOWORD( lParam ) Child Window handle
- // HIWORD( lParam ) Type of Window: CTLCOLOR_MSGBOX, _EDIT, _LISTBOX, _BTN, _DLG, _SCROLLBAR, _STATIC
- //-----------------------------------------------------------------------
- #if( WINDOW_BRUSH )
- case WM_CTLCOLOR:
- if ( HIWORD( lParam ) == CTLCOLOR_BTN ) {
- SetBkColor( (HDC)wParam, GetSysColor( COLOR_WINDOW ));
- SetTextColor( (HDC)wParam, GetSysColor( COLOR_WINDOWTEXT ));
- UnrealizeObject( hBrush ); // reset the origin of the brush next time used.
- point.x = point.y = 0; // create a point.
- ClientToScreen( hWnd, &point ); // translate into screen coordinates.
- SetBrushOrg( (HDC)wParam, point.x, point.y ); // New Origin to use when next selected.
- return ((DWORD) hBrush);
- }
- break;
-
- //-----------------------------------------------------------------------
- // WM_SYSCOLORCHANGE Message.
- //-----------------------------------------------------------------------
- case WM_SYSCOLORCHANGE:
- DeleteObject( hBrush );
- hBrush = CreateSolidBrush( GetSysColor( COLOR_WINDOW ));
- break;
-
- //-----------------------------------------------------------------------
- // WM_SIZE Message.
- //-----------------------------------------------------------------------
- case WM_SIZE:
- rect.left = 24 * cxChar;
- rect.top = 2 * cyChar;
- rect.right = LOWORD( lParam );
- rect.bottom = HIWORD( lParam );
- break;
- #endif
-
- //-----------------------------------------------------------------------
- // WM_COMMAND Message.
- // wParam Child Window ID
- // LOWORD( lParam ) Child Window handle
- // HIWORD( lParam ) Notification Code: BN_CLICKED, BN_PAINT, etc...
- //-----------------------------------------------------------------------
- case WM_COMMAND:
- break;
-
- //-----------------------------------------------------------------------
- // WM_DESTROY Message.
- //-----------------------------------------------------------------------
- case WM_DESTROY:
- #if(WINDOW_BRUSH)
- DeleteObject( hBrush );
- #endif
- PostQuitMessage( 0 );
- break;
-
- default:
- return DefWindowProc( hWnd, iMessage, wParam, lParam );
- }
- return 0;
-}
-
-
-//*****************************************************************************
-// MainWindow::Is_Product_Registered -- Check the Registration Table information.
-//
-// INPUT: none.
-//
-// OUTPUT: BOOL - TRUE if product is already installed, FALSE if not.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-BOOL MainWindow::Is_Product_Registered( void )
-{
- HKEY phKey;
- BOOL result = FALSE;
-
- char key [_MAX_PATH];
- wchar_t szPath [_MAX_PATH];
- char aName [_MAX_PATH]; //jfs
-
- unsigned long Type;
- unsigned long Size = _MAX_PATH;
-
- HANDLE handle;
- WIN32_FIND_DATA FindFileData;
-
- memset( szPath, '\0', sizeof( szPath ));
- memset( szGamePath, '\0', sizeof( szGamePath ));
- memset( szSetupPath, '\0', sizeof( szSetupPath ));
- memset( szRegisterPath, '\0', sizeof( szRegisterPath ));
- memset( szInternetPath, '\0', sizeof( szInternetPath ));
- memset( szUninstallPath, '\0', sizeof( szUninstallPath ));
- memset( szUninstallCommandLine, '\0', sizeof( szUninstallCommandLine ));
- memset( FindFileData.cFileName, '\0', sizeof( FindFileData.cFileName ));
- memset( FindFileData.cAlternateFileName, '\0', sizeof( FindFileData.cAlternateFileName ));
-
- InstallProduct = TRUE;
- UninstallAvailable = FALSE;
- DisplayRegisterButton = FALSE;
- IsWolapiAvailable = FALSE;
- IsUserRegistered = FALSE;
-
- //==========================================================================
- // Look for keys under the Game's Registry key.
- //==========================================================================
-// _tcscat( _tcscpy( key, SOFTWARE_EAGAMES_KEY ), szRegistryKey );
- _tcscat( _tcscpy( key, EAGAMES_GENERALS_KEY ), szRegistryKey );
-
- //--------------------------------------------------------------------------
- // Try to open the key.
- //--------------------------------------------------------------------------
- if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, key, 0, KEY_QUERY_VALUE, &phKey ) == ERROR_SUCCESS ) {
-
- //-----------------------------------------------------------------------
- // Get Full path\filename of product to execute ("Play").
- //-----------------------------------------------------------------------
- Size = _MAX_PATH;
- if ( RegQueryValueEx( phKey, INSTALL_PATH_KEY, NULL, &Type, (unsigned char *)szGamePath, &Size ) == ERROR_SUCCESS ) {
- _tcscpy(szWorldbuilderPath, szGamePath);
- _tcscpy(szPatchgetPath, szGamePath);
- _tcscat(szGamePath, LAUNCHER_FILENAME);
- _tcscat(szWorldbuilderPath, WORLDBUILDER_FILENAME);
- _tcscat(szPatchgetPath, PATCHGET_FILENAME);
- handle = FindFirstFile( szGamePath, &FindFileData );
- if ( handle != INVALID_HANDLE_VALUE ) {
- InstallProduct = FALSE;
- FindClose( handle );
- }
- }
- Msg( __LINE__, TEXT(__FILE__), TEXT("GamePath = %s."), szGamePath );
-
- RegCloseKey( phKey );
- }
-
- //==========================================================================
- // Find Keys under "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
- //==========================================================================
-
- _tcscpy( key, SHELL_UNINSTALL_KEY );
- Path_Add_Back_Slash( key );
- _tcscat( key, szRegistryKey );
-
- //--------------------------------------------------------------------------
- // Query the Uninstall key "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
- //--------------------------------------------------------------------------
- if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, key, 0, KEY_ALL_ACCESS, &phKey ) == ERROR_SUCCESS ) {
-
- Size = _MAX_PATH;
- if ( RegQueryValueEx( phKey, UNINSTALL_STRING_SUBKEY, NULL, &Type, (unsigned char *)aName, &Size ) == ERROR_SUCCESS )
- {
- //------------------------------------------------------------------------------------------------------
- // Look for the uninstall program. If found, set flag.
- // JFS... need to extract path and command line... 8/26/03
- // JFS... further verify that we use a very limited uninstall based on the presence of "IDriver.exe"
- //------------------------------------------------------------------------------------------------------
- if(strstr(aName,UNINSTALL_EXECUTABLE) != NULL)
- {
- char *sp;
-
- strcpy( szUninstallPath, aName );
- sp = strchr(szUninstallPath,'/');
- if(*sp != NULL)
- {
- strcpy( szUninstallCommandLine, sp );
- strcpy( szUninstallPath, aName );
- *sp = '\0';
- }
- }
-
- handle = FindFirstFile( szUninstallPath, &FindFileData );
- if ( handle != INVALID_HANDLE_VALUE ) {
- UninstallAvailable = TRUE;
- FindClose( handle );
- }
- }
- RegCloseKey( phKey );
- }
-
- //==========================================================================
- // Look for keys under Register. If available, we should show the "Register"
- // button. WESTWOOD_REGISTER_KEY "Software\\Westwood\\Register"
- //==========================================================================
-// _tcscpy( key, WESTWOOD_REGISTER_KEY );
-
- //-------------------------------------------------------------------------
- // Create IGR Options Object.
- //-------------------------------------------------------------------------
- IGROptionsClass *OnlineOptions = new IGROptionsClass();
- if ( OnlineOptions ) {
- OnlineOptions->Init();
- }
-
- //--------------------------------------------------------------------------
- // If "Options" is set under WOLAPI, then this is a Game Room Edition and
- // registration should NOT be allowed.
- //--------------------------------------------------------------------------
- if ( OnlineOptions ) {
- DisplayRegisterButton = OnlineOptions->Is_Running_Reg_App_Allowed();
- }
-
- //--------------------------------------------------------------------------
- // If Registration is allowed...
- //--------------------------------------------------------------------------
-/*
- if ( DisplayRegisterButton ) {
-
- DisplayRegisterButton = false;
-
- if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, key, 0, KEY_QUERY_VALUE, &phKey ) == ERROR_SUCCESS ) {
-
- //-----------------------------------------------------------------------
- // Get Full path\filename of product to execute ("Register.exe").
- //-----------------------------------------------------------------------
- Size = _MAX_PATH;
- if ( RegQueryValueEx( phKey, INSTALLPATH_SUBKEY, NULL, &Type, (unsigned char *)szRegisterPath, &Size ) == ERROR_SUCCESS ) {
-
- //--------------------------------------------------------------------
- // Check if this executable exists.
- //--------------------------------------------------------------------
- handle = FindFirstFile( szRegisterPath, &FindFileData );
- if ( handle != INVALID_HANDLE_VALUE ) {
- DisplayRegisterButton = TRUE;
- FindClose( handle );
- }
- }
- RegCloseKey( phKey );
- }
- }
-*/
- //==========================================================================
- // Is WOLAPI DLL installed?
- //==========================================================================
-/*
- _tcscpy( key, WESTWOOD_WOLAPI_KEY );
-
- if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, key, 0, KEY_QUERY_VALUE, &phKey ) == ERROR_SUCCESS ) {
-
- //-----------------------------------------------------------------------
- // Get Full path\filename of product to execute ("Register.exe").
- //-----------------------------------------------------------------------
- Size = _MAX_PATH;
- if ( RegQueryValueEx( phKey, INSTALLPATH_SUBKEY, NULL, &Type, (unsigned char *)szBuffer, &Size ) == ERROR_SUCCESS ) {
-
- //--------------------------------------------------------------------
- // Check if this executable exists.
- //--------------------------------------------------------------------
- handle = FindFirstFile( szBuffer, &FindFileData );
- if ( handle != INVALID_HANDLE_VALUE ) {
- IsWolapiAvailable = TRUE;
- FindClose( handle );
- }
- }
- RegCloseKey( phKey );
- }
-*/
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("---------------- Is_Product_Registered---------------" ));
- Msg( __LINE__, TEXT(__FILE__), TEXT(" InstallProduct = %d."), InstallProduct );
- Msg( __LINE__, TEXT(__FILE__), TEXT(" UninstallAvailable = %d."), UninstallAvailable );
- Msg( __LINE__, TEXT(__FILE__), TEXT(" IsUserRegistered = %d."), IsUserRegistered );
- Msg( __LINE__, TEXT(__FILE__), TEXT(" DisplayRegisterButton = %d."), DisplayRegisterButton );
- Msg( __LINE__, TEXT(__FILE__), TEXT(" szGamePath = %s."), szGamePath );
- Msg( __LINE__, TEXT(__FILE__), TEXT(" szSetupPath = %s."), szSetupPath );
- Msg( __LINE__, TEXT(__FILE__), TEXT(" szRegisterPath = %s."), szRegisterPath );
- Msg( __LINE__, TEXT(__FILE__), TEXT(" szInternetPath = %s."), szInternetPath );
- Msg( __LINE__, TEXT(__FILE__), TEXT(" szUninstallPath = %s."), szUninstallPath );
-
- return( result );
-}
-
-
-//*****************************************************************************
-// MainWindow::Run_Explorer
-//
-// Get the Current Dir from argv[0]. Open the Explorer Window with
-// this dir. The Explorer will open and display everything in this dir.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-BOOL MainWindow::Run_Explorer( const char *szString, HWND hWnd, RECT *rect )
-{
- char szWindowsPath [ _MAX_PATH ];
- char szPath [ _MAX_PATH ];
- char szCurDir [ _MAX_PATH ];
- char drive [ _MAX_DRIVE ];
- char dir [ _MAX_DIR ];
- char lpszComLine [ 127 ];
-
- BOOL result = FALSE;
- PROCESS_INFORMATION processinfo;
- STARTUPINFO startupinfo;
-
- //--------------------------------------------------------------------------
- // Get current drive/directory from _argv[0].
- //--------------------------------------------------------------------------
- _tcscpy( szPath, szArgvPath );
- _tsplitpath( szPath, drive, dir, NULL, NULL );
- _tmakepath ( szPath, drive, dir, NULL, NULL );
-
- //--------------------------------------------------------------------------
- // Get Windows directory and build path to Explorer. Pas in szPath as
- // the directory for Explorer to open.
- //--------------------------------------------------------------------------
- GetWindowsDirectory( szWindowsPath, _MAX_PATH );
- Path_Add_Back_Slash( szWindowsPath );
-
- _tcscat( szWindowsPath, EXPLORER_NAME );
- _tcscat( _tcscat( _tcscpy( lpszComLine, szWindowsPath ), _TEXT( " " )), szPath );
- _tcscpy( szCurDir, szPath );
-
- //==========================================================================
- // Setup the call
- //==========================================================================
- memset( &startupinfo, 0, sizeof( STARTUPINFO ));
- startupinfo.cb = sizeof( STARTUPINFO );
-
- //--------------------------------------------------------------------------
- // Next, start the process
- //--------------------------------------------------------------------------
- result = CreateProcess(
- szWindowsPath, // address of module name
- lpszComLine, // address of command line
- NULL, // address of process security attributes
- NULL, // address of thread security attributes
- FALSE, // new process inherits handles
- 0, // creation flags
- NULL, // address of new environment block
- szCurDir, // address of current directory name
- &startupinfo, // address of STARTUPINFO
- &processinfo ); // address of PROCESS_INFORMATION
-
- //--------------------------------------------------------------------------
- // If WinExec returned 0, error occurred.
- //--------------------------------------------------------------------------
- if ( !result ) {
-
- Cant_Find_MessageBox ( Main::hInstance, szPath );
-
- #if(BACKGROUND_BITMAP)
- //-----------------------------------------------------------------------
- // Recreate Buttons based on Registry, then repaint window.
- //-----------------------------------------------------------------------
- Create_Buttons( hWnd, rect );
- InvalidateRect( hWnd, rect, FALSE );
- #endif
- }
- return ( result );
-}
-
-//*****************************************************************************
-// MainWindow::Run_Game -- Launch the game based on registry information.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-unsigned int MainWindow::Run_Game ( HWND hWnd, RECT *rect )
-{
- char dir [_MAX_DIR];
- char ext [_MAX_EXT];
- char drive [_MAX_DRIVE];
- char file [_MAX_FNAME];
-
-// unsigned abc = 0;
- HANDLE handle;
- WIN32_FIND_DATA FindFileData;
-
- //--------------------------------------------------------------------------
- // Check if C&C is already running, and is looking for the CDRom.
- // The Autorun keeps asking to "Play" when this happens.
- //--------------------------------------------------------------------------
- HWND game_window = FindWindow ( szGameWindow, NULL );
- if ( game_window ){
- ShowWindow( game_window, SW_RESTORE );
- SetForegroundWindow ( game_window );
- return FALSE;
- }
-
- //--------------------------------------------------------------------------
- // Split into parts.
- //--------------------------------------------------------------------------
- _tsplitpath( szGamePath, drive, dir, file, ext );
-
- //--------------------------------------------------------------------------
- // Launch the game.
- //--------------------------------------------------------------------------
- handle = FindFirstFile( szGamePath, &FindFileData );
- if ( handle == INVALID_HANDLE_VALUE ) {
- return FALSE;
- }
-
- FindClose( handle );
-
- //-----------------------------------------------------------------------
- // Stop Sound if sound was playing.
- //-----------------------------------------------------------------------
- Stop_Sound_Playing();
-
- LaunchObject.SetPath( szGamePath );
- LaunchObject.Set_Launch( true );
- return( true );
-}
-
-//*****************************************************************************
-// MainWindow::Run_WorldBuilder -- Launch the map editor based on registry information.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 12/02/2002 BGC : Created.
-//=============================================================================
-
-unsigned int MainWindow::Run_WorldBuilder( HWND hWnd, RECT *rect)
-{
- HANDLE handle;
- WIN32_FIND_DATA FindFileData;
-
- //--------------------------------------------------------------------------
- // Launch the game.
- //--------------------------------------------------------------------------
- handle = FindFirstFile( szWorldbuilderPath, &FindFileData );
- if ( handle == INVALID_HANDLE_VALUE ) {
- return FALSE;
- }
-
- FindClose( handle );
-
- //-----------------------------------------------------------------------
- // Stop Sound if sound was playing.
- //-----------------------------------------------------------------------
- Stop_Sound_Playing();
-
- LaunchObject.SetPath( szWorldbuilderPath );
- LaunchObject.Set_Launch( true );
- return( true );
-}
-
-//*****************************************************************************
-// MainWindow::Run_PatchGet -- Launch the patch checker based on registry information.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 12/02/2002 BGC : Created.
-//=============================================================================
-
-unsigned int MainWindow::Run_PatchGet( HWND hWnd, RECT *rect)
-{
- HANDLE handle;
- WIN32_FIND_DATA FindFileData;
-
- //--------------------------------------------------------------------------
- // Launch the game.
- //--------------------------------------------------------------------------
- handle = FindFirstFile( szPatchgetPath, &FindFileData );
- if ( handle == INVALID_HANDLE_VALUE ) {
- return FALSE;
- }
-
- FindClose( handle );
-
- //-----------------------------------------------------------------------
- // Stop Sound if sound was playing.
- //-----------------------------------------------------------------------
- Stop_Sound_Playing();
-
- LaunchObject.SetPath( szPatchgetPath );
- LaunchObject.Set_Launch( true );
- return( true );
-}
-
-//*****************************************************************************
-// MainWindow::Run_Demo -- Launch a demo program if desired.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 01/08/2002 MML : Created.
-//=============================================================================
-
-unsigned int MainWindow::Run_Demo ( HWND hWnd, RECT *rect, int cd_drive )
-{
-// unsigned abc = 0;
- HANDLE handle;
- WIN32_FIND_DATA FindFileData;
-
- //--------------------------------------------------------------------------
- // Make path to demo program.
- //--------------------------------------------------------------------------
-// Make_Current_Path_To( MOH_DEMO_PROGRAM, szBuffer );
- wsprintf( szBuffer, "%c:\\", 'A' + cd_drive );
- Path_Add_Back_Slash( szBuffer );
- strcat( szBuffer, MOH_DEMO_PROGRAM );
-
- //--------------------------------------------------------------------------
- // Launch the game.
- //--------------------------------------------------------------------------
- handle = FindFirstFile( szBuffer, &FindFileData );
- if ( handle == INVALID_HANDLE_VALUE ) {
- Cant_Find_MessageBox( Main::hInstance, szBuffer );
- return FALSE;
- }
-
- FindClose( handle );
-
- //-----------------------------------------------------------------------
- // Stop Sound if sound was playing.
- //-----------------------------------------------------------------------
- Stop_Sound_Playing();
-
- LaunchObject.SetPath( szBuffer );
- LaunchObject.Set_Launch( true );
- return( true );
-}
-
-//*****************************************************************************
-// MainWindow::Run_OpenFile -- Main Window function to perform Setup tasks.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-unsigned int MainWindow::Run_OpenFile(int cd_drive, const char *filename, bool wait /* = false */)
-{
- char filepath[MAX_PATH];
- MSG msg;
- BOOL returnValue;
-
- SHELLEXECUTEINFO executeInfo;
- memset(&executeInfo, 0, sizeof(executeInfo));
-
- executeInfo.cbSize = sizeof(executeInfo);
- executeInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
- executeInfo.hwnd = ApplicationHWnd;
- executeInfo.lpVerb = "open";
- executeInfo.lpFile = filename;
- executeInfo.nShow = SW_SHOWNORMAL;
-
- HANDLE hProcess;
-
-
- BOOL ret = ShellExecuteEx(&executeInfo);
-
- if ((ret == 0) || ((int)(executeInfo.hInstApp) <= 32)) {
- Msg(__LINE__, TEXT(__FILE__), TEXT("Couldn't find executable for %s\n"), filepath);
- return 0;
- }
-
- hProcess = executeInfo.hProcess;
-
- if (wait == true) {
- WaitForInputIdle(hProcess, 5000);
-
- bool waiting = true;
- bool quit = false;
-
- while ((waiting == true) && (quit != true)) {
- Sleep(0);
-
- while( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
- {
-
- // get the message
- returnValue = GetMessage( &msg, NULL, 0, 0 );
-
- // check for quitting
- if( returnValue == 0 )
- quit = TRUE;
-
- // translate and dispatch the message
- TranslateMessage( &msg );
- DispatchMessage( &msg );
-
- } // end while
-
- DWORD exitCode;
- GetExitCodeProcess(hProcess, &exitCode);
-
- if (exitCode != STILL_ACTIVE) {
- waiting = false;
- }
- }
- }
-
- return 1;
-}
-
-//*****************************************************************************
-// MainWindow::Run_Setup -- Main Window function to perform Setup tasks.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-unsigned int MainWindow::Run_Setup( HWND hWnd, RECT *rect, int cd_drive )
-{
-// UINT result = 0;
- int i = 0;
- char params [ 127 ];
- char filepath[ _MAX_PATH ];
- HANDLE handle;
- WIN32_FIND_DATA FindFileData;
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("---------------------- Run_Setup --------------------." ));
-
- //--------------------------------------------------------------------------
- // Clear these buffers for later use.
- //--------------------------------------------------------------------------
- memset( params, '\0', 127 );
-
- //--------------------------------------------------------------------------
- // Get Drive & Dir from ARGV[0] and create path to SETUP.EXE.
- //--------------------------------------------------------------------------
-// strcpy( filepath, szArgvPath );
-// Path_Add_Back_Slash( filepath );
-
- wsprintf( filepath, "%c:\\", 'A' + cd_drive );
- Path_Add_Back_Slash( filepath );
- strcat( filepath, SETUP_NAME );
-
- //--------------------------------------------------------------------------
- // If we could not find SETUP.EXE, then display error msg and exit.
- //--------------------------------------------------------------------------
- handle = FindFirstFile( filepath, &FindFileData );
- if ( handle == INVALID_HANDLE_VALUE ) {
- Cant_Find_MessageBox( Main::hInstance, filepath );
- return FALSE;
- }
- FindClose( handle );
-
- //--------------------------------------------------------------------------
- // Create parameters to pass in with the program we are calling.
- //--------------------------------------------------------------------------
- memset( params, '\0', sizeof( params ));
- if ( NumberArguments ) {
-
- _tcscpy( params, Arguments[0] );
- i = 1;
- while (( i < NUM_ARGUMENTS ) && ( i < NumberArguments )) {
- _tcscat( _tcscat( params, _TEXT( " " )), Arguments[i] );
- i++;
- }
- }
-
- //--------------------------------------------------------------------------
- // Stop Sound if sound was playing.
- //--------------------------------------------------------------------------
- Stop_Sound_Playing();
-
- LaunchObject.SetPath( filepath );
- LaunchObject.SetArgs( params );
- LaunchObject.Set_Launch( true );
- return( true );
-}
-
-
-//*****************************************************************************
-// MainWindow::Run_New_Account -- Create a new online account.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-unsigned int MainWindow::Run_New_Account ( HWND hWnd, RECT *rect )
-{
-// UINT result = 0;
- int i = 0;
- char params [ 127 ];
- char filepath[ _MAX_PATH ];
- HANDLE handle;
- WIN32_FIND_DATA FindFileData;
-
- //--------------------------------------------------------------------------
- // Clear these buffers for later use.
- //--------------------------------------------------------------------------
- memset( params, '\0', 127 );
-
- //--------------------------------------------------------------------------
- // Get Drive & Dir from ARGV[0] and create path to SETUP.EXE.
- //--------------------------------------------------------------------------
- _tcscpy( filepath, szArgvPath );
- Path_Add_Back_Slash( filepath );
- _tcscat( filepath, SETUP_NAME );
-
- //--------------------------------------------------------------------------
- // If we could not find SETUP.EXE, then display error msg and exit.
- //--------------------------------------------------------------------------
- handle = FindFirstFile( filepath, &FindFileData );
- if ( handle == INVALID_HANDLE_VALUE ) {
- Cant_Find_MessageBox( Main::hInstance, SETUP_NAME );
- return FALSE;
- }
- FindClose( handle );
-
- //--------------------------------------------------------------------------
- // Create parameters to pass in with the program we are calling.
- //--------------------------------------------------------------------------
- memset( params, '\0', sizeof( params ));
- if ( NumberArguments ) {
-
- _tcscpy( params, Arguments[0] );
- i = 1;
- while (( i < NUM_ARGUMENTS ) && ( i < NumberArguments )) {
- _tcscat( _tcscat( params, _TEXT( " " )), Arguments[i] );
- i++;
- }
- _tcscat( params, _TEXT( " " ));
- }
- _tcscat( params, "-o" );
-
- //--------------------------------------------------------------------------
- // Stop Sound if sound was playing.
- //--------------------------------------------------------------------------
- Stop_Sound_Playing();
-
- LaunchObject.SetPath( filepath );
- LaunchObject.SetArgs( params );
- LaunchObject.Set_Launch( true );
- return( true );
-}
-
-
-//*****************************************************************************
-// MainWindow::Run_Register_Or_Auto_Update
-//
-// Either run Register.exe or Game Update Program from the user's harddrive.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 02/24/1999 MML : Created.
-//=============================================================================
-
-unsigned int MainWindow::Run_Register ( HWND hWnd, RECT *rect )
-{
- char szArgs[ MAX_PATH ];
- HANDLE handle;
- WIN32_FIND_DATA FindFileData;
- BOOL result = FALSE;
-
- //--------------------------------------------------------------------------
- // Register Program is available. Continue...
- //--------------------------------------------------------------------------
- if ( DisplayRegisterButton ) {
-
- //-----------------------------------------------------------------------
- // Check again. May have been changed ...
- //-----------------------------------------------------------------------
- handle = FindFirstFile( szRegisterPath, &FindFileData );
- if ( handle == INVALID_HANDLE_VALUE ) {
- return( 0 );
- }
- FindClose( handle );
-
- //-----------------------------------------------------------------------
- // User is already registered, so maybe we should Auto Update!
- //-----------------------------------------------------------------------
- strcpy( szArgs, _TEXT( " " ));
-
- LaunchObject.SetPath( szRegisterPath );
- LaunchObject.SetArgs( szArgs );
- LaunchObject.Set_Launch( true );
- result = true;
- }
-
- return( result );
-}
-
-//*****************************************************************************
-// MainWindow::Run_Auto_Update
-//
-// Either run Register.exe or Game Update Program from the user's harddrive.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 02/24/1999 MML : Created.
-//=============================================================================
-
-unsigned int MainWindow::Run_Auto_Update ( HWND hWnd, RECT *rect )
-{
- char szArgs [ MAX_PATH ];
- HANDLE handle;
- WIN32_FIND_DATA FindFileData;
- BOOL result = FALSE;
-
- //--------------------------------------------------------------------------
- // Register Program is available. Continue...
- //--------------------------------------------------------------------------
- if ( !InstallProduct ) {
-
- //-----------------------------------------------------------------------
- // Check again. May have been changed ...
- //-----------------------------------------------------------------------
- handle = FindFirstFile( szGamePath, &FindFileData );
- if ( handle == INVALID_HANDLE_VALUE ) {
- return( 0 );
- }
- FindClose( handle );
-
- _tcscpy( szArgs, _TEXT( " GrabPatches" ));
-
- LaunchObject.SetPath( szGamePath );
- LaunchObject.SetArgs( szArgs );
- LaunchObject.Set_Launch( true );
- result = true;
- }
- return( result );
-}
-
-
-//*****************************************************************************
-// MainWindow::Run_Uninstall -- Main Window function to perform Setup tasks.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-unsigned int MainWindow::Run_Uninstall( HWND hWnd, RECT *rect )
-{
-// MSG msg;
- UINT result = 0;
-// int done = 0;
-// DWORD dwTimeout = 1500;
-// DWORD dwRC = WAIT_TIMEOUT;
- DWORD lpExitCode;
-
- STARTUPINFO startupinfo;
- PROCESS_INFORMATION processinfo;
- HANDLE handle;
- WIN32_FIND_DATA FindFileData;
-
- char szCurDir [_MAX_PATH];
- char file [_MAX_FNAME];
- char ext [_MAX_EXT];
- char szPath [_MAX_PATH];
-
- //--------------------------------------------------------------------------
- // Launch the UNINSTALL.
- //--------------------------------------------------------------------------
- handle = FindFirstFile( szUninstallPath, &FindFileData );
- if ( handle == INVALID_HANDLE_VALUE ) {
- return( 0 );
- }
-
- FindClose( handle );
-
- _splitpath( szUninstallPath, drive, dir, NULL, NULL );
- _makepath ( szCurDir, drive, dir, NULL, NULL );
-
- //=======================================================================
- // Setup the call
- //=======================================================================
- memset( &startupinfo, 0, sizeof( STARTUPINFO ));
- startupinfo.cb = sizeof( STARTUPINFO );
-
- result = CreateProcess(
- szUninstallPath, // address of module name
- szUninstallCommandLine, // address of command line
- NULL, // address of process security attributes
- NULL, // address of thread security attributes
- 0, // new process inherits handles
- 0,
- NULL, // address of new environment block
- szCurDir,
- &startupinfo, // address of STARTUPINFO
- &processinfo ); // address of PROCESS_INFORMATION
-
- //--------------------------------------------------------------------------
- // If WinExec returned 0, error occurred.
- //--------------------------------------------------------------------------
- if ( !result ) {
-
- _tsplitpath( szUninstallPath, NULL, NULL, file, ext );
- _tmakepath ( szPath, NULL, NULL, file, ext );
- Cant_Find_MessageBox ( Main::hInstance, szPath );
-
-// #if(BACKGROUND_BITMAP)
- //-----------------------------------------------------------------------
- // Recreate Buttons based on Registry, then repaint window.
- //-----------------------------------------------------------------------
-// Create_Buttons( hWnd, rect );
-// InvalidateRect( hWnd, rect, FALSE );
-// #endif
-
- return( result );
- }
-
- // JFS: 8-26-03... Can't have auto run going during an uninstall!
-#if 0
- //--------------------------------------------------------------------------
- // Wait for App to shutdown
- //--------------------------------------------------------------------------
- while (dwRC == WAIT_TIMEOUT)
- {
-
- //-----------------------------------------------------------------------
- // Wait for object
- //-----------------------------------------------------------------------
- dwRC = WaitForSingleObject( processinfo.hProcess, dwTimeout );
-
-
- //-----------------------------------------------------------------------
- // Flush the Queue
- //-----------------------------------------------------------------------
- while (PeekMessage( &msg, NULL, 0, 0, PM_REMOVE )) {
- TranslateMessage( &msg );
-// DispatchMessage( &msg );
- }
- }
-#endif
- //--------------------------------------------------------------------------
- // If the specified process has not terminated, the termination status
- // returned is STILL_ACTIVE.
- //--------------------------------------------------------------------------
- GetExitCodeProcess( processinfo.hProcess, &lpExitCode );
- CloseHandle( processinfo.hProcess );
- CloseHandle( processinfo.hThread );
-
-#if(BACKGROUND_BITMAP)
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // MML 5/27/99: This function is dropping through because we launch Uninstll.exe
- // which in turn launches Uninst.exe thus ::Run_Install ends before Uninst.exe is done.
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- //--------------------------------------------------------------------------
- // Recreate Buttons based on Registry.
- // Repaint calling Window.
- //--------------------------------------------------------------------------
- Create_Buttons( hWnd, rect );
- InvalidateRect( hWnd, rect, FALSE );
-#endif
-
- return( result );
-}
-
-//*****************************************************************************
-// MainWindow::Create_Buttons -- Reset the Buttons.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-void MainWindow::Create_Buttons( HWND hWnd, RECT *dlg_rect )
-{
- int j = 0;
- int i = 0;
- int x_pos = 0;
- int y_pos = 0;
- int width = 0;
- int height = 0;
- int button_index = 0;
-
- HBITMAP hButtonBitmap = 0;
- HPALETTE hpal = 0;
- BITMAP button_bm;
- char next_button_name[_MAX_PATH];
- char focused_button_name[_MAX_PATH];
- RECT * button_size = ButtonSizes;
-
- //--------------------------------------------------------------------------
- // Reset all the flags.
- //--------------------------------------------------------------------------
- Is_Product_Registered( );
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("------------------------ Create_Buttons ------------------------" ));
-
- //--------------------------------------------------------------------------
- // Get width and height of the button.
- //--------------------------------------------------------------------------
- hButtonBitmap = LoadResourceBitmap( Main::hModule, BUTTON_REG, &hpal, TRUE );
- if ( hButtonBitmap ) {
- GetObject( hButtonBitmap, sizeof( BITMAP ), (LPTSTR)&button_bm );
- width = button_bm.bmWidth;
- height = button_bm.bmHeight;
- DeleteObject( hButtonBitmap );
- hButtonBitmap = 0;
- } else {
- button_bm.bmWidth = width = BUTTON_WIDTH;
- button_bm.bmHeight = height = BUTTON_HEIGHT;
- }
-
- //--------------------------------------------------------------------------
- // Initialize the ButtonList.
- //--------------------------------------------------------------------------
- if( b640X480 || b800X600 ) {
-
- x_pos = 410;
- y_pos = 90;
- } else {
- x_pos = 540;
- y_pos = 117;
- }
-
- for ( i = 0; i < NUM_BUTTONS; i++ ) {
-
- if ( ButtonList[i] )
- {
- delete( ButtonList[i] );
- }
-
- ButtonList[i] = NULL;
- ButtonSizes[i].left = x_pos; // X position.
- ButtonSizes[i].top = y_pos; // Y position.
- ButtonSizes[i].right = width; // Button's width.
- ButtonSizes[i].bottom = height; // Button's height.
- y_pos += height + 4;
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonSizes[%d] = ( %d, %d, %d, %d )"),
- i, ButtonSizes[i].left, ButtonSizes[i].top, ButtonSizes[i].right, ButtonSizes[i].bottom );
- }
-
- //==========================================================================
- // Create the "Buttons"
- //==========================================================================
- i = 0;
- j = 0;
-
- //--------------------------------------------------------------------------
- // Make any other necessary adjustments here.
- //--------------------------------------------------------------------------
- int count = 7;
-
- if ( !UninstallAvailable ) {
- count--; // No uninstall button.
- }
- if ( InstallProduct ) {
- count--; // No Website button.
- }
- button_index = 0;
-
- strcpy( next_button_name, ButtonImages[button_index] );
- strcpy( focused_button_name, FocusedButtonImages[button_index] );
-
- button_size = ButtonSizes;
- i = j = button_index;
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("count = %d."), count );
- Msg( __LINE__, TEXT(__FILE__), TEXT("button_index = %d."), button_index );
- Msg( __LINE__, TEXT(__FILE__), TEXT("next_button_name = %s."), next_button_name );
- Msg( __LINE__, TEXT(__FILE__), TEXT("focused_button_name = %s."), focused_button_name );
-
-
- //-------------------------------------------------------------------------
- // INSTALL or PLAY?
- //-------------------------------------------------------------------------
- if ( InstallProduct ) {
-
- //---------------------------------------------------------------------
- // (8) INSTALL button.
- //---------------------------------------------------------------------
- Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonList[%d]: Id=%d, ButtonSizes=%d, String=%s."), i, IDD_OK, j, "Install" );
- ButtonList[i++] = new DrawButton(
- IDD_OK,
- button_size[j++],
- BUTTON_REG,
- BUTTON_SEL,
- BUTTON_SEL,
-#ifdef LEAN_AND_MEAN
- Locale_GetString( "Autorun:Install" ),
-#else
- AsciiString("Autorun:Install"),
-#endif
- TTButtonFontPtr );
-
- } else {
-
- //---------------------------------------------------------------------
- // (8) PLAY button.
- //---------------------------------------------------------------------
- Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonList[%d]: Id=%d, ButtonSizes=%d, String=%s."), i, IDD_OK2, j, "Play" );
- ButtonList[i++] = new DrawButton(
- IDD_OK2,
- button_size[j++],
- BUTTON_REG,
- BUTTON_SEL,
- BUTTON_SEL,
-#ifdef LEAN_AND_MEAN
- Locale_GetString( "Autorun:Play" ),
-#else
- AsciiString("Autorun:Play"),
-#endif
- TTButtonFontPtr );
-/*
- //---------------------------------------------------------------------
- // (8) WorldBuilder button.
- //---------------------------------------------------------------------
- Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonList[%d]: Id=%d, ButtonSizes=%d, String=%s."), i, IDD_OK2, j, "WorldBuilder" );
-// ButtonList[i--] = new DrawButton(
- ButtonList[i++] = new DrawButton(
- IDD_OK3,
-// button_size[j--],
- button_size[j++],
- BUTTON_REG,
- BUTTON_SEL,
- BUTTON_SEL,
-#ifdef LEAN_AND_MEAN
- Locale_GetString( "Autorun:Worldbuilder" ),
-#else
- AsciiString("Autorun:Worldbuilder"),
-#endif
- TTButtonFontPtr );
-*/
- //---------------------------------------------------------------------
- // (8) Check for updates button.
- //---------------------------------------------------------------------
- Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonList[%d]: Id=%d, ButtonSizes=%d, String=%s."), i, IDD_OK2, j, "Check For Updates" );
-// ButtonList[i--] = new DrawButton(
- ButtonList[i++] = new DrawButton(
- IDD_OK4,
-// button_size[j--],
- button_size[j++],
- BUTTON_REG,
- BUTTON_SEL,
- BUTTON_SEL,
-#ifdef LEAN_AND_MEAN
- Locale_GetString( "Autorun:CheckForUpdates" ),
-#else
- AsciiString("Autorun:CheckForUpdates"),
-#endif
- TTButtonFontPtr );
- }
-
- //-------------------------------------------------------------------------
- // (7) EXPLORE CD
- //-------------------------------------------------------------------------
- Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonList[%d]: Id=%d, ButtonSizes=%d, String=%s."), i, IDD_EXPLORE, j, "Explore" );
- ButtonList[i++] = new DrawButton (
- IDD_EXPLORE,
- button_size[j++],
- BUTTON_REG,
- BUTTON_SEL,
- BUTTON_SEL,
-#ifdef LEAN_AND_MEAN
- Locale_GetString( "Autorun:ExploreCD" ),
-#else
- AsciiString("Autorun:ExploreCD"),
-#endif
- TTButtonFontPtr );
-// strcpy( next_button_name, ButtonImages[button_index] );
-// strcpy( focused_button_name, FocusedButtonImages[button_index--] );
-// strcpy( focused_button_name, FocusedButtonImages[button_index++] );
-
- if ( !InstallProduct ) {
- //-----------------------------------------------------------------------
- // (3) WebSite button.
- //-----------------------------------------------------------------------
- Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonList[%d]: Id=%d, ButtonSizes=%d, String=%s."), i, IDD_OK, j, "Install" );
- ButtonList[i++] = new DrawButton(
- IDD_INTERNET,
- button_size[j++],
- BUTTON_REG,
- BUTTON_SEL,
- BUTTON_SEL,
-#ifdef LEAN_AND_MEAN
- Locale_GetString( "Autorun:Website" ),
-#else
- AsciiString("Autorun:Website"),
-#endif
- TTButtonFontPtr );
-
-// strcpy( next_button_name, ButtonImages[button_index] );
-// strcpy( focused_button_name, FocusedButtonImages[button_index--] );
-// strcpy( focused_button_name, FocusedButtonImages[button_index++] );
- }
-
- //--------------------------------------------------------------------------
- // (2) UNINSTALL?
- //--------------------------------------------------------------------------
- if ( UninstallAvailable && !InstallProduct ) {
- Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonList[%d]: Id=%d, ButtonSizes=%d, String=%s."), i, IDD_UNINSTALL, j, "Uninstall" );
- ButtonList[i++] = new DrawButton(
- IDD_UNINSTALL,
- button_size[j++],
- BUTTON_REG,
- BUTTON_SEL,
- BUTTON_SEL,
-#ifdef LEAN_AND_MEAN
- Locale_GetString( "Autorun:Uninstall" ),
-#else
- AsciiString("Autorun:Uninstall"),
-#endif
- TTButtonFontPtr );
-
-// strcpy( next_button_name, ButtonImages[button_index] );
-// strcpy( focused_button_name, FocusedButtonImages[button_index--] );
-// strcpy( focused_button_name, FocusedButtonImages[button_index++] );
- }
-
- //--------------------------------------------------------------------------
- // (1) MOH movie
- //--------------------------------------------------------------------------
- Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonList[%d]: Id=%d, ButtonSizes=%d, String=%s."), i, IDD_PREVIEWS, j, "Preview Movies");
- ButtonList[i++] = new DrawButton(
- IDD_PREVIEWS,
- button_size[j++],
- BUTTON_REG,
- BUTTON_SEL,
- BUTTON_SEL,
-#ifdef LEAN_AND_MEAN
- Locale_GetString( "Autorun:Previews" ),
-#else
- AsciiString("Autorun:Previews"),
-#endif
- TTButtonFontPtr );
-
- //--------------------------------------------------------------------------
- // (1) Help file
- //--------------------------------------------------------------------------
- Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonList[%d]: Id=%d, ButtonSizes=%d, String=%s."), i, IDD_HELP, j, "Help file");
- ButtonList[i++] = new DrawButton(
- IDD_HELP,
- button_size[j++],
- BUTTON_REG,
- BUTTON_SEL,
- BUTTON_SEL,
-#ifdef LEAN_AND_MEAN
- Locale_GetString( "Autorun:Help" ),
-#else
- AsciiString("Autorun:Help"),
-#endif
- TTButtonFontPtr );
-
- //--------------------------------------------------------------------------
- // (1) CANCEL?
- //--------------------------------------------------------------------------
- Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonList[%d]: Id=%d, ButtonSizes=%d, String=%s."), i, IDD_CANCEL, j, "Cancel" );
- ButtonList[i++] = new DrawButton(
- IDD_CANCEL,
- button_size[j++],
- BUTTON_REG,
- BUTTON_SEL,
- BUTTON_SEL,
-#ifdef LEAN_AND_MEAN
- Locale_GetString( "Autorun:Cancel" ),
-#else
- AsciiString("Autorun:Cancel"),
-#endif
- TTButtonFontPtr );
-
-// strcpy( next_button_name, ButtonImages[button_index] );
-// strcpy( focused_button_name, FocusedButtonImages[button_index--] );
-// strcpy( focused_button_name, FocusedButtonImages[button_index++] );
-
- //-------------------------------------------------------------------------
- // Set the top button to have the focus.
- //-------------------------------------------------------------------------
- if ( ButtonList[0]) {
- Msg( __LINE__, TEXT(__FILE__), TEXT("Button with starting Focus = %d"), i );
- ButtonList[0]->Set_State( DrawButton::FOCUS_STATE );
- }
-
-#if( _DEBUG )
- Msg( __LINE__, TEXT(__FILE__), TEXT("----------------------------------------------------------------------------------"));
- for( i=0; iReturn_Id(),
- ButtonList[i]->Return_X_Pos(),
- ButtonList[i]->Return_Y_Pos(),
- ButtonList[i]->Return_Width(),
- ButtonList[i]->Return_Height());
- }
- }
-#endif
-}
-
-
-//*****************************************************************************
-// WndProc -- Get Main Window's Stored Word.
-//
-// INPUT: HWND hWnd.
-// Window *pWindow
-//
-// OUTPUT: none.
-//
-// WARNINGS: none.
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-LRESULT CALLBACK Wnd_Proc ( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam )
-{
- //--------------------------------------------------------------------------
- // If the GlobalMainWindow Ptr is not initialized, do it when the MW-CREATE
- // msg is called. Then we use the GlobalMainWindow's WindowProc to
- // process all the individual msgs sent.
- //--------------------------------------------------------------------------
- if ( GlobalMainWindow == NULL ) {
- if ( iMessage == WM_CREATE ) {
-
- LPCREATESTRUCT lpcs;
-
- lpcs = (LPCREATESTRUCT) lParam;
- GlobalMainWindow = (MainWindow *) lpcs->lpCreateParams;
-
- //-----------------------------------------------------------------
- // Now let the object perform whatever initialization it needs
- // for WM_CREATE in its own WndProc.
- //-----------------------------------------------------------------
- return GlobalMainWindow->Window_Proc( hWnd, iMessage, wParam, lParam );
-
- } else {
- return DefWindowProc( hWnd, iMessage, wParam, lParam );
- }
-
- } else {
- return GlobalMainWindow->Window_Proc( hWnd, iMessage, wParam, lParam );
- }
-}
-
-//*****************************************************************************
-// DIALOG_BOX_PROC -- Handles dlg messages
-//
-// INPUT: standard windows dialog command parameters
-//
-// OUTPUT: unused
-//
-// WARNINGS: none
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param, LPARAM l_param )
-{
- int i = 0, j = 0;
- int nResult = 0;
-// int space_between = 5;
- int prevDCStretchMode;
- int prevMemDCStretchMode;
- int prevButtonDCStretchMode;
- int prevLicenseDCStretchMode;
- int result = 0;
- char buffer1[ 50 ];
-// char buffer2[ 50 ];
-
- HDC hDC, memDC, buttonDC, licenseDC;
- BITMAP bm, fm, lm;
-// LOGPALETTE * plgpl = NULL;
- PAINTSTRUCT ps;
- static int bits_pixel = 0;
- static int idCtl = 0;
- static int mouse_x, mouse_y;
-
- static char szBitmap[_MAX_PATH];
- static char szLicense[ _MAX_PATH ];
- static char szButtonBitmap[_MAX_PATH];
-
- static wchar_t szString1[ 500 ];
- static wchar_t szString2[ 500 ];
- static wchar_t szWholeString[ 1000 ];
-// static wchar_t szWSMsg1[ _MAX_PATH ];
-
-#ifdef LEAN_AND_MEAN
-
-#else
- static UnicodeString wsMsg1;
-#endif
-
- static wchar_t szWSMsg2[ _MAX_PATH ];
- static wchar_t szWholeWSMsg[ 1000 ];
-// static wchar_t szInstallWarningMsg[ _MAX_PATH ];
-
- static HBITMAP hBitmap = 0;
- static HBITMAP oldBitmap = 0;
-// static HBITMAP oldButtonBitmap = 0;
- static HBITMAP oldLicenseBitmap = 0;
- static HBITMAP hButtonBitmap = 0;
- static HBITMAP hFlicker[NUM_FLICKER_FRAMES];
- static HBITMAP hLicenseBitmap;
-
- static POINT point;
- static HBRUSH hStaticBrush = 0;
- static HPALETTE hpal = 0;
- static HPALETTE hpalold = 0;
- static BOOL FirstTime = TRUE;
-// static BOOL Flicker = TRUE;
- static BOOL Flicker = FALSE;
- static int FlickerIndex = 0;
- static BOOL PaintOnlyFlicker = TRUE;
- static BOOL PaintBackground = TRUE;
- static UINT timer_id = 0;
- static RECT rect; // Desktop Window ( used once ).
- static RECT tray_rect; // Desktop Window w/o Tray size.
- static RECT paint_rect; // Size that needs to be repainted.
- static RECT dlg_rect; // Dialog client window size.
- static RECT bitmap_rect; // Background bitmap size.
- static RECT flicker_rect; // Flicker bitmap size.
- static RECT buttons_rect; // Area where buttons are.
- static RECT license_rect; // Area where buttons are.
- static RECT BackgroundRect[ ( NUM_BUTTONS * 3 ) + 3 ]; // Background areas outside button area.
-
-#if(USE_MOUSE_MOVES)
- static int CurrentButton = 0;
- static int LastButton = 0;
- static int PrevButton = 0;
-#endif
-
- #if(0)
- {
- //-------------------------------------------------------------------------------
- // Used for debugging -- lining up objects using the mouse coordinates.
- //-------------------------------------------------------------------------------
- int i = 0;
- HDC hdc = GetDC( window_handle );
- char string[10];
- POINT pPoint;
-
- GetCursorPos( &pPoint );
- ScreenToClient( window_handle, &pPoint );
- sprintf( string, "%d, %d", pPoint.x, pPoint.y );
- TextOut( hdc, 10, 50, string, 8 );
- ReleaseDC( window_handle, hdc );
- }
- #endif
-
-
- //-----------------------------------------------------------------------------------
- // Process Dialogs messages.
- //-----------------------------------------------------------------------------------
- switch( message ) {
-
- case WM_INITDIALOG:
- {
- //-----------------------------------------------------------------------
- // Set dialog's caption.
- //-----------------------------------------------------------------------
-
-#ifdef LEAN_AND_MEAN
-
- Locale_GetString( "Autorun:Title", szWideBuffer );
- memset( szWideBuffer2, '\0', _MAX_PATH );
- swprintf( szWideBuffer2, szWideBuffer, szProductName );
- swprintf( szWideBuffer2, szWideBuffer, szFullProductName );
-
-#else
-
- wideBuffer = TheGameText->fetch("Autorun:Title");
- wideBuffer2.format(wideBuffer, fullProductName.str());
- WideCharToMultiByte( CodePage, 0, wideBuffer2.str(), wideBuffer2.getLength()+1, szBuffer, _MAX_PATH, NULL, NULL );
-
-#endif
-
-
- SetWindowText( window_handle, szBuffer );
-
- //-----------------------------------------------------------------------
- // Set Icon.
- //-----------------------------------------------------------------------
- SendMessage( window_handle, WM_SETICON, ICON_SMALL, (long)LoadIcon( Main::hInstance, MAKEINTRESOURCE(1)));
-
- #if(BACKGROUND_BITMAP)
-
- //-----------------------------------------------------------------------
- // Get the DeskTop's size and this dialogs size (in pixels).
- //-----------------------------------------------------------------------
- GetClientRect( GetDesktopWindow(), &rect );
- SystemParametersInfo( SPI_GETWORKAREA, 0, &tray_rect, 0 );
-
-/// if( rect.right <= 640 ) {
-// b640X480 = TRUE;
-// } else if( rect.right <= 800 ) {
- b800X600 = TRUE;
-// }
-
- //=======================================================================
- // Create Fonts.
- //=======================================================================
- HDC hdc = GetDC( window_handle );
-
- FontManager = new FontManagerClass( hdc );
- assert( FontManager != NULL );
- ReleaseDC( window_handle, hdc );
-
- //=======================================================================
- // Load messages for bottom of screen.
- //=======================================================================
-// memset( szString1, '\0', MAX_PATH );
-// memset( szString2, '\0', MAX_PATH );
-// memset( szWholeString, '\0', 1000 );
-
-// Locale_GetString( EA_LICENSE_MSG1, szString1 );
-// Locale_GetString( EA_LICENSE_MSG2, szString2 );
-// swprintf( szWholeString, L"%s %s", szString1, szString2 );
-
-// memset( szWSMsg1, '\0', _MAX_PATH );
- memset( szWSMsg2, '\0', _MAX_PATH );
- memset( szWholeWSMsg, '\0', 1000 );
-
-// Locale_GetString( WESTWOOD_COM_MSG, szWSMsg1 );
-// wsMsg1 = TheGameText->fetch("Autorun:WestwoodComMsg");
-
-// PlugInProductName( szWSMsg1, (wchar_t *)(fullProductName.str()) );
-// PlugInProductName( (wchar_t *)(wsMsg1.str()), (wchar_t *)(fullProductName.str()) );
-// wsMsg1 = Fix_Single_Ampersands ( wsMsg1, false );
-// swprintf( szWholeWSMsg, L"%s", wsMsg1.str() );
-
-// memset( szInstallWarningMsg, '\0', _MAX_PATH );
-
-// Locale_GetString( IDS_INSTALL_WARNING_MSG, szWideBuffer );
-// wideBuffer = TheGameText->fetch("Autorun:InstallWarningMsg");
-
-// swprintf( szInstallWarningMsg, wideBuffer.str(), fullProductName.str() );
-
- //=======================================================================
- // Load the correct background & animation bitmap.
- //=======================================================================
- memset( buffer1, '\0', sizeof( buffer1 ));
-
- if( b640X480 ) {
-
- strcpy( szBitmap, _TEXT( "Background2" ));
-
- if ( LANG_FRE == LanguageID ) {
- strcpy( szLicense, _TEXT( "License_FRENCH2" ));
- } else if ( LANG_GER == LanguageID ) {
- strcpy( szLicense, _TEXT( "License_GERMAN2" ));
- } else {
- strcpy( szLicense, _TEXT( "License_USA2" ));
- }
- license_rect.left = 186;
- license_rect.top = 414;
-
- } else if( b800X600 ) {
-
- strcpy( szBitmap, _TEXT( "Background" ));
-
- if ( LANG_FRE == LanguageID ) {
- strcpy( szLicense, _TEXT( "License_FRENCH2" ));
- } else if ( LANG_GER == LanguageID ) {
- strcpy( szLicense, _TEXT( "License_GERMAN2" ));
- } else {
- strcpy( szLicense, _TEXT( "License_USA2" ));
- }
- license_rect.left = 186;
- license_rect.top = 414;
-
- } else {
-
- strcpy( szBitmap, _TEXT( "Background" ));
- strcpy( buffer1, "FLICKER" );
-
- if ( LANG_FRE == LanguageID ) {
- strcpy( szLicense, _TEXT( "License_FRENCH" ));
- } else if ( LANG_GER == LanguageID ) {
- strcpy( szLicense, _TEXT( "License_GERMAN" ));
- } else {
- strcpy( szLicense, _TEXT( "License_USA" ));
- }
- license_rect.left = 238;
- license_rect.top = 580;
- }
-
- //=======================================================================
- // Load flicker bitmap.
- //=======================================================================
- for( i = 0; i < NUM_FLICKER_FRAMES; i++ ) {
- hFlicker[i] = 0;
-// sprintf( buffer2, "%s%02d", buffer1, i );
-// hFlicker[i] = LoadResourceBitmap( Main::hModule, buffer2, &hpal );
- hFlicker[i] = LoadResourceBitmap( Main::hModule, buffer1, &hpal );
- }
-
- //-----------------------------------------------------------------------
- // Get the flicker bitmap's dimensions.
- //-----------------------------------------------------------------------
- result = 712;
-
- for( i = 0; i < NUM_FLICKER_POSITIONS; i++ ) {
- if( i == 8 ) {
- FlickerPositions[i][0] = result - 33;
- } else if( i == 9 ) {
- FlickerPositions[i][0] = result - 35;
- } else if ( i > 8 ) {
- FlickerPositions[i][0] = result - 28;
- } else {
- FlickerPositions[i][0] = result - 31;
- }
- FlickerPositions[i][1] = 560;
- result = FlickerPositions[i][0];
- }
-
- if ( hFlicker[0] ) {
- GetObject( hFlicker[0], sizeof( BITMAP ), (LPTSTR)&fm );
- flicker_rect.left = FlickerPositions[0][0];
- flicker_rect.top = FlickerPositions[0][1];
- flicker_rect.right = flicker_rect.left + fm.bmWidth;
- flicker_rect.bottom = flicker_rect.top + fm.bmHeight;
- }
-
- //-----------------------------------------------------------------------
- // Get the bitmap's dimensions.
- //-----------------------------------------------------------------------
- hLicenseBitmap = LoadResourceBitmap( Main::hModule, szLicense, &hpal );
- if ( hLicenseBitmap ) {
- GetObject( hLicenseBitmap, sizeof( BITMAP ), (LPTSTR)&lm );
- license_rect.right = license_rect.left + lm.bmWidth;
- license_rect.bottom = license_rect.top + lm.bmHeight;
- }
-
- //=======================================================================
- // Load background bitmap.
- //=======================================================================
- hBitmap = LoadResourceBitmap( Main::hModule, szBitmap, &hpal );
- if ( hBitmap ) {
- GetObject( hBitmap, sizeof( BITMAP ), (LPTSTR)&bm );
- }
-
- //-----------------------------------------------------------------------
- // Set the x, y, width, height of the Dialog and bitmaps dimensions.
- //-----------------------------------------------------------------------
- bitmap_rect.left = dlg_rect.left = 0;
- bitmap_rect.top = dlg_rect.top = 0;
- bitmap_rect.right = dlg_rect.right = bm.bmWidth;
- bitmap_rect.bottom = dlg_rect.bottom = bm.bmHeight;
-
- //-----------------------------------------------------------------------
- // Set the x, y, width, height of the Dialog and bitmaps dimensions.
- //-----------------------------------------------------------------------
- dlg_rect.left = 0;
- dlg_rect.top = 0;
-
- if( b640X480 ) {
- dlg_rect.right = rect.right;
- dlg_rect.bottom = tray_rect.bottom; // desktop smaller than image
- } else if( b800X600 ) {
- if(true){
- dlg_rect.right = bm.bmWidth + 6;
- dlg_rect.bottom = bm.bmHeight + GetSystemMetrics( SM_CYCAPTION ) + 6; // desktop larger than image
- } else {
- dlg_rect.right = 640;//bm.bmWidth + 6;
- dlg_rect.bottom = 480; //bm.bmHeight + GetSystemMetrics( SM_CYCAPTION ) + 6; // desktop larger than image
- }
- } else {
- dlg_rect.right = bm.bmWidth + 6;
- dlg_rect.bottom = bm.bmHeight + GetSystemMetrics( SM_CYCAPTION ) + 6; // desktop larger than image
- }
-
- //=======================================================================
- // Recreate Buttons based on Registry.
- //=======================================================================
- GlobalMainWindow->Create_Buttons( window_handle, &dlg_rect );
-
- //=======================================================================
- // Set Main Rectangle Areas around all the Buttons.
- //=======================================================================
-
- //-----------------------------------------------------------------------
- // Who is the first button?
- //-----------------------------------------------------------------------
- i = 0;
- while ( i < NUM_BUTTONS ) {
- if ( ButtonList[i] == NULL ) {
- i++;
- } else {
- break;
- }
- }
-
- if( i >= NUM_BUTTONS || i < 0 ) {
- i = 0;
- }
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("----------------------------- determining button area ---------------------------" ));
-
- buttons_rect.left = ButtonSizes[i].left;
- buttons_rect.top = ButtonSizes[i].top;
- buttons_rect.right = ButtonSizes[i].left + ButtonSizes[i].right;
- buttons_rect.bottom = ButtonSizes[i].top + ButtonSizes[i].bottom;
-
-// Msg( __LINE__, TEXT(__FILE__), TEXT("buttons_rect = [%d,%d,%d,%d]"), buttons_rect.left, buttons_rect.top, buttons_rect.right, buttons_rect.bottom );
-
- for( j = 0; j < NUM_BUTTONS; j++ ) {
- if ( ButtonList[j] != NULL ) {
- buttons_rect.left = __min( ButtonSizes[j].left , buttons_rect.left );
- buttons_rect.top = __min( ButtonSizes[j].top , buttons_rect.top );
- buttons_rect.right = __max( ButtonSizes[j].left + ButtonSizes[j].right , buttons_rect.right );
- buttons_rect.bottom = __max( ButtonSizes[j].top + ButtonSizes[j].bottom , buttons_rect.bottom );
- }
- }
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("buttons_rect = [%d,%d,%d,%d]"), buttons_rect.left, buttons_rect.top, buttons_rect.right, buttons_rect.bottom );
- Msg( __LINE__, TEXT(__FILE__), TEXT("----------------------------- determining button area ---------------------------" ));
-
- //=======================================================================
- // Center the dialog on the desktop.
- //=======================================================================
- if ( !b640X480 ) {
- MoveWindow( window_handle,
- ( rect.right - dlg_rect.right )/2,
- ( rect.bottom - dlg_rect.bottom )/2,
- dlg_rect.right,
- dlg_rect.bottom, TRUE );
- } else {
- MoveWindow( window_handle,
- 0, 0,
- dlg_rect.right,
- dlg_rect.bottom, TRUE );
- }
-
- //-----------------------------------------------------------------------
- // Get the new Client area.
- //-----------------------------------------------------------------------
- GetClientRect( window_handle, &dlg_rect );
-
-
- //=======================================================================================
- // JFS: 8/26/03 -- This was not getting cleared so if the button cnt were reduced...
- //=======================================================================================
- memset( BackgroundRect, 0, sizeof ( BackgroundRect ) );
-
- //=======================================================================
- // These are the areas of the Background to paint minus the Button Area.
- // This will prevent "flickering".
- //=======================================================================
- BackgroundRect[0].left = dlg_rect.left;
- BackgroundRect[0].top = dlg_rect.top;
- BackgroundRect[0].right = dlg_rect.right;
- BackgroundRect[0].bottom = buttons_rect.top;
-
- BackgroundRect[1].left = dlg_rect.left;
- BackgroundRect[1].top = buttons_rect.top;
- BackgroundRect[1].right = buttons_rect.left;
- BackgroundRect[1].bottom = dlg_rect.bottom;
-
- BackgroundRect[2].left = buttons_rect.left;
- BackgroundRect[2].top = buttons_rect.bottom;
- BackgroundRect[2].right = buttons_rect.right;
- BackgroundRect[2].bottom = dlg_rect.bottom;
-
- BackgroundRect[3].left = buttons_rect.right;
- BackgroundRect[3].top = buttons_rect.top;
- BackgroundRect[3].right = dlg_rect.right;
- BackgroundRect[3].bottom = dlg_rect.bottom;
-
- //=======================================================================
- // Find Areas that are in between, infront of, and behind each Buttons.
- //=======================================================================
- i = 0;
- j = 4;
-
- //-----------------------------------------------------------------------
- // Who is the first button?
- //-----------------------------------------------------------------------
- while ( i < NUM_BUTTONS ) {
- if ( ButtonList[i] == NULL ) {
- i++;
- } else {
- break;
- }
- }
-
- if( i >= NUM_BUTTONS || i < 0 ) {
- i = 0;
- }
-
- //-----------------------------------------------------------------------
- // For each button...
- //-----------------------------------------------------------------------
- int index = i;
- for( ; index < NUM_BUTTONS; index++ ) {
-
- //-------------------------------------------------------------------
- // Make areas between the buttons.
- //-------------------------------------------------------------------
- if ( ButtonList[index] != NULL && ButtonList[index+1] != NULL ) {
-
- // Area between buttons.
- BackgroundRect[j].top = ButtonList[index]->Return_Y_Pos() + ButtonList[index]->Return_Height();
- BackgroundRect[j].bottom = ButtonList[index+1]->Return_Y_Pos() - BackgroundRect[j].top;
- BackgroundRect[j].left = BackgroundRect[1].right;
- BackgroundRect[j].right = BackgroundRect[3].left - BackgroundRect[1].left - 1;
- j++;
- }
-
- //-------------------------------------------------------------------
- // Now look for areas in front of and behind each button.
- //-------------------------------------------------------------------
- if ( ButtonList[index] != NULL ) {
-
- // Area in front of buttons.
- BackgroundRect[j].top = ButtonList[index]->Return_Y_Pos();
- BackgroundRect[j].bottom = ButtonList[index]->Return_Height();
- BackgroundRect[j].left = BackgroundRect[1].right;
- BackgroundRect[j].right = ButtonList[index]->Return_X_Pos() - BackgroundRect[1].right;
- j++;
-
- // Area behind buttons.
- BackgroundRect[j].top = ButtonList[index]->Return_Y_Pos();
- BackgroundRect[j].bottom = ButtonList[index]->Return_Height();
- BackgroundRect[j].left = ButtonList[index]->Return_X_Pos() + ButtonList[index]->Return_Width();
- BackgroundRect[j].right = BackgroundRect[3].left - ( ButtonList[index]->Return_X_Pos() + ButtonList[index]->Return_Width());
- j++;
- }
- }
-
- #if(_DEBUG)
- Msg( __LINE__, TEXT(__FILE__), TEXT("----------------------------- WM_INITDIALOG ---------------------------" ));
- Msg( __LINE__, TEXT(__FILE__), TEXT("DeskTopWindowRect(w/o tray) = [%d,%d,%d,%d]"), tray_rect.left, tray_rect.top, tray_rect.right, tray_rect.bottom );
- Msg( __LINE__, TEXT(__FILE__), TEXT("DeskTopWindowRect = [%d,%d,%d,%d]"), rect.left, rect.top, rect.right, rect.bottom );
- Msg( __LINE__, TEXT(__FILE__), TEXT("b640X480 = [%d]"), b640X480 );
- Msg( __LINE__, TEXT(__FILE__), TEXT("b800X600 = [%d]"), b800X600 );
- Msg( __LINE__, TEXT(__FILE__), TEXT("ClientRect = [%d,%d,%d,%d]"), dlg_rect.left, dlg_rect.top, dlg_rect.right, dlg_rect.bottom );
-
- for( index = 0; index < ( NUM_BUTTONS * 3 ) + 3; index++ ) {
- Msg( __LINE__, TEXT(__FILE__), TEXT("BackgroundRect[%d] = [%d,%d,%d,%d]"), index, BackgroundRect[index].top, BackgroundRect[index].bottom, BackgroundRect[index].left, BackgroundRect[index].right );
- }
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("BitmapRect = [%d,%d,%d,%d]"), bitmap_rect.left, bitmap_rect.top, bitmap_rect.right, bitmap_rect.bottom );
- Msg( __LINE__, TEXT(__FILE__), TEXT("FlickerRect = [%d,%d,%d,%d]"), flicker_rect.left, flicker_rect.top, flicker_rect.right, flicker_rect.bottom );
- Msg( __LINE__, TEXT(__FILE__), TEXT("ButtonsRect = [%d,%d,%d,%d]"), buttons_rect.left, buttons_rect.top, buttons_rect.right, buttons_rect.bottom );
- Msg( __LINE__, TEXT(__FILE__), TEXT("-----------------------------------------------------------------------" ));
- #endif
-
- #else
-
- //-----------------------------------------------------------------------
- // Create Brush.
- //-----------------------------------------------------------------------
- hStaticBrush = CreateSolidBrush( RGB( 192, 192, 192 ));
-
- #endif
-
- //=======================================================================
- // Set dialog's timer! 1000 = 1 second.
- //=======================================================================
-// timer_id = SetTimer( window_handle, 1000, 250L, NULL );
- timer_id = SetTimer( window_handle, 1000, 500L, NULL );
- }
- return( TRUE );
-
- //-------------------------------------------------------------------------------
- // Try and set a custom cursor.
- //-------------------------------------------------------------------------------
-// case WM_SETCURSOR:
-// SetCursor(LoadCursor( Main::hInstance, MAKEINTRESOURCE(2)));
-// break;
-
- //-------------------------------------------------------------------------------
- // Tell Window to Select Palette if we are not the Focused Window.
- // This is to avoid getting stuck in a loop of receiving this msg
- // when we are focused.
- //-------------------------------------------------------------------------------
- case WM_PALETTECHANGED:
- if (( HWND )w_param != window_handle ) {
- SendMessage( window_handle, WM_QUERYNEWPALETTE, w_param, l_param );
- }
- break;
-
- //-------------------------------------------------------------------------------
- // Set and Realize our palette, then repaint if necessary.
- // Note that SelectPalette here is passed a FALSE.
- // This means reset palette as if we are in the foreground.
- //-------------------------------------------------------------------------------
- case WM_QUERYNEWPALETTE:
- hDC = GetDC( window_handle );
- hpalold = SelectPalette( hDC, hpal, FALSE );
- i = RealizePalette( hDC );
- if ( i != 0 ) {
- InvalidateRect( window_handle, &dlg_rect, TRUE );
- }
- SelectPalette( hDC, hpalold, TRUE );
- RealizePalette( hDC );
- ReleaseDC( window_handle, hDC );
- return i;
-
- //-------------------------------------------------------------------------------
- // Process Timer Messages.
- //-------------------------------------------------------------------------------
- case WM_TIMER:
- {
- if ( w_param == 1000 ) {
-
-// if ( Flicker && hFlicker[FlickerIndex] ) {
- if ( Flicker && hFlicker[0] ) {
-
- FlickerIndex++;
-// if ( FlickerIndex >= NUM_FLICKER_FRAMES ) {
- if ( FlickerIndex >= NUM_FLICKER_POSITIONS ) {
- FlickerIndex = 0;
- }
-
- InvalidateRect( window_handle, &flicker_rect, FALSE );
- flicker_rect.left = FlickerPositions[ FlickerIndex ][0];
- InvalidateRect( window_handle, &flicker_rect, FALSE );
- UpdateWindow( window_handle );
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("WM_TIMER: FlickerRect = [%d,%d,%d,%d]"), flicker_rect.left, flicker_rect.right, flicker_rect.top, flicker_rect.bottom );
- }
- }
-
- //-----------------------------------------------------------------------
- // If game is running, the mutex will return! Time to exit...
- // Note: This number is unique for Tiberian Sun ONLY!!!
- //-----------------------------------------------------------------------
- if( WinVersion.Is_Win_XP() || WinVersion.Version() > 500 ) {
- strcat( strcpy( szBuffer, "Global\\" ), GAME_MUTEX_OBJECT );
- } else {
- strcpy( szBuffer, GAME_MUTEX_OBJECT );
- }
- GameAppMutex = OpenMutex( MUTEX_ALL_ACCESS, FALSE, szBuffer );
-
- if ( GameAppMutex != NULL ) {
-
- //---------------------------------------------------------
- // Handle(s) are closed in the ProgEnd().
- //---------------------------------------------------------
-
- HWND ccwindow = FindWindow( szGameWindow, NULL );
- if ( ccwindow ) {
- if( IsIconic( ccwindow )){
- ShowWindow( ccwindow, SW_RESTORE );
- }
- SetForegroundWindow( ccwindow );
-
- } else {
-
- ccwindow = FindWindow( szSetupWindow, NULL );
- if ( ccwindow ) {
- if( IsIconic( ccwindow )){
- ShowWindow( ccwindow, SW_RESTORE );
- }
- SetForegroundWindow( ccwindow );
- }
- }
-
- PostMessage( window_handle, WM_COMMAND, (WPARAM)MAKELONG( IDD_CANCEL, BN_CLICKED ), (LPARAM)GetDlgItem( window_handle, IDD_CANCEL ));
- }
- }
- return ( 0 );
-
- //===============================================================================
- // Dialog's main paint routine.
- //===============================================================================
- case WM_PAINT:
-
- //---------------------------------------------------------------------------
- // If there is an area to update, repaint it.
- //---------------------------------------------------------------------------
- if ( GetUpdateRect( window_handle, &paint_rect, FALSE )) {
-
-// Msg( __LINE__, TEXT(__FILE__), TEXT("---------------------- WM_PAINT ---------------------"), i );
-// Msg( __LINE__, TEXT(__FILE__), TEXT("Rectangle to update = [%d,%d,%d,%d]"), paint_rect.left, paint_rect.top, paint_rect.right, paint_rect.bottom );
-
- //-----------------------------------------------------------------------
- // Get dialog's hDC.
- //-----------------------------------------------------------------------
- hDC = BeginPaint( window_handle, &ps );
-
- #if( BACKGROUND_BITMAP )
-
- if ( hBitmap ) {
-
- //---------------------------------------------------------------
- // Create a compatible DC for the bitmap.
- //---------------------------------------------------------------
- memDC = CreateCompatibleDC( hDC );
- buttonDC = CreateCompatibleDC( hDC );
- licenseDC = CreateCompatibleDC( hDC );
-
- //---------------------------------------------------------------
- // Set stretching mode for bitmaps.
- //---------------------------------------------------------------
- prevDCStretchMode = SetStretchBltMode( hDC, STRETCH_DELETESCANS );
- prevMemDCStretchMode = SetStretchBltMode( memDC, STRETCH_DELETESCANS );
- prevButtonDCStretchMode = SetStretchBltMode( buttonDC,STRETCH_DELETESCANS );
- prevLicenseDCStretchMode = SetStretchBltMode( licenseDC,STRETCH_DELETESCANS );
-
- //---------------------------------------------------------------
- // Set the palette in each DC.
- //---------------------------------------------------------------
- hpalold = SelectPalette( hDC, hpal, FALSE );
- RealizePalette( hDC );
- SelectPalette( memDC, hpal, FALSE );
- RealizePalette( memDC );
- SelectPalette( buttonDC, hpal, FALSE );
- RealizePalette( buttonDC );
- SelectPalette( licenseDC, hpal, FALSE );
- RealizePalette( licenseDC );
-
- //---------------------------------------------------------------
- // If area to update is a button area, this will be drawn farther
- // on. This is to prevent "flickering" by drawing the background
- // then the button image.
- //---------------------------------------------------------------
- for ( i = 0; i < NUM_BUTTONS; i++ ) {
-
- if ( ButtonList[i] ) {
-
- ButtonList[i]->Return_Area( &rect );
-
- if ( paint_rect.left == rect.left &&
- paint_rect.top == rect.top &&
- paint_rect.right == rect.right &&
- paint_rect.bottom == rect.bottom ) {
-
- PaintBackground = FALSE;
-// Msg( __LINE__, TEXT(__FILE__), TEXT("Rectangle matches a button to update = [%d,%d,%d,%d]"), rect.left, rect.top, rect.right, rect.bottom );
- break;
- }
- }
- }
-
- //===============================================================
- // Paint the background.
- //===============================================================
- if ( PaintBackground ) {
-
- //-----------------------------------------------------------
- // Select & Draw the background bitmap.
- //-----------------------------------------------------------
- oldBitmap = ( HBITMAP )SelectObject( memDC, hBitmap );
-
- //-----------------------------------------------------------
- // Updates area around the button area.
- //-----------------------------------------------------------
- #if(1)
- for( int i=0; i < ( NUM_BUTTONS * 3 ) + 3; i++ ) {
-
- if( BackgroundRect[i].left != 0 || BackgroundRect[i].top != 0 ||
- BackgroundRect[i].right != 0 || BackgroundRect[i].bottom != 0 ) {
-
- result = StretchBlt( hDC,
- BackgroundRect[i].left,
- BackgroundRect[i].top,
- BackgroundRect[i].right,
- BackgroundRect[i].bottom,
- memDC,
- BackgroundRect[i].left,
- BackgroundRect[i].top,
- BackgroundRect[i].right,
- BackgroundRect[i].bottom,
- SRCCOPY );
-
- if( result != 0 ) {
-// Msg( __LINE__, TEXT(__FILE__), TEXT("Paint this rect = [%d,%d,%d,%d]"), BackgroundRect[i].left, BackgroundRect[i].top, BackgroundRect[i].right, BackgroundRect[i].bottom );
- }
-
- #if(0)
- HPEN pen = CreatePen( /*PS_DOT*/ PS_SOLID, 1, TEXT_COLOR );
- HGDIOBJ oldpen = SelectObject( hDC, pen );
- SetBkMode( hDC, TRANSPARENT );
-
- MoveToEx( hDC, BackgroundRect[i].left+1, BackgroundRect[i].top+1, NULL );
- LineTo( hDC, BackgroundRect[i].right-1, BackgroundRect[i].top+1 );
- LineTo( hDC, BackgroundRect[i].right-1, BackgroundRect[i].bottom-1 );
- LineTo( hDC, BackgroundRect[i].left+1, BackgroundRect[i].bottom-1 );
- LineTo( hDC, BackgroundRect[i].left+1, BackgroundRect[i].top+1 );
-
- SelectObject( hDC, oldpen );
- DeleteObject( pen );
- #endif
- }
- }
-/*
- //-----------------------------------------------------------
- // Select & Draw the background bitmap.
- //-----------------------------------------------------------
- oldLicenseBitmap = ( HBITMAP )SelectObject( licenseDC, hLicenseBitmap );
-
- //-----------------------------------------------------------
- // Updates area around the button area.
- //-----------------------------------------------------------
- result = StretchBlt( hDC,
- license_rect.left,
- license_rect.top,
- license_rect.right,
- license_rect.bottom,
- licenseDC,
- 0,
- 0,
- license_rect.right,
- license_rect.bottom,
- SRCCOPY );
-*/
- #else
-
- //-----------------------------------------------------------
- // Blit whole background, in one shot.
- //-----------------------------------------------------------
- StretchBlt( hDC, dlg_rect.left, dlg_rect.top, dlg_rect.right, dlg_rect.bottom,
- memDC, bitmap_rect.left, bitmap_rect.top, bitmap_rect.right, bitmap_rect.bottom,
- SRCCOPY );
- #endif
-
- SelectObject( memDC, oldBitmap );
- SelectObject( licenseDC, oldLicenseBitmap );
-
- } else {
- PaintBackground = TRUE;
- }
-
- //---------------------------------------------------------------
- // Animation.
- //---------------------------------------------------------------
-// if ( Flicker && hFlicker[FlickerIndex] ) {
- if ( Flicker && hFlicker[0] ) {
-
-// oldBitmap = ( HBITMAP )SelectObject( memDC, hFlicker[FlickerIndex] );
- oldBitmap = ( HBITMAP )SelectObject( memDC, hFlicker[0] );
-
- StretchBlt(
- hDC,
- flicker_rect.left,
- flicker_rect.top,
- flicker_rect.right,
- flicker_rect.bottom,
- memDC,
- 0,
- 0,
- flicker_rect.right,
- flicker_rect.bottom,
- SRCCOPY );
-
- #if(0)
- HPEN pen = CreatePen( /*PS_DOT*/ PS_SOLID, 1, TEXT_COLOR );
- HGDIOBJ oldpen = SelectObject( hDC, pen );
- SetBkMode( hDC, TRANSPARENT );
-
- MoveToEx( hDC, flicker_rect.left+1, flicker_rect.top+1, NULL );
- LineTo( hDC, flicker_rect.right-1, flicker_rect.top+1 );
- LineTo( hDC, flicker_rect.right-1, flicker_rect.bottom-1 );
- LineTo( hDC, flicker_rect.left+1, flicker_rect.bottom-1 );
- LineTo( hDC, flicker_rect.left+1, flicker_rect.top+1 );
-
- SelectObject( hDC, oldpen );
- DeleteObject( pen );
- #endif
-
- SelectObject( memDC, oldBitmap );
-
-// Msg( __LINE__, TEXT(__FILE__), TEXT(" Drawing Flicker [%d,%d,%d,%d]."), flicker_rect.left, flicker_rect.top, flicker_rect.right, flicker_rect.bottom );
- }
-
- //---------------------------------------------------------------
- // Draw each button.
- //---------------------------------------------------------------
- for ( i = 0; i < NUM_BUTTONS; i++ ) {
-
- if ( ButtonList[i] ) {
-
- Rect rect;
-
- //-------------------------------------------------------
- // Uses Bitmaps or DrawText???
- //-------------------------------------------------------
- if ( ButtonList[i]->Draw_Bitmaps()) {
-
- RECT src_rect, dst_rect;
-
- strcpy( szButtonBitmap, ButtonList[i]->Return_Bitmap( ));
- hButtonBitmap = LoadResourceBitmap( Main::hInstance, szButtonBitmap, &hpal, TRUE );
- if ( hButtonBitmap ) {
-
- GetObject( hButtonBitmap, sizeof( BITMAP ), (LPTSTR)&bm );
-
- dst_rect.left = ButtonList[i]->Return_X_Pos();
- dst_rect.top = ButtonList[i]->Return_Y_Pos();
- dst_rect.right = ButtonList[i]->Return_Stretched_Width();
- dst_rect.bottom = ButtonList[i]->Return_Stretched_Height();
- src_rect.left = 0;
- src_rect.top = 0;
- src_rect.right = bm.bmWidth;
- src_rect.bottom = bm.bmHeight;
-
- //-----------------------------------------------
- // Draw the button's bitmap background.
- //-----------------------------------------------
- oldBitmap = ( HBITMAP ) SelectObject( buttonDC, hButtonBitmap );
- StretchBlt(
- hDC,
- dst_rect.left,
- dst_rect.top,
- dst_rect.right,
- dst_rect.bottom,
- buttonDC,
- src_rect.left,
- src_rect.top,
- src_rect.right,
- src_rect.bottom,
- SRCCOPY );
-
- SelectObject( buttonDC, oldBitmap );
- DeleteObject( hButtonBitmap );
- hButtonBitmap = 0;
- }
-
- } // END OF DRAW BITMAPS
-
-#if(0)
- TTFontClass *fontptr = ButtonList[i]->Return_Font_Ptr();
- if ( fontptr ) {
-
- RECT outline_rect;
-
- ButtonList[i]->Return_Area( &outline_rect );
- ButtonList[i]->Return_Text_Area( &rect );
-
- /*
- ** This function was combining the pixel color with the background,
- ** so it never looked correct.
- */
-// SetTextColor( hDC, RGB( 0, 240, 0 ));
-// DrawFocusRect( hDC, &dst_rect );
-
- if ( ButtonList[i]->Get_State() == DrawButton::PRESSED_STATE ) {
- fontptr->Print(
- hDC,
- ButtonList[i]->Return_Text(),
- rect,
- TEXT_PRESSED_COLOR,
- TEXT_PRESSED_SHADOW_COLOR,
- TPF_BUTTON,
- TPF_SHADOW );
-
- } else if ( ButtonList[i]->Get_State() == DrawButton::FOCUS_STATE ) {
- fontptr->Print(
- hDC,
- ButtonList[i]->Return_Text(),
- rect,
- TEXT_FOCUSED_COLOR,
- TEXT_FOCUSED_SHADOW_COLOR,
- TPF_BUTTON,
- TPF_SHADOW );
-
- } else {
- fontptr->Print(
- hDC,
- ButtonList[i]->Return_Text(),
- rect,
- TEXT_NORMAL_COLOR,
- TEXT_NORMAL_SHADOW_COLOR,
- TPF_BUTTON,
- TPF_SHADOW );
- }
-
- #if(0)
- HPEN pen = CreatePen( /*PS_DOT*/ PS_SOLID, 2, TEXT_COLOR );
- HGDIOBJ oldpen = SelectObject( hDC, pen );
- SetBkMode( hDC, TRANSPARENT );
-
- MoveToEx( hDC, // handle to device context
- outline_rect.left, // x-coordinate of new current position
- outline_rect.top, // y-coordinate of new current position
- NULL ); // pointer to old current position
-
- LineTo( hDC, // device context handle
- outline_rect.right, // x-coordinate of line's ending point
- outline_rect.top ); // y-coordinate of line's ending point
-
- LineTo( hDC, // device context handle
- outline_rect.right, // x-coordinate of line's ending point
- outline_rect.bottom ); // y-coordinate of line's ending point
-
- LineTo( hDC, // device context handle
- outline_rect.left, // x-coordinate of line's ending point
- outline_rect.bottom ); // y-coordinate of line's ending point
-
- LineTo( hDC, // device context handle
- outline_rect.left, // x-coordinate of line's ending point
- outline_rect.top ); // y-coordinate of line's ending point
-
- SelectObject( hDC, oldpen );
- DeleteObject( pen );
- #endif
- }
-#else
- ButtonList[i]->Draw_Text( hDC );
-#endif
-
-
-
- } // end of if button
-
- } // For each button...
-
- //---------------------------------------------------------------
- // Used in debugging -- draw rect around where buttons are.
- //---------------------------------------------------------------
- #if(0)
- {
- HPEN hPen1 = CreatePen( PS_SOLID, 1, RGB( 255, 255, 255 ));
- if (hPen1) {
-
- for ( int i = 0; i < NUM_BUTTONS; i++ ) {
- if ( ButtonList[i] ) {
-
- HGDIOBJ oldpen = SelectObject( hDC, hPen1 );
-
- MoveToEx( hDC,
- ButtonList[i]->Return_X_Pos()-1,
- ButtonList[i]->Return_Y_Pos()-1, NULL );
- LineTo( hDC,
- ButtonList[i]->Return_X_Pos() + ButtonList[i]->Return_Width() + 1,
- ButtonList[i]->Return_Y_Pos()-1 );
- LineTo( hDC,
- ButtonList[i]->Return_X_Pos() + ButtonList[i]->Return_Width() + 1,
- ButtonList[i]->Return_Y_Pos() + ButtonList[i]->Return_Height() + 1);
- LineTo( hDC,
- ButtonList[i]->Return_X_Pos()-1,
- ButtonList[i]->Return_Y_Pos() + ButtonList[i]->Return_Height() + 1);
- LineTo( hDC,
- ButtonList[i]->Return_X_Pos() - 1,
- ButtonList[i]->Return_Y_Pos() - 1);
-
- SelectObject( hDC, oldpen );
- }
- }
- }
- DeleteObject( hPen1 );
- }
- #endif
-
- //---------------------------------------------------------------
- // Restore all default objects to DCs and delete.
- //---------------------------------------------------------------
- SetStretchBltMode( hDC, prevDCStretchMode );
- SetStretchBltMode( memDC, prevMemDCStretchMode );
- SetStretchBltMode( buttonDC, prevButtonDCStretchMode );
- SetStretchBltMode( licenseDC, prevLicenseDCStretchMode );
-
- SelectPalette( hDC, hpalold, FALSE );
- SelectPalette( memDC, hpalold, FALSE );
- SelectPalette( buttonDC, hpalold, FALSE );
- SelectPalette( licenseDC, hpalold, FALSE );
-
- DeleteDC( memDC );
- DeleteDC( buttonDC );
- DeleteDC( licenseDC );
-
- } // end of bitmaps
-
- //===================================================================
- // Draw a solid colored background.
- //===================================================================
-// GetClientRect( window_handle, (LPRECT) &dlg_rect );
-// FillRect( hDC, &dlg_rect, (HBRUSH)( COLOR_WINDOW + 1 ));
-
- //===================================================================
- // Print text at bottom of screen.
- //===================================================================
- Rect text_rect;
- TTFontClass *fontptr = NULL;
-
- if ( b640X480 ) {
- fontptr = TTTextFontPtr640;
- } else if ( b800X600 ) {
- fontptr = TTTextFontPtr800;
- } else {
- fontptr = TTTextFontPtr;
- }
-
- if ( fontptr ) {
-
- if ( b640X480 || b800X600 ) {
- text_rect.X = 10;
- text_rect.Y = 240;
- text_rect.Width = 140; //498;
- text_rect.Height = 100; //26;
- } else {
- text_rect.X = 20;
- text_rect.Y = 340;
- text_rect.Width = 180; //498;
- text_rect.Height = 120; //26;
- }
-
- #if(0)
- RECT one;
-
- one.left = text_rect.X;
- one.top = text_rect.Y;
- one.right = text_rect.X + text_rect.Width;
- one.bottom = text_rect.Y + text_rect.Height;
-
- FrameRect( hDC, &one, (HBRUSH)( COLOR_WINDOW + 1 ));
-// DrawFocusRect( hDC, &one );
- #endif
-
- //---------------------------------------------------------------
- // WESTWOOD_COM Message at the top.
- //---------------------------------------------------------------
-/*
- fontptr->Print(
- hDC,
- szWholeWSMsg,
- text_rect,
- TEXT_COLOR,
- SHADOW_COLOR,
- TPF_CENTER_TEXT,
- TPF_SHADOW );
-*/
- }
-
- //---------------------------------------------------------------
- // EA_COM Message at the bottom.
- //---------------------------------------------------------------
- #if(0) // Moved this text to a bitmap.
- fontptr = TTLicenseFontPtr;
- if( fontptr ) {
-
- if ( b640X480 || b800X600 ) {
- text_rect.X = 220;
- text_rect.Y = 400;
- text_rect.Width = 300; //460;
- text_rect.Height = 48; //26;
- } else {
- text_rect.X = 250;
- text_rect.Y = 574;
- text_rect.Width = 420; //460;
- text_rect.Height = 60; //26;
- }
-
- #if(0)
- RECT one;
-
- one.left = text_rect.X;
- one.top = text_rect.Y;
- one.right = text_rect.X + text_rect.Width;
- one.bottom = text_rect.Y + text_rect.Height;
-
- FrameRect( hDC, &one, (HBRUSH)( COLOR_WINDOW + 1 ));
-// DrawFocusRect( hDC, &one );
- #endif
-
- fontptr->Print(
- hDC,
- szWholeString,
- text_rect,
- TEXT_COLOR,
- SHADOW_COLOR,
- TPF_CENTER_TEXT,
- TPF_SHADOW );
- }
- #endif
-
- #else
- //-------------------------------------------------------------------
- // Select the Brush if it was successfully created.
- //-------------------------------------------------------------------
- if ( hStaticBrush ) {
- HBRUSH oldBrush = (HBRUSH) SelectObject( hDC, hStaticBrush );
- GetClientRect( window_handle, (LPRECT) &dlg_rect );
- FillRect( hDC, &dlg_rect, hStaticBrush );
- SelectObject( hDC, oldBrush );
- }
- #endif
-
-// Msg( __LINE__, TEXT(__FILE__), TEXT("--------------------------------------------------------" ));
-
- EndPaint( window_handle, &ps );
-
- //-----------------------------------------------------------------------
- // Play DISK.WAV sound on CD.
- //-----------------------------------------------------------------------
- if ( FirstTime ) {
- if( UseSounds ) {
- PlaySound( szWavs[ SongNumber ], NULL, SND_ASYNC | SND_RESOURCE );
- }
- FirstTime = FALSE;
- }
- } /* end of if */
- break;
-
- //-------------------------------------------------------------------------------
- // Background needs to be erased. Note we are returning 1 here to "fake"
- // Windows into thinking we have already repainted the background with
- // our window brush. This prevents "flickering" because of background
- // being repainted ( ususally white ) before WM_PAINT is processed.
- //-------------------------------------------------------------------------------
- #if(BACKGROUND_BITMAP)
- case WM_ERASEBKGND:
- InvalidateRect( window_handle, &dlg_rect, FALSE );
- return ( 1 );
- #endif
-
- //-------------------------------------------------------------------------------
- // Check which button was pressed. If Explorer button was pressed,
- // call it now so we don't have to exit dialog.
- //-------------------------------------------------------------------------------
- case WM_COMMAND:
- {
- idCtl = LOWORD( w_param );
-
- unsigned int result = TRUE;
- bool end_dialog = false;
- int cd_drive;
-
- szBuffer[1] = '\0';
- szBuffer[0] = tolower( szArgvPath[0] );
-// cd_drive = (int)( szBuffer[0] - 'a' + 1 );
- cd_drive = (int)( szBuffer[0] - 'a' );
-
- #if(BACKGROUND_BITMAP)
-
- switch ( idCtl ) {
-
- //-------------------------------------------------------------------
- // IDD_MOHAVI
- //-------------------------------------------------------------------
- case IDD_PREVIEWS:
- {
- Msg( __LINE__, TEXT(__FILE__), TEXT("IDD_PREVIEWS Selected." ));
- // show the previews in succession. each will wait for the previous to finish
- // before playing.
- unsigned int success;
-
- char filepath[MAX_PATH];
- _snprintf(filepath, MAX_PATH, "%s%s", szArgvPath, SC4AVI_FILENAME);
-
- success = GlobalMainWindow->Run_OpenFile(cd_drive, filepath, true);
-// if (success != 0) {
-// success = GlobalMainWindow->Run_OpenFile(cd_drive, BFAVI_FILENAME, true);
-// }
-/*
- if (success == 0) {
- std::wstring wideBuffer = TheGameText->fetch("Autorun:CantRunAVIs");
- std::wstring wideBuffer2 = TheGameText->fetch("Autorun:Error");
- int length = wideBuffer.length();
- WideCharToMultiByte( CodePage, 0, wideBuffer.c_str(), length+1, szBuffer, _MAX_PATH, NULL, NULL );
- length = wideBuffer2.length();
- WideCharToMultiByte( CodePage, 0, wideBuffer2.c_str(), length+1, szBuffer2, _MAX_PATH, NULL, NULL );
- MessageBox( NULL, szBuffer, szBuffer2, MB_APPLMODAL | MB_OK );
- }
-*/
- }
- break;
-
- case IDD_HELP:
- {
- std::wstring wFileName;
- wFileName = Locale_GetString(HELP_FILENAME);
-
- std::string fname;
- const wchar_t *tmp = wFileName.c_str();
- char hack[2] = "a";
- while (*tmp)
- {
- hack[0] = (char)( *tmp & 0xFF );
- fname.append( hack );
- tmp++;
- }
-
- char newdir[MAX_PATH];
- char olddir[MAX_PATH];
- char filepath[MAX_PATH];
-
- GetCurrentDirectory(MAX_PATH, olddir);
-
- _snprintf(newdir, MAX_PATH, "%ssupport", szArgvPath);
- SetCurrentDirectory(newdir);
-
- _snprintf(filepath, MAX_PATH, "%s%s", szArgvPath, fname.c_str());
-
- unsigned int success;
- success = GlobalMainWindow->Run_OpenFile(cd_drive, filepath, false);
-
- SetCurrentDirectory(olddir);
-
-/*
- if (success == 0) {
- std::wstring wideBuffer = TheGameText->fetch("Autorun:CantRunHelp");
- std::wstring wideBuffer2 = TheGameText->fetch("Autorun:Error");
- int length = wideBuffer.length();
- WideCharToMultiByte( CodePage, 0, wideBuffer.c_str(), length+1, szBuffer, _MAX_PATH, NULL, NULL );
- length = wideBuffer2.length();
- WideCharToMultiByte( CodePage, 0, wideBuffer2.c_str(), length+1, szBuffer2, _MAX_PATH, NULL, NULL );
- MessageBox( NULL, szBuffer, szBuffer2, MB_APPLMODAL | MB_OK );
- }
-*/
- }
- break;
-
- //-------------------------------------------------------------------
- // IDD_CANCEL
- //-------------------------------------------------------------------
- case IDD_CANCEL:
- Msg( __LINE__, TEXT(__FILE__), TEXT("IDD_CANCEL Selected." ));
- end_dialog = true;
- break;
-
- //-------------------------------------------------------------------
- // IDD_OK -- Install
- // IDD_OK2 -- Play
- //-------------------------------------------------------------------
- case IDD_OK:
- case IDD_OK2:
- case IDD_OK3:
- case IDD_OK4:
-
-// if( !Is_On_CD( PRODUCT_VOLUME_CD1 ) && IsEnglish ) {
- if( !Is_On_CD( PRODUCT_VOLUME_CD1 )) {
-
- //-----------------------------------------------------------
- // If false is returned, then CANCEL was pressed.
- //-----------------------------------------------------------
- char volume_to_match[ MAX_PATH ];
-
- Reformat_Volume_Name( PRODUCT_VOLUME_CD1, volume_to_match );
-// result = Prompt_For_CD( window_handle, volume_to_match, IDS_INSERT_CDROM_WITH_VOLUME1, IDS_EXIT_MESSAGE2, &cd_drive );
- result = Prompt_For_CD( window_handle, volume_to_match, "Autorun:InsertCDROMWithVolume1", "Autorun:ExitMessage2", &cd_drive );
- }
-
- if ( result ) {
- if ( idCtl == IDD_OK ) {
- Msg( __LINE__, TEXT(__FILE__), TEXT("IDD_OK Selected." ));
- result = GlobalMainWindow->Run_Setup( window_handle, &dlg_rect, cd_drive );
- } else if ( idCtl == IDD_OK2 ) {
- Msg( __LINE__, TEXT(__FILE__), TEXT("IDD_OK2 Selected." ));
- result = GlobalMainWindow->Run_Game( window_handle, &dlg_rect );
- } else if (idCtl == IDD_OK3 ) {
- Msg( __LINE__, TEXT(__FILE__), TEXT("IDD_OK3 Selected, running WorldBuilder." ));
- result = GlobalMainWindow->Run_WorldBuilder( window_handle, &dlg_rect );
- } else if (idCtl == IDD_OK4 ) {
- Msg( __LINE__, TEXT(__FILE__), TEXT("IDD_OK4 Selected, running PatchGet." ));
- result = GlobalMainWindow->Run_PatchGet( window_handle, &dlg_rect );
- }
- }
-
- if ( result ) {
- end_dialog = true;
- }
- break;
-
- #if(SHOW_MOH_DEMO)
- //-------------------------------------------------------------------
- // Launch demo from CD.
- //-------------------------------------------------------------------
- case IDD_VIEW_DEMO:
-
- if( !Is_On_CD( PRODUCT_VOLUME_CD2 )) {
-
- //-----------------------------------------------------------
- // If false is returned, then CANCEL was pressed.
- //-----------------------------------------------------------
- char volume_to_match[ MAX_PATH ];
-
- Reformat_Volume_Name( PRODUCT_VOLUME_CD2, volume_to_match );
-// result = Prompt_For_CD( window_handle, volume_to_match, IDS_INSERT_CDROM_WITH_VOLUME2, IDS_EXIT_MESSAGE2, &cd_drive );
- result = Prompt_For_CD( window_handle, volume_to_match, AsciiString("Autorun:InsertCDROMWithVolume2"), AsciiString("Autorun:ExitMessage2"), &cd_drive );
- }
-
- if ( result ) {
- Msg( __LINE__, TEXT(__FILE__), TEXT("IDD_VIEW_DEMO Selected." ));
- result = GlobalMainWindow->Run_Demo( window_handle, &dlg_rect, cd_drive );
- }
-
- if ( result ) {
- end_dialog = true;
- }
-
- break;
- #endif
-
- #if( SHOW_GAMESPY_BUTTON )
- //-------------------------------------------------------------------
- // Launch GameSpy Website.
- //-------------------------------------------------------------------
- case IDD_GAMESPY:
- Msg( __LINE__, TEXT(__FILE__), TEXT("IDD_GAMESPY Selected." ));
- if( ViewHTML( GAMESPY_WEBSITE ))
- {
- end_dialog = true;
- }
- else
- {
- Error_Message( Main::hInstance, AsciiString("Autorun:Generals"), AsciiString("Autorun:CantFindExplorer"), GAME_WEBSITE );
- }
- break;
- #endif
-
- //-------------------------------------------------------------------
- // Create a new online account.
- //-------------------------------------------------------------------
- case IDD_NEW_ACCOUNT:
- Msg( __LINE__, TEXT(__FILE__), TEXT("IDD_NEW_ACCOUNT Selected." ));
- result = GlobalMainWindow->Run_New_Account( window_handle, &dlg_rect );
- if ( result ) {
- end_dialog = true;
- }
- break;
-
- //-------------------------------------------------------------------
- // IDD_REGISTER
- //-------------------------------------------------------------------
- case IDD_REGISTER:
- Msg( __LINE__, TEXT(__FILE__), TEXT("IDD_REGISTER Selected." ));
- result = GlobalMainWindow->Run_Register( window_handle, &dlg_rect );
- if ( result ) {
- end_dialog = true;
- }
- break;
-
- //-------------------------------------------------------------------
- // IDD_INTERNET
- //-------------------------------------------------------------------
- case IDD_INTERNET:
- Msg( __LINE__, TEXT(__FILE__), TEXT("IDD_INTERNET Selected." ));
- if( ViewHTML( GAME_WEBSITE )) {
- end_dialog = true;
- }
- else
- {
- Error_Message( Main::hInstance, "Autorun:Generals", "Autorun:CantFindExplorer", GAME_WEBSITE );
- }
- break;
-
- //-------------------------------------------------------------------
- // IDD_UPDATE
- //-------------------------------------------------------------------
- case IDD_UPDATE:
- Msg( __LINE__, TEXT(__FILE__), TEXT("IDD_UPDATE Selected." ));
- result = GlobalMainWindow->Run_Auto_Update( window_handle, &dlg_rect );
- if ( result ) {
- end_dialog = true;
- }
- break;
-
- //-------------------------------------------------------------------
- // IDD_EXPLORE
- //-------------------------------------------------------------------
- case IDD_EXPLORE:
- Msg( __LINE__, TEXT(__FILE__), TEXT("IDD_EXPLORE Selected." ));
- GlobalMainWindow->Run_Explorer( "", window_handle, &dlg_rect );
- end_dialog = true;
- break;
-
- //-------------------------------------------------------------------
- // IDD_UNINSTALL
- //-------------------------------------------------------------------
- case IDD_UNINSTALL:
- Msg( __LINE__, TEXT(__FILE__), TEXT("IDD_UNINSTALL Selected." ));
- result = GlobalMainWindow->Run_Uninstall( window_handle, &dlg_rect );
-
- //---------------------------------------------------------------
- // MML 5/27/99: I am exiting here because the we launch
- // Uninstll.exe which in turn launches Uninst.exe thus
- // ::Run_Install ends before Uninst.exe is done.
- //---------------------------------------------------------------
- if ( result ) {
- end_dialog = true;
- }
- break;
-
- default:
- break;
- }
-
- //-----------------------------------------------------------------------
- // Exit Autorun.
- //-----------------------------------------------------------------------
- if( end_dialog ) {
-
- for ( i = 0; i < NUM_BUTTONS; i++ ) {
- if ( ButtonList[i] ) {
- delete( ButtonList[i] );
- ButtonList[i] = NULL;
- }
- }
- if ( hpal ) {
- DeleteObject( hpal );
- }
- if ( hBitmap ) {
- DeleteObject( hBitmap );
- }
- for( i = 0; i < NUM_FLICKER_FRAMES; i++ ) {
- DeleteObject( hFlicker[i] );
- hFlicker[i] = 0;
- }
- Stop_Sound_Playing();
- KillTimer( window_handle, timer_id );
- EndDialog( window_handle, idCtl );
- }
-
- #else
- if ( hStaticBrush ) {
- DeleteObject( hStaticBrush );
- hStaticBrush = 0;
- }
- EndDialog( window_handle, idCtl );
- KillTimer( window_handle, timer_id );
- KillTimer( window_handle, gem_timer_id );
- #endif
-
- }
- break;
-
- //-------------------------------------------------------------------------------
- // This message is the response to the Close Button in upper right corner.
- //-------------------------------------------------------------------------------
- case WM_SYSCOMMAND:
-
- if ( w_param == SC_CLOSE ) {
- #if(BACKGROUND_BITMAP)
-
- for ( i = 0; i < NUM_BUTTONS; i++ ) {
- if ( ButtonList[i] ) {
- delete( ButtonList[i] );
- ButtonList[i] = NULL;
- }
- }
- if ( hpal ) {
- DeleteObject( hpal );
- }
- if ( hBitmap ) {
- DeleteObject( hBitmap );
- }
- for( i = 0; i < NUM_FLICKER_FRAMES; i++ ) {
- DeleteObject( hFlicker[i] );
- hFlicker[i] = 0;
- }
-
- #else
- if ( hStaticBrush ) {
- DeleteObject( hStaticBrush );
- hStaticBrush = 0;
- }
- #endif
-
- //-----------------------------------------------------------------------
- // Stop the sound if still going.
- //-----------------------------------------------------------------------
- Stop_Sound_Playing();
-
- //-----------------------------------------------------------------------
- // Delete the arguments.
- //-----------------------------------------------------------------------
- if ( Args ) {
- delete( Args );
- Args = NULL;
- }
- KillTimer( window_handle, timer_id );
- EndDialog( window_handle, w_param );
- }
- break;
-
- //-------------------------------------------------------------------------------
- // WM_SYSCOLORCHANGE Message.
- // If your applications uses controls in Windows 95/NT, forward the
- // WM_SYSCOLORCHANGE message to the controls.
- //-------------------------------------------------------------------------------
- #if( !BACKGROUND_BITMAP )
- case WM_SYSCOLORCHANGE:
- if ( hStaticBrush ) {
- DeleteObject( hStaticBrush );
- hStaticBrush = CreateSolidBrush( GetSysColor( COLOR_WINDOW ));
- }
- break;
- #endif
-
- //-------------------------------------------------------------------------------
- // WM_CTLCOLOR Message.
- // wParam Handle to Child Window's device context
- // LOWORD( lParam ) Child Window handle
- // HIWORD( lParam ) Type of Window: CTLCOLOR_MSGBOX, _EDIT, _LISTBOX, _BTN, _DLG, _SCROLLBAR, _STATIC
- //
- // WM_CTLCOLORMSGBOX
- // WM_CTLCOLOREDIT
- // WM_CTLCOLORLISTBOX
- // WM_CTLCOLORBTN
- // WM_CTLCOLORDLG
- // WM_CTLCOLORSCROLLBAR
- // WM_CTLCOLORSTATIC
- // #define WM_CTLCOLOR 0x0019
- // #define GET_WM_CTLCOLOR_HDC (wp, lp, msg) (HDC)(wp)
- // #define GET_WM_CTLCOLOR_HWND(wp, lp, msg) (HWND)(lp)
- // #define GET_WM_CTLCOLOR_TYPE(wp, lp, msg) (WORD)(msg - WM_CTLCOLORMSGBOX)
- // #define GET_WM_CTLCOLOR_MSG (type) (WORD)(WM_CTLCOLORMSGBOX+(type))
- //-------------------------------------------------------------------------------
- #if( !BACKGROUND_BITMAP )
- case WM_CTLCOLOR:
- if ( HIWORD( l_param ) == CTLCOLOR_STATIC ) {
-
- SetTextColor(( HDC )w_param, GetSysColor( COLOR_WINDOWTEXT ));
- SetBkColor( (HDC)wParam, GetSysColor( COLOR_WINDOW ));
-// SetBkColor(( HDC )w_param, RGB( 192, 192, 192 ));
-
- UnrealizeObject( hStaticBrush ); // reset the origin of the brush next time used.
- point.x = point.y = 0; // create a point.
- ClientToScreen( window_handle, &point ); // translate into screen coordinates.
- SetBrushOrgEx( (HDC)w_param, point.x, point.y, NULL ); // New Origin to use when next selected.
- return((LRESULT) hStaticBrush );
- }
- #endif
-
- //===============================================================================
- // Check where Left Mouse button was pressed.
- //===============================================================================
- #if(BACKGROUND_BITMAP)
- case WM_LBUTTONDOWN:
- {
- RECT rect;
-
- //----------------------------------------------------------------------
- // Get mouse coordinates.
- //----------------------------------------------------------------------
- mouse_x = LOWORD( l_param );
- mouse_y = HIWORD( l_param );
-
- //----------------------------------------------------------------------
- // For each button in the list...
- //----------------------------------------------------------------------
- for ( i = 0; i < NUM_BUTTONS; i++ ) {
-
- //-------------------------------------------------------------------
- // If mouse was clicked in one of the "buttons", then change
- // that button's state to "pressed".
- //-------------------------------------------------------------------
- if ( ButtonList[i] && ButtonList[i]->Is_Mouse_In_Region( mouse_x, mouse_y )) {
-
- if ( ButtonList[i]->Get_State() != DrawButton::PRESSED_STATE ) {
-
- ButtonList[i]->Return_Area ( &rect );
- ButtonList[i]->Set_State( DrawButton::PRESSED_STATE );
- InvalidateRect( window_handle, &rect, FALSE );
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("WM_LBUTTONDOWN -- %s. rect = [%d,%d,%d,%d]."),
- ButtonList[i]->Return_Normal_Bitmap(), rect.left, rect.top, rect.right, rect.bottom );
-
- UpdateWindow( window_handle );
- }
- break;
- }
- }
- }
- break;
- #endif
-
- //===============================================================================
- // Check where Left Mouse button was released.
- //===============================================================================
- #if(BACKGROUND_BITMAP)
- case WM_LBUTTONUP:
- {
- RECT rect;
- int focus_index = 0;
- int found_focus = -1;
-
- //-----------------------------------------------------------------------
- // Get mouse coordinates.
- //-----------------------------------------------------------------------
- mouse_x = LOWORD( l_param );
- mouse_y = HIWORD( l_param );
-
- //=======================================================================
- // focus_index = previous PRESSED/FOCUSED button.
- // found_focus = new PRESSED/FOCUSED button ( if different ).
- //=======================================================================
-
- //-----------------------------------------------------------------------
- // First find the button that is either focused or pressed.
- //-----------------------------------------------------------------------
- for ( i = 0; i < NUM_BUTTONS; i++ ) {
- if ( ButtonList[i] ) {
-
- //---------------------------------------------------------------
- // Save index of button with focus.
- //---------------------------------------------------------------
- if( ButtonList[i]->Get_State() == DrawButton::FOCUS_STATE ||
- ButtonList[i]->Get_State() == DrawButton::PRESSED_STATE ) {
- focus_index = i;
- }
- }
- }
-
- //-----------------------------------------------------------------------
- // Then find the button that is to be focused or pressed.
- //-----------------------------------------------------------------------
- for ( i = 0; i < NUM_BUTTONS; i++ ) {
- if ( ButtonList[i] && ButtonList[i]->Is_Mouse_In_Region( mouse_x, mouse_y )) {
- found_focus = i;
- }
- }
-
- //-----------------------------------------------------------------------
- // If new button is not found...
- //-----------------------------------------------------------------------
- if ( found_focus == -1 ) {
-
- //-------------------------------------------------------------------
- // Make sure previously focused/pressed button is now is a
- // focused state and no action is taken. This occurs when
- // mouse is clicked outside of any button areas.
- //-------------------------------------------------------------------
- if ( ButtonList[focus_index] && ( ButtonList[focus_index]->Get_State() != DrawButton::FOCUS_STATE )) {
-
- ButtonList[focus_index]->Set_State( DrawButton::FOCUS_STATE );
- ButtonList[focus_index]->Return_Area ( &rect );
- InvalidateRect( window_handle, &rect, FALSE );
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("WM_LBUTTONUP -- %s[FOCUS_STATE] = [x=%d, y=%d, w=%d, h=%d]."),
- ButtonList[ focus_index ]->Return_Normal_Bitmap(), rect.left, rect.top, rect.right, rect.bottom );
-
- UpdateWindow( window_handle );
- }
-
- } else {
-
- //-------------------------------------------------------------------
- // Buttons are one and the same.
- //-------------------------------------------------------------------
- if( focus_index == found_focus ) {
-
- ButtonList[ found_focus ]->Set_State( DrawButton::FOCUS_STATE );
- ButtonList[ found_focus ]->Return_Area ( &rect );
- InvalidateRect( window_handle, &rect, FALSE );
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("WM_LBUTTONUP -- %s[FOCUS_STATE] = [x=%d, y=%d, w=%d, h=%d]."),
- ButtonList[ found_focus ]->Return_Normal_Bitmap(), rect.left, rect.top, rect.right, rect.bottom );
-
- UpdateWindow( window_handle );
-
- } else {
-
- //---------------------------------------------------------------
- // Make previously focused button, Normal...
- //---------------------------------------------------------------
- if ( ButtonList[ focus_index ] ) {
-
- ButtonList[ focus_index ]->Set_State( DrawButton::NORMAL_STATE );
- ButtonList[ focus_index ]->Return_Area ( &rect );
- InvalidateRect( window_handle, &rect, FALSE );
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("WM_LBUTTONUP -- %s[NORMAL_STATE] = [x=%d, y=%d, w=%d, h=%d]."),
- ButtonList[ focus_index ]->Return_Normal_Bitmap(),
- rect.left, rect.top, rect.right, rect.bottom );
-
- UpdateWindow( window_handle );
- }
-
- //---------------------------------------------------------------
- // ...and the new button now has focus.
- //---------------------------------------------------------------
- if ( ButtonList[ found_focus ] ) {
-
- ButtonList[ found_focus ]->Set_State( DrawButton::FOCUS_STATE );
- ButtonList[ found_focus ]->Return_Area ( &rect );
- InvalidateRect( window_handle, &rect, FALSE );
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("WM_LBUTTONUP -- %s[FOCUS_STATE] = [x=%d, y=%d, w=%d, h=%d]."),
- ButtonList[ found_focus ]->Return_Normal_Bitmap(), rect.left, rect.top, rect.right, rect.bottom );
-
- UpdateWindow( window_handle );
- }
- }
- }
-
- //-----------------------------------------------------------------------
- // Repaint the Window now.
- //-----------------------------------------------------------------------
- nResult = UpdateWindow( window_handle );
-
- //-----------------------------------------------------------------------
- // Do the focus button's action.
- //-----------------------------------------------------------------------
- if ( found_focus >= 0 ) {
- if (( ButtonList[found_focus] ) &&
- ( ButtonList[found_focus]->Get_State() == DrawButton::FOCUS_STATE ) &&
- ( ButtonList[found_focus]->Is_Mouse_In_Region( mouse_x, mouse_y ))) {
- SendMessage( window_handle, WM_COMMAND, ButtonList[found_focus]->Return_Id(), 0L );
- break;
- }
- }
- }
- break;
- #endif
-
- //-------------------------------------------------------------------------------
- // Check Mouse moves over buttons.
- //-------------------------------------------------------------------------------
-//#if(DISABLE_KEYBOARD)
- #if(BACKGROUND_BITMAP)
- case WM_MOUSEMOVE:
- {
- RECT rect;
- int j;
- int done = 0;
-
- //-----------------------------------------------------------------------
- // Get mouse coordinates.
- //-----------------------------------------------------------------------
- mouse_x = LOWORD( l_param );
- mouse_y = HIWORD( l_param );
-
- #if(USE_MOUSE_MOVES)
- //-----------------------------------------------------------------------
- // Reset most current button.
- //-----------------------------------------------------------------------
- CurrentButton = 0;
- #endif
-
- //-----------------------------------------------------------------------
- // For each button in the list...
- //-----------------------------------------------------------------------
- i = 0;
- while( i < NUM_BUTTONS && !done ) {
-
- //-------------------------------------------------------------------
- // For each button, check if mouse is in it's area.
- //-------------------------------------------------------------------
- if ( ButtonList[i] && ButtonList[i]->Is_Mouse_In_Region( mouse_x, mouse_y )) {
-
- //---------------------------------------------------------------
- // This is now the current button.
- //---------------------------------------------------------------
- CurrentButton = ButtonList[i]->Return_Id();
-
- if( CurrentButton != LastButton ) {
-
- //-----------------------------------------------------------
- // Make all other buttons, NORMAL.
- //-----------------------------------------------------------
- for ( j = 0; j < NUM_BUTTONS; j++ ) {
- if ( ButtonList[j] ) {
- ButtonList[j]->Set_State( DrawButton::NORMAL_STATE );
-// Msg( __LINE__, TEXT(__FILE__), TEXT("WM_MOUSEMOVE -- %s[NORMAL_STATE]]."), ButtonList[j]->Return_Normal_Bitmap());
- }
- }
-
- if ( w_param & MK_LBUTTON ) {
-
- //--------------------------------------------------------
- // Left Mouse button is pressed! Make it a pressed button!
- //--------------------------------------------------------
- if ( ButtonList[i] && ButtonList[i]->Get_State() != DrawButton::PRESSED_STATE ) {
- ButtonList[i]->Set_State( DrawButton::PRESSED_STATE );
-// Msg( __LINE__, TEXT(__FILE__), TEXT("WM_MOUSEMOVE -- %s[PRESSED_STATE]."), ButtonList[i]->Return_Normal_Bitmap());
- }
-
- } else {
-
- //--------------------------------------------------------
- // If this button is not already focused, give it the focus.
- //--------------------------------------------------------
- if ( ButtonList[i] && ButtonList[i]->Get_State() != DrawButton::FOCUS_STATE ) {
- ButtonList[i]->Set_State( DrawButton::FOCUS_STATE );
-// Msg( __LINE__, TEXT(__FILE__), TEXT("WM_MOUSEMOVE -- %s[FOCUS_STATE]."), ButtonList[i]->Return_Normal_Bitmap());
- }
- } // end of if
-
- //-----------------------------------------------------------
- // Get the area of the button, and post it for updating.
- //-----------------------------------------------------------
- for ( j = 0; j < NUM_BUTTONS; j++ ) {
- if ( ButtonList[j] ) {
- ButtonList[j]->Return_Area ( &rect );
- InvalidateRect( window_handle, &rect, FALSE );
- }
- }
-
- //-----------------------------------------------------------
- // Repaint now!
- //-----------------------------------------------------------
- UpdateWindow( window_handle );
-
- done = 1;
- }
-
- } // end of if
- i++;
-
- } // end of for
-
-
- #if( USE_MOUSE_MOVES )
- //-----------------------------------------------------------------------
- // If a MouseMove was found to be in one of the buttons, then
- // CurrentButton will have a value.
- //-----------------------------------------------------------------------
- if ( CurrentButton != 0 ) {
-
- LastButton = CurrentButton;
-
- //-------------------------------------------------------------------
- // If we are still in the same button, don't make a sound!
- //-------------------------------------------------------------------
- if ( LastButton != PrevButton ) {
- PrevButton = LastButton;
- PlaySound( szButtonWav, Main::hModule, SND_ASYNC | SND_RESOURCE );
- }
- }
- #endif
- }
- break;
-
- #endif // Background_Bitmap flag
-//#endif
-
- //-------------------------------------------------------------------------------
- // Repaint when focus is restored (does partial repaint), and when
- // mouse is double clicked on dialog ( full repaint ).
- //-------------------------------------------------------------------------------
- case WM_LBUTTONDBLCLK:
- case WM_SETFOCUS:
- InvalidateRect( window_handle, &dlg_rect, TRUE );
-// nResult = UpdateWindow( window_handle );
-// Msg( __LINE__, TEXT(__FILE__), TEXT("WM_LBUTTONDBLCLK -- dlg_rect = [x=%d, y=%d, w=%d, h=%d]."),
-// dlg_rect.left, dlg_rect.top, dlg_rect.right, dlg_rect.bottom );
- break;
-
- #if(BACKGROUND_BITMAP)
- //-------------------------------------------------------------------------------
- // bit 30 of lParam - Specifies the previous key state.
- // The value is 1 if the key is down before the message is sent,
- // or it is 0 if the key is up.
- //-------------------------------------------------------------------------------
- case WM_KEYUP:
- {
-// int j = 0;
-
- switch( w_param ) {
-
- case VK_ESCAPE:
- SendMessage( window_handle, WM_SYSCOMMAND, SC_CLOSE, 0L );
- break;
-
-//#if(DISABLE_KEYBOARD)
- case VK_RETURN:
- //---------------------------------------------------------------
- // If the Return/Enter key is pressed... find the focused
- // button and call its action.
- //---------------------------------------------------------------
-// result = ( l_param & 0x40000000 );
- for ( i = 0; i < NUM_BUTTONS; i++ ) {
- if ( ButtonList[i] && ButtonList[i]->Get_State() == DrawButton::FOCUS_STATE ) {
- SendMessage( window_handle, WM_COMMAND, ButtonList[i]->Return_Id(), 0L );
- break;
- }
- }
- break;
-//#endif
-
-//#if(DISABLE_KEYBOARD)
- case VK_TAB:
- case VK_DOWN:
- {
- //-----------------------------------------------------------
- // Find the button with focus and "tab" to the next button by finding
- // the next valid index. If past last button, circle back to the top.
- //-----------------------------------------------------------
- int focused_button = 0;
- int next_button = 0;
-
- for ( i = 0; i < NUM_BUTTONS; i++ ) {
- if ( ButtonList[i] && ButtonList[i]->Get_State() == DrawButton::FOCUS_STATE ) {
-
- focused_button = i;
- next_button = i+1;
-
- if ( next_button >= NUM_BUTTONS ) {
- next_button = 0;
- }
- while (( next_button < NUM_BUTTONS ) && !ButtonList[ next_button ] ) {
- next_button++;
- }
-
- if ( next_button >= NUM_BUTTONS ) {
- next_button = 0;
- while (( next_button < NUM_BUTTONS ) && !ButtonList[ next_button ] ) {
- next_button++;
- }
- }
- break;
- }
- }
-
- //-----------------------------------------------------------
- // Set the previous button to Normal status.
- //-----------------------------------------------------------
- if ( ButtonList[focused_button] && ( ButtonList[focused_button]->Get_State() != DrawButton::NORMAL_STATE )) {
-
- ButtonList[focused_button]->Set_State( DrawButton::NORMAL_STATE );
- ButtonList[focused_button]->Return_Area ( &rect );
- InvalidateRect( window_handle, &rect, FALSE );
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("VK_DOWN/VK_TAB -- %s = [%s]."), ButtonList[focused_button]->Return_Normal_Bitmap(), "NORMAL_STATE" );
- }
-
- //-----------------------------------------------------------
- // Set the new button to focus status.
- //-----------------------------------------------------------
- if ( ButtonList[next_button] && ( ButtonList[next_button]->Get_State() != DrawButton::FOCUS_STATE )) {
-
- ButtonList[next_button]->Set_State( DrawButton::FOCUS_STATE );
- ButtonList[next_button]->Return_Area ( &rect );
- InvalidateRect( window_handle, &rect, FALSE );
- PlaySound( szButtonWav, Main::hModule, SND_ASYNC | SND_RESOURCE );
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("VK_DOWN/VK_TAB -- %s = [%s]."), ButtonList[next_button]->Return_Normal_Bitmap(), "FOCUS_STATE" );
- }
- }
- break;
-
- case VK_UP:
- {
- //-----------------------------------------------------------
- // Find the button with focus and "tab" to the next button by finding
- // the next valid index. If past last button, circle back to the top.
- //-----------------------------------------------------------
- int focused_button = 0;
- int next_button = 0;
-
- for ( i = 0; i < NUM_BUTTONS; i++ ) {
- if ( ButtonList[i] && ButtonList[i]->Get_State() == DrawButton::FOCUS_STATE ) {
-
- focused_button = i;
- next_button = i-1;
-
- if ( next_button < 0 ) {
- next_button = NUM_BUTTONS - 1;
- }
- while (( next_button > 0 ) && !ButtonList[ next_button ] ) {
- next_button--;
- }
-
- if ( !ButtonList[ next_button ]) {
- next_button = NUM_BUTTONS - 1;
- }
- while (( next_button >= 0 ) && !ButtonList[ next_button ] ) {
- next_button--;
- }
- break;
- }
- }
-
- //-----------------------------------------------------------
- // Set the previous button to Normal status.
- //-----------------------------------------------------------
- if ( ButtonList[focused_button] && ( ButtonList[focused_button]->Get_State() != DrawButton::NORMAL_STATE )) {
-
- ButtonList[focused_button]->Set_State( DrawButton::NORMAL_STATE );
- ButtonList[focused_button]->Return_Area ( &rect );
- InvalidateRect( window_handle, &rect, FALSE );
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("VK_DOWN/VK_TAB -- %s = [%s]."), ButtonList[focused_button]->Return_Normal_Bitmap(), "NORMAL_STATE" );
- }
-
- //-----------------------------------------------------------
- // Set the new button to focus status.
- //-----------------------------------------------------------
- if ( ButtonList[next_button] && ( ButtonList[next_button]->Get_State() != DrawButton::FOCUS_STATE )) {
-
- ButtonList[next_button]->Set_State( DrawButton::FOCUS_STATE );
- ButtonList[next_button]->Return_Area ( &rect );
- InvalidateRect( window_handle, &rect, FALSE );
- PlaySound( szButtonWav, Main::hModule, SND_ASYNC | SND_RESOURCE );
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("VK_DOWN/VK_TAB -- %s = [%s]."), ButtonList[next_button]->Return_Normal_Bitmap(), "FOCUS_STATE" );
- }
- }
- break;
-//#endif
-
- } /* end of switch */
- } /* end of case stmt */
-
- return ( 0 );
-
- #endif
- }
- return( FALSE );
-}
-
-//*****************************************************************************
-// STOP_SOUND_PLAYING -- Stop the background sound.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: Will stop any sound started by PlaySound.
-//
-// HISTORY:
-// 06/04/1999 MML : Created.
-//=============================================================================
-
-void Stop_Sound_Playing ( void )
-{
- PlaySound( NULL, NULL, SND_ASYNC | SND_FILENAME );
-}
-
-//*****************************************************************************
-// OPTIONS -- Find any user options and set the correct flags
-//
-// INPUT: int argc = no. of arguments to check
-// BYTE *argv[] = ptr to actual command line parameters
-//
-// OUTPUT:
-//
-// WARNINGS:
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-BOOL Options( Command_Line_Arguments *Orgs )
-{
- int i;
- BOOL result = TRUE;
- char buffer[ MAX_ARGUMENT_LENGTH ];
-
- //-------------------------------------------------------------------------
- // Scan arguments for any options ( / or - followed by a letter)
- //-------------------------------------------------------------------------
- for ( i = 0; i < Orgs->Get_argc(); i++ ) {
-
- //---------------------------------------------------------------------
- // Get the next item in the list.
- //---------------------------------------------------------------------
- memset( buffer, '\0', sizeof( buffer ));
- strcpy( buffer, Orgs->Get_argv(i));
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("Options -- Argument[%d] = %s."), i, buffer );
-
- //---------------------------------------------------------------------
- // If starts with / or -
- //---------------------------------------------------------------------
- if (( buffer[0] == '/' ) || ( buffer[0] == '-' )) {
-
- switch ( tolower( buffer[1] )) {
-
- //-------------------------------------------------------------
- // Retrieve the game's version info.
- //-------------------------------------------------------------
- case 'v':
- {
- char szPath [ MAX_PATH ];
- char szVersion[ MAX_PATH ];
-
- Make_Current_Path_To( SETUP_INI_FILE1, szPath );
- GetPrivateProfileString( "Setup", "Version", "1.0", szVersion, sizeof( szVersion ), szPath );
-
- LoadString( Main::hInstance, IDS_VERSION_STRING, szBuffer, MAX_PATH );
-
-// sprintf( szBuffer3, "V %s", szVersion );
- sprintf( szBuffer3, szBuffer, szVersion );
-// strcpy( szBuffer, szRegistryKey );
-
- MessageBox( NULL, szBuffer3, "Autorun", MB_TASKMODAL | MB_OK );
- result = FALSE;
- }
- break;
-
- //-------------------------------------------------------------
- // Bypass the volume check.
- //-------------------------------------------------------------
- case 'n':
- {
- HANDLE handle;
- WIN32_FIND_DATA FindFileData;
-
- memset( szVolumeName, '\0', MAX_PATH );
-
- //-----------------------------------------------------
- // If we think we are on CD2, then use PRODUCT_VOLUME_CD2.
- //-----------------------------------------------------
- Make_Current_Path_To( MOH_DEMO_PROGRAM, szBuffer );
- handle = FindFirstFile( szBuffer, &FindFileData );
- if ( handle == INVALID_HANDLE_VALUE ) {
- strcpy( szVolumeName, PRODUCT_VOLUME_CD1 );
- } else {
- strcpy( szVolumeName, PRODUCT_VOLUME_CD2 );
- FindClose( handle );
- }
-
- strcpy( Arguments[ NumberArguments++ ], buffer );
- }
- break;
-
- #if( _DEBUG )
-
- case 'c':
- if( buffer[2] == 'd' ) {
- szCDDrive[0] = buffer[3];
- szCDDrive[1] = ':';
- szCDDrive[2] = '\\';
- }
- break;
-
- //-------------------------------------------------------------
- // Change languages?
- //-------------------------------------------------------------
- case 'l':
- {
- //-----------------------------------------------------
- // Identifier Meaning
- // 932 Japan
- // 936 Chinese (PRC, Singapore)
- // 949 Korean
- // 1252 Windows 3.1 Latin 1 (US, Western Europe)
- //-----------------------------------------------------
- char *temp = buffer+2;
- int number = atoi( temp );
-
- switch( number ) {
-
- case LANG_GER:
- LanguageToUse = LANG_GER;
- CodePage = 1252;
- break;
-
- case LANG_FRE:
- LanguageToUse = LANG_FRE;
- CodePage = 1252;
- break;
-
- case LANG_JAP:
- LanguageToUse = LANG_JAP;
- CodePage = 932;
- break;
-
- case LANG_KOR:
- LanguageToUse = LANG_KOR;
- CodePage = 949;
- break;
-
- case LANG_CHI:
- LanguageToUse = LANG_CHI;
- CodePage = 950;
- break;
-
- case LANG_USA:
- default:
- LanguageToUse = LANG_USA;
- CodePage = 1252;
- break;
- }
- }
- break;
-
-
- #endif
-
- default:
- strcpy( Arguments[ NumberArguments++ ], buffer );
- break;
- }
- }
- }
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("Options -- Language = %d"), Language );
- Msg( __LINE__, TEXT(__FILE__), TEXT("Options -- CodePage = %d"), CodePage );
-
-#if(0)
- struct lconv *info = localeconv();
- char szDefaultLangID[ MAX_PATH ];
-
- GetLocaleInfo(
- LOCALE_USER_DEFAULT, // locale identifier
- LOCALE_ILANGUAGE, // type of information
- szBuffer1, // address of buffer for information
- MAX_PATH ); // size of buffer
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("Options -- GetLocalInfo = %s"), szBuffer1 );
-
- sprintf( szDefaultLangID, "%04X", GetUserDefaultLangID());
- Msg( __LINE__, __FILE__, "Options -- GetUserDefaultLangID() = %s", szDefaultLangID );
-
- sprintf( szDefaultLangID, "%04X", GetSystemDefaultLangID());
- Msg( __LINE__, __FILE__, "Options -- GetSystemDefaultLangID() = %s", szDefaultLangID );
- Msg( __LINE__, __FILE__, "-------------------------------------------------------------" );
-#endif
-
- return( result );
-}
-
-//*****************************************************************************
-// Valid_Environment -- Make sure this program is run from CD-ROM disc only
-// AND it is a Win95 system.
-//
-// INPUT: none.
-//
-// OUTPUT: none.
-//
-// WARNINGS: returns 0 if ok to continue.
-//
-// HISTORY:
-// 06/04/1996 MML : Created.
-//=============================================================================
-
-BOOL Valid_Environment ( void )
-{
- bool result = 0;
-
- //--------------------------------------------------------------------------
- // Check Windows Version.
- //--------------------------------------------------------------------------
-
- int length = 0;
- result = WinVersion.Meets_Minimum_Version_Requirements();
- if ( !result )
- {
- std::wstring wideBuffer = TheGameText->fetch("GUI:WindowsVersionText");
- std::wstring wideBuffer2 = TheGameText->fetch("GUI:WindowsVersionTitle");
- length = wideBuffer.length();
- WideCharToMultiByte( CodePage, 0, wideBuffer.c_str(), length+1, szBuffer, _MAX_PATH, NULL, NULL );
- length = wideBuffer2.length();
- WideCharToMultiByte( CodePage, 0, wideBuffer2.c_str(), length+1, szBuffer2, _MAX_PATH, NULL, NULL );
- MessageBox( NULL, szBuffer, szBuffer2, MB_APPLMODAL | MB_OK );
- }
-
- return( result );
-}
-
-//****************************************************************************
-// LOADRESOURCEBITMAP -- Find & Load the bitmap from the resource.
-//
-// INPUT: HINSTANCE hInstance -- Program's hInstance.
-// LPTSTR lpString -- name of bitmap to find.
-// HPALETTE FAR *lphPalette -- we will return palette in this.
-//
-// OUTPUT: HBITMAP -- handle to the bitmap if found.
-//
-// WARNINGS:
-//
-// HISTORY: Found this routine on MS Developmemt CD, July 1996.
-// 09/26/1996 MML : Created.
-//=============================================================================
-
-HBITMAP LoadResourceBitmap( HINSTANCE hInstance, LPCTSTR lpString, HPALETTE FAR *lphPalette, bool loading_a_button )
-{
-// HDC hdc;
- int iNumColors;
- HRSRC hRsrc;
- HGLOBAL hGlobal;
- HBITMAP hBitmapFinal = NULL;
- LPBITMAPINFOHEADER lpbi;
-
- hBitmapFinal = LoadBitmap( hInstance, lpString );
-
- //--------------------------------------------------------------------------
- // Find the Bitmap in this program's resources.
- //--------------------------------------------------------------------------
- hRsrc = FindResource( hInstance, lpString, RT_BITMAP );
- if ( hRsrc ) {
-
- //-----------------------------------------------------------------------
- // Load the resource, lock the memory, grab a DC.
- //-----------------------------------------------------------------------
- hGlobal = LoadResource( hInstance, hRsrc );
- lpbi = (LPBITMAPINFOHEADER) LockResource( hGlobal );
-
- if ( loading_a_button ) {
-
- //--------------------------------------------------------------------------
- // Set number of colors ( 2 to the nth ).
- //--------------------------------------------------------------------------
- if ( lpbi->biBitCount <= 8 ) {
- iNumColors = ( 1 << lpbi->biBitCount );
- } else {
- iNumColors = 0;
- }
-
- } else {
-
- //--------------------------------------------------------------------
- // Get the palette from the resource.
- //--------------------------------------------------------------------
- *lphPalette = CreateDIBPalette((LPBITMAPINFO) lpbi, &iNumColors );
- }
-
- //-----------------------------------------------------------------------
- // Free DS and memory used.
- //-----------------------------------------------------------------------
- UnlockResource( hGlobal );
- FreeResource( hGlobal );
- }
-
- return( hBitmapFinal );
-}
-
-//*****************************************************************************
-// CREATEDIBPALETTE -- Creates the palette from the Bitmap found above.
-//
-// INPUT: LPBITMAPINFO lpbmi -- bitmap info from header.
-// LPINT lpiNumColors -- number of colors.
-//
-// OUTPUT: HPALETTE -- handle to the bitmap if found.
-//
-// WARNINGS:
-//
-// HISTORY: Found this routine on MS Developmemt CD, July 1996.
-// 09/26/1996 MML : Created.
-//=============================================================================
-HPALETTE CreateDIBPalette ( LPBITMAPINFO lpbmi, LPINT lpiNumColors )
-{
- LPBITMAPINFOHEADER lpbi;
- LPLOGPALETTE lpPal;
- HANDLE hLogPal;
- HPALETTE hPal = NULL;
- int i;
-
- lpbi = (LPBITMAPINFOHEADER) lpbmi;
-
- //--------------------------------------------------------------------------
- // Set number of colors ( 2 to the nth ).
- //--------------------------------------------------------------------------
- if ( lpbi->biBitCount <= 8 ) {
- *lpiNumColors = ( 1 << lpbi->biBitCount );
- } else {
- *lpiNumColors = 0;
- }
-
- //--------------------------------------------------------------------------
- // If bitmap has a palette ( bitcount ), lock some memory and create
- // a palette from the bitmapinfoheader passed in.
- //--------------------------------------------------------------------------
- if ( *lpiNumColors ) {
-
- hLogPal = GlobalAlloc( GHND, sizeof( LOGPALETTE ) + sizeof( PALETTEENTRY ) * ( *lpiNumColors ));
- lpPal = (LPLOGPALETTE) GlobalLock( hLogPal );
- lpPal->palVersion = 0x300;
- lpPal->palNumEntries = (WORD)*lpiNumColors;
-
- for ( i = 0; i < *lpiNumColors; i++ ) {
- lpPal->palPalEntry[i].peRed = lpbmi->bmiColors[i].rgbRed;
- lpPal->palPalEntry[i].peGreen = lpbmi->bmiColors[i].rgbGreen;
- lpPal->palPalEntry[i].peBlue = lpbmi->bmiColors[i].rgbBlue;
- lpPal->palPalEntry[i].peFlags = 0;
- }
- hPal = CreatePalette( lpPal );
- GlobalUnlock( hLogPal );
- GlobalFree( hLogPal );
-
-#if(0)
- StandardFileClass fileout;
- char buff[2];
-
- fileout.Open( "test.pal", MODE_WRITE_TRUNCATE );
- for ( i = 0; i < *lpiNumColors; i++ ) {
- sprintf( buff, "%d", lpPal->palPalEntry[i].peRed >> 2 );
- fileout.Write(( void *)buff, 2 );
- sprintf( buff, "%d", lpPal->palPalEntry[i].peGreen >> 2 );
- fileout.Write(( void *)buff, 2 );
- sprintf( buff, "%d", lpPal->palPalEntry[i].peBlue >> 2 );
- fileout.Write(( void *)buff, 2 );
- }
- fileout.Close();
-#endif
-
- }
- return( hPal );
-}
-
-//*****************************************************************************
-// LOADRESOURCEBUTTON -- Find & Load the bitmap from the resource.
-//
-// INPUT: HINSTANCE hInstance -- Program's hInstance.
-// LPTSTR lpString -- name of bitmap to find.
-// HPALETTE FAR *lphPalette -- we will return palette in this.
-//
-// OUTPUT: HBITMAP -- handle to the bitmap if found.
-//
-// WARNINGS:
-//
-// HISTORY: Found this routine on MS Developmemt CD, July 1996.
-// 09/26/1996 MML : Created.
-//=============================================================================
-HBITMAP LoadResourceButton( HINSTANCE hInstance, LPCTSTR lpString, HPALETTE FAR lphPalette )
-{
- HDC hdc;
- int iNumColors;
- HRSRC hRsrc;
- HGLOBAL hGlobal;
- HBITMAP hBitmapFinal = NULL;
- LPBITMAPINFOHEADER lpbi;
-
- //--------------------------------------------------------------------------
- // Find the Bitmap in this program's resources.
- //--------------------------------------------------------------------------
- hRsrc = FindResource( hInstance, lpString, RT_BITMAP );
- if ( hRsrc ) {
-
- //-----------------------------------------------------------------------
- // Load the resource, lock the memory, grab a DC.
- //-----------------------------------------------------------------------
- hGlobal = LoadResource( hInstance, hRsrc );
- lpbi = (LPBITMAPINFOHEADER) LockResource( hGlobal );
- hdc = GetDC( NULL );
-
- //--------------------------------------------------------------------------
- // Set number of colors ( 2 to the nth ).
- //--------------------------------------------------------------------------
- if ( lpbi->biBitCount <= 8 ) {
- iNumColors = ( 1 << lpbi->biBitCount );
- } else {
- iNumColors = 0;
- }
-
- //-----------------------------------------------------------------------
- // Get the palette from the resource.
- // Select to the DC and realize it in the System palette.
- //-----------------------------------------------------------------------
-// *lphPalette = CreateDIBPalette((LPBITMAPINFO) lpbi, &iNumColors );
- if ( lphPalette != NULL ) {
- SelectPalette( hdc, lphPalette, FALSE );
- RealizePalette( hdc );
- }
-
- //-----------------------------------------------------------------------
- // Now create the bitmap itself.
- //-----------------------------------------------------------------------
- hBitmapFinal = CreateDIBitmap(
- hdc,
- (LPBITMAPINFOHEADER)lpbi,
- (LONG)CBM_INIT,
- (LPTSTR)lpbi + lpbi->biSize + iNumColors * sizeof( RGBQUAD ),
- (LPBITMAPINFO)lpbi,
- DIB_RGB_COLORS );
-
- //-----------------------------------------------------------------------
- // Free DS and memory used.
- //-----------------------------------------------------------------------
- ReleaseDC( NULL, hdc );
- UnlockResource( hGlobal );
- FreeResource( hGlobal );
- }
- return( hBitmapFinal );
-}
-
-//*****************************************************************************
-// Cant_Find_MessageBox -- Find & Load the bitmap from the resource.
-//
-// INPUT: HINSTANCE hInstance -- Program's hInstance.
-// LPTSTR lpString -- name of bitmap to find.
-// HPALETTE FAR *lphPalette -- we will return palette in this.
-//
-// OUTPUT: HBITMAP -- handle to the bitmap if found.
-//
-// WARNINGS:
-//
-// HISTORY: Found this routine on MS Developmemt CD, July 1996.
-// 09/26/1996 MML : Created.
-// 08/27/2003 JFS : Repaired!
-//=============================================================================
-
-void Cant_Find_MessageBox ( HINSTANCE hInstance, const char *szPath )
-{
-
- //
- // JFS... Added functionality to make this work in wide characters.
- //
-#ifdef LEAN_AND_MEAN
- {
- Locale_GetString( "Autorun:AutorunTitle", szWideBuffer );
- swprintf( szWideBuffer3, szWideBuffer, szProductName );
-
- Locale_GetString( "Autorun:CantFind", szWideBuffer );
- MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, szPath, _MAX_PATH, szWideBuffer0, _MAX_PATH );
- swprintf( szWideBuffer2, szWideBuffer, szWideBuffer0 );
-
- MessageBoxW( NULL, szWideBuffer2, szWideBuffer3, MB_APPLMODAL | MB_OK );
- }
-
-#else
-
- std::wstring wideBuffer = TheGameText->fetch("Autorun:AutorunTitle");
- std::wstring wideBuffer2.format( wideBuffer.str(), productName.str() );
- std::wstring wideBuffer3 = TheGameText->fetch("Autorun:CantFind");
-
- WideCharToMultiByte( CodePage, 0, wideBuffer3.str(), wideBuffer3.getLength()+1, szBuffer3, _MAX_PATH, NULL, NULL );
- WideCharToMultiByte( CodePage, 0, wideBuffer2.str(), wideBuffer2.getLength()+1, szBuffer2, _MAX_PATH, NULL, NULL );
-
-
- sprintf( szBuffer1, szBuffer3, szPath );
-
-
- if ( strlen( szPath ) < 3 )
- {
- MessageBox( NULL, "The path specified in Cant_Find_MessageBox was blank", "Autorun", MB_APPLMODAL | MB_OK );
- return;
- }
- if ( strlen( szBuffer1 ) < 3 && strlen( szBuffer3 ) < 3 )
- {
- MessageBox( NULL, "***MISSING MESSAGES***... IDS_AUTORUN_TITLE and IDS_CANT_FIND", "Autorun", MB_APPLMODAL | MB_OK );
- return;
- }
- if ( strlen( szBuffer1 ) < 3 )
- {
- MessageBox( NULL, "***MISSING MESSAGE***... IDS_AUTORUN_TITLE", "Autorun", MB_APPLMODAL | MB_OK );
- return;
- }
- if ( strlen( szBuffer3 ) < 3 )
- {
- MessageBox( NULL, "***MISSING MESSAGE***... IDS_CANT_FIND", "Autorun", MB_APPLMODAL | MB_OK );
- return;
- }
-
-
-
-
- MessageBox( NULL, szBuffer1, szBuffer2, MB_APPLMODAL | MB_OK );
-#endif
-
-}
-
-
-/******************************************************************************
- * Error_Message --
- *
- * INPUT:
- *
- * OUTPUT:
- *
- * WARNINGS: none
- *
- * HISTORY:
- * 08/14/1998 MML : Created.
- *============================================================================*/
-
-void Error_Message ( HINSTANCE hInstance, const char * title, const char * string, const char *path )
-{
-
-#ifndef LEAN_AND_MEAN
-
- wideBuffer2 = TheGameText->fetch(title);
- wideBuffer3 = TheGameText->fetch(string);
-
- if ( path && ( path[0] != '\0' ))
- {
- wideBuffer3.format( wideBuffer.str(), path );
- }
- else
- {
- wideBuffer3 = wideBuffer; // insert not provided
- }
-
- WideCharToMultiByte( CodePage, 0, wideBuffer2.str(), wideBuffer2.getLength()+1, szBuffer2, _MAX_PATH, NULL, NULL );
- WideCharToMultiByte( CodePage, 0, wideBuffer3.str(), wideBuffer3.getLength()+1, szBuffer3, _MAX_PATH, NULL, NULL );
-
- MessageBox( NULL, szBuffer3, szBuffer2, MB_APPLMODAL | MB_OK );
-
-#endif
-
- MessageBox( NULL, "ERROR_UNDEFINED", "ERROR_UNDEFINED", MB_APPLMODAL | MB_OK );
-
-
-}
-
-
-/******************************************************************************
-/ Launch Class Object
-/******************************************************************************/
-
-LaunchObjectClass::LaunchObjectClass ( char *path, char *args )
-{
- memset( szPath, '\0', _MAX_PATH );
- memset( szArgs, '\0', _MAX_PATH );
-
- if( path != NULL && path[0] != '\0' ) {
- strcpy( szPath, path );
- }
- if( args != NULL && args[0] != '\0' ) {
- strcpy( szArgs, args );
- }
-}
-
-void LaunchObjectClass::SetPath ( char *path )
-{
- if( path != NULL && path[0] != '\0' ) {
- memset( szPath, '\0', _MAX_PATH );
- strcpy( szPath, path );
- }
-}
-
-void LaunchObjectClass::SetArgs ( char *args )
-{
- if( args != NULL && args[0] != '\0' ) {
- memset( szArgs, '\0', _MAX_PATH );
- strcpy( szArgs, args );
- }
-}
-
-unsigned int LaunchObjectClass::Launch ( void )
-{
- char filepath [_MAX_PATH];
- char dir [_MAX_DIR];
- char ext [_MAX_EXT];
- char drive [_MAX_DRIVE];
- char file [_MAX_FNAME];
- char lpszComLine [ 127 ];
-
- PROCESS_INFORMATION processinfo;
- STARTUPINFO startupinfo;
- unsigned int abc = 0;
- unsigned int result = 0;
-
- memset( lpszComLine, '\0', 127 );
-
- //--------------------------------------------------------------------------
- // Split into parts.
- //--------------------------------------------------------------------------
- _splitpath( szPath, drive, dir, file, ext );
-
- //--------------------------------------------------------------------------
- // Change current path to the correct dir.
- //
- // The _chdrive function changes the current working drive to the drive
- // specified by drive. The drive parameter uses an integer to specify the
- // new working drive (1=A, 2=B, and so forth). This function changes only
- // the working drive; _chdir changes the working directory.
- //--------------------------------------------------------------------------
- _makepath( filepath, drive, dir, NULL, NULL );
- Path_Remove_Back_Slash( filepath );
-
- abc = (unsigned)( toupper( filepath[0] ) - 'A' + 1 );
- if ( !_chdrive( abc )) {
-
- //----------------------------------------------------------------------
- // Returns a value of 0 if successful.
- //----------------------------------------------------------------------
- abc = _chdir( filepath );
- }
-
-#if (_DEBUG)
-
- int cde = _getdrive();
- _getcwd( szBuffer, _MAX_PATH );
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("Current Working Dir = %d\\%s." ), cde, szBuffer );
-#endif
-
- //--------------------------------------------------------------------------
- // Try to launch the EXE...
- //--------------------------------------------------------------------------
- _stprintf( lpszComLine, _TEXT( "%s %s" ), szPath, szArgs );
-
- //==========================================================================
- // Setup the call
- //==========================================================================
- memset( &startupinfo, 0, sizeof( STARTUPINFO ));
- startupinfo.cb = sizeof( STARTUPINFO );
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("About to launch %s." ), lpszComLine );
-
- result = CreateProcess(
- szPath, // address of module name
- lpszComLine, // address of command line
- NULL, // address of process security attributes
- NULL, // address of thread security attributes
- FALSE, // new process inherits handles
- FALSE,
- NULL, // address of new environment block
- NULL, // address of current directory name
- &startupinfo, // address of STARTUPINFO
- &processinfo ); // address of PROCESS_INFORMATION
-
- //--------------------------------------------------------------------------
- // If WinExec returned 0, error occurred.
- //--------------------------------------------------------------------------
- if ( !result ) {
-
- Msg( __LINE__, TEXT(__FILE__), TEXT("Launch of %s failed." ), lpszComLine );
- _makepath ( filepath, NULL, NULL, file, ext );
- Cant_Find_MessageBox ( Main::hInstance, filepath );
- }
- Msg( __LINE__, TEXT(__FILE__), TEXT("Launch of %s succeeded." ), lpszComLine );
-
- return( result );
-}
-
-void Debug_Date_And_Time_Stamp ( void )
-{
- //-------------------------------------------------------------------------
- // tm_sec - Seconds after minute (0 - 59)
- // tm_min - Minutes after hour (0 - 59)
- // tm_hour - Hours after midnight (0 - 23)
- // tm_mday - Day of month (1 - 31)
- // tm_mon - Month (0 - 11; January = 0)
- // tm_year - Year (current year minus 1900)
- // tm_wday - Day of week (0 - 6; Sunday = 0)
- // tm_yday - Day of year (0 - 365; January 1 = 0)
- //-------------------------------------------------------------------------
- static const char *Month_Strings[ 12 ] = {
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December"
- };
-
- static const char *Week_Day_Strings[ 7 ] = {
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday",
- };
-
- char ampm[] = "AM";
- time_t ltime;
- struct tm * today;
-
- /*-------------------------------------------------------------------------
- *Convert to time structure and adjust for PM if necessary.
- */
- time( <ime );
- today = localtime( <ime );
- if( today->tm_hour > 12 ) {
- strcpy( ampm, "PM" );
- today->tm_hour -= 12;
- }
- if( today->tm_hour == 0 ) { /* Adjust if midnight hour. */
- today->tm_hour = 12;
- }
-
- Msg( __LINE__, __FILE__, "%s, %s %d, %d %d:%d:%d %s",
- Week_Day_Strings[ today->tm_wday ],
- Month_Strings[ today->tm_mon ],
- today->tm_mday,
- today->tm_year + 1900,
- today->tm_hour,
- today->tm_min,
- today->tm_sec,
- ampm );
-
- /*-------------------------------------------------------------------------
- * Note how pointer addition is used to skip the first 11
- * characters and printf is used to trim off terminating
- * characters.
- */
-// Msg( __LINE__, __FILE__, "%s %s\n", asctime( today ), ampm );
-}
-
-
-bool Is_On_CD ( const char *volume_name )
-{
- char volume_to_match[ MAX_PATH ];
-
- Reformat_Volume_Name( volume_name, volume_to_match );
-
- if( _stricmp( szVolumeName, volume_to_match ) == 0 ) {
- return true;
- } else {
- return false;
- }
-}
-
-bool Prompt_For_CD ( HWND window_handle, char *volume_name, const char * message1, const char * message2, int *cd_drive )
-{
- int drive;
-
- strcpy( szBuffer, Args->Get_argv( 0 ));
- drive = toupper( szBuffer[0] ) - 'A';
- memset( szBuffer, '\0', MAX_PATH );
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // This is the correct check for a CD Check.
- //
- // MML: Modified on 10/18/2000 so it would check for all available CD drives.
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- int result = IDRETRY;
-
- while( result == IDRETRY ) {
-
- if ( CD_Volume_Verification( drive, szBuffer, volume_name )) {
-
- result = IDOK;
- *cd_drive = drive;
-
- } else {
-
- CDList.Reset_Index();
-
- while(( result == IDRETRY ) && ( CDList.Get_Index() < CDList.Get_Number_Of_Drives())) {
-
- drive = CDList.Get_Next_CD_Drive();
-
- if ( CD_Volume_Verification( drive, szBuffer, volume_name )) {
- result = IDOK;
- *cd_drive = drive;
- }
- }
- }
-
- if ( result == IDRETRY ) {
- result = ( Show_Message( window_handle, message1, message2 ));
- }
- }
-
- if ( result == IDCANCEL ) {
- return( false );
-// return true;
- }
-
- return( true );
-}
-
-
-
-int Show_Message ( HWND window_handle, const char * message1, const char * message2 )
-{
-
-#ifndef LEAN_AND_MEAN
-
- UnicodeString string1;
- UnicodeString string2;
- WCHAR szString3[ MAX_PATH ];
- int result = false;
-
- string1 = TheGameText->fetch(message1);
- string2 = TheGameText->fetch(message2);
-
- wcscpy( szString3, string1.str() );
- wcscat( szString3, L" " );
- wcscat( szString3, string2.str() );
-
- WideCharToMultiByte( CodePage, 0, szString3, _MAX_PATH, szBuffer, _MAX_PATH, NULL, NULL );
- result = MessageBox( window_handle, szBuffer, "Autorun", MB_RETRYCANCEL|MB_APPLMODAL|MB_SETFOREGROUND );
-
- return( result );
-
-#else
-
- return ( 0 );
-
-#endif
-
-}
-
-
-void Reformat_Volume_Name ( const char *volume_name, char *new_volume_name )
-{
- char temp_volume_name[ MAX_PATH ];
-
- strcpy( temp_volume_name, volume_name );
-
- if( WinVersion.Is_Win95()) {
- temp_volume_name[11] = '\0';
- }
-
- if( new_volume_name != NULL ) {
- strcpy( new_volume_name, temp_volume_name );
- }
-}
-
-
diff --git a/Generals/Code/Tools/Autorun/autorun.h b/Generals/Code/Tools/Autorun/autorun.h
deleted file mode 100644
index 089bd18b9b9..00000000000
--- a/Generals/Code/Tools/Autorun/autorun.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/************************************************************************************************
-* C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S *
-*************************************************************************************************
-*
-* FILE
-* $Archive: /Renegade Setup/Autorun/autorun.h $
-*
-* DESCRIPTION
-*
-* PROGRAMMER
-* $Author: Maria_l $
-*
-* VERSION INFO
-* $Modtime: 1/28/02 11:11a $
-* $Revision: 10 $
-*
-*************************************************************************************************/
-
-
-#ifndef AUTORUN_H
-#define AUTORUN_H
-
-#include
-#include
-#include