Advertisement
rfancella

WinAPE.ahk

Dec 1st, 2014
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.69 KB | None | 0 0
  1. MEmu = WinAPE
  2. MEmuV = v2.0.a18
  3. MURL = http://www.winape.net/
  4. MAuthor = djvj & brolly
  5. MVersion = 2.0
  6. MCRC = BA48CA3E
  7. iCRC = FC556A8E
  8. MID = 635038268934069007
  9. MSystem = "Amstrad GX4000","Amstrad CPC","Amstrad CPC Plus"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; You cannot pass a game name to the emu through CLI, but the emu will autolaunch the game set in its ini file.
  13. ; Run the exe manually and goto Settings->General, check "Disable Automatic Update"
  14. ; On the Display tab, check "Hide Control Panel", "Hide Menus" and "No Right-Click Menu". "Linear Palette" will slightly darken image if you enable it.
  15. ; On the Sound tab, check "44 kHz" and "16 bit".
  16. ; On the Input tab, set your controls and hit OK.
  17. ; Press F10 to turn on fullscreen then ALT+F4 to exit and save your settings.
  18. ; Make sure your rom extension is either zip or cpr, not both.
  19. ; Make sure you have Arnold V Diagnostic Cartridge.cpr rom on WinApe\ROM folder if you want to run No Exit.
  20. ; You can use any other CPCPlus cart if you prefer, in that case make sure you edit the variable below to the correct name.
  21. ;
  22. ; Default WinAPE disk swap/flip keys:
  23. ; Shift+F1 will flip Disk on Drive A:
  24. ; Shift+F2 will flip Disk on Drive B:
  25. ; Shift+Ctrl+F3 will swap Disks on Drive A: and B:
  26. ;----------------------------------------------------------------------------
  27. StartModule()
  28. BezelGUI()
  29. FadeInStart()
  30.  
  31. settingsFile := modulePath . "\" . moduleName . ".ini"
  32. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  33. DiagCart := IniReadCheck(settingsFile, "Settings", "DiagCart","Arnold V Diagnostic Cartridge.cpr",,1)
  34. driveErrorFix := IniReadCheck(settingsFile, "Settings", "driveErrorFix","false",,1)
  35.  
  36. DiagCart := GetFullName(DiagCart)
  37. 7z(romPath, romName, romExtension, 7zExtractPath)
  38. BezelStart()
  39. ;Clean any previous disk in drives
  40. IniWrite, %A_Space%, %emuPath%\WinAPE.ini, Drives, Drive(0) ; Drive A Side A
  41. IniWrite, %A_Space%, %emuPath%\WinAPE.ini, Drives, Drive(4) ; Drive A Side B
  42. IniWrite, %A_Space%, %emuPath%\WinAPE.ini, Drives, Drive(1) ; Drive B Side A
  43. IniWrite, %A_Space%, %emuPath%\WinAPE.ini, Drives, Drive(5) ; Drive B Side B
  44.  
  45. ;Clean any previous cart
  46. IniWrite, %A_Space%, %emuPath%\WinAPE.ini, ROMS, Cartridge
  47.  
  48. ;If autobootrom=true it means rom will start through CLI otherwise another cart must be loaded before hand as a workaround
  49. autobootrom=true
  50. If romName contains No Exit
  51. { ;No Exit won't boot if the cart is already plugged it requires another cart (not all work) to be plugged and then we need to swap them
  52. ;we use the diagnostic cart as the booting cart since it always works
  53. autobootrom=false
  54. }
  55.  
  56. ;Change settings based on system name (CPC Plus games will only work if system is CPC Plus or GX4000)
  57. If systemName = Amstrad CPC
  58. { IniWrite, false, %emuPath%\WinAPE.ini, Configuration, Enable Plus
  59. IniWrite, 0, %emuPath%\WinAPE.ini, Configuration, CRTC Type
  60. IniWrite, false, %emuPath%\WinAPE.ini, ROMS, Cartridge Enabled
  61. IniWrite, OS6128, %emuPath%\WinAPE.ini, ROMS, Lower
  62. IniWrite, BASIC1-1, %emuPath%\WinAPE.ini, ROMS, Upper(0)
  63. } Else {
  64. IniWrite, true, %emuPath%\WinAPE.ini, Configuration, Enable Plus
  65. IniWrite, 3, %emuPath%\WinAPE.ini, Configuration, CRTC Type
  66. IniWrite, true, %emuPath%\WinAPE.ini, ROMS, Cartridge Enabled
  67. IniWrite, %A_Space%, %emuPath%\WinAPE.ini, ROMS, Lower
  68. IniWrite, %A_Space%, %emuPath%\WinAPE.ini, ROMS, Upper(0)
  69. }
  70.  
  71. ;Plug the cartridge/disk through ini file
  72. If (systemName = "Amstrad CPC Plus" AND romExtension = "dsk")
  73. IniWrite, cpc_plus.cpr, %emuPath%\WinAPE.ini, ROMS, Cartridge
  74. Else
  75. If autobootrom = true
  76. If romExtension = .zip
  77. IniWrite, %romPath%\%romName%%romExtension%\:%romName%.cpr, %emuPath%\WinAPE.ini, ROMS, Cartridge
  78. Else If romExtension = .cpr
  79. IniWrite, %romPath%\%romName%%romExtension%, %emuPath%\WinAPE.ini, ROMS, Cartridge
  80. Else
  81. IniWrite, %DiagCart%, %emuPath%\WinAPE.ini, ROMS, Cartridge
  82.  
  83. ;Set Fullscreen
  84. If (Fullscreen = "true" && autobootrom = "true")
  85. IniWrite, true, %emuPath%\WinAPE.ini, Configuration, Full Screen
  86. Else
  87. IniWrite, false, %emuPath%\WinAPE.ini, Configuration, Full Screen
  88.  
  89. ;Set Numlock since you should have your joystick configurations made for this
  90. SetNumlockState, off
  91.  
  92. ;MultiDisk loading, this will load the first 2 disks into drives A and B since some games can read from both drives and therefore
  93. ;the user won't need to change disks through the MG menu.
  94. If (romName contains "(Disk 1" OR romName contains "(Side A")
  95. { ;If the user boots any disk rather than the first one, multi disk support must be done through HyperLaunch MG menu
  96. multipartTable := CreateRomTable(multipartTable)
  97.  
  98. If multipartTable.MaxIndex()
  99. { ;Make the searches case insensitive
  100. original_case_sense := A_StringCaseSense
  101. StringCaseSense, Off
  102.  
  103. ;Has multi part
  104. for index, element in multipartTable
  105. { current_rom := multipartTable[A_Index,1]
  106.  
  107. driveA_sideA = (Side A,(Disk 1),(Disk 1 Side A
  108. driveA_sideB = (Side B,(Disk 1 Side B
  109. driveB_sideA = (Disk 2),(Disk 2 Side A
  110. driveB_sideB = (Disk 2 Side B
  111.  
  112. If current_rom contains %driveA_sideA%
  113. IniWrite, %current_rom%, %emuPath%\WinAPE.ini, Drives, Drive(0)
  114. Else If current_rom contains %driveA_sideB%
  115. IniWrite, %current_rom%, %emuPath%\WinAPE.ini, Drives, Drive(4)
  116. Else If current_rom contains %driveB_sideA%
  117. IniWrite, %current_rom%, %emuPath%\WinAPE.ini, Drives, Drive(1)
  118. Else If current_rom contains %driveB_sideB%
  119. IniWrite, %current_rom%, %emuPath%\WinAPE.ini, Drives, Drive(5)
  120. }
  121. ;Restore original StringCaseSense
  122. StringCaseSense, %original_case_sense%
  123. }
  124. }
  125.  
  126. Run(executable . " """ . romPath . "\" . romName . romExtension . """ /A", emuPath)
  127.  
  128. If driveErrorFix = true
  129. {
  130. WinWait("WinApe.exe - Drive Not Ready ahk_class #32770")
  131. WinActivate, WinApe.exe - Drive Not Ready ahk_class #32770
  132. ControlClick, Button1, WinApe.exe - Drive Not Ready ahk_class #32770
  133. }
  134.  
  135. WinWait("ahk_class TfrmCover") ; waiting for logo to show
  136. WinHide, ahk_class TfrmCover ; making logo dissappear!
  137.  
  138. WinWait("Windows Amstrad Plus Emulator ahk_class TfrmEmu")
  139. WinWaitActive("Windows Amstrad Plus Emulator ahk_class TfrmEmu")
  140. BezelDraw()
  141.  
  142. If autobootrom != true
  143. { ;Lets swap carts to load No Exit
  144. Sleep 500 ;Wait just an instant for the diagnostic cart to load
  145. Send ^{F3}
  146. WinWait("Open ahk_class #32770")
  147. WinWaitActive("Open ahk_class #32770")
  148. Sleep, 100
  149. ControlSetText, Edit1, %romPath%\%romName%%romExtension%, Open ahk_class #32770
  150. Send {Enter}
  151. Sleep, 100
  152. If Fullscreen = true
  153. Send {F10} ;Go Fullscreen
  154. }
  155.  
  156. FadeInExit()
  157. Process("WaitClose",executable)
  158. 7zCleanUp()
  159. BezelExit()
  160. FadeOutExit()
  161. ExitModule()
  162.  
  163.  
  164. CloseProcess:
  165. FadeOutStart()
  166. WinClose("ahk_class TfrmEmu")
  167. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement