Commit Graph

554 Commits

Author SHA1 Message Date
David Guillen Fandos 55c6a69ccd Move flag regs to unserialized area
This is only used in x86 (mips and arm use native regs and never spill)
2021-08-28 17:50:25 +02:00
David Guillen Fandos d649fe96cb Fix high/low ram watermark tracking
Fixes negative sized memset calls and some wrap around bugs. Fixes at
least a couple of games.
2021-08-28 16:49:41 +02:00
David Guillen Fandos 1feab54699 Rewrite DMA handlers
Make it cleaner and clearer, also fix an out of bounds issue in high
memory regions.
2021-08-27 21:38:38 +02:00
David Guillen Fandos 8e50b168cb Fix OOO access on last instruction.
Cycle counting is a bit broken, needs some rework.
2021-08-26 13:40:48 +02:00
David Guillen Fandos 8207775256 Fix out of bounds read bug on open bus read
This bug doesn't affect many games but makes sanitizers unhappy.
Also fix some minor FIFO clear bug
2021-08-24 19:55:37 +02:00
David Guillen Fandos 7068cbc95b New savestate implementation
This uses BSON as savestate format, to allow external tools to parse it
(so that we can add proper test of the states). The BSON is not 100%
correct according to spec (no ordered keys) but can be parsed by most
libraries.

This fixes also a bug in the savestate palette color recalculation that
was wrongly overwritting the original palette (which could cause some
problems on some games).

Also fixes some potential issues by serializing some more stuff and
cleans up unused stuff.

Testing shows that states look good and there's only minor differences
in audio ticks, related to buffer sizes (since buffer flushes are
de-synced from video frames due to different frequency).
2021-08-24 17:15:27 +02:00
David Guillen Fandos 40b3cd51ec Fix sign extension from BG references (broke it in 7f7d06) 2021-08-24 17:13:39 +02:00
David Guillen Fandos 1e976fb312 Remove unused stuff and fix const variables
Trying to figure out what needs to be part of a savestate :)
2021-08-24 10:57:30 +02:00
David Guillen Fandos b61bec202f Simplify EEPROM handling and remove some mem aliasing warnings.
This fixes issue #29
2021-08-22 00:23:53 +02:00
David Guillen Fandos fb830447ba Simplify DMA handling 2021-08-21 19:41:52 +02:00
David Guillen Fandos a3377c2ac1 Minor DMA cleanup 2021-08-21 18:10:12 +02:00
David Guillen Fandos 86b365f065 Remove unused variable 2021-08-21 16:59:07 +02:00
David Guillen Fandos 77803adcac Remove more unused stuff 2021-08-20 17:39:35 +02:00
David Guillen Fandos 1409e04629 Remove unused crust 2021-08-16 00:03:24 +02:00
David Guillen Fandos 7f7d066854 Remove video vars serialization
This is not needed at all, since the variables are not updated between
reload and end-of-frame (where we take our savestates). Added a reload
call during gba_load_state() to initialize it from the I/O regs.
2021-08-15 23:30:57 +02:00
David Guillen Fandos 745b2ece2c Fix inifinite loop in the interpreter, fixes ~6 games
Seems that, on IRQ, it is assumed that the PC will change (which happens
most of the time). However if the IRQ is masked it resumes execution.
On masked DMA IRQ the interpreter jumps to alert without incrementing
the instruction pointer (right after).
2021-08-15 23:02:12 +02:00
David Guillen Fandos f5232543f5 Improve tracing prints 2021-08-15 22:48:43 +02:00
David Guillen Fandos 057b80f8cc Fix a bug with BLH (half BL) on ARM
This fixes issues on games from Camelot (GS2 and Mario Golf)
2021-08-15 22:19:40 +02:00
David Guillen Fandos 1b37289890 Fix MIPS instruction tracing 2021-08-15 22:13:33 +02:00
David Guillen Fandos 14bc6e3554 Remove unnecessary check in update stub (arm) 2021-08-15 21:52:26 +02:00
David Guillen Fandos 5be5015338 Rearrange register layout and exclude useless regs from savestat
This changes the savestate format once again.
2021-08-15 21:07:20 +02:00
David Guillen Fandos 2d34d91c64 Fix iwram stack optimization on Kirby
Seems that it break it, probably uses a SP pointer to EWRAM or similar
2021-08-15 20:24:59 +02:00
David Guillen Fandos ce14e2585b Fix and reenable Android arm 32 bit builds
Removed the last bits of text relocations by moving all relevant RAMs to
the stub reachable area. This should be as fast or even faster than
previous code.
2021-07-31 17:45:46 +02:00
David Guillen Fandos b3abefa7d9 Avoid using relocations in arm code 2021-07-31 00:20:18 +02:00
David Guillen Fandos da5ec48982 Rework I/O mappings
Mirrors exist at 64KB boundary (not 0x400) but works nevertheless
2021-07-30 00:18:02 +02:00
Autechre 7ba465089c
Merge pull request #145 from Poligraf/retrofw
add retrofw target
2021-07-30 12:16:36 +02:00
Poligraf 80f86535e7
add retrofw target 2021-07-30 20:35:15 +12:00
David Guillen Fandos efee37f82c Re-enable Android x86 builds 2021-07-28 19:14:45 +02:00
David Guillen Fandos ab7d9bb161 Move membuffers close to dynarec area to fix x86 relocs
This essentially makes it easier to get a relocation-free text area for
x86 so that Android loaders are happy.
2021-07-28 19:12:43 +02:00
David Guillen Fandos dec6f50d89 Fix DMA VRAM mirror overflow and small 1-off error
Seems that this could make VRAM overflow big time and overwrite IWRAM
most of the time (since it lives after that buffer). This causes a
variety of errors, some of them hidden if IWRAM not used.
Most games do not use VRAM mirror so it's not a big deal, but some do
have a off-by-one errors that trigger this.
2021-07-28 01:26:19 +02:00
David Guillen Fandos 5fe5121c81 Remove pointer from sound struct, use index instead
This makes serialization possible, previously it was broken.
2021-07-27 21:45:15 +02:00
David Guillen Fandos ba51aa6a1c Fix pointer serialization in the memory system
This makes savestates potentially unstable under certain conditions (and
definitely not portable)
2021-07-27 21:18:15 +02:00
David Guillen Fandos 19d67af0bd Revert Android 32 bit builds
Working on getting them fixed soon
2021-07-27 21:11:19 +02:00
David Guillen Fandos 8e670a3263 Rewire warning flags (new NDK?) 2021-07-27 01:06:06 +02:00
David Guillen Fandos ae2a656e66 Remove nested functions in arm dynarec
Re-enable Android builds
2021-07-27 00:47:54 +02:00
David Guillen Fandos b0947a1ae1 Promote nested functions to macros, fix clang builds
Add x86 Android builds back to the CI now that it's fixed (tested with
NDK r21)
2021-07-26 21:41:07 +02:00
Autechre 1d8313cc14
Merge pull request #143 from fjtrujy/master
Add PS2 to the CI for compilation
2021-07-25 20:02:34 +02:00
Francisco Javier Trujillo Mata 49d6efa3d1 Add PS2 to the CI for compilation 2021-07-25 20:01:36 +02:00
Autechre 828965d33d
Merge pull request #142 from davidgfnet/master
Add PS2 builds and expand the ROM buffer to 16MB
2021-07-24 17:38:41 +02:00
David Guillen Fandos 8ddfae6bc2 Add PS2 builds and expand the ROM buffer to 16MB
This requires the new PS2 font drive to work, since gskit uses too much
memory.
2021-07-24 02:02:12 +02:00
Autechre d468f473e8
Add RS-90 support to Gitlab 2021-07-23 21:09:17 +02:00
David Guillen Fandos 706926caff Reduce RS90 buffer to 4MB 2021-07-23 19:26:55 +02:00
David Guillen Fandos 75e67bffc2 Add support for RS90 2021-07-23 18:50:44 +02:00
David Guillen Fandos 60155e0b81 Add preliminary support for PS2 devices 2021-07-22 18:30:45 +02:00
David Guillen Fandos a77c1c9171 Add overridable memory config knob for low-mem platforms 2021-07-21 00:23:10 +02:00
David Guillen Fandos 3009504613 Fix palette calculation on XBGR1555 mode 2021-07-20 23:09:14 +02:00
David Guillen Fandos a8d99d993f Fix potential MIPS issue on cache alignment 2021-07-19 18:55:42 +02:00
David Guillen Fandos 3eddcf8416 Minor mips dead code cleanup 2021-07-19 00:24:45 +02:00
David Guillen Fandos 72a4a91fda Speed up arm stores 2021-07-15 21:27:38 +02:00
David Guillen Fandos ac3e75a107 Reimplement arm load stubs and fix BIOS handler
This fixes unallowed BIOS accesses (outside from BIOS) which fixes some
games like Silent Scope but also Zelda (fixes rolling as reported by
neonloop!)
2021-07-15 00:40:52 +02:00