Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv
- #Warn
- #UseHook on
- #SingleInstance force
- EnvGet, UserProfile, USERPROFILE
- global BackupPath := UserProfile . "\Desktop\DoomSaves\Any%"
- global SteamId := 0
- global DoomBasePath := UserProfile . "\Saved Games\id Software\DOOM\base\savegame.user"
- Loop, Files, %DoomBasePath%\*, D
- {
- SteamId := A_LoopFileName
- break
- }
- if (SteamId)
- {
- global SavePath := DoomBasePath . "\" . SteamId . "\GAME-AUTOSAVE0"
- }
- else
- {
- MsgBox, Unable to find Doom save folder, exiting...
- Exit
- }
- Gui, Font, s14
- Gui, Add, DropDownList, Readonly x5 y5 w550 h300 vDebug
- Gui, Show, x0 y0 w560 h40, Current Save
- LoadSaveList()
- ; ^Numpad5 = Copy Save
- ; ^Numpad7 = Backup Save
- ; ^Numpad8 = Previous Save
- ; ^Numpad2 = Next Save
- ^Numpad5::CopySave()
- ^Numpad7::CreateNewSave()
- ^Numpad8::MovePosition(-1)
- ^Numpad2::MovePosition(1)
- LoadSaveList()
- {
- GuiControl,, Debug, |
- Loop, Files, %BackupPath%\*, D
- {
- GuiControlGet, Debug
- GuiControl,, Debug, %A_LoopFileName%
- }
- MovePosition(1, false)
- Return
- }
- CopySave()
- {
- GuiControlGet, SelectedFile, , Debug, text
- SelectedFilePath := BackupPath . "\" . SelectedFile
- ; Sanity Checks
- if (InStr(SavePath, "GAME-AUTOSAVE")) and (StrLen(SelectedFile) > 1) and (FileExist(SavePath)) and (FileExist(SelectedFilePath))
- {
- FileDelete, %SavePath%\*.*
- FileCopy, %SelectedFilePath%\*, %SavePath%, 1
- }
- return
- }
- MovePosition(newPos, relative := true)
- {
- GuiControl, +AltSubmit, Debug
- GuiControlGet, CurrentPosition, , Debug
- GuiControl, -AltSubmit, Debug
- if (relative)
- {
- newPos := CurrentPosition + newPos
- }
- if (newPos > 0) and (newPos <= SaveCount())
- {
- GuiControl, Choose, Debug, %newPos%
- }
- }
- SaveCount()
- {
- count := 0
- Loop, Files, %BackupPath%\*, D
- count++
- return count
- }
- CreateNewSave()
- {
- InputBox, name, Enter Save Name
- if ErrorLevel = 0
- {
- nextFolderNumber := SubStr("000" . SaveCount() + 1, -2)
- fullPath := BackupPath . "\" . nextFolderNumber . " - " . name
- FileCreateDir, %fullPath%
- FileCopy, %SavePath%\*, %fullPath%, 1
- LoadSaveList()
- MovePosition(SaveCount(), false)
- }
- return
- }
- GuiClose:
- {
- Gui, Destroy
- ExitApp
- Return
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement