3 Commits
Author SHA1 Message Date
popux dd88c8ee28 Fix mac build 2026-10-22 16:24:11 +02:00
popux aa8c2754d9 Fix corpses crash 2026-10-22 16:23:47 +02:00
popux 5787e3abbc Fix respawn 2026-10-22 16:23:41 +02:00
6 changed files with 52 additions and 12 deletions

No files matched your search

+9 -7
View File
@@ -23,14 +23,15 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
# declaration (no members) and rejects base-member access. So prefer GCC.
# (GCC does hard-error on the one struct that declares a member with the same
# name as an inherited one — CCTVRecord's `pad` — see docs/internals.md.)
# An explicit -DCMAKE_C_COMPILER=... always wins.
if(NOT DEFINED CMAKE_C_COMPILER)
# An explicit -DCMAKE_C_COMPILER=... or a CC environment variable always wins.
if(NOT DEFINED CMAKE_C_COMPILER AND "$ENV{CC}" STREQUAL "")
if(CMAKE_HOST_APPLE)
# Homebrew installs real GNU GCC with a version suffix; /usr/bin/gcc is
# Apple Clang and does not support the Plan 9 struct extensions required
# by the decomp's `inherits` pattern.
# Homebrew (gcc-N) and MacPorts (gcc-mp-N) install real GNU GCC with a
# version suffix; /usr/bin/gcc is Apple Clang and does not support the
# Plan 9 struct extensions required by the decomp's `inherits` pattern.
find_program(_GE007_GCC
NAMES gcc-16 gcc-15 gcc-14 gcc-13 gcc-12 gcc-11 gcc)
NAMES gcc-16 gcc-mp-16 gcc-15 gcc-mp-15 gcc-14 gcc-mp-14 gcc-13 gcc-mp-13
gcc-12 gcc-mp-12 gcc-11 gcc-mp-11 gcc)
else()
find_program(_GE007_GCC NAMES gcc)
endif()
@@ -39,7 +40,8 @@ if(NOT DEFINED CMAKE_C_COMPILER)
get_filename_component(_GE007_GCC_DIR "${_GE007_GCC}" DIRECTORY)
if(CMAKE_HOST_APPLE)
find_program(_GE007_GXX
NAMES g++-16 g++-15 g++-14 g++-13 g++-12 g++-11 g++
NAMES g++-16 g++-mp-16 g++-15 g++-mp-15 g++-14 g++-mp-14 g++-13 g++-mp-13
g++-12 g++-mp-12 g++-11 g++-mp-11 g++
PATHS "${_GE007_GCC_DIR}" NO_DEFAULT_PATH)
else()
find_program(_GE007_GXX NAMES g++
+13 -1
View File
@@ -55,7 +55,19 @@ brew install cmake gcc sdl2 zlib python3
The project requires real GNU GCC for the decomp's Plan 9 struct extensions.
Apple's `/usr/bin/gcc` is Clang and is not compatible. CMake automatically
selects Homebrew's versioned `gcc-N`/`g++-N` executables.
selects Homebrew's versioned `gcc-N`/`g++-N` (or MacPorts' `gcc-mp-N`/`g++-mp-N`)
executables; set `CC`/`CXX` to pick a specific one. Delete the build directory
after switching compilers.
If GCC fails with `fatal error: _bounds.h: No such file or directory`, it was
built against a newer macOS SDK than the one CMake picked (the `xcode-select`
default). Point `SDKROOT` at the SDK GCC was built with (`gcc -v` shows it as
`--with-sysroot`), for example with MacPorts GCC 15:
```sh
SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk \
CC=/opt/local/bin/gcc-mp-15 CXX=/opt/local/bin/g++-mp-15 ./build-pc.sh ntsc-final
```
### Asset extraction (decompilation toolchain)
+7
View File
@@ -908,6 +908,13 @@ static void chrlvActorKeepCorpse(ChrRecord *self)
self->act_dead.allowfade = CORPSE_KEEP;
self->act_dead.reaptimer = ++s_CorpseSeq;
self->sleep = 0;
/* Scripts see a removed guard once its body would have faded: level
* scripts respawn reinforcements on if_chr_does_not_exist(id), and
* spawned guards reuse that id via SetMyChrNum. Move the body to a
* fresh internal id (as chrAllocate does) so its old one frees up. */
self->chrnum = (s16)player1_guardID;
player1_guardID += 1;
}
}
+1 -3
View File
@@ -2,13 +2,11 @@
#include "bondtypes.h"
#include "initunk_005450.h"
#define MODELHITENTRIES_LEN 600
extern struct ModelHitEntry *g_ModelHitFreeList; // canonically freedist
/**
* These are linker/BSS labels. g_ModelHitEntries is the start of a
* ModelHitEntry[600] pool. g_ModelHitEntriesPenultimate labels entry 598
* ModelHitEntry[MODELHITENTRIES_LEN] pool. g_ModelHitEntriesPenultimate labels entry 598
* inside that same pool and is kept as a raw char symbol so IDO emits the
* original relocation.
*/
+10
View File
@@ -2,6 +2,16 @@
#define _INITUNK_005450_H_
#include <ultra64.h>
/* Hit-test/draw-order entries shared by every model drawn in a frame (each
* chr takes one per drawable node, ~20-30). PC: room for many more drawn
* chrs, e.g. bodies kept by Game.MaxCorpses; exhausting the pool left later
* chrs without entries and crashed the next shot test. */
#if defined(PLATFORM_64BIT)
#define MODELHITENTRIES_LEN 8192
#else
#define MODELHITENTRIES_LEN 600
#endif
void initModelHitEntryFreeList(void);
#endif
+12 -1
View File
@@ -1,6 +1,7 @@
#include <ultra64.h>
#include <memp.h>
#include "objecthandler.h"
#include "initunk_005450.h"
#include "model.h"
// bss
@@ -11,7 +12,7 @@
// writes 600*40 bytes from g_ModelHitEntries and overruns the N64-sized placeholders
// by 12KB into adjacent .bss globals. Size the pool for the real struct on PC; keep
// the original placeholder chain verbatim on N64.
char g_ModelHitEntries[600 * sizeof(ModelHitEntry)];
char g_ModelHitEntries[MODELHITENTRIES_LEN * sizeof(ModelHitEntry)];
#else
//CODE.bss:80076A50
char g_ModelHitEntries[0xC];
@@ -1269,6 +1270,16 @@ s32 sub_GAME_7F06C010(ModelHitEntry **entryptr, coord3d *modelRayStart, coord3d
{
ModelHitEntry *entry = *entryptr;
#ifdef PORT
/* No entries (the shared pool ran out while drawing): nothing to hit */
if (entry == NULL)
{
*outModel = NULL;
*outNode = NULL;
return 0;
}
#endif
while (entry->next != NULL)
{
entry = entry->next;