Ejemplo n.º 1
0
        public static void glNitroBindTextures(HBDF b, int offset)
        {
            if (b.TEXSBlocks.Length == 0)
            {
                return;
            }
            int num = 0;

            foreach (HBDF.MDLFBlock.TextureBlock texture in b.MDLFBlocks[0].Textures)
            {
                string str    = b.MDLFBlocks[0].Names.Strings[(int)b.MDLFBlocks[0].NrMaterials + num * 2 + 1];
                int    index1 = 0;
                for (int index2 = 0; index2 < b.TEXSBlocks[0].TEXOBlocks.Length; ++index2)
                {
                    if (b.TEXSBlocks[0].TEXOBlocks[index2].TexName.Name == str)
                    {
                        index1 = index2;
                        break;
                    }
                }
                if (b.TEXSBlocks[0].TEXOBlocks[index1].PalName != null)
                {
                    GlNitro2.glNitroTexImage2D(b.TEXSBlocks[0].GetIMGOByName(b.TEXSBlocks[0].TEXOBlocks[index1].TexName.Name).ToBitmap(b.TEXSBlocks[0].GetPLTOByName(b.TEXSBlocks[0].TEXOBlocks[index1].PalName.Name)), texture, num + offset);
                }
                else
                {
                    GlNitro2.glNitroTexImage2D(b.TEXSBlocks[0].GetIMGOByName(b.TEXSBlocks[0].TEXOBlocks[index1].TexName.Name).ToBitmap((HBDF.TEXSBlock.PLTOBlock)null), texture, num + offset);
                }
                ++num;
            }
        }
Ejemplo n.º 2
0
 public MDLF(HBDF file)
 {
     this.file = file;
     this.InitializeComponent();
     this.simpleOpenGlControl1.MouseWheel += new MouseEventHandler(this.simpleOpenGlControl1_MouseWheel);
     this.menuItem1.Text = LanguageHandler.GetString("3d.animation");
 }
Ejemplo n.º 3
0
 public void SetHBDF(HBDF Hbdf)
 {
     this.file = Hbdf;
     this.timer1.Stop();
     this.menuItem2.MenuItems.Clear();
     GlNitro2.glNitroBindTextures(this.file, 1);
     this.Render();
 }
Ejemplo n.º 4
0
        private void MPDSEditor_Load(object sender, EventArgs e)
        {
            byte[] numArray1 = Compression.LZ77Decompress(this.BoardData.Files[1].Data);
            byte[] numArray2 = Compression.LZ77Decompress(this.BoardData.Files[2].Data);
            byte[] numArray3 = Compression.LZ77Decompress(this.BoardData.Files[0].Data);
            byte[] array1    = ((IEnumerable <byte>)numArray1).ToList <byte>().GetRange(4, numArray1.Length - 4).ToArray();
            byte[] array2    = ((IEnumerable <byte>)numArray2).ToList <byte>().GetRange(4, numArray2.Length - 4).ToArray();
            byte[] array3    = ((IEnumerable <byte>)numArray3).ToList <byte>().GetRange(4, numArray3.Length - 4).ToArray();
            this.pictureBox1.Image = (Image)Graphic.ConvertData(array2, 0, 0, array1, array3, 256, 256, Graphic.GXTexFmt.GX_TEXFMT_PLTT16, Graphic.NNSG2dCharacterFmt.NNS_G2D_CHARACTER_FMT_CHAR);
            this.Layout            = new BoardLayout(Compression.LZ77Decompress(this.BoardData.Files[3].Data));
            int index1 = -1;
            int num    = 0;

            for (int index2 = 4; (long)index2 < (long)this.BoardData.NrFiles; ++index2)
            {
                int length = this.BoardData.Files[index2].Data.Length;
                if (length > num)
                {
                    num    = length;
                    index1 = index2;
                }
            }
            this.Model      = new HBDF(Compression.LZ77Decompress(this.BoardData.Files[index1].Data));
            this.Spaces     = new HBDF.TEXSBlock(Compression.LZ77Decompress(this.SystemData.Files[69].Data));
            this.Objects[0] = new HBDF(Compression.LZ77Decompress(this.SystemData.Files[32].Data));
            this.Objects[1] = new HBDF(Compression.LZ77Decompress(this.SystemData.Files[31].Data));
            this.Objects[2] = new HBDF(Compression.LZ77Decompress(this.SystemData.Files[33].Data));
            Gl.ReloadFunctions();
            Gl.glEnable(2896);
            Gl.glEnable(32826);
            Gl.glEnable(2903);
            Gl.glEnable(2929);
            Gl.glEnable(2977);
            Gl.glDisable(2884);
            Gl.glFrontFace(2305);
            Gl.glEnable(3553);
            Gl.glClearDepth(1.0);
            Gl.glEnable(3008);
            Gl.glEnable(3042);
            Gl.glBlendFunc(770, 771);
            Gl.glShadeModel(7425);
            Gl.glAlphaFunc(516, 0.0f);
            Gl.glClearColor(0.2f, 0.2f, 0.2f, 1f);
            GlNitro2.glNitroBindTextures(this.Model, 1);
            GlNitro2.glNitroBindTextures(this.Spaces, (int)this.Model.MDLFBlocks[0].NrTextures + 1);
            GlNitro2.glNitroBindTextures(this.Objects[0], (int)this.Model.MDLFBlocks[0].NrTextures + 1 + this.Spaces.TEXOBlocks.Length);
            GlNitro2.glNitroBindTextures(this.Objects[1], (int)this.Model.MDLFBlocks[0].NrTextures + 1 + this.Spaces.TEXOBlocks.Length + (int)this.Objects[0].MDLFBlocks[0].NrTextures);
            GlNitro2.glNitroBindTextures(this.Objects[2], (int)this.Model.MDLFBlocks[0].NrTextures + 1 + this.Spaces.TEXOBlocks.Length + (int)this.Objects[0].MDLFBlocks[0].NrTextures + (int)this.Objects[1].MDLFBlocks[0].NrTextures);
            this.Render();
        }
Ejemplo n.º 5
0
        private static bool Open(ByteFileInfo file, Form1 Owner, object Parameter = null, bool filedialog = false)
        {
            switch (FileHandler.GetType(file))
            {
            case "NARC":
                NARC.DirectoryEntry Root = NARC.Unpack(file.Data);
                if (FileHandler.OpenedArchives.Count != 0 && !FileHandler.OpenedArchives[0].FileName.EndsWith(".nds"))
                {
                    FileHandler.OpenedArchives.RemoveAt(FileHandler.OpenedArchives.Count - 1);
                }
                Owner.OpenNarc(Root);
                return(true);

            case "NCGR":
                NCGR Graphic = new NCGR(file.Data);
                switch (FileHandler.OpenDialog)
                {
                case MKDS_Course_Modifier.UI.BNCL _:
                    ((MKDS_Course_Modifier.UI.BNCL)FileHandler.OpenDialog).SetNCGR(Graphic);
                    break;

                case MKDS_Course_Modifier.UI.NCER _:
                    ((MKDS_Course_Modifier.UI.NCER)FileHandler.OpenDialog).SetNCGR(Graphic, FileHandler.OpenedFiles.Count);
                    return(true);
                }
                return(false);

            case "NCLR":
                MKDS_Course_Modifier.G2D_Binary_File_Format.NCLR nclr = new MKDS_Course_Modifier.G2D_Binary_File_Format.NCLR(file.Data);
                switch (FileHandler.OpenDialog)
                {
                case null:
                    FileHandler.OpenDialog = (Form) new MKDS_Course_Modifier.UI.NCLR(nclr);
                    FileHandler.OpenDialog.Show((IWin32Window)Owner);
                    FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                    return(true);

                case MKDS_Course_Modifier.UI.BNCL _:
                    ((MKDS_Course_Modifier.UI.BNCL)FileHandler.OpenDialog).SetNCLR(nclr);
                    break;

                case MKDS_Course_Modifier.UI.NCER _:
                    ((MKDS_Course_Modifier.UI.NCER)FileHandler.OpenDialog).SetNCLR(nclr);
                    break;
                }
                return(false);

            case "NSCR":
                MKDS_Course_Modifier.G2D_Binary_File_Format.NSCR nscr = new MKDS_Course_Modifier.G2D_Binary_File_Format.NSCR(file.Data);
                return(false);

            case "NSBMD":
                MKDS_Course_Modifier.G3D_Binary_File_Format.NSBMD nsbmd = new MKDS_Course_Modifier.G3D_Binary_File_Format.NSBMD(file.Data);
                if (FileHandler.OpenDialog is MKDS_Course_Modifier.UI.NSBMD)
                {
                    FileHandler.OpenedFiles.RemoveAt(FileHandler.OpenedFiles.Count - 1);
                    ((MKDS_Course_Modifier.UI.NSBMD)FileHandler.OpenDialog).SetNSBMD(nsbmd);
                    return(true);
                }
                if (FileHandler.OpenDialog != null)
                {
                    return(false);
                }
                FileHandler.OpenDialog = (Form) new MKDS_Course_Modifier.UI.NSBMD(nsbmd);
                FileHandler.OpenDialog.Show((IWin32Window)Owner);
                FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                return(true);

            case "NSBTX":
                MKDS_Course_Modifier.G3D_Binary_File_Format.NSBTX Btx = new MKDS_Course_Modifier.G3D_Binary_File_Format.NSBTX(file.Data);
                if (FileHandler.OpenDialog is MKDS_Course_Modifier.UI.NSBMD)
                {
                    ((MKDS_Course_Modifier.UI.NSBMD)FileHandler.OpenDialog).SetNSBTX(Btx);
                    return(false);
                }
                FileHandler.OpenDialog = (Form) new MKDS_Course_Modifier.UI.NSBTX(Btx);
                FileHandler.OpenDialog.Show((IWin32Window)Owner);
                FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                return(true);

            case "NSBCA":
                NSBCA Bca1 = new NSBCA(file.Data);
                if (!(FileHandler.OpenDialog is MKDS_Course_Modifier.UI.NSBMD))
                {
                    return(false);
                }
                ((MKDS_Course_Modifier.UI.NSBMD)FileHandler.OpenDialog).SetNSBCA(Bca1);
                return(false);

            case "NSBTA":
                MKDS_Course_Modifier.G3D_Binary_File_Format.NSBTA nsbta = new MKDS_Course_Modifier.G3D_Binary_File_Format.NSBTA(file.Data);
                int num = (int)MessageBox.Show("Due to problems with texture matrices, is nsbta temporary disabled.");
                return(false);

            case "NSBMA":
                NSBMA Bma = new NSBMA(file.Data);
                if (!(FileHandler.OpenDialog is MKDS_Course_Modifier.UI.NSBMD))
                {
                    return(false);
                }
                ((MKDS_Course_Modifier.UI.NSBMD)FileHandler.OpenDialog).SetNSBMA(Bma);
                return(false);

            case "NSBVA":
                NSBVA Bva = new NSBVA(file.Data);
                if (!(FileHandler.OpenDialog is MKDS_Course_Modifier.UI.NSBMD))
                {
                    return(false);
                }
                ((MKDS_Course_Modifier.UI.NSBMD)FileHandler.OpenDialog).SetNSBVA(Bva);
                return(false);

            case "NSBTP":
                NSBTP Btp = new NSBTP(file.Data);
                if (!(FileHandler.OpenDialog is MKDS_Course_Modifier.UI.NSBMD))
                {
                    return(false);
                }
                ((MKDS_Course_Modifier.UI.NSBMD)FileHandler.OpenDialog).SetNSBTP(Btp);
                return(false);

            case "KCL":
                KCL KCL = new KCL(file.Data);
                if (FileHandler.OpenDialog is MKDS_Course_Modifier.UI.MKDS.NKM)
                {
                    ((MKDS_Course_Modifier.UI.MKDS.NKM)FileHandler.OpenDialog).SetKCL(KCL);
                }
                return(false);

            case "MR":
                MKDS_Course_Modifier.MKDS.MR Mission = new MKDS_Course_Modifier.MKDS.MR(file.Data);
                if (FileHandler.OpenDialog != null)
                {
                    return(false);
                }
                FileHandler.OpenDialog = (Form) new MKDS_Course_Modifier.UI.MKDS.MR(Mission);
                FileHandler.OpenDialog.Show((IWin32Window)Owner);
                FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                return(true);

            case "NKM":
                MKDS_Course_Modifier.MKDS.NKM File1 = new MKDS_Course_Modifier.MKDS.NKM(file.Data);
                if (FileHandler.OpenDialog != null)
                {
                    return(false);
                }
                FileHandler.OpenDialog = (Form) new MKDS_Course_Modifier.UI.MKDS.NKM(File1);
                FileHandler.OpenDialog.Show((IWin32Window)Owner);
                FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                return(true);

            case "NCG.BIN":
                return(false);

            case "NCL.BIN":
                return(false);

            case "NSC.BIN":
                return(false);

            case "SPA":
                MKDS_Course_Modifier.Particles.SPA Spa = new MKDS_Course_Modifier.Particles.SPA(file.Data);
                if (FileHandler.OpenDialog != null)
                {
                    return(false);
                }
                FileHandler.OpenDialog = (Form) new MKDS_Course_Modifier.UI.SPA(Spa);
                FileHandler.OpenDialog.Show((IWin32Window)Owner);
                FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                return(true);

            case "SSEQ":
                MKDS_Course_Modifier.Sound.SSEQ file1 = new MKDS_Course_Modifier.Sound.SSEQ(file.Data);
                if (FileHandler.OpenDialog != null)
                {
                    return(false);
                }
                FileHandler.OpenDialog = (Form) new MKDS_Course_Modifier.UI.SSEQ(file1, FileHandler.m);
                FileHandler.OpenDialog.Show((IWin32Window)Owner);
                FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                return(true);

            case "SBNK":
                SBNK k = new SBNK(file.Data);
                if (FileHandler.OpenDialog != null && FileHandler.OpenDialog is MKDS_Course_Modifier.UI.SSEQ)
                {
                    SBNK s = SBNK.InitDLS(k, (SWAR[])Parameter);
                    ((MKDS_Course_Modifier.UI.SSEQ)FileHandler.OpenDialog).SetDLS(SBNK.ToDLS(s));
                }
                return(false);

            case "SDAT":
                SDAT SDAT = new SDAT(file.Data);
                Owner.OpenSDAT(SDAT);
                return(true);

            case "SSAR":
                MKDS_Course_Modifier.Sound.SSEQ file2 = new MKDS_Course_Modifier.Sound.SSEQ(file.Data, (int)Parameter);
                if (FileHandler.OpenDialog != null)
                {
                    return(false);
                }
                FileHandler.OpenDialog = (Form) new MKDS_Course_Modifier.UI.SSEQ(file2, FileHandler.m);
                FileHandler.OpenDialog.Show((IWin32Window)Owner);
                FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                return(true);

            case "NDS":
                NDS Rom = new NDS(file.Data);
                FileHandler.OpenedArchives.Clear();
                Owner.OpenNDS(Rom);
                return(true);

            case "NCER":
                MKDS_Course_Modifier.G2D_Binary_File_Format.NCER Cell = new MKDS_Course_Modifier.G2D_Binary_File_Format.NCER(file.Data);
                if (FileHandler.OpenDialog == null)
                {
                    FileHandler.OpenDialog = (Form) new MKDS_Course_Modifier.UI.NCER(Cell);
                    FileHandler.OpenDialog.Show((IWin32Window)Owner);
                    FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                    return(true);
                }
                if (FileHandler.OpenDialog is MKDS_Course_Modifier.UI.BNCL)
                {
                    ((MKDS_Course_Modifier.UI.BNCL)FileHandler.OpenDialog).SetNCER(Cell);
                }
                return(false);

            case "BMG":
                MKDS_Course_Modifier.Misc.BMG File2 = new MKDS_Course_Modifier.Misc.BMG(file.Data);
                if (FileHandler.OpenDialog != null)
                {
                    return(false);
                }
                FileHandler.OpenDialog = (Form) new MKDS_Course_Modifier.UI.BMG(File2);
                FileHandler.OpenDialog.Show((IWin32Window)Owner);
                FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                return(true);

            case "SM64BMD":
                MKDS_Course_Modifier.SM64DS.BMD bmd = new MKDS_Course_Modifier.SM64DS.BMD(file.Data);
                if (FileHandler.OpenDialog is MKDS_Course_Modifier.UI.BMD)
                {
                    ((MKDS_Course_Modifier.UI.BMD)FileHandler.OpenDialog).SetBMD(bmd);
                    return(false);
                }
                FileHandler.OpenDialog = (Form) new MKDS_Course_Modifier.UI.BMD(bmd);
                FileHandler.OpenDialog.Show((IWin32Window)Owner);
                FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                return(true);

            case "SM64BCA":
                MKDS_Course_Modifier.SM64DS.BCA Bca2 = new MKDS_Course_Modifier.SM64DS.BCA(file.Data);
                if (!(FileHandler.OpenDialog is MKDS_Course_Modifier.UI.BMD))
                {
                    return(false);
                }
                ((MKDS_Course_Modifier.UI.BMD)FileHandler.OpenDialog).SetBCA(Bca2);
                return(true);

            case "BNCL":
                MKDS_Course_Modifier.Misc.BNCL Bncl = new MKDS_Course_Modifier.Misc.BNCL(file.Data);
                if (FileHandler.OpenDialog != null)
                {
                    return(false);
                }
                FileHandler.OpenDialog = (Form) new MKDS_Course_Modifier.UI.BNCL(Bncl);
                FileHandler.OpenDialog.Show((IWin32Window)Owner);
                FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                return(true);

            case "GCNBMD":
                MKDS_Course_Modifier.GCN.BMD file3 = new MKDS_Course_Modifier.GCN.BMD(file.Data);
                if (FileHandler.OpenDialog != null)
                {
                    return(false);
                }
                FileHandler.OpenDialog = (Form) new J3D1(file3);
                FileHandler.OpenDialog.Show((IWin32Window)Owner);
                FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                return(true);

            case "HBDF":
                HBDF hbdf = new HBDF(file.Data);
                if (hbdf.MDLFBlocks.Length > 0)
                {
                    if (FileHandler.OpenDialog is MDLF)
                    {
                        ((MDLF)FileHandler.OpenDialog).SetHBDF(hbdf);
                    }
                    else
                    {
                        FileHandler.OpenDialog = (Form) new MDLF(hbdf);
                        FileHandler.OpenDialog.Show((IWin32Window)Owner);
                        FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                        return(true);
                    }
                }
                return(false);

            case "GCNBOL":
                BOL bol = new BOL(file.Data);
                return(false);

            case "PAZ":
                PAZ Arc = new PAZ(file.Data);
                Owner.OpenPAZ(Arc);
                return(true);

            case "TEX":
                TEX tex = new TEX(file.Data);
                return(false);

            case "GRPCONF":
                Grpconf grpconf = new Grpconf(file.Data);
                return(false);

            case "OBJ":
                MKDS_Course_Modifier._3D_Formats.OBJ obj = new MKDS_Course_Modifier._3D_Formats.OBJ(file.Path);
                if (FileHandler.OpenDialog != null)
                {
                    return(false);
                }
                FileHandler.OpenDialog = (Form) new MKDS_Course_Modifier.UI.OBJ(obj, obj.MLTName == null ? (MLT)null : new MLT(obj.MLTName));
                FileHandler.OpenDialog.Show((IWin32Window)Owner);
                FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                return(true);

            case "GCNBLO":
                MKDS_Course_Modifier.GCN.BLO Layout = new MKDS_Course_Modifier.GCN.BLO(file.Data, file.Path);
                if (FileHandler.OpenDialog != null)
                {
                    return(false);
                }
                FileHandler.OpenDialog = (Form) new MKDS_Course_Modifier.UI.BLO(Layout);
                FileHandler.OpenDialog.Show((IWin32Window)Owner);
                FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                return(true);

            case "3DSCGFX":
                MKDS_Course_Modifier._3DS.CGFX cgfx = new MKDS_Course_Modifier._3DS.CGFX(file.Data);
                if (FileHandler.OpenDialog != null)
                {
                    return(false);
                }
                FileHandler.OpenDialog = (Form) new MKDS_Course_Modifier.UI.CGFX(cgfx);
                FileHandler.OpenDialog.Show((IWin32Window)Owner);
                FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                return(true);

            case "FMVVideo":
                MKDS_Course_Modifier.Misc.FMV Video = new MKDS_Course_Modifier.Misc.FMV(file.Data);
                if (FileHandler.OpenDialog != null)
                {
                    return(false);
                }
                FileHandler.OpenDialog = (Form) new MKDS_Course_Modifier.UI.FMV(Video);
                FileHandler.OpenDialog.Show((IWin32Window)Owner);
                FileHandler.OpenDialog.FormClosed += new FormClosedEventHandler(FileHandler.OpenDialog_FormClosed);
                return(true);

            default:
                return(false);
            }
        }