Fix: Make PC return recovery title-specific for Little Nightmares 3

The PC < 0x1000 recovery mechanism introduced in commit fbb4f5c0
was causing issues for other games. This change restricts the recovery
to only apply when the title ID matches Little Nightmares 3.

- Add LittleNightmares3 title ID constant to title_ids.h
- Check program ID before applying PC return recovery in physical_core.cpp
- Recovery now only triggers for Little Nightmares 3 (010066101A55A800)
  to avoid affecting other games

Fixes issues caused by the general PC return recovery in other titles.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
Zephyron
2025-11-10 20:00:55 +10:00
parent d78c598927
commit 85a41cba46
2 changed files with 7 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ private:
public:
static constexpr u64 FinalFantasyTactics = 0x010038B015560000ULL;
static constexpr u64 LittleNightmares3 = 0x010066101A55A800ULL;
};
} // namespace UICommon

View File

@@ -3,6 +3,7 @@
#include "common/scope_exit.h"
#include "common/settings.h"
#include "citron/util/title_ids.h"
#include "core/core.h"
#include "core/debugger/debugger.h"
#include "core/hle/kernel/k_process.h"
@@ -130,8 +131,12 @@ void PhysicalCore::RunThread(Kernel::KThread* thread) {
interface->GetContext(ctx);
u64 current_pc = ctx.pc;
// Get the program ID (title ID) to check if this fix should apply
u64 program_id = process->GetProgramId();
// Detect null pointer execution loop (PC in very low memory addresses)
if (current_pc < 0x1000) {
// Only apply this recovery fix for Little Nightmares 3 to avoid issues with other games
if (current_pc < 0x1000 && program_id == UICommon::TitleID::LittleNightmares3) {
LOG_WARNING(Core_ARM, "Null pointer execution detected at PC={:016X}", current_pc);
LOG_WARNING(Core_ARM, "Attempting to recover by returning from invalid function call");