Make ctrff usable again

This commit is contained in:
2025-12-06 21:34:19 +01:00
parent b021609c4c
commit bfa6c9e92a
15 changed files with 97 additions and 91 deletions

View File

@@ -1,7 +1,7 @@
#include <ctrff/bcwav.hpp>
/** Using this a single time so inline it */
inline PD::u32 Swap32(PD::u32 in) {
inline ctrff::u32 Swap32(ctrff::u32 in) {
return (in >> 24) | ((in >> 8) & 0x0000FF00) | ((in << 8) & 0x00FF0000) |
(in << 24);
}
@@ -28,7 +28,7 @@ CTRFF_API void BCWAV::LoadFile(const std::string& path) {
pReader.Read(pHeader.FileSize);
pReader.Read(pHeader.NumBlocks);
pReader.Read(pHeader.Reserved);
for (PD::u16 i = 0; i < pHeader.NumBlocks; i++) {
for (ctrff::u16 i = 0; i < pHeader.NumBlocks; i++) {
SizedReference ref;
ReadSizedReference(ref);
if (ref.Ref.TypeID == Ref_InfoBlock) {
@@ -86,7 +86,7 @@ CTRFF_API void BCWAV::ReadInfoBlock(InfoBlock& block) {
CTRFF_API void BCWAV::ReadReferenceTab(ReferenceTable& tab) {
pReader.Read(tab.Count);
tab.Refs.reserve(tab.Count + 1);
for (PD::u32 i = 0; i < tab.Count; i++) {
for (ctrff::u32 i = 0; i < tab.Count; i++) {
Reference r;
pReader.Read(r.TypeID);
pReader.Read(r.Padding);
@@ -111,7 +111,7 @@ CTRFF_API void BCWAV::ReadGotoBeginning(bool use_loop_beg) {
}
}
CTRFF_API void BCWAV::ReadBlock(PD::u32 block, PD::u8* ref) {
CTRFF_API void BCWAV::ReadBlock(ctrff::u32 block, ctrff::u8* ref) {
// if (pFile.tellg() > pHeader.FileSize || block >= GetNumBlocks()) {
// throw std::runtime_error("BCWAV: Decode block Out of range!");
// }