void WriteBackFontKF(KeepFont kf, RecycleAddress ra) { uint topaddress = FontForm.GetFontPointer(kf.IsItemFont); uint prevaddr; uint fontaddr = FontForm.FindFontData(topaddress, kf.MojiCode, out prevaddr, this.PriorityCode); if (fontaddr != U.NOT_FOUND) {//知ってるらしい return; } if (prevaddr == U.NOT_FOUND) {//追加不可能 return; } byte[] newFontData = FontForm.MakeNewFontData(kf.MojiCode , kf.Width , kf.Data , Program.ROM , this.PriorityCode); U.write_u32(newFontData, 0, 0); //NULL リストの末尾に追加するので. uint newaddr = ra.Write(newFontData, this.UndoData); if (newaddr == U.NOT_FOUND) {//エラー return; } //ひとつ前のフォントリストのポインタを、現在追加した最後尾にすげかえる. Program.ROM.write_u32(prevaddr + 0, U.toPointer(newaddr), this.UndoData); if (kf.rewitePointer != U.NOT_FOUND) { Program.ROM.write_u32(kf.rewitePointer, U.toPointer(newaddr), this.UndoData); } }
void AddKeepFont(bool isItemFont, uint moji, uint rewitePointer = U.NOT_FOUND) { uint topaddress = FontForm.GetFontPointer(isItemFont); uint prevaddress; uint fontaddress = FontForm.FindFontData(topaddress , moji , out prevaddress , PriorityCode); if (fontaddress == U.NOT_FOUND) { return; } KeepFont kf = new KeepFont(); kf.IsItemFont = isItemFont; kf.Moji = "Code" + U.To0xHexString(moji); kf.MojiCode = moji; kf.Width = Program.ROM.u8(fontaddress + 5); kf.Data = Program.ROM.getBinaryData(fontaddress + 8, 64); kf.rewitePointer = rewitePointer; KeepFontList.Add(kf); }