rfancella

Stella.ahk

Dec 8th, 2014
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.49 KB | None | 0 0
  1. MEmu = Stella
  2. MEmuV = v4.0
  3. MURL = http://stella.sourceforge.net/
  4. MAuthor = djvj & bleasby
  5. MVersion = 2.0.2
  6. MCRC = 5282CE19
  7. iCRC = 376895B4
  8. MID = 635038268926052339
  9. MSystem = "Atari 2600"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; If you want to use a hotkey to swap disks, assign one in HLHQ for this module
  13. ; Stella stores its config @ C:\Users\USERNAME\AppData\Roaming\Stella
  14. ; CLI docs @ emuPath\docs\index.html#CommandLine
  15. ;----------------------------------------------------------------------------
  16. StartModule()
  17. BezelGUI()
  18. FadeInStart()
  19.  
  20. settingsFile := modulePath . "\" . moduleName . ".ini"
  21. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  22. ; FullResolution := IniReadCheck(settingsFile, "Settings", "FullResolution","autoHL",,1) ; If autoHL, HL will set the fullscreenres to your current monitor res. If auto, Stella will try to use the maximum resolution for your screen. Otherwise set your desired res here WxH (ex 1920x1200)
  23. screenZoom := IniReadCheck(settingsFile, "Settings", "ScreenZoom","autoHL",,1) ; If autoHL, HL will set the zoom to maximize your gameplay area. Otherwise set your desired zoom as zoom2x, zoom3x, zoom4x or zoom5x.
  24. centerScreen := IniReadCheck(settingsFile, "Settings", "CenterScreen","true",,1) ; If true, center your gameplay screen
  25. DiskSwapKey := IniReadCheck(settingsFile, "Settings", "DiskSwapKey",,,1) ; swaps disk
  26.  
  27. bezelTopOffset := IniReadCheck(settingsFile, "Settings", "Bezel_Top_Offset","31",,1)
  28. bezelBottomOffset := IniReadCheck(settingsFile, "Settings", "Bezel_Bottom_Offset","8",,1)
  29. bezelLeftOffset := IniReadCheck(settingsFile, "Settings", "Bezel_Left_Offset","8",,1)
  30. bezelRightOffset := IniReadCheck(settingsFile, "Settings", "Bezel_Right_Offset","8",,1)
  31. BezelStart("fixResMode")
  32.  
  33. hideEmuObj := Object("Stella ahk_class SDL_app",1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  34. 7z(romPath, romName, romExtension, 7zExtractPath)
  35.  
  36. fullscreen := " -fullscreen " . (If fullscreen = "true" ? 1 : 0)
  37. centerScreen := " -center " . (If centerScreen = "true" ? 1 : 0)
  38.  
  39. ; fullResolution := If (FullResolution="autoHL") ? (A_ScreenWidth . "x" . A_ScreenHeight) : (If FullResolution = "auto" ? "auto" : FullResolution)
  40. If (screenZoom="autoHL") {
  41. gameRes := IniReadCheck(A_ScriptDir . "\Settings\" systemName . "\resolutions.ini", dbname, "Resolution","notFound",,1)
  42. StringSplit, res, gameRes, x
  43. If (A_ScreenWidth >= res1*6) and (A_ScreenHeight >= res2*6)
  44. screenZoom := 6
  45. Else If (A_ScreenWidth >= res1*5) and (A_ScreenHeight >= res2*5)
  46. screenZoom := 5
  47. Else If (A_ScreenWidth >= res1*4) and (A_ScreenHeight >= res2*4)
  48. screenZoom := 4
  49. Else If (A_ScreenWidth >= res1*3) and (A_ScreenHeight >= res2*3)
  50. screenZoom := 3
  51. Else
  52. screenZoom := 2
  53. }
  54. screenZoom := " -tia.zoom " . screenZoom
  55.  
  56. ; If FileExist(emuPath . "\basedir.txt") {
  57. ; FileRead, stellaIniPath, % emuPath . "\basedir.txt"
  58. ; stellaFile := CheckFile(stellaIniPath . "\stella.ini", "Stella.ini file not found on " . stellaIniPath . ".Please check the file " . emuPath . "\basedir.txt")
  59. ; } Else
  60. ; stellaFile := CheckFile(A_AppData . "\Stella\stella.ini")
  61.  
  62. ; stellaIni := LoadProperties(stellaFile) ; load the ini contents into memory
  63. ; stellaFullres := ReadProperty(stellaIni,"fullres") ; read value
  64. ; stellaTia_filter := ReadProperty(stellaIni,"tia_filter") ; read value
  65.  
  66. ; If !(stellaFullres = fullResolution) or !(stellaTia_filter = screenZoom) {
  67. ; WriteProperty(stellaIni,"fullres",fullResolution)
  68. ; WriteProperty(stellaIni,"tia_filter",screenZoom)
  69. ; SaveProperties(stellaFile,stellaIni)
  70. ; }
  71.  
  72. If DiskSwapKey
  73. XHotKeywrapper(DiskSwapKey,"DiskSwap")
  74.  
  75. HideEmuStart() ; This fully ensures windows are completely hidden even faster than winwait
  76.  
  77. ; This allows us to send variables, that when empty, are not sent to the Run command
  78. Run(executable . fullscreen . centerScreen . " """ . romPath . "\" . romName . romExtension . """ ", emuPath)
  79.  
  80. WinWait("Stella ahk_class SDL_app")
  81. WinWaitActive("Stella ahk_class SDL_app")
  82. Sleep, 700 ; Necessary otherwise the HyperSpin window flashes back into view
  83.  
  84. BezelDraw()
  85. HideEmuEnd()
  86. FadeInExit()
  87. Process("WaitClose", executable)
  88. 7zCleanUp()
  89. BezelExit()
  90. FadeOutExit()
  91. ExitModule()
  92.  
  93.  
  94. DiskSwap:
  95. Send, {RCtrl down}{R down}{R up}{RCtrl up} ; need to send the keys slow so stella recognizes them
  96. Return
  97.  
  98. RestoreEmu:
  99. Send, {Esc down}{Esc up}
  100. Return
  101.  
  102. CloseProcess:
  103. FadeOutStart()
  104. WinClose("Stella ahk_class SDL_app")
  105. Return
Advertisement
Add Comment
Please, Sign In to add comment