| ... | ... |
@@ -34,15 +34,15 @@ protected: |
| 34 | 34 |
std::bitset<16> mutes; |
| 35 | 35 |
|
| 36 | 36 |
XSFConfig_2SF(); |
| 37 |
- void LoadSpecificConfig(); |
|
| 38 |
- void SaveSpecificConfig(); |
|
| 39 |
- void GenerateSpecificDialogs(); |
|
| 40 |
- INT_PTR CALLBACK ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); |
|
| 41 |
- void ResetSpecificConfigDefaults(HWND hwndDlg); |
|
| 42 |
- void SaveSpecificConfigDialog(HWND hwndDlg); |
|
| 43 |
- void CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad); |
|
| 37 |
+ void LoadSpecificConfig() override; |
|
| 38 |
+ void SaveSpecificConfig() override; |
|
| 39 |
+ void GenerateSpecificDialogs() override; |
|
| 40 |
+ INT_PTR CALLBACK ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) override; |
|
| 41 |
+ void ResetSpecificConfigDefaults(HWND hwndDlg) override; |
|
| 42 |
+ void SaveSpecificConfigDialog(HWND hwndDlg) override; |
|
| 43 |
+ void CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad) override; |
|
| 44 | 44 |
public: |
| 45 |
- void About(HWND parent); |
|
| 45 |
+ void About(HWND parent) override; |
|
| 46 | 46 |
}; |
| 47 | 47 |
|
| 48 | 48 |
unsigned XSFConfig::initSampleRate = DESMUME_SAMPLE_RATE; |
* 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().
| ... | ... |
@@ -6,12 +6,17 @@ |
| 6 | 6 |
*/ |
| 7 | 7 |
|
| 8 | 8 |
#include <bitset> |
| 9 |
-#include "XSFPlayer.h" |
|
| 9 |
+#include <sstream> |
|
| 10 |
+#include <string> |
|
| 11 |
+#include <cstddef> |
|
| 12 |
+#include "windowsh_wrapper.h" |
|
| 10 | 13 |
#include "XSFConfig.h" |
| 11 | 14 |
#include "convert.h" |
| 12 | 15 |
#include "desmume/NDSSystem.h" |
| 13 | 16 |
#include "desmume/version.h" |
| 14 | 17 |
|
| 18 |
+class XSFPlayer; |
|
| 19 |
+ |
|
| 15 | 20 |
enum |
| 16 | 21 |
{
|
| 17 | 22 |
idInterpolation = 1000, |
| ... | ... |
@@ -71,11 +76,11 @@ void XSFConfig_2SF::SaveSpecificConfig() |
| 71 | 76 |
|
| 72 | 77 |
void XSFConfig_2SF::GenerateSpecificDialogs() |
| 73 | 78 |
{
|
| 74 |
- this->configDialog.AddLabelControl(DialogLabelBuilder(L"Interpolation").WithSize(50, 8).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_BOTTOMLEFT, Point<short>(0, 10), 2).IsLeftJustified()); |
|
| 75 |
- this->configDialog.AddComboBoxControl(DialogComboBoxBuilder().WithSize(78, 14).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_TOPRIGHT, Point<short>(5, -3)).WithID(idInterpolation).IsDropDownList(). |
|
| 79 |
+ this->configDialog.AddLabelControl(DialogLabelBuilder(L"Interpolation").WithSize(50, 8).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::PositionType::FromBottomLeft, Point<short>(0, 10), 2).IsLeftJustified()); |
|
| 80 |
+ this->configDialog.AddComboBoxControl(DialogComboBoxBuilder().WithSize(78, 14).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::PositionType::FromTopRight, Point<short>(5, -3)).WithID(idInterpolation).IsDropDownList(). |
|
| 76 | 81 |
WithTabStop()); |
| 77 |
- this->configDialog.AddLabelControl(DialogLabelBuilder(L"Mute").WithSize(50, 8).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_BOTTOMLEFT, Point<short>(0, 10), 2).IsLeftJustified()); |
|
| 78 |
- this->configDialog.AddListBoxControl(DialogListBoxBuilder().WithSize(78, 45).WithExactHeight().InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_TOPRIGHT, Point<short>(5, -3)).WithID(idMutes).WithBorder(). |
|
| 82 |
+ this->configDialog.AddLabelControl(DialogLabelBuilder(L"Mute").WithSize(50, 8).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::PositionType::FromBottomLeft, Point<short>(0, 10), 2).IsLeftJustified()); |
|
| 83 |
+ this->configDialog.AddListBoxControl(DialogListBoxBuilder().WithSize(78, 45).WithExactHeight().InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::PositionType::FromTopRight, Point<short>(5, -3)).WithID(idMutes).WithBorder(). |
|
| 79 | 84 |
WithVerticalScrollbar().WithMultipleSelect().WithTabStop()); |
| 80 | 85 |
} |
| 81 | 86 |
|
| ... | ... |
@@ -91,7 +96,7 @@ INT_PTR CALLBACK XSFConfig_2SF::ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM |
| 91 | 96 |
SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Sharp Interpolation")); |
| 92 | 97 |
SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_SETCURSEL, this->interpolation, 0); |
| 93 | 98 |
// Mutes |
| 94 |
- for (size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 99 |
+ for (std::size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 95 | 100 |
{
|
| 96 | 101 |
SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_ADDSTRING, 0, reinterpret_cast<LPARAM>((L"SPU " + std::to_wstring(x + 1)).c_str())); |
| 97 | 102 |
SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_SETSEL, this->mutes[x], x); |
| ... | ... |
@@ -108,14 +113,14 @@ void XSFConfig_2SF::ResetSpecificConfigDefaults(HWND hwndDlg) |
| 108 | 113 |
{
|
| 109 | 114 |
SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_SETCURSEL, XSFConfig_2SF::initInterpolation, 0); |
| 110 | 115 |
auto tmpMutes = std::bitset<16>(XSFConfig_2SF::initMutes); |
| 111 |
- for (size_t x = 0, numMutes = tmpMutes.size(); x < numMutes; ++x) |
|
| 116 |
+ for (std::size_t x = 0, numMutes = tmpMutes.size(); x < numMutes; ++x) |
|
| 112 | 117 |
SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_SETSEL, tmpMutes[x], x); |
| 113 | 118 |
} |
| 114 | 119 |
|
| 115 | 120 |
void XSFConfig_2SF::SaveSpecificConfigDialog(HWND hwndDlg) |
| 116 | 121 |
{
|
| 117 | 122 |
this->interpolation = static_cast<unsigned>(SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_GETCURSEL, 0, 0)); |
| 118 |
- for (size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 123 |
+ for (std::size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 119 | 124 |
this->mutes[x] = !!SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_GETSEL, x, 0); |
| 120 | 125 |
} |
| 121 | 126 |
|
| ... | ... |
@@ -124,7 +129,7 @@ void XSFConfig_2SF::CopySpecificConfigToMemory(XSFPlayer *, bool preLoad) |
| 124 | 129 |
if (!preLoad) |
| 125 | 130 |
{
|
| 126 | 131 |
CommonSettings.spuInterpolationMode = static_cast<SPUInterpolationMode>(this->interpolation); |
| 127 |
- for (size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 132 |
+ for (std::size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 128 | 133 |
CommonSettings.spu_muteChannels[x] = this->mutes[x]; |
| 129 | 134 |
} |
| 130 | 135 |
} |
* Replace the (w)stringify functions with the standard std::to_(w)string functions.
* Replace convertTo with versions that use type_traits to determine which standard string conversion function to call, as well as handle enums specically.
| ... | ... |
@@ -93,7 +93,7 @@ INT_PTR CALLBACK XSFConfig_2SF::ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM |
| 93 | 93 |
// Mutes |
| 94 | 94 |
for (size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
| 95 | 95 |
{
|
| 96 |
- SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_ADDSTRING, 0, reinterpret_cast<LPARAM>((L"SPU " + wstringify(x + 1)).c_str())); |
|
| 96 |
+ SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_ADDSTRING, 0, reinterpret_cast<LPARAM>((L"SPU " + std::to_wstring(x + 1)).c_str())); |
|
| 97 | 97 |
SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_SETSEL, this->mutes[x], x); |
| 98 | 98 |
} |
| 99 | 99 |
break; |
(I never remember to update these and besides, GitHub history can show when they were last modified.)
| ... | ... |
@@ -41,7 +41,7 @@ public: |
| 41 | 41 |
void About(HWND parent); |
| 42 | 42 |
}; |
| 43 | 43 |
|
| 44 |
-unsigned XSFConfig::initSampleRate = 44100; |
|
| 44 |
+unsigned XSFConfig::initSampleRate = DESMUME_SAMPLE_RATE; |
|
| 45 | 45 |
std::string XSFConfig::commonName = "2SF Decoder"; |
| 46 | 46 |
std::string XSFConfig::versionNumber = "0.9b"; |
| 47 | 47 |
unsigned XSFConfig_2SF::initInterpolation = 2; |
| ... | ... |
@@ -54,7 +54,7 @@ XSFConfig *XSFConfig::Create() |
| 54 | 54 |
|
| 55 | 55 |
XSFConfig_2SF::XSFConfig_2SF() : XSFConfig(), interpolation(0), mutes() |
| 56 | 56 |
{
|
| 57 |
- this->supportedSampleRates.push_back(44100); |
|
| 57 |
+ this->supportedSampleRates.push_back(DESMUME_SAMPLE_RATE); |
|
| 58 | 58 |
} |
| 59 | 59 |
|
| 60 | 60 |
void XSFConfig_2SF::LoadSpecificConfig() |
| ... | ... |
@@ -89,6 +89,7 @@ INT_PTR CALLBACK XSFConfig_2SF::ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM |
| 89 | 89 |
SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"No Interpolation")); |
| 90 | 90 |
SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Linear Interpolation")); |
| 91 | 91 |
SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Cosine Interpolation")); |
| 92 |
+ SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Sharp Interpolation")); |
|
| 92 | 93 |
SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_SETCURSEL, this->interpolation, 0); |
| 93 | 94 |
// Mutes |
| 94 | 95 |
for (size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
* 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.
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* xSF - 2SF 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 "desmume/NDSSystem.h" |
| 15 | 14 |
#include "desmume/version.h" |
| 16 | 15 |
|
| ... | ... |
@@ -24,7 +23,7 @@ class XSFConfig_2SF : public XSFConfig |
| 24 | 23 |
{
|
| 25 | 24 |
protected: |
| 26 | 25 |
static unsigned initInterpolation; |
| 27 |
- static std::wstring initMutes; |
|
| 26 |
+ static std::string initMutes; |
|
| 28 | 27 |
|
| 29 | 28 |
friend class XSFConfig; |
| 30 | 29 |
unsigned interpolation; |
| ... | ... |
@@ -43,10 +42,10 @@ public: |
| 43 | 42 |
}; |
| 44 | 43 |
|
| 45 | 44 |
unsigned XSFConfig::initSampleRate = 44100; |
| 46 |
-std::wstring XSFConfig::commonName = L"2SF Decoder"; |
|
| 47 |
-std::wstring XSFConfig::versionNumber = L"0.9b"; |
|
| 45 |
+std::string XSFConfig::commonName = "2SF Decoder"; |
|
| 46 |
+std::string XSFConfig::versionNumber = "0.9b"; |
|
| 48 | 47 |
unsigned XSFConfig_2SF::initInterpolation = 2; |
| 49 |
-std::wstring XSFConfig_2SF::initMutes = L"0000000000000000"; |
|
| 48 |
+std::string XSFConfig_2SF::initMutes = "0000000000000000"; |
|
| 50 | 49 |
|
| 51 | 50 |
XSFConfig *XSFConfig::Create() |
| 52 | 51 |
{
|
| ... | ... |
@@ -60,15 +59,15 @@ XSFConfig_2SF::XSFConfig_2SF() : XSFConfig(), interpolation(0), mutes() |
| 60 | 59 |
|
| 61 | 60 |
void XSFConfig_2SF::LoadSpecificConfig() |
| 62 | 61 |
{
|
| 63 |
- this->interpolation = this->configIO->GetValue(L"Interpolation", XSFConfig_2SF::initInterpolation); |
|
| 64 |
- std::wstringstream mutesSS(this->configIO->GetValue(L"Mutes", XSFConfig_2SF::initMutes)); |
|
| 62 |
+ this->interpolation = this->configIO->GetValue("Interpolation", XSFConfig_2SF::initInterpolation);
|
|
| 63 |
+ std::stringstream mutesSS(this->configIO->GetValue("Mutes", XSFConfig_2SF::initMutes));
|
|
| 65 | 64 |
mutesSS >> this->mutes; |
| 66 | 65 |
} |
| 67 | 66 |
|
| 68 | 67 |
void XSFConfig_2SF::SaveSpecificConfig() |
| 69 | 68 |
{
|
| 70 |
- this->configIO->SetValue(L"Interpolation", this->interpolation); |
|
| 71 |
- this->configIO->SetValue(L"Mutes", this->mutes.to_string<wchar_t>()); |
|
| 69 |
+ this->configIO->SetValue("Interpolation", this->interpolation);
|
|
| 70 |
+ this->configIO->SetValue("Mutes", this->mutes.to_string<char>());
|
|
| 72 | 71 |
} |
| 73 | 72 |
|
| 74 | 73 |
void XSFConfig_2SF::GenerateSpecificDialogs() |
| ... | ... |
@@ -132,6 +131,6 @@ void XSFConfig_2SF::CopySpecificConfigToMemory(XSFPlayer *, bool preLoad) |
| 132 | 131 |
|
| 133 | 132 |
void XSFConfig_2SF::About(HWND parent) |
| 134 | 133 |
{
|
| 135 |
- 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" |
|
| 136 |
- L"Utilizes modified " + String(EMU_DESMUME_NAME_AND_VERSION()).GetWStr() + L" for audio playback.").c_str(), (XSFConfig::commonName + L" v" + XSFConfig::versionNumber).c_str(), MB_OK); |
|
| 134 |
+ 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" |
|
| 135 |
+ "Utilizes modified " + EMU_DESMUME_NAME_AND_VERSION() + " for audio playback.").c_str(), ConvertFuncs::StringToWString(XSFConfig::commonName + " v" + XSFConfig::versionNumber).c_str(), MB_OK); |
|
| 137 | 136 |
} |
* [2SF] Used more up-to-date asmjit, despite the ugly looking code.
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* xSF - 2SF configuration |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2013-04-17 |
|
| 4 |
+ * Last modification on 2014-09-17 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Partially based on the vio*sf framework |
| 7 | 7 |
*/ |
| ... | ... |
@@ -132,6 +132,6 @@ void XSFConfig_2SF::CopySpecificConfigToMemory(XSFPlayer *, bool preLoad) |
| 132 | 132 |
|
| 133 | 133 |
void XSFConfig_2SF::About(HWND parent) |
| 134 | 134 |
{
|
| 135 |
- 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" |
|
| 135 |
+ 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" |
|
| 136 | 136 |
L"Utilizes modified " + String(EMU_DESMUME_NAME_AND_VERSION()).GetWStr() + L" for audio playback.").c_str(), (XSFConfig::commonName + L" v" + XSFConfig::versionNumber).c_str(), MB_OK); |
| 137 | 137 |
} |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* xSF - 2SF configuration |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2013-03-30 |
|
| 4 |
+ * Last modification on 2013-04-17 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Partially based on the vio*sf framework |
| 7 | 7 |
*/ |
| ... | ... |
@@ -12,6 +12,7 @@ |
| 12 | 12 |
#include "convert.h" |
| 13 | 13 |
#include "BigSString.h" |
| 14 | 14 |
#include "desmume/NDSSystem.h" |
| 15 |
+#include "desmume/version.h" |
|
| 15 | 16 |
|
| 16 | 17 |
enum |
| 17 | 18 |
{
|
| ... | ... |
@@ -91,7 +92,7 @@ INT_PTR CALLBACK XSFConfig_2SF::ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM |
| 91 | 92 |
SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Cosine Interpolation")); |
| 92 | 93 |
SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_SETCURSEL, this->interpolation, 0); |
| 93 | 94 |
// Mutes |
| 94 |
- for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 95 |
+ for (size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 95 | 96 |
{
|
| 96 | 97 |
SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_ADDSTRING, 0, reinterpret_cast<LPARAM>((L"SPU " + wstringify(x + 1)).c_str())); |
| 97 | 98 |
SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_SETSEL, this->mutes[x], x); |
| ... | ... |
@@ -108,14 +109,14 @@ void XSFConfig_2SF::ResetSpecificConfigDefaults(HWND hwndDlg) |
| 108 | 109 |
{
|
| 109 | 110 |
SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_SETCURSEL, XSFConfig_2SF::initInterpolation, 0); |
| 110 | 111 |
auto tmpMutes = std::bitset<16>(XSFConfig_2SF::initMutes); |
| 111 |
- for (int x = 0, numMutes = tmpMutes.size(); x < numMutes; ++x) |
|
| 112 |
+ for (size_t x = 0, numMutes = tmpMutes.size(); x < numMutes; ++x) |
|
| 112 | 113 |
SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_SETSEL, tmpMutes[x], x); |
| 113 | 114 |
} |
| 114 | 115 |
|
| 115 | 116 |
void XSFConfig_2SF::SaveSpecificConfigDialog(HWND hwndDlg) |
| 116 | 117 |
{
|
| 117 | 118 |
this->interpolation = static_cast<unsigned>(SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_GETCURSEL, 0, 0)); |
| 118 |
- for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 119 |
+ for (size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 119 | 120 |
this->mutes[x] = !!SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_GETSEL, x, 0); |
| 120 | 121 |
} |
| 121 | 122 |
|
| ... | ... |
@@ -124,7 +125,7 @@ void XSFConfig_2SF::CopySpecificConfigToMemory(XSFPlayer *, bool preLoad) |
| 124 | 125 |
if (!preLoad) |
| 125 | 126 |
{
|
| 126 | 127 |
CommonSettings.spuInterpolationMode = static_cast<SPUInterpolationMode>(this->interpolation); |
| 127 |
- for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 128 |
+ for (size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 128 | 129 |
CommonSettings.spu_muteChannels[x] = this->mutes[x]; |
| 129 | 130 |
} |
| 130 | 131 |
} |
| ... | ... |
@@ -132,5 +133,5 @@ void XSFConfig_2SF::CopySpecificConfigToMemory(XSFPlayer *, bool preLoad) |
| 132 | 133 |
void XSFConfig_2SF::About(HWND parent) |
| 133 | 134 |
{
|
| 134 | 135 |
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" |
| 135 |
- L"Utilizes modified DeSmuME v0.9.8 for audio playback.").c_str(), (XSFConfig::commonName + L" v" + XSFConfig::versionNumber).c_str(), MB_OK); |
|
| 136 |
+ L"Utilizes modified " + String(EMU_DESMUME_NAME_AND_VERSION()).GetWStr() + L" for audio playback.").c_str(), (XSFConfig::commonName + L" v" + XSFConfig::versionNumber).c_str(), MB_OK); |
|
| 136 | 137 |
} |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* xSF - 2SF 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 |
*/ |
| ... | ... |
@@ -119,7 +119,7 @@ void XSFConfig_2SF::SaveSpecificConfigDialog(HWND hwndDlg) |
| 119 | 119 |
this->mutes[x] = !!SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_GETSEL, x, 0); |
| 120 | 120 |
} |
| 121 | 121 |
|
| 122 |
-void XSFConfig_2SF::CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad) |
|
| 122 |
+void XSFConfig_2SF::CopySpecificConfigToMemory(XSFPlayer *, bool preLoad) |
|
| 123 | 123 |
{
|
| 124 | 124 |
if (!preLoad) |
| 125 | 125 |
{
|
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,136 @@ |
| 1 |
+/* |
|
| 2 |
+ * xSF - 2SF 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 "desmume/NDSSystem.h" |
|
| 15 |
+ |
|
| 16 |
+enum |
|
| 17 |
+{
|
|
| 18 |
+ idInterpolation = 1000, |
|
| 19 |
+ idMutes |
|
| 20 |
+}; |
|
| 21 |
+ |
|
| 22 |
+class XSFConfig_2SF : public XSFConfig |
|
| 23 |
+{
|
|
| 24 |
+protected: |
|
| 25 |
+ static unsigned initInterpolation; |
|
| 26 |
+ static std::wstring initMutes; |
|
| 27 |
+ |
|
| 28 |
+ friend class XSFConfig; |
|
| 29 |
+ unsigned interpolation; |
|
| 30 |
+ std::bitset<16> mutes; |
|
| 31 |
+ |
|
| 32 |
+ XSFConfig_2SF(); |
|
| 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"2SF Decoder"; |
|
| 46 |
+std::wstring XSFConfig::versionNumber = L"0.9b"; |
|
| 47 |
+unsigned XSFConfig_2SF::initInterpolation = 2; |
|
| 48 |
+std::wstring XSFConfig_2SF::initMutes = L"0000000000000000"; |
|
| 49 |
+ |
|
| 50 |
+XSFConfig *XSFConfig::Create() |
|
| 51 |
+{
|
|
| 52 |
+ return new XSFConfig_2SF(); |
|
| 53 |
+} |
|
| 54 |
+ |
|
| 55 |
+XSFConfig_2SF::XSFConfig_2SF() : XSFConfig(), interpolation(0), mutes() |
|
| 56 |
+{
|
|
| 57 |
+ this->supportedSampleRates.push_back(44100); |
|
| 58 |
+} |
|
| 59 |
+ |
|
| 60 |
+void XSFConfig_2SF::LoadSpecificConfig() |
|
| 61 |
+{
|
|
| 62 |
+ this->interpolation = this->configIO->GetValue(L"Interpolation", XSFConfig_2SF::initInterpolation); |
|
| 63 |
+ std::wstringstream mutesSS(this->configIO->GetValue(L"Mutes", XSFConfig_2SF::initMutes)); |
|
| 64 |
+ mutesSS >> this->mutes; |
|
| 65 |
+} |
|
| 66 |
+ |
|
| 67 |
+void XSFConfig_2SF::SaveSpecificConfig() |
|
| 68 |
+{
|
|
| 69 |
+ this->configIO->SetValue(L"Interpolation", this->interpolation); |
|
| 70 |
+ this->configIO->SetValue(L"Mutes", this->mutes.to_string<wchar_t>()); |
|
| 71 |
+} |
|
| 72 |
+ |
|
| 73 |
+void XSFConfig_2SF::GenerateSpecificDialogs() |
|
| 74 |
+{
|
|
| 75 |
+ this->configDialog.AddLabelControl(DialogLabelBuilder(L"Interpolation").WithSize(50, 8).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_BOTTOMLEFT, Point<short>(0, 10), 2).IsLeftJustified()); |
|
| 76 |
+ this->configDialog.AddComboBoxControl(DialogComboBoxBuilder().WithSize(78, 14).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_TOPRIGHT, Point<short>(5, -3)).WithID(idInterpolation).IsDropDownList(). |
|
| 77 |
+ WithTabStop()); |
|
| 78 |
+ this->configDialog.AddLabelControl(DialogLabelBuilder(L"Mute").WithSize(50, 8).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_BOTTOMLEFT, Point<short>(0, 10), 2).IsLeftJustified()); |
|
| 79 |
+ this->configDialog.AddListBoxControl(DialogListBoxBuilder().WithSize(78, 45).WithExactHeight().InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_TOPRIGHT, Point<short>(5, -3)).WithID(idMutes).WithBorder(). |
|
| 80 |
+ WithVerticalScrollbar().WithMultipleSelect().WithTabStop()); |
|
| 81 |
+} |
|
| 82 |
+ |
|
| 83 |
+INT_PTR CALLBACK XSFConfig_2SF::ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
|
| 84 |
+{
|
|
| 85 |
+ switch (uMsg) |
|
| 86 |
+ {
|
|
| 87 |
+ case WM_INITDIALOG: |
|
| 88 |
+ // Interpolation |
|
| 89 |
+ SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"No Interpolation")); |
|
| 90 |
+ SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Linear Interpolation")); |
|
| 91 |
+ SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Cosine Interpolation")); |
|
| 92 |
+ SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_SETCURSEL, this->interpolation, 0); |
|
| 93 |
+ // Mutes |
|
| 94 |
+ for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 95 |
+ {
|
|
| 96 |
+ SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_ADDSTRING, 0, reinterpret_cast<LPARAM>((L"SPU " + wstringify(x + 1)).c_str())); |
|
| 97 |
+ SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_SETSEL, this->mutes[x], x); |
|
| 98 |
+ } |
|
| 99 |
+ break; |
|
| 100 |
+ case WM_COMMAND: |
|
| 101 |
+ break; |
|
| 102 |
+ } |
|
| 103 |
+ |
|
| 104 |
+ return XSFConfig::ConfigDialogProc(hwndDlg, uMsg, wParam, lParam); |
|
| 105 |
+} |
|
| 106 |
+ |
|
| 107 |
+void XSFConfig_2SF::ResetSpecificConfigDefaults(HWND hwndDlg) |
|
| 108 |
+{
|
|
| 109 |
+ SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_SETCURSEL, XSFConfig_2SF::initInterpolation, 0); |
|
| 110 |
+ auto tmpMutes = std::bitset<16>(XSFConfig_2SF::initMutes); |
|
| 111 |
+ for (int x = 0, numMutes = tmpMutes.size(); x < numMutes; ++x) |
|
| 112 |
+ SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_SETSEL, tmpMutes[x], x); |
|
| 113 |
+} |
|
| 114 |
+ |
|
| 115 |
+void XSFConfig_2SF::SaveSpecificConfigDialog(HWND hwndDlg) |
|
| 116 |
+{
|
|
| 117 |
+ this->interpolation = static_cast<unsigned>(SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_GETCURSEL, 0, 0)); |
|
| 118 |
+ for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 119 |
+ this->mutes[x] = !!SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_GETSEL, x, 0); |
|
| 120 |
+} |
|
| 121 |
+ |
|
| 122 |
+void XSFConfig_2SF::CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad) |
|
| 123 |
+{
|
|
| 124 |
+ if (!preLoad) |
|
| 125 |
+ {
|
|
| 126 |
+ CommonSettings.spuInterpolationMode = static_cast<SPUInterpolationMode>(this->interpolation); |
|
| 127 |
+ for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 128 |
+ CommonSettings.spu_muteChannels[x] = this->mutes[x]; |
|
| 129 |
+ } |
|
| 130 |
+} |
|
| 131 |
+ |
|
| 132 |
+void XSFConfig_2SF::About(HWND parent) |
|
| 133 |
+{
|
|
| 134 |
+ 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" |
|
| 135 |
+ L"Utilizes modified DeSmuME v0.9.8 for audio playback.").c_str(), (XSFConfig::commonName + L" v" + XSFConfig::versionNumber).c_str(), MB_OK); |
|
| 136 |
+} |