Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dll/dll/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ struct Overlay_Appearance {
uint32 notification_duration_chat = 4000; // sliding animation duration duration (millisec)

std::string ach_unlock_datetime_format = "%Y/%m/%d - %H:%M:%S";
bool show_notification_history = false;
bool show_achievement_list = false;
bool unlocked_expanded = true;
bool locked_expanded = false;

float background_r = 0.12f;
float background_g = 0.11f;
Expand Down
4 changes: 4 additions & 0 deletions dll/dll/steam_user_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ public ISteamUserStats
// - "hidden" for retrieving if an achievement is hidden (returns "0" when not hidden, "1" when hidden)
const char * GetAchievementDisplayAttribute( const char *pchName, const char *pchKey );

// Returns the global unlock percentage for an achievement from achievements.json,
// or -1.0 if the field is not present.
double GetAchievementUnlockPercentage( const char *pchName );


// Achievement progress - triggers an AchievementProgress callback, that is all.
// Calling this w/ N out of N progress will NOT set the achievement, the game must still do that.
Expand Down
16 changes: 16 additions & 0 deletions dll/settings_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,22 @@ static void load_overlay_appearance(class Settings *settings_client, class Setti
} else if (name.compare("Achievement_Unlock_Datetime_Format") == 0) {
settings_client->overlay_appearance.ach_unlock_datetime_format = value;
settings_server->overlay_appearance.ach_unlock_datetime_format = value;
} else if (name.compare("Show_Notification_History") == 0) {
bool show = (std::stol(value, NULL) != 0);
settings_client->overlay_appearance.show_notification_history = show;
settings_server->overlay_appearance.show_notification_history = show;
} else if (name.compare("Show_Achievement_List") == 0) {
bool show = (std::stol(value, NULL) != 0);
settings_client->overlay_appearance.show_achievement_list = show;
settings_server->overlay_appearance.show_achievement_list = show;
} else if (name.compare("Unlocked_Expanded") == 0) {
bool expand = (std::stol(value, NULL) != 0);
settings_client->overlay_appearance.unlocked_expanded = expand;
settings_server->overlay_appearance.unlocked_expanded = expand;
} else if (name.compare("Locked_Expanded") == 0) {
bool expand = (std::stol(value, NULL) != 0);
settings_client->overlay_appearance.locked_expanded = expand;
settings_server->overlay_appearance.locked_expanded = expand;
} else if (name.compare("Achievement_Notification_Delay") == 0) {
float delay_sec = std::stof(value, NULL);
settings_client->achievement_notification_delay_ms = static_cast<int>(delay_sec * 1000.0f);
Expand Down
19 changes: 19 additions & 0 deletions dll/steam_user_stats_achievements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,25 @@ const char * Steam_User_Stats::GetAchievementDisplayAttribute( const char *pchNa
}


// Returns the global unlock percentage for an achievement from achievements.json,
// or -1.0 if the field is not present.
double Steam_User_Stats::GetAchievementUnlockPercentage( const char *pchName )
{
std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (!pchName || !pchName[0]) return -1.0;

auto it = defined_achievements.end();
try {
it = defined_achievements_find(pchName);
} catch(...) { }
if (defined_achievements.end() == it) return -1.0;

try {
return it->value("unlock_percentage", -1.0);
} catch(...) { return -1.0; }
}


// Achievement progress - triggers an AchievementProgress callback, that is all.
// Calling this w/ N out of N progress will NOT set the achievement, the game must still do that.
bool Steam_User_Stats::IndicateAchievementProgress( const char *pchName, uint32 nCurProgress, uint32 nMaxProgress )
Expand Down
1 change: 1 addition & 0 deletions overlay_experimental/overlay/steam_overlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ struct Overlay_Achievement
bool hidden{};
bool achieved{};
uint32 unlock_time{};
float unlock_percentage = -1.0f; // from achievements.json, -1 = unknown
InGameOverlay::RendererResource_t* icon{};
InGameOverlay::RendererResource_t* icon_gray{};
int icon_handle = Settings::UNLOADED_IMAGE_HANDLE;
Expand Down
190 changes: 184 additions & 6 deletions overlay_experimental/steam_overlay.cpp

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions post_build/README.release.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ Just look for "online json validator" on your web brower to valide your file.

You can use https://steamdb.info/ to list items and attributes they have and put them into your .json, you can also use the command line tool `generate_emu_config`.

In `achievements.json`, each achievement can optionally include an `unlock_percentage` field (0.0–100.0) with the global unlock rate for that achievement.
When present, the overlay displays it next to the achievement in the achievement list.
You can find achievement unlock percentages on SteamDB by checking a game's global achievement stats page (e.g. `https://steamdb.info/app/<appid>/stats/`).

Keep in mind that some item are not valid to have in your inventory.
---
For example, in PayDay2 all items below `item_id` `50000` will make your game crash.
Expand Down
16 changes: 16 additions & 0 deletions post_build/steam_settings.EXAMPLE/configs.overlay.EXAMPLE.ini
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,22 @@ Achievement_Notification_Delay=0
# default=%Y/%m/%d - %H:%M:%S
Achievement_Unlock_Datetime_Format=%Y/%m/%d - %H:%M:%S

# 1=show the notification history panel when the overlay opens
# default=0
Show_Notification_History=0

# 1=show the achievement list window when the overlay opens
# default=0
Show_Achievement_List=0

# 1=expand the unlocked achievements section by default
# default=1
Unlocked_Expanded=1

# 1=expand the locked achievements section by default
# default=0
Locked_Expanded=0

# main background when you press shift+tab
Background_R=0.12
Background_G=0.11
Expand Down