MCPcopy Create free account
hub / github.com/Lovrom8/RSMods / HandleAutoLoadProfile

Function HandleAutoLoadProfile

DLL/ModManager.cpp:588–608  ·  view source on GitHub ↗

Handles automatic profile loading (AKA "Fork in the toaster" mod).

Source from the content-addressed store, hash-verified

586 /// Handles automatic profile loading (AKA "Fork in the toaster" mod).
587 /// </summary>
588 void HandleAutoLoadProfile(GameLoopState& state) {
589 if (Settings::ReturnSettingValue("ForceProfileEnabled") != "on" ||
590 GameState::Menus::IsInMenusWithDisallowedAutoEnter() ||
591 state.forkInToasterNewProfile) {
592 return;
593 }
594
595 // Skip UPlay login dialog - depending on the menu it might be necessary to press either ESC or Enter, so just spam both
596 if (GameState::currentMenu == "SelectionListDialog" ||
597 GameState::currentMenu == "UplayLoginDialog") {
598 Keyboard::SendEscapeKey();
599 Keyboard::AutoEnterGame();
600 }
601 else if (Settings::ReturnSettingValue("ProfileToLoad") != "" &&
602 GameState::currentMenu == "ProfileSelect") { // If the user user says "I want to always load this profile"
603 HandleSpecificProfileLoad(state);
604 }
605 else { // User doesn't care what profile we select, just select the first / top one.
606 Keyboard::AutoEnterGame();
607 }
608 }
609
610 /// <summary>
611 /// Loads a specific user profile by name.

Callers 1

UpdateGameLoadingStateFunction · 0.85

Calls 4

SendEscapeKeyFunction · 0.85
AutoEnterGameFunction · 0.85

Tested by

no test coverage detected