TIA: Add software pitch driver (TIunA) and song data export
This commit is contained in:
parent
7fee9b6f05
commit
85199e5228
11 changed files with 790 additions and 8 deletions
|
|
@ -249,6 +249,56 @@ void FurnaceGUI::drawExportZSM(bool onWindow) {
|
|||
}
|
||||
}
|
||||
|
||||
void FurnaceGUI::drawExportTiuna(bool onWindow) {
|
||||
exitDisabledTimer=1;
|
||||
|
||||
ImGui::Text("this is NOT ROM export! (for now)\nfor use with TIunA driver, outputs asm source.");
|
||||
ImGui::InputText("base song label name", &asmBaseLabel); //TODO validate label
|
||||
if (ImGui::InputInt("max size in first bank",&tiunaFirstBankSize,1,100)) {
|
||||
if (tiunaFirstBankSize<0) tiunaFirstBankSize=0;
|
||||
if (tiunaFirstBankSize>4096) tiunaFirstBankSize=4096;
|
||||
}
|
||||
if (ImGui::InputInt("max size in other banks",&tiunaOtherBankSize,1,100)) {
|
||||
if (tiunaOtherBankSize<16) tiunaOtherBankSize=16;
|
||||
if (tiunaOtherBankSize>4096) tiunaOtherBankSize=4096;
|
||||
}
|
||||
|
||||
ImGui::Text("chips to export:");
|
||||
int selected=0;
|
||||
for (int i=0; i<e->song.systemLen; i++) {
|
||||
DivSystem sys=e->song.system[i];
|
||||
bool isTIA=sys==DIV_SYSTEM_TIA;
|
||||
ImGui::BeginDisabled((!isTIA) || (selected>=1));
|
||||
ImGui::Checkbox(fmt::sprintf("%d. %s##_SYSV%d",i+1,getSystemName(e->song.system[i]),i).c_str(),&willExport[i]);
|
||||
ImGui::EndDisabled();
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
|
||||
if (!isTIA) {
|
||||
ImGui::SetTooltip("this chip is not supported by the file format!");
|
||||
} else if (selected>=1) {
|
||||
ImGui::SetTooltip("only one Atari TIA is supported!");
|
||||
}
|
||||
}
|
||||
if (isTIA && willExport[i]) selected++;
|
||||
}
|
||||
if (selected>0) {
|
||||
if (onWindow) {
|
||||
ImGui::Separator();
|
||||
if (ImGui::Button("Cancel",ImVec2(200.0f*dpiScale,0))) ImGui::CloseCurrentPopup();
|
||||
ImGui::SameLine();
|
||||
}
|
||||
if (ImGui::Button("Export",ImVec2(200.0f*dpiScale,0))) {
|
||||
openFileDialog(GUI_FILE_EXPORT_TIUNA);
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
} else {
|
||||
ImGui::Text("nothing to export");
|
||||
if (onWindow) {
|
||||
ImGui::Separator();
|
||||
if (ImGui::Button("Cancel",ImVec2(400.0f*dpiScale,0))) ImGui::CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FurnaceGUI::drawExportAmigaVal(bool onWindow) {
|
||||
exitDisabledTimer=1;
|
||||
|
||||
|
|
@ -372,6 +422,19 @@ void FurnaceGUI::drawExport() {
|
|||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
bool hasTiunaCompat=false;
|
||||
for (int i=0; i<e->song.systemLen; i++) {
|
||||
if (e->song.system[i]==DIV_SYSTEM_TIA) {
|
||||
hasTiunaCompat=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hasTiunaCompat) {
|
||||
if (ImGui::BeginTabItem("TIunA")) {
|
||||
drawExportTiuna(true);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
int numAmiga=0;
|
||||
for (int i=0; i<e->song.systemLen; i++) {
|
||||
if (e->song.system[i]==DIV_SYSTEM_AMIGA) numAmiga++;
|
||||
|
|
@ -406,6 +469,9 @@ void FurnaceGUI::drawExport() {
|
|||
case GUI_EXPORT_ZSM:
|
||||
drawExportZSM(true);
|
||||
break;
|
||||
case GUI_EXPORT_TIUNA:
|
||||
drawExportTiuna(true);
|
||||
break;
|
||||
case GUI_EXPORT_AMIGA_VAL:
|
||||
drawExportAmigaVal(true);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1926,6 +1926,15 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
|||
(settings.autoFillSave)?shortName:""
|
||||
);
|
||||
break;
|
||||
case GUI_FILE_EXPORT_TIUNA:
|
||||
if (!dirExists(workingDirTiunaExport)) workingDirTiunaExport=getHomeDir();
|
||||
hasOpened=fileDialog->openSave(
|
||||
"Export TIunA",
|
||||
{"assembly files", "*.asm"},
|
||||
workingDirTiunaExport,
|
||||
dpiScale
|
||||
);
|
||||
break;
|
||||
case GUI_FILE_EXPORT_TEXT:
|
||||
if (!dirExists(workingDirROMExport)) workingDirROMExport=getHomeDir();
|
||||
hasOpened=fileDialog->openSave(
|
||||
|
|
@ -4894,6 +4903,9 @@ bool FurnaceGUI::loop() {
|
|||
case GUI_FILE_EXPORT_ZSM:
|
||||
workingDirZSMExport=fileDialog->getPath()+DIR_SEPARATOR_STR;
|
||||
break;
|
||||
case GUI_FILE_EXPORT_TIUNA:
|
||||
workingDirTiunaExport=fileDialog->getPath()+DIR_SEPARATOR_STR;
|
||||
break;
|
||||
case GUI_FILE_EXPORT_ROM:
|
||||
case GUI_FILE_EXPORT_TEXT:
|
||||
case GUI_FILE_EXPORT_CMDSTREAM:
|
||||
|
|
@ -5375,6 +5387,27 @@ bool FurnaceGUI::loop() {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case GUI_FILE_EXPORT_TIUNA: {
|
||||
SafeWriter* w=e->saveTiuna(willExport,asmBaseLabel.c_str(),tiunaFirstBankSize,tiunaOtherBankSize);
|
||||
if (w!=NULL) {
|
||||
FILE* f=ps_fopen(copyOfName.c_str(),"wb");
|
||||
if (f!=NULL) {
|
||||
fwrite(w->getFinalBuf(),1,w->size(),f);
|
||||
fclose(f);
|
||||
pushRecentSys(copyOfName.c_str());
|
||||
} else {
|
||||
showError("could not open file!");
|
||||
}
|
||||
w->finish();
|
||||
delete w;
|
||||
if (!e->getWarnings().empty()) {
|
||||
showWarning(e->getWarnings(),GUI_WARN_GENERIC);
|
||||
}
|
||||
} else {
|
||||
showError(fmt::sprintf("Could not write TIunA! (%s)",e->getLastError()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GUI_FILE_EXPORT_ROM:
|
||||
showError(_("Coming soon!"));
|
||||
break;
|
||||
|
|
@ -7271,6 +7304,7 @@ void FurnaceGUI::syncState() {
|
|||
workingDirAudioExport=e->getConfString("lastDirAudioExport",workingDir);
|
||||
workingDirVGMExport=e->getConfString("lastDirVGMExport",workingDir);
|
||||
workingDirZSMExport=e->getConfString("lastDirZSMExport",workingDir);
|
||||
workingDirTiunaExport=e->getConfString("lastDirTiunaExport",workingDir);
|
||||
workingDirROMExport=e->getConfString("lastDirROMExport",workingDir);
|
||||
workingDirFont=e->getConfString("lastDirFont",workingDir);
|
||||
workingDirColors=e->getConfString("lastDirColors",workingDir);
|
||||
|
|
@ -7430,6 +7464,7 @@ void FurnaceGUI::commitState(DivConfig& conf) {
|
|||
conf.set("lastDirAudioExport",workingDirAudioExport);
|
||||
conf.set("lastDirVGMExport",workingDirVGMExport);
|
||||
conf.set("lastDirZSMExport",workingDirZSMExport);
|
||||
conf.set("lastDirTiunaExport",workingDirTiunaExport);
|
||||
conf.set("lastDirROMExport",workingDirROMExport);
|
||||
conf.set("lastDirFont",workingDirFont);
|
||||
conf.set("lastDirColors",workingDirColors);
|
||||
|
|
@ -7689,6 +7724,9 @@ FurnaceGUI::FurnaceGUI():
|
|||
vgmExportTrailingTicks(-1),
|
||||
drawHalt(10),
|
||||
zsmExportTickRate(60),
|
||||
asmBaseLabel(""),
|
||||
tiunaFirstBankSize(3072),
|
||||
tiunaOtherBankSize(4096-48),
|
||||
macroPointSize(16),
|
||||
waveEditStyle(0),
|
||||
displayInsTypeListMakeInsSample(-1),
|
||||
|
|
|
|||
|
|
@ -591,6 +591,7 @@ enum FurnaceGUIFileDialogs {
|
|||
GUI_FILE_EXPORT_AUDIO_PER_CHANNEL,
|
||||
GUI_FILE_EXPORT_VGM,
|
||||
GUI_FILE_EXPORT_ZSM,
|
||||
GUI_FILE_EXPORT_TIUNA,
|
||||
GUI_FILE_EXPORT_CMDSTREAM,
|
||||
GUI_FILE_EXPORT_TEXT,
|
||||
GUI_FILE_EXPORT_ROM,
|
||||
|
|
@ -643,6 +644,7 @@ enum FurnaceGUIExportTypes {
|
|||
GUI_EXPORT_AUDIO=0,
|
||||
GUI_EXPORT_VGM,
|
||||
GUI_EXPORT_ZSM,
|
||||
GUI_EXPORT_TIUNA,
|
||||
GUI_EXPORT_CMD_STREAM,
|
||||
GUI_EXPORT_AMIGA_VAL,
|
||||
GUI_EXPORT_TEXT,
|
||||
|
|
@ -1581,7 +1583,8 @@ class FurnaceGUI {
|
|||
|
||||
String workingDir, fileName, clipboard, warnString, errorString, lastError, curFileName, nextFile, sysSearchQuery, newSongQuery, paletteQuery;
|
||||
String workingDirSong, workingDirIns, workingDirWave, workingDirSample, workingDirAudioExport;
|
||||
String workingDirVGMExport, workingDirZSMExport, workingDirROMExport, workingDirFont, workingDirColors, workingDirKeybinds;
|
||||
String workingDirVGMExport, workingDirZSMExport, workingDirTiunaExport, workingDirROMExport;
|
||||
String workingDirFont, workingDirColors, workingDirKeybinds;
|
||||
String workingDirLayout, workingDirROM, workingDirTest;
|
||||
String workingDirConfig;
|
||||
String mmlString[32];
|
||||
|
|
@ -1618,6 +1621,9 @@ class FurnaceGUI {
|
|||
int cvHiScore;
|
||||
int drawHalt;
|
||||
int zsmExportTickRate;
|
||||
String asmBaseLabel;
|
||||
int tiunaFirstBankSize;
|
||||
int tiunaOtherBankSize;
|
||||
int macroPointSize;
|
||||
int waveEditStyle;
|
||||
int displayInsTypeListMakeInsSample;
|
||||
|
|
@ -2669,6 +2675,7 @@ class FurnaceGUI {
|
|||
void drawExportAudio(bool onWindow=false);
|
||||
void drawExportVGM(bool onWindow=false);
|
||||
void drawExportZSM(bool onWindow=false);
|
||||
void drawExportTiuna(bool onWindow=false);
|
||||
void drawExportAmigaVal(bool onWindow=false);
|
||||
void drawExportText(bool onWindow=false);
|
||||
void drawExportCommand(bool onWindow=false);
|
||||
|
|
|
|||
|
|
@ -254,12 +254,23 @@ void FurnaceGUI::initSystemPresets() {
|
|||
CH(DIV_SYSTEM_TIA, 1.0f, 0, "")
|
||||
}
|
||||
);
|
||||
SUB_ENTRY(
|
||||
"Atari 2600/7800 (with software pitch driver)", {
|
||||
CH(DIV_SYSTEM_TIA, 1.0f, 0, "softwarePitch=1")
|
||||
}
|
||||
);
|
||||
ENTRY(
|
||||
"Atari 7800 + Ballblazer/Commando", {
|
||||
CH(DIV_SYSTEM_TIA, 1.0f, 0, ""),
|
||||
CH(DIV_SYSTEM_POKEY, 1.0f, 0, "")
|
||||
}
|
||||
);
|
||||
SUB_ENTRY(
|
||||
"Atari 7800 (with software pitch driver) + Ballblazer/Commando", {
|
||||
CH(DIV_SYSTEM_TIA, 1.0f, 0, "softwarePitch=1"),
|
||||
CH(DIV_SYSTEM_POKEY, 1.0f, 0, "")
|
||||
}
|
||||
);
|
||||
ENTRY(
|
||||
"Atari Lynx", {
|
||||
CH(DIV_SYSTEM_LYNX, 1.0f, 0, "")
|
||||
|
|
@ -2978,6 +2989,11 @@ void FurnaceGUI::initSystemPresets() {
|
|||
CH(DIV_SYSTEM_TIA, 1.0f, 0, "")
|
||||
}
|
||||
);
|
||||
SUB_ENTRY(
|
||||
"Atari TIA (with software pitch driver)", {
|
||||
CH(DIV_SYSTEM_TIA, 1.0f, 0, "softwarePitch=1")
|
||||
}
|
||||
);
|
||||
ENTRY(
|
||||
"NES (Ricoh 2A03)", {
|
||||
CH(DIV_SYSTEM_NES, 1.0f, 0, "")
|
||||
|
|
|
|||
|
|
@ -1061,6 +1061,18 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
|
|||
case DIV_SYSTEM_TIA: {
|
||||
bool clockSel=flags.getInt("clockSel",0);
|
||||
int mixingType=flags.getInt("mixingType",0);
|
||||
bool softwarePitch=flags.getBool("softwarePitch",false);
|
||||
bool oldPitch=flags.getBool("oldPitch",false);
|
||||
|
||||
ImGui::BeginDisabled(oldPitch);
|
||||
if (ImGui::Checkbox(_("Software pitch driver"),&softwarePitch)) {
|
||||
altered=true;
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
if (ImGui::Checkbox(_("Old pitch table (compatibility)"),&oldPitch)) {
|
||||
if (oldPitch) softwarePitch=false;
|
||||
altered=true;
|
||||
}
|
||||
|
||||
ImGui::Text(_("Mixing mode:"));
|
||||
ImGui::Indent();
|
||||
|
|
@ -1086,6 +1098,8 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
|
|||
e->lockSave([&]() {
|
||||
flags.set("clockSel",(int)clockSel);
|
||||
flags.set("mixingType",mixingType);
|
||||
flags.set("softwarePitch",softwarePitch);
|
||||
flags.set("oldPitch",oldPitch);
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue