[XBDM] 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 illusion98
parent 56925afdc8
commit 7fa2567d20
1 changed files with 49 additions and 0 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 {
@ -42,6 +44,53 @@ 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 DmIsDebuggerPresent() { return 0; }
DECLARE_XBDM_EXPORT1(DmIsDebuggerPresent, kDebug, kStub);
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) {}