Exemple #1
0
        protected override void Update(GameTime gameTime)
        {
            time.Update(gameTime);
            display.Update(time);

            //check minecraft version
            GameVersionDetector.Update();

            AdvancementTracker.Update(time);
            StatisticsTracker.Update(time);
            AchievementTracker.Update(time);

            //update each screen
            mainScreen.UpdateRecursive(time);
            foreach (var screen in altScreens.Values)
            {
                screen.UpdateRecursive(time);
            }

            //update notes screen
            if (NotesSettings.Instance.Enabled)
            {
                if (notesWindow == null || notesWindow.IsDisposed)
                {
                    notesWindow = new FNotes();
                    notesWindow.Show();
                }
                else if (TrackerSettings.IsPostExplorationUpdate)
                {
                    notesWindow.UpdateCurrentSave(AdvancementTracker.CurrentSaveName);
                }
                else
                {
                    notesWindow.UpdateCurrentSave(AchievementTracker.CurrentSaveName);
                }
            }
            else if (notesWindow != null && !notesWindow.IsDisposed)
            {
                notesWindow.Close();
            }

            TrackerSettings.Instance.Update();
            MainSettings.Instance.Update();
            OverlaySettings.Instance.Update();
            SpriteSheet.Update(time);

            base.Update(gameTime);
        }
Exemple #2
0
        } // thread

        public void detectGame()
        {
            while (true)
            {
                versionList.Clear();
                Process processIII = Process.GetProcessesByName("gta3").FirstOrDefault();
                Process processVC  = Process.GetProcessesByName("gta-vc").FirstOrDefault();
                Process processSA1 = Process.GetProcessesByName("gta_sa").FirstOrDefault();
                Process processSA2 = Process.GetProcessesByName("gta-sa").FirstOrDefault();

                GameVersion gtaiiiVersion = new GameVersion(processIII, GameVersionDetector.getGameInformation(processIII), iiiFirstMissionMemAddress);
                versionList.Add(gtaiiiVersion);
                GameVersion gtavcVersion = new GameVersion(processVC, GameVersionDetector.getGameInformation(processVC), vcFirstMissionMemAddress);
                versionList.Add(gtavcVersion);
                GameVersion gtasa1Version = new GameVersion(processSA1, GameVersionDetector.getGameInformation(processSA1), sa1FirstMissionMemAddress);
                versionList.Add(gtasa1Version);
                GameVersion gtasa2Version = new GameVersion(processSA2, GameVersionDetector.getGameInformation(processSA2), sa2FirstMissionMemAddress);
                versionList.Add(gtasa2Version);
                GameVersion gtasa3Version = new GameVersion(processSA1, GameVersionDetector.getGameInformation(processSA1), sa3FirstMissionMemAddress);
                versionList.Add(gtasa1Version);

                GameVersion cg = new GameVersion();

                if (firstLaunch && IsHandleCreated)
                {
                    foreach (var game in versionList)
                    {
                        if (GameVersionDetector.isProcessActive(game.Process))
                        {
                            status = "Please restart the game (recommended), or click 'OK' if you want to continue anyway.";
                            possibleLaunchIssue = true;
                            cg = game;
                            this.Invoke((MethodInvoker) delegate
                            {
                                btnOk.Visible = true;
                            });
                            break;
                        }
                    }
                }


                foreach (var game in versionList)                                                            // loops through each game
                {
                    if (gvd.DetectCurrentVersion(game) && GameVersionDetector.isProcessActive(game.Process)) // if the game is running
                    {
                        gameDetected = true;                                                                 // if the code gets to this point, this means the game has been detected.

                        currentGame = game.GameName;

                        if (gameDetected && path == "") // if the game is detected, but the path is still empty, then prompt the user to select a path before starting the game (safety feature)
                        {
                            status      = "Please close the game and try choosing a path first!";
                            isReordered = false;
                        }
                        else if (gameDetected && path != "" && checkReset && !possibleLaunchIssue)                           // if the game is detected, a (valid) path was entered, and the songs need to be checked for a reset
                        {
                            if (Memory.GetMemoryResult(game.Process, game.MemAddress + game.Offset, 4) == 0 && !isReordered) // if the memaddress (first mission) is 0 (not done), and the songs have not been ordered
                            {
                                isReordered           = true;
                                hasReorderingFinished = false; // this boolean is being changed in Rename thread

                                try
                                {
                                    if (!threadRename.IsAlive && path != "") // if thread is not running, and path is not empty
                                    {
                                        threadRename.Start();                // start the 'rename'-thread
                                    }
                                }

                                catch (Exception)
                                {
                                    Console.WriteLine("Thread RENAME is already running!!");
                                }


                                if (hasReorderingFinished)
                                {
                                    if (elapsedTime > 999)
                                    {
                                        seconds = Convert.ToInt32(elapsedTime / 1000);
                                        status  = "Finished in " + seconds + " seconds!\r\nSongs don't need another reset right now.";
                                    }
                                    else
                                    {
                                        status = "Finished in " + elapsedTime + " ms!\r\nSongs don't need another reset right now.";
                                    }
                                }


                                //  hasResetFinished = true;
                                // }
                            }
                            else if (Memory.GetMemoryResult(game.Process, game.MemAddress + game.Offset, 4) == 1 && checkReset) // if the memaddress (first mission) is 1 (done), and the songs should be checked for a reset
                            {
                                if (hasReorderingFinished && gameDetected && path != "" && !loadingError)                       // if reodering is (still) finished, game is detected, path is valid and no errors were found
                                {
                                    status = "Waiting for another reset...";                                                    // just let the user know
                                }

                                isReordered = false;
                            }
                            else if (Memory.GetMemoryResult(game.Process, game.MemAddress + game.Offset, 4) == 0) // if the memaddress (first mission) is 0 (not done)
                            {
                                if (hasReorderingFinished && gameDetected && !loadingError)                       // if reordering is finished, game is detected, and no loading errors
                                {
                                    if (elapsedTime > 999)
                                    {
                                        seconds = Convert.ToInt32(elapsedTime / 1000);
                                        status  = "Finished in " + seconds + " seconds!\r\nSongs don't need another reset right now.";
                                    }
                                    else
                                    {
                                        status = "Finished in " + elapsedTime + " ms!\r\nSongs don't need another reset right now.";
                                    }
                                }
                            }
                            else
                            {
                            }
                            //  hasResetFinished = true;
                        }
                        break; // no need to check for any remaining games in the loop
                    }
                    else // if the game is not running
                    {
                        if (firstLaunch && checkReset)
                        {
                            if (!GameVersionDetector.isProcessActive(cg.Process) && IsHandleCreated)
                            {
                                firstLaunch         = false;
                                possibleLaunchIssue = false;
                                this.Invoke((MethodInvoker) delegate
                                {
                                    btnOk.Visible = false;
                                });
                            }
                        }
                        if (checkReset)                                        // if the game should be checked
                        {
                            currentGame = "Game is not supported or running!"; // let the user know
                        }

                        if (path == "" && hasReorderingFinished)                                        // if path is empty
                        {
                            status = "Please select a path to your MP3 player using the button above."; // tell the user to select a path
                            if (!checkReset)                                                            // if reset should not be checked
                            {
                                currentGame = "Not checking current game.";                             // let the user know
                            }
                            // hasResetFinished = false;
                        }
                        else if (!checkReset && !loadingError) // if reset should not be checked, and no errors occured
                        {
                            if (elapsedTime > 999)
                            {
                                seconds = Convert.ToInt32(elapsedTime / 1000);
                                status  = "Finished in " + seconds + " seconds!\r\nThe auto-reset feature is disabled.\r\n Use the 'Quick settings' instead.";
                            }
                            else
                            {
                                status = "Finished in " + elapsedTime + " ms!\r\nThe auto-reset feature is disabled.\r\n Use the 'Quick settings' instead."; // let the user know
                            }
                            this.Invoke((MethodInvoker) delegate
                            {
                                enableButtons();
                            });
                        }

                        if (hasReorderingFinished && path != "" && checkReset && !loadingError && !possibleLaunchIssue && !gameDetected) // if reodering is finished, path is valid, resets should be checked, and no errors occured
                        {
                            if (elapsedTime > 999)
                            {
                                seconds = Convert.ToInt32(elapsedTime / 1000);
                                status  = "Finished in " + seconds + " seconds!\r\n Please launch a supported GTA game."; // let the user know
                            }
                            else
                            {
                                status = "Finished in " + elapsedTime + " ms!\r\n Please launch a supported GTA game."; // let the user know
                            }

                            // hasResetFinished = false;
                        }


                        gameDetected = false;
                        // hasResetFinished = false;
                    }
                }

                try
                {
                    if (!gameDetected) // if game is not detected
                    {
                        /*  if (hasReorderingFinished)
                         * {
                         *    status = "Finished!\r\nPlease launch a supported GTA game.";
                         * }*/
                        this.Invoke((MethodInvoker) delegate
                        {
                            enableButtons();  // enable all buttons
                        });
                    }
                }
                catch (Exception)
                { }

                Thread.Sleep(1220);
            }
        }