Example #1
0
 public TextEditor(byte[] buf)
 {
     InitializeComponent();
     gb = new GBHL.GBFile(buf);
     getTextAddresses();
     nAddress.Value = textAddresses[0];
 }
Example #2
0
        public frmWarp(Program.GameTypes g, GBHL.GBFile gbf, byte f)
        {
            InitializeComponent();
            game = g;
            if (g == Program.GameTypes.Ages)
            {
                foreach (string s in agesGroupNames)
                {
                    cboArea.Items.Add(s);
                }
            }
            else
            {
                foreach (string s in seasonsGroupNames)
                {
                    cboArea.Items.Add(s);
                }
            }

            cboArea.SelectedIndex = 0;
            flag2      = f;
            gb         = gbf;
            warpLoader = new WarpLoader(gb);
            mapLoader  = new MapLoader(gb);
        }
Example #3
0
        public InteractionLoader(GBHL.GBFile g, Program.GameTypes game)
        {
            gb         = g;
            loadedGame = game;

            if (game == Program.GameTypes.Ages)
            {
                // Check if patch has been applied
                if (gb.ReadByte(0x54328) == 0xc3)
                {
                    enableExtraInteractionBank();
                }

                // Many maps point here when they have no data.
                // But this isn't treated as a special case anymore.
                //noLocation = 0x49977;
            }
            else
            {
                if (gb.ReadByte(0x458dc) == 0xcd)
                {
                    enableExtraInteractionBank();
                }

                //noLocation = 0x4634b;
            }

            loadInteractions(0, 0);
        }
Example #4
0
 public ChestEditor(GBHL.GBFile g, byte chest)
 {
     InitializeComponent();
     gb          = g;
     chestData   = chest;
     nItem.Value = chest;
 }
Example #5
0
 public frmDungeonPortal(GBHL.GBFile g, Program.GameTypes game)
 {
     gb        = g;
     this.game = game;
     InitializeComponent();
     nDungeon_ValueChanged(null, null);
 }
Example #6
0
        public RepointCollision(byte[] g, bool overworld, int dungeon, int map, int address, bool spec, bool mag, bool sprite, List <Warps> warps, List <LAObject> objects, int wallvalue, int floorvalue)
        {
            InitializeComponent();
            gb         = new GBHL.GBFile(g);
            Dungeon    = dungeon;
            overWorld  = overworld;
            Map        = map;
            mapAddress = address;
            special    = spec;
            magGlass   = mag;
            sprites    = sprite;
            mapWarps   = warps;
            mapObjects = objects;
            wall       = wallvalue;
            floor      = floorvalue;

            nAddress.Value = address;
            if (!sprite)
            {
                if (overWorld)
                {
                    if (map < 0x80)
                    {
                        nAddress.Minimum = 0x24200;
                        nAddress.Maximum = //0x2668B;
                                           0x27FFD;
                    }
                    else
                    {
                        nAddress.Minimum = 0x68000;
                        nAddress.Maximum = //0x69E73;
                                           0x6BFFD;
                    }
                }
                else
                {
                    if (dungeon < 6 || dungeon >= 0x1A)
                    {
                        nAddress.Maximum = 0x2BB74;
                        nAddress.Minimum = 0x28200;
                    }
                    else if (dungeon >= 6 || dungeon < 0x1A)
                    {
                        nAddress.Maximum = 0x2FFFD;
                        nAddress.Minimum = 0x2C200;
                    }
                    if (dungeon == 0xFF)
                    {
                        nAddress.Maximum = 0x2BFFD;
                        nAddress.Minimum = 0x28200;
                    }
                }
            }
            else
            {
                nAddress.Minimum = 0x58640;
                nAddress.Maximum = 0x5BFFD;
            }
        }
Example #7
0
 public frmChest(GBHL.GBFile g, int grp, int m, Program.GameTypes game)
 {
     gb    = g;
     chest = new ChestLoader(gb, game);
     group = grp;
     map   = m;
     InitializeComponent();
 }
Example #8
0
 public frmDungeonRooms(GBHL.GBFile g, byte[] m, Image i)
 {
     gb       = g;
     mapOrder = m;
     Array.Copy(m, baseMapOrder, m.Length);
     InitializeComponent();
     pMinimap.Image = i;
 }
Example #9
0
 public NewObject(GBHL.GBFile g, bool overWorld)
 {
     InitializeComponent();
     gb        = g;
     O.x       = 0;
     O.y       = 0;
     overworld = overWorld;
     O.id      = (byte)nObjectID.Value;
 }
Example #10
0
 public frmTilesetEditor(GBHL.GBFile g, Form1 f)
 {
     InitializeComponent();
     tilesBmp       = new Bitmap(128, 128);
     form           = f;
     gb             = g;
     nTileset.Value = f.nArea.Value;
     LoadTileset((int)nTileset.Value);
 }
Example #11
0
 public frmAreaFlags(GBHL.GBFile g, Program.GameTypes gm, AreaLoader a, int area)
 {
     InitializeComponent();
     gb          = g;
     game        = gm;
     areaLoader  = a;
     nArea.Value = area;
     nArea_ValueChanged(null, null);
 }
Example #12
0
 public frmInteractions(InteractionLoader i, int grp, int mp, Program.GameTypes game, GBHL.GBFile g)
 {
     InitializeComponent();
     this.game         = game;
     interactionLoader = i;
     gb    = g;
     group = grp;
     map   = mp;
 }
Example #13
0
 public frmWarpProps(WarpLoader w, int g, int la, Program.GameTypes gm, GBHL.GBFile gbf)
 {
     game        = gm;
     warpLoader  = w;
     group       = g;
     lastAddress = la;
     gb          = gbf;
     InitializeComponent();
 }
Example #14
0
        public static int GetPaletteAddress(GBHL.GBFile gb, Program.GameTypes game, int index)
        {
            int baseColorAddress = (game == Program.GameTypes.Ages ? (0x17 * 0x4000) : (0x16 * 0x4000));

            gb.BufferLocation  = (game == Program.GameTypes.Ages ? 0x632C : 0x6290);
            gb.BufferLocation += index * 2;
            gb.BufferLocation  = gb.ReadByte() + gb.ReadByte() * 0x100;

            byte a = gb.ReadByte();

            gb.BufferLocation = baseColorAddress + gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100);

            return((gb.BufferLocation % 0x4000) + 0x4000);
        }
Example #15
0
        public frmMapScript(GBHL.GBFile g, int map, int group)
        {
            gb  = g;
            grp = group;
            bm  = (byte)map;
            m   = new MapScripts(gb);
            InitializeComponent();
            int b = m.loadScript(map, group);

            if (b == -1)
            {
                panel2.Visible = true;
                return;
            }
            panel1.Visible = true;
            nScript.Value  = (byte)b;
        }
Example #16
0
 public MinibossEditor(byte[] buff, bool overworld, int map)
 {
     InitializeComponent();
     gb        = new GBHL.GBFile(buff);
     overWorld = overworld;
     if (!overworld)
     {
         comDungeons.SelectedIndex = 0;
     }
     else
     {
         comDungeons.Enabled = false;
         label2.Text         = "Map:";
         label3.Text         = "Warp Map:";
         nMap1.Value         = map;
     }
 }
Example #17
0
 public frmTransitions(TransitionLoader tl, GBHL.GBFile g, Program.GameTypes ga)
 {
     InitializeComponent();
     gb               = g;
     game             = ga;
     transitionLoader = tl;
     nIndex.Maximum   = tl.transitions.Count - 1;
     if (tl.transitions.Count == 0)
     {
         groupBox1.Enabled = false;
     }
     else
     {
         nMap.Value = transitionLoader.transitions[(int)nIndex.Value].map;
         cboDirection.SelectedIndex = transitionLoader.transitions[(int)nIndex.Value].direction;
         nFrom.Value = PaletteLoader.GetPaletteIndex(gb, game, transitionLoader.transitions[(int)nIndex.Value].from);
         nTo.Value   = PaletteLoader.GetPaletteIndex(gb, game, transitionLoader.transitions[(int)nIndex.Value].to);
     }
 }
Example #18
0
        public static int GetPaletteIndex(GBHL.GBFile gb, Program.GameTypes game, int dest)
        {
            int baseColorAddress = (game == Program.GameTypes.Ages ? (0x17 * 0x4000) : (0x16 * 0x4000));

            for (int i = 0; i < 255; i++)
            {
                gb.BufferLocation  = (game == Program.GameTypes.Ages ? 0x632C : 0x6290);
                gb.BufferLocation += i * 2;
                gb.BufferLocation  = gb.ReadByte() + gb.ReadByte() * 0x100;

                byte a = gb.ReadByte();

                gb.BufferLocation = baseColorAddress + gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100);
                if ((gb.BufferLocation % 0x4000) + 0x4000 == dest)
                {
                    return(i);
                }
            }
            return(-1);
        }
Example #19
0
        public frmSecondaryScript(GBHL.GBFile g, MapScripts ms, int grp, int mp)
        {
            gb    = g;
            m     = ms;
            group = grp;
            map   = mp;
            InitializeComponent();
            int i = m.loadSecondaryScriptRef(group, map);

            sl = i;
            if (i == -1)
            {
                panel2.Visible = true;
            }
            else
            {
                panel1.Visible = true;
                nScript.Value  = gb.ReadByte(i + 1);
            }
        }
Example #20
0
 public SpriteEditor(GBHL.GBFile g, bool overworld, byte Map, byte Dungeon)
 {
     InitializeComponent();
     gb = g;
     if (overworld)
     {
         overWorld          = overworld;
         cOverworld.Checked = true;
     }
     map        = Map;
     nMap.Value = map;
     if (!overworld)
     {
         dungeon        = Dungeon;
         nDungeon.Value = dungeon;
     }
     loadSpriteBanks();
     getSpriteLocation();
     drawSprites();
 }
Example #21
0
        public frmTreeTop(GBHL.GBFile g, int grp, int mp, TreeTopLoader trl)
        {
            gb    = g;
            map   = mp;
            group = grp;
            tl    = trl;
            InitializeComponent();
            int i = tl.getTreeTopLocation(group, map);

            if (i == -1)
            {
                panel2.Visible = true;
            }
            else
            {
                panel1.Visible    = true;
                treeLoc           = i;
                gb.BufferLocation = i + 1;
                nMap.Value        = (byte)map;
                nTop.Value        = gb.ReadByte();
                nX.Value          = gb.ReadByte();
                nY.Value          = gb.ReadByte();
            }
        }
Example #22
0
 public static string GetROMHeader(GBHL.GBFile gb)
 {
     gb.BufferLocation = 0x134;
     byte[] bytes = gb.ReadBytes(10);
     return(System.Text.ASCIIEncoding.ASCII.GetString(bytes));
 }
Example #23
0
 public frmStart(GBHL.GBFile g, Program.GameTypes gm)
 {
     gb   = g;
     game = gm;
     InitializeComponent();
 }
Example #24
0
 public ChestLoader(GBHL.GBFile g, Program.GameTypes gm)
 {
     gb   = g;
     game = gm;
 }
Example #25
0
 public TilesetBuilder(GBHL.GBFile g)
 {
     gb = g;
 }
Example #26
0
 public TransitionLoader(GBHL.GBFile g)
 {
     gb = g;
 }
Example #27
0
 public MapScripts(GBHL.GBFile g)
 {
     gb = g;
 }
Example #28
0
        public PaletteEditor(TileLoader t, Form1 f, Color[,] pal, byte[] g, int dungeon, int map, bool overworld, bool sideview, bool special, bool crystal, byte off)
        {
            InitializeComponent();

            tLoader = t;
            palette = pal;
            form1   = f;
            gb      = new GBHL.GBFile(g);

            if (overworld)
            {
                nDungeon.Enabled = false;
            }
            overWorld            = overworld;
            sideView             = sideview;
            specialMaps          = special;
            crystals             = crystal;
            mapIndex             = map;
            mapIndexOriginal     = map;
            dungeonIndex         = dungeon;
            dungeonIndexOriginal = dungeon;
            nMap.Value           = map;

            if (!overworld)
            {
                nDungeon.Value    = dungeon;
                nIndex.Enabled    = false;
                gb.BufferLocation = 0x8523A;
                for (int i = 0; i < 0x2D; i++)
                {
                    if (gb.ReadByte() != dungeonIndex)
                    {
                        gb.BufferLocation += 3;
                        continue;
                    }
                    if (gb.ReadByte() != mapIndex)
                    {
                        gb.BufferLocation += 2;
                        continue;
                    }
                    byte q = gb.ReadByte();
                    if (q != 4)
                    {
                        gb.BufferLocation++;
                        continue;
                    }
                    nIndex.Enabled = true;
                    nIndex.Maximum = 0x3F;
                    offset         = off;
                    nIndex.Value   = off & 0x3F;
                    break;
                }
            }
            if (dungeon == 0xFF)
            {
                nMap.Maximum = 0x15;
            }
            pTileset.Image = form1.pTiles.Image;

            palette = pal;
            Bitmap   b   = new Bitmap(128, 128);
            Graphics gra = Graphics.FromImage(b);

            for (int k = 0; k < 8; k++)
            {
                for (int i = 0; i < 4; i++)
                {
                    gra.FillRectangle(new SolidBrush(pal[k, i]), i * 32, k * 16, 32, 16);
                }
            }
            pPalette.Image = b;
            getPaletteLocation();
            getPalettePointer();
            if (overworld)
            {
                offset       = off;
                nIndex.Value = off;
            }
        }
Example #29
0
 public WarpLoader(GBHL.GBFile g)
 {
     gb = g;
 }
Example #30
0
 public frmSearch(GBHL.GBFile g)
 {
     gb = g;
     InitializeComponent();
 }
Example #31
0
File: Form1.cs Project: Drenn1/ZOTE
        private void LoadROM(string file)
        {
            try
            {
                BinaryReader br = new BinaryReader(File.OpenRead(file));
                byte[] buffer = br.ReadBytes((int)br.BaseStream.Length);
                br.Close();
                gb = new GBHL.GBFile(buffer);
                fname = file;
            }
            catch (Exception)
            {
                MessageBox.Show("IO Error.", "Error");
                setBles(false);
            }

            setBles(true);
            tl = new TextLoader(gb);
            panel1.Enabled = true;
        }
Example #32
0
 public StartEditor(GBHL.GBFile g)
 {
     InitializeComponent();
     gb = g;
     getStartData();
 }