GUI: separate text/binary command stream buttons
This commit is contained in:
parent
d67be98468
commit
24c39c7819
|
@ -516,7 +516,13 @@ void FurnaceGUI::drawMobileControls() {
|
||||||
openFileDialog(GUI_FILE_EXPORT_VGM);
|
openFileDialog(GUI_FILE_EXPORT_VGM);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Button("CmdStream");
|
if (ImGui::Button("CmdStream")) {
|
||||||
|
openFileDialog(GUI_FILE_EXPORT_CMDSTREAM_BINARY);
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("CmdStream Text")) {
|
||||||
|
openFileDialog(GUI_FILE_EXPORT_CMDSTREAM);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
|
|
|
@ -1737,9 +1737,18 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
||||||
if (!dirExists(workingDirROMExport)) workingDirROMExport=getHomeDir();
|
if (!dirExists(workingDirROMExport)) workingDirROMExport=getHomeDir();
|
||||||
hasOpened=fileDialog->openSave(
|
hasOpened=fileDialog->openSave(
|
||||||
"Export Command Stream",
|
"Export Command Stream",
|
||||||
{"text file", "*.txt",
|
{"text file", "*.txt"},
|
||||||
"binary file", "*.bin"},
|
"text file{.txt}",
|
||||||
"text file{.txt},binary file{.bin}",
|
workingDirROMExport,
|
||||||
|
dpiScale
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case GUI_FILE_EXPORT_CMDSTREAM_BINARY:
|
||||||
|
if (!dirExists(workingDirROMExport)) workingDirROMExport=getHomeDir();
|
||||||
|
hasOpened=fileDialog->openSave(
|
||||||
|
"Export Command Stream",
|
||||||
|
{"binary file", "*.bin"},
|
||||||
|
"binary file{.bin}",
|
||||||
workingDirROMExport,
|
workingDirROMExport,
|
||||||
dpiScale
|
dpiScale
|
||||||
);
|
);
|
||||||
|
@ -3727,7 +3736,10 @@ bool FurnaceGUI::loop() {
|
||||||
|
|
||||||
"technical/development use only!"
|
"technical/development use only!"
|
||||||
);
|
);
|
||||||
if (ImGui::Button("export")) {
|
if (ImGui::Button("export (binary)")) {
|
||||||
|
openFileDialog(GUI_FILE_EXPORT_CMDSTREAM_BINARY);
|
||||||
|
}
|
||||||
|
if (ImGui::Button("export (text)")) {
|
||||||
openFileDialog(GUI_FILE_EXPORT_CMDSTREAM);
|
openFileDialog(GUI_FILE_EXPORT_CMDSTREAM);
|
||||||
}
|
}
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
|
@ -4205,6 +4217,7 @@ bool FurnaceGUI::loop() {
|
||||||
break;
|
break;
|
||||||
case GUI_FILE_EXPORT_ROM:
|
case GUI_FILE_EXPORT_ROM:
|
||||||
case GUI_FILE_EXPORT_CMDSTREAM:
|
case GUI_FILE_EXPORT_CMDSTREAM:
|
||||||
|
case GUI_FILE_EXPORT_CMDSTREAM_BINARY:
|
||||||
workingDirROMExport=fileDialog->getPath()+DIR_SEPARATOR_STR;
|
workingDirROMExport=fileDialog->getPath()+DIR_SEPARATOR_STR;
|
||||||
break;
|
break;
|
||||||
case GUI_FILE_LOAD_MAIN_FONT:
|
case GUI_FILE_LOAD_MAIN_FONT:
|
||||||
|
@ -4292,9 +4305,10 @@ bool FurnaceGUI::loop() {
|
||||||
checkExtension(".zsm");
|
checkExtension(".zsm");
|
||||||
}
|
}
|
||||||
if (curFileDialog==GUI_FILE_EXPORT_CMDSTREAM) {
|
if (curFileDialog==GUI_FILE_EXPORT_CMDSTREAM) {
|
||||||
// we can't tell whether the user chose .txt or .bin in the system file picker
|
checkExtension(".txt");
|
||||||
const char* fallbackExt=(settings.sysFileDialog || ImGuiFileDialog::Instance()->GetCurrentFilter()=="text file")?".txt":".bin";
|
}
|
||||||
checkExtensionDual(".txt",".bin",fallbackExt);
|
if (curFileDialog==GUI_FILE_EXPORT_CMDSTREAM_BINARY) {
|
||||||
|
checkExtension(".bin");
|
||||||
}
|
}
|
||||||
if (curFileDialog==GUI_FILE_EXPORT_COLORS) {
|
if (curFileDialog==GUI_FILE_EXPORT_COLORS) {
|
||||||
checkExtension(".cfgc");
|
checkExtension(".cfgc");
|
||||||
|
@ -4636,15 +4650,9 @@ bool FurnaceGUI::loop() {
|
||||||
case GUI_FILE_EXPORT_ROM:
|
case GUI_FILE_EXPORT_ROM:
|
||||||
showError("Coming soon!");
|
showError("Coming soon!");
|
||||||
break;
|
break;
|
||||||
case GUI_FILE_EXPORT_CMDSTREAM: {
|
case GUI_FILE_EXPORT_CMDSTREAM:
|
||||||
String lowerCase=fileName;
|
case GUI_FILE_EXPORT_CMDSTREAM_BINARY: {
|
||||||
for (char& i: lowerCase) {
|
bool isBinary=(curFileDialog==GUI_FILE_EXPORT_CMDSTREAM_BINARY);
|
||||||
if (i>='A' && i<='Z') i+='a'-'A';
|
|
||||||
}
|
|
||||||
bool isBinary=true;
|
|
||||||
if ((lowerCase.size()<4 || lowerCase.rfind(".bin")!=lowerCase.size()-4)) {
|
|
||||||
isBinary=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SafeWriter* w=e->saveCommand(isBinary);
|
SafeWriter* w=e->saveCommand(isBinary);
|
||||||
if (w!=NULL) {
|
if (w!=NULL) {
|
||||||
|
|
|
@ -370,6 +370,7 @@ enum FurnaceGUIFileDialogs {
|
||||||
GUI_FILE_EXPORT_VGM,
|
GUI_FILE_EXPORT_VGM,
|
||||||
GUI_FILE_EXPORT_ZSM,
|
GUI_FILE_EXPORT_ZSM,
|
||||||
GUI_FILE_EXPORT_CMDSTREAM,
|
GUI_FILE_EXPORT_CMDSTREAM,
|
||||||
|
GUI_FILE_EXPORT_CMDSTREAM_BINARY,
|
||||||
GUI_FILE_EXPORT_ROM,
|
GUI_FILE_EXPORT_ROM,
|
||||||
GUI_FILE_LOAD_MAIN_FONT,
|
GUI_FILE_LOAD_MAIN_FONT,
|
||||||
GUI_FILE_LOAD_PAT_FONT,
|
GUI_FILE_LOAD_PAT_FONT,
|
||||||
|
|
Loading…
Reference in a new issue