summaryrefslogtreecommitdiff
path: root/src/music.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-07-10 01:44:43 +0200
committerTreeki <treeki@gmail.com>2012-07-10 01:44:43 +0200
commit658a61ba359b87d70a9545b0496b78279c9dac37 (patch)
tree73a25f3b0b13bf385de8a9843656c3843cb2475d /src/music.cpp
parent4716dd060af05eecc5e9761a75af10e288b297a1 (diff)
downloadkamek-658a61ba359b87d70a9545b0496b78279c9dac37.tar.gz
kamek-658a61ba359b87d70a9545b0496b78279c9dac37.zip
filesize fixing, hopefully
Diffstat (limited to 'src/music.cpp')
-rw-r--r--src/music.cpp26
1 files changed, 26 insertions, 0 deletions
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 <rvl/dvd.h>
+
+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;
+ }
+ }
+}