Fix NotesLoaderDWI.cpp
This resolves the following issues with DWI format simfiles: - DWI files containing valid charts may fail to load and appear to have 0 or 1 notes - DWI files opened in the editor would not save the original contents of the chart into a new file
This commit is contained in:
+11
-1
@@ -190,6 +190,12 @@ static StepsType GetTypeFromMode(const RString &mode)
|
|||||||
static NoteData ParseNoteData(RString &step1, RString &step2,
|
static NoteData ParseNoteData(RString &step1, RString &step2,
|
||||||
Steps &out, const RString &path)
|
Steps &out, const RString &path)
|
||||||
{
|
{
|
||||||
|
if (step1.size() < 2 && step2.size() < 2)
|
||||||
|
{
|
||||||
|
LOG->Warn("Didn't get enough data when attempting to load a DWI file");
|
||||||
|
// Handle the error by returning an empty NoteData object
|
||||||
|
return NoteData();
|
||||||
|
}
|
||||||
g_mapDanceNoteToNoteDataColumn.clear();
|
g_mapDanceNoteToNoteDataColumn.clear();
|
||||||
switch( out.m_StepsType )
|
switch( out.m_StepsType )
|
||||||
{
|
{
|
||||||
@@ -300,7 +306,7 @@ static NoteData ParseNoteData(RString &step1, RString &step2,
|
|||||||
/* It's a jump.
|
/* It's a jump.
|
||||||
* We need to keep reading notes until we hit a >. */
|
* We need to keep reading notes until we hit a >. */
|
||||||
jump = true;
|
jump = true;
|
||||||
i++;
|
c = sStepData[i++];
|
||||||
}
|
}
|
||||||
|
|
||||||
const int iIndex = BeatToNoteRow( (float)fCurrentBeat );
|
const int iIndex = BeatToNoteRow( (float)fCurrentBeat );
|
||||||
@@ -355,6 +361,10 @@ static NoteData ParseNoteData(RString &step1, RString &step2,
|
|||||||
iIndex,
|
iIndex,
|
||||||
TAP_ORIGINAL_HOLD_HEAD);
|
TAP_ORIGINAL_HOLD_HEAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (jump && i < sStepData.size()) {
|
||||||
|
c = sStepData[i++];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while( jump );
|
while( jump );
|
||||||
fCurrentBeat += fCurrentIncrementer;
|
fCurrentBeat += fCurrentIncrementer;
|
||||||
|
|||||||
Reference in New Issue
Block a user