2015-05-24 06:55:12 +02:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2021-07-05 03:22:19 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
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>
|
2020-11-28 23:31:48 +01:00
|
|
|
#include <cstring>
|
2017-12-25 18:07:29 +01:00
|
|
|
#include <optional>
|
2014-02-19 13:09:14 -05:00
|
|
|
#include <string>
|
2020-11-21 01:30:02 +01:00
|
|
|
#include <string_view>
|
2014-02-19 13:09:14 -05:00
|
|
|
|
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
|
|
|
|
2022-01-11 11:17:47 -08:00
|
|
|
namespace ExpansionInterface
|
|
|
|
{
|
|
|
|
enum class Slot : int;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
{
|
2009-10-05 22:59:11 +00:00
|
|
|
// Enumerations and structs
|
2021-07-04 13:38:30 +02:00
|
|
|
enum class ControllerType
|
|
|
|
{
|
|
|
|
None = 0,
|
|
|
|
GC,
|
|
|
|
GBA,
|
|
|
|
};
|
|
|
|
using ControllerTypeArray = std::array<ControllerType, 4>;
|
|
|
|
using WiimoteEnabledArray = std::array<bool, 4>;
|
|
|
|
|
2014-06-07 11:30:39 +09:00
|
|
|
// GameCube Controller State
|
2010-07-22 04:16:51 +00:00
|
|
|
#pragma pack(push, 1)
|
2014-03-12 15:33:41 -04:00
|
|
|
struct ControllerState
|
|
|
|
{
|
2010-07-22 04:16:51 +00: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
|
2014-09-08 20:15:47 -04:00
|
|
|
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
|
2019-06-03 20:34:06 -04:00
|
|
|
bool get_origin : 1; // Special bit to indicate analog origin reset
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2012-10-19 19:42:44 -04:00
|
|
|
u8 TriggerL, TriggerR; // Triggers, 16 bits
|
2010-07-22 04:16:51 +00:00
|
|
|
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.
|
2010-07-22 04:16:51 +00:00
|
|
|
#pragma pack(push, 1)
|
2014-03-12 15:33:41 -04:00
|
|
|
struct DTMHeader
|
|
|
|
{
|
2020-11-28 23:31:48 +01:00
|
|
|
std::string_view GetGameID() const
|
|
|
|
{
|
|
|
|
return {gameID.data(), strnlen(gameID.data(), gameID.size())};
|
|
|
|
}
|
2020-11-21 01:30:02 +01:00
|
|
|
|
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
|
|
|
|
2010-07-22 04:16:51 +00:00
|
|
|
bool
|
|
|
|
bFromSaveState; // false indicates that the recording started from bootup, true for savestate
|
|
|
|
u64 frameCount; // Number of frames in the recording
|
2011-12-14 04:03:05 -08:00
|
|
|
u64 inputCount; // Number of input frames in recording
|
2010-07-22 04:16:51 +00:00
|
|
|
u64 lagCount; // Number of lag frames in the recording
|
2011-12-26 05:09:30 -06:00
|
|
|
u64 uniqueID; // (not implemented) A Unique ID comprised of: md5(time + Game ID)
|
2010-07-22 04:16:51 +00:00
|
|
|
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
|
|
|
|
2011-12-26 05:09:30 -06:00
|
|
|
u64 recordingStartTime; // seconds since 1970 that recording started (used for RTC)
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2012-10-19 19:42:44 -04:00
|
|
|
bool bSaveConfig; // Loads the settings below on startup if true
|
2012-10-18 04:18:40 -04:00
|
|
|
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
|
2012-10-18 04:18:40 -04:00
|
|
|
bool bEFBAccessEnable;
|
|
|
|
bool bEFBCopyEnable;
|
2015-02-21 12:08:47 +01:00
|
|
|
bool bSkipEFBCopyToRam;
|
2012-10-18 04:18:40 -04:00
|
|
|
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)
|
2012-10-25 02:44:30 -04: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)
|
2013-06-20 06:08:17 -04:00
|
|
|
bool bSyncGPU;
|
2013-09-03 15:50:41 -04:00
|
|
|
bool bNetPlay;
|
2015-06-05 20:27:01 +02:00
|
|
|
bool bPAL60;
|
2016-02-24 13:56:59 -05:00
|
|
|
u8 language;
|
2019-07-06 03:57:18 -04:00
|
|
|
u8 reserved3;
|
2018-07-08 21:26:34 +02:00
|
|
|
bool bFollowBranch;
|
NetPlay/Jit64: Avoid using software FMA
When I added the software FMA path in 2c38d64 and made us use
it when determinism is enabled, I was assuming that either the
performance impact of software FMA wouldn't be too large or CPUs
that were too old to have FMA instructions were too slow to run
Dolphin well anyway. This was wrong. To give an example, the
netplay performance went from 60 FPS to 30 FPS in one case.
This change makes netplay clients negotiate whether FMA should
be used. If all clients use an x64 CPU that supports FMA, or
AArch64, then FMA is enabled, and otherwise FMA is disabled.
In other words, we sacrifice accuracy if needed to avoid massive
slowdown, but not otherwise. When not using netplay, whether to
enable FMA is simply based on whether the host CPU supports it.
The only remaining case where the software FMA path gets used
under normal circumstances is when an input recording is created
on a CPU with FMA support and then played back on a CPU without.
This is not an especially common scenario (though it can happen),
and TASers are generally less picky about performance and more
picky about accuracy than other users anyway.
With this change, FMA desyncs are avoided between AArch64 and
modern x64 CPUs (unlike before 2c38d64), but we do get FMA
desyncs between AArch64 and old x64 CPUs (like before 2c38d64).
This desync can be avoided by adding a non-FMA path to JitArm64 as
an option, which I will wait with for another pull request so that
we can get the performance regression fixed as quickly as possible.
https://bugs.dolphin-emu.org/issues/12542
2021-06-09 20:16:41 +02:00
|
|
|
bool bUseFMA;
|
2021-07-04 13:38:30 +02:00
|
|
|
u8 GBAControllers; // GBA Controllers plugged in (the bits are ports 1-4)
|
|
|
|
std::array<u8, 7> 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
|
2014-09-08 20:15:47 -04: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
|
|
|
|
2009-08-07 16:03:57 +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
|
|
|
|
2009-08-21 19:55:03 +00:00
|
|
|
void SetPolledDevice();
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-08-20 23:31:48 +00:00
|
|
|
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();
|
2009-08-20 23:31:48 +00:00
|
|
|
bool IsPlayingInput();
|
2014-09-06 23:44:25 -04:00
|
|
|
bool IsMovieActive();
|
2011-07-11 20:15:05 +00:00
|
|
|
bool IsReadOnly();
|
2014-07-02 21:45:59 -04: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();
|
2022-01-11 11:17:47 -08:00
|
|
|
bool IsUsingMemcard(ExpansionInterface::Slot slot);
|
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);
|
2021-07-04 13:38:30 +02:00
|
|
|
bool IsUsingGBA(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
|
|
|
|
2021-07-04 13:38:30 +02:00
|
|
|
bool BeginRecordingInput(const ControllerTypeArray& controllers,
|
|
|
|
const WiimoteEnabledArray& wiimotes);
|
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);
|
2011-12-28 02:33:41 -06: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();
|
2021-11-29 23:03:36 -05:00
|
|
|
std::string GetRerecords();
|
2011-06-24 06:50:50 +00:00
|
|
|
|
2018-06-29 16:48:30 -04:00
|
|
|
} // namespace Movie
|