void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "SM64 ROMs (.z64)|*.z64"; if (ofd.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } Editor.projectSettings = new ProjectSettings(ofd.FileName); EmulationState.instance.LoadROM(ofd.FileName); EmulationState.instance.LoadBank(0x2, 0x108A40, 0x114750, true); EmulationState.instance.LoadBank(0x15, 0x2ABCA0, 0x2AC6B0, false); EmulationState.instance.banks[0x15].ptrsROM.AddRange(new int[] { 0x2A6228, 0x26A114, 0x26A138 }); globalTextures = new TextureManager(EmulationState.instance, Level.renderDevice); GeoLayout.textureManager = globalTextures; LevelScriptReader.ReadFrom(0x2ABCA0, 0x2ABE58); int[] levelAddresses = LevelScriptReader.GetCommands(0x2AC094, 0x2AC2FC, 0x00); toolBox.SetLevelAddresses(levelAddresses); if (levelAddresses.Length > 0) { LoadLevel(levelAddresses[0]); } }
public static Level LoadLevelROM(int ROMstart) { current = new Level(); GeoLayout.textureManager = current.textureManager; LevelScriptReader.ReadFrom(ROMstart); Level output = current; current = null; return(output); }
public void ReadJump(byte[] jumpCommand) { recordingLevelGeos = false; int jumpAddress = cvt.int32(jumpCommand, 4); levelGeoJumps.Add(jumpAddress); current = this; LevelScriptReader.ReadFromSegmented(jumpAddress); current = null; recordingLevelGeos = true; }
public void CleanLevelGeos() { Dictionary <byte, int> newGeo = new Dictionary <byte, int>(levelGeos); levelGeos.Clear(); current = this; foreach (int jumpAddress in levelGeoJumps) { LevelScriptReader.ReadFromSegmented(jumpAddress); } current = null; foreach (var jumpGeoLayout in levelGeos) { newGeo.Remove(jumpGeoLayout.Key); } levelGeos.Clear(); foreach (var layout in newGeo) { try { GeoLayout.LoadSegmented(layout.Value); levelGeos[layout.Key] = layout.Value; } catch { //Geo layout could not be loaded, thus should not be added to the levels geo layout list. } } levelGeos = newGeo; foreach (Area area in areas) { foreach (Object obj in area) { byte id = obj.model_ID; obj.SetModelID(0); obj.SetModelID(id); } } }