Fix compile issues because of the earlier std::unique_ptr change in in_xsf.cpp.
--- a/src/in_ncsf/XSFPlayer_NCSF.cpp
+++ b/src/in_ncsf/XSFPlayer_NCSF.cpp
@@ -28,7 +28,7 @@
const char *XSFPlayer::WinampDescription = "NCSF Decoder";
const char *XSFPlayer::WinampExts = "ncsf;minincsf\0DS Nitro Composer Sound Format files (*.ncsf;*.minincsf)\0";
-extern XSFConfig *xSFConfig;
+extern std::unique_ptr<XSFConfig> xSFConfig;
XSFPlayer *XSFPlayer::Create(const std::filesystem::path &path)
{
@@ -107,7 +107,7 @@
static DWORD WINAPI soundViewThread(void *b)
{
- auto xSFConfig_NCSF = static_cast<XSFConfig_NCSF *>(xSFConfig);
+ auto xSFConfig_NCSF = static_cast<XSFConfig_NCSF *>(xSFConfig.get());
xSFConfig_NCSF->CallSoundView(static_cast<XSFPlayer_NCSF *>(b), xSFConfig->GetHInstance(), nullptr);
MSG msg;
while (!killSoundViewThread)
@@ -220,7 +220,7 @@
if (WaitForSingleObject(soundViewThreadHandle, 2000) == WAIT_TIMEOUT)
{
TerminateThread(soundViewThreadHandle, 0);
- static_cast<XSFConfig_NCSF *>(xSFConfig)->CloseSoundView();
+ static_cast<XSFConfig_NCSF *>(xSFConfig.get())->CloseSoundView();
}
CloseHandle(soundViewThreadHandle);
soundViewThreadHandle = INVALID_HANDLE_VALUE;
--- a/src/in_snsf/XSFPlayer_SNSF.cpp
+++ b/src/in_snsf/XSFPlayer_SNSF.cpp
@@ -47,7 +47,7 @@
const char *XSFPlayer::WinampDescription = "SNSF Decoder";
const char *XSFPlayer::WinampExts = "snsf;minisnsf\0SNES Sound Format files (*.snsf;*.minisnsf)\0";
-extern XSFConfig *xSFConfig;
+extern std::unique_ptr<XSFConfig> xSFConfig;
XSFPlayer *XSFPlayer::Create(const std::filesystem::path &path)
{
@@ -217,7 +217,7 @@
Memory.Init();
S9xInitAPU();
- XSFConfig_SNSF *xSFConfig_SNSF = dynamic_cast<XSFConfig_SNSF *>(xSFConfig);
+ XSFConfig_SNSF *xSFConfig_SNSF = dynamic_cast<XSFConfig_SNSF *>(xSFConfig.get());
if (xSFConfig_SNSF->resampler == 4)
S9xInitSound<SincResampler>(10, 0);
else if (xSFConfig_SNSF->resampler == 3)
--- a/src/in_xsf_framework/XSFPlayer.cpp
+++ b/src/in_xsf_framework/XSFPlayer.cpp
@@ -7,13 +7,14 @@
#include <algorithm>
#include <limits>
+#include <memory>
#include <vector>
#include <cstdint>
#include "XSFCommon.h"
#include "XSFConfig.h"
#include "XSFPlayer.h"
-extern XSFConfig *xSFConfig;
+extern std::unique_ptr<XSFConfig> xSFConfig;
XSFPlayer::XSFPlayer() : xSF(), sampleRate(0), detectedSilenceSample(0), detectedSilenceSec(0), skipSilenceOnStartSec(5), lengthSample(0), fadeSample(0), currentSample(0),
prevSampleL(CHECK_SILENCE_BIAS), prevSampleR(CHECK_SILENCE_BIAS), lengthInMS(-1), fadeInMS(-1), volume(1.0), ignoreVolume(false), uses32BitSamplesClampedTo16Bit(false)