diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index a8bcf88895..be1ebe3982 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1423,13 +1423,13 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) no vm::temporary_unlock(*cpu); u32 pf_port_id = 0; - if (auto pf_entries = g_fxo->get(); true) + if (auto& pf_entries = g_fxo->get(); true) { if (auto mem = vm::get(vm::any, addr)) { - reader_lock lock(pf_entries->mutex); + reader_lock lock(pf_entries.mutex); - for (const auto& entry : pf_entries->entries) + for (const auto& entry : pf_entries.entries) { if (entry.start_addr == mem->addr) { @@ -1489,10 +1489,10 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) no // Now, place the page fault event onto table so that other functions [sys_mmapper_free_address and pagefault recovery funcs etc] // know that this thread is page faulted and where. - auto pf_events = g_fxo->get(); + auto& pf_events = g_fxo->get(); { - std::lock_guard pf_lock(pf_events->pf_mutex); - pf_events->events.emplace(cpu, addr); + std::lock_guard pf_lock(pf_events.pf_mutex); + pf_events.events.emplace(cpu, addr); } sig_log.warning("Page_fault %s location 0x%x because of %s memory", is_writing ? "writing" : "reading", diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index 9dab9762cf..0fbe0bc8dc 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -444,14 +444,14 @@ void cpu_thread::operator()() { case 1: { - //g_fxo->get()->registered.push(id); + //g_fxo->get().registered.push(id); break; } case 2: { if (g_cfg.core.spu_prof) { - g_fxo->get()->registered.push(id); + g_fxo->get().registered.push(id); } break; @@ -763,7 +763,7 @@ bool cpu_thread::check_state() noexcept { if (state0 & cpu_flag::dbg_pause) { - g_fxo->get()->pause_from(this); + g_fxo->get().pause_from(this); } cpu_wait(state1); @@ -1159,6 +1159,6 @@ void cpu_thread::flush_profilers() noexcept if (g_cfg.core.spu_prof || false) { - g_fxo->get()->registered.push(0); + g_fxo->get().registered.push(0); } } diff --git a/rpcs3/Emu/Cell/Modules/cellAudio.cpp b/rpcs3/Emu/Cell/Modules/cellAudio.cpp index 444b16aac6..88a6113cc6 100644 --- a/rpcs3/Emu/Cell/Modules/cellAudio.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAudio.cpp @@ -561,12 +561,12 @@ namespace audio void configure_audio() { - if (const auto g_audio = g_fxo->get()) + if (auto& g_audio = g_fxo->get(); g_fxo->is_init()) { // Only reboot the audio renderer if a relevant setting changed const auto new_raw = get_raw_config(); - if (const auto raw = g_audio->cfg.raw; + if (const auto raw = g_audio.cfg.raw; raw.desired_buffer_duration != new_raw.desired_buffer_duration || raw.buffering_enabled != new_raw.buffering_enabled || raw.time_stretching_threshold != new_raw.time_stretching_threshold || @@ -577,8 +577,8 @@ namespace audio raw.downmix != new_raw.downmix || raw.renderer != new_raw.renderer) { - g_audio->cfg.raw = new_raw; - g_audio->m_update_configuration = true; + g_audio.cfg.raw = new_raw; + g_audio.m_update_configuration = true; } } } @@ -1100,11 +1100,11 @@ error_code cellAudioInit() { cellAudio.warning("cellAudioInit()"); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::lock_guard lock(g_audio->mutex); + std::lock_guard lock(g_audio.mutex); - if (g_audio->init) + if (g_audio.init) { return CELL_AUDIO_ERROR_ALREADY_INIT; } @@ -1114,13 +1114,13 @@ error_code cellAudioInit() for (u32 i = 0; i < AUDIO_PORT_COUNT; i++) { - g_audio->ports[i].number = i; - g_audio->ports[i].addr = g_audio_buffer + AUDIO_PORT_OFFSET * i; - g_audio->ports[i].index = g_audio_indices + i; - g_audio->ports[i].state = audio_port_state::closed; + g_audio.ports[i].number = i; + g_audio.ports[i].addr = g_audio_buffer + AUDIO_PORT_OFFSET * i; + g_audio.ports[i].index = g_audio_indices + i; + g_audio.ports[i].state = audio_port_state::closed; } - g_audio->init = 1; + g_audio.init = 1; return CELL_OK; } @@ -1129,20 +1129,20 @@ error_code cellAudioQuit(ppu_thread& ppu) { cellAudio.warning("cellAudioQuit()"); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::lock_guard lock(g_audio->mutex); + std::lock_guard lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } // TODO - g_audio->keys.clear(); - g_audio->key_count = 0; - g_audio->event_period = 0; - g_audio->init = 0; + g_audio.keys.clear(); + g_audio.key_count = 0; + g_audio.event_period = 0; + g_audio.init = 0; return CELL_OK; } @@ -1151,11 +1151,11 @@ error_code cellAudioPortOpen(vm::ptr audioParam, vm::ptrget(); + auto& g_audio = g_fxo->get(); - std::lock_guard lock(g_audio->mutex); + std::lock_guard lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } @@ -1221,7 +1221,7 @@ error_code cellAudioPortOpen(vm::ptr audioParam, vm::ptropen_port(); + const auto port = g_audio.open_port(); if (!port) { @@ -1236,9 +1236,9 @@ error_code cellAudioPortOpen(vm::ptr audioParam, vm::ptrattr = attr; port->size = ::narrow(num_channels * num_blocks * port->block_size()); port->cur_pos = 0; - port->global_counter = g_audio->m_counter; + port->global_counter = g_audio.m_counter; port->active_counter = 0; - port->timestamp = g_audio->m_last_period_end; + port->timestamp = g_audio.m_last_period_end; if (attr & CELL_AUDIO_PORTATTR_INITLEVEL) { @@ -1264,11 +1264,11 @@ error_code cellAudioGetPortConfig(u32 portNum, vm::ptr port { cellAudio.trace("cellAudioGetPortConfig(portNum=%d, portConfig=*0x%x)", portNum, portConfig); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::lock_guard lock(g_audio->mutex); + std::lock_guard lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } @@ -1278,7 +1278,7 @@ error_code cellAudioGetPortConfig(u32 portNum, vm::ptr port return CELL_AUDIO_ERROR_PARAM; } - audio_port& port = g_audio->ports[portNum]; + audio_port& port = g_audio.ports[portNum]; portConfig->readIndexAddr = port.index; @@ -1309,11 +1309,11 @@ error_code cellAudioPortStart(u32 portNum) { cellAudio.warning("cellAudioPortStart(portNum=%d)", portNum); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::lock_guard lock(g_audio->mutex); + std::lock_guard lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } @@ -1323,7 +1323,7 @@ error_code cellAudioPortStart(u32 portNum) return CELL_AUDIO_ERROR_PARAM; } - switch (auto state = g_audio->ports[portNum].state.compare_and_swap(audio_port_state::opened, audio_port_state::started)) + switch (auto state = g_audio.ports[portNum].state.compare_and_swap(audio_port_state::opened, audio_port_state::started)) { case audio_port_state::closed: return CELL_AUDIO_ERROR_PORT_NOT_OPEN; case audio_port_state::started: return CELL_AUDIO_ERROR_PORT_ALREADY_RUN; @@ -1336,11 +1336,11 @@ error_code cellAudioPortClose(u32 portNum) { cellAudio.warning("cellAudioPortClose(portNum=%d)", portNum); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::lock_guard lock(g_audio->mutex); + std::lock_guard lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } @@ -1350,7 +1350,7 @@ error_code cellAudioPortClose(u32 portNum) return CELL_AUDIO_ERROR_PARAM; } - switch (auto state = g_audio->ports[portNum].state.exchange(audio_port_state::closed)) + switch (auto state = g_audio.ports[portNum].state.exchange(audio_port_state::closed)) { case audio_port_state::closed: return CELL_AUDIO_ERROR_PORT_NOT_OPEN; case audio_port_state::started: return CELL_OK; @@ -1363,11 +1363,11 @@ error_code cellAudioPortStop(u32 portNum) { cellAudio.warning("cellAudioPortStop(portNum=%d)", portNum); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::lock_guard lock(g_audio->mutex); + std::lock_guard lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } @@ -1377,7 +1377,7 @@ error_code cellAudioPortStop(u32 portNum) return CELL_AUDIO_ERROR_PARAM; } - switch (auto state = g_audio->ports[portNum].state.compare_and_swap(audio_port_state::started, audio_port_state::opened)) + switch (auto state = g_audio.ports[portNum].state.compare_and_swap(audio_port_state::started, audio_port_state::opened)) { case audio_port_state::closed: return CELL_AUDIO_ERROR_PORT_NOT_RUN; case audio_port_state::started: return CELL_OK; @@ -1390,11 +1390,11 @@ error_code cellAudioGetPortTimestamp(u32 portNum, u64 tag, vm::ptr stamp) { cellAudio.trace("cellAudioGetPortTimestamp(portNum=%d, tag=0x%llx, stamp=*0x%x)", portNum, tag, stamp); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::lock_guard lock(g_audio->mutex); + std::lock_guard lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } @@ -1404,7 +1404,7 @@ error_code cellAudioGetPortTimestamp(u32 portNum, u64 tag, vm::ptr stamp) return CELL_AUDIO_ERROR_PARAM; } - audio_port& port = g_audio->ports[portNum]; + audio_port& port = g_audio.ports[portNum]; if (port.state == audio_port_state::closed) { @@ -1417,7 +1417,7 @@ error_code cellAudioGetPortTimestamp(u32 portNum, u64 tag, vm::ptr stamp) } const u64 delta_tag = port.global_counter - tag; - const u64 delta_tag_stamp = delta_tag * g_audio->cfg.audio_block_period; + const u64 delta_tag_stamp = delta_tag * g_audio.cfg.audio_block_period; // Apparently no error is returned if stamp is null *stamp = port.timestamp - delta_tag_stamp; @@ -1429,11 +1429,11 @@ error_code cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, vm::ptr tag) { cellAudio.trace("cellAudioGetPortBlockTag(portNum=%d, blockNo=0x%llx, tag=*0x%x)", portNum, blockNo, tag); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::lock_guard lock(g_audio->mutex); + std::lock_guard lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } @@ -1443,7 +1443,7 @@ error_code cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, vm::ptr tag) return CELL_AUDIO_ERROR_PARAM; } - audio_port& port = g_audio->ports[portNum]; + audio_port& port = g_audio.ports[portNum]; if (port.state == audio_port_state::closed) { @@ -1465,11 +1465,11 @@ error_code cellAudioSetPortLevel(u32 portNum, float level) { cellAudio.trace("cellAudioSetPortLevel(portNum=%d, level=%f)", portNum, level); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::lock_guard lock(g_audio->mutex); + std::lock_guard lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } @@ -1479,7 +1479,7 @@ error_code cellAudioSetPortLevel(u32 portNum, float level) return CELL_AUDIO_ERROR_PARAM; } - audio_port& port = g_audio->ports[portNum]; + audio_port& port = g_audio.ports[portNum]; if (port.state == audio_port_state::closed) { @@ -1512,7 +1512,7 @@ static error_code AudioCreateNotifyEventQueue(ppu_thread& ppu, vm::ptr id, // This originally reads from a global sdk value set by cellAudioInit // So check initialization as well - const u32 queue_depth = g_fxo->get()->init && g_ps3_process_info.sdk_ver <= 0x35FFFF ? 2 : 8; + const u32 queue_depth = g_fxo->get().init && g_ps3_process_info.sdk_ver <= 0x35FFFF ? 2 : 8; if (CellError res{sys_event_queue_create(ppu, id, attr, key_value, queue_depth) + 0u}) { @@ -1553,11 +1553,11 @@ error_code cellAudioCreateNotifyEventQueueEx(ppu_thread& ppu, vm::ptr id, v error_code AudioSetNotifyEventQueue(u64 key, u32 iFlags) { - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::lock_guard lock(g_audio->mutex); + std::lock_guard lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } @@ -1569,7 +1569,7 @@ error_code AudioSetNotifyEventQueue(u64 key, u32 iFlags) return CELL_AUDIO_ERROR_TRANS_EVENT; } - for (auto i = g_audio->keys.cbegin(); i != g_audio->keys.cend();) // check for duplicates + for (auto i = g_audio.keys.cbegin(); i != g_audio.keys.cend();) // check for duplicates { auto port = i->port.lock(); @@ -1581,7 +1581,7 @@ error_code AudioSetNotifyEventQueue(u64 key, u32 iFlags) if (!lv2_event_queue::check(port)) { // Cleanup, avoid cases where there are multiple ports with the same key - i = g_audio->keys.erase(i); + i = g_audio.keys.erase(i); } else { @@ -1590,8 +1590,8 @@ error_code AudioSetNotifyEventQueue(u64 key, u32 iFlags) } // Set unique source associated with the key - g_audio->keys.push_back({g_audio->event_period, iFlags, ((process_getpid() + u64{}) << 32) + lv2_event_port::id_base + (g_audio->key_count++ * lv2_event_port::id_step), std::move(q)}); - g_audio->key_count %= lv2_event_port::id_count; + g_audio.keys.push_back({g_audio.event_period, iFlags, ((process_getpid() + u64{}) << 32) + lv2_event_port::id_base + (g_audio.key_count++ * lv2_event_port::id_step), std::move(q)}); + g_audio.key_count %= lv2_event_port::id_count; return CELL_OK; } @@ -1617,16 +1617,16 @@ error_code cellAudioSetNotifyEventQueueEx(u64 key, u32 iFlags) error_code AudioRemoveNotifyEventQueue(u64 key, u32 iFlags) { - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::lock_guard lock(g_audio->mutex); + std::lock_guard lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } - for (auto i = g_audio->keys.cbegin(); i != g_audio->keys.cend(); i++) + for (auto i = g_audio.keys.cbegin(); i != g_audio.keys.cend(); i++) { if ([&](auto port){ return lv2_event_queue::check(port) && port->key == key; }(i->port.lock())) { @@ -1635,7 +1635,7 @@ error_code AudioRemoveNotifyEventQueue(u64 key, u32 iFlags) break; } - g_audio->keys.erase(i); + g_audio.keys.erase(i); return CELL_OK; } @@ -1667,11 +1667,11 @@ error_code cellAudioAddData(u32 portNum, vm::ptr src, u32 samples, float { cellAudio.trace("cellAudioAddData(portNum=%d, src=*0x%x, samples=%d, volume=%f)", portNum, src, samples, volume); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::unique_lock lock(g_audio->mutex); + std::unique_lock lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } @@ -1681,7 +1681,7 @@ error_code cellAudioAddData(u32 portNum, vm::ptr src, u32 samples, float return CELL_AUDIO_ERROR_PARAM; } - const audio_port& port = g_audio->ports[portNum]; + const audio_port& port = g_audio.ports[portNum]; const auto dst = port.get_vm_ptr(); @@ -1701,11 +1701,11 @@ error_code cellAudioAdd2chData(u32 portNum, vm::ptr src, u32 samples, flo { cellAudio.trace("cellAudioAdd2chData(portNum=%d, src=*0x%x, samples=%d, volume=%f)", portNum, src, samples, volume); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::unique_lock lock(g_audio->mutex); + std::unique_lock lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } @@ -1715,7 +1715,7 @@ error_code cellAudioAdd2chData(u32 portNum, vm::ptr src, u32 samples, flo return CELL_AUDIO_ERROR_PARAM; } - const audio_port& port = g_audio->ports[portNum]; + const audio_port& port = g_audio.ports[portNum]; const auto dst = port.get_vm_ptr(); @@ -1769,11 +1769,11 @@ error_code cellAudioAdd6chData(u32 portNum, vm::ptr src, float volume) { cellAudio.trace("cellAudioAdd6chData(portNum=%d, src=*0x%x, volume=%f)", portNum, src, volume); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::unique_lock lock(g_audio->mutex); + std::unique_lock lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } @@ -1783,7 +1783,7 @@ error_code cellAudioAdd6chData(u32 portNum, vm::ptr src, float volume) return CELL_AUDIO_ERROR_PARAM; } - const audio_port& port = g_audio->ports[portNum]; + const audio_port& port = g_audio.ports[portNum]; const auto dst = port.get_vm_ptr(); @@ -1829,11 +1829,11 @@ error_code cellAudioMiscSetAccessoryVolume(u32 devNum, float volume) { cellAudio.todo("cellAudioMiscSetAccessoryVolume(devNum=%d, volume=%f)", devNum, volume); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::unique_lock lock(g_audio->mutex); + std::unique_lock lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } @@ -1853,11 +1853,11 @@ error_code cellAudioSetPersonalDevice(s32 iPersonalStream, s32 iDevice) { cellAudio.todo("cellAudioSetPersonalDevice(iPersonalStream=%d, iDevice=%d)", iPersonalStream, iDevice); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::unique_lock lock(g_audio->mutex); + std::unique_lock lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } @@ -1877,11 +1877,11 @@ error_code cellAudioUnsetPersonalDevice(s32 iPersonalStream) { cellAudio.todo("cellAudioUnsetPersonalDevice(iPersonalStream=%d)", iPersonalStream); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - std::unique_lock lock(g_audio->mutex); + std::unique_lock lock(g_audio.mutex); - if (!g_audio->init) + if (!g_audio.init) { return CELL_AUDIO_ERROR_NOT_INIT; } diff --git a/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp b/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp index b9e493269c..74bedd07aa 100644 --- a/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp @@ -175,12 +175,12 @@ error_code cellAudioInGetDeviceInfo(u32 deviceNumber, u32 deviceIndex, vm::ptrget(); + auto& av_manager = g_fxo->get(); - if (deviceNumber >= av_manager->devices.size()) + if (deviceNumber >= av_manager.devices.size()) return CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND; - av_manager->copy_device_info(deviceNumber, info); + av_manager.copy_device_info(deviceNumber, info); return CELL_OK; } @@ -201,8 +201,9 @@ error_code cellVideoOutGetGamma(u32 videoOut, vm::ptr gamma) return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; } - auto conf = g_fxo->get(); - *gamma = conf->gamma; + auto& conf = g_fxo->get(); + + *gamma = conf.gamma; return CELL_OK; } @@ -216,13 +217,13 @@ error_code cellAudioInGetAvailableDeviceInfo(u32 count, vm::ptrget(); + auto& av_manager = g_fxo->get(); - u32 num_devices_returned = std::min(count, ::size32(av_manager->devices)); + u32 num_devices_returned = std::min(count, ::size32(av_manager.devices)); for (u32 index = 0; index < num_devices_returned; index++) { - av_manager->copy_device_info(index, device_info + index); + av_manager.copy_device_info(index, device_info + index); } return not_an_error(num_devices_returned); @@ -248,8 +249,8 @@ error_code cellVideoOutSetGamma(u32 videoOut, f32 gamma) return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; } - auto conf = g_fxo->get(); - conf->gamma = gamma; + auto& conf = g_fxo->get(); + conf.gamma = gamma; return CELL_OK; } @@ -350,8 +351,8 @@ error_code cellVideoOutGetResolutionAvailability2() return CELL_OK; } -DECLARE(ppu_module_manager::cellAvconfExt) -("cellSysutilAvconfExt", []() { +DECLARE(ppu_module_manager::cellAvconfExt)("cellSysutilAvconfExt", []() +{ REG_FUNC(cellSysutilAvconfExt, cellAudioOutUnregisterDevice); REG_FUNC(cellSysutilAvconfExt, cellAudioOutGetDeviceInfo2); REG_FUNC(cellSysutilAvconfExt, cellVideoOutSetXVColor); diff --git a/rpcs3/Emu/Cell/Modules/cellCamera.cpp b/rpcs3/Emu/Cell/Modules/cellCamera.cpp index b7df2efd28..2cd1722a77 100644 --- a/rpcs3/Emu/Cell/Modules/cellCamera.cpp +++ b/rpcs3/Emu/Cell/Modules/cellCamera.cpp @@ -271,18 +271,18 @@ error_code cellCameraInit() cellCamera.todo("cellCameraInit()"); // Start camera thread - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - std::lock_guard lock(g_camera->mutex); + std::lock_guard lock(g_camera.mutex); - if (g_camera->init) + if (g_camera.init) { return CELL_CAMERA_ERROR_ALREADY_INIT; } if (g_cfg.io.camera == camera_handler::null) { - g_camera->init = 1; + g_camera.init = 1; return CELL_OK; } @@ -290,40 +290,40 @@ error_code cellCameraInit() { case fake_camera_type::eyetoy: { - g_camera->attr[CELL_CAMERA_SATURATION] = { 164 }; - g_camera->attr[CELL_CAMERA_BRIGHTNESS] = { 96 }; - g_camera->attr[CELL_CAMERA_AEC] = { 1 }; - g_camera->attr[CELL_CAMERA_AGC] = { 1 }; - g_camera->attr[CELL_CAMERA_AWB] = { 1 }; - g_camera->attr[CELL_CAMERA_ABC] = { 0 }; - g_camera->attr[CELL_CAMERA_LED] = { 1 }; - g_camera->attr[CELL_CAMERA_QS] = { 0 }; - g_camera->attr[CELL_CAMERA_NONZEROCOEFFS] = { 32, 32 }; - g_camera->attr[CELL_CAMERA_YUVFLAG] = { 0 }; - g_camera->attr[CELL_CAMERA_BACKLIGHTCOMP] = { 0 }; - g_camera->attr[CELL_CAMERA_MIRRORFLAG] = { 1 }; - g_camera->attr[CELL_CAMERA_422FLAG] = { 1 }; - g_camera->attr[CELL_CAMERA_USBLOAD] = { 4 }; + g_camera.attr[CELL_CAMERA_SATURATION] = { 164 }; + g_camera.attr[CELL_CAMERA_BRIGHTNESS] = { 96 }; + g_camera.attr[CELL_CAMERA_AEC] = { 1 }; + g_camera.attr[CELL_CAMERA_AGC] = { 1 }; + g_camera.attr[CELL_CAMERA_AWB] = { 1 }; + g_camera.attr[CELL_CAMERA_ABC] = { 0 }; + g_camera.attr[CELL_CAMERA_LED] = { 1 }; + g_camera.attr[CELL_CAMERA_QS] = { 0 }; + g_camera.attr[CELL_CAMERA_NONZEROCOEFFS] = { 32, 32 }; + g_camera.attr[CELL_CAMERA_YUVFLAG] = { 0 }; + g_camera.attr[CELL_CAMERA_BACKLIGHTCOMP] = { 0 }; + g_camera.attr[CELL_CAMERA_MIRRORFLAG] = { 1 }; + g_camera.attr[CELL_CAMERA_422FLAG] = { 1 }; + g_camera.attr[CELL_CAMERA_USBLOAD] = { 4 }; break; } case fake_camera_type::eyetoy2: { - g_camera->attr[CELL_CAMERA_SATURATION] = { 64 }; - g_camera->attr[CELL_CAMERA_BRIGHTNESS] = { 8 }; - g_camera->attr[CELL_CAMERA_AEC] = { 1 }; - g_camera->attr[CELL_CAMERA_AGC] = { 1 }; - g_camera->attr[CELL_CAMERA_AWB] = { 1 }; - g_camera->attr[CELL_CAMERA_LED] = { 1 }; - g_camera->attr[CELL_CAMERA_BACKLIGHTCOMP] = { 0 }; - g_camera->attr[CELL_CAMERA_MIRRORFLAG] = { 1 }; - g_camera->attr[CELL_CAMERA_GAMMA] = { 1 }; - g_camera->attr[CELL_CAMERA_AGCLIMIT] = { 4 }; - g_camera->attr[CELL_CAMERA_DENOISE] = { 0 }; - g_camera->attr[CELL_CAMERA_FRAMERATEADJUST] = { 0 }; - g_camera->attr[CELL_CAMERA_PIXELOUTLIERFILTER] = { 1 }; - g_camera->attr[CELL_CAMERA_AGCLOW] = { 48 }; - g_camera->attr[CELL_CAMERA_AGCHIGH] = { 64 }; + g_camera.attr[CELL_CAMERA_SATURATION] = { 64 }; + g_camera.attr[CELL_CAMERA_BRIGHTNESS] = { 8 }; + g_camera.attr[CELL_CAMERA_AEC] = { 1 }; + g_camera.attr[CELL_CAMERA_AGC] = { 1 }; + g_camera.attr[CELL_CAMERA_AWB] = { 1 }; + g_camera.attr[CELL_CAMERA_LED] = { 1 }; + g_camera.attr[CELL_CAMERA_BACKLIGHTCOMP] = { 0 }; + g_camera.attr[CELL_CAMERA_MIRRORFLAG] = { 1 }; + g_camera.attr[CELL_CAMERA_GAMMA] = { 1 }; + g_camera.attr[CELL_CAMERA_AGCLIMIT] = { 4 }; + g_camera.attr[CELL_CAMERA_DENOISE] = { 0 }; + g_camera.attr[CELL_CAMERA_FRAMERATEADJUST] = { 0 }; + g_camera.attr[CELL_CAMERA_PIXELOUTLIERFILTER] = { 1 }; + g_camera.attr[CELL_CAMERA_AGCLOW] = { 48 }; + g_camera.attr[CELL_CAMERA_AGCHIGH] = { 64 }; break; } default: @@ -334,10 +334,10 @@ error_code cellCameraInit() if (g_cfg.io.camera == camera_handler::fake) { - g_camera->is_attached = true; + g_camera.is_attached = true; } - g_camera->init = 1; + g_camera.init = 1; return CELL_OK; } @@ -345,11 +345,11 @@ error_code cellCameraEnd() { cellCamera.todo("cellCameraEnd()"); - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - std::lock_guard lock(g_camera->mutex); + std::lock_guard lock(g_camera.mutex); - if (!g_camera->init) + if (!g_camera.init) { return CELL_CAMERA_ERROR_NOT_INIT; } @@ -361,8 +361,8 @@ error_code cellCameraEnd() //} // TODO - g_camera->init = 0; - g_camera->reset_state(); + g_camera.init = 0; + g_camera.reset_state(); return CELL_OK; } @@ -413,10 +413,10 @@ error_code cellCameraOpenEx(s32 dev_num, vm::ptr info) return CELL_CAMERA_ERROR_PARAM; } - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); // we know g_camera is valid here (cellCameraSetAttribute above checks for it) - if (g_camera->is_open) + if (g_camera.is_open) { return CELL_CAMERA_ERROR_ALREADY_OPEN; } @@ -430,7 +430,7 @@ error_code cellCameraOpenEx(s32 dev_num, vm::ptr info) const auto vbuf_size = get_video_buffer_size(*info); - std::lock_guard lock(g_camera->mutex); + std::lock_guard lock(g_camera.mutex); if (info->read_mode != CELL_CAMERA_READ_DIRECT && !info->buffer) { @@ -440,8 +440,8 @@ error_code cellCameraOpenEx(s32 dev_num, vm::ptr info) std::tie(info->width, info->height) = get_video_resolution(*info); - g_camera->is_open = true; - g_camera->info = *info; + g_camera.is_open = true; + g_camera.info = *info; return CELL_OK; } @@ -461,9 +461,9 @@ error_code cellCameraClose(s32 dev_num) return CELL_CAMERA_ERROR_PARAM; } - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return CELL_CAMERA_ERROR_NOT_INIT; } @@ -473,15 +473,15 @@ error_code cellCameraClose(s32 dev_num) return not_an_error(CELL_CAMERA_ERROR_NOT_OPEN); } - std::lock_guard lock(g_camera->mutex); + std::lock_guard lock(g_camera.mutex); - if (!g_camera->is_open) + if (!g_camera.is_open) { return CELL_CAMERA_ERROR_NOT_OPEN; } - vm::dealloc(g_camera->info.buffer.addr(), vm::main); - g_camera->is_open = false; + vm::dealloc(g_camera.info.buffer.addr(), vm::main); + g_camera.is_open = false; return CELL_OK; } @@ -502,9 +502,9 @@ error_code cellCameraGetDeviceGUID(s32 dev_num, vm::ptr guid) { cellCamera.todo("cellCameraGetDeviceGUID(dev_num=%d, guid=*0x%x)", dev_num, guid); - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return CELL_CAMERA_ERROR_NOT_INIT; } @@ -520,9 +520,9 @@ error_code cellCameraGetType(s32 dev_num, vm::ptr type) { cellCamera.todo("cellCameraGetType(dev_num=%d, type=*0x%x)", dev_num, type); - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return CELL_CAMERA_ERROR_NOT_INIT; } @@ -537,7 +537,7 @@ error_code cellCameraGetType(s32 dev_num, vm::ptr type) return CELL_CAMERA_ERROR_PARAM; } - if (!g_camera->is_attached) + if (!g_camera.is_attached) { return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND; } @@ -562,9 +562,9 @@ s32 cellCameraIsAvailable(s32 dev_num) return false; } - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return false; } @@ -586,9 +586,9 @@ s32 cellCameraIsAttached(s32 dev_num) return false; } - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return false; } @@ -598,9 +598,9 @@ s32 cellCameraIsAttached(s32 dev_num) return false; } - std::lock_guard lock(g_camera->mutex); + std::lock_guard lock(g_camera.mutex); - bool is_attached = g_camera->is_attached; + bool is_attached = g_camera.is_attached; if (g_cfg.io.camera == camera_handler::fake) { @@ -608,8 +608,8 @@ s32 cellCameraIsAttached(s32 dev_num) // normally should be attached immediately after event queue is registered, but just to be sure if (!is_attached) { - g_camera->send_attach_state(true); - is_attached = g_camera->is_attached; + g_camera.send_attach_state(true); + is_attached = g_camera.is_attached; } } @@ -625,9 +625,9 @@ s32 cellCameraIsOpen(s32 dev_num) return false; } - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return false; } @@ -637,9 +637,9 @@ s32 cellCameraIsOpen(s32 dev_num) return false; } - std::lock_guard lock(g_camera->mutex); + std::lock_guard lock(g_camera.mutex); - return g_camera->is_open.load(); + return g_camera.is_open.load(); } s32 cellCameraIsStarted(s32 dev_num) @@ -651,9 +651,9 @@ s32 cellCameraIsStarted(s32 dev_num) return false; } - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return false; } @@ -663,9 +663,9 @@ s32 cellCameraIsStarted(s32 dev_num) return false; } - std::lock_guard lock(g_camera->mutex); + std::lock_guard lock(g_camera.mutex); - return g_camera->is_streaming.load(); + return g_camera.is_streaming.load(); } error_code cellCameraGetAttribute(s32 dev_num, s32 attrib, vm::ptr arg1, vm::ptr arg2) @@ -673,9 +673,9 @@ error_code cellCameraGetAttribute(s32 dev_num, s32 attrib, vm::ptr arg1, vm const auto attr_name = get_camera_attr_name(attrib); cellCamera.todo("cellCameraGetAttribute(dev_num=%d, attrib=%d=%s, arg1=*0x%x, arg2=*0x%x)", dev_num, attrib, attr_name, arg1, arg2); - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return CELL_CAMERA_ERROR_NOT_INIT; } @@ -691,25 +691,25 @@ error_code cellCameraGetAttribute(s32 dev_num, s32 attrib, vm::ptr arg1, vm } // actually compares <= 0x63 which is equivalent - if (attrib < CELL_CAMERA_FORMATCAP && !g_camera->is_open) + if (attrib < CELL_CAMERA_FORMATCAP && !g_camera.is_open) { return CELL_CAMERA_ERROR_NOT_OPEN; } - std::lock_guard lock(g_camera->mutex); + std::lock_guard lock(g_camera.mutex); - if (!g_camera->is_attached) + if (!g_camera.is_attached) { return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND; } if (arg1) { - *arg1 = g_camera->attr[attrib].v1; + *arg1 = g_camera.attr[attrib].v1; } if (arg2) { - *arg2 = g_camera->attr[attrib].v2; + *arg2 = g_camera.attr[attrib].v2; } return CELL_OK; @@ -720,9 +720,9 @@ error_code cellCameraSetAttribute(s32 dev_num, s32 attrib, u32 arg1, u32 arg2) const auto attr_name = get_camera_attr_name(attrib); cellCamera.todo("cellCameraSetAttribute(dev_num=%d, attrib=%d=%s, arg1=%d, arg2=%d)", dev_num, attrib, attr_name, arg1, arg2); - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return CELL_CAMERA_ERROR_NOT_INIT; } @@ -738,12 +738,12 @@ error_code cellCameraSetAttribute(s32 dev_num, s32 attrib, u32 arg1, u32 arg2) } // actually compares <= 0x63 which is equivalent - if (attrib < CELL_CAMERA_FORMATCAP && !g_camera->is_open) + if (attrib < CELL_CAMERA_FORMATCAP && !g_camera.is_open) { return CELL_CAMERA_ERROR_NOT_OPEN; } - g_camera->set_attr(attrib, arg1, arg2); + g_camera.set_attr(attrib, arg1, arg2); return CELL_OK; } @@ -758,9 +758,9 @@ error_code cellCameraGetBufferSize(s32 dev_num, vm::ptr info) { cellCamera.todo("cellCameraGetBufferSize(dev_num=%d, info=*0x%x)", dev_num, info); - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return CELL_CAMERA_ERROR_NOT_INIT; } @@ -777,7 +777,7 @@ error_code cellCameraGetBufferSize(s32 dev_num, vm::ptr info) return CELL_CAMERA_ERROR_PARAM; } - if (g_camera->is_open) + if (g_camera.is_open) { return CELL_CAMERA_ERROR_ALREADY_OPEN; } @@ -802,10 +802,10 @@ error_code cellCameraGetBufferSize(s32 dev_num, vm::ptr info) return status; } - std::lock_guard lock(g_camera->mutex); + std::lock_guard lock(g_camera.mutex); - info->bytesize = get_video_buffer_size(g_camera->info); - g_camera->info = *info; + info->bytesize = get_video_buffer_size(g_camera.info); + g_camera.info = *info; return info->bytesize; } @@ -825,9 +825,9 @@ error_code cellCameraGetBufferInfoEx(s32 dev_num, vm::ptr info // the following should be moved to cellCameraGetBufferInfo - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return CELL_CAMERA_ERROR_NOT_INIT; } @@ -842,7 +842,7 @@ error_code cellCameraGetBufferInfoEx(s32 dev_num, vm::ptr info return CELL_CAMERA_ERROR_PARAM; } - if (!g_camera->is_open) + if (!g_camera.is_open) { return CELL_CAMERA_ERROR_NOT_OPEN; } @@ -852,8 +852,8 @@ error_code cellCameraGetBufferInfoEx(s32 dev_num, vm::ptr info return CELL_CAMERA_ERROR_PARAM; } - std::lock_guard lock(g_camera->mutex); - *info = g_camera->info; + std::lock_guard lock(g_camera.mutex); + *info = g_camera.info; return CELL_OK; } @@ -899,9 +899,9 @@ error_code cellCameraReset(s32 dev_num) return CELL_CAMERA_ERROR_PARAM; } - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return CELL_CAMERA_ERROR_NOT_INIT; } @@ -911,12 +911,12 @@ error_code cellCameraReset(s32 dev_num) return not_an_error(CELL_CAMERA_ERROR_NOT_OPEN); } - if (!g_camera->is_open) + if (!g_camera.is_open) { return CELL_CAMERA_ERROR_NOT_OPEN; } - if (!g_camera->is_attached) + if (!g_camera.is_attached) { return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND; } @@ -947,9 +947,9 @@ error_code cellCameraStart(s32 dev_num) return CELL_CAMERA_ERROR_PARAM; } - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return CELL_CAMERA_ERROR_NOT_INIT; } @@ -959,20 +959,20 @@ error_code cellCameraStart(s32 dev_num) return not_an_error(CELL_CAMERA_ERROR_NOT_OPEN); } - std::lock_guard lock(g_camera->mutex); + std::lock_guard lock(g_camera.mutex); - if (!g_camera->is_open) + if (!g_camera.is_open) { return CELL_CAMERA_ERROR_NOT_OPEN; } - if (!g_camera->is_attached) + if (!g_camera.is_attached) { return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND; } - g_camera->timer.Start(); - g_camera->is_streaming = true; + g_camera.timer.Start(); + g_camera.is_streaming = true; return CELL_OK; } @@ -1023,9 +1023,9 @@ error_code cellCameraReadEx(s32 dev_num, vm::ptr read) { cellCamera.todo("cellCameraReadEx(dev_num=%d, read=0x%x)", dev_num, read); - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return CELL_CAMERA_ERROR_NOT_INIT; } @@ -1040,19 +1040,19 @@ error_code cellCameraReadEx(s32 dev_num, vm::ptr read) return CELL_CAMERA_ERROR_PARAM; } - std::lock_guard lock(g_camera->mutex); + std::lock_guard lock(g_camera.mutex); - if (!g_camera->is_open) + if (!g_camera.is_open) { return CELL_CAMERA_ERROR_NOT_OPEN; } - if (!g_camera->is_attached) + if (!g_camera.is_attached) { return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND; } - if (!g_camera->is_streaming) + if (!g_camera.is_streaming) { return CELL_CAMERA_ERROR_NOT_STARTED; } @@ -1061,13 +1061,13 @@ error_code cellCameraReadEx(s32 dev_num, vm::ptr read) if (read) // NULL returns CELL_OK { - read->timestamp = g_camera->timer.GetElapsedTimeInMicroSec(); - read->frame = g_camera->frame_num; - read->bytesread = g_camera->is_streaming ? get_video_buffer_size(g_camera->info) : 0; + read->timestamp = g_camera.timer.GetElapsedTimeInMicroSec(); + read->frame = g_camera.frame_num; + read->bytesread = g_camera.is_streaming ? get_video_buffer_size(g_camera.info) : 0; - auto shared_data = g_fxo->get(); + auto& shared_data = g_fxo->get(); - shared_data->frame_timestamp.exchange(read->timestamp); + shared_data.frame_timestamp.exchange(read->timestamp); } return CELL_OK; @@ -1089,9 +1089,9 @@ error_code cellCameraStop(s32 dev_num) return CELL_CAMERA_ERROR_PARAM; } - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return CELL_CAMERA_ERROR_NOT_INIT; } @@ -1101,25 +1101,25 @@ error_code cellCameraStop(s32 dev_num) return not_an_error(CELL_CAMERA_ERROR_NOT_OPEN); } - if (!g_camera->is_open) + if (!g_camera.is_open) { return CELL_CAMERA_ERROR_NOT_OPEN; } - if (!g_camera->is_attached) + if (!g_camera.is_attached) { return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND; } - if (!g_camera->is_streaming) + if (!g_camera.is_streaming) { return CELL_CAMERA_ERROR_NOT_STARTED; } - g_camera->is_streaming = false; + g_camera.is_streaming = false; - std::lock_guard lock(g_camera->mutex); - g_camera->timer.Stop(); + std::lock_guard lock(g_camera.mutex); + g_camera.timer.Stop(); return CELL_OK; } @@ -1140,9 +1140,9 @@ error_code cellCameraSetNotifyEventQueue(u64 key) { cellCamera.todo("cellCameraSetNotifyEventQueue(key=0x%x)", key); - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return CELL_CAMERA_ERROR_NOT_INIT; } @@ -1152,7 +1152,7 @@ error_code cellCameraSetNotifyEventQueue(u64 key) return CELL_OK; } - g_camera->add_queue(key, 0, 0); + g_camera.add_queue(key, 0, 0); return CELL_OK; } @@ -1161,9 +1161,9 @@ error_code cellCameraRemoveNotifyEventQueue(u64 key) { cellCamera.todo("cellCameraRemoveNotifyEventQueue(key=0x%x)", key); - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return CELL_CAMERA_ERROR_NOT_INIT; } @@ -1173,7 +1173,7 @@ error_code cellCameraRemoveNotifyEventQueue(u64 key) return CELL_OK; } - g_camera->remove_queue(key); + g_camera.remove_queue(key); return CELL_OK; } @@ -1187,14 +1187,14 @@ error_code cellCameraSetNotifyEventQueue2(u64 key, u64 source, u64 flag) return CELL_OK; } - const auto g_camera = g_fxo->get(); + auto& g_camera = g_fxo->get(); - if (!g_camera->init) + if (!g_camera.init) { return CELL_CAMERA_ERROR_NOT_INIT; } - g_camera->add_queue(key, source, flag); + g_camera.add_queue(key, source, flag); return CELL_OK; } diff --git a/rpcs3/Emu/Cell/Modules/cellFs.cpp b/rpcs3/Emu/Cell/Modules/cellFs.cpp index 28da3c317b..4bc12c36c2 100644 --- a/rpcs3/Emu/Cell/Modules/cellFs.cpp +++ b/rpcs3/Emu/Cell/Modules/cellFs.cpp @@ -967,16 +967,16 @@ s32 cellFsAioRead(vm::ptr aio, vm::ptr id, fs_aio_cb_t func) // TODO: detect mount point and send AIO request to the AIO thread of this mount point - const auto m = g_fxo->get(); + auto& m = g_fxo->get(); - if (!m) + if (!m.thread) { return CELL_ENXIO; } const s32 xid = (*id = ++g_fs_aio_id); - m->thread->cmd_list + m.thread->cmd_list ({ { 1, xid }, { aio, func }, @@ -991,16 +991,16 @@ s32 cellFsAioWrite(vm::ptr aio, vm::ptr id, fs_aio_cb_t func) // TODO: detect mount point and send AIO request to the AIO thread of this mount point - const auto m = g_fxo->get(); + auto& m = g_fxo->get(); - if (!m) + if (!m.thread) { return CELL_ENXIO; } const s32 xid = (*id = ++g_fs_aio_id); - m->thread->cmd_list + m.thread->cmd_list ({ { 2, xid }, { aio, func }, diff --git a/rpcs3/Emu/Cell/Modules/cellGame.cpp b/rpcs3/Emu/Cell/Modules/cellGame.cpp index 8c76949bfe..21dddcdd1a 100644 --- a/rpcs3/Emu/Cell/Modules/cellGame.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGame.cpp @@ -459,9 +459,9 @@ error_code cellGameBootCheck(vm::ptr type, vm::ptr attributes, vm::ptr return CELL_GAME_ERROR_PARAM; } - const auto perm = g_fxo->get(); + auto& perm = g_fxo->get(); - const auto init = perm->init.init(); + const auto init = perm.init.init(); if (!init) { @@ -510,10 +510,10 @@ error_code cellGameBootCheck(vm::ptr type, vm::ptr attributes, vm::ptr strcpy_trunc(*dirName, Emu.GetTitleID()); } - perm->dir = std::move(dir); - perm->sfo = std::move(sfo); - perm->restrict_sfo_params = *type == u32{CELL_GAME_GAMETYPE_HDD}; // Ratchet & Clank: All 4 One (PSN versions) rely on this error checking (TODO: Needs proper hw tests) - perm->exists = true; + perm.dir = std::move(dir); + perm.sfo = std::move(sfo); + perm.restrict_sfo_params = *type == u32{CELL_GAME_GAMETYPE_HDD}; // Ratchet & Clank: All 4 One (PSN versions) rely on this error checking (TODO: Needs proper hw tests) + perm.exists = true; return CELL_OK; } @@ -529,9 +529,9 @@ error_code cellGamePatchCheck(vm::ptr size, vm::ptr r psf::registry sfo = psf::load_object(fs::file(vfs::get(Emu.GetDir() + "PARAM.SFO"))); - const auto perm = g_fxo->get(); + auto& perm = g_fxo->get(); - const auto init = perm->init.init(); + const auto init = perm.init.init(); if (!init) { @@ -548,10 +548,10 @@ error_code cellGamePatchCheck(vm::ptr size, vm::ptr r size->sysSizeKB = 0; // TODO } - perm->restrict_sfo_params = false; - perm->dir = Emu.GetTitleID(); - perm->sfo = std::move(sfo); - perm->exists = true; + perm.restrict_sfo_params = false; + perm.dir = Emu.GetTitleID(); + perm.sfo = std::move(sfo); + perm.exists = true; return CELL_OK; } @@ -576,9 +576,9 @@ error_code cellGameDataCheck(u32 type, vm::cptr dirName, vm::ptrget(); + auto& perm = g_fxo->get(); - auto init = perm->init.init(); + auto init = perm.init.init(); if (!init) { @@ -615,14 +615,14 @@ error_code cellGameDataCheck(u32 type, vm::cptr dirName, vm::ptrsysSizeKB = 0; // TODO } - perm->dir = std::move(name); + perm.dir = std::move(name); if (type == CELL_GAME_GAMETYPE_GAMEDATA) { - perm->can_create = true; + perm.can_create = true; } - perm->restrict_sfo_params = false; + perm.restrict_sfo_params = false; if (sfo.empty()) { @@ -630,8 +630,8 @@ error_code cellGameDataCheck(u32 type, vm::cptr dirName, vm::ptrexists = true; - perm->sfo = std::move(sfo); + perm.exists = true; + perm.sfo = std::move(sfo); return CELL_OK; } @@ -644,55 +644,55 @@ error_code cellGameContentPermit(vm::ptr contentInfoPa return CELL_GAME_ERROR_PARAM; } - const auto perm = g_fxo->get(); + auto& perm = g_fxo->get(); - const auto init = perm->init.reset(); + const auto init = perm.init.reset(); if (!init) { return CELL_GAME_ERROR_FAILURE; } - const std::string dir = perm->dir.empty() ? "/dev_bdvd/PS3_GAME"s : "/dev_hdd0/game/" + perm->dir; + const std::string dir = perm.dir.empty() ? "/dev_bdvd/PS3_GAME"s : "/dev_hdd0/game/" + perm.dir; - if (perm->temp.empty() && !perm->exists) + if (perm.temp.empty() && !perm.exists) { - perm->reset(); + perm.reset(); strcpy_trunc(*contentInfoPath, ""); strcpy_trunc(*usrdirPath, ""); return CELL_OK; } - if (!perm->temp.empty()) + if (!perm.temp.empty()) { // Create PARAM.SFO - fs::pending_file temp(perm->temp + "/PARAM.SFO"); - temp.file.write(psf::save_object(perm->sfo)); + fs::pending_file temp(perm.temp + "/PARAM.SFO"); + temp.file.write(psf::save_object(perm.sfo)); ensure(temp.commit()); // Make temporary directory persistent (atomically) - if (vfs::host::rename(perm->temp, vfs::get(dir), &g_mp_sys_dev_hdd0, false)) + if (vfs::host::rename(perm.temp, vfs::get(dir), &g_mp_sys_dev_hdd0, false)) { cellGame.success("cellGameContentPermit(): directory '%s' has been created", dir); // Prevent cleanup - perm->temp.clear(); + perm.temp.clear(); } else { cellGame.error("cellGameContentPermit(): failed to initialize directory '%s' (%s)", dir, fs::g_tls_error); } } - else if (perm->can_create) + else if (perm.can_create) { // Update PARAM.SFO fs::pending_file temp(vfs::get(dir + "/PARAM.SFO")); - temp.file.write(psf::save_object(perm->sfo)); + temp.file.write(psf::save_object(perm.sfo)); ensure(temp.commit()); } // Cleanup - perm->reset(); + perm.reset(); strcpy_trunc(*contentInfoPath, dir); strcpy_trunc(*usrdirPath, dir + "/USRDIR"); @@ -883,21 +883,21 @@ error_code cellGameCreateGameData(vm::ptr init, vm::ptrget(); + auto& perm = g_fxo->get(); - const auto _init = prm->init.access(); + const auto _init = perm.init.access(); - if (!_init || prm->dir.empty()) + if (!_init || perm.dir.empty()) { return CELL_GAME_ERROR_FAILURE; } - if (!prm->can_create) + if (!perm.can_create) { return CELL_GAME_ERROR_NOTSUPPORTED; } - if (prm->exists) + if (perm.exists) { return CELL_GAME_ERROR_EXIST; } @@ -923,11 +923,11 @@ error_code cellGameCreateGameData(vm::ptr init, vm::ptrtemp = vfs::get(tmp_contentInfo); + perm.temp = vfs::get(tmp_contentInfo); cellGame.success("cellGameCreateGameData(): temporary directory '%s' has been created", tmp_contentInfo); // Initial PARAM.SFO parameters (overwrite) - prm->sfo = + perm.sfo = { { "CATEGORY", psf::string(3, "GD") }, { "TITLE_ID", psf::string(CELL_GAME_SYSP_TITLEID_SIZE, init->titleId) }, @@ -950,7 +950,7 @@ error_code cellGameDeleteGameData(vm::cptr dirName) const std::string name = dirName.get_ptr(); const std::string dir = vfs::get("/dev_hdd0/game/"s + name); - const auto prm = g_fxo->get(); + auto& perm = g_fxo->get(); auto remove_gd = [&]() -> error_code { @@ -990,16 +990,16 @@ error_code cellGameDeleteGameData(vm::cptr dirName) while (true) { // Obtain exclusive lock and cancel init - auto _init = prm->init.init(); + auto _init = perm.init.init(); if (!_init) { // Or access it - if (auto access = prm->init.access(); access) + if (auto access = perm.init.access(); access) { // Cannot remove it when it is accessed by cellGameDataCheck // If it is HG data then resort to remove_gd for ERROR_BROKEN - if (prm->dir == name && prm->can_create) + if (perm.dir == name && perm.can_create) { return CELL_GAME_ERROR_NOTSUPPORTED; } @@ -1028,9 +1028,9 @@ error_code cellGameGetParamInt(s32 id, vm::ptr value) return CELL_GAME_ERROR_PARAM; } - const auto prm = g_fxo->get(); + auto& perm = g_fxo->get(); - const auto init = prm->init.access(); + const auto init = perm.init.access(); if (!init) { @@ -1050,13 +1050,13 @@ error_code cellGameGetParamInt(s32 id, vm::ptr value) } } - if (!prm->sfo.count(key)) + if (!perm.sfo.count(key)) { // TODO: Check if special values need to be set here cellGame.warning("cellGameGetParamInt(): id=%d was not found", id); } - *value = psf::get_integer(prm->sfo, key, 0); + *value = psf::get_integer(perm.sfo, key, 0); return CELL_OK; } @@ -1122,9 +1122,9 @@ error_code cellGameGetParamString(s32 id, vm::ptr buf, u32 bufsize) return CELL_GAME_ERROR_PARAM; } - const auto prm = g_fxo->get(); + auto& perm = g_fxo->get(); - const auto init = prm->init.access(); + const auto init = perm.init.access(); if (!init) { @@ -1138,14 +1138,14 @@ error_code cellGameGetParamString(s32 id, vm::ptr buf, u32 bufsize) return CELL_GAME_ERROR_INVALID_ID; } - if (key.flags & strkey_flag::get && prm->restrict_sfo_params) + if (key.flags & strkey_flag::get && perm.restrict_sfo_params) { return CELL_GAME_ERROR_NOTSUPPORTED; } - const auto value = psf::get_string(prm->sfo, std::string(key.name)); + const auto value = psf::get_string(perm.sfo, std::string(key.name)); - if (value.empty() && !prm->sfo.count(std::string(key.name))) + if (value.empty() && !perm.sfo.count(std::string(key.name))) { // TODO: Check if special values need to be set here cellGame.warning("cellGameGetParamString(): id=%d was not found", id); @@ -1165,9 +1165,9 @@ error_code cellGameSetParamString(s32 id, vm::cptr buf) return CELL_GAME_ERROR_PARAM; } - const auto prm = g_fxo->get(); + auto& perm = g_fxo->get(); - const auto init = prm->init.access(); + const auto init = perm.init.access(); if (!init) { @@ -1181,12 +1181,12 @@ error_code cellGameSetParamString(s32 id, vm::cptr buf) return CELL_GAME_ERROR_INVALID_ID; } - if (!prm->can_create || key.flags & strkey_flag::read_only || (key.flags & strkey_flag::set && prm->restrict_sfo_params)) + if (!perm.can_create || key.flags & strkey_flag::read_only || (key.flags & strkey_flag::set && perm.restrict_sfo_params)) { return CELL_GAME_ERROR_NOTSUPPORTED; } - psf::assign(prm->sfo, std::string(key.name), psf::string(key.max_size, buf.get_ptr())); + psf::assign(perm.sfo, std::string(key.name), psf::string(key.max_size, buf.get_ptr())); return CELL_OK; } @@ -1203,16 +1203,16 @@ error_code cellGameGetSizeKB(vm::ptr size) // Always reset to 0 at start *size = 0; - const auto prm = g_fxo->get(); + auto& perm = g_fxo->get(); - const auto init = prm->init.access(); + const auto init = perm.init.access(); if (!init) { return CELL_GAME_ERROR_FAILURE; } - const std::string local_dir = !prm->temp.empty() ? prm->temp : vfs::get("/dev_hdd0/game/" + prm->dir); + const std::string local_dir = !perm.temp.empty() ? perm.temp : vfs::get("/dev_hdd0/game/" + perm.dir); const auto dirsz = fs::get_dir_size(local_dir, 1024); diff --git a/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp b/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp index 6fb0100365..9082637732 100644 --- a/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp @@ -100,7 +100,7 @@ error_code gcmMapEaIoAddress(ppu_thread& ppu, u32 ea, u32 io, u32 size, bool is_ u32 gcmIoOffsetToAddress(u32 ioOffset) { - const u32 upper12Bits = g_fxo->get()->offsetTable.eaAddress[ioOffset >> 20]; + const u32 upper12Bits = g_fxo->get().offsetTable.eaAddress[ioOffset >> 20]; if (upper12Bits > 0xBFF) { @@ -112,12 +112,12 @@ u32 gcmIoOffsetToAddress(u32 ioOffset) void InitOffsetTable() { - const auto cfg = g_fxo->get(); + auto& cfg = g_fxo->get(); const u32 addr = vm::alloc((3072 + 512) * sizeof(u16), vm::main); - cfg->offsetTable.ioAddress.set(addr); - cfg->offsetTable.eaAddress.set(addr + (3072 * sizeof(u16))); + cfg.offsetTable.ioAddress.set(addr); + cfg.offsetTable.eaAddress.set(addr + (3072 * sizeof(u16))); std::memset(vm::base(addr), 0xFF, (3072 + 512) * sizeof(u16)); } @@ -129,7 +129,7 @@ void InitOffsetTable() u32 cellGcmGetLabelAddress(u8 index) { cellGcmSys.trace("cellGcmGetLabelAddress(index=%d)", index); - return g_fxo->get()->gcm_info.label_addr + 0x10 * index; + return g_fxo->get().gcm_info.label_addr + 0x10 * index; } vm::ptr cellGcmGetReportDataAddressLocation(u32 index, u32 location) @@ -153,7 +153,7 @@ vm::ptr cellGcmGetReportDataAddressLocation(u32 index, u32 lo cellGcmSys.error("cellGcmGetReportDataAddressLocation: Wrong local index (%d)", index); } - return vm::cast(g_fxo->get()->gcm_info.label_addr + ::offset32(&RsxReports::report) + index * 0x10); + return vm::cast(g_fxo->get().gcm_info.label_addr + ::offset32(&RsxReports::report) + index * 0x10); } u64 cellGcmGetTimeStamp(u32 index) @@ -165,7 +165,7 @@ u64 cellGcmGetTimeStamp(u32 index) cellGcmSys.error("cellGcmGetTimeStamp: Wrong local index (%d)", index); } - return vm::read64(g_fxo->get()->gcm_info.label_addr + ::offset32(&RsxReports::report) + index * 0x10); + return vm::read64(g_fxo->get().gcm_info.label_addr + ::offset32(&RsxReports::report) + index * 0x10); } u32 cellGcmGetCurrentField() @@ -179,7 +179,7 @@ u32 cellGcmGetNotifyDataAddress(u32 index) cellGcmSys.warning("cellGcmGetNotifyDataAddress(index=%d)", index); // If entry not in use, return NULL - u16 entry = g_fxo->get()->offsetTable.eaAddress[241]; + u16 entry = g_fxo->get().offsetTable.eaAddress[241]; if (entry == 0xFFFF) { return 0; } @@ -192,7 +192,7 @@ u32 cellGcmGetNotifyDataAddress(u32 index) */ vm::ptr _cellGcmFunc12() { - return vm::ptr::make(g_fxo->get()->gcm_info.label_addr + ::offset32(&RsxReports::report)); // TODO + return vm::ptr::make(g_fxo->get().gcm_info.label_addr + ::offset32(&RsxReports::report)); // TODO } u32 cellGcmGetReport(u32 type, u32 index) @@ -221,7 +221,7 @@ u32 cellGcmGetReportDataAddress(u32 index) cellGcmSys.error("cellGcmGetReportDataAddress: Wrong local index (%d)", index); } - return g_fxo->get()->gcm_info.label_addr + ::offset32(&RsxReports::report) + index * 0x10; + return g_fxo->get().gcm_info.label_addr + ::offset32(&RsxReports::report) + index * 0x10; } u32 cellGcmGetReportDataLocation(u32 index, u32 location) @@ -247,19 +247,19 @@ u64 cellGcmGetTimeStampLocation(u32 index, u32 location) u32 cellGcmGetControlRegister() { cellGcmSys.trace("cellGcmGetControlRegister()"); - return g_fxo->get()->gcm_info.control_addr; + return g_fxo->get().gcm_info.control_addr; } u32 cellGcmGetDefaultCommandWordSize() { cellGcmSys.trace("cellGcmGetDefaultCommandWordSize()"); - return g_fxo->get()->gcm_info.command_size; + return g_fxo->get().gcm_info.command_size; } u32 cellGcmGetDefaultSegmentWordSize() { cellGcmSys.trace("cellGcmGetDefaultSegmentWordSize()"); - return g_fxo->get()->gcm_info.segment_size; + return g_fxo->get().gcm_info.segment_size; } error_code cellGcmInitDefaultFifoMode(s32 mode) @@ -310,7 +310,7 @@ error_code cellGcmBindZcull(u8 index, u32 offset, u32 width, u32 height, u32 cul void cellGcmGetConfiguration(vm::ptr config) { cellGcmSys.trace("cellGcmGetConfiguration(config=*0x%x)", config); - *config = g_fxo->get()->current_config; + *config = g_fxo->get().current_config; } u32 cellGcmGetFlipStatus() @@ -359,27 +359,27 @@ error_code _cellGcmInitBody(ppu_thread& ppu, vm::pptr contex { cellGcmSys.warning("_cellGcmInitBody(context=**0x%x, cmdSize=0x%x, ioSize=0x%x, ioAddress=0x%x)", context, cmdSize, ioSize, ioAddress); - const auto gcm_cfg = g_fxo->get(); - std::lock_guard lock(gcm_cfg->gcmio_mutex); + auto& gcm_cfg = g_fxo->get(); + std::lock_guard lock(gcm_cfg.gcmio_mutex); - gcm_cfg->current_config.ioAddress = 0; - gcm_cfg->current_config.localAddress = 0; - gcm_cfg->local_size = 0; - gcm_cfg->local_addr = 0; + gcm_cfg.current_config.ioAddress = 0; + gcm_cfg.current_config.localAddress = 0; + gcm_cfg.local_size = 0; + gcm_cfg.local_addr = 0; - //if (!gcm_cfg->local_size && !gcm_cfg->local_addr) + //if (!gcm_cfg.local_size && !gcm_cfg.local_addr) { - gcm_cfg->local_size = 0xf900000; // TODO: Get sdk_version in _cellGcmFunc15 and pass it to gcmGetLocalMemorySize - gcm_cfg->local_addr = rsx::constants::local_mem_base; - vm::falloc(gcm_cfg->local_addr, gcm_cfg->local_size, vm::video); + gcm_cfg.local_size = 0xf900000; // TODO: Get sdk_version in _cellGcmFunc15 and pass it to gcmGetLocalMemorySize + gcm_cfg.local_addr = rsx::constants::local_mem_base; + vm::falloc(gcm_cfg.local_addr, gcm_cfg.local_size, vm::video); } - cellGcmSys.warning("*** local memory(addr=0x%x, size=0x%x)", gcm_cfg->local_addr, gcm_cfg->local_size); + cellGcmSys.warning("*** local memory(addr=0x%x, size=0x%x)", gcm_cfg.local_addr, gcm_cfg.local_size); InitOffsetTable(); const auto render = rsx::get_current_renderer(); - if (gcm_cfg->system_mode == CELL_GCM_SYSTEM_MODE_IOMAP_512MB) + if (gcm_cfg.system_mode == CELL_GCM_SYSTEM_MODE_IOMAP_512MB) { cellGcmSys.warning("cellGcmInit(): 512MB io address space used"); render->main_mem_size = 0x20000000; @@ -395,12 +395,12 @@ error_code _cellGcmInitBody(ppu_thread& ppu, vm::pptr contex return CELL_GCM_ERROR_FAILURE; } - gcm_cfg->current_config.ioSize = ioSize; - gcm_cfg->current_config.ioAddress = ioAddress; - gcm_cfg->current_config.localSize = gcm_cfg->local_size; - gcm_cfg->current_config.localAddress = gcm_cfg->local_addr; - gcm_cfg->current_config.memoryFrequency = 650000000; - gcm_cfg->current_config.coreFrequency = 500000000; + gcm_cfg.current_config.ioSize = ioSize; + gcm_cfg.current_config.ioAddress = ioAddress; + gcm_cfg.current_config.localSize = gcm_cfg.local_size; + gcm_cfg.current_config.localAddress = gcm_cfg.local_addr; + gcm_cfg.current_config.memoryFrequency = 650000000; + gcm_cfg.current_config.coreFrequency = 500000000; // Create contexts const auto area = vm::reserve_map(vm::rsx_context, 0, 0x10000000, 0x403); @@ -410,26 +410,26 @@ error_code _cellGcmInitBody(ppu_thread& ppu, vm::pptr contex g_defaultCommandBufferBegin = ioAddress; g_defaultCommandBufferFragmentCount = cmdSize / (32 * 1024); - gcm_cfg->gcm_info.context_addr = rsx_ctxaddr; - gcm_cfg->gcm_info.control_addr = rsx_ctxaddr + 0x100000; - gcm_cfg->gcm_info.label_addr = rsx_ctxaddr + 0x300000; + gcm_cfg.gcm_info.context_addr = rsx_ctxaddr; + gcm_cfg.gcm_info.control_addr = rsx_ctxaddr + 0x100000; + gcm_cfg.gcm_info.label_addr = rsx_ctxaddr + 0x300000; - gcm_cfg->current_context.begin.set(g_defaultCommandBufferBegin + 4096); // 4 kb reserved at the beginning - gcm_cfg->current_context.end.set(g_defaultCommandBufferBegin + 32 * 1024 - 4); // 4b at the end for jump - gcm_cfg->current_context.current = gcm_cfg->current_context.begin; - gcm_cfg->current_context.callback.set(ppu_function_manager::func_addr(FIND_FUNC(cellGcmCallback))); + gcm_cfg.current_context.begin.set(g_defaultCommandBufferBegin + 4096); // 4 kb reserved at the beginning + gcm_cfg.current_context.end.set(g_defaultCommandBufferBegin + 32 * 1024 - 4); // 4b at the end for jump + gcm_cfg.current_context.current = gcm_cfg.current_context.begin; + gcm_cfg.current_context.callback.set(ppu_function_manager::func_addr(FIND_FUNC(cellGcmCallback))); - gcm_cfg->ctxt_addr = context.addr(); - gcm_cfg->gcm_buffers.set(vm::alloc(sizeof(CellGcmDisplayInfo) * 8, vm::main)); - gcm_cfg->zculls_addr = vm::alloc(sizeof(CellGcmZcullInfo) * 8, vm::main); - gcm_cfg->tiles_addr = vm::alloc(sizeof(CellGcmTileInfo) * 15, vm::main); + gcm_cfg.ctxt_addr = context.addr(); + gcm_cfg.gcm_buffers.set(vm::alloc(sizeof(CellGcmDisplayInfo) * 8, vm::main)); + gcm_cfg.zculls_addr = vm::alloc(sizeof(CellGcmZcullInfo) * 8, vm::main); + gcm_cfg.tiles_addr = vm::alloc(sizeof(CellGcmTileInfo) * 15, vm::main); - vm::_ref(gcm_cfg->gcm_info.context_addr) = gcm_cfg->current_context; - context->set(gcm_cfg->gcm_info.context_addr); + vm::_ref(gcm_cfg.gcm_info.context_addr) = gcm_cfg.current_context; + context->set(gcm_cfg.gcm_info.context_addr); // 0x40 is to offset CellGcmControl from RsxDmaControl - gcm_cfg->gcm_info.control_addr += 0x40; - auto& ctrl = vm::_ref(gcm_cfg->gcm_info.control_addr); + gcm_cfg.gcm_info.control_addr += 0x40; + auto& ctrl = vm::_ref(gcm_cfg.gcm_info.control_addr); ctrl.put = 0; ctrl.get = 0; ctrl.ref = 0; // Set later to -1 at RSX initialization @@ -440,10 +440,10 @@ error_code _cellGcmInitBody(ppu_thread& ppu, vm::pptr contex render->intr_thread = idm::get>(static_cast(*_tid)); render->intr_thread->state -= cpu_flag::stop; render->isHLE = true; - render->label_addr = gcm_cfg->gcm_info.label_addr; - render->device_addr = gcm_cfg->gcm_info.context_addr; - render->local_mem_size = gcm_cfg->local_size; - render->init(gcm_cfg->gcm_info.control_addr - 0x40); + render->label_addr = gcm_cfg.gcm_info.label_addr; + render->device_addr = gcm_cfg.gcm_info.context_addr; + render->local_mem_size = gcm_cfg.local_size; + render->init(gcm_cfg.gcm_info.control_addr - 0x40); return CELL_OK; } @@ -482,7 +482,7 @@ error_code cellGcmSetDisplayBuffer(u8 id, u32 offset, u32 pitch, u32 width, u32 { cellGcmSys.trace("cellGcmSetDisplayBuffer(id=0x%x, offset=0x%x, pitch=%d, width=%d, height=%d)", id, offset, width ? pitch / width : pitch, width, height); - const auto gcm_cfg = g_fxo->get(); + auto& gcm_cfg = g_fxo->get(); if (id > 7) { @@ -498,10 +498,10 @@ error_code cellGcmSetDisplayBuffer(u8 id, u32 offset, u32 pitch, u32 width, u32 buffers[id].width = width; buffers[id].height = height; - gcm_cfg->gcm_buffers[id].offset = offset; - gcm_cfg->gcm_buffers[id].pitch = pitch; - gcm_cfg->gcm_buffers[id].width = width; - gcm_cfg->gcm_buffers[id].height = height; + gcm_cfg.gcm_buffers[id].offset = offset; + gcm_cfg.gcm_buffers[id].pitch = pitch; + gcm_cfg.gcm_buffers[id].width = width; + gcm_cfg.gcm_buffers[id].height = height; if (id + 1u > render->display_buffers_count) { @@ -553,7 +553,7 @@ error_code cellGcmSetFlipStatus2() template > ret_type gcmSetPrepareFlip(ppu_thread& ppu, vm::ptr ctxt, u32 id) { - const auto gcm_cfg = g_fxo->get(); + auto& gcm_cfg = g_fxo->get(); if (id > 7) { @@ -571,9 +571,9 @@ ret_type gcmSetPrepareFlip(ppu_thread& ppu, vm::ptr ctxt, u3 const u32 cmd_size = rsx::make_command(ctxt->current, GCM_FLIP_COMMAND, { id }); - if (!old_api && ctxt.addr() == gcm_cfg->gcm_info.context_addr) + if (!old_api && ctxt.addr() == gcm_cfg.gcm_info.context_addr) { - vm::_ref(gcm_cfg->gcm_info.control_addr).put += cmd_size; + vm::_ref(gcm_cfg.gcm_info.control_addr).put += cmd_size; } return static_cast(not_an_error(id)); @@ -623,7 +623,7 @@ error_code cellGcmSetTileInfo(u8 index, u8 location, u32 offset, u32 size, u32 p cellGcmSys.warning("cellGcmSetTileInfo(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)", index, location, offset, size, pitch, comp, base, bank); - const auto gcm_cfg = g_fxo->get(); + auto& gcm_cfg = g_fxo->get(); if (index >= rsx::limits::tiles_count || base >= 2048 || bank >= 4) { @@ -656,7 +656,7 @@ error_code cellGcmSetTileInfo(u8 index, u8 location, u32 offset, u32 size, u32 p tile.base = base; tile.bank = bank; - vm::_ptr(gcm_cfg->tiles_addr)[index] = tile.pack(); + vm::_ptr(gcm_cfg.tiles_addr)[index] = tile.pack(); return CELL_OK; } @@ -698,7 +698,7 @@ void cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart, cellGcmSys.todo("cellGcmSetZcull(index=%d, offset=0x%x, width=%d, height=%d, cullStart=0x%x, zFormat=0x%x, aaFormat=0x%x, zCullDir=0x%x, zCullFormat=0x%x, sFunc=0x%x, sRef=0x%x, sMask=0x%x)", index, offset, width, height, cullStart, zFormat, aaFormat, zCullDir, zCullFormat, sFunc, sRef, sMask); - const auto gcm_cfg = g_fxo->get(); + auto& gcm_cfg = g_fxo->get(); if (index >= rsx::limits::zculls_count) { @@ -722,7 +722,7 @@ void cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart, zcull.sMask = sMask; zcull.bound = (zCullFormat > 0); - vm::_ptr(gcm_cfg->zculls_addr)[index] = zcull.pack(); + vm::_ptr(gcm_cfg.zculls_addr)[index] = zcull.pack(); } error_code cellGcmUnbindTile(u8 index) @@ -756,19 +756,19 @@ error_code cellGcmUnbindZcull(u8 index) u32 cellGcmGetTileInfo() { cellGcmSys.warning("cellGcmGetTileInfo()"); - return g_fxo->get()->tiles_addr; + return g_fxo->get().tiles_addr; } u32 cellGcmGetZcullInfo() { cellGcmSys.warning("cellGcmGetZcullInfo()"); - return g_fxo->get()->zculls_addr; + return g_fxo->get().zculls_addr; } u32 cellGcmGetDisplayInfo() { cellGcmSys.warning("cellGcmGetDisplayInfo()"); - return g_fxo->get()->gcm_buffers.addr(); + return g_fxo->get().gcm_buffers.addr(); } error_code cellGcmGetCurrentDisplayBufferId(vm::ptr id) @@ -848,7 +848,7 @@ error_code cellGcmInitSystemMode(u64 mode) { cellGcmSys.trace("cellGcmInitSystemMode(mode=0x%x)", mode); - g_fxo->get()->system_mode = mode; + g_fxo->get().system_mode = mode; return CELL_OK; } @@ -907,19 +907,19 @@ error_code cellGcmAddressToOffset(u32 address, vm::ptr offset) { cellGcmSys.trace("cellGcmAddressToOffset(address=0x%x, offset=*0x%x)", address, offset); - const auto cfg = g_fxo->get(); + auto& gcm_cfg = g_fxo->get(); u32 result; // Test if address is within local memory - if (const u32 offs = address - cfg->local_addr; offs < cfg->local_size) + if (const u32 offs = address - gcm_cfg.local_addr; offs < gcm_cfg.local_size) { result = offs; } // Address in main memory else check else { - const u32 upper12Bits = cfg->offsetTable.ioAddress[address >> 20]; + const u32 upper12Bits = gcm_cfg.offsetTable.ioAddress[address >> 20]; // If the address is mapped in IO if (upper12Bits << 20 < rsx::get_current_renderer()->main_mem_size) @@ -940,17 +940,17 @@ u32 cellGcmGetMaxIoMapSize() { cellGcmSys.trace("cellGcmGetMaxIoMapSize()"); - return rsx::get_current_renderer()->main_mem_size - g_fxo->get()->reserved_size; + return rsx::get_current_renderer()->main_mem_size - g_fxo->get().reserved_size; } void cellGcmGetOffsetTable(vm::ptr table) { cellGcmSys.trace("cellGcmGetOffsetTable(table=*0x%x)", table); - const auto cfg = g_fxo->get(); + auto& gcm_cfg = g_fxo->get(); - table->ioAddress = cfg->offsetTable.ioAddress; - table->eaAddress = cfg->offsetTable.eaAddress; + table->ioAddress = gcm_cfg.offsetTable.ioAddress; + table->eaAddress = gcm_cfg.offsetTable.eaAddress; } error_code cellGcmIoOffsetToAddress(u32 ioOffset, vm::ptr address) @@ -982,17 +982,17 @@ error_code gcmMapEaIoAddress(ppu_thread& ppu, u32 ea, u32 io, u32 size, bool is_ } // Assume lock is acquired - const auto cfg = g_fxo->get(); + auto& gcm_cfg = g_fxo->get(); ea >>= 20, io >>= 20, size >>= 20; // Fill the offset table for (u32 i = 0; i < size; i++) { - cfg->offsetTable.ioAddress[ea + i] = io + i; - cfg->offsetTable.eaAddress[io + i] = ea + i; + gcm_cfg.offsetTable.ioAddress[ea + i] = io + i; + gcm_cfg.offsetTable.eaAddress[io + i] = ea + i; } - cfg->IoMapTable[ea] = size; + gcm_cfg.IoMapTable[ea] = size; return CELL_OK; } @@ -1000,8 +1000,8 @@ error_code cellGcmMapEaIoAddress(ppu_thread& ppu, u32 ea, u32 io, u32 size) { cellGcmSys.warning("cellGcmMapEaIoAddress(ea=0x%x, io=0x%x, size=0x%x)", ea, io, size); - const auto cfg = g_fxo->get(); - std::lock_guard lock(cfg->gcmio_mutex); + auto& gcm_cfg = g_fxo->get(); + std::lock_guard lock(gcm_cfg.gcmio_mutex); return gcmMapEaIoAddress(ppu, ea, io, size, false); } @@ -1012,8 +1012,8 @@ error_code cellGcmMapEaIoAddressWithFlags(ppu_thread& ppu, u32 ea, u32 io, u32 s ensure(flags == 2 /*CELL_GCM_IOMAP_FLAG_STRICT_ORDERING*/); - const auto cfg = g_fxo->get(); - std::lock_guard lock(cfg->gcmio_mutex); + auto& gcm_cfg = g_fxo->get(); + std::lock_guard lock(gcm_cfg.gcmio_mutex); return gcmMapEaIoAddress(ppu, ea, io, size, true); } @@ -1022,13 +1022,13 @@ error_code cellGcmMapLocalMemory(vm::ptr address, vm::ptr size) { cellGcmSys.warning("cellGcmMapLocalMemory(address=*0x%x, size=*0x%x)", address, size); - const auto cfg = g_fxo->get(); - std::lock_guard lock(cfg->gcmio_mutex); + auto& gcm_cfg = g_fxo->get(); + std::lock_guard lock(gcm_cfg.gcmio_mutex); - if (!cfg->local_addr && !cfg->local_size && vm::falloc(cfg->local_addr = rsx::constants::local_mem_base, cfg->local_size = 0xf900000 /* TODO */, vm::video)) + if (!gcm_cfg.local_addr && !gcm_cfg.local_size && vm::falloc(gcm_cfg.local_addr = rsx::constants::local_mem_base, gcm_cfg.local_size = 0xf900000 /* TODO */, vm::video)) { - *address = cfg->local_addr; - *size = cfg->local_size; + *address = gcm_cfg.local_addr; + *size = gcm_cfg.local_size; return CELL_OK; } @@ -1041,13 +1041,13 @@ error_code cellGcmMapMainMemory(ppu_thread& ppu, u32 ea, u32 size, vm::ptr if (!size || (ea & 0xFFFFF) || (size & 0xFFFFF)) return CELL_GCM_ERROR_FAILURE; - const auto cfg = g_fxo->get(); - std::lock_guard lock(cfg->gcmio_mutex); + auto& gcm_cfg = g_fxo->get(); + std::lock_guard lock(gcm_cfg.gcmio_mutex); // Use the offset table to find the next free io address - for (u32 io = 0, end = (rsx::get_current_renderer()->main_mem_size - cfg->reserved_size) >> 20, unmap_count = 1; io < end; unmap_count++) + for (u32 io = 0, end = (rsx::get_current_renderer()->main_mem_size - gcm_cfg.reserved_size) >> 20, unmap_count = 1; io < end; unmap_count++) { - if (cfg->offsetTable.eaAddress[io + unmap_count - 1] > 0xBFF) + if (gcm_cfg.offsetTable.eaAddress[io + unmap_count - 1] > 0xBFF) { if (unmap_count >= (size >> 20)) { @@ -1081,21 +1081,21 @@ error_code cellGcmReserveIoMapSize(u32 size) return CELL_GCM_ERROR_INVALID_ALIGNMENT; } - const auto cfg = g_fxo->get(); - std::lock_guard lock(cfg->gcmio_mutex); + auto& gcm_cfg = g_fxo->get(); + std::lock_guard lock(gcm_cfg.gcmio_mutex); if (size > cellGcmGetMaxIoMapSize()) { return CELL_GCM_ERROR_INVALID_VALUE; } - cfg->reserved_size += size; + gcm_cfg.reserved_size += size; return CELL_OK; } -error_code GcmUnmapIoAddress(ppu_thread& ppu, gcm_config* cfg, u32 io) +error_code GcmUnmapIoAddress(ppu_thread& ppu, gcm_config& gcm_cfg, u32 io) { - if (u32 ea = cfg->offsetTable.eaAddress[io >>= 20], size = cfg->IoMapTable[ea]; size) + if (u32 ea = gcm_cfg.offsetTable.eaAddress[io >>= 20], size = gcm_cfg.IoMapTable[ea]; size) { if (auto error = sys_rsx_context_iounmap(ppu, 0x55555555, io << 20, size << 20)) { @@ -1104,11 +1104,11 @@ error_code GcmUnmapIoAddress(ppu_thread& ppu, gcm_config* cfg, u32 io) for (u32 i = 0; i < size; i++) { - cfg->offsetTable.ioAddress[ea + i] = 0xFFFF; - cfg->offsetTable.eaAddress[io + i] = 0xFFFF; + gcm_cfg.offsetTable.ioAddress[ea + i] = 0xFFFF; + gcm_cfg.offsetTable.eaAddress[io + i] = 0xFFFF; } - cfg->IoMapTable[ea] = 0; + gcm_cfg.IoMapTable[ea] = 0; return CELL_OK; } @@ -1127,13 +1127,13 @@ error_code cellGcmUnmapEaIoAddress(ppu_thread& ppu, u32 ea) return CELL_GCM_ERROR_FAILURE; } - const auto cfg = g_fxo->get(); - std::lock_guard lock(cfg->gcmio_mutex); + auto& gcm_cfg = g_fxo->get(); + std::lock_guard lock(gcm_cfg.gcmio_mutex); - if (const u32 io = cfg->offsetTable.ioAddress[ea] << 20; + if (const u32 io = gcm_cfg.offsetTable.ioAddress[ea] << 20; io < rsx::get_current_renderer()->main_mem_size) { - return GcmUnmapIoAddress(ppu, cfg, io); + return GcmUnmapIoAddress(ppu, gcm_cfg, io); } return CELL_GCM_ERROR_FAILURE; @@ -1143,10 +1143,10 @@ error_code cellGcmUnmapIoAddress(ppu_thread& ppu, u32 io) { cellGcmSys.warning("cellGcmUnmapIoAddress(io=0x%x)", io); - const auto cfg = g_fxo->get(); - std::lock_guard lock(cfg->gcmio_mutex); + auto& gcm_cfg = g_fxo->get(); + std::lock_guard lock(gcm_cfg.gcmio_mutex); - return GcmUnmapIoAddress(ppu, cfg, io); + return GcmUnmapIoAddress(ppu, gcm_cfg, io); } error_code cellGcmUnreserveIoMapSize(u32 size) @@ -1158,15 +1158,15 @@ error_code cellGcmUnreserveIoMapSize(u32 size) return CELL_GCM_ERROR_INVALID_ALIGNMENT; } - const auto cfg = g_fxo->get(); - std::lock_guard lock(cfg->gcmio_mutex); + auto& gcm_cfg = g_fxo->get(); + std::lock_guard lock(gcm_cfg.gcmio_mutex); - if (size > cfg->reserved_size) + if (size > gcm_cfg.reserved_size) { return CELL_GCM_ERROR_INVALID_VALUE; } - cfg->reserved_size -= size; + gcm_cfg.reserved_size -= size; return CELL_OK; } @@ -1218,27 +1218,27 @@ void cellGcmSetDefaultCommandBuffer() { cellGcmSys.warning("cellGcmSetDefaultCommandBuffer()"); - const auto gcm_cfg = g_fxo->get(); + auto& gcm_cfg = g_fxo->get(); - vm::write32(gcm_cfg->ctxt_addr, gcm_cfg->gcm_info.context_addr); + vm::write32(gcm_cfg.ctxt_addr, gcm_cfg.gcm_info.context_addr); } error_code cellGcmSetDefaultCommandBufferAndSegmentWordSize(u32 bufferSize, u32 segmentSize) { cellGcmSys.warning("cellGcmSetDefaultCommandBufferAndSegmentWordSize(bufferSize=0x%x, segmentSize=0x%x)", bufferSize, segmentSize); - const auto gcm_cfg = g_fxo->get(); + auto& gcm_cfg = g_fxo->get(); - const auto& put = vm::_ref(gcm_cfg->gcm_info.control_addr).put; - const auto& get = vm::_ref(gcm_cfg->gcm_info.control_addr).get; + const auto& put = vm::_ref(gcm_cfg.gcm_info.control_addr).put; + const auto& get = vm::_ref(gcm_cfg.gcm_info.control_addr).get; if (put != 0x1000 || get != 0x1000 || bufferSize < segmentSize * 2 || segmentSize >= 0x80000000) { return CELL_GCM_ERROR_FAILURE; } - gcm_cfg->gcm_info.command_size = bufferSize; - gcm_cfg->gcm_info.segment_size = segmentSize; + gcm_cfg.gcm_info.command_size = bufferSize; + gcm_cfg.gcm_info.segment_size = segmentSize; return CELL_OK; } @@ -1268,7 +1268,7 @@ void _cellGcmSetFlipCommandWithWaitLabel(ppu_thread& ppu, vm::ptrget(); + auto& gcm_cfg = g_fxo->get(); if (auto error = gcmSetPrepareFlip(ppu, ctx, id); error < 0) { @@ -1277,7 +1277,7 @@ void _cellGcmSetFlipCommandWithWaitLabel(ppu_thread& ppu, vm::ptrgcm_info.label_addr + 0x10 * label_index, label_value); + vm::write32(gcm_cfg.gcm_info.label_addr + 0x10 * label_index, label_value); } error_code cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 comp, u16 base, u8 bank) @@ -1285,7 +1285,7 @@ error_code cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch cellGcmSys.warning("cellGcmSetTile(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)", index, location, offset, size, pitch, comp, base, bank); - const auto gcm_cfg = g_fxo->get(); + auto& gcm_cfg = g_fxo->get(); // Copied form cellGcmSetTileInfo if (index >= rsx::limits::tiles_count || base >= 2048 || bank >= 4) @@ -1320,7 +1320,7 @@ error_code cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch tile.bank = bank; tile.bound = (pitch > 0); - vm::_ptr(gcm_cfg->tiles_addr)[index] = tile.pack(); + vm::_ptr(gcm_cfg.tiles_addr)[index] = tile.pack(); return CELL_OK; } @@ -1391,7 +1391,7 @@ static std::pair getNextCommandBufferBeginEnd(u32 current) static u32 getOffsetFromAddress(u32 address) { - const u32 upper = g_fxo->get()->offsetTable.ioAddress[address >> 20]; // 12 bits + const u32 upper = g_fxo->get().offsetTable.ioAddress[address >> 20]; // 12 bits ensure(upper != 0xFFFF); return (upper << 20) | (address & 0xFFFFF); } @@ -1418,9 +1418,9 @@ s32 cellGcmCallback(ppu_thread& ppu, vm::ptr context, u32 co { cellGcmSys.trace("cellGcmCallback(context=*0x%x, count=0x%x)", context, count); - const auto gcm_cfg = g_fxo->get(); + auto& gcm_cfg = g_fxo->get(); - auto& ctrl = vm::_ref(gcm_cfg->gcm_info.control_addr); + auto& ctrl = vm::_ref(gcm_cfg.gcm_info.control_addr); // Flush command buffer (ie allow RSX to read up to context->current) ctrl.put.exchange(getOffsetFromAddress(context->current.addr())); diff --git a/rpcs3/Emu/Cell/Modules/cellGem.cpp b/rpcs3/Emu/Cell/Modules/cellGem.cpp index c4f8fd9a3d..ba38af1a2e 100644 --- a/rpcs3/Emu/Cell/Modules/cellGem.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGem.cpp @@ -274,16 +274,16 @@ static bool ds3_input_to_ext(const u32 port_no, CellGemExtPortData& ext) */ static bool mouse_input_to_pad(const u32 mouse_no, be_t& digital_buttons, be_t& analog_t) { - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - std::scoped_lock lock(handler->mutex); + std::scoped_lock lock(handler.mutex); - if (mouse_no >= handler->GetMice().size()) + if (mouse_no >= handler.GetMice().size()) { return false; } - const auto& mouse_data = handler->GetMice().at(0); + const auto& mouse_data = handler.GetMice().at(0); digital_buttons = 0; @@ -307,16 +307,16 @@ static bool mouse_input_to_pad(const u32 mouse_no, be_t& digital_buttons, b static bool mouse_pos_to_gem_image_state(const u32 mouse_no, vm::ptr& gem_image_state) { - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - std::scoped_lock lock(handler->mutex); + std::scoped_lock lock(handler.mutex); - if (!gem_image_state || mouse_no >= handler->GetMice().size()) + if (!gem_image_state || mouse_no >= handler.GetMice().size()) { return false; } - const auto& mouse = handler->GetMice().at(0); + const auto& mouse = handler.GetMice().at(0); const auto renderer = static_cast(rsx::get_current_renderer()); const auto width = renderer->get_frame()->client_width(); @@ -337,16 +337,16 @@ static bool mouse_pos_to_gem_image_state(const u32 mouse_no, vm::ptr& gem_state) { - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - std::scoped_lock lock(handler->mutex); + std::scoped_lock lock(handler.mutex); - if (!gem_state || mouse_no >= handler->GetMice().size()) + if (!gem_state || mouse_no >= handler.GetMice().size()) { return false; } - const auto& mouse = handler->GetMice().at(0); + const auto& mouse = handler.GetMice().at(0); const auto renderer = static_cast(rsx::get_current_renderer()); const auto width = renderer->get_frame()->client_width(); @@ -382,11 +382,11 @@ error_code cellGemCalibrate(u32 gem_num) { cellGem.todo("cellGemCalibrate(gem_num=%d)", gem_num); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - std::scoped_lock lock(gem->mtx); + std::scoped_lock lock(gem.mtx); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -398,10 +398,10 @@ error_code cellGemCalibrate(u32 gem_num) if (g_cfg.io.move == move_handler::fake || g_cfg.io.move == move_handler::mouse) { - gem->controllers[gem_num].calibrated_magnetometer = true; - gem->controllers[gem_num].enabled_tracking = true; - gem->controllers[gem_num].hue = 1; - gem->status_flags = CELL_GEM_FLAG_CALIBRATION_OCCURRED | CELL_GEM_FLAG_CALIBRATION_SUCCEEDED; + gem.controllers[gem_num].calibrated_magnetometer = true; + gem.controllers[gem_num].enabled_tracking = true; + gem.controllers[gem_num].hue = 1; + gem.status_flags = CELL_GEM_FLAG_CALIBRATION_OCCURRED | CELL_GEM_FLAG_CALIBRATION_SUCCEEDED; } return CELL_OK; @@ -411,11 +411,11 @@ error_code cellGemClearStatusFlags(u32 gem_num, u64 mask) { cellGem.todo("cellGemClearStatusFlags(gem_num=%d, mask=0x%x)", gem_num, mask); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - std::scoped_lock lock(gem->mtx); + std::scoped_lock lock(gem.mtx); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -425,7 +425,7 @@ error_code cellGemClearStatusFlags(u32 gem_num, u64 mask) return CELL_GEM_ERROR_INVALID_PARAMETER; } - gem->status_flags &= ~mask; + gem.status_flags &= ~mask; return CELL_OK; } @@ -434,9 +434,9 @@ error_code cellGemConvertVideoFinish() { cellGem.todo("cellGemConvertVideoFinish()"); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -448,9 +448,9 @@ error_code cellGemConvertVideoStart(vm::cptr video_frame) { cellGem.todo("cellGemConvertVideoStart(video_frame=*0x%x)", video_frame); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -462,16 +462,16 @@ error_code cellGemEnableCameraPitchAngleCorrection(u32 enable_flag) { cellGem.todo("cellGemEnableCameraPitchAngleCorrection(enable_flag=%d)", enable_flag); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - std::scoped_lock lock(gem->mtx); + std::scoped_lock lock(gem.mtx); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } - gem->enable_pitch_correction = !!enable_flag; + gem.enable_pitch_correction = !!enable_flag; return CELL_OK; } @@ -480,21 +480,21 @@ error_code cellGemEnableMagnetometer(u32 gem_num, u32 enable) { cellGem.todo("cellGemEnableMagnetometer(gem_num=%d, enable=0x%x)", gem_num, enable); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - std::scoped_lock lock(gem->mtx); + std::scoped_lock lock(gem.mtx); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } - if (!gem->is_controller_ready(gem_num)) + if (!gem.is_controller_ready(gem_num)) { return CELL_GEM_NOT_CONNECTED; } - gem->controllers[gem_num].enabled_magnetometer = !!enable; + gem.controllers[gem_num].enabled_magnetometer = !!enable; return CELL_OK; } @@ -509,13 +509,13 @@ error_code cellGemEnd(ppu_thread& ppu) { cellGem.warning("cellGemEnd()"); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - std::scoped_lock lock(gem->mtx); + std::scoped_lock lock(gem.mtx); - if (gem->state.compare_and_swap_test(1, 0)) + if (gem.state.compare_and_swap_test(1, 0)) { - if (u32 addr = gem->memory_ptr) + if (u32 addr = gem.memory_ptr) { sys_memory_free(ppu, addr); } @@ -530,11 +530,11 @@ error_code cellGemFilterState(u32 gem_num, u32 enable) { cellGem.warning("cellGemFilterState(gem_num=%d, enable=%d)", gem_num, enable); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - std::scoped_lock lock(gem->mtx); + std::scoped_lock lock(gem.mtx); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -544,7 +544,7 @@ error_code cellGemFilterState(u32 gem_num, u32 enable) return CELL_GEM_ERROR_INVALID_PARAMETER; } - gem->controllers[gem_num].enabled_filtering = !!enable; + gem.controllers[gem_num].enabled_filtering = !!enable; return CELL_OK; } @@ -553,11 +553,11 @@ error_code cellGemForceRGB(u32 gem_num, float r, float g, float b) { cellGem.todo("cellGemForceRGB(gem_num=%d, r=%f, g=%f, b=%f)", gem_num, r, g, b); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - std::scoped_lock lock(gem->mtx); + std::scoped_lock lock(gem.mtx); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -567,7 +567,7 @@ error_code cellGemForceRGB(u32 gem_num, float r, float g, float b) return CELL_GEM_ERROR_INVALID_PARAMETER; } - gem->controllers[gem_num].sphere_rgb = gem_config::gem_color(r, g, b); + gem.controllers[gem_num].sphere_rgb = gem_config::gem_color(r, g, b); return CELL_OK; } @@ -582,9 +582,9 @@ error_code cellGemGetAllTrackableHues(vm::ptr hues) { cellGem.todo("cellGemGetAllTrackableHues(hues=*0x%x)"); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -601,9 +601,9 @@ error_code cellGemGetCameraState(vm::ptr camera_state) { cellGem.todo("cellGemGetCameraState(camera_state=0x%x)", camera_state); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -623,9 +623,9 @@ error_code cellGemGetEnvironmentLightingColor(vm::ptr r, vm::ptr g, vm { cellGem.todo("cellGemGetEnvironmentLightingColor(r=*0x%x, g=*0x%x, b=*0x%x)", r, g, b); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -647,9 +647,9 @@ error_code cellGemGetHuePixels(vm::cptr camera_frame, u32 hue, vm::ptr { cellGem.todo("cellGemGetHuePixels(camera_frame=*0x%x, hue=%d, pixels=*0x%x)", camera_frame, hue, pixels); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -666,9 +666,9 @@ error_code cellGemGetImageState(u32 gem_num, vm::ptr gem_imag { cellGem.todo("cellGemGetImageState(gem_num=%d, image_state=&0x%x)", gem_num, gem_image_state); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -678,7 +678,7 @@ error_code cellGemGetImageState(u32 gem_num, vm::ptr gem_imag return CELL_GEM_ERROR_INVALID_PARAMETER; } - auto shared_data = g_fxo->get(); + auto& shared_data = g_fxo->get(); if (g_cfg.io.move == move_handler::fake) { @@ -694,7 +694,7 @@ error_code cellGemGetImageState(u32 gem_num, vm::ptr gem_imag if (g_cfg.io.move == move_handler::fake || g_cfg.io.move == move_handler::mouse) { - gem_image_state->frame_timestamp = shared_data->frame_timestamp.load(); + gem_image_state->frame_timestamp = shared_data.frame_timestamp.load(); gem_image_state->timestamp = gem_image_state->frame_timestamp + 10; gem_image_state->r = 10; gem_image_state->distance = 2 * 1000; // 2 meters away from camera @@ -709,16 +709,16 @@ error_code cellGemGetInertialState(u32 gem_num, u32 state_flag, u64 timestamp, v { cellGem.warning("cellGemGetInertialState(gem_num=%d, state_flag=%d, timestamp=0x%x, inertial_state=0x%x)", gem_num, state_flag, timestamp, inertial_state); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - std::scoped_lock lock(gem->mtx); + std::scoped_lock lock(gem.mtx); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } - if (!check_gem_num(gem_num) || state_flag > CELL_GEM_INERTIAL_STATE_FLAG_NEXT || !inertial_state || !gem->is_controller_ready(gem_num)) + if (!check_gem_num(gem_num) || state_flag > CELL_GEM_INERTIAL_STATE_FLAG_NEXT || !inertial_state || !gem.is_controller_ready(gem_num)) { return CELL_GEM_ERROR_INVALID_PARAMETER; } @@ -736,8 +736,8 @@ error_code cellGemGetInertialState(u32 gem_num, u32 state_flag, u64 timestamp, v { ds3_input_to_ext(gem_num, inertial_state->ext); - inertial_state->timestamp = gem->timer.GetElapsedTimeInMicroSec(); - inertial_state->counter = gem->inertial_counter++; + inertial_state->timestamp = gem.timer.GetElapsedTimeInMicroSec(); + inertial_state->counter = gem.inertial_counter++; inertial_state->accelerometer[0] = 10; } @@ -748,11 +748,11 @@ error_code cellGemGetInfo(vm::ptr info) { cellGem.warning("cellGemGetInfo(info=*0x%x)", info); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - reader_lock lock(gem->mtx); + reader_lock lock(gem.mtx); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -763,13 +763,13 @@ error_code cellGemGetInfo(vm::ptr info) } // TODO: Support connecting PlayStation Move controllers - info->max_connect = gem->attribute.max_connect; - info->now_connect = gem->connected_controllers; + info->max_connect = gem.attribute.max_connect; + info->now_connect = gem.connected_controllers; for (int i = 0; i < CELL_GEM_MAX_NUM; i++) { - info->status[i] = gem->controllers[i].status; - info->port[i] = gem->controllers[i].port; + info->status[i] = gem.controllers[i].status; + info->port[i] = gem.controllers[i].port; } return CELL_OK; @@ -796,11 +796,11 @@ error_code cellGemGetRGB(u32 gem_num, vm::ptr r, vm::ptr g, vm::pt { cellGem.todo("cellGemGetRGB(gem_num=%d, r=*0x%x, g=*0x%x, b=*0x%x)", gem_num, r, g, b); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - reader_lock lock(gem->mtx); + reader_lock lock(gem.mtx); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -810,7 +810,7 @@ error_code cellGemGetRGB(u32 gem_num, vm::ptr r, vm::ptr g, vm::pt return CELL_GEM_ERROR_INVALID_PARAMETER; } - auto& sphere_color = gem->controllers[gem_num].sphere_rgb; + auto& sphere_color = gem.controllers[gem_num].sphere_rgb; *r = sphere_color.r; *g = sphere_color.g; *b = sphere_color.b; @@ -822,11 +822,11 @@ error_code cellGemGetRumble(u32 gem_num, vm::ptr rumble) { cellGem.todo("cellGemGetRumble(gem_num=%d, rumble=*0x%x)", gem_num, rumble); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - reader_lock lock(gem->mtx); + reader_lock lock(gem.mtx); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -836,7 +836,7 @@ error_code cellGemGetRumble(u32 gem_num, vm::ptr rumble) return CELL_GEM_ERROR_INVALID_PARAMETER; } - *rumble = gem->controllers[gem_num].rumble; + *rumble = gem.controllers[gem_num].rumble; return CELL_OK; } @@ -845,11 +845,11 @@ error_code cellGemGetState(u32 gem_num, u32 flag, u64 time_parameter, vm::ptrget(); + auto& gem = g_fxo->get(); - reader_lock lock(gem->mtx); + reader_lock lock(gem.mtx); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -874,7 +874,7 @@ error_code cellGemGetState(u32 gem_num, u32 flag, u64 time_parameter, vm::ptrext); gem_state->tracking_flags = CELL_GEM_TRACKING_FLAG_POSITION_TRACKED | CELL_GEM_TRACKING_FLAG_VISIBLE; - gem_state->timestamp = gem->timer.GetElapsedTimeInMicroSec(); + gem_state->timestamp = gem.timer.GetElapsedTimeInMicroSec(); gem_state->quat[3] = 1.f; return CELL_OK; @@ -887,11 +887,11 @@ error_code cellGemGetStatusFlags(u32 gem_num, vm::ptr flags) { cellGem.todo("cellGemGetStatusFlags(gem_num=%d, flags=*0x%x)", gem_num, flags); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - reader_lock lock(gem->mtx); + reader_lock lock(gem.mtx); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -901,7 +901,7 @@ error_code cellGemGetStatusFlags(u32 gem_num, vm::ptr flags) return CELL_GEM_ERROR_INVALID_PARAMETER; } - *flags = gem->status_flags; + *flags = gem.status_flags; return CELL_OK; } @@ -910,11 +910,11 @@ error_code cellGemGetTrackerHue(u32 gem_num, vm::ptr hue) { cellGem.warning("cellGemGetTrackerHue(gem_num=%d, hue=*0x%x)", gem_num, hue); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - reader_lock lock(gem->mtx); + reader_lock lock(gem.mtx); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -924,12 +924,12 @@ error_code cellGemGetTrackerHue(u32 gem_num, vm::ptr hue) return CELL_GEM_ERROR_INVALID_PARAMETER; } - if (!gem->controllers[gem_num].enabled_tracking || gem->controllers[gem_num].hue > 359) + if (!gem.controllers[gem_num].enabled_tracking || gem.controllers[gem_num].hue > 359) { return CELL_GEM_ERROR_NOT_A_HUE; } - *hue = gem->controllers[gem_num].hue; + *hue = gem.controllers[gem_num].hue; return CELL_OK; } @@ -954,16 +954,16 @@ error_code cellGemInit(ppu_thread& ppu, vm::cptr attribute) { cellGem.warning("cellGemInit(attribute=*0x%x)", attribute); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); if (!attribute || !attribute->spurs_addr || !attribute->max_connect || attribute->max_connect > CELL_GEM_MAX_NUM) { return CELL_GEM_ERROR_INVALID_PARAMETER; } - std::scoped_lock lock(gem->mtx); + std::scoped_lock lock(gem.mtx); - if (!gem->state.compare_and_swap_test(0, 1)) + if (!gem.state.compare_and_swap_test(0, 1)) { return CELL_GEM_ERROR_ALREADY_INITIALIZED; } @@ -978,33 +978,33 @@ error_code cellGemInit(ppu_thread& ppu, vm::cptr attribute) return CELL_GEM_ERROR_RESOURCE_ALLOCATION_FAILED; } - gem->memory_ptr = *addr; + gem.memory_ptr = *addr; } else { - gem->memory_ptr = 0; + gem.memory_ptr = 0; } - gem->update_started = false; - gem->camera_frame = 0; - gem->status_flags = 0; - gem->attribute = *attribute; + gem.update_started = false; + gem.camera_frame = 0; + gem.status_flags = 0; + gem.attribute = *attribute; if (g_cfg.io.move == move_handler::mouse) { // init mouse handler - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - handler->Init(std::min(attribute->max_connect, CELL_GEM_MAX_NUM)); + handler.Init(std::min(attribute->max_connect, CELL_GEM_MAX_NUM)); } for (int gem_num = 0; gem_num < CELL_GEM_MAX_NUM; gem_num++) { - gem->reset_controller(gem_num); + gem.reset_controller(gem_num); } // TODO: is this correct? - gem->timer.Start(); + gem.timer.Start(); return CELL_OK; } @@ -1013,11 +1013,11 @@ error_code cellGemInvalidateCalibration(s32 gem_num) { cellGem.todo("cellGemInvalidateCalibration(gem_num=%d)", gem_num); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - std::scoped_lock lock(gem->mtx); + std::scoped_lock lock(gem.mtx); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -1029,8 +1029,8 @@ error_code cellGemInvalidateCalibration(s32 gem_num) if (g_cfg.io.move == move_handler::fake || g_cfg.io.move == move_handler::mouse) { - gem->controllers[gem_num].calibrated_magnetometer = false; - // TODO: gem->status_flags + gem.controllers[gem_num].calibrated_magnetometer = false; + // TODO: gem.status_flags } return CELL_OK; @@ -1040,9 +1040,9 @@ s32 cellGemIsTrackableHue(u32 hue) { cellGem.todo("cellGemIsTrackableHue(hue=%d)", hue); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - if (!gem->state || hue > 359) + if (!gem.state || hue > 359) { return false; } @@ -1054,9 +1054,9 @@ error_code cellGemPrepareCamera(s32 max_exposure, f32 image_quality) { cellGem.todo("cellGemPrepareCamera(max_exposure=%d, image_quality=%f)", max_exposure, image_quality); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -1073,9 +1073,9 @@ error_code cellGemPrepareVideoConvert(vm::cptr vc_ { cellGem.todo("cellGemPrepareVideoConvert(vc_attribute=*0x%x)", vc_attribute); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -1098,7 +1098,7 @@ error_code cellGemPrepareVideoConvert(vm::cptr vc_ return CELL_GEM_ERROR_INVALID_ALIGNMENT; } - gem->vc_attribute = vc; + gem.vc_attribute = vc; return CELL_OK; } @@ -1107,9 +1107,9 @@ error_code cellGemReadExternalPortDeviceInfo(u32 gem_num, vm::ptr ext_id, v { cellGem.todo("cellGemReadExternalPortDeviceInfo(gem_num=%d, ext_id=*0x%x, ext_info=%s)", gem_num, ext_id, ext_info); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -1119,12 +1119,12 @@ error_code cellGemReadExternalPortDeviceInfo(u32 gem_num, vm::ptr ext_id, v return CELL_GEM_ERROR_INVALID_PARAMETER; } - if (gem->controllers[gem_num].status & CELL_GEM_STATUS_DISCONNECTED) + if (gem.controllers[gem_num].status & CELL_GEM_STATUS_DISCONNECTED) { return CELL_GEM_NOT_CONNECTED; } - if (!(gem->controllers[gem_num].ext_status & CELL_GEM_EXT_CONNECTED)) + if (!(gem.controllers[gem_num].ext_status & CELL_GEM_EXT_CONNECTED)) { return CELL_GEM_NO_EXTERNAL_PORT_DEVICE; } @@ -1136,9 +1136,9 @@ error_code cellGemReset(u32 gem_num) { cellGem.todo("cellGemReset(gem_num=%d)", gem_num); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -1148,10 +1148,10 @@ error_code cellGemReset(u32 gem_num) return CELL_GEM_ERROR_INVALID_PARAMETER; } - gem->reset_controller(gem_num); + gem.reset_controller(gem_num); // TODO: is this correct? - gem->timer.Start(); + gem.timer.Start(); return CELL_OK; } @@ -1160,11 +1160,11 @@ error_code cellGemSetRumble(u32 gem_num, u8 rumble) { cellGem.todo("cellGemSetRumble(gem_num=%d, rumble=0x%x)", gem_num, rumble); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - std::scoped_lock lock(gem->mtx); + std::scoped_lock lock(gem.mtx); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -1174,7 +1174,7 @@ error_code cellGemSetRumble(u32 gem_num, u8 rumble) return CELL_GEM_ERROR_INVALID_PARAMETER; } - gem->controllers[gem_num].rumble = rumble; + gem.controllers[gem_num].rumble = rumble; return CELL_OK; } @@ -1189,11 +1189,11 @@ error_code cellGemTrackHues(vm::cptr req_hues, vm::ptr res_hues) { cellGem.todo("cellGemTrackHues(req_hues=*0x%x, res_hues=*0x%x)", req_hues, res_hues); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - std::scoped_lock lock(gem->mtx); + std::scoped_lock lock(gem.mtx); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } @@ -1211,8 +1211,8 @@ error_code cellGemTrackHues(vm::cptr req_hues, vm::ptr res_hues) } else if (req_hues[i] == u32{CELL_GEM_DONT_TRACK_HUE}) { - gem->controllers[i].enabled_tracking = false; - gem->controllers[i].enabled_LED = false; + gem.controllers[i].enabled_tracking = false; + gem.controllers[i].enabled_LED = false; } else { @@ -1230,21 +1230,21 @@ error_code cellGemUpdateFinish() { cellGem.warning("cellGemUpdateFinish()"); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } - std::scoped_lock lock(gem->mtx); + std::scoped_lock lock(gem.mtx); - if (!std::exchange(gem->update_started, false)) + if (!std::exchange(gem.update_started, false)) { return CELL_GEM_ERROR_UPDATE_NOT_STARTED; } - if (!gem->camera_frame) + if (!gem.camera_frame) { return not_an_error(CELL_GEM_NO_VIDEO); } @@ -1256,22 +1256,22 @@ error_code cellGemUpdateStart(vm::cptr camera_frame, u64 timestamp) { cellGem.warning("cellGemUpdateStart(camera_frame=*0x%x, timestamp=%d)", camera_frame, timestamp); - const auto gem = g_fxo->get(); + auto& gem = g_fxo->get(); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } - std::scoped_lock lock(gem->mtx); + std::scoped_lock lock(gem.mtx); // Update is starting even when camera_frame is null - if (std::exchange(gem->update_started, true)) + if (std::exchange(gem.update_started, true)) { return CELL_GEM_ERROR_UPDATE_NOT_FINISHED; } - gem->camera_frame = camera_frame.addr(); + gem.camera_frame = camera_frame.addr(); if (!camera_frame) { return not_an_error(CELL_GEM_NO_VIDEO); @@ -1284,9 +1284,9 @@ error_code cellGemWriteExternalPort(u32 gem_num, vm::ptrget(); + auto& gem = g_fxo->get(); - if (!gem->state) + if (!gem.state) { return CELL_GEM_ERROR_UNINITIALIZED; } diff --git a/rpcs3/Emu/Cell/Modules/cellImeJp.cpp b/rpcs3/Emu/Cell/Modules/cellImeJp.cpp index 66f229c6eb..a47b721222 100644 --- a/rpcs3/Emu/Cell/Modules/cellImeJp.cpp +++ b/rpcs3/Emu/Cell/Modules/cellImeJp.cpp @@ -128,10 +128,10 @@ error_code cellImeJpOpen(sys_memory_container_t container_id, vm::ptrget(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (manager->is_initialized) + if (manager.is_initialized) { return CELL_IMEJP_ERROR_ALREADY_OPEN; } @@ -140,11 +140,11 @@ error_code cellImeJpOpen(sys_memory_container_t container_id, vm::ptrpath); - manager->dictionary_paths.emplace_back(addDicPath->path); + manager.dictionary_paths.emplace_back(addDicPath->path); } *hImeJpHandle = vm::cast(ime_jp_address); - manager->is_initialized = true; + manager.is_initialized = true; return CELL_OK; } @@ -158,10 +158,10 @@ error_code cellImeJpOpen2(sys_memory_container_t container_id, vm::ptrget(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (manager->is_initialized) + if (manager.is_initialized) { return CELL_IMEJP_ERROR_ALREADY_OPEN; } @@ -170,12 +170,12 @@ error_code cellImeJpOpen2(sys_memory_container_t container_id, vm::ptrpath); - manager->dictionary_paths.emplace_back(addDicPath->path); + manager.dictionary_paths.emplace_back(addDicPath->path); } *hImeJpHandle = vm::cast(ime_jp_address); - manager->is_initialized = true; + manager.is_initialized = true; return CELL_OK; } @@ -189,10 +189,10 @@ error_code cellImeJpOpen3(sys_memory_container_t container_id, vm::ptrget(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (manager->is_initialized) + if (manager.is_initialized) { return CELL_IMEJP_ERROR_ALREADY_OPEN; } @@ -205,14 +205,14 @@ error_code cellImeJpOpen3(sys_memory_container_t container_id, vm::ptrpath); - manager->dictionary_paths.emplace_back(addDicPath[i]->path); + manager.dictionary_paths.emplace_back(addDicPath[i]->path); } } } *hImeJpHandle = vm::cast(ime_jp_address); - manager->is_initialized = true; + manager.is_initialized = true; return CELL_OK; } @@ -227,21 +227,21 @@ error_code cellImeJpClose(CellImeJpHandle hImeJpHandle) { cellImeJp.todo("cellImeJpClose(hImeJpHandle=*0x%x)", hImeJpHandle); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - manager->input_state = CELL_IMEJP_BEFORE_INPUT; - manager->input_string.clear(); - manager->converted_string.clear(); - manager->confirmed_string.clear(); - manager->cursor = 0; - manager->cursor_end = 0; - manager->is_initialized = false; + manager.input_state = CELL_IMEJP_BEFORE_INPUT; + manager.input_string.clear(); + manager.converted_string.clear(); + manager.confirmed_string.clear(); + manager.cursor = 0; + manager.cursor_end = 0; + manager.is_initialized = false; return CELL_OK; } @@ -250,20 +250,20 @@ error_code cellImeJpSetKanaInputMode(CellImeJpHandle hImeJpHandle, s16 inputOpti { cellImeJp.todo("cellImeJpSetKanaInputMode(hImeJpHandle=*0x%x, inputOption=%d)", hImeJpHandle, inputOption); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state != CELL_IMEJP_BEFORE_INPUT) + if (manager.input_state != CELL_IMEJP_BEFORE_INPUT) { return CELL_IMEJP_ERROR_ERR; } - manager->kana_input_mode = inputOption; + manager.kana_input_mode = inputOption; return CELL_OK; } @@ -272,15 +272,15 @@ error_code cellImeJpSetInputCharType(CellImeJpHandle hImeJpHandle, s16 charTypeO { cellImeJp.todo("cellImeJpSetInputCharType(hImeJpHandle=*0x%x, charTypeOption=%d)", hImeJpHandle, charTypeOption); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - manager->input_char_type = charTypeOption; + manager.input_char_type = charTypeOption; return CELL_OK; } @@ -289,15 +289,15 @@ error_code cellImeJpSetFixInputMode(CellImeJpHandle hImeJpHandle, s16 fixInputMo { cellImeJp.todo("cellImeJpSetFixInputMode(hImeJpHandle=*0x%x, fixInputMode=%d)", hImeJpHandle, fixInputMode); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - manager->fix_input_mode = fixInputMode; + manager.fix_input_mode = fixInputMode; return CELL_OK; } @@ -306,20 +306,20 @@ error_code cellImeJpAllowExtensionCharacters(CellImeJpHandle hImeJpHandle, s16 e { cellImeJp.todo("cellImeJpSetFixInputMode(hImeJpHandle=*0x%x, extensionCharacters=%d)", hImeJpHandle, extensionCharacters); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state != CELL_IMEJP_BEFORE_INPUT) + if (manager.input_state != CELL_IMEJP_BEFORE_INPUT) { return CELL_IMEJP_ERROR_ERR; } - manager->allowed_extensions = extensionCharacters; + manager.allowed_extensions = extensionCharacters; return CELL_OK; } @@ -328,20 +328,20 @@ error_code cellImeJpReset(CellImeJpHandle hImeJpHandle) { cellImeJp.todo("cellImeJpReset(hImeJpHandle=*0x%x)", hImeJpHandle); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - manager->input_state = CELL_IMEJP_BEFORE_INPUT; - manager->input_string.clear(); - manager->converted_string.clear(); - manager->confirmed_string.clear(); - manager->cursor = 0; - manager->cursor_end = 0; + manager.input_state = CELL_IMEJP_BEFORE_INPUT; + manager.input_string.clear(); + manager.converted_string.clear(); + manager.confirmed_string.clear(); + manager.cursor = 0; + manager.cursor_end = 0; return CELL_OK; } @@ -355,15 +355,15 @@ error_code cellImeJpGetStatus(CellImeJpHandle hImeJpHandle, vm::ptr pInputS return CELL_IMEJP_ERROR_PARAM; } - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - *pInputStatus = manager->input_state; + *pInputStatus = manager.input_state; return CELL_OK; } @@ -377,20 +377,20 @@ error_code cellImeJpEnterChar(CellImeJpHandle hImeJpHandle, u16 inputChar, vm::p return CELL_IMEJP_ERROR_PARAM; } - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state == CELL_IMEJP_MOVE_CLAUSE_GAP) + if (manager.input_state == CELL_IMEJP_MOVE_CLAUSE_GAP) { return CELL_IMEJP_ERROR_ERR; } - manager->addChar(inputChar); + manager.addChar(inputChar); *pOutputStatus = CELL_IMEJP_RET_CONFIRMED; @@ -412,20 +412,20 @@ error_code cellImeJpEnterString(CellImeJpHandle hImeJpHandle, vm::cptr pInp return CELL_IMEJP_ERROR_PARAM; } - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state == CELL_IMEJP_MOVE_CLAUSE_GAP) + if (manager.input_state == CELL_IMEJP_MOVE_CLAUSE_GAP) { return CELL_IMEJP_ERROR_ERR; } - manager->addString(pInputString); + manager.addString(pInputString); *pOutputStatus = CELL_IMEJP_RET_CONFIRMED; @@ -442,20 +442,20 @@ error_code cellImeJpModeCaretRight(CellImeJpHandle hImeJpHandle) { cellImeJp.todo("cellImeJpModeCaretRight(hImeJpHandle=*0x%x)", hImeJpHandle); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state != CELL_IMEJP_BEFORE_CONVERT) + if (manager.input_state != CELL_IMEJP_BEFORE_CONVERT) { return CELL_IMEJP_ERROR_ERR; } - manager->moveCursor(1); + manager.moveCursor(1); return CELL_OK; } @@ -464,20 +464,20 @@ error_code cellImeJpModeCaretLeft(CellImeJpHandle hImeJpHandle) { cellImeJp.todo("cellImeJpModeCaretLeft(hImeJpHandle=*0x%x)", hImeJpHandle); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state != CELL_IMEJP_BEFORE_CONVERT) + if (manager.input_state != CELL_IMEJP_BEFORE_CONVERT) { return CELL_IMEJP_ERROR_ERR; } - manager->moveCursor(-1); + manager.moveCursor(-1); return CELL_OK; } @@ -486,20 +486,20 @@ error_code cellImeJpBackspaceWord(CellImeJpHandle hImeJpHandle) { cellImeJp.todo("cellImeJpBackspaceWord(hImeJpHandle=*0x%x)", hImeJpHandle); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state != CELL_IMEJP_BEFORE_CONVERT) + if (manager.input_state != CELL_IMEJP_BEFORE_CONVERT) { return CELL_IMEJP_ERROR_ERR; } - manager->backspaceWord(); + manager.backspaceWord(); return CELL_OK; } @@ -508,20 +508,20 @@ error_code cellImeJpDeleteWord(CellImeJpHandle hImeJpHandle) { cellImeJp.todo("cellImeJpDeleteWord(hImeJpHandle=*0x%x)", hImeJpHandle); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state != CELL_IMEJP_BEFORE_CONVERT) + if (manager.input_state != CELL_IMEJP_BEFORE_CONVERT) { return CELL_IMEJP_ERROR_ERR; } - manager->deleteWord(); + manager.deleteWord(); return CELL_OK; } @@ -530,24 +530,24 @@ error_code cellImeJpAllDeleteConvertString(CellImeJpHandle hImeJpHandle) { cellImeJp.todo("cellImeJpAllDeleteConvertString(hImeJpHandle=*0x%x)", hImeJpHandle); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state == CELL_IMEJP_BEFORE_INPUT) + if (manager.input_state == CELL_IMEJP_BEFORE_INPUT) { return CELL_IMEJP_ERROR_ERR; } - manager->cursor = 0; - manager->cursor_end = 0; - manager->input_string.clear(); - manager->converted_string.clear(); - manager->input_state = CELL_IMEJP_BEFORE_INPUT; + manager.cursor = 0; + manager.cursor_end = 0; + manager.input_string.clear(); + manager.converted_string.clear(); + manager.input_state = CELL_IMEJP_BEFORE_INPUT; return CELL_OK; } @@ -556,20 +556,20 @@ error_code cellImeJpConvertForward(CellImeJpHandle hImeJpHandle) { cellImeJp.todo("cellImeJpConvertForward(hImeJpHandle=*0x%x)", hImeJpHandle); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state == CELL_IMEJP_BEFORE_INPUT) + if (manager.input_state == CELL_IMEJP_BEFORE_INPUT) { return CELL_IMEJP_ERROR_ERR; } - manager->input_state = CELL_IMEJP_CANDIDATES; + manager.input_state = CELL_IMEJP_CANDIDATES; return CELL_OK; } @@ -578,20 +578,20 @@ error_code cellImeJpConvertBackward(CellImeJpHandle hImeJpHandle) { cellImeJp.todo("cellImeJpConvertBackward(hImeJpHandle=*0x%x)", hImeJpHandle); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state == CELL_IMEJP_BEFORE_INPUT) + if (manager.input_state == CELL_IMEJP_BEFORE_INPUT) { return CELL_IMEJP_ERROR_ERR; } - manager->input_state = CELL_IMEJP_CANDIDATES; + manager.input_state = CELL_IMEJP_CANDIDATES; return CELL_OK; } @@ -600,15 +600,15 @@ error_code cellImeJpCurrentPartConfirm(CellImeJpHandle hImeJpHandle, s16 listIte { cellImeJp.todo("cellImeJpCurrentPartConfirm(hImeJpHandle=*0x%x, listItem=%d)", hImeJpHandle, listItem); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state == CELL_IMEJP_BEFORE_INPUT) + if (manager.input_state == CELL_IMEJP_BEFORE_INPUT) { return CELL_IMEJP_ERROR_ERR; } @@ -620,26 +620,26 @@ error_code cellImeJpAllConfirm(CellImeJpHandle hImeJpHandle) { cellImeJp.todo("cellImeJpAllConfirm(hImeJpHandle=*0x%x)", hImeJpHandle); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state == CELL_IMEJP_BEFORE_INPUT) + if (manager.input_state == CELL_IMEJP_BEFORE_INPUT) { return CELL_IMEJP_ERROR_ERR; } // Use input_string for now - manager->confirmed_string = manager->input_string; - manager->cursor = 0; - manager->cursor_end = 0; - manager->input_string.clear(); - manager->converted_string.clear(); - manager->input_state = CELL_IMEJP_BEFORE_INPUT; + manager.confirmed_string = manager.input_string; + manager.cursor = 0; + manager.cursor_end = 0; + manager.input_string.clear(); + manager.converted_string.clear(); + manager.input_state = CELL_IMEJP_BEFORE_INPUT; return CELL_OK; } @@ -648,21 +648,21 @@ error_code cellImeJpAllConvertCancel(CellImeJpHandle hImeJpHandle) { cellImeJp.todo("cellImeJpAllConvertCancel(hImeJpHandle=*0x%x)", hImeJpHandle); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state == CELL_IMEJP_BEFORE_INPUT || manager->input_state == CELL_IMEJP_BEFORE_CONVERT) + if (manager.input_state == CELL_IMEJP_BEFORE_INPUT || manager.input_state == CELL_IMEJP_BEFORE_CONVERT) { return CELL_IMEJP_ERROR_ERR; } - manager->converted_string.clear(); - manager->input_state = CELL_IMEJP_BEFORE_CONVERT; + manager.converted_string.clear(); + manager.input_state = CELL_IMEJP_BEFORE_CONVERT; return CELL_OK; } @@ -671,15 +671,15 @@ error_code cellImeJpConvertCancel(CellImeJpHandle hImeJpHandle) { cellImeJp.todo("cellImeJpConvertCancel(hImeJpHandle=*0x%x)", hImeJpHandle); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state == CELL_IMEJP_BEFORE_INPUT || manager->input_state == CELL_IMEJP_BEFORE_CONVERT) + if (manager.input_state == CELL_IMEJP_BEFORE_INPUT || manager.input_state == CELL_IMEJP_BEFORE_CONVERT) { return CELL_IMEJP_ERROR_ERR; } @@ -692,20 +692,20 @@ error_code cellImeJpExtendConvertArea(CellImeJpHandle hImeJpHandle) { cellImeJp.todo("cellImeJpExtendConvertArea(hImeJpHandle=*0x%x)", hImeJpHandle); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state == CELL_IMEJP_BEFORE_INPUT || manager->input_state == CELL_IMEJP_BEFORE_CONVERT) + if (manager.input_state == CELL_IMEJP_BEFORE_INPUT || manager.input_state == CELL_IMEJP_BEFORE_CONVERT) { return CELL_IMEJP_ERROR_ERR; } - manager->moveCursorEnd(1); + manager.moveCursorEnd(1); return CELL_OK; } @@ -714,20 +714,20 @@ error_code cellImeJpShortenConvertArea(CellImeJpHandle hImeJpHandle) { cellImeJp.todo("cellImeJpShortenConvertArea(hImeJpHandle=*0x%x)", hImeJpHandle); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state == CELL_IMEJP_BEFORE_INPUT || manager->input_state == CELL_IMEJP_BEFORE_CONVERT) + if (manager.input_state == CELL_IMEJP_BEFORE_INPUT || manager.input_state == CELL_IMEJP_BEFORE_CONVERT) { return CELL_IMEJP_ERROR_ERR; } - manager->moveCursorEnd(-1); + manager.moveCursorEnd(-1); return CELL_OK; } @@ -736,15 +736,15 @@ error_code cellImeJpTemporalConfirm(CellImeJpHandle hImeJpHandle, s16 selectInde { cellImeJp.todo("cellImeJpTemporalConfirm(hImeJpHandle=*0x%x, selectIndex=%d)", hImeJpHandle, selectIndex); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state != CELL_IMEJP_CANDIDATES) + if (manager.input_state != CELL_IMEJP_CANDIDATES) { return CELL_IMEJP_ERROR_ERR; } @@ -756,15 +756,15 @@ error_code cellImeJpPostConvert(CellImeJpHandle hImeJpHandle, s16 postType) { cellImeJp.todo("cellImeJpPostConvert(hImeJpHandle=*0x%x, postType=%d)", hImeJpHandle, postType); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state == CELL_IMEJP_BEFORE_INPUT) + if (manager.input_state == CELL_IMEJP_BEFORE_INPUT) { return CELL_IMEJP_ERROR_ERR; } @@ -776,15 +776,15 @@ error_code cellImeJpMoveFocusClause(CellImeJpHandle hImeJpHandle, s16 moveType) { cellImeJp.todo("cellImeJpMoveFocusClause(hImeJpHandle=*0x%x, moveType=%d)", hImeJpHandle, moveType); - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state == CELL_IMEJP_BEFORE_INPUT || manager->input_state == CELL_IMEJP_BEFORE_CONVERT || manager->input_state == CELL_IMEJP_MOVE_CLAUSE_GAP) + if (manager.input_state == CELL_IMEJP_BEFORE_INPUT || manager.input_state == CELL_IMEJP_BEFORE_CONVERT || manager.input_state == CELL_IMEJP_MOVE_CLAUSE_GAP) { return CELL_IMEJP_ERROR_ERR; } @@ -792,23 +792,23 @@ error_code cellImeJpMoveFocusClause(CellImeJpHandle hImeJpHandle, s16 moveType) switch (moveType) { case CELL_IMEJP_FOCUS_NEXT: - manager->moveCursor(1); + manager.moveCursor(1); break; case CELL_IMEJP_FOCUS_BEFORE: - manager->moveCursor(-1); + manager.moveCursor(-1); break; case CELL_IMEJP_FOCUS_TOP: - manager->moveCursor(-1 * ::narrow(manager->input_string.length())); + manager.moveCursor(-1 * ::narrow(manager.input_string.length())); break; case CELL_IMEJP_FOCUS_END: - manager->moveCursor(::narrow(manager->input_string.length())); - manager->moveCursor(-1); + manager.moveCursor(::narrow(manager.input_string.length())); + manager.moveCursor(-1); break; default: break; } - manager->input_state = CELL_IMEJP_CONVERTING; + manager.input_state = CELL_IMEJP_CONVERTING; return CELL_OK; } @@ -822,15 +822,15 @@ error_code cellImeJpGetFocusTop(CellImeJpHandle hImeJpHandle, vm::ptr pFocu return CELL_IMEJP_ERROR_PARAM; } - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - *pFocusTop = static_cast(manager->cursor * 2); // offset in bytes + *pFocusTop = static_cast(manager.cursor * 2); // offset in bytes return CELL_OK; } @@ -844,21 +844,21 @@ error_code cellImeJpGetFocusLength(CellImeJpHandle hImeJpHandle, vm::ptr pF return CELL_IMEJP_ERROR_PARAM; } - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->cursor >= (CELL_IMEJP_STRING_MAXLENGTH - 1)) + if (manager.cursor >= (CELL_IMEJP_STRING_MAXLENGTH - 1)) { *pFocusLength = 0; } else { - *pFocusLength = static_cast((manager->cursor_end - manager->cursor + 1) * 2); // offset in bytes + *pFocusLength = static_cast((manager.cursor_end - manager.cursor + 1) * 2); // offset in bytes } return CELL_OK; @@ -873,10 +873,10 @@ error_code cellImeJpGetConfirmYomiString(CellImeJpHandle hImeJpHandle, vm::ptrget(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } @@ -886,11 +886,11 @@ error_code cellImeJpGetConfirmYomiString(CellImeJpHandle hImeJpHandle, vm::ptr(CELL_IMEJP_STRING_MAXLENGTH - 1, manager->confirmed_string.length()); + const usz max_len = std::min(CELL_IMEJP_STRING_MAXLENGTH - 1, manager.confirmed_string.length()); for (u32 i = 0; i < max_len; i++) { - pYomiString[i] = manager->confirmed_string[i]; + pYomiString[i] = manager.confirmed_string[i]; } return CELL_OK; @@ -905,10 +905,10 @@ error_code cellImeJpGetConfirmString(CellImeJpHandle hImeJpHandle, vm::ptr return CELL_IMEJP_ERROR_PARAM; } - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } @@ -918,11 +918,11 @@ error_code cellImeJpGetConfirmString(CellImeJpHandle hImeJpHandle, vm::ptr pConfirmString[i] = 0; } - const usz max_len = std::min(CELL_IMEJP_STRING_MAXLENGTH - 1, manager->confirmed_string.length()); + const usz max_len = std::min(CELL_IMEJP_STRING_MAXLENGTH - 1, manager.confirmed_string.length()); for (u32 i = 0; i < max_len; i++) { - pConfirmString[i] = manager->confirmed_string[i]; + pConfirmString[i] = manager.confirmed_string[i]; } return CELL_OK; @@ -937,10 +937,10 @@ error_code cellImeJpGetConvertYomiString(CellImeJpHandle hImeJpHandle, vm::ptrget(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } @@ -950,11 +950,11 @@ error_code cellImeJpGetConvertYomiString(CellImeJpHandle hImeJpHandle, vm::ptr(CELL_IMEJP_STRING_MAXLENGTH - 1, manager->input_string.length()); + const usz max_len = std::min(CELL_IMEJP_STRING_MAXLENGTH - 1, manager.input_string.length()); for (u32 i = 0; i < max_len; i++) { - pYomiString[i] = manager->input_string[i]; + pYomiString[i] = manager.input_string[i]; } return CELL_OK; @@ -969,10 +969,10 @@ error_code cellImeJpGetConvertString(CellImeJpHandle hImeJpHandle, vm::ptr return CELL_IMEJP_ERROR_PARAM; } - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } @@ -982,11 +982,11 @@ error_code cellImeJpGetConvertString(CellImeJpHandle hImeJpHandle, vm::ptr pConvertString[i] = 0; } - const usz max_len = std::min(CELL_IMEJP_STRING_MAXLENGTH - 1, manager->input_string.length()); + const usz max_len = std::min(CELL_IMEJP_STRING_MAXLENGTH - 1, manager.input_string.length()); for (u32 i = 0; i < max_len; i++) { - pConvertString[i] = manager->input_string[i]; + pConvertString[i] = manager.input_string[i]; } return CELL_OK; @@ -1001,15 +1001,15 @@ error_code cellImeJpGetCandidateListSize(CellImeJpHandle hImeJpHandle, vm::ptrget(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state != CELL_IMEJP_CANDIDATES) + if (manager.input_state != CELL_IMEJP_CANDIDATES) { return CELL_IMEJP_ERROR_ERR; } @@ -1028,15 +1028,15 @@ error_code cellImeJpGetCandidateList(CellImeJpHandle hImeJpHandle, vm::ptr return CELL_IMEJP_ERROR_PARAM; } - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state != CELL_IMEJP_CANDIDATES) + if (manager.input_state != CELL_IMEJP_CANDIDATES) { return CELL_IMEJP_ERROR_ERR; } @@ -1055,15 +1055,15 @@ error_code cellImeJpGetCandidateSelect(CellImeJpHandle hImeJpHandle, vm::ptrget(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } - if (manager->input_state != CELL_IMEJP_CANDIDATES) + if (manager.input_state != CELL_IMEJP_CANDIDATES) { return CELL_IMEJP_ERROR_ERR; } @@ -1082,10 +1082,10 @@ error_code cellImeJpGetPredictList(CellImeJpHandle hImeJpHandle, vm::ptr pY return CELL_IMEJP_ERROR_PARAM; } - const auto manager = g_fxo->get(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } @@ -1104,10 +1104,10 @@ error_code cellImeJpConfirmPrediction(CellImeJpHandle hImeJpHandle, vm::ptrget(); - std::lock_guard lock(manager->mutex); + auto& manager = g_fxo->get(); + std::lock_guard lock(manager.mutex); - if (!manager->is_initialized) + if (!manager.is_initialized) { return CELL_IMEJP_ERROR_CONTEXT; } diff --git a/rpcs3/Emu/Cell/Modules/cellKb.cpp b/rpcs3/Emu/Cell/Modules/cellKb.cpp index a532d09348..f056c07fb0 100644 --- a/rpcs3/Emu/Cell/Modules/cellKb.cpp +++ b/rpcs3/Emu/Cell/Modules/cellKb.cpp @@ -35,9 +35,9 @@ error_code cellKbInit(u32 max_connect) { sys_io.warning("cellKbInit(max_connect=%d)", max_connect); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.init(); + const auto init = handler.init.init(); if (!init) return CELL_KB_ERROR_ALREADY_INITIALIZED; @@ -46,7 +46,7 @@ error_code cellKbInit(u32 max_connect) return CELL_KB_ERROR_INVALID_PARAMETER; libio_sys_config_init(); - handler->Init(std::min(max_connect, 7u)); + handler.Init(std::min(max_connect, 7u)); return CELL_OK; } @@ -55,9 +55,9 @@ error_code cellKbEnd() { sys_io.notice("cellKbEnd()"); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.reset(); + const auto init = handler.init.reset(); if (!init) return CELL_KB_ERROR_UNINITIALIZED; @@ -71,9 +71,9 @@ error_code cellKbClearBuf(u32 port_no) { sys_io.trace("cellKbClearBuf(port_no=%d)", port_no); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.access(); + const auto init = handler.init.access(); if (!init) return CELL_KB_ERROR_UNINITIALIZED; @@ -81,14 +81,14 @@ error_code cellKbClearBuf(u32 port_no) if (port_no >= CELL_KB_MAX_KEYBOARDS) return CELL_KB_ERROR_INVALID_PARAMETER; - std::lock_guard lock(handler->m_mutex); + std::lock_guard lock(handler.m_mutex); - const KbInfo& current_info = handler->GetInfo(); + const KbInfo& current_info = handler.GetInfo(); - if (port_no >= handler->GetKeyboards().size() || current_info.status[port_no] != CELL_KB_STATUS_CONNECTED) + if (port_no >= handler.GetKeyboards().size() || current_info.status[port_no] != CELL_KB_STATUS_CONNECTED) return CELL_KB_ERROR_NO_DEVICE; - KbData& current_data = handler->GetData(port_no); + KbData& current_data = handler.GetData(port_no); current_data.len = 0; current_data.led = 0; current_data.mkey = 0; @@ -245,9 +245,9 @@ error_code cellKbGetInfo(vm::ptr info) { sys_io.trace("cellKbGetInfo(info=*0x%x)", info); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.access(); + const auto init = handler.init.access(); if (!init) return CELL_KB_ERROR_UNINITIALIZED; @@ -257,9 +257,9 @@ error_code cellKbGetInfo(vm::ptr info) std::memset(info.get_ptr(), 0, info.size()); - std::lock_guard lock(handler->m_mutex); + std::lock_guard lock(handler.m_mutex); - const KbInfo& current_info = handler->GetInfo(); + const KbInfo& current_info = handler.GetInfo(); info->max_connect = current_info.max_connect; info->now_connect = current_info.now_connect; info->info = current_info.info; @@ -276,9 +276,9 @@ error_code cellKbRead(u32 port_no, vm::ptr data) { sys_io.trace("cellKbRead(port_no=%d, data=*0x%x)", port_no, data); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.access(); + const auto init = handler.init.access(); if (!init) return CELL_KB_ERROR_UNINITIALIZED; @@ -286,14 +286,14 @@ error_code cellKbRead(u32 port_no, vm::ptr data) if (port_no >= CELL_KB_MAX_KEYBOARDS || !data) return CELL_KB_ERROR_INVALID_PARAMETER; - std::lock_guard lock(handler->m_mutex); + std::lock_guard lock(handler.m_mutex); - const KbInfo& current_info = handler->GetInfo(); + const KbInfo& current_info = handler.GetInfo(); - if (port_no >= handler->GetKeyboards().size() || current_info.status[port_no] != CELL_KB_STATUS_CONNECTED) + if (port_no >= handler.GetKeyboards().size() || current_info.status[port_no] != CELL_KB_STATUS_CONNECTED) return CELL_KB_ERROR_NO_DEVICE; - KbData& current_data = handler->GetData(port_no); + KbData& current_data = handler.GetData(port_no); data->led = current_data.led; data->mkey = current_data.mkey; data->len = std::min(CELL_KB_MAX_KEYCODES, current_data.len); @@ -310,9 +310,9 @@ error_code cellKbSetCodeType(u32 port_no, u32 type) { sys_io.trace("cellKbSetCodeType(port_no=%d, type=%d)", port_no, type); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.access(); + const auto init = handler.init.access(); if (!init) return CELL_KB_ERROR_UNINITIALIZED; @@ -320,12 +320,12 @@ error_code cellKbSetCodeType(u32 port_no, u32 type) if (port_no >= CELL_KB_MAX_KEYBOARDS || type > CELL_KB_CODETYPE_ASCII) return CELL_KB_ERROR_INVALID_PARAMETER; - if (port_no >= handler->GetKeyboards().size()) + if (port_no >= handler.GetKeyboards().size()) return CELL_OK; - std::lock_guard lock(handler->m_mutex); + std::lock_guard lock(handler.m_mutex); - KbConfig& current_config = handler->GetConfig(port_no); + KbConfig& current_config = handler.GetConfig(port_no); current_config.code_type = type; // can also return CELL_KB_ERROR_SYS_SETTING_FAILED @@ -337,9 +337,9 @@ error_code cellKbSetLEDStatus(u32 port_no, u8 led) { sys_io.trace("cellKbSetLEDStatus(port_no=%d, led=%d)", port_no, led); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.access(); + const auto init = handler.init.access(); if (!init) return CELL_KB_ERROR_UNINITIALIZED; @@ -350,12 +350,12 @@ error_code cellKbSetLEDStatus(u32 port_no, u8 led) if (led > 7) return CELL_KB_ERROR_SYS_SETTING_FAILED; - if (port_no >= handler->GetKeyboards().size() || handler->GetInfo().status[port_no] != CELL_KB_STATUS_CONNECTED) + if (port_no >= handler.GetKeyboards().size() || handler.GetInfo().status[port_no] != CELL_KB_STATUS_CONNECTED) return CELL_KB_ERROR_FATAL; - std::lock_guard lock(handler->m_mutex); + std::lock_guard lock(handler.m_mutex); - KbData& current_data = handler->GetData(port_no); + KbData& current_data = handler.GetData(port_no); current_data.led = static_cast(led); return CELL_OK; @@ -365,9 +365,9 @@ error_code cellKbSetReadMode(u32 port_no, u32 rmode) { sys_io.trace("cellKbSetReadMode(port_no=%d, rmode=%d)", port_no, rmode); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.access(); + const auto init = handler.init.access(); if (!init) return CELL_KB_ERROR_UNINITIALIZED; @@ -375,12 +375,12 @@ error_code cellKbSetReadMode(u32 port_no, u32 rmode) if (port_no >= CELL_KB_MAX_KEYBOARDS || rmode > CELL_KB_RMODE_PACKET) return CELL_KB_ERROR_INVALID_PARAMETER; - if (port_no >= handler->GetKeyboards().size()) + if (port_no >= handler.GetKeyboards().size()) return CELL_OK; - std::lock_guard lock(handler->m_mutex); + std::lock_guard lock(handler.m_mutex); - KbConfig& current_config = handler->GetConfig(port_no); + KbConfig& current_config = handler.GetConfig(port_no); current_config.read_mode = rmode; // can also return CELL_KB_ERROR_SYS_SETTING_FAILED @@ -392,9 +392,9 @@ error_code cellKbGetConfiguration(u32 port_no, vm::ptr config) { sys_io.trace("cellKbGetConfiguration(port_no=%d, config=*0x%x)", port_no, config); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.access(); + const auto init = handler.init.access(); if (!init) return CELL_KB_ERROR_UNINITIALIZED; @@ -402,18 +402,18 @@ error_code cellKbGetConfiguration(u32 port_no, vm::ptr config) if (port_no >= CELL_KB_MAX_KEYBOARDS) return CELL_KB_ERROR_INVALID_PARAMETER; - std::lock_guard lock(handler->m_mutex); + std::lock_guard lock(handler.m_mutex); - const KbInfo& current_info = handler->GetInfo(); + const KbInfo& current_info = handler.GetInfo(); - if (port_no >= handler->GetKeyboards().size() || current_info.status[port_no] != CELL_KB_STATUS_CONNECTED) + if (port_no >= handler.GetKeyboards().size() || current_info.status[port_no] != CELL_KB_STATUS_CONNECTED) return CELL_KB_ERROR_NO_DEVICE; // tests show that config is checked only after the device's status if (!config) return CELL_KB_ERROR_INVALID_PARAMETER; - const KbConfig& current_config = handler->GetConfig(port_no); + const KbConfig& current_config = handler.GetConfig(port_no); config->arrange = current_config.arrange; config->read_mode = current_config.read_mode; config->code_type = current_config.code_type; diff --git a/rpcs3/Emu/Cell/Modules/cellMic.cpp b/rpcs3/Emu/Cell/Modules/cellMic.cpp index e9775fac66..5bee6482e6 100644 --- a/rpcs3/Emu/Cell/Modules/cellMic.cpp +++ b/rpcs3/Emu/Cell/Modules/cellMic.cpp @@ -503,13 +503,13 @@ error_code cellMicInit() { cellMic.notice("cellMicInit()"); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (mic_thr.init) return CELL_MICIN_ERROR_ALREADY_INIT; - mic_thr->load_config_and_init(); - mic_thr->init = 1; + mic_thr.load_config_and_init(); + mic_thr.init = 1; return CELL_OK; } @@ -518,14 +518,14 @@ error_code cellMicEnd(ppu_thread& ppu) { cellMic.notice("cellMicEnd()"); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; // TODO - mic_thr->init = 0; - mic_thr->event_queue_key = 0; + mic_thr.init = 0; + mic_thr.event_queue_key = 0; return CELL_OK; } @@ -536,15 +536,15 @@ error_code cellMicOpen(s32 dev_num, s32 sampleRate) { cellMic.trace("cellMicOpen(dev_num=%d sampleRate=%d)", dev_num, sampleRate); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; - if (!mic_thr->mic_list.count(dev_num)) + if (!mic_thr.mic_list.count(dev_num)) return CELL_MICIN_ERROR_DEVICE_NOT_FOUND; - auto& device = mic_thr->mic_list.at(dev_num); + auto& device = mic_thr.mic_list.at(dev_num); if (device.is_opened()) return CELL_MICIN_ERROR_ALREADY_OPEN; @@ -556,15 +556,15 @@ error_code cellMicOpenRaw(s32 dev_num, s32 sampleRate, s32 maxChannels) { cellMic.trace("cellMicOpenRaw(dev_num=%d, sampleRate=%d, maxChannels=%d)", dev_num, sampleRate, maxChannels); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; - if (!mic_thr->mic_list.count(dev_num)) + if (!mic_thr.mic_list.count(dev_num)) return CELL_MICIN_ERROR_DEVICE_NOT_FOUND; - auto& device = mic_thr->mic_list.at(dev_num); + auto& device = mic_thr.mic_list.at(dev_num); if (device.is_opened()) return CELL_MICIN_ERROR_ALREADY_OPEN; @@ -577,15 +577,15 @@ error_code cellMicOpenEx(s32 dev_num, s32 rawSampleRate, s32 rawChannel, s32 DSP cellMic.trace("cellMicOpenEx(dev_num=%d, rawSampleRate=%d, rawChannel=%d, DSPSampleRate=%d, bufferSizeMS=%d, signalType=0x%x)", dev_num, rawSampleRate, rawChannel, DSPSampleRate, bufferSizeMS, signalType); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; - if (!mic_thr->mic_list.count(dev_num)) + if (!mic_thr.mic_list.count(dev_num)) return CELL_MICIN_ERROR_DEVICE_NOT_FOUND; - auto& device = mic_thr->mic_list.at(dev_num); + auto& device = mic_thr.mic_list.at(dev_num); if (device.is_opened()) return CELL_MICIN_ERROR_ALREADY_OPEN; @@ -599,15 +599,15 @@ u8 cellMicIsOpen(s32 dev_num) { cellMic.trace("cellMicIsOpen(dev_num=%d)", dev_num); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return false; - if (!mic_thr->mic_list.count(dev_num)) + if (!mic_thr.mic_list.count(dev_num)) return false; - return mic_thr->mic_list.at(dev_num).is_opened(); + return mic_thr.mic_list.at(dev_num).is_opened(); } s32 cellMicIsAttached(s32 dev_num) @@ -620,15 +620,15 @@ error_code cellMicClose(s32 dev_num) { cellMic.trace("cellMicClose(dev_num=%d)", dev_num); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; - if (!mic_thr->mic_list.count(dev_num)) + if (!mic_thr.mic_list.count(dev_num)) return CELL_MICIN_ERROR_DEVICE_NOT_FOUND; - auto& device = mic_thr->mic_list.at(dev_num); + auto& device = mic_thr.mic_list.at(dev_num); if (!device.is_opened()) return CELL_MICIN_ERROR_NOT_OPEN; @@ -642,15 +642,15 @@ error_code cellMicStart(s32 dev_num) { cellMic.trace("cellMicStart(dev_num=%d)", dev_num); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; - if (!mic_thr->mic_list.count(dev_num)) + if (!mic_thr.mic_list.count(dev_num)) return CELL_MICIN_ERROR_DEVICE_NOT_FOUND; - auto& device = mic_thr->mic_list.at(dev_num); + auto& device = mic_thr.mic_list.at(dev_num); if (!device.is_opened()) return CELL_MICIN_ERROR_NOT_OPEN; @@ -664,15 +664,15 @@ error_code cellMicStartEx(s32 dev_num, u32 iflags) // TODO: flags - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; - if (!mic_thr->mic_list.count(dev_num)) + if (!mic_thr.mic_list.count(dev_num)) return CELL_MICIN_ERROR_DEVICE_NOT_FOUND; - auto& device = mic_thr->mic_list.at(dev_num); + auto& device = mic_thr.mic_list.at(dev_num); if (!device.is_opened()) return CELL_MICIN_ERROR_NOT_OPEN; @@ -686,15 +686,15 @@ error_code cellMicStop(s32 dev_num) { cellMic.trace("cellMicStop(dev_num=%d)", dev_num); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; - if (!mic_thr->mic_list.count(dev_num)) + if (!mic_thr.mic_list.count(dev_num)) return CELL_MICIN_ERROR_DEVICE_NOT_FOUND; - auto& device = mic_thr->mic_list.at(dev_num); + auto& device = mic_thr.mic_list.at(dev_num); if (!device.is_opened()) return CELL_MICIN_ERROR_NOT_OPEN; @@ -716,15 +716,15 @@ error_code cellMicGetDeviceAttr(s32 dev_num, CellMicDeviceAttr deviceAttributes, if (!arg1 || (!arg2 && deviceAttributes == CELLMIC_DEVATTR_CHANVOL)) return CELL_MICIN_ERROR_PARAM; - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; - if (!mic_thr->mic_list.count(dev_num)) + if (!mic_thr.mic_list.count(dev_num)) return CELL_MICIN_ERROR_DEVICE_NOT_FOUND; - auto& device = mic_thr->mic_list.at(dev_num); + auto& device = mic_thr.mic_list.at(dev_num); switch (deviceAttributes) { @@ -744,15 +744,15 @@ error_code cellMicSetDeviceAttr(s32 dev_num, CellMicDeviceAttr deviceAttributes, { cellMic.trace("cellMicSetDeviceAttr(dev_num=%d, deviceAttributes=%d, arg1=%d, arg2=%d)", dev_num, +deviceAttributes, arg1, arg2); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; - if (!mic_thr->mic_list.count(dev_num)) + if (!mic_thr.mic_list.count(dev_num)) return CELL_MICIN_ERROR_DEVICE_NOT_FOUND; - auto& device = mic_thr->mic_list.at(dev_num); + auto& device = mic_thr.mic_list.at(dev_num); switch (deviceAttributes) { @@ -789,9 +789,9 @@ error_code cellMicGetSignalState(s32 dev_num, CellMicSignalState sig_state, vm:: { cellMic.todo("cellMicGetSignalState(dev_num=%d, sig_state=%d, value=*0x%x)", dev_num, +sig_state, value); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; be_t* ival = vm::_ptr(value.addr()); @@ -827,15 +827,15 @@ error_code cellMicGetFormatRaw(s32 dev_num, vm::ptr format) { cellMic.trace("cellMicGetFormatRaw(dev_num=%d, format=0x%x)", dev_num, format); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; - if (!mic_thr->mic_list.count(dev_num)) + if (!mic_thr.mic_list.count(dev_num)) return CELL_MICIN_ERROR_DEVICE_NOT_FOUND; - auto& device = mic_thr->mic_list.at(dev_num); + auto& device = mic_thr.mic_list.at(dev_num); format->subframeSize = device.get_bit_resolution() / 8; // Probably? format->bitResolution = device.get_bit_resolution(); @@ -866,9 +866,9 @@ error_code cellMicSetNotifyEventQueue(u64 key) { cellMic.todo("cellMicSetNotifyEventQueue(key=0x%llx)", key); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; // default mic queue size = 4 @@ -876,9 +876,9 @@ error_code cellMicSetNotifyEventQueue(u64 key) if (!mic_queue) return CELL_MICIN_ERROR_EVENT_QUEUE; - mic_thr->event_queue_key = key; + mic_thr.event_queue_key = key; - for (auto& mic_entry : mic_thr->mic_list) + for (auto& mic_entry : mic_thr.mic_list) { mic_queue->send(0, CELLMIC_ATTACH, mic_entry.first, 0); } @@ -891,9 +891,9 @@ error_code cellMicSetNotifyEventQueue2(u64 key, u64 source, u64 flag) // TODO: Actually do things with the source variable cellMic.todo("cellMicSetNotifyEventQueue2(key=0x%llx, source=0x%llx, flag=0x%llx", key, source, flag); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; // default mic queue size = 4 @@ -902,7 +902,7 @@ error_code cellMicSetNotifyEventQueue2(u64 key, u64 source, u64 flag) return CELL_MICIN_ERROR_EVENT_QUEUE; mic_queue->send(0, CELLMIC_ATTACH, 0, 0); - mic_thr->event_queue_key = key; + mic_thr.event_queue_key = key; return CELL_OK; } @@ -911,12 +911,12 @@ error_code cellMicRemoveNotifyEventQueue(u64 key) { cellMic.warning("cellMicRemoveNotifyEventQueue(key=0x%llx)", key); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; - mic_thr->event_queue_key = 0; + mic_thr.event_queue_key = 0; return CELL_OK; } @@ -927,15 +927,15 @@ error_code cellMicReadRaw(s32 dev_num, vm::ptr data, s32 max_bytes) { cellMic.trace("cellMicReadRaw(dev_num=%d, data=0x%x, maxBytes=%d)", dev_num, data, max_bytes); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; - if (!mic_thr->mic_list.count(dev_num)) + if (!mic_thr.mic_list.count(dev_num)) return CELL_MICIN_ERROR_DEVICE_NOT_FOUND; - auto& mic = mic_thr->mic_list.at(dev_num); + auto& mic = mic_thr.mic_list.at(dev_num); if (!mic.is_opened() || !(mic.get_signal_types() & CELLMIC_SIGTYPE_RAW)) return CELL_MICIN_ERROR_NOT_OPEN; @@ -947,15 +947,15 @@ error_code cellMicRead(s32 dev_num, vm::ptr data, u32 max_bytes) { cellMic.todo("cellMicRead(dev_num=%d, data=0x%x, maxBytes=0x%x)", dev_num, data, max_bytes); - const auto mic_thr = g_fxo->get(); - const std::lock_guard lock(mic_thr->mutex); - if (!mic_thr->init) + auto& mic_thr = g_fxo->get(); + const std::lock_guard lock(mic_thr.mutex); + if (!mic_thr.init) return CELL_MICIN_ERROR_NOT_INIT; - if (!mic_thr->mic_list.count(dev_num)) + if (!mic_thr.mic_list.count(dev_num)) return CELL_MICIN_ERROR_DEVICE_NOT_FOUND; - auto& mic = mic_thr->mic_list.at(dev_num); + auto& mic = mic_thr.mic_list.at(dev_num); if (!mic.is_opened() || !(mic.get_signal_types() & CELLMIC_SIGTYPE_DSP)) return CELL_MICIN_ERROR_NOT_OPEN; diff --git a/rpcs3/Emu/Cell/Modules/cellMouse.cpp b/rpcs3/Emu/Cell/Modules/cellMouse.cpp index f5bc71e2af..dcfe32b2d1 100644 --- a/rpcs3/Emu/Cell/Modules/cellMouse.cpp +++ b/rpcs3/Emu/Cell/Modules/cellMouse.cpp @@ -36,9 +36,9 @@ error_code cellMouseInit(u32 max_connect) { sys_io.warning("cellMouseInit(max_connect=%d)", max_connect); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.init(); + const auto init = handler.init.init(); if (!init) return CELL_MOUSE_ERROR_ALREADY_INITIALIZED; @@ -49,7 +49,7 @@ error_code cellMouseInit(u32 max_connect) } libio_sys_config_init(); - handler->Init(std::min(max_connect, 7u)); + handler.Init(std::min(max_connect, 7u)); return CELL_OK; } @@ -58,9 +58,9 @@ error_code cellMouseClearBuf(u32 port_no) { sys_io.trace("cellMouseClearBuf(port_no=%d)", port_no); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.access(); + const auto init = handler.init.access(); if (!init) return CELL_MOUSE_ERROR_UNINITIALIZED; @@ -70,17 +70,17 @@ error_code cellMouseClearBuf(u32 port_no) return CELL_MOUSE_ERROR_INVALID_PARAMETER; } - const MouseInfo& current_info = handler->GetInfo(); + const MouseInfo& current_info = handler.GetInfo(); - if (port_no >= handler->GetMice().size() || current_info.status[port_no] != CELL_MOUSE_STATUS_CONNECTED) + if (port_no >= handler.GetMice().size() || current_info.status[port_no] != CELL_MOUSE_STATUS_CONNECTED) { return CELL_MOUSE_ERROR_NO_DEVICE; } - handler->GetDataList(port_no).clear(); - handler->GetTabletDataList(port_no).clear(); + handler.GetDataList(port_no).clear(); + handler.GetTabletDataList(port_no).clear(); - MouseRawData& raw_data = handler->GetRawData(port_no); + MouseRawData& raw_data = handler.GetRawData(port_no); raw_data.len = 0; for (int i = 0; i < CELL_MOUSE_MAX_CODES; i++) @@ -95,9 +95,9 @@ error_code cellMouseEnd() { sys_io.notice("cellMouseEnd()"); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.reset(); + const auto init = handler.init.reset(); if (!init) return CELL_MOUSE_ERROR_UNINITIALIZED; @@ -111,9 +111,9 @@ error_code cellMouseGetInfo(vm::ptr info) { sys_io.trace("cellMouseGetInfo(info=*0x%x)", info); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.access(); + const auto init = handler.init.access(); if (!init) return CELL_MOUSE_ERROR_UNINITIALIZED; @@ -125,7 +125,7 @@ error_code cellMouseGetInfo(vm::ptr info) std::memset(info.get_ptr(), 0, info.size()); - const MouseInfo& current_info = handler->GetInfo(); + const MouseInfo& current_info = handler.GetInfo(); info->max_connect = current_info.max_connect; info->now_connect = current_info.now_connect; info->info = current_info.info; @@ -144,9 +144,9 @@ error_code cellMouseInfoTabletMode(u32 port_no, vm::ptr inf { sys_io.trace("cellMouseInfoTabletMode(port_no=%d, info=*0x%x)", port_no, info); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.access(); + const auto init = handler.init.access(); if (!init) return CELL_MOUSE_ERROR_UNINITIALIZED; @@ -157,9 +157,9 @@ error_code cellMouseInfoTabletMode(u32 port_no, vm::ptr inf return CELL_MOUSE_ERROR_INVALID_PARAMETER; } - const MouseInfo& current_info = handler->GetInfo(); + const MouseInfo& current_info = handler.GetInfo(); - if (port_no >= handler->GetMice().size() || current_info.status[port_no] != CELL_MOUSE_STATUS_CONNECTED) + if (port_no >= handler.GetMice().size() || current_info.status[port_no] != CELL_MOUSE_STATUS_CONNECTED) { return CELL_MOUSE_ERROR_FATAL; } @@ -181,9 +181,9 @@ error_code cellMouseGetData(u32 port_no, vm::ptr data) { sys_io.trace("cellMouseGetData(port_no=%d, data=*0x%x)", port_no, data); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.access(); + const auto init = handler.init.access(); if (!init) return CELL_MOUSE_ERROR_UNINITIALIZED; @@ -193,11 +193,11 @@ error_code cellMouseGetData(u32 port_no, vm::ptr data) return CELL_MOUSE_ERROR_INVALID_PARAMETER; } - std::lock_guard lock(handler->mutex); + std::lock_guard lock(handler.mutex); - const MouseInfo& current_info = handler->GetInfo(); + const MouseInfo& current_info = handler.GetInfo(); - if (port_no >= handler->GetMice().size() || current_info.status[port_no] != CELL_MOUSE_STATUS_CONNECTED) + if (port_no >= handler.GetMice().size() || current_info.status[port_no] != CELL_MOUSE_STATUS_CONNECTED) { return CELL_MOUSE_ERROR_NO_DEVICE; } @@ -206,7 +206,7 @@ error_code cellMouseGetData(u32 port_no, vm::ptr data) // TODO: check if (current_info.mode[port_no] != CELL_MOUSE_INFO_TABLET_MOUSE_MODE) has any impact - MouseDataList& data_list = handler->GetDataList(port_no); + MouseDataList& data_list = handler.GetDataList(port_no); if (data_list.empty()) { @@ -230,9 +230,9 @@ error_code cellMouseGetDataList(u32 port_no, vm::ptr data) { sys_io.warning("cellMouseGetDataList(port_no=%d, data=0x%x)", port_no, data); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.access(); + const auto init = handler.init.access(); if (!init) return CELL_MOUSE_ERROR_UNINITIALIZED; @@ -242,18 +242,18 @@ error_code cellMouseGetDataList(u32 port_no, vm::ptr data) return CELL_MOUSE_ERROR_INVALID_PARAMETER; } - std::lock_guard lock(handler->mutex); + std::lock_guard lock(handler.mutex); - const MouseInfo& current_info = handler->GetInfo(); + const MouseInfo& current_info = handler.GetInfo(); - if (port_no >= handler->GetMice().size() || current_info.status[port_no] != CELL_MOUSE_STATUS_CONNECTED) + if (port_no >= handler.GetMice().size() || current_info.status[port_no] != CELL_MOUSE_STATUS_CONNECTED) { return CELL_MOUSE_ERROR_NO_DEVICE; } // TODO: check if (current_info.mode[port_no] != CELL_MOUSE_INFO_TABLET_MOUSE_MODE) has any impact - auto& list = handler->GetDataList(port_no); + auto& list = handler.GetDataList(port_no); data->list_num = std::min(CELL_MOUSE_MAX_DATA_LIST_NUM, static_cast(list.size())); int i = 0; @@ -276,9 +276,9 @@ error_code cellMouseSetTabletMode(u32 port_no, u32 mode) { sys_io.warning("cellMouseSetTabletMode(port_no=%d, mode=%d)", port_no, mode); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.access(); + const auto init = handler.init.access(); if (!init) return CELL_MOUSE_ERROR_UNINITIALIZED; @@ -289,9 +289,9 @@ error_code cellMouseSetTabletMode(u32 port_no, u32 mode) return CELL_MOUSE_ERROR_INVALID_PARAMETER; } - MouseInfo& current_info = handler->GetInfo(); + MouseInfo& current_info = handler.GetInfo(); - if (port_no >= handler->GetMice().size() || current_info.status[port_no] != CELL_MOUSE_STATUS_CONNECTED) + if (port_no >= handler.GetMice().size() || current_info.status[port_no] != CELL_MOUSE_STATUS_CONNECTED) { return CELL_MOUSE_ERROR_FATAL; } @@ -312,9 +312,9 @@ error_code cellMouseGetTabletDataList(u32 port_no, vm::ptrget(); + auto& handler = g_fxo->get(); - const auto init = handler->init.access(); + const auto init = handler.init.access(); if (!init) return CELL_MOUSE_ERROR_UNINITIALIZED; @@ -324,9 +324,9 @@ error_code cellMouseGetTabletDataList(u32 port_no, vm::ptrGetInfo(); + const MouseInfo& current_info = handler.GetInfo(); - if (port_no >= handler->GetMice().size() || current_info.status[port_no] != CELL_MOUSE_STATUS_CONNECTED) + if (port_no >= handler.GetMice().size() || current_info.status[port_no] != CELL_MOUSE_STATUS_CONNECTED) { return CELL_MOUSE_ERROR_NO_DEVICE; } @@ -334,7 +334,7 @@ error_code cellMouseGetTabletDataList(u32 port_no, vm::ptrGetTabletDataList(port_no); + auto& list = handler.GetTabletDataList(port_no); data->list_num = std::min(CELL_MOUSE_MAX_DATA_LIST_NUM, static_cast(list.size())); int i = 0; @@ -357,9 +357,9 @@ error_code cellMouseGetRawData(u32 port_no, vm::ptr data) { sys_io.warning("cellMouseGetRawData(port_no=%d, data=*0x%x)", port_no, data); - const auto handler = g_fxo->get(); + auto& handler = g_fxo->get(); - const auto init = handler->init.access(); + const auto init = handler.init.access(); if (!init) return CELL_MOUSE_ERROR_UNINITIALIZED; @@ -369,9 +369,9 @@ error_code cellMouseGetRawData(u32 port_no, vm::ptr data) return CELL_MOUSE_ERROR_INVALID_PARAMETER; } - const MouseInfo& current_info = handler->GetInfo(); + const MouseInfo& current_info = handler.GetInfo(); - if (port_no >= handler->GetMice().size() || current_info.status[port_no] != CELL_MOUSE_STATUS_CONNECTED) + if (port_no >= handler.GetMice().size() || current_info.status[port_no] != CELL_MOUSE_STATUS_CONNECTED) { return CELL_MOUSE_ERROR_NO_DEVICE; } @@ -379,7 +379,7 @@ error_code cellMouseGetRawData(u32 port_no, vm::ptr data) // TODO: decr tests show that CELL_MOUSE_ERROR_DATA_READ_FAILED is returned when a mouse is connected // TODO: check if (current_info.mode[port_no] != CELL_MOUSE_INFO_TABLET_MOUSE_MODE) has any impact - MouseRawData& current_data = handler->GetRawData(port_no); + MouseRawData& current_data = handler.GetRawData(port_no); data->len = current_data.len; current_data.len = 0; diff --git a/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp b/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp index d419e82703..0ee889f5fa 100644 --- a/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp +++ b/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp @@ -119,7 +119,7 @@ struct msg_dlg_thread_info dlg->close(true, true); } } - else if (const auto dlg = g_fxo->get()->get()) + else if (const auto dlg = g_fxo->get().get()) { if (!wait_until.compare_and_swap_test(new_value, 0)) { @@ -173,7 +173,7 @@ error_code open_msg_dialog(bool is_blocking, u32 type, vm::cptr msgString, return res; } - const auto dlg = g_fxo->get()->make(); + const auto dlg = g_fxo->get().make(); if (!dlg) { @@ -197,8 +197,8 @@ error_code open_msg_dialog(bool is_blocking, u32 type, vm::cptr msgString, }); } - g_fxo->get()->wait_until = 0; - g_fxo->get()->remove(); + g_fxo->get().wait_until = 0; + g_fxo->get().remove(); } input::SetIntercepted(false); @@ -234,7 +234,7 @@ error_code open_msg_dialog(bool is_blocking, u32 type, vm::cptr msgString, if (is_blocking) { - while (auto dlg = g_fxo->get()->get()) + while (auto dlg = g_fxo->get().get()) { if (Emu.IsStopped() || dlg->state != MsgDialogState::Open) { @@ -437,25 +437,25 @@ error_code cellMsgDialogClose(f32 delay) { if (auto dlg = manager->get()) { - const auto thr = g_fxo->get(); - thr->wait_until = wait_until; - thr->wait_until.notify_one(); + auto& thr = g_fxo->get(); + thr.wait_until = wait_until; + thr.wait_until.notify_one(); return CELL_OK; } return CELL_MSGDIALOG_ERROR_DIALOG_NOT_OPENED; } - const auto dlg = g_fxo->get()->get(); + const auto dlg = g_fxo->get().get(); if (!dlg) { return CELL_MSGDIALOG_ERROR_DIALOG_NOT_OPENED; } - const auto thr = g_fxo->get(); - thr->wait_until = wait_until; - thr->wait_until.notify_one(); + auto& thr = g_fxo->get(); + thr.wait_until = wait_until; + thr.wait_until.notify_one(); return CELL_OK; } @@ -467,13 +467,13 @@ error_code cellMsgDialogAbort() { if (auto dlg = manager->get()) { - g_fxo->get()->wait_until = 0; + g_fxo->get().wait_until = 0; dlg->close(false, true); return CELL_OK; } } - const auto dlg = g_fxo->get()->get(); + const auto dlg = g_fxo->get().get(); if (!dlg) { @@ -485,8 +485,8 @@ error_code cellMsgDialogAbort() return CELL_SYSUTIL_ERROR_BUSY; } - g_fxo->get()->wait_until = 0; - g_fxo->get()->remove(); // this shouldn't call on_close + g_fxo->get().wait_until = 0; + g_fxo->get().remove(); // this shouldn't call on_close input::SetIntercepted(false); // so we need to reenable the pads here return CELL_OK; @@ -522,7 +522,7 @@ error_code cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, vm::cptr m } } - const auto dlg = g_fxo->get()->get(); + const auto dlg = g_fxo->get().get(); if (!dlg) { @@ -554,7 +554,7 @@ error_code cellMsgDialogProgressBarReset(u32 progressBarIndex) } } - const auto dlg = g_fxo->get()->get(); + const auto dlg = g_fxo->get().get(); if (!dlg) { @@ -586,7 +586,7 @@ error_code cellMsgDialogProgressBarInc(u32 progressBarIndex, u32 delta) } } - const auto dlg = g_fxo->get()->get(); + const auto dlg = g_fxo->get().get(); if (!dlg) { diff --git a/rpcs3/Emu/Cell/Modules/cellMusic.cpp b/rpcs3/Emu/Cell/Modules/cellMusic.cpp index 39ced09fb6..cb70d68a04 100644 --- a/rpcs3/Emu/Cell/Modules/cellMusic.cpp +++ b/rpcs3/Emu/Cell/Modules/cellMusic.cpp @@ -84,14 +84,14 @@ error_code cellMusicSetSelectionContext2(vm::ptr cont if (!context) return CELL_MUSIC2_ERROR_PARAM; - const auto music = g_fxo->get(); + auto& music = g_fxo->get(); - if (!music->func) + if (!music.func) return CELL_MUSIC2_ERROR_GENERIC; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 { - music->func(ppu, CELL_MUSIC2_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(CELL_OK), music->userData); + music.func(ppu, CELL_MUSIC2_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(CELL_OK), music.userData); return CELL_OK; }); @@ -104,14 +104,14 @@ error_code cellMusicSetVolume2(f32 level) level = std::clamp(level, 0.0f, 1.0f); - const auto music = g_fxo->get(); + auto& music = g_fxo->get(); - if (!music->func) + if (!music.func) return CELL_MUSIC2_ERROR_GENERIC; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 { - music->func(ppu, CELL_MUSIC2_EVENT_SET_VOLUME_RESULT, vm::addr_t(CELL_OK), music->userData); + music.func(ppu, CELL_MUSIC2_EVENT_SET_VOLUME_RESULT, vm::addr_t(CELL_OK), music.userData); return CELL_OK; }); @@ -135,14 +135,14 @@ error_code cellMusicSetSelectionContext(vm::ptr conte if (!context) return CELL_MUSIC_ERROR_PARAM; - const auto music = g_fxo->get(); + auto& music = g_fxo->get(); - if (!music->func) + if (!music.func) return CELL_MUSIC_ERROR_GENERIC; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 { - music->func(ppu, CELL_MUSIC_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(CELL_OK), music->userData); + music.func(ppu, CELL_MUSIC_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(CELL_OK), music.userData); return CELL_OK; }); @@ -162,13 +162,13 @@ error_code cellMusicInitialize2SystemWorkload(s32 mode, vm::ptrget(); - music->func = func; - music->userData = userData; + auto& music = g_fxo->get(); + music.func = func; + music.userData = userData; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 { - music->func(ppu, CELL_MUSIC2_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); + music.func(ppu, CELL_MUSIC2_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); return CELL_OK; }); @@ -199,13 +199,13 @@ error_code cellMusicFinalize() { cellMusic.todo("cellMusicFinalize()"); - const auto music = g_fxo->get(); + auto& music = g_fxo->get(); - if (music->func) + if (music.func) { - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 { - music->func(ppu, CELL_MUSIC_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), music->userData); + music.func(ppu, CELL_MUSIC_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), music.userData); return CELL_OK; }); } @@ -226,13 +226,13 @@ error_code cellMusicInitializeSystemWorkload(s32 mode, u32 container, vm::ptrget(); - music->func = func; - music->userData = userData; + auto& music = g_fxo->get(); + music.func = func; + music.userData = userData; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 { - music->func(ppu, CELL_MUSIC_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); + music.func(ppu, CELL_MUSIC_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); return CELL_OK; }); @@ -252,13 +252,13 @@ error_code cellMusicInitialize(s32 mode, u32 container, s32 spuPriority, vm::ptr return CELL_MUSIC_ERROR_PARAM; } - const auto music = g_fxo->get(); - music->func = func; - music->userData = userData; + auto& music = g_fxo->get(); + music.func = func; + music.userData = userData; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 { - music->func(ppu, CELL_MUSIC_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); + music.func(ppu, CELL_MUSIC_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); return CELL_OK; }); @@ -269,13 +269,13 @@ error_code cellMusicFinalize2() { cellMusic.todo("cellMusicFinalize2()"); - const auto music = g_fxo->get(); + auto& music = g_fxo->get(); - if (music->func) + if (music.func) { - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 { - music->func(ppu, CELL_MUSIC2_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), music->userData); + music.func(ppu, CELL_MUSIC2_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), music.userData); return CELL_OK; }); } @@ -320,14 +320,14 @@ error_code cellMusicSetPlaybackCommand2(s32 command, vm::ptr param) if (command < CELL_MUSIC_PB_CMD_STOP || command > CELL_MUSIC_PB_CMD_FASTREVERSE) return CELL_MUSIC2_ERROR_PARAM; - const auto music = g_fxo->get(); + auto& music = g_fxo->get(); - if (!music->func) + if (!music.func) return CELL_MUSIC2_ERROR_GENERIC; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 { - music->func(ppu, CELL_MUSIC2_EVENT_SET_PLAYBACK_COMMAND_RESULT, vm::addr_t(CELL_OK), music->userData); + music.func(ppu, CELL_MUSIC2_EVENT_SET_PLAYBACK_COMMAND_RESULT, vm::addr_t(CELL_OK), music.userData); return CELL_OK; }); @@ -341,14 +341,14 @@ error_code cellMusicSetPlaybackCommand(s32 command, vm::ptr param) if (command < CELL_MUSIC_PB_CMD_STOP || command > CELL_MUSIC_PB_CMD_FASTREVERSE) return CELL_MUSIC_ERROR_PARAM; - const auto music = g_fxo->get(); + auto& music = g_fxo->get(); - if (!music->func) + if (!music.func) return CELL_MUSIC_ERROR_GENERIC; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 { - music->func(ppu, CELL_MUSIC_EVENT_SET_PLAYBACK_COMMAND_RESULT, vm::addr_t(CELL_OK), music->userData); + music.func(ppu, CELL_MUSIC_EVENT_SET_PLAYBACK_COMMAND_RESULT, vm::addr_t(CELL_OK), music.userData); return CELL_OK; }); @@ -359,14 +359,14 @@ error_code cellMusicSelectContents2() { cellMusic.todo("cellMusicSelectContents2()"); - const auto music = g_fxo->get(); + auto& music = g_fxo->get(); - if (!music->func) + if (!music.func) return CELL_MUSIC2_ERROR_GENERIC; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 { - music->func(ppu, CELL_MUSIC2_EVENT_SELECT_CONTENTS_RESULT, vm::addr_t(CELL_OK), music->userData); + music.func(ppu, CELL_MUSIC2_EVENT_SELECT_CONTENTS_RESULT, vm::addr_t(CELL_OK), music.userData); return CELL_OK; }); @@ -377,14 +377,14 @@ error_code cellMusicSelectContents(u32 container) { cellMusic.todo("cellMusicSelectContents(container=0x%x)", container); - const auto music = g_fxo->get(); + auto& music = g_fxo->get(); - if (!music->func) + if (!music.func) return CELL_MUSIC_ERROR_GENERIC; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 { - music->func(ppu, CELL_MUSIC_EVENT_SELECT_CONTENTS_RESULT, vm::addr_t(CELL_OK), music->userData); + music.func(ppu, CELL_MUSIC_EVENT_SELECT_CONTENTS_RESULT, vm::addr_t(CELL_OK), music.userData); return CELL_OK; }); @@ -404,13 +404,13 @@ error_code cellMusicInitialize2(s32 mode, s32 spuPriority, vm::ptrget(); - music->func = func; - music->userData = userData; + auto& music = g_fxo->get(); + music.func = func; + music.userData = userData; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 { - music->func(ppu, CELL_MUSIC2_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); + music.func(ppu, CELL_MUSIC2_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); return CELL_OK; }); @@ -423,14 +423,14 @@ error_code cellMusicSetVolume(f32 level) level = std::clamp(level, 0.0f, 1.0f); - const auto music = g_fxo->get(); + auto& music = g_fxo->get(); - if (!music->func) + if (!music.func) return CELL_MUSIC_ERROR_GENERIC; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 { - music->func(ppu, CELL_MUSIC_EVENT_SET_VOLUME_RESULT, vm::addr_t(CELL_OK), music->userData); + music.func(ppu, CELL_MUSIC_EVENT_SET_VOLUME_RESULT, vm::addr_t(CELL_OK), music.userData); return CELL_OK; }); diff --git a/rpcs3/Emu/Cell/Modules/cellMusicDecode.cpp b/rpcs3/Emu/Cell/Modules/cellMusicDecode.cpp index 9815124518..4c7b7699f6 100644 --- a/rpcs3/Emu/Cell/Modules/cellMusicDecode.cpp +++ b/rpcs3/Emu/Cell/Modules/cellMusicDecode.cpp @@ -99,13 +99,13 @@ error_code cellMusicDecodeInitialize(s32 mode, u32 container, s32 spuPriority, v { cellMusicDecode.todo("cellMusicDecodeInitialize(mode=0x%x, container=0x%x, spuPriority=0x%x, func=*0x%x, userData=*0x%x)", mode, container, spuPriority, func, userData); - const auto musicDecode = g_fxo->get(); - musicDecode->func = func; - musicDecode->userData = userData; + auto& dec = g_fxo->get(); + dec.func = func; + dec.userData = userData; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &dec](ppu_thread& ppu) -> s32 { - musicDecode->func(ppu, CELL_MUSIC_DECODE_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); return CELL_OK; }); @@ -116,13 +116,13 @@ error_code cellMusicDecodeInitializeSystemWorkload(s32 mode, u32 container, vm:: { cellMusicDecode.todo("cellMusicDecodeInitializeSystemWorkload(mode=0x%x, container=0x%x, func=*0x%x, userData=*0x%x, spuUsageRate=0x%x, spurs=*0x%x, priority=*0x%x, attr=*0x%x)", mode, container, func, userData, spuUsageRate, spurs, priority, attr); - const auto musicDecode = g_fxo->get(); - musicDecode->func = func; - musicDecode->userData = userData; + auto& dec = g_fxo->get(); + dec.func = func; + dec.userData = userData; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &dec](ppu_thread& ppu) -> s32 { - musicDecode->func(ppu, CELL_MUSIC_DECODE_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); return CELL_OK; }); @@ -133,13 +133,13 @@ error_code cellMusicDecodeFinalize() { cellMusicDecode.todo("cellMusicDecodeFinalize()"); - const auto musicDecode = g_fxo->get(); + auto& dec = g_fxo->get(); - if (musicDecode->func) + if (dec.func) { - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &dec](ppu_thread& ppu) -> s32 { - musicDecode->func(ppu, CELL_MUSIC_DECODE_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), musicDecode->userData); + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), dec.userData); return CELL_OK; }); } @@ -151,14 +151,14 @@ error_code cellMusicDecodeSelectContents() { cellMusicDecode.todo("cellMusicDecodeSelectContents()"); - const auto musicDecode = g_fxo->get(); + auto& dec = g_fxo->get(); - if (!musicDecode->func) + if (!dec.func) return CELL_MUSIC_DECODE_ERROR_GENERIC; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &dec](ppu_thread& ppu) -> s32 { - musicDecode->func(ppu, CELL_MUSIC_DECODE_EVENT_SELECT_CONTENTS_RESULT, vm::addr_t(CELL_OK), musicDecode->userData); + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_SELECT_CONTENTS_RESULT, vm::addr_t(CELL_OK), dec.userData); return CELL_OK; }); @@ -169,14 +169,14 @@ error_code cellMusicDecodeSetDecodeCommand(s32 command) { cellMusicDecode.todo("cellMusicDecodeSetDecodeCommand(command=0x%x)", command); - const auto musicDecode = g_fxo->get(); + auto& dec = g_fxo->get(); - if (!musicDecode->func) + if (!dec.func) return CELL_MUSIC_DECODE_ERROR_GENERIC; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &dec](ppu_thread& ppu) -> s32 { - musicDecode->func(ppu, CELL_MUSIC_DECODE_EVENT_SET_DECODE_COMMAND_RESULT, vm::addr_t(CELL_OK), musicDecode->userData); + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_SET_DECODE_COMMAND_RESULT, vm::addr_t(CELL_OK), dec.userData); return CELL_OK; }); @@ -205,14 +205,14 @@ error_code cellMusicDecodeSetSelectionContext(vm::ptr { cellMusicDecode.todo("cellMusicDecodeSetSelectionContext(context=*0x%x)", context); - const auto musicDecode = g_fxo->get(); + auto& dec = g_fxo->get(); - if (!musicDecode->func) + if (!dec.func) return CELL_MUSIC_DECODE_ERROR_GENERIC; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &dec](ppu_thread& ppu) -> s32 { - musicDecode->func(ppu, CELL_MUSIC_DECODE_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(CELL_OK), musicDecode->userData); + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(CELL_OK), dec.userData); return CELL_OK; }); @@ -229,13 +229,13 @@ error_code cellMusicDecodeInitialize2(s32 mode, u32 container, s32 spuPriority, { cellMusicDecode.todo("cellMusicDecodeInitialize2(mode=0x%x, container=0x%x, spuPriority=0x%x, func=*0x%x, userData=*0x%x, speed=0x%x, bufsize=0x%x)", mode, container, spuPriority, func, userData, speed, bufsize); - const auto musicDecode = g_fxo->get(); - musicDecode->func = func; - musicDecode->userData = userData; + auto& dec = g_fxo->get(); + dec.func = func; + dec.userData = userData; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &dec](ppu_thread& ppu) -> s32 { - musicDecode->func(ppu, CELL_MUSIC_DECODE2_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); + dec.func(ppu, CELL_MUSIC_DECODE2_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); return CELL_OK; }); @@ -246,13 +246,13 @@ error_code cellMusicDecodeInitialize2SystemWorkload(s32 mode, u32 container, vm: { cellMusicDecode.todo("cellMusicDecodeInitialize2SystemWorkload(mode=0x%x, container=0x%x, func=*0x%x, userData=*0x%x, spuUsageRate=0x%x, bufsize=0x%x, spurs=*0x%x, priority=*0x%x, attr=*0x%x)", mode, container, func, userData, spuUsageRate, bufsize, spurs, priority, attr); - const auto musicDecode = g_fxo->get(); - musicDecode->func = func; - musicDecode->userData = userData; + auto& dec = g_fxo->get(); + dec.func = func; + dec.userData = userData; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &dec](ppu_thread& ppu) -> s32 { - musicDecode->func(ppu, CELL_MUSIC_DECODE2_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); + dec.func(ppu, CELL_MUSIC_DECODE2_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); return CELL_OK; }); @@ -263,13 +263,13 @@ error_code cellMusicDecodeFinalize2() { cellMusicDecode.todo("cellMusicDecodeFinalize2()"); - const auto musicDecode = g_fxo->get(); + auto& dec = g_fxo->get(); - if (musicDecode->func) + if (dec.func) { - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &dec](ppu_thread& ppu) -> s32 { - musicDecode->func(ppu, CELL_MUSIC_DECODE2_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), musicDecode->userData); + dec.func(ppu, CELL_MUSIC_DECODE2_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), dec.userData); return CELL_OK; }); } @@ -281,14 +281,14 @@ error_code cellMusicDecodeSelectContents2() { cellMusicDecode.todo("cellMusicDecodeSelectContents2()"); - const auto musicDecode = g_fxo->get(); + auto& dec = g_fxo->get(); - if (!musicDecode->func) + if (!dec.func) return CELL_MUSIC_DECODE_ERROR_GENERIC; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &dec](ppu_thread& ppu) -> s32 { - musicDecode->func(ppu, CELL_MUSIC_DECODE2_EVENT_SELECT_CONTENTS_RESULT, vm::addr_t(CELL_OK), musicDecode->userData); + dec.func(ppu, CELL_MUSIC_DECODE2_EVENT_SELECT_CONTENTS_RESULT, vm::addr_t(CELL_OK), dec.userData); return CELL_OK; }); @@ -299,14 +299,14 @@ error_code cellMusicDecodeSetDecodeCommand2(s32 command) { cellMusicDecode.todo("cellMusicDecodeSetDecodeCommand2(command=0x%x)", command); - const auto musicDecode = g_fxo->get(); + auto& dec = g_fxo->get(); - if (!musicDecode->func) + if (!dec.func) return CELL_MUSIC_DECODE_ERROR_GENERIC; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &dec](ppu_thread& ppu) -> s32 { - musicDecode->func(ppu, CELL_MUSIC_DECODE2_EVENT_SET_DECODE_COMMAND_RESULT, vm::addr_t(CELL_OK), musicDecode->userData); + dec.func(ppu, CELL_MUSIC_DECODE2_EVENT_SET_DECODE_COMMAND_RESULT, vm::addr_t(CELL_OK), dec.userData); return CELL_OK; }); @@ -335,14 +335,14 @@ error_code cellMusicDecodeSetSelectionContext2(vm::ptrget(); + auto& dec = g_fxo->get(); - if (!musicDecode->func) + if (!dec.func) return CELL_MUSIC_DECODE_ERROR_GENERIC; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &dec](ppu_thread& ppu) -> s32 { - musicDecode->func(ppu, CELL_MUSIC_DECODE2_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(CELL_OK), musicDecode->userData); + dec.func(ppu, CELL_MUSIC_DECODE2_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(CELL_OK), dec.userData); return CELL_OK; }); diff --git a/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp b/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp index 112319cc8c..a7186cd804 100644 --- a/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp +++ b/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp @@ -96,14 +96,14 @@ error_code cellNetCtlInit() { cellNetCtl.warning("cellNetCtlInit()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (nph->is_netctl_init) + if (nph.is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_TERMINATED; } - nph->is_netctl_init = true; + nph.is_netctl_init = true; return CELL_OK; } @@ -112,17 +112,18 @@ void cellNetCtlTerm() { cellNetCtl.warning("cellNetCtlTerm()"); - const auto nph = g_fxo->get>(); - nph->is_netctl_init = false; + auto& nph = g_fxo->get>(); + + nph.is_netctl_init = false; } error_code cellNetCtlGetState(vm::ptr state) { cellNetCtl.trace("cellNetCtlGetState(state=*0x%x)", state); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_netctl_init) + if (!nph.is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_INITIALIZED; } @@ -132,7 +133,7 @@ error_code cellNetCtlGetState(vm::ptr state) return CELL_NET_CTL_ERROR_INVALID_ADDR; } - *state = nph->get_net_status(); + *state = nph.get_net_status(); return CELL_OK; } @@ -141,9 +142,9 @@ error_code cellNetCtlAddHandler(vm::ptr handler, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_netctl_init) + if (!nph.is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_INITIALIZED; } @@ -160,9 +161,9 @@ error_code cellNetCtlDelHandler(s32 hid) { cellNetCtl.todo("cellNetCtlDelHandler(hid=0x%x)", hid); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_netctl_init) + if (!nph.is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_INITIALIZED; } @@ -179,9 +180,9 @@ error_code cellNetCtlGetInfo(s32 code, vm::ptr info) { cellNetCtl.warning("cellNetCtlGetInfo(code=0x%x (%s), info=*0x%x)", code, InfoCodeToName(code), info); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_netctl_init) + if (!nph.is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_INITIALIZED; } @@ -193,11 +194,11 @@ error_code cellNetCtlGetInfo(s32 code, vm::ptr info) if (code == CELL_NET_CTL_INFO_ETHER_ADDR) { - memcpy(info->ether_addr.data, nph->get_ether_addr().data(), 6); + memcpy(info->ether_addr.data, nph.get_ether_addr().data(), 6); return CELL_OK; } - if (nph->get_net_status() == CELL_NET_CTL_STATE_Disconnected) + if (nph.get_net_status() == CELL_NET_CTL_STATE_Disconnected) { return CELL_NET_CTL_ERROR_NOT_CONNECTED; } @@ -211,12 +212,12 @@ error_code cellNetCtlGetInfo(s32 code, vm::ptr info) case CELL_NET_CTL_INFO_LINK_TYPE: info->link_type = CELL_NET_CTL_LINK_TYPE_10BASE_FULL; break; case CELL_NET_CTL_INFO_IP_CONFIG: info->ip_config = CELL_NET_CTL_IP_STATIC; break; case CELL_NET_CTL_INFO_DEFAULT_ROUTE: strcpy_trunc(info->default_route, "192.168.1.1"); break; - case CELL_NET_CTL_INFO_PRIMARY_DNS: strcpy_trunc(info->primary_dns, np_handler::ip_to_string(nph->get_dns_ip())); break; - case CELL_NET_CTL_INFO_SECONDARY_DNS: strcpy_trunc(info->secondary_dns, np_handler::ip_to_string(nph->get_dns_ip())); break; - case CELL_NET_CTL_INFO_IP_ADDRESS: strcpy_trunc(info->ip_address, np_handler::ip_to_string(nph->get_local_ip_addr())); break; + case CELL_NET_CTL_INFO_PRIMARY_DNS: strcpy_trunc(info->primary_dns, np_handler::ip_to_string(nph.get_dns_ip())); break; + case CELL_NET_CTL_INFO_SECONDARY_DNS: strcpy_trunc(info->secondary_dns, np_handler::ip_to_string(nph.get_dns_ip())); break; + case CELL_NET_CTL_INFO_IP_ADDRESS: strcpy_trunc(info->ip_address, np_handler::ip_to_string(nph.get_local_ip_addr())); break; case CELL_NET_CTL_INFO_NETMASK: strcpy_trunc(info->netmask, "255.255.255.255"); break; case CELL_NET_CTL_INFO_HTTP_PROXY_CONFIG: info->http_proxy_config = 0; break; - case CELL_NET_CTL_INFO_DHCP_HOSTNAME: strcpy_trunc(info->dhcp_hostname, nph->get_hostname()); break; + case CELL_NET_CTL_INFO_DHCP_HOSTNAME: strcpy_trunc(info->dhcp_hostname, nph.get_hostname()); break; default: cellNetCtl.error("Unsupported request: %s", InfoCodeToName(code)); break; } @@ -240,9 +241,9 @@ error_code cellNetCtlNetStartDialogLoadAsync(vm::cptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_netctl_init) + if (!nph.is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_INITIALIZED; } @@ -263,7 +264,7 @@ error_code cellNetCtlNetStartDialogLoadAsync(vm::cptrget>()->operator()(0); + g_fxo->get>()(0); return CELL_OK; } @@ -272,9 +273,9 @@ error_code cellNetCtlNetStartDialogAbortAsync() { cellNetCtl.error("cellNetCtlNetStartDialogAbortAsync()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_netctl_init) + if (!nph.is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_INITIALIZED; } @@ -286,9 +287,9 @@ error_code cellNetCtlNetStartDialogUnloadAsync(vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_netctl_init) + if (!nph.is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_INITIALIZED; } @@ -303,7 +304,7 @@ error_code cellNetCtlNetStartDialogUnloadAsync(vm::ptrresult = nph->get_net_status() == CELL_NET_CTL_STATE_IPObtained ? 0 : CELL_NET_CTL_ERROR_DIALOG_CANCELED; + result->result = nph.get_net_status() == CELL_NET_CTL_STATE_IPObtained ? 0 : CELL_NET_CTL_ERROR_DIALOG_CANCELED; sysutil_send_system_cmd(CELL_SYSUTIL_NET_CTL_NETSTART_UNLOADED, 0); return CELL_OK; @@ -313,9 +314,9 @@ error_code cellNetCtlGetNatInfo(vm::ptr natInfo) { cellNetCtl.warning("cellNetCtlGetNatInfo(natInfo=*0x%x)", natInfo); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_netctl_init) + if (!nph.is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_INITIALIZED; } diff --git a/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp b/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp index 6afa0de1f3..edddba9e33 100644 --- a/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp +++ b/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp @@ -53,11 +53,11 @@ struct osk_info // TODO: don't use this function std::shared_ptr _get_osk_dialog(bool create = false) { - const auto osk = g_fxo->get(); + auto& osk = g_fxo->get(); if (create) { - const auto init = osk->init.init(); + const auto init = osk.init.init(); if (!init) { @@ -67,25 +67,25 @@ std::shared_ptr _get_osk_dialog(bool create = false) if (auto manager = g_fxo->try_get()) { std::shared_ptr dlg = std::make_shared(); - osk->dlg = manager->add(dlg); + osk.dlg = manager->add(dlg); } else { - osk->dlg = Emu.GetCallbacks().get_osk_dialog(); + osk.dlg = Emu.GetCallbacks().get_osk_dialog(); } - return osk->dlg; + return osk.dlg; } else { - const auto init = osk->init.access(); + const auto init = osk.init.access(); if (!init) { return nullptr; } - return osk->dlg; + return osk.dlg; } } @@ -164,7 +164,7 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr dia if (accepted) { - if (auto ccb = g_fxo->get()->osk_confirm_callback.exchange({})) + if (auto ccb = g_fxo->get().osk_confirm_callback.exchange({})) { vm::ptr string_to_send = vm::cast(vm::alloc(CELL_OSKDIALOG_STRING_SIZE * 2, vm::main)); atomic_t done = false; @@ -198,7 +198,7 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr dia } } - if (g_fxo->get()->use_separate_windows.load() && osk->osk_text[0] == 0) + if (g_fxo->get().use_separate_windows.load() && osk->osk_text[0] == 0) { cellOskDialog.warning("cellOskDialogLoadAsync: input result is CELL_OSKDIALOG_INPUT_FIELD_RESULT_NO_INPUT_TEXT"); osk->osk_input_result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_NO_INPUT_TEXT; @@ -214,7 +214,7 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr dia } // Send OSK status - if (g_fxo->get()->use_separate_windows.load() && (g_fxo->get()->osk_continuous_mode.load() != CELL_OSKDIALOG_CONTINUOUS_MODE_NONE)) + if (g_fxo->get().use_separate_windows.load() && (g_fxo->get().osk_continuous_mode.load() != CELL_OSKDIALOG_CONTINUOUS_MODE_NONE)) { if (accepted) { @@ -237,7 +237,7 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr dia { const auto osk = wptr.lock(); - if (g_fxo->get()->use_separate_windows.load()) + if (g_fxo->get().use_separate_windows.load()) { sysutil_send_system_cmd(CELL_SYSUTIL_OSKDIALOG_INPUT_ENTERED, 0); } @@ -325,10 +325,10 @@ error_code getText(vm::ptr OutputInfo, bool is if (is_unload) { // Unload should be called last, so remove the dialog here - if (const auto reset_lock = g_fxo->get()->init.reset()) + if (const auto reset_lock = g_fxo->get().init.reset()) { // TODO - g_fxo->get()->dlg.reset(); + g_fxo->get().dlg.reset(); } sysutil_send_system_cmd(CELL_SYSUTIL_OSKDIALOG_UNLOADED, 0); @@ -422,10 +422,10 @@ error_code cellOskDialogSetSeparateWindowOption(vm::ptrget(); true) + if (auto& osk = g_fxo->get(); true) { - osk->use_separate_windows = true; - osk->osk_continuous_mode = static_cast(+windowOption->continuousMode); + osk.use_separate_windows = true; + osk.osk_continuous_mode = static_cast(+windowOption->continuousMode); } return CELL_OK; @@ -583,9 +583,9 @@ error_code cellOskDialogExtRegisterConfirmWordFilterCallback(vm::ptrget(); true) + if (auto& osk = g_fxo->get(); true) { - osk->osk_confirm_callback = pCallback; + osk.osk_confirm_callback = pCallback; } return CELL_OK; diff --git a/rpcs3/Emu/Cell/Modules/cellPad.cpp b/rpcs3/Emu/Cell/Modules/cellPad.cpp index 303435f12d..542acb5ccb 100644 --- a/rpcs3/Emu/Cell/Modules/cellPad.cpp +++ b/rpcs3/Emu/Cell/Modules/cellPad.cpp @@ -56,17 +56,17 @@ error_code cellPadInit(u32 max_connect) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (config->max_connect) + if (config.max_connect) return CELL_PAD_ERROR_ALREADY_INITIALIZED; if (max_connect == 0 || max_connect > CELL_MAX_PADS) return CELL_PAD_ERROR_INVALID_PARAMETER; libio_sys_config_init(); - config->max_connect = std::min(max_connect, CELL_PAD_MAX_PORT_NUM); - config->port_setting.fill(CELL_PAD_SETTING_PRESS_OFF | CELL_PAD_SETTING_SENSOR_OFF); + config.max_connect = std::min(max_connect, CELL_PAD_MAX_PORT_NUM); + config.port_setting.fill(CELL_PAD_SETTING_PRESS_OFF | CELL_PAD_SETTING_SENSOR_OFF); return CELL_OK; } @@ -76,9 +76,9 @@ error_code cellPadEnd() std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect.exchange(0)) + if (!config.max_connect.exchange(0)) return CELL_PAD_ERROR_UNINITIALIZED; libio_sys_config_end(); @@ -112,9 +112,9 @@ error_code cellPadClearBuf(u32 port_no) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -124,7 +124,7 @@ error_code cellPadClearBuf(u32 port_no) const auto& pads = handler->GetPads(); - if (port_no >= config->max_connect) + if (port_no >= config.max_connect) return CELL_PAD_ERROR_NO_DEVICE; const auto pad = pads[port_no]; @@ -143,9 +143,9 @@ error_code cellPadGetData(u32 port_no, vm::ptr data) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -155,7 +155,7 @@ error_code cellPadGetData(u32 port_no, vm::ptr data) const auto& pads = handler->GetPads(); - if (port_no >= config->max_connect) + if (port_no >= config.max_connect) return CELL_PAD_ERROR_NO_DEVICE; const auto pad = pads[port_no]; @@ -171,7 +171,7 @@ error_code cellPadGetData(u32 port_no, vm::ptr data) return CELL_OK; } - const auto setting = config->port_setting[port_no]; + const auto setting = config.port_setting[port_no]; bool btnChanged = false; if (rinfo.ignore_input) @@ -419,9 +419,9 @@ error_code cellPadPeriphGetInfo(vm::ptr info) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -433,7 +433,7 @@ error_code cellPadPeriphGetInfo(vm::ptr info) std::memset(info.get_ptr(), 0, sizeof(CellPadPeriphInfo)); - info->max_connect = config->max_connect; + info->max_connect = config.max_connect; info->now_connect = rinfo.now_connect; info->system_info = rinfo.system_info; @@ -441,12 +441,12 @@ error_code cellPadPeriphGetInfo(vm::ptr info) for (u32 i = 0; i < CELL_PAD_MAX_PORT_NUM; ++i) { - if (i >= config->max_connect) + if (i >= config.max_connect) break; info->port_status[i] = pads[i]->m_port_status; pads[i]->m_port_status &= ~CELL_PAD_STATUS_ASSIGN_CHANGES; - info->port_setting[i] = config->port_setting[i]; + info->port_setting[i] = config.port_setting[i]; info->device_capability[i] = pads[i]->m_device_capability; info->device_type[i] = pads[i]->m_device_type; info->pclass_type[i] = pads[i]->m_class_type; @@ -462,9 +462,9 @@ error_code cellPadPeriphGetData(u32 port_no, vm::ptr data) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -475,7 +475,7 @@ error_code cellPadPeriphGetData(u32 port_no, vm::ptr data) const auto& pads = handler->GetPads(); - if (port_no >= config->max_connect) + if (port_no >= config.max_connect) return CELL_PAD_ERROR_NO_DEVICE; const auto pad = pads[port_no]; @@ -496,9 +496,9 @@ error_code cellPadGetRawData(u32 port_no, vm::ptr data) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -508,7 +508,7 @@ error_code cellPadGetRawData(u32 port_no, vm::ptr data) const auto& pads = handler->GetPads(); - if (port_no >= config->max_connect) + if (port_no >= config.max_connect) return CELL_PAD_ERROR_NO_DEVICE; const auto pad = pads[port_no]; @@ -527,9 +527,9 @@ error_code cellPadGetDataExtra(u32 port_no, vm::ptr device_type, vm::ptrget(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -539,7 +539,7 @@ error_code cellPadGetDataExtra(u32 port_no, vm::ptr device_type, vm::ptrGetPads(); - if (port_no >= config->max_connect) + if (port_no >= config.max_connect) return CELL_PAD_ERROR_NO_DEVICE; const auto pad = pads[port_no]; @@ -568,9 +568,9 @@ error_code cellPadSetActDirect(u32 port_no, vm::ptr param) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -591,7 +591,7 @@ error_code cellPadSetActDirect(u32 port_no, vm::ptr param) const auto& pads = handler->GetPads(); - if (port_no >= config->max_connect) + if (port_no >= config.max_connect) return CELL_PAD_ERROR_NO_DEVICE; const auto pad = pads[port_no]; @@ -614,9 +614,9 @@ error_code cellPadGetInfo(vm::ptr info) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -627,7 +627,7 @@ error_code cellPadGetInfo(vm::ptr info) std::memset(info.get_ptr(), 0, sizeof(CellPadInfo)); const PadInfo& rinfo = handler->GetInfo(); - info->max_connect = config->max_connect; + info->max_connect = config.max_connect; info->now_connect = rinfo.now_connect; info->system_info = rinfo.system_info; @@ -635,7 +635,7 @@ error_code cellPadGetInfo(vm::ptr info) for (u32 i = 0; i < CELL_MAX_PADS; ++i) { - if (i >= config->max_connect) + if (i >= config.max_connect) break; pads[i]->m_port_status &= ~CELL_PAD_STATUS_ASSIGN_CHANGES; // TODO: should ASSIGN flags be cleared here? @@ -687,9 +687,9 @@ error_code cellPadGetInfo2(vm::ptr info) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -700,7 +700,7 @@ error_code cellPadGetInfo2(vm::ptr info) std::memset(info.get_ptr(), 0, sizeof(CellPadInfo2)); const PadInfo& rinfo = handler->GetInfo(); - info->max_connect = config->max_connect; + info->max_connect = config.max_connect; info->now_connect = rinfo.now_connect; info->system_info = rinfo.system_info; @@ -708,12 +708,12 @@ error_code cellPadGetInfo2(vm::ptr info) for (u32 i = 0; i < CELL_PAD_MAX_PORT_NUM; ++i) { - if (i >= config->max_connect) + if (i >= config.max_connect) break; info->port_status[i] = pads[i]->m_port_status; pads[i]->m_port_status &= ~CELL_PAD_STATUS_ASSIGN_CHANGES; - info->port_setting[i] = config->port_setting[i]; + info->port_setting[i] = config.port_setting[i]; info->device_capability[i] = pads[i]->m_device_capability; info->device_type[i] = pads[i]->m_device_type; } @@ -727,9 +727,9 @@ error_code cellPadGetCapabilityInfo(u32 port_no, vm::ptr std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -739,7 +739,7 @@ error_code cellPadGetCapabilityInfo(u32 port_no, vm::ptr const auto& pads = handler->GetPads(); - if (port_no >= config->max_connect) + if (port_no >= config.max_connect) return CELL_PAD_ERROR_NO_DEVICE; const auto pad = pads[port_no]; @@ -760,9 +760,9 @@ error_code cellPadSetPortSetting(u32 port_no, u32 port_setting) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; if (port_no >= CELL_MAX_PADS) @@ -772,7 +772,7 @@ error_code cellPadSetPortSetting(u32 port_no, u32 port_setting) if (port_no >= CELL_PAD_MAX_PORT_NUM) return CELL_OK; - config->port_setting[port_no] = port_setting; + config.port_setting[port_no] = port_setting; // can also return CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD @@ -785,9 +785,9 @@ error_code cellPadInfoPressMode(u32 port_no) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -797,7 +797,7 @@ error_code cellPadInfoPressMode(u32 port_no) const auto& pads = handler->GetPads(); - if (port_no >= config->max_connect) + if (port_no >= config.max_connect) return CELL_PAD_ERROR_NO_DEVICE; const auto pad = pads[port_no]; @@ -814,9 +814,9 @@ error_code cellPadInfoSensorMode(u32 port_no) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -826,7 +826,7 @@ error_code cellPadInfoSensorMode(u32 port_no) const auto& pads = handler->GetPads(); - if (port_no >= config->max_connect) + if (port_no >= config.max_connect) return CELL_PAD_ERROR_NO_DEVICE; const auto pad = pads[port_no]; @@ -843,9 +843,9 @@ error_code cellPadSetPressMode(u32 port_no, u32 mode) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -866,9 +866,9 @@ error_code cellPadSetPressMode(u32 port_no, u32 mode) return CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD; if (mode) - config->port_setting[port_no] |= CELL_PAD_SETTING_PRESS_ON; + config.port_setting[port_no] |= CELL_PAD_SETTING_PRESS_ON; else - config->port_setting[port_no] &= ~CELL_PAD_SETTING_PRESS_ON; + config.port_setting[port_no] &= ~CELL_PAD_SETTING_PRESS_ON; return CELL_OK; } @@ -879,9 +879,9 @@ error_code cellPadSetSensorMode(u32 port_no, u32 mode) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -902,9 +902,9 @@ error_code cellPadSetSensorMode(u32 port_no, u32 mode) return CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD; if (mode) - config->port_setting[port_no] |= CELL_PAD_SETTING_SENSOR_ON; + config.port_setting[port_no] |= CELL_PAD_SETTING_SENSOR_ON; else - config->port_setting[port_no] &= ~CELL_PAD_SETTING_SENSOR_ON; + config.port_setting[port_no] &= ~CELL_PAD_SETTING_SENSOR_ON; return CELL_OK; } @@ -915,9 +915,9 @@ error_code cellPadLddRegisterController() std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -927,7 +927,7 @@ error_code cellPadLddRegisterController() if (handle < 0) return CELL_PAD_ERROR_TOO_MANY_DEVICES; - config->port_setting[handle] = 0; + config.port_setting[handle] = 0; return not_an_error(handle); } @@ -938,9 +938,9 @@ error_code cellPadLddDataInsert(s32 handle, vm::ptr data) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -963,9 +963,9 @@ error_code cellPadLddGetPortNo(s32 handle) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); @@ -987,9 +987,9 @@ error_code cellPadLddUnregisterController(s32 handle) std::lock_guard lock(pad::g_pad_mutex); - const auto config = g_fxo->get(); + auto& config = g_fxo->get(); - if (!config->max_connect) + if (!config.max_connect) return CELL_PAD_ERROR_UNINITIALIZED; const auto handler = pad::get_current_handler(); diff --git a/rpcs3/Emu/Cell/Modules/cellRec.cpp b/rpcs3/Emu/Cell/Modules/cellRec.cpp index 047346f21f..c074254c2b 100644 --- a/rpcs3/Emu/Cell/Modules/cellRec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellRec.cpp @@ -66,11 +66,11 @@ error_code cellRecOpen(vm::cptr pDirName, vm::cptr pFileName, vm::cp { cellRec.todo("cellRecOpen(pDirName=%s, pFileName=%s, pParam=*0x%x, container=0x%x, cb=*0x%x, cbUserData=*0x%x)", pDirName, pFileName, pParam, container, cb, cbUserData); - const auto rec = g_fxo->get(); - rec->cb = cb; - rec->cbUserData = cbUserData; + auto& rec = g_fxo->get(); + rec.cb = cb; + rec.cbUserData = cbUserData; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &rec](ppu_thread& ppu) -> s32 { cb(ppu, CELL_REC_STATUS_OPEN, CELL_OK, cbUserData); return CELL_OK; @@ -83,11 +83,11 @@ error_code cellRecClose(s32 isDiscard) { cellRec.todo("cellRecClose(isDiscard=0x%x)", isDiscard); - const auto rec = g_fxo->get(); + auto& rec = g_fxo->get(); - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &rec](ppu_thread& ppu) -> s32 { - rec->cb(ppu, CELL_REC_STATUS_CLOSE, CELL_OK, rec->cbUserData); + rec.cb(ppu, CELL_REC_STATUS_CLOSE, CELL_OK, rec.cbUserData); return CELL_OK; }); @@ -103,11 +103,11 @@ error_code cellRecStop() { cellRec.todo("cellRecStop()"); - const auto rec = g_fxo->get(); + auto& rec = g_fxo->get(); - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &rec](ppu_thread& ppu) -> s32 { - rec->cb(ppu, CELL_REC_STATUS_STOP, CELL_OK, rec->cbUserData); + rec.cb(ppu, CELL_REC_STATUS_STOP, CELL_OK, rec.cbUserData); return CELL_OK; }); @@ -118,11 +118,11 @@ error_code cellRecStart() { cellRec.todo("cellRecStart()"); - const auto rec = g_fxo->get(); + auto& rec = g_fxo->get(); - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &rec](ppu_thread& ppu) -> s32 { - rec->cb(ppu, CELL_REC_STATUS_START, CELL_OK, rec->cbUserData); + rec.cb(ppu, CELL_REC_STATUS_START, CELL_OK, rec.cbUserData); return CELL_OK; }); diff --git a/rpcs3/Emu/Cell/Modules/cellResc.cpp b/rpcs3/Emu/Cell/Modules/cellResc.cpp index 80d83be91c..55ebe14f7b 100644 --- a/rpcs3/Emu/Cell/Modules/cellResc.cpp +++ b/rpcs3/Emu/Cell/Modules/cellResc.cpp @@ -33,9 +33,9 @@ error_code cellRescInit(vm::cptr initConfig) { cellResc.todo("cellRescInit(initConfig=*0x%x)", initConfig); - auto resc_manager = g_fxo->get(); + auto& resc_manager = g_fxo->get(); - if (resc_manager->is_initialized) + if (resc_manager.is_initialized) { return CELL_RESC_ERROR_REINITIALIZED; } @@ -45,7 +45,7 @@ error_code cellRescInit(vm::cptr initConfig) return CELL_RESC_ERROR_BAD_ARGUMENT; } - resc_manager->config = + resc_manager.config = { initConfig->size, initConfig->resourcePolicy, @@ -55,7 +55,7 @@ error_code cellRescInit(vm::cptr initConfig) initConfig->interlaceMode, initConfig->flipMode }; - resc_manager->is_initialized = true; + resc_manager.is_initialized = true; return CELL_OK; } @@ -64,8 +64,8 @@ void cellRescExit() { cellResc.todo("cellRescExit()"); - auto resc_manager = g_fxo->get(); - resc_manager->is_initialized = false; + auto& resc_manager = g_fxo->get(); + resc_manager.is_initialized = false; } error_code cellRescVideoOutResolutionId2RescBufferMode(u32 resolutionId, vm::cptr bufferMode) @@ -84,9 +84,9 @@ error_code cellRescSetDsts(u32 bufferMode, vm::cptr dsts) { cellResc.todo("cellRescSetDsts(bufferMode=%d, dsts=*0x%x)", bufferMode, dsts); - auto resc_manager = g_fxo->get(); + auto& resc_manager = g_fxo->get(); - if (!resc_manager->is_initialized) + if (!resc_manager.is_initialized) { return CELL_RESC_ERROR_NOT_INITIALIZED; } @@ -103,22 +103,22 @@ error_code cellRescSetDisplayMode(u32 bufferMode) { cellResc.todo("cellRescSetDisplayMode(bufferMode=%d)", bufferMode); - auto resc_manager = g_fxo->get(); + auto& resc_manager = g_fxo->get(); - if (!resc_manager->is_initialized) + if (!resc_manager.is_initialized) { return CELL_RESC_ERROR_NOT_INITIALIZED; } - if (!bufferMode || bufferMode > CELL_RESC_1920x1080 || !(resc_manager->config.support_modes & bufferMode)) // TODO: is the bufferMode check correct? + if (!bufferMode || bufferMode > CELL_RESC_1920x1080 || !(resc_manager.config.support_modes & bufferMode)) // TODO: is the bufferMode check correct? { return CELL_RESC_ERROR_BAD_ARGUMENT; } if (bufferMode == CELL_RESC_720x576) { - const u32 pal_mode = resc_manager->config.pal_temporal_mode; - const u32 flip_mode = resc_manager->config.flip_mode; + const u32 pal_mode = resc_manager.config.pal_temporal_mode; + const u32 flip_mode = resc_manager.config.flip_mode; // Check if palTemporalMode is any INTERPOLATE mode or CELL_RESC_PAL_60_DROP if ((pal_mode - CELL_RESC_PAL_60_INTERPOLATE) <= CELL_RESC_PAL_60_INTERPOLATE || pal_mode == CELL_RESC_PAL_60_DROP) @@ -138,7 +138,7 @@ error_code cellRescSetDisplayMode(u32 bufferMode) } } - resc_manager->buffer_mode = bufferMode; + resc_manager.buffer_mode = bufferMode; return CELL_OK; } @@ -147,9 +147,9 @@ error_code cellRescAdjustAspectRatio(f32 horizontal, f32 vertical) { cellResc.todo("cellRescAdjustAspectRatio(horizontal=%f, vertical=%f)", horizontal, vertical); - auto resc_manager = g_fxo->get(); + auto& resc_manager = g_fxo->get(); - if (!resc_manager->is_initialized) + if (!resc_manager.is_initialized) { return CELL_RESC_ERROR_NOT_INITIALIZED; } @@ -166,9 +166,9 @@ error_code cellRescSetPalInterpolateDropFlexRatio(f32 ratio) { cellResc.todo("cellRescSetPalInterpolateDropFlexRatio(ratio=%f)", ratio); - auto resc_manager = g_fxo->get(); + auto& resc_manager = g_fxo->get(); - if (!resc_manager->is_initialized) + if (!resc_manager.is_initialized) { return CELL_RESC_ERROR_NOT_INITIALIZED; } @@ -185,9 +185,9 @@ error_code cellRescGetBufferSize(vm::ptr colorBuffers, vm::ptr vertexA { cellResc.todo("cellRescGetBufferSize(colorBuffers=*0x%x, vertexArray=*0x%x, fragmentShader=*0x%x)", colorBuffers, vertexArray, fragmentShader); - auto resc_manager = g_fxo->get(); + auto& resc_manager = g_fxo->get(); - if (!resc_manager->is_initialized) + if (!resc_manager.is_initialized) { return CELL_RESC_ERROR_NOT_INITIALIZED; } @@ -257,9 +257,9 @@ error_code cellRescSetSrc(s32 idx, vm::cptr src) { cellResc.todo("cellRescSetSrc(idx=0x%x, src=*0x%x)", idx, src); - auto resc_manager = g_fxo->get(); + auto& resc_manager = g_fxo->get(); - if (!resc_manager->is_initialized) + if (!resc_manager.is_initialized) { return CELL_RESC_ERROR_NOT_INITIALIZED; } @@ -276,9 +276,9 @@ error_code cellRescSetConvertAndFlip(ppu_thread& ppu, vm::ptrget(); + auto& resc_manager = g_fxo->get(); - if (!resc_manager->is_initialized) + if (!resc_manager.is_initialized) { return CELL_RESC_ERROR_NOT_INITIALIZED; } @@ -302,9 +302,9 @@ error_code cellRescSetBufferAddress(vm::cptr colorBuffers, vm::cptr ve { cellResc.todo("cellRescSetBufferAddress(colorBuffers=*0x%x, vertexArray=*0x%x, fragmentShader=*0x%x)", colorBuffers, vertexArray, fragmentShader); - auto resc_manager = g_fxo->get(); + auto& resc_manager = g_fxo->get(); - if (!resc_manager->is_initialized) + if (!resc_manager.is_initialized) { return CELL_RESC_ERROR_NOT_INITIALIZED; } @@ -371,9 +371,9 @@ error_code cellRescCreateInterlaceTable(vm::ptr ea_addr, f32 srcH, CellRes return CELL_RESC_ERROR_BAD_ARGUMENT; } - auto resc_manager = g_fxo->get(); + auto& resc_manager = g_fxo->get(); - if (!resc_manager->buffer_mode) + if (!resc_manager.buffer_mode) { return CELL_RESC_ERROR_BAD_COMBINATION; } diff --git a/rpcs3/Emu/Cell/Modules/cellRudp.cpp b/rpcs3/Emu/Cell/Modules/cellRudp.cpp index 67afbc0b99..40727a6d4b 100644 --- a/rpcs3/Emu/Cell/Modules/cellRudp.cpp +++ b/rpcs3/Emu/Cell/Modules/cellRudp.cpp @@ -72,26 +72,26 @@ error_code cellRudpInit(vm::ptr allocator) { cellRudp.warning("cellRudpInit(allocator=*0x%x)", allocator); - const auto rudp = g_fxo->get(); + auto& rudp = g_fxo->get(); - if (rudp->malloc) + if (rudp.malloc) { return CELL_RUDP_ERROR_ALREADY_INITIALIZED; } if (allocator) { - rudp->malloc = allocator->app_malloc; - rudp->free = allocator->app_free; + rudp.malloc = allocator->app_malloc; + rudp.free = allocator->app_free; } else { - rudp->malloc = [](ppu_thread& ppu, u32 size) + rudp.malloc = [](ppu_thread& ppu, u32 size) { return vm::ptr::make(vm::alloc(size, vm::main)); }; - rudp->free = [](ppu_thread& ppu, vm::ptr ptr) + rudp.free = [](ppu_thread& ppu, vm::ptr ptr) { if (!vm::dealloc(ptr.addr(), vm::main)) { @@ -107,16 +107,16 @@ error_code cellRudpEnd() { cellRudp.warning("cellRudpEnd()"); - const auto rudp = g_fxo->get(); + auto& rudp = g_fxo->get(); - if (!rudp->malloc) + if (!rudp.malloc) { return CELL_RUDP_ERROR_NOT_INITIALIZED; } - rudp->malloc = nullptr; - rudp->free = nullptr; - rudp->handler = vm::null; + rudp.malloc = nullptr; + rudp.free = nullptr; + rudp.handler = vm::null; return CELL_OK; } @@ -131,15 +131,15 @@ error_code cellRudpSetEventHandler(vm::ptr handler, vm::pt { cellRudp.todo("cellRudpSetEventHandler(handler=*0x%x, arg=*0x%x)", handler, arg); - const auto rudp = g_fxo->get(); + auto& rudp = g_fxo->get(); - if (!rudp->malloc) + if (!rudp.malloc) { return CELL_RUDP_ERROR_NOT_INITIALIZED; } - rudp->handler = handler; - rudp->handler_arg = arg; + rudp.handler = handler; + rudp.handler_arg = arg; return CELL_OK; } diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index d879a64ace..8aa0ffe1ff 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -163,7 +163,7 @@ static std::vector get_save_entries(const std::string& base_dir, static error_code select_and_delete(ppu_thread& ppu) { - std::unique_lock lock(g_fxo->get()->mutex, std::try_to_lock); + std::unique_lock lock(g_fxo->get().mutex, std::try_to_lock); if (!lock) { @@ -558,7 +558,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v return {CELL_SAVEDATA_ERROR_PARAM, std::to_string(ecode)}; } - std::unique_lock lock(g_fxo->get()->mutex, std::try_to_lock); + std::unique_lock lock(g_fxo->get().mutex, std::try_to_lock); if (!lock) { diff --git a/rpcs3/Emu/Cell/Modules/cellScreenshot.cpp b/rpcs3/Emu/Cell/Modules/cellScreenshot.cpp index cd1f64b207..34b8821d16 100644 --- a/rpcs3/Emu/Cell/Modules/cellScreenshot.cpp +++ b/rpcs3/Emu/Cell/Modules/cellScreenshot.cpp @@ -85,25 +85,25 @@ error_code cellScreenShotSetParameter(vm::cptr param) if (param->game_comment && !memchr(param->game_comment.get_ptr(), '\0', CELL_SCREENSHOT_GAME_COMMENT_MAX_SIZE)) return CELL_SCREENSHOT_ERROR_PARAM; - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); std::lock_guard lock(screenshot_mtx); if (param->photo_title && param->photo_title[0] != '\0') - manager->photo_title = std::string(param->photo_title.get_ptr()); + manager.photo_title = std::string(param->photo_title.get_ptr()); else - manager->photo_title = ""; + manager.photo_title = ""; if (param->game_title && param->game_title[0] != '\0') - manager->game_title = std::string(param->game_title.get_ptr()); + manager.game_title = std::string(param->game_title.get_ptr()); else - manager->game_title = ""; + manager.game_title = ""; if (param->game_comment && param->game_comment[0] != '\0') - manager->game_comment = std::string(param->game_comment.get_ptr()); + manager.game_comment = std::string(param->game_comment.get_ptr()); else - manager->game_comment = ""; + manager.game_comment = ""; - cellScreenshot.notice("cellScreenShotSetParameter(photo_title=%s, game_title=%s, game_comment=%s)", manager->photo_title, manager->game_title, manager->game_comment); + cellScreenshot.notice("cellScreenShotSetParameter(photo_title=%s, game_title=%s, game_comment=%s)", manager.photo_title, manager.game_title, manager.game_comment); return CELL_OK; } @@ -123,13 +123,13 @@ error_code cellScreenShotSetOverlayImage(vm::cptr srcDir, vm::cptr s return CELL_SCREENSHOT_ERROR_PARAM; } - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); std::lock_guard lock(screenshot_mtx); - manager->overlay_dir_name = std::string(srcDir.get_ptr()); - manager->overlay_file_name = std::string(srcFile.get_ptr()); - manager->overlay_offset_x = offset_x; - manager->overlay_offset_y = offset_y; + manager.overlay_dir_name = std::string(srcDir.get_ptr()); + manager.overlay_file_name = std::string(srcFile.get_ptr()); + manager.overlay_offset_x = offset_x; + manager.overlay_offset_y = offset_y; return CELL_OK; } @@ -138,10 +138,10 @@ error_code cellScreenShotEnable() { cellScreenshot.warning("cellScreenShotEnable()"); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); std::lock_guard lock(screenshot_mtx); - manager->is_enabled = true; + manager.is_enabled = true; return CELL_OK; } @@ -150,10 +150,10 @@ error_code cellScreenShotDisable() { cellScreenshot.warning("cellScreenShotDisable()"); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); std::lock_guard lock(screenshot_mtx); - manager->is_enabled = false; + manager.is_enabled = false; return CELL_OK; } diff --git a/rpcs3/Emu/Cell/Modules/cellSearch.cpp b/rpcs3/Emu/Cell/Modules/cellSearch.cpp index ae524c3381..0e542934eb 100644 --- a/rpcs3/Emu/Cell/Modules/cellSearch.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSearch.cpp @@ -122,9 +122,9 @@ error_code cellSearchInitialize(CellSearchMode mode, u32 container, vm::ptrget(); + auto& search = g_fxo->get(); - switch (search->state.compare_and_swap(search_state::not_initialized, search_state::initializing)) + switch (search.state.compare_and_swap(search_state::not_initialized, search_state::initializing)) { case search_state::not_initialized: break; @@ -136,12 +136,12 @@ error_code cellSearchInitialize(CellSearchMode mode, u32 container, vm::ptrfunc = func; - search->userData = userData; + search.func = func; + search.userData = userData; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &search](ppu_thread& ppu) -> s32 { - search->state.store(search_state::idle); + search.state.store(search_state::idle); func(ppu, CELL_SEARCH_EVENT_INITIALIZE_RESULT, CELL_OK, vm::null, userData); return CELL_OK; }); @@ -153,9 +153,9 @@ error_code cellSearchFinalize() { cellSearch.todo("cellSearchFinalize()"); - const auto search = g_fxo->get(); + auto& search = g_fxo->get(); - switch (search->state.compare_and_swap(search_state::idle, search_state::finalizing)) + switch (search.state.compare_and_swap(search_state::idle, search_state::finalizing)) { case search_state::idle: break; @@ -171,14 +171,14 @@ error_code cellSearchFinalize() return CELL_SEARCH_ERROR_GENERIC; } - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &search](ppu_thread& ppu) -> s32 { { - std::lock_guard lock(search->links_mutex); - search->content_links.clear(); + std::lock_guard lock(search.links_mutex); + search.content_links.clear(); } - search->state.store(search_state::not_initialized); - search->func(ppu, CELL_SEARCH_EVENT_FINALIZE_RESULT, CELL_OK, vm::null, search->userData); + search.state.store(search_state::not_initialized); + search.func(ppu, CELL_SEARCH_EVENT_FINALIZE_RESULT, CELL_OK, vm::null, search.userData); return CELL_OK; }); @@ -222,9 +222,9 @@ error_code cellSearchStartListSearch(CellSearchListSearchType type, CellSearchSo return CELL_SEARCH_ERROR_PARAM; } - const auto search = g_fxo->get(); + auto& search = g_fxo->get(); - switch (search->state.compare_and_swap(search_state::idle, search_state::in_progress)) + switch (search.state.compare_and_swap(search_state::idle, search_state::in_progress)) { case search_state::idle: break; @@ -242,7 +242,7 @@ error_code cellSearchStartListSearch(CellSearchListSearchType type, CellSearchSo const u32 id = *outSearchId = idm::make(); - sysutil_register_cb([=, content_map = g_fxo->get()](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &content_map = g_fxo->get(), &search](ppu_thread& ppu) -> s32 { auto curr_search = idm::get(id); vm::var resultParam; @@ -320,8 +320,8 @@ error_code cellSearchStartListSearch(CellSearchListSearchType type, CellSearchSo } const u64 hash = std::hash()(item_path); - auto found = content_map->find(hash); - if (found == content_map->end()) // content isn't yet being tracked + auto found = content_map.find(hash); + if (found == content_map.end()) // content isn't yet being tracked { //auto ext_offset = item.name.find_last_of('.'); // used later if no "Title" found @@ -334,8 +334,8 @@ error_code cellSearchStartListSearch(CellSearchListSearchType type, CellSearchSo // std::string link = "/.tmp/" + std::to_string(hash) + item.name.substr(ext_offset); // strcpy_trunc(curr_find->infoPath.contentPath, link); - // std::lock_guard lock(search->links_mutex); - // search->content_links.emplace(std::move(link), item_path); + // std::lock_guard lock(search.links_mutex); + // search.content_links.emplace(std::move(link), item_path); } else { @@ -391,7 +391,7 @@ error_code cellSearchStartListSearch(CellSearchListSearchType type, CellSearchSo } } - content_map->emplace(hash, curr_find); + content_map.emplace(hash, curr_find); curr_search->content_ids.emplace_back(hash, curr_find); // place this file's "ID" into the list of found types cellSearch.notice("cellSearchStartListSearch(): Content ID: %08X Path: \"%s\"", hash, item_path); @@ -410,8 +410,8 @@ error_code cellSearchStartListSearch(CellSearchListSearchType type, CellSearchSo searchInFolder(fmt::format("/dev_hdd0/%s", media_dir)); resultParam->resultNum = ::narrow(curr_search->content_ids.size()); - search->state.store(search_state::idle); - search->func(ppu, CELL_SEARCH_EVENT_LISTSEARCH_RESULT, CELL_OK, vm::cast(resultParam.addr()), search->userData); + search.state.store(search_state::idle); + search.func(ppu, CELL_SEARCH_EVENT_LISTSEARCH_RESULT, CELL_OK, vm::cast(resultParam.addr()), search.userData); return CELL_OK; }); @@ -449,9 +449,9 @@ error_code cellSearchStartContentSearchInList(vm::cptr list return CELL_SEARCH_ERROR_PARAM; } - const auto search = g_fxo->get(); + auto& search = g_fxo->get(); - switch (search->state.compare_and_swap(search_state::idle, search_state::in_progress)) + switch (search.state.compare_and_swap(search_state::idle, search_state::in_progress)) { case search_state::idle: break; @@ -467,9 +467,9 @@ error_code cellSearchStartContentSearchInList(vm::cptr list return CELL_SEARCH_ERROR_GENERIC; } - const auto content_map = g_fxo->get(); - auto found = content_map->find(*reinterpret_cast(listId->data)); - if (found == content_map->end()) + auto& content_map = g_fxo->get(); + auto found = content_map.find(*reinterpret_cast(listId->data)); + if (found == content_map.end()) { // content ID not found, perform a search first return CELL_SEARCH_ERROR_CONTENT_NOT_FOUND; @@ -499,7 +499,7 @@ error_code cellSearchStartContentSearchInList(vm::cptr list const u32 id = *outSearchId = idm::make(); - sysutil_register_cb([=, list_path = std::string(content_info->infoPath.contentPath)](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, list_path = std::string(content_info->infoPath.contentPath), &search, &content_map](ppu_thread& ppu) -> s32 { auto curr_search = idm::get(id); vm::var resultParam; @@ -553,8 +553,8 @@ error_code cellSearchStartContentSearchInList(vm::cptr list const std::string item_path(vpath + "/" + item.name); const u64 hash = std::hash()(item_path); - auto found = content_map->find(hash); - if (found == content_map->end()) // content isn't yet being tracked + auto found = content_map.find(hash); + if (found == content_map.end()) // content isn't yet being tracked { auto ext_offset = item.name.find_last_of('.'); // used later if no "Title" found @@ -565,8 +565,8 @@ error_code cellSearchStartContentSearchInList(vm::cptr list std::string link = "/.tmp/" + std::to_string(hash) + item.name.substr(ext_offset); strcpy_trunc(curr_find->infoPath.contentPath, link); - std::lock_guard lock(search->links_mutex); - search->content_links.emplace(std::move(link), item_path); + std::lock_guard lock(search.links_mutex); + search.content_links.emplace(std::move(link), item_path); } else { @@ -783,7 +783,7 @@ error_code cellSearchStartContentSearchInList(vm::cptr list strcpy_trunc(info.albumTitle, "ALBUM TITLE"); } - content_map->emplace(hash, curr_find); + content_map.emplace(hash, curr_find); curr_search->content_ids.emplace_back(hash, curr_find); // place this file's "ID" into the list of found types cellSearch.notice("cellSearchStartContentSearchInList(): Content ID: %08X Path: \"%s\"", hash, item_path); @@ -802,8 +802,8 @@ error_code cellSearchStartContentSearchInList(vm::cptr list searchInFolder(list_path); resultParam->resultNum = ::narrow(curr_search->content_ids.size()); - search->state.store(search_state::idle); - search->func(ppu, CELL_SEARCH_EVENT_CONTENTSEARCH_INLIST_RESULT, CELL_OK, vm::cast(resultParam.addr()), search->userData); + search.state.store(search_state::idle); + search.func(ppu, CELL_SEARCH_EVENT_CONTENTSEARCH_INLIST_RESULT, CELL_OK, vm::cast(resultParam.addr()), search.userData); return CELL_OK; }); @@ -851,9 +851,9 @@ error_code cellSearchStartContentSearch(CellSearchContentSearchType type, CellSe return CELL_SEARCH_ERROR_PARAM; } - const auto search = g_fxo->get(); + auto& search = g_fxo->get(); - switch (search->state.compare_and_swap(search_state::idle, search_state::in_progress)) + switch (search.state.compare_and_swap(search_state::idle, search_state::in_progress)) { case search_state::idle: break; @@ -871,7 +871,7 @@ error_code cellSearchStartContentSearch(CellSearchContentSearchType type, CellSe const u32 id = *outSearchId = idm::make(); - sysutil_register_cb([=, content_map = g_fxo->get()](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &content_map = g_fxo->get(), &search](ppu_thread& ppu) -> s32 { auto curr_search = idm::get(id); vm::var resultParam; @@ -906,8 +906,8 @@ error_code cellSearchStartContentSearch(CellSearchContentSearchType type, CellSe const std::string item_path(relative_vpath + "/" + item.name); const u64 hash = std::hash()(item_path); - auto found = content_map->find(hash); - if (found == content_map->end()) // content isn't yet being tracked + auto found = content_map.find(hash); + if (found == content_map.end()) // content isn't yet being tracked { auto ext_offset = item.name.find_last_of('.'); // used later if no "Title" found @@ -918,8 +918,8 @@ error_code cellSearchStartContentSearch(CellSearchContentSearchType type, CellSe std::string link = "/.tmp/" + std::to_string(hash) + item.name.substr(ext_offset); strcpy_trunc(curr_find->infoPath.contentPath, link); - std::lock_guard lock(search->links_mutex); - search->content_links.emplace(std::move(link), item_path); + std::lock_guard lock(search.links_mutex); + search.content_links.emplace(std::move(link), item_path); } else { @@ -985,7 +985,7 @@ error_code cellSearchStartContentSearch(CellSearchContentSearchType type, CellSe strcpy_trunc(info.albumTitle, "ALBUM TITLE"); } - content_map->emplace(hash, curr_find); + content_map.emplace(hash, curr_find); curr_search->content_ids.emplace_back(hash, curr_find); // place this file's "ID" into the list of found types cellSearch.notice("cellSearchStartContentSearch(): Content ID: %08X Path: \"%s\"", hash, item_path); @@ -1003,8 +1003,8 @@ error_code cellSearchStartContentSearch(CellSearchContentSearchType type, CellSe searchInFolder(fmt::format("/dev_hdd0/%s", media_dir), ""); resultParam->resultNum = ::narrow(curr_search->content_ids.size()); - search->state.store(search_state::idle); - search->func(ppu, CELL_SEARCH_EVENT_CONTENTSEARCH_RESULT, CELL_OK, vm::cast(resultParam.addr()), search->userData); + search.state.store(search_state::idle); + search.func(ppu, CELL_SEARCH_EVENT_CONTENTSEARCH_RESULT, CELL_OK, vm::cast(resultParam.addr()), search.userData); return CELL_OK; }); @@ -1038,9 +1038,9 @@ error_code cellSearchStartSceneSearchInVideo(vm::cptr video return CELL_SEARCH_ERROR_PARAM; } - const auto search = g_fxo->get(); + auto& search = g_fxo->get(); - switch (search->state.compare_and_swap(search_state::idle, search_state::in_progress)) + switch (search.state.compare_and_swap(search_state::idle, search_state::in_progress)) { case search_state::idle: break; @@ -1058,14 +1058,14 @@ error_code cellSearchStartSceneSearchInVideo(vm::cptr video const u32 id = *outSearchId = idm::make(); - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &search](ppu_thread& ppu) -> s32 { vm::var resultParam; resultParam->searchId = id; resultParam->resultNum = 0; // TODO - search->state.store(search_state::idle); - search->func(ppu, CELL_SEARCH_EVENT_SCENESEARCH_INVIDEO_RESULT, CELL_OK, vm::cast(resultParam.addr()), search->userData); + search.state.store(search_state::idle); + search.func(ppu, CELL_SEARCH_EVENT_SCENESEARCH_INVIDEO_RESULT, CELL_OK, vm::cast(resultParam.addr()), search.userData); return CELL_OK; }); @@ -1094,9 +1094,9 @@ error_code cellSearchStartSceneSearch(CellSearchSceneSearchType searchType, vm:: return CELL_SEARCH_ERROR_PARAM; } - const auto search = g_fxo->get(); + auto& search = g_fxo->get(); - switch (search->state.compare_and_swap(search_state::idle, search_state::in_progress)) + switch (search.state.compare_and_swap(search_state::idle, search_state::in_progress)) { case search_state::idle: break; @@ -1114,14 +1114,14 @@ error_code cellSearchStartSceneSearch(CellSearchSceneSearchType searchType, vm:: const u32 id = *outSearchId = idm::make(); - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &search](ppu_thread& ppu) -> s32 { vm::var resultParam; resultParam->searchId = id; resultParam->resultNum = 0; // TODO - search->state.store(search_state::idle); - search->func(ppu, CELL_SEARCH_EVENT_SCENESEARCH_RESULT, CELL_OK, vm::cast(resultParam.addr()), search->userData); + search.state.store(search_state::idle); + search.func(ppu, CELL_SEARCH_EVENT_SCENESEARCH_RESULT, CELL_OK, vm::cast(resultParam.addr()), search.userData); return CELL_OK; }); @@ -1144,7 +1144,7 @@ error_code cellSearchGetContentInfoByOffset(CellSearchId searchId, s32 offset, v return CELL_SEARCH_ERROR_INVALID_SEARCHID; } - switch (g_fxo->get()->state.load()) + switch (g_fxo->get().state.load()) { case search_state::idle: break; @@ -1212,7 +1212,7 @@ error_code cellSearchGetContentInfoByContentId(vm::cptr con return CELL_SEARCH_ERROR_PARAM; } - switch (g_fxo->get()->state.load()) + switch (g_fxo->get().state.load()) { case search_state::idle: break; @@ -1228,9 +1228,9 @@ error_code cellSearchGetContentInfoByContentId(vm::cptr con return CELL_SEARCH_ERROR_GENERIC; } - const auto content_map = g_fxo->get(); - auto found = content_map->find(*reinterpret_cast(contentId->data)); - if (found != content_map->end()) + auto& content_map = g_fxo->get(); + auto found = content_map.find(*reinterpret_cast(contentId->data)); + if (found != content_map.end()) { const auto& content_info = found->second; switch (content_info->type) @@ -1279,7 +1279,7 @@ error_code cellSearchGetOffsetByContentId(CellSearchId searchId, vm::cptrget()->state.load()) + switch (g_fxo->get().state.load()) { case search_state::idle: break; @@ -1333,7 +1333,7 @@ error_code cellSearchGetContentIdByOffset(CellSearchId searchId, s32 offset, vm: return CELL_SEARCH_ERROR_INVALID_SEARCHID; } - switch (g_fxo->get()->state.load()) + switch (g_fxo->get().state.load()) { case search_state::idle: break; @@ -1422,7 +1422,7 @@ error_code cellSearchGetContentInfoPath(vm::cptr contentId, return CELL_SEARCH_ERROR_PARAM; } - switch (g_fxo->get()->state.load()) + switch (g_fxo->get().state.load()) { case search_state::idle: break; @@ -1439,9 +1439,9 @@ error_code cellSearchGetContentInfoPath(vm::cptr contentId, } const u64 id = *reinterpret_cast(contentId->data); - const auto content_map = g_fxo->get(); - auto found = content_map->find(id); - if(found != content_map->end()) + auto& content_map = g_fxo->get(); + auto found = content_map.find(id); + if(found != content_map.end()) { std::memcpy(infoPath.get_ptr(), &found->second->infoPath, sizeof(found->second->infoPath)); } @@ -1477,8 +1477,8 @@ error_code cellSearchPrepareFile(vm::cptr path) return CELL_SEARCH_ERROR_PARAM; } - const auto search = g_fxo->get(); - switch (search->state.load()) + auto& search = g_fxo->get(); + switch (search.state.load()) { case search_state::idle: break; @@ -1494,9 +1494,9 @@ error_code cellSearchPrepareFile(vm::cptr path) return CELL_SEARCH_ERROR_GENERIC; } - reader_lock lock(search->links_mutex); - auto found = search->content_links.find(path.get_ptr()); - if (found != search->content_links.end()) + reader_lock lock(search.links_mutex); + auto found = search.content_links.find(path.get_ptr()); + if (found != search.content_links.end()) { vfs::mount(found->first, vfs::get(found->second)); } @@ -1539,7 +1539,7 @@ error_code cellSearchCancel(CellSearchId searchId) return CELL_SEARCH_ERROR_INVALID_SEARCHID; } - switch (g_fxo->get()->state.load()) + switch (g_fxo->get().state.load()) { case search_state::in_progress: break; @@ -1565,7 +1565,7 @@ error_code cellSearchEnd(CellSearchId searchId) { cellSearch.todo("cellSearchEnd(searchId=0x%x)", searchId); - switch (g_fxo->get()->state.load()) + switch (g_fxo->get().state.load()) { case search_state::idle: break; diff --git a/rpcs3/Emu/Cell/Modules/cellSsl.cpp b/rpcs3/Emu/Cell/Modules/cellSsl.cpp index 7177ae6f0b..0f36371a96 100644 --- a/rpcs3/Emu/Cell/Modules/cellSsl.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSsl.cpp @@ -45,12 +45,12 @@ error_code cellSslInit(vm::ptr pool, u32 poolSize) { cellSsl.todo("cellSslInit(pool=*0x%x, poolSize=%d)", pool, poolSize); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - if (manager->is_init) + if (manager.is_init) return CELL_SSL_ERROR_ALREADY_INITIALIZED; - manager->is_init = true; + manager.is_init = true; return CELL_OK; } @@ -59,12 +59,12 @@ error_code cellSslEnd() { cellSsl.todo("cellSslEnd()"); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - if (!manager->is_init) + if (!manager.is_init) return CELL_SSL_ERROR_NOT_INITIALIZED; - manager->is_init = false; + manager.is_init = false; return CELL_OK; } @@ -142,7 +142,7 @@ error_code cellSslCertGetSerialNumber(vm::cptr sslCert, vm::cpptr sboD { cellSsl.todo("cellSslCertGetSerialNumber(sslCert=*0x%x, sboData=**0x%x, sboLength=*0x%x)", sslCert, sboData, sboLength); - if (!g_fxo->get()->is_init) + if (!g_fxo->get().is_init) return CELL_SSL_ERROR_NOT_INITIALIZED; if (!sslCert) @@ -158,7 +158,7 @@ error_code cellSslCertGetPublicKey(vm::cptr sslCert, vm::cpptr sboData { cellSsl.todo("cellSslCertGetPublicKey(sslCert=*0x%x, sboData=**0x%x, sboLength=*0x%x)", sslCert, sboData, sboLength); - if (!g_fxo->get()->is_init) + if (!g_fxo->get().is_init) return CELL_SSL_ERROR_NOT_INITIALIZED; if (!sslCert) @@ -174,7 +174,7 @@ error_code cellSslCertGetRsaPublicKeyModulus(vm::cptr sslCert, vm::cpptrget()->is_init) + if (!g_fxo->get().is_init) return CELL_SSL_ERROR_NOT_INITIALIZED; if (!sslCert) @@ -190,7 +190,7 @@ error_code cellSslCertGetRsaPublicKeyExponent(vm::cptr sslCert, vm::cpptr< { cellSsl.todo("cellSslCertGetRsaPublicKeyExponent(sslCert=*0x%x, sboData=**0x%x, sboLength=*0x%x)", sslCert, sboData, sboLength); - if (!g_fxo->get()->is_init) + if (!g_fxo->get().is_init) return CELL_SSL_ERROR_NOT_INITIALIZED; if (!sslCert) @@ -206,7 +206,7 @@ error_code cellSslCertGetNotBefore(vm::cptr sslCert, vm::ptr { cellSsl.todo("cellSslCertGetNotBefore(sslCert=*0x%x, begin=*0x%x)", sslCert, begin); - if (!g_fxo->get()->is_init) + if (!g_fxo->get().is_init) return CELL_SSL_ERROR_NOT_INITIALIZED; if (!sslCert) @@ -222,7 +222,7 @@ error_code cellSslCertGetNotAfter(vm::cptr sslCert, vm::ptr l { cellSsl.todo("cellSslCertGetNotAfter(sslCert=*0x%x, limit=*0x%x)", sslCert, limit); - if (!g_fxo->get()->is_init) + if (!g_fxo->get().is_init) return CELL_SSL_ERROR_NOT_INITIALIZED; if (!sslCert) @@ -238,7 +238,7 @@ error_code cellSslCertGetSubjectName(vm::cptr sslCert, vm::cpptr cer { cellSsl.todo("cellSslCertGetSubjectName(sslCert=*0x%x, certName=**0x%x)", sslCert, certName); - if (!g_fxo->get()->is_init) + if (!g_fxo->get().is_init) return CELL_SSL_ERROR_NOT_INITIALIZED; if (!sslCert) @@ -254,7 +254,7 @@ error_code cellSslCertGetIssuerName(vm::cptr sslCert, vm::cpptr cert { cellSsl.todo("cellSslCertGetIssuerName(sslCert=*0x%x, certName=**0x%x)", sslCert, certName); - if (!g_fxo->get()->is_init) + if (!g_fxo->get().is_init) return CELL_SSL_ERROR_NOT_INITIALIZED; if (!sslCert) @@ -270,7 +270,7 @@ error_code cellSslCertGetNameEntryCount(vm::cptr certName, vm::ptr en { cellSsl.todo("cellSslCertGetNameEntryCount(certName=*0x%x, entryCount=*0x%x)", certName, entryCount); - if (!g_fxo->get()->is_init) + if (!g_fxo->get().is_init) return CELL_SSL_ERROR_NOT_INITIALIZED; if (!certName) @@ -286,7 +286,7 @@ error_code cellSslCertGetNameEntryInfo(vm::cptr certName, u32 entryNum, vm { cellSsl.todo("cellSslCertGetNameEntryInfo(certName=*0x%x, entryNum=%d, oidName=**0x%x, value=**0x%x, valueLength=*0x%x, flag=0x%x)", certName, entryNum, oidName, value, valueLength, flag); - if (!g_fxo->get()->is_init) + if (!g_fxo->get().is_init) return CELL_SSL_ERROR_NOT_INITIALIZED; if (!certName) @@ -302,7 +302,7 @@ error_code cellSslCertGetMd5Fingerprint(vm::cptr sslCert, vm::cptr buf { cellSsl.todo("cellSslCertGetMd5Fingerprint(sslCert=*0x%x, buf=*0x%x, plen=*0x%x)", sslCert, buf, plen); - if (!g_fxo->get()->is_init) + if (!g_fxo->get().is_init) return CELL_SSL_ERROR_NOT_INITIALIZED; if (!sslCert) diff --git a/rpcs3/Emu/Cell/Modules/cellSysCache.cpp b/rpcs3/Emu/Cell/Modules/cellSysCache.cpp index caebeeb3ea..8197bf6b39 100644 --- a/rpcs3/Emu/Cell/Modules/cellSysCache.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSysCache.cpp @@ -94,9 +94,9 @@ error_code cellSysCacheClear() { cellSysutil.notice("cellSysCacheClear()"); - const auto cache = g_fxo->get(); + auto& cache = g_fxo->get(); - const auto lock = cache->init.access(); + const auto lock = cache.init.access(); if (!lock) { @@ -104,10 +104,10 @@ error_code cellSysCacheClear() } // Clear existing cache - if (!cache->cache_id.empty()) + if (!cache.cache_id.empty()) { std::lock_guard lock0(g_mp_sys_dev_hdd1.mutex); - cache->clear(false); + cache.clear(false); } return not_an_error(CELL_SYSCACHE_RET_OK_CLEARED); @@ -117,7 +117,7 @@ error_code cellSysCacheMount(vm::ptr param) { cellSysutil.notice("cellSysCacheMount(param=*0x%x)", param); - const auto cache = g_fxo->get(); + auto& cache = g_fxo->get(); if (!param || (param->cacheId[0] && sysutil_check_name_string(param->cacheId, 1, CELL_SYSCACHE_ID_SIZE) != 0)) { @@ -128,18 +128,18 @@ error_code cellSysCacheMount(vm::ptr param) std::string cache_id = vfs::escape(Emu.GetTitleID() + '_' + param->cacheId); // Full path to virtual cache root (/dev_hdd1) - std::string new_path = cache->cache_root + cache_id + '/'; + std::string new_path = cache.cache_root + cache_id + '/'; // Set fixed VFS path strcpy_trunc(param->getCachePath, "/dev_hdd1"); // Lock pseudo-mutex - const auto lock = cache->init.init_always([&] + const auto lock = cache.init.init_always([&] { }); // Check if can reuse existing cache (won't if cache id is an empty string) - if (param->cacheId[0] && cache_id == cache->cache_id) + if (param->cacheId[0] && cache_id == cache.cache_id) { // Isn't mounted yet on first call to cellSysCacheMount vfs::mount("/dev_hdd1", new_path); @@ -151,13 +151,13 @@ error_code cellSysCacheMount(vm::ptr param) std::lock_guard lock0(g_mp_sys_dev_hdd1.mutex); // Clear existing cache - if (!cache->cache_id.empty()) + if (!cache.cache_id.empty()) { - cache->clear(true); + cache.clear(true); } // Set new cache id - cache->cache_id = std::move(cache_id); + cache.cache_id = std::move(cache_id); fs::create_dir(new_path); vfs::mount("/dev_hdd1", new_path); diff --git a/rpcs3/Emu/Cell/Modules/cellSysutil.cpp b/rpcs3/Emu/Cell/Modules/cellSysutil.cpp index f61c27a1cc..cae56b62f4 100644 --- a/rpcs3/Emu/Cell/Modules/cellSysutil.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSysutil.cpp @@ -50,21 +50,20 @@ struct sysutil_cb_manager extern void sysutil_register_cb(std::function&& cb) { - const auto cbm = g_fxo->get(); + auto& cbm = g_fxo->get(); - cbm->registered.push(std::move(cb)); + cbm.registered.push(std::move(cb)); } extern void sysutil_send_system_cmd(u64 status, u64 param) { - // May be nullptr if emulation is stopped - if (const auto cbm = g_fxo->get()) + if (auto& cbm = g_fxo->get(); g_fxo->is_init() && !Emu.IsStopped()) { - for (sysutil_cb_manager::registered_cb cb : cbm->callbacks) + for (sysutil_cb_manager::registered_cb cb : cbm.callbacks) { if (cb.first) { - cbm->registered.push([=](ppu_thread& ppu) -> s32 + cbm.registered.push([=](ppu_thread& ppu) -> s32 { // TODO: check it and find the source of the return value (void isn't equal to CELL_OK) cb.first(ppu, status, param, cb.second); @@ -401,9 +400,9 @@ error_code cellSysutilCheckCallback(ppu_thread& ppu) { cellSysutil.trace("cellSysutilCheckCallback()"); - const auto cbm = g_fxo->get(); + auto& cbm = g_fxo->get(); - for (auto&& func : cbm->registered.pop_all()) + for (auto&& func : cbm.registered.pop_all()) { if (s32 res = func(ppu)) { @@ -429,9 +428,9 @@ error_code cellSysutilRegisterCallback(s32 slot, vm::ptr fu return CELL_SYSUTIL_ERROR_VALUE; } - const auto cbm = g_fxo->get(); + auto& cbm = g_fxo->get(); - cbm->callbacks[slot].store({func, userdata}); + cbm.callbacks[slot].store({func, userdata}); return CELL_OK; } @@ -445,9 +444,9 @@ error_code cellSysutilUnregisterCallback(u32 slot) return CELL_SYSUTIL_ERROR_VALUE; } - const auto cbm = g_fxo->get(); + auto& cbm = g_fxo->get(); - cbm->callbacks[slot].store({}); + cbm.callbacks[slot].store({}); return CELL_OK; } diff --git a/rpcs3/Emu/Cell/Modules/cellSysutilAvc2.cpp b/rpcs3/Emu/Cell/Modules/cellSysutilAvc2.cpp index bb132f743a..728b3acbdd 100644 --- a/rpcs3/Emu/Cell/Modules/cellSysutilAvc2.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSysutilAvc2.cpp @@ -134,7 +134,8 @@ error_code cellSysutilAvc2LoadAsync(SceNpMatching2ContextId ctx_id, u32 containe if (avc2_cb) { - sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { avc2_cb(cb_ppu, CELL_AVC2_EVENT_LOAD_SUCCEEDED, 0, avc2_cb_arg); return 0; }); @@ -230,7 +231,8 @@ error_code cellSysutilAvc2JoinChatRequest(vm::cptr room_id if (avc2_cb) { - sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { avc2_cb(cb_ppu, CELL_AVC2_EVENT_JOIN_SUCCEEDED, 0, avc2_cb_arg); return 0; }); @@ -322,7 +324,8 @@ error_code cellSysutilAvc2LeaveChatRequest() if (avc2_cb) { - sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { avc2_cb(cb_ppu, CELL_AVC2_EVENT_LEAVE_SUCCEEDED, 0, avc2_cb_arg); return 0; }); @@ -371,7 +374,7 @@ error_code cellSysutilAvc2EnumPlayers(vm::ptr players_num, vm::ptrget(); + auto& conf = g_fxo->get(); state->state = CELL_VIDEO_OUT_OUTPUT_STATE_ENABLED; state->colorSpace = CELL_VIDEO_OUT_COLOR_SPACE_RGB; - state->displayMode.resolutionId = conf->state? conf->resolution_id : g_video_out_resolution_id.at(g_cfg.video.resolution); + state->displayMode.resolutionId = conf.state ? conf.resolution_id : g_video_out_resolution_id.at(g_cfg.video.resolution); state->displayMode.scanMode = CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE; state->displayMode.conversion = CELL_VIDEO_OUT_DISPLAY_CONVERSION_NONE; - state->displayMode.aspect = conf->state? conf->aspect : g_video_out_aspect_id.at(g_cfg.video.aspect_ratio); + state->displayMode.aspect = conf.state ? conf.aspect : g_video_out_aspect_id.at(g_cfg.video.aspect_ratio); state->displayMode.refreshRates = CELL_VIDEO_OUT_REFRESH_RATE_59_94HZ; return CELL_OK; @@ -187,20 +187,20 @@ error_code cellVideoOutConfigure(u32 videoOut, vm::ptrget(); - conf->resolution_id = config->resolutionId; - conf->_3d = config->resolutionId >= CELL_VIDEO_OUT_RESOLUTION_720_3D_FRAME_PACKING; - conf->aspect = config->aspect; - conf->format = config->format; - conf->scanline_pitch = config->pitch; - conf->resolution_x = res.width; - conf->resolution_y = res.height; - conf->state = 1; + auto& conf = g_fxo->get(); + conf.resolution_id = config->resolutionId; + conf._3d = config->resolutionId >= CELL_VIDEO_OUT_RESOLUTION_720_3D_FRAME_PACKING; + conf.aspect = config->aspect; + conf.format = config->format; + conf.scanline_pitch = config->pitch; + conf.resolution_x = res.width; + conf.resolution_y = res.height; + conf.state = 1; - if (conf->aspect == CELL_VIDEO_OUT_ASPECT_AUTO) + if (conf.aspect == CELL_VIDEO_OUT_ASPECT_AUTO) { // Resolve 'auto' option to actual aspect ratio - conf->aspect = g_video_out_aspect_id.at(g_cfg.video.aspect_ratio); + conf.aspect = g_video_out_aspect_id.at(g_cfg.video.aspect_ratio); } cellSysutil.notice("Selected video resolution 0x%x", config->resolutionId); @@ -224,12 +224,12 @@ error_code cellVideoOutGetConfiguration(u32 videoOut, vm::ptrget(); conf->state) + if (auto& conf = g_fxo->get(); conf.state) { - config->resolutionId = conf->resolution_id; - config->format = conf->format; - config->aspect = conf->aspect; - config->pitch = conf->scanline_pitch; + config->resolutionId = conf.resolution_id; + config->format = conf.format; + config->aspect = conf.aspect; + config->pitch = conf.scanline_pitch; } else { diff --git a/rpcs3/Emu/Cell/Modules/cellVoice.cpp b/rpcs3/Emu/Cell/Modules/cellVoice.cpp index 89cdb78d8a..3d74687565 100644 --- a/rpcs3/Emu/Cell/Modules/cellVoice.cpp +++ b/rpcs3/Emu/Cell/Modules/cellVoice.cpp @@ -50,19 +50,19 @@ error_code cellVoiceConnectIPortToOPort(u32 ips, u32 ops) { cellVoice.todo("cellVoiceConnectIPortToOPort(ips=%d, ops=%d)", ips, ops); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto iport = manager->access_port(ips); + auto iport = manager.access_port(ips); if (!iport || iport->info.portType >= CELLVOICE_PORTTYPE_OUT_PCMAUDIO) return CELL_VOICE_ERROR_TOPOLOGY; - auto oport = manager->access_port(ops); + auto oport = manager.access_port(ops); if (!oport || oport->info.portType <= CELLVOICE_PORTTYPE_IN_VOICE) return CELL_VOICE_ERROR_TOPOLOGY; @@ -74,11 +74,11 @@ error_code cellVoiceCreateNotifyEventQueue(ppu_thread& ppu, vm::ptr id, vm: { cellVoice.warning("cellVoiceCreateNotifyEventQueue(id=*0x%x, key=*0x%x)", id, key); - auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; vm::var attr; @@ -111,11 +111,11 @@ error_code cellVoiceCreatePort(vm::ptr portId, vm::cptr { cellVoice.warning("cellVoiceCreatePort(portId=*0x%x, pArg=*0x%x)", portId, pArg); - auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::scoped_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; if (!pArg) @@ -160,20 +160,20 @@ error_code cellVoiceCreatePort(vm::ptr portId, vm::cptr return CELL_VOICE_ERROR_ARGUMENT_INVALID; } - if (manager->ports.size() > CELLVOICE_MAX_PORT) + if (manager.ports.size() > CELLVOICE_MAX_PORT) return CELL_VOICE_ERROR_RESOURCE_INSUFFICIENT; // Id: bits [8,15] seem to contain a "random" value // bits [0,7] are based on creation counter modulo 0xa0 // The rest are set to zero and ignored. - manager->id_ctr++; manager->id_ctr %= 0xa0; + manager.id_ctr++; manager.id_ctr %= 0xa0; // It isn't known whether bits[8,15] are guaranteed to be non-zero constexpr u32 min_value = 1; for (u32 ctr2 = min_value; ctr2 < CELLVOICE_MAX_PORT + min_value; ctr2++) { - const auto [port, success] = manager->ports.try_emplace(static_cast((ctr2 << 8) | manager->id_ctr)); + const auto [port, success] = manager.ports.try_emplace(static_cast((ctr2 << 8) | manager.id_ctr)); if (success) { @@ -190,14 +190,14 @@ error_code cellVoiceDeletePort(u32 portId) { cellVoice.warning("cellVoiceDeletePort(portId=%d)", portId); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::scoped_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - if (manager->ports.erase(static_cast(portId)) == 0) + if (manager.ports.erase(static_cast(portId)) == 0) return CELL_VOICE_ERROR_TOPOLOGY; return CELL_OK; @@ -207,19 +207,19 @@ error_code cellVoiceDisconnectIPortFromOPort(u32 ips, u32 ops) { cellVoice.todo("cellVoiceDisconnectIPortFromOPort(ips=%d, ops=%d)", ips, ops); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto iport = manager->access_port(ips); + auto iport = manager.access_port(ips); if (!iport || iport->info.portType >= CELLVOICE_PORTTYPE_OUT_PCMAUDIO) return CELL_VOICE_ERROR_TOPOLOGY; - auto oport = manager->access_port(ops); + auto oport = manager.access_port(ops); if (!oport || oport->info.portType <= CELLVOICE_PORTTYPE_IN_VOICE) return CELL_VOICE_ERROR_TOPOLOGY; @@ -231,16 +231,16 @@ error_code cellVoiceEnd() { cellVoice.warning("cellVoiceEnd()"); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::scoped_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - if (std::exchange(manager->voice_service_started, false)) + if (std::exchange(manager.voice_service_started, false)) { - for (auto& key_pair : manager->queue_keys) + for (auto& key_pair : manager.queue_keys) { if (auto queue = lv2_event_queue::find(key_pair.first)) { @@ -252,8 +252,8 @@ error_code cellVoiceEnd() } } - manager->reset(); - manager->is_init = false; + manager.reset(); + manager.is_init = false; return CELL_OK; } @@ -262,11 +262,11 @@ error_code cellVoiceGetBitRate(u32 portId, vm::ptr bitrate) { cellVoice.warning("cellVoiceGetBitRate(portId=%d, bitrate=*0x%x)", portId, bitrate); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; // No nullptr check! @@ -274,7 +274,7 @@ error_code cellVoiceGetBitRate(u32 portId, vm::ptr bitrate) // Constant value for errors (meaning unknown) *bitrate = 0x4f323285; - auto port = manager->access_port(portId); + auto port = manager.access_port(portId); if (!port || (port->info.portType != CELLVOICE_PORTTYPE_IN_VOICE && port->info.portType != CELLVOICE_PORTTYPE_OUT_VOICE)) return CELL_VOICE_ERROR_TOPOLOGY; @@ -287,14 +287,14 @@ error_code cellVoiceGetMuteFlag(u32 portId, vm::ptr bMuted) { cellVoice.warning("cellVoiceGetMuteFlag(portId=%d, bMuted=*0x%x)", portId, bMuted); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto port = manager->access_port(portId); + auto port = manager.access_port(portId); if (!port) return CELL_VOICE_ERROR_TOPOLOGY; @@ -307,14 +307,14 @@ error_code cellVoiceGetPortAttr(u32 portId, u32 attr, vm::ptr attrValue) { cellVoice.todo("cellVoiceGetPortAttr(portId=%d, attr=%d, attrValue=*0x%x)", portId, attr, attrValue); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto port = manager->access_port(portId); + auto port = manager.access_port(portId); if (!port) return CELL_VOICE_ERROR_TOPOLOGY; @@ -327,19 +327,19 @@ error_code cellVoiceGetPortInfo(u32 portId, vm::ptr pInfo { cellVoice.todo("cellVoiceGetPortInfo(portId=%d, pInfo=*0x%x)", portId, pInfo); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto port = manager->access_port(portId); + auto port = manager.access_port(portId); if (!port) return CELL_VOICE_ERROR_TOPOLOGY; - if (!manager->voice_service_started) + if (!manager.voice_service_started) return CELL_VOICE_ERROR_SERVICE_DETACHED; // No nullptr check! @@ -354,14 +354,14 @@ error_code cellVoiceGetSignalState(u32 portId, u32 attr, vm::ptr attrValue { cellVoice.todo("cellVoiceGetSignalState(portId=%d, attr=%d, attrValue=*0x%x)", portId, attr, attrValue); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto port = manager->access_port(portId); + auto port = manager.access_port(portId); if (!port) return CELL_VOICE_ERROR_TOPOLOGY; @@ -374,14 +374,14 @@ error_code cellVoiceGetVolume(u32 portId, vm::ptr volume) { cellVoice.warning("cellVoiceGetVolume(portId=%d, volume=*0x%x)", portId, volume); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto port = manager->access_port(portId); + auto port = manager.access_port(portId); // No nullptr check! @@ -399,17 +399,17 @@ error_code cellVoiceInit(vm::ptr pArg) { cellVoice.todo("cellVoiceInit(pArg=*0x%x)", pArg); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::scoped_lock lock(manager.mtx); - if (manager->is_init) + if (manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_INITIALIZED; if (!pArg) return CELL_VOICE_ERROR_ARGUMENT_INVALID; - manager->is_init = true; + manager.is_init = true; return CELL_OK; } @@ -418,15 +418,15 @@ error_code cellVoiceInitEx(vm::ptr pArg) { cellVoice.todo("cellVoiceInitEx(pArg=*0x%x)", pArg); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - if (manager->is_init) + if (manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_INITIALIZED; if (!pArg) return CELL_VOICE_ERROR_ARGUMENT_INVALID; - manager->is_init = true; + manager.is_init = true; return CELL_OK; } @@ -435,14 +435,14 @@ error_code cellVoicePausePort(u32 portId) { cellVoice.todo("cellVoicePausePort(portId=%d)", portId); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto port = manager->access_port(portId); + auto port = manager.access_port(portId); if (!port) return CELL_VOICE_ERROR_TOPOLOGY; @@ -454,11 +454,11 @@ error_code cellVoicePausePortAll() { cellVoice.todo("cellVoicePausePortAll()"); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; return CELL_OK; @@ -468,14 +468,14 @@ error_code cellVoiceRemoveNotifyEventQueue(u64 key) { cellVoice.warning("cellVoiceRemoveNotifyEventQueue(key=0x%llx)", key); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::scoped_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - if (manager->queue_keys.erase(key) == 0) + if (manager.queue_keys.erase(key) == 0) return CELL_VOICE_ERROR_EVENT_QUEUE; return CELL_OK; @@ -485,14 +485,14 @@ error_code cellVoiceResetPort(u32 portId) { cellVoice.todo("cellVoiceResetPort(portId=%d)", portId); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto port = manager->access_port(portId); + auto port = manager.access_port(portId); if (!port) return CELL_VOICE_ERROR_TOPOLOGY; @@ -504,14 +504,14 @@ error_code cellVoiceResumePort(u32 portId) { cellVoice.todo("cellVoiceResumePort(portId=%d)", portId); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto port = manager->access_port(portId); + auto port = manager.access_port(portId); if (!port) return CELL_VOICE_ERROR_TOPOLOGY; @@ -523,11 +523,11 @@ error_code cellVoiceResumePortAll() { cellVoice.todo("cellVoiceResumePortAll()"); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; return CELL_OK; @@ -537,14 +537,14 @@ error_code cellVoiceSetBitRate(u32 portId, CellVoiceBitRate bitrate) { cellVoice.warning("cellVoiceSetBitRate(portId=%d, bitrate=%d)", portId, +bitrate); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::scoped_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto port = manager->access_port(portId); + auto port = manager.access_port(portId); if (!port || (port->info.portType != CELLVOICE_PORTTYPE_IN_VOICE && port->info.portType != CELLVOICE_PORTTYPE_OUT_VOICE)) return CELL_VOICE_ERROR_TOPOLOGY; @@ -574,14 +574,14 @@ error_code cellVoiceSetMuteFlag(u32 portId, u16 bMuted) { cellVoice.warning("cellVoiceSetMuteFlag(portId=%d, bMuted=%d)", portId, bMuted); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::scoped_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto port = manager->access_port(portId); + auto port = manager.access_port(portId); if (!port) return CELL_VOICE_ERROR_TOPOLOGY; @@ -594,11 +594,11 @@ error_code cellVoiceSetMuteFlagAll(u16 bMuted) { cellVoice.warning("cellVoiceSetMuteFlagAll(bMuted=%d)", bMuted); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; // Doesn't change port->bMute value @@ -609,11 +609,11 @@ error_code cellVoiceSetNotifyEventQueue(u64 key, u64 source) { cellVoice.warning("cellVoiceSetNotifyEventQueue(key=0x%llx, source=0x%llx)", key, source); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::scoped_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; // Note: it is allowed to enqueue the key twice (another source is enqueued with FIFO ordering) @@ -626,11 +626,11 @@ error_code cellVoiceSetNotifyEventQueue(u64 key, u64 source) { // same thing as sys_event_port_send with port.name == 0 // Try to give different port id everytime - source = ((process_getpid() + 1ull) << 32) | (lv2_event_port::id_base + manager->port_source * lv2_event_port::id_step); - manager->port_source = (manager->port_source + 1) % lv2_event_port::id_count; + source = ((process_getpid() + 1ull) << 32) | (lv2_event_port::id_base + manager.port_source * lv2_event_port::id_step); + manager.port_source = (manager.port_source + 1) % lv2_event_port::id_count; } - manager->queue_keys[key].push_back(source); + manager.queue_keys[key].push_back(source); return CELL_OK; } @@ -638,14 +638,14 @@ error_code cellVoiceSetPortAttr(u32 portId, u32 attr, vm::ptr attrValue) { cellVoice.todo("cellVoiceSetPortAttr(portId=%d, attr=%d, attrValue=*0x%x)", portId, attr, attrValue); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::scoped_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto port = manager->access_port(portId); + auto port = manager.access_port(portId); if (!port) return CELL_VOICE_ERROR_TOPOLOGY; @@ -658,14 +658,14 @@ error_code cellVoiceSetVolume(u32 portId, f32 volume) { cellVoice.warning("cellVoiceSetVolume(portId=%d, volume=%f)", portId, volume); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::scoped_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto port = manager->access_port(portId); + auto port = manager.access_port(portId); if (!port) return CELL_VOICE_ERROR_TOPOLOGY; @@ -674,12 +674,12 @@ error_code cellVoiceSetVolume(u32 portId, f32 volume) return CELL_OK; } -error_code VoiceStart(voice_manager* manager) +error_code VoiceStart(voice_manager& manager) { - if (std::exchange(manager->voice_service_started, true)) + if (std::exchange(manager.voice_service_started, true)) return CELL_OK; - for (auto& key_pair : manager->queue_keys) + for (auto& key_pair : manager.queue_keys) { if (auto queue = lv2_event_queue::find(key_pair.first)) { @@ -697,11 +697,11 @@ error_code cellVoiceStart() { cellVoice.warning("cellVoiceStart()"); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::scoped_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; return VoiceStart(manager); @@ -711,11 +711,11 @@ error_code cellVoiceStartEx(vm::ptr pArg) { cellVoice.todo("cellVoiceStartEx(pArg=*0x%x)", pArg); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::scoped_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; if (!pArg) @@ -730,17 +730,17 @@ error_code cellVoiceStop() { cellVoice.warning("cellVoiceStop()"); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::scoped_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - if (!std::exchange(manager->voice_service_started, false)) + if (!std::exchange(manager.voice_service_started, false)) return CELL_OK; - for (auto& key_pair : manager->queue_keys) + for (auto& key_pair : manager.queue_keys) { if (auto queue = lv2_event_queue::find(key_pair.first)) { @@ -758,17 +758,17 @@ error_code cellVoiceUpdatePort(u32 portId, vm::cptr pArg) { cellVoice.warning("cellVoiceUpdatePort(portId=%d, pArg=*0x%x)", portId, pArg); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::scoped_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; if (!pArg) return CELL_VOICE_ERROR_ARGUMENT_INVALID; - auto port = manager->access_port(portId); + auto port = manager.access_port(portId); if (!port) return CELL_VOICE_ERROR_TOPOLOGY; @@ -790,14 +790,14 @@ error_code cellVoiceWriteToIPort(u32 ips, vm::cptr data, vm::ptr size { cellVoice.todo("cellVoiceWriteToIPort(ips=%d, data=*0x%x, size=*0x%x)", ips, data, size); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto iport = manager->access_port(ips); + auto iport = manager.access_port(ips); if (!iport || iport->info.portType >= CELLVOICE_PORTTYPE_OUT_PCMAUDIO) return CELL_VOICE_ERROR_TOPOLOGY; @@ -809,14 +809,14 @@ error_code cellVoiceWriteToIPortEx(u32 ips, vm::cptr data, vm::ptr si { cellVoice.todo("cellVoiceWriteToIPortEx(ips=%d, data=*0x%x, size=*0x%x, numFrameLost=%d)", ips, data, size, numFrameLost); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto iport = manager->access_port(ips); + auto iport = manager.access_port(ips); if (!iport || iport->info.portType >= CELLVOICE_PORTTYPE_OUT_PCMAUDIO) return CELL_VOICE_ERROR_TOPOLOGY; @@ -828,14 +828,14 @@ error_code cellVoiceWriteToIPortEx2(u32 ips, vm::cptr data, vm::ptr s { cellVoice.todo("cellVoiceWriteToIPortEx2(ips=%d, data=*0x%x, size=*0x%x, frameGaps=%d)", ips, data, size, frameGaps); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto iport = manager->access_port(ips); + auto iport = manager.access_port(ips); if (!iport || iport->info.portType >= CELLVOICE_PORTTYPE_OUT_PCMAUDIO) return CELL_VOICE_ERROR_TOPOLOGY; @@ -847,14 +847,14 @@ error_code cellVoiceReadFromOPort(u32 ops, vm::ptr data, vm::ptr size { cellVoice.todo("cellVoiceReadFromOPort(ops=%d, data=*0x%x, size=*0x%x)", ops, data, size); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - reader_lock lock(manager->mtx); + reader_lock lock(manager.mtx); - if (!manager->is_init) + if (!manager.is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; - auto oport = manager->access_port(ops); + auto oport = manager.access_port(ops); if (!oport || oport->info.portType <= CELLVOICE_PORTTYPE_IN_VOICE) return CELL_VOICE_ERROR_TOPOLOGY; @@ -869,7 +869,7 @@ error_code cellVoiceDebugTopology() { UNIMPLEMENTED_FUNC(cellVoice); - if (!g_fxo->get()->is_init) + if (!g_fxo->get().is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; return CELL_VOICE_ERROR_NOT_IMPLEMENTED; diff --git a/rpcs3/Emu/Cell/Modules/cellWebBrowser.cpp b/rpcs3/Emu/Cell/Modules/cellWebBrowser.cpp index 7db2c942da..c452965933 100644 --- a/rpcs3/Emu/Cell/Modules/cellWebBrowser.cpp +++ b/rpcs3/Emu/Cell/Modules/cellWebBrowser.cpp @@ -242,12 +242,12 @@ error_code cellWebBrowserInitialize(vm::ptr system { cellSysutil.todo("cellWebBrowserInitialize(system_cb=*0x%x, container=0x%x)", system_cb, container); - const auto browser = g_fxo->get(); - browser->system_cb = system_cb; + auto& browser = g_fxo->get(); + browser.system_cb = system_cb; - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &browser](ppu_thread& ppu) -> s32 { - system_cb(ppu, CELL_SYSUTIL_WEBBROWSER_INITIALIZING_FINISHED, browser->userData); + system_cb(ppu, CELL_SYSUTIL_WEBBROWSER_INITIALIZING_FINISHED, browser.userData); return CELL_OK; }); @@ -276,11 +276,11 @@ void cellWebBrowserShutdown() { cellSysutil.todo("cellWebBrowserShutdown()"); - const auto browser = g_fxo->get(); + auto& browser = g_fxo->get(); - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + sysutil_register_cb([=, &browser](ppu_thread& ppu) -> s32 { - browser->system_cb(ppu, CELL_SYSUTIL_WEBBROWSER_SHUTDOWN_FINISHED, browser->userData); + browser.system_cb(ppu, CELL_SYSUTIL_WEBBROWSER_SHUTDOWN_FINISHED, browser.userData); return CELL_OK; }); } diff --git a/rpcs3/Emu/Cell/Modules/libmixer.cpp b/rpcs3/Emu/Cell/Modules/libmixer.cpp index 813a127656..c6d8778ae9 100644 --- a/rpcs3/Emu/Cell/Modules/libmixer.cpp +++ b/rpcs3/Emu/Cell/Modules/libmixer.cpp @@ -351,9 +351,9 @@ struct surmixer_thread : ppu_thread void non_task() { - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - audio_port& port = g_audio->ports[g_surmx.audio_port]; + audio_port& port = g_audio.ports[g_surmx.audio_port]; while (port.state != audio_port_state::closed) { @@ -479,9 +479,9 @@ s32 cellSurMixerCreate(vm::cptr config) { libmixer.warning("cellSurMixerCreate(config=*0x%x)", config); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - const auto port = g_audio->open_port(); + const auto port = g_audio.open_port(); if (!port) { @@ -563,14 +563,14 @@ s32 cellSurMixerStart() { libmixer.warning("cellSurMixerStart()"); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); if (g_surmx.audio_port >= AUDIO_PORT_COUNT) { return CELL_LIBMIXER_ERROR_NOT_INITIALIZED; } - g_audio->ports[g_surmx.audio_port].state.compare_and_swap(audio_port_state::opened, audio_port_state::started); + g_audio.ports[g_surmx.audio_port].state.compare_and_swap(audio_port_state::opened, audio_port_state::started); return CELL_OK; } @@ -585,14 +585,14 @@ s32 cellSurMixerFinalize() { libmixer.warning("cellSurMixerFinalize()"); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); if (g_surmx.audio_port >= AUDIO_PORT_COUNT) { return CELL_LIBMIXER_ERROR_NOT_INITIALIZED; } - g_audio->ports[g_surmx.audio_port].state.compare_and_swap(audio_port_state::opened, audio_port_state::closed); + g_audio.ports[g_surmx.audio_port].state.compare_and_swap(audio_port_state::opened, audio_port_state::closed); return CELL_OK; } @@ -630,14 +630,14 @@ s32 cellSurMixerPause(u32 type) { libmixer.warning("cellSurMixerPause(type=%d)", type); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); if (g_surmx.audio_port >= AUDIO_PORT_COUNT) { return CELL_LIBMIXER_ERROR_NOT_INITIALIZED; } - g_audio->ports[g_surmx.audio_port].state.compare_and_swap(audio_port_state::started, audio_port_state::opened); + g_audio.ports[g_surmx.audio_port].state.compare_and_swap(audio_port_state::started, audio_port_state::opened); return CELL_OK; } @@ -654,9 +654,9 @@ s32 cellSurMixerGetTimestamp(u64 tag, vm::ptr stamp) { libmixer.error("cellSurMixerGetTimestamp(tag=0x%llx, stamp=*0x%x)", tag, stamp); - const auto g_audio = g_fxo->get(); + auto& g_audio = g_fxo->get(); - *stamp = g_audio->m_start_time + tag * AUDIO_BUFFER_SAMPLES * 1'000'000 / g_audio->cfg.audio_sampling_rate; + *stamp = g_audio.m_start_time + tag * AUDIO_BUFFER_SAMPLES * 1'000'000 / g_audio.cfg.audio_sampling_rate; return CELL_OK; } diff --git a/rpcs3/Emu/Cell/Modules/sceNp.cpp b/rpcs3/Emu/Cell/Modules/sceNp.cpp index e177e7212a..6f5a917b49 100644 --- a/rpcs3/Emu/Cell/Modules/sceNp.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNp.cpp @@ -399,11 +399,11 @@ error_code sceNpInit(u32 poolsize, vm::ptr poolptr) { sceNp.warning("sceNpInit(poolsize=0x%x, poolptr=*0x%x)", poolsize, poolptr); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - std::lock_guard lock(nph->mutex_status); + std::lock_guard lock(nph.mutex_status); - if (nph->is_NP_init) + if (nph.is_NP_init) { return SCE_NP_ERROR_ALREADY_INITIALIZED; } @@ -422,8 +422,8 @@ error_code sceNpInit(u32 poolsize, vm::ptr poolptr) return SCE_NP_ERROR_INVALID_ARGUMENT; } - nph->init_NP(poolsize, poolptr); - nph->is_NP_init = true; + nph.init_NP(poolsize, poolptr); + nph.is_NP_init = true; return CELL_OK; } @@ -432,17 +432,17 @@ error_code sceNpTerm() { sceNp.warning("sceNpTerm()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - std::lock_guard lock(nph->mutex_status); + std::lock_guard lock(nph.mutex_status); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } - nph->terminate_NP(); - nph->is_NP_init = false; + nph.terminate_NP(); + nph.is_NP_init = false; return CELL_OK; } @@ -473,7 +473,7 @@ error_code npDrmIsAvailable(vm::cptr k_licensee_addr, vm::cptr drm_pat return CELL_ENOENT; } - auto npdrmkeys = g_fxo->get(); + auto& npdrmkeys = g_fxo->get(); std::string rap_dir_path = "/dev_hdd0/home/" + Emu.GetUsr() + "/exdata/"; @@ -492,7 +492,7 @@ error_code npDrmIsAvailable(vm::cptr k_licensee_addr, vm::cptr drm_pat if (verify_npdrm_self_headers(enc_file, reinterpret_cast(&k_licensee))) { - npdrmkeys->devKlic = k_licensee; + npdrmkeys.devKlic = k_licensee; } else { @@ -509,10 +509,10 @@ error_code npDrmIsAvailable(vm::cptr k_licensee_addr, vm::cptr drm_pat if (VerifyEDATHeaderWithKLicense(enc_file, enc_drm_path_local, reinterpret_cast(&k_licensee), &contentID)) { const std::string rap_file = rap_dir_path + contentID + ".rap"; - npdrmkeys->devKlic = k_licensee; + npdrmkeys.devKlic = k_licensee; if (fs::is_file(vfs::get(rap_file))) - npdrmkeys->rifKey = GetEdatRifKeyFromRapFile(fs::file{vfs::get(rap_file)}); + npdrmkeys.rifKey = GetEdatRifKeyFromRapFile(fs::file{vfs::get(rap_file)}); else sceNp.warning(u8"npDrmIsAvailable(): Rap file not found: “%s”", rap_file.c_str()); } @@ -648,9 +648,9 @@ error_code sceNpBasicRegisterHandler(vm::cptr context, vm: { sceNp.warning("sceNpBasicRegisterHandler(context=*0x%x, handler=*0x%x, arg=*0x%x)", context, handler, arg); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -660,8 +660,8 @@ error_code sceNpBasicRegisterHandler(vm::cptr context, vm: return SCE_NP_BASIC_ERROR_INVALID_ARGUMENT; } - nph->basic_handler = handler; - nph->basic_handler_arg = arg; + nph.basic_handler = handler; + nph.basic_handler_arg = arg; return CELL_OK; } @@ -670,9 +670,9 @@ error_code sceNpBasicRegisterContextSensitiveHandler(vm::cptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -689,9 +689,9 @@ error_code sceNpBasicUnregisterHandler() { sceNp.todo("sceNpBasicUnregisterHandler()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -703,9 +703,9 @@ error_code sceNpBasicSetPresence(vm::cptr data, u64 size) { sceNp.todo("sceNpBasicSetPresence(data=*0x%x, size=%d)", data, size); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -722,9 +722,9 @@ error_code sceNpBasicSetPresenceDetails(vm::cptr pres { sceNp.todo("sceNpBasicSetPresenceDetails(pres=*0x%x, options=0x%x)", pres, options); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -746,9 +746,9 @@ error_code sceNpBasicSetPresenceDetails2(vm::cptr pr { sceNp.todo("sceNpBasicSetPresenceDetails2(pres=*0x%x, options=0x%x)", pres, options); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -770,9 +770,9 @@ error_code sceNpBasicSendMessage(vm::cptr to, vm::cptr data, u64 { sceNp.todo("sceNpBasicSendMessage(to=*0x%x, data=*0x%x, size=%d)", to, data, size); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -794,9 +794,9 @@ error_code sceNpBasicSendMessageGui(vm::cptr msg, sys_ { sceNp.todo("sceNpBasicSendMessageGui(msg=*0x%x, containerId=%d)", msg, containerId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -811,7 +811,7 @@ error_code sceNpBasicSendMessageGui(vm::cptr msg, sys_ return SCE_NP_BASIC_ERROR_EXCEEDS_MAX; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return not_an_error(SCE_NP_BASIC_ERROR_NOT_CONNECTED); } @@ -823,9 +823,9 @@ error_code sceNpBasicSendMessageAttachment(vm::cptr to, vm::cptr { sceNp.todo("sceNpBasicSendMessageAttachment(to=*0x%x, subject=%s, body=%s, data=%s, size=%d, containerId=%d)", to, subject, body, data, size, containerId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -840,7 +840,7 @@ error_code sceNpBasicSendMessageAttachment(vm::cptr to, vm::cptr return SCE_NP_BASIC_ERROR_EXCEEDS_MAX; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return not_an_error(SCE_NP_BASIC_ERROR_NOT_CONNECTED); } @@ -852,9 +852,9 @@ error_code sceNpBasicRecvMessageAttachment(sys_memory_container_t containerId) { sceNp.todo("sceNpBasicRecvMessageAttachment(containerId=%d)", containerId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -866,9 +866,9 @@ error_code sceNpBasicRecvMessageAttachmentLoad(u32 id, vm::ptr buffer, vm: { sceNp.todo("sceNpBasicRecvMessageAttachmentLoad(id=%d, buffer=*0x%x, size=*0x%x)", id, buffer, size); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -890,9 +890,9 @@ error_code sceNpBasicRecvMessageCustom(u16 mainType, u32 recvOptions, sys_memory { sceNp.todo("sceNpBasicRecvMessageCustom(mainType=%d, recvOptions=%d, containerId=%d)", mainType, recvOptions, containerId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -909,9 +909,9 @@ error_code sceNpBasicMarkMessageAsUsed(SceNpBasicMessageId msgId) { sceNp.todo("sceNpBasicMarkMessageAsUsed(msgId=%d)", msgId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -928,9 +928,9 @@ error_code sceNpBasicAbortGui() { sceNp.todo("sceNpBasicAbortGui()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -942,9 +942,9 @@ error_code sceNpBasicAddFriend(vm::cptr contact, vm::cptr body, s { sceNp.todo("sceNpBasicAddFriend(contact=*0x%x, body=%s, containerId=%d)", contact, body, containerId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -959,7 +959,7 @@ error_code sceNpBasicAddFriend(vm::cptr contact, vm::cptr body, s return SCE_NP_BASIC_ERROR_EXCEEDS_MAX; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return not_an_error(SCE_NP_BASIC_ERROR_NOT_CONNECTED); } @@ -971,9 +971,9 @@ error_code sceNpBasicGetFriendListEntryCount(vm::ptr count) { sceNp.todo("sceNpBasicGetFriendListEntryCount(count=*0x%x)", count); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -984,7 +984,7 @@ error_code sceNpBasicGetFriendListEntryCount(vm::ptr count) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -999,9 +999,9 @@ error_code sceNpBasicGetFriendListEntry(u32 index, vm::ptr npid) { sceNp.todo("sceNpBasicGetFriendListEntry(index=%d, npid=*0x%x)", index, npid); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1013,7 +1013,7 @@ error_code sceNpBasicGetFriendListEntry(u32 index, vm::ptr npid) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1025,9 +1025,9 @@ error_code sceNpBasicGetFriendPresenceByIndex(u32 index, vm::ptr { sceNp.todo("sceNpBasicGetFriendPresenceByIndex(index=%d, user=*0x%x, pres=*0x%x, options=%d)", index, user, pres, options); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1045,9 +1045,9 @@ error_code sceNpBasicGetFriendPresenceByIndex2(u32 index, vm::ptr { sceNp.todo("sceNpBasicGetFriendPresenceByIndex2(index=%d, user=*0x%x, pres=*0x%x, options=%d)", index, user, pres, options); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1065,9 +1065,9 @@ error_code sceNpBasicGetFriendPresenceByNpId(vm::cptr npid, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1085,9 +1085,9 @@ error_code sceNpBasicGetFriendPresenceByNpId2(vm::cptr npid, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1105,9 +1105,9 @@ error_code sceNpBasicAddPlayersHistory(vm::cptr npid, vm::ptr des { sceNp.todo("sceNpBasicAddPlayersHistory(npid=*0x%x, description=*0x%x)", npid, description); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1129,9 +1129,9 @@ error_code sceNpBasicAddPlayersHistoryAsync(vm::cptr npids, u32 count, { sceNp.todo("sceNpBasicAddPlayersHistoryAsync(npids=*0x%x, count=%d, description=*0x%x, reqId=*0x%x)", npids, count, description, reqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1164,7 +1164,7 @@ error_code sceNpBasicAddPlayersHistoryAsync(vm::cptr npids, u32 count, return SCE_NP_BASIC_ERROR_EXCEEDS_MAX; } - auto req_id = nph->add_players_to_history(npids, count); + auto req_id = nph.add_players_to_history(npids, count); if (reqId) { @@ -1178,9 +1178,9 @@ error_code sceNpBasicGetPlayersHistoryEntryCount(u32 options, vm::ptr count { sceNp.todo("sceNpBasicGetPlayersHistoryEntryCount(options=%d, count=*0x%x)", options, count); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1191,7 +1191,7 @@ error_code sceNpBasicGetPlayersHistoryEntryCount(u32 options, vm::ptr count } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1206,9 +1206,9 @@ error_code sceNpBasicGetPlayersHistoryEntry(u32 options, u32 index, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1220,7 +1220,7 @@ error_code sceNpBasicGetPlayersHistoryEntry(u32 options, u32 index, vm::ptrget_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1232,9 +1232,9 @@ error_code sceNpBasicAddBlockListEntry(vm::cptr npid) { sceNp.warning("sceNpBasicAddBlockListEntry(npid=*0x%x)", npid); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1244,7 +1244,7 @@ error_code sceNpBasicAddBlockListEntry(vm::cptr npid) return SCE_NP_BASIC_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return not_an_error(SCE_NP_BASIC_ERROR_NOT_CONNECTED); } @@ -1256,9 +1256,9 @@ error_code sceNpBasicGetBlockListEntryCount(vm::ptr count) { sceNp.warning("sceNpBasicGetBlockListEntryCount(count=*0x%x)", count); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1269,7 +1269,7 @@ error_code sceNpBasicGetBlockListEntryCount(vm::ptr count) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1284,9 +1284,9 @@ error_code sceNpBasicGetBlockListEntry(u32 index, vm::ptr npid) { sceNp.todo("sceNpBasicGetBlockListEntry(index=%d, npid=*0x%x)", index, npid); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1298,7 +1298,7 @@ error_code sceNpBasicGetBlockListEntry(u32 index, vm::ptr npid) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1310,9 +1310,9 @@ error_code sceNpBasicGetMessageAttachmentEntryCount(vm::ptr count) { sceNp.todo("sceNpBasicGetMessageAttachmentEntryCount(count=*0x%x)", count); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1323,7 +1323,7 @@ error_code sceNpBasicGetMessageAttachmentEntryCount(vm::ptr count) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1338,9 +1338,9 @@ error_code sceNpBasicGetMessageAttachmentEntry(u32 index, vm::ptr { sceNp.todo("sceNpBasicGetMessageAttachmentEntry(index=%d, from=*0x%x)", index, from); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1352,7 +1352,7 @@ error_code sceNpBasicGetMessageAttachmentEntry(u32 index, vm::ptr } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1369,10 +1369,10 @@ error_code sceNpBasicGetCustomInvitationEntryCount(vm::ptr count) return SCE_NP_AUTH_EINVAL; } - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); // TODO: Find the correct test which returns SCE_NP_AUTH_ESRCH - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_AUTH_ESRCH; } @@ -1393,10 +1393,10 @@ error_code sceNpBasicGetCustomInvitationEntry(u32 index, vm::ptr return SCE_NP_AUTH_EINVAL; } - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_AUTH_ESRCH; } @@ -1408,9 +1408,9 @@ error_code sceNpBasicGetMatchingInvitationEntryCount(vm::ptr count) { sceNp.todo("sceNpBasicGetMatchingInvitationEntryCount(count=*0x%x)", count); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1421,7 +1421,7 @@ error_code sceNpBasicGetMatchingInvitationEntryCount(vm::ptr count) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1436,9 +1436,9 @@ error_code sceNpBasicGetMatchingInvitationEntry(u32 index, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1450,7 +1450,7 @@ error_code sceNpBasicGetMatchingInvitationEntry(u32 index, vm::ptrget_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1462,9 +1462,9 @@ error_code sceNpBasicGetClanMessageEntryCount(vm::ptr count) { sceNp.todo("sceNpBasicGetClanMessageEntryCount(count=*0x%x)", count); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1475,7 +1475,7 @@ error_code sceNpBasicGetClanMessageEntryCount(vm::ptr count) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1490,9 +1490,9 @@ error_code sceNpBasicGetClanMessageEntry(u32 index, vm::ptr from) { sceNp.todo("sceNpBasicGetClanMessageEntry(index=%d, from=*0x%x)", index, from); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1504,7 +1504,7 @@ error_code sceNpBasicGetClanMessageEntry(u32 index, vm::ptr from) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1516,9 +1516,9 @@ error_code sceNpBasicGetMessageEntryCount(u32 type, vm::ptr count) { sceNp.todo("sceNpBasicGetMessageEntryCount(type=%d, count=*0x%x)", type, count); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1529,7 +1529,7 @@ error_code sceNpBasicGetMessageEntryCount(u32 type, vm::ptr count) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1544,9 +1544,9 @@ error_code sceNpBasicGetMessageEntry(u32 type, u32 index, vm::ptr { sceNp.todo("sceNpBasicGetMessageEntry(type=%d, index=%d, from=*0x%x)", type, index, from); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1558,7 +1558,7 @@ error_code sceNpBasicGetMessageEntry(u32 type, u32 index, vm::ptr } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1570,9 +1570,9 @@ error_code sceNpBasicGetEvent(vm::ptr event, vm::ptr from, v { sceNp.warning("sceNpBasicGetEvent(event=*0x%x, from=*0x%x, data=*0x%x, size=*0x%x)", event, from, data, size); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1806,9 +1806,9 @@ error_code sceNpCustomMenuRegisterActions(vm::cptr menu, vm::pt { sceNp.todo("sceNpCustomMenuRegisterActions(menu=*0x%x, handler=*0x%x, userArg=*0x%x, options=0x%x)", menu, handler, userArg, options); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED; } @@ -1825,9 +1825,9 @@ error_code sceNpCustomMenuActionSetActivation(vm::cptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED; } @@ -1844,9 +1844,9 @@ error_code sceNpCustomMenuRegisterExceptionList(vm::cptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED; } @@ -1869,9 +1869,9 @@ error_code sceNpFriendlist(vm::ptr resultHandler, { sceNp.warning("sceNpFriendlist(resultHandler=*0x%x, userArg=*0x%x, containerId=%d)", resultHandler, userArg, containerId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED; } @@ -1888,9 +1888,9 @@ error_code sceNpFriendlistCustom(SceNpFriendlistCustomOptions options, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED; } @@ -1907,9 +1907,9 @@ error_code sceNpFriendlistAbortGui() { sceNp.todo("sceNpFriendlistAbortGui()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED; } @@ -1921,19 +1921,19 @@ error_code sceNpLookupInit() { sceNp.warning("sceNpLookupInit()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (nph->is_NP_Lookup_init) + if (nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED; } - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } - nph->is_NP_Lookup_init = true; + nph.is_NP_Lookup_init = true; return CELL_OK; } @@ -1942,19 +1942,19 @@ error_code sceNpLookupTerm() { sceNp.todo("sceNpLookupTerm()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } - nph->is_NP_Lookup_init = false; + nph.is_NP_Lookup_init = false; return CELL_OK; } @@ -1963,9 +1963,9 @@ error_code sceNpLookupCreateTitleCtx(vm::cptr communicatio { sceNp.warning("sceNpLookupCreateTitleCtx(communicationId=*0x%x(%s), selfNpId=0x%x)", communicationId, communicationId->data, selfNpId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -1982,9 +1982,9 @@ error_code sceNpLookupDestroyTitleCtx(s32 titleCtxId) { sceNp.warning("sceNpLookupDestroyTitleCtx(titleCtxId=%d)", titleCtxId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -1999,14 +1999,14 @@ error_code sceNpLookupCreateTransactionCtx(s32 titleCtxId) { sceNp.warning("sceNpLookupCreateTransactionCtx(titleCtxId=%d)", titleCtxId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2018,9 +2018,9 @@ error_code sceNpLookupDestroyTransactionCtx(s32 transId) { sceNp.warning("sceNpLookupDestroyTransactionCtx(transId=%d)", transId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2037,9 +2037,9 @@ error_code sceNpLookupSetTimeout(s32 ctxId, usecond_t timeout) { sceNp.todo("sceNpLookupSetTimeout(ctxId=%d, timeout=%d)", ctxId, timeout); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2056,9 +2056,9 @@ error_code sceNpLookupAbortTransaction(s32 transId) { sceNp.todo("sceNpLookupAbortTransaction(transId=%d)", transId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2070,9 +2070,9 @@ error_code sceNpLookupWaitAsync(s32 transId, vm::ptr result) { sceNp.todo("sceNpLookupWaitAsync(transId=%d, result=%d)", transId, result); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2084,9 +2084,9 @@ error_code sceNpLookupPollAsync(s32 transId, vm::ptr result) { sceNp.todo("sceNpLookupPollAsync(transId=%d, result=*0x%x)", transId, result); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2100,9 +2100,9 @@ error_code sceNpLookupNpId(s32 transId, vm::cptr onlineId, vm::pt { sceNp.todo("sceNpLookupNpId(transId=%d, onlineId=*0x%x, npId=*0x%x, option=*0x%x)", transId, onlineId, npId, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2117,7 +2117,7 @@ error_code sceNpLookupNpId(s32 transId, vm::cptr onlineId, vm::pt return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2129,9 +2129,9 @@ error_code sceNpLookupNpIdAsync(s32 transId, vm::ptr onlineId, vm { sceNp.todo("sceNpLookupNpIdAsync(transId=%d, onlineId=*0x%x, npId=*0x%x, prio=%d, option=*0x%x)", transId, onlineId, npId, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2146,7 +2146,7 @@ error_code sceNpLookupNpIdAsync(s32 transId, vm::ptr onlineId, vm return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2160,9 +2160,9 @@ error_code sceNpLookupUserProfile(s32 transId, vm::cptr npId, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2177,7 +2177,7 @@ error_code sceNpLookupUserProfile(s32 transId, vm::cptr npId, vm::ptrget_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2191,9 +2191,9 @@ error_code sceNpLookupUserProfileAsync(s32 transId, vm::cptr npId, vm:: sceNp.todo("sceNpLookupUserProfile(transId=%d, npId=*0x%x, userInfo=*0x%x, aboutMe=*0x%x, languages=*0x%x, countryCode=*0x%x, avatarImage=*0x%x, prio=%d, option=*0x%x)", transId, npId, userInfo, aboutMe, languages, countryCode, avatarImage, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2208,7 +2208,7 @@ error_code sceNpLookupUserProfileAsync(s32 transId, vm::cptr npId, vm:: return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2223,9 +2223,9 @@ error_code sceNpLookupUserProfileWithAvatarSize(s32 transId, s32 avatarSizeType, "avatarImageDataMaxSize=%d, avatarImageDataSize=*0x%x, option=*0x%x)", transId, avatarSizeType, npId, userInfo, aboutMe, languages, countryCode, avatarImageData, avatarImageDataMaxSize, avatarImageDataSize, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2240,7 +2240,7 @@ error_code sceNpLookupUserProfileWithAvatarSize(s32 transId, s32 avatarSizeType, return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2256,9 +2256,9 @@ error_code sceNpLookupUserProfileWithAvatarSizeAsync(s32 transId, s32 avatarSize "avatarImageDataMaxSize=%d, avatarImageDataSize=*0x%x, prio=%d, option=*0x%x)", transId, avatarSizeType, npId, userInfo, aboutMe, languages, countryCode, avatarImageData, avatarImageDataMaxSize, avatarImageDataSize, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2273,7 +2273,7 @@ error_code sceNpLookupUserProfileWithAvatarSizeAsync(s32 transId, s32 avatarSize return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2285,9 +2285,9 @@ error_code sceNpLookupAvatarImage(s32 transId, vm::ptr avatarUrl { sceNp.todo("sceNpLookupAvatarImage(transId=%d, avatarUrl=*0x%x, avatarImage=*0x%x, option=*0x%x)", transId, avatarUrl, avatarImage, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2302,7 +2302,7 @@ error_code sceNpLookupAvatarImage(s32 transId, vm::ptr avatarUrl return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2314,9 +2314,9 @@ error_code sceNpLookupAvatarImageAsync(s32 transId, vm::ptr avat { sceNp.todo("sceNpLookupAvatarImageAsync(transId=%d, avatarUrl=*0x%x, avatarImage=*0x%x, prio=%d, option=*0x%x)", transId, avatarUrl, avatarImage, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2331,7 +2331,7 @@ error_code sceNpLookupAvatarImageAsync(s32 transId, vm::ptr avat return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2343,9 +2343,9 @@ error_code sceNpLookupTitleStorage() { UNIMPLEMENTED_FUNC(sceNp); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2357,9 +2357,9 @@ error_code sceNpLookupTitleStorageAsync() { UNIMPLEMENTED_FUNC(sceNp); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2371,9 +2371,9 @@ error_code sceNpLookupTitleSmallStorage(s32 transId, vm::ptr data, u64 max { sceNp.todo("sceNpLookupTitleSmallStorage(transId=%d, data=*0x%x, maxSize=%d, contentLength=*0x%x, option=*0x%x)", transId, data, maxSize, contentLength, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2393,7 +2393,7 @@ error_code sceNpLookupTitleSmallStorage(s32 transId, vm::ptr data, u64 max // return SCE_NP_COMMUNITY_ERROR_BODY_TOO_LARGE; //} - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2405,9 +2405,9 @@ error_code sceNpLookupTitleSmallStorageAsync(s32 transId, vm::ptr data, u6 { sceNp.todo("sceNpLookupTitleSmallStorageAsync(transId=%d, data=*0x%x, maxSize=%d, contentLength=*0x%x, prio=%d, option=*0x%x)", transId, data, maxSize, contentLength, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Lookup_init) + if (!nph.is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2427,7 +2427,7 @@ error_code sceNpLookupTitleSmallStorageAsync(s32 transId, vm::ptr data, u6 // return SCE_NP_COMMUNITY_ERROR_BODY_TOO_LARGE; //} - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2443,9 +2443,9 @@ error_code sceNpManagerRegisterCallback(vm::ptr callback, { sceNp.warning("sceNpManagerRegisterCallback(callback=*0x%x, arg=*0x%x)", callback, arg); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2455,8 +2455,8 @@ error_code sceNpManagerRegisterCallback(vm::ptr callback, return SCE_NP_ERROR_INVALID_ARGUMENT; } - nph->manager_cb = callback; - nph->manager_cb_arg = arg; + nph.manager_cb = callback; + nph.manager_cb_arg = arg; return CELL_OK; } @@ -2465,14 +2465,14 @@ error_code sceNpManagerUnregisterCallback() { sceNp.warning("sceNpManagerUnregisterCallback()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } - nph->manager_cb.set(0); + nph.manager_cb.set(0); return CELL_OK; } @@ -2481,9 +2481,9 @@ error_code sceNpManagerGetStatus(vm::ptr status) { sceNp.trace("sceNpManagerGetStatus(status=*0x%x)", status); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { //return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2493,7 +2493,7 @@ error_code sceNpManagerGetStatus(vm::ptr status) return SCE_NP_ERROR_INVALID_ARGUMENT; } - *status = nph->get_psn_status(); + *status = nph.get_psn_status(); return CELL_OK; } @@ -2502,9 +2502,9 @@ error_code sceNpManagerGetNetworkTime(vm::ptr pTick) { sceNp.warning("sceNpManagerGetNetworkTime(pTick=*0x%x)", pTick); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { //return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2514,12 +2514,12 @@ error_code sceNpManagerGetNetworkTime(vm::ptr pTick) return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph.get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } @@ -2544,9 +2544,9 @@ error_code sceNpManagerGetOnlineId(vm::ptr onlineId) { sceNp.warning("sceNpManagerGetOnlineId(onlineId=*0x%x)", onlineId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { //return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2556,17 +2556,17 @@ error_code sceNpManagerGetOnlineId(vm::ptr onlineId) return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph.get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } - memcpy(onlineId.get_ptr(), &nph->get_online_id(), onlineId.size()); + memcpy(onlineId.get_ptr(), &nph.get_online_id(), onlineId.size()); return CELL_OK; } @@ -2575,9 +2575,9 @@ error_code sceNpManagerGetNpId(ppu_thread& ppu, vm::ptr npId) { sceNp.warning("sceNpManagerGetNpId(npId=*0x%x)", npId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - // if (!nph->is_NP_init) + // if (!nph.is_NP_init) // { // return SCE_NP_ERROR_NOT_INITIALIZED; // } @@ -2587,17 +2587,17 @@ error_code sceNpManagerGetNpId(ppu_thread& ppu, vm::ptr npId) return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph.get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } - memcpy(npId.get_ptr(), &nph->get_npid(), npId.size()); + memcpy(npId.get_ptr(), &nph.get_npid(), npId.size()); return CELL_OK; } @@ -2606,9 +2606,9 @@ error_code sceNpManagerGetOnlineName(vm::ptr onlineName) { sceNp.warning("sceNpManagerGetOnlineName(onlineName=*0x%x)", onlineName); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2618,17 +2618,17 @@ error_code sceNpManagerGetOnlineName(vm::ptr onlineName) return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph.get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } - memcpy(onlineName.get_ptr(), &nph->get_online_name(), onlineName.size()); + memcpy(onlineName.get_ptr(), &nph.get_online_name(), onlineName.size()); return CELL_OK; } @@ -2637,9 +2637,9 @@ error_code sceNpManagerGetAvatarUrl(vm::ptr avatarUrl) { sceNp.warning("sceNpManagerGetAvatarUrl(avatarUrl=*0x%x)", avatarUrl); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2649,17 +2649,17 @@ error_code sceNpManagerGetAvatarUrl(vm::ptr avatarUrl) return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph.get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } - memcpy(avatarUrl.get_ptr(), &nph->get_avatar_url(), avatarUrl.size()); + memcpy(avatarUrl.get_ptr(), &nph.get_avatar_url(), avatarUrl.size()); return CELL_OK; } @@ -2668,9 +2668,9 @@ error_code sceNpManagerGetMyLanguages(vm::ptr myLanguages) { sceNp.warning("sceNpManagerGetMyLanguages(myLanguages=*0x%x)", myLanguages); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2680,12 +2680,12 @@ error_code sceNpManagerGetMyLanguages(vm::ptr myLanguages) return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph.get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } @@ -2697,9 +2697,9 @@ error_code sceNpManagerGetAccountRegion(vm::ptr countryCode, v { sceNp.warning("sceNpManagerGetAccountRegion(countryCode=*0x%x, language=*0x%x)", countryCode, language); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2709,12 +2709,12 @@ error_code sceNpManagerGetAccountRegion(vm::ptr countryCode, v return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph.get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } @@ -2732,9 +2732,9 @@ error_code sceNpManagerGetAccountAge(vm::ptr age) { sceNp.warning("sceNpManagerGetAccountAge(age=*0x%x)", age); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2744,12 +2744,12 @@ error_code sceNpManagerGetAccountAge(vm::ptr age) return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph.get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } @@ -2763,9 +2763,9 @@ error_code sceNpManagerGetContentRatingFlag(vm::ptr isRestricted, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2775,12 +2775,12 @@ error_code sceNpManagerGetContentRatingFlag(vm::ptr isRestricted, vm::ptrget_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph.get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } @@ -2796,9 +2796,9 @@ error_code sceNpManagerGetChatRestrictionFlag(vm::ptr isRestricted) { sceNp.trace("sceNpManagerGetChatRestrictionFlag(isRestricted=*0x%x)", isRestricted); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2808,12 +2808,12 @@ error_code sceNpManagerGetChatRestrictionFlag(vm::ptr isRestricted) return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph.get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } @@ -2828,9 +2828,9 @@ error_code sceNpManagerGetCachedInfo(CellSysutilUserId userId, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2853,9 +2853,9 @@ error_code sceNpManagerRequestTicket(vm::cptr npId, vm::cptr serv { sceNp.error("sceNpManagerRequestTicket(npId=*0x%x, serviceId=%s, cookie=*0x%x, cookieSize=%d, entitlementId=%s, consumedCount=%d)", npId, serviceId, cookie, cookieSize, entitlementId, consumedCount); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2865,17 +2865,17 @@ error_code sceNpManagerRequestTicket(vm::cptr npId, vm::cptr serv return SCE_NP_AUTH_EINVALID_ARGUMENT; } - if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph.get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } - nph->req_ticket(0x00020001, npId.get_ptr(), serviceId.get_ptr(), reinterpret_cast(cookie.get_ptr()), cookieSize, entitlementId.get_ptr(), consumedCount); + nph.req_ticket(0x00020001, npId.get_ptr(), serviceId.get_ptr(), reinterpret_cast(cookie.get_ptr()), cookieSize, entitlementId.get_ptr(), consumedCount); return CELL_OK; } @@ -2886,9 +2886,9 @@ error_code sceNpManagerRequestTicket2(vm::cptr npId, vm::cptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2898,17 +2898,17 @@ error_code sceNpManagerRequestTicket2(vm::cptr npId, vm::cptrget_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph.get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } - nph->req_ticket(0x00020001, npId.get_ptr(), serviceId.get_ptr(), reinterpret_cast(cookie.get_ptr()), cookieSize, entitlementId.get_ptr(), consumedCount); + nph.req_ticket(0x00020001, npId.get_ptr(), serviceId.get_ptr(), reinterpret_cast(cookie.get_ptr()), cookieSize, entitlementId.get_ptr(), consumedCount); return CELL_OK; } @@ -2917,9 +2917,9 @@ error_code sceNpManagerGetTicket(vm::ptr buffer, vm::ptr bufferSize) { sceNp.error("sceNpManagerGetTicket(buffer=*0x%x, bufferSize=*0x%x)", buffer, bufferSize); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2929,7 +2929,7 @@ error_code sceNpManagerGetTicket(vm::ptr buffer, vm::ptr bufferSize) return SCE_NP_ERROR_INVALID_ARGUMENT; } - const auto& ticket = nph->get_ticket(); + const auto& ticket = nph.get_ticket(); if (!buffer) { @@ -2951,9 +2951,9 @@ error_code sceNpManagerGetTicketParam(s32 paramId, vm::ptr par { sceNp.todo("sceNpManagerGetTicketParam(paramId=%d, param=*0x%x)", paramId, param); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2971,9 +2971,9 @@ error_code sceNpManagerGetEntitlementIdList(vm::ptr entIdLis { sceNp.todo("sceNpManagerGetEntitlementIdList(entIdList=*0x%x, entIdListNum=%d)", entIdList, entIdListNum); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2985,9 +2985,9 @@ error_code sceNpManagerGetEntitlementById(vm::cptr entId, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -3010,9 +3010,9 @@ error_code sceNpManagerSubSignin(CellSysutilUserId userId, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -3030,9 +3030,9 @@ error_code sceNpManagerSubSignout(vm::ptr npId) { sceNp.todo("sceNpManagerSubSignout(npId=*0x%x)", npId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -3204,9 +3204,9 @@ error_code sceNpProfileCallGui(vm::cptr npid, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -3223,9 +3223,9 @@ error_code sceNpProfileAbortGui() { sceNp.todo("sceNpProfileAbortGui()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -3237,19 +3237,19 @@ error_code sceNpScoreInit() { sceNp.warning("sceNpScoreInit()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (nph->is_NP_Score_init) + if (nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED; } - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } - nph->is_NP_Score_init = true; + nph.is_NP_Score_init = true; return CELL_OK; } @@ -3258,19 +3258,19 @@ error_code sceNpScoreTerm() { sceNp.warning("sceNpScoreTerm()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } - nph->is_NP_Score_init = false; + nph.is_NP_Score_init = false; return CELL_OK; } @@ -3279,9 +3279,9 @@ error_code sceNpScoreCreateTitleCtx(vm::cptr communication { sceNp.todo("sceNpScoreCreateTitleCtx(communicationId=*0x%x, passphrase=*0x%x, selfNpId=*0x%x)", communicationId, passphrase, selfNpId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3298,9 +3298,9 @@ error_code sceNpScoreDestroyTitleCtx(s32 titleCtxId) { sceNp.todo("sceNpScoreDestroyTitleCtx(titleCtxId=%d)", titleCtxId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3315,14 +3315,14 @@ error_code sceNpScoreCreateTransactionCtx(s32 titleCtxId) { sceNp.todo("sceNpScoreCreateTransactionCtx(titleCtxId=%d)", titleCtxId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph.get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3334,9 +3334,9 @@ error_code sceNpScoreDestroyTransactionCtx(s32 transId) { sceNp.todo("sceNpScoreDestroyTransactionCtx(transId=%d)", transId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3348,9 +3348,9 @@ error_code sceNpScoreSetTimeout(s32 ctxId, usecond_t timeout) { sceNp.todo("sceNpScoreSetTimeout(ctxId=%d, timeout=%d)", ctxId, timeout); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3367,9 +3367,9 @@ error_code sceNpScoreSetPlayerCharacterId(s32 ctxId, SceNpScorePcId pcId) { sceNp.todo("sceNpScoreSetPlayerCharacterId(ctxId=%d, pcId=%d)", ctxId, pcId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3386,9 +3386,9 @@ error_code sceNpScoreWaitAsync(s32 transId, vm::ptr result) { sceNp.todo("sceNpScoreWaitAsync(transId=%d, result=*0x%x)", transId, result); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3405,9 +3405,9 @@ error_code sceNpScorePollAsync(s32 transId, vm::ptr result) { sceNp.todo("sceNpScorePollAsync(transId=%d, result=*0x%x)", transId, result); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3424,9 +3424,9 @@ error_code sceNpScoreGetBoardInfo(s32 transId, SceNpScoreBoardId boardId, vm::pt { sceNp.todo("sceNpScoreGetBoardInfo(transId=%d, boardId=%d, boardInfo=*0x%x, option=*0x%x)", transId, boardId, boardInfo, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3441,7 +3441,7 @@ error_code sceNpScoreGetBoardInfo(s32 transId, SceNpScoreBoardId boardId, vm::pt return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3453,9 +3453,9 @@ error_code sceNpScoreGetBoardInfoAsync(s32 transId, SceNpScoreBoardId boardId, v { sceNp.todo("sceNpScoreGetBoardInfo(transId=%d, boardId=%d, boardInfo=*0x%x, prio=%d, option=*0x%x)", transId, boardId, boardInfo, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3474,9 +3474,9 @@ error_code sceNpScoreRecordScore(s32 transId, SceNpScoreBoardId boardId, SceNpSc sceNp.todo( "sceNpScoreRecordScore(transId=%d, boardId=%d, score=%d, scoreComment=*0x%x, gameInfo=*0x%x, tmpRank=*0x%x, option=*0x%x)", transId, boardId, score, scoreComment, gameInfo, tmpRank, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3486,7 +3486,7 @@ error_code sceNpScoreRecordScore(s32 transId, SceNpScoreBoardId boardId, SceNpSc return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3500,9 +3500,9 @@ error_code sceNpScoreRecordScoreAsync(s32 transId, SceNpScoreBoardId boardId, Sc sceNp.todo("sceNpScoreRecordScoreAsync(transId=%d, boardId=%d, score=%d, scoreComment=*0x%x, gameInfo=*0x%x, tmpRank=*0x%x, prio=%d, option=*0x%x)", transId, boardId, score, scoreComment, gameInfo, tmpRank, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3519,9 +3519,9 @@ error_code sceNpScoreRecordGameData(s32 transId, SceNpScoreBoardId boardId, SceN { sceNp.todo("sceNpScoreRecordGameData(transId=%d, boardId=%d, score=%d, totalSize=%d, sendSize=%d, data=*0x%x, option=*0x%x)", transId, boardId, score, totalSize, sendSize, data, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3536,7 +3536,7 @@ error_code sceNpScoreRecordGameData(s32 transId, SceNpScoreBoardId boardId, SceN return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3549,9 +3549,9 @@ error_code sceNpScoreRecordGameDataAsync(s32 transId, SceNpScoreBoardId boardId, sceNp.todo( "sceNpScoreRecordGameDataAsync(transId=%d, boardId=%d, score=%d, totalSize=%d, sendSize=%d, data=*0x%x, prio=%d, option=*0x%x)", transId, boardId, score, totalSize, sendSize, data, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3568,9 +3568,9 @@ error_code sceNpScoreGetGameData(s32 transId, SceNpScoreBoardId boardId, vm::cpt { sceNp.todo("sceNpScoreGetGameDataAsync(transId=%d, boardId=%d, npId=*0x%x, totalSize=*0x%x, recvSize=%d, data=*0x%x, option=*0x%x)", transId, boardId, npId, totalSize, recvSize, data, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3585,7 +3585,7 @@ error_code sceNpScoreGetGameData(s32 transId, SceNpScoreBoardId boardId, vm::cpt return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3598,9 +3598,9 @@ error_code sceNpScoreGetGameDataAsync(s32 transId, SceNpScoreBoardId boardId, vm sceNp.todo("sceNpScoreGetGameDataAsync(transId=%d, boardId=%d, npId=*0x%x, totalSize=*0x%x, recvSize=%d, data=*0x%x, prio=%d, option=*0x%x)", transId, boardId, npId, totalSize, recvSize, data, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3621,9 +3621,9 @@ error_code sceNpScoreGetRankingByNpId(s32 transId, SceNpScoreBoardId boardId, vm "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", transId, boardId, npIdArray, npIdArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3643,7 +3643,7 @@ error_code sceNpScoreGetRankingByNpId(s32 transId, SceNpScoreBoardId boardId, vm return SCE_NP_COMMUNITY_ERROR_TOO_MANY_NPID; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3659,9 +3659,9 @@ error_code sceNpScoreGetRankingByNpIdAsync(s32 transId, SceNpScoreBoardId boardI "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", transId, boardId, npIdArray, npIdArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3687,9 +3687,9 @@ error_code sceNpScoreGetRankingByRange(s32 transId, SceNpScoreBoardId boardId, S "arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", transId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3709,7 +3709,7 @@ error_code sceNpScoreGetRankingByRange(s32 transId, SceNpScoreBoardId boardId, S return SCE_NP_COMMUNITY_ERROR_TOO_LARGE_RANGE; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3725,9 +3725,9 @@ error_code sceNpScoreGetRankingByRangeAsync(s32 transId, SceNpScoreBoardId board "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", transId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3752,9 +3752,9 @@ error_code sceNpScoreGetFriendsRanking(s32 transId, SceNpScoreBoardId boardId, s "arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", transId, boardId, includeSelf, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3780,9 +3780,9 @@ error_code sceNpScoreGetFriendsRankingAsync(s32 transId, SceNpScoreBoardId board "arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", transId, boardId, includeSelf, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3804,9 +3804,9 @@ error_code sceNpScoreCensorComment(s32 transId, vm::cptr comment, vm::ptr< { sceNp.todo("sceNpScoreCensorComment(transId=%d, comment=%s, option=*0x%x)", transId, comment, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3822,7 +3822,7 @@ error_code sceNpScoreCensorComment(s32 transId, vm::cptr comment, vm::ptr< return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3834,9 +3834,9 @@ error_code sceNpScoreCensorCommentAsync(s32 transId, vm::cptr comment, s32 { sceNp.todo("sceNpScoreCensorCommentAsync(transId=%d, comment=%s, prio=%d, option=*0x%x)", transId, comment, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3859,9 +3859,9 @@ error_code sceNpScoreSanitizeComment(s32 transId, vm::cptr comment, vm::pt { sceNp.todo("sceNpScoreSanitizeComment(transId=%d, comment=%s, sanitizedComment=*0x%x, option=*0x%x)", transId, comment, sanitizedComment, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3877,7 +3877,7 @@ error_code sceNpScoreSanitizeComment(s32 transId, vm::cptr comment, vm::pt return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3889,9 +3889,9 @@ error_code sceNpScoreSanitizeCommentAsync(s32 transId, vm::cptr comment, v { sceNp.todo("sceNpScoreSanitizeCommentAsync(transId=%d, comment=%s, sanitizedComment=*0x%x, prio=%d, option=*0x%x)", transId, comment, sanitizedComment, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3918,9 +3918,9 @@ error_code sceNpScoreGetRankingByNpIdPcId(s32 transId, SceNpScoreBoardId boardId "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", transId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3940,7 +3940,7 @@ error_code sceNpScoreGetRankingByNpIdPcId(s32 transId, SceNpScoreBoardId boardId return SCE_NP_COMMUNITY_ERROR_TOO_MANY_NPID; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3956,9 +3956,9 @@ error_code sceNpScoreGetRankingByNpIdPcIdAsync(s32 transId, SceNpScoreBoardId bo "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", transId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3980,9 +3980,9 @@ error_code sceNpScoreAbortTransaction(s32 transId) { sceNp.todo("sceNpScoreAbortTransaction(transId=%d)", transId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3999,9 +3999,9 @@ error_code sceNpScoreGetClansMembersRankingByNpId(s32 transId, SceNpClanId clanI transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, totalRecord, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -4021,7 +4021,7 @@ error_code sceNpScoreGetClansMembersRankingByNpId(s32 transId, SceNpClanId clanI return SCE_NP_COMMUNITY_ERROR_TOO_MANY_NPID; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -4039,9 +4039,9 @@ error_code sceNpScoreGetClansMembersRankingByNpIdAsync(s32 transId, SceNpClanId transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, totalRecord, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -4069,9 +4069,9 @@ error_code sceNpScoreGetClansMembersRankingByNpIdPcId(s32 transId, SceNpClanId c transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, totalRecord, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -4091,7 +4091,7 @@ error_code sceNpScoreGetClansMembersRankingByNpIdPcId(s32 transId, SceNpClanId c return SCE_NP_COMMUNITY_ERROR_TOO_MANY_NPID; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -4110,9 +4110,9 @@ error_code sceNpScoreGetClansMembersRankingByNpIdPcIdAsync(s32 transId, SceNpCla transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, totalRecord, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -4138,9 +4138,9 @@ error_code sceNpScoreGetClansRankingByRange(s32 transId, SceNpScoreClansBoardId "arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", transId, clanBoardId, startSerialRank, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -4160,7 +4160,7 @@ error_code sceNpScoreGetClansRankingByRange(s32 transId, SceNpScoreClansBoardId return SCE_NP_COMMUNITY_ERROR_TOO_LARGE_RANGE; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -4176,9 +4176,9 @@ error_code sceNpScoreGetClansRankingByRangeAsync(s32 transId, SceNpScoreClansBoa "reservedSize2=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", transId, clanBoardId, startSerialRank, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -4202,9 +4202,9 @@ error_code sceNpScoreGetClanMemberGameData( sceNp.todo("sceNpScoreGetClanMemberGameData(transId=%d, boardId=%d, clanId=%d, npId=*0x%x, totalSize=*0x%x, recvSize=%d, data=*0x%x, option=*0x%x)", transId, boardId, clanId, npId, totalSize, recvSize, data, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -4219,7 +4219,7 @@ error_code sceNpScoreGetClanMemberGameData( return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -4233,9 +4233,9 @@ error_code sceNpScoreGetClanMemberGameDataAsync( sceNp.todo("sceNpScoreGetClanMemberGameDataAsync(transId=%d, boardId=%d, clanId=%d, npId=*0x%x, totalSize=*0x%x, recvSize=%d, data=*0x%x, prio=%d, option=*0x%x)", transId, boardId, clanId, npId, totalSize, recvSize, data, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -4256,9 +4256,9 @@ error_code sceNpScoreGetClansRankingByClanId(s32 transId, SceNpScoreClansBoardId "reserved2=*0x%x, reservedSize2=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", transId, clanBoardId, clanIdArray, clanIdArraySize, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -4278,7 +4278,7 @@ error_code sceNpScoreGetClansRankingByClanId(s32 transId, SceNpScoreClansBoardId return SCE_NP_COMMUNITY_ERROR_TOO_MANY_NPID; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -4294,9 +4294,9 @@ error_code sceNpScoreGetClansRankingByClanIdAsync(s32 transId, SceNpScoreClansBo "reserved2=*0x%x, reservedSize2=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", transId, clanBoardId, clanIdArray, clanIdArraySize, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -4323,9 +4323,9 @@ error_code sceNpScoreGetClansMembersRankingByRange(s32 transId, SceNpClanId clan transId, clanId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, totalRecord, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -4345,7 +4345,7 @@ error_code sceNpScoreGetClansMembersRankingByRange(s32 transId, SceNpClanId clan return SCE_NP_COMMUNITY_ERROR_TOO_LARGE_RANGE; } - if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -4362,9 +4362,9 @@ error_code sceNpScoreGetClansMembersRankingByRangeAsync(s32 transId, SceNpClanId transId, clanId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, totalRecord, prio, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Score_init) + if (!nph.is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -4386,9 +4386,9 @@ error_code sceNpSignalingCreateCtx(vm::ptr npId, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4405,8 +4405,8 @@ error_code sceNpSignalingCreateCtx(vm::ptr npId, vm::ptrget>(); - sigh->set_sig_cb(*ctx_id, handler, arg); + auto& sigh = g_fxo->get>(); + sigh.set_sig_cb(*ctx_id, handler, arg); return CELL_OK; } @@ -4415,9 +4415,9 @@ error_code sceNpSignalingDestroyCtx(u32 ctx_id) { sceNp.todo("sceNpSignalingDestroyCtx(ctx_id=%d)", ctx_id); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4434,15 +4434,15 @@ error_code sceNpSignalingAddExtendedHandler(u32 ctx_id, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } - const auto sigh = g_fxo->get>(); - sigh->set_ext_sig_cb(ctx_id, handler, arg); + auto& sigh = g_fxo->get>(); + sigh.set_ext_sig_cb(ctx_id, handler, arg); return CELL_OK; } @@ -4451,9 +4451,9 @@ error_code sceNpSignalingSetCtxOpt(u32 ctx_id, s32 optname, s32 optval) { sceNp.todo("sceNpSignalingSetCtxOpt(ctx_id=%d, optname=%d, optval=%d)", ctx_id, optname, optval); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4470,9 +4470,9 @@ error_code sceNpSignalingGetCtxOpt(u32 ctx_id, s32 optname, vm::ptr optval) { sceNp.todo("sceNpSignalingGetCtxOpt(ctx_id=%d, optname=%d, optval=*0x%x)", ctx_id, optname, optval); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4489,9 +4489,9 @@ error_code sceNpSignalingActivateConnection(u32 ctx_id, vm::ptr npId, v { sceNp.warning("sceNpSignalingActivateConnection(ctx_id=%d, npId=*0x%x, conn_id=*0x%x)", ctx_id, npId, conn_id); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4501,11 +4501,11 @@ error_code sceNpSignalingActivateConnection(u32 ctx_id, vm::ptr npId, v return SCE_NP_SIGNALING_ERROR_INVALID_ARGUMENT; } - if (strncmp(nph->get_npid().handle.data, npId->handle.data, 16) == 0) + if (strncmp(nph.get_npid().handle.data, npId->handle.data, 16) == 0) return SCE_NP_SIGNALING_ERROR_OWN_NP_ID; - const auto sigh = g_fxo->get>(); - *conn_id = sigh->init_sig_infos(npId.get_ptr()); + auto& sigh = g_fxo->get>(); + *conn_id = sigh.init_sig_infos(npId.get_ptr()); return CELL_OK; } @@ -4514,9 +4514,9 @@ error_code sceNpSignalingDeactivateConnection(u32 ctx_id, u32 conn_id) { sceNp.todo("sceNpSignalingDeactivateConnection(ctx_id=%d, conn_id=%d)", ctx_id, conn_id); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4528,9 +4528,9 @@ error_code sceNpSignalingTerminateConnection(u32 ctx_id, u32 conn_id) { sceNp.todo("sceNpSignalingTerminateConnection(ctx_id=%d, conn_id=%d)", ctx_id, conn_id); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4542,9 +4542,9 @@ error_code sceNpSignalingGetConnectionStatus(u32 ctx_id, u32 conn_id, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4554,8 +4554,9 @@ error_code sceNpSignalingGetConnectionStatus(u32 ctx_id, u32 conn_id, vm::ptrget>(); - const auto si = sigh->get_sig_infos(conn_id); + auto& sigh = g_fxo->get>(); + + const auto si = sigh.get_sig_infos(conn_id); *conn_status = si.connStatus; if (peer_addr) @@ -4570,9 +4571,9 @@ error_code sceNpSignalingGetConnectionInfo(u32 ctx_id, u32 conn_id, s32 code, vm { sceNp.todo("sceNpSignalingGetConnectionInfo(ctx_id=%d, conn_id=%d, code=%d, info=*0x%x)", ctx_id, conn_id, code, info); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4589,9 +4590,9 @@ error_code sceNpSignalingGetConnectionFromNpId(u32 ctx_id, vm::ptr npId { sceNp.todo("sceNpSignalingGetConnectionFromNpId(ctx_id=%d, npId=*0x%x, conn_id=*0x%x)", ctx_id, npId, conn_id); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4608,9 +4609,9 @@ error_code sceNpSignalingGetConnectionFromPeerAddress(u32 ctx_id, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4627,9 +4628,9 @@ error_code sceNpSignalingGetLocalNetInfo(u32 ctx_id, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4639,8 +4640,8 @@ error_code sceNpSignalingGetLocalNetInfo(u32 ctx_id, vm::ptrlocal_addr = nph->get_local_ip_addr(); - info->mapped_addr = nph->get_public_ip_addr(); + info->local_addr = nph.get_local_ip_addr(); + info->mapped_addr = nph.get_public_ip_addr(); // Pure speculation below info->nat_status = 0; @@ -4655,9 +4656,9 @@ error_code sceNpSignalingGetPeerNetInfo(u32 ctx_id, vm::ptr npId, vm::p { sceNp.todo("sceNpSignalingGetPeerNetInfo(ctx_id=%d, npId=*0x%x, req_id=*0x%x)", ctx_id, npId, req_id); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4674,9 +4675,9 @@ error_code sceNpSignalingCancelPeerNetInfo(u32 ctx_id, u32 req_id) { sceNp.todo("sceNpSignalingCancelPeerNetInfo(ctx_id=%d, req_id=%d)", ctx_id, req_id); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4688,9 +4689,9 @@ error_code sceNpSignalingGetPeerNetInfoResult(u32 ctx_id, u32 req_id, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_init) + if (!nph.is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } diff --git a/rpcs3/Emu/Cell/Modules/sceNp2.cpp b/rpcs3/Emu/Cell/Modules/sceNp2.cpp index fbf617194b..841a022328 100644 --- a/rpcs3/Emu/Cell/Modules/sceNp2.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNp2.cpp @@ -178,9 +178,9 @@ error_code sceNpMatching2Init2(u64 stackSize, s32 priority, vm::ptr *nph, SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::ptr assignedReqId) +error_code generic_match2_error_check(const named_thread& nph, SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::ptr assignedReqId) { - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -207,11 +207,11 @@ error_code sceNp2Init(u32 poolsize, vm::ptr poolptr) { sceNp2.warning("sceNp2Init(poolsize=0x%x, poolptr=*0x%x)", poolsize, poolptr); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); { - std::lock_guard lock(nph->mutex_status); - if (nph->is_NP2_init) + std::lock_guard lock(nph.mutex_status); + if (nph.is_NP2_init) { return SCE_NP_ERROR_ALREADY_INITIALIZED; } @@ -224,7 +224,7 @@ error_code sceNp2Init(u32 poolsize, vm::ptr poolptr) return result; } - nph->is_NP2_init = true; + nph.is_NP2_init = true; return CELL_OK; } @@ -239,14 +239,14 @@ error_code sceNpMatching2Init2(u64 stackSize, s32 priority, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_init) + if (!nph.is_NP2_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } - if (nph->is_NP2_Match2_init) + if (nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_ALREADY_INITIALIZED; } @@ -256,7 +256,7 @@ error_code sceNpMatching2Init2(u64 stackSize, s32 priority, vm::ptris_NP2_Match2_init = true; + nph.is_NP2_Match2_init = true; return CELL_OK; } @@ -265,11 +265,11 @@ error_code sceNp2Term(ppu_thread& ppu) { sceNp2.warning("sceNp2Term()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); { - std::lock_guard lock(nph->mutex_status); - if (!nph->is_NP2_init) + std::lock_guard lock(nph.mutex_status); + if (!nph.is_NP2_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -280,7 +280,7 @@ error_code sceNp2Term(ppu_thread& ppu) // cellSysutilUnregisterCallbackDispatcher(); sceNpTerm(); - nph->is_NP2_init = false; + nph.is_NP2_init = false; return CELL_OK; } @@ -295,21 +295,21 @@ error_code sceNpMatching2Term2() { sceNp2.warning("sceNpMatching2Term2()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); { - std::lock_guard lock(nph->mutex_status); - if (!nph->is_NP2_init) + std::lock_guard lock(nph.mutex_status); + if (!nph.is_NP2_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - nph->is_NP2_Match2_init = false; + nph.is_NP2_Match2_init = false; } // TODO: for all contexts: sceNpMatching2DestroyContext @@ -321,9 +321,9 @@ error_code sceNpMatching2DestroyContext(SceNpMatching2ContextId ctxId) { sceNp2.todo("sceNpMatching2DestroyContext(ctxId=%d)", ctxId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -339,7 +339,7 @@ error_code sceNpMatching2LeaveLobby( { sceNp2.todo("sceNpMatching2LeaveLobby(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -352,9 +352,9 @@ error_code sceNpMatching2RegisterLobbyMessageCallback(SceNpMatching2ContextId ct { sceNp2.todo("sceNpMatching2RegisterLobbyMessageCallback(ctxId=%d, cbFunc=*0x%x, cbFuncArg=*0x%x)", ctxId, cbFunc, cbFuncArg); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -367,7 +367,7 @@ error_code sceNpMatching2GetWorldInfoList( { sceNp2.warning("sceNpMatching2GetWorldInfoList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -378,7 +378,7 @@ error_code sceNpMatching2GetWorldInfoList( return SCE_NP_MATCHING2_ERROR_INVALID_SERVER_ID; } - *assignedReqId = nph->get_world_list(ctxId, optParam, reqParam->serverId); + *assignedReqId = nph.get_world_list(ctxId, optParam, reqParam->serverId); return CELL_OK; } @@ -387,9 +387,9 @@ error_code sceNpMatching2RegisterLobbyEventCallback(SceNpMatching2ContextId ctxI { sceNp2.todo("sceNpMatching2RegisterLobbyEventCallback(ctxId=%d, cbFunc=*0x%x, cbFuncArg=*0x%x)", ctxId, cbFunc, cbFuncArg); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -402,7 +402,7 @@ error_code sceNpMatching2GetLobbyMemberDataInternalList(SceNpMatching2ContextId { sceNp2.todo("sceNpMatching2GetLobbyMemberDataInternalList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -416,13 +416,13 @@ error_code sceNpMatching2SearchRoom( { sceNp2.warning("sceNpMatching2SearchRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; } - *assignedReqId = nph->search_room(ctxId, optParam, reqParam.get_ptr()); + *assignedReqId = nph.search_room(ctxId, optParam, reqParam.get_ptr()); return CELL_OK; } @@ -432,9 +432,9 @@ error_code sceNpMatching2SignalingGetConnectionStatus( { sceNp2.warning("sceNpMatching2SignalingGetConnectionStatus(ctxId=%d, roomId=%d, memberId=%d, connStatus=*0x%x, peerAddr=*0x%x, peerPort=*0x%x)", ctxId, roomId, memberId, connStatus, peerAddr, peerPort); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -444,8 +444,9 @@ error_code sceNpMatching2SignalingGetConnectionStatus( return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; } - const auto sigh = g_fxo->get>(); - const auto si = sigh->get_sig2_infos(roomId, memberId); + auto& sigh = g_fxo->get>(); + + const auto si = sigh.get_sig2_infos(roomId, memberId); *connStatus = si.connStatus; @@ -467,7 +468,7 @@ error_code sceNpMatching2SetUserInfo( { sceNp2.todo("sceNpMatching2SetUserInfo(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -480,9 +481,9 @@ error_code sceNpMatching2GetClanLobbyId(SceNpMatching2ContextId ctxId, SceNpClan { sceNp2.todo("sceNpMatching2GetClanLobbyId(ctxId=%d, clanId=%d, lobbyId=*0x%x)", ctxId, clanId, lobbyId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -495,7 +496,7 @@ error_code sceNpMatching2GetLobbyMemberDataInternal( { sceNp2.todo("sceNpMatching2GetLobbyMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -508,9 +509,9 @@ error_code sceNpMatching2ContextStart(SceNpMatching2ContextId ctxId) { sceNp2.warning("sceNpMatching2ContextStart(ctxId=%d)", ctxId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -521,7 +522,8 @@ error_code sceNpMatching2ContextStart(SceNpMatching2ContextId ctxId) if (ctx->context_callback) { - sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { ctx->context_callback(cb_ppu, ctxId, SCE_NP_MATCHING2_CONTEXT_EVENT_Start, SCE_NP_MATCHING2_EVENT_CAUSE_CONTEXT_ACTION, 0, ctx->context_callback_param); return 0; }); @@ -535,7 +537,7 @@ error_code sceNpMatching2CreateServerContext( { sceNp2.warning("sceNpMatching2CreateServerContext(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -546,7 +548,7 @@ error_code sceNpMatching2CreateServerContext( return SCE_NP_MATCHING2_ERROR_INVALID_SERVER_ID; } - *assignedReqId = nph->create_server_context(ctxId, optParam, reqParam->serverId); + *assignedReqId = nph.create_server_context(ctxId, optParam, reqParam->serverId); return CELL_OK; } @@ -555,9 +557,9 @@ error_code sceNpMatching2GetMemoryInfo(vm::ptr memInfo { sceNp2.todo("sceNpMatching2GetMemoryInfo(memInfo=*0x%x)", memInfo); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -570,13 +572,13 @@ error_code sceNpMatching2LeaveRoom( { sceNp2.warning("sceNpMatching2LeaveRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; } - *assignedReqId = nph->leave_room(ctxId, optParam, reqParam.get_ptr()); + *assignedReqId = nph.leave_room(ctxId, optParam, reqParam.get_ptr()); return CELL_OK; } @@ -586,13 +588,13 @@ error_code sceNpMatching2SetRoomDataExternal( { sceNp2.warning("sceNpMatching2SetRoomDataExternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; } - *assignedReqId = nph->set_roomdata_external(ctxId, optParam, reqParam.get_ptr()); + *assignedReqId = nph.set_roomdata_external(ctxId, optParam, reqParam.get_ptr()); return CELL_OK; } @@ -602,9 +604,9 @@ error_code sceNpMatching2SignalingGetConnectionInfo( { sceNp2.todo("sceNpMatching2SignalingGetConnectionInfo(ctxId=%d, roomId=%d, memberId=%d, code=%d, connInfo=*0x%x)", ctxId, roomId, memberId, code, connInfo); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -623,8 +625,8 @@ error_code sceNpMatching2SignalingGetConnectionInfo( } case 5: { - const auto sigh = g_fxo->get>(); - const auto si = sigh->get_sig2_infos(roomId, memberId); + auto& sigh = g_fxo->get>(); + const auto si = sigh.get_sig2_infos(roomId, memberId); connInfo->address.port = std::bit_cast>(si.port); connInfo->address.addr.np_s_addr = si.addr; break; @@ -649,13 +651,13 @@ error_code sceNpMatching2SendRoomMessage( { sceNp2.todo("sceNpMatching2SendRoomMessage(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; } - *assignedReqId = nph->send_room_message(ctxId, optParam, reqParam.get_ptr()); + *assignedReqId = nph.send_room_message(ctxId, optParam, reqParam.get_ptr()); return CELL_OK; } @@ -665,7 +667,7 @@ error_code sceNpMatching2JoinLobby( { sceNp2.todo("sceNpMatching2JoinLobby(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -679,7 +681,7 @@ error_code sceNpMatching2GetRoomMemberDataExternalList(SceNpMatching2ContextId c { sceNp2.todo("sceNpMatching2GetRoomMemberDataExternalList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -692,9 +694,9 @@ error_code sceNpMatching2AbortRequest(SceNpMatching2ContextId ctxId, SceNpMatchi { sceNp2.todo("sceNpMatching2AbortRequest(ctxId=%d, reqId=%d)", ctxId, reqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -707,13 +709,13 @@ error_code sceNpMatching2GetServerInfo( { sceNp2.warning("sceNpMatching2GetServerInfo(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; } - *assignedReqId = nph->get_server_status(ctxId, optParam, reqParam->serverId); + *assignedReqId = nph.get_server_status(ctxId, optParam, reqParam->serverId); return CELL_OK; } @@ -722,9 +724,9 @@ error_code sceNpMatching2GetEventData(SceNpMatching2ContextId ctxId, SceNpMatchi { sceNp2.notice("sceNpMatching2GetEventData(ctxId=%d, eventKey=%d, buf=*0x%x, bufLen=%d)", ctxId, eventKey, buf, bufLen); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -734,16 +736,16 @@ error_code sceNpMatching2GetEventData(SceNpMatching2ContextId ctxId, SceNpMatchi return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; } - return not_an_error(nph->get_match2_event(eventKey, static_cast(buf.get_ptr()), bufLen)); + return not_an_error(nph.get_match2_event(eventKey, static_cast(buf.get_ptr()), bufLen)); } error_code sceNpMatching2GetRoomSlotInfoLocal(SceNpMatching2ContextId ctxId, const SceNpMatching2RoomId roomId, vm::ptr roomSlotInfo) { sceNp2.todo("sceNpMatching2GetRoomSlotInfoLocal(ctxId=%d, roomId=%d, roomSlotInfo=*0x%x)", ctxId, roomId, roomSlotInfo); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -756,7 +758,7 @@ error_code sceNpMatching2SendLobbyChatMessage( { sceNp2.todo("sceNpMatching2SendLobbyChatMessage(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -769,9 +771,9 @@ error_code sceNpMatching2AbortContextStart(SceNpMatching2ContextId ctxId) { sceNp2.todo("sceNpMatching2AbortContextStart(ctxId=%d)", ctxId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -783,9 +785,9 @@ error_code sceNpMatching2GetRoomMemberIdListLocal(SceNpMatching2ContextId ctxId, { sceNp2.todo("sceNpMatching2GetRoomMemberIdListLocal(ctxId=%d, roomId=%d, sortMethod=%d, memberId=*0x%x, memberIdNum=%d)", ctxId, roomId, sortMethod, memberId, memberIdNum); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -798,13 +800,13 @@ error_code sceNpMatching2JoinRoom( { sceNp2.warning("sceNpMatching2JoinRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; } - *assignedReqId = nph->join_room(ctxId, optParam, reqParam.get_ptr()); + *assignedReqId = nph.join_room(ctxId, optParam, reqParam.get_ptr()); return CELL_OK; } @@ -815,9 +817,9 @@ error_code sceNpMatching2GetRoomMemberDataInternalLocal(SceNpMatching2ContextId sceNp2.todo("sceNpMatching2GetRoomMemberDataInternalLocal(ctxId=%d, roomId=%d, memberId=%d, attrId=*0x%x, attrIdNum=%d, member=*0x%x, buf=*0x%x, bufLen=%d)", ctxId, roomId, memberId, attrId, attrIdNum, member, buf, bufLen); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -829,9 +831,9 @@ error_code sceNpMatching2GetCbQueueInfo(SceNpMatching2ContextId ctxId, vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -844,7 +846,7 @@ error_code sceNpMatching2KickoutRoomMember( { sceNp2.todo("sceNpMatching2KickoutRoomMember(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -857,9 +859,9 @@ error_code sceNpMatching2ContextStartAsync(SceNpMatching2ContextId ctxId, u32 ti { sceNp2.warning("sceNpMatching2ContextStartAsync(ctxId=%d, timeout=%d)", ctxId, timeout); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -875,7 +877,8 @@ error_code sceNpMatching2ContextStartAsync(SceNpMatching2ContextId ctxId, u32 ti if (ctx->context_callback) { - sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { ctx->context_callback(cb_ppu, ctxId, SCE_NP_MATCHING2_CONTEXT_EVENT_Start, SCE_NP_MATCHING2_EVENT_CAUSE_CONTEXT_ACTION, 0, ctx->context_callback_param); return 0; }); @@ -889,7 +892,7 @@ error_code sceNpMatching2SetSignalingOptParam( { sceNp2.todo("sceNpMatching2SetSignalingOptParam(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -902,9 +905,9 @@ error_code sceNpMatching2RegisterContextCallback(SceNpMatching2ContextId ctxId, { sceNp2.warning("sceNpMatching2RegisterContextCallback(ctxId=%d, cbFunc=*0x%x, cbFuncArg=*0x%x)", ctxId, cbFunc, cbFuncArg); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -929,7 +932,7 @@ error_code sceNpMatching2SendRoomChatMessage( { sceNp2.todo("sceNpMatching2SendRoomChatMessage(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -943,13 +946,13 @@ error_code sceNpMatching2SetRoomDataInternal( { sceNp2.todo("sceNpMatching2SetRoomDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; } - *assignedReqId = nph->set_roomdata_internal(ctxId, optParam, reqParam.get_ptr()); + *assignedReqId = nph.set_roomdata_internal(ctxId, optParam, reqParam.get_ptr()); return CELL_OK; } @@ -959,13 +962,13 @@ error_code sceNpMatching2GetRoomDataInternal( { sceNp2.todo("sceNpMatching2GetRoomDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; } - *assignedReqId = nph->get_roomdata_internal(ctxId, optParam, reqParam.get_ptr()); + *assignedReqId = nph.get_roomdata_internal(ctxId, optParam, reqParam.get_ptr()); return CELL_OK; } @@ -975,13 +978,13 @@ error_code sceNpMatching2SignalingGetPingInfo( { sceNp2.warning("sceNpMatching2SignalingGetPingInfo(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; } - *assignedReqId = nph->get_ping_info(ctxId, optParam, reqParam.get_ptr()); + *assignedReqId = nph.get_ping_info(ctxId, optParam, reqParam.get_ptr()); return CELL_OK; } @@ -990,9 +993,9 @@ error_code sceNpMatching2GetServerIdListLocal(SceNpMatching2ContextId ctxId, vm: { sceNp2.todo("sceNpMatching2GetServerIdListLocal(ctxId=%d, serverId=*0x%x, serverIdNum=%d)", ctxId, serverId, serverIdNum); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1002,7 +1005,7 @@ error_code sceNpMatching2GetServerIdListLocal(SceNpMatching2ContextId ctxId, vm: return SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND; } - const auto slist = nph->get_match2_server_list(ctxId); + const auto slist = nph.get_match2_server_list(ctxId); u32 num_servs = std::min(static_cast(slist.size()), serverIdNum); @@ -1040,7 +1043,7 @@ error_code sceNpMatching2GrantRoomOwner( { sceNp2.todo("sceNpMatching2GrantRoomOwner(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -1054,9 +1057,9 @@ error_code sceNpMatching2CreateContext( { sceNp2.warning("sceNpMatching2CreateContext(npId=*0x%x, commId=*0x%x(%s), passPhrase=*0x%x, ctxId=*0x%x, option=%d)", npId, commId, commId->data, ctxId, option); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1075,9 +1078,9 @@ error_code sceNpMatching2GetSignalingOptParamLocal(SceNpMatching2ContextId ctxId { sceNp2.todo("sceNpMatching2GetSignalingOptParamLocal(ctxId=%d, roomId=%d, signalingOptParam=*0x%x)", ctxId, roomId, signalingOptParam); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1089,15 +1092,15 @@ error_code sceNpMatching2RegisterSignalingCallback(SceNpMatching2ContextId ctxId { sceNp2.notice("sceNpMatching2RegisterSignalingCallback(ctxId=%d, cbFunc=*0x%x, cbFuncArg=*0x%x)", ctxId, cbFunc, cbFuncArg); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - const auto sigh = g_fxo->get>(); - sigh->set_sig2_cb(ctxId, cbFunc, cbFuncArg); + auto& sigh = g_fxo->get>(); + sigh.set_sig2_cb(ctxId, cbFunc, cbFuncArg); return CELL_OK; } @@ -1106,9 +1109,9 @@ error_code sceNpMatching2ClearEventData(SceNpMatching2ContextId ctxId, SceNpMatc { sceNp2.todo("sceNpMatching2ClearEventData(ctxId=%d, eventKey=%d)", ctxId, eventKey); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1121,7 +1124,7 @@ error_code sceNpMatching2GetUserInfoList( { sceNp2.todo("sceNpMatching2GetUserInfoList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -1135,7 +1138,7 @@ error_code sceNpMatching2GetRoomMemberDataInternal( { sceNp2.todo("sceNpMatching2GetRoomMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -1149,7 +1152,7 @@ error_code sceNpMatching2SetRoomMemberDataInternal( { sceNp2.todo("sceNpMatching2SetRoomMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -1163,14 +1166,14 @@ error_code sceNpMatching2JoinProhibitiveRoom( { sceNp2.warning("sceNpMatching2JoinProhibitiveRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; } // TODO: add blocked users - *assignedReqId = nph->join_room(ctxId, optParam, &reqParam->joinParam); + *assignedReqId = nph.join_room(ctxId, optParam, &reqParam->joinParam); return CELL_OK; } @@ -1179,9 +1182,9 @@ error_code sceNpMatching2SignalingSetCtxOpt(SceNpMatching2ContextId ctxId, s32 o { sceNp2.todo("sceNpMatching2SignalingSetCtxOpt(ctxId=%d, optname=%d, optval=%d)", ctxId, optname, optval); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1194,7 +1197,7 @@ error_code sceNpMatching2DeleteServerContext( { sceNp2.todo("sceNpMatching2DeleteServerContext(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -1207,9 +1210,9 @@ error_code sceNpMatching2SetDefaultRequestOptParam(SceNpMatching2ContextId ctxId { sceNp2.warning("sceNpMatching2SetDefaultRequestOptParam(ctxId=%d, optParam=*0x%x)", ctxId, optParam); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1232,16 +1235,16 @@ error_code sceNpMatching2RegisterRoomEventCallback(SceNpMatching2ContextId ctxId { sceNp2.todo("sceNpMatching2RegisterRoomEventCallback(ctxId=%d, cbFunc=*0x%x, cbFuncArg=*0x%x)", ctxId, cbFunc, cbFuncArg); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - nph->room_event_cb = cbFunc; - nph->room_event_cb_ctx = ctxId; - nph->room_event_cb_arg = cbFuncArg; + nph.room_event_cb = cbFunc; + nph.room_event_cb_ctx = ctxId; + nph.room_event_cb_arg = cbFuncArg; return CELL_OK; } @@ -1250,9 +1253,9 @@ error_code sceNpMatching2GetRoomPasswordLocal(SceNpMatching2ContextId ctxId, Sce { sceNp2.todo("sceNpMatching2GetRoomPasswordLocal(ctxId=%d, roomId=%d, withPassword=*0x%x, roomPassword=*0x%x)", ctxId, roomId, withPassword, roomPassword); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1265,7 +1268,7 @@ error_code sceNpMatching2GetRoomDataExternalList( { sceNp2.todo("sceNpMatching2GetRoomDataExternalList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -1279,13 +1282,13 @@ error_code sceNpMatching2CreateJoinRoom( { sceNp2.warning("sceNpMatching2CreateJoinRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; } - *assignedReqId = nph->create_join_room(ctxId, optParam, reqParam.get_ptr()); + *assignedReqId = nph.create_join_room(ctxId, optParam, reqParam.get_ptr()); return CELL_OK; } @@ -1294,9 +1297,9 @@ error_code sceNpMatching2SignalingGetCtxOpt(SceNpMatching2ContextId ctxId, s32 o { sceNp2.todo("sceNpMatching2SignalingGetCtxOpt(ctxId=%d, optname=%d, optval=*0x%x)", ctxId, optname, optval); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1309,7 +1312,7 @@ error_code sceNpMatching2GetLobbyInfoList( { sceNp2.todo("sceNpMatching2GetLobbyInfoList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -1323,9 +1326,9 @@ error_code sceNpMatching2GetLobbyMemberIdListLocal( { sceNp2.todo("sceNpMatching2GetLobbyMemberIdListLocal(ctxId=%d, lobbyId=%d, memberId=*0x%x, memberIdNum=%d, me=*0x%x)", ctxId, lobbyId, memberId, memberIdNum, me); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1338,7 +1341,7 @@ error_code sceNpMatching2SendLobbyInvitation( { sceNp2.todo("sceNpMatching2SendLobbyInvitation(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -1351,9 +1354,9 @@ error_code sceNpMatching2ContextStop(SceNpMatching2ContextId ctxId) { sceNp2.todo("sceNpMatching2ContextStop(ctxId=%d)", ctxId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1367,7 +1370,8 @@ error_code sceNpMatching2ContextStop(SceNpMatching2ContextId ctxId) if (ctx->context_callback) { - sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { ctx->context_callback(cb_ppu, ctxId, SCE_NP_MATCHING2_CONTEXT_EVENT_Stop, SCE_NP_MATCHING2_EVENT_CAUSE_CONTEXT_ACTION, 0, ctx->context_callback_param); return 0; }); @@ -1381,7 +1385,7 @@ error_code sceNpMatching2SetLobbyMemberDataInternal( { sceNp2.todo("sceNpMatching2SetLobbyMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { return res; @@ -1394,16 +1398,16 @@ error_code sceNpMatching2RegisterRoomMessageCallback(SceNpMatching2ContextId ctx { sceNp2.todo("sceNpMatching2RegisterRoomMessageCallback(ctxId=%d, cbFunc=*0x%x, cbFuncArg=*0x%x)", ctxId, cbFunc, cbFuncArg); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - nph->room_msg_cb = cbFunc; - nph->room_msg_cb_ctx = ctxId; - nph->room_msg_cb_arg = cbFuncArg; + nph.room_msg_cb = cbFunc; + nph.room_msg_cb_ctx = ctxId; + nph.room_msg_cb_arg = cbFuncArg; return CELL_OK; } @@ -1412,9 +1416,9 @@ error_code sceNpMatching2SignalingCancelPeerNetInfo(SceNpMatching2ContextId ctxI { sceNp2.todo("sceNpMatching2SignalingCancelPeerNetInfo(ctxId=%d, reqId=%d)", ctxId, reqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1426,9 +1430,9 @@ error_code sceNpMatching2SignalingGetLocalNetInfo(vm::ptrget>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1446,9 +1450,9 @@ error_code sceNpMatching2SignalingGetPeerNetInfo(SceNpMatching2ContextId ctxId, { sceNp2.todo("sceNpMatching2SignalingGetPeerNetInfo(ctxId=%d, roomId=%d, roomMemberId=%d, reqId=*0x%x)", ctxId, roomId, roomMemberId, reqId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1465,9 +1469,9 @@ error_code sceNpMatching2SignalingGetPeerNetInfoResult(SceNpMatching2ContextId c { sceNp2.todo("sceNpMatching2SignalingGetPeerNetInfoResult(ctxId=%d, reqId=%d, netinfo=*0x%x)", ctxId, reqId, netinfo); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP2_Match2_init) + if (!nph.is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1485,14 +1489,14 @@ error_code sceNpAuthOAuthInit() { sceNp2.todo("sceNpAuthOAuthInit()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (nph->is_NP_Auth_init) + if (nph.is_NP_Auth_init) { return SCE_NP_OAUTH_ERROR_ALREADY_INITIALIZED; } - nph->is_NP_Auth_init = true; + nph.is_NP_Auth_init = true; return CELL_OK; } @@ -1501,10 +1505,10 @@ error_code sceNpAuthOAuthTerm() { sceNp2.todo("sceNpAuthOAuthTerm()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); // TODO: check if this might throw SCE_NP_OAUTH_ERROR_NOT_INITIALIZED - nph->is_NP_Auth_init = false; + nph.is_NP_Auth_init = false; return CELL_OK; } @@ -1513,9 +1517,9 @@ error_code sceNpAuthCreateOAuthRequest() { sceNp2.todo("sceNpAuthCreateOAuthRequest()"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Auth_init) + if (!nph.is_NP_Auth_init) { return SCE_NP_OAUTH_ERROR_NOT_INITIALIZED; } @@ -1527,9 +1531,9 @@ error_code sceNpAuthDeleteOAuthRequest(SceNpAuthOAuthRequestId reqId) { sceNp2.todo("sceNpAuthDeleteOAuthRequest(reqId=%d)"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Auth_init) + if (!nph.is_NP_Auth_init) { return SCE_NP_OAUTH_ERROR_NOT_INITIALIZED; } @@ -1541,9 +1545,9 @@ error_code sceNpAuthAbortOAuthRequest(SceNpAuthOAuthRequestId reqId) { sceNp2.todo("sceNpAuthAbortOAuthRequest(reqId=%d)"); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Auth_init) + if (!nph.is_NP_Auth_init) { return SCE_NP_OAUTH_ERROR_NOT_INITIALIZED; } @@ -1555,9 +1559,9 @@ error_code sceNpAuthGetAuthorizationCode(SceNpAuthOAuthRequestId reqId, vm::cptr { sceNp2.todo("sceNpAuthGetAuthorizationCode(reqId=%d, param=*0x%x, authCode=*0x%x, issuerId=%d)", reqId, param, authCode, issuerId); - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); - if (!nph->is_NP_Auth_init) + if (!nph.is_NP_Auth_init) { return SCE_NP_OAUTH_ERROR_NOT_INITIALIZED; } diff --git a/rpcs3/Emu/Cell/Modules/sceNpClans.cpp b/rpcs3/Emu/Cell/Modules/sceNpClans.cpp index 15350bbb64..7b7c5a894d 100644 --- a/rpcs3/Emu/Cell/Modules/sceNpClans.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNpClans.cpp @@ -77,9 +77,9 @@ error_code sceNpClansInit(vm::cptr commId, vm::cptrget(); + auto& clans_manager = g_fxo->get(); - if (clans_manager->is_initialized) + if (clans_manager.is_initialized) { return SCE_NP_CLANS_ERROR_ALREADY_INITIALIZED; } @@ -94,7 +94,7 @@ error_code sceNpClansInit(vm::cptr commId, vm::cptris_initialized = true; + clans_manager.is_initialized = true; return CELL_OK; } @@ -103,14 +103,14 @@ error_code sceNpClansTerm() { sceNpClans.warning("sceNpClansTerm()"); - const auto clans_manager = g_fxo->get(); + auto& clans_manager = g_fxo->get(); - if (!clans_manager->is_initialized) + if (!clans_manager.is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } - clans_manager->is_initialized = false; + clans_manager.is_initialized = false; return CELL_OK; } @@ -119,7 +119,7 @@ error_code sceNpClansCreateRequest(vm::ptr handle, u64 { sceNpClans.todo("sceNpClansCreateRequest(handle=*0x%x, flags=0x%llx)", handle, flags); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -141,7 +141,7 @@ error_code sceNpClansDestroyRequest(vm::ptr handle) { sceNpClans.todo("sceNpClansDestroyRequest(handle=*0x%x)", handle); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -153,7 +153,7 @@ error_code sceNpClansAbortRequest(vm::ptr handle) { sceNpClans.todo("sceNpClansAbortRequest(handle=*0x%x)", handle); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -165,7 +165,7 @@ error_code sceNpClansCreateClan(vm::ptr handle, vm::cpt { sceNpClans.todo("sceNpClansCreateClan(handle=*0x%x, name=%s, tag=%s, clanId=*0x%x)", handle, name, tag, clanId); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -187,7 +187,7 @@ error_code sceNpClansDisbandClan(vm::ptr handle, SceNpC { sceNpClans.todo("sceNpClansDisbandClan(handle=*0x%x, clanId=*0x%x)", handle, clanId); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -199,7 +199,7 @@ error_code sceNpClansGetClanList(vm::ptr handle, vm::cp { sceNpClans.todo("sceNpClansGetClanList(handle=*0x%x, paging=*0x%x, clanList=*0x%x, pageResult=*0x%x)", handle, paging, clanList, pageResult); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -224,7 +224,7 @@ error_code sceNpClansGetClanListByNpId(vm::ptr handle, { sceNpClans.todo("sceNpClansGetClanListByNpId(handle=*0x%x, paging=*0x%x, npid=*0x%x, clanList=*0x%x, pageResult=*0x%x)", handle, paging, npid, clanList, pageResult); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -249,7 +249,7 @@ error_code sceNpClansSearchByProfile(vm::ptr handle, vm { sceNpClans.todo("sceNpClansSearchByProfile(handle=*0x%x, paging=*0x%x, search=*0x%x, results=*0x%x, pageResult=*0x%x)", handle, paging, search, results, pageResult); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -274,7 +274,7 @@ error_code sceNpClansSearchByName(vm::ptr handle, vm::c { sceNpClans.todo("sceNpClansSearchByName(handle=*0x%x, paging=*0x%x, search=*0x%x, results=*0x%x, pageResult=*0x%x)", handle, paging, search, results, pageResult); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -299,7 +299,7 @@ error_code sceNpClansGetClanInfo(vm::ptr handle, SceNpC { sceNpClans.todo("sceNpClansGetClanInfo(handle=*0x%x, clanId=%d, info=*0x%x)", handle, clanId, info); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -317,7 +317,7 @@ error_code sceNpClansUpdateClanInfo(vm::ptr handle, Sce { sceNpClans.todo("sceNpClansUpdateClanInfo(handle=*0x%x, clanId=%d, info=*0x%x)", handle, clanId, info); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -340,7 +340,7 @@ error_code sceNpClansGetMemberList(vm::ptr handle, SceN { sceNpClans.todo("sceNpClansGetMemberList(handle=*0x%x, clanId=%d, paging=*0x%x, status=%d, memList=*0x%x, pageResult=*0x%x)", handle, clanId, paging, status, memList, pageResult); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -365,7 +365,7 @@ error_code sceNpClansGetMemberInfo(vm::ptr handle, SceN { sceNpClans.todo("sceNpClansGetMemberInfo(handle=*0x%x, clanId=%d, npid=*0x%x, memInfo=*0x%x)", handle, clanId, npid, memInfo); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -382,7 +382,7 @@ error_code sceNpClansUpdateMemberInfo(vm::ptr handle, S { sceNpClans.todo("sceNpClansUpdateMemberInfo(handle=*0x%x, clanId=%d, memInfo=*0x%x)", handle, clanId, info); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -405,7 +405,7 @@ error_code sceNpClansChangeMemberRole(vm::ptr handle, S { sceNpClans.todo("sceNpClansChangeMemberRole(handle=*0x%x, clanId=%d, npid=*0x%x, role=%d)", handle, clanId, npid, role); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -422,7 +422,7 @@ error_code sceNpClansGetAutoAcceptStatus(vm::ptr handle { sceNpClans.todo("sceNpClansGetAutoAcceptStatus(handle=*0x%x, clanId=%d, enable=*0x%x)", handle, clanId, enable); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -439,7 +439,7 @@ error_code sceNpClansUpdateAutoAcceptStatus(vm::ptr han { sceNpClans.todo("sceNpClansUpdateAutoAcceptStatus(handle=*0x%x, clanId=%d, enable=%d)", handle, clanId, enable); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -451,7 +451,7 @@ error_code sceNpClansJoinClan(vm::ptr handle, SceNpClan { sceNpClans.todo("sceNpClansJoinClan(handle=*0x%x, clanId=%d)", handle, clanId); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -463,7 +463,7 @@ error_code sceNpClansLeaveClan(vm::ptr handle, SceNpCla { sceNpClans.todo("sceNpClansLeaveClan(handle=*0x%x, clanId=%d)", handle, clanId); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -475,7 +475,7 @@ error_code sceNpClansKickMember(vm::ptr handle, SceNpCl { sceNpClans.todo("sceNpClansKickMember(handle=*0x%x, clanId=%d, npid=*0x%x, message=*0x%x)", handle, clanId, npid, message); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -500,7 +500,7 @@ error_code sceNpClansSendInvitation(vm::ptr handle, Sce { sceNpClans.todo("sceNpClansSendInvitation(handle=*0x%x, clanId=%d, npid=*0x%x, message=*0x%x)", handle, clanId, npid, message); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -525,7 +525,7 @@ error_code sceNpClansCancelInvitation(vm::ptr handle, S { sceNpClans.todo("sceNpClansCancelInvitation(handle=*0x%x, clanId=%d, npid=*0x%x)", handle, clanId, npid); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -542,7 +542,7 @@ error_code sceNpClansSendInvitationResponse(vm::ptr han { sceNpClans.todo("sceNpClansSendInvitationResponse(handle=*0x%x, clanId=%d, message=*0x%x, accept=%d)", handle, clanId, message, accept); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -562,7 +562,7 @@ error_code sceNpClansSendMembershipRequest(vm::ptr hand { sceNpClans.todo("sceNpClansSendMembershipRequest(handle=*0x%x, clanId=%d, message=*0x%x)", handle, clanId, message); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -582,7 +582,7 @@ error_code sceNpClansCancelMembershipRequest(vm::ptr ha { sceNpClans.todo("sceNpClansCancelMembershipRequest(handle=*0x%x, clanId=%d)", handle, clanId); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -594,7 +594,7 @@ error_code sceNpClansSendMembershipResponse(vm::ptr han { sceNpClans.todo("sceNpClansSendMembershipResponse(handle=*0x%x, clanId=%d, npid=*0x%x, message=*0x%x, allow=%d)", handle, clanId, npid, message, allow); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -619,7 +619,7 @@ error_code sceNpClansGetBlacklist(vm::ptr handle, SceNp { sceNpClans.todo("sceNpClansGetBlacklist(handle=*0x%x, clanId=%d, paging=*0x%x, bl=*0x%x, pageResult=*0x%x)", handle, clanId, paging, bl, pageResult); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -644,7 +644,7 @@ error_code sceNpClansAddBlacklistEntry(vm::ptr handle, { sceNpClans.todo("sceNpClansAddBlacklistEntry(handle=*0x%x, clanId=%d, npid=*0x%x)", handle, clanId, npid); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -661,7 +661,7 @@ error_code sceNpClansRemoveBlacklistEntry(vm::ptr handl { sceNpClans.todo("sceNpClansRemoveBlacklistEntry(handle=*0x%x, clanId=%d, npid=*0x%x)", handle, clanId, npid); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -678,7 +678,7 @@ error_code sceNpClansRetrieveAnnouncements(vm::ptr hand { sceNpClans.todo("sceNpClansRetrieveAnnouncements(handle=*0x%x, clanId=%d, paging=*0x%x, mlist=*0x%x, pageResult=*0x%x)", handle, clanId, paging, mlist, pageResult); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -703,7 +703,7 @@ error_code sceNpClansPostAnnouncement(vm::ptr handle, S { sceNpClans.todo("sceNpClansPostAnnouncement(handle=*0x%x, clanId=%d, message=*0x%x, data=*0x%x, duration=%d, mId=*0x%x)", handle, clanId, message, data, duration, mId); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -730,7 +730,7 @@ error_code sceNpClansRemoveAnnouncement(vm::ptr handle, { sceNpClans.todo("sceNpClansPostAnnouncement(handle=*0x%x, clanId=%d, mId=%d)", handle, clanId, mId); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -742,7 +742,7 @@ error_code sceNpClansPostChallenge(vm::ptr handle, SceN { sceNpClans.todo("sceNpClansPostChallenge(handle=*0x%x, clanId=%d, targetClan=%d, message=*0x%x, data=*0x%x, duration=%d, mId=*0x%x)", handle, clanId, targetClan, message, data, duration, mId); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -769,7 +769,7 @@ error_code sceNpClansRetrievePostedChallenges(vm::ptr h { sceNpClans.todo("sceNpClansRetrievePostedChallenges(handle=*0x%x, clanId=%d, targetClan=%d, paging=*0x%x, mList=*0x%x, pageResult=*0x%x)", handle, clanId, targetClan, paging, mList, pageResult); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -794,7 +794,7 @@ error_code sceNpClansRemovePostedChallenge(vm::ptr hand { sceNpClans.todo("sceNpClansRemovePostedChallenge(handle=*0x%x, clanId=%d, targetClan=%d, mId=%d)", handle, clanId, targetClan, mId); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -806,7 +806,7 @@ error_code sceNpClansRetrieveChallenges(vm::ptr handle, { sceNpClans.todo("sceNpClansRetrieveChallenges(handle=*0x%x, clanId=%d, paging=*0x%x, mList=*0x%x, pageResult=*0x%x)", handle, clanId, paging, mList, pageResult); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } @@ -831,7 +831,7 @@ error_code sceNpClansRemoveChallenge(SceNpClansRequestHandle handle, SceNpClanId { sceNpClans.todo("sceNpClansRemoveChallenge(handle=*0x%x, clanId=%d, mId=%d)", handle, clanId, mId); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } diff --git a/rpcs3/Emu/Cell/Modules/sceNpSns.cpp b/rpcs3/Emu/Cell/Modules/sceNpSns.cpp index e9b622c51e..8bae005a9d 100644 --- a/rpcs3/Emu/Cell/Modules/sceNpSns.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNpSns.cpp @@ -43,9 +43,9 @@ error_code sceNpSnsFbInit(vm::cptr params) { sceNpSns.todo("sceNpSnsFbInit(params=*0x%x)", params); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - if (manager->is_initialized) + if (manager.is_initialized) { return SCE_NP_SNS_FB_ERROR_ALREADY_INITIALIZED; } @@ -57,7 +57,7 @@ error_code sceNpSnsFbInit(vm::cptr params) // TODO: Use the initialization parameters somewhere - manager->is_initialized = true; + manager.is_initialized = true; return CELL_OK; } @@ -66,14 +66,14 @@ error_code sceNpSnsFbTerm() { sceNpSns.warning("sceNpSnsFbTerm()"); - const auto manager = g_fxo->get(); + auto& manager = g_fxo->get(); - if (!manager->is_initialized) + if (!manager.is_initialized) { return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED; } - manager->is_initialized = false; + manager.is_initialized = false; return CELL_OK; } @@ -82,7 +82,7 @@ error_code sceNpSnsFbCreateHandle(vm::ptr handle) { sceNpSns.warning("sceNpSnsFbCreateHandle(handle=*0x%x)", handle); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED; } @@ -107,7 +107,7 @@ error_code sceNpSnsFbDestroyHandle(u32 handle) { sceNpSns.warning("sceNpSnsFbDestroyHandle(handle=%d)", handle); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED; } @@ -129,7 +129,7 @@ error_code sceNpSnsFbAbortHandle(u32 handle) { sceNpSns.todo("sceNpSnsFbAbortHandle(handle=%d)", handle); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED; } @@ -160,7 +160,7 @@ error_code sceNpSnsFbGetAccessToken(u32 handle, vm::cptrget()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED; } @@ -179,9 +179,9 @@ error_code sceNpSnsFbGetAccessToken(u32 handle, vm::cptrget>(); + auto& nph = g_fxo->get>(); - if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph.get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_SNS_ERROR_NOT_SIGN_IN); } @@ -229,7 +229,7 @@ s32 sceNpSnsFbCheckThrottle(vm::ptr arg0) return SCE_NP_SNS_ERROR_INVALID_ARGUMENT; } - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED; } @@ -241,7 +241,7 @@ s32 sceNpSnsFbCheckConfig(vm::ptr arg0) { sceNpSns.todo("sceNpSnsFbCheckConfig(arg0=*0x%x)", arg0); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED; } @@ -287,7 +287,7 @@ error_code sceNpSnsFbGetLongAccessToken(u32 handle, vm::cptrget()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED; } @@ -306,9 +306,9 @@ error_code sceNpSnsFbGetLongAccessToken(u32 handle, vm::cptrget>(); + auto& nph = g_fxo->get>(); - if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph.get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_SNS_ERROR_NOT_SIGN_IN); } diff --git a/rpcs3/Emu/Cell/Modules/sceNpTrophy.cpp b/rpcs3/Emu/Cell/Modules/sceNpTrophy.cpp index a00ba7c0a1..b82d95388c 100644 --- a/rpcs3/Emu/Cell/Modules/sceNpTrophy.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNpTrophy.cpp @@ -209,11 +209,11 @@ error_code sceNpTrophyInit(vm::ptr pool, u32 poolSize, u32 containerId, u6 { sceNpTrophy.warning("sceNpTrophyInit(pool=*0x%x, poolSize=0x%x, containerId=0x%x, options=0x%llx)", pool, poolSize, containerId, options); - const auto trophy_manager = g_fxo->get(); + auto& trophy_manager = g_fxo->get(); - std::scoped_lock lock(trophy_manager->mtx); + std::scoped_lock lock(trophy_manager.mtx); - if (trophy_manager->is_initialized) + if (trophy_manager.is_initialized) { return SCE_NP_TROPHY_ERROR_ALREADY_INITIALIZED; } @@ -223,7 +223,7 @@ error_code sceNpTrophyInit(vm::ptr pool, u32 poolSize, u32 containerId, u6 return SCE_NP_TROPHY_ERROR_NOT_SUPPORTED; } - trophy_manager->is_initialized = true; + trophy_manager.is_initialized = true; return CELL_OK; } @@ -232,11 +232,11 @@ error_code sceNpTrophyTerm() { sceNpTrophy.warning("sceNpTrophyTerm()"); - const auto trophy_manager = g_fxo->get(); + auto& trophy_manager = g_fxo->get(); - std::scoped_lock lock(trophy_manager->mtx); + std::scoped_lock lock(trophy_manager.mtx); - if (!trophy_manager->is_initialized) + if (!trophy_manager.is_initialized) { return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; } @@ -244,7 +244,7 @@ error_code sceNpTrophyTerm() idm::clear(); idm::clear(); - trophy_manager->is_initialized = false; + trophy_manager.is_initialized = false; return CELL_OK; } @@ -253,11 +253,11 @@ error_code sceNpTrophyCreateHandle(vm::ptr handle) { sceNpTrophy.warning("sceNpTrophyCreateHandle(handle=*0x%x)", handle); - const auto trophy_manager = g_fxo->get(); + auto& trophy_manager = g_fxo->get(); - std::scoped_lock lock(trophy_manager->mtx); + std::scoped_lock lock(trophy_manager.mtx); - if (!trophy_manager->is_initialized) + if (!trophy_manager.is_initialized) { return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; } @@ -282,12 +282,12 @@ error_code sceNpTrophyDestroyHandle(u32 handle) { sceNpTrophy.warning("sceNpTrophyDestroyHandle(handle=0x%x)", handle); - const auto trophy_manager = g_fxo->get(); + auto& trophy_manager = g_fxo->get(); - std::scoped_lock lock(trophy_manager->mtx); + std::scoped_lock lock(trophy_manager.mtx); // TODO: find out if this is checked - //if (!trophy_manager->is_initialized) + //if (!trophy_manager.is_initialized) //{ // return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; //} @@ -316,12 +316,12 @@ error_code sceNpTrophyAbortHandle(u32 handle) { sceNpTrophy.todo("sceNpTrophyAbortHandle(handle=0x%x)", handle); - const auto trophy_manager = g_fxo->get(); + auto& trophy_manager = g_fxo->get(); - std::scoped_lock lock(trophy_manager->mtx); + std::scoped_lock lock(trophy_manager.mtx); // TODO: find out if this is checked - //if (!trophy_manager->is_initialized) + //if (!trophy_manager.is_initialized) //{ // return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; //} @@ -356,11 +356,11 @@ error_code sceNpTrophyCreateContext(vm::ptr context, vm::cptrget(); + auto& trophy_manager = g_fxo->get(); - std::scoped_lock lock(trophy_manager->mtx); + std::scoped_lock lock(trophy_manager.mtx); - if (!trophy_manager->is_initialized) + if (!trophy_manager.is_initialized) { return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; } @@ -434,11 +434,11 @@ error_code sceNpTrophyDestroyContext(u32 context) { sceNpTrophy.warning("sceNpTrophyDestroyContext(context=0x%x)", context); - const auto trophy_manager = g_fxo->get(); + auto& trophy_manager = g_fxo->get(); - std::scoped_lock lock(trophy_manager->mtx); + std::scoped_lock lock(trophy_manager.mtx); - if (!trophy_manager->is_initialized) + if (!trophy_manager.is_initialized) { return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; } @@ -461,16 +461,16 @@ error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle, { sceNpTrophy.error("sceNpTrophyRegisterContext(context=0x%x, handle=0x%x, statusCb=*0x%x, arg=*0x%x, options=0x%llx)", context, handle, statusCb, arg, options); - const auto trophy_manager = g_fxo->get(); + auto& trophy_manager = g_fxo->get(); - std::shared_lock lock(trophy_manager->mtx); + std::shared_lock lock(trophy_manager.mtx); - if (!trophy_manager->is_initialized) + if (!trophy_manager.is_initialized) { return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; } - const auto [ctxt, error] = trophy_manager->get_context_ex(context, handle); + const auto [ctxt, error] = trophy_manager.get_context_ex(context, handle); const auto handle_ptr = idm::get(handle); if (error) @@ -543,16 +543,16 @@ error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle, return SCE_NP_TROPHY_ERROR_PROCESSING_ABORTED; } - std::unique_lock lock2(trophy_manager->mtx); + std::unique_lock lock2(trophy_manager.mtx); // Rerun error checks, the callback could have changed stuff by calling sceNpTrophy functions internally - if (!trophy_manager->is_initialized) + if (!trophy_manager.is_initialized) { return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; } - const auto [ctxt2, error2] = trophy_manager->get_context_ex(context, handle); + const auto [ctxt2, error2] = trophy_manager.get_context_ex(context, handle); if (error2) { @@ -654,16 +654,16 @@ error_code sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr return SCE_NP_TROPHY_ERROR_NOT_SUPPORTED; } - const auto trophy_manager = g_fxo->get(); + auto& trophy_manager = g_fxo->get(); - reader_lock lock(trophy_manager->mtx); + reader_lock lock(trophy_manager.mtx); - if (!trophy_manager->is_initialized) + if (!trophy_manager.is_initialized) { return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; } - const auto [ctxt, error] = trophy_manager->get_context_ex(context, handle); + const auto [ctxt, error] = trophy_manager.get_context_ex(context, handle); if (error) { @@ -710,16 +710,16 @@ error_code sceNpTrophySetSoundLevel(u32 context, u32 handle, u32 level, u64 opti return SCE_NP_TROPHY_ERROR_NOT_SUPPORTED; } - const auto trophy_manager = g_fxo->get(); + auto& trophy_manager = g_fxo->get(); - reader_lock lock(trophy_manager->mtx); + reader_lock lock(trophy_manager.mtx); - if (!trophy_manager->is_initialized) + if (!trophy_manager.is_initialized) { return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; } - const auto [ctxt, error] = trophy_manager->get_context_ex(context, handle); + const auto [ctxt, error] = trophy_manager.get_context_ex(context, handle); if (error) { @@ -733,16 +733,16 @@ error_code sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptrget(); + auto& trophy_manager = g_fxo->get(); - reader_lock lock(trophy_manager->mtx); + reader_lock lock(trophy_manager.mtx); - if (!trophy_manager->is_initialized) + if (!trophy_manager.is_initialized) { return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; } - const auto [ctxt, error] = trophy_manager->get_context_ex(context, handle); + const auto [ctxt, error] = trophy_manager.get_context_ex(context, handle); if (error) { @@ -845,16 +845,16 @@ error_code sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::pt { sceNpTrophy.error("sceNpTrophyUnlockTrophy(context=0x%x, handle=0x%x, trophyId=%d, platinumId=*0x%x)", context, handle, trophyId, platinumId); - const auto trophy_manager = g_fxo->get(); + auto& trophy_manager = g_fxo->get(); - reader_lock lock(trophy_manager->mtx); + reader_lock lock(trophy_manager.mtx); - if (!trophy_manager->is_initialized) + if (!trophy_manager.is_initialized) { return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; } - const auto [ctxt, error] = trophy_manager->get_context_ex(context, handle); + const auto [ctxt, error] = trophy_manager.get_context_ex(context, handle); if (error) { @@ -931,16 +931,16 @@ error_code sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, vm::ptrget(); + auto& trophy_manager = g_fxo->get(); - reader_lock lock(trophy_manager->mtx); + reader_lock lock(trophy_manager.mtx); - if (!trophy_manager->is_initialized) + if (!trophy_manager.is_initialized) { return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; } - const auto [ctxt, error] = trophy_manager->get_context_ex(context, handle); + const auto [ctxt, error] = trophy_manager.get_context_ex(context, handle); if (error) { @@ -1092,16 +1092,16 @@ error_code sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, vm::p return SCE_NP_TROPHY_ERROR_INVALID_TROPHY_ID; } - const auto trophy_manager = g_fxo->get(); + auto& trophy_manager = g_fxo->get(); - reader_lock lock(trophy_manager->mtx); + reader_lock lock(trophy_manager.mtx); - if (!trophy_manager->is_initialized) + if (!trophy_manager.is_initialized) { return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; } - const auto [ctxt, error] = trophy_manager->get_context_ex(context, handle); + const auto [ctxt, error] = trophy_manager.get_context_ex(context, handle); if (error) { @@ -1120,16 +1120,16 @@ error_code sceNpTrophyGetGameProgress(u32 context, u32 handle, vm::ptr perc return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT; } - const auto trophy_manager = g_fxo->get(); + auto& trophy_manager = g_fxo->get(); - reader_lock lock(trophy_manager->mtx); + reader_lock lock(trophy_manager.mtx); - if (!trophy_manager->is_initialized) + if (!trophy_manager.is_initialized) { return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; } - const auto [ctxt, error] = trophy_manager->get_context_ex(context, handle); + const auto [ctxt, error] = trophy_manager.get_context_ex(context, handle); if (error) { @@ -1160,16 +1160,16 @@ error_code sceNpTrophyGetGameIcon(u32 context, u32 handle, vm::ptr buffer, { sceNpTrophy.warning("sceNpTrophyGetGameIcon(context=0x%x, handle=0x%x, buffer=*0x%x, size=*0x%x)", context, handle, buffer, size); - const auto trophy_manager = g_fxo->get(); + auto& trophy_manager = g_fxo->get(); - reader_lock lock(trophy_manager->mtx); + reader_lock lock(trophy_manager.mtx); - if (!trophy_manager->is_initialized) + if (!trophy_manager.is_initialized) { return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; } - const auto [ctxt, error] = trophy_manager->get_context_ex(context, handle); + const auto [ctxt, error] = trophy_manager.get_context_ex(context, handle); if (error) { @@ -1210,16 +1210,16 @@ error_code sceNpTrophyGetTrophyIcon(u32 context, u32 handle, s32 trophyId, vm::p { sceNpTrophy.warning("sceNpTrophyGetTrophyIcon(context=0x%x, handle=0x%x, trophyId=%d, buffer=*0x%x, size=*0x%x)", context, handle, trophyId, buffer, size); - const auto trophy_manager = g_fxo->get(); + auto& trophy_manager = g_fxo->get(); - reader_lock lock(trophy_manager->mtx); + reader_lock lock(trophy_manager.mtx); - if (!trophy_manager->is_initialized) + if (!trophy_manager.is_initialized) { return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; } - const auto [ctxt, error] = trophy_manager->get_context_ex(context, handle); + const auto [ctxt, error] = trophy_manager.get_context_ex(context, handle); if (error) { diff --git a/rpcs3/Emu/Cell/Modules/sceNpTus.cpp b/rpcs3/Emu/Cell/Modules/sceNpTus.cpp index 870293bcd2..24ac02192a 100644 --- a/rpcs3/Emu/Cell/Modules/sceNpTus.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNpTus.cpp @@ -148,15 +148,15 @@ error_code sceNpTusInit(s32 prio) { sceNpTus.warning("sceNpTusInit(prio=%d)", prio); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (tus_manager->is_initialized) + if (tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED; } - tus_manager->is_initialized = true; + tus_manager.is_initialized = true; return CELL_OK; } @@ -165,15 +165,15 @@ error_code sceNpTusTerm() { sceNpTus.warning("sceNpTusTerm()"); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - tus_manager->terminate(); + tus_manager.terminate(); return CELL_OK; } @@ -182,10 +182,10 @@ error_code sceNpTusCreateTitleCtx(vm::cptr communicationId { sceNpTus.todo("sceNpTusCreateTitleCtx(communicationId=*0x%x, passphrase=*0x%x, selfNpId=*0x%x)", communicationId, passphrase, selfNpId); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -195,7 +195,7 @@ error_code sceNpTusCreateTitleCtx(vm::cptr communicationId return SCE_NP_COMMUNITY_ERROR_INSUFFICIENT_ARGUMENT; } - const auto id = tus_manager->add_title_context(); + const auto id = tus_manager.add_title_context(); if (id <= 0) { @@ -209,15 +209,15 @@ error_code sceNpTusDestroyTitleCtx(s32 titleCtxId) { sceNpTus.todo("sceNpTusDestroyTitleCtx(titleCtxId=%d)", titleCtxId); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_title_context_id(titleCtxId)) + if (!tus_manager.check_title_context_id(titleCtxId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -229,20 +229,20 @@ error_code sceNpTusCreateTransactionCtx(s32 titleCtxId) { sceNpTus.todo("sceNpTusCreateTransactionCtx(titleCtxId=%d)", titleCtxId); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_title_context_id(titleCtxId)) + if (!tus_manager.check_title_context_id(titleCtxId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } - const auto id = tus_manager->add_transaction_context(titleCtxId); + const auto id = tus_manager.add_transaction_context(titleCtxId); if (id <= 0) { @@ -256,15 +256,15 @@ error_code sceNpTusDestroyTransactionCtx(s32 transId) { sceNpTus.todo("sceNpTusDestroyTransactionCtx(transId=%d)", transId); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->remove_transaction_context_id(transId)) + if (!tus_manager.remove_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -276,16 +276,16 @@ error_code sceNpTusSetTimeout(s32 ctxId, u32 timeout) { sceNpTus.todo("sceNpTusSetTimeout(ctxId=%d, timeout=%d)", ctxId, timeout); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - auto title_context = tus_manager->get_title_context(ctxId); - auto transaction_context = title_context ? tus_manager->get_transaction_context(ctxId) : nullptr; + auto title_context = tus_manager.get_title_context(ctxId); + auto transaction_context = title_context ? tus_manager.get_transaction_context(ctxId) : nullptr; if (!title_context && !transaction_context) { @@ -316,15 +316,15 @@ error_code sceNpTusAbortTransaction(s32 transId) { sceNpTus.todo("sceNpTusAbortTransaction(transId=%d)", transId); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - auto transaction_context = tus_manager->get_transaction_context(transId); + auto transaction_context = tus_manager.get_transaction_context(transId); if (!transaction_context) { @@ -360,15 +360,15 @@ error_code sceNpTusSetMultiSlotVariable(s32 transId, vm::cptr targetNpI { sceNpTus.todo("sceNpTusSetMultiSlotVariable(transId=%d, targetNpId=*0x%x, slotIdArray=*0x%x, variableArray=*0x%x, arrayNum=%d, option=*0x%x)", transId, targetNpId, slotIdArray, variableArray, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -395,15 +395,15 @@ error_code sceNpTusSetMultiSlotVariableVUser(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -430,15 +430,15 @@ error_code sceNpTusSetMultiSlotVariableAsync(s32 transId, vm::cptr targ { sceNpTus.todo("sceNpTusSetMultiSlotVariableAsync(transId=%d, targetNpId=*0x%x, slotIdArray=*0x%x, variableArray=*0x%x, arrayNum=%d, option=*0x%x)", transId, targetNpId, slotIdArray, variableArray, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -465,15 +465,15 @@ error_code sceNpTusSetMultiSlotVariableVUserAsync(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -500,15 +500,15 @@ error_code sceNpTusGetMultiSlotVariable(s32 transId, vm::cptr targetNpI { sceNpTus.todo("sceNpTusGetMultiSlotVariable(transId=%d, targetNpId=*0x%x, slotIdArray=*0x%x, variableArray=*0x%x, variableArraySize=%d, arrayNum=%d, option=*0x%x)", transId, targetNpId, slotIdArray, variableArray, variableArraySize, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -536,15 +536,15 @@ error_code sceNpTusGetMultiSlotVariableVUser(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -572,15 +572,15 @@ error_code sceNpTusGetMultiSlotVariableAsync(s32 transId, vm::cptr targ { sceNpTus.todo("sceNpTusGetMultiSlotVariableAsync(transId=%d, targetNpId=*0x%x, slotIdArray=*0x%x, variableArray=*0x%x, variableArraySize=%d, arrayNum=%d, option=*0x%x)", transId, targetNpId, slotIdArray, variableArray, variableArraySize, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -607,15 +607,15 @@ error_code sceNpTusGetMultiSlotVariableVUserAsync(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -642,15 +642,15 @@ error_code sceNpTusGetMultiUserVariable(s32 transId, vm::cptr targetNpI { sceNpTus.todo("sceNpTusGetMultiUserVariable(transId=%d, targetNpIdArray=*0x%x, slotId=%d, variableArray=*0x%x, variableArraySize=%d, arrayNum=%d, option=*0x%x)", transId, targetNpIdArray, slotId, variableArray, variableArraySize, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -678,15 +678,15 @@ error_code sceNpTusGetMultiUserVariableVUser(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -714,15 +714,15 @@ error_code sceNpTusGetMultiUserVariableAsync(s32 transId, vm::cptr targ { sceNpTus.todo("sceNpTusGetMultiUserVariableAsync(transId=%d, targetNpIdArray=*0x%x, slotId=%d, variableArray=*0x%x, variableArraySize=%d, arrayNum=%d, option=*0x%x)", transId, targetNpIdArray, slotId, variableArray, variableArraySize, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -749,15 +749,15 @@ error_code sceNpTusGetMultiUserVariableVUserAsync(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -784,15 +784,15 @@ error_code sceNpTusGetFriendsVariable(s32 transId, SceNpTusSlotId slotId, s32 in { sceNpTus.todo("sceNpTusGetFriendsVariable(transId=%d, slotId=%d, includeSelf=%d, sortType=%d, variableArray=*0x%x, variableArraySize=%d, arrayNum=%d, option=*0x%x)", transId, slotId, includeSelf, sortType, variableArray, variableArraySize, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -820,15 +820,15 @@ error_code sceNpTusGetFriendsVariableAsync(s32 transId, SceNpTusSlotId slotId, s { sceNpTus.todo("sceNpTusGetFriendsVariableAsync(transId=%d, slotId=%d, includeSelf=%d, sortType=%d, variableArray=*0x%x, variableArraySize=%d, arrayNum=%d, option=*0x%x)", transId, slotId, includeSelf, sortType, variableArray, variableArraySize, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -855,15 +855,15 @@ error_code sceNpTusAddAndGetVariable(s32 transId, vm::cptr targetNpId, { sceNpTus.todo("sceNpTusAddAndGetVariable(transId=%d, targetNpId=*0x%x, slotId=%d, inVariable=%d, outVariable=*0x%x, outVariableSize=%d, option=*0x%x)", transId, targetNpId, slotId, inVariable, outVariable, outVariableSize, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -885,15 +885,15 @@ error_code sceNpTusAddAndGetVariableVUser(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -915,15 +915,15 @@ error_code sceNpTusAddAndGetVariableAsync(s32 transId, vm::cptr targetN { sceNpTus.todo("sceNpTusAddAndGetVariableAsync(transId=%d, targetNpId=*0x%x, slotId=%d, inVariable=%d, outVariable=*0x%x, outVariableSize=%d, option=*0x%x)", transId, targetNpId, slotId, inVariable, outVariable, outVariableSize, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -945,15 +945,15 @@ error_code sceNpTusAddAndGetVariableVUserAsync(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -975,15 +975,15 @@ error_code sceNpTusTryAndSetVariable(s32 transId, vm::cptr targetNpId, { sceNpTus.todo("sceNpTusTryAndSetVariable(transId=%d, targetNpId=*0x%x, slotId=%d, opeType=%d, variable=%d, resultVariable=*0x%x, resultVariableSize=%d, option=*0x%x)", transId, targetNpId, slotId, opeType, variable, resultVariable, resultVariableSize, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1005,15 +1005,15 @@ error_code sceNpTusTryAndSetVariableVUser(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1035,15 +1035,15 @@ error_code sceNpTusTryAndSetVariableAsync(s32 transId, vm::cptr targetN { sceNpTus.todo("sceNpTusTryAndSetVariableAsync(transId=%d, targetNpId=*0x%x, slotId=%d, opeType=%d, variable=%d, resultVariable=*0x%x, resultVariableSize=%d, option=*0x%x)", transId, targetNpId, slotId, opeType, variable, resultVariable, resultVariableSize, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1065,15 +1065,15 @@ error_code sceNpTusTryAndSetVariableVUserAsync(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1095,15 +1095,15 @@ error_code sceNpTusDeleteMultiSlotVariable(s32 transId, vm::cptr target { sceNpTus.todo("sceNpTusDeleteMultiSlotVariable(transId=%d, targetNpId=*0x%x, slotIdArray=*0x%x, arrayNum=%d, option=*0x%x)", transId, targetNpId, slotIdArray, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1130,15 +1130,15 @@ error_code sceNpTusDeleteMultiSlotVariableVUser(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1165,15 +1165,15 @@ error_code sceNpTusDeleteMultiSlotVariableAsync(s32 transId, vm::cptr t { sceNpTus.todo("sceNpTusDeleteMultiSlotVariableAsync(transId=%d, targetNpId=*0x%x, slotIdArray=*0x%x, arrayNum=%d, option=*0x%x)", transId, targetNpId, slotIdArray, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1200,15 +1200,15 @@ error_code sceNpTusDeleteMultiSlotVariableVUserAsync(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1235,15 +1235,15 @@ error_code sceNpTusSetData(s32 transId, vm::cptr targetNpId, SceNpTusSl { sceNpTus.todo("sceNpTusSetData(transId=%d, targetNpId=*0x%x, slotId=%d, totalSize=%d, sendSize=%d, data=*0x%x, info=*0x%x, infoStructSize=%d, option=*0x%x)", transId, targetNpId, slotId, totalSize, sendSize, data, info, infoStructSize, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1266,15 +1266,15 @@ error_code sceNpTusSetDataVUser(s32 transId, vm::cptr tar { sceNpTus.todo("sceNpTusSetDataAsync(transId=%d, targetVirtualUserId=*0x%x, slotId=%d, totalSize=%d, sendSize=%d, data=*0x%x, info=*0x%x, infoStructSize=%d, option=*0x%x)", transId, targetVirtualUserId, slotId, totalSize, sendSize, data, info, infoStructSize, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1297,15 +1297,15 @@ error_code sceNpTusSetDataAsync(s32 transId, vm::cptr targetNpId, SceNp { sceNpTus.todo("sceNpTusSetDataAsync(transId=%d, targetNpId=*0x%x, slotId=%d, totalSize=%d, sendSize=%d, data=*0x%x, info=*0x%x, infoStructSize=%d, option=*0x%x)", transId, targetNpId, slotId, totalSize, sendSize, data, info, infoStructSize, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1327,15 +1327,15 @@ error_code sceNpTusSetDataVUserAsync(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1357,15 +1357,15 @@ error_code sceNpTusGetData(s32 transId, vm::cptr targetNpId, SceNpTusSl { sceNpTus.todo("sceNpTusGetData(transId=%d, targetNpId=*0x%x, slotId=%d, dataStatus=*0x%x, dataStatusSize=%d, data=*0x%x, recvSize=%d, option=*0x%x)", transId, targetNpId, slotId, dataStatus, dataStatusSize, data, recvSize, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1388,15 +1388,15 @@ error_code sceNpTusGetDataVUser(s32 transId, vm::cptr tar { sceNpTus.todo("sceNpTusGetDataVUser(transId=%d, targetVirtualUserId=*0x%x, slotId=%d, dataStatus=*0x%x, dataStatusSize=%d, data=*0x%x, recvSize=%d, option=*0x%x)", transId, targetVirtualUserId, slotId, dataStatus, dataStatusSize, data, recvSize, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1419,15 +1419,15 @@ error_code sceNpTusGetDataAsync(s32 transId, vm::cptr targetNpId, SceNp { sceNpTus.todo("sceNpTusGetDataAsync(transId=%d, targetNpId=*0x%x, slotId=%d, dataStatus=*0x%x, dataStatusSize=%d, data=*0x%x, recvSize=%d, option=*0x%x)", transId, targetNpId, slotId, dataStatus, dataStatusSize, data, recvSize, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1454,15 +1454,15 @@ error_code sceNpTusGetDataVUserAsync(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1484,15 +1484,15 @@ error_code sceNpTusGetMultiSlotDataStatus(s32 transId, vm::cptr targetN { sceNpTus.todo("sceNpTusGetMultiSlotDataStatus(transId=%d, targetNpId=*0x%x, slotIdArray=*0x%x, statusArray=*0x%x, statusArraySize=%d, arrayNum=%d, option=*0x%x)", transId, targetNpId, slotIdArray, statusArray, statusArraySize, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1520,15 +1520,15 @@ error_code sceNpTusGetMultiSlotDataStatusVUser(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1556,15 +1556,15 @@ error_code sceNpTusGetMultiSlotDataStatusAsync(s32 transId, vm::cptr ta { sceNpTus.todo("sceNpTusGetMultiSlotDataStatusAsync(transId=%d, targetNpId=*0x%x, slotIdArray=*0x%x, statusArray=*0x%x, statusArraySize=%d, arrayNum=%d, option=*0x%x)", transId, targetNpId, slotIdArray, statusArray, statusArraySize, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1591,15 +1591,15 @@ error_code sceNpTusGetMultiSlotDataStatusVUserAsync(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1626,15 +1626,15 @@ error_code sceNpTusGetMultiUserDataStatus(s32 transId, vm::cptr targetN { sceNpTus.todo("sceNpTusGetMultiUserDataStatus(transId=%d, targetNpIdArray=*0x%x, slotId=%d, statusArray=*0x%x, statusArraySize=%d, arrayNum=%d, option=*0x%x)", transId, targetNpIdArray, slotId, statusArray, statusArraySize, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1662,15 +1662,15 @@ error_code sceNpTusGetMultiUserDataStatusVUser(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1698,15 +1698,15 @@ error_code sceNpTusGetMultiUserDataStatusAsync(s32 transId, vm::cptr ta { sceNpTus.todo("sceNpTusGetMultiUserDataStatusAsync(transId=%d, targetNpIdArray=*0x%x, slotId=%d, statusArray=*0x%x, statusArraySize=%d, arrayNum=%d, option=*0x%x)", transId, targetNpIdArray, slotId, statusArray, statusArraySize, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1733,15 +1733,15 @@ error_code sceNpTusGetMultiUserDataStatusVUserAsync(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1768,15 +1768,15 @@ error_code sceNpTusGetFriendsDataStatus(s32 transId, SceNpTusSlotId slotId, s32 { sceNpTus.todo("sceNpTusGetFriendsDataStatus(transId=%d, slotId=%d, includeSelf=%d, sortType=%d, statusArray=*0x%x, statusArraySize=%d, arrayNum=%d, option=*0x%x)", transId, slotId, includeSelf, sortType, statusArray, statusArraySize, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1804,15 +1804,15 @@ error_code sceNpTusGetFriendsDataStatusAsync(s32 transId, SceNpTusSlotId slotId, { sceNpTus.todo("sceNpTusGetFriendsDataStatusAsync(transId=%d, slotId=%d, includeSelf=%d, sortType=%d, statusArray=*0x%x, statusArraySize=%d, arrayNum=%d, option=*0x%x)", transId, slotId, includeSelf, sortType, statusArray, statusArraySize, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1839,15 +1839,15 @@ error_code sceNpTusDeleteMultiSlotData(s32 transId, vm::cptr targetNpId { sceNpTus.todo("sceNpTusDeleteMultiSlotData(transId=%d, targetNpId=*0x%x, slotIdArray=*0x%x, arrayNum=%d, option=*0x%x)", transId, targetNpId, slotIdArray, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1874,15 +1874,15 @@ error_code sceNpTusDeleteMultiSlotDataVUser(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1909,15 +1909,15 @@ error_code sceNpTusDeleteMultiSlotDataAsync(s32 transId, vm::cptr targe { sceNpTus.todo("sceNpTusDeleteMultiSlotDataAsync(transId=%d, targetNpId=*0x%x, slotIdArray=*0x%x, arrayNum=%d, option=*0x%x)", transId, targetNpId, slotIdArray, arrayNum, option); - const auto tus_manager = g_fxo->get(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1944,15 +1944,15 @@ error_code sceNpTusDeleteMultiSlotDataVUserAsync(s32 transId, vm::cptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -1979,15 +1979,15 @@ error_code sceNpTssGetData(s32 transId, SceNpTssSlotId slotId, vm::ptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } @@ -2004,15 +2004,15 @@ error_code sceNpTssGetDataAsync(s32 transId, SceNpTssSlotId slotId, vm::ptrget(); - std::scoped_lock lock(tus_manager->mtx); + auto& tus_manager = g_fxo->get(); + std::scoped_lock lock(tus_manager.mtx); - if (!tus_manager->is_initialized) + if (!tus_manager.is_initialized) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!tus_manager->check_transaction_context_id(transId)) + if (!tus_manager.check_transaction_context_id(transId)) { return SCE_NP_COMMUNITY_ERROR_INVALID_ID; } diff --git a/rpcs3/Emu/Cell/Modules/sceNpUtil.cpp b/rpcs3/Emu/Cell/Modules/sceNpUtil.cpp index 0e042ae50b..2370a63cfe 100644 --- a/rpcs3/Emu/Cell/Modules/sceNpUtil.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNpUtil.cpp @@ -11,14 +11,14 @@ error_code sceNpUtilBandwidthTestInitStart(u32 prio, u64 stack) { sceNpUtil.todo("sceNpUtilBandwidthTestInitStart(prio=%d, stack=%d)", prio, stack); - const auto util_manager = g_fxo->get(); + auto& util_manager = g_fxo->get(); - if (util_manager->is_initialized) + if (util_manager.is_initialized) { return SCE_NP_ERROR_ALREADY_INITIALIZED; } - util_manager->is_initialized = true; + util_manager.is_initialized = true; return CELL_OK; } @@ -27,7 +27,7 @@ error_code sceNpUtilBandwidthTestGetStatus() { sceNpUtil.todo("sceNpUtilBandwidthTestGetStatus()"); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -39,14 +39,14 @@ error_code sceNpUtilBandwidthTestShutdown(vm::ptr { sceNpUtil.todo("sceNpUtilBandwidthTestShutdown(result=*0x%x)", result); - const auto util_manager = g_fxo->get(); + auto& util_manager = g_fxo->get(); - if (!util_manager->is_initialized) + if (!util_manager.is_initialized) { return SCE_NP_ERROR_NOT_INITIALIZED; } - util_manager->is_initialized = false; + util_manager.is_initialized = false; return CELL_OK; } @@ -55,7 +55,7 @@ error_code sceNpUtilBandwidthTestAbort() { sceNpUtil.todo("sceNpUtilBandwidthTestAbort()"); - if (!g_fxo->get()->is_initialized) + if (!g_fxo->get().is_initialized) { return SCE_NP_ERROR_NOT_INITIALIZED; } diff --git a/rpcs3/Emu/Cell/Modules/sys_io_.cpp b/rpcs3/Emu/Cell/Modules/sys_io_.cpp index f2991e6b69..abbdb53cd5 100644 --- a/rpcs3/Emu/Cell/Modules/sys_io_.cpp +++ b/rpcs3/Emu/Cell/Modules/sys_io_.cpp @@ -27,26 +27,26 @@ struct libio_sys_config // Only exists internally (has no name) extern void libio_sys_config_init() { - auto cfg = g_fxo->get(); + auto& cfg = g_fxo->get(); - std::lock_guard lock(cfg->mtx); + std::lock_guard lock(cfg.mtx); - if (cfg->init_ctr++ == 0) + if (cfg.init_ctr++ == 0) { // Belongs to "_cfg_evt_hndlr" thread (8k stack) - cfg->stack_addr = (ensure(vm::alloc(0x2000, vm::stack, 4096))); + cfg.stack_addr = ensure(vm::alloc(0x2000, vm::stack, 4096)); } } extern void libio_sys_config_end() { - auto cfg = g_fxo->get(); + auto& cfg = g_fxo->get(); - std::lock_guard lock(cfg->mtx); + std::lock_guard lock(cfg.mtx); - if (cfg->init_ctr-- == 1) + if (cfg.init_ctr-- == 1) { - ensure(vm::dealloc(std::exchange(cfg->stack_addr, 0), vm::stack)); + ensure(vm::dealloc(std::exchange(cfg.stack_addr, 0), vm::stack)); } } diff --git a/rpcs3/Emu/Cell/PPUModule.cpp b/rpcs3/Emu/Cell/PPUModule.cpp index d97edf1da9..0767475a7b 100644 --- a/rpcs3/Emu/Cell/PPUModule.cpp +++ b/rpcs3/Emu/Cell/PPUModule.cpp @@ -777,12 +777,12 @@ static void ppu_check_patch_spu_images(const ppu_segment& seg) for (const auto& prog : obj.progs) { // Apply the patch - applied += g_fxo->get()->apply(hash, (elf_header + prog.p_offset), prog.p_filesz, prog.p_vaddr); + applied += g_fxo->get().apply(hash, (elf_header + prog.p_offset), prog.p_filesz, prog.p_vaddr); if (!Emu.GetTitleID().empty()) { // Alternative patch - applied += g_fxo->get()->apply(Emu.GetTitleID() + '-' + hash, (elf_header + prog.p_offset), prog.p_filesz, prog.p_vaddr); + applied += g_fxo->get().apply(Emu.GetTitleID() + '-' + hash, (elf_header + prog.p_offset), prog.p_filesz, prog.p_vaddr); } } @@ -800,7 +800,7 @@ static void ppu_check_patch_spu_images(const ppu_segment& seg) void try_spawn_ppu_if_exclusive_program(const ppu_module& m) { // If only PRX/OVL has been loaded at Emu.BootGame(), launch a single PPU thread so its memory can be viewed - if (Emu.IsReady() && g_fxo->get()->segs.empty()) + if (Emu.IsReady() && g_fxo->get().segs.empty()) { ppu_thread_params p { @@ -829,10 +829,10 @@ std::shared_ptr ppu_load_prx(const ppu_prx_object& elf, const std::stri const auto prx = idm::make_ptr(); // Access linkage information object - const auto link = g_fxo->get(); + auto& link = g_fxo->get(); // Initialize HLE modules - ppu_initialize_modules(link); + ppu_initialize_modules(&link); // Library hash sha1_context sha; @@ -1079,8 +1079,8 @@ std::shared_ptr ppu_load_prx(const ppu_prx_object& elf, const std::stri ppu_loader.warning("Library %s (rtoc=0x%x):", lib_name, lib_info->toc); - prx->specials = ppu_load_exports(link, lib_info->exports_start, lib_info->exports_end); - prx->imports = ppu_load_imports(prx->relocs, link, lib_info->imports_start, lib_info->imports_end); + prx->specials = ppu_load_exports(&link, lib_info->exports_start, lib_info->exports_end); + prx->imports = ppu_load_imports(prx->relocs, &link, lib_info->imports_start, lib_info->imports_end); std::stable_sort(prx->relocs.begin(), prx->relocs.end()); toc = lib_info->toc; } @@ -1113,17 +1113,17 @@ std::shared_ptr ppu_load_prx(const ppu_prx_object& elf, const std::stri const std::string hash_seg = fmt::format("%s-%u", hash, i); // Apply the patch - auto _applied = g_fxo->get()->apply(hash_seg, vm::get_super_ptr(seg.addr), seg.size); + auto _applied = g_fxo->get().apply(hash_seg, vm::get_super_ptr(seg.addr), seg.size); if (!Emu.GetTitleID().empty()) { // Alternative patch - _applied += g_fxo->get()->apply(Emu.GetTitleID() + '-' + hash_seg, vm::get_super_ptr(seg.addr), seg.size); + _applied += g_fxo->get().apply(Emu.GetTitleID() + '-' + hash_seg, vm::get_super_ptr(seg.addr), seg.size); } // Rebase patch offsets std::for_each(_applied.begin(), _applied.end(), [&](u32& res) { if (res != umax) res += seg.addr; }); - + applied += _applied; if (_applied.empty()) @@ -1205,11 +1205,13 @@ bool ppu_load_exec(const ppu_exec_object& elf) } } + g_fxo->need(); + // Set for delayed initialization in ppu_initialize() - const auto _main = g_fxo->get(); + auto& _main = g_fxo->get(); // Access linkage information object - const auto link = g_fxo->init(); + auto& link = g_fxo->get(); // TLS information u32 tls_vaddr = 0; @@ -1232,7 +1234,7 @@ bool ppu_load_exec(const ppu_exec_object& elf) struct on_fatal_error { - ppu_module* _main; + ppu_module& _main; bool errored = true; ~on_fatal_error() @@ -1243,7 +1245,7 @@ bool ppu_load_exec(const ppu_exec_object& elf) } // Revert previous allocations on an error - for (const auto& seg : _main->segs) + for (const auto& seg : _main.segs) { vm::dealloc(seg.addr); } @@ -1300,7 +1302,7 @@ bool ppu_load_exec(const ppu_exec_object& elf) } // Store only LOAD segments (TODO) - _main->segs.emplace_back(_seg); + _main.segs.emplace_back(_seg); } } @@ -1321,33 +1323,33 @@ bool ppu_load_exec(const ppu_exec_object& elf) if (addr && size) { - _main->secs.emplace_back(_sec); + _main.secs.emplace_back(_sec); - if (_sec.flags & 0x4 && addr >= _main->segs[0].addr && addr + size <= _main->segs[0].addr + _main->segs[0].size) + if (_sec.flags & 0x4 && addr >= _main.segs[0].addr && addr + size <= _main.segs[0].addr + _main.segs[0].size) { end = std::max(end, addr + size); } } } - sha1_finish(&sha, _main->sha1); + sha1_finish(&sha, _main.sha1); // Format patch name std::string hash("PPU-0000000000000000000000000000000000000000"); for (u32 i = 0; i < 20; i++) { constexpr auto pal = "0123456789abcdef"; - hash[4 + i * 2] = pal[_main->sha1[i] >> 4]; - hash[5 + i * 2] = pal[_main->sha1[i] & 15]; + hash[4 + i * 2] = pal[_main.sha1[i] >> 4]; + hash[5 + i * 2] = pal[_main.sha1[i] & 15]; } // Apply the patch - auto applied = g_fxo->get()->apply(hash, vm::g_base_addr); + auto applied = g_fxo->get().apply(hash, vm::g_base_addr); if (!Emu.GetTitleID().empty()) { // Alternative patch - applied += g_fxo->get()->apply(Emu.GetTitleID() + '-' + hash, vm::g_base_addr); + applied += g_fxo->get().apply(Emu.GetTitleID() + '-' + hash, vm::g_base_addr); } if (applied.empty()) @@ -1360,10 +1362,10 @@ bool ppu_load_exec(const ppu_exec_object& elf) } // Initialize HLE modules - ppu_initialize_modules(link); + ppu_initialize_modules(&link); // Embedded SPU elf patching - for (const auto& seg : _main->segs) + for (const auto& seg : _main.segs) { ppu_check_patch_spu_images(seg); } @@ -1373,10 +1375,10 @@ bool ppu_load_exec(const ppu_exec_object& elf) { auto shle = g_fxo->init(0); - for (u32 i = _main->segs[0].addr; i < (_main->segs[0].addr + _main->segs[0].size); i += 4) + for (u32 i = _main.segs[0].addr; i < (_main.segs[0].addr + _main.segs[0].size); i += 4) { vm::cptr _ptr = vm::cast(i); - shle->check_against_patterns(_ptr, (_main->segs[0].addr + _main->segs[0].size) - i, i); + shle->check_against_patterns(_ptr, (_main.segs[0].addr + _main.segs[0].size) - i, i); } } @@ -1512,9 +1514,9 @@ bool ppu_load_exec(const ppu_exec_object& elf) return false; } - ppu_load_exports(link, proc_prx_param.libent_start, proc_prx_param.libent_end); - ppu_load_imports(_main->relocs, link, proc_prx_param.libstub_start, proc_prx_param.libstub_end); - std::stable_sort(_main->relocs.begin(), _main->relocs.end()); + ppu_load_exports(&link, proc_prx_param.libent_start, proc_prx_param.libent_end); + ppu_load_imports(_main.relocs, &link, proc_prx_param.libstub_start, proc_prx_param.libstub_end); + std::stable_sort(_main.relocs.begin(), _main.relocs.end()); } break; } @@ -1594,14 +1596,14 @@ bool ppu_load_exec(const ppu_exec_object& elf) } // Set path (TODO) - _main->name.clear(); - _main->path = vfs::get(Emu.argv[0]); + _main.name.clear(); + _main.path = vfs::get(Emu.argv[0]); // Analyse executable (TODO) - _main->analyse(0, static_cast(elf.header.e_entry), end, applied); + _main.analyse(0, static_cast(elf.header.e_entry), end, applied); // Validate analyser results (not required) - _main->validate(0); + _main.validate(0); // Set SDK version g_ps3_process_info.sdk_ver = sdk_version; @@ -1781,7 +1783,7 @@ std::pair, CellError> ppu_load_overlay(const ppu_ex } // Access linkage information object - const auto link = g_fxo->get(); + auto& link = g_fxo->get(); // Executable hash sha1_context sha; @@ -1903,12 +1905,12 @@ std::pair, CellError> ppu_load_overlay(const ppu_ex } // Apply the patch - auto applied = g_fxo->get()->apply(hash, vm::g_base_addr); + auto applied = g_fxo->get().apply(hash, vm::g_base_addr); if (!Emu.GetTitleID().empty()) { // Alternative patch - applied += g_fxo->get()->apply(Emu.GetTitleID() + '-' + hash, vm::g_base_addr); + applied += g_fxo->get().apply(Emu.GetTitleID() + '-' + hash, vm::g_base_addr); } // Embedded SPU elf patching @@ -1997,8 +1999,8 @@ std::pair, CellError> ppu_load_overlay(const ppu_ex fmt::throw_exception("Bad magic! (0x%x)", proc_prx_param.magic); } - ppu_load_exports(link, proc_prx_param.libent_start, proc_prx_param.libent_end); - ppu_load_imports(ovlm->relocs, link, proc_prx_param.libstub_start, proc_prx_param.libstub_end); + ppu_load_exports(&link, proc_prx_param.libent_start, proc_prx_param.libent_end); + ppu_load_imports(ovlm->relocs, &link, proc_prx_param.libstub_start, proc_prx_param.libstub_end); } break; } diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 983ad1fb83..36621c41b3 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -456,7 +456,7 @@ static bool ppu_break(ppu_thread& ppu, ppu_opcode_t op) { // Pause ppu.state.atomic_op([](bs_t& state) { if (!(state & cpu_flag::dbg_step)) state += cpu_flag::dbg_pause; }); - + if (ppu.check_state()) { return false; @@ -2216,7 +2216,7 @@ extern void ppu_finalize(const ppu_module& info) } #ifdef LLVM_AVAILABLE - g_fxo->get()->remove(cache_path + info.name); + g_fxo->get().remove(cache_path + info.name); #endif } @@ -2515,9 +2515,9 @@ extern void ppu_precompile(std::vector& dir_queue, std::vectorget(); + auto& _main = g_fxo->get(); - if (!_main) + if (!g_fxo->is_init()) { return; } @@ -2530,9 +2530,9 @@ extern void ppu_initialize() bool compile_main = false; // Check main module cache - if (!_main->segs.empty()) + if (!_main.segs.empty()) { - compile_main = ppu_initialize(*_main, true); + compile_main = ppu_initialize(_main, true); } std::vector prx_list; @@ -2575,9 +2575,9 @@ extern void ppu_initialize() } // Initialize main module cache - if (!_main->segs.empty()) + if (!_main.segs.empty()) { - ppu_initialize(*_main); + ppu_initialize(_main); } // Initialize preloaded libraries @@ -2602,7 +2602,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only) } // Temporarily - s_ppu_toc = g_fxo->get>(); + s_ppu_toc = &g_fxo->get>(); for (const auto& func : info.funcs) { @@ -2709,7 +2709,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only) }; // Permanently loaded compiled PPU modules (name -> data) - jit_module& jit_mod = g_fxo->get()->get(cache_path + info.name); + jit_module& jit_mod = g_fxo->get().get(cache_path + info.name); // Compiler instance (deferred initialization) std::shared_ptr& jit = jit_mod.pjit; @@ -2976,7 +2976,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only) // Prevent watchdog thread from terminating g_watchdog_hold_ctr++; - named_thread_group threads(fmt::format("PPUW.%u.", ++g_fxo->get()->index), thread_count, [&]() + named_thread_group threads(fmt::format("PPUW.%u.", ++g_fxo->get().index), thread_count, [&]() { // Set low priority thread_ctrl::scoped_priority low_prio(-1); @@ -2992,7 +2992,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only) const auto [obj_name, part] = std::as_const(workload)[i]; // Allocate "core" - std::lock_guard jlock(g_fxo->get()->sem); + std::lock_guard jlock(g_fxo->get().sem); ppu_log.warning("LLVM: Compiling module %s%s", cache_path, obj_name); diff --git a/rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp b/rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp index d157034137..372784c9c9 100644 --- a/rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp +++ b/rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp @@ -44,7 +44,7 @@ void spu_recompiler::init() // Initialize if necessary if (!m_spurt) { - m_spurt = g_fxo->get(); + m_spurt = &g_fxo->get(); } } @@ -77,9 +77,9 @@ spu_function_t spu_recompiler::compile(spu_program&& _func) return add_loc->compiled; } - if (auto cache = g_fxo->get(); *cache && g_cfg.core.spu_cache && !add_loc->cached.exchange(1)) + if (auto& cache = g_fxo->get(); cache && g_cfg.core.spu_cache && !add_loc->cached.exchange(1)) { - cache->add(func); + cache.add(func); } { diff --git a/rpcs3/Emu/Cell/SPURecompiler.cpp b/rpcs3/Emu/Cell/SPURecompiler.cpp index 0f4b625ffd..e0c0e719e7 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.cpp +++ b/rpcs3/Emu/Cell/SPURecompiler.cpp @@ -546,7 +546,7 @@ void spu_cache::initialize() // Initialize global cache instance if (g_cfg.core.spu_cache) { - *g_fxo->get() = std::move(cache); + g_fxo->get() = std::move(cache); } } @@ -4208,7 +4208,7 @@ public: // Initialize if necessary if (!m_spurt) { - m_spurt = g_fxo->get(); + m_spurt = &g_fxo->get(); cpu_translator::initialize(m_jit.get_context(), m_jit.get_engine()); const auto md_name = llvm::MDString::get(m_context, "branch_weights"); @@ -4252,9 +4252,9 @@ public: std::string log; - if (auto cache = g_fxo->get(); *cache && g_cfg.core.spu_cache && !add_loc->cached.exchange(1)) + if (auto& cache = g_fxo->get(); cache && g_cfg.core.spu_cache && !add_loc->cached.exchange(1)) { - cache->add(func); + cache.add(func); } { @@ -4849,7 +4849,7 @@ public: fs::file(m_spurt->get_cache_path() + "spu-ir.log", fs::write + fs::append).write(log); } - if (*g_fxo->get()) + if (g_fxo->get().operator bool()) { spu_log.success("New block compiled successfully"); } @@ -9124,7 +9124,7 @@ struct spu_fast : public spu_recompiler_base { if (!m_spurt) { - m_spurt = g_fxo->get(); + m_spurt = &g_fxo->get(); } } @@ -9460,7 +9460,7 @@ struct spu_fast : public spu_recompiler_base else if (added) { // Send work to LLVM compiler thread - g_fxo->get()->registered.push(m_hash_start, add_loc); + g_fxo->get().registered.push(m_hash_start, add_loc); } // Rebuild trampoline if necessary diff --git a/rpcs3/Emu/Cell/lv2/lv2.cpp b/rpcs3/Emu/Cell/lv2/lv2.cpp index eade47a71c..8441752085 100644 --- a/rpcs3/Emu/Cell/lv2/lv2.cpp +++ b/rpcs3/Emu/Cell/lv2/lv2.cpp @@ -1073,7 +1073,7 @@ extern void ppu_execute_syscall(ppu_thread& ppu, u64 code) if (code < g_ppu_syscall_table.size()) { - g_fxo->get>()->stat[code]++; + g_fxo->get>().stat[code]++; if (auto func = g_ppu_syscall_table[code].first) { diff --git a/rpcs3/Emu/Cell/lv2/sys_config.cpp b/rpcs3/Emu/Cell/lv2/sys_config.cpp index fd3bad4c7e..407e061d4a 100644 --- a/rpcs3/Emu/Cell/lv2/sys_config.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_config.cpp @@ -263,10 +263,10 @@ error_code sys_config_open(u32 equeue_hdl, vm::ptr out_config_hdl) } // Initialize lv2_config global state - const auto global = g_fxo->get(); + auto& global = g_fxo->get(); if (true) { - global->initialize(); + global.initialize(); } // Create a lv2_config_handle object @@ -307,7 +307,7 @@ error_code sys_config_get_service_event(u32 config_hdl, u32 event_id, vm::ptrget()->find_event(event_id); + const auto event = g_fxo->get().find_event(event_id); if (!event) { return CELL_ESRCH; diff --git a/rpcs3/Emu/Cell/lv2/sys_config.h b/rpcs3/Emu/Cell/lv2/sys_config.h index cc8f60dbc2..658c25c60e 100644 --- a/rpcs3/Emu/Cell/lv2/sys_config.h +++ b/rpcs3/Emu/Cell/lv2/sys_config.h @@ -352,7 +352,7 @@ class lv2_config_service_event atomic_t next_id = 0; }; - return g_fxo->get()->next_id++; + return g_fxo->get().next_id++; } public: @@ -385,7 +385,7 @@ public: { auto ev = std::make_shared(std::forward(args)...); - g_fxo->get()->add_service_event(ev); + g_fxo->get().add_service_event(ev); return ev; } @@ -393,9 +393,9 @@ public: // Destructor ~lv2_config_service_event() { - if (auto global = g_fxo->get()) + if (auto& global = g_fxo->get(); !Emu.IsStopped()) { - global->remove_service_event(id); + global.remove_service_event(id); } } diff --git a/rpcs3/Emu/Cell/lv2/sys_fs.cpp b/rpcs3/Emu/Cell/lv2/sys_fs.cpp index 122297c658..959cced2f6 100644 --- a/rpcs3/Emu/Cell/lv2/sys_fs.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_fs.cpp @@ -465,8 +465,8 @@ lv2_file::open_raw_result_t lv2_file::open_raw(const std::string& local_path, s3 file.seek(0); if (magic == "NPD\0"_u32) { - auto edatkeys = g_fxo->get(); - auto sdata_file = std::make_unique(std::move(file), edatkeys->devKlic.load(), edatkeys->rifKey.load()); + auto& edatkeys = g_fxo->get(); + auto sdata_file = std::make_unique(std::move(file), edatkeys.devKlic.load(), edatkeys.rifKey.load()); if (!sdata_file->ReadHeader()) { return {CELL_EFSSPECIFIC}; @@ -553,7 +553,7 @@ error_code sys_fs_open(ppu_thread& ppu, vm::cptr path, s32 flags, vm::ptr< if (const u32 id = idm::import([&ppath = ppath, &file = file, mode, flags, &real = real, &type = type]() -> std::shared_ptr { - if (!g_fxo->get()->npdrm_fds.try_inc(16)) + if (!g_fxo->get().npdrm_fds.try_inc(16)) { return nullptr; } @@ -681,7 +681,7 @@ error_code sys_fs_close(ppu_thread& ppu, u32 fd) { if (file.type >= lv2_file_type::sdata) { - g_fxo->get()->npdrm_fds--; + g_fxo->get().npdrm_fds--; } }); @@ -1350,7 +1350,7 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr _arg, u32 stream.reset(std::move(sdata_file)); if (const u32 id = idm::import([&file = *file, &stream = stream]() -> std::shared_ptr { - if (!g_fxo->get()->npdrm_fds.try_inc(16)) + if (!g_fxo->get().npdrm_fds.try_inc(16)) { return nullptr; } diff --git a/rpcs3/Emu/Cell/lv2/sys_memory.cpp b/rpcs3/Emu/Cell/lv2/sys_memory.cpp index 79d569fa06..ed0fa6da2b 100644 --- a/rpcs3/Emu/Cell/lv2/sys_memory.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_memory.cpp @@ -50,10 +50,10 @@ error_code sys_memory_allocate(cpu_thread& cpu, u32 size, u64 flags, vm::ptrget(); + auto& dct = g_fxo->get(); // Try to get "physical memory" - if (!dct->take(size)) + if (!dct.take(size)) { return CELL_ENOMEM; } @@ -62,7 +62,7 @@ error_code sys_memory_allocate(cpu_thread& cpu, u32 size, u64 flags, vm::ptralloc(size, nullptr, align)) { - ensure(!g_fxo->get()->addrs[addr >> 16].exchange(dct)); + ensure(!g_fxo->get().addrs[addr >> 16].exchange(&dct)); if (alloc_addr) { @@ -77,7 +77,7 @@ error_code sys_memory_allocate(cpu_thread& cpu, u32 size, u64 flags, vm::ptrused -= size; + dct.used -= size; return CELL_ENOMEM; } @@ -133,7 +133,7 @@ error_code sys_memory_allocate_from_container(cpu_thread& cpu, u32 size, u32 cid { if (u32 addr = area->alloc(size)) { - ensure(!g_fxo->get()->addrs[addr >> 16].exchange(ct.ptr.get())); + ensure(!g_fxo->get().addrs[addr >> 16].exchange(ct.ptr.get())); if (alloc_addr) { @@ -158,7 +158,7 @@ error_code sys_memory_free(cpu_thread& cpu, u32 addr) sys_memory.warning("sys_memory_free(addr=0x%x)", addr); - const auto ct = addr % 0x10000 ? nullptr : g_fxo->get()->addrs[addr >> 16].exchange(nullptr); + const auto ct = addr % 0x10000 ? nullptr : g_fxo->get().addrs[addr >> 16].exchange(nullptr); if (!ct) { @@ -215,12 +215,12 @@ error_code sys_memory_get_user_memory_size(cpu_thread& cpu, vm::ptrget(); + auto& dct = g_fxo->get(); ::reader_lock lock(s_memstats_mtx); - mem_info->total_user_memory = dct->size; - mem_info->available_user_memory = dct->size - dct->used; + mem_info->total_user_memory = dct.size; + mem_info->available_user_memory = dct.size - dct.used; // Scan other memory containers idm::select([&](u32, lv2_memory_container& ct) @@ -254,12 +254,12 @@ error_code sys_memory_container_create(cpu_thread& cpu, vm::ptr cid, u32 si return CELL_ENOMEM; } - const auto dct = g_fxo->get(); + auto& dct = g_fxo->get(); std::lock_guard lock(s_memstats_mtx); // Try to obtain "physical memory" from the default container - if (!dct->take(size)) + if (!dct.take(size)) { return CELL_ENOMEM; } @@ -271,7 +271,7 @@ error_code sys_memory_container_create(cpu_thread& cpu, vm::ptr cid, u32 si return CELL_OK; } - dct->used -= size; + dct.used -= size; return CELL_EAGAIN; } @@ -305,7 +305,7 @@ error_code sys_memory_container_destroy(cpu_thread& cpu, u32 cid) } // Return "physical memory" to the default container - g_fxo->get()->used -= ct->size; + g_fxo->get().used -= ct->size; return CELL_OK; } diff --git a/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp b/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp index fb7ab7a1a3..c4cd09fc1a 100644 --- a/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp @@ -143,16 +143,16 @@ error_code sys_mmapper_allocate_shared_memory(ppu_thread& ppu, u64 ipc_key, u64 } // Get "default" memory container - const auto dct = g_fxo->get(); + auto& dct = g_fxo->get(); - if (!dct->take(size)) + if (!dct.take(size)) { return CELL_ENOMEM; } - if (auto error = create_lv2_shm(ipc_key != SYS_MMAPPER_NO_SHM_KEY, ipc_key, size, flags & SYS_MEMORY_PAGE_SIZE_64K ? 0x10000 : 0x100000, flags, dct)) + if (auto error = create_lv2_shm(ipc_key != SYS_MMAPPER_NO_SHM_KEY, ipc_key, size, flags & SYS_MEMORY_PAGE_SIZE_64K ? 0x10000 : 0x100000, flags, &dct)) { - dct->used -= size; + dct.used -= size; return error; } @@ -317,16 +317,16 @@ error_code sys_mmapper_allocate_shared_memory_ext(ppu_thread& ppu, u64 ipc_key, } // Get "default" memory container - const auto dct = g_fxo->get(); + auto& dct = g_fxo->get(); - if (!dct->take(size)) + if (!dct.take(size)) { return CELL_ENOMEM; } - if (auto error = create_lv2_shm(true, ipc_key, size, flags & SYS_MEMORY_PAGE_SIZE_64K ? 0x10000 : 0x100000, flags, dct)) + if (auto error = create_lv2_shm(true, ipc_key, size, flags & SYS_MEMORY_PAGE_SIZE_64K ? 0x10000 : 0x100000, flags, &dct)) { - dct->used -= size; + dct.used -= size; return error; } @@ -467,10 +467,10 @@ error_code sys_mmapper_free_address(ppu_thread& ppu, u32 addr) } // If page fault notify exists and an address in this area is faulted, we can't free the memory. - auto pf_events = g_fxo->get(); - std::lock_guard pf_lock(pf_events->pf_mutex); + auto& pf_events = g_fxo->get(); + std::lock_guard pf_lock(pf_events.pf_mutex); - for (const auto& ev : pf_events->events) + for (const auto& ev : pf_events.events) { auto mem = vm::get(vm::any, addr); if (mem && addr <= ev.second && ev.second <= addr + mem->size - 1) @@ -493,20 +493,20 @@ error_code sys_mmapper_free_address(ppu_thread& ppu, u32 addr) } // If a memory block is freed, remove it from page notification table. - auto pf_entries = g_fxo->get(); - std::lock_guard lock(pf_entries->mutex); + auto& pf_entries = g_fxo->get(); + std::lock_guard lock(pf_entries.mutex); - auto ind_to_remove = pf_entries->entries.begin(); - for (; ind_to_remove != pf_entries->entries.end(); ++ind_to_remove) + auto ind_to_remove = pf_entries.entries.begin(); + for (; ind_to_remove != pf_entries.entries.end(); ++ind_to_remove) { if (addr == ind_to_remove->start_addr) { break; } } - if (ind_to_remove != pf_entries->entries.end()) + if (ind_to_remove != pf_entries.entries.end()) { - pf_entries->entries.erase(ind_to_remove); + pf_entries.entries.erase(ind_to_remove); } return CELL_OK; @@ -725,11 +725,11 @@ error_code sys_mmapper_enable_page_fault_notification(ppu_thread& ppu, u32 start return CELL_EAGAIN; } - auto pf_entries = g_fxo->get(); - std::unique_lock lock(pf_entries->mutex); + auto& pf_entries = g_fxo->get(); + std::unique_lock lock(pf_entries.mutex); // Return error code if page fault notifications are already enabled - for (const auto& entry : pf_entries->entries) + for (const auto& entry : pf_entries.entries) { if (entry.start_addr == start_addr) { @@ -741,7 +741,7 @@ error_code sys_mmapper_enable_page_fault_notification(ppu_thread& ppu, u32 start } page_fault_notification_entry entry{ start_addr, event_queue_id, port_id->value() }; - pf_entries->entries.emplace_back(entry); + pf_entries.entries.emplace_back(entry); return CELL_OK; } @@ -749,18 +749,18 @@ error_code sys_mmapper_enable_page_fault_notification(ppu_thread& ppu, u32 start error_code mmapper_thread_recover_page_fault(cpu_thread* cpu) { // We can only wake a thread if it is being suspended for a page fault. - auto pf_events = g_fxo->get(); + auto& pf_events = g_fxo->get(); { - std::lock_guard pf_lock(pf_events->pf_mutex); - const auto pf_event_ind = pf_events->events.find(cpu); + std::lock_guard pf_lock(pf_events.pf_mutex); + const auto pf_event_ind = pf_events.events.find(cpu); - if (pf_event_ind == pf_events->events.end()) + if (pf_event_ind == pf_events.events.end()) { // if not found... return CELL_EINVAL; } - pf_events->events.erase(pf_event_ind); + pf_events.events.erase(pf_event_ind); } if (cpu->id_type() == 1u) diff --git a/rpcs3/Emu/Cell/lv2/sys_net.cpp b/rpcs3/Emu/Cell/lv2/sys_net.cpp index 41309dd3b3..83233e66b1 100644 --- a/rpcs3/Emu/Cell/lv2/sys_net.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_net.cpp @@ -566,8 +566,8 @@ struct nt_p2p_port // Adds to tcp timeout monitor to resend the message until an ack is received if (require_ack) { - auto tcpm = g_fxo->get>(); - tcpm->add_message(sock_id, dst, std::move(data), seq); + auto& tcpm = g_fxo->get>(); + tcpm.add_message(sock_id, dst, std::move(data), seq); } } @@ -590,8 +590,8 @@ struct nt_p2p_port if (tcp_header->flags == lv2_socket::p2ps_i::ACK) { - auto tcpm = g_fxo->get>(); - tcpm->confirm_data_received(sock_id, tcp_header->ack); + auto& tcpm = g_fxo->get>(); + tcpm.confirm_data_received(sock_id, tcp_header->ack); } auto send_ack = [&]() @@ -831,8 +831,8 @@ struct nt_p2p_port sign_msgs.push_back(std::move(msg)); } - const auto sigh = g_fxo->get>(); - sigh->wake_up(); + auto& sigh = g_fxo->get>(); + sigh.wake_up(); return true; } @@ -1142,11 +1142,11 @@ using network_context = named_thread; // Used by RPCN to send signaling packets to RPCN server(for UDP hole punching) s32 send_packet_from_p2p_port(const std::vector& data, const sockaddr_in& addr) { - s32 res = 0; - const auto nc = g_fxo->get(); + s32 res{}; + auto& nc = g_fxo->get(); { - std::lock_guard list_lock(nc->list_p2p_ports_mutex); - auto& def_port = nc->list_p2p_ports.at(3658); + std::lock_guard list_lock(nc.list_p2p_ports_mutex); + auto& def_port = nc.list_p2p_ports.at(3658); res = ::sendto(def_port.p2p_socket, reinterpret_cast(data.data()), data.size(), 0, reinterpret_cast(&addr), sizeof(sockaddr_in)); } @@ -1156,14 +1156,14 @@ s32 send_packet_from_p2p_port(const std::vector& data, const sockaddr_in& ad std::vector> get_rpcn_msgs() { - auto msgs = std::vector>(); - const auto nc = g_fxo->get(); + std::vector> msgs; + auto& nc = g_fxo->get(); { - std::lock_guard list_lock(nc->list_p2p_ports_mutex); - auto& def_port = nc->list_p2p_ports.at(3658); + std::lock_guard list_lock(nc.list_p2p_ports_mutex); + auto& def_port = nc.list_p2p_ports.at(3658); { std::lock_guard lock(def_port.s_rpcn_mutex); - msgs = std::move(def_port.rpcn_msgs); + msgs = std::move(def_port.rpcn_msgs); def_port.rpcn_msgs.clear(); } } @@ -1173,11 +1173,11 @@ std::vector> get_rpcn_msgs() std::vector, std::vector>> get_sign_msgs() { - auto msgs = std::vector, std::vector>>(); - const auto nc = g_fxo->get(); + std::vector, std::vector>> msgs; + auto& nc = g_fxo->get(); { - std::lock_guard list_lock(nc->list_p2p_ports_mutex); - auto& def_port = nc->list_p2p_ports.at(3658); + std::lock_guard list_lock(nc.list_p2p_ports_mutex); + auto& def_port = nc.list_p2p_ports.at(3658); { std::lock_guard lock(def_port.s_sign_mutex); msgs = std::move(def_port.sign_msgs); @@ -1479,15 +1479,15 @@ error_code sys_net_bnet_bind(ppu_thread& ppu, s32 s, vm::cptr lv2_socket::socket_type real_socket{}; - const auto nc = g_fxo->get(); + auto& nc = g_fxo->get(); { - std::lock_guard list_lock(nc->list_p2p_ports_mutex); - if (nc->list_p2p_ports.count(p2p_port) == 0) + std::lock_guard list_lock(nc.list_p2p_ports_mutex); + if (nc.list_p2p_ports.count(p2p_port) == 0) { - nc->list_p2p_ports.emplace(std::piecewise_construct, std::forward_as_tuple(p2p_port), std::forward_as_tuple(p2p_port)); + nc.list_p2p_ports.emplace(std::piecewise_construct, std::forward_as_tuple(p2p_port), std::forward_as_tuple(p2p_port)); } - auto& pport = nc->list_p2p_ports.at(p2p_port); + auto& pport = nc.list_p2p_ports.at(p2p_port); real_socket = pport.p2p_socket; { std::lock_guard lock(pport.bound_p2p_vports_mutex); @@ -1597,13 +1597,13 @@ error_code sys_net_bnet_connect(ppu_thread& ppu, s32 s, vm::ptrget(); + auto& nc = g_fxo->get(); { - std::lock_guard list_lock(nc->list_p2p_ports_mutex); - if (!nc->list_p2p_ports.count(sock.p2p.port)) - nc->list_p2p_ports.emplace(std::piecewise_construct, std::forward_as_tuple(sock.p2p.port), std::forward_as_tuple(sock.p2p.port)); + std::lock_guard list_lock(nc.list_p2p_ports_mutex); + if (!nc.list_p2p_ports.count(sock.p2p.port)) + nc.list_p2p_ports.emplace(std::piecewise_construct, std::forward_as_tuple(sock.p2p.port), std::forward_as_tuple(sock.p2p.port)); - auto& pport = nc->list_p2p_ports.at(sock.p2p.port); + auto& pport = nc.list_p2p_ports.at(sock.p2p.port); real_socket = pport.p2p_socket; { std::lock_guard lock(pport.bound_p2p_vports_mutex); @@ -1658,15 +1658,15 @@ error_code sys_net_bnet_connect(ppu_thread& ppu, s32 s, vm::ptrsin_port == 53) { - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); // Hack for DNS name.sin_port = std::bit_cast>(53); - name.sin_addr.s_addr = nph->get_dns_ip(); + name.sin_addr.s_addr = nph.get_dns_ip(); sys_net.notice("sys_net_bnet_connect: using DNS..."); - nph->add_dns_spy(s); + nph.add_dns_spy(s); } else if (_addr->sa_family != SYS_NET_AF_INET) { @@ -2245,10 +2245,10 @@ error_code sys_net_bnet_recvfrom(ppu_thread& ppu, s32 s, vm::ptr buf, u32 //if (!(sock.events & lv2_socket::poll::read)) { - const auto nph = g_fxo->get>(); - if (nph->is_dns(s) && nph->is_dns_queue(s)) + auto& nph = g_fxo->get>(); + if (nph.is_dns(s) && nph.is_dns_queue(s)) { - const auto packet = nph->get_dns_packet(s); + const auto packet = nph.get_dns_packet(s); ensure(packet.size() < len); memcpy(buf.get_ptr(), packet.data(), packet.size()); @@ -2256,7 +2256,7 @@ error_code sys_net_bnet_recvfrom(ppu_thread& ppu, s32 s, vm::ptr buf, u32 native_addr.ss_family = AF_INET; (reinterpret_cast<::sockaddr_in*>(&native_addr))->sin_port = std::bit_cast>(53); // htons(53) - (reinterpret_cast<::sockaddr_in*>(&native_addr))->sin_addr.s_addr = nph->get_dns_ip(); + (reinterpret_cast<::sockaddr_in*>(&native_addr))->sin_addr.s_addr = nph.get_dns_ip(); return true; } @@ -2655,18 +2655,18 @@ error_code sys_net_bnet_sendto(ppu_thread& ppu, s32 s, vm::cptr buf, u32 l //if (!(sock.events & lv2_socket::poll::write)) { - const auto nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); if (addr && type == SYS_NET_SOCK_DGRAM && psa_in->sin_port == 53) { - nph->add_dns_spy(s); + nph.add_dns_spy(s); } - if (nph->is_dns(s)) + if (nph.is_dns(s)) { - const s32 ret_analyzer = nph->analyze_dns_packet(s, reinterpret_cast(_buf.data()), len); + const s32 ret_analyzer = nph.analyze_dns_packet(s, reinterpret_cast(_buf.data()), len); // If we're not connected just never send the packet and pretend we did - if (!nph->get_net_status()) + if (!nph.get_net_status()) { native_result = data_len; return true; @@ -3135,10 +3135,10 @@ error_code sys_net_bnet_close(ppu_thread& ppu, s32 s) // If it's a bound socket we "close" the vport if ((sock->type == SYS_NET_SOCK_DGRAM_P2P || sock->type == SYS_NET_SOCK_STREAM_P2P) && sock->p2p.port && sock->p2p.vport) { - const auto nc = g_fxo->get(); + auto& nc = g_fxo->get(); { - std::lock_guard lock(nc->list_p2p_ports_mutex); - auto& p2p_port = nc->list_p2p_ports.at(sock->p2p.port); + std::lock_guard lock(nc.list_p2p_ports_mutex); + auto& p2p_port = nc.list_p2p_ports.at(sock->p2p.port); { std::lock_guard lock(p2p_port.bound_p2p_vports_mutex); if (sock->type == SYS_NET_SOCK_DGRAM_P2P) @@ -3162,8 +3162,8 @@ error_code sys_net_bnet_close(ppu_thread& ppu, s32 s) } } - const auto nph = g_fxo->get>(); - nph->remove_dns_spy(s); + auto& nph = g_fxo->get>(); + nph.remove_dns_spy(s); return CELL_OK; } @@ -3189,7 +3189,7 @@ error_code sys_net_bnet_poll(ppu_thread& ppu, vm::ptr fds, s32 n { fds_buf.assign(fds.get_ptr(), fds.get_ptr() + nfds); - std::unique_lock nw_lock(g_fxo->get()->s_nw_mutex); + std::unique_lock nw_lock(g_fxo->get().s_nw_mutex); std::shared_lock lock(id_manager::g_mutex); @@ -3254,8 +3254,8 @@ error_code sys_net_bnet_poll(ppu_thread& ppu, vm::ptr fds, s32 n else { // Check for fake packet for dns interceptions - const auto nph = g_fxo->get>(); - if (fds_buf[i].events & SYS_NET_POLLIN && nph->is_dns(fds_buf[i].fd) && nph->is_dns_queue(fds_buf[i].fd)) + auto& nph = g_fxo->get>(); + if (fds_buf[i].events & SYS_NET_POLLIN && nph.is_dns(fds_buf[i].fd) && nph.is_dns_queue(fds_buf[i].fd)) fds_buf[i].revents |= SYS_NET_POLLIN; if (fds_buf[i].events & ~(SYS_NET_POLLIN | SYS_NET_POLLOUT | SYS_NET_POLLERR)) @@ -3342,7 +3342,7 @@ error_code sys_net_bnet_poll(ppu_thread& ppu, vm::ptr fds, s32 n fds_buf[i].revents |= SYS_NET_POLLERR; signaled++; - g_fxo->get()->s_to_awake.emplace_back(&ppu); + g_fxo->get().s_to_awake.emplace_back(&ppu); return true; } @@ -3377,7 +3377,7 @@ error_code sys_net_bnet_poll(ppu_thread& ppu, vm::ptr fds, s32 n return {}; } - std::lock_guard nw_lock(g_fxo->get()->s_nw_mutex); + std::lock_guard nw_lock(g_fxo->get().s_nw_mutex); if (signaled) { @@ -3425,7 +3425,7 @@ error_code sys_net_bnet_select(ppu_thread& ppu, s32 nfds, vm::ptrget()->s_nw_mutex); + std::lock_guard nw_lock(g_fxo->get().s_nw_mutex); reader_lock lock(id_manager::g_mutex); @@ -3558,7 +3558,7 @@ error_code sys_net_bnet_select(ppu_thread& ppu, s32 nfds, vm::ptrget()->s_to_awake.emplace_back(&ppu); + g_fxo->get().s_to_awake.emplace_back(&ppu); return true; } @@ -3601,7 +3601,7 @@ error_code sys_net_bnet_select(ppu_thread& ppu, s32 nfds, vm::ptrget()->s_nw_mutex); + std::lock_guard nw_lock(g_fxo->get().s_nw_mutex); if (signaled) { @@ -3691,8 +3691,8 @@ error_code sys_net_infoctl(ppu_thread& ppu, s32 cmd, vm::ptr arg) char buffer[nameserver.size() + 80]{}; std::memcpy(buffer, nameserver.data(), nameserver.size()); - const auto nph = g_fxo->get>(); - const auto dns_str = np_handler::ip_to_string(nph->get_dns_ip()); + auto& nph = g_fxo->get>(); + const auto dns_str = np_handler::ip_to_string(nph.get_dns_ip()); std::memcpy(buffer + nameserver.size() - 1, dns_str.data(), dns_str.size()); std::string_view name{buffer}; diff --git a/rpcs3/Emu/Cell/lv2/sys_overlay.cpp b/rpcs3/Emu/Cell/lv2/sys_overlay.cpp index bff88aaa00..70745b1446 100644 --- a/rpcs3/Emu/Cell/lv2/sys_overlay.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_overlay.cpp @@ -33,7 +33,7 @@ static error_code overlay_load_module(vm::ptr ovlmid, const std::string& vp src = std::move(lv2_file); } - u128 klic = g_fxo->get()->devKlic.load(); + u128 klic = g_fxo->get().devKlic.load(); ppu_exec_object obj = decrypt_self(std::move(src), reinterpret_cast(&klic)); diff --git a/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp b/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp index 349616aa3b..b860fddb1b 100644 --- a/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp @@ -1,6 +1,7 @@ #include "stdafx.h" #include "sys_ppu_thread.h" +#include "Emu/System.h" #include "Emu/IdManager.h" #include "Emu/perf_meter.hpp" @@ -48,13 +49,13 @@ struct ppu_thread_cleaner bool ppu_thread_exit(ppu_thread& ppu) { ppu.state += cpu_flag::exit + cpu_flag::wait; - + // Deallocate Stack Area ensure(vm::dealloc(ppu.stack_addr, vm::stack) == ppu.stack_size); - if (const auto dct = g_fxo->get()) + if (auto& dct = g_fxo->get(); !Emu.IsStopped()) { - dct->used -= ppu.stack_size; + dct.used -= ppu.stack_size; } return false; @@ -99,7 +100,7 @@ void _sys_ppu_thread_exit(ppu_thread& ppu, u64 errorcode) ppu.state -= cpu_flag::suspend; } - g_fxo->get()->clean(old_status == ppu_join_status::detached ? ppu.id : 0); + g_fxo->get().clean(old_status == ppu_join_status::detached ? ppu.id : 0); while (ppu.joiner == ppu_join_status::zombie && !ppu.is_stopped()) { @@ -127,7 +128,7 @@ error_code sys_ppu_thread_join(ppu_thread& ppu, u32 thread_id, vm::ptr vptr sys_ppu_thread.trace("sys_ppu_thread_join(thread_id=0x%x, vptr=*0x%x)", thread_id, vptr); // Clean some detached thread (hack) - g_fxo->get()->clean(0); + g_fxo->get().clean(0); auto thread = idm::get>(thread_id, [&](ppu_thread& thread) -> CellError { @@ -210,7 +211,7 @@ error_code sys_ppu_thread_detach(ppu_thread& ppu, u32 thread_id) sys_ppu_thread.trace("sys_ppu_thread_detach(thread_id=0x%x)", thread_id); // Clean some detached thread (hack) - g_fxo->get()->clean(0); + g_fxo->get().clean(0); const auto thread = idm::check>(thread_id, [&](ppu_thread& thread) -> CellError { @@ -261,8 +262,8 @@ error_code sys_ppu_thread_detach(ppu_thread& ppu, u32 thread_id) if (thread.ret == CELL_EAGAIN) { - g_fxo->get()->clean(thread_id); - g_fxo->get()->clean(0); + g_fxo->get().clean(thread_id); + g_fxo->get().clean(0); } return CELL_OK; @@ -293,7 +294,7 @@ error_code sys_ppu_thread_set_priority(ppu_thread& ppu, u32 thread_id, s32 prio) } // Clean some detached thread (hack) - g_fxo->get()->clean(0); + g_fxo->get().clean(0); const auto thread = idm::check>(thread_id, [&](ppu_thread& thread) { @@ -325,7 +326,7 @@ error_code sys_ppu_thread_get_priority(ppu_thread& ppu, u32 thread_id, vm::ptrget()->clean(0); + g_fxo->get().clean(0); u32 prio; @@ -426,15 +427,15 @@ error_code _sys_ppu_thread_create(ppu_thread& ppu, vm::ptr thread_id, vm::p const u32 tls = param->tls; // Clean some detached thread (hack) - g_fxo->get()->clean(0); + g_fxo->get().clean(0); // Compute actual stack size and allocate const u32 stack_size = utils::align(std::max(_stacksz, 4096), 4096); - const auto dct = g_fxo->get(); + auto& dct = g_fxo->get(); // Try to obtain "physical memory" from the default container - if (!dct->take(stack_size)) + if (!dct.take(stack_size)) { return CELL_ENOMEM; } @@ -443,7 +444,7 @@ error_code _sys_ppu_thread_create(ppu_thread& ppu, vm::ptr thread_id, vm::p if (!stack_base) { - dct->used -= stack_size; + dct.used -= stack_size; return CELL_ENOMEM; } @@ -484,7 +485,7 @@ error_code _sys_ppu_thread_create(ppu_thread& ppu, vm::ptr thread_id, vm::p if (!tid) { vm::dealloc(stack_base); - dct->used -= stack_size; + dct.used -= stack_size; return CELL_EAGAIN; } @@ -634,11 +635,11 @@ error_code sys_ppu_thread_get_page_fault_context(ppu_thread& ppu, u32 thread_id, } // We can only get a context if the thread is being suspended for a page fault. - auto pf_events = g_fxo->get(); - reader_lock lock(pf_events->pf_mutex); + auto& pf_events = g_fxo->get(); + reader_lock lock(pf_events.pf_mutex); - const auto evt = pf_events->events.find(thread.ptr.get()); - if (evt == pf_events->events.end()) + const auto evt = pf_events.events.find(thread.ptr.get()); + if (evt == pf_events.events.end()) { return CELL_EINVAL; } diff --git a/rpcs3/Emu/Cell/lv2/sys_process.cpp b/rpcs3/Emu/Cell/lv2/sys_process.cpp index 5f10589207..d744521d1a 100644 --- a/rpcs3/Emu/Cell/lv2/sys_process.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_process.cpp @@ -401,7 +401,7 @@ void _sys_process_exit2(ppu_thread& ppu, s32 status, vm::ptr ar if (disc.empty() && !Emu.GetTitleID().empty()) disc = vfs::get(Emu.GetDir()); - Emu.CallAfter([path = std::move(path), argv = std::move(argv), envp = std::move(envp), data = std::move(data), disc = std::move(disc), hdd1 = std::move(hdd1), klic = g_fxo->get()->devKlic.load()]() mutable + Emu.CallAfter([path = std::move(path), argv = std::move(argv), envp = std::move(envp), data = std::move(data), disc = std::move(disc), hdd1 = std::move(hdd1), klic = g_fxo->get().devKlic.load()]() mutable { sys_process.success("Process finished -> %s", argv[0]); Emu.SetForceBoot(true); diff --git a/rpcs3/Emu/Cell/lv2/sys_prx.cpp b/rpcs3/Emu/Cell/lv2/sys_prx.cpp index 4d54456a77..09047628e2 100644 --- a/rpcs3/Emu/Cell/lv2/sys_prx.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_prx.cpp @@ -264,7 +264,7 @@ static error_code prx_load_module(const std::string& vpath, u64 flags, vm::ptrget()->devKlic.load(); + u128 klic = g_fxo->get().devKlic.load(); ppu_prx_object obj = decrypt_self(std::move(src), reinterpret_cast(&klic)); diff --git a/rpcs3/Emu/Cell/lv2/sys_rsx.cpp b/rpcs3/Emu/Cell/lv2/sys_rsx.cpp index 1442dc9be8..d51585b0c6 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rsx.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_rsx.cpp @@ -118,7 +118,7 @@ error_code sys_rsx_memory_allocate(cpu_thread& cpu, vm::ptr mem_handle, vm: if (u32 addr = vm::falloc(rsx::constants::local_mem_base, size, vm::video)) { - g_fxo->get()->memory_size = size; + g_fxo->get().memory_size = size; *mem_addr = addr; *mem_handle = 0x5a5a5a5b; return CELL_OK; @@ -142,7 +142,7 @@ error_code sys_rsx_memory_free(cpu_thread& cpu, u32 mem_handle) return CELL_ENOMEM; } - if (g_fxo->get()->context_base) + if (g_fxo->get().context_base) { fmt::throw_exception("Attempting to dealloc rsx memory when the context is still being used"); } @@ -176,11 +176,11 @@ error_code sys_rsx_context_allocate(cpu_thread& cpu, vm::ptr context_id, vm return CELL_EINVAL; } - auto rsx_cfg = g_fxo->get(); + auto& rsx_cfg = g_fxo->get(); - std::lock_guard lock(rsx_cfg->mutex); + std::lock_guard lock(rsx_cfg.mutex); - if (rsx_cfg->context_base) + if (rsx_cfg.context_base) { // We currently do not support multiple contexts fmt::throw_exception("sys_rsx_context_allocate was called twice"); @@ -225,7 +225,7 @@ error_code sys_rsx_context_allocate(cpu_thread& cpu, vm::ptr context_id, vm driverInfo.version_driver = 0x211; driverInfo.version_gpu = 0x5c; - driverInfo.memory_size = rsx_cfg->memory_size; + driverInfo.memory_size = rsx_cfg.memory_size; driverInfo.nvcore_frequency = 500000000; // 0x1DCD6500 driverInfo.memory_frequency = 650000000; // 0x26BE3680 driverInfo.reportsNotifyOffset = 0x1000; @@ -234,7 +234,7 @@ error_code sys_rsx_context_allocate(cpu_thread& cpu, vm::ptr context_id, vm driverInfo.systemModeFlags = static_cast(system_mode); driverInfo.hardware_channel = 1; // * i think* this 1 for games, 0 for vsh - rsx_cfg->driver_info = vm::cast(*lpar_driver_info); + rsx_cfg.driver_info = vm::cast(*lpar_driver_info); auto &dmaControl = vm::_ref(vm::cast(*lpar_dma_control)); dmaControl.get = 0; @@ -253,21 +253,21 @@ error_code sys_rsx_context_allocate(cpu_thread& cpu, vm::ptr context_id, vm attr->name_u64 = 0; sys_event_port_create(cpu, vm::get_addr(&driverInfo.handler_queue), SYS_EVENT_PORT_LOCAL, 0); - rsx_cfg->rsx_event_port = driverInfo.handler_queue; + rsx_cfg.rsx_event_port = driverInfo.handler_queue; sys_event_queue_create(cpu, vm::get_addr(&driverInfo.handler_queue), attr, 0, 0x20); - sys_event_port_connect_local(cpu, rsx_cfg->rsx_event_port, driverInfo.handler_queue); + sys_event_port_connect_local(cpu, rsx_cfg.rsx_event_port, driverInfo.handler_queue); - rsx_cfg->dma_address = vm::cast(*lpar_dma_control); + rsx_cfg.dma_address = vm::cast(*lpar_dma_control); const auto render = rsx::get_current_renderer(); render->display_buffers_count = 0; render->current_display_buffer = 0; render->label_addr = vm::cast(*lpar_reports); - render->device_addr = rsx_cfg->device_addr; - render->local_mem_size = rsx_cfg->memory_size; + render->device_addr = rsx_cfg.device_addr; + render->local_mem_size = rsx_cfg.memory_size; render->init(vm::cast(*lpar_dma_control)); - rsx_cfg->context_base = context_base; + rsx_cfg.context_base = context_base; *context_id = 0x55555555; return CELL_OK; @@ -283,11 +283,11 @@ error_code sys_rsx_context_free(cpu_thread& cpu, u32 context_id) sys_rsx.todo("sys_rsx_context_free(context_id=0x%x)", context_id); - auto rsx_cfg = g_fxo->get(); + auto& rsx_cfg = g_fxo->get(); - std::scoped_lock lock(rsx_cfg->mutex); + std::scoped_lock lock(rsx_cfg.mutex); - if (context_id != 0x55555555 || !rsx_cfg->context_base) + if (context_id != 0x55555555 || !rsx_cfg.context_base) { return CELL_EINVAL; } @@ -338,7 +338,7 @@ error_code sys_rsx_context_iomap(cpu_thread& cpu, u32 context_id, u32 io, u32 ea io >>= 20, ea >>= 20, size >>= 20; render->pause(); - std::scoped_lock lock(g_fxo->get()->mutex); + std::scoped_lock lock(g_fxo->get().mutex); for (u32 i = 0; i < size; i++) { @@ -382,7 +382,7 @@ error_code sys_rsx_context_iounmap(cpu_thread& cpu, u32 context_id, u32 io, u32 vm::reader_lock rlock; - std::scoped_lock lock(g_fxo->get()->mutex); + std::scoped_lock lock(g_fxo->get().mutex); for (const u32 end = (io >>= 20) + (size >>= 20); io < end;) { @@ -422,15 +422,15 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 const auto render = rsx::get_current_renderer(); - auto rsx_cfg = g_fxo->get(); + auto& rsx_cfg = g_fxo->get(); - if (!rsx_cfg->context_base || context_id != 0x55555555) + if (!rsx_cfg.context_base || context_id != 0x55555555) { sys_rsx.error("sys_rsx_context_attribute(): invalid context failure (context_id=0x%x)", context_id); return CELL_OK; // Actually returns CELL_OK, cellGCmSys seem to be relying on this as well } - auto &driverInfo = vm::_ref(rsx_cfg->driver_info); + auto &driverInfo = vm::_ref(rsx_cfg.driver_info); switch (package_id) { case 0x001: // FIFO @@ -438,7 +438,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 render->pause(); const u64 get = static_cast(a3); const u64 put = static_cast(a4); - vm::_ref>(rsx_cfg->dma_address + ::offset32(&RsxDmaControl::put)).release(put << 32 | get); + vm::_ref>(rsx_cfg.dma_address + ::offset32(&RsxDmaControl::put)).release(put << 32 | get); render->sync_point_request.release(true); render->unpause(); break; @@ -505,7 +505,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 driverInfo.head[a3].lastQueuedBufferId = static_cast(a4); driverInfo.head[a3].flipFlags |= 0x40000000 | (1 << a4); - rsx_cfg->send_event(0, SYS_RSX_EVENT_QUEUE_BASE << a3, 0); + rsx_cfg.send_event(0, SYS_RSX_EVENT_QUEUE_BASE << a3, 0); render->on_frame_end(static_cast(a4)); } @@ -519,7 +519,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 return SYS_RSX_CONTEXT_ATTRIBUTE_ERROR; } - std::lock_guard lock(rsx_cfg->mutex); + std::lock_guard lock(rsx_cfg.mutex); // Note: no error checking is being done @@ -623,7 +623,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 ensure(a5 & (1 << 30)); } - std::lock_guard lock(rsx_cfg->mutex); + std::lock_guard lock(rsx_cfg.mutex); // When tile is going to be unbound, we can use it as a hint that the address will no longer be used as a surface and can be removed/invalidated // Todo: There may be more checks such as format/size/width can could be done @@ -697,7 +697,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 ensure((a6 & 0xFFFFFFFF) == 0u + ((0x2000 << 0) | (0x20 << 16))); } - std::lock_guard lock(rsx_cfg->mutex); + std::lock_guard lock(rsx_cfg.mutex); auto &zcull = render->zculls[a3]; @@ -741,7 +741,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 // seems gcmSysWaitLabel uses this offset, so lets set it to 0 every flip vm::_ref(render->label_addr + 0x10) = 0; - rsx_cfg->send_event(0, SYS_RSX_EVENT_FLIP_BASE << 1, 0); + rsx_cfg.send_event(0, SYS_RSX_EVENT_FLIP_BASE << 1, 0); break; case 0xFED: // hack: vblank command @@ -767,7 +767,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 if (render->enable_second_vhandler) event_flags |= SYS_RSX_EVENT_SECOND_VBLANK_BASE << a3; // second vhandler - rsx_cfg->send_event(0, event_flags, 0); + rsx_cfg.send_event(0, event_flags, 0); break; } @@ -776,7 +776,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 // as i think we need custom lv1 interrupts to handle this accurately // this also should probly be set by rsxthread driverInfo.userCmdParam = static_cast(a4); - rsx_cfg->send_event(0, SYS_RSX_EVENT_USER_CMD, 0); + rsx_cfg.send_event(0, SYS_RSX_EVENT_USER_CMD, 0); break; default: @@ -803,12 +803,12 @@ error_code sys_rsx_device_map(cpu_thread& cpu, vm::ptr dev_addr, vm::ptrget(); + auto& rsx_cfg = g_fxo->get(); static shared_mutex device_map_mtx; std::scoped_lock lock(device_map_mtx); - if (!rsx_cfg->device_addr) + if (!rsx_cfg.device_addr) { const auto area = vm::reserve_map(vm::rsx_context, 0, 0x10000000, 0x403); const u32 addr = area ? area->alloc(0x100000) : 0; @@ -819,11 +819,11 @@ error_code sys_rsx_device_map(cpu_thread& cpu, vm::ptr dev_addr, vm::ptrdevice_addr = addr; + rsx_cfg.device_addr = addr; return CELL_OK; } - *dev_addr = rsx_cfg->device_addr; + *dev_addr = rsx_cfg.device_addr; return CELL_OK; } diff --git a/rpcs3/Emu/Cell/lv2/sys_spu.cpp b/rpcs3/Emu/Cell/lv2/sys_spu.cpp index c13c63642f..4beac51415 100644 --- a/rpcs3/Emu/Cell/lv2/sys_spu.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_spu.cpp @@ -168,12 +168,12 @@ void sys_spu_image::deploy(u8* loc, sys_spu_segment* segs, u32 nsegs) } // Apply the patch - auto applied = g_fxo->get()->apply(hash, loc); + auto applied = g_fxo->get().apply(hash, loc); if (!Emu.GetTitleID().empty()) { // Alternative patch - applied += g_fxo->get()->apply(Emu.GetTitleID() + '-' + hash, loc); + applied += g_fxo->get().apply(Emu.GetTitleID() + '-' + hash, loc); } spu_log.notice("Loaded SPU image: %s (<- %u)%s", hash, applied.size(), dump); @@ -252,7 +252,7 @@ error_code sys_spu_image_open(ppu_thread& ppu, vm::ptr img, vm::c return {fs_error, path}; } - u128 klic = g_fxo->get()->devKlic.load(); + u128 klic = g_fxo->get().devKlic.load(); const fs::file elf_file = decrypt_self(std::move(file), reinterpret_cast(&klic)); @@ -623,7 +623,7 @@ error_code sys_spu_thread_group_create(ppu_thread& ppu, vm::ptr id, u32 num } else { - ct = g_fxo->get(); + ct = &g_fxo->get(); if (ct->take(mem_size) != mem_size) { @@ -1771,7 +1771,7 @@ error_code sys_spu_thread_group_log(ppu_thread& ppu, s32 command, vm::ptr s atomic_t state = SYS_SPU_THREAD_GROUP_LOG_ON; }; - const auto state = g_fxo->get(); + auto& state = g_fxo->get(); switch (command) { @@ -1782,13 +1782,13 @@ error_code sys_spu_thread_group_log(ppu_thread& ppu, s32 command, vm::ptr s return CELL_EFAULT; } - *stat = state->state; + *stat = state.state; break; } case SYS_SPU_THREAD_GROUP_LOG_ON: case SYS_SPU_THREAD_GROUP_LOG_OFF: { - state->state.release(command); + state.state.release(command); break; } default: return CELL_EINVAL; diff --git a/rpcs3/Emu/Cell/lv2/sys_usbd.cpp b/rpcs3/Emu/Cell/lv2/sys_usbd.cpp index 69ac9a26b1..2ec4302703 100644 --- a/rpcs3/Emu/Cell/lv2/sys_usbd.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_usbd.cpp @@ -125,13 +125,13 @@ private: void LIBUSB_CALL callback_transfer(struct libusb_transfer* transfer) { - const auto usbh = g_fxo->get>(); + auto& usbh = g_fxo->get>(); - std::lock_guard lock(usbh->mutex); - if (!usbh->is_init) + std::lock_guard lock(usbh.mutex); + if (!usbh.is_init) return; - usbh->transfer_complete(transfer); + usbh.transfer_complete(transfer); } usb_handler_thread::usb_handler_thread() @@ -481,12 +481,12 @@ error_code sys_usbd_initialize(ppu_thread& ppu, vm::ptr handle) sys_usbd.warning("sys_usbd_initialize(handle=*0x%x)", handle); - const auto usbh = g_fxo->get>(); + auto& usbh = g_fxo->get>(); - std::lock_guard lock(usbh->mutex); + std::lock_guard lock(usbh.mutex); // Must not occur (lv2 allows multiple handles, cellUsbd does not) - ensure(!usbh->is_init.exchange(true)); + ensure(!usbh.is_init.exchange(true)); *handle = 0x115B; @@ -500,13 +500,13 @@ error_code sys_usbd_finalize(ppu_thread& ppu, u32 handle) sys_usbd.warning("sys_usbd_finalize(handle=0x%x)", handle); - const auto usbh = g_fxo->get>(); + auto& usbh = g_fxo->get>(); - std::lock_guard lock(usbh->mutex); - usbh->is_init = false; + std::lock_guard lock(usbh.mutex); + usbh.is_init = false; // Forcefully awake all waiters - for (auto& cpu : ::as_rvalue(std::move(usbh->sq))) + for (auto& cpu : ::as_rvalue(std::move(usbh.sq))) { // Special ternimation signal value cpu->gpr[4] = 4; @@ -525,18 +525,18 @@ error_code sys_usbd_get_device_list(ppu_thread& ppu, u32 handle, vm::ptrget>(); + auto& usbh = g_fxo->get>(); - std::lock_guard lock(usbh->mutex); - if (!usbh->is_init) + std::lock_guard lock(usbh.mutex); + if (!usbh.is_init) return CELL_EINVAL; // TODO: was std::min - u32 i_tocopy = std::min(max_devices, ::size32(usbh->handled_devices)); + u32 i_tocopy = std::min(max_devices, ::size32(usbh.handled_devices)); for (u32 index = 0; index < i_tocopy; index++) { - device_list[index] = usbh->handled_devices[index].first; + device_list[index] = usbh.handled_devices[index].first; } return not_an_error(i_tocopy); @@ -549,14 +549,14 @@ error_code sys_usbd_register_extra_ldd(ppu_thread& ppu, u32 handle, vm::ptrget>(); + auto& usbh = g_fxo->get>(); - std::lock_guard lock(usbh->mutex); - if (!usbh->is_init) + std::lock_guard lock(usbh.mutex); + if (!usbh.is_init) return CELL_EINVAL; - s32 res = usbh->add_ldd(s_product, slen_product, id_vendor, id_product_min, id_product_max); - usbh->check_devices_vs_ldds(); + s32 res = usbh.add_ldd(s_product, slen_product, id_vendor, id_product_min, id_product_max); + usbh.check_devices_vs_ldds(); return not_an_error(res); // To check } @@ -567,16 +567,16 @@ error_code sys_usbd_get_descriptor_size(ppu_thread& ppu, u32 handle, u32 device_ sys_usbd.trace("sys_usbd_get_descriptor_size(handle=0x%x, deviceNumber=0x%x)", handle, device_handle); - const auto usbh = g_fxo->get>(); + auto& usbh = g_fxo->get>(); - std::lock_guard lock(usbh->mutex); + std::lock_guard lock(usbh.mutex); - if (!usbh->is_init || !usbh->handled_devices.count(device_handle)) + if (!usbh.is_init || !usbh.handled_devices.count(device_handle)) { return CELL_EINVAL; } - return not_an_error(usbh->handled_devices[device_handle].second->device.get_size()); + return not_an_error(usbh.handled_devices[device_handle].second->device.get_size()); } error_code sys_usbd_get_descriptor(ppu_thread& ppu, u32 handle, u32 device_handle, vm::ptr descriptor, u32 desc_size) @@ -585,17 +585,17 @@ error_code sys_usbd_get_descriptor(ppu_thread& ppu, u32 handle, u32 device_handl sys_usbd.trace("sys_usbd_get_descriptor(handle=0x%x, deviceNumber=0x%x, descriptor=0x%x, desc_size=0x%x)", handle, device_handle, descriptor, desc_size); - const auto usbh = g_fxo->get>(); + auto& usbh = g_fxo->get>(); - std::lock_guard lock(usbh->mutex); + std::lock_guard lock(usbh.mutex); - if (!usbh->is_init || !usbh->handled_devices.count(device_handle)) + if (!usbh.is_init || !usbh.handled_devices.count(device_handle)) { return CELL_EINVAL; } u8* ptr = static_cast(descriptor.get_ptr()); - usbh->handled_devices[device_handle].second->device.write_data(ptr); + usbh.handled_devices[device_handle].second->device.write_data(ptr); return CELL_OK; } @@ -634,16 +634,16 @@ error_code sys_usbd_open_pipe(ppu_thread& ppu, u32 handle, u32 device_handle, u3 sys_usbd.warning("sys_usbd_open_pipe(handle=0x%x, device_handle=0x%x, unk1=0x%x, unk2=0x%x, unk3=0x%x, endpoint=0x%x, unk4=0x%x)", handle, device_handle, unk1, unk2, unk3, endpoint, unk4); - const auto usbh = g_fxo->get>(); + auto& usbh = g_fxo->get>(); - std::lock_guard lock(usbh->mutex); + std::lock_guard lock(usbh.mutex); - if (!usbh->is_init || !usbh->handled_devices.count(device_handle)) + if (!usbh.is_init || !usbh.handled_devices.count(device_handle)) { return CELL_EINVAL; } - return not_an_error(usbh->open_pipe(device_handle, static_cast(endpoint))); + return not_an_error(usbh.open_pipe(device_handle, static_cast(endpoint))); } error_code sys_usbd_open_default_pipe(ppu_thread& ppu, u32 handle, u32 device_handle) @@ -652,16 +652,16 @@ error_code sys_usbd_open_default_pipe(ppu_thread& ppu, u32 handle, u32 device_ha sys_usbd.trace("sys_usbd_open_default_pipe(handle=0x%x, device_handle=0x%x)", handle, device_handle); - const auto usbh = g_fxo->get>(); + auto& usbh = g_fxo->get>(); - std::lock_guard lock(usbh->mutex); + std::lock_guard lock(usbh.mutex); - if (!usbh->is_init || !usbh->handled_devices.count(device_handle)) + if (!usbh.is_init || !usbh.handled_devices.count(device_handle)) { return CELL_EINVAL; } - return not_an_error(usbh->open_pipe(device_handle, 0)); + return not_an_error(usbh.open_pipe(device_handle, 0)); } error_code sys_usbd_close_pipe(ppu_thread& ppu, u32 handle, u32 pipe_handle) @@ -670,16 +670,16 @@ error_code sys_usbd_close_pipe(ppu_thread& ppu, u32 handle, u32 pipe_handle) sys_usbd.todo("sys_usbd_close_pipe(handle=0x%x, pipe_handle=0x%x)", handle, pipe_handle); - const auto usbh = g_fxo->get>(); + auto& usbh = g_fxo->get>(); - std::lock_guard lock(usbh->mutex); + std::lock_guard lock(usbh.mutex); - if (!usbh->is_init || !usbh->is_pipe(pipe_handle)) + if (!usbh.is_init || !usbh.is_pipe(pipe_handle)) { return CELL_EINVAL; } - usbh->close_pipe(pipe_handle); + usbh.close_pipe(pipe_handle); return CELL_OK; } @@ -696,15 +696,15 @@ error_code sys_usbd_receive_event(ppu_thread& ppu, u32 handle, vm::ptr arg1 sys_usbd.trace("sys_usbd_receive_event(handle=%u, arg1=*0x%x, arg2=*0x%x, arg3=*0x%x)", handle, arg1, arg2, arg3); - const auto usbh = g_fxo->get>(); + auto& usbh = g_fxo->get>(); { - std::lock_guard lock(usbh->mutex); + std::lock_guard lock(usbh.mutex); - if (!usbh->is_init) + if (!usbh.is_init) return CELL_EINVAL; - if (usbh->get_event(arg1, arg2, arg3)) + if (usbh.get_event(arg1, arg2, arg3)) { // hack for Guitar Hero Live // Attaching the device too fast seems to result in a nullptr along the way @@ -715,7 +715,7 @@ error_code sys_usbd_receive_event(ppu_thread& ppu, u32 handle, vm::ptr arg1 } lv2_obj::sleep(ppu); - usbh->sq.emplace_back(&ppu); + usbh.sq.emplace_back(&ppu); } while (auto state = ppu.state.fetch_sub(cpu_flag::signal)) @@ -784,18 +784,18 @@ error_code sys_usbd_transfer_data(ppu_thread& ppu, u32 handle, u32 id_pipe, vm:: } } - const auto usbh = g_fxo->get>(); + auto& usbh = g_fxo->get>(); - std::lock_guard lock(usbh->mutex); + std::lock_guard lock(usbh.mutex); - if (!usbh->is_init || !usbh->is_pipe(id_pipe)) + if (!usbh.is_init || !usbh.is_pipe(id_pipe)) { return CELL_EINVAL; } - u32 id_transfer = usbh->get_free_transfer_id(); - const auto& pipe = usbh->get_pipe(id_pipe); - auto& transfer = usbh->get_transfer(id_transfer); + u32 id_transfer = usbh.get_free_transfer_id(); + const auto& pipe = usbh.get_pipe(id_pipe); + auto& transfer = usbh.get_transfer(id_transfer); // Default endpoint is control endpoint if (pipe.endpoint == 0) @@ -823,7 +823,7 @@ error_code sys_usbd_transfer_data(ppu_thread& ppu, u32 handle, u32 id_pipe, vm:: } if (transfer.fake) - usbh->fake_transfers.push_back(&transfer); + usbh.fake_transfers.push_back(&transfer); // returns an identifier specific to the transfer return not_an_error(id_transfer); @@ -835,18 +835,18 @@ error_code sys_usbd_isochronous_transfer_data(ppu_thread& ppu, u32 handle, u32 i sys_usbd.todo("sys_usbd_isochronous_transfer_data(handle=0x%x, id_pipe=0x%x, iso_request=*0x%x)", handle, id_pipe, iso_request); - const auto usbh = g_fxo->get>(); + auto& usbh = g_fxo->get>(); - std::lock_guard lock(usbh->mutex); + std::lock_guard lock(usbh.mutex); - if (!usbh->is_init || !usbh->is_pipe(id_pipe)) + if (!usbh.is_init || !usbh.is_pipe(id_pipe)) { return CELL_EINVAL; } - u32 id_transfer = usbh->get_free_transfer_id(); - const auto& pipe = usbh->get_pipe(id_pipe); - auto& transfer = usbh->get_transfer(id_transfer); + u32 id_transfer = usbh.get_free_transfer_id(); + const auto& pipe = usbh.get_pipe(id_pipe); + auto& transfer = usbh.get_transfer(id_transfer); memcpy(&transfer.iso_request, iso_request.get_ptr(), sizeof(UsbDeviceIsoRequest)); pipe.device->isochronous_transfer(&transfer); @@ -861,14 +861,14 @@ error_code sys_usbd_get_transfer_status(ppu_thread& ppu, u32 handle, u32 id_tran sys_usbd.trace("sys_usbd_get_transfer_status(handle=0x%x, id_transfer=0x%x, unk1=0x%x, result=*0x%x, count=*0x%x)", handle, id_transfer, unk1, result, count); - const auto usbh = g_fxo->get>(); + auto& usbh = g_fxo->get>(); - std::lock_guard lock(usbh->mutex); + std::lock_guard lock(usbh.mutex); - if (!usbh->is_init) + if (!usbh.is_init) return CELL_EINVAL; - auto& transfer = usbh->get_transfer(id_transfer); + auto& transfer = usbh.get_transfer(id_transfer); *result = transfer.result; *count = transfer.count; @@ -882,14 +882,14 @@ error_code sys_usbd_get_isochronous_transfer_status(ppu_thread& ppu, u32 handle, sys_usbd.todo("sys_usbd_get_isochronous_transfer_status(handle=0x%x, id_transfer=0x%x, unk1=0x%x, request=*0x%x, result=*0x%x)", handle, id_transfer, unk1, request, result); - const auto usbh = g_fxo->get>(); + auto& usbh = g_fxo->get>(); - std::lock_guard lock(usbh->mutex); + std::lock_guard lock(usbh.mutex); - if (!usbh->is_init) + if (!usbh.is_init) return CELL_EINVAL; - auto& transfer = usbh->get_transfer(id_transfer); + auto& transfer = usbh.get_transfer(id_transfer); *result = transfer.result; memcpy(request.get_ptr(), &transfer.iso_request, sizeof(UsbDeviceIsoRequest)); @@ -919,14 +919,14 @@ error_code sys_usbd_event_port_send(ppu_thread& ppu, u32 handle, u64 arg1, u64 a sys_usbd.warning("sys_usbd_event_port_send(handle=0x%x, arg1=0x%x, arg2=0x%x, arg3=0x%x)", handle, arg1, arg2, arg3); - const auto usbh = g_fxo->get>(); + auto& usbh = g_fxo->get>(); - std::lock_guard lock(usbh->mutex); + std::lock_guard lock(usbh.mutex); - if (!usbh->is_init) + if (!usbh.is_init) return CELL_EINVAL; - usbh->add_event(arg1, arg2, arg3); + usbh.add_event(arg1, arg2, arg3); return CELL_OK; } diff --git a/rpcs3/Emu/Cell/lv2/sys_vm.cpp b/rpcs3/Emu/Cell/lv2/sys_vm.cpp index 06a231eef3..a5413428d0 100644 --- a/rpcs3/Emu/Cell/lv2/sys_vm.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_vm.cpp @@ -44,14 +44,14 @@ error_code sys_vm_memory_map(ppu_thread& ppu, u32 vsize, u32 psize, u32 cid, u64 const auto idm_ct = idm::get(cid); - const auto ct = cid == SYS_MEMORY_CONTAINER_ID_INVALID ? g_fxo->get() : idm_ct.get(); + const auto ct = cid == SYS_MEMORY_CONTAINER_ID_INVALID ? &g_fxo->get() : idm_ct.get(); if (!ct) { return CELL_ESRCH; } - if (!g_fxo->get()->total_vsize.fetch_op([vsize](u32& size) + if (!g_fxo->get().total_vsize.fetch_op([vsize](u32& size) { // A single process can hold up to 256MB of virtual memory, even on DECR if (0x10000000 - size < vsize) @@ -68,7 +68,7 @@ error_code sys_vm_memory_map(ppu_thread& ppu, u32 vsize, u32 psize, u32 cid, u64 if (!ct->take(psize)) { - g_fxo->get()->total_vsize -= vsize; + g_fxo->get().total_vsize -= vsize; return CELL_ENOMEM; } @@ -87,7 +87,7 @@ error_code sys_vm_memory_map(ppu_thread& ppu, u32 vsize, u32 psize, u32 cid, u64 } ct->used -= psize; - g_fxo->get()->total_vsize -= vsize; + g_fxo->get().total_vsize -= vsize; return CELL_ENOMEM; } @@ -121,7 +121,7 @@ error_code sys_vm_unmap(ppu_thread& ppu, u32 addr) // Return memory vmo.ct->used -= vmo.psize; - g_fxo->get()->total_vsize -= vmo.size; + g_fxo->get().total_vsize -= vmo.size; }); if (!vmo) diff --git a/rpcs3/Emu/Memory/vm.cpp b/rpcs3/Emu/Memory/vm.cpp index e2c1ed43ec..e632da4cb7 100644 --- a/rpcs3/Emu/Memory/vm.cpp +++ b/rpcs3/Emu/Memory/vm.cpp @@ -906,9 +906,9 @@ namespace vm // Notify rsx to invalidate range // Note: This must be done *before* memory gets unmapped while holding the vm lock, otherwise // the RSX might try to call VirtualProtect on memory that is already unmapped - if (const auto rsxthr = g_fxo->get(); g_fxo->is_init()) + if (auto& rsxthr = g_fxo->get(); g_fxo->is_init()) { - rsxthr->on_notify_memory_unmapped(addr, size); + rsxthr.on_notify_memory_unmapped(addr, size); } // Actually unmap memory diff --git a/rpcs3/Emu/NP/np_handler.cpp b/rpcs3/Emu/NP/np_handler.cpp index 024fb5b840..b39b8bece5 100644 --- a/rpcs3/Emu/NP/np_handler.cpp +++ b/rpcs3/Emu/NP/np_handler.cpp @@ -325,8 +325,8 @@ void np_handler::init_NP(u32 poolsize, vm::ptr poolptr) ensure(!s_npid.empty()); // It should have been generated before this np_handler::string_to_npid(s_npid, &npid); - const auto sigh = g_fxo->get>(); - sigh->set_self_sig_info(npid); + auto& sigh = g_fxo->get>(); + sigh.set_self_sig_info(npid); } switch (g_cfg.net.psn_status) @@ -462,7 +462,8 @@ u32 np_handler::get_server_status(SceNpMatching2ContextId ctx_id, vm::cptr s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { cb_info.cb(cb_ppu, cb_info.ctx_id, req_id, SCE_NP_MATCHING2_REQUEST_EVENT_GetServerInfo, event_key, 0, sizeof(SceNpMatching2GetServerInfoResponse), cb_info.cb_arg); return 0; }); @@ -478,7 +479,8 @@ u32 np_handler::create_server_context(SceNpMatching2ContextId ctx_id, vm::cptr s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { cb_info.cb(cb_ppu, cb_info.ctx_id, req_id, SCE_NP_MATCHING2_REQUEST_EVENT_CreateServerContext, event_key, 0, 0, cb_info.cb_arg); return 0; }); @@ -759,7 +761,8 @@ bool np_handler::reply_get_world_list(u32 req_id, std::vector& reply_data) } } - sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { cb_info.cb(cb_ppu, cb_info.ctx_id, req_id, SCE_NP_MATCHING2_REQUEST_EVENT_GetWorldInfoList, event_key, 0, sizeof(SceNpMatching2GetWorldInfoListResponse), cb_info.cb_arg); return 0; }); @@ -792,14 +795,15 @@ bool np_handler::reply_create_join_room(u32 req_id, std::vector& reply_data) RoomDataInternal_to_SceNpMatching2RoomDataInternal(resp, room_info.get_ptr(), npid); // Establish Matching2 self signaling info - const auto sigh = g_fxo->get>(); - sigh->set_self_sig2_info(room_info->roomId, 1); - sigh->set_sig2_infos(room_info->roomId, 1, SCE_NP_SIGNALING_CONN_STATUS_ACTIVE, rpcn.get_addr_sig(), rpcn.get_port_sig(), true); + auto& sigh = g_fxo->get>(); + sigh.set_self_sig2_info(room_info->roomId, 1); + sigh.set_sig2_infos(room_info->roomId, 1, SCE_NP_SIGNALING_CONN_STATUS_ACTIVE, rpcn.get_addr_sig(), rpcn.get_port_sig(), true); // TODO? Should this send a message to Signaling CB? Is this even necessary? extra_nps::print_create_room_resp(room_resp); - sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { cb_info.cb(cb_ppu, cb_info.ctx_id, req_id, SCE_NP_MATCHING2_REQUEST_EVENT_CreateJoinRoom, event_key, 0, sizeof(SceNpMatching2CreateJoinRoomResponse), cb_info.cb_arg); return 0; }); @@ -835,12 +839,13 @@ bool np_handler::reply_join_room(u32 req_id, std::vector& reply_data) extra_nps::print_room_data_internal(room_resp->roomDataInternal.get_ptr()); // Establish Matching2 self signaling info - const auto sigh = g_fxo->get>(); - sigh->set_self_sig2_info(room_info->roomId, member_id); - sigh->set_sig2_infos(room_info->roomId, member_id, SCE_NP_SIGNALING_CONN_STATUS_ACTIVE, rpcn.get_addr_sig(), rpcn.get_port_sig(), true); + auto& sigh = g_fxo->get>(); + sigh.set_self_sig2_info(room_info->roomId, member_id); + sigh.set_sig2_infos(room_info->roomId, member_id, SCE_NP_SIGNALING_CONN_STATUS_ACTIVE, rpcn.get_addr_sig(), rpcn.get_port_sig(), true); // TODO? Should this send a message to Signaling CB? Is this even necessary? - sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { cb_info.cb(cb_ppu, cb_info.ctx_id, req_id, SCE_NP_MATCHING2_REQUEST_EVENT_JoinRoom, event_key, 0, sizeof(SceNpMatching2JoinRoomResponse), cb_info.cb_arg); return 0; }); @@ -864,10 +869,11 @@ bool np_handler::reply_leave_room(u32 req_id, std::vector& reply_data) u32 event_key = get_event_key(); // Unsure if necessary if there is no data // Disconnect all users from that room - const auto sigh = g_fxo->get>(); - sigh->disconnect_sig2_users(room_id); + auto& sigh = g_fxo->get>(); + sigh.disconnect_sig2_users(room_id); - sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { cb_info.cb(cb_ppu, cb_info.ctx_id, req_id, SCE_NP_MATCHING2_REQUEST_EVENT_LeaveRoom, event_key, 0, 0, cb_info.cb_arg); return 0; }); @@ -895,7 +901,8 @@ bool np_handler::reply_search_room(u32 req_id, std::vector& reply_data) SearchRoomReponse_to_SceNpMatching2SearchRoomResponse(resp, search_resp); - sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { cb_info.cb(cb_ppu, cb_info.ctx_id, req_id, SCE_NP_MATCHING2_REQUEST_EVENT_SearchRoom, event_key, 0, sizeof(SceNpMatching2SearchRoomResponse), cb_info.cb_arg); return 0; }); @@ -913,7 +920,8 @@ bool np_handler::reply_set_roomdata_external(u32 req_id, std::vector& reply_ u32 event_key = get_event_key(); // Unsure if necessary if there is no data - sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { cb_info.cb(cb_ppu, cb_info.ctx_id, req_id, SCE_NP_MATCHING2_REQUEST_EVENT_SetRoomDataExternal, event_key, 0, 0, cb_info.cb_arg); return 0; }); @@ -946,7 +954,8 @@ bool np_handler::reply_get_roomdata_internal(u32 req_id, std::vector& reply_ extra_nps::print_room_data_internal(room_resp->roomDataInternal.get_ptr()); - sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { cb_info.cb(cb_ppu, cb_info.ctx_id, req_id, SCE_NP_MATCHING2_REQUEST_EVENT_GetRoomDataInternal, event_key, 0, sizeof(SceNpMatching2GetRoomDataInternalResponse), cb_info.cb_arg); return 0; }); @@ -964,7 +973,8 @@ bool np_handler::reply_set_roomdata_internal(u32 req_id, std::vector& reply_ u32 event_key = get_event_key(); // Unsure if necessary if there is no data - sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { cb_info.cb(cb_ppu, cb_info.ctx_id, req_id, SCE_NP_MATCHING2_REQUEST_EVENT_SetRoomDataInternal, event_key, 0, 0, cb_info.cb_arg); return 0; }); @@ -993,7 +1003,8 @@ bool np_handler::reply_get_ping_info(u32 req_id, std::vector& reply_data) SceNpMatching2SignalingGetPingInfoResponse* final_ping_resp = reinterpret_cast(allocate_req_result(event_key, sizeof(SceNpMatching2SignalingGetPingInfoResponse))); GetPingInfoResponse_to_SceNpMatching2SignalingGetPingInfoResponse(resp, final_ping_resp); - sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { cb_info.cb(cb_ppu, cb_info.ctx_id, req_id, SCE_NP_MATCHING2_REQUEST_EVENT_SignalingGetPingInfo, event_key, 0, sizeof(SceNpMatching2SignalingGetPingInfoResponse), cb_info.cb_arg); return 0; }); @@ -1009,7 +1020,8 @@ bool np_handler::reply_send_room_message(u32 req_id, std::vector& reply_data const auto cb_info = std::move(pending_requests.at(req_id)); pending_requests.erase(req_id); - sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 + { cb_info.cb(cb_ppu, cb_info.ctx_id, req_id, SCE_NP_MATCHING2_REQUEST_EVENT_SendRoomMessage, 0, 0, 0, cb_info.cb_arg); return 0; }); @@ -1032,8 +1044,8 @@ bool np_handler::reply_req_sign_infos(u32 req_id, std::vector& reply_data) if (reply.is_error()) return error_and_disconnect("Malformed reply to RequestSignalingInfos command"); - const auto sigh = g_fxo->get>(); - sigh->start_sig(conn_id, addr, port); + auto& sigh = g_fxo->get>(); + sigh.start_sig(conn_id, addr, port); return true; } @@ -1082,7 +1094,8 @@ void np_handler::notif_user_joined_room(std::vector& data) rpcn_log.notice("Received notification that user %s(%d) joined the room(%d)", notif_data->roomMemberDataInternal->userInfo.npId.handle.data, notif_data->roomMemberDataInternal->memberId, room_id); extra_nps::print_room_member_data_internal(notif_data->roomMemberDataInternal.get_ptr()); - sysutil_register_cb([room_event_cb = this->room_event_cb, room_id, event_key, room_event_cb_ctx = this->room_event_cb_ctx, room_event_cb_arg = this->room_event_cb_arg](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([room_event_cb = this->room_event_cb, room_id, event_key, room_event_cb_ctx = this->room_event_cb_ctx, room_event_cb_arg = this->room_event_cb_arg](ppu_thread& cb_ppu) -> s32 + { room_event_cb(cb_ppu, room_event_cb_ctx, room_id, SCE_NP_MATCHING2_ROOM_EVENT_MemberJoined, event_key, 0, sizeof(SceNpMatching2RoomMemberUpdateInfo), room_event_cb_arg); return 0; }); @@ -1109,7 +1122,8 @@ void np_handler::notif_user_left_room(std::vector& data) rpcn_log.notice("Received notification that user %s(%d) left the room(%d)", notif_data->roomMemberDataInternal->userInfo.npId.handle.data, notif_data->roomMemberDataInternal->memberId, room_id); extra_nps::print_room_member_data_internal(notif_data->roomMemberDataInternal.get_ptr()); - sysutil_register_cb([room_event_cb = this->room_event_cb, room_event_cb_ctx = this->room_event_cb_ctx, room_id, event_key, room_event_cb_arg = this->room_event_cb_arg](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([room_event_cb = this->room_event_cb, room_event_cb_ctx = this->room_event_cb_ctx, room_id, event_key, room_event_cb_arg = this->room_event_cb_arg](ppu_thread& cb_ppu) -> s32 + { room_event_cb(cb_ppu, room_event_cb_ctx, room_id, SCE_NP_MATCHING2_ROOM_EVENT_MemberLeft, event_key, 0, sizeof(SceNpMatching2RoomMemberUpdateInfo), room_event_cb_arg); return 0; }); @@ -1135,10 +1149,11 @@ void np_handler::notif_room_destroyed(std::vector& data) rpcn_log.notice("Received notification that room(%d) was destroyed", room_id); - const auto sigh = g_fxo->get>(); - sigh->disconnect_sig2_users(room_id); + auto& sigh = g_fxo->get>(); + sigh.disconnect_sig2_users(room_id); - sysutil_register_cb([room_event_cb = this->room_event_cb, room_event_cb_ctx = this->room_event_cb_ctx, room_id, event_key, room_event_cb_arg = this->room_event_cb_arg](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([room_event_cb = this->room_event_cb, room_event_cb_ctx = this->room_event_cb_ctx, room_id, event_key, room_event_cb_arg = this->room_event_cb_arg](ppu_thread& cb_ppu) -> s32 + { room_event_cb(cb_ppu, room_event_cb_ctx, room_id, SCE_NP_MATCHING2_ROOM_EVENT_RoomDestroyed, event_key, 0, sizeof(SceNpMatching2RoomUpdateInfo), room_event_cb_arg); return 0; }); @@ -1160,9 +1175,9 @@ void np_handler::notif_p2p_connect(std::vector& data) rpcn_log.notice("Received notification to connect to member(%d) of room(%d): %s:%d", member_id, room_id, ip_to_string(addr_p2p), port_p2p); // Attempt Signaling - const auto sigh = g_fxo->get>(); - sigh->set_sig2_infos(room_id, member_id, SCE_NP_SIGNALING_CONN_STATUS_PENDING, addr_p2p, port_p2p); - sigh->start_sig2(room_id, member_id); + auto& sigh = g_fxo->get>(); + sigh.set_sig2_infos(room_id, member_id, SCE_NP_SIGNALING_CONN_STATUS_PENDING, addr_p2p, port_p2p); + sigh.start_sig2(room_id, member_id); } void np_handler::notif_room_message_received(std::vector& data) @@ -1363,7 +1378,8 @@ u32 np_handler::add_players_to_history(vm::cptr npids, u32 count) // if (basic_handler) // { - // sysutil_register_cb([basic_handler = this->basic_handler, req_id, basic_handler_arg = this->basic_handler_arg](ppu_thread& cb_ppu) -> s32 { + // sysutil_register_cb([basic_handler = this->basic_handler, req_id, basic_handler_arg = this->basic_handler_arg](ppu_thread& cb_ppu) -> s32 + // { // basic_handler(cb_ppu, SCE_NP_BASIC_EVENT_ADD_PLAYERS_HISTORY_RESULT, 0, req_id, basic_handler_arg); // return 0; // }); diff --git a/rpcs3/Emu/NP/signaling_handler.cpp b/rpcs3/Emu/NP/signaling_handler.cpp index 9e0bfed0c5..7a289d6d74 100644 --- a/rpcs3/Emu/NP/signaling_handler.cpp +++ b/rpcs3/Emu/NP/signaling_handler.cpp @@ -70,7 +70,8 @@ void signaling_handler::signal_sig_callback(u32 conn_id, int event) { if (sig_cb) { - sysutil_register_cb([sig_cb = this->sig_cb, sig_cb_ctx = this->sig_cb_ctx, conn_id, event, sig_cb_arg = this->sig_cb_arg](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([sig_cb = this->sig_cb, sig_cb_ctx = this->sig_cb_ctx, conn_id, event, sig_cb_arg = this->sig_cb_arg](ppu_thread& cb_ppu) -> s32 + { sig_cb(cb_ppu, sig_cb_ctx, conn_id, event, 0, sig_cb_arg); return 0; }); @@ -85,7 +86,8 @@ void signaling_handler::signal_ext_sig_callback(u32 conn_id, int event) { if (sig_ext_cb) { - sysutil_register_cb([sig_ext_cb = this->sig_ext_cb, sig_ext_cb_ctx = this->sig_ext_cb_ctx, conn_id, event, sig_ext_cb_arg = this->sig_ext_cb_arg](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([sig_ext_cb = this->sig_ext_cb, sig_ext_cb_ctx = this->sig_ext_cb_ctx, conn_id, event, sig_ext_cb_arg = this->sig_ext_cb_arg](ppu_thread& cb_ppu) -> s32 + { sig_ext_cb(cb_ppu, sig_ext_cb_ctx, conn_id, event, 0, sig_ext_cb_arg); return 0; }); @@ -98,7 +100,8 @@ void signaling_handler::signal_sig2_callback(u64 room_id, u16 member_id, SceNpMa // Signal the callback if (sig2_cb) { - sysutil_register_cb([sig2_cb = this->sig2_cb, sig2_cb_ctx = this->sig2_cb_ctx, room_id, member_id, event, sig2_cb_arg = this->sig2_cb_arg](ppu_thread& cb_ppu) -> s32 { + sysutil_register_cb([sig2_cb = this->sig2_cb, sig2_cb_ctx = this->sig2_cb_ctx, room_id, member_id, event, sig2_cb_arg = this->sig2_cb_arg](ppu_thread& cb_ppu) -> s32 + { sig2_cb(cb_ppu, sig2_cb_ctx, room_id, member_id, event, 0, sig2_cb_arg); return 0; }); @@ -587,8 +590,8 @@ u32 signaling_handler::init_sig_infos(const SceNpId* npid) // Request peer infos from RPCN std::string npid_str(reinterpret_cast(npid->handle.data)); - const auto nph = g_fxo->get>(); - nph->req_sign_infos(npid_str, conn_id); + auto& nph = g_fxo->get>(); + nph.req_sign_infos(npid_str, conn_id); } else { diff --git a/rpcs3/Emu/RSX/Common/texture_cache_helpers.h b/rpcs3/Emu/RSX/Common/texture_cache_helpers.h index b744da13e6..86a5bc9734 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache_helpers.h +++ b/rpcs3/Emu/RSX/Common/texture_cache_helpers.h @@ -187,7 +187,7 @@ namespace rsx continue; } - const u32 bpp = g_fxo->get()->get_bpp(); + const u32 bpp = g_fxo->get().get_bpp(); const u32 pitch = buffer.pitch ? +buffer.pitch : bpp * buffer.width; if (pitch != dst_pitch) diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.h b/rpcs3/Emu/RSX/GL/GLGSRender.h index c56bd9cee6..07cbd4a7f8 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.h +++ b/rpcs3/Emu/RSX/GL/GLGSRender.h @@ -162,7 +162,7 @@ private: void load_texture_env(); void bind_texture_env(); - gl::texture* get_present_source(gl::present_surface_info* info, const rsx::avconf* avconfig); + gl::texture* get_present_source(gl::present_surface_info* info, const rsx::avconf& avconfig); public: void set_viewport(); diff --git a/rpcs3/Emu/RSX/GL/GLPresent.cpp b/rpcs3/Emu/RSX/GL/GLPresent.cpp index bfd526dcd2..3b73f0dd06 100644 --- a/rpcs3/Emu/RSX/GL/GLPresent.cpp +++ b/rpcs3/Emu/RSX/GL/GLPresent.cpp @@ -4,7 +4,7 @@ LOG_CHANNEL(screenshot_log, "SCREENSHOT"); -gl::texture* GLGSRender::get_present_source(gl::present_surface_info* info, const rsx::avconf* avconfig) +gl::texture* GLGSRender::get_present_source(gl::present_surface_info* info, const rsx::avconf& avconfig) { gl::texture* image = nullptr; @@ -79,10 +79,10 @@ gl::texture* GLGSRender::get_present_source(gl::present_surface_info* info, cons m_gl_texture_cache.invalidate_range(cmd, range, rsx::invalidation_cause::read); gl::texture::format fmt; - switch (avconfig->format) + switch (avconfig.format) { default: - rsx_log.error("Unhandled video output format 0x%x", avconfig->format); + rsx_log.error("Unhandled video output format 0x%x", avconfig.format); [[fallthrough]]; case CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8R8G8B8: fmt = gl::texture::format::bgra; @@ -113,16 +113,16 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info) u32 buffer_pitch = display_buffers[info.buffer].pitch; u32 av_format; - const auto avconfig = g_fxo->get(); + auto& avconfig = g_fxo->get(); - if (avconfig->state) + if (avconfig.state) { - av_format = avconfig->get_compatible_gcm_format(); + av_format = avconfig.get_compatible_gcm_format(); if (!buffer_pitch) - buffer_pitch = buffer_width * avconfig->get_bpp(); + buffer_pitch = buffer_width * avconfig.get_bpp(); - const u32 video_frame_height = (!avconfig->_3d? avconfig->resolution_y : (avconfig->resolution_y - 30) / 2); - buffer_width = std::min(buffer_width, avconfig->resolution_x); + const u32 video_frame_height = (!avconfig._3d? avconfig.resolution_y : (avconfig.resolution_y - 30) / 2); + buffer_width = std::min(buffer_width, avconfig.resolution_x); buffer_height = std::min(buffer_height, video_frame_height); } else @@ -153,7 +153,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info) const auto image_to_flip_ = get_present_source(&present_info, avconfig); image_to_flip = image_to_flip_->id(); - if (avconfig->_3d) [[unlikely]] + if (avconfig._3d) [[unlikely]] { const auto [unused, min_expected_height] = rsx::apply_resolution_scale(RSX_SURFACE_DIMENSION_IGNORED, buffer_height + 30); if (image_to_flip_->height() < min_expected_height) @@ -236,7 +236,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info) const bool use_full_rgb_range_output = g_cfg.video.full_rgb_range_output.get(); - if (use_full_rgb_range_output && rsx::fcmp(avconfig->gamma, 1.f) && !avconfig->_3d) + if (use_full_rgb_range_output && rsx::fcmp(avconfig.gamma, 1.f) && !avconfig._3d) { // Blit source image to the screen m_flip_fbo.recreate(); @@ -248,12 +248,12 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info) } else { - const f32 gamma = avconfig->gamma; + const f32 gamma = avconfig.gamma; const bool limited_range = !use_full_rgb_range_output; const rsx::simple_array images{ image_to_flip, image_to_flip2 }; gl::screen.bind(); - m_video_output_pass.run(areau(aspect_ratio), images, gamma, limited_range, avconfig->_3d); + m_video_output_pass.run(areau(aspect_ratio), images, gamma, limited_range, avconfig._3d); } } diff --git a/rpcs3/Emu/RSX/Overlays/Shaders/shader_loading_dialog_native.cpp b/rpcs3/Emu/RSX/Overlays/Shaders/shader_loading_dialog_native.cpp index d3c1dc0aec..7b7a032d8a 100644 --- a/rpcs3/Emu/RSX/Overlays/Shaders/shader_loading_dialog_native.cpp +++ b/rpcs3/Emu/RSX/Overlays/Shaders/shader_loading_dialog_native.cpp @@ -17,7 +17,7 @@ namespace rsx type.disable_cancel = true; type.progress_bar_count = 2; - dlg = g_fxo->get()->create(!!g_cfg.video.shader_preloading_dialog.use_custom_background); + dlg = g_fxo->get().create(!!g_cfg.video.shader_preloading_dialog.use_custom_background); dlg->progress_bar_set_taskbar_index(-1); dlg->show(false, msg, type, [](s32 status) { diff --git a/rpcs3/Emu/RSX/Overlays/overlay_message_dialog.cpp b/rpcs3/Emu/RSX/Overlays/overlay_message_dialog.cpp index 9682cffc08..7dc6aa2f46 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_message_dialog.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_message_dialog.cpp @@ -251,13 +251,13 @@ namespace rsx { if (!exit) { - g_fxo->get>()->operator()([&, tbit = alloc_thread_bit()]() + g_fxo->get>()([&, tbit = alloc_thread_bit()]() { g_thread_bit = tbit; if (interactive) { - auto ref = g_fxo->get()->get(uid); + auto ref = g_fxo->get().get(uid); if (auto error = run_input_loop()) { diff --git a/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp b/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp index abbac7ebf6..2571b707e2 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp @@ -1017,7 +1017,7 @@ namespace rsx update_panel(); - g_fxo->get>()->operator()([this, tbit = alloc_thread_bit()] + g_fxo->get>()([this, tbit = alloc_thread_bit()] { g_thread_bit = tbit; diff --git a/rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp b/rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp index 9a22c0e096..a6aa5751b5 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp @@ -414,7 +414,7 @@ namespace rsx { m_update_timer.Start(); - const auto rsx_thread = g_fxo->get(); + auto& rsx_thread = g_fxo->get(); switch (m_detail) { @@ -422,7 +422,7 @@ namespace rsx { m_frametime = std::max(0.f, static_cast(elapsed_update / m_frames)); - m_rsx_load = rsx_thread->get_load(); + m_rsx_load = rsx_thread.get_load(); m_total_threads = utils::cpu_stats::get_thread_count(); @@ -440,7 +440,7 @@ namespace rsx m_spu_cycles += thread_ctrl::get_cycles(spu); }); - m_rsx_cycles += rsx_thread->get_cycles(); + m_rsx_cycles += rsx_thread.get_cycles(); m_total_cycles = std::max(1, m_ppu_cycles + m_spu_cycles + m_rsx_cycles); m_cpu_usage = static_cast(m_cpu_stats.get_usage()); @@ -716,10 +716,10 @@ namespace rsx if (!g_cfg.misc.use_native_interface) return; - if (auto manager = g_fxo->get()) + if (auto& manager = g_fxo->get(); g_fxo->is_init()) { auto& perf_settings = g_cfg.video.perf_overlay; - auto perf_overlay = manager->get(); + auto perf_overlay = manager.get(); if (perf_settings.perf_overlay_enabled) { @@ -727,10 +727,10 @@ namespace rsx if (!existed) { - perf_overlay = manager->create(); + perf_overlay = manager.create(); } - std::scoped_lock lock(*manager); + std::lock_guard lock(manager); perf_overlay->set_detail_level(perf_settings.level); perf_overlay->set_position(perf_settings.position); @@ -747,7 +747,7 @@ namespace rsx } else if (perf_overlay) { - manager->remove(); + manager.remove(); } } } diff --git a/rpcs3/Emu/RSX/Overlays/overlays.cpp b/rpcs3/Emu/RSX/Overlays/overlays.cpp index 98f1b72ded..e3f4d48bba 100644 --- a/rpcs3/Emu/RSX/Overlays/overlays.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlays.cpp @@ -216,15 +216,15 @@ namespace rsx } // NOTE: Object removal should be the last step - if (auto manager = g_fxo->get()) + if (auto& manager = g_fxo->get(); g_fxo->is_init()) { - if (auto dlg = manager->get()) + if (auto dlg = manager.get()) { if (dlg->progress_bar_count()) Emu.GetCallbacks().handle_taskbar_progress(0, 1); } - manager->remove(uid); + manager.remove(uid); } } diff --git a/rpcs3/Emu/RSX/RSXOffload.cpp b/rpcs3/Emu/RSX/RSXOffload.cpp index d80f842e5f..7b1318fdcf 100644 --- a/rpcs3/Emu/RSX/RSXOffload.cpp +++ b/rpcs3/Emu/RSX/RSXOffload.cpp @@ -103,8 +103,8 @@ namespace rsx } else { - g_fxo->get()->m_enqueued_count++; - g_fxo->get()->m_work_queue.push(dst, src, length); + g_fxo->get().m_enqueued_count++; + g_fxo->get().m_work_queue.push(dst, src, length); } } @@ -116,8 +116,8 @@ namespace rsx } else { - g_fxo->get()->m_enqueued_count++; - g_fxo->get()->m_work_queue.push(dst, src, length); + g_fxo->get().m_enqueued_count++; + g_fxo->get().m_work_queue.push(dst, src, length); } } @@ -131,8 +131,8 @@ namespace rsx } else { - g_fxo->get()->m_enqueued_count++; - g_fxo->get()->m_work_queue.push(dst, primitive, count); + g_fxo->get().m_enqueued_count++; + g_fxo->get().m_work_queue.push(dst, primitive, count); } } @@ -141,21 +141,21 @@ namespace rsx { ensure(g_cfg.video.multithreaded_rsx); - g_fxo->get()->m_enqueued_count++; - g_fxo->get()->m_work_queue.push(request_code, args); + g_fxo->get().m_enqueued_count++; + g_fxo->get().m_work_queue.push(request_code, args); } // Synchronization bool dma_manager::is_current_thread() const { - return std::this_thread::get_id() == g_fxo->get()->m_thread_id; + return std::this_thread::get_id() == g_fxo->get().m_thread_id; } bool dma_manager::sync() { - const auto _thr = g_fxo->get(); + auto& _thr = g_fxo->get(); - if (_thr->m_enqueued_count.load() <= _thr->m_processed_count.load()) [[likely]] + if (_thr.m_enqueued_count.load() <= _thr.m_processed_count.load()) [[likely]] { // Nothing to do return true; @@ -169,7 +169,7 @@ namespace rsx return false; } - while (_thr->m_enqueued_count.load() > _thr->m_processed_count.load()) + while (_thr.m_enqueued_count.load() > _thr.m_processed_count.load()) { rsxthr->on_semaphore_acquire_wait(); utils::pause(); @@ -177,7 +177,7 @@ namespace rsx } else { - while (_thr->m_enqueued_count.load() > _thr->m_processed_count.load()) + while (_thr.m_enqueued_count.load() > _thr.m_processed_count.load()) utils::pause(); } @@ -186,7 +186,7 @@ namespace rsx void dma_manager::join() { - *g_fxo->get() = thread_state::aborting; + g_fxo->get() = thread_state::aborting; sync(); } @@ -205,7 +205,7 @@ namespace rsx // Fault recovery utils::address_range dma_manager::get_fault_range(bool writing) const { - const auto m_current_job = (ensure(g_fxo->get()->m_current_job)); + const auto m_current_job = ensure(g_fxo->get().m_current_job); void *address = nullptr; u32 range = m_current_job->length; diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 9628812499..26c39a96c3 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -555,7 +555,7 @@ namespace rsx rsx::overlays::reset_performance_overlay(); - g_fxo->get()->init(); + g_fxo->get().init(); on_init_thread(); if (!zcull_ctrl) @@ -684,7 +684,7 @@ namespace rsx do_local_task(rsx::FIFO_state::lock_wait); m_rsx_thread_exiting = true; - g_fxo->get()->join(); + g_fxo->get().join(); state += cpu_flag::exit; } @@ -2357,7 +2357,7 @@ namespace rsx const u32 data_size = range.second * block.attribute_stride; const u32 vertex_base = range.first * block.attribute_stride; - g_fxo->get()->copy(persistent, vm::_ptr(block.real_offset_address) + vertex_base, data_size); + g_fxo->get().copy(persistent, vm::_ptr(block.real_offset_address) + vertex_base, data_size); persistent += data_size; } } @@ -2510,7 +2510,7 @@ namespace rsx m_graphics_state |= rsx::pipeline_state::fragment_constants_dirty; // DMA sync; if you need this, don't use MTRSX - // g_fxo->get()->sync(); + // g_fxo->get().sync(); //TODO: On sync every sub-unit should finish any pending tasks //Might cause zcull lockup due to zombie 'unclaimed reports' which are not forcefully removed currently @@ -2744,7 +2744,7 @@ namespace rsx { // Each 64 entries are grouped by a bit const u64 io_event = SYS_RSX_EVENT_UNMAPPED_BASE << i; - g_fxo->get()->send_event(0, io_event, to_unmap); + g_fxo->get().send_event(0, io_event, to_unmap); } } } @@ -2757,13 +2757,13 @@ namespace rsx { io >>= 20; - const auto cfg = g_fxo->get(); - std::lock_guard lock(cfg->gcmio_mutex); + auto& cfg = g_fxo->get(); + std::lock_guard lock(cfg.gcmio_mutex); for (const u32 end = ea + (size >> 20); ea < end;) { - cfg->offsetTable.ioAddress[ea++] = 0xFFFF; - cfg->offsetTable.eaAddress[io++] = 0xFFFF; + cfg.offsetTable.ioAddress[ea++] = 0xFFFF; + cfg.offsetTable.eaAddress[io++] = 0xFFFF; } } } @@ -2828,7 +2828,7 @@ namespace rsx { if (g_cfg.video.multithreaded_rsx) { - g_fxo->get()->sync(); + g_fxo->get().sync(); } external_interrupt_ack.store(true); diff --git a/rpcs3/Emu/RSX/VK/VKCommandStream.cpp b/rpcs3/Emu/RSX/VK/VKCommandStream.cpp index 4f4a4a5693..3ca4256cd1 100644 --- a/rpcs3/Emu/RSX/VK/VKCommandStream.cpp +++ b/rpcs3/Emu/RSX/VK/VKCommandStream.cpp @@ -25,7 +25,7 @@ namespace vk if (!flush && g_cfg.video.multithreaded_rsx) { auto packet = new submit_packet(queue, pfence, info); - g_fxo->get()->backend_ctrl(rctrl_queue_submit, packet); + g_fxo->get().backend_ctrl(rctrl_queue_submit, packet); } else { diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index 86e41ce69e..19e1a493dd 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -673,15 +673,15 @@ bool VKGSRender::on_access_violation(u32 address, bool is_writing) if (result.num_flushable > 0) { - if (g_fxo->get()->is_current_thread()) + if (g_fxo->get().is_current_thread()) { // The offloader thread cannot handle flush requests ensure(!(m_queue_status & flush_queue_state::deadlock)); - m_offloader_fault_range = g_fxo->get()->get_fault_range(is_writing); + m_offloader_fault_range = g_fxo->get().get_fault_range(is_writing); m_offloader_fault_cause = (is_writing) ? rsx::invalidation_cause::write : rsx::invalidation_cause::read; - g_fxo->get()->set_mem_fault_flag(); + g_fxo->get().set_mem_fault_flag(); m_queue_status |= flush_queue_state::deadlock; // Wait for deadlock to clear @@ -690,7 +690,7 @@ bool VKGSRender::on_access_violation(u32 address, bool is_writing) utils::pause(); } - g_fxo->get()->clear_mem_fault_flag(); + g_fxo->get().clear_mem_fault_flag(); return true; } @@ -1928,7 +1928,7 @@ void VKGSRender::close_and_submit_command_buffer(vk::fence* pFence, VkSemaphore // Workaround for deadlock occuring during RSX offloader fault // TODO: Restructure command submission infrastructure to avoid this condition - const bool sync_success = g_fxo->get()->sync(); + const bool sync_success = g_fxo->get().sync(); const VkBool32 force_flush = !sync_success; if (vk::test_status_interrupt(vk::heap_dirty)) diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.h b/rpcs3/Emu/RSX/VK/VKGSRender.h index a8a4ee1a99..ac76c3cb9d 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.h +++ b/rpcs3/Emu/RSX/VK/VKGSRender.h @@ -516,7 +516,7 @@ private: void present(vk::frame_context_t *ctx); void reinitialize_swapchain(); - vk::image* get_present_source(vk::present_surface_info* info, const rsx::avconf* avconfig); + vk::image* get_present_source(vk::present_surface_info* info, const rsx::avconf& avconfig); void begin_render_pass(); void close_render_pass(); diff --git a/rpcs3/Emu/RSX/VK/VKPresent.cpp b/rpcs3/Emu/RSX/VK/VKPresent.cpp index 74f05ac709..083933accf 100644 --- a/rpcs3/Emu/RSX/VK/VKPresent.cpp +++ b/rpcs3/Emu/RSX/VK/VKPresent.cpp @@ -273,7 +273,7 @@ void VKGSRender::frame_context_cleanup(vk::frame_context_t *ctx, bool free_resou vk::advance_completed_frame_counter(); } -vk::image* VKGSRender::get_present_source(vk::present_surface_info* info, const rsx::avconf* avconfig) +vk::image* VKGSRender::get_present_source(vk::present_surface_info* info, const rsx::avconf& avconfig) { vk::image* image_to_flip = nullptr; @@ -352,10 +352,10 @@ vk::image* VKGSRender::get_present_source(vk::present_surface_info* info, const } VkFormat format; - switch (avconfig->format) + switch (avconfig.format) { default: - rsx_log.error("Unhandled video output format 0x%x", avconfig->format); + rsx_log.error("Unhandled video output format 0x%x", avconfig.format); [[fallthrough]]; case CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8R8G8B8: format = VK_FORMAT_B8G8R8A8_UNORM; @@ -439,16 +439,16 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info) u32 buffer_pitch = display_buffers[info.buffer].pitch; u32 av_format; - const auto avconfig = g_fxo->get(); + auto& avconfig = g_fxo->get(); - if (avconfig->state) + if (avconfig.state) { - av_format = avconfig->get_compatible_gcm_format(); + av_format = avconfig.get_compatible_gcm_format(); if (!buffer_pitch) - buffer_pitch = buffer_width * avconfig->get_bpp(); + buffer_pitch = buffer_width * avconfig.get_bpp(); - const u32 video_frame_height = (!avconfig->_3d? avconfig->resolution_y : (avconfig->resolution_y - 30) / 2); - buffer_width = std::min(buffer_width, avconfig->resolution_x); + const u32 video_frame_height = (!avconfig._3d? avconfig.resolution_y : (avconfig.resolution_y - 30) / 2); + buffer_width = std::min(buffer_width, avconfig.resolution_x); buffer_height = std::min(buffer_height, video_frame_height); } else @@ -471,7 +471,7 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info) image_to_flip = get_present_source(&present_info, avconfig); - if (avconfig->_3d) [[unlikely]] + if (avconfig._3d) [[unlikely]] { const auto [unused, min_expected_height] = rsx::apply_resolution_scale(RSX_SURFACE_DIMENSION_IGNORED, buffer_height + 30); if (image_to_flip->height() < min_expected_height) @@ -592,7 +592,7 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info) { const bool use_full_rgb_range_output = g_cfg.video.full_rgb_range_output.get(); - if (!use_full_rgb_range_output || !rsx::fcmp(avconfig->gamma, 1.f) || avconfig->_3d) [[unlikely]] + if (!use_full_rgb_range_output || !rsx::fcmp(avconfig.gamma, 1.f) || avconfig._3d) [[unlikely]] { calibration_src.push_back(dynamic_cast(image_to_flip)); ensure(calibration_src.front()); @@ -642,7 +642,7 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info) vk::get_overlay_pass()->run( *m_current_command_buffer, areau(aspect_ratio), direct_fbo, calibration_src, - avconfig->gamma, !use_full_rgb_range_output, avconfig->_3d, single_target_pass); + avconfig.gamma, !use_full_rgb_range_output, avconfig._3d, single_target_pass); image_to_flip->pop_layout(*m_current_command_buffer); direct_fbo->release(); diff --git a/rpcs3/Emu/RSX/VK/VKResourceManager.cpp b/rpcs3/Emu/RSX/VK/VKResourceManager.cpp index f67be7c7c7..c4233bfc8f 100644 --- a/rpcs3/Emu/RSX/VK/VKResourceManager.cpp +++ b/rpcs3/Emu/RSX/VK/VKResourceManager.cpp @@ -32,10 +32,10 @@ namespace vk { if (!flush && g_cfg.video.multithreaded_rsx) { - auto offloader_thread = g_fxo->get(); - ensure(!offloader_thread->is_current_thread()); + auto& offloader_thread = g_fxo->get(); + ensure(!offloader_thread.is_current_thread()); - offloader_thread->backend_ctrl(rctrl_run_gc, reinterpret_cast(event_id)); + offloader_thread.backend_ctrl(rctrl_run_gc, reinterpret_cast(event_id)); return; } diff --git a/rpcs3/Emu/RSX/VK/VKVertexBuffers.cpp b/rpcs3/Emu/RSX/VK/VKVertexBuffers.cpp index f32f7542c5..48c7cb3581 100644 --- a/rpcs3/Emu/RSX/VK/VKVertexBuffers.cpp +++ b/rpcs3/Emu/RSX/VK/VKVertexBuffers.cpp @@ -69,7 +69,7 @@ namespace VkDeviceSize offset_in_index_buffer = m_index_buffer_ring_info.alloc<256>(upload_size); void* buf = m_index_buffer_ring_info.map(offset_in_index_buffer, upload_size); - g_fxo->get()->emulate_as_indexed(buf, clause.primitive, vertex_count); + g_fxo->get().emulate_as_indexed(buf, clause.primitive, vertex_count); m_index_buffer_ring_info.unmap(); return std::make_tuple( diff --git a/rpcs3/Emu/RSX/VK/vkutils/data_heap.cpp b/rpcs3/Emu/RSX/VK/vkutils/data_heap.cpp index 58b1dc160e..bb8ee2b349 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/data_heap.cpp +++ b/rpcs3/Emu/RSX/VK/vkutils/data_heap.cpp @@ -68,7 +68,7 @@ namespace vk } // Wait for DMA activity to end - g_fxo->get()->sync(); + g_fxo->get().sync(); if (mapped) { diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 01e0f6c8c4..4ccd0bb5ea 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -207,7 +207,7 @@ namespace rsx void texture_read_semaphore_release(thread* rsx, u32 _reg, u32 arg) { // Pipeline barrier seems to be equivalent to a SHADER_READ stage barrier - g_fxo->get()->sync(); + g_fxo->get().sync(); if (g_cfg.video.strict_rendering_mode) { rsx->sync(); @@ -230,7 +230,7 @@ namespace rsx void back_end_write_semaphore_release(thread* rsx, u32 _reg, u32 arg) { // Full pipeline barrier - g_fxo->get()->sync(); + g_fxo->get().sync(); rsx->sync(); const u32 offset = method_registers.semaphore_offset_4097(); diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index b4011014af..fb947f1b49 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -530,15 +530,15 @@ const std::string Emulator::GetBackgroundPicturePath() const std::string Emulator::PPUCache() const { - const auto _main = g_fxo->get(); + auto& _main = g_fxo->get(); - if (!_main || _main->cache.empty()) + if (!g_fxo->is_init() || _main.cache.empty()) { ppu_log.warning("PPU Cache location not initialized."); return {}; } - return _main->cache; + return _main.cache; } bool Emulator::BootRsxCapture(const std::string& path) @@ -1070,7 +1070,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool } // Load patches from different locations - g_fxo->get()->append_title_patches(m_title_id); + g_fxo->get().append_title_patches(m_title_id); // Mount all devices const std::string emu_dir = GetEmuDir(); @@ -1157,15 +1157,15 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool if (obj == elf_error::ok) { - const auto _main = g_fxo->get(); + auto& _main = g_fxo->get(); ppu_load_exec(obj); - _main->path = path; + _main.path = path; ConfigurePPUCache(); - ppu_initialize(*_main); + ppu_initialize(_main); } else { @@ -2074,25 +2074,25 @@ void Emulator::ConfigureLogs() void Emulator::ConfigurePPUCache() { - const auto _main = g_fxo->get(); + auto& _main = g_fxo->get(); - _main->cache = GetCacheDir(); + _main.cache = GetCacheDir(); if (!m_title_id.empty() && m_cat != "1P") { - _main->cache += Emu.GetTitleID(); - _main->cache += '/'; + _main.cache += Emu.GetTitleID(); + _main.cache += '/'; } - fmt::append(_main->cache, "ppu-%s-%s/", fmt::base57(_main->sha1), _main->path.substr(_main->path.find_last_of('/') + 1)); + fmt::append(_main.cache, "ppu-%s-%s/", fmt::base57(_main.sha1), _main.path.substr(_main.path.find_last_of('/') + 1)); - if (!fs::create_path(_main->cache)) + if (!fs::create_path(_main.cache)) { - sys_log.error("Failed to create cache directory: %s (%s)", _main->cache, fs::g_tls_error); + sys_log.error("Failed to create cache directory: %s (%s)", _main.cache, fs::g_tls_error); } else { - sys_log.notice("Cache: %s", _main->cache); + sys_log.notice("Cache: %s", _main.cache); } } diff --git a/rpcs3/Emu/VFS.cpp b/rpcs3/Emu/VFS.cpp index 4cc162d9cf..8bfd2d5c7c 100644 --- a/rpcs3/Emu/VFS.cpp +++ b/rpcs3/Emu/VFS.cpp @@ -36,11 +36,11 @@ bool vfs::mount(std::string_view vpath, std::string_view path) // Workaround g_fxo->need(); - const auto table = g_fxo->get(); + auto& table = g_fxo->get(); // TODO: scan roots of mounted devices for undeleted vfs::host::unlink remnants, and try to delete them (_WIN32 only) - std::lock_guard lock(table->mutex); + std::lock_guard lock(table.mutex); if (vpath.empty()) { @@ -48,7 +48,7 @@ bool vfs::mount(std::string_view vpath, std::string_view path) return false; } - for (std::vector list{&table->root};;) + for (std::vector list{&table.root};;) { // Skip one or more '/' const auto pos = vpath.find_first_not_of('/'); @@ -111,9 +111,9 @@ bool vfs::mount(std::string_view vpath, std::string_view path) std::string vfs::get(std::string_view vpath, std::vector* out_dir, std::string* out_path) { - const auto table = g_fxo->get(); + auto& table = g_fxo->get(); - reader_lock lock(table->mutex); + reader_lock lock(table.mutex); // Resulting path fragments: decoded ones std::vector result; @@ -136,7 +136,7 @@ std::string vfs::get(std::string_view vpath, std::vector* out_dir, name_list.reserve(vpath.size() / 2); } - for (std::vector list{&table->root};;) + for (std::vector list{&table.root};;) { // Skip one or more '/' const auto pos = vpath.find_first_not_of('/'); diff --git a/rpcs3/rpcs3qt/debugger_frame.cpp b/rpcs3/rpcs3qt/debugger_frame.cpp index 1c3b48199b..5f614154b6 100644 --- a/rpcs3/rpcs3qt/debugger_frame.cpp +++ b/rpcs3/rpcs3qt/debugger_frame.cpp @@ -578,7 +578,7 @@ void debugger_frame::UpdateUnitList() idm::select>(on_select); idm::select>(on_select); - if (auto render = g_fxo->get(); emu_state != system_state::stopped && render && render->ctrl) + if (auto render = g_fxo->try_get(); emu_state != system_state::stopped && render && render->ctrl) { on_select(render->id, *render); } diff --git a/rpcs3/rpcs3qt/gs_frame.cpp b/rpcs3/rpcs3qt/gs_frame.cpp index b32be473b2..b99010d99a 100644 --- a/rpcs3/rpcs3qt/gs_frame.cpp +++ b/rpcs3/rpcs3qt/gs_frame.cpp @@ -483,9 +483,9 @@ void gs_frame::take_screenshot(const std::vector sshot_data, const u32 sshot screenshot_manager manager; { - const auto fxo = g_fxo->get(); + auto& fxo = g_fxo->get(); std::lock_guard lock(screenshot_mtx); - manager = *fxo; + manager = fxo; } struct scoped_png_ptrs @@ -579,10 +579,10 @@ void gs_frame::take_screenshot(const std::vector sshot_data, const u32 sshot // Games choose the overlay file and the offset based on the current video resolution. // We need to scale the overlay if our resolution scaling causes the image to have a different size. - const auto avconf = g_fxo->get(); + auto& avconf = g_fxo->get(); // TODO: handle wacky PS3 resolutions (without resolution scaling) - if (avconf->resolution_x != sshot_width || avconf->resolution_y != sshot_height) + if (avconf.resolution_x != sshot_width || avconf.resolution_y != sshot_height) { const int scale = rsx::get_resolution_scale_percent(); const int x = (scale * manager.overlay_offset_x) / 100; diff --git a/rpcs3/rpcs3qt/kernel_explorer.cpp b/rpcs3/rpcs3qt/kernel_explorer.cpp index f0c1875601..9c65732f45 100644 --- a/rpcs3/rpcs3qt/kernel_explorer.cpp +++ b/rpcs3/rpcs3qt/kernel_explorer.cpp @@ -183,7 +183,7 @@ kernel_explorer::kernel_explorer(QWidget* parent) void kernel_explorer::Update() { - const auto dct = g_fxo->get(); + const auto dct = g_fxo->try_get(); if (!dct) { @@ -606,7 +606,7 @@ void kernel_explorer::Update() { // Currently a single context is supported at a time const auto rsx = rsx::get_current_renderer(); - const auto context_info = g_fxo->get(); + const auto context_info = g_fxo->try_get(); if (!rsx || !context_info) { diff --git a/rpcs3/util/fixed_typemap.hpp b/rpcs3/util/fixed_typemap.hpp index b0a568ee16..b77c14c484 100644 --- a/rpcs3/util/fixed_typemap.hpp +++ b/rpcs3/util/fixed_typemap.hpp @@ -256,15 +256,15 @@ namespace stx // Obtain object pointer (may be uninitialized memory) template - T* get() const noexcept + T& get() const noexcept { if constexpr (Size != 0) { - return std::launder(reinterpret_cast(m_data + stx::typeoffset>())); + return *std::launder(reinterpret_cast(m_data + stx::typeoffset>())); } else { - return std::launder(reinterpret_cast(m_list + stx::typeoffset>())); + return *std::launder(reinterpret_cast(m_list + stx::typeoffset>())); } } @@ -274,7 +274,7 @@ namespace stx { if (is_init()) { - [[likely]] return get(); + [[likely]] return &get(); } [[unlikely]] return nullptr;