Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
1978 gallons of pancake batter
Original Poster
#1 Old 1st Mar 2011 at 9:39 PM
Default NameGuidMap - Relation between string key and resource instance value
When an object gets created by GlobalFunctions.CreateObjectOutOfWorld() or one of its siblings, it gets created by using a string parameter. That string gets used to get a ResourceKey for the object by calling NameGuidMap.GetGuidByName(). The call then vanishes to the unmanaged code with ScriptCore.NameGuidMapService.NameGuidMapService_GetGuidByName().

Obviously NameGuidMap is some sort of lookup table to link the string keys to the arbitrary numbered OBJD resources. For the cake slice for example, the key is "foodEatBirthdayCake" and the cake slice's OBJD instance is 0x06BE. There seems to be nothing in the slice's resources that works as a link between key and instance value. The only occurance of the FNV64 hash of "foodEatBirthdayCake" is the slice's _RIG and FTPT.

Does anyone have an idea where string key and instance value are linked?

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Advertisement
Top Secret Researcher
#2 Old 1st Mar 2011 at 9:52 PM
Honestly, I simply wrote my own "CreateObject" function that takes the Instance value directly, and bypassed the NameGuidMap section.

Never did look further into whether that system can be altered.

If you happen to find it, and it is a tunable resource, I would love to hear about it.


NRaas Industries: Sims 3 Mods for the Discerning Player, hosted by The Wikispaces.
1978 gallons of pancake batter
Original Poster
#3 Old 1st Mar 2011 at 10:06 PM
Quote: Originally posted by twallan
If you happen to find it, and it is a tunable resource, I would love to hear about it.
If it were a tunable resource, there would be no need to put that in the unmanaged code, would there? Do you think the devs could have actually hard-coded that lookup table into the executable? Sounds like a terrible thing to do. Until now, I assumed that it had to be some generic thing that gets built when the game loads the resources. Now I'm not so sure about that assumption anymore.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Top Secret Researcher
#4 Old 1st Mar 2011 at 10:41 PM
Quote: Originally posted by Buzzler
Do you think the devs could have actually hard-coded that lookup table into the executable?


Those were indeed my exact thoughts when I originally investigated.

However, it could be loaded in managed code, and accessed through the game-engine... Attempting to trace it back in that circumstance is nigh impossible.


NRaas Industries: Sims 3 Mods for the Discerning Player, hosted by The Wikispaces.
Giblets for hire
#5 Old 27th Mar 2011 at 1:25 PM
The engine loads nameguidmaps from packages; it's a <int version> <int count> <[uint64 hash, uint64 guid]* guidmap>.

(type 0xF3A38370)
Lab Assistant
#6 Old 8th Apr 2012 at 7:55 AM
I played with this yesterday (with Inge helping me a lot) and we got the CreateObjectOutOfWorld working. As Rick says above, one has to add NGMP to the package and add a mapping from InstanceName to GUID. Version can be 1 (I think this was default), I also did not not need to define count separately.

The InstanceName that script uses often comes from tuning xmls and may not necessarily be the same as the actual InstanceName in the OBJD. But you have probably set that somewhere anyway, if not, hash the InstanceName. The GUID parameter comes from the Instance column of OBJK/OBJD, you see that in the main view (left side) in S3PE.
One horse disagreer of the Apocalypse
#7 Old 8th Apr 2012 at 8:32 AM
Can you clarify about adding NGMP to the package? Presumably you don't add the entire NGMP and override the original - do you make a new small one with just your own new entry in it? Does it have to have any particular ResourceKey convention?

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Lab Assistant
#8 Old 8th Apr 2012 at 9:52 AM
I just selected Add from the popup and in the dialog set the type to NGMP, group to 0x0 and gave random name to make name hash from. When the new resource was there, I used Grid option to edit it. I added just the info I described in my previous post.

So yes, I created a new small one with just my entry in it. I only found one NGMP from game packages and that had no name, so I assumed there are no naming conventions (if that is what you mean by ResourceKey convention).
One horse disagreer of the Apocalypse
#9 Old 8th Apr 2012 at 10:25 AM
ResourceKey refers to the Type,Group, and Instance number of a resource, while Name (in the S3PE context) refers to to string that appears in the Name column, which is obtained from the _KEY resource. Anyway you answered my question, thanks

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Inventor
#10 Old 3rd Jan 2013 at 1:13 AM Last edited by douglasveiga : 3rd Jan 2013 at 2:22 AM.
Sorry about resurrecting this thread.

the "The GUID parameter comes from the Instance column of OBJK/OBJD" needs to be hash 32 or 64??
64

to create the object "GlobalFunctions.CreateObjectOutOfWorld("mynewinstancenameFromNGMP",ProductVersion.BaseGame);" works??? works.


in the NGMP file:
Quote:
Version: 0x00000001
--- NGMPPairList: Data (0x1) ---
[0]: NameHash: (hash of "mynewinstancenameFromNGMP"); Instance: (Instance from column of OBJK/OBJD)
---

is it correct?? is correct.


already solved.
thanks very much guys!! :D
One horse disagreer of the Apocalypse
#11 Old 3rd Jan 2013 at 3:21 PM
Thanks Douglas

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Test Subject
#12 Old 22nd Nov 2014 at 3:06 AM Last edited by tenmang : 22nd Nov 2014 at 3:56 AM.
Hello, thanks to your NGMP and other tutors I finally can export plant and ingredient from EP
Plant: can plant from seed or fruit from inventory, buy auto soil. very good
Ingredient: can buy from store, put in inventory. But I can not get the ingredient image to show up in inventory or on the harvest stage plant, it still have string name show up if i hover it
In detail, I export all resources of the ghostchili ingredient but it missing objd/objk. seem that all ingredient missing objd except store content
1/ I create objd/objk map to ghostchili vpxy. create NGMP for it -> dont work
2/ just create NGMP map to vpxy/modl instance -> dont work too
[0]: NameHash: (hash of Ingredient_Key/Name in XML); Instance: (Instance from column of OBJD/MODL)
So, Ingredient object working fine without the objd resource (it default "Ingredient" in the code) but it missing image because of mapping MODL resource. I dig into code and see GetThumbnailKey will call this line:

ResourceKey((ulong) ResourceUtils.XorFoldHashString32(str), 0x1661233, 1 | num) { InstanceId = key.InstanceId | num };

0x1661233 is MODL
I have no clue to map that ResourceUtils.XorFoldHashString32(str)
Please help me if I miss something
Inventor
#13 Old 22nd Nov 2014 at 8:19 AM
Try reading this thread http://modthesims.info/showthread.php?t=540902,
more specifically douglasveiga's posts, ignore my rambling.
Test Subject
#14 Old 22nd Nov 2014 at 1:40 PM
thanks so much. i didn't see that post :D
Back to top