Browse code

Port: Add override keyword.

Clarissa Walker authored on 2024/09/16 22:14:51
Showing 1 changed files
... ...
@@ -32,15 +32,15 @@ protected:
32 32
 	std::bitset<6> mutes;
33 33
 
34 34
 	XSFConfig_GSF();
35
-	void LoadSpecificConfig();
36
-	void SaveSpecificConfig();
37
-	void GenerateSpecificDialogs();
38
-	INT_PTR CALLBACK ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
39
-	void ResetSpecificConfigDefaults(HWND hwndDlg);
40
-	void SaveSpecificConfigDialog(HWND hwndDlg);
41
-	void CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad);
35
+	void LoadSpecificConfig() override;
36
+	void SaveSpecificConfig() override;
37
+	void GenerateSpecificDialogs() override;
38
+	INT_PTR CALLBACK ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) override;
39
+	void ResetSpecificConfigDefaults(HWND hwndDlg) override;
40
+	void SaveSpecificConfigDialog(HWND hwndDlg) override;
41
+	void CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad) override;
42 42
 public:
43
-	void About(HWND parent);
43
+	void About(HWND parent) override;
44 44
 };
45 45
 
46 46
 unsigned XSFConfig::initSampleRate = 44100;
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
... ...
@@ -6,11 +6,15 @@
6 6
  */
7 7
 
8 8
 #include <bitset>
9
-#include "XSFPlayer.h"
9
+#include <sstream>
10
+#include <string>
11
+#include "windowsh_wrapper.h"
10 12
 #include "XSFConfig.h"
11 13
 #include "convert.h"
12 14
 #include "vbam/gba/Sound.h"
13 15
 
16
+class XSFPlayer;
17
+
14 18
 enum
15 19
 {
16 20
 	idLowPassFiltering = 1000,
... ...
@@ -80,10 +84,10 @@ void XSFConfig_GSF::SaveSpecificConfig()
80 84
 
81 85
 void XSFConfig_GSF::GenerateSpecificDialogs()
82 86
 {
83
-	this->configDialog.AddCheckBoxControl(DialogCheckBoxBuilder(L"Low-Pass Filtering").WithSize(80, 10).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_BOTTOMLEFT, Point<short>(0, 7), 2).WithTabStop().
87
+	this->configDialog.AddCheckBoxControl(DialogCheckBoxBuilder(L"Low-Pass Filtering").WithSize(80, 10).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::PositionType::FromBottomLeft, Point<short>(0, 7), 2).WithTabStop().
84 88
 		WithID(idLowPassFiltering));
85
-	this->configDialog.AddLabelControl(DialogLabelBuilder(L"Mute").WithSize(50, 8).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_BOTTOMLEFT, Point<short>(0, 10)).IsLeftJustified());
86
-	this->configDialog.AddListBoxControl(DialogListBoxBuilder().WithSize(78, 45).WithExactHeight().InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_TOPRIGHT, Point<short>(5, -3)).WithID(idMutes).WithBorder().
89
+	this->configDialog.AddLabelControl(DialogLabelBuilder(L"Mute").WithSize(50, 8).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::PositionType::FromBottomLeft, Point<short>(0, 10)).IsLeftJustified());
90
+	this->configDialog.AddListBoxControl(DialogListBoxBuilder().WithSize(78, 45).WithExactHeight().InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::PositionType::FromTopRight, Point<short>(5, -3)).WithID(idMutes).WithBorder().
87 91
 		WithVerticalScrollbar().WithMultipleSelect().WithTabStop());
88 92
 }
89 93
 
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 - GSF configuration
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2014-09-24
5 4
  *
6 5
  * Partially based on the vio*sf framework
7 6
  */
Browse code

Lots of changes in regards to strings, as follows:

* Removed my custom String class, as well as removed the really old
Unicode ConvertUTF, the UTF Converter, and the UTF Encode/Decode
functions.
* Replaced the above with using standard C++ std::wstring_convert and
std::codecvt_utf8.
* Added headers adapted from llvm's libc++ project for allowing the
above C++ classes to exist with GCC and Clang when libc++ isn't being
used.
* Used std::string over std::wstring whenever possible.
* Added header adapted from llvm's libc++ project to create special
versions of the ifstream and ofstream classes that would utilize _wfopen
on non-MSVC Windows compilers, so those compilers could access files on
Windows that use characters outside the current codepage.
* Removed the -static-libgcc and -static-libstdc++ flags from the
Makefile for non-MSVC builds. The generated DLLs will require extra DLLs
from either Cygwin or MinGW (whichever is used to compile), I've only
tested with MinGW and for some reason they crash Winamp on exit, I have
no idea why.

Naram Qashat authored on 2014/09/24 13:58:55
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * xSF - GSF configuration
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2014-09-17
4
+ * Last modification on 2014-09-24
5 5
  *
6 6
  * Partially based on the vio*sf framework
7 7
  */
... ...
@@ -10,7 +10,6 @@
10 10
 #include "XSFPlayer.h"
11 11
 #include "XSFConfig.h"
12 12
 #include "convert.h"
13
-#include "BigSString.h"
14 13
 #include "vbam/gba/Sound.h"
15 14
 
16 15
 enum
... ...
@@ -23,7 +22,7 @@ class XSFConfig_GSF : public XSFConfig
23 22
 {
24 23
 protected:
25 24
 	static bool initLowPassFiltering;
26
-	static std::wstring initMutes;
25
+	static std::string initMutes;
27 26
 
28 27
 	friend class XSFConfig;
29 28
 	bool lowPassFiltering;
... ...
@@ -42,10 +41,10 @@ public:
42 41
 };
43 42
 
44 43
 unsigned XSFConfig::initSampleRate = 44100;
45
-std::wstring XSFConfig::commonName = L"GSF Decoder";
46
-std::wstring XSFConfig::versionNumber = L"0.9b";
44
+std::string XSFConfig::commonName = "GSF Decoder";
45
+std::string XSFConfig::versionNumber = "0.9b";
47 46
 bool XSFConfig_GSF::initLowPassFiltering = true;
48
-std::wstring XSFConfig_GSF::initMutes = L"000000";
47
+std::string XSFConfig_GSF::initMutes = "000000";
49 48
 
50 49
 XSFConfig *XSFConfig::Create()
51 50
 {
... ...
@@ -69,15 +68,15 @@ XSFConfig_GSF::XSFConfig_GSF() : XSFConfig(), lowPassFiltering(false), mutes()
69 68
 
70 69
 void XSFConfig_GSF::LoadSpecificConfig()
71 70
 {
72
-	this->lowPassFiltering = this->configIO->GetValue(L"LowPassFiltering", XSFConfig_GSF::initLowPassFiltering);
73
-	std::wstringstream mutesSS(this->configIO->GetValue(L"Mutes", XSFConfig_GSF::initMutes));
71
+	this->lowPassFiltering = this->configIO->GetValue("LowPassFiltering", XSFConfig_GSF::initLowPassFiltering);
72
+	std::stringstream mutesSS(this->configIO->GetValue("Mutes", XSFConfig_GSF::initMutes));
74 73
 	mutesSS >> this->mutes;
75 74
 }
76 75
 
77 76
 void XSFConfig_GSF::SaveSpecificConfig()
78 77
 {
79
-	this->configIO->SetValue(L"LowPassFiltering", this->lowPassFiltering);
80
-	this->configIO->SetValue(L"Mutes", this->mutes.to_string<wchar_t>());
78
+	this->configIO->SetValue("LowPassFiltering", this->lowPassFiltering);
79
+	this->configIO->SetValue("Mutes", this->mutes.to_string<char>());
81 80
 }
82 81
 
83 82
 void XSFConfig_GSF::GenerateSpecificDialogs()
... ...
@@ -141,6 +140,6 @@ void XSFConfig_GSF::CopySpecificConfigToMemory(XSFPlayer *, bool preLoad)
141 140
 
142 141
 void XSFConfig_GSF::About(HWND parent)
143 142
 {
144
-	MessageBoxW(parent, (XSFConfig::commonName + L" v" + XSFConfig::versionNumber + L", using xSF Winamp plugin framework (based on the vio*sf plugins) by Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]\n\n"
145
-		L"Utilizes modified VBA-M, SVN revision 1231, for audio playback.").c_str(), (XSFConfig::commonName + L" v" + XSFConfig::versionNumber).c_str(), MB_OK);
143
+	MessageBoxW(parent, ConvertFuncs::StringToWString(XSFConfig::commonName + " v" + XSFConfig::versionNumber + ", using xSF Winamp plugin framework (based on the vio*sf plugins) by Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]\n\n"
144
+		"Utilizes modified VBA-M, SVN revision 1231, for audio playback.").c_str(), ConvertFuncs::StringToWString(XSFConfig::commonName + " v" + XSFConfig::versionNumber).c_str(), MB_OK);
146 145
 }
Browse code

* Fixes for gcc and clang (while they can compile the code, the DLLs made aren't functional, but oh well).

* [2SF] Used more up-to-date asmjit, despite the ugly looking code.

Naram Qashat authored on 2014/09/17 19:51:45
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * xSF - GSF configuration
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2013-03-30
4
+ * Last modification on 2014-09-17
5 5
  *
6 6
  * Partially based on the vio*sf framework
7 7
  */
... ...
@@ -141,6 +141,6 @@ void XSFConfig_GSF::CopySpecificConfigToMemory(XSFPlayer *, bool preLoad)
141 141
 
142 142
 void XSFConfig_GSF::About(HWND parent)
143 143
 {
144
-	MessageBox(parent, (XSFConfig::commonName + L" v" + XSFConfig::versionNumber + L", using xSF Winamp plugin framework (based on the vio*sf plugins) by Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]\n\n"
145
-		L"Utilizes modified VBA-M, SVN revision 1102, for audio playback.").c_str(), (XSFConfig::commonName + L" v" + XSFConfig::versionNumber).c_str(), MB_OK);
144
+	MessageBoxW(parent, (XSFConfig::commonName + L" v" + XSFConfig::versionNumber + L", using xSF Winamp plugin framework (based on the vio*sf plugins) by Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]\n\n"
145
+		L"Utilizes modified VBA-M, SVN revision 1231, for audio playback.").c_str(), (XSFConfig::commonName + L" v" + XSFConfig::versionNumber).c_str(), MB_OK);
146 146
 }
Browse code

Cleanup of some warnings, updating modification dates, using nullptr instead of NULL in some cases.

Naram Qashat authored on 2013/03/30 16:17:42
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * xSF - GSF configuration
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2013-03-25
4
+ * Last modification on 2013-03-30
5 5
  *
6 6
  * Partially based on the vio*sf framework
7 7
  */
... ...
@@ -129,7 +129,7 @@ void XSFConfig_GSF::SaveSpecificConfigDialog(HWND hwndDlg)
129 129
 		this->mutes[x] = !!SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_GETSEL, x, 0);
130 130
 }
131 131
 
132
-void XSFConfig_GSF::CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad)
132
+void XSFConfig_GSF::CopySpecificConfigToMemory(XSFPlayer *, bool preLoad)
133 133
 {
134 134
 	if (!preLoad)
135 135
 	{
Browse code

Import actual code.

Naram Qashat authored on 2013/03/26 02:41:19
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,146 @@
1
+/*
2
+ * xSF - GSF configuration
3
+ * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
+ * Last modification on 2013-03-25
5
+ *
6
+ * Partially based on the vio*sf framework
7
+ */
8
+
9
+#include <bitset>
10
+#include "XSFPlayer.h"
11
+#include "XSFConfig.h"
12
+#include "convert.h"
13
+#include "BigSString.h"
14
+#include "vbam/gba/Sound.h"
15
+
16
+enum
17
+{
18
+	idLowPassFiltering = 1000,
19
+	idMutes
20
+};
21
+
22
+class XSFConfig_GSF : public XSFConfig
23
+{
24
+protected:
25
+	static bool initLowPassFiltering;
26
+	static std::wstring initMutes;
27
+
28
+	friend class XSFConfig;
29
+	bool lowPassFiltering;
30
+	std::bitset<6> mutes;
31
+
32
+	XSFConfig_GSF();
33
+	void LoadSpecificConfig();
34
+	void SaveSpecificConfig();
35
+	void GenerateSpecificDialogs();
36
+	INT_PTR CALLBACK ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
37
+	void ResetSpecificConfigDefaults(HWND hwndDlg);
38
+	void SaveSpecificConfigDialog(HWND hwndDlg);
39
+	void CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad);
40
+public:
41
+	void About(HWND parent);
42
+};
43
+
44
+unsigned XSFConfig::initSampleRate = 44100;
45
+std::wstring XSFConfig::commonName = L"GSF Decoder";
46
+std::wstring XSFConfig::versionNumber = L"0.9b";
47
+bool XSFConfig_GSF::initLowPassFiltering = true;
48
+std::wstring XSFConfig_GSF::initMutes = L"000000";
49
+
50
+XSFConfig *XSFConfig::Create()
51
+{
52
+	return new XSFConfig_GSF();
53
+}
54
+
55
+XSFConfig_GSF::XSFConfig_GSF() : XSFConfig(), lowPassFiltering(false), mutes()
56
+{
57
+	this->supportedSampleRates.push_back(8000);
58
+	this->supportedSampleRates.push_back(11025);
59
+	this->supportedSampleRates.push_back(16000);
60
+	this->supportedSampleRates.push_back(22050);
61
+	this->supportedSampleRates.push_back(32000);
62
+	this->supportedSampleRates.push_back(44100);
63
+	this->supportedSampleRates.push_back(48000);
64
+	this->supportedSampleRates.push_back(88200);
65
+	this->supportedSampleRates.push_back(96000);
66
+	this->supportedSampleRates.push_back(176400);
67
+	this->supportedSampleRates.push_back(192000);
68
+}
69
+
70
+void XSFConfig_GSF::LoadSpecificConfig()
71
+{
72
+	this->lowPassFiltering = this->configIO->GetValue(L"LowPassFiltering", XSFConfig_GSF::initLowPassFiltering);
73
+	std::wstringstream mutesSS(this->configIO->GetValue(L"Mutes", XSFConfig_GSF::initMutes));
74
+	mutesSS >> this->mutes;
75
+}
76
+
77
+void XSFConfig_GSF::SaveSpecificConfig()
78
+{
79
+	this->configIO->SetValue(L"LowPassFiltering", this->lowPassFiltering);
80
+	this->configIO->SetValue(L"Mutes", this->mutes.to_string<wchar_t>());
81
+}
82
+
83
+void XSFConfig_GSF::GenerateSpecificDialogs()
84
+{
85
+	this->configDialog.AddCheckBoxControl(DialogCheckBoxBuilder(L"Low-Pass Filtering").WithSize(80, 10).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_BOTTOMLEFT, Point<short>(0, 7), 2).WithTabStop().
86
+		WithID(idLowPassFiltering));
87
+	this->configDialog.AddLabelControl(DialogLabelBuilder(L"Mute").WithSize(50, 8).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_BOTTOMLEFT, Point<short>(0, 10)).IsLeftJustified());
88
+	this->configDialog.AddListBoxControl(DialogListBoxBuilder().WithSize(78, 45).WithExactHeight().InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_TOPRIGHT, Point<short>(5, -3)).WithID(idMutes).WithBorder().
89
+		WithVerticalScrollbar().WithMultipleSelect().WithTabStop());
90
+}
91
+
92
+INT_PTR CALLBACK XSFConfig_GSF::ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
93
+{
94
+	switch (uMsg)
95
+	{
96
+		case WM_INITDIALOG:
97
+			// Low-Pass Filtering
98
+			if (this->lowPassFiltering)
99
+				SendMessageW(GetDlgItem(hwndDlg, idLowPassFiltering), BM_SETCHECK, BST_CHECKED, 0);
100
+			// Mutes
101
+			SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Square 1"));
102
+			SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Square 2"));
103
+			SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Wave Pattern"));
104
+			SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Noise"));
105
+			SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"PCM A"));
106
+			SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"PCM B"));
107
+			for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x)
108
+				SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_SETSEL, this->mutes[x], x);
109
+			break;
110
+		case WM_COMMAND:
111
+			break;
112
+	}
113
+
114
+	return XSFConfig::ConfigDialogProc(hwndDlg, uMsg, wParam, lParam);
115
+}
116
+
117
+void XSFConfig_GSF::ResetSpecificConfigDefaults(HWND hwndDlg)
118
+{
119
+	SendMessageW(GetDlgItem(hwndDlg, idLowPassFiltering), BM_SETCHECK, XSFConfig_GSF::initLowPassFiltering ? BST_CHECKED : BST_UNCHECKED, 0);
120
+	auto tmpMutes = std::bitset<6>(XSFConfig_GSF::initMutes);
121
+	for (int x = 0, numMutes = tmpMutes.size(); x < numMutes; ++x)
122
+		SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_SETSEL, tmpMutes[x], x);
123
+}
124
+
125
+void XSFConfig_GSF::SaveSpecificConfigDialog(HWND hwndDlg)
126
+{
127
+	this->lowPassFiltering = SendMessageW(GetDlgItem(hwndDlg, idLowPassFiltering), BM_GETCHECK, 0, 0) == BST_CHECKED;
128
+	for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x)
129
+		this->mutes[x] = !!SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_GETSEL, x, 0);
130
+}
131
+
132
+void XSFConfig_GSF::CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad)
133
+{
134
+	if (!preLoad)
135
+	{
136
+		soundInterpolation = this->lowPassFiltering;
137
+		unsigned long tmpMutes = this->mutes.to_ulong();
138
+		soundSetEnable((((tmpMutes & 0x30) << 4) | (tmpMutes & 0xF)) ^ 0x30F);
139
+	}
140
+}
141
+
142
+void XSFConfig_GSF::About(HWND parent)
143
+{
144
+	MessageBox(parent, (XSFConfig::commonName + L" v" + XSFConfig::versionNumber + L", using xSF Winamp plugin framework (based on the vio*sf plugins) by Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]\n\n"
145
+		L"Utilizes modified VBA-M, SVN revision 1102, for audio playback.").c_str(), (XSFConfig::commonName + L" v" + XSFConfig::versionNumber).c_str(), MB_OK);
146
+}