OpenXcom Forum

OpenXcom => Offtopic => Topic started by: Kilgore T.M. Replicant on April 20, 2018, 01:45:25 pm

Title: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant 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: ??? (http://s000.tinyupload.com/index.php?file_id=22223626532571517408)
Step 3: 1oom-0.1.tar.bz2 (http://s000.tinyupload.com/index.php?file_id=77639700907875942212) (md5sum: 665bd7bff107cb5919ab9dbec3d6b58c)
edit: Step 3.1: https://github.com/KilgoreTroutMaskReplicant/1oom (https://github.com/KilgoreTroutMaskReplicant/1oom)
edit: Step 3.2: Homepage (https://kilgoretroutmaskreplicant.github.io/1oom/)
edit: Step 3.3: https://gitlab.com/KilgoreTroutMaskReplicant/1oom (https://gitlab.com/KilgoreTroutMaskReplicant/1oom)
edit: Step 3.4: Homepage (https://kilgoretroutmaskreplicant.gitlab.io/plain-html)

Downloads: releases (https://gitlab.com/KilgoreTroutMaskReplicant/1oom/tags), development builds (https://lxnt.wtf/oxem/#/1oom)
Code: [Select]
git clone https://gitlab.com/KilgoreTroutMaskReplicant/1oom.git
See the homepage for screenshots (https://kilgoretroutmaskreplicant.gitlab.io/plain-html/screenshots.html).
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes 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.
Title: Re: Reversing to Orion - project 1oom
Post by: DoxaLogos (JG) on April 20, 2018, 06:22:55 pm
Yep, get this on GitHub! :)

BTW, is it called project1oom, because you're reversing MOO1 -> 1OOM ?
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant 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 (http://s000.tinyupload.com/index.php?file_id=74509813743672485250)

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.
Title: Re: Reversing to Orion - project 1oom
Post by: Hythlodaeus on April 21, 2018, 10:42:13 pm
Do the same with Master of Magic, and half of the internet will suck you off.
Title: Re: Reversing to Orion - project 1oom
Post by: Solarius Scorch 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!
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant 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.
Title: Re: Reversing to Orion - project 1oom
Post by: Hythlodaeus 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).
Title: Re: Reversing to Orion - project 1oom
Post by: SupSuper 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.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant 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.
Title: Re: Reversing to Orion - project 1oom
Post by: Skin36 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
Title: Re: Reversing to Orion - project 1oom
Post by: Hythlodaeus 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?
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant 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.
Title: Re: Reversing to Orion - project 1oom
Post by: Hythlodaeus 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).
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant 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. ;)
Title: Re: Reversing to Orion - project 1oom
Post by: Hythlodaeus on April 30, 2018, 06:46:57 pm
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.

This is why for instance snap packages are sandboxed to protect your computer (and appimage can also be sandboxed with an external app). Since you're a Gentoo user I understand where you're coming from, but most regular users do appreciate out-of-the-box convenience over dev libs download and command line fidgeting. I had not compiled anything for a looong time and it took me about 15 mins to figure out how to do it again, only to notice I had missed the INSTALL file all along. Maintaining packages can be tedious, but for the sake of dissemination and visibility, it helps a lot to have precompiled binaries, especially now that snap/appimage allow you to to distribute universal builds.

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...

I've played it for a bit, and I am really impressed with what I have seen so far. Everything looks pretty tight and functional, and even the intro is already working! How you managed to work on this on your own without any outside feedback whatsoever is quite the achievement!

Visibility would be beneficial, although I don't really need more coders at this point; most bug fixes need to refer to the disassembly.
Screenshots: sure. Video? Nope, don't have the software or experience for it. I do appreciate more PR but fucking suck at it. ;)

I got it to work, so I can snap some screenshots by myself. You really need to launch a proper project webpage for this though, because this project deserves a proper home and discussion forums!
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on April 30, 2018, 09:07:04 pm
Maintaining packages can be tedious, but for the sake of dissemination and visibility, it helps a lot to have precompiled binaries, especially now that snap/appimage allow you to to distribute universal builds.
I reluctantly agree. I will link to any binaries in the home page (see first post) but will not attempt to make any. I did have a mingw32 cross compiling setup once but am too lazy to set such up again.

You really need to launch a proper project webpage for this though, because this project deserves a proper home and discussion forums!
I admit that taking advantage of openxcom is a bit... skeevy? But I have no experience in creating either. Umm.., patches welcome...?
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on April 30, 2018, 09:14:38 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.
I feel this skips step 0: deteriming the "known" file formats. Consider disassembilng libz vs. naming a function "zip_uncompress" based on the parameter and surrouding code. Otherwise your post is spot-on.
Title: Re: Reversing to Orion - project 1oom
Post by: Hythlodaeus on April 30, 2018, 09:23:12 pm
I would say that at least Windows builds will be essential for more visibility, because Windows users don't know/don't want to use a compiler, and at least 80% of your future playerbase will be running Windows. Maybe you can request someone to help you with binaries in general, given you will only be releasing them on a monthly basis, as you mentioned before. I can try to learn how to make AppImage packages in the meantime to cover the linux side.

And don't feel bad for promoting your stuff in OXC forums. if anything the word should be spread in more places! You just made a fully playable open source clone of Master of Orion, after all!
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on April 30, 2018, 10:07:50 pm
I would say that at least Windows builds will be essential for more visibility, because Windows users don't know/don't want to use a compiler,
Sad but true, hence my request.

and at least 80% of your future playerbase will be running WindowsAndroid.
FTFY. Also: sad but true.

And don't feel bad for promoting your stuff in OXC forums. if anything the word should be spread in more places!
There are 2 related threads in reddit. I tried to push my shit warez merchandise elsewere but have been met with either IP blocks or "links to illegal content". So thanks to SupSuper! I promise to fuck off if someone sets up the platform. ;) IOW, spread the word.

edit: typos
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on May 01, 2018, 01:06:00 am
For windows build I suggest mxc, couple of people there use it t ocreate binaries for public, only drawback is that require linux to setup it.

By build follow this file (with some info about setup): https://github.com/Yankes/OpenXcom/blob/OpenXcomExtended/src/Makefile.mxe
Title: Re: Reversing to Orion - project 1oom
Post by: Skin36 on May 01, 2018, 09:02:34 am
https://store.steampowered.com/app/298050/Master_of_Orion/
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 01, 2018, 10:27:35 am
For windows build I suggest mxc, couple of people there use it t ocreate binaries for public, only drawback is that require linux to setup it.
Cool, a cross compiler + libs builder. Seems very useful. If it supports libsamplerate then setting up for 1oom should be really simple. I will stick with providing the source code.
Title: Re: Reversing to Orion - project 1oom
Post by: Skin36 on May 01, 2018, 11:34:29 am
I feel this skips step 0: deteriming the "known" file formats. Consider disassembilng libz vs. naming a function "zip_uncompress" based on the parameter and surrouding code. Otherwise your post is spot-on.

this can be done simultaneously. In any case, I will be happy to help.
Title: Re: Reversing to Orion - project 1oom
Post by: Hythlodaeus on May 01, 2018, 12:30:35 pm
Reported a game crashing bug and a small compiling issue on github.

Further suggestion: create a Freenode IRC channel in order to initiate discussion and report issues more promptly
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 02, 2018, 04:43:40 am
Reported a game crashing bug and a small compiling issue on github.
Thanks!

Further suggestion: create a Freenode IRC channel in order to initiate discussion and report issues more promptly
I agree that IRC is quite good for that. Unfortunately it does not fit my workflow. I'm online only for brief periods between development bursts.
Title: Re: Reversing to Orion - project 1oom
Post by: Hythlodaeus on May 02, 2018, 12:41:27 pm
I would suggest using gitter chat then. It can be linked to a regular IRC channel along the project's github, and it logsand highlights messages directed at you.
Title: Re: Reversing to Orion - project 1oom
Post by: SupSuper on May 03, 2018, 02:03:47 am
There are 2 related threads in reddit. I tried to push my shit warez merchandise elsewere but have been met with either IP blocks or "links to illegal content". So thanks to SupSuper! I promise to fuck off if someone sets up the platform. ;) IOW, spread the word.
Your IP is in a lot of public hitlists so I wonder what you or your neighbors have been up to. :P

https://osgameclones.com/ will probably be interested.

For windows build I suggest mxc, couple of people there use it t ocreate binaries for public, only drawback is that require linux to setup it.

By build follow this file (with some info about setup): https://github.com/Yankes/OpenXcom/blob/OpenXcomExtended/src/Makefile.mxe
I second the recommendation for mxe (http://mxe.cc/), we've been using it for the Git Builder and it works great. I'll look into making some Windows binaries.

Any reason you used SDL1.2 instead of SDL2 though?
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 03, 2018, 03:33:50 am
Your IP is in a lot of public hitlists so I wonder what you or your neighbors have been up to. :P
That's Tor for you. Pursuing anonymity is important wether you are searching for jpegs of Dolores Haze, staging a coup or reversing 25 year old games.

https://osgameclones.com/ will probably be interested.
Nice! I will notify them, thanks.

Any reason you used SDL1.2 instead of SDL2 though?
1. Familiarity and having some code ready for borrowing.
2. Debian libsdl2-dev depending on libwayland and various other odd libs.

Note that simultaneous builds for both (and more) were always in the plan. Someone just needs to implement src/hw/sdl/2. My focus is on bug genocide.
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on May 03, 2018, 03:43:10 am
Note that simultaneous builds for both (and more) were always in the plan. Someone just needs to implement src/hw/sdl/2. My focus is on bug genocide.
Looking at your code show that is indeed nearly drop in replacement, one file to change and rest of code base use fixed interface.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 03, 2018, 03:55:34 am
Looking at your code show that is indeed nearly drop in replacement, one file to change and rest of code base use fixed interface.
I expect the difficult part to be configure.ac. The video code could probably be copy/pasted from Chocolate Doom 3.0 as it is also aspect ratio corrected 320x200.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 03, 2018, 03:58:01 am
I would suggest using gitter chat then. It can be linked to a regular IRC channel along the project's github, and it logsand highlights messages directed at you.
I do not agree with their terms of service. Thanks again for the bug reports!
Title: Re: Reversing to Orion - project 1oom
Post by: SupSuper on May 03, 2018, 11:34:42 pm
Here's a Windows build if anyone wants to try it, just drop it in your MOO1 folder. For some reason audio doesn't seem to be working on Windows.

Sent you a pull request with the fixes I had to do: https://github.com/KilgoreTroutMaskReplicant/1oom/pull/5
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 04, 2018, 05:17:39 am
Here's a Windows build if anyone wants to try it, just drop it in your MOO1 folder. For some reason audio doesn't seem to be working on Windows.

Sent you a pull request with the fixes I had to do: https://github.com/KilgoreTroutMaskReplicant/1oom/pull/5
Wow, thanks! Merged. I'll see what wine says about the EXEs, but I doubt I can help with the audio issue (unless it's the complete lack of SDL_mixer).

edit: Looks like it is the missing SDL_mixer as stated in stderr (which I guess is kind of hard to see in Windows). Can't help much in fixing that.
Title: Re: Reversing to Orion - project 1oom
Post by: SupSuper on May 04, 2018, 11:06:57 pm
Nice catch, I fixed it and updated the download. The problem was MXE uses static libs by default, which your autoconf doesn't handle. You need to use `pkg-config --libs --static SDL_mixer` to catch all the SDL_mixer dependencies, just -lSDL_mixer won't do.

Shared libs would probably be more efficient, but that's beyond the scope of my meager "I just wanna play this on Windows" effort. :P
Title: Re: Reversing to Orion - project 1oom
Post by: Hythlodaeus on May 05, 2018, 12:00:54 am
Good news, just finished the game for the first time (on easiest difficulty), with no more random crashes. Still much testing to be done, especially in regards to AI, but for now I can confirm the game is at the very least finishable!

What an amazing achievement this project is, considering it is only at alpha phase!
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 05, 2018, 06:10:29 am
The problem was MXE uses static libs by default, which your autoconf doesn't handle. You need to use `pkg-config --libs --static SDL_mixer` to catch all the SDL_mixer dependencies, just -lSDL_mixer won't do.

Good job figuring that out! I guess the autoconf needs "--enable-static" that takes care of this. This can be hard for me to test and I hate fiddling with autocrap so I'll leave it up to the hands of kind, statically linking strangers.

Shared libs would probably be more efficient, but that's beyond the scope of my meager "I just wanna play this on Windows" effort. :P

Thanks to your efforts, I can sleep sound knowing that the code works on the most popular desktop spy platform operating system. I'd be happy if you (or someone else) could make a such a zip for the homepage could link to when I tag a v0.x release.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 12, 2018, 03:07:32 pm
A quick status update:
- Experimental SDL2 support has landed on the git repo. If you have experience with SDL2, now's the perfect time to lend a hand.
- Many bugs have been eradicated thanks to the reports from Hythlodaeus. Many bugs remain. Help with testing is appreciated.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 15, 2018, 08:25:50 pm
Finally managed to set up a win32 cross compiler. Thanks for the MXE suggestion!

Problem is that I can not test the binaries. Running in wine gives no music (same for SupSuper's exes) and I have no 32 bit GL libs (or something) so sdl1 is software only and sdl2 crashes on start.

If you use Windows, please grab the attached zip and report how it works. Comparisons on sdl1 vs. sdl2 would be interesting too.

(EDIT: ancient build removed)
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on May 15, 2018, 08:42:26 pm
`1oom_classic_sdl1` and `1oom_classic_sdl2` work and have sound, btw change name of readme from your "relese" because it conflict with file with same name from GoG version of MOO1

[ps]

you should probably add `ls` to console version (and pad support too :D ) because I do not see way to find all available planets, something like that:
Code: [Select]
lp [planet_name [max_dist]]       list all planets, if you add name it will sort by distance ascending, you can limit max distance
lf [planet_name [max_dist]]       list all fleets, if you add name it will sort by distance ascending, you can limit max distance
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 16, 2018, 10:58:10 am
`1oom_classic_sdl1` and `1oom_classic_sdl2` work and have sound

I want to be 100% sure of this: Do they have music? The sound effects for even on my wine setup.

btw change name of readme from your "relese" because it conflict with file with same name from GoG version of MOO1

Noted. I'll probably shove the other docs under doc/ to reduce the clutter.

you should probably add `ls` to console version (and pad support too :D ) because I do not see way to find all available planets, something like that:
Code: [Select]
lp [planet_name [max_dist]]       list all planets, if you add name it will sort by distance ascending, you can limit max distance
lf [planet_name [max_dist]]       list all fleets, if you add name it will sort by distance ascending, you can limit max distance

Something like this is planned, it's just that less important stuff like Windows ports get in the way. ;)

What is "pad support"?
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on May 16, 2018, 10:36:26 pm
What is "pad support"?
system console vs game console :>

For music, main menu and landing screen have it. It look its work same as dosbox version.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 17, 2018, 05:27:43 am
system console vs game console :>

(insert ASCII drawing of joke flying over head)

For music, main menu and landing screen have it. It look its work same as dosbox version.

Thanks for testing and the suggestions (btw, currently "l *" shows all stars).

--

I'm tempted to drop SDL2 from future win32 zips if there's no clear advantage to it. That dll is too fat for my taste. Better keep it for v0.3... If you have (or know of) a Windows version / setup where SDL1 does not work but SDL2 does then please chime in.
Title: Re: Reversing to Orion - project 1oom
Post by: SupSuper on May 17, 2018, 05:50:01 am
Finally managed to set up a win32 cross compiler. Thanks for the MXE suggestion!

Problem is that I can not test the binaries. Running in wine gives no music (same for SupSuper's exes) and I have no 32 bit GL libs (or something) so sdl1 is software only and sdl2 crashes on start.

If you use Windows, please grab the attached zip and report how it works. Comparisons on sdl1 vs. sdl2 would be interesting too.
SDL1.2 exe works fine for me but SDL2 exe doesn't even start. ???

Music plays fine. I'm guessing it doesn't work on Wine because it's MIDI, which uses a proprietary driver for playback on Windows.

Once you need more testers, I'd suggest posting a Windows build on the GOG and Steam forums for the original game, you're sure to get a lot of victims players. :)
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 18, 2018, 11:49:20 am
SDL1.2 exe works fine for me but SDL2 exe doesn't even start. ???

Thanks for testing. Odd to have it not work for some and not for others. Different Windows versions? In any case, I can't debug this problem further and will leave it to the nonexisting win32 maintainer.

Music plays fine. I'm guessing it doesn't work on Wine because it's MIDI, which uses a proprietary driver for playback on Windows.

Ah, makes sense in the "it's MS"  way.

Once you need more testers, I'd suggest posting a Windows build on the GOG and Steam forums for the original game, you're sure to get a lot of victims players. :)

I fear "once" was two weeks ago. Good suggestion, but I'm hesitant on registering to such services. I doubt they take kindly to strangers from Anonymousville, IP random.

help im trapped in a microsoft port factory

(EDIT: ancient build removed)
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on May 18, 2018, 08:55:55 pm
dos console version look working, and graphic version do not (tested using DosBox from GoG MoO). Any mouse click crash game.

another bug in console version `s s +10` does not work as advertised.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 19, 2018, 05:04:13 am
dos console version look working, and graphic version do not (tested using DosBox from GoG MoO). Any mouse click crash game.

Worked for me on Debian DOSBox. Try with -noaudio and link to and/or PM me your dosbox conf file. I won't spend much more time on that port.

another bug in console version `s s +10` does not work as advertised.

I will take a look when I get the "write ad-hoc parser" itch again. I'd be happy if someone rewrote all of src/ui/cmdline/.

edit:

Open dosbox-*.conf, find the "sbtype=" line and change it to "sbtype=sb16".  (What is it currently?) Code that works with sbpro2 and sbpro1 is now up in GitHub. Older sb models remain broken, but now produce an error message and exit. I have no interest in debugging Allegro sound drivers.

"s s +10" adds 10 to the slider value displayed after SHIP. The bug must be in the help text. I don't know what you expected.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 19, 2018, 11:50:16 pm
1oom v0.3 has been released. Changes:
    - new HW libraries: SDL2 and Allegro 4
    - new OS: MSDOS
    - win32 version now actually compiles
    - numerous bugs fixed
    - a log file is written by default
    - cmdline UI has emerged but is not fully playable yet
    - pkg-config support added for easier compiling
    - saveconv supports text input for debugging

Source code: https://github.com/KilgoreTroutMaskReplicant/1oom
Binaries: https://github.com/KilgoreTroutMaskReplicant/1oom/releases/tag/v0.3
Homepage: https://kilgoretroutmaskreplicant.github.io/1oom/

HELP WANTED!

The code still 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 bug report.
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on May 20, 2018, 03:21:48 am
One semi bug in SDL1 version, it always grab mouse and center it, because you can't easy alt-tab or move window around because of this.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 20, 2018, 03:55:25 pm
One semi bug in SDL1 version, it always grab mouse and center it, because you can't easy alt-tab or move window around because of this.

It shouldn't grab the mouse when it starts in windowed mode. Does middle click or Ctrl-F10 not release the mouse?
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on May 20, 2018, 05:03:02 pm
It shouldn't grab the mouse when it starts in windowed mode. Does middle click or Ctrl-F10 not release the mouse?
Right, this is correct, simply when I start game and click on it, and it will gab mouse automatically (that I did not notice before). And them I had problem that I described.
Overall I think best would be when game loose focus it should do action from `Ctrl-F10` too. Because otherwise every time cursor is over game windows (even it is in background) it will center cursor to window. With `Ctrl-F10` it release mouse and stop move it around, that I would except when I do alt tab.


btw I see I forget to post answer to your previous question, nosond work better and problem with `s s +10` is probably more with console than parsing, when I type `s s 10<up><backspace><backspace><backspace>+10` it will not work correctly, overall cursors are not handled in expected way and probably is not fault of your code.
For new bugs your last dos version crash when you move cursor to top edge of screen and overall crash when click (no sound set in dosbox config).
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 20, 2018, 05:25:48 pm
Right, this is correct, simply when I start game and click on it, and it will gab mouse automatically (that I did not notice before). And them I had problem that I described.

So what was the problem? When the mouse (or rather, the input) is grabbed, Alt-tab should not be possible. Middle click or Ctrl-F10 and you should be able to move/resize the window and alt-tab as normal.

Overall I think best would be when game loose focus it should do action from `Ctrl-F10` too. Because otherwise every time cursor is over game windows (even it is in background) it will center cursor to window. With `Ctrl-F10` it release mouse and stop move it around, that I would except when I do alt tab.

I agree. I don't see how the game would lose focus while the input is grabbed but then I run a rather minimalist UI... it's probably some SDL event I'm not handling properly. I will take a look. Thanks for the report!

btw I see I forget to post answer to your previous question, nosond work better and problem with `s s +10` is probably more with console than parsing, when I type `s s 10<up><backspace><backspace><backspace>+10` it will not work correctly, overall cursors are not handled in expected way and probably is not fault of your code.

The code supports readline which supports cursor key handling, but the win32 build was built without it. I'll see if I can add it easily in the next version. What still baffles me is how I was supposed to infer this from your message.

For new bugs your last dos version crash when you move cursor to top edge of screen and overall crash when click (no sound set in dosbox config).

Hmm, I'll test the mouse edge thing.

Note that the following things are not equivalent:
1. setting nosound=true in dosbox conf
2. setting sbtype=none in dosbox conf
3. running 1classic with -noaudio
4. turning off your speakers

Option 3 should fix the crash if it is sound related. Setting sbtype=sb16 should work as well.

What is sbtype set to in GoG MOO1?
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on May 20, 2018, 09:13:13 pm
The code supports readline which supports cursor key handling, but the win32 build was built without it. I'll see if I can add it easily in the next version. What still baffles me is how I was supposed to infer this from your message.
You can't, fist I thought that syntax is incorrect (I repeat this couple of times and I do not know how I manage to repeat this bugged sequence without realizing it), and after your reply I tried this again and it worked. Then I start examining this again and find what exactly cause this bug.

Hmm, I'll test the mouse edge thing.

Note that the following things are not equivalent:
1. setting nosound=true in dosbox conf
2. setting sbtype=none in dosbox conf
3. running 1classic with -noaudio
4. turning off your speakers

Option 3 should fix the crash if it is sound related. Setting sbtype=sb16 should work as well.

What is sbtype set to in GoG MOO1?
I set option (1). Config in attachment.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 21, 2018, 12:54:30 am
You can't, fist I thought that syntax is incorrect (I repeat this couple of times and I do not know how I manage to repeat this bugged sequence without realizing it), and after your reply I tried this again and it worked. Then I start examining this again and find what exactly cause this bug.

Ah, OK. I will try to get the next binaries to behave better.

I set option (1). Config in attachment.

Thanks. Now please do option 3 (1classic -noaudio) and tell if it fixes the crashing. Options 1 and 4 are equally effective.

I tried to make the DOS version crash by moving the mouse to edges. Never does that for me. I did add some new related code on git; no new binaries yet.

This may be silly question, but... are you actually running this via DOSbox? Does Windows allow running 32bit DOS programs without it these days?

The SDL versions were indeed not releasing the mouse grab when losing focus. Turns out SDL2 allows alt-tab while input is grabbed... learn something every day. Both SDL1 and SDL2 (hopefully) fixed on git, binaries will follow some day.

... speaking of which, nightly builds would be cool but I have no idea how to set those up. Tips and/or webspace welcome.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 25, 2018, 03:43:20 am
... so has anyone gotten the DOS version to work, audio or not?

Here's some untested binaries. Now with -uiscale N for the sharp eyed and readline for the typists.

The project could use some almost-nightly builds. I'd need some "latest builds" directory to point at in the homepage. The builds would be made and uploaded manually by me. If you have some tens of megabytes of webspace (and bandwidth) to spare and want to help out, please contact me.

(EDIT: ancient build removed)
Title: Re: Reversing to Orion - project 1oom
Post by: SupSuper on May 26, 2018, 12:52:24 am
... so has anyone gotten the DOS version to work, audio or not?

Here's some untested binaries. Now with -uiscale N for the sharp eyed and readline for the typists.

The project could use some almost-nightly builds. I'd need some "latest builds" directory to point at in the homepage. The builds would be made and uploaded manually by me. If you have some tens of megabytes of webspace (and bandwidth) to spare and want to help out, please contact me.
DOS version doesn't work for me, either executable just gives me the message "Load error: no DPMI - Get csdpmi*b.zip".

As for autobuilder, I would suggest looking into CI, there are a bunch of free solutions though I don't know any that fit your exact case:
- Travis (https://travis-ci.org/) - Linux machines, you can easily just feed it your GitHub and make and they will build/test/deploy whatever you want, but I doubt they're set up for cross-building Windows executables.
- Appveyor (https://www.appveyor.com/) - Windows machines, but they only build Visual Studio projects.

Otherwise you will just have to convince someone very generous. If you build them yourself, can't you just store them on GitHub Pages? Might have to eventually purge them from Git history to avoid bloating it with old builds.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 26, 2018, 05:28:14 am
DOS version doesn't work for me, either executable just gives me the message "Load error: no DPMI - Get csdpmi*b.zip".

Was this from the zip in the previous post? If so, then it's the missing cwsdpmi.exe which is (or should be?) included in the v0.3 release (and available elsewhere). I better include it in these builds too.

As for autobuilder, I would suggest looking into CI, there are a bunch of free solutions though I don't know any that fit your exact case:

Thanks, but I doubt they fit. I gather DOS cross compiles are rare these days. My problem is not building them, but hosting.

If you build them yourself, can't you just store them on GitHub Pages? Might have to eventually purge them from Git history to avoid bloating it with old builds.

Storing binary zips in git repos is all kinds of wrong.

Otherwise you will just have to convince someone very generous.

The best way for me to do this is to STFU and get back to coding.

Oh and thanks for the GoG PR. Here's to hoping your estimates in victim luring power are accurate.
Title: Re: Reversing to Orion - project 1oom
Post by: SupSuper on May 26, 2018, 07:32:17 am
Was this from the zip in the previous post? If so, then it's the missing cwsdpmi.exe which is (or should be?) included in the v0.3 release (and available elsewhere). I better include it in these builds too.
Ah sorry, forum attachments aren't the easiest way to track builds. :)
Game works fine now (with and without sound) but I'm getting the same issue as Yankes, touching the screen edge crashes the game. Tried on DOSBox 0.74, Daum build and X build.
(https://i.imgur.com/y6CMGlt.png)
If it helps, I'm running the game by just copying your files directly into the MOO1 folder.

Oh and thanks for the GoG PR. Here's to hoping your estimates in victim luring power are accurate.
Posted on Steam too. Doesn't seem to have done much, but here's hoping.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 27, 2018, 07:28:14 am
Game works fine now (with and without sound) but I'm getting the same issue as Yankes, touching the screen edge crashes the game. Tried on DOSBox 0.74, Daum build and X build.

Thanks for testing. I can't reproduce the crash on the Debian stable DOSBox (also 0.74). The mouse coords on the recent builds are limited both via Allegro and in 1oom code. I can't fathom where the problem lies. I guess the next step would be hunting down the source for the version you use, but I think I've wasted enough time on the DOS version as is.

Posted on Steam too. Doesn't seem to have done much, but here's hoping.

Thanks! Meanwhile, I'll continue to abuse the forum attachments. ;)

(EDIT: stopped abusing forum attachments)
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on May 27, 2018, 01:06:46 pm
Is always "printf" hack to find bug cause, this could track variables and see where is difference.
Title: Re: Reversing to Orion - project 1oom
Post by: Yataka Shimaoka on May 27, 2018, 07:59:28 pm
Sorry, but how do I install this?
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 28, 2018, 02:34:18 am
Is always "printf" hack to find bug cause, this could track variables and see where is difference.

I made a test program and a new 1classic.exe. This is my last attempt; if the attached 1classic still does not work and the mtest reveals nothing then I simply stop making DOS binaries.

--- posts merged ---

Sorry, but how do I install this?

You don't. See README (or 1README.txt if you got a binary zip). If still not sure please point out which part of README (or INSTALL) is unclear.

(EDIT: ancient unuseful test progam removed)
Title: Re: Reversing to Orion - project 1oom
Post by: Yataka Shimaoka on May 28, 2018, 05:44:55 am
There is no readme in the zip
Title: Re: Reversing to Orion - project 1oom
Post by: SupSuper on May 28, 2018, 06:39:30 pm
Sorry, but how do I install this?
Just extract to your MOO1 folder. You need to get v0.3 first though: https://github.com/KilgoreTroutMaskReplicant/1oom/releases/tag/v0.3
Kilgore's ZIPs only include the updated EXEs, not the whole package.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 29, 2018, 03:14:56 am
There is no readme in the zip

Fair enough. I will add one to the future zips. The need for the v0.3 files is mentioned in 1version.txt, but that is easy to ignore.

--

As for the DOS mouse crash: I managed to replicate it by running DOS in QEmu. Curiously it happens with Microsoft's mouse.exe but not with ctmouse.exe from FreeDOS. The crash seems to be due to stack corruption; CS:EIP has a nonsensical value. The crash has manifested as hanging on an infinite loop, a "clean" crash with DJGPP/cwsdpmi.exe register dump, emulated machine reset and QEmu itself crashing.

The bug is not in 1oom code. My current understanding is that something is broken in Allegro (or my cross-compiling setup) when either calling software interrupts from hardware interrupt contexts or interrupts in general. Perhaps some non-reentrant handler is entered twice simultaneously; this would explain why my DOSBox version works perfectly all the time as (I guess) it spends 0 cycles in the mouse interrupt handler. Perhaps later versions have more accurate emulation.

This is one of those rare cases where asm-level debugging is the only way forward. I need to get a DOSBox version that crashes and compile it with the debugging options...

This is a deep rabbit hole that contains software/hardware interrupts, DPMI, real/protected mode switching and nondeterministic bug reproduction. Fixing this is in firmly in the Not Worth The Fucking Effort pile. Seeing how there are no open bugs, might as well bang my head against this particular wall for a few more days.
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on May 29, 2018, 09:35:42 pm
Great that you find clue what cause this bug. Bugs like this are pain in ass, I today spend whole day in work trying find bug in my c# code that only happens on other peoples computers and not on my. After asking of couple of people to test it I manage to find that bug was in datapick control that read current windows locale and if value is "wrong" do not show any date at all.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on May 30, 2018, 03:09:52 am
Great that you find clue what cause this bug.

Still couldn't quite nail it but I managed to make a version that I can't get to crash (testing welcome). Removing the call to rest() seems to fix it. I fear the real bug is still lurking somewhere but is very difficult to reproduce in a way that makes it debuggable. (Got a frest SVN version of DOSBox and it still refuses to crash reliably.)

If this build works then I consider it good enough. I think my time is better spent on debugging the actual game rather than a port to a dead OS.

Bugs like this are pain in ass, I today spend whole day in work trying find bug in my c# code that only happens on other peoples computers and not on my. After asking of couple of people to test it I manage to find that bug was in datapick control that read current windows locale and if value is "wrong" do not show any date at all.

IMHO i18n is a curse word.

(EDIT: ancient build removed)
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on June 05, 2018, 06:28:36 am
I have no account and hold some contempt at [GitHub].

Welp. (https://blog.github.com/2018-06-04-github-microsoft/)

1oom has moved to GitLab: project (https://gitlab.com/KilgoreTroutMaskReplicant/1oom), git (https://gitlab.com/KilgoreTroutMaskReplicant/1oom.git), homepage (https://kilgoretroutmaskreplicant.gitlab.io/plain-html)

Still waiting for the DOS test results.

---
EDIT: to mark the occasion...

1oom v0.4 has been released. Changes:
    - add -uiscale N for viewing more of the galaxy at once
    - local multiplayer is ready for testing (use -new to start)
    - 1oom_pbxdump as the counterpart to 1oom_pbxmake
    - bug genocide marches on, notably:
    - AI fleets disappearing when sent fixed
    - AI ship design phase can no longer hang
    - MSDOS port should not crash at the slightest provocation

Source code: https://gitlab.com/KilgoreTroutMaskReplicant/1oom
Binaries: https://gitlab.com/KilgoreTroutMaskReplicant/1oom/tags/v0.4
Homepage: https://kilgoretroutmaskreplicant.gitlab.io/plain-html/

Note that the project has moved from GitHub to GitLab. Grab a fresh git clone.

HELP WANTED!

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 bug report.

---

EDIT the 2nd: Apologies to those helpful people spreading the word. Sorry about the link breakage! Have a childish PNG as an attempt at compensation.
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on June 15, 2018, 03:48:32 pm
https://github.com/KilgoreTroutMaskReplicant/ is 404

Is this project dead ?
Title: Re: Reversing to Orion - project 1oom
Post by: Kammerer on June 15, 2018, 06:14:06 pm
1oom has moved to GitLab: project (https://gitlab.com/KilgoreTroutMaskReplicant/1oom), git (https://gitlab.com/KilgoreTroutMaskReplicant/1oom.git), homepage (https://kilgoretroutmaskreplicant.gitlab.io/plain-html)

It was moved to GitLab due to the fact that GitHub had been purchased by Microsoft.
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on June 15, 2018, 06:28:43 pm
It was moved to GitLab due to the fact that GitHub was purchased by Microsoft.

Thanks.

One wonders who would buy GitLab next.

btw it doesn't build:

Code: [Select]
../../../src/game/game_ai_classic.c:3751:28: error: ‘p2’ undeclared (first use in this function); did you mean ‘p1’?
             e1->diplo_type[p2] = 0;

looks like a typo
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on June 16, 2018, 11:29:11 am
One wonders who would buy GitLab next.
please don't let it be facebook

Building centralized services named after the decentralized project that saved us from CVS / SVN hell always struck me as odd.

Quote
btw it doesn't build:

Sorry about that. Fix has been pushed. Must have been half asleep to not test compile before committing.
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on June 16, 2018, 03:58:45 pm
please don't let it be facebook


Whoever that might be, it's inevitable: they raised $45.5M in venture capital to date.

Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on June 16, 2018, 09:45:33 pm
Now that any goodwill this project may have gathered has been demolished by the avenue move, I guess it's back to tinyupload on the next offensive buyout.

Here's a dev build to celebrate recent feature creep. Notable changes:
- -uiextra enables things like new New Game screen
- new AI Classic+ for small fixes
- mouse wheel map zoom (-uiscale 2 or more) and slider adjust
- implemented various 1.40m fixes / improvements

I'm debugging overflows in AI code and need a late game save which has two or more opponents with large fleets of (near) max tech. Playing a game to that points takes a lot of time. If you happen to have such a save (for 1oom or MOO1 v1.3) then please send it to me.

(EDIT: ancient build removed)
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on June 17, 2018, 12:20:02 am
Now that any goodwill this project may have gathered has been demolished by the avenue move, I guess it's back to tinyupload on the next offensive buyout.

Well, once upon a time I ran an SVN server for the UFO2000.

I guess it's back to self-hosting repos. Any way one slices the orange, there has to be some place where for example my buildfarm is to get the source code from.

Not that much of a step, it's not like the forums, or my builds aren't self-hosted.

Any particular builds (OS/arch) you'd like automated?

Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on June 17, 2018, 12:51:12 pm
Well, once upon a time I ran an SVN server for the UFO2000.

Merging SVN branches sure was a pain.

I guess it's back to self-hosting repos. Any way one slices the orange, there has to be some place where for example my buildfarm is to get the source code from.

Not that much of a step, it's not like the forums, or my builds aren't self-hosted.

Any particular builds (OS/arch) you'd like automated?

.... is this an offer to provide automatic builds and host them? If so, then yay!

I believe the win32/SDL1 is the only one that really matters. Folks using Linux should be able to build this easily enough (and make install is not required), although a snap package has been asked for. Still haven't got a word on if the DOS version crash fix worked, so I'll keep ignoring it.

So the answer is win32/SDL1 but I wouldn't turn down other builds.
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on June 17, 2018, 01:57:24 pm
Merging SVN branches sure was a pain.

.... is this an offer to provide automatic builds and host them? If so, then yay!

I believe the win32/SDL1 is the only one that really matters. Folks using Linux should be able to build this easily enough (and make install is not required), although a snap package has been asked for. Still haven't got a word on if the DOS version crash fix worked, so I'll keep ignoring it.

So the answer is win32/SDL1 but I wouldn't turn down other builds.
I garbed last version and crashes with mouse stops. Tested without sound.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on June 18, 2018, 02:04:26 am
I garbed last version and crashes with mouse stops. Tested without sound.

...? The mouse crashing stopped? It crashes when the mouse stops? I do not understand. Just answer this: does the latest DOS version crash?
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on June 18, 2018, 07:17:34 pm
I mean, I do not have crash anymore when I move mouse on edges of screen. Last version work fine, at least without sound (because I do not test with it enabled).
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on June 18, 2018, 07:55:38 pm
I mean, I do not have crash anymore when I move mouse on edges of screen. Last version work fine, at least without sound (because I do not test with it enabled).

Thanks for testing and clarifying. The DOS port lives to see another release.
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on June 23, 2018, 03:51:54 pm
Here goes a build:  https://lxnt.wtf/oxem/#/1oom

only problem it doesn't work, the *sdl1.exes  just quit silently, and the cmdline exe complains about too few entries in diplomat.lbx

EDIT: the linux build complains:

Code: [Select]
error: LBX: space.lbx invalid id 57 >= 57
error: opening file 'v11.lbx'!

this all with data files from myabandonware.com


Also, some warnings:

Code: [Select]
game_ai_classic.c: In function ‘game_ai_classic_turn_p1_front’:
game_ai_classic.c:287:70: warning: array subscript is above array bounds [-Warray-bounds]
                 if (ait->tbl_front_planet[i] == ait->tbl_front_planet[j]) {
                                                 ~~~~~~~~~~~~~~~~~~~~~^~~
game_ai_classic.c:294:73: warning: array subscript is above array bounds [-Warray-bounds]
                     ait->tbl_front_relation[j] = ait->tbl_front_relation[j + 1];
                                                  ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
game_ai_classic.c:295:69: warning: array subscript is above array bounds [-Warray-bounds]
                     ait->tbl_front_planet[j] = ait->tbl_front_planet[j + 1];
                                                ~~~~~~~~~~~~~~~~~~~~~^~~~~~~

game_ai_classic.c: In function ‘game_battle_ai_target1’:
game_ai_classic.c:2764:13: warning: ‘tblxy[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     uint8_t tblxy[1];

fmt_mus.c: In function ‘xmid_convert_evnt’:
fmt_mus.c:150:32: warning: variable ‘b’ set but not used [-Wunused-but-set-variable]
                     uint8_t c, b;
                                ^
mv -f .deps/util.Tpo .deps/util.Po
fmt_sfx.c: In function ‘fmt_sfx_convert_voc’:
fmt_sfx.c:257:30: warning: variable ‘marker’ set but not used [-Wunused-but-set-variable]
                     uint16_t marker;
                              ^~~~~~
gcc -DHAVE_CONFIG_H -I.  -I../src/os/unix -I../src   -g -O3 -Wall -Wno-inline -Wstrict-prototypes -MT pbxdump.o -MD -MP -MF .deps/pbxdump.Tpo -c -o pbxdump.o pbxdump.c
fmt_sfx.c:271:30: warning: variable ‘repeatnum’ set but not used [-Wunused-but-set-variable]
                     uint16_t repeatnum;
                              ^~~~~~~~~
fmt_sfx.c:170:32: warning: variable ‘ctype’ set but not used [-Wunused-but-set-variable]
         uint8_t b, block_type, ctype = 0, stereo = 0, sr;
                                ^~~~~
fmt_sfx.c:170:17: warning: variable ‘b’ set but not used [-Wunused-but-set-variable]
         uint8_t b, block_type, ctype = 0, stereo = 0, sr;

lbxview.c: In function ‘drawscreen_inlbx’:
lbxview.c:286:56: warning: ‘%x’ directive writing between 1 and 4 bytes into a region of size between 0 and 20 [-Wformat-overflow=]
         sprintf(linebuf, "%ix%i f:%i/%i(%i)%c (%x)(%x)(%x) if:%i fmt:%i | %i %i",
                                                        ^~
lbxview.c:286:26: note: directive argument in the range [0, 65535]
         sprintf(linebuf, "%ix%i f:%i/%i(%i)%c (%x)(%x)(%x) if:%i fmt:%i | %i %i",
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lbxview.c:286:26: note: directive argument in the range [0, 255]
lbxview.c:286:26: note: directive argument in the range [0, 255]
In file included from /usr/include/stdio.h:862:0,
                 from lbxview.c:3:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: ‘__builtin___sprintf_chk’ output between 41 and 96 bytes into a destination of size 41
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __bos (__s), __fmt, __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lbxview.c:295:62: warning: ‘__builtin___sprintf_chk’ may write a terminating nul past the end of the destination [-Wformat-overflow=]
             sprintf(linebuf, "pal o:%x do:%x f:%i n:%i (%02x)",
                                                              ^
In file included from /usr/include/stdio.h:862:0,
                 from lbxview.c:3:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: ‘__builtin___sprintf_chk’ output between 26 and 42 bytes into a destination of size 41
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __bos (__s), __fmt, __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


EDIT: okay, works with v1.3 data files. might be helpful to spit an error message to mention that.
But not the sdl1-win32 version, hmm. cmdline one works tho


EDIT: sprintf at lbxview.c:286 crashes for me every time. a kludge of     char linebuf[100500]; helps a bit
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on June 24, 2018, 07:08:14 am
Here goes a build:  https://lxnt.wtf/oxem/#/1oom

First of all: Yay! Thanks a lot!

Please name set the version part of the files according to "git describe --tags" to reduce confusion between 7z name and what is shown in 1oom_log.txt and the main menu (if uiextra is enabled).

Can I put that URL on the homepage?

only problem it doesn't work, the *sdl1.exes  just quit silently, and the cmdline exe complains about too few entries in diplomat.lbx

EDIT: okay, works with v1.3 data files. might be helpful to spit an error message to mention that.

The md5sums are listed in doc/lbxmd5.txt. Good idea on the error message.

Also, some warnings:

Thanks, will take a look.

But not the sdl1-win32 version, hmm. cmdline one works tho

Can't help much with win32 testing...
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on June 24, 2018, 05:49:44 pm
First of all: Yay! Thanks a lot!

Please name set the version part of the files according to "git describe --tags" to reduce confusion between 7z name and what is shown in 1oom_log.txt and the main menu (if uiextra is enabled).

Can I put that URL on the homepage?

No problem, and I fixed the file names

Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on June 24, 2018, 06:51:06 pm
No problem, and I fixed the file names

Thanks. Added to OP and homepage.

Fixed the lbxview buffer size and added a check for V11.LBX and a suitable error message. The unused vars in fmt_*.c are used in debug builds (--enable-modebug) and I'd rather not add ifdefs around the declarations. The array bounds warning in game_ai_classic.c baffles me; clearly the index i is bound to same limits as j but it only complains about the latter.

Is win32 still broken? Anything on 1oom_log.txt? I'll try it in wine later.
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on June 24, 2018, 10:17:36 pm

Is win32 still broken? Anything on 1oom_log.txt? I'll try it in wine later.

It doesn't write anything to 1oom_log.txt. Must be silently quitting somewhere before the first logwrite.

I can't for the life of me install wine at my 18.04 box, and running stuff under gdb in native win32 is kind of seriously hampered by the fact that there seems to not be an i686 gdb built for MSYS2. Looks like I'll have to dig out an x64 box, there should be a couple or three old ones somewhere in the lair.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on June 25, 2018, 08:06:55 am
It doesn't write anything to 1oom_log.txt. Must be silently quitting somewhere before the first logwrite.

Tried with "wine 1oom_classic_sdl1 -nogl" on Debian stable wine, seemed to work OK. Can't test without -nogl due to missing 32-bit graphics drivers. Not much of a test but hey, have a datapoint.

Do the win32 binaries I have released work on your box?
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on June 25, 2018, 11:15:30 am
Yeah, well the -nogl did it.

I'll take a look into SDL1/2 init code, I've got tons of that boilerplate in my other projects.


EDIT:

You know, I'd consider dropping sdl1 support. I looked into the mess the GL support there is and ewww.. You really want to waste your time supporting it?

Running sdl1/sdl2 builds under RDP (no GL, no sound, but hey it should still run) makes it quit with

Code: [Select]
error: initialising SDL_mixer (48000 Hz, slice 2048): DirectSoundCreate: No audio device found

src/hw/sdl/hwsdl_audio.c:111

This is suboptimal, it should continue without sound.

Suggest just returning 0 instead of -1 from  hw_audio_init() in case any Mix_* function fails.

EDIT: and also ./ui/classic/uiclassic.c:382 should rely not on opt_audio_enabled but on audio_initialized


Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on June 26, 2018, 04:55:57 am
Yeah, well the -nogl did it.

Weird that it didn't get to write any log, the video init should come way later. Maybe the log needs more flushing.

Do the sdl1 binaries I have released work with -gl?

You know, I'd consider dropping sdl1 support. I looked into the mess the GL support there is and ewww.. You really want to waste your time supporting it?

I use sdl1 so it's not getting dropped. So far 100% of Windows test reports have stated that sdl1 works but only 50% that sdl2 does. (Sample size being 2...)

As for a waste of time: have you noticed there's Allegro 4 support?

I do not care much which SDL version the Windows users have to deal with. For the v0.x releases I will build both.

This is suboptimal, it should continue without sound.

No. I consider this a fatal error. There is -noaudio for playing without sound.

EDIT: and also ./ui/classic/uiclassic.c:382 should rely not on opt_audio_enabled but on audio_initialized

See above. Also, I do not plan to expand the hw/ API with the latter.
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on June 26, 2018, 02:38:32 pm
Weird that it didn't get to write any log, the video init should come way later. Maybe the log needs more flushing.

Strange, yeah.

Quote
Do the sdl1 binaries I have released work with -gl?

system: win7 embedded standard x64, nvidia gt218

all binaries work.

system: same, but via RDP:

-noaudio -nogl:  sdl1 builds work; sdl2 builds: your silently quits, mine crashes:

Code: [Select]
#0  0x0051cff0 in SDL_LowerBlit_REAL (src=0x13bb780,
    srcrect=0x76a4f8 <video+24>, dst=0x0, dstrect=0x76a4f8 <video+24>)
    at src/video/SDL_surface.c:592
#1  0x004a6ad6 in video_update () at hwsdl2_video.c:210
#2  0x004a6f58 in hw_video_set_palette (num=256, first=0,
    pal=0x76a554 <video+116> "") at ../../../../src/hw/sdl/hwsdl_video.c:40
#3  hw_video_refresh_palette () at ../../../../src/hw/sdl/hwsdl_video.c:40
#4  hw_video_init (w=<optimized out>, h=<optimized out>) at hwsdl2_video.c:493
#5  0x00463458 in ui_late_init () at uiclassic.c:342
#6  0x0040f2a2 in main_do () at game.c:506
#7  0x0040b6d7 in main_1oom (argc=2, argv=0x13b1688) at main.c:81
#8  0x004a4575 in SDL_main (argc=argc@entry=2, argv=argv@entry=0x13b1688)
    at hwsdl2.c:210
#9  0x004d8fb4 in main_utf8 (argv=0x13b1688, argc=2)
    at src/main/windows/SDL_windows_main.c:126
#10 main_getcmdline () at src/main/windows/SDL_windows_main.c:159
#11 0x004d90c5 in WinMain@16 (hInst=0x400000, hPrev=hPrev@entry=0x0,
    szCmdLine=0x15c418f "-noaudio", sw=10)
    at src/main/windows/SDL_windows_main.c:202

What happens is that the pixelformat for the window is RGB565 under RDP, but for some reason SDL_PixelFormatEnumToMasks() in video_sw_set() returns 'Unknown pixel format' for it, and then rgbabuffer is NULL, and all goes down from there.

sdl2 builds reject -gl/-nogl flags and die silently (when running under MSYS2 gdb one can notice an error message, but no logs written). The above backtrace is for a run with -noaudio only.

sdl1 builds with -noaudio -gl over RDP: a window opens with white background; nothing else happens.


Quote
I use sdl1 so it's not getting dropped. So far 100% of Windows test reports have stated that sdl1 works but only 50% that sdl2 does. (Sample size being 2...)

As for a waste of time: have you noticed there's Allegro 4 support?

I do not care much which SDL version the Windows users have to deal with. For the v0.x releases I will build both.

No. I consider this a fatal error. There is -noaudio for playing without sound.

See above. Also, I do not plan to expand the hw/ API with the latter.

Your decision, man. It was only a suggestion.
(also I thought allegro is for the dos version).
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on June 27, 2018, 05:31:40 am
What happens is that the pixelformat for the window is RGB565 under RDP, but for some reason SDL_PixelFormatEnumToMasks() in video_sw_set() returns 'Unknown pixel format' for it, and then rgbabuffer is NULL, and all goes down from there.

16b color is currently unsupported. I don't have an easy way to test it so I won't attempt to fix it. Patches welcome.

sdl2 builds reject -gl/-nogl flags and die silently (when running under MSYS2 gdb one can notice an error message, but no logs written). The above backtrace is for a run with -noaudio only.

-gl/-nogl are sdl1 only, sdl2 does not use OpenGL direcly but uses the SDL2 API instead.

The log file is opened after reading the cmdline args so it missing in this case is normal (although not necessarily user-friendly).

sdl1 builds with -noaudio -gl over RDP: a window opens with white background; nothing else happens.

Must be the 16b thing. Thanks for testing!

Your decision, man. It was only a suggestion.

Don't take my terse refusals the wrong way. I do appreciate suggestions, but can be rather blunt when explaining why I've chosen not to implement them.

(also I thought allegro is for the dos version).

Quite right, but
1) there is nothing stopping to build that hw/ for other OSs
2) the DOS version is a perverse curiosity that has eaten way too much of my time already
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on June 27, 2018, 08:41:45 pm
16b color is currently unsupported. I don't have an easy way to test it so I won't attempt to fix it. Patches welcome.

Here - https://gitlab.com/StoddardOXC/1oom/commit/1043353804aee6f9837d50164e1face7638e5b22

sdl2 only.  16/15 bpp now works. 24 bpp also works, but I didn't look if it didn't work before.

BUT! 8bpp still crashes (yes, RDP has that mode). But I'm not going into that.


EDIT: also the mouse is crazy  over rdp/vnc. But whatever.

 
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on June 28, 2018, 05:03:03 am
Here - https://gitlab.com/StoddardOXC/1oom/commit/1043353804aee6f9837d50164e1face7638e5b22

sdl2 only.  16/15 bpp now works. 24 bpp also works, but I didn't look if it didn't work before.

Thanks! Small issues before merging:
- use log_error for the error messages
- die using exit(EXIT_FAILURE)
- use if (x == NULL) as the arguably superior (NULL == x) is not used elsewhere

BUT! 8bpp still crashes (yes, RDP has that mode). But I'm not going into that.

Wise decision. Let sdl1 handle the low end. Speaking of which, I guess I have to fix 15/16/24b for it now.

EDIT: also the mouse is crazy  over rdp/vnc. But whatever.

Care to elaborate? The sdl2 mouse code is a bit weird since using mouse events destroyed the performance.
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on June 28, 2018, 03:57:06 pm
Thanks! Small issues before merging:
- use log_error for the error messages
- die using exit(EXIT_FAILURE)
- use if (x == NULL) as the arguably superior (NULL == x) is not used elsewhere

Done.

Care to elaborate? The sdl2 mouse code is a bit weird since using mouse events destroyed the performance.

It looks like the mouse movement is multiplied by a factor of 50-100, even outside the game window. So it's completely unusable, and even closing the game from the main menu is quite a challenge.

Besides, what was the problem with the mouse events? I never heard or seen such a problem.

Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on June 29, 2018, 06:04:59 am
Done.

Cool. Send a PR/MR/whatever when ready.

It looks like the mouse movement is multiplied by a factor of 50-100, even outside the game window. So it's completely unusable, and even closing the game from the main menu is quite a challenge.

Hmm. A bug report appeared also stating problems with the sdl2 mouse movement. At least I know the wall I will be bashing my head against for the next few days.

I hope you have noticed the Ctrl-Esc shortcut and have not been wresting with mice to escape.

Besides, what was the problem with the mouse events? I never heard or seen such a problem.

Looking at the main menu and moving the mouse by some tens of pixels resulted in the animation freezing for about a second while the mouse crawled to the new position. Apparently the mouse events filled the event queue and everything ground down to a halt. Perhaps this only happens with high DPI mice.

I found the disable mouse motion events solution by googling but can't find it again. Commit 189fa32597f724c3ca0ad1e1adc42532c243d6d0 has the fix.

EDIT: Pushed sdl1 15/16/24bpp support. Test results on 15/16/24bpp setups would be helpful.
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on June 29, 2018, 01:18:23 pm
Cool. Send a PR/MR/whatever when ready.

Done

I hope you have noticed the Ctrl-Esc shortcut and have not been wresting with mice to escape.

For me, ctrl-shift-esc to task manager and then keyboard-killing the process works somewhat over RDP (ubuntu/remmina)


Hmm. A bug report appeared also stating problems with the sdl2 mouse movement. At least I know the wall I will be bashing my head against for the next few days.

Looking at the main menu and moving the mouse by some tens of pixels resulted in the animation freezing for about a second while the mouse crawled to the new position. Apparently the mouse events filled the event queue and everything ground down to a halt. Perhaps this only happens with high DPI mice.

I've reverted the ignore-mouse-motion commit, and even when spamming the log with events, it does not slow down noticeably. Still, the values I get when over RDP are insane:

Code: [Select]
SDL_MOUSEMOTION abs 0 239 rel -102 0
SDL_MOUSEMOTION abs 0 239 rel -103 0
SDL_MOUSEMOTION abs 0 239 rel -256 0
SDL_MOUSEMOTION abs 0 239 rel -153 0
SDL_MOUSEMOTION abs 0 239 rel -154 0
SDL_MOUSEMOTION abs 0 171 rel -307 -68
SDL_MOUSEMOTION abs 0 171 rel -205 0
SDL_MOUSEMOTION abs 0 171 rel -205 0
SDL_MOUSEMOTION abs 0 171 rel -460 0
SDL_MOUSEMOTION abs 0 171 rel -359 0
SDL_MOUSEMOTION abs 0 171 rel -153 0
SDL_MOUSEMOTION abs 0 34 rel -512 -137
SDL_MOUSEMOTION abs 0 0 rel -717 -273
SDL_MOUSEMOTION abs 0 0 rel -256 -136
SDL_MOUSEMOTION abs 0 0 rel -256 -69
SDL_MOUSEMOTION abs 0 0 rel -410 -273





EDIT: Pushed sdl1 15/16/24bpp support. Test results on 15/16/24bpp setups would be helpful.

Works for me.


EDIT: minor nit in configure.ac:

Code: [Select]
-    gitversion=`$GIT describe --tags`
+    gitversion=`$GIT -C $srcdir describe --tags`

for out-of-tree builds.
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on June 29, 2018, 03:02:14 pm
Done

For me, ctrl-shift-esc to task manager and then keyboard-killing the process works somewhat over RDP (ubuntu/remmina)


I've reverted the ignore-mouse-motion commit, and even when spamming the log with events, it does not slow down noticeably. Still, the values I get when over RDP are insane:
<untested hypothesis>
Because it RDP "fault":
a) RDP move mouse cursor to you real mouse cursor position
b) 1oom always center mouse cursor

Problem is that your real cursor is not moved. Then what happens? Both things fight where position should be, 1oom to center or RDP to your real cursor.
</untested hypothesis>
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on June 29, 2018, 04:58:43 pm
<untested hypothesis>
Because it RDP "fault":
a) RDP move mouse cursor to you real mouse cursor position
b) 1oom always center mouse cursor

Problem is that your real cursor is not moved. Then what happens? Both things fight where position should be, 1oom to center or RDP to your real cursor.
</untested hypothesis>

You know what?  I commented out the SDL_SetRelativeMouseMode() call and the madness went away. As in that the game became playable. I'm not sure why it's even needed, since this isn't a 3d-shooter.

Sure, this isn't a solution, just a band-aid. The actual bug is somewhere in rdp/directinput/sdl2/whatever interaction of course.
Still, RDP makes testing on windows that much simpler, and I'd appreciate an option to disable relative mouse mode.

PS.  OXCE+ doesn't have this problem either. It's SDL1, granted, but the 1oom sdl1 build does have erratic mouse, although not as bad as sdl2 one.

Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on June 29, 2018, 05:34:55 pm
I only connected dots, I could be right or it could be wrong, bu your change show that I guess right.

OXC could have this problem too, try middle click map scroll, IIRC it use relative mouse mode.
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on June 29, 2018, 08:50:27 pm
I only connected dots, I could be right or it could be wrong, bu your change show that I guess right.

Yeah, sorry for the tone, Yankes. I was too irritated by this mouse crap for two days.

Certainly the problem is in the relative mouse mode vs RDP/VNC.

Still for a game like MOO1 which does not have a use for a relative mode afaik, it's strange to insist on it, then build an absolute mode on top of that. I guess that's the origins of the code showing through.

EDIT:

OXC could have this problem too, try middle click map scroll, IIRC it use relative mouse mode.

OXCE+ sure doesn't  use relative mode for the battlescape middle-button scroll. Geoscape does, though, but it's fully usable if a bit too sensitive. A bit.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on June 30, 2018, 03:39:41 am
I've reverted the ignore-mouse-motion commit, and even when spamming the log with events, it does not slow down noticeably.

Maybe it's this stupid high DPI gaming mouse I have.

Works for me.

Thanks for testing!

EDIT: minor nit in configure.ac:

Code: [Select]
-    gitversion=`$GIT describe --tags`
+    gitversion=`$GIT -C $srcdir describe --tags`

for out-of-tree builds.

Good catch. I guess same goes for src/version.sh.

<untested hypothesis>

Nice!

You know what?  I commented out the SDL_SetRelativeMouseMode() call and the madness went away. As in that the game became playable. I'm not sure why it's even needed, since this isn't a 3d-shooter.

Thanks for the detective work. I'll try to get rid of the relative mouse mode. Also appears in bug #25 (https://gitlab.com/KilgoreTroutMaskReplicant/1oom/issues/25).

The calls are there because sdl2 is a quick hack based on sdl1. I'm not an expert on either SDL. Sorry for the inconvenience.

EDIT: after some testing and recollecting...

1oom mouse usage is not absolute. Removing SDL_SetRelativeMouseMode is not a solution. Try commenting it out and:
1. Start/continue game
2. Move cursor over Next turn
3. Press cursor left to move to Game
4. Move back to Next turn using the mouse
5. Repeat from step 3 until mouse stops moving right

I can't see anything in the SDL mouse API that would allow what the MOO1 UI needs and RDP/VNC works with. Ideas?

Still, RDP makes testing on windows that much simpler, and I'd appreciate an option to disable relative mouse mode.

I assume this is even with the shortcomings. I'll reluctantly add an option for it. EDIT 2: Done: -norelmouse, SDL2 only.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on July 01, 2018, 08:00:06 am
1oom v0.5 has been released. Changes:
    - support mouse wheel for lists, sliders and zooming
    - add -uiextra for enabling extra UI features, notably:
        * new New Game screen with opponent selection (including AI/player)
        * planetary governor for less micro (click on name to enable/disable)
    - SDL: support 15/16/24 bpp
    - added documentation on differences to v1.3
    - some improvements from the unofficial patch v1.40m have been implemented
    - add Classic+ AI with small fixes, some from v1.40m
    - about 100 bugs fixed, notably:
        * the AI should now provide a worthy challenge
        * space combat works as it should
        * fixed many crashes
    - added doc/pbxin_fixbugs.txt for optional bug fixes
    - last and least: the "No Events" text overlay is implemented

Source code: https://gitlab.com/KilgoreTroutMaskReplicant/1oom
Binaries: https://gitlab.com/KilgoreTroutMaskReplicant/1oom/tags/v0.5
Homepage: https://kilgoretroutmaskreplicant.gitlab.io/plain-html/
Development builds: https://lxnt.wtf/oxem/#/1oom

HELP WANTED!

The project has reached a point where the game is fully playable, not crashing all the time and actually fighting back.

Many of the undoubtedly remaining bugs will need MOO1 expertise to spot. If you can beat MOO1 on impossible (which the project maintainer has yet to do) then please give this a whirl and report any oddities you encounter.

Late game saves with (near) max tech and huge fleets would be very helpful in debugging overflows. If/when you have some, please send them along.

Big endian hardware test results would be interesting.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on July 26, 2018, 05:32:16 am
you should probably add `ls` to console version (and pad support too :D ) because I do not see way to find all available planets, something like that:
Code: [Select]
lp [planet_name [max_dist]]       list all planets, if you add name it will sort by distance ascending, you can limit max distance
lf [planet_name [max_dist]]       list all fleets, if you add name it will sort by distance ascending, you can limit max distance

Several hundred commits later:
Code: [Select]
v [RANGE] [+DIST] [FILTERS]

Good things come to those who wait.
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on July 26, 2018, 08:18:05 pm
btw mouse problems, over all if I understand correctly problem is that cursor keys can move mouse too, then what if you use `SDL_WarpMouseInWindow` when you use cursors? This teoricaly could keep both in sync.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on July 27, 2018, 04:33:06 am
btw mouse problems, over all if I understand correctly problem is that cursor keys can move mouse too, then what if you use `SDL_WarpMouseInWindow` when you use cursors? This teoricaly could keep both in sync.

The cursor is also moved automatically on some other occasions (usually setting it on a Continue button).

Isn't the problem with relative mouse mode that on VNC/RDP such warping does not work? I won't attempt a fix that I can neither test nor be sure if it would help any.
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on July 27, 2018, 09:34:54 pm
I did not test this, end even never try using this function, but I except this could avoid most problems.

Right now when using SDL relative mouse need move real mouse to center, and you use only relative motion to move display cursor around.
If you do not do this and you use keyboard arrow keys then real mouse and display cursors go out of sync.
This have drawback of that RDP always can overwrite mouse position this make SDL and RDP fight each other.

Now we change approach.

Instead of relative we use absolute mouse position. SDL do not move mouse anywhere only read its position.
If you press keyboard arrow key then and only then SDL move real mouse to expected position, this will keep real mouse and display cursors in sync.
When you did this with RDP then it again move mouse but now SDL do not try move it again. Fight is over because SDL give up without fight.

Side effect:

Arrows keys do not working in RDP, but as it do not work now ether so we do not lose any thing.


Again this is not tested, I could even misunderstood how `SDL_WarpMouseInWindow` work, but if I guess it right it should work as described.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on July 28, 2018, 06:53:53 am
Thanks for the detailed analysis.

I did not test this, end even never try using this function, but I except this could avoid most problems.

I fear it would create a few more.

Instead of relative we use absolute mouse position. SDL do not move mouse anywhere only read its position.
If you press keyboard arrow key then and only then SDL move real mouse to expected position, this will keep real mouse and display cursors in sync.

The expected position varies based on window size and which aspect ratio is used (if any). The current mouse code is blissfully unaware of all that.

Using SDL_WarpMouseInWindow generates a mouse event. I fear that could affect mouse acceleration in some broken cases (see bug (https://gitlab.com/KilgoreTroutMaskReplicant/1oom/issues/25)).

Side effect:

Arrows keys do not working in RDP, but as it do not work now ether so we do not lose any thing.

The cursor is moved on other occasions too. Any hotkey which points to an object (for example "n" to Next turn), at the start of main menu to New game, when exploring a planet (IIRC) to Continue...

So this would not be a complete fix and would add messy mouse->screen coord translation code. I certainly won't change the current code to absolute to almost-fix RDP. I also won't outright reject a patch that implements it for -norelmouse only.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on July 29, 2018, 12:54:03 pm
1oom v0.6 has been released. Changes:
    - fix mouse handling on large resolutions, replace -mousediv with -mousespd
    - extend mouse wheel support for counts, add options for inverting
    - clicking cycles selection of overlapping fleets/transports
    - new -uiextra UI features, notably:
        * space combat autoresolve for skipping uninteresting battles
        * target bases for planetary governor (right-click planet name)
        * partial fleet send does not deselect fleet
        * click destination again to Accept
        * Game screen options overhaul: sound/music volume, mouse speed, ...
    - less than 100 bugs fixed, notably:
        * AI expansion was hindered by several bugs
        * space combat had issues
        * fixed a few crashes
    - doc/pbxin_fixbugs.txt expanded, including fixed starting ship costs
    - cmdline UI is now complete
    - 1oom_lbxedit (which you should ignore and use 1oom_pbxmake instead)

Source code: https://gitlab.com/KilgoreTroutMaskReplicant/1oom
Binaries: https://gitlab.com/KilgoreTroutMaskReplicant/1oom/tags/v0.6
Homepage: https://kilgoretroutmaskreplicant.gitlab.io/plain-html/

HELP WANTED!

The project has reached a point where the game is fully playable, not crashing all the time and actually fighting back.

Many of the undoubtedly remaining bugs will need MOO1 expertise to spot. If you can beat MOO1 on impossible (which the project maintainer has yet to do) then please give this a whirl and report any oddities you encounter.

On the other hand, many of the remaining bugs will be obvious once bumped into. Play and report! Onward to v1.0!

Still looking for big endian hardware test results.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on August 10, 2018, 08:52:55 am
Does the music have correct tempo?

I lack the sense of rhythm and/or software to verify this. The option -xmidtpq / xmid_ticksperq controls the tempo, the default value is 55. I'd like to get the correct value determined and the option removed.

I'd suggest recording two loops of the main menu music with MOO1 and 1oom (with xmidtpq values near 55) and trying to align the recordings with an audio editor. Report which one is closest.

If you have the software and about 15 minutes to spare, consider lending the project a hand.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on August 17, 2018, 10:46:25 pm
1oom v0.7 has been released. Changes:
    - game is deterministic by default
    - more options for planetary governor: (see doc/usage_common.txt)
        * spend rest on research/ships/reserve
        * ecology mode
        * build star gates
    - new -yearsave option for yearly saves (1oom_save_YYYY.bin)
    - Ctrl-F5 takes a screenshot
    - new -uiextra UI features:
        * 1.40m-like research bonus lights
        * extra menu (click bottom-left corner)
        * message filtering (via extra menu)
    - new "planet X has finished terraforming" message (off by default)
    - about 30 bugs fixed, notably:
        * many memory corruption crashes fixed (C is fun)
        * ETA is now correct
        * spy cost in Races screen matches actual costs
    - doc/pbxin_fixbugs.txt expanded, including fix for Oracle Interface

Source code: https://gitlab.com/KilgoreTroutMaskReplicant/1oom
Binaries: https://gitlab.com/KilgoreTroutMaskReplicant/1oom/tags/v0.7
Homepage: https://kilgoretroutmaskreplicant.gitlab.io/plain-html/
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on September 06, 2018, 05:40:29 am
MOO1 was released 1993-09-06. Happy 25th anniversary! Here's 1oom v0.8 to celebrate the occasion. Changes:
    - click again to accept for transport redirection
    - all Advanced Technology are available for research
    - multiplayer player switching reduced
    - fix several music bugs
    - fix ship visibility during movement
    - fix ship scanner range
    - a handful of small fixes

Source code: https://gitlab.com/KilgoreTroutMaskReplicant/1oom
Binaries: https://gitlab.com/KilgoreTroutMaskReplicant/1oom/tags/v0.8
Homepage: https://kilgoretroutmaskreplicant.gitlab.io/plain-html/

tl;dr see above pic
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on September 08, 2018, 02:05:22 am
One small tweak.
When you hold left button on production scroll (like SHIP, IND or DEF) and move mouse outside it, game still should adjust value to max or min.
Currently if you too fast move mouse (without releasing button) it will skip last step.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on September 08, 2018, 07:19:16 am
One small tweak.
When you hold left button on production scroll (like SHIP, IND or DEF) and move mouse outside it, game still should adjust value to max or min.
Currently if you too fast move mouse (without releasing button) it will skip last step.

I think this is a case of original behaviour that no one wants. Thanks for pointing it out. Attempting a fix... EDIT: Fixed in v0.8-3.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on September 14, 2018, 05:14:04 am
Dear Windows user,

If you know how to compile 1oom on Windows or are planning to find out, please consider documenting the setup process for a "How to compile on Windows" article for the 1oom homepage.

Regards,
- KTMR
Not a Windows user
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on September 15, 2018, 12:59:23 am
Last nitpicking, when you press mouse down on scroll and move mouse out and release it then mouse click is triggered on spot where you move mouse.
Aside from that, last version work lot better when you fix last scroll quirk.
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on September 15, 2018, 01:56:00 am
Dear Windows user,

If you know how to compile 1oom on Windows or are planning to find out, please consider documenting the setup process for a "How to compile on Windows" article for the 1oom homepage.

Ahem, between mxe and autoconf it should be fairly straightforward. Or did you mean the unholy mess named VS?
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on September 15, 2018, 11:04:48 am
Last nitpicking, when you press mouse down on scroll and move mouse out and release it then mouse click is triggered on spot where you move mouse.
Aside from that, last version work lot better when you fix last scroll quirk.

Unfortunately click-on-release is original behaviour. The related code is hairy and I'm not sure if it can be fixed without rewriting a lot of code and introducing a slew of new bugs.

Ahem, between mxe and autoconf it should be fairly straightforward. Or did you mean the unholy mess named VS?

As outlined in HACKING this project is autotools only. I'm thinking of Joe Q. Mooexpert who wants to tinker a bit with the AI code but has never compiled anything. A nice "download this, install that, type ./configure" guide would come handy for poor Joe. I'm half temped to write one myself with the first steps being "install Linux and MXE"... I wouldn't know where to start on Windows, and I doubt Joe would either.
Title: Re: Reversing to Orion - project 1oom
Post by: Yankes on September 15, 2018, 03:15:29 pm
Unfortunately click-on-release is original behaviour. The related code is hairy and I'm not sure if it can be fixed without rewriting a lot of code and introducing a slew of new bugs.
"Last nitpicking", if it can't be change then its fine.
Title: Re: Reversing to Orion - project 1oom
Post by: SupSuper on September 18, 2018, 03:01:44 am
As outlined in HACKING this project is autotools only. I'm thinking of Joe Q. Mooexpert who wants to tinker a bit with the AI code but has never compiled anything. A nice "download this, install that, type ./configure" guide would come handy for poor Joe. I'm half temped to write one myself with the first steps being "install Linux and MXE"... I wouldn't know where to start on Windows, and I doubt Joe would either.
If you're only gonna support autotools, then the only option is installing the Linux tools on Windows (eg. MSYS or WSL), at which point the steps are the same as Linux. :P All roads lead to Rome.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on September 18, 2018, 10:13:51 am
If you're only gonna support autotools, then the only option is installing the Linux tools on Windows (eg. MSYS or WSL), at which point the steps are the same as Linux. :P All roads lead to Rome.

Let's peek at the current INSTALL:
Quote
If you want to use SDL1:
    aptitude install libsdl1.2-dev libsdl-mixer1.2-dev

Does either of those come with Debian-derived packaging system?

Request stands. At least now I (and Joe) have some acronyms to google, but I can't test any of it.
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on September 18, 2018, 04:37:15 pm

Does either of those come with Debian-derived packaging system?

MSYS2 has pacman (from Arch Linux)

What I tried is:
Code: [Select]
install http://www.msys2.org/
run the mingw32 version

/bin/pacman -Syuu
 - close shell window as per instructions
/bin/pacman -S git autoconf automake gcc mingw32/mingw-w64-i686-SDL_image pacman -S mingw32/mingw-w64-i686-readline

git clone https://gitlab.com/KilgoreTroutMaskReplicant/1oom.git
cd 1oom
autoreconf -fi
./configure
(it fails)
make
(hopefully)


But then it did not found -lmingw32 and an hour of head-bashing the wall didn't make it work, so at this point it'd be simpler to just fire up a linux VM (for me)

It also doesn't find readline, which can be mitigated with
Code: [Select]
export LDFLAGS=-L/mingw64/lib/
export CFLAGS=-I/mingw64/include

but it should work without this.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on September 19, 2018, 12:50:04 pm
MSYS2 has pacman (from Arch Linux)

Ah, cool.

What I tried is:

Thanks for trying and writing. SDL_image is not used but SDL_mixer is. I assume both pull in SDL itself.

But then it did not found -lmingw32 and an hour of head-bashing the wall didn't make it work, so at this point it'd be simpler to just fire up a linux VM (for me)

Sorry about your head and wall. Not quite sure what -lmingw32 is, but I'll try to fix that and readline.

Linux is really user friendly when it comes to building software.

EDIT:

I find the combination

Code: [Select]
gcc
mingw32/mingw-w64-i686-SDL
./configure

suspicious. Shouldn't that be either

Code: [Select]
gcc
SDL
./configure

or

Code: [Select]
mingw32/mingw-w64-i686-gcc
mingw32/mingw-w64-i686-SDL
./configure --host=i686-w64-mingw

? In any case, can't help much further without config.log.

Took a look at configure.ac again. No idea on -lmingw32 or the readline issue, but made missing SDL(2)_mixer and OpenGL cause an error and require --disable to get around.
Title: Re: Reversing to Orion - project 1oom
Post by: SupSuper on September 20, 2018, 12:32:35 am
Works fine here. Here's what I did:

1. Install MSYS2 following the instructions on http://www.msys2.org/
2. After doing all the updates as instructed, launch MSYS2 MSYS and install your toolchain (replace i686 with x86_64 if you want 64-bit EXEs):
Code: [Select]
pacman -S mingw-w64-i686-toolchain mingw-w64-i686-SDL mingw-w64-i686-SDL_mixer mingw-w64-i686-libsamplerate3. Install the build tools:
Code: [Select]
pacman -S git autoconf automake make4. Close the shell and launch MSYS2 MinGW 32-bit (or 64-bit respectively) to set up the environment variables.
5. Compile as usual:
Code: [Select]
git clone https://gitlab.com/KilgoreTroutMaskReplicant/1oom.git
cd 1oom
autoreconf -fi
./configure
make

(https://i.imgur.com/zze2jDT.png)

Btw Kilgore you need to clean up those unused warnings. :P

Edit: mingw-w64-i686-toolchain might already be installed for you so not sure it's needed.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on September 20, 2018, 05:48:06 am
Works fine here. Here's what I did:

Thanks! I'll try to write the HOWTO based on these.

A few questions:
1. Does it run?
2. Are the SDL2 libs just s/SDL/SDL2/g?

Quote
Btw Kilgore you need to clean up those unused warnings. :P

OK, fine. I don't see them as they are used for --enable-modebug.
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on September 20, 2018, 05:50:57 pm
Ok, reinstalled MSYS2 from scratch according to SupSuper's instructions and it worked. Thanks, man.

SDL2 is indeed just a

Code: [Select]
pacman -S mingw-w64-i686-SDL2 mingw-w64-i686-SDL2_mixer

away.

And it all does run modulo problems with finding the .dlls. I suggest you incorporate a static build option and make it default for msys2 builds otherwise it'll be no end of confusion about copying dlls and stuff.


Title: Re: Reversing to Orion - project 1oom
Post by: SupSuper on September 21, 2018, 01:48:47 am
And it all does run modulo problems with finding the .dlls. I suggest you incorporate a static build option and make it default for msys2 builds otherwise it'll be no end of confusion about copying dlls and stuff.
Well static linking is kinda inefficient when you've got 10 EXEs... don't know how to integrate it into automake, but you could easily write a separate script to copy them for you: https://blog.rubenwardy.com/2018/05/07/mingw-copy-dlls/
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on September 21, 2018, 02:48:13 am
Well, it's not like there are ten thousand libs linked, after all the whole statically linked shebang weighs under 20Mb.
Besides we're talking about debug/test builds here, in which case some convenience way outweighs minor disk space waste.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on September 21, 2018, 05:20:25 am
And it all does run modulo problems with finding the .dlls. I suggest you incorporate a static build option and make it default for msys2 builds otherwise it'll be no end of confusion about copying dlls and stuff.

Does it run if you simply "src/1oom_classic_sdl1" right after make? If it doesn't then I can only
1) ask for you guys to write the dll copy instructions
2) take a closer look at static builds

IIRC autotools has some --enable-static added by default but I doubt it's that easy. I'd settle for instructions on grabbing the dlls.

Draft v1 in attachments. (EDIT: obsolete, removed)
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on September 21, 2018, 03:39:46 pm
Static build (that is, linking SDL statically) was achieved by
Code: [Select]
--- a/configure.ac
+++ b/configure.ac
@@ -189,10 +189,10 @@ if test x"$enable_hwsdl1" != "xno"; then
         HW_SDL1_LIBS="$SDL1_LIBS"
     elif test x"$sdl_config" != "xno"; then
         HW_SDL1_CFLAGS="$CFLAGS `$sdl_config --cflags`"
-        HW_SDL1_LIBS="`$sdl_config --libs`"
+        HW_SDL1_LIBS="`$sdl_config --static-libs`"
     elif $pkg_config --exists sdl; then
         HW_SDL1_CFLAGS="$CFLAGS `$pkg_config --cflags sdl`"
-        HW_SDL1_LIBS="`$pkg_config --libs sdl`"
+        HW_SDL1_LIBS="`$pkg_config --libs --static sdl`"
     else
         HW_SDL1_LIBS="-lSDL"
     fi
@@ -223,7 +223,7 @@ if test x"$enable_hwsdl1" != "xno"; then
             if test x"$SDL1MIXER_LIBS" != "x"; then
                 HW_SDL1_LIBS="$HW_SDL1_LIBS $SDL1MIXER_LIBS"
             elif $pkg_config --exists SDL_mixer; then
-                HW_SDL1_LIBS="`$pkg_config --libs SDL_mixer`"
+                HW_SDL1_LIBS="`$pkg_config --static --libs SDL_mixer`"
             else
                 HW_SDL1_LIBS="$HW_SDL1_LIBS -lSDL_mixer"
             fi

AND running configure as follows:

Code: [Select]
LDFLAGS=-static ./configure  --disable-hwsdl1audio

After that it runs when just the executable is copied into the MOO1 data dir.

SDL_mixer package somehow doesn't install a pkg-config file, so there's no way to link it statically but for listing all its dependent libs manually or something. But the sound isn't that critical for AI development.

As for the DLL set, previously I just copied the all the *.dll files from $MSYS2_INSTALL_DIR/mingw32/bin to the MOO1 data dir because I'm lazy like that. (substitute mingw64 for 64bit builds).




Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on September 21, 2018, 11:08:57 pm
I remembered wrong: there is no --enable-static by default. I tried implemeting it, but couldn't get a static SDL (or libsamplerate) configured on my Debian setup and gave up. I can add it anyway if you deem it helpful. Meanwhile, something like
Code: [Select]
../configure LDFLAGS="-static" \
        SDL1_CFLAGS="`sdl-config --cflags`" \
        SDL1_LIBS="`sdl-config --static-libs`" \
        SDL1MIXER_LIBS="-lblahblah"
should work without the patch. I'd rather not document that.

The reason I asked about "src/1oom_classic_sdl1" in specific was the remote possibility that the dynamic linker can somehow find the dlls when run in MSYS. I guess "nope" is the answer.

I've written the howto with running the exes within MSYS in mind. Given "make -j 3 && src/1oom_..." and command history, who would prefer copying the exe somewhere else and running it via other means?

But the sound isn't that critical for AI development.

Sure, but this is not only for AI work. I'm trying to bring freedom 1 and the joy of hacking to wider masses. I'd much prefer "how to build a fully functional build" than something specific. I'm willing to ignore libsamplerate and readline.

Quote
As for the DLL set, previously I just copied the all the *.dll files from $MSYS2_INSTALL_DIR/mingw32/bin to the MOO1 data dir because I'm lazy like that. (substitute mingw64 for 64bit builds).

I'm tempted to use that solution. Can you state that as a copy/pasteable cp command?

Adapting that script SupSuper linked to would be better. As I can't test it, well...

As for static vs. dynamic: whichever someone chooses and fixes that v1 draft to work with. If you need --enable-static, say so.
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on September 22, 2018, 12:39:08 am
It all kinda depends on a particular workflow.

I, for example, copy built exes to a separate directory, which contains MOO1 data files, by other means (not msys shell).

Someone else might prefer to do it the other way around or something else.

In MSYS2 the root of its filesystem namespace is its install directoty, under that you have /bin, /home/$windows_username, /mingw32, /mingw64, etc.

So to copy dlls it would be cp /mingw32/*dll ~/1oom/src for them to end up adjacent to the built exes  assuming you just did git clone 1oom ; cd 1oom ; autoconf-dance  without cd-ing somewhere else before that.


Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on September 22, 2018, 05:56:30 am
Thanks, I think I can finish the howto now. Should be up in a few days.
Title: Re: Reversing to Orion - project 1oom
Post by: SupSuper on September 23, 2018, 06:12:25 am
The reason I asked about "src/1oom_classic_sdl1" in specific was the remote possibility that the dynamic linker can somehow find the dlls when run in MSYS. I guess "nope" is the answer.

I've written the howto with running the exes within MSYS in mind. Given "make -j 3 && src/1oom_..." and command history, who would prefer copying the exe somewhere else and running it via other means?
If you run it from inside MSYS, it will find the DLLs in the search paths automatically, but you can only run command-line apps from MSYS (so the command-line 1oom will work, but not the classic 1oom).

I might experiment with a proper Windows toolchain and see how it compares to autotools.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on September 23, 2018, 06:18:34 am
(was just about to post:)

Howto is up (https://kilgoretroutmaskreplicant.gitlab.io/plain-html/howto_build_windows.html). Bug reports / patches here or there (https://gitlab.com/KilgoreTroutMaskReplicant/plain-html).

(when this popped up)

If you run it from inside MSYS, it will find the DLLs in the search paths automatically, but you can only run command-line apps from MSYS (so the command-line 1oom will work, but not the classic 1oom).

... fuck. Did not expect that. Taking down link from index.html and waiting for patches...
Title: Re: Reversing to Orion - project 1oom
Post by: SupSuper on September 23, 2018, 10:07:19 am
... fuck. Did not expect that. Taking down link from index.html and waiting for patches...
Nothing's broken. :) To clarify:

- If you run the .exe's directly from the MSYS shell, then you don't need to copy the DLLs, as it will use the shell search path (with the caveat that only the command-line version will work inside a shell).

- If you run the .exe's directly in Windows, then you need to copy the DLLs, since it will use the Windows search path.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on September 24, 2018, 04:06:06 am
Nothing's broken. :) To clarify:

- If you run the .exe's directly from the MSYS shell, then you don't need to copy the DLLs, as it will use the shell search path (with the caveat that only the command-line version will work inside a shell).

- If you run the .exe's directly in Windows, then you need to copy the DLLs, since it will use the Windows search path.

The howto (link above) directs the user to start 1oom_classic_sdl1 via the MSYS shell in order to find out which DLLs are missing. According to your clarifications this fails in two ways:

- MSYS shell can find the DLLs when the exe is run inside it and thus will not help in the generic case (which is not that important from the howto's perspective).

- It does not work for the _sdlN exes since only command-line applications can be run from the MSYS shell. (WTF? The mind boggles. Why do you put up with that garbage?)

The point of the howto is to give step-by-step instructions in compiling and running your own build. The current version fails. How is it not broken?

I guess I'll rewrite the DLL hell section and hope for the best.

EDIT:

Rewritten version is up.

Thanks guys spaceship and dog for the help! My Face When receiving a solid contribution:
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on October 02, 2018, 02:24:13 pm
1oom v0.9 has been released. Changes:
    - map scroll speed is adjustable
    - Planets and Fleet screen lists sortable by name/count/bases/etc
    - keys!
        * Alt-X in main menu toggles -uiextra
        * UHJK scroll the map
        * / to search for a planet by name
        * (Ctrl-)1-9 to tag/recall planet
        * space bar for Continue/dismiss/OK/etc
        * 1-5 as portrait click on Races
    - almost 20 bugs fixed, notably:
        * a cause for the infamous 32000 doom stacks indentified and fixed
        * AI scrapped wrong ship designs resulting in obsolete fleets
        * AI II armor bias fixed, resulting in overall better ship designs
        * all but a few of the 1.40m fixes are now implemented
    - doc/pbxin_fixbugs.txt expanded, including fix for waste calculation

Source code: https://gitlab.com/KilgoreTroutMaskReplicant/1oom
Binaries: https://gitlab.com/KilgoreTroutMaskReplicant/1oom/tags/v0.9
Homepage: https://kilgoretroutmaskreplicant.gitlab.io/plain-html/

Test. Report. Profit?
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on October 14, 2018, 11:16:23 am
Time for a rantrospective.

Over a year ago I stumbled on a MOO1 Le'ts Play (https://forums.somethingawful.com/showthread.php?threadid=3817977) [sic] and got bitten hard by nostalgia. On 2017-10-14 I went looking for a Free Software Master of Orion engine to play with. Finding none, I said "fuck it" and rolled up my sleeves. One year later, the LP is wrapping up with a bonus round and we have 1oom going the last inches towards a stable v1.0 release.

Not finding any ready made disassembly was a disappointment. Documentation on the save format gave a starting point.

The disassembly was started using radare2 which turned out inadequate. Finding no better Free tool, I ate my principles and installed wine + IDA 5.0 freeware. It really is a shame that no Free tool is up to the task.

Going from nothing to v0.1 took 6 months of disassembling, manual decompiling to C and refactoring. During those months I worked about 9/7 on average.

The human unautomated part of disassembling is figuring out what "func_1A562" which operates on variables "var_2" and "unk_39BD8" does and naming all of that to something sensible. Here the knowledge on save format allowed to name many variables after spotting the load/save code.

Decompiling is the process of translating assembly to C. As an example, let's take a peek at one C function:
Code: [Select]
void game_planet_destroy(struct game_s *g, uint8_t planet_i)
{
    planet_t *p = &(g->planet[planet_i]);
    /* ... */
    p->rebels = 0;
    p->unrest = 0;
    p->reserve = 0;
    p->prev_owner = p->owner;
    /* ... */
}
And what it looks like in the disassembled v1.3 EXE:
Code: [Select]
game_planet_destroy proc far

var_2           = word ptr -2
planet_i        = word ptr  6

    push    bp
    mov     bp, sp
    sub     sp, 2
    push    si
    push    di
    mov     cx, [bp+planet_i]
    ...
    mov     ax, cx
    mov     dx, size struc_planet
    imul    dx
    les     bx, planet_data_segoffs
    add     bx, ax
    mov     es:[bx+struc_planet.rebels], 0
    mov     ax, cx
    mov     dx, size struc_planet
    imul    dx
    les     bx, planet_data_segoffs
    add     bx, ax
    mov     es:[bx+struc_planet.unrest], 0
    mov     ax, cx
    mov     dx, size struc_planet
    imul    dx
    les     bx, planet_data_segoffs
    add     bx, ax
    mov     word ptr es:[bx+(struc_planet.reserve+2)], 0
    mov     word ptr es:[bx+struc_planet.reserve], 0
    mov     ax, cx
    mov     dx, size struc_planet
    imul    dx
    les     bx, planet_data_segoffs
    add     bx, ax
    mov     ax, es:[bx+struc_planet.owner]
    push    ax
    mov     ax, cx
    mov     dx, size struc_planet
    imul    dx
    les     bx, planet_data_segoffs
    add     bx, ax
    pop     ax
    mov     es:[bx+struc_planet.prev_owner], ax
    ...
That's right: every time a planet (or, well, anything) is read or written to, the address is recalculated. The EXEs could be shrunk down to less than 50% size. Picture wading through about 770 kB of that garbage and that's my life for most of the 6 months before v0.1.

Refactoring consisted of getting rid of global variables and splitting game/UI/AI code allowing switchable AIs, multiplayer and atrocities like the cmdline UI. The game/UI boundary violation that most stuck to the mind was Plasma Torpedo depletion being handled in missile drawing code.

I needed a new nick before going public with this. Why use one unpopular culture reference when you can chain several? Answer: username length limits.

With 1oom-0.1.tar.bz2 in hand I embarked on a journey to publish it. The first place I tried was the home of the unofficial patch: Realms Beyond (http://realmsbeyond.net/). Unfortunately they block IPs of "known spammers". After many attempts at fighting against the CAPTCHA to get blocked and seeing the Contact form do nothing, I set my sights on the FreeOrion forum only for the topic to be rejected for containing "links to illegal or pirated software". Registration attempts at the official corpse-of-Simtex-on-display site masteroforion.com were a futile exercise in staring at a spinny please wait circle. Next up was OpenXcom forums (sci-fi, MicroProse, 1993, GPL == close enough). Fresh out of ideas and waiting for the OXC registration to be sorted out, I went to Reddit of all places to make the first public announcement (https://redd.it/8d4fb5). This thread followed soon after.

It took about 2 weeks to get the first tarball out. That's a lot of lost productivity.

Suggestions to put the project in GitHub followed. I obliged. Then Microsoft bought GitHub. Hello GitLab!

Once a foothold (http://www.realmsbeyond.net/forums/showthread.php?tid=9278) was established in Realms Beyond, the good ideas started flooding in. The feature creep has going on since then. So much for simply replicating v1.3.

The bugs have never piled up. The project has always been starving for bug reports. These days I work on this for about 2/7, mostly towards network multiplayer.

The current status of the project is a fully functional engine replacement with less bugs (I hope) and nifty new features. I see no reason for anyone to use the old DOS EXEs anymore. Mission accomplished?

How to calculate the value of an entertainment product when money is taken out of the equation? I propose comparing the time spent on developing the product to the total time spent on consuming it. I suspect 1oom has not broke even yet.

Cheers to:
- sargon0 for the partial save format docs
- SupSuper for tolerating this thread and helping out with the Windows port
- Stoddard for the invaluable devbuilds and SDL2 fixes
- Hythlodaeus for getting a foot in the Realms Beyond door
- coder111 for the planetary governor
- Jeff Graw for the UI ideas and feedback
- RefSteel for MOO wisdom and forum archaeology
- all who cared enough to report a bug

Lines of code in CSV format:
Code: [Select]
date,version,total,src,game,classic,cmdline,sdl,sdl1,sdl2,alleg,alleg4,dos,win,unix
2017-10-14,vnone,0,0,0,0,0,0,0,0,0,0,0,0,0
2017-11-14,v0.0,2568,896,1641,0,0,0,31,0,0,0,0,0,0
2017-12-14,v0.0-39-gfa00f4b,18204,6046,4437,5742,436,822,490,0,0,0,0,84,147
2018-01-14,v0.0-68-geb03567,30847,6430,8729,13628,436,871,522,0,0,0,0,84,147
2018-02-14,v0.0-96-ge0d2c60,39674,7821,13539,16124,537,878,544,0,0,0,0,84,147
2018-03-14,v0.0-117-g62059b7,49070,8692,18103,19964,633,878,544,0,0,0,0,90,166
2018-04-14,v0.1,57149,9359,23802,21570,723,900,539,0,0,0,0,90,166
2018-05-14,v0.2-55-g681cf86,62852,11419,24160,21694,2816,808,751,908,0,0,0,121,175
2018-06-14,v0.4-38-g5a9834d,67158,12274,25015,22068,3349,1075,816,987,648,453,148,137,188
2018-07-14,v0.5-67-gbe8d753,70168,12438,26229,22477,4216,1196,951,1063,662,463,148,137,188
2018-08-14,v0.6-46-g1ca378e,74222,13502,26696,22794,6315,1209,982,1066,675,467,162,152,202
2018-09-14,v0.8-14-g94ab478,74707,13534,27055,22890,6279,1209,995,1087,675,467,162,152,202
2018-10-14,v0.9-10-gdb25388,75508,13537,27143,23597,6284,1201,994,1094,675,467,162,152,202
2018-11-14,v1.0,75746,13537,27187,23791,6284,1201,994,1094,675,467,162,152,202

Misc:
- hardest bug to fix: the DOS mouse crash (https://gitlab.com/KilgoreTroutMaskReplicant/1oom/commit/d66f673a29623943c93f23c3828a276248b1ad47#17e3f19bd56a81326381a51290d16b180e939188_286_306)
- longest bug post-mortem: #46 (https://gitlab.com/KilgoreTroutMaskReplicant/1oom/issues/46)
- most head-to-desk function: src/gfxaux.c:gfx_aux_draw_frame_from_rotate_limit_do (https://gitlab.com/KilgoreTroutMaskReplicant/1oom/blob/master/src/gfxaux.c#L335)
- stupidest mistake: not reading the Official Strategy Guide before starting
- worst idea: no additional files
- games played since starting the project: 3 (1 to completion)

TL;DR dear diary, while waiting for bug reports I disappeared up my own ass
Title: Re: Reversing to Orion - project 1oom
Post by: Stoddard on October 14, 2018, 02:27:22 pm
This is a magnificent work.

Congratulations!
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on November 04, 2018, 12:34:39 pm
Now that 1oom has percolated up to Thotimx's LP thread that sparked it, it's time for disclosure.

Most people who have read a book (or even a game manual) in their lives have learned the difference between parenthesis-without-space (uncertain plural (https://en.wikipedia.org/wiki/Uncertain_plural)) and parenthesis-with-space (supplementary information (https://en.wikipedia.org/wiki/Bracket#Parenthesis)). Thotimx is not one of them.

Not having :tenbux: to spare on a Something Awful account, I started 1oom to get Thotimx to correct the error in their writing style. A year later, Thotimx has noticed the project and the inflammatory README comment. And persist on writing incorrectly. I must have misread that book about winnowing friends and influenza people (or somesuch).

Thus, the project has failed. At least we got a decent F/OSS MOO1-like as collateral.

Last call for feature requests and bug reports.
Title: Re: Reversing to Orion - project 1oom
Post by: Kilgore T.M. Replicant on November 14, 2018, 07:30:10 am
1oom v1.0 has been released. Changes:
    - quit brings back to main menu
    - clicking on the Tech screen lights sets the slider to bonus limit
    - governor color coding based on where the rest is spent
    - extra menu (bottom-left corner, shortcut E) expanded
    - a handful of bugs fixed

Source code: https://gitlab.com/KilgoreTroutMaskReplicant/1oom
Binaries: https://gitlab.com/KilgoreTroutMaskReplicant/1oom/tags/v1.0
Homepage: https://kilgoretroutmaskreplicant.gitlab.io/plain-html/

This is the final release. I will be homeless in a matter of days; less C and disasm, more sucking cock for shelter.

I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion. I watched C code glitter in the dark near the A20 gate. All those moments will be stored in git... like tears in PNG... Time to die.

- Kilgore Trout Mask Replicant Hobo Chang Ba With A Shotgun*

* see Galapagos
Title: Re: Reversing to Orion - project 1oom
Post by: luke83 on November 14, 2018, 11:38:27 am
I love MOO1 ( the others had some bells and whistles but it was not the same feel).....Will check this out on the weekend.