Closed juhana closed 3 years ago
Oops, I should've thought of that. Is there any reason not to also anchor the tests in formats.js too?
I was thinking you could have a URL that doesn't end in a file extension like example.com/game.z8?version=2 or something similar so you'd need to add at least & and ? to the end. Optimally there would be a setting to override the automatic detection e.g. if you have a URL that doesn't have a file ending (I need to do default_story: [ "data:text/javascript,processBase64Zcode('" + data + "'); // .ulx .js" ]
to make it detect Glulx and use the correct loader)
Ahh, yeah that makes sense.
Do you need to use a data URL, or if you could simply pass a typed array to a launcher function would that be okay? I'd have thought data URLs are a last resort option, so happy to work out something else.
Yeah, if I could just pass in a typed array that would work best for me.
I saw in the snippets that you're doing this:
borogove.loader( function( data ) {
const extension = ( window.location.search.indexOf( "vm=quixe" ) > -1 ) ? "ulx" : "z8";
window.parchment_options = {
default_story: [ `data:text/javascript,processBase64Zcode('${data}'); // ${extension} .js` ],
lib_path: 'https://assets.borogove.app/interpreters/parchment/2/',
lock_options: 0,
lock_story: 0
};
// <script src="main.js" type="module"></s cript>
$.getScript( "https://assets.borogove.app/interpreters/parchment/2/main.js" );
});
Which is quite hacky.
So I'm thinking of the follow changes:
auto_launch: false
to parchment_options to not auto launchwindow.launch_parchment
you could call to launch it. I'm wondering what parameters would be best. I'm thinking it would take an object of options to again add on top of the other layers of options, and that I'll add a data
option to provide an Uint8array, and either format
or vm
option to specify the format and specific VM implementation.Does that sound like it would meet your needs?
That would indeed sound like the best solution, and that's close to how Quixe works (different launchers for different data inputs.)
Checking that the file extension exists anywhere in the filename will easily lead to choosing the wrong format, especially .gam (game.z8 is categorized as a TADS file.) Added
.
in front of all extensions and changed the I7 template to check the end of the file as Inform generates always the same extensions.