Jump to content
  • Announcement

    The HyperSpin 2 early access beta is here!

    We’re starting the first public testing phase with Platinum Members to keep the scope manageable while we test the current feature set and begin to add more. In the future, we’ll provide a version for basic members as well.  On behalf of the entire HyperSpin team, we look forward to another exciting adventure with our community.

Help Rotating monitor


epicfatigue

Recommended Posts

Posted

Hello Everyone,

I am just wanting to know how i can go about getting Hyperspin to launch an exe file for vertical Mame games and another for Horizontal games.

My reason is for my rotating monitor i have built a USB rotating system and just want to implement it into my cabinet.

This is what the GUI looks like and a demo of the system,

You can view the full project here.

http://www.hyperspin-fe.com/forum/showthread.php?26691-My-first-Arcade-Build-Rotating-CRT-amp-More

Posted

Take a look here:

http://forum.arcadecontrols.com/index.php/topic,110471.80.html

I followed that thread and now my monitor automatically rotates depending on which rom is loaded. The only thing I'd change is don't put any code directly into the mame module because obviously you will overwrite it when you update. I need to change this myself now I'm using RL, I currently have it inside the module but I'm sure there's a cleaner way for this to work.

Posted

I tried putting the code into StartGlobalUserFeatures() and StopGlobalUserFeatures() but couldnt get it to work. Here are the lines in red that I originally added to the module to get the auto rotate to work.

MEmu = MAME
MEmuV =  v0.148				
MURL = http://www.mame.net/
MAuthor = djvj
MVersion = 2.0
MCRC = 2C317D7A
iCRC = 8E4C99AB
MID = 635038268903403479
MSystem = "Cave","LaserDisc","MAME","Nintendo Arcade Systems","Sega Model 1","Sega ST-V","SNK Neo Geo","SNK Neo Geo AES"
;----------------------------------------------------------------------------
; Notes:
; No need to edit mame.ini and set your rom folder, module sends the rompath for you.
; Command Line Options - http://easyemu.mameworld.info/mameguide/mameguide-options.html
; High Scores DO NOT SAVE when cheats are enabled!
;----------------------------------------------------------------------------


StartModule()
FadeInStart()

settingsFile := CheckFile(modulePath . "\" . moduleName . ".ini")

Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
Videomode := IniReadCheck(settingsFile, "Settings", "Videomode","d3d",,1)
pauseMethod := IniReadCheck(settingsFile, "Settings", "PauseMethod",1,,1)	; set the pause method that works better on your machine (preferred methods 1 and 2) 1 = Win7 and Win8 OK - Problems with Win XP, 2 = preferred method for WinXP - Problems in Win7, 3 and 4 = same as 1 and 2, 5 = only use If you have a direct input version of mame, 6 = suspend mame process method, it could crash mame in some computers
bezelMode := IniReadCheck(settingsFile, "Settings", "BezelMode","layout",,1)	; "layout" or "normal"
cheatMode := IniReadCheck(settingsFile, "Settings", "CheatMode","false",,1)
cheatModeKey := IniReadCheck(settingsFile, "Settings", "CheatModeKey",A_Space,,1)	; user defined key to be held down before launching a mame rom.
sysParams := IniReadCheck(settingsFile, systemName, "Params", A_Space,,1)
romParams := IniReadCheck(settingsFile, romName, "Params", A_Space,,1)
mameRomName := IniReadCheck(settingsFile, romName, "MameRomName", A_Space,,1)

If bezelEnabled = true
{	ListXMLtable := []
ListXMLtable := ListXMLInfo(romName)
}
If bezelMode = layout
{	useBezels := If (bezelEnabled = "true") ? "-use_bezels" : "-nouse_bezels"
useOverlays := If (bezelEnabled = "true") ? "-use_overlays" : "-nouse_overlays"
useBackdrops := If (bezelEnabled = "true") ? "-use_backdrops" : "-nouse_backdrops"
BezelStart(romName,ListXMLtable[1],ListXMLtable[2],ListXMLtable[3],ListXMLtable[4])
} Else {
useBezels := "-nouse_bezels"
useOverlays := "-nouse_overlays"
useBackdrops := "-nouse_backdrops"
BezelStart(,,ListXMLtable[2])
}

; -romload part of 147u2 that shows what roms were checked when missing roms
winstate := If (Fullscreen = "true") ? "Hide UseErrorLevel" : "UseErrorLevel"
fullscreen := If (Fullscreen = "true") ? "-nowindow" : "-window"
videomode := If (Videomode != "" ) ? "-video " . videomode : ""
sysParams := If sysParams != ""  ? sysParams : ""
romParams := If romParams != ""  ? romParams : ""

StringReplace,mameRomPaths,romPathFromIni,|,`"`;`",1	; replace all instances of | to ; in the Rom_Path from Emulators.ini so mame knows where to find your roms
mameRomPaths := "-rompath """ .  (If mameRomName ? romPath : mameRomPaths) . """"	; if using an alt rom, only supply mame with the path to that rom so it doesn't try to use the original rom

If InStr(romParams,"-rompath")
ScriptError("""-rompath"" is defined as a parameter for " . romName . ". The MAME module fills this automatically so please remove this from Params in the module's settings.")
If InStr(sysParams,"-rompath")
ScriptError("""-rompath"" is defined as a parameter for " . systemName . ". The MAME module fills this automatically so please remove this from Params in the module's settings.")

If mameRomName {
FileMove, %romPath%\%romName%%romExtension%, %romPath%\%mameRomName%%romExtension%	; rename rom to match what mame needs
originalRomName := romName	; store romName from database so we know what to rename it back to later
romName := mameRomName
If ErrorLevel
	ScriptError("There was a problem renaming " . romName . "  to " . mameRomName . " in " . romPath . ". Please check you have write permission to this folder/file and you don't already have a file named """ . mameRomName . """ in your rom folder.",8)
Else	; if rename was successful, set var so we know to move it back later
	fileRenamed = 1
}

If cheatMode = true
{	If cheatModeKey	; if user wants to use a key to enable CheatMode
	cheatEnabled := If XHotkeyAllKeysPressed(cheatModeKey) ? "-cheat" : ""
Else	; no cheat mode key defined
	cheatEnabled := "-cheat"
}


[color="#FF0000"]Runwait, %emupath%\Rotation.exe "%romName%"[/color]

Run(executable . A_Space . romName . A_Space . fullscreen . A_Space . cheatEnabled . A_Space . videomode . A_Space . useBezels . A_Space . useOverlays . A_Space . useBackdrops . A_Space . mameRomPaths . A_Space . sysParams . A_Space . romParams, emuPath, winstate)

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 in 7,8,9
	Error = Identification Error
Else
	Error = MAME Error
ScriptError("MAME Error - " . Error)
}

WinWait("MAME ahk_class MAME")
WinWaitActive("MAME ahk_class MAME")

BezelDraw()
FadeInExit()
Process("WaitClose", executable)
[color="#FF0000"]Runwait, %emupath%\Rotation.exe "reset"[/color]
BezelExit()

If fileRenamed {	; rename file back to alternate name for next launch
FileMove, %romPath%\%romName%%romExtension%, %romPath%\%originalRomName%%romExtension%
If ErrorLevel	; if rename was successful, set var so we know to move it back later
	ScriptError("There was a problem renaming " . romName . " back to " . originalRomName)
}

FadeOutExit()
ExitModule()


ListXMLInfo(rom){ ; returns MAME/MESS info about parent rom, orientation angle, resolution
Global emuFullPath, emuPath
ListXMLtable := []
RunWait, % comspec . " /c " . """" . emuFullPath . """" . " -listxml " . rom . " > tempBezel.txt", %emuPath%, Hide
Fileread, ListxmlContents, %emuPath%\tempBezel.txt
RegExMatch(ListxmlContents, "s)<game.*name=" . """" . rom . """" . ".*" . "cloneof=" . """" . "[^""""]*", parent)
RegExMatch(parent,"cloneof=" . """" . ".*", parent)
RegExMatch(parent,"""" . ".*", parent)
StringTrimLeft, parent, parent, 1
RegExMatch(ListxmlContents, "s)<display.*rotate=" . """" . "[0-9]+" . """", angle)
RegExMatch(angle,"[0-9]+", angle, "-6")
RegExMatch(ListxmlContents, "s)<display.*width=" . """" . "[0-9]+" . """", width)
RegExMatch(width,"[0-9]+", width, "-6")
RegExMatch(ListxmlContents, "s)<display.*height=" . """" . "[0-9]+" . """", Height)
RegExMatch(Height,"[0-9]+", Height, "-6")
ListXMLtable[1] := parent
ListXMLtable[2] := angle
If (ListXMLtable[2]<>0)
	ListXMLtable[3] := height
Else
	ListXMLtable[3] := width
If (ListXMLtable[2]<>0)
	ListXMLtable[4] := width
Else
	ListXMLtable[4] := height
FileDelete, %emuPath%\tempBezel.txt
Return ListXMLtable	
}

HaltEmu:
If pauseMethod = 1
{	disableSuspendEmu = true
	disableRestoreEmu = true
	PostMessage,0x211, 1, , , MAME ahk_class MAME
} Else If pauseMethod = 2
{	disableSuspendEmu = true
	PostMessage,0x211, 1, , , MAME ahk_class MAME
} Else If pauseMethod = 3
{	disableSuspendEmu = true
	disableRestoreEmu = true
	PostMessage,% 0x0400+6, 1, , , MAME ahk_class MAME
} Else If pauseMethod = 4
{	disableSuspendEmu = true
	PostMessage,% 0x0400+6, 1, , , MAME ahk_class MAME
} Else If pauseMethod = 5
{	disableSuspendEmu = true
	Send, {P down}
	Sleep, 1000
	Send, {P up} 
}
Return
RestoreEmu:
If pauseMethod = 1
{	PostMessage,0x212, 1, , , MAME ahk_class MAME
	WinActivate, MAME ahk_class MAME
} Else If pauseMethod = 2
{	PostMessage,0x212, 1, , , MAME ahk_class MAME
	WinActivate, MAME ahk_class MAME
} Else If pauseMethod = 3
{	PostMessage,% 0x0400+6, 0, , , MAME ahk_class MAME
	WinActivate, MAME ahk_class MAME
} Else If pauseMethod = 4
{	PostMessage,% 0x0400+6, 0, , , MAME ahk_class MAME
	WinActivate, MAME ahk_class MAME
} Else If pauseMethod = 5
{	disableSuspendEmu = true
	Send, {P down}
	Sleep, 1000
	Send, {P up} 
	WinActivate, MAME ahk_class MAME
} Else If pauseMethod = 6
	WinActivate, MAME ahk_class MAME
Return



CloseProcess:

FadeOutStart()
WinClose("MAME ahk_class MAME")
Return

Not sure if its needed but here is the rotate.ahk to see whats going on.

;[Rotation.exe]

;

;

#SingleInstance force 


romName = %1%

If ((romName = "ace") | (romName = "maze") | (romName = "bang") | (romName = "batman") | (romName = "blasto") | (romName = "bullfgt") | (romName = "cannball") | (romName = "circus") | (romName = "combat") | (romName = "cotton") | (romName = "smash") | (romName = "dday") | (romName = "zero") | (romName = "edf") | (romName = "esb") | (romName = "flyball") | (romName = "gaia") | (romName = "galaxi") | (romName = "gng") | (romName = "grdnstrm") | (romName = "headon") | (romName = "car2") | (romName = "hustle") | (romName = "island") | (romName = "island2") | (romName = "joust") | (romName = "eto") | (romName = "le2") | (romName = "msh") | (romName = "mk") | (romName = "mk2") | (romName = "news") | (romName = "orbit") | (romName = "pass") | (romName = "pgm") | (romName = "phrcraze") | (romName = "popeye") | (romName = "kok") | (romName = "spy") | (romName = "safari") | (romName = "sonic") | (romName = "skyraid") | (romName = "sss") | (romName = "sf") | (romName = "roul") | (romName = "jleague") | (romName = "atetris") | (romName = "tetris") | (romName = "tictac") | (romName = "toki") | (romName = "tm") | (romName = "statriv2") | (romName = "vf") | (romName = "vr") | (romName = "topgun") | (romName = "ws") | (romName = "swa"))
{
goto horizontalrotation
}

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 2050", ,{enter},hide
;run C:\Program Files (x86)\iRotate\irotate.exe /1:rotate=90

iniwrite, vertical, C:\HyperSpin\Emulators\MAME\Rotation.ini, controls, PrevState 

exitapp

}



horizontalrotation:

if ( State = "horizontal" ) 

{

exitapp

} 

else if ( State = "vertical") 

{ 

Run, %COMSPEC% /c "smccmd --resume --speed -2050", ,{enter},hide
;run C:\Program Files (x86)\iRotate\irotate.exe /1:rotate=0

iniwrite, horizontal, C:\HyperSpin\Emulators\MAME\Rotation.ini, controls, PrevState 

exitapp

}

Last but not least my log.

16:59:57:572 | HL |     INFO  | +N/A   | Main - HyperLaunch v3.0.0.7
16:59:57:573 | HL |     INFO  | +0     | Main - System Specs:
				HyperLaunch Dir: C:\HyperSpin\HyperLaunch
				OS: WIN_7
				Architecture: 64-bit (might not be accurate)
				OS Language: 0409
				OS Admin Status: Yes
				Monitor #1 (\\.\DISPLAY1): 1920x1080 (1920x1040 work)
				Monitor #2 (\\.\DISPLAY2): 3200x1024 (3200x1024 work)
				AutoHotkey Path: C:\Program Files (x86)\AutoHotkey\AutoHotkey.exe
				AHK Version: 1.1.09.04
				Unicode: No
16:59:57:573 | HL |     INFO  | +0     | Main - HyperSpin.exe coordinates are x0 y0 w1920 h1080
16:59:57:573 | HL |     INFO  | +0     | CheckFile - Checking if C:\HyperSpin\HyperLaunch\HyperLaunch.exe exists
16:59:57:574 | HL |     INFO  | +0     | Main - HyperLaunch received "MAME" and "1944"
16:59:57:583 | HL |     INFO  | +15    | Main - 1944 is using the default emulator: MAME
16:59:57:583 | HL |     INFO  | +0     | Main - Checking for a [MAME] section in C:\HyperSpin\HyperLaunch\Settings\MAME\Emulators.ini
16:59:57:583 | HL |     INFO  | +0     | Main - Checking for a [MAME] section in C:\HyperSpin\HyperLaunch\Settings\Global Emulators.ini
16:59:57:584 | HL |     INFO  | +0     | Main - Found [MAME] in C:\HyperSpin\HyperLaunch\Settings\Global Emulators.ini
16:59:57:584 | HL |     INFO  | +0     | CheckFile - Checking if C:\HyperSpin\HyperLaunch\Modules\MAME\MAME.ahk exists
16:59:57:591 | HL |     INFO  | +0     | Main - CRC Check - CRC matches, this is an official unedited module.
16:59:57:591 | HL |     INFO  | +0     | Main - 1944 will use module: C:\HyperSpin\HyperLaunch\Modules\MAME\MAME.ahk
16:59:57:608 | HL |     INFO  | +16    | Main - INI Keys read
16:59:57:608 | HL |     INFO  | +0     | CheckFile - Checking if C:\HyperSpin\HyperLaunch\Module Extensions\7z.exe exists
16:59:57:611 | HL |     INFO  | +0     | CheckFile - Checking if C:\HyperSpin\HyperLaunch\Module Extensions\7z.dll exists
16:59:57:611 | HL |     INFO  | +0     | CreateRomMapTable - Started
16:59:57:611 | HL |     INFO  | +0     | CreateRomMapTable - Could not find any roms for the Rom Map Table
16:59:57:611 | HL |     INFO  | +0     | CreateRomMapTable - Ended, No mapping inis found.
16:59:57:611 | HL |     INFO  | +0     | CheckPaths - Started
16:59:57:611 | HL |     INFO  | +0     | CheckPaths - Found rom: C:\HyperSpin\Emulators\MAME\roms\1944.zip
16:59:57:611 | HL |     INFO  | +0     | CheckFile - Checking if C:\HyperSpin\Emulators\MAME\mame64.exe exists
16:59:57:611 | HL |     INFO  | +0     | CheckPaths - Ended
16:59:57:613 | HL |     INFO  | +16    | BuildScript - User Variables:
				;----------------------------------------------------------------------------
				; INJECTED VARIABLES
				;----------------------------------------------------------------------------

				#NoTrayIcon
				#InstallKeybdHook
				DetectHiddenWindows, ON
				SetTitleMatchMode, 2
				SendMode, Event
				0 = 2
				frontendPID = 2868
				frontendPath = C:\HyperSpin
				frontendExe = HyperSpin.exe
				frontendExt = exe
				frontendName = HyperSpin
				frontendDrive = C:
				exitEmulatorKey = ~Esc
				exitEmulatorKeyWait = 0
				forceHoldKey = ~Esc
				restoreFE = true
				exitScriptKey = ~[ & ~]
				emuFullPath = C:\HyperSpin\Emulators\MAME\mame64.exe
				emuPath = C:\HyperSpin\Emulators\MAME
				emuName = MAME
				emuExt = exe
				romPath = C:\HyperSpin\Emulators\MAME\roms
				romPathFromIni = C:\HyperSpin\Emulators\MAME\roms
				romExtension = .zip
				romExtensionOrig = .zip
				romExtensions = zip|7z|chd
				executable = mame64.exe
				systemName = MAME
				dbName = 1944
				romName = 
				romMapPath = C:\HyperSpin\HyperLaunch\Settings\MAME\Rom Mapping
				romMappingEnabled = true
				romMappingLaunchMenuEnabled = false
				romMappingFirstMatchingExt = true
				romMappingShowAllRomsInArchive = false
				romMappingNumberOfWheelsByScreen = 7
				romMappingMenuWidth = 300
				romMappingMenuMargin = 50
				romMappingTextFont = Bebas Neue
				romMappingTextOptions = cFFFFFFFF r4 s40 Bold
				romMappingDisabledTextColor = ff888888
				romMappingTextSizeDifference = 5
				romMappingTextMargin = 10
				romMappingTitleTextFont = Bebas Neue
				romMappingTitleTextOptions = cFFFFFFFF r4 s60 Bold
				romMappingTitle2TextFont = Bebas Neue
				romMappingTitle2TextOptions = cFFFFFFFF r4 s15 Bold
				romMappingGameInfoTextFont = Bebas Neue
				romMappingGameInfoTextOptions = cFFFFFFFF r4 s15 Regular
				romMappingBackgroundBrush = aa000000
				romMappingColumnBrush = 33000000
				romMappingButtonBrush1 = 6f000000
				romMappingButtonBrush2 = 33000000
				romMappingBackgroundAlign = Stretch and Lose Aspect
				romMappingMenuFlagWidth = 40
				romMappingMenuFlagSeparation = 5
				romMappingDefaultMenuList = FullList
				romMappingSingleFilteredRomAutomaticLaunch = false
				skipchecks = False
				romMatchExt = true
				logFile = C:\HyperSpin\HyperLaunch\HyperLaunch.log
				logLabel := ["    INFO"," WARNING","   ERROR","  DEBUG1","  DEBUG2"]
				logLevel = 3
				logIncludeModule = true
				logIncludeFileProperties = true
				logShowCommandWindow = false
				logCommandWindow = false
				navUpKey = Up|R
				navDownKey = Down|F
				navLeftKey = Left
				navRightKey = Right
				navSelectKey = Enter
				originalWidth = 1920
				originalHeight = 1080
				dtEnabled = true
				dtPath = 
				dtUseSCSI = true
				dtAddDrive = true
				emuIdleShutdown = 0
				hideEmu = true
				hideFE = true
				fadeIn = false
				fadeInDuration = 500
				fadeInTransitionAnimation = DefaultAnimateFadeIn
				fadeInDelay = 0
				fadeInExitDelay = 0
				fadeOutExitDelay = 0
				fadeOut = false
				fadeOutDuration = 0
				fadeOutTransitionAnimation = DefaultAnimateFadeOut
				fadeOutDelay = 0
				fadeLyrInterpolation = 7
				fadeLyr1Color = FF000000
				fadeLyr1AlignImage = Align to Top Left
				fadeLyr2Pos = Bottom Right Corner
				fadeLyr2X = 300
				fadeLyr2Y = 300
				fadeLyr2Adjust = 1
				fadeLyr2PicPad = 0
				fadeLyr3Pos = Center
				fadeLyr3X = 300
				fadeLyr3Y = 300
				fadeLyr3Adjust = 0.75
				fadeLyr3Speed = 750
				fadeLyr3Animation = DefaultFadeAnimation
				fadeLyr37zAnimation = DefaultFadeAnimation
				fadeLyr3Type = imageandbar
				fadeLyr3ImgFollow7zProgress = true
				fadeLyr3Repeat = 1
				fadeLyr3PicPad = 0
				fadeLyr4Adjust = 0.75
				fadeLyr4X = 100
				fadeLyr4Y = 100
				fadeLyr4Pos = Above Layer 3 - Left
				fadeLyr4FPS = 10
				fadeLyr4PicPad = 0
				fadeTranspGifColor = FFFFFF
				fadeBarWindow = false
				fadeBarWindowX = 
				fadeBarWindowY = 
				fadeBarWindowW = 600
				fadeBarWindowH = 120
				fadeBarWindowR = 20
				fadeBarWindowM = 20
				fadeBarWindowHatchStyle = 8
				fadeBarBack = true
				fadeBarBackColor = FF555555
				fadeBarH = 20
				fadeBarR = 5
				fadeBarColor = DD00BFFF
				fadeBarHatchStyle = 3
				fadeBarPercentageText = true
				fadeBarInfoText = true
				fadeBarXOffset = 0
				fadeBarYOffset = 100
				fadeRomInfoDescription = text
				fadeRomInfoSystemName = text
				fadeRomInfoYear = text
				fadeRomInfoManufacturer = text
				fadeRomInfoGenre = text
				fadeRomInfoRating = text
				fadeRomInfoOrder = Description|SystemName|Year|Manufacturer|Genre|Rating
				fadeRomInfoTextPlacement = topRight
				fadeRomInfoTextMargin = 5
				fadeRomInfoText1Options = cFF555555 r4 s20 Bold
				fadeRomInfoText2Options = cFF555555 r4 s20 Bold
				fadeRomInfoText3Options = cFF555555 r4 s20 Bold
				fadeRomInfoText4Options = cFF555555 r4 s20 Bold
				fadeRomInfoText5Options = cFF555555 r4 s20 Bold
				fadeRomInfoText6Options = cFF555555 r4 s20 Bold
				fadeStats_Number_of_Times_Played = text with label
				fadeStats_Last_Time_Played = text with label
				fadeStats_Average_Time_Played = text with label
				fadeStats_Total_Time_Played = text with label
				fadeStats_System_Total_Played_Time = text with label
				fadeStats_Total_Global_Played_Time = text with label
				fadeStatsInfoOrder = Number_of_Times_Played|Last_Time_Played|Average_Time_Played|Total_Time_Played|System_Total_Played_Time|Total_Global_Played_Time
				fadeStatsInfoTextPlacement = topLeft
				fadeStatsInfoTextMargin = 5
				fadeStatsInfoText1Options = cFF555555 r4 s20 Bold
				fadeStatsInfoText2Options = cFF555555 r4 s20 Bold
				fadeStatsInfoText3Options = cFF555555 r4 s20 Bold
				fadeStatsInfoText4Options = cFF555555 r4 s20 Bold
				fadeStatsInfoText5Options = cFF555555 r4 s20 Bold
				fadeStatsInfoText6Options = cFF555555 r4 s20 Bold
				fadeText1X = 0
				fadeText1Y = 0
				fadeText1Options = cFFFFFFFF r4 s20 Right Bold
				fadeText1 = Loading Game
				fadeText2X = 0
				fadeText2Y = 0
				fadeText2Options = cFFFFFFFF r4 s20 Right Bold
				fadeText2 = Extraction Complete
				fadeFont = Arial
				fadeSystemAndRomLayersOnly = false
				fadeInterruptKey = 
				detectFadeErrorEnabled = true
				fadeImgPath = C:\HyperSpin\HyperLaunch\Media\Fade
				HLDataPath = C:\HyperSpin\HyperLaunch\Data
				HLMediaPath = C:\HyperSpin\HyperLaunch\Media
				HLErrSoundPath = C:\HyperSpin\HyperLaunch\Media\Sounds\Error
				modulesPath = C:\HyperSpin\HyperLaunch\Modules
				moduleFullName = C:\HyperSpin\HyperLaunch\Modules\MAME\MAME.ahk
				moduleName = MAME
				modulePath = C:\HyperSpin\HyperLaunch\Modules\MAME
				moduleExtension = ahk
				moduleExtensionsPath = C:\HyperSpin\HyperLaunch\Module Extensions
				libPath = C:\HyperSpin\HyperLaunch\Lib
				7zEnabled = false
				7zPath = C:\HyperSpin\HyperLaunch\Module Extensions\7z.exe
				7zDllPath = C:\HyperSpin\HyperLaunch\Module Extensions\7z.dll
				7zExtractPath = C:\Users\Mark\AppData\Local\Temp\HS
				7zExtractPathOrig = 
				7zAttachSystemName = false
				7zDelTemp = true
				7zSounds = true
				7zFormats = .zip,.rar,.7z,.lzh,.gzip,.tar
				7zFormatsNoP = zip,rar,7z,lzh,gzip,tar
				mgEnabled = false
				mgKey = ~NumpadSub
				mgBackgroundColor = FF000000
				mgSidePadding = 0.2
				mgYOffset = 500
				mgImageAdjust = 1
				mgFont = Arial
				mgText1Options = x10p y30p w80p Center cBBFFFFFF r4 s100 BoldItalic
				mgText1Text = Please select a game
				mgText2Options = w96p cFFFFFFFF r4 s50 Center BoldItalic
				mgText2Offset = 70
				mgUseSound = true
				mgSoundfreq = 300
				mgExitEffect = none
				mgSelectedEffect = rotate
				mgUseGameArt = false
				mgArtworkDir = Artwork1
				hpEnabled = false
				hpKey = ~NumpadAdd
				hpBackToMenuBarKey = X
				hpZoomInKey = C
				hpZoomOutKey = V
				hpScreenshotKey = ~PrintScreen
				hpHiToTextPath = C:\HyperSpin\HyperLaunch\Module Extensions\HiToText.exe
				hpSaveStateKeyCodes = {shift down}{F7 down}{F7 up}{shift up}
				hpLoadStateKeyCodes = {shift down}{F7 down}{F7 up}{shift up}
				keymapperEnabled = false
				keymapper = ahk
				xpadderFullPath = C:\HyperSpin\Utilities\Xpadder\xpadder.exe
				joyToKeyFullPath = C:\HyperSpin\Utilities\JoyToKey\JoyToKey.exe
				keymapperProfilePath = C:\HyperSpin\HyperLaunch\Profiles\ahk
				keymapperFrontEndProfileName = HyperSpin
				keymapperHyperLaunchProfileEnabled = false
				JoyIDsEnabled = false
				JoyIDsPreferredControllersSystem = use_global
				JoyIDsPreferredControllersGlobal = use_global
				CustomJoyNamesEnabled = false
				CustomJoyNames = 
				FEProfile = C:\HyperSpin\HyperLaunch\Profiles\ahk\HyperSpin
				defaultProfile = C:\HyperSpin\HyperLaunch\Profiles\ahk\_Default
				systemProfile = C:\HyperSpin\HyperLaunch\Profiles\ahk\MAME
				xPadderSystemProfile = C:\HyperSpin\HyperLaunch\Profiles\ahk\MAME\_Default
				emuProfile = C:\HyperSpin\HyperLaunch\Profiles\ahk\MAME\MAME
				romProfile = C:\HyperSpin\HyperLaunch\Profiles\ahk\MAME\1944
				blankProfile = C:\HyperSpin\HyperLaunch\Profiles\ahk\blank
				HyperLaunchProfile = C:\HyperSpin\HyperLaunch\Profiles\ahk\HyperLaunch
				bezelEnabled = false
				statisticsEnabled = true

16:59:57:613 | HL |     INFO  | +0     | BuildScript - Loaded XHotkey Init.ahk scripts
16:59:57:613 | HL |     INFO  | +0     | BuildScript - Loaded Statistics Init.ahk scripts
16:59:57:613 | HL |     INFO  | +0     | BuildScript - Loaded User Functions Init.ahk script
16:59:57:613 | HL |     INFO  | +0     | BuildScript - Module:
				MEmu = MAME
				MEmuV =  v0.148
				MURL = http://www.mame.net/
				MAuthor = djvj
				MVersion = 2.0.1
				MCRC = EEC5F04B
				iCRC = 8E4C99AB
				MID = 635038268903403479
				MSystem = "Cave","LaserDisc","MAME","Nintendo Arcade Systems","Sega Model 1","Sega ST-V","SNK Neo Geo","SNK Neo Geo AES"
				;----------------------------------------------------------------------------
				; Notes:
				; No need to edit mame.ini and set your rom folder, module sends the rompath for you.
				; Command Line Options - http://easyemu.mameworld.info/mameguide/mameguide-options.html
				; High Scores DO NOT SAVE when cheats are enabled!
				;----------------------------------------------------------------------------
				StartModule()
				FadeInStart()

				settingsFile := CheckFile(modulePath . "\" . moduleName . ".ini")

				Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
				Videomode := IniReadCheck(settingsFile, "Settings", "Videomode","d3d",,1)
				pauseMethod := IniReadCheck(settingsFile, "Settings", "PauseMethod",1,,1)	; set the pause method that works better on your machine (preferred methods 1 and 2) 1 = Win7 and Win8 OK - Problems with Win XP, 2 = preferred method for WinXP - Problems in Win7, 3 and 4 = same as 1 and 2, 5 = only use If you have a direct input version of mame, 6 = suspend mame process method, it could crash mame in some computers
				bezelMode := IniReadCheck(settingsFile, "Settings", "BezelMode","layout",,1)	; "layout" or "normal"
				cheatMode := IniReadCheck(settingsFile, "Settings", "CheatMode","false",,1)
				cheatModeKey := IniReadCheck(settingsFile, "Settings", "CheatModeKey",A_Space,,1)	; user defined key to be held down before launching a mame rom.
				sysParams := IniReadCheck(settingsFile, systemName, "Params", A_Space,,1)
				romParams := IniReadCheck(settingsFile, romName, "Params", A_Space,,1)
				mameRomName := IniReadCheck(settingsFile, romName, "MameRomName", A_Space,,1)

				If bezelEnabled = true
				{	ListXMLtable := []
					ListXMLtable := ListXMLInfo(romName)
				}
				If bezelMode = layout
				{	useBezels := If (bezelEnabled = "true") ? "-use_bezels" : "-nouse_bezels"
					useOverlays := If (bezelEnabled = "true") ? "-use_overlays" : "-nouse_overlays"
					useBackdrops := If (bezelEnabled = "true") ? "-use_backdrops" : "-nouse_backdrops"
					BezelStart(romName,ListXMLtable[1],ListXMLtable[2],ListXMLtable[3],ListXMLtable[4])
				} Else {
					useBezels := "-nouse_bezels"
					useOverlays := "-nouse_overlays"
					useBackdrops := "-nouse_backdrops"
					BezelStart(,,ListXMLtable[2])
				}

				; -romload part of 147u2 that shows what roms were checked when missing roms
				winstate := If (Fullscreen = "true") ? "Hide UseErrorLevel" : "UseErrorLevel"
				fullscreen := If (Fullscreen = "true") ? "-nowindow" : "-window"
				videomode := If (Videomode != "" ) ? "-video " . videomode : ""
				sysParams := If sysParams != ""  ? sysParams : ""
				romParams := If romParams != ""  ? romParams : ""

				StringReplace,mameRomPaths,romPathFromIni,|,`"`;`",1	; replace all instances of | to ; in the Rom_Path from Emulators.ini so mame knows where to find your roms
				mameRomPaths := "-rompath """ .  (If mameRomName ? romPath : mameRomPaths) . """"	; if using an alt rom, only supply mame with the path to that rom so it doesn't try to use the original rom

				If InStr(romParams,"-rompath")
					ScriptError("""-rompath"" is defined as a parameter for " . romName . ". The MAME module fills this automatically so please remove this from Params in the module's settings.")
				If InStr(sysParams,"-rompath")
					ScriptError("""-rompath"" is defined as a parameter for " . systemName . ". The MAME module fills this automatically so please remove this from Params in the module's settings.")

				If mameRomName {
					FileMove, %romPath%\%romName%%romExtension%, %romPath%\%mameRomName%%romExtension%	; rename rom to match what mame needs
					originalRomName := romName	; store romName from database so we know what to rename it back to later
					romName := mameRomName
					If ErrorLevel
						ScriptError("There was a problem renaming " . romName . "  to " . mameRomName . " in " . romPath . ". Please check you have write permission to this folder/file and you don't already have a file named """ . mameRomName . """ in your rom folder.",8)
					Else	; if rename was successful, set var so we know to move it back later
						fileRenamed = 1
				}

				If cheatMode = true
				{	If cheatModeKey {	; if user wants to use a key to enable CheatMode
						; cheatEnabled := 
						; cheatEnabled := If XHotkeyAllKeysPressed(cheatModeKey) ? "-cheat" : ""
						Loop 5
						{
							Sleep, 500
							cheatEnabled := XHotkeyAllKeysPressed(cheatModeKey)
							tooltip, Index: %A_Index%`ncheatEnabled: %cheatEnabled%
							Sleep, 500
						}
						msgbox cheatModeKey: %cheatModeKey%`n cheatEnabled: %cheatEnabled%
						ExitApp
					} Else	; no cheat mode key defined
						cheatEnabled := "-cheat"
				}

				Run(executable . A_Space . romName . A_Space . fullscreen . A_Space . cheatEnabled . A_Space . videomode . A_Space . useBezels . A_Space . useOverlays . A_Space . useBackdrops . A_Space . mameRomPaths . A_Space . sysParams . A_Space . romParams, emuPath, winstate)

				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 in 7,8,9
						Error = Identification Error
					Else
						Error = MAME Error
					ScriptError("MAME Error - " . Error)
				}

				WinWait("ahk_class MAME")
				WinWaitActive("ahk_class MAME")

				BezelDraw()
				FadeInExit()
				Process("WaitClose", executable)
				BezelExit()

				If fileRenamed {	; rename file back to alternate name for next launch
					FileMove, %romPath%\%romName%%romExtension%, %romPath%\%originalRomName%%romExtension%
					If ErrorLevel	; if rename was successful, set var so we know to move it back later
						ScriptError("There was a problem renaming " . romName . " back to " . originalRomName)
				}

				FadeOutExit()
				ExitModule()


				ListXMLInfo(rom){ ; returns MAME/MESS info about parent rom, orientation angle, resolution
					Global emuFullPath, emuPath
					ListXMLtable := []
					RunWait, % comspec . " /c " . """" . emuFullPath . """" . " -listxml " . rom . " > tempBezel.txt", %emuPath%, Hide
					Fileread, ListxmlContents, %emuPath%\tempBezel.txt
					RegExMatch(ListxmlContents, "s)<game.*name=" . """" . rom . """" . ".*" . "cloneof=" . """" . "[^""""]*", parent)
					RegExMatch(parent,"cloneof=" . """" . ".*", parent)
					RegExMatch(parent,"""" . ".*", parent)
					StringTrimLeft, parent, parent, 1
					RegExMatch(ListxmlContents, "s)<display.*rotate=" . """" . "[0-9]+" . """", angle)
					RegExMatch(angle,"[0-9]+", angle, "-6")
					RegExMatch(ListxmlContents, "s)<display.*width=" . """" . "[0-9]+" . """", width)
					RegExMatch(width,"[0-9]+", width, "-6")
					RegExMatch(ListxmlContents, "s)<display.*height=" . """" . "[0-9]+" . """", Height)
					RegExMatch(Height,"[0-9]+", Height, "-6")
					ListXMLtable[1] := parent
					ListXMLtable[2] := angle
					If (ListXMLtable[2]<>0)
						ListXMLtable[3] := height
					Else
						ListXMLtable[3] := width
					If (ListXMLtable[2]<>0)
						ListXMLtable[4] := width
					Else
						ListXMLtable[4] := height
					FileDelete, %emuPath%\tempBezel.txt
					Return ListXMLtable	
				}

				HaltEmu:
					If pauseMethod = 1
					{	disableSuspendEmu = true
						disableRestoreEmu = true
						PostMessage,0x211, 1, , , ahk_class MAME
					} Else If pauseMethod = 2
					{	disableSuspendEmu = true
						PostMessage,0x211, 1, , , ahk_class MAME
					} Else If pauseMethod = 3
					{	disableSuspendEmu = true
						disableRestoreEmu = true
						PostMessage,% 0x0400+6, 1, , , ahk_class MAME
					} Else If pauseMethod = 4
					{	disableSuspendEmu = true
						PostMessage,% 0x0400+6, 1, , , ahk_class MAME
					} Else If pauseMethod = 5
					{	disableSuspendEmu = true
						Send, {P down}
						Sleep, 1000
						Send, {P up} 
					}
				Return
				RestoreEmu:
					If pauseMethod = 1
					{	PostMessage,0x212, 1, , , ahk_class MAME
						WinActivate, ahk_class MAME
					} Else If pauseMethod = 2
					{	PostMessage,0x212, 1, , , ahk_class MAME
						WinActivate, ahk_class MAME
					} Else If pauseMethod = 3
					{	PostMessage,% 0x0400+6, 0, , , ahk_class MAME
						WinActivate, ahk_class MAME
					} Else If pauseMethod = 4
					{	PostMessage,% 0x0400+6, 0, , , ahk_class MAME
						WinActivate, ahk_class MAME
					} Else If pauseMethod = 5
					{	disableSuspendEmu = true
						Send, {P down}
						Sleep, 1000
						Send, {P up} 
						WinActivate, ahk_class MAME
					} Else If pauseMethod = 6
						WinActivate, ahk_class MAME
				Return

				CloseProcess:
					FadeOutStart()
					WinClose("ahk_class MAME")
				Return

16:59:57:616 | HL |     INFO  | +0     | BuildScript - Loaded Statistics.ahk script
16:59:57:616 | HL |     INFO  | +0     | BuildScript - Loaded User Functions.ahk script
16:59:57:616 | HL |     INFO  | +0     | BuildScript - Finished injecting functions into module
16:59:57:616 | HL |     INFO  | +0     | Main - Module is built
16:59:57:616 | HL |     INFO  | +0     | CheckFile - Checking if C:\HyperSpin\HyperLaunch\AutoHotkey.dll exists
16:59:57:625 | HL |     INFO  | +0     | Main - Hiding taskbar
16:59:57:840 | HL |     INFO  | +218   | Main - Hiding desktop
16:59:57:855 | HL |     INFO  | +16    | Main - Running module
17:00:05:906 | HL |     INFO  | +8049  | Main - Module ended, exiting HyperLaunch normally
17:00:05:906 | HL |     INFO  | +0     | ExitScript - Started
17:00:06:388 | HL |     INFO  | +484   | SystemCursor - Restoring mouse cursor
17:00:06:396 | HL |     INFO  | +15    | ExitScript - Ended

Posted

you will need something like:

StartGlobalUserFeatures(){
  Global emupath, romName
  Runwait, %emupath%\Rotation.exe "%romName%"
  return
}

and

StopGlobalUserFeatures(){
  Global emupath
  Runwait, %emupath%\Rotation.exe "reset"
  return
}

Be aware that this is a non tested code. Just try that and use tooltips to see if everything works as it should

Posted

It shows me the fade in loading screen with a tool tip thats shows "index:1" which counts up to "index:5", also in the tooltip is "cheatenabled:0". Once its counted to "index:5" it does nothing and I have to exit out.

  • 2 weeks later...
Posted
It shows me the fade in loading screen with a tool tip thats shows "index:1" which counts up to "index:5", also in the tooltip is "cheatenabled:0". Once its counted to "index:5" it does nothing and I have to exit out.

You sure you have the newest module because my mame was doing that and djvj had some debugging code enabled, the next day he fixed that.. It did exactly this until I updated...

Posted

I don't know how everybody else does, but if you take a look at the mame module, I wrote a function named ListXMLInfo that can give you the game orientation based on the listxml file that MAME creates.

ListXMLInfo(rom){ ; returns MAME/MESS info about parent rom, orientation angle, resolution

You could use the same function, by simply adding these lines to a ahk script.

ListXMLtable := []
ListXMLtable := ListXMLInfo(romName)
RotationAngle := ListXMLtable[2] 

Posted
You sure you have the newest module because my mame was doing that and djvj had some debugging code enabled, the next day he fixed that.. It did exactly this until I updated...

It works now :o

Cheers sandman

I just hope it wont affect my other systems as this code is global.

Edit

It affects other systems, back to the drawing board :(

Posted

just add a conditional to work only on the systems that you want.

something like:

StartGlobalUserFeatures(){
  Global emupath, romName, systemName
 if systemName="MAME"
     Runwait, %emupath%\Rotation.exe "%romName%"
  return
}

Posted
just add a conditional to work only on the systems that you want.

something like:

StartGlobalUserFeatures(){
  Global emupath, romName, systemName
 if systemName=[color="#FF0000"]"[/color]MAME[color="#FF0000"]"[/color]
     Runwait, %emupath%\Rotation.exe "%romName%"
  return
}

Just had to remove the quotation marks and it works :), thank you.

  • 10 months later...
Posted

I have combine the functions to handle the rotation of the monitor if there is a vertical rom selected within hyperspin MAME. I use the listXMLinfo function mentioned by Bleasby a couple of reply's above. In the logs its working very good. With this you do not have to make 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.

UPDATE: Added some logging to the roation.ahk and optimized the userFunctions to see all others then RotationAngle=0 as vertical

UPDATE: 06-21-14: fixed error on ListXMLinfo when launching emulator other then mame. Added %zz% wildcard trick to ListXMLinfo() function

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("############### START USERFUNCTIONS ##############")
Log("StartGlobalUserFeatures - Starting")

Global emupath, romName, systemName		

	If ( systemName = "MAME" ){

		ListMameTable := []
		ListMameTable := ListXMLInfo%zz%(romName)
		RotationAngle := ListMameTable[2]
		Rotation := 0 ;0 = horizontal

		Log("USER Function - Rotation:" . RotationAngle . " ROM:" . romName)

		If (RotationAngle != "0"){
			Rotation :=1	
			Log("USER Functions - Rotating Vertical")				
		}

		Runwait, %emupath%\Rotation.exe %Rotation%		
		Log("USER Functions - 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("############### STOP USERFUNCTIONS ##############")
Log("StopGlobalUserFeatures - Starting")	

Global emupath, systemName

If ( systemName = "MAME" )
{ 
	;REMARK below if you want to prevent turning back to horizontal state:
	RotHor := 0 
	Runwait, %emupath%\Rotation.exe %RotHor%		
	Log("USER Function - Rotation.exe back to horizontal")

	return
}			

Log("StopGlobalUserFeatures - Ending")	

}




It fires the rotation.exe (compiled ahk) in the hyperspin\emulators\mame\ mame*.exe root

if you want to turn the monitor back to horizontal position umremark the runwait in the StopGlobalUserFeatures function

The source for Rotation.exe/ahk that is fired by UserFunctions.ahk

;[Rotation.exe]
#SingleInstance force 

SetWorkingDir %A_ScriptDir%


;parsed value from UserFunctions.ahk
Rotation = %1%

;read Current state
iniread, state, %A_scriptdir%\Rotation.ini, Controls, PrevState 

If ( Rotation = 0)
{
iniwrite, "Selected horizontal game", %A_scriptdir%\Rotation.ini, log, rotlog 
goto horizontalRotation
} 
Else If (Rotation = 1)
{
iniwrite, "Selected Vertical game", %A_scriptdir%\Rotation.ini, log, rotlog 
goto verticalRotation
}



verticalRotation:

If ( state = 1) 
{
; Monitor already vertical position.
iniwrite, "vertical state was 1", %A_scriptdir%\Rotation.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%\Rotation.ini, controls, PrevState 
iniwrite, "vertical state was 0", %A_scriptdir%\Rotation.ini, log, loging 

exitapp

}



horizontalRotation:

If ( state = 0) 
{
; Monitor already horizontal position.
iniwrite, "horizontal state was 0", %A_scriptdir%\Rotation.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%\Rotation.ini, controls, PrevState 
iniwrite, "horizontal state was 1", %A_scriptdir%\Rotation.ini, log, loging 
exitapp
}






You also need a rotationstate.ini in the hyperspin\emulators\mame\ mame*.exe root to read/write the state the monitor is in ( vertical OR horizontal = 1 OR 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 which way the scree rotates.

set autoror to 1 if you want the screen to be displayed ClockWise.

set the autorol to 1 if you want to screen to be displayed CounterClockwise.

#

# CORE ROTATION OPTIONS

#

autoror 0

autorol 1

Please test or if you are an AHK guru please let me know how to improve the code.

  • 3 weeks later...
Posted

Finally had the time to let the above script do the work on my WIP slimline arcade build. I use a controller and motor from Pololu to turn the 24" LCD screen. The code works flawlessly and turning the monitor if a mame rom is vertical based, and turning back to horizontal when 'escaping' the emulator. So no need for vertical or horizontal lists anymore it is all auto-detecting. If you also do NEO-GEO in MAME it will turn those also,

With a little bit of code exploration I can probably turn the monitor for Taito Type X vertical games based on the same userfunction.ahk script. But probably need the TTX games manualy bases on the game name.

To make a long story short. It works!

Posted

For TTX and any other vertical games such as the naomi ones I have a simple script that rotates the screen before launching the game and another script that rotates the screen back on exit.

Posted
Are you willing to share? I want to know how to fire the rotate commands before and after TTX launches.

Rotate

run C:\HyperSpin\HyperLaunch\Module Extensions\iRotate.exe /1:rotate=180

run smccmd --resume --speed 2250,,Hide

Return

run C:\HyperSpin\HyperLaunch\Module Extensions\iRotate.exe /1:rotate=0 /exit


run smccmd --resume --speed -2250,,Hide

run C:\HyperSpin\HyperLaunch\Module Extensions\bring back focus.ahk

Bring back focus.ahk <-- Only required for raiden IV

Process, Exist, Hyperspin.exe
frontendPID := ErrorLevel
ControlClick, , ahk_pid %frontendPID%



sleep, 2000
MouseClick, left

The rotate.ahk would go in the Prelaunch box and return.ahk would go in the postexit box.

Posted

For everyone who struggles with this. I extended the /hyperlaunch/lib/user functions.ahk script for Taito Type X vertical games.

It now supports auto vertical detection for mame and TTX games (see previous post of mine)

Change /hyperlaunch/lib/user functions.ahk script to this:

; Use this function to define any code you want to run in every module on start
StartGlobalUserFeatures(){
Log("############### START USERFUNCTIONS ##############")
Log("StartGlobalUserFeatures - Starting")

Global emupath, romName, systemName, dbName, moduleExtensionsPath	

rotation:=0 ;0 = horizontal

Log("USER Function - System NAME:" . systemName)
Log("USER Function - ROM NAME:" . romName)
Log("USER Function - DB NAME:" . dbName)

If ( systemName = "MAME" ){

	Log("USER Function - MAME - ROM:" . romName)

	ListMameTable := []
	ListMameTable := ListXMLInfo%zz%(romName)
	RotationAngle := ListMameTable[2]

	Log("USER Function - Rotation:" . RotationAngle . " ROM:" . romName)

	If (RotationAngle != "0"){
		Rotation :=1	
		Log("USER Functions - Rotating Vertical")				
	}

	Runwait, %emupath%\Rotation.exe %Rotation%		
	Log("USER Functions - Rotation.exe Executed")			

} else if ( systemName = "SNK Neo Geo" ){

	Log("USER Function - NEOGEO - ROM:" . romName)

} else if ( systemName = "Taito Type X" ){

	Log("USER Function - TTX - ROM:" . romName)

	;Vertical game list:	
	if( romName = "Homura" || romName = "Shikigami no Shiro III" || "Raiden III" || "Raiden IV" ){

		Log("USER Function - TTX - Vertical switch:" . romName)

		Rotation:=1 			
		TTXRotation := moduleExtensionsPath . "\TTX-Rotation.ahk"
		RunWait, %TTXRotation% %Rotation% %romName%

	} 


}


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("############### STOP USERFUNCTIONS ##############")
Log("StopGlobalUserFeatures - Starting")

Global emupath, systemName, romName, dbName, moduleExtensionsPath

Rotation:=0

Log("USER Function - System NAME:" . systemName)
Log("USER Function - ROM NAME:" . romName)
Log("USER Function - DB NAME:" . dbName)

If ( systemName = "MAME" )
{ 
	;REMARK below if you want to prevent turning back to horizontal state:

	Runwait, %emupath%\Rotation.exe %Rotation%		
	Log("USER Function - Rotation.exe back to horizontal")



} else if ( systemName = "Taito Type X" ){

	Log("USER Function - Taito Type X- Return horizontal:" .dbName)		
	Rotation:=0 			
	TTXRotation := moduleExtensionsPath . "\TTX-Rotation.ahk"
	RunWait, %TTXRotation% %Rotation%


}	



Log("StopGlobalUserFeatures - Ending")	

}

Now add following script to the /hyperlaunch/module extensions/ directory:

TTX-Rotation.ahk


;[TTX-Rotation]
#SingleInstance force 
SetWorkingDir %A_ScriptDir%

;parsed value from UserFunctions.ahk
Rotation = %1%
TTXgame = %2%

iniwrite, %TTXgame%, %A_scriptdir%\ttxrotation.ini, ROTATION, Game
iniwrite, %Rotation%, %A_scriptdir%\ttxrotation.ini, ROTATION, Mode

If ( Rotation = 0)
{
goto horizontalRotation
} 
Else If (Rotation = 1)
{
goto verticalRotation
}

verticalRotation:

iniwrite, "switch vertical", %A_scriptdir%\ttxrotation.ini, ROTATION, Switch
; Rotate monitor to vertical position:
;Run, %COMSPEC% /c "smccmd --resume --speed -530", ,{enter},hide

;Or/And use iRotate:
Run %comspec% /c "irotate.exe /1:rotate=180 /exit"

exitapp



horizontalRotation:

iniwrite, "switch horizontal", %A_scriptdir%\ttxrotation.ini, ROTATION, Switch
; Rotate monitor to horizontal position:
;Run, %COMSPEC% /c "smccmd --resume --speed 520", ,{enter},hide

;Or/And use iRotate:
Run %comspec% /c "irotate.exe /1:rotate=0 /exit"
iniwrite, "switch horizontal", %A_scriptdir%\ttxrotation.ini, ROTATION, Switch

exitapp



I also added a ttxrotation.ini to log ttxrotation.ahk settings to, you can use it to hold a state if you want, or remark the initwrite lines if you do not want it

Place it in the /hyperlaunch/module extensions/ directory:

ttxrotation.ini

[PRELAUNCH]
Game=
Mode=0
Switch="switch horizontal"

Test and enjoy!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...