mupen64plus-ui-console
mupen64plus-ui-console copied to clipboard
Screenshots not all taked from command line
I realize, in some situation, every requested screenshots (argument --testshots
) are not all generated.
I have a test suite that open a rom with a save state and save some screenshots. Generated command line looks like this:
./mupen64plus --resolution 640x480 --audio dummy --configdir ./ --nosaveoptions --testshots 2,5 --savestate mupen64plus-regression-test/save_state/1080sb-charselect.st0 --sshotdir mupen64plus-regression-test/screenshot /home/narann/code/repo/mupen64plus/mupen64plus-regression-test/rom/1080sb.z64
The second screenshot is never generated. Interestingly, I have around hundred tests and only 4-6 have this problem. It's not game related, maybe more save state related.
Looking at the code where the console ask for the screen shot:
https://github.com/mupen64plus/mupen64plus-ui-console/blob/master/src/main.c#L141
And how the core handle it:
https://github.com/mupen64plus/mupen64plus-core/blob/b9765eca453ed46773655c44bc86fbcdeb33ab7c/src/main/main.c#L725
As I understand the code, the core ask for a screenshot "next time" the video plugin reach video_plugin_render_callback
. But the console ask for M64CMD_STOP
as soon the last frame+1 is reached. This mean, the frame callback M64CMD_SET_FRAME_CALLBACK
is executed before the video plugin reach video_plugin_render_callback
and take its screenshot.
I will do some test to know if wait few frames after the latest screenshot before close the emulator could help...
I just tested 1 frame count in the callback (aka, wait one frame before ask the emulator to close) and it works!
However, I'm not sure it's the best thing to do... Any idea @richard42 ?
Yeah, you could change line 145 to something like this:
else if (nextshot == 0 && FrameIndex == l_TestShotList[l_TestShotIdx-1] + 3)
Nice! I will do that!