Go Back   Forums > Abandonia.com > Community News & Feedback > Proposition: A new way to store the games.
Memberlist Forum Rules Today's Posts
Search Forums:
Click here to use Advanced Search

Thread: Proposition: A new way to store the games. Reply to Thread
Your Username: Click here to log in
Image Verification
Please enter the six letters or digits that appear in the image opposite.

Title:
  
Message:
Post Icons
You may choose an icon for your message from the following list:
 

Additional Options
Miscellaneous Options

Topic Review (Newest First)
26-04-2012 11:51 PM
Japo It's a good idea, I've heard before people wishing DOSBox would run simple zip packages with zero configuration, similarly in practice to the way emulators for other platforms do.
26-04-2012 07:38 PM
Black Mage The script:

Code:
from zipfile import ZipFile
import tempfile
import sys
import glob
import os
import os.path
import shutil
import subprocess

dosboxPath = "/usr/bin/dosbox";

def runDosboxFile(dosboxFilePath):

	####
	## Extract the dosbox file to a temporary directory and close the file.
	####
	applicationPath = tempfile.mkdtemp("dosboxFile")

	with ZipFile(dosboxFilePath, "r") as dosboxFile:
	
		dosboxFile.extractall(applicationPath)
	
	####
	## Run dosbox.
	####
	dosboxConfPath = os.path.join(applicationPath, "dosbox.conf")
	
	if(os.path.exists(dosboxConfPath)):
		
		confString = "-conf %s" % dosboxConfPath
		echoString = ""
		
	else:
	
		confString = ""
		echoString = "-c \"@echo Couldn\'t find dosbox.conf file! will mount the main app directory as c:\" -c @pause"
	
	dosboxCommand = "%s . %s%s" % (dosboxPath, confString, echoString)

	dosboxProcess = subprocess.Popen(dosboxCommand, cwd=applicationPath, shell=True)
	
	dosboxProcess.wait()

	####
	## Create a new dosbox file with the altered data to replace the old one.
	####
	(baseName, dot, extension) = dosboxFilePath.rpartition(".")
	
	newDosboxFilePath = baseName + "_new" + dot + extension
	
	with ZipFile(newDosboxFilePath, "w") as newDosboxFile:
	
		for file in glob.iglob(os.path.join(applicationPath, "*")):
		
			newDosboxFile.write(file, os.path.basename(file))
		
	####
	## Remove the temporary directory and the old dosbox file, and rename the new dosbox file
	## to replace the old one.
	####	
	shutil.rmtree(applicationPath)
	
	os.remove(dosboxFilePath)

	os.rename(newDosboxFilePath, dosboxFilePath)

	
if __name__ == "__main__":

	if(len(sys.argv) == 1):
		
		print("usage: %s {dbfFilePath}\n" % sys.argv[0])
		print("\tdbfFilePath = The path to the .dbf file you want to open.")
		
		raw_input()
		
		exit(1)
		
	runDosboxFile(sys.argv[1])
26-04-2012 07:38 PM
Black Mage
Proposition: A new way to store the games.

I had this idea today.

We take some common archive format, zip, lzma, tar.gz. (we could also use tar only for the matter)

We "install" a game under dosbox if needed, so that it would be ready to be executed and played.

The directory the game is installed to will contain a good "dosbox.conf" file that will fit the game for most systems, plus autoexec lines to run the game, and exit when it closes.

If the game needs a cd folder or image, it will be also plased under its installed folder and
mounted in the dosbox.conf autoexec line.

A possible addon will be an "install.conf" to run the install program many games have.

we could also add some formatted text file containing info about the game.

when finished we archive the game with the chosen format, for example zip (since its
a format used in abandonia i chose it as an example).

we then change the extension from ".zip" to ".dbf" (or any other suggestion, dbf = dosbox file).

finally we associate this format with an application that i "wrote" (more on that in a sec)

The user dounloads the game and application. and all he/she needs to do, is double click
the file and play

-----

The application i wrote is a proof of the above concept, its not the best app, it doesnt do
all i want it to do, its slow and its buggy.

Its a python script that will accept as its only argument the above file* unpack it to a temporary folder, open it with dosbox (right now the dosbox path is hardcoded) and when finished will repack the temporary folder, delete the old package file and replace it with the new one.

i will post the source in a comment**, the important thing to note is that i can write a more serious version in "c" that will be fast, will contain an ncursers menu to enable the user
to configure the "dosbox.conf" file, to run "install.conf" to configure the installation and
show the game info in the txt i mentioned.

Who knows maybe if people like it and the dosbox team will like it, i could insert this
code as part as dosbox, or at least as a frontend on their site.

The reason i post this topic here before i wrote any c code, is that i want to see reactions
to the idea, feedback, and finally i need to know if with a good program (and not that python script of course) there is a chance that an awsome site like abandonia will use my proposed standard + app.

---

I want to add that the beauty of this format is that its eventually a common archive
file that any common archiving app can extract so people can still do what they want
with those files.



*The install.conf and txt description file are not included in this versions support.
**Note that there seems to be a bug with this script in windows so it might throw an exception that it cant delete the old file, and will leave both old file and a new file with the
new game data.

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

The current time is 09:54 PM (GMT)

 
Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.