Ensure note names are normalized (i.e. converted to lowercase) properly before parsing.master
@@ -5,7 +5,7 @@ MaxFps=30 | |||||
[Joystick.0] | [Joystick.0] | ||||
DeviceID=0 | DeviceID=0 | ||||
AxisThreshold=8000 | AxisThreshold=8000 | ||||
GUID=00000000-0000-0000-0000-000000000000 | |||||
GUID=00000000000000000000000000000000 | |||||
[Joystick.0.ControlMapping] | [Joystick.0.ControlMapping] | ||||
Affirm=11 | Affirm=11 | ||||
Negate=10 | Negate=10 | ||||
@@ -65,7 +65,7 @@ Username=Player 1 | |||||
[Joystick.1] | [Joystick.1] | ||||
DeviceID=1 | DeviceID=1 | ||||
AxisThreshold=8000 | AxisThreshold=8000 | ||||
GUID=00000000-0000-0000-0000-000000000000 | |||||
GUID=00000000000000000000000000000000 | |||||
[Joystick.1.ControlMapping] | [Joystick.1.ControlMapping] | ||||
Affirm=11 | Affirm=11 | ||||
Negate=10 | Negate=10 | ||||
@@ -302,7 +302,7 @@ IZ_ProcedureResult IZ_JoystickInitialize(IZ_JoystickState(* state)[IZ_PLAYERS], | |||||
memcpy(&(*state)[player_index].config.guid, &joystick_guid, sizeof(SDL_GUID)); | memcpy(&(*state)[player_index].config.guid, &joystick_guid, sizeof(SDL_GUID)); | ||||
//(*state)[player_index].config.guid = joystick_guid; | //(*state)[player_index].config.guid = joystick_guid; | ||||
printf("initialize event from guid: "); | |||||
printf("[INPUT:JOYSTICK] Initialize event from GUID: "); | |||||
for (u8 zz = 0; zz < 16; zz += 1) { | for (u8 zz = 0; zz < 16; zz += 1) { | ||||
printf("%02x", (*state)[player_index].config.guid.data[zz]); | printf("%02x", (*state)[player_index].config.guid.data[zz]); | ||||
} | } | ||||
@@ -157,7 +157,7 @@ IZ_ProcedureResult IZ_MIDIInputInitialize(IZ_MIDIInputState(* state)[IZ_PLAYERS] | |||||
u8 input_midi_devices_count = 0; | u8 input_midi_devices_count = 0; | ||||
u8 device_index; | u8 device_index; | ||||
for (device_index = 0; device_index < midi_devices_count; device_index += 1) { | for (device_index = 0; device_index < midi_devices_count; device_index += 1) { | ||||
if (!Pm_GetDeviceInfo(device_index)->output) { | |||||
if (!Pm_GetDeviceInfo(device_index)->input) { | |||||
continue; | continue; | ||||
} | } | ||||
@@ -26,8 +26,12 @@ char* IZ_MIDIGetNoteName(u8 midi_note) { | |||||
u8 IZ_MIDIGetNoteFromName(const char* name) { | u8 IZ_MIDIGetNoteFromName(const char* name) { | ||||
char name_copy[8]; | char name_copy[8]; | ||||
memcpy(name_copy, name, 8); | memcpy(name_copy, name, 8); | ||||
#ifdef WIN32 | |||||
#ifdef IZ_WIN32 | |||||
_strlwr_s(name_copy, 8); | _strlwr_s(name_copy, 8); | ||||
#elif defined IZ_WIN64 | |||||
_strlwr_s(name_copy, 8); | |||||
#else | |||||
_strlwr(name_copy); | |||||
#endif | #endif | ||||
u8 octave; | u8 octave; | ||||
@@ -41,7 +45,7 @@ u8 IZ_MIDIGetNoteFromName(const char* name) { | |||||
return (octave * 12) + pitch_index; | return (octave * 12) + pitch_index; | ||||
} | } | ||||
} | } | ||||
return 255u; | |||||
return 255u; // invalid note value | |||||
} | } | ||||
u8 pitch_class; | u8 pitch_class; | ||||