db48x / emularity

easily embed emulators
GNU General Public License v3.0
621 stars 113 forks source link

I can't play other games... for example Thumblepop! #65

Closed ziogoku closed 4 years ago

ziogoku commented 4 years ago

Hi, I'm trying to launch Tumblepop but I can't do it.

The example of arcade: example_arcade.html, exaplains that we need to download the emulator and rom for game Targ, so I download mameexidy.js and targ.zip , and it work correctly (If I launch it from web server).

I try to change parameters to start Tumblepop, I found on https://archive.org/download/emularity_engine_v1/ the file tumblep.json:

`    
name "Tumble Pop (World)"
arcade "1"
js_filename "mamesupbtime.js.gz"
bios_filenames  
0 ""
peripherals  
0 ""
native_resolution  
0 320
1 240
extra_args=  
0 ""
driver "tumblep"
wasmjs_filename "mamesupbtime_wasm.js.gz"
wasm_filename "mamesupbtime_wasm.wasm.gz"
file_locations  
mamesupbtime_wasm.wasm "mamesupbtime_wasm.wasm.gz"

`

So I download mamesupbtime.js.gz as emulator from that site and put it on emulators/jsmess.

So I download rom .zip and put it in a path.

The code in the html is: var emulator = new Emulator(document.querySelector("#canvas"), null, new JSMAMELoader(JSMAMELoader.driver("tumblep"), JSMAMELoader.nativeResolution(320, 240), JSMAMELoader.scale(3), JSMAMELoader.emulatorJS("emulators/jsmess/mamesupbtime.js"), JSMAMELoader.mountFile("tumplep.zip", JSMAMELoader.fetchFile("Game File", "ROM/tumblep.zip") ))); emulator.start({ waitAfterDownloading: true });

(I added also the wasm)

When I launch I obtain that it load all resources, work untile open graphic canvas with: Loading Machine (0%)... it is died.

This is the console log:

`

loader.js:1000 Attempting load of mame.ini loader.js:1000 Attempting load of horizont.ini loader.js:1000 Attempting load of arcade.ini loader.js:1000 Attempting load of raster.ini loader.js:1000 Attempting load of source/supbtime.ini loader.js:1000 Attempting load of tumblep.ini loader.js:1000 Attempting load of mame.ini loader.js:1000 Attempting load of mame.ini loader.js:1000 Attempting load of horizont.ini loader.js:1000 Attempting load of arcade.ini loader.js:1000 Attempting load of raster.ini loader.js:1000 Attempting load of source/supbtime.ini loader.js:1000 Attempting load of tumblep.ini loader.js:1001 Calling stub instead of sigaction() loader.js:1001 Calling stub instead of sigaction() loader.js:1000 Available videodrivers: emscripten loader.js:1000 Current Videodriver: emscripten loader.js:1000 Display #0 loader.js:1000 Renderdrivers: loader.js:1000 opengles2 (0x0) loader.js:1000 software (0x0) loader.js:1000 Available audio drivers: loader.js:1000 emscripten
loader.js:1000 disk
loader.js:1000 dummy
loader.js:1000 Build version: 0.206 (mame0206-dirty) loader.js:1000 Build architecure:
loader.js:1000 Build defines 1: SDLMAME_UNIX=1 loader.js:1000 Build defines 1: LSB_FIRST=1 MAME_NOASM=1 loader.js:1000 SDL/OpenGL defines: SDL_COMPILEDVERSION=2007 USE_OPENGL=1 loader.js:1000 Compiler defines A: GNUC=4 GNUC_MINOR=2 GNUC_PATCHLEVEL=1 VERSION="4.2.1 Compatible Clang 6.0.1 " loader.js:1000 Compiler defines B: unix=1 loader.js:1000 Compiler defines C: loader.js:1000 Enter init_monitors loader.js:1000 Adding monitor screen0 (1920 x 1080) loader.js:1000 Leave init_monitors loader.js:1000 Enter sdlwindow_init loader.js:1000 Using SDL multi-window soft driver (SDL 2.0+) loader.js:1000 loader.js:1000 Hints: loader.js:1000 SDL_FRAMEBUFFER_ACCELERATION (null) loader.js:1000 SDL_RENDER_DRIVER (null) loader.js:1000 SDL_RENDER_OPENGL_SHADERS (null) loader.js:1000 SDL_RENDER_SCALE_QUALITY (null) loader.js:1000 SDL_RENDER_VSYNC (null) loader.js:1000 SDL_VIDEO_X11_XVIDMODE (null) loader.js:1000 SDL_VIDEO_X11_XINERAMA (null) loader.js:1000 SDL_VIDEO_X11_XRANDR (null) loader.js:1000 SDL_GRAB_KEYBOARD (null) loader.js:1000 SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS 0 loader.js:1000 SDL_IOS_IDLE_TIMER_DISABLED (null) loader.js:1000 SDL_IOS_ORIENTATIONS (null) loader.js:1000 SDL_XINPUT_ENABLED (null) loader.js:1000 Input: Adding keyboard #0: System keyboard (device id: System keyboard) loader.js:1000 Keyboard: Registered System keyboard loader.js:1000 Keyboard: End initialization loader.js:1000 Mouse: Start initialization loader.js:1000 Input: Adding mouse #0: System mouse (device id: System mouse) loader.js:1000 Mouse: Registered System mouse loader.js:1000 Mouse: End initialization loader.js:1000 Could not initialize SDL Haptic subsystem: SDL not built with haptic (force feedback) support. loader.js:1000 Joystick: Start initialization loader.js:1000 Joystick: End initialization loader.js:1000 Searching font Liberation Sans in -. path/s loader.js:1000 font Liberation Sans|Regular is not TrueType or BDF, using MAME default loader.js:1000 Region ':maincpu' created loader.js:1000 Region ':audiocpu' created loader.js:1000 Region ':tiles' created loader.js:1000 Region ':sprites' created loader.js:1000 Region ':oki' created loader.js:1001 hl00-1.f12 NOT FOUND (tried in tumblep tumblep) loader.js:1001 hl01-1.f13 NOT FOUND (tried in tumblep tumblep) loader.js:1001 hl02-.f16 NOT FOUND (tried in tumblep tumblep) loader.js:1001 map-02.rom NOT FOUND (tried in tumblep tumblep) loader.js:1001 map-01.rom NOT FOUND (tried in tumblep tumblep) loader.js:1001 map-00.rom NOT FOUND (tried in tumblep tumblep) loader.js:1001 hl03-.j15 NOT FOUND (tried in tumblep tumblep) loader.js:1001 exception thrown: 19336544 mamesupbtime.js:1180 Uncaught 19336544 Module.quit @ mamesupbtime.js:1180 callMain @ mamesupbtime.js:3464254 doRun @ mamesupbtime.js:3464277 run @ mamesupbtime.js:3464289 (anonymous) @ mamesupbtime.js:3464387 `

Some idea????

LeonisX commented 4 years ago

Hi, I am also impressed with the Emularity project and, whenever possible, try to understand it more deeply. I was mainly engaged in game consoles, but arcade machines are also interesting to me. I launched both games that were mentioned above - both start perfectly. Here is a snippet of code to launch the second game. If it is not enough, then I will try to indicate more details. Good luck to you.

var emulator = new Emulator(document.querySelector("#canvas"),
    null,
    new JSMESSLoader(JSMESSLoader.driver("tumblep"),
        JSMESSLoader.nativeResolution(320, 240),
        JSMAMELoader.scale(2),
        JSMESSLoader.emulatorJS("engine/mamesupbtime.js.gz"),
        JSMESSLoader.emulatorWASM("engine/mamesupbtime_wasm.js.gz"),

        JSMESSLoader.mountFile("tumblep.zip",
            JSMESSLoader.fetchFile("Game File", "roms/tumblep.zip")
        )
    )
)
ziogoku commented 4 years ago

Thank you Leonis, I'll try and will know you if you resolve my problem!

ziogoku commented 4 years ago

Hi again Leonis, I'm traing to use your code but it give me error: Uncaught SyntaxError: Invalid or unexpected token mamesupbtime.js.gz:1

This because I used mamesupbtime.js.gz without unzip file. Is correct?

ziogoku commented 4 years ago

Ok, news: Now Tumblepop start! But for this I need to unzip the gzip files to .js!

Now another question: there is a mode to use directly the .gz files without unzip that????

LeonisX commented 4 years ago

I use magic in .htaccess file in root directory of web server.

I had to move the emulator storage to a separate subdomain, because this solution conflicted with server optimization aimed at the quick distribution of static files.

AddEncoding gzip .gz

RewriteEngine on

RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}gz -f
RewriteRule (.*)\.wasm$ $1\.wasm.gz [L]

RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}gz -f
RewriteRule (.*)\.js$ $1\.js.gz [L]

<FilesMatch ".+\.wasm.gz$">
ForceType "application/octet-stream"
</FilesMatch>

<FilesMatch ".+\.js.gz$">
ForceType "text/javascript;charset=UTF-8"
</FilesMatch>

<FilesMatch ".+\.wasm$">
ForceType "application/wasm"
</FilesMatch>

The idea is to return the already packed GZ file, but with the correct headers (Content-Encoding: gzip and Content-Type) - the browser, seeing this header, will unpack the archive itself. At the same time, resources will be greatly reduced: you do not need to pack the emulator on the server side each time and you do not need to overload the Internet channel much.

Unfortunately, I’m not a great specialist in this, the code was born after hours of searching among examples. I hope it will be useful.

ziogoku commented 4 years ago

mmmm.... I'm using IIS and there is something like that for IIS, but it not works :(

LeonisX commented 4 years ago

.htaccess is the configuration file for theApache HTTP server, I hope that there is a similar solution under IIS, I described the principle in the previous message, you can return the compressed file, the main thing is to specify the correct header so that the browser unpacks it automatically.

ziogoku commented 4 years ago

Ok Leonis, you are very gentle and I thank you! I try to convert the .htaccess in a web.config , using IIS tools for URL rewrite, and it results: `

`

But this doesn't work :(

I'll see with an apache server, maybe will be better!

Thank you for the moment!

db48x commented 4 years ago

I'm sorry that I didn't see this earlier; my spam filter seems to have gotten above itself.

Thank you @LeonisX for your help here, I really appreciate it.

@ziogoku, I don't know anything about IIS specifically, so I don't know if that configuration is correct or not. It sounds at the very least like you know what needs to happen, and since this was filed in January I suspect you might have gotten it working since then. I'm going to close this issue, but don't hesitate to open another if you have another question!