PSO v2 Widescreen Code: Update Patch Disc?

Sylverant is a homebrew open source server for Phantasy Star Online. Dreamcast users still play PSO online with this server even today! This is the official forum for both the online game server as well as the open source project itself. Feel free to post and get a gathering started online! We can also show you how to get connected!

Moderators: BlueCrab, Aleron Ives

Post Reply
Doctor Dan
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 35
Joined: Sat Dec 27, 2014 11:17 pm

PSO v2 Widescreen Code: Update Patch Disc?

Post by Doctor Dan » Wed Feb 01, 2017 1:20 pm

There's been a long ongoing widescreen codebreaker code thread on assemblergames.com, I think they have over 100 games by now

They just today got a code for PSO v2, it would be pretty awesome if BlueCrab was able to update the patcher disc to include an option for the widescreen patches
I there's a code for v1 also

Anyway it would be awesome to see that added
http://assemblergames.com/l/threads/wid ... ost-933125
http://assemblergames.com/l/threads/wid ... ost-932932
PSO v1 http://assemblergames.com/l/threads/wid ... ost-850838
User avatar
Aleron Ives
Psychotic DCEmu
Psychotic DCEmu
Posts: 739
Joined: Wed Jan 05, 2011 2:15 pm
Location: California
Contact:

Re: PSO v2 Widescreen Code: Update Patch Disc?

Post by Aleron Ives » Wed Feb 01, 2017 5:19 pm

As I said on ASG, one of the patches is being written to somewhere in memory that isn't the game binary, so I'm not sure the boot disc can handle this. The patching program modifies the game's executable before allowing execution to occur, so the second widescreen patch would get overwritten once the game started to write data to that address. We probably need to know the offset in the game binary that writes to the address Esppiral patched, so that we can modify the game to write the correct value for us.
"Fear the HUnewearl."
Image
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5274
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Contact:

Re: PSO v2 Widescreen Code: Update Patch Disc?

Post by BlueCrab » Wed Feb 01, 2017 6:01 pm

Aleron Ives wrote:As I said on ASG, one of the patches is being written to somewhere in memory that isn't the game binary, so I'm not sure the boot disc can handle this. The patching program modifies the game's executable before allowing execution to occur, so the second widescreen patch would get overwritten once the game started to write data to that address. We probably need to know the offset in the game binary that writes to the address Esppiral patched, so that we can modify the game to write the correct value for us.
Actually... No, the patching program in its current form does not modify the game binary before it is run, since that wouldn't work for PSOv2. :wink:

It actually tries to modify the values in RAM every time the GD-ROM is accessed until it succeeds (read: until it successfully patches the first 4 bytes of the server address) -- then it short circuits unless that value is changed back. If one of the values is actually in RAM that is ever modified later on, then the current way the patching program works would not be applicable. It might be as simple as always running the set of patches when the GD-ROM is accessed, or it might have to be something more convoluted (like hooking the V-blank interrupt and doing it every frame). Hooking the V-blank handler would be possible, but not something I'd really want to do (it's much more likely that I'd do something to break the game there, plus, I'd have to figure out where the game stores the interrupt table and all that other stuff)...

Either way, it's something I can look at later (I'm doubtful I'll have time to do it before sometime in April though).

Also, that only covers V2 US/PAL and V1 US. I'd really rather if I was adding them that they could be added for all versions of the game at the same time (so, we'd need at least V1 PAL/Japan and V2 Japan... and the NTE :P ).

I'm joking about the NTE... Although that would be nice too.
User avatar
Aleron Ives
Psychotic DCEmu
Psychotic DCEmu
Posts: 739
Joined: Wed Jan 05, 2011 2:15 pm
Location: California
Contact:

Re: PSO v2 Widescreen Code: Update Patch Disc?

Post by Aleron Ives » Wed Feb 01, 2017 6:42 pm

1ST_READ.BIN isn't the game binary for V2, though. I thought you were waiting for the main binary to get extracted and pasted into RAM, and then patching it before passing the execution over to the game.
"Fear the HUnewearl."
Image
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5274
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Contact:

Re: PSO v2 Widescreen Code: Update Patch Disc?

Post by BlueCrab » Thu Feb 02, 2017 12:02 am

Aleron Ives wrote:1ST_READ.BIN isn't the game binary for V2, though. I thought you were waiting for the main binary to get extracted and pasted into RAM, and then patching it before passing the execution over to the game.
Nope. That was too messy to get working right, which is why I just hooked the GD-ROM syscall. Plus, doing it that way would mean that the patches would no longer be applied if, for instance, you went into the in-game browser then back to the game. :wink:

Basically, how it works is that every time the game tries to do anything to the GD-ROM, the patcher checks the first 4 bytes of the server address. If it matches the one the game has built-in, then it applies all patches. Then it just does whatever the game was trying to do with the GD-ROM... If there's no patching to be done, it adds about 20 CPU cycles to each GD-ROM access (so a very much imperceptible amount of time). There's a bit more latency if there is patching to be done, but it's still less than 200 CPU cycles in total if I can do math at this hour. :lol:
Doctor Dan
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 35
Joined: Sat Dec 27, 2014 11:17 pm

Re: PSO v2 Widescreen Code: Update Patch Disc?

Post by Doctor Dan » Thu Feb 16, 2017 6:25 pm

BlueCrab wrote:I'd really rather if I was adding them that they could be added for all versions of the game at the same time (so, we'd need at least V1 PAL/Japan and V2 Japan... and the NTE :P ).[/size]
Esppiral didn't have a problem taking my request for Sonic Adventure v1.005 NTSC after doing PAL a few days before. He probably won't have a problem if he was asked to look into PAL and NTSC-J editions if it were for an official project such as this

I'll ask later or tomorrow and refer him here

As I also said on ASG the time frame doesn't matter, we know you'll eventually get to it and that's what counts

I can't recall if Esppiral's v2 patch was a hex patch for 1ST_READ.BIN, but if it was, then that circumvents the issue of needing to add memory patching tactics to the patcher yeah?
I hex patched SA v1.005 and it worked fine (with resulting FOV glitches in Chao Garden and rings shadows)
User avatar
Aleron Ives
Psychotic DCEmu
Psychotic DCEmu
Posts: 739
Joined: Wed Jan 05, 2011 2:15 pm
Location: California
Contact:

Re: PSO v2 Widescreen Code: Update Patch Disc?

Post by Aleron Ives » Thu Feb 16, 2017 7:15 pm

His widescreen code for PSOv2 contains one patch in the main binary and one patch somewhere else in RAM, so it's not guaranteed that the second patch will always be in the same spot, nor is it guaranteed that the game will leave the value alone once it's patched. If the game tries to change the value at some point during the game, the AR will suddenly become wrong. Doing all patches in the game's main executable prevents both of these problems.
"Fear the HUnewearl."
Image
Post Reply