| 1 |
/** |
| 2 |
* Furnace Tracker - multi-system chiptune tracker |
| 3 |
* Copyright (C) 2021-2025 tildearrow and contributors |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 2 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License along |
| 16 |
* with this program; if not, write to the Free Software Foundation, Inc., |
| 17 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 |
*/ |
| 19 |
|
| 20 |
#include "gui.h" |
| 21 |
#include "guiConst.h" |
| 22 |
#include "../fileutils.h" |
| 23 |
#include "misc/cpp/imgui_stdlib.h" |
| 24 |
#include <imgui.h> |
| 25 |
|
| 26 |
void FurnaceGUI::drawExportAudio(bool onWindow) { |
| 27 |
exitDisabledTimer=1; |
| 28 |
|
| 29 |
ImGui::Text(_("Export type:")); |
| 30 |
|
| 31 |
ImGui::Indent(); |
| 32 |
if (ImGui::RadioButton(_("one file"),audioExportOptions.mode==DIV_EXPORT_MODE_ONE)) { |
| 33 |
audioExportOptions.mode=DIV_EXPORT_MODE_ONE; |
| 34 |
} |
| 35 |
if (ImGui::RadioButton(_("multiple files (one per chip)"),audioExportOptions.mode==DIV_EXPORT_MODE_MANY_SYS)) { |
| 36 |
audioExportOptions.mode=DIV_EXPORT_MODE_MANY_SYS; |
| 37 |
} |
| 38 |
if (ImGui::RadioButton(_("multiple files (one per channel)"),audioExportOptions.mode==DIV_EXPORT_MODE_MANY_CHAN)) { |
| 39 |
audioExportOptions.mode=DIV_EXPORT_MODE_MANY_CHAN; |
| 40 |
} |
| 41 |
ImGui::Unindent(); |
| 42 |
|
| 43 |
if (audioExportOptions.mode!=DIV_EXPORT_MODE_MANY_SYS) { |
| 44 |
ImGui::Text(_("Bit depth:")); |
| 45 |
ImGui::Indent(); |
| 46 |
if (ImGui::RadioButton(_("16-bit integer"),audioExportOptions.format==DIV_EXPORT_FORMAT_S16)) { |
| 47 |
audioExportOptions.format=DIV_EXPORT_FORMAT_S16; |
| 48 |
} |
| 49 |
if (ImGui::RadioButton(_("32-bit float"),audioExportOptions.format==DIV_EXPORT_FORMAT_F32)) { |
| 50 |
audioExportOptions.format=DIV_EXPORT_FORMAT_F32; |
| 51 |
} |
| 52 |
ImGui::Unindent(); |
| 53 |
} |
| 54 |
|
| 55 |
if (ImGui::InputInt(_("Sample rate"),&audioExportOptions.sampleRate,100,10000)) { |
| 56 |
if (audioExportOptions.sampleRate<8000) audioExportOptions.sampleRate=8000; |
| 57 |
if (audioExportOptions.sampleRate>384000) audioExportOptions.sampleRate=384000; |
| 58 |
} |
| 59 |
|
| 60 |
if (audioExportOptions.mode!=DIV_EXPORT_MODE_MANY_SYS) { |
| 61 |
if (ImGui::InputInt(_("Channels in file"),&audioExportOptions.chans,1,1)) { |
| 62 |
if (audioExportOptions.chans<1) audioExportOptions.chans=1; |
| 63 |
if (audioExportOptions.chans>16) audioExportOptions.chans=16; |
| 64 |
} |
| 65 |
} |
| 66 |
|
| 67 |
if (ImGui::InputInt(_("Loops"),&audioExportOptions.loops,1,2)) { |
| 68 |
if (audioExportOptions.loops<0) audioExportOptions.loops=0; |
| 69 |
} |
| 70 |
if (ImGui::InputDouble(_("Fade out (seconds)"),&audioExportOptions.fadeOut,1.0,2.0,"%.1f")) { |
| 71 |
if (audioExportOptions.fadeOut<0.0) audioExportOptions.fadeOut=0.0; |
| 72 |
} |
| 73 |
|
| 74 |
bool isOneOn=false; |
| 75 |
if (audioExportOptions.mode==DIV_EXPORT_MODE_MANY_CHAN) { |
| 76 |
ImGui::Text(_("Channels to export:")); |
| 77 |
ImGui::SameLine(); |
| 78 |
if (ImGui::SmallButton(_("All"))) { |
| 79 |
for (int i=0; i<DIV_MAX_CHANS; i++) { |
| 80 |
audioExportOptions.channelMask[i]=true; |
| 81 |
} |
| 82 |
} |
| 83 |
ImGui::SameLine(); |
| 84 |
if (ImGui::SmallButton(_("None"))) { |
| 85 |
for (int i=0; i<DIV_MAX_CHANS; i++) { |
| 86 |
audioExportOptions.channelMask[i]=false; |
| 87 |
} |
| 88 |
} |
| 89 |
ImGui::SameLine(); |
| 90 |
if (ImGui::SmallButton(_("Shown in pattern"))) { |
| 91 |
for (int i=0; i<DIV_MAX_CHANS; i++) { |
| 92 |
audioExportOptions.channelMask[i]=e->curSubSong->chanShow[i]; |
| 93 |
} |
| 94 |
} |
| 95 |
ImGui::SameLine(); |
| 96 |
if (ImGui::SmallButton(_("Shown in oscilloscope"))) { |
| 97 |
for (int i=0; i<DIV_MAX_CHANS; i++) { |
| 98 |
audioExportOptions.channelMask[i]=e->curSubSong->chanShowChanOsc[i]; |
| 99 |
} |
| 100 |
} |
| 101 |
ImGui::SameLine(); |
| 102 |
if (ImGui::SmallButton(_("Invert"))) { |
| 103 |
for (int i=0; i<DIV_MAX_CHANS; i++) { |
| 104 |
audioExportOptions.channelMask[i]=!audioExportOptions.channelMask[i]; |
| 105 |
} |
| 106 |
} |
| 107 |
|
| 108 |
if (ImGui::BeginChild("Channel Selection",ImVec2(0,200.0f*dpiScale))) { |
| 109 |
for (int i=0; i<e->getTotalChannelCount(); i++) { |
| 110 |
String name=fmt::sprintf("%d. %s##_CE%d",i+1,e->getChannelName(i),i); |
| 111 |
ImGui::Checkbox(name.c_str(),&audioExportOptions.channelMask[i]); |
| 112 |
if (audioExportOptions.channelMask[i]) isOneOn=true; |
| 113 |
} |
| 114 |
} |
| 115 |
ImGui::EndChild(); |
| 116 |
} else { |
| 117 |
isOneOn=true; |
| 118 |
} |
| 119 |
|
| 120 |
if (onWindow) { |
| 121 |
ImGui::Separator(); |
| 122 |
if (ImGui::Button(_("Cancel"),ImVec2(200.0f*dpiScale,0))) ImGui::CloseCurrentPopup(); |
| 123 |
ImGui::SameLine(); |
| 124 |
} |
| 125 |
|
| 126 |
if (isOneOn) { |
| 127 |
if (ImGui::Button(_("Export"),ImVec2(200.0f*dpiScale,0))) { |
| 128 |
switch (audioExportOptions.mode) { |
| 129 |
case DIV_EXPORT_MODE_ONE: |
| 130 |
openFileDialog(GUI_FILE_EXPORT_AUDIO_ONE); |
| 131 |
break; |
| 132 |
case DIV_EXPORT_MODE_MANY_SYS: |
| 133 |
openFileDialog(GUI_FILE_EXPORT_AUDIO_PER_SYS); |
| 134 |
break; |
| 135 |
case DIV_EXPORT_MODE_MANY_CHAN: |
| 136 |
openFileDialog(GUI_FILE_EXPORT_AUDIO_PER_CHANNEL); |
| 137 |
break; |
| 138 |
} |
| 139 |
ImGui::CloseCurrentPopup(); |
| 140 |
} |
| 141 |
} else { |
| 142 |
ImGui::Text(_("select at least one channel")); |
| 143 |
} |
| 144 |
} |
| 145 |
|
| 146 |
void FurnaceGUI::drawExportVGM(bool onWindow) { |
| 147 |
exitDisabledTimer=1; |
| 148 |
|
| 149 |
ImGui::Text(_("settings:")); |
| 150 |
if (ImGui::BeginCombo(_("format version"),fmt::sprintf("%d.%.2x",vgmExportVersion>>8,vgmExportVersion&0xff).c_str())) { |
| 151 |
for (int i=0; i<7; i++) { |
| 152 |
if (ImGui::Selectable(fmt::sprintf("%d.%.2x",vgmVersions[i]>>8,vgmVersions[i]&0xff).c_str(),vgmExportVersion==vgmVersions[i])) { |
| 153 |
vgmExportVersion=vgmVersions[i]; |
| 154 |
} |
| 155 |
} |
| 156 |
ImGui::EndCombo(); |
| 157 |
} |
| 158 |
ImGui::Checkbox(_("loop"),&vgmExportLoop); |
| 159 |
if (vgmExportLoop && e->song.loopModality==2) { |
| 160 |
ImGui::Text(_("loop trail:")); |
| 161 |
ImGui::Indent(); |
| 162 |
if (ImGui::RadioButton(_("auto-detect"),vgmExportTrailingTicks==-1)) { |
| 163 |
vgmExportTrailingTicks=-1; |
| 164 |
} |
| 165 |
if (ImGui::RadioButton(_("add one loop"),vgmExportTrailingTicks==-2)) { |
| 166 |
vgmExportTrailingTicks=-2; |
| 167 |
} |
| 168 |
if (ImGui::RadioButton(_("custom"),vgmExportTrailingTicks>=0)) { |
| 169 |
vgmExportTrailingTicks=0; |
| 170 |
} |
| 171 |
if (vgmExportTrailingTicks>=0) { |
| 172 |
ImGui::SameLine(); |
| 173 |
if (ImGui::InputInt("##TrailTicks",&vgmExportTrailingTicks,1,100)) { |
| 174 |
if (vgmExportTrailingTicks<0) vgmExportTrailingTicks=0; |
| 175 |
} |
| 176 |
} |
| 177 |
ImGui::Unindent(); |
| 178 |
} |
| 179 |
ImGui::Checkbox(_("add pattern change hints"),&vgmExportPatternHints); |
| 180 |
if (ImGui::IsItemHovered()) { |
| 181 |
ImGui::SetTooltip(_( |
| 182 |
"inserts data blocks on pattern changes.\n" |
| 183 |
"useful if you are writing a playback routine.\n\n" |
| 184 |
|
| 185 |
"the format of a pattern change data block is:\n" |
| 186 |
"67 66 FE ll ll ll ll 01 oo rr pp pp pp ...\n" |
| 187 |
"- ll: length, a 32-bit little-endian number\n" |
| 188 |
"- oo: order\n" |
| 189 |
"- rr: initial row (a 0Dxx effect is able to select a different row)\n" |
| 190 |
"- pp: pattern index (one per channel)\n\n" |
| 191 |
|
| 192 |
"pattern indexes are ordered as they appear in the song." |
| 193 |
)); |
| 194 |
} |
| 195 |
ImGui::Checkbox(_("direct stream mode"),&vgmExportDirectStream); |
| 196 |
if (ImGui::IsItemHovered()) { |
| 197 |
ImGui::SetTooltip(_( |
| 198 |
"required for DualPCM and MSM6258 export.\n\n" |
| 199 |
"allows for volume/direction changes when playing samples,\n" |
| 200 |
"at the cost of a massive increase in file size." |
| 201 |
)); |
| 202 |
} |
| 203 |
ImGui::Text(_("chips to export:")); |
| 204 |
bool hasOneAtLeast=false; |
| 205 |
bool hasNES=false; |
| 206 |
for (int i=0; i<e->song.systemLen; i++) { |
| 207 |
int minVersion=e->minVGMVersion(e->song.system[i]); |
| 208 |
if (e->song.system[i]==DIV_SYSTEM_NES) hasNES=true; |
| 209 |
ImGui::BeginDisabled(minVersion>vgmExportVersion || minVersion==0); |
| 210 |
ImGui::Checkbox(fmt::sprintf("%d. %s##_SYSV%d",i+1,getSystemName(e->song.system[i]),i).c_str(),&willExport[i]); |
| 211 |
ImGui::EndDisabled(); |
| 212 |
if (minVersion>vgmExportVersion) { |
| 213 |
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { |
| 214 |
ImGui::SetTooltip(_("this chip is only available in VGM %d.%.2x and higher!"),minVersion>>8,minVersion&0xff); |
| 215 |
} |
| 216 |
} else if (minVersion==0) { |
| 217 |
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { |
| 218 |
ImGui::SetTooltip(_("this chip is not supported by the VGM format!")); |
| 219 |
} |
| 220 |
} else { |
| 221 |
if (willExport[i]) hasOneAtLeast=true; |
| 222 |
} |
| 223 |
} |
| 224 |
ImGui::Text(_("select the chip you wish to export, but only up to %d of each type."),(vgmExportVersion>=0x151)?2:1); |
| 225 |
|
| 226 |
if (hasNES) { |
| 227 |
ImGui::Text(_("NES DPCM bank switch method:")); |
| 228 |
if (ImGui::RadioButton(_("data blocks"),!vgmExportDPCM07)) { |
| 229 |
vgmExportDPCM07=false; |
| 230 |
} |
| 231 |
if (ImGui::IsItemHovered()) { |
| 232 |
ImGui::SetTooltip(_("67 66 C2 - writes a new data block on each bank switch.\nmay result in bigger files but is compatible with all players.")); |
| 233 |
} |
| 234 |
if (ImGui::RadioButton(_("RAM write commands"),vgmExportDPCM07)) { |
| 235 |
vgmExportDPCM07=true; |
| 236 |
} |
| 237 |
if (ImGui::IsItemHovered()) { |
| 238 |
ImGui::SetTooltip(_("67 66 07 - uses RAM write commands (68) to switch banks.\nnot all VGM players support this!")); |
| 239 |
} |
| 240 |
} |
| 241 |
|
| 242 |
ImGui::Text(_("speed drift compensation:")); |
| 243 |
if (ImGui::RadioButton(_("none"),vgmExportCorrectedRate==44100)) { |
| 244 |
vgmExportCorrectedRate=44100; |
| 245 |
} |
| 246 |
// as tested on a Model 1 Genesis (VA6, USA): |
| 247 |
// 0.97841613336995507871 slower, 1.02206000687632131440 longer |
| 248 |
if (ImGui::RadioButton(_("DeadFish VgmPlay (1.02×)"),vgmExportCorrectedRate==43148)) { |
| 249 |
vgmExportCorrectedRate=43148; |
| 250 |
} |
| 251 |
|
| 252 |
if (hasOneAtLeast) { |
| 253 |
if (onWindow) { |
| 254 |
ImGui::Separator(); |
| 255 |
if (ImGui::Button(_("Cancel"),ImVec2(200.0f*dpiScale,0))) ImGui::CloseCurrentPopup(); |
| 256 |
ImGui::SameLine(); |
| 257 |
} |
| 258 |
if (ImGui::Button(_("Export"),ImVec2(200.0f*dpiScale,0))) { |
| 259 |
openFileDialog(GUI_FILE_EXPORT_VGM); |
| 260 |
ImGui::CloseCurrentPopup(); |
| 261 |
} |
| 262 |
} else { |
| 263 |
ImGui::Text(_("nothing to export")); |
| 264 |
if (onWindow) { |
| 265 |
ImGui::Separator(); |
| 266 |
if (ImGui::Button(_("Cancel"),ImVec2(400.0f*dpiScale,0))) ImGui::CloseCurrentPopup(); |
| 267 |
} |
| 268 |
} |
| 269 |
} |
| 270 |
|
| 271 |
void FurnaceGUI::drawExportROM(bool onWindow) { |
| 272 |
exitDisabledTimer=1; |
| 273 |
|
| 274 |
const DivROMExportDef* def=e->getROMExportDef(romTarget); |
| 275 |
|
| 276 |
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); |
| 277 |
if (ImGui::BeginCombo("##ROMTarget",def==NULL?"<select one>":def->name)) { |
| 278 |
for (int i=0; i<DIV_ROM_MAX; i++) { |
| 279 |
const DivROMExportDef* newDef=e->getROMExportDef((DivROMExportOptions)i); |
| 280 |
if (newDef!=NULL) { |
| 281 |
if (romExportAvail[i]) { |
| 282 |
if (ImGui::Selectable(newDef->name)) { |
| 283 |
romTarget=(DivROMExportOptions)i; |
| 284 |
romMultiFile=newDef->multiOutput; |
| 285 |
romConfig=DivConfig(); |
| 286 |
if (newDef->fileExt==NULL) { |
| 287 |
romFilterName=""; |
| 288 |
romFilterExt=""; |
| 289 |
} else { |
| 290 |
romFilterName=newDef->fileType; |
| 291 |
romFilterExt=newDef->fileExt; |
| 292 |
} |
| 293 |
} |
| 294 |
} |
| 295 |
} |
| 296 |
} |
| 297 |
ImGui::EndCombo(); |
| 298 |
} |
| 299 |
|
| 300 |
if (def!=NULL) { |
| 301 |
ImGui::Text("by %s",def->author); |
| 302 |
|
| 303 |
ImGui::TextWrapped("%s",def->description); |
| 304 |
} |
| 305 |
|
| 306 |
ImGui::Separator(); |
| 307 |
|
| 308 |
bool altered=false; |
| 309 |
|
| 310 |
switch (romTarget) { |
| 311 |
case DIV_ROM_TIUNA: { |
| 312 |
String asmBaseLabel=romConfig.getString("baseLabel","twin"); |
| 313 |
int firstBankSize=romConfig.getInt("firstBankSize",1024); |
| 314 |
int otherBankSize=romConfig.getInt("otherBankSize",4096-48); |
| 315 |
int sysToExport=romConfig.getInt("sysToExport",-1); |
| 316 |
|
| 317 |
// TODO; validate label |
| 318 |
if (ImGui::InputText(_("base song label name"),&asmBaseLabel)) { |
| 319 |
altered=true; |
| 320 |
} |
| 321 |
if (ImGui::InputInt(_("max size in first bank"),&firstBankSize,1,100)) { |
| 322 |
if (firstBankSize<0) firstBankSize=0; |
| 323 |
if (firstBankSize>4096) firstBankSize=4096; |
| 324 |
altered=true; |
| 325 |
} |
| 326 |
if (ImGui::InputInt(_("max size in other banks"),&otherBankSize,1,100)) { |
| 327 |
if (otherBankSize<16) otherBankSize=16; |
| 328 |
if (otherBankSize>4096) otherBankSize=4096; |
| 329 |
altered=true; |
| 330 |
} |
| 331 |
|
| 332 |
ImGui::Text(_("chip to export:")); |
| 333 |
for (int i=0; i<e->song.systemLen; i++) { |
| 334 |
DivSystem sys=e->song.system[i]; |
| 335 |
bool isTIA=(sys==DIV_SYSTEM_TIA); |
| 336 |
ImGui::BeginDisabled(!isTIA); |
| 337 |
if (ImGui::RadioButton(fmt::sprintf("%d. %s##_SYSV%d",i+1,getSystemName(e->song.system[i]),i).c_str(),sysToExport==i)) { |
| 338 |
sysToExport=i; |
| 339 |
altered=true; |
| 340 |
} |
| 341 |
ImGui::EndDisabled(); |
| 342 |
} |
| 343 |
if (altered) { |
| 344 |
romConfig.set("baseLabel",asmBaseLabel); |
| 345 |
romConfig.set("firstBankSize",firstBankSize); |
| 346 |
romConfig.set("otherBankSize",otherBankSize); |
| 347 |
romConfig.set("sysToExport",sysToExport); |
| 348 |
} |
| 349 |
break; |
| 350 |
} |
| 351 |
case DIV_ROM_ZSM: { |
| 352 |
int zsmExportTickRate=romConfig.getInt("zsmrate",60); |
| 353 |
bool zsmExportLoop=romConfig.getBool("loop",true); |
| 354 |
bool zsmExportOptimize=romConfig.getBool("optimize",true); |
| 355 |
|
| 356 |
if (ImGui::InputInt(_("Tick Rate (Hz)"),&zsmExportTickRate,1,2)) { |
| 357 |
if (zsmExportTickRate<1) zsmExportTickRate=1; |
| 358 |
if (zsmExportTickRate>44100) zsmExportTickRate=44100; |
| 359 |
altered=true; |
| 360 |
} |
| 361 |
if (ImGui::Checkbox(_("loop"),&zsmExportLoop)) { |
| 362 |
altered=true; |
| 363 |
} |
| 364 |
if (ImGui::Checkbox(_("optimize size"),&zsmExportOptimize)) { |
| 365 |
altered=true; |
| 366 |
} |
| 367 |
if (altered) { |
| 368 |
romConfig.set("zsmrate",zsmExportTickRate); |
| 369 |
romConfig.set("loop",zsmExportLoop); |
| 370 |
romConfig.set("optimize",zsmExportOptimize); |
| 371 |
} |
| 372 |
break; |
| 373 |
} |
| 374 |
case DIV_ROM_GRUB: { |
| 375 |
bool grubExportBin=romConfig.getBool("exportBin",false); |
| 376 |
if (ImGui::Checkbox(_("export binary file"),&grubExportBin)) { |
| 377 |
altered=true; |
| 378 |
} |
| 379 |
if (altered) { |
| 380 |
romConfig.set("exportBin",grubExportBin); |
| 381 |
} |
| 382 |
break; |
| 383 |
} |
| 384 |
case DIV_ROM_ABSTRACT: |
| 385 |
ImGui::TextWrapped("%s",_("select a target from the menu at the top of this dialog.")); |
| 386 |
break; |
| 387 |
default: |
| 388 |
ImGui::TextWrapped("%s",_("this export method doesn't offer any options.")); |
| 389 |
break; |
| 390 |
} |
| 391 |
/* |
| 392 |
*/ |
| 393 |
|
| 394 |
if (onWindow) { |
| 395 |
ImGui::Separator(); |
| 396 |
if (ImGui::Button(_("Cancel"),ImVec2(200.0f*dpiScale,0))) ImGui::CloseCurrentPopup(); |
| 397 |
ImGui::SameLine(); |
| 398 |
} |
| 399 |
if (ImGui::Button(_("Export"),ImVec2(200.0f*dpiScale,0))) { |
| 400 |
openFileDialog(GUI_FILE_EXPORT_ROM); |
| 401 |
ImGui::CloseCurrentPopup(); |
| 402 |
} |
| 403 |
} |
| 404 |
|
| 405 |
void FurnaceGUI::drawExportText(bool onWindow) { |
| 406 |
exitDisabledTimer=1; |
| 407 |
|
| 408 |
ImGui::Text( |
| 409 |
_("this option exports the song to a text file.\n") |
| 410 |
); |
| 411 |
if (onWindow) { |
| 412 |
ImGui::Separator(); |
| 413 |
if (ImGui::Button(_("Cancel"),ImVec2(200.0f*dpiScale,0))) ImGui::CloseCurrentPopup(); |
| 414 |
ImGui::SameLine(); |
| 415 |
} |
| 416 |
if (ImGui::Button(_("Export"),ImVec2(200.0f*dpiScale,0))) { |
| 417 |
openFileDialog(GUI_FILE_EXPORT_TEXT); |
| 418 |
ImGui::CloseCurrentPopup(); |
| 419 |
} |
| 420 |
} |
| 421 |
|
| 422 |
void FurnaceGUI::commandExportOptions() { |
| 423 |
ImGui::Checkbox(_("Long pointers (use for 64K+ size streams)"),&csExportOptions.longPointers); |
| 424 |
ImGui::Checkbox(_("Big endian mode"),&csExportOptions.bigEndian); |
| 425 |
ImGui::Separator(); |
| 426 |
ImGui::Checkbox(_("Don't optimize command calls"),&csExportOptions.noCmdCallOpt); |
| 427 |
ImGui::Checkbox(_("Don't condense delays"),&csExportOptions.noDelayCondense); |
| 428 |
ImGui::Checkbox(_("Don't perform sub-block search"),&csExportOptions.noSubBlock); |
| 429 |
} |
| 430 |
|
| 431 |
void FurnaceGUI::drawExportCommand(bool onWindow) { |
| 432 |
exitDisabledTimer=1; |
| 433 |
|
| 434 |
ImGui::Text(_( |
| 435 |
"this option exports a binary file which\n" |
| 436 |
"contains a dump of the internal command stream\n" |
| 437 |
"produced when playing the song.\n\n" |
| 438 |
|
| 439 |
"technical/development use only!" |
| 440 |
)); |
| 441 |
|
| 442 |
commandExportOptions(); |
| 443 |
|
| 444 |
if (onWindow) { |
| 445 |
ImGui::Separator(); |
| 446 |
if (ImGui::Button(_("Cancel"),ImVec2(200.0f*dpiScale,0))) ImGui::CloseCurrentPopup(); |
| 447 |
ImGui::SameLine(); |
| 448 |
} |
| 449 |
if (ImGui::Button(_("Export"),ImVec2(200.0f*dpiScale,0))) { |
| 450 |
openFileDialog(GUI_FILE_EXPORT_CMDSTREAM); |
| 451 |
ImGui::CloseCurrentPopup(); |
| 452 |
} |
| 453 |
} |
| 454 |
|
| 455 |
void FurnaceGUI::drawExportDMF(bool onWindow) { |
| 456 |
exitDisabledTimer=1; |
| 457 |
|
| 458 |
ImGui::Text(_( |
| 459 |
"export in DefleMask module format.\n" |
| 460 |
"only do it if you really, really need to, or are downgrading an existing .dmf." |
| 461 |
)); |
| 462 |
|
| 463 |
ImGui::Text(_("format version:")); |
| 464 |
ImGui::RadioButton(_("1.1.3 and higher"),&dmfExportVersion,0); |
| 465 |
ImGui::RadioButton(_("1.0/legacy (0.12)"),&dmfExportVersion,1); |
| 466 |
|
| 467 |
if (onWindow) { |
| 468 |
ImGui::Separator(); |
| 469 |
if (ImGui::Button(_("Cancel"),ImVec2(200.0f*dpiScale,0))) ImGui::CloseCurrentPopup(); |
| 470 |
ImGui::SameLine(); |
| 471 |
} |
| 472 |
if (ImGui::Button(_("Export"),ImVec2(200.0f*dpiScale,0))) { |
| 473 |
if (dmfExportVersion==1) { |
| 474 |
openFileDialog(GUI_FILE_SAVE_DMF_LEGACY); |
| 475 |
} else { |
| 476 |
openFileDialog(GUI_FILE_SAVE_DMF); |
| 477 |
} |
| 478 |
ImGui::CloseCurrentPopup(); |
| 479 |
} |
| 480 |
} |
| 481 |
|
| 482 |
void FurnaceGUI::drawExport() { |
| 483 |
if (settings.exportOptionsLayout==1 || curExportType==GUI_EXPORT_NONE) { |
| 484 |
if (ImGui::BeginTabBar("ExportTypes")) { |
| 485 |
if (ImGui::BeginTabItem(_("Audio"))) { |
| 486 |
drawExportAudio(true); |
| 487 |
ImGui::EndTabItem(); |
| 488 |
} |
| 489 |
if (ImGui::BeginTabItem(_("VGM"))) { |
| 490 |
drawExportVGM(true); |
| 491 |
ImGui::EndTabItem(); |
| 492 |
} |
| 493 |
if (romExportExists) { |
| 494 |
if (ImGui::BeginTabItem(_("ROM"))) { |
| 495 |
drawExportROM(true); |
| 496 |
ImGui::EndTabItem(); |
| 497 |
} |
| 498 |
} |
| 499 |
if (ImGui::BeginTabItem(_("Text"))) { |
| 500 |
drawExportText(true); |
| 501 |
ImGui::EndTabItem(); |
| 502 |
} |
| 503 |
if (ImGui::BeginTabItem(_("Command Stream"))) { |
| 504 |
drawExportCommand(true); |
| 505 |
ImGui::EndTabItem(); |
| 506 |
} |
| 507 |
if (ImGui::BeginTabItem(_("DMF"))) { |
| 508 |
drawExportDMF(true); |
| 509 |
ImGui::EndTabItem(); |
| 510 |
} |
| 511 |
ImGui::EndTabBar(); |
| 512 |
} |
| 513 |
} else switch (curExportType) { |
| 514 |
case GUI_EXPORT_AUDIO: |
| 515 |
drawExportAudio(true); |
| 516 |
break; |
| 517 |
case GUI_EXPORT_VGM: |
| 518 |
drawExportVGM(true); |
| 519 |
break; |
| 520 |
case GUI_EXPORT_ROM: |
| 521 |
drawExportROM(true); |
| 522 |
break; |
| 523 |
case GUI_EXPORT_TEXT: |
| 524 |
drawExportText(true); |
| 525 |
break; |
| 526 |
case GUI_EXPORT_CMD_STREAM: |
| 527 |
drawExportCommand(true); |
| 528 |
break; |
| 529 |
case GUI_EXPORT_DMF: |
| 530 |
drawExportDMF(true); |
| 531 |
break; |
| 532 |
default: |
| 533 |
ImGui::Text(_("congratulations! you've unlocked a secret panel.")); |
| 534 |
if (ImGui::Button(_("Toggle hidden systems"))) { |
| 535 |
settings.hiddenSystems=!settings.hiddenSystems; |
| 536 |
ImGui::CloseCurrentPopup(); |
| 537 |
} |
| 538 |
if (ImGui::Button(_("Toggle all instrument types"))) { |
| 539 |
settings.displayAllInsTypes=!settings.displayAllInsTypes; |
| 540 |
ImGui::CloseCurrentPopup(); |
| 541 |
} |
| 542 |
if (ImGui::Button(_("Set pitch linearity to Partial"))) { |
| 543 |
e->song.linearPitch=1; |
| 544 |
ImGui::CloseCurrentPopup(); |
| 545 |
} |
| 546 |
if (ImGui::Button(_("Set fat to max"))) { |
| 547 |
ImGuiStyle& sty=ImGui::GetStyle(); |
| 548 |
sty.FramePadding=ImVec2(20.0f*dpiScale,20.0f*dpiScale); |
| 549 |
sty.ItemSpacing=ImVec2(10.0f*dpiScale,10.0f*dpiScale); |
| 550 |
sty.ItemInnerSpacing=ImVec2(10.0f*dpiScale,10.0f*dpiScale); |
| 551 |
ImGui::CloseCurrentPopup(); |
| 552 |
} |
| 553 |
if (ImGui::Button(_("Set muscle and fat to zero"))) { |
| 554 |
ImGuiStyle& sty=ImGui::GetStyle(); |
| 555 |
sty.FramePadding=ImVec2(0,0); |
| 556 |
sty.ItemSpacing=ImVec2(0,0); |
| 557 |
sty.ItemInnerSpacing=ImVec2(0,0); |
| 558 |
ImGui::CloseCurrentPopup(); |
| 559 |
} |
| 560 |
if (ImGui::Button(_("Tell tildearrow this must be a mistake"))) { |
| 561 |
showError(_("yeah, it's a bug. write a bug report in the GitHub page and tell me how did you get here.")); |
| 562 |
ImGui::CloseCurrentPopup(); |
| 563 |
} |
| 564 |
break; |
| 565 |
} |
| 566 |
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) { |
| 567 |
ImGui::CloseCurrentPopup(); |
| 568 |
} |
| 569 |
} |