Changeset 1847

Show
Ignore:
Timestamp:
11/06/08 00:28:56 (2 months ago)
Author:
ddb174
Message:

All Sdb files are now parsed to a lower level; the Count9 subtype is now fully parsed along with the Count10 and Count11 subtypes. The 3ds exporter can now export textures and UVs(though we still can't figure out the correct texture from the game nor the UVs, this requires more Sdb knowledge). Some progress on extracting the room list for each Age.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • drizzle/DrizzlePrp/src/automation/realmyst.java

    r1846 r1847  
    3939        main.meshdata.mat = Material.create("defaultmat"); 
    4040         
     41        //add texture filename... 
     42        main.meshdata.mat.texturemap = TextureMap.create("active.hsm.dds"); 
     43         
    4144        for(Mdb mdb: mdbs) 
    4245        { 
     
    6972        }*/ 
    7073         
    71         if(mdb.fs==null) throw new ignore("Skipping NamedObj because it has no fs."); 
    72         if(mdb.bunch==null) throw new ignore("Skipping NamedObj because it has no bunch."); 
    73         if(mdb.whas==null) throw new ignore("Skipping NamedObj because it has no whas."); 
     74        String ignorereason = ""; 
     75        if(mdb.fs==null) ignorereason += "Skipping NamedObj because it has no fs. "; 
     76        if(mdb.bunch==null) ignorereason += "Skipping NamedObj because it has no bunch. "; 
     77        if(mdb.whas==null) ignorereason += "Skipping NamedObj because it has no whas. "; 
     78        if(mdb.trips==null) ignorereason += "NamedObj has no trips."; 
     79        if(!ignorereason.equals("")) throw new ignore(ignorereason); 
    7480         
    7581        Vertex[] verts = new Vertex[mdb.fs.length]; 
     
    94100 
    95101        String objname = mdb.name.toString(); 
     102         
     103        FltPair[] uvcoords = new FltPair[mdb.trips.length]; 
     104        for(int i=0;i<mdb.trips.length;i++) 
     105        { 
     106            Flt u = mdb.trips[i].x; 
     107            Flt v = mdb.trips[i].y; 
     108            uvcoords[i] = FltPair.createFromFlts(u, v); 
     109        } 
    96110 
    97111        //if(main==null) 
     
    104118        newobj.namedTriangleObject.points = PointArray.create(verts); 
    105119        newobj.namedTriangleObject.faces = FaceArray.create(faces, "defaultmat"); 
     120        //if(uvcoords.length!=0) newobj.namedTriangleObject.uvcoords = UvVerts.create(uvcoords); 
    106121        //main.meshdata.objs.add(newobj); 
     122         
     123        for(ShortTriplet face: faces) 
     124        { 
     125            if(face.p >= verts.length || face.q>= verts.length || face.r>=verts.length) 
     126            { 
     127                int dummy=0; 
     128            } 
     129        } 
     130        if(uvcoords.length!=0) 
     131        { 
     132            if(uvcoords.length!=verts.length) 
     133            { 
     134                int dummy=0; 
     135            } 
     136            else 
     137            { 
     138                if(uvcoords.length!=0) newobj.namedTriangleObject.uvcoords = UvVerts.create(uvcoords); 
     139                 
     140            } 
     141        } 
    107142 
    108143        //IBytedeque out = new Bytedeque2(); 
  • drizzle/DrizzlePrp/src/export3ds/AAA_Template.java

    r1842 r1847  
    88import shared.*; 
    99 
    10 public class AAA_Template 
     10public class AAA_Template extends tdsobj 
    1111{ 
    1212     
     
    2020    } 
    2121     
     22    public Typeid type(){throw new uncaughtexception("implement this.");} 
     23 
     24    public void innercompile(IBytedeque c) 
     25    { 
     26        throw new uncaughtexception("implement this."); 
     27    } 
     28     
    2229} 
  • drizzle/DrizzlePrp/src/export3ds/Material.java

    r1842 r1847  
    1515    public MatSpecular specular; 
    1616     
     17    public TextureMap texturemap; 
     18     
    1719    private Material(){} 
    1820     
     
    2527        result.diffuse = MatDiffuse.create((byte)204,(byte)204,(byte)204); 
    2628        result.specular = MatSpecular.create((byte)255,(byte)255,(byte)255); 
     29        result.texturemap = null; 
    2730        return result; 
    2831    } 
     
    3437        diffuse.compile(c); 
    3538        specular.compile(c); 
     39        if(texturemap!=null) texturemap.compile(c); 
    3640    } 
    3741} 
  • drizzle/DrizzlePrp/src/export3ds/NamedTriangleObject.java

    r1842 r1847  
    1313    public FaceArray faces; 
    1414     
     15    public UvVerts uvcoords; 
     16     
    1517    private NamedTriangleObject(){} 
    1618     
     
    2527        points.compile(c); 
    2628        faces.compile(c); 
     29        if(uvcoords!=null) uvcoords.compile(c); 
    2730    } 
    2831} 
  • drizzle/DrizzlePrp/src/export3ds/Typeid.java

    r1842 r1847  
    2626    facearray, 
    2727    meshmatgroup, 
     28    texturemap, 
     29    texturefilename, 
     30    uvcoords, 
    2831    ; 
    2932    public static pair[] pairs = { 
     
    4346        p((short)0x4120, facearray), 
    4447        p((short)0x4130, meshmatgroup), 
     48        p((short)0x4140, uvcoords), 
     49        p((short)0xa200, texturemap), 
     50        p((short)0xa300, texturefilename), 
    4551    }; 
    4652     
  • drizzle/DrizzlePrp/src/gui/Gui.form

    r1845 r1847  
    29252925              </Constraints> 
    29262926            </Component> 
     2927            <Component class="javax.swing.JButton" name="jButton109"> 
     2928              <Properties> 
     2929                <Property name="text" type="java.lang.String" value="string search"/> 
     2930              </Properties> 
     2931              <Events> 
     2932                <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton109ActionPerformed"/> 
     2933              </Events> 
     2934              <Constraints> 
     2935                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription"> 
     2936                  <AbsoluteConstraints x="680" y="60" width="-1" height="-1"/> 
     2937                </Constraint> 
     2938              </Constraints> 
     2939            </Component> 
    29272940          </SubComponents> 
    29282941        </Container> 
  • drizzle/DrizzlePrp/src/gui/Gui.java

    r1846 r1847  
    578578        jButton106 = new javax.swing.JButton(); 
    579579        jButton108 = new javax.swing.JButton(); 
     580        jButton109 = new javax.swing.JButton(); 
    580581        jPanel12 = new javax.swing.JPanel(); 
    581582        jButton50 = new javax.swing.JButton(); 
     
    24692470                jButton108.setBounds(410, 120, 72, 36); 
    24702471 
     2472                jButton109.setText("string search"); 
     2473                jButton109.addActionListener(new java.awt.event.ActionListener() { 
     2474                    public void actionPerformed(java.awt.event.ActionEvent evt) { 
     2475                        jButton109ActionPerformed(evt); 
     2476                    } 
     2477                }); 
     2478                jPanel10.add(jButton109); 
     2479                jButton109.setBounds(680, 60, 96, 36); 
     2480 
    24712481                tabsState3.addTab("realMyst", jPanel10); 
    24722482 
     
    41734183 
    41744184}//GEN-LAST:event_jButton108ActionPerformed 
     4185 
     4186private void jButton109ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton109ActionPerformed 
     4187    String folder = "G:/prps/realmysttest2/sdb"; 
     4188    String[] searchstrs = { 
     4189        //6910138.vdb 
     4190        //"channelwood", 
     4191        //"ch_bookroom", 
     4192        //"channel_temple", 
     4193        //"windmill", 
     4194        //"ch_sirrus01", 
     4195        //"ch_waterhut01", 
     4196        //"ch_cylinder_f", 
     4197        //"ch_achenar01", 
     4198         
     4199        //85660192.vdb 
     4200        //"me_achenar02", 
     4201        //"me_achenar01", 
     4202        //"me_pass02", 
     4203        //"mech_indoor", 
     4204        //"me_bookroom", 
     4205        //"mech_outdoor", 
     4206        //"me_conpane", 
     4207         
     4208        "se_stair04", 
     4209        "selenitic", 
     4210        "se_stair03", 
     4211        "se_stair02", 
     4212         
     4213        //"cabin", 
     4214        //"treegate", 
     4215        //"rocket", 
     4216        //"fireplace", 
     4217         
     4218        ////"stoneship01", 
     4219        ////"sn_island_laboratory", 
     4220        //"snowage", 
     4221        //"aurora", 
     4222         
     4223        //"sship_aku_room", 
     4224        //"ss_akk04", 
     4225        //"ss_deep_sea", 
     4226        //"compus_room", 
     4227        //"sship_tunnel", 
     4228        //"lighthouse", 
     4229    }; 
     4230    Vector<File> files = filesearcher.search.getallfiles(folder, false); 
     4231    for(File f: files) 
     4232    { 
     4233        boolean allfound = filesearcher.search.searchForStrings(f, searchstrs); 
     4234        if(allfound) 
     4235        { 
     4236            String filename = f.getName(); 
     4237            int dummy=0; 
     4238        } 
     4239    } 
     4240}//GEN-LAST:event_jButton109ActionPerformed 
    41754241     
    41764242/*class c2 extends javax.swing.DefaultListSelectionModel 
     
    42454311    private javax.swing.JButton jButton107; 
    42464312    private javax.swing.JButton jButton108; 
     4313    private javax.swing.JButton jButton109; 
    42474314    private javax.swing.JButton jButton11; 
    42484315    private javax.swing.JButton jButton12; 
  • drizzle/DrizzlePrp/src/realmyst/Count10.java

    r1842 r1847  
    2424{ 
    2525    //int tag; 
    26     Typeid type; 
     26    public Typeid type; 
    2727    int size; 
    2828    int sub1; 
     
    170170            int u4 = c.readInt(); e.ensure(u4,0,1,4,6,7,5,37837212); 
    171171            int count = c.readInt(); //e.ensure(u5,2); 
    172             //suboccref[] subs = c.readArray(suboccref.class, count); 
    173             Object[] subs = new Object[count]; 
    174             for(int i=0;i<count;i++) 
    175             { 
    176                 subs[i] = TaggedObj.readwithtype(type, c); 
    177             } 
     172            suboccref[] subs = c.readArray(suboccref.class, count); 
     173            //Object[] subs = new Object[count]; 
     174            //for(int i=0;i<count;i++) 
     175            //{ 
     176            //    subs[i] = TaggedObj.readwithtype(type, c); 
     177            //} 
     178             
    178179            /*int u6 = c.readInt(); e.ensure(u6,0); 
    179180            int u7 = c.readInt(); e.ensure(u7,1); 
  • drizzle/DrizzlePrp/src/realmyst/Count11.java

    r1842 r1847  
    4848            { 
    4949                m.msg("reading extra int and flt"); 
    50                 int u6 = c.readInt(); e.ensure(u6,4); 
     50                int u6 = c.readInt(); e.ensure(u6,4,10); 
    5151                Flt f1 = new Flt(c); //0.5 
    5252                int dummy=0; 
  • drizzle/DrizzlePrp/src/realmyst/Count9.java

    r1842 r1847  
    3333        Bstr s1 = new Bstr(c); 
    3434        byte b1 = c.readByte(); e.ensure((int)b1,15); 
    35         int u2 = c.readInt(); 
    36         int u3 = c.readInt(); 
    37         int u4 = c.readInt(); 
    38         int u5 = c.readInt(); 
    39         int u6 = c.readInt(); 
    40         int u7 = c.readInt(); 
    41         int u8 = c.readInt(); 
     35        int u2 = c.readInt(); e.ensure(u2,0); 
     36        int u3 = c.readInt(); e.ensure(u3,0,5,3,1,2,4); 
     37        int u4 = c.readInt(); //e.ensure(u4,16418,4,24580,17412,16388,25604); 
     38        int u5 = c.readInt(); e.ensure(u5,0); 
     39        int u6 = c.readInt(); e.ensure(u6,0,1,2); 
     40        //int u7 = c.readInt(); e.ensure(u7,0); 
     41        Bstr u7 = new Bstr(c); //usually empty. 
     42        //int u8 = c.readInt(); e.ensure(u8,0); 
     43        Bstr u8 = new Bstr(c); //usually empty. 
    4244        int u9 = c.readInt(); 
    4345        //Bstr s2 = new Bstr(c); 
     
    5254            //int u11 = c.readInt(); e.ensure(u11,1001); //3 
    5355            //Typeid reftype = Typeid.read(c); 
    54             TaggedObj[] refs = c.readArray(TaggedObj.class, u10); 
     56            //TaggedObj[] refs = c.readArray(TaggedObj.class, u10); 
     57            Ref2[] ref2s = c.readArray(Ref2.class, u10); 
    5558            //if(reftype==Typeid.ref) 
    5659            //{ 
     
    109112        public Ref2(IBytestream c) 
    110113        { 
    111             Typeid targetTypeMaybe = Typeid.read(c); 
     114            //Typeid thisguy = Typeid.read(c); //ref2, ref 
     115            int tag = c.readInt(); 
     116             
     117            Typeid type2 = Typeid.read(c); e.ensure(type2==Typeid.count9ref);//count9ref 
    112118            int u1 = c.readInt(); e.ensure(u1,0); 
    113119            int u2 = c.readInt(); e.ensure(u2,1); 
    114             int u3 = c.readInt(); e.ensure(u3,8); 
    115             int u4 = c.readInt(); e.ensure(u4,2); 
    116             int u5 = c.readInt(); //e.ensure(u5,676); //676,762,1064,etc 
    117             int u6 = c.readInt(); e.ensure(u6,0); 
    118             Bstr s1 = new Bstr(c); 
    119             int u7 = c.readInt(); e.ensure(u7,3); 
     120            int u3 = c.readInt(); e.ensure(u3,8,24,10,26); //24 
     121            int dummy2=0; 
     122            /*int u4 = c.readInt(); e.ensure(u4,2,1); 
     123            if(u4==2) 
     124            { 
     125                int u5 = c.readInt(); e.ensure(u5,1); // 
     126                int u6 = c.readInt(); e.ensure(u6,0); 
     127                Bstr s1 = new Bstr(c); 
     128                int u7 = c.readInt(); e.ensure(u7,1); //3 seems the same. 
     129            } 
     130            else if(u4==1) 
     131            { 
     132                if(u3==8) 
     133                { 
     134                    int u5 = c.readInt(); e.ensure(u5,0); 
     135                    int u12 = c.readInt(); 
     136                    Bstr[] s3s = c.readArray(Bstr.class, u12); 
     137                } 
     138                else if(u3==24) 
     139                { 
     140                    int v1 = c.readInt(); //1 
     141                    int v2 = c.readInt(); //0 
     142                    int v3 = c.readInt(); //0 
     143                    int v4 = c.readInt(); //2000 
     144                    int v5 = c.readInt(); //2000 
     145                    int v6 = c.readInt(); //1 
     146                    byte v7 = c.readByte(); //0 
     147                    int v8 = c.readInt(); //1 
     148                    int v9 = c.readInt(); //0 
     149                } 
     150                 
     151            } 
     152            else 
     153            { 
     154                int dummy=0; 
     155            }*/ 
     156             
     157             
     158            //if(thisguy==Typeid.ref2) 
     159            if(tag==0x3ea) 
     160            { 
     161                //Typeid targetTypeMaybe = Typeid.read(c); //count9ref 
     162                //int u1 = c.readInt(); e.ensure(u1,0); 
     163                //int u2 = c.readInt(); e.ensure(u2,1); 
     164                //int u3 = c.readInt(); e.ensure(u3,8,10,24); 
     165                int u4 = c.readInt(); e.ensure(u4,2); 
     166                int u5 = c.readInt(); //e.ensure(u5,676); //676,762,1064,etc 
     167                //int u6 = c.readInt(); e.ensure(u6,0); 
     168                Bstr s6 = new Bstr(c); //usually empty. 
     169                Bstr s7 = new Bstr(c); 
     170                int u8 = c.readInt(); e.ensure(u8,3,1,2); //1 seems the same. 
     171                int dummy=0; 
     172            } 
     173            //else if(thisguy==Typeid.ref) 
     174            else if(tag==0x3e9) 
     175            { 
     176                //Typeid type = Typeid.read(c); //count9ref 
     177                //int u1 = c.readInt(); e.ensure(u1,0); 
     178                //int u2 = c.readInt(); e.ensure(u2,1); 
     179                //int u3 = c.readInt(); e.ensure(u3,8,10); 
     180                int u4 = c.readInt(); e.ensure(u4,1); 
     181                int count = c.readInt(); e.ensure(count,0,2);//e.ensure(u5,2); 
     182                //suboccref[] subs = c.readArray(suboccref.class, count); 
     183 
     184                int u12 = c.readInt(); //e.ensure(u12,1); //if this is not 1, the array part might break because it might be wrong. 
     185                //Bstr s3 = new Bstr(c); 
     186                Bstr[] s3s = c.readArray(Bstr.class, u12); 
     187                int dummy=0; 
     188                 
     189            } 
     190            else if(tag==0x3ec) 
     191            { 
     192                //Typeid type = Typeid.read(c); //count9ref 
     193                //int u1 = c.readInt(); e.ensure(u1,0); 
     194                //int u2 = c.readInt(); e.ensure(u2,1); 
     195                //int u3 = c.readInt(); e.ensure(u3,24,26); //24 
     196                int u4 = c.readInt(); e.ensure(u4,1); 
     197                int count = c.readInt(); e.ensure(count,1,0,2);//e.ensure(u5,2); 
     198                //suboccref[] subs = c.readArray(suboccref.class, count); 
     199 
     200                int u12 = c.readInt(); //e.ensure(u12,0,551,253,691,400,112); //if this is not 1, the array part might break because it might be wrong. 
     201                //Bstr s3 = new Bstr(c); 
     202                //Bstr[] s3s = c.readArray(Bstr.class, u12); 
     203                 
     204                int u20 = c.readInt(); //e.ensure(u20,0,90,513,93,92,510); 
     205                int u21 = c.readInt(); //e.ensure(u21,2000,0,800,250); 
     206                int u22 = c.readInt(); //e.ensure(u22,2000,0,90,513,600); 
     207                //int u23 = c.readInt(); e.ensure(u23,1); 
     208                //byte b245 = c.readByte(); e.ensure((int)b245,0); 
     209                Bstr s23 = new Bstr(c); 
     210                int u24 = c.readInt(); e.ensure(u24,1); 
     211                int u25 = c.readInt(); e.ensure(u25,0,1); 
     212                //int u26 = c.readInt(); 
     213                int dummy=0; 
     214            } 
     215            else if(tag==0x3ed) 
     216            { 
     217                //Typeid type = Typeid.read(c); //count9ref 
     218                //int u1 = c.readInt(); e.ensure(u1,0); 
     219                //int u2 = c.readInt(); e.ensure(u2,1); 
     220                //int u3 = c.readInt(); e.ensure(u3,24,26); //24 
     221                int u4 = c.readInt(); e.ensure(u4,1); 
     222                int count = c.readInt(); e.ensure(count,0,1,2);//1 might do something special. 
     223                //suboccref[] subs = c.readArray(suboccref.class, count); 
     224 
     225                int u12 = c.readInt(); //e.ensure(u12,0,400,112,253); //if this is not 1, the array part might break because it might be wrong. 
     226                //Bstr s3 = new Bstr(c); 
     227                //Bstr[] s3s = c.readArray(Bstr.class, u12); 
     228                 
     229                int u20 = c.readInt(); //e.ensure(u20,0,95,93); 
     230                int u21 = c.readInt(); //e.ensure(u21,0,688,397,548); 
     231                int u22 = c.readInt(); //e.ensure(u22,0,507,510); 
     232                Bstr s23 = new Bstr(c); 
     233                int dummy=0; 
     234            } 
     235            else if(tag==0x3) 
     236            { 
     237                //Typeid type = Typeid.read(c); //count9ref 
     238                //int u1 = c.readInt(); e.ensure(u1,0); 
     239                //int u2 = c.readInt(); e.ensure(u2,1); 
     240                //int u3 = c.readInt(); e.ensure(u3,8); 
     241            } 
     242            else if(tag==0x3eb) 
     243            { 
     244                //Typeid type = Typeid.read(c); //count9ref 
     245                //int u1 = c.readInt(); e.ensure(u1,0); 
     246                //int u2 = c.readInt(); e.ensure(u2,1); 
     247                //int u3 = c.readInt(); e.ensure(u3,8); 
     248                int u4 = c.readInt(); e.ensure(u4,1); 
     249                int u5 = c.readInt(); //e.ensure(u5,0x41200000,0x43340000,0x40000001); 
     250                int u6 = c.readInt(); e.ensure(u6,4); 
     251                int u7 = c.readInt(); e.ensure(u7,0,0x3f000000); 
     252                int dummy=0; 
     253            } 
     254            else if(tag==0x3ee) 
     255            { 
     256                //Typeid type = Typeid.read(c); //count9ref 
     257                //int u1 = c.readInt(); e.ensure(u1,0); 
     258                //int u2 = c.readInt(); e.ensure(u2,1); 
     259                //int u3 = c.readInt(); e.ensure(u3,10,8); 
     260                int u4 = c.readInt(); e.ensure(u4,1); 
     261                int u5 = c.readInt(); e.ensure(u5,2,3); 
     262                int u6 = c.readInt(); e.ensure(u6,1,6,4); 
     263                //Bstr s7 = new Bstr(c); 
     264                Bstr[] s7s = c.readArray(Bstr.class, u6); 
     265                int dummy=0; 
     266            } 
     267            else if(tag==0x0) 
     268            { 
     269                //Typeid type = Typeid.read(c); //count9ref 
     270                //int u1 = c.readInt(); e.ensure(u1,0); 
     271                //int u2 = c.readInt(); e.ensure(u2,1); 
     272                //int u3 = c.readInt(); e.ensure(u3,24); 
     273                int dummy=0; 
     274            } 
     275            else if(tag==0x1) 
     276            { 
     277                //Typeid type = Typeid.read(c); //count9ref 
     278                //int u1 = c.readInt(); e.ensure(u1,0); 
     279                //int u2 = c.readInt(); e.ensure(u2,1); 
     280                //int u3 = c.readInt(); e.ensure(u3,24); 
     281                int dummy=0; 
     282            } 
     283            else if(tag==0x9) 
     284            { 
     285                //Typeid type = Typeid.read(c); //count9ref 
     286                //int u1 = c.readInt(); e.ensure(u1,0); 
     287                //int u2 = c.readInt(); e.ensure(u2,1); 
     288                //int u3 = c.readInt(); e.ensure(u3,8,24); 
     289                int u4 = c.readInt(); e.ensure(u4,1); 
     290                int u5 = c.readInt(); e.ensure(u5,0,2); 
     291                Flt f6 = new Flt(c); 
     292                Bstr s7 = new Bstr(c); 
     293                if(u5==2) 
     294                { 
     295                    Bstr s8 = new Bstr(c); 
     296                } 
     297                int dummy=0; 
     298            } 
     299            else if(tag==0x3f0) 
     300            { 
     301                int u4 = c.readInt(); e.ensure(u4,1); 
     302                int u5 = c.readInt(); e.ensure(u5,2); 
     303                int u6 = c.readInt(); e.ensure(u6,3); 
     304                Bstr s7 = new Bstr(c); 
     305                Bstr s8 = new Bstr(c); 
     306                Bstr s9 = new Bstr(c); 
     307                int dummy=0; 
     308            } 
     309            else 
     310            { 
     311                int dummy=0; 
     312            } 
    120313         
    121314            //int strcount = c.readInt(); 
  • drizzle/DrizzlePrp/src/realmyst/Mdb.java

    r1843 r1847  
    3535    IntsFullIndex ifi; 
    3636    public wha[] whas; 
     37    public Vertex[] trips; 
    3738     
    3839     
    3940    static Primary main; 
    40      
     41    public Mdb(IBytestream c) 
     42    { 
     43        this(c,"none"); 
     44    } 
    4145    public Mdb(IBytestream c, String fntrap) 
    4246    { 
     
    116120 
    117121            int u21 = c.readInt(); //e.ensure(u21,0); 
    118             Vertex[] trips = c.readArray(Vertex.class, u21); //uvw maybe? 
     122            trips = c.readArray(Vertex.class, u21); //uvw maybe? 
    119123        } 
    120124         
  • drizzle/DrizzlePrp/src/realmyst/Sdb.java

    r1842 r1847  
    2020    public Bstr[] strs; 
    2121     
     22    public Count10[] count10s    ; 
     23     
    2224    public Sdb(IBytestream c) 
    2325    { 
    24         String filename= 
     26        String filename = new java.io.File(c.sourceName).getName(); 
     27        String trapfilename= 
    2528                //"113499986.vdb" 
    2629                //"14341445.vdb" 
    27                 "45043.vdb" 
     30                //"45043.vdb" 
     31                //"6910138.vdb" 
     32                "85655908.vdb" 
    2833                ; 
    29         if(c.sourceName.toLowerCase().endsWith(filename.toLowerCase())) 
    30         { 
    31             int dummy=0; 
     34        if(c.sourceName.toLowerCase().endsWith(trapfilename.toLowerCase())) 
     35        { 
     36            int dummy=0; 
     37        } 
     38        else 
     39        { 
     40            //return; 
    3241        } 
    3342         
     
    3544         
    3645        tag = c.readInt(); 
    37         if(tag==0x02000000) 
    38         { 
    39             //sdb header 
    40             u1 = c.readInt(); //filesize (including header) Sometimes not, though. 
    41             filesizeMinusHeader = c.readInt(); //filesize minus header 
    42             name = new Bstr(c); 
    43             m.msg(name.toString()+" u1="+Integer.toString(u1)+" u2="+Integer.toString(filesizeMinusHeader)); 
    44             //u3 = c.readInt(); 
    45             u3 = new Bstr(c); 
    46             strCount = c.readInt(); 
    47             //s2 = new Bstr(c); 
    48             if(strCount!=1) 
    49             { 
    50                 int dummy=0; 
    51             } 
    52             strs = c.readArray(Bstr.class, strCount); 
    53              
    54             if(c.getBytesRemaining()<40) 
    55             { 
    56                 int dummy=0; 
    57             } 
    58              
    59             //if(true)return; 
    60              
    61             //hsObjectGroup (sub_46c140) 
    62             int tag2 = c.readInt(); //should actually be a reverse int. 
    63             if(tag2!=0x9469DF4E) 
    64             { 
    65                 ignore = false; 
    66                 throw new ignore("Unhandled tag."); 
    67             } 
    68             ReverseInt two = new ReverseInt(c); e.ensure(two.convertToInt()==2); 
    69             int six = c.readInt();  e.ensure(six==6); 
    70             int u8 = c.readInt(); //v6 
    71             if(u8!=0) 
    72             { 
    73                 ignore = false; 
    74                 throw new ignore("Unhandled."); 
    75             } 
    76             int count = c.readInt(); //v65 
    77             Bstr[] morestrs = c.readArray(Bstr.class, count); 
    78             int count2 = c.readInt(); //v69 
    79             if(count2!=0) 
    80             { 
    81                 ignore = false; 
    82                 throw new ignore("Unhandled."); 
    83             } 
    84             int count3 = c.readInt(); //v72 
    85             if(count3!=0) 
    86             { 
    87                 ignore = false; 
    88                 throw new ignore("Unhandled."); 
    89             } 
    90  
    91             //new try: 
     46        if(tag!=0x02000000) throw new uncaughtexception("Sdb didn't have the correct magic number."); 
     47         
     48        //sdb header 
     49        u1 = c.readInt(); //filesize (including header) Sometimes not, though. 
     50        filesizeMinusHeader = c.readInt(); //filesize minus header 
     51        name = new Bstr(c); 
     52        //m.msg(name.toString()+" u1="+Integer.toString(u1)+" u2="+Integer.toString(filesizeMinusHeader)); 
     53        m.msg(name.toString()); 
     54        if(name.toString().toLowerCase().startsWith("holdingpen_")) 
     55        { 
     56            int dummy=0; 
     57        } 
     58        else 
     59        { 
     60            //return; 
     61        } 
     62        //u3 = c.readInt(); 
     63        u3 = new Bstr(c); 
     64        strCount = c.readInt(); 
     65        //s2 = new Bstr(c); 
     66        if(strCount!=1) 
     67        { 
     68            int dummy=0; 
     69        } 
     70        strs = c.readArray(Bstr.class, strCount); 
     71 
     72        //if(true)return; 
     73 
     74        if(c.getBytesRemaining()<40) 
     75        { 
     76            int dummy=0; 
     77        } 
     78 
     79        //if(true)return; 
     80 
     81        //hsObjectGroup (sub_46c140) 
     82        int tag2 = c.readInt(); //should actually be a reverse int. 
     83        if(tag2!=0x9469DF4E) 
     84        { 
     85            //ignore = false; 
     86            throw new uncaughtexception("Unhandled tag."); 
     87        } 
     88        ReverseInt two = new ReverseInt(c); e.ensure(two.convertToInt()==2); 
     89        int six = c.readInt();  e.ensure(six==6); 
     90        //int u8 = c.readInt(); //v6 
     91        //if(u8!=0) 
     92        //{ 
     93        //    //ignore = false; 
     94        //    throw new ignore("Unhandled u8."); 
     95        //} 
     96        Bstr u8 = new Bstr(c); 
     97        if(u8.strlen>0) 
     98        { 
     99            int dummy=0; 
     100        } 
     101        int count = c.readInt(); //v65 
     102        Bstr[] morestrs = c.readArray(Bstr.class, count); 
     103        int count2 = c.readInt(); //v69 
     104        if(count2!=0) 
     105        { 
     106            //ignore = false; 
     107            //throw new ignore("Unhandled count2."); 
     108            Count2Undone[] count2s = c.readArray(Count2Undone.class, count2); 
     109        } 
     110        int count3 = c.readInt(); //v72 
     111        if(count3!=0) 
     112        { 
     113            //ignore = false; 
     114            //throw new ignore("Unhandled count3."); 
     115            Count3Undone[] count3s = c.readArray(Count3Undone.class, count3); 
     116        } 
     117 
     118        //new try: 
     119        int hasThing = c.readInt(); 
     120        if(hasThing!=0) 
     121        { 
     122            //ignore = false; 
     123            //throw new ignore("Unhandled hasThing."); 
     124            CountAUndone cau = new CountAUndone(c); 
     125        } 
     126        int count4 = c.readInt(); //v78 
     127        if(count4!=0) 
     128        { 
     129            //ignore = false; 
     130            //throw new ignore("Unhandled count4."); 
     131            Count4Undone[] count4s = c.readArray(Count4Undone.class, count4); 
     132        } 
     133        int u10 = c.readInt(); //stored at offset 148 
     134        int u11 = c.readInt(); //v15 
     135        if(u11!=0) 
     136        { 
     137            //ignore = false; 
     138            //throw new ignore("Unhandled u11."); 
     139        } 
     140        int count5 = c.readInt(); //v84 
     141        if(count5!=0) 
     142        { 
     143            //ignore = false; 
     144            //throw new ignore("Unhandled count5."); 
     145            Count5Undone[] count5s = c.readArray(Count5Undone.class, count5); 
     146        } 
     147        int count6 = c.readInt(); //v86 
     148        if(count6!=0) 
     149        { 
     150            //ignore = false; 
     151            //throw new ignore("Unhandled count6."); 
     152            Count6Undone[] count6s = c.readArray(Count6Undone.class, count6); 
     153        } 
     154        int count7 = c.readInt(); //v91 
     155        if(count7!=0) 
     156        { 
     157            //ignore = false; 
     158            //throw new ignore("Unhandled count7."); 
     159            Count7Undone[] count7s = c.readArray(Count7Undone.class, count7); 
     160        } 
     161        int count8 = c.readInt(); //v96 
     162        if(count8!=0) 
     163        { 
     164            //ignore = false; 
     165            //throw new ignore("unhandled count8."); 
     166            Count8Undone[] count8s = c.readArray(Count8Undone.class, count8); 
     167        } 
     168        int count9 = c.readInt(); //v101 
     169        if(count9!=0) 
     170        { 
     171            //ignore = false; 
     172            //if(ignore) throw new ignore("unhandled."); 
     173            Count9[] c9s = c.readArray(Count9.class, count9); 
     174        } 
     175        int count10 = c.readInt(); //v107 
     176        if(count10!=0) //used by age objects, for example. 
     177        { 
     178            //m.err("unhandled."); 
     179            //ignore = false; 
     180            //if(ignore) throw new ignore("unhandled."); 
     181            count10s = c.readArray(Count10.class, count10); 
     182        } 
     183        int count11 = c.readInt(); //result 
     184        if(count11!=0) 
     185        { 
     186            //if(ignore) throw new ignore("unhandled."); 
     187            //m.msg("count11:"+c.sourceName); 
     188            //throw new uncaughtexception("unhandled."); 
     189            Count11[] c11s = c.readArray(Count11.class, count11); 
     190        } 
     191        int dummy=0; 
     192 
     193        //old try: 
     194        /*else 
     195        { 
    92196            int hasThing = c.readInt(); 
    93197            if(hasThing!=0) 
    94198            { 
    95                 ignore = false; 
    96                 throw new ignore("Unhandled."); 
     199                throw new uncaughtexception("Unhandled."); 
    97200            } 
    98201            int count4 = c.readInt(); //v78 
    99202            if(count4!=0) 
    100203            { 
    101                 ignore = false; 
    102                 throw new ignore("Unhandled."); 
     204                throw new uncaughtexception("Unhandled."); 
    103205            } 
    104             int u10 = c.readInt(); //stored at offset 148 
    105             int u11 = c.readInt(); //v15 
    106             if(u11!=0) 
     206            else 
    107207            { 
    108                 ignore = false; 
    109                 throw new ignore("Unhandled."); 
    110             } 
    111             int count5 = c.readInt(); //v84 
    112             if(count5!=0) 
    113             { 
    114                 ignore = false; 
    115                 throw new ignore("Unhandled."); 
    116             } 
    117             int count6 = c.readInt(); //v86 
    118             if(count6!=0) 
    119             { 
    120                 ignore = false; 
    121                 throw new ignore("Unhandled."); 
    122             } 
    123             int count7 = c.readInt(); //v91 
    124             if(count7!=0) 
    125             { 
    126                 ignore = false; 
    127                 throw new ignore("Unhandled."); 
    128             } 
    129             int count8 = c.readInt(); //v96 
    130             if(count8!=0) 
    131             { 
    132                 ignore = false; 
    133                 throw new ignore("unhandled."); 
    134             } 
    135             int count9 = c.readInt(); //v101 
    136             if(count9!=0) 
    137             { 
    138                 ignore = false; 
    139                 if(ignore) throw new ignore("unhandled."); 
    140                 Count9[] c9s = c.readArray(Count9.class, count9); 
    141             } 
    142             int count10 = c.readInt(); //v107 
    143             if(count10!=0) 
    144             { 
    145                 //m.err("unhandled."); 
    146                 //ignore = false; 
    147                 if(ignore) throw new ignore("unhandled."); 
    148                 Count10[] u1s = c.readArray(Count10.class, count10); 
    149             } 
    150             int count11 = c.readInt(); //result 
    151             if(count11!=0) 
    152             { 
    153                 if(ignore) throw new ignore("unhandled."); 
    154                 m.msg("count11:"+c.sourceName); 
    155                 //throw new uncaughtexception("unhandled."); 
    156                 Count11[] c11s = c.readArray(Count11.class, count11); 
    157             } 
    158              
    159             //old try: 
    160             /*else 
    161             { 
    162                 int hasThing = c.readInt(); 
    163                 if(hasThing!=0) 
     208                int u10 = c.readInt(); //stored at offset 148 
     209                int u11 = c.readInt(); //v15 
     210                if(u11!=0) 
    164211                { 
    165212          &nbs