From b3a00d0368c8c02e94a82dce9a658743aed4b15a Mon Sep 17 00:00:00 2001
From: Joel Linn <jl@conductive.de>
Date: Sat, 16 Jul 2022 01:57:12 +0200
Subject: [PATCH 1/7] [CI] Update image to 2022-07-15

---
 .drone.star | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.drone.star b/.drone.star
index 194adc533..cc9740a3b 100644
--- a/.drone.star
+++ b/.drone.star
@@ -8,7 +8,7 @@ def main(ctx):
     ]
 
 def image_linux_x86_64():
-    return 'xeniaproject/buildenv:2022-01-01'
+    return 'xeniaproject/buildenv:2022-07-15'
 
 def volume_build(toolchain, path='/drone/src/build'):
     return {

From 92db8f65b7dd5decab26e297713d574d2ca253be Mon Sep 17 00:00:00 2001
From: Joel Linn <jl@conductive.de>
Date: Sat, 16 Jul 2022 01:57:25 +0200
Subject: [PATCH 2/7] [CI] Use ninja for cmake builds

---
 .drone.star | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/.drone.star b/.drone.star
index cc9740a3b..50dab8429 100644
--- a/.drone.star
+++ b/.drone.star
@@ -160,9 +160,7 @@ def pipeline_linux_desktop(name, image, arch, cc, build_release_all):
                     for c in Debug Release
                     do
                       mkdir cmake-$c
-                      cd cmake-$c
-                      cmake -DCMAKE_BUILD_TYPE=$c ..
-                      cd ..
+                      cmake -S . -B cmake-$c -G Ninja -DCMAKE_BUILD_TYPE=$c
                     done
                     '''.format(cc),
                 ],

From 846fedfa47cf9e3f21ba1718ab806f04734cb803 Mon Sep 17 00:00:00 2001
From: Joel Linn <jl@conductive.de>
Date: Sat, 16 Jul 2022 11:09:16 +0200
Subject: [PATCH 3/7] [xenia-build] Report premake errors via exit code

---
 xenia-build | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xenia-build b/xenia-build
index 543114686..a2695b871 100755
--- a/xenia-build
+++ b/xenia-build
@@ -673,11 +673,11 @@ class SetupCommand(Command):
         print('')
 
         print('- running premake...')
-        if run_platform_premake(target_os_override=args['target_os']) == 0:
-            print('')
-            print('Success!')
+        ret = run_platform_premake(target_os_override=args['target_os'])
+        print('')
+        print('Success!' if ret == 0 else 'Error!')
 
-        return 0
+        return ret
 
 
 class PullCommand(Command):
@@ -755,11 +755,11 @@ class PremakeCommand(Command):
         # Update premake. If no binary found, it will be built from source.
         print('Running premake...')
         print('')
-        if run_platform_premake(target_os_override=args['target_os'],
-                                cc=args['cc'], devenv=args['devenv']) == 0:
-            print('Success!')
+        ret = run_platform_premake(target_os_override=args['target_os'],
+                                   cc=args['cc'], devenv=args['devenv'])
+        print('Success!' if ret == 0 else 'Error!')
 
-        return 0
+        return ret
 
 
 class BaseBuildCommand(Command):

From f4f131aab906957f9cc94ad98bc6622de24c4cd7 Mon Sep 17 00:00:00 2001
From: Joel Linn <jl@conductive.de>
Date: Sun, 17 Jul 2022 16:14:46 +0200
Subject: [PATCH 4/7] [CI] Exclude "Wait on Timer" and "Wait on Multiple
 Timers" tests from drone

---
 .drone.star | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/.drone.star b/.drone.star
index 50dab8429..8a9b49e29 100644
--- a/.drone.star
+++ b/.drone.star
@@ -74,6 +74,10 @@ def targets_android(platform):
         ])
     return targets
 
+def xenia_base_tests_filters():
+    # https://github.com/xenia-project/xenia/issues/2036
+    return 'exclude:"Wait on Timer" exclude:"Wait on Multiple Timers"'
+
 # Run lint in a separate pipeline so that it will try building even if lint fails
 def pipeline_lint():
     return {
@@ -263,7 +267,7 @@ def pipeline_linux_desktop(name, image, arch, cc, build_release_all):
                 'image': image,
                 'volumes': [volume_build('premake')],
                 'commands': [
-                    'valgrind --error-exitcode=99 ./build/bin/Linux/Debug/xenia-base-tests --durations yes',
+                    'valgrind --error-exitcode=99 ./build/bin/Linux/Debug/xenia-base-tests --durations yes ' + xenia_base_tests_filters(),
                 ],
                 'depends_on': ['build-premake-debug-tests'],
             },
@@ -273,7 +277,7 @@ def pipeline_linux_desktop(name, image, arch, cc, build_release_all):
                 'image': image,
                 'volumes': [volume_build('premake')],
                 'commands': [
-                    './build/bin/Linux/Release/xenia-base-tests --success --durations yes',
+                    './build/bin/Linux/Release/xenia-base-tests --success --durations yes ' + xenia_base_tests_filters(),
                 ],
                 'depends_on': ['build-premake-release-tests'],
             },
@@ -283,7 +287,7 @@ def pipeline_linux_desktop(name, image, arch, cc, build_release_all):
                 'image': image,
                 'volumes': [volume_build('cmake')],
                 'commands': [
-                    './build/bin/Linux/Release/xenia-base-tests --success --durations yes',
+                    './build/bin/Linux/Release/xenia-base-tests --success --durations yes ' + xenia_base_tests_filters(),
                 ],
                 'depends_on': ['build-cmake-release-tests'],
             },

From 5bfa3bf56e6dcdcac56f5d5a805c6507a9ae0f4b Mon Sep 17 00:00:00 2001
From: Joel Linn <jl@conductive.de>
Date: Sun, 17 Jul 2022 16:16:01 +0200
Subject: [PATCH 5/7] [CI] Build all android targets

---
 .drone.star | 55 ++---------------------------------------------------
 1 file changed, 2 insertions(+), 53 deletions(-)

diff --git a/.drone.star b/.drone.star
index 8a9b49e29..2111be666 100644
--- a/.drone.star
+++ b/.drone.star
@@ -23,57 +23,6 @@ def command_cc(cc):
 def command_ndk_build(platform, configuration, target):
     return '$ANDROID_NDK_ROOT/build/ndk-build NDK_PROJECT_PATH:=./bin/{configuration} NDK_APPLICATION_MK:=./xenia.Application.mk PREMAKE_ANDROIDNDK_PLATFORMS:={platform} PREMAKE_ANDROIDNDK_CONFIGURATIONS:={configuration} -j$(nproc) {target}'.format(platform=platform, configuration=configuration, target=target)
 
-def targets_android(platform):
-    targets = [
-        'aes_128',
-        'capstone',
-        'dxbc',
-        'discord-rpc',
-        'cxxopts',
-        'cpptoml',
-        'avcodec',
-        'avutil',
-        'fmt',
-        'glslang-spirv',
-        'imgui',
-        'mspack',
-        'snappy',
-        'xxhash',
-        'xenia-app',
-        # 'xenia-app-discord',
-        'xenia-apu',
-        'xenia-apu-nop',
-        'xenia-base',
-        'xenia-base-tests',
-        'xenia-core',
-        'xenia-cpu',
-        'xenia-cpu-tests',
-        'xenia-cpu-ppc-tests',
-        # 'xenia-cpu-backend-x64',
-        # 'xenia-debug-ui',
-        'xenia-gpu',
-        'xenia-gpu-shader-compiler',
-        'xenia-gpu-null',
-        'xenia-gpu-vulkan',
-        'xenia-gpu-vulkan-trace-viewer',
-        'xenia-gpu-vulkan-trace-dump',
-        'xenia-hid',
-        'xenia-hid-demo',
-        'xenia-hid-nop',
-        'xenia-kernel',
-        'xenia-ui',
-        'xenia-ui-vulkan',
-        'xenia-ui-window-vulkan-demo',
-        'xenia-vfs',
-        'xenia-vfs-dump',
-    ]
-    if platform == 'Android-x86_64':
-        targets.extend([
-            'xenia-cpu-backend-x64',
-            'xenia-debug-ui',
-        ])
-    return targets
-
 def xenia_base_tests_filters():
     # https://github.com/xenia-project/xenia/issues/2036
     return 'exclude:"Wait on Timer" exclude:"Wait on Multiple Timers"'
@@ -391,7 +340,7 @@ def pipeline_android(name, image, arch, platform):
                 'image': image,
                 'commands': [
                     'cd build',
-                    command_ndk_build(platform, 'Debug', ' '.join(targets_android(platform))),
+                    command_ndk_build(platform, 'Debug', 'all'),
                 ],
                 'depends_on': ['toolchain'],
             },
@@ -401,7 +350,7 @@ def pipeline_android(name, image, arch, platform):
                 'image': image,
                 'commands': [
                     'cd build',
-                    command_ndk_build(platform, 'Release', ' '.join(targets_android(platform))),
+                    command_ndk_build(platform, 'Release', 'all'),
                 ],
                 'depends_on': ['toolchain'],
             },

From a41770acc59e6f9955d6b81e14054f4cb5c0506e Mon Sep 17 00:00:00 2001
From: Joel Linn <jl@conductive.de>
Date: Sun, 17 Jul 2022 18:54:21 +0200
Subject: [PATCH 6/7] [xenia-build] Check for clang-format 14

---
 xenia-build | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xenia-build b/xenia-build
index a2695b871..6bb3cb8b0 100755
--- a/xenia-build
+++ b/xenia-build
@@ -431,6 +431,7 @@ def get_clang_format_binary():
     attempts = [
         'C:\\Program Files\\LLVM\\bin\\clang-format.exe',
         'C:\\Program Files (x86)\\LLVM\\bin\\clang-format.exe',
+        'clang-format-14',
         'clang-format-13',
         'clang-format',
         ]

From 0a94b86cb8a784db15f34f091b85f50d8f79fdd7 Mon Sep 17 00:00:00 2001
From: Triang3l <triang3l@yandex.ru>
Date: Mon, 18 Jul 2022 21:02:07 +0300
Subject: [PATCH 7/7] [GPU] Remove orphaned GetPresentArea declaration [ci
 skip]

---
 src/xenia/gpu/draw_util.h | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/src/xenia/gpu/draw_util.h b/src/xenia/gpu/draw_util.h
index a022b05a6..a365b5436 100644
--- a/src/xenia/gpu/draw_util.h
+++ b/src/xenia/gpu/draw_util.h
@@ -603,14 +603,6 @@ bool GetResolveInfo(const RegisterFile& regs, const Memory& memory,
                     bool fixed_rgba16_truncated_to_minus_1_to_1,
                     ResolveInfo& info_out);
 
-// Taking user configuration - stretching or letterboxing, overscan region to
-// crop to fill while maintaining the aspect ratio - into account, returns the
-// area where the frame should be presented in the host window.
-void GetPresentArea(uint32_t source_width, uint32_t source_height,
-                    uint32_t window_width, uint32_t window_height,
-                    int32_t& target_x_out, int32_t& target_y_out,
-                    uint32_t& target_width_out, uint32_t& target_height_out);
-
 }  // namespace draw_util
 }  // namespace gpu
 }  // namespace xe