Exemplo n.º 1
0
        public SaveState(ref Process gameProc, ref int baseAddress)
        {
            this.xPos = ProcessMemory.ReadSingle(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x03742E10, 0x20));
            this.yPos = ProcessMemory.ReadSingle(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x03742E10, 0x24));
            this.zPos = ProcessMemory.ReadSingle(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x03742E10, 0x28));
            this.xRot = ProcessMemory.ReadInt16(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x03742E10, 0x14));
            this.yRot = ProcessMemory.ReadInt16(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x03742E10, 0x18));
            this.zRot = ProcessMemory.ReadInt16(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x03742E10, 0x1C));

            this.hSpeed = ProcessMemory.ReadSingle(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0373CDF0, 0x38));
            this.vSpeed = ProcessMemory.ReadSingle(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0373CDF0, 0x3C));
            this.hover  = ProcessMemory.ReadInt16(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0373CDF0, 0x8));

            this.lives = ProcessMemory.ReadByte(gameProc, baseAddress + 0x0370EF34);
            this.rings = ProcessMemory.ReadInt16(gameProc, baseAddress + 0x0370F0E4);

            this.tFrames  = ProcessMemory.ReadByte(gameProc, baseAddress + 0x0370EF35);
            this.tSeconds = ProcessMemory.ReadByte(gameProc, baseAddress + 0x0370F128);
            this.tMins    = ProcessMemory.ReadByte(gameProc, baseAddress + 0x0370EF48);

            this.camX    = ProcessMemory.ReadSingle(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0372CBB0, 0x20));
            this.camY    = ProcessMemory.ReadSingle(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0372CBB0, 0x24));
            this.camZ    = ProcessMemory.ReadSingle(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0372CBB0, 0x28));
            this.camXRot = ProcessMemory.ReadInt16(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0372CBB0, 0x14));
            this.camYRot = ProcessMemory.ReadInt16(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0372CBB0, 0x18));
            this.camZRot = ProcessMemory.ReadInt16(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0372CBB0, 0x1C));
        }
Exemplo n.º 2
0
        public static void LoadState(SaveState state)
        {
            // Write Position into memory
            ProcessMemory.Write(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x03742E10, 0x20), state.xPos);
            ProcessMemory.Write(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x03742E10, 0x24), state.yPos);
            ProcessMemory.Write(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x03742E10, 0x28), state.zPos);

            //ProcessMemory.Write("base+0372CAB0", "float", state.xPos.ToString());
            //ProcessMemory.Write("base+0372CAB4", "float", state.xPos.ToString());
            //ProcessMemory.Write("base+0372CAB8", "float", state.xPos.ToString());

            // Write Rotation into memory
            ProcessMemory.Write(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x03742E10, 0x14), state.xRot);
            ProcessMemory.Write(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x03742E10, 0x18), state.yRot);
            ProcessMemory.Write(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x03742E10, 0x1C), state.zRot);

            // Write Speed into memory
            ProcessMemory.Write(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0373CDF0, 0x38), state.hSpeed);
            ProcessMemory.Write(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0373CDF0, 0x3C), state.vSpeed);
            ProcessMemory.Write(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0373CDF0, 0x8), state.hover);

            // Write Lives and rings into memory
            ProcessMemory.Write(gameProc, baseAddress + 0x0370EF34, state.lives);
            ProcessMemory.Write(gameProc, baseAddress + 0x0370F0E4, state.rings);

            // Write time into memory
            ProcessMemory.Write(gameProc, baseAddress + 0x0370EF35, state.tFrames);
            ProcessMemory.Write(gameProc, baseAddress + 0x0370F128, state.tSeconds);
            ProcessMemory.Write(gameProc, baseAddress + 0x0370EF48, state.tMins);



            // Write camera info into memory
            if (ProcessMemory.ReadByte(gameProc, 0x372CBA8) != 7)
            {
                ProcessMemory.Write(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0372CBB0, 0x20), state.camX);
                ProcessMemory.Write(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0372CBB0, 0x24), state.camY);
                ProcessMemory.Write(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0372CBB0, 0x28), state.camZ);

                ProcessMemory.Write(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0372CBB0, 0x14), state.camXRot);
                ProcessMemory.Write(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0372CBB0, 0x18), state.camYRot);
                ProcessMemory.Write(gameProc, ProcessMemory.GetFinalAddress(gameProc, baseAddress + 0x0372CBB0, 0x1C), state.camZRot);

                //ProcessMemory.Write("base+372CAE1", "byte", "0");
            }
        }