sorrows of a linux rain world modder

i have somehow joined the rain meadow team (dedicated blogpost coming soonTM)

part of the process of modding is reading game code to see how it does stuff

now most games aren't exactly enthusiastic about releasing their source code, but there's tools that can help us reverse-engineer it!

decompilers

just as compilers converts source code to machine code, decompilers convert machine code back to source code

+-------------+  === compile ==>  +------------------------------+
| source code |                   | machine code (elf, dll, exe) |
+-------------+  <= decompile ==  +------------------------------+

aside from no comments and macros, it's not a perfect process e.g. linq stuff looks ugly as hell

but ig that's how modding goes

visual studio

no. nuh-uh. not installing this shit whats it like 40 gigabytes? hell nah i aint running this thru wine id rather just setup a windows vm

dnSpy?

dnspy is deprecated, but there's an unofficial revival at dnSpyex

also this only works on windows (i hear some run it thru wine but haven't tried myself)

!!! DO NOT TRUST dnspy.co THAT SITE IS FAKE AND PROBABLY A TROJAN

ILSpy?

only works on windows too... or at least the UI bit

tried wine but ui glitchy

however, the readme points us at a linux port using AvaloniaUI!

AvaloniaILSpy?

sucks.

it's super outdated and laggy

prebuilt binary links against glibc which errors out on my musl setup (even with gcompat! think i messed around with patchelf to fix the symbols but couldn't get it working )

also tried compiling it but failed due to some fontconfig error maybe cos i was building in chroot but eh

so i just ran it from my (arch) tablet pc and waypipe ssh over

it is... predictably laggy and overall Not a Great Experience, especially since my tablet pc has to be on and connected to LAN

but it worked fine enough so ehh

ILSpy... on linux??

so one day whle procrastinating a refactor i start browsing for ways to run ilspy natively

because surely someone has to have done that before, right? i'd expect more linux users to be modders

and i find this reddit thread from an AvaloniaUI fella suggesting macos and linux ports

oooooooooh that's promising

i do some digging but all i can find is this blogpost for macos

no blogpost for linux??

consider running .dmg thru darling but nah

i scrounge around a bit more and eventually find the linux version on their twitter

its a google drive link ??? bit.ly/3SgwCGU

get it and it seems legit

yay i love musl

great there's missing symbols because we're on musl, remember...

run it and

segfault

i've done this whole song and dance before, so i patchelf strdup and strftime

segfault

gdb gives nothing

i give up and run it thru wolfiproot

works

78.5M	wolfi.work

not the worst but surely we could run it native!

run thru strace

nothing jumps out, couple of failed mremaps and then segfault

nvim -d the traces, nothing notable

huh.

"musl segfault but not glibc"

gives this godot issue that was solved by increasing stack size?

"musl dotnet increase stack size"

github.com/dotnet/runtime: Set minimum stack size using PT_GNU_STACK header for Musl #72920 ooh

surely we can do this with patchelf? "patchelf set PT_GNU_STACK header"

github.com/NixOS/patchelf: [REQ] add patchelf --stack-size #161

> open feature request

> close it one day later because you wrote a program to do it

grab chelf and copypaste the example

chelf -s 1052672 ILSpy

and it works!

screenshot of ILSpy running in linux

wtf this is so cursed

conclusion

society if proprietary software was compiled statically against musl:

i'll probably do a separate blogpost for my neovim setup augh so many promised blogposts, so little willpower...
made with <3 and /.gen.sh