Merge branch 'tildearrow:master' into SID3

This commit is contained in:
LTVA1 2024-08-19 21:44:23 +03:00 committed by GitHub
commit c26fa0c1f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 549 additions and 484 deletions

View file

@ -123,16 +123,16 @@ void FurnaceGUI::doAction(int what) {
pendingStepUpdate=1;
break;
case GUI_ACTION_OCTAVE_UP:
if (++curOctave>7) {
curOctave=7;
if (++curOctave>GUI_EDIT_OCTAVE_MAX) {
curOctave=GUI_EDIT_OCTAVE_MAX;
} else {
e->autoNoteOffAll();
failedNoteOn=false;
}
break;
case GUI_ACTION_OCTAVE_DOWN:
if (--curOctave<-5) {
curOctave=-5;
if (--curOctave<GUI_EDIT_OCTAVE_MIN) {
curOctave=GUI_EDIT_OCTAVE_MIN;
} else {
e->autoNoteOffAll();
failedNoteOn=false;
@ -679,10 +679,26 @@ void FurnaceGUI::doAction(int what) {
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) {
bool foundIns=false;
bool foundOctave=false;
for (int i=cursor.y; i>=0 && !(foundIns && foundOctave); i--) {
// absorb most recent instrument
if (!foundIns && pat->data[i][2] >= 0) {
curIns=pat->data[i][2];
break;
foundIns=true;
}
// absorb most recent octave (i.e. set curOctave such that the "main row" (QWERTY) of notes
// will result in an octave number equal to the previous note).
if (!foundOctave && pat->data[i][0] != 0) {
// decode octave data (was signed cast to unsigned char)
int octave=pat->data[i][1];
if (octave>128) octave-=256;
// @NOTE the special handling when note==12, which is really an octave above what's
// stored in the octave data. without this handling, if you press Q, then
// "ABSORB_INSTRUMENT", then Q again, you'd get a different octave!
if (pat->data[i][0]==12) octave++;
curOctave=CLAMP(octave-1, GUI_EDIT_OCTAVE_MIN, GUI_EDIT_OCTAVE_MAX);
foundOctave=true;
}
}
break;

View file

@ -647,8 +647,8 @@ void FurnaceGUI::drawEditControls() {
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::InputInt("##Octave",&curOctave,1,1)) {
if (curOctave>7) curOctave=7;
if (curOctave<-5) curOctave=-5;
if (curOctave>GUI_EDIT_OCTAVE_MAX) curOctave=GUI_EDIT_OCTAVE_MAX;
if (curOctave<GUI_EDIT_OCTAVE_MIN) curOctave=GUI_EDIT_OCTAVE_MIN;
e->autoNoteOffAll();
failedNoteOn=false;
@ -808,8 +808,8 @@ void FurnaceGUI::drawEditControls() {
ImGui::SameLine();
ImGui::SetNextItemWidth(96.0f*dpiScale);
if (ImGui::InputInt("##Octave",&curOctave,1,1)) {
if (curOctave>7) curOctave=7;
if (curOctave<-5) curOctave=-5;
if (curOctave>GUI_EDIT_OCTAVE_MAX) curOctave=GUI_EDIT_OCTAVE_MAX;
if (curOctave<GUI_EDIT_OCTAVE_MIN) curOctave=GUI_EDIT_OCTAVE_MIN;
e->autoNoteOffAll();
failedNoteOn=false;
@ -926,8 +926,8 @@ void FurnaceGUI::drawEditControls() {
float avail=ImGui::GetContentRegionAvail().x;
ImGui::SetNextItemWidth(avail);
if (ImGui::InputInt("##Octave",&curOctave,0,0)) {
if (curOctave>7) curOctave=7;
if (curOctave<-5) curOctave=-5;
if (curOctave>GUI_EDIT_OCTAVE_MAX) curOctave=GUI_EDIT_OCTAVE_MAX;
if (curOctave<GUI_EDIT_OCTAVE_MIN) curOctave=GUI_EDIT_OCTAVE_MIN;
e->autoNoteOffAll();
failedNoteOn=false;
@ -1093,8 +1093,8 @@ void FurnaceGUI::drawEditControls() {
float avail=ImGui::GetContentRegionAvail().x;
ImGui::SetNextItemWidth(avail);
if (ImGui::InputInt("##Octave",&curOctave,1,1)) {
if (curOctave>7) curOctave=7;
if (curOctave<-5) curOctave=-5;
if (curOctave>GUI_EDIT_OCTAVE_MAX) curOctave=GUI_EDIT_OCTAVE_MAX;
if (curOctave<GUI_EDIT_OCTAVE_MIN) curOctave=GUI_EDIT_OCTAVE_MIN;
e->autoNoteOffAll();
failedNoteOn=false;

View file

@ -319,6 +319,29 @@ void FurnaceGUI::drawExportROM(bool onWindow) {
}
break;
}
case DIV_ROM_ZSM: {
int zsmExportTickRate=romConfig.getInt("zsmrate",60);
bool zsmExportLoop=romConfig.getBool("loop",true);
bool zsmExportOptimize=romConfig.getBool("optimize",true);
if (ImGui::InputInt(_("Tick Rate (Hz)"),&zsmExportTickRate,1,2)) {
if (zsmExportTickRate<1) zsmExportTickRate=1;
if (zsmExportTickRate>44100) zsmExportTickRate=44100;
altered=true;
}
if (ImGui::Checkbox(_("loop"),&zsmExportLoop)) {
altered=true;
}
if (ImGui::Checkbox(_("optimize size"),&zsmExportOptimize)) {
altered=true;
}
if (altered) {
romConfig.set("zsmrate",zsmExportTickRate);
romConfig.set("loop",zsmExportLoop);
romConfig.set("optimize",zsmExportOptimize);
}
break;
}
case DIV_ROM_ABSTRACT:
ImGui::TextWrapped("%s",_("select a target from the menu at the top of this dialog."));
break;
@ -340,28 +363,6 @@ void FurnaceGUI::drawExportROM(bool onWindow) {
}
}
void FurnaceGUI::drawExportZSM(bool onWindow) {
exitDisabledTimer=1;
ImGui::Text(_("Commander X16 Zsound Music File"));
if (ImGui::InputInt(_("Tick Rate (Hz)"),&zsmExportTickRate,1,2)) {
if (zsmExportTickRate<1) zsmExportTickRate=1;
if (zsmExportTickRate>44100) zsmExportTickRate=44100;
}
ImGui::Checkbox(_("loop"),&zsmExportLoop);
ImGui::SameLine();
ImGui::Checkbox(_("optimize size"),&zsmExportOptimize);
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_ZSM);
ImGui::CloseCurrentPopup();
}
}
void FurnaceGUI::drawExportText(bool onWindow) {
exitDisabledTimer=1;
@ -444,16 +445,6 @@ void FurnaceGUI::drawExport() {
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++;
}
if (numZSMCompat>0) {
if (ImGui::BeginTabItem(_("ZSM"))) {
drawExportZSM(true);
ImGui::EndTabItem();
}
}
if (ImGui::BeginTabItem(_("Text"))) {
drawExportText(true);
ImGui::EndTabItem();
@ -478,9 +469,6 @@ void FurnaceGUI::drawExport() {
case GUI_EXPORT_ROM:
drawExportROM(true);
break;
case GUI_EXPORT_ZSM:
drawExportZSM(true);
break;
case GUI_EXPORT_TEXT:
drawExportText(true);
break;

View file

@ -2022,16 +2022,6 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
(settings.autoFillSave)?shortName:""
);
break;
case GUI_FILE_EXPORT_ZSM:
if (!dirExists(workingDirZSMExport)) workingDirZSMExport=getHomeDir();
hasOpened=fileDialog->openSave(
_("Export ZSM"),
{_("ZSM file"), "*.zsm"},
workingDirZSMExport,
dpiScale,
(settings.autoFillSave)?shortName:""
);
break;
case GUI_FILE_EXPORT_TEXT:
if (!dirExists(workingDirROMExport)) workingDirROMExport=getHomeDir();
hasOpened=fileDialog->openSave(
@ -4405,16 +4395,6 @@ bool FurnaceGUI::loop() {
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++;
}
if (numZSMCompat>0) {
if (ImGui::BeginMenu(_("export ZSM..."))) {
drawExportZSM();
ImGui::EndMenu();
}
}
if (ImGui::BeginMenu(_("export text..."))) {
drawExportText();
ImGui::EndMenu();
@ -4442,16 +4422,6 @@ bool FurnaceGUI::loop() {
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++;
}
if (numZSMCompat>0) {
if (ImGui::MenuItem(_("export ZSM..."))) {
curExportType=GUI_EXPORT_ZSM;
displayExport=true;
}
}
if (ImGui::MenuItem(_("export text..."))) {
curExportType=GUI_EXPORT_TEXT;
displayExport=true;
@ -5034,9 +5004,6 @@ bool FurnaceGUI::loop() {
case GUI_FILE_EXPORT_VGM:
workingDirVGMExport=fileDialog->getPath()+DIR_SEPARATOR_STR;
break;
case GUI_FILE_EXPORT_ZSM:
workingDirZSMExport=fileDialog->getPath()+DIR_SEPARATOR_STR;
break;
case GUI_FILE_EXPORT_ROM:
case GUI_FILE_EXPORT_TEXT:
case GUI_FILE_EXPORT_CMDSTREAM:
@ -5136,9 +5103,6 @@ bool FurnaceGUI::loop() {
if (curFileDialog==GUI_FILE_EXPORT_ROM) {
checkExtension(romFilterExt.c_str());
}
if (curFileDialog==GUI_FILE_EXPORT_ZSM) {
checkExtension(".zsm");
}
if (curFileDialog==GUI_FILE_EXPORT_TEXT) {
checkExtension(".txt");
}
@ -5614,27 +5578,6 @@ bool FurnaceGUI::loop() {
}
break;
}
case GUI_FILE_EXPORT_ZSM: {
SafeWriter* w=e->saveZSM(zsmExportTickRate,zsmExportLoop,zsmExportOptimize);
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 ZSM! (%s)"),e->getLastError()));
}
break;
}
case GUI_FILE_EXPORT_ROM:
romExportPath=copyOfName;
pendingExport=e->buildROM(romTarget);
@ -7879,7 +7822,6 @@ void FurnaceGUI::syncState() {
workingDirSample=e->getConfString("lastDirSample",workingDir);
workingDirAudioExport=e->getConfString("lastDirAudioExport",workingDir);
workingDirVGMExport=e->getConfString("lastDirVGMExport",workingDir);
workingDirZSMExport=e->getConfString("lastDirZSMExport",workingDir);
workingDirROMExport=e->getConfString("lastDirROMExport",workingDir);
workingDirFont=e->getConfString("lastDirFont",workingDir);
workingDirColors=e->getConfString("lastDirColors",workingDir);
@ -8038,7 +7980,6 @@ void FurnaceGUI::commitState(DivConfig& conf) {
conf.set("lastDirSample",workingDirSample);
conf.set("lastDirAudioExport",workingDirAudioExport);
conf.set("lastDirVGMExport",workingDirVGMExport);
conf.set("lastDirZSMExport",workingDirZSMExport);
conf.set("lastDirROMExport",workingDirROMExport);
conf.set("lastDirFont",workingDirFont);
conf.set("lastDirColors",workingDirColors);
@ -8256,8 +8197,6 @@ FurnaceGUI::FurnaceGUI():
displayError(false),
displayExporting(false),
vgmExportLoop(true),
zsmExportLoop(true),
zsmExportOptimize(true),
vgmExportPatternHints(false),
vgmExportDirectStream(false),
displayInsTypeList(false),
@ -8300,7 +8239,6 @@ FurnaceGUI::FurnaceGUI():
vgmExportVersion(0x171),
vgmExportTrailingTicks(-1),
drawHalt(10),
zsmExportTickRate(60),
macroPointSize(16),
waveEditStyle(0),
displayInsTypeListMakeInsSample(-1),

View file

@ -137,6 +137,9 @@ enum FurnaceGUIRenderBackend {
#define ngettext momo_ngettext
#endif
#define GUI_EDIT_OCTAVE_MIN -5
#define GUI_EDIT_OCTAVE_MAX 7
// TODO:
// - add colors for FM envelope and waveform
// - maybe add "alternate" color for FM modulators/carriers (a bit difficult)
@ -599,7 +602,6 @@ enum FurnaceGUIFileDialogs {
GUI_FILE_EXPORT_AUDIO_PER_SYS,
GUI_FILE_EXPORT_AUDIO_PER_CHANNEL,
GUI_FILE_EXPORT_VGM,
GUI_FILE_EXPORT_ZSM,
GUI_FILE_EXPORT_CMDSTREAM,
GUI_FILE_EXPORT_TEXT,
GUI_FILE_EXPORT_ROM,
@ -652,7 +654,6 @@ enum FurnaceGUIExportTypes {
GUI_EXPORT_AUDIO=0,
GUI_EXPORT_VGM,
GUI_EXPORT_ROM,
GUI_EXPORT_ZSM,
GUI_EXPORT_CMD_STREAM,
GUI_EXPORT_TEXT,
GUI_EXPORT_DMF
@ -1595,7 +1596,7 @@ class FurnaceGUI {
String workingDir, fileName, clipboard, warnString, errorString, lastError, curFileName, nextFile, sysSearchQuery, newSongQuery, paletteQuery, sampleBankSearchQuery;
String workingDirSong, workingDirIns, workingDirWave, workingDirSample, workingDirAudioExport;
String workingDirVGMExport, workingDirZSMExport, workingDirROMExport;
String workingDirVGMExport, workingDirROMExport;
String workingDirFont, workingDirColors, workingDirKeybinds;
String workingDirLayout, workingDirROM, workingDirTest;
String workingDirConfig;
@ -1614,7 +1615,7 @@ class FurnaceGUI {
std::vector<String> availRenderDrivers;
std::vector<String> availAudioDrivers;
bool quit, warnQuit, willCommit, edit, editClone, isPatUnique, modified, displayError, displayExporting, vgmExportLoop, zsmExportLoop, zsmExportOptimize, vgmExportPatternHints;
bool quit, warnQuit, willCommit, edit, editClone, isPatUnique, modified, displayError, displayExporting, vgmExportLoop, vgmExportPatternHints;
bool vgmExportDirectStream, displayInsTypeList, displayWaveSizeList;
bool portrait, injectBackUp, mobileMenuOpen, warnColorPushed;
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
@ -1635,7 +1636,6 @@ class FurnaceGUI {
int vgmExportTrailingTicks;
int cvHiScore;
int drawHalt;
int zsmExportTickRate;
int macroPointSize;
int waveEditStyle;
int displayInsTypeListMakeInsSample;
@ -2701,7 +2701,6 @@ class FurnaceGUI {
void drawExportAudio(bool onWindow=false);
void drawExportVGM(bool onWindow=false);
void drawExportROM(bool onWindow=false);
void drawExportZSM(bool onWindow=false);
void drawExportText(bool onWindow=false);
void drawExportCommand(bool onWindow=false);
void drawExportDMF(bool onWindow=false);

View file

@ -688,7 +688,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_ABSORB_INSTRUMENT", _N("Absorb instrument/octave from status at cursor"), 0),
D("PAT_MAX", "", NOT_AN_ACTION),
D("INS_LIST_MIN", _N("---Instrument list"), NOT_AN_ACTION),

View file

@ -1204,62 +1204,62 @@ void FurnaceGUI::initSystemPresets() {
}
);
SUB_ENTRY(
"Sega TeraDrive", {
CH(DIV_SYSTEM_YM2612, 1.0f, 0, ""),
CH(DIV_SYSTEM_SMS, 0.5f, 0, ""),
CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "")
"Sega TeraDrive", {
CH(DIV_SYSTEM_YM2612, 1.0f, 0, ""),
CH(DIV_SYSTEM_SMS, 0.5f, 0, ""),
CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "")
}
);
SUB_SUB_ENTRY(
"Sega TeraDrive (extended channel 3)", {
CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, ""),
CH(DIV_SYSTEM_SMS, 0.5f, 0, ""),
CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "")
"Sega TeraDrive (extended channel 3)", {
CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, ""),
CH(DIV_SYSTEM_SMS, 0.5f, 0, ""),
CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "")
}
);
SUB_SUB_ENTRY(
"Sega TeraDrive (CSM)", {
CH(DIV_SYSTEM_YM2612_CSM, 1.0f, 0, ""),
CH(DIV_SYSTEM_SMS, 0.5f, 0, ""),
CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "")
"Sega TeraDrive (CSM)", {
CH(DIV_SYSTEM_YM2612_CSM, 1.0f, 0, ""),
CH(DIV_SYSTEM_SMS, 0.5f, 0, ""),
CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "")
}
);
SUB_SUB_ENTRY(
"Sega TeraDrive (DualPCM)", {
CH(DIV_SYSTEM_YM2612_DUALPCM, 1.0f, 0, ""),
CH(DIV_SYSTEM_SMS, 0.5f, 0, ""),
CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "")
"Sega TeraDrive (DualPCM)", {
CH(DIV_SYSTEM_YM2612_DUALPCM, 1.0f, 0, ""),
CH(DIV_SYSTEM_SMS, 0.5f, 0, ""),
CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "")
}
);
SUB_SUB_ENTRY(
"Sega TeraDrive (DualPCM, extended channel 3)", {
CH(DIV_SYSTEM_YM2612_DUALPCM_EXT, 1.0f, 0, ""),
CH(DIV_SYSTEM_SMS, 0.5f, 0, ""),
CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "")
"Sega TeraDrive (DualPCM, extended channel 3)", {
CH(DIV_SYSTEM_YM2612_DUALPCM_EXT, 1.0f, 0, ""),
CH(DIV_SYSTEM_SMS, 0.5f, 0, ""),
CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "")
}
);
ENTRY(
_("Sharp X1"), {
CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=3")
}
}
);
SUB_ENTRY(
_("Sharp X1 + FM Addon"), {
CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=3"),
CH(DIV_SYSTEM_YM2151, 1.0f, 0, "clockSel=2")
}
}
);
ENTRY(
_("Sharp X68000"), {
CH(DIV_SYSTEM_YM2151, 1.0f, 0, "clockSel=2"),
CH(DIV_SYSTEM_MSM6258, 1.0f, 0, "clockSel=2")
}
}
);
ENTRY(
_("FM-7"), {
CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=12"),
CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=5")
}
}
);
SUB_ENTRY(
_("FM-7 (extended channel 3)"), {