diff --git a/x11-packages/dosbox-x/build.sh b/x11-packages/dosbox-x/build.sh index a058573ed0..5a55dca65e 100644 --- a/x11-packages/dosbox-x/build.sh +++ b/x11-packages/dosbox-x/build.sh @@ -2,11 +2,10 @@ TERMUX_PKG_HOMEPAGE=https://dosbox-x.com/ TERMUX_PKG_DESCRIPTION="A cross-platform DOS emulator based on the DOSBox project" TERMUX_PKG_LICENSE="GPL-2.0" TERMUX_PKG_MAINTAINER="@termux" -TERMUX_PKG_VERSION=0.84.3 -TERMUX_PKG_REVISION=1 +TERMUX_PKG_VERSION="2025.02.01" TERMUX_PKG_SRCURL=https://github.com/joncampbell123/dosbox-x/archive/refs/tags/dosbox-x-v${TERMUX_PKG_VERSION}.tar.gz -TERMUX_PKG_SHA256=6c807e72ece5de6b038e5ff3a7f1bc2e3bd61901548ed027192f58ff19585881 -TERMUX_PKG_DEPENDS="dosbox-x-data, fluidsynth, freetype, libc++, libiconv, libpcap, libpng, libslirp, libx11, libxkbfile, libxrandr, opengl, sdl2 | sdl2-compat, sdl2-net, zlib" +TERMUX_PKG_SHA256=3a6fdfd659bb05db82bf2d850af806f666562cce9a37609fd33b59f7e4bd8fa4 +TERMUX_PKG_DEPENDS="dosbox-x-data, fluidsynth, freetype, libandroid-posix-semaphore, libc++, libiconv, libpcap, libpng, libslirp, libx11, libxkbfile, libxrandr, opengl, sdl2 | sdl2-compat, sdl2-net, zlib" TERMUX_PKG_ANTI_BUILD_DEPENDS="sdl2-compat" TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" @@ -27,5 +26,5 @@ termux_step_post_get_source() { termux_step_pre_configure() { autoreconf -fi - LDFLAGS+=" -liconv" + LDFLAGS+=" -liconv -landroid-posix-semaphore" } diff --git a/x11-packages/dosbox-x/esfmu-1.2.6.patch b/x11-packages/dosbox-x/esfmu-1.2.6.patch new file mode 100644 index 0000000000..44c6cfe048 --- /dev/null +++ b/x11-packages/dosbox-x/esfmu-1.2.6.patch @@ -0,0 +1,397 @@ ++++ ./src/hardware/esfmu/esfm_registers.c +@@ -453,21 +453,24 @@ + { + case TIMER1_REG: + chip->timer_reload[0] = data; ++ chip->timer_counter[0] = data; + break; + case TIMER2_REG: + chip->timer_reload[1] = data; ++ chip->timer_counter[1] = data; + break; + case TIMER_SETUP_REG: + if (data & 0x80) + { ++ chip->irq_bit = 0; + chip->timer_overflow[0] = 0; + chip->timer_overflow[1] = 0; +- chip->irq_bit = 0; ++ break; + } + chip->timer_enable[0] = (data & 0x01) != 0; + chip->timer_enable[1] = (data & 0x02) != 0; +- chip->timer_mask[0] = (data & 0x20) != 0; +- chip->timer_mask[1] = (data & 0x40) != 0; ++ chip->timer_mask[1] = (data & 0x20) != 0; ++ chip->timer_mask[0] = (data & 0x40) != 0; + break; + case CONFIG_REG: + chip->keyscale_mode = (data & 0x40) != 0; +@@ -485,10 +488,14 @@ + } + break; + case TEST_REG: +- chip->test_bit_eg_halt = (data & 0x01) | ((data & 0x20) != 0); +- chip->test_bit_distort = (data & 0x02) != 0; +- chip->test_bit_attenuate = (data & 0x10) != 0; +- chip->test_bit_phase_stop_reset = (data & 0x40) != 0; ++ chip->test_bit_w0_r5_eg_halt = (data & 0x01) | ((data & 0x20) != 0); ++ chip->test_bit_1_distort = (data & 0x02) != 0; ++ chip->test_bit_2 = (data & 0x04) != 0; ++ chip->test_bit_3 = (data & 0x08) != 0; ++ chip->test_bit_4_attenuate = (data & 0x10) != 0; ++ chip->test_bit_w5_r0 = (data & 0x20) != 0; ++ chip->test_bit_6_phase_stop_reset = (data & 0x40) != 0; ++ chip->test_bit_7 = (data & 0x80) != 0; + break; + } + } +@@ -543,16 +550,16 @@ + switch (address & 0x5ff) + { + case TIMER1_REG: +- data = chip->timer_reload[0]; ++ data = chip->timer_counter[0]; + break; + case TIMER2_REG: +- data = chip->timer_reload[1]; ++ data = chip->timer_counter[1]; + break; + case TIMER_SETUP_REG: + data |= chip->timer_enable[0] != 0; + data |= (chip->timer_enable[1] != 0) << 1; +- data |= (chip->timer_mask[0] != 0) << 5; +- data |= (chip->timer_mask[1] != 0) << 6; ++ data |= (chip->timer_mask[1] != 0) << 5; ++ data |= (chip->timer_mask[0] != 0) << 6; + break; + case CONFIG_REG: + data |= (chip->keyscale_mode != 0) << 6; +@@ -563,11 +570,14 @@ + data |= chip->emu_tremolo_deep << 7; + break; + case TEST_REG: +- data |= chip->test_bit_eg_halt != 0; +- data |= (chip->test_bit_distort != 0) << 1; +- data |= (chip->test_bit_attenuate != 0) << 4; +- data |= (chip->test_bit_eg_halt != 0) << 5; +- data |= (chip->test_bit_phase_stop_reset != 0) << 6; ++ data |= chip->test_bit_w5_r0 != 0; ++ data |= (chip->test_bit_1_distort != 0) << 1; ++ data |= (chip->test_bit_2 != 0) << 2; ++ data |= (chip->test_bit_3 != 0) << 3; ++ data |= (chip->test_bit_4_attenuate != 0) << 4; ++ data |= (chip->test_bit_w0_r5_eg_halt != 0) << 5; ++ data |= (chip->test_bit_6_phase_stop_reset != 0) << 6; ++ data |= (chip->test_bit_7 != 0) << 7; + break; + case FOUROP_CONN_REG: + for (i = 0; i < 3; i++) +@@ -577,6 +587,7 @@ + } + break; + case NATIVE_MODE_REG: ++ data |= (chip->emu_newmode != 0); + data |= (chip->native_mode != 0) << 7; + break; + } +@@ -639,9 +650,11 @@ + break; + case 0x02: + chip->timer_reload[0] = data; ++ chip->timer_counter[0] = data; + break; + case 0x03: + chip->timer_reload[1] = data; ++ chip->timer_counter[1] = data; + break; + case 0x04: + for (i = 0; i < 3; i++) +@@ -677,19 +690,24 @@ + break; + case 0x02: + chip->timer_reload[0] = data; ++ chip->timer_counter[0] = data; + break; + case 0x03: + chip->timer_reload[1] = data; ++ chip->timer_counter[1] = data; + break; + case 0x04: +- chip->timer_enable[0] = data & 0x01; +- chip->timer_enable[1] = (data & 0x02) != 0; +- chip->timer_mask[0] = (data & 0x20) != 0; +- chip->timer_mask[1] = (data & 0x40) != 0; + if (data & 0x80) + { + chip->irq_bit = 0; ++ chip->timer_overflow[0] = 0; ++ chip->timer_overflow[1] = 0; ++ break; + } ++ chip->timer_enable[0] = data & 0x01; ++ chip->timer_enable[1] = (data & 0x02) != 0; ++ chip->timer_mask[1] = (data & 0x20) != 0; ++ chip->timer_mask[0] = (data & 0x40) != 0; + break; + case 0x08: + chip->keyscale_mode = (data & 0x40) != 0; +@@ -850,6 +868,7 @@ + case 0: + chip->native_mode = 0; + ESFM_native_to_emu_switch(chip); ++ // TODO: verify if the address write goes through + chip->addr_latch = data; + break; + case 1: +@@ -886,43 +905,30 @@ + ESFM_read_port (esfm_chip *chip, uint8_t offset) + { + uint8_t data = 0; +- if (chip->native_mode) ++ ++ switch(offset) + { +- switch(offset) ++ case 0: ++ data |= (chip->irq_bit != 0) << 7; ++ data |= (chip->timer_overflow[0] != 0) << 6; ++ data |= (chip->timer_overflow[1] != 0) << 5; ++ break; ++ case 1: ++ if (chip->native_mode) + { +- case 0: +- // TODO: actually implement timer count, trigger and reset +- data |= (chip->irq_bit != 0) << 7; +- data |= (chip->timer_overflow[0] != 0) << 6; +- data |= (chip->timer_overflow[1] != 0) << 5; +- break; +- case 1: + data = ESFM_readback_reg_native(chip, chip->addr_latch); +- break; +- // TODO: verify what the ESFM chip actually returns when reading +- // from the other address ports + } +- } +- else +- { +- switch(offset) ++ else + { +- case 0: +- data |= (chip->irq_bit != 0) << 7; +- data |= (chip->timer_overflow[0] != 0) << 6; +- data |= (chip->timer_overflow[1] != 0) << 5; +- break; +- case 1: + data = 0; +- break; +- case 2: case 3: +- // This matches OPL3 behavior. +- // TODO: verify what the ESFM chip actually returns when reading +- // from address ports in emulation mode +- data = 0xff; +- break; + } ++ break; ++ case 2: case 3: ++ // This matches OPL3 behavior. ++ data = 0xff; ++ break; + } ++ + return data; + } + ++++ ./src/hardware/esfmu/esfm.c +@@ -1741,6 +1741,10 @@ + } + + /* ------------------------------------------------------------------------- */ ++#pragma GCC diagnostic ignored "-Wunused-variable" ++#pragma GCC diagnostic ignored "-Wunknown-pragmas" ++#pragma clang diagnostic ignored "-Wunused-variable" ++#pragma clang diagnostic ignored "-Wunknown-pragmas" + static void + ESFM_process_feedback(esfm_chip *chip) + { +@@ -1752,11 +1756,12 @@ + uint32 basefreq, phase_offset; + uint3 block; + uint10 f_num; +- int32_t wave_out; ++ int32_t wave_out, wave_last; + int32_t phase_feedback; ++ uint32_t iter_counter; + uint3 waveform; + uint3 mod_in_shift; +- uint32_t phase_acc; ++ uint32_t phase, phase_acc; + uint10 eg_output; + + if (slot->mod_in_level && (chip->native_mode || (slot->in.mod_input == &slot->in.feedback_buf))) +@@ -1778,7 +1783,7 @@ + eg_output = slot->in.eg_output; + + // ASM optimizaions! +-#if defined(__GNUC__) && defined(__x86_64__) ++#if defined(__GNUC__) && defined(__x86_64__) && !defined(_ESFMU_DISABLE_ASM_OPTIMIZATIONS) + asm ( + "movzbq %[wave], %%r8 \n\t" + "shll $11, %%r8d \n\t" +@@ -1843,13 +1848,14 @@ + [exprom] "m" (exprom) + : "cc", "ax", "bx", "cx", "dx", "r8", "r9", "r10", "r11" + ); +-#elif defined(__GNUC__) && defined(__i386__) +- uint32_t iter_counter; +- int32_t wave_last; ++#elif defined(__GNUC__) && defined(__i386__) && !defined(_ESFMU_DISABLE_ASM_OPTIMIZATIONS) ++ size_t logsinrom_addr = (size_t)logsinrom; ++ size_t exprom_addr = (size_t)exprom; ++ + asm ( + "movzbl %b[wave], %%eax \n\t" + "shll $11, %%eax \n\t" +- "leal %[sinrom], %%edi \n\t" ++ "movl %[sinrom], %%edi \n\t" + "addl %%eax, %%edi \n\t" + "shlw $3, %[eg_out] \n\t" + "xorl %[out], %[out] \n\t" +@@ -1884,7 +1890,7 @@ + // wave_out = exprom[level & 0xff] >> (level >> 8); + "movb %%ah, %%cl \n\t" + "movzbl %%al, %%eax \n\t" +- "leal %[exprom], %[out] \n\t" ++ "movl %[exprom], %[out] \n\t" + "movzwl (%[out], %%eax, 2), %[out] \n\t" + "shrl %%cl, %[out] \n\t" + // if (lookup & 0x8000) wave_out = -wave_out; +@@ -1906,12 +1912,12 @@ + : [p_off] "m" (phase_offset), + [mod_in] "m" (mod_in_shift), + [wave] "m" (waveform), +- [sinrom] "m" (logsinrom), +- [exprom] "m" (exprom), ++ [sinrom] "m" (logsinrom_addr), ++ [exprom] "m" (exprom_addr), + [i] "m" (iter_counter) + : "cc", "ax", "bx", "cx", "di" + ); +-#elif defined(__GNUC__) && defined(__arm__) ++#elif defined(__GNUC__) && defined(__arm__) && !defined(_ESFMU_DISABLE_ASM_OPTIMIZATIONS) + asm ( + "movs r3, #0 \n\t" + "movs %[out], #0 \n\t" +@@ -1966,12 +1972,12 @@ + ); + #else + wave_out = 0; +- int32_t wave_last = 0; +- for (uint32_t iter_counter = 0; iter_counter < 29; iter_counter++) ++ wave_last = 0; ++ for (iter_counter = 0; iter_counter < 29; iter_counter++) + { + phase_feedback = (wave_out + wave_last) >> 2; + wave_last = wave_out; +- uint32_t phase = phase_feedback >> mod_in_shift; ++ phase = phase_feedback >> mod_in_shift; + phase += phase_acc >> 9; + wave_out = ESFM_envelope_wavegen(waveform, phase, eg_output); + phase_acc += phase_offset; +@@ -2055,10 +2061,13 @@ + return (int16_t)sample; + } + ++#define TIMER1_CONST (0.2517482517482517) ++#define TIMER2_CONST (0.06293706293706293) + /* ------------------------------------------------------------------------- */ + static void + ESFM_update_timers(esfm_chip *chip) +-{ ++{ ++ int i; + // Tremolo + if ((chip->global_timer & 0x3f) == 0x3f) + { +@@ -2111,6 +2120,28 @@ + } + } + ++ for (i = 0; i < 2; i++) ++ { ++ if (chip->timer_enable[i]) ++ { ++ chip->timer_accumulator[i] += (i == 0) ? TIMER1_CONST : TIMER2_CONST; ++ if (chip->timer_accumulator[i] > 1.0) ++ { ++ chip->timer_accumulator[i] -= 1.0; ++ chip->timer_counter[i]++; ++ if (chip->timer_counter[i] == 0) ++ { ++ if (chip->timer_mask[i] == 0) ++ { ++ chip->irq_bit = true; ++ chip->timer_overflow[i] = true; ++ } ++ chip->timer_counter[i] = chip->timer_reload[i]; ++ } ++ } ++ } ++ } ++ + chip->eg_tick ^= 1; + } + ++++ ./src/hardware/esfmu/esfm.h +@@ -215,7 +215,7 @@ + { + esfm_channel channels[18]; + int32 output_accm[2]; +- uint_fast16_t addr_latch; ++ uint16 addr_latch; + + flag emu_wavesel_enable; + flag emu_newmode; +@@ -248,6 +248,7 @@ + flag emu_vibrato_deep; + flag emu_tremolo_deep; + ++ double timer_accumulator[2]; + uint8 timer_reload[2]; + uint8 timer_counter[2]; + flag timer_enable[2]; +@@ -255,18 +256,27 @@ + flag timer_overflow[2]; + flag irq_bit; + +- // Halts the envelope generators from advancing. +- flag test_bit_eg_halt; ++ // -- Test bits (NOT IMPLEMENTED) -- ++ // Halts the envelope generators from advancing. Written on bit 0, read back from bit 5. ++ flag test_bit_w0_r5_eg_halt; + /* + * Activates some sort of waveform test mode that amplifies the output volume greatly + * and continuously shifts the waveform table downwards, possibly also outputting the + * waveform's derivative? (it's so weird!) + */ +- flag test_bit_distort; ++ flag test_bit_1_distort; ++ // Seems to do nothing. ++ flag test_bit_2; ++ // Seems to do nothing. ++ flag test_bit_3; + // Appears to attenuate the output by about 3 dB. +- flag test_bit_attenuate; ++ flag test_bit_4_attenuate; ++ // Written on bit 5, read back from bit 0. Seems to do nothing. ++ flag test_bit_w5_r0; + // Resets all phase generators and holds them in the reset state while this bit is set. +- flag test_bit_phase_stop_reset; ++ flag test_bit_6_phase_stop_reset; ++ // Seems to do nothing. ++ flag test_bit_7; + + esfm_write_buf write_buf[ESFM_WRITEBUF_SIZE]; + size_t write_buf_start; diff --git a/x11-packages/dosbox-x/fix-hardcoded-paths.patch b/x11-packages/dosbox-x/fix-hardcoded-paths.patch index 720864db6b..77f1c621c1 100644 --- a/x11-packages/dosbox-x/fix-hardcoded-paths.patch +++ b/x11-packages/dosbox-x/fix-hardcoded-paths.patch @@ -1,79 +1,79 @@ ---- a/src/gui/midi_synth.h -+++ b/src/gui/midi_synth.h -@@ -162,16 +162,16 @@ - #else - // Default on "other" platforms according to fluidsynth docs - // This works on RH and Fedora, if a soundfont is installed -- if (FILE *file = fopen("/usr/share/soundfonts/default.sf2", "r")) { -+ if (FILE *file = fopen("@TERMUX_PREFIX@/share/soundfonts/default.sf2", "r")) { - fclose(file); -- sf = "/usr/share/soundfonts/default.sf2"; -+ sf = "@TERMUX_PREFIX@/share/soundfonts/default.sf2"; - // Ubuntu and Debian don't have a default.sf2... -- } else if (FILE *file = fopen("/usr/share/sounds/sf2/FluidR3_GM.sf2", "r")) { -+ } else if (FILE *file = fopen("@TERMUX_PREFIX@/share/sounds/sf2/FluidR3_GM.sf2", "r")) { - fclose(file); -- sf = "/usr/share/sounds/sf2/FluidR3_GM.sf2"; -- } else if (FILE *file = fopen("/usr/share/sounds/sf2/GeneralUser_GS.sf2", "r")) { -+ sf = "@TERMUX_PREFIX@/share/sounds/sf2/FluidR3_GM.sf2"; -+ } else if (FILE *file = fopen("@TERMUX_PREFIX@/share/sounds/sf2/GeneralUser_GS.sf2", "r")) { - fclose(file); -- sf = "/usr/share/sounds/sf2/GeneralUser_GS.sf2"; -+ sf = "@TERMUX_PREFIX@/share/sounds/sf2/GeneralUser_GS.sf2"; - } else { - LOG_MSG("MIDI:synth: Specify .SF2 sound font file with midiconfig="); - return false; -@@ -338,16 +338,16 @@ - #else - // Default on "other" platforms according to fluidsynth docs - // This works on RH and Fedora, if a soundfont is installed -- if (FILE *file = fopen("/usr/share/soundfonts/default.sf2", "r")) { -+ if (FILE *file = fopen("@TERMUX_PREFIX@/share/soundfonts/default.sf2", "r")) { - fclose(file); -- sf = "/usr/share/soundfonts/default.sf2"; -+ sf = "@TERMUX_PREFIX@/share/soundfonts/default.sf2"; - // Ubuntu and Debian don't have a default.sf2... -- } else if (FILE *file = fopen("/usr/share/sounds/sf2/FluidR3_GM.sf2", "r")) { -+ } else if (FILE *file = fopen("@TERMUX_PREFIX@/share/sounds/sf2/FluidR3_GM.sf2", "r")) { - fclose(file); -- sf = "/usr/share/sounds/sf2/FluidR3_GM.sf2"; -- } else if (FILE *file = fopen("/usr/share/sounds/sf2/GeneralUser_GS.sf2", "r")) { -+ sf = "@TERMUX_PREFIX@/share/sounds/sf2/FluidR3_GM.sf2"; -+ } else if (FILE *file = fopen("@TERMUX_PREFIX@/share/sounds/sf2/GeneralUser_GS.sf2", "r")) { - fclose(file); -- sf = "/usr/share/sounds/sf2/GeneralUser_GS.sf2"; -+ sf = "@TERMUX_PREFIX@/share/sounds/sf2/GeneralUser_GS.sf2"; - } else { - LOG_MSG("MIDI:fluidsynth: SoundFont not specified, and no system SoundFont found"); - return false; ---- a/src/hardware/parport/printer.cpp -+++ b/src/hardware/parport/printer.cpp -@@ -399,7 +399,7 @@ - } - basedir = std::string(windir) + "\\fonts\\"; - #else -- basedir = "/usr/share/fonts/"; -+ basedir = "@TERMUX_PREFIX@/share/fonts/"; - #endif - switch (LQtypeFace) - { ---- a/src/misc/cross.cpp -+++ b/src/misc/cross.cpp -@@ -131,9 +131,9 @@ - // Let's check if the above exists, otherwise use RESDIR - struct stat info; - if ((stat(in.c_str(), &info) != 0) || (!(info.st_mode & S_IFDIR))) -- in = "/usr/local/share/dosbox-x"; -+ in = "@TERMUX_PREFIX@/local/share/dosbox-x"; - if ((stat(in.c_str(), &info) != 0) || (!(info.st_mode & S_IFDIR))) -- in = "/usr/share/dosbox-x"; -+ in = "@TERMUX_PREFIX@/share/dosbox-x"; - if ((stat(in.c_str(), &info) != 0) || (!(info.st_mode & S_IFDIR))) { - //LOG_MSG("XDG_DATA_HOME (%s) does not exist. Using %s", in.c_str(), RESDIR); - in = RESDIR; ---- a/src/output/output_ttf.cpp -+++ b/src/output/output_ttf.cpp -@@ -389,7 +389,7 @@ +--- a/src/gui/midi_synth.h ++++ b/src/gui/midi_synth.h +@@ -186,16 +186,16 @@ + #else + // Default on "other" platforms according to fluidsynth docs + // This works on RH and Fedora, if a soundfont is installed +- if (FILE *file = fopen("/usr/share/soundfonts/default.sf2", "r")) { ++ if (FILE *file = fopen("@TERMUX_PREFIX@/share/soundfonts/default.sf2", "r")) { + fclose(file); +- sf = "/usr/share/soundfonts/default.sf2"; ++ sf = "@TERMUX_PREFIX@/share/soundfonts/default.sf2"; + // Ubuntu and Debian don't have a default.sf2... +- } else if (FILE *file = fopen("/usr/share/sounds/sf2/FluidR3_GM.sf2", "r")) { ++ } else if (FILE *file = fopen("@TERMUX_PREFIX@/share/sounds/sf2/FluidR3_GM.sf2", "r")) { + fclose(file); +- sf = "/usr/share/sounds/sf2/FluidR3_GM.sf2"; +- } else if (FILE *file = fopen("/usr/share/sounds/sf2/GeneralUser_GS.sf2", "r")) { ++ sf = "@TERMUX_PREFIX@/share/sounds/sf2/FluidR3_GM.sf2"; ++ } else if (FILE *file = fopen("@TERMUX_PREFIX@/share/sounds/sf2/GeneralUser_GS.sf2", "r")) { + fclose(file); +- sf = "/usr/share/sounds/sf2/GeneralUser_GS.sf2"; ++ sf = "@TERMUX_PREFIX@/share/sounds/sf2/GeneralUser_GS.sf2"; + } else { + LOG_MSG("MIDI:synth: Specify .SF2 sound font file with midiconfig="); + return false; +@@ -363,16 +363,16 @@ + #else + // Default on "other" platforms according to fluidsynth docs + // This works on RH and Fedora, if a soundfont is installed +- if (FILE *file = fopen("/usr/share/soundfonts/default.sf2", "r")) { ++ if (FILE *file = fopen("@TERMUX_PREFIX@/share/soundfonts/default.sf2", "r")) { + fclose(file); +- sf = "/usr/share/soundfonts/default.sf2"; ++ sf = "@TERMUX_PREFIX@/share/soundfonts/default.sf2"; + // Ubuntu and Debian don't have a default.sf2... +- } else if (FILE *file = fopen("/usr/share/sounds/sf2/FluidR3_GM.sf2", "r")) { ++ } else if (FILE *file = fopen("@TERMUX_PREFIX@/share/sounds/sf2/FluidR3_GM.sf2", "r")) { + fclose(file); +- sf = "/usr/share/sounds/sf2/FluidR3_GM.sf2"; +- } else if (FILE *file = fopen("/usr/share/sounds/sf2/GeneralUser_GS.sf2", "r")) { ++ sf = "@TERMUX_PREFIX@/share/sounds/sf2/FluidR3_GM.sf2"; ++ } else if (FILE *file = fopen("@TERMUX_PREFIX@/share/sounds/sf2/GeneralUser_GS.sf2", "r")) { + fclose(file); +- sf = "/usr/share/sounds/sf2/GeneralUser_GS.sf2"; ++ sf = "@TERMUX_PREFIX@/share/sounds/sf2/GeneralUser_GS.sf2"; + } else { + LOG_MSG("MIDI:fluidsynth: SoundFont not specified, and no system SoundFont found"); + return false; +--- a/src/hardware/parport/printer.cpp ++++ b/src/hardware/parport/printer.cpp +@@ -399,7 +399,7 @@ + } + basedir = std::string(windir) + "\\fonts\\"; + #else +- basedir = "/usr/share/fonts/"; ++ basedir = "@TERMUX_PREFIX@/share/fonts/"; + #endif + switch (LQtypeFace) + { +--- a/src/misc/cross.cpp ++++ b/src/misc/cross.cpp +@@ -131,9 +131,9 @@ + // Let's check if the above exists, otherwise use RESDIR + struct stat info; + if ((stat(in.c_str(), &info) != 0) || (!(info.st_mode & S_IFDIR))) +- in = "/usr/local/share/dosbox-x"; ++ in = "@TERMUX_PREFIX@/local/share/dosbox-x"; + if ((stat(in.c_str(), &info) != 0) || (!(info.st_mode & S_IFDIR))) +- in = "/usr/share/dosbox-x"; ++ in = "@TERMUX_PREFIX@/share/dosbox-x"; + if ((stat(in.c_str(), &info) != 0) || (!(info.st_mode & S_IFDIR))) { + //LOG_MSG("XDG_DATA_HOME (%s) does not exist. Using %s", in.c_str(), RESDIR); + in = RESDIR; +--- a/src/output/output_ttf.cpp ++++ b/src/output/output_ttf.cpp +@@ -389,7 +389,7 @@ } } #elif defined(LINUX) @@ -82,7 +82,7 @@ #elif defined(MACOSX) strcpy(fontdir, "/Library/Fonts/"); #else -@@ -406,7 +406,7 @@ +@@ -406,7 +406,7 @@ #if defined(LINUX) || defined(MACOSX) if (!ttf_fh) { #if defined(LINUX) @@ -91,14 +91,14 @@ #else strcpy(fontdir, "/System/Library/Fonts/"); #endif ---- a/vs/sdl/src/cdrom/linux/SDL_syscdrom.c -+++ b/vs/sdl/src/cdrom/linux/SDL_syscdrom.c -@@ -68,7 +68,7 @@ - #ifdef MNTTAB - #define _PATH_MNTTAB MNTTAB - #else --#define _PATH_MNTTAB "/etc/fstab" -+#define _PATH_MNTTAB "@TERMUX_PREFIX@/etc/fstab" - #endif - #endif /* !_PATH_MNTTAB */ - +--- a/vs/sdl/src/cdrom/linux/SDL_syscdrom.c ++++ b/vs/sdl/src/cdrom/linux/SDL_syscdrom.c +@@ -68,7 +68,7 @@ + #ifdef MNTTAB + #define _PATH_MNTTAB MNTTAB + #else +-#define _PATH_MNTTAB "/etc/fstab" ++#define _PATH_MNTTAB "@TERMUX_PREFIX@/etc/fstab" + #endif + #endif /* !_PATH_MNTTAB */ + diff --git a/x11-packages/dosbox-x/src-gamelink-gamelink.cpp.patch b/x11-packages/dosbox-x/src-gamelink-gamelink.cpp.patch new file mode 100644 index 0000000000..a3176a5b33 --- /dev/null +++ b/x11-packages/dosbox-x/src-gamelink-gamelink.cpp.patch @@ -0,0 +1,68 @@ +--- ./src/gamelink/gamelink.cpp. 2025-02-27 14:27:22.277681812 +0200 ++++ ./src/gamelink/gamelink.cpp 2025-02-27 14:28:31.115220198 +0200 +@@ -43,6 +43,65 @@ + extern bool is_paused; + extern uint32_t RunningProgramLoadAddress; + ++static int shm_unlink(const char *name) { ++ size_t namelen; ++ char *fname; ++ ++ /* Construct the filename. */ ++ while (name[0] == '/') ++name; ++ ++ if (name[0] == '\0') { ++ /* The name "/" is not supported. */ ++ errno = EINVAL; ++ return -1; ++ } ++ ++ namelen = strlen(name); ++ fname = (char *) alloca(sizeof("@TERMUX_PREFIX@/tmp/") - 1 + namelen + 1); ++ memcpy(fname, "@TERMUX_PREFIX@/tmp/", sizeof("@TERMUX_PREFIX@/tmp/") - 1); ++ memcpy(fname + sizeof("@TERMUX_PREFIX@/tmp/") - 1, name, namelen + 1); ++ ++ return unlink(fname); ++} ++ ++static int shm_open(const char *name, int oflag, mode_t mode) { ++ size_t namelen; ++ char *fname; ++ int fd; ++ ++ /* Construct the filename. */ ++ while (name[0] == '/') ++name; ++ ++ if (name[0] == '\0') { ++ /* The name "/" is not supported. */ ++ errno = EINVAL; ++ return -1; ++ } ++ ++ namelen = strlen(name); ++ fname = (char *) alloca(sizeof("@TERMUX_PREFIX@/tmp/") - 1 + namelen + 1); ++ memcpy(fname, "@TERMUX_PREFIX@/tmp/", sizeof("@TERMUX_PREFIX@/tmp/") - 1); ++ memcpy(fname + sizeof("@TERMUX_PREFIX@/tmp/") - 1, name, namelen + 1); ++ ++ fd = open(fname, oflag, mode); ++ if (fd != -1) { ++ /* We got a descriptor. Now set the FD_CLOEXEC bit. */ ++ int flags = fcntl(fd, F_GETFD, 0); ++ flags |= FD_CLOEXEC; ++ flags = fcntl(fd, F_SETFD, flags); ++ ++ if (flags == -1) { ++ /* Something went wrong. We cannot return the descriptor. */ ++ int save_errno = errno; ++ close(fd); ++ fd = -1; ++ errno = save_errno; ++ } ++ } ++ ++ return fd; ++} ++ + //============================================================================== + + //------------------------------------------------------------------------------ diff --git a/x11-packages/dosbox-x/src-libs-porttalk-porttalk.cpp.patch b/x11-packages/dosbox-x/src-libs-porttalk-porttalk.cpp.patch deleted file mode 100644 index 9d2eebaca4..0000000000 --- a/x11-packages/dosbox-x/src-libs-porttalk-porttalk.cpp.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/libs/porttalk/porttalk.cpp -+++ b/src/libs/porttalk/porttalk.cpp -@@ -236,7 +236,7 @@ - } - #endif - --#ifdef LINUX -+#if defined LINUX && !defined __ANDROID__ - # if defined(__i386__) || defined(__amd64__) || defined(__x86_64__) - // This Linux ioperm only works up to port 0x3FF - #include