From 5763da184ca682e65d6df6efd376102df80ec9b4 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Wed, 12 Dec 2018 12:40:04 +0100 Subject: [PATCH] Fix bug in WriteMemBlock_nommu_ptr when size is not word-aligned Bump max opaque polygon to 8192 (alpilot) Minor lr backport and clean up Fix corruption in doa2[m] and alpilot Fix missing sound in Jambo Safari --- core/hw/arm7/arm7.cpp | 8 ++++---- core/hw/maple/maple_devs.cpp | 6 +++--- core/hw/pvr/ta_ctx.h | 2 +- core/hw/sh4/interpr/sh4_interpreter.cpp | 9 --------- core/hw/sh4/sh4_core_regs.cpp | 9 ++------- core/hw/sh4/sh4_mem.cpp | 22 +++++++++++++++------- 6 files changed, 25 insertions(+), 31 deletions(-) diff --git a/core/hw/arm7/arm7.cpp b/core/hw/arm7/arm7.cpp index ddb2d3dc4..801eecac1 100644 --- a/core/hw/arm7/arm7.cpp +++ b/core/hw/arm7/arm7.cpp @@ -2010,10 +2010,10 @@ extern "C" void CompileCode() if (op_flags & OP_SETS_PC) armv_imm_to_reg(R15_ARM_NEXT,pc+4); - #if HOST_CPU==CPU_X86 - if ( !(op_flags & OP_SETS_PC) ) - armv_imm_to_reg(R15_ARM_NEXT,pc+4); - #endif +#if HOST_CPU==CPU_X86 + if ( !(op_flags & OP_SETS_PC) ) + armv_imm_to_reg(R15_ARM_NEXT,pc+4); +#endif armv_intpr(opcd); diff --git a/core/hw/maple/maple_devs.cpp b/core/hw/maple/maple_devs.cpp index 1536ae963..0a073c86d 100755 --- a/core/hw/maple/maple_devs.cpp +++ b/core/hw/maple/maple_devs.cpp @@ -9,6 +9,9 @@ #include "hw/pvr/spg.h" #include +#include "deps/zlib/zlib.h" +#include "deps/xxhash/xxhash.h" + #if _ANDROID #include #include @@ -22,9 +25,6 @@ #define LOGJVS(...) #endif -#include "deps/zlib/zlib.h" -#include "deps/xxhash/xxhash.h" - #define SAVE_EPROM 1 const char* maple_sega_controller_name = "Dreamcast Controller"; diff --git a/core/hw/pvr/ta_ctx.h b/core/hw/pvr/ta_ctx.h index 2ade5ca05..4aaa76fad 100644 --- a/core/hw/pvr/ta_ctx.h +++ b/core/hw/pvr/ta_ctx.h @@ -203,7 +203,7 @@ struct TA_context rend.verts.InitBytes(4 * 1024 * 1024, &rend.Overrun, "verts"); //up to 4 mb of vtx data/frame = ~ 96k vtx/frame rend.idx.Init(120 * 1024, &rend.Overrun, "idx"); //up to 120K indexes ( idx have stripification overhead ) - rend.global_param_op.Init(4096, &rend.Overrun, "global_param_op"); + rend.global_param_op.Init(8192, &rend.Overrun, "global_param_op"); rend.global_param_pt.Init(4096, &rend.Overrun, "global_param_pt"); rend.global_param_mvo.Init(4096, &rend.Overrun, "global_param_mvo"); rend.global_param_tr.Init(10240, &rend.Overrun, "global_param_tr"); diff --git a/core/hw/sh4/interpr/sh4_interpreter.cpp b/core/hw/sh4/interpr/sh4_interpreter.cpp index 5cc1454a2..d4dd59820 100644 --- a/core/hw/sh4/interpr/sh4_interpreter.cpp +++ b/core/hw/sh4/interpr/sh4_interpreter.cpp @@ -238,15 +238,6 @@ int DreamcastSecond(int tag, int c, int j) return SH4_MAIN_CLOCK; } -int UpdateSystem_rec() -{ - //WIP - if (Sh4cntx.sh4_sched_next<0) - sh4_sched_tick(448); - - return Sh4cntx.interrupt_pend; -} - //448 Cycles (fixed) int UpdateSystem() { diff --git a/core/hw/sh4/sh4_core_regs.cpp b/core/hw/sh4/sh4_core_regs.cpp index 7bcd1d2d5..3c7a80152 100644 --- a/core/hw/sh4/sh4_core_regs.cpp +++ b/core/hw/sh4/sh4_core_regs.cpp @@ -47,14 +47,9 @@ bool UpdateSR() { printf("UpdateSR MD=0;RB=1 , this must not happen\n"); sr.RB =0;//error - must always be 0 - if (old_sr.RB) - ChangeGPR();//switch - } - else - { - if (old_sr.RB) - ChangeGPR();//switch } + if (old_sr.RB) + ChangeGPR();//switch } old_sr.status=sr.status; diff --git a/core/hw/sh4/sh4_mem.cpp b/core/hw/sh4/sh4_mem.cpp index e02a38336..cb9287004 100644 --- a/core/hw/sh4/sh4_mem.cpp +++ b/core/hw/sh4/sh4_mem.cpp @@ -248,6 +248,7 @@ void WriteMemBlock_nommu_dma(u32 dst,u32 src,u32 size) } else { + verify(size % 4 == 0); for (u32 i=0;i>2]); + u32 left = size - i; + if (left >= 4) + { + WriteMem32_nommu(dst + i, src[i >> 2]); + i += 4; + } + else if (left >= 2) + { + WriteMem16_nommu(dst + i, ((u16 *)src)[i >> 1]); + i += 2; + } + else + WriteMem8_nommu(dst + i, ((u8 *)src)[i++]); } } }