ISSUE #06 - Saving new/changed files, like saves & setup cfg

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.
User avatar
Phoenix
ECC Developer 2006-2016
Posts: 9057
Joined: 27 Aug 2006, 01:17
Location: Deventer, The Netherlands
Contact:

ISSUE #06 - Saving new/changed files, like saves & setup cfg

Unread post by Phoenix » 22 Dec 2009, 20:52

Ok, as we know...dosgames may write savegames or other files, and setup's may write cfg files ect, ect, now to catch these files i had this in mind:

1. Unpack the files (duh!)
2. Set all attributes to -R -H (remove readonly & hidden file attributes), this is to make files uniform...with these attributes removed
3. Set all file dates to a specific date, in this case 2000.01.01
4. GAME IS STARTED/CONFIGURED
5. when DOSBox closes the script will scan the folder for new or changed files (not equal to this date: 2000.01.01) and compresses these into a ZIP file with the game CRC32, like 5F8SDE4F.ZIP

now we have "catched" the saved files, the next time the game is started:

1. unpack the files...
2. check for CRC32 ZIP file with changed files....if exist then uncompress in game folder...
3. start game...
4. compress changed files again...

this is step 2 & 3:
(placed underneath the section UNZIP GAMEDATA)

Code: Select all

; === SETTING FILE ATTRIBUTES ===
ToolTip("Setting attributes...", $ClientRes[0]/2, $ClientRes[1]/2, "ECC DOSBox", 1, 2)
FileSetAttrib($GameOutputFolder & "\*.*", "-RH", 1)
FileSetTime($GameOutputFolder & "\*.*", "20000101", 0, 1)
ToolTip("")
example output:
Attachments
ecc_dosbox_datatime.png
ecc_dosbox_datatime.png (21.94 KiB) Viewed 700 times
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
Vicman
PLATINUM member
Posts: 1233
Joined: 17 Jun 2007, 16:12
Location: Germany,Bochum

ISSUE #06 - Saving new/changed files, like saves & setup cfg

Unread post by Vicman » 22 Dec 2009, 21:27

I feel.....we are almost there :swing:
Great Idea & Work, Phoenix ;)
imagepacks:
Done: Vic20, N64, Philips VG-5000 G7000 G7400, SordM5, Amstrad GX4000, Enterprise 64/128
Progress: Atari 8bit, Dosbox, Exelvision EXL 100
Vicman's eCC-Clips on You Tube

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

ISSUE #06 - Saving new/changed files, like saves & setup cfg

Unread post by Phoenix » 22 Dec 2009, 21:39

Hi Vicman,

Still a long way to go, but we will get there :sorcerer:
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: 9057
Joined: 27 Aug 2006, 01:17
Location: Deventer, The Netherlands
Contact:

Re: ISSUE #06 - Saving new/changed files, like saves & setup cfg

Unread post by Phoenix » 22 Dec 2009, 22:41

Ok, i've managed to let the script retrieve the changed files, but it seems i cannot make this work correctly if changed files are place in subdir, like "<gamefolder>\savegames\save001.sav", it will not store the folder "savegames" but only the file :wow:

to test this:

1. GET THE WHOLE SCRIPT in the topic above, it wil only start DOSBox, nothing more
2. start a game for dosbox....dosbox will startup
2. now place some other files into the just fresly extracted gamefolder (the script will be paused now until dosbox closes)
3. exit DOSBox
4. check your "ecc-script\dosbox\changedfiles" folder for ZIP files
5. as you may notice it has packed the changed files, but not the subdirs :wacko: , i used the "folder recurse" option "-r" and set the workfolder "-w", but it doesn't seem to work...

maybe you can help me with this section??

A PIECE of the code (get the whole code in another topic!!)

Code: Select all

; === RUN THE GAME === <<<DOES ONLY START DOSBOX FOR THE MOMENT!!!>>>
RunWait($Emulator)

; === CHECK FOR CHANGED FILES ===
ToolTip("Saving changed files...", $ClientRes[0]/2, $ClientRes[1]/2, "ECC DOSBox", 1, 2)
; Search for all files and put these in an array: $RFSarray
RecursiveFileSearch($GameOutputFolder, "(?i)\.(?)", "", 1, true, 0)
For $DOSFile in $RFSarray
	$FileTime = FileGetTime($DOSFile, 0, 0)
	If Not @error Then
		If $FileTime[0] & $FileTime[1] & $FileTime[2] <> "20000101" Then
		ShellExecuteWait($eccThirdParty7zip, " a -tzip -r " & $ChangedFilesZipFile & " " & $DOSFile & " -w" & Chr(34) & $GameOutputFolder & Chr(34), "", "", "")
		EndIf
	EndIf
Next
ToolTip("")
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: 9057
Joined: 27 Aug 2006, 01:17
Location: Deventer, The Netherlands
Contact:

Re: ISSUE #06 - Saving new/changed files, like saves & setup cfg

Unread post by Phoenix » 24 Dec 2009, 00:05

Ok now the section to unpack the changed files after setting the attributes, placed after 'SETTING FILE ATTRIBUTES':

Code: Select all

; === UNPACK CHANGED FILES ===
If FileExists($ChangedFilesZipFile) Then
	ToolTip("Unpacking changed files...", $ClientRes[0]/2, $ClientRes[1]/2, "ECC DOSBox", 1, 2)
	ShellExecuteWait($eccThirdParty7zip, " x " & $ChangedFilesZipFile & " -y -o" & $GameOutputFolder, "", "", "")
	ToolTip("")
EndIf
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

Who is online

Users browsing this forum: No registered users and 1 guest