Rocks'n'Diamonds on OS/2 revisited

Discussion around programming R'n'D, its source code and its tools.

Moderators: Flumminator, Zomis

Post Reply
dryeo
Posts: 3
Joined: Wed Nov 25, 2020 6:34 am

Rocks'n'Diamonds on OS/2 revisited

Post by dryeo »

Hi, had an urge to play Rocks'n'Diamonds on OS/2 (actually ArcaOS), so downloaded the 4.2.0.4 source and with this patch,

Code: Select all

diff --git a/src/libgame/zip/ioapi.h b/src/libgame/zip/ioapi.h
index 0741de44..d8665be5 100644
--- a/src/libgame/zip/ioapi.h
+++ b/src/libgame/zip/ioapi.h
@@ -33,7 +33,7 @@
 #  define ftello64 ftell
 #  define fseeko64 fseek
 #else
-#  if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__ANDROID__) || defined(__linux__)
+#  if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__ANDROID__) || defined(__linux__) || defined(__OS2__)
 #    define fopen64 fopen
 #    define ftello64 ftello
 #    define fseeko64 fseeko
-- 
And some EXTRA_LDFLAGS (probably not strictly needed) and NO_JOYSTICK defined in the top level makefile it compiles fine and seems to mostly work. Our SDL2 port is new and probably alpha/beta status so some questions about warnings.
In %HOME%\.rocksndiamonds\stderr.txt I see these warnings. I take it the mods failures are due to SDL2_mixer shortcomings, the getKeyFromKeyName happened when I tried to change the user name from root to mine, which failed with esc recovering. Is this another SDL2 deficiency?

Code: Select all

[WARN] configuration file 'W:\Home/.rocksndiamonds/cache/artworkinfo.cache' is empty
[WARN] cannot read music file 'K:\work\rocksndiamonds-4.2.0.4/music/mus_classic/mod.apoplexy': Unrecognized audio format
[WARN] cannot read music file 'K:\work\rocksndiamonds-4.2.0.4/music/mus_classic/mod.chiptune': Unrecognized audio format
[WARN] cannot read music file 'K:\work\rocksndiamonds-4.2.0.4/music/mus_classic/mod.cream_of_the_earth': Unrecognized audio format
[WARN] getKeyFromKeyName(): not completely implemented
I also was looking for the Windows ico file and could not find it, be nice to convert it to OS/2 format, name it rocksndiamonds.ico and put it beside the binary so the system uses it.
Anyways great to see Rocks'n'Diamonds still being maintained and worked on and the fact that it compiles on edge operating systems with almost no work is nice
User avatar
Holger
Site Admin
Posts: 3773
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Rocks'n'Diamonds on OS/2 revisited

Post by Holger »

Hi dryeo, welcome to the R'n'D forum! :)
Hi, had an urge to play Rocks'n'Diamonds on OS/2 (actually ArcaOS), so downloaded the 4.2.0.4 source and with this patch,
That's cool! It is a long time ago that I had a package of an OS/2 port of R'n'D on my web site (which was created by somebody else)! (I removed these ports to systems like OS/2, BeOS, AmigaOS etc. because they were very old and not maintained anymore.)

Regarding the patch, I think the current approach of deciding for which platforms explicit 64-bit versions of fopen() etc. are required (as taken from the minizip package) is not very practicable... it should probably better be some check like "Windows or nor Windows" instead of explicitly listing all systems that does not use them... I think I should change this (so no patch would be needed for OS/2 at all then).

BTW: Do you really need the "NO_JOYSTICK" flag? It was from a time where R'n'D supported different native joystick drivers on different systems (like Linux, FreeBSD etc.)... Now that only the SDL2 target is left, it should generally not be needed anymore?!
Our SDL2 port is new and probably alpha/beta status so some questions about warnings.
So does this mean that you are using (or maybe even working on?) a port of SDL2 to ArcaOS which is not yet complete and does not support joysticks so far? But then it apparently already has empty stubs for all the joystick / game controller functions, I assume? (Because that NO_JOYSTICK flag does not hide all these function calls.)
In %HOME%\.rocksndiamonds\stderr.txt I see these warnings.
The first one can just be ignored ...
I take it the mods failures are due to SDL2_mixer shortcomings
That's right; you simply get them if SDL_mixer has no MOD support compiled in.
the getKeyFromKeyName happened when I tried to change the user name from root to mine, which failed with esc recovering. Is this another SDL2 deficiency?
That's an interesting one, as it comes from a function that translates human readable key names (as found in the user setup file) to internal key symbols, so it would happen if it tries to read a key name it does not recognize. I will extend this warning to print out the key name in question, so the warning will be more useful then. But I don't think that this is a problem with your SDL library in this case.
I also was looking for the Windows ico file and could not find it, be nice to convert it to OS/2 format, name it rocksndiamonds.ico and put it beside the binary so the system uses it.
The Windows icon file is converted from a PNG icon to an ICO file using ImageMagick and then compiled into the binary. I should add the source icon file to the "build-projects" folder (just like I already did for the Android icons). (The Mac icons are also missing, btw.)

Thanks for your report about building R'n'D for OS/2 / ArcaOS -- this helps me improving the program, especially for platforms that I'm currently not aware of! :-)
filbo
Posts: 604
Joined: Fri Jun 20, 2014 10:06 am

Re: Rocks'n'Diamonds on OS/2 revisited

Post by filbo »

I'm sure there is a standardized symbol which you could use to:

#if defined(STANDARDIZED_MACRO_THAT_MEANS_SUPPORTS_STDIO64)
... do it one way
#else
... do it the other way
#endif

where one way #defines a bunch of things one direction or the other (open -> open64, or open64 -> open); and the other doesn't.

... and rip out all the system-specific #if defined(MACRO) for that. And then you would eventually get a bug report that Left ElbowOS 23.5 doesn't have that macro, so you would slowly have to add back in a couple of system-specific ones, but let that be on the stragglers' heads...

I also get 'getKeyFromKeyName' messages occasionally; seeing the details would be nice. I also still get a condition where debug 'set game speed' actions happen when I hit a digit with no modifier, which I get out of by hitting each modifier key one by one (l-shift, r-shift, l-alt, etc.) -- I am suspicious these two things are related, but have no proof.
dryeo
Posts: 3
Joined: Wed Nov 25, 2020 6:34 am

Re: Rocks'n'Diamonds on OS/2 revisited

Post by dryeo »

Holger wrote: Fri Nov 27, 2020 3:48 pm Hi dryeo, welcome to the R'n'D forum! :)
Hi, had an urge to play Rocks'n'Diamonds on OS/2 (actually ArcaOS), so downloaded the 4.2.0.4 source and with this patch,
That's cool! It is a long time ago that I had a package of an OS/2 port of R'n'D on my web site (which was created by somebody else)! (I removed these ports to systems like OS/2, BeOS, AmigaOS etc. because they were very old and not maintained anymore.)
Actually that was me who did the XFree86 port. I did lose interest between joysticks stopping working and XFree getting seriously out of date. No SDL port back then either.
Regarding the patch, I think the current approach of deciding for which platforms explicit 64-bit versions of fopen() etc. are required (as taken from the minizip package) is not very practicable... it should probably better be some check like "Windows or nor Windows" instead of explicitly listing all systems that does not use them... I think I should change this (so no patch would be needed for OS/2 at all then).

BTW: Do you really need the "NO_JOYSTICK" flag? It was from a time where R'n'D supported different native joystick drivers on different systems (like Linux, FreeBSD etc.)... Now that only the SDL2 target is left, it should generally not be needed anymore?!
Seems not. I just went through the top level makefile and that seemed like it should be uncommented.
Our SDL2 port is new and probably alpha/beta status so some questions about warnings.
So does this mean that you are using (or maybe even working on?) a port of SDL2 to ArcaOS which is not yet complete and does not support joysticks so far? But then it apparently already has empty stubs for all the joystick / game controller functions, I assume? (Because that NO_JOYSTICK flag does not hide all these function calls.)
Yes, I'm using a new port of SDL2 to OS/2 (ArcaOS is an OEM version based on OS/2 4.52 and is basically compatible). Not sure what Arca Noae has planned for joystick support or whoever is porting SDL2. SDL never did support joysticks on OS/2.
I might take a look at what would be required to add USB Joystick support to SDL2, seems all the pieces should be there. And of course Rocks'n'Diamonds really benefits from a joystick or gamepad. Whether I have the skills is questionable.
In %HOME%\.rocksndiamonds\stderr.txt I see these warnings.
The first one can just be ignored ...
I take it the mods failures are due to SDL2_mixer shortcomings
That's right; you simply get them if SDL_mixer has no MOD support compiled in.
the getKeyFromKeyName happened when I tried to change the user name from root to mine, which failed with esc recovering. Is this another SDL2 deficiency?
That's an interesting one, as it comes from a function that translates human readable key names (as found in the user setup file) to internal key symbols, so it would happen if it tries to read a key name it does not recognize. I will extend this warning to print out the key name in question, so the warning will be more useful then. But I don't think that this is a problem with your SDL library in this case.
OK, good to know. Guess I should port the needed library to build the Git tree


The Windows icon file is converted from a PNG icon to an ICO file using ImageMagick and then compiled into the binary. I should add the source icon file to the "build-projects" folder (just like I already did for the Android icons). (The Mac icons are also missing, btw.)

Thanks for your report about building R'n'D for OS/2 / ArcaOS -- this helps me improving the program, especially for platforms that I'm currently not aware of! :-)
Good to hear, and thank you for continuing to support Rocks'n'Diamonds. I think I first played it on Slackware v2 many years back.
dryeo
Posts: 3
Joined: Wed Nov 25, 2020 6:34 am

Re: Rocks'n'Diamonds on OS/2 revisited

Post by dryeo »

Thought I would post the patch needed to compile current git head,

Code: Select all

diff --git a/src/Makefile b/src/Makefile
index b9a75a6b..3790d225 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -81,6 +81,10 @@ MACOSX_DEPLOYMENT_TARGET = $MAC_TARGET_VERSION_MIN
 endif
 endif

+ifeq ($(shell uname -s),OS/2)          # compiling on OS/2
+PROGNAME = ../$(PROGBASE).exe
+EXTRA_LDFLAGS = -Zomf -Zbin-files -Zmap -lcx -Zhigh-mem
+endif

 # -----------------------------------------------------------------------------
 # configuring target
Not sure how to get make package-os2 to work
User avatar
Holger
Site Admin
Posts: 3773
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Rocks'n'Diamonds on OS/2 revisited

Post by Holger »

Thought I would post the patch needed to compile current git head,
Just added your patch -- thank you! (It's not available in the public Git repo yet.)
Not sure how to get make package-os2 to work
Unfortunately, the corresponding build and packaging script is currently not part of the public repository. In fact, I'm currently working on exactly this topic, expecially to prevent having redundant icon files for all platforms (but instead dynamically creating all required icons from a single set of base icons in (maybe) different sizes).

Regarding the packaging for OS/2, this would have to be added then (and might be similar to the packaging for already existing platforms, like creating a zip package or setup.exe file for the Windows platform).
Post Reply