Add impl. for DmGetXboxName, stub 5 functions Stubs: DmGetXbeInfo, DmIsDebuggerPresent, DmRegisterCommandProcessor, DmRegisterCommandProcessorEx This helps progress some debug builds of games, DmGetXboxName error codes are based on what some games seem to expect from it. Will probably be a good idea to move most of this to xbdm_info.cc soon.

This commit is contained in:
emoose 2020-01-09 17:25:50 +00:00 committed by illusion
parent 9719627296
commit 78c728b81d
1 changed files with 46 additions and 12 deletions

View File

@ -14,6 +14,8 @@
#include "xenia/kernel/xthread.h"
#include "xenia/xbox.h"
#define XBDM_ERROR(err) (0x82DA0000 | (err & 0xFFFF))
namespace xe {
namespace kernel {
namespace xbdm {
@ -33,24 +35,12 @@ DECLARE_XBDM_EXPORT1(DmCloseLoadedModules, kDebug, kStub);
MAKE_DUMMY_STUB_STATUS(DmFreePool);
dword_result_t DmGetXbeInfo() {
// TODO(gibbed): Crackdown appears to expect this as success?
// Unknown arguments -- let's hope things don't explode.
return 0x02DA0000;
}
DECLARE_XBDM_EXPORT1(DmGetXbeInfo, kDebug, kStub);
MAKE_DUMMY_STUB_STATUS(DmGetXboxName);
dword_result_t DmIsDebuggerPresent() { return 0; }
DECLARE_XBDM_EXPORT1(DmIsDebuggerPresent, kDebug, kStub);
MAKE_DUMMY_STUB_STATUS(DmRegisterCommandProcessor);
void DmSendNotificationString(lpdword_t unk0_ptr) {}
DECLARE_XBDM_EXPORT1(DmSendNotificationString, kDebug, kStub);
MAKE_DUMMY_STUB_STATUS(DmRegisterCommandProcessorEx);
MAKE_DUMMY_STUB_STATUS(DmStartProfiling);
MAKE_DUMMY_STUB_STATUS(DmStopProfiling);
@ -75,6 +65,50 @@ dword_result_t DmFindPdbSignature(lpdword_t unk0_ptr, lpdword_t unk1_ptr) {
}
DECLARE_XBDM_EXPORT1(DmFindPdbSignature, kDebug, kStub);
dword_result_t DmGetXbeInfo(pointer_t<char> path, pointer_t<uint8_t> info) {
// TODO: get full path of path parameter, and copy it into info[0:0x100]
memset(info, 0, 0x10C);
return X_ERROR_SUCCESS;
}
DECLARE_XBDM_EXPORT1(DmGetXbeInfo, kDebug, kStub);
dword_result_t DmGetXboxName(pointer_t<char> name, lpdword_t name_len) {
std::string box_name = "XeniaBox";
if (!name_len) {
return XBDM_ERROR(0x17); // xbdm invalid arg error code?
}
auto orig_len = *name_len;
*name_len = (uint32_t)box_name.length() + 1;
if (orig_len < *name_len) {
return XBDM_ERROR(0x105); // xbdm buffer size error code?
}
// Limit console name size to 255 chars
auto name_size = std::min((uint32_t)box_name.length(), 255u);
memcpy(name, box_name.c_str(), name_size);
name[name_size] = 0;
return X_ERROR_SUCCESS;
}
DECLARE_XBDM_EXPORT1(DmGetXboxName, kDebug, kImplemented);
dword_result_t DmRegisterCommandProcessor(dword_t r3, dword_t r4) {
return X_ERROR_SUCCESS;
}
DECLARE_XBDM_EXPORT1(DmRegisterCommandProcessor, kDebug, kStub);
dword_result_t DmRegisterCommandProcessorEx(dword_t r3, dword_t r4,
dword_t r5) {
return X_ERROR_SUCCESS;
}
DECLARE_XBDM_EXPORT1(DmRegisterCommandProcessorEx, kDebug, kStub);
dword_result_t DmSetDumpSettings(dword_t r3) { return X_ERROR_SUCCESS; }
DECLARE_XBDM_EXPORT1(DmSetDumpSettings, kDebug, kStub);
void RegisterMiscExports(xe::cpu::ExportResolver* export_resolver,
KernelState* kernel_state) {}