Exemplo n.º 1
0
        private void *ScrollToBottomDetour(void *a1)
        {
            try {
                var panel = (AddonChatLogPanel *)((ulong)a1 - 0x268);
                var name  = Marshal.PtrToStringAnsi(new IntPtr(panel->AtkUnitBase.Name));
                if (!string.IsNullOrEmpty(name))
                {
                    var isEnabled = name switch {
                        "ChatLogPanel_0" => !Config.DisablePanel0,
                        "ChatLogPanel_1" => !Config.DisablePanel1,
                        "ChatLogPanel_2" => !Config.DisablePanel2,
                        "ChatLogPanel_3" => !Config.DisablePanel3,
                        _ => false
                    };

                    if (isEnabled && panel->IsScrolledBottom == 0)
                    {
                        SimpleLog.Verbose($"Prevented Autoscroll in: {name}");
                        return(null);
                    }
                }
                return(scrollToBottomHook.Original(a1));
            } catch {
                return(scrollToBottomHook.Original(a1));
            }
        }
Exemplo n.º 2
0
        private void *PrintMessageDetour(RaptureLogModule *raptureLogModule, XivChatType xivChatType, IntPtr senderName, IntPtr message, uint senderId, byte param)
        {
            try {
                if (chatTypes.Contains(xivChatType))
                {
                    // Need to hook it manually to handle changing the name until API4
                    var stdSender    = StdString.ReadFromPointer(senderName);
                    var parsedSender = SeString.Parse(stdSender.RawData);

                    if (Parse(ref parsedSender))
                    {
                        stdSender.RawData = parsedSender.Encode();
                        var allocatedString = Service.LibcFunction.NewString(stdSender.RawData);
                        var retVal          = printChatHook.Original(raptureLogModule, xivChatType, allocatedString.Address, message, senderId, param);
                        allocatedString.Dispose();
                        return(retVal);
                    }
                }
            } catch (Exception ex) {
                SimpleLog.Error(ex);
            }


            return(printChatHook.Original(raptureLogModule, xivChatType, senderName, message, senderId, param));
        }
 private byte TryOnDetour(uint unknownCanEquip, uint itemBaseId, ulong stainColor, uint itemGlamourId, byte unknownByte)
 {
     if (Config.ShiftForUnglamoured && Service.KeyState[VirtualKey.SHIFT])
     {
         return(tryOnHook.Original(unknownCanEquip, itemBaseId, stainColor, 0, unknownByte));
     }
     return(tryOnHook.Original(unknownCanEquip, itemGlamourId != 0 ? itemGlamourId : itemBaseId, stainColor, 0, unknownByte));
 }
        private void *AddonExpOnUpdateDetour(AtkUnitBase *addonExp, NumberArrayData **numberArrays, StringArrayData **stringArrays, void *a4)
        {
            var ret         = addonExpOnUpdateHook.Original(addonExp, numberArrays, stringArrays, a4);
            var stringArray = stringArrays[2];

            if (stringArray == null)
            {
                goto Return;
            }
            var strPtr = stringArray->StringArray[69];

            if (strPtr == null)
            {
                goto Return;
            }

            try {
                var str = MemoryHelper.ReadSeStringNullTerminated(new IntPtr(strPtr));
                SetExperienceBarVisible(!str.TextValue.Contains("-/-"));
            } catch {
                // Ignored
            }

Return:
            return(ret);
        }
    private void *PvpCharacterOnSetup(AtkUnitBase *atkUnitBase, int a2, void *a3)
    {
        var retVal = pvpCharacterOnSetup.Original(atkUnitBase, a2, a3);

        // Slots
        MoveNode(atkUnitBase, 126, 0, -1);   // Job Stone
        MoveNode(atkUnitBase, 114, -8, 60);  // Main Weapon
        MoveNode(atkUnitBase, 116, -8, 107); // Head
        MoveNode(atkUnitBase, 117, -8, 154); // Body
        MoveNode(atkUnitBase, 119, -8, 201); // Hands
        MoveNode(atkUnitBase, 118, -8, 248); // Legs
        MoveNode(atkUnitBase, 120, -8, 295); // Feet

        // Images
        MoveNode(atkUnitBase, 112, 0, 0);   // Job Stone
        MoveNode(atkUnitBase, 102, 0, 108); // Head
        MoveNode(atkUnitBase, 103, 0, 155); // Body
        MoveNode(atkUnitBase, 104, 0, 202); // Hands
        MoveNode(atkUnitBase, 105, 0, 249); // Legs
        MoveNode(atkUnitBase, 106, 0, 296); // Feet

        // Glamour Error Icons
        MoveNode(atkUnitBase, 98, 18, 25);  // Job Stone
        MoveNode(atkUnitBase, 86, 18, 86);  // Main Hand
        MoveNode(atkUnitBase, 88, 18, 133); // Head
        MoveNode(atkUnitBase, 89, 18, 180); // Body
        MoveNode(atkUnitBase, 91, 18, 227); // Hands
        MoveNode(atkUnitBase, 90, 18, 274); // Legs
        MoveNode(atkUnitBase, 92, 18, 321); // Feet

        return(retVal);
    }
    private void *CharacterOnSetup(AtkUnitBase *atkUnitBase, int a2, void *a3)
    {
        var retVal = characterOnSetup.Original(atkUnitBase, a2, a3);

        // Slots
        MoveNode(atkUnitBase, 60, 0, -1);   // Job Stone
        MoveNode(atkUnitBase, 48, -8, 60);  // Main Weapon
        MoveNode(atkUnitBase, 50, -8, 107); // Head
        MoveNode(atkUnitBase, 51, -8, 154); // Body
        MoveNode(atkUnitBase, 53, -8, 201); // Hands
        MoveNode(atkUnitBase, 52, -8, 248); // Legs
        MoveNode(atkUnitBase, 54, -8, 295); // Feet

        // Images
        MoveNode(atkUnitBase, 46, 0, 0);
        MoveNode(atkUnitBase, 36, 0, 108); // Head
        MoveNode(atkUnitBase, 37, 0, 155); // Body
        MoveNode(atkUnitBase, 38, 0, 202); // Hands
        MoveNode(atkUnitBase, 39, 0, 249); // Legs
        MoveNode(atkUnitBase, 40, 0, 296); // Feet

        // Glamour Error Icons
        MoveNode(atkUnitBase, 32, 18, 25);  // Job Stone
        MoveNode(atkUnitBase, 20, 18, 86);  // Main Hand
        MoveNode(atkUnitBase, 22, 18, 133); // Head
        MoveNode(atkUnitBase, 23, 18, 180); // Body
        MoveNode(atkUnitBase, 25, 18, 227); // Hands
        MoveNode(atkUnitBase, 24, 18, 274); // Legs
        MoveNode(atkUnitBase, 26, 18, 321); // Feet

        return(retVal);
    }
    private byte SetOptionDetour(ConfigModule *configmodule, uint index, int value, int a4, byte a5, byte a6)
    {
        try {
            var opt = configmodule->GetOption(index);
            changes.Insert(0, new LoggedConfigChange()
            {
                Index  = index,
                Option = opt->OptionID,
                Value  = value,
                a4     = a4,
                a5     = a5,
                a6     = a6
            });

            if (changes.Count > 200)
            {
                changes.RemoveRange(200, changes.Count - 200);
            }
        } catch (Exception ex) {
            SimpleLog.Error(ex);
        }


        return(setOptionHook.Original(configmodule, index, value, a4, a5, a6));
    }
Exemplo n.º 8
0
 private void *ResetChocoTimeDetour(IntPtr a1, Int16 a2)
 {
     if (Horiz && a1 == ChocoTimeNode)
     {
         return(null);
     }
     return(resetChocotimeHook.Original(a1, a2));
 }
Exemplo n.º 9
0
 private void *ResetMemberPositionDetour(IntPtr a1, float a2)
 {
     if (Horiz && PlayerNodes.Contains(a1))   // % 40 == 0
     {
         return(null);
     }
     return(resetMemberPositionHook.Original(a1, a2));
 }
 private void *SetupDetour(void *a1, AtkUnitBase *a2, void *a3)
 {
     if (a3 == updateRetainerPointer)
     {
         var ptr = Marshal.GetFunctionPointerForDelegate(replacementUpdateRetainerDelegate);
         a3 = (void *)ptr;
     }
     return(addonSetupHook.Original(a1, a2, a3));
 }
Exemplo n.º 11
0
 private void *SetupDetour(void *a1, AtkUnitBase *a2, void *a3)
 {
     if (a3 == updateResultPointer)
     {
         SimpleLog.Verbose($"Setup UpdateResult: {(ulong) a1:X} {(ulong) a2:X} {(ulong) a3:X}");
         var ptr = Marshal.GetFunctionPointerForDelegate(replacementUpdateResultDelegate);
         a3 = (void *)ptr;
     }
     return(addonSetupHook.Original(a1, a2, a3));
 }
    private byte ExamineRefresh(AtkUnitBase *atkUnitBase, int a2, AtkValue *loadingStage)
    {
        var retVal = onExamineRefresh.Original(atkUnitBase, a2, loadingStage);

        if (loadingStage != null && a2 > 0)
        {
            if (loadingStage->UInt == 4)
            {
                ShowItemLevel();
            }
        }
        return(retVal);
    }
        private void *SetupDetour(AddonShopCardDialog *addonShopCardDialog, uint a2, void *a3)
        {
            var ret = setupHook.Original(addonShopCardDialog, a2, a3);

            if (addonShopCardDialog == null)
            {
                return(ret);
            }
            if (addonShopCardDialog->CardQuantityInput == null)
            {
                return(ret);
            }
            addonShopCardDialog->CardQuantityInput->SetValue(addonShopCardDialog->CardQuantityInput->Data.Max);
            return(ret);
        }
Exemplo n.º 14
0
 private void *ChangeSortOptionDetour(SomeAgent *agent, int sortOption)
 {
     try {
         if (agent->SomeInt != 0)
         {
             sortOption = Config.SelectedOption;
         }
         else
         {
             Config.SelectedOption = sortOption;
             PluginConfig.Save();
         }
     } catch {
         //
     }
     return(changeSortOptionHook.Original(agent, sortOption));
 }
    private byte ActionBarBaseUpdateDetour(AddonActionBarBase *addonActionBarBase, NumberArrayData **numberArrayData, StringArrayData **stringArrayData)
    {
        var changesFound = false;

        var hotbarID = addonActionBarBase->HotbarID;

        if (hotbarID < allActionBars.Length)
        {
            changesFound  = UpdateHotbarRecordedControlHints(addonActionBarBase, stringArrayData[StrDataIndex]);
            changesFound |= UpdateHotbarCommands(addonActionBarBase);
        }

        var ret = actionBarBaseUpdateHook.Original(addonActionBarBase, numberArrayData, stringArrayData);

        if (changesFound)
        {
            FillControlHints();
        }
        return(ret);
    }
Exemplo n.º 16
0
        private void *InspectOnSetup(AtkUnitBase *atkUnitBase, int a2, void *a3)
        {
            var retVal = inspectOnSetup.Original(atkUnitBase, a2, a3);

            // Slots
            MoveNode(atkUnitBase, 47, 0, -120);   // Job Stone
            MoveNode(atkUnitBase, 12, 9, 125);    // Main Weapon
            MoveNode(atkUnitBase, 37, 0, 46 * 1); // Head
            MoveNode(atkUnitBase, 38, 0, 46 * 2); // Body
            MoveNode(atkUnitBase, 39, 0, 46 * 3); // Hands
            MoveNode(atkUnitBase, 40, 0, 46 * 4); // Legs
            MoveNode(atkUnitBase, 41, 0, 46 * 5); // Feet

            // Images
            MoveNode(atkUnitBase, 60, 0, -120);   // Job Stone
            MoveNode(atkUnitBase, 13, 15, 130);   // Main Weapon
            MoveNode(atkUnitBase, 50, 0, 46 * 1); // Head
            MoveNode(atkUnitBase, 51, 0, 46 * 2); // Body
            MoveNode(atkUnitBase, 52, 0, 46 * 3); // Hands
            MoveNode(atkUnitBase, 53, 0, 46 * 4); // Legs
            MoveNode(atkUnitBase, 54, 0, 46 * 5); // Feet

            return(retVal);
        }
    private void *MoveAddonDetour(RaptureAtkModule *atkModule, AtkUnitBase *addon, void *idk)
    {
        var name = Marshal.PtrToStringUTF8(new IntPtr(addon->Name));

        return(Config.LockedWindows.Contains(name) ? null : moveAddonHook.Original(atkModule, addon, idk));
    }
 private int GetSpecialModeDetour(void *unused, byte specialModeType)
 {
     return(specialModeType == 2 ? 4 : getSpecialModeHook.Original(unused, specialModeType));
 }