diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 673e18ff3..fadc87023 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -337,3 +337,10 @@ jobs: with: name: ${{ steps.package-identify.outputs.id }} path: ${{ steps.package-identify.outputs.filename }} + + - name: Upload Metal artifact + if: ${{ github.repository == 'tildearrow/furnace' && github.ref_name == 'metal' }} + uses: actions/upload-artifact@v4.3.0 + with: + name: ${{ steps.package-identify.outputs.id }} + path: ${{ steps.package-identify.outputs.filename }} diff --git a/src/gui/gui.h b/src/gui/gui.h index ef06e3ad7..5a21f028b 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1259,6 +1259,7 @@ struct FurnaceGUISysDef { String definition; std::vector orig; std::vector subDefs; + void bake(); FurnaceGUISysDef(const char* n, std::initializer_list def, const char* e=NULL); FurnaceGUISysDef(const char* n, const char* def, DivEngine* e); }; diff --git a/src/gui/presets.cpp b/src/gui/presets.cpp index 96912d0c5..f91a45905 100644 --- a/src/gui/presets.cpp +++ b/src/gui/presets.cpp @@ -3102,11 +3102,9 @@ void FurnaceGUI::initSystemPresets() { CATEGORY_END; } -FurnaceGUISysDef::FurnaceGUISysDef(const char* n, std::initializer_list def, const char* e): - name(n), - extra((e==NULL)?"":e) { - orig=def; +void FurnaceGUISysDef::bake() { int index=0; + definition=""; for (FurnaceGUISysDefChip& i: orig) { definition+=fmt::sprintf( "id%d=%d\nvol%d=%f\npan%d=%f\nflags%d=%s\n", @@ -3126,12 +3124,19 @@ FurnaceGUISysDef::FurnaceGUISysDef(const char* n, std::initializer_list def, const char* e): + name(n), + extra((e==NULL)?"":e) { + orig=def; + bake(); +} + FurnaceGUISysDef::FurnaceGUISysDef(const char* n, const char* def, DivEngine* e): name(n), - definition(def) { + definition(taDecodeBase64(def)) { // extract definition DivConfig conf; - conf.loadFromBase64(def); + conf.loadFromMemory(definition.c_str()); for (int i=0; i& entries, int depth) for (int i=0; iname); ImGui::Separator(); - ImGui::Text("the rest..."); + + int doRemove=-1; + bool mustBake=false; + + for (size_t i=0; iorig.size(); i++) { + String tempID; + FurnaceGUISysDefChip& chip=preset->orig[i]; + + bool doInvert=(chip.vol<0); + float vol=fabs(chip.vol); + ImGui::PushID(i); + + tempID=fmt::sprintf("%s##USystem",getSystemName(chip.sys)); + ImGui::Button(tempID.c_str(),ImVec2(ImGui::GetContentRegionAvail().x-ImGui::CalcTextSize("Invert").x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0,0)); + if (ImGui::BeginPopupContextItem("SysPickerCU",ImGuiPopupFlags_MouseButtonLeft)) { + DivSystem picked=systemPicker(); + if (picked!=DIV_SYSTEM_NULL) { + chip.sys=picked; + mustBake=true; + ImGui::CloseCurrentPopup(); + } + ImGui::EndPopup(); + } + + ImGui::SameLine(); + if (ImGui::Checkbox("Invert",&doInvert)) { + chip.vol=-chip.vol; + mustBake=true; + } + ImGui::SameLine(); + pushDestColor(); + if (ImGui::Button(ICON_FA_MINUS "##USysRemove")) { + doRemove=i; + mustBake=true; + } + popDestColor(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); + if (CWSliderFloat("Volume",&vol,0.0f,3.0f)) { + if (doInvert) { + if (vol<0.0001) vol=0.0001; + } + if (vol<0) vol=0; + if (vol>10) vol=10; + chip.vol=doInvert?-vol:vol; + mustBake=true; + } rightClickable + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); + if (CWSliderFloat("Panning",&chip.pan,-1.0f,1.0f)) { + if (chip.pan<-1.0f) chip.pan=-1.0f; + if (chip.pan>1.0f) chip.pan=1.0f; + mustBake=true; + } rightClickable + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); + if (CWSliderFloat("Front/Rear",&chip.panFR,-1.0f,1.0f)) { + if (chip.panFR<-1.0f) chip.panFR=-1.0f; + if (chip.panFR>1.0f) chip.panFR=1.0f; + mustBake=true; + } rightClickable + + if (ImGui::TreeNode("Configure")) { + DivConfig sysFlags; + sysFlags.loadFromBase64(chip.flags.c_str()); + if (drawSysConf(-1,i,chip.sys,sysFlags,false)) { + chip.flags=sysFlags.toBase64(); + mustBake=true; + } + ImGui::TreePop(); + } + + ImGui::PopID(); + } + + if (doRemove>=0) { + preset->orig.erase(preset->orig.begin()+doRemove); + mustBake=true; + } + + ImGui::Button(ICON_FA_PLUS "##SysAddU"); + if (ImGui::BeginPopupContextItem("SysPickerU",ImGuiPopupFlags_MouseButtonLeft)) { + DivSystem picked=systemPicker(); + if (picked!=DIV_SYSTEM_NULL) { + preset->orig.push_back(FurnaceGUISysDefChip(picked,1.0f,0.0f,"")); + mustBake=true; + ImGui::CloseCurrentPopup(); + } + ImGui::EndPopup(); + } + + if (mustBake) preset->bake(); } }