diff --git a/include/libforest/emu64/emu64.hpp b/include/libforest/emu64/emu64.hpp index 4628d44a..69d062b6 100644 --- a/include/libforest/emu64/emu64.hpp +++ b/include/libforest/emu64/emu64.hpp @@ -434,7 +434,7 @@ class emu64_print { void Printf(const char* fmt, ...) { va_list list; - if ((this->print_flags & EMU64_PRINTF_FLAG)) { + if ((this->print_flags & EMU64_PRINTF_ENABLED_FLAG)) { va_start(list, fmt); this->Vprintf(fmt, list); va_end(list); @@ -603,7 +603,7 @@ class emu64 : public emu64_print { void cullmode(); void texture_gen(int tile); void texture_matrix(); - void disp_matrix(GC_Mtx mtx); + void disp_matrix(MtxP mtx); const char* segchk(u32 seg); const char* combine_name(u32 param, u32 type); const char* combine_alpha(int param, int type); @@ -689,6 +689,7 @@ class emu64 : public emu64_print { void emu64_set_verbose(int verbose); /* N64 texture format[N64 bit size] -> dol texture format */ + static u8 nChans; static char* warningString[EMU64_WARNING_COUNT]; static u32 warningTime[EMU64_WARNING_COUNT]; static bool displayWarning; diff --git a/include/libforest/emu64/texture_cache.h b/include/libforest/emu64/texture_cache.h index ba7e2758..b3b7e883 100644 --- a/include/libforest/emu64/texture_cache.h +++ b/include/libforest/emu64/texture_cache.h @@ -63,7 +63,7 @@ typedef struct texture_cache_s { // static tmem_t tmem_map[TMEM_ENTRIES]; #define TEX_BUFFER_DATA_SIZE 0xC000 -#define TEX_BUFFER_BSS_SIZE 0x1000 +#define TEX_BUFFER_BSS_SIZE 0x400 #ifdef __cplusplus } diff --git a/src/static/libforest/emu64/emu64.c b/src/static/libforest/emu64/emu64.c index c3053f78..a992a7b9 100644 --- a/src/static/libforest/emu64/emu64.c +++ b/src/static/libforest/emu64/emu64.c @@ -31,9 +31,9 @@ void guMtxXFM1F_dol6w1(MtxP mtx, GXProjectionType type, float x, float y, float extern void OSInitFastCast(void); static aflags_c aflags; - -static u8 texture_buffer_data[TEX_BUFFER_DATA_SIZE]; -static u8 texture_buffer_bss[TEX_BUFFER_BSS_SIZE]; +u8 emu64::nChans = 0; +static u8 texture_buffer_data[TEX_BUFFER_DATA_SIZE] ATTRIBUTE_ALIGN(32); +static u8 texture_buffer_bss[TEX_BUFFER_BSS_SIZE] ATTRIBUTE_ALIGN(32); static tmem_t tmem_map[TMEM_ENTRIES]; @@ -55,17 +55,6 @@ static texture_cache_funcs texture_cache_data_func = { &texture_cache_alloc, }; -static texture_cache_t texture_cache_data = { - &texture_cache_data_func, - &texture_buffer_data[0], - &texture_buffer_data[TEX_BUFFER_DATA_SIZE], - &texture_buffer_data[0], - nullptr, - nullptr, - FALSE, - 0, -}; - /* .bss cache functions */ static void* texture_cache_bss_search(void* addr); static int texture_cache_bss_entry(void* original, void* converted); @@ -76,10 +65,21 @@ static texture_cache_funcs texture_cache_bss_func = { &texture_cache_alloc, }; +static texture_cache_t texture_cache_data = { + &texture_cache_data_func, + &texture_buffer_data[0], + &texture_buffer_data[sizeof(texture_buffer_data)], + &texture_buffer_data[0], + nullptr, + nullptr, + FALSE, + 0, +}; + static texture_cache_t texture_cache_bss = { &texture_cache_bss_func, &texture_buffer_bss[0], - &texture_buffer_bss[TEX_BUFFER_BSS_SIZE], + &texture_buffer_bss[sizeof(texture_buffer_bss)], &texture_buffer_bss[0], nullptr, nullptr, diff --git a/src/static/libforest/emu64/emu64_print.cpp b/src/static/libforest/emu64/emu64_print.cpp index 964de25e..21206c18 100644 --- a/src/static/libforest/emu64/emu64_print.cpp +++ b/src/static/libforest/emu64/emu64_print.cpp @@ -6,7 +6,7 @@ static const char* __unused__reorder_char0A(void) { return "\n"; } -void emu64::disp_matrix(GC_Mtx mtx) { +void emu64::disp_matrix(MtxP mtx) { static const u8 kakko[] = {'/', '\\', '/', '\\', '|', '|', '|', '|', '|', '|', '|', '|', '\\', '/', '\\', '/'}; for (int i = 0; i < 4; i++) { @@ -28,7 +28,7 @@ const char* emu64::segchk(u32 segment) { const char str0[] = "anime_4_txt+%4u"; const char str1[] = "anime_6_model+sizeof(Mtx)*%2u"; - u32 partial_addr = (u32)seg2k0(segment); + u32 partial_addr = seg2k0(segment); u32 addr = convert_partial_address(partial_addr); str[0] = '\0'; @@ -36,7 +36,7 @@ const char* emu64::segchk(u32 segment) { if (addr == partial_addr) { snprintf(str, sizeof(str), "0x%08x", segment); } else { - snprintf(str, sizeof(str), "0x%08x /* PADDR=0x%08x */", segment, partial_addr); + snprintf(str, sizeof(str), "0x%08x /* PADDR=0x%08x */", segment, addr); } } else { const char* s;