Convert Movie to a class with a static instance, and other fixes based on B3n30 feedback.

This commit is contained in:
danzel 2017-12-17 17:55:56 +13:00
parent 04541150b1
commit 0238e0c5e7
7 changed files with 129 additions and 81 deletions

View file

@ -138,7 +138,7 @@ static void UpdatePadCallback(u64 userdata, int cycles_late) {
s16 circle_pad_x = static_cast<s16>(circle_pad_x_f * MAX_CIRCLEPAD_POS);
s16 circle_pad_y = static_cast<s16>(circle_pad_y_f * MAX_CIRCLEPAD_POS);
Movie::HandlePadAndCircleStatus(state, circle_pad_x, circle_pad_y);
Core::Movie::GetInstance().HandlePadAndCircleStatus(state, circle_pad_x, circle_pad_y);
const DirectionState direction = GetStickDirectionState(circle_pad_x, circle_pad_y);
state.circle_up.Assign(direction.up);
@ -185,7 +185,7 @@ static void UpdatePadCallback(u64 userdata, int cycles_late) {
touch_entry.y = static_cast<u16>(y * Core::kScreenBottomHeight);
touch_entry.valid.Assign(pressed ? 1 : 0);
Movie::HandleTouchStatus(touch_entry);
Core::Movie::GetInstance().HandleTouchStatus(touch_entry);
// TODO(bunnei): We're not doing anything with offset 0xA8 + 0x18 of HID SharedMemory, which
// supposedly is "Touch-screen entry, which contains the raw coordinate data prior to being
@ -225,7 +225,7 @@ static void UpdateAccelerometerCallback(u64 userdata, int cycles_late) {
accelerometer_entry.y = static_cast<s16>(accel.y);
accelerometer_entry.z = static_cast<s16>(accel.z);
Movie::HandleAccelerometerStatus(accelerometer_entry);
Core::Movie::GetInstance().HandleAccelerometerStatus(accelerometer_entry);
// Make up "raw" entry
// TODO(wwylele):
@ -265,7 +265,7 @@ static void UpdateGyroscopeCallback(u64 userdata, int cycles_late) {
gyroscope_entry.y = static_cast<s16>(gyro.y);
gyroscope_entry.z = static_cast<s16>(gyro.z);
Movie::HandleGyroscopeStatus(gyroscope_entry);
Core::Movie::GetInstance().HandleGyroscopeStatus(gyroscope_entry);
// Make up "raw" entry
mem->gyroscope.raw_entry.x = gyroscope_entry.x;

View file

@ -194,7 +194,7 @@ void ExtraHID::SendHIDStatus() {
response.buttons.r_not_held.Assign(1);
response.unknown = 0;
Movie::HandleExtraHidResponse(response);
Core::Movie::GetInstance().HandleExtraHidResponse(response);
std::vector<u8> response_buffer(sizeof(response));
memcpy(response_buffer.data(), &response, sizeof(response));

View file

@ -65,7 +65,7 @@ void IR_RST::UpdateCallback(u64 userdata, int cycles_late) {
s16 c_stick_x = static_cast<s16>(c_stick_x_f * MAX_CSTICK_RADIUS);
s16 c_stick_y = static_cast<s16>(c_stick_y_f * MAX_CSTICK_RADIUS);
Movie::HandleIrRst(state, c_stick_x, c_stick_y);
Core::Movie::GetInstance().HandleIrRst(state, c_stick_x, c_stick_y);
if (!raw_c_stick) {
const HID::DirectionState direction = HID::GetStickDirectionState(c_stick_x, c_stick_y);