I want to thank RetroBorg for leading me in the right direction. All the credit for this code goes to Chillinwater at the HS forums. This is primarily HIS code, I just modified it to suit my needs. I am completely impressed with his troubleshooting abilities and how he "set-up" the development of this code. The source can be found here:
http://www.hyperspin-fe.com/forum/showthread.php?t=11271&highlight=4way. The MAME module for Hyperspin is the work of BadBoyBill at the same forums. This is his work, just modified for the rotation files.
The files you need are all attached, but they need to be modified for your setup. I am detailing the process here so you can understand what changes need to be made to what files. I hope this doesn't violate some forum rules. I am just showing the contents of each file.
First thing you need to do is update to Hyperlaunch to v2.0. This can be found at the HS forums. Next, you need to use the modified MAME module below. This adds Runwait....Rotation.exe line in the beginning and two more lines of code at the end initiating a "reset" in %Rompath%.This is the "MAME" file attached. This file goes in the \modules\mame directory in your HS setup.
;----------------------------------------------------------------------------
; MAME
; MAME .140
; by BBB
; 1.0
;
; Info:
; Since MAME needs to save hi scores and data on exit, then we can\'t force
; MAME closed with a hotkey. So make sure you have your own exit key setup
; in MAME first. We will leave the CloseProcess section below blank, but
; it is still required.
;
;----------------------------------------------------------------------------
Runwait, %emupath%\Rotation.exe "%romName%" (THIS LINE HAS BEEN ADDED)
Runwait, %executable% %romName%, %emuPath%, Hide UseErrorLevel
if(ErrorLevel != 0){
if (ErrorLevel = 1){
Error = Failed Validity
}else if(ErrorLevel = 2){
Error = Missing Files
}else if(ErrorLevel = 3){
Error = Fatal Error
}else if(ErrorLevel = 4){
Error = Device Error
}else if(ErrorLevel = 5){
Error = Game Does Not Exist
}else if(ErrorLevel = 6){
Error = Invalid Config
}else if(ErrorLevel = 7 || ErrorLevel = 8 || ErrorLevel = 9){
Error = Identification Error
}else{
Error = Mame Error
}
MsgBox Mame Error - %Error%
}
process, waitclose, %executable% (THIS LINE HAS BEEN ADDED)
Runwait, %emupath%\Rotation.exe "reset" (THIS LINE HAS BEEN ADDED)
ExitApp
;Required
CloseProcess:
;Doesnt have to do anything but make sure to have the line before and after this line.
return
Next you need to add two files to you MAME root folder. The first one is a list of vertical games
which I haven't completed yet. The other is the Rotation.ahk which contains the code to send commands to SMCCMD depending upon the list.
Open the Rotation text file and you'll see it's incomplete. Any game you want on a vertical rotation needs to go in the line "Set2_vertical=" single line followed by a comma.
If someone knows how to do this easily, please let me know. I don't want to type that all out! This file goes in your MAME root folder.
[Controls]
PrevState=horizontal
Set2_vertical=005,progolf,1941j,1941,1942,1942b (etc. Add all vertical ROM games here followed by a comma.)
Finally you need to add the Rotation.ahk to your MAME root folder. This one needs some editing. The line that reads "iniwrite, vertical, C:\arcade\mame\Rotation.ini, controls, PrevState" - you need to change the directory to your setup. This needs to point to Rotation.ini. Same thing for the line that reads "iniwrite, horizontal, C:\arcade\mame\Rotation.ini, controls, PrevState " If you read the code, you'll notice I am using --speed 1000. You might want to start this off slower to make sure it works on your setup before rotating at this speed. Once you are done editing, you need to compile this to an .exe in the same location.
;[Rotation.exe]
;
;
#SingleInstance force
romName = %1%
param := "%romName%"
;reads verticalRoms controlled roms list
IniRead, verticalRoms, %A_ScriptDir%\Rotation.ini, controls, Set2_vertical
;reads state of vertical, horizontal rotation (user added line in "controls.ini")
iniread, state, %a_scriptdir%\Rotation.ini, Controls, PrevState
ifnotinstring, verticalRoms, %romname%, gosub, horizontalrotation
verticalrotation:
if ( State = "vertical")
{
exitapp
}
else if ( State = "horizontal")
{
Run, %COMSPEC% /c "smccmd --resume --speed 1000", ,{enter},hide
iniwrite, vertical, C:\arcade\mame\Rotation.ini, controls, PrevState
exitapp
}
horizontalrotation:
if ( State = "horizontal" )
{
exitapp
}
else if ( State = "vertical")
{
Run, %COMSPEC% /c "smccmd --resume --speed -1000", ,{enter},hide
iniwrite, horizontal, C:\arcade\mame\Rotation.ini, controls, PrevState
exitapp
}
That's all it takes! If you did everything correctly and I explained it well enough, hopefully you'll be able to go into hyperlaunch and run say 1942 with a rotation vertical, then back to horizontal on exit. Then if you enter in something like Robotron, you should not get any rotation. The code is basically writing to "prevstate" in the Rotation.ini file. You can CNTRL+ALT+DEL any instance of Mame to see that it's writing "horizontal" or "vertical" at that location.
All you have to do now is the arduous task of setting up each game in MAME with a CW90 or CCW90 rotation. I have a list from ROMLister with all the vertical games, I just need to get them into a single string. Then I figure as I play games, when the monitor turns (because the game was found in the list), I will go into MAME settings and change the orientation. Once this is done, it will always be in the orientation, so over time this won't be an issue anymore. (Anyone have a better way of doing this?)Enjoy!