Hi guys, I think you know there’s a browser port of Unreal Tournament made by Ryan C. Gordon. It works almost perfectly, but the networking doesn’t.
I’m currently actively working on a classic networked games project — right now it’s already possible to play HLDM, Quake 2/3, DOOM, and OpenTTD in the browser. Naturally, I’d love to have UT99 in my collection as well.
I’ve spoken with Ryan — unfortunately, he can’t provide the source code since he doesn’t have the rights to it. So I have to work with what’s available, namely the compiled WASM.
I suspect the game crashes when starting a network session because it tries to open a port, which obviously isn’t possible in the browser. My plan is to intercept and replace the necessary WASM calls with my own networking layer.
The worst part is that the only available build is fully obfuscated and most likely compiled without exceptions, so the crash stacks are extremely uninformative. Still, I plan to gradually analyze the WASM and reconstruct some of the networking logic. It seems a good place to start is by analyzing the Emscripten JS glue functions — when and how they’re invoked.
Now to my main question:
👉 Is there any way to determine exactly which version of Emscripten this binary was built with?
Ideally down to a commit hash — or at least the major/minor version. That would be a great starting point, since I could then review the corresponding network stack implementation.
P.S. It would’ve been logical to just ask Ryan which version he used, but unfortunately, for some reason (I’m not sure why), he stopped replying.
P.S.2. This is a port https://icculus.org/ut99-emscripten/
Hi guys, I think you know there’s a browser port of Unreal Tournament made by Ryan C. Gordon. It works almost perfectly, but the networking doesn’t.
I’m currently actively working on a classic networked games project — right now it’s already possible to play HLDM, Quake 2/3, DOOM, and OpenTTD in the browser. Naturally, I’d love to have UT99 in my collection as well.
I’ve spoken with Ryan — unfortunately, he can’t provide the source code since he doesn’t have the rights to it. So I have to work with what’s available, namely the compiled WASM.
I suspect the game crashes when starting a network session because it tries to open a port, which obviously isn’t possible in the browser. My plan is to intercept and replace the necessary WASM calls with my own networking layer.
The worst part is that the only available build is fully obfuscated and most likely compiled without exceptions, so the crash stacks are extremely uninformative. Still, I plan to gradually analyze the WASM and reconstruct some of the networking logic. It seems a good place to start is by analyzing the Emscripten JS glue functions — when and how they’re invoked.
Now to my main question:
👉 Is there any way to determine exactly which version of Emscripten this binary was built with?
Ideally down to a commit hash — or at least the major/minor version. That would be a great starting point, since I could then review the corresponding network stack implementation.
P.S. It would’ve been logical to just ask Ryan which version he used, but unfortunately, for some reason (I’m not sure why), he stopped replying.
P.S.2. This is a port https://icculus.org/ut99-emscripten/
--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVEzn-n1yBNobvPL9J5L07XW%2BX-qEBG4j%2B7FtFaz0iw5qw%40mail.gmail.com.
Thanks for the reply.
I organized a hackathon and made pretty good progress on solving my task — I replaced Emscripten’s socket implementation with my own and managed to get through the initial handshake stage when connecting the client to the server.
However, unfortunately, at some point an exception occurs on the server and it crashes.
As the mentioned, exception catching is disabled, so I only see a very uninformative message:
Exception catching is disabled, this exception cannot be caught. C...
I did some digging and found that the UT99 engine throws exceptions like this:
throw (TEXT("SOME TEXT"))
I don’t yet know exactly what TEXT
does, but let’s assume it’s equivalent to:
throw "Some text"
My question is: is there any way I can print this "Some text"
to console.log
?
I tried debugging directly in WASM to find the pointer to "Some text"
, but haven’t succeeded yet.
Here’s the _cxa_throw
implementation:
function ___cxa_throw(ptr, type, destructor) {
EXCEPTIONS.infos[ptr] = {
ptr: ptr,
adjusted: ptr,
type: type,
destructor: destructor,
refcount: 0,
caught: false,
rethrown: false
};
EXCEPTIONS.last = ptr;
if (!("uncaught_exception" in __ZSt18uncaught_exceptionv)) {
__ZSt18uncaught_exceptionv.uncaught_exception = 1
} else {
__ZSt18uncaught_exceptionv.uncaught_exception++
}
debugger
console.warn("___cxa_throw", ptr, type, destructor);
// throw ptr - " - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."
}