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

Avoid duplicate logging in sceUtility*GetStatus #5968

Merged
merged 2 commits into from
May 8, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 37 additions & 16 deletions Core/HLE/sceUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const int SCE_ERROR_MODULE_NOT_LOADED = 0x80111103;
const int SCE_ERROR_AV_MODULE_BAD_ID = 0x80110F01;
const u32 PSP_MODULE_NET_HTTP = 261;
const u32 PSP_MODULE_NET_HTTPSTORAGE = 264;
int oldStatus = 100; //random value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably declare as u32 then we don't need to change those for example &WrapU_U to &WrapI_U


enum UtilityDialogType {
UTILITY_DIALOG_NONE,
Expand Down Expand Up @@ -131,7 +132,8 @@ int sceUtilitySavedataInitStart(u32 paramAddr)
WARN_LOG(SCEUTILITY, "sceUtilitySavedataInitStart(%08x): wrong dialog type", paramAddr);
return SCE_ERROR_UTILITY_WRONG_TYPE;
}


oldStatus = 100;
currentDialogType = UTILITY_DIALOG_SAVEDATA;
currentDialogActive = true;
int ret = saveDialog.Init(paramAddr);
Expand Down Expand Up @@ -163,7 +165,10 @@ int sceUtilitySavedataGetStatus()
}

int status = saveDialog.GetStatus();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raven02
status is int so that oldStatus also need int

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep :)

DEBUG_LOG(SCEUTILITY, "%08x=sceUtilitySavedataGetStatus()", status);
if (oldStatus != status) {
oldStatus = status;
DEBUG_LOG(SCEUTILITY, "%08x=sceUtilitySavedataGetStatus()", status);
}
hleEatCycles(200);
return status;
}
Expand Down Expand Up @@ -267,6 +272,7 @@ int sceUtilityMsgDialogInitStart(u32 paramAddr)
return SCE_ERROR_UTILITY_WRONG_TYPE;
}

oldStatus = 100;
currentDialogType = UTILITY_DIALOG_MSG;
currentDialogActive = true;
int ret = msgDialog.Init(paramAddr);
Expand Down Expand Up @@ -310,7 +316,10 @@ int sceUtilityMsgDialogGetStatus()
}

int status = msgDialog.GetStatus();
DEBUG_LOG(SCEUTILITY, "%08x=sceUtilityMsgDialogGetStatus()", status);
if (oldStatus != status) {
oldStatus = status;
DEBUG_LOG(SCEUTILITY, "%08x=sceUtilityMsgDialogGetStatus()", status);
}
return status;
}

Expand All @@ -337,6 +346,7 @@ int sceUtilityOskInitStart(u32 oskPtr)
return SCE_ERROR_UTILITY_WRONG_TYPE;
}

oldStatus = 100;
currentDialogType = UTILITY_DIALOG_OSK;
currentDialogActive = true;
int ret = oskDialog.Init(oskPtr);
Expand Down Expand Up @@ -380,7 +390,10 @@ int sceUtilityOskGetStatus()
}

int status = oskDialog.GetStatus();
DEBUG_LOG(SCEUTILITY, "%08x=sceUtilityOskGetStatus()", status);
if (oldStatus != status) {
oldStatus = status;
DEBUG_LOG(SCEUTILITY, "%08x=sceUtilityOskGetStatus()", status);
}
return status;
}

Expand All @@ -392,6 +405,7 @@ int sceUtilityNetconfInitStart(u32 paramsAddr)
return SCE_ERROR_UTILITY_WRONG_TYPE;
}

oldStatus = 100;
currentDialogType = UTILITY_DIALOG_NET;
currentDialogActive = true;
int ret = netDialog.Init(paramsAddr);
Expand Down Expand Up @@ -428,28 +442,32 @@ int sceUtilityNetconfGetStatus()
}

int status = netDialog.GetStatus();
DEBUG_LOG(SCEUTILITY, "%08x=sceUtilityNetconfGetStatus()", status);
if (oldStatus != status) {
oldStatus = status;
DEBUG_LOG(SCEUTILITY, "%08x=sceUtilityNetconfGetStatus()", status);
}
return status;
}

//TODO: Implement all sceUtilityScreenshot* for real, it doesn't seem to be complex
//but it requires more investigation
u32 sceUtilityScreenshotInitStart(u32 paramAddr)
int sceUtilityScreenshotInitStart(u32 paramAddr)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raven02 Only sceUtilityScreenshot* use u32
So that I change to int

{
if (currentDialogActive && currentDialogType != UTILITY_DIALOG_SCREENSHOT)
{
WARN_LOG(SCEUTILITY, "sceUtilityScreenshotInitStart(%08x): wrong dialog type", paramAddr);
return SCE_ERROR_UTILITY_WRONG_TYPE;
}

oldStatus = 100;
currentDialogType = UTILITY_DIALOG_SCREENSHOT;
currentDialogActive = true;
u32 retval = screenshotDialog.Init();
WARN_LOG_REPORT(SCEUTILITY, "%08x=sceUtilityScreenshotInitStart(%08x)", retval, paramAddr);
return retval;
}

u32 sceUtilityScreenshotShutdownStart()
int sceUtilityScreenshotShutdownStart()
{
if (currentDialogType != UTILITY_DIALOG_SCREENSHOT)
{
Expand All @@ -463,7 +481,7 @@ u32 sceUtilityScreenshotShutdownStart()
return ret;
}

u32 sceUtilityScreenshotUpdate(u32 animSpeed)
int sceUtilityScreenshotUpdate(u32 animSpeed)
{
if (currentDialogType != UTILITY_DIALOG_SCREENSHOT)
{
Expand All @@ -484,20 +502,23 @@ int sceUtilityScreenshotGetStatus()
return SCE_ERROR_UTILITY_WRONG_TYPE;
}

u32 status = screenshotDialog.GetStatus();
WARN_LOG(SCEUTILITY, "%08x=sceUtilityScreenshotGetStatus()", status);
int status = screenshotDialog.GetStatus();
if (oldStatus != status) {
oldStatus = status;
WARN_LOG(SCEUTILITY, "%08x=sceUtilityScreenshotGetStatus()", status);
}
return status;
}

u32 sceUtilityScreenshotContStart(u32 paramAddr)
int sceUtilityScreenshotContStart(u32 paramAddr)
{
if (currentDialogType != UTILITY_DIALOG_SCREENSHOT)
{
WARN_LOG(SCEUTILITY, "sceUtilityScreenshotContStart(): wrong dialog type");
return SCE_ERROR_UTILITY_WRONG_TYPE;
}

u32 ret = screenshotDialog.ContStart();
int ret = screenshotDialog.ContStart();
WARN_LOG(SCEUTILITY, "%08x=sceUtilityScreenshotContStart(%08x)", ret, paramAddr);
return ret;
}
Expand Down Expand Up @@ -789,11 +810,11 @@ const HLEFunction sceUtility[] =
{0x2a2b3de0, &WrapU_U<sceUtilityLoadModule>, "sceUtilityLoadModule"},
{0xe49bfe92, &WrapU_U<sceUtilityUnloadModule>, "sceUtilityUnloadModule"},

{0x0251B134, &WrapU_U<sceUtilityScreenshotInitStart>, "sceUtilityScreenshotInitStart"},
{0xF9E0008C, &WrapU_V<sceUtilityScreenshotShutdownStart>, "sceUtilityScreenshotShutdownStart"},
{0xAB083EA9, &WrapU_U<sceUtilityScreenshotUpdate>, "sceUtilityScreenshotUpdate"},
{0x0251B134, &WrapI_U<sceUtilityScreenshotInitStart>, "sceUtilityScreenshotInitStart"},
{0xF9E0008C, &WrapI_V<sceUtilityScreenshotShutdownStart>, "sceUtilityScreenshotShutdownStart"},
{0xAB083EA9, &WrapI_U<sceUtilityScreenshotUpdate>, "sceUtilityScreenshotUpdate"},
{0xD81957B7, &WrapI_V<sceUtilityScreenshotGetStatus>, "sceUtilityScreenshotGetStatus"},
{0x86A03A27, &WrapU_U<sceUtilityScreenshotContStart>, "sceUtilityScreenshotContStart"},
{0x86A03A27, &WrapI_U<sceUtilityScreenshotContStart>, "sceUtilityScreenshotContStart"},

{0x0D5BC6D2, 0, "sceUtilityLoadUsbModule"},
{0xF64910F0, 0, "sceUtilityUnloadUsbModule"},
Expand Down