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/
|
|
|
|
|
|
|
|
#ifndef __FRAME_H
|
|
|
|
#define __FRAME_H
|
|
|
|
|
|
|
|
#include "Common.h"
|
2010-06-13 09:26:00 +00:00
|
|
|
#include "GCPadStatus.h"
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
// Per-(video )Frame actions
|
|
|
|
|
|
|
|
namespace Frame {
|
|
|
|
|
|
|
|
// 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
|
|
|
|
2010-07-22 04:16:51 +00:00
|
|
|
}; // Total: 58 + 6 = 64 bits per frame
|
|
|
|
#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;
|
|
|
|
|
|
|
|
extern unsigned int g_framesToSkip, g_frameSkipCounter;
|
|
|
|
|
|
|
|
extern int g_numPads;
|
|
|
|
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 FILE *g_recordfd;
|
|
|
|
extern std::string g_recordFile;
|
|
|
|
|
|
|
|
extern u64 g_frameCounter, g_lagCounter;
|
|
|
|
|
|
|
|
extern int g_numRerecords;
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
2010-07-22 04:16:51 +00:00
|
|
|
u8 padding[7]; // Padding to align the header to 1024 bits
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2010-07-22 04:16:51 +00:00
|
|
|
u8 reserved[128]; // Increasing size from 128 bytes to 256 bytes, just because we can
|
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
void FrameUpdate();
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
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-02-11 19:09:46 +00:00
|
|
|
void ChangeWiiPads();
|
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);
|
|
|
|
int FrameSkippingFactor();
|
|
|
|
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
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __FRAME_H
|