cellCamera/cellGem: Fix time stretching setting (#10476)

This commit is contained in:
Eladash 2021-06-20 21:25:13 +03:00 committed by GitHub
parent 0531b3d801
commit aaa20c0ff0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 12 deletions

View file

@ -976,7 +976,7 @@ error_code cellCameraStart(s32 dev_num)
return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND;
}
g_camera.timer.Start();
g_camera.start_timestamp = get_guest_system_time();
g_camera.is_streaming = true;
return CELL_OK;
@ -1066,7 +1066,7 @@ error_code cellCameraReadEx(s32 dev_num, vm::ptr<CellCameraReadEx> read)
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->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;
std::lock_guard lock(g_camera.mutex);
g_camera.timer.Stop();
return CELL_OK;
}
@ -1300,7 +1297,7 @@ void camera_context::operator()()
const u64 camera_id = 0;
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
{

View file

@ -417,7 +417,7 @@ public:
shared_mutex mutex;
shared_mutex mutex_notify_data_map;
Timer timer;
u64 start_timestamp = 0;
atomic_t<u8> read_mode{CELL_CAMERA_READ_FUNCCALL};
atomic_t<bool> is_streaming{false};

View file

@ -106,7 +106,7 @@ struct gem_config
shared_mutex mtx;
Timer timer;
u64 start_timestamp = 0;
// helper functions
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);
inertial_state->timestamp = gem.timer.GetElapsedTimeInMicroSec();
inertial_state->timestamp = (get_guest_system_time() - gem.start_timestamp);
inertial_state->counter = gem.inertial_counter++;
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);
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;
return CELL_OK;
@ -1006,7 +1006,7 @@ error_code cellGemInit(ppu_thread& ppu, vm::cptr<CellGemAttribute> attribute)
}
// TODO: is this correct?
gem.timer.Start();
gem.start_timestamp = get_guest_system_time();
return CELL_OK;
}
@ -1153,7 +1153,7 @@ error_code cellGemReset(u32 gem_num)
gem.reset_controller(gem_num);
// TODO: is this correct?
gem.timer.Start();
gem.start_timestamp = get_guest_system_time();
return CELL_OK;
}