KeppySoftware/OmniMIDI

kdmapi.h DriverSettingsCase broken, causes DriverSettings to always return FALSE without changing settings.

LaxLacks opened this issue · 0 comments

Finding it impossible to unlock 128 MIDI channels with 14.8.2 via the DriverSettings API call.

Issue 1, the inline if at the top is intended to include multiple lines and requires a code block. It will always return FALSE here before even checking cbValue

Issue 2, Mode is always changed to OM_SET and requires == in place of =

Here's a fixed version:

diff --git a/OmniMIDI/kdmapi.h b/OmniMIDI/kdmapi.h
index 54637901..bdeaf0ce 100644
--- a/OmniMIDI/kdmapi.h
+++ b/OmniMIDI/kdmapi.h
@@ -7,10 +7,10 @@ Thank you Kode54 for allowing me to fork your awesome driver.
 
 #define DriverSettingsCase(Setting, Mode, Type, SettingStruct, Value, cbValue) \
 	case Setting: \
-		if (!SettingsManagedByClient) PrintMessageToDebugLog(#Setting, "Please send OM_MANAGE first!!!"); return FALSE; \
+		if (!SettingsManagedByClient) { PrintMessageToDebugLog(#Setting, "Please send OM_MANAGE first!!!"); return FALSE; } \
 		if (cbValue != sizeof(Type)) return FALSE; \
-		if (Mode = OM_SET) SettingStruct = *(Type*)Value; \
-		else if (Mode = OM_GET) *(Type*)Value = SettingStruct; \
+		if (Mode == OM_SET) SettingStruct = *(Type*)Value; \
+		else if (Mode == OM_GET) *(Type*)Value = SettingStruct; \
 		else return FALSE; \
 		break;