2010-06-09 01:37:08 +00:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
2011-06-24 06:50:50 +00:00
|
|
|
#ifndef __MOVIE_H
|
|
|
|
#define __MOVIE_H
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
#include "Common.h"
|
2011-02-17 09:12:36 +00:00
|
|
|
#include "../../InputCommon/Src/GCPadStatus.h"
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2011-12-14 04:03:05 -08:00
|
|
|
#include "ChunkFile.h"
|
|
|
|
|
2011-12-15 09:22:16 -08:00
|
|
|
namespace WiimoteEmu
|
|
|
|
{
|
|
|
|
struct ReportFeatures;
|
|
|
|
}
|
|
|
|
|
2011-06-24 06:50:50 +00:00
|
|
|
// Per-(video )Movie actions
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2011-06-24 06:50:50 +00:00
|
|
|
namespace Movie {
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
// Enumerations and structs
|
|
|
|
enum PlayMode {
|
|
|
|
MODE_NONE = 0,
|
|
|
|
MODE_RECORDING,
|
|
|
|
MODE_PLAYING
|
|
|
|
};
|
|
|
|
|
|
|
|
// Gamecube Controller State
|
2010-07-22 04:16:51 +00:00
|
|
|
#pragma pack(push,1)
|
|
|
|
struct ControllerState {
|
|
|
|
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;
|
2012-10-19 19:42:44 -04:00
|
|
|
bool L:1, R:1; // Binary triggers, 2 bits
|
2012-10-20 14:18:42 -04:00
|
|
|
bool disc:1; // Checks for disc being changed
|
|
|
|
bool reserved:3; // Reserved bits used for padding, 4 bits
|
2010-08-30 07:05:47 +00: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
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2011-03-19 02:28:49 +00:00
|
|
|
}; // Total: 60 + 4 = 64 bits per frame
|
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
|
|
|
|
|
|
|
// Global declarations
|
2012-10-25 02:44:30 -04:00
|
|
|
extern bool g_bFrameStep, g_bPolled, g_bReadOnly, g_bDiscChange, g_bClearSave;
|
2010-06-09 01:37:08 +00:00
|
|
|
extern PlayMode g_playMode;
|
2012-10-25 02:44:30 -04:00
|
|
|
extern u64 g_titleID;
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2011-05-03 00:06:44 +00:00
|
|
|
extern u32 g_framesToSkip, g_frameSkipCounter;
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2011-05-03 00:06:44 +00:00
|
|
|
extern u8 g_numPads;
|
2010-06-09 01:37:08 +00:00
|
|
|
extern ControllerState *g_padStates;
|
2011-02-12 02:14:20 +00:00
|
|
|
extern char g_playingFile[256];
|
2010-06-09 01:37:08 +00:00
|
|
|
extern std::string g_recordFile;
|
|
|
|
|
2011-12-14 04:03:05 -08:00
|
|
|
extern u64 g_currentByte, g_totalBytes;
|
|
|
|
extern u64 g_currentFrame, g_totalFrames;
|
|
|
|
extern u64 g_currentLagCount, g_totalLagCount;
|
|
|
|
extern u64 g_currentInputCount, g_totalInputCount;
|
2012-10-20 14:18:42 -04:00
|
|
|
extern std::string g_discChange;
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2011-05-03 00:06:44 +00:00
|
|
|
extern u32 g_rerecords;
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2010-07-22 04:16:51 +00:00
|
|
|
#pragma pack(push,1)
|
|
|
|
struct DTMHeader {
|
2010-06-09 01:37:08 +00:00
|
|
|
u8 filetype[4]; // Unique Identifier (always "DTM"0x1A)
|
|
|
|
|
2010-07-22 04:16:51 +00:00
|
|
|
u8 gameID[6]; // The Game ID
|
|
|
|
bool bWii; // Wii game
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2010-07-22 04:16:51 +00:00
|
|
|
u8 numControllers; // The number of connected controllers (1-4)
|
2010-06-09 01:37:08 +00: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
|
|
|
|
u8 author[32]; // Author's name (encoded in UTF-8)
|
2012-10-20 14:18:42 -04:00
|
|
|
|
2011-02-14 02:18:03 +00:00
|
|
|
u8 videoBackend[16]; // UTF-8 representation of the video backend
|
|
|
|
u8 audioEmulator[16]; // UTF-8 representation of the audio emulator
|
2012-11-23 22:23:58 -05:00
|
|
|
unsigned char md5[16]; // MD5 of game iso
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2011-12-26 05:09:30 -06:00
|
|
|
u64 recordingStartTime; // seconds since 1970 that recording started (used for RTC)
|
2011-07-11 20:15:05 +00: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;
|
2012-10-20 14:18:42 -04:00
|
|
|
u8 CPUCore; // 0 = interpreter, 1 = JIT, 2 = JITIL
|
2012-10-18 04:18:40 -04:00
|
|
|
bool bEFBAccessEnable;
|
|
|
|
bool bEFBCopyEnable;
|
|
|
|
bool bCopyEFBToTexture;
|
|
|
|
bool bEFBCopyCacheEnable;
|
|
|
|
bool bEFBEmulateFormatChanges;
|
|
|
|
bool bUseXFB;
|
|
|
|
bool bUseRealXFB;
|
|
|
|
bool bMemcard;
|
2012-10-25 02:44:30 -04:00
|
|
|
bool bClearSave; // Create a new memory card when playing back a movie if true
|
2012-10-21 17:48:45 -04:00
|
|
|
u8 reserved[16]; // Padding for any new config options
|
2012-10-20 14:18:42 -04:00
|
|
|
u8 discChange[40]; // Name of iso file to switch to, for two disc games.
|
2012-10-20 15:58:29 -04:00
|
|
|
u8 reserved2[47]; // 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();
|
2012-01-02 02:20:22 -08:00
|
|
|
void Init();
|
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();
|
2011-07-11 20:15:05 +00:00
|
|
|
bool IsReadOnly();
|
2011-12-26 05:09:30 -06:00
|
|
|
u64 GetRecordingStartTime();
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2012-10-18 04:18:40 -04:00
|
|
|
bool IsConfigSaved();
|
|
|
|
bool IsDualCore();
|
|
|
|
bool IsProgressive();
|
|
|
|
bool IsSkipIdle();
|
|
|
|
bool IsDSPHLE();
|
|
|
|
bool IsFastDiscSpeed();
|
|
|
|
int GetCPUMode();
|
2012-10-25 02:44:30 -04:00
|
|
|
bool IsStartingFromClearSave();
|
2012-10-21 17:48:45 -04:00
|
|
|
bool IsUsingMemcard();
|
2012-10-18 04:18:40 -04:00
|
|
|
void SetGraphicsConfig();
|
2012-10-24 16:35:52 -04:00
|
|
|
void GetSettings();
|
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);
|
2011-02-12 00:06:58 +00:00
|
|
|
void ChangePads(bool instantly = false);
|
2011-07-11 20:15:05 +00:00
|
|
|
void ChangeWiiPads(bool instantly = false);
|
2010-09-06 21:41:01 +00:00
|
|
|
|
2011-12-11 21:08:26 -08:00
|
|
|
void DoFrameStep();
|
2010-06-09 01:37:08 +00:00
|
|
|
void SetFrameStopping(bool bEnabled);
|
2011-02-12 02:14:20 +00:00
|
|
|
void SetReadOnly(bool bEnabled);
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
void SetFrameSkipping(unsigned int framesToSkip);
|
|
|
|
void FrameSkipping();
|
|
|
|
|
2010-08-30 07:05:47 +00:00
|
|
|
bool BeginRecordingInput(int controllers);
|
2010-06-09 01:37:08 +00:00
|
|
|
void RecordInput(SPADStatus *PadStatus, int controllerID);
|
2011-12-15 09:22:16 -08:00
|
|
|
void RecordWiimote(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf, int irMode);
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
bool PlayInput(const char *filename);
|
2010-08-30 07:05:47 +00:00
|
|
|
void LoadInput(const char *filename);
|
2012-10-20 14:18:42 -04:00
|
|
|
void ReadHeader();
|
2010-06-09 01:37:08 +00:00
|
|
|
void PlayController(SPADStatus *PadStatus, int controllerID);
|
2011-12-15 09:22:16 -08:00
|
|
|
bool PlayWiimote(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf, int irMode);
|
2011-02-15 17:03:20 +00:00
|
|
|
void EndPlayInput(bool cont);
|
2010-08-30 07:05:47 +00:00
|
|
|
void SaveRecording(const char *filename);
|
2011-12-28 02:33:41 -06:00
|
|
|
void DoState(PointerWrap &p);
|
2012-11-23 22:23:58 -05:00
|
|
|
void CheckMD5();
|
2012-11-25 19:26:37 -05:00
|
|
|
void GetMD5();
|
2012-11-24 18:27:20 -05:00
|
|
|
void Shutdown();
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2011-02-17 09:12:36 +00:00
|
|
|
std::string GetInputDisplay();
|
2011-06-24 06:50:50 +00:00
|
|
|
|
|
|
|
// Done this way to avoid mixing of core and gui code
|
|
|
|
typedef void(*ManipFunction)(SPADStatus *, int);
|
|
|
|
|
|
|
|
void SetInputManip(ManipFunction);
|
|
|
|
void CallInputManip(SPADStatus *PadStatus, int controllerID);
|
2010-06-09 01:37:08 +00:00
|
|
|
};
|
|
|
|
|
2012-11-26 01:41:00 -05:00
|
|
|
#endif // __MOVIE_H
|