예제 #1
0
        private static void RegionParse_cmd22(ROM rom, List <Region> regions, RegionParseState state)
        {
            if (state.regionState != RegionState.ModelsLoader)
            {
                CutRegion(rom, regions, state, rom.offset, RegionState.ModelsLoader);
            }

            int segmentedAddress = rom.Read32(4);
            int segment          = rom.Read8(4);
            int model            = rom.Read8(3);

            // Only 0x19 or 0x0E commands are supported
            if (segment != 0x19 && segment != 0x0E)
            {
                return;
            }

            try
            {
                List <Region> modelRegions = new List <Region>();

                int geoLayoutROMAddress = rom.GetROMAddress(segmentedAddress);
                GeoLayout.PerformRegionParse(rom, modelRegions, geoLayoutROMAddress);

                foreach (Region region in modelRegions)
                {
                    region.model = model;
                }

                regions.AddRange(modelRegions);
            }
            catch (NotSupportedException e)
            {
                MessageBox.Show(String.Format("Model {0} graphics parsing is not supported! Reason : '{1}'", state.area, e.Message), "Level Parser", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception e)
            {
                MessageBox.Show(String.Format("Failed to parse model {0} graphics! Reason : '{1}'", state.area, e.Message), "Level Parser", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private static void RegionParse_cmd1F(ROM rom, List <Region> regions, RegionParseState state)
        {
            CutRegion(rom, regions, state, rom.offset, RegionState.AreaHeader);

            int   segmentedAddress = rom.Read32(4);
            int   segment          = rom.Read8(4);
            sbyte area             = (sbyte)rom.Read8(2);

            state.area        = area;
            state.regionState = RegionState.AreaHeader;

            // Only 0x19 or 0x0E commands are supported
            // Usually it is in segment 19 anyways
            if (segment != 0x19 && segment != 0x0E)
            {
                return;
            }

            int           geoLayoutROMAddress  = rom.GetROMAddress(segmentedAddress);
            List <Region> areaGeolayoutRegions = new List <Region>();

            try
            {
                GeoLayout.PerformRegionParse(rom, areaGeolayoutRegions, geoLayoutROMAddress);
                foreach (Region region in areaGeolayoutRegions)
                {
                    region.area = area;
                }

                regions.AddRange(areaGeolayoutRegions);
            }
            catch (NotSupportedException e)
            {
                MessageBox.Show(String.Format("Area {0} graphics parsing is not supported! Reason : '{1}'", state.area, e.Message), "Level Parser", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception e)
            {
                MessageBox.Show(String.Format("Failed to parse area {0} graphics! Reason : '{1}'", state.area, e.Message), "Level Parser", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }