Exemplo n.º 1
0
        public void WriteBackTheSameFile() => Common.FileOpenRead("kh2/res/00objentry.bin", stream =>
        {
            Helpers.AssertStream(stream, inStream =>
            {
                var outStream = new MemoryStream();
                Objentry.Write(outStream, Objentry.Read(inStream));

                return(outStream);
            });
        });
Exemplo n.º 2
0
        public Kernel(IDataContent dataContent)
        {
            _dataContent = dataContent;

            FontContext     = new FontContext();
            MessageProvider = new Kh2MessageProvider();
            RegionId        = DetectRegion(dataContent);
            IsReMix         = DetectReMix(dataContent, Region);

            // Load files in the same order as KH2 does
            ObjEntries = LoadFile("00objentry.bin", stream => Objentry.Read(stream));
            // 00progress
            LoadSystem("03system.bin");
            LoadBattle("00battle.bin");
            // 00common
            // 00worldpoint
            // 07localset
            // 12soundinfo
            // 14mission

            LoadFontImage($"msg/{Language}/fontimage.bar");
            LoadFontInfo($"msg/{Language}/fontinfo.bar");
            Places = LoadFile($"msg/{Language}/place.bin", stream => Place.Read(stream));
            LoadMessage("sys");
            // 15jigsaw

            if (Language == "jp")
            {
                SystemMessageContext = FontContext.ToKh2JpSystemTextContext();
                EventMessageContext  = FontContext.ToKh2JpEventTextContext();
            }
            else
            {
                SystemMessageContext = FontContext.ToKh2EuSystemTextContext();
                EventMessageContext  = FontContext.ToKh2EuEventTextContext();
            }
        }
Exemplo n.º 3
0
 public void GroupByUnknown02() => File.OpenRead("kh2/res/00objentry.bin").Using(stream =>
 {
     var table   = Objentry.Read(stream);
     var grouped = table.GroupBy(x => x.SpawnObject4).ToList();
     Assert.Equal(0x076C, table.Count);
 });
Exemplo n.º 4
0
 public void HasRightEntryCount() => File.OpenRead("kh2/res/00objentry.bin").Using(stream =>
 {
     var table = Objentry.Read(stream);
     Assert.Equal(0x076C, table.Count);
 });