First post, by superfury
I've currently moved my entire CPU thread to the main thread (the main thread was only processing input using for(;SDL_PollEvent(&event);) loop). Now the CPU itself is also processed in the main thread (so essentially three threads now: The main(CPU&input) thread, the timer thread(handling hardware timing like the VGA etc.) and audio thread(started by SDL). There's also a pause menu thread (with the CPU thread only processing input, CPU is disabled when this thread is running) which handles the settings menu (started by pressing SELECT/Backspace at boot or during CPU running time).
For some reason the CPU is very slow now (at/below 8086 speed). It used to run at about the speed of 1MIPS according to the now-removed IPS counter (now it's about 333KIPS afaik, probably slower, not measured).
The application for some reason only runs at about 20% CPU (Idling 80% of the time). According to the profiler it spends most time in ntdll.dll or WOW64.dll. Is SDL_Delay being called too much? Or is the SDL_PollEvent the cause of the slow CPU? It's essentially one for loop every instruction executed.
My project location:
https://bitbucket.org/superfury/x86emu/src
The main file is at emu/main.c (including the CPU loop and input update calls in updateInputMain).
Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io