46 Commits

Author SHA1 Message Date
CasualPokePlayer
c5cddc0407
RTC state machine improvements (#3459)
* Try to correct the RTC state machine to only operate on edges

Unsure if all of this is entirely right (haven't ran any tests to confirm behavior here). Fixes RTC within Pokemon games (and maybe other games) due to the added write latch code adding a _readPins call.

* More correct behavior based on testing

* Move this init to align to struct

* Correctly handle rtc output on falling edges rather than raising edges

also correctly handle rtc output in general, even in cases outside of an rtc read cmd
_outputPins needed to be corrected here, it shouldn't be reading gpioBase here...

* Simplify

* More RTC state machine fixes

Separate out command start and command write data processing
Command start processing happens again if the command magic is invalid (note: doesn't apply to the unmapped command 5)
Ensure command data processing loops
Output 1s for commands with no actual output

* Put SIO output in states

* Try to correct light sensor too

* inc state version

* fix reserved names
2025-04-29 22:48:23 -07:00
CasualPokePlayer
57d1552582 Increment state version, narrow direction in state too 2025-04-06 21:20:39 -07:00
CasualPokePlayer
3ae429fd91 Implement GPIO internal write latch
Regardless of direction, a write to GPIO data actually succeeds fully with all 4 bits. However, this does not directly touch the pin state. It instead places it into an internal write only latch. This latch asserts bits onto the pin state if direction allows for such, otherwise the other side (e.g. RTC) will be the one asserting bits (but this does not end up touching the internal write latch).

The implementation here is likely not entirely accurate for direction changes from out to in (as that depends on each external device implementation), but it should be correct for in to out changes.
2025-04-06 21:20:39 -07:00
Vicki Pfau
a5e3e746b2 GBA Unlicensed Carts: Prevent multicarts from remapping after being locked 2024-11-23 19:46:44 -08:00
Vicki Pfau
bdb0057fb3 GBA Serialize: Add support for Vast Fame state 2024-11-23 03:23:05 -08:00
Vicki Pfau
91cf829261 GBA Memory: Add initial support for N-in-1 style multicarts 2024-11-17 02:58:25 -08:00
Vicki Pfau
630e3a591a GBA SIO: Add support for side data in save states 2024-09-26 22:40:26 -07:00
Vicki Pfau
621eb4d425 GBA SIO: Move starting/end timing logic out of drivers 2024-09-26 22:40:26 -07:00
Vicki Pfau
a5ea157c9a GBA Video: Add stubs for saving/loading extra data out of the video renderers 2024-09-01 01:56:52 -07:00
Vicki Pfau
1a3873da67 GBA Serialize: Fix some minor save state edge cases
There are two edge cases fixed in this commit. The first one involves audio
FIFO DMA state not being properly updated if the game reconfigured it between
save and load. This doesn't happen often, but it could conceivably affect
custom sound engines. The second case is the extremely rare case of a save
state being taken directly after a DMA ending but before an open bus read. The
chances of this happening are negligible, but it's still a bug regargless.
2024-06-25 03:13:33 -07:00
Vicki Pfau
8545271e9e GBA Memory: Modernize constant names 2023-01-26 18:59:35 -08:00
Vicki Pfau
bb711d311f GBA Savedata: Store RTC data in savegames (closes #240) 2022-10-06 02:57:26 -07:00
Vicki Pfau
9b07a63056 All: Preliminary shift to C11 2022-08-08 12:54:49 -07:00
Vicki Pfau
6159c5a70b GBA Audio: Decrunchify GB audio 2022-06-15 20:34:06 -07:00
Vicki Pfau
f9e03e7182 GBA Memory: Implement adjustable EWRAM waitstates (closes #1276) 2022-06-07 00:05:27 -07:00
Vicki Pfau
6289c1a4d1 GBA Serialize: Fix doc error 2022-06-05 20:36:26 -07:00
Vicki Pfau
9f5267e24e GBA Audio: Claw back some performance 2022-06-03 22:36:19 -07:00
Vicki Pfau
3c0d9f7197 GBA Audio: Sample FIFOs at SOUNDBIAS-set frequency 2022-06-01 19:13:05 -07:00
Vicki Pfau
76a8f4da2b GB Audio: Migrate channel 3 into GBRunAudio 2022-06-01 01:29:33 -07:00
Vicki Pfau
68f628a211 GB Audio: Redo channels 1 and 2 2022-06-01 01:11:40 -07:00
Vicki Pfau
9a85fc8a5a Core: Frame counter should be unsigned 2022-01-15 15:30:41 -08:00
Vicki Pfau
fa2975a4ab GBA Serialization: Serials key IRQ state, update docs 2021-12-06 12:38:08 -08:00
Vicki Pfau
3309892657 GB, GBA Serialize: Attempt to fix MSVC build 2021-02-09 01:28:21 -08:00
Vicki Pfau
60b59ae312 GBA Hardware: Unpack RTC struct 2020-11-29 13:35:21 -08:00
Vicki Pfau
65fb61d7e2 GBA Memory: Improve robustness of Matrix memory support 2020-08-27 04:27:13 -07:00
Vicki Pfau
5c58186f03 GBA Audio: Revamp FIFO emulation (fixes #356, fixes #875, fixes #1847) 2020-08-21 04:45:15 -07:00
Vicki Pfau
7652fe9f7a GB Audio: Fix serializing sweep time 2020-08-10 18:11:54 -07:00
Vicki Pfau
38613b5770 GBA BIOS: Make HLE BIOS calls interruptable (fixes #1711, fixes #1823) 2020-08-07 02:06:11 -07:00
Vicki Pfau
287fd86e6a GBA: Allow pausing event loop while CPU is blocked 2020-07-30 18:51:05 -07:00
Vicki Pfau
7f64f8cf3b Debugger: Keep track of global cycle count 2020-05-30 18:01:15 -07:00
Vicki Pfau
41775416ce GBA: Rip out old rr code 2020-01-28 18:15:49 -08:00
Vicki Pfau
befef8ee26 GBA Video: Fix Hblank timing 2020-01-27 18:27:03 -08:00
Vicki Pfau
1285aa2749 GBA Serialize: Fix audio serialization for desynced FIFOs 2020-01-24 21:51:15 -08:00
Vicki Pfau
93633ea605 GBA DMA: Linger last DMA on bus (fixes mgba.io/i/301, fixes mgba.io/i/1320) 2020-01-24 18:07:08 -08:00
Vicki Pfau
ad870aa26b GBA Audio: Redo channel 4 batching for GBA only 2020-01-01 17:02:02 -08:00
Vicki Pfau
f6a4a13b60 GBA: All IRQs have 7 cycle delay (fixes #539, #1208) 2018-10-07 12:52:00 -07:00
Vicki Pfau
0d7cdb9ed8 GBA Serialize: Serialize POSTFLG 2018-09-08 11:24:46 -07:00
Vicki Pfau
6c664c7efe GBA Serialize: Fix docs 2018-09-01 16:19:18 -07:00
Vicki Pfau
679630701e GBA DMA: Fix invalid DMA reads (fixes #142) 2017-11-01 16:55:31 -07:00
Vicki Pfau
7c59350e9d GBA Timer: More timer improvements 2017-07-05 20:41:18 -07:00
Vicki Pfau
87791b9db9 Core: Move savestate creation time to extdata 2017-06-10 09:27:19 -07:00
Vicki Pfau
417012632c GBA Serialize: Remove unused function 2017-04-29 01:39:46 -07:00
Vicki Pfau
1e7a62fbb3 Revert "ARM: Overhaul PSR access"
This reverts commit 37f5feb713d5768f2bf5405e5a9db8765248efc2 and fixup commits.
2017-01-31 11:46:24 -08:00
Vicki Pfau
37f5feb713 ARM: Overhaul PSR access 2017-01-28 11:11:59 -08:00
Vicki Pfau
46782f16a0 GBA Savedata: Transition saving to new timoing system 2017-01-27 16:36:01 -08:00
Jeffrey Pfau
fa884d071e All: Migrate includes to separate directory 2016-12-30 21:25:07 -08:00