twinaphex/genesis-next — comment on commit 62ee45296bd1e23ca9dede6461caa59d0d0f7357
File:  line 0
By ekeeke:

I am glad it's working now but there are still a few things I would like to figure before blindly merging things. As I said in previous posts, I am more interested in the reasons why the patches are needed d than in patches themselves:

1) libsnes fix to state.c seems more like a hack to me and I'm sure I can find a solution that fits everyone's need if you explain me exactly why those changes are needed. As far as I can tell, the only changes are the name of the functions parameter and the returned size when saving. I can't figure how the first one could be an issue to the frontend and as for the second one, it should be up to libsnes to simply ignore the returned value of state_save and use STATE_SIZE instead.

2) I still don't get why include to stdlib.h need to be moved out m68kops.h, this does not make any sense to me so can you at least give me the error or warning you are getting ?

3) why are custom blitting functions needed for libsnes in NTSC filters ? is that because it uses 15-bit RGB ? in that case, a better solution would be to use the existing define for that. Also, I think there is a #ifdef in vdp_render.c that prevents using NTSC filter if anything else than 16-bit RGB is used. Has this been modified as well ? Again, a better understanding of what libsnes is specifically needing can help me figuring a more portable solution.

More generally, what I am trying to do is to get ride of port specific defines (like those existing #ifdef NGC as well) and figure better portable solutions, because I doesn't feel like doing all these stuff again for every future platform ports... In my current implementation, this is already true for specific defines in vdp_render.c, sms_cart.c and system.c (now passes the sound buffer pointer to audio_update function).

Some other stuff you might want to fix in your ports:

- the framerate values you are using when calling audio_init are SPECIFIC to the Wii/Gamecube ports, as those values are only required to keep Wii/Gamecube audio & video hardware in sync, using exact frequency when VSYNC is used. In my current (uncommited) version, this is hopefully better explained and I added an option to force VSYNC OFF. audio_init & sound_init functions have also been modified so that passing 0 as framerate parameter forces the emulator to run at the original clock speed instead. As you probably don't care about that on PS3, better use default framerates.

- similarly, you shouldn't care about interlaced mode changes (bitmap.viewport.changed & 4), this is only for Wii/Gamecube ports, again when VSYNC is used in original video mode. In this mode, video mode is switching between non-interlaced and interlaced like a real Genesis would do and VSYNC timings are changing, hence why I need to reinitialize framerate value and audio timings to keep everything in sync.