Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;----------------------------------------------------------------------------
- ; Sinclair ZX Spectrum
- ; Spectaculator v7.51
- ; by djvj & brolly
- ; 1.2
- ;
- ; Notes:
- ; Install Spectaculator, on first run put in your registration info and uncheck the box on the Welcome to Spectaculator window.
- ; On your first exit, uncheck the box to show warning next time and click Yes.
- ;
- ; Games are run on 48k model by default, if you want to use a different model for a specific game you can set it on the Settings.ini file that
- ; is on the same dir as this script, Configuration example (the key names MUST match your rom name):
- ;
- ; [Fish! (Europe)]
- ; model=plus3
- ; [3D Space Wars (Europe)]
- ; model=16k
- ; [Xybots (Europe)]
- ; model=128k
- ;
- ; To set your res and ratio, goto Tools->Options->Advanced->Display
- ; To enable fullscreen, set the Fullscreen variable below to true
- ; Spectaculator stores its settings in the registry @ HKEY_CURRENT_USER\Software\spectaculator.com\Spectaculator\Settings
- ;----------------------------------------------------------------------------
- LoadingScreen = true
- ExitScreen = true
- Fullscreen = true
- loadingPic = Splash.jpg
- loadingPicW = 800
- loadingPicH = 600
- loadingColor = Black
- settingsFile := CheckFile(A_Scriptdir . "\Modules\" . systemName . "\Settings.ini")
- ; This gets rid of the emu window that pops up on launch
- If ( LoadingScreen = "true" ) {
- Gui +LastFound
- WinGet GUI_ID, ID
- Gui +AlwaysOnTop -Caption +ToolWindow
- Gui, Color, %loadingColor%
- loadXPos := ( A_ScreenWidth / 2 ) - ( loadingPicW / 2 )
- loadYPos := ( A_ScreenHeight / 2 ) - ( loadingPicH / 2 )
- Gui, Add, Picture,x%loadXPos% y%loadYPos%, %A_ScriptDir%\Modules\%systemName%\%loadingPic%
- Gui Show, x0 y0 h%A_ScreenHeight% w%A_ScreenWidth% Hide
- DllCall("AnimateWindow","UInt",GUI_ID,"Int",300,"UInt","0xa0000") ; animate in loading GUI
- }
- ; Read current ini & registry values so we know if they need to be updated for the chosen game
- currentFullScreen := ReadReg("Full Screen")
- currentModel := ReadReg("Model v6+")
- IniRead, iniModel, %settingsFile%, %romName%, model, 1 ; 1 is the default value, which is the 48k ZX Spectrum model
- ; Updating registry with desired model number if it is different
- If ( currentModel != iniModel ) {
- If ( iniModel = "128k" )
- WriteReg("Model v6+", 2)
- Else If (iniModel = "16k")
- WriteReg("Model v6+", 0)
- Else If (iniModel = "plus3")
- WriteReg("Model v6+", 5)
- Else
- WriteReg("Model v6+", 1) ; model 48k
- }
- ; Setting Fullscreen setting in registry if it doesn't match what user wants above
- If ( Fullscreen != "true" And currentFullScreen = 1 )
- WriteReg("Full Screen", 0)
- Else If ( Fullscreen = "true" And currentFullScreen = 0 )
- WriteReg("Full Screen", 1)
- Run, %executable% "%romPath%%romName%%romExtension%", %emuPath%
- WinWait, ahk_class SpectaculatorClass
- WinWaitActive, ahk_class SpectaculatorClass
- ; Detect when our emulator is fullscreen and then continue
- If ( Fullscreen = "true" ) {
- While ( FS_Active != 1 && WinActive(ahk_class SpectaculatorClass) ) {
- CheckFullscreen()
- Sleep, 50
- }
- }
- DllCall("SetMenu", uint, WinActive( "A" ), uint, 0) ; Removes the MenuBar
- DllCall("AnimateWindow",UInt,GUI_ID,UInt,500,UInt,0x90000) ; animate out loading GUI
- Gui Destroy
- Process, WaitClose, %executable%
- DllCall("AnimateWindow",UInt,GUI_ID2,UInt,250,UInt,0x90000) ; animate out exit GUI
- WinActivate, Hyperspin
- ExitApp
- ReadReg(var1) {
- RegRead, regValue, HKEY_CURRENT_USER, Software\spectaculator.com\Spectaculator\Settings, %var1%
- Return %regValue%
- }
- WriteReg(var1, var2) {
- RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\spectaculator.com\Spectaculator\Settings, %var1%, %var2%
- }
- ScriptError(error) {
- MsgBox,48,Error,%error%,5
- ExitApp
- }
- CheckFile(file) {
- IfNotExist, %file%
- {
- ScriptError("Cannot find " . file)
- ExitApp
- }
- return %file%
- }
- CheckFullscreen() {
- FS_ABM := DllCall( "RegisterWindowMessage", Str,"AppBarMsg" ), VarSetCapacity( FS_AppBarData,36,0 )
- FS_Off := NumPut(36,FS_AppBarData), FS_Off := NumPut( WinExist(A_ScriptFullPath " - AutoHotkey"), FS_Off+0 )
- FS_Off := NumPut(FS_ABM, FS_Off+0), FS_Off := NumPut( 1,FS_Off+0 ) , FS_Off := NumPut( 1, FS_Off+0 )
- DllCall( "Shell32.dll\SHAppBarMessage", UInt, 0x0, UInt,&FS_APPBARDATA )
- OnMessage( FS_ABM, "FS_Notify" )
- }
- FS_Notify( wParam, LParam, Msg, HWnd ) {
- Global FS_Active
- FS_Active := LParam
- }
- CloseProcess:
- If ( exitScreen = "true" ) {
- Gui +LastFound
- WinGet GUI_ID2, ID
- Gui +AlwaysOnTop -Caption +ToolWindow
- Gui Color, Black
- Gui Show, x0 y0 h%A_ScreenHeight% w%A_ScreenWidth% Hide
- DllCall("AnimateWindow","UInt",GUI_ID2,"Int",500,"UInt","0xa0000") ; animate in exit GUI
- }
- WinClose, ahk_class SpectaculatorClass
- Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement