[misc] Fix runtime Linux problems derived from a different initialization order on instancing classes.

This commit is contained in:
Marco Rodolfi 2025-01-19 19:50:39 +01:00 committed by Radosław Gliński
parent 2a232abc09
commit 0dc0f18abb
1 changed files with 11 additions and 2 deletions

View File

@ -21,6 +21,17 @@ namespace xam {
std::atomic<int> xam_dialogs_shown_ = {0};
// FixMe(RodoMa92): Same hack as main_init_posix.cc:40
// Force initialization before constructor calling, mimicking
// Windows.
// Ref:
// https://reviews.llvm.org/D12689#243295
#ifdef XE_PLATFORM_LINUX
__attribute__((init_priority(101)))
#endif
static std::vector<xe::cpu::Export*>
xam_exports(4096);
bool xeXamIsUIActive() { return xam_dialogs_shown_ > 0; }
XamModule::XamModule(Emulator* emulator, KernelState* kernel_state)
@ -34,8 +45,6 @@ XamModule::XamModule(Emulator* emulator, KernelState* kernel_state)
#undef XE_MODULE_EXPORT_GROUP
}
std::vector<xe::cpu::Export*> xam_exports(4096);
xe::cpu::Export* RegisterExport_xam(xe::cpu::Export* export_entry) {
assert_true(export_entry->ordinal < xam_exports.size());
xam_exports[export_entry->ordinal] = export_entry;