When a "Memory expansion hack" is enabled under Settings -> Model in xplus4, it works fine, but if the configuration is saved, the emulator is not able to start up again:
sukko@insight ~ $ xplus4
Loading system file `/usr/share/vice/PRINTER/mps803-D7811G-111-U32053A.bin'.
Reading configuration file `/home/sukko/.config/vice/vicerc'.
CSORY 256KiB expansion installed.
Segmentation fault
Removing the "MemoryHack=<n>" line from vicerc allows xplus4 to start up correctly again.</n>
This bug was already present in 3.7 at least and it is still present in 3.8.
My VICE build has debugging enabled, and running
xplus4 -default, then enabling CSORY 256K, saving settings and runningxplus4gives us an assertion:After some digging I found that
plus4io_init()is called after the "MemoryHack" resource initialization is called, which in turn calls the setters for the various memory hacks, which callplus4_pio_init(-1). That is what triggers the assertion,plus4_pio_init()tries to unregister an IO source that isn't yet registered (and the assertion indicates we want to do that, not just ignore aNULLvalue).So moving the call to
plus4io_init()intomachine_resources_init(), before the call toplus4_resources_init()makes sure the IO sources a registered so the memhacks code can properly unregister them.I however have zero knowledge of the Plus4, let alone its memory hacks/IO, so I'll post a diff here with the proposed change:
Patch applied, did a quick test and everything seems to be working fine.
I'll test more, but thanks in the meantime :).
Alright, thanks for checking. I'll wait for someone with more knowledge of the IO sources system to check that this patch doesn't inadvertently trigger other issues.
it's correct
Yay! Applied in r44947.