Advertisement
rfancella

BeebEM.ahk

Nov 26th, 2014
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.11 KB | None | 0 0
  1. MEmu = BeebEm
  2. MEmuV = v4.14
  3. MURL = http://www.mkw.me.uk/beebem
  4. MAuthor = craiganderson & rfancella
  5. MVersion = 1.3
  6. MCRC =
  7. iCRC =
  8. MID =
  9. MSystem = "Acorn BBC Micro"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ;The vast majority of images within the archive contain a BASIC loader file, so the following should suffice:
  13. ;
  14. ;This will happen auto if the file ext is .udf and it does not have " start)" in the file name:
  15. ;
  16. ;*TAPE
  17. ;PAGE=&E00
  18. ;CHAIN ""
  19. ;
  20. ;If it has " start)" in the file name, the module will enter this:
  21. ;
  22. ;*TAPE
  23. ;*RUN
  24. ;
  25. ;If the file extension is .ssd and has " start)" in the file name, it will enter:
  26. ;
  27. ;*RUN for you. I hope to make it extract the run name and enter it also soon.
  28. ;
  29. ;Added a key method. If you get a Bad Command when a game is run, try Method 2
  30. ;----------------------------------------------------------------------------
  31.  
  32. StartModule()
  33. BezelGUI()
  34. FadeInStart()
  35.  
  36. 7z(romPath, romName, romExtension, 7zExtractPath)
  37.  
  38. screensize := ""
  39. settingsFile := modulePath . "\" . moduleName . ".ini"
  40. inputBlock := IniReadCheck(settingsFile, "Settings", "inputBlock","true",,1)
  41. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  42. methodForKeys := IniReadCheck(settingsFile, "Settings", "methodForKeys",1,,1)
  43. startCommand := IniReadCheck(settingsFile, romName, "startCommand","",,1)
  44. keyDelay := IniReadCheck(settingsFile, "Settings" . "|" . romName, "keyDelay", "75",,1)
  45. SendCommandDelay := IniReadCheck(settingsFile, "Settings" . "|" . romName, "SendCommandDelay", "2000",,1)
  46. WaitBetweenSends := IniReadCheck(settingsFile, "Settings" . "|" . romName, "WaitBetweenSends", "false",,1)
  47.  
  48. CheckFile(moduleExtensionsPath . "\BlockInput.exe")
  49.  
  50. BezelStart()
  51. screensize := If Fullscreen = "true" ? "-fullscreen " : ""
  52.  
  53. If inputBlock = true
  54. {
  55. Run("BlockInput.exe 30", moduleExtensionsPath) ; start the tool that blocks all input so user cannot interrupt the launch process for 30 seconds
  56. }
  57.  
  58. Run(executable . " """ . romPath . "\" . romName . romExtension . """ " . screensize, emuPath)
  59. WinWait("ahk_class BEEBWIN")
  60. WinWaitActive("ahk_class BEEBWIN")
  61. BezelDraw()
  62. FadeInExit()
  63.  
  64. Sleep, 100
  65. SetKeyDelay, %keyDelay%, 100
  66.  
  67. If romExtension = .ssd
  68. {
  69. If (startCommand <> "")
  70. {
  71. If (methodForKeys = 2)
  72. {
  73. Send, {* down}{* up}{d down}{d up}{i down}{i up}{s down}{s up}{k down}{k up}{RETURN down}{RETURN up}
  74. Sleep, 100
  75. Send, {* down}{* up}{R down}{R up}{u down}{u up}{n down}{n up}{SPACE down}{SPACE up}
  76. StringSplit, commandArray, startCommand
  77. Loop, %commandArray0%
  78. {
  79. commandChar := commandArray%a_index%
  80. Send, {%commandChar% down}{%commandChar% up}
  81. }
  82. Send, {RETURN down}{RETURN up}
  83. Sleep, 100
  84. Send, {R down}{R up}{u down}{u up}{n down}{n up}{RETURN down}{RETURN up}
  85. } Else {
  86. Send, {@ down}{@ up}{d down}{d up}{i down}{i up}{s down}{s up}{k down}{k up}{RETURN down}{RETURN up}
  87. Sleep, 100
  88. Send, {@ down}{@ up}{R down}{R up}{u down}{u up}{n down}{n up}{SPACE down}{SPACE up}
  89. StringSplit, commandArray, startCommand
  90. Loop, %commandArray0%
  91. {
  92. commandChar := commandArray%a_index%
  93. Send, {%commandChar% down}{%commandChar% up}
  94. }
  95. Send, {RETURN down}{RETURN up}
  96. Sleep, 100
  97. Send, {R down}{R up}{u down}{u up}{n down}{n up}{RETURN down}{RETURN up}
  98. }
  99. }
  100. } Else If romExtension = .uef
  101. {
  102. startString := "(RUN start)"
  103. startUEF := InStr(romName, startString)
  104. If (startUEF > 0) || (startCommand <> "")
  105. {
  106. If (methodForKeys = 2)
  107. {
  108. Send, {* down}{* up}{t down}{t up}{a down}{a up}{p down}{p up}{e down}{e up}{ENTER down}{ENTER up}
  109. Sleep, 1000
  110. Send, {* down}{* up}{r down}{r up}{u down}{u up}{n down}{n up}{ENTER down}{ENTER up}
  111. } Else {
  112. Send, {@ down}{@ up}{t down}{t up}{a down}{a up}{p down}{p up}{e down}{e up}{ENTER down}{ENTER up}
  113. Sleep, 1000
  114. Send, {@ down}{@ up}{r down}{r up}{u down}{u up}{n down}{n up}{ENTER down}{ENTER up}
  115. }
  116. } Else {
  117. If (methodForKeys = 2)
  118. {
  119. Send, {* down}{* up}{t down}{t up}{a down}{a up}{p down}{p up}{e down}{e up}{ENTER down}{ENTER up}
  120. Sleep,1000
  121. Send, {p down}{p up}{a down}{a up}{g down}{g up}{e down}{e up}{= down}{= up}{& down}{& up}{e down}{e up}{0 down}{0 up}{0 down}{0 up}{ENTER down}{ENTER up}
  122. Sleep,1000
  123. Send, {c down}{c up}{h down}{h up}{a down}{a up}{i down}{i up}{n down}{n up}{@ down}{@ up}
  124. Sleep,100
  125. Send, {@ down}{@ up}{ENTER down}{ENTER up}
  126. } Else {
  127. Send, {~ down}{~ up}{t down}{t up}{a down}{a up}{p down}{p up}{e down}{e up}{ENTER down}{ENTER up}
  128. Sleep,1000
  129. Send, {p down}{p up}{a down}{a up}{g down}{g up}{e down}{e up}{_ down}{_ up}{^ down}{^ up}{e down}{e up}{0 down}{0 up}{0 down}{0 up}{ENTER down}{ENTER up}
  130. Sleep,1000
  131. Send, {c down}{c up}{h down}{h up}{a down}{a up}{i down}{i up}{n down}{n up}{@ down}{@ up}
  132. Sleep,100
  133. Send, {@ down}{@ up}{ENTER down}{ENTER up}
  134. }
  135. }
  136. }
  137.  
  138. If inputBlock = true
  139. {
  140. Process("Close", "BlockInput.exe") ; end script that blocks all input
  141. }
  142.  
  143. Process("WaitClose", executable)
  144. 7zCleanUp()
  145. BezelExit()
  146. FadeOutExit()
  147. ExitModule()
  148.  
  149. CloseProcess:
  150. FadeOutStart()
  151. WinClose("ahk_class BEEBWIN")
  152. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement