Posts: 2,671
Thanks: 63752 in 193 Posts
25 Achievements
GFX Resources and No Adults in Households
Has anyone had any luck with editing the _GFX resources? I looked around the Python scripts and couldn't find where it was preventing creating a household with no adults. Took apart some of the GFX stuff using JPEXS (which supports GFX files without needing to rename them and hex edit hack the first three bytes of the file now) and found some references to the HouseholdContainsAdults() test. See the discussion in
this thread for more info about the JPEXS stuff.
You can edit the scripts right in JPEXS, and I quickly found that any change that alters the length of the file will cause the game to hang (infinite loading screen). So careful code changes would have to be done.
I first attempted to just change that function (and one other that performs the same test) by simply changing the 'return false' at the end of the function to a 'return true' (same length for the AVM bytecode). No help, the function is being loaded from somewhere else not that GFX file. Tried changing the same functions in multiple likely sounding files. No luck.
So finally I figured I'd alter the behavior of the actual play button press. Found the relevant code in the CASNavigationMain class starting at line 374:
Code:
var _loc1_:Object = CommunicationManager.CallGameService("CasGetHouseholdExchangeData","0");
if(_loc1_)
{
_loc2_ = new ExchangeData(_loc1_);
if(_loc2_.HouseholdContainsAdults()) <-------- Failure of this test results in "Household must have an adult" dialog
{
Changing this in any serious manner will definitely change the length of the file, resulting in the infinite load screen. Bad. So I went to edit the actual AVM opcodes in the Method/Getter/Setter Trait pane of JPEXS. The code above being translated to the following for the VM:
Code:
; 60 35
getlex Qname(PackageNamespace("olympus.io"),"CommunicationManager")
; 2c bc 2f
pushstring "CasGetHouseholdExchangeData"
; 2c 9a 09
pushstring "0"
; 46 fc 01 02
callproperty Qname(PackageNamespace(""),"CallGameService") 2
; 80 03
coerce Qname(PackageNamespace(""),"Object")
; d5
setlocal_1
; d1
getlocal_1
; 12 c5 00 00
iffalse ofs00f5
; 5d 6e
findpropstrict Qname(PackageNamespace("gamedata.Exchange"),"ExchangeData")
; d1
getlocal_1
; 4a 6e 01
constructprop Qname(PackageNamespace("gamedata.Exchange"),"ExchangeData") 1
; 80 6e
coerce Qname(PackageNamespace("gamedata.Exchange"),"ExchangeData")
; d6
setlocal_2
; d2
getlocal_2
; 46 96 06 00
callproperty Qname(PackageNamespace(""),"HouseholdContainsAdults") 0
; 12 7f 00 00
iffalse ofs00c1
I simply replaced the last callproperty opcode with 4 nop opcodes so that instead of testing the return code from the HouseholdContainsAdults() test it just tests the local _loc2_ - which we know must be true (or else the game is seriously broken).
Success! Or so I thought! CAS loaded up, I created a household with a single teen, hit play and the household summary dialog came up as if it were going to let me continue. The next load screen (prior to moving into the neighborhood) did the sit and spin for eternity.
Figured I'd completely broken it, so I tried creating a regular sim family with an adult in it. That worked fine. So the GFX resource must be working fine, it (or another GFX) is just testing somewhere again (or perhaps failing to test, assuming there is an adult) and hanging when it gets unexpected results.
Tried plugging away at various other GFX resources to get it going further (namely those associated with the neighborhood and the move in screen, as well as various libraries in the GFX resources). No luck. Managed to hang and crash TS4 a lot though!
Anyway, I'm stuck - at least for now I'm setting it aside. But thought I'd share what I've learned though in case someone with more AS knowledge, or even better access to Scaleform CLIK which is my best guest as to what the GFX resources were built with. Tried using the export to FLA feature of JPEXS, but that strips out all of the AS scripts that aren't directly associated with a Flash object. So unless theres a way to put that back in with Adobe Flash Pro, using JPEXS to edit the scripts is the only way to go.
For all the game's easy modability, they sure made UI changes a pain in the