Testing and fiddling with our recent overhaul for changing OS/UI themes and updating on the fly resulting in a segmentation fault that also would not allow you to re-open the emulator unless changing back to the theme previously known by Citron, which obviously we don't want. Grabbed the core dump.
The backtrace pointed to a race condition in GMainWindow::UpdateUITheme, where a QTextStream was reading from a Qt resource stylesheet (.qss) that was being simultaneously reloaded by the theme change event. This led to an attempt to read from a dangling pointer.
This change resolves the issue by reading the entire stylesheet into memory in a single, atomic operation using f.readAll(). This prevents the underlying resource from becoming invalid during the read. The resulting QByteArray is explicitly converted to a QString via QString::fromUtf8 to satisfy Qt 6's stricter type requirements.
Signed-off-by: Collecting <collecting@noreply.localhost>
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>
Implement deferred update mechanism using a helper batch script that applies
updates after the application exits, avoiding Windows file locking issues.
On Windows, the updater now:
- Stages update files and creates a helper batch script
- Launches the script as a detached process
- Exits the application
- The script waits for app closure, applies updates, and restarts Citron
Linux AppImage updates continue to work as before with the existing method.
Signed-off-by: Zephyron <zephyron@citron-emu.org>
Fixes crashes when games/mods request more than MAX_MIP_LEVELS (14).
Implements defensive clamping at four critical points in the texture
cache (CalculateLevelSizes, CalculateMipLevelOffsets,
CalculateMipLevelSizes, CalculateLevelBytes) to gracefully handle
excessive mip level requests.
When >14 mip levels are requested:
- Logs informative warning (debug builds)
- Clamps to MAX_MIP_LEVELS
- Continues execution safely
This improves upon Eden's solution by adding actual bounds checking
instead of just converting ASSERT to ASSERT_MSG.
Fixes: CTGP-DX (Mario Kart 8 Deluxe mod)
Co-authored-by: JPikachu <jpikachu.eden@gmail.com>
Co-authored-by: JPikachu <jpikachu@eden-emu.dev>
Co-authored-by: MaranBr <maranbr@outlook.com>
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>