Skip to content

Commit

Permalink
Fixes LBA sector size of -lba. (#55)
Browse files Browse the repository at this point in the history
XA/DA/DO sectors used the default size of `2048` instead of their respective size.
  • Loading branch information
Zenithsiz authored Oct 1, 2024
1 parent c7f30a0 commit e116d7f
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions src/mkpsxiso/iso.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,42 +793,41 @@ void iso::DirTreeClass::OutputLBAlisting(FILE* fp, int level) const
const DIRENTRY& entry = e.get();
fprintf( fp, " " );

if ( !entry.id.empty() )
if ( entry.id.empty() )
{
if ( entry.type == EntryType::EntryFile )
{
fprintf( fp, "File " );
}
else if ( entry.type == EntryType::EntryDir )
{
fprintf( fp, "Dir " );
}
else if ( ( entry.type == EntryType::EntryXA ) ||
( entry.type == EntryType::EntryXA_DO ) )
{
fprintf( fp, "XA " );
}
else if ( entry.type == EntryType::EntryDA )
{
fprintf( fp, "CDDA " );
}

fprintf( fp, "%-17s", entry.id.c_str() );
} else {

fprintf( fp, "Dummy <DUMMY> " );

fprintf( fp, "%-10" PRIu32, GetSizeInSectors(entry.length) );
}

// Write size in sector units
if (entry.type != EntryType::EntryDir)
else if ( entry.type == EntryType::EntryFile )
{
fprintf( fp, "File " );
fprintf( fp, "%-17s", entry.id.c_str() );
fprintf( fp, "%-10" PRIu32, GetSizeInSectors(entry.length) );
}
else
else if ( entry.type == EntryType::EntryDir )
{
fprintf( fp, "Dir " );
fprintf( fp, "%-17s", entry.id.c_str() );
fprintf( fp, "%-10s", "" );
}
else if ( entry.type == EntryType::EntryXA )
{
fprintf( fp, "XA " );
fprintf( fp, "%-17s", entry.id.c_str() );
fprintf( fp, "%-10" PRIu32, GetSizeInSectors(entry.length, 2336) );
}
else if ( entry.type == EntryType::EntryXA_DO )
{
fprintf( fp, "XA " );
fprintf( fp, "%-17s", entry.id.c_str() );
fprintf( fp, "%-10" PRIu32, GetSizeInSectors(entry.length) );
}
else if ( entry.type == EntryType::EntryDA )
{
fprintf( fp, "CDDA " );
fprintf( fp, "%-17s", entry.id.c_str() );
fprintf( fp, "%-10" PRIu32, 150 + GetSizeInSectors(entry.length, CD_SECTOR_SIZE) );
}

// Write LBA offset
fprintf( fp, "%-10d", entry.lba );
Expand Down

0 comments on commit e116d7f

Please sign in to comment.