Code cleanup and fixes on 64bits

This commit is contained in:
Kevin Alexis Contreras 2022-06-13 10:05:42 -05:00
parent af8c5ab978
commit 394939347c
6 changed files with 23 additions and 11 deletions

View File

@ -30,8 +30,13 @@
#include "ichain.h"
#include "regs.h"
//#define AUDIO_HEAP_SIZE 0x38000
#define AUDIO_HEAP_SIZE 0x3800000 // The original audio heap size was too small. The heap would exceed capacity and corrupt everything in its path.
#if defined(_WIN64) || defined(__x86_64__)
#define _SOH64
#define AUDIO_HEAP_SIZE 0x70000
#else
#define AUDIO_HEAP_SIZE 0x38000
#endif
#define SYSTEM_HEAP_SIZE (1024 * 1024 * 4)
#ifdef __cplusplus
@ -537,9 +542,9 @@ typedef enum {
/* 4 */ TEXT_STATE_CHOICE,
/* 5 */ TEXT_STATE_EVENT,
/* 6 */ TEXT_STATE_DONE,
/* 7 */ TEXT_STATE_SONG_DEMO_DONE,
/* 8 */ TEXT_STATE_8,
/* 9 */ TEXT_STATE_9,
/* 7 */ TEXT_STATE_SONG_DEMO_DONE,
/* 8 */ TEXT_STATE_8,
/* 9 */ TEXT_STATE_9,
/* 10 */ TEXT_STATE_AWAITING_NEXT
} TextState;

View File

@ -1157,7 +1157,7 @@ typedef struct {
} CamColChk; // size = 0x28
typedef struct {
/* 0x000 */ char paramData[0xFF];
/* 0x000 */ char paramData[0x14 * sizeof(void*)];
/* 0x050 */ Vec3f at;
/* 0x05C */ Vec3f eye;
/* 0x068 */ Vec3f up;

View File

@ -579,7 +579,7 @@ extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(int romOffset)
if (strem2[0] == 'R' && strem2[1] == 'I' && strem2[2] == 'F' && strem2[3] == 'F')
{
SoundFontSample* sampleC = (SoundFontSample*)malloc(sizeof(SoundFontSample));
SoundFontSample* sampleC = new SoundFontSample;
*strem++; // RIFF
*strem++; // size

View File

@ -10,7 +10,11 @@ const s16 D_8014A6C0[] = {
0x0030, // gTatumsPerBeat
};
#ifdef _SOH64
const AudioContextInitSizes D_8014A6C4 = { 0x57F00, 0x2E0E0, 0xFCE0 };
#else
const AudioContextInitSizes D_8014A6C4 = { 0x37F00, 0xE0E0, 0xBCE0 };
#endif
ReverbSettings D_80133420[][3] = {
{

View File

@ -718,8 +718,7 @@ uintptr_t AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) {
if (ret != NULL) {
*didAllocate = false;
status = 2;
} else
{
} else {
char* seqData = 0;
SoundFont* fnt;

View File

@ -1516,7 +1516,11 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
if (globalCtx->sceneNum == SCENE_MALON_STABLE) {
// "/* BGCheck LonLon Size %dbyte */\n"
osSyncPrintf("/* BGCheck LonLonサイズ %dbyte */\n", 0x3520);
colCtx->memSize = 0x3520 * (sizeof(void*) / 4); // 64-bit build needs more memory
#ifdef _SOH64
colCtx->memSize = 0x3520 * (sizeof(void*) / 4);
#else
colCtx->memSize = 0x3520;
#endif
} else {
// "/* BGCheck Mini Size %dbyte */\n"
osSyncPrintf("/* BGCheck ミニサイズ %dbyte */\n", 0x4E20);
@ -3787,7 +3791,7 @@ void CollisionHeader_SegmentedToVirtual(CollisionHeader* colHeader) {
/**
* Convert CollisionHeader Segmented to Virtual addressing
*/
void CollisionHeader_GetVirtual(void* colHeader, CollisionHeader** dest)
void CollisionHeader_GetVirtual(void* colHeader, CollisionHeader** dest)
{
if (ResourceMgr_OTRSigCheck(colHeader))
colHeader = ResourceMgr_LoadColByName(colHeader);