mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-09 16:35:13 +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
|
|
@ -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<u16>& digital_buttons, be_t<u16>& analog_t)
|
||||
{
|
||||
const auto handler = g_fxo->get<MouseHandlerBase>();
|
||||
auto& handler = g_fxo->get<MouseHandlerBase>();
|
||||
|
||||
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<u16>& digital_buttons, b
|
|||
|
||||
static bool mouse_pos_to_gem_image_state(const u32 mouse_no, vm::ptr<CellGemImageState>& gem_image_state)
|
||||
{
|
||||
const auto handler = g_fxo->get<MouseHandlerBase>();
|
||||
auto& handler = g_fxo->get<MouseHandlerBase>();
|
||||
|
||||
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<GSRender*>(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<CellGemImag
|
|||
|
||||
static bool mouse_pos_to_gem_state(const u32 mouse_no, vm::ptr<CellGemState>& gem_state)
|
||||
{
|
||||
const auto handler = g_fxo->get<MouseHandlerBase>();
|
||||
auto& handler = g_fxo->get<MouseHandlerBase>();
|
||||
|
||||
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<GSRender*>(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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
if (!gem->state)
|
||||
if (!gem.state)
|
||||
{
|
||||
return CELL_GEM_ERROR_UNINITIALIZED;
|
||||
}
|
||||
|
|
@ -448,9 +448,9 @@ error_code cellGemConvertVideoStart(vm::cptr<void> video_frame)
|
|||
{
|
||||
cellGem.todo("cellGemConvertVideoStart(video_frame=*0x%x)", video_frame);
|
||||
|
||||
const auto gem = g_fxo->get<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<u8> hues)
|
|||
{
|
||||
cellGem.todo("cellGemGetAllTrackableHues(hues=*0x%x)");
|
||||
|
||||
const auto gem = g_fxo->get<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
if (!gem->state)
|
||||
if (!gem.state)
|
||||
{
|
||||
return CELL_GEM_ERROR_UNINITIALIZED;
|
||||
}
|
||||
|
|
@ -601,9 +601,9 @@ error_code cellGemGetCameraState(vm::ptr<CellGemCameraState> camera_state)
|
|||
{
|
||||
cellGem.todo("cellGemGetCameraState(camera_state=0x%x)", camera_state);
|
||||
|
||||
const auto gem = g_fxo->get<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
if (!gem->state)
|
||||
if (!gem.state)
|
||||
{
|
||||
return CELL_GEM_ERROR_UNINITIALIZED;
|
||||
}
|
||||
|
|
@ -623,9 +623,9 @@ error_code cellGemGetEnvironmentLightingColor(vm::ptr<f32> r, vm::ptr<f32> g, vm
|
|||
{
|
||||
cellGem.todo("cellGemGetEnvironmentLightingColor(r=*0x%x, g=*0x%x, b=*0x%x)", r, g, b);
|
||||
|
||||
const auto gem = g_fxo->get<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
if (!gem->state)
|
||||
if (!gem.state)
|
||||
{
|
||||
return CELL_GEM_ERROR_UNINITIALIZED;
|
||||
}
|
||||
|
|
@ -647,9 +647,9 @@ error_code cellGemGetHuePixels(vm::cptr<void> camera_frame, u32 hue, vm::ptr<u8>
|
|||
{
|
||||
cellGem.todo("cellGemGetHuePixels(camera_frame=*0x%x, hue=%d, pixels=*0x%x)", camera_frame, hue, pixels);
|
||||
|
||||
const auto gem = g_fxo->get<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
if (!gem->state)
|
||||
if (!gem.state)
|
||||
{
|
||||
return CELL_GEM_ERROR_UNINITIALIZED;
|
||||
}
|
||||
|
|
@ -666,9 +666,9 @@ error_code cellGemGetImageState(u32 gem_num, vm::ptr<CellGemImageState> gem_imag
|
|||
{
|
||||
cellGem.todo("cellGemGetImageState(gem_num=%d, image_state=&0x%x)", gem_num, gem_image_state);
|
||||
|
||||
const auto gem = g_fxo->get<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
if (!gem->state)
|
||||
if (!gem.state)
|
||||
{
|
||||
return CELL_GEM_ERROR_UNINITIALIZED;
|
||||
}
|
||||
|
|
@ -678,7 +678,7 @@ error_code cellGemGetImageState(u32 gem_num, vm::ptr<CellGemImageState> gem_imag
|
|||
return CELL_GEM_ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
auto shared_data = g_fxo->get<gem_camera_shared>();
|
||||
auto& shared_data = g_fxo->get<gem_camera_shared>();
|
||||
|
||||
if (g_cfg.io.move == move_handler::fake)
|
||||
{
|
||||
|
|
@ -694,7 +694,7 @@ error_code cellGemGetImageState(u32 gem_num, vm::ptr<CellGemImageState> 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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<CellGemInfo> info)
|
|||
{
|
||||
cellGem.warning("cellGemGetInfo(info=*0x%x)", info);
|
||||
|
||||
const auto gem = g_fxo->get<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<CellGemInfo> 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<float> r, vm::ptr<float> 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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<float> r, vm::ptr<float> 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<u8> rumble)
|
|||
{
|
||||
cellGem.todo("cellGemGetRumble(gem_num=%d, rumble=*0x%x)", gem_num, rumble);
|
||||
|
||||
const auto gem = g_fxo->get<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<u8> 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::ptr<Ce
|
|||
{
|
||||
cellGem.warning("cellGemGetState(gem_num=%d, flag=0x%x, time=0x%llx, gem_state=*0x%x)", gem_num, flag, time_parameter, gem_state);
|
||||
|
||||
const auto gem = g_fxo->get<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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::ptr<Ce
|
|||
ds3_input_to_ext(gem_num, gem_state->ext);
|
||||
|
||||
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<u64> flags)
|
|||
{
|
||||
cellGem.todo("cellGemGetStatusFlags(gem_num=%d, flags=*0x%x)", gem_num, flags);
|
||||
|
||||
const auto gem = g_fxo->get<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<u64> 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<u32> hue)
|
|||
{
|
||||
cellGem.warning("cellGemGetTrackerHue(gem_num=%d, hue=*0x%x)", gem_num, hue);
|
||||
|
||||
const auto gem = g_fxo->get<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<u32> 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<CellGemAttribute> attribute)
|
|||
{
|
||||
cellGem.warning("cellGemInit(attribute=*0x%x)", attribute);
|
||||
|
||||
const auto gem = g_fxo->get<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<CellGemAttribute> 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<MouseHandlerBase>();
|
||||
auto& handler = g_fxo->get<MouseHandlerBase>();
|
||||
|
||||
handler->Init(std::min<u32>(attribute->max_connect, CELL_GEM_MAX_NUM));
|
||||
handler.Init(std::min<u32>(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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
if (!gem->state)
|
||||
if (!gem.state)
|
||||
{
|
||||
return CELL_GEM_ERROR_UNINITIALIZED;
|
||||
}
|
||||
|
|
@ -1073,9 +1073,9 @@ error_code cellGemPrepareVideoConvert(vm::cptr<CellGemVideoConvertAttribute> vc_
|
|||
{
|
||||
cellGem.todo("cellGemPrepareVideoConvert(vc_attribute=*0x%x)", vc_attribute);
|
||||
|
||||
const auto gem = g_fxo->get<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
if (!gem->state)
|
||||
if (!gem.state)
|
||||
{
|
||||
return CELL_GEM_ERROR_UNINITIALIZED;
|
||||
}
|
||||
|
|
@ -1098,7 +1098,7 @@ error_code cellGemPrepareVideoConvert(vm::cptr<CellGemVideoConvertAttribute> 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<u32> 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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
if (!gem->state)
|
||||
if (!gem.state)
|
||||
{
|
||||
return CELL_GEM_ERROR_UNINITIALIZED;
|
||||
}
|
||||
|
|
@ -1119,12 +1119,12 @@ error_code cellGemReadExternalPortDeviceInfo(u32 gem_num, vm::ptr<u32> 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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<u32> req_hues, vm::ptr<u32> res_hues)
|
|||
{
|
||||
cellGem.todo("cellGemTrackHues(req_hues=*0x%x, res_hues=*0x%x)", req_hues, res_hues);
|
||||
|
||||
const auto gem = g_fxo->get<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<u32> req_hues, vm::ptr<u32> 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<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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<void> camera_frame, u64 timestamp)
|
|||
{
|
||||
cellGem.warning("cellGemUpdateStart(camera_frame=*0x%x, timestamp=%d)", camera_frame, timestamp);
|
||||
|
||||
const auto gem = g_fxo->get<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
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::ptr<u8[CELL_GEM_EXTERNAL_PO
|
|||
{
|
||||
cellGem.todo("cellGemWriteExternalPort(gem_num=%d, data=%s)", gem_num, data);
|
||||
|
||||
const auto gem = g_fxo->get<gem_config>();
|
||||
auto& gem = g_fxo->get<gem_config>();
|
||||
|
||||
if (!gem->state)
|
||||
if (!gem.state)
|
||||
{
|
||||
return CELL_GEM_ERROR_UNINITIALIZED;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue