Example #1
0
        public static uint SearchMenu(string typename, uint menuID, uint helpID)
        {
            uint pointer;

            if (typename == "UNITMENU")
            {
                pointer = MenuDefinitionForm.GetUnitMenuPointer();
            }
            else if (typename == "GAMEMENU")
            {
                pointer = MenuDefinitionForm.GetGameMenuPointer();
            }
            else if (typename == "DEBUG1")
            {
                pointer = MenuDefinitionForm.GetDebug1MenuPointer();
            }
            else if (typename == "ITEMMENU")
            {
                pointer = MenuDefinitionForm.GetItemMenuPointer();
            }
            else
            {
                return(U.NOT_FOUND);
            }
            return(SearchMenuLow(pointer, menuID, helpID));
        }
Example #2
0
        public static uint SearchMenuUnitOrGame(uint menuID, uint helpID)
        {
            uint r = SearchMenuLow(MenuDefinitionForm.GetUnitMenuPointer(), menuID, helpID);

            if (r != U.NOT_FOUND)
            {
                return(r);
            }
            r = SearchMenuLow(MenuDefinitionForm.GetGameMenuPointer(), menuID, helpID);
            return(r);
        }
Example #3
0
        public static uint ExpandsArea(Form form, string typename, uint newdatacount, Undo.UndoData undodata)
        {
            uint pointer;

            if (typename == "UNITMENU")
            {
                pointer = MenuDefinitionForm.GetUnitMenuPointer();
            }
            else if (typename == "GAMEMENU")
            {
                pointer = MenuDefinitionForm.GetGameMenuPointer();
            }
            else if (typename == "DEBUG1")
            {
                pointer = MenuDefinitionForm.GetDebug1MenuPointer();
            }
            else if (typename == "ITEMMENU")
            {
                pointer = MenuDefinitionForm.GetItemMenuPointer();
            }
            else
            {
                return(U.NOT_FOUND);
            }

            uint newaddr;

            {
                InputFormRef.ExpandsEventArgs eearg = new InputFormRef.ExpandsEventArgs();

                InputFormRef ifr = Init(null);
                ifr.ReInitPointer(pointer);

                eearg.OldBaseAddress = ifr.BaseAddress;
                eearg.OldDataCount   = ifr.DataCount;
                eearg.BlockSize      = ifr.BlockSize;

                newaddr = ifr.ExpandsArea(form, newdatacount, undodata, pointer);
                if (newaddr == U.NOT_FOUND)
                {
                    return(U.NOT_FOUND);
                }

                eearg.NewBaseAddress = newaddr;
                eearg.NewDataCount   = newdatacount;
                AddressListExpandsEventInner(form, eearg, undodata);
            }
            InputFormRef.ClearCacheDataCount();
            return(newaddr);
        }
Example #4
0
        public static uint AllocNullMenuAddress(uint needCount, string typename)
        {
            uint pointer;

            if (typename == "UNITMENU")
            {
                pointer = MenuDefinitionForm.GetUnitMenuPointer();
            }
            else if (typename == "GAMEMENU")
            {
                pointer = MenuDefinitionForm.GetGameMenuPointer();
            }
            else
            {
                return(U.NOT_FOUND);
            }

            uint alwayFalse = 0;

            if (Program.ROM.RomInfo.version() != 6)
            {
                alwayFalse = U.toPointer(Program.ROM.RomInfo.MenuCommand_UsabilityNever() + 1);
            }

            uint nullCount = 0;
            uint foundAddr = U.NOT_FOUND;

            InputFormRef ifr = Init(null);

            ifr.ReInitPointer(pointer);

            uint addr = ifr.BaseAddress;

            for (int i = 0; i < ifr.DataCount; i++, addr += ifr.BlockSize)
            {
                uint a1 = Program.ROM.u32(addr + 0);
                uint a2 = Program.ROM.u32(addr + 4);
                uint a3 = Program.ROM.u32(addr + 8);
                uint a4 = Program.ROM.u32(addr + 12); //常にメニューを表示しないを選択
                uint a5 = Program.ROM.u32(addr + 16);
                uint a6 = Program.ROM.u32(addr + 20);
                uint a7 = Program.ROM.u32(addr + 24);
                uint a8 = Program.ROM.u32(addr + 28);
                uint a9 = Program.ROM.u32(addr + 32);

                if (a1 == 0 && a2 == 0 && a3 == 0 && a4 == alwayFalse &&
                    a5 == 0 && a6 == 0 && a7 == 0 && a8 == 0 && a9 == 0)
                {
                    if (nullCount <= 0)
                    {
                        foundAddr = addr;
                    }

                    nullCount++;
                    if (nullCount >= needCount)
                    {
                        return(foundAddr);
                    }
                }
                else
                {
                    nullCount = 0;
                    foundAddr = U.NOT_FOUND;
                }
            }
            return(U.NOT_FOUND);
        }