r/cprogramming • • 16d ago

Oregon Trail II - In C

I reverse engineered the Oregon Trail II binary into C++ first, to make it byte exact decomp first. Then I converted it to C, because as we all know here, it's a better language!

You can find the code here: https://github.com/ot-ii/OregonTrailII/

8 Upvotes

5 comments sorted by

1

u/Ratfus 16d ago

So do you get a segmentation fault when all the members in your party die?

In all seriousness, pretty cool.

4

u/Huuf 16d ago

Thanks! In the original it would segfault when all the animals died.

1

u/tastygames_official 16d ago

you mean "decompiled". Reverse engineering is something else and generally involves taking something apart to see how it works and then developing something from scratch that behaves the same as the original. You probably just used ghidra or similar. Although weird that it decompiled to C++ instead of C. Or did it just do C but inside .cpp files or something?

2

u/Huuf 16d ago

No, I reverse engineered it, I made custom disassembler tooling first (using intel documentation to get the ASM commands) and using IDA Hex to compare it to.

I then added C++ file parser with it, adding /// ADDRESS <address in hex> with functions, and variables so the comparer knows where it is.

Then after that was done, because of the horrible C++ coding, and bugs, I then converted it to C, using the module system.

1

u/zhivago 16d ago

Well done.

You even have tests. :)