I have created a functio that handles screen/display rotation if a vertical rom is selected within hyperspin MAME. I use the listXMLinfo function of hyperlaunch to detect if the rom is a vertical or horizontal game. With this you do not have to generate/create a vertical or horizontal gamelist for MAME. It reads it from the listXMLinfo.
It's still in test phase but maybe people with rotating monitors using SMCMD or people using iRotate (or both) can test the scripts since my rotating arcrade cab is not finished yet so I cannot test.
For my tests I use a lot of logging into the script, so you can see in the actions in the /hyperlaunch/ log file when selecting mame games.
Update: Fixed loading of other systems other then mame error msg.
UserFunctions.ahk ( located in /hyperspin/hyperlaunch/lib/ )
; Use this function to define any code you want to run in every module on start
StartGlobalUserFeatures(){
Log("StartGlobalUserFeatures - Starting")
Global emupath, romName, systemName
Log("RotateFunctions - System " . systemName)
If ( systemName = "MAME" )
{
Log("RotateFunctions - MAME:True")
ListMameTable := []
ListMameTable := ListXMLInfo%zz%(romName)
RotationAngle := ListMameTable[2]
Rotation := 0 ;horizontal
Log("RotateFunctions - Rotation:" . RotationAngle . " ROM:" . romName)
If (RotationAngle != "0")
{
Rotation :=1
Log("RotateFunctions - Rotating Vertical")
}
Runwait, %emupath%\Rotation.exe %Rotation%
Log("RotateFunctions - Rotation.exe Executed")
return
}
Log("StartGlobalUserFeatures - Ending")
}
; Use this function to define any code you may need to stop or clean up in every module on exit
StopGlobalUserFeatures(){
Log("StopGlobalUserFeatures - Starting")
Global emupath, systemName
If ( systemName = "MAME" )
{
;Unmark below if you want back to horizontal state after quiting game:
;Runwait, %emupath%\Rotation.exe "0"
;Log("RotateFunctions - Rotation.exe back to horizontal")
return
}
Log("StopGlobalUserFeatures - Ending")
}
The above script fires the rotation.exe (compiled ahk) in the hyperspin\emulators\mame\ root.
if you want to turn the monitor back to horizontal position on quiting the game, umremark the runwait in the StopGlobalUserFeatures function.
The source for Rotation.ahk that is fired by UserFunctions.ahk above. Put it in the root of hyperspin\emulators\mame\ .
You need to compile this with autoHotkey to an executable. If you have autohotkey installed, just right click the file and compile.
;[Rotation.exe]
#SingleInstance force
SetWorkingDir %A_ScriptDir%
;parsed value from UserFunctions.ahk
Rotation = %1%
;read Current state
iniread, state, %A_scriptdir%\Rotationstate.ini, Controls, PrevState
If ( Rotation = 0)
{
iniwrite, "Selected horizontal game", %A_scriptdir%\Rotationstate.ini, log, rotlog
goto horizontalRotation
}
Else If (Rotation = 1)
{
iniwrite, "Selected Vertical game", %A_scriptdir%\Rotationstate.ini, log, rotlog
goto verticalRotation
}
verticalRotation:
If ( state = 1)
{
; Monitor already vertical position.
iniwrite, "vertical state was 1", %A_scriptdir%\Rotationstate.ini, log, loging
exitapp
}
Else If ( state = 0)
{
; Rotate monitor to vertical position:
;Run, %COMSPEC% /c "smccmd --resume --speed -530", ,{enter},hide
;Or/And use iRotate:
; Run, irotate.exe /rotate=90
; Write rotation state:
iniwrite, 1, %A_scriptdir%\Rotationstate.ini, controls, PrevState
iniwrite, "vertical state was 0", %A_scriptdir%\Rotationstate.ini, log, loging
exitapp
}
horizontalRotation:
If ( state = 0)
{
; Monitor already horizontal position.
iniwrite, "horizontal state was 0", %A_scriptdir%\Rotationstate.ini, log, loging
exitapp
}
Else If( state = 1)
{
; Rotate monitor to horizontal position:
;Run, %COMSPEC% /c "smccmd --resume --speed 520", ,{enter},hide
;Or/And use iRotate:
; Run, irotate.exe /rotate=90
; Write rotation state:
iniwrite, 0, %A_scriptdir%\Rotationstate.ini, controls, PrevState
iniwrite, "horizontal state was 1", %A_scriptdir%\Rotationstate.ini, log, loging
exitapp
}
You also need a rotationstate.ini in the hyperspin\emulators\mame\ mame*.exe root to read/write the previous state the monitor is in when launching a new game
Vertical (1) OR horizontal (0)
[Controls]
PrevState=1
[log]
loging="vertical state was 1"
rotlog="Selected Vertical game"
You also have to set the rotation mode in MAME.ini in which way your screen rotates.
set autoror to 1 if your screen is rotating anti clockwise to vertical
set the autorol to 1 if your screen is rotating Counter-clockwise for vertical games.
#
# CORE ROTATION OPTIONS
#
autoror 0
autorol 0
Please let me know results.