Пример #1
0
        public bool ProcessHook()
        {
            Process proc = Process.GetProcessesByName(ProcessName).FirstOrDefault();

            // Already hooked
            if (BfGameProcess != null && proc != null)
            {
                return(true);
            }
            // Already unhooked
            if (BfGameProcess == null && proc == null)
            {
                return(false);
            }

            // New hook
            if (BfGameProcess == null && proc != null)
            {
                currentBfVersion = DetermineCurrentGameVersion();
                InitVersionSpecificVariables();
                InitDeepPointers();
                BfGameProcess = proc;
                return(true);
            }

            // New Unhook
            if (BfGameProcess != null && proc == null)
            {
                ResetEverything();
            }

            return(false);
        }
Пример #2
0
        private void ResetEverything()
        {
            BfGameProcess           = null;
            currentBfVersion        = BfVersion.UNASSIGNED;
            baseAddrMainManagerPath = 0;
            offsetPathPrefixMainManagerStatic.Clear();

            DPMainManagerMusicCoroutine  = null;
            DPMainManagerCurrentRoomName = null;
            DPMainManagerFlags           = null;
            DPMainManagerFirstMusicId    = null;
            DPMainManagerBattle          = null;
            DPMainManagerBattlePtr       = null;
            DPMainManagerEnemyEncounter  = null;
            numFlags = -1;
        }