Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -406,4 +406,7 @@ vcpkg_installed
build
out
enc_temp_folder

# Build outputs and user-specific files
bin/
/path_sources
2 changes: 1 addition & 1 deletion bin/settings/shortcuts.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FILE_OPEN = ctrl + o
FILE_SAVE = ctrl + s
FILE_SAVE_AS =
FILE_SAVE_AS =
FILE_CLOSE =

OPEN_DIALOG_SONG_PROPERTIES = shift + p
Expand Down
32 changes: 21 additions & 11 deletions src/Editor/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,12 @@ static SDL_DialogFileFilter loadFilters[] = {
{"All Files (*.*)", "*"},
};

#define SAVE_FILTERS_COUNT 4
static SDL_DialogFileFilter saveFilters[] = {{"Stepmania/ITG (*.sm)", "sm"},
{"Stepmania 5 (*.ssc)", "ssc"},
{"Osu!mania (*.osu)", "osu"},
{"All Files (*.*)", "*"}};
#define SAVE_FILTERS_COUNT 5
static SDL_DialogFileFilter saveFilters[] = {
{"Stepmania/ITG (*.sm)", "sm"}, {"Stepmania 5 (*.ssc)", "ssc"},
{"Osu!mania (*.osu)", "osu"}, {"Dance With Intensity (*.dwi)", "dwi"},
{"All Files (*.*)", "*"},
};
struct DialogSegment {
Segment::Type type;
int row;
Expand Down Expand Up @@ -589,12 +590,15 @@ struct EditorImpl : public Editor, public InputHandler {
switch (saveFmt) {
default:
case SIM_SM:
filterIndex = 1;
filterIndex = 0;
break;
case SIM_SSC:
filterIndex = 2;
filterIndex = 1;
break;
case SIM_OSU:
filterIndex = 2;
break;
case SIM_DWI:
filterIndex = 3;
break;
};
Expand All @@ -610,21 +614,27 @@ struct EditorImpl : public Editor, public InputHandler {
if (save_path.empty()) return false;

// Update the save format based on the selected filter index.
// SDL3 returns 0-based filter indices (getFilterIndex subtracts 1).
switch (filterIndex) {
case 1:
case 0:
saveFmt = SIM_SM;
break;
case 2:
case 1:
saveFmt = SIM_SSC;
break;
case 3:
case 2:
saveFmt = SIM_OSU;
break;
case 3:
saveFmt = SIM_DWI;
break;
default:
if (ext == ".ssc") {
saveFmt = SIM_SSC;
} else if (ext == ".osu") {
saveFmt = SIM_OSU;
} else if (ext == ".dwi") {
saveFmt = SIM_DWI;
} else {
saveFmt = SIM_SM;
}
Expand All @@ -642,7 +652,7 @@ struct EditorImpl : public Editor, public InputHandler {
// Saving multiple formats.
std::vector<SimFormat> save = myDefaultSaveFormat;
SimFormat fmt = gSimfile->get()->format;
if (fmt == SIM_NONE || fmt == SIM_DWI) {
if (fmt == SIM_NONE) {
fmt = save[0];
}
save.erase(std::remove(save.begin(), save.end(), fmt), save.end());
Expand Down
1 change: 1 addition & 0 deletions src/Simfile/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ list(APPEND SRC
"NoteList.cpp"
"Notes.cpp"
"Parsing.cpp"
"SaveDwi.cpp"
"SaveOsu.cpp"
"SaveSm.cpp"
"SegmentGroup.cpp"
Expand Down
14 changes: 9 additions & 5 deletions src/Simfile/LoadDwi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ static bool ParseNotes(Simfile* sim, char* p, int numPads, int numCols,
++n;
break;
case '{':
quantization = 4;
quantization = 3;
++n;
break;
case '`':
Expand All @@ -278,12 +278,12 @@ static bool ParseNotes(Simfile* sim, char* p, int numPads, int numCols,
++n;
break;
case '\'':
quantization = 32;
quantization = 24;
++n;
break;
default:
n = ReadNoteRow(n, chart->notes, row, map, holds,
quantization);
192 / quantization);
row += quantization;
break;
};
Expand Down Expand Up @@ -384,6 +384,10 @@ static void ParseTag(Simfile* sim, std::string tag, char* val) {
sim->genre = val;
} else if (tag == "DISPLAYBPM") {
ParseDisplayBpm(sim->tempo, val);
} else if (tag == "SAMPLESTART") {
ParseVal(val, sim->previewStart);
} else if (tag == "SAMPLELENGTH") {
ParseVal(val, sim->previewLength);
}
}

Expand All @@ -407,8 +411,8 @@ bool LoadDwi(fs::path path, Simfile* sim) {
auto simname = sim->file;
simname = simname.substr(0, simname.find_last_of("."));
Str::toLower(simname);
for (auto& path : paths) {
std::string f = pathToUtf8(path.filename());
for (auto& filePath : paths) {
std::string f = pathToUtf8(filePath.filename());
std::string fl(f);
Str::toLower(fl);

Expand Down
5 changes: 4 additions & 1 deletion src/Simfile/Parsing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ bool SaveOsu(SAVE_ARGS); // Defined in SaveOsu.cpp
}; // namespace Osu
namespace Dwi {
bool LoadDwi(LOAD_ARGS); // Defined in LoadDwi.cpp
};
bool SaveDwi(SAVE_ARGS); // Defined in SaveDwi.cpp
}; // namespace Dwi

// ================================================================================================
// Parsing utilities.
Expand Down Expand Up @@ -206,6 +207,8 @@ bool SaveSimfile(const Simfile& sim, SimFormat format, bool backup) {
return Sm::SaveSsc(&sim, backup);
case SIM_OSU:
return Osu::SaveOsu(&sim, backup);
case SIM_DWI:
return Dwi::SaveDwi(&sim, backup);
};
return false;
}
Expand Down
Loading
Loading