socram8888 / tonyhax

PS1 savegame exploit
Do What The F*ck You Want To Public License
436 stars 25 forks source link

Tekken 3 (SLPS-01300) Black Screen only #145

Open qkwyx opened 1 year ago

qkwyx commented 1 year ago

Before opening this kind of issue, please ensure:

tonyhax version: Which version are you running? Please ensure you are running the latest stable, or a newer beta. Tonyhax v1.4.5 Installation method: How did you get tonyhax on the memory card? PS2 console and MCA v2 Entry point game: Which game are you using to launch tonyhax? FreePSXBoot Slot2 Console model: Console product code, written on the bottom of the unit, such as "SCPH-7502" I am using SCPH-9001 Integrity check: If it boots, does the built-in integrity check succeed? Yes BIOS version: If you can get to boot, which version of the BIOS does it report? v4.1 Target game: If the bug happens when launching a game, what's its name and game code? Example: "Spyro 3 (SCES-02835)" Tekken 3 (SLPS-01300) Bug explanation: Please write a detailed explanation on which issue are you experiencing. After the Tonyhax v1.4.5 loads and after passing the "Starting" message it should play the Namco Screen but instead only black screen. Tried Tonyhax v1.4.3 it will load and play with no problems but v1.4.4 onwards it won't just black screen

qkwyx commented 1 year ago

I discovered my workaround to play this game. After Tonyhax v1.4.5 loads/boots, remove the memorycard on slot 2 then put the Tekken 3 Japan (SLPS-01300) game disc and play with no problems. I tried another game Sangoku Musou Japan (SLPS-00731) original black disc after Tonyhax v1.4.5 boots and I would not remove the memorycard on slot 2 and load the game it will hangs on the "Starting" log screen, but removing the memorycard on slot 2 after it boots it will load the game with no problems. Possible for now this will a work around that games with black screen or hangs on Starting log screen.

Edit: Actually not really "I discovered" it was the idea of @alex-free and I myself try it if it applies on this original fork Tonyhax and test on latest as of this writing v1.4.5 and it does that would be the work around for games with black screen after booting or hangs when "Starting" log screen appears. Sorry for that.

alex-free commented 1 year ago

I discovered my workaround to play this game. After Tonyhax v1.4.5 loads/boots, remove the memorycard on slot 2 then put the Tekken 3 Japan (SLPS-01300) game disc and play with no problems. I tried another game Sangoku Musou Japan (SLPS-00731) original black disc after Tonyhax v1.4.5 boots and I would not remove the memorycard on slot 2 and load the game it will hangs on the "Starting" log screen, but removing the memorycard on slot 2 after it boots it will load the game with no problems. Possible for now this will a work around that games with black screen or hangs on Starting log screen.

Edit: Actually not really "I discovered" it was the idea of @alex-free and I myself try it if it applies on this original fork Tonyhax and test on latest as of this writing v1.4.5 and it does that would be the work around for games with black screen after booting or hangs when "Starting" log screen appears. Sorry for that.

Oh wow this is super interesting that it also happens in the original tonyhax. Socram8888 has a debugger he can use to actually figure out why this issue happens and why my workaround works.

Again, this issue only happens with the FreePSXBoot exploit. The even more interesting bit is that the original Tonyhax is using a patch to disable slot 2 by Socram8888 himself.

The first issue with the Socram8888 patch is that it doesn't work on BIOS v1.0, BIOS v1.1, and BIOS v2.0 due to what I think is kernel differences in the older versions compared to BIOS v2.1 and above which due work as expected. BIOS v2.0 is found in the oldest USA consoles and therefore is affected even in the original Tonyhax. Meanwhile BIOS v1.0 and v1.1 are only found in the launch Japanese consoles and are not relevant here.

The second issue with the Socram8888 patch is that it doesn't work on all games. If you check the release notes to the FreePSXBoot exploit builder program, the original exploit author realized that the way the patches were originally disabling slot 2 by simulating a corrupted memory card was preventing some games from working correctly at all. The exploit author devised a new method which simulated a timeout with reading from the memory card in slot 2. This new method resulted in a patch which also for the first time worked on all PSX BIOS versions, including v1.0, v1.1, and v2.0. This new patch is automatically applied before starting the PS-EXE during the exploit. This is all apart of how the FreePSXBoot builder program generates the exploit memory card images.

The original Tonyhax resets the BIOS and all the tables/exception handler/all the stuff that the FreePSXBoot exploit changes right before starting the Tonyhax PS-EXE using the exploit. This is kind of redundant IMO (that stuff is not in a weird state after using the FreePSXBoot exploit like say a save game exploit would leave it as) but is also why Socram8888 has his own patch in Tonyhax that gets applied.

My idea with Tonyhax International was to only for the FreePSXBoot exploit boot method, not to reset the exception handler and BIOS tables (but still reset interrupts and clear kernel stack memory as well as other things from the original reset bios function). This way the original FreePSXBoot builder patch for the slot 2 memory card would remain intact and indeed effective).

I was thinking it was the patch causing this issue with the stuck on starting text but that doesn't actually seem to be the case. My fork and the original are extremely different in regard to the FreePSXBoot exploit yet the same issue and workaround work.

I really look forward to socram8888 looking into this with the debugger that I don't have access to.

alex-free commented 1 year ago

Wait I have an idea. Maybe if for the FreePSXBoot method immediately at load the stopcard() BIOS function could be called and maybe it will unscrew up whatever state unreliably occurs that causes this issue. Might have to startcard() before stopcard() too I'll check this out.

alex-free commented 1 year ago

YES!. @qkwyx let me know if this is also working 100% for you without having to remove the memory card in slot 2.

I think this issue has to do with the FreePSXBoot builder v2.1. IIRC Tonyhax v1.4.3 used v2.0 and it did not have this issue. Tonyhax International v1.1.0 was the first version to have the FreePSXBoot builder v2.1 and it also is the first version which shows this issue.

test.zip

Socram8888, this is what I'm doing first thing in main()

#if defined FREEPSXBOOT // unfuck state from FreePSXBoot exploit, which if not done results in hanging in some games when trying to start the PS-EXE later
    void * address; // For Calculating BIOS Functions
    // InitCard(pad_enable)
    address = (uint32_t *) GetB0Table()[0x4A];
    ((void (*)(uint8_t*)) address)(0);
    // BIOS FunctionStartCard()
    address = (void *) (GetB0Table()[0x4B]);
    ((void (*)(void)) address)();
    // BIOS Function _bu_init()
    address = (void *) (GetB0Table()[0x55]);
    ((void (*)(void)) address)();
    // BIOS Function allow_new_card()
    address = (void *) (GetB0Table()[0x50]);
    ((void (*)(void)) address)();
    // BIOS Function StopPad()
    address = (void *) (GetB0Table()[0x14]);
    ((void (*)(void)) address)();
#endif
qkwyx commented 1 year ago

Tekken 3 (SLPS-01300) Import Disc test results SCPH-101 v4.4 Official Release v1.1.9 FreePSXBoot slot 2 no remove = plays with no problem Test Build (Mar 15, 2023) FreePSXBoot slot 2 no remove = plays with no problem SCPH-9001 Official Release v1.1.9 FreePSXBoot slot 2 no remove = black screen Test Build (Mar 15, 2023) FreePSXBoot slot 2 no remove = black screen Official Release v1.1.9 FreePSXBoot slot 2 remove = plays with no problem Test Build (Mar 15, 2023) FreePSXBoot slot 2 remove = plays with no problem SCPH-5501 Official Release v1.1.9 FreePSXBoot slot 2 no remove = black screen Test Build (Mar 15, 2023) FreePSXBoot slot 2 no remove = after almost a second horizontal glitch screen then black screen Official Release v1.1.9 FreePSXBoot slot 2 remove = plays with no problem Test Build (Mar 15, 2023) FreePSXBoot slot 2 remove = plays with no problem

Sangoku Musou Japan (SLPS-00731) Import Disc test results SCPH-101 v4.4 Official Release v1.1.9 FreePSXBoot slot 2 no remove = plays with no problem Test Build (Mar 15, 2023) FreePSXBoot slot 2 no remove = plays with no problem SCPH-9001 Official Release v1.1.9 FreePSXBoot slot 2 no remove = hangs after word "Starting" on log screen Test Build (Mar 15, 2023) FreePSXBoot slot 2 no remove = hangs after word "Starting" on log screen Official Release v1.1.9 FreePSXBoot slot 2 remove = plays with no problem Test Build (Mar 15, 2023) FreePSXBoot slot 2 remove = plays with no problem SCPH-5501 Official Release v1.1.9 FreePSXBoot slot 2 no remove = hangs after word "Starting" on log screen Test Build (Mar 15, 2023) FreePSXBoot slot 2 no remove = hangs after word "Starting" on log screen Official Release v1.1.9 FreePSXBoot slot 2 remove = plays with no problem Test Build (Mar 15, 2023) FreePSXBoot slot 2 remove =plays with no problem

No remove means after Tonyhax International boots, the memorycard on slot 2 stay as is Remove means after Tonyhax International boots, remove the memorcyard on slot 2

On remove memorycard on slot 2 then load the game then while the intro screen is playing, you can put back the memorycard on slot 2 and still the game won't recognize the memorycard insterted. Test this only Sangoku Musou game.

alex-free commented 1 year ago

Tekken 3 (SLPS-01300) Import Disc test results SCPH-101 v4.4 Official Release v1.1.9 FreePSXBoot slot 2 no remove = plays with no problem Test Build (Mar 15, 2023) FreePSXBoot slot 2 no remove = plays with no problem SCPH-9001 Official Release v1.1.9 FreePSXBoot slot 2 no remove = black screen Test Build (Mar 15, 2023) FreePSXBoot slot 2 no remove = black screen Official Release v1.1.9 FreePSXBoot slot 2 remove = plays with no problem Test Build (Mar 15, 2023) FreePSXBoot slot 2 remove = plays with no problem SCPH-5501 Official Release v1.1.9 FreePSXBoot slot 2 no remove = black screen Test Build (Mar 15, 2023) FreePSXBoot slot 2 no remove = after almost a second horizontal glitch screen then black screen Official Release v1.1.9 FreePSXBoot slot 2 remove = plays with no problem Test Build (Mar 15, 2023) FreePSXBoot slot 2 remove = plays with no problem

Sangoku Musou Japan (SLPS-00731) Import Disc test results SCPH-101 v4.4 Official Release v1.1.9 FreePSXBoot slot 2 no remove = plays with no problem Test Build (Mar 15, 2023) FreePSXBoot slot 2 no remove = plays with no problem SCPH-9001 Official Release v1.1.9 FreePSXBoot slot 2 no remove = hangs after word "Starting" on log screen Test Build (Mar 15, 2023) FreePSXBoot slot 2 no remove = hangs after word "Starting" on log screen Official Release v1.1.9 FreePSXBoot slot 2 remove = plays with no problem Test Build (Mar 15, 2023) FreePSXBoot slot 2 remove = plays with no problem SCPH-5501 Official Release v1.1.9 FreePSXBoot slot 2 no remove = hangs after word "Starting" on log screen Test Build (Mar 15, 2023) FreePSXBoot slot 2 no remove = hangs after word "Starting" on log screen Official Release v1.1.9 FreePSXBoot slot 2 remove = plays with no problem Test Build (Mar 15, 2023) FreePSXBoot slot 2 remove =plays with no problem

No remove means after Tonyhax International boots, the memorycard on slot 2 stay as is Remove means after Tonyhax International boots, remove the memorcyard on slot 2

On remove memorycard on slot 2 then load the game then while the intro screen is playing, you can put back the memorycard on slot 2 and still the game won't recognize the memorycard insterted. Test this only Sangoku Musou game.

It is completely intended that slot 2 is disabled throughout the game. That is what is supposed to happen.

The original Tonyhax v1.4.3 had none of these issues and works everytime without removing the memory card?

socram8888 commented 1 year ago

tonyhax does allow to use memory cards after removing the FPB card, it's why the patching code is different and I'm not using the FPB patch that @alex-free 's fork is using, which entirely disables the slot

alex-free commented 1 year ago

tonyhax does allow to use memory cards after removing the FPB card, it's why the patching code is different and I'm not using the FPB patch that @alex-free 's fork is using, which entirely disables the slot

Good to know. Would you consider to look into BIOS v2.0 and why your patch doesn't work on that version (and the earlier ones?)

I'm considering just removing all the patching and requiring users remove it in my fork for the moment since I can't figure out what's going on with FreePSXBoot builder v2.1.

qkwyx commented 1 year ago

It is completely intended that slot 2 is disabled throughout the game. That is what is supposed to happen.

The original Tonyhax v1.4.3 had none of these issues and works everytime without removing the memory card?

Yes the original Tonyhax v1.4.3 only had none of these issues and works everytime without removing the memorycard. In line with it the same also on Tonyhax International v1.0.8 only playing without issues without removing the memorycard.

alex-free commented 1 year ago

It is completely intended that slot 2 is disabled throughout the game. That is what is supposed to happen.

The original Tonyhax v1.4.3 had none of these issues and works everytime without removing the memory card?

Yes the original Tonyhax v1.4.3 only had none of these issues and works everytime without removing the memorycard. In line with it the same also on Tonyhax International v1.0.8 only playing without issues without removing the memorycard.

Everything supports the theory then. FreePSXBoot builder v2.1 is the cause...

socram8888 commented 1 year ago

I'm not that sure really. I'm not using the FPB stage 2, but only the first stage payload that fits in a single memory card sector and that has stood the same afaik since the exploit's inception. Also I clear the entire consoles' RAM.

I've not changed the anti-FPB patch since I added it in 1.3.3, so that code is probably not to blame either.

The only changes I made between 1.4.3 and 1.4.5 if my memory serves me right are related to the antipiracy patch that hijacks the EnterCriticalSection, but your AP code is entirely different.

alex-free commented 1 year ago

I'm not that sure really. I'm not using the FPB stage 2, but only the first stage payload that fits in a single memory card sector and that has stood the same afaik since the exploit's inception. Also I clear the entire consoles' RAM.

I've not changed the anti-FPB patch since I added it in 1.3.3, so that code is probably not to blame either.

The only changes I made between 1.4.3 and 1.4.5 if my memory serves me right are related to the antipiracy patch that hijacks the EnterCriticalSection, but your AP code is entirely different.

In v1.4.4, you updated to FreePSXBoot builder v2.1 from v2.0. In v1.0.9 of my fork, I updated to v2.1 from v2.0.

Due to the differences in our versions, I think every other possibility can be safely ruled out. It's not the patch method, or the AP code.

This is the same exact time that this issue began popping up for specific games. I think the FreePSXBoot exploit since v2.1 now causes some kind of lingering issue that affects some games. And by removing the memory card it prevents that lingering issue. I am willing to bet that simply reverting to v2.0 will solve this.

I am considering reverting to v2.0.

alex-free commented 1 year ago

This is the commit that Tonyhax v1.4.3 and International v1.0.8 used for FreePSXBoot: https://github.com/brad-lin/FreePSXBoot/commit/4888a9aa5852a60163798552bb3668f739484d2e

I just reverted to it and rebuilt Tonyhax International using the old version of FreePSXBoot from that commit. I am still not resetting the RAM so that the original FreePSXBoot builder patches remain working. Should work, haven't tested yet.

test2.zip

qkwyx commented 1 year ago

This is the commit that Tonyhax v1.4.3 and International v1.0.8 used for FreePSXBoot: brad-lin/FreePSXBoot@4888a9a

I just reverted to it and rebuilt Tonyhax International using the old version of FreePSXBoot from that commit. I am still not resetting the RAM so that the original FreePSXBoot builder patches remain working. Should work, haven't tested yet.

test2.zip

Will test again when I get home... am at work for now.

alex-free commented 1 year ago

https://github.com/brad-lin/FreePSXBoot/issues/76 shows what I was talking about with the issue of the original FreePSXBoot patch/your patch Socram8888.

For now I'm just requiring the user to remove any FreePSXBoot memory card, for many reasons: https://github.com/alex-free/tonyhax/issues/15#issuecomment-1473128126

qkwyx commented 1 year ago

The results are all the same. Best method for now is removing the memorycard after booting.

alex-free commented 1 year ago

The results are all the same. Best method for now is removing the memorycard after booting.

I think that the only way it worked before was that specific FreePSXBoot v2.0 commit + Socram8888 patch. I could try compiling the original Tonyhax (current version) with the old version of FreePSXBoot at that commit to prove the theory.

qkwyx commented 1 year ago

The results are all the same. Best method for now is removing the memorycard after booting.

I think that the only way it worked before was that specific FreePSXBoot v2.0 commit + Socram8888 patch. I could try compiling the original Tonyhax (current version) with the old version of FreePSXBoot at that commit to prove the theory.

ok will wait no probs.