db48x / emularity

easily embed emulators
GNU General Public License v3.0
620 stars 111 forks source link

load custom dosbox.conf #13

Closed veso266 closed 7 years ago

veso266 commented 7 years ago

Hi I would like to know how can I load custom dosbox.conf in emdosbox-loader (emularity) (what the difrence between emularity and emdosbox-loader (emularity is better right??)

I was using this code to load file from zip var emulator = new Emulator(document.querySelector("#canvas"), null, new DosBoxLoader(DosBoxLoader.emulatorJS("emulator/dosbox.js"), DosBoxLoader.nativeResolution(640, 400), DosBoxLoader.mountZip("c", DosBoxLoader.fetchFile("Game File", "emulator/win311-stock.zip")), DosBoxLoader.startExe("windows.bat"))) emulator.start({ waitAfterDownloading: true }); now I also have dosbox.conf in my zip so how can I load it in so emdosbox will recognize it?

Thanks for Anwsering and Best Regards

db48x commented 7 years ago

It should find it automatically, if you've included it in the zip file. Is this available somewhere yet where I can take a look at it?

veso266 commented 7 years ago

hi you can see it here: http://dosbox.dxing.si/network/example_dosbox.html zip file with config is here: http://dosbox.dxing.si/network/emulator/tm.zip

I am using emdosbox-loader here (should I use emularity instead (what the difrence??)

Thanks for Anwsering and Best Regards

db48x commented 7 years ago

Oh yes, please use Emularity instead; emdosbox-loader is its predecessor.

db48x commented 7 years ago

Ok, I've deleted the older repository; my apologies for the confusion.

veso266 commented 7 years ago

Hi thanks now it wokrs (you can check it out its on the same link)

PS: why are emulator files gziped (dosbox.js.gz) I am using my compiled version of emdosbox with modem and IPX support but theese files cought my attention PPS: What is the purpose of that function in example_dosbox.hrml: function locateAdditionalFiles(filename) { if (filename === "dosbox.html.mem") { return "emulators/em-dosbox/dosbox-sync.mem"; } return "emulators/em-dosbox/"+ filename; } I just comented it out because it had given me trouble and @kripten said .mem files are not required anymore

PPPS: is it posible to disable saving changes into browserFS temporarly (I don't want changes that I do inside dosbox being saved while I am testing) PPPPS: how to properly use this example: https://github.com/db48x/emularity/blob/master/example_ia.html (there are no game files passed to the emulator just one string)

Thanks for Anwsering and Best Regards

db48x commented 7 years ago

I'm glad to hear that it's working!

The emulator files are compressed because they are served up by archive.org, and that's how they do it.

The locateAdditionalFiles function is indeed quite rarely used. The DosBox emulator still needs it, although we're working on recompiling it at the moment. Once we finish that it won't be needed any more.

Hmm. No, at the moment there's no way to turn that off. You could however run your browser in Private Browsing/Incognito mode (depending on which browser it is) so that it doesn't have access to the IndexedDB.

And as for example_ia.html, you'll notice that this one uses IALoader instead of DosBoxLoader. IALoader takes a string and uses it as the name of an item on archive.org. It pulls the metadata from that item, and uses it to figure out what emulator to use. It then calls DosBoxLoader, MAMELoader, or SAELoader as needed to start the correct emulator. The game files all get loaded from archive.org.

veso266 commented 7 years ago

@db48x Thanks because I am using my own compiled version of em-dosbox I don't need that locateAdditionalFiles function

PS: IALoader looks interesting do you think you could provide me with backend for IALoader (what Internet Archive has) as that quite convenient to just pass name of an item and everything is figured out on its own (I would like to implement something like that) (for instance you pass Workbench_3 and IA loader would know that it needs Amiga emulator and it needs to load kickstarter rooms for it, or pass Telemate to it and it would know to use em-dosbox and the required zip file that has telemate in it kinda like Internet Archive has but on my own server instead of archive.org one

Thanks for Anwsering and Best Regards

db48x commented 7 years ago

In principle, sure. In practice it's not really worth it; you would need an XML file for every item, and a JSON file for every emulator, and all the urls and filenames would have to match exactly (aside from the host name, of course). It's much more concise to use the javascript interface to set things up.

veso266 commented 7 years ago

@db48x but I love challanges so if you could tell more on what need to be done to accomplish this what needs to be put in xml and json files for IA Loader to be able recognize everything

if its not worth it I would like to do this just for fun

Thanks for Anwsering and Best Regards

bengarrett commented 7 years ago

PPPS: is it posible to disable saving changes into browserFS temporarly (I don't want changes that I do inside dosbox being saved while I am testing)

If you're happy editing the JS script code.

Edit loader.js at line 862 there is a conditional if statement beginning with if (BrowserFS.FileSystem.IndexedDB.isAvailable()) {.

Above that line if you insert finish(); return;, that should disable the saving changes feature. Then comment it out when you want saving restored.

db48x commented 7 years ago

Well, I suppose. You can see this in the network tab when you load example_ia.html.

The first is IA's item metadata, which we load from http://cors.archive.org/cors/Pitfall_Activision_1982/Pitfall_Activision_1982_meta.xml. This has all of the metadata for the item, but Emularity only cares about the keys that start with "emulator" or "dosbox". If the metadata has properties like "dosbox_drive_c", "dosbox_drive_d", etc, then we'll load them by url (they're relative paths, with both the item name and the file name in them, such as "foo/bar.zip"). This is mostly used by Windows programs on IA so that they can all share one copy of Windows.

Then it loads the list of files in the item from http://cors.archive.org/cors/Pitfall_Activision_1982/Pitfall_Activision_1982_files.xml. If the metadata has an "emulator_ext" property, then we're looking for all files that have the extension it specifies.

Finally we load the emulator metadata from http://cors.archive.org/cors/emularity_engine_v1/a2600.json.

The combined list of files and the emulator metadata are then fed to the loader for the emulator.

In my opinion it's only worth using IALoader if you're really going to load from the Internet Archive. If you want something similar for your own site, then I recommend writing your own Loader along similar lines; that'll give you the opportunity to simplify the data that you have to load. IALoader is complex partly because archive.org's metadata is complex (after all, it hosts a lot more than just software, let alone video games).

I'm going to close this issue, since you've gotten it going. Feel free to open more if you have other questions or difficulties, of course.