ps2homebrew / Open-PS2-Loader

Game and app loader for Sony PlayStation 2
https://ps2homebrew.github.io/Open-PS2-Loader/
Academic Free License v3.0
2.05k stars 262 forks source link

[ISSUE][SLUS_209.46] Mode 4 (Skip Videos) not working for GTA San Andreas. Standalone GSM's 'Skip Videos Fix' works, not available in OPL-integrated GSM #332

Open patters-match opened 3 years ago

patters-match commented 3 years ago

Disclaimer Issue reports for OPL version which were not downloaded from the official GitHub repo are not accepted. Before posting the issue confirm that you meet the below requirements.

Describe the issue When using the built-in GSM to play this game in a progressive video mode (HDTV 480p @60Hz) it does not boot, hanging instead at a black screen before playing the short intro video with Rockstar logos. This is an identical situation to GTA III and GTA Vice City which can both be made to work by using OPL's compatibility mode 4 (Skip Videos). This mode does not work for GTA San Andreas though.

I notice that standalone GSM 0.38's 'Skip Videos Fix' does allow GTA San Andreas to be booted (from disc, and from OPL), successfully skipping the interlaced intro video clip which causes the hang in 480p.

I set my modchip to boot DEV1 so my PS2 Slim starts OPL automatically, and I use Pademu with a DualShock 4 controller from there. Although this GTA San Andreas issue can be worked around using standalone GSM, this breaks the elegance of the OPL+Pademu solution, in that a DualShock 2 must be connected.

I can suggest several possible approaches to allow this game to be played in progressive output via OPL only:

  1. Use a PS2 emulator to debug precisely why Mode 4 is struggling to skip videos for this particular game

  2. Examine the skip method used by GSM 0.38 standalone, and potentially use this source code to enhance or replace OPL's Mode 4. I presume there is a distinct possibility of regression issues in other games with this approach however.

  3. Expose GSM's own 'Skip Videos Fix' option in the OPL GSM configuration section (presumably this will need to supersede OPL Mode 4 when enabled).

  4. Work out a PS2RD raw cheat code to skip the intro video for this particular game.

Thanks

Configuration (please complete the following information):

To Reproduce Steps to reproduce the behavior:

Proof the game fundamentally works in OPL:

  1. Reset, and boot OPL
  2. Configure GTA San Andreas (USA) (SLUS 20946 v1.03): disable OPL Mode 4, disable GSM and start
  3. The game launches fine, with interlaced video - quite messy on a modern HDTV

The game issue we're trying to work around:

  1. Reset, and boot OPL again
  2. Configure the game again: disable OPL Mode 4, enable OPL GSM, with mode 'HDTV 480p @60Hz'
  3. The game will crash, presumably because it tried to render an interlaced video into a progressive frame

The OPL issue I am reporting:

  1. Reset, and boot OPL again
  2. Configure the game again: enable OPL Mode 4, enable OPL GSM, with mode 'HDTV 480p @60Hz'
  3. Start the game, it crashes to a black screen. Mode 4 has failed to skip the intro video resulting in a crash

A further distinction - the OPL Mode 4 crash issue is not related to GSM:

  1. Reset, and boot OPL again
  2. Configure the game again: keep OPL Mode 4 enabled, disable GSM
  3. Start the game, it crashes to a black screen. Mode 4 has crashed attempting to skip the intro video, even without GSM & 480p mode

Standalone GSM works around the game issue (booting from disc):

  1. Reset, boot standalone GSM 0.38
  2. Configure mode 'HDTV 480p @60Hz', enable Skip Videos Fix, exit to Browser with game disc inserted
  3. The game will boot successfully, it will skip the problematic intro video, and it will render in 480p allowing upscaling, anti-aliasing, and sharpening by an mClassic (only works for progressive display modes, interlaced modes are passed through)

Standalone GSM works around the game issue (even with OPL):

  1. Reset, and boot OPL again, configure OPL to use 480p display mode for its menu
  2. Configure the game yet again: disable OPL Mode 4, disable GSM. Save this configuration
  3. Reset, and boot standalone GSM 0.38
  4. Configure mode 'HDTV 480p @60Hz', enable Skip Videos Fix, exit to mc0:BOOT/BOOT.ELF (uLaunchELF) and load OPL again
  5. Start the game, it will boot successfully, it will skip the problematic intro video, and it will render in 480p allowing upscaling, anti-aliasing, and sharpening by an mClassic
patters-match commented 3 years ago

Here is the OPL commit in which @doctorxyz removed the 'ontheflypatcher' method that standalone GSM uses, so it looks like this functionality had been in OPL at one point in time:

https://github.com/ps2homebrew/Open-PS2-Loader/commit/674d6b6d9962e2afa825b3cb135612bca1b9d6e5

I guess there is something missing from the newer OPL method, since they're not functionally equivalent.

patters-match commented 3 years ago

I'm not a developer, but inspecting the GSM source it seems to me that the only method that standalone GSM's 'Skip Videos Fix' uses is the SceMpegIsEnd method, identical to what is detailed here: https://forums.pcsx2.net/Thread-Patch-Making-For-Dummies-SceMpegIsEnd

However, if I search the San Andreas ELF I cannot find that pattern of instructions, so I cannot seem to make my own cheat file to apply this FMV skip to bodge the game into working with OPL in 480p. Looking at that commit by @doctorxyz in my previous comment I can see that the SceMpegIsEnd patch method was moved from the GSM implementation into the OPL PSS mode but the patch appears to be identical in both forms. However, the changelog entry for GSM 0.37 states that for the 'Skip Videos Fix': "On-The-Fly patcher applies it whenever SetGsCrt syscall is called". So maybe this is the difference. Is OPL's patcher running only once, whereas standalone GSM's is running each time SetGsCrt is called?

I've had a play with CheatEngine and PCSX2 and I can see that San Andreas seems to load the video playback code dynamically from separate code overlay file mpeg.nm which would explain why the SceMpegIsEnd pattern isn't present in the main ELF. I do detect the target code to patch in mpeg.nm. Is the issue perhaps that OPL is only scanning the main ELF to make this patch and therefore missing the dynamically loaded code?

If this is indeed the situation then I think there is a case for re-adding the standalone GSM on-the-fly-patcher to OPL as an optional GSM setting which would override OPL Mode 4.

carl0sjt commented 3 years ago

if you enable the field emulation at GSM settings it will not crash

patters-match commented 3 years ago

Thanks, that's a useful workaround for the defect I reported. I was not aware.