Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kingdom Hearts: BBS, game stays on white screen after completing events. #2066

Closed
Kenny4343 opened this issue Jun 3, 2013 · 43 comments
Closed

Comments

@Kenny4343
Copy link
Contributor

From the forum member VanitasZD:
"After completing an event (e.g defeat all the Unversed in Olympus Colloseum), it freezes on the white screen. Why does it do this?"

It happened on maleficent's castle for me, and it doesn't really freeze, it keeps running but does nothing, here's a log: http://db.tt/2v94qP9l

@unknownbrackets
Copy link
Collaborator

Is it reproducible every time? Did this always happen, or is it new (and if so, since when)?

-[Unknown]

@Kenny4343
Copy link
Contributor Author

Every single time that I tried (three, gave up after that), it didn't happen on previous events of this kind that I first did, and no one had said anything either, but it certainly started somewhere after video support... It'll be a pain to reproduce it to test on other builds as I'm on the hardest difficulty LOL, but if someone else doesn't, I'll see if I can find it.

@solarmystic
Copy link
Contributor

@Kenny4343

Could be a little bit more specific in your problem description?

Stating the platform you experienced the freeze on would be a nice start. (Windows? Android? IOS? Symbian?)

Settings used in the emulator? (Fast mem etc)

Hardware utilized?

Like @unknownbrackets mentioned, problem repro (the exact steps undertaken to reproduce the problem) would also be great.

@Kenny4343
Copy link
Contributor Author

I don't know what did Vanitas use, as always from my side it's on android, SGS3, settings are default ones, with and without fast mem it still happens, and as explained, as already said it happens fter in-game events (Not sure if all of them) for me it was in maleficent's castle where you have to beat a great group of unversed, there the screen slowly becomes white as everytime you finish one of these events and stays white.

Edit: Now that I realize it, people were saying how they were stuck after the tutorial, so I'm guessing it must be after completing the event of fighting the light balls which is similar, I'm just guessing though.

@Kenny4343
Copy link
Contributor Author

Surprisingly, as told by amj530 on the forums:
"This happened 2 times to me, but I waited a few minutes and then continued normally."
It does continue after you wait for a few minutes on the whitescreen, although that's not normal either..

@solarmystic
Copy link
Contributor

@Kenny4343

If waiting makes it continue normally, could activating turbo help to speed up the process?

@Kenny4343
Copy link
Contributor Author

No, that's why I had given up before. I turbo'ed it for at least a minute or half a minute all the three times I tried, since the game didn't freeze as I said, but just stayed on the blank screen.

@Squall-Leonhart
Copy link

does an FFMPEG occur at this point?

@Kenny4343
Copy link
Contributor Author

No, it wouldn've been simply skipable if so.

@Squall-Leonhart
Copy link

some ffmpegs are definitely not skippable in this game.

@Kenny4343
Copy link
Contributor Author

That doesn't change the fact that there isn't any in there.
And you might be right but each cutscene and FMV has always been skippable for me, so.

@Squall-Leonhart
Copy link

which character are you playing

@Kenny4343
Copy link
Contributor Author

Ventus, I assume this is the issue because of how people also kept saying they'd be stuck after completing the tutotial (which is pretty much the same, after completing the light balls event).

@Squall-Leonhart
Copy link

can you attach an affected save. i can't find anything relating to a light balls event on google

and the tutorial all goes fine for me(unless its a different tutorial than the one at the games start?)

@Kenny4343
Copy link
Contributor Author

Hmm, thing is I already got past that part, but I'll try to get there again to give you the save file, moreover to check if the issue still persists.

@Squall-Leonhart
Copy link

I can see it now, i found where the orbs of light even occurs xD, i was a little further in and forgot that battles name.

@oioitff's last build using the Filter does not have the issue so that might be a place to start investigating.

@Kenny4343
Copy link
Contributor Author

Okay here you go: https://www.dropbox.com/sh/7dq4128t4lv6ss6/UDtCHUssZC
It's a bit far from where it actually happens sorry, but it shouldn't take you long, it's the closest savefile I could find, all you have to do is to keep going until you reach the cutscene where you got to fight a big group of maleficent's goons (that's the event) once you complete it, the issue happens.
Edit: oh lol sorry, just saw your post, so did you get to reproduce it?

@Squall-Leonhart
Copy link

03:32:240 Sd::UpdateVS I[HLE]: HLE\sceAtrac.cpp:833 sceAtracReleaseAtracID(8)
03:33:845 idle0 I[HLE]: GLES\Framebuffer.cpp:610 Decimating FBO for 04174000 (480 x 272 x 1), age 6

Pauses on white screen for almost 3 minutes and then continues with

06:15:492 user_main I[HLE]: HLE\scePower.cpp:260 222=scePowerGetPllClockFrequencyInt()
06:15:493 user_main I[HLE]: HLE\scePower.cpp:226 scePowerSetClockFrequency(333,333,166)
06:15:508 idle0 I[HLE]: GLES\Framebuffer.cpp:610 Decimating FBO for 00154000 (128 x 128 x 0), age 6
06:15:508 idle0 I[HLE]: GLES\Framebuffer.cpp:610 Decimating FBO for 00154000 (128 x 128 x 2), age 6
06:15:786 user_main I[HLE]: GLES\Framebuffer.cpp:415 Creating FBO for 00154000 : 128 x 128 x 0
06:15:786 user_main I[HLE]: GLES\Framebuffer.cpp:415 Creating FBO for 00154000 : 128 x 128 x 2
06:16:873 user_main I[HLE]: HLE\sceAtrac.cpp:1060 sceAtracSetDataAndGetID(0900d4a0, 0001e110)
06:16:874 user_main W[HLE]: HLE\sceAtrac.cpp:984 This is an atrac3 audio

@unknownbrackets
Copy link
Collaborator

If you can compile, it'd be very useful to know if there's any function active in that time. For example, if you use VerySleepy to profile it (starting when it starts the white screen, stopping afterward, and turn off the throttle), it should say what function is spending the most time.

I just wonder if something is doing a huge loop or something, since it eventually recovers...

-[Unknown]

@Squall-Leonhart
Copy link

good idea unknownbrackets

@Squall-Leonhart
Copy link

Sleep 10.828945 10.828945 16.638676 16.638676 KERNELBASE [unknown] 0
DrvPresentBuffers 6.637321 14.249403 10.198245 21.894211 nvoglv32 [unknown] 0
GLES_GPU::FastRunLoop 2.452177 31.664965 3.76777 48.653225 PPSSPPWindows
GLES_GPU::ExecuteOp 2.01636 16.184216 3.098138 24.867051 PPSSPPWindows
ShaderManager::ApplyShader 1.503011 6.233249 2.309377 9.577388 PPSSPPWindows
CityHash32 1.13189 1.13189 1.739149 1.739149 PPSSPPWindows
RtlTryEnterCriticalSection 0.856798 0.856798 1.31647 1.31647 ntdll [unknown] 0

@unknownbrackets
Copy link
Collaborator

Hmm, that looks mostly normal. It seems like it's rendering something.

And an actual PSP shows exactly the same thing, just without the delay? There's no extra scene that is being rendered wrong or something?

By the way, Sleep means you had throttle on...

-[Unknown]

@Squall-Leonhart
Copy link

PSP, JPCSP and @oioitff media builds all behave like this video

https://www.youtube.com/watch?feature=player_detailpage&v=0NiPpdYMV50#t=233s

master pauses for 3ish minutes between the level up/slowmo and the information screen at 4:00

Just took another profile
WaitForSingleObject 1705.134117 1705.134117 59.042949 59.042949 kernel32 [unknown] 0
WaitForMultipleObjects 392.268939 392.268939 13.582929 13.582929 kernel32 [unknown] 0
RtlInitializeExceptionChain 262.541412 2887.08559 9.090909 99.969877 ntdll [unknown] 0
MsgWaitForMultipleObjects 131.270706 131.270706 4.545455 4.545455 USER32 [unknown] 0
PeekMessageW 131.270706 131.270706 4.545455 4.545455 USER32 [unknown] 0
DispatchMessageW 130.398656 130.446623 4.515258 4.516919 USER32 [unknown] 0
Sleep 98.868343 98.868343 3.423472 3.423472 KERNELBASE [unknown] 0
DrvPresentBuffers 3.253231 6.95261 0.112648 0.240745 nvoglv32 [unknown] 0
GLES_GPU::FastRunLoop 0.973009 13.651314 0.033692 0.472698

NativeRender 0 128.877043 0 4.46257 PPSSPPWindows

@Squall-Leonhart
Copy link

Sorted by inclusive instead

RtlInitializeExceptionChain 262.541412 2887.08559 9.090909 99.969877 ntdll [unknown] 0
BaseThreadInitThunk 0 2624.544178 0 90.878968 kernel32 [unknown] 0
WaitForSingleObject 1705.134117 1705.134117 59.042949 59.042949 kernel32 [unknown] 0
endthreadex 0 1311.837125 0 45.424423 MSVCR100 [unknown] 0
WorkerThread::WorkFunc 0 1050.165646 0 36.363636 PPSSPPWindows
std::thread::RunAndDelete<std::thread::Func<std::tr1::_Bind<void void std::tr1::_Bind1<std::tr1::_Callable_pmf<void (__thiscall http::Download::*const)(void) http::Download 0> http::Download *> > > > 0 1050.165646 0 36.363636 PPSSPPWindows
DrvCopyContext 0.120022 396.016339 0.004156 13.712688 nvoglv32 [unknown] 0
WaitForMultipleObjects 392.268939 392.268939 13.582929 13.582929 kernel32 [unknown] 0
[691A98CC] 0 262.54141 0 9.090909 nvoglv32 0
[746412DA] 0 262.537384 0 9.09077 DSOUND 0
[691A7EC7] 0 262.47841 0 9.088728 nvoglv32 0
[74642E13] 0 262.467377 0 9.088346 DSOUND 0

@Squall-Leonhart
Copy link

this comment by solarmystic might relate to this issue

#2039 (comment)

@unknownbrackets
Copy link
Collaborator

Unfortunately, probably not. In that case, it's hanging trying to play a video.

-[Unknown]

@Squall-Leonhart
Copy link

last working 40877cf
first build able to confirm as broken since then 89b2fdf

builds between these 2 change sets won't load the mickey riding a book video and the pause menu won't appear (FPS counter stops dead) so i can't get in game to test them.

there are also alot of No Builds in that gap.

@unknownbrackets
Copy link
Collaborator

Oh, I wonder if it's the same as the loop in Twin Brave, which seems ADSR related. That's the most likely thing in that range.

Does it help to replace this in Core/HW/SasAudio.cpp:

    case STATE_SUSTAIN:
        WalkCurve(sustainRate, sustainType);
        break;
    case STATE_RELEASE:
        WalkCurve(releaseRate, releaseType);
        if (height_ <= 0) {
            height_ = 0;
            SetState(STATE_OFF);
        }
        break;

With:

    case STATE_SUSTAIN:
        WalkCurve(sustainRate, sustainType);
        if (height_ <= 0) {
            height_ = 0;
            SetState(STATE_RELEASE);
        }
        break;
    case STATE_RELEASE:
        WalkCurve(releaseRate, releaseType);
        if (height_ <= 0) {
            height_ = 0;
            SetState(STATE_OFF);
        }
        break;

-[Unknown]

@Squall-Leonhart
Copy link

unfortunately not :(

or, wait, let me try from a full rebuild

no, it did not help.

@Squall-Leonhart
Copy link

though the issue does seem to be in the SasAudio source.

@unknownbrackets
Copy link
Collaborator

You could try a hack (if you have a savestate right before it, for example) by replacing this in Core/HLE/sceSas.cpp:

u32 sceSasGetEndFlag(u32 core) {
    return 0xFFFFFFFF;
}

If it doesn't hang this way, that means we're keeping a sound effect on too long.

-[Unknown]

@Squall-Leonhart
Copy link

Your code would not compile,

However, entered as

u32 sceSasGetEndFlag(u32 core) {
    u32 endFlag = 0;
    for (int i = 0; i < sas->maxVoices; i++) {
        if (!sas->voices[i].playing)
            endFlag |= (1 << i);
        return 0xFFFFFFFF;
    }

and the problem is gone, so yes, it seems a sound effect is being held onto too long.

@Squall-Leonhart
Copy link

u32 sceSasGetEndFlag(u32 core) {
    u32 endFlag = -1;
    for (int i = 0; i < sas->maxVoices; i++) {
        if (!sas->voices[i].playing)
            endFlag |= (1 << i);
    }

also works

@Squall-Leonhart
Copy link

not sure if this breaks something, but it works

u32 sceSasGetEndFlag(u32 core) {
    u32 endFlag = 0;
    for (int i = 0; i < sas->maxVoices; i++) {
         if (sas->voices[i].playing ? true : false);
            endFlag |= (1 << i);
    }

    DEBUG_LOG(HLE,"sceSasGetEndFlag(%08x)", endFlag);
    return endFlag;
}

@unknownbrackets
Copy link
Collaborator

if (sas->voices[i].playing ? true : false); // <--- notice the stray semicolon

Those semicolons, they'll get you every time.

-[Unknown]

@Squall-Leonhart
Copy link

not as stray as you would think,

with the ;. the following line is considered an empty controlled statement and the game transitions past to the next screen immediately
without the ; the next line is not considered an empty controlled statement and hangs on the white screen

so would that imply that

            endFlag |= (1 << i);

is not returning the desired result?

@unknownbrackets
Copy link
Collaborator

With the ;, your code is equivalent to:

u32 sceSasGetEndFlag(u32 core) {
    u32 endFlag = 0;
    for (int i = 0; i < sas->maxVoices; i++) {
        endFlag |= (1 << i);
    }

    DEBUG_LOG(HLE,"sceSasGetEndFlag(%08x)", endFlag);
    return endFlag;
}

In other words, the problem is the voice is still playing. You could try (SasAudio.cpp again):

void ADSREnvelope::Step() {
    // Let's end the envelope right away.
    height_ = 0;
    SetState(STATE_OFF);
    return;

    // This unreachable code here mainly to look pretty.
    switch (state_) {
...

To verify if it's the ADSR envelope at all. If that doesn't help, you can try disabling looping:

    else if (flags == 3) {
        if (loopEnabled_) {
            // Nah, looping is for suckers.
            //loopAtNextBlock_ = true;
        }
    }

If neither helps, then maybe we're not handling the voice right at all...

-[Unknown]

@Squall-Leonhart
Copy link

Verified to be the ADSR Envelop with the first code change.

Disabling Looping also works. but i assume the second block of code disables the envelope anyway.

@hrydgard
Copy link
Owner

hrydgard commented Jun 7, 2013

Somebody mentioned a while ago that the functionality of the Sas library appears to be very similar to the PSX SPU. So maybe some of this is relevant: http://psx.rules.org/spu.txt

@Squall-Leonhart
Copy link

@unknownbrackets
i utilised your first suggestion with a slight alteration

    case STATE_SUSTAIN:
        WalkCurve(sustainRate, sustainType);
        if (height_ < sustainLevel) {
            height_ = 0;
            SetState(STATE_RELEASE);
        }
        break;
    case STATE_RELEASE:
        WalkCurve(releaseRate, releaseType);
        if (height_ <= 0) {
            height_ = 0;
            SetState(STATE_OFF);
        }
        break;

this works, but im probably breaking things elsewhere

@unknownbrackets
Copy link
Collaborator

@hrydgard according to this it doesn't stop on sustain:
https://github.com/smokku/pcsx-rearmed/blob/master/plugins/dfsound/adsr.c#L146

PEOPS has some interesting comments in its code, which seem to disagree on the matter.

Hmm. Maybe I can find a way to test it.

-[Unknown]

@Squall-Leonhart
Copy link

dfsound is the evolution of PEOPS Dsound after pete released the source

PEOPS has a number of bugs not present in dfsound, so the comments in peops cannot be completely trusted to be correct (not that I don't trust Pete, what i don't trust is what was and wasn't known at the time he created the plugin)

unknownbrackets added a commit to unknownbrackets/ppsspp that referenced this issue Jun 10, 2013
@Squall-Leonhart
Copy link

Fixed by #2186

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants