core: Fix accurate multiplication loading (home menu and savestate)
Some checks are pending
citra-build / source (push) Waiting to run
citra-build / linux (appimage) (push) Waiting to run
citra-build / linux (appimage-wayland) (push) Waiting to run
citra-build / linux (fresh) (push) Waiting to run
citra-build / macos (arm64) (push) Waiting to run
citra-build / macos (x86_64) (push) Waiting to run
citra-build / macos-universal (push) Blocked by required conditions
citra-build / windows (msvc) (push) Waiting to run
citra-build / windows (msys2) (push) Waiting to run
citra-build / android (googleplay) (push) Waiting to run
citra-build / android (vanilla) (push) Waiting to run
citra-build / docker (push) Waiting to run
citra-format / clang-format (push) Waiting to run
citra-transifex / transifex (push) Waiting to run

This commit is contained in:
PabloMK7 2026-01-22 14:44:49 +01:00
parent 94b558d3f1
commit b0fea112e8
7 changed files with 17 additions and 5 deletions

View File

@ -269,6 +269,8 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {
LoadDiskCacheProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0);
system.GPU().ApplyPerProgramSettings(program_id);
std::unique_ptr<Frontend::GraphicsContext> cpu_context;
system.GPU().Renderer().Rasterizer()->LoadDefaultDiskResources(stop_run,
&LoadDiskCacheProgress);

View File

@ -18,6 +18,7 @@
#include "core/3ds.h"
#include "core/core.h"
#include "core/frontend/framebuffer_layout.h"
#include "core/loader/loader.h"
#include "core/perf_stats.h"
#include "input_common/keyboard.h"
#include "input_common/main.h"
@ -78,6 +79,10 @@ void EmuThread::run() {
emit LoadProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0);
u64 program_id{};
system.GetAppLoader().ReadProgramId(program_id);
system.GPU().ApplyPerProgramSettings(program_id);
system.GPU().Renderer().Rasterizer()->LoadDefaultDiskResources(
stop_run, [this](VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total) {
emit LoadProgress(stage, value, total);

View File

@ -474,6 +474,10 @@ int LaunchSdlFrontend(int argc, char** argv) {
}
});
u64 program_id{};
system.GetAppLoader().ReadProgramId(program_id);
system.GPU().ApplyPerProgramSettings(program_id);
std::atomic_bool stop_run;
system.GPU().Renderer().Rasterizer()->LoadDefaultDiskResources(
stop_run, [](VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total) {

View File

@ -403,8 +403,6 @@ System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::st
kernel->UpdateCPUAndMemoryState(program_id, app_mem_mode, app_n3ds_hw_capabilities);
gpu->ReportLoadingProgramID(program_id);
// Restore any parameters that should be carried through a reset.
if (auto apt = Service::APT::GetModule(*this)) {
if (restore_deliver_arg.has_value()) {
@ -902,13 +900,15 @@ void System::serialize(Archive& ar, const unsigned int file_version) {
gpu->SetInterruptHandler(
[gsp](Service::GSP::InterruptId interrupt_id) { gsp->SignalInterrupt(interrupt_id); });
// Switch the shader cache to the title running when the savestate was created
// Apply per program settings and switch the shader cache to the title running when the
// savestate was created.
const u32 thread_id = gsp->GetActiveClientThreadId();
if (thread_id != std::numeric_limits<u32>::max()) {
const auto thread = kernel->GetThreadByID(thread_id);
if (thread) {
const std::shared_ptr<Kernel::Process> process = thread->owner_process.lock();
if (process) {
gpu->ApplyPerProgramSettings(process->codeset->program_id);
gpu->Renderer().Rasterizer()->SwitchDiskResources(process->codeset->program_id);
}
}

View File

@ -693,6 +693,7 @@ Result GSP_GPU::AcquireGpuRight(const Kernel::HLERequestContext& ctx,
Common::Hacks::HackAllowMode::DISALLOW) != Common::Hacks::HackAllowMode::DISALLOW;
auto& gpu = system.GPU();
gpu.ApplyPerProgramSettings(process->codeset->program_id);
gpu.GetRightEyeDisabler().SetEnabled(right_eye_disable_allow);
gpu.PicaCore().vs_setup.requires_fixup = requires_shader_fixup;
gpu.PicaCore().gs_setup.requires_fixup = requires_shader_fixup;

View File

@ -311,7 +311,7 @@ GraphicsDebugger& GPU::Debugger() {
return impl->gpu_debugger;
}
void GPU::ReportLoadingProgramID(u64 program_ID) {
void GPU::ApplyPerProgramSettings(u64 program_ID) {
auto hack = Common::Hacks::hack_manager.GetHack(
Common::Hacks::HackType::ACCURATE_MULTIPLICATION, program_ID);
bool use_accurate_mul = Settings::values.shaders_accurate_mul.GetValue();

View File

@ -94,7 +94,7 @@ public:
return *right_eye_disabler;
}
void ReportLoadingProgramID(u64 program_ID);
void ApplyPerProgramSettings(u64 program_ID);
private:
void SubmitCmdList(u32 index);