Get the latest tech news
Show HN: Porting Terraria and Celeste to WebAssembly
Absurdly cursed mono webassembly hacks, and a journey to create a project that definitely shouldn't exist
When I saw that they had never posted their work publicly, I became about as obsessed with the idea as you would expect, leading to a year long journey of bytecode hacks, runtime bugs, patch files, and horrible build systems all to create something that really should have never existed in the first place. My current best progressed save file (I lost my old ones)The framerate of around 2 FPS wasn't promising, but fortunately enabling Ahead-Of-Time Compilation was able to get the performace up to being completely usable, even on low end devices. Copy the original method's IL bytecode into a new controlled method with modifications Call MethodBase.GetFunctionPointer() or "thunk" the runtime to retrieve pointers to the executable regions in memory that the jit code is held in Ask the OS kernel to disable write protection on the pages of memory where the jitted code is Write the bytes for a long jmp ( 0xFF 0x25 <pointer>) into the start of the function to redirect the control flow back into MonoMod.
Or read this on Hacker News