pcsx_rearmed.git
4 years agoUpdate psemu_plugin_defs.h
SindenLightgun [Sat, 14 Sep 2019 23:03:36 +0000 (00:03 +0100)]
Update psemu_plugin_defs.h

4 years agoAdding Guncon support for mouse based lightguns
SindenLightgun [Sat, 14 Sep 2019 23:02:42 +0000 (00:02 +0100)]
Adding Guncon support for mouse based lightguns

4 years agoAdding Guncon support for mouse based lightguns
SindenLightgun [Sat, 14 Sep 2019 23:01:43 +0000 (00:01 +0100)]
Adding Guncon support for mouse based lightguns

4 years agoAdding Guncon support for mouse based lightguns
SindenLightgun [Sat, 14 Sep 2019 22:59:29 +0000 (23:59 +0100)]
Adding Guncon support for mouse based lightguns

4 years agoAdding Guncon support for mouse based lightguns
SindenLightgun [Sat, 14 Sep 2019 22:57:30 +0000 (23:57 +0100)]
Adding Guncon support for mouse based lightguns

4 years agoAdding Guncon support for mouse based lightguns
SindenLightgun [Sat, 14 Sep 2019 22:54:40 +0000 (23:54 +0100)]
Adding Guncon support for mouse based lightguns

4 years agoMerge pull request #339 from dankcushions/patch-1
Twinaphex [Wed, 21 Aug 2019 23:24:21 +0000 (01:24 +0200)]
Merge pull request #339 from dankcushions/patch-1

Added support for PSXONPSP660.bin and psx* named BIOS files

4 years agoAdded support for PSXONPSP660.bin and psx* named BIOS files
dankcushions [Wed, 21 Aug 2019 22:47:11 +0000 (23:47 +0100)]
Added support for PSXONPSP660.bin and psx* named BIOS files

4 years agoMerge pull request #335 from yoshisuga/ios-arm64-buildbot-fix
Twinaphex [Wed, 14 Aug 2019 15:57:51 +0000 (17:57 +0200)]
Merge pull request #335 from yoshisuga/ios-arm64-buildbot-fix

iOS: support for building using buildbot recipe

4 years agoMerge pull request #334 from jdgleaver/options-update
Twinaphex [Wed, 14 Aug 2019 13:19:52 +0000 (15:19 +0200)]
Merge pull request #334 from jdgleaver/options-update

Update 'libretro_core_options.h' to v1.3 format

4 years agoUpdate 'libretro_core_options.h' to v1.3 format
jdgleaver [Wed, 14 Aug 2019 13:10:51 +0000 (14:10 +0100)]
Update 'libretro_core_options.h' to v1.3 format

4 years agoiOS: support for building using buildbot recipe
Yoshi Sugawara [Tue, 13 Aug 2019 20:40:25 +0000 (10:40 -1000)]
iOS: support for building using buildbot recipe

4 years agoMerge pull request #330 from retro-wertz/skip_plugins
Twinaphex [Wed, 7 Aug 2019 11:58:05 +0000 (13:58 +0200)]
Merge pull request #330 from retro-wertz/skip_plugins

Do not compile plugins when using the non-static build method

4 years agoDo not compile plugins when using the non-static build method
retro-wertz [Wed, 7 Aug 2019 10:49:38 +0000 (18:49 +0800)]
Do not compile plugins when using the non-static build method

- This is meant for platforms that still uses the non-static build method to compile the libretro core (aka versions of retropie)
- The output file is still libretro.so to preserve any compatibility with existing script
- Using the static makefile is still recommended.

4 years agoMerge pull request #328 from retro-wertz/sanitize_gpu_adv_options
Twinaphex [Mon, 5 Aug 2019 02:53:52 +0000 (04:53 +0200)]
Merge pull request #328 from retro-wertz/sanitize_gpu_adv_options

Sanitize gpu adv options and close plugins upon exiting core

4 years agoMerge pull request #327 from retro-wertz/patch-4
Twinaphex [Mon, 5 Aug 2019 01:52:56 +0000 (03:52 +0200)]
Merge pull request #327 from retro-wertz/patch-4

Fix main RAM size in retro_get_memory_size

4 years agoClose plugins when exiting core
retro-wertz [Mon, 5 Aug 2019 01:52:18 +0000 (09:52 +0800)]
Close plugins when exiting core

4 years agoUpdate advanced peops gpu core options
retro-wertz [Mon, 5 Aug 2019 01:46:37 +0000 (09:46 +0800)]
Update advanced peops gpu core options

4 years agoFix main RAM size in retro_get_memory_size
retro-wertz [Sun, 4 Aug 2019 23:39:22 +0000 (07:39 +0800)]
Fix main RAM size in retro_get_memory_size

PSX Main RAM should only by 2048KB

4 years agoMerge pull request #326 from retro-wertz/silence_warnings
hizzlekizzle [Sat, 3 Aug 2019 13:33:29 +0000 (08:33 -0500)]
Merge pull request #326 from retro-wertz/silence_warnings

silence warnings and a few core fixes

4 years agoSilence a few more warnings
retro-wertz [Sat, 3 Aug 2019 12:56:36 +0000 (20:56 +0800)]
Silence a few more warnings

- silence a few more truncated warnings
- change "disable" to "disabled" in core options

4 years agoHLE BIOS: Fix corrupted memory card saves
retro-wertz [Sat, 3 Aug 2019 12:27:27 +0000 (20:27 +0800)]
HLE BIOS: Fix corrupted memory card saves

- Save files for games that are suppose to work with HLE bios are now corrupted from the last HLE BIOS improvements PR.
- This only affects memcard 2 slot when enabled and used. Saves on memcard 1 are fine since those are directly handled through the Libretro API.
- This is fixed by adding the missing SaveMcd() to buwrite().

Tested on Wild Arms and Breath of Fire III

NOTE: HLE bios is still not compatible for most games. For example, memory card save functions are broken or does not work at all. Most of Konami games i have tested does not work with HLE BIOS for memory card saves.

4 years agopsxbios.c: Cleanup buopen()
retro-wertz [Sat, 3 Aug 2019 09:53:45 +0000 (17:53 +0800)]
psxbios.c: Cleanup buopen()

- This just silences some [-Wpointer-sign] warning from last PR

4 years agoFix region detection for Wild Arms
retro-wertz [Sat, 3 Aug 2019 04:02:35 +0000 (12:02 +0800)]
Fix region detection for Wild Arms

- Wild Arms EU and US version has non-standard string (probably for region protection) causing auto-region detection to fail and wrong CDROM info in log.
- This fix sanitizes the string name to remove unneeded characters ("EXE\" in this case that comes before the serial-number). This would sanitize the CD-ROM info in log as well.

4 years agoSilence warning -Wstringop-truncation
retro-wertz [Sat, 3 Aug 2019 03:13:47 +0000 (11:13 +0800)]
Silence warning -Wstringop-truncation

-strncpy replaced with strcpy and memcpy where appropriate

4 years agoSilence warning -Wformat-overflow
retro-wertz [Sat, 3 Aug 2019 00:35:12 +0000 (08:35 +0800)]
Silence warning -Wformat-overflow

- Increasing the maximum size of destination char array to x2 to silence this warning.

4 years agoMerge pull request #325 from retro-wertz/SysPrintf_to_retro_log
hizzlekizzle [Fri, 2 Aug 2019 13:38:48 +0000 (08:38 -0500)]
Merge pull request #325 from retro-wertz/SysPrintf_to_retro_log

SysPrintf to retro_log and silence some warnings

4 years agoSanitize Loaded CD image string in log
retro-wertz [Fri, 2 Aug 2019 12:55:20 +0000 (20:55 +0800)]
Sanitize Loaded CD image string in log

4 years agoSilence warning about misleading indent
retro-wertz [Fri, 2 Aug 2019 11:37:20 +0000 (19:37 +0800)]
Silence warning about misleading indent

4 years agoSilence warning: missing braces around initializer
retro-wertz [Fri, 2 Aug 2019 11:06:03 +0000 (19:06 +0800)]
Silence warning: missing braces around initializer

4 years agoRename PACKAGE_VERSION to PCSX_VERSION
retro-wertz [Fri, 2 Aug 2019 11:02:52 +0000 (19:02 +0800)]
Rename PACKAGE_VERSION to PCSX_VERSION

- this should silence warning for another PACKAGE_VERSION define used for flac
- PACKAGE_VERSION is not used within pcsx other than version logging. Savestate does not check for this and is using another define for savestate version number.

4 years agoUse retro_log for SysPrintf
retro-wertz [Fri, 2 Aug 2019 10:51:32 +0000 (18:51 +0800)]
Use retro_log for SysPrintf

4 years agoMerge pull request #323 from fpscan/master
Twinaphex [Tue, 30 Jul 2019 22:45:31 +0000 (00:45 +0200)]
Merge pull request #323 from fpscan/master

Update libretro_core_options.h

4 years agoUpdate libretro_core_options.h
Ömercan Kömür [Tue, 30 Jul 2019 21:16:02 +0000 (00:16 +0300)]
Update libretro_core_options.h

option_defs_tr,

4 years agoMerge pull request #322 from retro-wertz/fix_android_build
Twinaphex [Tue, 30 Jul 2019 20:59:20 +0000 (22:59 +0200)]
Merge pull request #322 from retro-wertz/fix_android_build

Fix android build

4 years agoFix android build
retro-wertz [Tue, 30 Jul 2019 20:30:05 +0000 (04:30 +0800)]
Fix android build

4 years agoMerge pull request #321 from fpscan/master
hizzlekizzle [Tue, 30 Jul 2019 15:34:19 +0000 (10:34 -0500)]
Merge pull request #321 from fpscan/master

Turkish Language Support

4 years agoMerge pull request #320 from retro-wertz/new_core_options
hizzlekizzle [Tue, 30 Jul 2019 15:33:45 +0000 (10:33 -0500)]
Merge pull request #320 from retro-wertz/new_core_options

target actual gpu plugin used for advance gpu core options

4 years agoTurkish Language Support
Ömercan Kömür [Tue, 30 Jul 2019 15:24:38 +0000 (18:24 +0300)]
Turkish Language Support

4 years agoSilence this log message
retro-wertz [Tue, 30 Jul 2019 02:08:33 +0000 (10:08 +0800)]
Silence this log message

- Removing this log message since RETRO_ENVIRONMENT_SET_GEOMETRY will show width and height when there is a change from last callback.

4 years agoMake advanced gpu options target actual gpu plugin used
retro-wertz [Tue, 30 Jul 2019 02:03:04 +0000 (10:03 +0800)]
Make advanced gpu options target actual gpu plugin used

- In the case of IOS, the core uses UNAI but can be built with dynarec or interpreter. Other platform does as well. So gpu-specific  defines are added for actual  gpu plugin used and compiled and then the specific gpu-only core options are shown or hidden based on this #define

4 years agoUpdate libretro_core_options.h
Twinaphex [Mon, 29 Jul 2019 16:47:25 +0000 (18:47 +0200)]
Update libretro_core_options.h

4 years agoMerge pull request #319 from retro-wertz/new_core_options
hizzlekizzle [Mon, 29 Jul 2019 15:44:39 +0000 (10:44 -0500)]
Merge pull request #319 from retro-wertz/new_core_options

add new core options menu, add advance gpu options.

4 years agoAdd advanced gpu core options
retro-wertz [Mon, 29 Jul 2019 14:51:08 +0000 (22:51 +0800)]
Add advanced gpu core options

- works for peops gpu plugin only

4 years agoMerge pull request #318 from retro-wertz/psxbios
hizzlekizzle [Mon, 29 Jul 2019 13:20:14 +0000 (08:20 -0500)]
Merge pull request #318 from retro-wertz/psxbios

HLE BIOS improvements from upstream

4 years agoAdd enhanced core options
retro-wertz [Mon, 29 Jul 2019 13:00:29 +0000 (21:00 +0800)]
Add enhanced core options

4 years agoHLE: Merge HLE BIOS improvements from upstream
retro-wertz [Mon, 29 Jul 2019 06:10:54 +0000 (14:10 +0800)]
HLE: Merge HLE BIOS improvements from upstream
- Merge update from https://github.com/libretro/pcsx_rearmed

4 years agoMerge pull request #317 from retro-wertz/psxhle_log
Twinaphex [Mon, 29 Jul 2019 03:44:53 +0000 (05:44 +0200)]
Merge pull request #317 from retro-wertz/psxhle_log

psxhle.c: Silence logging when using HLE bios

4 years agopsxhle.c: Silence logging when using HLE bios
retro-wertz [Mon, 29 Jul 2019 03:32:40 +0000 (11:32 +0800)]
psxhle.c: Silence logging when using HLE bios

- at least one game (Wild Arms) is continouos spamming the log window. Silence this in a way that its easy to enable when need to.
- Remove unnecessary message in Makefile

4 years agoadd custom issue report template
hizzlekizzle [Mon, 29 Jul 2019 03:08:45 +0000 (22:08 -0500)]
add custom issue report template

4 years agoMerge pull request #137 from gameblabla/hle
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...)

4 years agopsxbios: Don't accept 400h as a valid sector.
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.

4 years agopsxbios: Properly fix garbage area code.
gameblabla [Mon, 22 Jul 2019 02:39:41 +0000 (04:39 +0200)]
psxbios: Properly fix garbage area code.

This should work as intended now.

4 years agopsxbios: Fixup mistake in card_info function.
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.

4 years agopsxbios: Return value is always 1 for CloseTh and ChangeTh.
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.

4 years agopsxbios: Add checks for memchr.
gameblabla [Sun, 21 Jul 2019 05:43:56 +0000 (07:43 +0200)]
psxbios: Add checks for memchr.

4 years agopsxbios: Some games read from address 0, fix that.
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.

4 years agopsxbios: Implement get_cd_status stub according to nocash doc.
gameblabla [Sun, 21 Jul 2019 00:45:58 +0000 (02:45 +0200)]
psxbios: Implement get_cd_status stub according to nocash doc.

4 years agopsxbios: Make HLE bios start from block 1, not 2.
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."

4 years agopsxbios: Fix card_status function as to use card_active_chan.
gameblabla [Sun, 21 Jul 2019 00:30:15 +0000 (02:30 +0200)]
psxbios: Fix card_status function as to use card_active_chan.

4 years agopsxbios: Merge interrupt_r26 fix from PCSX4ALL.
gameblabla [Sun, 21 Jul 2019 00:13:34 +0000 (02:13 +0200)]
psxbios: Merge interrupt_r26 fix from PCSX4ALL.

Thanks DmitrySmagin for the fix.

4 years agopsxbios: Do the same for heap_size.
gameblabla [Sun, 21 Jul 2019 00:10:27 +0000 (02:10 +0200)]
psxbios: Do the same for heap_size.

4 years agopsxbios : Use bfreezel for pad_stopped instead of setting it to 0.
gameblabla [Sat, 20 Jul 2019 23:31:24 +0000 (01:31 +0200)]
psxbios : Use bfreezel for pad_stopped instead of setting it to 0.

4 years agopsxbios : Implement stub for wait_card.
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.

4 years agopsxbios : Fix a few mistakes :
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.

4 years agopsxbios: Add note and update copyright.
gameblabla [Thu, 18 Jul 2019 00:51:25 +0000 (02:51 +0200)]
psxbios: Add note and update copyright.

4 years agopsxbios: Merge heap fix from PCSX4ALL.
gameblabla [Thu, 18 Jul 2019 00:42:41 +0000 (02:42 +0200)]
psxbios: Merge heap fix from PCSX4ALL.

4 years agopsxbios: Init some vars just to be sure.
gameblabla [Thu, 18 Jul 2019 00:40:13 +0000 (02:40 +0200)]
psxbios: Init some vars just to be sure.

4 years agopsxbios: Merge PCSX4ALL pad_stopped fix.
gameblabla [Thu, 18 Jul 2019 00:38:32 +0000 (02:38 +0200)]
psxbios: Merge PCSX4ALL pad_stopped fix.

4 years agopsxbios.cpp: Add psxBios_card_status(); doesn't seem to affect anything
gameblabla [Thu, 18 Jul 2019 00:35:47 +0000 (02:35 +0200)]
psxbios.cpp: Add psxBios_card_status(); doesn't seem to affect anything

4 years agopsxbios: Fixes save issues on Parasite Eve II, Parasite Eve I and others
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.

4 years agopsxbios: Callback Events should not set event status to busy in TestEvent.
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.

4 years agopsxbios: Support other syscalls
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.

4 years agopsxbios: Add checks for strlen.
gameblabla [Thu, 18 Jul 2019 00:28:55 +0000 (02:28 +0200)]
psxbios: Add checks for strlen.

Per what Nocash documentation says.

4 years agopsxbios: Add checks for strcpy & strncpy.
gameblabla [Thu, 18 Jul 2019 00:28:22 +0000 (02:28 +0200)]
psxbios: Add checks for strcpy & strncpy.

This should be closer to documentation.

4 years agopsxbios: Fixup free.
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.

4 years agopsxbios: Add checks for strcmp & strncmp.
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)

4 years agopsxbios: Stub for get_error
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.

4 years agopsxbios : Several fixes to malloc.
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.

4 years agopsxbios: Add checks for memmove.
gameblabla [Thu, 18 Jul 2019 00:19:07 +0000 (02:19 +0200)]
psxbios: Add checks for memmove.

Always returns dst per documentation.

4 years agopsxbios : Add checks to memset.
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).

4 years agopsxbios: Add checks to memcpy.
gameblabla [Thu, 18 Jul 2019 00:16:41 +0000 (02:16 +0200)]
psxbios: Add checks to memcpy.

Always returns dst

4 years agopsxbios: Add checks for bzero.
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.

4 years agopsxbios: Add checks for bcopy
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)

4 years agopsxbios : Add checks to index and rindex calls
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.

4 years agopsxbios: Merge upstream fix for Deliverevent in firstfile
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.

4 years agopsxbios: Should fix input issues in some games.
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 ?

4 years agopsxbios: Fix out-of-bounds issue.
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.

4 years agoOnly PCSX4ALL uses ResetIoCycle. Remove it for now.
gameblabla [Thu, 18 Jul 2019 00:08:32 +0000 (02:08 +0200)]
Only PCSX4ALL uses ResetIoCycle. Remove it for now.

4 years agoFixup buread & buwrite being undefined.
gameblabla [Thu, 18 Jul 2019 00:07:56 +0000 (02:07 +0200)]
Fixup buread & buwrite being undefined.

4 years agopsxbios: Improve WaitEvent behaviour according to documentation
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.

4 years agopsxbios: Better realloc implementation
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.

4 years agopsxbios : Add checks for strncat
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.

4 years agopsxbios: Add todigit implementation
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.

4 years agopsxbios: Adds putc and getc implementation
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.

4 years agopsxbios: Return 0x1f801814 for gpu_abort_dma
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.

4 years agopsxbios: Better EnterCiritcal implementation
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.

4 years agopsxbios: Add checks for card_write, card_read
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.

4 years agopsxbios: Merging improved card_info function from upstream
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.

4 years agopsxbios: Merging fixes from upstream.
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.