diff --git a/src/audio/data.c b/src/audio/data.c index 85a34457..cd8528c1 100644 --- a/src/audio/data.c +++ b/src/audio/data.c @@ -60,14 +60,14 @@ struct AudioSessionSettings gAudioSessionPresets[18] = { { 32000, 16, 1, 0x0A00, 0x47FF, 0x7FFF, 0x3F00, 0x6200, 0x4400, 0x2A80 }, { 32000, 20, 1, 0x0800, 0x37FF, 0x7FFF, 0x3300, 0x5500, 0x4000, 0x1B00 }, #else - { 32000, 16, 1, 0x0C00, 0x2FFF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 }, - { 32000, 16, 1, 0x0A00, 0x47FF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 }, - { 32000, 16, 1, 0x1000, 0x2FFF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 }, - { 32000, 16, 1, 0x0E00, 0x3FFF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 }, - { 32000, 16, 1, 0x0C00, 0x4FFF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 }, - { 32000, 16, 1, 0x0C00, 0x2FFF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 }, - { 32000, 16, 1, 0x0A00, 0x47FF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 }, - { 32000, 20, 1, 0x0800, 0x37FF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 }, + { 32000, 16, 1, 0x0C00, 0x2FFF, 0x7FFF, 0x7400, 0xA000, 0x7400, 0x7400 }, + { 32000, 16, 1, 0x0A00, 0x47FF, 0x7FFF, 0x7400, 0xA000, 0x7400, 0x7400 }, + { 32000, 16, 1, 0x1000, 0x2FFF, 0x7FFF, 0x7400, 0xA000, 0x7400, 0x7400 }, + { 32000, 16, 1, 0x0E00, 0x3FFF, 0x7FFF, 0x7400, 0xA000, 0x7400, 0x7400 }, + { 32000, 16, 1, 0x0C00, 0x4FFF, 0x7FFF, 0x7400, 0xA000, 0x7400, 0x7400 }, + { 32000, 16, 1, 0x0C00, 0x2FFF, 0x7FFF, 0x7400, 0xA000, 0x7400, 0x7400 }, + { 32000, 16, 1, 0x0A00, 0x47FF, 0x7FFF, 0x7400, 0xA000, 0x7400, 0x7400 }, + { 32000, 20, 1, 0x0800, 0x37FF, 0x7FFF, 0x7400, 0xA000, 0x7400, 0x7400 }, #endif { 27000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 }, { 27000, 16, 1, 0x0800, 0x3FFF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 }, @@ -583,8 +583,8 @@ f32 gVolRampingRhs128[128] = { s16 gTatumsPerBeat = TATUMS_PER_BEAT; s8 gUnusedCount80333EE8 = UNUSED_COUNT_80333EE8; -s32 gAudioHeapSize = DOUBLE_SIZE_ON_64_BIT(AUDIO_HEAP_SIZE); -s32 D_80333EF0 = DOUBLE_SIZE_ON_64_BIT(D_80333EF0_VAL); +s32 gAudioHeapSize = AUDIO_HEAP_SIZE; +s32 D_80333EF0 = D_80333EF0_VAL; volatile s32 gAudioLoadLock = AUDIO_LOCK_UNINITIALIZED; #ifdef VERSION_EU diff --git a/src/audio/data.h b/src/audio/data.h index 55a9b7e8..26f6baa9 100644 --- a/src/audio/data.h +++ b/src/audio/data.h @@ -106,12 +106,12 @@ extern u32 gAudioRandom; //make my life easier #ifdef VERSION_EU #define UNUSED_COUNT_80333EE8 24 -#define AUDIO_HEAP_SIZE 0x2c500 -#define D_80333EF0_VAL 0x2c00 +#define AUDIO_HEAP_SIZE DOUBLE_SIZE_ON_64_BIT(0x2c500) +#define D_80333EF0_VAL DOUBLE_SIZE_ON_64_BIT(0x2c00) #else #define UNUSED_COUNT_80333EE8 16 -#define AUDIO_HEAP_SIZE 0x31150 -#define D_80333EF0_VAL 0x2500 +#define AUDIO_HEAP_SIZE DOUBLE_SIZE_ON_64_BIT(0x48000) +#define D_80333EF0_VAL DOUBLE_SIZE_ON_64_BIT(0x2500) #endif diff --git a/src/audio/heap.c b/src/audio/heap.c index a183a707..17bf353d 100644 --- a/src/audio/heap.c +++ b/src/audio/heap.c @@ -1,4 +1,5 @@ #include +#include #include "heap.h" #include "data.h" @@ -209,6 +210,8 @@ void *soundAlloc(struct SoundAllocPool *pool, u32 size) { *pos = 0; } } else { + fprintf(stderr, "soundAlloc failed: tried to alloc %u bytes (%i free)\n", + ALIGN16(size), pool->start + pool->size - pool->cur); return NULL; } return start; @@ -225,6 +228,8 @@ void *soundAlloc(struct SoundAllocPool *pool, u32 size) { start[i] = 0; } } else { + fprintf(stderr, "soundAlloc failed: tried to alloc %u bytes (%i free)\n", + (unsigned int)ALIGN16(size), (int)(pool->start + pool->size - pool->cur)); return NULL; } return start; diff --git a/src/buffers/buffers.c b/src/buffers/buffers.c index db3b573f..ddcd0281 100644 --- a/src/buffers/buffers.c +++ b/src/buffers/buffers.c @@ -1,13 +1,10 @@ #include #include "buffers.h" +#include "audio/data.h" ALIGNED8 u8 gDecompressionHeap[0xD000]; -#if defined(VERSION_EU) || defined(VERSION_SH) -ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200) - 0x3800]; -#else -ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200)]; -#endif +ALIGNED16 u8 gAudioHeap[AUDIO_HEAP_SIZE]; ALIGNED8 u8 gIdleThreadStack[0x800]; ALIGNED8 u8 gThread3Stack[0x2000]; diff --git a/src/pc/gfx/gfx_pc.c b/src/pc/gfx/gfx_pc.c index a4ec6056..42fa8ad6 100644 --- a/src/pc/gfx/gfx_pc.c +++ b/src/pc/gfx/gfx_pc.c @@ -307,7 +307,7 @@ static bool gfx_texture_cache_lookup(int tile, struct TextureHashmapNode **n, co hash = (hash >> HASH_SHIFT) & HASH_MASK; struct TextureHashmapNode **node = &gfx_texture_cache.hashmap[hash]; - while (*node != NULL && *node - gfx_texture_cache.pool < gfx_texture_cache.pool_pos) { + while (*node != NULL && *node - gfx_texture_cache.pool < (int)gfx_texture_cache.pool_pos) { if (CMPADDR((*node)->texture_addr, orig_addr) && (*node)->fmt == fmt && (*node)->siz == siz) { gfx_rapi->select_texture(tile, (*node)->texture_id); *n = *node; diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c index 1249f71f..e5fc9fed 100644 --- a/src/pc/pc_main.c +++ b/src/pc/pc_main.c @@ -339,6 +339,7 @@ void main_func(void) { #endif #ifdef DEBUG fflush(stdout); + fflush(stderr); #endif } #endif