1
0
Fork 0
mirror of https://github.com/Detanup01/gbe_fork.git synced 2025-03-28 14:56:24 +01:00

Merge pull request #114 from otavepto/patch-implement-functions

implement some functions
This commit is contained in:
Detanup01 2024-12-07 12:56:23 +01:00 committed by GitHub
commit e02cc9b366
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 83 additions and 7 deletions

View file

@ -1384,8 +1384,24 @@ STEAMCLIENT_API steam_bool Steam_BConnected( HSteamUser hUser, HSteamPipe hSteam
STEAMCLIENT_API steam_bool Steam_BLoggedOn( HSteamUser hUser, HSteamPipe hSteamPipe )
{
PRINT_DEBUG_ENTRY();
return true;
PRINT_DEBUG("%i %i", hUser, hSteamPipe);
Steam_Client *steam_client = get_steam_client();
auto pipe_it = steam_client->steam_pipes.find(hSteamPipe);
if (steam_client->steam_pipes.end() == pipe_it) {
return false;
}
class Settings *settings_tmp{};
if (pipe_it->second == Steam_Pipe::SERVER) {
settings_tmp = steam_client->settings_server;
} else if (pipe_it->second == Steam_Pipe::CLIENT) {
settings_tmp = steam_client->settings_client;
} else {
return false;
}
return !settings_tmp->is_offline();
}
STEAMCLIENT_API steam_bool Steam_BReleaseSteamPipe( HSteamPipe hSteamPipe )

View file

@ -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 country = settings->ip_country.c_str();
auto country_lower = common_helpers::to_lower(country && country[0] ? country : "--"); // "--" is an actual value the client returns
if (pchValue && cchValueMax >= 3) {
strncpy(pchValue, country_lower.c_str(), 3);
pchValue[2] = 0;
}
return 3;
}
return 0;
}

View file

@ -1440,10 +1440,37 @@ bool Steam_UGC::GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *
// If bHighPriority is set, any other item download will be suspended and this item downloaded ASAP.
bool Steam_UGC::DownloadItem( PublishedFileId_t nPublishedFileID, bool bHighPriority )
{
PRINT_DEBUG_ENTRY();
PRINT_DEBUG("%llu %i // TODO", nPublishedFileID, (int)bHighPriority);
std::lock_guard<std::recursive_mutex> lock(global_mutex);
return false;
if (!settings->isModInstalled(nPublishedFileID)) {
DownloadItemResult_t data_fail{};
data_fail.m_eResult = EResult::k_EResultFail;
data_fail.m_nPublishedFileId = nPublishedFileID;
data_fail.m_unAppID = settings->get_local_game_id().AppID();
callbacks->addCBResult(data_fail.k_iCallback, &data_fail, sizeof(data_fail), 0.050);
return false;
}
{
DownloadItemResult_t data{};
data.m_eResult = EResult::k_EResultOK;
data.m_nPublishedFileId = nPublishedFileID;
data.m_unAppID = settings->get_local_game_id().AppID();
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data), 0.1);
}
{
ItemInstalled_t data{};
data.m_hLegacyContent = nPublishedFileID;
data.m_nPublishedFileId = nPublishedFileID;
data.m_unAppID = settings->get_local_game_id().AppID();
data.m_unManifestID = 123; // TODO
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data), 0.15);
}
PRINT_DEBUG("downloaded!");
return true;
}
@ -1596,8 +1623,17 @@ SteamAPICall_t Steam_UGC::GetWorkshopEULAStatus()
{
PRINT_DEBUG_TODO();
std::lock_guard<std::recursive_mutex> lock(global_mutex);
WorkshopEULAStatus_t data{};
data.m_eResult = k_EResultOK;
data.m_nAppID = settings->get_local_game_id().AppID();
data.m_unVersion = 0; // TODO
data.m_rtAction = (RTime32)std::chrono::duration_cast<std::chrono::seconds>(startup_time.time_since_epoch()).count();
data.m_bAccepted = true;
data.m_bNeedsAction = false;
return k_uAPICallInvalid;
auto ret = callback_results->addCallResult(data.k_iCallback, &data, sizeof(data));
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
return ret;
}
// Return the user's community content descriptor preferences