Beispiel #1
0
        void WriteText(uint id, string text, Undo.UndoData undodata)
        {
            //無効なID
            if (id <= 0)
            {
                return;
            }

            //最後の改行の削除.
            if (text.Length < 2)
            {
                return;
            }
            string writetext = U.substr(text, 0, text.Length - 2);

            writetext = TextForm.ConvertFEditorToEscape(writetext);

            if (id < this.MaxTextCount)
            {
                TextForm.WriteText(this.TextBaseAddress
                                   , this.MaxTextCount
                                   , id
                                   , writetext
                                   , undodata);
                return;
            }
            if (!U.isSafetyPointer(id))
            {
                Log.Error("不明な文字列", id.ToString(), text);
                return;
            }
            uint p_text_pointer = U.toOffset(id);
            uint text_pointer   = Program.ROM.u32(p_text_pointer);

            if (!U.isSafetyPointer(text_pointer))
            {
                Log.Error("ポインタではありません", id.ToString(), text);
                return;
            }
            uint new_textpointer = CStringForm.WriteCString(text_pointer, writetext, undodata);

            if (new_textpointer == U.NOT_FOUND)
            {
                return;
            }

            Program.ROM.write_p32(p_text_pointer, new_textpointer, undodata);
        }