User avatar
spludlow
Posts: 34
Joined: Thu Jan 24, 2019 2:15 pm
Contact: Website

Load state path not expanding environment variables

Mame 0.217 Windows

I’ve been experimenting with running the MAME application from a read only network share, its working pretty well but…

It doesn’t seem to look in the right place when loading state.

I configured the INI like so:

state_directory %APPDATA%\MAME\sta

When I save everything is sound.

When I load it don’t work, it looks in the wrong place:

ProcMon shows:

SAVE:
CreateFile C:\Users\Fred\AppData\Roaming\MAME\sta\megadriv\1.sta SUCCESS

LOAD (On the load it continuously attempts this until you close the dialogue):
CreateFile \\some-box\MameFront$\MameApp\%APPDATA%\MAME\sta\megadriv\ PATH NOT FOUND

Looks like in the load it’s not expanding environment variables, and doing something weird with the path.

Cheers
User avatar
Tafoid
Posts: 351
Joined: Thu Nov 06, 2014 12:50 pm
Location: USA
Contact: Website

Re: Load state path not expanding environment variables

spludlow wrote: Sun Jan 26, 2020 9:41 am Mame 0.217 Windows

I’ve been experimenting with running the MAME application from a read only network share, its working pretty well but…

It doesn’t seem to look in the right place when loading state.

I configured the INI like so:

state_directory %APPDATA%\MAME\sta

When I save everything is sound.

When I load it don’t work, it looks in the wrong place:

ProcMon shows:

SAVE:
CreateFile C:\Users\Fred\AppData\Roaming\MAME\sta\megadriv\1.sta SUCCESS

LOAD (On the load it continuously attempts this until you close the dialogue):
CreateFile \\some-box\MameFront$\MameApp\%APPDATA%\MAME\sta\megadriv\ PATH NOT FOUND

Looks like in the load it’s not expanding environment variables, and doing something weird with the path.

Cheers

I'd have to guess your front-end MameFront? is adjusting that environment location from your default Windows one? I tried locally your example: state_directory %APPDATA%\MAME\sta and I was able to load/save and restart MAME with the saves showing for me in the F7 menu. It also worked fine as a command-line argument: -state_directory %APPDATA%\MAME\sta. You could also check lower in your .ini chain to see if there is something changing it. Information on order of .ini loading can be found here: https://docs.mamedev.org/advanced/multiconfig.html
User avatar
spludlow
Posts: 34
Joined: Thu Jan 24, 2019 2:15 pm
Contact: Website

Re: Load state path not expanding environment variables

Thanks for having a look.

Sorry should have mentioned I'm not using a front end. That's just the path to a default MAME.

Anyway forget about that I still have the problem with a simplified test (all from local drive) :

- Extract fresh MAME binaries C:\mame0217b_64bit\
- Start MAME Configure Options -> Save Configuration (Not changing anything just create INI)
- Edit ROM Path ONLY
- Confirm state works YES
- Edit state_directory with Expanded path "C:\Users\Fred\AppData\Roaming\MAME\sta"
- Confirm state works YES
- Edit state_directory with environment variable path "%APPDATA%\MAME\sta"
- Confirm state works NO !!!

On the save it does save to a file, but does not show the existing saves, so the save its self is OK.

The problem seems to be in the listing of the state directory rather than the actual load which it does when working normally.

Again on the load ProcMon shows:
08:52:48.4001832 mame64.exe 10576 CreateFile C:\mame0217b_64bit\%APPDATA%\MAME\sta\megadriv\ PATH NOT FOUND

Not sure why it works for you?

Cheers
User avatar
spludlow
Posts: 34
Joined: Thu Jan 24, 2019 2:15 pm
Contact: Website

Re: Load state path not expanding environment variables

BTW Using:

-state_directory %APPDATA%\MAME\sta

Does work, but this is because cmd is expanding the environment variable, you can tell by looking at task manager.

Suppose I can workaround the problem by having a bat to launch MAME with all 7 output directories passed as parameters but its a bit messy compared to just launching MAME.

Return to “MAME Discussion”