From c04ada0a77ad5ad05e29a44f6c20d6267636077a Mon Sep 17 00:00:00 2001 From: Watto <45884543+wattoc@users.noreply.github.com> Date: Mon, 3 May 2021 12:10:43 +0100 Subject: [PATCH] 1oom: new recipe (#5842) Also fix midi looping in SDL Mixer --- games-strategy/1oom/1oom-1.0.recipe | 74 +++ .../1oom/additional-files/1oom.rdef | 64 +++ games-strategy/1oom/patches/1oom-1.0.patchset | 526 ++++++++++++++++++ .../patches/sdl_mixer-1.2.12.patchset | 21 + media-libs/sdl_mixer/sdl_mixer-1.2.12.recipe | 3 +- 5 files changed, 687 insertions(+), 1 deletion(-) create mode 100644 games-strategy/1oom/1oom-1.0.recipe create mode 100644 games-strategy/1oom/additional-files/1oom.rdef create mode 100644 games-strategy/1oom/patches/1oom-1.0.patchset create mode 100644 media-libs/sdl_mixer/patches/sdl_mixer-1.2.12.patchset diff --git a/games-strategy/1oom/1oom-1.0.recipe b/games-strategy/1oom/1oom-1.0.recipe new file mode 100644 index 000000000..7fdd10d5d --- /dev/null +++ b/games-strategy/1oom/1oom-1.0.recipe @@ -0,0 +1,74 @@ +SUMMARY="Open source clone of Master of Orion" +DESCRIPTION="1oom is a game engine recreation of the original \"Master \ +of Orion\" (1993), a 4X strategy space game originally made by Simtex \ +and released by Microprose. + +Please note you will need the original game LBX data files from version 1.3. \ +This means that you will need a purchased copy of Master of Orion \ +in order to use 1oom. \ + +To play: copy the LBX files into /boot/home/config/non-packaged/data/1oom + +Configuration may be changed by editing the 1oom_config_game_classic_sdl1.txt \ +file, located in /boot/home/config/settings/1oom" +HOMEPAGE="https://kilgoretroutmaskreplicant.gitlab.io/plain-html/" +COPYRIGHT="2018-2021 1oom developers" +LICENSE="GNU GPL v2" +REVISION="1" +SOURCE_URI="https://gitlab.com/Tapani_/1oom/-/archive/master/1oom-master.tar.gz?sha=81ce4060661fa724fa97e12d97e39c8c39b9deb6" +CHECKSUM_SHA256="5538253ec444041955c11c88b73ec62764359238e145afa4508e6ba58fb410d8" +SOURCE_FILENAME="1oom-$portVersion.tar.gz" +SOURCE_DIR="1oom-master" +PATCHES="1oom-$portVersion.patchset" +ADDITIONAL_FILES="1oom.rdef" + +ARCHITECTURES="!x86_gcc2 ?x86 x86_64" +if [ "$targetArchitecture" = x86_gcc2 ]; then +SECONDARY_ARCHITECTURES="x86" +fi + +PROVIDES=" + 1oom$secondaryArchSuffix = $portVersion + app:1oom + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libGL$secondaryArchSuffix + lib:libglu$secondaryArchSuffix + lib:libsamplerate$secondaryArchSuffix + lib:libSDL$secondaryArchSuffix + lib:libSDL_mixer$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libGL$secondaryArchSuffix + devel:libglu$secondaryArchSuffix + devel:libsamplerate$secondaryArchSuffix + devel:libSDL$secondaryArchSuffix + devel:libSDL_mixer$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:aclocal + cmd:autoreconf + cmd:awk + cmd:gcc$secondaryArchSuffix + cmd:make + cmd:pkg_config$secondaryArchSuffix + " + +BUILD() +{ + autoreconf -fi + runConfigure ./configure -disable-uicmdline -disable-tools -disable-hwx11 --bindir=$appsDir + make $jobArgs +} + +INSTALL() +{ + make install + mv $appsDir/1oom_classic_sdl1 $appsDir/1oom + + addResourcesToBinaries $portDir/additional-files/1oom.rdef $appsDir/1oom + addAppDeskbarSymlink $appsDir/1oom "1oom" +} diff --git a/games-strategy/1oom/additional-files/1oom.rdef b/games-strategy/1oom/additional-files/1oom.rdef new file mode 100644 index 000000000..e4270809b --- /dev/null +++ b/games-strategy/1oom/additional-files/1oom.rdef @@ -0,0 +1,64 @@ +resource app_flags B_SINGLE_LAUNCH | B_ARGV_ONLY; + +resource app_signature "application/x-vnd.1oom"; + +resource vector_icon { +$"6E636966090203040200E6E6E6FF3A01010300FF00037F004C03FF0000020104" + $"0200B6B6FAFF25257303FFAA0002000402007373CAFF2A2A53020104025CFFFF" + $"00FFFFAA00020104020080CAECFF00567F1A0606FF07BEBEBFCCBEBEBFCCBEBE" + $"C14BBC38C281BD9DC281BAD4C281B9B2BFCCB9B2C14BB9B2BE4EBC38BD17BAD4" + $"BD17BD9DBD17BEBEBFCCBEBEBE4EBEBEBFCCBFCC0606FF07C861BDDFC861BDDF" + $"C86144C281C428C5C0C428BF43C428BCA2BDDFBCA244BCA2BA66C281B796BF43" + $"B796C5C0B796C861BDDFC861BA66C861BDDFBDDF0205C081BF96C081BF96BD2E" + $"BFD3B689C04DB9DCC010B689C198B689C42DB689C2E2B9DCC375C081C205BD2E" + $"C2BDC081C136C081BF96C081C066C081BF960205C081C205C081C205BD2EC2BD" + $"B689C42DB9DCC375B814C43FBB2BC463B9A0C451BD86C3C0C23CC279BFE1C31D" + $"C1A8C253C081C205C115C22CC081C2050205C081BF96C081BF96C081C066C081" + $"C205C081C136C115C22CC23CC279C1A8C253C23CC1C7C23CC063C23CC115C1A8" + $"C01FC081BF96C115BFDBC081BF960205C081BF96C081BF96BD2EBFD3B689C04D" + $"B9DCC010B814C0A4BB2BC154B9A0C0FCBD86C104C23CC063BFE1C0B3C1A8C01F" + $"C081BF96C115BFDBC081BF960205B689C04DB689C04DB689C198B689C42DB689" + $"C2E2B814C43FBB2BC463B9A0C451BB2BC35EBB2BC154BB2BC259B9A0C0FCB689" + $"C04DB814C0A4B689C04D0205C23CC063C23CC063BFE1C0B3BB2BC154BD86C104" + $"BB2BC259BB2BC463BB2BC35EBD86C3C0C23CC279BFE1C31DC23CC1C7C23CC063" + $"C23CC115C23CC0630205B51296BDB51296BDB5128F74B51280E2B512882BBB1E" + $"818FC73682E7C12A823BC736880BC7369253C7368D2FC12A93CCB51296BDBB1E" + $"9544B51296BD0205CA9D937CCA9D937CC97B9319C7369253C85892B6C7368D2F" + $"C73682E7C736880BC8588399CA9D84FEC97B844CCA9D89D3CA9D937CCA9D8EA7" + $"CA9D937C0205BB4897FABB4897FAB9369790B51296BDB7249727BB1E9544C736" + $"9253C12A93CCC85892B6CA9D937CC97B9319C58194FBBB4897FAC065967ABB48" + $"97FA0205BB4897FABB4897FABB48914CBB4883F0BB488A9EC065844ACA9D84FE" + $"C58184A4CA9D89D3CA9D937CCA9D8EA7C58194FBBB4897FAC065967ABB4897FA" + $"0205BB4897FABB4897FAB9369790B51296BDB7249727B5128F74B51280E2B512" + $"882BB72481E7BB4883F0B93682ECBB488A9EBB4897FABB48914CBB4897FA0205" + $"BB4883F0BB4883F0B93682ECB51280E2B72481E7BB1E818FC73682E7C12A823B" + $"C8588399CA9D84FEC97B844CC58184A4BB4883F0C065844ABB4883F00205B5B6" + $"BFF2B5B6BFF2B3B3C010AFACC04AB1AFC02DAFACC1F8AFACC555AFACC3A7B1AF" + $"C4EBB5B6C416B3B3C480B5B6C2B5B5B6BFF2B5B6C154B5B6BFF20205B5B6C416" + $"B5B6C416B3B3C480AFACC555B1AFC4EBB2D0C551B916C549B5F3C54DBA20C4FD" + $"BC34C466BB2AC4B2BA0AC44BB5B6C416B7E0C431B5B6C4160205B5B6BFF2B5B6" + $"BFF2B5B6C154B5B6C416B5B6C2B5B7E0C431BC34C466BA0AC44BBC34C369BC34" + $"C16FBC34C26CBA0AC0F0B5B6BFF2B7E0C071B5B6BFF20205B5B6BFF2B5B6BFF2" + $"B3B3C010AFACC04AB1AFC02DB2D0C0D2B916C1E2B5F3C15ABA20C1BCBC34C16F" + $"BB2AC195BA0AC0F0B5B6BFF2B7E0C071B5B6BFF20205AFACC04AAFACC04AAFAC" + $"C1F8AFACC555AFACC3A7B2D0C551B916C549B5F3C54DB916C427B916C1E2B916" + $"C304B5F3C15AAFACC04AB2D0C0D2AFACC04A0205BC34C16FBC34C16FBB2AC195" + $"B916C1E2BA20C1BCB916C304B916C549B916C427BA20C4FDBC34C466BB2AC4B2" + $"BC34C369BC34C16FBC34C26CBC34C16F020518C0DA18C0DAAF4DC0EBAD7CC10E" + $"AE64C0FCAD7CC246AD7CC4B6AD7CC37EAE64C48D18C43BAF4DC46418C31B18C0" + $"DA18C1FA18C0DA020518C43B18C43BAF4DC464AD7CC4B6AE64C48DB095C4C2B6" + $"C7C4DAB3AEC4CEB743C4BCB83AC480B7BEC49EB58EC46918C43BB2E1C45218C4" + $"3B020518C0DA18C0DA18C1FA18C43B18C31BB2E1C452B83AC480B58EC469B83A" + $"C3B1B83AC213B83AC2E2B58EC1AB18C0DAB2E1C14218C0DA020518C0DA18C0DA" + $"AF4DC0EBAD7CC10EAE64C0FCB095C177B6C7C24AB3AEC1E0B743C238B83AC213" + $"B7BEC226B58EC1AB18C0DAB2E1C14218C0DA0205AD7CC10EAD7CC10EAD7CC246" + $"AD7CC4B6AD7CC37EB095C4C2B6C7C4DAB3AEC4CEB6C7C400B6C7C24AB6C7C325" + $"B3AEC1E0AD7CC10EB095C177AD7CC10E0205B83AC213B83AC213B7BEC226B6C7" + $"C24AB743C238B6C7C325B6C7C4DAB6C7C400B743C4BCB83AC480B7BEC49EB83A" + $"C3B1B83AC213B83AC2E2B83AC2131A0A000100000A080101000A010102000A02" + $"0103000A030104000A040105000A050106000A060107000A050108000A060109" + $"000A04010A000A03010B000A01010C000A02010D000A01010E000A02010F000A" + $"030110000A040111000A050112000A060113000A070114000A070115000A0701" + $"16000A070117000A070118000A07011900" +}; + diff --git a/games-strategy/1oom/patches/1oom-1.0.patchset b/games-strategy/1oom/patches/1oom-1.0.patchset new file mode 100644 index 000000000..875e2723f --- /dev/null +++ b/games-strategy/1oom/patches/1oom-1.0.patchset @@ -0,0 +1,526 @@ +From c1423f41d7c20f05f6aec103a0ba018069b5f025 Mon Sep 17 00:00:00 2001 +From: Craig Watson +Date: Wed, 14 Apr 2021 17:54:01 +0000 +Subject: Fixes to exported timing in XMID conversion + + +diff --git a/src/fmt_mus.c b/src/fmt_mus.c +index 37040b0..192bc20 100644 +--- a/src/fmt_mus.c ++++ b/src/fmt_mus.c +@@ -118,6 +118,7 @@ static int xmid_convert_evnt(const uint8_t *data_in, uint32_t len_in, const uint + struct noteoffs_s s[1]; + int rc = -1, noteons = 0, looppoint = -1; + uint32_t len_out = 0, t_now = 0, delta_time = 0; ++ unsigned qnlen = 500000; + bool end_found = false; + *tune_loops = false; + memset(s, 0, sizeof(s[0])); +@@ -145,6 +146,11 @@ static int xmid_convert_evnt(const uint8_t *data_in, uint32_t len_in, const uint + ++skip_extra_bytes; + } + dt_off |= b; ++ uint64_t dtoff_c = (uint64_t)dt_off * 480 * 500000 * 2 / ((uint64_t)qnlen * XMID_TICKSPERQ); ++ dt_off = dtoff_c >> 1; ++ if (dtoff_c & 0x1) { ++ dt_off++; ++ } + if (!xmid_add_pending_noteoff(s, data_in, t_now + delta_time, dt_off)) { + goto fail; + } +@@ -253,6 +259,7 @@ static int xmid_convert_evnt(const uint8_t *data_in, uint32_t len_in, const uint + /* MOO1 seems to ignore the set tempo events as not dropping them results in wrong tempo in f.ex tune 0xA */ + LOG_DEBUG((DEBUGLEVEL_FMTMUS, "XMID: dropping tempo %u event after %i notes\n", GET_BE_24(&data_in[3]), noteons)); + add_event = false; ++ qnlen = GET_BE_24(&data_in[3]); + skip_extra_bytes = len_event; + } + break; +@@ -267,13 +274,18 @@ static int xmid_convert_evnt(const uint8_t *data_in, uint32_t len_in, const uint + delta_time += *data_in++; + --len_in; + } ++ uint64_t delta_c = (uint64_t)delta_time * 480 * 500000 * 2 / ((uint64_t)qnlen * XMID_TICKSPERQ); ++ delta_time = delta_c >> 1; ++ if (delta_c & 0x1) { ++ delta_time++; ++ } + break; + } + + if (add_event) { + uint32_t len_delta_time; + uint8_t buf_delta_time[4]; +- ++ + while ((s->top >= 0) && ((t_now + delta_time) >= s->tbl[s->top].t)) { + noteoff_t *n = &(s->tbl[s->top]); + uint32_t delay_noff = n->t - t_now; +@@ -398,7 +410,7 @@ bool fmt_mus_convert_xmid(const uint8_t *data_in, uint32_t len_in, uint8_t **dat + /*00*/ 'M', 'T', 'h', 'd', + /*04*/ 0, 0, 0, 6, + /*08*/ 0, 0, 0, 1, +- /*0c*/ (XMID_TICKSPERQ >> 8) & 0xff, XMID_TICKSPERQ & 0xff, ++ /*0c*/ (480 >> 8) & 0xff, 480 & 0xff, + /*0e*/ 'M', 'T', 'r', 'k' + /*12*/ /* length, big endian */ + }; +-- +2.30.2 + + +From 65b60d9556ea2a8a977226b45e6e0cd2fb633d28 Mon Sep 17 00:00:00 2001 +From: Craig Watson +Date: Mon, 19 Apr 2021 10:51:26 +0000 +Subject: Add Haiku specific OS support Fix timing calculations in XMID + conversion to work correctly with Haiku Native Midi + + +diff --git a/configure.ac b/configure.ac +index 4e0ef24..dc63fc7 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -100,6 +100,16 @@ else + is_msdos=false + fi + ++dnl - check for haiku ++ ++case $host in ++ *-*-haiku*) ++ is_haiku=yes ++ ;; ++ *) ++ is_haiku=no ++ ;; ++esac + + dnl - optional features + +@@ -537,6 +547,8 @@ AC_SUBST(HW_X11_CFLAGS) + + dnl - setup the system-specific object files + ++ ++ + if test x"$is_win32" = "xyes"; then + OS_DIR="\$(top_builddir)/src/os/win32" + OS_SRC_DIR="\$(top_srcdir)/src/os/win32" +@@ -544,6 +556,7 @@ if test x"$is_win32" = "xyes"; then + AM_CONDITIONAL(COMPILE_UNIX, false) + AM_CONDITIONAL(COMPILE_WIN32, true) + AM_CONDITIONAL(COMPILE_MSDOS, false) ++ AM_CONDITIONAL(COMPILE_HAIKU, false) + elif test x"$is_msdos" = "xyes"; then + OS_DIR="\$(top_builddir)/src/os/msdos" + OS_SRC_DIR="\$(top_srcdir)/src/os/msdos" +@@ -551,6 +564,15 @@ elif test x"$is_msdos" = "xyes"; then + AM_CONDITIONAL(COMPILE_UNIX, false) + AM_CONDITIONAL(COMPILE_WIN32, false) + AM_CONDITIONAL(COMPILE_MSDOS, true) ++ AM_CONDITIONAL(COMPILE_HAIKU, false) ++elif test x"$is_haiku" = "xyes"; then ++ OS_DIR="\$(top_builddir)/src/os/haiku" ++ OS_SRC_DIR="\$(top_srcdir)/src/os/haiku" ++ BINDIST_SCRIPT="\$(top_srcdir)/make-bindist_install.sh" ++ AM_CONDITIONAL(COMPILE_UNIX, false) ++ AM_CONDITIONAL(COMPILE_WIN32, false) ++ AM_CONDITIONAL(COMPILE_MSDOS, false) ++ AM_CONDITIONAL(COMPILE_HAIKU, true) + else + OS_DIR="\$(top_builddir)/src/os/unix" + OS_SRC_DIR="\$(top_srcdir)/src/os/unix" +@@ -558,6 +580,7 @@ else + AM_CONDITIONAL(COMPILE_UNIX, true) + AM_CONDITIONAL(COMPILE_WIN32, false) + AM_CONDITIONAL(COMPILE_MSDOS, false) ++ AM_CONDITIONAL(COMPILE_HAIKU, false) + fi + OS_LIBS="$OS_DIR/libos.a" + OS_INCLUDES="-I$OS_SRC_DIR" +diff --git a/src/fmt_mus.c b/src/fmt_mus.c +index 192bc20..4912205 100644 +--- a/src/fmt_mus.c ++++ b/src/fmt_mus.c +@@ -36,6 +36,8 @@ struct noteoffs_s { + }; + + #define XMID_TICKSPERQ 60 ++#define XMID_FREQ 480 ++#define XMID_DEFAULT_QNLEN 500000 + /*#define XMID_USE_BANKS*/ + + /* -------------------------------------------------------------------------- */ +@@ -118,7 +120,8 @@ static int xmid_convert_evnt(const uint8_t *data_in, uint32_t len_in, const uint + struct noteoffs_s s[1]; + int rc = -1, noteons = 0, looppoint = -1; + uint32_t len_out = 0, t_now = 0, delta_time = 0; +- unsigned qnlen = 500000; ++ uint64_t delta_c; ++ unsigned qnlen = XMID_DEFAULT_QNLEN; + bool end_found = false; + *tune_loops = false; + memset(s, 0, sizeof(s[0])); +@@ -137,6 +140,7 @@ static int xmid_convert_evnt(const uint8_t *data_in, uint32_t len_in, const uint + case 0x90: + { + uint32_t dt_off; ++ uint64_t dtoff_c; + uint8_t b; + dt_off = 0; + skip_extra_bytes = 1; +@@ -146,7 +150,7 @@ static int xmid_convert_evnt(const uint8_t *data_in, uint32_t len_in, const uint + ++skip_extra_bytes; + } + dt_off |= b; +- uint64_t dtoff_c = (uint64_t)dt_off * 480 * 500000 * 2 / ((uint64_t)qnlen * XMID_TICKSPERQ); ++ dtoff_c = (uint64_t)dt_off * XMID_FREQ * XMID_DEFAULT_QNLEN * 2 / ((uint64_t)qnlen * XMID_TICKSPERQ); + dt_off = dtoff_c >> 1; + if (dtoff_c & 0x1) { + dt_off++; +@@ -274,7 +278,7 @@ static int xmid_convert_evnt(const uint8_t *data_in, uint32_t len_in, const uint + delta_time += *data_in++; + --len_in; + } +- uint64_t delta_c = (uint64_t)delta_time * 480 * 500000 * 2 / ((uint64_t)qnlen * XMID_TICKSPERQ); ++ delta_c = (uint64_t)delta_time * XMID_FREQ * XMID_DEFAULT_QNLEN * 2 / ((uint64_t)qnlen * XMID_TICKSPERQ); + delta_time = delta_c >> 1; + if (delta_c & 0x1) { + delta_time++; +@@ -285,10 +289,11 @@ static int xmid_convert_evnt(const uint8_t *data_in, uint32_t len_in, const uint + if (add_event) { + uint32_t len_delta_time; + uint8_t buf_delta_time[4]; ++ uint32_t delay_noff; + + while ((s->top >= 0) && ((t_now + delta_time) >= s->tbl[s->top].t)) { + noteoff_t *n = &(s->tbl[s->top]); +- uint32_t delay_noff = n->t - t_now; ++ delay_noff = n->t - t_now; + len_delta_time = xmid_encode_delta_time(buf_delta_time, delay_noff); + for (int i = 0; i < len_delta_time; ++i) { + *p++ = buf_delta_time[i]; +@@ -410,7 +415,7 @@ bool fmt_mus_convert_xmid(const uint8_t *data_in, uint32_t len_in, uint8_t **dat + /*00*/ 'M', 'T', 'h', 'd', + /*04*/ 0, 0, 0, 6, + /*08*/ 0, 0, 0, 1, +- /*0c*/ (480 >> 8) & 0xff, 480 & 0xff, ++ /*0c*/ (XMID_FREQ >> 8) & 0xff, XMID_FREQ & 0xff, + /*0e*/ 'M', 'T', 'r', 'k' + /*12*/ /* length, big endian */ + }; +diff --git a/src/os/Makefile.am b/src/os/Makefile.am +index 3f3948b..95a4c78 100644 +--- a/src/os/Makefile.am ++++ b/src/os/Makefile.am +@@ -10,4 +10,8 @@ if COMPILE_MSDOS + SUBDIRS = msdos + endif + +-DIST_SUBDIRS = unix win32 msdos ++if COMPILE_HAIKU ++SUBDIRS = haiku ++endif ++ ++DIST_SUBDIRS = unix win32 msdos haiku +diff --git a/src/os/haiku/Makefile.am b/src/os/haiku/Makefile.am +new file mode 100644 +index 0000000..ea47512 +--- /dev/null ++++ b/src/os/haiku/Makefile.am +@@ -0,0 +1,9 @@ ++AM_CPPFLAGS = \ ++ @OS_INCLUDES@ \ ++ -I$(top_srcdir)/src ++ ++noinst_LIBRARIES = libos.a ++ ++libos_a_SOURCES = \ ++ os.c \ ++ osdefs.h +diff --git a/src/os/haiku/os.c b/src/os/haiku/os.c +new file mode 100644 +index 0000000..7097bf3 +--- /dev/null ++++ b/src/os/haiku/os.c +@@ -0,0 +1,190 @@ ++#include "config.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "os.h" ++#include "options.h" ++#include "lib.h" ++#include "util.h" ++#include "types.h" ++ ++/* -------------------------------------------------------------------------- */ ++ ++const struct cmdline_options_s os_cmdline_options[] = { ++ { NULL, 0, NULL, NULL, NULL, NULL } ++}; ++ ++/* -------------------------------------------------------------------------- */ ++ ++static char *data_path = NULL; ++static char *user_path = NULL; ++static char *all_data_paths[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; ++static int num_data_paths = 0; ++ ++/* -------------------------------------------------------------------------- */ ++ ++const char *idstr_os = "unix"; ++ ++int os_early_init(void) ++{ ++ return 0; ++} ++ ++int os_init(void) ++{ ++ return 0; ++} ++ ++void os_shutdown(void) ++{ ++ lib_free(user_path); ++ user_path = NULL; ++ lib_free(data_path); ++ data_path = NULL; ++ for (int i = 0; i < num_data_paths; ++i) { ++ lib_free(all_data_paths[i]); ++ all_data_paths[i] = NULL; ++ } ++ num_data_paths = 0; ++} ++ ++const char **os_get_paths_data(void) ++{ ++ if (num_data_paths == 0) { ++ char *p; ++ int i = 0; ++ bool got_xdg = false; ++ ++ if (data_path) { ++ all_data_paths[i++] = lib_stralloc(data_path); ++ } ++ p = getenv("XDG_DATA_HOME"); ++ if (p) { ++ all_data_paths[i++] = util_concat(p, "/1oom", NULL); ++ got_xdg = true; ++ } ++ p = getenv("XDG_DATA_DIRS"); ++ if (p) { ++ all_data_paths[i++] = util_concat(p, "/1oom", NULL);; ++ got_xdg = true; ++ } ++ if (!got_xdg) { ++ p = getenv("HOME"); ++ if (p) { ++ all_data_paths[i++] = util_concat(p, "/config/non-packaged/data/1oom", NULL);; ++ } ++ } ++ all_data_paths[i++] = lib_stralloc("."); ++ all_data_paths[i] = NULL; ++ num_data_paths = i; ++ } ++ return (const char **)all_data_paths; ++} ++ ++const char *os_get_path_data(void) ++{ ++ return data_path; ++} ++ ++void os_set_path_data(const char *path) ++{ ++ if (data_path) { ++ lib_free(data_path); ++ data_path = NULL; ++ } ++ data_path = lib_stralloc(path); ++} ++ ++const char *os_get_path_user(void) ++{ ++ if (user_path == NULL) { ++ char *xdg_config_home = getenv("XDG_CONFIG_HOME"); ++ if (xdg_config_home != NULL) { ++ user_path = util_concat(xdg_config_home, "/1oom", NULL); ++ } else { ++ char *home = getenv("HOME"); ++ if (home != NULL) { ++ user_path = util_concat(home, "/config/settings/1oom", NULL); ++ } else { ++ user_path = lib_stralloc("."); ++ } ++ } ++ } ++ return user_path; ++} ++ ++void os_set_path_user(const char *path) ++{ ++ if (user_path) { ++ lib_free(user_path); ++ user_path = NULL; ++ } ++ user_path = lib_stralloc(path); ++} ++ ++int os_make_path(const char *path) ++{ ++ if ((path == NULL) || ((path[0] == '.') && (path[1] == '\0'))) { ++ return 0; ++ } ++ if (access(path, F_OK)) { ++ return mkdir(path, 0700); ++ } ++ return 0; ++} ++ ++int os_make_path_user(void) ++{ ++ return os_make_path(os_get_path_user()); ++} ++ ++int os_make_path_for(const char *filename) ++{ ++ int res = 0; ++ char *path; ++ util_fname_split(filename, &path, NULL); ++ if (path != NULL) { ++ res = os_make_path(path); ++ lib_free(path); ++ } ++ return res; ++} ++ ++const char *os_get_fname_save_slot(char *buf, size_t bufsize, int savei/*1..9*/) ++{ ++ return NULL; ++} ++ ++const char *os_get_fname_save_year(char *buf, size_t bufsize, int year/*2300..*/) ++{ ++ return NULL; ++} ++ ++const char *os_get_fname_cfg(char *buf, size_t bufsize, const char *gamestr, const char *uistr, const char *hwstr) ++{ ++ return NULL; ++} ++ ++const char *os_get_fname_log(char *buf, size_t bufsize) ++{ ++ if (buf) { ++ lib_strcpy(buf, "1oom_log.txt", bufsize); ++ return buf; ++ } ++ return "1oom_log.txt"; ++} ++ ++const char *os_get_fname_screenshot(char *buf, size_t bufsize, const char *extension) ++{ ++ char *fmt = lib_malloc(FSDEV_PATH_MAX); ++ lib_sprintf(fmt, FSDEV_PATH_MAX, "%s/1oom_pic_%%03i.%s", os_get_path_user(), extension); ++ util_get_fname_unused(buf, bufsize, fmt, 999); ++ lib_free(fmt); ++ fmt = NULL; ++ return buf; ++} +diff --git a/src/os/haiku/osdefs.h b/src/os/haiku/osdefs.h +new file mode 100644 +index 0000000..0318cc4 +--- /dev/null ++++ b/src/os/haiku/osdefs.h +@@ -0,0 +1,10 @@ ++#ifndef INC_1OOM_OSDEFS_H ++#define INC_1OOM_OSDEFS_H ++ ++#define FSDEV_PATH_MAX 2048 ++#define FSDEV_DIR_SEP_STR "/" ++#define FSDEV_DIR_SEP_CHR '/' ++#define FSDEV_EXT_SEP_STR "." ++#define FSDEV_EXT_SEP_CHR '.' ++ ++#endif +-- +2.30.2 + + +From afdb687f327ac6a4f5faf8da2b86da36ef1ca27a Mon Sep 17 00:00:00 2001 +From: Craig Watson +Date: Mon, 19 Apr 2021 11:20:38 +0000 +Subject: Fix Haiku OS build makefile include + + +diff --git a/configure.ac b/configure.ac +index dc63fc7..4983925 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -681,6 +681,7 @@ AC_CONFIG_FILES([Makefile + src/os/unix/Makefile + src/os/win32/Makefile + src/os/msdos/Makefile ++ src/os/haiku/Makefile + src/ui/Makefile + src/ui/cmdline/Makefile + src/ui/classic/Makefile +-- +2.30.2 + + +From f630a0228d5bb8365a96803baa5741c6867bc4ab Mon Sep 17 00:00:00 2001 +From: Craig Watson +Date: Mon, 19 Apr 2021 14:51:08 +0000 +Subject: Set some sensible defaults on Haiku, fix OS description + + +diff --git a/src/hw/sdl/hwsdl_opt.c b/src/hw/sdl/hwsdl_opt.c +index 4777674..6607eac 100644 +--- a/src/hw/sdl/hwsdl_opt.c ++++ b/src/hw/sdl/hwsdl_opt.c +@@ -12,7 +12,7 @@ int hw_opt_screen_winh = 0; + int hw_opt_screen_fsw = 0; + int hw_opt_screen_fsh = 0; + int hw_opt_mousespd = 100; +-bool hw_opt_relmouse = true; ++bool hw_opt_relmouse = false; + #ifdef FEATURE_MODEBUG + int hw_opt_overlay_pal = 0; + #endif +diff --git a/src/options.c b/src/options.c +index fd349da..76b4457 100644 +--- a/src/options.c ++++ b/src/options.c +@@ -38,7 +38,7 @@ bool opt_sfx_init_parallel = true; + int opt_music_volume = 64; + int opt_sfx_volume = 100; + int opt_audiorate = 48000; +-int opt_audioslice_ms = 50; ++int opt_audioslice_ms = 100; + #ifdef HAVE_SAMPLERATE + bool opt_use_libsamplerate = true; + int opt_libsamplerate_scale = 65; +diff --git a/src/os/haiku/os.c b/src/os/haiku/os.c +index 7097bf3..9081897 100644 +--- a/src/os/haiku/os.c ++++ b/src/os/haiku/os.c +@@ -28,7 +28,7 @@ static int num_data_paths = 0; + + /* -------------------------------------------------------------------------- */ + +-const char *idstr_os = "unix"; ++const char *idstr_os = "haiku"; + + int os_early_init(void) + { +-- +2.30.2 + diff --git a/media-libs/sdl_mixer/patches/sdl_mixer-1.2.12.patchset b/media-libs/sdl_mixer/patches/sdl_mixer-1.2.12.patchset new file mode 100644 index 000000000..ec1c08d22 --- /dev/null +++ b/media-libs/sdl_mixer/patches/sdl_mixer-1.2.12.patchset @@ -0,0 +1,21 @@ +From 2ea0989df83a759942d42cadb4e9c055a75d2a18 Mon Sep 17 00:00:00 2001 +From: Craig Watson +Date: Mon, 19 Apr 2021 14:59:10 +0000 +Subject: Fix looping midi bug in Haiku native midi + + +diff --git a/native_midi/native_midi_haiku.cpp b/native_midi/native_midi_haiku.cpp +index 8de350e..60face0 100644 +--- a/native_midi/native_midi_haiku.cpp ++++ b/native_midi/native_midi_haiku.cpp +@@ -74,6 +74,7 @@ class MidiEventsStore : public BMidi + --fLoops; + fPos = 0; + ev = fEvs; ++ startTime = B_NOW; + } else + break; + } +-- +2.30.2 + diff --git a/media-libs/sdl_mixer/sdl_mixer-1.2.12.recipe b/media-libs/sdl_mixer/sdl_mixer-1.2.12.recipe index acb83d736..ae25ce01f 100644 --- a/media-libs/sdl_mixer/sdl_mixer-1.2.12.recipe +++ b/media-libs/sdl_mixer/sdl_mixer-1.2.12.recipe @@ -6,10 +6,11 @@ MOD, Timidity MIDI, Ogg Vorbis, and SMPEG MP3 libraries." HOMEPAGE="http://www.libsdl.org/projects/SDL_mixer/" COPYRIGHT="1997-2012 Sam Lantinga" LICENSE="Zlib" -REVISION="7" +REVISION="8" SOURCE_URI="http://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-1.2.12.tar.gz" CHECKSUM_SHA256="1644308279a975799049e4826af2cfc787cad2abb11aa14562e402521f86992a" SOURCE_DIR="SDL_mixer-$portVersion" +PATCHES="sdl_mixer-1.2.12.patchset" ARCHITECTURES="x86_gcc2 x86 x86_64" SECONDARY_ARCHITECTURES="x86_gcc2 x86"