cellOskDialog: fix cellOskDialogUnloadAsync return string

fixes Class of Heroes 2G
This commit is contained in:
Megamouse 2019-01-12 09:23:43 +01:00
parent 3406acd8c9
commit f9c1b15bf4

View File

@ -224,14 +224,18 @@ error_code getText(vm::ptr<CellOskDialogCallbackReturnParam> OutputInfo, bool is
} }
} }
const bool is_valid = OutputInfo->pResultString && (OutputInfo->result == CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK || (is_unload && OutputInfo->result == CELL_OSKDIALOG_INPUT_FIELD_RESULT_NO_INPUT_TEXT)); bool do_copy = OutputInfo->pResultString && (OutputInfo->result == CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK || (is_unload && OutputInfo->result == CELL_OSKDIALOG_INPUT_FIELD_RESULT_NO_INPUT_TEXT));
for (u32 i = 0; i < CELL_OSKDIALOG_STRING_SIZE - 1; i++) for (u32 i = 0; i < CELL_OSKDIALOG_STRING_SIZE - 1; i++)
{ {
osk->osk_text_old[i] = osk->osk_text[i]; osk->osk_text_old[i] = osk->osk_text[i];
if (is_valid && i < OutputInfo->numCharsResultString) if (do_copy && i < OutputInfo->numCharsResultString)
{ {
if (osk->osk_text[i] == 0)
{
do_copy = false;
}
OutputInfo->pResultString[i] = osk->osk_text[i]; OutputInfo->pResultString[i] = osk->osk_text[i];
} }
} }
@ -443,6 +447,11 @@ error_code cellOskDialogExtRegisterConfirmWordFilterCallback(vm::ptr<cellOskDial
{ {
cellOskDialog.warning("cellOskDialogExtRegisterConfirmWordFilterCallback(pCallback=*0x%x)", pCallback); cellOskDialog.warning("cellOskDialogExtRegisterConfirmWordFilterCallback(pCallback=*0x%x)", pCallback);
if (!pCallback)
{
return CELL_OSKDIALOG_ERROR_PARAM;
}
auto osk = fxm::get<OskDialogBase>(); auto osk = fxm::get<OskDialogBase>();
if (!osk) if (!osk)
{ {