diff --git a/.github/workflows/picci.yaml b/.github/workflows/picci.yaml index 0d4d3d9613..e0f12dfb62 100644 --- a/.github/workflows/picci.yaml +++ b/.github/workflows/picci.yaml @@ -59,11 +59,18 @@ jobs: compiler: ["clang", "gcc"] build_type: ["Debug", "RelWithDebInfo"] sound_engine: ["lle", "custom"] + arch: ["x86_64", "i686"] runs-on: ubuntu-24.04 needs: extract-assets steps: - name: Install requirements run: sudo apt-get update && sudo apt-get install build-essential libsdl2-dev + - name: Install multilib + if: matrix.arch == 'i686' + run: | + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt-get install gcc-multilib g++-multilib libsdl2-dev:i386 - name: Clone repo uses: actions/checkout@v4 with: @@ -82,6 +89,9 @@ jobs: if [[ "${{ matrix.sound_engine }}" == "lle" ]]; then export PC_FLAGS="-DWANT_LIBSND_LLE=1" fi + if [[ "${{ matrix.arch }}" == "i686" ]]; then + export PC_FLAGS="$PC_FLAGS -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32" + fi export CC=${{ matrix.compiler }} cmake -B ${{github.workspace}}/pc ${PC_FLAGS} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} cmake --build ${{github.workspace}}/pc --config ${{ matrix.build_type }} diff --git a/include/common.h b/include/common.h index f0888a5083..8e23aa6a01 100644 --- a/include/common.h +++ b/include/common.h @@ -19,6 +19,21 @@ #define VERSION "us" #endif +#if defined(_MSC_VER) +#if defined(_WIN64) || defined(_M_X64) || defined(_M_ARM64) +#define PLATFORM_64BIT +#endif +#elif defined(__GNUC__) || defined(__clang__) || defined(__MWERKS__) +#if defined(__x86_64__) || defined(__aarch64__) || defined(__ppc64__) || \ + defined(__powerpc64__) || defined(__riscv_xlen) +#define PLATFORM_64BIT +#endif +#else +#if (defined(__LP64__) || defined(_LP64)) +#define PLATFORM_64BIT +#endif +#endif + #include "include_asm.h" #include "settings.h" #include "types.h" diff --git a/include/entity.h b/include/entity.h index 0cc336b4e1..2b2e14da8d 100644 --- a/include/entity.h +++ b/include/entity.h @@ -185,7 +185,7 @@ typedef struct { s32 accelerationX; s32 accelerationY; byte pad[32]; -#ifdef VERSION_PC +#ifdef PLATFORM_64BIT s32 _align_anim[2]; #endif u8 anim; @@ -225,7 +225,7 @@ typedef struct PACKED { /* 0xA0 */ s32 : 32; /* 0xA4 */ s32 : 32; /* 0xA8 */ s32 : 32; -#ifdef VERSION_PC +#ifdef PLATFORM_64BIT s32 _align_anim[2]; #endif u8 anim; @@ -237,7 +237,7 @@ typedef struct { s32 unk84; s32 unk88; byte pad[32]; -#ifdef VERSION_PC +#ifdef PLATFORM_64BIT s32 _align_anim[2]; #endif u8 anim; @@ -260,7 +260,7 @@ typedef struct { /* 0xA0 */ s32 : 32; /* 0xA4 */ s32 : 32; /* 0xA8 */ s32 : 32; -#ifdef VERSION_PC +#ifdef PLATFORM_64BIT s32 _align_anim[2]; #endif u8 anim; @@ -279,7 +279,7 @@ typedef struct { /* 0xA0 */ s32 : 32; /* 0xA4 */ s32 : 32; /* 0xA8 */ s32 : 32; -#ifdef VERSION_PC +#ifdef PLATFORM_64BIT s32 _align_anim[2]; #endif u8 anim; @@ -293,7 +293,7 @@ typedef struct { /* 0xA0 */ s32 : 32; /* 0xA4 */ s32 : 32; /* 0xA8 */ s32 : 32; -#ifdef VERSION_PC +#ifdef PLATFORM_64BIT s32 _align_anim[2]; #endif u8 anim; @@ -315,7 +315,7 @@ typedef struct { s32 accelerationY; s32 unkA4; s32 unkA8; -#ifdef VERSION_PC +#ifdef PLATFORM_64BIT s32 : 32; #endif u8 anim; @@ -343,7 +343,7 @@ typedef struct PACKED { s16 unkA2; s32 unkA4; s32 unkA8; -#ifdef VERSION_PC +#ifdef PLATFORM_64BIT s32 _align_anim; #endif u8 anim; @@ -367,7 +367,7 @@ typedef struct PACKED { s32 accelerationY; s32 unkA4; s32 unkA8; -#ifdef VERSION_PC +#ifdef PLATFORM_64BIT s32 _align_anim; #endif u8 anim; @@ -390,7 +390,7 @@ typedef struct PACKED { s32 accelerationY; s32 unkA4; s32 unkA8; -#ifdef VERSION_PC +#ifdef PLATFORM_64BIT s32 _align_anim; #endif u8 anim; @@ -418,7 +418,7 @@ typedef struct PACKED { /* 0x9E */ s16 unk9E; /* 0xA0 */ s16 unkA0; /* 0xA4 */ byte pad[10]; -#ifdef VERSION_PC +#ifdef PLATFORM_64BIT s32 _align_anim; #endif /* 0xAC */ u8 anim; @@ -469,10 +469,8 @@ typedef struct { /* 0xA0 */ s16 unkA0; /* 0xA2 */ s16 unkA2; /* 0xA4 */ s16 unkA4; - /* 0xA6 */ u8 pad[4]; -#ifdef VERSION_PC - s16 _align_anim; -#endif + /* 0xA6 */ u16 : 16; + /* 0xA8 */ u32 : 32; /* 0xAC */ u8 anim; /* 0xAD */ u8 unkAD; /* 0xAE */ s16 unkAE; @@ -499,7 +497,7 @@ typedef struct PACKED { /* 0xA0 */ u32 : 32; /* 0xA4 */ u32 : 32; /* 0xA8 */ u32 : 32; -#ifdef VERSION_PC +#ifdef PLATFORM_64BIT s32 _align_anim; #endif /* 0xAC */ u8 anim; @@ -524,7 +522,7 @@ typedef struct PACKED { /* 0x9A */ s16 unk9A; /* 0x9C */ u8 unk9C; /* 0x9D */ u8 pad[15]; -#ifdef VERSION_PC +#ifdef PLATFORM_64BIT s32 _align_anim; #endif /* 0xAC */ u8 anim; @@ -1115,7 +1113,7 @@ typedef struct { s32 : 32; s32 : 32; s32 : 32; -#ifndef VERSION_PC +#ifndef PLATFORM_64BIT s32 : 32; #endif s16 subweaponId; @@ -1162,7 +1160,7 @@ typedef struct { s32 : 32; s32 : 32; s32 : 32; -#ifndef VERSION_PC +#ifndef PLATFORM_64BIT s32 : 32; #endif s16 subweaponId; @@ -1337,7 +1335,7 @@ typedef struct { u16 unk80; u16 pad82; Point16* unk84; -#ifndef VERSION_PC +#ifndef PLATFORM_64BIT /* 0x88 */ s32 : 32; #endif /* 0x8C */ struct Entity* parent; @@ -1367,7 +1365,7 @@ typedef struct { /* 0xA4 */ s32 : 32; /* 0xA8 */ s32 : 32; /* 0xAC */ s32 : 32; -#ifdef VERSION_PC +#ifdef PLATFORM_64BIT s32 : 32; #endif /* 0xB0 */ s16 subweaponId; @@ -1389,7 +1387,7 @@ typedef struct { /* 0xA4 */ s32 : 32; /* 0xA8 */ s32 : 32; /* 0xAC */ s32 : 32; -#ifdef VERSION_PC +#ifdef PLATFORM_64BIT s32 : 32; #endif /* 0xB0 */ s16 subweaponId; @@ -1443,10 +1441,11 @@ typedef struct { u16 unk7C; u16 unk7E; u8 unk80; - byte pad81; + u8 : 8; u8 unk82; - byte pad83; + u8 : 8; s32 unk84; + s32 : 32; struct Entity* parent; } ET_RicRevivalColumn; // Note this is the same as CrashCross @@ -1472,7 +1471,7 @@ typedef struct { } ET_Whip; typedef struct { -#ifndef VERSION_PC +#ifndef PLATFORM_64BIT s32 pad7c; #endif Primitive* unk80; diff --git a/src/pc/psxsdk/emu.cpp b/src/pc/psxsdk/emu.cpp index 5a0b7387d7..3044bf1194 100644 --- a/src/pc/psxsdk/emu.cpp +++ b/src/pc/psxsdk/emu.cpp @@ -10,7 +10,11 @@ #include "../../main/psxsdk/libsnd/libsnd_i.h" // adjust SS_SEQ_TABSIZ in include/psxsdk/libsnd.h accordingly +#ifdef PLATFORM_64BIT static_assert(sizeof(SeqStruct) == 192, "SS_SEQ_TABSIZ check"); +#else +static_assert(sizeof(SeqStruct) == 172, "SS_SEQ_TABSIZ check"); +#endif PS_SPU* SPU = nullptr;