예제 #1
0
파일: Poke.cs 프로젝트: tianqihou/tools
        public void SetPos(ReadAndWrite rw)
        {
            int enymyyTable = 0xa5f54;

            this.enymyyTable = rw.ReadPointer(enymyyTable);
            int playeryTable = 0xa5ebc;

            this.playeryTable = rw.ReadPointer(playeryTable);
            int altitudeTable = 0xa5ff4;

            this.altitudeTable = rw.ReadPointer(altitudeTable);
        }
예제 #2
0
파일: Poke.cs 프로젝트: tianqihou/tools
        public void Import(ReadAndWrite rw, Bitmap bm, int frame, int pal, bool clear, bool find)
        {
            int gfx_offset = npc.gfx_table + (frame << 3);
            int img_offset;

            try {
                img_offset = rw.ReadPointer(gfx_offset);
                if (clear)
                {
                    rw.FillWith0xFF(img_offset, rw.Br.ReadInt16());
                    goto FIND;
                }
                if (clear || find)
                {
                    goto FIND;
                }
                goto NOT_FIND;
            } catch (NullReferenceException) { }
FIND:
            img_offset = rw.FindFreeOffset0xFF(PokeConfig.ini.start_offset, bm.Width * bm.Height / 2);
NOT_FIND:
            byte[] img = ImgFunction.ConvertNormalImagToGBA(bm, new List <Color>(palletes[pal]), false);
            rw.WriteBytes(img_offset, 0, img);
            rw.Seek(gfx_offset);
            rw.Bw.Write(img_offset + ReadAndWrite.ROM);
            rw.Bw.Write(bm.Width * bm.Height >> 1);
            npc.width  = (short)bm.Width;
            npc.height = (short)bm.Height;
            Save(rw);
        }
예제 #3
0
파일: Poke.cs 프로젝트: tianqihou/tools
        public void SetLearnSet(ReadAndWrite rw, int index)
        {
            offset = rw.ReadPointer(learn_offset + 4 * index);
            BinaryReader br = rw.Br;

            br.BaseStream.Seek(offset, SeekOrigin.Begin);
            grid.Rows.Clear();
            if (expanded_learnset)
            {
                for (int x = 0; x < 50; x++)
                {
                    short s = br.ReadInt16();
                    learnmove_buffer[x] = s;
                    byte m = br.ReadByte();
                    learnlvl_buffer[x] = m;
                    if (s == 0)
                    {
                        break;
                    }
                    grid.Rows.Add();
                    grid.Rows[x].Cells[0].Value = m;
                    grid.Rows[x].Cells[1].Value = dataSource[s];
                }
            }
            else
            {
            }
        }
예제 #4
0
파일: Poke.cs 프로젝트: tianqihou/tools
        public Bitmap GetIcoin(ReadAndWrite rw)
        {
            rw.Seek(icoinPalleteIndexTable + index);
            byte palindex = rw.Br.ReadByte();

            byte[] img = rw.ReadBytes(rw.ReadPointer(icoinTable + (index << 2))
                                      , 0, 0x400);
            return(ImgFunction.ConvertGBAImageToBitmap(img, icoinPalltes[palindex],
                                                       32, 64, icoinImage));
        }
예제 #5
0
파일: Poke.cs 프로젝트: tianqihou/tools
        public void LoadPalletes(ReadAndWrite rw)
        {
            byte[] data = new byte[0x20];
            Stream s    = rw.Br.BaseStream;

            for (int x = 0; x < PAL_NUM - 1; x++)
            {
                int off = rw.ReadPointer(PAL_SPRITE + (x << 3));
                int num = s.ReadByte();
                rw.Seek(off);
                s.Read(data, 0, 0x20);
                palletes[num] = ImgFunction.ConvertGBAPalTo24Bit(data);
            }
        }
예제 #6
0
파일: Poke.cs 프로젝트: tianqihou/tools
        public Bitmap GetImg(ReadAndWrite rw, int frames)
        {
            if (palletes[0] == null)
            {
                LoadPalletes(rw);
            }
            int off;

            try {
                off = rw.ReadPointer(npc.gfx_table + (frames << 3));
            } catch (Exception) {
                return(null);
            }

            Bitmap p = rw.GetIndexedBitmapNotLz(off, palletes[(byte)npc.pal_tag], npc.width, npc.height);

            return(p);
        }
예제 #7
0
파일: Poke.cs 프로젝트: tianqihou/tools
        /// <summary>
        /// 保存任意压缩数据,需要提供原始指针所在地址。
        /// </summary>
        /// <param name="rw"></param>
        /// <param name="data">所需要写入的数据</param>
        /// <param name="offset">指针所在地址</param>
        /// <param name="fill">是否将原来的数据填充为0xFF</param>
        public int Save(ReadAndWrite rw, byte[] data, int offset_to_repoint, bool fill)
        {
            //指针所在地址
            int offset_old = rw.ReadPointer(offset_to_repoint);
            //新地址
            int offset_new = rw.FindFreeOffset(start, data.Length);

            rw.WriteBytes(offset_new, 0, data);
            start = rw.Position;
            rw.Repoint(offset_to_repoint, offset_new);
            int length = ImgFunction.LZUncompress(rw.Br, offset_old).Item2;

            if (fill)
            {
                rw.FillWith0xFF(offset_old, length);
            }
            return(offset_new);
        }
예제 #8
0
파일: Poke.cs 프로젝트: tianqihou/tools
 public void InIt(ReadAndWrite rw, INI_init ini)
 {
     front_offset           = rw.ReadPointer(ini.frontspritetable);
     back_offset            = rw.ReadPointer(ini.backspritetable);
     normal_pal_off         = rw.ReadPointer(ini.frontpalettetable);
     shiny_pal_off          = rw.ReadPointer(ini.shinypalettetable);
     icoinTable             = rw.ReadPointer(ini.icointable);
     icoinPalleteIndexTable = rw.ReadPointer(ini.icoinindextable);
     icoinPalltes           = new Color[3][];
     rw.Seek(ini.icoinpallete);
     for (byte x = 0; x < 3; x++)
     {
         byte[] pal = rw.Br.ReadBytes(32);
         icoinPalltes[x] = ImgFunction.ConvertGBAPalTo24Bit(pal);
     }
 }
예제 #9
0
파일: Poke.cs 프로젝트: tianqihou/tools
 public byte[] GetData(ReadAndWrite rw, int offset)
 {
     offset = rw.ReadPointer(offset);
     return(ImgFunction.LZUncompress(rw.Br, offset).Item1);
 }