コード例 #1
0
ファイル: MLT.cs プロジェクト: Shadowth117/sa_tools
            public MLTEntry(byte[] file, int offset, string filename = "")
            {
                Type            = ((MLTEntryType)BitConverter.ToUInt32(file, offset));
                BankID          = file[offset + 4];
                LoadAddress     = BitConverter.ToInt32(file, offset + 0x08);
                AllocatedMemory = BitConverter.ToInt32(file, offset + 0x0C);
                Name            = (filename == "" ? "BANK" : filename + "_BANK") + BankID.ToString("D2") + GetMLTItemExtension(file, offset);
                int pointer = BitConverter.ToInt32(file, offset + 0x10);
                int size    = BitConverter.ToInt32(file, offset + 0x14);

                if (pointer != -1)
                {
                    Data = new byte[size];
                    Array.Copy(file, pointer, Data, 0, size);
                }

                /*
                 * Console.Write("Entry {0} Bank {1}, Address {2}, Allocated Memory {3}", Type.ToString(), BankID.ToString(), LoadAddress.ToString("X"), AllocatedMemory.ToString(""));
                 * if (Data != null)
                 *  Console.Write(", Bank Data Size {0}", Data.Length.ToString());
                 * else
                 *  Console.Write(", No Bank Data");
                 * Console.Write(System.Environment.NewLine);
                 */
            }
コード例 #2
0
ファイル: MLT.cs プロジェクト: Shadowth117/sa_tools
 public MLTEntry(string filename, int bankID, int loadAddr, int allocMem)
 {
     Type            = GetMLTEntryTypeFromFilename(filename);
     BankID          = bankID;
     LoadAddress     = loadAddr;
     AllocatedMemory = allocMem;
     if (File.Exists(filename))
     {
         Data = File.ReadAllBytes(filename);
     }
 }