trophyfix

This commit is contained in:
Jake 2018-01-23 20:37:29 +01:00 committed by Zangetsu38
parent 081d7c5de7
commit 488c4d198f
4 changed files with 35 additions and 10 deletions

View file

@ -2,6 +2,7 @@
#include "Emu/System.h"
#include "Emu/IdManager.h"
#include "Emu/Cell/PPUModule.h"
#include "Emu/Cell/lv2/sys_sync.h"
#include "cellSysutil.h"
@ -46,6 +47,22 @@ extern void sysutil_register_cb(std::function<s32(ppu_thread&)>&& cb)
cbm->registered.push(std::move(cb));
}
extern s32 sysutil_register_cb_wait(ppu_thread& caller, std::function<s32(ppu_thread&)>&& cb) {
atomic_t<bool> wait{true};
u32 rtn = -1;
sysutil_register_cb([&](ppu_thread& ppu) -> s32 {
rtn = cb(ppu);
wait = false;
caller.notify();
return CELL_OK;
});
lv2_obj::sleep(caller);
while (wait && !Emu.IsStopped()) thread_ctrl::wait();
return rtn;
}
extern void sysutil_send_system_cmd(u64 status, u64 param)
{
if (const auto cbm = fxm::get<sysutil_cb_manager>())

View file

@ -199,3 +199,4 @@ struct CellSysCacheParam
extern void sysutil_register_cb(std::function<s32(ppu_thread&)>&&);
extern void sysutil_send_system_cmd(u64 status, u64 param);
extern s32 sysutil_register_cb_wait(ppu_thread&, std::function<s32(ppu_thread&)>&&);

View file

@ -2,6 +2,7 @@
#include "Emu/System.h"
#include "Emu/IdManager.h"
#include "Emu/Cell/PPUModule.h"
#include "Emu/Cell/Modules/cellSysutil.h"
#include "restore_new.h"
#include "Utilities/rXml.h"
@ -315,16 +316,23 @@ error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle,
tropusr->Load(trophyUsrPath, trophyConfPath);
ctxt->tropusr.reset(tropusr);
// TODO: Callbacks
if (statusCb(ppu, context, SCE_NP_TROPHY_STATUS_INSTALLED, 100, 100, arg) < 0)
{
return SCE_NP_TROPHY_ERROR_PROCESSING_ABORTED;
}
s32 rtn = sysutil_register_cb_wait(ppu, [=](ppu_thread& ppu) -> s32 {
return statusCb(ppu, context, SCE_NP_TROPHY_STATUS_INSTALLED, 100, 100, arg);
});
if (statusCb(ppu, context, SCE_NP_TROPHY_STATUS_PROCESSING_COMPLETE, 100, 100, arg) < 0)
{
return SCE_NP_TROPHY_ERROR_PROCESSING_ABORTED;
}
if (rtn < 0)
return SCE_NP_TROPHY_ERROR_PROCESSING_ABORTED;
rtn = sysutil_register_cb_wait(ppu, [=](ppu_thread& ppu) -> s32 {
return statusCb(ppu, context, SCE_NP_TROPHY_STATUS_PROCESSING_COMPLETE, 100, 100, arg);
});
if (rtn < 0)
return SCE_NP_TROPHY_ERROR_PROCESSING_ABORTED;
rtn = sysutil_register_cb_wait(ppu, [=](ppu_thread& ppu) -> s32 {
return CELL_OK;
});
return CELL_OK;
}

View file

@ -130,7 +130,6 @@ void msg_dialog_frame::Create(const std::string& msg)
connect(m_button_ok, &QAbstractButton::clicked, [=]
{
on_close(CELL_MSGDIALOG_BUTTON_OK);
m_dialog->accept();
});
}