This patch when applied after the newest 140u2 hiscore patch will fix a bug that crept in which the machine memory was being freed before the hiscore callback read the hiscore to the games .hi file. This probably is why some people had some games work and others not, or experienced random working and not. I think in Windows the memory was still there, just technically freed but it was accessing memory that was freed to the operating system already (just lucky sometimes). In Linux this turned out to always fail, at least on certain games, but not all of them. Strange but this definitely is a bug that this patch fixes...
diff --git a/src/emu/machine.c b/src/emu/machine.c
index 6726451..dadcf47 100644
--- a/src/emu/machine.c
+++ b/src/emu/machine.c
@@ -332,10 +332,6 @@ void running_machine::start()
crosshair_init(this);
sound_init(this);
- //MKCHAMP - INITIALIZING THE HISCORE ENGINE
- if (!options_get_bool(&m_options, OPTION_DISABLE_HISCORE_PATCH))
- hiscore_init(this);
-
// initialize the debugger
if ((debug_flags & DEBUG_FLAG_ENABLED) != 0)
debugger_init(this);
@@ -361,6 +357,10 @@ void running_machine::start()
// set up the cheat engine
m_cheat = auto_alloc(this, cheat_manager(*this));
+ //MKCHAMP - INITIALIZING THE HISCORE ENGINE
+ if (!options_get_bool(&m_options, OPTION_DISABLE_HISCORE_PATCH))
+ hiscore_init(this);
+
// disallow save state registrations starting here
state_save_allow_registration(this, false);
}
Here's the way I tracked it down, shows the backtrace of it trying to access the machine when it was already technically freed...
#0 0x000000000202703d in astring_c (str=0x80) at src/lib/util/astring.c:499
No locals.
#1 0x000000000040f280 in astring::operator char const* (this=0x80) at src/lib/util/astring.h:344
No locals.
#2 0x000000000040f69e in device_config::tag (this=0x0) at src/emu/devintrf.h:287
No locals.
#3 0x000000000040f6e6 in device_t::tag (this=0x6de6d90) at src/emu/devintrf.h:441
No locals.
#4 0x0000000000430dea in device_memory (device=0x6de6d90) at src/emu/dimemory.h:192
intf = 0x0
#5 0x0000000000430e6a in device_get_space (device=0x6de6d90, spacenum=0) at src/emu/dimemory.h:204
No locals.
#6 0x0000000001e69af0 in copy_from_memory (machine=0x6d5c1e0, cpu=0, addr=20104, dest=0x6de6ff0 "\260\371B\a", num_bytes=4) at src/emu/hiscore.c:89
i = 0
targetspace = 0x6de6ff0
#7 0x0000000001e6a181 in hiscore_save (machine=0x6d5c1e0) at src/emu/hiscore.c:280
data = 0x6de6ff0 "\260\371B\a"
mem_range = 0x73b0f80
filerr = FILERR_NONE
f = 0x6d5d5c0
fname = 0x6d58940
#8 0x0000000001e6a25d in hiscore_close (machine=...) at src/emu/hiscore.c:312
No locals.
#9 0x0000000001b75176 in running_machine::call_notifiers (this=0x6d5c1e0, which=MACHINE_NOTIFY_EXIT) at src/emu/machine.c:778
cb = 0x73b0f60
#10 0x0000000001b74523 in running_machine::run (this=0x6d5c1e0, firstrun=true) at src/emu/machine.c:453
error = 0
#11 0x0000000001b70cac in mame_execute (osd=..., options=0x6d38b50) at src/emu/mame.c:203
gamename = {<_astring_base> = {text = 0x7fffffffe06c "pacman", alloclen = 52,
smallbuf = "pacman\000\377\377\177\000\000.\257\003\002\000\000\000\000\264\032|\003\000\000\000\000`\227\324\006\000\000\000\000\255+|\003\000\000\000\000P\213\323\006\000\000\000"}, <No data fields>}
driver = 0x2d87d40
config = 0x6d6c010
machine = 0x6d5c1e0
firstgame = false
firstrun = true
exit_pending = false
error = 0
#12 0x0000000001b0a3e4 in cli_execute (argc=2, argv=0x7fffffffe4a8, osd=..., osd_options=0x364ccc0) at src/emu/clifront.c:175
gamename_option = 0x6d28f5c "pacman"
driver = 0x2d87d40
exename = {<_astring_base> = {text = 0x7fffffffe1dc "mame64", alloclen = 52,
smallbuf = "mame64\000\004", '\000' <repeats 36 times>"\202, \303\336\367\377\177\000"}, <No data fields>}
options = 0x6d38b50
result = -1
gamename = {<_astring_base> = {text = 0x7fffffffe21c "pacman", alloclen = 52,
smallbuf = "pacman\000\000\000\000\000\000\350\213\264\367\377\177", '\000' <repeats 18 times>"\300, \343\377\377\377\177\000\000\340\243@\000\000\000\000"}, <No data fields>}
#13 0x00000000013183f6 in main (argc=2, argv=0x7fffffffe4a8) at src/osd/sdl/sdlmain.c:328
osd = {<osd_interface> = {_vptr.osd_interface = 0x364d850, m_machine = 0x6d5c1e0}, <No data fields>}
res = 0
This occured at least on pacman and tempest, donkey kong games seemed to somehow still work, guessing it's in how the machine for each game handled freeing the resources and probably some luck of memory being there even when already freed from mames ownership.