notaz [Sat, 8 Feb 2020 19:29:08 +0000 (21:29 +0200)]
menu: fix a buffer overflow
Reported by @wwhheerree, closes #152.
notaz [Tue, 19 Nov 2019 22:24:11 +0000 (00:24 +0200)]
Merge pull request #147 from senquack/cdrom_sstate_fix
cdrom: add missing BCD->int convert in cdrFreeze()
Daniel Silsby [Tue, 12 Nov 2019 23:48:44 +0000 (18:48 -0500)]
cdrom: add missing BCD->int convert in cdrFreeze()
For some Eboot .PBP game images, when loading a savestate, a zlib error
like 'uncompress failed with -5 for block 5383, sector 86132' would be
output to stdout/stderr. The savestate would still be playable, though.
Traced it down to cdrFreeze() failing to convert cdr.Prev from BCD->int
when calling ReadTrack(). Note that the odd 'cdr.Prev[0]++;' line seems
to be someone's hacky way of forcing ReadTrack() to avoid skipping what
it thinks is a duplicate sector read.
notaz [Mon, 11 Nov 2019 18:50:44 +0000 (20:50 +0200)]
Merge pull request #146 from senquack/gpulib_fix
gpulib: fix out-of-bounds reads in do_cmd_buffer()
Daniel Silsby [Sat, 9 Nov 2019 01:30:04 +0000 (20:30 -0500)]
gpulib: fix out-of-bounds reads in do_cmd_buffer()
When gpu.cmd_buffer[] is filling up, and the last 1 or 2 words
in it are the beginning of a new vram read/write cmd, do_cmd_buffer()
would access out-of-bounds, reading garbage pos/size data.
Fixes corrupted gfx in this PS1 .exe test utility:
https://github.com/PeterLemon/PSX/tree/master/CPUTest/CPU/LOADSTORE/LW
(This and all similar tests on Peter's site).
Note that gfx access in this utility is done entirely through cmds given
through GPUwriteData(), i.e. direct CPU->GP0 stores, not DMA.
notaz [Sat, 3 Aug 2019 13:22:14 +0000 (16:22 +0300)]
Merge pull request #139 from retro-wertz/patch-3
Fix corrupted memory card saves when using HLE
retro-wertz [Sat, 3 Aug 2019 13:04:35 +0000 (21:04 +0800)]
Fix corrupted memory card saves when using HLE
- This is fixed by adding the missing SaveMcd() to buwrite().
Tested on Wild Arms and Breath of Fire III
notaz [Wed, 24 Jul 2019 20:39:11 +0000 (23:39 +0300)]
Merge pull request #137 from gameblabla/hle
HLE BIOS improvements (based on nocash doc, pcsx4all, upstream pcsxr etc...)
gameblabla [Mon, 22 Jul 2019 21:25:49 +0000 (23:25 +0200)]
psxbios: Don't accept 400h as a valid sector.
Notaz said this could corrupt the emulator (even though
the console allowed this and it was a bug) so limit it to 0x3FF.
gameblabla [Mon, 22 Jul 2019 02:39:41 +0000 (04:39 +0200)]
psxbios: Properly fix garbage area code.
This should work as intended now.
gameblabla [Sun, 21 Jul 2019 18:57:57 +0000 (20:57 +0200)]
psxbios: Fixup mistake in card_info function.
This fixes Looney Tunes Sheep Raiders.
gameblabla [Sun, 21 Jul 2019 15:31:48 +0000 (17:31 +0200)]
psxbios: Return value is always 1 for CloseTh and ChangeTh.
According to nocash PSX doc, ChangeThread and CloseThread should
always return 1. Fix it accordingly.
gameblabla [Sun, 21 Jul 2019 05:43:56 +0000 (07:43 +0200)]
psxbios: Add checks for memchr.
gameblabla [Sun, 21 Jul 2019 03:39:55 +0000 (05:39 +0200)]
psxbios: Some games read from address 0, fix that.
See Garbage Area at Address 00000000h in Nocash PSX Specifications for more inf>
R-types will refuse to boot if psxM[0] is zero.
Fade to Black can crash upon memory card access if psxM[5] is set to the wrong >
Crash Team Racing will refuse to boot if psxM[2] and psxM[3] are not zero.
(Previously, that region of memory would be overwritten above. No explanation why.)
It's set as such according to nocash :
[00000000h]=3C1A0000h ;<-- but overwritten by 00000003h after soon
[00000004h]=275A0C80h ;<-- or 275A0C50h (in older BIOS)
[00000008h]=03400008h
[0000000Ch]=00000000h
Note that setting 00000000h to 00000003h doesn't work for R-types.
gameblabla [Sun, 21 Jul 2019 00:45:58 +0000 (02:45 +0200)]
psxbios: Implement get_cd_status stub according to nocash doc.
gameblabla [Sun, 21 Jul 2019 00:38:32 +0000 (02:38 +0200)]
psxbios: Make HLE bios start from block 1, not 2.
I already fixed this for bufile :
ptr = Mcd##mcd##Data + 128 * (nfile + 1); \
instead of
ptr = Mcd##mcd##Data + 128 * nfile; \
But i forgot to also fix psxBios_firstfile accordingly.
So nfile would still start from block 2 and it would
cause all kinds of issues.
This was the original comment on pcsxr codeplex
as my patch was based on it :
"The HLE-Bios start to read memory card blocks at block 2. You need to change
ptr = Mcd##mcd##Data + 128 * nfile; \ to
ptr = Mcd##mcd##Data + 128 * (nfile + 1); \
for #define bufile(mcd) { \ and changing nfile = 1; to nfile = 0; for psxBios_firstfile() { // 42 Starts numbering slots in the right position."
gameblabla [Sun, 21 Jul 2019 00:30:15 +0000 (02:30 +0200)]
psxbios: Fix card_status function as to use card_active_chan.
gameblabla [Sun, 21 Jul 2019 00:13:34 +0000 (02:13 +0200)]
psxbios: Merge interrupt_r26 fix from PCSX4ALL.
Thanks DmitrySmagin for the fix.
gameblabla [Sun, 21 Jul 2019 00:10:27 +0000 (02:10 +0200)]
psxbios: Do the same for heap_size.
gameblabla [Sat, 20 Jul 2019 23:31:24 +0000 (01:31 +0200)]
psxbios : Use bfreezel for pad_stopped instead of setting it to 0.
gameblabla [Sat, 20 Jul 2019 23:28:56 +0000 (01:28 +0200)]
psxbios : Implement stub for wait_card.
Pretty much identical to get_card_status except it's supposed
to wait until a non-busy state occurs.
gameblabla [Sat, 20 Jul 2019 23:26:10 +0000 (01:26 +0200)]
psxbios : Fix a few mistakes :
- Remove extra ffile, pfile.. as it is declared elsewhere.
- Remove extra condition as it's already being handled by pad_stopped.
- Remove n variable from function (pcsx4all did this) as it's useless
and documentation doesn't seem to specify it's needed.
gameblabla [Thu, 18 Jul 2019 00:51:25 +0000 (02:51 +0200)]
psxbios: Add note and update copyright.
gameblabla [Thu, 18 Jul 2019 00:42:41 +0000 (02:42 +0200)]
psxbios: Merge heap fix from PCSX4ALL.
gameblabla [Thu, 18 Jul 2019 00:40:13 +0000 (02:40 +0200)]
psxbios: Init some vars just to be sure.
gameblabla [Thu, 18 Jul 2019 00:38:32 +0000 (02:38 +0200)]
psxbios: Merge PCSX4ALL pad_stopped fix.
gameblabla [Thu, 18 Jul 2019 00:35:47 +0000 (02:35 +0200)]
psxbios.cpp: Add psxBios_card_status(); doesn't seem to affect anything
gameblabla [Thu, 18 Jul 2019 00:34:31 +0000 (02:34 +0200)]
psxbios: Fixes save issues on Parasite Eve II, Parasite Eve I and others
Merging never-merged fix by Solus for Parasite Eve. I also fixed some GCC warnings
about dir->name going out of bounds too.
We also make sure to only add '/0' if string is not full and right after the last character in the dir array.
This fixes saving/loading in Parasite Eve II, Parasite Eve.
It also fixed regressions for the LEGO Racers where other games would break,
meaning this should be the proper fix for saves.
We're also using our own strlen implementation to avoid any issues or
relying on the libc's own strlen.
gameblabla [Thu, 18 Jul 2019 00:30:31 +0000 (02:30 +0200)]
psxbios: Callback Events should not set event status to busy in TestEvent.
We are already doing that in WaitEvent. According to nocash documentation,
this also applies to TestEvent as well so let's implement it.
gameblabla [Thu, 18 Jul 2019 00:29:49 +0000 (02:29 +0200)]
psxbios: Support other syscalls
Since they don't do anything however, let's just add a default and break;
instead. Interestingly, trying to implement SYS(04h+ can actually crash
the HLE bios. Nocash documentation said that it should crash it
but due to other reasons, it doesn't and returns to main program instead.
gameblabla [Thu, 18 Jul 2019 00:28:55 +0000 (02:28 +0200)]
psxbios: Add checks for strlen.
Per what Nocash documentation says.
gameblabla [Thu, 18 Jul 2019 00:28:22 +0000 (02:28 +0200)]
psxbios: Add checks for strcpy & strncpy.
This should be closer to documentation.
gameblabla [Thu, 18 Jul 2019 00:27:11 +0000 (02:27 +0200)]
psxbios: Fixup free.
This is needed for Burning Road. Fix comes from PCSX4ALL by dmitryssmagin.
gameblabla [Thu, 18 Jul 2019 00:26:18 +0000 (02:26 +0200)]
psxbios: Add checks for strcmp & strncmp.
Yes, it's supposed to have a lot of checks like these.
Also merge some more fixes from PCSX4ALL. (upstream did not have
these as far as i know)
gameblabla [Thu, 18 Jul 2019 00:23:24 +0000 (02:23 +0200)]
psxbios: Stub for get_error
According to a user on PCSX-Reloaded codeplex (now dead), this fixed loading/saving
in Final Fantasy Tactics.
gameblabla [Thu, 18 Jul 2019 00:21:53 +0000 (02:21 +0200)]
psxbios : Several fixes to malloc.
- Don't allow malloc to init memory if heap is invalid
According to nocash documentation, malloc will not allocate if heap size
is too small or invalid.
- Also merge some fixes from PCSX4ALL fork by senquack in order to allow
Burning Road to run.
gameblabla [Thu, 18 Jul 2019 00:19:07 +0000 (02:19 +0200)]
psxbios: Add checks for memmove.
Always returns dst per documentation.
gameblabla [Thu, 18 Jul 2019 00:17:35 +0000 (02:17 +0200)]
psxbios : Add checks to memset.
This now can be a tricky pony and an improper memset implementation means that
you can't play Tomb Raider 4 properly.
(Trying to put in the eye of horus will just result in Lara sidestepping)
This should hopefully be fixed (and follows nocash doc).
gameblabla [Thu, 18 Jul 2019 00:16:41 +0000 (02:16 +0200)]
psxbios: Add checks to memcpy.
Always returns dst
gameblabla [Thu, 18 Jul 2019 00:15:27 +0000 (02:15 +0200)]
psxbios: Add checks for bzero.
Only return 0 if size is invalid. (0 or 0x7FFFFFFF), return dst if not.
gameblabla [Thu, 18 Jul 2019 00:13:13 +0000 (02:13 +0200)]
psxbios: Add checks for bcopy
Nocash documentation say that function refuses to copy any data
if dst is NULL or len greater than 0x7FFFFFFF.
(In any cases, return value is always dst)
gameblabla [Thu, 18 Jul 2019 00:12:23 +0000 (02:12 +0200)]
psxbios : Add checks to index and rindex calls
Return 0 for index/rindex if src is 0x00.
gameblabla [Thu, 18 Jul 2019 00:11:40 +0000 (02:11 +0200)]
psxbios: Merge upstream fix for Deliverevent in firstfile
Looks like it is only executed for memory cards, that makes sense i guess.
gameblabla [Thu, 18 Jul 2019 00:10:43 +0000 (02:10 +0200)]
psxbios: Should fix input issues in some games.
Someone reported that this fixed Negcon controls in Ridge Racer Revolution
and Grand Tour Racing.
I doubt this will suffer from regressions ?
gameblabla [Thu, 18 Jul 2019 00:09:56 +0000 (02:09 +0200)]
psxbios: Fix out-of-bounds issue.
Make sure to return 0xff is no TCBs are available.
Thanks senquack for the proper fix.
gameblabla [Thu, 18 Jul 2019 00:08:32 +0000 (02:08 +0200)]
Only PCSX4ALL uses ResetIoCycle. Remove it for now.
gameblabla [Thu, 18 Jul 2019 00:07:56 +0000 (02:07 +0200)]
Fixup buread & buwrite being undefined.
gameblabla [Thu, 18 Jul 2019 00:02:48 +0000 (02:02 +0200)]
psxbios: Improve WaitEvent behaviour according to documentation
Nocash says it should return 0 if Event is unused, which it already does so it might be safe to remove the warning about it.
(see why below)
Then, it says that it should return 1 if event is ready (EvStALREADY). When that happens, it should also set it to ready (EvStACTIVE),
unless event mode is EvMdINTR. (aka Callback Events)
If it is a callback event, then documentation says it should be stuck in a loop forever.
It also says that it can sometime return 0 (a BUG according to nocash),
especially if it switched from EvStALREADY to EvStACTIVE.
Said return value was previously set to 1, for some reasons. Now that we are covering all the corner cases,
we should be returning 0 instead by default to cover the BUG.
This should cover how most games expects it to behave now and should make it more robust.
gameblabla [Thu, 18 Jul 2019 00:01:34 +0000 (02:01 +0200)]
psxbios: Better realloc implementation
This should be closer to the real behaviour as described by nocash.
It doesn't do any bcopy though but it shouldn't be too much different
other than that.
gameblabla [Thu, 18 Jul 2019 00:00:11 +0000 (02:00 +0200)]
psxbios : Add checks for strncat
Returns 0 if src or dst is 0x00.
gameblabla [Wed, 17 Jul 2019 23:59:35 +0000 (01:59 +0200)]
psxbios: Add todigit implementation
Based on CTRX's code : https://github.com/machinamentum/CTRX/blob/master/bios/source/libc.c#L152
I'm not aware of any games using it but it doesn't hurt to have it
and it should work fine.
gameblabla [Wed, 17 Jul 2019 23:58:44 +0000 (01:58 +0200)]
psxbios: Adds putc and getc implementation
getc will need to be fixed later but this should do as it is.
No issues with putc. Both are similar to psxBios_read and psxBios_write,
except size is 1.
gameblabla [Wed, 17 Jul 2019 23:57:53 +0000 (01:57 +0200)]
psxbios: Return 0x1f801814 for gpu_abort_dma
Nocash documentation says that it returns the I/O address.
I doubt any games use it so but it doesn't hurt to have it.
gameblabla [Wed, 17 Jul 2019 23:57:08 +0000 (01:57 +0200)]
psxbios: Better EnterCiritcal implementation
Nocash documentation says it should return 0 if one or
none of the bits were changed and return 1 of both bits were set.
This fixes Medievil 2, which would freeze upon starting up a game
and this properly fixes Digimon World crashing (with fixed strcat implementation).
It also possibly fix other games.
gameblabla [Wed, 17 Jul 2019 23:55:57 +0000 (01:55 +0200)]
psxbios: Add checks for card_write, card_read
This also implements a bug which allows writes to 0x400
(Is supposed to only accept sector number between 0..3FFh).
Function should return 0 if sector is invalid.
gameblabla [Wed, 17 Jul 2019 23:54:58 +0000 (01:54 +0200)]
psxbios: Merging improved card_info function from upstream
It should be closer to the real thing, and this commit and the previous one
definitely fixes the save issues in Digimon World.
gameblabla [Wed, 17 Jul 2019 23:44:03 +0000 (01:44 +0200)]
psxbios: Merging fixes from upstream.
DeliverEvent functions are executed right after writing/reading instead of after setting v0.
This fixes saving in games like LEGO Racers.
gameblabla [Wed, 17 Jul 2019 23:10:33 +0000 (01:10 +0200)]
psxbios: Add checks to PAD_init
Nocash documentation says that function fails if type is not 0x20000000
or 0x20000001. In case of failure, it should return 0.
If not, then it should return 2.
This fixes input in Digimon World.
gameblabla [Wed, 17 Jul 2019 23:09:21 +0000 (01:09 +0200)]
psxbios: Add checks to strcat
Nocash documentation says that function fails if src or dst is 0.
If so, then it must return 0.
This fix is required for fixing crash on bootup in Digimon World.
notaz [Mon, 25 Mar 2019 21:48:57 +0000 (23:48 +0200)]
Merge pull request #127 from retro-wertz/fix_rtps_rtpt
gte: backport fix for RTPS/RTPT
notaz [Mon, 25 Mar 2019 21:46:49 +0000 (23:46 +0200)]
Merge pull request #130 from retro-wertz/patch-1
gte: change return to s64 for BOUNDS_
retro-wertz [Sat, 23 Mar 2019 07:25:04 +0000 (15:25 +0800)]
gte: change return to s64 for BOUNDS_
fix https://github.com/notaz/pcsx_rearmed/issues/129
retro-wertz [Sat, 23 Mar 2019 01:26:39 +0000 (09:26 +0800)]
gte: backport fix for RTPS/RTPT
Fix glitched drawing of road surface in 'Burning Road'..
behavior now matches Mednafen. This also preserves the fix by Shalma
from prior commit
f916013 for missing elements in 'Legacy of Kain:
Soul Reaver' (missing green plasma balls in first level).
- backported fix from pcsx4all
https://github.com/dmitrysmagin/pcsx4all/pull/41/commits/
a6ff7d29d615bdb26b491f4e1e2a9f4608a8d643
- fixes R4 - Ridge Racer Type 4 lighting issue
notaz [Tue, 12 Mar 2019 22:56:19 +0000 (00:56 +0200)]
Merge pull request #123 from gameblabla/diablofix_hack
Diablo Music fix for PCSX Rearmed. (optional hack)
notaz [Sat, 9 Mar 2019 17:45:49 +0000 (19:45 +0200)]
Merge pull request #124 from gameblabla/buildingfixes
Fix for compiling it against newer zlib versions.
gameblabla [Thu, 7 Mar 2019 20:05:25 +0000 (21:05 +0100)]
Fix for compiling it against newer zlib versions.
gameblabla [Thu, 7 Mar 2019 19:47:17 +0000 (20:47 +0100)]
Diablo Music fix for PCSX Rearmed. (optional hack)
Let's also allow it to be changed from the menu.
Set to off by default as it could cause issues in some other games.
notaz [Tue, 19 Feb 2019 02:15:35 +0000 (04:15 +0200)]
Merge pull request #119 from gameblabla/piofix
psxmem: Reads of PIO Expansion area read all-ones.
gameblabla [Sun, 17 Feb 2019 08:26:51 +0000 (09:26 +0100)]
psxmem: Reads of PIO Expansion area read all-ones.
Patch by senquack :
"Fixes 'Tetris with Card Captor Sakura - Eternal Heart (Japan)' startup.
Thanks to gameblabla for finding this issue and pointing out that
Mednafen had a fix for it. It's adapted here in a much simpler form."
notaz [Tue, 17 Oct 2017 09:02:00 +0000 (12:02 +0300)]
Merge pull request #98 from psyke83/master
RPI: add Mesa override & update vendor library names
Conn O'Griofa [Mon, 16 Oct 2017 16:50:42 +0000 (17:50 +0100)]
RPI: add Mesa override & update vendor library names
* Update RPI vendor library names to allow compatibility with recent
firmwares that have obsoleted the originally named duplicate libraries.
* Add override to build against VC4 Mesa driver via "VIDEOCORE=no"
notaz [Tue, 2 May 2017 23:52:15 +0000 (02:52 +0300)]
use pc-relative offsets for PIC too
notaz [Fri, 30 Sep 2016 10:58:12 +0000 (13:58 +0300)]
drc: fix a mistake from w^x change
Fixes:
d148d265
notaz [Tue, 20 Sep 2016 23:07:16 +0000 (02:07 +0300)]
drc: some vita and 3ds support
not tested, mostly just guesswork
notaz [Tue, 20 Sep 2016 22:06:32 +0000 (01:06 +0300)]
drc: avoid MAP_FIXED
it's almost never a good idea, it will override some other mapping
and make things crash
notaz [Sun, 18 Sep 2016 23:40:17 +0000 (02:40 +0300)]
drc: try to support w^x platforms like iOS
untested...
notaz [Sun, 18 Sep 2016 21:00:48 +0000 (00:00 +0300)]
drc: remove unnecessary cache flushing
should already be flushed or not matter at this point
notaz [Sun, 18 Sep 2016 20:58:17 +0000 (23:58 +0300)]
drc: enable and fix warnings
these were kept for compat with Ari64's code, which is removed, see
previous commit messages
notaz [Sun, 18 Sep 2016 20:43:04 +0000 (23:43 +0300)]
drc: mark things static
notaz [Sun, 18 Sep 2016 17:10:06 +0000 (20:10 +0300)]
drc: strip eol blanks
Because people send patches while using editors that strip blanks
and the patch becomes a mess.
notaz [Sun, 18 Sep 2016 17:04:25 +0000 (20:04 +0300)]
drc: drop less obvious dead code
notaz [Sun, 18 Sep 2016 16:22:58 +0000 (19:22 +0300)]
drc: drop heaps of dead code
I've kept it around to keep the code similar to Ari64's version,
so that it would be easier to merge back his fixes. However Mupen64plus
has long reformatted the code and it kind of went different direction
anyway, so there is no point to keep all this code now.
notaz [Sat, 9 Jul 2016 23:09:08 +0000 (02:09 +0300)]
libretro: try to prevent bad builds
notaz [Thu, 31 Mar 2016 23:34:52 +0000 (02:34 +0300)]
fix build on some archs
just some unneeded preprocessor check
notaz [Thu, 31 Mar 2016 22:49:55 +0000 (01:49 +0300)]
don't use __ARM_ARCH_7A__
github issue #68
notaz [Thu, 31 Mar 2016 22:16:56 +0000 (01:16 +0300)]
use __ARM_ARCH
notaz [Sat, 5 Mar 2016 01:20:41 +0000 (03:20 +0200)]
large file support
not tested if it actually reads over 2GB
notaz [Sun, 28 Feb 2016 21:36:59 +0000 (23:36 +0200)]
psxmem: use rounding that's more likely to work
notaz [Sun, 28 Feb 2016 21:03:44 +0000 (23:03 +0200)]
drc: handle any immediate
notaz [Thu, 7 Jan 2016 21:47:01 +0000 (23:47 +0200)]
menu: fix input config for device names ending with space
reported by KP142EH12 and perhaps somebody else I forgot
also take the opportunity to update libpicofe
notaz [Tue, 24 Mar 2015 22:39:24 +0000 (00:39 +0200)]
psxmem: fix error handling
also bump libpicofe for mmap fix
gizmo98 [Fri, 13 Feb 2015 15:33:04 +0000 (16:33 +0100)]
arm_features.h Add ARM architectures 8A and 6M
Just copied macros from gcc source code:
https://github.com/gcc-mirror/gcc/blob/
113a5d9f83975b703ec06a1d2baa30604d322cf1/libatomic/config/arm/arm-config.h#L54
notaz [Thu, 5 Feb 2015 23:26:44 +0000 (01:26 +0200)]
libretro: always use fixed samples per frame
notaz [Thu, 5 Feb 2015 00:50:46 +0000 (02:50 +0200)]
release r22
notaz [Thu, 5 Feb 2015 00:37:56 +0000 (02:37 +0200)]
gpulib: remove unneeded hack
notaz [Thu, 5 Feb 2015 00:36:58 +0000 (02:36 +0200)]
dma: some timing hacks
untested
notaz [Thu, 5 Feb 2015 00:29:23 +0000 (02:29 +0200)]
dma: do some madr updates
untested, but makes ff7 behave better with linked lists
(dither problem)
notaz [Tue, 3 Feb 2015 22:31:01 +0000 (00:31 +0200)]
gpu_unai: fix some 64bit issues
notaz [Tue, 3 Feb 2015 01:10:06 +0000 (03:10 +0200)]
frontend: fix minor glitches on video mode changes
notaz [Mon, 2 Feb 2015 23:35:33 +0000 (01:35 +0200)]
frontend: update libpicofe