Commit Graph

67 Commits

Author SHA1 Message Date
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 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 d41d5a4af4 Shave off 250KB of useless memory by fixing the gba_over structure 2021-07-07 00:43:02 +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 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 Guillen Fandos 7a642069e3 Cleanup unused stuff 2021-06-09 18:10:26 +02:00
David Guillen Fandos aafde6de7b Add ROM mirroring and fix mult. cycle count
This should correct some minor issues in some games.
2021-05-17 01:16:56 +02:00
David Guillen Fandos 4fd456e158 Adding Code Breaker cheat support
This works on both interpreter and dynarec.
Tested in MIPS, ARM and x86, still needs some more testing, some edge
cases can be buggy.
2021-05-05 21:15:27 +02:00
David Guillen Fandos 71ebc49b59 Improve indirect jumps in ARM
Handle already translated blocks in the ARM asm to speed up indirect
branches (affect some games more than others)
2021-03-30 21:06:52 +02:00
David Guillen Fandos 7ea6c5e247 Move OAM RAM to stubs also
Makes accesses more efficient for MIPS. Make accesses also fast for palette
reads.
2021-03-26 23:13:26 +01:00
David Guillen Fandos a494a3f00e Move OAM update flag to a register
Fix a small bug in MIPS dynarec that affects non -G0 targets
2021-03-26 23:13:26 +01:00
David Guillen Fandos 11ec213c99 Make ewram memory lineal
This saves a few cycles in MIPS and simplifies a bit the core.
Removed the write map, only affects interpreter performance very
minimally. Rewired ARM and x86 handlers to support direct access to
I/EWRAM (and VRAM on ARM) to compensate. Overall performance is slightly
better but code is cleaner and allows for further improvements in the
dynarecs.
2021-03-23 19:09:56 +01:00
David Guillen Fandos eab44b9e0b Enable runtime dynarec enable/disable
Added a more thorough cache cleanup for reset/mode-change too.
Fixed the mmap initialization that ends up leaking memory.
Minor x86 asm fixes for Android.
2021-03-17 21:05:49 +01:00
David Guillen Fandos fb7ca09b01 Remove BIOS reserved translation area
This is not really necessary since it can share area with ROM.
Performance impact should be very minimal (haven't noticed it myself)
and could be compensated (even by a positive offset) if we bump the ROM
cache area size.
Tested with several dynarecs.
2021-03-17 18:33:02 +01:00
David Guillen Fandos 34e672ed25 Simplify open load handling for MIPS and fix other arches
Also rewrite a bit memory handlers for smaller functions.
2021-03-16 22:58:58 +01:00
David Guillen Fandos 5ffd2832e8 Rewrite of the MIPS dynarec stubs
This allows us to emit the handlers directly in a more efficient manner.
At the same time it allows for an easy fix to emit PIC code, which is
necessary for libretro. This also enables more platform specific
optimizations and variations, perhaps even run-time multiplatform
support.
2021-03-16 22:58:58 +01:00
David Guillen Fandos c86b9064df Move palettes around to simplify MIPS dynarec
Will move also OAM structures to gain a few cycles per load/store.
Loads can also be optimized for an extra instruction per access.
2021-03-15 02:25:02 +01:00
David Guillen Fandos 7db08a3fcf Fix fd check 2021-03-11 22:13:32 +01:00
David Guillen Fandos 5127f4b5cc Remove PSP-specific stuff from MIPS backend
This is unnecessary since newlib supports all file I/O.
This is needed for other mips ports
2021-03-10 18:41:37 +01:00
David Guillen Fandos 3d558413fd Fix x86 dynarec, broken by d10c4afe
The dynarec expects function args to be located in registers instead of
the stack, which is not the default calling convetion in GCC/clang.
2021-03-06 21:15:22 +01:00
David Guillen Fandos 349e47f0b2 Small fixes to division by zero
This causes crashes in PSP quite often in many games. Other CPUs might
(depending on the processor state) silently return zero or some
undefined value.
The fix is borrowed from ReGBA's codebase
2021-02-23 20:27:59 +01:00
David Guillen Fandos ed3ba2c18b More cleanups (mostly whitespace and unused stuff) 2021-02-15 21:51:49 +01:00
negativeExponent 56372b0635 Use correct path separator 2020-10-28 19:39:41 +08:00
negativeExponent f8b598a2ed Update RTC emulation
- Based on notes, gpSP's RTC does was based on vba.
- I've updated relevant sections of it based on latest vba.

reference issue: https://github.com/libretro/gpsp/issues/79
2020-10-09 15:14:25 +08:00
negativeExponent d8225bb313 Add optional battery save using libretro save api
- Adds core option to allow battery saves using the libretro api
  (retro_get_memory_data/size)
- Initial save size set at 128KB and actual size is automatically
  determined internally by gba.
- This will always assume that a save file is supported since save
  size or type cannot be determined until gba tries to write to backup memory.
- A 128KB block of memory is used as buffer, similar method to VBA
  Next/Beetle GBA workarounds.

Fix https://github.com/libretro/gpsp/issues/72
2020-09-05 20:47:59 +08:00
negativeExponent ba5d66e0bc Fix flash 64K games not saving (Fix https://github.com/libretro/gpsp/issues/59) 2019-11-15 21:49:44 +08:00
bmaupin 89e55e9902 Reenable native file IO on PSP 2019-10-03 13:53:34 -04:00
aliaspider 65ff54ff4e fix sram not saving on some platforms. 2015-09-20 23:42:37 +01:00
aliaspider d4caae665f show the gbaover details for the current gamepak only. 2015-04-06 11:30:47 +01:00
twinaphex 360f958f8d Split up gba_over entries into separate header file 2014-12-22 05:18:39 +01:00
twinaphex 2c81cc1915 Add entries to gbaover 2014-12-22 05:15:05 +01:00
twinaphex 34472c0092 Add more gbaover entries 2014-12-22 04:49:26 +01:00
twinaphex d80bf300d4 Add entries to gbaover 2014-12-22 01:01:43 +01:00
twinaphex 167586fbe3 Add more entries to gbaover 2014-12-22 00:32:56 +01:00
twinaphex 99092cafcf Add more entries to gbaover 2014-12-22 00:17:15 +01:00
twinaphex 95e630983c Add more entries to gbaover 2014-12-22 00:08:37 +01:00
twinaphex 9ea187d3a8 Remove patching of two BIOS ROM locations 2014-12-21 09:48:06 +01:00
twinaphex 06022e2559 Update gbaover 2014-12-21 09:21:53 +01:00
twinaphex b89210e14e Add more entries to gbaover 2014-12-21 07:41:57 +01:00
twinaphex 91d7ce94f8 More changes 2014-12-21 07:24:25 +01:00
twinaphex 91d936b13f Add some more vbaover entries 2014-12-21 06:38:55 +01:00
twinaphex cc1a867328 Start adding gbaover - unfinished 2014-12-21 06:29:16 +01:00
Twinaphex d10c4afea2 Get rid of function_cc 2014-12-20 09:14:38 +01:00
twinaphex ba834beeb1 Change load_gamepak signature 2014-12-20 08:35:53 +01:00
twinaphex 9fe97ba148 gba_memory.c - some cleanups 2014-12-20 08:25:17 +01:00
twinaphex ab96870240 Make functions static in gba_memory.c 2014-12-20 08:12:28 +01:00
twinaphex 87b34754f8 Remove more case ranges 2014-12-13 04:55:24 +01:00
twinaphex e83651639f dma_transfer - change dest_ptr to type uintptr_t - fixes 64bit interpreter
according to aliaspider
2014-12-12 01:53:39 +01:00