GUI: hex mode for SNES filter MML string
This commit is contained in:
parent
cb34b7e1a7
commit
6fbe11696e
|
@ -5443,6 +5443,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
displayPendingIns(false),
|
displayPendingIns(false),
|
||||||
pendingInsSingle(false),
|
pendingInsSingle(false),
|
||||||
displayPendingRawSample(false),
|
displayPendingRawSample(false),
|
||||||
|
snesFilterHex(false),
|
||||||
vgmExportVersion(0x171),
|
vgmExportVersion(0x171),
|
||||||
drawHalt(10),
|
drawHalt(10),
|
||||||
zsmExportTickRate(60),
|
zsmExportTickRate(60),
|
||||||
|
|
|
@ -1039,7 +1039,7 @@ class FurnaceGUI {
|
||||||
bool portrait, mobileMenuOpen;
|
bool portrait, mobileMenuOpen;
|
||||||
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
|
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
|
||||||
bool displayNew, fullScreen, preserveChanPos, wantScrollList, noteInputPoly;
|
bool displayNew, fullScreen, preserveChanPos, wantScrollList, noteInputPoly;
|
||||||
bool displayPendingIns, pendingInsSingle, displayPendingRawSample;
|
bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex;
|
||||||
bool willExport[32];
|
bool willExport[32];
|
||||||
int vgmExportVersion;
|
int vgmExportVersion;
|
||||||
int drawHalt;
|
int drawHalt;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "misc/cpp/imgui_stdlib.h"
|
#include "misc/cpp/imgui_stdlib.h"
|
||||||
|
#include <imgui.h>
|
||||||
|
|
||||||
bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool modifyOnChange) {
|
bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool modifyOnChange) {
|
||||||
bool altered=false;
|
bool altered=false;
|
||||||
|
@ -1273,19 +1274,51 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
||||||
} rightClickable
|
} rightClickable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button(snesFilterHex?"Hex##SNESFHex":"Dec##SNESFHex")) {
|
||||||
|
snesFilterHex=!snesFilterHex;
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); // wavetable text input size found here
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); // wavetable text input size found here
|
||||||
if (ImGui::InputText("##MMLWave",&mmlStringSNES)) {
|
if (ImGui::InputText("##MMLWave",&mmlStringSNES)) {
|
||||||
int actualData[256];
|
int actualData[256];
|
||||||
int discardIt=0;
|
int discardIt=0;
|
||||||
memset(actualData,0,256*sizeof(int));
|
memset(actualData,0,256*sizeof(int));
|
||||||
decodeMMLStrW(mmlStringSNES,actualData,discardIt,-128,127,false);
|
decodeMMLStrW(mmlStringSNES,actualData,discardIt,snesFilterHex?0:-128,snesFilterHex?255:127,snesFilterHex);
|
||||||
|
if (snesFilterHex) {
|
||||||
|
for (int i=0; i<8; i++) {
|
||||||
|
if (actualData[i]>=128) actualData[i]-=256;
|
||||||
|
}
|
||||||
|
}
|
||||||
memcpy(echoFilter,actualData,8*sizeof(int));
|
memcpy(echoFilter,actualData,8*sizeof(int));
|
||||||
altered=true;
|
altered=true;
|
||||||
}
|
}
|
||||||
if (!ImGui::IsItemActive()) {
|
if (!ImGui::IsItemActive()) {
|
||||||
encodeMMLStr(mmlStringSNES,echoFilter,8,-1,-1,false);
|
int actualData[8];
|
||||||
|
for (int i=0; i<8; i++) {
|
||||||
|
if (echoFilter[i]<0 && snesFilterHex) {
|
||||||
|
actualData[i]=echoFilter[i]+256;
|
||||||
|
} else {
|
||||||
|
actualData[i]=echoFilter[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
encodeMMLStr(mmlStringSNES,actualData,8,-1,-1,snesFilterHex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int filterSum=(
|
||||||
|
echoFilter[0]+
|
||||||
|
echoFilter[1]+
|
||||||
|
echoFilter[2]+
|
||||||
|
echoFilter[3]+
|
||||||
|
echoFilter[4]+
|
||||||
|
echoFilter[5]+
|
||||||
|
echoFilter[6]+
|
||||||
|
echoFilter[7]
|
||||||
|
);
|
||||||
|
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text,(filterSum<-128 || filterSum>127)?uiColors[GUI_COLOR_LOGLEVEL_WARNING]:uiColors[GUI_COLOR_TEXT]);
|
||||||
|
ImGui::Text("sum: %d",filterSum);
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
|
||||||
if (altered) {
|
if (altered) {
|
||||||
e->lockSave([&]() {
|
e->lockSave([&]() {
|
||||||
flags.set("volScaleL",127-vsL);
|
flags.set("volScaleL",127-vsL);
|
||||||
|
|
Loading…
Reference in a new issue