GUI: parse ROM export requisites
This commit is contained in:
parent
f906b4ebe4
commit
eaa943e724
|
@ -141,6 +141,8 @@ enum DivSystem {
|
||||||
DIV_SYSTEM_5E01,
|
DIV_SYSTEM_5E01,
|
||||||
DIV_SYSTEM_BIFURCATOR,
|
DIV_SYSTEM_BIFURCATOR,
|
||||||
DIV_SYSTEM_SID2,
|
DIV_SYSTEM_SID2,
|
||||||
|
|
||||||
|
DIV_SYSTEM_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DivEffectType: unsigned short {
|
enum DivEffectType: unsigned short {
|
||||||
|
|
|
@ -249,6 +249,7 @@ void FurnaceGUI::drawExportROM(bool onWindow) {
|
||||||
for (int i=0; i<DIV_ROM_MAX; i++) {
|
for (int i=0; i<DIV_ROM_MAX; i++) {
|
||||||
const DivROMExportDef* newDef=e->getROMExportDef((DivROMExportOptions)i);
|
const DivROMExportDef* newDef=e->getROMExportDef((DivROMExportOptions)i);
|
||||||
if (newDef!=NULL) {
|
if (newDef!=NULL) {
|
||||||
|
if (romExportAvail[i]) {
|
||||||
if (ImGui::Selectable(newDef->name)) {
|
if (ImGui::Selectable(newDef->name)) {
|
||||||
romTarget=(DivROMExportOptions)i;
|
romTarget=(DivROMExportOptions)i;
|
||||||
romMultiFile=newDef->multiOutput;
|
romMultiFile=newDef->multiOutput;
|
||||||
|
@ -263,6 +264,7 @@ void FurnaceGUI::drawExportROM(bool onWindow) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ImGui::EndCombo();
|
ImGui::EndCombo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,10 +438,12 @@ void FurnaceGUI::drawExport() {
|
||||||
drawExportVGM(true);
|
drawExportVGM(true);
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
|
if (romExportExists) {
|
||||||
if (ImGui::BeginTabItem(_("ROM"))) {
|
if (ImGui::BeginTabItem(_("ROM"))) {
|
||||||
drawExportROM(true);
|
drawExportROM(true);
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
int numZSMCompat=0;
|
int numZSMCompat=0;
|
||||||
for (int i=0; i<e->song.systemLen; i++) {
|
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++;
|
if ((e->song.system[i]==DIV_SYSTEM_VERA) || (e->song.system[i]==DIV_SYSTEM_YM2151)) numZSMCompat++;
|
||||||
|
|
|
@ -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) {
|
ImVec4 FurnaceGUI::channelColor(int ch) {
|
||||||
switch (settings.channelColors) {
|
switch (settings.channelColors) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -2359,6 +2441,7 @@ int FurnaceGUI::load(String path) {
|
||||||
undoHist.clear();
|
undoHist.clear();
|
||||||
redoHist.clear();
|
redoHist.clear();
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
|
updateROMExportAvail();
|
||||||
updateScroll(0);
|
updateScroll(0);
|
||||||
if (!e->getWarnings().empty()) {
|
if (!e->getWarnings().empty()) {
|
||||||
showWarning(e->getWarnings(),GUI_WARN_GENERIC);
|
showWarning(e->getWarnings(),GUI_WARN_GENERIC);
|
||||||
|
@ -4301,10 +4384,12 @@ bool FurnaceGUI::loop() {
|
||||||
drawExportVGM();
|
drawExportVGM();
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
if (romExportExists) {
|
||||||
if (ImGui::BeginMenu(_("export ROM..."))) {
|
if (ImGui::BeginMenu(_("export ROM..."))) {
|
||||||
drawExportROM();
|
drawExportROM();
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
int numZSMCompat=0;
|
int numZSMCompat=0;
|
||||||
for (int i=0; i<e->song.systemLen; i++) {
|
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++;
|
if ((e->song.system[i]==DIV_SYSTEM_VERA) || (e->song.system[i]==DIV_SYSTEM_YM2151)) numZSMCompat++;
|
||||||
|
@ -4336,10 +4421,12 @@ bool FurnaceGUI::loop() {
|
||||||
curExportType=GUI_EXPORT_VGM;
|
curExportType=GUI_EXPORT_VGM;
|
||||||
displayExport=true;
|
displayExport=true;
|
||||||
}
|
}
|
||||||
|
if (romExportExists) {
|
||||||
if (ImGui::MenuItem(_("export ROM..."))) {
|
if (ImGui::MenuItem(_("export ROM..."))) {
|
||||||
curExportType=GUI_EXPORT_ROM;
|
curExportType=GUI_EXPORT_ROM;
|
||||||
displayExport=true;
|
displayExport=true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
int numZSMCompat=0;
|
int numZSMCompat=0;
|
||||||
for (int i=0; i<e->song.systemLen; i++) {
|
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++;
|
if ((e->song.system[i]==DIV_SYSTEM_VERA) || (e->song.system[i]==DIV_SYSTEM_YM2151)) numZSMCompat++;
|
||||||
|
@ -4387,6 +4474,7 @@ bool FurnaceGUI::loop() {
|
||||||
autoDetectSystem();
|
autoDetectSystem();
|
||||||
}
|
}
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
|
updateROMExportAvail();
|
||||||
}
|
}
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
@ -4413,6 +4501,7 @@ bool FurnaceGUI::loop() {
|
||||||
autoDetectSystem();
|
autoDetectSystem();
|
||||||
}
|
}
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
|
updateROMExportAvail();
|
||||||
} else {
|
} else {
|
||||||
showError(fmt::sprintf(_("cannot change chip! (%s)"),e->getLastError()));
|
showError(fmt::sprintf(_("cannot change chip! (%s)"),e->getLastError()));
|
||||||
}
|
}
|
||||||
|
@ -4437,6 +4526,7 @@ bool FurnaceGUI::loop() {
|
||||||
autoDetectSystem();
|
autoDetectSystem();
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
}
|
}
|
||||||
|
updateROMExportAvail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
|
@ -5695,6 +5785,7 @@ bool FurnaceGUI::loop() {
|
||||||
selEnd=SelectionPoint();
|
selEnd=SelectionPoint();
|
||||||
cursor=SelectionPoint();
|
cursor=SelectionPoint();
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
|
updateROMExportAvail();
|
||||||
} else {
|
} else {
|
||||||
ImGui::OpenPopup(_("New Song"));
|
ImGui::OpenPopup(_("New Song"));
|
||||||
}
|
}
|
||||||
|
@ -6245,6 +6336,7 @@ bool FurnaceGUI::loop() {
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
MARK_MODIFIED;
|
MARK_MODIFIED;
|
||||||
}
|
}
|
||||||
|
updateROMExportAvail();
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
@ -7263,6 +7355,7 @@ bool FurnaceGUI::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
|
updateROMExportAvail();
|
||||||
|
|
||||||
logV("max texture size: %dx%d",rend->getMaxTextureWidth(),rend->getMaxTextureHeight());
|
logV("max texture size: %dx%d",rend->getMaxTextureWidth(),rend->getMaxTextureHeight());
|
||||||
|
|
||||||
|
@ -8397,7 +8490,8 @@ FurnaceGUI::FurnaceGUI():
|
||||||
romTarget(DIV_ROM_ABSTRACT),
|
romTarget(DIV_ROM_ABSTRACT),
|
||||||
romMultiFile(false),
|
romMultiFile(false),
|
||||||
romExportSave(false),
|
romExportSave(false),
|
||||||
pendingExport(NULL) {
|
pendingExport(NULL),
|
||||||
|
romExportExists(false) {
|
||||||
// value keys
|
// value keys
|
||||||
valueKeys[SDLK_0]=0;
|
valueKeys[SDLK_0]=0;
|
||||||
valueKeys[SDLK_1]=1;
|
valueKeys[SDLK_1]=1;
|
||||||
|
@ -8516,6 +8610,8 @@ FurnaceGUI::FurnaceGUI():
|
||||||
// effect sorting
|
// effect sorting
|
||||||
memset(effectsShow,1,sizeof(bool)*10);
|
memset(effectsShow,1,sizeof(bool)*10);
|
||||||
|
|
||||||
|
memset(romExportAvail,0,sizeof(bool)*DIV_ROM_MAX);
|
||||||
|
|
||||||
strncpy(noteOffLabel,"OFF",32);
|
strncpy(noteOffLabel,"OFF",32);
|
||||||
strncpy(noteRelLabel,"===",32);
|
strncpy(noteRelLabel,"===",32);
|
||||||
strncpy(macroRelLabel,"REL",32);
|
strncpy(macroRelLabel,"REL",32);
|
||||||
|
|
|
@ -2683,6 +2683,8 @@ class FurnaceGUI {
|
||||||
String romFilterName, romFilterExt;
|
String romFilterName, romFilterExt;
|
||||||
String romExportPath;
|
String romExportPath;
|
||||||
DivROMExport* pendingExport;
|
DivROMExport* pendingExport;
|
||||||
|
bool romExportAvail[DIV_ROM_MAX];
|
||||||
|
bool romExportExists;
|
||||||
|
|
||||||
// user presets window
|
// user presets window
|
||||||
std::vector<int> selectedUserPreset;
|
std::vector<int> selectedUserPreset;
|
||||||
|
@ -2732,6 +2734,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);
|
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 updateWindowTitle();
|
||||||
|
void updateROMExportAvail();
|
||||||
void autoDetectSystem();
|
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 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();
|
void prepareLayout();
|
||||||
|
|
|
@ -289,6 +289,7 @@ void FurnaceGUI::drawNewSong() {
|
||||||
selEnd=SelectionPoint();
|
selEnd=SelectionPoint();
|
||||||
cursor=SelectionPoint();
|
cursor=SelectionPoint();
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
|
updateROMExportAvail();
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,11 @@ void FurnaceGUI::drawSysManager() {
|
||||||
if (!e->duplicateSystem(i,sysDupCloneChannels,sysDupEnd)) {
|
if (!e->duplicateSystem(i,sysDupCloneChannels,sysDupEnd)) {
|
||||||
showError(fmt::sprintf(_("cannot clone chip! (%s)"),e->getLastError()));
|
showError(fmt::sprintf(_("cannot clone chip! (%s)"),e->getLastError()));
|
||||||
} else {
|
} else {
|
||||||
|
if (e->song.autoSystem) {
|
||||||
|
autoDetectSystem();
|
||||||
|
updateWindowTitle();
|
||||||
|
}
|
||||||
|
updateROMExportAvail();
|
||||||
MARK_MODIFIED;
|
MARK_MODIFIED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,6 +110,7 @@ void FurnaceGUI::drawSysManager() {
|
||||||
autoDetectSystem();
|
autoDetectSystem();
|
||||||
}
|
}
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
|
updateROMExportAvail();
|
||||||
} else {
|
} else {
|
||||||
showError(fmt::sprintf(_("cannot change chip! (%s)"),e->getLastError()));
|
showError(fmt::sprintf(_("cannot change chip! (%s)"),e->getLastError()));
|
||||||
}
|
}
|
||||||
|
@ -143,6 +149,7 @@ void FurnaceGUI::drawSysManager() {
|
||||||
autoDetectSystem();
|
autoDetectSystem();
|
||||||
}
|
}
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
|
updateROMExportAvail();
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
|
|
Loading…
Reference in a new issue