From 4944bdee46f8f6c0672448c628e3f492aa77238f Mon Sep 17 00:00:00 2001 From: Antonio Guastella Date: Thu, 5 Feb 2026 11:35:54 +0100 Subject: [PATCH 1/2] Improve GCC/Clang portability and header cleaniness --- ps2xAnalyzer/include/ps2recomp/elf_analyzer.h | 3 ++- ps2xRecomp/CMakeLists.txt | 7 ------- ps2xRecomp/include/ps2recomp/code_generator.h | 1 + ps2xRecomp/include/ps2recomp/elf_parser.h | 3 ++- ps2xRecomp/include/ps2recomp/ps2_recompiler.h | 1 + ps2xRuntime/CMakeLists.txt | 4 ++++ ps2xRuntime/include/ps2_syscalls.h | 4 +--- ps2xRuntime/src/lib/ps2_syscalls.cpp | 5 +++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ps2xAnalyzer/include/ps2recomp/elf_analyzer.h b/ps2xAnalyzer/include/ps2recomp/elf_analyzer.h index dba6896..6f1ec0c 100644 --- a/ps2xAnalyzer/include/ps2recomp/elf_analyzer.h +++ b/ps2xAnalyzer/include/ps2recomp/elf_analyzer.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -89,4 +90,4 @@ namespace ps2recomp }; } -#endif // PS2RECOMP_ELF_ANALYZER_H \ No newline at end of file +#endif // PS2RECOMP_ELF_ANALYZER_H diff --git a/ps2xRecomp/CMakeLists.txt b/ps2xRecomp/CMakeLists.txt index cae5ca8..b9e6864 100644 --- a/ps2xRecomp/CMakeLists.txt +++ b/ps2xRecomp/CMakeLists.txt @@ -38,13 +38,6 @@ FetchContent_Declare( GIT_SHALLOW TRUE ) -FetchContent_Declare( - libdwarf - GIT_REPOSITORY https://github.com/davea42/libdwarf-code.git - GIT_TAG v2.2.0 - GIT_SHALLOW TRUE -) - set(BUILD_DWARFDUMP OFF CACHE BOOL "" FORCE) set(BUILD_DWARFEXAMPLE OFF CACHE BOOL "" FORCE) set(BUILD_DWARFGEN OFF CACHE BOOL "" FORCE) diff --git a/ps2xRecomp/include/ps2recomp/code_generator.h b/ps2xRecomp/include/ps2recomp/code_generator.h index 540f551..b0a6386 100644 --- a/ps2xRecomp/include/ps2recomp/code_generator.h +++ b/ps2xRecomp/include/ps2recomp/code_generator.h @@ -6,6 +6,7 @@ #include #include #include +#include namespace ps2recomp { diff --git a/ps2xRecomp/include/ps2recomp/elf_parser.h b/ps2xRecomp/include/ps2recomp/elf_parser.h index e1abdfa..9d06f72 100644 --- a/ps2xRecomp/include/ps2recomp/elf_parser.h +++ b/ps2xRecomp/include/ps2recomp/elf_parser.h @@ -2,6 +2,7 @@ #define PS2RECOMP_ELF_PARSER_H #include +#include #include #include #include @@ -55,4 +56,4 @@ namespace ps2recomp } // namespace ps2recomp -#endif // PS2RECOMP_ELF_PARSER_H \ No newline at end of file +#endif // PS2RECOMP_ELF_PARSER_H diff --git a/ps2xRecomp/include/ps2recomp/ps2_recompiler.h b/ps2xRecomp/include/ps2recomp/ps2_recompiler.h index 74e28d9..1f156bc 100644 --- a/ps2xRecomp/include/ps2recomp/ps2_recompiler.h +++ b/ps2xRecomp/include/ps2recomp/ps2_recompiler.h @@ -3,6 +3,7 @@ #include "code_generator.h" #include "config_manager.h" +#include #include #include #include diff --git a/ps2xRuntime/CMakeLists.txt b/ps2xRuntime/CMakeLists.txt index d2f4412..0c21d8a 100644 --- a/ps2xRuntime/CMakeLists.txt +++ b/ps2xRuntime/CMakeLists.txt @@ -41,6 +41,10 @@ target_include_directories(ps2_runtime PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ) +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") + target_compile_options(ps2_runtime PUBLIC -msse4.1) +endif() + target_link_libraries(ps2_runtime PRIVATE raylib) target_link_libraries(ps2EntryRunner PRIVATE diff --git a/ps2xRuntime/include/ps2_syscalls.h b/ps2xRuntime/include/ps2_syscalls.h index 97a4457..f362fe9 100644 --- a/ps2xRuntime/include/ps2_syscalls.h +++ b/ps2xRuntime/include/ps2_syscalls.h @@ -3,14 +3,12 @@ #include "ps2_runtime.h" #include "ps2_call_list.h" -#include #include +#include // Number of active host threads spawned for PS2 thread emulation extern std::atomic g_activeThreads; -static std::mutex g_sys_fd_mutex; - #define PS2_FIO_O_RDONLY 0x0001 #define PS2_FIO_O_WRONLY 0x0002 #define PS2_FIO_O_RDWR 0x0003 diff --git a/ps2xRuntime/src/lib/ps2_syscalls.cpp b/ps2xRuntime/src/lib/ps2_syscalls.cpp index 1d4a7a1..c1369c1 100644 --- a/ps2xRuntime/src/lib/ps2_syscalls.cpp +++ b/ps2xRuntime/src/lib/ps2_syscalls.cpp @@ -2,6 +2,7 @@ #include "ps2_runtime.h" #include "ps2_runtime_macros.h" #include "ps2_stubs.h" +#include #include #include #include @@ -9,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -22,6 +24,7 @@ std::unordered_map g_fileDescriptors; int g_nextFd = 3; // Start after stdin, stdout, stderr +static std::mutex g_sys_fd_mutex; struct ThreadInfo { @@ -130,8 +133,6 @@ std::string translatePs2Path(const char *ps2Path) return ""; } -#include "ps2_syscalls.h" - namespace ps2_syscalls { From fe718baa757637257455c9e3793d830d202c8e4f Mon Sep 17 00:00:00 2001 From: Antonio Guastella Date: Fri, 6 Feb 2026 11:56:17 +0100 Subject: [PATCH 2/2] ci: add Linux GCC/Clang build workflow Added GitHub Actions job with GCC/Clang matrix to build the project on Linux. The job installs build tools and X11 deps required by raylib, then configures with CMake + Ninja and builds in Release. This helps avoiding Linux portability regressions and aligns with the projects GCC/Clang support. Also, extended .gitignore to cover common CMake/Ninja build directories for simplicity. Tests: local Release builds with GCC and Clang (Ninja). No runtime tests yet --- .github/workflows/build.yml | 46 +++++++++++++++++++++++++++++++++++++ .gitignore | 12 +++++++++- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 065d2f7..b4536e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,3 +44,49 @@ jobs: build/ps2xAnalyzer/Release/*.exe build/ps2xRecomp/Release/*.exe build/ps2xTest/Release/*.exe + + linux-gcc-clang: + strategy: + fail-fast: false + matrix: + include: + - compiler: gcc + cc: gcc + cxx: g++ + - compiler: clang + cc: clang + cxx: clang++ + + name: linux-${{ matrix.compiler }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + submodules: recursive + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + build-essential \ + cmake \ + ninja-build \ + clang \ + pkg-config \ + libx11-dev \ + libxrandr-dev \ + libxinerama-dev \ + libxcursor-dev \ + libxi-dev \ + libgl1-mesa-dev + + - name: Configure + env: + CC: ${{ matrix.cc }} + CXX: ${{ matrix.cxx }} + run: | + cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release + + - name: Build + run: | + cmake --build build --config Release diff --git a/.gitignore b/.gitignore index 3839ad4..8b878a2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ out .vscode build +build*/ +cmake-build-*/ *.exe *.ilk @@ -12,8 +14,16 @@ build *.tlog *.ipch +# CMake/Ninja (in-source builds) +CMakeFiles/ +CMakeCache.txt +cmake_install.cmake +compile_commands.json +*.ninja +.ninja_* + # Now we can place the dump code here and test while expand the Runtime ps2xRuntime/include/ps2_recompiled_functions.h ps2xRuntime/include/ps2_recompiled_stubs.h ps2xRuntime/src/runner/ps2_recompiled_functions.cpp -ps2xRuntime/src/runner/register_functions.cpp \ No newline at end of file +ps2xRuntime/src/runner/register_functions.cpp