Jump to content

Changing Armor Tint Starter Guide


rdngmikey

Recommended Posts

You mean this one?

http://s3.postimg.org/ocqmxb3oz/Nexus_QA_Hyperion_Armor_25.png

 

I call that guy - BubbleGum Rally! :)

 

Kay, in all seriousness;

 

- I just Eye-Dropped one of those Pinkish pixels from the image and i got this exact (RGB, btw) value for that color = (185,11,112)

 

- In theory, the Floating 0.xxxxxx formulas should nearly match after proper conversion from my RGB guess.

 

- That solves the case for trying to detect the correct slot which (i'm just guessing) could very well be #24 since we're looping into a formally declared from_0 array. Barracks do not understand or like binary stuff. Decimal is 25, code calls it a 24? Nope again. You'd need the Hex value for 24 == 18?

 

- Am i making any sense here, so far?

 

- So, if you previously entered 32 as a **single & lonely** OFFset for a (your custom attempt) list of just one slot that normally would want the whole thingy in a neatly assembled full and authentic file by a coder... something is bound to go wrong. :mad: Man versus Machine or vice-versa.

 

Thus, conclusion -- i just don't know if a single Armor Tint can be altered by that PatcherGUI code... but, i'm confident that (now) you can find the BuggleGum sticking out of a line with Floating arythmetics urging you to wait for a correct answer.

 

Gosh, i'm tired!

Glad i could help - a little. :ninja:

Link to comment
Share on other sites

  • Replies 64
  • Created
  • Last Reply

Top Posters In This Topic

Strangely... rngmickey, speaks of third & fourth bytes to explain the complex maths required while a resulting float_value is simply appended to the description lines with wghost81 translator-parser code.

In fact he did very nice job without any tools.

 

All can be seen in the spoiler containing deserialized info wghost81 posted earlier. I will quote rdngmikey's first post. Corrected few typos in it. Original post is here.

 

You should see a series of numbers that go like this ---- 01 00 00 00 28 02 00 00 00 00 00 00 22 00 00 00 00 00 00 00 04 0D 00 00 00 00 00 00 20 00 00 00

This is the file Header that contains all of the armor codes.

01 00 00 00 - Previous Object Reference

 

Correct. It is an array Entries containing values for all 32 armor tints.

 

28 02 00 00 00 00 00 00 - NameIdx Entries

22 00 00 00 00 00 00 00 - TypeIdx ArrayProperty

04 0D 00 00 - PropertySize 3332

00 00 00 00 - ArrayIdx 0

00 00 00 20 - NumElements 32

 

The next string looks like this ----- DE 03 00 00 00 00 00 00 02 0B 00 00 00 00 00 00 10 00 00 00 00 00 00 00

This is the individual armor container, each container starts with DE 03 ...

The container is an entry in the Entries array. For the primary color tint it is:

 

DE 03 00 00 00 00 00 00 - NameIdx Primary

02 0B 00 00 00 00 00 00 - TypeIdx StructProperty

10 00 00 00 - PropertySize 16

00 00 00 00 - ArrayIdx 0

 

And for the secondary:

 

92 04 00 00 00 00 00 00 - NameIdx Secondary (the secondary color tint)

02 0B 00 00 00 00 00 00 - TypeIdx StructProperty

10 00 00 00 - PropertySize 16

00 00 00 00 - ArrayIdx 0

 

... and will end with the closing container codes which look like this ---- 92 03 00 00 00 00 00 00

The closing string always starts with 92 03 and is only 8 Bytes long.

 

Correct. None closes current entry in the Entries array.

 

92 03 00 00 00 00 00 00 - NameIdx: None

 

I've modified the following quote for the sake of clarity.

In between these two strings are the armor codes, the first is for the primary color and the second is for the secondary color.

Each color code will be 16 Bytes.

The string we're after will look like this ---- 2B 22 59 3E FF 69 95 40 C1 EF B4 3E 00 00 80 41

(I can't use the actual first string due to the fact that I've already modded the values.)

 

Now, we are only interested in 6 Bytes, the THIRD and FOURTH Byte segments in each of the four groupings;

Looking at the numbers above that would be 59 and 3E, 95 and 40, B4 and 3E.

I haven't seen the last four nor the first two in each segment do anything, so don't worry about them.

Each entry looks like:

40 03 00 00 00 00 00 00 - InnerNameIdx LinearColor

RR RR RR RR GG GG GG GG BB BB BB BB AA AA AA AA - 16 bytes, 4 floats - R, G, B, Alpha

 

So rdngmikey was tweaking floats for RGB values. And floats are written in little endian (backwards) so the last two bytes in each group of four bytes had the biggest influence.

 

Good skill for finding stuff.

 

---

Thus, conclusion -- i just don't know if a single Armor Tint can be altered by that PatcherGUI code...

 

Yes it can :smile: See the comment above REL_OFFSET.

UPK_FILE=Startup.upk

OBJECT=UnitPalettes.ArmorTint

// Change REL_OFFSET to: 32 + (NUMBER_OF_ENTRY_TO_CHANGE * 104)
// An example: 32+(3*104)=344 so it will be REL_OFFSET=344
// Basically it is formula for finding 0xDE03000000000000 offsets (in decimal).
// Remember the array starts at Entries[0] so use values 0-31. It is customization screen number - 1.

REL_OFFSET=32

[MODDED_CODE]
<Primary>
<StructProperty>
<%u 0x00000010>
<%u 0x00000000>
<LinearColor>
<%f 0.99> <%f 0.5> <%f 0.99> <%f 1.0> // (R, G, B, A)
<Secondary>
<StructProperty>
<%u 0x00000010>
<%u 0x00000000>
<LinearColor>
<%f 0.05> <%f 0.05> <%f 0.05> <%f 1.0> // (R, G, B, A)
<None>
Edited by Drakous79
Link to comment
Share on other sites

ok so (185, 11, 112) would convert to (B9, 0B?, 70) so I should look for that sequence in the uncompressed startup.upk file? This is assuming that color is 100% accurate. I assume there might be some variation (e.g. if it's actually B8) and then I won't find what I want...

halp

 

edit:

oh I didn't see that comment, that would have helped a lot if I had seen that =\

Ok i will attempt to turn that awful pink/blue monstrosity into just plain black or something and see if it worked.

Thought I would much rather just go into the actual startup.upk and manually change values of the tints that I want to change, but I suppose this might actually be easier. hard to say when you've never done any kind of formal programming or anything with hex before.

 

 

another edit:
so if i want to change tint # 25, i would end up with

UPK_FILE=Startup.upk

OBJECT=UnitPalettes.ArmorTint
REL_OFFSET=2528 // 32 + (104 * 24)
[MODDED_CODE]
<Primary>
<StructProperty>
<%u 0x00000010>
<%u 0x00000000>
<LinearColor>
<%f ####> <%f ####> <%f ####> <%f 1.0>
<Secondary>
<StructProperty>
<%u 0x00000010>
<%u 0x00000000>
<LinearColor>
<%f ####> <%f ####> <%f ####> <%f 1.0>
<None>

edit #9234982394:

ok i got it to work, but i entered 25*104 + 32 so it changed armor tint 26. I am assuming I can convert the numbers I insert into the .upk via the patcher into hex, then search for those hex values and edit the saturation that way? if, say, i wanted to make some kind of neon black trippy armor tint.

Edited by zeppelin1717
Link to comment
Share on other sites

Barracks do not understand or like binary stuff. Decimal is 25, code calls it a 24? Nope again. You'd need the Hex value for 24 == 18?

 

Try to think of -1 as the code to UI compensation.

 

Data in arrays start at position 0, while customization spinner starts at position 1. Spinner's position 0 is Standard.

0-31 ... armor tint array
1-32 ... armor tint spinner

We can say UnitPalettes.ArmorTint.Entries[ X ] = Armor Tint X+1

 

Here's m_strNoArmorTint string defined.

// XComStrategyGame.int
m_strNoArmorTint=Standard

And here is a conditional uing Armor Tint spinner's minimum of -1 to display the string.

// XComStrategyGame.upk, XGCustomizeUI.UpdateMainMenu
// If ArmorTintIndex < 0, write Standard, else compensate and write an integer.
kOption.strHelp = "" $ (((GetArmorTintIndex()) < 0) ? m_strNoArmorTint : string((GetArmorTintIndex()) + 1));

Data! Re-de-compensate!

Edited by Drakous79
Link to comment
Share on other sites

ok i got it to work, but i entered 25*104 + 32 so it changed armor tint 26. I am assuming I can convert the numbers I insert into the .upk via the patcher into hex, then search for those hex values and edit the saturation that way? if, say, i wanted to make some kind of neon black trippy armor tint.

 

Cool.

 

Search those bytes by decimal offset you used while patching and knowledge you learned.

 

What do you mean by neon black trippy? Shiny black like Darth Vader's armor? Or shiny radioactive green?

Edited by Drakous79
Link to comment
Share on other sites

I mean black but with high saturation. look at "japgeneric" in rdngmikey's picture:

https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak-xpa1/t31.0-8/10648839_707151869356253_4998266155295236436_o.jpg

 

I want that but black instead. so obviously it would be 0, 0, 0, but the saturation value would be different and I'm not sure how I would go about changing that, considering I can't just search for "00 00 00 00 00 00" etc in the hex editor.

Link to comment
Share on other sites

Ok say I want to edit armor tint 15 and 25. is it easier to just make 2 different patches? or can i just repeat that REL_OFFSET part later on.. i.e.

UPK_FILE=Startup.upk

OBJECT=UnitPalettes.ArmorTint
REL_OFFSET=2528
[MODDED_CODE]
<Primary>
<StructProperty>
<%u 0x00000010>
<%u 0x00000000>
<LinearColor>
<%f 1.0> <%f 1.0> <%f 1.0> <%f 1.0>
<Secondary>
<StructProperty>
<%u 0x00000010>
<%u 0x00000000>
<LinearColor>
<%f 0.0> <%f 0.0> <%f 0.0> <%f 1.0>
<None>

REL_OFFSET=1592
[MODDED_CODE]
<Primary>
<StructProperty>
<%u 0x00000010>
<%u 0x00000000>
<LinearColor>
<%f 1.0> <%f 1.0> <%f 1.0> <%f 1.0>
<Secondary>
<StructProperty>
<%u 0x00000010>
<%u 0x00000000>
<LinearColor>
<%f 0.0> <%f 0.0> <%f 0.0> <%f 1.0>
<None>
Link to comment
Share on other sites

You can just repeat REL_OFFSET.

 

Setting the saturation is very crazy as far as I can tell. I've created simple mod file to see these values:

<%f 1.0> <%f 0.5> <%f 1.0> <%f 1.0> // (R, G, B, A)
<%f 2.0> <%f 0.5> <%f 2.0> <%f 1.0> // (R, G, B, A)
<%f 3.0> <%f 0.5> <%f 3.0> <%f 1.0> // (R, G, B, A)

Attaching mod file for tints 1-3 in the spoiler:

 

 

UPK_FILE=Startup.upk

OBJECT=UnitPalettes.ArmorTint
REL_OFFSET=32
[MODDED_CODE]
// entry #0
<Primary>
<StructProperty>
<%u 0x00000010>
<%u 0x00000000>
<LinearColor>
<%f 1.0> <%f 0.5> <%f 1.0> <%f 1.0> // (R, G, B, A)
<Secondary>
<StructProperty>
<%u 0x00000010>
<%u 0x00000000>
<LinearColor>
<%f 0.00> <%f 0.00> <%f 0.00> <%f 1.0> // (R, G, B, A)
<None>
// entry #1
<Primary>
<StructProperty>
<%u 0x00000010>
<%u 0x00000000>
<LinearColor>
<%f 2.0> <%f 0.5> <%f 2.0> <%f 1.0> // (R, G, B, A)
<Secondary>
<StructProperty>
<%u 0x00000010>
<%u 0x00000000>
<LinearColor>
<%f 0.00> <%f 0.00> <%f 0.00> <%f 1.0> // (R, G, B, A)
<None>
// entry #2
<Primary>
<StructProperty>
<%u 0x00000010>
<%u 0x00000000>
<LinearColor>
<%f 3.0> <%f 0.5> <%f 3.0> <%f 1.0> // (R, G, B, A)
<Secondary>
<StructProperty>
<%u 0x00000010>
<%u 0x00000000>
<LinearColor>
<%f 0.00> <%f 0.00> <%f 0.00> <%f 1.0> // (R, G, B, A)
<None>

 

 

 

And I am quite surprised what happened. The game accepted values greater than 255 and made them more shiny! It's crazy and confusing.

 

For the black you want, I don't know how to persuade the game to make it more shiny at the moment.

 

Edit:

<%f 99.0> <%f 0.5> <%f 99.0> <%f 1.0>

http://i.imgur.com/9v04wot.jpg

Edited by Drakous79
Link to comment
Share on other sites

I mean black but with high saturation. look at "japgeneric" in rdngmikey's picture:

https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak-xpa1/t31.0-8/10648839_707151869356253_4998266155295236436_o.jpg

 

I want that but black instead. so obviously it would be 0, 0, 0, but the saturation value would be different and I'm not sure how I would go about changing that, considering I can't just search for "00 00 00 00 00 00" etc in the hex editor.

I modded the numbers to below 0 in direct hex, i.e. 0 = 3A roughly, i put the number at 39 and ended up with blacker than black, as far as I know you cannot make black bright in this, because to make something bright you take the color numbers above their normal range, for black, below their normal range.

 

 

Thank you, thank you, thank you Drakous for translating my post into something a little more understandable.

 

If anyone wants to use the information that I have posted, please remember that I am using info that I have obtained from others and have expanded on, nothing more. Please be sure to obtain their permission before using anything.

I got my start from here.

http://wiki.tesnexus.com/index.php/Color_Palettes_-_XCOM:EU_2012

Edited by rdngmikey
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...