| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- /*
- ** 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();
- }
- }
|