I think I need to re-frame my question, and explain my workflow.

I need a way to supply a file system to a emscripten-built game that has 
been located in a name space other than 'Module'

I have tried it many different ways, and they always end up with the same 
problem: the preamble from the file_packager.py ends up
negating my efforts to modularize the game.

For example:

I build the game using
<emccc>  .... -s EXPORT_NAME=\"Module_Game\" ---preload 
'/somelocalpath/gameassets@/'  --o game.js 

this creates two files:
game.js                                   - preamble FS + preamble 
EMSCRIPTEN + game code
gameassets.data                      - data file for my FS.

inside my html/JS page I will load the game
.
.
var Module_Game = {};
.
.
_Module.memoryInitializerPrefixURL = "./" + name + "/";              // I 
am locating the game code in a subfolder off this location of the root 
document page.
$.getScript( "./" + name + "/game.js", function(v)
{
         // do something
}


The PROBLEM when I tried to use some module name OTHER than 'Module' is 
seen in the game.js file
"
var Module;

if (typeof Module === 'undefined') Module = {};                   // Since 
I ( hosting web page ) didn't define 'Module' this bit of code will now 
assign it {}

< preamble code for the File system >

var Module;    
if (!Module) Module = (typeof Module_Game !== 'undefined' ? Module_Game : 
null) || {};
                                                                            
         // Since (!Module) is false because the above code, the following 
will not be setting up the 'Module_Game' object. I am hosed!

< preamble code for the Game >

 
I can hand edit this file and fix up the FS check on the 'Module' to fix my 
problem, but it would seem that my needs are fairly mainstream and I am 
hoping that I am just missing something.

Thanks for your consideration.

Regards,
Joe

 

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to