Commit Graph

22641 Commits

Author SHA1 Message Date
Chris Siebert 85f90604bd
Fixed behavior of SHA, SHX, SHY, and SHS in NesHawk (squshed PR #4309)
* Fixed incorrect behavior of SHA, SHX, SHY, and SHS

Opcodes $93, $9B, $9C, $9E, and $9F, also referred to as the "Unstable High Byte Group", all rely on the High Byte of the target address being incremented internally when the processor adds the X or Y register as an offset, and this new value of the high byte is ANDed with the value being stored.

* Fixed a typo

In the comment made for private byte H, changed the word "varaible" to "variable"

* Added H to the 6502 SyncState

Added H to the 6502 SyncState, which is used during the final cycles of a few unofficial instructions.

* Updated LxaConstant for Chip6510.cs

This now passes Disk2.d64's "LXAB" test.
Does this need to change in Drive1541.cs as well?

* Updated AneConstant for Chip6510.cs

This now passes Disk2.d64's "TRAP1" test.
Does this need to change in Drive1541.cs as well?

* Updated the 6502's unstable high byte group for RDY beahvior.

SHA, for example, typically writes a value of A & X & H, but if the RDY line is low 2 cycles before the write occurs, (tested with a DMC DMA) the value written is just A & X. To recreate that behavior, H is set to $FF if the RDY line is low during that particular stage of the instruction.

* Removed trailing whitespace added in previous commit

* The 6502 ext_ppu_cycle variable is now updated in NesHawk

The ext_ppu_cycle was only used in SubNesHawk, though it would still appear in the tracelogger for NesHawk, just always with a value of 0.
This value is now incremented at the end of runppu() in PPU.cs, and reset at the beginning of a frame inside DoFrame() of SubNesHawk, and FrameAdvance() for NesHawk.

* Fixed formatting of a line added in the previous commit.

Added spaces around the equal sign.

* Added the 6502 address bus, and DMC DMA Halt cycles occur on the correct cycles

Added the 16 bit address bus as a public variable to Execute.cs
The 6502 Address Bus is not updated by the DMC DMA or OAM DMA.
The DMC DMA's "halt cycles" and "put cycles" read from wherever the 6502 address bus currently is. This can result in extra reads from read-sensitive PPU and APU registers.
Likewise, APU Register Activation is tied to the 6502 address bus. (Previously using the value of the PC, as the address bus will be the value of the PC during OAM DMAs)

* Removed unnecessary includes

I have no idea what added these, but it was a mistake.

* Added the 6502 address bus to the SyncState

Added the 6502 address bus to the SyncState

* Updated controller strobing and clocking

Controllers only get strobed when the CPU transitions from a get cycle to a put cycle.
Controllers only get clocked if the previous CPU cycle was not reading from the controller port.

* Updating timing of clearing the Frame Counter Interrupt Flag

The Frame Counter Interrupt Flag is only cleared on "put" cycles.
This can be detected by running an instruction that double-reads address $4015, such as the unofficial SLO $4015, X instruction. The Value in the A register after that instruction will have different results depending on if the cycle this ran on was a get or a put cycle, since the flag is only cleared on the put cycle after the read occured.

* Update src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Execute.cs

Co-authored-by: YoshiRulz <OSSYoshiRulz+GitHub@gmail.com>

* Update src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Execute.cs

Co-authored-by: YoshiRulz <OSSYoshiRulz+GitHub@gmail.com>

* Update src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Execute.cs

Co-authored-by: YoshiRulz <OSSYoshiRulz+GitHub@gmail.com>

* Update src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Execute.cs

Co-authored-by: YoshiRulz <OSSYoshiRulz+GitHub@gmail.com>

* Update src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Execute.cs

Co-authored-by: YoshiRulz <OSSYoshiRulz+GitHub@gmail.com>

* Update src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Execute.cs

Co-authored-by: YoshiRulz <OSSYoshiRulz+GitHub@gmail.com>

* Update src/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.cs

Co-authored-by: YoshiRulz <OSSYoshiRulz+GitHub@gmail.com>

* Update src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/APU.cs

Co-authored-by: YoshiRulz <OSSYoshiRulz+GitHub@gmail.com>

* Update src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs

Co-authored-by: YoshiRulz <OSSYoshiRulz+GitHub@gmail.com>

* Update src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs

Co-authored-by: YoshiRulz <OSSYoshiRulz+GitHub@gmail.com>

* Fixed a typo

* Updated formatting, and fixed a potential bug.

Two read cycles in a row, one from either controller port, will still clock both controllers once.

* Update src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs

Co-authored-by: YoshiRulz <OSSYoshiRulz+GitHub@gmail.com>

* Updated sprite evaluation for misaligned OAM

If a write to $2003 occurs on a visible scanline before sprite evaluation, the initial index into OAM for the evaluation will not begin at OAM index 0. If the OAM index was not a multiple of 4 when this occurs, an interesting phenomenon becomes visible, where the lower two bits of the OAM index are cleared if the Y position is out of range for the scanline. Surprisingly, the X position makes this same "in range" check, resulting in the lower two bits being cleared if not in range.

* Updated glitchy increment of OAM index when writing to $2004

When this occurs, reg_2003 needs to increment, and this also results in a bitwise AND with $FC.

---------

Co-authored-by: YoshiRulz <OSSYoshiRulz+GitHub@gmail.com>
2025-06-14 17:34:42 +10:00
feos 4636cd8cd7 add doom script 2025-06-12 18:43:48 +03:00
feos 9143bdcee1 dsda: expose linedef coords 2025-06-12 18:43:48 +03:00
YoshiRulz 9214e2418e
Change lazy init of `HeaderKeys.AllValues` in preparation for C# 14 2025-06-10 15:31:43 +10:00
YoshiRulz 933d626a95
Simplify enumeration of NesHawk `[MapperProp]`s 2025-06-10 15:29:57 +10:00
Daniel Peter Rutschmann 3ab4a96404
Make the number of frames per TAStudio rewind configurable (squashed PR #4319)
* allow a TAStudio rewind to go back a configurable number of frames.

* rename FramesPerRewind to RewindStep.

* make whitespace consistent.

Use tabs for regular lines, but use spaces in argument lists that are formatted as one argument per line.

* remove tiny designer resizes.

* refactor isFastForwarding variables in main form.

* refactor isFastForwarding variables in main form, v2.

Copy IsFastForwarding into a local variable to minimize recalculations.

* add doc string to MainForm.IsFastForwarding.

* refactor if statement shape in TAStudio.MenuItems.cs .
2025-06-10 13:45:27 +10:00
YoshiRulz 95a01894de
Fix line endings in `Bk2MnemonicLookup.cs`
fixes 513c1ca8e
2025-06-10 00:03:38 +10:00
feos ffb469540e dsda: expose linedefs as mem domain 2025-06-09 01:27:51 +03:00
YoshiRulz bda2c2b5a0
When processing `--lua` flag, treat unknown file extensions as scripts 2025-06-08 15:55:15 +10:00
feos df708a3a8e order 2025-06-07 18:32:19 +03:00
feos 8b43c98657 dsda: fix reading OUT OF BOUNDS of mobj_t 2025-06-07 18:28:11 +03:00
YoshiRulz f2ccc9af90
Simplify `DSDA.PutSettings`
fixes a150bb433
2025-06-08 00:36:53 +10:00
feos 2dfdd8f7c3 mute 2 complaints 2025-06-07 16:57:34 +03:00
feos a150bb433a is this overkill? 2025-06-07 15:37:41 +03:00
feos 4f8beb5536 cleanup 2025-06-07 15:36:59 +03:00
feos 6ab684dba6 cleanup 2025-06-07 12:37:21 +03:00
feos 7a50343173 ok 2025-06-07 12:05:35 +03:00
feos 987a9f96f8 dsda: get input format from db 2025-06-07 11:53:11 +03:00
feos 513c1ca8ed dsda: raven defaults and mnemonics
rename controller so all 3 games can share binds
2025-06-07 10:17:20 +03:00
YoshiRulz 971fc61c42
Corrections to notes re: Analyzers/linting in the contribution guide 2025-06-07 12:36:42 +10:00
YoshiRulz f576e320bb
Update some links in the contribution guide 2025-06-07 12:33:03 +10:00
feos 0a8b57cf55 dsda: flylook buttons 2025-06-06 23:33:36 +03:00
feos 1783c28fc2 dsda: expose raven inventory selection 2025-06-06 21:29:38 +03:00
YoshiRulz b68649ed70
Fix mixed line endings in `DSDA.IVideoProvider.cs`
fixes 2d2318356
2025-06-06 10:00:05 +10:00
SuuperW 61b44d72ba
Simplify movie stopping+saving logic, fixing bug where opening a new movie while in recording mode in TAStudio would save the current movie even if the user said not to. (#4341) 2025-06-05 22:55:10 +02:00
feos e82d5fcd08 reduce copypaste
ideally this thing would be stored as a bitfield but we have to keep the bool for each player separated in syncsettings
2025-06-05 20:57:33 +03:00
feos 58d6dea596 dsda: things got too wide 2025-06-05 20:41:18 +03:00
feos 0d40ea955e dsda: fix fist selection for boom compat
initially I read the code wrong. `demo_compatibility` means vanilla complevel, not "demo is running". for vanilla hitting 1 would switch to first only if you have berserk, otherwise it'd stick to chainsaw (provided you have it of course). that part was working ok. but for boom compat hitting 1 swaps fist and chainsaw at all times, and that part was broken: chainsaw would not get selected even if you have it.

pass button values directly (same can be done for arti)
2025-06-05 20:34:16 +03:00
YoshiRulz ad7dd09a82
Remove line-end whitespace in `DOSBox.cs`
fixes d09d215aa
2025-06-06 00:00:28 +10:00
feos d09d215aa0 dosbox: don't shrink the image
it'd arguably make sense to shrink, if we could downscale it with some smooth algo. this is based on the fact that on a CRT monitor you also see scanlines at fixed thickness (unless you adjust the output) and only width is variable (and depends on pixel density + size of overscan). so upscaling 240p by exactly 2 and then adjusting with made sense on the paper (and it's what we do for CRT encodes). but hawk can't default to a smooth algo, and it can't only apply it on shrink while everything is resized using point. so it's better to just never shrink and let height also be variable. that's kinda what everyone else is doing anyway.
2025-06-05 16:52:10 +03:00
Morilli c2b767f1f8 check MovieEndAction on savestate load
- closes #4346
2025-06-05 06:23:10 +02:00
Morilli f4eb779883 simplify MovieSession.HandleLoadState
also partially reverts c57657bbd4
2025-06-05 06:22:33 +02:00
Morilli ef2ce91527 fix potential exception in AutosaveSaveRAMSeconds setter
previous default was 0 which is now disallowed
2025-06-05 01:02:21 +02:00
Morilli 21e4636eec fix missing dispose in LoadSaveRam
fixes 291dd80c27
2025-06-05 00:32:30 +02:00
CasualPokePlayer 156fb5062b Rebuild SDL2 Linux 2025-06-04 14:44:41 -07:00
Morilli 6aa7f325d1 bump SDL2 and libusb
SDL2: ~2.31 => 2.32.8
libusb: 1.0.27 => 1.0.29

someone else rebuild linux with proper glibc version
2025-06-04 22:57:26 +02:00
Morilli 18c29ca57c refactor saveram saving error handling in CloseGame
The previous code did nothing when a new rom was loaded or the emulator was closed. Now the user at least gets the chance to try again, however much that will help.
2025-06-04 22:23:39 +02:00
Morilli 1b7e858977 Harden FlushSaveRam
more try = more catch. Disk errors while writing saveram are rare and probably user error, but they're unrecoverable and shouldn't crash the emulator outright.

See #4258 and #1466
2025-06-04 22:00:49 +02:00
Morilli 291dd80c27 refactor LoadSaveRam
The code will now consider both autosaveram and normal saveram files on load. Normal saveram is preferred unless an autosave exists that is more recent than the normal save, in which case the user is prompted to select which saveram to load.
2025-06-04 21:23:55 +02:00
Morilli f1ecb13249 ensure autosaveram interval is always set and fix off-by-1 2025-06-04 19:38:24 +02:00
Morilli 93fbb0202c bump minimum AutoSaveRAM interval to 1 second
I don't think we need the option to backup saveram every frame
2025-06-04 19:10:26 +02:00
Morilli 150fc2f4c2 don't check SaveRamModified on shutdown
let's flush the saveram unconditionally instead of relying on SaveRamModified which could get unset from autosaves or elsewhere

see also #4344
2025-06-04 18:51:04 +02:00
Morilli a2cf4e0797 clarify semantics and implementation of ISaveRam.SaveRamModified 2025-06-04 18:51:04 +02:00
feos 5fa597ad8a dsda: fix automap inputs crashing outside level
update settings descriptions
2025-06-04 16:14:56 +03:00
YoshiRulz abba6ed260
Add help on changing peripherals to TAStudio's `Columns` menu
see #2449
2025-06-03 10:49:35 +10:00
YoshiRulz bc0090f414
Move TAStudio `Columns` > `Show Player #` into those submenus
resolves #2449
2025-06-03 10:22:43 +10:00
YoshiRulz c5c760afa6
Change behaviour of TAStudio `Columns` > `Show Player #`
partially reverts b62f4bc6a
see #2449
No longer hides the submenu, and toggling individual columns updates the
whole-player checkbox, which is now tri-state.
Same for the "Show Keys" item.
And after all that, Mono doesn't distinguish Indeterminate :P
2025-06-03 10:22:36 +10:00
YoshiRulz 094adb0cb0
Some refactors to `TAStudio.SetUpToolStripColumns` 2025-06-03 10:10:01 +10:00
YoshiRulz b4105f9423
Add `IEnumerable<bool>.Unanimity` extension 2025-06-03 10:10:01 +10:00
YoshiRulz bb7e5bc02c
Add Meziantou.Polyfill 2025-06-03 10:10:01 +10:00