rem configuration validation 
rem ________________________

OPEN "CHECK.dat" FOR INPUT AS #1
 INPUT #1, e$ 
 if e$ = "y" goto 300
 if e$ = "n" goto 10
 print "There has been an error in your install please delete all files and reinstall"
print "press enter to quit"
input a$
end


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

11
cls
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



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



