Merge branch 'master' into sysmgrtooltip_syschaninfo

This commit is contained in:
tildearrow 2024-10-10 02:38:18 -05:00
commit c6dfd4f10b
309 changed files with 93453 additions and 72703 deletions

View file

@ -39,7 +39,7 @@
#define FURNACE_APP_ID "org.tildearrow.furnace"
#define rightClickable if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) ImGui::SetKeyboardFocusHere(-1);
#define ctrlWheeling ((ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) && wheelY!=0)
#define ctrlWheeling (isCtrlWheelModifierHeld() && wheelY!=0)
#define handleUnimportant if (settings.insFocusesPattern && patternOpen) {nextWindow=GUI_WINDOW_PATTERN;}
#define unimportant(x) if (x) {handleUnimportant}
@ -66,10 +66,13 @@
logI("beep!"); \
}
#define BIND_FOR(x) getKeyName(actionKeys[x],true).c_str()
#define BIND_FOR(x) getMultiKeysName(actionKeys[x].data(),actionKeys[x].size(),true).c_str()
#define FM_PREVIEW_SIZE 512
#define CHECK_HIDDEN_SYSTEM(x) \
(x==DIV_SYSTEM_YMU759 || x==DIV_SYSTEM_UPD1771C || x==DIV_SYSTEM_DUMMY || x==DIV_SYSTEM_SEGAPCM_COMPAT || x==DIV_SYSTEM_PONG)
enum FurnaceGUIRenderBackend {
GUI_BACKEND_SDL=0,
GUI_BACKEND_GL3,
@ -137,6 +140,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)
@ -351,6 +357,9 @@ enum FurnaceGUIColors {
GUI_COLOR_INSTR_GBA_MINMOD,
GUI_COLOR_INSTR_BIFURCATOR,
GUI_COLOR_INSTR_SID2,
GUI_COLOR_INSTR_SUPERVISION,
GUI_COLOR_INSTR_UPD1771C,
GUI_COLOR_INSTR_SID3,
GUI_COLOR_INSTR_UNKNOWN,
GUI_COLOR_CHANNEL_BG,
@ -598,7 +607,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,
@ -642,6 +650,7 @@ enum FurnaceGUIWarnings {
GUI_WARN_CLEAR_HISTORY,
GUI_WARN_CV,
GUI_WARN_RESET_CONFIG,
GUI_WARN_IMPORT,
GUI_WARN_GENERIC
};
@ -651,7 +660,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
@ -817,6 +825,8 @@ enum FurnaceGUIActions {
GUI_ACTION_PAT_SCROLL_MODE,
GUI_ACTION_PAT_CLEAR_LATCH,
GUI_ACTION_PAT_ABSORB_INSTRUMENT,
GUI_ACTION_PAT_CURSOR_UNDO,
GUI_ACTION_PAT_CURSOR_REDO,
GUI_ACTION_PAT_MAX,
GUI_ACTION_INS_LIST_MIN,
@ -1102,6 +1112,22 @@ struct UndoStep {
newPatLen(0) {}
};
struct CursorJumpPoint {
SelectionPoint point;
int order;
int subSong;
CursorJumpPoint(const SelectionPoint& p, int o, int ss):
point(p), order(o), subSong(ss) {}
CursorJumpPoint():
point(), order(0), subSong(0) {}
bool operator== (const CursorJumpPoint& spot) {
return point.xCoarse==spot.point.xCoarse && point.xFine==spot.point.xFine && point.y==spot.point.y && order==spot.order && subSong==spot.subSong;
}
bool operator!= (const CursorJumpPoint& spot) {
return !(*this == spot);
}
};
// -1 = any
struct MIDIBind {
int type, channel, data1, data2;
@ -1594,7 +1620,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;
@ -1603,17 +1629,18 @@ class FurnaceGUI {
String mmlStringSNES[DIV_MAX_CHIPS];
String folderString;
struct PaletteSearchResult { int id; std::vector<int> highlightChars; };
std::vector<DivSystem> sysSearchResults;
std::vector<std::pair<DivSample*,bool>> sampleBankSearchResults;
std::vector<FurnaceGUISysDef> newSongSearchResults;
std::vector<int> paletteSearchResults;
std::vector<PaletteSearchResult> paletteSearchResults;
FixedQueue<String,32> recentFile;
std::vector<DivInstrumentType> makeInsTypeList;
std::vector<FurnaceGUIWaveSizeEntry> waveSizeList;
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;
@ -1634,7 +1661,6 @@ class FurnaceGUI {
int vgmExportTrailingTicks;
int cvHiScore;
int drawHalt;
int zsmExportTickRate;
int macroPointSize;
int waveEditStyle;
int displayInsTypeListMakeInsSample;
@ -1723,6 +1749,16 @@ class FurnaceGUI {
char emptyLabel[32];
char emptyLabel2[32];
std::vector<int> songOrdersLengths; // lengths of all orders (for drawing song export progress)
int songLength; // length of all the song in rows
int songLoopedSectionLength; // length of looped part of the song
int songFadeoutSectionLength; // length of fading part of the song
bool songHasSongEndCommand; // song has "Song end" command (FFxx)
int lengthOfOneFile; // length of one rendering pass. song length times num of loops + fadeout
int totalLength; // total length of render (lengthOfOneFile times num of files for per-channel export)
float curProgress;
int totalFiles;
struct Settings {
bool settingsChanged;
int mainFontSize, patFontSize, headFontSize, iconSize;
@ -1742,6 +1778,7 @@ class FurnaceGUI {
int opnbCore;
int opl2Core;
int opl3Core;
int opl4Core;
int esfmCore;
int opllCore;
int ayCore;
@ -1768,6 +1805,7 @@ class FurnaceGUI {
int opnbCoreRender;
int opl2CoreRender;
int opl3CoreRender;
int opl4CoreRender;
int esfmCoreRender;
int opllCoreRender;
int ayCoreRender;
@ -1794,6 +1832,7 @@ class FurnaceGUI {
int patRowsBase;
int orderRowsBase;
int soloAction;
int ctrlWheelModifier;
int pullDeleteBehavior;
int wrapHorizontal;
int wrapVertical;
@ -1802,7 +1841,6 @@ class FurnaceGUI {
int allowEditDocking;
int chipNames;
int overflowHighlight;
int partyTime;
int flatNotes;
int germanNotation;
int stepOnDelete;
@ -2004,6 +2042,7 @@ class FurnaceGUI {
opnbCore(1),
opl2Core(0),
opl3Core(0),
opl4Core(0),
esfmCore(0),
opllCore(0),
ayCore(0),
@ -2030,6 +2069,7 @@ class FurnaceGUI {
opnbCoreRender(1),
opl2CoreRender(0),
opl3CoreRender(0),
opl4CoreRender(0),
esfmCoreRender(0),
opllCoreRender(0),
ayCoreRender(0),
@ -2055,6 +2095,7 @@ class FurnaceGUI {
patRowsBase(0),
orderRowsBase(1),
soloAction(0),
ctrlWheelModifier(0),
pullDeleteBehavior(1),
wrapHorizontal(0),
wrapVertical(0),
@ -2063,7 +2104,6 @@ class FurnaceGUI {
allowEditDocking(1),
chipNames(0),
overflowHighlight(0),
partyTime(0),
germanNotation(0),
stepOnDelete(0),
scrollStep(0),
@ -2202,7 +2242,7 @@ class FurnaceGUI {
vsync(1),
frameRateLimit(60),
displayRenderTime(0),
inputRepeat(0),
inputRepeat(1),
glRedSize(8),
glGreenSize(8),
glBlueSize(8),
@ -2244,13 +2284,20 @@ class FurnaceGUI {
struct Tutorial {
bool introPlayed;
bool protoWelcome;
bool importedMOD, importedS3M, importedXM, importedIT;
double popupTimer;
Tutorial():
#ifdef SUPPORT_XP
introPlayed(true),
#else
introPlayed(false),
#endif
protoWelcome(false) {
protoWelcome(false),
importedMOD(false),
importedS3M(false),
importedXM(false),
importedIT(false),
popupTimer(10.0f) {
}
} tutorial;
@ -2263,6 +2310,9 @@ class FurnaceGUI {
std::vector<ImWchar> localeExtraRanges;
DivInstrument* prevInsData;
DivInstrument cachedCurIns;
DivInstrument* cachedCurInsPtr;
bool insEditMayBeDirty;
unsigned char* pendingLayoutImport;
size_t pendingLayoutImportLen;
@ -2328,7 +2378,7 @@ class FurnaceGUI {
// bit 28: meta (win)
// bit 27: alt
// bit 24-26: reserved
int actionKeys[GUI_ACTION_MAX];
std::vector<int> actionKeys[GUI_ACTION_MAX];
std::map<int,int> actionMapGlobal;
std::map<int,int> actionMapPat;
@ -2448,7 +2498,7 @@ class FurnaceGUI {
int waveDragMin, waveDragMax;
bool waveDragActive;
int bindSetTarget, bindSetPrevValue;
int bindSetTarget, bindSetTargetIdx, bindSetPrevValue;
bool bindSetActive, bindSetPending;
float nextScroll, nextAddScroll, orderScroll, orderScrollSlideOrigin;
@ -2491,6 +2541,8 @@ class FurnaceGUI {
std::map<unsigned short,DivPattern*> oldPatMap;
FixedQueue<UndoStep,256> undoHist;
FixedQueue<UndoStep,256> redoHist;
FixedQueue<CursorJumpPoint,256> cursorUndoHist;
FixedQueue<CursorJumpPoint,256> cursorRedoHist;
// sample editor specific
double sampleZoom;
@ -2704,16 +2756,17 @@ 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);
void drawSSGEnv(unsigned char type, const ImVec2& size);
void drawWaveform(unsigned char type, bool opz, const ImVec2& size);
void drawWaveformSID3(unsigned char type, const ImVec2& size);
void drawAlgorithm(unsigned char alg, FurnaceGUIFMAlgs algType, const ImVec2& size);
void drawESFMAlgorithm(DivInstrumentESFM& esfm, const ImVec2& size);
void drawFMEnv(unsigned char tl, unsigned char ar, unsigned char dr, unsigned char d2r, unsigned char rr, unsigned char sl, unsigned char sus, unsigned char egt, unsigned char algOrGlobalSus, float maxTl, float maxArDr, float maxRr, const ImVec2& size, unsigned short instType);
void drawSID3Env(unsigned char tl, unsigned char ar, unsigned char dr, unsigned char d2r, unsigned char rr, unsigned char sl, unsigned char sus, unsigned char egt, unsigned char algOrGlobalSus, float maxTl, float maxArDr, float maxRr, const ImVec2& size, unsigned short instType);
void drawGBEnv(unsigned char vol, unsigned char len, unsigned char sLen, bool dir, const ImVec2& size);
bool drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& flags, bool modifyOnChange, bool fromMenu=false);
void kvsConfig(DivInstrument* ins, bool supportsKVS=true);
@ -2730,6 +2783,7 @@ class FurnaceGUI {
static bool LocalizedComboGetter(void* data, int idx, const char** out_text);
// these ones offer ctrl-wheel fine value changes.
bool isCtrlWheelModifierHeld() const;
bool CWSliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format=NULL, ImGuiSliderFlags flags=0);
bool CWVSliderScalar(const char* label, const ImVec2& size, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format=NULL, ImGuiSliderFlags flags=0);
bool CWSliderInt(const char* label, int* v, int v_min, int v_max, const char* format="%d", ImGuiSliderFlags flags=0);
@ -2776,6 +2830,7 @@ class FurnaceGUI {
void insTabFMModernHeader(DivInstrument* ins);
void insTabFM(DivInstrument* ins);
void insTabWavetable(DivInstrument* ins);
void insTabSample(DivInstrument* ins);
void drawOrderButtons();
@ -2783,6 +2838,8 @@ class FurnaceGUI {
void actualWaveList();
void actualSampleList();
// HACK: template. any way to remove it?
template<typename func_waveItemData> void waveListHorizontalGroup(float* wavePreview, int dir, int count, const func_waveItemData& waveItemData);
void insListItem(int index, int dir, int asset);
void waveListItem(int index, float* wavePreview, int dir, int asset);
void sampleListItem(int index, int dir, int asset);
@ -2796,8 +2853,6 @@ class FurnaceGUI {
void pushToggleColors(bool status);
void popToggleColors();
void highlightWindow(const char* winName);
FurnaceGUIImage* getImage(FurnaceGUIImages image);
FurnaceGUITexture* getTexture(FurnaceGUIImages image, FurnaceGUIBlendMode blendMode=GUI_BLEND_MODE_BLEND);
void drawImage(ImDrawList* dl, FurnaceGUIImages image, const ImVec2& pos, const ImVec2& scale, double rotate, const ImVec2& uvMin, const ImVec2& uvMax, const ImVec4& imgColor);
@ -2812,6 +2867,7 @@ class FurnaceGUI {
void drawPattern();
void drawInsList(bool asChild=false);
void drawInsEdit();
void drawInsSID3(DivInstrument* ins);
void drawWaveList(bool asChild=false);
void drawWaveEdit();
void drawSampleList(bool asChild=false);
@ -2824,7 +2880,7 @@ class FurnaceGUI {
void drawMemory();
void drawCompatFlags();
void drawPiano();
void drawNotes();
void drawNotes(bool asChild=false);
void drawChannels();
void drawPatManager();
void drawSysManager();
@ -2849,8 +2905,10 @@ class FurnaceGUI {
void drawSystemChannelInfo(const DivSysDef* whichDef);
void drawSystemChannelInfoText(const DivSysDef* whichDef);
void assignActionMap(std::map<int,int>& actionMap, int first, int last);
void drawKeybindSettingsTableRow(FurnaceGUIActions actionIdx);
void parseKeybinds();
void promptKey(int which);
void promptKey(int which, int bindIdx);
void doAction(int what);
bool importColors(String path);
@ -2916,22 +2974,33 @@ class FurnaceGUI {
void doExpand(int multiplier, const SelectionPoint& sStart, const SelectionPoint& sEnd);
void doCollapseSong(int divider);
void doExpandSong(int multiplier);
void doAbsorbInstrument();
void doUndo();
void doRedo();
void doFind();
void doReplace();
void doDrag();
void editOptions(bool topMenu);
DivSystem systemPicker();
DivSystem systemPicker(bool fullWidth);
void noteInput(int num, int key, int vol=-1);
void valueInput(int num, bool direct=false, int target=-1);
void orderInput(int num);
void doGenerateWave();
CursorJumpPoint getCurrentCursorJumpPoint();
void applyCursorJumpPoint(const CursorJumpPoint& spot);
void makeCursorUndo();
void doCursorUndo();
void doCursorRedo();
void doUndoSample();
void doRedoSample();
void checkRecordInstrumentUndoStep();
void doUndoInstrument();
void doRedoInstrument();
void play(int row=0);
void setOrder(unsigned char order, bool forced=false);
void stop();