mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-17 19:34:39 +01:00
Add an option to allow resetting video/audio dump on save/load state.
This commit is contained in:
1 parent
99ab8dfc99
commit
e698414f9b
6 files changed
+55
-2
No files matched your search
@@ -360,6 +360,7 @@ static ConfigSetting generalSettings[] = {
|
||||
ConfigSetting("UseFFV1", &g_Config.bUseFFV1, false),
|
||||
ConfigSetting("DumpFrames", &g_Config.bDumpFrames, false),
|
||||
ConfigSetting("DumpAudio", &g_Config.bDumpAudio, false),
|
||||
ConfigSetting("SaveLoadResetsAVdumping", &g_Config.bSaveLoadResetsAVdumping, false),
|
||||
ConfigSetting("StateSlot", &g_Config.iCurrentStateSlot, 0, true, true),
|
||||
ConfigSetting("RewindFlipFrequency", &g_Config.iRewindFlipFrequency, 0, true, true),
|
||||
|
||||
|
||||
@@ -105,6 +105,7 @@ public:
|
||||
bool bUseFFV1;
|
||||
bool bDumpFrames;
|
||||
bool bDumpAudio;
|
||||
bool bSaveLoadResetsAVdumping;
|
||||
bool bEnableLogging;
|
||||
bool bDumpDecryptedEboot;
|
||||
bool bFullscreenOnDoubleclick;
|
||||
|
||||
+15
-1
@@ -331,7 +331,7 @@ void __AudioSetOutputFrequency(int freq) {
|
||||
// Mix samples from the various audio channels into a single sample queue.
|
||||
// This single sample queue is where __AudioMix should read from. If the sample queue is full, we should
|
||||
// just sleep the main emulator thread a little.
|
||||
void __AudioUpdate() {
|
||||
void __AudioUpdate(bool resetRecording) {
|
||||
// Audio throttle doesn't really work on the PSP since the mixing intervals are so closely tied
|
||||
// to the CPU. Much better to throttle the frame rate on frame display and just throw away audio
|
||||
// if the buffer somehow gets full.
|
||||
@@ -384,6 +384,16 @@ void __AudioUpdate() {
|
||||
if (g_Config.bEnableSound) {
|
||||
resampler.PushSamples(mixBuffer, hwBlockSize);
|
||||
#ifndef MOBILE_DEVICE
|
||||
if (g_Config.bSaveLoadResetsAVdumping && resetRecording) {
|
||||
__StopLogAudio();
|
||||
std::string discID = g_paramSFO.GetDiscID();
|
||||
std::string audio_file_name = StringFromFormat("%s%s_%d.wav", GetSysDirectory(DIRECTORY_AUDIO).c_str(), discID, returnEmulatedTime()).c_str();
|
||||
INFO_LOG(COMMON, "Restarted audio recording to: %s", audio_file_name.c_str());
|
||||
if (!File::Exists(GetSysDirectory(DIRECTORY_AUDIO)))
|
||||
File::CreateDir(GetSysDirectory(DIRECTORY_AUDIO));
|
||||
File::CreateEmptyFile(audio_file_name);
|
||||
__StartLogAudio(audio_file_name);
|
||||
}
|
||||
if (!m_logAudio) {
|
||||
if (g_Config.bDumpAudio) {
|
||||
// Use gameID_EmulatedTimestamp for filename
|
||||
@@ -450,3 +460,7 @@ void __StopLogAudio() {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void WAVDump::Reset() {
|
||||
__AudioUpdate(true);
|
||||
}
|
||||
@@ -33,7 +33,7 @@ struct AudioDebugStats {
|
||||
|
||||
void __AudioInit();
|
||||
void __AudioDoState(PointerWrap &p);
|
||||
void __AudioUpdate();
|
||||
void __AudioUpdate(bool resetRecording = false);
|
||||
void __AudioShutdown();
|
||||
void __AudioSetOutputFrequency(int freq);
|
||||
|
||||
@@ -49,3 +49,9 @@ void __PushExternalAudio(const s32 *audio, int numSamples); // Should not be us
|
||||
// Audio Dumping stuff
|
||||
void __StartLogAudio(const std::string& filename);
|
||||
void __StopLogAudio();
|
||||
|
||||
class WAVDump
|
||||
{
|
||||
public:
|
||||
static void Reset();
|
||||
};
|
||||
@@ -46,6 +46,14 @@
|
||||
#include "HW/MemoryStick.h"
|
||||
#include "GPU/GPUState.h"
|
||||
|
||||
#ifndef MOBILE_DEVICE
|
||||
#include "Core/AVIDump.h"
|
||||
#include "Core/HLE/__sceAudio.h"
|
||||
|
||||
AVIDump video;
|
||||
WAVDump audio;
|
||||
#endif
|
||||
|
||||
namespace SaveState
|
||||
{
|
||||
struct SaveStart
|
||||
@@ -591,6 +599,17 @@ namespace SaveState
|
||||
callbackMessage = sc->T("Loaded State");
|
||||
callbackResult = true;
|
||||
hasLoadedState = true;
|
||||
#ifndef MOBILE_DEVICE
|
||||
if (g_Config.bSaveLoadResetsAVdumping) {
|
||||
if (g_Config.bDumpFrames) {
|
||||
video.Stop();
|
||||
video.Start(PSP_CoreParameter().renderWidth, PSP_CoreParameter().renderHeight);
|
||||
}
|
||||
if (g_Config.bDumpAudio) {
|
||||
audio.Reset();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else if (result == CChunkFileReader::ERROR_BROKEN_STATE) {
|
||||
HandleFailure();
|
||||
callbackMessage = i18nLoadFailure;
|
||||
@@ -615,6 +634,17 @@ namespace SaveState
|
||||
if (result == CChunkFileReader::ERROR_NONE) {
|
||||
callbackMessage = sc->T("Saved State");
|
||||
callbackResult = true;
|
||||
#ifndef MOBILE_DEVICE
|
||||
if (g_Config.bSaveLoadResetsAVdumping) {
|
||||
if (g_Config.bDumpFrames) {
|
||||
video.Stop();
|
||||
video.Start(PSP_CoreParameter().renderWidth, PSP_CoreParameter().renderHeight);
|
||||
}
|
||||
if (g_Config.bDumpAudio) {
|
||||
audio.Reset();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else if (result == CChunkFileReader::ERROR_BROKEN_STATE) {
|
||||
HandleFailure();
|
||||
callbackMessage = i18nSaveFailure;
|
||||
|
||||
@@ -781,6 +781,7 @@ void GameSettingsScreen::CreateViews() {
|
||||
systemSettings->Add(new CheckBox(&g_Config.bDumpFrames, sy->T("Record Display")));
|
||||
systemSettings->Add(new CheckBox(&g_Config.bUseFFV1, sy->T("Use Lossless Video Codec (FFV1)")));
|
||||
systemSettings->Add(new CheckBox(&g_Config.bDumpAudio, sy->T("Record Audio")));
|
||||
systemSettings->Add(new CheckBox(&g_Config.bSaveLoadResetsAVdumping, sy->T("Reset Recording on Save/Load State")));
|
||||
#endif
|
||||
systemSettings->Add(new CheckBox(&g_Config.bDayLightSavings, sy->T("Day Light Saving")));
|
||||
static const char *dateFormat[] = { "YYYYMMDD", "MMDDYYYY", "DDMMYYYY"};
|
||||
|
||||
Reference in new issue
Block a user