Merge branch 'movie-fixes'
This commit is contained in:
commit
15f49c9b61
|
@ -1,41 +0,0 @@
|
|||
// 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 _SETUP_H_
|
||||
#define _SETUP_H_
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// File description:
|
||||
// Compilation settings. I avoid placing this in Common.h or some place where lots of files needs
|
||||
// to be rebuilt if any of these settings are changed. I'd rather have it in as few files as possible.
|
||||
// This file can be kept on the ignore list in your SVN program. It allows local optional settings
|
||||
// depending on what works on your computer.
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// Settings:
|
||||
|
||||
// This may remove sound artifacts in Wario Land Shake It and perhaps other games
|
||||
//#define SETUP_AVOID_SOUND_ARTIFACTS
|
||||
|
||||
// Build with playback rerecording options
|
||||
//#define RERECORDING
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
#endif // _SETUP_H_
|
||||
|
|
@ -15,7 +15,6 @@
|
|||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Setup.h"
|
||||
#include "Thread.h"
|
||||
#include "Common.h"
|
||||
|
||||
|
|
|
@ -97,12 +97,6 @@ void Timer::AddTimeDifference()
|
|||
m_StartTime += GetTimeDifference();
|
||||
}
|
||||
|
||||
// Wind back the starting time to a custom time
|
||||
void Timer::WindBackStartingTime(u64 WindBack)
|
||||
{
|
||||
m_StartTime += WindBack;
|
||||
}
|
||||
|
||||
// Get the time elapsed since the Start()
|
||||
u64 Timer::GetTimeElapsed()
|
||||
{
|
||||
|
|
|
@ -35,7 +35,6 @@ public:
|
|||
// The time difference is always returned in milliseconds, regardless of alternative internal representation
|
||||
u64 GetTimeDifference();
|
||||
void AddTimeDifference();
|
||||
void WindBackStartingTime(u64 WindBack);
|
||||
|
||||
static void IncreaseResolution();
|
||||
static void RestoreResolution();
|
||||
|
|
|
@ -5,7 +5,6 @@ set(SRCS Src/ActionReplay.cpp
|
|||
Src/Console.cpp
|
||||
Src/Core.cpp
|
||||
Src/CoreParameter.cpp
|
||||
Src/CoreRerecording.cpp
|
||||
Src/CoreTiming.cpp
|
||||
Src/DSPEmulator.cpp
|
||||
Src/GeckoCodeConfig.cpp
|
||||
|
|
|
@ -207,7 +207,6 @@
|
|||
<ClCompile Include="Src\Console.cpp" />
|
||||
<ClCompile Include="Src\Core.cpp" />
|
||||
<ClCompile Include="Src\CoreParameter.cpp" />
|
||||
<ClCompile Include="Src\CoreRerecording.cpp" />
|
||||
<ClCompile Include="Src\CoreTiming.cpp" />
|
||||
<ClCompile Include="Src\Debugger\Debugger_SymbolMap.cpp" />
|
||||
<ClCompile Include="Src\Debugger\Dump.cpp" />
|
||||
|
@ -385,7 +384,11 @@
|
|||
<ClCompile Include="Src\PowerPC\PPCTables.cpp" />
|
||||
<ClCompile Include="Src\PowerPC\Profiler.cpp" />
|
||||
<ClCompile Include="Src\PowerPC\SignatureDB.cpp" />
|
||||
<ClCompile Include="Src\State.cpp" />
|
||||
<ClCompile Include="Src\State.cpp">
|
||||
<OpenMPSupport Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'">false</OpenMPSupport>
|
||||
<OpenMPSupport Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</OpenMPSupport>
|
||||
<OpenMPSupport Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</OpenMPSupport>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Src\stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include "EmuWindow.h"
|
||||
#endif
|
||||
|
||||
#include "Setup.h" // Common
|
||||
#include "Atomic.h"
|
||||
#include "Thread.h"
|
||||
#include "Timer.h"
|
||||
|
@ -61,9 +61,6 @@
|
|||
#include "VideoBackendBase.h"
|
||||
#include "AudioCommon.h"
|
||||
#include "OnScreenDisplay.h"
|
||||
#ifdef _WIN32
|
||||
#include "EmuWindow.h"
|
||||
#endif
|
||||
|
||||
#include "VolumeHandler.h"
|
||||
#include "FileMonitor.h"
|
||||
|
@ -293,7 +290,7 @@ void Stop() // - Hammertime!
|
|||
SConfig::GetInstance().m_SYSCONF->Reload();
|
||||
|
||||
INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutdown complete ----");
|
||||
Movie::g_currentInputCount = 0;
|
||||
Movie::Shutdown();
|
||||
g_bStopping = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,21 +95,6 @@ void RequestRefreshInfo();
|
|||
// the return value of the first call should be passed in as the second argument of the second call.
|
||||
bool PauseAndLock(bool doLock, bool unpauseOnUnlock=true);
|
||||
|
||||
#ifdef RERECORDING
|
||||
|
||||
void FrameUpdate();
|
||||
void FrameAdvance();
|
||||
void FrameStepOnOff();
|
||||
void WriteStatus();
|
||||
void RerecordingStart();
|
||||
void RerecordingStop();
|
||||
void WindBack(int Counter);
|
||||
|
||||
extern int g_FrameCounter,g_InputCounter;
|
||||
extern bool g_FrameStep;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,248 +0,0 @@
|
|||
// 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/
|
||||
|
||||
|
||||
#include "Setup.h"
|
||||
#ifndef RERECORDING
|
||||
bool rerecording = false;
|
||||
#else
|
||||
|
||||
// Include
|
||||
// --------------
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "Thread.h" // Common
|
||||
|
||||
#include "Timer.h"
|
||||
#include "Common.h"
|
||||
|
||||
#include "Console.h"
|
||||
#include "Core.h"
|
||||
#include "CPUDetect.h"
|
||||
#include "CoreTiming.h"
|
||||
#include "Boot/Boot.h"
|
||||
#include "PatchEngine.h"
|
||||
|
||||
#include "HW/Memmap.h"
|
||||
#include "HW/ProcessorInterface.h"
|
||||
#include "HW/GPFifo.h"
|
||||
#include "HW/CPU.h"
|
||||
#include "HW/HW.h"
|
||||
#include "HW/DSP.h"
|
||||
#include "HW/GPFifo.h"
|
||||
#include "HW/AudioInterface.h"
|
||||
#include "HW/VideoInterface.h"
|
||||
#include "HW/CommandProcessor.h"
|
||||
#include "HW/PixelEngine.h"
|
||||
#include "HW/SystemTimers.h"
|
||||
|
||||
#include "PowerPC/PowerPC.h"
|
||||
|
||||
#include "ConfigManager.h"
|
||||
|
||||
#include "MemTools.h"
|
||||
#include "Host.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// File description: Rerecording Functions
|
||||
/* ---------------
|
||||
|
||||
How the timer works: We measure the time between drawn frames, not when the game is paused. So time
|
||||
should be a fairly comparable measure of the time it took to play the game. However the time it takes
|
||||
to draw a frame will be lower on a fast computer. Therefore we could perhaps measure time as an
|
||||
internal game time that is adjusted by the average time it takes to draw a frame. Also if it only takes
|
||||
ten or twenty milliseconds to draw a frame I'm not certain about how accurate the mmsystem timers are for
|
||||
such short periods.
|
||||
|
||||
//////////////////////////////////////*/
|
||||
|
||||
|
||||
|
||||
namespace Core
|
||||
{
|
||||
|
||||
|
||||
|
||||
// Declarations and definitions
|
||||
// ---------------
|
||||
int g_FrameCounter = 0;
|
||||
bool g_FrameStep = false;
|
||||
Common::Timer ReRecTimer;
|
||||
|
||||
|
||||
|
||||
|
||||
// Control Run, Pause, Stop and the Timer.
|
||||
// ---------------
|
||||
|
||||
// Subtract the paused time when we run again
|
||||
void Run()
|
||||
{
|
||||
ReRecTimer.AddTimeDifference();
|
||||
}
|
||||
// Update the time
|
||||
void Pause()
|
||||
{
|
||||
ReRecTimer.Update();
|
||||
}
|
||||
|
||||
// Start the timer when a game is booted
|
||||
void RerecordingStart()
|
||||
{
|
||||
g_FrameCounter = 0;
|
||||
ReRecTimer.Start();
|
||||
|
||||
// Logging
|
||||
//DEBUG_LOG(CONSOLE, "RerecordingStart: %i\n", g_FrameCounter);
|
||||
}
|
||||
|
||||
// Reset the frame counter
|
||||
void RerecordingStop()
|
||||
{
|
||||
// Write the final time and Stop the timer
|
||||
ReRecTimer.Stop();
|
||||
|
||||
// Update status bar
|
||||
WriteStatus();
|
||||
}
|
||||
|
||||
/* Wind back the frame counter when a save state is loaded. Currently we don't know what that means in
|
||||
time so we just guess that the time is proportional the the number of frames
|
||||
|
||||
Todo: There are many assumptions here: We probably want to replace the time here by the actual time
|
||||
that we save together with the save state or the input recording for example. And have it adjusted
|
||||
for full speed playback (whether it's 30 fps or 60 fps or some other speed that the game is natively
|
||||
capped at). Also the input interrupts do not occur as often as the frame renderings, they occur more
|
||||
often. So we may want to move the input recording to fram updates, or perhaps sync the input interrupts
|
||||
to frame updates.
|
||||
*/
|
||||
void WindBack(int Counter)
|
||||
{
|
||||
/* Counter should be smaller than g_FrameCounter, however it currently updates faster than the
|
||||
frames so currently it may not be the same. Therefore I use the abs() function. */
|
||||
int AbsoluteFrameDifference = abs(g_FrameCounter - Counter);
|
||||
float FractionalFrameDifference = (float) AbsoluteFrameDifference / (float) g_FrameCounter;
|
||||
|
||||
// Update the frame counter
|
||||
g_FrameCounter = Counter;
|
||||
|
||||
// Approximate a time to wind back the clock to
|
||||
// Get the current time
|
||||
u64 CurrentTimeMs = ReRecTimer.GetTimeElapsed();
|
||||
// Save the current time in seconds in a new double
|
||||
double CurrentTimeSeconds = (double) (CurrentTimeMs / 1000);
|
||||
// Reduce it by the same proportion as the counter was wound back
|
||||
CurrentTimeSeconds = CurrentTimeSeconds * FractionalFrameDifference;
|
||||
// Update the clock
|
||||
ReRecTimer.WindBackStartingTime((u64)CurrentTimeSeconds * 1000);
|
||||
|
||||
// Logging
|
||||
DEBUG_LOG(CONSOLE, "WindBack: %i %u\n", Counter, (u64)CurrentTimeSeconds);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Frame advance
|
||||
// ---------------
|
||||
void FrameAdvance()
|
||||
{
|
||||
// Update status bar
|
||||
WriteStatus();
|
||||
|
||||
// If a game is not started, return
|
||||
if (Core::GetState() == Core::CORE_UNINITIALIZED) return;
|
||||
|
||||
// Play to the next frame
|
||||
if (g_FrameStep)
|
||||
{
|
||||
Run();
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
}
|
||||
}
|
||||
|
||||
// Turn on frame stepping
|
||||
void FrameStepOnOff()
|
||||
{
|
||||
/* Turn frame step on or off. If a game is running and we turn this on it means that the game
|
||||
will pause after the next frame update */
|
||||
g_FrameStep = !g_FrameStep;
|
||||
|
||||
// Update status bar
|
||||
WriteStatus();
|
||||
|
||||
// If a game is not started, return
|
||||
if(Core::GetState() == Core::CORE_UNINITIALIZED) return;
|
||||
|
||||
// Run the emulation if we turned off framestepping
|
||||
if (!g_FrameStep)
|
||||
{
|
||||
Run();
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// General functions
|
||||
// ---------------
|
||||
|
||||
// Write to the status bar
|
||||
void WriteStatus()
|
||||
{
|
||||
std::string TmpStr = "Time: " + ReRecTimer.GetTimeElapsedFormatted();
|
||||
TmpStr += StringFromFormat(" Frame: %s", ThousandSeparate(g_FrameCounter).c_str());
|
||||
// The FPS is the total average since the game was booted
|
||||
TmpStr += StringFromFormat(" FPS: %i", (g_FrameCounter * 1000) / ReRecTimer.GetTimeElapsed());
|
||||
TmpStr += StringFromFormat(" FrameStep: %s", g_FrameStep ? "On" : "Off");
|
||||
Host_UpdateStatusBar(TmpStr.c_str(), 1);
|
||||
}
|
||||
|
||||
|
||||
// When a new frame is drawn
|
||||
void FrameUpdate()
|
||||
{
|
||||
// Write to the status bar
|
||||
WriteStatus();
|
||||
/* I don't think the frequent update has any material speed inpact at all, but should it
|
||||
have you can controls the update speed by changing the "% 10" in this line */
|
||||
//if (g_FrameCounter % 10 == 0) WriteStatus();
|
||||
|
||||
// Pause if frame stepping is on
|
||||
if(g_FrameStep)
|
||||
{
|
||||
Pause();
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
}
|
||||
|
||||
// Count one frame
|
||||
g_FrameCounter++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // Core
|
||||
|
||||
|
||||
#endif // RERECORDING
|
|
@ -20,7 +20,6 @@
|
|||
#include "ChunkFile.h"
|
||||
#include "IniFile.h"
|
||||
#include "HLEMixer.h"
|
||||
#include "Setup.h"
|
||||
#include "StringUtil.h"
|
||||
#include "LogManager.h"
|
||||
#include "IniFile.h"
|
||||
|
|
|
@ -193,7 +193,8 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
|
|||
case 0x0004:
|
||||
// PBs are here now
|
||||
m_addressPBs = HLEMemory_Read_U32(uAddress);
|
||||
soundStream->GetMixer()->SetHLEReady(true);
|
||||
if (soundStream)
|
||||
soundStream->GetMixer()->SetHLEReady(true);
|
||||
// soundStream->Update();
|
||||
uAddress += 4;
|
||||
break;
|
||||
|
|
|
@ -132,13 +132,13 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
|||
if(Movie::IsPlayingInput())
|
||||
{
|
||||
Movie::PlayController(&PadStatus, ISIDevice::m_iDeviceNumber);
|
||||
if(!Core::g_CoreStartupParameter.bWii)
|
||||
if(!Movie::IsUsingWiimote(0))
|
||||
Movie::InputUpdate();
|
||||
}
|
||||
else if(Movie::IsRecordingInput())
|
||||
{
|
||||
Movie::RecordInput(&PadStatus, ISIDevice::m_iDeviceNumber);
|
||||
if(!Core::g_CoreStartupParameter.bWii)
|
||||
if(!Movie::IsUsingWiimote(0))
|
||||
Movie::InputUpdate();
|
||||
}
|
||||
|
||||
|
|
|
@ -136,9 +136,9 @@ void DoState(unsigned char **ptr, int mode)
|
|||
{
|
||||
// TODO:
|
||||
|
||||
//PointerWrap p(ptr, mode);
|
||||
//for (unsigned int i=0; i<4; ++i)
|
||||
// ((WiimoteEmu::Wiimote*)g_plugin.controllers[i])->DoState(p);
|
||||
PointerWrap p(ptr, mode);
|
||||
for (unsigned int i=0; i<4; ++i)
|
||||
((WiimoteEmu::Wiimote*)g_plugin.controllers[i])->DoState(p);
|
||||
}
|
||||
|
||||
// ___________________________________________________________________________
|
||||
|
|
|
@ -594,13 +594,69 @@ void Wiimote::SendReadDataReply(ReadRequest& _request)
|
|||
|
||||
void Wiimote::DoState(PointerWrap& p)
|
||||
{
|
||||
// not working :(
|
||||
//if (p.MODE_READ == p.GetMode())
|
||||
//{
|
||||
// // LOAD
|
||||
// Reset(); // should cause a status report to be sent, then wii should re-setup wiimote
|
||||
//}
|
||||
//p.Do(m_reporting_channel);
|
||||
p.Do(m_extension->active_extension);
|
||||
p.Do(m_extension->switch_extension);
|
||||
|
||||
p.Do(m_accel);
|
||||
p.Do(m_index);
|
||||
p.Do(ir_sin);
|
||||
p.Do(ir_cos);
|
||||
p.Do(m_rumble_on);
|
||||
p.Do(m_speaker_mute);
|
||||
p.Do(m_motion_plus_present);
|
||||
p.Do(m_motion_plus_active);
|
||||
p.Do(m_reporting_auto);
|
||||
p.Do(m_reporting_mode);
|
||||
p.Do(m_reporting_channel);
|
||||
p.Do(m_shake_step);
|
||||
p.Do(m_sensor_bar_on_top);
|
||||
p.Do(m_status);
|
||||
p.Do(m_adpcm_state);
|
||||
p.Do(m_ext_key);
|
||||
p.Do(m_eeprom);
|
||||
p.Do(m_reg_motion_plus);
|
||||
p.Do(m_reg_ir);
|
||||
p.Do(m_reg_ext);
|
||||
p.Do(m_reg_speaker);
|
||||
|
||||
//Do 'm_read_requests' queue
|
||||
{
|
||||
u32 size;
|
||||
if (p.mode == PointerWrap::MODE_READ)
|
||||
{
|
||||
//clear
|
||||
while (m_read_requests.size())
|
||||
m_read_requests.pop();
|
||||
|
||||
p.Do(size);
|
||||
while (size--)
|
||||
{
|
||||
ReadRequest tmp;
|
||||
p.Do(tmp.address);
|
||||
p.Do(tmp.position);
|
||||
p.Do(tmp.size);
|
||||
tmp.data = new u8[tmp.size];
|
||||
p.DoArray(tmp.data, tmp.size);
|
||||
m_read_requests.push(tmp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::queue<ReadRequest> tmp_queue(m_read_requests);
|
||||
size = m_read_requests.size();
|
||||
p.Do(size);
|
||||
while (!tmp_queue.empty())
|
||||
{
|
||||
ReadRequest tmp = tmp_queue.front();
|
||||
p.Do(tmp.address);
|
||||
p.Do(tmp.position);
|
||||
p.Do(tmp.size);
|
||||
p.DoArray(tmp.data, tmp.size);
|
||||
tmp_queue.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
p.DoMarker("Wiimote");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -62,7 +62,11 @@ public:
|
|||
|
||||
virtual ~IWII_IPC_HLE_Device() { }
|
||||
|
||||
virtual void DoState(PointerWrap& p) { DoStateShared(p); }
|
||||
virtual void DoState(PointerWrap& p)
|
||||
{
|
||||
DoStateShared(p);
|
||||
p.Do(m_Active);
|
||||
}
|
||||
|
||||
void DoStateShared(PointerWrap& p);
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState(PointerWrap &p)
|
|||
std::deque<SQueuedEvent> m_EventQueue;
|
||||
*/
|
||||
|
||||
p.Do(m_ControllerBD);
|
||||
p.Do(m_CtrlSetup);
|
||||
p.Do(m_ACLSetup);
|
||||
p.Do(m_HCIEndpoint);
|
||||
|
|
|
@ -102,6 +102,7 @@ void CWII_IPC_HLE_WiiMote::DoState(PointerWrap &p)
|
|||
p.Do(uclass);
|
||||
p.Do(features);
|
||||
p.Do(lmp_version);
|
||||
p.Do(lmp_subversion);
|
||||
p.Do(m_LinkKey);
|
||||
p.Do(m_Name);
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "HW/WiimoteEmu/WiimoteEmu.h"
|
||||
#include "HW/WiimoteEmu/WiimoteHid.h"
|
||||
#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
|
||||
#include "VideoBackendBase.h"
|
||||
#include "State.h"
|
||||
#include "Timer.h"
|
||||
#include "VideoConfig.h"
|
||||
|
@ -36,9 +35,10 @@
|
|||
#include "HW/EXI_Channel.h"
|
||||
#include "HW/DVDInterface.h"
|
||||
#include "../../Common/Src/NandPaths.h"
|
||||
#include "Crypto/md5.h"
|
||||
|
||||
// large enough for just over 24 hours of single-player recording
|
||||
#define MAX_DTM_LENGTH (40 * 1024 * 1024)
|
||||
// The chunk to allocate movie data in multiples of.
|
||||
#define DTM_BASE_LENGTH (1024)
|
||||
|
||||
std::mutex cs_frameSkip;
|
||||
|
||||
|
@ -56,6 +56,7 @@ u8 g_numPads = 0;
|
|||
ControllerState g_padState;
|
||||
DTMHeader tmpHeader;
|
||||
u8* tmpInput = NULL;
|
||||
size_t tmpInputAllocated = 0;
|
||||
u64 g_currentByte = 0, g_totalBytes = 0;
|
||||
u64 g_currentFrame = 0, g_totalFrames = 0; // VI
|
||||
u64 g_currentLagCount = 0, g_totalLagCount = 0; // just stats
|
||||
|
@ -63,12 +64,13 @@ u64 g_currentInputCount = 0, g_totalInputCount = 0; // just stats
|
|||
u64 g_recordingStartTime; // seconds since 1970 that recording started
|
||||
bool bSaveConfig, bSkipIdle, bDualCore, bProgressive, bDSPHLE, bFastDiscSpeed = false;
|
||||
bool bMemcard, g_bClearSave = false;
|
||||
std::string videoBackend = "opengl";
|
||||
std::string videoBackend = "unknown";
|
||||
int iCPUCore = 1;
|
||||
bool g_bDiscChange = false;
|
||||
std::string g_discChange = "";
|
||||
std::string author = "";
|
||||
u64 g_titleID = 0;
|
||||
unsigned char MD5[16];
|
||||
|
||||
bool g_bRecordingFromSaveState = false;
|
||||
bool g_bPolled = false;
|
||||
|
@ -80,6 +82,25 @@ std::string g_InputDisplay[8];
|
|||
|
||||
ManipFunction mfunc = NULL;
|
||||
|
||||
void EnsureTmpInputSize(size_t bound)
|
||||
{
|
||||
if (tmpInputAllocated >= bound)
|
||||
return;
|
||||
// The buffer expands in powers of two of DTM_BASE_LENGTH
|
||||
// (standard exponential buffer growth).
|
||||
size_t newAlloc = DTM_BASE_LENGTH;
|
||||
while (newAlloc < bound)
|
||||
newAlloc *= 2;
|
||||
u8* newTmpInput = new u8[newAlloc];
|
||||
tmpInputAllocated = newAlloc;
|
||||
if (tmpInput != NULL)
|
||||
{
|
||||
if (g_totalBytes > 0)
|
||||
memcpy(newTmpInput, tmpInput, g_totalBytes);
|
||||
delete[] tmpInput;
|
||||
}
|
||||
tmpInput = newTmpInput;
|
||||
}
|
||||
|
||||
std::string GetInputDisplay()
|
||||
{
|
||||
|
@ -135,6 +156,7 @@ void Init()
|
|||
if (IsPlayingInput())
|
||||
{
|
||||
ReadHeader();
|
||||
std::thread md5thread(CheckMD5);
|
||||
if ((strncmp((char *)tmpHeader.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str(), 6)))
|
||||
{
|
||||
PanicAlert("The recorded game (%s) is not the same as the selected game (%s)", tmpHeader.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str());
|
||||
|
@ -144,7 +166,9 @@ void Init()
|
|||
if (IsRecordingInput())
|
||||
{
|
||||
GetSettings();
|
||||
std::thread md5thread(GetMD5);
|
||||
}
|
||||
|
||||
g_frameSkipCounter = g_framesToSkip;
|
||||
memset(&g_padState, 0, sizeof(g_padState));
|
||||
if (!tmpHeader.bFromSaveState || !IsPlayingInput())
|
||||
|
@ -162,10 +186,6 @@ void Init()
|
|||
g_currentFrame = 0;
|
||||
g_currentLagCount = 0;
|
||||
g_currentInputCount = 0;
|
||||
// we don't clear these things because otherwise we can't resume playback if we load a movie state later
|
||||
//g_totalFrames = g_totalBytes = 0;
|
||||
//delete tmpInput;
|
||||
//tmpInput = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -392,16 +412,20 @@ bool BeginRecordingInput(int controllers)
|
|||
|
||||
// This is only done here if starting from save state because otherwise we won't have the titleid. Otherwise it's set in WII_IPC_HLE_Device_es.cpp.
|
||||
// TODO: find a way to GetTitleDataPath() from Movie::Init()
|
||||
if (File::Exists((Common::GetTitleDataPath(g_titleID) + "banner.bin").c_str()))
|
||||
Movie::g_bClearSave = false;
|
||||
else
|
||||
Movie::g_bClearSave = true;
|
||||
if (Core::g_CoreStartupParameter.bWii)
|
||||
{
|
||||
if (File::Exists((Common::GetTitleDataPath(g_titleID) + "banner.bin").c_str()))
|
||||
Movie::g_bClearSave = false;
|
||||
else
|
||||
Movie::g_bClearSave = true;
|
||||
}
|
||||
std::thread md5thread(GetMD5);
|
||||
}
|
||||
g_playMode = MODE_RECORDING;
|
||||
GetSettings();
|
||||
author = SConfig::GetInstance().m_strMovieAuthor;
|
||||
delete [] tmpInput;
|
||||
tmpInput = new u8[MAX_DTM_LENGTH];
|
||||
EnsureTmpInputSize(1);
|
||||
|
||||
g_currentByte = g_totalBytes = 0;
|
||||
|
||||
Core::DisplayMessage("Starting movie recording", 2000);
|
||||
|
@ -581,7 +605,7 @@ void RecordInput(SPADStatus *PadStatus, int controllerID)
|
|||
g_padState.CStickX = PadStatus->substickX;
|
||||
g_padState.CStickY = PadStatus->substickY;
|
||||
|
||||
|
||||
EnsureTmpInputSize(g_currentByte + 8);
|
||||
memcpy(&(tmpInput[g_currentByte]), &g_padState, 8);
|
||||
g_currentByte += 8;
|
||||
g_totalBytes = g_currentByte;
|
||||
|
@ -605,6 +629,7 @@ void RecordWiimote(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf
|
|||
u8 size = rptf.size;
|
||||
|
||||
InputUpdate();
|
||||
EnsureTmpInputSize(g_currentByte + size + 1);
|
||||
tmpInput[g_currentByte++] = size;
|
||||
memcpy(&(tmpInput[g_currentByte]), data, size);
|
||||
g_currentByte += size;
|
||||
|
@ -635,7 +660,6 @@ void ReadHeader()
|
|||
else
|
||||
{
|
||||
GetSettings();
|
||||
bSaveConfig = false;
|
||||
}
|
||||
|
||||
videoBackend.resize(ARRAYSIZE(tmpHeader.videoBackend));
|
||||
|
@ -655,6 +679,7 @@ void ReadHeader()
|
|||
{
|
||||
author[i] = tmpHeader.author[i];
|
||||
}
|
||||
memcpy(MD5, tmpHeader.md5, 16);
|
||||
}
|
||||
|
||||
bool PlayInput(const char *filename)
|
||||
|
@ -698,8 +723,7 @@ bool PlayInput(const char *filename)
|
|||
g_playMode = MODE_PLAYING;
|
||||
|
||||
g_totalBytes = g_recordfd.GetSize() - 256;
|
||||
delete tmpInput;
|
||||
tmpInput = new u8[MAX_DTM_LENGTH];
|
||||
EnsureTmpInputSize((size_t)g_totalBytes);
|
||||
g_recordfd.ReadArray(tmpInput, (size_t)g_totalBytes);
|
||||
g_currentByte = 0;
|
||||
g_recordfd.Close();
|
||||
|
@ -766,9 +790,8 @@ void LoadInput(const char *filename)
|
|||
g_totalLagCount = tmpHeader.lagCount;
|
||||
g_totalInputCount = tmpHeader.inputCount;
|
||||
|
||||
EnsureTmpInputSize((size_t)totalSavedBytes);
|
||||
g_totalBytes = totalSavedBytes;
|
||||
delete [] tmpInput;
|
||||
tmpInput = new u8[MAX_DTM_LENGTH];
|
||||
t_record.ReadArray(tmpInput, (size_t)g_totalBytes);
|
||||
}
|
||||
else if (g_currentByte > 0)
|
||||
|
@ -1077,6 +1100,7 @@ void SaveRecording(const char *filename)
|
|||
header.bClearSave = g_bClearSave;
|
||||
strncpy((char *)header.discChange, g_discChange.c_str(),ARRAYSIZE(header.discChange));
|
||||
strncpy((char *)header.author, author.c_str(),ARRAYSIZE(header.author));
|
||||
memcpy(header.md5,MD5,16);
|
||||
|
||||
// TODO
|
||||
header.uniqueID = 0;
|
||||
|
@ -1135,4 +1159,46 @@ void GetSettings()
|
|||
g_bClearSave = !File::Exists(SConfig::GetInstance().m_strMemoryCardA);
|
||||
bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD;
|
||||
}
|
||||
|
||||
void CheckMD5()
|
||||
{
|
||||
for (int i=0, n=0; i<16; i++)
|
||||
{
|
||||
if (tmpHeader.md5[i] != 0)
|
||||
continue;
|
||||
n++;
|
||||
if (n == 16)
|
||||
return;
|
||||
}
|
||||
Core::DisplayMessage("Verifying checksum...", 2000);
|
||||
|
||||
unsigned char gameMD5[16];
|
||||
char game[255];
|
||||
memcpy(game, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strFilename.c_str(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strFilename.size());
|
||||
md5_file(game, gameMD5);
|
||||
|
||||
if (memcmp(gameMD5,MD5,16) == 0)
|
||||
Core::DisplayMessage("Checksum of current game matches the recorded game.", 2000);
|
||||
else
|
||||
PanicAlert("Checksum of current game does not match the recorded game!");
|
||||
}
|
||||
|
||||
void GetMD5()
|
||||
{
|
||||
Core::DisplayMessage("Calculating checksum of game file...", 2000);
|
||||
for (int i = 0; i < 16; i++)
|
||||
MD5[i] = 0;
|
||||
char game[255];
|
||||
memcpy(game, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strFilename.c_str(),SConfig::GetInstance().m_LocalCoreStartupParameter.m_strFilename.size());
|
||||
md5_file(game, MD5);
|
||||
Core::DisplayMessage("Finished calculating checksum.", 2000);
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
g_currentInputCount = g_totalInputCount = g_totalFrames = g_totalBytes = 0;
|
||||
delete [] tmpInput;
|
||||
tmpInput = NULL;
|
||||
tmpInputAllocated = 0;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#define __MOVIE_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "FileUtil.h"
|
||||
#include "../../InputCommon/Src/GCPadStatus.h"
|
||||
|
||||
#include <string>
|
||||
|
@ -99,7 +98,7 @@ struct DTMHeader {
|
|||
|
||||
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
|
||||
unsigned char md5[16]; // MD5 of game iso
|
||||
|
||||
u64 recordingStartTime; // seconds since 1970 that recording started (used for RTC)
|
||||
|
||||
|
@ -133,7 +132,6 @@ void Init();
|
|||
|
||||
void SetPolledDevice();
|
||||
|
||||
bool IsAutoFiring();
|
||||
bool IsRecordingInput();
|
||||
bool IsRecordingInputFromSaveState();
|
||||
bool IsJustStartingRecordingInputFromSaveState();
|
||||
|
@ -178,6 +176,9 @@ bool PlayWiimote(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures&
|
|||
void EndPlayInput(bool cont);
|
||||
void SaveRecording(const char *filename);
|
||||
void DoState(PointerWrap &p);
|
||||
void CheckMD5();
|
||||
void GetMD5();
|
||||
void Shutdown();
|
||||
|
||||
std::string GetInputDisplay();
|
||||
|
||||
|
@ -188,4 +189,4 @@ void SetInputManip(ManipFunction);
|
|||
void CallInputManip(SPADStatus *PadStatus, int controllerID);
|
||||
};
|
||||
|
||||
#endif // __FRAME_H
|
||||
#endif // __MOVIE_H
|
||||
|
|
|
@ -71,7 +71,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
|
|||
static std::thread g_save_thread;
|
||||
|
||||
// Don't forget to increase this after doing changes on the savestate system
|
||||
static const int STATE_VERSION = 8;
|
||||
static const int STATE_VERSION = 9;
|
||||
|
||||
struct StateHeader
|
||||
{
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "Common.h" // Common
|
||||
#include "FileUtil.h"
|
||||
#include "Timer.h"
|
||||
#include "Setup.h"
|
||||
|
||||
#include "Globals.h" // Local
|
||||
#include "Frame.h"
|
||||
|
@ -458,13 +457,6 @@ CFrame::CFrame(wxFrame* parent,
|
|||
|
||||
// Update controls
|
||||
UpdateGUI();
|
||||
|
||||
// If we are rerecording create the status bar now instead of later when a game starts
|
||||
#ifdef RERECORDING
|
||||
ModifyStatusBar();
|
||||
// It's to early for the OnHostMessage(), we will update the status when Ctrl or Space is pressed
|
||||
//Core::WriteStatus();
|
||||
#endif
|
||||
}
|
||||
// Destructor
|
||||
CFrame::~CFrame()
|
||||
|
|
|
@ -27,9 +27,6 @@ window handle that is returned by CreateWindow() can be accessed from
|
|||
Core::GetWindowHandle().
|
||||
*/
|
||||
|
||||
|
||||
#include "Setup.h" // Common
|
||||
|
||||
#include "NetWindow.h"
|
||||
#include "Common.h" // Common
|
||||
#include "FileUtil.h"
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "CPUDetect.h"
|
||||
#include "IniFile.h"
|
||||
#include "FileUtil.h"
|
||||
#include "Setup.h"
|
||||
|
||||
#include "Host.h" // Core
|
||||
#include "HW/Wiimote.h"
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "VideoConfig.h"
|
||||
#include "Setup.h"
|
||||
#include "MemoryUtil.h"
|
||||
#include "Thread.h"
|
||||
#include "Atomic.h"
|
||||
|
|
|
@ -111,7 +111,8 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\Common\Src;..\Core\Src;..\..\..\Externals\SOIL;..\..\..\Externals\CLRun\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
|
@ -129,7 +130,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\Common\Src;..\Core\Src;..\..\..\Externals\SOIL;..\..\..\Externals\CLRun\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
@ -141,7 +142,8 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\Common\Src;..\Core\Src;..\..\..\Externals\SOIL;..\..\..\Externals\CLRun\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "Globals.h"
|
||||
#include "VideoConfig.h"
|
||||
#include "IniFile.h"
|
||||
#include "Setup.h"
|
||||
#include "Core.h"
|
||||
#include "Host.h"
|
||||
#include "VideoBackend.h"
|
||||
|
|
|
@ -88,7 +88,6 @@ Make AA apply instantly during gameplay if possible
|
|||
#include "TextureConverter.h"
|
||||
#include "PostProcessing.h"
|
||||
#include "OnScreenDisplay.h"
|
||||
#include "Setup.h"
|
||||
#include "DLCache.h"
|
||||
#include "FramebufferManager.h"
|
||||
#include "Core.h"
|
||||
|
|
Loading…
Reference in New Issue