From 6a47974b369baa25b40c49e54aea56ed65217935 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 22 Apr 2025 19:13:45 +0200 Subject: [PATCH] [CORE] Move DebugWindow tool to Core --- Core/Tools/CMakeLists.txt | 2 +- Core/Tools/DebugWindow/CMakeLists.txt | 28 +++ .../Tools/DebugWindow/DebugWindow.cpp | 0 .../Tools/DebugWindow/DebugWindow.def | 0 .../Tools/DebugWindow/DebugWindow.h | 0 .../Tools/DebugWindow/DebugWindow.rc | 0 .../Tools/DebugWindow/DebugWindowDialog.cpp | 0 .../Tools/DebugWindow/DebugWindowDialog.h | 0 .../Tools/DebugWindow/DebugWindowExport.h | 0 .../Tools/DebugWindow/Resource.h | 0 .../Tools/DebugWindow/StdAfx.cpp | 0 .../Code => Core}/Tools/DebugWindow/StdAfx.h | 0 .../Tools/DebugWindow/post-build.bat | 0 .../Tools/DebugWindow/res/DebugWindow.rc2 | 0 Generals/Code/Tools/CMakeLists.txt | 1 - .../Code/Tools/DebugWindow/CMakeLists.txt | 29 --- .../Code/Tools/DebugWindow/DebugWindow.cpp | 228 ------------------ Generals/Code/Tools/DebugWindow/DebugWindow.h | 72 ------ .../Tools/DebugWindow/DebugWindowDialog.cpp | 226 ----------------- .../Tools/DebugWindow/DebugWindowDialog.h | 82 ------- .../Tools/DebugWindow/DebugWindowExport.h | 52 ---- Generals/Code/Tools/DebugWindow/Resource.h | 26 -- Generals/Code/Tools/DebugWindow/StdAfx.cpp | 26 -- Generals/Code/Tools/DebugWindow/StdAfx.h | 65 ----- GeneralsMD/Code/Tools/CMakeLists.txt | 1 - .../Code/Tools/DebugWindow/CMakeLists.txt | 29 --- .../Code/Tools/DebugWindow/DebugWindow.def | 6 - .../Code/Tools/DebugWindow/DebugWindow.rc | 177 -------------- .../Code/Tools/DebugWindow/post-build.bat | 1 - .../Tools/DebugWindow/res/DebugWindow.rc2 | 13 - 30 files changed, 29 insertions(+), 1035 deletions(-) create mode 100644 Core/Tools/DebugWindow/CMakeLists.txt rename {GeneralsMD/Code => Core}/Tools/DebugWindow/DebugWindow.cpp (100%) rename {Generals/Code => Core}/Tools/DebugWindow/DebugWindow.def (100%) rename {GeneralsMD/Code => Core}/Tools/DebugWindow/DebugWindow.h (100%) rename {Generals/Code => Core}/Tools/DebugWindow/DebugWindow.rc (100%) rename {GeneralsMD/Code => Core}/Tools/DebugWindow/DebugWindowDialog.cpp (100%) rename {GeneralsMD/Code => Core}/Tools/DebugWindow/DebugWindowDialog.h (100%) rename {GeneralsMD/Code => Core}/Tools/DebugWindow/DebugWindowExport.h (100%) rename {GeneralsMD/Code => Core}/Tools/DebugWindow/Resource.h (100%) rename {GeneralsMD/Code => Core}/Tools/DebugWindow/StdAfx.cpp (100%) rename {GeneralsMD/Code => Core}/Tools/DebugWindow/StdAfx.h (100%) rename {Generals/Code => Core}/Tools/DebugWindow/post-build.bat (100%) rename {Generals/Code => Core}/Tools/DebugWindow/res/DebugWindow.rc2 (100%) delete mode 100644 Generals/Code/Tools/DebugWindow/CMakeLists.txt delete mode 100644 Generals/Code/Tools/DebugWindow/DebugWindow.cpp delete mode 100644 Generals/Code/Tools/DebugWindow/DebugWindow.h delete mode 100644 Generals/Code/Tools/DebugWindow/DebugWindowDialog.cpp delete mode 100644 Generals/Code/Tools/DebugWindow/DebugWindowDialog.h delete mode 100644 Generals/Code/Tools/DebugWindow/DebugWindowExport.h delete mode 100644 Generals/Code/Tools/DebugWindow/Resource.h delete mode 100644 Generals/Code/Tools/DebugWindow/StdAfx.cpp delete mode 100644 Generals/Code/Tools/DebugWindow/StdAfx.h delete mode 100644 GeneralsMD/Code/Tools/DebugWindow/CMakeLists.txt delete mode 100644 GeneralsMD/Code/Tools/DebugWindow/DebugWindow.def delete mode 100644 GeneralsMD/Code/Tools/DebugWindow/DebugWindow.rc delete mode 100644 GeneralsMD/Code/Tools/DebugWindow/post-build.bat delete mode 100644 GeneralsMD/Code/Tools/DebugWindow/res/DebugWindow.rc2 diff --git a/Core/Tools/CMakeLists.txt b/Core/Tools/CMakeLists.txt index 55b529f0d2e..20270f8ce2a 100644 --- a/Core/Tools/CMakeLists.txt +++ b/Core/Tools/CMakeLists.txt @@ -2,7 +2,7 @@ # Build useful tool binaries. if(RTS_BUILD_CORE_TOOLS) - # TODO: add subdirectory... + add_subdirectory(DebugWindow) endif() # Build less useful tool/test binaries. diff --git a/Core/Tools/DebugWindow/CMakeLists.txt b/Core/Tools/DebugWindow/CMakeLists.txt new file mode 100644 index 00000000000..d6514ca8ada --- /dev/null +++ b/Core/Tools/DebugWindow/CMakeLists.txt @@ -0,0 +1,28 @@ +set(DEBUGWINDOW_SRC + "DebugWindow.cpp" + "DebugWindow.h" + "DebugWindowDialog.cpp" + "DebugWindowDialog.h" + "DebugWindowExport.h" + "StdAfx.cpp" + "StdAfx.h" +) + +add_library(core_debugwindow SHARED) + +target_sources(core_debugwindow PRIVATE ${DEBUGWINDOW_SRC}) + +target_link_libraries(core_debugwindow PRIVATE + core_config +) + +if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") + target_compile_definitions(core_debugwindow PRIVATE _AFXDLL) + target_sources(core_debugwindow PRIVATE + DebugWindow.rc + DebugWindow.def + ) + set_target_properties(core_debugwindow PROPERTIES OUTPUT_NAME DebugWindow) +else() + set_target_properties(core_debugwindow PROPERTIES OUTPUT_NAME debugwindow) +endif() diff --git a/GeneralsMD/Code/Tools/DebugWindow/DebugWindow.cpp b/Core/Tools/DebugWindow/DebugWindow.cpp similarity index 100% rename from GeneralsMD/Code/Tools/DebugWindow/DebugWindow.cpp rename to Core/Tools/DebugWindow/DebugWindow.cpp diff --git a/Generals/Code/Tools/DebugWindow/DebugWindow.def b/Core/Tools/DebugWindow/DebugWindow.def similarity index 100% rename from Generals/Code/Tools/DebugWindow/DebugWindow.def rename to Core/Tools/DebugWindow/DebugWindow.def diff --git a/GeneralsMD/Code/Tools/DebugWindow/DebugWindow.h b/Core/Tools/DebugWindow/DebugWindow.h similarity index 100% rename from GeneralsMD/Code/Tools/DebugWindow/DebugWindow.h rename to Core/Tools/DebugWindow/DebugWindow.h diff --git a/Generals/Code/Tools/DebugWindow/DebugWindow.rc b/Core/Tools/DebugWindow/DebugWindow.rc similarity index 100% rename from Generals/Code/Tools/DebugWindow/DebugWindow.rc rename to Core/Tools/DebugWindow/DebugWindow.rc diff --git a/GeneralsMD/Code/Tools/DebugWindow/DebugWindowDialog.cpp b/Core/Tools/DebugWindow/DebugWindowDialog.cpp similarity index 100% rename from GeneralsMD/Code/Tools/DebugWindow/DebugWindowDialog.cpp rename to Core/Tools/DebugWindow/DebugWindowDialog.cpp diff --git a/GeneralsMD/Code/Tools/DebugWindow/DebugWindowDialog.h b/Core/Tools/DebugWindow/DebugWindowDialog.h similarity index 100% rename from GeneralsMD/Code/Tools/DebugWindow/DebugWindowDialog.h rename to Core/Tools/DebugWindow/DebugWindowDialog.h diff --git a/GeneralsMD/Code/Tools/DebugWindow/DebugWindowExport.h b/Core/Tools/DebugWindow/DebugWindowExport.h similarity index 100% rename from GeneralsMD/Code/Tools/DebugWindow/DebugWindowExport.h rename to Core/Tools/DebugWindow/DebugWindowExport.h diff --git a/GeneralsMD/Code/Tools/DebugWindow/Resource.h b/Core/Tools/DebugWindow/Resource.h similarity index 100% rename from GeneralsMD/Code/Tools/DebugWindow/Resource.h rename to Core/Tools/DebugWindow/Resource.h diff --git a/GeneralsMD/Code/Tools/DebugWindow/StdAfx.cpp b/Core/Tools/DebugWindow/StdAfx.cpp similarity index 100% rename from GeneralsMD/Code/Tools/DebugWindow/StdAfx.cpp rename to Core/Tools/DebugWindow/StdAfx.cpp diff --git a/GeneralsMD/Code/Tools/DebugWindow/StdAfx.h b/Core/Tools/DebugWindow/StdAfx.h similarity index 100% rename from GeneralsMD/Code/Tools/DebugWindow/StdAfx.h rename to Core/Tools/DebugWindow/StdAfx.h diff --git a/Generals/Code/Tools/DebugWindow/post-build.bat b/Core/Tools/DebugWindow/post-build.bat similarity index 100% rename from Generals/Code/Tools/DebugWindow/post-build.bat rename to Core/Tools/DebugWindow/post-build.bat diff --git a/Generals/Code/Tools/DebugWindow/res/DebugWindow.rc2 b/Core/Tools/DebugWindow/res/DebugWindow.rc2 similarity index 100% rename from Generals/Code/Tools/DebugWindow/res/DebugWindow.rc2 rename to Core/Tools/DebugWindow/res/DebugWindow.rc2 diff --git a/Generals/Code/Tools/CMakeLists.txt b/Generals/Code/Tools/CMakeLists.txt index 9fd5dc30331..0abdb299a54 100644 --- a/Generals/Code/Tools/CMakeLists.txt +++ b/Generals/Code/Tools/CMakeLists.txt @@ -2,7 +2,6 @@ # Build useful tool binaries. if(RTS_BUILD_GENERALS_TOOLS) - add_subdirectory(DebugWindow) add_subdirectory(GUIEdit) add_subdirectory(ImagePacker) add_subdirectory(MapCacheBuilder) diff --git a/Generals/Code/Tools/DebugWindow/CMakeLists.txt b/Generals/Code/Tools/DebugWindow/CMakeLists.txt deleted file mode 100644 index 6ae53af6d39..00000000000 --- a/Generals/Code/Tools/DebugWindow/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -set(DEBUGWINDOW_SRC - "DebugWindow.cpp" - "DebugWindow.h" - "DebugWindowDialog.cpp" - "DebugWindowDialog.h" - "DebugWindowExport.h" - "StdAfx.cpp" - "StdAfx.h" -) - -add_library(g_debugwindow SHARED) -set_target_properties(g_debugwindow PROPERTIES OUTPUT_NAME debugwindow) - -target_sources(g_debugwindow PRIVATE ${DEBUGWINDOW_SRC}) - -target_link_libraries(g_debugwindow PRIVATE - core_config -) - -if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") - target_compile_definitions(g_debugwindow PRIVATE _AFXDLL) - target_sources(g_debugwindow PRIVATE - DebugWindow.rc - DebugWindow.def - ) - set_target_properties(g_debugwindow PROPERTIES OUTPUT_NAME DebugWindow) -else() - set_target_properties(g_debugwindow PROPERTIES OUTPUT_NAME debugwindow) -endif() diff --git a/Generals/Code/Tools/DebugWindow/DebugWindow.cpp b/Generals/Code/Tools/DebugWindow/DebugWindow.cpp deleted file mode 100644 index e2f8655b829..00000000000 --- a/Generals/Code/Tools/DebugWindow/DebugWindow.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// 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(); - } -} \ No newline at end of file diff --git a/Generals/Code/Tools/DebugWindow/DebugWindow.h b/Generals/Code/Tools/DebugWindow/DebugWindow.h deleted file mode 100644 index 9a455974871..00000000000 --- a/Generals/Code/Tools/DebugWindow/DebugWindow.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// 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_) diff --git a/Generals/Code/Tools/DebugWindow/DebugWindowDialog.cpp b/Generals/Code/Tools/DebugWindow/DebugWindowDialog.cpp deleted file mode 100644 index 9383e8d0779..00000000000 --- a/Generals/Code/Tools/DebugWindow/DebugWindowDialog.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#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[0], "%d", frameNumber); - - CWnd *pWnd = GetDlgItem(IDC_FrameNumber); - if (pWnd) { - pWnd->SetWindowText(mFrameNumber.c_str()); - } -} - -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() \ No newline at end of file diff --git a/Generals/Code/Tools/DebugWindow/DebugWindowDialog.h b/Generals/Code/Tools/DebugWindow/DebugWindowDialog.h deleted file mode 100644 index a3040d0481a..00000000000 --- a/Generals/Code/Tools/DebugWindow/DebugWindowDialog.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - - -#include "Resource.h" -#include // for std::pair -#include // for std::string -#include // for std::vector - -typedef std::pair PairString; -typedef std::vector VecPairString; -typedef std::vector VecString; - -typedef std::vector::iterator VecPairStringIt; -typedef std::vector::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() - - - -}; \ No newline at end of file diff --git a/Generals/Code/Tools/DebugWindow/DebugWindowExport.h b/Generals/Code/Tools/DebugWindow/DebugWindowExport.h deleted file mode 100644 index 4987cde2a2f..00000000000 --- a/Generals/Code/Tools/DebugWindow/DebugWindowExport.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#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); -} \ No newline at end of file diff --git a/Generals/Code/Tools/DebugWindow/Resource.h b/Generals/Code/Tools/DebugWindow/Resource.h deleted file mode 100644 index 2b70b466052..00000000000 --- a/Generals/Code/Tools/DebugWindow/Resource.h +++ /dev/null @@ -1,26 +0,0 @@ -//{{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 diff --git a/Generals/Code/Tools/DebugWindow/StdAfx.cpp b/Generals/Code/Tools/DebugWindow/StdAfx.cpp deleted file mode 100644 index 7e214580f01..00000000000 --- a/Generals/Code/Tools/DebugWindow/StdAfx.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// 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" - - - diff --git a/Generals/Code/Tools/DebugWindow/StdAfx.h b/Generals/Code/Tools/DebugWindow/StdAfx.h deleted file mode 100644 index 2ed562467bb..00000000000 --- a/Generals/Code/Tools/DebugWindow/StdAfx.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// 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 - -// TheSuperHackers @compile xezon 24/03/2025 Prevent afxwin.h from loading d3d9types.h, colliding with our own DirectX library. -#define _d3d9TYPES_H_ - -#include // MFC core and standard components -#include // MFC extensions - -#ifndef _AFX_NO_OLE_SUPPORT -#include // MFC OLE classes -#include // MFC OLE dialog classes -#include // MFC Automation classes -#endif // _AFX_NO_OLE_SUPPORT - - -#ifndef _AFX_NO_DB_SUPPORT -#include // MFC ODBC database classes -#endif // _AFX_NO_DB_SUPPORT - -#ifndef _AFX_NO_DAO_SUPPORT -#include // MFC DAO database classes -#endif // _AFX_NO_DAO_SUPPORT - -#include // MFC support for Internet Explorer 4 Common Controls -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // 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_) diff --git a/GeneralsMD/Code/Tools/CMakeLists.txt b/GeneralsMD/Code/Tools/CMakeLists.txt index 8f63dc40c00..b5d2b2a878d 100644 --- a/GeneralsMD/Code/Tools/CMakeLists.txt +++ b/GeneralsMD/Code/Tools/CMakeLists.txt @@ -2,7 +2,6 @@ # Build useful tool binaries. if(RTS_BUILD_ZEROHOUR_TOOLS) - add_subdirectory(DebugWindow) add_subdirectory(GUIEdit) add_subdirectory(ImagePacker) add_subdirectory(MapCacheBuilder) diff --git a/GeneralsMD/Code/Tools/DebugWindow/CMakeLists.txt b/GeneralsMD/Code/Tools/DebugWindow/CMakeLists.txt deleted file mode 100644 index 5a98e87d8c8..00000000000 --- a/GeneralsMD/Code/Tools/DebugWindow/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -set(DEBUGWINDOW_SRC - "DebugWindow.cpp" - "DebugWindow.h" - "DebugWindowDialog.cpp" - "DebugWindowDialog.h" - "DebugWindowExport.h" - "StdAfx.cpp" - "StdAfx.h" -) - -add_library(z_debugwindow SHARED) -set_target_properties(z_debugwindow PROPERTIES OUTPUT_NAME debugwindow) - -target_sources(z_debugwindow PRIVATE ${DEBUGWINDOW_SRC}) - -target_link_libraries(z_debugwindow PRIVATE - core_config -) - -if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") - target_compile_definitions(z_debugwindow PRIVATE _AFXDLL) - target_sources(z_debugwindow PRIVATE - DebugWindow.rc - DebugWindow.def - ) - set_target_properties(z_debugwindow PROPERTIES OUTPUT_NAME DebugWindow) -else() - set_target_properties(z_debugwindow PROPERTIES OUTPUT_NAME debugwindow) -endif() diff --git a/GeneralsMD/Code/Tools/DebugWindow/DebugWindow.def b/GeneralsMD/Code/Tools/DebugWindow/DebugWindow.def deleted file mode 100644 index 1a14c937ee8..00000000000 --- a/GeneralsMD/Code/Tools/DebugWindow/DebugWindow.def +++ /dev/null @@ -1,6 +0,0 @@ -; DebugWindow.def : Declares the module parameters for the DLL. - -LIBRARY "DebugWindow" -DESCRIPTION 'DebugWindow Windows Dynamic Link Library' - -EXPORTS diff --git a/GeneralsMD/Code/Tools/DebugWindow/DebugWindow.rc b/GeneralsMD/Code/Tools/DebugWindow/DebugWindow.rc deleted file mode 100644 index 7722908f212..00000000000 --- a/GeneralsMD/Code/Tools/DebugWindow/DebugWindow.rc +++ /dev/null @@ -1,177 +0,0 @@ -//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 - diff --git a/GeneralsMD/Code/Tools/DebugWindow/post-build.bat b/GeneralsMD/Code/Tools/DebugWindow/post-build.bat deleted file mode 100644 index 9f13c3e38d1..00000000000 --- a/GeneralsMD/Code/Tools/DebugWindow/post-build.bat +++ /dev/null @@ -1 +0,0 @@ -@copy debug\debugWindow.dll ..\..\..\Run \ No newline at end of file diff --git a/GeneralsMD/Code/Tools/DebugWindow/res/DebugWindow.rc2 b/GeneralsMD/Code/Tools/DebugWindow/res/DebugWindow.rc2 deleted file mode 100644 index a9778297b91..00000000000 --- a/GeneralsMD/Code/Tools/DebugWindow/res/DebugWindow.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// 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... - -/////////////////////////////////////////////////////////////////////////////