From 753027d4c6971b874d2685f4129a162873786ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krystian=20Bac=C5=82awski?= Date: Mon, 21 Nov 2022 15:29:56 +0100 Subject: [PATCH 1/5] Update to the most recent fs-uae based on winuae 4.2.1 --- patches/fs-uae/break-at-start.diff | 12 ++--- patches/fs-uae/break-on-illegal.diff | 2 +- patches/fs-uae/break-on-sigint.diff | 14 +++--- patches/fs-uae/debugger-on-stderr.diff | 46 ++++++++--------- patches/fs-uae/exceptions-on-stderr.diff | 25 +++------- patches/fs-uae/fix-without-ppc.diff | 12 ++--- patches/fs-uae/print-memwatch.diff | 2 +- patches/fs-uae/uaelib-log.diff | 63 +++++++++++++----------- submodules/fs-uae | 2 +- 9 files changed, 85 insertions(+), 93 deletions(-) diff --git a/patches/fs-uae/break-at-start.diff b/patches/fs-uae/break-at-start.diff index 2e23c44..73099de 100644 --- a/patches/fs-uae/break-at-start.diff +++ b/patches/fs-uae/break-at-start.diff @@ -1,8 +1,8 @@ -Index: demoscene-toolchain/submodules/fs-uae/src/fs-uae/main.c +Index: demoscene-toolchain/submodules/fs-uae/src/fsuae/fsuae-main.c =================================================================== ---- demoscene-toolchain.orig/submodules/fs-uae/src/fs-uae/main.c -+++ demoscene-toolchain/submodules/fs-uae/src/fs-uae/main.c -@@ -531,6 +531,10 @@ static void on_init(void) +--- demoscene-toolchain.orig/submodules/fs-uae/src/fsuae/fsuae-main.c ++++ demoscene-toolchain/submodules/fs-uae/src/fsuae/fsuae-main.c +@@ -803,6 +803,10 @@ static void on_init(void) fs_uae_configure_input(); fs_uae_configure_directories(); @@ -12,12 +12,12 @@ Index: demoscene-toolchain/submodules/fs-uae/src/fs-uae/main.c + if (fs_config_get_int("save_state_compression") == 0) { amiga_set_save_state_compression(0); - } + } else { Index: demoscene-toolchain/submodules/fs-uae/src/od-fs/stubs.cpp =================================================================== --- demoscene-toolchain.orig/submodules/fs-uae/src/od-fs/stubs.cpp +++ demoscene-toolchain/submodules/fs-uae/src/od-fs/stubs.cpp -@@ -188,7 +188,7 @@ void target_fixup_options (struct uae_pr +@@ -179,7 +179,7 @@ void target_fixup_options(struct uae_pre } int debuggable (void) { diff --git a/patches/fs-uae/break-on-illegal.diff b/patches/fs-uae/break-on-illegal.diff index 0d35e9b..e767ff4 100644 --- a/patches/fs-uae/break-on-illegal.diff +++ b/patches/fs-uae/break-on-illegal.diff @@ -2,7 +2,7 @@ Index: demoscene-toolchain/submodules/fs-uae/src/newcpu.cpp =================================================================== --- demoscene-toolchain.orig/submodules/fs-uae/src/newcpu.cpp +++ demoscene-toolchain/submodules/fs-uae/src/newcpu.cpp -@@ -3195,6 +3195,14 @@ uae_u32 REGPARAM2 op_illg (uae_u32 opcod +@@ -4139,6 +4139,14 @@ uae_u32 REGPARAM2 op_illg (uae_u32 opcod } } diff --git a/patches/fs-uae/break-on-sigint.diff b/patches/fs-uae/break-on-sigint.diff index 983d2b5..5e573f2 100644 --- a/patches/fs-uae/break-on-sigint.diff +++ b/patches/fs-uae/break-on-sigint.diff @@ -2,23 +2,23 @@ Index: demoscene-toolchain/submodules/fs-uae/src/od-fs/uaemisc.cpp =================================================================== --- demoscene-toolchain.orig/submodules/fs-uae/src/od-fs/uaemisc.cpp +++ demoscene-toolchain/submodules/fs-uae/src/od-fs/uaemisc.cpp -@@ -9,6 +9,7 @@ - #include "uae.h" +@@ -10,6 +10,7 @@ #include "xwin.h" + #include "clipboard.h" #include "uae/fs.h" +#include "fs/conf.h" #include "../od-win32/debug_win32.h" - #ifndef PICASSO96 -@@ -229,7 +230,6 @@ TCHAR *target_expand_environment (const - return strdup(path); + #include +@@ -203,7 +204,6 @@ TCHAR *target_expand_environment (const + } } -#if 0 #include #include "debug.h" #ifdef __cplusplus_disabled -@@ -246,11 +246,12 @@ static RETSIGTYPE sigbrkhandler (int foo +@@ -220,11 +220,12 @@ static RETSIGTYPE sigbrkhandler (int foo signal (SIGINT, sigbrkhandler); #endif } @@ -33,7 +33,7 @@ Index: demoscene-toolchain/submodules/fs-uae/src/od-fs/uaemisc.cpp #if defined(__unix) && !defined(__NeXT__) struct sigaction sa; sa.sa_handler = sigbrkhandler; -@@ -263,7 +264,6 @@ void setup_brkhandler (void) +@@ -237,7 +238,6 @@ void setup_brkhandler (void) #else signal (SIGINT, sigbrkhandler); #endif diff --git a/patches/fs-uae/debugger-on-stderr.diff b/patches/fs-uae/debugger-on-stderr.diff index 1b9ebc1..71f889d 100644 --- a/patches/fs-uae/debugger-on-stderr.diff +++ b/patches/fs-uae/debugger-on-stderr.diff @@ -1,31 +1,31 @@ -Index: demoscene-toolchain/submodules/fs-uae/src/od-fs/uaemisc.cpp +Index: demoscene-toolchain/submodules/fs-uae/src/od-fs/writelog_fs.cpp =================================================================== ---- demoscene-toolchain.orig/submodules/fs-uae/src/od-fs/uaemisc.cpp -+++ demoscene-toolchain/submodules/fs-uae/src/od-fs/uaemisc.cpp -@@ -85,7 +85,7 @@ void sleep_millis (int ms) { - void console_out_f(const TCHAR *fmt, ...) { +--- demoscene-toolchain.orig/submodules/fs-uae/src/od-fs/writelog_fs.cpp ++++ demoscene-toolchain/submodules/fs-uae/src/od-fs/writelog_fs.cpp +@@ -479,7 +479,7 @@ void console_out_f (const TCHAR *format, + #else va_list arg_ptr; - va_start(arg_ptr, fmt); -- vprintf(fmt, arg_ptr); -+ vfprintf(stderr, fmt, arg_ptr); + va_start(arg_ptr, format); +- vprintf(format, arg_ptr); ++ vfprintf(stderr, format, arg_ptr); va_end(arg_ptr); - } - -@@ -102,7 +102,7 @@ void f_out(void *f, const TCHAR *format, - } - - void console_out (const TCHAR *msg) { -- printf("%s", msg); -+ fprintf(stderr, "%s", msg); - } - int console_get_gui (TCHAR *out, int maxlen) { -@@ -120,7 +120,7 @@ int console_get(TCHAR *in, int maxlen) { + #endif +@@ -490,7 +490,7 @@ void console_out (const TCHAR *txt) + #ifdef _WIN32 + console_put (txt); + #else +- printf("%s", txt); ++ fprintf(stderr, "%s", txt); + #endif } - void console_flush(void) { -- fflush(stdout); -+ fflush(stderr); +@@ -596,7 +596,7 @@ void console_flush (void) + #ifdef _WIN32 + flushconsole (); + #else +- fflush(stdout); ++ fflush(stderr); + #endif } - TCHAR console_getch (void) { diff --git a/patches/fs-uae/exceptions-on-stderr.diff b/patches/fs-uae/exceptions-on-stderr.diff index 548433d..447820e 100644 --- a/patches/fs-uae/exceptions-on-stderr.diff +++ b/patches/fs-uae/exceptions-on-stderr.diff @@ -1,21 +1,8 @@ -Index: demoscene-toolchain/submodules/fs-uae/src/debug.cpp -=================================================================== ---- demoscene-toolchain.orig/submodules/fs-uae/src/debug.cpp -+++ demoscene-toolchain/submodules/fs-uae/src/debug.cpp -@@ -4836,7 +4836,7 @@ static bool debug_line (TCHAR *input) - debug_illegal_mask = debug_illegal ? 0 : -1; - debug_illegal_mask &= ~((uae_u64)255 << 24); // mask interrupts - } -- console_out_f (_T("Exception breakpoint mask: %0I64X\n"), debug_illegal_mask); -+ console_out_f (_T("Exception breakpoint mask: %016" PRIx64 "\n"), debug_illegal_mask); - debug_illegal = debug_illegal_mask ? 1 : 0; - } else { - addr = 0xffffffff; Index: demoscene-toolchain/submodules/fs-uae/src/newcpu.cpp =================================================================== --- demoscene-toolchain.orig/submodules/fs-uae/src/newcpu.cpp +++ demoscene-toolchain/submodules/fs-uae/src/newcpu.cpp -@@ -2191,6 +2191,7 @@ static void exception_debug (int nr) +@@ -2911,6 +2911,7 @@ static void exception_debug (int nr) return; console_out_f (_T("Exception %d, PC=%08X\n"), nr, M68K_GETPC); #endif @@ -23,12 +10,12 @@ Index: demoscene-toolchain/submodules/fs-uae/src/newcpu.cpp } #ifdef CPUEMU_13 -@@ -2993,7 +2994,7 @@ static void ExceptionX (int nr, uaecptr +@@ -3792,7 +3793,7 @@ static void ExceptionX (int nr, uaecptr - if (debug_illegal && !in_rom (M68K_GETPC)) { + if (debug_illegal && !in_rom(pc)) { if (nr <= 63 && (debug_illegal_mask & ((uae_u64)1 << nr))) { -- write_log (_T("Exception %d breakpoint\n"), nr); -+ console_out_f (_T("Exception %d breakpoint\n"), nr); - activate_debugger (); +- write_log(_T("Exception %d breakpoint\n"), nr); ++ console_out_f(_T("Exception %d breakpoint\n"), nr); + activate_debugger(); } } diff --git a/patches/fs-uae/fix-without-ppc.diff b/patches/fs-uae/fix-without-ppc.diff index d7fc154..6fddc0f 100644 --- a/patches/fs-uae/fix-without-ppc.diff +++ b/patches/fs-uae/fix-without-ppc.diff @@ -2,20 +2,20 @@ Index: demoscene-toolchain/submodules/fs-uae/src/cpuboard.cpp =================================================================== --- demoscene-toolchain.orig/submodules/fs-uae/src/cpuboard.cpp +++ demoscene-toolchain/submodules/fs-uae/src/cpuboard.cpp -@@ -898,12 +898,16 @@ void cpuboard_rethink(void) - INTREQ_0(0x8000 | 0x0008); +@@ -1055,12 +1055,16 @@ void cpuboard_rethink(void) + safe_interrupt_set(IRQ_SOURCE_CPUBOARD, 0, false); if (currprefs.cachesize) - uae_int_requested |= 0x010000; + atomic_or(&uae_int_requested, 0x010000); +#ifdef WITH_PPC uae_ppc_wakeup_main(); +#endif } else if (!(io_reg[CSIII_REG_IRQ] & (P5_IRQ_PPC_1 | P5_IRQ_PPC_2))) { - INTREQ_0(0x8000 | 0x0008); + safe_interrupt_set(IRQ_SOURCE_CPUBOARD, 1, false); if (currprefs.cachesize) - uae_int_requested |= 0x010000; + atomic_or(&uae_int_requested, 0x010000); +#ifdef WITH_PPC uae_ppc_wakeup_main(); +#endif } else { - uae_int_requested &= ~0x010000; + atomic_and(&uae_int_requested, ~0x010000); } diff --git a/patches/fs-uae/print-memwatch.diff b/patches/fs-uae/print-memwatch.diff index ea105e1..c7b5065 100644 --- a/patches/fs-uae/print-memwatch.diff +++ b/patches/fs-uae/print-memwatch.diff @@ -2,7 +2,7 @@ Index: demoscene-toolchain/submodules/fs-uae/src/debug.cpp =================================================================== --- demoscene-toolchain.orig/submodules/fs-uae/src/debug.cpp +++ demoscene-toolchain/submodules/fs-uae/src/debug.cpp -@@ -3219,6 +3219,7 @@ static void memwatch (TCHAR **c) +@@ -3849,6 +3849,7 @@ static void memwatch (TCHAR **c) mwn->access_mask = MW_MASK_CPU_D_R | MW_MASK_CPU_D_W | MW_MASK_CPU_I; if (mwn->frozen && mwn->rwi == 0) mwn->rwi = 3; diff --git a/patches/fs-uae/uaelib-log.diff b/patches/fs-uae/uaelib-log.diff index 6f48a5a..5d4e32e 100644 --- a/patches/fs-uae/uaelib-log.diff +++ b/patches/fs-uae/uaelib-log.diff @@ -2,46 +2,51 @@ Index: demoscene-toolchain/submodules/fs-uae/src/od-fs/libamiga.cpp =================================================================== --- demoscene-toolchain.orig/submodules/fs-uae/src/od-fs/libamiga.cpp +++ demoscene-toolchain/submodules/fs-uae/src/od-fs/libamiga.cpp -@@ -130,7 +130,7 @@ void amiga_floppy_set_writable_images(in +@@ -146,6 +146,7 @@ void amiga_floppy_set_writable_images(in int amiga_init(void) { -- printf("UAE: Initializing core derived from %s\n", UAE_BASE_VERSION); + setvbuf(stdout, NULL, _IOLBF, 0); - write_log("UAE: Initializing core derived from %s\n", UAE_BASE_VERSION); + uae_log("Initializing core derived from %s\n", UAE_BASE_VERSION); - uae_register_main_thread(); -Index: demoscene-toolchain/submodules/fs-uae/src/od-fs/uaemisc.cpp + #if 0 +Index: demoscene-toolchain/submodules/fs-uae/src/od-fs/writelog_fs.cpp =================================================================== ---- demoscene-toolchain.orig/submodules/fs-uae/src/od-fs/uaemisc.cpp -+++ demoscene-toolchain/submodules/fs-uae/src/od-fs/uaemisc.cpp -@@ -129,11 +129,9 @@ TCHAR console_getch (void) { - } - - void close_console (void) { -- STUB(""); +--- demoscene-toolchain.orig/submodules/fs-uae/src/od-fs/writelog_fs.cpp ++++ demoscene-toolchain/submodules/fs-uae/src/od-fs/writelog_fs.cpp +@@ -174,8 +174,6 @@ void activate_console (void) + return; + #ifdef _WIN32 + SetForegroundWindow (GetConsoleWindow ()); +-#else +- STUB(""); + #endif } - extern void activate_console (void) { -- STUB(""); +@@ -341,8 +339,6 @@ void close_console (void) + } + FreeConsole (); + } +-#else +- STUB(""); + #endif + consoleopen = 0; } - - bool console_isch (void) Index: demoscene-toolchain/submodules/fs-uae/src/uaelib.cpp =================================================================== --- demoscene-toolchain.orig/submodules/fs-uae/src/uaelib.cpp +++ demoscene-toolchain/submodules/fs-uae/src/uaelib.cpp -@@ -360,6 +360,8 @@ static int native_dos_op (uae_u32 mode, +@@ -349,6 +349,8 @@ static int native_dos_op(TrapContext *ct return 0; } +#include "uaelib_log.cpp" + - static uae_u32 uaelib_demux_common(uae_u32 ARG0, uae_u32 ARG1, uae_u32 ARG2, uae_u32 ARG3, uae_u32 ARG4, uae_u32 ARG5) + static uae_u32 uaelib_demux_common(TrapContext *ctx, uae_u32 ARG0, uae_u32 ARG1, uae_u32 ARG2, uae_u32 ARG3, uae_u32 ARG4, uae_u32 ARG5) { switch (ARG0) { -@@ -381,6 +383,8 @@ static uae_u32 uaelib_demux_common(uae_u - case 14: return emulib_GetDisk(ARG1, ARG2); +@@ -370,6 +372,8 @@ static uae_u32 uaelib_demux_common(TrapC + case 14: return emulib_GetDisk(ctx, ARG1, ARG2); case 15: return emulib_Debug(); + case 40: return emulib_Log(ARG1); @@ -242,7 +247,7 @@ Index: demoscene-toolchain/submodules/fs-uae/libfsemu/src/ml/input.c =================================================================== --- demoscene-toolchain.orig/submodules/fs-uae/libfsemu/src/ml/input.c +++ demoscene-toolchain/submodules/fs-uae/libfsemu/src/ml/input.c -@@ -143,7 +143,7 @@ GList *fs_ml_input_list_custom_keyboards +@@ -147,7 +147,7 @@ GList *fs_ml_input_list_custom_keyboards char *keyboards_path = g_build_filename( fs_data_dir(), "Devs", "Keyboards", NULL); #endif @@ -255,18 +260,18 @@ Index: demoscene-toolchain/submodules/fs-uae/src/memory.cpp =================================================================== --- demoscene-toolchain.orig/submodules/fs-uae/src/memory.cpp +++ demoscene-toolchain/submodules/fs-uae/src/memory.cpp -@@ -1259,9 +1259,9 @@ static void log_kickstart(uae_u8 *mem, i +@@ -1503,9 +1503,9 @@ static void log_kickstart(uae_u8 *mem, i if (rd) { char tmp[MAX_DPATH]; getromname(rd, tmp); -- printf("UAE: %s\n", tmp); -+ write_log("UAE: %s\n", tmp); +- printf("ROM: %s\n", tmp); ++ write_log("ROM: %s\n", tmp); } else { -- printf("UAE: KS ROM %08x (%d bytes)\n", crc32, size); -+ write_log("UAE: KS ROM %08x (%d bytes)\n", crc32, size); +- printf("ROM: KS ROM %08x (%d bytes)\n", crc32, size); ++ write_log("ROM: KS ROM %08x (%d bytes)\n", crc32, size); } + #endif } - Index: demoscene-toolchain/submodules/fs-uae/libfsemu/src/log.c =================================================================== --- demoscene-toolchain.orig/submodules/fs-uae/libfsemu/src/log.c @@ -275,8 +280,8 @@ Index: demoscene-toolchain/submodules/fs-uae/libfsemu/src/log.c } log_data.file = g_fopen(path, "w"); if (log_data.file) { -- printf("LOG: %s\n", path); -+ printf("LOG: %s\n\n", path); +- fprintf(stderr, "LOGFILE: %s\n", path); ++ fprintf(stderr, "LOGFILE: %s\n\n", path); if (log_data.initial_path) { FILE *f = g_fopen(log_data.initial_path, "r"); if (f) { diff --git a/submodules/fs-uae b/submodules/fs-uae index f5bf027..bfa0c75 160000 --- a/submodules/fs-uae +++ b/submodules/fs-uae @@ -1 +1 @@ -Subproject commit f5bf0271008d6c16eb255475345ee9af1ef3ce7c +Subproject commit bfa0c7522c6c5f73cceb340d677491d056febd01 From 0c25787c1bcdf684b506c41b975df04dd83e47a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krystian=20Bac=C5=82awski?= Date: Mon, 21 Nov 2022 16:16:16 +0100 Subject: [PATCH 2/5] Make it compile. --- Dockerfile | 4 ++-- toolchain-m68k | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index eb43e0d..e9fdca8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,6 @@ RUN apt-get -q update && apt-get upgrade -y RUN apt-get install -y --no-install-recommends \ automake bison ca-certificates flex git-core gettext gperf \ gcc g++ libc6-dev libglib2.0-dev libncurses-dev libpng-dev \ - libsdl2-dev libopenal-dev libtool make patch pkg-config \ - python3 libpython3-dev python3-setuptools quilt \ + libsdl2-dev libsdl2-ttf-dev libopenal-dev libtool make patch \ + pkg-config python3 libpython3-dev python3-setuptools quilt \ subversion texinfo zip diff --git a/toolchain-m68k b/toolchain-m68k index 28f6356..e4ae91c 100755 --- a/toolchain-m68k +++ b/toolchain-m68k @@ -332,10 +332,8 @@ def build(): '--prefix={prefix}', '--enable-gdbstub', '--without-libmpeg2', - '--disable-a2065', '--disable-action-replay', '--disable-ahi', - '--disable-arcadia', '--disable-builtin-slirp', '--disable-gfxboard', '--disable-jit', @@ -347,7 +345,6 @@ def build(): '--disable-slirp', '--disable-qemu-cpu', '--disable-qemu-slirp', - '--disable-uaenet', '--disable-uaescsi', '--disable-uaeserial', '--disable-dms', From 0c023a632af9e3da67558b4db59160164d3543aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krystian=20Bac=C5=82awski?= Date: Tue, 22 Nov 2022 14:14:08 +0100 Subject: [PATCH 3/5] Assume data directory on macOS is the same as on Linux. --- patches/fs-uae/data-path-macos.diff | 13 +++++++++++++ patches/series | 1 + 2 files changed, 14 insertions(+) create mode 100644 patches/fs-uae/data-path-macos.diff diff --git a/patches/fs-uae/data-path-macos.diff b/patches/fs-uae/data-path-macos.diff new file mode 100644 index 0000000..3061505 --- /dev/null +++ b/patches/fs-uae/data-path-macos.diff @@ -0,0 +1,13 @@ +Index: demoscene-toolchain/submodules/fs-uae/fsemu/src/fsemu-data.c +=================================================================== +--- demoscene-toolchain.orig/submodules/fs-uae/fsemu/src/fsemu-data.c ++++ demoscene-toolchain/submodules/fs-uae/fsemu/src/fsemu-data.c +@@ -284,7 +284,7 @@ char *fsemu_data_file_path(const char *r + return path; + } + +-#ifdef FSEMU_OS_MACOS ++#ifdef FSEMU_OS_MACOS__DISABLE + char buffer[FSEMU_PATH_MAX]; + fs_get_application_exe_dir(buffer, FSEMU_PATH_MAX); + path = g_build_filename(buffer, "..", "Resources", "Data", relative, NULL); diff --git a/patches/series b/patches/series index f8a5759..1bdcfd2 100644 --- a/patches/series +++ b/patches/series @@ -8,3 +8,4 @@ fs-uae/exceptions-on-stderr.diff fs-uae/fix-without-ppc.diff fs-uae/print-memwatch.diff fs-uae/uaelib-log.diff +fs-uae/data-path-macos.diff From 79f1a0ffacf5c8c83bd210839be8630e6242a686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krystian=20Bac=C5=82awski?= Date: Tue, 22 Nov 2022 17:12:00 +0100 Subject: [PATCH 4/5] More patches to make it work as intended. --- patches/fs-uae/debug-msg-fix.diff | 13 ++ patches/fs-uae/silence-logs.diff | 197 ++++++++++++++++++++++++++++++ patches/fs-uae/uaelib-log.diff | 64 ---------- patches/series | 2 + 4 files changed, 212 insertions(+), 64 deletions(-) create mode 100644 patches/fs-uae/debug-msg-fix.diff create mode 100644 patches/fs-uae/silence-logs.diff diff --git a/patches/fs-uae/debug-msg-fix.diff b/patches/fs-uae/debug-msg-fix.diff new file mode 100644 index 0000000..93d057d --- /dev/null +++ b/patches/fs-uae/debug-msg-fix.diff @@ -0,0 +1,13 @@ +Index: demoscene-toolchain/submodules/fs-uae/src/debug.cpp +=================================================================== +--- demoscene-toolchain.orig/submodules/fs-uae/src/debug.cpp ++++ demoscene-toolchain/submodules/fs-uae/src/debug.cpp +@@ -6474,7 +6474,7 @@ void debug (void) + return; + } + if (bp > 0) +- console_out_f(_T("Breakpoint %d triggered.\n"), bp - 1); ++ console_out_f(_T("Breakpoint at %x\n"), pc); + debug_cycles(); + } + } else { diff --git a/patches/fs-uae/silence-logs.diff b/patches/fs-uae/silence-logs.diff new file mode 100644 index 0000000..9e17476 --- /dev/null +++ b/patches/fs-uae/silence-logs.diff @@ -0,0 +1,197 @@ +Index: demoscene-toolchain/submodules/fs-uae/fsemu/src/fsemu-video.c +=================================================================== +--- demoscene-toolchain.orig/submodules/fs-uae/fsemu/src/fsemu-video.c ++++ demoscene-toolchain/submodules/fs-uae/fsemu/src/fsemu-video.c +@@ -383,7 +383,7 @@ void fsemu_video_post_frame(fsemu_video_ + + int from = MAX(last_skipped_frame, fsemu_video.last_retrieved_frame + 1); + for (int i = from; i < frame->number; i++) { +- printf("SKIPPED FRAME %d\n", i); ++ // printf("SKIPPED FRAME %d\n", i); + last_skipped_frame = i; + FSEMU_FRAMEINFO(i).render_skipped = true; + } +Index: demoscene-toolchain/submodules/fs-uae/fsemu/src/fsemu-audiobuffer.c +=================================================================== +--- demoscene-toolchain.orig/submodules/fs-uae/fsemu/src/fsemu-audiobuffer.c ++++ demoscene-toolchain/submodules/fs-uae/fsemu/src/fsemu-audiobuffer.c +@@ -348,7 +348,7 @@ static double pid_controller_step(int *e + fsemu_audio_frame_stats_t stats; + fsemu_audio_frame_stats(fsemu_frame_counter() - 1, &stats); + +-#if 1 ++#if 0 + if (stats.avg_latency_us != latency_avg_2) { + printf( + "WARNING: Adjust %d vs %d\n", stats.avg_latency_us, latency_avg_2); +Index: demoscene-toolchain/submodules/fs-uae/fsemu/src/fsemu-frame.c +=================================================================== +--- demoscene-toolchain.orig/submodules/fs-uae/fsemu/src/fsemu-frame.c ++++ demoscene-toolchain/submodules/fs-uae/fsemu/src/fsemu-frame.c +@@ -171,7 +171,7 @@ void fsemu_frame_end(void) + + int64_t now = fsemu_time_us(); + if (now > fsemu_frame_end_at + 1000) { +- printf( ++ fsemu_log( + "fsemu_frame_end called %d ms too late " + "(now=%lld, fsemu_frame_end_at=%lld)\n", + (int) (now - fsemu_frame_end_at) / 1000, +@@ -182,7 +182,7 @@ void fsemu_frame_end(void) + fsemu_frame_wait_until_frame_end(); + now = fsemu_time_us(); + if (now > fsemu_frame_end_at + 1000) { +- printf("Overslept %d\n", ++ fsemu_log("Overslept %d\n", + (int) (fsemu_time_us() - fsemu_frame_end_at)); + } + fsemu_frame_add_sleep_time(0); +@@ -438,7 +438,7 @@ static void fsemu_frame_update_timing_ti + if (late_frames >= 10) { + // We might not be able to catch up normally, so we reset origin. + fsemu_frame_origin_at = now; +- printf("\n--------------------------------\n\n"); ++ fsemu_frame_log("\n--------------------------------\n\n"); + // FIXME: REGISTER THIS AS AN UNDERRUN EVENT + } + +Index: demoscene-toolchain/submodules/fs-uae/fsemu/src/fsemu-inputport.c +=================================================================== +--- demoscene-toolchain.orig/submodules/fs-uae/fsemu/src/fsemu-inputport.c ++++ demoscene-toolchain/submodules/fs-uae/fsemu/src/fsemu-inputport.c +@@ -97,7 +97,7 @@ static void fsemu_inputport_map_custom_a + static void fsemu_inputport_map_custom_actions(fsemu_inputmode_t *mode, + const char *prefix) + { +- printf("fsemu_inputport_map_custom_actions prefix=%s\n", prefix); ++ fsemu_log("fsemu_inputport_map_custom_actions prefix=%s\n", prefix); + fsemu_inputport_map_custom_action( + mode, prefix, "button_a", FSEMU_INPUTDEVICE_BUTTON_A); + fsemu_inputport_map_custom_action( +Index: demoscene-toolchain/submodules/fs-uae/fsemu/src/fsemu-data.c +=================================================================== +--- demoscene-toolchain.orig/submodules/fs-uae/fsemu/src/fsemu-data.c ++++ demoscene-toolchain/submodules/fs-uae/fsemu/src/fsemu-data.c +@@ -16,7 +16,7 @@ + + // ---------------------------------------------------------------------------- + +-int fsemu_data_log_level = FSEMU_LOG_LEVEL_DEBUG; ++int fsemu_data_log_level = FSEMU_LOG_LEVEL_INFO; + + /* + static struct fsemu_titlebar { +@@ -200,7 +200,7 @@ bool fsemu_data_development_mode(void) + fs_get_application_exe_dir(executable_dir, FSEMU_PATH_MAX); + char *path = g_build_filename( + executable_dir, "fsemu", "src", "fsemu-all.c", NULL); +- printf("%s\n", path); ++ fsemu_log("%s\n", path); + if (fsemu_path_exists(path)) { + development_mode = true; + } +@@ -390,7 +390,7 @@ void fsemu_data_load(const char *name, v + *data_size = 0; + char *path = fsemu_data_file_path(name); + if (!path) { +- fsemu_data_log_warning("Could not find data file '%s'\n", name); ++ fsemu_data_log("Could not find data file '%s'\n", name); + return; + } + fsemu_data_log("Path: %s\n", path); +Index: demoscene-toolchain/submodules/fs-uae/src/fsuae/fsuae-main.c +=================================================================== +--- demoscene-toolchain.orig/submodules/fs-uae/src/fsuae/fsuae-main.c ++++ demoscene-toolchain/submodules/fs-uae/src/fsuae/fsuae-main.c +@@ -1717,12 +1717,14 @@ int main(int argc, char *argv[]) + fs_set_prgname("fs-uae"); + fs_set_application_name("Amiga Emulator"); + ++#if 0 + fprintf(stderr, + COPYRIGHT_NOTICE, + PACKAGE_VERSION, + OS_NAME_2, + ARCH_NAME_2, + UAE_BASE_VERSION); ++#endif + fsemu_log_with_level(FSEMU_LOG_LEVEL_INFO, + COPYRIGHT_NOTICE, + PACKAGE_VERSION, +Index: demoscene-toolchain/submodules/fs-uae/src/debugmem.cpp +=================================================================== +--- demoscene-toolchain.orig/submodules/fs-uae/src/debugmem.cpp ++++ demoscene-toolchain/submodules/fs-uae/src/debugmem.cpp +@@ -2086,7 +2086,7 @@ static bool debugger_load_library(const + if (!zf) { + zf = zfile_fopen(name, _T("rb")); + if (!zf) { +- console_out_f(_T("Couldn't open '%s'\n"), name); ++ // console_out_f(_T("Couldn't open '%s'\n"), name); + return false; + } + } +Index: demoscene-toolchain/submodules/fs-uae/src/od-fs/writelog_fs.cpp +=================================================================== +--- demoscene-toolchain.orig/submodules/fs-uae/src/od-fs/writelog_fs.cpp ++++ demoscene-toolchain/submodules/fs-uae/src/od-fs/writelog_fs.cpp +@@ -174,8 +174,6 @@ void activate_console (void) + return; + #ifdef _WIN32 + SetForegroundWindow (GetConsoleWindow ()); +-#else +- STUB(""); + #endif + } + +@@ -341,8 +339,6 @@ void close_console (void) + } + FreeConsole (); + } +-#else +- STUB(""); + #endif + consoleopen = 0; + } +Index: demoscene-toolchain/submodules/fs-uae/libfsemu/src/log.c +=================================================================== +--- demoscene-toolchain.orig/submodules/fs-uae/libfsemu/src/log.c ++++ demoscene-toolchain/submodules/fs-uae/libfsemu/src/log.c +@@ -64,7 +64,7 @@ void fs_config_set_log_file(const char * + } + log_data.file = g_fopen(path, "w"); + if (log_data.file) { +- fprintf(stderr, "LOGFILE: %s\n", path); ++ printf("LOGFILE: %s\n", path); + if (log_data.initial_path) { + FILE *f = g_fopen(log_data.initial_path, "r"); + if (f) { +Index: demoscene-toolchain/submodules/fs-uae/src/memory.cpp +=================================================================== +--- demoscene-toolchain.orig/submodules/fs-uae/src/memory.cpp ++++ demoscene-toolchain/submodules/fs-uae/src/memory.cpp +@@ -1503,9 +1503,9 @@ static void log_kickstart(uae_u8 *mem, i + if (rd) { + char tmp[MAX_DPATH]; + getromname(rd, tmp); +- printf("ROM: %s\n", tmp); ++ fs_log("ROM: %s\n", tmp); + } else { +- printf("ROM: KS ROM %08x (%d bytes)\n", crc32, size); ++ fs_log("ROM: KS ROM %08x (%d bytes)\n", crc32, size); + } + #endif + } +Index: demoscene-toolchain/submodules/fs-uae/libfsemu/src/ml/input.c +=================================================================== +--- demoscene-toolchain.orig/submodules/fs-uae/libfsemu/src/ml/input.c ++++ demoscene-toolchain/submodules/fs-uae/libfsemu/src/ml/input.c +@@ -147,7 +147,7 @@ GList *fs_ml_input_list_custom_keyboards + char *keyboards_path = g_build_filename( + fs_data_dir(), "Devs", "Keyboards", NULL); + #endif +- printf("# Keyboards path: %s\n", keyboards_path); ++ fs_log("# Keyboards path: %s\n", keyboards_path); + GList *list = NULL; + GDir *dir = g_dir_open(keyboards_path, 0, NULL); + if (dir) { diff --git a/patches/fs-uae/uaelib-log.diff b/patches/fs-uae/uaelib-log.diff index 5d4e32e..9c9522e 100644 --- a/patches/fs-uae/uaelib-log.diff +++ b/patches/fs-uae/uaelib-log.diff @@ -10,28 +10,6 @@ Index: demoscene-toolchain/submodules/fs-uae/src/od-fs/libamiga.cpp uae_log("Initializing core derived from %s\n", UAE_BASE_VERSION); #if 0 -Index: demoscene-toolchain/submodules/fs-uae/src/od-fs/writelog_fs.cpp -=================================================================== ---- demoscene-toolchain.orig/submodules/fs-uae/src/od-fs/writelog_fs.cpp -+++ demoscene-toolchain/submodules/fs-uae/src/od-fs/writelog_fs.cpp -@@ -174,8 +174,6 @@ void activate_console (void) - return; - #ifdef _WIN32 - SetForegroundWindow (GetConsoleWindow ()); --#else -- STUB(""); - #endif - } - -@@ -341,8 +339,6 @@ void close_console (void) - } - FreeConsole (); - } --#else -- STUB(""); - #endif - consoleopen = 0; - } Index: demoscene-toolchain/submodules/fs-uae/src/uaelib.cpp =================================================================== --- demoscene-toolchain.orig/submodules/fs-uae/src/uaelib.cpp @@ -243,45 +221,3 @@ Index: demoscene-toolchain/submodules/fs-uae/src/uaelib_log.cpp + } + } +} -Index: demoscene-toolchain/submodules/fs-uae/libfsemu/src/ml/input.c -=================================================================== ---- demoscene-toolchain.orig/submodules/fs-uae/libfsemu/src/ml/input.c -+++ demoscene-toolchain/submodules/fs-uae/libfsemu/src/ml/input.c -@@ -147,7 +147,7 @@ GList *fs_ml_input_list_custom_keyboards - char *keyboards_path = g_build_filename( - fs_data_dir(), "Devs", "Keyboards", NULL); - #endif -- printf("# Keyboards path: %s\n", keyboards_path); -+ fs_log("# Keyboards path: %s\n", keyboards_path); - GList *list = NULL; - GDir *dir = g_dir_open(keyboards_path, 0, NULL); - if (dir) { -Index: demoscene-toolchain/submodules/fs-uae/src/memory.cpp -=================================================================== ---- demoscene-toolchain.orig/submodules/fs-uae/src/memory.cpp -+++ demoscene-toolchain/submodules/fs-uae/src/memory.cpp -@@ -1503,9 +1503,9 @@ static void log_kickstart(uae_u8 *mem, i - if (rd) { - char tmp[MAX_DPATH]; - getromname(rd, tmp); -- printf("ROM: %s\n", tmp); -+ write_log("ROM: %s\n", tmp); - } else { -- printf("ROM: KS ROM %08x (%d bytes)\n", crc32, size); -+ write_log("ROM: KS ROM %08x (%d bytes)\n", crc32, size); - } - #endif - } -Index: demoscene-toolchain/submodules/fs-uae/libfsemu/src/log.c -=================================================================== ---- demoscene-toolchain.orig/submodules/fs-uae/libfsemu/src/log.c -+++ demoscene-toolchain/submodules/fs-uae/libfsemu/src/log.c -@@ -64,7 +64,7 @@ void fs_config_set_log_file(const char * - } - log_data.file = g_fopen(path, "w"); - if (log_data.file) { -- fprintf(stderr, "LOGFILE: %s\n", path); -+ fprintf(stderr, "LOGFILE: %s\n\n", path); - if (log_data.initial_path) { - FILE *f = g_fopen(log_data.initial_path, "r"); - if (f) { diff --git a/patches/series b/patches/series index 1bdcfd2..e00b318 100644 --- a/patches/series +++ b/patches/series @@ -9,3 +9,5 @@ fs-uae/fix-without-ppc.diff fs-uae/print-memwatch.diff fs-uae/uaelib-log.diff fs-uae/data-path-macos.diff +fs-uae/silence-logs.diff +fs-uae/debug-msg-fix.diff From 70e323ac5f97c6cf5ce23bd0967537bc23dd164c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krystian=20Bac=C5=82awski?= Date: Thu, 24 Nov 2022 16:12:40 +0100 Subject: [PATCH 5/5] Unfortunately bebbo has not fixed all problem with N_SLINE stabs. --- patches/gdb-line-addr-fix.patch | 13 +++++++++++++ patches/series | 1 + 2 files changed, 14 insertions(+) create mode 100644 patches/gdb-line-addr-fix.patch diff --git a/patches/gdb-line-addr-fix.patch b/patches/gdb-line-addr-fix.patch new file mode 100644 index 0000000..0bc4330 --- /dev/null +++ b/patches/gdb-line-addr-fix.patch @@ -0,0 +1,13 @@ +Index: demoscene-toolchain/submodules/binutils-gdb/gdb/dbxread.c +=================================================================== +--- demoscene-toolchain.orig/submodules/binutils-gdb/gdb/dbxread.c ++++ demoscene-toolchain/submodules/binutils-gdb/gdb/dbxread.c +@@ -2581,7 +2581,7 @@ process_one_symbol (int type, int desc, + + /* Relocate for dynamic loading and for ELF acc + function-relative symbols. */ +- valu += function_start_offset; ++ /* valu += function_start_offset; */ + + /* GCC 2.95.3 emits the first N_SLINE stab somewhere in the + middle of the prologue instead of right at the start of the diff --git a/patches/series b/patches/series index e00b318..3710b1d 100644 --- a/patches/series +++ b/patches/series @@ -11,3 +11,4 @@ fs-uae/uaelib-log.diff fs-uae/data-path-macos.diff fs-uae/silence-logs.diff fs-uae/debug-msg-fix.diff +gdb-line-addr-fix.patch