Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting nvram directory #89

Closed
francisdb opened this issue Sep 11, 2023 · 11 comments
Closed

Getting nvram directory #89

francisdb opened this issue Sep 11, 2023 · 11 comments

Comments

@francisdb
Copy link
Contributor

francisdb commented Sep 11, 2023

Looks like a few tables do this:

    Set WshShell = CreateObject("WScript.Shell")
    GetNVramPath = WshShell.RegRead("HKCU\Software\Freeware\Visual PinMame\globals\nvram_directory")

Is there no other way to get that directory or could this be implemented?

ABBAv2.0/ABBAv2.0.vbs.patch

https://github.com/jsm174/vpx-standalone-scripts/blob/7605c75d6403bcbaa112fd644ddaf5db32c94a74/Vortex%20(Taito%20do%20Brasil%20-%201981)%20v4/Vortex%20(Taito%20do%20Brasil%20-%201981)%20v4.vbs.patch

https://github.com/jsm174/vpx-standalone-scripts/blob/7605c75d6403bcbaa112fd644ddaf5db32c94a74/Last%20Starfighter%2C%20The%20(Taito%2C%201983)%20hybrid%20v1.04/Last%20Starfighter%2C%20The%20(Taito%2C%201983)%20hybrid%20v1.04.vbs.patch

And Topaz

@francisdb francisdb changed the title Getting nvram direcory Getting nvram directory Oct 2, 2023
@francisdb
Copy link
Contributor Author

These nvram patches are required to reset the table when quit. If not a game stopped in the middle of a it will resume on next start.

@francisdb
Copy link
Contributor Author

francisdb commented Nov 25, 2023

there seems to be a standard script for Taito: NVram patch for Taito do Brasil tables by Pmax65

Space Shuttle (Taito do Brasil - 1982) 4.0.0
used by https://www.vpforums.org/index.php?app=downloads&showfile=13644

https://www.vpforums.org/index.php?app=downloads&showfile=13430
https://www.vpforums.org/index.php?app=downloads&showfile=13422

@francisdb
Copy link
Contributor Author

Might add a patch to vpxtool that resolves this to [table]/pinmame/nvram or ~/.pinmame/nvram if the former is missing.

@francisdb
Copy link
Contributor Author

Zarza (Taito do Brasil - 1982)
https://www.vpforums.org/index.php?app=downloads&showfile=13488

@francisdb
Copy link
Contributor Author

https://www.vpforums.org/index.php?app=downloads&showfile=13284
Snake Machine (Taito do Brasil - 1981)

@rh6423
Copy link
Contributor

rh6423 commented Mar 14, 2024

Titan (Taito do Brasil - 1981) was this issue. My workaround was to disable the whole Nvram patch in the script. Haven't encountered any issues as yet. Removing the WshShell line and setting GetNVramPath = '~/pinmame/nvram' worked as well. Not as clean, but if the script actually needs help finding the nvram directory it works.

This is from vbscript.md in the standalone source:

Issue: WScript.Shell does not work

' does not work
Dim WshShell : Set WshShell = CreateObject("WScript.Shell")
GetNVramPath = WshShell.RegRead("HKEY_CURRENT_USER\Software\Freeware\Visual PinMame\globals\nvram_directory")

' no workaround as we standalone will not support wscript.shell

You could change this logic to either source the pinmame path (VPX has to know this to find the ROMs, right?) and append /nvram, or access nvram path directly if it's stored somewhere (like one of the ini files).

PlatformOS(string) could be used to define some logic in the script to make it work for Windows (if nvram patch is still needed there).

@rh6423
Copy link
Contributor

rh6423 commented Mar 14, 2024

It occurred to me that I rarely exit mid-game. Tested it, and it is an issue with the nvram patch disabled. Game continues with remaining balls when you start it back up rather than starting a new game. vpmPath is being set in libpinmame.h, so it's probably accessible somehow. No mention of vpmPath in CommandReference.txt, not sure where else to look yet...

@francisdb
Copy link
Contributor Author

Would be nice if there was some kind of nvram api available for scripts without having to mess with the filesystem.

@rh6423
Copy link
Contributor

rh6423 commented Mar 15, 2024

My research led me to this forum post. Taito do Brasil tables were designed to withstand power outages without interrupting the game in play. So disabling the whole nvram patch component of the .vbs is a more accurate simulation of the real thing. Since this approach also makes the tables playable on 10.8 standalone, I think it's the right solution.

Accessing the nvram path from inside a .vbs script is still an interesting question, but perhaps less urgent. I'll put in a few pull reqs for other Taito do Brasil tables this weekend. I know they're mostly clones, but Brazilian Taito machines rock! I want to live in a world where we can play them on a Mac or Linux machine just as easily as the Windows people do,

@francisdb
Copy link
Contributor Author

francisdb commented Mar 17, 2024

Found a table that does this:

	Dim NVRAM : NVRAM = Controller.NVRAM
	dim str : str = _
	ConvertBCD(NVRAM(CInt("&h200"))) & _
	ConvertBCD(NVRAM(CInt("&h201"))) & _
	ConvertBCD(NVRAM(CInt("&h202"))) & _
	ConvertBCD(NVRAM(CInt("&h203")))		'sys 11 current score
	str = round(str)

Unfortunately this does not work on standalone see vpinball/vpinball#1579

I wonder if there is an api to write to nvram and reset Taito tables

@francisdb
Copy link
Contributor Author

Moved to vpinball vpinball/vpinball#1595

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants