From 658a61ba359b87d70a9545b0496b78279c9dac37 Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 10 Jul 2012 01:44:43 +0200 Subject: filesize fixing, hopefully --- src/music.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src') diff --git a/src/music.cpp b/src/music.cpp index a687d35..6a92a23 100644 --- a/src/music.cpp +++ b/src/music.cpp @@ -44,6 +44,8 @@ inline char *BrsarInfoOffset(u32 offset) { return (char*)(*(u32*)(((u32)SoundRelatedClass) + 0x5CC)) + offset; } +void FixFilesize(u32 streamNameOffset); + extern "C" u8 after_course_getMusicForZone(u8 realThemeID) { if (realThemeID < 100) return realThemeID; @@ -73,11 +75,35 @@ extern "C" u8 after_course_getMusicForZone(u8 realThemeID) { sprintf(BrsarInfoOffset(stream->stringOffset), "stream/theme%03d.brstm", realThemeID); sprintf(BrsarInfoOffset(stream->stringOffsetFast), "stream/theme%03d_fast.brstm", realThemeID); + // update filesizes + FixFilesize(stream->stringOffset); + FixFilesize(stream->stringOffsetFast); + // done! return stream->originalID; } +//oh for fuck's sake +#include "fileload.h" +//#include + +void FixFilesize(u32 streamNameOffset) { + char *streamName = BrsarInfoOffset(streamNameOffset); + + char nameWithSound[80]; + snprintf(nameWithSound, 79, "/Sound/%s", streamName); + + s32 entryNum; + DVDHandle info; + + if ((entryNum = DVDConvertPathToEntrynum(nameWithSound)) >= 0) { + if (DVDFastOpen(entryNum, &info)) { + u32 *lengthPtr = (u32*)(streamName - 0x1C); + *lengthPtr = info.length; + } + } +} -- cgit v1.2.3