Jump to content

Finding the first step?


NephilimNexus

Recommended Posts

Trying to edit the binary compiled script is seriously rough...

 

else
{
	kSoldier.kAppearance.iGender = ((Rand(3) == 0) ? 2 : 1);
}

 

compiled is

 

06 01 02 0F 35 27 0E 00 00 29 0E 00 00 00 00 35
32 0E 00 00 3D 0E 00 00 00 01 00 3A A4 00 00 45
9A A7 2C 03 16 25 16 02

 

 

The 2C 03 16 25 16 is the magic area. The 2C is the offset for rand(), 03 is the seed (changing that to 00 means all troops are always female (tested and confirmed)), but the 16 25 16 is some sort of byte packed structure I can't wrap my brain around. The 25 changed to a 26 makes the code (Rand(3) == 1) but 35 seems to reference some completely different function in some other class entirely. It's beyond me. You'd have to create some sort of custom UnrealScript decompiler specific to XCom or something. These types of packed structures seem to be everywhere I want to change something and I just can't figure them out. Anyone else taking a look at the compiled script?

 

A7 is the bytecode for Rand. 2C is the bytcode for intconst for the next byte, which is 03.

 

16 25 16 02... not sure. Don't forget it'll need bytecode equivalent for the unary comparison operation... but there is none for unary (afaik), so it'll look like something else in bytecode than what we see decompiled. I know the code doesn't end there, since 53 is end of function. I would not be surprised if the next 2 bytes were: 16 26... then it'd make sense.

 

 

 

Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

00000170  00 00 45 9A A7 2C 03 16 25 16 02 00 2C 02 01 00  ..Eš§,..%...,...

 

Ok, so it doesn't... :D

 

16 25 16 02 00 2C 02 01
  
   0             2   1

 

2C followed by two bytes which are treated as ints from byte values... I seen that before in other code. The rest is stuff for the unary conditional.

 

BTW, I tutorialized this mod in this thread here: http://forums.nexusmods.com/index.php?/topic/811009-the-next-step/page__st__40

Edited by Daemonjax
Link to comment
Share on other sites

  • Replies 229
  • Created
  • Last Reply

Top Posters In This Topic

A7 is the bytecode for Rand. 2C is the bytcode for intconst for the next byte, which is 03.

 

Not sure this quite follows because I could change 2C and it would get rid of the Rand entirely depending on how I changed it. I guess it might've been getting confused thinking it was a two byte opcode or an object reference combined with the A7.

 

The rest is stuff for the unary conditional.

 

This is what I thought as well, given a 2 and 1 would be pretty obvious. But, changing either of those (to 0,0 or 1,1 or 2,2) had no effect on the decompiler and just caused the game itself to crash.

Link to comment
Share on other sites

This is a bit off-topic, but I thought I'd show that hex editing UPKs can bear fruit. This is something I was working on a couple weeks ago for a different UE game using the exact same methods we're looking at here:

 

 

( If you haven't played BL2, that video might not mean anything ). I'd hoped to play around more with XCOM, but I'm getting some dental surgery done tomorrow and I plan on being doped up the rest of the week.

Link to comment
Share on other sites

  • 1 month later...

I haven't read through this whole thing, but I'm curious if anyone knows. There's absolutely no way to edit the DefaultGameCore.ini and remain in online mode for Steam?

 

I'm just looking to change a few values, but all these steps I have to go through are so user unfriendly and just ridiculous.

Link to comment
Share on other sites

 

And this is safe? It won't compromise my Steam account?

 

 

Edit: I've tried it now, can't seem to get anything to work ingame. I've saved the hosts file as a txt file and also overwrote it as a 'file' file.

 

Neither seemed to work, do I need to start a new game to see the changes? I was just trying to quickly change a price of something and then loading a game to see if it works but it didn't change.

Edited by Enad1
Link to comment
Share on other sites

[And this is safe? It won't compromise my Steam account?

Yes, it's safe. May prevent you from playing XCOM EU multiplayer, haven't tried myself. In that case just delete entries from hosts and let Steam do the job.

 

I've saved the hosts file as a txt file and also overwrote it as a 'file' file.

Just to be sure I understand - you saved it as txt and then renamed to hosts without extension overwriting the original file in your windows installation folder\system32\drivers\etc\?

 

Try changing something like alien stats, on a throwaway save, just to make sure you did it right.

Or add more health to Kevlar armor and check in new game. It's the first line ... iType=eItem_ArmorKevlar,iHPBonus=1

 

Mod friendly :)

Edited by Drakous79
Link to comment
Share on other sites

[And this is safe? It won't compromise my Steam account?

Yes, it's safe. May prevent you from playing XCOM EU multiplayer, haven't tried myself. In that case just delete entries from hosts and let Steam do the job.

 

I've saved the hosts file as a txt file and also overwrote it as a 'file' file.

Just to be sure I understand - you saved it as txt and then renamed to hosts without extension overwriting the original file in your windows installation folder\system32\drivers\etc\?

 

Try changing something like alien stats, on a throwaway save, just to make sure you did it right.

Or add more health to Kevlar armor and check in new game. It's the first line ... iType=eItem_ArmorKevlar,iHPBonus=1

 

Mod friendly :)

 

At first I saved it as a text file, am I supposed to do that? But then I just overwrote the original file, maintaining the same file type. Which one am I supposed to do?

 

Edit: I just tried it both ways, tried changing the kevlar HP bonus, and started a new game. No difference. Why isn't this working for me??

Edited by Enad1
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...