mirror of https://github.com/PCSX2/pcsx2.git
Capture: Swap int return types with bool
Additionally fix SPU2 error message
This commit is contained in:
parent
df446510da
commit
7b9c8634f4
|
@ -134,8 +134,8 @@ void CALLBACK GSsetGameCRC(int crc, int gameoptions);
|
||||||
void CALLBACK GSsetFrameSkip(int frameskip);
|
void CALLBACK GSsetFrameSkip(int frameskip);
|
||||||
|
|
||||||
// Starts recording GS frame data
|
// Starts recording GS frame data
|
||||||
// returns a non zero value if successful
|
// returns true if successful
|
||||||
int CALLBACK GSsetupRecording(std::string& filename);
|
bool CALLBACK GSsetupRecording(std::string& filename);
|
||||||
|
|
||||||
// Stops recording GS frame data
|
// Stops recording GS frame data
|
||||||
void CALLBACK GSendRecording();
|
void CALLBACK GSendRecording();
|
||||||
|
@ -185,7 +185,7 @@ typedef void(CALLBACK *_GSsetGameCRC)(int, int);
|
||||||
typedef void(CALLBACK *_GSsetFrameSkip)(int frameskip);
|
typedef void(CALLBACK *_GSsetFrameSkip)(int frameskip);
|
||||||
typedef void(CALLBACK *_GSsetVsync)(int enabled);
|
typedef void(CALLBACK *_GSsetVsync)(int enabled);
|
||||||
typedef void(CALLBACK *_GSsetExclusive)(int isExclusive);
|
typedef void(CALLBACK *_GSsetExclusive)(int isExclusive);
|
||||||
typedef int(CALLBACK* _GSsetupRecording)(std::string&);
|
typedef bool(CALLBACK* _GSsetupRecording)(std::string&);
|
||||||
typedef void(CALLBACK* _GSendRecording)();
|
typedef void(CALLBACK* _GSendRecording)();
|
||||||
typedef void(CALLBACK *_GSreset)();
|
typedef void(CALLBACK *_GSreset)();
|
||||||
typedef void(CALLBACK *_GSwriteCSR)(u32 value);
|
typedef void(CALLBACK *_GSwriteCSR)(u32 value);
|
||||||
|
|
|
@ -682,7 +682,7 @@ extern SndOutModule* mods[];
|
||||||
|
|
||||||
extern bool WavRecordEnabled;
|
extern bool WavRecordEnabled;
|
||||||
|
|
||||||
extern int RecordStart(const std::string* filename);
|
extern bool RecordStart(const std::string* filename);
|
||||||
extern void RecordStop();
|
extern void RecordStop();
|
||||||
extern void RecordWrite(const StereoOut16& sample);
|
extern void RecordWrite(const StereoOut16& sample);
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ bool WavRecordEnabled = false;
|
||||||
static WavOutFile* m_wavrecord = nullptr;
|
static WavOutFile* m_wavrecord = nullptr;
|
||||||
static Mutex WavRecordMutex;
|
static Mutex WavRecordMutex;
|
||||||
|
|
||||||
int RecordStart(const std::string* filename)
|
bool RecordStart(const std::string* filename)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -121,16 +121,16 @@ int RecordStart(const std::string* filename)
|
||||||
else
|
else
|
||||||
m_wavrecord = new WavOutFile("audio_recording.wav", 48000, 16, 2);
|
m_wavrecord = new WavOutFile("audio_recording.wav", 48000, 16, 2);
|
||||||
WavRecordEnabled = true;
|
WavRecordEnabled = true;
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
catch (std::runtime_error&)
|
catch (std::runtime_error&)
|
||||||
{
|
{
|
||||||
m_wavrecord = nullptr; // not needed, but what the heck. :)
|
m_wavrecord = nullptr; // not needed, but what the heck. :)
|
||||||
if (filename)
|
if (filename)
|
||||||
SysMessage("SPU2-X couldn't open file for recording: %s.\nWavfile capture disabled.", filename->c_str());
|
SysMessage("SPU2 couldn't open file for recording: %s.\nWavfile capture disabled.", filename->c_str());
|
||||||
else
|
else
|
||||||
SysMessage("SPU2-X couldn't open file for recording: audio_recording.wav.\nWavfile capture disabled.");
|
SysMessage("SPU2 couldn't open file for recording: audio_recording.wav.\nWavfile capture disabled.");
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -579,7 +579,7 @@ void SPU2write(u32 rmem, u16 value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns a non zero value if successful
|
// returns a non zero value if successful
|
||||||
int SPU2setupRecording(const std::string* filename)
|
bool SPU2setupRecording(const std::string* filename)
|
||||||
{
|
{
|
||||||
return RecordStart(filename);
|
return RecordStart(filename);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,8 @@ void SPU2write(u32 mem, u16 value);
|
||||||
u16 SPU2read(u32 mem);
|
u16 SPU2read(u32 mem);
|
||||||
|
|
||||||
// extended funcs
|
// extended funcs
|
||||||
// returns a non zero value if successful
|
// returns true if successful
|
||||||
int SPU2setupRecording(const std::string* filename);
|
bool SPU2setupRecording(const std::string* filename);
|
||||||
void SPU2endRecording();
|
void SPU2endRecording();
|
||||||
|
|
||||||
void SPU2setClockPtr(u32* ptr);
|
void SPU2setClockPtr(u32* ptr);
|
||||||
|
|
|
@ -680,9 +680,9 @@ void AppConfig::LoadSave( IniInterface& ini )
|
||||||
GSWindow .LoadSave( ini );
|
GSWindow .LoadSave( ini );
|
||||||
Framerate .LoadSave( ini );
|
Framerate .LoadSave( ini );
|
||||||
#ifndef DISABLE_RECORDING
|
#ifndef DISABLE_RECORDING
|
||||||
inputRecording .loadSave( ini );
|
inputRecording.loadSave(ini);
|
||||||
#endif
|
#endif
|
||||||
AudioCapture .LoadSave( ini );
|
AudioCapture.LoadSave( ini );
|
||||||
Templates .LoadSave( ini );
|
Templates .LoadSave( ini );
|
||||||
|
|
||||||
ini.Flush();
|
ini.Flush();
|
||||||
|
|
|
@ -811,28 +811,28 @@ void pt(const char* str){
|
||||||
printf("%02i:%02i:%02i%s", current->tm_hour, current->tm_min, current->tm_sec, str);
|
printf("%02i:%02i:%02i%s", current->tm_hour, current->tm_min, current->tm_sec, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(int) GSsetupRecording(std::string& filename)
|
EXPORT_C_(bool) GSsetupRecording(std::string& filename)
|
||||||
{
|
{
|
||||||
if (s_gs == NULL) {
|
if (s_gs == NULL) {
|
||||||
printf("GSdx: no s_gs for recording\n");
|
printf("GSdx: no s_gs for recording\n");
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
#if defined(__unix__) || defined(__APPLE__)
|
#if defined(__unix__) || defined(__APPLE__)
|
||||||
if (!theApp.GetConfigB("capture_enabled")) {
|
if (!theApp.GetConfigB("capture_enabled")) {
|
||||||
printf("GSdx: Recording is disabled\n");
|
printf("GSdx: Recording is disabled\n");
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
printf("GSdx: Recording start command\n");
|
printf("GSdx: Recording start command\n");
|
||||||
if (s_gs->BeginCapture(filename))
|
if (s_gs->BeginCapture(filename))
|
||||||
{
|
{
|
||||||
pt(" - Capture started\n");
|
pt(" - Capture started\n");
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pt(" - Capture cancelled\n");
|
pt(" - Capture cancelled\n");
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -404,7 +404,7 @@ GSCapture::~GSCapture()
|
||||||
EndCapture();
|
EndCapture();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GSCapture::BeginCapture(float fps, GSVector2i recommendedResolution, float aspect, std::string& filename)
|
bool GSCapture::BeginCapture(float fps, GSVector2i recommendedResolution, float aspect, std::string& filename)
|
||||||
{
|
{
|
||||||
printf("Recommended resolution: %d x %d, DAR for muxing: %.4f\n", recommendedResolution.x, recommendedResolution.y, aspect);
|
printf("Recommended resolution: %d x %d, DAR for muxing: %.4f\n", recommendedResolution.x, recommendedResolution.y, aspect);
|
||||||
std::lock_guard<std::recursive_mutex> lock(m_lock);
|
std::lock_guard<std::recursive_mutex> lock(m_lock);
|
||||||
|
@ -418,7 +418,7 @@ int GSCapture::BeginCapture(float fps, GSVector2i recommendedResolution, float a
|
||||||
GSCaptureDlg dlg;
|
GSCaptureDlg dlg;
|
||||||
|
|
||||||
if (IDOK != dlg.DoModal())
|
if (IDOK != dlg.DoModal())
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
{
|
{
|
||||||
const int start = dlg.m_filename.length() - 4;
|
const int start = dlg.m_filename.length() - 4;
|
||||||
|
@ -438,12 +438,10 @@ int GSCapture::BeginCapture(float fps, GSVector2i recommendedResolution, float a
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dlg.InvalidFile();
|
dlg.InvalidFile();
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
m_size.x = (dlg.m_width + 7) & ~7;
|
m_size.x = (dlg.m_width + 7) & ~7;
|
||||||
m_size.y = (dlg.m_height + 7) & ~7;
|
m_size.y = (dlg.m_height + 7) & ~7;
|
||||||
//
|
//
|
||||||
|
@ -458,7 +456,7 @@ int GSCapture::BeginCapture(float fps, GSVector2i recommendedResolution, float a
|
||||||
|| FAILED(hr = cgb->SetFiltergraph(m_graph))
|
|| FAILED(hr = cgb->SetFiltergraph(m_graph))
|
||||||
|| FAILED(hr = cgb->SetOutputFileName(&MEDIASUBTYPE_Avi, std::wstring(dlg.m_filename.begin(), dlg.m_filename.end()).c_str(), &mux, NULL)))
|
|| FAILED(hr = cgb->SetOutputFileName(&MEDIASUBTYPE_Avi, std::wstring(dlg.m_filename.begin(), dlg.m_filename.end()).c_str(), &mux, NULL)))
|
||||||
{
|
{
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_src = new GSSource(m_size.x, m_size.y, fps, NULL, hr, dlg.m_colorspace);
|
m_src = new GSSource(m_size.x, m_size.y, fps, NULL, hr, dlg.m_colorspace);
|
||||||
|
@ -466,22 +464,22 @@ int GSCapture::BeginCapture(float fps, GSVector2i recommendedResolution, float a
|
||||||
if (dlg.m_enc==0)
|
if (dlg.m_enc==0)
|
||||||
{
|
{
|
||||||
if (FAILED(hr = m_graph->AddFilter(m_src, L"Source")))
|
if (FAILED(hr = m_graph->AddFilter(m_src, L"Source")))
|
||||||
return 0;
|
return false;
|
||||||
if (FAILED(hr = m_graph->ConnectDirect(GetFirstPin(m_src, PINDIR_OUTPUT), GetFirstPin(mux, PINDIR_INPUT), NULL)))
|
if (FAILED(hr = m_graph->ConnectDirect(GetFirstPin(m_src, PINDIR_OUTPUT), GetFirstPin(mux, PINDIR_INPUT), NULL)))
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(FAILED(hr = m_graph->AddFilter(m_src, L"Source"))
|
if(FAILED(hr = m_graph->AddFilter(m_src, L"Source"))
|
||||||
|| FAILED(hr = m_graph->AddFilter(dlg.m_enc, L"Encoder")))
|
|| FAILED(hr = m_graph->AddFilter(dlg.m_enc, L"Encoder")))
|
||||||
{
|
{
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(FAILED(hr = m_graph->ConnectDirect(GetFirstPin(m_src, PINDIR_OUTPUT), GetFirstPin(dlg.m_enc, PINDIR_INPUT), NULL))
|
if(FAILED(hr = m_graph->ConnectDirect(GetFirstPin(m_src, PINDIR_OUTPUT), GetFirstPin(dlg.m_enc, PINDIR_INPUT), NULL))
|
||||||
|| FAILED(hr = m_graph->ConnectDirect(GetFirstPin(dlg.m_enc, PINDIR_OUTPUT), GetFirstPin(mux, PINDIR_INPUT), NULL)))
|
|| FAILED(hr = m_graph->ConnectDirect(GetFirstPin(dlg.m_enc, PINDIR_OUTPUT), GetFirstPin(mux, PINDIR_INPUT), NULL)))
|
||||||
{
|
{
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,7 +508,7 @@ int GSCapture::BeginCapture(float fps, GSVector2i recommendedResolution, float a
|
||||||
|
|
||||||
m_capturing = true;
|
m_capturing = true;
|
||||||
filename = dlg.m_filename.erase(dlg.m_filename.length() - 3, 3) + "wav";
|
filename = dlg.m_filename.erase(dlg.m_filename.length() - 3, 3) + "wav";
|
||||||
return 1;
|
return true;
|
||||||
#elif defined(__unix__)
|
#elif defined(__unix__)
|
||||||
// Note I think it doesn't support multiple depth creation
|
// Note I think it doesn't support multiple depth creation
|
||||||
GSmkdir(m_out_dir.c_str());
|
GSmkdir(m_out_dir.c_str());
|
||||||
|
@ -527,7 +525,7 @@ int GSCapture::BeginCapture(float fps, GSVector2i recommendedResolution, float a
|
||||||
|
|
||||||
m_capturing = true;
|
m_capturing = true;
|
||||||
filename = m_out_dir + "/audio_recording.wav";
|
filename = m_out_dir + "/audio_recording.wav";
|
||||||
return 1;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
GSCapture();
|
GSCapture();
|
||||||
virtual ~GSCapture();
|
virtual ~GSCapture();
|
||||||
|
|
||||||
int BeginCapture(float fps, GSVector2i recommendedResolution, float aspect, std::string& filename);
|
bool BeginCapture(float fps, GSVector2i recommendedResolution, float aspect, std::string& filename);
|
||||||
bool DeliverFrame(const void* bits, int pitch, bool rgba);
|
bool DeliverFrame(const void* bits, int pitch, bool rgba);
|
||||||
bool EndCapture();
|
bool EndCapture();
|
||||||
|
|
||||||
|
|
|
@ -533,7 +533,7 @@ bool GSRenderer::MakeSnapshot(const std::string& path)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GSRenderer::BeginCapture(std::string& filename)
|
bool GSRenderer::BeginCapture(std::string& filename)
|
||||||
{
|
{
|
||||||
GSVector4i disp = m_wnd->GetClientRect().fit(m_aspectratio);
|
GSVector4i disp = m_wnd->GetClientRect().fit(m_aspectratio);
|
||||||
float aspect = (float)disp.width() / std::max(1, disp.height());
|
float aspect = (float)disp.width() / std::max(1, disp.height());
|
||||||
|
|
|
@ -72,7 +72,7 @@ public:
|
||||||
void SetAspectRatio(int aspect) {m_aspectratio = aspect;}
|
void SetAspectRatio(int aspect) {m_aspectratio = aspect;}
|
||||||
void SetVSync(int vsync);
|
void SetVSync(int vsync);
|
||||||
|
|
||||||
virtual int BeginCapture(std::string& filename);
|
virtual bool BeginCapture(std::string& filename);
|
||||||
virtual void EndCapture();
|
virtual void EndCapture();
|
||||||
|
|
||||||
void PurgePool();
|
void PurgePool();
|
||||||
|
|
Loading…
Reference in New Issue