libretro / flycast

Flycast is a multiplatform Sega Dreamcast emulator. NOTE: No longer actively developed, use upstream repo for libretro from now on - https://github.com/flyinghead/flycast
http://reicast.com
GNU General Public License v2.0
155 stars 78 forks source link

I have a fix for the Date/Time problem but can't fork the repo #40

Closed 7oxicshadow closed 6 years ago

7oxicshadow commented 6 years ago

Hi @twinaphex,

I have a fix for the Date/Time problem with the libretro version. I would create a pull request but because I already have a fork of the master repo (with pending pull requests) which means I cant create a fork of this fork.

Instead I will just detail the required change with an explanation here.

The problem exists on the Libretro branch because it reads the dc_nvmem.bin from /dc/ but when it writes the settings to nvram it writes to /dc/data.

Doh!

The solution is to change the following code in nullDC.cpp: (approx line 257)

#ifdef _WIN32
    SaveRomFiles(get_writable_data_path(""));
#else
    SaveRomFiles(get_writable_data_path(""));
#endif

Once making this change it means that the dc_nvmem.bin will be in the same directory as the bios.

If you would rather keep it in the data folder you will have to modify the LoadRomFiles() function. Ideally this function needs to be split because it assumes that the bios and nvmem is in the same folder whereas libretro will need different paths.

Note: When setting the time during the Dreamcast bios, make sure you set it accurately as there seems to be some sort of validation check that will fail if it is too far out from the current time...

All I ask is that you mention my name in the commit history.

Thanks.

inactive123 commented 6 years ago

Sure thing @7oxicshadow, thanks a lot for this. I'll be sure to check it out!

inactive123 commented 6 years ago

Yeah, that was slightly embarrassing. I still believe the reason it finally works in conjunction with this is that the emulator now finally exits/closes itself properly, but regardless, huge thanks for this! I made the commit and paid you credit.

7oxicshadow commented 6 years ago

Thanks for the commit.

I have spent a lot of time looking into this when fixing it on the master branch so I had an advantage over most people.

At least this was easy. On the master branch I have had to modify the assembly so that the threads will exit cleanly to trigger to allow the nvram to save :)

As you said, if is critical to get reicast to exit cleanly for this to work properly.

Hopefully this keep the frequent Dreamcast users happy :D

inactive123 commented 6 years ago

BTW, I see that you have your own fork where you worked on the dynarec for x86.

We would very much like to get ARM/x86 dynarecs to work with this core, right now it only works with x64. I had to kinda change the control loop flow for the libretro port, so getting this to work is a bit different from the regular reicast version, but it should not be too difficult for you I think.

There is a bounty open for this - https://github.com/libretro/reicast-emulator/issues/12

Let me know if there is any interest in this, it would be great to finally have this resolved.

orbea commented 6 years ago

@7oxicshadow Thanks a lot for this fix!

anothername99 commented 6 years ago

@7oxicshadow Thank you! There's also another saving-related issue (with a bounty) if you want to have a look: https://github.com/reicast/reicast-emulator/issues/1170