Previous Page | Next Page

by Nisto at 9:50 PM EDT on September 15, 2014
YES! I think I've made another useful discovery.

In SOUNDCD.IRX a table for each BGM's ID and sectors (relative to SOUND.DAT!) of both the Vers and SdDt chunks are stored. I found out that one of the values stored in the table is the ID of the BGM, because when I altered SOUND.DAT and launched the game, PCSX2's log showed an error from the game saying "Invalid Sound BGM call: 50114" which eventually lead me right to the table I needed. And since I knew an ID to look for, it was pretty easy to dissect it.

Okay, so 0x13CE0 -> 0x1431F is the region of the table. Each entry is 20 bytes in size. Struct below:

u32 bgm_id
u32 vers_sector
u32 vers_size
u32 sddt_sector
u32 sddt_size

Remember, the sector numbers are relative to SOUND.DAT, not the whole disc/image! Many of the IDs are just "1", because those are sound effects. ID 50114 is White Noiz/Forest Trail. ID 50006 is Forest (the theme playing when you meet Angela). ID 50115 is A World Of Madness/Silent Heaven. That's all I know right now.

There's some other table(s) right before it, but I don't know what the hell they contain.

Hopefully this can be used somehow to modify where each BGM plays... hopefully. Feels like I've tried everything else now.

EDIT: Damn it, guess not. But I found something else with the help of those BGM IDs.. in the main executable, there appears to be a few BGM IDs in a table (0x1D5208->0x1D5367, 8 bytes per entry), but there's only 44 there. But they're in the order that the tracks will typically play... can't figure out what the value (4 bytes) before the ID in there is though! Gah. Here's the table if anyone has any ideas..





EDIT: Okay found another little something: 0x08 in the tmid chunks is the BGM ID (this may be different for sound effects though!). Maybe I just need to edit this too to get it to properly load the BGM wanted...

EDIT: Figured out what the table between 0x137C0 and 0x13CDB in SOUNDCD.IRX is. As I thought, it's a table for the Svag streams (only dialogues pretty much) in SOUND.DAT. Each entry is 12 bytes, another struct below:

u32 svag_sector
u32 svag_size
u32 unk // terminator? (all are 0x7F 00 00 00)

Here, however, note that the sector number is relative to the end of the BGM section of SOUND.DAT (which ends at 0x19F4FFF).




Yes!!! Figured out a way to modify where BGM plays.

To change the first BGM (White Noiz/Forest Trail), change BGM ID 0xC3C2 (50114) in the table at 0x13CE0 of SOUNDCD.IRX to the BGM you want (e.g. to 0xC358 for the track "True"). Then you also patch the BGM ID for the track's SdDt chunk in SOUND.DAT (the tmid chunk specifically, as mentioned above) accordingly (i.e. once again change 0xC3C2 to 0xC358 to change White Noiz/Forest Trail to the track "True").

edited 11:15 AM EDT September 16, 2014
by peronmls at 5:12 AM EDT on September 16, 2014
Great job man! Wish more people were on the scene with this game. It's way to good to be ignored. Really.
by Nisto at 5:57 AM EDT on September 16, 2014
I agree. :(
by Nisto at 10:27 AM EDT on September 17, 2014
EDIT: struct for the SdDt/sdtr/tmid chunks:

u32 sddt_signature
u32 sddt_size
u32 sdtr_signature
u32 sdtr_size
u32 tmid_signature
u32 tmid_size
u32 bgm_id
u32 unk1 // always 0
u32 master_volume
u32 unk2 // always 0
u32 unk3 // always 0
u32 unk4 // always 0

may be different for SFX tracks.

edited 9:29 AM EDT September 18, 2014
by Nisto at 3:54 PM EDT on September 21, 2014
The first two patterns of a KDT1 sequence always sets stuff like BPM etc. (at least in the case of SH2). This changes BPM, I believe:

00 F6 90 CC 46

Not sure to what (in human-readable form), but 0x46 is the binary value in this case.


Also I think I have come to a conclusion that the raw sequences don't have any "natural" form. Some of them are simply made in such a way that only when the player progresses will they play as expected, because it seems the game really just manually adjusts the volume for each sequence pattern (or channel maybe?) as the player progresses (for example, I noticed the Silent Heaven/A World of Madness tracks can actually play simultaneously if you're right between the areas where the tracks play, which does suggest only volume is changed).

So there it is. I think if a set were ever to be created, the sequences would actually have to be changed somehow (adjust volume where needed). And even then I don't think it'd sound very well.

edited 10:07 PM EDT September 21, 2014
by Nisto at 10:53 AM EDT on September 22, 2014
Here is an unused track: https://www.youtube.com/watch?v=vm8L7JC_E_E
by peronmls at 4:25 AM EDT on September 23, 2014
holy shit more!!!!
by snakemeat at 10:23 AM EDT on September 23, 2014
Nice work.
by Nisto at 3:47 AM EDT on September 24, 2014
Some more discoveries for help with dissecting the sequences.



The first 4 bytes for each track/pattern (after the first two tracks/patterns that is, which again, specifies stuff like BPM and other track properties) specifies a channel. For example:

0x00 C6 82 C9

0x80 = channel 1, 0x81 = channel 2, 0x82 = channel 3, etc. (limited to 0x8F)



The byte right after the first 4 specifies a program to use. I'm not sure how it's changed in the middle of the track (if that's even possible), but at least at offset 0x04 of the track/pattern, it will look similar to this:

0x82 8A C0 8B DA DB 00

0x80 = program 1, 0x81 = program 2, 0x82 = program 3, etc. (probably also limited to 0x8F)



EDIT: More:

00 C6 81 C9 81 8A 91 8B E4 DB 00 FC 77 3C 6B 8A 40 CA

In this example, the value in bold specifies the start offset of the pattern. Also, it seems like 0xCA is a note-off instruction, but 0xCB seems to send a note-off instruction too, and it's typically present at the end of a pattern (before 0xFFFF), so I don't know...

edited 12:50 PM EDT September 24, 2014
by Nisto at 11:54 AM EDT on September 28, 2014
Actually scratch that last part in the previous post. It seems I was wrong. I don't know what the hell "offsets" patterns though, but it seems like SOMETHING does, because if I take, say, the first note of the second-to-last pattern of the White Noiz/Forest Trail BGM and make it the first and only note and pattern, it takes a few seconds for it to start playing... I've tried just about everything and I simply cannot get it to start directly (at its original tempo etc. anyway).

So now I've taken it upon me to try and actually discover IDA and MIPS assembly in general. I have found the starting section of where it (SOUNDCD.IRX) parses the SdDt chunk I think at least, so there is yet progress... All I really want to find out though, is how I can get multi-track BGMs to play only one track (which means I'll have to know at least part of the KDT1 sequence format), and properly at that...

edited 5:03 PM EDT September 28, 2014

Previous Page | Next Page
Go to Page 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Search this thread

Show all threads

Reply to this thread:

User Name Tags:

bold: [b]bold[/b]
italics: [i]italics[/i]
emphasis: [em]emphasis[/em]
underline: [u]underline[/u]
small: [small]small[/small]
Link: [url=http://www.google.com]Link[/url]

[img=https://www.hcs64.com/images/mm1.png]
Password
Subject
Message

HCS Forum Index
Halley's Comet Software
forum source