mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 22:19:02 +00:00
fixed_typemap.hpp: return reference
This commit is contained in:
parent
bbf52f3cea
commit
ea5e837bd6
87 changed files with 3028 additions and 2997 deletions
|
|
@ -125,13 +125,13 @@ private:
|
|||
|
||||
void LIBUSB_CALL callback_transfer(struct libusb_transfer* transfer)
|
||||
{
|
||||
const auto usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
|
||||
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<u32> handle)
|
|||
|
||||
sys_usbd.warning("sys_usbd_initialize(handle=*0x%x)", handle);
|
||||
|
||||
const auto usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
|
||||
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<named_thread<usb_handler_thread>>();
|
||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
|
||||
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::ptr<UsbInte
|
|||
|
||||
sys_usbd.warning("sys_usbd_get_device_list(handle=0x%x, device_list=*0x%x, max_devices=0x%x)", handle, device_list, max_devices);
|
||||
|
||||
const auto usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
|
||||
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<s32>
|
||||
u32 i_tocopy = std::min<u32>(max_devices, ::size32(usbh->handled_devices));
|
||||
u32 i_tocopy = std::min<u32>(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::ptr<char
|
|||
sys_usbd.warning("sys_usbd_register_extra_ldd(handle=0x%x, s_product=%s, slen_product=0x%x, id_vendor=0x%x, id_product_min=0x%x, id_product_max=0x%x)", handle, s_product, slen_product, id_vendor,
|
||||
id_product_min, id_product_max);
|
||||
|
||||
const auto usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
|
||||
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<named_thread<usb_handler_thread>>();
|
||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
|
||||
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<void> 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<named_thread<usb_handler_thread>>();
|
||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
|
||||
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<u8*>(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<named_thread<usb_handler_thread>>();
|
||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
|
||||
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<u8>(endpoint)));
|
||||
return not_an_error(usbh.open_pipe(device_handle, static_cast<u8>(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<named_thread<usb_handler_thread>>();
|
||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
|
||||
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<named_thread<usb_handler_thread>>();
|
||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
|
||||
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<u64> 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<named_thread<usb_handler_thread>>();
|
||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
|
||||
{
|
||||
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<u64> 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<named_thread<usb_handler_thread>>();
|
||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
|
||||
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<named_thread<usb_handler_thread>>();
|
||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
|
||||
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<named_thread<usb_handler_thread>>();
|
||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
|
||||
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<named_thread<usb_handler_thread>>();
|
||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
|
||||
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<named_thread<usb_handler_thread>>();
|
||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue