pcsx_rearmed.git
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

2 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.

2 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.

2 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.

2 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

2 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

2 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.

2 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.

2 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

2 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

2 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.

2 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).

2 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

2 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

2 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

2 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.

2 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

2 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

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

forgot a dummy variable, whoops

2 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

2 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

2 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

2 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

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

2 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

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

2 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

2 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

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

2 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.

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

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

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

2 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

2 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

2 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

2 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

2 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

2 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

2 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

2 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

2 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)

2 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

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

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

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

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

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

2 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

2 years agotry to migrate from Travis CI to GitHub Actions
notaz [Fri, 29 Oct 2021 20:57:05 +0000 (23:57 +0300)]
try to migrate from Travis CI to GitHub Actions

2 years agoRemove CdlGetlocP hack. (#235)
gameblabla [Fri, 29 Oct 2021 20:22:25 +0000 (20:22 +0000)]
Remove CdlGetlocP hack. (#235)

This was added back in 2013 or so in PCSX Rearmed
and according to some tests against Tomb Raider 1 (which
is affected by the GetLocP code),
it works properly without this hack.

So let's just remove it as we are now doing it properly.
(Besides, Duckstation and mednafen don't have this hack)

2 years agoMove CdlSetLoc to CdrInterrupt and return invalid arg error (#234)
gameblabla [Fri, 29 Oct 2021 20:09:41 +0000 (20:09 +0000)]
Move CdlSetLoc to CdrInterrupt and return invalid arg error (#234)

So far,
i could only find Simple 1500 Series Vol. 31 - The Sound Novel to be affected by this.
In Duckstation, this was causing extra delays without it.
However in our case, this doesn't seem to be the case and i couldn't
find much find about it.

2 years agoNew, separate GPU plugin based on Unai. (#233)
gameblabla [Fri, 29 Oct 2021 20:03:27 +0000 (20:03 +0000)]
New, separate GPU plugin based on Unai. (#233)

This new plugin is based on Unai but is more accurate and fixes a few issues.
According to some tests on real hardware :
fps      old new
spyro1   130 112
tekken3   95  68
nfs3     107  91

Because of this, it was decided to make it separate from the "Old" Unai.

Note that this doesn't have the threading changes from libretro's fork yet :
this will be for another PR.

Co-authored-by: negativeExponent <negativeExponent@users.noreply.github.com>
Co-authored-by: Justin Weiss <justin@justinweiss.com>
Co-authored-by: senquack <dansilsby@gmail.com>
2 years agoHack fix for CDROM timings regression (Castlevania, Megaman X4) (#231)
gameblabla [Fri, 29 Oct 2021 20:00:59 +0000 (20:00 +0000)]
Hack fix for CDROM timings regression (Castlevania, Megaman X4) (#231)

See https://github.com/libretro/pcsx_rearmed/issues/557.

The CDROM timings changes from Redux fixed a bunch of games
(Crash Team Racing's intro no longer cuts off too early,
Worms Pinball gets further instead of just crashing,
FF8 Lunar Cry FMV no longer crashes etc...)
but it broke the other games that relied on ADPCM samples,
which is most noticeable in games like Castlevania or Megaman X4.

According to nicolasnoble, we should not cause a delay if seek destination is c>
However, this would require a lot more work so in the meantime,
let's do just that and add a comment.

2 years agoFix CD volume issue in Star Wars - Dark Forces. (#232)
gameblabla [Mon, 18 Oct 2021 20:20:09 +0000 (20:20 +0000)]
Fix CD volume issue in Star Wars - Dark Forces. (#232)

CD Volume is 16-bits signed, not unsigned.
Otherwise in Star Wars Dark Forces :
If you set the volume slider to the minimum value allowed
for the CD Volume, it will overflow and wrap around (to the maximum volume).

2 years agoFix oversight for icache emulation code. (#226)
gameblabla [Sun, 10 Oct 2021 15:30:59 +0000 (15:30 +0000)]
Fix oversight for icache emulation code. (#226)

This fixes Armored Core when being run in icache emulation mode.
This was a mistake on my part as i forgot about that piece of code.

2 years agocdriso: clean up after cdda thread removal
notaz [Sat, 2 Oct 2021 18:37:51 +0000 (21:37 +0300)]
cdriso: clean up after cdda thread removal

2 years agoMerge several fixes from PCSX Redux and adjust delay for SetLocPending. (#221)
gameblabla [Sat, 2 Oct 2021 17:51:48 +0000 (17:51 +0000)]
Merge several fixes from PCSX Redux and adjust delay for SetLocPending. (#221)

There's a game, PoPoLoCrois Monogatari II, that unfortunately locks up
during the intro screen.
I should have known that code was wrong as Mednafen did not have anything
like that in their code either, hence the confusion.

Their fix however still don't include the Driver fix so the game would still
crash if we don't have the "+ Seektime".
To be honest, i'm not sure why the PCSX Reloaded team did it this way...

I noticed that the fastforward and fastbackward code was pretty much unused.
Looked at Mednafen and all they do is just adjust the cursector
and make sure that fastword & backword trigger the AUTO_REPORT code
so i did the latter.

Co-authored-by: Nicolas Noble <nicolasnoble@users.noreply.github.com>
2 years agoProper CDDA fix for Fantastic Pinball Kyuutenkai (and remove CDDA playthread as it...
gameblabla [Sat, 2 Oct 2021 15:51:24 +0000 (15:51 +0000)]
Proper CDDA fix for Fantastic Pinball Kyuutenkai (and remove CDDA playthread as it causes issues) (#215)

Part of the CDROM related changes were taken from PCSX Reloaded.
https://github.com/gameblabla/pcsxr/blob/6484236cb0281e8040ff6c8078c87899a3407534/pcsxr/libpcsxcore/cdrom.c

2 years agoOne more on odd lines for PAL HSYNC (#224)
gameblabla [Sat, 2 Oct 2021 14:53:16 +0000 (14:53 +0000)]
One more on odd lines for PAL HSYNC (#224)

As done by Duckstation
https://github.com/stenzek/duckstation/blob/bbcf1c67d1aefd5de9cdc9c158f92bc7aaecaa63/src/core/gpu.h#L56

2 years agoFix for Armored Core misdetecting a Link cable being detected (#223)
gameblabla [Sat, 2 Oct 2021 14:39:44 +0000 (14:39 +0000)]
Fix for Armored Core misdetecting a Link cable being detected (#223)

For some reason, the game detects that a link cable is plugged in
and disables the local multiplayer as a result.

Thanks @sony for fixing the issue in their PS Classic branch, a
simplier fix is done here instead.

Co-authored-by: Sony
2 years agoIcache emulation from PCSX Redux + Senquack changes from PCSX4ALL (#198)
gameblabla [Sat, 2 Oct 2021 13:41:42 +0000 (13:41 +0000)]
Icache emulation from PCSX Redux + Senquack changes from PCSX4ALL (#198)

* Merge Icache emulation from PCSX Redux

See (Redux) :
https://github.com/grumpycoders/pcsx-redux/commit/1923ce54ef585beba3a948d50f8c30161102312c

See original icache implementation (mirror of PCSX Reloaded):
https://github.com/gameblabla/pcsxr

Without icache emulation, F1 2001 will greatly misbehave :
if you accelerate, the car will go around like crazy.
With icache emulation, it works as intended.

Our code is slightly different from theirs as i found out that
having the icache arrays in psxregs would cause crashes so instead
what i'm doing is to taking them out of there and only allocating them
on the heap (due to their great size).

Co-authored-by: Nicolas Noble <nicolasnoble@users.noreply.github.com>
* Fix issues with BREAK and some interpreter commands. Fixes F1 2000.

Note that the game is very sensible to timing issues when it comes to the CDROM
controller.
That will be for a separate commit however.

* Culling off cache bits from the hardware addresses.

Based on those PRs from PCSX-Redux :
https://github.com/grumpycoders/pcsx-redux/commit/0cd940100e96b95eea87dbb47381596f7f8dbe72#diff-009cbf66734b5de152bf170b80f8c7e03bebaa08a191f6ad7a06c7420f24b69c
https://github.com/grumpycoders/pcsx-redux/commit/03d2ba3f278868cdd7ee3a44edef7ee87e6a1589#diff-009cbf66734b5de152bf170b80f8c7e03bebaa08a191f6ad7a06c7420f24b69c

Co-authored-by: Nicolas Noble <nicolasnoble@users.noreply.github.com>
* Slightly better "open bus" behavior

OG commit is here from PCSX Redux :
https://github.com/grumpycoders/pcsx-redux/commit/128ba97f9680ab8dcd2f840f72ae998507325730#diff-8552772bc73559e3448880c9b8126252b49b95a89cfac254148d27127cbec719

Co-authored-by: Nicolas Noble <nicolasnoble@users.noreply.github.com>
* [Interpreter] Link even if branch is not taken in BGEZAL/BLTZAL

Source :
grumpycoders/pcsx-redux@c1a0569

Co-authored-by: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com>
Co-authored-by: Nicolas Noble <nicolasnoble@users.noreply.github.com>
2 years agoFix detection of some CDs such as Wild Arms USA detected as a PAL game. (#222)
gameblabla [Sat, 2 Oct 2021 13:23:27 +0000 (13:23 +0000)]
Fix detection of some CDs such as Wild Arms USA detected as a PAL game. (#222)

I was able to confirm it fixed the issue for Wild Arms.

Co-authored-by: bardeci <37640967+bardeci@users.noreply.github.com>
2 years agopsxmem: Writes to PIO Expansion area have no effect. (#220)
gameblabla [Mon, 27 Sep 2021 19:09:52 +0000 (19:09 +0000)]
psxmem: Writes to PIO Expansion area have no effect. (#220)

This is related to the Tetris with Card Captor fix a while back.
However, i forgot to merge this one as well related to writes,
even though it was not really necessary to fix that particular game.

Co-authored-by: senquack <dansilsby@gmail.com>
2 years agoARM build fixes. (Should fix building on ARM/GCC10) (#210)
gameblabla [Thu, 9 Sep 2021 20:20:54 +0000 (20:20 +0000)]
ARM build fixes. (Should fix building on ARM/GCC10) (#210)

This fixes building on GCC10 and ARM.
Note that in my previous HLE patch, i forgot to export psxNULL
so it was failling to compile it... Oops.

Co-authored-by: negativeExponent <negativeExponent@users.noreply.github.com>
2 years agoImplement fix from Mednafen for Fantastic Pinball Kyuutenkai. (#206)
gameblabla [Mon, 30 Aug 2021 22:34:02 +0000 (22:34 +0000)]
Implement fix from Mednafen for Fantastic Pinball Kyuutenkai. (#206)

This is taken from the way Mednafen implemented it.
https://github.com/libretro-mirrors/mednafen-git/blob/563b72e377fa8284559df4df0271108d4935c9f1/src/psx/cdc.cpp#L941

This properly fixes the freeze issue in Fantastic Pinball Kyuutenkai.

2 years agoFix regression with CdlPause (#209)
gameblabla [Mon, 30 Aug 2021 21:08:08 +0000 (21:08 +0000)]
Fix regression with CdlPause (#209)

2 years agoImprove CdlPause command based on Mednafen's implementation (#207)
gameblabla [Fri, 27 Aug 2021 22:05:02 +0000 (22:05 +0000)]
Improve CdlPause command based on Mednafen's implementation (#207)

Reference :
https://github.com/libretro-mirrors/mednafen-git/blob/master/src/psx/cdc.cpp#L1969

This fixed an issue with Worms Pinball booting to the language screen.
Previously, it would sometimes boot to it but not reliably
and the screen would always not appear or be black.

Now, the emulator doesn't crash anymore and the language screen
can be seen (although it is a glitchy mess).

2 years agoCDROM: Rename Reset+Init commands approperly, fix "This is Football 2" lockup (#205)
gameblabla [Thu, 26 Aug 2021 18:05:23 +0000 (18:05 +0000)]
CDROM: Rename Reset+Init commands approperly, fix "This is Football 2" lockup (#205)

Upon the reset command being issued, we need to set the Mode to 0x20
(as it was confirmed in Mednafen) and also disable the muting.

We also change the seektime for the reset command appropriately.
Please see Mednafen's implementation as reference :
https://github.com/libretro-mirrors/mednafen-git/blob/1899500078169e787f86eb5302a3f35abdaa8764/src/psx/cdc.cpp#L2007

This fixes the black screen issue in "This is Football 2".
This also fixes the black screen issue in Pooh's Party.

2 years agoFix CdlGetTD according to Mednafen's implementation. (#204)
gameblabla [Thu, 26 Aug 2021 18:04:19 +0000 (18:04 +0000)]
Fix CdlGetTD according to Mednafen's implementation. (#204)

2 years agoCdlGetmode is GetParam, fix it according to Mednafen's implementation (#203)
gameblabla [Wed, 25 Aug 2021 21:56:52 +0000 (21:56 +0000)]
CdlGetmode is GetParam, fix it according to Mednafen's implementation (#203)

The result size for GetParam (previously Getmode) should be only 5 and done this way.

2 years agoWe shouldn't throw an error for GetQ. (#202)
gameblabla [Wed, 25 Aug 2021 21:53:08 +0000 (21:53 +0000)]
We shouldn't throw an error for GetQ. (#202)

I doubt this is used by any games but who knows.

See Mednafen for reference :
https://github.com/libretro-mirrors/mednafen-git/blob/1899500078169e787f86eb5302a3f35abdaa8764/src/psx/cdc.cpp#L2527

2 years agoImprove SetLoc CDROM command from Duckstation (#201)
gameblabla [Wed, 25 Aug 2021 21:37:51 +0000 (21:37 +0000)]
Improve SetLoc CDROM command from Duckstation (#201)

See Duckstation's CDROM for reference :
https://github.com/stenzek/duckstation/blob/18241978ea056a81ff9847f0ad89658f886153ea/src/core/cdrom.cpp#L1087

This probably shouldn't make a difference but who knows.

2 years agoCdlSync should be NULL and return an error. (#199)
gameblabla [Wed, 25 Aug 2021 21:22:44 +0000 (21:22 +0000)]
CdlSync should be NULL and return an error. (#199)

This has been confirmed by both Mednafen and nocash's documentation.

2 years agoAlways look up verify_dirty literals from offsets by neonloop (#194)
gameblabla [Wed, 25 Aug 2021 20:55:22 +0000 (20:55 +0000)]
Always look up verify_dirty literals from offsets by neonloop (#194)

Literals are deduplicated, so there's no guarantee they will be stored
next to each other, even if they're written sequentially. verify_dirty
and get_bounds must use the offsets on each instruction, instead of
assuming values are stored sequentially.

Co-authored-by: neonloop <neonloop@pm.me>
2 years agopsxinterpreter: Merge DIV interpreter fix from libretro's fork (#193)
gameblabla [Sun, 22 Aug 2021 22:31:18 +0000 (22:31 +0000)]
psxinterpreter: Merge DIV interpreter fix from libretro's fork (#193)

Fix comes from here :
https://github.com/libretro/pcsx_rearmed/pull/530

Co-authored-by: Ember Cold <embercold@outlook.com>
2 years agoCDROM: Ignore sectors with channel number 255 (#195)
gameblabla [Sun, 22 Aug 2021 22:29:02 +0000 (22:29 +0000)]
CDROM: Ignore sectors with channel number 255 (#195)

This was inspired by the fix in Duckstation :
https://github.com/stenzek/duckstation/commit/0710e3b6d384526ed939f742f8f657623bb354bb

Some games have junk audio sectors with a channel number of 255.
If these are not skipped, then they will play wrong file.

This was tested on "Blue's Clues : Blue's Big Musical" and
it fixed the missing audio there.

Taxi 2 is also said to be affected by this.

2 years agomdec.cpp: Dare to set MDEC_BIAS to 10 (#186)
gameblabla [Sun, 22 Aug 2021 22:18:42 +0000 (22:18 +0000)]
mdec.cpp: Dare to set MDEC_BIAS to 10 (#186)

This fixes graphic artifacts during cinematics in :
- Vandal Hearts
- R-Types
- Galerians

Dmitrysmagin had a similar fix in PCSX4ALL but he set it to 6.
It turns out MDEC_BIAS set to 6 was still not enough for Galerians
to look properly so it was set to 10.
It seems so far that other games are unaffected.

Co-authored-by: Dmitry Smagin <exmortis@yandex.ru>
2 years agoFixes Diablo 1 SPU bug properly and remove Diablo hack. (#191)
gameblabla [Sun, 22 Aug 2021 21:50:09 +0000 (21:50 +0000)]
Fixes Diablo 1 SPU bug properly and remove Diablo hack. (#191)

(Mostly) inspired by the fixes done in PCSX Redux :
https://github.com/grumpycoders/pcsx-redux/blob/93653ba5281487d3bed57371d7b64c32dfc669f0/src/spu/registers.cc#L504

It seems that there was an attempt to initially implement it
in PCSX Reloaded (hence the bIgnoreLoop in freeze.c) but it was never
implemented properly.

Co-authored-by: Nicolas Noble <nicolasnoble@users.noreply.github.com>
2 years agoProperly protect the HLE instructions against corrupted memory. (#189)
gameblabla [Sun, 22 Aug 2021 21:39:05 +0000 (21:39 +0000)]
Properly protect the HLE instructions against corrupted memory. (#189)

Fix is from PCSX-redux :
https://github.com/grumpycoders/pcsx-redux/commit/99c9508f2a9dc1444b88f37eb100cdfb17862b52

This should hopefully fix HDHOSHY's experimental patch properly.

Co-authored-by: Nicolas Noble <nicolasnoble@users.noreply.github.com>
2 years agoRewrite GPU bios functions according to OpenBIOS. (#192)
gameblabla [Wed, 18 Aug 2021 21:15:09 +0000 (21:15 +0000)]
Rewrite GPU bios functions according to OpenBIOS. (#192)

See PCSX-Redux :
https://github.com/grumpycoders/pcsx-redux/blob/93653ba5281487d3bed57371d7b64c32dfc669f0/src/mips/openbios/gpu/gpu.c

2 years ago[SPU] Emulate SPUSTAT[5:0] as a mirror of SPUCNT[5:0] (#190)
gameblabla [Wed, 18 Aug 2021 20:58:45 +0000 (20:58 +0000)]
[SPU] Emulate SPUSTAT[5:0] as a mirror of SPUCNT[5:0] (#190)

Fix is from PCSX-Redux :
https://github.com/grumpycoders/pcsx-redux/commit/4e905d7953a26bffd52f486dc5b03c2a19075d01

I have tested the fix against Loonies 8192 (a PSn00bSDK made homebrew game) and it no longer
locks up during loading.

Co-authored-by: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com>
2 years agoCDRom timings changes (#184)
gameblabla [Wed, 18 Aug 2021 20:24:33 +0000 (20:24 +0000)]
CDRom timings changes (#184)

Upstreamed changes from PCSX Redux as seen here :
https://github.com/grumpycoders/pcsx-redux/commit/5730e04f0183f37038bc1d133cf9f9092425b90a

This apparently fixes Deus Fight in Xenogears.

Co-authored-by: Nicolas Noble <nicolasnoble@users.noreply.github.com>
2 years agoAdd internal database for problematic games. (#182)
gameblabla [Wed, 18 Aug 2021 20:22:43 +0000 (20:22 +0000)]
Add internal database for problematic games. (#182)

2 years agodeal with some more annoying warnings
notaz [Mon, 16 Aug 2021 22:09:20 +0000 (01:09 +0300)]
deal with some more annoying warnings

Especially main.c as it's regenerated after each commit.