diff --git a/core/hw/sh4/dyna/blockmanager.cpp b/core/hw/sh4/dyna/blockmanager.cpp index 18844836d..ee076c04d 100644 --- a/core/hw/sh4/dyna/blockmanager.cpp +++ b/core/hw/sh4/dyna/blockmanager.cpp @@ -220,180 +220,11 @@ void bm_DiscardBlock(RuntimeBlockInfo* block) block_ptr->Discard(); } -#if 0 -bool UDgreaterX ( RuntimeBlockInfo* elem1, RuntimeBlockInfo* elem2 ) -{ - return elem1->runs > elem2->runs; -} - -bool UDgreaterLOC ( RuntimeBlockInfo* elem1, RuntimeBlockInfo* elem2 ) -{ - return elem1->addr < elem2->addr; -} - -u32 FindPath(RuntimeBlockInfo* rbi, u32 sa,s32 mc,u32& plc) -{ - if (mc < 0 || rbi==0) - return 0; - - plc++; - if (rbi->BlockType==BET_Cond_0 || rbi->BlockType==BET_Cond_1) - { - u32 plc1=plc,plc2=plc,v1=0,v2=0; - if (rbi->BranchBlock>sa) - { - v1=FindPath(bm_GetBlock(rbi->BranchBlock),rbi->addr,mc-rbi->guest_cycles,plc1); - } - v2=FindPath(bm_GetBlock(rbi->NextBlock),rbi->addr,mc-rbi->guest_cycles,plc2); - if (plc1>plc2) - { - plc=plc1; - return rbi->guest_cycles+v1; - } - else - { - plc=plc2; - return rbi->guest_cycles+v2; - } - - } - else if (rbi->BlockType==BET_StaticJump) - { - if (rbi->BranchBlock>sa) - return rbi->guest_cycles+FindPath(bm_GetBlock(rbi->BranchBlock),rbi->addr,mc-rbi->guest_cycles,plc); - else - { - return rbi->guest_cycles; - } - } - else - { - if (plc!=1) - INFO_LOG(DYNAREC, "Chain lost due to %d", rbi->BlockType); - else - INFO_LOG(DYNAREC, "Chain fail due to %d", rbi->BlockType); - return rbi->guest_cycles; - } -} -u32 total_saved; -void FindPath(u32 start) -{ - RuntimeBlockInfo* rbi=bm_GetBlock(start); - - if (!rbi || !rbi->runs) - return; - - u32 plen=0; - u32 pclc=FindPath(rbi,start,SH4_TIMESLICE,plen); - if (plen>1) - { - total_saved+=(plen-1)*2*rbi->runs; - INFO_LOG(DYNAREC, "%08X: %d, %d, %.2f, %.2f",start,pclc,plen,pclc/(float)plen,plen*2*rbi->runs/1000.f); - } - rbi->runs=0; -} -#endif - -u32 rebuild_counter=20; void bm_Periodical_1s() { bm_CleanupDeletedBlocks(); - - if (rebuild_counter>0) rebuild_counter--; -#if HOST_OS==OS_WINDOWS && 0 - std::sort(all_blocks.begin(),all_blocks.end(),UDgreaterX); - - map vmap; - map calls; - - u32 total_runs=0; - for(int i=0;iruns; - if (rbi->BranchBlock!=-1 && rbi->BranchBlock < rbi->addr) - { - if (rbi->BlockType==BET_Cond_0 || rbi->BlockType==BET_Cond_1 || rbi->BlockType==BET_StaticJump) - { - RuntimeBlockInfo* bbi=bm_GetBlock(all_blocks[i]->BranchBlock); - if (bbi && bbi->runs) - { - vmap[all_blocks[i]->BranchBlock]=bbi->runs; - } - } - - if (rbi->BlockType==BET_StaticCall) - { - RuntimeBlockInfo* bbi=bm_GetBlock(all_blocks[i]->BranchBlock); - if (bbi && bbi->runs) - { - calls[all_blocks[i]->BranchBlock]+=rbi->runs; - } - } - } - verify(rbi->NextBlock>rbi->addr); - } - - map::iterator iter=vmap.begin(); - - total_saved=0; - u32 total_l_runs=0; - while(iter!=vmap.end()) - { - FindPath(iter->first); - total_l_runs+=iter->second; - iter++; - } - - for(int i=0;iruns=0; - - INFO_LOG(DYNAREC, "Total Saved: %.2f || Total Loop Runs: %.2f || Total Runs: %.2f",total_saved/1000.f,total_l_runs/1000.f,total_runs/1000.f); -#endif } -#if 0 -void constprop(RuntimeBlockInfo* blk); -void bm_Rebuild() -{ - return; - - die("this is broken in multiple levels, including compile options"); - - void RASDASD(); - RASDASD(); - - blkmap.clear(); - - std::sort(all_blocks.begin(),all_blocks.end(),UDgreaterLOC); - - for(size_t i=0; iaddr&0x3FFFFFFF)>0x0C010100); - - if (all_blocks[i]->staging_runs<0 && do_opts) - { -//#if HOST_OS==OS_WINDOWS - //constprop(all_blocks[i]); -//#endif - } - ngen_Compile(all_blocks[i],NoCheck,false,all_blocks[i]->staging_runs>0,do_opts); - - blkmap.insert(all_blocks[i]); - verify(bm_GetBlock((RuntimeBlockInfo*)all_blocks[i]->code)==all_blocks[i]); - - FPCA(all_blocks[i]->addr)=all_blocks[i]->code; - } - - for(size_t i=0; iRelink(); - } - - rebuild_counter=30; -} -#endif - void bm_vmem_pagefill(void** ptr, u32 size_bytes) { for (size_t i=0; i < size_bytes / sizeof(ptr[0]); i++) diff --git a/core/hw/sh4/dyna/driver.cpp b/core/hw/sh4/dyna/driver.cpp index d2ff9bfca..7f1542755 100644 --- a/core/hw/sh4/dyna/driver.cpp +++ b/core/hw/sh4/dyna/driver.cpp @@ -353,17 +353,6 @@ u32 DYNACALL rdv_DoInterrupts_pc(u32 pc) { next_pc = pc; UpdateINTC(); - //We can only safely relocate/etc stuff here, as in other generic update cases - //There's a RET, meaning the code can't move around - //Interrupts happen at least 50 times/second, so its not a problem .. - /* - if (rebuild_counter == 0) - { - // TODO: Why is this commented, etc. - //bm_Rebuild(); - } - */ - return next_pc; } diff --git a/core/nullDC.cpp b/core/nullDC.cpp index f26a295d5..22c457250 100755 --- a/core/nullDC.cpp +++ b/core/nullDC.cpp @@ -37,7 +37,6 @@ static bool rtt_to_buffer_game; static bool safemode_game; static bool tr_poly_depth_mask_game; static bool extra_depth_game; -static bool full_mmu_game; static bool disable_vmem32_game; cThread emu_thread(&dc_run, NULL); @@ -139,16 +138,15 @@ void LoadSpecialSettings() safemode_game = false; tr_poly_depth_mask_game = false; extra_depth_game = false; - full_mmu_game = false; disable_vmem32_game = false; - if (reios_windows_ce || !strncmp("T26702N", reios_product_number, 7)) // PBA Tour Bowling 2001 + if (reios_windows_ce || settings.dreamcast.ForceWindowsCE + || !strncmp("T26702N", reios_product_number, 7)) // PBA Tour Bowling 2001 { INFO_LOG(BOOT, "Enabling Full MMU and Extra depth scaling for Windows CE game"); settings.rend.ExtraDepthScale = 0.1; extra_depth_game = true; settings.dreamcast.FullMMU = true; - full_mmu_game = true; settings.aica.NoBatch = true; } @@ -595,6 +593,7 @@ void InitSettings() settings.dreamcast.broadcast = 4; // default settings.dreamcast.language = 6; // default settings.dreamcast.FullMMU = false; + settings.dreamcast.ForceWindowsCE = false; settings.dynarec.SmcCheckLevel = FullCheck; settings.aica.DSPEnabled = false; settings.aica.LimitFPS = LimitFPSEnabled; @@ -680,8 +679,8 @@ void LoadSettings(bool game_specific) settings.dreamcast.broadcast = cfgLoadInt(config_section, "Dreamcast.Broadcast", settings.dreamcast.broadcast); settings.dreamcast.language = cfgLoadInt(config_section, "Dreamcast.Language", settings.dreamcast.language); settings.dreamcast.FullMMU = cfgLoadBool(config_section, "Dreamcast.FullMMU", settings.dreamcast.FullMMU); - if (settings.dreamcast.FullMMU) - // Not really related but full mmu games are usually using Windows CE, which requires NoBatch + settings.dreamcast.ForceWindowsCE = cfgLoadBool(config_section, "Dreamcast.ForceWindowsCE", settings.dreamcast.ForceWindowsCE); + if (settings.dreamcast.ForceWindowsCE) settings.aica.NoBatch = true; settings.aica.LimitFPS = (LimitFPSEnum)cfgLoadInt(config_section, "aica.LimitFPS", (int)settings.aica.LimitFPS); settings.aica.DSPEnabled = cfgLoadBool(config_section, "aica.DSPEnabled", settings.aica.DSPEnabled); @@ -817,8 +816,7 @@ void SaveSettings() cfgSaveInt("config", "Dreamcast.Cable", settings.dreamcast.cable); cfgSaveInt("config", "Dreamcast.Region", settings.dreamcast.region); cfgSaveInt("config", "Dreamcast.Broadcast", settings.dreamcast.broadcast); - if (!full_mmu_game || !settings.dreamcast.FullMMU) - cfgSaveBool("config", "Dreamcast.FullMMU", settings.dreamcast.FullMMU); + cfgSaveBool("config", "Dreamcast.ForceWindowsCE", settings.dreamcast.ForceWindowsCE); cfgSaveBool("config", "Dynarec.idleskip", settings.dynarec.idleskip); cfgSaveBool("config", "Dynarec.unstable-opt", settings.dynarec.unstable_opt); if (!safemode_game || !settings.dynarec.safemode) diff --git a/core/rend/gui.cpp b/core/rend/gui.cpp index 7a281787a..3e92f928a 100644 --- a/core/rend/gui.cpp +++ b/core/rend/gui.cpp @@ -1244,6 +1244,9 @@ static void gui_display_settings() ImGui::Checkbox("HLE BIOS", &settings.bios.UseReios); ImGui::SameLine(); ShowHelpMarker("Use high-level BIOS emulation if BIOS files are not found"); + ImGui::Checkbox("Force Windows CE", &settings.dreamcast.ForceWindowsCE); + ImGui::SameLine(); + ShowHelpMarker("Enable full MMU emulation and other Windows CE settings"); #ifndef _ANDROID ImGui::Checkbox("Serial Console", &settings.debug.SerialConsole); ImGui::SameLine(); diff --git a/core/types.h b/core/types.h index e608bf785..d8fdc436b 100644 --- a/core/types.h +++ b/core/types.h @@ -608,6 +608,7 @@ struct settings_t u32 language; // 0 -> JP, 1 -> EN, 2 -> DE, 3 -> FR, 4 -> SP, 5 -> IT, 6 -> default std::vector ContentPath; bool FullMMU; + bool ForceWindowsCE; } dreamcast; struct