Example #1
0
        public GameUtils(DalamudPluginInterface pluginInterface)
        {
            var scanner = pluginInterface.TargetModuleScanner;

            var loadPlayerResourcesAddress =
                scanner.ScanText(
                    "E8 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? BA ?? ?? ?? ?? 41 B8 ?? ?? ?? ?? 48 8B 48 30 48 8B 01 FF 50 10 48 85 C0 74 0A ");
            var unloadPlayerResourcesAddress =
                scanner.ScanText("41 55 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 84 24 ?? ?? ?? ?? 4C 8B E9 48 83 C1 08");

            _playerResourceManagerAddress = scanner.GetStaticAddressFromSig("0F 44 FE 48 8B 0D ?? ?? ?? ?? 48 85 C9 74 05");

            LoadPlayerResources   = Marshal.GetDelegateForFunctionPointer <LoadPlayerResourcesPrototype>(loadPlayerResourcesAddress);
            UnloadPlayerResources = Marshal.GetDelegateForFunctionPointer <UnloadPlayerResourcesPrototype>(unloadPlayerResourcesAddress);
        }
Example #2
0
        public unsafe void Init()
        {
            var scanner = Plugin.PluginInterface.TargetModuleScanner;

            var readFileAddress =
                scanner.ScanText("E8 ?? ?? ?? ?? 84 C0 0F 84 ?? 00 00 00 4C 8B C3 BA 05");

            var readSqpackAddress =
                scanner.ScanText("E8 ?? ?? ?? ?? EB 05 E8 ?? ?? ?? ?? 84 C0 0F 84 ?? 00 00 00 4C 8B C3");

            var getResourceSyncAddress =
                scanner.ScanText("E8 ?? ?? 00 00 48 8D 4F ?? 48 89 87 ?? ?? 00 00");

            var getResourceAsyncAddress =
                scanner.ScanText("E8 ?? ?? ?? 00 48 8B D8 EB ?? F0 FF 83 ?? ?? 00 00");


            ReadSqpackHook       = new Hook <ReadSqpackPrototype>(readSqpackAddress, new ReadSqpackPrototype(ReadSqpackHandler));
            GetResourceSyncHook  = new Hook <GetResourceSyncPrototype>(getResourceSyncAddress, new GetResourceSyncPrototype(GetResourceSyncHandler));
            GetResourceAsyncHook = new Hook <GetResourceAsyncPrototype>(getResourceAsyncAddress, new GetResourceAsyncPrototype(GetResourceAsyncHandler));

            ReadFile = Marshal.GetDelegateForFunctionPointer <ReadFilePrototype>(readFileAddress);

            /////

            var loadPlayerResourcesAddress =
                scanner.ScanText(
                    "E8 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? BA ?? ?? ?? ?? 41 B8 ?? ?? ?? ?? 48 8B 48 30 48 8B 01 FF 50 10 48 85 C0 74 0A ");
            var unloadPlayerResourcesAddress =
                scanner.ScanText("41 55 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 84 24 ?? ?? ?? ?? 4C 8B E9 48 83 C1 08");

            _playerResourceManagerAddress = scanner.GetStaticAddressFromSig("0F 44 FE 48 8B 0D ?? ?? ?? ?? 48 85 C9 74 05");

            LoadPlayerResources   = Marshal.GetDelegateForFunctionPointer <LoadPlayerResourcesPrototype>(loadPlayerResourcesAddress);
            UnloadPlayerResources = Marshal.GetDelegateForFunctionPointer <UnloadPlayerResourcesPrototype>(unloadPlayerResourcesAddress);
            ReadFile = Marshal.GetDelegateForFunctionPointer <ReadFilePrototype>(readFileAddress);
        }