aliens

Author Topic: Reversing to Orion - project 1oom  (Read 67792 times)

Offline Kilgore T.M. Replicant

  • Colonel
  • ****
  • Posts: 100
  • Mangia!
    • View Profile
Reversing to Orion - project 1oom
« on: April 20, 2018, 01:45:25 pm »
1993 was a great year for PC gaming: Doom, XCOM/UFO and Master of Orion. Now, 25 years later, in a post-DOS world... how does one play these?

Doom has numerous "source ports" due to the source code release (thanks Carmack!). OpenXcom provides modern compatibility and GPL goodness for Xcom, thanks to the efforts of SupSuper & co.

As for the other MicroProse classic MOO1, we have v1.3 and some unofficial v1.4 hacked DOS EXEs with no source code in sight. Time to change that!

Step 1: grab a disassembler
Step 2: ???
Step 3: 1oom-0.1.tar.bz2 (md5sum: 665bd7bff107cb5919ab9dbec3d6b58c)
edit: Step 3.1: https://github.com/KilgoreTroutMaskReplicant/1oom
edit: Step 3.2: Homepage
edit: Step 3.3: https://gitlab.com/KilgoreTroutMaskReplicant/1oom
edit: Step 3.4: Homepage

Downloads: releases, development builds
Code: [Select]
git clone https://gitlab.com/KilgoreTroutMaskReplicant/1oom.git
See the homepage for screenshots.
« Last Edit: August 14, 2018, 04:57:23 am by Kilgore T.M. Replicant »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Reversing to Orion - project 1oom
« Reply #1 on: April 20, 2018, 04:48:17 pm »
Great, btw why not you create GitHub project?

[ps]
Fist error, in comp.h `MAX3` is probably not properly defined.
« Last Edit: April 20, 2018, 05:05:01 pm by Yankes »

Offline DoxaLogos (JG)

  • Colonel
  • ****
  • Posts: 358
  • Squaddie cautiously peering through the breach
    • View Profile
Re: Reversing to Orion - project 1oom
« Reply #2 on: April 20, 2018, 06:22:55 pm »
Yep, get this on GitHub! :)

BTW, is it called project1oom, because you're reversing MOO1 -> 1OOM ?

Offline Kilgore T.M. Replicant

  • Colonel
  • ****
  • Posts: 100
  • Mangia!
    • View Profile
Re: Reversing to Orion - project 1oom
« Reply #3 on: April 21, 2018, 03:18:54 pm »
Yep, get this on GitHub! :)
I guess I have to. It will take a while; I have no account and hold some contempt at the platform. Meanwhile, elaboration on step 2:  the IDA files

edit: now on GitHub: https://github.com/KilgoreTroutMaskReplicant/1oom

Quote
BTW, is it called project1oom, because you're reversing MOO1 -> 1OOM ?
Yes.

Fist error, in comp.h `MAX3` is probably not properly defined.
It should be unused and subject for removal.
« Last Edit: April 21, 2018, 04:23:57 pm by Kilgore T.M. Replicant »

Offline Hythlodaeus

  • Colonel
  • ****
  • Posts: 276
    • View Profile
Re: Reversing to Orion - project 1oom
« Reply #4 on: April 21, 2018, 10:42:13 pm »
Do the same with Master of Magic, and half of the internet will suck you off.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11722
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Reversing to Orion - project 1oom
« Reply #5 on: April 21, 2018, 10:50:06 pm »
Do the same with Master of Magic, and half of the internet will suck you off.

Oooooh with moddability!

Offline Kilgore T.M. Replicant

  • Colonel
  • ****
  • Posts: 100
  • Mangia!
    • View Profile
Re: Reversing to Orion - project 1oom
« Reply #6 on: April 22, 2018, 03:25:23 am »
Do the same with Master of Magic, and half of the internet will suck you off.
Tempting, but there's plenty of work left with this one. Besides, "1mom" sounds both normal and suspicious.

Offline Hythlodaeus

  • Colonel
  • ****
  • Posts: 276
    • View Profile
Re: Reversing to Orion - project 1oom
« Reply #7 on: April 23, 2018, 11:54:29 pm »
Tempting, but there's plenty of work left with this one. Besides, "1mom" sounds both normal and suspicious.

Well there was never a mom 2, so you should call it momo (mom, open).

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Reversing to Orion - project 1oom
« Reply #8 on: April 24, 2018, 06:03:24 pm »
Looks promising! Curious what your process is for picking this apart, as there is not much documentation in using IDA this way.
Last I tried I only managed to figure out some LBXs, can trade notes if you need.
« Last Edit: April 24, 2018, 06:06:10 pm by SupSuper »

Offline Kilgore T.M. Replicant

  • Colonel
  • ****
  • Posts: 100
  • Mangia!
    • View Profile
Re: Reversing to Orion - project 1oom
« Reply #9 on: April 26, 2018, 08:03:42 am »
Curious what your process is for picking this apart, as there is not much documentation in using IDA this way.
The process:
0. Deduce LBX format, peek around the net for .GAM format
1. Grab IDA, start at entry point
2. Figure out what the disassembled code (snippet) does, name functions and variables
3. Manual translation to C
4. Figure out what a function or a bunch of them really do, (re)name functions and variables
5. Refactor for game logic / UI separation

Step 0 was mostly done in the 90's.

The rest is (AFAIK) using IDA in a regular fashion: disassembling and naming. The decompiling was/is manual. I started step 1 about 6 months ago and have been working at it for about 8 hours per day. This should give a nice figure on how much work is involved in reverse engineering an old game.

Note that this is my first time using IDA or reversing x86_16 so maybe the lack of experience is showing. Perhaps there's a magic asm -> C translation button that I missed. Due to the manual method the current code is likely very buggy; the lack of testing mentioned in the readme is not to be taken lightly.

Step 5 is nonessential for a clone/remake, but I like clean module separation and giggle at the prospect of a text adventure UI.

Last I tried I only managed to figure out some LBXs, can trade notes if you need.
Thanks for the offer. I have them sorted out now, but doc/format_lbx.txt patches are welcome.

Offline Skin36

  • Squaddie
  • *
  • Posts: 3
    • View Profile
Re: Reversing to Orion - project 1oom
« Reply #10 on: April 26, 2018, 09:06:31 pm »
I have little experience working with IDA, if that, I can help with general questions.

Here is my plan for reversing games.
1. Defining text strings, renaming functions according to text strings.
2.Search for the main cycle.
3. Search for structures, variables.
4. Determination of the members of the structures.
5. and so on

Offline Hythlodaeus

  • Colonel
  • ****
  • Posts: 276
    • View Profile
Re: Reversing to Orion - project 1oom
« Reply #11 on: April 29, 2018, 05:42:05 pm »
One thing that seems to be missing is the the status of the project. Is the game playable by now already? What are the goals for the next milestones/builds?

Also, as someone who is on linux and is too lazy to compile stuff, any chance you can make a snap/appimage autobuilder?

Offline Kilgore T.M. Replicant

  • Colonel
  • ****
  • Posts: 100
  • Mangia!
    • View Profile
Re: Reversing to Orion - project 1oom
« Reply #12 on: April 30, 2018, 05:27:53 am »
One thing that seems to be missing is the the status of the project. Is the game playable by now already? What are the goals for the next milestones/builds?
The game should be fully playable. I will whip up a roadmap at some point. I plan to make monthly releases focusing on debugging the whole mess. With that said...

---

1oom v0.2 has been released. Changes:
    - help dialogs and news transition implemented; all done!?
    - configuration files implemented
    - add -user <path>
    - documentation added
    - full screen toggling with Alt-Enter
    - 1oom_gfxconv for converting graphics to LBX format
    - various bugs fixed

Source code: https://github.com/KilgoreTroutMaskReplicant/1oom
Binaries: none.

---

HELP WANTED!

All the big pieces are now in place. The rest is testing, debugging and expanding. This is the point where I need your assistance. The two most pressing things:

1. The code needs a lot of testing; play it and yell if it breaks!  When it does, make a copy of 1oom_save8.bin pass it along the report.

2. The Windows code is completely untested. If you have a toolchain ready,  please test if it works at all. Also consider uploading a binary somewhere for the non-developers.

---

Also, as someone who is on linux and is too lazy to compile stuff, any chance you can make a snap/appimage autobuilder?
Sorry, I have no idea what those are and am too lazy to find out.

Offline Hythlodaeus

  • Colonel
  • ****
  • Posts: 276
    • View Profile
Re: Reversing to Orion - project 1oom
« Reply #13 on: April 30, 2018, 03:00:56 pm »
Sorry, I have no idea what those are and am too lazy to find out.

They're pre-packaged universal linux build systems, essentially. OpenXcom uses this to distribute linux nightlies, and IMO the best thing since sliced bread on linux.

https://appimage.org/ - the one used by oxc
https://snapcraft.io/ - canonical official, allows sandboxing

Aside from that, you'll have my testing support on this one, once I manage to compile the bloody thing. It's been more than 10 years since I last played MoO 1, however, so it aint gonna exactly be an expert opinion though  ;D

Oh, and one more thing, I would recommend you to get some extra help at https://forum.freegamedev.net/, since you have a lot of people who work on FLOSS going about there. I myself used to write for their blog, Free Gamer, and I think I sitll have editing permission on it. If you can whip up a few more screenshots and maybe a video I could write an article about it for the frontpage (it's been ages since it was last updated, but they still do get views).
« Last Edit: April 30, 2018, 03:09:37 pm by Hythlodaeus »

Offline Kilgore T.M. Replicant

  • Colonel
  • ****
  • Posts: 100
  • Mangia!
    • View Profile
Re: Reversing to Orion - project 1oom
« Reply #14 on: April 30, 2018, 05:08:07 pm »
(Added a TODO to the git repo.)

They're pre-packaged universal linux build systems, essentially. OpenXcom uses this to distribute linux nightlies, and IMO the best thing since sliced bread on linux.
Does it bundle the used libraries? In any case, smells a bit too much like exe+dll->zip solution that Windows folks take for granted. Running random binaries from the net always seemed weird to me and my brand of sliced bread is Gentoo...

I understand that compiling can be tedious in most platforms. In Linux, it's a few commands given in INSTALL. Perhaps one wishes not to have gcc & friends eating HDD space. Still it baffles my puny brain.

I'd be happy if someone else set up nightly builds. I'm just a code monkey that reads x86_16 and writes C; I'll leave binary building to others.

Quote
Aside from that, you'll have my testing support on this one, once I manage to compile the bloody thing. It's been more than 10 years since I last played MoO 1, however, so it aint gonna exactly be an expert opinion though  ;D
Thanks for the support. Ask if there is any compiling trouble. I'm from the "play for 1 day every 3 years" group. Never beat the game on Impossible...

Quote
I would recommend you to get some extra help at https://forum.freegamedev.net/, since you have a lot of people who work on FLOSS going about there.
Visibility would be beneficial, although I don't really need more coders at this point; most bug fixes need to refer to the disassembly.

Quote
If you can whip up a few more screenshots and maybe a video I could write an article about it for the frontpage (it's been ages since it was last updated, but they still do get views).
Screenshots: sure. Video? Nope, don't have the software or experience for it. I do appreciate more PR but fucking suck at it. ;)