ISSUE #04 - Configuring START & SETUP for game

This is a forum section for ideas howto implement and running DOS games in ECC (using DOSBox), this forum wil be temporally here until the problem is solved.
Locked [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
User avatar
Phoenix
ECC Developer 2006-2016
Posts: 9059
Joined: 27 Aug 2006, 01:17
Location: Deventer, The Netherlands
Contact:

Re: ISSUE #04 - Configuring START & SETUP for game

Unread post by Phoenix » 18 Dec 2009, 20:37

Hi All,

OK, further with this project :P, next to dosbox configs (wich will be handled lateron) it's also important to store the startupdata & configdata so the the script later known which file to run.

now...i can let the script store these data into a huge INI file, but i rather have seperated files for now...so i let the user select the startup & config file and let the script save this to an INI file wich has the same crc32 as the game, wich is stored into the folder 'ecc-script\dosbox\gamesettings'.

Code: Select all

; === CONFIGURE GAMESETTINGS (START & SETUP) ===
DirCreate($eccSystemEccFolder & "\ecc-script\dosbox\gamesettings")
$GameSettingsINI = $eccSystemEccFolder & "\ecc-script\dosbox\gamesettings\" & $eccFileRomCrc32 & ".ini"

; Configure startup file of the game
If IniRead($GameSettingsINI, "STARTUPDATA", "gamestart", "") = "" Then
$GameSelectStart = FileOpenDialog("select the file to START the game", $OutputFolder, "Executables (*.exe;*.com;*.bat)", 1)
If @error Then
    IniWrite($GameSettingsINI, "STARTUPDATA", "gamestart", "")
Else
    ;store only the startup file
   $GameSelectStart = StringSplit($GameSelectStart, "\")
   $GameSelectStart = $GameSelectStart[UBound($GameSelectStart)-1]
   IniWrite($GameSettingsINI, "STARTUPDATA", "gamestart", $GameSelectStart)
EndIf
EndIf

; Configure setup file of the game
If IniRead($GameSettingsINI, "STARTUPDATA", "gamesetup", "") = "" Then
$GameSelectSetup = FileOpenDialog("select the file to CONFIG/SETUP the game", $OutputFolder, "Executables (*.exe;*.com;*.bat)", 1)
If @error Then
    IniWrite($GameSettingsINI, "STARTUPDATA", "gamesetup", "")
Else
    ;store only the setup file
   $GameSelectSetup = StringSplit($GameSelectSetup, "\")
   $GameSelectSetup = $GameSelectSetup[UBound($GameSelectSetup)-1]
   IniWrite($GameSettingsINI, "STARTUPDATA", "gamesetup", $GameSelectSetup)
EndIf
EndIf
here is an example how it is stored this way:
ecc_dosbox_config.png
ecc_dosbox_config.png (26.29 KiB) Viewed 510 times
more soon!....stay tuned!!
Sebastiaan Ebeltjes | ECC Developer 2006-2016 | ECC Forum Admin | Phoenix Interactive WebMaster
[- ECC programs -]
eccUpdate, eccScriptSystem, GtkThemeSelect, DatFileUpdater (DFU), ImagePackCenter (IPC), eccDiagnostics, 3dGallery, iccImageInject
eccKameleonCode, eccCreateStartmenuShotcut, eccThirdPartyConfig (TPC), EmuMoviesDownloader (EMD), eccVideoPlayer
MobyGamesImporter (MGI), ECC Amiga GetGemusConfig.

User avatar
Phoenix
ECC Developer 2006-2016
Posts: 9059
Joined: 27 Aug 2006, 01:17
Location: Deventer, The Netherlands
Contact:

Re: ISSUE #04 - Configuring START & SETUP for game

Unread post by Phoenix » 20 Dec 2009, 11:23

Ok, to finish this, we also have to write data if the user "canceled" his selection (there is no setup file), and that it will not be asked again:

updated script section:

Code: Select all

; === CONFIGURE GAMESETTINGS (START & SETUP) ===
DirCreate($eccSystemEccFolder & "\ecc-script\dosbox\gamesettings")
$GameSettingsINI = $eccSystemEccFolder & "\ecc-script\dosbox\gamesettings\" & $eccFileRomCrc32 & ".ini"

; Configure STARTUP file of the game
Global $DosBoxGameStart = IniRead($GameSettingsINI, "STARTUPDATA", "gamestart", "")
If $DosBoxGameStart = "" Then
If $DosBoxGameStart <> "NotAvailable" Then
	$GameSelectStart = FileOpenDialog("select the file to START the game", $OutputFolder, "Executables (*.exe;*.com;*.bat)", 1)
	If @error Then
		IniWrite($GameSettingsINI, "STARTUPDATA", "gamestart", "NotAvailable")
	Else
		;store only the startup file
		$GameSelectStart = StringSplit($GameSelectStart, "\")
		$GameSelectStart = $GameSelectStart[UBound($GameSelectStart)-1]
		IniWrite($GameSettingsINI, "STARTUPDATA", "gamestart", $GameSelectStart)
	EndIf
EndIf
EndIf

; Configure SETUP file of the game
Global $DosBoxGameSetup = IniRead($GameSettingsINI, "STARTUPDATA", "gamesetup", "")
If $DosBoxGameSetup = "" Then
If $DosBoxGameSetup <> "NotAvailable" Then
	$GameSelectSetup = FileOpenDialog("select the file to CONFIG/SETUP the game", $OutputFolder, "Executables (*.exe;*.com;*.bat)", 1)
	If @error Then
		IniWrite($GameSettingsINI, "STARTUPDATA", "gamesetup", "NotAvailable")
	Else
		;store only the setup file
		$GameSelectSetup = StringSplit($GameSelectSetup, "\")
		$GameSelectSetup = $GameSelectSetup[UBound($GameSelectSetup)-1]
		IniWrite($GameSettingsINI, "STARTUPDATA", "gamesetup", $GameSelectSetup)
	EndIf
EndIf
EndIf


p.s. the code may seem to be a bit sloppy, but it seems autoit can't handle multiple operators at one line, something like:

Code: Select all

If $DosBoxGameSetup = "" Or <> "NotAvailable" Then
Sebastiaan Ebeltjes | ECC Developer 2006-2016 | ECC Forum Admin | Phoenix Interactive WebMaster
[- ECC programs -]
eccUpdate, eccScriptSystem, GtkThemeSelect, DatFileUpdater (DFU), ImagePackCenter (IPC), eccDiagnostics, 3dGallery, iccImageInject
eccKameleonCode, eccCreateStartmenuShotcut, eccThirdPartyConfig (TPC), EmuMoviesDownloader (EMD), eccVideoPlayer
MobyGamesImporter (MGI), ECC Amiga GetGemusConfig.

Locked
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 1 guest