public void LoadTilesets(ushort TilesetID, int JyotyuPalOverride) { Tilesets = new NSMBTileset[3]; Console.WriteLine("JyotyuPalOverride = {0}, JyotyuPal offset = {1}...", JyotyuPalOverride, ROM.Overlay0[ROM.GetOffset(ROM.Data.Table_Jyotyu_NCL) + JyotyuPalOverride]); byte JyotyuPalID = ROM.Overlay0[ROM.GetOffset(ROM.Data.Table_Jyotyu_NCL) + JyotyuPalOverride]; File JyotyuPalFile = null; if (JyotyuPalID == 1) { JyotyuPalFile = ROM.FS.getFileByName("d_2d_A_J_jyotyu_B_ncl.bin"); } else if (JyotyuPalID == 2) { JyotyuPalFile = ROM.FS.getFileByName("d_2d_A_J_jyotyu_R_ncl.bin"); } else if (JyotyuPalID == 3) { JyotyuPalFile = ROM.FS.getFileByName("d_2d_A_J_jyotyu_W_ncl.bin"); } else { JyotyuPalFile = ROM.FS.getFileByName("d_2d_A_J_jyotyu_ncl.bin"); } Tilesets[0] = new NSMBTileset( ROM.FS.getFileByName("d_2d_A_J_jyotyu_ncg.bin"), JyotyuPalFile, ROM.FS.getFileByName("d_2d_PA_A_J_jyotyu.bin"), ROM.FS.getFileByName("A_J_jyotyu.bin"), ROM.FS.getFileByName("A_J_jyotyu_hd.bin"), null, true, 0); LoadTileset1(TilesetID); Tilesets[2] = new NSMBTileset( ROM.FS.getFileByName("d_2d_I_S_tikei_nohara_ncg.bin"), ROM.FS.getFileByName("d_2d_I_S_tikei_nohara_ncl.bin"), ROM.FS.getFileByName("d_2d_PA_I_S_nohara.bin"), ROM.FS.getFileByName("I_S_nohara.bin"), ROM.FS.getFileByName("I_S_nohara_hd.bin"), ROM.FS.getFileByName("NoHaRaSubUnitChangeData.bin"), false, 2); // Patch in a bunch of overrides to the normal tileset // Now works directly on the map16 data Tilesets[0].UseOverrides = true; Tilesets[0].Overrides[1] = 136; Tilesets[0].Overrides[2] = 137; Tilesets[0].Overrides[3] = 138; Tilesets[0].Overrides[4] = 139; Tilesets[0].Overrides[5] = 140; Tilesets[0].Overrides[6] = 141; Tilesets[0].Overrides[7] = 142; Tilesets[0].Overrides[8] = 143; Tilesets[0].Overrides[36] = 135; Tilesets[0].Overrides[112] = 26; Tilesets[0].Overrides[113] = 27; Tilesets[0].Overrides[114] = 53; Tilesets[0].Overrides[115] = 55; Tilesets[0].Overrides[116] = 28; Tilesets[0].Overrides[117] = 57; Tilesets[0].Overrides[118] = 144; Tilesets[0].Overrides[119] = 1; Tilesets[0].Overrides[120] = 4; Tilesets[0].Overrides[121] = 5; Tilesets[0].Overrides[122] = 30; Tilesets[0].Overrides[123] = 31; Tilesets[0].Overrides[124] = 8; Tilesets[0].Overrides[125] = 9; Tilesets[0].Overrides[126] = 20; Tilesets[0].Overrides[127] = 21; Tilesets[0].Overrides[128] = 24; Tilesets[0].Overrides[129] = 25; Tilesets[0].Overrides[132] = 29; Tilesets[0].Overrides[130] = 54; Tilesets[0].Overrides[131] = 56; Tilesets[0].Overrides[133] = 58; Tilesets[0].Overrides[134] = 2; Tilesets[0].Overrides[135] = 3; Tilesets[0].Overrides[136] = 6; Tilesets[0].Overrides[137] = 7; Tilesets[0].Overrides[138] = 12; Tilesets[0].Overrides[139] = 13; Tilesets[0].Overrides[140] = 10; Tilesets[0].Overrides[141] = 11; Tilesets[0].Overrides[142] = 22; Tilesets[0].Overrides[143] = 23; Tilesets[0].Overrides[145] = 32; Tilesets[0].Overrides[146] = 19; Tilesets[0].Overrides[147] = 17; Tilesets[0].Overrides[148] = 18; Tilesets[0].Overrides[149] = 14; Tilesets[0].Overrides[150] = 22; Tilesets[0].Overrides[151] = 23; Tilesets[0].Overrides[152] = 71; Tilesets[0].Overrides[153] = 72; Tilesets[0].Overrides[154] = 15; Tilesets[0].Overrides[155] = 16; Tilesets[0].Overrides[156] = 20; Tilesets[0].Overrides[157] = 21; Tilesets[0].Overrides[158] = 28; Tilesets[0].Overrides[159] = 29; Tilesets[0].Overrides[160] = 71; Tilesets[0].Overrides[161] = 72; Tilesets[0].Overrides[171] = 53; Tilesets[0].Overrides[172] = 57; Tilesets[0].Overrides[173] = 55; Tilesets[0].Overrides[174] = 26; Tilesets[0].Overrides[175] = 27; Tilesets[0].Overrides[187] = 54; Tilesets[0].Overrides[188] = 58; Tilesets[0].Overrides[189] = 56; Tilesets[0].Overrides[190] = 24; Tilesets[0].Overrides[191] = 25; Tilesets[0].Overrides[192] = 59; Tilesets[0].Overrides[193] = 63; Tilesets[0].Overrides[194] = 61; Tilesets[0].Overrides[195] = 65; Tilesets[0].Overrides[196] = 69; Tilesets[0].Overrides[197] = 67; Tilesets[0].Overrides[198] = 33; Tilesets[0].Overrides[199] = 34; Tilesets[0].Overrides[200] = 41; Tilesets[0].Overrides[201] = 42; Tilesets[0].Overrides[202] = 37; Tilesets[0].Overrides[203] = 38; Tilesets[0].Overrides[204] = 47; Tilesets[0].Overrides[205] = 48; Tilesets[0].Overrides[206] = 51; Tilesets[0].Overrides[207] = 52; Tilesets[0].Overrides[208] = 60; Tilesets[0].Overrides[209] = 64; Tilesets[0].Overrides[210] = 62; Tilesets[0].Overrides[211] = 66; Tilesets[0].Overrides[212] = 70; Tilesets[0].Overrides[213] = 68; Tilesets[0].Overrides[214] = 35; Tilesets[0].Overrides[215] = 36; Tilesets[0].Overrides[216] = 43; Tilesets[0].Overrides[217] = 44; Tilesets[0].Overrides[218] = 39; Tilesets[0].Overrides[219] = 40; Tilesets[0].Overrides[220] = 49; Tilesets[0].Overrides[221] = 50; Tilesets[0].Overrides[222] = 45; Tilesets[0].Overrides[223] = 46; Tilesets[0].Overrides[228] = 41; Tilesets[0].Overrides[229] = 42; Tilesets[0].Overrides[230] = 45; Tilesets[0].Overrides[231] = 65; Tilesets[0].Overrides[232] = 69; Tilesets[0].Overrides[233] = 67; Tilesets[0].Overrides[234] = 47; Tilesets[0].Overrides[235] = 48; Tilesets[0].Overrides[236] = 52; Tilesets[0].Overrides[237] = 59; Tilesets[0].Overrides[238] = 63; Tilesets[0].Overrides[239] = 61; Tilesets[0].Overrides[244] = 43; Tilesets[0].Overrides[245] = 44; Tilesets[0].Overrides[246] = 46; Tilesets[0].Overrides[247] = 66; Tilesets[0].Overrides[248] = 70; Tilesets[0].Overrides[249] = 68; Tilesets[0].Overrides[250] = 49; Tilesets[0].Overrides[251] = 50; Tilesets[0].Overrides[252] = 51; Tilesets[0].Overrides[253] = 60; Tilesets[0].Overrides[254] = 64; Tilesets[0].Overrides[255] = 62; // Tilesets[0].repaintAllMap16(); RepatchBlocks(Properties.Settings.Default.SmallBlockOverlays); // Enable notes for the normal tileset Tilesets[0].UseNotes = true; if (ROM.UserInfo.descriptions.ContainsKey(65535)) { Tilesets[0].ObjNotes = ROM.UserInfo.descriptions[65535].ToArray(); } else { Tilesets[0].ObjNotes = GetDescriptions(LanguageManager.GetList("ObjNotes")); } if (ROM.UserInfo.descriptions.ContainsKey(TilesetID)) { Tilesets[1].ObjNotes = ROM.UserInfo.descriptions[TilesetID].ToArray();; Tilesets[1].UseNotes = true; } if (ROM.UserInfo.descriptions.ContainsKey(65534)) { Tilesets[2].ObjNotes = ROM.UserInfo.descriptions[65534].ToArray(); Tilesets[2].UseNotes = true; } }
private void importPNGButton_Click(object sender, EventArgs e) { getFiles(); if (GFXFile == null) { return; } if (PalFile == null) { return; } if (LayoutFile == null) { return; } // Create a local copy because the global variables could be overwritten while the background is importing File myGFXFile = GFXFile; File myPalFile = PalFile; File myLayoutFile = LayoutFile; int offs = bg.topLayer ? 256 : 576; int palOffs = bg.topLayer ? 8 : 10; if (bg.mappedTileset) { offs = 192; palOffs = 2; } OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = LanguageManager.Get("Filters", "png"); ofd.CheckFileExists = true; if (ofd.ShowDialog() != DialogResult.OK) { return; } string filename = ofd.FileName; Bitmap b = new Bitmap(filename); if (b.Size != new Size(512, 512)) { throw new Exception("Wrong image size"); } BgPNGImportPrompt bgPrompt = new BgPNGImportPrompt(bg.topLayer, bg.mappedTileset); if (!bgPrompt.finished) { return; } ImageTiler ti; if (bg.topLayer) { bgPrompt.bgFirstTileOffset = 0; ti = new ImageTiler(b, new Size(256, bgPrompt.fgHeightInPixels), new Size(512, 512), 50); } else { ti = new ImageTiler(b, new Size(256, bgPrompt.bgHeightInPixels), new Size(512, 512), 50); } Color[] palette = ImageIndexer.createPaletteForImage(b); ByteArrayOutputStream oo = new ByteArrayOutputStream(); for (int i = 0; i < palette.Length; i++) { oo.writeUShort(NSMBTileset.toRGB15(palette[i])); } ByteArrayOutputStream offsetBitmapData = new ByteArrayOutputStream(); for (int i = 0; i < 256 * bgPrompt.bgFirstTileOffset; i++) { offsetBitmapData.writeByte(0); } //byte[] newBitmapData = ImageIndexer.indexImageWithPalette(ti.tileBuffer, palette); byte[] newBitmapData = new byte[offsetBitmapData.getArray().Length + ImageIndexer.indexImageWithPalette(ti.tileBuffer, palette).Length]; Buffer.BlockCopy(offsetBitmapData.getArray(), 0, newBitmapData, 0, offsetBitmapData.getArray().Length); Buffer.BlockCopy(ImageIndexer.indexImageWithPalette(ti.tileBuffer, palette), 0, newBitmapData, offsetBitmapData.getArray().Length, ImageIndexer.indexImageWithPalette(ti.tileBuffer, palette).Length); myPalFile.beginEdit(this); myPalFile.replace(ROM.LZ77_Compress(oo.getArray()), this); myPalFile.endEdit(this); myGFXFile.beginEdit(this); myGFXFile.replace(ROM.LZ77_Compress(newBitmapData), this); myGFXFile.endEdit(this); b.Dispose(); ByteArrayOutputStream layout = new ByteArrayOutputStream(); for (int y = 0; y < ti.heightTileCount; y++) { for (int x = 0; x < ti.widthTileCount; x++) { layout.writeUShort((ushort)((ti.tileMap[x, y] + offs + (bgPrompt.bgFirstTileOffset * 4)) | (palOffs << 12))); } } myLayoutFile.beginEdit(this); myLayoutFile.replace(ROM.LZ77_Compress(layout.getArray()), this); myLayoutFile.endEdit(this); }
private void Xdelta_import_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("All of the ROM contents will be replaced with the XDelta patch, unlike the NSMBe patches, this one overwrites the ROM entirely!\n\nNSMBe is going to restart after the import has finished.\n\nDo you still want to contiue?", LanguageManager.Get("General", "Warning"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.No) { return; } MessageBox.Show(LanguageManager.Get("Patch", "XSelectROM"), LanguageManager.Get("Patch", "XImport"), MessageBoxButtons.OK, MessageBoxIcon.Information); OpenFileDialog cleanROM_openFileDialog = new OpenFileDialog(); cleanROM_openFileDialog.Title = "Please select a clean NSMB ROM file"; cleanROM_openFileDialog.Filter = "Nintendo DS ROM (*.nds)|*.nds|All files (*.*)|*.*"; if (cleanROM_openFileDialog.ShowDialog() != DialogResult.OK) { return; } OpenFileDialog xdelta_openFileDialog = new OpenFileDialog(); xdelta_openFileDialog.Title = "Please select the XDelta patch to import"; xdelta_openFileDialog.Filter = "XDelta Patch (*.xdelta)|*.xdelta|All files (*.*)|*.*"; if (xdelta_openFileDialog.ShowDialog() != DialogResult.OK) { return; } try { ROM.close(); string str = " -d -f -s \"" + cleanROM_openFileDialog.FileName + "\" \"" + xdelta_openFileDialog.FileName + "\" \"" + Properties.Settings.Default.ROMPath + "\""; Process process = new Process(); process.StartInfo.UseShellExecute = false; process.StartInfo.FileName = "xdelta3.exe"; process.StartInfo.Arguments = str; process.StartInfo.CreateNoWindow = true; process.StartInfo.RedirectStandardError = true; process.Start(); string end = process.StandardError.ReadToEnd(); if (end == "") { MessageBox.Show("ROM patched successfully, restarting NSMBe..."); } else { MessageBox.Show(end + "\n\nRestarting NSMBe!", "Something went wrong!", MessageBoxButtons.OK, MessageBoxIcon.Error); } process.WaitForExit(); //Restart NSMBe Process process2 = new Process(); process2.StartInfo.FileName = Application.ExecutablePath; process2.StartInfo.Arguments = "\"" + Properties.Settings.Default.ROMPath + "\""; process2.Start(); Application.Exit(); } catch (Exception ex) { MessageBox.Show("An unexpected exception has occured, restarting!\nDetails:\n" + ex, LanguageManager.Get("SpriteData", "ErrorTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error); //Restart NSMBe Process process2 = new Process(); process2.StartInfo.FileName = Application.ExecutablePath; process2.StartInfo.Arguments = "\"" + Properties.Settings.Default.ROMPath + "\""; process2.Start(); Application.Exit(); } }
private void Xdelta_export_Click(object sender, EventArgs e) { MessageBox.Show(LanguageManager.Get("Patch", "XSelectROM") + LanguageManager.Get("Patch", "XRestartAfterApplied"), LanguageManager.Get("Patch", "XExport"), MessageBoxButtons.OK, MessageBoxIcon.Information); OpenFileDialog cleanROM_openFileDialog = new OpenFileDialog(); cleanROM_openFileDialog.Title = "Please select a clean NSMB ROM file"; cleanROM_openFileDialog.Filter = "Nintendo DS ROM (*.nds)|*.nds|All files (*.*)|*.*"; if (cleanROM_openFileDialog.ShowDialog() != DialogResult.OK) { return; } SaveFileDialog xdelta_saveFileDialog = new SaveFileDialog(); xdelta_saveFileDialog.Title = "Please select where to save the XDelta patch"; xdelta_saveFileDialog.Filter = "XDelta Patch (*.xdelta)|*.xdelta|All files (*.*)|*.*"; if (xdelta_saveFileDialog.ShowDialog() != DialogResult.OK) { return; } try { ROM.close(); string str = " -f -s \"" + cleanROM_openFileDialog.FileName + "\" \"" + Properties.Settings.Default.ROMPath + "\" \"" + xdelta_saveFileDialog.FileName + "\""; Process process = new Process(); process.StartInfo.UseShellExecute = false; process.StartInfo.FileName = "xdelta3.exe"; process.StartInfo.Arguments = str; process.StartInfo.CreateNoWindow = true; process.StartInfo.RedirectStandardError = true; process.Start(); string end = process.StandardError.ReadToEnd(); if (end == "") { MessageBox.Show("Patch created successfully!", "Success!"); } else { MessageBox.Show(end, "Something went wrong!", MessageBoxButtons.OK, MessageBoxIcon.Error); } process.WaitForExit(); } catch (Exception ex) { MessageBox.Show("An unexpected exception has occured!\nDetails:\n" + ex, LanguageManager.Get("SpriteData", "ErrorTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { //Restart NSMBe Process process2 = new Process(); process2.StartInfo.FileName = Application.ExecutablePath; process2.StartInfo.Arguments = "\"" + Properties.Settings.Default.ROMPath + "\""; process2.Start(); Application.Exit(); } }
private void mpPatch2_Click(object sender, EventArgs e) { NSMBLevel lvl = new NSMBLevel(new InternalLevelSource("J01_1", "")); NarcReplace("Dat_Field.narc", "I_M_nohara.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT)); NarcReplace("Dat_Field.narc", "I_M_nohara_hd.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT_HD)); NarcReplace("Dat_Field.narc", "d_2d_PA_I_M_nohara.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_PNL)); NarcReplace("Dat_Field.narc", "NoHaRaMainUnitChangeData.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_CHK)); NarcReplace("Dat_Field.narc", "d_2d_I_M_tikei_nohara_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCG)); NarcReplace("Dat_Field.narc", "d_2d_I_M_tikei_nohara_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCL)); NarcReplace("Dat_Field.narc", "d_2d_I_M_back_nohara_VS_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NSC)); NarcReplace("Dat_Field.narc", "d_2d_I_M_back_nohara_VS_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCG)); NarcReplace("Dat_Field.narc", "d_2d_I_M_back_nohara_VS_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCL)); NarcReplace("Dat_Field.narc", "d_2d_I_M_free_nohara_VS_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NSC)); NarcReplace("Dat_Field.narc", "d_2d_I_M_free_nohara_VS_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCG)); NarcReplace("Dat_Field.narc", "d_2d_I_M_free_nohara_VS_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCL)); lvl = new NSMBLevel(new InternalLevelSource("J02_1", "")); NarcReplace("Dat_Basement.narc", "I_M_chika3.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT)); NarcReplace("Dat_Basement.narc", "I_M_chika3_hd.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT_HD)); NarcReplace("Dat_Basement.narc", "d_2d_PA_I_M_chika3.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_PNL)); NarcReplace("Dat_Basement.narc", "ChiKa3MainUnitChangeData.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_CHK)); NarcReplace("Dat_Basement.narc", "d_2d_I_M_tikei_chika3_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCG)); NarcReplace("Dat_Basement.narc", "d_2d_I_M_tikei_chika3_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCL)); NarcReplace("Dat_Basement.narc", "d_2d_I_M_back_chika3_R_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NSC)); NarcReplace("Dat_Basement.narc", "d_2d_I_M_back_chika3_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCG)); NarcReplace("Dat_Basement.narc", "d_2d_I_M_back_chika3_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCL)); lvl = new NSMBLevel(new InternalLevelSource("J03_1", "")); NarcReplace("Dat_Ice.narc", "I_M_setsugen2.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT)); NarcReplace("Dat_Ice.narc", "I_M_setsugen2_hd.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT_HD)); NarcReplace("Dat_Ice.narc", "d_2d_PA_I_M_setsugen2.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_PNL)); NarcReplace("Dat_Ice.narc", "SeTsuGen2MainUnitChangeData.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_CHK)); NarcReplace("Dat_Ice.narc", "d_2d_I_M_tikei_setsugen2_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCG)); NarcReplace("Dat_Ice.narc", "d_2d_I_M_tikei_setsugen2_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCL)); NarcReplace("Dat_Ice.narc", "d_2d_I_M_back_setsugen2_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NSC)); NarcReplace("Dat_Ice.narc", "d_2d_I_M_back_setsugen2_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCG)); NarcReplace("Dat_Ice.narc", "d_2d_I_M_back_setsugen2_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCL)); NarcReplace("Dat_Ice.narc", "d_2d_I_M_free_setsugen2_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NSC)); NarcReplace("Dat_Ice.narc", "d_2d_I_M_free_setsugen2_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCG)); NarcReplace("Dat_Ice.narc", "d_2d_I_M_free_setsugen2_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCL)); lvl = new NSMBLevel(new InternalLevelSource("J04_1", "")); NarcReplace("Dat_Pipe.narc", "W_M_dokansoto.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT)); NarcReplace("Dat_Pipe.narc", "W_M_dokansoto_hd.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT_HD)); NarcReplace("Dat_Pipe.narc", "d_2d_PA_W_M_dokansoto.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_PNL)); NarcReplace("Dat_Pipe.narc", "DoKaNSoToMainUnitChangeData.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_CHK)); NarcReplace("Dat_Pipe.narc", "d_2d_W_M_tikei_dokansoto_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCG)); NarcReplace("Dat_Pipe.narc", "d_2d_W_M_tikei_dokansoto_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCL)); NarcReplace("Dat_Pipe.narc", "d_2d_W_M_back_dokansoto_R_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NSC)); NarcReplace("Dat_Pipe.narc", "d_2d_W_M_back_dokansoto_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCG)); NarcReplace("Dat_Pipe.narc", "d_2d_W_M_back_dokansoto_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCL)); NarcReplace("Dat_Pipe.narc", "d_2d_W_M_free_dokansoto_R_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NSC)); NarcReplace("Dat_Pipe.narc", "d_2d_W_M_free_dokansoto_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCG)); NarcReplace("Dat_Pipe.narc", "d_2d_W_M_free_dokansoto_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCL)); lvl = new NSMBLevel(new InternalLevelSource("J05_1", "")); NarcReplace("Dat_Fort.narc", "I_M_yakata.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT)); NarcReplace("Dat_Fort.narc", "I_M_yakata_hd.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT_HD)); NarcReplace("Dat_Fort.narc", "d_2d_PA_I_M_yakata.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_PNL)); NarcReplace("Dat_Fort.narc", "YaKaTaMainUnitChangeData.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_CHK)); NarcReplace("Dat_Fort.narc", "d_2d_I_M_tikei_yakata_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCG)); NarcReplace("Dat_Fort.narc", "d_2d_I_M_tikei_yakata_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCL)); NarcReplace("Dat_Fort.narc", "d_2d_I_M_back_yakata_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NSC)); NarcReplace("Dat_Fort.narc", "d_2d_I_M_back_yakata_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCG)); NarcReplace("Dat_Fort.narc", "d_2d_I_M_back_yakata_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCL)); NarcReplace("Dat_Fort.narc", "d_2d_I_M_free_yakata_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NSC)); NarcReplace("Dat_Fort.narc", "d_2d_I_M_free_yakata_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCG)); NarcReplace("Dat_Fort.narc", "d_2d_I_M_free_yakata_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCL)); MessageBox.Show(LanguageManager.Get("General", "Completed")); }
public static void Load() { if (!ROM.isNSMBRom) { return; } //Delete existing datas.Clear(); datas2.Clear(); spriteNames.Clear(); categoryIds.Clear(); categories.Clear(); spritesInCategory.Clear(); datas = new Dictionary <int, SpriteData>(); datas2 = new Dictionary <int, SpriteData>(); if (!File.Exists(path)) { if (MessageBox.Show(LanguageManager.Get("SpriteData", "Prompt"), LanguageManager.Get("SpriteData", "PromptTitle"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Update(); } else { return; } } try { FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read); XmlReader xmlr = XmlReader.Create(fs); xmlr.ReadToFollowing("category"); do { int id = int.Parse(xmlr.GetAttribute("id")); categoryIds.Add(id); categories.Add(xmlr.ReadElementContentAsString()); spritesInCategory.Add(id, new List <int>()); } while (xmlr.ReadToNextSibling("category")); while (xmlr.ReadToFollowing("sprite")) { SpriteData d = readFromStream(xmlr); //Check for user spritedata FileStream fs_user = new FileStream(Path.Combine(directory, "user_spritedata.xml"), FileMode.Open, FileAccess.Read, FileShare.Read); XmlReader xmlr_user = XmlReader.Create(fs_user); while (xmlr_user.ReadToFollowing("sprite")) { if (int.Parse(xmlr_user.GetAttribute("id")) == d.spriteID) { d = readFromStream(xmlr_user); } } xmlr_user.Close(); fs_user.Close(); spriteNames.Add(d.name); spritesInCategory[d.categoryID].Add(d.spriteID); if (d != null) { datas2.Add(d.spriteID, d); } } for (int i = 0; i < datas2.Count; i++) { int ActorID = ROM.GetClassIDFromTable(i); datas.Add(i, datas2[ActorID]); } datas2.Clear(); xmlr.Close(); fs.Close(); } catch (Exception e) { new ErrorMSGBox(LanguageManager.Get("SpriteData", "ErrorTitle"), LanguageManager.Get("SpriteData", "ErrorParse"), "", e.ToString()).ShowDialog(); datas.Clear(); datas2.Clear(); } }