store pattern names

This commit is contained in:
tildearrow 2022-02-19 18:18:12 -05:00
parent 67ec998196
commit cda18d32b3
4 changed files with 24 additions and 6 deletions

View File

@ -25,6 +25,7 @@ furthermore, an `or reserved` indicates this field is always present, but is res
the format versions are:
- 51: Furnace 0.5.7pre3
- 50: Furnace 0.5.7pre2
- 49: Furnace 0.5.7pre1
- 48: Furnace 0.5.6
@ -105,6 +106,7 @@ size | description
| - 0x09: Neo Geo (YM2610) - 13 channels
| - bit 6 enables alternate mode:
| - 0x42: Genesis extended - 13 channels
| - 0x43: SMS (SN76489) + OPLL (YM2413) - 13 channels
| - 0x47: C64 (6581) - 3 channels
| - 0x49: Neo Geo extended - 16 channels
| - bit 7 for non-DefleMask chips:
@ -444,6 +446,7 @@ size | description
| - instrument
| - volume
| - effect and effect data...
STR | pattern name (>=51)
# the Furnace instrument format (.fui)

View File

@ -37,8 +37,8 @@
warnings+=(String("\n")+x); \
}
#define DIV_VERSION "0.5.7pre2"
#define DIV_ENGINE_VERSION 50
#define DIV_VERSION "0.5.7pre3"
#define DIV_ENGINE_VERSION 51
enum DivStatusView {
DIV_STATUS_NOTHING=0,

View File

@ -986,6 +986,10 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
pat->data[j][5+(k<<1)]=reader.readS();
}
}
if (ds.version>=51) {
pat->name=reader.readString();
}
}
if (reader.tell()<reader.size()) {
@ -1337,6 +1341,8 @@ SafeWriter* DivEngine::saveFur() {
w->writeS(pat->data[j][3]); // volume
w->write(&pat->data[j][4],2*song.pat[i>>16].effectRows*2); // effects
}
w->writeString(pat->name,false);
}
/// POINTERS

View File

@ -19,9 +19,10 @@
#include "gui.h"
#include "IconsFontAwesome4.h"
#include <imgui.h>
void FurnaceGUI::drawOrders() {
char selID[64];
static char selID[4096];
if (nextWindow==GUI_WINDOW_ORDERS) {
ordersOpen=true;
ImGui::SetNextWindowFocus();
@ -66,9 +67,9 @@ void FurnaceGUI::drawOrders() {
bool highlightLoop=(i>=loopOrder && i<=loopEnd);
if (highlightLoop) ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg,ImGui::GetColorU32(uiColors[GUI_COLOR_SONG_LOOP]));
if (settings.orderRowsBase==1) {
snprintf(selID,64,"%.2X##O_S%.2x",i,i);
snprintf(selID,4096,"%.2X##O_S%.2x",i,i);
} else {
snprintf(selID,64,"%d##O_S%.2x",i,i);
snprintf(selID,4096,"%d##O_S%.2x",i,i);
}
if (ImGui::Selectable(selID)) {
e->setOrder(i);
@ -79,7 +80,12 @@ void FurnaceGUI::drawOrders() {
for (int j=0; j<e->getTotalChannelCount(); j++) {
if (!e->song.chanShow[j]) continue;
ImGui::TableNextColumn();
snprintf(selID,64,"%.2X##O_%.2x_%.2x",e->song.orders.ord[j][i],j,i);
DivPattern* pat=e->song.pat[j].getPattern(e->song.orders.ord[j][i],false);
/*if (!pat->name.empty()) {
snprintf(selID,4096,"%s##O_%.2x_%.2x",pat->name.c_str(),j,i);
} else {*/
snprintf(selID,4096,"%.2X##O_%.2x_%.2x",e->song.orders.ord[j][i],j,i);
//}
if (ImGui::Selectable(selID,(orderEditMode!=0 && curOrder==i && orderCursor==j))) {
if (curOrder==i) {
if (orderEditMode==0) {
@ -106,6 +112,9 @@ void FurnaceGUI::drawOrders() {
}
}
}
if (!pat->name.empty() && ImGui::IsItemHovered()) {
ImGui::SetTooltip("%s",pat->name.c_str());
}
if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {
if (curOrder==i) {
if (orderEditMode==0) {