Advertisement
Guest User

Dolphin w/ dolphinbar

a guest
Oct 24th, 2015
433
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.81 KB | None | 0 0
  1. MEmu = Dolphin
  2. MEmuV = v4.0 r6928
  3. MURL = https://dolphin-emu.org/
  4. MAuthor = djvj & bleasby
  5. MVersion = 2.1.2
  6. MCRC = ABBCC8CC
  7. iCRC = C6A0A085
  8. MID = 635038268884477733
  9. MSystem = "Nintendo Gamecube","Nintendo Wii","Nintendo WiiWare"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; Be sure you are running at least Dolphin v4.0 or greater.
  13. ; If you get an error that you are missing a vcomp100.dll, install Visual C++ 2010: http://www.microsoft.com/download/en/details.aspx?id=14632
  14. ; Also make sure you are running latest directx: http://www.microsoft.com/downloads/details.aspx?FamilyID=2da43d38-db71-4c1b-bc6a-9b6652cd92a3
  15. ; Dolphin will sometimes crash when connnecting a Wiimote, then going back to the game. After all Wiimotes are connected that you want to use, it shouldn't have anymore issues.
  16. ; Convert all your games to ciso using Wii Backup Manager to save alot of space by stripping everything but the game partition. http://www.wiibackupmanager.tk/
  17. ; If you want to keep your Dolphin.ini in the emu folder, create a "portable.txt" file in MyDocuments\Dolphin Emulator\
  18. ;
  19. ; Bezels:
  20. ; If the game does not fit the window, you can try setting stretch to window manually in dolphin.
  21. ;
  22. ; Setting up custom Wiimote or GCPad profiles:
  23. ; First set UseCustomWiimoteProfiles or UseCustomGCpadProfiles to true in RocketLauncherUI for this module
  24. ; Launch Dolphin manually and goto Options->(Wiimote or Gamecube Pad) Settings and configure all your controls how you want your default setup to look like. This will be used for all games that you don't set a custom profile for. No need to save any profiles.
  25. ; All your controls are stored in WiimoteNew.ini or GCPadNew.ini and get copied to a _Default_(WiimoteNew or GCPadNew).ini on first launch. This ini contains all the controls for all 4 controllers.
  26. ; Do not confuse this with Dolphin's built-in profiles as those only contain info for only one controller. The (WiimoteNew or GCPadNew).ini and all the profiles RocketLauncher uses contain info for all controllers in one file.
  27. ; This new profile now called _Default_(WiimoteNew or GCPadNew).ini will be found in Dolphins settings folder: \Config\Profiles\(Wiimote or GCPad) (RL)\Default.ini
  28. ; For each game or custom control sets you want to use, edit the controls for all the controllers to work for that game and exit Dolphin. Now copy the (WiimoteNew or GCPadNew).ini to the "(Wiimote or GCPad) (RL)" folder and name it whatever you like.
  29. ; In RocketLauncherUI's module settings for Dolphin, Click the Rom Settings tab and add each game from your xml you want to use a this custom profile for.
  30. ; Now for all those games you added, make sure the Profile setting it set to the custom profile you want to load when that game is launched.
  31. ; Any game not added will use the "_Default_(WiimoteNew or GCPadNew).ini" profile RocketLauncher makes on first launch.
  32. ;
  33. ; To Pair a Wiimote:
  34. ; Highly suggest getting a Mayflash DolphinBar as it makes pairing and using wiimotes as easy as with a real Wii: http://www.amazon.com/TOTALCONSOLE-W010-Wireless-Sensor-DolphinBar/dp/B00HZWEB74
  35. ; If using the DolphinBar, just make sure Dolphin is set to continuously scan for wiimotes and set controls to use real wiimotes for as many wiimotes you have.
  36. ; You do not need to pair the wiimote with the PC first as you would with a standard blueooth and wiimote.
  37. ; DolphinBar should be on Mode 4. Wiimotes don't get paired until after Dolphin is running, not before!!
  38. ; After Dolphin is running, press 1+2 on each wiimote and after a few moments, the wiimote will pair and vibrate and one led will lock solid. Do this for each wiimote. That's it!
  39. ;
  40. ; If using a standard LED Bar:
  41. ; Make sure all your wiimotes have already been paired with your PC's bluetooth adapter
  42. ; All 4 leds on the wiimote should be flashing
  43. ; Press your Refresh key (set in RocketLauncherUI for this module) or enable continuous scanning in Dolphin
  44. ; Press 1 + 2 on the wiimote and one led should go solid designating the player number
  45. ;
  46. ; Netplay:
  47. ; If you're using a GameCube game with saves, synchronize your memory cards, Wii NAND needs to be synchronized, and some settings (such as CPU Clock Override) must be either synchronized or disabled.
  48. ; Because netplay may require different settings than you would normally use with local play, the module will look for any inis in your Dolphin user config folder ending with "_netplay" and use those configs instead of your normal ones.
  49. ; So for example, after you tweak all your dolphin settings for netplay, copy your dolphin.ini to dolphin_netplay.ini in the same folder.
  50. ; When the module launches and you choose multiplayer from RocketLauncher on screen menu, the module will backup dolphin.ini and copy dolphin_network.ini to dolphin.IniDelete
  51. ; On exit, the module will restore your backed up dolphin.ini and any other ini files in this folder (and all subfolders) that had the "_netplay" in the name.
  52. ; Guide on tweaking performance for netplay: https://dolphin-emu.org/docs/guides/netplay-guide/
  53. ; Another guide: https://docs.google.com/document/d/1CIkBAGcf_-kBUa4urn4KUj2U4UA6y_2a7stXJz85yiE/
  54. ;
  55. ; Linking a GameCube game with VBA-M
  56. ; Game tested: Legend of Zelda, The - Four Swords Adventures (USA)
  57. ; VBA-M emulator tested: visualboyadvance-m2.0.0Beta1
  58. ; dolphin emulator tested: dolphin-master-4.0-6725-x64
  59. ; On RocketLaunchUI, dolphin, GameCube Module settings set your VBA-M executable and VBA Bios file path on the VBALink tab.
  60. ; On RocketLaunchUI, dolphin, GameCube, Game name Module Settings enable VBA Link
  61. ; If your Game Boy Advanced Windows appear frozen after the RocketLauncher fade screen loads, increase the value of the VBADelay on GameCube, VBALink settings. Default value is 500 milliseconds.
  62. ; A game with one VBA window will use a two screens bezel file, Bezel [2S].png, the first screen for the GameCube game and the second one for the VBA screen. Two VBAs = Bezel [3S].png, again first screen for the GameCube game and second and third for the VBA screens, and so on.
  63. ;----------------------------------------------------------------------------
  64. StartModule()
  65. BezelGui()
  66. FadeInStart()
  67.  
  68. Run C:\Users\Joe\Desktop\Hyperspin-HyperLaunch New\Launcher Scripts\Dolphinbar\Enable Dolphinbar.bat
  69. Sleep, 1500
  70.  
  71. settingsFile := modulePath . "\" . moduleName . ".ini"
  72. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  73. UseCustomWiimoteProfiles := IniReadCheck(settingsFile, "Settings", "UseCustomWiimoteProfiles","false",,1) ; set to true if you want to setup custom Wiimote profiles for games
  74. UseCustomGCPadProfiles := IniReadCheck(settingsFile, "Settings", "UseCustomGCPadProfiles","false",,1) ; set to true if you want to setup custom GCPad profiles for games
  75. HideMouse := IniReadCheck(settingsFile, "Settings", "HideMouse","true",,1) ; hides mouse cursor in the emu options
  76. RefreshKey := IniReadCheck(settingsFile, "Settings", "RefreshKey","",,1) ; hotkey to "Refresh" Wiimotes, delete the key to disable it
  77. Timeout := IniReadCheck(settingsFile, "Settings", "Timeout","5",,1) ; amount in seconds we should wait for the above hotkeys to timeout
  78. renderToMain := IniReadCheck(settingsFile, "Settings", "Render_To_Main","false",,1)
  79. enableNetworkPlay := IniReadCheck(settingsFile, "Network", "Enable_Network_Play","false",,1)
  80.  
  81. ;options to Gamecube and VBA Link
  82. enableVBALink := IniReadCheck(settingsFile, romName, "enableVBALink", "false",,1)
  83. VBAExePath := IniReadCheck(settingsFile, "VBA Link", "VBAExePath", ,,1)
  84. VBABiosPath := IniReadCheck(settingsFile, "VBA Link", "VBABiosPath", ,,1)
  85. VBADelay := IniReadCheck(settingsFile, "VBA Link", "VBADelay", 500,,1)
  86.  
  87. ; Determine where Dolphin is storing its ini, this will act as the base folder for settings and profiles related to this emu
  88. dolphinININewPath := A_MyDocuments . "\Dolphin Emulator\Config\Dolphin.ini" ; location of Dolphin.ini for v4.0+
  89. dolphinINIOldPath := emuPath . "\User\Config\Dolphin.ini" ; location of Dolphin.ini prior to v4.0
  90. portableTxtFile := emuPath . "\portable.txt"
  91. If (!FileExist(portableTxtFile) && FileExist(dolphinININewPath))
  92. { dolphinBasePath := A_MyDocuments . "\Dolphin Emulator"
  93. Log("Module - Dolphin's base settings folder is not portable and found in: " . dolphinBasePath)
  94. } Else If (FileExist(portableTxtFile) || FileExist(dolphinINIOldPath))
  95. { dolphinBasePath := emuPath . "\User"
  96. Log("Module - Dolphin's base settings folder is portable and found in: " . dolphinBasePath)
  97. } Else
  98. ScriptError("Could not find your Dolphin.ini in either of these folders. Please run Dolphin manually first to create it.`n" . dolphinINIOldPath . "`n" . dolphinININewPath)
  99. dolphinINI := dolphinBasePath . "\Config\Dolphin.ini"
  100.  
  101. If (enableVBALink = "true"){
  102. VBAExePath := AbsoluteFromRelative(EmuPath, VBAExePath)
  103. VBABiosPath := AbsoluteFromRelative(EmuPath, VBABiosPath)
  104. SplitPath, VBAExePath, VBAFile, VBAPath
  105. SelectedNumberofPlayers :=NumberOfPlayersSelectionMenu(4)
  106. If (SelectedNumberofPlayers=1){
  107. enableVBALink = "false"
  108. } Else {
  109. ; backup original ini
  110. FileCopy, %dolphinINI%, %dolphinINIBackup%
  111. dolphinINIBackup := dolphinBasePath . "\Config\Dolphin_Backup.ini"
  112. Loop, % SelectedNumberofPlayers
  113. { tempCount := a_index-1
  114. IniWrite, 5, %dolphinINI%, Controls, PadType%tempCount%
  115. }
  116. }
  117. }
  118.  
  119. ; Win titles used throughout module
  120. dolphinTitle := "Dolphin ahk_class wxWindowNR"
  121. dolphinGameTitle := If renderToMain = "true" ? dolphinTitle : "FPS ahk_class wxWindowNR"
  122. dolphinScanningTitle := "Scanning for ISOs ahk_class #32770"
  123. dolphinNetPlaySetupTitle := "Dolphin NetPlay Setup ahk_class wxWindowNR"
  124. dolphinNetPlayTitle := "Dolphin NetPlay ahk_class wxWindowNR"
  125. dolphinErrorTitle1 := "Warning ahk_class #32770"
  126. dolphinErrorTitle2 := "Error ahk_class #32770"
  127.  
  128. If (enableVBALink = "true")
  129. BezelStart(SelectedNumberofPlayers+1)
  130. Else
  131. BezelStart()
  132.  
  133. If (enableVBALink = "true" and !bezelPath) ; disabling fullscreen if VBA Link mode
  134. Fullscreen := "false"
  135.  
  136. If (renderToMain = "true" && (enableVBALink = "true" || bezelEnabled = "true")) { ; disabling toolbar and statusbar if bezels or vba link is used as it will show when rendering to the main window
  137. IniWrite, False, %dolphinINI%, Interface, ShowToolbar
  138. IniWrite, False, %dolphinINI%, Interface, ShowStatusbar
  139. }
  140.  
  141. hideEmuObj := Object(dolphinScanningTitle,0,dolphinNetPlayTitle,0,dolphinNetPlaySetupTitle,0,dolphinErrorTitle1,0,dolphinErrorTitle2,0,dolphinTitle,0,dolphinGameTitle,1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  142. 7z(romPath, romName, romExtension, 7zExtractPath)
  143.  
  144. If romExtension in .zip,.7z,.rar
  145. ScriptError(MEmu . " does not support compressed roms. Please enable 7z support in RocketLauncherUI to use this module/emu.")
  146.  
  147. If RefreshKey {
  148. RefreshKey := xHotKeyVarEdit(RefreshKey,"RefreshKey","~","Add")
  149. xHotKeywrapper(RefreshKey,"RefreshWiimote")
  150. }
  151.  
  152. Fullscreen := (If ( Fullscreen = "true" ) ? ("True") : ("False"))
  153. HideMouse := (If ( HideMouse = "true" ) ? ("True") : ("False"))
  154.  
  155. networkSession :=
  156. If (enableNetworkPlay = "true") {
  157. Log("Module - Network Multi-Player is an available option for " . dbName,4)
  158. IniRead, dolphinNickname, %dolphinINI%, NetPlay, Nickname
  159. IniRead, dolphinAddress, %dolphinINI%, NetPlay, Address
  160. IniRead, dolphinCPort, %dolphinINI%, NetPlay, ConnectPort
  161. IniRead, dolphinHPort, %dolphinINI%, NetPlay, HostPort
  162. netplayNickname := IniReadCheck(settingsFile, "Network", "NetPlay_Nickname","Player",,1)
  163. getWANIP := IniReadCheck(settingsFile, "Network", "Get_WAN_IP","false",,1)
  164. networkPlayers := 4 ; Max amount of networkable players
  165.  
  166. If (getWANIP = "true")
  167. myPublicIP := GetPublicIP()
  168.  
  169. defaultServerIP := IniReadCheck(settingsFile, "Network", "Default_Server_IP", myPublicIP,,1)
  170. defaultServerPort := IniReadCheck(settingsFile, "Network", "Default_Server_Port",,,1)
  171. lastIP := IniReadCheck(settingsFile, "Network", "Last_IP", defaultServerIP,,1) ; does not need to be on the ISD
  172. lastPort := IniReadCheck(settingsFile, "Network", "Last_Port", defaultServerPort,,1) ; does not need to be on the ISD
  173.  
  174. If (netplayNickname != dolphinNickname)
  175. IniWrite, %netplayNickname%, %dolphinINI%, NetPlay, Nickname
  176.  
  177. MultiplayerMenu(lastIP,lastPort,networkType,networkPlayers,0)
  178. If networkSession {
  179. Log("Module - Using a Network for " . dbName,4)
  180.  
  181. restoreIniObject := Object() ; initialize object
  182. currentObj :=
  183. dolphinConfigPath := dolphinBasePath . "\Config"
  184. Loop, %dolphinConfigPath%\*.ini
  185. {
  186. If InStr(A_LoopFileName, "_netplay.ini") {
  187. Log("Module - Found a network specific ini: " . A_LoopFileFullPath,4)
  188. networkIni := A_LoopFileFullPath
  189. originalIni := RegExReplace(A_LoopFileFullPath, "_netplay","","",-1,15)
  190. backupIni := originalIni . ".backup"
  191. FileMove, %originalIni%, %backupIni%,1 ; backup original ini
  192. FileCopy, %networkIni%, %originalIni% ; copy network ini to original name
  193. currentObj++
  194. restoreIniObject[currentObj,"originalIni"] := originalIni
  195. restoreIniObject[currentObj,"backupIni"] := backupIni
  196. }
  197. }
  198.  
  199. IniWrite, %lastPort%, %settingsFile%, Network, Last_Port
  200.  
  201. If (networkType = "client") {
  202. IniWrite, %lastIP%, %settingsFile%, Network, Last_IP ; Save last used IP and Port for quicker launching next time
  203. IniWrite, %lastIP%, %dolphinINI%, NetPlay, Address
  204. IniWrite, %lastPort%, %dolphinINI%, NetPlay, ConnectPort
  205. } Else ; server
  206. IniWrite, %lastPort%, %dolphinINI%, NetPlay, HostPort
  207.  
  208. IniWrite, %romPath%, %dolphinINI%, General, ISOPath0 ; makes browser only show the one game we want to play
  209. IniWrite, 1, %dolphinINI%, General, ISOPaths ; makes browser only show the first path set
  210. IniWrite, %romPath%\%romName%%romExtension%, %dolphinINI%, General, LastFilename
  211. Log("Module - Starting a network session using the IP """ . networkIP . """ and PORT """ . networkPort . """",4)
  212. } Else
  213. Log("Module - User chose Single Player mode for this session",4)
  214. }
  215.  
  216. gcSerialPort = 5 ; this puts the BBA network adapter into the serial port. If previous launch was Triforce, AM-Baseboard would be set here and would result in Unknown DVD command errors
  217.  
  218. iniLookup =
  219. ( ltrim c
  220. Display, Fullscreen, %Fullscreen%
  221. Display, RenderToMain, %renderToMain%
  222. Interface, HideCursor, %HideMouse%
  223. Interface, ConfirmStop, False
  224. Interface, UsePanicHandlers, False
  225. Core, SerialPort1, %gcSerialPort%
  226. )
  227. Loop, Parse, iniLookup, `n
  228. {
  229. StringSplit, split, A_LoopField, `,, %A_Space%%A_Tab%
  230. IniRead, tempVar, %dolphinINI%, %split1%, %split2%
  231. If ( tempVar != split3 )
  232. IniWrite, % split3, %dolphinINI%, %split1%, %split2%
  233. }
  234.  
  235. ; Load default or user specified Wiimote or GCPad profiles for launching
  236. If (InStr(systemName, "wii") && UseCustomWiimoteProfiles = "true")
  237. ChangeDolphinProfile("Wiimote")
  238. If (UseCustomGCPadProfiles = "true")
  239. ChangeDolphinProfile("GCPad")
  240.  
  241. HideEmuStart()
  242.  
  243. If networkSession
  244. Run(executable, emuPath) ; must be launched w/o /b for browser list to work
  245. Else
  246. Run(executable . " /b /e """ . romPath . "\" . romName . romExtension . """", emuPath) ; /b = batch (exit dolphin with emu), /e = load file
  247.  
  248. Prev_TitleMatchMode := A_TitleMatchMode
  249. SetTitleMatchMode RegEx
  250. If (renderToMain = "false") {
  251. WinWait("(Dolphin.*\|)")
  252. WinGet, dolphinID, ID
  253. dolphinTitle = ahk_ID %dolphinID%
  254. WinWaitActive(dolphinTitle)
  255. } Else {
  256. WinWait(dolphinTitle)
  257. WinGet, dolphinID, ID
  258. }
  259. SetTitleMatchMode %Prev_TitleMatchMode%
  260.  
  261. If networkSession {
  262. Log("Module - Opening NetPlay window")
  263.  
  264. ; Get the 6-letter ID of the game
  265. If (romExtension = ".wbfs")
  266. gameID := RLObject.readFileData(romPath . "\" . romName . romExtension,512,6,"UTF8")
  267. Else If (romExtension = ".iso")
  268. gameID := RLObject.readFileData(romPath . "\" . romName . romExtension,0,6,"UTF8")
  269. Else If (romExtension = ".ciso")
  270. gameID := RLObject.readFileData(romPath . "\" . romName . romExtension,32768,6,"UTF8")
  271.  
  272. ; Must wait for Dolphin to finish scanning isos before netplay window can be opened so the game list is populated. Opening too early and the game list will be blank or partially filled.
  273. If WinExist(dolphinScanningTitle)
  274. WinWaitClose(dolphinScanningTitle,,60) ; wait 60 seconds max. hopefully doesn't take longer than that to scan your isos...
  275. Else {
  276. WinWait, %dolphinScanningTitle%,,5 ; wait 5 seconds max to appear
  277. If ErrorLevel
  278. Log("Module - Timed out waiting for ""Scanning for ISOs"" window to appear. It may have finished before it could be detected, moving on.")
  279. Else
  280. Log("Module - ""Scanning for ISOs"" window found.")
  281. }
  282. WinMenuSelectItem, %dolphinTitle%,, Tools, Start NetPlay
  283. matchMode := A_TitleMatchMode ; store for restoration later
  284. SetTitleMatchMode, 3 ; changes match mode so title must match exactly
  285. WinWait(dolphinNetPlaySetupTitle)
  286. WinWaitActive(dolphinNetPlaySetupTitle)
  287. If (networkType = "client") {
  288. Log("Module - Clicking Connect button")
  289. While !breakLoops {
  290. ControlClick, Button1, %dolphinNetPlaySetupTitle% ; click connect button
  291. Log("Module - Waiting for Host to start game")
  292. WinWait, %dolphinNetPlayTitle%,,2,%dolphinNetPlaySetupTitle% ; waits 2 seconds
  293. If ErrorLevel { ; 1 if timed out, now check for any error windows and close them
  294. Loop, 2 ; loop through both error windows
  295. If WinExist(dolphinErrorTitle%A_Index%) ; error windows that can appear when host is not running yet
  296. ControlClick, Button1, % dolphinErrorTitle%A_Index% ; click ok to clear error
  297. Log("Module - Host not running yet, trying again")
  298. Continue
  299. } Else { ; window exists
  300. Log("Module - Connected to host, waiting for host to start game")
  301. Break
  302. }
  303. }
  304. } Else { ; server
  305. ControlGet, List, List,, ListBox1, %dolphinNetPlaySetupTitle% ; get list of selectable games
  306. Loop, Parse, List, `n
  307. If InStr(A_Loopfield, gameID) {
  308. idLocation := A_Index ; record the location in the ListBox of our game
  309. Log("Module - Game list shows """ . A_LoopField . """ as item " . A_Index) ; logging each items in ListBox
  310. }
  311. If !idLocation { ; game was not found in list
  312. ScriptError("Could not find your """ . romName . """ in the game selection window for netplay. Possibly the gameID could not be found in your game. Please check your the RocketLauncher log and report this error.",,,,,1)
  313. Gosub, CloseProcess
  314. FadeInExit()
  315. Goto, CloseDolphin
  316. }
  317. Control, Choose, %idLocation%, ListBox1, %dolphinNetPlaySetupTitle% ; selects our game in the ListBox
  318. Log("Module - Clicking Host button")
  319. ControlClick, Button2, %dolphinNetPlaySetupTitle% ; click host button
  320. WinWait(dolphinNetPlayTitle,,,dolphinNetPlaySetupTitle) ; this window should now appear when hosted correctly
  321. Log("Module - Waiting for " . networkPlayers . " players until the game is started")
  322. While !breakLoops {
  323. ControlGet, List, List,, ListBox1, %dolphinNetPlayTitle%
  324. If InStr(List,"[" . networkPlayers . "]") {
  325. Log("Module - All players have joined, starting game")
  326. Break
  327. }
  328. Sleep, 100
  329. }
  330. ControlClick, Button8, %dolphinNetPlayTitle%,,,,,dolphinNetPlaySetupTitle ; click start button
  331. }
  332. SetTitleMatchMode, %matchMode% ; restore old match mode
  333. }
  334.  
  335.  
  336. If (enableVBALink = "true") {
  337. Screen1ID := dolphinID
  338. vbaINI := CheckFile(VBAPath . "\vbam.ini")
  339. vbaINIBackup := VBAPath . "\vbam_Backup.ini"
  340. FileCopy, %vbaINI%, %vbaINIBackup%
  341. ;removing fullscreen from VBA-M
  342. IniWrite, 0, %vbaINI%, preferences, fullScreen
  343. ;setting other VBA-M ini options
  344. StringReplace, VBABiosPathDoubleSlash,VBABiosPath, \, \\, all
  345. IniWrite, 0, %vbaINI%, preferences, pauseWhenInactive
  346. IniWrite, %VBABiosPathDoubleSlash%, %vbaINI%, GBA, BiosFile
  347. IniWrite, 1, %vbaINI%, GBA, LinkAuto
  348. IniWrite, 127.0.0.1, %vbaINI%, GBA, LinkHost
  349. IniWrite, 3, %vbaINI%, GBA, LinkType
  350. IniWrite, %SelectedNumberofPlayers%, %vbaINI%, preferences, LinkNumPlayers
  351. IniWrite, 1, %vbaINI%, preferences, useBiosGBA
  352. IniWrite, 1, %vbaINI%, Display, Stretch
  353. IniWrite, 1, %vbaINI%, Display, Scale
  354.  
  355. ;running VBA-M
  356. Loop, %SelectedNumberofPlayers%
  357. { currentScreen := a_index + 1
  358. Run(VBAFile . " " . """" . VBABiosPath . """",VBAPath,, Screen%currentScreen%PID)
  359. WinWait("ahk_pid " . Screen%currentScreen%PID)
  360. sleep, %VBADelay%
  361. bezelScreen%currentScreen%H := bezelScreen%currentScreen%H+24 ; to hide emu bottom bar
  362. }
  363. ;waiting for VBA-M windows bios loading
  364. timeout := A_TickCount
  365. Loop
  366. { WinGet, id, list, gba_bios - VisualBoyAdvance-M
  367. If (id=SelectedNumberofPlayers){
  368. Loop, %id%
  369. { currentScreen := a_index + 1
  370. Screen%currentScreen%ID := id%A_Index%
  371. }
  372. Break
  373. }
  374. If (timeout<A_TickCount-10000)
  375. Break
  376. Sleep, 100
  377. }
  378. ;Resizing Windows to fill screen if no bezel file is found
  379. If !(bezelPath) {
  380. Loop, % (SelectedNumberofPlayers+1)
  381. { If (a_index=1){
  382. X1 := 0 , Y1 := 0 , W1 := A_ScreenWidth//2 , H1 := A_ScreenHeight
  383. } Else {
  384. X%a_index% := A_ScreenWidth//2 , Y%a_index% := (a_index-2)*(A_ScreenHeight//SelectedNumberofPlayers) , W%a_index% := A_ScreenWidth//2 , H%a_index% := (A_ScreenHeight//SelectedNumberofPlayers)
  385. }
  386. WinSet, Style, -0xC00000, % "ahk_id " . Screen%A_Index%ID
  387. ToggleMenu(Screen%A_Index%ID)
  388. WinSet, Style, -0xC40000, % "ahk_id " . Screen%A_Index%ID
  389. WinMove, % "ahk_id " . Screen%A_Index%ID, , % X%A_Index%, % Y%A_Index%, % W%A_Index%, % H%A_Index%
  390. ;check If window moved
  391. timeout := A_TickCount
  392. Loop
  393. { WinGetPos, X, Y, W, H, % "ahk_id " . Screen%A_Index%ID
  394. If (X=X%A_Index%) and (Y=Y%A_Index%) and (W=W%A_Index%) and (H=H%A_Index%)
  395. Break
  396. If (timeout<A_TickCount-4000)
  397. Break
  398. Sleep, 50
  399. WinMove, % "ahk_id " . Screen%A_Index%ID, , % X%A_Index%, % Y%A_Index%, % W%A_Index%, % H%A_Index%
  400. }
  401. }
  402. Sleep, 50
  403. }
  404. }
  405.  
  406. BezelDraw()
  407. WinActivate, %dolphinGameTitle%
  408. HideEmuEnd()
  409. FadeInExit()
  410. Process("WaitClose", executable)
  411.  
  412. CloseDolphin:
  413. If (networkSession && restoreIniObject.MaxIndex()) {
  414. Loop % restoreIniObject.MaxIndex()
  415. { Log("Module - Restoring the original ini: " . restoreIniObject[A_Index,"backupIni"] . " to " . restoreIniObject[A_Index,"originalIni"],4)
  416. FileMove, % restoreIniObject[A_Index,"backupIni"], % restoreIniObject[A_Index,"originalIni"],1 ; restore all backed up inis
  417. }
  418. }
  419.  
  420. 7zCleanUp()
  421. BezelExit()
  422. FadeOutExit()
  423. ExitModule()
  424.  
  425.  
  426. ChangeDolphinProfile(profileType) {
  427. Global settingsFile,romName,dolphinBasePath
  428. profile := IniReadCheck(settingsFile, romName, "profile", "Default",,1)
  429. RLProfilePath := dolphinBasePath . "\Config\Profiles\" . profileType . " (RL)"
  430. currentProfile := dolphinBasePath . "\Config\" . profileType . "New.ini"
  431. defaultProfile := RLProfilePath . "\_Default_" . profileType . "New.ini"
  432. customProfile := RLProfilePath . "\" . profile . ".ini"
  433. If !FileExist(currentProfile) {
  434. Log("Module - You have custom " . profileType . " profiles enabled, but could not locate " . currentProfile . ". This file stores all your current controls in Dolphin. Please setup your controls in Dolphin first.",2)
  435. Return
  436. }
  437. If !FileExist(defaultProfile) {
  438. Log("Module - Creating initial Default " . profileType . " profile by copying " . profileType . ".ini to " . defaultProfile, 2)
  439. FileCreateDir % RLProfilePath
  440. FileCopy, %currentProfile%, %defaultProfile% ; create the initial default profile on first launch
  441. }
  442. If (profile != "Default" && !FileExist(customProfile))
  443. Log("Module - " . romName . " is set to load a custom " . profileType . " profile`, but it could not be found: " . customProfile,2)
  444. FileRead, cProfile, %currentProfile% ; read current profile into memory
  445. FileRead, nProfile, %customProfile% ; read custom profile into memory
  446. If ( cProfile != nProfile ) { ; if both profiles do not match exactly
  447. Log("Module - Current " . profileType . " profile does not match the one this game should use.")
  448. If (profile != "Default") { ; if user set to use a custom profile
  449. Log("Module - Copying this defined " . profileType . " profile to replace the current one: " . customProfile)
  450. FileCopy, %customProfile%, %currentProfile%, 1
  451. } Else { ; load default profile
  452. Log("Module - Copying the default " . profileType . " profile to replace the current one: " . defaultProfile)
  453. FileCopy, %defaultProfile%, %currentProfile%, 1
  454. }
  455. } Else
  456. Log("Module - Current " . profileType . " profile is already the correct one for this game, not touching it.")
  457. }
  458.  
  459. ConnectWiimote(key) {
  460. Global Timeout
  461. wiimoteClass := "Dolphin Controller Configuration ahk_class #32770"
  462. IfWinNotExist, %wiimoteClass%
  463. {
  464. DetectHiddenWindows, OFF ; this needs to be off otherwise WinMenuSelectItem doesn't work for some odd reason
  465. WinActivate, Dolphin ahk_class wxWindowNR,,,FPS
  466. WinMenuSelectItem, ahk_class wxWindowNR,, Options, Controller Settings,,,,,,FPS
  467. WinWait(wiimoteClass)
  468. WinWaitActive(wiimoteClass)
  469. }
  470. ;WinActivate, %wiimoteClass% ; test if window needs to be active
  471. ControlClick, %key%, %wiimoteClass%
  472. ControlClick, OK, %wiimoteClass%
  473. ; WinActivate, FPS ahk_class wxWindowClassNR ; for older dolphins
  474. WinActivate, %dolphinGameTitle%
  475. }
  476.  
  477. PairWiimote:
  478. ConnectWiimote("Pair Up")
  479. Return
  480.  
  481. RefreshWiimote:
  482. ConnectWiimote("Refresh")
  483. Return
  484.  
  485. CloseProcess:
  486. breakLoops := 1
  487. FadeOutStart()
  488. If (enableVBALink = "true"){
  489. Loop, %SelectedNumberofPlayers%
  490. { currentScreen := a_index + 1
  491. ;WinActivate, % "ahk_pid " . Screen%currentScreen%PID
  492. WinClose("ahk_id " . Screen%currentScreen%ID)
  493. sleep, 100
  494. }
  495. FileMove, %dolphinINIBackup%, %dolphinINI%
  496. FileMove, %vbaINIBackup%, %vbaINI%,1
  497. }
  498. If networkSession {
  499. If WinExist(dolphinNetPlaySetupTitle)
  500. WinClose(dolphinNetPlaySetupTitle)
  501. If WinExist(dolphinNetPlayTitle)
  502. WinClose(dolphinNetPlayTitle)
  503. If !WinExist(dolphinGameTitle) ; if game never launched, close the main emu window
  504. WinClose(dolphinTitle)
  505. }
  506. If WinExist(dolphinGameTitle)
  507. WinClose(dolphinGameTitle) ; this needs to close the window the game is running in otherwise dolphin crashes on exit
  508.  
  509. Run C:\Users\Joe\Desktop\Hyperspin-HyperLaunch New\Launcher Scripts\Dolphinbar\Disable Dolphinbar.bat
  510.  
  511. Return
  512.  
  513. Run C:\Users\Joe\Desktop\Hyperspin-HyperLaunch New\Launcher Scripts\Dolphinbar\Disable Dolphinbar.bat
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement