Пример #1
0
        public AreaLoader(RomData romData)
        {
            RomData = romData
                      ?? throw new ArgumentNullException(nameof(romData));

            AreaObjectLoader = new AreaObjectLoader(this);
            AreaSpriteLoader = new AreaSpriteLoader(this);
        }
Пример #2
0
        public PaletteData(RomData romData)
        {
            RomData = romData
                      ?? throw new ArgumentNullException(nameof(romData));

            RomData.AreaNumberChanged += AreaIndexChanged;

            if ((PaletteRowIndexTableAddress & 0x8000) == 0 ||
                (PaletteIndexTableAddress & 0x8000) == 0 ||
                (PaletteDataAddress & 0x8000) == 0)
            {
                throw new ArgumentException(
                          "Could not find palette data pointers in ROM data.");
            }

            LoadPalette();
        }
Пример #3
0
        public TilemapLoader(RomData romData)
        {
            RomData = romData
                      ?? throw new ArgumentNullException(nameof(romData));

            Layer2Tilemap = new int[0xD00 >> 1];

            BackgroundGenerationCommands = new Action[0x0D]
            {
                () => Layer2TilemapIndex++,
                EnableHdmaGradient,
                EnableHdmaWaving,
                UnknownCommand03,
                SetTilemapIndex,
                FillTopAreaTilemap,
                FillUndergroundRockPattern,
                FillUnderwaterTopAreaTilemap,
                FillWaterFallRockPattern,
                () => EnableLayer3 = true,
                GenerateWaterfallTiles,
                SetSpecialTilemapIndex,
                GenerateGoombaPillars,
            };
        }
Пример #4
0
 public AllStarsRomFile(string path)
 {
     Path        = path ?? throw new ArgumentNullException(nameof(path));
     Rom         = new RomIO(File.ReadAllBytes(path));
     Smb1RomData = new Smb1.RomData(Rom);
 }
Пример #5
0
        public GfxData(RomData romData)
        {
            RomData = romData
                      ?? throw new ArgumentNullException(nameof(romData));

            PixelData = new byte[0x28000];

            AreaPixelData = GfxToPixelMap(
                Rom.ReadBytes(AreaGfxAddress, AreaGfxSize, true));

            SpritePixelData = GfxToPixelMap(
                Rom.ReadBytes(SpriteGfxAddress, SpriteGfxSize, true));

            AnimatedPixelData = GfxToPixelMap(
                Rom.ReadBytes(AnimatedGfxAddress, AnimatedGfxSize, true));

            MarioGfxData = GfxToPixelMap(
                Rom.ReadBytes(MarioGfxAddress, PlayerGfxSize, true));

            LuigiGfxData = GfxToPixelMap(
                Rom.ReadBytes(LuigiGfxAddress, PlayerGfxSize, true));

            MenuGfxData = Gfx2BppToPixelMap(
                Rom.ReadBytes(MenuGfxAddress, MenuGfxSize, true));

            Array.Copy(AreaPixelData, PixelData, AreaPixelData.Length);

            Array.Copy(
                sourceArray: SpritePixelData,
                sourceIndex: 0,
                destinationArray: PixelData,
                destinationIndex: 0xC000,
                length: SpritePixelData.Length);

            Array.Copy(
                sourceArray: AnimatedPixelData,
                sourceIndex: 0,
                destinationArray: PixelData,
                destinationIndex: 0x14000,
                length: AnimatedPixelData.Length);

            Array.Copy(
                sourceArray: MarioGfxData,
                sourceIndex: 0,
                destinationArray: PixelData,
                destinationIndex: 0x1C000,
                length: MarioGfxData.Length);

            Array.Copy(
                sourceArray: LuigiGfxData,
                sourceIndex: 0,
                destinationArray: PixelData,
                destinationIndex: 0x20000,
                length: LuigiGfxData.Length);

            Array.Copy(
                sourceArray: MenuGfxData,
                sourceIndex: 0,
                destinationArray: PixelData,
                destinationIndex: 0x24000,
                length: MenuGfxData.Length);

            TileSetActions = new Action[0x20]
            {
                null,
                WriteUnderGroundTileSet,
                WriteGrassTileSet,
                WriteUnderGroundTileSet,
                WriteBowserCastleTileSet,
                WriteGrassTileSet,
                null,
                WriteStarryNightTileSet,
                null,
                WriteStarryNightTileSet,
                WriteGameOverTileSet,
                WriteGrassTileSet,
                WriteGrassTileSet,
                null,
                WriteGrassTileSet,
                null,
                WriteGrassTileSet,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                WriteUnderGroundTileSet,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
            };
        }
Пример #6
0
 public AreaBg2Map(RomData romData)
 {
     RomData = romData
               ?? throw new ArgumentNullException(nameof(romData));
 }