diff --git a/Frameworks/lazyusf/lazyusf/main/main.c b/Frameworks/lazyusf/lazyusf/main/main.c index b96ad28fa..4a35d2a18 100644 --- a/Frameworks/lazyusf/lazyusf/main/main.c +++ b/Frameworks/lazyusf/lazyusf/main/main.c @@ -137,7 +137,7 @@ m64p_error main_start(usf_state_t * state) #ifdef DEBUG_INFO state->r4300emu = 0; #else - state->r4300emu = state->enable_trimming_mode ? 1 : 2; + state->r4300emu = state->enable_trimming_mode ? 0 : 2; #endif /* set some other core parameters based on the config file values */ diff --git a/Frameworks/lazyusf/lazyusf/memory/memory.c b/Frameworks/lazyusf/lazyusf/memory/memory.c index b9a318fc9..6cb530f66 100644 --- a/Frameworks/lazyusf/lazyusf/memory/memory.c +++ b/Frameworks/lazyusf/lazyusf/memory/memory.c @@ -23,6 +23,8 @@ #include "usf/usf_internal.h" +#include "usf/barray.h" + #include "memory.h" #include "api/m64p_types.h" @@ -1166,7 +1168,7 @@ int init_memory(usf_state_t * state, uint32_t rdram_size) map_region(state, 0xb000+i, M64P_MEM_NOTHING, RW(nothing)); } - state->fast_memory = 1; + state->fast_memory = state->enable_trimming_mode ? 0 : 1; if (state->g_rom && state->g_rom_size >= 0xfc0) init_cic_using_ipl3(state, &state->g_si.pif.cic, state->g_rom + 0x40); @@ -1241,6 +1243,24 @@ unsigned int * osal_fastcall fast_mem_access(usf_state_t * state, unsigned int a address &= 0x1ffffffc; + /* XXX this method is only valid for single 32 bit word fetches, + * as used by the pure interpreter CPU. The cached interpreter + * and the recompiler, on the other hand, fetch the start of a + * block and use the pointer for the entire block. */ + + if (state->enable_trimming_mode) + { + if (address < RDRAM_MAX_SIZE) + { + if (!bit_array_test(state->barray_ram_written_first, address / 4)) + bit_array_set(state->barray_ram_read, address / 4); + } + else if ((address - 0x10000000) < state->g_rom_size) + { + bit_array_set(state->barray_rom, address / 4); + } + } + if (address < RDRAM_MAX_SIZE) return (unsigned int*)((unsigned char*)state->g_rdram + address); else if (address >= 0x10000000)