Advertisement
rfancella

Magic Engine.ahk

May 19th, 2015
598
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.36 KB | None | 0 0
  1. MEmu = Magic Engine
  2. MEmuV = v1.1.3
  3. MURL = http://www.magicengine.com/
  4. MAuthor = djvj
  5. MVersion = 2.0.3
  6. MCRC = 847AD52C
  7. iCRC = 7930CF86
  8. MID = 635038268901782138
  9. MSystem = "NEC PC Engine","NEC PC Engine-CD","NEC PC-FX","NEC SuperGrafx","NEC TurboGrafx-16","NEC TurboGrafx-CD"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; Download and extract nomousy to the folder with this module from http://www.autohotkey.com/forum/viewtopic.php?t=2197 (it makes the cursor transparent, so clicks will still register)
  13. ; This is used to prevent the mouse cursor from appearing in the middle of your screen when you run Magic Engine
  14. ; xPadder/joy2key don't work, the emu reads raw inputs. If you use gamepads, make sure you set your keys in Config->Gamepad
  15. ; Set your desired Video settings below.
  16. ;
  17. ; NEC PC-FX:
  18. ; Tested with emulator Magic Engine FX v1.0.1
  19. ; This is not the same emu as Magic Engine. It only emulates a PC-FX, but module script is almost the same.
  20. ;
  21. ; CD systems:
  22. ; Make sure your Virtual Drive_Tools_Path in RocketLauncherUI is correct
  23. ; Make sure you have the syscard3.pce rom in your emu dir. You can find the file here: http://www.fantasyanime.com/emuhelp/syscards.zip
  24. ;----------------------------------------------------------------------------
  25. StartModule()
  26. BezelGUI()
  27. FadeInStart()
  28.  
  29. settingsFile := modulePath . "\" . moduleName . ".ini"
  30. Windowed := IniReadCheck(settingsFile, "Settings", "Windowed","y",,1) ; y=Simulated Fullscreen mode, n=Normal Fullscreen mode - Simulated Fullscreen mode is preferred, it still looks fullscreen
  31. WideScreenMode := IniReadCheck(settingsFile, "Settings", "WideScreenMode","n",,1) ; y=enable, n=disable
  32. DesktopMode := IniReadCheck(settingsFile, "Settings", "DesktopMode","y",,1) ; y=enable, n=disable - This is basically what sets fullscreen mode. Set to n to show emu in a small window
  33. FullscreenStretch := IniReadCheck(settingsFile, "Settings", "FullscreenStretch","y",,1) ; y=enable, n=disable - This stretches the game screen while keeping the aspect ratio
  34. HighResMode := IniReadCheck(settingsFile, "Settings", "HighResMode","y",,1) ; y=enable, n=disable
  35. Filter := IniReadCheck(settingsFile, "Settings", "Filter","1",,1) ; 1=bilinear filtering , 0=disable
  36. TripleBuffer := IniReadCheck(settingsFile, "Settings", "TripleBuffer","y",,1) ; y=enable, n=disable (DirectX only)
  37. Zoom := IniReadCheck(settingsFile, "Settings", "Zoom","2",,1) ; 4=zoom max , 0=no zoom, use any value between 0 and 4
  38. scanlines := IniReadCheck(settingsFile, "Settings", "scanlines","0",,1) ; 0=none, 40=black, use any value in between 0 and 40
  39. vSync := IniReadCheck(settingsFile, "Settings", "vSync","1",,1) ; 0=disable, 1=enable, 2=vsync + timer (special vsync for windowed mode)
  40. vDriver := IniReadCheck(settingsFile, "Settings", "vDriver","1",,1) ; 0=DirectX, 1=OpenGL
  41. xRes := IniReadCheck(settingsFile, "Settings", "xRes","1280",,1)
  42. yRes := IniReadCheck(settingsFile, "Settings", "yRes","1024",,1)
  43. bitDepth := IniReadCheck(settingsFile, "Settings", "bitDepth","32",,1)
  44. DisplayRes := IniReadCheck(settingsFile, "Settings", "DisplayRes","n",,1) ; Display screen resolution for troubleshooting
  45. UseNoMousy := IniReadCheck(settingsFile, "Settings", "UseNoMousy","true",,1) ; Use NoMousy tool to hide the mouse. If false, will move mouse off the screen instead
  46.  
  47. BezelStart("FixResMode")
  48.  
  49. If systemName contains pcfx,pc-fx
  50. meini = pcfx.ini
  51. Else
  52. meini = pce.ini
  53.  
  54. MEINI := CheckFile(emuPath . "\" . meini,"Could not find " . emuPath . "\" . meini . "`nPlease run Magic Engine manually first so it is created for you.")
  55. If UseNoMousy = true
  56. noMousyFile := CheckFile(moduleExtensionsPath . "\nomousy.exe","You have UseNoMousy enabled in the module, but could not find " . moduleExtensionsPath . "\nomousy.exe")
  57. If systemName contains CD,pcfx,pc-fx
  58. {
  59. CheckFile(emuPath . "\SYSCARD3.PCE","Cannot find " . emuPath . "\SYSCARD3.PCE`nThis file is required for CD systems when using Magic Engine.")
  60. If vdEnabled = true
  61. VirtualDrive("get") ; populates the vdDriveLetter variable with the drive letter to your scsi or dt virtual drive
  62. Else
  63. ScriptError("You are running a CD-based system with Magic Engine but do not have Virtual Drive enabled. Please enable Virtual Drive support`, it is required to run CD systems with this module.")
  64. }
  65. If InStr(systemName,"CD")?"":" -cd"
  66.  
  67. ; Now let's update all our keys if they differ in the ini
  68. iniLookup =
  69. ( ltrim c
  70. video, windowed, %Windowed%
  71. video, wide, %WideScreenMode%
  72. video, desktop, %DesktopMode%
  73. video, fullscreen, %FullscreenStretch%
  74. video, high_res, %HighResMode%
  75. video, filter, %Filter%
  76. video, triple_buffer, %TripleBuffer%
  77. video, Zoom, %Zoom%
  78. video, scanlines, %scanlines%
  79. video, vsync, %vSync%
  80. video, driver, %vDriver%
  81. video, screen_width, %xRes%
  82. video, screen_height, %yRes%
  83. video, screen_depth, %bitDepth%
  84. cdrom, drive_letter, %vdDriveLetter%:
  85. misc, screen_resolution, %DisplayRes%
  86. )
  87. Loop, Parse, iniLookup, `n
  88. {
  89. StringSplit, split, A_LoopField, `,, %A_Space%%A_Tab%
  90. IniRead, tempVar, %MEINI%, %split1%, %split2%
  91. If ( tempVar != split3 )
  92. IniWrite, % split3, %MEINI%, %split1%, %split2%
  93. }
  94.  
  95. hideEmuObj := Object("MagicEngine ahk_class MagicEngineWindowClass",1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  96. 7z(romPath, romName, romExtension, 7zExtractPath)
  97.  
  98. HideEmuStart()
  99.  
  100. If systemName contains CD,pcfx,pc-fx ; your system name must have "CD" in it's name
  101. {
  102. VirtualDrive("mount",romPath . "\" . romName . romExtension)
  103. Run, % executable . " syscard3.pce" . (If InStr(systemName,"CD")?"":" -cd"), %emuPath%
  104. }Else
  105. Run, %executable% "%romPath%\%romName%%romExtension%", %emuPath%
  106.  
  107. WinWait("MagicEngine ahk_class MagicEngineWindowClass")
  108. WinWaitActive("MagicEngine ahk_class MagicEngineWindowClass")
  109.  
  110. If UseNoMousy = true
  111. Run, %noMousyFile% /hide ; hide cursor
  112. Else
  113. MouseMove %A_ScreenWidth%,%A_ScreenHeight%
  114.  
  115. BezelDraw()
  116. HideEmuEnd()
  117. FadeInExit()
  118. Process("WaitClose", executable)
  119.  
  120. If systemName contains CD,pcfx,pc-fx
  121. VirtualDrive("unmount")
  122. If UseNoMousy = true
  123. Run, %noMousyFile% ; unhide cursor
  124.  
  125. 7zCleanUp()
  126. BezelExit()
  127. FadeOutExit()
  128. ExitModule()
  129.  
  130.  
  131. CloseProcess:
  132. FadeOutStart()
  133. WinClose("MagicEngine ahk_class MagicEngineWindowClass")
  134. Return
  135.  
  136. Esc::Return ; this prevents the quick flash of Hyperspin when exiting with fade on. You can still exit with Esc.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement