| ... | ... |
@@ -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); |
* 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().
| ... | ... |
@@ -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 |
(I never remember to update these and besides, GitHub history can show when they were last modified.)
Also added a clone of DeSmuME's Sound View that is only build during a
debug build, which helped to identify the above issues.
| 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 |
+}; |