From 8732fb3e754a55f0012c0ffb0f3e3941302307d7 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 13 Jul 2020 20:07:47 +0200 Subject: [PATCH] Fixed some MIDI-related crashes and AdLib Gold now writes the correct amount of EEPROM bytes on close. --- src/sound/midi.c | 5 ++++- src/sound/snd_adlibgold.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sound/midi.c b/src/sound/midi.c index 22efb56f2..19f1ce0a8 100644 --- a/src/sound/midi.c +++ b/src/sound/midi.c @@ -295,6 +295,9 @@ midi_in_device_init() void midi_raw_out_rt_byte(uint8_t val) { + if (!midi_in) + return; + if (!midi_in->midi_realtime) return; @@ -310,7 +313,7 @@ midi_raw_out_rt_byte(uint8_t val) void midi_raw_out_thru_rt_byte(uint8_t val) { - if (midi_in->thruchan) + if (midi_in && midi_in->thruchan) midi_raw_out_rt_byte(val); } diff --git a/src/sound/snd_adlibgold.c b/src/sound/snd_adlibgold.c index 09a51994b..b031a6835 100644 --- a/src/sound/snd_adlibgold.c +++ b/src/sound/snd_adlibgold.c @@ -820,7 +820,7 @@ void adgold_close(void *p) f = nvr_fopen(L"adgold.bin", L"wb"); if (f) { - fwrite(adgold->adgold_eeprom, 0x18, 1, f); + fwrite(adgold->adgold_eeprom, 0x1a, 1, f); fclose(f); }