mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-09-10 19:45:49 +00:00
hotkeys
This commit is contained in:
parent
32732ee0a7
commit
68680b7e8b
9 changed files with 81 additions and 22 deletions
1
Externals/SlippiLib/SlippiGame.cpp
vendored
1
Externals/SlippiLib/SlippiGame.cpp
vendored
|
@ -452,7 +452,6 @@ namespace Slippi {
|
||||||
break;
|
break;
|
||||||
case EVENT_FRAME_START:
|
case EVENT_FRAME_START:
|
||||||
handleFrameStart(game.get(), payloadSize);
|
handleFrameStart(game.get(), payloadSize);
|
||||||
isProcessingComplete = false; // SLIPPITODO remove after getting on par with ishii
|
|
||||||
break;
|
break;
|
||||||
case EVENT_PRE_FRAME_UPDATE:
|
case EVENT_PRE_FRAME_UPDATE:
|
||||||
handlePreFrameUpdate(game.get(), payloadSize);
|
handlePreFrameUpdate(game.get(), payloadSize);
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace Common
|
||||||
|
|
||||||
#define SLIPPI_REV_STR "2.1.1"
|
#define SLIPPI_REV_STR "2.1.1"
|
||||||
|
|
||||||
|
#define IS_PLAYBACK 1
|
||||||
const std::string scm_slippi_semver_str = SLIPPI_REV_STR;
|
const std::string scm_slippi_semver_str = SLIPPI_REV_STR;
|
||||||
|
|
||||||
#ifdef IS_PLAYBACK
|
#ifdef IS_PLAYBACK
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#include "Core/Slippi/SlippiReplayComm.h"
|
#include "Core/Slippi/SlippiReplayComm.h"
|
||||||
#include "Core/Slippi/SlippiPlayback.h"
|
#include "Core/Slippi/SlippiPlayback.h"
|
||||||
#include "Core/State.h"
|
#include "Core/State.h"
|
||||||
#include "VideoCommon/OnScreenDisplay.h"
|
|
||||||
|
|
||||||
#define FRAME_INTERVAL 900
|
#define FRAME_INTERVAL 900
|
||||||
#define SLEEP_TIME_MS 8
|
#define SLEEP_TIME_MS 8
|
||||||
|
|
|
@ -194,8 +194,8 @@ constexpr std::array<const char*, 142> s_hotkey_labels{{
|
||||||
|
|
||||||
// Slippi Playback
|
// Slippi Playback
|
||||||
_trans("Jump backwards in Slippi replay"),
|
_trans("Jump backwards in Slippi replay"),
|
||||||
_trans("Pause/unpause Slippi replay"),
|
_trans("Step backwards in Slippi replay"),
|
||||||
_trans("Advance one frame in Slippi replay"),
|
_trans("Step forwards in Slippi replay"),
|
||||||
_trans("Jump forwards in Slippi replay"),
|
_trans("Jump forwards in Slippi replay"),
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ constexpr std::array<HotkeyGroupInfo, NUM_HOTKEY_GROUPS> s_groups_info = {
|
||||||
{_trans("Select State"), HK_SELECT_STATE_SLOT_1, HK_SELECT_STATE_SLOT_10},
|
{_trans("Select State"), HK_SELECT_STATE_SLOT_1, HK_SELECT_STATE_SLOT_10},
|
||||||
{_trans("Load Last State"), HK_LOAD_LAST_STATE_1, HK_LOAD_LAST_STATE_10},
|
{_trans("Load Last State"), HK_LOAD_LAST_STATE_1, HK_LOAD_LAST_STATE_10},
|
||||||
{_trans("Other State Hotkeys"), HK_SAVE_FIRST_STATE, HK_LOAD_STATE_FILE},
|
{_trans("Other State Hotkeys"), HK_SAVE_FIRST_STATE, HK_LOAD_STATE_FILE},
|
||||||
{_trans("Slippi playback controls"), HK_JUMP_BACK, HK_JUMP_FORWARD} } };
|
{_trans("Slippi playback controls"), HK_SLIPPI_JUMP_BACK, HK_SLIPPI_JUMP_FORWARD} } };
|
||||||
|
|
||||||
HotkeyManager::HotkeyManager()
|
HotkeyManager::HotkeyManager()
|
||||||
{
|
{
|
||||||
|
@ -496,4 +496,29 @@ void HotkeyManager::LoadDefaults(const ControllerInterface& ciface)
|
||||||
}
|
}
|
||||||
set_key_expression(HK_UNDO_LOAD_STATE, NON + " & `F12`");
|
set_key_expression(HK_UNDO_LOAD_STATE, NON + " & `F12`");
|
||||||
set_key_expression(HK_UNDO_SAVE_STATE, SHIFT + " & `F12`");
|
set_key_expression(HK_UNDO_SAVE_STATE, SHIFT + " & `F12`");
|
||||||
|
|
||||||
|
// Slippi Playback
|
||||||
|
// #ifdef PLAYBACK
|
||||||
|
#ifdef _WIN32
|
||||||
|
set_key_expression(HK_SLIPPI_JUMP_BACK, SHIFT + " & `LEFT`");
|
||||||
|
set_key_expression(HK_SLIPPI_STEP_BACK, NON + " & `LEFT`");
|
||||||
|
set_key_expression(HK_FRAME_ADVANCE, NON + " & `PERIOD`");
|
||||||
|
set_key_expression(HK_PLAY_PAUSE, NON + " & `SPACE`");
|
||||||
|
set_key_expression(HK_SLIPPI_STEP_FORWARD, NON + " & `RIGHT`");
|
||||||
|
set_key_expression(HK_SLIPPI_JUMP_FORWARD, SHIFT + " & `RIGHT`");
|
||||||
|
#elif __APPLE__
|
||||||
|
set_key_expression(HK_SLIPPI_JUMP_BACK, SHIFT + " & `Left Arrow`");
|
||||||
|
set_key_expression(HK_SLIPPI_JUMP_BACK, NON + " & `Left Arrow`");
|
||||||
|
set_key_expression(HK_FRAME_ADVANCE, NON + " & `.`");
|
||||||
|
set_key_expression(HK_PLAY_PAUSE, NON + "& `Space`");
|
||||||
|
set_key_expression(HK_SLIPPI_STEP_FORWARD, NON + " & `Right Arrow`");
|
||||||
|
set_key_expression(HK_SLIPPI_JUMP_FORWARD, SHIFT + " & `Right Arrow`");
|
||||||
|
#else
|
||||||
|
set_key_expression(HK_SLIPPI_JUMP_BACK, SHIFT + " & `Left`");
|
||||||
|
set_key_expression(HK_SLIPPI_JUMP_BACK, NON + "Left");
|
||||||
|
set_key_expression(HK_FRAME_ADVANCE, NON + " & `period`");
|
||||||
|
set_key_expression(HK_PLAY_PAUSE, NON + "& `space`");
|
||||||
|
set_key_expression(HK_SLIPPI_STEP_FORWARD, NON + " & `Right`");
|
||||||
|
set_key_expression(HK_SLIPPI_JUMP_FORWARD, SHIFT + " & `Right`");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,10 +178,10 @@ enum Hotkey
|
||||||
HK_LOAD_STATE_FILE,
|
HK_LOAD_STATE_FILE,
|
||||||
|
|
||||||
// Slippi Playback
|
// Slippi Playback
|
||||||
HK_JUMP_BACK,
|
HK_SLIPPI_JUMP_BACK,
|
||||||
HK_TOGGLE_PLAY_PAUSE,
|
HK_SLIPPI_STEP_BACK,
|
||||||
HK_NEXT_FRAME,
|
HK_SLIPPI_STEP_FORWARD,
|
||||||
HK_JUMP_FORWARD,
|
HK_SLIPPI_JUMP_FORWARD,
|
||||||
|
|
||||||
NUM_HOTKEYS,
|
NUM_HOTKEYS,
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,11 +40,6 @@ signals:
|
||||||
void RequestLowerWindow();
|
void RequestLowerWindow();
|
||||||
void RequestExit();
|
void RequestExit();
|
||||||
void RequestSeek();
|
void RequestSeek();
|
||||||
void RequestPausePlay();
|
|
||||||
void RequestSkipBack();
|
|
||||||
void RequestSkipBackBig();
|
|
||||||
void RequestSkipForward();
|
|
||||||
void RequestSkipForwardBig();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Host();
|
Host();
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "Core/IOS/IOS.h"
|
#include "Core/IOS/IOS.h"
|
||||||
#include "Core/IOS/USB/Bluetooth/BTBase.h"
|
#include "Core/IOS/USB/Bluetooth/BTBase.h"
|
||||||
#include "Core/State.h"
|
#include "Core/State.h"
|
||||||
|
#include "Core/Slippi/SlippiPlayback.h"
|
||||||
|
|
||||||
#include "DolphinQt/Settings.h"
|
#include "DolphinQt/Settings.h"
|
||||||
|
|
||||||
|
@ -36,6 +37,8 @@
|
||||||
#include "VideoCommon/VertexShaderManager.h"
|
#include "VideoCommon/VertexShaderManager.h"
|
||||||
#include "VideoCommon/VideoConfig.h"
|
#include "VideoCommon/VideoConfig.h"
|
||||||
|
|
||||||
|
extern std::unique_ptr<SlippiPlaybackStatus> g_playbackStatus;
|
||||||
|
|
||||||
constexpr const char* DUBOIS_ALGORITHM_SHADER = "dubois";
|
constexpr const char* DUBOIS_ALGORITHM_SHADER = "dubois";
|
||||||
|
|
||||||
HotkeyScheduler::HotkeyScheduler() : m_stop_requested(false)
|
HotkeyScheduler::HotkeyScheduler() : m_stop_requested(false)
|
||||||
|
@ -506,7 +509,41 @@ void HotkeyScheduler::Run()
|
||||||
Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, "");
|
Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
#ifdef IS_PLAYBACK
|
||||||
|
// Slippi Playback
|
||||||
|
if (IsHotkey(HK_SLIPPI_JUMP_BACK))
|
||||||
|
{
|
||||||
|
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
||||||
|
g_playbackStatus->targetFrameNum = g_playbackStatus->currentPlaybackFrame - 1200;
|
||||||
|
Host_PlaybackSeek();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsHotkey(HK_SLIPPI_STEP_BACK))
|
||||||
|
{
|
||||||
|
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
||||||
|
g_playbackStatus->targetFrameNum = g_playbackStatus->currentPlaybackFrame - 300;
|
||||||
|
Host_PlaybackSeek();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsHotkey(HK_SLIPPI_STEP_FORWARD))
|
||||||
|
{
|
||||||
|
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
||||||
|
g_playbackStatus->targetFrameNum = g_playbackStatus->currentPlaybackFrame + 300;
|
||||||
|
Host_PlaybackSeek();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsHotkey(HK_SLIPPI_JUMP_FORWARD))
|
||||||
|
{
|
||||||
|
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
||||||
|
g_playbackStatus->targetFrameNum = g_playbackStatus->currentPlaybackFrame + 1200;
|
||||||
|
Host_PlaybackSeek();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const auto stereo_depth = Config::Get(Config::GFX_STEREO_DEPTH);
|
const auto stereo_depth = Config::Get(Config::GFX_STEREO_DEPTH);
|
||||||
|
|
||||||
|
|
|
@ -422,12 +422,12 @@ void DrawSlippiPlaybackControls()
|
||||||
}
|
}
|
||||||
ImGui::SetCursorPos(ImVec2(0.0f, ImGui::GetWindowHeight() - 30));
|
ImGui::SetCursorPos(ImVec2(0.0f, ImGui::GetWindowHeight() - 30));
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.5f, 0.45f));
|
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.5f, 0.45f));
|
||||||
auto const paused = g_playbackStatus->shouldPause;
|
//auto const paused = g_playbackStatus->shouldPause;
|
||||||
if (ButtonCustom(paused ? ICON_FA_PLAY : ICON_FA_PAUSE, ImVec2(40.0f, 32.0f))) {
|
//if (ButtonCustom(paused ? ICON_FA_PLAY : ICON_FA_PAUSE, ImVec2(40.0f, 32.0f))) {
|
||||||
g_playbackStatus->shouldPause = !paused;
|
// g_playbackStatus->shouldPause = !paused;
|
||||||
INFO_LOG(SLIPPI, "playing");
|
// INFO_LOG(SLIPPI, "playing");
|
||||||
}
|
//}
|
||||||
ImGui::SameLine(0.0f, 5.0f);
|
//ImGui::SameLine(0.0f, 5.0f);
|
||||||
if (ButtonCustom(ICON_FA_FAST_BACKWARD, ImVec2(32.0f, 32.0f))) {
|
if (ButtonCustom(ICON_FA_FAST_BACKWARD, ImVec2(32.0f, 32.0f))) {
|
||||||
INFO_LOG(SLIPPI, "fast back");
|
INFO_LOG(SLIPPI, "fast back");
|
||||||
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
||||||
|
@ -461,7 +461,7 @@ void DrawSlippiPlaybackControls()
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||||
ImGui::SetCursorPos(ImVec2(180.0f, window->DC.CursorPosPrevLine.y + 6.0f));
|
ImGui::SetCursorPos(ImVec2(135.0f, window->DC.CursorPosPrevLine.y + 6.0f));
|
||||||
|
|
||||||
auto playbackTime = GetTimeForFrame(g_playbackStatus->currentPlaybackFrame);
|
auto playbackTime = GetTimeForFrame(g_playbackStatus->currentPlaybackFrame);
|
||||||
auto endTime = GetTimeForFrame(g_playbackStatus->lastFrame);
|
auto endTime = GetTimeForFrame(g_playbackStatus->lastFrame);
|
||||||
|
|
|
@ -55,3 +55,6 @@ void Host_LowerWindow()
|
||||||
void Host_Exit()
|
void Host_Exit()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
void Host_PlaybackSeek()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue