2
CLS
PRINT "Welcome to Ms Master 2.02 compact"
PRINT "Select an option"
PRINT "1. Configure Ms Master2.0"
PRINT "2. Restore Ms files from Backups"
PRINT "3. Bind Ms"
PRINT "4. Manage Templates"
PRINT "5. Backup Gamesaves"
PRINT "6. Restore Plugins"
PRINT "x. Exit"
INPUT g$
        IF g$ = "1" GOTO 10
        IF g$ = "2" GOTO 99
        IF g$ = "3" GOTO 300
        IF g$ = "4" GOTO 400
        IF g$ = "5" GOTO 500
        IF g$ = "6" GOTO 600
        IF g$ = "x" THEN END
        GOTO 2



10
REM config menu
REM +++++++++++
REM Driver generator 2.0
CLS
PRINT "Msmaster2.0 Configurator"
PRINT "What is the drive letter of your psp or ms reader? example f"
INPUT a$

11
PRINT "Did you install to the default folder? y/n"
INPUT c$
IF c$ = "y" GOTO 20
IF c$ = "n" GOTO 12
GOTO 11

12
CLS
PRINT "What is the path to msmaster2.0 folder ?"
PRINT "Please input the path you installed to"
print "If you use a filename with a space enter  as below"
PRINT "ie  c:\""program files""\"
print "if you use a filename with out a space enter as below"
print "ie c:\pspbackups\"
INPUT b$

REM generate ms1 inf

        OPEN "AUTORUN.inf" FOR OUTPUT AS #5
        PRINT #5, "[Autorun]"
        PRINT #5, "lable=PsP Memory Stick 1"
        PRINT #5, "icon=..\_mypendrive\icons\icon.ico"
        PRINT #5, "shell\progr0\command=" ; b$; "msmaster2.0\drivers\backupms.bat"
        PRINT #5, "shell\progr0=BACKUP MS1"
        PRINT #5, "shell\progr1\command=" ; b$; "msmaster2.0\drivers\bplug1.bat"
        PRINT #5, "shell\progr1=BACKUP MS1 Plugins"
        PRINT #5, "shell\progr2\command=" ; b$; "msmaster2.0\drivers\dumputil.bat"
        PRINT #5, "shell\progr2=Dump MS to Utils folder"
        PRINT #5, "shell\progr3\command="; b$; "msmaster2.0\drivers\autorun.bat"
        PRINT #5, "shell\progr3=Restore Utils to MS"
        CLOSE #5
PRINT " succesfully generated ms1 drivers"


REM move to temp dir
REM ________________
OPEN "move1.dat" FOR OUTPUT AS #2
PRINT #2, "XCOPY /h /r /y "; b$; "msmaster2.0\drivers\AUTORUN.inf "; b$; "temp"
CLOSE #2
                OPEN "move1.dat" FOR INPUT AS #2
                INPUT #2, e$
                SHELL e$
                CLOSE #2
                PRINT "succesfully moved"
		PRINT "press enter to continue"
                     INPUT t$
REM replace drivers with new files generated and moved above
REM ________________________________________________________

OPEN "move1b.dat" FOR OUTPUT AS #3
PRINT #3, "XCOPY /h /r /y "; b$; "temp\autorun.inf "; b$; "msmaster2.0\drivers\ms1"
CLOSE #3
                OPEN "move1b.dat" FOR INPUT AS #3
                INPUT #3, u$
                SHELL u$
                CLOSE #3
                PRINT "successfully replaced file"
                  


REM generate ms2 inf
REM ________________

        OPEN "autorun.inf" FOR OUTPUT AS #1
        PRINT #1, "[Autorun]"
        PRINT #1, "lable=PsP Memory Stick 2"
        PRINT #1, "icon=..\_mypendrive\icons\icon.ico"
        PRINT #1, "shell\progr0\command="; b$; "msmaster2.0\drivers\backupb.bat"
        PRINT #1, "shell\progr0=BACKUP MS2"
        PRINT #1, "shell\progr1\command="; b$; "msmaster2.0\drivers\bplug2.bat"
        PRINT #1, "shell\progr1=BACKUP MS2 Plugins"
        PRINT #1, "shell\progr2\command="; b$; "msmaster2.0\drivers\dumputil.bat"
        PRINT #1, "shell\progr2=Dump MS to Utils folder"
        PRINT #1, "shell\progr3\command="; b$; "msmaster2.0\drivers\autorun.bat"
        PRINT #1, "shell\progr3=Restore Utils to MS"
        CLOSE #1

REM move to temp dir
REM ________________
OPEN "move2.dat" FOR OUTPUT AS #2
PRINT #2, "XCOPY /i /h /r /y "; b$; "msmaster2.0\drivers\AUTORUN.inf "; b$; "temp"
CLOSE #2
                OPEN "move2.dat" FOR INPUT AS #2
                INPUT #2, e$
                SHELL e$
                CLOSE #2
                PRINT "succesfully moved"
             
REM replace drivers with new files generated and moved above
REM ________________________________________________________

OPEN "move2b.dat" FOR OUTPUT AS #3
PRINT #3, "XCOPY /i /h /r /y /d "; b$; "temp\autorun.inf "; b$; "msmaster2.0\drivers\ms2"
CLOSE #3
                OPEN "move2b.dat" FOR INPUT AS #3
                INPUT #3, u$
                SHELL u$
                CLOSE #3
                PRINT "successfully replaced file"

REM generate ms3 inf
REM ________________

        OPEN "autorun.inf" FOR OUTPUT AS #1
        PRINT #1, "[Autorun]"
        PRINT #1, "lable=PsP Memory Stick 3"
        PRINT #1, "icon=..\_mypendrive\icons\icon.ico"
        PRINT #1, "shell\progr0\command="; b$; "msmaster2.0\drivers\backupb.bat"
        PRINT #1, "shell\progr0=BACKUP MS3"
        PRINT #1, "shell\progr1\command="; b$; "msmaster2.0\drivers\bplug2.bat"
        PRINT #1, "shell\progr1=BACKUP MS3 Plugins"
        PRINT #1, "shell\progr2\command="; b$; "msmaster2.0\drivers\dumputil.bat"
        PRINT #1, "shell\progr2=Dump MS to Utils folder"
        PRINT #1, "shell\progr3\command="; b$; "msmaster2.0\drivers\autorun.bat"
        PRINT #1, "shell\progr3=Restore Utils to MS"
        CLOSE #1
             
REM ________________
OPEN "move3.dat" FOR OUTPUT AS #2
PRINT #2, "XCOPY /i /h /r /y "; b$; "msmaster2.0\drivers\AUTORUN.inf "; b$; "temp"
CLOSE #2
                OPEN "move3.dat" FOR INPUT AS #2
                INPUT #2, e$
                SHELL e$
                CLOSE #2
                PRINT "succesfully moved"
                

REM replace drivers with new files generated and moved above
REM ________________________________________________________

OPEN "move2b.dat" FOR OUTPUT AS #3
PRINT #3, "XCOPY /i /h /r /y /d "; b$; "temp\autorun.inf "; b$; "msmaster2.0\drivers\ms3"
CLOSE #3
                OPEN "move2b.dat" FOR INPUT AS #3
                INPUT #3, u$
                SHELL u$
                CLOSE #3
                PRINT "successfully replaced file"
                    

GOTO 40

REM Default installation settings
REM ________________________________


20
b$ = "c:\"


40
        OPEN "autorun.bat" FOR OUTPUT AS #1
        OPEN "backupms.bat" FOR OUTPUT AS #2
        OPEN "gamesave.dat" FOR OUTPUT AS #3
        OPEN "backupb.bat" FOR OUTPUT AS #5
        OPEN "gamesveb.dat" FOR OUTPUT AS #6
        OPEN "backupc.bat" FOR OUTPUT AS #7
        OPEN "gamesvec.dat" FOR OUTPUT AS #8
        OPEN "bind1.dat" FOR OUTPUT AS #9
        OPEN "bind2.dat" FOR OUTPUT AS #10
        OPEN "bind3.dat" FOR OUTPUT AS #11
        OPEN "resvea.dat" FOR OUTPUT AS #12
        OPEN "resveb.dat" FOR OUTPUT AS #13
        OPEN "resvec.dat" FOR OUTPUT AS #14
 


                PRINT #1, "XCOPY /e /h /r /y "; b$; "msmaster2.0\utils\* "; a$; ":\"
        CLOSE #1
                PRINT #2, "xcopy /e /h /r /y  "; a$; ":\* "; b$; "msmaster2.0\ms1\backup"
        CLOSE #2
                PRINT #3, "xcopy /e /h /r /y "; a$; ":\psp\savedata\* "; b$; "msmaster2.0\ms1\gamesaves"
        CLOSE #3
                PRINT #5, "xcopy /e /h /r /y  "; a$; ":\* "; b$; "msmaster2.0\ms2\backup"
        CLOSE #5
                PRINT #6, "XCOPY /e /h /r /y "; a$; ":\psp\savedata\* "; b$; "msmaster2.0\ms2\gamesaves"
        CLOSE #6
                PRINT #7, "XCOPY /e /h /r /y  "; a$; ":\* "; b$; "msmaster2.0\ms3\backup"
        CLOSE #7
                PRINT #8, "XCOPY /e /h /r /y "; a$; ":\psp\savedata\* "; b$; "msmaster2.0\ms3\gamesaves"
        CLOSE #8
                PRINT #9, "XCOPY /e /h /r /y "; b$; "msmaster2.0\drivers\ms1\* "; a$; ":\"
        CLOSE #9
                PRINT #10, "XCOPY /e /h /r /y "; b$; "msmaster2.0\drivers\ms2\* "; a$; ":\"
        CLOSE #10
                PRINT #11, "XCOPY /e /h /r /y "; b$; "msmaster2.0\drivers\ms3\* "; a$; ":\"
        CLOSE #11
                PRINT #12, "XCOPY /e /h /r /y "; b$; "msmaster2.0\ms1\gamesaves\* "; a$; ":\psp\savedata"
        CLOSE #12
                PRINT #13, "XCOPY /e /h /r /y "; b$; "msmaster2.0\ms2\gamesaves\* "; a$; ":\psp\savedata"
        CLOSE #13
                PRINT #14, "XCOPY /e /h /r /y "; b$; "msmaster2.0\ms3\gamesaves\* "; a$; ":\psp\savedata"
        CLOSE #14

        OPEN "rems1.dat" FOR OUTPUT AS #1
        OPEN "rems2.dat" FOR OUTPUT AS #2
        OPEN "rems3.dat" FOR OUTPUT AS #3
        OPEN "dumputil.bat" FOR OUTPUT AS #4
        OPEN "temp1.dat" FOR OUTPUT AS #5
        OPEN "temp2.dat" FOR OUTPUT AS #6
        OPEN "temp3.dat" FOR OUTPUT AS #7
        OPEN "check.dat" FOR OUTPUT AS #8
        OPEN "retmp1.dat" FOR OUTPUT AS #9
        OPEN "retmp2.dat" FOR OUTPUT AS #10
        OPEN "retmp3.dat" FOR OUTPUT AS #11


                PRINT #1, "XCOPY /e /h /r /y "; b$; "msmaster2.0\ms1\backup\* "; a$; ":\"
        CLOSE #1
                PRINT #2, "XCOPY /e /h /r /y "; b$; "msmaster2.0\ms2\backup\* "; a$; ":\"
        CLOSE #2
                PRINT #3, "XCOPY /e /h /r /y "; b$; "msmaster2.0\ms3\backup\* "; a$; ":\"
        CLOSE #3
                PRINT #4, "xcopy /e /h /r /y  "; a$; ":\* "; b$; "msmaster2.0\utils"
        CLOSE #4
                PRINT #5, "xcopy /e /h /r /y  "; a$; ":\* "; b$; "msmaster2.0\ms1\template"
        CLOSE #5
                PRINT #6, "xcopy /e /h /r /y  "; a$; ":\* "; b$; "msmaster2.0\ms2\template"
        CLOSE #6
                PRINT #7, "xcopy /e /h /r /y  "; a$; ":\* "; b$; "msmaster2.0\ms3\template"
        CLOSE #7
                PRINT #8, "y"
        CLOSE #8
                PRINT #9, "xcopy /e /h /r /y  "; b$; "msmaster2.0\ms1\template\* "; a$; ":\ "
        CLOSE #9
                PRINT #10, "xcopy /e /h /r /y "; b$; "msmaster2.0\ms2\template\* "; a$; ":\ "
        CLOSE #10
                PRINT #11, "xcopy /e /h /r /y "; b$; "msmaster2.0\ms3\template\* "; a$; ":\ "
        CLOSE #11


        OPEN "replug1.dat" FOR OUTPUT AS #1
        OPEN "replug2.dat" FOR OUTPUT AS #2
        OPEN "replug3.dat" FOR OUTPUT AS #3
        OPEN "bplug1.bat" FOR OUTPUT AS #4
        OPEN "bplug2.bat" FOR OUTPUT AS #5
        OPEN "bplug3.bat" FOR OUTPUT AS #6

                PRINT #1, "XCOPY /e /h /r /y "; b$; "msmaster2.0\ms1\seplugins\* "; a$; ":\seplugins"
        CLOSE #1
                PRINT #2, "XCOPY /e /h /r /y "; b$; "msmaster2.0\ms2\seplugins\* "; a$; ":\seplugins"
        CLOSE #2
                PRINT #3, "XCOPY /e /h /r /y "; b$; "msmaster2.0\ms3\seplugins\* "; a$; ":\seplugins"
        CLOSE #3
                PRINT #4, "xcopy /e /h /r /y  "; a$; ":\seplugins\* "; b$; "msmaster2.0\ms1\seplugins"
        CLOSE #4
                PRINT #5, "xcopy /e /h /r /y  "; a$; ":\seplugins\* "; b$; "msmaster2.0\ms2\seplugins"
        CLOSE #5
                PRINT #6, "xcopy /e /h /r /y  "; a$; ":\seplugins\* "; b$; "msmaster2.0\ms3\seplugins"
        CLOSE #6



        GOTO 2





REM REsTORE MENUS
REM ++++++++++++

99
CLS
PRINT "What do you want to restore?"
PRINT "1. Gamesaves"
PRINT "2. Backups"
PRINT "3. Templates"
PRINT "4. EXIT"
INPUT a$
        IF a$ = "1" GOTO 100
        IF a$ = "2" GOTO 200
        IF a$ = "3" GOTO 220
        IF a$ = "4" THEN END
        GOTO 99

100
        CLS
        PRINT "Restore Gamesaves from where?"
        PRINT "1. Ms1 Backups"
        PRINT "2. Ms2 Backups"
        PRINT "3. Ms3 Backups"
        PRINT "4. All Backups"
        PRINT "5. EXIT"
        INPUT b$
                IF b$ = "1" GOTO 110
                IF b$ = "2" GOTO 120
                IF b$ = "3" GOTO 130
                IF b$ = "4" GOTO 140
                IF b$ = "5" THEN END
                GOTO 100
110
REM restore ms1 gamesaves
REM ___________________
                        OPEN "RESVEA.dat" FOR INPUT AS #12
                        INPUT #12, e$
                        SHELL e$
                        CLOSE
                        END

120
REM restore ms2 gamesaves
REM ___________________
                        OPEN "RESVEB.dat" FOR INPUT AS #13
                        INPUT #13, e$
                        SHELL e$
                        CLOSE
                        END

130
REM restore ms3 gamesaves
REM ___________________
                        OPEN "RESVEV.dat" FOR INPUT AS #14
                        INPUT #14, e$
                        SHELL e$
                        CLOSE
                        END

140
REM restore all gamesaves
REM _____________________
                        OPEN "RESVEA.dat" FOR INPUT AS #12
                        INPUT #12, e$
                        SHELL e$
                        CLOSE

                        OPEN "RESVEB.dat" FOR INPUT AS #13
                        INPUT #13, f$
                        SHELL f$
                        CLOSE

                        OPEN "RESVEC.dat" FOR INPUT AS #14
                        INPUT #14, g$
                        SHELL g$
                        CLOSE

                        END



200
REM restore from backup
REM *******************
CLS
PRINT "Restore from What backup?"
PRINT "1. Ms1"
PRINT "2. Ms2"
PRINT "3. Ms3"
PRINT "4. EXIT"
INPUT d$
       
        IF d$ = "1" GOTO 211
        IF d$ = "2" GOTO 213
        IF d$ = "3" GOTO 215
        IF d$ = "4" THEN END
        GOTO 200
       
211
REM restore ms1 backup
REM __________________
                OPEN "REMS1.dat" FOR INPUT AS #12
                INPUT #12, e$
                SHELL e$
                CLOSE
                END

213
REM restore ms2 backup
REM __________________
                OPEN "REMS2.dat" FOR INPUT AS #12
                INPUT #12, e$
                SHELL e$
                CLOSE
                END

215
REM restore from ms3 backup
REM _______________________
                OPEN "REMS3.dat" FOR INPUT AS #12
                INPUT #12, e$
                SHELL e$
                CLOSE
                END

220
REM restore template
REM ****************
CLS
PRINT "Restore from What Template?"
PRINT "1. Ms1"
PRINT "2. Ms2"
PRINT "3. Ms3"
PRINT "4. EXIT"
INPUT d$
      
        IF d$ = "1" GOTO 221
        IF d$ = "2" GOTO 223
        IF d$ = "3" GOTO 225
        IF d$ = "4" THEN END
        GOTO 200
      
221
REM restore from ms1 template
REM _________________________
                OPEN "RETMP1.dat" FOR INPUT AS #12
                INPUT #12, e$
                SHELL e$
                CLOSE
                END

223
REM restore from ms2 template
REM _________________________
                OPEN "RETMP2.dat" FOR INPUT AS #12
                INPUT #12, e$
                SHELL e$
                CLOSE
                END

225
REM restore from ms3 template
REM _________________________
                OPEN "RETMP3.dat" FOR INPUT AS #12
                INPUT #12, e$
                SHELL e$
                CLOSE
                END





300
REM ms binding
REM **********
CLS
PRINT "What Ms do you want to bind to the inserted MS?"
PRINT "1. Ms1"
PRINT "2. Ms2"
PRINT "3. Ms3"
INPUT g$

        IF g$ = "1" GOTO 320
        IF g$ = "2" GOTO 340
        IF g$ = "3" GOTO 360
        GOTO 300

320
REM bind ms1
REM ________
                OPEN "BIND1.dat" FOR INPUT AS #12
                INPUT #12, e$
                SHELL e$
                CLOSE

END

340
REM bind ms2
REM ________
                OPEN "BIND2.dat" FOR INPUT AS #12
                INPUT #12, e$
                SHELL e$
                CLOSE
                END

360
REM bind ms3
REM ________
                OPEN "BIND3.dat" FOR INPUT AS #12
                INPUT #12, e$
                SHELL e$
                CLOSE
                END


400
REM template managment
REM ******************
CLS
PRINT "What do you wish to do?"
PRINT "1. Create Template from Current Ms"
PRINT "2. Format Template"
PRINT "x. EXIT"
INPUT k$
IF k$ = "1" GOTO 410
IF k$ = "2" GOTO 480
IF k$ = "x" THEN END
GOTO 400

410
REM Dump to template dir
REM ____________________
        CLS
        PRINT "What Ms Template would you like to Create?"
        PRINT "1. Ms 1 Template"
        PRINT "2. Ms 2 Template"
        PRINT "3. Ms 3 Template"
        PRINT "x. EXIT"
        INPUT j$
                IF j$ = "1" GOTO 420
                IF j$ = "2" GOTO 440
                IF j$ = "3" GOTO 460
                IF j$ = "x" THEN END
                GOTO 410

420
REM Dump MS1 template
REM _________________
                        OPEN "TEMP1.dat" FOR INPUT AS #12
                        INPUT #12, e$
                        SHELL e$
                        CLOSE
                        END

440
REM Dump ms2 template
REM _________________
                        OPEN "TEMP2.dat" FOR INPUT AS #12
                        INPUT #12, e$
                        SHELL e$
                        CLOSE
                        END

460
REM Dump ms3 template
REM _________________
                        OPEN "TEMP3.dat" FOR INPUT AS #12
                        INPUT #12, e$
                        SHELL e$
                        CLOSE
                        END


480
REM Template formating
REM ******************
PRINT "What Template do you want to Format?"
PRINT "1. Ms1 Template"
PRINT "2. Ms2 Template"
PRINT "3. Ms3 Template"
PRINT "x. EXIT"
INPUT k$
        IF k$ = "1" GOTO 485
        IF k$ = "1" GOTO 486
        IF k$ = "1" GOTO 487
        IF k$ = "x" THEN END
        GOTO 480

485
REM Format template ms1
REM ___________________
                SHELL "RMDIR c:\msmaster2.0\ms1\template\"
                SHELL "MKDIR c:\msmaster2.0\ms1\template\"
                INPUT p$
                END

486
REM Format template ms2
REM ___________________
                SHELL "RMDIR /s /q c:\msmaster2.0\ms2\template"
                SHELL "mkdir c:\msmaster2.0\ms2\template"
                END

487
REM Format template ms3
REM ___________________
                SHELL "RMDIR /s /q c:\msmaster2.0\ms3\template"
                SHELL "mkdir c:\msmaster2.0\ms3\template"
                END

500
REM Dump gamesaves
REM **************
CLS
PRINT "Where would you like to back up Gamesaves to?"
PRINT "1. Ms1 Gamesaves"
PRINT "2. Ms2 Gamesaves"
PRINT "3. Ms3 Gamesaves"
PRINT "x. EXIT"
INPUT y$
        IF y$ = "1" GOTO 520
        IF y$ = "2" GOTO 540
        IF y$ = "3" GOTO 560
        IF y$ = "4" THEN END
        GOTO 500

520
REM Dump to ms1
REM ___________
CLS
                        OPEN "GAMESAVE.dat" FOR INPUT AS #12
                        INPUT #12, e$
                        SHELL e$
                        CLOSE
                        END

540
REM dUMP TO MS2
REM ___________
CLS
                        OPEN "GAMESVEB.dat" FOR INPUT AS #12
                        INPUT #12, e$
                        SHELL e$
                        CLOSE
                        END
560
REM dUMP TO MS3
REM ___________
CLS
                        OPEN "GAMESVEC.dat" FOR INPUT AS #12
                        INPUT #12, e$
                        SHELL e$
                        CLOSE
                        END



600
REM Plugin restore
REM **************
CLS
PRINT "Which plugin backup would you like to restore to MS?"
PRINT "1. Ms1 plugins"
PRINT "2. Ms2 plugins"
PRINT "3. Ms3 plugins"
PRINT "x. EXIT"
INPUT l$
        IF l$ = "1" GOTO 620
        IF l$ = "2" GOTO 640
        IF l$ = "3" GOTO 660
        IF l$ = "x" THEN END
        GOTO 600

620
REM Restore ms1 plugins
REM *******************
CLS
                        OPEN "REPLUG1.dat" FOR INPUT AS #12
                        INPUT #12, e$
                        SHELL e$
                        CLOSE
                        END

640
REM Restore ms2 plugins
REM *******************
CLS
                        OPEN "REPLUG2.dat" FOR INPUT AS #12
                        INPUT #12, e$
                        SHELL e$
                        CLOSE
                        END


660
REM Restore ms2 plugins
REM *******************
CLS
                        OPEN "REPLUG3.dat" FOR INPUT AS #12
                        INPUT #12, e$
                        SHELL e$
                        CLOSE
                        END

