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
When the user turned on fullscreen mode without VRR enabled, then enabled the VRR option, and then turned off fullscreen mode, it would cause the screen to be black until the application is closed.
Also fixes presets/clear buttons for NTT, Pachinko & Hypershot, and improves layout for all controller config popups (buttons/borders are aligned, etc.)
* 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)
-Removed the confusing/hard-to-use "previous refresh value" "compare to" option
-The "last value" column now shows the values that "previous search value" will compare against
-Added "update values" button to apply an empty filter that does not hide any addresses, but updates the "last value" that will be used for subsequent filters
* NES: Improve OAM corruption accuracy.
Our understanding of OAM row corruption has significantly improved since Mesen's implementation of the feature that was based on oam_flicker_test.nes results. This change improves the accuracy of the two OAM corruption emulation options.
Primary OAM (OAM1) and secondary OAM (OAM2) live in the same block of memory, made up of 9-byte rows where the first 8 bytes are consecutive OAM1 bytes and the last byte is an OAM2 byte. The PPU accesses OAM on every dot. On some dots, it uses the OAM1 address ($2003), and on other dots, it uses its internal OAM2 address. If the address changes during an OAM access (the 2nd half of a dot) and this causes the selected row to change, then it can trigger either analog corruption (the new row gets 'random' data) or a row copy (the old row's 9 bytes are copied to the new row). More information can be found at nesdev.org/wiki/OAM_internals.
Address selection is fairly simple. When rendering is off, OAM1ADDR is always selected. When rendering is on, OAM1ADDR is selected on odd dots in 1-256, and otherwise OAM2ADDR is selected.
Corruption occurs on the NES in 3 situations:
1. Writing to $2003 on NTSC PPUs, because writes are not synchronized at all and so the CPU open bus value and the new value can both cause the row to change mid-access. Depending on the timing, this can do nothing, cause analog corruption, or cause row copy. This was fixed in PAL PPUs, but we don't know about Dendy.
2. Toggling rendering on an OAM2ADDR dot. Depending on the direction and the timing, this can do nothing or cause analog corruption of or row copy to the new row.
3. On 2C02E and later PPUs, having a row mismatch if rendering is enabled at the start of pre-render. This always causes a row copy from the OAM1ADDR row to the OAM2ADDR row and is required for Huge Insect to spawn enemies in level 1. (2C02C PPUs have some corruption in this situation, too, but it is not yet understood.)
This change adds support for OAM corruption in situations 1 and 2 using the "Enable PPU $2003/rendering-toggle OAM corruption" setting, which is off by default. This does not take alignment into account at all and only does row copy, not analog corruption. Recommended for developers, but probably undesirable for actual users. This setting was previously called "Enable PPU OAM row corruption emulation". Note that situation 1 ($2003 writes) is not perfectly matching blargg's oam_read test results in the most vulnerable alignment yet, suggesting there is more research to be done on this.
Situation 3 is now supported under the "Disable PPU frame-start OAM corruption (2C02D and earlier)" setting, so this corruption happens by default. Mesen was already doing some corruption here to support Huge Insect, with the previous version of this setting being called "Disable PPU OAMADDR bug emulation". These changes make the corruption more accurate and apply in more situations, so there is a chance it will break some user software, but because it is required for a game, we've opted to have it on by default. This feature should match hardware very closely, as it doesn't have the timing and analog aspects seen in situations 1 and 2.
To support these, sprite rendering was reworked a bit to more accurately manage the OAM1 and OAM2 addresses during rendering. This should make sprite rendering behavior more accurate when rendering is toggled mid-frame, although there are still inaccuracies that come up if you do this. The OAM2 address can also now be seen in the register viewer below $2003.
This was tested against a suite of NES tests, AccuracyCoin $2004 Stress Test, and oam_flicker_test.nes/oam_flicker_test_reenable.nes. The $2003-based corruption causes a few tests to change behavior when enabled (which is expected), but oam_read and related tests are not failing exactly right yet. Tests otherwise pass.
* Changes based on code review.
* Removed _spriteAddrL/_spriteAddrH members, use local variables instead.
* Simplify firstVisibleSpriteAddr assignment
---------
Co-authored-by: Sour <[email protected]>
Phase should be 0 when this option is enabled, otherwise there's still jitter from one frame to another (though less obvious jitter)
Also made the GB/GBA/WS filters alternate between the 2 phases (SNES filter is used), which makes the colors look much better, even without merge fields enabled.
The Pocket Challenge V2 is an education handheld based on the ASWAN SoC, as used in the WonderSwan. It uses the same boot ROM (with an early exit), but has some implementation changes:
The LCD icon segment area is not present (on the display panel only).
There is no onboard internal EEPROM.
The input keypad layout differs.
The headphone output is always used with a custom onboard DAC, as opposed to relying on the SoC's own PWM DAC for the internal speaker.
This PR implements support for all of this. Support for the PCv2-exclusive cartridge mapper (KARNAK) will be added by a separate PR.
* 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]>
* 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
Blending even/odd columns only allows fake transparency effects to work while avoiding a blur effect on the picture. This however does not work well in all scenarios (e.g high resolution text in Secret of Mana menus)
+Fixed some incorrect/missing validations
+Disable save button when an error message is shown
+Fixed .nes load logic ignoring PRG/CHR sizes from NES 2.0 headers (was getting overriden by game DB)
This updates the Mesen naming in title bars, the About window, and the default data folder name. It also changes copyright information to note the new contributors, changes the website to MesenCE's GitHub page, and updates the build link.
I'm not convinced I found everything, so a thorough review would be appreciated.
There was previously no auto option that would select the best model a game has any support for and which falls back to the original Game Boy if that's all the game can do. The "Auto (prefer Game Boy)" option would select Game Boy except when given a GBC-exclusive game. The new "Auto (prefer best)" option selects GBC if the game has any GBC support, SGB if it has any SGB support, and GB otherwise. This option is now selected by default.
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)