Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

WIP: Maybe parse a session based cue correctly? #1841

Open
wants to merge 1 commit into
base: alpha
Choose a base branch
from
Open
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions libswirl/imgread/cue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ Disc* cue_parse(const wchar* file)
u32 current_fad = 150;
string track_filename;
u32 track_number = -1;
u32 session_number = -1;
string track_type;
bool first_track = false;

while (!cuesheet.eof())
{
Expand All @@ -78,6 +80,12 @@ Disc* cue_parse(const wchar* file)
{
current_fad = 45000 + 150;
}
else if (token == "SESSION")
{
first_track = true;
cuesheet >> session_number;
continue;
}
else if (token != "SINGLE-DENSITY")
printf("CUE parse error: unrecognized REM token %s. Expected SINGLE-DENSITY or HIGH-DENSITY\n", token.c_str());
cuesheet >> token;
Expand Down Expand Up @@ -116,6 +124,16 @@ Disc* cue_parse(const wchar* file)
{
cuesheet >> track_number;
cuesheet >> track_type;

if (first_track)
{
first_track = false;

Session s;
s.StartFAD=(u32)(current_fad);
s.FirstTrack=track_number;
disc->sessions.push_back(s);
}
}
else if (token == "INDEX")
{
Expand Down