Changeset 1850

Show
Ignore:
Timestamp:
11/07/08 09:49:06 (2 months ago)
Author:
ddb174
Message:

Now handles 94.8% of the realMyst Count3 objects.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • drizzle/DrizzlePrp/src/gui/Gui.form

    r1848 r1850  
    449449                                  <Group type="102" attributes="0"> 
    450450                                      <Group type="103" groupAlignment="0" attributes="0"> 
    451                                           <Component id="textfieldState3" pref="437" max="32767" attributes="0"/> 
     451                                          <Component id="textfieldState3" pref="433" max="32767" attributes="0"/> 
    452452                                          <Group type="102" alignment="0" attributes="0"> 
    453453                                              <EmptySpace max="-2" attributes="0"/> 
  • drizzle/DrizzlePrp/src/gui/Gui.java

    r1848 r1850  
    40334033     
    40344034    m.state.pop(); 
     4035     
     4036    m.msg("Subcount3s handled: "+Integer.toString(realmyst.Count3Undone.subcount3.numhandled)); 
     4037    m.msg("Subcount3s ignored: "+Integer.toString(realmyst.Count3Undone.subcount3.numignored)); 
     4038    m.msg("Count3s handled: "+Integer.toString(realmyst.Count3Undone.numhandled)); 
     4039    m.msg("Count3s ignored: "+Integer.toString(realmyst.Count3Undone.numignored)); 
    40354040     
    40364041    /*File f2 = new File(outfol+"/mdb"); 
  • drizzle/DrizzlePrp/src/realmyst/Count3Undone.java

    r1848 r1850  
    2929    int possibility; 
    3030     
     31    public static int numhandled=0; 
     32    public static int numignored=0; 
     33     
     34    //sub_409d40, I think, because it reads a sub_40cb70 (4x4 matrix). 
    3135    public Count3Undone(IBytestream c) 
    3236    { 
     
    4549            possibility = c.readInt(); //the texture index! -1 presumably means no texture. 
    4650            m.msg("Possibility: "+Integer.toString(possibility)); 
    47             if(true)return; 
    48         } 
     51            //if(true)return; 
     52        } 
     53         
     54        //if(size>1100) return; 
     55        //if(size>194) return; 
    4956         
    5057        //just use a fork 
     
    6370            int dummy=0; 
    6471        } 
    65         int u3 = c.readInt(); e.ensure(u3,0,1); 
    66         if(u3==1)  
    67         { 
    68             StringAndByte sb3a = new StringAndByte(c); 
    69             int dummy=0; 
    70         } 
     72        int u3 = c.readInt(); e.ensure(u3,0,1,2); 
     73        //if(u3==1)  
     74        //{ 
     75        //    StringAndByte sb3a = new StringAndByte(c); 
     76        //    int dummy=0; 
     77        //} 
     78        StringAndByte[] sb3a = c.readArray(StringAndByte.class, u3); 
    7179        int u4 = c.readInt(); e.ensure(u4,3); 
    72         int u5 = c.readInt(); e.ensure(u5,0); 
    73         int u6 = c.readInt(); //e.ensure(u6,5,8,4,13,37,12,36,21,9,1,33); //13 
    74         int u7 = c.readInt(); e.ensure(u7,1); //todo: rsetore this. 
    75         int u8 = c.readInt(); e.ensure(u8,0,0x40c0,0x80,0x4000,0x4080,0x4040,0x60c0,0x200c0,0x20040,0x40d0,0x4050,0x4010,0x4090); //16576,128, 0x4000 
    76         int u8b=0; 
    77         if((u8&0x4000)!=0) 
    78         { 
    79             u8b = c.readInt(); e.ensure(u8b,0,2,0x20,130,8,34); 
    80         } 
    81         int u9 = c.readInt(); e.ensure(u9,0,128,2,3,8,32,130,1,34,160); //128 
    82         int u10 = c.readInt(); //e.ensure(u10,0,1,0x2000,0x40,0x41,0x200,0x2040,3,2,0x4000); //1,0x2000 
    83         int u11 = c.readInt(); //e.ensure(u11,0,0x2000,0x40,0x1,0x11,0x19,0x8,0x243,0x80,0x41,2,0x100,0x18,0x2040); //0x2000,0x40 
    84         int u12 = c.readInt(); e.ensure(u12,0,16,17,8,4,1,24,128,256,32); 
    85         int u13 = c.readInt(); //e.ensure(u13,0,4); //sometimes a float. 
    86         //m.msg("count3: u8b="+Integer.toString(u8b)+" u9="+Integer.toString(u9)); 
    87         //if(true)return; 
    88         Flt u14 = new Flt(c); 
    89         Flt u15 = new Flt(c); 
    90         Flt u16 = new Flt(c); 
    91         Flt u17 = new Flt(c); 
    92         Flt u18 = new Flt(c); 
    93         Flt f19 = new Flt(c); 
    94         Flt f20 = new Flt(c); 
    95         Flt f21 = new Flt(c); 
    96         Flt f22 = new Flt(c); 
    97         Flt f23 = new Flt(c); 
    98         int u25=0; Bstr s26=null;//int u26=0; Flt f27=null; Flt f28=null; 
    99         if((u8&0x2000)!=0) 
     80        int u5 = c.readInt(); e.ensure(u5,0,1); 
     81        int u6 = c.readInt(); e.ensure(u6,655,645,557,649,521,533,544,512,644,556,535,513,520,549,133,524,23,6,525,516,517,29,7,15,5,37,21,13,12,45,9,4,36,1,0,33,8,141);//e.ensure(u6,5,8,4,13,37,12,36,21,9,1,33); //13 
     82        int u7 = c.readInt(); e.ensure(u7,1,2,3,4,5,6); 
     83        try{ 
     84            numignored++; 
     85            subcount3[] subs = c.readArray(subcount3.class, u7); 
     86            numignored--; 
     87            numhandled++; 
     88        }catch(ignore e){ 
     89            return; 
     90        } 
     91         
     92        //wrong place probably. (u6==517, has flag 512=0x200) 
     93        //belongs after the reverse-engineered object, using flag from before it. 
     94        //if((esiPlus120&0x20000)!=0) 
     95        //esiPlus120 is 200c0 for bik and 60c0 for avi 
     96        if((u6&512)!=0) 
     97        { 
     98            //int u300 = c.readInt(); e.ensure(u300,0,4); 
     99            //Bstr s301 = new Bstr(c); //.bik video filename.  
     100            int dummy=0; 
     101        } 
     102        //does this go before the other one? 
     103        if(u5==1) 
     104        { 
     105            int u500 = c.readInt(); e.ensure(u500,1,2); 
     106            for(int i=0;i<u500;i++) 
     107            { 
     108                int u501 = c.readInt(); e.ensure(u501,0,1); 
     109                if(u501==1) 
     110                { 
     111                    //these are actually floats. 
     112                    int u510 = c.readInt(); 
     113                    int u511 = c.readInt(); 
     114                    int u512 = c.readInt(); 
     115                    int u513 = c.readInt(); 
     116                    //int u514 = c.readInt(); 
     117                    int dummy=0; 
     118                } 
     119                int u502 = c.readInt(); //e.ensure(u502,0x40000,0x41700000); 
     120                int u503 = c.readInt(); e.ensure(u503,2); 
     121                Vertex[] vertices = c.readArray(Vertex.class, 2);//u503); 
     122                int dummy=0; 
     123            } 
     124            int dummy=0; 
     125        } 
     126         
     127        //int ending = c.readInt(); 
     128        int[] endings = c.readInts(u7); 
     129        int bytesleft2 = (startpos+size)-c.getAbsoluteOffset(); 
     130        if(bytesleft2!=0) 
     131        { 
     132            int dummy=0; 
     133        } 
     134        if(true) return; 
     135         
     136         
     137         
     138        /*int u25=0; Bstr s26=null;//int u26=0; Flt f27=null; Flt f28=null; 
     139        if((esiPlus120&0x2000)!=0) 
    100140        { 
    101141            u25 = c.readInt(); e.ensure(u25,4,0); 
     
    106146        } 
    107147        int u29=0; Bstr s30=null; 
    108         if((u8&0x20000)!=0) 
     148        if((esiPlus120&0x20000)!=0) 
    109149        { 
    110150            u29 = c.readInt(); e.ensure(u29,0); 
    111151            s30 = new Bstr(c); 
    112152        } 
    113         if((u8&0x10)!=0) //16 floats; a matrix?  xform state? 
     153        if((esiPlus120&0x10)!=0) //16 floats; a matrix?  xform state? 
    114154        { 
    115155            Flt f31 = new Flt(c); 
     
    122162            Flt u35 = new Flt(c); 
    123163            Flt f36 = new Flt(c); 
    124             int u36 = c.readInt(); e.ensure(u36,0); 
     164            //int u36 = c.readInt(); e.ensure(u36,0); 
     165            Flt u36 = new Flt(c); 
    125166            //int u37 = c.readInt(); e.ensure(u35,0); 
    126167            Flt u37 = new Flt(c); 
     
    138179            int dummy=0; 
    139180        } 
    140         if((u8&0x4000)!=0) 
     181        if((esiPlus120&0x4000)!=0) 
    141182        { 
    142183            //u8b = c.readInt(); e.ensure(u8b,0,2,0x20,130,8,34); 
    143184        } 
     185         
     186        if(u5==1) 
     187        { 
     188            int u100 = c.readInt(); e.ensure(u100,1); 
     189            int u101 = c.readInt(); e.ensure(u101,0); 
     190            int u102 = c.readInt(); e.ensure(u102,0x40000); 
     191            int u103 = c.readInt(); e.ensure(u103,2); 
     192            Flt f104 = new Flt(c); 
     193            Flt f105 = new Flt(c); 
     194            Flt f106 = new Flt(c); 
     195            Flt f107 = new Flt(c); 
     196            Flt f108 = new Flt(c); 
     197            Flt f109 = new Flt(c); 
     198        } 
     199         
    144200        int u24 = c.readInt(); //e.ensure(u24,-1,13,50,0,7,20,22,47,27,28,41); //50 
    145          
    146          
    147201        int bytesleft = (startpos+size)-c.getAbsoluteOffset(); 
    148202        if(bytesleft!=0) 
    149203        { 
    150204            int dummy=0; 
    151         } 
    152          
     205        }*/ 
     206         
     207    } 
     208     
     209    public static class subcount3 
     210    { 
     211        int esiPlus120; 
     212        int ending; 
     213         
     214        public static int numignored = 0; 
     215        public static int numhandled = 0; 
     216         
     217        public subcount3(IBytestream c) 
     218        { 
     219            esiPlus120 = c.readInt(); 
     220            numignored++; 
     221            if((esiPlus120&0x8000)!=0) throw new ignore("ignoring..."); 
     222            numignored--; 
     223            numhandled++; 
     224            e.allowflags(esiPlus120,0x10,0x40,0x80,0x2000,0x4000,0x20000);//e.ensure(esiPlus120,0,0x208,0x4050,0x4090,0x4010,0x40d0,0x20040,0x200c0,0x80,0x4040,0x40c0,0x4080,0x4000,0x60c0);//e.ensure(esiPlus120,0,0x40c0,0x80,0x4000,0x4080,0x4040,0x60c0,0x200c0,0x20040,0x40d0,0x4050,0x4010,0x4090); //16576,128, 0x4000 
     225 
     226            int u8b=0; 
     227            if((esiPlus120&0x4000)!=0) 
     228            { 
     229                //u8b = c.readInt(); e.ensure(u8b,0,2,0x20,130,8,34); 
     230            } 
     231            int u9 = c.readInt(); e.ensure(u9,0,128,2,32,34,130,8,160);//e.ensure(u9,0,128,2,3,8,32,130,1,34,160); //128 
     232            //if((u6&0x20)!=0) 
     233            //{ 
     234            //    //Flt x1 = new Flt(c); 
     235            //    int dummy=0; 
     236            //} 
     237            int u10 = c.readInt(); e.ensure(u10,0,3,2,1);//e.ensure(u10,0,1,0x2000,0x40,0x41,0x200,0x2040,3,2,0x4000); //1,0x2000 
     238            int u11 = c.readInt(); e.allowflags(u11,0x1,0x2,0x4,0x20,0x40,0x80,0x100,0x200,0x400,0x800,0x2000,0x4000);//e.ensure(u11,0,0x4101,0x6040,0x4040,0x6101,0x4100,0x4200,0x204,0x2002,0x6001,0x4002,0x240,0x880,0x241,0xc81,0x4,0x5,0x141,0x102,0x61,0x480,0x101,0x4001,128,1,65,0x2000,3,320,64,2,66,0x4000,0x2001,256,512,0x2040,0x303,67,0x243,0x6000,0x201);//e.ensure(u11,0,0x2000,0x40,0x1,0x11,0x19,0x8,0x243,0x80,0x41,2,0x100,0x18,0x2040); //0x2000,0x40 
     239            int u12 = c.readInt(); e.ensure(u12,0,33,17,25,16,1,24,8,4);//e.ensure(u12,0,16,17,8,4,1,24,128,256,32); 
     240            int u13 = c.readInt(); e.ensure(u13,0,4,128,256,32,132);//e.ensure(u13,0,4); //sometimes a float. 
     241            //m.msg("count3: u8b="+Integer.toString(u8b)+" u9="+Integer.toString(u9)); 
     242            //if(true)return; 
     243            Flt u14 = new Flt(c); 
     244            Flt u15 = new Flt(c); 
     245            if((u12&0x20)!=0) 
     246            { 
     247                Flt f200 = new Flt(c); 
     248                int dummy=0; 
     249            } 
     250            if((esiPlus120&0x100)!=0) 
     251            { 
     252                int dummy=0; 
     253            } 
     254            if((esiPlus120&0x200)!=0) 
     255            { 
     256                int dummy=0; 
     257            } 
     258            if((esiPlus120&0x4000)!=0) 
     259            { 
     260                Flt f203 = new Flt(c); 
     261                int dummy=0; 
     262            } 
     263            Flt u16 = new Flt(c); 
     264            Flt u17 = new Flt(c); 
     265            Flt u18 = new Flt(c); 
     266            Flt f19 = new Flt(c); //often the previous ones are all 0.0 and this is 1.0 
     267            Flt f20 = new Flt(c); 
     268            Flt f21 = new Flt(c); 
     269            Flt f22 = new Flt(c); 
     270            Flt f23 = new Flt(c); 
     271 
     272            Matrix m400=null; 
     273            if((esiPlus120&0x10)!=0) 
     274            { 
     275                m400 = new Matrix(c); 
     276                int dummy=0; 
     277            } 
     278            //if((esiPlus120&0x8000)!=0 && (esiPlus120&0x8)!=0) throw new ignore("wait til later."); 
     279            if((esiPlus120&0x8000)!=0) 
     280            { 
     281                //sub_406bd0 
     282                if(true) throw new ignore("wait til later."); 
     283                //c.readBytes(136); 
     284                //int dummy=0; 
     285                 
     286                int u600 = c.readInt(); 
     287                int u601 = c.readInt(); 
     288                int u602 = c.readInt(); 
     289                int u603 = c.readInt(); 
     290                ReverseInt r604 = new ReverseInt(c); //e.ensure(r604.convertToInt()==99099); 
     291                ReverseInt r605 = new ReverseInt(c); 
     292                ReverseInt r606 = new ReverseInt(c); 
     293                int u607 = c.readInt(); 
     294                Flt f608 = new Flt(c); 
     295                int u609 = c.readInt(); //esi+36 
     296                Flt f610 = new Flt(c); 
     297                int u611 = c.readInt(); 
     298                int u612 = c.readInt(); 
     299                int u613 = c.readInt(); e.ensure(u613,0);//count 
     300                //int[] u614s = c.readInts(9*u613); //what is this struct? 8 ints and a Bstr. 
     301                Flt[] u615s = c.readArray(Flt.class, u609); 
     302                //possible matrix right here. 
     303                 
     304                int dummy=0; 
     305            } 
     306            if((esiPlus120&0x8)!=0) 
     307            { 
     308                int dummy=0; 
     309            } 
     310            if((esiPlus120&0x4)!=0) 
     311            { 
     312                int dummy=0; 
     313            } 
     314            if((esiPlus120&0x2)!=0) 
     315            { 
     316                int dummy=0; 
     317            } 
     318            if((esiPlus120&0x20)!=0) 
     319            { 
     320                int dummy=0; 
     321            } 
     322            if((esiPlus120&0x1000)!=0) 
     323            { 
     324                int dummy=0; 
     325            } 
     326             
     327            //wrong place probably. (u6==517, has flag 512=0x200) 
     328            //belongs after the reverse-engineered object, using flag from before it. 
     329            //if((esiPlus120&0x20000)!=0) 
     330            //esiPlus120 is 200c0 for bik and 60c0 for avi 
     331            //if((u6&512)!=0) 
     332            int extracount=0; 
     333            if((esiPlus120&0x20000)!=0) 
     334            { 
     335                int u300 = c.readInt(); e.ensure(u300,0,4); 
     336                Bstr s301 = new Bstr(c); //.bik video filename.  
     337                extracount++; 
     338                int dummy=0; 
     339            } 
     340            if((esiPlus120&0x2000)!=0) 
     341            { 
     342                int u300 = c.readInt(); e.ensure(u300,0,4); 
     343                Bstr s301 = new Bstr(c); //.avi video filename.  
     344                extracount++; 
     345                int dummy=0; 
     346            } 
     347            if(extracount>1) 
     348            { 
     349                int dummy=0; 
     350            } 
     351             
     352             
     353            //ending = c.readInt(); 
     354             
     355        } 
    153356    } 
    154357} 
  • drizzle/DrizzlePrp/src/shared/IBytestream.java

    r1847 r1850  
    8585                throw new uncaughtexception("Encountered readexception."); 
    8686            } 
     87            else if(e2 instanceof ignore) 
     88            { 
     89                throw (ignore)e2; 
     90            } 
    8791            else 
    8892            { 
  • drizzle/DrizzlePrp/src/shared/e.java

    r1842 r1850  
    3535        } 
    3636    } 
    37      
     37    public static void allowflags(int var, int... allowedflags) 
     38    { 
     39        int allflags = 0; 
     40        for(int flag: allowedflags) 
     41        { 
     42            allflags |= flag; 
     43        } 
     44         
     45        int result = var & (~allflags); 
     46        if(result!=0) 
     47        { 
     48            m.warn("Flag not in list of allowed flags. These are the disallowed flags: "+Integer.toBinaryString(result)); 
     49        } 
     50    } 
    3851    /*public static void ensure(short a, int ... options) 
    3952    {