- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- NameGuidMap - Relation between string key and resource instance value
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- NameGuidMap - Relation between string key and resource instance value
Replies: 13 (Who?), Viewed: 6069 times.
#1
1st Mar 2011 at 9:39 PM
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
#2
1st Mar 2011 at 9:52 PM
Posts: 1,728
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.
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.
#3
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 gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
#4
1st Mar 2011 at 10:41 PM
Posts: 1,728
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.
#5
27th Mar 2011 at 1:25 PM
Posts: 150
Thanks: 26371 in 64 Posts
The engine loads nameguidmaps from packages; it's a <int version> <int count> <[uint64 hash, uint64 guid]* guidmap>.
(type 0xF3A38370)
(type 0xF3A38370)
Lab Assistant
#6
8th Apr 2012 at 7:55 AM
Posts: 113
Thanks: 1369 in 11 Posts
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.
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.
#7
8th Apr 2012 at 8:32 AM
Posts: 11,682
Thanks: 9675 in 11 Posts
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)
"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Lab Assistant
#8
8th Apr 2012 at 9:52 AM
Posts: 113
Thanks: 1369 in 11 Posts
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).
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).
#9
8th Apr 2012 at 10:25 AM
Posts: 11,682
Thanks: 9675 in 11 Posts
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)
"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
#10
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:
is it correct?? is correct.
already solved.
thanks very much guys!! :D
64
to create the object "GlobalFunctions.CreateObjectOutOfWorld("mynewinstancenameFromNGMP",ProductVersion.BaseGame);"
in the NGMP file:
Quote:
Version: 0x00000001 --- NGMPPairList: Data (0x1) --- [0]: NameHash: (hash of "mynewinstancenameFromNGMP"); Instance: (Instance from column of OBJK/OBJD) --- |
already solved.
thanks very much guys!! :D
#11
3rd Jan 2013 at 3:21 PM
Posts: 11,682
Thanks: 9675 in 11 Posts
Thanks Douglas
"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Test Subject
#12
22nd Nov 2014 at 3:06 AM
Last edited by tenmang : 22nd Nov 2014 at 3:56 AM.
Posts: 35
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
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
#13
22nd Nov 2014 at 8:19 AM
Posts: 997
Thanks: 22004 in 95 Posts
Try reading this thread http://modthesims.info/showthread.php?t=540902,
more specifically douglasveiga's posts, ignore my rambling.
more specifically douglasveiga's posts, ignore my rambling.
Test Subject
#14
22nd Nov 2014 at 1:40 PM
Posts: 35
thanks so much. i didn't see that post :D
Who Posted
|