Jump to content

All my products and services are free. All my costs are met by donations I receive from my users. If you enjoy using any of my products, please donate to support me. My bare hosting costs are currently not met so please consider donating by either clicking this text or the Patreon link on the right.

Patreon

Recommended Posts

Posted

I've floated a simplified version of this idea before, but it didn't get much traction.. I've done a bit more work on it though, and I think its got potential, so here goes (again)...

Scenario: a rom set (eg: Future Pinball Original Tables - original content, not pirated, etc) may come (torrent)zipped.

Problems: wasted disk space. Some rom sets have multiple roms /tables/etc (ala Good/7zip support). To keep the set updated (and be a good torrent community citizen), you need to keep your original set. To play the tables though, you'll need to extract each table to disk. Retaining configs, hiscores, etc.

Solution: a wrapper which does the following:

1) takes in various command line arguments. eg: zipwrapper [.ROM extension] [rest of normal emulator command]. Because of its nature, I don't think this wrapper could be launched using the "Also Launch" method.

2) Extracts .zip file to temporary location. (same for every game, eg: C:\TEMP\EXTRACT). Don't overwrite existing files (or NEWER files)

3) COPY contents to a working directory (ie, where it will be run from) (unique per zipfile, eg: C:\GAMES\EMULATOR\ZIPFILENAMEWITHOUTTHEDOTZIPATTHEEND)

4) Process contents of working directory

- find all files matching .ROM extension

- either present a menu with the matches, or simply determine best fit using a predefined option ("closest matching filename", "most recent timestamp", etc)

5) Manipulate original command line string to reflect location of extracted contents. Invoke the emulator using that new commandline. Play game, etc.

6) When the game has exited, selectively move files from working directory to the temporary location (ie, steps 3 & 2 above, respectively), EXCEPT those files which have been modified in last x hours. This should leave only the files which are modifed in your working folder. Next time you play that table/game, those files (hence hiscores, custom settings etc) will still be there.

7) Now delete the contents C:\TEMP\EXTRACT.

ok.. now, I've got a working .vbs prototype which does this (seems to work perfectly), although I'm having trouble with the "automatically determine which rom I want" bit, but that shouldn't take much to iron out. At the moment, this one presents a menu to ask the user which one they want to use. Only problem with that, is that I need to turn off the Hide Desktop feature, otherwise the menu isn't visible.

Question time:

- Has anything like this been done before? (ie, am I reinventing the wheel?)

- Am thinking doing this in vbs might have some limitations, especially with the Hide Desktop thing. Might have a go at rewriting this Visual Studio or something. Any thoughts on this?

- How does the Hide Desktop feature work? will this uh.. hide.. all .exe's except the emulator.exe? Is there any way to allow a wrapper to be visible (ie, if multiple roms within an archive are found, present a menu asking the user which one, etc) with Hide Desktop enabled?

- Anyone else interested in this?

Posted
- Has anything like this been done before? (ie, am I reinventing the wheel?)

Nothing I know of that does all these things you've said. I think it's a good idea actually.

- Am thinking doing this in vbs might have some limitations, especially with the Hide Desktop thing. Might have a go at rewriting this Visual Studio or something. Any thoughts on this?

Your better off using Visual Studio IMHO. Obviously PleasureExtractor does similar things like extract files and rename stuff, so some of the basic code to do what you need I already have. Just need to tweak it and write a bunch of extra stuff. I do code primarily in C# but if it's easier for you to code in VB.NET I can still help out there.

- How does the Hide Desktop feature work? will this uh.. hide.. all .exe's except the emulator.exe? Is there any way to allow a wrapper to be visible (ie, if multiple roms within an archive are found, present a menu asking the user which one, etc) with Hide Desktop enabled?

AFAIK Hide Desktop is just a black window that pops up but I'm not 100% sure. That would explain why some software won't show with it turned on. I think as long as you BringWindowToTop() of Z order it should display over the Hide Desktop window. Anyway, if need be you can add a "Black Window" in the wrapper to hide the desktop yourself. Not sure why Tom doesn't have a timeout where the black window will disappear after a set amount of time. That would solve Hide Desktop not working for some games. Either way it can be solved in the wrapper easily enough.

- Anyone else interested in this?

Not really as I use PleasureExtractor and just have everything already extracted. I have the original set on my other PC that updates the set then I just copy across the new files when there is an update. I would just say "buy a new HDD" ;) But I'm happy to help you out with it though. I have a Zip library and example source in C# and VB.NET if you interested in going that way. Trust me on this, coding this in .NET will be a hell of a lot easier than coding it in vbs.

Posted
1) takes in various command line arguments. eg: zipwrapper [.ROM extension] [rest of normal emulator command]. Because of its nature, I don't think this wrapper could be launched using the "Also Launch" method.

I would say

zipwrapper.exe -zip <path_to_zip> -ext <extension> -search <fn=filename/fd=filedate> -cmd <command_line_args>

You wouldn't need to use the "Also Launch". All you need is to have a variable in zipwrapper. So here's an example.

zipwrapper.exe -zip "C:\Emulators\Future Pinball\My Table.zip" -ext fpt -search fd -cmd "Future Pinball.exe" /open "<ROM>" /play /exit

Notice the <ROM> that is the zipwrapper built in variable and you simply do a replace of <ROM> with the *.fpt file it finds in the archive. The way PleasureExtractor guesses the newest version of the fpt (since there are often a bunch of versions in the one archive) is using alphabetical sorting of the filenames. But you could have some extra command line options to specify the method of search (Eg. By filename, file date etc.)

2) Extracts .zip file to temporary location. (same for every game, eg: C:\TEMP\EXTRACT). Don't overwrite existing files (or NEWER files)

Not sure why you wouldn't have "dont overwrite existing files". The temp folder should be the users real temp folder, and there should be no files left in there after it's finished. That's Path.GetTempPath() in .NET.

3) COPY contents to a working directory (ie, where it will be run from) (unique per zipfile, eg: C:\GAMES\EMULATOR\ZIPFILENAMEWITHOUTTHEDOTZIPATTHEEND)

Run it from the user's temp folder then delete it later. It should be extracted into a folder and keep the existing file structure in the zip. Path.Combine() is what you would use when you get back the array of files from the extracted Zip file.

4) Process contents of working directory

- find all files matching .ROM extension

- either present a menu with the matches, or simply determine best fit using a predefined option ("closest matching filename", "most recent timestamp", etc)

Screw the menu, just have a few different methods of finding the best one. A menu is pretty easy to do anyway using .NET and GDI+ (System.Graphics namespace)

5) Manipulate original command line string to reflect location of extracted contents. Invoke the emulator using that new commandline. Play game, etc.

Yep for this you would use System.Diagnostics.Process namespace. Very easy to launch a program then wait for it to finish (Process.Exited event). Again using the <ROM> variable to replace the command line with the appropriate game (sRunCommand = sCommandLine.Replace("<ROM>", sFoundROM)).

6) When the game has exited, selectively move files from working directory to the temporary location (ie, steps 3 & 2 above, respectively), EXCEPT those files which have been modified in last x hours. This should leave only the files which are modifed in your working folder. Next time you play that table/game, those files (hence hiscores, custom settings etc) will still be there.

That's not too hard to do in .NET (nothing is too hard for .NET hehe). This is how I would do it. When you extract a zip file to the user's temp folder, the class I've written returns an array of all the full paths to each file in the extracted folder. Next you go through each file and get the date/time stamp for each file (File.GetLastWriteTime()). Then when it's finished check each time/date stamp and any files changed or added, zip them up into a little archive and store them in a special sub folder (Eg. SaveState) in the wrapper's Application.Startup folder (ie. Path.Combine(Application.Startup, "SaveState")) using the same name as the original zip file. Next time it extracts the zip it will check this folder for a matching zip, if found it will extract this zip over the top of the one extracted to the user's temp folder thus restoring any hiscores or custom settings.

7) Now delete the contents C:\TEMP\EXTRACT.

From Path.GetTempPath(). Sounds like you have a pretty good understanding of how it should work. I know how you would do it in C#/VB.NET. I'm happy to help you with this sounds like it would be a fun challenge. Definately doable in .NET ;) Let me know if you need any help. I've asked a few people on these forums to get into .NET and I'm happy to help people learn. Maybe we should keep the discussion of it open in this thread and post all the source code as we go so people can learn how to make a wrapper in .NET?

Posted
Not really as I use PleasureExtractor and just have everything already extracted. I have the original set on my other PC that updates the set then I just copy across the new files when there is an update. I would just say "buy a new HDD" ;)

Look mate, if I'm buying a new HDD, its going to be for hardcore european porn. Not some paltry redundant emulation files :P

I would say

zipwrapper.exe -zip <path_to_zip> -ext <extension> -search <fn=filename/fd=filedate> -cmd <command_line_args>

You wouldn't need to use the "Also Launch". All you need is to have a variable in zipwrapper. So here's an example.

zipwrapper.exe -zip "C:\Emulators\Future Pinball\My Table.zip" -ext fpt -search fd -cmd "Future Pinball.exe" /open "<ROM>" /play /exit

Notice the <ROM> that is the zipwrapper built in variable and you simply do a replace of <ROM> with the *.fpt file it finds in the archive. The way PleasureExtractor guesses the newest version of the fpt (since there are often a bunch of versions in the one archive) is using alphabetical sorting of the filenames. But you could have some extra command line options to specify the method of search (Eg. By filename, file date etc.)

Yep, thats definitely the way to go. In the current script, I had a couple of goofy if-then-else conditions in there to handle differences in the command line for things like visual pinball (needs a "-" in front of the table name or something like that.

Not sure why you wouldn't have "dont overwrite existing files". The temp folder should be the users real temp folder, and there should be no files left in there after it's finished. That's Path.GetTempPath() in .NET.

Yeah, my Cut & Paste skills failed me in that occasion.. the "don't overwrite existing files" thing was for the working folder bit, not the temporary folder bit..

Run it from the user's temp folder then delete it later. It should be extracted into a folder and keep the existing file structure in the zip. Path.Combine() is what you would use when you get back the array of files from the extracted Zip file.

Excellent, thanks for the tip(s).

Screw the menu, just have a few different methods of finding the best one. A menu is pretty easy to do anyway using .NET and GDI+ (System.Graphics namespace)

Yeah, was leaning that way.

From Path.GetTempPath(). Sounds like you have a pretty good understanding of how it should work. I know how you would do it in C#/VB.NET. I'm happy to help you with this sounds like it would be a fun challenge. Definately doable in .NET ;) Let me know if you need any help. I've asked a few people on these forums to get into .NET and I'm happy to help people learn. Maybe we should keep the discussion of it open in this thread and post all the source code as we go so people can learn how to make a wrapper in .NET?

Yeah definitely man, sounds like a great idea! Besides, I'll need all the help I can get :P

Guest
This topic is now closed to further replies.
×
×
  • Create New...