Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ******************************************************************
- * File: Rbr-NGP-Switcher
- * Desc: Switches NGP Plugins and .ini`s for Richard Burns Rally.
- * Author: Sezen
- * Date: 10/16/2019
- * Version: 1.0
- ******************************************************************
- IDENTIFICATION DIVISION.
- PROGRAM-ID. RBR-NGP-SWITCHER.
- ENVIRONMENT DIVISION.
- INPUT-OUTPUT SECTION.
- DATA DIVISION.
- FILE SECTION.
- WORKING-STORAGE SECTION.
- 01 VERSION PIC 9.
- 01 RBR-DIR-IN PIC X(60).
- PROCEDURE DIVISION.
- MAIN-PROCEDURE.
- CALL 'DIR-CHECK' USING RBR-DIR-IN.
- CALL 'READ-VER' USING VERSION,RBR-DIR-IN.
- CALL 'COPY-FILES' USING VERSION,RBR-DIR-IN.
- STOP RUN.
- EXIT PROGRAM.
- *
- IDENTIFICATION DIVISION.
- PROGRAM-ID. DIR-CHECK.
- ENVIRONMENT DIVISION.
- INPUT-OUTPUT SECTION.
- FILE-CONTROL.
- SELECT IN-DIR ASSIGN "DIR.TXT"
- ORGANIZATION IS LINE SEQUENTIAL.
- DATA DIVISION.
- FILE SECTION.
- FD IN-DIR.
- 01 IN-DIR-LINE PIC X(32).
- WORKING-STORAGE SECTION.
- 01 FILE-DETAILS.
- 03 FD-FILESIZE PIC X(8) COMP-X.
- 03 FD-DATE.
- 05 FD-FILL PIC X(2) COMP-X.
- 05 FD-YEAR PIC X(2) COMP-X.
- 05 FD-FILLER PIC x(20) COMP-X.
- 01 FILE-NAME PIC X(80).
- 01 DIR-NAME PIC X(60).
- LINKAGE SECTION.
- 01 RBR-DIR-OUT PIC X(60).
- PROCEDURE DIVISION USING RBR-DIR-OUT.
- DISPLAY 'CHECKING DIR.TXT...'
- CALL 'CBL_CHECK_FILE_EXIST' USING 'DIR.TXT',FILE-DETAILS.
- IF RETURN-CODE = 0 THEN
- OPEN INPUT IN-DIR
- READ IN-DIR
- MOVE IN-DIR-LINE TO RBR-DIR-OUT
- CLOSE IN-DIR
- MOVE 'RICHARDBURNSRALLY.EXE' TO FILE-NAME
- STRING RBR-DIR-OUT DELIMITED BY ' ',FILE-NAME INTO
- DIR-NAME
- CALL 'CBL_CHECK_FILE_EXIST' USING DIR-NAME,FILE-DETAILS
- IF RETURN-CODE NOT = 0 THEN
- DISPLAY 'YOU ENTERED THE WRONG DIRECTORY... :/'
- DISPLAY 'TRY ENTERING IT AGAIN.'
- DISPLAY 'IF YOU ARE 100% SURE ITS GOOD, REPORT IT.'
- STOP RUN
- END-IF
- EXIT PROGRAM
- END-IF.
- DISPLAY 'NO DIR.TXT!'
- DISPLAY 'NOW WE WILL CHECK DIRS...'
- MOVE 'C:\GAMES\RICHARD BURNS RALLY\RICHARDBURNSRALLY.EXE'
- TO FILE-NAME.
- DISPLAY 'CALLING TO CHECK ' FILE-NAME.
- CALL 'CBL_CHECK_FILE_EXIST' USING FILE-NAME, FILE-DETAILS.
- IF RETURN-CODE = 0
- THEN
- DISPLAY 'EXISTS AT ' FILE-NAME
- MOVE 'C:\GAMES\RICHARD BURNS RALLY\ ' TO DIR-NAME
- CALL 'WRITE-OUT' USING 'DIR.TXT', DIR-NAME
- MOVE DIR-NAME TO RBR-DIR-OUT
- EXIT PROGRAM
- END-IF.
- DISPLAY 'WASNT THERE.'
- MOVE 'C:\PROGRAM FILES\RICHARD BURNS RALLY\RICHARD
- - 'BURNSRALLY.EXE' TO FILE-NAME.
- CALL 'CBL_CHECK_FILE_EXIST' USING FILE-NAME, FILE-DETAILS.
- IF RETURN-CODE = 0
- THEN
- MOVE 'C:\PROGRAM FILES\EIDOS\RICHARD BURNS RALLY' TO
- DIR-NAME
- CALL 'WRITE-OUT' USING 'DIR.TXT',DIR-NAME
- MOVE DIR-NAME TO RBR-DIR-OUT
- EXIT PROGRAM
- END-IF.
- DISPLAY 'PLEASE ENTER THE DIRECTORY RBR IS LOCATED IN
- - 'WITH ENDING \\ '
- ACCEPT DIR-NAME.
- CALL 'WRITE-OUT' USING 'DIR.TXT',DIR-NAME.
- MOVE DIR-NAME TO RBR-DIR-OUT.
- DISPLAY 'DONE! '
- CALL 'MAIN'.
- STOP RUN.
- EXIT PROGRAM.
- END PROGRAM DIR-CHECK.
- *
- IDENTIFICATION DIVISION.
- PROGRAM-ID. WRITE-OUT IS COMMON.
- ENVIRONMENT DIVISION.
- INPUT-OUTPUT SECTION.
- FILE-CONTROL.
- SELECT OUT-FILE ASSIGN TO LS-FILE-NAME
- ORGANIZATION IS LINE SEQUENTIAL.
- DATA DIVISION.
- FILE SECTION.
- FD OUT-FILE.
- 01 OUT-FILE-LINE PIC X(256).
- LINKAGE SECTION.
- 01 LS-FILE-NAME PIC X(25).
- 01 LS-DIR-NAME PIC X(60).
- PROCEDURE DIVISION USING LS-FILE-NAME, LS-DIR-NAME.
- DISPLAY 'WRITING...'
- CALL "CBL_CREATE_FILE" USING LS-FILE-NAME,3,3,0,0.
- OPEN OUTPUT OUT-FILE.
- WRITE OUT-FILE-LINE FROM LS-DIR-NAME.
- CLOSE OUT-FILE.
- EXIT PROGRAM.
- END PROGRAM WRITE-OUT.
- *
- IDENTIFICATION DIVISION.
- PROGRAM-ID. READ-VER.
- DATA DIVISION.
- WORKING-STORAGE SECTION.
- 01 FILE-SIZE PIC X(8) COMP-X.
- LINKAGE SECTION.
- 01 LS-VERSION PIC 9.
- 01 RBR-DIR PIC X(60).
- PROCEDURE DIVISION USING LS-VERSION,RBR-DIR.
- CALL 'CHECK-VER' USING FILE-SIZE,RBR-DIR.
- DISPLAY 'FILE SIZE: ' FILE-SIZE.
- IF FILE-SIZE = 778240 THEN
- DISPLAY '_____________________________'
- DISPLAY 'YOU ARE CURRENTLY ON... NGP5!'
- DISPLAY '-----------------------------'
- MOVE 5 TO LS-VERSION
- ELSE
- DISPLAY '_____________________________'
- DISPLAY 'YOU ARE CURRENTLY ON... NGP6!'
- DISPLAY '-----------------------------'
- MOVE 6 TO LS-VERSION
- END-IF.
- EXIT PROGRAM.
- END PROGRAM READ-VER.
- *
- IDENTIFICATION DIVISION.
- PROGRAM-ID. CHECK-VER IS COMMON.
- DATA DIVISION.
- WORKING-STORAGE SECTION.
- 01 TEMP-DIR PIC X(60).
- 01 WS-VERSION PIC X(5).
- 01 WS-FILE-DETAILS.
- 03 WS-FD-FILESIZE PIC X(8) COMP-X.
- 03 WS-FD-DATE.
- 05 WS-FD-FILL PIC X(2) COMP-X.
- 05 WS-FD-YEAR PIC X(2) COMP-X.
- 05 WS-FD-FILLER PIC X(50) COMP-X.
- LINKAGE SECTION.
- 01 LS-FILE-SIZE PIC X(8) COMP-X.
- 01 RBR-DIR PIC X(60).
- PROCEDURE DIVISION USING LS-FILE-SIZE,RBR-DIR.
- STRING RBR-DIR,'PLUGINS\PhysicsNG.dll' DELIMITED BY ' '
- INTO TEMP-DIR.
- DISPLAY 'DISPLAYING...'
- display TEMP-DIR.
- CALL 'CBL_CHECK_FILE_EXIST' USING TEMP-DIR, WS-FILE-DETAILS.
- MOVE WS-FD-FILESIZE TO LS-FILE-SIZE.
- EXIT PROGRAM.
- END PROGRAM CHECK-VER.
- *
- IDENTIFICATION DIVISION.
- PROGRAM-ID. COPY-FILES.
- DATA DIVISION.
- WORKING-STORAGE SECTION.
- 01 VERSION-STR PIC X(5).
- 01 FILE-NAME PIC X(15).
- 01 TEMP PIC X(60).
- 01 RBR-T PIC X(88).
- LINKAGE SECTION.
- 01 VERSION PIC 9.
- 01 RBR-DIR PIC X(60).
- PROCEDURE DIVISION USING VERSION,RBR-DIR.
- DISPLAY 'OUR RBR DIR IS: ' RBR-DIR.
- IF VERSION = 5 THEN MOVE 'NGP5\ ' TO VERSION-STR
- ELSE MOVE 'NGP6\ ' TO VERSION-STR
- END-IF.
- *
- * SAVE 'carListUser.ini' TO NGP FOLDERS.
- *
- CALL 'NGP-STR' USING VERSION-STR,'carListUser.ini ',TEMP.
- * FILE LENGTH = 15
- CALL 'RBR-STR' USING RBR-DIR,'RBRCIT\carListUser.ini ',
- RBR-T.
- * FILE LENGTH = 26
- DISPLAY 'SAVING carListUser.ini TO ' TEMP.
- CALL 'CBL_COPY_FILE' USING RBR-T,TEMP.
- *
- * SAVE CARS.INI
- *
- CALL 'NGP-STR' USING VERSION-STR,'Cars.ini ',TEMP.
- CALL 'RBR-STR' USING RBR-DIR,'Cars\Cars.ini ',
- RBR-T
- DISPLAY 'SAVING Cars.ini TO ' TEMP.
- CALL 'CBL_COPY_FILE' USING RBR-T,TEMP.
- * RESET VERSION NUMBER
- *
- IF VERSION = 5 THEN MOVE 'NGP6\ ' TO VERSION-STR
- ELSE MOVE 'NGP5\ ' TO VERSION-STR
- END-IF.
- *
- * REPLACE NEW 'PhysicsNG.dll'
- *
- DISPLAY 'REPLACING PhysicsNG.dll...'
- CALL 'RBR-STR' USING RBR-DIR,'Plugins\PhysicsNG.dll ',
- RBR-T.
- CALL 'NGP-STR' USING VERSION-STR,'PhysicsNG.DLL ',TEMP.
- CALL 'CBL_COPY_FILE' USING
- TEMP,RBR-T.
- *
- * REPLACE NEW 'carListUser.ini'
- *
- DISPLAY 'REPLACING carListUser.ini...'
- CALL 'RBR-STR' USING RBR-DIR,'RBRCIT\carListUser.ini ',
- RBR-T.
- CALL 'NGP-STR' USING VERSION-STR,'carListUser.ini ',TEMP.
- CALL 'CBL_COPY_FILE' USING TEMP,RBR-T.
- *
- * REPLACE NEW 'Cars.ini'
- *
- DISPLAY 'REPLACING Cars.ini...'
- CALL 'RBR-STR' USING RBR-DIR,'Cars\Cars.ini ',
- RBR-T.
- CALL 'NGP-STR' USING VERSION-STR,'Cars.ini ',TEMP.
- CALL 'CBL_COPY_FILE' USING TEMP,RBR-T
- *
- * REPLACE NEW 'carList.ini'
- *
- DISPLAY 'REPLACING carList.ini...'
- CALL 'NGP-STR' USING VERSION-STR,'carList.ini ',TEMP.
- CALL 'RBR-STR' USING RBR-DIR,'RBRCIT\carlist\carList.ini',
- RBR-T.
- CALL 'CBL_COPY_FILE' USING
- TEMP,RBR-T.
- *
- * FINISHING UP...
- *
- DISPLAY 'ALL DONE!'.
- STOP RUN.
- END PROGRAM COPY-FILES.
- *
- IDENTIFICATION DIVISION.
- PROGRAM-ID. NGP-STR IS COMMON.
- DATA DIVISION.
- LINKAGE SECTION.
- 01 VERSION-STR PIC X(5).
- 01 FILE-STR PIC X(20).
- 01 OUTPUT-STR PIC X(95).
- PROCEDURE DIVISION USING VERSION-STR,FILE-STR,OUTPUT-STR.
- STRING VERSION-STR,FILE-STR INTO OUTPUT-STR.
- EXIT PROGRAM.
- END PROGRAM NGP-STR.
- *
- IDENTIFICATION DIVISION.
- PROGRAM-ID. RBR-STR IS COMMON.
- DATA DIVISION.
- LINKAGE SECTION.
- 01 RBR-DIR PIC X(60).
- 01 FILE-DIR PIC X(26).
- 01 OUT-STR PIC X(88).
- PROCEDURE DIVISION USING RBR-DIR,FILE-DIR,OUT-STR.
- STRING RBR-DIR DELIMITED BY ' ' FILE-DIR INTO OUT-STR.
- DISPLAY OUT-STR.
- EXIT PROGRAM.
- END PROGRAM RBR-STR.
- *
- END PROGRAM RBR-NGP-SWITCHER.
- * TO-DO:
- * UNPACKER
- * UPDATE CHECK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement