コード例 #1
0
        public bool ShouldStart()
        {
            byte[] flags;

            try
            {
                if (!gameMemory.ReadFlags(out flags))
                {
                    LogToFile("ShouldStart: Couldn't read the flags");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                LogToFile("ShouldStart: Unhandled exception while reading memory: " + ex.Message);
                return(false);
            }
            bool newNewGameStarted = BitConverter.ToBoolean(flags, (int)GameEnums.Flag.NewGameStarted);
            bool shouldStart       = (newNewGameStarted && !oldNewGameStarted);

            if (newNewGameStarted != oldNewGameStarted)
            {
                LogToFile("ShouldStart: NewGameStarted was " + oldNewGameStarted + " and now " + newNewGameStarted);
            }

            oldNewGameStarted = newNewGameStarted;
            return(shouldStart);
        }
コード例 #2
0
        public bool ShouldStart()
        {
            int currentSong;

            byte[] flags;

            try
            {
                if (!gameMemory.ReadFirstMusicId(out currentSong))
                {
                    return(false);
                }
                if (!gameMemory.ReadFlags(out flags))
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }

            bool shouldStart             = false;
            bool newListeningToTitleSong = (currentSong == (int)GameEnums.Song.Title);

            if (oldListeningToTitleSong && !newListeningToTitleSong)
            {
                shouldStart = BitConverter.ToBoolean(flags, (int)GameEnums.Flag.NewGameStarted);
            }

            oldListeningToTitleSong = newListeningToTitleSong;
            return(shouldStart);
        }