CAudioGroupLoader: Make use of unsigned stream helpers where applicable

Same behavior, minus implicit sign conversions.
This commit is contained in:
Lioncash 2020-06-18 19:38:20 -04:00
parent 59cfe6fc02
commit bcc27ddd5c
1 changed files with 15 additions and 15 deletions

View File

@ -4,8 +4,8 @@ std::unique_ptr<CAudioGroup> CAudioGroupLoader::LoadAGSC(IInputStream& rAGSC, CR
{
// For now we only load sound define IDs and the group ID!
// Version check
uint32 Check = rAGSC.PeekLong();
EGame Game = (Check == 0x1 ? EGame::Echoes : EGame::Prime);
const uint32 Check = rAGSC.PeekULong();
const EGame Game = Check == 0x1 ? EGame::Echoes : EGame::Prime;
auto pOut = std::make_unique<CAudioGroup>(pEntry);
// Read header, navigate to Proj chunk
@ -13,7 +13,7 @@ std::unique_ptr<CAudioGroup> CAudioGroupLoader::LoadAGSC(IInputStream& rAGSC, CR
{
rAGSC.ReadString();
pOut->mGroupName = rAGSC.ReadString();
uint32 PoolSize = rAGSC.ReadLong();
const uint32 PoolSize = rAGSC.ReadULong();
rAGSC.Seek(PoolSize + 0x4, SEEK_CUR);
}
@ -21,22 +21,22 @@ std::unique_ptr<CAudioGroup> CAudioGroupLoader::LoadAGSC(IInputStream& rAGSC, CR
{
rAGSC.Seek(0x4, SEEK_CUR);
pOut->mGroupName = rAGSC.ReadString();
pOut->mGroupID = rAGSC.ReadShort();
uint32 PoolSize = rAGSC.ReadLong();
pOut->mGroupID = rAGSC.ReadUShort();
const uint32 PoolSize = rAGSC.ReadULong();
rAGSC.Seek(0xC + PoolSize, SEEK_CUR);
}
// Read needed data from the Proj chunk
uint16 Peek = rAGSC.PeekShort();
const uint16 Peek = rAGSC.PeekUShort();
if (Peek != 0xFFFF)
{
uint32 ProjStart = rAGSC.Tell();
const uint32 ProjStart = rAGSC.Tell();
rAGSC.Seek(0x4, SEEK_CUR);
uint16 GroupID = rAGSC.ReadShort();
uint16 GroupType = rAGSC.ReadShort();
const uint16 GroupID = rAGSC.ReadUShort();
const uint16 GroupType = rAGSC.ReadUShort();
rAGSC.Seek(0x14, SEEK_CUR);
uint32 SfxTableStart = rAGSC.ReadLong();
const uint32 SfxTableStart = rAGSC.ReadULong();
if (Game == EGame::Prime)
pOut->mGroupID = GroupID;
@ -46,12 +46,12 @@ std::unique_ptr<CAudioGroup> CAudioGroupLoader::LoadAGSC(IInputStream& rAGSC, CR
if (GroupType == 1)
{
rAGSC.Seek(ProjStart + SfxTableStart, SEEK_SET);
uint16 NumSounds = rAGSC.ReadShort();
const uint16 NumSounds = rAGSC.ReadUShort();
rAGSC.Seek(0x2, SEEK_CUR);
for (uint32 iSfx = 0; iSfx < NumSounds; iSfx++)
{
pOut->mDefineIDs.push_back( rAGSC.ReadShort() );
pOut->mDefineIDs.push_back(rAGSC.ReadUShort());
rAGSC.Seek(0x8, SEEK_CUR);
}
}
@ -63,7 +63,7 @@ std::unique_ptr<CAudioGroup> CAudioGroupLoader::LoadAGSC(IInputStream& rAGSC, CR
std::unique_ptr<CAudioLookupTable> CAudioGroupLoader::LoadATBL(IInputStream& rATBL, CResourceEntry *pEntry)
{
auto pOut = std::make_unique<CAudioLookupTable>(pEntry);
uint32 NumMacroIDs = rATBL.ReadLong();
const uint32 NumMacroIDs = rATBL.ReadULong();
for (uint32 iMacro = 0; iMacro < NumMacroIDs; iMacro++)
pOut->mDefineIDs.push_back( rATBL.ReadShort() );
@ -74,11 +74,11 @@ std::unique_ptr<CAudioLookupTable> CAudioGroupLoader::LoadATBL(IInputStream& rAT
std::unique_ptr<CStringList> CAudioGroupLoader::LoadSTLC(IInputStream& rSTLC, CResourceEntry *pEntry)
{
auto pOut = std::make_unique<CStringList>(pEntry);
uint32 NumStrings = rSTLC.ReadLong();
const uint32 NumStrings = rSTLC.ReadULong();
pOut->mStringList.reserve(NumStrings);
for (uint32 iStr = 0; iStr < NumStrings; iStr++)
pOut->mStringList.push_back( rSTLC.ReadString() );
pOut->mStringList.push_back(rSTLC.ReadString());
return pOut;
}