pocomane / MiSTer_Batch_Control

Simple utility to control the MiSTer FPGA from the command line
48 stars 8 forks source link

MegaCD images not being released #16

Closed rhester72 closed 3 years ago

rhester72 commented 3 years ago

When MBC is used to copy/launch a MegaCD title (I'm using CHD, not sure if that matters), when the emulator is killed, the file lock on the CHD doesn't seem to be released, resulting in breakage on later runs (in conjunction with MiSTer_SAM). There have been a significant number of changes to Main MiSTer, Linux and the MegaCD core over the past few months and it's unclear which (if any) led to this breakage.

More interestingly, this problem does not appear to occur with TGFX-CD.

pocomane commented 3 years ago

It is very strange that the issue appears with the MegaCD but not the TFGX-CD. I can not see any difference between them. I will try to update all the MiSTer stack soon and to reproduce this issue. In the meanwhile:

rhester72 commented 3 years ago
rhester72 commented 3 years ago

Another observation of the same issue:

https://misterfpga.org/viewtopic.php?p=32933#p32933

mrchrisster commented 3 years ago

Can you try out one of the older mbc releases (eg version 4) to see if that makes it work? Download: https://github.com/mrchrisster/MiSTer_Batch_Control/raw/master/mbc_v04 Rename to mbc and replace at /media/fat/Scripts/.MiSTer_SAM

mrchrisster commented 3 years ago

I did some testing and can confirm this error was introduced at https://github.com/pocomane/MiSTer_Batch_Control/commit/dcf0eec8829c6d33bef2d9064803553a2de35599 The version before works correctly while the version after always loads the same rom

pocomane commented 3 years ago

Thanks for the the analysis. The reason for the break in that commit, is that it changes where the rom are mounted, so it makes clear an issue that is present also in the previous versions: with MegaCD CHD the "Normal" umount does not work.

I not really understand why, however I found a workaround: use the special unmounting option "DETACH" a.k.a. "lazy". This is tried only if the "Normal" unmounting fails 10 times in 5 seconds.

This seems to fix the issue on my MiSTer setup. Please check if it works for you too.

mrchrisster commented 3 years ago

Just tried working on a fix as well by defining the filename in MBC.c but it didn't work. I noticed megacd core now has an unmount option by pushing button a+b on the gamepad. Unfortunately this relaunches the core so i wasn't able to define a sequence through MBC. Anyways, great to hear you found a workaround!

mrchrisster commented 3 years ago

Can confirm this works, thanks for the fix!

rhester72 commented 3 years ago

Looks good here as well, closing - thanks, @pocomane !