rfancella

BeebEM WIP.ahk

Feb 21st, 2015
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. MEmu = BeebEm
  2. MEmuV = v4.14
  3. MURL = http://www.mkw.me.uk/beebem/index.html
  4. MAuthor = brolly
  5. MVersion = 1.0
  6. MCRC = A4929607
  7. iCRC = 4EC57BED
  8. mId = 635599773229077671
  9. MSystem = "Acorn BBC Micro"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; Make sure you set your user data folder to Emulator_Path\UserData, for this start BeebEm and
  13. ; go to Options-Preference Options-Select User Data Folder
  14. ;
  15. ; Supported Models:
  16. ; BBC Model B
  17. ; BBC Model B + Integra-B
  18. ; BBC Model B Plus
  19. ; BBC Master 128
  20. ;----------------------------------------------------------------------------
  21.  
  22. StartModule()
  23. BezelGUI()
  24. FadeInStart()
  25.  
  26. settingsFile := modulePath . "\" . moduleName . ".ini"
  27. configFile := emuPath . "\UserData\Preferences.cfg"
  28.  
  29. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  30. Model := IniReadCheck(settingsFile, romName, "Model" . "|" . romName,"0",,1)
  31. TapeSpeed := IniReadCheck(settingsFile, "Settings" . "|" . romName, "TapeSpeed","ee02",,1)
  32. SetTube := IniReadCheck(settingsFile, "Settings" . "|" . romName, "SetTube","false",,1)
  33. ChainCommand := IniReadCheck(settingsFile, romName, "ChainCommand","",,1)
  34. RunCommand := IniReadCheck(settingsFile, romName, "RunCommand","",,1)
  35.  
  36. StringUpper RunCommand, RunCommand
  37.  
  38. 7z(romPath, romName, romExtension, 7zExtractPath)
  39.  
  40. If romExtension not in .ssd,.dsd,.ad,.img,.uef
  41. ScriptError("The extension " . romExtension . " is not one of the known supported extensions for this emulator.")
  42.  
  43. If !FileExist(configFile)
  44. ScriptError("Preferences.cfg was not found at " . configFile)
  45.  
  46. If Model not in 0,1,2,3
  47. ScriptError("Model " . Model . " is not one of the known supported systems for this module: " . moduleName . ". Please use the option to configure the type of system needed through HyperlaunchHQ.")
  48.  
  49. configIni := LoadProperties(configFile) ; load the config into memory
  50. SetTube := If SetTube = "true" ? "01" : "00"
  51.  
  52. Params := Params . "-Data - -DisMenu "
  53. If ( romExtension = ".uef" ) { ;Tape
  54. Params := Params . " -KbdCmd ""OSCLI\s2\STAPE\s2\S\nPAGE\s-\S\s6\SE00\nCH.\s22\S\n"" "
  55. ;Alternatives
  56. ;Params := Params . " -KbdCmd ""OSCLI\s2\STAPE\s2\S\nOSCLI\s2\SRUN\s2\S\n"" "
  57. ;Params := Params . " -KbdCmd ""\s'\STAPE\nPAGE\s-\S\s6\SE00\nCHAIN \s22\S\n"" "
  58. ;Params := Params . " -KbdCmd ""\s'\STAPE\n\s'\SRUN\n"" "
  59. } Else If (ChainCommand) {
  60. Params := Params . " -KbdCmd """ . (If Model = "3" ? "\d0600\S\d0040" : "") . "CH.\s2\S" . ChainCommand . "\s2\S\n"" " ;Loading the Master 128 OS takes longer so we need to simulate a delay before starting to send the commands otherwise not all of it will get through. Then revert it back to the default value of 40ms.
  61. } Else If (RunCommand) {
  62. Params := Params . " -KbdCmd """ . (If Model = "3" ? "\d0600\S\d0040" : "") . "OSCLI\s2\SRUN " . RunCommand . "\s2\S\n"" " ;Loading the Master 128 OS takes longer so we need to simulate a delay before starting to send the commands otherwise not all of it will get through. Then revert it back to the default value of 40ms.
  63. }
  64. Params := Params . " """ . romPath . "\" . romName . romExtension . """"
  65.  
  66. ;Set the properties in the preferences.cfg file
  67. WriteProperty(configIni,"MachineType", "0" . Model)
  68. WriteProperty(configIni,"KeyMapping", "00009c62")
  69. WriteProperty(configIni,"TubeEnabled", SetTube)
  70. WriteProperty(configIni,"Tape Clock Speed", TapeSpeed)
  71. SaveProperties(configFile,configIni) ; save changes to Preferences.cfg
  72.  
  73. BezelStart()
  74.  
  75. Fullscreen := If Fullscreen = "true" ? "-FullScreen " : ""
  76.  
  77. Run(executable . " " . Fullscreen . Params, emuPath)
  78.  
  79. WinActivate, ahk_class BEEBWIN
  80. WinWaitActive("ahk_class BEEBWIN")
  81.  
  82. If bezelPath {
  83. WinGetPos,,, initialwidth,, ahk_class BEEBWIN
  84. W:=
  85. timeout := A_TickCount
  86. Loop {
  87. Sleep, 50
  88. WinGetPos,,, W,, ahk_class BEEBWIN
  89. If (W != initialwidth)
  90. Break
  91. If(timeout < A_TickCount - 2000)
  92. Break
  93. }
  94. }
  95. Sleep, 50
  96.  
  97. BezelDraw()
  98. FadeInExit()
  99. Process("WaitClose", executable)
  100. 7zCleanUp()
  101. BezelExit()
  102. FadeOutExit()
  103. ExitModule()
  104.  
  105.  
  106. CloseProcess:
  107. FadeOutStart()
  108. WinClose("ahk_class BEEBWIN")
  109. Return
Advertisement
Add Comment
Please, Sign In to add comment