Beispiel #1
0
        private static void SetSceneFlag(FlagOperations op, Ptr baseAddr, int id)
        {
            if (id < 0 || id > 0x3F)
            {
                Console.WriteLine("Flag Id is not between 0x00 and 0x3F");
                return;
            }
            int value = baseAddr.ReadInt32(0);

            if (id >= 0x20)
            {
                baseAddr = baseAddr.RelOff(4);
                id      -= 0x20;
            }
            if (op == FlagOperations.Off)
            {
                int mask = ~(1 << id);
                value &= mask;
            }
            else if (op == FlagOperations.On)
            {
                value |= 1 << id;
            }
            else if (op == FlagOperations.Toggle)
            {
                value ^= 1 << id;
            }
            baseAddr.Write(0, value);
            Console.WriteLine($"{baseAddr}: {value:X8}");
        }
Beispiel #2
0
        private static void SetEventChkInf(FlagOperations op, Ptr saveCtx, int id)
        {
            if (id < 0 || id >= 0xE0)
            {
                Console.WriteLine("Flag ID is not between 0x00 and 0xDF");
                return;
            }
            Ptr    off   = saveCtx.RelOff(id / 0x10 * 2 + 0xED4);
            ushort value = off.ReadUInt16(0);
            ushort shift = (ushort)(1 << (id % 0x10));

            if (op == FlagOperations.Off)
            {
                ushort mask = (ushort)~shift;
                value &= mask;
            }
            else if (op == FlagOperations.On)
            {
                value |= shift;
            }
            else if (op == FlagOperations.Toggle)
            {
                value ^= shift;
            }
            off.Write(0, value);
            Console.WriteLine($"{off}: {value:X4}");
        }