About This File
Under messui, go to the Options, Directories... tab, under Show directories; ROMs, add by clicking on Insert the folder containing your games and bios, the detection is carried out Put the studio2.zip and the studio2.xml from the ROMs subfolder studio2 in the hash folder Once in game activate scroll lock (Fn and K) then press the TAB key, go to Input (this machine) and reassign the keys necessary for the smooth running of the game
MEmu := "MESS"
MEmuV := "0.195"
MURL := ["http://www.mess.org/"]
MAuthor := ["djvj","faahrev","brolly","Tomkun"]
MVersion := ""
MCRC := ""
iCRC := ""
MID := ""
MSystem := ["RCA Studio II"]
RCA Studio II - studio2
StartModule()
BezelGUI()
FadeInStart()
; This object controls how the module reacts to different systems. MESS can play a lot of systems, but needs to know what system you want to run, so this module has to adapt.
mTypeVar=
RCA Studio II|studio2
)
mType := Object()
Loop, Parse, mTypeVar, `n, `r
{
obj := {}
Loop, Parse, A_LoopField, |
If A_Index = 1
obj.System := A_LoopField
Else ; 2
obj.MessID := A_LoopField
mType.Insert(obj["System"], obj)
}
Log("Module - Finished building the " . MEmu . " object",4)
; For easier use throughout the module
messSystem := mType[systemName].System
messID := mType[systemName].MessID
If !messSystem
ScriptError("Your systemName is: " . systemName . "`nIt is not one of the known supported systems for this " . MEmu . " module.")
settingsFile := modulePath . "\" . moduleName . ".ini"
Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1) ; Set fullscreen mode
messBiosPath := IniReadCheck(settingsFile, "Settings", "MESS_BIOS_Path", emuPath . "\roms",,1)
Videomode := IniReadCheck(settingsFile, "Settings", "Videomode","d3d",,1) ; Choices are gdi,ddraw,d3d. If left blank, mess uses d3d by default
hlsl := IniReadCheck(settingsFile, "Settings|" . messSystem . "|" . romName, "HLSL","false",,1)
glsl := IniReadCheck(settingsFile, "Settings|" . messSystem . "|" . romName, "GLSL","false",,1)
bezelMode := IniReadCheck(settingsFile, "Settings", "BezelMode","normal",,1) ; "layout" or "normal"
UseSoftwareList := IniReadCheck(settingsFile, messSystem, "UseSoftwareList","false",,1)
sysStaticParams := IniReadCheck(settingsFile, messSystem, "StaticParameters", A_Space,,1)
sysParams := IniReadCheck(settingsFile, messSystem, "Parameters", A_Space,,1)
romParams := IniReadCheck(settingsFile, romName, "Parameters", sysParams,,1)
Artwork_Crop := IniReadCheck(settingsFile, messSystem . "|" . romName, "Artwork_Crop", "true",,1)
Use_Bezels := IniReadCheck(settingsFile, messSystem . "|" . romName, "Use_Bezels", "true",,1)
Use_Overlays := IniReadCheck(settingsFile, messSystem . "|" . romName, "Use_Overlays", "true",,1)
Use_Backdrops := IniReadCheck(settingsFile, messSystem . "|" . romName, "Use_Backdrops", "true",,1)
messBiosPath := GetFullName(messBiosPath)
;Read settings from system name ini file
sysSettingsFile := modulePath . "\" . messSystem . ".ini"
IfExist, %sysSettingsFile%
{
romParams := IniReadCheck(sysSettingsFile, romName, "Parameters", romParams,,1)
hlsl := IniReadCheck(sysSettingsFile, romName, "HLSL",hlsl,,1)
glsl := IniReadCheck(sysSettingsFile, romName, "GLSL",glsl,,1)
Artwork_Crop := IniReadCheck(sysSettingsFile, romName, "Artwork_Crop", Artwork_Crop,,1)
Use_Bezels := IniReadCheck(sysSettingsFile, romName, "Use_Bezels", Use_Bezels,,1)
Use_Overlays := IniReadCheck(sysSettingsFile, romName, "Use_Overlays", Use_Overlays,,1)
Use_Backdrops := IniReadCheck(sysSettingsFile, romName, "Use_Backdrops", Use_Backdrops,,1)
}
artworkCrop := If (Artwork_Crop = "true") ? " -artwork_crop" : " -noartwork_crop"
useBezels := If (Use_Bezels = "true") ? " -use_bezels" : " -nouse_bezels"
useOverlays := If (Use_Overlays = "true") ? " -use_overlays" : " -nouse_overlays"
useBackdrops := If (Use_Backdrops = "true") ? " -use_backdrops" : " -nouse_backdrops"
; Get MESS version from executable, this is needed since some CLI switches are not available in older MESS versions
exeAtrib := FileGetVersionInfo_AW( EmuPath . "\" . executable, "FileVersion|ProductVersion", "|" )
Loop, Parse, exeAtrib, |%A_Tab%, %A_Space%
A_Index & 1 ? ( _ := A_LoopField ) : ( %_% := A_LoopField )
If (ProductVersion)
StringRight, MESSVersion, ProductVersion, StrLen(ProductVersion) - 2
Log("Detected MESS Product Version from '" . EmuPath . "\" . executable . "' is " . MESSVersion)
hideEmuObj := Object(dialogOpen . " ahk_class ConsoleWindowClass",0,"ahk_class MAME",1) ;Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
If bezelEnabled = true
BezelStart()
7z(romPath, romName, romExtension, 7zExtractPath)
winstate := If (Fullscreen = "true") ? "Hide UseErrorLevel" : "UseErrorLevel"
fullscreen := If (Fullscreen = "true") ? " -nowindow" : " -window"
If (Videomode = "opengl")
{
hlsl := " -nohlsl_enable"
If (MESSVersion > 159)
glsl := If glsl = "true" ? " -gl_glsl" : (If glsl = "ini" ? "" : " -nogl_glsl")
Else
glsl := ""
}
Else
{
hlsl := If hlsl = "true" ? " -hlsl_enable" : (If hlsl = "ini" ? "" : " -nohlsl_enable")
If (MESSVersion > 159)
glsl := If Videomode = "ini" ? "" : " -nogl_glsl"
Else
glsl := ""
If (Videomode = "ini")
Videomode := ""
}
videomode := If (Videomode != "" )? " -video " . videomode : ""
param1 := " -cart """ . romPath . "\" . romName . romExtension . """" ; default param1 used for launching most systems.
If romExtension = .txt ; This can be applied to all systems
param1:=
param1 := " -cdrm """ . romPath . "\" . romName . romExtension . """"
}Else If messID = studio2 ; RCA Studio II
{ If romExtension != .asm
param1 := " -cart1 """ . romPath . "\" . romName . romExtension . """"
sysStaticParams := If sysStaticParams != "" ? A_Space . sysStaticParams : "" ; tacking on a space in case user forgot to add one
romParams := If romParams != "" ? A_Space . romParams : "" ; tacking on a space in case user forgot to add one
StringReplace,messRomPaths,romPathFromIni,|,`"`;`",1 ; replace all instances of | to ; in the Rom_Path from RL's Emulators.ini so mess knows where to find your roms
messRomPaths := " -rompath """ . messRomPaths . (If messBiosPath ? ";" . messBiosPath : "") . """" ; if a bios path was supplied, add it into the rom paths sent to mess
If InStr(romParams,"-rompath")
ScriptError("""-rompath"" is defined as a parameter for " . romName . ". The MESS module fills this automatically so please remove this from Params in the module's settings.")
If InStr(sysStaticParams,"-rompath")
ScriptError("""-rompath"" is defined as a parameter for " . messSystem . ". The MESS module fills this automatically so please remove this from Params in the module's settings.")
; use a custom cfg file if it exists and append it to param1
IfExist, % emuPath . "\cfg\" . messID . "\" . dbName
param1 := " -cfg_directory " . """" . emuPath . "\cfg\" . messID . "\" . dbName . """" . param1
HideEmuStart()
errLvl := Run(executable . A_Space . messID . param1 . param2 . param3 . param4 . param5 . param6 . messRomPaths . sysStaticParams . romParams . fullscreen . hlsl . glsl . videomode . artworkCrop . useBezels . useOverlays . useBackdrops . " -skip_gameinfo", emuPath, winstate)
If errLvl {
If (errLvl = 1)
Error = Failed Validity
Else If(errLvl = 2)
Error = Missing Files
Else If(errLvl = 3)
Error = Fatal Error
Else If(errLvl = 4)
Error = Device Error
Else If(errLvl = 5)
Error = Game Does Not Exist
Else If(errLvl = 6)
Error = Invalid Config
Else If errLvl in 7,8,9
Error = Identification Error
Else
Error = MESS Error
Log("MESS Error - " . Error,3)
}
WinWait("ahk_class MAME")
WinWaitActive("ahk_class MAME")
BezelDraw()
If romName = ICBMromName ; for Bally Astrocade only
{ Sleep, 2000 ; increase if you don't see the title screen
SetKeyDelay(50)
Send, {F3 down}{F3 up} ; sends a reset to MESS, needed for ICBM to boot
}
HideEmuEnd()
FadeInExit()
Process("WaitClose", executable)
7zCleanUp()
BezelExit()
FadeOutExit()
ExitModule()
; This will simply create a new blank ini if one does not exist
CheckFileMESS(file){
IfNotExist, %file%
FileAppend,, %file%
Return file
}
ListXMLInfo(rom){ ; returns MAME/MESS info about parent rom, orientation angle, resolution
Global emuFullPath, emuPath
ListXMLtable := []
Log("Module - RunWait`, " . comspec . " /c " . """" . emuFullPath . """" . " -listxml " . rom . " > tempBezel.txt`, " . emuPath . "`, Hide")
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
ListXMLtable[3] := height
ListXMLtable[4] := width
If (ListXMLtable[3] > ListXMLtable[4])
ListXMLtable[2] := true
FileDelete, %emuPath%\tempBezel.txt
Return ListXMLtable
}
BezelLabel:
WinSet, Transparent, 0, ahk_class ConsoleWindowClass
Return
CloseProcess:
FadeOutStart()
WinClose("ahk_class MAME")
Return