Jump to content

Customize Easter Egg Hero Characters


Kaldreth88

Recommended Posts

I started modifying the details on the cheat heroes through hex edits, and I've been changing their appearance and stats. The only issue I can't resolve is getting the Customize option to light up in-game. The only thing I'm concerned about is being able to change the armor deco with each upgrade. I haven't been able to figure out what disables the customize option for these characters. Any help is appreciated.

Link to comment
Share on other sites

Update: I managed to figure this out already. My only issue now lies with this one line:

 

 

 

 

0F 35 03 FB FF FF B1 F9 FF FF 00 00 35 BC F8 FF FF A5 F9 FF FF 00 01 19 01 39 2C 00 00 09 00 60 53 00 00 00 01 60 53 00 00 19 19 1B 6B 03 00 00 00 00 00 00 16 09 00 AE 31 00 00 00 01 AE 31 00 00 0D 00 96 FB FF FF 00 1B 9F 12 00 00 00 00 00 00 24 00 28 16

m_kSoldier.m_kSoldier.kAppearance.iVoice = BARRACKS().m_kCharGen.GetNextMaleVoice(0, false)

 

 

I want to change this to a female voice, but I can't figure out how. Everything else has been easy, but this one line has me completely stumped. I'd just like to be able to specify a voice pack, but I can't figure out what alternative line to change it to. I haven't had any luck in figuring out the hex code for GetNextFemaleVoice. I'm wondering if there's any way I can pull up that info myself.

Edited by Kaldreth88
Link to comment
Share on other sites

The problem here is that GetNextMaleVoice and GetNextFemaleVoice are functions in XGCharacterGenerator, which is in XComGame.upk, not XComStrategyGame.upk. So the original code referenced this by having an entry in the import table for GetNextMaleVoice. They didn't need GetNextFemaleVoice, so it isn't in the import table. Therefore there is no appropriate index to use to replace the index for GetNextMaleVoice.

 

You can use the UPKUtils to create a new import table entry for GetNextFemaleVoice, and then use that index in the replacement code. I don't have the code handy to do this, but it should be possible through [ADD_IMPORT_ENTRY].

 

Another note of warning: the female voices are hardcoded into the game to a much more significant extent than the male ones. When we worked on getting the custom languages working, the GetPossibleVoices() function was always returning the same fixed set for females, without actually looking at what was available in the game. We had to work around this for Long War by replacing the native GetPossibleVoices() function with a script version that walked the available voice packages to find all available female voices.

 

Another, simpler option is to just hardcode the voice to a particular constant. It's just an integer, so set it to whatever value you like :smile:

 

Link to comment
Share on other sites

tracktwo, I tried to change it to an integer but it seems to screw up the offsets. I'm sure it's something to do with the way I'm replacing the hex code. In this particular line, this is what I changed.

 

m_kSoldier.m_kSoldier.kAppearance.iVoice = BARRACKS().m_kCharGen.GetNextMaleVoice(0, false)

0F 35 03 FB FF FF B1 F9 FF FF 00 00 35 BC F8 FF FF A5 F9 FF FF 00 01 19 01 39 2C 00 00 09 00 60 53 00 00 00 01 60 53 00 00 19 19 1B 6B 03 00 00 00 00 00 00 16 09 00 AE 31 00 00 00 01 AE 31 00 00 0D 00 96 FB FF FF 00 1B 9F 12 00 00 00 00 00 00 24 00 28 16

 

 

to

 

m_kSoldier.m_kSoldier.kAppearance.iVoice = 12

0F 35 03 FB FF FF B1 F9 FF FF 00 00 35 BC F8 FF FF A5 F9 FF FF 00 01 19 01 39 2C 00 00 09 00 60 53 00 00 00 01 60 53 00 00 2C 0C 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B

;

 

 

UEE reads it fine, but then I noticed all the offsets afterwards are broken for each case. I'm sure I'm misunderstanding something in hex editing. I poured through several documents and topics in the past couple days but I can't figure out what exactly I should change it to.

Edited by Kaldreth88
Link to comment
Share on other sites

I just saw your post about the offset problems in the UPK utils thread and posted a response there! :smile:

 

[EDIT: Moved here because you removed the original post in that thread so things were kind of disconnected]

 

The offsets are off because there is a difference between the code size and the memory size. You've maintained the same code size wtih the 0Bs, but any time you replace an index with four 0Bs you reduce the in-memory size by 4 because they are actually 8 bytes long in-game. Hence the offset mismatch.

 

You need to make sure both sizes remain fixed. An easy way to do this is to inject some index references to your replacement code with 00 <4 bytes of some index of a local variable in the function>. Each one of these consumes 5 bytes of 0Bs, so reduce that count appropriately. In my hacks that did this before I injected a JMP at the top of my replacement code to skip over the index references, but I think expressions that just reference a local variable (00 <index>) are no-ops, so you don't need to jump over it.

Edited by tracktwo
Link to comment
Share on other sites

Untested code to add the name and import for GetNextFemaleVoice:

UPK_FILE=XComStrategyGame.upk

[ADD_NAME_ENTRY]
<%u19> // string length (including terminating null)
<%t"GetNextFemaleVoice"> // ASCII null-terminated string
<%u0x00000000> // flags L (always the same)
<%u0x00070010> // flags H (always the same)

[ADD_IMPORT_ENTRY]
<Core> //Package
<Function> //Object type
<Class.XComGame.XGCharacterGenerator> // The external class
<GetNextFemaleVoice>  // Name to import

Then you can open up the result in UE explorer and look in the import table to find the index that was assigned to GetNextFemaleVoice. Replace the index for GetNextMaleVoice with this index in your replacement code.

 

Good luck!

Link to comment
Share on other sites

tracktwo, he'll also need the return value. But the bad news is that I tested new import table entries and they do not work. :sad: Name entries work both under Windows and Linux, new export variables work in some cases under Windows (it is how Mutators are enabled, for example), but I wasn't able to make import table entries work. They get parsed by XCOM engine, but when I try to actually use them the game CTDs. :sad:

 

Also the problem with new entries is that such mod creates a tons of compatibility issues. So generally I don't recommend using even new name table entries unless you absolutely can't do without them.

Edited by wghost81
Link to comment
Share on other sites

Ah right, I always forget the return values are treated separately. And I did manage to get import tables to work in a specific case, but I guess it doesn't extend to the general. My case was in fixing the customization cue sounds for the Annette and Zhang voices so they could be selected in the customize UI and play the sample sounds, and this did work, on Windows at least.

 

Agreed on the compatibility case, though. Probably the best bet is to just hard-code the value or perhaps just set it to a random number.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...