PCSX2 / pcsx2_patches

Patches for Widescreen, No Interlace etc go in here, syncs with the main repo
165 stars 75 forks source link

GT4 480p in race #269

Open ameenross opened 10 months ago

ameenross commented 10 months ago

I've done some experimenting with Silent's deinterlacing patch which was removed here: https://github.com/PCSX2/pcsx2_patches/commit/18732331eb507c9dc50e45a31c19a2db48efe249

The last line which says "speed timer" slows down the race clock, but doesn't slow down the actual game/race. So effectively you'll be driving 20% faster and lap times will be 17% lower. This is immediately obvious when doing a license test (immediate gold by huge margin). Leaving out that line "fixes" the clock problem. But the game will still be running too quick. I got it to run "properly" (though unfortunately at 50fps) by simply setting the FPS limit at 83.3%. Combined with another deinterlacing patch by Silent, I've now got this:

// No interlacing
patch=1,EE,204A2A2C,extended,0000102D

// 480p mode in race
patch=1,EE,2035812C,extended,2442003C // (60 fps?)
patch=1,EE,20A57E70,extended,00000001

I should mention that this looks great compared to playing without patches, so even though the 60FPS benefit is lost with my trick, it still looks and functions good.

I had the idea to change the number 3C to 32, but that just causes the exact same problem with the clock. So I'm guessing the PAL build simply doesn't support 60FPS (due to tick rate, perhaps?). Unless nobody has found it up until now...

ameenross commented 10 months ago

Just noticed that the address is the same, so naturally it will have the same effect.

[Mode 480p]
author=Silent
comment=480p mode in race. Disable deinterlacing patch
patch=1,EE,20A57E70,extended,00000000
patch=1,EE,2035812C,extended,2442003C
patch=1,EE,E0020001,extended,00A57E7C
patch=1,EE,20A57E70,extended,00000001
patch=1,EE,2035812C,extended,24420032 //speed timer (line is the same as the second patch line, except `3C` is `32`)
PeterDelta commented 10 months ago

I am in the testing phase, speed of the vehicles you use corrected, I would say that on all circuits both in a-spec and b-spec mode, at 480p and 1080i, if you find any anomaly, tell me so I can correct it. So there are two of us to tested it is a very long game ;). https://github.com/PeterDelta/PCSX2/blob/main/patches/SCES-51719_44A61C8F.pnach

ameenross commented 10 months ago

@PeterDelta I saw those. They're supposed to be 2 variants, right? As in, you cannot enable both lists of patches at the same time? If so, I tried both of those, and I thought they had the same speed problem as mentioned before. I can test again on thursday or friday to be sure.

ameenross commented 10 months ago

Also, as a programmer myself who likes minimalism, I was a bit wary about the list of patches being so long. Is that really strictly necessary?

PeterDelta commented 10 months ago

Yes, one patch enables 480p racing mode and the other 1080i mode, they are separate patches or you can enable one or the other. At first it was longer but I found more global values and I have reduced it to this. Each circuit has different physics, some share them but others do not. That is why there are so many conditions, so that it does not alter the game in any way since they change from one circuit to another. The only way to reduce it is to find the direction that regulates the overall speed of the game, something I haven't found yet. For now and unless I have missed a circuit, the speed is corrected in both b-spec and a-spec.

ameenross commented 10 months ago

Ah, right, that explains it. I do wonder, though: is there a way in 480p or 1080i mode to tell PCSX2 that the FPS limit needs to be 50 instead of 60? Of course I'd rather have 60fps, and I fortunately can with my Ryzen 7700 and DDR5 RAM (no discrete graphics required anymore, hurray!), however a workable 50FPS solution is a very welcome option. Especially for people whose machines cannot reliably run GT4 @ 60fps, but even I'd like to have the option.

PeterDelta commented 10 months ago

The game already runs at 50 fps by default, progressive mode can only run at 60. Additionally, the visual improvement as you can see is notable.

ameenross commented 10 months ago

Yes, what I mean is the visual improvement without the FPS improvement. Like I described in the OP which I already have working, although with a manual configuration change... I guess it's not possible via pnach as 480p is recognized by PCSX2 to be 60 FPS?

PeterDelta commented 10 months ago

I understand. I don't know how that's done honestly.

ameenross commented 10 months ago

I was afraid of that. No problem, I'll test your patches again Friday probably... although maybe it helps to add a few code comments what the lines do? I'm guessing it's a lot of opcode patches, or at least values of constants or something... but it's sufficiently complex that some explanation is welcome. Also, I guess you could make 1 block of "physics" patches which is required for both 480p and 1080p mode? Now there's quite some duplication from the looks of it.

Out of curiosity, what would happen if I save a replay with these patches, and load it without any? Would it perfectly reproduce the race, or are the engine/physics changes significant enough to break it?

PeterDelta commented 10 months ago

The progressive is only enabled when entering the race, you can do a race and save the replay, when you see it in the theatre you will see it at 50 fps. Except for the first lines of the patch, which are to enable progressives, the rest are for AI speeds and the car we take on the circuits. There is nothing that breaks or hangs, that is why I have conditioned everything so that it does not happen. The speed of the car we are driving is exact, the speed of the AI is approximate and that is what I am testing.

ameenross commented 10 months ago

So my first test today was not a great success. I tested A5 license, and fail within about a second because the car is way faster than the Skyline safety car. Also, I'm pretty sure the game is running too fast.

ameenross commented 10 months ago

So I did some more testing, and it seems that this is enough for 50fps in race, although with the minor caveat that the pre-race menu shakes slightly. But there's no shaking in the race. This might not give you 60fps which would be great to get working perfectly, but it does mean a significant improvement of the graphics with minimal code. EDIT: should note, this still requires frame limiting to be at 83.3%.

// No interlacing
patch=1,EE,204A2A2C,extended,0000102D

// 480p mode in race
patch=1,EE,20A57E70,extended,00000001
PeterDelta commented 10 months ago

I just checked the speed of the A5 license, both national and international and it is accurate, there is no error there. If it works great for you, but that is, in addition to being incomplete, unnecessary due to the interlaced patch (which, except for some games, have become obsolete). Address 20A57E70 enables progressive mode, everything runs faster as you indicate, so minimalism is of no use here unless speed modifiers are found, and that is what I have done so far.

By the way, at 50 fps you are also faster than the safety car, in fact you can't overtake it because you suspend

ameenross commented 10 months ago

If it works great for you, but that is, in addition to being incomplete, unnecessary due to the interlaced patch [...]

Yes my 2 patches work great(-ish). The no interlacing patch is needed because the image is shaky in the menus (requiring deinterlacing)... whereas with the patch, the shaking stops (so deinterlacing can be disabled tyvm). If by obsolete you mean the "Enable No-Interlacing Patches" checkbox in the graphics settings, that doesn't work for me on GT4. Or at least doesn't have the same effect as my patch.

The other patch only changes the output mode in races/replays etc... anything where the actual simulation is run. But PCSX2 detects it as being NTSC and sets frame limiting to 60 (but the game engine assumes 50). Interestingly though, when I change the NTSC frame limit to 50 in the advanced settings, the game still runs at 60. Seems like a bug to me, or there's a detail I'm missing. But personally, I don't mind using the 83.3% trick anymore. And having real, actual 60FPS would be the icing on the cake at this point.

I just checked the speed of the A5 license, both national and international and it is accurate, there is no error there.

I disabled ALL other patches, only enabled your 480p patch... there's a clear speedup of the game. Look, with a horrible attempt on A-1, I got gold by a 4 second margin.

image

The (added) problem on A-5 is the AI drives extremely slowly. So maybe if it works for you, then there are some other lines in your patch that are not in the GitHub version?

PeterDelta commented 10 months ago

The image does not shake at any time in the menus. I use the latest pcsx2 update and the automatic deinterlacing option, it shouldn't shake. Sorry, but I don't get a skyline in the A-5... I get a seat Ibiza in the international one and an Audi A-3 in the national one and in both the speed is corrected. The safety car does not have a speed correction so in any case it should be faster than ours although what is really important is our speed. I have tried changing the language of the game and I still get the same cars in A-5

Gran Turismo 4_SCES-51719_20240105153352 Gran Turismo 4_SCES-51719_20240105153326

ameenross commented 10 months ago

The image does not shake at any time in the menus. I use the latest pcsx2 update and the automatic deinterlacing option, it shouldn't shake.

That option doesn't work for me. Don't know why... but let's drop that subject.

Sorry, but I don't get a skyline in the A-5... I get a seat Ibiza in the international one and an Audi A-3 in the national one

Did I say IA-5? I said A-5, which is the one on Grand Valley with the Audi A3. That has a Skyline safety car ("guided lap"), which you normally don't get close to (with some rare exceptions in some corners of certain license tests), but now you overtake him right 1s after starting (which is not allowed and you fail the test). The Skyline is incredibly slow...

the speed is corrected

Not on my system it isn't, and I showed you a screenshot to prove it...

PeterDelta commented 10 months ago

Ok, I apologize, you're right, I just saw a test that needs correction, I didn't finish testing the licenses completely, I focused more on the circuits, I'll dedicate myself to correcting them all this afternoon :).

PeterDelta commented 10 months ago

It is already corrected, in the end all the license tests were correct, the safety car was the one that failed. The AI is better tuned

ameenross commented 10 months ago

Well alright, I took your changes from GitHub. There's still something wrong with the speed. I'm not a bad player, but shouldn't be able to get gold with such a huge margin even after 1000 attempts.

image

The Skyline is now a bit faster though... but now he swerves to the right when I'm next to him and hits me. Test failed. So it's not quite correct.

PeterDelta commented 10 months ago

I don't do those times, it cost me a lot to get the golds. The speed is corrected by 0.833333 to match the speed at 50 and over time I have also verified that it matches. I don't know where the error could be... In that test, with the patch removed, do you also do those times? The speed of AI needs to be found

ameenross commented 10 months ago

Absolutely not. That time is like 4s faster than the world record too.

I don't think it matters, but I'm not using any wide-screen patches by the way... Since you can simply choose 16:9 in the game's options.

I do wonder what you mean by saying the speed is adjusted by 83.3%... Can you point to the exact patch lines that are responsible for this so I can test without all the AI stuff?

EDIT: both my screenshots with the gold trophy are from the A1 test by the way. 0:30.750 is sufficient for gold and I'm almost 5s faster than that.

PeterDelta commented 10 months ago

Gran Turismo 4_SCES-51719_20240105222403 1000m at 50hz without patch Gran Turismo 4_SCES-51719_20240105222512 1000m at 480p

Gran Turismo 4_SCES-51719_20240105223849 Gran Turismo 4_SCES-51719_20240105223758 Tests at 50hz and 480p, in the case of the license I have gone to ensure. Speed calculation is accurate

ameenross commented 10 months ago

Well on one hand I would be worried about half a tenth difference in a simple 1000m test. It's almost half a % difference... On the other hand it's not 17% difference and your times for A1 look realistic...

I don't know what to tell you. There's obviously a difference between my test and yours. So what could it be? I disabled ALL patches (absolutely everything) aside from your list of patches for 480p. And this is the result I got on latest nightly PCSX2 earlier today. And it was the same a few weeks ago, the speed was incorrect. It has been the same in every test I have done.

Perhaps the difference is elsewhere? I'm using the Vulkan renderer and am on Linux. I'd be surprised if that made any difference, but hey, at this point I should mention it. Or perhaps it's PS2 BIOS version?

PeterDelta commented 10 months ago

It really isn't always done at the exact same time. It's math, the difference between 50 and 60 is 0.833333. In that aspect, the speed of the cars we choose has their speed corrected (as I say, I may have missed some because there are many circuits but I think I have tried them all in recent months). The only thing left is the AI, which is approximate but playable. Your test baffles me a little, I have tried vulkan and it works the same. It occurs to me that you may have some altered modifier in the advanced configuration. I have everything as standard, I only enable scaling and widescreen patches

ameenross commented 10 months ago

Nothing. In fact, I just pressed "restore defaults" yesterday as well. Added a few things to the OSD, set scaling to 3x, disabled deinterlacing... I think that's it.

I can't check right now, but iirc I'm using BIOS version 30004R.

PeterDelta commented 10 months ago

Download the latest version from https://pcsx2.net/ and perform a clean installation. Just put the patch, bios folder and memory card, configure the driver and you will see it works. I just checked it to see if it was my fault and it works perfectly. In this test I did 0'18.484 in 1000m

ameenross commented 9 months ago

I'm sorry, I have to disappoint you. I tried a completely clean install with latest nightly, only enabled your 480p patch and changed resolution to 3x and added some OSD. Even a new, completely blank memory card. Here's the result:

image

In this license test it actually feels like the cars breaks harder than what I'm used to as well. I think that might point to a flaw in your approach: a slower car does not compensate for the speedup of the game engine, as the car will feel more grippy. You really need to slow down the game engine itself otherwise it will always be off.

PeterDelta commented 9 months ago

With your tests I can conclude that we are not using the same patch. I have carried out that test and pushing as hard as possible after several attempts this is what I have achieved, therefore that time is impossible to achieve.

Gran Turismo 4_SCES-51719_20240111165928

In the cars we choose, only the movement is altered to match the original speed, it does not affect the brakes.

ameenross commented 9 months ago

So here's what I did:

  1. clean install
  2. point to my BIOS folder
  3. chose Europe 30004R V6
  4. changed res to 3x
  5. added FPS and res to OSD
  6. start the game
  7. click "Tools → Edit Patches"
  8. copy/paste this exact revision: https://raw.githubusercontent.com/PeterDelta/PCSX2/fc0d01ebd39567839702e2eb1b0efec4f264f1dd/patches/SCES-51719_44A61C8F.pnach
  9. go to "Settings → Game Properties"
  10. enable your 480p patch
  11. drive

It doesn't work correctly. I also tried software mode and it has the exact same result. So I guess we're NOT using the same patches (unless it matters that I'm on another platform than you). But then please post the patches you're using right now.

PeterDelta commented 9 months ago

I can't understand what the error could be, really. The patch is correctly published

ameenross commented 9 months ago

Any clamping or other options I need to change? Everything is on default.

PeterDelta commented 9 months ago

Nothing, nothing needs to be modified.

ameenross commented 9 months ago

In case anyone comes across this, here's what I'm currently doing to get the game running in 480p mode @50fps:

https://github.com/PCSX2/pcsx2/issues/10756#issuecomment-1920869327

For good measure I also set the EE cycle rate to 130%, but that isn't strictly necessary. It might make the game run a little bit better, but I haven't really noticed a difference yet.