Ejemplo n.º 1
0
 public Options(string dImport, string dExport, SupportedGames dGame, string dWwise, string dProject)
 {
     defaultImport      = dImport;
     defaultExport      = dExport;
     defaultGame        = dGame;
     wwisePath          = dWwise;
     defaultProjectPath = dProject;
 }
Ejemplo n.º 2
0
        private void ChangeMode(object sender, RoutedEventArgs e)
        {
            //should only be called by MenuItems
            MenuItem item = (MenuItem)sender;

            mode = (SupportedGames)Convert.ToInt32(item.Tag);
            ChangeView();
            NullAllWindows();
        }
Ejemplo n.º 3
0
 public BNKEditor(SupportedGames Mode, Options options)
 {
     InitializeComponent();
     mode = Mode;
     if (options.defaultImport != null)
     {
         ImportPath = options.defaultImport;
     }
     if (options.defaultImport != null)
     {
         ExportPath = options.defaultExport;
     }
 }
Ejemplo n.º 4
0
        //imported constructor
        public NBNKFile(BinaryReader br, SupportedGames mode)
        {
            holding = new List <byte[]>();
            while (br.BaseStream.Position < br.BaseStream.Length)
            {
                byte[] magicArr = br.ReadBytes(4);
                string magic    = Encoding.UTF8.GetString(magicArr);
                switch (magic)
                {
                case "BKHD":
                    uint SLength = br.ReadUInt32();
                    BankHeader = new BKHD(SLength, br);
                    uint   bnkId = BankHeader.dwSoundbankID;
                    string path  = Directory.GetCurrentDirectory() + "/" + mode.ToString() + "/BNK/" + bnkId.ToString() + ".lbl";
                    if (File.Exists(path))
                    {
                        MessageBoxResult labelRead = MessageBox.Show("Label file found. Read labels?", "Labels", MessageBoxButton.YesNo);
                        if (labelRead == MessageBoxResult.Yes)
                        {
                            labels = new Labels(XmlReader.Create(path));
                        }
                        else
                        {
                            labels = new Labels();
                        }
                    }
                    else
                    {
                        labels = new Labels();
                    }
                    break;

                case "DIDX":
                    DataIndex = new DIDX(br, labels);
                    break;

                /*case "HIRC":
                 *  ObjectHierarchy = new HIRC(br);
                 *  break;*/
                default:
                    //this adds support to not-immediately-interpreted versions of WWise, assuming that the main 3 (BKHD, DIDX, DATA) do not change in structure
                    SLength = br.ReadUInt32();
                    byte[] tLength = BitConverter.GetBytes(SLength);
                    byte[] data    = br.ReadBytes((int)SLength);
                    byte[] section = HelperFunctions.Combine(HelperFunctions.Combine(magicArr, tLength), data);
                    holding.Add(section);
                    break;
                }
            }
            br.Close();
        }
Ejemplo n.º 5
0
 //WWEVEditor wwevEditor = null;
 //RE Engine programs
 //RSZEditor rszEditor = null;
 //WELEditor welEditor = null;
 public MainWindow()
 {
     InitializeComponent();
     if (File.Exists("Options.xml"))
     {
         options = new Options(XmlReader.Create(new FileStream("Options.xml", FileMode.Open)));
     }
     else
     {
         options = new Options();
     }
     mode = options.defaultGame;
     ChangeView();
 }
Ejemplo n.º 6
0
        private void SetOptions(object sender, RoutedEventArgs e)
        {
            OptionsWindow optionWindow = new OptionsWindow(options);

            optionWindow.ShowDialog();
            if (optionWindow.DialogResult == true)
            {
                ComboBoxItem DefaultGame = (ComboBoxItem)optionWindow.DefaultGame.SelectedItem;
                int          defaultGame = Convert.ToInt32(DefaultGame.Tag);
                options = new Options(optionWindow.DefaultImport.Text, optionWindow.DefaultExport.Text, (SupportedGames)defaultGame, optionWindow.WWiseExePath.Text, optionWindow.DefaultProjectPath.Text);
                options.WriteOptions();
                mode = options.defaultGame;
                ChangeView();
            }
        }
Ejemplo n.º 7
0
 public NPCKEditor(SupportedGames Mode, Options options)
 {
     InitializeComponent();
     mode                = Mode;
     viewModel           = new NPCKViewModel();
     WemView.DataContext = viewModel;
     if (options.defaultImport != null)
     {
         ImportPath = options.defaultImport;
     }
     if (options.defaultExport != null)
     {
         ExportPath = options.defaultExport;
     }
 }
Ejemplo n.º 8
0
        public PCKString(BinaryReader br, SupportedGames mode, long start)
        {
            uint offset = br.ReadUInt32();

            index = br.ReadUInt32();
            long retval = br.BaseStream.Position;

            br.BaseStream.Seek(start + offset, SeekOrigin.Begin);
            if (mode == SupportedGames.MHRise)
            {
                value = HelperFunctions.ReadNullTerminatedString(br);
            }
            else
            {
                value = HelperFunctions.ReadUniNullTerminatedString(br);
            }
            br.BaseStream.Seek(retval, SeekOrigin.Begin);
        }
Ejemplo n.º 9
0
 public void LoadGame()
 {
     this.OPCodeTable = BlackOps3.OPCodeTable;
     this.Game        = SupportedGames.BlackOps3;
     if (this.compilerVersion == 0xD)
     {
         this.OPCodeTable = BlackOps2.OPCodeTable;
         this.Game        = SupportedGames.BlackOps2;
     }
     else if (this.gameByte == 3)
     {
         // OPCode table is the same for IW but
         // Same opcodetable as bo2 but has some structure differences
         this.OPCodeTable = WorldWar2.OPCodeTable;
         this.Game        = SupportedGames.WorldWar2;
     }
     if (this.compilerVersion == 0xD && this.gameByte == 3)
     {
         this.OPCodeTable = WorldWar2.OPCodeTable;
         this.Game        = SupportedGames.WorldWar2;
     }
 }
Ejemplo n.º 10
0
        //imported constructor
        public NPCKHeader(BinaryReader br, SupportedGames Mode, string fileName)
        {
            mode = Mode;
            string labelPath = Directory.GetCurrentDirectory() + "/" + mode.ToString() + "/PCK/" + fileName + ".lbl";

            if (File.Exists(labelPath))
            {
                MessageBoxResult labelRead = MessageBox.Show("Label file found. Read labels?", "Labels", MessageBoxButton.YesNo);
                if (labelRead == MessageBoxResult.Yes)
                {
                    labels = new Labels(XmlReader.Create(labelPath));
                }
            }
            char[] magicBytes = br.ReadChars(4);
            uint   headerLen  = br.ReadUInt32();

            unkn2            = br.ReadUInt32();
            languageLength   = br.ReadUInt32();
            bnkTableLength   = br.ReadUInt32();
            wemTableLength   = br.ReadUInt32();
            unknStructLength = br.ReadUInt32();
            long stringHeaderStart = br.BaseStream.Position;
            uint stringCount       = br.ReadUInt32();

            for (int i = 0; i < stringCount; i++)
            {
                PCKString stringData = new PCKString(br, Mode, stringHeaderStart);
                pckStrings.Add(stringData);
            }
            br.BaseStream.Seek(stringHeaderStart + languageLength, SeekOrigin.Begin);
            for (int i = 0; i < bnkTableLength / 4; i++)
            {
                br.ReadUInt32();
            }
            //this is 4-aligned at least in RE Engine games
            uint wemACount = br.ReadUInt32();

            for (int i = 0; i < wemACount; i++)
            {
                uint id            = br.ReadUInt32();
                uint one           = br.ReadUInt32();
                uint length        = br.ReadUInt32();
                uint offset        = br.ReadUInt32();
                uint languageEnum  = br.ReadUInt32();
                int  workingOffset = (int)br.BaseStream.Position;
                br.BaseStream.Seek(offset, SeekOrigin.Begin);
                byte[] file = br.ReadBytes((int)length);
                br.BaseStream.Seek(workingOffset, SeekOrigin.Begin);
                string name;
                if (labels.wemLabels.ContainsKey(id))
                {
                    name = labels.wemLabels[id];
                }
                else
                {
                    name = "Imported Wem " + i;
                }
                Wem newWem = new Wem(name, id, file, languageEnum);
                WemList.Add(newWem);
            }
            //the unknStruct uint is right here, but we've already read what we need
        }
Ejemplo n.º 11
0
 //created constructor
 public NPCKHeader(SupportedGames Mode)
 {
     mode = Mode;
     pckStrings.Add(new PCKString(0, "sfx"));
 }
Ejemplo n.º 12
0
        public List <byte> GenerateLanguageBytes(SupportedGames mode)
        {
            List <byte> languageBytes = new List <byte>();

            byte[] count = BitConverter.GetBytes(pckStrings.Count);
            for (int i = 0; i < count.Length; i++)
            {
                languageBytes.Add(count[i]);
            }
            //get "header" size for use later
            int headerSize = 4 + (pckStrings.Count * 8);
            //now generate string table and offsets
            List <byte> stringTable = new List <byte>();

            int[]         offsets = new int[pckStrings.Count];
            List <string> strings = new List <string>();

            for (int i = 0; i < pckStrings.Count; i++)
            {
                strings.Add(pckStrings[i].value);
            }
            strings.Sort();//alphabetically
            for (int i = 0; i < strings.Count; i++)
            {
                byte[] asBytes;
                if (mode == SupportedGames.MHRise)
                {
                    asBytes = Encoding.UTF8.GetBytes(strings[i]);
                }
                else
                {
                    asBytes = Encoding.Unicode.GetBytes(strings[i]);
                }

                for (int j = 0; j < pckStrings.Count; j++)
                {
                    if (pckStrings[j].value == strings[i])
                    {
                        offsets[j] = Math.Max(0, headerSize + stringTable.Count);
                        for (int k = 0; k < asBytes.Length; k++)
                        {
                            stringTable.Add(asBytes[k]);
                        }
                        if (mode == SupportedGames.MHRise)
                        {
                            stringTable.Add(0);
                        }
                        else
                        {
                            stringTable.Add(0);
                            stringTable.Add(0);
                        }
                    }
                }
            }
            //finally add pckString data to languageBytes
            for (int i = 0; i < pckStrings.Count; i++)
            {
                byte[] offset = BitConverter.GetBytes(offsets[i]);
                for (int j = 0; j < offset.Length; j++)
                {
                    languageBytes.Add(offset[j]);
                }
                byte[] index = BitConverter.GetBytes(pckStrings[i].index);
                for (int j = 0; j < index.Length; j++)
                {
                    languageBytes.Add(index[j]);
                }
            }
            //concat string table
            for (int i = 0; i < stringTable.Count; i++)
            {
                languageBytes.Add(stringTable[i]);
            }
            //align 4
            while (languageBytes.Count % 4 != 0)
            {
                languageBytes.Add(0);
            }

            return(languageBytes);
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Checks compatibility with specified game ID.
 /// </summary>
 /// <param name="GameID">Game ID.</param>
 public bool CheckCompatibility(string GameID)
 {
     // Check if GameID exists in list...
     return(SupportedGames.Contains(GameID));
 }
Ejemplo n.º 14
0
            // You shouldn't ever need to sight a player.  Only the main Metabans plugin should ever need to do this.
            public MetabansAPI mb_sight_player(SupportedGames game_name, string player_uid, string player_name, string group_name, string player_ip, string alternate_uid) {
                var hash = new Hashtable();
                hash.Add("action", "mb_sight_player");
                hash.Add("game_name", game_name.ToString());
                hash.Add("player_uid", player_uid);
                hash.Add("player_name", player_name);
                hash.Add("group_name", group_name);

                if (player_ip != null) {
                    hash.Add("player_ip", player_ip.Split(':')[0]);
                }

                hash.Add("alternate_uid", alternate_uid);

                m_requests.Add(hash);

                return this;
            }
Ejemplo n.º 15
0
            public MetabansAPI mb_assess_player(SupportedGames game_name, string player_uid, AssessmentTypes assessment_type, string reason, int assessment_length) {
                var hash = new Hashtable();
                hash.Add("action", "mb_assess_player");
                hash.Add("game_name", game_name.ToString());
                hash.Add("player_uid", player_uid);
                hash.Add("assessment_type", assessment_type.ToString());
                hash.Add("reason", reason);
                hash.Add("assessment_length", assessment_length.ToString());

                m_requests.Add(hash);

                return this;
            }
Ejemplo n.º 16
0
 public void LoadGame()
 {
     this.OPCodeTable = Fable3OPCodes.OPCodeTable;
     this.Game        = SupportedGames.Fable3;
 }