57 Commits
Author SHA1 Message Date
SourMesen ea606ecb5f NES: Fixed default CHR mappings when game uses CHR RAM (#198)
Some games/mappers never update CHR banking, which caused previous changes done for performance to make 0000-1FFF open bus instead of being mapped to CHR RAM by default. The mappings need to be set after UpdatePageSizes is called.
2026-06-28 13:35:29 +09:00
Fiskbit eaab6b1a7b NES: Fix CHR-RAM for iNES ROMs when using the database. (#165)
CHR-NVRAM coming out of the database is -1 if not present, which causes the sum of the two types of CHR-RAM to be the wrong size.
2026-06-04 15:11:04 -07:00
Fiskbit 6203e2e3e9 NES: Improve CHR-NVRAM support. (#158)
* NES: Improve CHR-NVRAM support.

Right now, Mesen uses the NES 2.0 CHR-NVRAM field simply to enable battery saves for the volatile CHR-RAM type, so it only cares if it's zero or nonzero. This means that a game using CHR-NVRAM needs to specify volatile CHR-RAM to get the CHR-NVRAM it's actually requesting. Mesen also doesn't currently distinguish between CHR-RAM types in any way; there is a single CHR-RAM memory type and so it's not capable of saving just some of CHR-RAM. The only contemporary game that uses CHR-NVRAM, RacerMate Challenge II, has both types.

This change makes Mesen sum the two CHR-RAM types and save all of the data. This is still not correct, as it doesn't make sense to specify both types of CHR-RAM for any mapper other than mapper 168, but it will at least allow correctly-specified headers to work. It also allows RacerMate Challenge II to get the full 64 KiB of CHR-RAM (normally 32 KiB of each type) that it requests when using NES 2.0 ROMs, and it now saves however much of this is CHR-NVRAM (either the 2nd half or all of it).

This change also makes the log window print the CHR-NVRAM size as "CHR save RAM" if nonzero.

* Make it always print CHR save RAM size for NES 2.0.
2026-06-03 00:04:27 -07:00
SourMesen c4582f3f09 NES: Misc. performance improvements (#144)
-Slightly improved performance for all mappers using expansion audio (removed virtual call + inlined code)
-Slightly improvement performance for bank switching logic in BaseMapper, improves MMC5 performance because it can swap CHR banks on each scanline
2026-05-28 00:21:46 -07:00
SourMesen f5f790d6e1 NES: Improve CPU read performance for most common case (#145)
Modified NesMemoryManager & BaseMapper to allow inlining the read logic when the CPU is e.g executing code from ROM. This speeds up execution by around 5%.
2026-05-27 21:59:12 -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
Sour 57f898da5c Debugger: Lua - Fixed performance issues with getState on NES when used with mappers that support flash saves 2025-05-22 21:26:00 +09:00
Sour 198df38982 Debugger: NES - Unmap memory when both read/write are blocked
This prevents the memory from appearing in the cpu/ppu memory space in the memory viewer (and prevents reads/writes from being highlighted, etc.), making it behave like any unmapped/open bus section
2025-04-10 17:28:44 +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 d751502a58 NES: Added Rainbow support (mapper 682) 2024-10-08 21:37:44 +09:00
Sour 7ed5fd5562 NES: Added EPSM support 2024-10-01 20:57:06 +09:00
Sour de20208abe NES: Added option to enable CPU test mode registers 2024-09-28 16:55:45 +09:00
Sour 4c1579d8fd NES: Small performance improvements 2024-09-26 22:41:57 +09:00
Sour c77415581f NES: Disable Game Genie bus conflicts emulation when running an unknown iNES 1.0 ROM
Otherwise, Game Genie codes that could have worked on hardware did not work as expected because of the bus conflicts. This could occur when e.g trying to use cheats on a romhack, etc.
2024-07-20 21:39:16 +09:00
Sour cc892e5fc7 NES: Fixed MMC5 crashes when header defines no CHR ROM
+ Added missing variables to save state
2023-08-14 19:05:22 +09:00
Sour 6798a22fee Debugger: NES - Fixed crash when disassembling
When disassembling unverified code, the 1FFF->2000 transition returned address -1:NesInternalRam which caused an invalid access to src.Cache[-1]
2023-07-07 08:40:57 +09:00
Sour fa49e40306 Debugger: NES - Fixed crash when importing DBG files containing symbols with an address > 2^31 2023-06-21 18:18:41 +09:00
Sour 036a8bfb7b NES: Fixed crashes when loading a save state on a game that doesn't match the one it was saved from 2023-02-08 21:11:01 -05:00
Sour 03983c1494 Debugger: Memory viewer - NES - Allow "view in ppu memory" for palette ram 2023-01-30 20:56:35 -05:00
Eldred Habert 097e2d40c7 Fix build errors with GCC (#2)
* Delete libevdev as well with `make clean`
* Fix explicit specialization is non-namespace scope
* Fix declaration of CgbFlag changing its meaning
* Fix declaration of NesHeader changing its meaning
2023-01-28 17:59:08 -05:00
Sour 7108bdde36 Refactoring - Moved some leftover files out of the root folder 2022-09-08 21:48:49 -04:00
Sour 152abf690b Rename stdafx.h to pch.h 2022-09-08 21:29:52 -04:00
Sour aca122dde0 Debugger: NES - Fixed issues with famicombox's bigger system ram 2022-08-29 21:03:44 -04:00
Sour 0de17a6df1 Debugger: MemoryType::Register refactoring 2022-08-29 20:29:12 -04:00
Sour ca602a4749 NES: Added UI to configure dip switches 2022-08-28 15:52:42 -04:00
Sour 54956326f8 NES: Refactored nametable code to avoid resizing nametable ram (which caused crashes in debugger) 2022-08-27 12:03:34 -04:00
Sour 623892d6c3 Fixed ram init logic to ensure the correct config option is used when loading a game 2022-07-25 22:04:44 -04:00
Sour 8354f48357 NES: Rename some functions/variables to match nomenclature used in the rest of the code 2022-07-24 20:31:19 -04:00
Sour 77692f323d Fixed behavior when loading an invalid rom while a rom is loaded, fixed battery save behavior when switching between games, fix/cleanup some TODOs 2022-07-21 16:12:24 -04:00
Sour b456170551 Save states: Serializer rework/rewrite 2022-07-20 00:40:32 -04:00
Sour 69350fea6b NES: Implemented break on bus conflict option 2022-07-13 22:17:00 -04:00
Sour 437a88d0c3 Debugger: Memory Tools - Added "view in [mem type]" action 2022-06-25 11:44:18 -04:00
Sour a31eb671ac Input: Support for barcode readers and tape recorders (NES) 2022-03-15 22:39:30 -04:00
Sour e74a132ac9 NES: Fixed CHR RAM behavior 2022-03-12 19:51:31 -05:00
Sour 7c25bbf4b4 Refactoring: NES - removed old debugger functions 2022-01-22 12:23:09 -05:00
Sour dffbd4921a Refactoring: Renamed SnesMemoryType 2022-01-22 12:16:10 -05:00
Sour 0d78c064f3 Core: Reduce shared_ptr usage, refactor netplay code to remove static instances 2022-01-21 21:25:33 -05:00
Sour 1f8a9875a4 Debugger: NES - Fixed GetPpuAbsoluteAddress sometime returning CHR ROM address for CHR RAM-only game
_chrRomSize was set even though _chrRom was an empty array
2022-01-10 19:50:16 -05:00
Sour 5b4c3eeacc NES: Don't give save/work ram automatically when GetSaveRamSize/GetWorkRamSize is overridden + dynamic nametable ram size for debugger 2022-01-08 16:19:20 -05:00
Sour 3d14313183 Debugger: Breakpoint improvements, enable ppu breakpoints for NES, performance tweaks for debugger 2022-01-08 16:02:59 -05:00
Sour e5a2388911 Register viewer 2021-07-01 21:55:28 -04:00
Sour ff825fc4de Tilemap viewer 2021-06-22 20:12:37 -04:00
Sour 8c7f0a2cfa Fixed init order for mappers (e.g mmc3) 2021-05-10 19:27:09 -04:00
Sour f1944fd51a Added MMC3/MMC5 2021-05-08 13:13:18 -04:00
Sour c2df0ef553 Console region refactoring/changes 2021-04-27 23:30:00 -04:00
Sour 5c07d87d3a VS system todo fixes/refactoring 2021-04-26 23:44:32 -04:00
Sour 0479d6f90a VS system/dualsystem (missing palette and proper audio/video option support) 2021-04-25 14:12:10 -04:00
Sour b4aefda1d2 Battery save fixes 2021-04-21 20:46:21 -04:00
Sour 7293249cdd Reset / power cycle 2021-04-15 21:32:04 -04:00
Sour 12bf5c5e1b NES/GB/SNES config, audio filters 2021-04-11 18:50:31 -04:00