From 9b7145d2b0440bdf4f720824d52390c32000dc1e Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 29 May 2022 22:21:37 -0500 Subject: [PATCH 1/4] harden wavetable loader --- src/engine/engine.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 812159e7..639712e5 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -1840,6 +1840,9 @@ bool DivEngine::addWaveFromFile(const char* path, bool addRaw) { // read as .dmw reader.seek(0,SEEK_SET); int len=reader.readI(); + if (len<=0 || len>256) { + throw EndOfFileException(&reader,reader.size()); + } wave->max=(unsigned char)reader.readC(); if (wave->max==255) { // new wavetable format unsigned char waveVersion=reader.readC(); From 539f96542f60feb5b2cd631ac7017aa9d35809ad Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 29 May 2022 23:37:10 -0500 Subject: [PATCH 2/4] work around #502 @cam900 please revert this one before attempting to diagnose the issue. --- extern/imgui_patched/imgui_tables.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extern/imgui_patched/imgui_tables.cpp b/extern/imgui_patched/imgui_tables.cpp index 9b67811c..6aea054e 100644 --- a/extern/imgui_patched/imgui_tables.cpp +++ b/extern/imgui_patched/imgui_tables.cpp @@ -1998,6 +1998,11 @@ void ImGui::TableBeginCell(ImGuiTable* table, int column_n) { // FIXME-TABLE: Could avoid this if draw channel is dummy channel? SetWindowClipRectBeforeSetChannel(window, column->ClipRect); + if (column->DrawChannelCurrent==(ImGuiTableDrawChannelIdx)-1) { + // temporary workaround for #502 + //printf("sorry!\n"); + column->DrawChannelCurrent=column_n; + } table->DrawSplitter->SetCurrentChannel(window->DrawList, column->DrawChannelCurrent); } From 394a315c4abeb70a76bd0d1d91d23db94c4a3958 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 30 May 2022 00:07:24 -0500 Subject: [PATCH 3/4] ZX beeper: drum muting hotfix --- src/engine/platform/zxbeeper.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/engine/platform/zxbeeper.cpp b/src/engine/platform/zxbeeper.cpp index 3ea42ede..ff14d161 100644 --- a/src/engine/platform/zxbeeper.cpp +++ b/src/engine/platform/zxbeeper.cpp @@ -208,6 +208,7 @@ int DivPlatformZXBeeper::dispatch(DivCommand c) { chan[c.chan].duty=c.value; break; case DIV_CMD_SAMPLE_MODE: + if (isMuted[c.chan]) break; curSample=c.value; curSamplePos=0; curSamplePeriod=0; From 35d56ac5d68c9f73b78af552ee95560c66eda206 Mon Sep 17 00:00:00 2001 From: cam900 Date: Mon, 30 May 2022 22:00:38 +0900 Subject: [PATCH 4/4] Fix typecasting --- extern/imgui_patched/imgui_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/imgui_patched/imgui_internal.h b/extern/imgui_patched/imgui_internal.h index 3ec72742..3d6a3a1d 100644 --- a/extern/imgui_patched/imgui_internal.h +++ b/extern/imgui_patched/imgui_internal.h @@ -2563,7 +2563,7 @@ struct ImGuiTableColumn PrevEnabledColumn = NextEnabledColumn = -1; SortOrder = -1; SortDirection = ImGuiSortDirection_None; - DrawChannelCurrent = DrawChannelFrozen = DrawChannelUnfrozen = (ImU8)-1; + DrawChannelCurrent = DrawChannelFrozen = DrawChannelUnfrozen = (ImU32)-1; } };