mGBA Forums
mGBA got stuck on libretro - Printable Version

+- mGBA Forums (https://forums.mgba.io)
+-- Forum: mGBA (https://forums.mgba.io/forumdisplay.php?fid=1)
+--- Forum: General (https://forums.mgba.io/forumdisplay.php?fid=3)
+--- Thread: mGBA got stuck on libretro (/showthread.php?tid=4864)



mGBA got stuck on libretro - winktj - 08-23-2018

I compiled mGBA as a libretro core and rans on RetroARCH (ARMv7 + OpenGLES + EGL + DRM/KMS + toolchain:arm-linux-gnueabi without hard float).

Core and ROM was loaded successfully, but it hangs on a white screen and didn't  responds any inputs.
   
I added some debug log prints on RetroArch source codes and I found that the main loop of RetroARCH stucks on core_run function, that is why RetroARCH can not response all input events.
I also added debug log prints into mGBA source codes:
Code:
static void _GBACoreRunFrame(struct mCore* core) {
    struct GBA* gba = core->board;
    int32_t frameCounter = gba->video.frameCounter;
    printf("TJDEBUG %s %d: frameCounter = %d\n", __func__, __LINE__, frameCounter);
    while (gba->video.frameCounter == frameCounter) {
        ARMRunLoop(core->cpu);
    }
    printf("TJDEBUG %s %d: video.frameCounter = %d\n", __func__, __LINE__, gba->video.frameCounter);
}

The result shows that when frameCounter equals 6, core will run infinitely at ARMRunLoop(core->cpu);, can not break out the while loop.

This problem has been bothering me for a while, and I would be grateful if someone could give me some ideas to debug the issues.

Thank you!


RE: mGBA got stuck on libretro - endrift - 08-23-2018

What game?


RE: mGBA got stuck on libretro - winktj - 08-23-2018

(08-23-2018, 04:47 AM)endrift Wrote: What game?

Hi endirft,

Thanks for reply.

I have tried many roms, like Super Mario Advance 4 - Super Mario Bros. 3 (U) (V1.1), Pokemon-Fire Red.gba, Metal Slug Advance (U).gba.
Both of them got the same result - only render first 6 frames and hang on.

This is the “stuck screen" that loading  Super Mario Bros. 3:

   


RE: mGBA got stuck on libretro - winktj - 08-31-2018

Hi endirft
After a long debugging time, I found the problem is that it struck on the function audioCallback in RetroARCH. There maybe something wrong in Audio setting of my Linux System.

Thanks for your reply again!