From 438b4143defc8fbf2d7f746abc8909c2ecce91a9 Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Tue, 10 Mar 2015 18:34:02 -0700 Subject: [PATCH] Updated lazyusf2 --- Frameworks/lazyusf/lazyusf/main/main.c | 1 + Frameworks/lazyusf/lazyusf/rsp/rsp_core.c | 52 ++++++++++++++----- Frameworks/lazyusf/lazyusf/rsp_lle/vu/vsaw.h | 10 ++-- Frameworks/lazyusf/lazyusf/si/si_controller.c | 22 ++++++++ 4 files changed, 68 insertions(+), 17 deletions(-) diff --git a/Frameworks/lazyusf/lazyusf/main/main.c b/Frameworks/lazyusf/lazyusf/main/main.c index 1739dc271..b96ad28fa 100644 --- a/Frameworks/lazyusf/lazyusf/main/main.c +++ b/Frameworks/lazyusf/lazyusf/main/main.c @@ -184,6 +184,7 @@ m64p_error main_start(usf_state_t * state) state->g_delay_ai = 1; state->g_delay_pi = 1; state->g_delay_dp = 1; + state->enable_hle_audio = 0; } return M64ERR_SUCCESS; diff --git a/Frameworks/lazyusf/lazyusf/rsp/rsp_core.c b/Frameworks/lazyusf/lazyusf/rsp/rsp_core.c index fcafc3af8..f258b55e6 100644 --- a/Frameworks/lazyusf/lazyusf/rsp/rsp_core.c +++ b/Frameworks/lazyusf/lazyusf/rsp/rsp_core.c @@ -23,6 +23,8 @@ #include "usf/usf_internal.h" +#include "usf/barray.h" + #include "rsp_lle/rsp_lle.h" #include "rsp_core.h" @@ -53,13 +55,26 @@ void dma_sp_write(struct rsp_core* sp) unsigned char *spmem = (unsigned char*)sp->mem + (sp->regs[SP_MEM_ADDR_REG] & 0x1000); unsigned char *dram = (unsigned char*)sp->ri->rdram.dram; - for(j=0; jr4300->state->enable_trimming_mode) { + for(j=0; jr4300->state->barray_ram_written_first, dramaddr / 4)) + bit_array_set(sp->r4300->state->barray_ram_read, dramaddr / 4); + memaddr++; + dramaddr++; + } + dramaddr+=skip; + } + } else { + for(j=0; jmem + (sp->regs[SP_MEM_ADDR_REG] & 0x1000); unsigned char *dram = (unsigned char*)sp->ri->rdram.dram; - for(j=0; jr4300->state->enable_trimming_mode) { + for(j=0; jr4300->state->barray_ram_read, dramaddr / 4)) + bit_array_set(sp->r4300->state->barray_ram_written_first, dramaddr / 4); + memaddr++; + dramaddr++; + } + dramaddr+=skip; + } + } else { + for(j=0; jVR[vs][i]; vt = 0; /* Even though VT is ignored in VSAR, according to official sources as well * as reversing, lots of games seem to specify it as non-zero, possibly to @@ -39,7 +39,7 @@ static void VSAR(int vd, int vs, int vt, int e) vst1q_s16(VR[vd], zero); #else for (i = 0; i < N; i++) - VR[vd][i] = 0x0000; /* override behavior (zilmar) */ + state->VR[vd][i] = 0x0000; /* override behavior (zilmar) */ #endif } else @@ -48,12 +48,12 @@ static void VSAR(int vd, int vs, int vt, int e) vector_copy(VR[vd], VACC[e]); #else for (i = 0; i < N; i++) - VR[vd][i] = VACC[e][i]; + state->VR[vd][i] = state->VACC[e][i]; #endif } for (i = 0; i < N; i++) - VACC[e][i] = oldval[i]; /* ... = VS */ + state->VACC[e][i] = oldval[i]; /* ... = VS */ return; } #endif diff --git a/Frameworks/lazyusf/lazyusf/si/si_controller.c b/Frameworks/lazyusf/lazyusf/si/si_controller.c index 2b653c7df..4ce1ce4cc 100644 --- a/Frameworks/lazyusf/lazyusf/si/si_controller.c +++ b/Frameworks/lazyusf/lazyusf/si/si_controller.c @@ -23,6 +23,8 @@ #include "usf/usf_internal.h" +#include "usf/barray.h" + #include "si_controller.h" #include "api/m64p_types.h" @@ -52,6 +54,16 @@ static void dma_si_write(struct si_controller* si) { *((uint32_t*)(&si->pif.ram[i])) = sl(si->ri->rdram.dram[(si->regs[SI_DRAM_ADDR_REG]+i)/4]); } + + if (si->r4300->state->enable_trimming_mode) + { + for (i = 0; i < PIF_RAM_SIZE; i += 4) + { + unsigned int ram_address = si->regs[SI_DRAM_ADDR_REG] + i; + if (!bit_array_test(si->r4300->state->barray_ram_written_first, ram_address / 4)) + bit_array_set(si->r4300->state->barray_ram_read, ram_address / 4); + } + } update_pif_write(si); update_count(si->r4300->state); @@ -81,6 +93,16 @@ static void dma_si_read(struct si_controller* si) si->ri->rdram.dram[(si->regs[SI_DRAM_ADDR_REG]+i)/4] = sl(*(uint32_t*)(&si->pif.ram[i])); } + if (si->r4300->state->enable_trimming_mode) + { + for (i = 0; i < PIF_RAM_SIZE; i += 4) + { + unsigned int ram_address = si->regs[SI_DRAM_ADDR_REG] + i; + if (!bit_array_test(si->r4300->state->barray_ram_read, ram_address / 4)) + bit_array_set(si->r4300->state->barray_ram_written_first, ram_address / 4); + } + } + update_count(si->r4300->state); if (si->r4300->state->g_delay_si) {