This repository has been archived by the owner on Oct 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Steam/Epic Achievements Unlock (#468)
* Steam/Epic Achievements Unlock * cleaning
- Loading branch information
Showing
10 changed files
with
177 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include "pch-il2cpp.h" | ||
#include "utility.h" | ||
#include "achievements.hpp" | ||
#include "logger.h" | ||
|
||
namespace Achievements { | ||
|
||
_Ret_maybenull_ AchievementManager_1* GetAchievementManager() { | ||
static AchievementManager_1* manager = nullptr; | ||
if (!manager) { | ||
static AccountManager* accountManager = nullptr; | ||
if (!accountManager) { | ||
Type* AccountManagerType = app::Type_GetType(convert_to_string(translate_type_name("AccountManager, Assembly-CSharp")), NULL); | ||
LOG_ASSERT(AccountManagerType != nullptr); | ||
il2cpp::Array results = app::Object_1_FindObjectsOfType(AccountManagerType, NULL); | ||
if (results.size() == 0) | ||
return nullptr; | ||
accountManager = reinterpret_cast<AccountManager*>(results[0]); | ||
} | ||
|
||
if (accountManager->fields.prevLoggedInStatus == EOSManager_AccountLoginStatus__Enum::Offline) | ||
return nullptr; | ||
|
||
Type* AchievementManagerType = app::Type_GetType(convert_to_string(translate_type_name("AchievementManager, Assembly-CSharp")), NULL); | ||
LOG_ASSERT(AchievementManagerType != nullptr); | ||
il2cpp::Array results = app::Object_1_FindObjectsOfType(AchievementManagerType, NULL); | ||
if (results.size() == 0) | ||
return nullptr; | ||
manager = reinterpret_cast<AchievementManager_1*>(results[0]); | ||
} | ||
return manager; | ||
} | ||
|
||
bool IsSupported() { | ||
return GetAchievementManager() != nullptr; | ||
} | ||
|
||
void UnlockAll() { | ||
auto manager = GetAchievementManager(); | ||
if (!manager) return; | ||
|
||
ScopedThreadAttacher managedThreadAttached; | ||
il2cpp::Dictionary achievementGameModeKey = manager->klass->static_fields->AchievementGameModeKey; | ||
for (auto pair : achievementGameModeKey) { | ||
il2cpp::List list = pair.value; | ||
if (!list.contains(app::GameModes__Enum::Normal)) { | ||
list.add(app::GameModes__Enum::Normal); | ||
} | ||
if (!list.contains(app::GameModes__Enum::HideNSeek)) { | ||
list.add(app::GameModes__Enum::HideNSeek); | ||
} | ||
app::AchievementManager_1_UnlockAchievement(manager, pair.key, nullptr); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,5 @@ | ||
#pragma once | ||
#include <vector> | ||
|
||
std::vector<const char*> steamAchievements = { | ||
"task_complete_easy", | ||
"task_complete_medium", | ||
"task_complete_hard", | ||
"card_first_try", | ||
"kill_during_lights", | ||
"no_vents_impostor_win", | ||
"kills_first", | ||
"kills_easy", | ||
"kills_medium", | ||
"kills_hard", | ||
"wins_skeld", | ||
"wins_mira", | ||
"wins_polus", | ||
"wins_airship", | ||
"survive_two_impostors", | ||
"win_all_tasks", | ||
"win_sabotage", | ||
"win_kills", | ||
"win_impostor_vote", | ||
"survive_crewmate", | ||
"die_during_medscan", | ||
"fix_own_sabotage", | ||
"three_kills_before_meeting", | ||
"win_always_correct_votes", | ||
"impostorKills", | ||
"tasksCompleted", | ||
"MapWinsSkeld", | ||
"MapWinsPolus", | ||
"MapWinsMira", | ||
"MapWinsAirship" | ||
}; | ||
namespace Achievements { | ||
bool IsSupported(); | ||
void UnlockAll(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters