Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Sat Apr 20, 2024 2:42 pm
All times are UTC + 0
BMRI and XML files? I'm trying to understand how it works.
Moderators: Global Moderators
Post new topic   Reply to topic Page 1 of 1 [1 Post] Mark the topic unread ::  View previous topic :: View next topic
Author Message
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Sun Feb 24, 2008 3:42 am    Post subject:  BMRI and XML files? I'm trying to understand how it works.
Subject description: Any help is appreciated...
Reply with quote  Mark this post and the followings unread

Last year I gave one or two quick looks into the B.M.R.I. packages (.bin, .manifest, .relo, .imp with some .cdata music as well). I never got much far into it, specially because university and other activities put me a lot of pressure. Now I've been coding the OS BIG Editor for over a month and I've downloaded a recent (but not the latest) source of SDK Extras to get deeper information on how it works.


Utilities:
-> SDK Extras source code.
-> Bin Opener
-> Mod SDK, with sample C&C3 XMLs and XSD Schemas (they are crucial).
-> OS BIG Editor.
-> A sample (C&C Retarded 2.7)



So, it wasn't hard to figure out that jonwil cracked the whole .manifest data. It's something like this:

-> Manifest Header
-> For each Assets
- - -> Get Asset Headers.
-> For each Asset Reference
- - -> Get Asset References.
-> Read Reference Name Buffer
-> Read Asset Name Buffer
-> Read Source Name Buffer.


The .bin file has raw data for all assets.


Now, the imports and relocations are things that are not clear.

Looking at Bin Opener, it seems that the imports are directly linked to the Asset References (aka Extras at the Bin Opener). Imps and Relo entries end with 0xffffffff.


The values on both .relo and .imp entries are smaller than the size of the file. So, I think they are actually offsets in the raw files.

Also, comparing some raw material from certain buidlings and the offsets from the relocations, I've noticed an interest standard. Go to the address on the relocation. The first 4 bytes seems to be a new address in the file or some value like that. The pointed place has the value that this type receives.

So, while the relo is useless to extract textures and other binary files from the .bin, they are crucial for the game to understand the contents of the XML files. Let's see a sample here:

On the Nod Crane, we have a relo for 0x230. At the raw file, it points to a 0x16f0. At this address we have 00 00 96 43. In ASCII, the 96 43 is "-C" = -12. The next relo is on 2b0, which has an integer 2b4 and, exactly at 2b4, we have Name:NODCrane, which is in DisplayName area part of the NodCrane.XML.


Interesting, heh? Now, how do we find the values for these things? Let's use this logic to see how NodCrane is organized there. I hope Gunrun forgives me on this one:


The order should be this:


Quote:
Description="Desc:NODCrane"
TypeDescription="Type:NODCrane"
Side="NOD"
SelectPortrait="Portrait_NODCrane" (wild guess here, since it could be ButtonImage as well)
ButtonImage="Portrait_NODCrane"
BuildTime=13? (I think Gunrun altered here).


And finally, at relo 0x190, we have a 2c4 value. The value of this address, is 0. But if you look at the imp values, the first one is exactly 2c4. Is there any linkage here? The imports links files with hashes that are not in my range to look at them, honestly. So, I'm skipping to the next .relo.


The next has value 4, I couldn't track any property in the original Crane with that value.
TransportSlotCount="1" ? (I'm unsure about this one as well, but it is 1).
The next has value 9 and I couldn't track any property with that value.
0e c0 db 08 ... doesn't make sense in ASCII, no sense in the calculator, unless the value is 14 (0e).
9b 3d 0e 5a... doesn't make sense either. Right before it, there is a BuildingPowerFunctions, which is at AIUpdate part of the original XML file.



And, again, we reach a 0. But this time, there is no similar .IMP value for 0x138c. So, maybe the .imp call above was just a coincidence. In the XML there are few values with 0, far away from the beggining of the file or inside more complex structures. And let's continue anyway:


Something with value 3.
Also something with value 3.
Value 0 and the address 0x1478 isn't any IMP value.
Value 2.
"00 00 c8 42"
"-C"
Inside the DisplayName tag: Name:NODCrane
"F0 02 00 00". 2F0 = 752, which doesn't make sense. The content on that address doesn't make sense in ASCII or binary.
Value "1".
Value "0"
Value "2"
ConditionsYes="STRUCTURE_UNPACKING"
ConditionsYes="RUBBLE"
Value "4"
ConditionsYes="REALLYDAMAGED"
Value "5"
ConditionsYes="DAMAGED"


etc...



NodCrane imports 13 files, where one is imported by instance, the DATA:BaseObjects/BaseStructure.xml. The contents of this file is featured at the raw material from NodCrane as well. So, I got this clue:


Include Types:
-> All: The file is added as a new asset.
-> Instance: The contents of the file is copied into the asset that includes it.
-> Reference: The contents are not included, but the file is referenced at AssetsReference and has an import with an offset to the AssetID with the file location. By the way, the AssetID structure on SDK Extras is wrong. There are 4 integers, instead of two.




Another doubt is to how to use the Schemas to catch the contents pointed by the relocations? Any clues?

Back to top
View user's profile Send private message Visit poster's website Skype Account
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [1 Post] Mark the topic unread ::  View previous topic :: View next topic
 
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
Quick Reply
Username:


If you are visually impaired or cannot otherwise answer the challenges below please contact the Administrator for help.


Write only two of the following words separated by a sharp: Brotherhood, unity, peace! 

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

[ Time: 0.1493s ][ Queries: 11 (0.0074s) ][ Debug on ]