OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Martin Iturbide on May 11, 2025, 10:20:22 pm

Title: Request: Compile "Tower Topper" (aka Nebulus)
Post by: Martin Iturbide on May 11, 2025, 10:20:22 pm
Hello

Can someone please help me to compile "Tower Topper" 1.3 to AcaOS ?
It uses SDL 2 now. (Dependencies: SDL2_mixer  (with ogg support if you want music), sdl2 and zlib)

Here it is the source code: https://gitlab.com/roever/toppler/

Here it is the old one, just in case: https://www.os2world.com/games/index.php/native-games/strategy/301-tower-toppler

I will like to understand better the makefile to see if I can do it by myself as an exercise.

Regards
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: Dave Yeo on May 12, 2025, 12:37:14 am
Seems to have a dependency on gimp.
Here's the diff to build the executable,
Code: [Select]
diff --git a/Makefile b/Makefile
index a6a140f..57fd6e6 100644
--- a/Makefile
+++ b/Makefile
@@ -18,10 +18,10 @@
 # along with this program; if not, write to the Free Software
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
 
-PREFIX = /usr
+PREFIX = /@unixroot/usr/local
 BINDIR = $(PREFIX)/bin
 DATADIR = $(PREFIX)/share
-STATEDIR = /var/toppler
+STATEDIR = /@unixroot/var/toppler
 LOCALEDIR = $(DATADIR)/locale
 MANDIR =  $(DATADIR)/man
 PKGDATADIR = $(DATADIR)/toppler
@@ -32,9 +32,10 @@ CONVERT = convert
 CXX = $(CROSS)$(CXX_NATIVE)
 CXX_NATIVE = g++
 CXXFLAGS = -Wall -Wextra -g -O2 -std=c++17
-EXEEXT = $(if $(filter %-w64-mingw32.static-,$(CROSS)),.exe,)
+# EXEEXT = $(if $(filter %-w64-mingw32.static-,$(CROSS)),.exe,)
+EXEEXT = .exe
 INSTALL = install
-LDFLAGS =
+LDFLAGS = -Zomf -Zhigh-mem -lintl
 MSGFMT = msgfmt
 MSGMERGE = msgmerge
 PKG_CONFIG = $(CROSS)$(PKG_CONFIG_NATIVE)

Which crashes without being installed with the data I think,
Code: [Select]
H:\tmp\toppler>toppler.exe

Killed by SIGSEGV
pid=0x01a8 ppid=0x0065 tid=0x0001 slot=0x00d3 pri=0x0200 mc=0x0001 ps=0x0010
H:\TMP\TOPPLER\TOPPLER.EXE
TOPPLER 2:000fff20
cs:eip=0000:0018ff20      ss:esp=0000:fffefdfc      ebp=00100053
 ds=6f6cd5d4      es=0000      fs=d3d2d1d0      gs=0000     efl=fbfaf9f8
eax=0018fd78 ebx=1ffc9d7c ecx=0018fd8c edx=0018fdb0 edi=656c6163 esi=0018ff8c
Creating 01A8_01.TRP
Moved 01a8_01.TRP to W:\var\log\app\6820c3a0-01a8_01-TOPPLER-exceptq.txt

Have to think on the data problem
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: Dave Yeo on May 12, 2025, 12:44:03 am
You can probably download the data, perhaps from a release and manually install. It does want gimp and povray?
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: Martin Iturbide on May 12, 2025, 02:36:04 pm
Thanks Dave for helping out.

I'm looking for the compiled data (since it uses gimp) and see if it can run. Can you share your compiled binaries?

Checking:
- https://gitlab.com/roever/toppler/uploads/06111021dffe64f3bd5f5a22c87e9426/toppler-windows-1.3-r2.zip
Will it be "toppler.dat" or the data files are being integrated with the .exe?

Regards
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: Dave Yeo on May 12, 2025, 04:53:04 pm
OK, I seem to have misunderstood how it works. Have to look closer. Here's my binary.
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: Martin Iturbide on May 12, 2025, 10:04:20 pm
Thanks Dave.

Just a question here. I checked the Toppler.exe with pmdll.exe and it reference "SDL2MIX0.dll".
Is that correct? because our SDL2Mixer is called "SDL2M200.dll" as far as I know.

Quote
[C:\HOME\MARTIN\DOWNLOADS\TOPPLER]toppler
SYS1804: The system cannot find the file SDL2MIX0.

If I grab our "SDL2M200.dll" and rename it to "SDL2MIX0.dll" I get:
Quote
[C:\HOME\MARTIN\DOWNLOADS\TOPPLER]toppler
SYS1059: The system cannot execute the specified program.


Regards
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: Dave Yeo on May 13, 2025, 12:40:02 am
Whoops, it found  the one in usr/local. I updated the zip above with the right sdl_mixer dll. Still crashes
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: Dave Yeo on May 13, 2025, 12:55:13 am
OK, looked at the crash closer, seems to be crashing looking for the translations. Here is an updated makefile.diff,
Code: [Select]
diff --git a/Makefile b/Makefile
index a6a140f..8a65621 100644
--- a/Makefile
+++ b/Makefile
@@ -18,10 +18,10 @@
 # along with this program; if not, write to the Free Software
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
 
-PREFIX = /usr
+PREFIX = /@unixroot/usr/local
 BINDIR = $(PREFIX)/bin
 DATADIR = $(PREFIX)/share
-STATEDIR = /var/toppler
+STATEDIR = /@unixroot/var/toppler
 LOCALEDIR = $(DATADIR)/locale
 MANDIR =  $(DATADIR)/man
 PKGDATADIR = $(DATADIR)/toppler
@@ -32,9 +32,10 @@ CONVERT = convert
 CXX = $(CROSS)$(CXX_NATIVE)
 CXX_NATIVE = g++
 CXXFLAGS = -Wall -Wextra -g -O2 -std=c++17
-EXEEXT = $(if $(filter %-w64-mingw32.static-,$(CROSS)),.exe,)
+# EXEEXT = $(if $(filter %-w64-mingw32.static-,$(CROSS)),.exe,)
+EXEEXT = .exe
 INSTALL = install
-LDFLAGS =
+LDFLAGS = -Zomf -Zhigh-mem -lintl
 MSGFMT = msgfmt
 MSGMERGE = msgmerge
 PKG_CONFIG = $(CROSS)$(PKG_CONFIG_NATIVE)
@@ -68,7 +69,7 @@ PKG_LIBS_NATIVE = $$($(PKG_CONFIG_NATIVE) --libs $(PKGS_NATIVE))
 DEFS += -DVERSION='"$(VERSION)"'
 DEFS += -DTOP_DATADIR='"$(PKGDATADIR)"'
 DEFS += -DHISCOREDIR='"$(STATEDIR)"'
-DEFS += -DENABLE_NLS=1
+# DEFS += -DENABLE_NLS=1
 DEFS += -DLOCALEDIR='"$(LOCALEDIR)"'
 
 FILES_H := $(wildcard src/*.h)
@@ -487,7 +488,7 @@ toppler.dat: _build/tools/crearc $(DATFILES)
 .PHONY: clean
 clean:
  rm -rf _build
- rm toppler
+ rm toppler$(EXEEXT)
 
 
 .PHONY: distclean

And a working binary, only lightly tested.
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: David McKenna on May 13, 2025, 01:08:00 am
Dave,

  With this one I'm getting:

[C:\junk\dl\toppler]toppler
SYS1804: The system cannot find the file SDL2MIX0.

 I do have all the SDL2 files installed. BTW - which version of SDL2 are you using? I have 2.0.18.

Regards,
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: Dave Yeo on May 13, 2025, 01:20:45 am
Hmm, have to do more cleanup. For now here's SDLmix0.dll. Seems I built version 2.6.0 at some point
Added toppler.dat and toppler.ogg to put in the same directory as toppler.exe
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: Martin Iturbide on May 13, 2025, 04:17:06 am
Thanks Dave.

It is working here. Music and fullscreen also works.

What do you think about this packaging to share it around?


Regards
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: Dave Yeo on May 13, 2025, 04:57:22 am
That was version 1.3 I compiled as you requested.
Here's the newest, also linked to the correct sdl mixer I hope :)
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: Dave Yeo on May 13, 2025, 05:00:34 am
Thanks Dave.

It is working here. Music and fullscreen also works.

What do you think about this packaging to share it around?


Regards

Sure either version. Might want to fork the repository, apply the attached patch (git am < 0001-OS-2-support.patch) and refer to the source in the package.
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: Martin Iturbide on May 13, 2025, 02:54:19 pm
Hello Dave

I cloned the repo here: https://github.com/OS2World/GAME-SDL-STRATEGY-Toppler

The patch command gave me an error with the .patch file, so I updated it by hand. I hope it is allright.

Regards
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: Martin Iturbide on May 13, 2025, 04:35:58 pm
Thanks Dave

Here it is the full package again. I tested it and it works.
Now it looks better with the common SDL2 Mixer.
I updated the readme.os2 too.

Regards
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: Dave Yeo on May 13, 2025, 04:42:02 pm
Looks good.
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: Martin Iturbide on May 13, 2025, 04:48:33 pm
Good. I will be uploading it to hobbes.

Regards
Title: Re: Request: Compile "Tower Topper" (aka Nebulus)
Post by: David McKenna on May 14, 2025, 01:45:47 am
 Thanks Dave and Martin for doing this... I really like Tower Toppler and it works well. Only issue I've seen is a trap on quitting (SIGSEGV), but doesn't affect the game.

Regards,