Exemple #1
0
        public KCL ConvertModelToKCL(NitroFile modelFile, string fileName, float scale, float faceSizeThreshold,
                                     Dictionary <string, int> matColTypes, bool save = true)
        {
            KCL importedModel = null;

            string modelFormat = fileName.Substring(fileName.Length - 3, 3).ToLower();

            switch (modelFormat)
            {
            case "obj":
                importedModel = ConvertOBJToKCL(modelFile, fileName, scale, faceSizeThreshold, matColTypes, save);
                break;

            case "dae":
                importedModel = ConvertDAEToKCL(modelFile, fileName, scale, faceSizeThreshold, matColTypes, save);
                break;

            case "imd":
                importedModel = ConvertIMDToKCL(modelFile, fileName, scale, faceSizeThreshold, matColTypes, save);
                break;

            default:
                importedModel = ConvertOBJToKCL(modelFile, fileName, scale, faceSizeThreshold, matColTypes, save);
                break;
            }

            return(importedModel);
        }
        private void LoadCollision(KCL kcl)
        {
            MuuntCollisionObject col = new MuuntCollisionObject();

            col.CollisionFile = kcl;
            col.Renderer      = new KCLRendering2D(kcl);
            CollisionObjects.Add(col);
        }
        public static void ExportKCLModel(KCL model, string fileName)
        {
            AbstractModelLoader kclLoader = new KCLLoader(fileName, model);

            ModelBase loadedModel = kclLoader.LoadModel();

            ExportModel(loadedModel, fileName);
        }
Exemple #4
0
        private void LoadCollision(KCL kcl)
        {
            MuuntCollisionObject col = new MuuntCollisionObject();

            col.CollisionFile = kcl;
            col.Renderer      = new KCLRendering2D(kcl);
            Viewport3D?.AddDrawable(kcl.DrawableContainer.Drawables[0]);
            CollisionObjects.Add(col);
        }
Exemple #5
0
        public static KCL ConvertOBJToKCL(NitroFile modelFile, string fileName, float scale, float faceSizeThreshold,
                                          Dictionary <string, int> matColTypes, bool save = true)
        {
            KCL importedModel = new KCL(modelFile);

            ModelBase loadedModel = new OBJLoader(fileName).LoadModel();

            importedModel = CallKCLWriter(modelFile, loadedModel, scale, faceSizeThreshold, matColTypes, save);

            return(importedModel);
        }
Exemple #6
0
        public KCL ConvertOBJToKCL(NitroFile modelFile, string fileName, float scale, float faceSizeThreshold,
            Dictionary<string, int> matColTypes, bool save = true)
        {
            KCL importedModel = new KCL(modelFile);

            if (m_LoadedModel == null)
                m_LoadedModel = new OBJLoader(fileName).LoadModel();

            importedModel = CallKCLWriter(modelFile, m_LoadedModel, fileName, scale, faceSizeThreshold, matColTypes, save);

            return importedModel;
        }
Exemple #7
0
        public void AddRenderableKcl(string FilePath)
        {
            if (!System.IO.File.Exists(FilePath))
            {
                return;
            }

            KCL kcl = (KCL)Switch_Toolbox.Library.IO.STFileLoader.OpenFileFormat(FilePath);

            if (kcl != null)
            {
                KclObjects.Add(kcl);
            }
        }
Exemple #8
0
        public KCL ConvertDAEToKCL(NitroFile modelFile, string fileName, float scale, float faceSizeThreshold,
                                   Dictionary <string, int> matColTypes, bool save = true)
        {
            KCL importedModel = new KCL(modelFile);

            if (m_LoadedModel == null)
            {
                m_LoadedModel = new DAELoader(fileName).LoadModel();
            }

            importedModel = CallKCLWriter(modelFile, m_LoadedModel, fileName, scale, faceSizeThreshold, matColTypes, save);

            return(importedModel);
        }
Exemple #9
0
        public static void AddFunctionless(string parentIdent, string ident, ILifetimeObject owner)
        {
            var upperIdent = ident.ToUpper();

            if (listeners.ContainsKey(upperIdent))
            {
                listeners.Remove(upperIdent);
            }

            var result = new DebugListener(parentIdent, ident, owner, KCL.C(SKeys.X), DebugListener.DebugListenerType.Functionless);

            result.Set(true);
            listeners.Add(upperIdent, result);
        }
 private void toolStripButton1_Click(object sender, EventArgs e)
 {
     if (this.openFileDialog1.ShowDialog() != DialogResult.OK || this.openFileDialog1.FileName.Length <= 0)
     {
         return;
     }
     try
     {
         this.k = new KCL(System.IO.File.ReadAllBytes(this.openFileDialog1.FileName));
     }
     catch
     {
     }
 }
 public void FileClosed(ViewableFile File)
 {
     if (File.FileFormat is MKDS.KCL && File.FileFormat == KCL)
     {
         KCL = null;
     }
     ViewableFile[] v = EveryFileExplorerUtil.GetOpenFilesOfType(typeof(MKDS.KCL));
     menuItem1.MenuItems.Clear();
     foreach (var vv in v)
     {
         menuItem1.MenuItems.Add(vv.File.Name);
     }
     if (v.Length != 0)
     {
         menuItem1.MenuItems[0].Checked = true;
         KCL = v[0].FileFormat;
     }
     Render();
     Render();
 }
        public void FileOpened(ViewableFile File)
        {
            ViewableFile[] v = EveryFileExplorerUtil.GetOpenFilesOfType(typeof(MKDS.KCL));
            menuItem1.MenuItems.Clear();
            bool curavab = false;

            foreach (var vv in v)
            {
                var m = menuItem1.MenuItems.Add(vv.File.Name);
                if (vv.FileFormat == KCL)
                {
                    curavab   = true;
                    m.Checked = true;
                }
            }
            if (!curavab && v.Length != 0)
            {
                menuItem1.MenuItems[0].Checked = true;
                KCL = v[0].FileFormat;
            }
            Render();
            Render();
        }
        private void ExportPrepareTrack(int index)
        {
            var name = MKDS.InternalTrackNames[index];

            MainCARC = new CARCEditor(name + ".carc");
            var texture_carc = new CARCEditor(name + "Tex.carc");

            var track_model = new Model(TrackModelInfo, MainCARC, texture_carc);

            if (track_model.Export())
            {
                MainModelCombo.Items.Add("Track");
                MainModelCombo.SelectedIndex = 0;
                MainModels.Add(track_model);
                LoadModelIntoView(track_model);
            }
            else
            {
                Utils.ShowMessage("Unable to load track model.");
            }

            var skybox_model = new Model(SkyboxModelInfo, MainCARC, texture_carc);

            if (skybox_model.Export())
            {
                MainModelCombo.Items.Add("Track skybox");
                MainModelCombo.SelectedIndex = 0;
                MainModels.Add(skybox_model);
                LoadModelIntoView(skybox_model);
            }
            else
            {
                Utils.ShowMessage("Unable to load track skybox model.");
            }

            var nkm_data = MainCARC.ReadFile("course_map.nkm");

            TrackNKM = new NKMD(nkm_data);

            var kcl_data = MainCARC.ReadFile("course_collision.kcl");

            TrackKCL = new KCL(kcl_data);

            var dummy_kart_model_info = new ModelInfo {
                ModelFile = "kart_MR_a.nsbmd", TextureFile = "kart_MR_a.nsbtx"
            };
            var dummy_kart_model = new Model(dummy_kart_model_info, null, null);

            if (dummy_kart_model.Export())
            {
                ModelCombo.Items.Add("Start position");
                ModelCombo.SelectedIndex = 0;
                ItemModels.Add(dummy_kart_model);
                LoadModelIntoView(dummy_kart_model);

                var ktps = TrackNKM.KartPointStart.Entries[0];
                ItemModelTranslates.Add(new Vector3D(ktps.Position.X / 16, ktps.Position.Y / 16, ktps.Position.Z / 16));
                UpdateModelTranslate(0, ktps.Position.X / 16, ktps.Position.Y / 16, ktps.Position.Z / 16, true);
                UpdateModelRotation(0, ktps.Rotation.X, ktps.Rotation.Y, ktps.Rotation.Z);
            }
            else
            {
                Utils.ShowMessage("Unable to load demo kart model.");
            }
        }
        private void NKMDViewer_Load(object sender, EventArgs e)
        {
            Gl.glEnable(Gl.GL_COLOR_MATERIAL);
            Gl.glEnable(Gl.GL_DEPTH_TEST);
            Gl.glDepthFunc(Gl.GL_ALWAYS);
            Gl.glEnable(Gl.GL_LOGIC_OP);
            Gl.glDisable(Gl.GL_CULL_FACE);
            Gl.glEnable(Gl.GL_TEXTURE_2D);
            Gl.glEnable(Gl.GL_LINE_SMOOTH);
            Gl.glEnable(Gl.GL_BLEND);

            Gl.glBlendFunc(Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA);

            ViewableFile[] v = EveryFileExplorerUtil.GetOpenFilesOfType(typeof(KCL));
            menuItem1.MenuItems.Clear();
            foreach (var vv in v)
            {
                menuItem1.MenuItems.Add(vv.File.Name);
            }
            if (v.Length != 0)
            {
                menuItem1.MenuItems[0].Checked = true;
                KCL = v[0].FileFormat;
            }

            if (NKMD.ObjectInformation != null)
            {
                AddTab <MKDS.NKM.OBJI.OBJIEntry>("OBJI", NKMD.ObjectInformation);
            }
            if (NKMD.Path != null)
            {
                AddTab <PATH.PATHEntry>("PATH", NKMD.Path);
            }
            if (NKMD.Point != null)
            {
                AddTab <POIT.POITEntry>("POIT", NKMD.Point);
            }
            if (NKMD.KartPointStart != null)
            {
                AddTab <KTPS.KTPSEntry>("KTPS", NKMD.KartPointStart);
            }
            if (NKMD.KartPointJugem != null)
            {
                AddTab <KTPJ.KTPJEntry>("KTPJ", NKMD.KartPointJugem);
            }
            if (NKMD.KartPointSecond != null)
            {
                AddTab <KTP2.KTP2Entry>("KTP2", NKMD.KartPointSecond);
            }
            if (NKMD.KartPointCannon != null)
            {
                AddTab <KTPC.KTPCEntry>("KTPC", NKMD.KartPointCannon);
            }
            if (NKMD.KartPointMission != null)
            {
                AddTab <KTPM.KTPMEntry>("KTPM", NKMD.KartPointMission);
            }
            if (NKMD.CheckPoint != null)
            {
                AddTab <CPOI.CPOIEntry>("CPOI", NKMD.CheckPoint);
            }
            if (NKMD.CheckPointPath != null)
            {
                AddTab <CPAT.CPATEntry>("CPAT", NKMD.CheckPointPath);
            }
            if (NKMD.ItemPoint != null)
            {
                AddTab <IPOI.IPOIEntry>("IPOI", NKMD.ItemPoint);
            }
            if (NKMD.ItemPath != null)
            {
                AddTab <IPAT.IPATEntry>("IPAT", NKMD.ItemPath);
            }
            if (NKMD.EnemyPoint != null)
            {
                AddTab <EPOI.EPOIEntry>("EPOI", NKMD.EnemyPoint);
            }
            if (NKMD.EnemyPath != null)
            {
                AddTab <EPAT.EPATEntry>("EPAT", NKMD.EnemyPath);
            }
            if (NKMD.MiniGameEnemyPoint != null)
            {
                AddTab <MEPO.MEPOEntry>("MEPO", NKMD.MiniGameEnemyPoint);
            }
            if (NKMD.MiniGameEnemyPath != null)
            {
                AddTab <MEPA.MEPAEntry>("MEPA", NKMD.MiniGameEnemyPath);
            }
            if (NKMD.Area != null)
            {
                AddTab <AREA.AREAEntry>("AREA", NKMD.Area);
            }
            if (NKMD.Camera != null)
            {
                AddTab <CAME.CAMEEntry>("CAME", NKMD.Camera);
            }

            Bitmap b3 = OBJI.OBJ_2D01;

            System.Resources.ResourceSet s = OBJI.ResourceManager.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture, false, false);
            foreach (Object b in s)
            {
                Bitmap     b2 = ((Bitmap)((System.Collections.DictionaryEntry)b).Value);
                BitmapData bd = b2.LockBits(new Rectangle(0, 0, b2.Width, b2.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
                Gl.glTexEnvf(Gl.GL_TEXTURE_ENV, Gl.GL_TEXTURE_ENV_MODE, Gl.GL_MODULATE);
                if ((String)((System.Collections.DictionaryEntry)b).Key != "start")
                {
                    Gl.glBindTexture(Gl.GL_TEXTURE_2D, BitConverter.ToUInt16(BitConverter.GetBytes(ushort.Parse(((String)((System.Collections.DictionaryEntry)b).Key).Split('_')[1], System.Globalization.NumberStyles.HexNumber)).Reverse().ToArray(), 0));
                }
                else
                {
                    Gl.glBindTexture(Gl.GL_TEXTURE_2D, -1);
                }
                Gl.glTexImage2D(Gl.GL_TEXTURE_2D, 0, Gl.GL_RGBA8, b2.Width, b2.Height, 0, Gl.GL_BGRA, Gl.GL_UNSIGNED_BYTE, bd.Scan0);
                b2.UnlockBits(bd);
                Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_WRAP_S, Gl.GL_CLAMP);
                Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_WRAP_T, Gl.GL_CLAMP);
                Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_NEAREST);
                Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_NEAREST);
            }
            init = true;
            Render();
            Render();
        }
Exemple #15
0
        public void AddRenderableKcl(string FilePath)
        {
            KCL kcl = (KCL)Switch_Toolbox.Library.IO.STFileLoader.OpenFileFormat(FilePath);

            KclObjects.Add(kcl);
        }
Exemple #16
0
        static void MakeKCLandPA(string input, bool zero)
        {
            try
            {
                Console.WriteLine("Creating KCL...");
                KCL           k         = new KCL();
                List <String> Materials = k.CreateFromFile(File.ReadAllBytes(input));
                Console.WriteLine("\r\nWriting KCL...");
                File.WriteAllBytes(input + ".kcl", k.Write());
                Console.WriteLine("Creating PA...");
                Pa_format pa = new Pa_format(true);
                for (int i = 0; i < Materials.Count; i++)
                {
                    if (zero)
                    {
                        pa.entries.Add(0);
                    }
                    else
                    {
                        Console.WriteLine("-Data for material : " + Materials[i]);
                        Console.Write(" |Enter value for Sound_code [0]: ");
                        string tmp = Console.ReadLine();
                        uint   SoundCode;
                        if (tmp.Trim() == "")
                        {
                            SoundCode = 0;
                        }
                        else
                        {
                            SoundCode = uint.Parse(tmp);
                        }
                        Console.Write(" |Enter value for Floor_code [0]: ");
                        tmp = Console.ReadLine();
                        uint FloorCode;
                        if (tmp.Trim() == "")
                        {
                            FloorCode = 0;
                        }
                        else
                        {
                            FloorCode = uint.Parse(tmp);
                        }
                        Console.Write(" |Enter value for Wall_code [0]: ");
                        tmp = Console.ReadLine();
                        uint WallCode;
                        if (tmp.Trim() == "")
                        {
                            WallCode = 0;
                        }
                        else
                        {
                            WallCode = uint.Parse(tmp);
                        }
                        uint Unknown        = 0;
                        uint CameraThrought = 0;
                        SoundCode      = SoundCode << pa.Fields[0].Shift;
                        FloorCode      = FloorCode << pa.Fields[1].Shift;
                        Unknown        = Unknown << pa.Fields[2].Shift;
                        WallCode       = WallCode << pa.Fields[3].Shift;
                        CameraThrought = CameraThrought << pa.Fields[4].Shift;

                        SoundCode      &= pa.Fields[0].Bitmask;
                        FloorCode      &= pa.Fields[1].Bitmask;
                        Unknown        &= pa.Fields[2].Bitmask;
                        WallCode       &= pa.Fields[3].Bitmask;
                        CameraThrought &= pa.Fields[4].Bitmask;

                        pa.entries.Add(SoundCode + FloorCode + Unknown + WallCode + CameraThrought);
                        Console.WriteLine("");
                    }
                }
                Console.WriteLine("Writing PA...");
                File.WriteAllBytes(input + ".pa", pa.MakeFile());
                Console.WriteLine("DONE !");
                Console.ReadLine();
                Console.ForegroundColor = ConsoleColor.White;
            }
            catch (Exception ex)
            {
                Console.WriteLine("There was an error: ");
                Console.WriteLine(ex.ToString());
                Console.WriteLine("");
                Console.ReadLine();
                Console.ForegroundColor = ConsoleColor.White;
            }
        }
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            Gl.glMatrixMode(5889);
            Gl.glLoadIdentity();
            Gl.glViewport(0, 0, this.simpleOpenGlControl1.Width, this.simpleOpenGlControl1.Height);
            float   num1 = float.MaxValue;
            float   num2 = float.MaxValue;
            float   num3 = float.MinValue;
            float   num4 = float.MinValue;
            Vector3 PositionA;
            Vector3 PositionB;
            Vector3 PositionC;

            for (int PlaneIdx = 0; PlaneIdx < this.k.Planes.Length; ++PlaneIdx)
            {
                if (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 0 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 1 || (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 3 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 7) || (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 8 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 18) || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 19)
                {
                    KCL.GetTriangle(this.k, PlaneIdx, out PositionA, out PositionB, out PositionC);
                    if ((double)PositionA.X < (double)num1 && (double)PositionA.X > (double)short.MinValue)
                    {
                        num1 = PositionA.X;
                    }
                    if ((double)PositionA.X > (double)num3 && (double)PositionA.X < (double)short.MaxValue)
                    {
                        num3 = PositionA.X;
                    }
                    if ((double)PositionB.X < (double)num1 && (double)PositionB.X > (double)short.MinValue)
                    {
                        num1 = PositionB.X;
                    }
                    if ((double)PositionB.X > (double)num3 && (double)PositionB.X < (double)short.MaxValue)
                    {
                        num3 = PositionB.X;
                    }
                    if ((double)PositionC.X < (double)num1 && (double)PositionC.X > (double)short.MinValue)
                    {
                        num1 = PositionC.X;
                    }
                    if ((double)PositionC.X > (double)num3 && (double)PositionC.X < (double)short.MaxValue)
                    {
                        num3 = PositionC.X;
                    }
                    if ((double)PositionA.Z < (double)num2 && (double)PositionA.Z > (double)short.MinValue)
                    {
                        num2 = PositionA.Z;
                    }
                    if ((double)PositionA.Z > (double)num4 && (double)PositionA.Z < (double)short.MaxValue)
                    {
                        num4 = PositionA.Z;
                    }
                    if ((double)PositionB.Z < (double)num2 && (double)PositionB.Z > (double)short.MinValue)
                    {
                        num2 = PositionB.Z;
                    }
                    if ((double)PositionB.Z > (double)num4 && (double)PositionB.Z < (double)short.MaxValue)
                    {
                        num4 = PositionB.Z;
                    }
                    if ((double)PositionC.Z < (double)num2 && (double)PositionC.Z > (double)short.MinValue)
                    {
                        num2 = PositionC.Z;
                    }
                    if ((double)PositionC.Z > (double)num4 && (double)PositionC.Z < (double)short.MaxValue)
                    {
                        num4 = PositionC.Z;
                    }
                }
            }
            float num5   = (float)(int)num1;
            float num6   = (float)(int)num2;
            float num7   = (float)(int)num3;
            float num8   = (float)(int)num4;
            float val1_1 = num5 - 512f;
            float val2_1 = num6 - 512f;
            float val1_2 = num7 + 512f;
            float val2_2 = num8 + 512f;

            this.textBox1.Text = ((int)((double)Math.Min(val1_1, val2_1) * 1.33333337306976)).ToString();
            this.textBox3.Text = ((int)((double)Math.Max(val1_2, val2_2) * 1.33333337306976)).ToString();
            TextBox textBox2 = this.textBox2;
            float   num9     = Math.Min(val1_1, val2_1);
            string  str1     = num9.ToString();

            textBox2.Text = str1;
            TextBox textBox4 = this.textBox4;

            num9 = Math.Max(val1_2, val2_2);
            string str2 = num9.ToString();

            textBox4.Text = str2;
            Gl.glOrtho((double)Math.Min(val1_1, val2_1) * 1.33333337306976, (double)Math.Max(val1_2, val2_2) * 1.33333337306976, (double)Math.Max(val1_2, val2_2), (double)Math.Min(val1_1, val2_1), -8192.0, 8192.0);
            Gl.glMatrixMode(5888);
            Gl.glLoadIdentity();
            Gl.glClearColor(0.0f, 0.0627451f, 0.3764706f, 1f);
            Gl.glClear(16640);
            Gl.glColor4f(1f, 1f, 1f, 1f);
            Gl.glEnable(3553);
            Gl.glBindTexture(3553, 0);
            Gl.glColor4f(1f, 1f, 1f, 1f);
            Gl.glDisable(2884);
            Gl.glEnable(3008);
            Gl.glEnable(3042);
            Gl.glBlendFunc(770, 771);
            Gl.glAlphaFunc(519, 0.0f);
            Gl.glDepthFunc(515);
            Gl.glPolygonMode(1032, 6913);
            Gl.glLineWidth(2f);
            Gl.glColor4f(1f, 1f, 1f, 1f);
            for (int PlaneIdx = 0; PlaneIdx < this.k.Planes.Length; ++PlaneIdx)
            {
                if (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 0 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 1 || (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 3 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 7) || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 18 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 19)
                {
                    KCL.GetTriangle(this.k, PlaneIdx, out PositionA, out PositionB, out PositionC);
                    Gl.glBegin(4);
                    Gl.glVertex3f(PositionA.X, PositionA.Z, PositionA.Y - 100f);
                    Gl.glVertex3f(PositionB.X, PositionB.Z, PositionB.Y - 100f);
                    Gl.glVertex3f(PositionC.X, PositionC.Z, PositionC.Y - 100f);
                    Gl.glEnd();
                }
            }
            Gl.glDisable(10754);
            Gl.glPolygonMode(1032, 6914);
            Gl.glColor3f(0.4705882f, 0.4705882f, 0.4705882f);
            for (int PlaneIdx = 0; PlaneIdx < this.k.Planes.Length; ++PlaneIdx)
            {
                if (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 0 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 1 || (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 3 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 7) || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 18 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 19)
                {
                    KCL.GetTriangle(this.k, PlaneIdx, out PositionA, out PositionB, out PositionC);
                    Gl.glBegin(4);
                    Gl.glVertex3f(PositionA.X, PositionA.Z, PositionA.Y);
                    Gl.glVertex3f(PositionB.X, PositionB.Z, PositionB.Y);
                    Gl.glVertex3f(PositionC.X, PositionC.Z, PositionC.Y);
                    Gl.glEnd();
                }
            }
            this.img = (byte[])null;
            this.map = (byte[])null;
            System.Drawing.Bitmap b = GlNitro2.ScreenShot(this.simpleOpenGlControl1);
            b.MakeTransparent(Color.FromArgb(0, 16, 96));
            Graphic.ConvertBitmap(b, this.pal, out this.img, out this.map, Graphic.GXTexFmt.GX_TEXFMT_PLTT16, true);
            b.Dispose();
            this.simpleOpenGlControl1.Refresh();
        }
Exemple #18
0
        private void NKMDViewer_Load(object sender, EventArgs e)
        {
            GL.Enable(EnableCap.ColorMaterial);
            GL.Enable(EnableCap.DepthTest);
            GL.DepthFunc(DepthFunction.Always);
            GL.Enable(EnableCap.IndexLogicOp);
            GL.Disable(EnableCap.CullFace);
            GL.Enable(EnableCap.Texture2D);
            GL.Enable(EnableCap.LineSmooth);
            GL.Enable(EnableCap.Blend);

            GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);

            ViewableFile[] v = EveryFileExplorerUtil.GetOpenFilesOfType(typeof(KCL));
            menuItem1.MenuItems.Clear();
            foreach (var vv in v)
            {
                menuItem1.MenuItems.Add(vv.File.Name);
            }
            if (v.Length != 0)
            {
                menuItem1.MenuItems[0].Checked = true;
                KCL = v[0].FileFormat;
            }

            if (MapData.KartPoint != null)
            {
                AddTab <KTPT.KTPTEntry>("KTPT", MapData.KartPoint);
            }
            if (MapData.EnemyPoint != null)
            {
                AddTab <ENPT.ENPTEntry>("ENPT", MapData.EnemyPoint);
            }
            if (MapData.EnemyPointPath != null)
            {
                AddTab <ENPH.ENPHEntry>("ENPH", MapData.EnemyPointPath);
            }
            if (MapData.ItemPoint != null)
            {
                AddTab <ITPT.ITPTEntry>("ITPT", MapData.ItemPoint);
            }
            if (MapData.ItemPointPath != null)
            {
                AddTab <ITPH.ITPHEntry>("ITPH", MapData.ItemPointPath);
            }
            if (MapData.CheckPoint != null)
            {
                AddTab <CKPT.CKPTEntry>("CKPT", MapData.CheckPoint);
            }
            if (MapData.CheckPointPath != null)
            {
                AddTab <CKPH.CKPHEntry>("CKPH", MapData.CheckPointPath);
            }
            if (MapData.GlobalObject != null)
            {
                AddTab <GOBJ.GOBJEntry>("GOBJ", MapData.GlobalObject);
            }
            if (MapData.Area != null)
            {
                AddTab <AREA.AREAEntry>("AREA", MapData.Area);
            }
            if (MapData.Camera != null)
            {
                AddTab <CAME.CAMEEntry>("CAME", MapData.Camera);
            }
            if (MapData.JugemPoint != null)
            {
                AddTab <JGPT.JGPTEntry>("JGPT", MapData.JugemPoint);
            }
            if (MapData.GliderPoint != null)
            {
                AddTab <GLPT.GLPTEntry>("GLPT", MapData.GliderPoint);
            }
            if (MapData.GliderPointPath != null)
            {
                AddTab <GLPH.GLPHEntry>("GLPH", MapData.GliderPointPath);
            }

            /*Bitmap b3 = OBJI.OBJ_2D01;
             * System.Resources.ResourceSet s = OBJI.ResourceManager.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture, false, false);
             * foreach (Object b in s)
             * {
             *      Bitmap b2 = ((Bitmap)((System.Collections.DictionaryEntry)b).Value);
             *      BitmapData bd = b2.LockBits(new Rectangle(0, 0, b2.Width, b2.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
             *      GL.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE);
             *      if ((String)((System.Collections.DictionaryEntry)b).Key != "start")
             *      {
             *              GL.glBindTexture(GL.GL_TEXTURE_2D, BitConverter.ToUInt16(BitConverter.GetBytes(ushort.Parse(((String)((System.Collections.DictionaryEntry)b).Key).Split('_')[1], System.Globalization.NumberStyles.HexNumber)).Reverse().ToArray(), 0));
             *      }
             *      else
             *      {
             *              GL.glBindTexture(GL.GL_TEXTURE_2D, -1);
             *      }
             *      GL.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA8, b2.Width, b2.Height, 0, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE, bd.Scan0);
             *      b2.UnlockBits(bd);
             *      GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP);
             *      GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP);
             *      GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
             *      GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
             * }*/
            init = true;
            Render();
            Render();
        }
Exemple #19
0
 public KCLLoader(string modelFileName, KCL kcl)
     : base(modelFileName)
 {
     m_KCL = kcl;
 }
Exemple #20
0
        static void Main(string[] args)
        {
            IntPtr consoleHandle = GetStdHandle(STD_INPUT_HANDLE);
            uint   consoleMode;

            GetConsoleMode(consoleHandle, out consoleMode);
            consoleMode &= ~ENABLE_QUICK_EDIT;
            SetConsoleMode(consoleHandle, consoleMode);

            Console.ForegroundColor = ConsoleColor.Green;
            Console.Title           = "CollisionsMng";
            Console.WriteLine("------------------------------------------------");
            Console.WriteLine("-----3D Land collision importer by exelix11-----");
            Console.WriteLine("------------------Version 1.2-------------------");
            Console.WriteLine("------------------------------------------------");
            Console.WriteLine("Thanks Gericom for Every File Explorer's KCL importer");
            Console.WriteLine("");
            try
            {
                if (args.Length == 0 || args.Length > 3)
                {
                    WriteUsage(); Console.ForegroundColor = ConsoleColor.White; return;
                }
                string FileName = args[0];
                if (args.Length == 1)
                {
                    if (Path.GetExtension(FileName).ToLower() == ".obj")
                    {
                        MakeKCLandPA(FileName, false);
                        Console.ForegroundColor = ConsoleColor.White;
                        return;
                    }
                    else if (Path.GetExtension(FileName).ToLower() == ".kcl")
                    {
                        KCL k = new KCL(File.ReadAllBytes(FileName));
                        k.convert(0, FileName + ".obj");
                        Console.WriteLine("DONE !");
                        Console.ForegroundColor = ConsoleColor.White;
                        return;
                    }
                    else if (Path.GetExtension(FileName).ToLower() == ".pa")
                    {
                        Console.WriteLine(Pa_format.LoadFile(File.ReadAllBytes(FileName)).ToString());
                        Console.ReadLine();
                        Console.ForegroundColor = ConsoleColor.White;
                        return;
                    }
                    else
                    {
                        Console.WriteLine("extension " + Path.GetExtension(FileName).ToLower() + " not supported");
                        WriteUsage();
                        Console.ForegroundColor = ConsoleColor.White;
                        return;
                    }
                }
                else if (args[1].ToLower() == "zero")
                {
                    MakeKCLandPA(FileName, true);
                    Console.ForegroundColor = ConsoleColor.White;
                    return;
                }
                else if (args[1].ToLower() == "unknown")
                {
                    Console.WriteLine(Pa_format.LoadFile(File.ReadAllBytes(FileName)).ToString(true));
                    Console.ReadLine();
                    Console.ForegroundColor = ConsoleColor.White;
                    return;
                }
                else
                {
                    WriteUsage(); Console.ForegroundColor = ConsoleColor.White; return;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("There was an error: ");
                Console.WriteLine(ex.ToString());
                Console.WriteLine("");
                Console.ReadLine();
                Console.ForegroundColor = ConsoleColor.White;
            }
        }
Exemple #21
0
 public KCLLoader(string modelFileName, KCL kcl) :
     base(modelFileName)
 {
     m_KCL = kcl;
 }
        private void NKMDViewer_Load(object sender, EventArgs e)
        {
            ViewableFile[] v = EveryFileExplorerUtil.GetOpenFilesOfType(typeof(KCL));
            menuItem1.MenuItems.Clear();
            foreach (var vv in v)
            {
                menuItem1.MenuItems.Add(vv.File.Name);
            }
            if (v.Length != 0)
            {
                menuItem1.MenuItems[0].Checked = true;
                KCL = v[0].FileFormat;
            }

            if (NKMD.ObjectInformation != null)
            {
                AddTab <MKDS.NKM.OBJI.OBJIEntry>("OBJI", NKMD.ObjectInformation);
            }
            if (NKMD.Path != null)
            {
                AddTab <PATH.PATHEntry>("PATH", NKMD.Path);
            }
            if (NKMD.Point != null)
            {
                AddTab <POIT.POITEntry>("POIT", NKMD.Point);
            }
            if (NKMD.Path != null && NKMD.Point != null)
            {
                TabPage p  = new TabPage("Routes");
                var     vv = new MKDSRouteViewer(NKMD.Path, NKMD.Point)
                {
                    Dock = DockStyle.Fill
                };
                vv.OnSelected += new SelectedEventHandler(GameDataSectionViewer_OnSelected);
                SectionViewers.Add(vv);
                p.Controls.Add(vv);
                tabControl1.TabPages.Add(p);
            }
            if (NKMD.KartPointStart != null)
            {
                AddTab <KTPS.KTPSEntry>("KTPS", NKMD.KartPointStart);
            }
            if (NKMD.KartPointJugem != null)
            {
                AddTab <KTPJ.KTPJEntry>("KTPJ", NKMD.KartPointJugem);
            }
            if (NKMD.KartPointSecond != null)
            {
                AddTab <KTP2.KTP2Entry>("KTP2", NKMD.KartPointSecond);
            }
            if (NKMD.KartPointCannon != null)
            {
                AddTab <KTPC.KTPCEntry>("KTPC", NKMD.KartPointCannon);
            }
            if (NKMD.KartPointMission != null)
            {
                AddTab <KTPM.KTPMEntry>("KTPM", NKMD.KartPointMission);
            }
            if (NKMD.CheckPoint != null)
            {
                AddTab <CPOI.CPOIEntry>("CPOI", NKMD.CheckPoint);
            }
            if (NKMD.CheckPointPath != null)
            {
                AddTab <CPAT.CPATEntry>("CPAT", NKMD.CheckPointPath);
            }
            if (NKMD.ItemPoint != null)
            {
                AddTab <IPOI.IPOIEntry>("IPOI", NKMD.ItemPoint);
            }
            if (NKMD.ItemPath != null)
            {
                AddTab <IPAT.IPATEntry>("IPAT", NKMD.ItemPath);
            }
            if (NKMD.EnemyPoint != null)
            {
                AddTab <EPOI.EPOIEntry>("EPOI", NKMD.EnemyPoint);
            }
            if (NKMD.EnemyPath != null)
            {
                AddTab <EPAT.EPATEntry>("EPAT", NKMD.EnemyPath);
            }
            if (NKMD.MiniGameEnemyPoint != null)
            {
                AddTab <MEPO.MEPOEntry>("MEPO", NKMD.MiniGameEnemyPoint);
            }
            if (NKMD.MiniGameEnemyPath != null)
            {
                AddTab <MEPA.MEPAEntry>("MEPA", NKMD.MiniGameEnemyPath);
            }
            if (NKMD.Area != null)
            {
                AddTab <AREA.AREAEntry>("AREA", NKMD.Area);
            }
            if (NKMD.Camera != null)
            {
                AddTab <CAME.CAMEEntry>("CAME", NKMD.Camera);
            }

            if (NKMD.Area != null)
            {
                mapViewer1.Groups.Add(new MKDSAreaRenderGroup(NKMD.Area, Color.FromArgb(64, Color.CornflowerBlue)));
            }

            if (NKMD.Point != null && NKMD.Path != null)
            {
                mapViewer1.Groups.Add(new MKDSRouteLineRenderGroup(NKMD.Path, NKMD.Point, Color.FromArgb(0, 0, 128)));
            }
            if (NKMD.Point != null)
            {
                mapViewer1.Groups.Add(new PointRenderGroup <POIT.POITEntry>(Color.FromArgb(0, 0, 128), NKMD.Point, typeof(POIT.POITEntry).GetProperty("Position")));
            }
            if (NKMD.CheckPoint != null && NKMD.CheckPointPath != null)
            {
                mapViewer1.Groups.Add(new MKDSCheckPointLineRenderGroup(NKMD.CheckPoint, NKMD.CheckPointPath, Color.FromArgb(0, 170, 0), Color.FromArgb(170, 0, 0)));
            }
            if (NKMD.CheckPoint != null)
            {
                mapViewer1.Groups.Add(new MKDSCheckPointPoint1RenderGroup(NKMD.CheckPoint, Color.FromArgb(0, 170, 0)));
            }
            if (NKMD.CheckPoint != null)
            {
                mapViewer1.Groups.Add(new MKDSCheckPointPoint2RenderGroup(NKMD.CheckPoint, Color.FromArgb(170, 0, 0)));
            }
            if (NKMD.ItemPoint != null && NKMD.ItemPath != null)
            {
                mapViewer1.Groups.Add(new MKDSItemPointLineRenderGroup(NKMD.ItemPoint, NKMD.ItemPath, Color.FromArgb(/*255, 230*/ 204, 153, 0)));
            }
            if (NKMD.ItemPoint != null)
            {
                mapViewer1.Groups.Add(new PointRenderGroup <IPOI.IPOIEntry>(Color.FromArgb(/*255, 230*/ 204, 153, 0), NKMD.ItemPoint, typeof(IPOI.IPOIEntry).GetProperty("Position")));
            }
            if (NKMD.EnemyPoint != null && NKMD.EnemyPath != null)
            {
                mapViewer1.Groups.Add(new MKDSEnemyPointLineRenderGroup(NKMD.EnemyPoint, NKMD.EnemyPath, Color.FromArgb(0, 204, 0)));
            }
            if (NKMD.EnemyPoint != null)
            {
                mapViewer1.Groups.Add(new PointRenderGroup <EPOI.EPOIEntry>(Color.FromArgb(0, 204, 0), NKMD.EnemyPoint, typeof(EPOI.EPOIEntry).GetProperty("Position")));
            }
            if (NKMD.MiniGameEnemyPoint != null && NKMD.MiniGameEnemyPath != null)
            {
                mapViewer1.Groups.Add(new MKDSMiniGameEnemyPointLineRenderGroup(NKMD.MiniGameEnemyPoint, NKMD.MiniGameEnemyPath, Color.FromArgb(0, 204, 0)));
            }
            if (NKMD.MiniGameEnemyPoint != null)
            {
                mapViewer1.Groups.Add(new PointRenderGroup <MEPO.MEPOEntry>(Color.FromArgb(0, 204, 0), NKMD.MiniGameEnemyPoint, typeof(MEPO.MEPOEntry).GetProperty("Position")));
            }

            if (NKMD.ObjectInformation != null)
            {
                mapViewer1.Groups.Add(new MKDSObjectRenderGroup(NKMD.ObjectInformation, Color.Red));
            }
            if (NKMD.KartPointStart != null)
            {
                mapViewer1.Groups.Add(new PointRenderGroup <KTPS.KTPSEntry>(Color.Black, NKMD.KartPointStart, typeof(KTPS.KTPSEntry).GetProperty("Position")));
            }
            if (NKMD.KartPointJugem != null)
            {
                mapViewer1.Groups.Add(new PointRenderGroup <KTPJ.KTPJEntry>(Color.Orange, NKMD.KartPointJugem, typeof(KTPJ.KTPJEntry).GetProperty("Position")));
            }
            if (NKMD.KartPointSecond != null)
            {
                mapViewer1.Groups.Add(new PointRenderGroup <KTP2.KTP2Entry>(Color.FromArgb(0, 230, 255), NKMD.KartPointSecond, typeof(KTP2.KTP2Entry).GetProperty("Position")));
            }
            if (NKMD.KartPointCannon != null)
            {
                mapViewer1.Groups.Add(new PointRenderGroup <KTPC.KTPCEntry>(Color.FromArgb(255, 0, 128), NKMD.KartPointCannon, typeof(KTPC.KTPCEntry).GetProperty("Position")));
            }
            if (NKMD.KartPointMission != null)
            {
                mapViewer1.Groups.Add(new PointRenderGroup <KTPM.KTPMEntry>(Color.MediumPurple, NKMD.KartPointMission, typeof(KTPM.KTPMEntry).GetProperty("Position")));
            }
            if (NKMD.Area != null)
            {
                mapViewer1.Groups.Add(new PointRenderGroup <AREA.AREAEntry>(Color.CornflowerBlue, NKMD.Area, typeof(AREA.AREAEntry).GetProperty("Position")));
            }
            if (NKMD.Camera != null)
            {
                mapViewer1.Groups.Add(new PointRenderGroup <CAME.CAMEEntry>(Color.BurlyWood, NKMD.Camera, typeof(CAME.CAMEEntry).GetProperty("Position")));
            }
        }
Exemple #23
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);
            }
        }