TASEmulators / desmume

DeSmuME is a Nintendo DS emulator
http://desmume.org
GNU General Public License v2.0
2.84k stars 528 forks source link

[Windows/ARM] JIT ARM32 (MSVC) support #633

Open basharast opened 1 year ago

basharast commented 1 year ago

Hi, I was compiling your emulator as libretro core (base code from this repo) I need it in this way because it's the only solution to port DS emulation for legacy windows arm devices. I made the required changes on memory functions and seems fine as the app didn't crash,

Issue

all I got is white screen with no sound also, seems it's waiting for something because JIT instructions are working (as per the log below),

I'm not sure if I compile it in the right way because I included only utils/arm_jit/arm_jit_arm.cpp which will include arm_emit & emit_core (+ HAVE_JIT defined while compiling the whole code)

Debug log

Here log file including JIT debug log retroarch2023_02_1301_48_27.log

is there anything has to be changed to fix this issue?

Environment details

System: Windows ARM32 Platform: UWP CPU: Qualcomm Snapdragon (8994)

it's pretty desperate situation when working on ARM32/UWP but any help will be appreciated as I'm looking forward to get DS emulation in better performance.

Side note

because of UWP security problem, memory cannot be protected as write+execute at once as workaround (partially for testing) during the code I swap the protection, I doubt I had issue with this because usually it will throw memory exception if anything went wrong. but to confirm the only place I had to do this swap is JittedFunc createFunc at emit_core.cpp

while (curr_bytes) {
        if (curr_bytes->next) {
        MakeWritable(fn_ptr, CHUNK_SIZE); //enable write
            memcpy(fn_ptr, curr_bytes->data, CHUNK_SIZE);
            fn_ptr += CHUNK_SIZE;
            tot_bytes_acum += CHUNK_SIZE;
        MakeExecutable(fn_ptr, CHUNK_SIZE); //back to execute
        }
        else {
        size_t sz = g_TOTALBYTES - tot_bytes_acum;
        MakeWritable(fn_ptr, sz); //enable write
            memcpy(fn_ptr, curr_bytes->data, sz);
        MakeExecutable(fn_ptr, sz);  //back to execute
            break;
        }
        curr_bytes = curr_bytes->next;
    }

Many thanks.

zeromus commented 1 year ago

Make instruction trace from your version and windows desktop desmume and check to make sure they are the same. Look to see if sound registers/video registers are being written (breakpoints in c++).