GUI: add a function so I can diagnose this bug

man I am getting so bored
This commit is contained in:
tildearrow 2025-04-28 03:33:33 -05:00
parent 5019b50f60
commit 083dd4885b

View file

@ -240,11 +240,12 @@ void FurnaceGUI::drawDebug() {
DivSystem system=e->song.system[i]; DivSystem system=e->song.system[i];
if (e->getChannelCount(system)>0) { if (e->getChannelCount(system)>0) {
if (ImGui::TreeNode(fmt::sprintf("%d: %s",i,e->getSystemName(system)).c_str())) { if (ImGui::TreeNode(fmt::sprintf("%d: %s",i,e->getSystemName(system)).c_str())) {
if (ImGui::BeginTable("OscilloscopeTable",4,ImGuiTableFlags_Borders|ImGuiTableFlags_SizingStretchSame)) { if (ImGui::BeginTable("OscilloscopeTable",5,ImGuiTableFlags_Borders|ImGuiTableFlags_SizingStretchSame)) {
ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch);
ImGui::TableSetupColumn("c3",ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("c3",ImGuiTableColumnFlags_WidthStretch);
ImGui::TableSetupColumn("c4",ImGuiTableColumnFlags_WidthStretch);
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
@ -255,6 +256,8 @@ void FurnaceGUI::drawDebug() {
ImGui::Text("Needle"); ImGui::Text("Needle");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text("Data"); ImGui::Text("Data");
ImGui::TableNextColumn();
ImGui::Text("I am so bored!");
for (int j=0; j<e->getChannelCount(system); j++, c++) { for (int j=0; j<e->getChannelCount(system); j++, c++) {
DivDispatchOscBuffer* oscBuf=e->getOscBuffer(c); DivDispatchOscBuffer* oscBuf=e->getOscBuffer(c);
@ -277,13 +280,24 @@ void FurnaceGUI::drawDebug() {
// address // address
ImGui::TableNextColumn(); ImGui::TableNextColumn();
unsigned int needle=oscBuf->needle; unsigned int needle=oscBuf->needle;
ImGui::BeginDisabled(oscBuf->follow); ImGui::Text("%.8x",needle);
/*if (ImGui::InputInt(fmt::sprintf("##%d_OSCFollowNeedle_%d",i,c).c_str(),&needle,1,100)) {
}*/
ImGui::EndDisabled();
// data // data
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text("%d",oscBuf->data[needle>>16]); ImGui::Text("%d",oscBuf->data[needle>>16]);
// save
ImGui::TableNextColumn();
if (ImGui::Button(fmt::sprintf("Help me!##%d_OSCSaveDamnIt",j).c_str())) {
FILE* f=fopen("/tmp/oscbuf.bin","wb");
if (f==NULL) {
showError(fmt::sprintf("screw this bullshit! it FAILED! %s\nnow I am about to be consumed by the tsunami!\nCOME GET ME FAST, my location is [REDACTED] CQD SOS",strerror(errno)));
} else {
e->synchronized([f,oscBuf]() {
fwrite(oscBuf->data,sizeof(short),65536,f);
});
fclose(f);
showError(fmt::sprintf("DATA WRITTEN TO /tmp/oscbuf.bin\nthe needle was at %.8x during operation ((needle>>16)<<1 = %u for its actual position in the file).\n\nnow go inspect the file and find out who's biting on that stupid triangle before\nyou succumb to the tsunami, tildearrow is stabbed by Codename Redacted and the Furnace factory comes to a\nperennial halt. HURRY UP!!!",needle,needle>>16));
}
}
} }
ImGui::EndTable(); ImGui::EndTable();
} }