2015-05-24 06:55:12 +02:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-18 01:08:10 +02:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 22:43:11 -04:00
|
|
|
// Refer to the license.txt file included.
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2014-02-10 13:54:46 -05:00
|
|
|
#pragma once
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2018-04-08 13:10:22 +02:00
|
|
|
#include <array>
|
2017-04-02 01:45:11 -04:00
|
|
|
#include <functional>
|
2017-12-25 18:07:29 +01:00
|
|
|
#include <optional>
|
2014-02-19 13:09:14 -05:00
|
|
|
#include <string>
|
|
|
|
|
2014-09-07 20:06:58 -05:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-07-07 05:30:06 +02:00
|
|
|
|
2017-05-27 15:43:40 +02:00
|
|
|
struct BootParameters;
|
|
|
|
|
2014-07-27 13:37:09 -04:00
|
|
|
struct GCPadStatus;
|
|
|
|
class PointerWrap;
|
2011-12-15 09:22:16 -08:00
|
|
|
|
2019-01-05 07:09:11 -06:00
|
|
|
namespace WiimoteCommon
|
|
|
|
{
|
|
|
|
class DataReportBuilder;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace WiimoteEmu
|
|
|
|
{
|
|
|
|
class EncryptionKey;
|
|
|
|
}
|
|
|
|
|
2011-06-24 06:50:50 +00:00
|
|
|
// Per-(video )Movie actions
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2014-03-12 15:33:41 -04:00
|
|
|
namespace Movie
|
|
|
|
{
|
2010-06-09 01:37:08 +00:00
|
|
|
// Enumerations and structs
|
2014-03-12 15:33:41 -04:00
|
|
|
enum PlayMode
|
|
|
|
{
|
2016-06-24 10:43:46 +02:00
|
|
|
MODE_NONE = 0,
|
|
|
|
MODE_RECORDING,
|
|
|
|
MODE_PLAYING
|
2010-06-09 01:37:08 +00:00
|
|
|
};
|
|
|
|
|
2014-06-07 11:30:39 +09:00
|
|
|
// GameCube Controller State
|
2016-06-24 10:43:46 +02:00
|
|
|
#pragma pack(push, 1)
|
2014-03-12 15:33:41 -04:00
|
|
|
struct ControllerState
|
|
|
|
{
|
2016-06-24 10:43:46 +02:00
|
|
|
bool Start : 1, A : 1, B : 1, X : 1, Y : 1, Z : 1; // Binary buttons, 6 bits
|
|
|
|
bool DPadUp : 1, DPadDown : 1, // Binary D-Pad buttons, 4 bits
|
|
|
|
DPadLeft : 1, DPadRight : 1;
|
2017-02-09 15:03:43 -08:00
|
|
|
bool L : 1, R : 1; // Binary triggers, 2 bits
|
|
|
|
bool disc : 1; // Checks for disc being changed
|
|
|
|
bool reset : 1; // Console reset button
|
|
|
|
bool is_connected : 1; // Should controller be treated as connected
|
|
|
|
bool reserved : 1; // Reserved bits used for padding, 1 bit
|
2016-06-24 10:43:46 +02:00
|
|
|
|
|
|
|
u8 TriggerL, TriggerR; // Triggers, 16 bits
|
|
|
|
u8 AnalogStickX, AnalogStickY; // Main Stick, 16 bits
|
|
|
|
u8 CStickX, CStickY; // Sub-Stick, 16 bits
|
2014-11-02 01:58:59 -05:00
|
|
|
};
|
2012-10-21 17:48:45 -04:00
|
|
|
static_assert(sizeof(ControllerState) == 8, "ControllerState should be 8 bytes");
|
2010-07-22 04:16:51 +00:00
|
|
|
#pragma pack(pop)
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2017-11-19 17:37:36 +01:00
|
|
|
// When making changes to the DTM format, keep in mind that there are programs other
|
|
|
|
// than Dolphin that parse DTM files. The format is expected to be relatively stable.
|
2016-06-24 10:43:46 +02:00
|
|
|
#pragma pack(push, 1)
|
2014-03-12 15:33:41 -04:00
|
|
|
struct DTMHeader
|
|
|
|
{
|
2018-04-08 13:10:22 +02:00
|
|
|
std::array<u8, 4> filetype; // Unique Identifier (always "DTM"0x1A)
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2018-04-08 13:10:22 +02:00
|
|
|
std::array<char, 6> gameID; // The Game ID
|
|
|
|
bool bWii; // Wii game
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2016-12-24 18:27:56 +01:00
|
|
|
u8 controllers; // Controllers plugged in (from least to most significant,
|
|
|
|
// the bits are GC controllers 1-4 and Wiimotes 1-4)
|
2016-06-24 10:43:46 +02:00
|
|
|
|
|
|
|
bool
|
|
|
|
bFromSaveState; // false indicates that the recording started from bootup, true for savestate
|
|
|
|
u64 frameCount; // Number of frames in the recording
|
|
|
|
u64 inputCount; // Number of input frames in recording
|
|
|
|
u64 lagCount; // Number of lag frames in the recording
|
|
|
|
u64 uniqueID; // (not implemented) A Unique ID comprised of: md5(time + Game ID)
|
|
|
|
u32 numRerecords; // Number of rerecords/'cuts' of this TAS
|
2018-04-08 13:10:22 +02:00
|
|
|
std::array<char, 32> author; // Author's name (encoded in UTF-8)
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2018-04-08 13:10:22 +02:00
|
|
|
std::array<char, 16> videoBackend; // UTF-8 representation of the video backend
|
|
|
|
std::array<char, 16> audioEmulator; // UTF-8 representation of the audio emulator
|
|
|
|
std::array<u8, 16> md5; // MD5 of game iso
|
2016-06-24 10:43:46 +02:00
|
|
|
|
|
|
|
u64 recordingStartTime; // seconds since 1970 that recording started (used for RTC)
|
|
|
|
|
|
|
|
bool bSaveConfig; // Loads the settings below on startup if true
|
|
|
|
bool bSkipIdle;
|
|
|
|
bool bDualCore;
|
|
|
|
bool bProgressive;
|
|
|
|
bool bDSPHLE;
|
|
|
|
bool bFastDiscSpeed;
|
2017-05-19 16:57:31 +02:00
|
|
|
u8 CPUCore; // Uses the values of PowerPC::CPUCore
|
2016-06-24 10:43:46 +02:00
|
|
|
bool bEFBAccessEnable;
|
|
|
|
bool bEFBCopyEnable;
|
|
|
|
bool bSkipEFBCopyToRam;
|
|
|
|
bool bEFBCopyCacheEnable;
|
|
|
|
bool bEFBEmulateFormatChanges;
|
2017-11-19 17:37:36 +01:00
|
|
|
bool bImmediateXFB;
|
|
|
|
bool bSkipXFBCopyToRam;
|
2016-12-24 18:27:56 +01:00
|
|
|
u8 memcards; // Memcards inserted (from least to most significant, the bits are slot A and B)
|
2016-06-24 10:43:46 +02:00
|
|
|
bool bClearSave; // Create a new memory card when playing back a movie if true
|
2016-12-24 18:27:56 +01:00
|
|
|
u8 bongos; // Bongos plugged in (from least to most significant, the bits are ports 1-4)
|
2016-06-24 10:43:46 +02:00
|
|
|
bool bSyncGPU;
|
|
|
|
bool bNetPlay;
|
|
|
|
bool bPAL60;
|
|
|
|
u8 language;
|
2018-06-29 16:48:30 -04:00
|
|
|
bool bReducePollingRate;
|
2018-07-08 21:26:34 +02:00
|
|
|
bool bFollowBranch;
|
|
|
|
std::array<u8, 9> reserved; // Padding for any new config options
|
2018-04-08 13:10:22 +02:00
|
|
|
std::array<char, 40> discChange; // Name of iso file to switch to, for two disc games.
|
|
|
|
std::array<u8, 20> revision; // Git hash
|
2016-06-24 10:43:46 +02:00
|
|
|
u32 DSPiromHash;
|
|
|
|
u32 DSPcoefHash;
|
2018-04-08 13:10:22 +02:00
|
|
|
u64 tickCount; // Number of ticks in the recording
|
|
|
|
std::array<u8, 11> reserved2; // Make heading 256 bytes, just because we can
|
2010-07-22 04:16:51 +00:00
|
|
|
};
|
2012-10-20 19:54:38 -04:00
|
|
|
static_assert(sizeof(DTMHeader) == 256, "DTMHeader should be 256 bytes");
|
|
|
|
|
2010-07-22 04:16:51 +00:00
|
|
|
#pragma pack(pop)
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
void FrameUpdate();
|
2011-03-17 10:41:56 +00:00
|
|
|
void InputUpdate();
|
2017-05-27 15:43:40 +02:00
|
|
|
void Init(const BootParameters& boot);
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
void SetPolledDevice();
|
|
|
|
|
|
|
|
bool IsRecordingInput();
|
2011-02-15 09:07:55 +00:00
|
|
|
bool IsRecordingInputFromSaveState();
|
2011-12-14 04:03:05 -08:00
|
|
|
bool IsJustStartingRecordingInputFromSaveState();
|
2012-10-18 04:03:12 -04:00
|
|
|
bool IsJustStartingPlayingInputFromSaveState();
|
2010-06-09 01:37:08 +00:00
|
|
|
bool IsPlayingInput();
|
2014-09-06 23:44:25 -04:00
|
|
|
bool IsMovieActive();
|
2011-07-11 20:15:05 +00:00
|
|
|
bool IsReadOnly();
|
2016-06-24 10:43:46 +02:00
|
|
|
u64 GetRecordingStartTime();
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2016-08-04 12:54:45 -04:00
|
|
|
u64 GetCurrentFrame();
|
|
|
|
u64 GetTotalFrames();
|
|
|
|
u64 GetCurrentInputCount();
|
|
|
|
u64 GetTotalInputCount();
|
|
|
|
u64 GetCurrentLagCount();
|
|
|
|
u64 GetTotalLagCount();
|
|
|
|
|
2016-12-23 20:37:23 -05:00
|
|
|
void SetClearSave(bool enabled);
|
2016-08-21 12:51:14 +02:00
|
|
|
void SignalDiscChange(const std::string& new_path);
|
2016-08-04 12:54:45 -04:00
|
|
|
void SetReset(bool reset);
|
|
|
|
|
2012-10-18 04:18:40 -04:00
|
|
|
bool IsConfigSaved();
|
2012-10-25 02:44:30 -04:00
|
|
|
bool IsStartingFromClearSave();
|
2014-07-02 21:45:59 -04:00
|
|
|
bool IsUsingMemcard(int memcard);
|
2012-10-18 04:18:40 -04:00
|
|
|
void SetGraphicsConfig();
|
2013-09-03 15:50:41 -04:00
|
|
|
bool IsNetPlayRecording();
|
2012-10-18 04:18:40 -04:00
|
|
|
|
2010-09-06 21:41:01 +00:00
|
|
|
bool IsUsingPad(int controller);
|
2011-02-11 19:09:46 +00:00
|
|
|
bool IsUsingWiimote(int wiimote);
|
2012-12-18 23:19:15 -05:00
|
|
|
bool IsUsingBongo(int controller);
|
2019-01-26 10:29:06 -06:00
|
|
|
void ChangePads();
|
2011-07-11 20:15:05 +00:00
|
|
|
void ChangeWiiPads(bool instantly = false);
|
2010-09-06 21:41:01 +00:00
|
|
|
|
2011-02-12 02:14:20 +00:00
|
|
|
void SetReadOnly(bool bEnabled);
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2010-08-30 07:05:47 +00:00
|
|
|
bool BeginRecordingInput(int controllers);
|
2018-06-21 12:08:59 -04:00
|
|
|
void RecordInput(const GCPadStatus* PadStatus, int controllerID);
|
|
|
|
void RecordWiimote(int wiimote, const u8* data, u8 size);
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2017-12-25 18:07:29 +01:00
|
|
|
bool PlayInput(const std::string& movie_path, std::optional<std::string>* savestate_path);
|
|
|
|
void LoadInput(const std::string& movie_path);
|
2012-10-20 14:18:42 -04:00
|
|
|
void ReadHeader();
|
2014-07-10 22:02:32 -04:00
|
|
|
void PlayController(GCPadStatus* PadStatus, int controllerID);
|
2019-01-01 08:32:39 -06:00
|
|
|
bool PlayWiimote(int wiimote, WiimoteCommon::DataReportBuilder& rpt, int ext,
|
|
|
|
const WiimoteEmu::EncryptionKey& key);
|
2011-02-15 17:03:20 +00:00
|
|
|
void EndPlayInput(bool cont);
|
2014-03-12 15:33:41 -04:00
|
|
|
void SaveRecording(const std::string& filename);
|
2016-06-24 10:43:46 +02:00
|
|
|
void DoState(PointerWrap& p);
|
2012-11-24 18:27:20 -05:00
|
|
|
void Shutdown();
|
2018-06-21 12:08:59 -04:00
|
|
|
void CheckPadStatus(const GCPadStatus* PadStatus, int controllerID);
|
2019-01-01 08:32:39 -06:00
|
|
|
void CheckWiimoteStatus(int wiimote, const WiimoteCommon::DataReportBuilder& rpt, int ext,
|
|
|
|
const WiimoteEmu::EncryptionKey& key);
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2011-02-17 09:12:36 +00:00
|
|
|
std::string GetInputDisplay();
|
2016-07-19 20:23:25 -04:00
|
|
|
std::string GetRTCDisplay();
|
2011-06-24 06:50:50 +00:00
|
|
|
|
|
|
|
// Done this way to avoid mixing of core and gui code
|
2017-04-02 01:45:11 -04:00
|
|
|
using GCManipFunction = std::function<void(GCPadStatus*, int)>;
|
2019-01-01 08:32:39 -06:00
|
|
|
using WiiManipFunction = std::function<void(WiimoteCommon::DataReportBuilder&, int, int,
|
|
|
|
const WiimoteEmu::EncryptionKey&)>;
|
2011-06-24 06:50:50 +00:00
|
|
|
|
2014-09-14 23:42:32 -04:00
|
|
|
void SetGCInputManip(GCManipFunction);
|
|
|
|
void SetWiiInputManip(WiiManipFunction);
|
|
|
|
void CallGCInputManip(GCPadStatus* PadStatus, int controllerID);
|
2019-01-01 08:32:39 -06:00
|
|
|
void CallWiiInputManip(WiimoteCommon::DataReportBuilder& rpt, int controllerID, int ext,
|
|
|
|
const WiimoteEmu::EncryptionKey& key);
|
2018-06-29 16:48:30 -04:00
|
|
|
} // namespace Movie
|