diff options
Diffstat (limited to 'utils/winmm_drv/config')
-rw-r--r-- | utils/winmm_drv/config/regconfig.c | 46 | ||||
-rw-r--r-- | utils/winmm_drv/config/regconfig.h | 3 |
2 files changed, 47 insertions, 2 deletions
diff --git a/utils/winmm_drv/config/regconfig.c b/utils/winmm_drv/config/regconfig.c index 353cea2..6e35df0 100644 --- a/utils/winmm_drv/config/regconfig.c +++ b/utils/winmm_drv/config/regconfig.c @@ -93,13 +93,15 @@ static BOOL readIntFromRegistry(HKEY hKeyParent, const PWCHAR subkey, const PWCH { WCHAR *buf = NULL; BOOL ret; + ret = readStringFromRegistry(hKeyParent, subkey, valueName, &buf); + if(ret && readData) - { *readData = _wtoi(buf); - } + if(buf) free(buf); + return ret; } @@ -115,6 +117,34 @@ static BOOL writeIntToRegistry(HKEY hKeyParent, const PWCHAR subkey, const PWCHA return ret; } +static BOOL readUIntFromRegistry(HKEY hKeyParent, const PWCHAR subkey, const PWCHAR valueName, UINT *readData) +{ + WCHAR *buf = NULL; + BOOL ret; + + ret = readStringFromRegistry(hKeyParent, subkey, valueName, &buf); + + if(ret && readData) + *readData = wcstoul(buf, NULL, 10); + + if(buf) + free(buf); + + return ret; +} + +static BOOL writeUIntToRegistry(HKEY hKeyParent, const PWCHAR subkey, const PWCHAR valueName, UINT intData) +{ + WCHAR buf[20]; + BOOL ret; + + ZeroMemory(buf, 20); + _snwprintf(buf, 20, L"%u", intData); + + ret = writeStringToRegistry(hKeyParent, subkey, valueName, buf); + return ret; +} + @@ -133,8 +163,11 @@ void setupDefault(DriverSettings *setup) setup->flagFullBrightness = BST_UNCHECKED; setup->volumeModel = 0; + setup->chanAlloc = 0; setup->numChips = 4; setup->num4ops = -1; + + setup->outputDevice = (UINT)-1; } @@ -144,6 +177,7 @@ static const PWCHAR s_regPath = L"SOFTWARE\\Wohlstand\\libADLMIDI"; void loadSetup(DriverSettings *setup) { int iVal; + UINT uVal; WCHAR *sVal = NULL; if(readIntFromRegistry(HKEY_CURRENT_USER, s_regPath, L"useExternalBank", &iVal)) @@ -179,11 +213,17 @@ void loadSetup(DriverSettings *setup) if(readIntFromRegistry(HKEY_CURRENT_USER, s_regPath, L"volumeModel", &iVal)) setup->volumeModel = iVal; + if(readIntFromRegistry(HKEY_CURRENT_USER, s_regPath, L"chanAlloc", &iVal)) + setup->chanAlloc = iVal; + if(readIntFromRegistry(HKEY_CURRENT_USER, s_regPath, L"numChips", &iVal)) setup->numChips = iVal; if(readIntFromRegistry(HKEY_CURRENT_USER, s_regPath, L"num4ops", &iVal)) setup->num4ops = iVal; + + if(readUIntFromRegistry(HKEY_CURRENT_USER, s_regPath, L"outputDevice", &uVal)) + setup->outputDevice = uVal; } void saveSetup(DriverSettings *setup) @@ -202,8 +242,10 @@ void saveSetup(DriverSettings *setup) writeIntToRegistry(HKEY_CURRENT_USER, s_regPath, L"flagFullBrightness", setup->flagFullBrightness); writeIntToRegistry(HKEY_CURRENT_USER, s_regPath, L"volumeModel", setup->volumeModel); + writeIntToRegistry(HKEY_CURRENT_USER, s_regPath, L"chanAlloc", setup->chanAlloc); writeIntToRegistry(HKEY_CURRENT_USER, s_regPath, L"numChips", setup->numChips); writeIntToRegistry(HKEY_CURRENT_USER, s_regPath, L"num4ops", setup->num4ops); + writeUIntToRegistry(HKEY_CURRENT_USER, s_regPath, L"outputDevice", setup->outputDevice); } diff --git a/utils/winmm_drv/config/regconfig.h b/utils/winmm_drv/config/regconfig.h index f854d1b..7c49bd6 100644 --- a/utils/winmm_drv/config/regconfig.h +++ b/utils/winmm_drv/config/regconfig.h @@ -25,8 +25,11 @@ typedef struct DriverSettings_t BOOL flagFullBrightness; int volumeModel; + int chanAlloc; int numChips; int num4ops; + + UINT outputDevice; } DriverSettings; extern const WCHAR g_adlSignalMemory[]; |