Advertisement
djvj

Untitled

Jan 20th, 2015
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.71 KB | None | 0 0
  1. MEmu = OpenBOR
  2. MEmuV = N/A
  3. MURL = http://sourceforge.net/projects/openbor/
  4. MAuthor = djvj
  5. MVersion = 2.0.1
  6. MCRC = F9760EF7
  7. iCRC = 42F15B8B
  8. MID = 635038268911600315
  9. MSystem = "OpenBOR"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; If you keep your games archived, you need to at least set Skip Checks to Rom Extension because there is no rom extension like a normal rom would have.
  13. ; If you don't use a dummy executable as your OpenBOR emulator for this module, you need to set Skip Checks to Rom and Emu because these are technically PC games and have a unique exe for each game.
  14. ; Default location to launch the games will be in your romPath with a subfolder for each game (named after the rom in your database).
  15. ; In each game's folder, should contain an OpenBOR.exe
  16.  
  17. ; If you don't want to use the above path/exe, change the rom's module settings in HLHQ and define a path for each game.
  18. ; Place each game you have in it using the example below. gamePath should start from your romPath and end with the exe to the game.
  19. ; The rom settings should contain an entry for each game, pointing to the OpenBOR.exe
  20. ; Example:
  21. ;
  22. ; [Battle Toads]
  23. ; gamePath = Battle Toads\OpenBOR.exe
  24. ; [MegaMan - War of the Past]
  25. ; gamePath = MegaMan - War of the Past\OpenBOR.exe
  26. ;
  27. ; If you don't use SkipChecks, the defined emulator for OpenBOR needs to point to a dummy exe, like Dummy.exe.
  28. ; Also your Rom Path needs to point to the folder with all blank txt files.
  29. ; Escape will only close the game from the main menu, it is needed for in-game menu usage otherwise. Using Escape as your HyperLaunch exit key is not advised as it is needed for in-game usage.
  30. ; Controls are done via in-game options for each game. To speed up configuring of games, configure one game then save its settings to a default.cfg and paste it into each game's Saves folder.
  31. ; Then in the next game, goto Options->System Options->Config Settings->Load settings from default.cfg
  32. ; Larger games are inherently slower to load, this is OpenBOR, nothing you can do about it but get a faster HDD.
  33. ; To use bezels or have the module control fullscreen, make sure a %romName%.cfg file exists in the Saves folder for each game.
  34. ; Example:
  35. ; C:\Games\OpenBOR\Battle Toads\Saves\Battle Toads.cfg
  36. ;----------------------------------------------------------------------------
  37. StartModule()
  38. BezelGUI()
  39. FadeInStart()
  40.  
  41. settingsFile := modulePath . "\" . moduleName . ".ini"
  42. fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  43. remapWinKeys := IniReadCheck(settingsFile, "Settings", "remapWinKeys","true",,1) ; This remaps windows Start keys to Return to prevent accidental leaving of game
  44. altExitKey := IniReadCheck(settingsFile, "Settings|" . romName, "Alternate_Exit_Key",,,1)
  45. gamePath := IniReadCheck(settingsFile, romName, "gamePath",,,1)
  46.  
  47. BezelStart("FixResMode")
  48.  
  49. hideEmuObj := Object("OpenBOR ahk_class SDL_app",1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  50. 7z(romPath, romName, romExtension, 7zExtractPath,,,1) ; allowing larger sized folders on 7zExtractPath
  51.  
  52. If FileExist(romPath . "\" . gamePath) && (gamePath && gamePath != "ERROR") {
  53. Log("Module - Found OpenBOR.exe using your defined gamePath setting in: " . romPath . "\" . gamePath)
  54. gamePath := romPath . "\" . gamePath
  55. } Else If FileExist(romPath . "\" . romName . "\OpenBOR.exe") {
  56. Log("Module - Found OpenBOR.exe using in: " . romPath . "\" . romName . "\OpenBOR.exe")
  57. gamePath := romPath . "\" . romName . "\OpenBOR.exe"
  58. } Else If FileExist(romPath . "\OpenBOR.exe") {
  59. Log("Module - Found OpenBOR.exe using in: " . romPath . "\OpenBOR.exe")
  60. gamePath := romPath . "\OpenBOR.exe"
  61. } Else
  62. ScriptError("Could not find " . gamePath . "`nPlease place your game in its own folder in your Rom_Path or define a custom gamePath in HLHQ's module setting for OpenBOR")
  63.  
  64. SplitPath, gamePath, gExe, gPath
  65.  
  66. ; This remaps windows Start keys to Return to prevent accidental leaving of game
  67. If remapWinKeys = true
  68. { Hotkey, RWin, WinRemap
  69. Hotkey, LWin, WinRemap
  70. }
  71.  
  72. ; Update fullscreen setting
  73. gameSaveCFG := gPath . "\Saves\" . romName . ".cfg"
  74. backupGameSaveCFG := gPath . "\Saves\" . romName . ".cfg.bak"
  75. If FileExist(gameSaveCFG) {
  76. If !FileExist(backupGameSaveCFG) ; make a backup just in case the next operation messes up the cfg
  77. FileCopy, %gameSaveCFG%, %backupGameSaveCFG%
  78. res := BinRead(gameSaveCFG,gameSaveData,1,235) ; read current fullscreen setting
  79. Bin2Hex(hexData,gameSaveData,res)
  80. If (fullscreen = "true" && hexData != "01")
  81. Hex2Bin(binData,"01"),BinWrite(gameSaveCFG,binData,1,235)
  82. Else If (fullscreen != "true" && hexData != "00")
  83. Hex2Bin(binData,"00"),BinWrite(gameSaveCFG,binData,1,235)
  84. }
  85.  
  86. HideEmuStart() ; This fully ensures windows are completely hidden even faster than winwait
  87.  
  88. Run(gExe, gPath, "UseErrorLevel", game_PID)
  89. If ErrorLevel
  90. ScriptError("Failed to launch " . romName)
  91.  
  92. WinWait("ahk_pid " . game_PID)
  93. WinWaitActive("ahk_pid " . game_PID)
  94.  
  95. WinGetTitle, gameTitle, ahk_pid %game_PID%
  96.  
  97. BezelDraw()
  98. HideEmuEnd()
  99. FadeInExit()
  100.  
  101. If altExitKey {
  102. Log("Module - Using a custom Exit_Emulator_Key for this session: """ . altExitKey . """")
  103. XHotKeywrapper(exitEmulatorKey,"CloseProcess","OFF")
  104. altExitKey := xHotKeyVarEdit(altExitKey,"CloseProcess","~","Add")
  105. XHotKeywrapper(altExitKey,"CloseProcess", "ON")
  106. }
  107.  
  108. Process("WaitClose", game_PID)
  109.  
  110. Process("Close", executable) ;on some machines/games, openbor doesn't close itself properly, this is the work around to make sure it does
  111.  
  112. 7zCleanUp()
  113. BezelExit()
  114. FadeOutExit()
  115. ExitModule()
  116.  
  117.  
  118. WinRemap:
  119. Return
  120.  
  121. CloseProcess:
  122. FadeOutStart()
  123. WinClose(gameTitle . " ahk_pid " . game_PID)
  124. ; WinClose("OpenBOR ahk_class SDL_app")
  125. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement