Commit Graph

790 Commits

Author SHA1 Message Date
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
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