about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-03 17:35:46 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-03 17:35:46 +0100
commit3d2f6745b40d00e1b0809aa45646a9eb5a47a336 (patch)
tree24ca479d1a688f1115b7b98f47fb8ca416fa4f39
parent1c9e2c998ffc9f20fc72aa75b01dae6c336659e4 (diff)
downloadbox64-3d2f6745b40d00e1b0809aa45646a9eb5a47a336.tar.gz
box64-3d2f6745b40d00e1b0809aa45646a9eb5a47a336.zip
Ready to emulate main elf
-rwxr-xr-xsrc/main.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index b5ba59ec..1395263b 100755
--- a/src/main.c
+++ b/src/main.c
@@ -505,7 +505,7 @@ void setupTrace(box64context_t* context)
 #endif
 }
 
-void endBox86()
+void endBox64()
 {
     if(!my_context)
         return;
@@ -874,7 +874,22 @@ int main(int argc, const char **argv, const char **env) {
     // and handle PLT
     RelocateElfPlt(my_context->maplib, NULL, elf_header);
     // defered init
-//    RunDeferedElfInit(emu);
+    RunDeferedElfInit(emu);
+    // do some special case check, _IO_2_1_stderr_ and friends, that are setup by libc, but it's already done here, so need to do a copy
+    ResetSpecialCaseMainElf(elf_header);
+    // init...
+    setupTrace(my_context);
+    // get entrypoint
+    my_context->ep = GetEntryPoint(my_context->maplib, elf_header);
+#if defined(RPI) || defined(RK3399)
+    // before launching emulation, let's check if this is a mojosetup from GOG
+    if (((strstr(prog, "bin/linux/x86/mojosetup") && getenv("MOJOSETUP_BASE")) || strstr(prog, ".mojosetup/mojosetup"))
+       && getenv("GTK2_RC_FILES")) {
+        sanitize_mojosetup_gtk_background();
+    }
+#endif
+
+    atexit(endBox64);
 
     return 0;
 }