Changes to build on mac (#4)

This commit is contained in:
Garrett Cox 2024-01-06 05:47:40 +00:00
parent 13a369e871
commit 1f69d643fc
21 changed files with 111 additions and 16 deletions

View File

@ -54,13 +54,16 @@ set(CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -ffast-math -DNDEBUG")
else()
set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-fuse-ld=lld")
set(CMAKE_C_FLAGS_DEBUG "-g")
set(CMAKE_LINKER_FLAGS_DEBUG "-fuse-ld=lld")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
set(CMAKE_OBJCXX_FLAGS_RELEASE "-O2 -DNDEBUG")
endif()
if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CMAKE_CXX_FLAGS_DEBUG "-fuse-ld=lld")
set(CMAKE_LINKER_FLAGS_DEBUG "-fuse-ld=lld")
endif()
if(NOT CMAKE_BUILD_TYPE )
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE)
endif()

@ -1 +1 @@
Subproject commit 6212ebc4407107340a76b3ab052f94170a42a3a6
Subproject commit c38b0ac812e71600be11ad17451280bb7145d8f4

View File

@ -77,6 +77,7 @@ uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
CollisionHeader* ResourceMgr_LoadColByName(const char* path);
AnimatedMaterial* ResourceMgr_LoadAnimatedMatByName(const char* path);
char* ResourceMgr_LoadTexOrDListByName(const char* filePath);
char* ResourceMgr_LoadIfDListByName(const char* filePath);
char* ResourceMgr_LoadPlayerAnimByName(const char* animPath);
AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path);
char* ResourceMgr_GetNameByCRC(uint64_t crc, char* alloc);
@ -103,6 +104,7 @@ s32* ResourceMgr_LoadCSByName(const char* path);
int ResourceMgr_OTRSigCheck(char* imgData);
uint64_t osGetTime(void);
uint32_t osGetCount(void);
uint64_t GetFrequency();
uint32_t OTRGetCurrentWidth(void);
uint32_t OTRGetCurrentHeight(void);
float OTRGetAspectRatio(void);

View File

@ -132,7 +132,7 @@ s32 AudioLoad_SyncInitSeqPlayer(s32 playerIndex, s32 seqId, s32 arg2);
s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIndex, s32 seqId, s32 skipTicks);
void AudioLoad_ProcessLoads(s32 resetStatus);
void AudioLoad_SetDmaHandler(DmaHandler callback);
void AudioLoad_Init(void* heap, u32 heapSize);
void AudioLoad_Init(void* heap, size_t heapSize);
void AudioLoad_InitSlowLoads(void);
s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* isDone);
s32 AudioLoad_SlowLoadSeq(s32 seqId, u8* ramAddr, s8* isDone);

View File

@ -7,6 +7,7 @@ extern "C" {
#endif
#include "z64.h"
#include "BenPort.h"
void bootproc(void);
void ViConfig_UpdateVi(u32 black);
@ -40,10 +41,6 @@ void IrqMgr_HandleRetrace(IrqMgr* irqmgr);
void IrqMgr_ThreadEntry(IrqMgr* irqmgr);
void IrqMgr_Init(IrqMgr* irqmgr, void* stack, OSPri pri, u8 retraceCount);
void osSyncPrintfUnused(const char* fmt, ...);
void rmonPrintf(const char* fmt, ...);
void RcpUtils_PrintRegisterStatus(void);
void RcpUtils_Reset(void);
@ -1324,6 +1321,41 @@ u8 AudioSeq_ResetReverb(void);
void AudioSeq_ResetActiveSequences(void);
void AudioSeq_ResetActiveSequencesAndVolume(void);
// #region 2S2H [Port] Made Available via C++
s32 osContInit(OSMesgQueue* mq, u8* controllerBits, OSContStatus* status);
s32 osContStartReadData(OSMesgQueue* mesg);
void osContGetReadData(OSContPad* pad);
// #endregion
// #region 2S2H [Port] Previously unavailable functions, made available for porting
void PadMgr_ThreadEntry();
void Heaps_Alloc(void);
// #endregion
// #region 2S2H [Port] Stubbed methods
void osSetThreadPri(OSThread* thread, OSPri p);
OSPri osGetThreadPri(OSThread* t);
void osSyncPrintfUnused(const char* fmt, ...);
void osSyncPrintf(const char* fmt, ...);
void rmonPrintf(const char* fmt, ...);
void osCreateThread(OSThread* thread, OSId id, void* entry, void* arg, void* sp, OSPri p);
void osStartThread(OSThread* t);
void osViSwapBuffer(void* frameBufPtr);
void osViBlack(u8 active);
void osDestroyThread(OSThread* t);
void osViSetMode(OSViMode* modep);
void osViSetSpecialFeatures(u32 func);
s32 osContStartQuery(OSMesgQueue* mq);
s32 osContSetCh(u8 ch);
void osContGetQuery(OSContStatus* data);
void osSpTaskLoad(OSTask* intp);
void osSpTaskStartGo(OSTask* tp);
void* osViGetCurrentFramebuffer(void);
void* osViGetNextFramebuffer(void);
OSYieldResult osSpTaskYielded(OSTask* task);
void osSpTaskYield(void);
void osViSetXScale(f32 value);
void osViSetYScale(f32 value);
// #endregion
void Regs_InitData(PlayState* play);
#ifdef __cplusplus

View File

@ -3,8 +3,12 @@
#include "PR/ultratypes.h"
// #region 2S2H [Port] These are defined by LUS
#if 0
typedef s32 intptr_t;
typedef u32 uintptr_t;
#endif
// #endregion
#define INT8_MIN (-0x80)
#define INT16_MIN (-0x8000)

View File

@ -25,7 +25,7 @@ extern s32 sIrqMgrRetraceCount;
extern u8 sYaz0DataBuffer[0x400];
extern u8* sYaz0CurDataEnd;
extern u32 sYaz0CurRomStart;
extern uintptr_t sYaz0CurRomStart;
extern u32 sYaz0CurSize;
extern u8* sYaz0MaxPtr;
extern void* gYaz0DecompressDstEnd;

View File

@ -669,7 +669,7 @@ typedef enum GetItemDrawId {
/* 0x73 */ GID_CHATEAU,
/* 0x74 */ GID_PICTOGRAPH_BOX,
/* 0x75 */ GID_MASK_FIERCE_DEITY,
/* 0x76 */ GID_MAX
/* 0x76 */ GID_MAXIMUM // 2S2H [Port] Changed from GID_MAX because that's a reserved macro on MacOS(?)
} GetItemDrawId;
#endif

42
mm/macosx/Info.plist.in Normal file
View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleName</key>
<string>2 Ship 2 Harkinian</string>
<key>CFBundleExecutable</key>
<string>2s2h</string>
<key>CFBundleGetInfoString</key>
<string>@CMAKE_PROJECT_VERSION@</string>
<key>CFBundleIconFile</key>
<string>2s2h.icns</string>
<key>CFBundleIdentifier</key>
<string>com.2ship2harkinian.2Ship2Harkinian</string>
<key>CFBundleDocumentTypes</key>
<array>
</array>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@CMAKE_PROJECT_VERSION@</string>
<key>CFBundleSignature</key>
<string>ZMM</string>
<key>CFBundleVersion</key>
<string>@CMAKE_PROJECT_VERSION@</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2024 HarbourMasters.</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
<key>LSArchitecturePriority</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
</dict>
</plist>

View File

@ -1,4 +1,5 @@
#include "padutils.h"
#include <strings.h>
#include <ultratypes.h>
void PadUtils_Init(Input* input) {

View File

@ -51,6 +51,8 @@
#include "main.h"
#include "macros.h"
#include "global.h"
#include <stdio.h>
#if 0
FaultMgr* sFaultInstance;
f32 sFaultTimeTotal; // read but not set anywhere

View File

@ -1,5 +1,6 @@
#include "libc/stdbool.h"
#include "idle.h"
#include "functions.h"
extern OSViMode osViModeNtscHpf1;
extern OSViMode osViModePalLan1;

View File

@ -1,5 +1,6 @@
#include "global.h"
#include "fault.h"
#include <stdio.h>
u8 sYaz0DataBuffer[0x400] ALIGNED(16);
u8* sYaz0CurDataEnd;

View File

@ -119,7 +119,7 @@ s32 DmaMgr_FindDmaIndex(uintptr_t vrom) {
#endif
}
const char* func_800809F4(u32 a0) {
const char* func_800809F4(uintptr_t a0) {
return "??";
}

View File

@ -1,6 +1,7 @@
#include "buffers.h"
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
u8* gAudioHeap;

View File

@ -35,6 +35,7 @@
#include "PR/controller.h"
#include "PR/os_motor.h"
#include "fault.h"
#include <stdio.h>
//extern FaultMgr gFaultMgr;

View File

@ -2,6 +2,7 @@
#include <string.h>
#include "z64.h"
#include <assert.h>
#include "BenPort.h"
//#include <math.h>
#define SCREEN_WIDTH 320
@ -383,7 +384,7 @@ int bcmp(void* __s1, void* __s2, int __n) {
}
#endif
int ResourceMgr_OTRSigCheck(char* imgData);
char* ResourceMgr_LoadTexOrDListByName(char* data);
char* ResourceMgr_LoadTexOrDListByName(const char* data);
void gSPSegment(void* value, int segNum, uintptr_t target) {
char* imgData = (char*)target;
@ -560,9 +561,9 @@ s32 osAiSetFrequency(u32 frequency) {
}
s32 osContStartQuery(OSMesgQueue* mq) {
}
void osCreateThread(void* a, u32 b, void* c, void* d) {
void osCreateThread(OSThread* thread, OSId id, void* entry, void* arg, void* sp, OSPri p) {
}
void osGetThreadPri(void* a) {
OSPri osGetThreadPri(OSThread* t) {
}
void osContGetQuery(OSContStatus* data) {
}
@ -599,7 +600,7 @@ void osViSetXScale(f32 value) {
}
void osSpTaskYield(void) {
}
u32* osViGetCurrentFramebuffer(void) {
void* osViGetCurrentFramebuffer(void) {
}
OSPiHandle* osFlashInit(void) {
}

View File

@ -4,6 +4,7 @@
#include "fixed_point.h"
#include "vt.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
#include <stdio.h>
#define DYNA_RAYCAST_FLOORS 1
#define DYNA_RAYCAST_WALLS 2

View File

@ -1,6 +1,7 @@
#include "global.h"
#include "message_data_static.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
#include <stdio.h>
f32 sNESFontWidths[160] = {
8.0f, 8.0f, 6.0f, 9.0f, 9.0f, 14.0f, 12.0f, 3.0f, 7.0f, 7.0f, 7.0f, 9.0f, 4.0f, 6.0f, 4.0f, 9.0f,

View File

@ -1540,10 +1540,12 @@ void func_8012CF0C(GraphicsContext* gfxCtx, s32 clearFb, s32 clearZb, u8 r, u8 g
OPEN_DISPS(gfxCtx);
// #region 2S2H [Port] Crashes on MacOS
gSPDisplayList(POLY_OPA_DISP++, gGfxMasterDL->setupBuffers);
gSPDisplayList(POLY_XLU_DISP++, gGfxMasterDL->setupBuffers);
gSPDisplayList(OVERLAY_DISP++, gGfxMasterDL->setupBuffers);
gSPDisplayList(DEBUG_DISP++, gGfxMasterDL->setupBuffers);
// #endregion
if (clearZb) {
__gSPDisplayList(POLY_OPA_DISP++,

View File

@ -29,7 +29,7 @@ const char* sD2CloudStaticTex[] = {
gCloudySkybox1Tex, gCloudySkybox2Tex, gCloudySkybox3Tex, gCloudySkybox4Tex, gCloudySkybox5Tex,
};
SkyboxFiles files[] = {
SkyboxFiles skyboxFiles[] = { // 2S2H [Port] Renamed from files because of conflcit
{ sD2FineStaticTex, gClearSkyboxTlue },
{ sD2CloudStaticTex, gClearSkyboxTlue },
};