rfancella

CCS64.ahk

Jun 8th, 2014
489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.06 KB | None | 0 0
  1. MEmu = CCS64
  2. MEmuV = v3.9
  3. MURL = http://www.ccs64.com/
  4. MAuthor = djvj
  5. MVersion = 2.0.2
  6. MCRC = 98AA8DCC
  7. iCRC = 2D6D3A54
  8. MID = 635038268878192501
  9. MSystem = "Commodore 64"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; To set fullscreen, set your VideoMode in HQ
  13. ; Does not support archived roms
  14. ; Not all roms autoload for an unknown reason
  15. ; fastload seems to not work
  16.  
  17. ; Supports prg, p00, p01, prg, t64, d64, g41, g64, tap, crt, c64
  18. ; CLI Syntax:
  19. ; CCS64 rom [-cfg filename] [-fastload] [-normalload] [-autorun] [-manualrun] [-window] [hardsid id]
  20. ;
  21. ;If you get an directX9 error while using bezel, increase the value of the Bezel_Resize_Sleep option.
  22. ;----------------------------------------------------------------------------
  23. StartModule()
  24. BezelGUI()
  25. FadeInStart()
  26.  
  27. hideEmuObj := Object("CCS64 ahk_class Afx:00400000:0",1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  28. 7z(romPath, romName, romExtension, 7zExtractPath)
  29.  
  30. If romExtension not in .c64,.crt,.d64,.g41,.g64,.p00,.p01,.prg,.t64,.tap
  31. ScriptError("Your rom has an extension of " . romExtension . ", only these extensions are supported:`nc64,crt,d64,g41,g64,p00,p01,prg,t64,tap")
  32.  
  33. settingsFile := modulePath . "\" . moduleName . ".ini"
  34. videoMode := IniReadCheck(settingsFile, "Settings", "VideoMode","1024x768x32",,1)
  35. bezelResizeSleep := IniReadCheck(settingsFile, "Settings", "Bezel_Resize_Sleep","2500",,1) ; sleep in order to avoid directx9 error when trying to resize the game window while he rom is still loading
  36. bezelTopOffset := IniReadCheck(settingsFile, "Settings", "bezelTopOffset",6,,1)
  37. bezelBottomOffset := IniReadCheck(settingsFile, "Settings", "bezelBottomOffset",21,,1)
  38. bezelLeftOffset := IniReadCheck(settingsFile, "Settings", "bezelLeftOffset",5,,1)
  39. bezelRightOffset := IniReadCheck(settingsFile, "Settings", "bezelRightOffset",5,,1)
  40.  
  41. VMarray := Object("Window 1x",0,"Window 2x",1,"Window 3x",2,"640x480x32",3,"720x480x32",4,"720x576x32",5,"800x600x32",6,"1024x768x32",7,"1152x864x32",8,"1280x720x32",9,"1280x768x32",10,"1280x800x32",11,"1280x960x32",12,"1280x1024x32",13,"1360x768x32",14,"1366x768x32",15,"1600x900x32",16,"1600x1024x32",17,"1600x1200x32",18,"1680x1050x32",19,"1920x1080x32",20,"1920x1200x32",21,"640x480x16",22,"720x480x16",23,"720x576x16",24,"800x600x16",25,"1024x768x16",26,"1152x864x16",27,"1280x720x16",28,"1280x768x16",29,"1280x800x16",30,"1280x960x16",31,"1280x1024x16",32,"1360x768x16",33,"1366x768x16",34,"1600x900x16",35,"1600x1024x16",36,"1600x1200x16",37,"1680x1050x16",38,"1920x1080x16",39,"1920x1200x16",40)
  42.  
  43. BezelStart()
  44.  
  45. videoMode := VMarray[videoMode]
  46. If !videoMode
  47. ScriptError("Invalid Parameters for the key videoMode in " . settingsFile . " under the section [Settings]")
  48.  
  49. If bezelPath ; forcing windowed mode on bezel if user did not set it on module options
  50. If (videoMode>2)
  51. videoMode := 2
  52.  
  53. ccs64File := emuPath . "\C64.cfg"
  54. IfNotExist, %ccs64File%
  55. FileAppend,, %ccs64File% ; emu does not create this automatically
  56. FileRead, ccs64CFG, %ccs64File%
  57.  
  58. ; Setting videoMode setting in CFG
  59. ccs64CFG := RegExReplace(ccs64CFG,"\$SCREENMODE=[0-9]+","$SCREENMODE=" . videoMode) ; setting windowed resolution
  60. SaveFile(ccs64CFG, ccs64File)
  61.  
  62. HideEmuStart()
  63.  
  64. SetTimer, ClearErrorMsg, 10
  65.  
  66. Run(executable . " """ . romPath . "\" . romName . romExtension . """"" -cfg ccs.cfg -autorun", emuPath)
  67.  
  68. WinWait("CCS64 ahk_class Afx:00400000:0")
  69. WinWaitActive("CCS64 ahk_class Afx:00400000:0")
  70.  
  71. If bezelPath
  72. Sleep, %bezelResizeSleep%
  73.  
  74. BezelDraw()
  75. HideEmuEnd()
  76. FadeInExit()
  77.  
  78. SetTimer, ClearErrorMsg, Off
  79.  
  80. Process("WaitClose", executable)
  81. 7zCleanUp()
  82. BezelExit()
  83. FadeOutExit()
  84. ExitModule()
  85.  
  86.  
  87. SaveFile(text,file) {
  88. FileDelete, %file%
  89. FileAppend, %text%, %file%
  90. }
  91.  
  92. ClearErrorMsg:
  93. Tooltip % az++
  94. IfWinExist, CCS64 ahk_class #32770
  95. { WinGetText, CCS64ErrorText, CCS64 ahk_class #32770
  96. If InStr(CCS64ErrorText,"Direct") {
  97. WinActivate, CCS64 ahk_class #32770
  98. Send, {Enter}
  99. }
  100. }
  101. Return
  102.  
  103. CloseProcess:
  104. FadeOutStart()
  105. WinClose("CCS64 ahk_class Afx:00400000:0")
  106. Return
Advertisement
Add Comment
Please, Sign In to add comment