Initial commit of Command & Conquer Generals and Command & Conquer Generals Zero Hour source code.

This commit is contained in:
LFeenanEA 2025-02-27 17:34:39 +00:00
parent 2e338c00cb
commit 3d0ee53a05
No known key found for this signature in database
GPG key ID: C6EBE8C2EA08F7E0
6072 changed files with 2283311 additions and 0 deletions

View file

@ -0,0 +1,352 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//======================================================================================
//
// @@@@@ @@ @ @@@@ @@@@ @@@@ @@ @ @@@@ @@@@ @@@@@ @@@@@ @@@@ @@ @
// @@ @ @@ @ @@ @ @@ @ @@ @ @@@ @ @@ @ @@ @ @@ @ @@ @ @@ @ @@ @
// @@@@@ @@ @ @@ @@ @@@@@@ @@ @ @ @@@@ @@@@ @@@@@ @@@@@ @@@@@@ @@
// @@ @ @@ @ @@ @ @@ @ @@ @ @@ @@ @@ @ @@ @ @@ @ @@ @ @@ @ @@
// @@@@@ @@@@ @@@@ @@@@ @@ @ @@ @ @@@@ @@@@ @@ @ @@@@@ @@ @ @@
//
// Copyright (c) 1998, 1999 Westwood Studios -- CONFIDENTIAL
//
// ArgC_ArgV.cpp
//
//======================================================================================
//-----------------------------------------------------------------------------
// INCLUDES
//-----------------------------------------------------------------------------
#define STRICT
#include <windows.h>
#include <windowsx.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#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 );
}
}

View file

@ -0,0 +1,70 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//================================================================================================
//
// @@@@@ @@ @ @@@@ @@@@ @@@@ @@ @ @@@@ @@@@ @@@@@ @@@@@ @@@@ @@ @
// @@ @ @@ @ @@ @ @@ @ @@ @ @@@ @ @@ @ @@ @ @@ @ @@ @ @@ @ @@ @
// @@@@@ @@ @ @@ @@ @@@@@@ @@ @ @ @@@@ @@@@ @@@@@ @@@@@ @@@@@@ @@
// @@ @ @@ @ @@ @ @@ @ @@ @ @@ @@ @@ @ @@ @ @@ @ @@ @ @@ @ @@
// @@@@@ @@@@ @@@@ @@@@ @@ @ @@ @ @@@@ @@@@ @@ @ @@@@@ @@ @ @@
//
// Copyright (c) 1998, 1999 Westwood Studios -- CONFIDENTIAL
//
// ArgC_ArgV.h
//
//================================================================================================
#ifndef ARGS_H
#define ARGS_H
//----------------------------------------------------------------------------
// INCLUDES
//----------------------------------------------------------------------------
#include <windows.h>
//#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

View file

@ -0,0 +1,300 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Japanese resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
#ifdef _WIN32
LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
#pragma code_page(932)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_VERSION_STRING "僶乕僕儑儞 %s"
IDS_CANT_FIND_FILE "%s 偑尒偮偐傝傑偣傫偱偟偨"
END
#endif // Japanese resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Korean resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
#ifdef _WIN32
LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
#pragma code_page(949)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_VERSION_STRING "Korean <20>oAu %s."
IDS_CANT_FIND_FILE "%s (A№)<29>| A√A№ <20>o <20>┆A<E29486>."
END
#endif // Korean resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Chinese (Taiwan) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHT)
#ifdef _WIN32
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL
#pragma code_page(950)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_VERSION_STRING "Chinese ac<61>? %s!C"
IDS_CANT_FIND_FILE "”a?<3F><>i %s!C"
END
#endif // Chinese (Taiwan) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_VERSION_STRING "German Version %s."
IDS_CANT_FIND_FILE "Konnte %s nicht finden."
END
#endif // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
1 ICON DISCARDABLE "autorun.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Cursor
//
2 CURSOR DISCARDABLE "arrow.cur"
/////////////////////////////////////////////////////////////////////////////
//
// 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
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
BITMAPDIALOG DIALOG DISCARDABLE 0, 0, 186, 94
STYLE DS_ABSALIGN | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU
FONT 8, "MS Sans Serif"
BEGIN
END
/////////////////////////////////////////////////////////////////////////////
//
// WAVE
//
MOUSEMOVE WAVE DISCARDABLE "mouse.wav"
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VERSIONINFO_1 VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEFLAGSMASK 0x0L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x0L
FILETYPE 0x0L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "Westwood Studios\0"
VALUE "FileDescription", "Westwood Autorun\0"
VALUE "FileVersion", "1.00\0"
VALUE "InternalName", "Autorun\0"
VALUE "LegalCopyright", "Copyright <20> Westwood Studios 2001\0"
VALUE "OriginalFilename", "Autorun.exe\0"
VALUE "ProductName", "Command & Conquer Renegade\0"
VALUE "ProductVersion", "1, 0, 0, 0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_VERSION_STRING "English Version %s."
IDS_CANT_FIND_FILE "Could not find %s."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// French (France) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_VERSION_STRING "French Version %s."
IDS_CANT_FIND_FILE "Impossible de trouver %s."
END
#endif // French (France) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,440 @@
# Microsoft Developer Studio Project File - Name="Autorun English" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=Autorun English - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Autorun.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Autorun.mak" CFG="Autorun English - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Autorun English - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "Autorun English - Win32 German" (based on "Win32 (x86) Application")
!MESSAGE "Autorun English - Win32 French" (based on "Win32 (x86) Application")
!MESSAGE "Autorun English - Win32 English" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/Renegade Setup/Autorun", SJEEAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Autorun English - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /Zp1 /W3 /Gm /GX /ZI /Od /I "../../Libraries/Include/" /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /FR /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x417 /fo"Debug/Autorun English.res" /d "_DEBUG" /d "_GERMAN"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 dxguid.lib dinput8.lib d3dx8.lib d3d8.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib wsock32.lib imm32.lib wininet.lib vfw32.lib /nologo /subsystem:windows /map /debug /machine:I386
# SUBTRACT LINK32
!ELSEIF "$(CFG)" == "Autorun English - Win32 German"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "German"
# PROP BASE Intermediate_Dir "German"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "German"
# PROP Intermediate_Dir "German"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /Zp1 /W3 /GX /O2 /I "../../Libraries/Include/" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_ENGLISH" /FD /c
# SUBTRACT BASE CPP /Fr /YX
# ADD CPP /nologo /Zp1 /W3 /GX /O2 /I "../../Libraries/Include/" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_ENGLISH" /FD /c
# SUBTRACT CPP /Fr /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /fo"Release/Autorun English.res" /d "NDEBUG" /d "_GERMAN"
# ADD RSC /l 0x409 /fo"Release/Autorun English.res" /d "NDEBUG" /d "_GERMAN"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib dxguid.lib dinput8.lib d3dx8.lib d3d8.lib wsock32.lib imm32.lib wininet.lib vfw32.lib /nologo /subsystem:windows /machine:I386 /out:".\Release\Autorun.exe"
# SUBTRACT BASE LINK32 /debug
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib dxguid.lib dinput8.lib d3dx8.lib d3d8.lib wsock32.lib imm32.lib wininet.lib vfw32.lib /nologo /subsystem:windows /machine:I386 /out:".\German\Autorun.exe"
# SUBTRACT LINK32 /debug
!ELSEIF "$(CFG)" == "Autorun English - Win32 French"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "French"
# PROP BASE Intermediate_Dir "French"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "French"
# PROP Intermediate_Dir "French"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /Zp1 /W3 /GX /O2 /I "../../Libraries/Include/" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_ENGLISH" /FD /c
# SUBTRACT BASE CPP /Fr /YX
# ADD CPP /nologo /Zp1 /W3 /GX /O2 /I "../../Libraries/Include/" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_ENGLISH" /FD /c
# SUBTRACT CPP /Fr /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /fo"Release/Autorun English.res" /d "NDEBUG" /d "_GERMAN"
# ADD RSC /l 0x409 /fo"Release/Autorun English.res" /d "NDEBUG" /d "_FRENCH"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib dxguid.lib dinput8.lib d3dx8.lib d3d8.lib wsock32.lib imm32.lib wininet.lib vfw32.lib /nologo /subsystem:windows /machine:I386 /out:".\Release\Autorun.exe"
# SUBTRACT BASE LINK32 /debug
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib dxguid.lib dinput8.lib d3dx8.lib d3d8.lib wsock32.lib imm32.lib wininet.lib vfw32.lib /nologo /subsystem:windows /machine:I386 /out:".\French\Autorun.exe"
# SUBTRACT LINK32 /debug
!ELSEIF "$(CFG)" == "Autorun English - Win32 English"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "English"
# PROP BASE Intermediate_Dir "English"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "English"
# PROP Intermediate_Dir "English"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /Zp1 /W3 /GX /O2 /I "../../Libraries/Include/" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_ENGLISH" /FD /c
# SUBTRACT BASE CPP /Fr /YX
# ADD CPP /nologo /Zp1 /W3 /GX /O2 /I "../../Libraries/Include/" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /Fr /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /fo"Release/Autorun English.res" /d "NDEBUG" /d "_GERMAN"
# ADD RSC /l 0x409 /fo"Release/Autorun English.res" /d "NDEBUG" /d "_ENGLISH"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib dxguid.lib dinput8.lib d3dx8.lib d3d8.lib wsock32.lib imm32.lib wininet.lib vfw32.lib /nologo /subsystem:windows /machine:I386 /out:".\Release\Autorun.exe"
# SUBTRACT BASE LINK32 /debug
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib dxguid.lib dinput8.lib d3dx8.lib d3d8.lib wsock32.lib imm32.lib wininet.lib vfw32.lib /nologo /subsystem:windows /machine:I386 /out:".\English\Autorun.exe"
# SUBTRACT LINK32 /debug
!ENDIF
# Begin Target
# Name "Autorun English - Win32 Debug"
# Name "Autorun English - Win32 German"
# Name "Autorun English - Win32 French"
# Name "Autorun English - Win32 English"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\ARGS.CPP
# End Source File
# Begin Source File
SOURCE=.\ARGS.H
# End Source File
# Begin Source File
SOURCE=.\autorun.cpp
# End Source File
# Begin Source File
SOURCE=.\autorun.h
# End Source File
# Begin Source File
SOURCE=.\CallbackHook.h
# End Source File
# Begin Source File
SOURCE=.\CDCNTRL.CPP
# End Source File
# Begin Source File
SOURCE=.\CDCNTRL.H
# End Source File
# Begin Source File
SOURCE=.\DrawButton.cpp
# End Source File
# Begin Source File
SOURCE=.\DrawButton.h
# End Source File
# Begin Source File
SOURCE=.\EZGIMEX.cpp
# End Source File
# Begin Source File
SOURCE=.\GameText.cpp
# End Source File
# Begin Source File
SOURCE=.\GameText.h
# End Source File
# Begin Source File
SOURCE=.\GETCD.CPP
# End Source File
# Begin Source File
SOURCE=.\GetCD.h
# End Source File
# Begin Source File
SOURCE=.\gimex.h
# End Source File
# Begin Source File
SOURCE=.\IGR.cpp
# End Source File
# Begin Source File
SOURCE=.\IGR.h
# End Source File
# Begin Source File
SOURCE=.\Jsupport.cpp
# End Source File
# Begin Source File
SOURCE=.\JSUPPORT.H
# End Source File
# Begin Source File
SOURCE=.\leanAndMeanAutorun.h
# End Source File
# Begin Source File
SOURCE=.\locale.cpp
# End Source File
# Begin Source File
SOURCE=.\locale.h
# End Source File
# Begin Source File
SOURCE=.\Locale_API.cpp
# End Source File
# Begin Source File
SOURCE=.\Locale_API.h
# End Source File
# Begin Source File
SOURCE=.\POINT.h
# End Source File
# Begin Source File
SOURCE=.\RECT.h
# End Source File
# Begin Source File
SOURCE=.\resource.h
# End Source File
# Begin Source File
SOURCE=.\TTFont.cpp
# End Source File
# Begin Source File
SOURCE=.\TTFont.h
# End Source File
# Begin Source File
SOURCE=.\Utils.cpp
# End Source File
# Begin Source File
SOURCE=.\Utils.h
# End Source File
# Begin Source File
SOURCE=.\ViewHTML.cpp
# End Source File
# Begin Source File
SOURCE=.\ViewHTML.h
# End Source File
# Begin Source File
SOURCE=.\WinFix.CPP
# End Source File
# Begin Source File
SOURCE=.\WinFix.H
# End Source File
# Begin Source File
SOURCE=.\wnd_file.cpp
# End Source File
# Begin Source File
SOURCE=.\Wnd_File.h
# End Source File
# Begin Source File
SOURCE=.\WSYS_File.cpp
# End Source File
# Begin Source File
SOURCE=.\WSYS_file.h
# End Source File
# Begin Source File
SOURCE=.\WSYS_FileSystem.cpp
# End Source File
# Begin Source File
SOURCE=.\WSYS_FileSystem.h
# End Source File
# Begin Source File
SOURCE=.\WSYS_RAMFile.cpp
# End Source File
# Begin Source File
SOURCE=.\WSYS_RAMFile.h
# End Source File
# Begin Source File
SOURCE=.\WSYS_StdFile.cpp
# End Source File
# Begin Source File
SOURCE=.\WSYS_StdFile.h
# End Source File
# Begin Source File
SOURCE=.\WSYS_StdFileSystem.cpp
# End Source File
# Begin Source File
SOURCE=.\WSYS_StdFileSystem.h
# End Source File
# End Group
# Begin Group "Resources"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\arrow.cur
# End Source File
# Begin Source File
SOURCE=.\Autorun.ICO
# End Source File
# Begin Source File
SOURCE=.\AUTORUN.RC
# End Source File
# Begin Source File
SOURCE=.\AutoRun_Frn.bmp
# End Source File
# End Group
# Begin Source File
SOURCE=.\ARButton_Reg.bmp
# End Source File
# Begin Source File
SOURCE=.\ARButton_Sel.bmp
# End Source File
# Begin Source File
SOURCE=..\arrow.cur
# End Source File
# Begin Source File
SOURCE=..\autorun.ico
# End Source File
# Begin Source File
SOURCE=.\Autorun_BG.bmp
# End Source File
# Begin Source File
SOURCE=.\AutoRun_Ger.bmp
# End Source File
# Begin Source File
SOURCE=.\Bullet.bmp
# End Source File
# Begin Source File
SOURCE=".\License French.bmp"
# End Source File
# Begin Source File
SOURCE=".\License French2.bmp"
# End Source File
# Begin Source File
SOURCE=".\License German.bmp"
# End Source File
# Begin Source File
SOURCE=".\License German2.bmp"
# End Source File
# Begin Source File
SOURCE=".\License USA.bmp"
# End Source File
# Begin Source File
SOURCE=".\License USA2.bmp"
# End Source File
# Begin Source File
SOURCE=.\mouse.wav
# End Source File
# Begin Source File
SOURCE=.\English\Present.wav
# End Source File
# Begin Source File
SOURCE=".\English\Rock-n-Roll.wav"
# End Source File
# End Target
# End Project

View file

@ -0,0 +1,33 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Autorun English"=".\Autorun English.dsp" - Package Owner=<4>
Package=<5>
{{{
begin source code control
"$/Renegade Setup/Autorun", SJEEAAAA
.
end source code control
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,156 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/***********************************************************************************************
*** 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 <winmin.h>
#define STRICT
#include <windows.h>
#include <windowsx.h>
#include <ctype.h>
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

View file

@ -0,0 +1,85 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/******************************************************************************
*
* 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)
{return false;}
protected:
CallbackHook(const CallbackHook&);
const CallbackHook& operator=(const CallbackHook&);
};
template<class T> class Callback : public CallbackHook
{
public:
Callback(bool (*callback)(T), T userdata)
: mCallback(callback),
mUserData(userdata)
{
}
virtual ~Callback()
{
}
virtual bool DoCallback(void)
{
if (mCallback != NULL)
{
return mCallback(mUserData);
}
return false;
}
private:
bool (*mCallback)(T);
T mUserData;
};
#endif // CALLBACKHOOK_H

View file

@ -0,0 +1,417 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/******************************************************************************
** 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 <windows.h>
#include <windowsx.h>
#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, char *normal, char *focus, 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, char *normal, char *focus, 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 );
}

View file

@ -0,0 +1,108 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/************************************************************************
** 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 <tchar.h>
#include <stdlib.h>
#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, char *normal, char *focus, char *pressed, const char *string, TTFontClass *fontptr );
DrawButton ( int id, RECT button_rect, char *normal, char *focus, 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

View file

@ -0,0 +1,213 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/* 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 <stdlib.h>
#include <string.h>
#include <stdio.h>
#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));
}

View file

@ -0,0 +1,414 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/****************************************************************************
***** 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 <windows.h>
#include <string.h>
//#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 char * _CD_Volume_Label[] = {
"Renegade Mission", // Yuri's Revenge (mission disk)
};
#else
static 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 ( 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! * *
*==============================================================================*/
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! * *
*==============================================================================*/
char *GetCDClass::Get_Volume_For_This_CD_Drive ( 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;
}
}
}
/* ==================================================================== */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,82 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//----------------------------------------------------------------------------
//
// 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_

View file

@ -0,0 +1,323 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/************************************************************************************************
*** 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 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 ( char *volume_name );
char * Get_Volume_For_This_CD_Drive ( char *path, char *volume_name );
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

View file

@ -0,0 +1,181 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//
// IGR.cpp - A class used to access the IGR registry settings.
//
// JeffB 7/5/00
//
#include <assert.h>
#include <windows.h>
#include <winreg.h>
//#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;
}

View file

@ -0,0 +1,75 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//
// 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;

View file

@ -0,0 +1,21 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// JSUPPORT.H
// DBCS Support Header
extern int nGetWord( char *,int );

View file

@ -0,0 +1,158 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// JSUPPORT.CPP
// DBCS Support Codes
#include <windows.h>
#include "jsupport.h"
// 前置禁則文字
// Can't set these characters on top of line
static BOOL IsDBCSInvalidAtTop(unsigned int c)
{
static BYTE * dtbl = (BYTE *)"¢°’”‰′″℃、。々〉》」』】〕ぁぃぅぇぉっゃゅょゎ゛゜ゝゞァィゥェォッャュョヮヵヶ・ーヽヾ!%),.:;?]}";
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;
}
// 後置禁則文字
// Can't set these characters on end of line
static BOOL IsDBCSInvalidAtEnd( unsigned int c )
{
static BYTE * dtbl = (BYTE *)"‘“〈《「『【〔([{$£¥";
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 );
}

View file

@ -0,0 +1,419 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************
* 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)
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 );
}

View file

@ -0,0 +1,67 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/************************************************************************************************
* 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 <STDLIB.H>
/****************************************************************************/
/* 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

View file

@ -0,0 +1,238 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/***********************************************************************************************
*** 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 <math.h>
//#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 T> 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 T>
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<T> const & rvalue) const {return(X==rvalue.X && Y==rvalue.Y);}
bool operator != (TPoint2D<T> const & rvalue) const {return(X!=rvalue.X || Y!=rvalue.Y);}
// Addition and subtraction operators.
TPoint2D<T> const & operator += (TPoint2D<T> const & rvalue) {X += rvalue.X;Y += rvalue.Y;return(*this);}
TPoint2D<T> const & operator -= (TPoint2D<T> const & rvalue) {X -= rvalue.X;Y -= rvalue.Y;return(*this);}
TPoint2D<T> const operator - (TPoint2D<T> const & rvalue) const {return(TPoint2D<T>(T(X - rvalue.X), T(Y - rvalue.Y)));}
TPoint2D<T> const operator + (TPoint2D<T> const & rvalue) const {return(TPoint2D<T>(T(X + rvalue.X), T(Y + rvalue.Y)));}
// Scalar multiplication and division.
TPoint2D<T> const operator * (T rvalue) const {return(TPoint2D<T>(T(X * rvalue), T(Y * rvalue)));}
TPoint2D<T> const & operator *= (T rvalue) {X *= rvalue; Y *= rvalue;return(*this);}
TPoint2D<T> const operator / (T rvalue) const {if (rvalue == T(0)) return(TPoint2D<T>(0,0));return(TPoint2D<T>(T(X / rvalue), T(Y / rvalue)));}
TPoint2D<T> const & operator /= (T rvalue) {if (rvalue != T(0)) {X /= rvalue;Y /= rvalue;}return(*this);}
// Dot and cross product.
TPoint2D<T> const operator * (TPoint2D<T> const & rvalue) const {return(TPoint2D<T>(T(X * rvalue.X), T(Y * rvalue.Y)));}
T Dot_Product(TPoint2D<T> const & rvalue) const {return((T(X * rvalue.X + Y * rvalue.Y)));}
TPoint2D<T> const Cross_Product(TPoint2D<T> const & rvalue) const {return(TPoint2D<T>(T(Y - rvalue.Y), T(rvalue.X - X)));}
// Negation operator -- simple and effective
TPoint2D<T> const operator - (void) const {return(TPoint2D<T>(T(-X), T(-Y)));}
// Vector support functions.
T Length(void) const {return(T(sqrt(double(X*X + Y*Y))));}
TPoint2D<T> const Normalize(void) const {
double len = sqrt(X*X + Y*Y);
if (len != 0.0) {
return(TPoint2D<T>((T)(X / len), (T)(Y / len)));
} else {
return(*this);
}
}
// Find distance between points.
T Distance_To(TPoint2D<T> 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<int>
{
public:
Point2D(void) {} // Default constructor does nothing by design.
Point2D(int x, int y) : TPoint2D<int>(x, y) {}
Point2D(Point2DStruct const & rvalue) : TPoint2D<int>(rvalue.X, rvalue.Y) {}
Point2D(TPoint2D<int> const & rvalue) : TPoint2D<int>(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<class T>
T Distance(TPoint2D<T> const & point1, TPoint2D<T> const & point2)
{
return((point1 - point2).Length());
}
template<class T>
TPoint2D<T> const Cross_Product(TPoint2D<T> const & lvalue, TPoint2D<T> 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 T>
class TPoint3D : public TPoint2D<T> {
typedef TPoint2D<T> BASECLASS;
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<T> const & rvalue) const {return(X==rvalue.X && Y==rvalue.Y && Z==rvalue.Z);}
bool operator != (TPoint3D<T> const & rvalue) const {return(X!=rvalue.X || Y!=rvalue.Y || Z!=rvalue.Z);}
// Addition and subtraction operators.
TPoint3D<T> const & operator += (TPoint3D<T> const & rvalue) {X += rvalue.X;Y += rvalue.Y;Z += rvalue.Z;return(*this);}
TPoint2D<T> const & operator += (TPoint2D<T> const & rvalue) {BASECLASS::operator += (rvalue);return(*this);}
TPoint3D<T> const & operator -= (TPoint3D<T> const & rvalue) {X -= rvalue.X;Y -= rvalue.Y;Z -= rvalue.Z;return(*this);}
TPoint2D<T> const & operator -= (TPoint2D<T> const & rvalue) {BASECLASS::operator -= (rvalue);return(*this);}
TPoint3D<T> const operator - (TPoint3D<T> const & rvalue) const {return(TPoint3D<T>(X - rvalue.X, Y - rvalue.Y, Z - rvalue.Z));}
TPoint3D<T> const operator - (TPoint2D<T> const & rvalue) const {return(TPoint3D<T>(X - rvalue.X, Y - rvalue.Y, Z));}
TPoint3D<T> const operator + (TPoint3D<T> const & rvalue) const {return(TPoint3D<T>(X + rvalue.X, Y + rvalue.Y, Z + rvalue.Z));}
TPoint3D<T> const operator + (TPoint2D<T> const & rvalue) const {return(TPoint3D<T>(X + rvalue.X, Y + rvalue.Y, Z));}
// Scalar multiplication and division.
TPoint3D<T> const operator * (T rvalue) const {return(TPoint3D<T>(X * rvalue, Y * rvalue, Z * rvalue));}
TPoint3D<T> const & operator *= (T rvalue) {X *= rvalue;Y *= rvalue;Z *= rvalue;return(*this);}
TPoint3D<T> const operator / (T rvalue) const {if (rvalue == T(0)) return(TPoint3D<T>(0,0,0));return(TPoint3D<T>(X / rvalue, Y / rvalue, Z / rvalue));}
TPoint3D<T> const & operator /= (T rvalue) {if (rvalue != T(0)) {X /= rvalue;Y /= rvalue;Z /= rvalue;}return(*this);}
// Dot and cross product.
TPoint3D<T> const operator * (TPoint3D<T> const & rvalue) const {return(TPoint3D<T>(X * rvalue.X, Y * rvalue.Y, Z * rvalue.Z));}
T Dot_Product(TPoint3D<T> const & rvalue) const {return(T(X * rvalue.X + Y * rvalue.Y + Z * rvalue.Z));}
TPoint3D<T> const Cross_Product(TPoint3D<T> const & rvalue) const {return TPoint3D<T>(Y * rvalue.Z - Z * rvalue.Y, Z * rvalue.X - X * rvalue.Z, X * rvalue.Y - Y * rvalue.X);}
// Negation operator -- simple and effective
TPoint3D<T> const operator - (void) const {return(TPoint3D<T>(-X, -Y, -Z));}
// Vector support functions.
T Length(void) const {return(T(sqrt(double(X*X + Y*Y + Z*Z))));}
TPoint3D<T> const Normalize(void) const {
double len = sqrt(X*X + Y*Y + Z*Z);
if (len != 0.0) {
return(TPoint3D<T>((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<int> Point3D;
template<class T>
TPoint3D<T> const Cross_Product(TPoint3D<T> const & lvalue, TPoint3D<T> const & rvalue)
{
return(lvalue.Cross_Product(rvalue));
}
#endif

View file

@ -0,0 +1,308 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/***********************************************************************************************
*** 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 <stddef.h>
#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 T>
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<T> const & point, T w, T h) : X(point.X), Y(point.Y), Width(w), Height(h) {}
// Equality comparison operators.
bool operator == (TRect<T> const & rvalue) const {return(X==rvalue.X && Y==rvalue.Y && Width==rvalue.Width && Height==rvalue.Height);}
bool operator != (TRect<T> const & rvalue) const {return(X!=rvalue.X || Y!=rvalue.Y || Width!=rvalue.Width || Height!=rvalue.Height);}
// Addition and subtraction operators.
TRect<T> const & operator += (TPoint2D<T> const & point) {X += point.X;Y += point.Y;return(*this);}
TRect<T> const & operator -= (TPoint2D<T> const & point) {X -= point.X;Y -= point.Y;return(*this);}
TRect<T> const operator + (TPoint2D<T> const & point) {return(TRect<T>(Top_Left() + point, Width, Height));}
TRect<T> const operator - (TPoint2D<T> const & point) {return(TRect<T>(Top_Left() - point, Width, Height));}
/*
** Bias this rectangle within another.
*/
TRect<T> const Bias_To(TRect<T> const & rect) const {return(TRect<T>(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<T> 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<T> Top_Left(void) const {return(TPoint2D<T>(X, Y));}
__declspec(property(get=Top_Left)) TPoint2D<T> TopLeft;
TPoint2D<T> Top_Right(void) const {return(TPoint2D<T>(T(X + Width - 1), Y));}
__declspec(property(get=Top_Right)) TPoint2D<T> TopRight;
TPoint2D<T> Bottom_Left(void) const {return(TPoint2D<T>(X, T(Y + Height - 1)));}
__declspec(property(get=Bottom_Left)) TPoint2D<T> BottomLeft;
TPoint2D<T> Bottom_Right(void) const {return(TPoint2D<T>(T(X + Width - 1), T(Y + Height - 1)));}
__declspec(property(get=Bottom_Right)) TPoint2D<T> BottomRight;
/*
** Determine if a point lies within the rectangle.
*/
bool Is_Point_Within(TPoint2D<T> 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<class T>
TPoint2D<T> const Bias_To(TPoint2D<T> const & point, TRect<T> const & rect)
{
return(TPoint2D<T>(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<class T>
TRect<T> const Union(TRect<T> const & rect1, TRect<T> const & rect2)
{
if (rect1.Is_Valid()) {
if (rect2.Is_Valid()) {
TRect<T> 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<class T>
TRect<T> const Intersect(TRect<T> const & bounding_rect, TRect<T> const & draw_rect, T * x, T * y)
{
TRect<T> bad_rect(0, 0, 0, 0); // Dummy (illegal) draw_rect.
TRect<T> 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<class T>
TRect<T> const Intersect(TRect<T> const & rect1, TRect<T> 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<int> Rect;
const Rect RECT_NONE(0,0,0,0);
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,304 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/************************************************************************************************
*** 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 <stddef.h>
#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

View file

@ -0,0 +1,669 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/****************************************************************************
*** 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 <io.h>
#include "args.h"
#include "assert.h"
#include "locale_api.h"
#include "resource.h"
#include "utils.h"
#include "winfix.h"
#include "wnd_file.h"
#include <winver.h>
#include <shlwapi.h>
//#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 ( 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 ( 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 );
}
}

View file

@ -0,0 +1,75 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
*** 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 <windows.h>
/******************************************************************************
** Swaps two objects.
*/
template<class T>
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 ( char *filename, char *path );
wchar_t * Make_Current_Path_To ( 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

View file

@ -0,0 +1,202 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/******************************************************************************
*
* 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 <windows.h>
#include "ViewHTML.h"
//#include "..\win.h"
#include <stdio.h>
//#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, 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 = "<title>ViewHTML</title>";
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;
}

View file

@ -0,0 +1,42 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/******************************************************************************
*
* 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, CallbackHook& callback = CallbackHook());
#endif // VIEWHTML_H

View file

@ -0,0 +1,268 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//----------------------------------------------------------------------------
//
// 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 <assert.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#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("<no file>");
}
//----------------------------------------------------------------------------
// 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( "<no file>" );
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);
}

View file

@ -0,0 +1,106 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//----------------------------------------------------------------------------
//
// 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
//----------------------------------------------------------------------------

View file

@ -0,0 +1,96 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//----------------------------------------------------------------------------=
//
// 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

View file

@ -0,0 +1,289 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//----------------------------------------------------------------------------
//
// 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 <stdio.h>
#include <fcntl.h>
#include <io.h>
#include <string.h>
#include <sys/stat.h>
#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;
}

View file

@ -0,0 +1,100 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//----------------------------------------------------------------------------=
//
// 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

View file

@ -0,0 +1,256 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//----------------------------------------------------------------------------
//
// 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 <stdio.h>
#include <fcntl.h>
#include <io.h>
#include <string.h>
#include <sys/stat.h>
#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 );
}

View file

@ -0,0 +1,97 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//----------------------------------------------------------------------------=
//
// 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

View file

@ -0,0 +1,122 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//----------------------------------------------------------------------------
//
// 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;
}

View file

@ -0,0 +1,92 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//----------------------------------------------------------------------------=
//
// 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

View file

@ -0,0 +1,167 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//----------------------------------------------------------------------------=
//
// 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

View file

@ -0,0 +1,350 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/***********************************************************************************************
*** 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 <windows.h>
#include <windowsx.h>
#pragma hdrstop
//#include <commctrl.h>
//#include <winuser.h>
#include <assert.h>
#include <stdio.h>
#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 );
}

View file

@ -0,0 +1,149 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/***********************************************************************************************
*** 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

View file

@ -0,0 +1,216 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//****************************************************************************
// 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 <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <ctype.h>
#include <stdlib.h>
#include <assert.h>
#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, char *file, char *fmt, ... );
void __cdecl Msg( int line, char *filename, 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

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,246 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/************************************************************************************************
* 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 <tchar.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "ttfont.h"
//--------------------------------------------------------------------
// Externs
//--------------------------------------------------------------------
extern int Language;
//--------------------------------------------------------------------
// Structs that everyone can use.
//--------------------------------------------------------------------
typedef enum {
LANG_USA, //0
LANG_UK, //1
LANG_GER, //2
LANG_FRE, //3
LANG_DUT, //4
LANG_ITA, //5
LANG_JAP, //6
LANG_SPA, //7
LANG_SCA, //8
LANG_KOR, //9
LANG_CHI, //10
LANG_NUM,
} LanguageType;
#define IS_LANGUAGE_DBCS(l) (((l)==LANG_CHI)||((l)==LANG_JAP)||((l)==LANG_KOR)) // [OYO]
#define IS_CODEPAGE_DBCS(C) ((C==949)||(C==950)||(C==932)) // [OYO]
//----------------------------------------------------------------------------
// DEFINES
//----------------------------------------------------------------------------
#define MAX_COMMAND_LINE_ARGUMENTS 10
#define MAX_ARGUMENT_LENGTH 80
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define WM_GO (WM_USER)+1
#define WM_USERSTAT (WM_USER + 100)
#define EXPLORER_NAME "EXPLORER.EXE"
#define INSTALL_PATH_KEY "InstallPath"
#define INTERNET_PATH_KEY "InternetPath"
#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\\InstallShield_{F3E9C243-122E-4D6B-ACC1-E1FEC02F6CA1}"
#define SHELL_APP_PATHS_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths"
#define PROGRAMS_SUBKEY "Programs"
#define COMMON_PROGRAMS_SUBKEY "Common Programs"
#define SOFTWARE_SUBKEY "Software"
/*
#define WESTWOOD_SUBKEY "Westwood"
#define SOFTWARE_WESTWOOD_KEY "Software\\Westwood\\"
#define WESTWOOD_WOLAPI_KEY "Software\\Westwood\\WOLAPI"
#define WESTWOOD_REGISTER_KEY "Software\\Westwood\\Register"
*/
#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"
#define LAUNCHER_FILENAME "Generals.exe"
#define WORLDBUILDER_FILENAME "WorldBuilder.exe"
#define PATCHGET_FILENAME "patchget.dat"
#define UNINSTALL_STRING_SUBKEY "UninstallString"
#define INSTALLPATH_SUBKEY "InstallPath"
#define VERSION_SUBKEY "Version"
#define LANGUAGE_SUBKEY "Language"
#define MAPPACKVERSION_SUBKEY "MapPackVersion"
#define DDRAW "DDRAW.DLL"
#define DSOUND "DSOUND.DLL"
#define DDHELP "DDHELP.EXE"
#define NORMAL "Normal"
#define FOCUSED "Focused"
#define PRESSED "Pressed"
/*
#define BUTTON1NORMAL "Button1Normal"
#define BUTTON2NORMAL "Button2Normal"
#define BUTTON3NORMAL "Button3Normal"
#define BUTTON4NORMAL "Button4Normal"
#define BUTTON5NORMAL "Button5Normal"
#define BUTTON6NORMAL "Button6Normal"
#define BUTTON7NORMAL "Button7Normal"
#define BUTTON8NORMAL "Button8Normal"
#define BUTTON9NORMAL "Button8Normal"
#define BUTTON10NORMAL "Button8Normal"
#define BUTTON1FOCUSED "Button1Focused"
#define BUTTON2FOCUSED "Button2Focused"
#define BUTTON3FOCUSED "Button3Focused"
#define BUTTON4FOCUSED "Button4Focused"
#define BUTTON5FOCUSED "Button5Focused"
#define BUTTON6FOCUSED "Button6Focused"
#define BUTTON7FOCUSED "Button7Focused"
#define BUTTON8FOCUSED "Button8Focused"
#define BUTTON9FOCUSED "Button8Focused"
#define BUTTON10FOCUSED "Button8Focused"
*/
#define BUTTON_REG "BUTTON_REG"
#define BUTTON_SEL "BUTTON_SEL"
//-------------------------------------------------------------------------
// LaunchObject Class
//-------------------------------------------------------------------------
class LaunchObjectClass
{
public:
LaunchObjectClass ( char *path=NULL, char *args=NULL );
void SetPath ( char *path );
void SetArgs ( char *args );
unsigned int Launch ( void );
bool Launch_A_Program ( void ) { return( LaunchSomething ); };
void Set_Launch ( bool value ) { LaunchSomething = value; };
public:
char szPath[ _MAX_PATH ];
char szArgs[ _MAX_PATH ];
bool LaunchSomething;
};
extern LaunchObjectClass LaunchObject;
//-------------------------------------------------------------------------
// Main Class
//-------------------------------------------------------------------------
class Main
{
public:
static HINSTANCE hInstance;
static HINSTANCE hPrevInstance;
static HMODULE hModule;
static int nCmdShow;
static int MessageLoop( void );
};
//-------------------------------------------------------------------------
// (Base)Window Class
//
// Note that Window_Proc is a "pure virtual" function making this an
// abstract class.
//-------------------------------------------------------------------------
class Window
{
protected:
HWND hWnd;
public:
HWND GetHandle( void ) { return hWnd; }
BOOL Show( int nCmdShow ) { return ShowWindow( hWnd, nCmdShow ); }
void Update( void ) { UpdateWindow( hWnd ); }
virtual LRESULT Window_Proc( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam ) = 0;
};
//-------------------------------------------------------------------------
// MainWindow Class
//-------------------------------------------------------------------------
class MainWindow : public Window
{
protected:
static char szClassName[ 100 ];
public:
MainWindow( void );
static void Register ( void );
static void Reset_Class_Name ( char *string )
{
if ( string != NULL && string[0] != '\0' ) {
strcpy( szClassName, string );
}
};
BOOL Is_Product_Registered ( void );
void Create_Buttons ( HWND hWnd, RECT *dlg_rect );
unsigned int Run_Auto_Update ( HWND hWnd, RECT *rect );
unsigned int Run_Demo ( HWND hWnd, RECT *rect, int cd_drive );
BOOL Run_Explorer ( char *, HWND hWnd, RECT *rect );
unsigned int Run_Game ( HWND hWnd, RECT *rect );
unsigned int Run_WorldBuilder ( HWND hWnd, RECT *rect );
unsigned int Run_PatchGet ( HWND hWnd, RECT *rect );
unsigned int Run_New_Account ( HWND hWnd, RECT *rect );
unsigned int Run_Register ( HWND hWnd, RECT *rect );
unsigned int Run_Setup ( HWND hWnd, RECT *rect, int cd_drive );
unsigned int Run_Uninstall ( HWND hWnd, RECT *rect );
unsigned int Run_OpenFile (int cd_drive, const char *filename, bool wait = false);
LRESULT Window_Proc ( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam );
};
#endif

View file

@ -0,0 +1,307 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/* Copyright (C) Electronic Arts Canada Inc. 1994-1998. All rights reserved. */
/* ABSTRACT
gimex.h - Graphics IMport EXport (GIMEX) v2.26
@ */
#ifndef __GIMEX_H
#define __GIMEX_H 1
#ifdef __cplusplus
extern "C" {
#endif
#define GimexVersion "2.26"
/****************************************************************************/
/* Data Types */
/****************************************************************************/
/* ARGB structure used for palettes/pixels */
#ifndef _ARGB_T
#define _ARGB_T
#if defined(_MSC_VER) || defined(__WATCOMC__) || defined(PSX) || defined(DC)
typedef struct
{
unsigned char b,g,r,a;
} ARGB;
#elif defined(SGI)
typedef struct
{
unsigned char a,b,g,r;
} ARGB;
#else /* Mac */
typedef struct
{
unsigned char a,r,g,b;
} ARGB;
#endif
#endif
/* Info structure describing bitmaps */
#define GIMEX_FRAMENAME_SIZE 32
#define GIMEX_COMMENT_SIZE 256
#define GIMEX_COLOURTBL_SIZE 256
#define GIMEX_HOTSPOTTBL_SIZE 256
#define GIMEX_HOTSPOTTBL_VALUES 2
typedef struct
{
long signature; /* signature of gimex ie 'tga ' (optional) */
long size; /* size of GINFO structure */
int version; /* version number of GINFO structure (200) */
int framenum; /* current frame */
int width; /* width of bitmap in pixels */
int height; /* height of bitmap in pixels */
int bpp; /* bits per pixel (8 or 32) */
int originalbpp; /* bits per pixel in original image (1 to 32) */
int startcolour; /* first colour in palette */
int numcolours; /* number of colours in original indexed palette */
ARGB colourtbl[GIMEX_COLOURTBL_SIZE]; /* 8 bit palette */
int subtype; /* internal format sub-type 0-default */
int packed; /* type of packing on original image. 0 none, 1 run, n other */
int quality; /* quality of lossy packing 0..100 */
int framesize; /* size of frame in bytes */
int alphabits; /* number of bits in alpha channel */
int redbits; /* number of bits in red channel */
int greenbits; /* number of bits in green channel */
int bluebits; /* number of bits in blue channel */
int centerx; /* center point relative to upper left corner */
int centery;
int defaultx; /* default coordinate point */
int defaulty;
int numhotspots; /* number of hot spots defined */
char framename[GIMEX_FRAMENAME_SIZE]; /* null terminated name of frame/image */
char comment[GIMEX_COMMENT_SIZE]; /* null terminated multiline user comment */
int hotspottbl[GIMEX_HOTSPOTTBL_SIZE][GIMEX_HOTSPOTTBL_VALUES];/* up to 256 hot spots, XY pairs relative to upperleft */
float dpi; /* dots per inch ie 72.0 */
int reserved[3]; /* reserved for future use - set to zero */
} GINFO;
#ifndef _GSTREAM_T
#define _GSTREAM_T GIMEX
typedef void GSTREAM; /* handle used for file functions */
#endif
typedef struct
{
long signature; /* signature of gimex ie 'tga ' (optional) */
long size; /* size of GINSTANCE structure */
int frames; /* Number of frames in file */
int framenum; /* current frame (optional) */
GSTREAM *gstream; /* stream pointer for file */
char *gref; /* gimex reference to additional memory used by module (optional) */
} GINSTANCE;
/* Info structure describing bitmaps */
#define MAXMACTYPES 8
#define MAXEXTENSIONS 8
#define GIMEX_EXTENSION_SIZE 8
#define GIMEX_AUTHORSTR_SIZE 32
#define GIMEX_VERSIONSTR_SIZE 8
#define GIMEX_SHORTTYPESTR_SIZE 8
#define GIMEX_WORDTYPESTR_SIZE 16
#define GIMEX_LONGTYPESTR_SIZE 32
typedef struct
{
long signature; /* signature of gimex ie 'tga ' (optional) */
long size; /* size of GABOUT structure */
int version; /* version number of GABOUT structure (200) */
unsigned int canimport :1; /* supports importing */
unsigned int canexport :1; /* supports exporting */
unsigned int importpacked :2; /* max import packed field 0..3 */
unsigned int exportpacked :2; /* max export packed field 0..3 */
unsigned int import8 :1; /* supports importing 8 bit indexed */
unsigned int export8 :1; /* supports exporting 8 bit indexed */
unsigned int import32 :1; /* supports importing 32 bit direct rgb */
unsigned int export32 :1; /* supports exporting 32 bit direct rgb */
unsigned int multiframe :1; /* supports multiple frames */
unsigned int multifile :1; /* format requires additional files or resource fork */
unsigned int multisize :1; /* supports different size per frame */
unsigned int framebuffer :1; /* module requires memory to buffer entire frame */
unsigned int external :1; /* module requires external tool or plugin */
unsigned int usesfile :1; /* module is file based vs ads/printer/generator */
unsigned int singlepalette :1; /* limited to a single palette per file */
unsigned int greyscale :1; /* use maxcolours for number of levels */
unsigned int startcolour :1; /* supports start colour */
unsigned int dotsubtype :1; /* subtype based on extension */
unsigned int resizable :1; /* read will respect ginfo width & height */
unsigned int pad :11; /* pad bitfield to 32 bit boundary for inter compiler compatibility */
int maxcolours; /* only use in 8 bit, 0 if module does not care */
int maxframename; /* maximum characters in ginfo framename */
int defaultquality; /* default pack quality */
long mactype[MAXMACTYPES]; /* mac file system types used */
char extensions[MAXEXTENSIONS][GIMEX_EXTENSION_SIZE]; /* null terminated extensions with '.' */
char authorstr[GIMEX_AUTHORSTR_SIZE]; /* name of gimex module author */
char versionstr[GIMEX_VERSIONSTR_SIZE]; /* version number of gimex module ie 1.00 */
char shorttypestr[GIMEX_SHORTTYPESTR_SIZE]; /* 3 or 4 character type string ie TGA */
char wordtypestr[GIMEX_WORDTYPESTR_SIZE]; /* single word type string ie Targa */
char longtypestr[GIMEX_LONGTYPESTR_SIZE]; /* full name of data format ie True Vision Targa */
} GABOUT;
/* Bitmap structure (optional) */
typedef struct
{
GINFO *ginfo;
char *image;
int rowbytes;
} GBITMAP;
#define GMAKEID(a,b,c,d) (((long)(a)<<24)|((long)(b)<<16)|((long)(c)<<8)|(long)(d))
#ifndef gmin
#define gmin(a,b) ((a)<(b)?(a):(b))
#endif
#ifndef gmax
#define gmax(a,b) ((a)>(b)?(a):(b))
#endif
#if !defined(GCALL)
#if defined(_MSC_VER) || defined(__WATCOMC__)
#define GCALL __stdcall
#else
#define GCALL
#endif
#endif
/* disable unreferenced parameters warnings */
#if defined(__WATCOMC__)
#pragma warning 202 999999
#endif
#if defined(_MSC_VER)
#pragma warning(disable : 4100)
#endif
#if 0
/****************************************************************************/
/* Gimex Module Example Prototypes */
/****************************************************************************/
/* Example Information Functions */
GABOUT * GCALL aboutbmp(void);
int GCALL isbmp(GSTREAM *g);
/* Example Import Functions */
int GCALL openbmp(GINSTANCE **gx, GSTREAM *g, char *pathname);
GINFO * GCALL infobmp(GINSTANCE *gx, int framenum);
int GCALL readbmp(GINSTANCE *gx, GINFO *ginfo, char *dest, int rowbytes);
int GCALL closebmp(GINSTANCE *gx);
/* Example Export Functions */
int GCALL wopenbmp(GINSTANCE **gx, GSTREAM *g, char *pathname, int numframes);
int GCALL writebmp(GINSTANCE *gx, GINFO *ginfo, char *source, int rowbytes);
int GCALL wclosebmp(GINSTANCE *gx);
#endif
/****************************************************************************/
/* Application Module Prototypes */
/****************************************************************************/
/* File Stream Functions */
GSTREAM * GCALL gopen(const char *pathname);
GSTREAM * GCALL gwopen(const char *pathname);
int GCALL gclose(GSTREAM *g);
int GCALL gread(GSTREAM *g, void *buf, long size);
int GCALL gwrite(GSTREAM *g, void *buf, long size);
int GCALL gseek(GSTREAM *g, long offset);
long GCALL glen(GSTREAM *g);
long GCALL gtell(GSTREAM *g);
/* Memory Functions */
void * GCALL galloc(long size);
int GCALL gfree(void *memptr);
void gputm(void *memptr, unsigned long val, int numbytes);
void gputi(void *memptr, unsigned long val, int numbytes);
unsigned long ggetm(void *memptr, int numbytes);
unsigned long ggeti(void *memptr, int numbytes);
/****************************************************************************/
/* Watcom Memory Functions */
/****************************************************************************/
#if defined(__WATCOMC__) && !defined(__NOINLINE__)
#pragma aux ggeti = \
"mov eax,[eax+ecx-4]" \
"neg ecx" \
"lea ecx,32[ecx*8]" \
"shr eax,cl" \
parm [eax] [ecx] \
modify [eax ecx] \
value [eax];
#pragma aux ggetm = \
".586" \
"mov eax,[eax]" \
"bswap eax" \
"neg ecx" \
"lea ecx,32[ecx*8]" \
"shr eax,cl" \
parm [eax] [ecx] \
modify [eax ecx] \
value [eax];
unsigned long bswap(unsigned long val);
#pragma aux bswap = "bswap eax" parm [eax] modify [eax] value [eax];
#define gputm(putmdest,putmdata,putmbytes) \
(((int)(putmbytes)==4) ? ((void)(*((unsigned long *) (putmdest)) = bswap((unsigned long)(putmdata)))) \
: (((int)(putmbytes)==1) ? ((void)(*((unsigned char *) (putmdest)) = (unsigned char)(putmdata))) \
: (((int)(putmbytes)==2) ? ((void)(*((unsigned short *) (putmdest)) = (unsigned short)(bswap((unsigned long)(putmdata))>>16))) \
: (((int)(putmbytes)==3) ? ((void)(*((unsigned char *) (putmdest)+2) = (unsigned char)(putmdata)),(void)(*((unsigned short *) (putmdest)) = (unsigned short)(bswap((unsigned long)(putmdata))>>8))) \
: (void)0))))
#define gputi(putidest,putidata,putibytes) \
(((int)(putibytes)==4) ? ((void)(*((unsigned long *) (putidest)) = ((unsigned long)(putidata)))) \
: (((int)(putibytes)==1) ? ((void)(*((unsigned char *) (putidest)) = (unsigned char)(putidata))) \
: (((int)(putibytes)==2) ? ((void)(*((unsigned short *) (putidest)) = (unsigned short)(putidata))) \
: (((int)(putibytes)==3) ? ((void)(*((unsigned short *) (putidest)) = (unsigned short)(putidata)),(void)(*((unsigned char *) (putidest)+2) = (unsigned char)((unsigned long)(putidata)>>16))) \
: (void)0))))
#endif /* __WATCOMC__ */
#ifdef __cplusplus
}
#endif
#endif /* __GIMEX_H */
/* END ABSTRACT */

View file

@ -0,0 +1,31 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// FILE: leanAndMeanAutorun.h /////////////////////////////////////////////////////////////////////
// Author: Mark Lorenzen, January 2003!
// Description: Classes extracted from GameEngine for use in autorun without having to link the game to autorun
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __LEANANDMEANAUTORUN_H_
#define __LEANANDMEANAUTORUN_H_
#define LEAN_AND_MEAN
#endif //__LEANANDMEANAUTORUN_H_

View file

@ -0,0 +1,864 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/* Copyright (C) Electronic Arts Canada Inc. 1998-1999. All rights reserved. */
#include <string.h>
#include <assert.h>
#include "gimex.h" /* for file and memory IO only */
#include "locale.h"
#include "wnd_file.h"
/*************************************************************************/
/* File Format Structures */
/*************************************************************************/
#define LOCALEFILE_HEADERCHUNKID 0x48434f4c /* 'LOCH' */
#define LOCALEFILE_INDEXCHUNKID 0x49434f4c /* 'LOCI' */
#define LOCALEFILE_LANGUAGECHUNKID 0x4c434f4c /* 'LOCL' */
typedef struct
{
unsigned int ChunkID; /* 'LOCH' LOCALEFILE_HEADERCHUNKID */
unsigned int ChunkSize; /* size of chunk in bytes */
unsigned int Flags; /* 0=no index chunk present,1=index chunk present */
unsigned int LanguageCount; /* number of language chunks in this file */
/* unsigned int LanguageOffset[LanguageCount]; \\ offsets in bytes from start of file to language chunk */
} LOCALEFILE_HEADERCHUNK;
/* offset LOCALEFILE_HEADERCHUNK_LANGUAGE_OFFSET bytes from the start of the chunk to the language offset table */
#define LOCALEFILE_HEADERCHUNK_LANGUAGE_OFFSET sizeof(LOCALEFILE_HEADERCHUNK)
typedef struct
{
unsigned int ChunkID; /* 'LOCI' LOCALEFILE_INDEXCHUNKID */
unsigned int ChunkSize; /* size of chunk in bytes */
unsigned int StringCount; /* number of string ids in this chunk (same value in all language chunks) */
unsigned int pad; /* must be zero */
/* STRINGID StringID[StringCount]; */
/* { */
/* unsigned short ID; \\ id that user gives to look up value */
/* unsigned short Index; \\ index to look up value in language chunks */
/* } */
} LOCALEFILE_INDEXCHUNK;
/* offset LOCALEFILE_INDEXCHUNK_STRINGID_OFFSET bytes from the start of the chunk to the string id table */
#define LOCALEFILE_INDEXCHUNK_STRINGID_OFFSET sizeof(LOCALEFILE_INDEXCHUNK)
typedef struct
{
unsigned int ChunkID; /* 'LOCL' LOCALEFILE_LANGUAGECHUNKID */
unsigned int ChunkSize; /* size of chunk in bytes including this header and all string data */
unsigned int LanguageID; /* language strings are in for this bank */
unsigned int StringCount; /* number of strings in this chunk */
/* unsigned int StringOffset[StringCount]; \\ offsets in bytes from start of chunk to string */
/* const char* Data[StringCount]; \\ StringCount null terminated strings */
} LOCALEFILE_LANGUAGECHUNK;
/* offset LOCALEFILE_LANGUAGECHUNK_STRING_OFFSETbytes from the start of the chunk to the string offset table */
#define LOCALEFILE_LANGUAGECHUNK_STRING_OFFSET sizeof(LOCALEFILE_LANGUAGECHUNK)
/*************************************************************************/
/* LOCALE_INSTANCE declaration */
/*************************************************************************/
typedef LOCALEFILE_HEADERCHUNK HEADER;
typedef LOCALEFILE_INDEXCHUNK INDEX;
typedef LOCALEFILE_LANGUAGECHUNK BANK;
typedef struct
{
int BankIndex; /* current language bank set (0..BANK_COUNT-1) */
BANK* pBank[LOCALE_BANK_COUNT]; /* array of string banks */
INDEX* pIndex[LOCALE_BANK_COUNT]; /* array of string indices */
} LOCALE_INSTANCE;
static LOCALE_INSTANCE *lx = NULL;
/*************************************************************************/
/* initialization/restore */
/*************************************************************************/
/* helper function to make assertions for initialization clearer */
int LOCALE_isinitialized( void )
{
if ( lx == NULL ) {
// TRACE("LOCALE API is not initialized - call LOCALE_init before calling LOCALE functions\n");
}
return( lx != NULL );
}
/*
;
; ABSTRACT
;
; LOCALE_init - Init the localization module
;
;
; SUMMARY
;
; #include "realfont.h"
;
; int LOCALE_init(void)
;
; DESCRIPTION
;
; Initilizes everything needed to use the locale API. Can only be called
; once until LOCALE_restore is called.
;
; Returns non-zero if everything went ok.
;
; SEE ALSO
;
; LOCALE_restore
;
;
; EXAMPLE
;
; locale_eg.c
;
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
;
;
; END ABSTRACT
;
*/
int LOCALE_init(void)
{
int ok = 0;
/* ensure locale module is NOT already initialized */
ASSERT(lx == NULL); /* can only call LOCALE_init after a restore or once, cannot double init locale API */
/* allocate instance */
lx = (LOCALE_INSTANCE*)galloc(sizeof(LOCALE_INSTANCE));
if (lx != NULL) {
memset(lx, 0, sizeof(LOCALE_INSTANCE));
ok = 1;
}
return ok;
}
/*
;
; ABSTRACT
;
; LOCALE_restore - Free resources used by the locale module
;
;
; SUMMARY
;
; #include "realfont.h"
;
; void LOCALE_restore(void)
;
; DESCRIPTION
;
; Restores all resources used by the locale API. Can only be called after
; LOCALE_init, and only once.
;
; SEE ALSO
;
; LOCALE_init
;
;
; EXAMPLE
;
; locale_eg.c
;
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
;
;
; END ABSTRACT
;
*/
void LOCALE_restore(void)
{
int i;
if( lx != NULL ) {
ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
ASSERT(lx != NULL);
/* free any language tables */
for (i = 0; i < LOCALE_BANK_COUNT; i++) {
if (lx->pBank[i]) {
LOCALE_setbank(i);
LOCALE_freetable();
}
}
/* free instance */
gfree(lx);
lx = NULL;
}
}
/*************************************************************************/
/* attributes */
/*************************************************************************/
/*
;
; ABSTRACT
;
; LOCALE_setbank - Set the current bank
;
;
; SUMMARY
;
; #include "realfont.h"
;
; void LOCALE_setbank(BankIndex)
; int BankIndex; Number between 0 and LOCALE_BANK_COUNT - 1
;
; DESCRIPTION
;
; Sets the current bank to be active. All functions will now use this
; bank for strings. A bank is slot where a string table is loaded.
; More than one bank can have a table loaded but the locale functions
; only work on one bank at a time, the active bank set by this function.
;
; SEE ALSO
;
; LOCALE_getbank
;
;
; EXAMPLE
;
; locale_eg.c
;
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
;
;
; END ABSTRACT
;
*/
void LOCALE_setbank(int BankIndex)
{
ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
lx->BankIndex = BankIndex;
}
/*
;
; ABSTRACT
;
; LOCALE_getbank - Get the current bank
;
;
; SUMMARY
;
; #include "realfont.h"
;
; int LOCALE_getbank(void)
;
; DESCRIPTION
;
; Returns the bank index of the current bank.
;
; SEE ALSO
;
; LOCALE_setbank
;
;
; EXAMPLE
;
; locale_eg.c
;
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
;
;
; END ABSTRACT
;
*/
int LOCALE_getbank(void)
{
ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
return lx->BankIndex;
}
/*
;
; ABSTRACT
;
; LOCALE_getbanklanguageid - Get the language id for the current bank
;
;
; SUMMARY
;
; #include "realfont.h"
;
; int LOCALE_getbanklanguageid(void)
;
; DESCRIPTION
;
; Returns the language id of the current bank. This id will match
; the lanugage id in the header file generated by Locomoto
;
; SEE ALSO
;
; LOCALE_loadtable
;
; EXAMPLE
;
; locale_eg.c
;
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
;
;
; END ABSTRACT
;
*/
int LOCALE_getbanklanguageid(void)
{
ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
ASSERT(lx->pBank[lx->BankIndex]); /* must load a table into bank before calling this function */
return (int)(lx->pBank[lx->BankIndex]->LanguageID);
}
/*
;
; ABSTRACT
;
; LOCALE_getbankstringcount - Get the string count for the current bank
;
;
; SUMMARY
;
; #include "realfont.h"
;
; int LOCALE_getbankstringcount(void)
;
; DESCRIPTION
;
; Returns the number of strings in the current bank. If zero is
; returned then this bank is empty.
;
; SEE ALSO
;
; LOCALE_loadtable
;
; EXAMPLE
;
; locale_eg.c
;
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
;
;
; END ABSTRACT
;
*/
int LOCALE_getbankstringcount(void)
{
int StringCount = 0;
ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
if (lx->pBank[lx->BankIndex]) {
StringCount = lx->pBank[lx->BankIndex]->StringCount;
}
return StringCount;
}
/*************************************************************************/
/* operations */
/*************************************************************************/
/*
;
; ABSTRACT
;
; LOCALE_loadtable - Load a string table into the current bank
;
;
; SUMMARY
;
; #include "realfont.h"
;
; int LOCALE_loadtable(pathname, languageid)
;
; const char* pathname; // pathname of .loc file to load
; int languageid; // language id to load (from .h file)
;
; DESCRIPTION
;
; Loads the specified language from the string file into the
; current bank. Returns non zero if the operation was succesful.
; The bank must be free before you can call LOCALE_loadtable. To
; free a bank use the LOCALE_freetable function. To determine
; if the bank is free use the LOCALE_getbankstringcount function.
;
; The languageid value is available in the .h file created by
; locomoto.
;
; Returns non-zero if everthing is ok.
;
; SEE ALSO
;
; LOCALE_freetable, LOCALE_getbankstringcount
;
; EXAMPLE
;
; locale_eg.c
;
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
;
;
; END ABSTRACT
;
*/
static int readheader( GSTREAM* g )
{
int ok = 0;
/* read file header */
LOCALEFILE_HEADERCHUNK header;
int HeaderChunkSize = sizeof(LOCALEFILE_HEADERCHUNK);
// VERIFY(gread(g, &header, HeaderChunkSize) == HeaderChunkSize);
if( gread(g, &header, HeaderChunkSize) != HeaderChunkSize ) {
return ok;
}
Msg( __LINE__, __FILE__, "readheader - HeaderChunkSize = %d.", HeaderChunkSize );
Msg( __LINE__, __FILE__, "readheader - header.LanguageCount = %d.", header.LanguageCount );
Msg( __LINE__, __FILE__, "readheader - header.Flags = %d.", header.Flags );
ASSERT( header.ChunkID == LOCALEFILE_HEADERCHUNKID ); /* ensure that this is a valid .loc file */
/* read index chunk if present */
if ( header.Flags == 1 ) {
int IndexChunkSize;
int IndexChunkPos = header.ChunkSize;
/* read index chunk size */
// VERIFY(gseek(g, IndexChunkPos + 4));
if( !gseek( g, IndexChunkPos + 4)) {
return ok;
}
Msg( __LINE__, __FILE__, "readheader - seek to = %d.", IndexChunkPos + 4 );
// VERIFY(gread(g, &IndexChunkSize, 4) == 4);
if( gread( g, &IndexChunkSize, 4) != 4 ) {
return ok;
}
Msg( __LINE__, __FILE__, "readheader - IndexChunkSize = %d.", IndexChunkSize );
/* alloc and read index chunk */
lx->pIndex[lx->BankIndex] = (LOCALEFILE_INDEXCHUNK *)galloc((long)IndexChunkSize );
if (lx->pIndex[lx->BankIndex]) {
// VERIFY(gseek(g, IndexChunkPos));
gseek( g, IndexChunkPos );
Msg( __LINE__, __FILE__, "readheader - seek to = %d.", IndexChunkPos );
// VERIFY(gread(g, lx->pIndex[lx->BankIndex], IndexChunkSize) == IndexChunkSize);
if ( gread(g, lx->pIndex[lx->BankIndex], IndexChunkSize ) != IndexChunkSize ) {
return ok;
}
Msg( __LINE__, __FILE__, "readheader - IndexChunkSize = %d.", IndexChunkSize );
ASSERT( lx->pIndex[lx->BankIndex]->ChunkID == LOCALEFILE_INDEXCHUNKID );
ok = 1;
}
}
Msg( __LINE__, __FILE__, "readheader - exiting." );
return ok;
}
static int readstrings( GSTREAM* g, int LanguageID )
{
Msg( __LINE__, __FILE__, "readstrings:: g ok? %d.", ((g!= NULL)?1:0));
int ok = 0;
int LanguageChunkOffsetPos = 16 + LanguageID*4;
int LanguageChunkPos = 0;
int LanguageChunkSize = -1;
/* read offset to language chunk */
// VERIFY(gseek(g, (int)LanguageChunkOffsetPos));
// VERIFY(gread(g, &LanguageChunkPos, 4) == 4);
if( !gseek( g, (int)LanguageChunkOffsetPos )) {
return ok;
}
if( gread( g, &LanguageChunkPos, 4 ) != 4 ) {
return ok;
}
/* read language chunk size */
// VERIFY(gseek(g, LanguageChunkPos + 4));
// VERIFY(gread(g, &LanguageChunkSize, 4) == 4);
if( !gseek( g, LanguageChunkPos + 4 )) {
return ok;
}
if( gread( g, &LanguageChunkSize, 4 ) != 4 ) {
return ok;
}
Msg( __LINE__, __FILE__, "readstrings::LanguageChunkOffsetPos = %d.", LanguageChunkOffsetPos );
Msg( __LINE__, __FILE__, "readstrings::LanguageChunkPos = %d.", LanguageChunkPos );
Msg( __LINE__, __FILE__, "readstrings::LanguageChunkSize = %d.", LanguageChunkSize );
/* alloc and read language chunk */
lx->pBank[lx->BankIndex] = (LOCALEFILE_LANGUAGECHUNK *)galloc((long)LanguageChunkSize);
if (lx->pBank[lx->BankIndex]) {
Msg( __LINE__, __FILE__, "readstrings:: A." );
// VERIFY(gseek(g, LanguageChunkPos));
// VERIFY(gread(g, lx->pBank[lx->BankIndex], LanguageChunkSize) == LanguageChunkSize);
if( !gseek( g, LanguageChunkPos )) {
return ok;
}
if( gread( g, lx->pBank[lx->BankIndex], LanguageChunkSize ) != LanguageChunkSize ) {
return ok;
}
ASSERT(lx->pBank[lx->BankIndex]->ChunkID == LOCALEFILE_LANGUAGECHUNKID);
ok = 1;
}
return ok;
}
int LOCALE_loadtable(const char* PathName, int LanguageID)
{
int ok = 0;
GSTREAM* g;
ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
ASSERT(lx->pBank[lx->BankIndex] == NULL); /* bank must be empty before loading a new table */
ASSERT(lx->pIndex[lx->BankIndex] == NULL); /* bank must be empty before loading a new table */
g = gopen( PathName );
if( g != NULL ) {
Msg( __LINE__, __FILE__, "LOCALE_loadtable-- file opened." );
if( readheader(g)) {
Msg( __LINE__, __FILE__, "LOCALE_loadtable-- readstrings." );
ok = readstrings( g, LanguageID );
Msg( __LINE__, __FILE__, "LOCALE_loadtable-- ok = %d ).", ok );
}
gclose(g);
}
return ok;
}
/*
;
; ABSTRACT
;
; LOCALE_purgetable - OBSOLETE
;
; Make all references to LOCALE_freetable
;
; END ABSTRACT
;
*/
/*
;
; ABSTRACT
;
; LOCALE_freetable - Free the string table in the current bank
;
;
; SUMMARY
;
; #include "realfont.h"
;
; void LOCALE_freetable(void)
;
; DESCRIPTION
;
; Frees the table loaded in the current bank. There must be a
; table loaded in the current bank. Use LOCALE_getbankstringcount
; to determine if the bank is free or not.
;
; SEE ALSO
;
; LOCALE_loadtable, LOCALE_getbankstringcount
;
; EXAMPLE
;
; locale_eg.c
;
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
;
;
; END ABSTRACT
;
*/
void LOCALE_freetable(void)
{
if( lx != NULL ) {
ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
ASSERT(lx->pBank[lx->BankIndex]); /* table must be loaded before calling this function */
/* free string bank */
gfree(lx->pBank[lx->BankIndex]);
lx->pBank[lx->BankIndex] = NULL;
/* if the bank has an index loaded, free that as well */
if (lx->pIndex[lx->BankIndex]) {
gfree(lx->pIndex[lx->BankIndex]);
lx->pIndex[lx->BankIndex] = NULL;
}
}
}
/*
;
; ABSTRACT
;
; LOCALE_getstring - Return the specified string from the current bank
;
; SUMMARY
;
; #include "realfont.h"
;
; const char* LOCALE_getstring( StringID )
; int StringID; ID of string to return
;
; DESCRIPTION
;
; Returns the string specified from the current bank. There must
; be a string table loaded into the current bank. Use the String
; ID specified in the header file created by Locomoto. Note that
; the string pointer is a const pointer. Do not modify the string
; or the Locale library may return invalid results.
;
; If the .loc file was created with an index StringID can be any
; valid integer in the range 0..65535. If no index was created
; with the .loc file StringID will be a zero based array index.
;
; String is returned by const for a reason. Bad things will happen
; if you modify it. You have been warned.
;
; SEE ALSO
;
; LOCALE_loadtable, LOCALE_getbankstringcount
;
; EXAMPLE
;
; locale_eg.c
;
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
;
;
; END ABSTRACT
;
*/
#include <stdlib.h> // for bsearch function
static int compare ( const void* arg1, const void* arg2 )
{
const unsigned short* s1 = (const unsigned short*)(arg1);
const unsigned short* s2 = (const unsigned short*)(arg2);
return (*s1) - (*s2);
}
static int getstringbyindex( unsigned short key, const INDEX* pIndex )
{
int index = 0;
unsigned short* result;
unsigned char* base; /* pointer to base of string id table */
ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
ASSERT(pIndex != NULL); /* index not loaded - .loc file must have index created (use -i option) */
base = ((unsigned char*)pIndex) + LOCALEFILE_INDEXCHUNK_STRINGID_OFFSET;
result = (unsigned short*)bsearch((unsigned char *)&key, base, pIndex->StringCount, 4, compare);
if (result != NULL) {
/* index is the second unsigned short */
++result;
index = *result;
} else {
index = -1;
}
return index;
}
const char* LOCALE_getstring( int StringID )
{
const char* p; /* pointer to string, NULL if string cannot be found */
Msg( __LINE__, __FILE__, "Locale_getstring::( %d ).", StringID );
ASSERT( LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
/* get string array index from the index if it exists */
if ( lx->pIndex[ lx->BankIndex ] != NULL ) {
StringID = getstringbyindex((unsigned short)StringID, lx->pIndex[lx->BankIndex]);
}
Msg( __LINE__, __FILE__, "Locale_getstring::( %d ).", StringID );
Msg( __LINE__, __FILE__, "Locale_getstring::( lx->BankIndex = %d ).", lx->BankIndex );
Msg( __LINE__, __FILE__, "Locale_getstring::( lx->pBank[lx->BankIndex]->StringCount = %d ).", lx->pBank[lx->BankIndex]->StringCount );
if ((StringID >= 0) && (StringID < (int)(lx->pBank[lx->BankIndex]->StringCount ))) {
Msg( __LINE__, __FILE__, "Locale_getstring:: A" );
unsigned int offset;
p = (const char*)(lx->pBank[lx->BankIndex]);
Msg( __LINE__, __FILE__, "Locale_getstring:: B" );
offset = *(unsigned int*)(p + LOCALEFILE_LANGUAGECHUNK_STRING_OFFSET + StringID*4);
Msg( __LINE__, __FILE__, "Locale_getstring:: C" );
p += offset;
Msg( __LINE__, __FILE__, "Locale_getstring:: D" );
} else {
p = NULL;
}
Msg( __LINE__, __FILE__, L"%s", 1252, (wchar_t *)p );
return p;
}
/*
;
; ABSTRACT
;
; LOCALE_getstr - return selected string from the specified .loc file
;
;
; SUMMARY
;
; #include "realfont.h"
;
; const char* LOCALE_getstr(stringid)
;
; int stringid; // string id to return
;
; DESCRIPTION
;
; Returns the string identified by stringid from the specified
; .loc file. Use the string ID specified in the header file created
; by Locomoto. Note that the string pointer is a const pointer. Do
; not modify the string or the Locale library may return invalid results.
;
; If your strings are Unicode strings, cast the result to a const USTR *.
;
; If the .loc file was created with an index stringid can be any
; valid integer in the range 0..65535. If no index was created
; with the .loc file stringid will be a zero based array index.
;
; String is returned by const for a reason. Bad things will happen
; if you modify it. You have been warned.
;
; SEE ALSO
;
; EXAMPLE
;
; locale_eg.c
;
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
;
; END ABSTRACT
;
*/
int LOCALElanguageid = 0;
const char* LOCALE_getstr( const void* pLocFile, int StringID )
{
const char* p; /* pointer to string, NULL if string cannot be found */
HEADER* pHeader;
BANK* pBank;
ASSERT(pLocFile != NULL);
pHeader = (LOCALEFILE_HEADERCHUNK*)(pLocFile);
ASSERT(pHeader->ChunkID == LOCALEFILE_HEADERCHUNKID);
ASSERT(pHeader->LanguageCount >= 1);
if( pHeader->Flags == 1 ) {
/* file has an index */
INDEX* pIndex = (INDEX*)((unsigned char*)(pLocFile) + pHeader->ChunkSize);
StringID = getstringbyindex((unsigned short)StringID, pIndex);
}
/* get pointer to string bank */
{
int offset = *((int*)(pLocFile) + 4 + LOCALElanguageid);
pBank = (BANK*)((unsigned char*)(pLocFile) + offset);
}
if ((StringID >= 0) && (StringID < (int)(pBank->StringCount))) {
unsigned int offset;
p = (const char*)(pBank);
offset = *(unsigned int*)(p + LOCALEFILE_LANGUAGECHUNK_STRING_OFFSET + StringID*4);
p += offset;
} else {
p = NULL;
}
return p;
}

View file

@ -0,0 +1,72 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
/* Copyright (C) Electronic Arts Canada Inc. 1998-1999. All rights reserved. */
/* ABSTRACT
locale.h - REAL fonts
@ */
#ifndef __LOCALE_H
#define __LOCALE_H 1
//#ifdef __cplusplus
//extern "C" {
//#endif
/****************************************************************************/
/* LOCALE API */
/****************************************************************************/
const char * LOCALE_getstr( const void *localefile, int stringid );
/* NOTE: this single function replaces the previous LOCALE API */
/****************************************************************************/
/* OBSOLETE LOCALE API */
/****************************************************************************/
/* This API is being retired in favor of the much simplier single LOCALE_getstr function. */
#define LOCALE_BANK_COUNT 8
/* initialization/restore */
int LOCALE_init( void ); /* call before calling any other LOCALE functions */
void LOCALE_restore( void ); /* free all memory/resources allocated by LOCALE */
/* attributes */
void LOCALE_setbank( int bankindex ); /* bankindex >= 0 && bankindex < LOCALE_BANK_COUNT */
int LOCALE_getbank( void ); /* returns current bank id */
int LOCALE_getbanklanguageid( void ); /* returns language id of the current bank */
int LOCALE_getbankstringcount( void ); /* returns the string string count in the current bank */
/* operations */
int LOCALE_loadtable( const char *pathname, int languageid ); /* load table into the current bank */
void LOCALE_freetable( void ); /* free table in the current bank */
const char * LOCALE_getstring( int stringid ); /* use values in the .h file created by locomoto */
/* maintain backwards compatibility */
#define LOCALE_purgetable LOCALE_freetable
//#ifdef __cplusplus
//}
//#endif
#endif /* __LOCALE_H */
/* END ABSTRACT */

View file

@ -0,0 +1,50 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by AUTORUN.RC
//
#define IDD_OK 100
#define IDD_OK2 101
#define IDD_REGISTER 102
#define IDD_EXPLORE 103
#define IDD_CANCEL 104
#define IDD_INTERNET 105
#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 IDS_VERSION_STRING 120
#define IDS_CANT_FIND_FILE 121
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 117
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

Binary file not shown.

View file

@ -0,0 +1,233 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// Babylon.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "Babylon.h"
#include "BabylonDlg.h"
#include "xlstuff.h"
#include <direct.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
char AppTitle[200];
CBabylonDlg *MainDLG = NULL;
static char *AppName = "Babylon:";
static int AlreadyRunning( void );
static HWND FoundWindow = NULL;
/////////////////////////////////////////////////////////////////////////////
// CBabylonApp
BEGIN_MESSAGE_MAP(CBabylonApp, CWinApp)
//{{AFX_MSG_MAP(CBabylonApp)
//}}AFX_MSG_MAP
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBabylonApp construction
CBabylonApp::CBabylonApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CBabylonApp object
CBabylonApp theApp;
TransDB *BabylonstrDB = NULL;
TransDB *MainDB = NULL;
char BabylonstrFilename[_MAX_PATH];
char MainXLSFilename[_MAX_PATH];
char DialogPath[_MAX_PATH];
char RootPath[_MAX_PATH];
LangID CurrentLanguage = LANGID_US;
/////////////////////////////////////////////////////////////////////////////
// CBabylonApp initialization
BOOL CBabylonApp::InitInstance()
{
// Initialize OLE libraries
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Parse the command line to see if launched as OLE server
if (RunEmbedded() || RunAutomated())
{
// Register all OLE server (factories) as running. This enables the
// OLE libraries to create objects from other applications.
COleTemplateServer::RegisterAll();
}
else
{
// When a server application is launched stand-alone, it is a good idea
// to update the system registry in case it has been damaged.
COleObjectFactory::UpdateRegistryAll();
}
MainDB = new TransDB ( "Main" );
BabylonstrDB = new TransDB ( "Generals.str" );
MainDB->EnableIDs ();
if ( !AfxInitRichEdit( ) )
{
AfxMessageBox ( "Error initializing Rich Edit" );
}
sprintf (AppTitle, "%s Built on %s - %s", AppName, __DATE__, __TIME__ );
if ( !_getcwd( RootPath, _MAX_PATH ) )
{
AfxMessageBox ( "Failed to obtain current working directoy!\n\n Set directoy path to \"c:\\Babylon\"." );
strcpy ( (char *) RootPath, "c:\\Babylon" );
}
strlwr ( RootPath );
strcpy ( (char *) BabylonstrFilename, RootPath );
strcat ( (char *) BabylonstrFilename, "\\Data\\Generals.str" );
strcpy ( (char *) MainXLSFilename, RootPath );
strcat ( (char *) MainXLSFilename, "\\Data\\main.db" );
strcpy ( (char *) DialogPath, RootPath );
strcat ( (char *) DialogPath, "\\dialog" );
if ( AlreadyRunning () )
{
if ( FoundWindow )
{
SetForegroundWindow ( FoundWindow );
}
}
else if ( OpenExcel ( ) )
{
CBabylonDlg dlg;
m_pMainWnd = &dlg;
MainDLG = &dlg;
int nResponse = dlg.DoModal();
CloseExcel ();
}
delete BabylonstrDB ;
delete MainDB;
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
//DEL void CBabylonApp::OnDropFiles(HDROP hDropInfo)
//DEL {
//DEL // TODO: Add your message handler code here and/or call default
//DEL
//DEL CWinApp::OnDropFiles(hDropInfo);
//DEL }
static BOOL CALLBACK EnumAllWindowsProc(HWND hWnd, LPARAM lParam);
static BOOL CALLBACK EnumAllWindowsProcExact(HWND hWnd, LPARAM lParam);
static char *szSearchTitle;
static int AlreadyRunning( void )
{
BOOL found = FALSE;
szSearchTitle = AppName;
EnumWindows((WNDENUMPROC) EnumAllWindowsProcExact, (LPARAM) &found);
return found;
}
//--------------------------------------------------------------------------------
int ExcelRunning( void )
{
BOOL found = FALSE;
szSearchTitle = "Microsoft Excel";
EnumWindows((WNDENUMPROC) EnumAllWindowsProc, (LPARAM) &found);
return found;
}
//--------------------------------------------------------------------------------
BOOL CALLBACK EnumAllWindowsProc(HWND hWnd, LPARAM lParam)
{
char szText[256];
GetWindowText(hWnd, szText, sizeof(szText));
if ( strstr(szText, szSearchTitle))
{
* (BOOL *) lParam = TRUE;
FoundWindow = hWnd;
return FALSE;
}
FoundWindow = NULL;
return TRUE;
}
//--------------------------------------------------------------------------------
BOOL CALLBACK EnumAllWindowsProcExact(HWND hWnd, LPARAM lParam)
{
char szText[256];
GetWindowText(hWnd, szText, sizeof(szText));
if ( !strncmp (szText, szSearchTitle, strlen ( szSearchTitle)))
{
* (BOOL *) lParam = TRUE;
FoundWindow = hWnd;
return FALSE;
}
FoundWindow = NULL;
return TRUE;
}

View file

@ -0,0 +1,370 @@
# Microsoft Developer Studio Project File - Name="Babylon" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=Babylon - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Babylon.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Babylon.mak" CFG="Babylon - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Babylon - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "Babylon - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/Nox/tools/Babylon", HYXCBAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Babylon - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 /nologo /subsystem:windows /machine:I386 /out:"..\..\..\run\babylon.exe"
# SUBTRACT LINK32 /debug
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Delete title
PostBuild_Cmds=del release\Babylon.obj
# End Special Build Tool
!ELSEIF "$(CFG)" == "Babylon - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386
!ENDIF
# Begin Target
# Name "Babylon - Win32 Release"
# Name "Babylon - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\Babylon.cpp
# End Source File
# Begin Source File
SOURCE=.\Babylon.odl
# End Source File
# Begin Source File
SOURCE=.\Babylon.rc
# End Source File
# Begin Source File
SOURCE=.\BabylonDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\bin.cpp
# End Source File
# Begin Source File
SOURCE=.\DlgProxy.cpp
# End Source File
# Begin Source File
SOURCE=.\excel8.cpp
# End Source File
# Begin Source File
SOURCE=.\expimp.cpp
# End Source File
# Begin Source File
SOURCE=.\ExportDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\fileops.cpp
# End Source File
# Begin Source File
SOURCE=.\GenerateDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\iff.cpp
# End Source File
# Begin Source File
SOURCE=.\list.cpp
# End Source File
# Begin Source File
SOURCE=.\loadsave.cpp
# End Source File
# Begin Source File
SOURCE=.\MatchDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\olestring.cpp
# End Source File
# Begin Source File
SOURCE=.\ProceedDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\Report.cpp
# End Source File
# Begin Source File
SOURCE=.\RetranslateDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# Begin Source File
SOURCE=.\transcs.cpp
# End Source File
# Begin Source File
SOURCE=.\TransDB.cpp
# End Source File
# Begin Source File
SOURCE=.\VerifyDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\VerifyTextDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\ViewDBsDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\XLStuff.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\Babylon.h
# End Source File
# Begin Source File
SOURCE=.\BabylonDlg.h
# End Source File
# Begin Source File
SOURCE=.\bin.h
# End Source File
# Begin Source File
SOURCE=.\DlgProxy.h
# End Source File
# Begin Source File
SOURCE=.\excel8.h
# End Source File
# Begin Source File
SOURCE=.\expimp.h
# End Source File
# Begin Source File
SOURCE=.\ExportDlg.h
# End Source File
# Begin Source File
SOURCE=.\fileops.h
# End Source File
# Begin Source File
SOURCE=.\GenerateDlg.h
# End Source File
# Begin Source File
SOURCE=.\iff.h
# End Source File
# Begin Source File
SOURCE=.\list.h
# End Source File
# Begin Source File
SOURCE=.\loadsave.h
# End Source File
# Begin Source File
SOURCE=.\MatchDlg.h
# End Source File
# Begin Source File
SOURCE=.\olestring.h
# End Source File
# Begin Source File
SOURCE=.\ProceedDlg.h
# End Source File
# Begin Source File
SOURCE=.\Report.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\RetranslateDlg.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# Begin Source File
SOURCE=.\transcs.h
# End Source File
# Begin Source File
SOURCE=.\TransDB.h
# End Source File
# Begin Source File
SOURCE=.\VerifyDlg.h
# End Source File
# Begin Source File
SOURCE=.\VerifyTextDlg.h
# End Source File
# Begin Source File
SOURCE=.\VIEWDBSII.h
# End Source File
# Begin Source File
SOURCE=.\XLStuff.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\Babylon.ico
# End Source File
# Begin Source File
SOURCE=.\res\Babylon.rc2
# End Source File
# Begin Source File
SOURCE=.\BABYLON.XLT
# End Source File
# Begin Source File
SOURCE=.\res\bitmap1.bmp
# End Source File
# Begin Source File
SOURCE=.\P2XDLL.DLL
# End Source File
# Begin Source File
SOURCE=.\res\pause.bmp
# End Source File
# Begin Source File
SOURCE=.\res\paused.bmp
# End Source File
# Begin Source File
SOURCE=.\PERLCRT.DLL
# End Source File
# Begin Source File
SOURCE=.\res\playd.bmp
# End Source File
# Begin Source File
SOURCE=.\res\playu.bmp
# End Source File
# Begin Source File
SOURCE=.\res\stop.bmp
# End Source File
# Begin Source File
SOURCE=.\STRCHECK.EXE
# End Source File
# End Group
# Begin Source File
SOURCE=.\Babylon.reg
# End Source File
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project

View file

@ -0,0 +1,37 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Babylon"=.\Babylon.dsp - Package Owner=<4>
Package=<5>
{{{
begin source code control
Babylon
.
end source code control
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
begin source code control
Babylon
.
end source code control
}}}
Package=<3>
{{{
}}}
###############################################################################

View file

@ -0,0 +1,74 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// Babylon.h : main header file for the BABYLON application
//
#if !defined(AFX_BABYLON_H__2BF3124B_3BA1_11D3_B9DA_006097B90D93__INCLUDED_)
#define AFX_BABYLON_H__2BF3124B_3BA1_11D3_B9DA_006097B90D93__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
#include "transdb.h"
/////////////////////////////////////////////////////////////////////////////
// CBabylonApp:
// See Babylon.cpp for the implementation of this class
//
class CBabylonApp : public CWinApp
{
public:
CBabylonApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBabylonApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CBabylonApp)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
int ExcelRunning( void );
extern TransDB *BabylonstrDB;
extern TransDB *MainDB;
extern char BabylonstrFilename[];
extern char MainXLSFilename[];
extern char RootPath[];
extern char DialogPath[];
extern LangID CurrentLanguage;
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_BABYLON_H__2BF3124B_3BA1_11D3_B9DA_006097B90D93__INCLUDED_)

View file

@ -0,0 +1,42 @@
// Babylon.odl : type library source for Babylon.exe
// This file will be processed by the MIDL compiler to produce the
// type library (Babylon.tlb).
[ uuid(2BF31247-3BA1-11D3-B9DA-006097B90D93), version(1.0) ]
library Babylon
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
// Primary dispatch interface for CBabylonDoc
[ uuid(2BF31248-3BA1-11D3-B9DA-006097B90D93) ]
dispinterface IBabylon
{
properties:
// NOTE - ClassWizard will maintain property information here.
// Use extreme caution when editing this section.
//{{AFX_ODL_PROP(CBabylonDlgAutoProxy)
//}}AFX_ODL_PROP
methods:
// NOTE - ClassWizard will maintain method information here.
// Use extreme caution when editing this section.
//{{AFX_ODL_METHOD(CBabylonDlgAutoProxy)
//}}AFX_ODL_METHOD
};
// Class information for CBabylonDoc
[ uuid(2BF31246-3BA1-11D3-B9DA-006097B90D93) ]
coclass Babylon
{
[default] dispinterface IBabylon;
};
//{{AFX_APPEND_ODL}}
//}}AFX_APPEND_ODL}}
};

View file

@ -0,0 +1,566 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
// Generated Help ID header file
#define APSTUDIO_HIDDEN_SYMBOLS
#include "resource.hm"
#undef APSTUDIO_HIDDEN_SYMBOLS
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\Babylon.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\Babylon.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About Babylon"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
LTEXT "Babylon Version 1.0",IDC_STATIC,40,10,76,8,SS_NOPREFIX
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP,WS_EX_STATICEDGE
LTEXT "Static",IDC_BUILD,7,37,221,11
ICON IDR_MAINFRAME,IDM_PIC,13,13,20,20
PUSHBUTTON "CP",IDC_BUTTON1,119,7,50,14,0,WS_EX_STATICEDGE
END
IDD_BABYLON_DIALOG DIALOGEX 0, 0, 320, 257
STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_MINIMIZEBOX | WS_POPUP |
WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES | WS_EX_APPWINDOW
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "Ready",IDC_STATUS,"Static",SS_LEFTNOWORDWRAP |
SS_SUNKEN | WS_GROUP,13,186,291,11,0,HIDC_STATUS
CONTROL "Progress1",IDC_PROGRESS1,"msctls_progress32",PBS_SMOOTH |
WS_BORDER,13,174,263,9,0,HIDC_PROGRESS1
GROUPBOX "",IDC_STATIC,7,7,306,243
PUSHBUTTON "&Reload",IDC_RELOAD,19,24,48,15
CONTROL "",IDC_LOG,"RICHEDIT",ES_MULTILINE | ES_AUTOVSCROLL |
ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | ES_NUMBER |
WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,13,75,291,95,
WS_EX_STATICEDGE
PUSHBUTTON "&DBs",IDC_VIEWDBS,19,54,26,15
GROUPBOX "DataBase",IDC_STATIC,14,15,169,27
PUSHBUTTON "&Update",IDC_UPDATE,74,24,48,15
PUSHBUTTON "&Save",IDC_SAVE,129,24,48,15
GROUPBOX "View",IDC_STATIC,13,45,88,27
PUSHBUTTON "E&xport",IDC_EXPORT,196,24,48,15
PUSHBUTTON "&Import",IDC_IMPORT,251,24,48,15
PUSHBUTTON "&Generate New Game Files",IDC_GENERATE,13,228,291,17,0,
WS_EX_STATICEDGE
PUSHBUTTON "&Warnings",IDC_WARNINGS,221,54,41,15
PUSHBUTTON "&Changes",IDC_CHANGES,50,54,43,15
PUSHBUTTON "&Errors",IDC_ERRORS,267,54,32,15
GROUPBOX "Translations",IDC_STATIC,189,15,115,27
RTEXT "100% ",IDC_PERCENT,280,174,24,9,SS_CENTERIMAGE |
SS_SUNKEN
GROUPBOX "Generals.Str",IDC_STATIC,215,45,89,27
PUSHBUTTON "Dialo&g",IDC_DIALOG,212,208,40,15
PUSHBUTTON "Report",IDC_REPORTS,145,54,49,15
GROUPBOX "Verify",IDC_STATIC,13,198,291,28
COMBOBOX IDC_COMBOLANG,75,209,125,88,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Text",IDC_TRANSLATIONS,259,208,40,15
GROUPBOX "Create",IDC_STATIC,137,45,65,27
PUSHBUTTON "Reset",IDC_RESET,18,208,44,15,0,WS_EX_CLIENTEDGE
PUSHBUTTON "Sent",IDC_SENT,105,52,24,15
END
IDD_VIEWDBS DIALOG DISCARDABLE 0, 0, 361, 173
STYLE DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "View Internal Databases"
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "",IDC_STATIC,7,7,347,159
CONTROL "Tree1",IDC_TREEVIEW,"SysTreeView32",TVS_HASBUTTONS |
TVS_HASLINES | TVS_LINESATROOT | WS_BORDER | WS_TABSTOP,
13,16,334,143
END
IDD_EXPORT DIALOGEX 0, 0, 277, 117
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Export Translations"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
PUSHBUTTON "&Export",IDOK,170,56,94,20,0,WS_EX_STATICEDGE
DEFPUSHBUTTON "&Cancel",IDCANCEL,170,83,94,14,0,WS_EX_STATICEDGE
COMBOBOX IDC_COMBOLANG,175,18,89,92,CBS_DROPDOWN | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
GROUPBOX "",IDC_STATIC,7,7,263,103
GROUPBOX "Include",IDC_STATIC,14,14,123,22
CONTROL "Translations",IDC_CHECKTRANS,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,22,23,84,13
CONTROL "&All strings",IDC_RADIOALL,"Button",BS_AUTORADIOBUTTON,
24,66,45,10
CONTROL "C&hanges only",IDC_RADIOCHANGES,"Button",
BS_AUTORADIOBUTTON,24,54,59,10
GROUPBOX "Export",IDC_STATIC,14,42,124,62
EDITTEXT IDC_FILENAME,184,35,80,13,ES_AUTOHSCROLL
LTEXT "Filename:",IDC_STATIC,150,37,31,8
LTEXT "Language:",IDC_STATIC,140,20,35,8
CONTROL "&Sample",IDC_RADIOSAMPLE,"Button",BS_AUTORADIOBUTTON,85,
78,39,10
CONTROL "&Dialog only",IDC_RADIODIALOG,"Button",
BS_AUTORADIOBUTTON,85,66,51,10
CONTROL "&Non dialog",IDC_RADIONONDIALOG,"Button",
BS_AUTORADIOBUTTON,85,54,50,10
CONTROL "&Unverified dialog",IDC_RADIOUNVERIFIED,"Button",
BS_AUTORADIOBUTTON,24,90,67,10
CONTROL "&Missing dialog",IDC_RADIOMISSING,"Button",
BS_AUTORADIOBUTTON,24,78,58,10
CONTROL "Unsen&t",IDC_RADIOUNSENT,"Button",BS_AUTORADIOBUTTON,93,
90,39,10
END
IDD_GENERATE DIALOGEX 0, 0, 249, 185
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Generate Game Files"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "Generate Files",IDOK,139,124,97,25,0,WS_EX_STATICEDGE
DEFPUSHBUTTON "Cancel",IDCANCEL,139,154,97,14,0,WS_EX_STATICEDGE
GROUPBOX "",IDC_STATIC,7,7,235,171
PUSHBUTTON "&Invert",IDC_INVERT,19,149,47,13,0,WS_EX_STATICEDGE
PUSHBUTTON "Select &All",IDC_SELECTALL,78,149,43,13,0,
WS_EX_STATICEDGE
CONTROL "CSF Format",IDC_UNICODE,"Button",BS_AUTORADIOBUTTON |
WS_GROUP,145,25,53,10
CONTROL """.str"" Format",IDC_BABYLONSTR,"Button",BS_AUTORADIOBUTTON |
WS_GROUP,145,36,55,10
GROUPBOX "Languages",IDC_STATIC,13,14,118,153
EDITTEXT IDC_PREFIX,170,49,52,12,ES_AUTOHSCROLL
GROUPBOX "File Options",IDC_STATIC,139,14,97,67
LTEXT "Prefix:",IDC_STATIC,146,52,20,8
CONTROL "Static",IDC_FILENAME,"Static",SS_LEFTNOWORDWRAP |
SS_SUNKEN | WS_GROUP,145,65,85,11
LISTBOX IDC_LANGUAGE,19,25,102,117,LBS_SORT | LBS_MULTIPLESEL |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
CONTROL "Show string IDs",IDC_IDS,"Button",BS_AUTORADIOBUTTON |
WS_GROUP,145,95,88,10
CONTROL "Show orignal text",IDC_ORIGINAL,"Button",
BS_AUTORADIOBUTTON | WS_GROUP,145,105,70,10
GROUPBOX "For missing translations",IDC_STATIC,139,85,97,34
END
IDD_SETTINGS DIALOGEX 0, 0, 270, 157
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Settings"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,194,126,50,14
PUSHBUTTON "Cancel",IDCANCEL,17,127,50,14
GROUPBOX "",IDC_STATIC,7,7,256,143
EDITTEXT IDC_EDIT1,97,25,90,12,ES_AUTOHSCROLL
LTEXT "Static",IDC_STATIC,27,26,59,8
PUSHBUTTON "File...",IDC_BUTTON1,191,25,50,14,0,WS_EX_STATICEDGE
END
IDD_MATCHDIALOG DIALOGEX 0, 0, 340, 213
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "Verify Dialog"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
PUSHBUTTON "Matches",IDOK,196,176,131,24,0,WS_EX_STATICEDGE
DEFPUSHBUTTON "Stop Verifying",IDCANCEL,13,175,56,25,0,
WS_EX_STATICEDGE
GROUPBOX "",IDC_WAVENAME,7,7,326,199
GROUPBOX "Text",IDC_TEXT_TITLE,14,19,313,137
LTEXT "",IDC_TEXT,19,30,302,121,SS_SUNKEN
CONTROL "Slider1",IDC_SLIDER,"msctls_trackbar32",TBS_BOTH |
TBS_NOTICKS | WS_TABSTOP,14,161,266,11,WS_EX_STATICEDGE
CONTROL "IDB_STOP",IDC_STOP,"Button",BS_OWNERDRAW | BS_BITMAP |
WS_TABSTOP,284,162,11,8
CONTROL "IDB_PAUSE",IDC_PAUSE,"Button",BS_OWNERDRAW | BS_BITMAP |
WS_TABSTOP,300,162,11,8
CONTROL "IDB_PLAY",IDC_PLAY,"Button",BS_OWNERDRAW | BS_BITMAP |
WS_TABSTOP,316,162,11,8
PUSHBUTTON "Does not match",IDC_NOMATCH,81,182,68,18,0,
WS_EX_STATICEDGE
END
IDD_PROCEED DIALOG DISCARDABLE 0, 0, 250, 118
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "Proceed?"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "&Yes",IDC_YES,26,90,50,14
LTEXT "",IDC_MESSAGE,15,18,220,66
PUSHBUTTON "Yes &Always",IDC_ALWAYS,98,90,50,14
PUSHBUTTON "&No",IDC_BUTTON_NO,170,90,50,14
END
IDD_MATCH DIALOGEX 0, 0, 423, 183
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "Retranslate changed text?"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "Skip &All",IDCANCEL,13,142,53,28,0,WS_EX_STATICEDGE
GROUPBOX "",IDC_STATIC,7,7,409,169
GROUPBOX "Unmatched Text",IDC_STATIC,13,19,193,118
GROUPBOX "Current Match",IDC_STATIC,211,19,193,151
PUSHBUTTON "&No Match",IDC_NOMATCH,69,142,53,14,0,WS_EX_STATICEDGE
COMBOBOX IDC_MATCHCOMBO,222,152,174,58,CBS_DROPDOWNLIST |
CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP,
WS_EX_STATICEDGE
PUSHBUTTON "&Match",IDC_MATCH,135,156,70,14,0,WS_EX_STATICEDGE
LTEXT "",IDC_NEWTEXT,21,33,174,95,SS_SUNKEN
LTEXT "",IDC_MATCHTEXT,223,33,174,95,SS_SUNKEN
LTEXT "Possible Matches",IDC_STATIC,223,140,159,10
CONTROL "Re-translate",IDC_CHECKRETRANSLATE,"Button",
BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,149,143,54,10
PUSHBUTTON "&Skip",IDC_SKIP,69,158,53,12,0,WS_EX_STATICEDGE
END
IDD_VERIFYTEXT DIALOGEX 0, 0, 420, 226
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "Translated text mismatch"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
GROUPBOX "",IDC_STATIC,7,7,406,212
GROUPBOX "Translated Text",IDC_STATIC,13,19,191,193
GROUPBOX "Database Text",IDC_STATIC,215,19,189,172
DEFPUSHBUTTON "&Doesn't Match",IDC_NOMATCH,21,191,70,15,0,
WS_EX_STATICEDGE
PUSHBUTTON "&Matches",IDC_MATCH,125,191,70,15,0,WS_EX_STATICEDGE
LTEXT "",IDC_TRANS,21,33,174,151,SS_SUNKEN
LTEXT "",IDC_ORIG,223,33,174,151,SS_SUNKEN
LTEXT "Do the CONTENTS of the above text match? (i.e. apart from gramatical or spelling differences, are they the same?)",
IDC_STATIC,215,194,189,18
END
IDD_CREATE_REPORTS DIALOGEX 0, 0, 249, 185
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Create Report"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
PUSHBUTTON "Create &Report",IDOK,139,124,97,25,0,WS_EX_STATICEDGE
DEFPUSHBUTTON "&Cancel",IDCANCEL,139,154,97,14,0,WS_EX_STATICEDGE
GROUPBOX "",IDC_STATIC,7,7,235,171
PUSHBUTTON "&Invert",IDC_INVERT,19,149,47,13,0,WS_EX_STATICEDGE
PUSHBUTTON "Select &All",IDC_SELECTALL,78,149,43,13,0,
WS_EX_STATICEDGE
GROUPBOX "Languages",IDC_STATIC,13,14,118,153
LISTBOX IDC_LANGUAGE,20,25,102,117,LBS_SORT | LBS_MULTIPLESEL |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Report",IDC_STATIC,139,14,97,104
CONTROL "&Translation status",IDC_TRANSLATION_STATUS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,145,26,87,10
CONTROL "&Dialog status",IDC_DIALOG_STATUS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,145,36,87,10
CONTROL "&Show details",IDC_SHOW_DETAILS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,145,46,87,10
EDITTEXT IDC_LIMIT,167,68,17,12,ES_AUTOHSCROLL | ES_WANTRETURN |
ES_NUMBER
LTEXT "items",IDC_ITEMS,187,70,17,8
CONTROL "If less than",IDC_IFLESS,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,157,57,50,10
END
IDD_CHARSET DIALOG DISCARDABLE 0, 0, 186, 95
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14
END
IDD_RETRANSLATE DIALOGEX 0, 0, 423, 183
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "Resolve Umatched Text"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "Skip &All changes",IDCANCEL,13,142,73,28,0,
WS_EX_STATICEDGE
GROUPBOX "",-1,7,7,409,169
GROUPBOX "New text",-1,13,19,193,118
GROUPBOX "Old Text",-1,211,19,193,118
PUSHBUTTON "&No need to Retranslate",IDC_NOMATCH,111,149,95,14,0,
WS_EX_STATICEDGE
PUSHBUTTON "Requires &Retranslation",IDC_MATCH,309,146,95,20,0,
WS_EX_STATICEDGE
LTEXT "",IDC_NEWTEXT,21,33,174,95,SS_SUNKEN
LTEXT "",IDC_OLDTEXT,223,33,174,95,SS_SUNKEN
PUSHBUTTON "&Skip",IDC_SKIP,231,149,53,14,0,WS_EX_STATICEDGE
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "\0"
VALUE "FileDescription", "Babylon MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "Babylon\0"
VALUE "LegalCopyright", "Copyright (C) 1999\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "Babylon.EXE\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Babylon Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 48
END
IDD_BABYLON_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 313
TOPMARGIN, 7
BOTTOMMARGIN, 250
END
IDD_VIEWDBS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 354
TOPMARGIN, 7
BOTTOMMARGIN, 166
END
IDD_EXPORT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 270
TOPMARGIN, 7
BOTTOMMARGIN, 110
END
IDD_GENERATE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 242
TOPMARGIN, 7
BOTTOMMARGIN, 178
END
IDD_SETTINGS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 263
TOPMARGIN, 7
BOTTOMMARGIN, 150
END
IDD_MATCHDIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 333
TOPMARGIN, 7
BOTTOMMARGIN, 206
END
IDD_PROCEED, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 243
TOPMARGIN, 7
BOTTOMMARGIN, 111
END
IDD_MATCH, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 416
TOPMARGIN, 7
BOTTOMMARGIN, 176
END
IDD_VERIFYTEXT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 413
TOPMARGIN, 7
BOTTOMMARGIN, 219
END
IDD_CREATE_REPORTS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 242
TOPMARGIN, 7
BOTTOMMARGIN, 178
END
IDD_CHARSET, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 88
END
IDD_RETRANSLATE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 416
TOPMARGIN, 7
BOTTOMMARGIN, 176
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_STOPU BITMAP DISCARDABLE "res\\stop.bmp"
IDB_STOPD BITMAP DISCARDABLE "res\\bitmap1.bmp"
IDB_PLAYU BITMAP DISCARDABLE "res\\playu.bmp"
IDB_PLAYD BITMAP DISCARDABLE "res\\playd.bmp"
IDB_PAUSEU BITMAP DISCARDABLE "res\\pause.bmp"
IDB_PAUSED BITMAP DISCARDABLE "res\\paused.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDP_OLE_INIT_FAILED "OLE initialization failed. Make sure that the OLE libraries are the correct version."
IDS_ABOUTBOX "&About Babylon..."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\Babylon.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View file

@ -0,0 +1,13 @@
REGEDIT
; This .REG file may be used by your SETUP program.
; If a SETUP program is not available, the entries below will be
; registered in your InitInstance automatically with a call to
; CWinApp::RegisterShellFileTypes and COleObjectFactory::UpdateRegistryAll.
HKEY_CLASSES_ROOT\Babylon.Application = Babylon Application
HKEY_CLASSES_ROOT\Babylon.Application\CLSID = {2BF31246-3BA1-11D3-B9DA-006097B90D93}
HKEY_CLASSES_ROOT\CLSID\{2BF31246-3BA1-11D3-B9DA-006097B90D93} = Babylon Application
HKEY_CLASSES_ROOT\CLSID\{2BF31246-3BA1-11D3-B9DA-006097B90D93}\ProgId = Babylon.Application
HKEY_CLASSES_ROOT\CLSID\{2BF31246-3BA1-11D3-B9DA-006097B90D93}\LocalServer32 = BABYLON.EXE

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,156 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// BabylonDlg.h : header file
//
#if !defined(AFX_BABYLONDLG_H__2BF3124D_3BA1_11D3_B9DA_006097B90D93__INCLUDED_)
#define AFX_BABYLONDLG_H__2BF3124D_3BA1_11D3_B9DA_006097B90D93__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "resource.h"
#include "transdb.h"
typedef enum
{
SAME_LINE,
NEW_LINE
} LogFormat;
typedef struct
{
int new_strings;
int deleted_strings;
int modified_strings;
int new_labels;
int deleted_labels;
int modified_labels;
int skipped_labels;
int updated_comments;
int updated_contexts;
int updated_waves;
int updated_speakers;
int updated_listeners;
int updated_maxlen;
int changes;
} UPDATEINFO;
class CBabylonDlgAutoProxy;
/////////////////////////////////////////////////////////////////////////////
// CBabylonDlg dialog
class CBabylonDlg : public CDialog
{
DECLARE_DYNAMIC(CBabylonDlg);
friend class CBabylonDlgAutoProxy;
CProgressCtrl *progress;
CStatic *percent;
int progress_pos;
int progress_range;
int max_index;
CComboBox *combo;
int operate_always;
// Construction
public:
int ValidateStrFile ( const char *filename );
int MatchText ( BabylonText *text, BabylonLabel *label, BabylonText **match );
int RetranslateText ( BabylonText *text, BabylonText *label );
void VerifyDialog( TransDB *db, LangID langid);
void VerifyTranslations( TransDB *db, LangID langid ) ;
int CanProceed ( void );
int CanOperate ( void );
int SaveMainDB ( void );
int UpdateLabel ( BabylonLabel *source, BabylonLabel *destination, UPDATEINFO &info, int update = TRUE, int skip = FALSE);
int UpdateDB ( TransDB *source, TransDB *destination, int update = TRUE);
void ProgressComplete ( void );
void SetProgress ( int pos );
void InitProgress ( int range );
int SaveLog ( void );
void Status ( const char *string, int log = TRUE);
void Log ( const char *string, LogFormat format = NEW_LINE );
CBabylonDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CBabylonDlg();
int LoadStrFile ( TransDB *db, const char *fileaname, void (*cb ) (void ) = NULL );
void Ready ( void ) { Status ( "Ready", FALSE ); ProgressComplete(); };
// Dialog Data
//{{AFX_DATA(CBabylonDlg)
enum { IDD = IDD_BABYLON_DIALOG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBabylonDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
CBabylonDlgAutoProxy* m_pAutoProxy;
HICON m_hIcon;
BOOL CanExit();
// Generated message map functions
//{{AFX_MSG(CBabylonDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnClose();
afx_msg void OnDropFiles(HDROP hDropInfo);
afx_msg void OnViewdbs();
afx_msg void OnReload();
afx_msg void OnUpdate();
afx_msg void OnSave();
afx_msg void OnWarnings();
afx_msg void OnErrors();
afx_msg void OnChanges();
afx_msg void OnExport();
afx_msg void OnImport();
afx_msg void OnGenerate();
afx_msg void OnVerifyDialog();
afx_msg void OnTranslations();
afx_msg void OnSelchangeCombolang();
afx_msg void OnReports();
afx_msg void OnDblclkCombolang();
afx_msg void OnReset();
afx_msg void OnSent();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
extern CBabylonDlg *MainDLG;
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_BABYLONDLG_H__2BF3124D_3BA1_11D3_B9DA_006097B90D93__INCLUDED_)

View file

@ -0,0 +1,106 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// DlgProxy.cpp : implementation file
//
#include "stdafx.h"
#include "Babylon.h"
#include "DlgProxy.h"
#include "BabylonDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBabylonDlgAutoProxy
IMPLEMENT_DYNCREATE(CBabylonDlgAutoProxy, CCmdTarget)
CBabylonDlgAutoProxy::CBabylonDlgAutoProxy()
{
EnableAutomation();
// To keep the application running as long as an automation
// object is active, the constructor calls AfxOleLockApp.
AfxOleLockApp();
// Get access to the dialog through the application's
// main window pointer. Set the proxy's internal pointer
// to point to the dialog, and set the dialog's back pointer to
// this proxy.
ASSERT (AfxGetApp()->m_pMainWnd != NULL);
ASSERT_VALID (AfxGetApp()->m_pMainWnd);
ASSERT_KINDOF(CBabylonDlg, AfxGetApp()->m_pMainWnd);
m_pDialog = (CBabylonDlg*) AfxGetApp()->m_pMainWnd;
m_pDialog->m_pAutoProxy = this;
}
CBabylonDlgAutoProxy::~CBabylonDlgAutoProxy()
{
// To terminate the application when all objects created with
// with automation, the destructor calls AfxOleUnlockApp.
// Among other things, this will destroy the main dialog
if (m_pDialog != NULL)
m_pDialog->m_pAutoProxy = NULL;
AfxOleUnlockApp();
}
void CBabylonDlgAutoProxy::OnFinalRelease()
{
// When the last reference for an automation object is released
// OnFinalRelease is called. The base class will automatically
// deletes the object. Add additional cleanup required for your
// object before calling the base class.
CCmdTarget::OnFinalRelease();
}
BEGIN_MESSAGE_MAP(CBabylonDlgAutoProxy, CCmdTarget)
//{{AFX_MSG_MAP(CBabylonDlgAutoProxy)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BEGIN_DISPATCH_MAP(CBabylonDlgAutoProxy, CCmdTarget)
//{{AFX_DISPATCH_MAP(CBabylonDlgAutoProxy)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()
// Note: we add support for IID_IBabylon to support typesafe binding
// from VBA. This IID must match the GUID that is attached to the
// dispinterface in the .ODL file.
// {2BF31248-3BA1-11D3-B9DA-006097B90D93}
static const IID IID_IBabylon =
{ 0x2bf31248, 0x3ba1, 0x11d3, { 0xb9, 0xda, 0x0, 0x60, 0x97, 0xb9, 0xd, 0x93 } };
BEGIN_INTERFACE_MAP(CBabylonDlgAutoProxy, CCmdTarget)
INTERFACE_PART(CBabylonDlgAutoProxy, IID_IBabylon, Dispatch)
END_INTERFACE_MAP()
// The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project
// {2BF31246-3BA1-11D3-B9DA-006097B90D93}
IMPLEMENT_OLECREATE2(CBabylonDlgAutoProxy, "Babylon.Application", 0x2bf31246, 0x3ba1, 0x11d3, 0xb9, 0xda, 0x0, 0x60, 0x97, 0xb9, 0xd, 0x93)
/////////////////////////////////////////////////////////////////////////////
// CBabylonDlgAutoProxy message handlers

View file

@ -0,0 +1,79 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// DlgProxy.h : header file
//
#if !defined(AFX_DLGPROXY_H__2BF3124F_3BA1_11D3_B9DA_006097B90D93__INCLUDED_)
#define AFX_DLGPROXY_H__2BF3124F_3BA1_11D3_B9DA_006097B90D93__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CBabylonDlg;
/////////////////////////////////////////////////////////////////////////////
// CBabylonDlgAutoProxy command target
class CBabylonDlgAutoProxy : public CCmdTarget
{
DECLARE_DYNCREATE(CBabylonDlgAutoProxy)
CBabylonDlgAutoProxy(); // protected constructor used by dynamic creation
// Attributes
public:
CBabylonDlg* m_pDialog;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBabylonDlgAutoProxy)
public:
virtual void OnFinalRelease();
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CBabylonDlgAutoProxy();
// Generated message map functions
//{{AFX_MSG(CBabylonDlgAutoProxy)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
DECLARE_OLECREATE(CBabylonDlgAutoProxy)
// Generated OLE dispatch map functions
//{{AFX_DISPATCH(CBabylonDlgAutoProxy)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_DISPATCH
DECLARE_DISPATCH_MAP()
DECLARE_INTERFACE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DLGPROXY_H__2BF3124F_3BA1_11D3_B9DA_006097B90D93__INCLUDED_)

View file

@ -0,0 +1,243 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// ExportDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Babylon.h"
#include "ExportDlg.h"
#include "direct.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
static int max_index;
/////////////////////////////////////////////////////////////////////////////
// CExportDlg dialog
CExportDlg::CExportDlg(CWnd* pParent /*=NULL*/)
: CDialog(CExportDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CExportDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CExportDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CExportDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CExportDlg, CDialog)
//{{AFX_MSG_MAP(CExportDlg)
ON_CBN_SELCHANGE(IDC_COMBOLANG, OnSelchangeCombolang)
ON_CBN_SELENDOK(IDC_COMBOLANG, OnSelendokCombolang)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CExportDlg message handlers
void CExportDlg::OnOK()
{
char buffer[100];
char *ptr;
// TODO: Add extra validation here
CEdit *edit = (CEdit *) GetDlgItem ( IDC_FILENAME );
CButton *all = (CButton *) GetDlgItem ( IDC_RADIOALL );
CButton *button;
CButton *sample = (CButton *) GetDlgItem ( IDC_RADIOSAMPLE );
CButton *dialog = (CButton *) GetDlgItem ( IDC_RADIODIALOG );
CButton *nondialog = (CButton *) GetDlgItem ( IDC_RADIONONDIALOG );
CButton *unverified = (CButton *) GetDlgItem ( IDC_RADIOUNVERIFIED );
CButton *missing = (CButton *) GetDlgItem ( IDC_RADIOMISSING );
CButton *unsent = (CButton *) GetDlgItem ( IDC_RADIOUNSENT );
edit->GetWindowText ( buffer, sizeof ( filename) -1 );
_getcwd ( filename, sizeof (filename ) -1 );
strcat ( filename, "\\" );
if ( ( ptr = strchr ( buffer, '.' )))
{
*ptr = 0;
}
strcat ( filename, buffer );
if ( all->GetCheck ())
{
options.filter = TR_ALL;
}
else if ( dialog->GetCheck ())
{
options.filter = TR_DIALOG;
}
else if ( nondialog->GetCheck ())
{
options.filter = TR_NONDIALOG;
}
else if ( sample->GetCheck ())
{
options.filter = TR_SAMPLE;
}
else if ( unverified->GetCheck ())
{
options.filter = TR_UNVERIFIED;
}
else if ( missing->GetCheck ())
{
options.filter = TR_MISSING_DIALOG;
}
else if ( unsent->GetCheck ())
{
options.filter = TR_UNSENT;
}
else
{
options.filter = TR_CHANGES;
}
options.include_comments = FALSE;
button = (CButton *) GetDlgItem ( IDC_CHECKTRANS );
options.include_translations = button->GetCheck ();
CDialog::OnOK();
}
void CExportDlg::OnCancel()
{
// TODO: Add extra cleanup here
langid = LANGID_UNKNOWN;
CDialog::OnCancel();
}
BOOL CExportDlg::OnInitDialog()
{
int index;
int lang_index;
LANGINFO *info;
CComboBox *combo;
CEdit *edit = (CEdit *) GetDlgItem ( IDC_FILENAME );
CButton *button = (CButton *) GetDlgItem ( IDC_RADIOCHANGES );
CDialog::OnInitDialog();
// TODO: Add extra initialization here
combo = (CComboBox *) GetDlgItem ( IDC_COMBOLANG );
combo->SetItemDataPtr ( 0, NULL );
options.filter = TR_CHANGES;
options.include_comments = FALSE;
options.include_translations = FALSE;
langid = LANGID_UNKNOWN;
filename[0] = 0;
button->SetCheck ( 1 );
index = 0;
lang_index = 0;
got_lang = FALSE;
while ( (info = GetLangInfo ( lang_index )) )
{
if ( TRUE )//info->langid != LANGID_US )
{
combo->InsertString ( index, info->name );
combo->SetItemDataPtr ( index, info );
if ( info->langid == CurrentLanguage )
{
combo->SetCurSel ( index );
got_lang = TRUE;
}
index++;
}
lang_index++;
}
max_index = index;
if ( !got_lang )
{
combo->InsertString ( 0, "Select language" );
combo->SetCurSel ( 0 );
max_index++;
}
edit->SetLimitText ( 8 );
OnSelchangeCombolang ();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CExportDlg::OnSelchangeCombolang()
{
// TODO: Add your control notification handler code here
LANGINFO *info = NULL;
int index;
CButton *export = (CButton *) GetDlgItem ( IDOK );
CComboBox *combo = (CComboBox *) GetDlgItem ( IDC_COMBOLANG );
CEdit *edit = (CEdit *) GetDlgItem ( IDC_FILENAME );
index = combo->GetCurSel ();
if ( index >= 0 && index < max_index )
{
info = (LANGINFO *) combo->GetItemDataPtr ( index );
}
if ( info )
{
char buffer[10];
edit->EnableWindow ( TRUE );
sprintf ( buffer, "Generals_%s", info->initials );
edit->SetWindowText ( buffer );
export->EnableWindow ( TRUE );
langid = info->langid;
if ( !got_lang )
{
combo->DeleteString ( 0 );
max_index--;
got_lang = TRUE;
}
}
else
{
edit->SetWindowText ("");
edit->EnableWindow ( FALSE );
export->EnableWindow ( FALSE );
langid = LANGID_UNKNOWN;
}
}
void CExportDlg::OnSelendokCombolang()
{
// TODO: Add your control notification handler code here
int i = 0;
}

View file

@ -0,0 +1,81 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
#if !defined(AFX_EXPORTDLG_H__DDA81307_4F1A_11D3_B9DA_006097B90D93__INCLUDED_)
#define AFX_EXPORTDLG_H__DDA81307_4F1A_11D3_B9DA_006097B90D93__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ExportDlg.h : header file
//
#include "expimp.h"
/////////////////////////////////////////////////////////////////////////////
// CExportDlg dialog
class CExportDlg : public CDialog
{
LangID langid;
char filename[200];
TROPTIONS options;
int got_lang;
// Construction
public:
LangID Language ( void ) { return langid; };
char* Filename ( void ) { return filename; };
TROPTIONS* Options ( void ) { return &options; };
CExportDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CExportDlg)
enum { IDD = IDD_EXPORT };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CExportDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CExportDlg)
virtual void OnOK();
virtual void OnCancel();
virtual BOOL OnInitDialog();
afx_msg void OnSelchangeCombolang();
afx_msg void OnSelendokCombolang();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EXPORTDLG_H__DDA81307_4F1A_11D3_B9DA_006097B90D93__INCLUDED_)

View file

@ -0,0 +1,231 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// GenerateDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Babylon.h"
#include "GenerateDlg.h"
#include "direct.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CGenerateDlg dialog
CGenerateDlg::CGenerateDlg(CWnd* pParent /*=NULL*/)
: CDialog(CGenerateDlg::IDD, pParent)
{
options.format = GN_UNICODE;
options.untranslated = GN_USEIDS;
langids[0] = LANGID_UNKNOWN;
filename[0] = 0;
//{{AFX_DATA_INIT(CGenerateDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CGenerateDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGenerateDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CGenerateDlg, CDialog)
//{{AFX_MSG_MAP(CGenerateDlg)
ON_BN_CLICKED(IDC_SELECTALL, OnSelectall)
ON_BN_CLICKED(IDC_INVERT, OnInvert)
ON_EN_CHANGE(IDC_PREFIX, OnChangePrefix)
ON_BN_CLICKED(IDC_BABYLONSTR, OnBabylonstr)
ON_BN_CLICKED(IDC_UNICODE, OnUnicode)
ON_BN_CLICKED(IDC_IDS, OnIds)
ON_BN_CLICKED(IDC_ORIGINAL, OnOriginal)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGenerateDlg message handlers
BOOL CGenerateDlg::OnInitDialog()
{
int index;
LANGINFO *info;
edit = (CEdit *) GetDlgItem ( IDC_PREFIX );
unicode = (CButton *) GetDlgItem ( IDC_UNICODE );
strfile = (CButton *) GetDlgItem ( IDC_BABYLONSTR );
useids = (CButton *) GetDlgItem ( IDC_IDS );
usetext = (CButton *) GetDlgItem ( IDC_ORIGINAL );
list = (CListBox *) GetDlgItem ( IDC_LANGUAGE );
filetext = ( CStatic *) GetDlgItem ( IDC_FILENAME );
CDialog::OnInitDialog();
// TODO: Add extra initialization here
unicode->SetCheck ( 1 );
useids->SetCheck ( 1 );
edit->SetWindowText ( "Generals" );
edit->SetLimitText ( 5 );
OnChangePrefix ();
index = 0;
while ( (info = GetLangInfo ( index )) )
{
list->InsertString ( index, info->name );
if ( info->langid == CurrentLanguage )
{
list->SetSel ( index );
}
index++;
}
num_langs = index;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CGenerateDlg::OnSelectall()
{
// TODO: Add your control notification handler code here
list->SelItemRange ( TRUE, 0, num_langs-1 );
}
void CGenerateDlg::OnInvert()
{
// TODO: Add your control notification handler code here
int index = 0;
while ( index < num_langs )
{
list->SetSel ( index, !list->GetSel ( index ));
index++;
}
}
void CGenerateDlg::OnChangePrefix()
{
char buffer[30];
edit->GetWindowText ( buffer, 6 );
if ( options.format == GN_BABYLONSTR )
{
strcat ( buffer, "_{xx}.str" );
}
else
{
strcat ( buffer, "_{xx}.csf" );
}
filetext->SetWindowText ( buffer );
}
void CGenerateDlg::OnBabylonstr()
{
// TODO: Add your control notification handler code here
options.format = GN_BABYLONSTR;
OnChangePrefix ();
unicode->SetCheck ( 0 );
}
void CGenerateDlg::OnUnicode()
{
// TODO: Add your control notification handler code here
options.format = GN_UNICODE;
OnChangePrefix ();
strfile->SetCheck ( 0 );
}
void CGenerateDlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
void CGenerateDlg::OnOK()
{
char buffer[30];
int count;
int i;
// TODO: Add extra validation here
edit->GetWindowText ( buffer, sizeof ( filename) -1 );
_getcwd ( filename, sizeof (filename ) -1 );
strcat ( filename, "\\" );
strcat ( filename, buffer );
count = list->GetSelItems ( num_langs, langindices );
if ( !count )
{
AfxMessageBox ( "No languages selected" );
return;
}
num_langs = 0;
for ( i = 0; i <count; i++ )
{
LANGINFO *info;
if ( info = GetLangInfo ( langindices[i] ))
{
langids[num_langs++] = info->langid;
}
}
langids[num_langs] = LANGID_UNKNOWN;
CDialog::OnOK();
}
void CGenerateDlg::OnIds()
{
options.untranslated = GN_USEIDS;
usetext->SetCheck ( 0 );
}
void CGenerateDlg::OnOriginal()
{
options.untranslated = GN_USEORIGINAL;
useids->SetCheck ( 0 );
}

View file

@ -0,0 +1,92 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
#if !defined(AFX_GENERATEDLG_H__959D0D41_50A5_11D3_B9DA_006097B90D93__INCLUDED_)
#define AFX_GENERATEDLG_H__959D0D41_50A5_11D3_B9DA_006097B90D93__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// GenerateDlg.h : header file
//
#include "expimp.h"
/////////////////////////////////////////////////////////////////////////////
// CGenerateDlg dialog
class CGenerateDlg : public CDialog
{
char filename[200];
GNOPTIONS options;
LangID langids[200];
int langindices[200];
int num_langs;
CListBox *list;
CEdit *edit;
CStatic *filetext;
CButton *unicode;
CButton *strfile;
CButton *useids;
CButton *usetext;
// Construction
public:
CGenerateDlg(CWnd* pParent = NULL); // standard constructor
char* FilePrefix ( void ) { return filename; };
GNOPTIONS* Options ( void ) { return &options; };
LangID* Langauges ( void ) { return langids; };
// Dialog Data
//{{AFX_DATA(CGenerateDlg)
enum { IDD = IDD_GENERATE };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGenerateDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CGenerateDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSelectall();
afx_msg void OnInvert();
afx_msg void OnChangePrefix();
afx_msg void OnBabylonstr();
afx_msg void OnUnicode();
virtual void OnCancel();
virtual void OnOK();
afx_msg void OnIds();
afx_msg void OnOriginal();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_GENERATEDLG_H__959D0D41_50A5_11D3_B9DA_006097B90D93__INCLUDED_)

View file

@ -0,0 +1,186 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// MatchDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Babylon.h"
#include "MatchDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
BabylonText *MatchingBabylonText = NULL;
BabylonText *MatchOriginalText;
BabylonLabel *MatchLabel;
#define MAX_MATCH 256
static BabylonText *current_match = NULL;
/////////////////////////////////////////////////////////////////////////////
// CMatchDlg dialog
CMatchDlg::CMatchDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMatchDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMatchDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CMatchDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMatchDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMatchDlg, CDialog)
//{{AFX_MSG_MAP(CMatchDlg)
ON_BN_CLICKED(IDC_NOMATCH, OnNomatch)
ON_BN_CLICKED(IDC_MATCH, OnMatch)
ON_BN_CLICKED(IDC_SKIP, OnSkip)
ON_CBN_SELCHANGE(IDC_MATCHCOMBO, OnSelchangeMatchcombo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMatchDlg message handlers
void CMatchDlg::OnCancel()
{
// TODO: Add extra cleanup here
MatchingBabylonText = NULL;
CDialog::OnCancel();
}
void CMatchDlg::OnNomatch()
{
// TODO: Add your control notification handler code here
MatchingBabylonText = NULL;
CDialog::OnOK ();
}
void CMatchDlg::OnMatch()
{
// TODO: Add your control notification handler code here
if ( (MatchingBabylonText = current_match ) )
{
CButton *check = (CButton *) GetDlgItem ( IDC_CHECKRETRANSLATE );
current_match->SetRetranslate ( check->GetCheck ());
}
CDialog::OnOK ();
}
BOOL CMatchDlg::OnInitDialog()
{
BabylonText *text;
ListSearch sh;
int index;
CStatic *newtext;
CComboBox *combo;
static char buffer[4*1024];
sprintf ( buffer, "Resolve umatched text from \"%s\" on line %d", MatchLabel->NameSB(),
MatchOriginalText->LineNumber() );
SetWindowText ( buffer );
CDialog::OnInitDialog();
current_match = NULL;
newtext = (CStatic *) GetDlgItem ( IDC_NEWTEXT );
newtext->SetWindowText ( MatchOriginalText->GetSB());
combo = (CComboBox *) GetDlgItem ( IDC_MATCHCOMBO );
CButton *check = (CButton *) GetDlgItem ( IDC_CHECKRETRANSLATE );
check->SetCheck ( 1 );
text = MatchLabel->FirstText ( sh );
index = 0;
while ( text )
{
if ( !text->Matched ())
{
int result;
result = combo->InsertString ( index, text->GetSB ());
result = combo->SetItemDataPtr ( index, text );
if ( result == CB_ERR )
{
result = 0;
}
if ( result == CB_ERRSPACE )
{
result = 0;
}
index++;
}
text = MatchLabel->NextText ( sh );
}
combo->SetCurSel ( 0 );
OnSelchangeMatchcombo();
MatchingBabylonText = NULL;
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CMatchDlg::OnSelchangeMatchcombo()
{
// TODO: Add your control notification handler code here
int index;
CComboBox *combo = (CComboBox *) GetDlgItem ( IDC_MATCHCOMBO );
index = combo->GetCurSel ();
if ( index >= 0 )
{
CStatic *newtext = (CStatic *) GetDlgItem ( IDC_MATCHTEXT );
current_match = (BabylonText *) combo->GetItemDataPtr ( index );
newtext->SetWindowText ( current_match->GetSB());
}
else
{
current_match = NULL;
}
}
void CMatchDlg::OnSkip()
{
// TODO: Add your control notification handler code here
EndDialog ( IDSKIP );
}

View file

@ -0,0 +1,76 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
#if !defined(AFX_MATCHDLG_H__FA868061_4EA7_11D3_B9DA_006097B90D93__INCLUDED_)
#define AFX_MATCHDLG_H__FA868061_4EA7_11D3_B9DA_006097B90D93__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MatchDlg.h : header file
//
#include "transDB.h"
#define IDSKIP 100
/////////////////////////////////////////////////////////////////////////////
// CMatchDlg dialog
class CMatchDlg : public CDialog
{
// Construction
public:
CMatchDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CMatchDlg)
enum { IDD = IDD_MATCH };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMatchDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CMatchDlg)
virtual void OnCancel();
afx_msg void OnNomatch();
afx_msg void OnMatch();
virtual BOOL OnInitDialog();
afx_msg void OnSkip();
afx_msg void OnSelchangeMatchcombo();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
extern BabylonText *MatchingBabylonText;
extern BabylonText *MatchOriginalText;
extern BabylonLabel *MatchLabel;
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MATCHDLG_H__FA868061_4EA7_11D3_B9DA_006097B90D93__INCLUDED_)

View file

@ -0,0 +1,105 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// ProceedDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Babylon.h"
#include "ProceedDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// ProceedDlg dialog
ProceedDlg::ProceedDlg(const char *nmessage, CWnd* pParent /*=NULL*/)
: CDialog(ProceedDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(ProceedDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
message = nmessage;
}
void ProceedDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(ProceedDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(ProceedDlg, CDialog)
//{{AFX_MSG_MAP(ProceedDlg)
ON_BN_CLICKED(IDC_YES, OnYes)
ON_BN_CLICKED(IDC_ALWAYS, OnAlways)
ON_BN_CLICKED(IDC_NO, OnNo)
ON_WM_CLOSE()
ON_BN_CLICKED(IDC_BUTTON_NO, OnNo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// ProceedDlg message handlers
void ProceedDlg::OnYes()
{
// TODO: Add your control notification handler code here
EndDialog ( IDYES );
}
void ProceedDlg::OnAlways()
{
// TODO: Add your control notification handler code here
EndDialog ( IDALWAYS );
}
void ProceedDlg::OnNo()
{
// TODO: Add your control notification handler code here
EndDialog ( IDNO );
}
void ProceedDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
EndDialog ( IDNO );
CDialog::OnClose();
}
BOOL ProceedDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetDlgItemText ( IDC_MESSAGE, message );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

View file

@ -0,0 +1,70 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
#if !defined(AFX_PROCEEDDLG_H__35C33E24_5AD8_11D3_B9DA_006097B90D93__INCLUDED_)
#define AFX_PROCEEDDLG_H__35C33E24_5AD8_11D3_B9DA_006097B90D93__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ProceedDlg.h : header file
//
#define IDALWAYS 101
/////////////////////////////////////////////////////////////////////////////
// ProceedDlg dialog
class ProceedDlg : public CDialog
{
// Construction
const char *message;
public:
ProceedDlg(const char *message, CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(ProceedDlg)
enum { IDD = IDD_PROCEED };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(ProceedDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(ProceedDlg)
afx_msg void OnYes();
afx_msg void OnAlways();
afx_msg void OnNo();
afx_msg void OnClose();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PROCEEDDLG_H__35C33E24_5AD8_11D3_B9DA_006097B90D93__INCLUDED_)

View file

@ -0,0 +1,218 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// Report.cpp : implementation file
//
#include "stdafx.h"
#include "Babylon.h"
#include "Report.h"
#include <limits.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CReport dialog
CReport::CReport(CWnd* pParent /*=NULL*/)
: CDialog(CReport::IDD, pParent)
{
options.translations = TRUE;
options.dialog = TRUE;
options.limit = 0;
langids[0] = LANGID_UNKNOWN;
filename[0] = 0;
//{{AFX_DATA_INIT(CReport)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CReport::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CReport)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CReport, CDialog)
//{{AFX_MSG_MAP(CReport)
ON_BN_CLICKED(IDC_INVERT, OnInvert)
ON_BN_CLICKED(IDC_SELECTALL, OnSelectall)
ON_BN_CLICKED(IDC_SHOW_DETAILS, OnShowDetails)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CReport message handlers
BOOL CReport::OnInitDialog()
{
int index;
LANGINFO *info;
limit = (CEdit *) GetDlgItem ( IDC_LIMIT );
trans_status = (CButton *) GetDlgItem ( IDC_TRANSLATION_STATUS );
dialog_status = (CButton *) GetDlgItem ( IDC_DIALOG_STATUS );
show_details = (CButton *) GetDlgItem ( IDC_SHOW_DETAILS );
ifless = (CButton *) GetDlgItem ( IDC_IFLESS );
list = (CListBox *) GetDlgItem ( IDC_LANGUAGE );
items = (CStatic *) GetDlgItem ( IDC_ITEMS );
CDialog::OnInitDialog();
// TODO: Add extra initialization here
trans_status->SetCheck ( options.translations );
dialog_status->SetCheck ( options.dialog );
show_details->SetCheck ( 0 );
ifless->SetCheck ( 1 );
limit->EnableWindow ( FALSE );
ifless->EnableWindow ( FALSE );
items->EnableWindow ( FALSE );
limit->SetWindowText ( "100" );
limit->SetLimitText ( 50 );
options.limit = 100;
index = 0;
while ( (info = GetLangInfo ( index )) )
{
list->InsertString ( index, info->name );
if ( info->langid == CurrentLanguage )
{
list->SetSel ( index );
}
index++;
}
num_langs = index;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CReport::OnSelectall()
{
// TODO: Add your control notification handler code here
list->SelItemRange ( TRUE, 0, num_langs-1 );
}
void CReport::OnInvert()
{
// TODO: Add your control notification handler code here
int index = 0;
while ( index < num_langs )
{
list->SetSel ( index, !list->GetSel ( index ));
index++;
}
}
void CReport::OnShowDetails()
{
// TODO: Add your control notification handler code here
if ( show_details->GetCheck () == 0 )
{
ifless->EnableWindow ( FALSE );
limit->EnableWindow ( FALSE );
items->EnableWindow ( FALSE );
}
else
{
ifless->EnableWindow ( TRUE );
limit->EnableWindow ( TRUE );
items->EnableWindow ( TRUE );
}
}
void CReport::OnOK()
{
int count;
int i;
char buffer[100];
count = list->GetSelItems ( num_langs, langindices );
if ( !count )
{
AfxMessageBox ( "No languages selected" );
return;
}
// get the filename
CFileDialog fd ( FALSE , NULL, "*.txt", OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR );
if ( fd.DoModal () != IDOK )
{
return;
}
strcpy ( filename, fd.GetPathName ());
num_langs = 0;
for ( i = 0; i <count; i++ )
{
LANGINFO *info;
if ( info = GetLangInfo ( langindices[i] ))
{
langids[num_langs++] = info->langid;
}
}
langids[num_langs] = LANGID_UNKNOWN;
options.dialog = dialog_status->GetCheck ();
options.translations = trans_status->GetCheck ();
limit->GetWindowText( buffer, sizeof(buffer)-1);
options.limit = atoi ( buffer );
if ( !show_details->GetCheck () )
{
options.limit = 0;
}
else if ( !ifless->GetCheck () )
{
options.limit = INT_MAX;
}
CDialog::OnOK();
}
void CReport::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}

View file

@ -0,0 +1,89 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
#if !defined(AFX_REPORT_H__47F98BA1_70E3_11D3_B9DA_006097B90D93__INCLUDED_)
#define AFX_REPORT_H__47F98BA1_70E3_11D3_B9DA_006097B90D93__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Report.h : header file
//
#include "expimp.h"
/////////////////////////////////////////////////////////////////////////////
// CReport dialog
class CReport : public CDialog
{
char filename[300];
RPOPTIONS options;
LangID langids[200];
int langindices[200];
int num_langs;
CListBox *list;
CEdit *limit;
CButton *dialog_status;
CButton *trans_status;
CButton *show_details;
CButton *ifless;
CStatic *items;
// Construction
public:
CReport(CWnd* pParent = NULL); // standard constructor
char* Filename ( void ) { return filename; };
RPOPTIONS* Options ( void ) { return &options; };
LangID* Langauges ( void ) { return langids; };
// Dialog Data
//{{AFX_DATA(CReport)
enum { IDD = IDD_CREATE_REPORTS };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CReport)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CReport)
virtual BOOL OnInitDialog();
afx_msg void OnInvert();
afx_msg void OnSelectall();
afx_msg void OnShowDetails();
virtual void OnOK();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_REPORT_H__47F98BA1_70E3_11D3_B9DA_006097B90D93__INCLUDED_)

View file

@ -0,0 +1,123 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// RetranslateDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Babylon.h"
#include "RetranslateDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// RetranslateDlg dialog
RetranslateDlg::RetranslateDlg(CWnd* pParent /*=NULL*/)
: CDialog(RetranslateDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(RetranslateDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void RetranslateDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(RetranslateDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(RetranslateDlg, CDialog)
//{{AFX_MSG_MAP(RetranslateDlg)
ON_WM_CANCELMODE()
ON_BN_CLICKED(IDC_MATCH, OnRetranslate)
ON_BN_CLICKED(IDC_SKIP, OnSkip)
ON_BN_CLICKED(IDC_NOMATCH, OnNoRetranslate)
ON_BN_CLICKED(IDCANCEL, OnSkipAll)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// RetranslateDlg message handlers
BOOL RetranslateDlg::OnInitDialog()
{
// TODO: Add extra initialization here
CStatic *text;
static char buffer[4*1024];
CDialog::OnInitDialog();
text = (CStatic *) GetDlgItem ( IDC_NEWTEXT );
text->SetWindowText ( newtext->GetSB());
text = (CStatic *) GetDlgItem ( IDC_OLDTEXT );
text->SetWindowText ( oldtext->GetSB());
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void RetranslateDlg::OnCancelMode()
{
CDialog::OnCancelMode();
// TODO: Add your message handler code here
}
void RetranslateDlg::OnRetranslate()
{
// TODO: Add your control notification handler code here
oldtext->SetRetranslate ( TRUE );
CDialog::OnOK ();
}
void RetranslateDlg::OnSkip()
{
// TODO: Add your control notification handler code here
EndDialog ( IDSKIP );
}
void RetranslateDlg::OnNoRetranslate()
{
// TODO: Add your control notification handler code here
oldtext->SetRetranslate ( FALSE );
CDialog::OnOK ();
}
void RetranslateDlg::OnSkipAll()
{
// TODO: Add your control notification handler code here
CDialog::OnCancel ();
}

View file

@ -0,0 +1,75 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
#if !defined(AFX_RETRANSLATEDLG_H__19E25401_0ECB_11D4_B9DB_006097B90D93__INCLUDED_)
#define AFX_RETRANSLATEDLG_H__19E25401_0ECB_11D4_B9DB_006097B90D93__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// RetranslateDlg.h : header file
//
#include "transdb.h"
#define IDSKIP 100
/////////////////////////////////////////////////////////////////////////////
// RetranslateDlg dialog
class RetranslateDlg : public CDialog
{
// Construction
public:
BabylonText *newtext;
BabylonText *oldtext;
RetranslateDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(RetranslateDlg)
enum { IDD = IDD_RETRANSLATE };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(RetranslateDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(RetranslateDlg)
virtual BOOL OnInitDialog();
afx_msg void OnCancelMode();
afx_msg void OnRetranslate();
afx_msg void OnSkip();
afx_msg void OnNoRetranslate();
afx_msg void OnSkipAll();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_RETRANSLATEDLG_H__19E25401_0ECB_11D4_B9DB_006097B90D93__INCLUDED_)

View file

@ -0,0 +1,192 @@
#
# Command & Conquer Generals Zero Hour™
# 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 <http://www.gnu.org/licenses/>.
#
sub ShowWarning;
sub ShowError;
$noxScript = shift || 'C:\Nox\Game\nox.str';
$outFile = shift;
open(STR, $noxScript) || die "Can't open Nox string file: $!\n";
if ($outFile)
{
open(STDOUT, ">$outFile") || die "Can't open output file: $!\n";
}
select((select(STDOUT), $| = 1)[0]);
$state = 0;
$line = 0;
$strcount = 0;
$strMaxCount = 32;
$lastFileName = "";
$lastFileNameLine = 0;
$ignoreErrors = 0;
$errCount = 0;
%labels = ();
while (<STR>)
{
$strline = $_;
$line++;
$strline =~ s/\/\/.*//g;
$strline =~ s/^\s*//g;
$strline =~ s/\s*$//g;
if (! ($strline eq ""))
{
if ($state == 0)
{
if (! ($strline =~ /^[^\"][^ :]*:[^ :]*[^\"]$/))
{
ShowError($line, $strline, "Expecting 'file:name'\n");
}
else
{
if (defined ($labels{$strline}))
{
ShowWarning($line, $strline, "Duplicate label at line $labels{$strline}\n");
}
$labels{$strline} = $line;
$lastFileName = $strline;
$lastFileNameLine = $line;
$strcount = 0;
$ignoreErrors = 0;
$state = 1;
}
}
elsif ($state == 1)
{
if (++$strcount >= $strMaxCount)
{
ShowError($line, $strline, "Too many strings ($strcount) - suspected missing END from section $lastFileName on line $lastFileNameLine\n");
}
elsif ($strline =~ /^END$/i)
{
$state = 0;
}
elsif ($strline =~ /\/n/i)
{
ShowWarning($line, $strline, "'/n'? This should probably be '\\n' instead\n");
}
elsif ($strline =~ /^\"[^\"]*[^\"]$/)
{
$state = 2;
}
else
{
$strline =~ s/\"\s*={0,1}\s*[a-zA-Z0-9_\.]*[^\"]$/\"/i;
if (! ($strline =~ /^\".*\"$/))
{
if ($strline =~ /^[^\"][^ :]*:[^ :]*[^\"]$/)
{
ShowError($line, $strline, "Missing quote - suspected missing END from section $lastFileName on line $lastFileNameLine\n");
}
else
{
ShowError($line, $strline, "Missing quote\n");
}
}
}
}
elsif ($state == 2)
{
$strline =~ s/\"\s*={0,1}\s*[a-zA-Z0-9_\.]*[^\"]$/\"/i;
if (++$strcount >= $strMaxCount)
{
ShowError($line, $strline, "Too many strings ($strcount) - suspected missing END from section $lastFileName on line $lastFileNameLine\n");
}
elsif ($strline =~ /\/n/i)
{
ShowWarning($line, $strline, "'/n'? This should probably be '\\n' instead\n");
}
elsif ($strline =~ /^[^\"].*\"$/)
{
$state = 1;
}
elsif (! ($strline =~ /^[^\"].*[^\"]$/))
{
ShowError($line, $strline, "Extra quote character found at start of line\n");
}
elsif ($strline =~ /^END$/i)
{
ShowWarning($line, $strline, "Suspiciously placed 'END'. Maybe missing an end-quote from previous section\n");
}
}
}
}
if ($state != 0)
{
ShowError($line, $strline, "Missing END\n");
}
print STDOUT "$line lines processed\n";
close(STR);
if ($errCount == 0)
{
open(RESULT, ">strcheck.err") || die "Can't open output file: $!\n";
print RESULT "OK";
close (RESULT);
}
exit($errCount);
sub ShowWarning
{
my ($errLine, $errString, $errDesc) = @_;
if (length($errString) > 32)
{
$errString = substr($errString, 0, 32) . "...";
}
if ($ignoreErrors == 0)
{
print STDOUT "$noxScript($errLine) : warning: '$errString' : $errDesc";
}
$state = 0;
$ignoreErrors = 1;
}
sub ShowError
{
my ($errLine, $errString, $errDesc) = @_;
if (length($errString) > 32)
{
$errString = substr($errString, 0, 32) . "...";
}
if ($ignoreErrors == 0)
{
print STDOUT "$noxScript($errLine) : error: '$errString' : $errDesc";
$errCount++;
}
$state = 0;
$ignoreErrors = 1;
}

View file

@ -0,0 +1,26 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// stdafx.cpp : source file that includes just the standard includes
// Babylon.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View file

@ -0,0 +1,60 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__2BF31252_3BA1_11D3_B9DA_006097B90D93__INCLUDED_)
#define AFX_STDAFX_H__2BF31252_3BA1_11D3_B9DA_006097B90D93__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
// This macro is the same as IMPLEMENT_OLECREATE, except it passes TRUE
// for the bMultiInstance parameter to the COleObjectFactory constructor.
// We want a separate instance of this application to be launched for
// each automation proxy object requested by automation controllers.
#ifndef IMPLEMENT_OLECREATE2
#define IMPLEMENT_OLECREATE2(class_name, external_name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
AFX_DATADEF COleObjectFactory class_name::factory(class_name::guid, \
RUNTIME_CLASS(class_name), TRUE, _T(external_name)); \
const AFX_DATADEF GUID class_name::guid = \
{ l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } };
#endif // IMPLEMENT_OLECREATE2
#include "excel8.h"
extern char AppTitle[];
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__2BF31252_3BA1_11D3_B9DA_006097B90D93__INCLUDED_)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,430 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//
// ParseStr.h
//
//
#ifndef __TRANSDB_H
#define __TRANSDB_H
#include "olestring.h"
#include "list.h"
#include "bin.h"
class CBabylonDlg;
typedef struct
{
int numdialog;
int missing;
int unresolved;
int resolved;
int errors;
} DLGREPORT;
typedef struct
{
int numlabels;
int numstrings;
int missing;
int retranslate;
int too_big;
int errors;
int bad_format;
int translated;
} TRNREPORT;
typedef enum
{
PMASK_NONE = 0,
PMASK_MISSING = 0x00000001,
PMASK_UNRESOLVED = 0x00000002,
PMASK_BADFORMAT = 0x00000004,
PMASK_TOOLONG = 0x00000008,
PMASK_RETRANSLATE = 0x00000010,
PMASK_ALL = 0xffffffff
} PMASK;
typedef enum
{
LANGID_US,
LANGID_UK,
LANGID_GERMAN,
LANGID_FRENCH,
LANGID_SPANISH,
LANGID_ITALIAN,
LANGID_JAPANESE,
LANGID_JABBER,
LANGID_KOREAN,
LANGID_CHINESE,
LANGID_UNKNOWN
} LangID;
typedef struct
{
LangID langid;
char *name;
char *initials ; // two character identifier
char *character; // single character identifier
} LANGINFO;
LANGINFO* GetLangInfo ( LangID langid );
char* GetLangName ( LangID langid );
LANGINFO* GetLangInfo ( int index );
LANGINFO* GetLangInfo ( char *language );
class CWaveInfo
{
int wave_valid;
DWORD wave_size_hi;
DWORD wave_size_lo;
int missing;
public:
CWaveInfo ( void );
int Valid ( void ) { return wave_valid; };
DWORD Lo ( void ) { return wave_size_lo; };
DWORD Hi ( void ) { return wave_size_hi; };
void SetValid( int new_valid ) { wave_valid = new_valid; };
void SetLo ( DWORD new_lo ) { wave_size_lo = new_lo; };
void SetHi ( DWORD new_hi ) { wave_size_hi = new_hi; };
int Missing ( void ) { return missing; };
void SetMissing ( int val ) { missing = val; };
};
class DBAttribs
{
DBAttribs *parent;
int changed;
int processed;
void *match;
public:
DBAttribs( void ) { parent = NULL; changed = FALSE; processed = FALSE; match = NULL; };
void SetParent ( DBAttribs *new_parent ) { parent = new_parent; };
int IsChanged ( void ) { return changed; };
void Changed ( void ) { changed = TRUE; if ( parent ) parent->Changed(); };
void NotChanged ( void ) { changed = FALSE; };
char ChangedSymbol ( void ) { return changed ? '*' :' '; };
int IsProcessed ( void ) { return processed; };
void Processed ( void ) { processed = TRUE; };
void NotProcessed ( void ) { processed = FALSE; };
void* Matched ( void ) { return match; };
void Match ( void* new_match ) { match = new_match; };
void NotMatched ( void ) { match = NULL; };
};
class TransDB;
class BabylonLabel;
class BabylonText;
class Translation : public DBAttribs
{
TransDB *db;
OLEString *text;
OLEString *comment;
LangID langid;
int revision;
int sent;
public:
CWaveInfo WaveInfo;
Translation ( void );
~Translation ( );
void SetDB ( TransDB *new_db );
Translation* Clone ( void );
void SetLangID ( LangID new_id ) { langid = new_id; };
TransDB* DB ( void ) { return db; };
void ClearChanges (void) { NotChanged(); };
void ClearProcessed (void) { NotProcessed(); };
void ClearMatched (void) { NotMatched(); };
int Clear ( void ) { return 0;};
void Set ( OLECHAR *string ) { text->Set ( string ); Changed();};
void Set ( char *string ) { text->Set ( string ); Changed(); };
OLECHAR* Get ( void ) { return text->Get (); };
int Len ( void ) { return text->Len (); };
char* GetSB ( void ) { return text->GetSB (); };
void SetComment ( OLECHAR *string ) { comment->Set ( string ); Changed(); };
void SetComment ( char *string ) { comment->Set ( string ); Changed(); };
OLECHAR* Comment ( void ) { return comment->Get(); };
char* CommentSB ( void ) { return comment->GetSB(); };
int Revision ( void ) { return revision; };
void SetRevision ( int new_rev ) { revision = new_rev; Changed(); };
LangID GetLangID ( void ) { return langid; };
char* Language ( void ) { return GetLangName ( langid );};
void AddToTree ( CTreeCtrl *tc, HTREEITEM parent, int changes = FALSE );
int TooLong ( int maxlen );
int ValidateFormat ( BabylonText *text );
int IsSent ( void );
void Sent ( int val );
};
class BabylonText : public DBAttribs
{
TransDB *db;
OLEString *text;
BabylonLabel *label;
OLEString *wavefile;
unsigned int line_number;
List translations;
int revision;
int id;
int retranslate;
int sent;
void init ( void );
public:
CWaveInfo WaveInfo;
BabylonText( void );
~BabylonText( );
void AddTranslation ( Translation *trans );
Translation* FirstTranslation ( ListSearch &sh );
Translation* NextTranslation ( ListSearch &sh );
Translation* GetTranslation ( LangID langid );
void SetDB ( TransDB *new_db );
void ClearChanges ( void );
void ClearProcessed ( void );
void ClearMatched ( void );
int Clear ( void );
BabylonText* Clone ( void );
void Remove ( void );
void AssignID ( void );
void Set ( OLECHAR *string );
void Set ( char *string );
void SetID ( int new_id ) { id = new_id; Changed(); };
int ID ( void ) { return id; };
void LockText ( void ) { text->Lock(); };
TransDB* DB ( void ) { return db; };
OLECHAR* Get ( void ) { return text->Get (); } ;
int Len ( void ) { return text->Len (); };
char* GetSB ( void ) { return text->GetSB (); } ;
void SetWave ( OLECHAR *string ) { wavefile->Set ( string ); Changed(); InvalidateAllWaves (); };
void SetWave ( char *string ) { wavefile->Set ( string ); Changed(); InvalidateAllWaves (); };
void SetLabel ( BabylonLabel *new_label ) { label = new_label; };
void SetRetranslate ( int flag = TRUE ) { retranslate = flag;};
int Retranslate ( void ) { return retranslate; };
OLECHAR* Wave ( void ) { return wavefile->Get (); } ;
char* WaveSB ( void ) { return wavefile->GetSB (); } ;
BabylonLabel* Label ( void ) { return label; } ;
int Revision ( void ) { return revision; } ;
void SetRevision ( int new_rev ) { revision = new_rev; Changed(); } ;
void IncRevision ( void ) { revision++; Changed(); };
void AddToTree ( CTreeCtrl *tc, HTREEITEM parent, int changes = FALSE );
int LineNumber ( void ) { return line_number; };
void SetLineNumber ( int line ) { line_number = line; Changed(); };
void FormatMetaString ( void ) { text->FormatMetaString (); Changed();};
int IsDialog ( void );
int DialogIsPresent ( const char *path, LangID langid = LANGID_US );
int DialogIsValid ( const char *path, LangID langid = LANGID_US, int check = TRUE );
int ValidateDialog( const char *path, LangID langid = LANGID_US );
void InvalidateAllWaves ( void );
void InvalidateWave ( void );
void InvalidateWave ( LangID langid );
int IsSent ( void );
void Sent ( int val );
};
class BabylonLabel : public DBAttribs
{
TransDB *db;
OLEString *name;
OLEString *comment;
OLEString *context;
OLEString *speaker;
OLEString *listener;
unsigned int max_len;
unsigned int line_number;
List text;
void init ( void );
public:
BabylonLabel ( void );
~BabylonLabel ( );
int Clear ( void );
void ClearChanges ( void );
void ClearProcessed ( void );
void ClearMatched ( void );
int AllMatched ( void );
void Remove ( void );
void AddText ( BabylonText *new_text );
void RemoveText ( BabylonText *new_text );
BabylonText* FirstText ( ListSearch& sh );
BabylonText* NextText ( ListSearch& sh);
BabylonText* FindText ( OLECHAR *find_text );
void SetDB ( TransDB *new_db );
BabylonLabel* Clone ( void );
int NumStrings ( void ) { return text.NumItems(); };
void SetMaxLen ( int max ) { max_len = max; Changed(); };
int MaxLen ( void ) { return max_len; };
void SetLineNumber( int line ) { line_number = line; Changed(); };
int LineNumber ( void ) { return line_number; };
TransDB* DB ( void ) { return db;};
void LockName ( void ) { name->Lock(); };
void SetName ( OLECHAR *string ) { name->Set ( string ); Changed(); };
void SetName ( char *string ) { name->Set ( string ); Changed(); };
void SetComment ( OLECHAR *string ) { comment->Set ( string ); Changed(); };
void SetComment ( char *string ) { comment->Set ( string ); Changed(); };
void SetContext ( OLECHAR *string ) { context->Set ( string ); Changed(); };
void SetContext ( char *string ) { context->Set ( string ); Changed(); };
void SetSpeaker ( char *string ) { speaker->Set ( string ); Changed(); };
void SetSpeaker ( OLECHAR *string ) { speaker->Set ( string ); Changed(); };
void SetListener ( char *string ) { listener->Set ( string ); Changed(); };
void SetListener ( OLECHAR *string ) { listener->Set ( string ); Changed(); };
OLECHAR* Name ( void ) { return name->Get (); };
OLECHAR* Comment ( void ) { return comment->Get(); };
OLECHAR* Context ( void ) { return context->Get(); };
OLECHAR* Speaker ( void ) { return speaker->Get(); };
OLECHAR* Listener ( void ) { return listener->Get(); };
char* NameSB ( void ) { return name->GetSB (); };
char* CommentSB ( void ) { return comment->GetSB(); };
char* ContextSB ( void ) { return context->GetSB(); };
char* SpeakerSB ( void ) { return speaker->GetSB(); };
char* ListenerSB ( void ) { return listener->GetSB(); };
void AddToTree ( CTreeCtrl *tc, HTREEITEM parent, int changes = FALSE );
};
#define TRANSDB_OPTION_NONE 00000000
#define TRANSDB_OPTION_DUP_TEXT 00000001 // strings can be dupilcated across labels
#define TRANSDB_OPTION_MULTI_TEXT 00000002 // labels can have more than 1 string
const int START_STRING_ID = 10000;
class TransDB : public DBAttribs
{
ListNode node;
List labels;
List obsolete;
Bin *label_bin;
Bin *text_bin;
BinID *text_id_bin;
Bin *obsolete_bin;
char name[100];
int num_obsolete;
int next_string_id;
int valid;
int checked_for_errors;
int last_error_count;
int flags;
public:
TransDB ( char *name = "no name" );
~TransDB ( );
void InvalidateDialog( LangID langid );
void VerifyDialog( LangID langid, void (*cb) ( void ) = NULL );
int ReportDialog( DLGREPORT *report, LangID langid, void (*print) ( const char *)= NULL, PMASK pmask= PMASK_ALL );
int ReportTranslations( TRNREPORT *report, LangID langid, void (*print) ( const char *) = NULL, PMASK pmask = PMASK_ALL );
void ReportDuplicates ( CBabylonDlg *dlg = NULL );
void AddLabel ( BabylonLabel *label );
void AddText ( BabylonText *text );
void AddObsolete ( BabylonText *text );
void RemoveLabel ( BabylonLabel *label );
void RemoveText ( BabylonText *text );
void RemoveObsolete ( BabylonText *text );
int Errors ( CBabylonDlg *dlg = NULL );
int HasErrors ( void ) { return checked_for_errors ? last_error_count != 0 : FALSE; };
int Warnings ( CBabylonDlg *dlg = NULL );
int NumLabelsChanged ( void );
int NumLabels ( void );
int NumObsolete ( void ) { return num_obsolete; };
BabylonLabel* FirstLabel ( ListSearch& sh );
BabylonLabel* NextLabel ( ListSearch& sh);
BabylonText* FirstObsolete ( ListSearch& sh );
BabylonText* NextObsolete ( ListSearch& sh);
BabylonLabel* FindLabel ( OLECHAR *name );
BabylonText* FindText ( OLECHAR *text );
BabylonText* FindSubText ( OLECHAR *text, int item = 0 );
BabylonText* FindText ( int id );
BabylonText* FindNextText ( void );
BabylonText* FindObsolete ( OLECHAR *text );
BabylonText* FindNextObsolete ( void );
int Clear ( void );
void ClearChanges ( void );
void ClearProcessed ( void );
void ClearMatched ( void );
TransDB* Next ( void );
void AddToTree ( CTreeCtrl *tc, HTREEITEM parent, int changes = FALSE, void (*cb) ( void ) = NULL );
char* Name ( void ) { return name;};
void EnableIDs ( void ) { next_string_id = START_STRING_ID; };
int NewID ( void ) { if ( next_string_id != -1) return next_string_id++; else return -1; };
int ID ( void ) { return next_string_id; };
void SetID ( int new_id ) { next_string_id = new_id; };
int IsValid ( void ) { return valid; };
void InValid ( void ) { valid = FALSE; };
int DuplicatesAllowed ( void ) { return flags & TRANSDB_OPTION_DUP_TEXT;};
int MultiTextAllowed ( void ) { return flags & TRANSDB_OPTION_MULTI_TEXT;};
void AllowDupiclates ( int yes = TRUE) { yes ? flags |= TRANSDB_OPTION_DUP_TEXT : flags &= ~(TRANSDB_OPTION_DUP_TEXT ); };
void AllowMultiText ( int yes = TRUE) { yes ? flags |= TRANSDB_OPTION_MULTI_TEXT : flags &= ~(TRANSDB_OPTION_MULTI_TEXT ); };
};
class DupNode : public ListNode
{
BabylonText *original;
BabylonText *duplicate;
public:
DupNode ( BabylonText *dup, BabylonText *orig ) { original = orig; duplicate = dup, SetPriority ( orig->LineNumber ());};
BabylonText *Duplicate ( void ) { return duplicate; };
BabylonText *Original ( void ) { return original; };
};
extern TransDB* FirstTransDB ( void );
#endif // __TRANSDB_H

View file

@ -0,0 +1,61 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// VIEWDBSII.cpp : implementation file
//
#include "stdafx.h"
#include "Babylon.h"
#include "VIEWDBSII.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// VIEWDBSII dialog
VIEWDBSII::VIEWDBSII(CWnd* pParent /*=NULL*/)
: CDialog(VIEWDBSII::IDD, pParent)
{
//{{AFX_DATA_INIT(VIEWDBSII)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void VIEWDBSII::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(VIEWDBSII)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(VIEWDBSII, CDialog)
//{{AFX_MSG_MAP(VIEWDBSII)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// VIEWDBSII message handlers

View file

@ -0,0 +1,70 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
#if !defined(AFX_VIEWDBSII_H__AC697EE4_6D37_4F29_ACC7_8B260A33DA2E__INCLUDED_)
#define AFX_VIEWDBSII_H__AC697EE4_6D37_4F29_ACC7_8B260A33DA2E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// VIEWDBSII.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// VIEWDBSII dialog
class VIEWDBSII : public CDialog
{
// Construction
public:
VIEWDBSII(CWnd* pParent = NULL); // standard constructor
void OnClose();
BOOL OnInitDialog();
HTREEITEM create_changes_view ( void );
HTREEITEM VIEWDBSII::create_full_view ( void );
// Dialog Data
//{{AFX_DATA(VIEWDBSII)
enum { IDD = IDD_VIEWDBS };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(VIEWDBSII)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(VIEWDBSII)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
extern int ViewChanges;
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_VIEWDBSII_H__AC697EE4_6D37_4F29_ACC7_8B260A33DA2E__INCLUDED_)

View file

@ -0,0 +1,238 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// VerifyDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Babylon.h"
#include "VerifyDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define TIMERID 1000
/////////////////////////////////////////////////////////////////////////////
// VerifyDlg dialog
VerifyDlg::VerifyDlg( BabylonText *ntext, LangID langid, const char *path, CWnd* pParent /*=NULL*/)
: CDialog(VerifyDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(VerifyDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
babylon_text = ntext;
linfo = GetLangInfo ( langid );
sprintf ( wavefile, "%s%s\\%s%s.wav", path, linfo->character, ntext->WaveSB(), linfo->character );
}
void VerifyDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(VerifyDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(VerifyDlg, CDialog)
//{{AFX_MSG_MAP(VerifyDlg)
ON_BN_CLICKED(IDC_NOMATCH, OnNomatch)
ON_BN_CLICKED(IDOK, OnMatch)
ON_BN_CLICKED(IDC_STOP, OnStop)
ON_BN_CLICKED(IDC_PLAY, OnPlay)
ON_BN_CLICKED(IDC_PAUSE, OnPause)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// VerifyDlg message handlers
BOOL VerifyDlg::OnInitDialog()
{
//long total;
CDialog::OnInitDialog();
RECT rect;
// TODO: Add extra initialization here
this->GetWindowRect ( &rect );
rect.top -= 100;
rect.bottom -= 100;
this->MoveWindow ( &rect );
stop.AutoLoad ( IDC_STOP, this );
pause.AutoLoad ( IDC_PAUSE, this );
play.AutoLoad ( IDC_PLAY, this );
wave = GetDlgItem ( IDC_WAVENAME );
text = (CStatic *) GetDlgItem ( IDC_TEXT );
slider = (CSliderCtrl *) GetDlgItem ( IDC_SLIDER );
wave->SetWindowText ( wavefile );
SetDlgItemText ( IDC_TEXT_TITLE, (babylon_text->Label()->NameSB()));
if ( linfo->langid == LANGID_US )
{
text->SetWindowText ( babylon_text->GetSB ());
}
else
{
Translation *trans = babylon_text->GetTranslation ( linfo->langid );
if ( trans )
{
text->SetWindowText ( trans->GetSB ());
}
else
{
text->SetWindowText ( "No translation!!");
}
}
#if 0
HDIGDRIVER dig;
HMDIDRIVER mdi;
HDLSDEVICE dls;
AIL_quick_handles ( &dig, &mdi, &dls );
stream = AIL_open_stream ( dig, wavefile, 0 );
if ( stream )
{
timer = SetTimer( TIMERID, 300, NULL );
AIL_stream_ms_position ( stream, &total, NULL );
slider->SetRange ( 0, total );
}
#endif
PostMessage ( WM_COMMAND, MAKEWPARAM ( IDC_PLAY, BN_CLICKED ));
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void VerifyDlg::OnNomatch()
{
// TODO: Add your control notification handler code here
CloseAudio ();
this->EndDialog ( IDSKIP );
}
void VerifyDlg::OnMatch()
{
// TODO: Add your control notification handler code here
CloseAudio ();
CDialog::OnOK();
}
void VerifyDlg::OnCancel()
{
// TODO: Add extra cleanup here
CloseAudio ();
CDialog::OnCancel();
}
void VerifyDlg::OnStop()
{
// TODO: Add your control notification handler code here
#if 0
if ( stream )
{
AIL_pause_stream ( stream, TRUE );
AIL_set_stream_ms_position ( stream, 0 );
}
#endif
}
void VerifyDlg::OnPlay()
{
// TODO: Add your control notification handler code here
#if 0
if ( stream )
{
if ( AIL_stream_status ( stream ) == SMP_STOPPED )
{
AIL_pause_stream ( stream, FALSE);
}
else
{
AIL_start_stream ( stream );
}
}
#endif
}
void VerifyDlg::OnPause()
{
// TODO: Add your control notification handler code here
#if 0
if ( stream )
{
if ( AIL_stream_status ( stream ) == SMP_STOPPED )
{
AIL_pause_stream ( stream, FALSE);
}
else
{
AIL_pause_stream ( stream, TRUE);
}
}
#endif
}
void VerifyDlg::CloseAudio ( void )
{
#if 0
if ( stream )
{
AIL_close_stream ( stream );
stream = NULL;
}
#endif
}
void VerifyDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if ( nIDEvent == TIMERID )
{
#if 0
if ( stream )
{
long current;
AIL_stream_ms_position ( stream, NULL, &current );
slider->SetPos ( current );
}
#endif
}
else
{
CDialog::OnTimer(nIDEvent);
}
}

View file

@ -0,0 +1,85 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
#if !defined(AFX_VERIFYDLG_H__88E9C121_599B_11D3_B9DA_006097B90D93__INCLUDED_)
#define AFX_VERIFYDLG_H__88E9C121_599B_11D3_B9DA_006097B90D93__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// VerifyDlg.h : header file
//
#include "transDB.h"
#define IDSKIP 100
/////////////////////////////////////////////////////////////////////////////
// VerifyDlg dialog
class VerifyDlg : public CDialog
{
CBitmapButton stop;
CBitmapButton play;
CBitmapButton pause;
CWnd *wave;
CStatic *text;
BabylonText *babylon_text;
LANGINFO *linfo;
UINT timer;
char wavefile[1024];
CSliderCtrl *slider;
// Construction
public:
VerifyDlg(BabylonText *ntext, LangID langid, const char *path, CWnd* pParent = NULL); // standard constructor
void CloseAudio ( void );
// Dialog Data
//{{AFX_DATA(VerifyDlg)
enum { IDD = IDD_MATCHDIALOG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(VerifyDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(VerifyDlg)
virtual BOOL OnInitDialog();
afx_msg void OnNomatch();
afx_msg void OnMatch();
virtual void OnCancel();
afx_msg void OnStop();
afx_msg void OnPlay();
afx_msg void OnPause();
afx_msg void OnTimer(UINT nIDEvent);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_VERIFYDLG_H__88E9C121_599B_11D3_B9DA_006097B90D93__INCLUDED_)

View file

@ -0,0 +1,91 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// VerifyTextDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Babylon.h"
#include "VerifyTextDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CVerifyTextDlg dialog
CVerifyTextDlg::CVerifyTextDlg( char *trans, char *orig, CWnd* pParent /*=NULL*/)
: CDialog(CVerifyTextDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CVerifyTextDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_trans = trans;
m_orig = orig;
}
void CVerifyTextDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CVerifyTextDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CVerifyTextDlg, CDialog)
//{{AFX_MSG_MAP(CVerifyTextDlg)
ON_BN_CLICKED(IDC_NOMATCH, OnNomatch)
ON_BN_CLICKED(IDC_MATCH, OnMatch)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CVerifyTextDlg message handlers
void CVerifyTextDlg::OnNomatch()
{
EndDialog ( IDNO );
}
void CVerifyTextDlg::OnMatch()
{
EndDialog ( IDYES );
}
BOOL CVerifyTextDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetDlgItemText ( IDC_TRANS, m_trans );
SetDlgItemText ( IDC_ORIG, m_orig );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

View file

@ -0,0 +1,68 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
#if !defined(AFX_VERIFYTEXTDLG_H__39DB1C81_6B90_11D3_B9DA_006097B90D93__INCLUDED_)
#define AFX_VERIFYTEXTDLG_H__39DB1C81_6B90_11D3_B9DA_006097B90D93__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// VerifyTextDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CVerifyTextDlg dialog
class CVerifyTextDlg : public CDialog
{
// Construction
char *m_trans;
char *m_orig;
public:
CVerifyTextDlg(char *trans, char *orig, CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CVerifyTextDlg)
enum { IDD = IDD_VERIFYTEXT };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CVerifyTextDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CVerifyTextDlg)
afx_msg void OnNomatch();
afx_msg void OnMatch();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_VERIFYTEXTDLG_H__39DB1C81_6B90_11D3_B9DA_006097B90D93__INCLUDED_)

View file

@ -0,0 +1,221 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// ViewDBsDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Babylon.h"
#include "Babylondlg.h"
#include "VIEWDBSII.h"
#include "transdb.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
int ViewChanges = FALSE;
/////////////////////////////////////////////////////////////////////////////
// CViewDBsDlg dialog
VIEWDBSII::VIEWDBSII(CWnd* pParent /*=NULL*/)
: CDialog(VIEWDBSII::IDD, pParent)
{
//{{AFX_DATA_INIT(CViewDBsDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void VIEWDBSII::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CViewDBsDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(VIEWDBSII, CDialog)
//{{AFX_MSG_MAP(CViewDBsDlg)
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CViewDBsDlg message handlers
static int label_count;
static void progress_cb ( void )
{
label_count++;
if ( MainDLG )
{
MainDLG->SetProgress ( label_count );
}
}
HTREEITEM VIEWDBSII::create_full_view ( void )
{
CTreeCtrl *tc = ( CTreeCtrl *) GetDlgItem ( IDC_TREEVIEW );
HTREEITEM root;
TransDB *db;
int count = 0;
char *title = "Building database view...";
MainDLG->Log ("");
MainDLG->Status ( title );
root = tc->InsertItem ( "DBs" );
db = FirstTransDB ( );
while ( db )
{
count += db->NumLabels ();
count += db->NumObsolete ();
db = db->Next ();
}
MainDLG->InitProgress ( count );
label_count = 0;
db = FirstTransDB ( );
while ( db )
{
char buffer[100];
sprintf ( buffer, "%s%s", title, db->Name());
MainDLG->Status ( buffer, FALSE );
db->AddToTree ( tc, root, FALSE, progress_cb );
db = db->Next ();
}
MainDLG->Log ("OK", SAME_LINE );
tc->Expand ( root, TVE_EXPAND );
return root;
}
HTREEITEM VIEWDBSII::create_changes_view ( void )
{
CTreeCtrl *tc = ( CTreeCtrl *) GetDlgItem ( IDC_TREEVIEW );
HTREEITEM root;
TransDB *db;
int count = 0;
char *title = "Building changes view...";
MainDLG->Log ("");
MainDLG->Status ( title );
db = FirstTransDB ( );
while ( db )
{
if ( db->IsChanged ())
{
count += db->NumLabels ();
count += db->NumObsolete ();
}
db = db->Next ();
}
if ( MainDLG )
{
MainDLG->InitProgress ( count );
}
if ( count )
{
root = tc->InsertItem ( "Changes" );
}
else
{
root = tc->InsertItem ( "No Changes" );
}
label_count = 0;
db = FirstTransDB ( );
while ( db )
{
char buffer[100];
if ( db->IsChanged ())
{
sprintf ( buffer, "%s%s", title, db->Name());
MainDLG->Status ( buffer, FALSE );
db->AddToTree ( tc, root, TRUE, progress_cb );
}
db = db->Next ();
}
if ( MainDLG )
{
MainDLG->ProgressComplete ( );
MainDLG->Log ("OK", SAME_LINE );
MainDLG->Ready ();
}
tc->Expand ( root, TVE_EXPAND );
return root;
}
BOOL VIEWDBSII::OnInitDialog()
{
HTREEITEM root;
CDialog::OnInitDialog();
// TODO: Add extra initialization here
if ( !ViewChanges )
{
root = create_full_view ();
}
else
{
root = create_changes_view ();
}
MainDLG->Ready();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void VIEWDBSII::OnClose()
{
// TODO: Add your message handler code here and/or call default
CTreeCtrl *tc = ( CTreeCtrl *) GetDlgItem ( IDC_TREEVIEW );
HTREEITEM root = tc->GetRootItem ();
tc->Expand ( root, TVE_COLLAPSE );
tc->DeleteAllItems ();
CDialog::OnClose();
}

View file

@ -0,0 +1,673 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//
// XLStuff.cpp
//
//
#include "stdAfx.h"
#include "Babylon.h"
#include "resource.h"
#include <stdio.h>
#include "xlstuff.h"
#include <assert.h>
#include <comdef.h>
static const int xlWorkbookNormal = -4143;
static const int xlNoChange = 1;
static const int xlLocalSessionChanges = 2;
static const int xlWBATWorksheet = -4167;
static _Workbook *workbook = NULL;
static _Application *xl = NULL;
static Workbooks *wbs = NULL;
static Range *range = NULL;
static _Worksheet *ws = NULL;
static OLECHAR buffer[100*1024];
static VARIANT no, yes, dummy, dummy0, nullstring, empty;
static VARIANT continuous, automatic, medium, thin, none;
static VARIANT yellow, solid;
static VARIANT GetCell ( int row, int column )
{
VARIANT cell;
VARIANT result;
LPDISPATCH dispatch;
OLECHAR cellname[20];
V_VT ( &cell ) = VT_EMPTY;
assert ( column > 0 );
swprintf ( cellname, L"%c%d", 'A'+column -1 , row );
V_VT ( &cell ) = VT_BSTR;
V_BSTR ( &cell ) = SysAllocString (cellname);
V_VT ( &result ) = VT_BOOL;
V_BOOL ( &result ) = FALSE;
if ( !ws )
{
goto error;
}
if ( ! (dispatch = ws->GetRange (cell, cell )))
{
goto error;
}
range->AttachDispatch ( dispatch );
result = range->GetValue ();
range->ReleaseDispatch ( );
error:
VariantClear ( &cell );
return result;
}
int PutCell ( int row, int column, OLECHAR *string, int val )
{
VARIANT cell;
VARIANT newValue;
int ok = FALSE;
LPDISPATCH dispatch;
OLECHAR cellname[20];
V_VT ( &newValue ) = VT_EMPTY;
V_VT ( &cell ) = VT_EMPTY;
assert ( column > 0 );
swprintf ( cellname, L"%c%d", 'A'+column-1, row );
V_VT ( &cell ) = VT_BSTR;
V_BSTR ( &cell ) = SysAllocString (cellname);
if ( !ws )
{
goto error;
}
if ( ! (dispatch = ws->GetRange (cell, cell )))
{
goto error;
}
range->AttachDispatch ( dispatch );
if ( string )
{
V_VT ( &newValue ) = VT_BSTR;
if ( string[0] == '\'')
{
buffer[0] = '\\';
wcscpy ( &buffer[1], string );
V_BSTR ( &newValue ) = SysAllocString ( buffer );
}
else
{
V_BSTR ( &newValue ) = SysAllocString ( string );
}
}
else
{
V_VT ( &newValue ) = VT_I4;
V_I4 ( &newValue ) = val;
}
range->SetValue ( newValue );
range->ReleaseDispatch ( );
ok = TRUE;
error:
VariantClear ( &cell );
VariantClear ( &newValue );
return ok;
}
int PutSeparator ( int row )
{
// Rows(row).Select
// Selection.Borders(xlDiagonalDown).LineStyle = xlNone
// Selection.Borders(xlDiagonalUp).LineStyle = xlNone
// Selection.Borders(xlEdgeLeft).LineStyle = xlNone
// Selection.Borders(xlEdgeTop).LineStyle = xlNone
// With Selection.Borders(xlEdgeBottom)
// .LineStyle = xlContinuous
// .Weight = xlMedium
// .ColorIndex = xlAutomatic
// End With
// With Selection.Borders(xlEdgeRight)
// .LineStyle = xlContinuous
// .Weight = xlThin
// .ColorIndex = xlAutomatic
// End With
int ok = FALSE;
Border *border = NULL;
Borders *borders = NULL;
LPDISPATCH dispatch;
OLECHAR cellname1[20];
OLECHAR cellname2[20];
VARIANT cell1,cell2;
if ( !ws )
{
goto error;
}
assert ( row > 0 );
swprintf ( cellname1, L"A%d", row );
swprintf ( cellname2, L"%c%d", 'A'+CELL_LAST-1-1, row );
V_VT ( &cell1 ) = VT_BSTR;
V_BSTR ( &cell1 ) = SysAllocString (cellname1);
V_VT ( &cell2 ) = VT_BSTR;
V_BSTR ( &cell2 ) = SysAllocString (cellname2);
if ( ! (dispatch = ws->GetRange (cell1, cell2 )))
{
goto error;
}
range->AttachDispatch ( dispatch );
dispatch = range->GetBorders ();
borders = new Borders ( dispatch );
if ( !borders )
{
goto error;
}
dispatch = borders->GetItem ( xlEdgeBottom );
border = new Border ( dispatch );
if ( !border )
{
goto error;
}
border->SetLineStyle ( continuous );
border->SetColorIndex ( automatic );
border->SetWeight ( thin );
ok = TRUE;
error:
range->ReleaseDispatch ( );
if ( borders )
{
delete borders ;
}
if ( border )
{
delete border ;
}
VariantClear ( &cell1 );
VariantClear ( &cell2 );
return ok;
}
int PutSection ( int row, OLECHAR *title )
{
int ok = FALSE;
Range *range = NULL;
Border *border = NULL;
Borders *borders = NULL;
Interior *interior = NULL;
LPDISPATCH dispatch;
OLECHAR cellname1[20];
OLECHAR cellname2[20];
VARIANT cell1,cell2;
_Worksheet *ws = NULL;
if ( !ws )
{
goto error;
}
assert ( row > 0 );
swprintf ( cellname1, L"A%d", row );
swprintf ( cellname2, L"%c%d", 'A'+CELL_LAST-1-1, row );
V_VT ( &cell1 ) = VT_BSTR;
V_BSTR ( &cell1 ) = SysAllocString (cellname1);
V_VT ( &cell2 ) = VT_BSTR;
V_BSTR ( &cell2 ) = SysAllocString (cellname2);
if ( ! (dispatch = ws->GetRange (cell1, cell2 )))
{
goto error;
}
range->AttachDispatch ( dispatch );
dispatch = range->GetBorders ();
borders = new Borders ( dispatch );
if ( !borders )
{
goto error;
}
dispatch = borders->GetItem ( xlEdgeBottom );
border = new Border ( dispatch );
if ( !border )
{
goto error;
}
border->SetLineStyle ( continuous );
border->SetColorIndex ( automatic );
border->SetWeight ( thin );
delete border;
border = NULL;
dispatch = borders->GetItem ( xlEdgeTop );
border = new Border ( dispatch );
if ( !border )
{
goto error;
}
border->SetLineStyle ( continuous );
border->SetColorIndex ( automatic );
border->SetWeight ( medium );
delete border;
border = NULL;
dispatch = borders->GetItem ( xlEdgeRight );
border = new Border ( dispatch );
if ( !border )
{
goto error;
}
border->SetLineStyle ( none );
delete border;
border = NULL;
dispatch = borders->GetItem ( xlEdgeLeft );
border = new Border ( dispatch );
if ( !border )
{
goto error;
}
border->SetLineStyle ( none );
dispatch = range->GetInterior ( );
interior = new Interior ( dispatch );
if ( !interior )
{
goto error;
}
interior->SetColorIndex ( yellow );
interior->SetPattern ( solid );
PutCell ( row, 1, L"Section", 0 );
PutCell ( row, 2, title, 0 );
ok = TRUE;
error:
range->ReleaseDispatch ( );
if ( borders )
{
delete borders ;
}
if ( border )
{
delete border ;
}
VariantClear ( &cell1 );
VariantClear ( &cell2 );
return ok;
}
int OpenExcel ( void )
{
LPDISPATCH dispatch;
if ( xl )
{
return TRUE;
}
#if 0
while ( ExcelRunning ())
{
if ( AfxMessageBox ( "Excel is running!\n\nClose or kill all instances of Excel and retry\n\nNOTE: Check task tray (CTRL-ALT-DELETE) for instances of Excel", MB_OKCANCEL ) == IDCANCEL )
{
return FALSE;
}
}
#endif
xl = new _Application();
if ( !xl )
{
return FALSE;
}
if ( !xl->CreateDispatch ("Excel.Application"))
{
goto error_access;
}
dispatch = xl->GetWorkbooks ( );
if ( dispatch )
{
wbs = new Workbooks( dispatch );
}
if ( !wbs )
{
return FALSE;
}
if ( ! (ws = new _Worksheet ()))
{
return FALSE;
}
if ( ! (range = new Range ()))
{
return FALSE;
}
V_VT ( &no ) = VT_BOOL;
V_VT ( &yes ) = VT_BOOL;
V_VT ( &dummy ) = VT_I4;
V_VT ( &dummy0 ) = VT_I4;
V_VT ( &nullstring ) = VT_BSTR ;
V_VT ( &empty ) = VT_EMPTY;
V_VT ( &continuous ) = VT_I4;
V_VT ( &automatic ) = VT_I4;
V_VT ( &medium ) = VT_I4;
V_VT ( &thin ) = VT_I4;
V_VT ( &none ) = VT_I4;
V_VT ( &solid ) = VT_I4;
V_VT ( &yellow ) = VT_I4;
V_BOOL ( &no ) = FALSE;
V_BOOL ( &yes ) = TRUE;
V_I4 ( &dummy ) = 1;
V_I4 ( &dummy0 ) = 0;
V_BSTR ( &nullstring ) = SysAllocString ( OLESTR ("") );
V_I4 ( &continuous ) = xlContinuous;
V_I4 ( &automatic ) = xlAutomatic;
V_I4 ( &medium ) = xlMedium;
V_I4 ( &thin ) = xlThin;
V_I4 ( &none ) = xlThin;
V_I4 ( &solid ) = xlSolid;
V_I4 ( &yellow ) = 6;
return TRUE;
error_access:
AfxMessageBox ("Could not access Excel!\n\nMake sure Excel is installed on this system.");
return FALSE;
}
void CloseExcel ( void )
{
CloseWorkBook ();
if ( range )
{
delete range;
range = NULL;
}
if ( ws )
{
delete ws;
ws = NULL;
}
if ( wbs )
{
wbs->Close();
delete wbs;
wbs = NULL;
}
if ( xl )
{
xl->Quit();
xl->ReleaseDispatch ();
delete xl;
xl = NULL;
}
VariantClear ( &nullstring );
}
int OpenWorkBook ( const char *filename )
{
LPDISPATCH dispatch;
dispatch = wbs->Open ((LPCTSTR) filename, dummy0, yes, dummy, nullstring, nullstring, yes, dummy, dummy, no, no, dummy, no );
if ( dispatch )
{
workbook = new _Workbook ( dispatch );
}
if ( !workbook )
{
return FALSE;
}
SelectActiveSheet ( );
return TRUE;
}
int NewWorkBook ( const char *path )
{
LPDISPATCH dispatch;
VARIANT temp;
char tfile[200];
char *p;
WIN32_FIND_DATA finfo;
HANDLE handle;
V_VT ( &temp ) = VT_I4;
V_I4 ( &temp ) = xlWBATWorksheet;
if ( path )
{
strcpy ( tfile, path );
if ( (p = strchr ( tfile, '.' )))
{
*p = 0;
}
strcpy ( p, ".xlt" );
if ( (handle = FindFirstFile ( tfile, &finfo)) != INVALID_HANDLE_VALUE )
{
if ( !(finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
{
swprintf ( buffer, L"%S", tfile );
V_VT ( &temp ) = VT_BSTR;
V_BSTR ( &temp ) = SysAllocString ( buffer );
}
FindClose ( handle );
}
}
dispatch = wbs->Add ( temp );
VariantClear ( &temp );
if ( dispatch )
{
workbook = new _Workbook ( dispatch );
}
if ( !workbook )
{
return FALSE;
}
SelectActiveSheet ( );
return TRUE;
}
int SaveWorkBook ( const char *filename, int protect )
{
VARIANT name, fileformat, rc;
V_VT ( &name ) = VT_BSTR;
swprintf ( buffer, L"%S", filename );
V_BSTR ( &name ) = SysAllocString ( buffer );
V_VT ( &fileformat ) = VT_I4;
V_I4 ( &fileformat ) = xlWorkbookNormal;
V_VT ( &rc ) = VT_I4;
V_I4 ( &rc ) = xlLocalSessionChanges;
if ( protect )
{
VARIANT password;
V_VT ( &password ) = VT_BSTR;
V_BSTR ( &password ) = SysAllocString ( L"" );
ws->Protect ( password, yes, yes, yes, no );
VariantClear ( &password );
}
workbook->SaveAs ( name, fileformat, nullstring, nullstring, no, no,
xlNoChange, rc, no, empty, empty );
VariantClear ( &name );
return TRUE;
}
void CloseWorkBook ( void )
{
if ( workbook )
{
workbook->SetSaved ( TRUE );
workbook->Close ( no, nullstring, no );
delete workbook;
workbook = NULL;
}
}
void SelectActiveSheet ( void )
{
LPDISPATCH dispatch;
if ( ! (dispatch = xl->GetActiveSheet ()))
{
return;
}
ws->ReleaseDispatch ( );
ws->AttachDispatch ( dispatch );
}
int GetInt ( int row, int cell )
{
long value;
VARIANT var;
_variant_t v;
var = GetCell ( row, cell );
v.Attach ( var );
value = v;
return (int) value;
}
int GetString ( int row, int cell, OLECHAR *string )
{
VARIANT var;
string[0] =0;
var = GetCell ( row, cell );
if ( V_VT ( &var ) == VT_BSTR )
{
wcscpy ( string, V_BSTR ( &var ));
}
VariantClear ( &var );
return 1;
}

View file

@ -0,0 +1,262 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//
// XLStuff.h
//
//
#ifndef XLSTUFF_H
#define XLSTUFF_H
#include "BabylonDlg.h"
typedef enum {
xlAll = -4104,
xlAutomatic = -4105,
xlBoth = 1,
xlCenter = -4108,
xlChecker = 9,
xlCircle = 8,
xlCorner = 2,
xlCrissCross = 16,
xlCross = 4,
xlDiamond = 2,
xlDistributed = -4117,
xlDoubleAccounting = 5,
xlFixedValue = 1,
xlFormats = -4122,
xlGray16 = 17,
xlGray8 = 18,
xlGrid = 15,
xlHigh = -4127,
xlInside = 2,
xlJustify = -4130,
xlLightDown = 13,
xlLightHorizontal = 11,
xlLightUp = 14,
xlLightVertical = 12,
xlLow = -4134,
xlManual = -4135,
xlMinusValues = 3,
xlModule = -4141,
xlNextToAxis = 4,
xlNone = -4142,
xlNotes = -4144,
xlOff = -4146,
xlOn = 1,
xlPercent = 2,
xlPlus = 9,
xlPlusValues = 2,
xlSemiGray75 = 10,
xlShowLabel = 4,
xlShowLabelAndPercent = 5,
xlShowPercent = 3,
xlShowValue = 2,
xlSimple = -4154,
xlSingle = 2,
xlSingleAccounting = 4,
xlSolid = 1,
xlSquare = 1,
xlStar = 5,
xlStError = 4,
xlToolbarButton = 2,
xlTriangle = 3,
xlGray25 = -4124,
xlGray50 = -4125,
xlGray75 = -4126,
xlBottom = -4107,
xlLeft = -4131,
xlRight = -4152,
xlTop = -4160,
xl3DBar = -4099,
xl3DSurface = -4103,
xlBar = 2,
xlColumn = 3,
xlCombination = -4111,
xlCustom = -4114,
xlDefaultAutoFormat = -1,
xlMaximum = 2,
xlMinimum = 4,
xlOpaque = 3,
xlTransparent = 2,
xlBidi = -5000,
xlLatin = -5001,
xlContext = -5002,
xlLTR = -5003,
xlRTL = -5004,
xlVisualCursor = 2,
xlLogicalCursor = 1,
xlSystem = 1,
xlPartial = 3,
xlHindiNumerals = 3,
xlBidiCalendar = 3,
xlGregorian = 2,
xlComplete = 4,
xlScale = 3,
xlClosed = 3,
xlColor1 = 7,
xlColor2 = 8,
xlColor3 = 9,
xlConstants = 2,
xlContents = 2,
xlBelow = 1,
xlCascade = 7,
xlCenterAcrossSelection = 7,
xlChart4 = 2,
xlChartSeries = 17,
xlChartShort = 6,
xlChartTitles = 18,
xlClassic1 = 1,
xlClassic2 = 2,
xlClassic3 = 3,
xl3DEffects1 = 13,
xl3DEffects2 = 14,
xlAbove = 0,
xlAccounting1 = 4,
xlAccounting2 = 5,
xlAccounting3 = 6,
xlAccounting4 = 17,
xlAdd = 2,
xlDebugCodePane = 13,
xlDesktop = 9,
xlDirect = 1,
xlDivide = 5,
xlDoubleClosed = 5,
xlDoubleOpen = 4,
xlDoubleQuote = 1,
xlEntireChart = 20,
xlExcelMenus = 1,
xlExtended = 3,
xlFill = 5,
xlFirst = 0,
xlFloating = 5,
xlFormula = 5,
xlGeneral = 1,
xlGridline = 22,
xlIcons = 1,
xlImmediatePane = 12,
xlInteger = 2,
xlLast = 1,
xlLastCell = 11,
xlList1 = 10,
xlList2 = 11,
xlList3 = 12,
xlLocalFormat1 = 15,
xlLocalFormat2 = 16,
xlLong = 3,
xlLotusHelp = 2,
xlMacrosheetCell = 7,
xlMixed = 2,
xlMultiply = 4,
xlNarrow = 1,
xlNoDocuments = 3,
xlOpen = 2,
xlOutside = 3,
xlReference = 4,
xlSemiautomatic = 2,
xlShort = 1,
xlSingleQuote = 2,
xlStrict = 2,
xlSubtract = 3,
xlTextBox = 16,
xlTiled = 1,
xlTitleBar = 8,
xlToolbar = 1,
xlVisible = 12,
xlWatchPane = 11,
xlWide = 3,
xlWorkbookTab = 6,
xlWorksheet4 = 1,
xlWorksheetCell = 3,
xlWorksheetShort = 5,
xlAllExceptBorders = 6,
xlLeftToRight = 2,
xlTopToBottom = 1,
xlVeryHidden = 2,
xlDrawingObject = 14
} Constants;
typedef enum {
xlHairline = 1,
xlMedium = -4138,
xlThick = 4,
xlThin = 2
} XlBorderWeight;
typedef enum {
xlContinuous = 1,
xlDash = -4115,
xlDashDot = 4,
xlDashDotDot = 5,
xlDot = -4118,
xlDouble = -4119,
xlSlantDashDot = 13,
xlLineStyleNone = -4142
} XlLineStyle;
typedef enum {
xlInsideHorizontal = 12,
xlInsideVertical = 11,
xlDiagonalDown = 5,
xlDiagonalUp = 6,
xlEdgeBottom = 9,
xlEdgeLeft = 7,
xlEdgeRight = 10,
xlEdgeTop = 8
} XlBordersIndex;
enum {
CELL_WAVEFILE = 1,
CELL_LABEL,
CELL_SPEAKER,
CELL_LISTENER,
CELL_STRINGID,
CELL_ENGLISH,
CELL_LOCALIZED,
CELL_CONTEXT,
CELL_COMMENT,
CELL_MAXLEN,
CELL_STRLEN,
CELL_LENCHECK,
CELL_REVISION,
CELL_LAST
};
#define ROW_COUNT 1
#define COLUMN_COUNT 2
#define ROW_LANGUAGE 1
#define COLUMN_LANGUAGE 1
int OpenExcel ( void );
void CloseExcel ( void );
int NewWorkBook ( const char *path );
int SaveWorkBook ( const char *filename, int protect = FALSE );
int OpenWorkBook ( const char *filename );
void CloseWorkBook ( void );
int PutCell ( int row, int column, OLECHAR *string, int val );
int PutSeparator ( int row );
int PutSection ( int row, OLECHAR *title );
void SelectActiveSheet ( void );
int GetInt ( int row, int cell );
int GetString ( int row, int cell, OLECHAR *buffer );
#endif // XLSTUFF_H

View file

@ -0,0 +1,404 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//
// Bin.cpp
//
#include "stdAfx.h"
#include "bin.h"
#include "assert.h"
#include "list.h"
Bin::Bin ( int size )
{
assert ( size > 0 );
num_buckets = size;
sh_item = NULL;
bucket = new List[size];
}
Bin::~Bin ( )
{
Clear ();
delete [] bucket;
}
void Bin::Clear ( void )
{
int count = num_buckets;
sh_item = NULL;
while ( count-- )
{
List *head = &bucket[count];
BinItem *item;
while ( ( item = (BinItem *) head->Next ()))
{
Remove ( item );
}
}
}
void* Bin::Get ( OLECHAR *text1, OLECHAR *text2 )
{
BinItem *item;
if ( ( item = GetBinItem ( text1, text2 )) )
{
return item->Item();
}
return NULL;
}
void* Bin::GetNext ( void )
{
BinItem *item;
if ( ( item = GetNextBinItem ( )) )
{
return item->Item();
}
return NULL;
}
void Bin::Add ( void *data, OLECHAR *text1, OLECHAR *text2 )
{
BinItem *item;
List *list;
int hash;
sh_item = NULL;
hash = calc_hash ( text1 );
item = new BinItem ( data, hash, text1, text2 );
list = &bucket[hash%num_buckets];
list->AddToTail ( (ListNode *) item );
}
BinItem* Bin::GetBinItem ( OLECHAR *text1, OLECHAR *text2)
{
sh_size1 = sh_size2 = 0;
sh_text1 = text1;
sh_text2 = text2;
sh_hash = calc_hash ( text1 );
if ( sh_text1 )
{
sh_size1 = wcslen ( sh_text1 );
}
if ( sh_text2 )
{
sh_size2 = wcslen ( sh_text2 );
}
sh_item = (BinItem *) &bucket[sh_hash%num_buckets];
return GetNextBinItem ();
}
BinItem* Bin::GetNextBinItem ( void )
{
if ( sh_item )
{
sh_item = (BinItem *) sh_item->Next ();
}
while ( sh_item )
{
if ( sh_item->Same ( sh_hash, sh_text1, sh_size1, sh_text2, sh_size2 ))
{
break;
}
sh_item = (BinItem *) sh_item->Next ();
}
return sh_item;
}
BinItem* Bin::GetBinItem ( void *item )
{
BinItem *bitem = NULL;
int i;
for ( i=0; i< num_buckets; i++)
{
if ( ( bitem = (BinItem *) bucket[i].Find ( item )))
{
break;
}
}
return bitem;
}
void Bin::Remove ( void *item )
{
BinItem *bitem;
if ( ( bitem = GetBinItem ( item ) ))
{
Remove ( bitem );
}
}
void Bin::Remove ( OLECHAR *text1, OLECHAR *text2 )
{
BinItem *bitem;
if ( ( bitem = GetBinItem ( text1, text2 ) ))
{
Remove ( bitem );
}
}
void Bin::Remove ( BinItem *item )
{
sh_item = NULL;
item->Remove ();
delete item ;
}
BinItem::BinItem ( void *data, int new_hash, OLECHAR *new_text1, OLECHAR *new_text2 )
{
SetItem ( data );
hash = new_hash;
if ( (text1 = new_text1) )
{
text1size = wcslen ( text1 );
}
else
{
text1size = 0;
}
if ( (text2 = new_text2) )
{
text2size = wcslen ( text2 );
}
else
{
text2size = 0;
}
}
int BinItem::Same ( int chash, OLECHAR *ctext1, int size1, OLECHAR *ctext2, int size2 )
{
if ( hash != chash || text1size != size1 || text2size != size2 )
{
return FALSE;
}
if ( wcsicmp ( text1, ctext1 ))
{
return FALSE;
}
if ( text2 && ctext2 && wcsicmp ( text2, ctext2 ))
{
return FALSE;
}
return TRUE;
}
int Bin::calc_hash ( OLECHAR *text )
{
int hash = 0;
while ( *text )
{
hash += *text++;
}
return hash;
}
// Bin ID code
BinID::BinID ( int size )
{
assert ( size > 0 );
num_buckets = size;
bucket = new List[size];
}
BinID::~BinID ( )
{
Clear ();
delete [] bucket;
}
void BinID::Clear ( void )
{
int count = num_buckets;
while ( count-- )
{
List *head = &bucket[count];
BinIDItem *item;
while ( ( item = (BinIDItem *) head->Next ()))
{
Remove ( item );
}
}
}
void* BinID::Get ( int id)
{
BinIDItem *item;
if ( ( item = GetBinIDItem ( id )) )
{
return item->Item();
}
return NULL;
}
void BinID::Add ( void *data, int id )
{
BinIDItem *item;
List *list;
item = new BinIDItem ( data, id );
list = &bucket[id%num_buckets];
list->AddToTail ( (ListNode *) item );
}
BinIDItem* BinID::GetBinIDItem ( int id )
{
BinIDItem *item;
item = (BinIDItem *) bucket[id%num_buckets].Next();
while ( item )
{
if ( item->Same ( id ))
{
break;
}
item = (BinIDItem *) item->Next ();
}
return item ;
}
BinIDItem* BinID::GetBinIDItem ( void *item )
{
BinIDItem *bitem = NULL;
int i;
for ( i=0; i< num_buckets; i++)
{
if ( ( bitem = (BinIDItem *) bucket[i].Find ( item )))
{
break;
}
}
return bitem;
}
void BinID::Remove ( void *item )
{
BinIDItem *bitem;
if ( ( bitem = GetBinIDItem ( item ) ))
{
Remove ( bitem );
}
}
void BinID::Remove ( int id )
{
BinIDItem *bitem;
if ( ( bitem = GetBinIDItem ( id ) ))
{
Remove ( bitem );
}
}
void BinID::Remove ( BinIDItem *item )
{
item->Remove ();
delete item ;
}
BinIDItem::BinIDItem ( void *data, int new_id )
{
SetItem ( data );
id = new_id;
}
int BinIDItem::Same ( int compare_id )
{
return id == compare_id;
}

View file

@ -0,0 +1,108 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//
// Bin.h
//
#ifndef __BIN_H
#define __BIN_H
#include "list.h"
#include "OLEString.h"
class BinItem: public ListNode
{
int hash;
OLECHAR *text1;
int text1size;
OLECHAR *text2;
int text2size;
public:
BinItem ( void *data, int hash, OLECHAR *text1, OLECHAR *text2 );
int Same ( int chash, OLECHAR *ctext1, int size1, OLECHAR *ctext2, int size2 );
};
class Bin
{
List *bucket;
int num_buckets;
BinItem *sh_item;
int sh_size1,sh_size2;
int sh_hash;
OLECHAR *sh_text1, *sh_text2;
int calc_hash ( OLECHAR *text );
public:
Bin ( int size = 256 );
~Bin ();
void Clear ( void );
void* Get ( OLECHAR *text1, OLECHAR *text2 = NULL );
void* GetNext ( void );
void Add ( void *item, OLECHAR *text1, OLECHAR *text2 = NULL );
BinItem* GetBinItem ( OLECHAR *text1, OLECHAR *text2 = NULL );
BinItem* GetBinItem ( void *item );
BinItem* GetNextBinItem ( void );
void Remove ( void *item );
void Remove ( OLECHAR *text1, OLECHAR *text2 = NULL );
void Remove ( BinItem *item );
};
class BinIDItem: public ListNode
{
int id;
public:
BinIDItem ( void *data, int id );
int Same ( int id );
};
class BinID
{
List *bucket;
int num_buckets;
public:
BinID ( int size = 256 );
~BinID ();
void Clear ( void );
void* Get ( int id );
void Add ( void *item, int id );
BinIDItem* GetBinIDItem ( int id );
BinIDItem* GetBinIDItem ( void *item );
void Remove ( void *item );
void Remove ( int id );
void Remove ( BinIDItem *item );
};
#endif // __BIN_H

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,884 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
// Machine generated IDispatch wrapper class(es) created with ClassWizard
/////////////////////////////////////////////////////////////////////////////
// Workbooks wrapper class
class Workbooks : public COleDispatchDriver
{
public:
Workbooks() {} // Calls COleDispatchDriver default constructor
Workbooks(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
Workbooks(const Workbooks& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
LPDISPATCH GetApplication();
long GetCreator();
LPDISPATCH GetParent();
LPDISPATCH Add(const VARIANT& Template);
void Close();
long GetCount();
LPDISPATCH GetItem(const VARIANT& Index);
LPUNKNOWN Get_NewEnum();
LPDISPATCH Open(LPCTSTR Filename, const VARIANT& UpdateLinks, const VARIANT& ReadOnly, const VARIANT& Format, const VARIANT& Password, const VARIANT& WriteResPassword, const VARIANT& IgnoreReadOnlyRecommended, const VARIANT& Origin,
const VARIANT& Delimiter, const VARIANT& Editable, const VARIANT& Notify, const VARIANT& Converter, const VARIANT& AddToMru);
void OpenText(LPCTSTR Filename, const VARIANT& Origin, const VARIANT& StartRow, const VARIANT& DataType, long TextQualifier, const VARIANT& ConsecutiveDelimiter, const VARIANT& Tab, const VARIANT& Semicolon, const VARIANT& Comma,
const VARIANT& Space, const VARIANT& Other, const VARIANT& OtherChar, const VARIANT& FieldInfo, const VARIANT& TextVisualLayout);
LPDISPATCH Get_Default(const VARIANT& Index);
};
/////////////////////////////////////////////////////////////////////////////
// _Application wrapper class
class _Application : public COleDispatchDriver
{
public:
_Application() {} // Calls COleDispatchDriver default constructor
_Application(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
_Application(const _Application& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
LPDISPATCH GetApplication();
long GetCreator();
LPDISPATCH GetParent();
LPDISPATCH GetActiveCell();
LPDISPATCH GetActiveChart();
CString GetActivePrinter();
void SetActivePrinter(LPCTSTR lpszNewValue);
LPDISPATCH GetActiveSheet();
LPDISPATCH GetActiveWindow();
LPDISPATCH GetActiveWorkbook();
LPDISPATCH GetAddIns();
LPDISPATCH GetAssistant();
void Calculate();
LPDISPATCH GetCells();
LPDISPATCH GetCharts();
LPDISPATCH GetColumns();
LPDISPATCH GetCommandBars();
long GetDDEAppReturnCode();
void DDEExecute(long Channel, LPCTSTR String);
long DDEInitiate(LPCTSTR App, LPCTSTR Topic);
void DDEPoke(long Channel, const VARIANT& Item, const VARIANT& Data);
VARIANT DDERequest(long Channel, LPCTSTR Item);
void DDETerminate(long Channel);
VARIANT Evaluate(const VARIANT& Name);
VARIANT _Evaluate(const VARIANT& Name);
VARIANT ExecuteExcel4Macro(LPCTSTR String);
LPDISPATCH Intersect(LPDISPATCH Arg1, LPDISPATCH Arg2, const VARIANT& Arg3, const VARIANT& Arg4, const VARIANT& Arg5, const VARIANT& Arg6, const VARIANT& Arg7, const VARIANT& Arg8, const VARIANT& Arg9, const VARIANT& Arg10,
const VARIANT& Arg11, const VARIANT& Arg12, const VARIANT& Arg13, const VARIANT& Arg14, const VARIANT& Arg15, const VARIANT& Arg16, const VARIANT& Arg17, const VARIANT& Arg18, const VARIANT& Arg19, const VARIANT& Arg20,
const VARIANT& Arg21, const VARIANT& Arg22, const VARIANT& Arg23, const VARIANT& Arg24, const VARIANT& Arg25, const VARIANT& Arg26, const VARIANT& Arg27, const VARIANT& Arg28, const VARIANT& Arg29, const VARIANT& Arg30);
LPDISPATCH GetNames();
LPDISPATCH GetRange(const VARIANT& Cell1, const VARIANT& Cell2);
LPDISPATCH GetRows();
VARIANT Run(const VARIANT& Macro, const VARIANT& Arg1, const VARIANT& Arg2, const VARIANT& Arg3, const VARIANT& Arg4, const VARIANT& Arg5, const VARIANT& Arg6, const VARIANT& Arg7, const VARIANT& Arg8, const VARIANT& Arg9,
const VARIANT& Arg10, const VARIANT& Arg11, const VARIANT& Arg12, const VARIANT& Arg13, const VARIANT& Arg14, const VARIANT& Arg15, const VARIANT& Arg16, const VARIANT& Arg17, const VARIANT& Arg18, const VARIANT& Arg19,
const VARIANT& Arg20, const VARIANT& Arg21, const VARIANT& Arg22, const VARIANT& Arg23, const VARIANT& Arg24, const VARIANT& Arg25, const VARIANT& Arg26, const VARIANT& Arg27, const VARIANT& Arg28, const VARIANT& Arg29,
const VARIANT& Arg30);
VARIANT _Run2(const VARIANT& Macro, const VARIANT& Arg1, const VARIANT& Arg2, const VARIANT& Arg3, const VARIANT& Arg4, const VARIANT& Arg5, const VARIANT& Arg6, const VARIANT& Arg7, const VARIANT& Arg8, const VARIANT& Arg9,
const VARIANT& Arg10, const VARIANT& Arg11, const VARIANT& Arg12, const VARIANT& Arg13, const VARIANT& Arg14, const VARIANT& Arg15, const VARIANT& Arg16, const VARIANT& Arg17, const VARIANT& Arg18, const VARIANT& Arg19,
const VARIANT& Arg20, const VARIANT& Arg21, const VARIANT& Arg22, const VARIANT& Arg23, const VARIANT& Arg24, const VARIANT& Arg25, const VARIANT& Arg26, const VARIANT& Arg27, const VARIANT& Arg28, const VARIANT& Arg29,
const VARIANT& Arg30);
LPDISPATCH GetSelection();
void SendKeys(const VARIANT& Keys, const VARIANT& Wait);
LPDISPATCH GetSheets();
LPDISPATCH GetThisWorkbook();
LPDISPATCH Union(LPDISPATCH Arg1, LPDISPATCH Arg2, const VARIANT& Arg3, const VARIANT& Arg4, const VARIANT& Arg5, const VARIANT& Arg6, const VARIANT& Arg7, const VARIANT& Arg8, const VARIANT& Arg9, const VARIANT& Arg10, const VARIANT& Arg11,
const VARIANT& Arg12, const VARIANT& Arg13, const VARIANT& Arg14, const VARIANT& Arg15, const VARIANT& Arg16, const VARIANT& Arg17, const VARIANT& Arg18, const VARIANT& Arg19, const VARIANT& Arg20, const VARIANT& Arg21,
const VARIANT& Arg22, const VARIANT& Arg23, const VARIANT& Arg24, const VARIANT& Arg25, const VARIANT& Arg26, const VARIANT& Arg27, const VARIANT& Arg28, const VARIANT& Arg29, const VARIANT& Arg30);
LPDISPATCH GetWindows();
LPDISPATCH GetWorkbooks();
LPDISPATCH GetWorksheetFunction();
LPDISPATCH GetWorksheets();
LPDISPATCH GetExcel4IntlMacroSheets();
LPDISPATCH GetExcel4MacroSheets();
void ActivateMicrosoftApp(long Index);
void AddChartAutoFormat(const VARIANT& Chart, LPCTSTR Name, const VARIANT& Description);
void AddCustomList(const VARIANT& ListArray, const VARIANT& ByRow);
BOOL GetAlertBeforeOverwriting();
void SetAlertBeforeOverwriting(BOOL bNewValue);
CString GetAltStartupPath();
void SetAltStartupPath(LPCTSTR lpszNewValue);
BOOL GetAskToUpdateLinks();
void SetAskToUpdateLinks(BOOL bNewValue);
BOOL GetEnableAnimations();
void SetEnableAnimations(BOOL bNewValue);
LPDISPATCH GetAutoCorrect();
long GetBuild();
BOOL GetCalculateBeforeSave();
void SetCalculateBeforeSave(BOOL bNewValue);
long GetCalculation();
void SetCalculation(long nNewValue);
VARIANT GetCaller(const VARIANT& Index);
BOOL GetCanPlaySounds();
BOOL GetCanRecordSounds();
CString GetCaption();
void SetCaption(LPCTSTR lpszNewValue);
BOOL GetCellDragAndDrop();
void SetCellDragAndDrop(BOOL bNewValue);
double CentimetersToPoints(double Centimeters);
BOOL CheckSpelling(LPCTSTR Word, const VARIANT& CustomDictionary, const VARIANT& IgnoreUppercase);
VARIANT GetClipboardFormats(const VARIANT& Index);
BOOL GetDisplayClipboardWindow();
void SetDisplayClipboardWindow(BOOL bNewValue);
long GetCommandUnderlines();
void SetCommandUnderlines(long nNewValue);
BOOL GetConstrainNumeric();
void SetConstrainNumeric(BOOL bNewValue);
VARIANT ConvertFormula(const VARIANT& Formula, long FromReferenceStyle, const VARIANT& ToReferenceStyle, const VARIANT& ToAbsolute, const VARIANT& RelativeTo);
BOOL GetCopyObjectsWithCells();
void SetCopyObjectsWithCells(BOOL bNewValue);
long GetCursor();
void SetCursor(long nNewValue);
long GetCustomListCount();
long GetCutCopyMode();
void SetCutCopyMode(long nNewValue);
long GetDataEntryMode();
void SetDataEntryMode(long nNewValue);
CString Get_Default();
CString GetDefaultFilePath();
void SetDefaultFilePath(LPCTSTR lpszNewValue);
void DeleteChartAutoFormat(LPCTSTR Name);
void DeleteCustomList(long ListNum);
LPDISPATCH GetDialogs();
BOOL GetDisplayAlerts();
void SetDisplayAlerts(BOOL bNewValue);
BOOL GetDisplayFormulaBar();
void SetDisplayFormulaBar(BOOL bNewValue);
BOOL GetDisplayFullScreen();
void SetDisplayFullScreen(BOOL bNewValue);
BOOL GetDisplayNoteIndicator();
void SetDisplayNoteIndicator(BOOL bNewValue);
long GetDisplayCommentIndicator();
void SetDisplayCommentIndicator(long nNewValue);
BOOL GetDisplayExcel4Menus();
void SetDisplayExcel4Menus(BOOL bNewValue);
BOOL GetDisplayRecentFiles();
void SetDisplayRecentFiles(BOOL bNewValue);
BOOL GetDisplayScrollBars();
void SetDisplayScrollBars(BOOL bNewValue);
BOOL GetDisplayStatusBar();
void SetDisplayStatusBar(BOOL bNewValue);
void DoubleClick();
BOOL GetEditDirectlyInCell();
void SetEditDirectlyInCell(BOOL bNewValue);
BOOL GetEnableAutoComplete();
void SetEnableAutoComplete(BOOL bNewValue);
long GetEnableCancelKey();
void SetEnableCancelKey(long nNewValue);
BOOL GetEnableSound();
void SetEnableSound(BOOL bNewValue);
VARIANT GetFileConverters(const VARIANT& Index1, const VARIANT& Index2);
LPDISPATCH GetFileSearch();
LPDISPATCH GetFileFind();
void FindFile();
BOOL GetFixedDecimal();
void SetFixedDecimal(BOOL bNewValue);
long GetFixedDecimalPlaces();
void SetFixedDecimalPlaces(long nNewValue);
VARIANT GetCustomListContents(long ListNum);
long GetCustomListNum(const VARIANT& ListArray);
VARIANT GetOpenFilename(const VARIANT& FileFilter, const VARIANT& FilterIndex, const VARIANT& Title, const VARIANT& ButtonText, const VARIANT& MultiSelect);
VARIANT GetSaveAsFilename(const VARIANT& InitialFilename, const VARIANT& FileFilter, const VARIANT& FilterIndex, const VARIANT& Title, const VARIANT& ButtonText);
void Goto(const VARIANT& Reference, const VARIANT& Scroll);
double GetHeight();
void SetHeight(double newValue);
void Help(const VARIANT& HelpFile, const VARIANT& HelpContextID);
BOOL GetIgnoreRemoteRequests();
void SetIgnoreRemoteRequests(BOOL bNewValue);
double InchesToPoints(double Inches);
VARIANT InputBox(LPCTSTR Prompt, const VARIANT& Title, const VARIANT& Default, const VARIANT& Left, const VARIANT& Top, const VARIANT& HelpFile, const VARIANT& HelpContextID, const VARIANT& Type);
BOOL GetInteractive();
void SetInteractive(BOOL bNewValue);
VARIANT GetInternational(const VARIANT& Index);
BOOL GetIteration();
void SetIteration(BOOL bNewValue);
double GetLeft();
void SetLeft(double newValue);
CString GetLibraryPath();
void MacroOptions(const VARIANT& Macro, const VARIANT& Description, const VARIANT& HasMenu, const VARIANT& MenuText, const VARIANT& HasShortcutKey, const VARIANT& ShortcutKey, const VARIANT& Category, const VARIANT& StatusBar,
const VARIANT& HelpContextID, const VARIANT& HelpFile);
void MailLogoff();
void MailLogon(const VARIANT& Name, const VARIANT& Password, const VARIANT& DownloadNewMail);
VARIANT GetMailSession();
long GetMailSystem();
BOOL GetMathCoprocessorAvailable();
double GetMaxChange();
void SetMaxChange(double newValue);
long GetMaxIterations();
void SetMaxIterations(long nNewValue);
long GetMemoryFree();
long GetMemoryTotal();
long GetMemoryUsed();
BOOL GetMouseAvailable();
BOOL GetMoveAfterReturn();
void SetMoveAfterReturn(BOOL bNewValue);
long GetMoveAfterReturnDirection();
void SetMoveAfterReturnDirection(long nNewValue);
LPDISPATCH GetRecentFiles();
CString GetName();
LPDISPATCH NextLetter();
CString GetNetworkTemplatesPath();
LPDISPATCH GetODBCErrors();
long GetODBCTimeout();
void SetODBCTimeout(long nNewValue);
void OnKey(LPCTSTR Key, const VARIANT& Procedure);
void OnRepeat(LPCTSTR Text, LPCTSTR Procedure);
void OnTime(const VARIANT& EarliestTime, LPCTSTR Procedure, const VARIANT& LatestTime, const VARIANT& Schedule);
void OnUndo(LPCTSTR Text, LPCTSTR Procedure);
CString GetOnWindow();
void SetOnWindow(LPCTSTR lpszNewValue);
CString GetOperatingSystem();
CString GetOrganizationName();
CString GetPath();
CString GetPathSeparator();
VARIANT GetPreviousSelections(const VARIANT& Index);
BOOL GetPivotTableSelection();
void SetPivotTableSelection(BOOL bNewValue);
BOOL GetPromptForSummaryInfo();
void SetPromptForSummaryInfo(BOOL bNewValue);
void Quit();
void RecordMacro(const VARIANT& BasicCode, const VARIANT& XlmCode);
BOOL GetRecordRelative();
long GetReferenceStyle();
void SetReferenceStyle(long nNewValue);
VARIANT GetRegisteredFunctions(const VARIANT& Index1, const VARIANT& Index2);
BOOL RegisterXLL(LPCTSTR Filename);
void Repeat();
BOOL GetRollZoom();
void SetRollZoom(BOOL bNewValue);
void SaveWorkspace(const VARIANT& Filename);
BOOL GetScreenUpdating();
void SetScreenUpdating(BOOL bNewValue);
void SetDefaultChart(const VARIANT& FormatName, const VARIANT& Gallery);
long GetSheetsInNewWorkbook();
void SetSheetsInNewWorkbook(long nNewValue);
BOOL GetShowChartTipNames();
void SetShowChartTipNames(BOOL bNewValue);
BOOL GetShowChartTipValues();
void SetShowChartTipValues(BOOL bNewValue);
CString GetStandardFont();
void SetStandardFont(LPCTSTR lpszNewValue);
double GetStandardFontSize();
void SetStandardFontSize(double newValue);
CString GetStartupPath();
VARIANT GetStatusBar();
void SetStatusBar(const VARIANT& newValue);
CString GetTemplatesPath();
BOOL GetShowToolTips();
void SetShowToolTips(BOOL bNewValue);
double GetTop();
void SetTop(double newValue);
long GetDefaultSaveFormat();
void SetDefaultSaveFormat(long nNewValue);
CString GetTransitionMenuKey();
void SetTransitionMenuKey(LPCTSTR lpszNewValue);
long GetTransitionMenuKeyAction();
void SetTransitionMenuKeyAction(long nNewValue);
BOOL GetTransitionNavigKeys();
void SetTransitionNavigKeys(BOOL bNewValue);
void Undo();
double GetUsableHeight();
double GetUsableWidth();
BOOL GetUserControl();
void SetUserControl(BOOL bNewValue);
CString GetUserName_();
void SetUserName(LPCTSTR lpszNewValue);
CString GetValue();
LPDISPATCH GetVbe();
CString GetVersion();
BOOL GetVisible();
void SetVisible(BOOL bNewValue);
void Volatile(const VARIANT& Volatile);
void Wait(const VARIANT& Time);
double GetWidth();
void SetWidth(double newValue);
BOOL GetWindowsForPens();
long GetWindowState();
void SetWindowState(long nNewValue);
long GetUILanguage();
void SetUILanguage(long nNewValue);
long GetDefaultSheetDirection();
void SetDefaultSheetDirection(long nNewValue);
long GetCursorMovement();
void SetCursorMovement(long nNewValue);
long GetControlCharacters();
void SetControlCharacters(long nNewValue);
BOOL GetEnableEvents();
void SetEnableEvents(BOOL bNewValue);
};
/////////////////////////////////////////////////////////////////////////////
// _Workbook wrapper class
class _Workbook : public COleDispatchDriver
{
public:
_Workbook() {} // Calls COleDispatchDriver default constructor
_Workbook(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
_Workbook(const _Workbook& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
LPDISPATCH GetApplication();
long GetCreator();
LPDISPATCH GetParent();
BOOL GetAcceptLabelsInFormulas();
void SetAcceptLabelsInFormulas(BOOL bNewValue);
void Activate();
LPDISPATCH GetActiveChart();
LPDISPATCH GetActiveSheet();
long GetAutoUpdateFrequency();
void SetAutoUpdateFrequency(long nNewValue);
BOOL GetAutoUpdateSaveChanges();
void SetAutoUpdateSaveChanges(BOOL bNewValue);
long GetChangeHistoryDuration();
void SetChangeHistoryDuration(long nNewValue);
LPDISPATCH GetBuiltinDocumentProperties();
void ChangeFileAccess(long Mode, const VARIANT& WritePassword, const VARIANT& Notify);
void ChangeLink(LPCTSTR Name, LPCTSTR NewName, long Type);
LPDISPATCH GetCharts();
void Close(const VARIANT& SaveChanges, const VARIANT& Filename, const VARIANT& RouteWorkbook);
CString GetCodeName();
CString Get_CodeName();
void Set_CodeName(LPCTSTR lpszNewValue);
VARIANT GetColors(const VARIANT& Index);
void SetColors(const VARIANT& Index, const VARIANT& newValue);
LPDISPATCH GetCommandBars();
long GetConflictResolution();
void SetConflictResolution(long nNewValue);
LPDISPATCH GetContainer();
BOOL GetCreateBackup();
LPDISPATCH GetCustomDocumentProperties();
BOOL GetDate1904();
void SetDate1904(BOOL bNewValue);
void DeleteNumberFormat(LPCTSTR NumberFormat);
long GetDisplayDrawingObjects();
void SetDisplayDrawingObjects(long nNewValue);
BOOL ExclusiveAccess();
long GetFileFormat();
void ForwardMailer();
CString GetFullName();
BOOL GetHasPassword();
BOOL GetHasRoutingSlip();
void SetHasRoutingSlip(BOOL bNewValue);
BOOL GetIsAddin();
void SetIsAddin(BOOL bNewValue);
VARIANT LinkInfo(LPCTSTR Name, long LinkInfo, const VARIANT& Type, const VARIANT& EditionRef);
VARIANT LinkSources(const VARIANT& Type);
LPDISPATCH GetMailer();
void MergeWorkbook(const VARIANT& Filename);
BOOL GetMultiUserEditing();
CString GetName();
LPDISPATCH GetNames();
LPDISPATCH NewWindow();
void OpenLinks(LPCTSTR Name, const VARIANT& ReadOnly, const VARIANT& Type);
CString GetPath();
BOOL GetPersonalViewListSettings();
void SetPersonalViewListSettings(BOOL bNewValue);
BOOL GetPersonalViewPrintSettings();
void SetPersonalViewPrintSettings(BOOL bNewValue);
LPDISPATCH PivotCaches();
void Post(const VARIANT& DestName);
BOOL GetPrecisionAsDisplayed();
void SetPrecisionAsDisplayed(BOOL bNewValue);
void PrintOut(const VARIANT& From, const VARIANT& To, const VARIANT& Copies, const VARIANT& Preview, const VARIANT& ActivePrinter, const VARIANT& PrintToFile, const VARIANT& Collate);
void PrintPreview(const VARIANT& EnableChanges);
void Protect(const VARIANT& Password, const VARIANT& Structure, const VARIANT& Windows);
void ProtectSharing(const VARIANT& Filename, const VARIANT& Password, const VARIANT& WriteResPassword, const VARIANT& ReadOnlyRecommended, const VARIANT& CreateBackup, const VARIANT& SharingPassword);
BOOL GetProtectStructure();
BOOL GetProtectWindows();
BOOL GetReadOnly();
BOOL GetReadOnlyRecommended();
void RefreshAll();
void Reply();
void ReplyAll();
void RemoveUser(long Index);
long GetRevisionNumber();
void Route();
BOOL GetRouted();
LPDISPATCH GetRoutingSlip();
void RunAutoMacros(long Which);
void Save();
void SaveAs(const VARIANT& Filename, const VARIANT& FileFormat, const VARIANT& Password, const VARIANT& WriteResPassword, const VARIANT& ReadOnlyRecommended, const VARIANT& CreateBackup, long AccessMode, const VARIANT& ConflictResolution,
const VARIANT& AddToMru, const VARIANT& TextCodepage, const VARIANT& TextVisualLayout);
void SaveCopyAs(const VARIANT& Filename);
BOOL GetSaved();
void SetSaved(BOOL bNewValue);
BOOL GetSaveLinkValues();
void SetSaveLinkValues(BOOL bNewValue);
void SendMail(const VARIANT& Recipients, const VARIANT& Subject, const VARIANT& ReturnReceipt);
void SendMailer(const VARIANT& FileFormat, long Priority);
void SetLinkOnData(LPCTSTR Name, const VARIANT& Procedure);
LPDISPATCH GetSheets();
BOOL GetShowConflictHistory();
void SetShowConflictHistory(BOOL bNewValue);
LPDISPATCH GetStyles();
void Unprotect(const VARIANT& Password);
void UnprotectSharing(const VARIANT& SharingPassword);
void UpdateFromFile();
void UpdateLink(const VARIANT& Name, const VARIANT& Type);
BOOL GetUpdateRemoteReferences();
void SetUpdateRemoteReferences(BOOL bNewValue);
VARIANT GetUserStatus();
LPDISPATCH GetCustomViews();
LPDISPATCH GetWindows();
LPDISPATCH GetWorksheets();
BOOL GetWriteReserved();
CString GetWriteReservedBy();
LPDISPATCH GetExcel4IntlMacroSheets();
LPDISPATCH GetExcel4MacroSheets();
BOOL GetTemplateRemoveExtData();
void SetTemplateRemoveExtData(BOOL bNewValue);
void HighlightChangesOptions(const VARIANT& When, const VARIANT& Who, const VARIANT& Where);
BOOL GetHighlightChangesOnScreen();
void SetHighlightChangesOnScreen(BOOL bNewValue);
BOOL GetKeepChangeHistory();
void SetKeepChangeHistory(BOOL bNewValue);
BOOL GetListChangesOnNewSheet();
void SetListChangesOnNewSheet(BOOL bNewValue);
void PurgeChangeHistoryNow(long Days, const VARIANT& SharingPassword);
void AcceptAllChanges(const VARIANT& When, const VARIANT& Who, const VARIANT& Where);
void RejectAllChanges(const VARIANT& When, const VARIANT& Who, const VARIANT& Where);
void ResetColors();
LPDISPATCH GetVBProject();
void FollowHyperlink(LPCTSTR Address, const VARIANT& SubAddress, const VARIANT& NewWindow, const VARIANT& AddHistory, const VARIANT& ExtraInfo, const VARIANT& Method, const VARIANT& HeaderInfo);
void AddToFavorites();
BOOL GetIsInplace();
};
/////////////////////////////////////////////////////////////////////////////
// _Worksheet wrapper class
class _Worksheet : public COleDispatchDriver
{
public:
_Worksheet() {} // Calls COleDispatchDriver default constructor
_Worksheet(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
_Worksheet(const _Worksheet& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
LPDISPATCH GetApplication();
long GetCreator();
LPDISPATCH GetParent();
void Activate();
void Copy(const VARIANT& Before, const VARIANT& After);
void Delete();
CString GetCodeName();
CString Get_CodeName();
void Set_CodeName(LPCTSTR lpszNewValue);
long GetIndex();
void Move(const VARIANT& Before, const VARIANT& After);
CString GetName();
void SetName(LPCTSTR lpszNewValue);
LPDISPATCH GetNext();
LPDISPATCH GetPageSetup();
LPDISPATCH GetPrevious();
void PrintOut(const VARIANT& From, const VARIANT& To, const VARIANT& Copies, const VARIANT& Preview, const VARIANT& ActivePrinter, const VARIANT& PrintToFile, const VARIANT& Collate);
void PrintPreview(const VARIANT& EnableChanges);
void Protect(const VARIANT& Password, const VARIANT& DrawingObjects, const VARIANT& Contents, const VARIANT& Scenarios, const VARIANT& UserInterfaceOnly);
BOOL GetProtectContents();
BOOL GetProtectDrawingObjects();
BOOL GetProtectionMode();
BOOL GetProtectScenarios();
void SaveAs(LPCTSTR Filename, const VARIANT& FileFormat, const VARIANT& Password, const VARIANT& WriteResPassword, const VARIANT& ReadOnlyRecommended, const VARIANT& CreateBackup, const VARIANT& AddToMru, const VARIANT& TextCodepage,
const VARIANT& TextVisualLayout);
void Select(const VARIANT& Replace);
void Unprotect(const VARIANT& Password);
long GetVisible();
void SetVisible(long nNewValue);
LPDISPATCH GetShapes();
BOOL GetTransitionExpEval();
void SetTransitionExpEval(BOOL bNewValue);
BOOL GetAutoFilterMode();
void SetAutoFilterMode(BOOL bNewValue);
void SetBackgroundPicture(LPCTSTR Filename);
void Calculate();
BOOL GetEnableCalculation();
void SetEnableCalculation(BOOL bNewValue);
LPDISPATCH GetCells();
LPDISPATCH ChartObjects(const VARIANT& Index);
void CheckSpelling(const VARIANT& CustomDictionary, const VARIANT& IgnoreUppercase, const VARIANT& AlwaysSuggest, const VARIANT& IgnoreInitialAlefHamza, const VARIANT& IgnoreFinalYaa, const VARIANT& SpellScript);
LPDISPATCH GetCircularReference();
void ClearArrows();
LPDISPATCH GetColumns();
long GetConsolidationFunction();
VARIANT GetConsolidationOptions();
VARIANT GetConsolidationSources();
BOOL GetEnableAutoFilter();
void SetEnableAutoFilter(BOOL bNewValue);
long GetEnableSelection();
void SetEnableSelection(long nNewValue);
BOOL GetEnableOutlining();
void SetEnableOutlining(BOOL bNewValue);
BOOL GetEnablePivotTable();
void SetEnablePivotTable(BOOL bNewValue);
VARIANT Evaluate(const VARIANT& Name);
VARIANT _Evaluate(const VARIANT& Name);
BOOL GetFilterMode();
void ResetAllPageBreaks();
LPDISPATCH GetNames();
LPDISPATCH OLEObjects(const VARIANT& Index);
LPDISPATCH GetOutline();
void Paste(const VARIANT& Destination, const VARIANT& Link);
void PasteSpecial(const VARIANT& Format, const VARIANT& Link, const VARIANT& DisplayAsIcon, const VARIANT& IconFileName, const VARIANT& IconIndex, const VARIANT& IconLabel);
LPDISPATCH PivotTables(const VARIANT& Index);
LPDISPATCH PivotTableWizard(const VARIANT& SourceType, const VARIANT& SourceData, const VARIANT& TableDestination, const VARIANT& TableName, const VARIANT& RowGrand, const VARIANT& ColumnGrand, const VARIANT& SaveData,
const VARIANT& HasAutoFormat, const VARIANT& AutoPage, const VARIANT& Reserved, const VARIANT& BackgroundQuery, const VARIANT& OptimizeCache, const VARIANT& PageFieldOrder, const VARIANT& PageFieldWrapCount, const VARIANT& ReadData,
const VARIANT& Connection);
LPDISPATCH GetRange(const VARIANT& Cell1, const VARIANT& Cell2);
LPDISPATCH GetRows();
LPDISPATCH Scenarios(const VARIANT& Index);
CString GetScrollArea();
void SetScrollArea(LPCTSTR lpszNewValue);
void ShowAllData();
void ShowDataForm();
double GetStandardHeight();
double GetStandardWidth();
void SetStandardWidth(double newValue);
BOOL GetTransitionFormEntry();
void SetTransitionFormEntry(BOOL bNewValue);
long GetType();
LPDISPATCH GetUsedRange();
LPDISPATCH GetHPageBreaks();
LPDISPATCH GetVPageBreaks();
LPDISPATCH GetQueryTables();
BOOL GetDisplayPageBreaks();
void SetDisplayPageBreaks(BOOL bNewValue);
LPDISPATCH GetComments();
LPDISPATCH GetHyperlinks();
void ClearCircles();
void CircleInvalid();
LPDISPATCH GetAutoFilter();
};
/////////////////////////////////////////////////////////////////////////////
// Range wrapper class
class Range : public COleDispatchDriver
{
public:
Range() {} // Calls COleDispatchDriver default constructor
Range(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
Range(const Range& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
LPDISPATCH GetApplication();
long GetCreator();
LPDISPATCH GetParent();
void Activate();
VARIANT GetAddIndent();
void SetAddIndent(const VARIANT& newValue);
CString GetAddress(const VARIANT& RowAbsolute, const VARIANT& ColumnAbsolute, long ReferenceStyle, const VARIANT& External, const VARIANT& RelativeTo);
CString GetAddressLocal(const VARIANT& RowAbsolute, const VARIANT& ColumnAbsolute, long ReferenceStyle, const VARIANT& External, const VARIANT& RelativeTo);
void AdvancedFilter(long Action, const VARIANT& CriteriaRange, const VARIANT& CopyToRange, const VARIANT& Unique);
void ApplyNames(const VARIANT& Names, const VARIANT& IgnoreRelativeAbsolute, const VARIANT& UseRowColumnNames, const VARIANT& OmitColumn, const VARIANT& OmitRow, long Order, const VARIANT& AppendLast);
void ApplyOutlineStyles();
LPDISPATCH GetAreas();
CString AutoComplete(LPCTSTR String);
void AutoFill(LPDISPATCH Destination, long Type);
void AutoFilter(const VARIANT& Field, const VARIANT& Criteria1, long Operator, const VARIANT& Criteria2, const VARIANT& VisibleDropDown);
void AutoFit();
void AutoFormat(long Format, const VARIANT& Number, const VARIANT& Font, const VARIANT& Alignment, const VARIANT& Border, const VARIANT& Pattern, const VARIANT& Width);
void AutoOutline();
void BorderAround(const VARIANT& LineStyle, long Weight, long ColorIndex, const VARIANT& Color);
LPDISPATCH GetBorders();
void Calculate();
LPDISPATCH GetCells();
LPDISPATCH GetCharacters(const VARIANT& Start, const VARIANT& Length);
void CheckSpelling(const VARIANT& CustomDictionary, const VARIANT& IgnoreUppercase, const VARIANT& AlwaysSuggest, const VARIANT& IgnoreInitialAlefHamza, const VARIANT& IgnoreFinalYaa, const VARIANT& SpellScript);
void Clear();
void ClearContents();
void ClearFormats();
void ClearNotes();
void ClearOutline();
long GetColumn();
LPDISPATCH ColumnDifferences(const VARIANT& Comparison);
LPDISPATCH GetColumns();
VARIANT GetColumnWidth();
void SetColumnWidth(const VARIANT& newValue);
void Consolidate(const VARIANT& Sources, const VARIANT& Function, const VARIANT& TopRow, const VARIANT& LeftColumn, const VARIANT& CreateLinks);
void Copy(const VARIANT& Destination);
long CopyFromRecordset(LPUNKNOWN Data, const VARIANT& MaxRows, const VARIANT& MaxColumns);
void CopyPicture(long Appearance, long Format);
long GetCount();
void CreateNames(const VARIANT& Top, const VARIANT& Left, const VARIANT& Bottom, const VARIANT& Right);
void CreatePublisher(const VARIANT& Edition, long Appearance, const VARIANT& ContainsPICT, const VARIANT& ContainsBIFF, const VARIANT& ContainsRTF, const VARIANT& ContainsVALU);
LPDISPATCH GetCurrentArray();
LPDISPATCH GetCurrentRegion();
void Cut(const VARIANT& Destination);
void DataSeries(const VARIANT& Rowcol, long Type, long Date, const VARIANT& Step, const VARIANT& Stop, const VARIANT& Trend);
VARIANT Get_Default(const VARIANT& RowIndex, const VARIANT& ColumnIndex);
void Set_Default(const VARIANT& RowIndex, const VARIANT& ColumnIndex, const VARIANT& newValue);
void Delete(const VARIANT& Shift);
LPDISPATCH GetDependents();
VARIANT DialogBox_();
LPDISPATCH GetDirectDependents();
LPDISPATCH GetDirectPrecedents();
VARIANT EditionOptions(long Type, long Option, const VARIANT& Name, const VARIANT& Reference, long Appearance, long ChartSize, const VARIANT& Format);
LPDISPATCH GetEnd(long Direction);
LPDISPATCH GetEntireColumn();
LPDISPATCH GetEntireRow();
void FillDown();
void FillLeft();
void FillRight();
void FillUp();
LPDISPATCH Find(const VARIANT& What, const VARIANT& After, const VARIANT& LookIn, const VARIANT& LookAt, const VARIANT& SearchOrder, long SearchDirection, const VARIANT& MatchCase, const VARIANT& MatchByte,
const VARIANT& MatchControlCharacters, const VARIANT& MatchDiacritics, const VARIANT& MatchKashida, const VARIANT& MatchAlefHamza);
LPDISPATCH FindNext(const VARIANT& After);
LPDISPATCH FindPrevious(const VARIANT& After);
LPDISPATCH GetFont();
VARIANT GetFormula();
void SetFormula(const VARIANT& newValue);
VARIANT GetFormulaArray();
void SetFormulaArray(const VARIANT& newValue);
long GetFormulaLabel();
void SetFormulaLabel(long nNewValue);
VARIANT GetFormulaHidden();
void SetFormulaHidden(const VARIANT& newValue);
VARIANT GetFormulaLocal();
void SetFormulaLocal(const VARIANT& newValue);
VARIANT GetFormulaR1C1();
void SetFormulaR1C1(const VARIANT& newValue);
VARIANT GetFormulaR1C1Local();
void SetFormulaR1C1Local(const VARIANT& newValue);
void FunctionWizard();
BOOL GoalSeek(const VARIANT& Goal, LPDISPATCH ChangingCell);
VARIANT Group(const VARIANT& Start, const VARIANT& End, const VARIANT& By, const VARIANT& Periods);
VARIANT GetHasArray();
VARIANT GetHasFormula();
VARIANT GetHeight();
VARIANT GetHidden();
void SetHidden(const VARIANT& newValue);
VARIANT GetHorizontalAlignment();
void SetHorizontalAlignment(const VARIANT& newValue);
VARIANT GetIndentLevel();
void SetIndentLevel(const VARIANT& newValue);
void InsertIndent(long InsertAmount);
void Insert(const VARIANT& Shift);
LPDISPATCH GetInterior();
VARIANT GetItem(const VARIANT& RowIndex, const VARIANT& ColumnIndex);
void SetItem(const VARIANT& RowIndex, const VARIANT& ColumnIndex, const VARIANT& newValue);
void Justify();
VARIANT GetLeft();
long GetListHeaderRows();
void ListNames();
long GetLocationInTable();
VARIANT GetLocked();
void SetLocked(const VARIANT& newValue);
void Merge(const VARIANT& Across);
void UnMerge();
LPDISPATCH GetMergeArea();
VARIANT GetMergeCells();
void SetMergeCells(const VARIANT& newValue);
VARIANT GetName();
void SetName(const VARIANT& newValue);
void NavigateArrow(const VARIANT& TowardPrecedent, const VARIANT& ArrowNumber, const VARIANT& LinkNumber);
LPUNKNOWN Get_NewEnum();
LPDISPATCH GetNext();
CString NoteText(const VARIANT& Text, const VARIANT& Start, const VARIANT& Length);
VARIANT GetNumberFormat();
void SetNumberFormat(const VARIANT& newValue);
VARIANT GetNumberFormatLocal();
void SetNumberFormatLocal(const VARIANT& newValue);
LPDISPATCH GetOffset(const VARIANT& RowOffset, const VARIANT& ColumnOffset);
VARIANT GetOrientation();
void SetOrientation(const VARIANT& newValue);
VARIANT GetOutlineLevel();
void SetOutlineLevel(const VARIANT& newValue);
long GetPageBreak();
void SetPageBreak(long nNewValue);
void Parse(const VARIANT& ParseLine, const VARIANT& Destination);
void PasteSpecial(long Paste, long Operation, const VARIANT& SkipBlanks, const VARIANT& Transpose);
LPDISPATCH GetPivotField();
LPDISPATCH GetPivotItem();
LPDISPATCH GetPivotTable();
LPDISPATCH GetPrecedents();
VARIANT GetPrefixCharacter();
LPDISPATCH GetPrevious();
void PrintOut(const VARIANT& From, const VARIANT& To, const VARIANT& Copies, const VARIANT& Preview, const VARIANT& ActivePrinter, const VARIANT& PrintToFile, const VARIANT& Collate);
void PrintPreview(const VARIANT& EnableChanges);
LPDISPATCH GetQueryTable();
LPDISPATCH GetRange(const VARIANT& Cell1, const VARIANT& Cell2);
void RemoveSubtotal();
BOOL Replace(const VARIANT& What, const VARIANT& Replacement, const VARIANT& LookAt, const VARIANT& SearchOrder, const VARIANT& MatchCase, const VARIANT& MatchByte, const VARIANT& MatchControlCharacters, const VARIANT& MatchDiacritics,
const VARIANT& MatchKashida, const VARIANT& MatchAlefHamza);
LPDISPATCH GetResize(const VARIANT& RowSize, const VARIANT& ColumnSize);
long GetRow();
LPDISPATCH RowDifferences(const VARIANT& Comparison);
VARIANT GetRowHeight();
void SetRowHeight(const VARIANT& newValue);
LPDISPATCH GetRows();
VARIANT Run(const VARIANT& Arg1, const VARIANT& Arg2, const VARIANT& Arg3, const VARIANT& Arg4, const VARIANT& Arg5, const VARIANT& Arg6, const VARIANT& Arg7, const VARIANT& Arg8, const VARIANT& Arg9, const VARIANT& Arg10,
const VARIANT& Arg11, const VARIANT& Arg12, const VARIANT& Arg13, const VARIANT& Arg14, const VARIANT& Arg15, const VARIANT& Arg16, const VARIANT& Arg17, const VARIANT& Arg18, const VARIANT& Arg19, const VARIANT& Arg20,
const VARIANT& Arg21, const VARIANT& Arg22, const VARIANT& Arg23, const VARIANT& Arg24, const VARIANT& Arg25, const VARIANT& Arg26, const VARIANT& Arg27, const VARIANT& Arg28, const VARIANT& Arg29, const VARIANT& Arg30);
void Select();
void Show();
void ShowDependents(const VARIANT& Remove);
VARIANT GetShowDetail();
void SetShowDetail(const VARIANT& newValue);
void ShowErrors();
void ShowPrecedents(const VARIANT& Remove);
VARIANT GetShrinkToFit();
void SetShrinkToFit(const VARIANT& newValue);
void Sort(const VARIANT& Key1, long Order1, const VARIANT& Key2, const VARIANT& Type, long Order2, const VARIANT& Key3, long Order3, long Header, const VARIANT& OrderCustom, const VARIANT& MatchCase, long Orientation, long SortMethod,
const VARIANT& IgnoreControlCharacters, const VARIANT& IgnoreDiacritics, const VARIANT& IgnoreKashida);
void SortSpecial(long SortMethod, const VARIANT& Key1, long Order1, const VARIANT& Type, const VARIANT& Key2, long Order2, const VARIANT& Key3, long Order3, long Header, const VARIANT& OrderCustom, const VARIANT& MatchCase, long Orientation);
LPDISPATCH GetSoundNote();
LPDISPATCH SpecialCells(long Type, const VARIANT& Value);
VARIANT GetStyle();
void SetStyle(const VARIANT& newValue);
void SubscribeTo(LPCTSTR Edition, long Format);
void Subtotal(long GroupBy, long Function, const VARIANT& TotalList, const VARIANT& Replace, const VARIANT& PageBreaks, long SummaryBelowData);
VARIANT GetSummary();
void Table(const VARIANT& RowInput, const VARIANT& ColumnInput);
VARIANT GetText();
void TextToColumns(const VARIANT& Destination, long DataType, long TextQualifier, const VARIANT& ConsecutiveDelimiter, const VARIANT& Tab, const VARIANT& Semicolon, const VARIANT& Comma, const VARIANT& Space, const VARIANT& Other,
const VARIANT& OtherChar, const VARIANT& FieldInfo);
VARIANT GetTop();
void Ungroup();
VARIANT GetUseStandardHeight();
void SetUseStandardHeight(const VARIANT& newValue);
VARIANT GetUseStandardWidth();
void SetUseStandardWidth(const VARIANT& newValue);
LPDISPATCH GetValidation();
VARIANT GetValue();
void SetValue(const VARIANT& newValue);
VARIANT GetValue2();
void SetValue2(const VARIANT& newValue);
VARIANT GetVerticalAlignment();
void SetVerticalAlignment(const VARIANT& newValue);
VARIANT GetWidth();
LPDISPATCH GetWorksheet();
VARIANT GetWrapText();
void SetWrapText(const VARIANT& newValue);
LPDISPATCH AddComment(const VARIANT& Text);
LPDISPATCH GetComment();
void ClearComments();
LPDISPATCH GetPhonetic();
LPDISPATCH GetFormatConditions();
long GetReadingOrder();
void SetReadingOrder(long nNewValue);
LPDISPATCH GetHyperlinks();
};
/////////////////////////////////////////////////////////////////////////////
// Border wrapper class
class Border : public COleDispatchDriver
{
public:
Border() {} // Calls COleDispatchDriver default constructor
Border(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
Border(const Border& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
LPDISPATCH GetApplication();
long GetCreator();
LPDISPATCH GetParent();
VARIANT GetColor();
void SetColor(const VARIANT& newValue);
VARIANT GetColorIndex();
void SetColorIndex(const VARIANT& newValue);
VARIANT GetLineStyle();
void SetLineStyle(const VARIANT& newValue);
VARIANT GetWeight();
void SetWeight(const VARIANT& newValue);
};
/////////////////////////////////////////////////////////////////////////////
// Borders wrapper class
class Borders : public COleDispatchDriver
{
public:
Borders() {} // Calls COleDispatchDriver default constructor
Borders(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
Borders(const Borders& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
LPDISPATCH GetApplication();
long GetCreator();
LPDISPATCH GetParent();
VARIANT GetColor();
void SetColor(const VARIANT& newValue);
VARIANT GetColorIndex();
void SetColorIndex(const VARIANT& newValue);
long GetCount();
LPDISPATCH GetItem(long Index);
VARIANT GetLineStyle();
void SetLineStyle(const VARIANT& newValue);
LPUNKNOWN Get_NewEnum();
VARIANT GetValue();
void SetValue(const VARIANT& newValue);
VARIANT GetWeight();
void SetWeight(const VARIANT& newValue);
LPDISPATCH Get_Default(long Index);
};
/////////////////////////////////////////////////////////////////////////////
// Interior wrapper class
class Interior : public COleDispatchDriver
{
public:
Interior() {} // Calls COleDispatchDriver default constructor
Interior(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
Interior(const Interior& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
LPDISPATCH GetApplication();
long GetCreator();
LPDISPATCH GetParent();
VARIANT GetColor();
void SetColor(const VARIANT& newValue);
VARIANT GetColorIndex();
void SetColorIndex(const VARIANT& newValue);
VARIANT GetInvertIfNegative();
void SetInvertIfNegative(const VARIANT& newValue);
VARIANT GetPattern();
void SetPattern(const VARIANT& newValue);
VARIANT GetPatternColor();
void SetPatternColor(const VARIANT& newValue);
VARIANT GetPatternColorIndex();
void SetPatternColorIndex(const VARIANT& newValue);
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,110 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//
// expimp.h
//
#ifndef __EXPIMP_H
#define __EXPIMP_H
#include "transDB.h"
#include "Babylondlg.h"
typedef enum
{
TR_ALL,
TR_CHANGES,
TR_DIALOG,
TR_NONDIALOG,
TR_SAMPLE,
TR_MISSING_DIALOG,
TR_UNVERIFIED,
TR_UNSENT
} TrFilter;
typedef struct
{
TrFilter filter;
int include_comments;
int include_translations;
} TROPTIONS;
typedef enum
{
GN_UNICODE,
GN_BABYLONSTR,
} GnFormat;
typedef enum
{
GN_USEIDS,
GN_USEORIGINAL,
} GnUntranslated;
typedef struct
{
GnFormat format; // what file format to generate
GnUntranslated untranslated; // what to do with untranslated text
} GNOPTIONS;
typedef struct
{
int translations;
int dialog;
int limit;
} RPOPTIONS;
#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
typedef struct
{
int id;
int version;
int num_labels;
int num_strings;
int skip;
} CSF_HEADER_V1;
typedef struct
{
int id;
int version;
int num_labels;
int num_strings;
int skip;
int langid;
} CSF_HEADER;
int ExportTranslations ( TransDB *db, const char *filename, LangID langid, TROPTIONS *options, CBabylonDlg *dlg = NULL );
int ImportTranslations ( TransDB *db, const char *filename, CBabylonDlg *dlg = NULL );
int UpdateSentTranslations ( TransDB *db, const char *filename, CBabylonDlg *dlg = NULL );
int GenerateGameFiles ( TransDB *db, const char *filename, GNOPTIONS *option, LangID *languages, CBabylonDlg *dlg = NULL );
int GenerateReport ( TransDB *db, const char *filename, RPOPTIONS *options, LangID *languages, CBabylonDlg *dlg = NULL );
void ProcessWaves ( TransDB *db, const char *filename, CBabylonDlg *dlg );
#endif

View file

@ -0,0 +1,108 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//
// fileops.cpp
//
#include "stdAfx.h"
#include "fileops.h"
int FileExists ( const char *filename )
{
int fa = FileAttribs ( filename );
return ! ( (fa == FA_NOFILE) || (fa & FA_DIRECTORY ));
}
int FileAttribs ( const char *filename )
{
WIN32_FIND_DATA fi;
HANDLE handle;
int fa = FA_NOFILE;
handle = FindFirstFile ( filename, &fi );
if ( handle != INVALID_HANDLE_VALUE )
{
if ( fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
{
fa |= FA_DIRECTORY;
}
if ( fi.dwFileAttributes & FILE_ATTRIBUTE_READONLY )
{
fa |= FA_READONLY;
}
else
{
fa |= FA_WRITEABLE;
}
FindClose ( handle );
}
return fa;
}
static void make_bk_name ( char *bkname, const char *filename )
{
char *ext, *ext1;
strcpy ( bkname, filename );
ext = strchr ( filename, '.' );
ext1 = strchr ( bkname, '.' );
if ( ext )
{
strcpy ( ext1, "_back_up" );
strcat ( ext1, ext );
}
else
{
strcat ( bkname, "_back_up" );
}
}
void MakeBackupFile ( const char *filename )
{
char bkname[256];
make_bk_name ( bkname, filename );
CopyFile ( filename, bkname, FALSE );
}
void RestoreBackupFile ( const char *filename )
{
char bkname[256];
make_bk_name ( bkname, filename );
if ( FileExists ( bkname ))
{
CopyFile ( bkname, filename, FALSE );
}
}

View file

@ -0,0 +1,38 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
//
// File IO support
//
#ifndef __FILEOPS_H
#define __FILEOPS_H
static const int FA_NOFILE = 0;
static const int FA_READONLY = 0x00000001;
static const int FA_DIRECTORY = 0x00000002;
static const int FA_WRITEABLE = 0x00000004;
int FileExists ( const char *filename );
int FileAttribs ( const char *filename );
void MakeBackupFile ( const char *filename );
void RestoreBackupFile ( const char *filename );
#endif // __FILEIO_H

View file

@ -0,0 +1,553 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
#include "stdAfx.h"
#include "sys/stat.h"
#include "iff.h"
#include <fcntl.h>
#include <io.h>
#include <stdlib.h>
#include <stdio.h>
#define IFF_RAWREAD(iff,data,size,label) {if ( IFF_rawread ( (iff), (data), (size)) != (size)) goto label;}
int IFF_rawread ( IFF_FILE *iff, void *buffer, int bytes )
{
if ( ! (iff->flags & mIFF_FILE_LOADED ) )
{
return _read ( iff->fp, buffer, bytes );
}
if ( iff->file_size < (iff->file_pos + bytes) )
{
bytes = iff->file_size - iff->file_pos;
}
memcpy ( buffer, &iff->mem_file[iff->file_pos], bytes );
iff->file_pos += bytes;
return bytes;
}
/******************************************************************/
/* */
/* */
/******************************************************************/
int IFF_seek ( IFF_FILE *iff, int pos, int mode )
{
if ( ! (iff->flags & mIFF_FILE_LOADED ))
{
return lseek ( iff->fp, pos, mode );
}
switch ( mode )
{
case SEEK_CUR:
iff->file_pos += pos;
break;
case SEEK_END:
iff->file_pos = iff->file_size - pos;
break;
case SEEK_SET:
iff->file_pos = pos;
break;
}
if ( iff->file_pos < 0 )
{
iff->file_pos = 0;
}
else
{
if ( iff->file_pos > iff->file_size )
{
iff->file_pos = iff->file_size;
}
}
return iff->file_pos;
}
/******************************************************************/
/* */
/* */
/******************************************************************/
IFF_FILE *IFF_Open ( const char *name )
{
IFF_FILE *iff = NULL;
if ( ! (iff = (IFF_FILE *) malloc ( sizeof (IFF_FILE))))
{
goto error;
}
iff->fp = -1;
memset ( iff, 0, sizeof ( IFF_FILE ));
if ((iff->fp = open ( name, _O_BINARY | _O_RDONLY )) == -1 )
{
goto error;
}
return iff;
error:
if (iff)
{
IFF_Close ( iff );
}
return NULL;
}
/******************************************************************/
/* */
/* */
/******************************************************************/
IFF_FILE *IFF_Load ( const char *name )
{
IFF_FILE *iff = NULL;
if ( ! (iff = (IFF_FILE *) malloc ( sizeof (IFF_FILE))))
{
goto error;
}
memset ( iff, 0, sizeof ( IFF_FILE ));
iff->fp = -1;
if ((iff->fp = open ( name, _O_BINARY | _O_RDONLY )) == -1 )
{
goto error;
}
iff->file_size = lseek ( iff->fp, 0, SEEK_END );
lseek ( iff->fp, 0, SEEK_SET );
if ( !(iff->mem_file = ( char *) malloc ( iff->file_size) ) )
{
goto error;
}
DO_READ ( iff->fp, iff->mem_file, iff->file_size, error );
iff->flags |= mIFF_FILE_LOADED;
return iff;
error:
if (iff)
{
IFF_Close ( iff );
}
return NULL;
}
/******************************************************************/
/* */
/* */
/******************************************************************/
void IFF_Reset ( IFF_FILE *iff )
{
IFF_seek ( iff, 0, SEEK_SET );
iff->pad_form = 0;
iff->pad_chunk = 0;
iff->FormSize = 0;
iff->ChunkSize = 0;
iff->next_byte = 0;
iff->chunk_size_pos = 0;
iff->form_size_pos = 0;
}
/******************************************************************/
/* */
/* */
/******************************************************************/
void IFF_goto_form_end ( IFF_FILE *iff )
{
iff->FormSize += iff->pad_form;
iff->pad_form = 0;
if (iff->FormSize)
{
IFF_seek ( iff, iff->FormSize, SEEK_CUR );
iff->next_byte += iff->FormSize;
iff->FormSize = 0;
iff->ChunkSize = 0;
}
}
/******************************************************************/
/* */
/* */
/******************************************************************/
void IFF_goto_chunk_end ( IFF_FILE *iff )
{
iff->ChunkSize += iff->pad_chunk;
iff->pad_chunk = 0;
if (iff->ChunkSize)
{
IFF_seek ( iff, iff->ChunkSize, SEEK_CUR );
iff->next_byte += iff->ChunkSize;
iff->FormSize -= iff->ChunkSize;
iff->ChunkSize = 0;
}
}
/******************************************************************/
/* */
/* */
/******************************************************************/
int IFF_NextForm ( IFF_FILE *iff )
{
IFF_CHUNK chunk;
int form;
IFF_goto_form_end ( iff );
IFF_RAWREAD (iff, &chunk, sizeof( IFF_CHUNK ), error );
chunk.Size = BgEn32 (chunk.Size);
chunk.ID = BgEn32 (chunk.ID);
iff->pad_form = (int) (chunk.Size & 0x0001);
if (chunk.ID != vIFF_ID_FORM )
{
goto error;
}
IFF_RAWREAD (iff, &form, sizeof( int ), error);
iff->FormID = (int) BgEn32 (form);
iff->flags |= mIFF_FILE_FORMOPEN;
iff->next_byte += sizeof( int ) + sizeof ( IFF_CHUNK );
iff->FormSize = (int) chunk.Size - sizeof ( int );
iff->ChunkSize = 0;
iff->pad_chunk = 0;
return TRUE;
error:
return FALSE;
}
/******************************************************************/
/* */
/* */
/******************************************************************/
int IFF_NextChunk ( IFF_FILE *iff )
{
IFF_CHUNK chunk;
IFF_goto_chunk_end ( iff );
if (iff->FormSize==0)
{
goto error;
}
IFF_RAWREAD ( iff, &chunk, sizeof( IFF_CHUNK ), error );
chunk.Size = BgEn32 (chunk.Size);
chunk.ID = BgEn32 (chunk.ID);
iff->pad_chunk = (int) (chunk.Size & 0x0001);
iff->flags |= mIFF_FILE_CHUNKOPEN;
iff->ChunkID = (int) chunk.ID;
iff->ChunkSize = (int) chunk.Size;
iff->next_byte += sizeof ( IFF_CHUNK );
iff->FormSize -= sizeof ( IFF_CHUNK );
return TRUE;
error:
return FALSE;
}
/******************************************************************/
/* */
/* */
/******************************************************************/
void IFF_Close ( IFF_FILE *iff )
{
if (iff->fp != -1)
{
_close (iff->fp);
}
if ( iff->mem_file )
{
free ( iff->mem_file );
}
free ( iff );
}
/******************************************************************/
/* */
/* */
/******************************************************************/
int IFF_Read ( IFF_FILE *iff, void *buff, int size )
{
int read =0;
if ( size>iff->ChunkSize )
{
size = iff->ChunkSize;
}
read = IFF_rawread ( iff, buff, size);
if (read==-1)
{
read = 0;
}
iff->ChunkSize -= read;
iff->FormSize -= read;
iff->next_byte += read;
return read;
}
/******************************************************************/
/* */
/* */
/******************************************************************/
IFF_FILE *IFF_New ( const char *name )
{
IFF_FILE *iff = NULL;
if ( ! (iff = (IFF_FILE *) malloc ( sizeof (IFF_FILE))))
{
goto error;
}
memset ( iff, 0, sizeof ( IFF_FILE ));
iff->fp = -1;
if ((iff->fp = _open ( name, _O_BINARY | _O_RDWR | _O_CREAT | _O_TRUNC, _S_IREAD | _S_IWRITE )) == -1 )
{
goto error;
}
return iff;
error:
if (iff)
{
IFF_Close ( iff );
}
return NULL;
}
/******************************************************************/
/* */
/* */
/******************************************************************/
int IFF_NewForm ( IFF_FILE *iff, int id )
{
IFF_CHUNK chunk;
chunk.ID = BgEn32 (vIFF_ID_FORM);
chunk.Size = BgEn32 (90000);
iff->FormSize = 0;
iff->ChunkSize = 0;
iff->FormID = id;
DO_WRITE ( iff->fp, &chunk, sizeof (IFF_CHUNK), error);
chunk.ID = BgEn32 ( (int) iff->FormID);
DO_WRITE ( iff->fp, &chunk.ID, sizeof (int), error );
iff->flags |= mIFF_FILE_FORMOPEN;
iff->form_size_pos = iff->next_byte + sizeof (int);
iff->next_byte += sizeof ( IFF_CHUNK ) + sizeof (int);
return TRUE;
error:
return FALSE;
}
/******************************************************************/
/* */
/* */
/******************************************************************/
int IFF_NewChunk ( IFF_FILE *iff, int id )
{
IFF_CHUNK chunk;
chunk.Size = BgEn32 (90000);
chunk.ID = BgEn32 ( (int) id);
DO_WRITE ( iff->fp, &chunk, sizeof ( IFF_CHUNK ), error );
iff->flags |= mIFF_FILE_CHUNKOPEN;
iff->chunk_size_pos = iff->next_byte + sizeof (int);
iff->next_byte += sizeof ( IFF_CHUNK ) ;
iff->FormSize += sizeof ( IFF_CHUNK ) ;
iff->ChunkSize = 0;
iff->ChunkID = id;
return TRUE;
error:
return FALSE;
}
/******************************************************************/
/* */
/* */
/******************************************************************/
int IFF_Write ( IFF_FILE *iff, void *buff, int size )
{
int val =0;
val = _write ( iff->fp, buff, size);
if (val==-1)
{
val = 0;
}
iff->ChunkSize += val;
iff->FormSize += val;
iff->next_byte += val;
return val;
}
/******************************************************************/
/* */
/* */
/******************************************************************/
int IFF_CloseForm ( IFF_FILE *iff )
{
int fp;
int off;
int size;
int pad = 0;
if (iff && ((fp = iff->fp) != -1))
{
if (iff->FormSize&0x0001)
{
DO_WRITE (fp, &pad, 1, error );
iff->next_byte++;
}
off = iff->next_byte - iff->form_size_pos;
size = BgEn32 ( (int) (iff->FormSize+sizeof ( int )));
if (lseek (fp, -off, SEEK_CUR)==iff->form_size_pos)
{
DO_WRITE ( fp, &size, sizeof (int), error );
lseek ( fp, 0, SEEK_END);
return TRUE;
}
}
error:
return FALSE;
}
/******************************************************************/
/* */
/* */
/******************************************************************/
int IFF_CloseChunk ( IFF_FILE *iff )
{
int fp;
int off;
int size;
int pad = 0;
if (iff && ((fp = iff->fp) != -1 ))
{
if (iff->ChunkSize&0x0001)
{
DO_WRITE (fp, &pad, 1, error );
iff->next_byte++;
iff->FormSize++;
}
off = iff->next_byte - iff->chunk_size_pos;
size = BgEn32 ((int) iff->ChunkSize);
if (lseek (fp, -off, SEEK_CUR)==iff->chunk_size_pos)
{
DO_WRITE ( fp, &size, sizeof (int), error );
lseek ( fp, 0, SEEK_END);
return TRUE;
}
}
error:
return TRUE;
}

View file

@ -0,0 +1,127 @@
/*
** 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 <http://www.gnu.org/licenses/>.
*/
#ifndef __IFF_H
#define __IFF_H
#define MakeID(a,b,c,d) ( (int) ( ( (int) (a) ) << 24 | ( (int) (b) ) << 16 | \
( (int) (c) ) << 8 | ( (int) (d) ) ) )
#define vIFF_ID_FORM MakeID('F','O','R','M')
#define vIFF_ID_CAT MakeID('C','A','T',' ')
#define vIFF_ID_LIST MakeID('L','I','S','T')
#define vIFF_ID_PROP MakeID('P','R','O','P')
#define vIFF_ID_FILLER W_MakeID(' ',' ',' ',' ')
/* IFF_FILE:
IFF File handling structure
*/
/* defines for IFF_FILE->flags */
#define mIFF_FILE_FORMOPEN (1<<0) /* in a form */
#define mIFF_FILE_CHUNKOPEN (1<<1) /* in a chunk */
#define mIFF_FILE_LOADED (1<<2) /* file is in memory */
typedef struct
{
int ID; /* Chunk ID */
int Size; /* Chunk size in bytes */
} IFF_CHUNK;
typedef struct {
/* public fields */
int FormID;
int ChunkID;
int FormSize;
int ChunkSize;
/* private fields */
int fp;
int flags;
int next_byte;
int chunk_size_pos;
int form_size_pos;
int pad_form;
int pad_chunk;
int file_size;
int file_pos;
char *mem_file;
} IFF_FILE;
IFF_FILE* IFF_Open ( const char * );
IFF_FILE* IFF_Load ( const char * );
VOID IFF_Reset ( IFF_FILE * );
VOID IFF_Close ( IFF_FILE * );
VOID IFF_goto_form_end ( IFF_FILE *);
VOID IFF_goto_chunk_end ( IFF_FILE *);
int IFF_NextForm ( IFF_FILE *);
int IFF_NextChunk ( IFF_FILE *);
int IFF_Read ( IFF_FILE *, void *, int );
int IFF_Write ( IFF_FILE *, void *, int );
IFF_FILE* IFF_New ( const char * );
int IFF_NewForm ( IFF_FILE *, int );
int IFF_NewChunk ( IFF_FILE *, int );
int IFF_CloseForm ( IFF_FILE * );
int IFF_CloseChunk ( IFF_FILE * );
#define DO_OPEN(P,N,F,E) {if (!((P)=open(N,(F)))) goto E;}
#define DO_READ(P,B,S,E) {if ( read((P),(B),(S))!=(S)) goto E;}
#define DO_WRITE(P,B,S,E) {if ( write((P),(B),(S))!=(S)) goto E;}
#define IFF_READ(iff,data,size,label) {if ( IFF_Read ( (iff), (data), (size)) != (size)) goto label;}
#define IFF_WRITE(iff,data,size,label) {if ( IFF_Write ( (iff), (data), (size)) != (size)) goto label;}
#define IFF_NEWCHUNK(iff,id,label) { if ( !IFF_NewChunk ( (iff), (id))) goto label; }
#define IFF_NEWFORM(iff,id,label) { if ( !IFF_NewForm ( (iff), (id))) goto label; }
#define Reverse32(L) ( (( (L)>>24 ) & 0xff) | (((L)>>8) &0xff00) | (((L)<<8)&0xff0000) | (((L)<<24)&0xff000000))
#define Reverse16(L) ( (( (L)>>8 ) & 0xff) | (((L)<<8)&0xff00) )
#define __CPU_BIG_ENDIAN__ 0
#if __CPU_BIG_ENDIAN__
#define BgEn32(L) (L)
#define BgEn16(L) (L)
#define LtEn32(L) Reverse32(L)
#define LtEn16(L) Reverse16(L)
#else
#define BgEn32(L) Reverse32(L)
#define BgEn16(L) Reverse16(L)
#define LtEn32(L) (L)
#define LtEn16(L) (L)
#endif
#endif /* __IFF_H */

Some files were not shown because too many files have changed in this diff Show more