Saturn: Try to fix chunk building insta crashing the game

This commit is contained in:
UnknownShadow200 2024-05-09 20:50:48 +10:00
parent 3ee1b1e92a
commit 5bd2d6848a
3 changed files with 16 additions and 1 deletions

View File

@ -16,7 +16,7 @@ SH_CFLAGS+= -Os -I. -DPLAT_SATURN
SH_LDFLAGS+= SH_LDFLAGS+=
IP_VERSION:= V1.000 IP_VERSION:= V1.000
IP_RELEASE_DATE:= 20160101 IP_RELEASE_DATE:= 20230101
IP_AREAS:= JTUBKAEL IP_AREAS:= JTUBKAEL
IP_PERIPHERALS:= JAMKST IP_PERIPHERALS:= JAMKST
IP_TITLE:= ClassiCube IP_TITLE:= ClassiCube

View File

@ -360,9 +360,16 @@ static void OutputChunkPartsMeta(int x, int y, int z, struct ChunkInfo* info) {
} }
void Builder_MakeChunk(struct ChunkInfo* info) { void Builder_MakeChunk(struct ChunkInfo* info) {
#ifdef CC_BUILD_SATURN
/* The Saturn build only has 16 kb stack, not large enough */
static BlockID chunk[EXTCHUNK_SIZE_3];
static cc_uint8 counts[CHUNK_SIZE_3 * FACE_COUNT];
static int bitFlags[1];
#else
BlockID chunk[EXTCHUNK_SIZE_3]; BlockID chunk[EXTCHUNK_SIZE_3];
cc_uint8 counts[CHUNK_SIZE_3 * FACE_COUNT]; cc_uint8 counts[CHUNK_SIZE_3 * FACE_COUNT];
int bitFlags[EXTCHUNK_SIZE_3]; int bitFlags[EXTCHUNK_SIZE_3];
#endif
cc_bool allAir, allSolid, onBorder; cc_bool allAir, allSolid, onBorder;
int xMax, yMax, zMax, totalVerts; int xMax, yMax, zMax, totalVerts;
@ -761,6 +768,7 @@ static void NormalBuilder_SetActive(void) {
/*########################################################################################################################* /*########################################################################################################################*
*-------------------------------------------------Advanced mesh builder---------------------------------------------------* *-------------------------------------------------Advanced mesh builder---------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
#ifdef CC_BUILD_ADVLIGHTING
static Vec3 adv_minBB, adv_maxBB; static Vec3 adv_minBB, adv_maxBB;
static int adv_initBitFlags, adv_baseOffset; static int adv_initBitFlags, adv_baseOffset;
static int* adv_bitFlags; static int* adv_bitFlags;
@ -1259,6 +1267,9 @@ static void AdvBuilder_SetActive(void) {
Builder_RenderBlock = Adv_RenderBlock; Builder_RenderBlock = Adv_RenderBlock;
Builder_PrePrepareChunk = Adv_PrePrepareChunk; Builder_PrePrepareChunk = Adv_PrePrepareChunk;
} }
#else
static void AdvBuilder_SetActive(void) { NormalBuilder_SetActive(); }
#endif
/*########################################################################################################################* /*########################################################################################################################*

View File

@ -124,6 +124,7 @@ typedef cc_uint8 cc_bool;
#define CC_BUILD_PLUGINS #define CC_BUILD_PLUGINS
#define CC_BUILD_ANIMATIONS #define CC_BUILD_ANIMATIONS
#define CC_BUILD_FILESYSTEM #define CC_BUILD_FILESYSTEM
#define CC_BUILD_ADVLIGHTING
/*#define CC_BUILD_GL11*/ /*#define CC_BUILD_GL11*/
#ifndef CC_BUILD_MANUAL #ifndef CC_BUILD_MANUAL
@ -345,6 +346,7 @@ typedef cc_uint8 cc_bool;
#define CC_BUILD_TOUCH #define CC_BUILD_TOUCH
#undef CC_BUILD_RESOURCES #undef CC_BUILD_RESOURCES
#undef CC_BUILD_ANIMATIONS /* Very costly in FPU less system */ #undef CC_BUILD_ANIMATIONS /* Very costly in FPU less system */
#undef CC_BUILD_ADVLIGHTING
#elif defined __WIIU__ #elif defined __WIIU__
#define CC_BUILD_WIIU #define CC_BUILD_WIIU
#define CC_BUILD_CONSOLE #define CC_BUILD_CONSOLE
@ -374,6 +376,7 @@ typedef cc_uint8 cc_bool;
#undef CC_BUILD_RESOURCES #undef CC_BUILD_RESOURCES
#undef CC_BUILD_NETWORKING #undef CC_BUILD_NETWORKING
#undef CC_BUILD_ANIMATIONS /* Very costly in FPU less system */ #undef CC_BUILD_ANIMATIONS /* Very costly in FPU less system */
#undef CC_BUILD_ADVLIGHTING
#undef CC_BUILD_FILESYSTEM #undef CC_BUILD_FILESYSTEM
#elif defined OS2 #elif defined OS2
#define CC_BUILD_OS2 #define CC_BUILD_OS2
@ -392,6 +395,7 @@ typedef cc_uint8 cc_bool;
#undef CC_BUILD_RESOURCES #undef CC_BUILD_RESOURCES
#undef CC_BUILD_NETWORKING #undef CC_BUILD_NETWORKING
#undef CC_BUILD_ANIMATIONS /* Very costly in FPU less system */ #undef CC_BUILD_ANIMATIONS /* Very costly in FPU less system */
#undef CC_BUILD_ADVLIGHTING
#undef CC_BUILD_FILESYSTEM #undef CC_BUILD_FILESYSTEM
#endif #endif
#endif #endif