From c9a8ae237e6fe1a625031c46209c8b81a7a3fecb Mon Sep 17 00:00:00 2001
From: XargonWan <XargonWan@gmail.com>
Date: Sat, 18 Feb 2023 10:19:10 +0000
Subject: [PATCH] Updated all the standalone emulators (except Duckstation)

---
 net.retrodeck.retrodeck.yml                   | 131 ++++++++++--------
 .../citra/unified-source-compat.patch         |  56 ++++++++
 2 files changed, 132 insertions(+), 55 deletions(-)
 create mode 100644 rd-submodules/citra/unified-source-compat.patch

diff --git a/net.retrodeck.retrodeck.yml b/net.retrodeck.retrodeck.yml
index d331c04c..e4482908 100644
--- a/net.retrodeck.retrodeck.yml
+++ b/net.retrodeck.retrodeck.yml
@@ -405,7 +405,7 @@ modules:
       - mv ./RetroArch-Linux-x86_64.AppImage.home/.config/retroarch/cores/* /app/share/libretro/cores/
     sources:
       - type: archive
-        url: https://buildbot.libretro.com/stable/1.12.0/linux/x86_64/RetroArch_cores.7z
+        url: https://buildbot.libretro.com/stable/1.14.0/linux/x86_64/RetroArch_cores.7z
         sha256: b5c87aa3462c023fa4e1aa171d1bd4f5b0b5cf9d8e4f0a6b5606ff26b05e0059
 
   # PPSSPP - START
@@ -424,16 +424,21 @@ modules:
 
       - -DBUILD_TESTING=OFF
       - -DOpenGL_GL_PREFERENCE=GLVND
-    #build-options:
-      #- -DX86_64=ON
-
+    build-options:
+      arch:
+        aarch64:
+          config-opts:
+            - -DUSING_EGL=ON
+            - -DUSING_GLES2=ON
+    post-install:
+      - install -Dm644 icons/icon-512.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/ppsspp.svg
     cleanup:
       - /share/ppsspp/assets/lang/README.md
     sources:
       - type: git
         url: &ppsspp-url https://github.com/hrydgard/ppsspp.git
-        tag: &ppsspp-tag v1.13.2
-        commit: &ppsspp-commit 9fe6338e3bf397f8a009a51a282c139dfa180eb6
+        tag: v1.14.4
+        commit: cd535263c1ad65fd03869591a8bd706680cbf04b
         x-checker-data:
           type: git
           tag-pattern: ^v([\d.]+)$
@@ -470,8 +475,8 @@ modules:
       - ln -s "${FLATPAK_DEST}/yuzu/usr/bin/yuzu" "${FLATPAK_DEST}/bin/yuzu"
     sources:
       - type: file
-        url: https://github.com/yuzu-emu/yuzu-mainline/releases/download/mainline-0-1301/yuzu-mainline-20230109-8c9f71e76.AppImage
-        sha256: 8dc52ddc8547b92d08cf450ce32c2f400049b7df98475a42be5012660c76743d
+        url: https://github.com/yuzu-emu/yuzu-mainline/releases/download/mainline-0-1343/yuzu-mainline-20230217-b795f3bc1.AppImage
+        sha256: 47eb1ec3e4d7368d0eef832a7b9c378fd6a0fbaebfd7af7768d6edaf8b35f8a5
 
   # Yuzu - END
 
@@ -482,14 +487,18 @@ modules:
     buildsystem: cmake-ninja
     builddir: true
     config-opts:
-      - -DCMAKE_BUILD_TYPE=Release
-      - -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
-      - -DENABLE_QT_TRANSLATION=ON
-      - -DCITRA_ENABLE_COMPATIBILITY_REPORTING=ON
-      - -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON
-      #- '-DENABLE_FFMPEG_VIDEO_DUMPER=ON'
-      # Disabled because of this: https://github.com/citra-emu/citra/issues/5949
-      - -DENABLE_FDK=ON
+      - '-DCMAKE_BUILD_TYPE=Release'
+      - '-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON'
+      - '-DENABLE_LTO=ON'
+      - '-DENABLE_QT_TRANSLATION=ON'
+      - '-DCITRA_ENABLE_COMPATIBILITY_REPORTING=ON'
+      - '-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF'
+      - '-DENABLE_FFMPEG_VIDEO_DUMPER=ON'
+      # FFMPEG VIDEO DUMPER was disabled because of this: https://github.com/citra-emu/citra/issues/5949
+      # Now is enabled again, remove this comment in the next versions
+      - '-DUSE_SYSTEM_SDL2=ON'
+      - '-DCMAKE_POLICY_DEFAULT_CMP0069=NEW'
+      - '-DENABLE_FDK=ON'
     cleanup:
       - /share/man
       - /share/pixmaps
@@ -497,14 +506,20 @@ modules:
       - install -Dm644 ../dist/citra.svg /app/share/icons/hicolor/scalable/apps/citra.svg
       - install -Dm644 ../dist/icon.png /app/share/icons/hicolor/512x512/apps/citra.png
     sources:
-      - type: git
-        url: https://github.com/citra-emu/citra-nightly.git
-        tag: nightly-1785
-        commit: baecc18d8c5365af0dddb231bc8c0a9c03850bf6
-        disable-shallow-clone: true
+      - type: archive
+        url: >-
+          https://github.com/citra-emu/citra-nightly/releases/download/nightly-1844/citra-unified-source-20230217-cda3584.tar.xz
+        sha256: 9e0c5fcf503f5d0dbe95cc6de68c4b3c9148c07e2df892b85cc99ada8963c14e
         x-checker-data:
-          type: git
-          tag-pattern: ^(nightly-\d+)$
+          type: json
+          url: https://api.github.com/repos/citra-emu/citra-nightly/releases/latest
+          version-query: .tag_name
+          url-query: >-
+            .assets[] | .browser_download_url |
+            match("https://.+citra-unified-source-.+.xz$") | .string
+          is-main-source: true
+      - type: patch
+        path: rd-submodules/citra/unified-source-compat.patch
 
   # CITRA - END
 
@@ -523,16 +538,11 @@ modules:
       - ln -s "${FLATPAK_DEST}/pcsx2-qt/usr/bin/pcsx2-qt" "${FLATPAK_DEST}/bin/pcsx2-qt"
     sources:
       - type: file
-        url: https://github.com/PCSX2/pcsx2/releases/download/v1.7.3501/pcsx2-v1.7.3501-linux-AppImage-64bit-AVX2-Qt.AppImage
-        sha256: 104e8dae653aeb1fa7c75a4cc0fd07038715e75c1f7d40d111428ae83279356c
+        url: https://github.com/PCSX2/pcsx2/releases/download/v1.7.4108/pcsx2-v1.7.4108-linux-AppImage-64bit-Qt.AppImage
+        sha256: 31dab12f7f7d0c4a7122011c0f86f5acfe9a9018cece66b4333d230154c8b910
 
   # PCSX2 - END
 
-  - name: debug
-    buildsystem: simple
-    build-commands:
-      - whoami
-
   # Dolphin - START
   # https://github.com/flathub/org.DolphinEmu.dolphin-emu
   # WHEN UPADTING: remember to update rd-submodules/dolphin contents
@@ -551,12 +561,15 @@ modules:
       - --disable-a2dp
       - --disable-avrcp
       - --disable-network
+      - --disable-obex
+      - --disable-bap 
+      - --disable-mcp
       - --with-dbusconfdir=/app/etc
       - --with-dbussessionbusdir=/app/usr/lib/system-services
     sources:
       - type: archive
-        url: https://www.kernel.org/pub/linux/bluetooth/bluez-5.65.tar.xz
-        sha256: 2565a4d48354b576e6ad92e25b54ed66808296581c8abb80587051f9993d96d4
+        url: https://www.kernel.org/pub/linux/bluetooth/bluez-5.66.tar.xz
+        sha256: 39fea64b590c9492984a0c27a89fc203e1cdc74866086efb8f4698677ab2b574
         x-checker-data:
           type: anitya
           project-id: 10029
@@ -603,9 +616,9 @@ modules:
       - sed -i -e 's/"2048"/"512"/g' /app/share/icons/hicolor/scalable/apps/dolphin-emu.svg
     sources:
       - type: git
-        url: ssh://git@github.com/dolphin-emu/dolphin.git
-        #url: https://github.com/dolphin-emu/dolphin.git
-        commit: 8bad821019721b9b72701b495da95656ace5fea5
+        #url: ssh://git@github.com/dolphin-emu/dolphin.git
+        url: https://github.com/dolphin-emu/dolphin.git
+        commit: 46b99671d9158e0ca840c1d8ef249db0f321ced7
         x-checker-data:
           type: json
           url: https://dolphin-emu.org/update/latest/beta
@@ -667,8 +680,8 @@ modules:
       - /share
     sources:
       - type: archive
-        url: https://www.tcpdump.org/release/libpcap-1.10.1.tar.gz
-        sha256: ed285f4accaf05344f90975757b3dbfe772ba41d1c401c2648b7fa45b711bdd4
+        url: https://www.tcpdump.org/release/libpcap-1.10.3.tar.gz
+        sha256: 2a8885c403516cf7b0933ed4b14d6caa30e02052489ebd414dc75ac52e7559e6
         x-checker-data:
           type: anitya
           project-id: 1702
@@ -699,20 +712,20 @@ modules:
     post-install:
       - |-
         for px in 16 32 48 64 128 256 512; do
-          install -Dm644 ../ui/icons/xemu_${px}x${px}.png /app/share/icons/hicolor/${px}x${px}/apps/app.xemu.xemu.png
+          install -Dm644 ../ui/icons/xemu_${px}x${px}.png $FLATPAK_DEST/share/icons/hicolor/${px}x${px}/apps/app.xemu.xemu.png
         done
-      - install -Dm644 ../ui/icons/xemu.svg /app/share/icons/hicolor/scalable/apps/app.xemu.xemu.svg
-      - mv qemu-system-i386 /app/bin/xemu
-      - mkdir -p /app/share/licenses/xemu
-      - cd .. && python3 scripts/gen-license.py > /app/share/licenses/xemu/LICENSE.txt
+      - install -Dm644 ../ui/icons/xemu.svg $FLATPAK_DEST/share/icons/hicolor/scalable/apps/app.xemu.xemu.svg
+      - mv qemu-system-i386 $FLATPAK_DEST/bin/xemu
+      - mkdir -p $FLATPAK_DEST/share/licenses/xemu
+      - cd .. && python3 scripts/gen-license.py > $FLATPAK_DEST/share/licenses/xemu/LICENSE.txt
     sources:
       - type: git
-        url: https://github.com/mborgerson/xemu.git
-        tag: v0.7.71
-        commit: 22db3304a454b2d289a9d5ea488fa3c3dec836f4
+        url: https://github.com/xemu-project/xemu.git
+        tag: v0.7.84
+        commit: d8fa50e524c22f85ecb2e43108fd6a5501744351
         x-checker-data:
           type: json
-          url: https://api.github.com/repos/mborgerson/xemu/releases/latest
+          url: https://api.github.com/repos/xemu-project/xemu/releases/latest
           tag-query: .tag_name
           timestamp-query: .published_at
           version-query: .tag_name
@@ -728,7 +741,7 @@ modules:
     sources:
       - type: git
         url: https://gitlab.freedesktop.org/slirp/libslirp.git
-        tag: v4.4.0
+        tag: v4.7.0
   - name: melonds
     buildsystem: cmake-ninja
     builddir: true
@@ -736,11 +749,13 @@ modules:
       arch:
         aarch64:
           config-opts:
-            - -DENABLE_OGLRENDERER=OFF
+            - -DENABLE_LTO_RELEASE=OFF
     sources:
       - type: git
-        url: https://github.com/Arisotura/melonDS.git
-        commit: cce9de5ee1f51e906a644922b2ada6644d81287a
+        url: https://github.com/melonDS-emu/melonDS.git
+        commit: 430de6b2702bb93faa8c2004aff3fbd084db4a1e
+      - type: file
+        path: net.kuribo64.melonDS.appdata.xml
 
   # MELONDS - END
 
@@ -781,20 +796,26 @@ modules:
       - -DITTAPI_SOURCE_DIR=/run/build/rpcs3/ittapi
       - -Wno-dev
     post-install:
-      - |
-        set -eux;
-        COMM_TAG="$(awk -F'[\{,]' '/version{.*}/{printf "%d.%d.%d", $2, $3, $4}' ../rpcs3/rpcs3_version.cpp)";
+      - |-
+        set -eux
+
+        COMM_TAG="$(awk -F'[\{,]' '/version{.*}/{printf "%d.%d.%d", $2, $3, $4}' ../rpcs3/rpcs3_version.cpp)"
         COMM_COUNT="$(git rev-list --count HEAD)";
         COMM_HASH="$(git rev-parse --short=8 HEAD)";
     sources:
       - type: git
         url: https://github.com/RPCS3/rpcs3.git
-        commit: 8d5a9dc722de8e8e881adf8c7f16e76226a1dad8
+        commit: 6b556a5206fa68e4801fca124bfc3874440e4e17
       - type: git
         url: https://github.com/intel/ittapi.git
-        commit: 2428ed97aa977c66b30940081e7d3e9b1a3c7402
+        commit: 2de8a23f6130036dcd4d1b78d05df3187951d298
         dest: ittapi/ittapi
         disable-shallow-clone: true
+      # remove git-lfs hook
+      - type: inline
+        dest: ittapi/ittapi/.git/hooks
+        dest-filename: post-checkout
+        contents:
 
   # RPCS3 - END
 
diff --git a/rd-submodules/citra/unified-source-compat.patch b/rd-submodules/citra/unified-source-compat.patch
new file mode 100644
index 00000000..6a1ca47c
--- /dev/null
+++ b/rd-submodules/citra/unified-source-compat.patch
@@ -0,0 +1,56 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 710f3fcfb..e5f4f4687 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -94,7 +94,11 @@ function(check_submodules_present)
+         endif()
+     endforeach()
+ endfunction()
+-check_submodules_present()
++
++if (EXISTS "${PROJECT_SOURCE_DIR}/.git/objects")
++    # only check submodules when source is obtained via Git
++    check_submodules_present()
++endif()
+ 
+ configure_file(${PROJECT_SOURCE_DIR}/dist/compatibility_list/compatibility_list.qrc
+                ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.qrc
+diff --git a/CMakeModules/GenerateSCMRev.cmake b/CMakeModules/GenerateSCMRev.cmake
+index a011c6cbf..87e9eef35 100644
+--- a/CMakeModules/GenerateSCMRev.cmake
++++ b/CMakeModules/GenerateSCMRev.cmake
+@@ -6,15 +6,27 @@ endfunction()
+ 
+ list(APPEND CMAKE_MODULE_PATH "${SRC_DIR}/externals/cmake-modules")
+ 
+-# Find the package here with the known path so that the GetGit commands can find it as well
+-find_package(Git QUIET PATHS "${GIT_EXECUTABLE}")
+-
+ # generate git/build information
+-include(GetGitRevisionDescription)
+-get_git_head_revision(GIT_REF_SPEC GIT_REV)
+-git_describe(GIT_DESC --always --long --dirty)
+-git_branch_name(GIT_BRANCH)
+ get_timestamp(BUILD_DATE)
++if (EXISTS "${SRC_DIR}/.git/objects")
++    # Find the package here with the known path so that the GetGit commands can find it as well
++    find_package(Git QUIET PATHS "${GIT_EXECUTABLE}")
++    # only use Git to check revision info when source is obtained via Git
++    include(GetGitRevisionDescription)
++    get_git_head_revision(GIT_REF_SPEC GIT_REV)
++    git_describe(GIT_DESC --always --long --dirty)
++    git_branch_name(GIT_BRANCH)
++elseif(EXISTS "${SRC_DIR}/GIT-COMMIT" AND EXISTS "${SRC_DIR}/GIT-TAG")
++    # unified source archive
++    file(READ "${SRC_DIR}/GIT-COMMIT" GIT_REV_RAW LIMIT 64)
++    string(STRIP "${GIT_REV_RAW}" GIT_REV)
++    string(SUBSTRING "${GIT_REV_RAW}" 0 9 GIT_DESC)
++    set(GIT_BRANCH "HEAD")
++else()
++    # self-packed archive?
++    set(GIT_DESC "UNKNOWN")
++    set(GIT_BRANCH "UNKNOWN")
++endif()
+ 
+ # Generate cpp with Git revision from template
+ # Also if this is a CI build, add the build name (ie: Nightly, Canary) to the scm_rev file as well
\ No newline at end of file