Commit graph

762 commits

Author SHA1 Message Date
andymcca
30e86961a1 Don't update background scanline params in mode 0
Noticed that an issue with Rayman 3 Hoodlum Havoc was reported on one of the gpsp compatability lists.  Cross-checked against mgba and revealed the same issue reported as being present in an earlier version -

https://github.com/mgba-emu/mgba/issues/377

This PR applies the same fix as used in mgba.  Could affect other games also.
2023-07-28 18:58:24 +02:00
David Guillen Fandos
0db43d6683 Add VRAM mirroring fixes to video code.
This fix comes from TempGBA-Mod (see PR #217).

Co-authored-by: andymcca <andymcc102@gmail.com>
2023-07-28 18:41:09 +02:00
David Guillen Fandos
85beb230f1 Partial object rendering rewrite
A couple of modes still missing but mostly done. Pixel-exact
compatibility for this change too.
2023-07-27 23:51:24 +02:00
David Guillen Fandos
d6a02ff1df Reimplement blending routines 2023-07-25 23:37:02 +02:00
David Guillen Fandos
543ba652ba Rewrite layer rendering logic for tiled modes.
Bitmap mode does not really support this yet, therefore color effects
are not being rendered.
2023-07-25 23:36:56 +02:00
David Guillen Fandos
7b3c092584 Simplify color modes (there's only three really). 2023-07-21 21:11:08 +02:00
David Guillen Fandos
99a9b1d9b7 Unused macros cleanup 2023-07-21 19:56:01 +02:00
David Guillen Fandos
c5108b78eb Rewrite bitmap rendering routines 2023-07-21 19:15:05 +02:00
David Guillen Fandos
11f56eb1d1 Implement text background affine rendering 2023-07-20 23:28:25 +02:00
David Guillen Fandos
c2964e386a Replace all other tiled renderers.
Alhpa blending and other color effects are merged into a single function
2023-07-19 20:30:52 +02:00
David Guillen Fandos
dc4c312ca7 Rewrite tile rendering base functions 2023-07-18 23:04:56 +02:00
David Guillen Fandos
b88f0c0135 Rewrite window code without macros 2023-07-14 22:39:47 +02:00
David Guillen Fandos
97435283d2 Branch video to be a CXX source file.
Purposely disable all CXX linking to ensure the binary remains the same
2023-07-14 20:16:37 +02:00
David Guillen Fandos
1d972ec7ff Improve GBC sound by fixing its deferred rendering
This fixes many games that use the PSG, particuarly the noise generator.
It is very noticeable in explosion/collision sounds with Sonic and Kirby
games, where the noise channel is rapidly tweaked.
2023-07-14 00:37:33 +02:00
David Guillen Fandos
2391496432 Some video cleanups for better readability 2023-07-11 23:11:27 +02:00
David Guillen Fandos
f5490a1996 Reduce video tracking vars
No need for full int, byte will do.
2023-07-09 23:05:49 +02:00
David Guillen Fandos
7f07da9ade Make sound control deterministic by having proper reset 2023-06-12 20:24:18 +02:00
David Guillen Fandos
34eb7a3bf3 Fix reset() issue with dynarec flushing
On a reset bios_swi_entrypoint can end up pointing to code over the
watermark, due to block_lookup_address_arm looking up the function
instead of translating it.
Fix it by making flush and init different functions (albeit similar).

Tested by running and resetting games automatically, causing ~10% of
games to crash.
2023-06-09 20:21:35 +02:00
David Guillen Fandos
84c347edad [interp] Improve interpreter timings and honor WAITCNT
This fixes a few games and makes the interpreter faster (since it
doesn't run an overclocked CPU anymore).
2023-06-07 19:40:27 +02:00
David Guillen Fandos
c9c88f3560 [interp] Simplify memory bindings a bit 2023-06-07 12:50:17 +02:00
David Guillen Fandos
f15d08f1f9 Fix Mode4 transparency
This fix exists in TempGBA/ReGBA, thanks to andymcca for finding it
2023-06-03 11:29:02 +02:00
LibretroAdmin
a9376c8603
Merge pull request #211 from warmenhoven/dev/warmenhoven/tvos
Fix tvos build
2023-05-28 05:57:09 +02:00
Eric Warmenhoven
61ca45147e Fix tvos build 2023-05-27 14:39:14 -04:00
David Guillen Fandos
f4e65d15c0 [arm/arm64] Fix OAM/VRAM byte writes
Forgot to add byte-doubling codepath for byte writes. This is correctly
implemented in x86 and MIPS.
2023-04-26 00:29:38 +02:00
David Guillen Fandos
872a22ae51 [mips] Correct GP restore to a more accurate location 2023-04-24 20:52:14 +02:00
David Guillen Fandos
eb50c15b1c Remove CHANGED_PC_STATUS, simplify update flow 2023-04-24 20:24:03 +02:00
David Guillen Fandos
64b19d1301 Improve and simplify 16 bit I/O writes too 2023-04-21 22:21:01 +02:00
David Guillen Fandos
a53399af58 Simplify I/O byte writes
Can easily be mapped to 16 bit writes.
2023-04-21 21:44:34 +02:00
David Guillen Fandos
2d28451f6c Fix SWI branch mismatch
The mismatch causes one-of errors for instruction 0F000000 (swieq 0)
which results in all sorts of funny errors (branches to bad addresses).
Fixes a couple of games.
2023-04-20 21:08:49 +02:00
David Guillen Fandos
8c6ff8d358 Simplify I/O writes further
Improve FIFO writes, make them a bit faster
2023-04-20 00:52:30 +02:00
David Guillen Fandos
6bf53cf3db Minor I/O write improvements 2023-04-19 23:22:18 +02:00
David Guillen Fandos
6eb1071dec Wrap I/O register reads
This can cause issues in big-endian platforms otherwise
2023-04-19 20:03:11 +02:00
David Guillen Fandos
413157dedd Fix timer bug regression, introduced at 0bc2a11
Thanks andy for finding the fix!
2023-04-19 20:00:28 +02:00
David Guillen Fandos
dec09d465c [aarch64] Fix c-flag setting on rotation immediate
This fixes a couple games and makes it pass the CPU test suite
2023-04-17 19:06:05 +02:00
David Guillen Fandos
3f976c9557 Refine BIOS and unmapped memory accesses
Turns out there's a couple of inaccuracies that do affect a couple of
games. Most of them are buggy games but emulating these accesses
correctly helps jumping over some bugs.
2023-04-15 11:44:48 +02:00
David Guillen Fandos
08372aae64 Add missing DMA side effects on I/O writes 2023-04-15 11:44:02 +02:00
David Guillen Fandos
bd39c03992 Improve tracing a bit, also in interpreter mode 2023-04-15 02:02:17 +02:00
David Guillen Fandos
46d8616a9f [x86] Do not corrupt edx since it can also corrupt REG_PC 2023-04-15 01:48:29 +02:00
David Guillen Fandos
11d87b89df Rewrite I/O side effects write and IRQ triggers
This rewrites the way that CPU alerts work, making them a bitmap (since
multiple alerts can happen simultaneously, like SMC and IRQ). This
doesn't really fix many games but improves accuracy overall and improves
performance on some I/O writes (the ones without side effects).
The IRQ raising is now decoupled and explicitely called via a new
function (check_and_raise_interrupts) to avoid issues such as invalid
CPSR values (doesn't seem to bother most games!). There's more side
effects missing, so this just lays the ground for more fixes.
2023-04-14 01:41:55 +02:00
David Guillen Fandos
9ef1a4d7b8 Fix tracing conditional ARM insts 2023-04-14 01:40:51 +02:00
David Guillen Fandos
2bbd77054e Fix pending interrupts not raised on IME/IE writes
Whenever an interrupt is pending and interrupts are disabled (via
IME/IE), an IE/IME write that re-enables IRQs will fail to raise an IRQ.
This makes some games hang. Most games seem to use CPSR.IRQ to enable
and disable interruts, so they are not affected. However some others use
IME/IE (or all of them), causing these deadlocks and some race
conditions.

This fixes a bunch of games that did not crash but would "hang" in some
interesting ways.
2023-04-10 12:58:03 +02:00
David Guillen Fandos
f9d7f51ef1 Minor cleanup and fix in DMA code. 2023-04-09 14:16:47 +02:00
David Guillen Fandos
dc4ec94cbc [arm64] Remove unused epilogue check 2023-04-08 17:14:39 +02:00
David Guillen Fandos
0e17e13c90 [arm] Fix I/O write epilogue
This fixes many games and brings it closer to what the other dynarecs
do. Without this patch there's register corruption if the memory write
triggers an IRQ (since raise_interrupt mangles the registers that have
not been saved).

At this point there's still an issue with CPSR saving but that affects
aso the other dynarecs.
2023-04-06 10:10:16 +02:00
David Guillen Fandos
c0b2f05e1d Fix interpreter bug on store-triggered DMAs
In thumb mode, a store that triggers a DMA and its correspondoing DMA
IRQ (since emulate DMAs being instantanious, which is another can of
worms tho...) overrwrites the PC with the PC-next value (disregarding
the IRQ handler address). This causes quite a few bugs. I'd expect it
causing way more bugs, but it doesnt...?

Anyway this fixes a few games like Buffy, Woody, Medabots, Super
Duper Sumos and Power Rangers
2023-04-03 20:24:17 +02:00
David Guillen Fandos
541adc9e1c Fix ROM swapping capabilities
This fixes ROM swapping for x86/64, arm32 and arm64. On top of that it
improves speed by removing unnecessary slow paths on small ROMs for
arm32 and mips. If the ROM can fit in RAM, it will emit more efficient
code that assumes the ROM is fully loaded.

For low-memory Linux platforms it would be better to use some mmap'ed
ROM, that way the OS would transparently handle page swapping, which is
perhaps faster. Will investigate and follow up on this in a separate
commit.
2023-03-03 21:05:12 +01:00
David Guillen Fandos
42c6bb2761 [x86-32] Fix missing function_cc
This messed up timings between the 32 bit version and the 64 bit version
2023-03-03 21:05:12 +01:00
LibretroAdmin
522d44556f
Update .gitlab-ci.yml 2023-02-21 19:04:50 +01:00
libretroadmin
175f00d527 Update libretro-common 2023-02-21 19:01:03 +01:00
LibretroAdmin
f0387156b8
Merge pull request #188 from mudlord/patch-1
Use proper VFS version.
2023-02-21 11:49:19 +01:00