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-03-11 10:21:46 +00:00
|
|
|
#include "FileUtil.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-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;
|
2011-02-15 23:38:44 +00:00
|
|
|
bool L:1, R:1; // Binary triggers, 2 bits
|
|
|
|
bool reserved:4; // Reserved bits used for padding, 4 bits
|
2010-08-30 07:05:47 +00:00
|
|
|
|
2011-02-15 23:38:44 +00: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
|
2010-07-22 04:16:51 +00:00
|
|
|
#pragma pack(pop)
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
// Global declarations
|
2011-02-12 02:14:20 +00:00
|
|
|
extern bool g_bFrameStep, g_bPolled, g_bReadOnly;
|
2010-06-09 01:37:08 +00:00
|
|
|
extern PlayMode g_playMode;
|
|
|
|
|
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-05-03 00:06:44 +00:00
|
|
|
extern u64 g_frameCounter, g_lagCounter, g_InputCounter;
|
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-03-19 02:28:49 +00: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
|
|
|
|
u64 uniqueID; // A Unique ID comprised of: md5(time + Game ID)
|
|
|
|
u32 numRerecords; // Number of rerecords/'cuts' of this TAS
|
|
|
|
u8 author[32]; // Author's name (encoded in UTF-8)
|
2010-06-09 01:37:08 +00: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
|
|
|
|
u8 padBackend[16]; // UTF-8 representation of the input backend
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2011-07-11 20:15:05 +00:00
|
|
|
// only used in read-only savestates
|
|
|
|
u64 frameStart; // Offset to resume playback on
|
|
|
|
u64 totalFrameCount; // Total frames, same as normal dtm's frameCount
|
|
|
|
|
|
|
|
u8 reserved[111]; // Make heading 256 bytes, just because we can
|
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();
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
void SetPolledDevice();
|
|
|
|
|
|
|
|
bool IsAutoFiring();
|
|
|
|
bool IsRecordingInput();
|
2011-02-15 09:07:55 +00:00
|
|
|
bool IsRecordingInputFromSaveState();
|
2010-06-09 01:37:08 +00:00
|
|
|
bool IsPlayingInput();
|
2011-07-11 20:15:05 +00:00
|
|
|
bool IsReadOnly();
|
2010-06-09 01:37:08 +00: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
|
|
|
|
2010-06-09 01:37:08 +00:00
|
|
|
void SetFrameStepping(bool bEnabled);
|
|
|
|
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-02-12 08:25:09 +00:00
|
|
|
void RecordWiimote(int wiimote, u8* data, s8 size);
|
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);
|
2010-06-09 01:37:08 +00:00
|
|
|
void PlayController(SPADStatus *PadStatus, int controllerID);
|
2011-02-12 08:25:09 +00:00
|
|
|
bool PlayWiimote(int wiimote, u8* data, s8 &size);
|
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);
|
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
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __FRAME_H
|