Advertisement
Guest User

Untitled

a guest
Jan 10th, 2014
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.54 KB | None | 0 0
  1. MEmu = Fusion
  2. MEmuV = v3.64
  3. MURL = http://www.eidolons-inn.net/tiki-index.php?page=Kega
  4. MAuthor = djvj
  5. MVersion = 2.0.8
  6. MCRC =
  7. iCRC =
  8. MID =
  9. MSystem = "Samsung Gam Boy","Sega 32X","Sega CD","Sega Game Gear","Sega Genesis","Sega Master System","Sega Mega Drive","Sega MD","Sega Mega-CD","Sega SC-3000","Sega SG-1000"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; Don't forget to setup your bios or you might just get a black screen.
  13. ; Set your fullscreen resolution by going to Video->Full Screen Resolution
  14. ; Fusion only supports 4 different windowed resolutions. If you don't use fullscreen, set the one you want by going to Video->Window Size
  15. ; Esc is Fusion's default key to go Fullscreen/Windowed mode. This cannot be changed, but this module will still close if you use Esc to exit. You may see the emu leave fullscreen first though.
  16. ; Esc can also cause Fusion to change its fullscreen mode on exit, causing it to lockup for 5-10 seconds. The only fix for this is to not use Esc as your exit key.
  17. ; For Sega CD, make sure your cues are correctly pointing to all the tracks or else you will not get sound. Also turn off auto-play for CDs
  18. ;
  19. ; Sega CD
  20. ; Configure your Sega CD bios first by going to Options -> Set Config -> Sega CD
  21. ; Set the scsi drive you want to use manually by going to Options -> CD Drive and seleting the one that corresponds to your scsi drive in DT. A dt drive is not supported by the emu, it must be scsi.
  22. ;
  23. ; Defining per-game controller types:
  24. ; In the module ini, set Controller_Reassigning_Enabled to true
  25. ; Default_P1_Controller and Default_P2_Controller should be set to the controller type you normally use for games not listed in the ini
  26. ; Make a new ini section with the name of your rom in your database, for example [Super Scope 6 (USA)]
  27. ; Under this section you can have 2 keys, P1_Controller and P2_Controller
  28. ; For P1_Controller - 0=None, 1=Gamepad, 2=Multitap, 3=Mouse, 4=Serial USART
  29. ; For P2_Controller - 0=None, 1=Gamepad, 2=Multitap, 3=Mouse, 4=Super Scope, 5=Justifier, 6=Dual Justifiers, 7=Serial USART
  30. ;
  31. ; Some games will not work if you have Teamplayer or 4way play active all the time, so you can set the MultiTapType for those problematic games in the module settings for each of these games.
  32. ;----------------------------------------------------------------------------
  33. StartModule()
  34. BezelGUI()
  35. FadeInStart()
  36.  
  37. ; The object controls how the module reacts to different systems. Fusion can play a lot of systems, but changes itself slightly so this module has to adapt
  38. mType := Object("Samsung Gam Boy","sms","Sega 32X","32X","Sega CD","scd","Sega Mega-CD","scd","Sega Game Gear","gg","Sega Genesis","gen","Sega Mega Drive","gen","Sega MD","gen","Sega Master System","sms","Sega SC-3000","sms","Sega SG-1000","sms")
  39. ident := mType[systemName] ; search 1st array for the systemName identifier mednafen uses
  40. If !ident
  41. ScriptError("Your systemName is: " . systemName . "`nIt is not one of the known supported systems for this Fusion module: " . moduleName)
  42.  
  43. Log("Module - Started reading module ini")
  44. settingsFile := modulePath . "\" . moduleName . ".ini"
  45. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  46. forceFullScreen32 := IniReadCheck(settingsFile, "Settings", "ForceFullScreen32","true",,1)
  47. hideTitleBar := IniReadCheck(settingsFile, "Settings", "hideTitleBar","true",,1) ; Removes the border, titlebar, menubar, and centers the emu on your screen. Only need this if fullscreen is false
  48. useRamCarts := IniReadCheck(settingsFile, "Settings", "UseRamCarts","true",,1)
  49. fluxAudioCD := IniReadCheck(settingsFile, "Settings", "FluxAudioCD",,,1) ; audio CD for use when Flux is ran
  50. fluxAudioCD := GetFullName(fluxAudioCD) ; convert relative path to absolute
  51. DTWaitTime := IniReadCheck(settingsFile, systemName, "DTWaitTime","0",,1)
  52. controllerReassigningEnabled := IniReadCheck(settingsFile, systemName, "Controller_Reassigning_Enabled","false",,1)
  53. perfectSync := IniReadCheck(settingsFile, romName, "PerfectSync","false",,1)
  54. multiTapType := IniReadCheck(settingsFile, systemName . "|" . romName, "MultiTapType",0,,1)
  55. genP1Controller := IniReadCheck(settingsFile, systemName . "|" . romName, "Genesis_P1_Controller",2,,1)
  56. genP1bController := IniReadCheck(settingsFile, systemName . "|" . romName, "Genesis_P1b_Controller",2,,1)
  57. genP1cController := IniReadCheck(settingsFile, systemName . "|" . romName, "Genesis_P1c_Controller",2,,1)
  58. genP1dController := IniReadCheck(settingsFile, systemName . "|" . romName, "Genesis_P1d_Controller",2,,1)
  59. genP2Controller := IniReadCheck(settingsFile, systemName . "|" . romName, "Genesis_P2_Controller",2,,1)
  60. genP2bController := IniReadCheck(settingsFile, systemName . "|" . romName, "Genesis_P2b_Controller",2,,1)
  61. genP2cController := IniReadCheck(settingsFile, systemName . "|" . romName, "Genesis_P2c_Controller",2,,1)
  62. genP2dController := IniReadCheck(settingsFile, systemName . "|" . romName, "Genesis_P2d_Controller",2,,1)
  63. smsP1Controller := IniReadCheck(settingsFile, systemName . "|" . romName, "SMS_P1_Controller",1,,1)
  64. smsP2Controller := IniReadCheck(settingsFile, systemName . "|" . romName, "SMS_P2_Controller",1,,1)
  65. genP1Use := IniReadCheck(settingsFile, systemName . "|" . romName, "Genesis_P1_Use",1,,1)
  66. genP1bUse := IniReadCheck(settingsFile, systemName . "|" . romName, "Genesis_P1b_Use",1,,1)
  67. genP1cUse := IniReadCheck(settingsFile, systemName . "|" . romName, "Genesis_P1c_Use",1,,1)
  68. genP1dUse := IniReadCheck(settingsFile, systemName . "|" . romName, "Genesis_P1d_Use",1,,1)
  69. genP2Use := IniReadCheck(settingsFile, systemName . "|" . romName, "Genesis_P2_Use",1,,1)
  70. genP2bUse := IniReadCheck(settingsFile, systemName . "|" . romName, "Genesis_P2b_Use",1,,1)
  71. genP2cUse := IniReadCheck(settingsFile, systemName . "|" . romName, "Genesis_P2c_Use",1,,1)
  72. genP2dUse := IniReadCheck(settingsFile, systemName . "|" . romName, "Genesis_P2d_Use",1,,1)
  73. smsP1Use := IniReadCheck(settingsFile, systemName . "|" . romName, "SMS_P1_Use",1,,1)
  74. smsP2Use := IniReadCheck(settingsFile, systemName . "|" . romName, "SMS_P2_Use",1,,1)
  75. Log("Module - Finished reading module ini")
  76.  
  77. BezelStart()
  78.  
  79. fusionFile := CheckFile(emuPath . "\fusion.ini")
  80. fusionIni := LoadProperties(fusionFile) ; load the config into memory
  81. currentFullScreen := ReadProperty(fusionIni,"FullScreen") ; read current fullscreen state
  82. currentForceFullScreen32 := ReadProperty(fusionIni,"forceFullScreen32") ; read current ForceFullScreen32 state
  83. currentPerfectSync := ReadProperty(fusionIni,"PerfectSync") ; read current PerfectSync state
  84.  
  85. 7z(romPath, romName, romExtension, 7zExtractPath)
  86.  
  87. If romExtension in .7z,.rar
  88. ScriptError(MEmu . " only supports uncompressed or zip compressed roms. Please enable 7z support in HLHQ to use this module/emu for this extension: """ . romExtension . """")
  89.  
  90. If ( Fullscreen != "true" And currentFullScreen = "1" ) {
  91. WriteProperty(fusionIni,"FullScreen", 0)
  92. If controllerReassigningEnabled != true ; no need to save file if it's going to be written later
  93. SaveProperties(fusionFile,fusionIni) ; save fusionFile to disk
  94. } Else If ( Fullscreen = "true" And currentFullScreen = "0" ) {
  95. WriteProperty(fusionIni,"FullScreen", 1)
  96. If controllerReassigningEnabled != true ; no need to save file if it's going to be written later
  97. SaveProperties(fusionFile,fusionIni) ; save fusionFile to disk
  98. }
  99.  
  100. If ( forceFullScreen32 != "true" And currentForceFullScreen32 = "1" ) {
  101. WriteProperty(fusionIni,"ForceFullScreen32", 0)
  102. If controllerReassigningEnabled != true ; no need to save file if it's going to be written later
  103. SaveProperties(fusionFile,fusionIni) ; save fusionFile to disk
  104. } Else If ( forceFullScreen32 = "true" And currentForceFullScreen32 = "0" ) {
  105. WriteProperty(fusionIni,"ForceFullScreen32", 1)
  106. If controllerReassigningEnabled != true ; no need to save file if it's going to be written later
  107. SaveProperties(fusionFile,fusionIni) ; save fusionFile to disk
  108. }
  109.  
  110. If ( perfectSync != "true" And currentPerfectSync = "1" ) {
  111. WriteProperty(fusionIni,"PerfectSync", 0)
  112. If controllerReassigningEnabled != true ; no need to save file if it's going to be written later
  113. SaveProperties(fusionFile,fusionIni) ; save fusionFile to disk
  114. } Else If ( perfectSync = "true" And currentPerfectSync = "0" ) {
  115. WriteProperty(fusionIni,"PerfectSync", 1)
  116. If controllerReassigningEnabled != true ; no need to save file if it's going to be written later
  117. SaveProperties(fusionFile,fusionIni) ; save fusionFile to disk
  118. }
  119.  
  120. hideEmu := (If Fullscreen = "true" ? ("Hide") : (""))
  121. fullscreen := (If Fullscreen = "true" ? ("-fullscreen") : (""))
  122.  
  123. If bezelPath ; Setting windowed mode resolution
  124. { WriteProperty(fusionIni,"GameGearZoom", 1) ; disabling emulator default bezel
  125. If controllerReassigningEnabled != true ; no need to save file if it's going to be written later
  126. SaveProperties(fusionFile,fusionIni) ; save fusionFile to disk
  127. }
  128.  
  129. ; Allows you to set on a per-rom basis the controller type plugged into controller ports 1 and 2
  130. If controllerReassigningEnabled = true
  131. { Log("Module - Started reassigning Fusion's ini controls")
  132. WriteProperty(fusionIni,"MultiTapType", multiTapType) ; sets MultiTap
  133. WriteProperty(fusionIni,"Joystick1Type", genP1Controller) ; sets controls for P1
  134. WriteProperty(fusionIni,"Joystick1bType", genP1bController) ; sets controls for P1b
  135. WriteProperty(fusionIni,"Joystick1cType", genP1cController) ; sets controls for P1c
  136. WriteProperty(fusionIni,"Joystick1dType", genP1dController) ; sets controls for P1d
  137. WriteProperty(fusionIni,"Joystick2Type", genP2Controller) ; sets controls for P2
  138. WriteProperty(fusionIni,"Joystick2bType", genP2bController) ; sets controls for P2b
  139. WriteProperty(fusionIni,"Joystick2cType", genP2cController) ; sets controls for P2c
  140. WriteProperty(fusionIni,"Joystick2dType", genP2dController) ; sets controls for P2d
  141. WriteProperty(fusionIni,"Joystick1MSType", smsP1Controller) ; sets controls for sms P1
  142. WriteProperty(fusionIni,"Joystick2MSType", smsP2Controller) ; sets controls for sms P2
  143. WriteProperty(fusionIni,"Joystick1Using", genP1Use) ; sets controls for P1
  144. WriteProperty(fusionIni,"Joystick1bUsing", genP1bUse) ; sets controls for P1b
  145. WriteProperty(fusionIni,"Joystick1cUsing", genP1cUse) ; sets controls for P1c
  146. WriteProperty(fusionIni,"Joystick1dUsing", genP1dUse) ; sets controls for P1d
  147. WriteProperty(fusionIni,"Joystick2Using", genP2Use) ; sets controls for P2
  148. WriteProperty(fusionIni,"Joystick2bUsing", genP2bUse) ; sets controls for P2b
  149. WriteProperty(fusionIni,"Joystick2cUsing", genP2cUse) ; sets controls for P2c
  150. WriteProperty(fusionIni,"Joystick2dUsing", genP2dUse) ; sets controls for P2d
  151. WriteProperty(fusionIni,"Joystick1MSUsing", smsP1Use) ; sets controls for sms P1
  152. WriteProperty(fusionIni,"Joystick2MSUsing", smsP2Use) ; sets controls for sms P2
  153. SaveProperties(fusionFile,fusionIni) ; save fusionFile to disk
  154. Log("Module - Finished reassigning Fusion's ini controls")
  155. }
  156.  
  157. fluxRom := InStr(romName, "flux") ; test if this game is Flux, a special case game that requires an Audio CD to be mounted
  158. If fluxRom {
  159. Log("Module - Mounting the Audio CD because """ . romName . """ requires one to function.")
  160. ident := "gen" ; change ident to gen because Flux has to be mounted as a Genesis rom
  161. DaemonTools("mount", fluxAudioCD) ; mount the Audio CD the user has set in the module settings
  162. }
  163.  
  164. scdExtension := InStr(".ccd|.cue|.bin|.iso", romExtension) ; the sega cd extensions supported by fusion
  165.  
  166. If (ident = "scd" && dtEnabled = "true" && scdExtension) {
  167. If dtUseSCSI = false
  168. Log("Module - Daemon Tools drive type is set to ""dt"" but only ""scsi"" is supported for Fusion. Forcing scsi drive.", 2)
  169. DaemonTools("mount", romPath . "\" . romName . romExtension, (If dtUseSCSI = "false" ? "scsi" : ""))
  170. Sleep, DTWaitTime
  171. Run(executable . " -auto -" . ident . " " . fullscreen, emuPath, hideEmu)
  172. } Else {
  173. If (ident = "scd" && dtEnabled = "true" && !scdExtension)
  174. Log("Module - " . romExtension . " is not a supported cd image extension for Fusion. Launching Fusion without DT support.", 2)
  175. Run(executable . " -auto -" . ident . " " . fullscreen . " """ . romPath . "\" . romName . romExtension . """", emuPath, hideEmu)
  176. }
  177.  
  178. WinWait("Fusion ahk_class KegaClass")
  179. WinWaitActive("Fusion ahk_class KegaClass")
  180.  
  181. If fluxRom
  182. PostMessage, 0x111, 40009,,,ahk_class KegaClass ; Runs the Boot Sega-CD command to load the Audio CD that should be mounted in DT already
  183.  
  184. If (ident = "scd" && useRamCarts = "true") ; Sega CD or Mega CD only
  185. { brmPath := ReadProperty(fusionIni,"BRMFiles") ; read BRM path
  186. IfNotExist, %brmPath%
  187. FileCreateDir, %brmPath% ; create brmPath if it does not exist
  188. selectRamWin := "Select RAM Cart Size ahk_class #32770"
  189. createRamWin := "Create RAM Cart ahk_class #32770"
  190. loadRamWin := "Load RAM Cart ahk_class #32770"
  191. ; Create New Ram Cart if it doesn't exist already
  192. IfNotExist, %brmPath%\%romName%.crm
  193. { PostMessage, 0x111, 40036,,,ahk_class KegaClass ; Open Create New Ram Cart Window
  194. WinWait, %selectRamWin%
  195. WinSet, Transparent, On, %selectRamWin%
  196. Control, Check,, Button7, %selectRamWin%
  197. ControlSend, Button1, {Enter}, %selectRamWin%
  198. WinWait, %createRamWin%
  199. WinSet, Transparent, On, %createRamWin%
  200. WinWaitActive, %createRamWin%
  201. Loop {
  202. ControlGetText, edit1Text, Edit1, %createRamWin%
  203. If ( edit1Text = brmPath . "\" . romName . ".crm" )
  204. Break
  205. Sleep, 100
  206. ControlSetText, Edit1, %brmPath%\%romName%.crm, %createRamWin%
  207. }
  208. ControlSend, Button1, {Enter}, %createRamWin% ; Select Save
  209. }
  210. ; Now load the Ram Cart
  211. PostMessage, 0x111, 40035,,,ahk_class KegaClass ; Open Load Ram Cart Window
  212. WinWait, %loadRamWin%
  213. WinSet, Transparent, On, %loadRamWin%
  214. WinWaitActive, %loadRamWin%
  215. Loop {
  216. ControlGetText, edit1Text, Edit1, %loadRamWin%
  217. If ( edit1Text = brmPath . "\" . romName . ".crm" )
  218. Break
  219. Sleep, 100
  220. ControlSetText, Edit1, %brmPath%\%romName%.crm, %loadRamWin%
  221. }
  222. ControlSend, Button1, {Enter}, %loadRamWin% ; Select Open
  223. }
  224.  
  225. WinWaitActive("Fusion ahk_class KegaClass")
  226.  
  227. Loop { ; looping until Fusion is done loading game
  228. Sleep, 200
  229. WinGetTitle, winTitle, Fusion ahk_class KegaClass
  230. StringSplit, T, winTitle, %A_Space%
  231. If ( T3 = "-" )
  232. Break
  233. }
  234.  
  235. If hideTitleBar = true
  236. { WinSet, Style, -0x40000, Fusion ahk_class KegaClass ; Removes the border of the game window
  237. WinSet, Style, -0xC00000, Fusion ahk_class KegaClass ; Removes the TitleBar
  238. DllCall("SetMenu", uint, WinActive( "A" ), uint, 0) ; Removes the MenuBar
  239. If bezelEnabled != true
  240. Center(Fusion ahk_class KegaClass)
  241. }
  242.  
  243. BezelDraw()
  244. FadeInExit()
  245. Process("WaitClose", executable)
  246.  
  247. If (fluxRom || (ident = "scd" && dtEnabled = "true" && scdExtension))
  248. DaemonTools("unmount")
  249.  
  250. 7zCleanUp()
  251. BezelExit()
  252. FadeOutExit()
  253. ExitModule()
  254.  
  255.  
  256. Center(title) {
  257. WinGetPos, X, Y, width, height, %title%
  258. x := ( A_ScreenWidth / 2 ) - ( width / 2 )
  259. y := ( A_ScreenHeight / 2 ) - ( height / 2 )
  260. WinMove, %title%, , x, y
  261. }
  262.  
  263. MultiGame:
  264. ; msgbox % "selectedRom = " . selectedRom . "`nselected game = " . currentButton . "`nmgRomPath = " . mgRomPath . "`nmgRomExt = " . mgRomExt . "`nmgRomName = " . mgRomName
  265. ; Unmount the CD from DaemonTools
  266. If ( scdExtension && dtEnabled = "true" )
  267. DaemonTools("unmount")
  268. Sleep, 500 ; Required to prevent DT from bugging
  269. ; Mount the CD using DaemonTools
  270. If ( scdExtension && dtEnabled = "true" )
  271. DaemonTools("mount", selectedRom)
  272. Return
  273.  
  274. CloseProcess:
  275. FadeOutStart()
  276. WinClose("Fusion ahk_class KegaClass")
  277. ; PostMessage, 0x111, 40039,,,ahk_class KegaClass ; Tells Fusion to Power Off
  278. ; Sleep, 100 ; giving time for Fusion to unload rom
  279. ; PostMessage, 0x111, 40005,,,ahk_class KegaClass ; Tells Fusion to exit
  280. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement