コード例 #1
0
 public void Deactivate()
 {
     if (!_modActive)
     {
         return;
     }
     ModLogger.WriteLine("Deactivating Break HP/MP Limit");
     GameMemory.Assembly.Inject(_offsetHPCheck, new[]
     {
         "and eax,0x00015f90",
         "add eax,0x0000270f",
     }, true);
     GameMemory.Assembly.Inject(_offsetMPCheck, new[]
     {
         "and eax,0x00002328",
         "add eax,0x000003E7",
     }, true);
     GameMemory.Assembly.Inject(_offsetMPLimit, new[]
     {
         "mov eax,0x0000270F",
         "jne 0x20E780",
         "mov eax,0x000003E7",
     }, true);
     GameMemory.Assembly.Inject(_offsetHPLimit, new[]
     {
         "mov eax,0x0001869F",
         "jne 0x20E749",
         "mov eax,0x0000270F",
     }, true);
     _modActive = false;
 }
コード例 #2
0
ファイル: FFX-HardBattle.cs プロジェクト: redthefed/Farplane
 public void Deactivate()
 {
     if (!_modActive)
     {
         return;
     }
     ModLogger.WriteLine("Harder battle mod deactivated");
     _modActive = false;
 }
コード例 #3
0
ファイル: FFX-HardBattle.cs プロジェクト: redthefed/Farplane
 public void Activate()
 {
     if (_modActive)
     {
         return;
     }
     ModLogger.WriteLine("Harder battle mod activated");
     _modActive = true;
 }
コード例 #4
0
 public void Deactivate()
 {
     if (!_modActive)
     {
         return;
     }
     ModLogger.WriteLine("Deactivating Break Damage Limit");
     ModLogger.WriteLine("Deactivation NYI");
     _modActive = false;
 }
コード例 #5
0
 public void Deactivate()
 {
     if (!_modActive)
     {
         return;
     }
     ModLogger.WriteLine("Deactivating free camera mod");
     GameMemory.Write <byte>(offsetCameraFlag, 0);
     _modActive = false;
 }
コード例 #6
0
 public void Activate()
 {
     if (_modActive)
     {
         return;
     }
     lastRoom = -1;
     ModLogger.WriteLine("Activating free camera mod");
     _modActive = true;
 }
コード例 #7
0
    public void Activate()
    {
        if (_modActive)
        {
            return;
        }
        ModLogger.WriteLine("Activating Break HP/MP Limit");

        // No check (yet)
        GameMemory.Assembly.Inject(_offsetHPCheck, new []
        {
            "nop",
            "nop",
            "nop",
            "nop",
            "nop",
            "mov eax,0x7fffffff",
        });
        GameMemory.Assembly.Inject(_offsetMPCheck, new[]
        {
            "nop",
            "nop",
            "nop",
            "nop",
            "nop",
            "mov eax,0x7fffffff",
        });
        GameMemory.Assembly.Inject(_offsetMPLimit, new[]
        {
            "nop",
            "nop",
            "nop",
            "nop",
            "nop",
            "nop",
            "nop",
            "mov eax,0x7fffffff",
        });
        GameMemory.Assembly.Inject(_offsetHPLimit, new[]
        {
            "nop",
            "nop",
            "nop",
            "nop",
            "nop",
            "nop",
            "nop",
            "mov eax,0x7fffffff",
        });

        _modActive = true;
    }
コード例 #8
0
    public static bool ValidateBytes()
    {
        var codeBytes1 = GameMemory.Read <byte>(_offsetModBytes1, _originalBytes1.Length);
        var codeBytes2 = GameMemory.Read <byte>(_offsetModBytes2, _originalBytes2.Length);

        if ((codeBytes1.SequenceEqual(_originalBytes1) &&
             codeBytes2.SequenceEqual(_originalBytes2)) ||
            (codeBytes1.SequenceEqual(_modBytes) &&
             codeBytes2.SequenceEqual(_modBytes)))
        {
            return(true);
        }
        ModLogger.WriteLine("Unexpected assembly code, aborting code write.");
        return(false);
    }
コード例 #9
0
    public void Update()
    {
        if (!_modActive)
        {
            return;
        }

        updateTicks++;
        if (updateTicks < 50)
        {
            return;                   // tick every ~400ms, faster and the game misses the flag on room change
        }
        updateTicks = 0;

        var battlePointer = GameMemory.Read <int>(offsetBattlePointer);

        if (battlePointer == 0) // Not in battle, enable camera
        {
            // Check current room
            var currentRoom = GameMemory.Read <ushort>(offsetCurrentRoom);

            // Check if room is on banned rooms list
            if (Array.IndexOf(bannedRooms, currentRoom) != -1)
            {
                GameMemory.Write <byte>(offsetCameraFlag, 0);
                lastRoom = currentRoom;
                return;
            }

            // If we have changed rooms, reset flag this tick
            if (currentRoom != lastRoom)
            {
                ModLogger.WriteLine("Room change detected: {0}", currentRoom.ToString("X2"));
                GameMemory.Write <byte>(offsetCameraFlag, 0);
                lastRoom = currentRoom;
                return;
            }

            // Enable camera flag
            GameMemory.Write <byte>(offsetCameraFlag, 1);
        }
        else // In battle, disable camera
        {
            GameMemory.Write <byte>(offsetCameraFlag, 0);
        }
    }
コード例 #10
0
    public void Activate()
    {
        if (_modActive)
        {
            return;
        }
        ModLogger.WriteLine("Activating Break Damage Limit");

        var assembly = new []
        {
            "nop",
            "nop",
            "nop",
            "nop",
            "mov ebx,0x7FFFFFFF"
        };

        GameMemory.Assembly.Inject(_offsetDamageLimit, assembly);

        _modActive = true;
    }
コード例 #11
0
ファイル: FFX-HardBattle.cs プロジェクト: redthefed/Farplane
    public void Update()
    {
        if (!_modActive)
        {
            return;
        }

        // Read battle pointer from memory
        var battlePointer = GameMemory.Read <IntPtr>(_offsetEnemyPointer);

        // Check if we need to reset battle
        if (battlePointer == IntPtr.Zero && changedCreature != null)
        {
            changedThisBattle = false;
            changedCreature   = null;
        }

        if (battlePointer != IntPtr.Zero && !changedThisBattle)
        {
            ModLogger.WriteLine("Battle detected, modifying enemies");
            changedCreature = new bool[8];

            // Loop until all creatures are modified or limit is hit
            var loopLimit = 2000; // maximum times to attempt modification before giving up

            while (changedCreature.Contains(false) && loopLimit > 0)
            {
                loopLimit--;
                for (int i = 0; i < 8; i++)
                {
                    if (changedCreature[i])
                    {
                        continue;                     // Enemy already modified
                    }
                    var entityData   = Battle.GetEnemyEntity(i);
                    var entityName   = StringConverter.ToString(entityData.text_name);
                    int entityOffset = (int)battlePointer + _sizeBattleEntity * i;

                    if (entityData.guid == 0) // No enemy in this slot
                    {
                        continue;
                    }

                    ModLogger.WriteLine("Modifying creature: {0}", entityName);

                    var newHP = entityData.hp_max * m_HpMpMultiplier;
                    newHP = newHP > int.MaxValue ? int.MaxValue : newHP;

                    var newMP = entityData.mp_max * m_HpMpMultiplier;
                    newMP = newMP > int.MaxValue ? int.MaxValue : newMP;

                    var newStrength = entityData.strength * m_StatMultiplier;
                    newStrength = newStrength > byte.MaxValue ? byte.MaxValue : newStrength;
                    var newDefense = entityData.defense * m_StatMultiplier;
                    newDefense = newDefense > byte.MaxValue ? byte.MaxValue : newDefense;
                    var newMagic = entityData.magic * m_StatMultiplier;
                    newMagic = newMagic > byte.MaxValue ? byte.MaxValue : newMagic;
                    var newMagicDef = entityData.magic_defense * m_StatMultiplier;
                    newMagicDef = newMagicDef > byte.MaxValue ? byte.MaxValue : newMagicDef;
                    var newAgility = entityData.agility * m_StatMultiplier;
                    newAgility = newAgility > byte.MaxValue ? byte.MaxValue : newAgility;
                    var newLuck = entityData.luck * m_StatMultiplier;
                    newLuck = newLuck > byte.MaxValue ? byte.MaxValue : newLuck;
                    var newAccuracy = entityData.accuracy * m_StatMultiplier;
                    newAccuracy = newAccuracy > byte.MaxValue ? byte.MaxValue : newAccuracy;
                    var newEvasion = entityData.evasion * m_StatMultiplier;
                    newEvasion = newEvasion > byte.MaxValue ? byte.MaxValue : newEvasion;

                    // update entity values
                    GameMemory.Write <int>(entityOffset + StructHelper.GetFieldOffset <BattleEntityData>("hp_current"),
                                           newHP, false);

                    GameMemory.Write <int>(entityOffset + StructHelper.GetFieldOffset <BattleEntityData>("hp_max"),
                                           newHP, false);

                    GameMemory.Write <int>(entityOffset + StructHelper.GetFieldOffset <BattleEntityData>("hp_max2"),
                                           newHP, false);

                    GameMemory.Write <int>(entityOffset + StructHelper.GetFieldOffset <BattleEntityData>("mp_current"),
                                           newMP, false);

                    GameMemory.Write <int>(entityOffset + StructHelper.GetFieldOffset <BattleEntityData>("mp_max"),
                                           newMP, false);

                    GameMemory.Write <int>(entityOffset + StructHelper.GetFieldOffset <BattleEntityData>("mp_max2"),
                                           newMP, false);

                    GameMemory.Write <byte>(entityOffset + StructHelper.GetFieldOffset <BattleEntityData>("strength"),
                                            (byte)newStrength, false);
                    GameMemory.Write <byte>(entityOffset + StructHelper.GetFieldOffset <BattleEntityData>("defense"),
                                            (byte)newDefense, false);
                    GameMemory.Write <byte>(entityOffset + StructHelper.GetFieldOffset <BattleEntityData>("magic"),
                                            (byte)newMagic, false);
                    GameMemory.Write <byte>(entityOffset + StructHelper.GetFieldOffset <BattleEntityData>("magic_defense"),
                                            (byte)newMagicDef, false);
                    GameMemory.Write <byte>(entityOffset + StructHelper.GetFieldOffset <BattleEntityData>("agility"),
                                            (byte)newAgility, false);
                    GameMemory.Write <byte>(entityOffset + StructHelper.GetFieldOffset <BattleEntityData>("luck"),
                                            (byte)newLuck, false);
                    GameMemory.Write <byte>(entityOffset + StructHelper.GetFieldOffset <BattleEntityData>("accuracy"),
                                            (byte)newAccuracy, false);
                    GameMemory.Write <byte>(entityOffset + StructHelper.GetFieldOffset <BattleEntityData>("evasion"),
                                            (byte)newEvasion, false);


                    changedCreature[i] = true;
                }
            }
            changedThisBattle = true;
        }
    }