mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-10-06 16:19:09 +00:00
hotkeys work
This commit is contained in:
parent
fc7b9e4e8f
commit
10588ff22c
9 changed files with 56 additions and 49 deletions
|
@ -17,6 +17,9 @@ project(dolphin-emu)
|
||||||
# unique name here.
|
# unique name here.
|
||||||
set(DISTRIBUTOR "None" CACHE STRING "Name of the distributor.")
|
set(DISTRIBUTOR "None" CACHE STRING "Name of the distributor.")
|
||||||
|
|
||||||
|
# Slippi Playback build option
|
||||||
|
add_compile_definitions(IS_PLAYBACK)
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE AND NOT ANDROID)
|
if(UNIX AND NOT APPLE AND NOT ANDROID)
|
||||||
option(ENABLE_X11 "Enables X11 Support" ON)
|
option(ENABLE_X11 "Enables X11 Support" ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -20,7 +20,6 @@ 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
|
||||||
|
|
|
@ -1168,7 +1168,7 @@ void CEXISlippi::prepareFrameData(u8* payload)
|
||||||
g_playbackStatus->lastFrame = m_current_game->GetLatestIndex();
|
g_playbackStatus->lastFrame = m_current_game->GetLatestIndex();
|
||||||
auto isNextFrameFound = g_playbackStatus->lastFrame > frameIndex;
|
auto isNextFrameFound = g_playbackStatus->lastFrame > frameIndex;
|
||||||
auto isFrameComplete = checkFrameFullyFetched(frameIndex);
|
auto isFrameComplete = checkFrameFullyFetched(frameIndex);
|
||||||
auto isFrameReady = !g_playbackStatus->shouldPause && isFrameFound && (isProcessingComplete || isNextFrameFound || isFrameComplete);
|
auto isFrameReady = isFrameFound && (isProcessingComplete || isNextFrameFound || isFrameComplete);
|
||||||
|
|
||||||
// If there is a startFrame configured, manage the fast-forward flag
|
// If there is a startFrame configured, manage the fast-forward flag
|
||||||
if (watchSettings.startFrame > Slippi::GAME_FIRST_FRAME)
|
if (watchSettings.startFrame > Slippi::GAME_FIRST_FRAME)
|
||||||
|
|
|
@ -232,7 +232,6 @@ void SlippiPlaybackStatus::SeekToFrame()
|
||||||
}
|
}
|
||||||
|
|
||||||
targetFrameNum = INT_MAX;
|
targetFrameNum = INT_MAX;
|
||||||
shouldPause = false;
|
|
||||||
Core::SetState(prevState);
|
Core::SetState(prevState);
|
||||||
seekMtx.unlock();
|
seekMtx.unlock();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -19,7 +19,6 @@ public:
|
||||||
bool shouldJumpBack = false;
|
bool shouldJumpBack = false;
|
||||||
bool shouldJumpForward = false;
|
bool shouldJumpForward = false;
|
||||||
bool inSlippiPlayback = false;
|
bool inSlippiPlayback = false;
|
||||||
volatile bool shouldPause = false;
|
|
||||||
volatile bool shouldRunThreads = false;
|
volatile bool shouldRunThreads = false;
|
||||||
bool isHardFFW = false;
|
bool isHardFFW = false;
|
||||||
bool isSoftFFW = false;
|
bool isSoftFFW = false;
|
||||||
|
|
|
@ -509,11 +509,13 @@ void HotkeyScheduler::Run()
|
||||||
Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, "");
|
Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef IS_PLAYBACK
|
#ifdef IS_PLAYBACK
|
||||||
// Slippi Playback
|
// Slippi Playback
|
||||||
if (IsHotkey(HK_SLIPPI_JUMP_BACK))
|
if (IsHotkey(HK_SLIPPI_JUMP_BACK))
|
||||||
{
|
{
|
||||||
|
INFO_LOG(SLIPPI, "jump back");
|
||||||
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
||||||
g_playbackStatus->targetFrameNum = g_playbackStatus->currentPlaybackFrame - 1200;
|
g_playbackStatus->targetFrameNum = g_playbackStatus->currentPlaybackFrame - 1200;
|
||||||
Host_PlaybackSeek();
|
Host_PlaybackSeek();
|
||||||
|
@ -522,6 +524,7 @@ void HotkeyScheduler::Run()
|
||||||
|
|
||||||
if (IsHotkey(HK_SLIPPI_STEP_BACK))
|
if (IsHotkey(HK_SLIPPI_STEP_BACK))
|
||||||
{
|
{
|
||||||
|
INFO_LOG(SLIPPI, "step back");
|
||||||
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
||||||
g_playbackStatus->targetFrameNum = g_playbackStatus->currentPlaybackFrame - 300;
|
g_playbackStatus->targetFrameNum = g_playbackStatus->currentPlaybackFrame - 300;
|
||||||
Host_PlaybackSeek();
|
Host_PlaybackSeek();
|
||||||
|
@ -530,6 +533,7 @@ void HotkeyScheduler::Run()
|
||||||
|
|
||||||
if (IsHotkey(HK_SLIPPI_STEP_FORWARD))
|
if (IsHotkey(HK_SLIPPI_STEP_FORWARD))
|
||||||
{
|
{
|
||||||
|
INFO_LOG(SLIPPI, "step forward");
|
||||||
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
||||||
g_playbackStatus->targetFrameNum = g_playbackStatus->currentPlaybackFrame + 300;
|
g_playbackStatus->targetFrameNum = g_playbackStatus->currentPlaybackFrame + 300;
|
||||||
Host_PlaybackSeek();
|
Host_PlaybackSeek();
|
||||||
|
@ -538,6 +542,7 @@ void HotkeyScheduler::Run()
|
||||||
|
|
||||||
if (IsHotkey(HK_SLIPPI_JUMP_FORWARD))
|
if (IsHotkey(HK_SLIPPI_JUMP_FORWARD))
|
||||||
{
|
{
|
||||||
|
INFO_LOG(SLIPPI, "jump forward");
|
||||||
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
||||||
g_playbackStatus->targetFrameNum = g_playbackStatus->currentPlaybackFrame + 1200;
|
g_playbackStatus->targetFrameNum = g_playbackStatus->currentPlaybackFrame + 1200;
|
||||||
Host_PlaybackSeek();
|
Host_PlaybackSeek();
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <chrono>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -18,10 +17,12 @@
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/Timer.h"
|
#include "Common/Timer.h"
|
||||||
#include "Core/Core.h"
|
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
|
#include "Core/Core.h"
|
||||||
#include "Core/Host.h"
|
#include "Core/Host.h"
|
||||||
#include "Core/Slippi/SlippiPlayback.h"
|
#include "Core/Slippi/SlippiPlayback.h"
|
||||||
|
|
||||||
#include "VideoCommon/OnScreenDisplay.h"
|
#include "VideoCommon/OnScreenDisplay.h"
|
||||||
#include "VideoCommon/IconsFontAwesome4.h"
|
#include "VideoCommon/IconsFontAwesome4.h"
|
||||||
|
|
||||||
|
@ -46,6 +47,7 @@ struct Message
|
||||||
};
|
};
|
||||||
static std::multimap<MessageType, Message> s_messages;
|
static std::multimap<MessageType, Message> s_messages;
|
||||||
static std::mutex s_messages_mutex;
|
static std::mutex s_messages_mutex;
|
||||||
|
|
||||||
static s32 frame = 0;
|
static s32 frame = 0;
|
||||||
|
|
||||||
static std::string GetTimeForFrame(s32 currFrame) {
|
static std::string GetTimeForFrame(s32 currFrame) {
|
||||||
|
@ -422,9 +424,7 @@ 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;
|
|
||||||
//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;
|
|
||||||
// INFO_LOG(SLIPPI, "playing");
|
// INFO_LOG(SLIPPI, "playing");
|
||||||
//}
|
//}
|
||||||
//ImGui::SameLine(0.0f, 5.0f);
|
//ImGui::SameLine(0.0f, 5.0f);
|
||||||
|
|
|
@ -919,12 +919,14 @@ bool Renderer::InitializeImGui()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef IS_PLAYBACK
|
||||||
ImFontConfig config;
|
ImFontConfig config;
|
||||||
config.MergeMode = true;
|
config.MergeMode = true;
|
||||||
ImGui::GetIO().Fonts->AddFontFromFileTTF("Roboto-Medium.ttf", 14.0f, 0, ImGui::GetIO().Fonts->GetGlyphRangesDefault());
|
ImGui::GetIO().Fonts->AddFontFromFileTTF("Roboto-Medium.ttf", 14.0f, 0, ImGui::GetIO().Fonts->GetGlyphRangesDefault());
|
||||||
static const ImWchar icons_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
|
static const ImWchar icons_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
|
||||||
ImFontConfig icons_config; icons_config.MergeMode = true; icons_config.PixelSnapH = true;
|
ImFontConfig icons_config; icons_config.MergeMode = true; icons_config.PixelSnapH = true;
|
||||||
ImGui::GetIO().Fonts->AddFontFromFileTTF(FONT_ICON_FILE_NAME_FA, 16.0f, &icons_config, icons_ranges);
|
ImGui::GetIO().Fonts->AddFontFromFileTTF(FONT_ICON_FILE_NAME_FA, 16.0f, &icons_config, icons_ranges);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Don't create an ini file. TODO: Do we want this in the future?
|
// Don't create an ini file. TODO: Do we want this in the future?
|
||||||
ImGui::GetIO().IniFilename = nullptr;
|
ImGui::GetIO().IniFilename = nullptr;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue