示例#1
0
        void LoadBanks(string fileName)
        {
            StreamReader reader = new StreamReader(fileName);

            try
            {
                while (!reader.EndOfStream)
                {
                    string line = reader.ReadLine();
                    line = line.Trim();
                    BankDescription newBank = BankDescription.Parse(line);
                    if (newBank != null)
                    {
                        banks.Add(newBank);
                    }
                }
            }
            catch (Exception ex)
            {
                EmulationState.messages.AppendMessage("Failed to level name file!\nException was:\n" + ex.ToString(), "Error");
            }
            finally
            {
                reader.Close();
            }
        }
示例#2
0
 static bool LOAD_BANK(byte[] commandBytes)
 {
     if (current != null)
     {
         current.loadedBanks.Add(BankDescription.Parse(commandBytes));
     }
     return(true);
 }
示例#3
0
        void WriteLevelData()
        {
            foreach (LevelBankDescription bank in new LevelBankDescription[] { bank0x5, bank0x6, bank0x9 })
            {
                if (bank == null)
                {
                    continue;
                }
                byte[][] cmd17;
                if (bank.commandBytes.TryGetValue("cmd17", out cmd17))
                {
                    foreach (byte[] cmd in cmd17)
                    {
                        BankDescription newDescription = BankDescription.Parse(cmd);
                        foreach (BankDescription desc in new List <BankDescription>(Editor.currentLevel.loadedBanks))
                        {
                            if (desc.ID == newDescription.ID)
                            {
                                Editor.currentLevel.loadedBanks.Remove(desc);
                            }
                        }
                        Editor.currentLevel.loadedBanks.Add(newDescription);
                        SM64RAM.EmulationState.instance.banks[newDescription.ID] = new SM64RAM.EmulationState.RAMBank(newDescription.ID, (int)newDescription.ROM_Start, (int)newDescription.ROM_End, cmd[0] != 0x17);
                    }
                }
                byte[][] cmd1A;
                if (bank.commandBytes.TryGetValue("cmd1a", out cmd1A))
                {
                    foreach (byte[] cmd in cmd1A)
                    {
                        BankDescription newDescription = BankDescription.Parse(cmd);
                        foreach (BankDescription desc in new List <BankDescription>(Editor.currentLevel.loadedBanks))
                        {
                            if (desc.ID == newDescription.ID)
                            {
                                Editor.currentLevel.loadedBanks.Remove(desc);
                            }
                        }
                        Editor.currentLevel.loadedBanks.Add(newDescription);
                        SM64RAM.EmulationState.instance.banks[newDescription.ID] = new SM64RAM.EmulationState.RAMBank(newDescription.ID, (int)newDescription.ROM_Start, (int)newDescription.ROM_End, true);
                    }
                }
                byte[][] cmd22;
                if (bank.commandBytes.TryGetValue("cmd22", out cmd22))
                {
                    foreach (byte[] cmd in cmd22)
                    {
                        Editor.currentLevel.AddLevelGeo(cmd[3], Level.modelIDs[cmd[3]] = GeoLayout.LoadSegmented(SM64RAM.cvt.int32(cmd, 4)));
                    }
                }

                byte[][] cmd06;
                if (bank.commandBytes.TryGetValue("cmd06", out cmd06))
                {
                    foreach (byte[] cmd in bank.commandBytes["cmd06"])
                    {
                        Editor.currentLevel.ReadJump(cmd);
                    }
                }
                Editor.currentLevel.CleanLevelGeos();
            }
        }