Report relaunching with another Xbe to the debugger

This commit is contained in:
x1nixmzeng 2020-10-11 12:13:03 +01:00
parent a380927fba
commit 3a740d7933
3 changed files with 45 additions and 14 deletions

View File

@ -37,19 +37,19 @@ namespace CxbxDebugger
// Note: Keep the top 3-bits empty as they are used internally
enum ReportType : DWORD
{
// Debugger report codes:
HLECACHE_FILE = 0x1000,
HLECACHE_FILE = 0x00deed00,
KERNEL_PATCH = 0x00deed01,
FILE_OPENED = 0x00deed02,
FILE_READ = 0x00deed03,
FILE_CLOSED = 0x00deed04,
DEBUGGER_INIT = 0x00deed05,
FILE_WRITE = 0x00deed06,
KERNEL_PATCH = 0x2000,
// Debugger query codes:
FILE_OPENED = 0x3000,
FILE_READ = 0x3001,
FILE_WRITE = 0x3002,
FILE_CLOSED = 0x3003,
OVERRIDE_EXCEPTION = 0x00ceed01,
DEBUGGER_INIT = 0x400,
DEBUGGER_NEW_TARGET = 0x401,
OVERRIDE_EXCEPTION = 0x500,
};
bool IsAttached()
@ -130,6 +130,7 @@ namespace CxbxDebugger
case Internal::FILE_READ:
case Internal::FILE_CLOSED:
case Internal::DEBUGGER_INIT:
case Internal::DEBUGGER_NEW_TARGET:
return true;
case Internal::OVERRIDE_EXCEPTION:
@ -148,12 +149,20 @@ namespace CxbxDebugger
{
Internal::ReportHelper Report(Internal::DEBUGGER_INIT);
Report.Add(0); // unused
Report.AddString(XbeTitle);
Report.Send();
}
void ReportNewTarget(const char* CommandLine)
{
Internal::ReportHelper Report(Internal::DEBUGGER_NEW_TARGET);
Report.AddString(CommandLine);
Report.Send();
}
void ReportHLECacheFile(const char* Filename)
{
Internal::ReportHelper Report(Internal::HLECACHE_FILE);

View File

@ -36,6 +36,7 @@ namespace CxbxDebugger
// Report helpers:
void ReportDebuggerInit(const char* XbeTitle);
void ReportNewTarget(const char* CommandLine);
void ReportHLECacheFile(const char* Filename);
void ReportKernelPatch(const char* ImportName, DWORD Address);

View File

@ -46,6 +46,7 @@
#include "common/util/strConverter.hpp" // for utf16_to_ascii
#include "core\kernel\memory-manager\VMManager.h"
#include "common/util/cliConfig.hpp"
#include "common/CxbxDebugger.h"
#include <algorithm> // for std::replace
#include <locale>
@ -588,11 +589,31 @@ XBSYSAPI EXPORTNUM(49) xbox::void_xt DECLSPEC_NORETURN NTAPI xbox::HalReturnToFi
g_VMManager.SavePersistentMemory();
// Some titles (Xbox Dashboard and retail/demo discs) use ";" as a current directory path seperator
// This process is handled during initialization. No speical handling here required.
// This process is handled during initialization. No special handling here required.
cli_config::SetLoad(XbePath);
if (!CxbxExec(false, nullptr, false)) {
CxbxKrnlCleanup("Could not launch %s", XbePath.c_str());
bool Debugging{ false };
g_EmuShared->GetDebuggingFlag(&Debugging);
if (Debugging)
{
std::string cliCommands;
if (!cli_config::GenCMD(cliCommands))
{
CxbxKrnlCleanup("Could not launch %s", XbePath.c_str());
}
CxbxDebugger::ReportNewTarget(cliCommands.c_str());
// The debugger will execute this process
}
else
{
if (!CxbxExec(false, nullptr, false))
{
CxbxKrnlCleanup("Could not launch %s", XbePath.c_str());
}
}
// This is a requirement to have shared memory buffers remain alive and transfer to new emulation process.