Hacker News new | ask | show | jobs
by aidanhs 1888 days ago
I first came across this a while ago and after digging I found the way it worked (and possibly still works) behind the scenes is pretty cool: https://groups.google.com/g/emscripten-discuss/c/4Qw8OOgTvu0...

> A while ago I was pondering getting emscripten working under Wine, but realised that it's not quite as simple as a typical program (because Wine relies on being able to just provide a compatibility layer for syscalls, so the compatibility layer for x86 would have to be provided by the port to emscripten).

> Seeing this post, I wondered if you'd found some cunning way around this so downloaded the project. No, you've just gone straight ahead and implemented an x86 emulator! Ok, but how is wine able to run on bare metal? Oh right, you've actually implemented parts of linux, including most of the syscall interface, your own executable loader, parts of procfs and assorted special devices! Alright, but (as Alon asks) how does this actually render things? Ah I see, you've implemented your own display driver in Wine which, when methods are invoked, dispatches interrupts to the emulated CPU which then forwards and translates the interrupt to an equivalent sdl call (with opengl working a similar way, but with a dll)!

> Wow!

1 comments

BoxedWine does OpenGL passthrough on platforms where available. This does not extend to the WASM/WebGL, but I really tried! I was able to get it working for some simple OpenGL applications with help from gl4es, but was unable to make it work with textures beyond one example [1]. I would appreciate some assistance if anyone has the required skills.

[1] - https://kevodwyer.github.io/boxedwine-examples/v1/boxedwine....