From 3d2f6745b40d00e1b0809aa45646a9eb5a47a336 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 3 Mar 2021 17:35:46 +0100 Subject: Ready to emulate main elf --- src/main.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src') 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; } -- cgit 1.4.1