litchie / dospad

iDOS - DOSBox port on iOS
https://litchie.com/dospad
GNU General Public License v2.0
613 stars 132 forks source link

Suggestion - autoidos.bat #101

Closed xanthiacoder closed 1 week ago

xanthiacoder commented 3 years ago

Loving the ease of mounting with the new UI update on iPhone. was thinking what if the mounting process for .iDOS packages worked like mounting CDs in Windows which had autorun.inf?

Basically the idea is that when a person uses the Disk Drive to select an iDOS package, it will mount it and also auto-execute a batch file (was thinking autoidos.bat to ensure uniquely belonging to iDOS functionality)

This will allow people to make interesting iDOS packages (though might be a new can of worms if people pack malicious executions)

litchie commented 3 years ago

what if you just want to edit some files in the iDOS package? Having autorun will get in the way.

If you have autorun.bat in the root of package, running it is just "A TAB ENTER".

xanthiacoder commented 3 years ago

That's true. It's more for those who want a "no-brainer" kind of interaction where one .iDOS package only does one thing, like a wrapper for a single game.

Then launching from Files app gets you right into the game without needing anything on command line.

The MacOS has something like this called Boxer on MacOS for wrapping dosbox games.

xanthiacoder commented 3 years ago

Oh actually I am being silly. Just figured I can replicate the same effect of an .iDOS wrapper by just editing the cfg file to autoexec when opening the package. :)

litchie commented 3 years ago

Forgot to mention that.

xanthiacoder commented 3 years ago

I'm working on a Modular Loading system now, so when the Disk Drive functionality is updated with the auto-incremental drive letters, it's going to allow people to easily set up a running environment with modular functionality, and will minimise downloading redundant packages. my plan now is to organise my .iDOS packages this way:

(C)ore package - these .iDOS packages should always be loaded from Files which will then initialise a dosbox environment. I am working on a Default package and a FreeDOS package for now (D)rivers package (load as D:) - these .iDOS packages will contain additional files required for specific things to work, for eg, a GUS package for Gravis Ultrasound support (E)xtras package (load as E:) - .iDOS packages for any extra (misc) files (F)iles package (load as F:) - .iDOS packages for files and data, general storage area, userland (G)ames or (G)eneral package (loads as G:) - the main application that the modular environment is set up for. Will contain a batch file that when executed, will run idosinit.bat on all loaded drives to complete the Modular loading.

Hopefully this will make it easy for others to enjoy dynamic and powerful environments I will be putting together by just using Disk Drive to load packages in proper sequence.

litchie commented 3 years ago

I will definitely try to make the disk mount work better. However, what is wrong with all-in-one packages? The storage is so cheap these days.

xanthiacoder commented 3 years ago

Trying to follow the spirit of DOS, streamlining rather than bloat. I am planning to offer the packages I prepare for download at dosprogrammer.wordpress.com and thus making it modular would mean people save on time and bandwidth when grabbing things.

Instead of downloading multiple copies of ULTRASND folder for each game that is configured for GUS, people will only need to grab the Driver .iDOS package with ULTRASND once.

I'll be working on putting up all the games with ULTRASND support next on the site, then write some guides. Hope this will also drive more interest in iDOS being the best way to DOS on iOS.

MisutaaAsriel commented 3 years ago

Hmmm... It's not the most elegant solution, but, if all the .idos packages reside in the application storage folder, you should be able to mount them using mount [drive letter] ~/Documents/[package name].idos. (Note it is case sensitive in my experience!)

By crafting a carefully tooled AUTOEXEC.BAT in the "Game" package, you could test for, and mount, each iDOS package in succession. That way all the user has to do is launch the Game iDOS package from Files.

For example:

@ECHO OFF
CLS
MOUNT X ~/Documents/

;; ECHO. lines print a blank line, used for text formatting, ease of reading. :)

:core
;; 
;; Mounts the "core" system as S: and tests if it exists using "IF EXIST [Path]\NUL", which evaluates true if directory exists.
;; 
;; If core package is not successfully mounted, moves on to error routine.
;; 
ECHO.
ECHO Loading core system. Please wait...
ECHO.

MOUNT S ~/Documents/CorePackage.idos
IF EXIST S:\NUL GOTO coreinit
GOTO nocore

:coreinit
;; 
;; This batch file would handle setting of DOSBox variables and additional "Core" setup.
;; 
;; FYI: Many DOSBOX variables can be set from the command-line using:
;; CONFIG -SET "SECTION VARIABLE=VALUE"
;; E.G. CONFIG -SET "DOS XMS=FALSE"
;;
CALL S:\INIT.BAT
;; 
;; Moves on to drivers.
;; 
GOTO drivers

:nocore
;;
;; If core package cannot be successfully mounted, returns an error message, and the choice to try again.
;; 
ECHO.
ECHO ERROR: CorePackage.idos could not be found. Please check the directory and try again.
ECHO.
choice /n /c:yna "Try Again? [Y]es [N]o > "
if errorlevel==2 goto abort
if errorlevel==1 goto core
goto core

:drivers
;; 
;; Same as "core", but for drivers. Wash, rinse, repeat. Everything will be similar from here.
;; 
ECHO.
ECHO Loading device drivers. Please wait...
ECHO.
MOUNT D ~/Documents/SomeDriverPackage.idos
IF EXIST D:\NUL GOTO driverinit
GOTO nodrivers

:driverinit
CALL D:\INIT.BAT
GOTO extras

:nodrivers
ECHO.
ECHO ERROR: SomeDriverPackage.idos could not be found. Please check the directory and try again.
ECHO.
choice /n /c:yna "Try Again? [Y]es [N]o > "
if errorlevel==2 goto abort
if errorlevel==1 goto drivers
goto drivers

:extras
ECHO.
ECHO Loading additional system files. Please wait...
ECHO.
MOUNT E ~/Documents/ExtrasPackage.idos
IF EXIST E:\NUL GOTO extrasinit
GOTO noextras

:extrasinit
CALL E:\INIT.BAT
GOTO files

:noextras
ECHO.
ECHO ERROR: ExtrasPackage.idos could not be found. Please check the directory and try again.
ECHO.
choice /n /c:yna "Try Again? [Y]es [N]o > "
if errorlevel==2 goto abort
if errorlevel==1 goto extras
goto extras

:files
ECHO.
ECHO Loading user data. Please wait...
ECHO.
MOUNT F ~/Documents/Files.idos
IF EXIST F:\NUL GOTO filesinit
GOTO nofiles

:filesinit
CALL F:\INIT.BAT
GOTO success

:nofiles
ECHO.
ECHO ERROR: Files.idos could not be found. Please check the directory and try again.
ECHO.
choice /n /c:yna "Try Again? [Y]es [N]o > "
if errorlevel==2 goto abort
if errorlevel==1 goto files
goto files

:success
;; 
;; The routine to run when all mounts are successful.
;; 
CLS
C:\SOMEPROGRAM.EXE /OPTION VARIABLE
GOTO exit

:abort
CLS
ECHO.
ECHO Program load aborted... Press any key to return to the command prompt...
PAUSE

:exit
CLS
X:

Edited 4:26AM CT 7/29/2021 — Command Typos.

litchie commented 1 week ago

In latest version iDOS 3.1, if there is a autorun.bat under the root, it will be executed automatically.