fix: correct Little Nightmares 3 TitleID check for PC to LR recovery

The TitleID check was broken due to using || operator which evaluated
to 1 instead of a title ID value, preventing the recovery mechanism
from working.

- Fix title_ids.h: Replace incorrect || expression with proper
  LittleNightmares3Base constant (0x010066101A55A000)
- Update physical_core.cpp: Use GetBaseTitleID() to match both
  base and update title ID variants

This now correctly identifies Little Nightmares 3 and enables the
recovery mechanism that sets PC to LR when detecting null pointer
execution loops.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
Zephyron
2025-11-11 20:05:07 +10:00
parent 57e6141d4a
commit 69f3225fa8
2 changed files with 7 additions and 2 deletions

View File

@@ -14,7 +14,9 @@ private:
public:
static constexpr u64 FinalFantasyTactics = 0x010038B015560000ULL;
static constexpr u64 LittleNightmares3 = 0x010066101A55A800ULL || 0x010066101A55A000ULL;
// Base title ID for Little Nightmares 3 (covers both 0x010066101A55A800 and 0x010066101A55A000)
// The base title ID is obtained by masking with 0xFFFFFFFFFFFFE000
static constexpr u64 LittleNightmares3Base = 0x010066101A55A000ULL;
};
} // namespace UICommon

View File

@@ -6,6 +6,7 @@
#include "citron/util/title_ids.h"
#include "core/core.h"
#include "core/debugger/debugger.h"
#include "core/file_sys/common_funcs.h"
#include "core/hle/kernel/k_process.h"
#include "core/hle/kernel/k_thread.h"
#include "core/hle/kernel/kernel.h"
@@ -136,7 +137,9 @@ void PhysicalCore::RunThread(Kernel::KThread* thread) {
// Detect null pointer execution loop (PC in very low memory addresses)
// Only apply this recovery fix for Little Nightmares 3 to avoid issues with other games
if (current_pc < 0x1000 && program_id == UICommon::TitleID::LittleNightmares3) {
// Check if the base title ID matches Little Nightmares 3 (covers both base and update variants)
if (current_pc < 0x1000 &&
FileSys::GetBaseTitleID(program_id) == UICommon::TitleID::LittleNightmares3Base) {
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");