swap handling

This commit is contained in:
lizzie 2025-12-11 05:01:48 +00:00
parent 43c7b288a8
commit a034d7a8c2
4 changed files with 43 additions and 3 deletions

View file

@ -51,6 +51,7 @@
#endif
#ifdef __OPENORBIS__
#include <orbis/SystemService.h>
# define STUB_WEAK(name) extern "C" void name() { printf("called " #name); asm volatile("ud2"); }
STUB_WEAK(__cxa_thread_atexit)
STUB_WEAK(__assert)
@ -441,10 +442,20 @@ int main(int argc, char** argv) {
[](VideoCore::LoadCallbackStage, size_t value, size_t total) {});
}
system.RegisterExitCallback([&] {
auto const exit_fn = [&] {
#ifdef __OPENORBIS__
sceSystemServiceLoadExec("EXIT", nullptr);
#else
// Just exit right away.
exit(0);
});
#endif
};
system.RegisterExitCallback(exit_fn);
#ifdef __linux__
Common::Linux::StartGamemode();
#endif
void(system.Run());
if (system.DebuggerEnabled()) {
system.InitializeDebugger();
@ -456,6 +467,7 @@ int main(int argc, char** argv) {
void(system.Pause());
system.ShutdownMainProcess();
detached_tasks.WaitForAllTasks();
exit_fn();
return 0;
}