* statics initialization order fix

This commit is contained in:
Ink 2016-12-06 14:39:32 +03:00
parent a636b3cbcf
commit 8a1d72098f
1 changed files with 6 additions and 1 deletions

View File

@ -140,9 +140,13 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
});
}
std::vector<xe::cpu::Export*> xboxkrnl_exports(4096);
static auto& get_xboxkrnl_exports() {
static std::vector<xe::cpu::Export*> xboxkrnl_exports(4096);
return xboxkrnl_exports;
}
xe::cpu::Export* RegisterExport_xboxkrnl(xe::cpu::Export* export_entry) {
auto& xboxkrnl_exports = get_xboxkrnl_exports();
assert_true(export_entry->ordinal < xboxkrnl_exports.size());
xboxkrnl_exports[export_entry->ordinal] = export_entry;
return export_entry;
@ -158,6 +162,7 @@ void XboxkrnlModule::RegisterExportTable(
#include "xenia/kernel/xboxkrnl/xboxkrnl_table.inc"
};
#include "xenia/kernel/util/export_table_post.inc"
auto& xboxkrnl_exports = get_xboxkrnl_exports();
for (size_t i = 0; i < xe::countof(xboxkrnl_export_table); ++i) {
auto& export_entry = xboxkrnl_export_table[i];
assert_true(export_entry.ordinal < xboxkrnl_exports.size());