From 93c0e13572d237519c34b542c499984b7a0b2a60 Mon Sep 17 00:00:00 2001 From: harry Date: Sun, 22 Jan 2023 09:45:22 -0500 Subject: [PATCH] Fix for Qt GUI wave file recording to support max file path length. --- src/drivers/Qt/ConsoleWindow.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/drivers/Qt/ConsoleWindow.cpp b/src/drivers/Qt/ConsoleWindow.cpp index 5ff7e7a3..b8a7f0e0 100644 --- a/src/drivers/Qt/ConsoleWindow.cpp +++ b/src/drivers/Qt/ConsoleWindow.cpp @@ -4039,7 +4039,7 @@ void consoleWin_t::wavRecordStart(void) if ( !FCEUI_WaveRecordRunning() ) { const char *romFile; - char fileName[1024]; + std::string fileName; romFile = getRomFile(); @@ -4055,20 +4055,20 @@ void consoleWin_t::wavRecordStart(void) if ( lastPath.size() > 0 ) { - strcpy( fileName, lastPath.c_str() ); - strcat( fileName, "/" ); + fileName.assign( lastPath ); + fileName.append( "/" ); } else if ( baseDir ) { - strcpy( fileName, baseDir ); - strcat( fileName, "/wav/" ); + fileName.assign( baseDir ); + fileName.append( "/wav/" ); } else { - fileName[0] = 0; + fileName.clear(); } - strcat( fileName, base ); - strcat( fileName, ".wav"); + fileName.append( base ); + fileName.append(".wav"); //printf("WAV Filepath:'%s'\n", fileName ); } else @@ -4076,7 +4076,7 @@ void consoleWin_t::wavRecordStart(void) return; } FCEU_WRAPPER_LOCK(); - FCEUI_BeginWaveRecord( fileName ); + FCEUI_BeginWaveRecord( fileName.c_str() ); FCEU_WRAPPER_UNLOCK(); } } @@ -4090,7 +4090,6 @@ void consoleWin_t::wavRecordAsStart(void) int ret, useNativeFileDialogVal; QString filename; std::string lastPath; - //char dir[512]; const char *base, *rom; QFileDialog dialog(this, tr("Save WAV Movie for Recording") ); QList urls;