core, citra_qt: add frame advancing to framelimiter

Frame advancing is a commonly used TAS feature which basically means running the game frame by frame. TASers use this feature to press exact buttons at the exact frames. This commit added frame advancing to the framelimiter and two actions to the Movie menu. The default hotkey is `\` for advancing frames, and `Ctrl+A` for toggling frame advancing. The `Advance Frame` hotkey would automatically enable frame advancing if not already enabled.
This commit is contained in:
zhupengfei 2018-10-01 23:39:22 +08:00
parent 41688b2f2a
commit cb775eb1ba
No known key found for this signature in database
GPG key ID: DD129E108BD09378
4 changed files with 90 additions and 0 deletions

View file

@ -4,9 +4,11 @@
#pragma once
#include <atomic>
#include <chrono>
#include <mutex>
#include "common/common_types.h"
#include "common/thread.h"
namespace Core {
@ -70,6 +72,14 @@ public:
void DoFrameLimiting(std::chrono::microseconds current_system_time_us);
/**
* Sets whether frame advancing is enabled or not.
* Note: The frontend must cancel frame advancing before shutting down in order
* to resume the emu_thread.
*/
void SetFrameAdvancing(bool value);
void AdvanceFrame();
private:
/// Emulated system time (in microseconds) at the last limiter invocation
std::chrono::microseconds previous_system_time_us{0};
@ -78,6 +88,12 @@ private:
/// Accumulated difference between walltime and emulated time
std::chrono::microseconds frame_limiting_delta_err{0};
/// Whether to use frame advancing (i.e. frame by frame)
std::atomic_bool frame_advancing_enabled;
/// Event to advance the frame when frame advancing is enabled
Common::Event frame_advance_event;
};
} // namespace Core