mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 06:21:26 +12:00
cellCamera/cellGem: Fix time stretching setting (#10476)
This commit is contained in:
parent
0531b3d801
commit
aaa20c0ff0
3 changed files with 9 additions and 12 deletions
|
@ -976,7 +976,7 @@ error_code cellCameraStart(s32 dev_num)
|
||||||
return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND;
|
return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_camera.timer.Start();
|
g_camera.start_timestamp = get_guest_system_time();
|
||||||
g_camera.is_streaming = true;
|
g_camera.is_streaming = true;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
|
@ -1066,7 +1066,7 @@ error_code cellCameraReadEx(s32 dev_num, vm::ptr<CellCameraReadEx> read)
|
||||||
|
|
||||||
if (read) // NULL returns CELL_OK
|
if (read) // NULL returns CELL_OK
|
||||||
{
|
{
|
||||||
read->timestamp = g_camera.timer.GetElapsedTimeInMicroSec();
|
read->timestamp = (get_guest_system_time() - g_camera.start_timestamp);
|
||||||
read->frame = g_camera.frame_num;
|
read->frame = g_camera.frame_num;
|
||||||
read->bytesread = g_camera.is_streaming ? get_video_buffer_size(g_camera.info) : 0;
|
read->bytesread = g_camera.is_streaming ? get_video_buffer_size(g_camera.info) : 0;
|
||||||
|
|
||||||
|
@ -1123,9 +1123,6 @@ error_code cellCameraStop(s32 dev_num)
|
||||||
|
|
||||||
g_camera.is_streaming = false;
|
g_camera.is_streaming = false;
|
||||||
|
|
||||||
std::lock_guard lock(g_camera.mutex);
|
|
||||||
g_camera.timer.Stop();
|
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1300,7 +1297,7 @@ void camera_context::operator()()
|
||||||
const u64 camera_id = 0;
|
const u64 camera_id = 0;
|
||||||
|
|
||||||
data2 = image_data_size << 32 | buffer_number << 16 | camera_id;
|
data2 = image_data_size << 32 | buffer_number << 16 | camera_id;
|
||||||
data3 = timer.GetElapsedTimeInMicroSec(); // timestamp
|
data3 = get_guest_system_time() - start_timestamp; // timestamp
|
||||||
}
|
}
|
||||||
else // CELL_CAMERA_READ_FUNCCALL, also default
|
else // CELL_CAMERA_READ_FUNCCALL, also default
|
||||||
{
|
{
|
||||||
|
|
|
@ -417,7 +417,7 @@ public:
|
||||||
|
|
||||||
shared_mutex mutex;
|
shared_mutex mutex;
|
||||||
shared_mutex mutex_notify_data_map;
|
shared_mutex mutex_notify_data_map;
|
||||||
Timer timer;
|
u64 start_timestamp = 0;
|
||||||
|
|
||||||
atomic_t<u8> read_mode{CELL_CAMERA_READ_FUNCCALL};
|
atomic_t<u8> read_mode{CELL_CAMERA_READ_FUNCCALL};
|
||||||
atomic_t<bool> is_streaming{false};
|
atomic_t<bool> is_streaming{false};
|
||||||
|
|
|
@ -106,7 +106,7 @@ struct gem_config
|
||||||
|
|
||||||
shared_mutex mtx;
|
shared_mutex mtx;
|
||||||
|
|
||||||
Timer timer;
|
u64 start_timestamp = 0;
|
||||||
|
|
||||||
// helper functions
|
// helper functions
|
||||||
bool is_controller_ready(u32 gem_num) const
|
bool is_controller_ready(u32 gem_num) const
|
||||||
|
@ -738,7 +738,7 @@ error_code cellGemGetInertialState(u32 gem_num, u32 state_flag, u64 timestamp, v
|
||||||
{
|
{
|
||||||
ds3_input_to_ext(gem_num, inertial_state->ext);
|
ds3_input_to_ext(gem_num, inertial_state->ext);
|
||||||
|
|
||||||
inertial_state->timestamp = gem.timer.GetElapsedTimeInMicroSec();
|
inertial_state->timestamp = (get_guest_system_time() - gem.start_timestamp);
|
||||||
inertial_state->counter = gem.inertial_counter++;
|
inertial_state->counter = gem.inertial_counter++;
|
||||||
inertial_state->accelerometer[0] = 10;
|
inertial_state->accelerometer[0] = 10;
|
||||||
}
|
}
|
||||||
|
@ -876,7 +876,7 @@ error_code cellGemGetState(u32 gem_num, u32 flag, u64 time_parameter, vm::ptr<Ce
|
||||||
ds3_input_to_ext(gem_num, gem_state->ext);
|
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->tracking_flags = CELL_GEM_TRACKING_FLAG_POSITION_TRACKED | CELL_GEM_TRACKING_FLAG_VISIBLE;
|
||||||
gem_state->timestamp = gem.timer.GetElapsedTimeInMicroSec();
|
gem_state->timestamp = (get_guest_system_time() - gem.start_timestamp);
|
||||||
gem_state->quat[3] = 1.f;
|
gem_state->quat[3] = 1.f;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
|
@ -1006,7 +1006,7 @@ error_code cellGemInit(ppu_thread& ppu, vm::cptr<CellGemAttribute> attribute)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: is this correct?
|
// TODO: is this correct?
|
||||||
gem.timer.Start();
|
gem.start_timestamp = get_guest_system_time();
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
@ -1153,7 +1153,7 @@ error_code cellGemReset(u32 gem_num)
|
||||||
gem.reset_controller(gem_num);
|
gem.reset_controller(gem_num);
|
||||||
|
|
||||||
// TODO: is this correct?
|
// TODO: is this correct?
|
||||||
gem.timer.Start();
|
gem.start_timestamp = get_guest_system_time();
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue