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,228 @@
/*
** 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/>.
*/
// DebugWindow.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "DebugWindow.h"
#include "DebugWindowDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//
/////////////////////////////////////////////////////////////////////////////
// CDebugWindowApp
BEGIN_MESSAGE_MAP(CDebugWindowApp, CWinApp)
//{{AFX_MSG_MAP(CDebugWindowApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDebugWindowApp construction
CDebugWindowApp::CDebugWindowApp()
{
AfxInitialize(true);
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
m_DialogWindow = NULL;
}
DebugWindowDialog* CDebugWindowApp::GetDialogWindow(void)
{
return m_DialogWindow;
}
void CDebugWindowApp::SetDialogWindow(DebugWindowDialog* pWnd)
{
m_DialogWindow = pWnd;
}
CDebugWindowApp::~CDebugWindowApp()
{
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CDebugWindowApp object
CDebugWindowApp theApp;
void __declspec(dllexport) CreateDebugDialog(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
DebugWindowDialog* tmpWnd;
tmpWnd = new DebugWindowDialog;
tmpWnd->Create(DebugWindowDialog::IDD);
tmpWnd->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
tmpWnd->ShowWindow(SW_SHOW);
if (tmpWnd->GetMainWndHWND()) {
SetFocus(tmpWnd->GetMainWndHWND());
}
theApp.SetDialogWindow(tmpWnd);
}
void __declspec(dllexport) DestroyDebugDialog(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
DebugWindowDialog* tmpWnd = theApp.GetDialogWindow();
if (tmpWnd) {
tmpWnd->DestroyWindow();
delete tmpWnd;
theApp.SetDialogWindow(NULL);
}
}
bool __declspec(dllexport) CanAppContinue(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
DebugWindowDialog* pDbg;
pDbg = theApp.GetDialogWindow();
if (!pDbg) {
return true;
}
return pDbg->CanProceed();
}
void __declspec(dllexport) ForceAppContinue(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
DebugWindowDialog* pDbg;
pDbg = theApp.GetDialogWindow();
if (!pDbg) {
return;
}
pDbg->ForceContinue();
}
bool __declspec(dllexport) RunAppFast(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
DebugWindowDialog* pDbg;
pDbg = theApp.GetDialogWindow();
if (!pDbg) {
return true;
}
return pDbg->RunAppFast();
}
void __declspec(dllexport) AppendMessage(const char* messageToPass)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
DebugWindowDialog* pDbg;
pDbg = theApp.GetDialogWindow();
if (pDbg) {
pDbg->AppendMessage(messageToPass);
}
}
void __declspec(dllexport) SetFrameNumber(int frameNumber)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
DebugWindowDialog* pDbg;
pDbg = theApp.GetDialogWindow();
if (pDbg) {
pDbg->SetFrameNumber(frameNumber);
}
}
void __declspec(dllexport) AppendMessageAndPause(const char* messageToPass)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
DebugWindowDialog* pDbg;
pDbg = theApp.GetDialogWindow();
if (pDbg) {
pDbg->AppendMessage(messageToPass);
pDbg->ForcePause();
}
}
void __declspec(dllexport) AdjustVariable(const char* variable, const char* value)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
DebugWindowDialog* pDbg;
pDbg = theApp.GetDialogWindow();
if (pDbg) {
pDbg->AdjustVariable(variable, value);
}
}
void __declspec(dllexport) AdjustVariableAndPause(const char* variable, const char* value)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
DebugWindowDialog* pDbg;
pDbg = theApp.GetDialogWindow();
if (pDbg) {
pDbg->AdjustVariable(variable, value);
pDbg->ForcePause();
}
}

View file

@ -0,0 +1,6 @@
; DebugWindow.def : Declares the module parameters for the DLL.
LIBRARY "DebugWindow"
DESCRIPTION 'DebugWindow Windows Dynamic Link Library'
EXPORTS

View file

@ -0,0 +1,150 @@
# Microsoft Developer Studio Project File - Name="DebugWindow" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=DebugWindow - 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 "DebugWindow.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 "DebugWindow.mak" CFG="DebugWindow - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "DebugWindow - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "DebugWindow - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName "DebugWindow"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "DebugWindow - Win32 Release"
# PROP BASE Use_MFC 5
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 5
# 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 /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_MBCS" /D "_USRDLL" /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"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 /nologo /subsystem:windows /dll /pdb:"..\..\..\Run\DebugWindow.pdb" /map:"..\..\..\Run\DebugWindow.map" /debug /machine:I386 /out:"..\..\..\Run\DebugWindow.dll"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "DebugWindow - Win32 Debug"
# PROP BASE Use_MFC 5
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 5
# 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 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_MBCS" /D "_USRDLL" /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"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /dll /debug /machine:I386
# ADD LINK32 /nologo /subsystem:windows /dll /pdb:"..\..\..\Run\DebugWindowD.pdb" /map:"..\..\..\Run\DebugWindowD.map" /debug /machine:I386 /out:"..\..\..\Run\DebugWindowD.dll"
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "DebugWindow - Win32 Release"
# Name "DebugWindow - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\DebugWindow.cpp
# End Source File
# Begin Source File
SOURCE=.\DebugWindow.def
# End Source File
# Begin Source File
SOURCE=.\DebugWindow.rc
# End Source File
# Begin Source File
SOURCE=.\DebugWindowDialog.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\DebugWindow.h
# End Source File
# Begin Source File
SOURCE=.\DebugWindowDialog.h
# End Source File
# Begin Source File
SOURCE=.\DebugWindowExport.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.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\DebugWindow.rc2
# End Source File
# End Group
# End Target
# End Project

View file

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

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/>.
*/
// DebugWindow.h : main header file for the DEBUGWINDOW DLL
//
#if !defined(AFX_DEBUGWINDOW_H__018E1800_6E59_4527_BA0C_8731EBF22953__INCLUDED_)
#define AFX_DEBUGWINDOW_H__018E1800_6E59_4527_BA0C_8731EBF22953__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 "DebugWindowExport.h"
/////////////////////////////////////////////////////////////////////////////
// CDebugWindowApp
// See DebugWindow.cpp for the implementation of this class
//
class DebugWindowDialog;
class CDebugWindowApp : public CWinApp
{
public:
CDebugWindowApp();
~CDebugWindowApp();
DebugWindowDialog* GetDialogWindow(void);
void SetDialogWindow(DebugWindowDialog* pWnd);
protected:
DebugWindowDialog* m_DialogWindow;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDebugWindowApp)
//}}AFX_VIRTUAL
//{{AFX_MSG(CDebugWindowApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DEBUGWINDOW_H__018E1800_6E59_4527_BA0C_8731EBF22953__INCLUDED_)

View file

@ -0,0 +1,177 @@
//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
/////////////////////////////////////////////////////////////////////////////
// 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\\DebugWindow.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#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 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "DebugWindow DLL\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "DebugWindow\0"
VALUE "LegalCopyright", "Copyright (C) 2002\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "DebugWindow.DLL\0"
VALUE "ProductName", "DebugWindow Dynamic Link Library\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DebugWindow DIALOG DISCARDABLE 0, 0, 210, 404
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "Step",IDC_Step,81,7,50,14
DEFPUSHBUTTON "Step 10",IDC_StepTen,153,7,50,14
EDITTEXT IDC_Variables,7,43,196,99,ES_MULTILINE | ES_AUTOVSCROLL |
ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL
EDITTEXT IDC_Messages,7,154,196,247,ES_MULTILINE | ES_AUTOVSCROLL |
ES_READONLY | WS_VSCROLL
LTEXT "Variables",IDC_Variables_Text,7,32,30,8
LTEXT "Messages",IDC_Messages_Text,7,144,33,8
DEFPUSHBUTTON "Clear",IDC_ClearWindows,153,26,50,14
CONTROL "Run Fast (10 X) ",IDC_RUN_FAST,"Button",BS_AUTOCHECKBOX |
BS_PUSHLIKE | WS_TABSTOP,81,26,54,14
CONTROL "Pause",IDC_Pause,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
WS_TABSTOP,7,7,50,14
LTEXT "0",IDC_FrameNumber,29,22,44,8
LTEXT "Frame",IDC_STATIC,7,22,20,8
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_DebugWindow, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 203
TOPMARGIN, 7
BOTTOMMARGIN, 397
END
END
#endif // APSTUDIO_INVOKED
#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\DebugWindow.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View file

@ -0,0 +1,226 @@
/*
** 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 "DebugWindowDialog.h"
DebugWindowDialog::DebugWindowDialog(UINT nIDTemplate, CWnd* pParentWnd) :
CDialog(nIDTemplate, pParentWnd)
{
mStepping = false;
mRunFast = false;
mNumberOfStepsAllowed = -1;
mMainWndHWND = ::FindWindow(NULL, "Command & Conquer: Generals");
}
int DebugWindowDialog::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
return CDialog::OnCreate(lpCreateStruct);
}
HWND DebugWindowDialog::GetMainWndHWND(void)
{
return mMainWndHWND;
}
void DebugWindowDialog::ForcePause(void)
{
mNumberOfStepsAllowed = 0;
_UpdatePauseButton();
}
void DebugWindowDialog::ForceContinue(void)
{
mNumberOfStepsAllowed = -1;
_UpdatePauseButton();
}
void DebugWindowDialog::OnPause()
{
if (mNumberOfStepsAllowed < 0) {
mNumberOfStepsAllowed = 0;
} else {
mNumberOfStepsAllowed = -1;
}
_UpdatePauseButton();
}
void DebugWindowDialog::OnStep()
{
mStepping = true;
mNumberOfStepsAllowed = 1;
_UpdatePauseButton();
}
void DebugWindowDialog::OnRunFast()
{
CButton *pButton = (CButton*)GetDlgItem(IDC_RUN_FAST);
mRunFast = pButton->GetCheck() == 1;
}
void DebugWindowDialog::OnStepTen()
{
mStepping = true;
mNumberOfStepsAllowed = 10;
_UpdatePauseButton();
}
void DebugWindowDialog::OnClearWindows()
{
mMessages.clear();
mVariables.clear();
_RebuildMesgString();
_RebuildVarsString();
}
bool DebugWindowDialog::CanProceed(void)
{
if (mNumberOfStepsAllowed < 0) {
return true;
} else if (mNumberOfStepsAllowed == 0) {
if (mStepping) {
mStepping = false;
_UpdatePauseButton();
}
return false;
}
--mNumberOfStepsAllowed;
return true;
}
bool DebugWindowDialog::RunAppFast(void)
{
return mRunFast;
}
void DebugWindowDialog::AppendMessage(const std::string& messageToAppend)
{
mMessages.push_back(messageToAppend);
_RebuildMesgString();
}
void DebugWindowDialog::AdjustVariable(const std::string& varName, const std::string& varValue)
{
for (VecPairStringIt it = mVariables.begin(); it != mVariables.end(); it++) {
if (it->first == varName) {
it->second = varValue;
_RebuildVarsString();
return;
}
}
PairString newPair;
newPair.first = varName;
newPair.second = varValue;
mVariables.push_back(newPair);
_RebuildVarsString();
}
void DebugWindowDialog::SetFrameNumber(int frameNumber)
{
static int numDigits;
numDigits = frameNumber / 10 + 2; // 1 for 1 additional digit, 1 for \0
mFrameNumber.resize(numDigits);
sprintf(mFrameNumber.begin(), "%d", frameNumber);
CWnd *pWnd = GetDlgItem(IDC_FrameNumber);
if (pWnd) {
pWnd->SetWindowText(mFrameNumber.begin());
}
}
void DebugWindowDialog::_RebuildVarsString(void)
{
int cursorPosBeg, cursorPosEnd;
((CEdit*)GetDlgItem(IDC_Variables))->GetSel(cursorPosBeg, cursorPosEnd);
mVariablesString = "";
for (VecPairStringIt it = mVariables.begin(); it != mVariables.end(); it++) {
mVariablesString += it->first;
mVariablesString += " = ";
mVariablesString += it->second;
mVariablesString += "\r\n";
}
// Push the new string
mVariablesDisplayString = mVariablesString.c_str();
GetDlgItem(IDC_Variables)->SetWindowText(mVariablesDisplayString);
((CEdit*)GetDlgItem(IDC_Variables))->GetSel(cursorPosBeg, cursorPosEnd);
}
void DebugWindowDialog::_RebuildMesgString(void)
{
mMessagesString = "";
for (VecStringIt it = mMessages.begin(); it != mMessages.end(); it++) {
mMessagesString += (*it);
mMessagesString += "\r\n";
}
// Push the new string
mMessagesDisplayString = mMessagesString.c_str();
GetDlgItem(IDC_Messages)->SetWindowText(mMessagesDisplayString);
((CEdit*)GetDlgItem(IDC_Messages))->SetSel(mMessagesString.length(), mMessagesString.length(), false);
}
void DebugWindowDialog::_UpdatePauseButton(void)
{
// huh huh huhuh he said pButt
CButton* pButt = (CButton*) GetDlgItem(IDC_Pause);
if (!pButt) {
return;
}
// The state should of the button should reflect !mNumberOfStepsAllowed
pButt->SetCheck((mNumberOfStepsAllowed ? FALSE : TRUE));
}
void DebugWindowDialog::OnClose()
{
ShowWindow(SW_MINIMIZE);
}
void DebugWindowDialog::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
if (nType == SIZE_MINIMIZED) {
if (mMainWndHWND) {
::SetFocus(mMainWndHWND);
}
}
}
BEGIN_MESSAGE_MAP(DebugWindowDialog, CDialog)
ON_WM_CREATE( )
ON_BN_CLICKED(IDC_Pause, OnPause)
ON_BN_CLICKED(IDC_Step, OnStep)
ON_BN_CLICKED(IDC_RUN_FAST, OnRunFast)
ON_BN_CLICKED(IDC_StepTen, OnStepTen)
ON_BN_CLICKED(IDC_ClearWindows, OnClearWindows)
ON_WM_CLOSE()
ON_WM_SIZE()
END_MESSAGE_MAP()

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/>.
*/
#include "Resource.h"
#include <map> // for std::pair
#include <string> // for std::string
#include <vector> // for std::vector
typedef std::pair<std::string, std::string> PairString;
typedef std::vector<PairString> VecPairString;
typedef std::vector<std::string> VecString;
typedef std::vector<PairString>::iterator VecPairStringIt;
typedef std::vector<std::string>::iterator VecStringIt;
class DebugWindowDialog : public CDialog
{
public:
enum {IDD = IDD_DebugWindow};
DebugWindowDialog(UINT nIDTemplate = DebugWindowDialog::IDD, CWnd* pParentWnd = NULL);
bool CanProceed(void);
bool RunAppFast(void);
void AppendMessage(const std::string& messageToAppend);
void AdjustVariable(const std::string& varName, const std::string& varValue);
void SetFrameNumber(int frameNumber);
HWND GetMainWndHWND(void);
void ForcePause(void);
void ForceContinue(void);
// This var shouldn't be here, but honsestly...
protected:
HWND mMainWndHWND;
int mNumberOfStepsAllowed; /// -1 means go forever, 0 means stop now, a positive number will be decremented to 0, 1 frame at a time
std::string mVariablesString;
std::string mMessagesString;
CString mVariablesDisplayString; // For double buffering
CString mMessagesDisplayString; // For double buffering
std::string mFrameNumber;
bool mStepping;
bool mRunFast;
VecPairString mVariables;
VecString mMessages;
void _RebuildVarsString(void);
void _RebuildMesgString(void);
void _UpdatePauseButton(void);
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnPause();
afx_msg void OnStep();
afx_msg void OnRunFast();
afx_msg void OnStepTen();
afx_msg void OnClearWindows();
afx_msg void OnClose();
DECLARE_MESSAGE_MAP()
};

View file

@ -0,0 +1,52 @@
/*
** 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/>.
*/
#pragma once
// Declared extern C to prevent name mangling, which makes life very unhappy
extern "C" {
// Called to create the dialog
void __declspec(dllexport) CreateDebugDialog(void);
// Called to (not surprisingly) destroy the dialog (and free the resources)
void __declspec(dllexport) DestroyDebugDialog(void);
// Call this each frame to determine whether to continue or not
bool __declspec(dllexport) CanAppContinue(void);
// Call this to force the app to continue. (Unpause if necessary.)
void __declspec(dllexport) ForceAppContinue(void);
// Call this to tell the app to run really fast
bool __declspec(dllexport) RunAppFast(void);
// Call this to add a message to the script window
void __declspec(dllexport) AppendMessage(const char* messageToPass);
// Call this to set the frame number of the app
void __declspec(dllexport) SetFrameNumber(int frameNumber);
// Call this to add a message, and simulate pressing Pause immediately after
void __declspec(dllexport) AppendMessageAndPause(const char* messageToPass);
// Call this to add or update a variable value
void __declspec(dllexport) AdjustVariable(const char* variable, const char* value);
// Call this to add or update a variable value, and simulate pressing Pause immediately after
void __declspec(dllexport) AdjustVariableAndPause(const char* variable, const char* value);
}

View file

@ -0,0 +1,44 @@
/*
** 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 DebugWindow.rc
//
#define IDC_Pause 1000
#define IDD_DebugWindow 1000
#define IDC_Step 1001
#define IDC_StepTen 1002
#define IDC_Variables 1003
#define IDC_Messages 1004
#define IDC_Variables_Text 1005
#define IDC_Messages_Text 1006
#define IDC_ClearWindows 1007
#define IDC_RUN_FAST 1008
#define IDC_FrameNumber 1010
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 1001
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1011
#define _APS_NEXT_SYMED_VALUE 1000
#endif
#endif

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
// DebugWindow.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View file

@ -0,0 +1,62 @@
/*
** 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__FB15454D_21B4_4F33_A593_C13A58B86008__INCLUDED_)
#define AFX_STDAFX_H__FB15454D_21B4_4F33_A593_C13A58B86008__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
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxole.h> // MFC OLE classes
#include <afxodlgs.h> // MFC OLE dialog classes
#include <afxdisp.h> // MFC Automation classes
#endif // _AFX_NO_OLE_SUPPORT
#ifndef _AFX_NO_DB_SUPPORT
#include <afxdb.h> // MFC ODBC database classes
#endif // _AFX_NO_DB_SUPPORT
#ifndef _AFX_NO_DAO_SUPPORT
#include <afxdao.h> // MFC DAO database classes
#endif // _AFX_NO_DAO_SUPPORT
#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
// I don't care that debug symbols are longer than 255, I won't read them anyways.
#pragma warning (disable : 4786)
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__FB15454D_21B4_4F33_A593_C13A58B86008__INCLUDED_)

View file

@ -0,0 +1 @@
@copy debug\debugWindow.dll ..\..\..\Run

View file

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