158 Commits
Author SHA1 Message Date
hunterk f049089880 initial libretro-ization. Some things partial/nonexistent
fix linking, rename lib, prep for GB/C

get more consoles working. PCE still not there

fix PCE hucard loading; CD still broken

fix PCE CD loading and firmware. SGB still not quite there

get SGB working

add gitlab recipe for libretro buildbot
2026-08-29 10:21:13 -05:00
SourMesen e5075abe29 Runahead: Fixed issue causing runahead X to behave like runahead X-1 for all cores (except NES) (#219)
An additional frame's worth of input lag was added by runahead because of the timing at which it loads/saves the state vs when the inputs are polled (NES core was not affected due to the timing at which it polls controllers compared to other cores)

Also fixed a SNES-specific runahead issue when the game starts a very long DMA before vblank that ends after vblank, causing some frames to not be rendered at all and showing older frames instead (this is a rare scenario, but caused issues in Star Fox)
2026-07-15 05:09:22 -07:00
SourMesen 6c54ae1989 Video: Support for VRR in borderless fullscreen (Windows only) and improved frame pacing (#178)
* Video: Add support for VRR when in borderless fullscreen mode (Windows only) and improve frame pacing

* Fixed debug stats not disappearing when unchecking option in some scenarios

* Changed frame pacing graph scale/logic to show the gap between the ideal pacing and the current pacing (within +/- 2ms)
2026-06-21 01:29:30 -07:00
SourMesen c28dc969bd NES: Fixed screen size when loading a PAL game using the "Auto" aspect ratio (#168)
On the NES, loading a PAL game with the "auto" aspect ratio, powering off the console, and then loading a PAL game again would result in the screen being the incorrect aspect ratio/ratio, until the user's mouse goes over the menu, or the window is resized, etc. This was caused by the region being reset to NTSC when the game is unloaded, despite the screen keeping the PAL aspect ratio's dimensions,.
2026-06-06 11:16:56 -07:00
SourMesen 37de357b75 NES: FDS - Performance improvements (#143)
-ProcessCpuClock was used to check for events that don't need to be checked that often (auto-switch disk + auto fast-forward options). This has been moved to an EndFrame callback.
-This was even slower than intended because of the call to _emu->GetFrameCount() which was, relatively speaking, fairly slow. To improve its performance (since it's used rarely for some things like turbo button processing), a separate GetFrameCount function was added on all console classes, and Emulator::GetFrameCount was also optimized to be faster when called from the emulation thread.

When the auto-switch disk option is enabled, this can improve performance by about 25-30%. When the option is not enabled, this still improves performance by 4-5%.
2026-05-27 04:02:54 -07:00
NovaSquirrelandSour 325c78fcbd GB: Link cable support with two local consoles (#77)
* GB: Link cable support with two local consoles

* GB: Fix crash when color blending is enabled

* GB: Fix formatting

* GB: Link UI fixes, control fixes, audio fixes

Copied from Sour's branch. Also a separate change to use separate savefiles.

* GB: Try to avoid crashes from buffer overflows

* GB: Separate savefiles with linked multiplayer

* GB: Add support for faster link speed

* GB: Move enum to correct file

* GB: Refactor, move serial transfer to function

* -Fixed secondary console sometimes running far ahead of the main console when frame counters did not match (e.g because one console had their LCD disabled longer, etc.) This would cause buffer overflows in the audio buffer.
-Fixed screen tearing when both consoles are not perfectly in sync (because of the LCD being disabled for a different amount of time, etc.)
-Fixed main console not calling PlayQueuedAudio properly mid-frame
-Reuse VS Dualsystem code to merge audio/video when possible/simple and moved that to AvMergeUtilities

Some visual glitches can appear on the secondary screen (for GB) while rewinding, but this can't really be fixed.

* Fixed warning (unused local variable)

* Prevent loading single-console save states when in dual-console modes

* Disable debugger for VS DualSystem's subconsole. Fixes issues when debugging VS DualSystem games

* Code cleanup

* Rework solution to disable debugger on second console to improve performance
Added InternalRunFrame for nes & gb to avoid checking for the presence of the second console after each cpu instruction

* Don't enable the linked GB option by default

* Removed unused function

* Netplay: Force game to reload after updating emulation settings when connecting to the server (or when the host changes game)
This ensures that e.g the GB link cable setting is applied and that the game loads correctly, regardless of the client's link cable settings (otherwise the game could load without the link mode enabled, etc.)

---------

Co-authored-by: Sour <[email protected]>
2026-05-15 02:35:27 -07:00
NovaSquirrel 6312748563 SNES: Add Turbo File Twin support (#109)
* SNES: Add Turbo File Twin support

* SNES: Try to make write mode flag more accurate

Hardware tests on Turbo File Twin seem to be showing that if you write data then it stops reporting that the write flag is on, despite letting you write more data

* SNES: Move bit array access to a utility

Also add note about how bit 26 in STF report is not fully verified

* SNES: Add behavior seen when reading without read command

When you turn the strobe on and off outside of a read command, the shift register gets reloaded with the most recently read or written byte

* NES, SNES: Emulator::SaveBattery() for saving console and controller

* Fix range limit in SetBitInArray

* Add notes about unknown aspects of TFII mode

* Add comments to make it clear what's unknown

* STF mode ignores out-of-range addresses

Also allocate _data instead of putting it in the class
2026-05-15 00:05:31 -07:00
SourMesen 893c0d4a2c Movies: Fixed missing input recording/playback for the first frame after power cycle (#90)
* Movies: Fixed missing input recording/playback for the first frame after power cycle
This didn't cause any obvious issues, because it would only matter if a significant button was pressed during the first frame. But when exporting a movie from the history viewer, the first frame's input was actually part of the .mmo file, causing every input to be offset by 1 frame when the movie was played back (which caused desyncs). The movie recording/playback was initialized too late, after the first frame's input was initialized, causing it to be skipped entirely. Using the new "AfterInitConsole" notification, which is triggered slightly earlier, instead of "GameLoaded" allows the first frame's input to be recorded/played properly

This also fixes a rare emulator crash that could occur when you power cycle while letting go of the rewind button at the same time (that I triggered by rewinding while the movie was playing a frame that had a power cycle input)

* Fixed more desync issues (when recording movies from "current state", and when exporting movies from the history viewer)

* Fixed warning

* Fixed backward-compatibility with movies recorded before these fixes
2026-05-10 17:58:21 -07:00
SourMesen e391fd8f9a Code: Add auto-formatting rules for C++ (clang-format) and enforce in CI via "clang-format" and "dotnet format" (#78)
* Code: Add auto-formatting rules for C++ projects (clang-format) and enforce code style via "clang-format" and "dotnet format"

* fix ui format warnings
2026-04-30 06:03:55 -07:00
Fiskbit a9f7c64e41 GB: Use correct BIOS when switching between GB and SGB. (#40)
When switching between GB and SGB models and then power cycling, the old BIOS would continue being used for the new model. This fixes that for GB and any other firmware where a similar problem may have come up.

Thanks to Sour for this fix.
2026-04-18 19:08:23 -07:00
Sour 5f6c362a93 WS: EEPROM - Add delay when processing read/write/erase commands 2025-07-13 20:58:09 +09:00
Sour 186e112c36 BPS: Fixed potential crashes when applying BPS patches 2025-06-24 20:56:40 +09:00
Sour a9a0b788db Debugger: Test runner - Initialize debugger immediately after loading the rom, instead of 1 frame later 2025-03-29 10:33:37 +09:00
Sour a2637ef2d4 Debugger: Fixed labels getting erased when spamming reload rom shortcut 2025-03-24 22:02:15 +09:00
Sour dd94362d29 Audio player: Use console time to detect X seconds of silence, rather than real time
Player was skipping to next track when pausing for more than X seconds and then resuming playback, etc.
2025-03-24 21:19:24 +09:00
Sour 8dc389df49 NES: Runahead - Fixed issues switching disks or inserting coins with FDS/VS System 2025-02-20 18:43:56 +09:00
Sour d72658de7a NES: FDS - Fixed issues with Kosodate Gokko (unlicensed disk copying program)
+ Added option to save directly to the original rom file instead of creating .ips files (for FDS & cartridges with flashable prg/chr rom)
2025-02-19 21:27:15 +09:00
Sour 7f0831a542 GBA/SMS/WS: Fixed broken lag counter
Also make counter reset to 0 when game is reset on all consoles
2024-12-26 12:01:19 +09:00
Sour 71ecb09ffe UI: Added Firmwares tab in emulation settings to view/manage firmware files 2024-12-19 20:06:28 +09:00
Sour c5406773a0 Added WonderSwan support 2024-09-19 21:19:43 +09:00
Sour 640a215cbb GB: Added support for MBC5 rumble feature 2024-07-13 20:50:57 +09:00
Sour 852f92fd31 Debugger: Lua - Keep the first non-zero value when emu.stop + prevent crash when called multiple times 2024-04-07 09:15:48 +09:00
Sour 13acb3fe42 Added GBA support 2024-03-30 11:42:31 +09:00
Sour aa9c459630 Debugger: Step Back - Allow stepping back 1 scanline/frame at a time + remove restriction that caused step back to only work for up to 30 frames 2024-01-26 23:39:31 +09:00
Sour 5308983ebb Added SMS/GG/SG-1000 support 2023-12-14 22:23:27 +09:00
Sour 82d02c0b11 Fixed power cycle being re-attempted on every frame if rom no longer exists 2023-05-14 23:56:43 -04:00
Sour c24037a9b5 UI: Fixed screensaver not getting disabled while game is running 2023-04-22 20:58:51 -04:00
Sour 2761a5814e UI: Fixed broken screenshots in load/save state menus on NES when a hd pack is loaded 2023-04-22 20:44:25 -04:00
Sour 4ea985f4b5 When a file has an unknown extension, check for known file signatures to pick a core 2023-03-12 16:39:48 -04:00
Sour a5fa24a32e NES: Fixed loading NES roms (+ improved behavior/error message display when this happens) 2023-03-06 16:42:32 -05:00
Sour 90ae21e1ac Fixed potential deadlock in rare scenarios when loading a game 2023-03-02 19:02:46 -05:00
Sour 132c535575 Reload ROM: Fixed issue that caused the rom to not get reloaded properly for GB/PCE when the debugger was opened 2023-02-23 23:19:46 -05:00
Sour bdabb1b264 Make "reload rom" shortcut behave identically to loading the rom file manually 2023-02-21 19:17:22 -05:00
Sour 236cca1cd9 Movies: Fixed freeze when attempting to load a movie while the debugger is opened
Fixed an identical freeze when switching tracks in a HES file while the debugger is opened
2023-02-08 22:34:00 -05:00
Sour 30b91ce382 SNES: Fixed crash with roms that aren't multiple of 4kb 2023-02-08 20:07:00 -05:00
Sour c696c493cb UI: Fixed screen size/aspect issues when using power off and then loading another game for the same console (except snes) 2023-01-30 20:40:54 -05:00
Sour b4618eb47a GB: Allow loading GB/GBC/SGB save states on any of the 3 models 2023-01-30 19:50:05 -05:00
Sour 776a9f9025 NES: Show region as "Dendy" when loading a game with famiclone timings 2023-01-28 21:13:06 -05:00
Sour 3de8e0d305 Debugger: SNES - Process DSP read/writes + added option to ignore DSP reads/writes 2023-01-25 15:47:29 -05:00
Sour d449f0c641 Debugger: Added cpuType parameter for Lua events 2023-01-24 22:14:24 -05:00
Sour b2997f1857 Rewind: Keep same instance of rewindmanager to reduce potential thread safety issues 2023-01-24 20:23:41 -05:00
Sour fe90b4571d Fixed misc code TODOs 2023-01-24 18:05:50 -05:00
Sour e6b4d23f70 Rename TODOs that need to be fixed/checked before release to TODOv2 2023-01-05 14:07:08 +09:00
Sour 7fa572777c Cheats: Added cheat database 2023-01-05 12:28:30 +09:00
Sour e96d6f3ca5 NES: Added HD pack builder tool 2022-12-29 18:28:33 +09:00
Sour 9a05559eb9 Debugger: Added --testRunner support 2022-12-28 10:44:54 +09:00
Sour 9751895751 Debugger: Allow saving/loading save states without forcing the emulator to run until the next vertical blank 2022-12-27 16:29:16 +09:00
Sour 267c5f9fcc Debugger: Fixed debugger issues after trying to load a file that doesn't exist 2022-11-02 04:17:48 -04:00
Sour 247f1d82e0 Rewind: Allow rewinding while paused 2022-10-21 21:10:06 -04:00
Sour 9494aec10b Debugger: Don't reload debugger workspace from disk when power cycling 2022-10-20 22:45:47 -04:00