Permalink
Browse files

Use gameID and emulated timestamp for Avi/Wav dump filenames.

  • Loading branch information...
LunaMoo committed Nov 13, 2017
1 parent a0f1276 commit 99ab8dfc997b7012b528729cae460bc6af230238
Showing with 26 additions and 4 deletions.
  1. +12 −2 Core/AVIDump.cpp
  2. +9 −2 Core/HLE/__sceAudio.cpp
  3. +4 −0 Core/HLE/sceKernelTime.cpp
  4. +1 −0 Core/HLE/sceKernelTime.h
View
@@ -34,6 +34,10 @@ extern "C" {
#include "GPU/Common/GPUDebugInterface.h"
#include "Core/ELF/ParamSFO.h"
#include "Core/HLE/sceKernelTime.h"
#include "StringUtils.h"
#ifdef USE_FFMPEG
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 28, 1)
@@ -86,10 +90,16 @@ bool AVIDump::CreateAVI() {
#ifdef USE_FFMPEG
AVCodec* codec = nullptr;
// Use gameID_EmulatedTimestamp for filename
std::string discID = g_paramSFO.GetDiscID();
std::string video_file_name = StringFromFormat("%s%s_%d.avi", GetSysDirectory(DIRECTORY_VIDEO).c_str(), discID, returnEmulatedTime()).c_str();
s_format_context = avformat_alloc_context();
std::stringstream s_file_index_str;
s_file_index_str << s_file_index;
snprintf(s_format_context->filename, sizeof(s_format_context->filename), "%s", (GetSysDirectory(DIRECTORY_VIDEO) + "framedump" + s_file_index_str.str() + ".avi").c_str());
s_file_index_str << video_file_name;
snprintf(s_format_context->filename, sizeof(s_format_context->filename), "%s", s_file_index_str.str().c_str());
INFO_LOG(COMMON, "Recording Video to: %s", s_format_context->filename);
// Make sure that the path exists
if (!File::Exists(GetSysDirectory(DIRECTORY_VIDEO)))
File::CreateDir(GetSysDirectory(DIRECTORY_VIDEO));
View
@@ -35,6 +35,9 @@
#include "Core/System.h"
#ifndef MOBILE_DEVICE
#include "Core/WaveFile.h"
#include "Core/ELF/ParamSFO.h"
#include "Core/HLE/sceKernelTime.h"
#include "StringUtils.h"
#endif
#include "Core/HLE/__sceAudio.h"
#include "Core/HLE/sceAudio.h"
@@ -383,9 +386,13 @@ void __AudioUpdate() {
#ifndef MOBILE_DEVICE
if (!m_logAudio) {
if (g_Config.bDumpAudio) {
std::string audio_file_name = GetSysDirectory(DIRECTORY_AUDIO) + "audiodump.wav";
// Use gameID_EmulatedTimestamp for filename
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,"Recording audio to: %s", audio_file_name.c_str());
// Create the path just in case it doesn't exist
File::CreateDir(GetSysDirectory(DIRECTORY_AUDIO));
if (!File::Exists(GetSysDirectory(DIRECTORY_AUDIO)))
File::CreateDir(GetSysDirectory(DIRECTORY_AUDIO));
File::CreateEmptyFile(audio_file_name);
__StartLogAudio(audio_file_name);
}
@@ -171,3 +171,7 @@ u32 sceKernelLibcGettimeofday(u32 timeAddr, u32 tzAddr)
hleReSchedule("libc timeofday");
return 0;
}
u32 returnEmulatedTime() {
return (u32)start_time + (u32)(CoreTiming::GetGlobalTimeUs() / 1000000ULL);
}
View
@@ -27,6 +27,7 @@ int sceKernelSysClock2USec(u32 sysclockPtr, u32 highPtr, u32 lowPtr);
int sceKernelSysClock2USecWide(u32 lowClock, u32 highClock, u32 lowPtr, u32 highPtr);
u64 sceKernelUSec2SysClockWide(u32 usec);
u32 sceKernelLibcClock();
u32 returnEmulatedTime();
void __KernelTimeInit();
void __KernelTimeDoState(PointerWrap &p);

0 comments on commit 99ab8df

Please sign in to comment.