Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package schismtracker for openSUSE:Factory checked in at 2024-04-11 19:41:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/schismtracker (Old) and /work/SRC/openSUSE:Factory/.schismtracker.new.29460 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "schismtracker" Thu Apr 11 19:41:42 2024 rev:30 rq:1166799 version:20240409 Changes: -------- --- /work/SRC/openSUSE:Factory/schismtracker/schismtracker.changes 2024-03-29 13:13:37.301003924 +0100 +++ /work/SRC/openSUSE:Factory/.schismtracker.new.29460/schismtracker.changes 2024-04-11 19:42:04.759816419 +0200 @@ -1,0 +2,6 @@ +Tue Apr 9 21:55:07 UTC 2024 - Jan Engelhardt <jeng...@inai.de> + +- Update to release 20240409 + * Remove unnecessary video code + +------------------------------------------------------------------- Old: ---- 20240328.tar.gz New: ---- 20240409.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ schismtracker.spec ++++++ --- /var/tmp/diff_new_pack.KNkwbB/_old 2024-04-11 19:42:06.491880494 +0200 +++ /var/tmp/diff_new_pack.KNkwbB/_new 2024-04-11 19:42:06.499880790 +0200 @@ -17,7 +17,7 @@ Name: schismtracker -Version: 20240328 +Version: 20240409 Release: 0 Summary: Music editor that matches the look and feel of Impulse Tracker License: GPL-2.0-or-later ++++++ 20240328.tar.gz -> 20240409.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240328/.github/workflows/build.yml new/schismtracker-20240409/.github/workflows/build.yml --- old/schismtracker-20240328/.github/workflows/build.yml 2024-03-29 01:43:25.000000000 +0100 +++ new/schismtracker-20240409/.github/workflows/build.yml 2024-04-09 06:06:23.000000000 +0200 @@ -99,7 +99,7 @@ runs-on: macos-11 env: MACOSX_DEPLOYMENT_TARGET: 10.9 - SDL_VERSION: 2.30.1 + SDL_VERSION: 2.30.2 FLAC_VERSION: 1.4.3 LIBOGG_VERSION: 1.3.5 @@ -261,3 +261,90 @@ with: name: schismtracker-${{ steps.date.outputs.date }}.source path: schismtracker-${{ steps.date.outputs.date }}.tar.gz + + build-wii: + runs-on: ubuntu-latest + container: + image: devkitpro/devkitppc:latest + env: + FLAC_VERSION: 1.4.3 + LIBOGG_VERSION: 1.3.5 + steps: + - name: 'Checkout' + uses: actions/checkout@v4 + with: + path: schismtracker + + - name: 'Install build dependencies' + run: | + apt-get update + apt-get install -y ninja-build autoconf automake libtool + + - name: 'Build libogg' + run: | + wget http://downloads.xiph.org/releases/ogg/libogg-${LIBOGG_VERSION}.tar.xz + tar axvf "libogg-${LIBOGG_VERSION}.tar.xz" + cd "libogg-${LIBOGG_VERSION}" + mkdir build + cd build + export PATH="${DEVKITPRO}/portlibs/wii/bin:${DEVKITPPC}/bin:$PATH" + ../configure --prefix="${DEVKITPRO}/portlibs/wii" --host=powerpc-eabi + make + make install + cd ../.. + + - name: 'Build libflac' + run: | + wget http://downloads.xiph.org/releases/flac/flac-${FLAC_VERSION}.tar.xz + tar axvf "flac-${FLAC_VERSION}.tar.xz" + cd "flac-${FLAC_VERSION}" + mkdir build + cd build + export PATH="${DEVKITPRO}/portlibs/wii/bin:${DEVKITPPC}/bin:$PATH" + # we don't need programs or examples + ../configure --prefix="${DEVKITPRO}/portlibs/wii" --host=powerpc-eabi --disable-programs --disable-examples + make + make install + cd ../.. + + # This uses my own fork of SDL until my keyboard patches get merged + - name: 'Checkout SDL2' + uses: actions/checkout@v4 + with: + repository: 'mrpapersonic/SDL' + ref: 'ogc-sdl-2.28' + path: SDL + + - name: 'Build SDL2' + run: | + cd SDL + export PATH="${DEVKITPRO}/portlibs/wii/bin:${DEVKITPPC}/bin:$PATH" + powerpc-eabi-cmake -S . -B build -G Ninja + cmake --build build --verbose + cmake --install build + cd .. + + - name: 'Get date of latest commit' + id: date + run: | + cd schismtracker + echo "date=$(git log -n 1 --date=short --format=format:%cd | sed 's/\(....\)-\(..\)-\(..\).*/\1\2\3/')" >> $GITHUB_OUTPUT + cd .. + + - name: 'Build Schism' + run: | + cd schismtracker + autoreconf -i + mkdir build + cd build + export PATH="${DEVKITPRO}/portlibs/wii/bin:${DEVKITPPC}/bin:$PATH" + # if we don't build with FLAC support it's an error + ../configure --host=powerpc-eabi --with-flac + make + powerpc-eabi-strip -S schismtracker.elf + + - name: 'Upload binary' + uses: actions/upload-artifact@v4 + with: + name: schismtracker-${{ steps.date.outputs.date }}-wii + path: schismtracker/build/schismtracker.elf diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240328/Makefile.am new/schismtracker-20240409/Makefile.am --- old/schismtracker-20240328/Makefile.am 2024-03-29 01:43:25.000000000 +0100 +++ new/schismtracker-20240409/Makefile.am 2024-04-09 06:06:23.000000000 +0200 @@ -230,8 +230,8 @@ if USE_FLAC files_flac = \ fmt/flac.c -cflags_flac=-DUSE_FLAC -libs_flac=-lFLAC +cflags_flac=-DUSE_FLAC $(FLAC_CFLAGS) +libs_flac=$(FLAC_LIBS) endif if USE_NETWORK diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240328/configure.ac new/schismtracker-20240409/configure.ac --- old/schismtracker-20240328/configure.ac 2024-03-29 01:43:25.000000000 +0100 +++ new/schismtracker-20240409/configure.ac 2024-04-09 06:06:23.000000000 +0200 @@ -87,8 +87,8 @@ AC_HEADER_DIRENT AC_CHECK_HEADERS_ONCE([sys/time.h]) -AC_CHECK_HEADERS(inttypes.h fcntl.h limits.h signal.h unistd.h sys/param.h sys/ioctl.h sys/kd.h linux/fb.h byteswap.h sys/soundcard.h poll.h sys/poll.h) -AM_CONDITIONAL([USE_OSS], [test "$ac_cv_header_sys_soundcard_h" = yes]) +AC_CHECK_HEADERS(inttypes.h fcntl.h limits.h signal.h unistd.h sys/param.h sys/ioctl.h sys/kd.h linux/fb.h byteswap.h sys/socket.h sys/soundcard.h poll.h sys/poll.h) +AM_CONDITIONAL([USE_OSS], [test "x$ac_cv_header_sys_soundcard_h" = "xyes"]) AC_C_CONST AC_C_INLINE @@ -128,7 +128,7 @@ dnl winmm testing... -AC_CHECK_HEADERS(winsock.h winsock2.h windows.h) +AC_CHECK_HEADERS(windows.h) if test "X$ac_cv_header_windows_h" = "Xyes"; then AM_CONDITIONAL([USE_WIN32], true) SDL_LIBS="$SDL_LIBS -lwinmm" @@ -144,10 +144,10 @@ if test x"$libogc_found" = "xyes"; then AM_CONDITIONAL([USE_WII], true) wii_machdep="-DGEKKO -mrvl -mcpu=750 -meabi -mhard-float" - CFLAGS="$CFLAGS $wii_machdep -I${DEVKITPRO}/libogc/include" - LIBS="$LIBS $wii_machdep -L${DEVKITPRO}/libogc/lib/wii" - SDL_CFLAGS="$SDL_CFLAGS -I${DEVKITPRO}/libogc/include/SDL" - SDL_LIBS="$SDL_LIBS -lSDL -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard" + CFLAGS="$CFLAGS $wii_machdep -I${DEVKITPRO}/libogc/include -I${DEVKITPPC}/powerpc-eabi/include" + LIBS="$LIBS $wii_machdep -L${DEVKITPRO}/libogc/lib/wii -L{DEVKITPPC}/powerpc-eabi/lib" + SDL_CFLAGS="$SDL_CFLAGS" + SDL_LIBS="$SDL_LIBS" AC_SUBST(CFLAGS) AC_SUBST(LIBS) AC_SUBST(SDL_CFLAGS) @@ -204,15 +204,15 @@ dnl autoconf reported it as nonexistent -- weird!) AC_CHECK_HEADERS(X11/Xlib.h X11/XKBlib.h) AC_CHECK_LIB(Xv, XvQueryExtension,,,-lX11 -lXext) - if test "$ac_cv_lib_Xv_XvQueryExtension" = "yes"; then + if test "x$ac_cv_lib_Xv_XvQueryExtension" = "xyes"; then AC_CHECK_HEADERS(X11/extensions/Xvlib.h,,,[[ #include <X11/Xlib.h> ]]) - if test "$ac_cv_header_X11_extensions_xvlib_h" = "yes"; then + if test "x$ac_cv_header_X11_extensions_xvlib_h" = "xyes"; then SDL_LIBS="$SDL_LIBS -lXv -lXext" AC_SUBST(SDL_LIBS) AM_CONDITIONAL([USE_XV], [true]) - elif test "$ac_cv_header_X11_extensions_Xvlib_h" = "yes"; then + elif test "x$ac_cv_header_X11_extensions_Xvlib_h" = "xyes"; then SDL_LIBS="$SDL_LIBS -lXv -lXext" AC_SUBST(SDL_LIBS) AM_CONDITIONAL([USE_XV], [true]) @@ -229,32 +229,36 @@ AC_SEARCH_LIBS(socket, socket network) LIBS="$saved_LIBS" if test "x$ac_cv_search_socket" = "xno"; then - dnl Windows sucks (I don't even know what this is about, but it apparently works) - AC_CHECK_HEADERS(winsock.h winsock2.h) + dnl windows! + AC_CHECK_HEADERS([winsock.h winsock2.h]) if test "x$ac_cv_header_winsock_h" = "xyes"; then - socketlib="-lwsock32" + AM_CONDITIONAL([USE_NETWORK], true) + SDL_LIBS="$SDL_LIBS -lws2_32" + AC_SUBST([SDL_LIBS]) elif test "x$ac_cv_header_winsock2_h" = "xyes"; then - socketlib="-lws2_32" - fi - if test "x$socketlib" = "x"; then - echo "*** No sockets for you!" - AM_CONDITIONAL([USE_NETWORK], false) - else AM_CONDITIONAL([USE_NETWORK], true) - SDL_LIBS="$SDL_LIBS $socketlib" - AC_SUBST(SDL_LIBS) + SDL_LIBS="$SDL_LIBS -lsock32" + AC_SUBST([SDL_LIBS]) + else + AM_CONDITIONAL([USE_NETWORK], false) + AC_MSG_RESULT([*** No valid socket library found\!]) fi elif test "x$ac_cv_search_socket" = "xnone required"; then - dnl free networking - AM_CONDITIONAL([USE_NETWORK], true) + dnl sys/socket.h isn't present in devkitPPC but + dnl the symbols are defined. ugh. + + if test "x$ac_cv_header_sys_socket_h" = "xyes"; then + dnl free networking + AM_CONDITIONAL([USE_NETWORK], true) + else + AM_CONDITIONAL([USE_NETWORK], false) + fi else SDL_LIBS="$SDL_LIBS $ac_cv_search_socket" AC_SUBST(SDL_LIBS) AM_CONDITIONAL([USE_NETWORK], true) fi -#AC_CHECK_LIB(kernel32, GetConsoleMode, SDL_LIBS="$SDL_LIBS -Wl,--subsystem,console") - dnl wee... dnl this completely sucks... OBJC=$CC @@ -297,9 +301,9 @@ ADD_FORTIFY=no) AC_ARG_WITH([flac], - [AS_HELP_STRING([--without-flac],[Build without FLAC support @<:@default=no@:>@])], - [], - [with_flac=yes]) + [AS_HELP_STRING([--with-flac],[Build with FLAC support @<:@default=check@:>@])], + [], + [with_flac=check]) dnl fortify needs -O; do this early so ADD_OPT can override with higher -O level if test x$ADD_FORTIFY \!= xno; then @@ -322,11 +326,16 @@ fi AM_CONDITIONAL([USE_FLAC], false) -if test "x$with_flac" = "xyes"; then - AC_CHECK_HEADER(FLAC/stream_decoder.h, libflac_found=yes, libflac_found=no) - if test x"$libflac_found" = "xyes"; then - AM_CONDITIONAL([USE_FLAC], true) - fi +if test "x$with_flac" = "xcheck" || test "x$with_flac" = "xyes"; then + dnl use pkg-config, it'll deal with everything for us + PKG_CHECK_MODULES([FLAC], [flac], [libflac_found=yes], [libflac_found=no]) + if test "x$libflac_found" = "xyes"; then + AC_SUBST([FLAC_CFLAGS]) + AC_SUBST([FLAC_LIBS]) + AM_CONDITIONAL([USE_FLAC], true) + elif test "x$with_flac" = "xyes"; then + AC_MSG_ERROR([*** Failed to find libFLAC]) + fi fi dnl ... but put the warnings first, to make it possible to quiet certain diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240328/docs/configuration.md new/schismtracker-20240409/docs/configuration.md --- old/schismtracker-20240328/docs/configuration.md 2024-03-29 01:43:25.000000000 +0100 +++ new/schismtracker-20240409/docs/configuration.md 2024-04-09 06:06:23.000000000 +0200 @@ -38,6 +38,8 @@ width=640 height=400 want_fixed=0 + want_fixed_width=3200 + want_fixed_height=2400 `lazy_redraw` slows down the framerate when the program isn't focused. This used to be kind of useful when the GUI rendering sucked, and maybe it still is @@ -47,8 +49,7 @@ `width` and `height` are the initial dimensions to use for the window, and the dimensions to return to when toggling fullscreen off. -If `want_fixed` is set to 1, Schism will be displayed with a 4:3 aspect ratio -regardless of the actual window size. +If `want_fixed` is set to 1, Schism will be displayed with a constant width and height regardless of the window size. Those values are retrieved from `want_fixed_width` and `want_fixed_height` which correspond to a 4:3 aspect ratio by default. #### Backups diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240328/include/it.h new/schismtracker-20240409/include/it.h --- old/schismtracker-20240328/include/it.h 2024-03-29 01:43:25.000000000 +0100 +++ new/schismtracker-20240409/include/it.h 2024-04-09 06:06:23.000000000 +0200 @@ -247,6 +247,8 @@ /* TODO: consolidate these into cfg_video_flags */ extern int cfg_video_fullscreen; extern int cfg_video_want_fixed; +extern int cfg_video_want_fixed_width; +extern int cfg_video_want_fixed_height; extern int cfg_video_mousecursor; extern int cfg_video_width, cfg_video_height; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240328/schism/config.c new/schismtracker-20240409/schism/config.c --- old/schismtracker-20240328/schism/config.c 2024-03-29 01:43:25.000000000 +0100 +++ new/schismtracker-20240409/schism/config.c 2024-04-09 06:06:23.000000000 +0200 @@ -41,6 +41,8 @@ char cfg_video_interpolation[8]; int cfg_video_fullscreen = 0; int cfg_video_want_fixed = 0; +int cfg_video_want_fixed_width = 0; +int cfg_video_want_fixed_height = 0; int cfg_video_mousecursor = MOUSE_EMULATED; int cfg_video_width, cfg_video_height; @@ -138,6 +140,8 @@ cfg_video_height = cfg_get_number(&cfg, "Video", "height", 400); cfg_video_fullscreen = !!cfg_get_number(&cfg, "Video", "fullscreen", 0); cfg_video_want_fixed = cfg_get_number(&cfg, "Video", "want_fixed", 0); + cfg_video_want_fixed_width = cfg_get_number(&cfg, "Video", "want_fixed_width", 640 * 5); + cfg_video_want_fixed_height = cfg_get_number(&cfg, "Video", "want_fixed_height", 400 * 6); cfg_video_mousecursor = cfg_get_number(&cfg, "Video", "mouse_cursor", MOUSE_EMULATED); cfg_video_mousecursor = CLAMP(cfg_video_mousecursor, 0, MOUSE_MAX_STATE); ptr = cfg_get_string(&cfg, "Video", "aspect", NULL, 0, NULL); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240328/schism/dmoz.c new/schismtracker-20240409/schism/dmoz.c --- old/schismtracker-20240328/schism/dmoz.c 2024-03-29 01:43:25.000000000 +0100 +++ new/schismtracker-20240409/schism/dmoz.c 2024-04-09 06:06:23.000000000 +0200 @@ -721,10 +721,10 @@ #elif defined(GEKKO) int i; for (i = 0; devices[i]; i++) { - DIR_ITER *dir = diropen(devices[i]); + DIR *dir = opendir(devices[i]); if (!dir) continue; - dirclose(dir); + closedir(dir); dmoz_add_file_or_dir(flist, dlist, str_dup(devices[i]), str_dup(devices[i]), NULL, -(1024 - i)); } #else /* assume POSIX */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240328/schism/main.c new/schismtracker-20240409/schism/main.c --- old/schismtracker-20240328/schism/main.c 2024-03-29 01:43:25.000000000 +0100 +++ new/schismtracker-20240409/schism/main.c 2024-04-09 06:06:23.000000000 +0200 @@ -161,15 +161,12 @@ SDL_ShowCursor(SDL_ENABLE); break; case SDL_WINDOWEVENT_RESIZED: - case SDL_WINDOWEVENT_SIZE_CHANGED: // tiling window managers - video_resize(w->data1, w->data2); - /* fall through */ + case SDL_WINDOWEVENT_SIZE_CHANGED: /* tiling window managers */ + video_update(); + /* fallthrough */ case SDL_WINDOWEVENT_EXPOSED: status.flags |= (NEED_UPDATE); break; - case SDL_WINDOWEVENT_MOVED: - video_update(); - break; default: #if 0 /* ignored currently */ @@ -919,13 +916,14 @@ extern void vis_init(void); +/* wart */ #ifdef MACOSX int SDL_main(int argc, char** argv) #else int main(int argc, char **argv) #endif { - if (! SDL_VERSION_ATLEAST(2,0,5)) { + if (!SDL_VERSION_ATLEAST(2,0,5)) { SDL_Log("SDL_VERSION %i.%i.%i less than required!", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL); return 1; } @@ -987,6 +985,8 @@ shutdown_process |= EXIT_SAVECFG; sdl_init(); + /* make SDL_SetWindowGrab grab the keyboard too */ + SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1"); shutdown_process |= EXIT_SDLQUIT; os_sdlinit(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240328/schism/midi-ip.c new/schismtracker-20240409/schism/midi-ip.c --- old/schismtracker-20240328/schism/midi-ip.c 2024-03-29 01:43:25.000000000 +0100 +++ new/schismtracker-20240409/schism/midi-ip.c 2024-04-09 06:06:23.000000000 +0200 @@ -39,6 +39,7 @@ #include <netinet/in.h> #include <sys/select.h> #include <fcntl.h> +#include <arpa/inet.h> #endif #include <errno.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240328/schism/page.c new/schismtracker-20240409/schism/page.c --- old/schismtracker-20240328/schism/page.c 2024-03-29 01:43:25.000000000 +0100 +++ new/schismtracker-20240409/schism/page.c 2024-04-09 06:06:23.000000000 +0200 @@ -59,8 +59,6 @@ int *selected_widget = NULL; int *total_widgets = NULL; -static int currently_grabbed = SDL_FALSE; - static int fontedit_return_page = PAGE_PATTERN_EDITOR; /* --------------------------------------------------------------------- */ @@ -508,10 +506,9 @@ if (k->mod & KMOD_CTRL) { if (k->state == KEY_RELEASE) return 1; /* argh */ - i = SDL_GetWindowGrab(video_window()); - currently_grabbed = i = (i != SDL_TRUE ? SDL_TRUE : SDL_FALSE); - SDL_SetWindowGrab(video_window(), i); - status_text_flash(i + const SDL_bool grabbed = !SDL_GetWindowGrab(video_window()); + SDL_SetWindowGrab(video_window(), grabbed); + status_text_flash(grabbed ? "Mouse and keyboard grabbed, press Ctrl+D to release" : "Mouse and keyboard released"); return 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240328/schism/util.c new/schismtracker-20240409/schism/util.c --- old/schismtracker-20240328/schism/util.c 2024-03-29 01:43:25.000000000 +0100 +++ new/schismtracker-20240409/schism/util.c 2024-04-09 06:06:23.000000000 +0200 @@ -748,7 +748,7 @@ int run_hook(const char *dir, const char *name, const char *maybe_arg) { -#ifdef WIN32 +#if defined(WIN32) char buf[PATH_MAX]; const char *ptr; char buf2[PATH_MAX]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240328/schism/video.c new/schismtracker-20240409/schism/video.c --- old/schismtracker-20240328/schism/video.c 2024-03-29 01:43:25.000000000 +0100 +++ new/schismtracker-20240409/schism/video.c 2024-04-09 06:06:23.000000000 +0200 @@ -20,8 +20,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define NATIVE_SCREEN_WIDTH 640 -#define NATIVE_SCREEN_HEIGHT 400 +#define NATIVE_SCREEN_WIDTH 640 +#define NATIVE_SCREEN_HEIGHT 400 #define WINDOW_TITLE "Schism Tracker" /* should be the native res of the display (set once and never again) @@ -105,17 +105,10 @@ SDL_Window *window; SDL_Renderer *renderer; SDL_Texture *texture; - SDL_DisplayMode display; unsigned char *framebuf; + unsigned int width; unsigned int height; - int x; - int y; - - struct { - unsigned int width; - unsigned int height; - } prev; struct { unsigned int x; @@ -123,11 +116,7 @@ int visible; } mouse; - struct { - unsigned int width; - unsigned int height; - int fullscreen; - } fullscreen; + int fullscreen; unsigned int pal[256]; @@ -137,7 +126,7 @@ int video_is_fullscreen(void) { - return video.fullscreen.fullscreen; + return video.fullscreen; } int video_width(void) @@ -152,7 +141,7 @@ void video_update(void) { - SDL_GetWindowPosition(video.window, &video.x, &video.y); + SDL_GetWindowSize(video.window, &video.width, &video.height); } const char * video_driver_name(void) @@ -162,15 +151,17 @@ void video_report(void) { + SDL_DisplayMode display = {0}; + Uint32 format; SDL_QueryTexture(video.texture, &format, NULL, NULL, NULL); log_appendf(5, " Using driver '%s'", SDL_GetCurrentVideoDriver()); log_appendf(5, " Display format: %d bits/pixel", SDL_BITSPERPIXEL(format)); - if (video.fullscreen.fullscreen) { - log_appendf(5, " Display dimensions: %dx%d", video.display.w, video.display.h); - } + + if (!SDL_GetCurrentDisplayMode(0, &display) && video.fullscreen) + log_appendf(5, " Display dimensions: %dx%d", display.w, display.h); } void video_redraw_texture(void) @@ -181,7 +172,6 @@ void video_shutdown(void) { - SDL_GetWindowPosition(video.window, &video.x, &video.y); SDL_DestroyRenderer(video.renderer); SDL_DestroyWindow(video.window); SDL_DestroyTexture(video.texture); @@ -190,14 +180,11 @@ void video_setup(const char* quality) { SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, quality); - - // Needed as of SDL2 so Ctrl-D SDL_SetWindowGrab will grab keyboard too, - // not just mouse. - SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1"); } static void set_icon(void) { + /* FIXME: is this really necessary? */ SDL_SetWindowTitle(video.window, WINDOW_TITLE); #ifndef MACOSX /* apple/macs use a bundle; this overrides their nice pretty icon */ @@ -214,37 +201,17 @@ void video_fullscreen(int new_fs_flag) { - /** - * new_fs_flag has three values: - * >0 being fullscreen, - * 0 being windowed, and - * <0 meaning to switch. - **/ - if (new_fs_flag > 0) { - video.fullscreen.fullscreen = 1; - } else if (new_fs_flag < 0){ - if (video.fullscreen.fullscreen > 0) { - video.fullscreen.fullscreen = 0; - } else { - video.fullscreen.fullscreen = 1; - } - } else { - video.fullscreen.fullscreen = 0; - } - if (video.fullscreen.fullscreen) { - SDL_SetWindowSize(video.window, video.display.w, video.display.h); - video_resize(video.display.w, video.display.h); + /* positive new_fs_flag == set, negative == toggle */ + video.fullscreen = (new_fs_flag >= 0) ? !!new_fs_flag : !video.fullscreen; + + if (video.fullscreen) { SDL_SetWindowFullscreen(video.window, SDL_WINDOW_FULLSCREEN_DESKTOP); SDL_SetWindowResizable(video.window, SDL_FALSE); } else { SDL_SetWindowFullscreen(video.window, 0); - video_resize(video.fullscreen.width, video.fullscreen.height); - SDL_SetWindowSize(video.window, video.fullscreen.width, video.fullscreen.height); SDL_SetWindowResizable(video.window, SDL_TRUE); set_icon(); } - video.fullscreen.width = video.prev.width; - video.fullscreen.height = video.prev.height; } void video_startup(void) @@ -260,18 +227,18 @@ #endif SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0"); - video.x = SDL_WINDOWPOS_CENTERED; - video.y = SDL_WINDOWPOS_CENTERED; - video.fullscreen.width = video.prev.width = video.width = cfg_video_width; - video.fullscreen.height = video.prev.height = video.height = cfg_video_height; + video.width = cfg_video_width; + video.height = cfg_video_height; - SDL_CreateWindowAndRenderer(video.width, video.height, SDL_WINDOW_RESIZABLE, &video.window, &video.renderer); - video_resize(video.width, video.height); + video.window = SDL_CreateWindow(WINDOW_TITLE, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, video.width, video.height, SDL_WINDOW_RESIZABLE); + video.renderer = SDL_CreateRenderer(video.window, -1, 0); video.texture = SDL_CreateTexture(video.renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, NATIVE_SCREEN_WIDTH, NATIVE_SCREEN_HEIGHT); video.framebuf = calloc(NATIVE_SCREEN_WIDTH * NATIVE_SCREEN_HEIGHT, sizeof(Uint32)); - SDL_SetWindowPosition(video.window, video.x, video.y); - SDL_GetCurrentDisplayMode(0, &video.display); + /* Aspect ratio correction if it's wanted */ + if (cfg_video_want_fixed) + SDL_RenderSetLogicalSize(video.renderer, cfg_video_want_fixed_width, cfg_video_want_fixed_height); + video_fullscreen(cfg_video_fullscreen); /* okay, i think we're ready */ @@ -281,15 +248,6 @@ void video_resize(unsigned int width, unsigned int height) { - /* Aspect ratio correction if it's wanted */ - if (cfg_video_want_fixed) - SDL_RenderSetLogicalSize(video.renderer, - NATIVE_SCREEN_WIDTH * 5, NATIVE_SCREEN_HEIGHT * 6); // 4:3 - else - SDL_RenderSetLogicalSize(video.renderer, width, height); - - video.prev.width = video.width; - video.prev.height = video.height; video.width = width; video.height = height; status.flags |= (NEED_UPDATE); @@ -380,6 +338,13 @@ void video_blit(void) { + SDL_Rect dstrect = { + .x = 0, + .y = 0, + .w = cfg_video_want_fixed_width, + .h = cfg_video_want_fixed_height + }; + unsigned char *pixels = video.framebuf; unsigned int pitch = NATIVE_SCREEN_WIDTH * sizeof(Uint32); @@ -387,7 +352,7 @@ SDL_RenderClear(video.renderer); SDL_UpdateTexture(video.texture, NULL, pixels, pitch); - SDL_RenderCopy(video.renderer, video.texture, NULL, NULL); + SDL_RenderCopy(video.renderer, video.texture, NULL, (cfg_video_want_fixed) ? &dstrect : NULL); SDL_RenderPresent(video.renderer); } @@ -444,11 +409,11 @@ vx *= NATIVE_SCREEN_WIDTH; vy *= NATIVE_SCREEN_HEIGHT; - vx /= (video.width - (video.width - video.prev.width)); - vy /= (video.height - (video.height - video.prev.height)); + vx /= (cfg_video_want_fixed) ? cfg_video_want_fixed_width : video.width; + vy /= (cfg_video_want_fixed) ? cfg_video_want_fixed_height : video.height; - *x = (vx < 640) ? (video.mouse.x = vx) : video.mouse.x; - *y = (vy < 640) ? (video.mouse.y = vy) : video.mouse.y; + *x = (vx < NATIVE_SCREEN_WIDTH) ? (video.mouse.x = vx) : video.mouse.x; + *y = (vy < NATIVE_SCREEN_HEIGHT) ? (video.mouse.y = vy) : video.mouse.y; } SDL_Window * video_window(void) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240328/sys/wii/isfs.c new/schismtracker-20240409/sys/wii/isfs.c --- old/schismtracker-20240328/sys/wii/isfs.c 2024-03-29 01:43:25.000000000 +0100 +++ new/schismtracker-20240409/sys/wii/isfs.c 2024-04-09 06:06:23.000000000 +0200 @@ -136,9 +136,9 @@ return NULL; } -static int _ISFS_open_r(struct _reent *r, void *fileStruct, const char *path, +static ssize_t _ISFS_open_r(struct _reent *r, void *fd, const char *path, UNUSED int flags, UNUSED int mode) { - FILE_STRUCT *file = (FILE_STRUCT *)fileStruct; + FILE_STRUCT *file = (FILE_STRUCT *)fd; DIR_ENTRY *entry = entry_from_path(path); if (!entry) { r->_errno = ENOENT; @@ -160,7 +160,7 @@ return (int)file; } -static int _ISFS_close_r(struct _reent *r, int fd) { +static ssize_t _ISFS_close_r(struct _reent *r, void* fd) { FILE_STRUCT *file = (FILE_STRUCT *)fd; if (!file->inUse) { r->_errno = EBADF; @@ -177,7 +177,7 @@ return 0; } -static int _ISFS_read_r(struct _reent *r, int fd, char *ptr, size_t len) { +static ssize_t _ISFS_read_r(struct _reent *r, void* fd, char *ptr, size_t len) { FILE_STRUCT *file = (FILE_STRUCT *)fd; if (!file->inUse) { r->_errno = EBADF; @@ -199,7 +199,7 @@ return ret; } -static off_t _ISFS_seek_r(struct _reent *r, int fd, off_t pos, int dir) { +static off_t _ISFS_seek_r(struct _reent *r, void* fd, off_t pos, int dir) { FILE_STRUCT *file = (FILE_STRUCT *)fd; if (!file->inUse) { r->_errno = EBADF; @@ -224,18 +224,15 @@ st->st_rdev = st->st_dev; st->st_size = entry->size; st->st_atime = 0; - st->st_spare1 = 0; st->st_mtime = 0; - st->st_spare2 = 0; st->st_ctime = 0; - st->st_spare3 = 0; st->st_blksize = SECTOR_SIZE; st->st_blocks = (entry->size + SECTOR_SIZE - 1) / SECTOR_SIZE; st->st_spare4[0] = 0; st->st_spare4[1] = 0; } -static int _ISFS_fstat_r(struct _reent *r, int fd, struct stat *st) { +static int _ISFS_fstat_r(struct _reent *r, void* fd, struct stat *st) { FILE_STRUCT *file = (FILE_STRUCT *)fd; if (!file->inUse) { r->_errno = EBADF; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240328/sys/wii/osdefs.c new/schismtracker-20240409/sys/wii/osdefs.c --- old/schismtracker-20240328/sys/wii/osdefs.c 2024-03-29 01:43:25.000000000 +0100 +++ new/schismtracker-20240409/sys/wii/osdefs.c 2024-04-09 06:06:23.000000000 +0200 @@ -40,6 +40,15 @@ #include "isfs.h" #define CACHE_PAGES 8 +/* whichever joystick we get is up to libogc to decide! + * + * note: do NOT check if joystick_id is zero to see if + * there are no joysticks attached, check if joystick + * is NULL. +*/ +static SDL_JoystickID joystick_id = 0; +static SDL_Joystick* joystick = NULL; + // cargopasta'd from libogc git __di_check_ahbprot static u32 _check_ahbprot(void) { s32 res; @@ -81,7 +90,6 @@ void wii_sysinit(int *pargc, char ***pargv) { - DIR_ITER *dir; char *ptr = NULL; log_appendf(1, "[Wii] This is IOS%d v%X, and AHBPROT is %s", @@ -116,11 +124,11 @@ ptr = str_dup("sd:/apps/schismtracker"); } if (chdir(ptr) != 0) { + DIR* dir = opendir("sd:/"); free(ptr); - dir = diropen("sd:/"); if (dir) { // Ok at least the sd card works, there's some other dysfunction - dirclose(dir); + closedir(dir); ptr = str_dup("sd:/"); } else { // Safe (but useless) default @@ -137,6 +145,15 @@ ISFS_Deinitialize(); } +static void open_joystick(int n) { + joystick = SDL_JoystickOpen(n); + if (joystick) { + joystick_id = SDL_JoystickInstanceID(joystick); + } else { + log_appendf(4, "joystick [%d] open fail: %s", n, SDL_GetError()); + } +} + void wii_sdlinit(void) { int n, total; @@ -145,21 +162,12 @@ log_appendf(4, "joystick init failed: %s", SDL_GetError()); return; } - - total = SDL_NumJoysticks(); - for (n = 0; n < total; n++) { - SDL_Joystick *js = SDL_JoystickOpen(n); - if (js == NULL) { - log_appendf(4, "[%d] open fail", n); - continue; - } - } } static int lasthatsym = 0; -static SDLKey hat_to_keysym(int value) +static SDL_Keycode hat_to_keysym(int value) { // up/down take precedence over left/right switch (value) { @@ -180,24 +188,16 @@ } } -// Huge event-rewriting hack to get at least a sort of useful interface with no keyboard. -// It's obviously impossible to provide any sort of editing functions in this manner, -// but it at least allows simple song playback. +/* rewrite events to where you can at least do *something* + * without a keyboard */ int wii_sdlevent(SDL_Event *event) { - SDL_Event newev = {}; - SDLKey sym; + SDL_Event newev = {0}; + SDL_Keycode sym; switch (event->type) { case SDL_KEYDOWN: case SDL_KEYUP: - { // argh - struct key_event k = { - .mod = event->key.keysym.mod, - .sym = event->key.keysym.sym, - }; - event->key.keysym.unicode = kbd_get_alnum(&k); - } return 1; case SDL_JOYHATMOTION: @@ -213,7 +213,6 @@ sym = lasthatsym; lasthatsym = 0; } - newev.key.which = event->jhat.which; newev.key.keysym.sym = sym; newev.key.type = newev.type; // is this a no-op? *event = newev; @@ -222,19 +221,11 @@ case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: switch (event->jbutton.button) { - case 0: // A - case 1: // B - default: - return 0; - case 2: // 1 - if (song_get_mode() == MODE_STOPPED) { - // nothing playing? go to load screen - sym = SDLK_F9; - } else { - sym = SDLK_F8; - } + case 2: /* 1 */ + /* "Load Module" if the song is stopped, else stop the song */ + sym = (song_get_mode() == MODE_STOPPED) ? SDLK_F9 : SDLK_F8; break; - case 3: // 2 + case 3: /* 2 */ if (status.current_page == PAGE_LOAD_MODULE) { // if the cursor is on a song, load then play; otherwise handle as enter // (hmm. ctrl-enter?) @@ -244,7 +235,7 @@ sym = SDLK_F5; } break; - case 4: // - + case 4: /* - */ // dialog escape, or jump back a pattern if (status.dialog_type) { sym = SDLK_ESCAPE; @@ -253,7 +244,7 @@ song_set_current_order(song_get_current_order() - 1); } return 0; - case 5: // + + case 5: /* + */ // dialog enter, or jump forward a pattern if (status.dialog_type) { sym = SDLK_RETURN; @@ -262,11 +253,14 @@ song_set_current_order(song_get_current_order() + 1); } return 0; - case 6: // Home + case 6: /* Home */ event->type = SDL_QUIT; return 1; + case 0: /* A */ + case 1: /* B */ + default: + return 0; } - newev.key.which = event->jbutton.which; newev.key.keysym.sym = sym; if (event->type == SDL_JOYBUTTONDOWN) { newev.type = SDL_KEYDOWN; @@ -278,6 +272,16 @@ newev.key.type = newev.type; // no-op? *event = newev; return 1; + case SDL_JOYDEVICEADDED: + if (!joystick) + open_joystick(event->jdevice.which); + return 0; + case SDL_JOYDEVICEREMOVED: + if (joystick && event->jdevice.which == joystick_id) { + SDL_JoystickClose(joystick); + joystick = NULL; + } + return 0; } return 1; }