Exemple #1
0
        //DrawOPClassFont + テキストを書くルーチン
        public static Size DrawOPClassFontAndText(ListBox lb, int index, Graphics g, Rectangle listbounds, bool isWithDraw)
        {
            if (index < 0 || index >= lb.Items.Count)
            {
                return(new Size(listbounds.X, listbounds.Y));
            }
            string text = lb.Items[index].ToString();

            SolidBrush brush      = new SolidBrush(lb.ForeColor);
            Font       normalFont = lb.Font;
            Rectangle  bounds     = listbounds;

            int textmargineY = (ListBoxEx.OWNER_DRAW_ICON_SIZE - (int)lb.Font.Height) / 2;

            //テキストの先頭にアイコン番号(キャラ番号が入っている. 無駄だが汎用性を考えるとほかに方法がない)
            uint   icon = U.atoh(text);
            Bitmap bitmap;

            if (Program.ROM.RomInfo.version() == 8)
            {
                if (Program.ROM.RomInfo.is_multibyte())
                {
                    bitmap = OPClassFontForm.DrawFontByID(icon);
                }
                else
                {
                    bitmap = OPClassFontFE8UForm.DrawFontByID(icon);
                }
            }
            else if (Program.ROM.RomInfo.version() == 7)
            {
                bitmap = ImageUtil.Blank(8, 8);
            }
            else
            {//ver 6
                bitmap = ImageUtil.Blank(8, 8);
            }

            U.MakeTransparent(bitmap);

            //アイコンを描く.
            Rectangle b = bounds;

            b.Width   = ICON_WIDTH;
            b.Height  = ICON_HEGITH;
            bounds.X += U.DrawPicture(bitmap, g, isWithDraw, b);

            //テキストを描く.
            b         = bounds;
            b.Y      += textmargineY;
            bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, b);

            brush.Dispose();
            bitmap.Dispose();

            bounds.Y += ICON_WIDTH;
            return(new Size(bounds.X, bounds.Y));
        }
Exemple #2
0
        public void Wipe(List <Address> list)
        {
            if (Program.ROM.RomInfo.version != 8)
            {
                return;
            }
            if (!Program.ROM.RomInfo.is_multibyte)
            {
                return;
            }

            if (Program.ROM.u16(0xB7890) != 0x4B00)
            {
                return;
            }

            //最初の一つを残して全消去
            List <U.AddrResult> alist = OPClassFontForm.MakeList();

            if (alist.Count <= 1)
            {
                return;
            }

            uint addr;

            addr = alist[0].addr;
            if (!U.isSafetyOffset(addr))
            {
                return;
            }
            uint lastJpFontImageAddr = Program.ROM.u32(addr + 0);

            for (int i = 0; i < alist.Count; i++)
            {
                addr = alist[i].addr;
                uint a = Program.ROM.u32(addr + 0);

                if (a != lastJpFontImageAddr)
                {
                    FEBuilderGBA.Address.AddLZ77Pointer(list
                                                        , addr + 0
                                                        , "OPClassFont " + U.To0xHexString(i)
                                                        , false
                                                        , FEBuilderGBA.Address.DataTypeEnum.LZ77IMG);
                    Program.ROM.write_u32(addr + 0, lastJpFontImageAddr, this.UndoData);
                }
            }
        }