wrapper to call for other hle dialogs
| 163 | |
| 164 | // wrapper to call for other hle dialogs |
| 165 | error_code open_msg_dialog(bool is_blocking, u32 type, vm::cptr<char> msgString, msg_dialog_source source, vm::ptr<CellMsgDialogCallback> callback, vm::ptr<void> userData, vm::ptr<void> extParam, s32* return_code) |
| 166 | { |
| 167 | cellSysutil.notice("open_msg_dialog(is_blocking=%d, type=0x%x, msgString=%s, source=%s, callback=*0x%x, userData=*0x%x, extParam=*0x%x, return_code=*0x%x)", is_blocking, type, msgString, source, callback, userData, extParam, return_code); |
| 168 | |
| 169 | const MsgDialogType _type{type}; |
| 170 | |
| 171 | if (return_code) |
| 172 | { |
| 173 | *return_code = CELL_MSGDIALOG_BUTTON_NONE; |
| 174 | } |
| 175 | |
| 176 | if (auto manager = g_fxo->try_get<rsx::overlays::display_manager>()) |
| 177 | { |
| 178 | if (manager->get<rsx::overlays::message_dialog>()) |
| 179 | { |
| 180 | return CELL_SYSUTIL_ERROR_BUSY; |
| 181 | } |
| 182 | |
| 183 | if (s32 ret = sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_BEGIN, 0); ret < 0) |
| 184 | { |
| 185 | return CellSysutilError{ret + 0u}; |
| 186 | } |
| 187 | |
| 188 | const auto notify = std::make_shared<atomic_t<u32>>(0); |
| 189 | |
| 190 | const auto res = manager->create<rsx::overlays::message_dialog>()->show(is_blocking, msgString.get_ptr(), _type, source, [callback, userData, &return_code, is_blocking, notify](s32 status) |
| 191 | { |
| 192 | if (is_blocking && return_code) |
| 193 | { |
| 194 | *return_code = status; |
| 195 | } |
| 196 | |
| 197 | sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_END, 0); |
| 198 | |
| 199 | if (callback) |
| 200 | { |
| 201 | sysutil_register_cb([=](ppu_thread& ppu) -> s32 |
| 202 | { |
| 203 | callback(ppu, status, userData); |
| 204 | return CELL_OK; |
| 205 | }); |
| 206 | } |
| 207 | |
| 208 | if (is_blocking && notify) |
| 209 | { |
| 210 | *notify = 1; |
| 211 | notify->notify_one(); |
| 212 | } |
| 213 | }); |
| 214 | |
| 215 | // Wait for on_close |
| 216 | while (is_blocking && !Emu.IsStopped() && !*notify) |
| 217 | { |
| 218 | notify->wait(false, atomic_wait_timeout{1'000'000}); |
| 219 | } |
| 220 | |
| 221 | return res; |
| 222 | } |
no test coverage detected