libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.31k stars 1.84k forks source link

Retroarch Emscripten Freezes #3291

Closed jcampbell05 closed 8 years ago

jcampbell05 commented 8 years ago

I have this log in the html and the canvas doesn't let me use the menu moving cursors etc.

RetroArch [INFO] :: === Build =======================================
Capabilities: 
Built: Jul 30 2016
RetroArch [INFO] :: Version: 1.3.6
RetroArch [INFO] :: Git: 6932d20
RetroArch [INFO] :: =================================================
RetroArch [INFO] :: Looking for config in: "/home/web_user/.config/retroarch/retroarch.cfg".
RetroArch [INFO] :: Looking for config in: "/home/web_user/.retroarch.cfg".
RetroArch [WARN] :: Config: using skeleton config "/etc/retroarch.cfg" as base for a new config file.
RetroArch [WARN] :: Config: Created new config file in: "/home/web_user/.config/retroarch/retroarch.cfg".
RetroArch [INFO] :: Config: loading config from: /home/web_user/.config/retroarch/retroarch.cfg.
RetroArch [WARN] :: Active core path not set, cannot load core-specific config file...
RetroArch [INFO] :: Resetting undo buffers.
RetroArch [INFO] :: Environ SET_PIXEL_FORMAT: RGB565.
RetroArch [INFO] :: Version of libretro API: 1
RetroArch [INFO] :: Compiled against API: 1
RetroArch [INFO] :: Set audio input rate to: 29975.00 Hz.
RetroArch [INFO] :: Video @ 960x720
RetroArch [INFO] :: [EGL]: EGL version: 1.4
RetroArch [INFO] :: [EGL]: Current context: 0xf234.
RetroArch [INFO] :: [EMSCRIPTEN/EGL]: Dimensions: 800x600
RetroArch [INFO] :: Found GL context: emscripten
RetroArch [INFO] :: Detecting screen resolution 800x600.
RetroArch [INFO] :: [GL]: Vendor: WebKit, Renderer: WebKit WebGL.
RetroArch [INFO] :: [GL]: Version: WebGL 1.0 (OpenGL ES 2.0 Chromium).
bad name in getProcAddress: glDebugMessageControlKHR,glDebugMessageControlKHR
bad name in getProcAddress: glDebugMessageInsertKHR,glDebugMessageInsertKHR
bad name in getProcAddress: glDebugMessageCallbackKHR,glDebugMessageCallbackKHR
bad name in getProcAddress: glGetDebugMessageLogKHR,glGetDebugMessageLogKHR
bad name in getProcAddress: glPushDebugGroupKHR,glPushDebugGroupKHR
bad name in getProcAddress: glPopDebugGroupKHR,glPopDebugGroupKHR
bad name in getProcAddress: glObjectLabelKHR,glObjectLabelKHR
bad name in getProcAddress: glGetObjectLabelKHR,glGetObjectLabelKHR
bad name in getProcAddress: glObjectPtrLabelKHR,glObjectPtrLabelKHR
bad name in getProcAddress: glGetObjectPtrLabelKHR,glGetObjectPtrLabelKHR
bad name in getProcAddress: glGetPointervKHR,glGetPointervKHR
bad name in getProcAddress: glEGLImageTargetTexture2DOES,glEGLImageTargetTexture2D
bad name in getProcAddress: glEGLImageTargetRenderbufferStorageOES,glEGLImageTargetRenderbufferStorage
bad name in getProcAddress: glGetProgramBinaryOES,glGetProgramBinary
bad name in getProcAddress: glProgramBinaryOES,glProgramBinary
bad name in getProcAddress: glMapBufferOES,glMapBuffer
bad name in getProcAddress: glUnmapBufferOES,glUnmapBuffer
bad name in getProcAddress: glGetBufferPointervOES,glGetBufferPointerv
bad name in getProcAddress: glTexImage3DOES,glTexImage3D
bad name in getProcAddress: glTexSubImage3DOES,glTexSubImage3D
bad name in getProcAddress: glCopyTexSubImage3DOES,glCopyTexSubImage3D
bad name in getProcAddress: glCompressedTexImage3DOES,glCompressedTexImage3D
bad name in getProcAddress: glCompressedTexSubImage3DOES,glCompressedTexSubImage3D
bad name in getProcAddress: glFramebufferTexture3DOES,glFramebufferTexture3D
bad name in getProcAddress: glIsVertexArrayOES,glIsVertexArray
RetroArch [INFO] :: Querying GL extension: ARB_texture_non_power_of_two => doesn't exist
RetroArch [INFO] :: Querying GL extension: OES_texture_npot => doesn't exist
RetroArch [INFO] :: Querying GL extension: BGRA8888 => doesn't exist
RetroArch [WARN] :: [GL]: GLES implementation does not have BGRA8888 extension.
32-bit path will require conversion.
RetroArch [INFO] :: Querying GL extension: GL_EXT_unpack_subimage => doesn't exist
RetroArch [INFO] :: Querying GL extension: EXT_sRGB => exists
RetroArch [INFO] :: GL: Using resolution 800x600
RetroArch [INFO] :: [GL]: Default shader backend found: glsl.
RetroArch [INFO] :: [Shader driver]: Using GLSL shader backend.
RetroArch [WARN] :: [GL]: Stock GLSL shaders will be used.
RetroArch [INFO] :: Found GLSL vertex shader.
RetroArch [INFO] :: Found GLSL fragment shader.
RetroArch [INFO] :: Linking GLSL program.
RetroArch [INFO] :: Found GLSL vertex shader.
RetroArch [INFO] :: Found GLSL fragment shader.
RetroArch [INFO] :: Linking GLSL program.
RetroArch [INFO] :: Found GLSL vertex shader.
RetroArch [INFO] :: Found GLSL fragment shader.
RetroArch [INFO] :: Linking GLSL program.
RetroArch [INFO] :: [GL]: Using 4 textures.
RetroArch [INFO] :: [GL]: Loaded 1 program(s).
RetroArch [INFO] :: Using font rendering backend: bitmap.
RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [ERROR] :: Cannot resolve application path! This should not happen.RetroArch [INFO] :: Saved new config to "/home/web_user/.config/retroarch/retroarch.cfg".
RetroArch [INFO] :: SRAM will not be saved.
RetroArch [INFO] :: null: [/home/web_user/.config/retroarch/content_history.lpl].
RetroArch [INFO] :: [GL]: VSync => off
Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!
RetroArch [INFO] :: [GL]: VSync => on
RetroArch [INFO] :: Querying GL extension: ARB_framebuffer_object => doesn't exist
andres-asm commented 8 years ago

it's not frozen, input isn't working.

jcampbell05 commented 8 years ago

@fr500 does anyone know how the input is broken and what could I do to fix it ?

andres-asm commented 8 years ago

not really, we're waiting for someone to be "THE GUY" on this issue

jcampbell05 commented 8 years ago

@fr500 cool, so I really want to help fix this. Is there any places you can point me to ? Where in the code is the input handled ? Which areas do you think could effect it ?

andres-asm commented 8 years ago

I think it's here: https://github.com/libretro/RetroArch/blob/master/input/drivers/rwebinput_input.c

On Sat, Jul 30, 2016 at 5:26 PM, James Campbell notifications@github.com wrote:

@fr500 https://github.com/fr500 cool, so I really want to help fix this. Is there any places you can point me to ? Where in the code is the input handled ? Which areas do you think could effect it ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/libretro/RetroArch/issues/3291#issuecomment-236393243, or mute the thread https://github.com/notifications/unsubscribe-auth/ABpC0LtJ5ZaGFCOXo_Z3LRfSZtX8d2L2ks5qa895gaJpZM4JY5y8 .

jcampbell05 commented 8 years ago

Implemented one using the native emscripten C++ HTML event APIs, currently it seems emscripten doesn't fire key press callbacks.

dalter commented 8 years ago

Compile with SDL2 support on last Emscripten 1.36.5 in RetroArch setting set sdl2 input driver

jcampbell05 commented 8 years ago

@dalter Cool so use SDL instead of RWebInput ?

dalter commented 8 years ago

I fixed RWebInput and add to Makefile.emscripten SDL2 flags. Now input SDL2 and RWebInput work fine But need more test with SDL2 !

andres-asm commented 8 years ago

Cool stuff gonna try today. @dalter have you looked into implementing gamepad support by any chance? https://kripken.github.io/emscripten-site/docs/api_reference/html5.h.html#gamepad

dalter commented 8 years ago

@fr500 didn't try add gamepad support with RWebInput. But SDL2 alredy has html5 support and gamepads working , but only Xbox 360 and PS3 (ps3 with xbox emuletion set) in google Chrome and Chromium (all webkit browsers). My older gampad "logitech rumbel pad 2" works not properly in chrome (all webkit browsers), miss some buttons. It works correctly only in Firefox

jcampbell05 commented 8 years ago

@dalter Do you have a version with these fixes I can use ?

andres-asm commented 8 years ago

Doesn't seem to work here http://hastebin.com/ripahuyoge.coffee

I'm on the latest master of the toolchain:

buildbot@who-cares:~/tools/emscripten/emsdk_portable$ ./emsdk list

The following precompiled tool packages are available for download:
           node-4.1.1-32bit
     *     node-4.1.1-64bit             INSTALLED
           emscripten-1.30.0
           emscripten-1.34.1
           emscripten-1.35.0

The following tools can be compiled from source:
           clang-tag-e1.36.4-32bit
           clang-tag-e1.36.5-32bit
           clang-tag-e1.36.4-64bit
           clang-tag-e1.36.5-64bit
           clang-incoming-32bit
           clang-incoming-64bit
           clang-master-32bit
     *     clang-master-64bit           INSTALLED
           emscripten-tag-1.36.4-32bit
           emscripten-tag-1.36.5-32bit
           emscripten-tag-1.36.4-64bit
           emscripten-tag-1.36.5-64bit
           emscripten-incoming-32bit
           emscripten-master-32bit
           emscripten-incoming-64bit
     *     emscripten-master-64bit      INSTALLED

The following precompiled SDKs are available for download:

The following SDKs can be compiled from source:
         sdk-incoming-32bit
         sdk-incoming-64bit
         sdk-master-32bit
    *    sdk-master-64bit               INSTALLED
         sdk-tag-1.36.4-32bit
         sdk-tag-1.36.5-32bit

Items marked with * are activated for the current user.
jcampbell05 commented 8 years ago

Compiling with SDL2 doesn't work for me either, it seems for me that the event callbacks aren't being allowed to be fired by RetroArch therefore no input can be processed.

dalter commented 8 years ago

@jcampbell05 @fr500 You are using the latest version of emscipten 1.36.5? you add the flag -s USE_SDL = 2 to LDFLAGS:? emscripten must load a necessary library SDL2 himself when to begin compiling js.

Here is a working example (SDL2 and Rwebinput): http://game-gear.ru/retroarch/RetroArch.html (If example link asks PASSWORD just click Cancel ) What erorrs compilation with SDL2?

I compile Last RetroArch with SDL2 and c Rwebinput and input work fine, but after loading the core emulator, RetroArch freeze I checked without my fix when RetroArch auto load rom from start , and it also freeze . I think that the problem in EGL I test my fix an old version RetroArch 1.3.2 and all worked fine

jcampbell05 commented 8 years ago

@dalter Compiling with SDL2 enabled with RWebInput still doesn't fix input for me. This is on Chrome and on the latest master of RetroArch.

r-type commented 8 years ago

Working at least for me for testcore ,with RWebInput ,Last RetroArch (1 day ago) and last Emscripten .

I have input in menu and no freeze using

arguments: ["-v",""],

instead of

arguments: ["-v", "--menu"],

in the html file.

retrojs

andres-asm commented 8 years ago

Ok, input is working now but it's hanging at startup unless we change audio driver from rwebaudio to null

r-type commented 8 years ago

Yes sound to null fix the freeze pb . BTW if you launch game directly instead to boot to --menu (without change audio to null) ,it works also as expected (but no sound too).

screen

jcampbell05 commented 8 years ago

Tried compiling and I just got an exception.

r-type commented 8 years ago

Using SDL2 for sound

config += "audio_driver = sdl2\n";

also solve the freeze pb at start , but have no sound in game after

r-type commented 8 years ago

Any chance sound ingame and freeze at start get fixed ? here a cap32 sample core http://dl.free.fr/vvif5yR4L

dalter commented 8 years ago

@r-type I fix audio driver and now all work fine !! (all fix in master)

r-type commented 8 years ago

Nice, thanks ! sound now play fine for me (at least for cap32). and no freeze when launch with --menu .

on side note , i notice that close content works but freeze if reload another content.

andres-asm commented 8 years ago

Been working on a little something http://190.130.222.178:9080/emscripten/webplayer.html

Data should persist across sessions (start retroarch first, upload second) and settings should be retained (use save current config)

r-type commented 8 years ago

@fr500 nice it's cool to have persistence, I’m not familiar with js so could you explain , did you use NODE FS ? where a the file locally ?

Actually i build with --preload-file to embedded some data need for emulators , like data/ folder for vice C64 . ( result is 2 files .js with .data ) but it's restrictive and tedious . So i would be happy if i can easily have persistent files (data,ra config/coreoptions...).

on side note ,i finally success to build a vice C64 without using libco , so after it was easy to build an rough emscripten version .

vice

http://dl.free.fr/fs0WErjaz

andres-asm commented 8 years ago

@r-type I used a browser based filesystem (browserfs) it has several backends. I'm only using local storage (browser cache) atm but it has backends for dropbox and others.

I commited the changes to master already but you probably need the memory map files from here: https://github.com/jvilk/BrowserFS/releases/tag/v0.5.12.

Once I gets the quirks ironed out I want to make it fetch assets/core info files, etc. automatically on first startup. BrowserFS allows that so it should be simple.

r-type commented 8 years ago

@fr500 thanks for the explanation and link , I'll look at . for the record i never keep cache or anything in my browser!

BTW your idea to fetch at startup look really nice !

andres-asm commented 8 years ago

@r-type well I plan to add the dropbox backend too, but if you don't save browser cache I reckon you don't use dropbox either.

andres-asm commented 8 years ago

I added some rudimentary dropbox support https://buildbot.libretro.com/.radius/webplayer.html https://www.youtube.com/watch?v=nNMbIRE2HBI

Works for me but failed on chrome/linux for @sronsse for some reason. Any more testng would be appreciated

RobLoach commented 8 years ago

This is coming along pretty nicely! Unfortunately did not work here, with or without Dropbox. Likely something I'm doing wrong on my end.

andres-asm commented 8 years ago

@RobLoach it's still quite fragile, maybe you hit the buttons in the wrong order. For local storage:

For dropbox:

Also, load archive with core causes this port to crash. The zip code seems wrong, it creates a 0 byte file.

@All, this is working nicely but I have a weird issue maybe someone here can help me with. Now that we have a persistent configuration I have discovered that vsync and hotkey input die on firefox after the first run.

I messed with the config a lot, ordered the config alphabetically and then I discovered that removing the line: aspect_ratio_index = "21"

tested about 10 times readding/removing the line and the same happened, made no sense but at least I knew which setting caused the issue. but then I decided to try again from scratch, reproduced, removed the line (without sorting the file) and... nothing, it didn't help.

I checked the template: https://github.com/libretro/RetroArch/blob/master/emscripten/webplayer.html#L201

And noticed the first entry is still at the first line of the config, so I removed that one And it got fixed again.

Tried removing that from the template, but then the culprit became audio_latency

Soo, I'm wondering if there is something wrong with the way I'm creating the base config. I guess I'll have to add these defaults to the platform driver instead (which would be good regardless) but the issue confuses me a lot.

Maybe some hidden character or something... I really don't understand.

BTW: the issue doesn't appear on chrome.

andres-asm commented 8 years ago

feel free to mantain the discussion.

RobLoach commented 8 years ago

@fr500

it's still quite fragile, maybe you hit the buttons in the wrong order. For local storage:

  • Start Retroarch
  • Upload

That did it. Worked with Kirby, wasted 10 minutes playing and I want my 10 minutes back. I do love the music though.

I checked the template

Being a web developer/designer, I can assist with improving this template. Not sure how far you want to go with the emscripten webplayer template shipped with RetroArch though. We could turn this into a really slick web application, with file management and everything.

andres-asm commented 8 years ago

Well I wouldn't want to overdo it, I want to keep it a single file at least so people bundling it in their sites don't have to go hunting for too many deps. After all you can manage the files via the dropbox app and they have some drop-in upload/download widget IIRC.

That said, I'm not against making it better, here's the list of things I'd like

Instead of the power button overlaid on top it should have a libretro logo or an invader

So if you can help with any of these I'd appreciate it, I want to keep working on the filesystem stuff (I want roms to be volatile, only userdata to be persistent)