private static bool TryGetBuild(string enumStr, out ORom.Build build) { if (!Enum.TryParse(enumStr, true, out build)) { return(false); } if (!ORom.IsBuildNintendo(build)) { return(false); } return(true); }
public static void SetRomLocation(ORom.Build version, string location) { XElement romLocation; var x = from a in romLocDoc.Elements("values").Elements("string") where a.Attribute("v").Value == version.ToString() select a; romLocation = x.SingleOrDefault(); if (romLocation == null) { throw new NotImplementedException(); } romLocation.Value = location; romLocDoc.Save("RomLocations.xml"); }
public static bool TryGetRomLocation(ORom.Build version, ref string location) { XElement romLocation; var x = from a in romLocDoc.Elements("values").Elements("string") where a.Attribute("v").Value == version.ToString() select a; romLocation = x.SingleOrDefault(); if (romLocation == null) { return(false); } location = romLocation.Value; return(File.Exists(location)); }
public static void Export(string file, ORom.Build build) { OFileTable rom = new OFileTable(file, build); Scene spirit; ExportModifiedScene(rom, out spirit, "06_h"); RoomListCommand roomCommand = (RoomListCommand)spirit.Header[HeaderCommands.RoomList]; for (int i = 0; i < 29; i++) { BinaryReader br; Room sRoom = new Room(Game.OcarinaOfTime, roomCommand.RoomAddresses[i]); Room beta = new Room(Game.OcarinaOfTime, new FileAddress()); br = new BinaryReader(rom.GetFile(sRoom.VirtualAddress)); sRoom.Header.Load(br, 0); beta.Header.Load(br, SpiritHack.GetBetaRoomSetupOffset(0, i)); List <SceneCommand> cmd = beta.Header.Commands(); SceneCommand objectCmd = sRoom.Header[HeaderCommands.ObjectList]; int index = cmd.FindIndex(x => x.Code == (int)HeaderCommands.ActorList); if (index > -1) { cmd.Insert(index, objectCmd); } using (BinaryWriter bw = new BinaryWriter(new FileStream($"r/06_{i:D2}", FileMode.CreateNew))) { beta.Header.WriteHeader(bw); br.BaseStream.Position = bw.BaseStream.Position; while (br.BaseStream.Position < br.BaseStream.Length) { bw.Write(br.ReadUInt32()); } } } }
private void compressButton_Click(object sender, EventArgs e) { TaskScheduler uiTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext(); ORom.Build version = (ORom.Build)comboBox1.SelectedItem; if (//version != null && File.Exists(modifiedFile) && File.Exists(compressedFile)) { this.Text = "Compressing Rom..."; using (FileStream fw = new FileStream("Compressed_Test.z64", FileMode.Create)) { RomBuilder.CompressRom(new ORom(modifiedFile, version), new ORom(compressedFile, version), fw); } } this.Text = "Compressed!"; //wip hack //FileTable ft = new FileTable(); //ft.Initialize(modifiedFile, version); //var va = ft.GetVirtualAddress(0x02A91000); //var br = ft.GetFile(va.Start); //CRC.WriteCRC("Compressed_Test2.z64"); //FileStream fs = new FileStream("test", FileMode.Create); //this.Text = "Compressing..."; //Yaz0.EncodeAsync(br.ReadBytes((int)va.Size), (int)va.Size, fs) // .ContinueWith(t => // { // this.Text = "Complete"; // fs.Close(); // }, // uiTaskScheduler); }
private RomVersion(ORom.Build build) { Game = Game.OcarinaOfTime; OVer = build; MVer = MRom.Build.UNKNOWN; }
public MesgBuildsPair(List <int> data, ORom.Build build) { Data = data; Builds.Add(build); }
public static void Import(string file, ORom.Build build) { Gen.SceneImporter.ImportToUncompressedRom(file, build, "r", new List <int>(new int[] { 81, 6 })); CRC.Write(file); }