Implement NetStartDialogLoadAsync, L10N additions

Also improved cellPadPeriphGetInfo
This commit is contained in:
Raul Tambre 2015-09-10 17:13:31 +03:00
parent f9731de777
commit cd7fbae583
15 changed files with 521 additions and 38 deletions

View file

@ -30,6 +30,17 @@
extern Module cellNetCtl;
std::unique_ptr<SignInDialogInstance> g_sign_in_dialog;
SignInDialogInstance::SignInDialogInstance()
{
}
void SignInDialogInstance::Close()
{
state = signInDialogClose;
}
s32 cellNetCtlInit()
{
cellNetCtl.Warning("cellNetCtlInit()");
@ -334,12 +345,68 @@ s32 cellNetCtlGetInfo(s32 code, vm::ptr<CellNetCtlInfo> info)
return CELL_OK;
}
void dialogOpenCallback()
{
named_thread_t(WRAP_EXPR("SignInDialog Thread"), [=]()
{
while (g_sign_in_dialog->state == signInDialogOpen)
{
if (Emu.IsStopped())
{
g_sign_in_dialog->state = signInDialogAbort;
break;
}
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
}
CallAfter([]()
{
g_sign_in_dialog->Destroy();
g_sign_in_dialog->state = signInDialogNone;
});
}).detach();
}
s32 cellNetCtlNetStartDialogLoadAsync(vm::ptr<CellNetCtlNetStartDialogParam> param)
{
cellNetCtl.Warning("cellNetCtlNetStartDialogLoadAsync(param=*0x%x)", param);
// TODO: Actually sign into PSN or an emulated network similar to PSN
sysutilSendSystemCommand(CELL_SYSUTIL_NET_CTL_NETSTART_FINISHED, 0);
// TODO: Actually sign into PSN or an emulated network similar to PSN (ESN)
sysutilSendSystemCommand(CELL_SYSUTIL_NET_CTL_NETSTART_LOADED, 0);
// The way this is handled, is heavily inspired by the cellMsgDialogOpen2 implementation
if (param->type == CELL_NET_CTL_NETSTART_TYPE_NP)
{
cellNetCtl.Warning("cellNetCtlNetStartDialogLoadAsync(CELL_NET_CTL_NETSTART_TYPE_NP)", param);
// Make sure that the dialog is not already open.
SignInDialogState old = signInDialogNone;
if (!g_sign_in_dialog->state.compare_exchange_strong(old, signInDialogInit))
{
return CELL_SYSUTIL_ERROR_BUSY;
}
CallAfter([]()
{
if (Emu.IsStopped())
{
g_sign_in_dialog->state.exchange(signInDialogNone);
return;
}
g_sign_in_dialog->Create();
g_sign_in_dialog->state.exchange(signInDialogOpen);
dialogOpenCallback();
});
}
else
{
cellNetCtl.Warning("cellNetCtlNetStartDialogLoadAsync(CELL_NET_CTL_NETSTART_TYPE_NET)", param);
sysutilSendSystemCommand(CELL_SYSUTIL_NET_CTL_NETSTART_FINISHED, 0);
}
return CELL_OK;
}
@ -348,6 +415,15 @@ s32 cellNetCtlNetStartDialogAbortAsync()
{
cellNetCtl.Todo("cellNetCtlNetStartDialogAbortAsync()");
SignInDialogState old = signInDialogOpen;
if (!g_sign_in_dialog->state.compare_exchange_strong(old, signInDialogAbort))
{
cellNetCtl.Error("cellNetCtlNetStartDialogAbortAsync(): Aborting the dialog failed.");
}
g_sign_in_dialog->status = CELL_NET_CTL_ERROR_DIALOG_ABORTED;
return CELL_OK;
}
@ -355,6 +431,7 @@ s32 cellNetCtlNetStartDialogUnloadAsync(vm::ptr<CellNetCtlNetStartDialogResult>
{
cellNetCtl.Warning("cellNetCtlNetStartDialogUnloadAsync(result=*0x%x)", result);
result->result = g_sign_in_dialog->status;
sysutilSendSystemCommand(CELL_SYSUTIL_NET_CTL_NETSTART_UNLOADED, 0);
return CELL_OK;