Added XBDM stubs.

This commit is contained in:
gibbed 2017-01-09 04:51:49 -06:00
parent 4ed0068da8
commit d730784efb
9 changed files with 228 additions and 0 deletions

View File

@ -44,6 +44,7 @@ struct ExportTag {
static const type kUserProfiles = 1u << 16;
static const type kNetworking = 1u << 17;
static const type kMemory = 1u << 18;
static const type kDebug = 1u << 19;
// Export will be logged on each call.
static const type kLog = 1u << 30;

View File

@ -32,6 +32,7 @@
#include "xenia/kernel/util/gameinfo_utils.h"
#include "xenia/kernel/util/xdbf_utils.h"
#include "xenia/kernel/xam/xam_module.h"
#include "xenia/kernel/xbdm/xbdm_module.h"
#include "xenia/kernel/xboxkrnl/xboxkrnl_module.h"
#include "xenia/memory.h"
#include "xenia/ui/imgui_dialog.h"
@ -167,6 +168,7 @@ X_STATUS Emulator::Setup(
// HLE kernel modules.
kernel_state_->LoadKernelModule<kernel::xboxkrnl::XboxkrnlModule>();
kernel_state_->LoadKernelModule<kernel::xam::XamModule>();
kernel_state_->LoadKernelModule<kernel::xbdm::XbdmModule>();
// Initialize emulator fallback exception handling last.
ExceptionHandler::Install(Emulator::ExceptionCallbackThunk, this);

View File

@ -405,6 +405,7 @@ void AppendParam(StringBuffer* string_buffer, pointer_t<T> param) {
enum class KernelModuleId {
xboxkrnl,
xam,
xbdm,
};
template <size_t I = 0, typename... Ps>
@ -518,6 +519,7 @@ using xe::cpu::ExportTag;
&name, #name, tags));
#define DECLARE_XAM_EXPORT(name, tags) DECLARE_EXPORT(xam, name, tags)
#define DECLARE_XBDM_EXPORT(name, tags) DECLARE_EXPORT(xbdm, name, tags)
#define DECLARE_XBOXKRNL_EXPORT(name, tags) DECLARE_EXPORT(xboxkrnl, name, tags)
} // namespace kernel

View File

@ -0,0 +1,52 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include "xenia/base/logging.h"
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/util/shim_utils.h"
#include "xenia/kernel/xbdm/xbdm_private.h"
#include "xenia/kernel/xthread.h"
#include "xenia/xbox.h"
namespace xe {
namespace kernel {
namespace xbdm {
void DmCloseLoadedModules(lpdword_t unk0_ptr) {}
DECLARE_XBDM_EXPORT(DmCloseLoadedModules, ExportTag::kStub | ExportTag::kDebug);
void DmSendNotificationString(lpdword_t unk0_ptr) {}
DECLARE_XBDM_EXPORT(DmSendNotificationString,
ExportTag::kStub | ExportTag::kDebug);
dword_result_t DmWalkLoadedModules(lpdword_t unk0_ptr, lpdword_t unk1_ptr) {
return X_STATUS_INVALID_PARAMETER;
}
DECLARE_XBDM_EXPORT(DmWalkLoadedModules, ExportTag::kStub | ExportTag::kDebug);
dword_result_t DmCaptureStackBackTrace(lpdword_t unk0_ptr, lpdword_t unk1_ptr) {
return X_STATUS_INVALID_PARAMETER;
}
DECLARE_XBDM_EXPORT(DmCaptureStackBackTrace,
ExportTag::kStub | ExportTag::kDebug);
void DmMapDevkitDrive() {}
DECLARE_XBDM_EXPORT(DmMapDevkitDrive, ExportTag::kStub | ExportTag::kDebug);
dword_result_t DmFindPdbSignature(lpdword_t unk0_ptr, lpdword_t unk1_ptr) {
return X_STATUS_INVALID_PARAMETER;
}
DECLARE_XBDM_EXPORT(DmFindPdbSignature, ExportTag::kStub | ExportTag::kDebug);
void RegisterMiscExports(xe::cpu::ExportResolver* export_resolver,
KernelState* kernel_state) {}
} // namespace xboxkrnl
} // namespace kernel
} // namespace xe

View File

@ -0,0 +1,61 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include "xenia/kernel/xbdm/xbdm_module.h"
#include <vector>
#include "xenia/base/math.h"
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/xbdm/xbdm_private.h"
namespace xe {
namespace kernel {
namespace xbdm {
XbdmModule::XbdmModule(Emulator* emulator, KernelState* kernel_state)
: KernelModule(kernel_state, "xe:\\xbdm.xex") {
RegisterExportTable(export_resolver_);
// Register all exported functions.
RegisterMiscExports(export_resolver_, kernel_state_);
}
std::vector<xe::cpu::Export*> xbdm_exports(4096);
xe::cpu::Export* RegisterExport_xbdm(xe::cpu::Export* export_entry) {
assert_true(export_entry->ordinal < xbdm_exports.size());
xbdm_exports[export_entry->ordinal] = export_entry;
return export_entry;
}
void XbdmModule::RegisterExportTable(xe::cpu::ExportResolver* export_resolver) {
assert_not_null(export_resolver);
// Build the export table used for resolution.
#include "xenia/kernel/util/export_table_pre.inc"
static xe::cpu::Export xbdm_export_table[] = {
#include "xenia/kernel/xbdm/xbdm_table.inc"
};
#include "xenia/kernel/util/export_table_post.inc"
for (size_t i = 0; i < xe::countof(xbdm_export_table); ++i) {
auto& export_entry = xbdm_export_table[i];
assert_true(export_entry.ordinal < xbdm_exports.size());
if (!xbdm_exports[export_entry.ordinal]) {
xbdm_exports[export_entry.ordinal] = &export_entry;
}
}
export_resolver->RegisterTable("xbdm.xex", &xbdm_exports);
}
XbdmModule::~XbdmModule() {}
} // namespace xbdm
} // namespace kernel
} // namespace xe

View File

@ -0,0 +1,36 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_XBDM_XBDM_MODULE_H_
#define XENIA_KERNEL_XBDM_XBDM_MODULE_H_
#include <string>
#include "xenia/cpu/export_resolver.h"
#include "xenia/kernel/kernel_module.h"
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/xbdm/xbdm_ordinals.h"
namespace xe {
namespace kernel {
namespace xbdm {
class XbdmModule : public KernelModule {
public:
XbdmModule(Emulator* emulator, KernelState* kernel_state);
virtual ~XbdmModule();
static void RegisterExportTable(xe::cpu::ExportResolver* export_resolver);
};
} // namespace xbdm
} // namespace kernel
} // namespace xe
#endif // XENIA_KERNEL_XBDM_XBDM_MODULE_H_

View File

@ -0,0 +1,24 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_XBDM_XBDM_ORDINALS_H_
#define XENIA_KERNEL_XBDM_XBDM_ORDINALS_H_
#include "xenia/cpu/export_resolver.h"
// Build an ordinal enum to make it easy to lookup ordinals.
#include "xenia/kernel/util/ordinal_table_pre.inc"
namespace ordinals {
enum {
#include "xenia/kernel/xbdm/xbdm_table.inc"
};
} // namespace ordinals
#include "xenia/kernel/util/ordinal_table_post.inc"
#endif // XENIA_KERNEL_XBDM_XBDM_ORDINALS_H_

View File

@ -0,0 +1,31 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_XBDM_XBDM_PRIVATE_H_
#define XENIA_KERNEL_XBDM_XBDM_PRIVATE_H_
#include "xenia/cpu/export_resolver.h"
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/xbdm/xbdm_ordinals.h"
namespace xe {
namespace kernel {
namespace xbdm {
xe::cpu::Export* RegisterExport_xbdm(xe::cpu::Export* export_entry);
// Registration functions, one per file.
void RegisterMiscExports(xe::cpu::ExportResolver* export_resolver,
KernelState* kernel_state);
} // namespace xbdm
} // namespace kernel
} // namespace xe
#endif // XENIA_KERNEL_XBDM_XBDM_PRIVATE_H_

View File

@ -0,0 +1,19 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
// This is a partial file designed to be included by other files when
// constructing various tables.
XE_EXPORT(xbdm, 0x00000004, DmCloseLoadedModules, kFunction),
XE_EXPORT(xbdm, 0x00000024, DmSendNotificationString, kFunction),
XE_EXPORT(xbdm, 0x00000033, DmWalkLoadedModules, kFunction),
XE_EXPORT(xbdm, 0x00000052, DmCaptureStackBackTrace, kFunction),
XE_EXPORT(xbdm, 0x0000008D, DmMapDevkitDrive, kFunction),
XE_EXPORT(xbdm, 0x00000091, DmFindPdbSignature, kFunction),