Make sure sceUtility funcs all return error codes.

Right now, everything is 0, but before it wasn't returning anything.
Returning 0 actually made some games start working right.
This commit is contained in:
Unknown W. Brackets 2012-12-24 18:37:28 -08:00
parent db6ef8ce64
commit f8f581794f
13 changed files with 77 additions and 72 deletions

View File

@ -53,14 +53,15 @@ void PSPDialog::DisplayMessage(std::string text)
PPGeDrawText(text.c_str(), 480/2, 100, PPGE_ALIGN_CENTER, 0.5f, 0xFFFFFFFF);
}
void PSPDialog::Shutdown()
int PSPDialog::Shutdown()
{
status = SCE_UTILITY_STATUS_SHUTDOWN;
return 0;
}
void PSPDialog::Update()
int PSPDialog::Update()
{
return 0;
}
bool PSPDialog::IsButtonPressed(int checkButton)

View File

@ -45,8 +45,8 @@ public:
PSPDialog();
virtual ~PSPDialog();
virtual void Update();
virtual void Shutdown();
virtual int Update();
virtual int Shutdown();
enum DialogStatus
{

View File

@ -29,18 +29,18 @@ PSPMsgDialog::PSPMsgDialog()
PSPMsgDialog::~PSPMsgDialog() {
}
void PSPMsgDialog::Init(unsigned int paramAddr)
int PSPMsgDialog::Init(unsigned int paramAddr)
{
// Ignore if already running
if (status != SCE_UTILITY_STATUS_NONE && status != SCE_UTILITY_STATUS_SHUTDOWN)
{
return;
return 0;
}
messageDialogAddr = paramAddr;
if (!Memory::IsValidAddress(messageDialogAddr))
{
return;
return 0;
}
Memory::ReadStruct(messageDialogAddr, &messageDialog);
@ -63,7 +63,7 @@ void PSPMsgDialog::Init(unsigned int paramAddr)
status = SCE_UTILITY_STATUS_INITIALIZE;
lastButtons = __CtrlPeekButtons();
return 0;
}
void PSPMsgDialog::DisplayBack()
@ -95,7 +95,7 @@ void PSPMsgDialog::DisplayEnterBack()
PPGeDrawText("Back", 320, 220, PPGE_ALIGN_LEFT, 0.5f, 0xFFFFFFFF);
}
void PSPMsgDialog::Update()
int PSPMsgDialog::Update()
{
switch (status) {
case SCE_UTILITY_STATUS_FINISHED:
@ -105,7 +105,7 @@ void PSPMsgDialog::Update()
if (status != SCE_UTILITY_STATUS_RUNNING)
{
return;
return 0;
}
const char *text;
@ -191,17 +191,18 @@ void PSPMsgDialog::Update()
break;
default:
status = SCE_UTILITY_STATUS_FINISHED;
return;
return 0;
break;
}
lastButtons = buttons;
Memory::WriteStruct(messageDialogAddr, &messageDialog);
return 0;
}
void PSPMsgDialog::Shutdown()
int PSPMsgDialog::Shutdown()
{
PSPDialog::Shutdown();
return PSPDialog::Shutdown();
}

View File

@ -41,9 +41,9 @@ public:
PSPMsgDialog();
virtual ~PSPMsgDialog();
virtual void Init(unsigned int paramAddr);
virtual void Update();
void Shutdown();
virtual int Init(unsigned int paramAddr);
virtual int Update();
int Shutdown();
private :
void DisplayBack();

View File

@ -143,7 +143,7 @@ void PSPOskDialog::RenderKeyboard()
}
void PSPOskDialog::Update()
int PSPOskDialog::Update()
{
buttons = __CtrlReadLatch();
int selectedRow = selectedChar / KEYSPERROW;
@ -230,4 +230,6 @@ void PSPOskDialog::Update()
oskData.result = PSP_UTILITY_OSK_RESULT_CHANGED;
Memory::WriteStruct(oskParams.SceUtilityOskDataPtr, &oskData);
Memory::WriteStruct(oskParamsAddr, &oskParams);
return 0;
}

View File

@ -145,7 +145,7 @@ public:
virtual ~PSPOskDialog();
virtual int Init(u32 oskPtr);
virtual void Update();
virtual int Update();
private:
void HackyGetStringWide(std::string& _string, const u32 em_address);
void RenderKeyboard();

View File

@ -25,12 +25,13 @@ PSPPlaceholderDialog::~PSPPlaceholderDialog() {
}
void PSPPlaceholderDialog::Init()
int PSPPlaceholderDialog::Init()
{
status = SCE_UTILITY_STATUS_INITIALIZE;
return 0;
}
void PSPPlaceholderDialog::Update()
int PSPPlaceholderDialog::Update()
{
//__UtilityUpdate();
if (status == SCE_UTILITY_STATUS_INITIALIZE)
@ -45,4 +46,5 @@ void PSPPlaceholderDialog::Update()
{
status = SCE_UTILITY_STATUS_SHUTDOWN;
}
return 0;
}

View File

@ -24,7 +24,7 @@ public:
PSPPlaceholderDialog();
virtual ~PSPPlaceholderDialog();
virtual void Init();
virtual void Update();
virtual int Init();
virtual int Update();
};

View File

@ -31,7 +31,7 @@ PSPSaveDialog::PSPSaveDialog()
PSPSaveDialog::~PSPSaveDialog() {
}
u32 PSPSaveDialog::Init(int paramAddr)
int PSPSaveDialog::Init(int paramAddr)
{
// Ignore if already running
if (status != SCE_UTILITY_STATUS_NONE && status != SCE_UTILITY_STATUS_SHUTDOWN)
@ -315,7 +315,7 @@ void PSPSaveDialog::DisplayBack()
PPGeDrawText("Back", 270, 220, PPGE_ALIGN_LEFT, 0.5f, 0xFFFFFFFF);
}
void PSPSaveDialog::Update()
int PSPSaveDialog::Update()
{
switch (status) {
case SCE_UTILITY_STATUS_FINISHED:
@ -327,12 +327,12 @@ void PSPSaveDialog::Update()
if (status != SCE_UTILITY_STATUS_RUNNING)
{
return;
return 0;
}
if (!param.GetPspParam()) {
status = SCE_UTILITY_STATUS_SHUTDOWN;
return;
return 0;
}
buttons = __CtrlPeekButtons();
@ -684,11 +684,14 @@ void PSPSaveDialog::Update()
Memory::Memcpy(requestAddr,&request,request.size);
}
return 0;
}
void PSPSaveDialog::Shutdown()
int PSPSaveDialog::Shutdown()
{
PSPDialog::Shutdown();
param.SetPspParam(0);
return 0;
}

View File

@ -62,9 +62,9 @@ public:
PSPSaveDialog();
virtual ~PSPSaveDialog();
virtual u32 Init(int paramAddr);
virtual void Update();
void Shutdown();
virtual int Init(int paramAddr);
virtual int Update();
int Shutdown();
private :

View File

@ -378,7 +378,7 @@ void SavedataParam::Clear()
}
}
u32 SavedataParam::SetPspParam(SceUtilitySavedataParam *param)
int SavedataParam::SetPspParam(SceUtilitySavedataParam *param)
{
pspParam = param;
if (!pspParam)

View File

@ -156,7 +156,7 @@ public:
SavedataParam();
u32 SetPspParam(SceUtilitySavedataParam* param);
int SetPspParam(SceUtilitySavedataParam* param);
SceUtilitySavedataParam* GetPspParam();
int GetFilenameCount();

View File

@ -50,14 +50,13 @@ void __UtilityShutdown()
int sceUtilitySavedataInitStart(u32 paramAddr)
{
DEBUG_LOG(HLE,"sceUtilitySavedataInitStart(%08x)", paramAddr);
return (u32)saveDialog.Init(paramAddr);
return saveDialog.Init(paramAddr);
}
int sceUtilitySavedataShutdownStart()
{
DEBUG_LOG(HLE,"sceUtilitySavedataShutdownStart()");
saveDialog.Shutdown();
return 0;
return saveDialog.Shutdown();
}
int sceUtilitySavedataGetStatus()
@ -65,13 +64,10 @@ int sceUtilitySavedataGetStatus()
return saveDialog.GetStatus();
}
void sceUtilitySavedataUpdate(u32 unknown)
int sceUtilitySavedataUpdate(int animSpeed)
{
DEBUG_LOG(HLE,"sceUtilitySavedataUpdate()");
saveDialog.Update();
return;
DEBUG_LOG(HLE,"sceUtilitySavedataUpdate(%d)", animSpeed);
return saveDialog.Update();
}
#define PSP_AV_MODULE_AVCODEC 0
@ -99,26 +95,27 @@ void sceUtilityLoadModule(u32 module)
__KernelReSchedule("utilityloadmodule");
}
void sceUtilityMsgDialogInitStart(u32 structAddr)
int sceUtilityMsgDialogInitStart(u32 structAddr)
{
DEBUG_LOG(HLE,"sceUtilityMsgDialogInitStart(%i)", structAddr);
msgDialog.Init(structAddr);
return msgDialog.Init(structAddr);
}
void sceUtilityMsgDialogShutdownStart(u32 unknown)
int sceUtilityMsgDialogShutdownStart(u32 unknown)
{
DEBUG_LOG(HLE,"FAKE sceUtilityMsgDialogShutdownStart(%i)", unknown);
msgDialog.Shutdown();
return msgDialog.Shutdown();
}
void sceUtilityMsgDialogUpdate(int animSpeed)
int sceUtilityMsgDialogUpdate(int animSpeed)
{
DEBUG_LOG(HLE,"sceUtilityMsgDialogUpdate(%i)", animSpeed);
msgDialog.Update();
return msgDialog.Update();
}
u32 sceUtilityMsgDialogGetStatus()
int sceUtilityMsgDialogGetStatus()
{
DEBUG_LOG(HLE,"sceUtilityMsgDialogGetStatus()");
return msgDialog.GetStatus();
}
@ -134,14 +131,13 @@ int sceUtilityOskInitStart(u32 oskPtr)
int sceUtilityOskShutdownStart()
{
ERROR_LOG(HLE,"FAKE sceUtilityOskShutdownStart(%i)", PARAM(0));
oskDialog.Shutdown();
return 0;
return oskDialog.Shutdown();
}
void sceUtilityOskUpdate(unsigned int unknown)
int sceUtilityOskUpdate(unsigned int unknown)
{
ERROR_LOG(HLE,"FAKE sceUtilityOskUpdate(%i)", unknown);
oskDialog.Update();
return oskDialog.Update();
}
int sceUtilityOskGetStatus()
@ -156,25 +152,25 @@ int sceUtilityOskGetStatus()
}
void sceUtilityNetconfInitStart(unsigned int unknown)
int sceUtilityNetconfInitStart(u32 structAddr)
{
DEBUG_LOG(HLE,"FAKE sceUtilityNetconfInitStart(%i)", unknown);
netDialog.Init();
DEBUG_LOG(HLE,"FAKE sceUtilityNetconfInitStart(%08x)", structAddr);
return netDialog.Init();
}
void sceUtilityNetconfShutdownStart(unsigned int unknown)
int sceUtilityNetconfShutdownStart(unsigned int unknown)
{
DEBUG_LOG(HLE,"FAKE sceUtilityNetconfShutdownStart(%i)", unknown);
netDialog.Shutdown();
return netDialog.Shutdown();
}
void sceUtilityNetconfUpdate(int unknown)
int sceUtilityNetconfUpdate(int animSpeed)
{
DEBUG_LOG(HLE,"FAKE sceUtilityNetconfUpdate(%i)", unknown);
netDialog.Update();
DEBUG_LOG(HLE,"FAKE sceUtilityNetconfUpdate(%i)", animSpeed);
return netDialog.Update();
}
unsigned int sceUtilityNetconfGetStatus()
int sceUtilityNetconfGetStatus()
{
DEBUG_LOG(HLE,"sceUtilityNetconfGetStatus()");
return netDialog.GetStatus();
@ -356,28 +352,28 @@ const HLEFunction sceUtility[] =
{0x64d50c56, &WrapU_U<sceUtilityUnloadNetModule>, "sceUtilityUnloadNetModule"},
{0xf88155f6, &WrapV_U<sceUtilityNetconfShutdownStart>, "sceUtilityNetconfShutdownStart"},
{0x4db1e739, &WrapV_U<sceUtilityNetconfInitStart>, "sceUtilityNetconfInitStart"},
{0x91e70e35, &WrapV_I<sceUtilityNetconfUpdate>, "sceUtilityNetconfUpdate"},
{0x6332aa39, &WrapU_V<sceUtilityNetconfGetStatus>, "sceUtilityNetconfGetStatus"},
{0xf88155f6, &WrapI_U<sceUtilityNetconfShutdownStart>, "sceUtilityNetconfShutdownStart"},
{0x4db1e739, &WrapI_U<sceUtilityNetconfInitStart>, "sceUtilityNetconfInitStart"},
{0x91e70e35, &WrapI_I<sceUtilityNetconfUpdate>, "sceUtilityNetconfUpdate"},
{0x6332aa39, &WrapI_V<sceUtilityNetconfGetStatus>, "sceUtilityNetconfGetStatus"},
{0x5eee6548, 0, "sceUtilityCheckNetParam"},
{0x434d4b3a, 0, "sceUtilityGetNetParam"},
{0x4FED24D8, 0, "sceUtilityGetNetParamLatestID"},
{0x67af3428, &WrapV_U<sceUtilityMsgDialogShutdownStart>, "sceUtilityMsgDialogShutdownStart"},
{0x2ad8e239, &WrapV_U<sceUtilityMsgDialogInitStart>, "sceUtilityMsgDialogInitStart"},
{0x95fc253b, &WrapV_I<sceUtilityMsgDialogUpdate>, "sceUtilityMsgDialogUpdate"},
{0x9a1c91d7, &WrapU_V<sceUtilityMsgDialogGetStatus>, "sceUtilityMsgDialogGetStatus"},
{0x67af3428, &WrapI_U<sceUtilityMsgDialogShutdownStart>, "sceUtilityMsgDialogShutdownStart"},
{0x2ad8e239, &WrapI_U<sceUtilityMsgDialogInitStart>, "sceUtilityMsgDialogInitStart"},
{0x95fc253b, &WrapI_I<sceUtilityMsgDialogUpdate>, "sceUtilityMsgDialogUpdate"},
{0x9a1c91d7, &WrapI_V<sceUtilityMsgDialogGetStatus>, "sceUtilityMsgDialogGetStatus"},
{0x4928bd96, 0, "sceUtilityMsgDialogAbort"},
{0x9790b33c, &WrapI_V<sceUtilitySavedataShutdownStart>, "sceUtilitySavedataShutdownStart"},
{0x50c4cd57, &WrapI_U<sceUtilitySavedataInitStart>, "sceUtilitySavedataInitStart"},
{0xd4b95ffb, &WrapV_U<sceUtilitySavedataUpdate>, "sceUtilitySavedataUpdate"},
{0xd4b95ffb, &WrapI_I<sceUtilitySavedataUpdate>, "sceUtilitySavedataUpdate"},
{0x8874dbe0, &WrapI_V<sceUtilitySavedataGetStatus>, "sceUtilitySavedataGetStatus"},
{0x3dfaeba9, &WrapI_V<sceUtilityOskShutdownStart>, "sceUtilityOskShutdownStart"},
{0xf6269b82, &WrapI_U<sceUtilityOskInitStart>, "sceUtilityOskInitStart"},
{0x4b85c861, &WrapV_U<sceUtilityOskUpdate>, "sceUtilityOskUpdate"},
{0x4b85c861, &WrapI_U<sceUtilityOskUpdate>, "sceUtilityOskUpdate"},
{0xf3f76017, &WrapI_V<sceUtilityOskGetStatus>, "sceUtilityOskGetStatus"},
{0x41e30674, &WrapU_UU<sceUtilitySetSystemParamString>, "sceUtilitySetSystemParamString"},