361 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 a33b8b2712 Debugger: GSU - Added profiler support (#261)
This is implemented by pretending every 16 bytes in ROM is a different function, allowing the profiler to display cycle counts for each individual "function" in the UI
Also fixes a missing call to ResetFlags for the merge opcode for FX3
2026-08-27 19:00:55 +09:00
SourMesen 8ac7e1df7d Lua: Fixed address value in memory callbacks when using memory types other than the default cpu memory type (#265)
Also fixed a few scenarios where the PPU memory write callbacks did not allow the Lua script to change the value about to be written (because the callback was called too late)
2026-08-27 19:00:22 +09:00
SourMesen ad0a1b9849 Lua: Misc. fixes & improvements (#250)
-Fixed getAccessCounters documentation (swapped param order)
-Fixed file watcher not being disabled properly when closing the script window, causing the script to run if changed on the disk, even if the script window is closed
-Prevent file watcher from triggering from writes done by the script window itself (which caused the script to be reloaded 2 or 3 times in a row)
-Fixed UI freezes when using emu.log() on a large table
-Fixed crash when 100k character limit (in the last 500 lines) for script log was reached (out of bounds read/write)
-Added "fps" value to "getState"
-Slightly improved getAccessCounters/getCdlData performance
-Added a new drawPixels API to improve performance when a script needs to draw a lot of individual pixels
2026-08-10 22:42:34 +09:00
SourMesen 9219fab3ed Debugger: Profiler - Keep track of cycles executed while the CPU is halted (#243)
Also adds a "cpu usage" meter in the debugger window which appears when software makes uses of halt/wai/etc.
2026-08-01 12:10:12 +09:00
SourMesen 05d74e7e40 Debugger: GBA - Show byte code as a single 16/32-bit value (#242)
Misc fixes:
-Fixed issues with the opcode tooltip not appearing for some GBA instructions (esp. when the condition code ends with an 's', e.g: rsbcs, movls, subcs)
-Fixed byte code not being lower case when the "use lower case" option is enabled
2026-08-01 12:09:15 +09:00
SourMesen 918379b7a7 Debugger: Tilemap viewer - Added option to pick background color (#238)
Also, minor bug fixes for WS:
-Fixed tilemap viewer for sometimes using the wrong background color
-Fixed the 4-bit RGB color values in the palette viewer having the R and B values swapped
2026-07-28 19:55:12 +09:00
SourMesen 8fc682325c Debugger: Lua - Added getPressedKeys API (#236)
Also:
-Improved emu.log() to support tables/array and numeric values, instead of only strings.
-Fixed duplicate save state key name for GB
-Fixed TrimRight logic not working properly when the string had a single non-space character followed by spaces (e.g TrimRight("A ") returned "A ")
2026-07-28 19:54:00 +09:00
SourMesen 58cb540644 Debugger: Profiler - Fixed some cycles from NMI/IRQ being applied to the function that was running when the NMI/IRQ was triggered (#209) 2026-07-11 15:35:27 +09:00
SourMesen 46be3cc430 Debugger: SNES - Fixed DSP-n trace logger not logging the correct instructions (#186)
Also fixes missing "exec" highlight for "DSP-n Program ROM" in the memory viewer
2026-06-21 20:33:41 +09:00
SourMesen c3e4a3e77b Debugger: Find all occurrences - Fixed duplicated results when searching a function label that contains a multi-line comment (#134) 2026-05-24 19:36:50 -07:00
NovaSquirrel 4380777010 GB: Add GBC palette to memory viewer (#93) 2026-05-10 10:29:18 +09:00
NovaSquirrel 464122d077 Debugger: Lua - Include numeric keys when printing tables (#81) 2026-05-03 15:28:35 -07:00
SourMesen d9833a92d5 Debugger: Lua - Fixed emulator crash when calling error() in a script with anything other than a string (#64)
Convert the value given by the script to error() to a string instead of assuming it's a string (and crashing)
2026-04-30 06:47:10 -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
SourMesen 4b8669d34b Debugger: Tilemap viewer - Fixed "edit tile" behavior on SNES when the tilemap is using 16x16 (or 16x8) tiles (#72)
Also, added support for horizontal/vertical mirroring when editing the mirrored tiles from the tilemap.
2026-04-27 09:18:53 -07:00
SourMesen 8e4dd329ac Debugger: Lua - Added new APIs: getCpuState, setCpuState, getMasterClock, getCpuCycleCount (#58)
getCpuState/setCpuState allow the same functionality as getState/setState, but limited to only the CPU's state, making them much faster (some performance optimizations to the serialization & Lua code were also done)
getMasterClock/getCpuCycleCount are very fast alternatives to getState when all the script needs is a cycle count.
2026-04-26 18:00:08 -07:00
SourMesen e4aa6fa945 Debugger: NES - Show Namco 163's audio RAM in memory viewer, breakpoints, etc. (#57)
* Debugger: NES - Show Namco 163's audio RAM in memory viewer, breakpoints, etc.

* Fixed crash when debugging NSF files

* Limit mapper ram to $180 bytes and 0-init all of the "bios" region that's mapped to CPU ram (4100-41FF)
2026-04-23 06:13:13 -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
NovaSquirrel 2ea2ed729c Debugger: Add "Vertical" tile layout option 2026-02-26 23:20:18 -05:00
Sour 80b1ee330a Debugger: SNES - Fixed deadlock when resetting the game while paused, when the "break on power/reset" option is disabled 2025-07-07 00:19:34 +09:00
Sour c1fe01129d PCE: CPU accuracy improvements based on hardware captures
-Replaced dummy reads with idle cycles where needed
-Fixed order of operation for some instructions
-Fixed IRQ timing (was 10 cycles, should be 8)
-Tweaked VDC timings to match test roms after the IRQ timing changes
2025-06-30 22:00:58 +09:00
Sour 0ae5f26d0c Debugger: GBA - Realign disassembly to multiples of 4 bytes when disassembling unknown blocks in ARM mode 2025-06-17 21:20:22 +09:00
Sour fbf1882f8f Debugger: Fixed audio sometimes looping endlessly after execution pauses 2025-05-14 20:53:06 +09:00
Sour de8a0819d6 Debugger: SNES - Fixed stack overflow crash when hitting a SPC breakpoint 2025-05-06 12:29:55 +09:00
Sour 176f14ae33 GBA: Fixed missing sprites in Guranbo's character name screen
The game sets the sprites to obj mode 3 (by mistake?), which is an unused "stereoscopic" mode for sprites. Mode 3 seems to behave like mode 0 when the global "stereoscopic" flag is not set (previously "green swap"), so the sprites are meant to display normally in this scenario (instead of being hidden like they were before)
2025-04-26 18:20:47 +09:00
Sour 045a0e01b9 Debugger: Lua - Fixed emulator crash when callback triggers an error and is allowed to repeat a large number of times 2025-04-24 17:45:16 +09:00
Sour a17a97fb7b Debugger: Lua - Support small arrays in getState/setState
This is needed to e.g have access to the GBA CPU's registers, etc.
Also hid some internal GBA state from getState to improve performance
2025-04-15 22:43:52 +09:00
Sour f1117c1b06 Debugger: Lua - emu.getPixel shouldn't set alpha channel to 255 2025-04-12 23:50:07 +09:00
Sour 01f62b8c38 Windows: Write log window and debug log messages to stdout on windows, too 2025-04-11 17:11:56 +09:00
Sour bf7872a7ae Linux: Show log window and debug log content in terminal 2025-04-10 18:11:01 +09:00
Sour 48e8332258 Tests: Fixed minor issues when running tests 2025-04-04 17:48:17 +09:00
Sour 36bd1611c6 Debugger: Catch up APU for all consoles when breaking, to allow register viewer/etc. to display up-to-date values 2025-04-03 22:41:27 +09:00
Sour 7267e28e21 Debugger: GBA - Added option to configure whether unidentified code/data is disassembled as arm/thumb 2025-03-31 18:11:29 +09:00
Sour 1975ab958c Debugger: Fixed crashes when switching between games from different consoles (in AOT build)
Caused by what looks like slight differences between how AOT treats an empty array (vs JIT builds) when it marshals the array (AOT sends a null pointer, JIT sends a pointer to an empty array)
This was causing issues in both builds (AOT crashed immediately because of the null pointer, JIT read from out-of-bounds memory)
2025-03-28 18:03:30 +09:00
Sour 2d96724b28 Debugger: SNES - Added new "break on..." options
Invalid vram/oam/cgram access, controller read while auto-read is running
2025-03-27 21:30:38 +09:00
Sour ad548465c6 Debugger: NES - Added new "break on..." options
Invalid VRAM access, Invalid OAM write, DMA controller read, Unstable opcodes
2025-03-27 21:16:02 +09:00
Sour 9e5d013c84 Debugger: Minor performance improvements for debugger initialization 2025-03-26 21:25:34 +09:00
Sour f359b80eb5 Debugger: Assembler - Allow using #label syntax on NES/SNES/PCE
This used to be allowed in Mesen-S
2025-03-13 18:32:46 +09:00
Sour f7ca5d06fb Debugger: Prevent rewind/step back from changing the value of frozen addresses 2025-02-11 20:48:52 +09:00
Sour 031cb7058c Debugger: Fixed issues with NES/SNES/PCE assemblers
-Labels defined within the assembler that were referred to before their definition did not work properly and ended up being assigned the wrong value (when the label's address wasn't a value between 0x100 and 0xFFFF) - this is fixed by running multiple passes until the resulting byte code stops changing.
-Fixed issues where e.g EOR $00, Y would be assembled as a 2-byte instruction, which is invalid.
2025-02-06 21:20:24 +09:00
Sour 43ff951e83 Debugger: Fixed crash in GetMemoryValues
When start is not 0 and end is beyond the max size, memset would write out of bounds.
Caused by the previous tile viewer fix
2025-01-21 18:35:49 +09:00
Sour 30ece8ec62 Debugger: Fixed broken tile viewer output with some size combinations
If the number of rows and columns did not result in an amount of bytes that was a power of 2, the viewer would incorrectly repeat some tiles, etc.
This was broken by performance fixes done a few months ago
2025-01-20 17:56:51 +09:00
Sour 18269da46b SNES: Add support for Sufami Turbo games 2025-01-03 09:18:59 +09:00
Sour 8d6830a70a SNES: Add support for ST018 coprocessor
Used by a single game: Hayazashi Nidan Morita Shougi 2
2024-12-29 23:41:52 +09:00
Sour 59f106b8cc SNES: Fixed NMI/IRQ timing issues
Passes all NMI/IRQ tests: demo_irqtest, demo_nmitest, irq, nmi, test_irq, test_irq4200, test_irq4209, test_irqb, test_nmi,
Also fixes timing issues with WAI
2024-12-24 17:43:09 +09:00
Sour c447eaf997 Debugger: Improve call stack/profiler behavior when dealing with some types of stack manipulation 2024-12-17 18:52:17 +09:00
Sour 1e3422b69e Debugger: Profiler - Show [irq]/[nmi] markers on functions 2024-12-17 18:51:01 +09:00
Sour 8ad34343ba Debugger: Prevent UI freeze when viewer updates pile up and end up taking up 100% of the UI thread's time
Prevent queueing another update while the previous update is still running, which should prevent most issues.
Also slightly improves performance for the SNES tilemap viewer (which was causing the freeze when displaying an 8bpp 1024x1024 tilemap)
2024-12-10 18:59:13 +09:00
Sour 614e61a2d1 Debugger: Fixed issues with step over/out in some scenarios (bank swapping, recursive functions, etc.)
Only break when both the stack pointer and the return address match what the debugger was expecting, instead of just the return address
2024-12-07 17:46:28 +09:00