Advertisement
djvj

bgb

Jan 24th, 2016
708
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.06 KB | None | 0 0
  1. MEmu = Bgb
  2. MEmuV = v1.4.3
  3. MURL = http://bgb.bircd.org/
  4. MAuthor = djvj,ghutch92
  5. MVersion = 2.0.6
  6. MCRC = B399DD36
  7. iCRC = 6B31DD58
  8. mId = 635637123510883144
  9. MSystem = "Nintendo Game Boy","Nintendo Game Boy Color"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; Place the "[BIOS] Nintendo Game Boy Color Boot ROM (World).gbc" rom in the bgb dir so you get correct colors
  13. ; Run the emu, right click and goto Options->System->GBC Bootrom and paste in the filename of the GBC boot rom
  14. ; Don't forget to check the "bootroms enabled" box
  15. ; Module will automatically delete the width/height settings so BGB sizes correctly to your monitor when going fullscreen.
  16. ;----------------------------------------------------------------------------
  17. StartModule()
  18. BezelGUI()
  19.  
  20. settingsFile := modulePath . "\" . systemName . ".ini"
  21. If !FileExist(settingsFile)
  22. settingsFile := modulePath . "\" . moduleName . ".ini"
  23.  
  24. SplitScreen2PlayersMode := IniReadCheck(settingsFile, "Settings", "SplitScreen_2_Players","Vertical",,1) ;horizontal or vertical
  25. SplitScreen3PlayersMode := IniReadCheck(settingsFile, "Settings", "SplitScreen_3_Players","P1top",,1) ; For Player1 screen to be on left: P1left. For Player1 screen to be on top: P1top. For Player1 screen to be on bottom: P1bottom. For Player1 screen to be on right: P1right.
  26.  
  27. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  28. SGBColorsEnabled := IniReadCheck(settingsFile, "Settings", "SGB_Colors_Enabled","false",,1) ; if enabled some game boy games will have color instead of being black and white
  29. SGBBorderEnabled := IniReadCheck(settingsFile, "Settings", "SGB_Border_Enabled","false",,1) ; if enabled some game boy games will have the border that the SGB used for tv screens
  30. multiplayerMenu := IniReadCheck(settingsFile, "Settings|" . romName, "Multiplayer_Menu","false",,1)
  31.  
  32. If (multiplayerMenu = "true")
  33. SelectedNumberofPlayers := NumberOfPlayersSelectionMenu(4)
  34.  
  35. FadeInStart()
  36.  
  37. If (SelectedNumberofPlayers > 1)
  38. BezelStart(SelectedNumberofPlayers)
  39. Else
  40. BezelStart()
  41.  
  42. ; Using commandline -setting name=value to set emulator options
  43.  
  44. ; This disables Esc from bringing up the debug window (bgb's default behavior). If it's on, pressing Esc brings up debug, rather then closing the emu
  45. parameters := " -setting DebugEsc=0"
  46. ;disables or enables Super Game Boy Colors for the Game Boy (DMG)
  47. parameters := (SGBColorsEnabled = "true") ? (parameters . " -setting SGBnocolors=0") : (parameters . " -setting SGBnocolors=1")
  48. ;disables or enables Super Game Boy Border for the Game Boy (DMG)
  49. parameters := (SGBBorderEnabled = "true") ? (parameters . " -setting Border=1") : (parameters . " -setting Border=0")
  50.  
  51. hideEmuObj := Object("ahk_class OS95",1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  52. 7z(romPath, romName, romExtension, sevenZExtractPath)
  53.  
  54. HideEmuStart()
  55. If (SelectedNumberofPlayers = 1 || multiplayerMenu = "false") {
  56. If (Fullscreen = "true") {
  57. ; Width/Height values must be blank so BGB sizes correctly to the monitor when going fullscreen because it has no proper aspect ratio control.
  58. bgbIniFile := emuPath . "\bgb.ini"
  59. bgbIni := LoadProperties(bgbIniFile) ; load the ini into memory
  60. WriteProperty(bgbIni,"Width","") ; delete value
  61. WriteProperty(bgbIni,"Height","")
  62. SaveProperties(bgbIniFile,bgbIni) ; save changes
  63. }
  64.  
  65. parameters .= " -setting Windowmode=1"
  66. Run(executable . parameters . " """ . romPath . "\" . romName . romExtension . """",emuPath)
  67. WinWait("bgb ahk_class Tfgb")
  68. WinWaitActive("bgb ahk_class Tfgb")
  69. If (Fullscreen = "true") {
  70. Log("Module - Creating black background to simulate a fullscreen look.")
  71. MaximizeWindow("bgb ahk_class Tfgb") ; bgb always stretches when telling it to go fullscreen so module handles it instead
  72. WinSet, AlwaysOnTop, On, bgb ahk_class Tfgb ; forces emu to always remain above the background
  73. Gui bgbGUI: -AlwaysOnTop -Caption +ToolWindow
  74. Gui bgbGUI: Color, Black
  75. Gui bgbGUI: Show, x0 y0 h%A_ScreenHeight% w%A_ScreenWidth%
  76. WinActivate % "bgb ahk_class Tfgb"
  77. }
  78. } Else {
  79. ;screen positions
  80. If (SelectedNumberofPlayers = 2)
  81. If (SplitScreen2PlayersMode = "Vertical")
  82. X1 := 0 , Y1 := 0 , W1 := A_ScreenWidth//2 , H1 := A_ScreenHeight , X2 := A_ScreenWidth//2 , Y2 := 0 , W2 := A_ScreenWidth//2 , H2 := A_ScreenHeight
  83. Else
  84. X1 := 0 , Y1 := 0 , W1 := A_ScreenWidth , H1 := A_ScreenHeight//2 , X2 := 0 , Y2 := A_ScreenHeight//2 , W2 := A_ScreenWidth , H2 := A_ScreenHeight//2
  85. Else If (SelectedNumberofPlayers = 3)
  86. If (SplitScreen3PlayersMode = "P1left")
  87. X1 := 0 , Y1 := 0 , W1 := A_ScreenWidth//2 , H1 := A_ScreenHeight , X2 := A_ScreenWidth//2 , Y2 := 0 , W2 := A_ScreenWidth//2 , H2 := A_ScreenHeight//2 , X3 := A_ScreenWidth//2 , Y3 := A_ScreenHeight//2 , W3 := A_ScreenWidth//2 , H3 := A_ScreenHeight//2
  88. Else If (SplitScreen3PlayersMode = "P1bottom")
  89. X1 := 0 , Y1 := A_ScreenHeight//2 , W1 := A_ScreenWidth , H1 := A_ScreenHeight//2 , X2 := 0 , Y2 := 0 , W2 := A_ScreenWidth//2 , H2 := A_ScreenHeight//2 , X3 := A_ScreenWidth//2 , Y3 := 0 , W3 := A_ScreenWidth//2 , H3 := A_ScreenHeight//2
  90. Else If (SplitScreen3PlayersMode = "P1right")
  91. X1 := A_ScreenWidth//2 , Y1 := 0 , W1 := A_ScreenWidth//2 , H1 := A_ScreenHeight , X2 := 0 , Y2 := 0 , W2 := A_ScreenWidth//2 , H2 := A_ScreenHeight//2 , X3 := 0 , Y3 := A_ScreenHeight//2 , W3 := A_ScreenWidth//2 , H3 := A_ScreenHeight//2
  92. Else ; top
  93. X1 := 0 , Y1 := 0 , W1 := A_ScreenWidth , H1 := A_ScreenHeight//2, X2 := 0 , Y2 := A_ScreenHeight//2 , W2 := A_ScreenWidth//2 , H2 := A_ScreenHeight//2, X3 := A_ScreenWidth//2 , Y3 := A_ScreenHeight//2 , W3 := A_ScreenWidth//2 , H3 := A_ScreenHeight//2
  94. Else
  95. X1 := 0 , Y1 := 0 , W1 := A_ScreenWidth//2 , H1 := A_ScreenHeight//2 , X2 := A_ScreenWidth//2 , Y2 := 0 , W2 := A_ScreenWidth//2 , H2 := A_ScreenHeight//2 , X3 := 0 , Y3 := A_ScreenHeight//2 , W3 := A_ScreenWidth//2 , H3 := A_ScreenHeight//2 , X4 := A_ScreenWidth//2 , Y4 := A_ScreenHeight//2 , W4 := A_ScreenWidth//2 , H4 := A_ScreenHeight//2
  96.  
  97. ;removing fullscreen ## only app with focus receives input. This means player 1 can't control player 2's game. ## Turning on remotejoy so player 2 can actually play
  98. parameters .= " -setting Windowmode=1 -setting JoyFocus=1 -setting RemoteJoy=1"
  99.  
  100. Address := "127.0.0.1" ;local address
  101. Port := 8765 ;default port
  102.  
  103. Loop % SelectedNumberofPlayers
  104. {
  105.  
  106. parameters .= " " . (If (A_Index = 1) ? "-listen" : "-connect") . " " . address . ":" . port
  107.  
  108. multi_romName := gamesSelectedArray[A_Index]
  109. If !multi_romName
  110. multi_romName := romName
  111.  
  112. Run(executable . parameters . " """ . romPath . "\" . multi_romName . romExtension . """",emuPath,, Screen%A_Index%PID)
  113. WinWait("ahk_pid " . Screen%A_Index%PID)
  114. WinGet, Screen%A_Index%ID, ID, % "ahk_pid " . Screen%A_Index%PID
  115. If Fullscreen = true
  116. { WinSet, Style, -0xC00000, % "ahk_id " . Screen%A_Index%ID
  117. ToggleMenu(Screen%A_Index%ID)
  118. WinSet, Style, -0xC40000, % "ahk_id " . Screen%A_Index%ID
  119. currentScreen := a_index
  120. WinMove, % "ahk_id " . Screen%currentScreen%ID, , % X%currentScreen%, % Y%currentScreen%, % W%currentScreen%, % H%currentScreen%
  121. ;check If window moved
  122. timeout := A_TickCount
  123. Loop
  124. { WinGetPos, X, Y, W, H, % "ahk_id " . Screen%currentScreen%ID
  125. If (X=X%currentScreen%) and (Y=Y%currentScreen%) and (W=W%currentScreen%) and (H=H%currentScreen%)
  126. Break
  127. If (timeout<A_TickCount-2000)
  128. Break
  129. Sleep, 50
  130. WinMove, % "ahk_id " . Screen%currentScreen%ID, , % X%currentScreen%, % Y%currentScreen%, % W%currentScreen%, % H%currentScreen%
  131. }
  132. }
  133. Sleep, 50
  134. }
  135. }
  136.  
  137. BezelDraw()
  138. HideEmuEnd()
  139. FadeInExit()
  140. Process("WaitClose", executable)
  141.  
  142. If (fullscreen = "true")
  143. { Gui bgbGUI: Destroy
  144. Log("Module - Destroyed black gui background.")
  145. }
  146.  
  147. 7zCleanUp()
  148. BezelExit()
  149. FadeOutExit()
  150. ExitModule()
  151.  
  152.  
  153. CloseProcess:
  154. FadeOutStart()
  155. If (SelectedNumberofPlayers > 1) {
  156. Loop, %SelectedNumberofPlayers%
  157. { WinClose("ahk_id " . Screen%a_index%ID)
  158. WinWaitClose("ahk_id " . Screen%a_index%ID)
  159. }
  160. } Else
  161. WinClose("ahk_class Tfgb")
  162. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement