Commit Graph

66 Commits

Author SHA1 Message Date
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 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
jdgleaver d0b35e939c Add turbo A/B buttons 2021-05-17 13:02:41 +01:00
jdgleaver 134aba2b37 Add dedicated RetroPad fast-forward button 2021-05-13 16:03:55 +01:00
David Guillen Fandos 37430f22c5 Small optimization (~2-4%) and whitespace cleanup!
Cleans up a ton of whitespace in cpu.c (like 100KB!) and improves
readability of some massive decode statements.

Added an optimization for PC-relative loads (pool load) in ROM (since
it's read only and cannot possibily change) that directly emits an
immediate load. This is way faster, specially in MIPS/x86, ARM can be
even faster if we rewrite the immediate load macros to also use a pool.
2021-05-07 20:41:54 +02:00
David Guillen Fandos 883f07f487 Fix small buf and add cheat error messages
Some minor formating too
2021-05-05 21:15:27 +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
negativeExponent 52088a4d10 Fix invalid memory map entries 2021-04-28 01:05:11 +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 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 f6f3a91039 Adding Normmatt's BIOS as a built-in BIOS
Add options to select whether to boot from BIOS (default is no, as it is
now) and whether to use the original bios or the builtin one (default is
auto, which tries to use the official but falls back to the builtin if
not found).
2021-03-22 21:45:52 +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
jdgleaver 3db8eba7fd Ensure post processing configuration is correctly reset in retro_deinit() 2021-03-16 13:14:21 +00:00
twinaphex bd36c9c77d Add osx-arm64 target 2021-03-09 22:05:36 +01:00
David Guillen Fandos 56dc6ecb70 Remove libco
This removes libco and all the usages of it (+pthreads).
Rewired all dynarecs and interpreter to return after every frame so that
libretro can process events. This required to make dynarec re-entrant.

Dynarecs were updated to check for new frame on every update (IRQ, cycle
exhaustion, I/O write, etc). The performance impact of doing so should
be minimal (and definitely outweight the libco gains). While at it,
fixed small issues to get a bit more perf: arm dynarec was not idling
correctly, mips was using stack when not needed, etc.

Tested on PSP (mips), OGA (armv7), Linux (x86 and interpreter). Not
tested on Android though.
2021-03-08 18:44:03 +01:00
jdgleaver 908be08be5 Optimise interframe blending 2020-11-09 13:04:00 +00:00
jdgleaver 226bd8283a Overhaul frameskip options 2020-10-24 14:58:40 +01:00
jdgleaver 00406feed9 Add build-time option to run the emulator in a thread instead of libco (fixes OpenDingux target) 2020-10-23 15:37:48 +01:00
twinaphex b10c73f00f Cleanups 2020-10-06 03:13:01 +02:00
jdgleaver aa7feb70ca Add optional colour correction + interframe blending 2020-09-21 18:03:58 +01:00
negativeExponent a3725fd81f Remove ewram from libretro api
- Removing RETRO_SYSTEM_MEMORY from retro_get_memory_data/size
  since its incompatible for 2 reasons:
1. gba uses at least 2 blocks of memory, which is not supported
2. the way gpsp's memory block are not contiguous (see memory
   descriptors)
2020-09-05 20:54:57 +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 fea026fec4 Fix cheevos support 2020-04-05 16:35:23 +08:00
bmaupin f484239f9c Add automatic frame skipping 2020-03-10 13:51:03 -04:00
hizzlekizzle 3f2f57c982
Merge pull request #64 from justinweiss/3ds-fix-prefetch-abort
[3DS] Fix dynarec prefetch aborts
2020-02-29 17:23:57 -06:00
Justin Weiss 6a50b8a68d [3DS] Fix dynarec prefetch aborts
Similar fix to https://github.com/libretro/pcsx_rearmed/pull/390. The
Nintendo svcBackdoor can cause stack corruption if an interrupt
happens during it, this uses Luma3DS/Rosalina's svcCustomBackdoor instead.
2020-02-29 10:55:58 -08:00
bmaupin 3df169d3e8 Add manual frame skipping 2020-02-28 13:23:56 -05:00
bmaupin 59c4f7f5c7 Fix periodic ram_translation_cache crashes 2020-02-27 13:52:59 -05:00
Francisco Javier Trujillo Mata e040afd35d Make PSP version to render the image it-self instead of using RetroArch 2019-11-23 17:34:35 +01:00
Sven 89e311b489 add memory hooks for cheat/rumble 2018-08-11 14:35:49 -04:00
Hedonium c7959bb001 Update libretro.c: Add missing input descriptors
Add missing L and R descriptors. Fixes #48
2018-05-03 10:34:34 -04:00
Tatsuya79 c745ed8229
Recover 1 frame of input lag 2018-01-06 17:27:48 +01:00
twinaphex c31b3e857c Better error handling 2017-01-24 18:24:03 +01:00
Gregor Richards 415b5ba67b Report git version with library_version 2016-12-09 18:42:12 -05:00
Francisco José García García adcf1c6f73 (VITA) Dynarec changes 2016-10-04 07:32:54 +00:00
Francisco José García García 6bfb7e1b47 (VITA) Dynarec working 2016-10-03 20:19:11 +02:00
Francisco José García García 44b63e7d28 (VITA) Dynarec WIP 2016-08-14 18:28:25 +02:00
Francisco José García García 177abe6a22 (VITA) Continue WIP - Fix Block for VM alignment 2016-08-08 13:13:22 +02:00
Francisco José García García 6ab0992ecf (VITA) Dynarec WIP 2016-08-08 00:31:21 +02:00
aliaspider f1d14fbe7c (3ds) dynarec: map the translation caches to specific addresses at
runtime, increases compatibility with loaders that can reloacate each
program section seperately.
move the svc enabling functions to the frontend.
2015-11-04 15:46:27 +01:00
aliaspider a93bb43bc8 (ctr/3ds) fix handle leak. 2015-09-27 14:47:06 +01:00
radius 7c4c6baa5e add input descriptors 2015-09-26 22:35:31 -05:00
aliaspider c1d061e204 (3DS) add dynarec support when started from a .cia install
use libkhax for ninjhax 1.0
2015-09-11 22:02:04 +01:00
aliaspider 69b5bfc05e allocate gba_screen_pixels on the heap.
use linearMemAlign for the 3DS target.
2015-04-13 02:43:42 +01:00
aliaspider 5b6683bb93 (3DS) enable dynarec support, works only with ninjahax. 2015-04-08 10:20:32 +01:00
twinaphex ba834beeb1 Change load_gamepak signature 2014-12-20 08:35:53 +01:00
twinaphex 5820d8be94 Create memmap_win32.c for Win32 systems - a mman wrapper 2014-12-13 05:50:15 +01:00
twinaphex c1375c871f Put ifdef around <sys/mman.h> include 2014-12-13 01:20:10 +01:00
Alcaro a42f3c57ff Allow core to work without GET_PERF_INTERFACE. 2014-12-11 23:21:27 +01:00