rfancella

Nestopia.ahk

Jun 8th, 2014
844
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.51 KB | None | 0 0
  1. MEmu = NestopiaMEmuV = v1.42
  2. MURL = http://www.emucr.com/2011/09/nestopia-unofficial-v1420.html
  3. MAuthor = djvj
  4. MVersion = 2.0.1
  5. MCRC = 472F9F52
  6. iCRC = 7BA5F4F9
  7. MID = 635038268908287546
  8. MSystem = "Nintendo Entertainment System","Nintendo Famicom","Nintendo Famicom Disk System"
  9. ;----------------------------------------------------------------------------
  10. ; Notes:
  11. ; If using this for Nintendo Famicom Disk System, make sure you place an FDS bios in your bios subfolder for your emu. You will have to select it on first launch of any FDS game.
  12. ; Set your fullscreen key to Alt+Enter if it is not already for HyperPause support
  13. ;----------------------------------------------------------------------------
  14. StartModule()
  15. BezelGUI()
  16. FadeInStart()
  17.  
  18.  
  19. settingsFile := modulePath . "\" . moduleName . ".ini"
  20. Fullscreen := IniReadCheck(settingsFile, "settings", "Fullscreen","true",,1)
  21. ExitKey := IniReadCheck(settingsFile, "settings", "ExitKey","Esc",,1)
  22. ToggleMenuKey := IniReadCheck(settingsFile, "settings", "ToggleMenuKey","Alt+M",,1)
  23. force4players := IniReadCheck(settingsFile, romName, "force4players","False",,1)
  24. bezelTopOffset := IniReadCheck(settingsFile, "Settings", "bezelTopOffset",16,,1)
  25. bezelBottomOffset := IniReadCheck(settingsFile, "Settings", "bezelBottomOffset",26,,1)
  26. bezelLeftOffset := IniReadCheck(settingsFile, "Settings", "bezelLeftOffset",7,,1)
  27. bezelRightOffset := IniReadCheck(settingsFile, "Settings", "bezelRightOffset",7,,1)
  28.  
  29. BezelStart()
  30.  
  31.  
  32. emuSettingsFile := emuPath . "\" . "nestopia.xml"
  33. FileRead, nesXML, %emuSettingsFile%
  34.  
  35.  
  36. IfInString, nesXML, % "<confirm-exit>yes</confirm-exit>" ; find if this setting is not the desired value
  37. StringReplace, nesXML, nesXML, % "<confirm-exit>yes</confirm-exit>", % "<confirm-exit>no</confirm-exit>" ; turning off confirmation on exit
  38. IfNotInString, nesXML, % "<exit>" . ExitKey . "</exit>" ; find if this setting is not the desired value
  39. { currentExitKey := StrX(nesXML,"<exit>" ,0,0,"</exit>",0,0) ; trim confirm-exit to what it's current setting is
  40. StringReplace, nesXML, nesXML, % currentExitKey, % "<exit>" . ExitKey . "</exit>" ; replacing the current exit key to the desired one from above
  41. }
  42. IfNotInString, nesXML, % "<toggle-menu>" . ToggleMenuKey . "</toggle-menu>" ; find if this setting is not the desired value
  43. { currentMenuKey := StrX(nesXML,"<toggle-menu>" ,0,0,"</toggle-menu>",0,0) ; trim toggle-menu to what it's current setting is
  44. StringReplace, nesXML, nesXML, % currentMenuKey, % "<toggle-menu>" . ToggleMenuKey . "</toggle-menu>" ; replacing the current toggle-menu key to the desired one from above
  45. }
  46.  
  47.  
  48. If force4players = true
  49. { IfInString, nesXML, % "<auto-select-controllers>yes</auto-select-controllers>" ; find if this setting is not the desired value
  50. StringReplace, nesXML, nesXML, % "<auto-select-controllers>yes</auto-select-controllers>", % "<auto-select-controllers>no</auto-select-controllers>" ; replacing the current toggle-menu key to the desired one from above
  51. StringReplace, nesXML, nesXML, % "<port-3>unconnected</port-3>", % "<port-3>pad3</port-3>"
  52. StringReplace, nesXML, nesXML, % "<port-4>unconnected</port-4", % "<port-4>pad4</port-4>"
  53. } Else
  54. IfInString, nesXML, % "<auto-select-controllers>no</auto-select-controllers>" ; find if this setting is not the desired value
  55. StringReplace, nesXML, nesXML, % "<auto-select-controllers>no</auto-select-controllers>", % "<auto-select-controllers>yes</auto-select-controllers>" ; replacing the current toggle-menu key to the desired one from above
  56.  
  57.  
  58. ; Enable Fullscreen
  59. currentFS := StrX(nesXML,"<start-fullscreen>" ,0,0,"</start-fullscreen>",0,0) ; trim start-fullscreen to what it's current setting is
  60. StringReplace, nesXML, nesXML, % currentFS, % "<start-fullscreen>" . ((If Fullscreen = "true")?"yes":"no") . "</start-fullscreen>" ; setting start-fullscreen to the desired setting from above
  61.  
  62.  
  63. SaveFile()
  64.  
  65.  
  66. 7z(romPath, romName, romExtension, 7zExtractPath)
  67.  
  68.  
  69. Run(executable . " """ . romPath . "\" . romName . romExtension . """", emuPath)
  70.  
  71.  
  72. WinActivate, romName - Nestopia
  73. WinWaitActive(romName . " - Nestopia")
  74.  
  75.  
  76. BezelDraw()
  77. FadeInExit()
  78. Process("WaitClose", executable)
  79. 7zCleanUp()
  80. BezelExit()
  81. FadeOutExit()
  82. ExitModule()
  83.  
  84.  
  85.  
  86.  
  87. SaveFile() {
  88. Global emuSettingsFile
  89. Global nesXML
  90. FileDelete, %emuSettingsFile%
  91. FileAppend, %nesXML%, %emuSettingsFile%, UTF-8
  92. }
  93.  
  94.  
  95. HaltEmu:
  96. ; Send, !{Enter}
  97. Sleep, 200
  98. Return
  99. RestoreEmu:
  100. WinActivate, ahk_id %emulatorID%
  101. ; Send, !{Enter}
  102. Return
  103.  
  104.  
  105. CloseProcess:
  106. FadeOutStart()
  107. WinClose("ahk_class Nestopia")
  108. Return
Advertisement
Add Comment
Please, Sign In to add comment