Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make distinction between 32-bit and 64-bit requirements #1786

Merged
merged 5 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/picci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
Expand Down
15 changes: 15 additions & 0 deletions include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
49 changes: 24 additions & 25 deletions include/entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -315,7 +315,7 @@ typedef struct {
s32 accelerationY;
s32 unkA4;
s32 unkA8;
#ifdef VERSION_PC
#ifdef PLATFORM_64BIT
s32 : 32;
#endif
u8 anim;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -1115,7 +1113,7 @@ typedef struct {
s32 : 32;
s32 : 32;
s32 : 32;
#ifndef VERSION_PC
#ifndef PLATFORM_64BIT
s32 : 32;
#endif
s16 subweaponId;
Expand Down Expand Up @@ -1162,7 +1160,7 @@ typedef struct {
s32 : 32;
s32 : 32;
s32 : 32;
#ifndef VERSION_PC
#ifndef PLATFORM_64BIT
s32 : 32;
#endif
s16 subweaponId;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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

Expand All @@ -1472,7 +1471,7 @@ typedef struct {
} ET_Whip;

typedef struct {
#ifndef VERSION_PC
#ifndef PLATFORM_64BIT
s32 pad7c;
#endif
Primitive* unk80;
Expand Down
4 changes: 4 additions & 0 deletions src/pc/psxsdk/emu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading