Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;----------------------------------------------------------------------------
- ; Sammy Atomiswave
- ; Demul v0.5.6, Demul v0.5.7
- ; by djvj
- ; 1.9
- ;
- ; Notes:
- ; Required - nvram files can be found in my user dir on the FTP at /Upload Here/djvj/Atomiswave\Emulators. Additonal instructions from my orignal HL1.0 script at http://www.hyperspin-fe.com/forum/showpost.php?p=86093&postcount=104
- ; Required - Settings.ini: can be found in my user dir on the FTP at /Upload Here/djvj/Atomiswave\Modules\Atomiswave
- ; settings.ini must be placed in Modules\Atomiswave\. This script will make it for you if it does not exist upon first load.
- ; Paths should have backslashes at the end. Defining paths this way makes it so you don't have to have multiple module dirs and scripts.
- ; Download the loading.png and logo.png from http://www.hyperspin-fe.com/downloads/Modules/Atomiswave/ and place them in your Modules\Atomiswave\
- ; GDI images must match mame zip names and be extracted and have a .dat extension
- ; romExtensions should be zip
- ; The HyperSpin settings ini (\Settings\Atomiswave\Atomiswave.ini) can have the emu and emupath set to whatever you want, it's not used. Only rompath and extensions are important.
- ; Demul:
- ; Place the atomiswave.zip bios archive in the demul\roms subdir
- ; Fullscreen gets sent by this script
- ; Set your Video Plugin to gpuOglv3 and set your desired resolution there
- ; In case your control codes do not match mine, set your desired control type in demul, then open the demul.ini and find section PORTB and look for the device key. Use this number instead of the one I provided
- ; Demul Controle:
- ; Start a game of each control type (look in the Settings.ini for these types) and configure your controls to play the game. Copy paste the ATOMISWAVE0_0 and ATOMISWAVE0_1 sections into the Settings.ini under the matching controls section.
- ;
- ; Demul v0.5.7:
- ; gpuDX11, gpuDXv3, and gpuDXLegacy are all supported. Define what plugin you want to use for each game in the Settings.ini.
- ; Read the notes at the top of the settings.ini on how to control windowed fullscreen, true fullscreen, or windowed mode
- ; Windowed fullscreen will take effect the 2nd time you run the emu. It has to calculate your resolution on first run.
- ;----------------------------------------------------------------------------
- ; check for and load into memory the Settings.ini
- settingsFile := CheckFile(A_Scriptdir . "\Modules\" . systemName . "\Settings.ini")
- ini_load(ini, settingsFile)
- ini_exportToGlobals(ini,0,"") ; creating variables of each section & key of the Settings.ini
- controls := %romName%_Controls ; conversion so script is easier to read
- system := %romName%_System ; necessary conversion
- GUI_ID := FadeInStart()
- ; This section writes your custom keys to the padDemul.ini or JVS.ini. Atomiswave games had many control panel layouts. The only way we can accomodate for these differing controls, is to keep track of them all and write them to the ini at the launch of each game.
- ; First we check if the last controls used are the same as the game we want to play, so we don't waste time updating the ini if it is not necessary. For example playing 2 sfstyle type games in a row, we wouldn't need to write to the ini.
- If ( %romName%_emulator = "demul" ) {
- ; check for and load into memory the Demul.ini
- demulFile := CheckFile(settings_pathToDemul . "Demul.ini")
- ini_load(demulini, demulFile)
- ; check for and load into memory the padDemul.ini
- padFile := CheckFile(settings_pathToDemul . "padDemul.ini")
- ini_load(padini, padFile)
- ; This section tells demul what arcade control type should be connected to the game. Options are standard (aka controller), mouse, lightgun, or keyboard
- If ( controls = "lightgun" || controls = "mouse" )
- ini_replaceValue(demulini, "PORTB", "device", settings_demulMouseCode)
- Else If ( controls = "keyboard" )
- ini_replaceValue(demulini, "PORTB", "device", settings_demulKeyboardCode)
- Else ; accounts for all other control types
- ini_replaceValue(demulini, "PORTB", "device", settings_demulControllerCode)
- If ( settings_LastControlUsedDemul != controls ) {
- WriteAtomiswaveControls(padini,0,%controls%_ATOMISWAVE0_0_SHOT1,%controls%_ATOMISWAVE0_0_SHOT2,%controls%_ATOMISWAVE0_0_SHOT3,%controls%_ATOMISWAVE0_0_SHOT4,%controls%_ATOMISWAVE0_0_SHOT5,%controls%_ATOMISWAVE0_0_START,%controls%_ATOMISWAVE0_0_COIN,%controls%_ATOMISWAVE0_0_UP,%controls%_ATOMISWAVE0_0_DOWN,%controls%_ATOMISWAVE0_0_LEFT,%controls%_ATOMISWAVE0_0_RIGHT)
- WriteAtomiswaveControls(padini,1,%controls%_ATOMISWAVE0_1_SHOT1,%controls%_ATOMISWAVE0_1_SHOT2,%controls%_ATOMISWAVE0_1_SHOT3,%controls%_ATOMISWAVE0_1_SHOT4,%controls%_ATOMISWAVE0_1_SHOT5,%controls%_ATOMISWAVE0_1_START,%controls%_ATOMISWAVE0_1_COIN,%controls%_ATOMISWAVE0_1_UP,%controls%_ATOMISWAVE0_1_DOWN,%controls%_ATOMISWAVE0_1_LEFT,%controls%_ATOMISWAVE0_1_RIGHT)
- }
- ini_replaceValue(ini, "settings", "LastControlUsedDemul", controls)
- ini_save(ini, settingsFile)
- ini_save(padini, padFile)
- ini_save(demulini, demulFile)
- }
- Else If ( %romName%_emulator = "demul57" ) {
- ; check for and load into memory the Demul.ini
- demul57File := CheckFile(settings_pathToDemul57 . "Demul.ini")
- ini_load(demul57ini, demul57File)
- ; check for and load into memory the padDemul.ini
- pad57File := CheckFile(settings_pathToDemul57 . "padDemul.ini")
- ini_load(pad57ini, pad57File)
- ; verify user set desired gpu plugin name correctly, else result to Default
- If ( %romName%_Demul57Plugin != "gpuDX11" And %romName%_Demul57Plugin != "gpuDXv3" And %romName%_Demul57Plugin != "gpuDXLegacy" And %romName%_Demul57Plugin != "" )
- ScriptError("Invalid gpu plugin defined for " . romName . " in your Settings.ini.`nLeave the plugin blank to enable default.`nValid options are gpuDX11, gpuDXv3, or gpuDXLegacy.")
- Else ( %romName%_Demul57Plugin = "" )
- %romName%_Demul57Plugin = %settings_demul57DefaultGPU%
- ; msgbox % %romName%_Demul57Plugin
- ; check for and load into memory the specified gpu plugin
- demul57gpuFile := CheckFile(settings_pathToDemul57 . %romName%_Demul57Plugin . ".ini")
- ini_load(gpuini, demul57gpuFile)
- ; This updates the Demul.ini with your gpu plugin choice for the selected rom
- ini_replaceValue(demul57ini, "plugins", "gpu", %romName%_Demul57Plugin . ".dll")
- ; This section tells demul what arcade control type should be connected to the game. Options are standard (aka controller), mouse, lightgun, or keyboard
- If ( controls = "lightgun" || controls = "mouse" )
- ini_replaceValue(demul57ini, "PORTB", "device", settings_demulMouseCode)
- Else If ( controls = "keyboard" )
- ini_replaceValue(demul57ini, "PORTB", "device", settings_demulKeyboardCode)
- Else ; accounts for all other control types
- ini_replaceValue(demul57ini, "PORTB", "device", settings_demulControllerCode)
- If ( settings_LastControlUsedDemul57 != controls ) {
- ;begin changes for demul 57 control mapping
- ;begin changes for demul 57 control mapping
- ;begin changes for demul 57 control mapping
- WriteAtomiswaveControls57(pad57ini,0,%controls%_JAMMA0_0_PUSH1,%controls%_JAMMA0_0_PUSH2,%controls%_JAMMA0_0_PUSH3,%controls%_JAMMA0_0_PUSH4,%controls%_JAMMA0_0_PUSH5,%controls%_JAMMA0_0_PUSH6,%controls%_JAMMA0_0_PUSH7,%controls%_JAMMA0_0_PUSH8,%controls%_JAMMA0_0_SERVICE,%controls%_JAMMA0_0_START,%controls%_JAMMA0_0_COIN,%controls%_JAMMA0_0_DIGITALUP,%controls%_JAMMA0_0_DIGITALDOWN,%controls%_JAMMA0_0_DIGITALLEFT,%controls%_JAMMA0_0_DIGITALRIGHT,%controls%_JAMMA0_0_ANALOGUP,%controls%_JAMMA0_0_ANALOGDOWN,%controls%_JAMMA0_0_ANALOGLEFT,%controls%_JAMMA0_0_ANALOGRIGHT,%controls%_JAMMA0_0_ANALOGUP2,%controls%_JAMMA0_0_ANALOGDOWN2,%controls%_JAMMA0_0_ANALOGLEFT2,%controls%_JAMMA0_0_ANALOGRIGHT2)
- WriteAtomiswaveControls57(pad57ini,1,%controls%_JAMMA0_1_PUSH1,%controls%_JAMMA0_1_PUSH2,%controls%_JAMMA0_1_PUSH3,%controls%_JAMMA0_1_PUSH4,%controls%_JAMMA0_1_PUSH5,%controls%_JAMMA0_1_PUSH6,%controls%_JAMMA0_1_PUSH7,%controls%_JAMMA0_1_PUSH8,%controls%_JAMMA0_1_SERVICE,%controls%_JAMMA0_1_START,%controls%_JAMMA0_1_COIN,%controls%_JAMMA0_1_DIGITALUP,%controls%_JAMMA0_1_DIGITALDOWN,%controls%_JAMMA0_1_DIGITALLEFT,%controls%_JAMMA0_1_DIGITALRIGHT,%controls%_JAMMA0_1_ANALOGUP,%controls%_JAMMA0_1_ANALOGDOWN,%controls%_JAMMA0_1_ANALOGLEFT,%controls%_JAMMA0_1_ANALOGRIGHT,%controls%_JAMMA0_1_ANALOGUP2,%controls%_JAMMA0_1_ANALOGDOWN2,%controls%_JAMMA0_1_ANALOGLEFT2,%controls%_JAMMA0_1_ANALOGRIGHT2)
- ;end changes for demul 57 control mapping
- ;end changes for demul 57 control mapping
- ;end changes for demul 57 control mapping
- }
- ini_replaceValue(ini, "settings", "LastControlUsedDemul57", controls)
- ini_save(ini, settingsFile)
- ini_save(pad57ini, pad57File)
- ini_save(demul57ini, demul57File)
- }
- ; Now lets run our emulator
- If ( %romName%_emulator = "demul" ) {
- Run, %settings_demulExe% -run=%system% -rom=%romName%, %settings_PathToDemul%
- Sleep, 1000 ; need a second for demul to launch, increase if yours takes longer and the loading screen is closing too soon
- Loop { ; looping until demul is done loading rom and gpu starts showing frames
- Sleep, 200
- WinGetTitle, winTitle, AHK_class window
- StringSplit, winTextSplit, winTitle, %A_Space%
- If ( winTextSplit5 = "gpu:" And winTextSplit6 = "0" )
- break
- }
- WinActivate ahk_class window
- Send !{ENTER} ; go fullscreen
- GUI_ID2 := FadeInExit()
- Process, WaitClose, %settings_demulExe%
- }
- Else If ( %romName%_emulator = "demul57" ) {
- ;Hide Taskbar and Start Button
- WinHide, ahk_class Shell_TrayWnd
- WinHide, Start ahk_class Button
- ; Create black background to give the emu the fullscren look
- Gui 2: -Caption +ToolWindow
- Gui 2: Color, Black
- Gui 2: Show, x0 y0 h%A_ScreenHeight% w%A_ScreenWidth%
- ; setting demul to use true fullscreen if defined in settings.ini, otherwise sets demul to run windowed. This is for gpuDX11 plugin only
- If ( %romName%_Demul57Plugin = "gpuDX11" ) {
- If ( settings_demul57Max = "fullscreen" ) {
- ini_replaceValue(gpuini, "main", "UseFullscreen", 1)
- ini_save(gpuini, demul57gpuFile)
- } Else {
- ini_replaceValue(gpuini, "main", "UseFullscreen", 0)
- ini_save(gpuini, demul57gpuFile)
- }
- }
- Run, %settings_demulExe% -run=%system% -rom=%romName%, %settings_PathToDemul57%
- Sleep, 1000 ; need a second for demul to launch, increase if yours takes longer and the loading screen is closing too soon
- Loop { ; looping until demul is done loading rom and gpu starts showing frames
- Sleep, 200
- WinGetTitle, winTitle, AHK_class window
- StringSplit, winTextSplit, winTitle, %A_Space%
- If ( winTextSplit5 = "gpu:" And winTextSplit6 != "0" And winTextSplit6 != "1" )
- break
- }
- WinActivate ahk_class window
- If ( ( %romName%_Demul57Plugin = "gpuDXv3" Or %romName%_Demul57Plugin = "gpuDXLegacy" ) && settings_demul57Max = "fullscreen" )
- Send !{ENTER} ; go fullscreen for gpuDXv3 and gpuDXLegacy plugins only
- ; This is where we calculate and maximize demul's window using our pseudo fullscreen code
- If ( settings_demul57Max = "true" ) {
- WinSet, Style, -0x40000, AHK_class window ; Removes the border of the game window
- WinSet, Style, -0xC00000, AHK_class window ; Removes the TitleBar
- Send, {F3} ; Removes the MenuBar
- MaximizeWindow("AHK_class window") ; this will take effect after you run demul once because we cannot stretch demul's screen while it is running.
- }
- GUI_ID2 := FadeInExit()
- Process, WaitClose, %settings_demulExe%
- ;Restore Taskbar and Start Button
- WinShow,ahk_class Shell_TrayWnd
- WinShow,Start ahk_class Button
- }
- GUI_ID4 := FadeOutExit()
- WinActivate, HyperSpin
- ExitApp
- ;(¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯)
- ; Functions - DO NOT EDIT
- ;(_.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._)
- ; Write new controls to padDemul.ini
- WriteAtomiswaveControls(ByRef iniR, PLAYER,SHOT1,SHOT2,SHOT3,SHOT4,SHOT5,START,COIN,UP,DOWN,LEFT,RIGHT) {
- ini_replaceValue(iniR, "ATOMISWAVE0_" . PLAYER, "SHOT1", SHOT1)
- ini_replaceValue(iniR, "ATOMISWAVE0_" . PLAYER, "SHOT2", SHOT2)
- ini_replaceValue(iniR, "ATOMISWAVE0_" . PLAYER, "SHOT3", SHOT3)
- ini_replaceValue(iniR, "ATOMISWAVE0_" . PLAYER, "SHOT4", SHOT4)
- ini_replaceValue(iniR, "ATOMISWAVE0_" . PLAYER, "SHOT5", SHOT5)
- ini_replaceValue(iniR, "ATOMISWAVE0_" . PLAYER, "START", START)
- ini_replaceValue(iniR, "ATOMISWAVE0_" . PLAYER, "COIN", COIN)
- ini_replaceValue(iniR, "ATOMISWAVE0_" . PLAYER, "UP", UP)
- ini_replaceValue(iniR, "ATOMISWAVE0_" . PLAYER, "DOWN", DOWN)
- ini_replaceValue(iniR, "ATOMISWAVE0_" . PLAYER, "LEFT", LEFT)
- ini_replaceValue(iniR, "ATOMISWAVE0_" . PLAYER, "RIGHT", RIGHT)
- }
- ;begin changes for demul 57 control mapping
- ;begin changes for demul 57 control mapping
- ;begin changes for demul 57 control mapping
- ; Write new controls to padDemul.ini - Demul 5.7
- WriteAtomiswaveControls57(ByRef iniR, PLAYER,PUSH1,PUSH2,PUSH3,PUSH4,PUSH5,PUSH6,PUSH7,PUSH8,SERVICE,START,COIN,DIGITALUP,DIGITALDOWN,DIGITALLEFT,DIGITALRIGHT,ANALOGUP,ANALOGDOWN,ANALOGLEFT,ANALOGRIGHT,ANALOGUP2,ANALOGDOWN2,ANALOGLEFT2,ANALOGRIGHT2) {
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "PUSH1", PUSH1)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "PUSH2", PUSH2)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "PUSH3", PUSH3)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "PUSH4", PUSH4)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "PUSH5", PUSH5)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "PUSH6", PUSH6)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "PUSH7", PUSH7)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "PUSH8", PUSH8)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "SERVICE", SERVICE)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "START", START)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "COIN", COIN)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "DIGITALUP", DIGITALUP)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "DIGITALDOWN", DIGITALDOWN)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "DIGITALLEFT", DIGITALLEFT)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "DIGITALRIGHT", DIGITALRIGHT)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "ANALOGUP", ANALOGUP)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "ANALOGDOWN", ANALOGDOWN)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "ANALOGLEFT", ANALOGLEFT)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "ANALOGRIGHT", ANALOGRIGHT)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "ANALOGUP2", ANALOGUP2)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "ANALOGDOWN2", ANALOGDOWN2)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "ANALOGLEFT2", ANALOGLEFT2)
- ini_replaceValue(iniR, "JAMMA0_" . PLAYER, "ANALOGRIGHT2", ANALOGRIGHT2)
- }
- ;end changes for demul 57 control mapping
- ;end changes for demul 57 control mapping
- ;end changes for demul 57 control mapping
- MaximizeWindow(class) {
- Global
- WinGetPos, appX, appY, appWidth, appHeight, %class%
- widthMaxPercenty := ( A_ScreenWidth / appWidth )
- heightMaxPercenty := ( A_ScreenHeight / appHeight )
- If ( widthMaxPercenty < heightMaxPercenty )
- percentToEnlarge := widthMaxPercenty
- Else
- percentToEnlarge := heightMaxPercenty
- appWidthNew := appWidth * percentToEnlarge
- appHeightNew := appHeight * percentToEnlarge
- Transform, appX, Round, %appX%
- Transform, appY, Round, %appY%
- Transform, appWidthNew, Round, %appWidthNew%
- Transform, appHeightNew, Round, %appHeightNew%
- appXPos := ( A_ScreenWidth / 2 ) - ( appWidthNew / 2 )
- appYPos := ( A_ScreenHeight / 2 ) - ( appHeightNew / 2 )
- IniWrite, %appWidthNew%, %gpuini%, resolution, wWidth
- IniWrite, %appHeightNew%, %gpuini%, resolution, wHeight
- If ( %romName%_Demul57Plugin = "gpuDX11" ) {
- ini_replaceValue(gpuini, "resolution", "Width", appWidthNew)
- ini_replaceValue(gpuini, "resolution", "Height", appHeightNew)
- } Else {
- ini_replaceValue(gpuini, "resolution", "wWidth", appWidthNew)
- ini_replaceValue(gpuini, "resolution", "wHeight", appHeightNew)
- }
- ini_save(gpuini, demul57gpuFile)
- WinMove, %class%,, appXPos, appYPos
- }
- ProcessExist(app) {
- DetectHiddenWindows, On
- Process, Exist, %app%.exe
- Return %ErrorLevel%
- }
- ; INI functions curtosy of Tuncay @ http://www.autohotkey.com/forum/viewtopic.php?t=46226
- ini_load(ByRef _Content, _Path = "", _convertNewLine = false)
- {
- ini_buildPath(_Path)
- error := true ; If file is found next, then its set to false.
- Loop, %_Path%, 0, 0
- {
- _Path := A_LoopFileLongPath
- error := false
- Break
- }
- If (error = false)
- {
- FileRead, _Content, %_Path%
- If (ErrorLevel)
- {
- error := true
- }
- }
- If (error)
- {
- _Content := ""
- }
- Else If (_convertNewLine)
- {
- StringReplace, _Content, _Content, `r`n, `n, All
- }
- ErrorLevel := error
- Return _Path
- }
- ini_save(ByRef _Content, _Path = "", _convertNewLine = true, _overwrite = true)
- {
- ini_buildPath(_Path)
- error := false
- If (_overwrite)
- {
- Loop, %_Path%, 0, 0
- {
- _Path := A_LoopFileLongPath
- Break
- }
- If FileExist(_Path)
- {
- FileDelete, %_Path%
- If (ErrorLevel)
- {
- error := true
- }
- }
- }
- Else If FileExist(_Path)
- {
- error := true
- }
- If (error = false)
- {
- If (_convertNewLine)
- {
- StringReplace, _Content, _Content, `r`n, `n, All
- StringReplace, _Content, _Content, `n, `r`n, All
- FileAppend, %_Content%, %_Path%
- }
- Else
- {
- FileAppend, %_Content%, *%_Path%
- }
- If (ErrorLevel)
- {
- error := true
- }
- }
- ErrorLevel := error
- Return _Path
- }
- ini_replaceValue(ByRef _Content, _Section, _Key, _Replacement = "", _PreserveSpace = False)
- {
- If (_Section = "")
- _Section = (?:\[.*])?
- Else
- _Section = \[\s*?\Q%_Section%\E\s*?]
- If Not _PreserveSpace
- {
- _Replacement = %_Replacement% ; Trim spaces.
- FirstChar := SubStr(_Replacement, 1, 1)
- If (FirstChar = """" AND SubStr(_Replacement, 0, 1)= """"
- OR FirstChar = "'" AND SubStr(_Replacement, 0, 1)= "'")
- {
- StringTrimLeft, _Replacement, _Replacement, 1
- StringTrimRight, _Replacement, _Replacement, 1
- }
- }
- ; Note: The regex of this function was written by Mystiq.
- RegEx = `aiU)((?:\R|^)\s*%_Section%\s*(?:\R\s*|\R\s*.+\s*=\s*.*?\s*(?=\R)|\R\s*[;#].*?(?=\R))*\R\s*\Q%_Key%\E\s*=).*((?=\R|$))
- _Content := RegExReplace(_Content, RegEx, "$1" . _Replacement . "$2", isReplaced, 1)
- If isReplaced
- ErrorLevel = 0
- Else
- ErrorLevel = 1
- Return isReplaced
- }
- ini_replaceSection(ByRef _Content, _Section, _Replacement = "")
- {
- If (_Section = "")
- _Section = (?:\[.*])?
- Else
- _Section = \[\s*?\Q%_Section%\E\s*?]
- RegEx = `aisU)^(\s*?.*)%_Section%\s*\R?.*(\R*\s*(?:\[.*|\R))?$
- _Content := RegExReplace(_Content, RegEx, "$1" . _Replacement . "$2", isReplaced, 1)
- If isReplaced
- ErrorLevel = 0
- Else
- ErrorLevel = 1
- Return isReplaced
- }
- ini_getValue(ByRef _Content, _Section, _Key, _PreserveSpace = False)
- {
- If (_Section = "")
- _Section = (?:\[.*])?
- Else
- {
- _Section = \[\s*?\Q%_Section%\E\s*?]
- }
- ; Note: The regex of this function was rewritten by Mystiq.
- RegEx = `aiU)(?:\R|^)\s*%_Section%\s*(?:\R\s*|\R\s*.+\s*=\s*.*?\s*(?=\R)|\R\s*[;#].*?(?=\R))*\R\s*\Q%_Key%\E\s*=(.*)(?=\R|$)
- /*
- RegEx := "`aiU)"
- . "(?:\R|^)\s*" . _Section . "\s*" ;-- section
- . "(?:"
- . "\R\s*" ;-- empty lines
- . "|\R\s*[\w\s]+\s*=\s*.*?\s*(?=\R)" ;-- OR other key=value pairs
- . "|\R\s*[;#].*?(?=\R)" ;-- OR commented lines
- . ")*"
- . "\R\s*\Q" . _Key . "\E\s*=(.*)(?=\R|$)" ;-- match
- */
- If RegExMatch(_Content, RegEx, Value)
- {
- If Not _PreserveSpace
- {
- Value1 = %Value1% ; Trim spaces.
- FirstChar := SubStr(Value1, 1, 1)
- If (FirstChar = """" AND SubStr(Value1, 0, 1)= """"
- OR FirstChar = "'" AND SubStr(Value1, 0, 1)= "'")
- {
- StringTrimLeft, Value1, Value1, 1
- StringTrimRight, Value1, Value1, 1
- }
- }
- ErrorLevel = 0
- }
- Else
- {
- ErrorLevel = 1
- Value1 =
- }
- Return Value1
- }
- ini_getSection(ByRef _Content, _Section)
- {
- If (_Section = "")
- _Section = (?:\[.*])?
- Else
- _Section = \[\s*?\Q%_Section%\E\s*?]
- RegEx = `aisUS)^.*(%_Section%\s*\R?.*)(?:\R*\s*(?:\[.*?|\R))?$
- If RegExMatch(_Content, RegEx, Value)
- ErrorLevel = 0
- Else
- {
- ErrorLevel = 1
- Value1 =
- }
- Return Value1
- }
- ini_getAllSectionNames(ByRef _Content, ByRef _count = "")
- {
- RegEx = `aisUmS)^.*(?:\s*\[\s*?(.*)\s*?]\s*|.+=.*).*$
- SectionNames := RegExReplace(_Content, RegEx, "$1", MatchNum)
- If MatchNum
- {
- SectionNames := RegExReplace(SectionNames, "S)\R+", ",", _count)
- ; Workaround, whitespaces only should be eliminated.
- SectionNames := RegExReplace(SectionNames, "S),+ +", "")
- StringReplace, SectionNames, SectionNames, `,, `,, UseErrorLevel
- _count := ErrorLevel ? ErrorLevel : 0
- _count := _count ? _count : 0
- StringTrimRight, SectionNames, SectionNames, 1
- ErrorLevel = 0
- }
- Else
- {
- ErrorLevel = 1
- _count = 0
- SectionNames =
- }
- Return SectionNames
- }
- ini_getAllValues(ByRef _Content, _Section = "", ByRef _count = "")
- {
- RegEx = `aisUmS)^(?=.*)(?:\s*\[\s*?.*\s*?]\s*|\s*?.+\s*?=(.*))(?=.*)$
- If (_Section != "")
- Values := RegExReplace(ini_getSection(_Content, _Section), RegEx, "$1`n", Match)
- Else
- Values := RegExReplace(_Content, RegEx, "$1`n", Match)
- If Match
- {
- Values := RegExReplace(Values, "`aS)\R+", "`n")
- ; Workaround, sometimes it catches sections. Whitespaces only should be eliminated also.
- Values := RegExReplace(Values, "`aS)\[.*?]\R+|\R+$|\R+ +$", "")
- StringReplace, Values, Values, `n, `n, UseErrorLevel
- _count := ErrorLevel ? ErrorLevel : 0
- StringTrimLeft, Values, Values, 1
- ErrorLevel = 0
- }
- Else
- {
- ErrorLevel = 1
- _count = 0
- Values =
- }
- Return Values
- }
- ini_exportToGlobals(ByRef _Content, _CreateIndexVars = false, _Prefix = "ini", _Seperator = "_", _SectionSpaces = "", _PreserveSpace = False)
- {
- Global
- Local secCount := 0, keyCount := 0, i := 0, Section, Section1, currSection, Pair, Pair1, Pair2, FirstChar
- If (_Prefix != "")
- {
- _Prefix .= _Seperator
- }
- Loop, Parse, _Content, `n, `r
- {
- If (Not RegExMatch(A_LoopField, "`aiSm)\[\s*(.+?)\s*]", Section))
- {
- If (RegExMatch(A_LoopField, "`aiSm)\s*(\b(?:.+?|\s?)\b)\s*=(.*)", Pair))
- {
- If (!_PreserveSpace)
- {
- StringReplace, Pair1, Pair1, %A_Space%, , All
- Pair2 = %Pair2% ; Trim spaces.
- FirstChar := SubStr(Pair2, 1, 1)
- If (FirstChar = """" AND SubStr(Pair2, 0, 1)= """"
- OR FirstChar = "'" AND SubStr(Pair2, 0, 1)= "'")
- {
- StringTrimLeft, Pair2, Pair2, 1
- StringTrimRight, Pair2, Pair2, 1
- }
- }
- StringReplace, currSection, currSection, %A_Space%, %_SectionSpaces%, All
- %_Prefix%%currSection%%_Seperator%%Pair1% := Pair2 ; ini_section_key := value
- keyCount++
- If (_CreateIndexVars)
- {
- %_Prefix%%currSection%0++
- i := %_Prefix%%currSection%0
- %_Prefix%%currSection%%i% := Pair1
- }
- }
- }
- Else
- {
- currSection := Section1
- If (_CreateIndexVars)
- {
- StringReplace, currSection, currSection, %A_Space%, %_SectionSpaces%, All
- secCount++
- %_Prefix%%secCount% := currSection
- }
- }
- }
- If (_CreateIndexVars)
- {
- %_Prefix%0 := secCount
- }
- If (secCount = 0 AND keyCount = 0)
- {
- ErrorLevel = 1
- }
- Else
- {
- ErrorLevel = 0
- }
- Return keyCount
- }
- ini_buildPath(ByRef _path)
- {
- ; Set to default wildcard if filename or exension are not set.
- If (_Path = "")
- {
- _Path := RegExReplace(A_ScriptFullPath, "S)\..*?$") . ".ini"
- }
- Else If (SubStr(_Path, 0, 1) = "\")
- {
- _Path .= RegExReplace(A_ScriptName, "S)\..*?$") . ".ini"
- }
- Else
- {
- If (InStr(FileExist(_Path), "D"))
- {
- ; If the current path is a directory, then add default file pattern to the directory.
- _Path .= "\" . RegExReplace(A_ScriptName, "S)\..*?$") . ".ini"
- }
- Else
- {
- ; Check all parts of path and use defaults, if any part is not specified.
- SplitPath, _Path,, fileDir, fileExtension, fileNameNoExt
- If (fileDir = "")
- {
- fileDir := A_WorkingDir
- }
- If (fileExtension = "")
- {
- fileExtension := "ini"
- }
- If (fileNameNoExt = "")
- {
- fileNameNoExt := RegExReplace(A_ScriptName, "S)\..*?$")
- }
- _Path := fileDir . "\" . fileNameNoExt . "." . fileExtension
- }
- }
- Return 0
- }
- CloseProcess:
- GUI_ID3 := FadeOutStart()
- If ( %romName%_emulator = "demul" )
- WinClose, %settings_demulExe%
- Else If ( %romName%_emulator = "demul57" ) { ; demul 0.5.7 crashes 50% of the time if you try to close it any other way
- Send, {F3}{Alt}{Up}s{Enter}
- Sleep, 50
- Process, Close, %settings_demulExe%
- }
- Return
- ***************** SETTINGS.INI *************************
- ***************** SETTINGS.INI *************************
- ***************** SETTINGS.INI *************************
- # demul57Max - true (gives a windowed mode full screen, not true fullscreen), fullscreen (sets demul to go true fullscreen), false (demul runs in a normal window)
- # Demul57Plugin - this is used in the per game settings. Choices are gpuDX11, gpuDXv3, and gpuDXLegacy
- [settings]
- PathToDemul =D:\HyperSpin Install 1.0 Final\Emulators\Sammy Atomiswave\demul056-32\
- PathToDemul57 =D:\HyperSpin Install 1.0 Final\Emulators\Sammy Atomiswave\demul057\
- DemulExe =demul.exe
- LoadingScreen =true
- demul57Max =true
- demul57DefaultGPU =gpuDXLegacy
- demulControllerCode = 16777216
- demulMouseCode = 131072
- demulKeyboardCode = 1073741824
- demulLightgunCode = -2147483648 ; not used but here in case
- LastControlUsedDemul =standard
- LastControlUsedDemul57 =standard
- [standard_ATOMISWAVE0_0]
- UP = 200
- DOWN = 208
- LEFT = 203
- RIGHT = 205
- SHOT1 = 29
- SHOT2 = 56
- SHOT3 = 57
- SHOT4 = 42
- SHOT5 = 44
- START = 2
- COIN = 6
- [standard_ATOMISWAVE0_1]
- UP = 19
- DOWN = 33
- LEFT = 32
- RIGHT = 34
- SHOT1 = 30
- SHOT2 = 31
- SHOT3 = 16
- SHOT4 = 17
- SHOT5 = 23
- START = 3
- COIN = 7
- ###BEGIN CHANGES FOR DEMUL 57 FIX
- ###BEGIN CHANGES FOR DEMUL 57 FIX
- ###BEGIN CHANGES FOR DEMUL 57 FIX
- ### I only play games that use the standard controls, if others are needed, can be added following the same pattern. [driving_JAMMA0_0] for example...
- [standard_JAMMA0_0]
- PUSH1 = 29
- PUSH2 = 56
- PUSH3 = 57
- PUSH4 = 42
- PUSH5 = 44
- PUSH6 = 0
- PUSH7 = 0
- PUSH8 = 0
- SERVICE = 0
- START = 2
- COIN = 6
- DIGITALUP = 200
- DIGITALDOWN = 208
- DIGITALLEFT = 203
- DIGITALRIGHT = 205
- ANALOGUP = 0
- ANALOGDOWN = 0
- ANALOGLEFT = 0
- ANALOGRIGHT = 0
- ANALOGUP2 = 0
- ANALOGDOWN2 = 0
- ANALOGLEFT2 = 0
- ANALOGRIGHT2 = 0
- [standard_JAMMA0_1]
- PUSH1 = 30
- PUSH2 = 31
- PUSH3 = 16
- PUSH4 = 17
- PUSH5 = 23
- PUSH6 = 0
- PUSH7 = 0
- PUSH8 = 0
- SERVICE = 0
- START = 3
- COIN = 7
- DIGITALUP = 19
- DIGITALDOWN = 33
- DIGITALLEFT = 32
- DIGITALRIGHT = 34
- ANALOGUP = 0
- ANALOGDOWN = 0
- ANALOGLEFT = 0
- ANALOGRIGHT = 0
- ANALOGUP2 = 0
- ANALOGDOWN2 = 0
- ANALOGLEFT2 = 0
- ANALOGRIGHT2 = 0
- ###END CHANGES FOR DEMUL 57 FIX
- ###END CHANGES FOR DEMUL 57 FIX
- ###END CHANGES FOR DEMUL 57 FIX
- [driving_ATOMISWAVE0_0]
- UP = 200
- DOWN = 208
- LEFT = 203
- RIGHT = 205
- SHOT1 = 29
- SHOT2 = 56
- SHOT3 = 57
- SHOT4 = 42
- SHOT5 = 44
- START = 2
- COIN = 6
- [driving_ATOMISWAVE0_1]
- UP = 19
- DOWN = 33
- LEFT = 32
- RIGHT = 34
- SHOT1 = 30
- SHOT2 = 31
- SHOT3 = 16
- SHOT4 = 17
- SHOT5 = 23
- START = 3
- COIN = 7
- [driving_JAMMA0_0]
- PUSH1 = 29
- PUSH2 = 56
- PUSH3 = 57
- PUSH4 = 42
- PUSH5 = 44
- PUSH6 = 45
- PUSH7 = 46
- PUSH8 = 9
- SERVICE = 0
- START = 2
- COIN = 6
- DIGITALUP = 0
- DIGITALDOWN = 0
- DIGITALLEFT = 203
- DIGITALRIGHT = 205
- ANALOGUP = 9
- ANALOGDOWN = 5
- ANALOGLEFT = 0
- ANALOGRIGHT = 0
- ANALOGUP2 = 0
- ANALOGDOWN2 = 0
- ANALOGLEFT2 = 0
- ANALOGRIGHT2 = 0
- [driving_JAMMA0_1]
- PUSH1 = 30
- PUSH2 = 31
- PUSH3 = 16
- PUSH4 = 17
- PUSH5 = 23
- PUSH6 = 37
- PUSH7 = 36
- PUSH8 = 47
- SERVICE = 0
- START = 3
- COIN = 7
- DIGITALUP = 0
- DIGITALDOWN = 0
- DIGITALLEFT = 32
- DIGITALRIGHT = 34
- ANALOGUP = 47
- ANALOGDOWN = 22
- ANALOGLEFT = 0
- ANALOGRIGHT = 0
- ANALOGUP2 = 0
- ANALOGDOWN2 = 0
- ANALOGLEFT2 = 0
- ANALOGRIGHT2 = 0
- [fps_ATOMISWAVE0_0]
- UP = 200
- DOWN = 208
- LEFT = 203
- RIGHT = 205
- SHOT1 = 29
- SHOT2 = 56
- SHOT3 = 57
- SHOT4 = 42
- SHOT5 = 44
- START = 2
- COIN = 6
- [fps_ATOMISWAVE0_1]
- UP = 19
- DOWN = 33
- LEFT = 32
- RIGHT = 34
- SHOT1 = 30
- SHOT2 = 31
- SHOT3 = 16
- SHOT4 = 17
- SHOT5 = 23
- START = 3
- COIN = 7
- [ggxstyle_ATOMISWAVE0_0]
- #UP = 200
- #DOWN = 208
- #LEFT = 203
- #RIGHT = 205
- #SHOT1 = 46
- #SHOT2 = 18
- #SHOT3 = 44
- #SHOT4 = 20
- #SHOT5 = 21
- #START = 38
- #COIN = 39
- UP = 200
- DOWN = 208
- LEFT = 203
- RIGHT = 205
- SHOT1 = 29
- SHOT2 = 56
- SHOT3 = 57
- SHOT4 = 42
- SHOT5 = 44
- START = 2
- COIN = 6
- [ggxstyle_ATOMISWAVE0_1]
- #UP = 72
- #DOWN = 76
- #LEFT = 75
- #RIGHT = 77
- #SHOT1 = 50
- #SHOT2 = 47
- #SHOT3 = 48
- #SHOT4 = 24
- #SHOT5 = 25
- #START = 19
- #COIN = 51
- UP = 19
- DOWN = 33
- LEFT = 32
- RIGHT = 34
- SHOT1 = 30
- SHOT2 = 31
- SHOT3 = 16
- SHOT4 = 17
- SHOT5 = 23
- START = 3
- COIN = 7
- [reverse_ATOMISWAVE0_0]
- UP = 200
- DOWN = 208
- LEFT = 203
- RIGHT = 205
- SHOT1 = 29
- SHOT2 = 56
- SHOT3 = 57
- SHOT4 = 42
- SHOT5 = 44
- START = 2
- COIN = 6
- [reverse_ATOMISWAVE0_1]
- UP = 19
- DOWN = 33
- LEFT = 32
- RIGHT = 34
- SHOT1 = 30
- SHOT2 = 31
- SHOT3 = 16
- SHOT4 = 17
- SHOT5 = 23
- START = 3
- COIN = 7
- [samba_ATOMISWAVE0_0]
- UP = 200
- DOWN = 208
- LEFT = 203
- RIGHT = 205
- SHOT1 = 29
- SHOT2 = 56
- SHOT3 = 57
- SHOT4 = 42
- SHOT5 = 44
- START = 2
- COIN = 6
- [samba_ATOMISWAVE0_1]
- UP = 19
- DOWN = 33
- LEFT = 32
- RIGHT = 34
- SHOT1 = 30
- SHOT2 = 31
- SHOT3 = 16
- SHOT4 = 17
- SHOT5 = 23
- START = 3
- COIN = 7
- [sfstyle_ATOMISWAVE0_0]
- #UP = 200
- #DOWN = 208
- #LEFT = 203
- #RIGHT = 205
- #SHOT1 = 46
- #SHOT2 = 45
- #SHOT3 = 21
- #SHOT4 = 18
- #SHOT5 = 44
- #START = 38
- #COIN = 39
- UP = 200
- DOWN = 208
- LEFT = 203
- RIGHT = 205
- SHOT1 = 29
- SHOT2 = 56
- SHOT3 = 57
- SHOT4 = 42
- SHOT5 = 44
- START = 2
- COIN = 6
- [sfstyle_ATOMISWAVE0_1]
- #UP = 72
- #DOWN = 76
- #LEFT = 75
- #RIGHT = 77
- #SHOT1 = 50
- #SHOT2 = 49
- #SHOT3 = 25
- #SHOT4 = 47
- #SHOT5 = 48
- #START = 19
- #COIN = 51
- UP = 19
- DOWN = 33
- LEFT = 32
- RIGHT = 34
- SHOT1 = 30
- SHOT2 = 31
- SHOT3 = 16
- SHOT4 = 17
- SHOT5 = 23
- START = 3
- COIN = 7
- # Rom Settings:
- [anmlbskt]
- System = atomiswave
- LongRomName=Animal Basket
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = standard
- Emulator = demul57
- Demul57Plugin = gpuDX11
- [demofist]
- System = atomiswave
- LongRomName=Demolish Fist
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = standard
- Emulator = demul
- Demul57Plugin = gpuDX11
- [dirtypig]
- System = atomiswave
- LongRomName=Dirty Pigskin Football
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = standard
- Emulator = demul57
- Demul57Plugin = gpuDX11
- [dolphin]
- System = atomiswave
- LongRomName=Dolphin Blue
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = standard
- Emulator = demul
- Demul57Plugin = gpuDX11
- [fotns]
- System = atomiswave
- LongRomName=Fist of the North Star
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = sfstyle
- Emulator = demul
- Demul57Plugin = gpuDX11
- [ftspeed]
- System = atomiswave
- LongRomName=Faster Than Speed
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = driving
- Emulator = demul57
- Demul57Plugin = gpuDX11
- [ggisuka]
- System = atomiswave
- LongRomName=Guilty Gear Isuka
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = ggxstyle
- Emulator = demul
- Demul57Plugin = gpuDX11
- [ggx15]
- System = atomiswave
- LongRomName=Guilty Gear X ver. 1.5
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = standard
- Emulator = demul57
- Demul57Plugin = gpuDX11
- [kofxi]
- System = atomiswave
- LongRomName=King of Fighters 11
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = standard
- Emulator = demul57
- Demul57Plugin = gpuDX11
- [kofnw]
- System = atomiswave
- LongRomName=King of Fighters NeoWave
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = sfstyle
- Emulator = demul
- Demul57Plugin = gpuDX11
- [kofnwj]
- System = atomiswave
- LongRomName=King of Fighters NeoWave (JAP)
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = sfstyle
- Emulator = demul
- Demul57Plugin = gpuDX11
- [kov7sprt]
- System = atomiswave
- LongRomName=Knights of Valor - The Seven Spirits
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = standard
- Emulator = demul
- Demul57Plugin = gpuDX11
- [maxspeed]
- System = atomiswave
- LongRomName=Maximum Speed
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = standard
- Emulator = demul57
- Demul57Plugin = gpuDX11
- [mslug6]
- System = atomiswave
- LongRomName=Metal Slug 6
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = standard
- Emulator = demul57
- Demul57Plugin = gpuDX11
- [ngbc]
- System = atomiswave
- LongRomName=Neo-Geo Battle Coliseum
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = standard
- Emulator = demul57
- Demul57Plugin = gpuDX11
- [rangrmsn]
- System = atomiswave
- LongRomName=Ranger Mission
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = standard
- Emulator = demul
- Demul57Plugin = gpuDX11
- [rumblef]
- System = atomiswave
- LongRomName=The Rumble Fish
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = sfstyle
- Emulator = demul
- Demul57Plugin = gpuDX11
- [rumblef2]
- System = atomiswave
- LongRomName=Rumble Fish 2, The
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = standard
- Emulator = demul57
- Demul57Plugin = gpuDX11
- [salmankt]
- System = atomiswave
- LongRomName=Salary Man Kintaro
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = standard
- Emulator = demul57
- Demul57Plugin = gpuDX11
- [samsptk]
- System = atomiswave
- LongRomName=Samurai Spirits Tenkaichi Kenkakuden
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = standard
- Emulator = demul57
- Demul57Plugin = gpuDX11
- [sprtshot]
- System = atomiswave
- LongRomName=Sports Shooting USA
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = standard
- Emulator = demul
- Demul57Plugin = gpuDX11
- [vfurlong]
- System = atomiswave
- LongRomName=Net Select Keiba Victory Furlong
- ScreenTimeout= 7000
- LoadDecrypted= false
- Controls = standard
- Emulator = demul57
- Demul57Plugin = gpuDX11
- [xtrmhunt]
- System = atomiswave
- LongRomName=Extreme Hunting
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = standard
- Emulator = demul
- Demul57Plugin = gpuDX11
- [xtrmhnt2]
- System = atomiswave
- LongRomName=Extreme Hunting 2
- ScreenTimeout= 5555
- LoadDecrypted= false
- Controls = lightgun
- Emulator = demul
- Demul57Plugin = gpuDX11
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement