hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.35k stars 2.18k forks source link

Resistance Retribution / Houfuku noToki crash in-game #4626

Open sum2012 opened 10 years ago

sum2012 commented 10 years ago

info log https://gist.github.com/sum2012/d3803a954fc24270d340

debug log https://drive.google.com/file/d/0B3OaSdeV0L8kVmszTHo4OWU5S3c/edit?usp=sharing

iso index https://gist.github.com/sum2012/adf600b324d3b58ebd96

first notice 37:01:136 ModuleLoader E[MODULE]: HLE\sceKernelModule.cpp:1612 UNIMPL sceKernelStopUnloadSelfModuleWithStatus(00000001, 00000000, 00000000, 00000000, 00000000): game has likely crashed

second notice E[IO]: HLE\sceIo.cpp:1634 ERROR_ERRNO_FILE_NOT_FOUND=sceIoOpenAsync(disc0:/PSP_GAME/USRDIR/GAMEDATA/COMMON/FONTS.HGZ, 00000001, 00000000) - file not found

The file exist in the iso index but end with .HOG \PSP_GAME\USRDIR\GAMEDATA\COMMON\FONTS.HOG

sum2012 commented 10 years ago

JPCSP no probrem log: https://gist.github.com/sum2012/71ba4779bb48935d5985

unknownbrackets commented 10 years ago

It seems to still open the HOG files if the HGZ files aren't there, so that may be fine.

What does the code look like at 08807520? I assume this still happens. A JpcspTrace of sceKernelDeleteCallback might help:

sceKernelDeleteCallback 0xEDBA5844 1 x

Just to see if it does call it.

-[Unknown]

sum2012 commented 10 years ago

First Thanks you tell me test in Sunday

I give you newest log first: (v0.9.6-406-g62eb701 ,(now crash due to on fast memory?)) info: https://gist.github.com/sum2012/9eb8c23fcbcd51a01128 debug log: https://drive.google.com/file/d/0B3OaSdeV0L8kSElXSW1YcEVtVjg/edit?usp=sharing

sum2012 commented 10 years ago

JPCSP trace log: https://gist.github.com/sum2012/4e91cbd3bd05db670252

nothing special 08:24:26 ModuleLoader - sceKernelDeleteCallback 0x3E1433B = 0x0

What does the code look like at 08807520? Hope I do right. 1

unknownbrackets commented 10 years ago

I wonder if handling sceKernelStopUnloadSelfModuleWithStatus would actually fix this game...

-[Unknown]

sum2012 commented 10 years ago

Add sceKernelCreateCallback in JPCSP trace log https://gist.github.com/sum2012/087dd982ba945751386b

PPSSPP debug log: 287=sceKernelCreateCallback(name=MEDIAPOWER, entry=08bf46c0, callbackArg=00000000) But in JPCSP trace log cannot find 08bf46c0

sum2012 commented 10 years ago

change config to sceKernelCreateCallback 0xE81CAF8F 3 sxx Hmm more easy to compare https://gist.github.com/sum2012/d588c00039e5e69062b7

09:16:04 user_main - sceKernelCreateCallback 0x08DCF370('MEDIAPOWER'), 0x8BF46C0, 0x0 = 0x3E0C035 seem no problem in sceKernelCreateCallback

unknownbrackets commented 10 years ago

Is this improved at all by #5092?

-[Unknown]

sum2012 commented 10 years ago

v0.9.6-420-g108d592 crash after in-game. I need go out now. Debug Log will proudce later https://gist.github.com/sum2012/e09eec24dcfa6e423319

sum2012 commented 10 years ago

@unknownbrackets I forget to ask a Important question. Do make log need turn off fast memory ? edit: turn off fast memory info log (a bit better) https://gist.github.com/sum2012/39b5aa5bb5d1e8905cd0

unknownbrackets commented 10 years ago

Generally yes, I usually use fast memory off. It helps to know the address that failed, sometimes, and especially what thread it was on.

Hmm. I guess it could be io related...

-[Unknown]

sum2012 commented 10 years ago

v0.9.6-429 debug log fast memory off,stop on first error https://drive.google.com/file/d/0B3OaSdeV0L8kRXlHaU5uNnpNTWM/edit?usp=sharing

sum2012 commented 10 years ago

Maybe need fix invalid address before more test 1

sum2012 commented 10 years ago

v0.9.8-500-gb0e97a0 Now debug log do not show OSK(freeze) spam of D[UTIL]: HLE\sceUtility.cpp:376 00000001=sceUtilityOskGetStatus() (Could not get time to draw a OSK ?) debug log: https://drive.google.com/file/d/0B3OaSdeV0L8kakI4ZmZWb2tETTA/edit?usp=sharing

Fast test osk good v0.9.6-813-g9798af3 debug log:https://drive.google.com/file/d/0B3OaSdeV0L8kSzNQbnYwNk9kZjQ/edit?usp=sharing

bad v0.9.6-837-g19a3ede

Compare https://github.com/hrydgard/ppsspp/compare/v0.9.6-813-g9798af3...v0.9.6-837-g19a3ede

sum2012 commented 10 years ago

Hmm, just a sceUtility debug log also proudce the problem

sum2012 commented 10 years ago

git bisect result 1 This commit https://github.com/unknownbrackets/ppsspp/commit/1f5639a489dfe68129cf2ae2d2833cd03acd6c81

sum2012 commented 10 years ago

int PSPOskDialog::Init(u32 oskPtr) {

ifdef DEBUG

 OSK_INIT_DELAY_US = 10000;

else

OSK_INIT_DELAY_US = 300000;

endif

@unknownbrackets @hrydgard @thedax How to get a log setting from sceUtility programmably? 2

thedax commented 10 years ago

@sum2012: You mean how can you tell what the log level for a certain module is set to while PPSSPP is running?

Probably something like this:

int logLevel = LogManager::GetInstance()->GetLogLevel(SCEUTILITY);

if (logLevel == LDEBUG) {
 // Do stuff if it's debug level
} else if (logLevel == LERROR) {
// Do something else if it's an error
}

Or use a switch statement:

int logLevel = LogManager::GetInstance()->GetLogLevel(SCEUTILITY);

switch (logLevel) {
 case LDEBUG:
      // Do stuff
      break;
 case LERROR:
      // Do other stuff
      break;
 default:
      // Do some other behaviour when it's not any of the above
      break;
}
unknownbrackets commented 10 years ago

Emulation behavior should definitely NOT change based on log level. Talk about a debugging nightmare.

-[Unknown]

thedax commented 10 years ago

Oh, I agree completely. I was just answering his basic question on how to obtain the logging level at runtime.

daniel229 commented 10 years ago

The DEMO also gets a lot Invalid address. https://drive.google.com/file/d/0BzGZGDfFE68zSGNWcHVKX1pLWW8/edit?usp=sharing

daniel229 commented 10 years ago

For the demo,after you killed the 3 robots in the first room and entry to another room,there is cutscene,if you don't skip,at the end it reportsa lot of invalid address,then after you killed one of the two big robots,it reports a lot of E[G3D]: GLES\SoftwareTransform.cpp:332 Normal projection mapping without normal? ,sometime it crashes.

unknownbrackets commented 10 years ago

Interesting. The invalid addresses happen even with jit off, so it doesn't look like a jit bug.

-[Unknown]

sum2012 commented 10 years ago

Flush icache only related to jit ?

unknownbrackets commented 10 years ago

Correct... well, I guess there are also the replacement opcodes. Did it used to work without jit on?

-[Unknown]

sum2012 commented 10 years ago

Doesn't

daniel229 commented 10 years ago

Fixed one kind of the invalid addresses I mentioned in the https://github.com/hrydgard/ppsspp/issues/3110 ,that cutsene invalid addresses don't hang the emulator sometime.

daniel229 commented 10 years ago

Those invalid addresses would make the game missing some graphics

non invalid addresses 01

invalid addresses 02

sum2012 commented 10 years ago

Update the log to v0.9.9-84-g37b8f62 Info log:https://gist.github.com/sum2012/918e3536fe0c65485786 Debug log: https://drive.google.com/file/d/0B3OaSdeV0L8kTlU1WUtoVWN6NTg/edit?usp=sharing I find sceUsb staff

daniel229 commented 10 years ago

Don't Register sceAtrac3plus() can avoid the invalid addresses and these graphical issue.https://github.com/hrydgard/ppsspp/issues/5631

sum2012 commented 10 years ago

Good finding

sum2012 commented 10 years ago

I test from start. Still freeze 2

daniel229 commented 10 years ago

Above errors happen randomly.I don't get those errors this time. 01

daniel229 commented 10 years ago

change this if (Memory::IsValidAddress(numSamplesAddr))Memory::Write_U32(numSamples, numSamplesAddr);

to if (Memory::IsValidAddress(numSamplesAddr))Memory::Write_U32(numSamples/2, numSamplesAddr); it would not get invalid addresses and these graphical issue.

unknownbrackets commented 10 years ago

It could be that this file decodes less samples each frame, whether due to mono or who knows what. But also, the first frame of audio actually is supposed to be a lower number of samples. Could just be that.

-[Unknown]

daniel229 commented 10 years ago

It works with this.with atrac->currentSample <= 2048 still got error.

        if (Memory::IsValidAddress(numSamplesAddr))
            (atrac->atracChannels == 1 && atrac->currentSample <= 4096) ? Memory::Write_U32(numSamples / 2, numSamplesAddr) : Memory::Write_U32(numSamples, numSamplesAddr);
daniel229 commented 10 years ago

It works with this

if (Memory::IsValidAddress(numSamplesAddr))
            (atrac->codecType == PSP_MODE_AT_3_PLUS && atrac->atracChannels == 1 && atrac->currentSample == 2048) ? Memory::Write_U32(numSamples / 32 + 1, numSamplesAddr) : Memory::Write_U32(numSamples, numSamplesAddr);
unknownbrackets commented 10 years ago

Interesting. Well, at least that supports the theory that it could have to do with the first time. Thanks.

Guess we'll have to test a bunch of permutations, long/short, at3/at3+, stereo/mono, full buffer/sliding buffer...

-[Unknown]

daniel229 commented 10 years ago

Demo crashing after the big robots explode in the second room,same as the retail version. savestate for the demo https://drive.google.com/file/d/0BzGZGDfFE68zaUJjYkZNSTljVXM/edit?usp=sharing

unknownbrackets commented 10 years ago

199e6bcd3bd57e173d9704c4016a6759203e3b7b avoids that crash, but it's still doing something wrong. Also, Google doesn't seem to want me to download that file.

-[Unknown]

daniel229 commented 10 years ago

Still crash with that change,I can't download from google either.Try this savestate https://onedrive.live.com/redir?resid=46301D80532F136C%21107

unknownbrackets commented 10 years ago

Hmm, that's jumping to 0 but I'm not sure from where. It's not in jit or vertexjit...

Do the graphical glitches still go away entirely without sceAtrac? I guess it's probably still bugs in that.

-[Unknown]

daniel229 commented 10 years ago

without Register_sceAtrac3plus(); still get graphical glitches and crashing.

ppsspp-gamer commented 10 years ago

Tested resistance retribution (UCUS-98668) with PPSSPP build v0.9.9.1-537-gabb294f x64, OpenGL backend, after merge pull request #6935 from unknownbrackets/atrac-minor, this game can almost finish first mission without any graphical glich, but still ran into infinite loop after open the door as picture below. Real time save state is attached just before ppsspp hang, download save state from here: http://www.mediafire.com/download/d844cd9i1er4d7e/UCUS98668_1.00_0.zip.

ppssppwindows64 2014-09-24 20-46-30-08

daniel229 commented 10 years ago

@ppsspp-gamer that area did not hang for me with JPN version. Same area crash point as the demo in retail version ,if it get lucky,it did not crash,it would get this error

snd_stream_d E[ME]: HLE\sceAtrac.cpp:1638 sceAtracSetAA3DataAndGetID(09007140, 51200, 14870528, 09fcc9b8): ATRAC UNKNOWN FORMAT
sum2012 commented 10 years ago

@ppsspp-gamer save (USA version) media log: https://gist.github.com/sum2012/f39217a5c38b713fc71b

debug log: https://drive.google.com/file/d/0B3OaSdeV0L8kbi1aQzY5QUNwaFU/edit?usp=sharing

ppsspp-gamer commented 10 years ago

I believe the resistance retribution crash (UCUS-98668) is related to atrac functions. If I disable audio just before opening the door, then enable audio after that, I can finish the first mission without problems. Actually I can continue several missions without crashes.

Another real time save state before crash (this crash can be avoid by disabling audio). http://www.mediafire.com/download/yy2ldh49rajwm51/UCUS98668_1.00_0-02.zip

ppssppwindows64 2014-09-30 04-08-09-29

unknownbrackets commented 10 years ago

The emulator's option to disable audio only disables output; everything else related to audio (including all the atrac3+ decoding and etc.) is still done. That is, the option doesn't affect game behavior at all; it only affects whether we send the resulting data to DirectSound or ignore it during the last step in the process.

If turning off audio really avoids the crash, it may be related to the amount of audio data being generated or something (like an overflow in our DirectSound management), rather than decoding specifically. But that seems unlikely based on the other crash.

-[Unknown]

sum2012 commented 10 years ago

@ppsspp-gamer I still get invalid address when I disable audio in option

ppsspp-gamer commented 10 years ago

@unknownbrackets but if audio is disable, then the StreamCallback in soundThread() function won't be called, why should the atrac3+ decding still be done?

soundthread

@sum2012, then I guess I am only lucky, I play almost half of this game by using this trick.