Files
GTASource/game/replaycoordinator/ReplayCoordinator.h
expvintl 419f2e4752 init
2025-02-23 17:40:52 +08:00

155 lines
4.9 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// FILE : ReplayCoordinator.h
// PURPOSE : Coordinates playback/rendering of replay footage and glues higher level interface
// to underlying raw replay playback.
//
// AUTHOR : james.strain
//
// Copyright (C) 1999-2014 Rockstar Games. All Rights Reserved.
//
/////////////////////////////////////////////////////////////////////////////////
#include "control/replay/ReplaySettings.h"
#if GTA_REPLAY
#ifndef REPLAY_COORDINATOR_H_
#define REPLAY_COORDINATOR_H_
// framework
#include "fwlocalisation/templateString.h"
// game
#include "control/replay/IReplayPlaybackController.h"
#include "frontend/PauseMenu.h"
#include "ReplayEditorParameters.h"
#include "ReplayPlaybackController.h"
class CMontage;
class CReplayPostFxRegistry;
// TODO4FIVE - Extract montage playback elements out of lower level replay system and put in here.
// Then we can update the pass-through functions here to make the decisions themselves!
class CReplayCoordinator
{
public: // declarations and variables
enum eCoordinatorState
{
COORDINATORSTATE_INVALID, // Not activate
COORDINATORSTATE_IDLE, // Active pending further use
COORDINATORSTATE_VIDEO_CLIP_PREVIEW,
COORDINATORSTATE_VIDEO_PREVIEW,
COORDINATORSTATE_VIDEO_PENDING_BAKE,
COORDINATORSTATE_VIDEO_BAKE,
COORDINATORSTATE_VIDEO_BAKE_PAUSED_CALLED,
COORDINATORSTATE_VIDEO_BAKE_PAUSED,
COORDINATORSTATE_VIDEO_BAKE_PENDING_CLEANUP,
COORDINATORSTATE_MAX
};
public: // methods
static void Init(unsigned initMode);
static void Update();
static void Shutdown(unsigned shutdownMode);
static void Activate();
static bool IsActive();
static void Deactivate();
//! Playback Functionality
inline static bool IsIdle() { return ms_currentState == COORDINATORSTATE_IDLE; }
static bool IsCachingForPlayback();
static bool IsPendingNextClip();
static bool IsPreviewingVideo();
static bool IsPreviewingClip();
static bool IsRenderingVideo();
static bool IsPendingVideoFinalization();
static bool HasVideoRenderErrored();
static char const * GetVideoRenderErrorLngKey();
static bool IsVideoRenderReadyForReplay();
static bool HasVideoRenderSuspended();
static bool HasVideoRenderBeenConstrained();
static bool IsRenderingPaused();
static bool DoesCurrentClipContainCutscene();
static bool DoesCurrentClipContainFirstPersonCamera();
static bool DoesCurrentClipDisableCameraMovement();
static bool StartAutogeneratingProject( CReplayEditorParameters::eAutoGenerationDuration const duration );
static bool IsAutogeneratingProject();
static bool HasAutogenerationFailed();
static CMontage* GetAutogeneratedMontage();
static u64 GetActiveUserId();
static bool ShouldShowLoadingScreen();
static bool ShouldShowProcessingText();
static bool HasClipLoadFailed();
static void SetShouldRenderTransitionsInEditMode( bool const shouldRender ) { ms_renderTransitionsInEditMode = shouldRender; }
static bool IsClipUsedInAnyProject( ClipUID const& uid );
static s32 GetIndexOfCurrentPlaybackClip();
static float GetEffectiveCurrentClipTimeMs();
static bool PlayClipPreview( u32 clipIndex, CMontage& montage );
static bool PlayProjectPreview( CMontage& montage );
static bool GetSpaceForVideoBake( size_t& out_availableSpace );
static bool StartBakeProject( CMontage& montage, char const * const outputName );
static bool UpdateBakeProject();
static void PauseBake();
static void ResumeBake();
static void KillPlaybackOrBake( bool userCancelled = true );
static void CleanupPlayback();
static bool IsExportingToVideoFile();
static bool ShouldDisablePopStreamer();
static bool IsSettingUpFirstFrame();
static bool IsPendingPendingBakeStart();
static bool IsPendingCleanup();
static CReplayPlaybackController& GetReplayPlaybackController() { return ms_playbackController; }
static CReplayPlaybackController const& GetReplayPlaybackControllerConst() { return ms_playbackController; }
static CReplayPostFxRegistry& GetPostFxRegistry() { return ms_postfxRegistry; }
static void UpdateOverlaysAndEffects();
//! Render Functionality
static void RenderOverlaysAndEffects();
static void RenderPostFadeOverlaysAndEffects();
static bool ShouldRenderOverlays();
private: // declarations and variables
static eCoordinatorState ms_currentState;
static CReplayPlaybackController ms_playbackController;
static CReplayPostFxRegistry ms_postfxRegistry;
static s32 ms_recordingInstanceIndex;
static s32 ms_recordingInstanceIndexForErrorChecking;
static bool ms_renderTransitionsInEditMode;
private: // methods
static void setState( eCoordinatorState const stateToSet );
static void PrepareForVideoBake();
static void PrepareForAudioBake();
static void CleanupVideoBake();
static void CleanupAudioBake();
static bool ShouldUpdateOverlays();
static bool ShouldRenderTransitions();
static bool IsViewingReplay();
static void CleanupReplayPlaybackInternal();
};
#endif // REPLAY_COORDINATOR_H_
#endif // GTA_REPLAY