Audio dumper: append filename with titleid and date-time

prevents overwrite of old file

Co-authored-by: Megamouse <studienricky89@googlemail.com>
This commit is contained in:
illusion 2020-06-01 16:58:14 +11:00 committed by Ivan
parent 437f374bae
commit 0315781306
1 changed files with 9 additions and 1 deletions

View File

@ -1,13 +1,21 @@
#include "stdafx.h"
#include "AudioDumper.h"
#include "Utilities/date_time.h"
#include "Emu/System.h"
AudioDumper::AudioDumper(u16 ch)
: m_header(ch)
{
if (GetCh())
{
m_output.open(fs::get_cache_dir() + "audio.wav", fs::rewrite);
std::string path = fs::get_cache_dir() + "audio_";
if (const std::string id = Emu.GetTitleID(); !id.empty())
{
path += id + "_";
};
path += date_time::current_time_narrow<'_'>() + ".wav";
m_output.open(path, fs::rewrite);
m_output.write(m_header); // write initial file header
}
}