'// SIMPLE LAUNCHER
'// CREATION DATE: 10/18/2020
'// AUTHOR: R.SCORPIO
'// VERY BASIC EMU LAUNCHER
'// WHATS NEW FOR OCTOBER 2020
'// - IMPLIMENTED A DB FOR BETTER ORGANIATION AND SEARCHING
'// - NOW HAS SEARCH FUNCTION TO FIND SPECIFIC GAME(S)
Const VERSION
= "20210310.1145" Const CONSOLE_DB
= "CONSOLES.DB"
'// GFX
Title
As String * 52 ' name of the console RomDBName
As String * 25 ' rom db name set by user, ext not required Extentions
As String * 25 ' accepted extensions EMUCmd
As String * 20 ' emu.exe to run the roms EMUParams
As String * 100 ' command line params EmuPath
As String * 256 ' path to emu.exe RomPath
As String * 256 ' path to roms for this console
Filename
As String * 120 ' filename of ROM
Dim Shared ROMS
As tROMS
' 2k for SNES,GBA which are most popular
showTitle
INIT ' Initialize to basic stuff
LOOP_MAIN:
Do ' loop for user choice MAIN_MENU
Loop Until ANS
= "X" ' kwwp loopinf unril user quits
HEADER "`6Exit Terminal Launch IV", 1
CENTER "`3Are you sure to want to exit `8[`7Y`8/`7N`8]", 5
'$include: 'UTILS.BI'
SELECTED_CONSOLE = 0
SELECTEDCONSOLE$ = "NONE"
EXIT_APP = FALSE
HEADER "`#S E T T I N G S", 1
LWRITELN "`t `#CONSOLE SETTINGS"
LWRITELN "`t `3======================="
LWRITELN "`t `%1`8. `7Add Console"
LWRITELN "`t `%2`8.`7 Edit Console"
LWRITELN "`t `%3`8.`7 Delete Console"
LWRITELN "`t `3------------------------"
LWRITELN "`t `40`8. `@EXIT SETTINGS"
NA:
HEADER "`4CONSOLE LIBRARY DOES NOT EXISTS", 1
CENTER "`%C`7ontinue....", 15
HEADER "`&CONSOLE SELECTION", 1
LIST_CONSOLES
HEADER "`%*", 15
LWRITE
"`0S`2elect `0C`2onsole`8: `$":
Input SELECTED_CONSOLE
HEADER "M A I N M E N U", 1
CENTER
"`6X `8= `7Exit Terminal Launch", 2:
Print
LWRITELN " `# _ _ _"
CENTER "`3[ `%P`7lay `3] `3[ `%S`7ettings `3] `3[ `%C`7onsole `3]", 4
LWRITELN "`8 | | |"
LWRITELN "`8 | | +--> `%C`7hange `%C`7urrent `%C`7onsole"
LWRITELN "`8 | |"
LWRITELN "`8 | +-----------------> `%T-L`7auncher `%S`7ettings"
LWRITELN "`8 |"
LWRITELN "`8 +----------------------------> `%S`7elect/`%P`7lay `%G`7ame"
CENTER "`#Currently Selected Console", 13
CENTER "`% NONE ", 15
CENTER
"`%" + _Trim$(CONSOLE_NAME
(SELECTED_CONSOLE
)), 15
CONSOLE_NAME$ = CONSOLE.Title
CENTER "`5T E R M I N A L L A U N C H E R", 2
CENTER "`3Organize/play all your EMUZ here", 4
Print Space$(15) + " ############################################" Print Space$(15) + " ############################################" Print Space$(15) + " #### ############################ ####" Print Space$(15) + " #### ############################ ####"
CENTER "`8app design by r.scorpio (c)2018-2021 `7v" + VERSION, 23
PAUSE 25
Sub SPLITSTR
(HAYSTACK
As String, NEEDLE
As String) ' SPLITS STRING BASED ON SPACE TODO: ADD FEATURE TO CHANGE NEEDLE
CNT = 1
SPLIT_EXT
(CNT
) = SPLIT_EXT
(CNT
) + Mid$(HAYSTACK
, I
, 1) CNT = CNT + 1
CENTER "`8 --`3------------=`!=`%[ " + TXT + " `%]=`!= `3------------`8-- ", Y
LWRITELN ("`8 - --`3------------------=`!=`%*`!=`3------------------`8-- - ")
SPIN(1) = "*": SPIN(2) = "/": SPIN(3) = "-"
SPIN(4) = "\": SPIN(5) = "|": SPIN(6) = "/"
SPIN(7) = "-": SPIN(8) = "\": SPIN(9) = "|"
x = 2
CENTER "`8 --`3------------=`!=`%[ " + SPIN(x) + " `%]=`!= `3------------`8-- ", 24
x
= x
+ 1:
If x
> 9 Then x
= 2
Case "Y": USER_INPUT
= 9 ' USED FOR YES/NO Case "N": USER_INPUT
= 0 ' USED FOR YES/NO
SPIN(1) = "*": SPIN(2) = "/": SPIN(3) = "-"
SPIN(4) = "\": SPIN(5) = "|": SPIN(6) = "/"
SPIN(7) = "-": SPIN(8) = "\": SPIN(9) = "|"
x = 2
CENTER "`8 --`3------------=`!=`%[ " + SPIN(x) + " `%]=`!= `3------------`8-- ", y
x
= x
+ 1:
If x
> 9 Then x
= 2
CENTER "`$THANKS FOR CHECKKNG OUT TERMINAL LANCHER IV!!", 8
CENTER "`$FOR INQUIRIES: RICKSCORPIO64@GMAIL.COM", 10
ConsoleCnt = 1
Get #2, ConsoleCnt
, CONSOLE
LWRITE
"`3":
Print CONSOLE.Title
ConsoleCnt = ConsoleCnt + 1
Print " _______ _____ _______ _______ ______ _______ _______ _______ " Print "| ___| \_ _|_ _| | | | | | __|" Print "| ___| -- || |_ | | | ---| - | |__ |" Print "|_______|_____/_______| |___| |______|_______|__|____|_______|"
Print "========================" LIST_CONSOLES
Print "------------------------"
Total_Records
= LOF(1) / Len(CONSOLE
) Print "1. Full title of console... ";
_Trim$(CONSOLE.Title
) Print "2. Database Name........... ";
_Trim$(CONSOLE.RomDBName
) Print "3. List extensions......... ";
_Trim$(CONSOLE.Extentions
) Print "4. Filename of emulator.... ";
_Trim$(CONSOLE.EMUCmd
) Print "5. Commandline Params...... ";
_Trim$(CONSOLE.EMUParams
) Print "6. Emulator Path........... ";
_Trim$(CONSOLE.EmuPath
) Print "7. Path for assoc. ROMS.... ";
_Trim$(CONSOLE.RomPath
) Print "0. Cancel Edit (no change)"
Case 1:
Input "Full title of console... "; CONSOLE.Title
Case 2:
Input "Database Name........... "; CONSOLE.RomDBName
Case 3:
Input "List extensions......... "; CONSOLE.Extentions
Case 4:
Input "Filename of emulator.... "; CONSOLE.EMUCmd
Case 5:
Input "Commandline Params...... "; CONSOLE.EMUParams
Case 6:
Input "Emulator Path........... "; CONSOLE.EmuPath
CONSOLE.EmuPath
= _Trim$(CONSOLE.EmuPath
)
Case 7:
Input "Path for assoc. ROMS.... "; CONSOLE.RomPath
CONSOLE.RomPath
= _Trim$(CONSOLE.RomPath
) If Right$(CONSOLE.RomPath
, 1) <> "\" Then CONSOLE.RomPath
= CONSOLE.RomPath
+ "\" Print "Changes SUCCESSFULLY applied";
DEL:
item = 1
Print " _____ _______ _____ ______ _______ _______ _______ " Print "| \| ___| |_ | | | | | __|" Print "| -- | ___| | | ---| - | |__ |" Print "|_____/|_______|_______| |______|_______|__|____|_______|"
Print "========================" LIST_CONSOLES
Print "------------------------"
Input "Select console to delete: ", ConsoleNum
Input "Are you sure? "; YN
RecNumber
= LOF(1) / Len(CONSOLE
)
ConsoleName
= _Trim$(CONSOLE.Title
)
item = item + 1
Kill DB_PATH
+ CONSOLE_DB
Name DB_PATH
+ "temp.db" As DB_PATH
+ CONSOLE_DB
LIST_CONSOLES
Print "Console " + ConsoleName
+ " was deleted SUCCESSFULLY!" Print "Press ENTER to continue..."
pt1 = ""
'IF INSTR(TXT, "(") > 0 THEN
' pt1 = LEFT$(TXT, INSTR(TXT, "(") - 1)
'
'ELSE
' pt1 = LEFT$(TXT, INSTR(TXT, ".") - 1)
'END IF
CENTER "`4Console not selected", 17
'CREATE A TXT FILE LIST FROM ROM PATH TO WORK WITH
'Delete the old romlist if it exists
'Need to split the space delimited string to an array
EXPLODE CONSOLE.Extentions
, Chr$(32), SPLIT_EXT
()
'Create new romlist.txt using given extentions (ext)
'this will be the raw filename - we will clean up the display below
'PRINT "DEBUG EXECUTING: " + "DIR " + _TRIM$(CONSOLE.RomPath) + _TRIM$(CONSOLE.Extentions) + " /B /A-D /ON >" + _TRIM$(CONSOLE.RomPath) + "ROMLIST.TXT"
LWRITELN
"`7Scanning `%" + _Trim$(CONSOLE.Title
) + "`7 folder":
Print
Print "scanning: " + SPLIT_EXT
(I
) Shell _Hide "DIR " + _Trim$(CONSOLE.RomPath
) + SPLIT_EXT
(I
) + " /B /A-D /ON >>" + _Trim$(CONSOLE.RomPath
) + "ROMLIST.TXT" LWRITELN
"`0Done...":
_Delay (2)
'Load the romlist.txt AND xfer cleaned title to the db
ROMS.Filename = ALINE
ROMS.title = CLEANROM(ALINE)
Close #2 ' roms text file Close #1 ' desired rom.db 'We're done, get out of here
HEADER "`$PLAY GAMES", 1
SELECT_CONSOLE
Close #1 ' straggler TODO FIX THIS FIND OUT WHERE IT IS AT
Get #1, SELECTED_CONSOLE
, CONSOLE
SELECT_GAME
'MAKE A DB FILE EACH TIME. HAPPENS SO FAST IT IS NOT NOTICABLE
'IF WE CHECK FOR EXISTING, IT DOES NOT UPDATE WHEN NEW FILES ARE ADDED TO
'THE FOLDER
CREATE_ROM_DB
(_Trim$(CONSOLE.RomDBName
) + ".db")
GAME_FOUND = 0
ROM_COUNT = 0
HEADER "`$GAME SELECTION", 1
LWRITELN "`4Currently if you just press enter, it will display all ROMS with"
LWRITELN "`4no scrolling. So suggest to use the partial search. Will fix this later"
LWRITE
"`2Enter partial gamename search`8: `#":
Input GAME_NAME
LWRITELN "`#5ID GAME NAME"
LWRITELN "`5============================================================="
If GAME_NAME
= "" Then Exit Sub ' return to menu - prevents the massive unscrollable list
GAME_FOUND = TRUE
' the following section just eyecandy for the id listing so it is
' proportional
'Input GAME_NAME ' dummy pause
PAUSE (24)
Close #1 ' clean up on exit early Input "Enter game ID or 0 to exit: "; I
' GET GAME ID AND RUN IT
' PRINT "DEBUG: "
' PRINT _TRIM$(CONSOLE.EmuPath) + _TRIM$(CONSOLE.EMUCmd) + " " + CHR$(34) + " " + _TRIM$(CONSOLE.EMUParams) + " " + CHR$(34) + _TRIM$(CONSOLE.RomPath) + _TRIM$(ROMS.Filename) + CHR$(34)
' PRINT "-----------------------------"
' PRINT
HEADER "ADD A CONSOLE TO THE LIBRARY", 1
Do ' ADDING ANOTHER CONSOLE? HEADER "`!Current Consoles", 1
LIST_CONSOLES
LWRITELN "`@No consoles in the library yet"
RecNumber
= LOF(1) / Len(CONSOLE
)
Input "Full title of console... "; CONSOLE.Title
Input "Database Name........... "; CONSOLE.RomDBName
Input "ROM extensions.......... "; CONSOLE.Extentions
Input "Filename of emulator.... "; CONSOLE.EMUCmd
Input "Commandline Params...... "; CONSOLE.EMUParams
LWRITELN "`$'-' `3to paste path(s)"
Input "Emulator Path........... "; CONSOLE.EmuPath
CONSOLE.EmuPath
= _Trim$(CONSOLE.EmuPath
) If Right$(CONSOLE.EmuPath
, 1) <> "\" Then CONSOLE.EmuPath
= CONSOLE.EmuPath
+ "\"
Input "Path for assoc. ROMS.... "; CONSOLE.RomPath
CONSOLE.RomPath
= _Trim$(CONSOLE.RomPath
) If Right$(CONSOLE.RomPath
, 1) <> "\" Then CONSOLE.RomPath
= CONSOLE.RomPath
+ "\"
Do:
Input "Everything Correct? (Y/n): "; YN
Put #1, RecNumber
+ 1, CONSOLE
Print "CONSOLE " + _Trim$(CONSOLE.Title
) + " addes successfully!" Do:
Input "Enter Another? (Y/n): "; YN