pcsx_rearmed.git
2 years agounbreak nodynarec build
notaz [Sat, 26 Feb 2022 23:54:39 +0000 (01:54 +0200)]
unbreak nodynarec build

oops

2 years agodrc: try to avoid some block trapping
notaz [Sat, 26 Feb 2022 22:10:57 +0000 (00:10 +0200)]
drc: try to avoid some block trapping

2 years agodrc: rework jump_out lists
notaz [Thu, 24 Feb 2022 21:28:11 +0000 (23:28 +0200)]
drc: rework jump_out lists

should waste less memory for malloc overheads

2 years agodrc: rework expire code
notaz [Wed, 23 Feb 2022 23:08:35 +0000 (01:08 +0200)]
drc: rework expire code

Should be quite a bit simpler now, and no longer wastes ~4MB of
translation cache for aggressive block expiring. However more stuff
in cache means longer lists which may slow things down if
recompilation is happening nonstop, so further tuning might be needed.

2 years agodrc: more precise invalidation checking for the invstub case
notaz [Tue, 22 Feb 2022 22:26:51 +0000 (00:26 +0200)]
drc: more precise invalidation checking for the invstub case

2 years agodrc: rework block tracking
notaz [Mon, 21 Feb 2022 23:23:09 +0000 (01:23 +0200)]
drc: rework block tracking

Mostly to remove that horrible generated code parsing.
Also seems to generate less code now.

2 years agodrc: get rid of SPAN
notaz [Sat, 19 Feb 2022 22:46:51 +0000 (00:46 +0200)]
drc: get rid of SPAN

Should have done it 10 years ago, it's a huge maintenance burden for
something than almost never happens.

2 years agodrc: restore all block entry points at once
notaz [Sat, 19 Feb 2022 22:11:52 +0000 (00:11 +0200)]
drc: restore all block entry points at once

and add some stats

2 years agodrc: don't delay block restoration
notaz [Sat, 19 Feb 2022 19:37:23 +0000 (21:37 +0200)]
drc: don't delay block restoration

Not sure why it was done the way it was (maybe something N64 related?),
but it occasionally caused dyna_linker to repeatedly walk the jump_in
list. What's worse, if the dirty block was deemed to expire soon,
it would never be restored and dyna_linker repeated jump_in walking
would never end, causing severe slowdown.

2 years agoRevert "clear Index0 data FIFO flag (#241)"
notaz [Thu, 17 Feb 2022 00:14:03 +0000 (02:14 +0200)]
Revert "clear Index0 data FIFO flag (#241)"

This reverts commit 50ae51487697da0d2f9c93295f89d2f10694b6d8.
It broke Driver 2.

2 years agodrc: try not to end the block prematurely
notaz [Tue, 15 Feb 2022 23:20:31 +0000 (01:20 +0200)]
drc: try not to end the block prematurely

Fixes: 4919de1e88095f00466f6674323d518fc520b0db

(was not really broken, only load delay detection can't work with
blocks that are too small)

2 years agopsxinterpreter: unbreak load delay handling
notaz [Tue, 15 Feb 2022 21:17:42 +0000 (23:17 +0200)]
psxinterpreter: unbreak load delay handling

Fixes: 943a507a4156b8f5b00e4431152e41eeb4dc6f3d

2 years agodrc: add a clock override for Super Robot Taisen Alpha
notaz [Sat, 12 Feb 2022 20:58:23 +0000 (22:58 +0200)]
drc: add a clock override for Super Robot Taisen Alpha

libretro/pcsx_rearmed#610

2 years agodrc: try to make some passes not as slow, part 2
notaz [Sun, 6 Feb 2022 23:41:12 +0000 (01:41 +0200)]
drc: try to make some passes not as slow, part 2

2 years agodrc: put passes in their own functions
notaz [Sun, 6 Feb 2022 20:38:54 +0000 (22:38 +0200)]
drc: put passes in their own functions

mostly for profiling

2 years agodrc: try to make some passes not as slow
notaz [Sat, 5 Feb 2022 22:10:18 +0000 (00:10 +0200)]
drc: try to make some passes not as slow

2 years agodrc: use optimized get_reg
notaz [Thu, 3 Feb 2022 00:04:52 +0000 (02:04 +0200)]
drc: use optimized get_reg

arm32-only for now

2 years agodrc: rm unneeded &63 masking
notaz [Wed, 2 Feb 2022 21:40:48 +0000 (23:40 +0200)]
drc: rm unneeded &63 masking

64bit leftover

2 years agoclear Index0 data FIFO flag (#241)
gameblabla [Mon, 7 Feb 2022 19:17:34 +0000 (19:17 +0000)]
clear Index0 data FIFO flag (#241)

Merge PCSX Redux fix.
This is what he had to say about it :
"So, this commit works around/fixes two issues with loading unirom.
There's a fix for logging invalid commands which should be pretty straight forward. The other change is around the FIFO flag.
Not really experienced with debugging/verifying this sort of thing so not feeling really confident the change is "right", though every game I've tried so far still seem to work as expected.
There's still something going on with not having an iso mounted that I haven't quite nailed down. Even having the iso mounted with "lid open" gives a bootable result. Feel like I'm going in circles a bit for something that might be an easy fix. Unirom is technically usable via ISO, but the unirom exe freezes if no iso is loaded"

Co-authored-by: johnbaumann <76951440+johnbaumann@users.noreply.github.com>
2 years agoFix silly typo mistake for CDROM pause/resume fix for DOA. (#242)
gameblabla [Sat, 5 Feb 2022 21:43:34 +0000 (21:43 +0000)]
Fix silly typo mistake for CDROM pause/resume fix for DOA. (#242)

My bad guys.

2 years agogpu_neon: fix apparent missing msb setting in blend_blocks_textured_add_fourth
notaz [Mon, 31 Jan 2022 23:50:12 +0000 (01:50 +0200)]
gpu_neon: fix apparent missing msb setting in blend_blocks_textured_add_fourth

The source bit is taken, which also enables semi transparency,
so if we did blending the bit must be set.

2 years agogpu_neon: reserved bpp is 16bpp, not 4bpp
notaz [Mon, 31 Jan 2022 00:07:25 +0000 (02:07 +0200)]
gpu_neon: reserved bpp is 16bpp, not 4bpp

2 years agodrc: don't abort on game crash
notaz [Sun, 30 Jan 2022 16:40:03 +0000 (18:40 +0200)]
drc: don't abort on game crash

Was not the best user experience, with this the user can load
another game at least.

2 years agorm the old debugger stuff, like in libretro fork
notaz [Sun, 30 Jan 2022 15:34:42 +0000 (17:34 +0200)]
rm the old debugger stuff, like in libretro fork

2 years agodrc: add apparently missing ROREG loading
notaz [Sat, 29 Jan 2022 23:39:40 +0000 (01:39 +0200)]
drc: add apparently missing ROREG loading

sjump_assemble had different loading for taken/not taken cases for
whatever reason, and I added ROREG loading according to INVCP, which
was (maybe?) erroneously missing for 'not taken' case. Fixes CTR crash
shortly after starting driving.

2 years agodrc: some more debug logging
notaz [Sat, 29 Jan 2022 23:37:45 +0000 (01:37 +0200)]
drc: some more debug logging

2 years agodrc: add seemingly missing double-alloc check
notaz [Thu, 27 Jan 2022 23:09:44 +0000 (01:09 +0200)]
drc: add seemingly missing double-alloc check

seems like it was possible to alloc the same reg on 2 host regs

edit: found after all the debugging: mupen64plus/mupen64plus-core@8f4cc2bdc93c41801077abda3197a3cb3b89cbb7

2 years agodrc: clear dirty flag when deallocating a reg
notaz [Thu, 27 Jan 2022 22:02:09 +0000 (00:02 +0200)]
drc: clear dirty flag when deallocating a reg

In later stages it may place special regs like AGEN there, and things
like AGEN being marked dirty seemed wrong, although probably harmless
as there is no code to writeback AGEN.

2 years agodrc: init some variables, adjust comments
notaz [Thu, 27 Jan 2022 21:54:42 +0000 (23:54 +0200)]
drc: init some variables, adjust comments

no proof that is actually needed, but it felt like some path could
pick up something uninitialized

2 years agodrc: emulate break opcode
notaz [Wed, 26 Jan 2022 20:09:22 +0000 (22:09 +0200)]
drc: emulate break opcode

sort-of-but-not-really used by "F1 2000"
(SLUS01120, not "Formula One 2000").

2 years agodrc: don't cache psxRegs.interrupt
notaz [Wed, 26 Jan 2022 20:02:18 +0000 (22:02 +0200)]
drc: don't cache psxRegs.interrupt

cdrom code can now cancel interrupts, so must always use the global

2 years agodrc: another hack to try to get Vita to work
notaz [Mon, 24 Jan 2022 18:49:04 +0000 (20:49 +0200)]
drc: another hack to try to get Vita to work

2 years agodrc: a bit more sophisticated f1 hack
notaz [Sun, 23 Jan 2022 23:49:45 +0000 (01:49 +0200)]
drc: a bit more sophisticated f1 hack

yes it sucks, I know...

2 years agoalways describe to get git hash in log messages
notaz [Sun, 23 Jan 2022 20:57:06 +0000 (22:57 +0200)]
always describe to get git hash in log messages

2 years agodrc: possibly the missing piece for Vita
notaz [Sun, 23 Jan 2022 14:14:39 +0000 (16:14 +0200)]
drc: possibly the missing piece for Vita

Lost during merge of dynarec fixes.
_newlib_vm_size_user might be the critical bit that overrides
a weak symbol in bootstrap/vita/sbrk.c

2 years agodrc: align size passed to mprotect
notaz [Sat, 22 Jan 2022 23:24:36 +0000 (01:24 +0200)]
drc: align size passed to mprotect

Maybe this makes svcControlProcessMemory() not do it's work there?
It doesn't seem to be failing though.

2 years agospu: try to eliminate some cdda clicks/pops
notaz [Sat, 22 Jan 2022 20:25:05 +0000 (22:25 +0200)]
spu: try to eliminate some cdda clicks/pops

cdda feeds less data than consumes due to poor timings,
especially for PAL

2 years agospu: save/restore decode_pos
notaz [Sat, 22 Jan 2022 20:20:42 +0000 (22:20 +0200)]
spu: save/restore decode_pos

SPUOSSFreeze_t conveniently had padding space for it

2 years agocdrom: play cdda regardless of report mode
notaz [Sat, 22 Jan 2022 20:15:54 +0000 (22:15 +0200)]
cdrom: play cdda regardless of report mode

Vib-Ribbon doesn't use it while playing.

2 years agodrc: always clear full decoded_insn
notaz [Tue, 14 Dec 2021 22:04:11 +0000 (00:04 +0200)]
drc: always clear full decoded_insn

Some stuff was left after INTCALL conversion and broke branch in delay
slot handling, like in Rayman 2.

2 years agofix some issues and warnings seen on ctr build
notaz [Tue, 14 Dec 2021 19:09:45 +0000 (21:09 +0200)]
fix some issues and warnings seen on ctr build

2 years agodrc: reapply some libretro changes
notaz [Tue, 14 Dec 2021 19:03:25 +0000 (21:03 +0200)]
drc: reapply some libretro changes

2 years agodrc: adjust asm to make clang happy
notaz [Tue, 14 Dec 2021 00:37:51 +0000 (02:37 +0200)]
drc: adjust asm to make clang happy

2 years agodrc: rearrange hacks
notaz [Mon, 29 Nov 2021 21:35:08 +0000 (23:35 +0200)]
drc: rearrange hacks

Also adds PE2 hack. PE2 probably checks if a frame didn't take
too long to complete by comparing counter 2 to a hardcoded value.
If it did exceed the limit it restarts all the processing, probably
assuming that the GPU was busy that time and retrying on next frame
would work out?

Still it will hang if not enough cycles are available, regardless of how
root counters are handled, and currently won't work on the interpreter
even with root counter hack because of recently added stalls.
PCSX's timing is just too wrong all over the place...

2 years agodrc: fix some mistake done during arm64 porting
notaz [Mon, 29 Nov 2021 00:10:27 +0000 (02:10 +0200)]
drc: fix some mistake done during arm64 porting

2 years agodrc: fix an old memhandler oversight
notaz [Sun, 28 Nov 2021 16:34:07 +0000 (18:34 +0200)]
drc: fix an old memhandler oversight

accidentally got it right when doing arm64 port though

2 years agodrc: fix CCREG loading
notaz [Sun, 28 Nov 2021 21:08:57 +0000 (23:08 +0200)]
drc: fix CCREG loading

CCREG was always manually loaded by *jump_assemble and few other
places, however when I added more CCREG allocs I expected loading
to be handled automatically, but turns out it wasn't.

2 years agodrc: don't cull ccreg
notaz [Sun, 28 Nov 2021 15:23:34 +0000 (17:23 +0200)]
drc: don't cull ccreg

It didn't even seem to be written back. What was the point doing so
anyway, other regs were (maybe?) culled to prevent saving/restoring
them in memhandlers, but ccreg is in callee-saved reg anyway?
We also need ccreg more often now for stalls.

2 years agodrc: rework cycle counting
notaz [Sun, 28 Nov 2021 15:12:04 +0000 (17:12 +0200)]
drc: rework cycle counting

The way it was done before caused different behaviour on different
platforms because the dynarec can invert branches depending on register
pressure and maybe other things. Because of that cycle counts would
change slightly but sufficiently to break/fix timing sensitive games.
Now it should be more consistent, maybe.

2 years agodrc: prefer callee-saved regs on alloc
notaz [Sun, 28 Nov 2021 22:03:20 +0000 (00:03 +0200)]
drc: prefer callee-saved regs on alloc

reduces amount of saved/restored regs (random game):
arm32: ~45%
arm64: ~80%

2 years agodrc: get rid of RAM_FIXED, revive ROREG
notaz [Fri, 26 Nov 2021 23:28:08 +0000 (01:28 +0200)]
drc: get rid of RAM_FIXED, revive ROREG

should work better on devices that can't map memory at desired locations

2 years agodrc: botched msb bit check
notaz [Fri, 26 Nov 2021 22:53:16 +0000 (00:53 +0200)]
drc: botched msb bit check

adjust the f1 hack too

3 years agodrc: only override default cycle_multiplier
notaz [Wed, 24 Nov 2021 20:52:53 +0000 (22:52 +0200)]
drc: only override default cycle_multiplier

To let the user tune if they want. Also iS multiplier in db
was still too small for HLE mode.

3 years agodrc: add a hack for f1 games
notaz [Wed, 24 Nov 2021 19:17:47 +0000 (21:17 +0200)]
drc: add a hack for f1 games

Quite fragile but maybe good enough.

What the games do seems to be deliberate to break emulators. It takes
the address of some internal function (let's call it f1) and calculates
an address add2 in such a way that f1 can't evict code at addr2. It then
writes a 4 instruction code piece f2 that just loads an address from
stack (which happens to be stacked ra) and jumps to it. f1 then gets
called, loads data (?) and overwrites f2 doing it and returns. Right
after that f2 gets called again.

3 years agointerpreter: simplify icache implementation
notaz [Mon, 22 Nov 2021 23:48:53 +0000 (01:48 +0200)]
interpreter: simplify icache implementation

Should be more accurate too.

3 years agodrc: drop 'likely' branch support, simplify
notaz [Mon, 22 Nov 2021 21:18:56 +0000 (23:18 +0200)]
drc: drop 'likely' branch support, simplify

not in MIPS1

3 years agodrc: reduce memory usage
notaz [Mon, 22 Nov 2021 20:33:52 +0000 (22:33 +0200)]
drc: reduce memory usage

mostly automated conversion

   text    data     bss     dec     hex filename
 137712       0 2753296 2891008  2c1d00 libpcsxcore/new_dynarec/new_dynarec.o
 132720       0 2732816 2865536  2bb980 libpcsxcore/new_dynarec/new_dynarec.o

3 years agomake icache implementation play nice with the dynarec
notaz [Mon, 22 Nov 2021 19:29:08 +0000 (21:29 +0200)]
make icache implementation play nice with the dynarec

No need to to have a build-time option now.

3 years agodrc: detect unconditional branches early
notaz [Mon, 22 Nov 2021 19:08:17 +0000 (21:08 +0200)]
drc: detect unconditional branches early

Mainly helps to end the block and not compile data.
Unsure if this doesn't break something.

3 years agodrc: minor adjustments
notaz [Mon, 22 Nov 2021 18:55:37 +0000 (20:55 +0200)]
drc: minor adjustments

like not marking INTCALL as compiled code

3 years agodrc: fix block expire
notaz [Mon, 22 Nov 2021 18:20:36 +0000 (20:20 +0200)]
drc: fix block expire

was shifting pointers that are not necessarily aligned

3 years agofrontend: remove src alignment requirements in asm
notaz [Sun, 21 Nov 2021 14:44:35 +0000 (16:44 +0200)]
frontend: remove src alignment requirements in asm

no measurable perf improvement seen just from :64 alignment both on
cortex-a8 and cortex-a72, and Psybadek uses unaligned vram location.

3 years agodrc,interpreter: add mul/div stalls
notaz [Sat, 20 Nov 2021 22:06:52 +0000 (00:06 +0200)]
drc,interpreter: add mul/div stalls

for games like Zero Divide, which will run at twice speed if there is
not enough combined slowdown (probably from muldiv/gte/cache misses).

3 years agodrc: try to make gte stall handling less bloaty
notaz [Fri, 19 Nov 2021 21:35:04 +0000 (23:35 +0200)]
drc: try to make gte stall handling less bloaty

3 years agodrc/gte: add some stall handling
notaz [Thu, 18 Nov 2021 22:52:31 +0000 (00:52 +0200)]
drc/gte: add some stall handling

3 years agodrc: use helpers for jump checks
notaz [Fri, 19 Nov 2021 21:33:27 +0000 (23:33 +0200)]
drc: use helpers for jump checks

most not converted, maybe another day

3 years agofrontend: force full recompile on drc setting change
notaz [Fri, 19 Nov 2021 21:36:28 +0000 (23:36 +0200)]
frontend: force full recompile on drc setting change

Libretro port should do the same, but here it outdated and nobody cared
updating it here.

3 years agodrc: use a separate var for game hacks
notaz [Thu, 18 Nov 2021 22:39:26 +0000 (00:39 +0200)]
drc: use a separate var for game hacks

because config save/load can clear the main var

3 years agofix some crashes when loading bad state
notaz [Thu, 18 Nov 2021 22:33:04 +0000 (00:33 +0200)]
fix some crashes when loading bad state

3 years agofix x86 build
notaz [Tue, 16 Nov 2021 23:48:45 +0000 (01:48 +0200)]
fix x86 build

forgot a dummy variable, whoops

3 years agodrc: add a timing hack for Internal Section
notaz [Tue, 16 Nov 2021 23:35:43 +0000 (01:35 +0200)]
drc: add a timing hack for Internal Section

3 years agodrc: adjust timing to be closer to the interpreter
notaz [Tue, 16 Nov 2021 00:54:03 +0000 (02:54 +0200)]
drc: adjust timing to be closer to the interpreter

3 years agodrc: adjust constants, 32bit is enough
notaz [Mon, 15 Nov 2021 19:09:47 +0000 (21:09 +0200)]
drc: adjust constants, 32bit is enough

3 years agodrc: handle a corner case with SLT
notaz [Sun, 14 Nov 2021 22:23:06 +0000 (00:23 +0200)]
drc: handle a corner case with SLT

3 years agoupdate libpicofe
notaz [Sun, 14 Nov 2021 21:39:22 +0000 (23:39 +0200)]
update libpicofe

3 years agotry to add armhf and arm64 ci build
notaz [Sun, 14 Nov 2021 20:23:12 +0000 (22:23 +0200)]
try to add armhf and arm64 ci build

3 years agoenable arm64 dynarec
notaz [Sun, 14 Nov 2021 00:28:50 +0000 (02:28 +0200)]
enable arm64 dynarec

3 years agodrc: update cache flushing
notaz [Sat, 13 Nov 2021 23:20:38 +0000 (01:20 +0200)]
drc: update cache flushing

as of now the arm64 __clear_cache workaround is still needed

3 years agodrc: new far call mechanism
notaz [Sat, 13 Nov 2021 23:14:55 +0000 (01:14 +0200)]
drc: new far call mechanism

somewhat inspired by mupen64plus, but a bit different

3 years agodrc: something works on arm64
notaz [Thu, 11 Nov 2021 00:32:02 +0000 (02:32 +0200)]
drc: something works on arm64

3 years agodrc: adjust bogus looking check
notaz [Wed, 10 Nov 2021 21:44:25 +0000 (23:44 +0200)]
drc: adjust bogus looking check

not really sure what's going on, but at the start of
"Pass 3 - Register allocation" zero reg allocations are removed,
so "regmap_pre[i+1][hr] != regs[i].regmap[hr]" assert will not hold.

3 years agodrc: arm64 wip
notaz [Mon, 8 Nov 2021 22:26:05 +0000 (22:26 +0000)]
drc: arm64 wip

3 years agodrc: some more general cleanup
notaz [Fri, 5 Nov 2021 22:19:16 +0000 (00:19 +0200)]
drc: some more general cleanup

3 years agodrc: arm64 wip
notaz [Wed, 3 Nov 2021 23:37:59 +0000 (23:37 +0000)]
drc: arm64 wip

3 years agodrc: starting arm64 support
notaz [Tue, 2 Nov 2021 23:08:49 +0000 (23:08 +0000)]
drc: starting arm64 support

mostly stubs only for now

3 years agodrc: move some stuff out of assem_arm for reuse
notaz [Tue, 2 Nov 2021 15:47:56 +0000 (17:47 +0200)]
drc: move some stuff out of assem_arm for reuse

3 years agodrc: remove yet yet more n64 stuff
notaz [Tue, 2 Nov 2021 15:12:21 +0000 (17:12 +0200)]
drc: remove yet yet more n64 stuff

3 years agodrc: remove yet more n64 stuff
notaz [Tue, 2 Nov 2021 13:50:03 +0000 (15:50 +0200)]
drc: remove yet more n64 stuff

3 years agodrc: rework for 64bit, part 4
notaz [Mon, 1 Nov 2021 22:44:56 +0000 (00:44 +0200)]
drc: rework for 64bit, part 4

3 years agodrc: remove some leftover n64-only stuff
notaz [Mon, 1 Nov 2021 22:42:09 +0000 (00:42 +0200)]
drc: remove some leftover n64-only stuff

quite sure some more is left, but it's not easy to separate out

3 years agodrc: rework for 64bit, part 3
notaz [Mon, 1 Nov 2021 19:57:53 +0000 (21:57 +0200)]
drc: rework for 64bit, part 3

3 years agodrc: remove old debug code
notaz [Mon, 1 Nov 2021 16:14:23 +0000 (18:14 +0200)]
drc: remove old debug code

it just makes arm64 conversion harder

3 years agodrc: convert 'stubs' to a struct with proper types (rework part 2)
notaz [Mon, 1 Nov 2021 14:55:04 +0000 (16:55 +0200)]
drc: convert 'stubs' to a struct with proper types (rework part 2)

3 years agodrc: rework for 64bit, part 1
notaz [Sun, 31 Oct 2021 23:30:34 +0000 (01:30 +0200)]
drc: rework for 64bit, part 1

3 years agosome drc debug patches
notaz [Sun, 31 Oct 2021 17:12:50 +0000 (19:12 +0200)]
some drc debug patches

3 years agosome drc debug helpers
notaz [Sun, 31 Oct 2021 16:33:40 +0000 (18:33 +0200)]
some drc debug helpers

3 years agosome cleanup to reduce confusion
notaz [Sun, 31 Oct 2021 16:20:57 +0000 (18:20 +0200)]
some cleanup to reduce confusion

3 years agoupdate libpicofe
notaz [Sun, 31 Oct 2021 15:23:53 +0000 (17:23 +0200)]
update libpicofe

3 years agoassorted warning fixes
notaz [Sun, 31 Oct 2021 12:40:30 +0000 (14:40 +0200)]
assorted warning fixes

3 years agoci-linux.yml: also need submodules
notaz [Fri, 29 Oct 2021 21:08:27 +0000 (00:08 +0300)]
ci-linux.yml: also need submodules