Fix crash in PinHandle when SMMU allocation fails and unmap queue is empty.
Previously, the code would log an error and continue looping indefinitely,
causing log spam and eventual crash. Now it returns 0 to fail gracefully.
Also fix incorrect handle check on line 219 - should check freeHandleDesc
instead of handle_description.
Signed-off-by: Zephyron <zephyron@citron-emu.org>
- Add custom_save_paths map to Settings::Values
- Implement ReadCustomSavePathValues and SaveCustomSavePathValues in Config
- Update CreateSaveDataFactory to check for custom save paths
- Support per-game title ID save path overrides
Signed-off-by: Zephyron <zephyron@citron-emu.org>
- Replace socket option assertion failures with proper error returns
- Add WSAENOPROTOOPT/ENOPROTOOPT error handling
- Fix LINGER and option value size validation
- Add Network::Errno::OTHER translation
- Implement basic Nex service stub for error code 2306-0520
Fixes crashes in Minecraft and other games when encountering unsupported
socket operations or attempting to use Nintendo's online services.
Signed-off-by: Zephyron <zephyron@citron-emu.org>
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>
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>
Major networking enhancements to improve multiplayer performance and
reduce desync issues in games like Mario Kart 8 Deluxe:
Network Performance:
- Add socket connection pooling in BSD service to reduce overhead
- Implement unreliable packet delivery for latency-sensitive game data
- Add packet reliability control for both ProxyPacket and LDNPacket
- Use ENET_PACKET_FLAG_UNSEQUENCED for small UDP packets (<1200 bytes)
Monitoring & Debugging:
- Add PacketStatistics struct to track sent/received/dropped packets
- Enhanced logging for proxy packet handling and socket lifecycle
- Periodic stats logging every 100 packets for diagnostics
Configuration:
- Update lobby_api_url and web_api_url to https://api.ynet-fun.xyz
- Add lobby API URL configuration support
Socket Management:
- Implement SocketPoolKey for efficient socket reuse
- Store domain/type/protocol info in FileDescriptor
- Max pool size limit (8 sockets per type) to prevent memory bloat
- Return closed sockets to pool when room is still connected
Protocol Updates:
- Add 'reliable' field to ProxyPacket and LDNPacket structures
- Update room.cpp packet handlers to respect reliability flags
- Maintain backward compatibility with default reliable=true
These changes significantly reduce packet latency for real-time game
traffic while maintaining reliability for control packets.
Signed-off-by: Zephyron <zephyron@citron-emu.org>
Windows auto updater failed due to:
1. File locking - can't overwrite running .exe files
2. Missing Qt 6 TLS plugins - can't connect via HTTPS
Solution:
- Implement helper batch script that applies updates after app exits
- Automate TLS plugin copying in CMake (qschannelbackend.dll, qopensslbackend.dll)
- Add enhanced SSL debugging and error messages
Windows updates now work. Linux continues to work as before.
Signed-off-by: Zephyron <zephyron@citron-emu.org>
Add support for the Skyline 32-bit modding framework by implementing
a code address offset and improving memory state verification.
Changes:
- Add CodeStartOffset constant (0x500000) applied to 32-bit code
address space types (Is32Bit and Is32BitNoMap) in KProcess::LoadFromMetadata
- Add debug logging for 32-bit syscall argument tracking in
SetProcessMemoryPermission, MapProcessCodeMemory, and
UnmapProcessCodeMemory wrapper functions
- Replace CheckMemoryStateContiguous with CheckMemoryState in
KPageTableBase::UnmapCodeMemory for more flexible memory state
verification
This implementation enables compatibility with:
- Skyline 32-bit modding framework
- CTGP-DX (Mario Kart 8 Deluxe mod)
- Other homebrew using 32-bit Skyline
Based on similar fixes in Ryujinx (commit 5e9678c8fe) and Eden emulator.
Co-authored-by: JPikachu <jpikachu.eden@gmail.com>
Co-authored-by: JPikachu <jpikachu@eden-emu.dev>
Signed-off-by: Zephyron <zephyron@citron-emu.org>
Changes:
- Add missing encryption type cases to all switch statements
- Only call CreatePatchMetaStorage() when both tables are present
- Update assertions to allow partial table combinations
Fixes loading for Hades II, Pokémon Legends: Z-A, and other games
with newer NCA structures.
Reported-by: Dr.Stug@citron-emu.org
Signed-off-by: Zephyron <zephyron@citron-emu.org>
Initialize PollFD.revents field to prevent assertion failures when
copying from read buffer. The assertion was failing because revents
contained uninitialized data from the buffer.
Thanks to Dr.Stug for providing the logs that identified this issue.
Fixes assertion failure at core\hle\service\sockets\bsd.cpp:564
Signed-off-by: Zephyron <zephyron@citron-emu.org>
- Increased heap region from 8 GiB to 12 GiB
- Fixed memory manager page reference count allocation
- Made resource region sizing dynamic for >8GB DRAM
- Increased physical address space bits to support 16GB
Signed-off-by: Zephyron <zephyron@citron-emu.org>
- Add stubbed DeleteCacheStorage function to FSP_SRV service
- Return success instead of causing assertion failure
- Prevents userspace PANIC when games attempt to delete cache storage
Signed-off-by: Zephyron <zephyron@citron-emu.org>
Support the romfslite folder type introduced in Atmosphere 1.9.5 for
memory-optimized mod loading. The emulator now detects and loads
romfslite folders the same way as romfs folders.
Signed-off-by: Zephyron <zephyron@citron-emu.org>
Add proper recovery mechanism for null pointer execution (PC < 0x1000)
by returning from invalid function calls using the Link Register instead
of blindly continuing execution.
Fixes infinite crash loop in games like Little Nightmares III.
Signed-off-by: Zephyron <zephyron@citron-emu.org>
Unify fastmem_pointer handling by using reinterpret_cast<uintptr_t>()
and std::nullopt consistently across all platforms, fixing MSVC
compilation errors with std::optional<uintptr_t> assignment.
Fixes: C2679 binary '=' operator errors on MSVC
Signed-off-by: Zephyron <zephyron@citron-emu.org>
Implements comprehensive NIM (Network Install Manager) services based on
the official Switch Brew documentation.
Changes:
- Added async interface classes: IAsyncValue, IAsyncResult,
IAsyncProgressResult, and IAsyncData for handling asynchronous operations
- Updated main nim service with all proper command names (commands 0-154)
- Replaced "Unknown" placeholders (84-134) with correct function names
- Added newer firmware commands (135-154) including download tasks,
application icon requests, and delivery info operations
- Fixed command 36: ListApplyDeltaTaskContentMeta (was duplicate name)
- Extended nim:shp service with Nintendo Account linking commands (600-601)
- Added nim:ecas command 5: GetCommonEcasSystemEventForReceivingBackgroundDownloadTask
- All services (nim, nim:eca, nim:shp, nim:ecas, ntc) verified and properly registered
This implementation accounts for all NIM-related functions across firmware
versions, providing proper stub handlers for emulator compatibility.
Reference: https://switchbrew.org/wiki/NIM_services
Signed-off-by: Zephyron <zephyron@citron-emu.org>
Boost::process is not available on Android, causing build failures.
Conditionally link it only on non-Android platforms.
Signed-off-by: Zephyron <zephyron@citron-emu.org>
- Convert fastmem_pointer assignments from raw pointers to uintptr_t
- Replace nullptr comparisons with std::optional::has_value()
- Use std::nullopt instead of nullptr for optional types
- Update Dynarmic submodule to commit 9d4582339
Signed-off-by: Zephyron <zephyron@citron-emu.org>
- Add parameter validation for joy_xpad_id, device_index, and npad_id
- Implement proper SixAxis resource manager integration with null checks
- Add safe fallback values to prevent crashes in motion sensor games
- Enhance error handling and logging for SixAxis sensor operations
- Address crashes in games like TOTK 1.4.2 that use motion sensors
Resolves SixAxis sensor crashes by following SwitchBrew HID service
specifications and adding proper parameter validation.
Signed-off-by: Zephyron <zephyron@citron-emu.org>