Changeset 1833

Show
Ignore:
Timestamp:
10/29/08 04:25:39 (2 months ago)
Author:
ddb174
Message:

Better realMyst support. Now unpacks all files to disk. Implemented zlib compatible DEFLATE of some objects. Understands the Hsm files. Understands the Idx files.

Files:

Legend:

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

    r1828 r1833  
    26522652          </Constraints> 
    26532653 
    2654           <Layout> 
    2655             <DimensionLayout dim="0"> 
    2656               <Group type="103" groupAlignment="0" attributes="0"> 
    2657                   <Group type="102" alignment="0" attributes="0"> 
    2658                       <EmptySpace min="-2" pref="64" max="-2" attributes="0"/> 
    2659                       <Component id="jButton45" min="-2" max="-2" attributes="0"/> 
    2660                       <EmptySpace pref="713" max="32767" attributes="0"/> 
    2661                   </Group> 
    2662               </Group> 
    2663             </DimensionLayout> 
    2664             <DimensionLayout dim="1"> 
    2665               <Group type="103" groupAlignment="0" attributes="0"> 
    2666                   <Group type="102" alignment="0" attributes="0"> 
    2667                       <EmptySpace min="-2" pref="62" max="-2" attributes="0"/> 
    2668                       <Component id="jButton45" min="-2" max="-2" attributes="0"/> 
    2669                       <EmptySpace pref="314" max="32767" attributes="0"/> 
    2670                   </Group> 
    2671               </Group> 
    2672             </DimensionLayout> 
     2654          <Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout"> 
     2655            <Property name="useNullLayout" type="boolean" value="true"/> 
    26732656          </Layout> 
    26742657          <SubComponents> 
    26752658            <Component class="javax.swing.JButton" name="jButton45"> 
    26762659              <Properties> 
    2677                 <Property name="text" type="java.lang.String" value="jButton45"/> 
     2660                <Property name="text" type="java.lang.String" value="Depack"/> 
    26782661              </Properties> 
    26792662              <Events> 
    26802663                <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton45ActionPerformed"/> 
    26812664              </Events> 
     2665              <Constraints> 
     2666                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription"> 
     2667                  <AbsoluteConstraints x="50" y="120" width="-1" height="-1"/> 
     2668                </Constraint> 
     2669              </Constraints> 
     2670            </Component> 
     2671            <Component class="shared.State.TextfieldState" name="textfieldState21"> 
     2672              <Properties> 
     2673                <Property name="text" type="java.lang.String" value="textfieldState21"/> 
     2674                <Property name="name" type="java.lang.String" value="realmystIn" noResource="true"/> 
     2675              </Properties> 
     2676              <Constraints> 
     2677                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription"> 
     2678                  <AbsoluteConstraints x="80" y="30" width="410" height="-1"/> 
     2679                </Constraint> 
     2680              </Constraints> 
     2681            </Component> 
     2682            <Component class="javax.swing.JButton" name="jButton95"> 
     2683              <Properties> 
     2684                <Property name="text" type="java.lang.String" value="select"/> 
     2685              </Properties> 
     2686              <Events> 
     2687                <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton95ActionPerformed"/> 
     2688              </Events> 
     2689              <Constraints> 
     2690                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription"> 
     2691                  <AbsoluteConstraints x="500" y="20" width="-1" height="-1"/> 
     2692                </Constraint> 
     2693              </Constraints> 
     2694            </Component> 
     2695            <Component class="javax.swing.JButton" name="jButton101"> 
     2696              <Properties> 
     2697                <Property name="text" type="java.lang.String" value="select"/> 
     2698              </Properties> 
     2699              <Events> 
     2700                <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton101ActionPerformed"/> 
     2701              </Events> 
     2702              <Constraints> 
     2703                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription"> 
     2704                  <AbsoluteConstraints x="510" y="70" width="-1" height="-1"/> 
     2705                </Constraint> 
     2706              </Constraints> 
     2707            </Component> 
     2708            <Component class="shared.State.TextfieldState" name="textfieldState24"> 
     2709              <Properties> 
     2710                <Property name="text" type="java.lang.String" value="textfieldState24"/> 
     2711                <Property name="name" type="java.lang.String" value="realmystOut" noResource="true"/> 
     2712              </Properties> 
     2713              <Constraints> 
     2714                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription"> 
     2715                  <AbsoluteConstraints x="80" y="80" width="410" height="-1"/> 
     2716                </Constraint> 
     2717              </Constraints> 
     2718            </Component> 
     2719            <Component class="javax.swing.JLabel" name="jLabel25"> 
     2720              <Properties> 
     2721                <Property name="text" type="java.lang.String" value="in file:"/> 
     2722              </Properties> 
     2723              <Constraints> 
     2724                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription"> 
     2725                  <AbsoluteConstraints x="10" y="30" width="-1" height="-1"/> 
     2726                </Constraint> 
     2727              </Constraints> 
     2728            </Component> 
     2729            <Component class="javax.swing.JLabel" name="jLabel26"> 
     2730              <Properties> 
     2731                <Property name="text" type="java.lang.String" value="out folder:"/> 
     2732              </Properties> 
     2733              <Constraints> 
     2734                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription"> 
     2735                  <AbsoluteConstraints x="10" y="80" width="60" height="-1"/> 
     2736                </Constraint> 
     2737              </Constraints> 
     2738            </Component> 
     2739            <Component class="shared.State.TextfieldState" name="textfieldState25"> 
     2740              <Properties> 
     2741                <Property name="text" type="java.lang.String" value="textfieldState25"/> 
     2742                <Property name="name" type="java.lang.String" value="realmystObjFile" noResource="true"/> 
     2743              </Properties> 
     2744              <Constraints> 
     2745                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription"> 
     2746                  <AbsoluteConstraints x="90" y="210" width="340" height="-1"/> 
     2747                </Constraint> 
     2748              </Constraints> 
     2749            </Component> 
     2750            <Component class="javax.swing.JButton" name="jButton102"> 
     2751              <Properties> 
     2752                <Property name="text" type="java.lang.String" value="Attempt to read."/> 
     2753              </Properties> 
     2754              <Events> 
     2755                <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton102ActionPerformed"/> 
     2756              </Events> 
     2757              <Constraints> 
     2758                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription"> 
     2759                  <AbsoluteConstraints x="90" y="250" width="160" height="-1"/> 
     2760                </Constraint> 
     2761              </Constraints> 
     2762            </Component> 
     2763            <Component class="javax.swing.JLabel" name="jLabel27"> 
     2764              <Properties> 
     2765                <Property name="text" type="java.lang.String" value="File:"/> 
     2766              </Properties> 
     2767              <Constraints> 
     2768                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription"> 
     2769                  <AbsoluteConstraints x="30" y="210" width="48" height="-1"/> 
     2770                </Constraint> 
     2771              </Constraints> 
     2772            </Component> 
     2773            <Component class="javax.swing.JButton" name="jButton103"> 
     2774              <Properties> 
     2775                <Property name="text" type="java.lang.String" value="select"/> 
     2776              </Properties> 
     2777              <Events> 
     2778                <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton103ActionPerformed"/> 
     2779              </Events> 
     2780              <Constraints> 
     2781                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription"> 
     2782                  <AbsoluteConstraints x="440" y="200" width="-1" height="-1"/> 
     2783                </Constraint> 
     2784              </Constraints> 
     2785            </Component> 
     2786            <Component class="javax.swing.JButton" name="jButton104"> 
     2787              <Properties> 
     2788                <Property name="text" type="java.lang.String" value="test"/> 
     2789              </Properties> 
     2790              <Events> 
     2791                <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton104ActionPerformed"/> 
     2792              </Events> 
     2793              <Constraints> 
     2794                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription"> 
     2795                  <AbsoluteConstraints x="260" y="120" width="-1" height="-1"/> 
     2796                </Constraint> 
     2797              </Constraints> 
    26822798            </Component> 
    26832799          </SubComponents> 
  • drizzle/DrizzlePrp/src/gui/Gui.java

    r1828 r1833  
    559559        jPanel10 = new javax.swing.JPanel(); 
    560560        jButton45 = new javax.swing.JButton(); 
     561        textfieldState21 = new shared.State.TextfieldState(); 
     562        jButton95 = new javax.swing.JButton(); 
     563        jButton101 = new javax.swing.JButton(); 
     564        textfieldState24 = new shared.State.TextfieldState(); 
     565        jLabel25 = new javax.swing.JLabel(); 
     566        jLabel26 = new javax.swing.JLabel(); 
     567        textfieldState25 = new shared.State.TextfieldState(); 
     568        jButton102 = new javax.swing.JButton(); 
     569        jLabel27 = new javax.swing.JLabel(); 
     570        jButton103 = new javax.swing.JButton(); 
     571        jButton104 = new javax.swing.JButton(); 
    561572        jPanel12 = new javax.swing.JPanel(); 
    562573        jButton50 = new javax.swing.JButton(); 
     
    22802291                tabsState3.addTab("GameHelp", jPanel7); 
    22812292 
    2282                 jButton45.setText("jButton45"); 
     2293                jPanel10.setLayout(null); 
     2294 
     2295                jButton45.setText("Depack"); 
    22832296                jButton45.addActionListener(new java.awt.event.ActionListener() { 
    22842297                    public void actionPerformed(java.awt.event.ActionEvent evt) { 
     
    22862299                    } 
    22872300                }); 
    2288  
    2289                 javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10); 
    2290                 jPanel10.setLayout(jPanel10Layout); 
    2291                 jPanel10Layout.setHorizontalGroup( 
    2292                     jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
    2293                     .addGroup(jPanel10Layout.createSequentialGroup() 
    2294                         .addGap(64, 64, 64) 
    2295                         .addComponent(jButton45) 
    2296                         .addContainerGap(713, Short.MAX_VALUE)) 
    2297                 ); 
    2298                 jPanel10Layout.setVerticalGroup( 
    2299                     jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
    2300                     .addGroup(jPanel10Layout.createSequentialGroup() 
    2301                         .addGap(62, 62, 62) 
    2302                         .addComponent(jButton45) 
    2303                         .addContainerGap(314, Short.MAX_VALUE)) 
    2304                 ); 
     2301                jPanel10.add(jButton45); 
     2302                jButton45.setBounds(50, 120, 66, 36); 
     2303 
     2304                textfieldState21.setText("textfieldState21"); 
     2305                textfieldState21.setName("realmystIn"); // NOI18N 
     2306                jPanel10.add(textfieldState21); 
     2307                textfieldState21.setBounds(80, 30, 410, 20); 
     2308 
     2309                jButton95.setText("select"); 
     2310                jButton95.addActionListener(new java.awt.event.ActionListener() { 
     2311                    public void actionPerformed(java.awt.event.ActionEvent evt) { 
     2312                        jButton95ActionPerformed(evt); 
     2313                    } 
     2314                }); 
     2315                jPanel10.add(jButton95); 
     2316                jButton95.setBounds(500, 20, 57, 36); 
     2317 
     2318                jButton101.setText("select"); 
     2319                jButton101.addActionListener(new java.awt.event.ActionListener() { 
     2320                    public void actionPerformed(java.awt.event.ActionEvent evt) { 
     2321                        jButton101ActionPerformed(evt); 
     2322                    } 
     2323                }); 
     2324                jPanel10.add(jButton101); 
     2325                jButton101.setBounds(510, 70, 57, 36); 
     2326 
     2327                textfieldState24.setText("textfieldState24"); 
     2328                textfieldState24.setName("realmystOut"); // NOI18N 
     2329                jPanel10.add(textfieldState24); 
     2330                textfieldState24.setBounds(80, 80, 410, 20); 
     2331 
     2332                jLabel25.setText("in file:"); 
     2333                jPanel10.add(jLabel25); 
     2334                jLabel25.setBounds(10, 30, 32, 16); 
     2335 
     2336                jLabel26.setText("out folder:"); 
     2337                jPanel10.add(jLabel26); 
     2338                jLabel26.setBounds(10, 80, 60, 16); 
     2339 
     2340                textfieldState25.setText("textfieldState25"); 
     2341                textfieldState25.setName("realmystObjFile"); // NOI18N 
     2342                jPanel10.add(textfieldState25); 
     2343                textfieldState25.setBounds(90, 210, 340, 20); 
     2344 
     2345                jButton102.setText("Attempt to read."); 
     2346                jButton102.addActionListener(new java.awt.event.ActionListener() { 
     2347                    public void actionPerformed(java.awt.event.ActionEvent evt) { 
     2348                        jButton102ActionPerformed(evt); 
     2349                    } 
     2350                }); 
     2351                jPanel10.add(jButton102); 
     2352                jButton102.setBounds(90, 250, 160, 36); 
     2353 
     2354                jLabel27.setText("File:"); 
     2355                jPanel10.add(jLabel27); 
     2356                jLabel27.setBounds(30, 210, 48, 16); 
     2357 
     2358                jButton103.setText("select"); 
     2359                jButton103.addActionListener(new java.awt.event.ActionListener() { 
     2360                    public void actionPerformed(java.awt.event.ActionEvent evt) { 
     2361                        jButton103ActionPerformed(evt); 
     2362                    } 
     2363                }); 
     2364                jPanel10.add(jButton103); 
     2365                jButton103.setBounds(440, 200, 57, 36); 
     2366 
     2367                jButton104.setText("test"); 
     2368                jButton104.addActionListener(new java.awt.event.ActionListener() { 
     2369                    public void actionPerformed(java.awt.event.ActionEvent evt) { 
     2370                        jButton104ActionPerformed(evt); 
     2371                    } 
     2372                }); 
     2373                jPanel10.add(jButton104); 
     2374                jButton104.setBounds(260, 120, 44, 36); 
    23052375 
    23062376                tabsState3.addTab("realMyst", jPanel10); 
     
    33973467 
    33983468    private void jButton45ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton45ActionPerformed 
    3399         byte[] filecontents = FileUtils.ReadFile(this.getSelectedFilename()); 
    3400         realmyst.rmcontext c = new realmyst.rmcontext(new Bytestream(filecontents)); 
    3401         realmyst.dirtfile df = new realmyst.dirtfile(c); 
     3469        //byte[] filecontents = FileUtils.ReadFile(this.getSelectedFilename()); 
     3470        //byte[] filecontents = FileUtils.ReadFile(this.textfieldState21.getText()); 
     3471        //realmyst.rmcontext c = new realmyst.rmcontext(new Bytestream(filecontents)); 
     3472        //realmyst.dirtfile df = new realmyst.dirtfile(c); 
     3473        shared.IBytestream bs = shared.SerialBytestream.createFromFilename(this.textfieldState21.getText()); 
     3474        realmyst.dirtfile df = new realmyst.dirtfile(bs); 
     3475        df.saveAllFiles(this.textfieldState24.getText()); 
     3476        int dummy=0; 
    34023477    }//GEN-LAST:event_jButton45ActionPerformed 
    34033478 
     
    37633838    automation.inplaceModifications.addDynamicTextMapAndMiscToFile(in, outfolder); 
    37643839}//GEN-LAST:event_jButton100ActionPerformed 
     3840 
     3841private void jButton95ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton95ActionPerformed 
     3842    GuiUtils.getUserSelectedFile(this.textfieldState21); 
     3843}//GEN-LAST:event_jButton95ActionPerformed 
     3844 
     3845private void jButton101ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton101ActionPerformed 
     3846    GuiUtils.getUserSelectedFolder(this.textfieldState24); 
     3847}//GEN-LAST:event_jButton101ActionPerformed 
     3848 
     3849private void jButton103ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton103ActionPerformed 
     3850    GuiUtils.getUserSelectedFile(this.textfieldState25); 
     3851}//GEN-LAST:event_jButton103ActionPerformed 
     3852 
     3853private void jButton102ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton102ActionPerformed 
     3854    String filename = this.textfieldState25.getText(); 
     3855    File f = new File(filename); 
     3856    shared.IBytestream bs = shared.SerialBytestream.createFromFilename(filename); 
     3857    realmyst.Hsm hsm; 
     3858    realmyst.Idx idx; 
     3859    realmyst.Mdb mdb; 
     3860    realmyst.Sdb sdb; 
     3861    realmyst.Shp shp; 
     3862    if(filename.toLowerCase().endsWith(".hsm")) 
     3863    { 
     3864        hsm = new realmyst.Hsm(bs); 
     3865    } 
     3866    else if(filename.toLowerCase().endsWith(".idx")) 
     3867    { 
     3868        idx = new realmyst.Idx(bs); 
     3869    } 
     3870    else if(filename.toLowerCase().endsWith(".vdb")) 
     3871    { 
     3872        if(f.getParentFile().getName().toLowerCase().equals("sdb")) 
     3873            sdb = new realmyst.Sdb(bs); 
     3874        else if(f.getParentFile().getName().toLowerCase().equals("mdb")) 
     3875            mdb = new realmyst.Mdb(bs); 
     3876    } 
     3877    else if(filename.toLowerCase().endsWith(".shp")) 
     3878    { 
     3879        shp = new realmyst.Shp(bs); 
     3880    } 
     3881    //realmyst.Idx idx = new realmyst.Idx(bs); 
     3882    //realmyst.SceneObject so = new realmyst.SceneObject(bs); 
     3883    //realmyst.Sdb mdb = new realmyst.Sdb(bs); 
     3884    if(bs.getBytesRemaining()!=0) m.warn("Didn't read all data."); 
     3885}//GEN-LAST:event_jButton102ActionPerformed 
     3886 
     3887private void jButton104ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton104ActionPerformed 
     3888    String outfol = this.textfieldState24.getText(); 
     3889     
     3890    File f = new File(outfol+"/sdb"); 
     3891    for(File child: f.listFiles()) 
     3892    { 
     3893        if(child.getName().toLowerCase().endsWith(".vdb")) 
     3894        { 
     3895            int fs = (int)child.length(); 
     3896            shared.IBytestream bs = shared.SerialBytestream.createFromFile(child); 
     3897            realmyst.Sdb mdb = new realmyst.Sdb(bs); 
     3898            int offset = bs.getAbsoluteOffset(); 
     3899            int bytesleft = bs.getBytesRemaining(); 
     3900             
     3901            if (mdb.filesizeMinusHeader!=fs-offset) 
     3902            { 
     3903                int dummy=0; 
     3904            } 
     3905            if(bytesleft!=0) 
     3906            { 
     3907                int dummy=0; 
     3908            } 
     3909            int dummy=0; 
     3910        } 
     3911    } 
     3912     
     3913    File f2 = new File(outfol+"/mdb"); 
     3914    for(File child: f2.listFiles()) 
     3915    { 
     3916        if(child.getName().toLowerCase().endsWith(".vdb")) 
     3917        { 
     3918            int fs = (int)child.length(); 
     3919            shared.IBytestream bs = shared.SerialBytestream.createFromFile(child); 
     3920            realmyst.Mdb mdb = new realmyst.Mdb(bs); 
     3921            int offset = bs.getAbsoluteOffset(); 
     3922            int bytesleft = bs.getBytesRemaining(); 
     3923             
     3924            if (mdb.u2!=fs-offset) 
     3925            { 
     3926                int dummy=0; 
     3927            } 
     3928            if(bytesleft!=0) 
     3929            { 
     3930                int dummy=0; 
     3931            } 
     3932            int dummy=0; 
     3933        } 
     3934    } 
     3935     
     3936}//GEN-LAST:event_jButton104ActionPerformed 
    37653937     
    37663938/*class c2 extends javax.swing.DefaultListSelectionModel 
     
    38273999    private javax.swing.JButton jButton10; 
    38284000    private javax.swing.JButton jButton100; 
     4001    private javax.swing.JButton jButton101; 
     4002    private javax.swing.JButton jButton102; 
     4003    private javax.swing.JButton jButton103; 
     4004    private javax.swing.JButton jButton104; 
    38294005    private javax.swing.JButton jButton11; 
    38304006    private javax.swing.JButton jButton12; 
     
    39194095    private javax.swing.JButton jButton93; 
    39204096    private javax.swing.JButton jButton94; 
     4097    private javax.swing.JButton jButton95; 
    39214098    private javax.swing.JButton jButton96; 
    39224099    private javax.swing.JButton jButton97; 
     
    39434120    private javax.swing.JLabel jLabel23; 
    39444121    private javax.swing.JLabel jLabel24; 
     4122    private javax.swing.JLabel jLabel25; 
     4123    private javax.swing.JLabel jLabel26; 
     4124    private javax.swing.JLabel jLabel27; 
    39454125    private javax.swing.JLabel jLabel3; 
    39464126    private javax.swing.JLabel jLabel4; 
     
    40294209    private shared.State.TextfieldState textfieldState2; 
    40304210    private shared.State.TextfieldState textfieldState20; 
     4211    private shared.State.TextfieldState textfieldState21; 
    40314212    private shared.State.TextfieldState textfieldState22; 
    40324213    private shared.State.TextfieldState textfieldState23; 
     4214    private shared.State.TextfieldState textfieldState24; 
     4215    private shared.State.TextfieldState textfieldState25; 
    40334216    private shared.State.TextfieldState textfieldState3; 
    40344217    private shared.State.TextfieldState textfieldState4; 
  • drizzle/DrizzlePrp/src/realmyst/dirtfile.java

    r1256 r1833  
    2222import uru.b; 
    2323import java.util.Vector; 
     24import shared.*; 
     25import java.io.File; 
    2426 
    2527//pera.dni seems to contain only .wav files. 
     
    3234    dirttree tree; 
    3335     
    34     public dirtfile(rmcontext c) 
     36    public dirtfile(IBytestream c) 
    3537    { 
    3638        header = new Header(c); 
     
    3840        tree = new dirttree(c.Fork(header.dirOffset), header.FTOffset, true); 
    3941    } 
    40     public static class Ntstring 
     42    public void saveAllFiles(String outputdir) 
    4143    { 
    42         byte[] bytes; 
    43         public Ntstring(rmcontext c) 
     44        for(dirttree child: tree.xchildren) 
    4445        { 
    45             Vector<Byte> readbytes = new Vector<Byte>(); 
    46             byte curbyte; 
    47             do 
     46            saveAllFiles(child,outputdir); 
     47        } 
     48    } 
     49    private void saveAllFiles(dirttree node, String outputdir) 
     50    { 
     51        String filename = outputdir+"/"+node.name.toString(); 
     52        if(node.isdir) 
     53        { 
     54            FileUtils.CreateFolder(filename); 
     55            for(dirttree child: node.xchildren) 
    4856            { 
    49                 curbyte = c.readByte(); 
    50                 readbytes.add(curbyte); 
    51             }while(curbyte!=0); 
    52             bytes = new byte[readbytes.size()]; 
    53             for(int i=0;i<bytes.length;i++) 
    54             { 
    55                 bytes[i] = readbytes.get(i); 
     57                saveAllFiles(child,filename); 
    5658            } 
    5759        } 
    58         public String toString() 
     60        else 
    5961        { 
    60             return b.BytesToString(bytes); 
    61         } 
    62     } 
    63     public static class DirtFile 
    64     { 
    65         byte[] rawdata; 
    66          
    67         public DirtFile(rmcontext c, int length) 
    68         { 
    69             rawdata = c.readBytes(length); 
     62            FileUtils.WriteFile(filename, node.xfile.rawdata); 
    7063        } 
    7164    } 
     
    7366    { 
    7467        Ntstring name; 
    75         DirtFile xfile; 
     68        ObjFile xfile; 
    7669        DirectoryTable xdirtable; 
    7770        FileStruct xfilestruct; 
     
    8073        dirttree[] xchildren; 
    8174         
    82         public dirttree(rmcontext c, int FTOffset, boolean isdirectory) 
     75        public dirttree(IBytestream c, int FTOffset, boolean isdirectory) 
    8376        { 
    8477            isdir = isdirectory; 
     
    10093                xfilestruct = new FileStruct(c); 
    10194                name = new Ntstring(c.Fork(xfilestruct.nameOffset)); 
    102                 shared.FileUtils.AppendText("c:/log.txt", name.toString()+"\n"); 
    103                 xfile = new DirtFile(c.Fork(xfilestruct.offset), xfilestruct.fileLength); 
     95                //shared.FileUtils.AppendText("c:/log.txt", name.toString()+"\n"); 
     96                xfile = new ObjFile(c.Fork(xfilestruct.offset), xfilestruct.fileLength, xfilestruct.isEmpty); 
    10497            } 
    10598        } 
     
    119112        int NLOffset; 
    120113        int dataOffset; 
    121         int FTOffset2; 
     114        int FTOffset2; //equals FTOffset 
    122115         
    123         public Header(rmcontext c) 
     116        public Header(IBytestream c) 
    124117        { 
    125118            header = c.readBytes(4); e.ensure(b.isEqual(header, new byte[]{'D','i','r','t'})); 
     
    140133        int[] fileOffsets; 
    141134         
    142         public DirectoryTable(rmcontext c) 
     135        public DirectoryTable(IBytestream c) 
    143136        { 
    144137            nameOffset = c.readInt(); 
     
    151144    { 
    152145        int nameOffset; 
    153         int extOffset; 
     146        int extOffset; //the offset to this structure, this var is redundent. 
    154147        int fileLength; 
    155148        int offset; 
    156149        int isEmpty; //is this what it is? 
    157150         
    158         public FileStruct(rmcontext c) 
     151        static int sum = 0; 
     152        static int all = 0; 
     153        static int diff = 0; 
     154        static int test = 0; 
     155        static int type1 = 0; 
     156        static int type2 = 0; 
     157         
     158        public FileStruct(IBytestream c) 
    159159        { 
    160160            nameOffset = c.readInt(); 
     
    163163            offset = c.readInt(); 
    164164            isEmpty = c.readInt(); 
     165            all += fileLength; 
     166            diff += fileLength-isEmpty; 
     167            test += isEmpty==0?fileLength:isEmpty; 
     168            if(isEmpty!=0) 
     169            { 
     170                int dummy=0; 
     171                sum += isEmpty; 
     172                type2++; 
     173                //m.msg("fileLength="+Integer.toString(fileLength)+" isEmpty="+Integer.toString(isEmpty)+" sum="+Integer.toString(sum)+" all="+Integer.toString(all)+" diff="+Integer.toString(diff)); 
     174                //m.msg("offsetstart="+Integer.toString(offset)+" offsetend"+Integer.toString(offset+fileLength)); 
     175                //m.msg("test="+Integer.toString(test)); 
     176            } 
     177            else 
     178            { 
     179                type1++; 
     180            } 
     181            m.msg("type1="+Integer.toString(type1)+" type2="+Integer.toString(type2)); 
     182            //m.msg(Integer.toString(extOffset)); 
    165183        } 
    166184    } 
  • drizzle/DrizzlePrp/src/realmyst/rmcontext.java

    r1256 r1833  
    2020 
    2121//import uru.context; 
    22 import uru.Bytestream
     22import shared.*
    2323import shared.readexception; 
    2424import shared.mystobj; 
    2525 
    26 public class rmcontext //extends context 
     26public class rmcontext extends SerialBytestream 
    2727{ 
    28     Bytestream in; 
     28    //IBytestream in; 
    2929     
    30     public rmcontext(Bytestream in2) 
     30    /*public rmcontext(IBytestream in2) 
    3131    { 
    3232        this.in = in2; 
     33    }*/ 
     34    /*public rmcontext(String filename) 
     35    { 
     36        super(filename); 
     37    }*/ 
     38    static rmcontext _curcontext = new rmcontext(); 
     39    public static rmcontext get() 
     40    { 
     41        return _curcontext; 
    3342    } 
    3443     
    35     private rmcontext() 
     44    private rmcontext(){} 
     45     
     46    /*public rmcontext Fork() 
    3647    { 
    37     } 
     48        rmcontext result = new rmcontext(); 
     49         
     50         
     51        return result; 
     52    }*/ 
    3853     
    39     public rmcontext Fork(int offset) 
     54    /*public rmcontext Fork(int offset) 
    4055    { 
    4156        rmcontext result = this.Fork(); 
     
    5065         
    5166        return result; 
    52     } 
     67    }*/ 
    5368     
    5469     
    55     public <T extends mystobj> T[] readVector( Class<T> objclass,int size) throws readexception 
     70    /*public <T extends mystobj> T[] readVector( Class<T> objclass,int size) throws readexception 
    5671    { 
    5772        T[] result = (T[])java.lang.reflect.Array.newInstance(objclass, size); 
     
    131146         
    132147        return result; 
    133     } 
     148    }*/ 
    134149     
    135150} 
  • drizzle/DrizzlePrp/src/shared/generic.java

    r1827 r1833  
    8787        return result; 
    8888    } 
    89     public static <T> T[] makeArray(Class objclass, int length) 
     89    public static <T> T[] makeArray(Class<T> objclass, int length) 
    9090    { 
    9191        T[] result = (T[])java.lang.reflect.Array.newInstance(objclass, length); 
  • drizzle/DrizzlePrp/src/uru/Bytestream.java

    r1715 r1833  
    2323import shared.m; 
    2424import shared.Bytes; 
     25import java.io.File; 
     26import java.io.FileInputStream; 
     27import java.io.FileNotFoundException; 
     28import shared.*; 
    2529/** 
    2630 * 
    2731 * @author user 
    2832 */ 
    29 public class Bytestream 
     33//public class Bytestream implements IBytestream 
     34public class Bytestream extends IBytestream 
    3035{ 
    3136     
     
    3540    private int maxpos; 
    3641    //private int length; //fullLength 
     42    //private boolean serial = false; 
     43    //private FileInputStream in; 
    3744 
    3845    //okay to change. 
     
    4047    public boolean throwExceptionOnEof = false; 
    4148     
    42  
     49    public int getBytesRemaining() 
     50    { 
     51        throw new uncaughtexception("Haven't implemented GetBytesRemaining yet."); 
     52    } 
     53    public int getFilelength() 
     54    { 
     55        throw new uncaughtexception("Haven't implemented GetFileLength yet."); 
     56    } 
     57    public IBytestream Fork(long offset) 
     58    { 
     59        throw new uncaughtexception("Haven't implemented fork yet."); 
     60    } 
    4361    public Bytestream(byte[] newData) 
    4462    { 
     
    5068        pos = 0; 
    5169    } 
    52     public Bytestream(){}; 
     70    private Bytestream(){}; 
    5371    public boolean eof() 
    5472    { 
     
    6785        return result; 
    6886    } 
     87    /*public static Bytestream createSerial(String filename) 
     88    { 
     89        Bytestream result = new Bytestream(); 
     90        result.serial = true; 
     91        File f = new File(filename); 
     92        if(!f.exists()) throw new shared.uncaughtexception("File doesn't exist:"+filename); 
     93        try 
     94        { 
     95            result.in = new FileInputStream(f); 
     96        } 
     97        catch(java.io.FileNotFoundException e) 
     98        { 
     99            throw new shared.uncaughtexception("File doesn't exist:"+filename); 
     100        } 
     101        return result; 
     102    }*/ 
    69103    public Bytestream Fork() 
    70104    { 
     
    199233        { 
    200234            result[i] = readByte(); 
    201         } 
    202         return result; 
    203     } 
    204     public byte[][] readMultiDimensionBytes(int num1, int num2) 
    205     { 
    206         byte[][] result = new byte[num1][]; 
    207         for(int i=0;i<num1;i++) 
    208         { 
    209             result[i] = this.readBytes(num2); 
    210         } 
    211         return result; 
    212     } 
    213     public int[][] readMultiDimensionInts(int num1, int num2) 
    214     { 
    215         int[][] result = new int[num1][]; 
    216         for(int i=0;i<num1;i++) 
    217         { 
    218             result[i] = this.readInts(num2); 
    219235        } 
    220236        return result; 
  • drizzle/DrizzlePrp/src/uru/b.java

    r1763 r1833  
    112112        int c = ByteToInt32(bytes[startpos+2])<<16; 
    113113        int d = ByteToInt32(bytes[startpos+3])<<24; 
     114        int result = a | b | c | d; 
     115        return result; 
     116    } 
     117    public static int BytesToInt32(byte b0, byte b1, byte b2, byte b3) 
     118    { 
     119        int a = ByteToInt32(b0)<<0; 
     120        int b = ByteToInt32(b1)<<8; 
     121        int c = ByteToInt32(b2)<<16; 
     122        int d = ByteToInt32(b3)<<24; 
    114123        int result = a | b | c | d; 
    115124        return result; 
  • drizzle/DrizzlePrp/src/uru/moulprp/Image.java

    r1711 r1833  
    1313import uru.Bytedeque; 
    1414import shared.readexception; 
     15import shared.IBytestream; 
    1516 
    1617/** 
     
    4041            int[][] extraPixels; 
    4142             
    42             public Level(Bytestream data, int width, int height, int texelsize) throws readexception 
     43            public Level(IBytestream data, int width, int height, int texelsize) throws readexception 
    4344            { 
    4445                this.width = width; 
     
    151152            byte[] rawdata; 
    152153             
    153             public Texel(Bytestream data, int texelsize) 
     154            public Texel(IBytestream data, int texelsize) 
    154155            { 
    155156                rawdata = data.readBytes(texelsize); 
     
    262263        } 
    263264         
    264         public Dxt(Bytestream data, int numLevels, int texwidth, int texheight, byte texelsize) throws readexception 
     265        public Dxt(IBytestream data, int numLevels, int texwidth, int texheight, byte texelsize) throws readexception 
    265266        { 
    266267            //e.ensure(texelsize==8); //DXT1