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

scePsmf() : add isPlayingStatus check #5338

Merged
merged 2 commits into from
Feb 9, 2014
Merged

scePsmf() : add isPlayingStatus check #5338

merged 2 commits into from
Feb 9, 2014

Conversation

dbz400
Copy link
Contributor

@dbz400 dbz400 commented Feb 4, 2014

Fixes #5178

@dbz400
Copy link
Contributor Author

dbz400 commented Feb 5, 2014

It is referencing to apply psmfplayer status check here. It fixes the hanging in return PSMF video/audio when end.

https://code.google.com/p/jpcsp/source/browse/trunk/src/jpcsp/HLE/modules150/scePsmfPlayer.java?spec=svn3454&r=3454#482

@unknownbrackets
Copy link
Collaborator

I don't really understand your condition:

(
  (
    psmfplayer->status != PSMF_PLAYER_STATUS_PLAYING
    && psmfplayer->status != PSMF_PLAYER_STATUS_PLAYING_FINISHED
    && psmfplayer->status != PSMF_PLAYER_STATUS_ERROR
  )
  || psmfplayer->status == PSMF_PLAYER_STATUS_NONE
)

The NONE part seems completely superfluous. Like saying, "if I don't have 3, 4, or 5 apples - or if I have 9 apples." 9 isn't one of 3, 4, or 5 anyway.

I assume these statuses aren't tested and is just from JPCSP, right?

-[Unknown]

@dbz400
Copy link
Contributor Author

dbz400 commented Feb 6, 2014

Yep , it is borrow from JPCSP though .

Sorry the NONE part is wrongly put in during testing and has been removed here

@dbz400
Copy link
Contributor Author

dbz400 commented Feb 6, 2014

This is the ref code from JPCSP and translate here in this commit

public int checkPlayerPlaying(int psmfPlayer) {
    psmfPlayer = checkPlayerInitialized(psmfPlayer);
    if (psmfPlayerStatus != PSMF_PLAYER_STATUS_PLAYING && psmfPlayerStatus != PSMF_PLAYER_STATUS_PLAYING_FINISHED && psmfPlayerStatus != PSMF_PLAYER_STATUS_ERROR) {
            if (log.isDebugEnabled()) {
                    log.debug(String.format("checkPlayerInitialized player not playing (status=0x%X)", psmfPlayerStatus));
            }
            throw new SceKernelErrorException(ERROR_PSMFPLAYER_NOT_INITIALIZED);
    }

    return psmfPlayer;
}

@hrydgard
Copy link
Owner

hrydgard commented Feb 6, 2014

Would have been nicer to centralize the check in a function (like, bool IsPlayingStatus(u32 status) ).

By the way, it looks pretty odd to have _ERROR in there. Is there a motivation for that?

@dbz400
Copy link
Contributor Author

dbz400 commented Feb 6, 2014

I'll have further check here to see if that _ERROR is necessary and also consolidate it in a single function and call it .

@dbz400
Copy link
Contributor Author

dbz400 commented Feb 6, 2014

Done .Should be clean now.

@dbz400
Copy link
Contributor Author

dbz400 commented Feb 8, 2014

@hrydgard , okay to merge?

@hrydgard
Copy link
Owner

hrydgard commented Feb 8, 2014

Hm, didn't you flip all the checks to the opposite now? Shouldn't it be:

if (!isPlayingStatus(psmfplayer->status)) {
    ERROR_LOG ....
    ...
}

@unknownbrackets
Copy link
Collaborator

Confusingly, isPlayingStatus() returns true when it's not playing, and false when it is playing.

-[Unknown]

@hrydgard
Copy link
Owner

hrydgard commented Feb 8, 2014

Ah right, so it's correct but wrongly named. Please rename it "isNotPlaying" or reverse the return value and the checks.

@dbz400
Copy link
Contributor Author

dbz400 commented Feb 9, 2014

Done. Should be good this time.

@dbz400
Copy link
Contributor Author

dbz400 commented Feb 9, 2014

Just tested Crimson Room Reverse , this commit also fixed it .

hrydgard added a commit that referenced this pull request Feb 9, 2014
scePsmf() : add isPlayingStatus check
@hrydgard hrydgard merged commit 91b9089 into hrydgard:master Feb 9, 2014
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

Successfully merging this pull request may close these issues.

Kidou Senshi Gundam - Shin Gihren no Yabou hangup when video finished.
3 participants