Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wasm cores compilation and code #25

Closed
thelamer opened this issue Sep 29, 2021 · 6 comments
Closed

Wasm cores compilation and code #25

thelamer opened this issue Sep 29, 2021 · 6 comments

Comments

@thelamer
Copy link

I get that this is essentially just a repo trying to organize and document what has been achieved by who or whatever makes emulatorjs, but I don't see anywhere else that has a community for reaching out and discussing what is here.
This code is stellar, someone has taken the time to port libretro cores (I suspect) to wasm and wrapped it up in a fully HTML5 compliant loader with many bells and whistles like controller support etc, all standardized across each system.

There is a grey area here where people are trying to host rom sites and make ad revenue, but just in general this stack is incredible and it is my hope that the open source community can participate someday in a meaningful way. Being able to run all this stuff in a browser goes beyond the search for ad revenue and breaks into new frontier of compatibility for retro gaming across so many devices that have web browser support.

I guess I am creating this issue to get the discussion started to see if it is possible to get some build logic and source modifications for the current stack. Has anyone had any success with even just introductions to the team or person behind emulatorjs?

@ethanaobrien
Copy link
Member

I agree! This code is very revolutionary! It's difficult to find a nintendo 64 emulator that will run but this one runs really well, and the Nintendo DS emulator is one of its kind!

So I've been looking through the code and I've found that some emulators (Like the ds emulator) use an optimizable javascript compiler called asm.js.

The nintendo 64 emulator, from what I've found, uses glupen64. Do you think we could compile this into an updated n64 wasm file?

If you know how, could you please walk me through transitioning a C application (like this) to a wasm file?

I haven't had much time to dig at the others but this is a start!

@thelamer
Copy link
Author

The problem is not in compiling cores into usable web assembly, tons of people have done that in the past as tech demos and such.
The problem is you are missing the code in these blobs that connects the JS frontend to the web assembly code and all the web based settings.
You can reverse engineer all of that, but might as well just ground up your own project at that point.

@ethanaobrien ethanaobrien pinned this issue Sep 29, 2021
@ethanaobrien
Copy link
Member

Would you mind referring me to one of those YouTube videos that you think are most helpful. Once I get the wasm generated I can begin to reverse engineer it

@thelamer
Copy link
Author

I like the enthusiasm, here are the build commands:
https://github.com/BinBashBanana/webretro/blob/master/source/readme.txt
Again I need to emphasize the amount of customization they did here to have easy no nonsense web based settings, these are not just wasm cores, they wrote stuff like mouse/gamepad emulation integration (look at the DS emulation).
Digging through sites that host this I have kind of concluded (could be wrong) that the retrogames.cc folks must maintain this.
They are using a bunch of undocumented hooks to execute functions like:

EJS_onSaveState
EJS_onLoadState
EJS_gameParentUrl
EJS_onGameStart
EJS_gameID

Along with baked in netplay support.
I mean it is possible they just dug into the minified code and expanded stuff, but they are using the vanilla libs and it just seems like they are way to familiar to not be at least affiliated in some manner with the core devs.

@ethanaobrien
Copy link
Member

ethanaobrien commented Oct 11, 2021

@thelamer I've been reverse engineering the code and I've managed to get the retroarch.js file it uses along with the ds core, decompiled, as wasm and attempted to decrypt to c

zip.zip

Any thoughts on what I should try now?

@thelamer
Copy link
Author

@thelamer I've been reverse engineering the code and I've managed to get the retroarch.js file it uses along with the ds core, decompiled, as wasm and attempted to decrypt to c

zip.zip

Any thoughts on what I should try now?

Not my area of expertise, the only thing I can recommend is some kind of communication somehow. Someone made this and I doubt they care about keeping it closed source. Might just be a hurdle of not wanting to provide support or deal with public CI and build pipelines. Instead of always playing catch-up, would be cool to have the source in a community project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants