GUI: add chip names option

This commit is contained in:
tildearrow 2022-01-28 03:17:35 -05:00
parent 9b62eb9d34
commit 0567a3f71b
4 changed files with 75 additions and 7 deletions

View File

@ -234,6 +234,53 @@ const char* DivEngine::getSystemName(DivSystem sys) {
return "Unknown";
}
const char* DivEngine::getSystemChips(DivSystem sys) {
switch (sys) {
case DIV_SYSTEM_NULL:
return "Unknown";
case DIV_SYSTEM_YMU759:
return "Yamaha YMU759";
case DIV_SYSTEM_GENESIS:
return "Yamaha YM2612 + TI SN76489";
case DIV_SYSTEM_SMS:
return "TI SN76489";
case DIV_SYSTEM_GB:
return "Game Boy";
case DIV_SYSTEM_PCE:
return "Hudson Soft HuC6280";
case DIV_SYSTEM_NES:
return "Ricoh 2A03";
case DIV_SYSTEM_C64_6581:
return "SID 6581";
case DIV_SYSTEM_C64_8580:
return "SID 8580";
case DIV_SYSTEM_ARCADE:
return "Yamaha YM2151 + SegaPCM";
case DIV_SYSTEM_GENESIS_EXT:
return "Yamaha YM2612 (extended channel 3) + TI SN76489";
case DIV_SYSTEM_YM2610:
return "Yamaha YM2610";
case DIV_SYSTEM_YM2610_EXT:
return "Yamaha YM2610 (extended channel 2)";
// Furnace-specific systems
case DIV_SYSTEM_AY8910:
return "AY-3-8910";
case DIV_SYSTEM_AMIGA:
return "Paula";
case DIV_SYSTEM_YM2151:
return "Yamaha YM2151 standalone";
case DIV_SYSTEM_YM2612:
return "Yamaha YM2612 standalone";
case DIV_SYSTEM_TIA:
return "Atari TIA";
case DIV_SYSTEM_SAA1099:
return "Philips SAA1099";
case DIV_SYSTEM_AY8930:
return "Microchip AY8930";
}
return "Unknown";
}
const char* DivEngine::getSystemNameJ(DivSystem sys) {
switch (sys) {
case DIV_SYSTEM_NULL:

View File

@ -313,6 +313,9 @@ class DivEngine {
// get sys name
const char* getSystemName(DivSystem sys);
// get sys chips
const char* getSystemChips(DivSystem sys);
// get japanese system name
const char* getSystemNameJ(DivSystem sys);

View File

@ -338,6 +338,13 @@ void FurnaceGUI::decodeMMLStr(String& source, int* macro, unsigned char& macroLe
}
}
const char* FurnaceGUI::getSystemName(DivSystem which) {
if (settings.chipNames) {
return e->getSystemChips(which);
}
return e->getSystemName(which);
}
void FurnaceGUI::updateScroll(int amount) {
float lineHeight=(patFont->FontSize+2*dpiScale);
nextScroll=lineHeight*amount;
@ -349,7 +356,7 @@ void FurnaceGUI::addScroll(int amount) {
}
void FurnaceGUI::updateWindowTitle() {
String type=e->getSystemName(e->song.system[0]);
String type=getSystemName(e->song.system[0]);
if (e->song.systemLen>1) type="multi-system";
if (e->song.name.empty()) {
SDL_SetWindowTitle(sdlWin,fmt::sprintf("Furnace (%s)",type).c_str());
@ -1973,7 +1980,7 @@ void FurnaceGUI::drawMixer() {
bool doInvert=e->song.systemVol[i]&128;
signed char vol=e->song.systemVol[i]&127;
ImGui::PushID(id);
ImGui::Text("%d. %s",i+1,e->getSystemName(e->song.system[i]));
ImGui::Text("%d. %s",i+1,getSystemName(e->song.system[i]));
if (ImGui::SliderScalar("Volume",ImGuiDataType_S8,&vol,&_ZERO,&_ONE_HUNDRED_TWENTY_SEVEN)) {
e->song.systemVol[i]=(e->song.systemVol[i]&128)|vol;
}
@ -2670,6 +2677,11 @@ void FurnaceGUI::drawSettings() {
settings.macroView=macroViewB;
}
bool chipNamesB=settings.chipNames;
if (ImGui::Checkbox("Use chip names instead of system names",&chipNamesB)) {
settings.chipNames=chipNamesB;
}
ImGui::Separator();
if (ImGui::TreeNode("Color scheme")) {
@ -2788,6 +2800,7 @@ void FurnaceGUI::syncSettings() {
settings.macroView=e->getConfInt("macroView",0);
settings.fmNames=e->getConfInt("fmNames",0);
settings.allowEditDocking=e->getConfInt("allowEditDocking",0);
settings.chipNames=e->getConfInt("chipNames",0);
if (settings.fmNames<0 || settings.fmNames>2) settings.fmNames=0;
}
@ -2815,6 +2828,7 @@ void FurnaceGUI::commitSettings() {
e->setConf("macroView",settings.macroView);
e->setConf("fmNames",settings.fmNames);
e->setConf("allowEditDocking",settings.allowEditDocking);
e->setConf("chipNames",settings.chipNames);
PUT_UI_COLOR(GUI_COLOR_BACKGROUND);
PUT_UI_COLOR(GUI_COLOR_FRAME_BACKGROUND);
@ -4314,7 +4328,7 @@ void FurnaceGUI::processDrags(int dragX, int dragY) {
}
#define sysAddOption(x) \
if (ImGui::MenuItem(e->getSystemName(x))) { \
if (ImGui::MenuItem(getSystemName(x))) { \
if (!e->addSystem(x)) { \
showError("cannot add system! ("+e->getLastError()+")"); \
} \
@ -4322,7 +4336,7 @@ void FurnaceGUI::processDrags(int dragX, int dragY) {
}
#define sysChangeOption(x,y) \
if (ImGui::MenuItem(e->getSystemName(y),NULL,e->song.system[x]==y)) { \
if (ImGui::MenuItem(getSystemName(y),NULL,e->song.system[x]==y)) { \
e->changeSystem(x,y); \
updateWindowTitle(); \
}
@ -4484,7 +4498,7 @@ bool FurnaceGUI::loop() {
bool hasOneAtLeast=false;
for (int i=0; i<e->song.systemLen; i++) {
ImGui::BeginDisabled(!e->isVGMExportable(e->song.system[i]));
ImGui::Checkbox(fmt::sprintf("%d. %s##_SYSV%d",i+1,e->getSystemName(e->song.system[i]),i).c_str(),&willExport[i]);
ImGui::Checkbox(fmt::sprintf("%d. %s##_SYSV%d",i+1,getSystemName(e->song.system[i]),i).c_str(),&willExport[i]);
ImGui::EndDisabled();
if (!e->isVGMExportable(e->song.system[i])) {
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
@ -4529,7 +4543,7 @@ bool FurnaceGUI::loop() {
}
if (ImGui::BeginMenu("change system...")) {
for (int i=0; i<e->song.systemLen; i++) {
if (ImGui::BeginMenu(fmt::sprintf("%d. %s##_SYSC%d",i+1,e->getSystemName(e->song.system[i]),i).c_str())) {
if (ImGui::BeginMenu(fmt::sprintf("%d. %s##_SYSC%d",i+1,getSystemName(e->song.system[i]),i).c_str())) {
sysChangeOption(i,DIV_SYSTEM_GENESIS);
sysChangeOption(i,DIV_SYSTEM_GENESIS_EXT);
sysChangeOption(i,DIV_SYSTEM_SMS);
@ -4555,7 +4569,7 @@ bool FurnaceGUI::loop() {
}
if (ImGui::BeginMenu("remove system...")) {
for (int i=0; i<e->song.systemLen; i++) {
if (ImGui::MenuItem(fmt::sprintf("%d. %s##_SYSR%d",i+1,e->getSystemName(e->song.system[i]),i).c_str())) {
if (ImGui::MenuItem(fmt::sprintf("%d. %s##_SYSR%d",i+1,getSystemName(e->song.system[i]),i).c_str())) {
if (!e->removeSystem(i)) {
showError("cannot remove system! ("+e->getLastError()+")");
}

View File

@ -203,6 +203,7 @@ class FurnaceGUI {
int macroView;
int fmNames;
int allowEditDocking;
int chipNames;
unsigned int maxUndoSteps;
String mainFontPath;
String patFontPath;
@ -227,6 +228,7 @@ class FurnaceGUI {
macroView(0),
fmNames(0),
allowEditDocking(0),
chipNames(0),
maxUndoSteps(100),
mainFontPath(""),
patFontPath("") {}
@ -371,6 +373,8 @@ class FurnaceGUI {
void decodeMMLStr(String& source, int* macro, unsigned char& macroLen, signed char& macroLoop, int macroMin, int macroMax);
void decodeMMLStrW(String& source, int* macro, int& macroLen, int macroMax);
const char* getSystemName(DivSystem which);
public:
const char* noteName(short note, short octave);
bool decodeNote(const char* what, short& note, short& octave);