PDA

View Full Version : Cracking the .sd files



alpaca
12-29-2006, 21:55
Well, did some work on those yesterday since we need to edit them if we actually want to add new factions (not only replace them).

In case you don't know a thing about them, the .sd files can be found in the data/ui folder and describe the images associated with ui elements (i.e. they describe which part of one of the stratpages/battlepages a ui element can be found in).

Note: This thread is meant first of all as a note to myself, but I thought somebody might be interested in it

Well, a short file definiton:


bytes content

0-3 long: 6, probably a version id or something
4-7 long: the number of pages in this file
8-11 long: the number of entries for ui elements

n times: files
0-3 long: string length for the file name
variable filename
0 0x00
1-4 long: width of the page
5-8 long: height of the page
9-12 long: length of the following bitmap
width*height/8 monochrome bitmap to signify cursor state (have a bitwise 1 here, you get a highlight)

m times: ui elements
0-3 long: string length
variable ui tag
0-1 short: file id of the page they are specified in
2-3 short: x position of the top left corner in the page
4-5 short: x position of the bottom right corner
6-7 short: y position (top left)
8-9 short: y position (top right)
10-15 0x010000000000

shifty157
12-29-2006, 22:27
So by editting the .sd files we can recreate the UI elements however we want unlike in RTW where we were limited to the size and arrangement of the vanilla elements?

alpaca
12-29-2006, 23:05
Yup, iirc RTW had these, too, but since we could just overwrite the vanilla stuff it wasn't that important
However, I don't think we can change the placement of the ui elements so we might not actually be able to change the menu layout (i.e. the new icons and stuff would have to be the same size).

serenius4tsd
01-04-2007, 00:18
How did you open these files? In notepad?

alpaca
01-04-2007, 00:51
No, in a hex editor. If you don't know what that is, I presume it will be hard for you to understand this, too ;)

serenius4tsd
01-04-2007, 02:14
Dont worry, i know what a hex editor is! :yes: :lol:

roy_d_merkel
02-27-2007, 20:41
Hey, I've done some work in c++ with these files, and I've got a mini class that can parse the files.

right now I'm working on figuring out how the bitmap file format works.

I've also noticed something odd.

Apparently, the 0x010000000000 magic number is not always correct, for example I found that the

TEXT_BUTTON_BG_MID uses the number: 0x010013001800,
POINTER_TOP_LEFT uses the number: 0x010101000300,
and POINTER_TOP_RIGHT uses the number: 0x01012f000200,

as three examples.

I've also noticed that in shared.sd, my hexdump gave me an extra 0 byte at the end of the file.

It would also appear that the ui elements actually use xPos for the left side of the element, and width to represent the right side of the
element.

And yPos for the top of the element, and height for the bottom of the element, because, for example with NUMERAL_1

xPos = 126, width = 139,
yPos = 262, height = 272.


Tell me what you think, Roy.

BTW, should I post my code also for every one to look at?

roy_d_merkel
02-28-2007, 22:06
okay, used the what I've found to produce a couple of small programs for editing .sd files, one adds a file resource to a .sd file, and the other one adds a variable.

Successfully used them to add a coa for wales for a mini mod I'm working on. I think I'll post the windows binaries later, I want to do some changes to my code to make them easier to use, and to remove some bugs.

More later.


Tell me what you think, Roy.

alpaca
03-01-2007, 14:51
Hey, I've done some work in c++ with these files, and I've got a mini class that can parse the files.

right now I'm working on figuring out how the bitmap file format works.

I've also noticed something odd.

Apparently, the 0x010000000000 magic number is not always correct, for example I found that the

TEXT_BUTTON_BG_MID uses the number: 0x010013001800,
POINTER_TOP_LEFT uses the number: 0x010101000300,
and POINTER_TOP_RIGHT uses the number: 0x01012f000200,

as three examples.

I've also noticed that in shared.sd, my hexdump gave me an extra 0 byte at the end of the file.

It would also appear that the ui elements actually use xPos for the left side of the element, and width to represent the right side of the
element.

And yPos for the top of the element, and height for the bottom of the element, because, for example with NUMERAL_1

xPos = 126, width = 139,
yPos = 262, height = 272.


Tell me what you think, Roy.

BTW, should I post my code also for every one to look at?
Well, maybe do a bit of research about what that number does then.

You're right about the width/height thing, it defines the bottom right corner of the image.

Edit (about your code): Well you may post it, I think the best way to edit these files would be to write a text-file list that contains each tga and the UI element names for that tga (with coordinates) and automatically generates mouse-over info from the alpha channel of the tga.

roy_d_merkel
03-01-2007, 22:40
Uploaded my current code, to 3ddownloads, waiting for them to accept.

I'm trying to figure out a good way to divine the purpose, and format of the mystery number put at the end of each ui element, because what my code does right now is put on the original 0x010000000000 that was mentioned, and it seems to be happy, but I'm curious to know why CA uses different numbers sometimes. (could these be flags of some kind? maybe 0x010000000000 represents some kind of normal state, while the other numbers represent flags specific to certain kinds of cursors?)


Your correct about the ui fixes, that would be a whole lot easier then what I have right now, basically the executables want:


addVariableToSd <.sd file (name only, with .sd, not full path> <tag (the name of the variable)> <fileid (the id of the .tga file, offset from 0 from the beginning of the .sd file)> <xpos> <width> <ypos> <height> [<medieval total war 2 path >]

addFileToSd <.sd file (name only, with .sd not full path> <filename to add (filename only with .tga, not full path) > [<medieval total war 2 path>]

readSdFile

(sd file contents need to be sent to the readSdFile)

:wall:


The gui would make a whole lot more sense, but that will take a little time, because I've never done any windows gui programming outside of vb 6.0.


So far though the concept appears sound, because I have successfully used the programs to produce something, so its just a matter of figuring out the mystery numbers, figureing out the black and white bitmap format and creating a user interface that people can actually use.


Roy.

alpaca
03-02-2007, 00:22
Well, we have 12 bytes for the mystical number, it looks like the first two bytes at least are 01 always.

Can you maybe search for more examples of different numbers, so you could see if there's any connection?
Furthermore, it's perfectly possible that this is just data junk, so for now I'd just go with the mostly used example, and see if any problems occur in-game.

roy_d_merkel
03-02-2007, 01:16
Well, we have 12 bytes for the mystical number, it looks like the first two bytes at least are 01 always.

Can you maybe search for more examples of different numbers, so you could see if there's any connection?
Furthermore, it's perfectly possible that this is just data junk, so for now I'd just go with the mostly used example, and see if any problems occur in-game.

actually its 6 bytes like you originally said, and it always appears to begin with the first byte being 0x01 (I was using hex notation, sorry for the confusion) :oops: .

Here is the entire list of examples that I could find of unique values:



file name hex value
shared.sd CURSOR_PH 0x010101000200
shared.sd TEXT_BUTTON_BG_MID 0x010013001800
shared.sd POINTER_TOP_LEFT 0x010101000300
shared.sd POINTER_TOP_RIGHT 0x01012f000200
shared.sd POINTER_BOTTOM_LEFT 0x010101003100
shared.sd POINTER_BOTTOM_RIGHT 0x01012e003000
shared.sd STRAT_CARD_BACKGROUND 0x000000000000
shared.sd TOOLBAR_BG 0x000000000000
strategy.sd MARBLE_BG 0x000000000000


As you notice almost all of them are in shared.sd, with the only otherone being MARBLE_BG.

I notice that STRAT_CARD_BACKGROUND, TOOLBAR_BG, and MARBLE_BG are all null, but TEXT_BG is 0x010000000000 (could it be that a value of 0 means that its a background?)

I also notice that all of the Pointers begin with the first two bytes being 1 (hex: 0x0101), and that their right side begins with "0x2X" where X is some hex number, so could (0x01012X) mean a value dealing with the right side of a pointer?

Meanwhile both pointer lefts begin with a hex value of (0x010101), and this is true for CURSOR_PH as well, so could (0x010101) be dealing with the left side of a pointer?

So I'm thinking that these numbers are definately bit fields of some kind, but I'm not exactly sure yet what they mean, I bet I'll probably need to go in later, and massecure some of the variables (makeing the mystery value all "0xFF"s, and see what happens).


Though it appears that all values we are interested in editing right now are not using any unique values. This means that editing coat of arms, should be using the value that you mentioned above for this magic number.
Tell me what you think, Roy.

alpaca
03-02-2007, 13:56
Right, 6 bytes, I was a bit tired and confused when writing that XD
Anyways, that means we have 6 byte variables, 3 shorts, or anything in between.

If we assume that what the sd pages actually store is links between tags and the images and mouse-over information, what could these 3-6 values for each tag mean in context?
Looking at the more interesting examples of cursors, I think it's safe to assume they have something to do with user interaction; it's a good bet to say that, for the cursor, they somehow define which point exactly is responsible for clicking when the player clicks her mouse-button.
Under that assumption, I'd interpret the first two bytes as flags for something, the following 4 bytes would be the coordinates (2 shorts) of the click-interaction.

After having a look at the files right now (you got me interested again for a while), and comparing them to the actual tgas, it seems that my assumption for the latter 4 bytes is correct. For cursors, they correspond exactly with the (relative) coordinates of the arrow-tip.

Well, we'll still have to figure out the flags but so far, good work :2thumbsup:

Edit: Ok, I had another idea. I guess the first byte is passive clickability (i.e. a button vs a background image), if you have a 1 it's clickable if not, it isn't - this may be used for the event system or something. The second byte is active clickability (i.e. a cursor) or some other mouse-interaction (like scrolling).
So for your examples, the button is clickable but can not click itself, the cursors and arrows can click or scroll, the background can neither. Makes sense at least, even in context.

Could you do me the favor of testing it? I don't have access to the game right now ;)
However, iirc, the sd pages don't work in a mod folder unless you put a copy in the vanilla data folder, too. Maybe that's why you didn't experience any ill effects earlier (because your files weren't actually used), I think file_first works poorly with them, too.

roy_d_merkel
03-02-2007, 18:26
Right, 6 bytes, I was a bit tired and confused when writing that XD
Anyways, that means we have 6 byte variables, 3 shorts, or anything in between.

If we assume that what the sd pages actually store is links between tags and the images and mouse-over information, what could these 3-6 values for each tag mean in context?
Looking at the more interesting examples of cursors, I think it's safe to assume they have something to do with user interaction; it's a good bet to say that, for the cursor, they somehow define which point exactly is responsible for clicking when the player clicks her mouse-button.
Under that assumption, I'd interpret the first two bytes as flags for something, the following 4 bytes would be the coordinates (2 shorts) of the click-interaction.

After having a look at the files right now (you got me interested again for a while), and comparing them to the actual tgas, it seems that my assumption for the latter 4 bytes is correct. For cursors, they correspond exactly with the (relative) coordinates of the arrow-tip.

Well, we'll still have to figure out the flags but so far, good work :2thumbsup:

Edit: Ok, I had another idea. I guess the first byte is passive clickability (i.e. a button vs a background image), if you have a 1 it's clickable if not, it isn't - this may be used for the event system or something. The second byte is active clickability (i.e. a cursor) or some other mouse-interaction (like scrolling).
So for your examples, the button is clickable but can not click itself, the cursors and arrows can click or scroll, the background can neither. Makes sense at least, even in context.

Could you do me the favor of testing it? I don't have access to the game right now ;)
However, iirc, the sd pages don't work in a mod folder unless you put a copy in the vanilla data folder, too. Maybe that's why you didn't experience any ill effects earlier (because your files weren't actually used), I think file_first works poorly with them, too.


Nice news is I already was putting my modded .sd files, and other mod data directly in their folders under c:\programs and settings\medieval 2 total war\data directory

and my coa for the wales faction is appearing in the strategy screen

(the result of my program, the two wales icons you see on this screen come from a file added to shared.sd, and strategy.sd, and
the variables FACTION_LOGO_WALES, and SMALL_FACTION_LOGO_WALES)
https://img524.imageshack.us/img524/7598/wales2nr7.jpg

This also means that I can alter that 6 byte mystery value, and see what happens if I change some values.

I think what I will do is take the variable: FACTION_LOGO_WALES, and make its mystery value 0xFFFFFFFFFFFF, and then 0x000000000000, and see what happens to it.

I'll get back to you after I have done so.

If I see changes between the two extremes, then I can go back through and try the various combinations that were already mentioned

get back to you with more info, Roy.

roy_d_merkel
03-03-2007, 02:47
here are the images. (changing the mystery value of FACTION_LOGO_WALES)


normally:
https://img524.imageshack.us/img524/7598/wales2nr7.jpg

When I make the mystery number 0x000000000000
https://img185.imageshack.us/img185/1010/wales3ag7.jpg

when I make the mystery number 0xFFFFFFFFFFFF
https://img185.imageshack.us/img185/5567/wales4fh7.jpg

So the effect of the all zeros value appears to be obvious, but the all f's value seems to be less obvious (I can't tell the difference between normal and all fs, and all buttons seem to have the same clickability, and unmovableness), I'll have to figure out more experiments to try to divine what the difference between the values, although all zeros appears to be an object that has no transparencies.


I think I'll check out what happens if I change the values of POINTER_TOP_LEFT, POINTER_TOP_RIGHT, POINTER_BOTTOM_LEFT, and POINTER_BOTTOM_RIGHT to 0x010000000000, and 0xFFFFFFFFFFFF

(btw. having trouble with the game crashing to desktop when I want to start a battle as anyone, so I think that something got corrupted, I think I messed something up when I set up the textures and files for my new welsh faction.).
Tell me what you think, Roy.

alpaca
03-03-2007, 16:30
Interesting, so the first byte is probably a transparency switch (that would also explain why backgrounds have a 0 there, they don't need transparency).
By the way, if it's a boolean switch (i.e. true or false), probably everything that isn't a 0 is true, so FF would be the same as 01 or anything in between, which would explain why you can't see a difference between normal and FF.

I'm still pretty sure that the last four bytes are coordinates for mouse-interaction points for the cursors, it just fits too perfectly. Maybe you could try changing the coordinates (say, you change the cursor coordinates to (40,40) instead of (0,2) or what they are now, and you should have to click with the right-bottom corner of the cursor instead of the arrow-tip). Also try changing the 1 in the second byte to 0 and see what happens then.

As for your CTD, maybe you have to supply some mouse-over info in text files or something? Does the error log show anything?


So far, congratulations on getting a new faction symbol in, afaik you're the first one to do that (well a completely new one, not a replace, anyways):yes:

roy_d_merkel
03-03-2007, 20:03
Interesting, so the first byte is probably a transparency switch (that would also explain why backgrounds have a 0 there, they don't need transparency).
By the way, if it's a boolean switch (i.e. true or false), probably everything that isn't a 0 is true, so FF would be the same as 01 or anything in between, which would explain why you can't see a difference between normal and FF.

I'm still pretty sure that the last four bytes are coordinates for mouse-interaction points for the cursors, it just fits too perfectly. Maybe you could try changing the coordinates (say, you change the cursor coordinates to (40,40) instead of (0,2) or what they are now, and you should have to click with the right-bottom corner of the cursor instead of the arrow-tip). Also try changing the 1 in the second byte to 0 and see what happens then.

As for your CTD, maybe you have to supply some mouse-over info in text files or something? Does the error log show anything?


So far, congratulations on getting a new faction symbol in, afaik you're the first one to do that (well a completely new one, not a replace, anyways):yes:

the transparency info makes sense, I should have guessed that CA would have used a boolean variable instead of a bit field.

What I need to do is get the decimal values of the mystery numbers on the special cases, that may help me figure out how to teak them to divine the last 5 mystery bytes.

Let me also revert to a vanilla installation, and edit the .sd files on the vanilla install.

here a is link to my code for editing .sd files, I already have the windows executables compiled, I think you need the cygwin libraries before you can use the executables though

http://www.wikiupload.com/download_page.php?id=94766


CURSOR_PH
byte 2: 1
byte 3: 1
byte 4: 0
byte 5: 2
byte 6: 0

TEXT_BUTTON_BG_MID
byte 2: 0
byte 3: 19
byte 4: 0
byte 5: 24
byte 6: 0

POINTER_TOP_LEFT:
byte 2: 1
byte 3: 1
byte 4: 0
byte 5: 3
byte 6: 0

POINTER_TOP_RIGHT
byte 2: 1
byte 3: 47
byte 4: 0
byte 5: 2
byte 6: 0

POINTER_BOTTOM_LEFT
byte 2: 1
byte 3: 1
byte 4: 0
byte 5: 49
byte 6: 0

POINTER_BOTTOM_RIGHT
byte 2: 1
byte 3: 46
byte 4: 0
byte 5: 48
byte 6: 0

well it looks like you may be right alpaca, bytes 3, 4, 5, 6 do look like they should be coordinates of something, so what I need to figure out is what, so maybe what I'll do is edit these arrows, and change bytes 3, and 5. Maybe make the small numbers larger, and the large numbers smaller, this should cause some sort of change in the large diagonal green arrows (these appear to be the objects that POINTER_TOP_X and POINTER_BOTTOM_X refer to). hypathetically this should change where I can click on the object, correct?

I think the byte 2 is a boolean dealing with resizing, to test this, I plan to blow up my wales coa to extreme sizes, and then toggle the bit, and see what happens.


I'll give you note of what I get once I change them.

BTW. my ctds seem only to occur when I try to manually resolve a battle (I tried autobattling a few times last night, and it let me autobattle without ctds). Looking through system.log.txt, no errors are shown until the "unexpected error" message appears.

and a url to the where I'm holding the current beta of my wales mod, for those who are interested.

http://www.wikiupload.com/download_page.php?id=94759

Arbaces
03-04-2007, 19:43
Good work indeed, looking forward to this, best of luck in finishing it.

Arbaces.

DarkKnight
03-11-2007, 06:11
Is this project still active? I would hate to see this die as I await the ability to add new logos. I would just like to offer my moral support and let you know that there are people out there who want a converter or editor for these files.

alpaca
03-11-2007, 14:36
Is this project still active? I would hate to see this die as I await the ability to add new logos. I would just like to offer my moral support and let you know that there are people out there who want a converter or editor for these files.
Well I don't have time to work on it at the moment. I'll maybe look into it again in a few days.

By the way, as a general statement: Even just stating interest will often increase the morale of the people working on something (especially tools).
When I first posted this, it looked like pretty much nobody was really interested, so I didn't continue to work on it (because I still don't need it yet)... May have happened to roy, too, who knows ;)

Anyways, thanks for the kind words.

roy_d_merkel
03-12-2007, 22:46
Nah, still on it, just nursing my hand, my hand was giving me some guff, so I have cut down on my computer time for awhile to let it heal.

Found out something about the error from before, tried a new installation of M2TW, patched it, and unpacked the files, then went into battle, and the game immediately crashed.

So I bet that my battle woes have something to do with the io_flags="file_first", and the unpacked files.

Still not sure why though, I'll get back to you as I learn more.

I've been working on doing some fixes to my code:

1. change the code so that it works with windows without the cygwin libraries.
2. expand the SDFile class so that it contains the functions to add files to the .sd libarary, and variables to the .sd library.
3. fix readSd so that it accepts a filename instead of standard in.
4. finished editSDFile.
5. finish my research.


I'll change the code link once I have 1-4 finished.

(Also spending some time trying to switch my total war 2 installation over to another computer, the game keeps complaining:

13:54:45.859 [data.invalid] [error] Expected localised string 'generic_repair')

more later.

(*insert answer to research questions here*)

Casuir
03-13-2007, 12:13
Did you delete the desc_geography file?

roy_d_merkel
03-13-2007, 21:57
haven't yet, could that be the cause of my mod problems? Does that file need to be removed?

b.t.w. fixed the error that it was complaining about in the error log file by patching my installation,

but still haven't been able to figure why the battles are still crashing (even in vanilla...).

All I know is that it seems to happen when I patch ME2TW, and unpack the files, I'm wondering if your right that I'm leaving a file in the directories that I shouldn't, I think the unpacker wants me to delete a file in the readme that I haven't deleted yet.

Casuir
03-13-2007, 23:24
That would be the cause of yer problems then, theres a timestamp problem with that file which causes a crash with battle mode.

Btw, is there enough space in the tga's for the 9 new faction icons or can they be resized?

roy_d_merkel
03-14-2007, 01:09
still doing testing, but what I am doing right now is to create a whole new tga file which contains my small faction icon, and my COA.

Then I currently add that tga file to shared.sd, and strategy.sd, as well as adding new variables:

FACTION_LOGO_WALES, and
SMALL_FACTION_LOGO_WALES

into the files that reference the tga file that was added.


This way I don't have to edit any of the factory tgas, and theoretically the only limit to the number of COAs I can add is the physical limits of the number of files and variables in the .sd files.


as for resizing, I have been wanting to do tests on that, I think now that my hand isn't bothering me as much, I can actually do those tests for you

(right now I suspect that the game will resize for you, but I need to do more testing, what I was going to do was take the file that contains my COA and faction icon, and double its height and width, resizing the images to match, I'll tell you the results when I know them -- I'm hoping to know by tonight, I wanted to test if I've fixed the battle error yet).

Update: deleting descr_geography_new.txt and descr_geography_new.db appears to fix the problems with battles crashing for me... :wall:

Lusted
03-14-2007, 11:22
So how would you go about making a new .tga with new faction COA and faction icons on it, and referencing it in the .sd?

alpaca
03-14-2007, 15:46
Yeah, creating a new tga would also be my favourite approach if the game supports it (we could even make a generic version and call it mod_strat.tga and mod_shared.tga or maybe use the same image for both). I think maximum size is 512*512 though - or at least most of the vanilla files have that size.

@Lusted: Right now by writing a converter tool or heavy uncomfortable hex-editing.

roy_d_merkel
03-14-2007, 17:27
I need to make some images for a full tutorial, but here is what I did for my wales faction in wales mod.

1. downloaded the wales coat of arms from online (wikipedia).
2. edited the coat of arms to turn the white background into a transparancy
3. saved this as wales_coa.xcf (gimps format)
4. used that file to produce: faction_symbols/wales.tga, menu/symbols/fe_buttons*/symbol*_wales.tga and menu/symbols/fe_faction_units/wales.tga
5. created a new 128x128 tga file, and put the coa of there in both big form and small form (one to represent the mini symbol, and one to represent the big symbol) -- walesCoa.tga
6. copied this tga file into c:\Programs Files\SEGA\Medieval II Total War\data\ui\southern_european\interface
7. using my code (for which I have a download link on one of my posts, I ran):

./addFileToSd shared.sd walesCoa.tga

./addFileToSd strategy.sd walesCoa.tga

./addVariableToSd shared.sd SMALL_FACTION_LOGO_WALES 3 96 119 89 127

./addVariableToSd.exe strategy.sd FACTION_LOGO_WALES 5 31 93 28 98



tell me what you think, roy.

alpaca
03-14-2007, 17:51
Well I think too many console commands for the average modder :no:
Anyways, waiting for your new version because I'm too lazy to install cygwin again.

By the way, I can confirm that our first byte seems to be a boolean flag of whether the game should use the alpha channel or not with this pic (mapping with the sign function: 0 is 0, all else is 1)

Lusted
03-14-2007, 19:51
Yeah, creating a new tga would also be my favourite approach if the game supports it (we could even make a generic version and call it mod_strat.tga and mod_shared.tga or maybe use the same image for both). I think maximum size is 512*512 though - or at least most of the vanilla files have that size.

We can fit the 9 faction symbols needed(big and small) in a file that size. Having a generic one with instructions on how to edit it would be good.

Roy, i'll give that a try at some point.

alpaca
03-14-2007, 20:46
Well I'm currently working on a python utility that'll work with a simple description file that contains all instructions that should go into the sd file and looks like this:

tga=stratpage_01.tga

entry=FACTION_LOGO_PAPAL_STATES
topleft=205,1
bottomright=16,76
You will specify the tga you want to use, then all the entries that should be linked to that page file.

It also contains some other possible commands that you can use but don't have to (i.e. advanced options like disabling alpha info for an entry, using a different image for mouse-over information, etc.)

roy_d_merkel
03-14-2007, 21:03
hmmm..... maybe better then what I have right now... though I bet I could make a format like that work without too much problem, that seems alot easier then what I'm trying to do now, could I create a c++ utility that dumps to that format? because I already have a reader, so maybe just change the dumpContents function.

Tell me what you think, Roy.

alpaca
03-14-2007, 22:07
hmmm..... maybe better then what I have right now... though I bet I could make a format like that work without too much problem, that seems alot easier then what I'm trying to do now, could I create a c++ utility that dumps to that format? because I already have a reader, so maybe just change the dumpContents function.

Tell me what you think, Roy.
Well I actually planned to write a dumper function into that script, too, because I kinda feel it belongs in there (and because I need it for testing :P) - I use OOP and already have a class reader for the sd files anyways.
I'm using python because it's extremely productive for such small command-line utilities and people who want to can easily edit the code a bit and redistribute their version.

Anyways, I may get this thing finished today, so your time may be better invested towards figuring out what this mystery value and the mystery coordinate do.
Oh, and rest assured you will get due mention in the readme and the release thread, roy :2thumbsup:

alpaca
03-15-2007, 01:47
Well, finally got apparently everything working - I'll test adding a new symbol tomorrow and make a release, but I'm pretty confident that it works (well the dumped and re-interpreted sd files look pretty close to the originals and they seem to work in-game)

DarkKnight
03-15-2007, 01:57
./addFileToSd shared.sd walesCoa.tga

./addFileToSd strategy.sd walesCoa.tga

./addVariableToSd shared.sd SMALL_FACTION_LOGO_WALES 3 96 119 89 127

./addVariableToSd.exe strategy.sd FACTION_LOGO_WALES 5 31 93 28 98
What do these numbers mean?

alpaca
03-15-2007, 02:06
In order: Index of the page you can find this element in, then left, right, top, bottom borders of the image
You won't have to bother with the index with the tool I'm working on but you'll need to specify the coordinates.

alpaca
03-15-2007, 14:58
Well stuff looks good. Here's a screen of a new faction logo I created (the Yorkshire rose).

I also moved the cycle arrow a bit around for testing purposes but that didn't work too well :dizzy2:

https://img64.imageshack.us/img64/8575/yorkshirerose1pb6.th.jpg (https://img64.imageshack.us/my.php?image=yorkshirerose1pb6.jpg)

Mouse-over info works fine, although the highlight state is still the shield (can't see it too well but it's there) because it'll be the same for all factions, but that's something for you 2d artists to worry about and not my problem:laugh4:

https://img263.imageshack.us/img263/6804/yorkshirerose2yk7.th.jpg (https://img263.imageshack.us/my.php?image=yorkshirerose2yk7.jpg)

A release should be ready in an hour or so. Not sure about a tutorial, might take me a bit longer - or maybe I'll take a short break before I start on it :juggle2:

roy_d_merkel
03-15-2007, 23:18
Actually I get a nonshield roll-over for mine, the reason is that the roll over for the faction symbol isn't read from the .sd file, but instead another file...

I think the file is in menu/symbols/faction.tga


So you need the .sd to make the COA for everything except for the faction choose screen, and the roll over effect, because these come from the file system.

BloodBath
03-16-2007, 13:33
Actually I get a nonshield roll-over for mine, the reason is that the roll over for the faction symbol isn't read from the .sd file, but instead another file...

I think the file is in menu/symbols/faction.tga


So you need the .sd to make the COA for everything except for the faction choose screen, and the roll over effect, because these come from the file system.

Mega thanks to you guys! Really impressive work! But I wonder what "roll over effect" means? Would you please specify that with image or something? Thanks a lot!

BTW, I changed the last 4 bytes in mysterious-6 bytes you guys think as coords of something, to some other reasonable values, for testing their effect. Unfortunately no obvious effect shows up. Although it seems only the four have non-zero coord values, making it no big deal:beam: , still we'd better figure it out.

I've been tracking the thread from the very beginning:2thumbsup: , thanks for excellent work again!

alpaca
03-16-2007, 15:09
Actually I get a nonshield roll-over for mine, the reason is that the roll over for the faction symbol isn't read from the .sd file, but instead another file...

I think the file is in menu/symbols/faction.tga


So you need the .sd to make the COA for everything except for the faction choose screen, and the roll over effect, because these come from the file system.
I'm pretty sure the roll-over effect for the strategy button is in stratpage_04.tga near the middle.
The menu folder is only for the main menu methinks. I should probably mention it in the tutorial nonetheless...

BloodBath
03-16-2007, 15:38
OK, the "roll over effect". I resized the FACTION_LOGO_YORKSHIRE to a smaller one, the non-shield roll over effect turns out like this.
https://img412.imageshack.us/img412/1415/explain1bloodbathra5.th.jpg (https://img412.imageshack.us/my.php?image=explain1bloodbathra5.jpg)

I'm pretty sure too it's in stratpage_04.tga, the one in the red rectangle with its id SHIELD_HL.
https://img216.imageshack.us/img216/5850/stratpage04bloodbathop1.th.jpg (https://img216.imageshack.us/my.php?image=stratpage04bloodbathop1.jpg)

This is an image after a little change to SHIELD_HL and the alpha channel switch of FACTION_LOGO_YORKSHIRE.
https://img228.imageshack.us/img228/1364/explain4bloodbathch3.th.jpg (https://img228.imageshack.us/my.php?image=explain4bloodbathch3.jpg)

Lusted
03-17-2007, 11:55
Next all we need is to crack the battle.sd file so we can get the new round faction symbols to show in the bottom right of the battle interface, the symbol you click on to highlight your units with green etc.

alpaca
03-17-2007, 14:20
Next all we need is to crack the battle.sd file so we can get the new round faction symbols to show in the bottom right of the battle interface, the symbol you click on to highlight your units with green etc.
1. battle.sd is cracked - a descriptor is included in the sd converter
2. Those images aren't in the battlepages. They seem to be in ui/faction_symbols but changing them appears to have no effect.

Lusted
03-18-2007, 17:28
2. Those images aren't in the battlepages. They seem to be in ui/faction_symbols but changing them appears to have no effect.

Hmm, then is there no way to get the game to use them?

alpaca
03-18-2007, 17:40
Hmm, then is there no way to get the game to use them?
Well I didn't really look into it to a larger extent, Zain seems to have changed it so we might best wait until he tells us which file we have to edit :P
https://forums.totalwar.org/vb/showpost.php?p=1468352&postcount=16

SigniferOne
04-09-2007, 07:00
Alpaca, so what's the story? This is a really promising project, did you ever end up publishing a release? Also, roy merkel's code, is it still around? Should be easy to recompile it under Windows.

Casuir
04-09-2007, 16:18
https://forums.totalwar.org/vb/showthread.php?t=81320
https://forums.totalwar.org/vb/showthread.php?t=81326

Have you tried using the ui/faction_symbols in a the base folder alpaca?

alpaca
04-09-2007, 20:30
Yeah I think I did back then. When something doesn't work, I usually try doing it in the main folder.
Anyways, I'll look into that when I need to :sweatdrop:

roy_d_merkel
07-21-2007, 02:03
Alpaca, so what's the story? This is a really promising project, did you ever end up publishing a release? Also, roy merkel's code, is it still around? Should be easy to recompile it under Windows.

http://www.3ddownloads.com/Strategy/Medieval%20Total%20War/Tools/readSd.zip#


here is my code, I was working on fixing it to parse the files better, had some odd behavior under native windows where long .sd files would be truncated. When getting from stdin (think windows non raw IO has some kind of a bug).

sort of got busy with other junk :sweatdrop:

by the way, nice work Alpaca :2thumbsup:

going to try some experiments with the mystery numbers later (unless someone already had them figured them out).

Roy.

Lusted
09-12-2007, 12:28
Anyone here using the retrofit mod? Because Unspoken Knight has included the sd.xml files used to make the .sd files in the mod.

SigniferOne
09-12-2007, 19:41
Nice, he included the CA in-house sd.xml files which can help the game regenerate the .sd files? That's fantastic, and further can help modding those said .sd files much easier.

Lusted
09-12-2007, 21:19
Nice, he included the CA in-house sd.xml files which can help the game regenerate the .sd files?

That's what im guessing they are from the info inside them.

alpaca
09-13-2007, 08:53
Yeah BrandonM told me they are in there. Apparently the .sds are also re-generated, so obviously I'd rather use the .xmls instead of the sd converter unless you need extra mouse-over information.
Turns out that CA had pretty much the same ideas about the thing as I had with the mouse-over bmp usually taken somehow from the alpha channel.