Browse code

Replace the Sound View dialog with a wxWidgets-based one.

* Removes the one that was orignally based entirely on the DeSmuME one, while still looking most the same but cleaner.
* To accommodate this, I needed to rework how wxWidgets was initialized so the configuration dialog boxes could also work alongside this.
* Needed to add a custom wxApp to handle the above.
* This also means that the configuration dialog no longer needs the plugin's HINSTANCE passed along.
* Had to not disable wxGauge or wxToogleButton for the Sound View dialog.
* Also remove the now-unneeded enums in the XSFConfig*.cpp files.
* Sound View is still done in a thread so its event loop can run independently from the rest of the plugin.
* XSFConfig_NCSF doesn't need to be the one to start the Sound View dialog now.

Naram Qashat authored on 2021/04/10 15:19:43
Showing 20 changed files
... ...
@@ -10,6 +10,7 @@
10 10
 #include <string>
11 11
 #include <cstddef>
12 12
 #include "windowsh_wrapper.h"
13
+#include "XSFApp.h"
13 14
 #include "XSFConfig.h"
14 15
 #include "XSFConfig_2SF.h"
15 16
 #include "XSFConfigDialog_2SF.h"
... ...
@@ -21,16 +22,15 @@ class wxWindow;
21 22
 class XSFConfigDialog;
22 23
 class XSFPlayer;
23 24
 
24
-enum
25
-{
26
-	idInterpolation = 1000,
27
-	idMutes
28
-};
29
-
30 25
 const unsigned XSFConfig::initSampleRate = static_cast<unsigned>(DESMUME_SAMPLE_RATE);
31 26
 const std::string XSFConfig::commonName = "2SF Decoder";
32 27
 const std::string XSFConfig::versionNumber = "0.9b";
33 28
 
29
+XSFApp *XSFApp::Create()
30
+{
31
+	return new XSFApp();
32
+}
33
+
34 34
 XSFConfig *XSFConfig::Create()
35 35
 {
36 36
 	return new XSFConfig_2SF();
... ...
@@ -10,6 +10,7 @@
10 10
 #include <string>
11 11
 #include <cstddef>
12 12
 #include "windowsh_wrapper.h"
13
+#include "XSFApp.h"
13 14
 #include "XSFConfig.h"
14 15
 #include "XSFConfig_GSF.h"
15 16
 #include "XSFConfigDialog_GSF.h"
... ...
@@ -20,16 +21,15 @@ class wxWindow;
20 21
 class XSFConfigDialog;
21 22
 class XSFPlayer;
22 23
 
23
-enum
24
-{
25
-	idLowPassFiltering = 1000,
26
-	idMutes
27
-};
28
-
29 24
 const unsigned XSFConfig::initSampleRate = 44100;
30 25
 const std::string XSFConfig::commonName = "GSF Decoder";
31 26
 const std::string XSFConfig::versionNumber = "0.9b";
32 27
 
28
+XSFApp *XSFApp::Create()
29
+{
30
+	return new XSFApp();
31
+}
32
+
33 33
 XSFConfig *XSFConfig::Create()
34 34
 {
35 35
 	return new XSFConfig_GSF();
... ...
@@ -14,12 +14,11 @@ set(HEADERS
14 14
 	SSEQPlayer/SWAV.h
15 15
 	SSEQPlayer/SYMBSection.h
16 16
 	SSEQPlayer/Track.h
17
-	resource.h
17
+	SoundView.h
18
+	XSFApp_NCSF.h
18 19
 	XSFConfig_NCSF.h
19 20
 	XSFConfigDialog_NCSF.h
20 21
 	XSFPlayer_NCSF.h)
21
-set(RESOURCES
22
-	in_ncsf.rc)
23 22
 set(SOURCES
24 23
 	SSEQPlayer/Channel.cpp
25 24
 	SSEQPlayer/FATSection.cpp
... ...
@@ -34,14 +33,15 @@ set(SOURCES
34 33
 	SSEQPlayer/SWAV.cpp
35 34
 	SSEQPlayer/SYMBSection.cpp
36 35
 	SSEQPlayer/Track.cpp
36
+	SoundView.cpp
37
+	XSFApp_NCSF.cpp
37 38
 	XSFConfig_NCSF.cpp
38 39
 	XSFConfigDialog_NCSF.cpp
39 40
 	XSFPlayer_NCSF.cpp)
40 41
 
41
-add_library(in_ncsf SHARED ${HEADERS} ${RESOURCES} ${SOURCES})
42
+add_library(in_ncsf SHARED ${HEADERS} ${SOURCES})
42 43
 set_target_properties(in_ncsf PROPERTIES PREFIX "")
43 44
 source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Header Files" FILES ${HEADERS})
44
-source_group("Resource Files" FILES ${RESOURCES})
45 45
 source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Source Files" FILES ${SOURCES})
46 46
 target_compile_options(in_ncsf PUBLIC
47 47
 	$<$<CXX_COMPILER_ID:MSVC>:/wd6011 /wd6385 /wd26819>)
48 48
new file mode 100644
... ...
@@ -0,0 +1,278 @@
1
+/*
2
+ * xSF - Sound View Dialog
3
+ * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
+ *
5
+ * Partially based on the vio*sf framework
6
+ *
7
+ * Based on the Sound View dialog box from DeSmuME
8
+ * http://desmume.org/
9
+ */
10
+
11
+#include <string>
12
+#ifdef __GNUC__
13
+# pragma GCC diagnostic push
14
+# pragma GCC diagnostic ignored "-Wold-style-cast"
15
+#elif defined(__clang__)
16
+# pragma clang diagnostic push
17
+# pragma clang diagnostic ignored "-Wold-style-cast"
18
+#endif
19
+#include <wx/button.h>
20
+#include <wx/checkbox.h>
21
+#include <wx/dialog.h>
22
+#include <wx/event.h>
23
+#include <wx/gauge.h>
24
+#include <wx/gbsizer.h>
25
+#include <wx/sizer.h>
26
+#include <wx/stattext.h>
27
+#include <wx/tglbtn.h>
28
+#ifdef __GNUC__
29
+# pragma GCC diagnostic pop
30
+#elif defined(__clang__)
31
+# pragma clang diagnostic pop
32
+#endif
33
+#include "convert.h"
34
+#include "SoundView.h"
35
+#include "SSEQPlayer/common.h"
36
+#include "SSEQPlayer/consts.h"
37
+#include "XSFCommon.h"
38
+#include "XSFConfig_NCSF.h"
39
+#include "XSFPlayer_NCSF.h"
40
+
41
+class wxWindow;
42
+
43
+enum
44
+{
45
+	idVolumeMode = 1,
46
+	idUnmuteAll,
47
+	idChannel00Mute
48
+};
49
+
50
+// Idea comes from https://derekwill.com/2014/06/24/combating-the-lag-of-the-winforms-progressbar/
51
+void SoundView::GaugeSetValueImmediate(wxGauge *gauge, int value)
52
+{
53
+	// This whole thing is to get around the progressive animation of progress bars since Windows Vista
54
+	if (value == gauge->GetRange())
55
+	{
56
+		// When the value equals the maximum, we have to temporarily increase the maximum before setting the value
57
+		gauge->SetRange(value + 1);
58
+		gauge->SetValue(value);
59
+		gauge->SetRange(value);
60
+	}
61
+	else
62
+		gauge->SetValue(value + 1);
63
+	gauge->SetValue(value);
64
+}
65
+
66
+SoundView::SoundView(wxWindow *parent, XSFConfig_NCSF *ncsfConfig, XSFPlayer_NCSF *ncsfPlayer) : wxDialog(parent, wxID_ANY, "Sound View"), config(ncsfConfig), player(ncsfPlayer), channelData(), volumeModeAlternative(false)
67
+{
68
+	auto outerSizer = new wxBoxSizer(wxVERTICAL);
69
+
70
+	auto mainSizer = new wxGridBagSizer;
71
+
72
+	auto volumeModeButton = new wxToggleButton(this, idVolumeMode, "Vol. Mode");
73
+	mainSizer->Add(volumeModeButton, { 0 ,0 }, { 1, 2 }, wxALIGN_LEFT | wxBOTTOM | wxLEFT, 5);
74
+	this->Bind(wxEVT_TOGGLEBUTTON, [&](wxCommandEvent &)
75
+	{
76
+		this->volumeModeAlternative = !this->volumeModeAlternative;
77
+	}, idVolumeMode);
78
+
79
+	auto unmuteAllButton = new wxButton(this, idUnmuteAll, "Unmute All");
80
+	mainSizer->Add(unmuteAllButton, { 0, 5 }, { 1, 1 }, wxALIGN_RIGHT | wxBOTTOM | wxRIGHT, 5);
81
+	this->Bind(wxEVT_BUTTON, [&](wxCommandEvent &)
82
+	{
83
+		for (int i = 0; i < 16; ++i)
84
+			this->channelData[i].muteCheckBox->SetValue(false);
85
+		this->config->mutes.reset();
86
+		this->config->SaveConfig();
87
+		this->player->SetMutes(this->config->mutes);
88
+	}, idUnmuteAll);
89
+
90
+	outerSizer->Add(mainSizer, 1, wxALL | wxEXPAND, 10);
91
+
92
+	for (int i = 0; i < 2; ++i)
93
+	{
94
+		auto volumeLabel = new wxStaticText(this, wxID_ANY, "Volume", wxDefaultPosition, { 150, -1 }, wxALIGN_CENTER_HORIZONTAL | wxBORDER_STATIC);
95
+		mainSizer->Add(volumeLabel, { 1, 7 * i + 1 }, { 1, 2 }, wxALL, 1);
96
+
97
+		auto repeatModeLabel = new wxStaticText(this, wxID_ANY, "Repeat Mode", wxDefaultPosition, { 108, -1 }, wxALIGN_CENTER_HORIZONTAL | wxBORDER_STATIC);
98
+		mainSizer->Add(repeatModeLabel, { 1, 7 * i + 3 }, { 1, 1 }, wxALL, 1);
99
+
100
+		auto stateLabel = new wxStaticText(this, wxID_ANY, "State", wxDefaultPosition, { 90, -1 }, wxALIGN_CENTER_HORIZONTAL | wxBORDER_STATIC);
101
+		mainSizer->Add(stateLabel, { 1, 7 * i + 4 }, { 1, 1 }, wxALL, 1);
102
+
103
+		auto timerValueLabel = new wxStaticText(this, wxID_ANY, "Timer Value", wxDefaultPosition, { 132, -1 }, wxALIGN_CENTER_HORIZONTAL | wxBORDER_STATIC);
104
+		mainSizer->Add(timerValueLabel, { 1, 7 * i + 5 }, { 1, 1 }, wxALL, 1);
105
+
106
+		auto panLabel = new wxStaticText(this, wxID_ANY, "Pan", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL | wxBORDER_STATIC);
107
+		mainSizer->Add(panLabel, { 2, 7 * i + 1 }, { 1, 2 }, wxALL | wxEXPAND, 1);
108
+
109
+		auto formatLabel = new wxStaticText(this, wxID_ANY, "Format", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL | wxBORDER_STATIC);
110
+		mainSizer->Add(formatLabel, { 2, 7 * i + 3 }, { 1, 1 }, wxALL | wxEXPAND, 1);
111
+
112
+		auto loopStartLabel = new wxStaticText(this, wxID_ANY, "Loop Start", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL | wxBORDER_STATIC);
113
+		mainSizer->Add(loopStartLabel, { 2, 7 * i + 4 }, { 1, 1 }, wxALL | wxEXPAND, 1);
114
+
115
+		auto soundPosLenLabel = new wxStaticText(this, wxID_ANY, "Sound Pos / Len", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL | wxBORDER_STATIC);
116
+		mainSizer->Add(soundPosLenLabel, { 2, 7 * i + 5 }, { 1, 1 }, wxALL | wxEXPAND, 1);
117
+	}
118
+
119
+	for (int i = 0; i < 8; ++i)
120
+		for (int j = 0; j < 2; ++j)
121
+		{
122
+			int channelNum = 8 * j + i;
123
+			auto channelLabel = new wxStaticText(this, wxID_ANY, std::string("#") + (channelNum < 10 ? "0" : "") + std::to_string(channelNum));
124
+			mainSizer->Add(channelLabel, { 2 * i + 3, 7 * j }, { 1, 1 }, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 1);
125
+
126
+			auto &currentChannelData = this->channelData[channelNum];
127
+
128
+			currentChannelData.volumeGauge = new wxGauge(this, wxID_ANY, 128, wxDefaultPosition, { 102, 18 }, wxGA_SMOOTH);
129
+			mainSizer->Add(currentChannelData.volumeGauge, { 2 * i + 3, 7 * j + 1 }, { 1, 1 }, wxALIGN_CENTER_VERTICAL | wxALL, 1);
130
+
131
+			currentChannelData.volumeLabel = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL | wxBORDER_STATIC | wxST_NO_AUTORESIZE);
132
+			mainSizer->Add(currentChannelData.volumeLabel, { 2 * i + 3, 7 * j + 2 }, { 1, 1 }, wxALL | wxEXPAND, 1);
133
+
134
+			currentChannelData.repeatModeLabel = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL | wxBORDER_STATIC | wxST_NO_AUTORESIZE);
135
+			mainSizer->Add(currentChannelData.repeatModeLabel, { 2 * i + 3, 7 * j + 3 }, { 1, 1 }, wxALL | wxEXPAND, 1);
136
+
137
+			currentChannelData.stateLabel = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL | wxBORDER_STATIC | wxST_NO_AUTORESIZE);
138
+			mainSizer->Add(currentChannelData.stateLabel, { 2 * i + 3, 7 * j + 4 }, { 1, 1 }, wxALL | wxEXPAND, 1);
139
+
140
+			currentChannelData.timerValueLabel = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL | wxBORDER_STATIC | wxST_NO_AUTORESIZE);
141
+			mainSizer->Add(currentChannelData.timerValueLabel, { 2 * i + 3, 7 * j + 5 }, { 1, 1 }, wxALL | wxEXPAND, 1);
142
+
143
+			currentChannelData.muteCheckBox = new wxCheckBox(this, idChannel00Mute + channelNum, wxEmptyString);
144
+			mainSizer->Add(currentChannelData.muteCheckBox, { 2 * i + 4, 7 * j }, { 1, 1 }, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 1);
145
+			this->Bind(wxEVT_CHECKBOX, [this, currentChannelData, channelNum](wxCommandEvent &)
146
+			{
147
+				this->config->mutes[channelNum] = currentChannelData.muteCheckBox->GetValue();
148
+				this->config->SaveConfig();
149
+				this->player->SetMutes(this->config->mutes);
150
+			}, idChannel00Mute + channelNum);
151
+
152
+			currentChannelData.panGauge = new wxGauge(this, wxID_ANY, 128, wxDefaultPosition, { 102, 18 }, wxGA_SMOOTH);
153
+			mainSizer->Add(currentChannelData.panGauge, { 2 * i + 4, 7 * j + 1 }, { 1, 1 }, wxALIGN_CENTER_VERTICAL | wxALL, 1);
154
+
155
+			currentChannelData.panLabel = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL | wxBORDER_STATIC | wxST_NO_AUTORESIZE);
156
+			mainSizer->Add(currentChannelData.panLabel, { 2 * i + 4, 7 * j + 2 }, { 1, 1 }, wxALL | wxEXPAND, 1);
157
+
158
+			currentChannelData.formatLabel = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL | wxBORDER_STATIC | wxST_NO_AUTORESIZE);
159
+			mainSizer->Add(currentChannelData.formatLabel, { 2 * i + 4, 7 * j + 3 }, { 1, 1 }, wxALL | wxEXPAND, 1);
160
+
161
+			currentChannelData.loopStartLabel = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL | wxBORDER_STATIC | wxST_NO_AUTORESIZE);
162
+			mainSizer->Add(currentChannelData.loopStartLabel, { 2 * i + 4, 7 * j + 4 }, { 1, 1 }, wxALL | wxEXPAND, 1);
163
+
164
+			currentChannelData.soundPosLenLabel = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL | wxBORDER_STATIC | wxST_NO_AUTORESIZE);
165
+			mainSizer->Add(currentChannelData.soundPosLenLabel, { 2 * i + 4, 7 * j + 5 }, { 1, 1 }, wxALL | wxEXPAND, 1);
166
+		}
167
+
168
+	this->SetSizer(outerSizer);
169
+	this->Layout();
170
+	outerSizer->Fit(this);
171
+
172
+	this->Center();
173
+
174
+	this->SyncToConfig();
175
+	this->Bind(wxEVT_IDLE, &SoundView::OnIdle, this);
176
+}
177
+
178
+void SoundView::OnIdle(wxIdleEvent &evt)
179
+{
180
+	this->Refresh();
181
+	evt.RequestMore();
182
+}
183
+
184
+void SoundView::Refresh()
185
+{
186
+	auto ncsfPlayer = this->player;
187
+	std::string buf;
188
+	for (std::size_t chanId = 0; chanId < 16; ++chanId)
189
+	{
190
+		const auto &chn = ncsfPlayer->GetChannel(chanId);
191
+		auto &chnData = this->channelData[chanId];
192
+
193
+		if (chn.state > ChannelState::Start)
194
+		{
195
+			this->GaugeSetValueImmediate(chnData.panGauge, muldiv7(128, chn.reg.panning));
196
+			std::uint8_t datashift = chn.reg.volumeDiv;
197
+			if (datashift == 3)
198
+				datashift = 4;
199
+			std::int32_t vol = muldiv7(128, chn.reg.volumeMul) >> datashift;
200
+			this->GaugeSetValueImmediate(chnData.volumeGauge, vol);
201
+
202
+			if (this->volumeModeAlternative)
203
+				buf = std::to_string(chn.reg.volumeMul) + "/" + std::to_string(1 << datashift);
204
+			else
205
+				buf = std::to_string(vol);
206
+			chnData.volumeLabel->SetLabel(buf);
207
+
208
+			if (!chn.reg.panning)
209
+				buf = "L";
210
+			else if (chn.reg.panning == 64)
211
+				buf = "C";
212
+			else if (chn.reg.panning == 127)
213
+				buf = "R";
214
+			else if (chn.reg.panning < 64)
215
+				buf = "L" + std::to_string(64 - chn.reg.panning);
216
+			else //if (chn.reg.panning > 64)
217
+				buf = "R" + std::to_string(chn.reg.panning - 64);
218
+			chnData.panLabel->SetLabel(buf);
219
+
220
+			static const std::string modes[] = { "Manual", "Loop Infinite", "One-Shot", "Prohibited" };
221
+			chnData.repeatModeLabel->SetLabel(std::to_string(chn.reg.repeatMode) + " (" + modes[chn.reg.repeatMode] + ")");
222
+
223
+			if (chn.reg.format != 3)
224
+			{
225
+				static const std::string formats[] = { "PCM8", "PCM16", "IMA-ADPCM" };
226
+				chnData.formatLabel->SetLabel(std::to_string(chn.reg.format) + " (" + formats[chn.reg.format] + ")");
227
+			}
228
+			else
229
+			{
230
+				buf = "3 (";
231
+				if (chanId < 8)
232
+					buf += "PSG/Noise?";
233
+				else if (chanId < 14)
234
+					buf += ConvertFuncs::TrimDoubleString(std::to_string(chn.reg.waveDuty == 7 ? 0 : 12.5 * (chn.reg.waveDuty + 1))) + "% Square";
235
+				else
236
+					buf += "Noise";
237
+				buf += ")";
238
+				chnData.formatLabel->SetLabel(buf);
239
+			}
240
+
241
+			static const std::string states[] = { "NONE", "START", "ATTACK", "DECAY", "SUSTAIN", "RELEASE" };
242
+			chnData.stateLabel->SetLabel(states[ConvertFuncs::ToIntegral(chn.state)]);
243
+
244
+			chnData.loopStartLabel->SetLabel("samp #" + std::to_string(chn.reg.loopStart));
245
+
246
+			std::string tmpBuf = NumToHexString(chn.reg.timer).substr(2);
247
+			buf = "$" + tmpBuf + " (";
248
+			tmpBuf = ConvertFuncs::TrimDoubleString(std::to_string((ARM7_CLOCK / 2) / static_cast<double>(0x10000 - chn.reg.timer) / 8));
249
+			if (tmpBuf.find('.') != std::string::npos)
250
+				tmpBuf = tmpBuf.substr(0, tmpBuf.find('.') + 2);
251
+			buf += tmpBuf + " Hz)";
252
+			chnData.timerValueLabel->SetLabel(buf);
253
+
254
+			chnData.soundPosLenLabel->SetLabel("samp #" + std::to_string(static_cast<std::uint32_t>(chn.reg.samplePosition)) + " / " + std::to_string(chn.reg.totalLength));
255
+		}
256
+		else if (chnData.lastState != ChannelState::None)
257
+		{
258
+			chnData.panGauge->SetValue(0);
259
+			chnData.volumeGauge->SetValue(0);
260
+			chnData.volumeLabel->SetLabel("---");
261
+			chnData.panLabel->SetLabel("---");
262
+			chnData.repeatModeLabel->SetLabel("---");
263
+			chnData.formatLabel->SetLabel("---");
264
+			chnData.stateLabel->SetLabel("NONE");
265
+			chnData.loopStartLabel->SetLabel("---");
266
+			chnData.timerValueLabel->SetLabel("---");
267
+			chnData.soundPosLenLabel->SetLabel("---");
268
+		}
269
+
270
+		chnData.lastState = chn.state;
271
+	}
272
+}
273
+
274
+void SoundView::SyncToConfig()
275
+{
276
+	for (int i = 0; i < 16; ++i)
277
+		this->channelData[i].muteCheckBox->SetValue(this->config->mutes[i]);
278
+}
0 279
new file mode 100644
... ...
@@ -0,0 +1,65 @@
1
+/*
2
+ * xSF - Sound View Dialog
3
+ * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
+ *
5
+ * Partially based on the vio*sf framework
6
+ *
7
+ * Based on the Sound View dialog box from DeSmuME
8
+ * http://desmume.org/
9
+ */
10
+
11
+#pragma once
12
+
13
+#ifdef __GNUC__
14
+# pragma GCC diagnostic push
15
+# pragma GCC diagnostic ignored "-Wold-style-cast"
16
+#elif defined(__clang__)
17
+# pragma clang diagnostic push
18
+# pragma clang diagnostic ignored "-Wold-style-cast"
19
+#endif
20
+#include <wx/dialog.h>
21
+#ifdef __GNUC__
22
+# pragma GCC diagnostic pop
23
+#elif defined(__clang__)
24
+# pragma clang diagnostic pop
25
+#endif
26
+#include "SSEQPlayer/consts.h"
27
+
28
+class wxCheckBox;
29
+class wxGauge;
30
+class wxIdleEvent;
31
+class wxStaticText;
32
+class wxWindow;
33
+class XSFConfig_NCSF;
34
+class XSFPlayer_NCSF;
35
+
36
+struct SoundViewData
37
+{
38
+	wxGauge *volumeGauge = nullptr;
39
+	wxStaticText *volumeLabel = nullptr;
40
+	wxStaticText *repeatModeLabel = nullptr;
41
+	wxStaticText *stateLabel = nullptr;
42
+	wxStaticText *timerValueLabel = nullptr;
43
+	wxCheckBox *muteCheckBox = nullptr;
44
+	wxGauge *panGauge = nullptr;
45
+	wxStaticText *panLabel = nullptr;
46
+	wxStaticText *formatLabel = nullptr;
47
+	wxStaticText *loopStartLabel = nullptr;
48
+	wxStaticText *soundPosLenLabel = nullptr;
49
+	ChannelState lastState = ChannelState::Start;
50
+};
51
+
52
+class SoundView : public wxDialog
53
+{
54
+	void GaugeSetValueImmediate(wxGauge *gauge, int value);
55
+public:
56
+	SoundView(wxWindow *parent, XSFConfig_NCSF *ncsfConfig, XSFPlayer_NCSF *ncsfPlayer);
57
+	void OnIdle(wxIdleEvent &evt);
58
+	void Refresh();
59
+	void SyncToConfig();
60
+
61
+	XSFConfig_NCSF *config;
62
+	XSFPlayer_NCSF *player;
63
+	SoundViewData channelData[16];
64
+	bool volumeModeAlternative;
65
+};
0 66
new file mode 100644
... ...
@@ -0,0 +1,30 @@
1
+/*
2
+ * xSF - NCSF wxWidgets App
3
+ * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
+ *
5
+ * Partially based on the vio*sf framework
6
+ */
7
+
8
+#include "SoundView.h"
9
+#include "XSFApp_NCSF.h"
10
+
11
+class XSFConfig_NCSF;
12
+class XSFPlayer_NCSF;
13
+
14
+void XSFApp_NCSF::CreateSoundView(XSFConfig_NCSF *config, XSFPlayer_NCSF *player)
15
+{
16
+	this->dialog = new SoundView(nullptr, config, player);
17
+	this->dialog->ShowModal();
18
+}
19
+
20
+void XSFApp_NCSF::SyncSoundViewToConfig()
21
+{
22
+	if (this->dialog)
23
+		this->dialog->SyncToConfig();
24
+}
25
+
26
+void XSFApp_NCSF::DestroySoundView()
27
+{
28
+	this->dialog->Destroy();
29
+	this->dialog = nullptr;
30
+}
0 31
new file mode 100644
... ...
@@ -0,0 +1,23 @@
1
+/*
2
+ * xSF - NCSF wxWidgets App
3
+ * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
+ *
5
+ * Partially based on the vio*sf framework
6
+ */
7
+
8
+#pragma once
9
+
10
+#include "XSFApp.h"
11
+
12
+class SoundView;
13
+class XSFConfig_NCSF;
14
+class XSFPlayer_NCSF;
15
+
16
+class XSFApp_NCSF : public XSFApp
17
+{
18
+	SoundView *dialog;
19
+public:
20
+	void CreateSoundView(XSFConfig_NCSF *config, XSFPlayer_NCSF *player);
21
+	void SyncSoundViewToConfig();
22
+	void DestroySoundView();
23
+};
... ...
@@ -11,37 +11,33 @@
11 11
 #include <cstddef>
12 12
 #include <cstdint>
13 13
 #include "windowsh_wrapper.h"
14
-#include <windowsx.h>
15
-#include <CommCtrl.h>
16
-#include "SSEQPlayer/common.h"
17
-#include "SSEQPlayer/consts.h"
14
+#include "XSFApp.h"
15
+#include "XSFApp_NCSF.h"
18 16
 #include "XSFConfig.h"
19 17
 #include "XSFConfig_NCSF.h"
20 18
 #include "XSFConfigDialog_NCSF.h"
21 19
 #include "XSFPlayer_NCSF.h"
22 20
 #include "convert.h"
23
-#include "resource.h"
24 21
 
25 22
 class wxWindow;
26 23
 class XSFConfigDialog;
27 24
 class XSFPlayer;
28 25
 
29
-enum
30
-{
31
-	idInterpolation = 1000,
32
-	idMutes
33
-};
34
-
35 26
 const unsigned XSFConfig::initSampleRate = 44100;
36 27
 const std::string XSFConfig::commonName = "NCSF Decoder";
37 28
 const std::string XSFConfig::versionNumber = "1.11.1";
38 29
 
30
+XSFApp *XSFApp::Create()
31
+{
32
+	return new XSFApp_NCSF();
33
+}
34
+
39 35
 XSFConfig *XSFConfig::Create()
40 36
 {
41 37
 	return new XSFConfig_NCSF();
42 38
 }
43 39
 
44
-XSFConfig_NCSF::XSFConfig_NCSF() : XSFConfig(), interpolation(0), mutes(), useSoundViewDialog(false), soundViewData()
40
+XSFConfig_NCSF::XSFConfig_NCSF() : XSFConfig(), interpolation(0), mutes(), useSoundViewDialog(false)
45 41
 {
46 42
 	this->supportedSampleRates.push_back(8000);
47 43
 	this->supportedSampleRates.push_back(11025);
... ...
@@ -93,6 +89,8 @@ void XSFConfig_NCSF::ResetSpecificConfigDefaults(XSFConfigDialog *dialog)
93 89
 			ncsfDialog->mute.Add(x);
94 90
 }
95 91
 
92
+extern std::unique_ptr<XSFApp> xSFApp;
93
+
96 94
 void XSFConfig_NCSF::SaveSpecificConfigDialog(XSFConfigDialog *dialog)
97 95
 {
98 96
 	auto ncsfDialog = static_cast<XSFConfigDialog_NCSF *>(dialog);
... ...
@@ -100,6 +98,7 @@ void XSFConfig_NCSF::SaveSpecificConfigDialog(XSFConfigDialog *dialog)
100 98
 	this->interpolation = ncsfDialog->interpolation;
101 99
 	for (std::size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x)
102 100
 		this->mutes[x] = ncsfDialog->mute.Index(x) != wxNOT_FOUND;
101
+	static_cast<XSFApp_NCSF *>(xSFApp.get())->SyncSoundViewToConfig();
103 102
 }
104 103
 
105 104
 void XSFConfig_NCSF::CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool)
... ...
@@ -120,212 +119,3 @@ XSFConfigDialog *XSFConfig_NCSF::CreateDialogBox(wxWindow *window, const std::st
120 119
 {
121 120
 	return new XSFConfigDialog_NCSF(*this, window, title);
122 121
 }
123
-
124
-INT_PTR CALLBACK XSFConfig_NCSF::SoundViewDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
125
-{
126
-	auto data = reinterpret_cast<SoundViewData *>(GetWindowLongW(hwndDlg, DWLP_USER));
127
-	if (!data && uMsg != WM_INITDIALOG)
128
-		return false;
129
-
130
-	switch (uMsg)
131
-	{
132
-		case WM_INITDIALOG:
133
-			if (!data)
134
-			{
135
-				data = reinterpret_cast<SoundViewData *>(lParam);
136
-				SetWindowLongW(hwndDlg, DWLP_USER, reinterpret_cast<LONG>(data));
137
-			}
138
-			data->hDlg = hwndDlg;
139
-			for (int chanId = 0; chanId < 16; ++chanId)
140
-			{
141
-				SendDlgItemMessageW(hwndDlg, IDC_SOUND0VOLBAR + chanId, PBM_SETRANGE, 0, MAKELPARAM(0, 128));
142
-				SendDlgItemMessageW(hwndDlg, IDC_SOUND0PANBAR + chanId, PBM_SETRANGE, 0, MAKELPARAM(0, 128));
143
-				SendDlgItemMessageW(hwndDlg, IDC_SOUND0MUTE + chanId, BM_SETCHECK, data->config->mutes[chanId], 0);
144
-			}
145
-			break;
146
-		case WM_CLOSE:
147
-		case WM_DESTROY:
148
-			data->config->CloseSoundView();
149
-			break;
150
-		case WM_COMMAND:
151
-			{
152
-				auto id = GET_WM_COMMAND_ID(wParam, lParam);
153
-				switch (id)
154
-				{
155
-					case IDC_BUTTON_VOLMODE:
156
-						data->volModeAlternative = !!IsDlgButtonChecked(hwndDlg, IDC_BUTTON_VOLMODE);
157
-						break;
158
-					case IDC_SOUND0MUTE:
159
-					case IDC_SOUND1MUTE:
160
-					case IDC_SOUND2MUTE:
161
-					case IDC_SOUND3MUTE:
162
-					case IDC_SOUND4MUTE:
163
-					case IDC_SOUND5MUTE:
164
-					case IDC_SOUND6MUTE:
165
-					case IDC_SOUND7MUTE:
166
-					case IDC_SOUND8MUTE:
167
-					case IDC_SOUND9MUTE:
168
-					case IDC_SOUND10MUTE:
169
-					case IDC_SOUND11MUTE:
170
-					case IDC_SOUND12MUTE:
171
-					case IDC_SOUND13MUTE:
172
-					case IDC_SOUND14MUTE:
173
-					case IDC_SOUND15MUTE:
174
-						data->config->mutes[id - IDC_SOUND0MUTE] = !!IsDlgButtonChecked(hwndDlg, id);
175
-						data->config->SaveConfig();
176
-						data->player->SetMutes(data->config->mutes);
177
-						break;
178
-					case IDC_SOUND_UNMUTE_ALL:
179
-						for (int chanId = 0; chanId < 16; ++chanId)
180
-							SendDlgItemMessageW(hwndDlg, IDC_SOUND0MUTE + chanId, BM_SETCHECK, false, 0);
181
-						data->config->mutes.reset();
182
-						data->config->SaveConfig();
183
-						data->player->SetMutes(data->config->mutes);
184
-						break;
185
-					default:
186
-						return false;
187
-				}
188
-			}
189
-			break;
190
-		default:
191
-			return false;
192
-	}
193
-
194
-	return true;
195
-}
196
-
197
-void XSFConfig_NCSF::CallSoundView(XSFPlayer *xSFPlayer, HINSTANCE hInstance, HWND hwndParent)
198
-{
199
-	this->soundViewData.reset(new SoundViewData);
200
-	this->soundViewData->config = this;
201
-	this->soundViewData->player = static_cast<XSFPlayer_NCSF *>(xSFPlayer);
202
-
203
-	auto hDlg = CreateDialogParamW(hInstance, MAKEINTRESOURCEW(IDD_SOUND_VIEW), hwndParent, XSFConfig_NCSF::SoundViewDialogProc, reinterpret_cast<LPARAM>(this->soundViewData.get()));
204
-	if (!hDlg)
205
-	{
206
-		this->soundViewData.reset();
207
-		return;
208
-	}
209
-
210
-	ShowWindow(hDlg, SW_SHOW);
211
-	UpdateWindow(hDlg);
212
-}
213
-
214
-static inline void ProgressSetPosImmediate(HWND hDlg, int nIDDlgItem, int nPos)
215
-{
216
-	int nMin = SendDlgItemMessageW(hDlg, nIDDlgItem, PBM_GETRANGE, true, reinterpret_cast<LPARAM>(nullptr));
217
-	int nMax = SendDlgItemMessageW(hDlg, nIDDlgItem, PBM_GETRANGE, false, reinterpret_cast<LPARAM>(nullptr));
218
-
219
-	// get rid of fancy progress animation since Windows Vista
220
-	// http://stackoverflow.com/questions/1061715/how-do-i-make-tprogressbar-stop-lagging
221
-	if (nPos < nMax)
222
-	{
223
-		SendDlgItemMessageW(hDlg, nIDDlgItem, PBM_SETPOS, nPos + 1, 0);
224
-		SendDlgItemMessageW(hDlg, nIDDlgItem, PBM_SETPOS, nPos, 0); // This will set Progress backwards and give an instant update
225
-	}
226
-	else
227
-	{
228
-		SendDlgItemMessageW(hDlg, nIDDlgItem, PBM_SETRANGE32, nMin, nPos + 1);
229
-		SendDlgItemMessageW(hDlg, nIDDlgItem, PBM_SETPOS, nPos + 1, 0);
230
-		SendDlgItemMessageW(hDlg, nIDDlgItem, PBM_SETRANGE32, nMin, nPos); // This will also set Progress backwards also so instant update
231
-	}
232
-}
233
-
234
-void XSFConfig_NCSF::RefreshSoundView()
235
-{
236
-	auto player = this->soundViewData->player;
237
-	auto hDlg = this->soundViewData->hDlg;
238
-	std::wstring buf;
239
-	for (std::size_t chanId = 0; chanId < 16; ++chanId)
240
-	{
241
-		const auto &chn = player->GetChannel(chanId);
242
-
243
-		if (chn.state > ChannelState::Start)
244
-		{
245
-			ProgressSetPosImmediate(hDlg, IDC_SOUND0PANBAR + chanId, muldiv7(128, chn.reg.panning));
246
-			std::uint8_t datashift = chn.reg.volumeDiv;
247
-			if (datashift == 3)
248
-				datashift = 4;
249
-			std::int32_t vol = muldiv7(128, chn.reg.volumeMul) >> datashift;
250
-			ProgressSetPosImmediate(hDlg, IDC_SOUND0VOLBAR + chanId, vol);
251
-
252
-			if (this->soundViewData->volModeAlternative)
253
-				buf = std::to_wstring(chn.reg.volumeMul) + L"/" + std::to_wstring(1 << datashift);
254
-			else
255
-				buf = std::to_wstring(vol);
256
-			SetDlgItemTextW(hDlg, IDC_SOUND0VOL + chanId, buf.c_str());
257
-
258
-			if (!chn.reg.panning)
259
-				buf = L"L";
260
-			else if (chn.reg.panning == 64)
261
-				buf = L"C";
262
-			else if (chn.reg.panning == 127)
263
-				buf = L"R";
264
-			else if (chn.reg.panning < 64)
265
-				buf = L"L" + std::to_wstring(64 - chn.reg.panning);
266
-			else //if (chn.reg.panning > 64)
267
-				buf = L"R" + std::to_wstring(chn.reg.panning - 64);
268
-			SetDlgItemTextW(hDlg, IDC_SOUND0PAN + chanId, buf.c_str());
269
-
270
-			static const std::wstring modes[] = { L"Manual", L"Loop Infinite", L"One-Shot", L"Prohibited" };
271
-			SetDlgItemTextW(hDlg, IDC_SOUND0REPEATMODE + chanId, (std::to_wstring(chn.reg.repeatMode) + L" (" + modes[chn.reg.repeatMode] + L")").c_str());
272
-
273
-			if (chn.reg.format != 3)
274
-			{
275
-				static const std::wstring formats[] = { L"PCM8", L"PCM16", L"IMA-ADPCM" };
276
-				SetDlgItemTextW(hDlg, IDC_SOUND0FORMAT + chanId, (std::to_wstring(chn.reg.format) + L" (" + formats[chn.reg.format] + L")").c_str());
277
-			}
278
-			else
279
-			{
280
-				buf = L"3 (";
281
-				if (chanId < 8)
282
-					buf += L"PSG/Noise?";
283
-				else if (chanId < 14)
284
-					buf += ConvertFuncs::TrimDoubleString(std::to_wstring(chn.reg.waveDuty == 7 ? 0 : 12.5 * (chn.reg.waveDuty + 1))) + L"% Square";
285
-				else
286
-					buf += L"Noise";
287
-				buf += L")";
288
-				SetDlgItemTextW(hDlg, IDC_SOUND0FORMAT + chanId, buf.c_str());
289
-			}
290
-
291
-			static const std::wstring states[] = { L"NONE", L"START", L"ATTACK", L"DECAY", L"SUSTAIN", L"RELEASE" };
292
-			SetDlgItemTextW(hDlg, IDC_SOUND0STATE + chanId, states[ConvertFuncs::ToIntegral(chn.state)].c_str());
293
-
294
-			SetDlgItemTextW(hDlg, IDC_SOUND0PNT + chanId, (L"samp #" + std::to_wstring(chn.reg.loopStart)).c_str());
295
-
296
-			std::wstring tmpBuf = ConvertFuncs::StringToWString(NumToHexString(chn.reg.timer)).substr(2);
297
-			buf = L"$" + tmpBuf + L" (";
298
-			tmpBuf = ConvertFuncs::TrimDoubleString(std::to_wstring((ARM7_CLOCK / 2) / static_cast<double>(0x10000 - chn.reg.timer) / 8));
299
-			if (tmpBuf.find('.') != std::wstring::npos)
300
-				tmpBuf = tmpBuf.substr(0, tmpBuf.find('.') + 2);
301
-			buf += tmpBuf + L" Hz)";
302
-			SetDlgItemTextW(hDlg, IDC_SOUND0TMR + chanId, buf.c_str());
303
-
304
-			SetDlgItemTextW(hDlg, IDC_SOUND0POSLEN + chanId, (L"samp #" + std::to_wstring(static_cast<std::uint32_t>(chn.reg.samplePosition)) + L" / " + std::to_wstring(chn.reg.totalLength)).c_str());
305
-		}
306
-		else if (this->soundViewData->channelLastStates[chanId] != ChannelState::None)
307
-		{
308
-			ProgressSetPosImmediate(hDlg, IDC_SOUND0PANBAR + chanId, 0);
309
-			ProgressSetPosImmediate(hDlg, IDC_SOUND0VOLBAR + chanId, 0);
310
-			SetDlgItemTextW(hDlg, IDC_SOUND0VOL + chanId, L"---");
311
-			SetDlgItemTextW(hDlg, IDC_SOUND0PAN + chanId, L"---");
312
-			SetDlgItemTextW(hDlg, IDC_SOUND0REPEATMODE + chanId, L"---");
313
-			SetDlgItemTextW(hDlg, IDC_SOUND0FORMAT + chanId, L"---");
314
-			SetDlgItemTextW(hDlg, IDC_SOUND0STATE + chanId, L"NONE");
315
-			SetDlgItemTextW(hDlg, IDC_SOUND0PNT + chanId, L"---");
316
-			SetDlgItemTextW(hDlg, IDC_SOUND0TMR + chanId, L"---");
317
-			SetDlgItemTextW(hDlg, IDC_SOUND0POSLEN + chanId, L"---");
318
-		}
319
-
320
-		this->soundViewData->channelLastStates[chanId] = chn.state;
321
-	}
322
-}
323
-
324
-void XSFConfig_NCSF::CloseSoundView()
325
-{
326
-	if (this->soundViewData)
327
-	{
328
-		DestroyWindow(this->soundViewData->hDlg);
329
-		this->soundViewData.reset();
330
-	}
331
-}
... ...
@@ -16,26 +16,11 @@
16 16
 #include "SSEQPlayer/consts.h"
17 17
 #include "XSFConfig.h"
18 18
 
19
+class SoundView;
19 20
 class wxWindow;
20 21
 class XSFConfig_NCSF;
21 22
 class XSFConfigDialog;
22 23
 class XSFPlayer;
23
-class XSFPlayer_NCSF;
24
-
25
-struct SoundViewData
26
-{
27
-	XSFConfig_NCSF *config;
28
-	XSFPlayer_NCSF *player;
29
-	ChannelState channelLastStates[16];
30
-	HWND hDlg;
31
-
32
-	bool volModeAlternative;
33
-
34
-	SoundViewData() : config(nullptr), player(nullptr), hDlg(nullptr), volModeAlternative(false)
35
-	{
36
-		std::fill_n(&this->channelLastStates[0], sizeof(this->channelLastStates), ChannelState::Start);
37
-	}
38
-};
39 24
 
40 25
 class XSFConfig_NCSF : public XSFConfig
41 26
 {
... ...
@@ -51,9 +36,11 @@ protected:
51 36
 	inline static const std::string initMutes = "0000000000000000";
52 37
 
53 38
 	friend class XSFConfig;
54
-	friend struct SoundViewData;
39
+	friend struct SoundViewDataOLD;
40
+	friend class SoundView;
55 41
 	unsigned interpolation;
56 42
 	std::bitset<16> mutes;
43
+	bool useSoundViewDialog;
57 44
 
58 45
 	XSFConfig_NCSF();
59 46
 	void LoadSpecificConfig() override;
... ...
@@ -62,16 +49,7 @@ protected:
62 49
 	void ResetSpecificConfigDefaults(XSFConfigDialog *dialog) override;
63 50
 	void SaveSpecificConfigDialog(XSFConfigDialog *dialog) override;
64 51
 	void CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad) override;
65
-
66
-	bool useSoundViewDialog;
67
-	std::unique_ptr<SoundViewData> soundViewData;
68
-
69
-	static INT_PTR CALLBACK SoundViewDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
70 52
 public:
71 53
 	void About(HWND parent) override;
72 54
 	XSFConfigDialog *CreateDialogBox(wxWindow *window, const std::string &title) override;
73
-
74
-	void CallSoundView(XSFPlayer *xSFPlayer, HINSTANCE hInstance, HWND hwndParent);
75
-	void RefreshSoundView();
76
-	void CloseSoundView();
77 55
 };
... ...
@@ -18,19 +18,35 @@
18 18
 #include <vector>
19 19
 #include <cstddef>
20 20
 #include <cstdint>
21
+#ifdef __GNUC__
22
+# pragma GCC diagnostic push
23
+# pragma GCC diagnostic ignored "-Wold-style-cast"
24
+#elif defined(__clang__)
25
+# pragma clang diagnostic push
26
+# pragma clang diagnostic ignored "-Wold-style-cast"
27
+#endif
28
+#include <wx/app.h>
29
+#ifdef __GNUC__
30
+# pragma GCC diagnostic pop
31
+#elif defined(__clang__)
32
+# pragma clang diagnostic pop
33
+#endif
21 34
 #include <zlib.h>
35
+#include "SSEQPlayer/common.h"
36
+#include "SSEQPlayer/consts.h"
37
+#include "SSEQPlayer/Player.h"
38
+#include "SSEQPlayer/SDAT.h"
39
+#include "XSFApp.h"
40
+#include "XSFApp_NCSF.h"
22 41
 #include "XSFCommon.h"
23 42
 #include "XSFConfig_NCSF.h"
24 43
 #include "XSFPlayer_NCSF.h"
25
-#include "SSEQPlayer/SDAT.h"
26
-#include "SSEQPlayer/Player.h"
27
-#include "SSEQPlayer/common.h"
28
-#include "SSEQPlayer/consts.h"
29 44
 
30 45
 const char *XSFPlayer::WinampDescription = "NCSF Decoder";
31 46
 const char *XSFPlayer::WinampExts = "ncsf;minincsf\0DS Nitro Composer Sound Format files (*.ncsf;*.minincsf)\0";
32 47
 
33 48
 extern std::unique_ptr<XSFConfig> xSFConfig;
49
+extern std::unique_ptr<XSFApp> xSFApp;
34 50
 
35 51
 XSFPlayer *XSFPlayer::Create(const std::filesystem::path &path)
36 52
 {
... ...
@@ -105,23 +121,10 @@ XSFPlayer_NCSF::XSFPlayer_NCSF(const std::filesystem::path &path) : XSFPlayer(),
105 121
 }
106 122
 
107 123
 static std::unique_ptr<std::thread> soundViewThreadHandle;
108
-static std::atomic_bool killSoundViewThread;
109 124
 
110 125
 static void soundViewThread(XSFPlayer_NCSF *player)
111 126
 {
112
-	auto xSFConfig_NCSF = static_cast<XSFConfig_NCSF *>(xSFConfig.get());
113
-	xSFConfig_NCSF->CallSoundView(player, xSFConfig->GetHInstance(), nullptr);
114
-	MSG msg;
115
-	while (!killSoundViewThread)
116
-	{
117
-		xSFConfig_NCSF->RefreshSoundView();
118
-		if (PeekMessageW(&msg, nullptr, 0, 0, PM_REMOVE))
119
-		{
120
-			TranslateMessage(&msg);
121
-			DispatchMessageW(&msg);
122
-		}
123
-	}
124
-	xSFConfig_NCSF->CloseSoundView();
127
+	static_cast<XSFApp_NCSF *>(xSFApp.get())->CreateSoundView(static_cast<XSFConfig_NCSF *>(xSFConfig.get()), player);
125 128
 }
126 129
 
127 130
 XSFPlayer_NCSF::~XSFPlayer_NCSF()
... ...
@@ -135,10 +138,7 @@ bool XSFPlayer_NCSF::Load()
135 138
 		return false;
136 139
 
137 140
 	if (this->useSoundViewDialog)
138
-	{
139
-		killSoundViewThread = false;
140 141
 		soundViewThreadHandle.reset(new std::thread(soundViewThread, this));
141
-	}
142 142
 
143 143
 	PseudoFile file;
144 144
 	file.data = &this->sdatData;
... ...
@@ -210,9 +210,12 @@ void XSFPlayer_NCSF::Terminate()
210 210
 {
211 211
 	this->player.Stop(true);
212 212
 
213
-	killSoundViewThread = true;
214
-	soundViewThreadHandle->join();
215
-	soundViewThreadHandle.reset();
213
+	if (soundViewThreadHandle)
214
+	{
215
+		static_cast<XSFApp_NCSF *>(xSFApp.get())->DestroySoundView();
216
+		soundViewThreadHandle->join();
217
+		soundViewThreadHandle.reset();
218
+	}
216 219
 }
217 220
 
218 221
 void XSFPlayer_NCSF::SetUseSoundViewDialog(bool newUseSoundViewDialog)
... ...
@@ -17,9 +17,9 @@
17 17
 #include <vector>
18 18
 #include <cstddef>
19 19
 #include <cstdint>
20
-#include "XSFPlayer.h"
21
-#include "SSEQPlayer/SDAT.h"
22 20
 #include "SSEQPlayer/Player.h"
21
+#include "SSEQPlayer/SDAT.h"
22
+#include "XSFPlayer.h"
23 23
 
24 24
 class XSFFile;
25 25
 
26 26
deleted file mode 100644
... ...
@@ -1,301 +0,0 @@
1
-// Microsoft Visual C++ generated resource script.
2
-//
3
-#include "resource.h"
4
-
5
-#define APSTUDIO_READONLY_SYMBOLS
6
-/////////////////////////////////////////////////////////////////////////////
7
-//
8
-// Generated from the TEXTINCLUDE 2 resource.
9
-//
10
-#include "afxres.h"
11
-
12
-/////////////////////////////////////////////////////////////////////////////
13
-#undef APSTUDIO_READONLY_SYMBOLS
14
-
15
-/////////////////////////////////////////////////////////////////////////////
16
-// English (United States) resources
17
-
18
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
19
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
20
-
21
-#ifdef APSTUDIO_INVOKED
22
-/////////////////////////////////////////////////////////////////////////////
23
-//
24
-// TEXTINCLUDE
25
-//
26
-
27
-1 TEXTINCLUDE
28
-BEGIN
29
-    "resource.h\0"
30
-END
31
-
32
-2 TEXTINCLUDE
33
-BEGIN
34
-    "#include ""afxres.h""\r\n"
35
-    "\0"
36
-END
37
-
38
-3 TEXTINCLUDE
39
-BEGIN
40
-    "\r\n"
41
-    "\0"
42
-END
43
-
44
-#endif    // APSTUDIO_INVOKED
45
-
46
-
47
-/////////////////////////////////////////////////////////////////////////////
48
-//
49
-// Dialog
50
-//
51
-
52
-IDD_SOUND_VIEW DIALOGEX 0, 0, 718, 269
53
-STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
54
-CAPTION "Sound View"
55
-FONT 8, "Ms Shell Dlg 2", 0, 0, 0x0
56
-BEGIN
57
-    CTEXT           "Volume",IDC_STATIC,30,22,100,11,0,WS_EX_STATICEDGE
58
-    CTEXT           "Pan",IDC_STATIC,30,34,100,11,0,WS_EX_STATICEDGE
59
-    CTEXT           "Repeat Mode",IDC_STATIC,131,22,72,11,0,WS_EX_STATICEDGE
60
-    CTEXT           "Format",IDC_STATIC,131,34,72,11,0,WS_EX_STATICEDGE
61
-    CTEXT           "State",IDC_STATIC,204,22,60,11,0,WS_EX_STATICEDGE
62
-    CTEXT           "Loop Start",IDC_STATIC,204,34,60,11,0,WS_EX_STATICEDGE
63
-    CTEXT           "Timer Value",IDC_STATIC,265,22,88,11,0,WS_EX_STATICEDGE
64
-    CTEXT           "Sound Pos / Len",IDC_STATIC,265,34,88,11,0,WS_EX_STATICEDGE
65
-    CTEXT           "Volume",IDC_STATIC,381,22,100,11,0,WS_EX_STATICEDGE
66
-    CTEXT           "Pan",IDC_STATIC,381,34,100,11,0,WS_EX_STATICEDGE
67
-    CTEXT           "Repeat Mode",IDC_STATIC,482,22,72,11,0,WS_EX_STATICEDGE
68
-    CTEXT           "Format",IDC_STATIC,482,34,72,11,0,WS_EX_STATICEDGE
69
-    CTEXT           "State",IDC_STATIC,555,22,60,11,0,WS_EX_STATICEDGE
70
-    CTEXT           "Loop Start",IDC_STATIC,555,34,60,11,0,WS_EX_STATICEDGE
71
-    CTEXT           "Timer Value",IDC_STATIC,616,22,88,11,0,WS_EX_STATICEDGE
72
-    CTEXT           "Sound Pos / Len",IDC_STATIC,616,34,88,11,0,WS_EX_STATICEDGE
73
-    RTEXT           "#00",IDC_STATIC,4,50,23,10
74
-    CONTROL         "",IDC_SOUND0VOLBAR,"msctls_progress32",PBS_SMOOTH,30,49,68,11
75
-    CTEXT           "",IDC_SOUND0VOL,100,49,30,11,0,WS_EX_STATICEDGE
76
-    CONTROL         "",IDC_SOUND0PANBAR,"msctls_progress32",PBS_SMOOTH,30,62,68,10
77
-    CTEXT           "",IDC_SOUND0PAN,100,61,30,11,0,WS_EX_STATICEDGE
78
-    CTEXT           "",IDC_SOUND0REPEATMODE,131,49,72,11,0,WS_EX_STATICEDGE
79
-    CTEXT           "",IDC_SOUND0FORMAT,131,61,72,11,0,WS_EX_STATICEDGE
80
-    CTEXT           "",IDC_SOUND0STATE,204,49,60,11,0,WS_EX_STATICEDGE
81
-    CTEXT           "",IDC_SOUND0PNT,204,61,60,11,0,WS_EX_STATICEDGE
82
-    CTEXT           "",IDC_SOUND0TMR,265,49,88,11,0,WS_EX_STATICEDGE
83
-    CTEXT           "",IDC_SOUND0POSLEN,265,61,88,11,0,WS_EX_STATICEDGE
84
-    RTEXT           "#01",IDC_STATIC,4,75,23,10
85
-    CONTROL         "",IDC_SOUND1VOLBAR,"msctls_progress32",PBS_SMOOTH,30,74,68,11
86
-    CTEXT           "",IDC_SOUND1VOL,100,74,30,11,0,WS_EX_STATICEDGE
87
-    CONTROL         "",IDC_SOUND1PANBAR,"msctls_progress32",PBS_SMOOTH,30,87,68,11
88
-    CTEXT           "",IDC_SOUND1PAN,100,87,30,11,0,WS_EX_STATICEDGE
89
-    CTEXT           "",IDC_SOUND1REPEATMODE,131,74,72,11,0,WS_EX_STATICEDGE
90
-    CTEXT           "",IDC_SOUND1FORMAT,131,87,72,11,0,WS_EX_STATICEDGE
91
-    CTEXT           "",IDC_SOUND1STATE,204,74,60,11,0,WS_EX_STATICEDGE
92
-    CTEXT           "",IDC_SOUND1PNT,204,87,60,11,0,WS_EX_STATICEDGE
93
-    CTEXT           "",IDC_SOUND1TMR,265,74,88,11,0,WS_EX_STATICEDGE
94
-    CTEXT           "",IDC_SOUND1POSLEN,265,87,88,11,0,WS_EX_STATICEDGE
95
-    RTEXT           "#02",IDC_STATIC,4,101,23,10
96
-    CONTROL         "",IDC_SOUND2VOLBAR,"msctls_progress32",PBS_SMOOTH,30,100,68,11
97
-    CTEXT           "",IDC_SOUND2VOL,100,100,30,11,0,WS_EX_STATICEDGE
98
-    CONTROL         "",IDC_SOUND2PANBAR,"msctls_progress32",PBS_SMOOTH,30,113,68,11
99
-    CTEXT           "",IDC_SOUND2PAN,100,113,30,11,0,WS_EX_STATICEDGE
100
-    CTEXT           "",IDC_SOUND2REPEATMODE,131,100,72,11,0,WS_EX_STATICEDGE
101
-    CTEXT           "",IDC_SOUND2FORMAT,131,113,72,11,0,WS_EX_STATICEDGE
102
-    CTEXT           "",IDC_SOUND2STATE,204,100,60,11,0,WS_EX_STATICEDGE
103
-    CTEXT           "",IDC_SOUND2PNT,204,113,60,11,0,WS_EX_STATICEDGE
104
-    CTEXT           "",IDC_SOUND2TMR,265,100,88,11,0,WS_EX_STATICEDGE
105
-    CTEXT           "",IDC_SOUND2POSLEN,265,113,88,11,0,WS_EX_STATICEDGE
106
-    RTEXT           "#03",IDC_STATIC,4,127,23,10
107
-    CONTROL         "",IDC_SOUND3VOLBAR,"msctls_progress32",PBS_SMOOTH,30,126,68,11
108
-    CTEXT           "",IDC_SOUND3VOL,100,126,30,11,0,WS_EX_STATICEDGE
109
-    CONTROL         "",IDC_SOUND3PANBAR,"msctls_progress32",PBS_SMOOTH,30,139,68,11
110
-    CTEXT           "",IDC_SOUND3PAN,100,139,30,11,0,WS_EX_STATICEDGE
111
-    CTEXT           "",IDC_SOUND3REPEATMODE,131,126,72,11,0,WS_EX_STATICEDGE
112
-    CTEXT           "",IDC_SOUND3FORMAT,131,139,72,11,0,WS_EX_STATICEDGE
113
-    CTEXT           "",IDC_SOUND3STATE,204,126,60,11,0,WS_EX_STATICEDGE
114
-    CTEXT           "",IDC_SOUND3PNT,204,139,60,11,0,WS_EX_STATICEDGE
115
-    CTEXT           "",IDC_SOUND3TMR,265,126,88,11,0,WS_EX_STATICEDGE
116
-    CTEXT           "",IDC_SOUND3POSLEN,265,139,88,11,0,WS_EX_STATICEDGE
117
-    RTEXT           "#04",IDC_STATIC,4,153,23,10
118
-    CONTROL         "",IDC_SOUND4VOLBAR,"msctls_progress32",PBS_SMOOTH,30,152,68,11
119
-    CTEXT           "",IDC_SOUND4VOL,100,152,30,11,0,WS_EX_STATICEDGE
120
-    CONTROL         "",IDC_SOUND4PANBAR,"msctls_progress32",PBS_SMOOTH,30,165,68,11
121
-    CTEXT           "",IDC_SOUND4PAN,100,165,30,11,0,WS_EX_STATICEDGE
122
-    CTEXT           "",IDC_SOUND4REPEATMODE,131,152,72,11,0,WS_EX_STATICEDGE
123
-    CTEXT           "",IDC_SOUND4FORMAT,131,165,72,11,0,WS_EX_STATICEDGE
124
-    CTEXT           "",IDC_SOUND4STATE,204,152,60,11,0,WS_EX_STATICEDGE
125
-    CTEXT           "",IDC_SOUND4PNT,204,165,60,11,0,WS_EX_STATICEDGE
126
-    CTEXT           "",IDC_SOUND4TMR,265,152,88,11,0,WS_EX_STATICEDGE
127
-    CTEXT           "",IDC_SOUND4POSLEN,265,165,88,11,0,WS_EX_STATICEDGE
128
-    RTEXT           "#05",IDC_STATIC,4,179,23,10
129
-    CONTROL         "",IDC_SOUND5VOLBAR,"msctls_progress32",PBS_SMOOTH,30,178,68,11
130
-    CTEXT           "",IDC_SOUND5VOL,100,178,30,11,0,WS_EX_STATICEDGE
131
-    CONTROL         "",IDC_SOUND5PANBAR,"msctls_progress32",PBS_SMOOTH,30,191,68,11
132
-    CTEXT           "",IDC_SOUND5PAN,100,191,30,11,0,WS_EX_STATICEDGE
133
-    CTEXT           "",IDC_SOUND5REPEATMODE,131,178,72,11,0,WS_EX_STATICEDGE
134
-    CTEXT           "",IDC_SOUND5FORMAT,131,191,72,11,0,WS_EX_STATICEDGE
135
-    CTEXT           "",IDC_SOUND5STATE,204,178,60,11,0,WS_EX_STATICEDGE
136
-    CTEXT           "",IDC_SOUND5PNT,204,191,60,11,0,WS_EX_STATICEDGE
137
-    CTEXT           "",IDC_SOUND5TMR,265,178,88,11,0,WS_EX_STATICEDGE
138
-    CTEXT           "",IDC_SOUND5POSLEN,265,191,88,11,0,WS_EX_STATICEDGE
139
-    RTEXT           "#06",IDC_STATIC,4,205,23,10
140
-    CONTROL         "",IDC_SOUND6VOLBAR,"msctls_progress32",PBS_SMOOTH,30,204,68,11
141
-    CTEXT           "",IDC_SOUND6VOL,100,204,30,11,0,WS_EX_STATICEDGE
142
-    CONTROL         "",IDC_SOUND6PANBAR,"msctls_progress32",PBS_SMOOTH,30,217,68,11
143
-    CTEXT           "",IDC_SOUND6PAN,100,217,30,11,0,WS_EX_STATICEDGE
144
-    CTEXT           "",IDC_SOUND6REPEATMODE,131,204,72,11,0,WS_EX_STATICEDGE
145
-    CTEXT           "",IDC_SOUND6FORMAT,131,217,72,11,0,WS_EX_STATICEDGE
146
-    CTEXT           "",IDC_SOUND6STATE,204,204,60,11,0,WS_EX_STATICEDGE
147
-    CTEXT           "",IDC_SOUND6PNT,204,217,60,11,0,WS_EX_STATICEDGE
148
-    CTEXT           "",IDC_SOUND6TMR,265,204,88,11,0,WS_EX_STATICEDGE
149
-    CTEXT           "",IDC_SOUND6POSLEN,265,217,88,11,0,WS_EX_STATICEDGE
150
-    RTEXT           "#07",IDC_STATIC,4,231,23,10
151
-    CONTROL         "",IDC_SOUND7VOLBAR,"msctls_progress32",PBS_SMOOTH,30,230,68,11
152
-    CTEXT           "",IDC_SOUND7VOL,100,230,30,11,0,WS_EX_STATICEDGE
153
-    CONTROL         "",IDC_SOUND7PANBAR,"msctls_progress32",PBS_SMOOTH,30,244,68,11
154
-    CTEXT           "",IDC_SOUND7PAN,100,244,30,11,0,WS_EX_STATICEDGE
155
-    CTEXT           "",IDC_SOUND7REPEATMODE,131,230,72,11,0,WS_EX_STATICEDGE
156
-    CTEXT           "",IDC_SOUND7FORMAT,131,244,72,11,0,WS_EX_STATICEDGE
157
-    CTEXT           "",IDC_SOUND7STATE,204,230,60,11,0,WS_EX_STATICEDGE
158
-    CTEXT           "",IDC_SOUND7PNT,204,244,60,11,0,WS_EX_STATICEDGE
159
-    CTEXT           "",IDC_SOUND7TMR,265,230,88,11,0,WS_EX_STATICEDGE
160
-    CTEXT           "",IDC_SOUND7POSLEN,265,244,88,11,0,WS_EX_STATICEDGE
161
-    RTEXT           "#08",IDC_STATIC,355,50,23,10
162
-    CONTROL         "",IDC_SOUND8VOLBAR,"msctls_progress32",PBS_SMOOTH,381,49,68,11
163
-    CTEXT           "",IDC_SOUND8VOL,451,49,30,11,0,WS_EX_STATICEDGE
164
-    CONTROL         "",IDC_SOUND8PANBAR,"msctls_progress32",PBS_SMOOTH,381,62,68,10
165
-    CTEXT           "",IDC_SOUND8PAN,451,61,30,11,0,WS_EX_STATICEDGE
166
-    CTEXT           "",IDC_SOUND8REPEATMODE,482,49,72,11,0,WS_EX_STATICEDGE
167
-    CTEXT           "",IDC_SOUND8FORMAT,482,61,72,11,0,WS_EX_STATICEDGE
168
-    CTEXT           "",IDC_SOUND8STATE,555,49,60,11,0,WS_EX_STATICEDGE
169
-    CTEXT           "",IDC_SOUND8PNT,555,61,60,11,0,WS_EX_STATICEDGE
170
-    CTEXT           "",IDC_SOUND8TMR,616,49,88,11,0,WS_EX_STATICEDGE
171
-    CTEXT           "",IDC_SOUND8POSLEN,616,61,88,11,0,WS_EX_STATICEDGE
172
-    RTEXT           "#09",IDC_STATIC,355,75,23,10
173
-    CONTROL         "",IDC_SOUND9VOLBAR,"msctls_progress32",PBS_SMOOTH,381,74,68,11
174
-    CTEXT           "",IDC_SOUND9VOL,451,74,30,11,0,WS_EX_STATICEDGE
175
-    CONTROL         "",IDC_SOUND9PANBAR,"msctls_progress32",PBS_SMOOTH,381,87,68,11
176
-    CTEXT           "",IDC_SOUND9PAN,451,87,30,11,0,WS_EX_STATICEDGE
177
-    CTEXT           "",IDC_SOUND9REPEATMODE,482,74,72,11,0,WS_EX_STATICEDGE
178
-    CTEXT           "",IDC_SOUND9FORMAT,482,87,72,11,0,WS_EX_STATICEDGE
179
-    CTEXT           "",IDC_SOUND9STATE,555,74,60,11,0,WS_EX_STATICEDGE
180
-    CTEXT           "",IDC_SOUND9PNT,555,87,60,11,0,WS_EX_STATICEDGE
181
-    CTEXT           "",IDC_SOUND9TMR,616,74,88,11,0,WS_EX_STATICEDGE
182
-    CTEXT           "",IDC_SOUND9POSLEN,616,87,88,11,0,WS_EX_STATICEDGE
183
-    RTEXT           "#10",IDC_STATIC,355,101,23,10
184
-    CONTROL         "",IDC_SOUND10VOLBAR,"msctls_progress32",PBS_SMOOTH,381,100,68,11
185
-    CTEXT           "",IDC_SOUND10VOL,451,100,30,11,0,WS_EX_STATICEDGE
186
-    CONTROL         "",IDC_SOUND10PANBAR,"msctls_progress32",PBS_SMOOTH,381,113,68,11
187
-    CTEXT           "",IDC_SOUND10PAN,451,113,30,11,0,WS_EX_STATICEDGE
188
-    CTEXT           "",IDC_SOUND10REPEATMODE,482,100,72,11,0,WS_EX_STATICEDGE
189
-    CTEXT           "",IDC_SOUND10FORMAT,482,113,72,11,0,WS_EX_STATICEDGE
190
-    CTEXT           "",IDC_SOUND10STATE,555,100,60,11,0,WS_EX_STATICEDGE
191
-    CTEXT           "",IDC_SOUND10PNT,555,113,60,11,0,WS_EX_STATICEDGE
192
-    CTEXT           "",IDC_SOUND10TMR,616,100,88,11,0,WS_EX_STATICEDGE
193
-    CTEXT           "",IDC_SOUND10POSLEN,616,113,88,11,0,WS_EX_STATICEDGE
194
-    RTEXT           "#11",IDC_STATIC,355,127,23,10
195
-    CONTROL         "",IDC_SOUND11VOLBAR,"msctls_progress32",PBS_SMOOTH,381,126,68,11
196
-    CTEXT           "",IDC_SOUND11VOL,451,126,30,11,0,WS_EX_STATICEDGE
197
-    CONTROL         "",IDC_SOUND11PANBAR,"msctls_progress32",PBS_SMOOTH,381,139,68,11
198
-    CTEXT           "",IDC_SOUND11PAN,451,139,30,11,0,WS_EX_STATICEDGE
199
-    CTEXT           "",IDC_SOUND11REPEATMODE,482,126,72,11,0,WS_EX_STATICEDGE
200
-    CTEXT           "",IDC_SOUND11FORMAT,482,139,72,11,0,WS_EX_STATICEDGE
201
-    CTEXT           "",IDC_SOUND11STATE,555,126,60,11,0,WS_EX_STATICEDGE
202
-    CTEXT           "",IDC_SOUND11PNT,555,139,60,11,0,WS_EX_STATICEDGE
203
-    CTEXT           "",IDC_SOUND11TMR,616,126,88,11,0,WS_EX_STATICEDGE
204
-    CTEXT           "",IDC_SOUND11POSLEN,616,139,88,11,0,WS_EX_STATICEDGE
205
-    RTEXT           "#12",IDC_STATIC,355,153,23,10
206
-    CONTROL         "",IDC_SOUND12VOLBAR,"msctls_progress32",PBS_SMOOTH,381,152,68,11
207
-    CTEXT           "",IDC_SOUND12VOL,451,152,30,11,0,WS_EX_STATICEDGE
208
-    CONTROL         "",IDC_SOUND12PANBAR,"msctls_progress32",PBS_SMOOTH,381,165,68,11
209
-    CTEXT           "",IDC_SOUND12PAN,451,165,30,11,0,WS_EX_STATICEDGE
210
-    CTEXT           "",IDC_SOUND12REPEATMODE,482,152,72,11,0,WS_EX_STATICEDGE
211
-    CTEXT           "",IDC_SOUND12FORMAT,482,165,72,11,0,WS_EX_STATICEDGE
212
-    CTEXT           "",IDC_SOUND12STATE,555,152,60,11,0,WS_EX_STATICEDGE
213
-    CTEXT           "",IDC_SOUND12PNT,555,165,60,11,0,WS_EX_STATICEDGE
214
-    CTEXT           "",IDC_SOUND12TMR,616,152,88,11,0,WS_EX_STATICEDGE
215
-    CTEXT           "",IDC_SOUND12POSLEN,616,165,88,11,0,WS_EX_STATICEDGE
216
-    RTEXT           "#13",IDC_STATIC,355,179,23,10
217
-    CONTROL         "",IDC_SOUND13VOLBAR,"msctls_progress32",PBS_SMOOTH,381,178,68,11
218
-    CTEXT           "",IDC_SOUND13VOL,451,178,30,11,0,WS_EX_STATICEDGE
219
-    CONTROL         "",IDC_SOUND13PANBAR,"msctls_progress32",PBS_SMOOTH,381,191,68,11
220
-    CTEXT           "",IDC_SOUND13PAN,451,191,30,11,0,WS_EX_STATICEDGE
221
-    CTEXT           "",IDC_SOUND13REPEATMODE,482,178,72,11,0,WS_EX_STATICEDGE
222
-    CTEXT           "",IDC_SOUND13FORMAT,482,191,72,11,0,WS_EX_STATICEDGE
223
-    CTEXT           "",IDC_SOUND13STATE,555,178,60,11,0,WS_EX_STATICEDGE
224
-    CTEXT           "",IDC_SOUND13PNT,555,191,60,11,0,WS_EX_STATICEDGE
225
-    CTEXT           "",IDC_SOUND13TMR,616,178,88,11,0,WS_EX_STATICEDGE
226
-    CTEXT           "",IDC_SOUND13POSLEN,616,191,88,11,0,WS_EX_STATICEDGE
227
-    RTEXT           "#14",IDC_STATIC,355,205,23,10
228
-    CONTROL         "",IDC_SOUND14VOLBAR,"msctls_progress32",PBS_SMOOTH,381,204,68,11
229
-    CTEXT           "",IDC_SOUND14VOL,451,204,30,11,0,WS_EX_STATICEDGE
230
-    CONTROL         "",IDC_SOUND14PANBAR,"msctls_progress32",PBS_SMOOTH,381,217,68,11
231
-    CTEXT           "",IDC_SOUND14PAN,451,217,30,11,0,WS_EX_STATICEDGE
232
-    CTEXT           "",IDC_SOUND14REPEATMODE,482,204,72,11,0,WS_EX_STATICEDGE
233
-    CTEXT           "",IDC_SOUND14FORMAT,482,217,72,11,0,WS_EX_STATICEDGE
234
-    CTEXT           "",IDC_SOUND14STATE,555,204,60,11,0,WS_EX_STATICEDGE
235
-    CTEXT           "",IDC_SOUND14PNT,555,217,60,11,0,WS_EX_STATICEDGE
236
-    CTEXT           "",IDC_SOUND14TMR,616,204,88,11,0,WS_EX_STATICEDGE
237
-    CTEXT           "",IDC_SOUND14POSLEN,616,217,88,11,0,WS_EX_STATICEDGE
238
-    RTEXT           "#15",IDC_STATIC,355,231,23,10
239
-    CONTROL         "",IDC_SOUND15VOLBAR,"msctls_progress32",PBS_SMOOTH,381,230,68,11
240
-    CTEXT           "",IDC_SOUND15VOL,451,230,30,11,0,WS_EX_STATICEDGE
241
-    CONTROL         "",IDC_SOUND15PANBAR,"msctls_progress32",PBS_SMOOTH,381,244,68,11
242
-    CTEXT           "",IDC_SOUND15PAN,451,244,30,11,0,WS_EX_STATICEDGE
243
-    CTEXT           "",IDC_SOUND15REPEATMODE,482,230,72,11,0,WS_EX_STATICEDGE
244
-    CTEXT           "",IDC_SOUND15FORMAT,482,244,72,11,0,WS_EX_STATICEDGE
245
-    CTEXT           "",IDC_SOUND15STATE,555,230,60,11,0,WS_EX_STATICEDGE
246
-    CTEXT           "",IDC_SOUND15PNT,555,244,60,11,0,WS_EX_STATICEDGE
247
-    CTEXT           "",IDC_SOUND15TMR,616,230,88,11,0,WS_EX_STATICEDGE
248
-    CTEXT           "",IDC_SOUND15POSLEN,616,244,88,11,0,WS_EX_STATICEDGE
249
-    CONTROL         "Vol.Mode",IDC_BUTTON_VOLMODE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,13,7,45,10
250
-    CONTROL         "Check1",IDC_SOUND0MUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,62,10,10
251
-    CONTROL         "Check1",IDC_SOUND1MUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,87,10,10
252
-    CONTROL         "Check1",IDC_SOUND2MUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,114,10,10
253
-    CONTROL         "Check1",IDC_SOUND3MUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,140,10,10
254
-    CONTROL         "Check1",IDC_SOUND4MUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,164,10,10
255
-    CONTROL         "Check1",IDC_SOUND5MUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,192,10,10
256
-    CONTROL         "Check1",IDC_SOUND6MUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,217,10,10
257
-    CONTROL         "Check1",IDC_SOUND7MUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,243,10,10
258
-    CONTROL         "Check1",IDC_SOUND8MUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,369,62,10,10
259
-    CONTROL         "Check1",IDC_SOUND9MUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,369,87,10,10
260
-    CONTROL         "Check1",IDC_SOUND10MUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,369,114,10,10
261
-    CONTROL         "Check1",IDC_SOUND11MUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,369,140,10,10
262
-    CONTROL         "Check1",IDC_SOUND12MUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,369,164,10,10
263
-    CONTROL         "Check1",IDC_SOUND13MUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,369,192,10,10
264
-    CONTROL         "Check1",IDC_SOUND14MUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,369,217,10,10
265
-    CONTROL         "Check1",IDC_SOUND15MUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,369,243,10,10
266
-    PUSHBUTTON      "Unmute All",IDC_SOUND_UNMUTE_ALL,302,3,50,14
267
-END
268
-
269
-
270
-/////////////////////////////////////////////////////////////////////////////
271
-//
272
-// DESIGNINFO
273
-//
274
-
275
-#ifdef APSTUDIO_INVOKED
276
-GUIDELINES DESIGNINFO
277
-BEGIN
278
-    IDD_SOUND_VIEW, DIALOG
279
-    BEGIN
280
-        LEFTMARGIN, 4
281
-        RIGHTMARGIN, 718
282
-        BOTTOMMARGIN, 255
283
-    END
284
-END
285
-#endif    // APSTUDIO_INVOKED
286
-
287
-#endif    // English (United States) resources
288
-/////////////////////////////////////////////////////////////////////////////
289
-
290
-
291
-
292
-#ifndef APSTUDIO_INVOKED
293
-/////////////////////////////////////////////////////////////////////////////
294
-//
295
-// Generated from the TEXTINCLUDE 3 resource.
296
-//
297
-
298
-
299
-/////////////////////////////////////////////////////////////////////////////
300
-#endif    // not APSTUDIO_INVOKED
301
-
302 0
deleted file mode 100644
... ...
@@ -1,194 +0,0 @@
1
-//{{NO_DEPENDENCIES}}
2
-// Microsoft Visual C++ generated include file.
3
-// Used by in_ncsf.rc
4
-//
5
-#define IDD_SOUND_VIEW                  1000
6
-#define IDC_BUTTON_VOLMODE              1001
7
-#define IDC_SOUND_UNMUTE_ALL            1002
8
-#define IDC_SOUND0VOL                   1350
9
-#define IDC_SOUND1VOL                   1351
10
-#define IDC_SOUND2VOL                   1352
11
-#define IDC_SOUND3VOL                   1353
12
-#define IDC_SOUND4VOL                   1354
13
-#define IDC_SOUND5VOL                   1355
14
-#define IDC_SOUND6VOL                   1356
15
-#define IDC_SOUND7VOL                   1357
16
-#define IDC_SOUND8VOL                   1358
17
-#define IDC_SOUND9VOL                   1359
18
-#define IDC_SOUND10VOL                  1360
19
-#define IDC_SOUND11VOL                  1361
20
-#define IDC_SOUND12VOL                  1362
21
-#define IDC_SOUND13VOL                  1363
22
-#define IDC_SOUND14VOL                  1364
23
-#define IDC_SOUND15VOL                  1365
24
-#define IDC_SOUND0VOLBAR                1370
25
-#define IDC_SOUND1VOLBAR                1371
26
-#define IDC_SOUND2VOLBAR                1372
27
-#define IDC_SOUND3VOLBAR                1373
28
-#define IDC_SOUND4VOLBAR                1374
29
-#define IDC_SOUND5VOLBAR                1375
30
-#define IDC_SOUND6VOLBAR                1376
31
-#define IDC_SOUND7VOLBAR                1377
32
-#define IDC_SOUND8VOLBAR                1378
33
-#define IDC_SOUND9VOLBAR                1379
34
-#define IDC_SOUND10VOLBAR               1380
35
-#define IDC_SOUND11VOLBAR               1381
36
-#define IDC_SOUND12VOLBAR               1382
37
-#define IDC_SOUND13VOLBAR               1383
38
-#define IDC_SOUND14VOLBAR               1384
39
-#define IDC_SOUND15VOLBAR               1385
40
-#define IDC_SOUND0PAN                   1390
41
-#define IDC_SOUND1PAN                   1391
42
-#define IDC_SOUND2PAN                   1392
43
-#define IDC_SOUND3PAN                   1393
44
-#define IDC_SOUND4PAN                   1394
45
-#define IDC_SOUND5PAN                   1395
46
-#define IDC_SOUND6PAN                   1396
47
-#define IDC_SOUND7PAN                   1397
48
-#define IDC_SOUND8PAN                   1398
49
-#define IDC_SOUND9PAN                   1399
50
-#define IDC_SOUND10PAN                  1400
51
-#define IDC_SOUND11PAN                  1401
52
-#define IDC_SOUND12PAN                  1402
53
-#define IDC_SOUND13PAN                  1403
54
-#define IDC_SOUND14PAN                  1404
55
-#define IDC_SOUND15PAN                  1405
56
-#define IDC_SOUND0PANBAR                1410
57
-#define IDC_SOUND1PANBAR                1411
58
-#define IDC_SOUND2PANBAR                1412
59
-#define IDC_SOUND3PANBAR                1413
60
-#define IDC_SOUND4PANBAR                1414
61
-#define IDC_SOUND5PANBAR                1415
62
-#define IDC_SOUND6PANBAR                1416
63
-#define IDC_SOUND7PANBAR                1417
64
-#define IDC_SOUND8PANBAR                1418
65
-#define IDC_SOUND9PANBAR                1419
66
-#define IDC_SOUND10PANBAR               1420
67
-#define IDC_SOUND11PANBAR               1421
68
-#define IDC_SOUND12PANBAR               1422
69
-#define IDC_SOUND13PANBAR               1423
70
-#define IDC_SOUND14PANBAR               1424
71
-#define IDC_SOUND15PANBAR               1425
72
-#define IDC_SOUND0REPEATMODE            1470
73
-#define IDC_SOUND1REPEATMODE            1471
74
-#define IDC_SOUND2REPEATMODE            1472
75
-#define IDC_SOUND3REPEATMODE            1473
76
-#define IDC_SOUND4REPEATMODE            1474
77
-#define IDC_SOUND5REPEATMODE            1475
78
-#define IDC_SOUND6REPEATMODE            1476
79
-#define IDC_SOUND7REPEATMODE            1477
80
-#define IDC_SOUND8REPEATMODE            1478
81
-#define IDC_SOUND9REPEATMODE            1479
82
-#define IDC_SOUND10REPEATMODE           1480
83
-#define IDC_SOUND11REPEATMODE           1481
84
-#define IDC_SOUND12REPEATMODE           1482
85
-#define IDC_SOUND13REPEATMODE           1483
86
-#define IDC_SOUND14REPEATMODE           1484
87
-#define IDC_SOUND15REPEATMODE           1485
88
-#define IDC_SOUND0FORMAT                1490
89
-#define IDC_SOUND1FORMAT                1491
90
-#define IDC_SOUND2FORMAT                1492
91
-#define IDC_SOUND3FORMAT                1493
92
-#define IDC_SOUND4FORMAT                1494
93
-#define IDC_SOUND5FORMAT                1495
94
-#define IDC_SOUND6FORMAT                1496
95
-#define IDC_SOUND7FORMAT                1497
96
-#define IDC_SOUND8FORMAT                1498
97
-#define IDC_SOUND9FORMAT                1499
98
-#define IDC_SOUND10FORMAT               1500
99
-#define IDC_SOUND11FORMAT               1501
100
-#define IDC_SOUND12FORMAT               1502
101
-#define IDC_SOUND13FORMAT               1503
102
-#define IDC_SOUND14FORMAT               1504
103
-#define IDC_SOUND15FORMAT               1505
104
-#define IDC_SOUND0STATE                 1510
105
-#define IDC_SOUND1STATE                 1511
106
-#define IDC_SOUND2STATE                 1512
107
-#define IDC_SOUND3STATE                 1513
108
-#define IDC_SOUND4STATE                 1514
109
-#define IDC_SOUND5STATE                 1515
110
-#define IDC_SOUND6STATE                 1516
111
-#define IDC_SOUND7STATE                 1517
112
-#define IDC_SOUND8STATE                 1518
113
-#define IDC_SOUND9STATE                 1519
114
-#define IDC_SOUND10STATE                1520
115
-#define IDC_SOUND11STATE                1521
116
-#define IDC_SOUND12STATE                1522
117
-#define IDC_SOUND13STATE                1523
118
-#define IDC_SOUND14STATE                1524
119
-#define IDC_SOUND15STATE                1525
120
-#define IDC_SOUND0PNT                   1530
121
-#define IDC_SOUND1PNT                   1531
122
-#define IDC_SOUND2PNT                   1532
123
-#define IDC_SOUND3PNT                   1533
124
-#define IDC_SOUND4PNT                   1534
125
-#define IDC_SOUND5PNT                   1535
126
-#define IDC_SOUND6PNT                   1536
127
-#define IDC_SOUND7PNT                   1537
128
-#define IDC_SOUND8PNT                   1538
129
-#define IDC_SOUND9PNT                   1539
130
-#define IDC_SOUND10PNT                  1540
131
-#define IDC_SOUND11PNT                  1541
132
-#define IDC_SOUND12PNT                  1542
133
-#define IDC_SOUND13PNT                  1543
134
-#define IDC_SOUND14PNT                  1544
135
-#define IDC_SOUND15PNT                  1545
136
-#define IDC_SOUND0TMR                   1550
137
-#define IDC_SOUND1TMR                   1551
138
-#define IDC_SOUND2TMR                   1552
139
-#define IDC_SOUND3TMR                   1553
140
-#define IDC_SOUND4TMR                   1554
141
-#define IDC_SOUND5TMR                   1555
142
-#define IDC_SOUND6TMR                   1556
143
-#define IDC_SOUND7TMR                   1557
144
-#define IDC_SOUND8TMR                   1558
145
-#define IDC_SOUND9TMR                   1559
146
-#define IDC_SOUND10TMR                  1560
147
-#define IDC_SOUND11TMR                  1561
148
-#define IDC_SOUND12TMR                  1562
149
-#define IDC_SOUND13TMR                  1563
150
-#define IDC_SOUND14TMR                  1564
151
-#define IDC_SOUND15TMR                  1565
152
-#define IDC_SOUND0POSLEN                1570
153
-#define IDC_SOUND1POSLEN                1571
154
-#define IDC_SOUND2POSLEN                1572
155
-#define IDC_SOUND3POSLEN                1573
156
-#define IDC_SOUND4POSLEN                1574
157
-#define IDC_SOUND5POSLEN                1575
158
-#define IDC_SOUND6POSLEN                1576
159
-#define IDC_SOUND7POSLEN                1577
160
-#define IDC_SOUND8POSLEN                1578
161
-#define IDC_SOUND9POSLEN                1579
162
-#define IDC_SOUND10POSLEN               1580
163
-#define IDC_SOUND11POSLEN               1581
164
-#define IDC_SOUND12POSLEN               1582
165
-#define IDC_SOUND13POSLEN               1583
166
-#define IDC_SOUND14POSLEN               1584
167
-#define IDC_SOUND15POSLEN               1585
168
-#define IDC_SOUND0MUTE                  2000
169
-#define IDC_SOUND1MUTE                  2001
170
-#define IDC_SOUND2MUTE                  2002
171
-#define IDC_SOUND3MUTE                  2003
172
-#define IDC_SOUND4MUTE                  2004
173
-#define IDC_SOUND5MUTE                  2005
174
-#define IDC_SOUND6MUTE                  2006
175
-#define IDC_SOUND7MUTE                  2007
176
-#define IDC_SOUND8MUTE                  2008
177
-#define IDC_SOUND9MUTE                  2009
178
-#define IDC_SOUND10MUTE                 2010
179
-#define IDC_SOUND11MUTE                 2011
180
-#define IDC_SOUND12MUTE                 2012
181
-#define IDC_SOUND13MUTE                 2013
182
-#define IDC_SOUND14MUTE                 2014
183
-#define IDC_SOUND15MUTE                 2015
184
-
185
-// Next default values for new objects
186
-//
187
-#ifdef APSTUDIO_INVOKED
188
-#ifndef APSTUDIO_READONLY_SYMBOLS
189
-#define _APS_NEXT_RESOURCE_VALUE        102
190
-#define _APS_NEXT_COMMAND_VALUE         40001
191
-#define _APS_NEXT_CONTROL_VALUE         1001
192
-#define _APS_NEXT_SYMED_VALUE           101
193
-#endif
194
-#endif
... ...
@@ -15,6 +15,7 @@
15 15
 #include <cstddef>
16 16
 #include <cstdint>
17 17
 #include "windowsh_wrapper.h"
18
+#include "XSFApp.h"
18 19
 #include "XSFConfig.h"
19 20
 #include "XSFConfig_SNSF.h"
20 21
 #include "XSFConfigDialog_SNSF.h"
... ...
@@ -25,18 +26,15 @@ class wxWindow;
25 26
 class XSFConfigDialog;
26 27
 class XSFPlayer;
27 28
 
28
-enum
29
-{
30
-	idSixteenBitSound = 1000,
31
-	idReverseStereo,
32
-	idResampler,
33
-	idMutes
34
-};
35
-
36 29
 const unsigned XSFConfig::initSampleRate = 44100;
37 30
 const std::string XSFConfig::commonName = "SNSF Decoder";
38 31
 const std::string XSFConfig::versionNumber = "0.9b";
39 32
 
33
+XSFApp *XSFApp::Create()
34
+{
35
+	return new XSFApp();
36
+}
37
+
40 38
 XSFConfig *XSFConfig::Create()
41 39
 {
42 40
 	return new XSFConfig_SNSF();
... ...
@@ -73,7 +73,6 @@ set(wxUSE_FS_INET OFF CACHE BOOL " " FORCE)
73 73
 set(wxUSE_FS_ZIP OFF CACHE BOOL " " FORCE)
74 74
 set(wxUSE_FSVOLUME OFF CACHE BOOL " " FORCE)
75 75
 set(wxUSE_FSWATCHER OFF CACHE BOOL " " FORCE)
76
-set(wxUSE_GAUGE OFF CACHE BOOL " " FORCE)
77 76
 set(wxUSE_GEOMETRY OFF CACHE BOOL " " FORCE)
78 77
 set(wxUSE_GIF OFF CACHE BOOL " " FORCE)
79 78
 set(wxUSE_GRAPHICS_CONTEXT OFF CACHE BOOL " " FORCE)
... ...
@@ -174,7 +173,6 @@ set(wxUSE_THREADS OFF CACHE BOOL " " FORCE)
174 173
 set(wxUSE_TIMEPICKCTRL OFF CACHE BOOL " " FORCE)
175 174
 set(wxUSE_TIMER OFF CACHE BOOL " " FORCE)
176 175
 set(wxUSE_TIPWINDOW OFF CACHE BOOL " " FORCE)
177
-set(wxUSE_TOGGLEBTN OFF CACHE BOOL " " FORCE)
178 176
 set(wxUSE_TOOLBAR OFF CACHE BOOL " " FORCE)
179 177
 set(wxUSE_TOOLBAR_NATIVE OFF CACHE BOOL " " FORCE)
180 178
 set(wxUSE_TOOLBOOK OFF CACHE BOOL " " FORCE)
... ...
@@ -215,6 +213,7 @@ set(HEADERS
215 213
 	RegExValidator.h
216 214
 	TagList.h
217 215
 	windowsh_wrapper.h
216
+	XSFApp.h
218 217
 	XSFCommon.h
219 218
 	XSFConfig.h
220 219
 	XSFConfigDialog.h
... ...
@@ -225,6 +224,7 @@ set(SOURCES
225 224
 	in_xsf.cpp
226 225
 	RegExValidator.cpp
227 226
 	TagList.cpp
227
+	XSFApp.cpp
228 228
 	XSFConfig.cpp
229 229
 	XSFConfig_Winamp.cpp
230 230
 	XSFConfigDialog.cpp
231 231
new file mode 100644
... ...
@@ -0,0 +1,41 @@
1
+/*
2
+ * xSF - Core wxWidgets App
3
+ * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
+ *
5
+ * Partially based on the vio*sf framework
6
+ */
7
+
8
+#ifdef __GNUC__
9
+# pragma GCC diagnostic push
10
+# pragma GCC diagnostic ignored "-Wold-style-cast"
11
+#elif defined(__clang__)
12
+# pragma clang diagnostic push
13
+# pragma clang diagnostic ignored "-Wold-style-cast"
14
+#endif
15
+#include <wx/nativewin.h>
16
+#ifdef __GNUC__
17
+# pragma GCC diagnostic pop
18
+#elif defined(__clang__)
19
+# pragma clang diagnostic pop
20
+#endif
21
+#include "windowsh_wrapper.h"
22
+#include "XSFApp.h"
23
+#include "XSFConfig.h"
24
+#include "XSFConfigDialog.h"
25
+
26
+void XSFApp::ConfigDialog(HWND parent, XSFConfig *config)
27
+{
28
+	// NOTE: This is only good enough to make it so the dialog box isn't shown on the taskbar, it is not good enough to make the dialog modal to Winamp's preferences screen... it'll actually crash if someone changes to another section of preferences...
29
+
30
+	auto window = wxNativeContainerWindow(parent);
31
+	auto dialog = config->CreateDialogBox(&window, XSFConfig::commonName + " v" + XSFConfig::versionNumber);
32
+	dialog->Finalize();
33
+	config->InitializeConfigDialog(dialog);
34
+	if (dialog->ShowModal() == wxID_OK)
35
+	{
36
+		config->SaveConfigDialog(dialog);
37
+		config->SaveConfig();
38
+	}
39
+	dialog->Destroy();
40
+	window.Destroy();
41
+}
0 42
new file mode 100644
... ...
@@ -0,0 +1,34 @@
1
+/*
2
+ * xSF - Core wxWidgets App
3
+ * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
+ *
5
+ * Partially based on the vio*sf framework
6
+ */
7
+
8
+#pragma once
9
+
10
+#ifdef __GNUC__
11
+# pragma GCC diagnostic push
12
+# pragma GCC diagnostic ignored "-Wold-style-cast"
13
+#elif defined(__clang__)
14
+# pragma clang diagnostic push
15
+# pragma clang diagnostic ignored "-Wold-style-cast"
16
+#endif
17
+#include <wx/app.h>
18
+#ifdef __GNUC__
19
+# pragma GCC diagnostic pop
20
+#elif defined(__clang__)
21
+# pragma clang diagnostic pop
22
+#endif
23
+#include "windowsh_wrapper.h"
24
+
25
+class XSFConfig;
26
+
27
+class XSFApp : public wxApp
28
+{
29
+public:
30
+	// Even though most of the plugins are just going to create an instance of XSFApp, I am using this to allow the NCSF plugin to make a derived instance instead.
31
+	static XSFApp *Create();
32
+
33
+	void ConfigDialog(HWND parent, XSFConfig *config);
34
+};
... ...
@@ -9,22 +9,9 @@
9 9
 #include <string>
10 10
 #include <type_traits>
11 11
 #include <vector>
12
-#ifdef __GNUC__
13
-# pragma GCC diagnostic push
14
-# pragma GCC diagnostic ignored "-Wold-style-cast"
15
-#elif defined(__clang__)
16
-# pragma clang diagnostic push
17
-# pragma clang diagnostic ignored "-Wold-style-cast"
18
-#endif
19
-#include <wx/app.h>
20
-#include <wx/nativewin.h>
21
-#ifdef __GNUC__
22
-# pragma GCC diagnostic pop
23
-#elif defined(__clang__)
24
-# pragma clang diagnostic pop
25
-#endif
26 12
 #include "windowsh_wrapper.h"
27 13
 #include <windowsx.h>
14
+#include "XSFApp.h"
28 15
 #include "XSFConfig.h"
29 16
 #include "XSFConfigDialog.h"
30 17
 #include "XSFFile.h"
... ...
@@ -104,52 +91,6 @@ void XSFConfig::SaveConfig()
104 91
 	this->SaveSpecificConfig();
105 92
 }
106 93
 
107
-class XSFConfigApp : public wxApp
108
-{
109
-	HWND parent;
110
-	XSFConfig *config;
111
-public:
112
-	XSFConfigApp() : parent(nullptr), config(nullptr)
113
-	{
114
-	}
115
-
116
-	XSFConfigApp(HWND newParent, XSFConfig *newConfig) : parent(newParent), config(newConfig)
117
-	{
118
-	}
119
-
120
-	bool OnInit() override
121
-	{
122
-		// NOTE: This is only good enough to make it so the dialog box isn't shown on the taskbar, it is not good enough to make the dialog modal to Winamp's preferences screen... it'll actually crash if someone changes to another section of preferences...
123
-
124
-		auto window = new wxNativeContainerWindow(this->parent);
125
-		auto dialog = this->config->CreateDialogBox(window, XSFConfig::commonName + " v" + XSFConfig::versionNumber);
126
-		dialog->Finalize();
127
-		this->config->InitializeConfigDialog(dialog);
128
-		if (dialog->ShowModal() == wxID_OK)
129
-		{
130
-			this->config->SaveConfigDialog(dialog);
131
-			this->config->SaveConfig();
132
-		}
133
-		dialog->Destroy();
134
-		window->Destroy();
135
-		return true;
136
-	}
137
-};
138
-
139
-#ifdef __GNUC__
140
-# pragma GCC diagnostic push
141
-# pragma GCC diagnostic ignored "-Wold-style-cast"
142
-#elif defined(__clang__)
143
-# pragma clang diagnostic push
144
-# pragma clang diagnostic ignored "-Wold-style-cast"
145
-#endif
146
-wxIMPLEMENT_APP_NO_MAIN(XSFConfigApp);
147
-#ifdef __GNUC__
148
-# pragma GCC diagnostic pop
149
-#elif defined(__clang__)
150
-# pragma clang diagnostic pop
151
-#endif
152
-
153 94
 void XSFConfig::GenerateDialogs()
154 95
 {
155 96
 	// NOTE: Eventually this will be done away with when I decide to make an actual info dialog box using wxWidgets.
... ...
@@ -248,13 +189,11 @@ INT_PTR CALLBACK XSFConfig::InfoDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wPara
248 189
 	return true;
249 190
 }
250 191
 
251
-void XSFConfig::CallConfigDialog(HINSTANCE hInstance, HWND hwndParent)
192
+extern std::unique_ptr<XSFApp> xSFApp;
193
+
194
+void XSFConfig::CallConfigDialog(HWND hwndParent)
252 195
 {
253
-	auto app = new XSFConfigApp(hwndParent, this);
254
-	wxApp::SetInstance(app);
255
-	wxEntryStart(hInstance);
256
-	app->OnInit();
257
-	wxEntryCleanup();
196
+	xSFApp->ConfigDialog(hwndParent, this);
258 197
 }
259 198
 
260 199
 void XSFConfig::CallInfoDialog(HINSTANCE hInstance, HWND hwndParent)
... ...
@@ -101,7 +101,7 @@ public:
101 101
 	void SaveConfig();
102 102
 	void GenerateDialogs();
103 103
 	static INT_PTR CALLBACK InfoDialogProcStatic(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
104
-	void CallConfigDialog(HINSTANCE hInstance, HWND hwndParent);
104
+	void CallConfigDialog(HWND hwndParent);
105 105
 	void CallInfoDialog(HINSTANCE hInstance, HWND hwndParent);
106 106
 	void InitializeConfigDialog(XSFConfigDialog *dialog);
107 107
 	void ResetConfigDefaults(XSFConfigDialog *dialog);
... ...
@@ -15,7 +15,21 @@
15 15
 #include <vector>
16 16
 #include <cstddef>
17 17
 #include <cstdint>
18
+#ifdef __GNUC__
19
+# pragma GCC diagnostic push
20
+# pragma GCC diagnostic ignored "-Wold-style-cast"
21
+#elif defined(__clang__)
22
+# pragma clang diagnostic push
23
+# pragma clang diagnostic ignored "-Wold-style-cast"
24
+#endif
25
+#include <wx/app.h>
26
+#ifdef __GNUC__
27
+# pragma GCC diagnostic pop
28
+#elif defined(__clang__)
29
+# pragma clang diagnostic pop
30
+#endif
18 31
 #include "windowsh_wrapper.h"
32
+#include "XSFApp.h"
19 33
 #include "XSFCommon.h"
20 34
 #include "XSFConfig.h"
21 35
 #include "XSFFile.h"
... ...
@@ -28,6 +42,7 @@ extern In_Module inMod;
28 42
 static const XSFFile *xSFFile = nullptr;
29 43
 XSFFile *xSFFileInInfo = nullptr;
30 44
 static std::unique_ptr<XSFPlayer> xSFPlayer;
45
+std::unique_ptr<XSFApp> xSFApp;
31 46
 std::unique_ptr<XSFConfig> xSFConfig;
32 47
 static bool paused;
33 48
 static std::atomic_int seek_needed;
... ...
@@ -83,7 +98,7 @@ void playThread()
83 98
 
84 99
 void config(HWND hwndParent)
85 100
 {
86
-	xSFConfig->CallConfigDialog(inMod.hDllInstance, hwndParent);
101
+	xSFConfig->CallConfigDialog(hwndParent);
87 102
 	if (xSFPlayer)
88 103
 		xSFConfig->CopyConfigToMemory(xSFPlayer.get(), false);
89 104
 }
... ...
@@ -95,6 +110,9 @@ void about(HWND hwndParent)
95 110
 
96 111
 void init()
97 112
 {
113
+	wxEntryStart(inMod.hDllInstance);
114
+	xSFApp.reset(XSFApp::Create());
115
+	wxApp::SetInstance(xSFApp.get());
98 116
 	xSFConfig.reset(XSFConfig::Create());
99 117
 	xSFConfig->LoadConfig();
100 118
 	xSFConfig->GenerateDialogs();
... ...
@@ -105,6 +123,8 @@ void quit()
105 123
 {
106 124
 	xSFPlayer.reset();
107 125
 	xSFConfig.reset();
126
+	xSFApp.reset();
127
+	wxEntryCleanup();
108 128
 }
109 129
 
110 130
 void getFileInfo(const in_char *file, in_char *title, int *length_in_ms)