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 1 changed files
... ...
@@ -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
 };
Browse code

Make the NCSF Sound View dialog always available.

(Before it was only available under Debug builds.)

Naram Qashat authored on 2021/04/06 22:29:00
Showing 1 changed files
... ...
@@ -7,26 +7,21 @@
7 7
 
8 8
 #pragma once
9 9
 
10
+#include <algorithm>
10 11
 #include <bitset>
12
+#include <memory>
11 13
 #include <string>
12
-#ifndef NDEBUG
13
-# include <algorithm>
14
-# include <memory>
15
-# include <cstdint>
16
-# include "SSEQPlayer/consts.h"
17
-#endif
14
+#include <cstdint>
18 15
 #include "windowsh_wrapper.h"
16
+#include "SSEQPlayer/consts.h"
19 17
 #include "XSFConfig.h"
20 18
 
21 19
 class wxWindow;
22 20
 class XSFConfig_NCSF;
23 21
 class XSFConfigDialog;
24 22
 class XSFPlayer;
25
-#ifndef DEBUG
26 23
 class XSFPlayer_NCSF;
27
-#endif
28 24
 
29
-#ifndef NDEBUG
30 25
 struct SoundViewData
31 26
 {
32 27
 	XSFConfig_NCSF *config;
... ...
@@ -41,14 +36,17 @@ struct SoundViewData
41 36
 		std::fill_n(&this->channelLastStates[0], sizeof(this->channelLastStates), ChannelState::Start);
42 37
 	}
43 38
 };
44
-#endif
45 39
 
46 40
 class XSFConfig_NCSF : public XSFConfig
47 41
 {
48 42
 protected:
49
-#ifndef NDEBUG
50
-	static constexpr bool initUseSoundViewDialog = true;
43
+	static constexpr bool initUseSoundViewDialog =
44
+#ifdef NDEBUG
45
+		false
46
+#else
47
+		true
51 48
 #endif
49
+	;
52 50
 	static constexpr unsigned initInterpolation = 4;
53 51
 	inline static const std::string initMutes = "0000000000000000";
54 52
 
... ...
@@ -65,19 +63,15 @@ protected:
65 63
 	void SaveSpecificConfigDialog(XSFConfigDialog *dialog) override;
66 64
 	void CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad) override;
67 65
 
68
-#ifndef NDEBUG
69 66
 	bool useSoundViewDialog;
70 67
 	std::unique_ptr<SoundViewData> soundViewData;
71 68
 
72 69
 	static INT_PTR CALLBACK SoundViewDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
73
-#endif
74 70
 public:
75 71
 	void About(HWND parent) override;
76 72
 	XSFConfigDialog *CreateDialogBox(wxWindow *window, const std::string &title) override;
77 73
 
78
-#ifndef NDEBUG
79 74
 	void CallSoundView(XSFPlayer *xSFPlayer, HINSTANCE hInstance, HWND hwndParent);
80 75
 	void RefreshSoundView();
81 76
 	void CloseSoundView();
82
-#endif
83 77
 };
Browse code

Add warnings to building with GCC/Clang.

* These were mostly copied from the old Makefile.
* The files including wxWidgets need -Wno-old-style-cast done in the code via pragmas because I do not want to disable that warning for the rest of the files. (It might've been overkill for some places where wxWidgets was included, but whatever.)

Naram Qashat authored on 2021/04/04 23:35:09
Showing 1 changed files
... ...
@@ -54,9 +54,6 @@ protected:
54 54
 
55 55
 	friend class XSFConfig;
56 56
 	friend struct SoundViewData;
57
-#ifndef NDEBUG
58
-	bool useSoundViewDialog;
59
-#endif
60 57
 	unsigned interpolation;
61 58
 	std::bitset<16> mutes;
62 59
 
... ...
@@ -69,6 +66,7 @@ protected:
69 66
 	void CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad) override;
70 67
 
71 68
 #ifndef NDEBUG
69
+	bool useSoundViewDialog;
72 70
 	std::unique_ptr<SoundViewData> soundViewData;
73 71
 
74 72
 	static INT_PTR CALLBACK SoundViewDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
Browse code

Add wxWidgets-based configuration dialog boxes.

* Removes the configuration dialog boxes that used my DialogBuilder.
* Move default configuration values to be inlined within the headers.
* Moved 2SF's and GSF's XSFConfig classes to their own headers to accommodate the new wxWidgets dialog boxes.
* Make it so NCSF's SoundView dialog can be toggled on or off from the configuration dialog box.

Naram Qashat authored on 2021/04/04 12:46:14
Showing 1 changed files
... ...
@@ -18,8 +18,13 @@
18 18
 #include "windowsh_wrapper.h"
19 19
 #include "XSFConfig.h"
20 20
 
21
+class wxWindow;
21 22
 class XSFConfig_NCSF;
23
+class XSFConfigDialog;
24
+class XSFPlayer;
25
+#ifndef DEBUG
22 26
 class XSFPlayer_NCSF;
27
+#endif
23 28
 
24 29
 #ifndef NDEBUG
25 30
 struct SoundViewData
... ...
@@ -41,21 +46,26 @@ struct SoundViewData
41 46
 class XSFConfig_NCSF : public XSFConfig
42 47
 {
43 48
 protected:
44
-	static unsigned initInterpolation;
45
-	static std::string initMutes;
49
+#ifndef NDEBUG
50
+	static constexpr bool initUseSoundViewDialog = true;
51
+#endif
52
+	static constexpr unsigned initInterpolation = 4;
53
+	inline static const std::string initMutes = "0000000000000000";
46 54
 
47 55
 	friend class XSFConfig;
48 56
 	friend struct SoundViewData;
57
+#ifndef NDEBUG
58
+	bool useSoundViewDialog;
59
+#endif
49 60
 	unsigned interpolation;
50 61
 	std::bitset<16> mutes;
51 62
 
52 63
 	XSFConfig_NCSF();
53 64
 	void LoadSpecificConfig() override;
54 65
 	void SaveSpecificConfig() override;
55
-	void GenerateSpecificDialogs() override;
56
-	INT_PTR CALLBACK ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) override;
57
-	void ResetSpecificConfigDefaults(HWND hwndDlg) override;
58
-	void SaveSpecificConfigDialog(HWND hwndDlg) override;
66
+	void InitializeSpecificConfigDialog(XSFConfigDialog *dialog) override;
67
+	void ResetSpecificConfigDefaults(XSFConfigDialog *dialog) override;
68
+	void SaveSpecificConfigDialog(XSFConfigDialog *dialog) override;
59 69
 	void CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad) override;
60 70
 
61 71
 #ifndef NDEBUG
... ...
@@ -65,6 +75,7 @@ protected:
65 75
 #endif
66 76
 public:
67 77
 	void About(HWND parent) override;
78
+	XSFConfigDialog *CreateDialogBox(wxWindow *window, const std::string &title) override;
68 79
 
69 80
 #ifndef NDEBUG
70 81
 	void CallSoundView(XSFPlayer *xSFPlayer, HINSTANCE hInstance, HWND hwndParent);
Browse code

Replace #ifdef _DEBUG with #ifndef NDEBUG

Naram Qashat authored on 2021/04/03 11:24:08
Showing 1 changed files
... ...
@@ -9,7 +9,7 @@
9 9
 
10 10
 #include <bitset>
11 11
 #include <string>
12
-#ifdef _DEBUG
12
+#ifndef NDEBUG
13 13
 # include <algorithm>
14 14
 # include <memory>
15 15
 # include <cstdint>
... ...
@@ -21,7 +21,7 @@
21 21
 class XSFConfig_NCSF;
22 22
 class XSFPlayer_NCSF;
23 23
 
24
-#ifdef _DEBUG
24
+#ifndef NDEBUG
25 25
 struct SoundViewData
26 26
 {
27 27
 	XSFConfig_NCSF *config;
... ...
@@ -58,7 +58,7 @@ protected:
58 58
 	void SaveSpecificConfigDialog(HWND hwndDlg) override;
59 59
 	void CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad) override;
60 60
 
61
-#ifdef _DEBUG
61
+#ifndef NDEBUG
62 62
 	std::unique_ptr<SoundViewData> soundViewData;
63 63
 
64 64
 	static INT_PTR CALLBACK SoundViewDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
... ...
@@ -66,7 +66,7 @@ protected:
66 66
 public:
67 67
 	void About(HWND parent) override;
68 68
 
69
-#ifdef _DEBUG
69
+#ifndef NDEBUG
70 70
 	void CallSoundView(XSFPlayer *xSFPlayer, HINSTANCE hInstance, HWND hwndParent);
71 71
 	void RefreshSoundView();
72 72
 	void CloseSoundView();
Browse code

Add override keyword.

Naram Qashat authored on 2021/03/30 01:29:32
Showing 1 changed files
... ...
@@ -50,13 +50,13 @@ protected:
50 50
 	std::bitset<16> mutes;
51 51
 
52 52
 	XSFConfig_NCSF();
53
-	void LoadSpecificConfig();
54
-	void SaveSpecificConfig();
55
-	void GenerateSpecificDialogs();
56
-	INT_PTR CALLBACK ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
57
-	void ResetSpecificConfigDefaults(HWND hwndDlg);
58
-	void SaveSpecificConfigDialog(HWND hwndDlg);
59
-	void CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad);
53
+	void LoadSpecificConfig() override;
54
+	void SaveSpecificConfig() override;
55
+	void GenerateSpecificDialogs() override;
56
+	INT_PTR CALLBACK ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) override;
57
+	void ResetSpecificConfigDefaults(HWND hwndDlg) override;
58
+	void SaveSpecificConfigDialog(HWND hwndDlg) override;
59
+	void CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad) override;
60 60
 
61 61
 #ifdef _DEBUG
62 62
 	std::unique_ptr<SoundViewData> soundViewData;
... ...
@@ -64,7 +64,7 @@ protected:
64 64
 	static INT_PTR CALLBACK SoundViewDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
65 65
 #endif
66 66
 public:
67
-	void About(HWND parent);
67
+	void About(HWND parent) override;
68 68
 
69 69
 #ifdef _DEBUG
70 70
 	void CallSoundView(XSFPlayer *xSFPlayer, HINSTANCE hInstance, HWND hwndParent);
Browse code

Various changes:

* Use enum class instead of enum (except for the enums for the resource IDs, not really necessary there).
* For NCSF specifically, included a function to convert an enum class to its underlying integral type (as this is needed for use with the std::bitset class).
* Cleanup headers so all the ones needed in a file are explicitly included even if they may possibly be included in another header.
* Used forward declarations in a few spots.
* Explicitly namespaced all (u)int*_t uses (this might seem like overkill, but it helps me see when the standard types are being used with a simple search for std::).
* Made sure it all builds with MinGW-w64 as well (both gcc and clang).
* Removed some std::move from DialogBuilder.cpp based on clang's warnings for that.
* Replaced use of std::copy_n on strings in DialogBuilder.cpp with my CopyToString functions that use wcscpy.
* Replaced CHAR_MIN/CHAR_MAX in eqstr.h and ltstr.h with std::numeric_limits<char>::min/max().

Naram Qashat authored on 2021/03/21 03:16:45
Showing 1 changed files
... ...
@@ -8,26 +8,32 @@
8 8
 #pragma once
9 9
 
10 10
 #include <bitset>
11
-#include <memory>
12
-#include "XSFConfig.h"
13
-#include "XSFPlayer_NCSF.h"
11
+#include <string>
12
+#ifdef _DEBUG
13
+# include <algorithm>
14
+# include <memory>
15
+# include <cstdint>
16
+# include "SSEQPlayer/consts.h"
17
+#endif
14 18
 #include "windowsh_wrapper.h"
19
+#include "XSFConfig.h"
15 20
 
16 21
 class XSFConfig_NCSF;
22
+class XSFPlayer_NCSF;
17 23
 
18 24
 #ifdef _DEBUG
19 25
 struct SoundViewData
20 26
 {
21 27
 	XSFConfig_NCSF *config;
22 28
 	XSFPlayer_NCSF *player;
23
-	uint8_t channelLastStates[16];
29
+	ChannelState channelLastStates[16];
24 30
 	HWND hDlg;
25 31
 
26 32
 	bool volModeAlternative;
27 33
 
28 34
 	SoundViewData() : config(nullptr), player(nullptr), hDlg(nullptr), volModeAlternative(false)
29 35
 	{
30
-		std::fill_n(&this->channelLastStates[0], sizeof(this->channelLastStates), CS_START);
36
+		std::fill_n(&this->channelLastStates[0], sizeof(this->channelLastStates), ChannelState::Start);
31 37
 	}
32 38
 };
33 39
 #endif
Browse code

Remove last modification date from files.

(I never remember to update these and besides, GitHub history can show when they were last modified.)

Naram Qashat authored on 2021/03/19 10:58:12
Showing 1 changed files
... ...
@@ -1,7 +1,6 @@
1 1
 /*
2 2
  * xSF - NCSF configuration
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2014-10-05
5 4
  *
6 5
  * Partially based on the vio*sf framework
7 6
  */
Browse code

[NCSF] Fix volume issues with a little help from the Nintendo DS SDK.

Also added a clone of DeSmuME's Sound View that is only build during a
debug build, which helped to identify the above issues.

Naram Qashat authored on 2014/10/05 20:00:09
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,69 @@
1
+/*
2
+ * xSF - NCSF configuration
3
+ * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
+ * Last modification on 2014-10-05
5
+ *
6
+ * Partially based on the vio*sf framework
7
+ */
8
+
9
+#pragma once
10
+
11
+#include <bitset>
12
+#include <memory>
13
+#include "XSFConfig.h"
14
+#include "XSFPlayer_NCSF.h"
15
+#include "windowsh_wrapper.h"
16
+
17
+class XSFConfig_NCSF;
18
+
19
+#ifdef _DEBUG
20
+struct SoundViewData
21
+{
22
+	XSFConfig_NCSF *config;
23
+	XSFPlayer_NCSF *player;
24
+	uint8_t channelLastStates[16];
25
+	HWND hDlg;
26
+
27
+	bool volModeAlternative;
28
+
29
+	SoundViewData() : config(nullptr), player(nullptr), hDlg(nullptr), volModeAlternative(false)
30
+	{
31
+		std::fill_n(&this->channelLastStates[0], sizeof(this->channelLastStates), CS_START);
32
+	}
33
+};
34
+#endif
35
+
36
+class XSFConfig_NCSF : public XSFConfig
37
+{
38
+protected:
39
+	static unsigned initInterpolation;
40
+	static std::string initMutes;
41
+
42
+	friend class XSFConfig;
43
+	friend struct SoundViewData;
44
+	unsigned interpolation;
45
+	std::bitset<16> mutes;
46
+
47
+	XSFConfig_NCSF();
48
+	void LoadSpecificConfig();
49
+	void SaveSpecificConfig();
50
+	void GenerateSpecificDialogs();
51
+	INT_PTR CALLBACK ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
52
+	void ResetSpecificConfigDefaults(HWND hwndDlg);
53
+	void SaveSpecificConfigDialog(HWND hwndDlg);
54
+	void CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad);
55
+
56
+#ifdef _DEBUG
57
+	std::unique_ptr<SoundViewData> soundViewData;
58
+
59
+	static INT_PTR CALLBACK SoundViewDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
60
+#endif
61
+public:
62
+	void About(HWND parent);
63
+
64
+#ifdef _DEBUG
65
+	void CallSoundView(XSFPlayer *xSFPlayer, HINSTANCE hInstance, HWND hwndParent);
66
+	void RefreshSoundView();
67
+	void CloseSoundView();
68
+#endif
69
+};