davidben / uqm

Port of The Ur-Quan Masters to Native Client
https://chrome.google.com/webstore/detail/the-ur-quan-masters/dieafepjepbfogacjnifndljhlpiggmb
Other
23 stars 3 forks source link

Investigate compiling for Emscripten for Firefox #19

Open davidben opened 12 years ago

davidben commented 12 years ago

I doubt it'll ever be able to replace the NaCl port for performance, but we could use Emscripten as an alternate version. There may be an SDL port. Unfortunately, there's also the nuisance that Firefox does not implement the FileSystem API. The backend will likely look very different. Hopefully it can reuse as much code as possible. (Maybe even reusing nacl-mounts with a PPAPI shim that backends pp::FileSystem on IndexedDB.)

davidben commented 12 years ago

Emscripten can't do threads, which is a problem. But it looks like the threads in uqm are slowly going away? Grepping for AssignTask suggests they're only used for audio, and perhaps that could use different code, or be simply unsupported in the fallback.

davidben commented 12 years ago

This is not going to invert easily. Lots of nested "event loops" and stuff. (Any call to DoInput.) I think the best answer here may be some crazy additional layer of source translation. That or manually managing a stack for all functions below a context switch. (May not be insane. Those probably aren't performance-sensitive.)