- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- OBJD File format
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- OBJD File format
Replies: 8 (Who?), Viewed: 5820 times.
#1
5th Oct 2009 at 1:08 PM
OBJD File format
Hi all,I'm having trouble parsing a couple of TS3 objd resources. I tried loading the resource in s3pe, and it seems to be having similar difficulties.
I'm parsing from this spec:
http://www.simswiki.info/wiki.php?t...ms_3:0x319E4F1D
But the attached OBJD resource isn't parsing nicely. I've tracked my issue down to byte 0x6CD. It's inside the property list of a Material Block, so should be following the typecodes as listed here:
http://www.simswiki.info/wiki.php?t...e#Material_List
If I read the first typecode byte 0x01, it prompts me to read a string of 0x40 characters, which comes out as "AX:\InStore\Complates\Materials\Store001_Basics\tikiStripes01Lrg". Then it becomes a bit of a mess, causing buffer overruns and fun stuff like that.
However, if I read the first byte, 0x01, then read a second byte (0xC0), then read a third byte (0x41) and use that third byte for the length, I get the more sensible string "X:\InStore\Complates\Materials\Store001_Basics\tikiStripes01Lrg_4". It then falls back into sync with the next property (a single byte, then a typecode 5 with two floats both equal to 1.0).
I'm not sure what the rule is for this though. What is the extra byte doing there? Or have I just done something stupid a few hundred bytes earlier which is messing up my offset?
Attached files:
S3_319E4F1D_01000000_00000000000F4297.rar (1.6 KB, 159 downloads) - View custom content | ||
Size Packed Ratio Date Time Attr CRC Meth Ver ------------------------------------------------------------------------------- S3_319E4F1D_01000000_00000000000F4297.objd 4168 1580 37% 05-10-09 20:54 .....A. 8A9A64A4 m3b 2.9 ------------------------------------------------------------------------------- 1 4168 1580 37% |
Advertisement
#2
6th Oct 2009 at 9:15 AM
Okay, answering my own question.
The definition of typecode 01:
BYTE 6 bit value
if & 0x40, value is following byte | 0x40
If first byte & 0x80, length of a following string
Otherwise value is index into string table
I was mistakenly thinking the first two "if" conditions were mutually exclusive. They're not. If the most significant bit is true, it is the length of the following string, except if it the second most significant bit is also true. In that case, the length is the value is following byte | 0x40. The spec is correct (if slightly cryptic), I just mis-read it. Mea culpa.
The definition of typecode 01:
BYTE 6 bit value
if & 0x40, value is following byte | 0x40
If first byte & 0x80, length of a following string
Otherwise value is index into string table
I was mistakenly thinking the first two "if" conditions were mutually exclusive. They're not. If the most significant bit is true, it is the length of the following string, except if it the second most significant bit is also true. In that case, the length is the value is following byte | 0x40. The spec is correct (if slightly cryptic), I just mis-read it. Mea culpa.
#3
6th Oct 2009 at 3:52 PM
Posts: 11,684
Thanks: 9674 in 11 Posts
But S3PE is still broken when confronted with some OBJDs?
"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)
#4
7th Oct 2009 at 9:54 AM
Hi Inge,
Yep, I just grabbed the latest s3pe, and it seems to be having the same issue that Postal had. Stack trace:
Yep, I just grabbed the latest s3pe, and it seems to be having the same issue that Postal had. Stack trace:
Code:
Error reading resource 319E4F1D:01000000:00000000000F4297 Exception has been thrown by the target of an invocation. Unexpected subType read: 0xC0 at 0x000006CF ---- Stack trace: at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType) at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at s3pi.WrapperDealer.WrapperDealer.WrapperForType(String type, Int32 APIversion, Stream s) at s3pi.WrapperDealer.WrapperDealer.GetResource(Int32 APIversion, IPackage pkg, IResourceIndexEntry rie, Boolean AlwaysDefault) at S3PIDemoFE.MainForm.browserWidget1_SelectedResourceChanged(Object sender, ResourceChangedEventArgs e) ---- Stack trace: at CatalogResource.CatalogResource.TypeCode01.Parse(Stream s) at CatalogResource.CatalogResource.TypeCode.CreateTypeCode(Int32 APIversion, EventHandler handler, Stream s, Byte[] prefix) at CatalogResource.CatalogResource.TypeCodeList.CreateElement(Stream s, Boolean& inc) at s3pi.Interfaces.AResource.DependentList`1.Parse(Stream s) at s3pi.Interfaces.AResource.DependentList`1..ctor(EventHandler handler, Stream s) at CatalogResource.CatalogResource.MaterialBlock.Parse(Stream s) at CatalogResource.CatalogResource.Material.Parse(Stream s) at CatalogResource.CatalogResource.MaterialList.CreateElement(Stream s) at s3pi.Interfaces.AResource.DependentList`1.CreateElement(Stream s, Boolean& inc) at s3pi.Interfaces.AResource.DependentList`1.Parse(Stream s) at s3pi.Interfaces.AResource.DependentList`1..ctor(EventHandler handler, Stream s) at CatalogResource.ObjectCatalogResource.Parse(Stream s) at CatalogResource.CatalogResource..ctor(Int32 APIversion, Stream s) at CatalogResource.ObjectCatalogResource..ctor(Int32 APIversion, Stream s)
#5
7th Oct 2009 at 9:57 AM
Posts: 11,684
Thanks: 9674 in 11 Posts
Thanks, I'll send Peter a link to this thread.
"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)
#6
7th Oct 2009 at 6:54 PM
Posts: 425
I'd been aware that there was a potential issue if both bits were set but hadn't been able to find any examples. Thanks for doing that hard part, Echo!
#7
7th Oct 2009 at 11:47 PM
I'll be honest, JFade found it, not me. But you're welcome in any case!
#8
10th Oct 2009 at 9:56 AM
Posts: 425
I've updated the WIKI page with what I think's been explained here.
#9
1st Nov 2009 at 9:44 AM
Posts: 11,684
Thanks: 9674 in 11 Posts
This fix is having to be backed out, as it was either specced in the first place, or implemented incorrectly, and was causing the weird windows in another thread.
Please can all parties revisit this thread and the wiki changes that were made on the back of it, and see if there is anything wrong in the spec?
"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Please can all parties revisit this thread and the wiki changes that were made on the back of it, and see if there is anything wrong in the spec?
"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Who Posted
|