Commit Graph

525 Commits

Author SHA1 Message Date
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
David Guillen Fandos 221b8ff115 Partially revert 71ebc49b
Just move the complex lookup to C for simplicity since there's not a lot
of gain to have. This makes it easier for devices with weird jit caches.
2021-07-14 01:59:46 +02:00
David Guillen Fandos 84cd7b2934 Rewrite ROM buffer allocation
This improves the existing on-demand ROM paging and also breaks down ROM
buffers into 1MB blocks for platforms with memory fragmentation issues.

Fixed some potential RTC reg issue in said platforms too.
Fixed page pinning on interpreter (would crash due to LRU evictions).
2021-07-14 01:20:30 +02:00
David Guillen Fandos c9421e6929 Some small cleanup to make the code more C++ conformant 2021-07-11 13:35:21 +02:00
David Guillen Fandos 3144d9e277 Rework ram block ptrs to remove second indirection table.
This removes ram_block_ptrs and encodes the pointer directly in the
block tag. Saves ~256KB at no performance cost.
Drawback is that it limits the ram cache size to 512KB (we were using
768KB before). Should not be a problem since most games use less than
32KB of cache anyway.

Fixed ARM routines accordingly.
2021-07-08 21:29:48 +02:00
David Guillen Fandos aded681de2 Add support for native XBGR1555 format
This is the format used by PS2.
This requires fixing the palette conversion routines (and palette writes
in the MIPS dynarec) but also adding support for 555 mode blending
(currently only 565 modes are supported, regardless of whether they are
RGB or BGR).
2021-07-07 00:51:29 +02:00
David Guillen Fandos 3790b233f1 Fix JIT section in MIPS (+ minor cleanup)
This seems to be an issue on some devices, better place it in .bss
unless we are running on Linux.
2021-07-07 00:45:28 +02:00
David Guillen Fandos d41d5a4af4 Shave off 250KB of useless memory by fixing the gba_over structure 2021-07-07 00:43:02 +02:00
David Guillen Fandos 0ca87a4807 Fix conditional ARM instructions at the end of a translation block
This fixes issue #133

The explanation is as follows. Most blocks end on an inconditional
jump/branch, but there's two cases where this doesn't happen:
translation gates and when we hit MAX_EXITS. These are very uncommon
cases and therefore more prone to hidden bugs.

When this happens, the last instruction emits a conditional jump (via
arm_conditional_block_header macro) which is patched by a later
instruction via generate_branch_patch_conditional. Typically the last
unconditional branch will trigger the patching condition (which is
aproximately condition != last_condition), but in these two cases it
might not happen, leaving an unpatched branch. This makes x86 and ARM
dynarecs crash in interesting ways (although it might not crash
depending on $stuff and make the bug even harder to track).
2021-07-05 18:19:19 +02:00
David Guillen Fandos 3d874ec5e3 Add palette conversion routine for non-R2 MIPS
Gated MIPS_HAS_R2_INSTS not used at the moment. Tested with qemu.
2021-07-01 12:06:57 +02:00
David Guillen Fandos 836e51b694 Fix some UB behaviour 2021-07-01 12:06:57 +02:00
David G. F 48f1a71fb7
Merge pull request #137 from davidgfnet/master
Enable big-endian devices: gc/wii
2021-06-27 01:30:50 +02:00
David Guillen Fandos 8dbf5f6c17 Enable big-endian devices: gc/wii
This patch adds big-endian compatibility in gpsp (in general but only
for the interpreter). There's no performance hit for little-endian
platforms (should be a no-op) and only add a small overhead in memory
accesses for big-endian platforms.

Most memory accesses are wrapped with a byteswap instruction and I/O reg
accesses are also rewired for proper access (using macros). Video
rendering has been fixed to also do byteswaps but there's a couple of
games and rendering modes that still seem broken (but they amount to
less than 20 games in my tests with 1K ROMs).

This also adds build rules and CI for NGC/WII/WIIU (untested)
2021-06-27 01:16:28 +02:00
David G. F d5ff18d3ce
Merge pull request #136 from davidgfnet/master
Remove macros in dma code
2021-06-25 00:50:19 +02:00
David Guillen Fandos bdf0293980 Remove macros in dma code
This reduces code size more than 20% (which is 200-300KB!).
DMA handling accounts for less than 0.5% the average emulation runtime
which doesn't justify the crazy optimization level that the code has. In
fact it's more than likely that the new code runs faster due to less
I-cache trashing.
2021-06-25 00:44:38 +02:00
David G. F 3221ea0ea8
Merge pull request #135 from davidgfnet/master
Fix CI for OD beta
2021-06-22 23:50:51 +02:00
David Guillen Fandos 8739b97b2d Fix CI for OD beta 2021-06-22 23:50:07 +02:00
David G. F 5bfd9ced9a
Merge pull request #134 from davidgfnet/master
Some MIPS fixes
2021-06-22 00:20:15 +02:00
David Guillen Fandos dbf72e95ef Fix the no-caller-saves bug for MIPS
Seems that ABI mandates that we allocate space for arg0..4 even if we do
pass them as registers. For some reason write_io_register<> functions
write in that stack area (1 word) corrupting the s0 saved register.
This seems to be a new gcc behaviour?
2021-06-22 00:09:44 +02:00
David Guillen Fandos f8d4276e12 Add support for mips64n32
This only needs some support to save/load state with 64 bit registers.
Since pointers remain 32 bit, no extra changes are needed in the
dynarec. Verified with qemu (qemu-mipsn32el) and miniretro.
2021-06-21 19:17:19 +02:00
David Guillen Fandos e0a31952db Add preliminary support for non mips32r2 devices
This is required in PS2 but could also make older dingux devices run
gpsp on retroarch
2021-06-18 18:03:47 +02:00
David Guillen Fandos 34b90277bc Rework patch handlers (MIPS) 2021-06-16 19:35:11 +02:00
David Guillen Fandos a160b6de50 Minor cleanup in MIPS code 2021-06-16 19:12:32 +02:00
David Guillen Fandos 1138636478 Update libretro.h with the new extensions from upstream 2021-06-09 18:13:39 +02:00
David Guillen Fandos 7a642069e3 Cleanup unused stuff 2021-06-09 18:10:26 +02:00
David Guillen Fandos f19f1695a6 Minor mips asm cleanup and fixes 2021-05-20 15:46:04 +02:00
David Guillen Fandos 261b2db9bb Cleanup Makefiles a bit 2021-05-19 20:11:35 +02:00
David Guillen Fandos ea2608812f Minor optimization 2021-05-19 20:11:35 +02:00
Autechre 96b3ed46eb
Merge pull request #130 from jdgleaver/turbo-buttons
Add turbo A/B buttons
2021-05-17 16:12:37 +02:00
jdgleaver d0b35e939c Add turbo A/B buttons 2021-05-17 13:02:41 +01:00