Merge pull request #2882 from danzel/movie-squash

Movie (Game Inputs) recording and playback
This commit is contained in:
James Rowe 2018-01-23 01:03:37 -07:00 committed by GitHub
commit 44d07574b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 673 additions and 41 deletions

View file

@ -16,6 +16,8 @@
#include "core/hle/service/hid/hid_spvr.h"
#include "core/hle/service/hid/hid_user.h"
#include "core/hle/service/service.h"
#include "core/movie.h"
#include "video_core/video_core.h"
namespace Service {
namespace HID {
@ -96,6 +98,9 @@ void Module::UpdatePadCallback(u64 userdata, int cycles_late) {
constexpr int MAX_CIRCLEPAD_POS = 0x9C; // Max value for a circle pad position
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);
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);
state.circle_down.Assign(direction.down);
@ -141,6 +146,8 @@ void Module::UpdatePadCallback(u64 userdata, int cycles_late) {
touch_entry.y = static_cast<u16>(y * Core::kScreenBottomHeight);
touch_entry.valid.Assign(pressed ? 1 : 0);
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
// converted to pixel coordinates." (http://3dbrew.org/wiki/HID_Shared_Memory#Offset_0xA8).
@ -179,6 +186,8 @@ void Module::UpdateAccelerometerCallback(u64 userdata, int cycles_late) {
accelerometer_entry.y = static_cast<s16>(accel.y);
accelerometer_entry.z = static_cast<s16>(accel.z);
Core::Movie::GetInstance().HandleAccelerometerStatus(accelerometer_entry);
// Make up "raw" entry
// TODO(wwylele):
// From hardware testing, the raw_entry values are approximately, but not exactly, as twice as
@ -217,6 +226,8 @@ void Module::UpdateGyroscopeCallback(u64 userdata, int cycles_late) {
gyroscope_entry.y = static_cast<s16>(gyro.y);
gyroscope_entry.z = static_cast<s16>(gyro.z);
Core::Movie::GetInstance().HandleGyroscopeStatus(gyroscope_entry);
// Make up "raw" entry
mem->gyroscope.raw_entry.x = gyroscope_entry.x;
mem->gyroscope.raw_entry.z = -gyroscope_entry.y;