Commit Graph

27747 Commits

Author SHA1 Message Date
Zephyron
c847b50fb1 fix: Add defensive checks in effect context, network, and DMA
- Add bounds checking in EffectContext::UpdateStateByDspShared()
- Add try-catch around effect updates to handle corrupted data gracefully
- Fix network interface auto-selection fallback
- Add null checks in Maxwell DMA operations

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-05 16:37:28 +10:00
Zephyron
a3831e37ae fix(audio): Fix buffer underrun handling to prevent buzzing
- Repeat last valid frame during underruns instead of fading to silence
- Maintain audio continuity when buffers are temporarily unavailable
- Prevent harsh audio artifacts during loading screens (0 FPS scenarios)

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-05 16:37:08 +10:00
Zephyron
453c4b4c4f fix(audio): Improve biquad filter processing and validation
- Add bounds checking for buffer indices in Process() and Verify()
- Implement fallback for invalid output indices (in-place processing)
- Improve error logging for debugging audio issues

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-05 16:36:50 +10:00
Zephyron
f252bc351e fix(audio): Add biquad filter v2 validation and coefficient conversion
- Add buffer index validation to prevent ArgumentOutOfRange errors
- Convert fixed-point coefficients (Q14) to float for REV15+ processing
- Add state-based initialization logic for ParameterVersion2
- Validate raw buffer indices before adding buffer_offset
- Add proper state handling in command generation

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-05 16:36:28 +10:00
Zephyron
3566445012 fix(audio): Refactor ParameterVersion2 to match ParameterVersion1 structure
- Change ParameterVersion2 to use fixed-point coefficients (s16) instead of float
- Replace enable bool with ParameterState enum for consistency
- Update validation logic to use state field instead of enable
- Add state validation in Update() method
- Update UpdateForCommandGeneration() to handle both versions

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-05 16:35:43 +10:00
Zephyron
8be0c4bdfa fix(kernel): Fix dispatch count management in scheduler
- Add defensive checks in RescheduleCurrentCore() to ensure disable_count is valid
- Remove EnableDispatch() from RescheduleCurrentCoreImpl() to prevent race conditions
- Fix assertion failures during thread scheduling

Fixes kernel crashes when switching threads.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-05 16:33:15 +10:00
Zephyron
d397f379fe fix: block controller input only during loading screen
Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-03 19:15:24 +10:00
Zephyron
6064320336 fix: GuiPrivate is mandatory for linux
Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-03 18:01:21 +10:00
Zephyron
0befe129ce fix: Add missing action_exit_fullscreen member variable declaration
Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-03 12:14:45 +10:00
Zephyron
78cbfcf1a7 fix: Add safety checks for input processing and callback cleanup
- Prevent controller input processing until emulation is fully running
- Add null checks and prevent double deletion of NPAD callbacks
- Set callback_key to -1 after deletion to prevent reuse

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-03 12:12:14 +10:00
Zephyron
79fcbf536e refactor: Improve BootGame error handling and thread initialization
- Add early validation for loader and title ID with critical error logging
- Move LoadROM call outside conditional block to always execute after validation
- Move emu_thread->start() to after all signal connections are established
- Improve code flow and organization for better maintainability

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-03 12:06:54 +10:00
Zephyron
240b8f7aef fix: Add safety checks to ZSTD decompression and improve HTTP client
- Add maximum packet size limit (16 MB) to prevent memory exhaustion
- Add empty input validation for ZSTD decompression
- Improve error handling with detailed logging
- Increase HTTP timeout from 30 to 60 seconds
- Enable HTTP redirect following and keep-alive connections

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-03 12:03:06 +10:00
Zephyron
54cba480e6 feat: Add build type system and improve fullscreen exit handling
- Add CITRON_BUILD_TYPE CMake variable (Stable/Nightly)
- Refactor GenerateSCMRev to use build type instead of repo parsing
- Update window title to display build type (Nightly/Stable)
- Improve fullscreen exit hotkey using dedicated QAction

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-03 12:00:07 +10:00
Zephyron
45d58d53aa refactor: Clean up setup wizard and improve updater
- Refactor setup_wizard code (remove 100+ lines of unused code)
- Change default update channel from Stable to Nightly
- Fix Windows build detection in updater (skip PGO builds)
- Remove verbose Wayland logging from Vulkan swapchain

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-03 11:56:01 +10:00
Zephyron
ff3759409b fix: Add destruction callback to EmulatedController for safe pointer management
Add SetDestructionCallback() method to allow observers to safely null
out pointers when the controller is destroyed. This prevents use-after-free
issues in UI components.

Also includes cleanup and const correctness improvements in
configure_input_player_widget.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-03 11:51:09 +10:00
Zephyron
eb11dd8f3b Merge pull request 'feature/android-game-file-extraction' (#61) from feature/android-game-file-extraction into main
Reviewed-on: https://git.citron-emu.org/Citron/Emulator/pulls/61
2025-12-03 01:39:40 +00:00
Zephyron
5bff8ff11d fix(android): fix compilation errors in dump functions
Use VFS API for directory creation and Java Long.valueOf() for
progress callbacks. Fix variable shadowing and add JNI reference cleanup.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-29 12:20:38 +10:00
Zephyron
9c250aabda feat(android): add custom dump location selection for RomFS/ExeFS
Allow users to specify a custom directory for dumping game files via
the Android document picker, with fallback to default dump directory.
Adds optional dumpPath parameter to both dump functions and UI dialog
for location selection.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-29 09:20:40 +10:00
Zephyron
261bab49a7 feat(android): add RomFS and ExeFS dumping support
Changes:
- Add JNI functions dumpRomFS() and dumpExeFS() in native.cpp
- Add Kotlin interface methods in NativeLibrary.kt
- Add UI options in GamePropertiesFragment for dumping
- Add string resources for dump operations
- Extract files to dump/{title_id}/romfs and dump/{title_id}/exefs
- Support patched and updated game content during extraction

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-29 09:16:33 +10:00
Zephyron
32c4a9060d chore(ui): improve setup wizard and boot manager
- Change setup wizard to non-modal for better user interaction

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-28 16:12:23 +10:00
Zephyron
90eeee345c feat(filesystem): add custom save path support per game
- 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>
2025-11-28 16:11:07 +10:00
Zephyron
bb4574e5df feat(ui): redesign loading screen with game icons and improved UX
- Replace banner/logo with game icon display
- Add shader progress widget with ETA calculations
- Improve stage translations with game title support
- Update UI layout to horizontal layout with better spacing
- Add smooth fade animations for show/hide transitions

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-28 16:10:28 +10:00
Zephyron
8e9b179b55 feat(ui): add tab switch animations and improve responsive layout
- Add AnimateTabSwitch method to configure dialogs with slide/fade animations
- Update responsive layout breakpoint from 550px to 850px
- Improve configure UI layout structure (accent color, rainbow mode positioning)
- Update button stylesheets for horizontal/vertical navigation modes
- Add animation includes (QPropertyAnimation, QGraphicsOpacityEffect, etc.)

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-28 16:09:25 +10:00
Zephyron
c27533949c Add update channel support (Stable/Nightly) to updater system
- Add STABLE_UPDATE_URL and NIGHTLY_UPDATE_URL constants
- Update CheckForUpdates() to read channel from QSettings
- Implement channel-aware version checking
  - Nightly: Always use commit hash from build version
  - Stable: Prioritize version.txt file, fallback to commit hash
- Update ParseUpdateResponse() to handle different API formats
  - Stable: Parse tag_name from Gitea API
  - Nightly: Extract commit hash from GitHub release name
- Update Linux AppImage updates to manage version.txt based on channel
- Remove update_url parameter from CheckForUpdates() methods
- Update main.cpp to use new CheckForUpdates() signature

The updater now supports both Stable and Nightly channels with
appropriate version checking and update source selection for each.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-22 16:56:48 +10:00
Zephyron
f2987a428b Improve UI configuration responsive layout and add update channel selector
- Add update channel combo box (Stable/Nightly) in General settings
- Store channel preference in QSettings
- Change compact layout breakpoint from 950px to 550px
- Improve layout switching logic to move screenshots group box
- Add translation support for update channel labels

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-22 16:56:32 +10:00
Zephyron
87a4d61789 Make updater dialog non-modal
Force the updater dialog to be non-modal so users can continue using
the application while checking for or downloading updates. This improves
user experience by not blocking interaction with the main window.

The dialog is explicitly set to non-modal in the constructor, overriding
any setting from the UI file.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-22 16:13:10 +10:00
Zephyron
5122b95475 Fix infinite recursion in UpdateUITheme() on Arch Linux
Add recursion guard (m_is_updating_theme) to prevent UpdateUITheme()
from entering an infinite loop when palette changes trigger recursive
theme updates. This eliminates the need for manual qt-config.ini edits
on Arch Linux systems.

The guard ensures that if UpdateUITheme() is already running, subsequent
calls will exit immediately, preventing stack overflow and application
freezing.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-22 16:13:00 +10:00
Zephyron
e881da60ef Improve UI configuration with responsive layout and UI positioning
- Add responsive layout switching (compact/wide) based on window width
- Move UI positioning combo to UI file for better maintainability
- Convert layouts to QFormLayout for better organization
- Add resizeEvent handling for dynamic layout adjustments
- Reduce minimum window size from 1000x600 to 700x600

The configuration dialog now adapts to smaller window sizes by switching
to a single-column layout when the width is less than 950px, improving
usability on smaller screens.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-22 16:12:43 +10:00
Zephyron
e3051f2fc1 Improve StyleAnimationEventFilter with padding animations
Replace simple style updates with smooth padding animations (10px ↔ 14px)
on tab button hover. Add PaddingAnimator helper class and proper
animation tracking for better visual feedback.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-22 16:01:31 +10:00
Zephyron
3f5587ea9b Add UI positioning option for configuration dialog
Allows users to switch between vertical and horizontal navigation
layouts. Includes new UI positioning setting, dynamic layout switching,
and style animation event filter for improved UX.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-21 18:55:43 +10:00
Zephyron
a9a80c956a Improve web service thread safety by creating client per request
- Change GenericRequest() to create a new httplib::Client for each request
  instead of reusing a single instance
- Remove shared client instance and mutex to avoid thread safety issues
- This is the safest approach in a multi-threaded environment and prevents
  potential race conditions

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-21 17:32:27 +10:00
Zephyron
188e2a8489 Add configuration change debouncing to game list online status updates
- Add OnConfigurationChanged() slot to debounce rapid configuration changes
- Implement 500ms timer to batch configuration update requests
- Prevents excessive network requests when multiple config changes occur
  in quick succession
- Improves performance and reduces server load

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-21 17:32:19 +10:00
Zephyron
bdab418fbf Fix hotkey configuration restore and empty key sequence handling
- Fix RestoreDefaults() to properly iterate through hotkey groups and prevent
  crashes with improved bounds checking
- Add explicit handling for empty key sequences in LoadHotkeys() to prevent
  invalid QKeySequence objects
- Improve user feedback with success message when defaults are restored

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-21 17:30:31 +10:00
Zephyron
0ce541b6ea Fix multiplayer chat room signal disconnection and cleanup
- Add Shutdown() method to ChatRoom to properly disconnect Qt signals
- Initialize room_network pointer to nullptr for safety
- Call Shutdown() in MultiplayerRoomOverlay::DisconnectFromRoom() to prevent
  signal leaks when disconnecting from rooms
- Ensures proper cleanup of chat widget connections when overlay is hidden

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-21 17:29:21 +10:00
Zephyron
fd5923753f Revert "fix: use local style.qss in colorful theme instead of relative path"
This reverts commit 82f8f09c45.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-19 13:44:39 +10:00
Zephyron
82f8f09c45 fix: use local style.qss in colorful theme instead of relative path
Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-16 11:01:45 +10:00
Zephyron
a1b317a15e fix: add Module 56 error support and improve error handling
- Add Module56 to ErrorModule enum for error code 2056-2306
- Add Module 56 error handling in fatal error reporting
- Define Module 56 error codes in ldn_results.h
- Improve error reporting for unknown modules

This allows the emulator to properly handle error code 2056-2306
reported by Minecraft and other games, preventing undefined
behavior when encountering unknown module errors.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-13 20:14:04 +10:00
Zephyron
19faff40cd fix: socket assertion crashes and add Nex service stub
- 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>
2025-11-13 19:30:40 +10:00
Zephyron
ba9dead3ee Stub VOTE_vtg implementation with warning log 2025-11-12 19:16:12 +10:00
Zephyron
16f815a7b9 Improve mouse wheel scrolling in configuration dialogs
Enable mouse wheel scrolling throughout scroll areas instead of
requiring hover over scrollbars. Add event filter to forward wheel
events to scrollbars. Fix Input tab scrolling by only consuming
wheel events in ConfigureInputPlayer when actively mapping inputs.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-12 16:41:57 +10:00
Zephyron
d3ae46a353 Fix network settings crash on Android
Register AIRPLANE_MODE setting in settingsItems map and add missing
string resources to prevent crashes when opening network options.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-12 16:15:44 +10:00
Zephyron
0b52871d9e Merge pull request 'feat: Add PC setup wizard with platform-specific paths' (#43) from feature/pc-setup-wizard into main
Reviewed-on: https://git.citron-emu.org/Citron/Emulator/pulls/43
2025-11-12 06:12:37 +00:00
Zephyron
6d1a4be09b feat: Add PC setup wizard with platform-specific paths
Implement first-run setup wizard for PC with DuckStation-style UI.
Includes installation type selection, keys/firmware installation,
game directory configuration, and platform-aware path detection
for Windows, Linux, and macOS.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-12 16:10:15 +10:00
Zephyron
a4e70c51d9 Add PGO indicator to main window title and about dialogue
Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-12 15:09:28 +10:00
Zephyron
4491abcdce chore: bump version to 0.11.0
Update version strings in about dialog and window title.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
0.11.0
2025-11-11 22:35:49 +10:00
Zephyron
69f3225fa8 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>
2025-11-11 20:05:07 +10:00
Zephyron
57e6141d4a Fix QJsonValue conversion ambiguity in game_list_worker.cpp
Explicitly cast modification_time to qint64 to resolve Linux build
error where std::int64_t conversion to QJsonValue is ambiguous.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-11 19:11:15 +10:00
Zephyron
e91b22511f Merge pull request 'Add Firmware 20.0.0-21.0.0 IPC support and stubs' (#37) from feature/firmware-20-21-support into main
Reviewed-on: https://git.citron-emu.org/Citron/Emulator/pulls/37
2025-11-11 08:53:20 +00:00
Zephyron
d59eb9a1a8 Add Firmware 20.0.0-21.0.0 IPC support and stubs
This commit implements comprehensive firmware 20.0.0 through 21.0.0
support for Citron, including:

- Updated firmware version constants to 21.0.0 in api_version.h
- Updated HID service firmware version string to 21.0.0
- Added IPC command stubs for firmware 20.0.0+ in:
  * ISystemSettingsServer (commands 263, 264, 282, 283, 289, 300, 301, 306, 307)
  * IFirmwareDebugSettingsServer (command 24)
  * IApplicationFunctions (command 330)
  * IOlscServiceForSystemService (command 914)
  * IRemoteStorageController (commands 28, 901)
  * IService (migration) (commands 2250, 2260)
  * IAudioController (command 10200)

- Created new service interfaces with proper stubs:
  * IContinuousRecorder (grcsrv) - command 5 [20.2.0+] with 0x20-byte input
  * IDownloadContext (news) - command 4 [20.0.0+]
  * INotifyService (pdm:ntfy) - commands 100, 101 [20.0.0+] returning outinterfaces

- Added all new source files to CMakeLists.txt build system
- Fixed logging tag usage (Service_Migration instead of Service_MIG)
- Added required CMIF serialization headers for proper template instantiation

All stubs return success explicitly, eliminating the need for auto-stubbing.
All implementations follow Switchbrew documentation as closely as possible.

Based on Switchbrew documentation:
- https://switchbrew.org/wiki/21.0.0
- https://switchbrew.org/wiki/20.5.0
- https://switchbrew.org/wiki/20.4.0
- https://switchbrew.org/wiki/20.3.0
- https://switchbrew.org/wiki/20.2.0
- https://switchbrew.org/wiki/20.1.5
- https://switchbrew.org/wiki/20.1.1
- https://switchbrew.org/wiki/20.1.0
- https://switchbrew.org/wiki/20.0.1
- https://switchbrew.org/wiki/20.0.0

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-11 18:52:10 +10:00
Zephyron
1127d30fd8 Fix: Restrict PC return recovery to Little Nightmares 3 with adjusted threshold
Only applies to Little Nightmares 3 (title ID: 010066101A55A800).

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-11-10 20:55:54 +10:00