PCSX2 / pcsx2

PCSX2 - The Playstation 2 Emulator
https://pcsx2.net
GNU General Public License v3.0
11.9k stars 1.63k forks source link

Boot (Full) fails if rebooting with a game already running #851

Closed Masamune3210 closed 8 years ago

Masamune3210 commented 9 years ago

After a reboot, the emulator log will throw a random Syscall Undefined and the virtual PS2 will fail to reboot until reboot is attempted again on which the emulator will either crash or successfully reboot.

Version: PCSX2 1.3.1-20150925184220 CPU: Intel i5-2500k @ 4.0 GHz GPU: nVidia GeForce GTX 660 Superclocked 3GB RAM: 11 GB DDR3 Log: https://gist.github.com/deadair3210/a7b941dacc03badcd9e9

refractionpcsx2 commented 9 years ago

Can you try your game as an ISO and not a CSO, I've had a few games not like being CSO files.

avih commented 9 years ago

Can you try your game as an ISO and not a CSO, I've had a few games not like being CSO files.

This sounds like a bug to me.

Games should not care or be aware that the media is compressed because PCSX2 exposes it the same as uncompressed DVD. Does it also happen with gzip?

This is probably worth filing an issue on it and asking @unknownbrackets to check it out.

refractionpcsx2 commented 9 years ago

I wish I could remember what games didn't like it, it's going to bug me now :(

oh well, hopefully this is one of those cases and we can get to the bottom of it

Masamune3210 commented 9 years ago

This time it happened with Disgaea Hour of Darkness, but it has happened with other games and without a iso selected before

refractionpcsx2 commented 9 years ago

Well Disgaea 2 works absolutely fine for me so there's something you're doing that's breaking it or your bios/iso is corrupted.

Masamune3210 commented 9 years ago

Ok, will rerip my BIOS and game and reconvert the game to CSO and see if it fixes it. Will post back here if it continues. Thanks anyway

refractionpcsx2 commented 9 years ago

Good luck!

avih commented 9 years ago

@deadair3210 Not sure why you closed the issue, however, a more detailed and concise description of the issue would help here. It's possible that it works for ref but there's still a bug which you bump into and he doesn't.

Also, I think ref said that CSO compression may cause more bugs, not fix bugs, so if there's indeed a CSO bug then a. it's important that we know about it and b. you should try without CSO compression to see if the bug goes away.

Could you please describe the exact steps you do which end up with the bug?

Masamune3210 commented 9 years ago
  1. Select ISO
  2. Start Virtual PS2
  3. Reboot
  4. Random Syscall issue

Going to try to reproduce later, busy for now. Do I need to reopen the issue then?

refractionpcsx2 commented 9 years ago

What do you mean by reboot? You mean hit "run cdvd" again?

Masamune3210 commented 9 years ago

Yes, sorry. I hit Run CDVD Full so that it goes through the BIOS and then into the game

refractionpcsx2 commented 9 years ago

Yeh i can't get it to crash doing that :/ Hope you can figure it out

Masamune3210 commented 9 years ago

Will try to reproduce it later

unknownbrackets commented 9 years ago

@deadair3210 try verifying a crc hash. If you're using maxcso, it can create a crc hash for you (see the documentation) of either ISO or CSO files.

If the ISO's hash doesn't match a clean hash, then your ISO is dirty. If the ISO's hash doesn't match the CSO's hash, then maxcso (or whatevever cso software you're using - note that some do not really support ps2-sized ISOs) has a bug. If the hashes are all good, then either pcsx2 has a bug, or the CSO loading code in it does.

Also, what region of game are you trying? Sometimes, they can behave differently, of course, and have different bugs in emulators.

@refractionpcsx2 can you clarify? There's been some FUD spread about games "not liking" CSO on PSP due to an implementation bug on physical PSP's custom firmwares. But obviously, games cannot actually tell. If there's a bug, let's fix it.

-[Unknown]

refractionpcsx2 commented 9 years ago

I'll check through my games and see if I can find one and let you know :)

Masamune3210 commented 9 years ago

I'm not sure if this is related, but while testing some other CSO conversions I managed to get the emulator to fail to reset the Virtual PS2. I was testing Dark Cloud, noticed that there were some graphical issues, changed the plugin settings, and hit Run CDVD Full to make sure that the changes would take. After hitting Run, the emulation just stayed on a black screen, and the log was spammed with TLB Miss. Log Attached, sorry the log is so long, had been testing a couple of games before this happened Log: https://gist.github.com/deadair3210/9e6ca79e8d14819665c7 Sorry if this isnt related enough to be part of this issue, but I wasnt sure if it had anything to do with the Syscall problem considering there are some Unrecoginized op errors around the end of the log as well

unknownbrackets commented 9 years ago

Does it happen only when it's a CSO, or does it happen with ISO?

I see right before the corruption there's a log about cheats. "cheats_ws.zip". If you disable cheats, does this still happen?

-[Unknown]

Masamune3210 commented 9 years ago

As far as I remember, this only has happened after I converted the game to a CSO, and I'm not sure about the cheats, will try to reproduce with a unconverted copy, though it might take some time as Im not sure what triggered it as it happened after testing about 4-5 other conversions before I started testing Dark Cloud.

Masamune3210 commented 9 years ago

Well, it happened again. This time switching between CSO converted copies of Dynasty Warriors 3 and Dynasty Warriors 4. Dont think the issue is game related, might be format related. Will try reproducing with ISO's. Seems to be triggered by switching between 4-5 games without closing the emulator in between. Couldnt get the full log because the emulator crashed and had to be closed. tlb miss

willkuer commented 9 years ago

Full emulog is saved in logs folder in the program directory. But I guess the screenshot is in this case sufficient.

Masamune3210 commented 9 years ago

Just got it to happen with ISO's as well, this time when the PS2 tried to reboot it looped until i shutdown the emulation

avih commented 9 years ago

Select ISO Start Virtual PS2 Reboot Random Syscall issue

Just to make sure I understand your procedure:

Masamune3210 commented 9 years ago

Start PCSX2 Select CSO System -> Boot Full Play until the title CDVD -> Select Different CSO Swap DISC or Reset -> Reset Emulated PS2 Crash

unknownbrackets commented 9 years ago

But to clarify, it happens even with ISO, and also with multiple games, so presumably the disc or format is irrelevant (although it may happen only for games that use a certain feature.)

If it's only happening sometimes, perhaps it's a race condition. Can there be a pending operation that goes uncancelled when you swap discs and reset?

-[Unknown]

Masamune3210 commented 9 years ago

Yes it seems to happen no matter the format or game. It really seems to be either a race condition or a leak somewhere as it only happens after switching games repeatedly

avih commented 9 years ago

Emulated PS2 Crash

You mean PCSX2 crash? or the game doesn't work but PCSX2 doesn't crash?

If PCSX2 doesn't crash, can you still do System -> Boot (fast or full)? Does the game run?

Masamune3210 commented 9 years ago

When i say emulated Ps2 crash i mean that the emulation of the ps2 has ceased functioning correctly, like what happens when a actual ps2 system freezes. the emulator still responds correctly(barring one account) and i can restart the emulation by hitting boot full. I dont use boot fast unless i have to, i like the nostalgic trip of using the ps2 bios

avih commented 9 years ago

the emulator still responds correctly(barring one account) and i can restart the emulation by hitting boot full.

Interesting, so after being prompted to swap disc or reset and choosing reset, it doesn't boot correctly, but then choosing system -> boot full makes it work correctly and the newly selected ISO plays fine?

Masamune3210 commented 9 years ago

yep

avih commented 9 years ago

Does it also happen with Boot full (while a game is running) without swapping the CDVD?

Masamune3210 commented 9 years ago

I'm not sure, will try when i get a chance. Computer is busy at the moment

avih commented 9 years ago

OK, so I can reproduce. As far as I can tell, it's an issue of boot full while a game is running, either by plainly choosing boot full while a game is running, or by boot full a game, then swap disc, choose "Reset" -> performs boot full (since last boot was full).

I tested with ICO (PAL) and few more. E.g. sequences:

Or

Or

Or

Masamune3210 commented 9 years ago

Its good to hear that it wasnt me doing something incorrectly or a problem with my setup.

avih commented 9 years ago

Swapping discs after boot fast works OK. After swapping discs it uses the last used boot "mode", so ultimately it's unrelated to swapping discs, it just happens that if the previous boot was full and you swap discs it performs another full boot and the bug shows.

avih commented 9 years ago

Anyone wants to find out whether it's a regression, and when it appeared?

Masamune3210 commented 9 years ago

gsdx d3d11 hw _ 640x448 _ auto _ interlaced field _ limiter_ normal _ speed_ 100 59 70 _ ee_ 42 _ gs_ 9 _ vu_ 0 _ ui_ 0 _ state 0 9_28_2015 10_49_45 am Not sure if this is related, but I noticed that if I switch games the emulator isnt cleaning the buffers for at least Gsdx, as you can see in this picture. I was trying Star Ocean then decided to switch to Tales of Legendia, and noticed you can still see parts of the star ocean menu in the black area for the cutscenes.

Will work on finding when the regression happened, will report back when i do

avih commented 9 years ago

Not sure if this is related

Probably unrelated. Please open a new issue for it. Thanks.

Masamune3210 commented 9 years ago

Cant get the error to happen on PCSX2 1.3.1-20150923092624,think after that is when the regression occured.

Will open a new issue for the Graphical Issue, wasn't sure if it was related to this or not due to the buffers not being cleared somehow interfering with the ps2 rebooting.

refractionpcsx2 commented 9 years ago

Wild stab in the dark here, but wonder if it was the changes from the coverity-qa extra that modified pcsx2/gui/AppMain.cpp to include the isocdvdsrc (or whatever it was)

micove commented 9 years ago

As refraction mentioned https://github.com/PCSX2/pcsx2/commit/4d8a23c1fcedf03773137e5e83ecd6f10ccbbf91 has:

    SysExecEvent_Execute()
        : m_UseCDVDsrc(false)
        , m_UseELFOverride(false)
+       , m_cdvdsrc_type(CDVDsrc_Iso)
    {
    }

    SysExecEvent_Execute( CDVD_SourceType srctype, const wxString& elf_override )
        : m_UseCDVDsrc(true)
        , m_UseELFOverride(true)
        , m_cdvdsrc_type(srctype)
        , m_elf_override( elf_override )
    {
    }

m_UseCDVDsrc is false and m_cdvdsrc_type gets initialized to CDVDsrc_Iso. Can't check this right now.

avih commented 9 years ago

Wild stab in the dark here, but wonder if it was the changes from the coverity-qa extra that modified pcsx2/gui/AppMain.cpp to include the isocdvdsrc (or whatever it was)

I thought so too and then I started testing earlier revisions, going back to January 2015, and all the builds exhibited the same issue.

However, I think my testing conclusions were flawed.

The bug does show consistently for me with ICO and valkyrie profile 2, but doesn't show with any other ISO I currently have on my system. E.g. with Rez or SoTC or GOW2 or MGS3 I can Boot full as many times as I want in a row and it always succeeds.

It appears to me that if either ICO or VP2 are running, then I can't boot full - neither via system -> boot full, nor by swapping the CDVD to any other game and choosing reset (where it tries to perform full boot).

But if another game is running, e.g. SoTC, then I can system -> boot full just fine, and also selecting any other CDVD (even ICO or VP2) and choosing reset -> it succeeds with full boot.

So it looks like some games (my examples are ICO and VP2) corrupt the state of PCSX2 such that it's unable to do a full boot. Fast boot still work though.

To test it from scratch:

avih commented 9 years ago

It's possible that other games are affected too, but it depends on whether or not they've reached the code/state where PCSX2 gets corrupted.

With VP2 and ICO - it's enough to see the first ingame thingy[*] such that boot full no longer works.

[*] without any memory cards, In VP2 it's the memory card screen, in ICO it's the language selection screen.

Masamune3210 commented 9 years ago

Found a game that does this every time i have tried. Load Kingdom Hearts 2 Final Mix (NTSC-J), Boot(Full), Wait until the PS2 logo is about to pop up and hit Boot(Full) again, Syscall Undefined Log - https://gist.github.com/deadair3210/63485a69ed5c5ae70e2e

Masamune3210 commented 9 years ago

Same thing happens with Kingdom Hearts Final Mix (NTSC-J), same procedure same results

Masamune3210 commented 9 years ago

Went from Soulcaliber 3's main menu, switched discs to Sphinx and the Cursed Mummy, Syscall

gregory38 commented 9 years ago

Is it a regession or is it a new bug? Status is quite confusing

jcdenton2k commented 8 years ago

@deadair3210 I've taken the time to look through your log and noticed a few odd things.

1 - For whatever reason you still insist on using the CSO format despite the fact that this increases loading times in a performance-heavy emulator like PCSX2. It takes more time to read the data (and some of it has to be decompressed on the fly) and as a result it can cause performance issues. I don't know why even in 2015 or now in 2016 you insist on trading hard drive space (which is dirt-cheap) in favor of a performance compromise.

2 - This part:

Loading patch 'F266B00B.pnach' from archive 'X:\Emulation\Emulators\Pcsx2\pcsx2-v1.3.1-1198-gc700035-windows-x86\pcsx2-v1.3.1-1198-gc700035-windows-x86\cheats_ws.zip' comment: Kingdom Hearts 2 Final Mix + (NTSC-J) (Wide Screen Cheats DB) Patches Loaded: 17

Under the 'System' menu of PCSX2, make sure to NOT have a checkmark under 'Enable Cheats', 'Enable Widescreen Patches', and 'Enable Host Filesystem'. You can use the 'Automatic Gamefixes' if you like but you can try to disable that and see if the issue still happens.

unknownbrackets commented 8 years ago

Well, unless you don't have enough RAM for your OS to fully cache the entire ISO in memory + the emulator and its memory usage, but you do have the RAM to cache the entire CSO. There can be lots of trade offs.

-[Unknown]

jcdenton2k commented 8 years ago

@deadair3210 @gregory38 I've found a solution to this issue so that it can be closed.

Using PCSX2 x32 build v1.5.0-dev-1010-gd58c07d compiled July-22-2016 by Orphis Buildbot from the official PCSX2 download links.

Using Win7 x64 OS and Windows build of PCSX2.

Initially I was able to reproduce the above issue with the TLB-miss and errors. Then I did a bit of configuration changing to see what was up.

I narrowed down the cause of the issue to enabling 'Widescreen Patches'. If you keep them disabled then the game will load fine regardless of how many times you 'Reload Full' from the BIOS.

All variables being completely default/safe (safest Preset 1 and ZERO speedhacks or GSDX hacks at all), the sole cause of this issue is enabling Widescreen Patches while doing 'Boot CDVD Full'. Changing renderer to Hardware/Software or DirectX/OpenGL did not affect this issue.

The workaround is that if you want to use the Widescreen Patches for this game, do 'Boot CDVD Fast' instead to bypass the BIOS.

One notable thing is that even when using the 'Fast' method, it still shows some 'TLB Miss' error messages but does not cause the game to fail to boot.

Also if you exit PCSX2 completely and start it fresh, the 'Full' method will work fine. It is only when trying to do 'Full' twice in a row or trying to do 'Full' when switching ISOs from another game do you get this issue.

This is why before making any bug reports it is always a good idea to try things with the WideScreen patches and Cheats DISABLED. It really helps :)

Loaded 17 Widescreen hacks from 'F266B00B.pnach' at 'C:\PCSX2\cheats_ws'

That shows 17 widescreen hacks being loaded on my end. I have no clue which one is the culprit but someone can maybe pass it along to the widescreen hack person to take a look and maybe add in a comment in the file if needed.

This issue does not require any coding or patching to resolve and can be safely closed out.

Masamune3210 commented 8 years ago

I use CSO because I have 11 GB of RAM so the image is cached in its entirety, and would rather be able to have more room on my drive for other games than have to worry about the (negligible) perf loss of having to decompress on the fly, which doesnt take that much on my i5-2500k. I have a 350 GB drive dedicated to all my emulation and code projects