Merge branch 'master' into sample_banks

This commit is contained in:
tildearrow 2024-08-17 17:53:15 -05:00
commit e3e61c817c
183 changed files with 1384 additions and 777 deletions

View file

@ -75,7 +75,7 @@ const char* aboutLine[]={
"Polski: freq-mod, PoznańskiSzybkowiec",
"Português (Brasil): Kagamiin~",
"Русский: Background2982, LTVA",
"Slovenčina: Mr. Hassium",
"Slovenčina: Wegfrei",
"Svenska: RevvoBolt",
"ไทย: akumanatt",
"",
@ -206,6 +206,7 @@ const char* aboutLine[]={
"Ultraprogramer",
"UserSniper",
"Weeppiko",
"Wegfrei",
"Xan",
"Yuzu4K",
"Zabir",

View file

@ -36,6 +36,8 @@ static float oscDebugMax=1.0;
static float oscDebugPower=1.0;
static int oscDebugRepeat=1;
static int numApples=1;
static int getGainChan=0;
static int getGainVol=0;
static void _drawOsc(const ImDrawList* drawList, const ImDrawCmd* cmd) {
if (cmd!=NULL) {
@ -721,6 +723,13 @@ void FurnaceGUI::drawDebug() {
ImGui::TreePop();
}
#endif
if (ImGui::TreeNode("Get Gain Test")) {
float realVol=e->getGain(getGainChan,getGainVol);
ImGui::InputInt("Chan",&getGainChan);
ImGui::InputInt("Vol",&getGainVol);
ImGui::Text("result: %.0f%%",realVol*100.0f);
ImGui::TreePop();
}
if (ImGui::TreeNode("User Interface")) {
if (ImGui::Button("Inspect")) {
inspectorOpen=!inspectorOpen;

View file

@ -676,6 +676,17 @@ void FurnaceGUI::doAction(int what) {
latchTarget=0;
latchNibble=false;
break;
case GUI_ACTION_PAT_ABSORB_INSTRUMENT: {
DivPattern* pat=e->curPat[cursor.xCoarse].getPattern(e->curOrders->ord[cursor.xCoarse][curOrder],false);
if (!pat) break;
for (int i=cursor.y; i>=0; i--) {
if (pat->data[i][2] >= 0) {
curIns=pat->data[i][2];
break;
}
}
break;
}
case GUI_ACTION_INS_LIST_ADD:
if (settings.insTypeMenu) {

View file

@ -130,7 +130,7 @@ const bool mobileButtonPersist[32]={
// page 1
false,
false,
false,
true,
false,
true,
true,

View file

@ -239,6 +239,107 @@ void FurnaceGUI::drawExportVGM(bool onWindow) {
}
}
void FurnaceGUI::drawExportROM(bool onWindow) {
exitDisabledTimer=1;
const DivROMExportDef* def=e->getROMExportDef(romTarget);
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::BeginCombo("##ROMTarget",def==NULL?"<select one>":def->name)) {
for (int i=0; i<DIV_ROM_MAX; i++) {
const DivROMExportDef* newDef=e->getROMExportDef((DivROMExportOptions)i);
if (newDef!=NULL) {
if (romExportAvail[i]) {
if (ImGui::Selectable(newDef->name)) {
romTarget=(DivROMExportOptions)i;
romMultiFile=newDef->multiOutput;
romConfig=DivConfig();
if (newDef->fileExt==NULL) {
romFilterName="";
romFilterExt="";
} else {
romFilterName=newDef->fileType;
romFilterExt=newDef->fileExt;
}
}
}
}
}
ImGui::EndCombo();
}
if (def!=NULL) {
ImGui::Text("by %s",def->author);
ImGui::TextWrapped("%s",def->description);
}
ImGui::Separator();
bool altered=false;
switch (romTarget) {
case DIV_ROM_TIUNA: {
String asmBaseLabel=romConfig.getString("baseLabel","song");
int firstBankSize=romConfig.getInt("firstBankSize",3072);
int otherBankSize=romConfig.getInt("otherBankSize",4096-48);
int sysToExport=romConfig.getInt("sysToExport",-1);
// TODO; validate label
if (ImGui::InputText(_("base song label name"),&asmBaseLabel)) {
altered=true;
}
if (ImGui::InputInt(_("max size in first bank"),&firstBankSize,1,100)) {
if (firstBankSize<0) firstBankSize=0;
if (firstBankSize>4096) firstBankSize=4096;
altered=true;
}
if (ImGui::InputInt(_("max size in other banks"),&otherBankSize,1,100)) {
if (otherBankSize<16) otherBankSize=16;
if (otherBankSize>4096) otherBankSize=4096;
altered=true;
}
ImGui::Text(_("chip to export:"));
for (int i=0; i<e->song.systemLen; i++) {
DivSystem sys=e->song.system[i];
bool isTIA=(sys==DIV_SYSTEM_TIA);
ImGui::BeginDisabled(!isTIA);
if (ImGui::RadioButton(fmt::sprintf("%d. %s##_SYSV%d",i+1,getSystemName(e->song.system[i]),i).c_str(),sysToExport==i)) {
sysToExport=i;
altered=true;
}
ImGui::EndDisabled();
}
if (altered) {
romConfig.set("baseLabel",asmBaseLabel);
romConfig.set("firstBankSize",firstBankSize);
romConfig.set("otherBankSize",otherBankSize);
romConfig.set("sysToExport",sysToExport);
}
break;
}
case DIV_ROM_ABSTRACT:
ImGui::TextWrapped("%s",_("select a target from the menu at the top of this dialog."));
break;
default:
ImGui::TextWrapped("%s",_("this export method doesn't offer any options."));
break;
}
/*
*/
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_ROM);
ImGui::CloseCurrentPopup();
}
}
void FurnaceGUI::drawExportZSM(bool onWindow) {
exitDisabledTimer=1;
@ -261,103 +362,6 @@ void FurnaceGUI::drawExportZSM(bool onWindow) {
}
}
void FurnaceGUI::drawExportTiuna(bool onWindow) {
exitDisabledTimer=1;
ImGui::Text(_("for 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;
ImGui::Text(_(
"this is NOT ROM export! only use for making sure the\n"
"Furnace Amiga emulator is working properly by\n"
"comparing it with real Amiga output."
));
ImGui::AlignTextToFramePadding();
ImGui::Text(_("Directory"));
ImGui::SameLine();
ImGui::InputText("##AVDPath",&workingDirROMExport);
if (onWindow) {
ImGui::Separator();
if (ImGui::Button(_("Cancel"),ImVec2(200.0f*dpiScale,0))) ImGui::CloseCurrentPopup();
ImGui::SameLine();
}
if (ImGui::Button(_("Bake Data"),ImVec2(200.0f*dpiScale,0))) {
DivROMExport* ex=e->buildROM(DIV_ROM_AMIGA_VALIDATION);
if (ex->go(e)) {
ex->wait();
if (ex->hasFailed()) {
showError("error!");
} else {
if (workingDirROMExport.size()>0) {
if (workingDirROMExport[workingDirROMExport.size()-1]!=DIR_SEPARATOR) workingDirROMExport+=DIR_SEPARATOR_STR;
}
for (DivROMExportOutput& i: ex->getResult()) {
String path=workingDirROMExport+i.name;
FILE* outFile=ps_fopen(path.c_str(),"wb");
if (outFile!=NULL) {
fwrite(i.data->getFinalBuf(),1,i.data->size(),outFile);
fclose(outFile);
}
i.data->finish();
delete i.data;
}
showError(fmt::sprintf(_("Done! Baked %d files."),(int)ex->getResult().size()));
}
} else {
showError("error!");
}
delete ex;
ImGui::CloseCurrentPopup();
}
}
void FurnaceGUI::drawExportText(bool onWindow) {
exitDisabledTimer=1;
@ -434,6 +438,12 @@ void FurnaceGUI::drawExport() {
drawExportVGM(true);
ImGui::EndTabItem();
}
if (romExportExists) {
if (ImGui::BeginTabItem(_("ROM"))) {
drawExportROM(true);
ImGui::EndTabItem();
}
}
int numZSMCompat=0;
for (int i=0; i<e->song.systemLen; i++) {
if ((e->song.system[i]==DIV_SYSTEM_VERA) || (e->song.system[i]==DIV_SYSTEM_YM2151)) numZSMCompat++;
@ -444,29 +454,6 @@ 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++;
}
if (numAmiga && settings.iCannotWait) {
if (ImGui::BeginTabItem(_("Amiga Validation"))) {
drawExportAmigaVal(true);
ImGui::EndTabItem();
}
}
if (ImGui::BeginTabItem(_("Text"))) {
drawExportText(true);
ImGui::EndTabItem();
@ -488,15 +475,12 @@ void FurnaceGUI::drawExport() {
case GUI_EXPORT_VGM:
drawExportVGM(true);
break;
case GUI_EXPORT_ROM:
drawExportROM(true);
break;
case GUI_EXPORT_ZSM:
drawExportZSM(true);
break;
case GUI_EXPORT_TIUNA:
drawExportTiuna(true);
break;
case GUI_EXPORT_AMIGA_VAL:
drawExportAmigaVal(true);
break;
case GUI_EXPORT_TEXT:
drawExportText(true);
break;

View file

@ -752,6 +752,88 @@ void FurnaceGUI::autoDetectSystem() {
}
}
void FurnaceGUI::updateROMExportAvail() {
unsigned char sysReqCount[DIV_SYSTEM_MAX];
unsigned char defReqCount[DIV_SYSTEM_MAX];
memset(sysReqCount,0,DIV_SYSTEM_MAX);
for (int i=0; i<e->song.systemLen; i++) {
sysReqCount[e->song.system[i]]++;
}
memset(romExportAvail,0,sizeof(bool)*DIV_ROM_MAX);
romExportExists=false;
for (int i=0; i<DIV_ROM_MAX; i++) {
const DivROMExportDef* newDef=e->getROMExportDef((DivROMExportOptions)i);
if (newDef!=NULL) {
// check for viability
bool viable=true;
memset(defReqCount,0,DIV_SYSTEM_MAX);
for (DivSystem j: newDef->requisites) {
defReqCount[j]++;
}
switch (newDef->requisitePolicy) {
case DIV_REQPOL_EXACT:
for (int j=0; j<DIV_SYSTEM_MAX; j++) {
if (defReqCount[j]!=sysReqCount[j]) {
viable=false;
break;
}
}
break;
case DIV_REQPOL_ANY:
for (int j=0; j<DIV_SYSTEM_MAX; j++) {
if (defReqCount[j]>sysReqCount[j]) {
viable=false;
break;
}
}
break;
case DIV_REQPOL_LAX:
viable=false;
for (DivSystem j: newDef->requisites) {
if (defReqCount[j]<=sysReqCount[j]) {
viable=true;
break;
}
}
break;
}
if (viable) {
romExportAvail[i]=true;
romExportExists=true;
}
}
}
if (!romExportAvail[romTarget]) {
// find a new one
romTarget=DIV_ROM_ABSTRACT;
for (int i=0; i<DIV_ROM_MAX; i++) {
const DivROMExportDef* newDef=e->getROMExportDef((DivROMExportOptions)i);
if (newDef!=NULL) {
if (romExportAvail[i]) {
romTarget=(DivROMExportOptions)i;
romMultiFile=newDef->multiOutput;
romConfig=DivConfig();
if (newDef->fileExt==NULL) {
romFilterName="";
romFilterExt="";
} else {
romFilterName=newDef->fileType;
romFilterExt=newDef->fileExt;
}
break;
}
}
}
}
}
ImVec4 FurnaceGUI::channelColor(int ch) {
switch (settings.channelColors) {
case 0:
@ -1950,15 +2032,6 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
(settings.autoFillSave)?shortName:""
);
break;
case GUI_FILE_EXPORT_TIUNA:
if (!dirExists(workingDirROMExport)) workingDirROMExport=getHomeDir();
hasOpened=fileDialog->openSave(
"Export TIunA",
{"assembly files", "*.asm"},
workingDirROMExport,
dpiScale
);
break;
case GUI_FILE_EXPORT_TEXT:
if (!dirExists(workingDirROMExport)) workingDirROMExport=getHomeDir();
hasOpened=fileDialog->openSave(
@ -1980,7 +2053,22 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
);
break;
case GUI_FILE_EXPORT_ROM:
showError(_("Coming soon!"));
if (!dirExists(workingDirROMExport)) workingDirROMExport=getHomeDir();
if (romMultiFile) {
hasOpened=fileDialog->openSelectDir(
_("Export ROM"),
workingDirROMExport,
dpiScale
);
} else {
hasOpened=fileDialog->openSave(
_("Export ROM"),
{romFilterName, "*"+romFilterExt},
workingDirROMExport,
dpiScale,
(settings.autoFillSave)?shortName:""
);
}
break;
case GUI_FILE_LOAD_MAIN_FONT:
if (!dirExists(workingDirFont)) workingDirFont=getHomeDir();
@ -2353,6 +2441,7 @@ int FurnaceGUI::load(String path) {
undoHist.clear();
redoHist.clear();
updateWindowTitle();
updateROMExportAvail();
updateScroll(0);
if (!e->getWarnings().empty()) {
showWarning(e->getWarnings(),GUI_WARN_GENERIC);
@ -4310,6 +4399,12 @@ bool FurnaceGUI::loop() {
drawExportVGM();
ImGui::EndMenu();
}
if (romExportExists) {
if (ImGui::BeginMenu(_("export ROM..."))) {
drawExportROM();
ImGui::EndMenu();
}
}
int numZSMCompat=0;
for (int i=0; i<e->song.systemLen; i++) {
if ((e->song.system[i]==DIV_SYSTEM_VERA) || (e->song.system[i]==DIV_SYSTEM_YM2151)) numZSMCompat++;
@ -4320,29 +4415,6 @@ bool FurnaceGUI::loop() {
ImGui::EndMenu();
}
}
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::BeginMenu(_("export TIunA..."))) {
drawExportTiuna();
ImGui::EndMenu();
}
}
int numAmiga=0;
for (int i=0; i<e->song.systemLen; i++) {
if (e->song.system[i]==DIV_SYSTEM_AMIGA) numAmiga++;
}
if (numAmiga && settings.iCannotWait) {
if (ImGui::BeginMenu(_("export Amiga validation data..."))) {
drawExportAmigaVal();
ImGui::EndMenu();
}
}
if (ImGui::BeginMenu(_("export text..."))) {
drawExportText();
ImGui::EndMenu();
@ -4364,6 +4436,12 @@ bool FurnaceGUI::loop() {
curExportType=GUI_EXPORT_VGM;
displayExport=true;
}
if (romExportExists) {
if (ImGui::MenuItem(_("export ROM..."))) {
curExportType=GUI_EXPORT_ROM;
displayExport=true;
}
}
int numZSMCompat=0;
for (int i=0; i<e->song.systemLen; i++) {
if ((e->song.system[i]==DIV_SYSTEM_VERA) || (e->song.system[i]==DIV_SYSTEM_YM2151)) numZSMCompat++;
@ -4374,29 +4452,6 @@ bool FurnaceGUI::loop() {
displayExport=true;
}
}
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::MenuItem(_("export TIunA..."))) {
curExportType=GUI_EXPORT_TIUNA;
displayExport=true;
}
}
int numAmiga=0;
for (int i=0; i<e->song.systemLen; i++) {
if (e->song.system[i]==DIV_SYSTEM_AMIGA) numAmiga++;
}
if (numAmiga && settings.iCannotWait) {
if (ImGui::MenuItem(_("export Amiga validation data..."))) {
curExportType=GUI_EXPORT_AMIGA_VAL;
displayExport=true;
}
}
if (ImGui::MenuItem(_("export text..."))) {
curExportType=GUI_EXPORT_TEXT;
displayExport=true;
@ -4434,6 +4489,7 @@ bool FurnaceGUI::loop() {
autoDetectSystem();
}
updateWindowTitle();
updateROMExportAvail();
}
ImGui::EndMenu();
}
@ -4460,6 +4516,7 @@ bool FurnaceGUI::loop() {
autoDetectSystem();
}
updateWindowTitle();
updateROMExportAvail();
} else {
showError(fmt::sprintf(_("cannot change chip! (%s)"),e->getLastError()));
}
@ -4484,6 +4541,7 @@ bool FurnaceGUI::loop() {
autoDetectSystem();
updateWindowTitle();
}
updateROMExportAvail();
}
}
ImGui::EndMenu();
@ -4980,7 +5038,6 @@ bool FurnaceGUI::loop() {
workingDirZSMExport=fileDialog->getPath()+DIR_SEPARATOR_STR;
break;
case GUI_FILE_EXPORT_ROM:
case GUI_FILE_EXPORT_TIUNA:
case GUI_FILE_EXPORT_TEXT:
case GUI_FILE_EXPORT_CMDSTREAM:
workingDirROMExport=fileDialog->getPath()+DIR_SEPARATOR_STR;
@ -5076,6 +5133,9 @@ bool FurnaceGUI::loop() {
if (curFileDialog==GUI_FILE_EXPORT_VGM) {
checkExtension(".vgm");
}
if (curFileDialog==GUI_FILE_EXPORT_ROM) {
checkExtension(romFilterExt.c_str());
}
if (curFileDialog==GUI_FILE_EXPORT_ZSM) {
checkExtension(".zsm");
}
@ -5575,29 +5635,20 @@ 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!"));
romExportPath=copyOfName;
pendingExport=e->buildROM(romTarget);
if (pendingExport==NULL) {
showError("could not create exporter! you may want to report this issue...");
} else {
pendingExport->setConf(romConfig);
if (pendingExport->go(e)) {
displayExportingROM=true;
romExportSave=true;
} else {
showError("could not begin exporting process! TODO: elaborate");
}
}
break;
case GUI_FILE_EXPORT_TEXT: {
SafeWriter* w=e->saveText(false);
@ -5769,6 +5820,11 @@ bool FurnaceGUI::loop() {
ImGui::OpenPopup(_("Rendering..."));
}
if (displayExportingROM) {
displayExportingROM=false;
ImGui::OpenPopup(_("ROM Export Progress"));
}
if (displayNew) {
newSongQuery="";
newSongFirstFrame=true;
@ -5788,6 +5844,7 @@ bool FurnaceGUI::loop() {
selEnd=SelectionPoint();
cursor=SelectionPoint();
updateWindowTitle();
updateROMExportAvail();
} else {
ImGui::OpenPopup(_("New Song"));
}
@ -5834,6 +5891,94 @@ bool FurnaceGUI::loop() {
ImGui::EndPopup();
}
ImVec2 romExportMinSize=mobileUI?ImVec2(canvasW-(portrait?0:(60.0*dpiScale)),canvasH-60.0*dpiScale):ImVec2(400.0f*dpiScale,200.0f*dpiScale);
ImVec2 romExportMaxSize=ImVec2(canvasW-((mobileUI && !portrait)?(60.0*dpiScale):0),canvasH-(mobileUI?(60.0*dpiScale):0));
centerNextWindow(_("ROM Export Progress"),canvasW,canvasH);
ImGui::SetNextWindowSizeConstraints(romExportMinSize,romExportMaxSize);
if (ImGui::BeginPopupModal(_("ROM Export Progress"),NULL)) {
if (pendingExport==NULL) {
ImGui::TextWrapped("%s",_("...ooooor you could try asking me a new ROM export?"));
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::Button(_("Erm what the sigma???"),ImVec2(ImGui::GetContentRegionAvail().x,0.0f))) {
ImGui::CloseCurrentPopup();
}
} else {
int progIndex=0;
while (true) {
DivROMExportProgress p=pendingExport->getProgress(progIndex);
if (p.name.empty()) break;
ImGui::Text("%s: %d%%",p.name.c_str(),(int)round(p.amount*100.0f));
ImGui::ProgressBar(p.amount,ImVec2(-FLT_MIN,0));
progIndex++;
}
ImVec2 romLogSize=ImGui::GetContentRegionAvail();
romLogSize.y-=ImGui::GetFrameHeightWithSpacing();
if (romLogSize.y<60.0f*dpiScale) romLogSize.y=60.0f*dpiScale;
if (ImGui::BeginChild("Export Log",romLogSize,true)) {
pendingExport->logLock.lock();
ImGui::PushFont(patFont);
for (String& i: pendingExport->exportLog) {
ImGui::TextWrapped("%s",i.c_str());
}
if (romExportSave) {
ImGui::SetScrollY(ImGui::GetScrollMaxY());
}
ImGui::PopFont();
pendingExport->logLock.unlock();
}
ImGui::EndChild();
if (pendingExport->isRunning()) {
WAKE_UP;
if (ImGui::Button(_("Abort"),ImVec2(ImGui::GetContentRegionAvail().x,0.0f))) {
pendingExport->abort();
delete pendingExport;
pendingExport=NULL;
romExportSave=false;
ImGui::CloseCurrentPopup();
}
} else {
if (romExportSave) {
pendingExport->wait();
if (!pendingExport->hasFailed()) {
// save files here (romExportPath)
for (DivROMExportOutput& i: pendingExport->getResult()) {
String path=romExportPath;
if (romMultiFile) {
path+=DIR_SEPARATOR_STR;
path+=i.name;
}
FILE* outFile=ps_fopen(path.c_str(),"wb");
if (outFile!=NULL) {
fwrite(i.data->getFinalBuf(),1,i.data->size(),outFile);
fclose(outFile);
} else {
// TODO: handle failure here
}
i.data->finish();
delete i.data;
}
}
romExportSave=false;
}
if (pendingExport!=NULL) {
if (pendingExport->hasFailed()) {
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted(_("Error!"));
ImGui::SameLine();
}
}
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::Button(_("OK"),ImVec2(ImGui::GetContentRegionAvail().x,0.0f))) {
delete pendingExport;
pendingExport=NULL;
ImGui::CloseCurrentPopup();
}
}
}
ImGui::EndPopup();
}
drawTutorial();
ImVec2 newSongMinSize=mobileUI?ImVec2(canvasW-(portrait?0:(60.0*dpiScale)),canvasH-60.0*dpiScale):ImVec2(400.0f*dpiScale,200.0f*dpiScale);
@ -6250,6 +6395,7 @@ bool FurnaceGUI::loop() {
updateWindowTitle();
MARK_MODIFIED;
}
updateROMExportAvail();
ImGui::CloseCurrentPopup();
}
ImGui::SameLine();
@ -7450,6 +7596,7 @@ bool FurnaceGUI::init() {
}
updateWindowTitle();
updateROMExportAvail();
logV("max texture size: %dx%d",rend->getMaxTextureWidth(),rend->getMaxTextureHeight());
@ -8137,6 +8284,7 @@ FurnaceGUI::FurnaceGUI():
displayEditString(false),
displayPendingSamples(false),
replacePendingSample(false),
displayExportingROM(false),
changeCoarse(false),
mobileEdit(false),
killGraphics(false),
@ -8150,9 +8298,6 @@ FurnaceGUI::FurnaceGUI():
vgmExportTrailingTicks(-1),
drawHalt(10),
zsmExportTickRate(60),
asmBaseLabel(""),
tiunaFirstBankSize(3072),
tiunaOtherBankSize(4096-48),
macroPointSize(16),
waveEditStyle(0),
displayInsTypeListMakeInsSample(-1),
@ -8613,7 +8758,12 @@ FurnaceGUI::FurnaceGUI():
curTutorial(-1),
curTutorialStep(0),
dmfExportVersion(0),
curExportType(GUI_EXPORT_NONE) {
curExportType(GUI_EXPORT_NONE),
romTarget(DIV_ROM_ABSTRACT),
romMultiFile(false),
romExportSave(false),
pendingExport(NULL),
romExportExists(false) {
// value keys
valueKeys[SDLK_0]=0;
valueKeys[SDLK_1]=1;
@ -8732,6 +8882,8 @@ FurnaceGUI::FurnaceGUI():
// effect sorting
memset(effectsShow,1,sizeof(bool)*10);
memset(romExportAvail,0,sizeof(bool)*DIV_ROM_MAX);
strncpy(noteOffLabel,"OFF",32);
strncpy(noteRelLabel,"===",32);
strncpy(macroRelLabel,"REL",32);

View file

@ -599,7 +599,6 @@ 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,
@ -651,10 +650,9 @@ enum FurnaceGUIExportTypes {
GUI_EXPORT_AUDIO=0,
GUI_EXPORT_VGM,
GUI_EXPORT_ROM,
GUI_EXPORT_ZSM,
GUI_EXPORT_TIUNA,
GUI_EXPORT_CMD_STREAM,
GUI_EXPORT_AMIGA_VAL,
GUI_EXPORT_TEXT,
GUI_EXPORT_DMF
};
@ -818,6 +816,7 @@ enum FurnaceGUIActions {
GUI_ACTION_PAT_LATCH,
GUI_ACTION_PAT_SCROLL_MODE,
GUI_ACTION_PAT_CLEAR_LATCH,
GUI_ACTION_PAT_ABSORB_INSTRUMENT,
GUI_ACTION_PAT_MAX,
GUI_ACTION_INS_LIST_MIN,
@ -1622,6 +1621,7 @@ class FurnaceGUI {
bool wantScrollListIns, wantScrollListWave, wantScrollListSample;
bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex, modTableHex, displayEditString;
bool displayPendingSamples, replacePendingSample;
bool displayExportingROM;
bool changeCoarse;
bool mobileEdit;
bool killGraphics;
@ -1635,9 +1635,6 @@ class FurnaceGUI {
int cvHiScore;
int drawHalt;
int zsmExportTickRate;
String asmBaseLabel;
int tiunaFirstBankSize;
int tiunaOtherBankSize;
int macroPointSize;
int waveEditStyle;
int displayInsTypeListMakeInsSample;
@ -1963,6 +1960,7 @@ class FurnaceGUI {
unsigned int maxUndoSteps;
float vibrationStrength;
int vibrationLength;
int s3mOPL3;
String mainFontPath;
String headFontPath;
String patFontPath;
@ -2219,6 +2217,7 @@ class FurnaceGUI {
maxUndoSteps(100),
vibrationStrength(0.5f),
vibrationLength(20),
s3mOPL3(0),
mainFontPath(""),
headFontPath(""),
patFontPath(""),
@ -2682,6 +2681,17 @@ class FurnaceGUI {
int dmfExportVersion;
FurnaceGUIExportTypes curExportType;
// ROM export specific
DivROMExportOptions romTarget;
DivConfig romConfig;
bool romMultiFile;
bool romExportSave;
String romFilterName, romFilterExt;
String romExportPath;
DivROMExport* pendingExport;
bool romExportAvail[DIV_ROM_MAX];
bool romExportExists;
// user presets window
std::vector<int> selectedUserPreset;
@ -2689,9 +2699,8 @@ class FurnaceGUI {
void drawExportAudio(bool onWindow=false);
void drawExportVGM(bool onWindow=false);
void drawExportROM(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);
void drawExportDMF(bool onWindow=false);
@ -2731,6 +2740,7 @@ class FurnaceGUI {
bool portSet(String label, unsigned int portSetID, int ins, int outs, int activeIns, int activeOuts, int& clickedPort, std::map<unsigned int,ImVec2>& portPos);
void updateWindowTitle();
void updateROMExportAvail();
void autoDetectSystem();
void autoDetectSystemIter(std::vector<FurnaceGUISysDef>& category, bool& isMatch, std::map<DivSystem,int>& defCountMap, std::map<DivSystem,DivConfig>& defConfMap, std::map<DivSystem,int>& sysCountMap, std::map<DivSystem,DivConfig>& sysConfMap);
void prepareLayout();

View file

@ -687,6 +687,7 @@ const FurnaceGUIActionDef guiActions[GUI_ACTION_MAX]={
D("PAT_LATCH", _N("Set note input latch"), 0),
D("PAT_SCROLL_MODE", _N("Change mobile scroll mode"), 0),
D("PAT_CLEAR_LATCH", _N("Clear note input latch"), 0),
D("PAT_ABSORB_INSTRUMENT", _N("Set current instrument to channel's current instrument column"), 0),
D("PAT_MAX", "", NOT_AN_ACTION),
D("INS_LIST_MIN", _N("---Instrument list"), NOT_AN_ACTION),

View file

@ -7569,6 +7569,10 @@ void FurnaceGUI::drawInsEdit() {
macroList.push_back(FurnaceGUIMacroDesc(_("Timer Num"),&ins->std.ex8Macro,0,15,64,uiColors[GUI_COLOR_MACRO_OTHER]));
macroList.push_back(FurnaceGUIMacroDesc(_("Timer Den"),&ins->std.fmsMacro,0,15,64,uiColors[GUI_COLOR_MACRO_OTHER]));
macroList.push_back(FurnaceGUIMacroDesc(_("PWM Boundary"),&ins->std.amsMacro,0,15,64,uiColors[GUI_COLOR_MACRO_OTHER]));
// workaround, because the gui will not set
// zoom or scroll if we're not in macros tab
ins->std.ex7Macro.vZoom=128;
ins->std.ex7Macro.vScroll=2048-64;
drawMacros(macroList,macroEditStateMacros);
ImGui::EndTabItem();
}

View file

@ -289,6 +289,7 @@ void FurnaceGUI::drawNewSong() {
selEnd=SelectionPoint();
cursor=SelectionPoint();
updateWindowTitle();
updateROMExportAvail();
ImGui::CloseCurrentPopup();
}

View file

@ -26,6 +26,8 @@
#include "imgui.h"
#include "imgui_internal.h"
#include "../ta-utils.h"
struct FurnacePlotArrayGetterData
{
const float* Values;
@ -270,12 +272,13 @@ int PlotBitfieldEx(const char* label, int (*values_getter)(void* data, int idx),
float lineHeight=ImGui::GetTextLineHeight()/2.0;
for (int i=0; i<bits && overlay_text[i]; i++) {
ImGui::PushStyleColor(ImGuiCol_Text,ImVec4(0,0,0,1.0f));
ImGui::RenderTextClipped(ImVec2(frame_bb.Min.x-1, frame_bb.Min.y-lineHeight-1), ImVec2(frame_bb.Max.x-1,frame_bb.Max.y+lineHeight-1), overlay_text[i], NULL, NULL, ImVec2(0.0f, (0.5+double(bits-1-i))/double(bits)));
ImGui::RenderTextClipped(ImVec2(frame_bb.Min.x-1, frame_bb.Min.y-lineHeight+1), ImVec2(frame_bb.Max.x-1,frame_bb.Max.y+lineHeight+1), overlay_text[i], NULL, NULL, ImVec2(0.0f, (0.5+double(bits-1-i))/double(bits)));
ImGui::RenderTextClipped(ImVec2(frame_bb.Min.x+1, frame_bb.Min.y-lineHeight-1), ImVec2(frame_bb.Max.x+1,frame_bb.Max.y+lineHeight-1), overlay_text[i], NULL, NULL, ImVec2(0.0f, (0.5+double(bits-1-i))/double(bits)));
ImGui::RenderTextClipped(ImVec2(frame_bb.Min.x+1, frame_bb.Min.y-lineHeight+1), ImVec2(frame_bb.Max.x+1,frame_bb.Max.y+lineHeight+1), overlay_text[i], NULL, NULL, ImVec2(0.0f, (0.5+double(bits-1-i))/double(bits)));
const char* text=_(overlay_text[i]);
ImGui::RenderTextClipped(ImVec2(frame_bb.Min.x-1, frame_bb.Min.y-lineHeight-1), ImVec2(frame_bb.Max.x-1,frame_bb.Max.y+lineHeight-1), text, NULL, NULL, ImVec2(0.0f, (0.5+double(bits-1-i))/double(bits)));
ImGui::RenderTextClipped(ImVec2(frame_bb.Min.x-1, frame_bb.Min.y-lineHeight+1), ImVec2(frame_bb.Max.x-1,frame_bb.Max.y+lineHeight+1), text, NULL, NULL, ImVec2(0.0f, (0.5+double(bits-1-i))/double(bits)));
ImGui::RenderTextClipped(ImVec2(frame_bb.Min.x+1, frame_bb.Min.y-lineHeight-1), ImVec2(frame_bb.Max.x+1,frame_bb.Max.y+lineHeight-1), text, NULL, NULL, ImVec2(0.0f, (0.5+double(bits-1-i))/double(bits)));
ImGui::RenderTextClipped(ImVec2(frame_bb.Min.x+1, frame_bb.Min.y-lineHeight+1), ImVec2(frame_bb.Max.x+1,frame_bb.Max.y+lineHeight+1), text, NULL, NULL, ImVec2(0.0f, (0.5+double(bits-1-i))/double(bits)));
ImGui::PopStyleColor();
ImGui::RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y-lineHeight), ImVec2(frame_bb.Max.x,frame_bb.Max.y+lineHeight), overlay_text[i], NULL, NULL, ImVec2(0.0f, (0.5+double(bits-1-i))/double(bits)));
ImGui::RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y-lineHeight), ImVec2(frame_bb.Max.x,frame_bb.Max.y+lineHeight), text, NULL, NULL, ImVec2(0.0f, (0.5+double(bits-1-i))/double(bits)));
}
}

View file

@ -1254,6 +1254,14 @@ void FurnaceGUI::drawSettings() {
}
popDestColor();
// SUBSECTION IMPORT
CONFIG_SUBSECTION(_("Import"));
bool s3mOPL3B=settings.s3mOPL3;
if (ImGui::Checkbox(_("Use OPL3 instead of OPL2 for S3M import"),&s3mOPL3B)) {
settings.s3mOPL3=s3mOPL3B;
settingsChanged=true;
}
END_SECTION;
}
CONFIG_SECTION(_("Audio")) {
@ -2415,6 +2423,7 @@ void FurnaceGUI::drawSettings() {
UI_KEYBIND_CONFIG(GUI_ACTION_PAT_EXPAND_SONG);
UI_KEYBIND_CONFIG(GUI_ACTION_PAT_LATCH);
UI_KEYBIND_CONFIG(GUI_ACTION_PAT_CLEAR_LATCH);
UI_KEYBIND_CONFIG(GUI_ACTION_PAT_ABSORB_INSTRUMENT);
KEYBIND_CONFIG_END;
ImGui::TreePop();
@ -4745,6 +4754,8 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
settings.vibrationStrength=conf.getFloat("vibrationStrength",0.5f);
settings.vibrationLength=conf.getInt("vibrationLength",20);
settings.s3mOPL3=conf.getInt("s3mOPL3",0);
settings.backupEnable=conf.getInt("backupEnable",1);
settings.backupInterval=conf.getInt("backupInterval",30);
settings.backupMaxCopies=conf.getInt("backupMaxCopies",5);
@ -5257,6 +5268,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
clampSetting(settings.backupMaxCopies,1,100);
clampSetting(settings.autoFillSave,0,1);
clampSetting(settings.autoMacroStepSize,0,1);
clampSetting(settings.s3mOPL3,0,1);
if (settings.exportLoops<0.0) settings.exportLoops=0.0;
if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
@ -5330,6 +5342,8 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
conf.set("vibrationStrength",settings.vibrationStrength);
conf.set("vibrationLength",settings.vibrationLength);
conf.set("s3mOPL3",settings.s3mOPL3);
conf.set("backupEnable",settings.backupEnable);
conf.set("backupInterval",settings.backupInterval);
conf.set("backupMaxCopies",settings.backupMaxCopies);

View file

@ -2482,7 +2482,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
break;
}
case DIV_SYSTEM_VERA: {
int chipType=flags.getInt("chipType",1);
int chipType=flags.getInt("chipType",2);
ImGui::Text(_("Chip revision:"));
ImGui::Indent();
@ -2494,6 +2494,10 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
chipType=1;
altered=true;
}
if (ImGui::RadioButton(_("V 47.0.2 (Tri/Saw PW XOR)"),chipType==2)) {
chipType=2;
altered=true;
}
ImGui::Unindent();
if (altered) {

View file

@ -91,6 +91,11 @@ void FurnaceGUI::drawSysManager() {
if (!e->duplicateSystem(i,sysDupCloneChannels,sysDupEnd)) {
showError(fmt::sprintf(_("cannot clone chip! (%s)"),e->getLastError()));
} else {
if (e->song.autoSystem) {
autoDetectSystem();
updateWindowTitle();
}
updateROMExportAvail();
MARK_MODIFIED;
}
}
@ -105,6 +110,7 @@ void FurnaceGUI::drawSysManager() {
autoDetectSystem();
}
updateWindowTitle();
updateROMExportAvail();
} else {
showError(fmt::sprintf(_("cannot change chip! (%s)"),e->getLastError()));
}
@ -143,6 +149,7 @@ void FurnaceGUI::drawSysManager() {
autoDetectSystem();
}
updateWindowTitle();
updateROMExportAvail();
ImGui::CloseCurrentPopup();
}
ImGui::EndPopup();