mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2025-01-12 10:29:32 +08:00
implement Steam_Apps::GetAppData()
This commit is contained in:
parent
e492aec54b
commit
455d5f479a
@ -30,8 +30,32 @@ Steam_Apps::Steam_Apps(Settings *settings, class SteamCallResults *callback_resu
|
||||
// If you expect it to exists wait for the AppDataChanged_t after the first failure and ask again
|
||||
int Steam_Apps::GetAppData( AppId_t nAppID, const char *pchKey, char *pchValue, int cchValueMax )
|
||||
{
|
||||
//TODO
|
||||
PRINT_DEBUG_TODO();
|
||||
PRINT_DEBUG("%u, %p = ['%s'] (%i)", nAppID, pchValue, pchKey, cchValueMax);
|
||||
std::lock_guard lock(global_mutex);
|
||||
|
||||
if (common_helpers::str_cmp_insensitive("subscribed", pchKey)) {
|
||||
bool val = BIsSubscribedApp(nAppID);
|
||||
if (pchValue && cchValueMax >= 2) {
|
||||
strncpy(pchValue, val ? "1" : "0", 2);
|
||||
}
|
||||
return 2;
|
||||
} else if (common_helpers::str_cmp_insensitive("installed", pchKey)) {
|
||||
bool val = BIsAppInstalled(nAppID);
|
||||
if (pchValue && cchValueMax >= 2) {
|
||||
strncpy(pchValue, val ? "1" : "0", 2);
|
||||
}
|
||||
return 2;
|
||||
} else if (common_helpers::str_cmp_insensitive("country", pchKey)) {
|
||||
// TODO this is not exactly how real client does it, but close enough
|
||||
auto lang = GetCurrentGameLanguage();
|
||||
auto lang_lower = common_helpers::to_lower(lang && lang[0] ? lang : "--"); // "--" is an actual value the client returns
|
||||
if (pchValue && cchValueMax >= 3) {
|
||||
strncpy(pchValue, lang_lower.c_str(), 3);
|
||||
pchValue[2] = 0;
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user