diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..aff5604
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,227 @@
+name: Z64 RSP
+
+on:
+  push:
+    paths-ignore:
+      - '**/*.md'
+      - '.{gitattributes,gitignore,travis.yml}'
+      - 'appveyor.yml,README'
+  pull_request:
+    paths-ignore:
+      - '**/*.md'
+      - '.{gitattributes,gitignore,travis.yml}'
+      - 'appveyor.yml,README'
+  workflow_dispatch:
+jobs:
+
+  Linux:
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - cc: GCC
+            platform: x64
+            bits: 64
+          - cc: GCC
+            platform: x86
+            bits: 32
+          - cc: Clang
+            platform: x64
+            bits: 64
+          - cc: Clang
+            platform: x86
+            bits: 32
+    name: Linux / ${{ matrix.cc }} / ${{ matrix.platform }}
+    runs-on: ubuntu-22.04
+    steps:
+      - uses: actions/checkout@v3
+      - name: Get build dependencies and arrange the environment
+        run: |
+          sudo apt-get update
+          sudo apt-get --reinstall -y install gcc-multilib g++-multilib libc6 libc6-dev-i386
+          sudo ldconfig
+      - name: Build and related stuff
+        run: |
+          if [[ ${{ matrix.bits }} -eq 32 ]]; then export OPTFLAGS="-O2 -flto -mtune=pentium4"; else export OPTFLAGS="-O2 -flto -mtune=core2"; fi
+          G_REV=$(git rev-parse --short HEAD)
+          echo "G_REV=${G_REV}" >> "${GITHUB_ENV}"
+          ORIG="$(pwd)"
+          if [[ "${{ matrix.cc }}" == "GCC" ]]; then
+            CC="gcc"
+            CXX="g++"
+          else
+            CC="clang"
+            CXX="clang++"
+          fi
+          if [[ ${{ matrix.bits }} -eq 32 ]]; then export PIC="1"; fi
+          ${CC} --version
+          echo ""
+          git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
+          mkdir tmp
+          for HLE in 0 1
+          do
+            echo ""
+            echo ":: ${{ matrix.cc }} ${{ matrix.platform }}${MSG} ::"
+            echo ""
+            make HLEVIDEO="${HLE}" -C projects/unix clean
+            echo ""
+            make CC="${CC}" CXX="${CXX}" BITS="${{ matrix.bits }}" HLEVIDEO="${HLE}" -C projects/unix all -j4
+            echo ""
+            make HLEVIDEO="${HLE}" -C projects/unix install DESTDIR="${ORIG}/tmp"
+            echo ""
+            cd tmp/usr/local/lib/mupen64plus
+            ls -gG mupen64plus-rsp-z64${LIB}.so
+            ldd mupen64plus-rsp-z64${LIB}.so
+            LIB="-hlevideo"
+            MSG=" / HLEVIDEO"
+            cd "${ORIG}"
+          done
+          mkdir pkg
+          if [[ "${CC}" == "gcc" ]]; then tar cvzf pkg/mupen64plus-rsp-z64-${{ matrix.platform }}-g${G_REV}.tar.gz -C tmp/ "usr"; fi
+      - name: Upload artifact
+        uses: actions/upload-artifact@v3
+        with:
+          name: mupen64plus-rsp-z64-${{ matrix.platform }}-g${{ env.G_REV }}
+          path: pkg/*
+          if-no-files-found: ignore
+
+  MSYS2:
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - cc: GCC
+            platform: x64
+            cross: x86_64
+            bits: 64
+          - cc: GCC
+            platform: x86
+            cross: i686
+            bits: 32
+    name: Windows / MSYS2 ${{ matrix.cc }} / ${{ matrix.platform }}
+    runs-on: windows-2019
+    defaults:
+      run:
+        shell: msys2 {0}
+    steps:
+      - uses: actions/checkout@v3
+      - uses: msys2/setup-msys2@v2
+        with:
+          msystem: MINGW${{ matrix.bits }}
+          update: true
+          install: >-
+            git
+            libtool
+            make
+            mingw-w64-${{ matrix.cross }}-gcc
+            mingw-w64-${{ matrix.cross }}-toolchain
+      - name: Build and related stuff
+        run: |
+          if [[ ${{ matrix.bits }} -eq 32 ]]; then export OPTFLAGS="-O2 -flto -mtune=pentium4"; else export OPTFLAGS="-O2 -flto -mtune=core2"; fi
+          echo "G_REV=$(git rev-parse --short HEAD)" >> "${GITHUB_ENV}"
+          ORIG="$(pwd)"
+          CC="gcc"
+          CXX="g++"
+          ${CC} --version
+          echo ""
+          git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
+          mkdir tmp
+          for HLE in 0 1
+          do
+            echo ""
+            echo ":: ${{ matrix.cc }} ${{ matrix.platform }}${MSG} ::"
+            echo ""
+            make HLEVIDEO="${HLE}" -C projects/unix clean
+            echo ""
+            make CC="${CC}" CXX="${CXX}" BITS="${{ matrix.bits }}" HLEVIDEO="${HLE}" -C projects/unix all -j4
+            echo ""
+            make HLEVIDEO="${HLE}" -C projects/unix install PLUGINDIR="" SHAREDIR="" BINDIR="" MANDIR="" LIBDIR="" APPSDIR="" ICONSDIR="icons" INCDIR="api" LDCONFIG="true" DESTDIR="${ORIG}/tmp"
+            echo ""
+            ls -gG tmp/mupen64plus-rsp-z64${LIB}.dll
+            ldd tmp/mupen64plus-rsp-z64${LIB}.dll
+            LIB="-hlevideo"
+            MSG=" / HLEVIDEO"
+          done
+      - name: Copy binaries, dependencies, etc...
+        run: |
+          mkdir pkg
+          if [[ ${{ matrix.bits }} -eq 32 ]]; then LIBGCC="libgcc_s_dw2-1"; else LIBGCC="libgcc_s_seh-1"; fi
+          for LIB in ${LIBGCC} libwinpthread-1
+          do
+            echo ":: Copying ${LIB}.dll"
+            cp "/mingw${{ matrix.bits }}/bin/${LIB}.dll" pkg/
+          done
+          cd tmp
+          for BIN in *.dll
+          do
+            echo ":: Copying ${BIN}"
+            cp "${BIN}" ../pkg/
+          done
+      - name: Upload artifact
+        uses: actions/upload-artifact@v3
+        with:
+          name: mupen64plus-rsp-z64-msys2-${{ matrix.platform }}-g${{ env.G_REV }}
+          path: pkg/*
+
+  Nightly-build:
+    runs-on: ubuntu-latest
+    needs: [Linux, MSYS2]
+    if: github.ref == 'refs/heads/master'
+    steps:
+      - uses: actions/checkout@v3
+      - name: Download artifacts
+        uses: actions/download-artifact@v3
+        with:
+          path: binaries
+      - name: Get some tools
+        run: |
+          sudo apt-get update
+          sudo apt-get -y install hashdeep
+      - name: Creating new artifacts and update nightly-build
+        run: |
+          mkdir pkg
+          cd binaries
+          for BIN in *
+          do
+            cd "${BIN}"
+            if [[ "${BIN:20:4}" == "msys" ]]; then
+              echo ":: Creating ${BIN}.zip"
+              zip -r "../../pkg/${BIN}.zip" *
+            else
+              echo ":: Recovering ${BIN}.tar.gz"
+              mv *.tar.gz ../../pkg/
+            fi
+            cd ..
+          done
+          cd ../pkg
+          echo ""
+          for BIN in *
+          do
+            ls -gG ${BIN}
+            tigerdeep -l ${BIN} >> ../${BIN:0:19}.tiger.txt
+            sha256sum ${BIN} >> ../${BIN:0:19}.sha256.txt
+            sha512sum ${BIN} >> ../${BIN:0:19}.sha512.txt
+          done
+          mv ../*.tiger.txt .
+          mv ../*.sha*.txt .
+          echo ""
+          echo "TIGER:"
+          cat *.tiger.txt
+          echo ""
+          echo "SHA256:"
+          cat *.sha256.txt
+          echo ""
+          echo "SHA512:"
+          cat *.sha512.txt
+          echo ""
+          git tag -f nightly-build
+          git push -f origin nightly-build
+      - name: Nightly-build
+        uses: ncipollo/release-action@v1
+        with:
+          prerelease: true
+          allowUpdates: true
+          removeArtifacts: true
+          replacesArtifacts: false
+          tag: nightly-build
+          artifacts: pkg/*
diff --git a/.travis.yml b/.travis.yml
index 2ed1bbf..8b717ef 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,13 +1,52 @@
+sudo: required
+dist: trusty
 language: cpp
 compiler:
   - gcc
   - clang
+addons:
+  apt:
+    packages:
+    - git
 before_install:
-  - sudo apt-get update -qq
-  - sudo apt-get install -y git
   - git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core
 env:
  - HLEVIDEO=0
  - HLEVIDEO=1
 script:
- - make -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean && CPPFLAGS="-D__extern_always_inline=inline" LDFLAGS="-Wl,--no-add-needed -Wl,--no-undefined" OPTFLAGS="-O2" make CC="${CC}" CXX="${CXX}" -j$(nproc) -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 all
+ - make -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean && LDFLAGS="-Wl,--no-add-needed -Wl,--no-undefined" OPTFLAGS="-O2" make CC="${CC}" CXX="${CXX}" -j$(nproc) -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 all
+
+# extra mxe build entries
+matrix:
+  include:
+    - env:
+      - MXE_CPU=i686
+      - PATH="/usr/lib/mxe/usr/bin/:$PATH"
+      addons:
+        apt:
+          sources:
+          - sourceline: 'deb http://pkg.mxe.cc/repos/apt/debian jessie main'
+            key_url: 'http://pkg.mxe.cc/repos/apt/conf/mxeapt.gpg'
+          packages:
+          - mxe-i686-w64-mingw32.shared-gcc
+      before_install:
+      - git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core
+      script:
+      - make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/"  V=1  clean && 
+        make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/"  V=1 -j$(nproc) all
+
+    - env:
+      - MXE_CPU=x86_64
+      - PATH="/usr/lib/mxe/usr/bin/:$PATH"
+      addons:
+        apt:
+          sources:
+          - sourceline: 'deb http://pkg.mxe.cc/repos/apt/debian jessie main'
+            key_url: 'http://pkg.mxe.cc/repos/apt/conf/mxeapt.gpg'
+          packages:
+          - mxe-x86-64-w64-mingw32.shared-gcc
+      before_install:
+       - git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core
+      script:
+      - make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/"  V=1  clean && 
+        make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/"  V=1 -j$(nproc) all
diff --git a/debian/changelog b/debian/changelog
index c65c3ad..1313874 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
-mupen64plus-rsp-z64 (2.0.0+12+g5a0a580-6) UNRELEASED; urgency=medium
+mupen64plus-rsp-z64 (2.5.9+git20220713.1.a7bf40f+ds-1) UNRELEASED; urgency=medium
 
+  [ Sven Eckelmann ]
   * debian/control:
     - Upgraded to policy 4.6.0, no changes required
     - Allow build without (fake)root
@@ -14,7 +15,10 @@ mupen64plus-rsp-z64 (2.0.0+12+g5a0a580-6) UNRELEASED; urgency=medium
     - Drop default flag --as-needed from linker flags
   * Remove overrides for unsupported no-upstream-changelog lintian tag
 
- -- Sven Eckelmann <sven@narfation.org>  Fri, 04 Oct 2019 13:23:02 +0200
+  [ Debian Janitor ]
+  * New upstream snapshot.
+
+ -- Sven Eckelmann <sven@narfation.org>  Wed, 07 Sep 2022 02:21:02 -0000
 
 mupen64plus-rsp-z64 (2.0.0+12+g5a0a580-5) unstable; urgency=medium
 
diff --git a/projects/unix/Makefile b/projects/unix/Makefile
index 62e2e43..734fb81 100755
--- a/projects/unix/Makefile
+++ b/projects/unix/Makefile
@@ -1,6 +1,6 @@
 #/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 # *   mupen64plus-rsp-z64 - Makefile                                        *
-# *   https://github.com/mupen64plus/mupen64plus-rsp-z64/                   *
+# *   Mupen64Plus homepage: https://mupen64plus.org/                        *
 # *   Copyright (C) 2010 Jon Ring                                           *
 # *   Copyright (C) 2008-2009 Richard Goedeken                              *
 # *   Copyright (C) 2007-2008 DarkJeztr Tillin9                             *
@@ -54,7 +54,6 @@ ifeq ("$(UNAME)","OpenBSD")
   OS = FREEBSD
   SO_EXTENSION = so
   SHARED = -shared
-  $(warning OS type "$(UNAME)" not officially supported.')
 endif
 ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
   OS = LINUX
@@ -68,7 +67,7 @@ ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW")
   PIC = 0
 endif
 ifeq ("$(OS)","NONE")
-  $(error OS type "$(UNAME)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
+  $(error OS type "$(UNAME)" not supported.  Please file bug report at 'https://github.com/mupen64plus/mupen64plus-core/issues')
 endif
 
 # detect system architecture
@@ -112,8 +111,14 @@ ifneq ("$(filter arm%,$(HOST_CPU))","")
     $(warning Architecture "$(HOST_CPU)" not officially supported.')
   endif
 endif
+ifneq ("$(filter aarch64 arm64,$(HOST_CPU))","")
+  CPU := AARCH64
+  ARCH_DETECTED := 64BITS
+  PIC ?= 1
+  $(warning Architecture "$(HOST_CPU)" not officially supported.')
+endif
 ifeq ("$(CPU)","NONE")
-  $(error CPU type "$(HOST_CPU)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
+  $(error CPU type "$(HOST_CPU)" not supported.  Please file bug report at 'https://github.com/mupen64plus/mupen64plus-core/issues')
 endif
 
 # base CFLAGS, LDLIBS, and LDFLAGS
@@ -145,8 +150,20 @@ ifeq ($(ARCH_DETECTED), 64BITS_32)
   ifeq ($(OS), FREEBSD)
     $(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
   endif
-  CFLAGS += -m32
-  LDFLAGS += -Wl,-m,elf_i386
+  ifneq ($(OS), OSX)
+    ifeq ($(OS), MINGW)
+      LDFLAGS += -Wl,-m,i386pe
+    else
+      CFLAGS += -m32
+      LDFLAGS += -Wl,-m,elf_i386
+    endif
+  endif
+endif
+
+ifeq ($(ARCH_DETECTED), 64BITS)
+  ifeq ($(OS), MINGW)
+    LDFLAGS += -Wl,-m,i386pep
+  endif
 endif
 
 # set special flags per-system
@@ -265,11 +282,11 @@ TARGET = mupen64plus-rsp-z64$(POSTFIX).$(SO_EXTENSION)
 targets:
 	@echo "Mupen64Plus-rsp-z64 makefile. "
 	@echo "  Targets:"
-	@echo "    all           == Build Mupen64Plus rsp-hle plugin"
+	@echo "    all           == Build Mupen64Plus rsp-z64 plugin"
 	@echo "    clean         == remove object files"
 	@echo "    rebuild       == clean and re-build all"
-	@echo "    install       == Install Mupen64Plus rsp-hle plugin"
-	@echo "    uninstall     == Uninstall Mupen64Plus rsp-hle plugin"
+	@echo "    install       == Install Mupen64Plus rsp-z64 plugin"
+	@echo "    uninstall     == Uninstall Mupen64Plus rsp-z64 plugin"
 	@echo "  Options:"
 	@echo "    BITS=32       == build 32-bit binaries on 64-bit machine"
 	@echo "    APIDIR=path   == path to find Mupen64Plus Core headers"
@@ -297,7 +314,7 @@ uninstall:
 	$(RM) "$(DESTDIR)$(PLUGINDIR)/$(TARGET)"
 
 clean:
-	$(RM) -r $(OBJDIR) $(TARGET)
+	$(RM) -r _obj _obj-hlevideo $(OBJDIR) mupen64plus-rsp-z64*.$(SO_EXTENSION) $(TARGET)
 
 rebuild: clean all
 
diff --git a/src/rsp.h b/src/rsp.h
index c89e25d..9ff08ee 100644
--- a/src/rsp.h
+++ b/src/rsp.h
@@ -34,7 +34,13 @@
 
 #define INLINE inline
 
-extern void log(m64p_msg_level level, const char *msg, ...);
+#if defined(__GNUC__)
+#define ATTR_FMT(fmtpos, attrpos) __attribute__ ((format (printf, fmtpos, attrpos)))
+#else
+#define ATTR_FMT(fmtpos, attrpos)
+#endif
+
+extern void log(m64p_msg_level level, const char *msg, ...) ATTR_FMT(2, 3);
 
 /* defined in systems/n64.c */
 #define rdram ((UINT32*)z64_rspinfo.RDRAM)
@@ -414,7 +420,10 @@ inline uint64_t RDTSC() {
 #undef GENTRACE
 #include <stdarg.h>
 
-inline void GENTRACE(const char * s, ...) {
+inline void GENTRACE(const char * s, ...) ATTR_FMT(1, 2);
+
+void GENTRACE(const char * s, ...)
+{
     va_list ap;
     va_start(ap, s);
     vfprintf(stderr, s, ap);
diff --git a/src/rsp_dasm.cpp b/src/rsp_dasm.cpp
index cdc2a2f..84c63e4 100644
--- a/src/rsp_dasm.cpp
+++ b/src/rsp_dasm.cpp
@@ -40,6 +40,12 @@
 #define DASMFLAG_LENGTHMASK        0x0000ffff      /* the low 16-bits contain the actual length */
 #define DASMFLAG_STEP_OVER_EXTRA(x) ((x) << DASMFLAG_OVERINSTSHIFT)
 
+#if defined(__GNUC__)
+#define ATTR_FMT(fmtpos, attrpos) __attribute__ ((format (printf, fmtpos, attrpos)))
+#else
+#define ATTR_FMT(fmtpos, attrpos)
+#endif
+
 static const char *reg[32] =
 {
         "0",    "r1",   "r2",   "r3",   "r4",   "r5",   "r6",   "r7",
@@ -100,7 +106,9 @@ INLINE char *signed_imm16(UINT32 op)
 
 static char *output;
 
-static void print(const char *fmt, ...)
+static void print(const char *fmt, ...) ATTR_FMT(1, 2);
+
+void print(const char *fmt, ...)
 {
         va_list vl;