misc movie cleanup and fixes

This commit is contained in:
rog 2012-10-20 19:54:38 -04:00
parent 92d2f5dee2
commit 9070e7ff8c
3 changed files with 66 additions and 61 deletions

View File

@ -26,6 +26,7 @@
#include "CoreAudioSoundStream.h" #include "CoreAudioSoundStream.h"
#include "OpenALStream.h" #include "OpenALStream.h"
#include "PulseAudioStream.h" #include "PulseAudioStream.h"
#include "../../Core/Src/Movie.h"
namespace AudioCommon namespace AudioCommon
{ {
@ -115,7 +116,12 @@ namespace AudioCommon
return backends; return backends;
} }
bool UseJIT() { bool UseJIT()
{
if (!Movie::IsDSPHLE() && Movie::IsPlayingInput() && Movie::IsConfigSaved())
{
return true;
}
return ac_Config.m_EnableJIT; return ac_Config.m_EnableJIT;
} }

View File

@ -60,12 +60,12 @@ u64 g_currentFrame = 0, g_totalFrames = 0; // VI
u64 g_currentLagCount = 0, g_totalLagCount = 0; // just stats u64 g_currentLagCount = 0, g_totalLagCount = 0; // just stats
u64 g_currentInputCount = 0, g_totalInputCount = 0; // just stats u64 g_currentInputCount = 0, g_totalInputCount = 0; // just stats
u64 g_recordingStartTime; // seconds since 1970 that recording started u64 g_recordingStartTime; // seconds since 1970 that recording started
bool g_bSaveConfig = false; bool bSaveConfig = false;
bool g_bSkipIdle = false; bool bSkipIdle = false;
bool g_bDualCore = false; bool bDualCore = false;
bool g_bProgressive = false; bool bProgressive = false;
bool g_bDSPHLE = false; bool bDSPHLE = false;
bool g_bFastDiscSpeed = false; bool bFastDiscSpeed = false;
std::string g_videoBackend = "opengl"; std::string g_videoBackend = "opengl";
int g_CPUCore = 1; int g_CPUCore = 1;
bool g_bMemcard; bool g_bMemcard;
@ -130,29 +130,11 @@ void Init()
g_bPolled = false; g_bPolled = false;
g_bFrameStep = false; g_bFrameStep = false;
g_bFrameStop = false; g_bFrameStop = false;
g_bSaveConfig = false; bSaveConfig = false;
g_CPUCore = SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore;
g_bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD; if (IsPlayingInput())
if (IsRecordingInput() || (!tmpHeader.bSaveConfig && IsPlayingInput()))
{ {
g_bSkipIdle = SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle; ReadHeader();
g_bDualCore = SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread;
g_bProgressive = SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive;
g_bDSPHLE = SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE;
g_bFastDiscSpeed = SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed;
g_videoBackend = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend;
g_bBlankMC = !File::Exists(SConfig::GetInstance().m_strMemoryCardA);
}
else if (IsPlayingInput() && tmpHeader.bSaveConfig)
{
g_bSaveConfig = tmpHeader.bSaveConfig;
g_bSkipIdle = tmpHeader.bSkipIdle;
g_bDualCore = tmpHeader.bDualCore;
g_bProgressive = tmpHeader.bProgressive;
g_bDSPHLE = tmpHeader.bDSPHLE;
g_bFastDiscSpeed = tmpHeader.bFastDiscSpeed;
g_CPUCore = tmpHeader.CPUCore;
g_bBlankMC = tmpHeader.bBlankMC;
} }
g_frameSkipCounter = g_framesToSkip; g_frameSkipCounter = g_framesToSkip;
memset(&g_padState, 0, sizeof(g_padState)); memset(&g_padState, 0, sizeof(g_padState));
@ -241,7 +223,7 @@ void FrameSkipping()
g_frameSkipCounter++; g_frameSkipCounter++;
if (g_frameSkipCounter > g_framesToSkip || Core::ShouldSkipFrame(g_frameSkipCounter) == false) if (g_frameSkipCounter > g_framesToSkip || Core::ShouldSkipFrame(g_frameSkipCounter) == false)
g_frameSkipCounter = 0; g_frameSkipCounter = 0;
g_video_backend->Video_SetRendering(!g_frameSkipCounter); g_video_backend->Video_SetRendering(!g_frameSkipCounter);
} }
} }
@ -293,31 +275,31 @@ bool IsUsingWiimote(int wiimote)
bool IsConfigSaved() bool IsConfigSaved()
{ {
return g_bSaveConfig; return bSaveConfig;
} }
bool IsDualCore() bool IsDualCore()
{ {
return g_bDualCore; return bDualCore;
} }
bool IsProgressive() bool IsProgressive()
{ {
return g_bProgressive; return bProgressive;
} }
bool IsSkipIdle() bool IsSkipIdle()
{ {
return g_bSkipIdle; return bSkipIdle;
} }
bool IsDSPHLE() bool IsDSPHLE()
{ {
return g_bDSPHLE; return bDSPHLE;
} }
bool IsFastDiscSpeed() bool IsFastDiscSpeed()
{ {
return g_bFastDiscSpeed; return bFastDiscSpeed;
} }
int GetCPUMode() int GetCPUMode()
@ -387,11 +369,11 @@ bool BeginRecordingInput(int controllers)
} }
g_playMode = MODE_RECORDING; g_playMode = MODE_RECORDING;
g_bSkipIdle = SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle; bSkipIdle = SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle;
g_bDualCore = SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread; bDualCore = SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread;
g_bProgressive = SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive; bProgressive = SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive;
g_bDSPHLE = SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE; bDSPHLE = SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE;
g_bFastDiscSpeed = SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed; bFastDiscSpeed = SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed;
g_videoBackend = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend; g_videoBackend = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend;
g_CPUCore = SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore; g_CPUCore = SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore;
@ -621,27 +603,45 @@ void RecordWiimote(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf
void ReadHeader() void ReadHeader()
{ {
g_numPads = tmpHeader.numControllers; g_numPads = tmpHeader.numControllers;
g_rerecords = tmpHeader.numRerecords;
g_recordingStartTime = tmpHeader.recordingStartTime; g_recordingStartTime = tmpHeader.recordingStartTime;
if (g_rerecords < tmpHeader.numRerecords);
g_rerecords = tmpHeader.numRerecords;
g_bSaveConfig = tmpHeader.bSaveConfig; if (tmpHeader.bSaveConfig)
g_bSkipIdle = tmpHeader.bSkipIdle; {
g_bDualCore = tmpHeader.bDualCore; bSaveConfig = true;
g_bProgressive = tmpHeader.bProgressive; bSkipIdle = tmpHeader.bSkipIdle;
g_bDSPHLE = tmpHeader.bDSPHLE; bDualCore = tmpHeader.bDualCore;
g_bFastDiscSpeed = tmpHeader.bFastDiscSpeed; bProgressive = tmpHeader.bProgressive;
g_CPUCore = tmpHeader.CPUCore; bDSPHLE = tmpHeader.bDSPHLE;
bFastDiscSpeed = tmpHeader.bFastDiscSpeed;
g_CPUCore = tmpHeader.CPUCore;
}
else
{
bSaveConfig = true;
bSkipIdle = SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle;
bDualCore = SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread;
bProgressive = SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive;
bDSPHLE = SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE;
bFastDiscSpeed = SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed;
g_videoBackend = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend;
}
g_videoBackend.resize(ARRAYSIZE(tmpHeader.videoBackend));
for (int i = 0; i < ARRAYSIZE(tmpHeader.videoBackend);i++) for (int i = 0; i < ARRAYSIZE(tmpHeader.videoBackend);i++)
{ {
g_videoBackend[i] = tmpHeader.videoBackend[i]; g_videoBackend[i] = tmpHeader.videoBackend[i];
} }
g_discChange.resize(ARRAYSIZE(tmpHeader.discChange));
for (int i = 0; i < ARRAYSIZE(tmpHeader.discChange);i++) for (int i = 0; i < ARRAYSIZE(tmpHeader.discChange);i++)
{ {
g_discChange[i] = tmpHeader.discChange[i]; g_discChange[i] = tmpHeader.discChange[i];
} }
author.resize(ARRAYSIZE(tmpHeader.author));
for (int i = 0; i < ARRAYSIZE(tmpHeader.author);i++) for (int i = 0; i < ARRAYSIZE(tmpHeader.author);i++)
{ {
author[i] = tmpHeader.author[i]; author[i] = tmpHeader.author[i];
@ -834,8 +834,7 @@ void LoadInput(const char *filename)
} }
t_record.Close(); t_record.Close();
g_rerecords = tmpHeader.numRerecords; bSaveConfig = tmpHeader.bSaveConfig;
g_bSaveConfig = tmpHeader.bSaveConfig;
if (!afterEnd) if (!afterEnd)
{ {
@ -1073,11 +1072,11 @@ void SaveRecording(const char *filename)
header.recordingStartTime = g_recordingStartTime; header.recordingStartTime = g_recordingStartTime;
header.bSaveConfig = true; header.bSaveConfig = true;
header.bSkipIdle = g_bSkipIdle; header.bSkipIdle = bSkipIdle;
header.bDualCore = g_bDualCore; header.bDualCore = bDualCore;
header.bProgressive = g_bProgressive; header.bProgressive = bProgressive;
header.bDSPHLE = g_bDSPHLE; header.bDSPHLE = bDSPHLE;
header.bFastDiscSpeed = g_bFastDiscSpeed; header.bFastDiscSpeed = bFastDiscSpeed;
strncpy((char *)header.videoBackend, g_videoBackend.c_str(),ARRAYSIZE(header.videoBackend)); strncpy((char *)header.videoBackend, g_videoBackend.c_str(),ARRAYSIZE(header.videoBackend));
header.CPUCore = g_CPUCore; header.CPUCore = g_CPUCore;
header.bEFBAccessEnable = g_ActiveConfig.bEFBAccessEnable; header.bEFBAccessEnable = g_ActiveConfig.bEFBAccessEnable;
@ -1095,7 +1094,7 @@ void SaveRecording(const char *filename)
// TODO // TODO
header.uniqueID = 0; header.uniqueID = 0;
// header.audioEmulator; // header.audioEmulator;
save_record.WriteArray(&header, 1); save_record.WriteArray(&header, 1);
bool success = save_record.WriteArray(tmpInput, (size_t)g_totalBytes); bool success = save_record.WriteArray(tmpInput, (size_t)g_totalBytes);

View File

@ -61,8 +61,7 @@ struct ControllerState {
// Global declarations // Global declarations
extern bool g_bFrameStep, g_bPolled, g_bReadOnly, g_bDiscChange; extern bool g_bFrameStep, g_bPolled, g_bReadOnly, g_bDiscChange;
extern bool g_bSaveConfig, g_bSkipIdle, g_bDualCore, g_bProgressive, g_bDSPHLE, g_bFastDiscSpeed, g_bMemcard, g_bBlankMC; extern bool g_bMemcard, g_bBlankMC;
extern bool g_bEFBAccessEnable, g_bEFBCopyEnable;
extern PlayMode g_playMode; extern PlayMode g_playMode;
extern u32 g_framesToSkip, g_frameSkipCounter; extern u32 g_framesToSkip, g_frameSkipCounter;
@ -124,8 +123,9 @@ struct DTMHeader {
u8 reserved[16]; u8 reserved[16];
u8 discChange[40]; // Name of iso file to switch to, for two disc games. u8 discChange[40]; // Name of iso file to switch to, for two disc games.
u8 reserved2[47]; // Make heading 256 bytes, just because we can u8 reserved2[47]; // Make heading 256 bytes, just because we can
}; };
static_assert(sizeof(DTMHeader) == 256, "DTMHeader should be 256 bytes");
#pragma pack(pop) #pragma pack(pop)
void FrameUpdate(); void FrameUpdate();