Merge pull request #111 from otavepto/patch-minor-fixes

some minor fixes
This commit is contained in:
Detanup01 2024-12-07 12:47:12 +01:00 committed by GitHub
commit 9dc32d035b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 96 additions and 89 deletions

View File

@ -277,7 +277,7 @@ void SteamCallResults::runCallResults()
}
}
PRINT_DEBUG("erase to_delete");
// PRINT_DEBUG("erase to_delete");
auto c = std::begin(callresults);
while (c != std::end(callresults)) {
if (c->to_delete) {

View File

@ -491,7 +491,7 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_SetMiniDumpComment( const char *pchMsg )
// and call SteamAPI_ReleaseCurrentThreadMemory regularly on other threads.
STEAMAPI_API void S_CALLTYPE SteamAPI_RunCallbacks()
{
PRINT_DEBUG_ENTRY();
// PRINT_DEBUG_ENTRY();
get_steam_client()->RunCallbacks(true, false);
//std::this_thread::sleep_for(std::chrono::microseconds(1)); //fixes resident evil revelations lagging. (Seems to work fine without this right now, commenting out)
}
@ -575,7 +575,7 @@ STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_IsSteamRunning()
// NOT THREADSAFE - do not call from multiple threads simultaneously.
STEAMAPI_API void Steam_RunCallbacks( HSteamPipe hSteamPipe, bool bGameServerCallbacks )
{
PRINT_DEBUG_ENTRY();
// PRINT_DEBUG_ENTRY();
SteamAPI_RunCallbacks();
@ -1007,7 +1007,7 @@ STEAMAPI_API void SteamGameServer_Shutdown()
STEAMAPI_API void SteamGameServer_RunCallbacks()
{
PRINT_DEBUG_ENTRY();
// PRINT_DEBUG_ENTRY();
get_steam_client()->RunCallbacks(false, true);
}
@ -1027,7 +1027,7 @@ STEAMAPI_API ISteamClient *SteamGameServerClient()
{
PRINT_DEBUG("old");
if (!get_steam_clientserver_old()->IsServerInit()) return NULL;
return (ISteamClient *)SteamInternal_CreateInterface(old_client);
return reinterpret_cast<ISteamClient *>(SteamInternal_CreateInterface(old_client));
}
STEAMAPI_API uint32 SteamGameServer_GetIPCCallCount()
@ -1133,7 +1133,7 @@ STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_ManualDispatch_GetNextCallback( HSte
}
if (q->empty()) {
PRINT_DEBUG("error queue is empty");
//PRINT_DEBUG("error queue is empty");
return false;
}
@ -1321,13 +1321,13 @@ STEAMCLIENT_API steam_bool Steam_BGetCallback( HSteamPipe hSteamPipe, CallbackMs
STEAMCLIENT_API void Steam_FreeLastCallback( HSteamPipe hSteamPipe )
{
PRINT_DEBUG("%i", hSteamPipe);
//PRINT_DEBUG("%i", hSteamPipe);
SteamAPI_ManualDispatch_FreeLastCallback( hSteamPipe );
}
STEAMCLIENT_API steam_bool Steam_GetAPICallResult( HSteamPipe hSteamPipe, SteamAPICall_t hSteamAPICall, void* pCallback, int cubCallback, int iCallbackExpected, bool* pbFailed )
{
PRINT_DEBUG("%i %llu %i %i", hSteamPipe, hSteamAPICall, cubCallback, iCallbackExpected);
//PRINT_DEBUG("%i %llu %i %i", hSteamPipe, hSteamAPICall, cubCallback, iCallbackExpected);
return SteamAPI_ManualDispatch_GetAPICallResult(hSteamPipe, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
}
@ -1351,6 +1351,7 @@ STEAMCLIENT_API void Breakpad_SteamMiniDumpInit( uint32 a, const char *b, const
STEAMCLIENT_API void Breakpad_SteamSendMiniDump( void *a, uint32 b )
{
PRINT_DEBUG_TODO();
PRINT_DEBUG(" app is sending a crash dump! [XXXXXXXXXXXXXXXXXXXXXXXXXXX]");
}
STEAMCLIENT_API void Breakpad_SteamSetAppID( uint32 unAppID )

View File

@ -248,7 +248,7 @@ public:
// steam timeline
ISteamTimeline *GetISteamTimeline( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion );
// steam appp disable update
// steam app disable update
ISteamAppDisableUpdate *GetISteamAppDisableUpdate( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion );
// steam billing

View File

@ -76,7 +76,7 @@ private:
UGCQueryHandle_t new_ugc_query(
bool return_all_subscribed = false,
std::set<PublishedFileId_t> return_only = std::set<PublishedFileId_t>());
const std::set<PublishedFileId_t> &return_only = std::set<PublishedFileId_t>());
std::optional<Mod_entry> get_query_ugc(UGCQueryHandle_t handle, uint32 index);

View File

@ -354,7 +354,7 @@ const std::map<std::string, Stat_config>& Settings::getStats() const
std::map<std::string, Stat_config>::const_iterator Settings::setStatDefiniton(const std::string &name, const struct Stat_config &stat_config)
{
auto ins_it = stats.insert_or_assign(common_helpers::ascii_to_lowercase(name), stat_config);
auto ins_it = stats.insert_or_assign(common_helpers::to_lower(name), stat_config);
return ins_it.first;
}

View File

@ -164,7 +164,6 @@ Steam_Client::~Steam_Client()
DEL_INST(background_thread);
DEL_INST(steam_gameserver);
DEL_INST(steam_gameserver_utils);
DEL_INST(steam_gameserverstats);
DEL_INST(steam_gameserver_networking);
@ -177,6 +176,8 @@ Steam_Client::~Steam_Client()
DEL_INST(steam_gameserver_networking_messages);
DEL_INST(steam_gameserver_game_coordinator);
DEL_INST(steam_masterserver_updater);
DEL_INST(steam_gameserver);
DEL_INST(steam_gameserver_gamestats);
DEL_INST(steam_matchmaking);
DEL_INST(steam_matchmaking_servers);
@ -214,6 +215,8 @@ Steam_Client::~Steam_Client()
DEL_INST(steam_friends);
DEL_INST(steam_user);
DEL_INST(steam_overlay);
DEL_INST(steam_app_ticket);
DEL_INST(ugc_bridge);

View File

@ -221,7 +221,7 @@ Steam_Controller::Steam_Controller(class Settings *settings, class SteamCallResu
this->run_every_runcb = run_every_runcb;
set_handles(settings->controller_settings.action_sets);
disabled = !action_handles.size();
disabled = action_handles.empty();
initialized = false;
this->run_every_runcb->add(&Steam_Controller::steam_run_every_runcb, this);
@ -231,6 +231,7 @@ Steam_Controller::~Steam_Controller()
{
//TODO rm network callbacks
//TODO rumble thread
Shutdown();
this->run_every_runcb->remove(&Steam_Controller::steam_run_every_runcb, this);
}
@ -291,6 +292,7 @@ bool Steam_Controller::Shutdown()
rumble_thread_data->rumble_thread_cv.notify_one();
background_rumble_thread.join();
delete rumble_thread_data;
rumble_thread_data = nullptr;
GamepadShutdown();
initialized = false;
return true;
@ -353,10 +355,10 @@ void Steam_Controller::EnableActionEventCallbacks( SteamInputActionEventCallback
// possible latency, you call this directly before reading controller state.
void Steam_Controller::RunFrame(bool bReservedValue)
{
PRINT_DEBUG_ENTRY();
if (disabled || !initialized) {
return;
}
PRINT_DEBUG_ENTRY();
GamepadUpdate();
}
@ -573,7 +575,7 @@ int Steam_Controller::GetDigitalActionOrigins( ControllerHandle_t controllerHand
EInputActionOrigin origins[STEAM_CONTROLLER_MAX_ORIGINS];
int ret = GetDigitalActionOrigins(controllerHandle, actionSetHandle, digitalActionHandle, origins );
for (int i = 0; i < ret; ++i) {
originsOut[i] = (EControllerActionOrigin)(origins[i] - (k_EInputActionOrigin_XBox360_A - k_EControllerActionOrigin_XBox360_A));
originsOut[i] = (EControllerActionOrigin)(origins[i] - ((long)k_EInputActionOrigin_XBox360_A - (long)k_EControllerActionOrigin_XBox360_A));
}
return ret;
@ -767,7 +769,7 @@ int Steam_Controller::GetAnalogActionOrigins( ControllerHandle_t controllerHandl
EInputActionOrigin origins[STEAM_CONTROLLER_MAX_ORIGINS];
int ret = GetAnalogActionOrigins(controllerHandle, actionSetHandle, analogActionHandle, origins );
for (int i = 0; i < ret; ++i) {
originsOut[i] = (EControllerActionOrigin)(origins[i] - (k_EInputActionOrigin_XBox360_A - k_EControllerActionOrigin_XBox360_A));
originsOut[i] = (EControllerActionOrigin)(origins[i] - ((long)k_EInputActionOrigin_XBox360_A - (long)k_EControllerActionOrigin_XBox360_A));
}
return ret;

View File

@ -164,7 +164,7 @@ bool Steam_Inventory::GetResultItems( SteamInventoryResult_t resultHandle,
pOutItemsArray->m_itemId = pOutItemsArray->m_iDefinition;
try
{
pOutItemsArray->m_unQuantity = i.value().get<int>();
pOutItemsArray->m_unQuantity = i->value("quantity", static_cast<uint16>(0));
}
catch (...)
{
@ -183,7 +183,7 @@ bool Steam_Inventory::GetResultItems( SteamInventoryResult_t resultHandle,
try
{
pOutItemsArray->m_unQuantity = it->get<int>();
pOutItemsArray->m_unQuantity = it->value("quantity", static_cast<uint16>(0));
}
catch (...)
{

View File

@ -129,7 +129,7 @@ bool Steam_Matchmaking::send_owner_packet(CSteamID lobby_id, Lobby_Messages *mes
return false;
}
Common_Message msg;
Common_Message msg{};
msg.set_allocated_lobby_messages(message);
msg.set_source_id(settings->get_local_steam_id().ConvertToUint64());
msg.set_dest_id((uint64)lobby->owner());
@ -1123,7 +1123,7 @@ int Steam_Matchmaking::GetLobbyMemberLimit( CSteamID steamIDLobby )
void Steam_Matchmaking::SetLobbyVoiceEnabled( CSteamID steamIDLobby, bool bVoiceEnabled )
{
PRINT_DEBUG_ENTRY();
PRINT_DEBUG_TODO();
}
// updates which type of lobby it is

View File

@ -247,7 +247,7 @@ int Steam_Networking_Messages::ReceiveMessagesOnChannel( int nLocalChannel, Stea
}
}
PRINT_DEBUG("got %u", message_counter);
PRINT_DEBUG("got %i", message_counter);
return message_counter;
}

View File

@ -195,7 +195,7 @@ void Steam_Networking_Sockets::set_steamnetconnectioninfo(std::map<HSteamNetConn
pInfo->m_eState = convert_status(connect_socket->second.status);
pInfo->m_eEndReason = 0; //TODO
pInfo->m_szEndDebug[0] = 0;
sprintf(pInfo->m_szConnectionDescription, "%u", connect_socket->first);
snprintf(pInfo->m_szConnectionDescription, sizeof(pInfo->m_szConnectionDescription), "%u", connect_socket->first);
//Note some games might not allocate a struct the whole size of SteamNetConnectionInfo_t when calling GetConnectionInfo
//keep this in mind in future interface updates

View File

@ -476,7 +476,7 @@ SteamAPICall_t Steam_Remote_Storage::UGCDownload( UGCHandle_t hContent )
// or if the transfer hasn't started yet, so be careful to check for that before dividing to get a percentage
bool Steam_Remote_Storage::GetUGCDownloadProgress( UGCHandle_t hContent, int32 *pnBytesDownloaded, int32 *pnBytesExpected )
{
PRINT_DEBUG_ENTRY();
PRINT_DEBUG_TODO();
std::lock_guard<std::recursive_mutex> lock(global_mutex);
return false;
@ -484,7 +484,7 @@ bool Steam_Remote_Storage::GetUGCDownloadProgress( UGCHandle_t hContent, int32 *
bool Steam_Remote_Storage::GetUGCDownloadProgress( UGCHandle_t hContent, uint32 *pnBytesDownloaded, uint32 *pnBytesExpected )
{
PRINT_DEBUG("old");
PRINT_DEBUG_TODO();
std::lock_guard<std::recursive_mutex> lock(global_mutex);
return false;
@ -1030,12 +1030,14 @@ SteamAPICall_t Steam_Remote_Storage::UpdateUserPublishedItemVote( PublishedFileI
RemoteStorageUpdateUserPublishedItemVoteResult_t data{};
data.m_nPublishedFileId = unPublishedFileId;
if (settings->isModInstalled(unPublishedFileId)) {
data.m_eResult = EResult::k_EResultOK;
auto mod = settings->getMod(unPublishedFileId);
if (mod.steamIDOwner == settings->get_local_steam_id().ConvertToUint64()) {
data.m_eResult = EResult::k_EResultOK;
} else { // not published by this user
data.m_eResult = EResult::k_EResultFail; // TODO is this correct?
if (bVoteUp) {
++mod.votesUp;
} else {
++mod.votesDown;
}
settings->addModDetails(unPublishedFileId, mod);
} else { // mod not installed
data.m_eResult = EResult::k_EResultFail; // TODO is this correct?
}
@ -1058,15 +1060,11 @@ SteamAPICall_t Steam_Remote_Storage::GetUserPublishedItemVoteDetails( PublishedF
data.m_unPublishedFileId = unPublishedFileId;
if (settings->isModInstalled(unPublishedFileId)) {
auto mod = settings->getMod(unPublishedFileId);
if (mod.steamIDOwner == settings->get_local_steam_id().ConvertToUint64()) {
data.m_eResult = EResult::k_EResultOK;
data.m_fScore = mod.score;
data.m_nReports = 0; // TODO is this ok?
data.m_nVotesAgainst = mod.votesDown;
data.m_nVotesFor = mod.votesUp;
} else { // not published by this user
data.m_eResult = EResult::k_EResultFail; // TODO is this correct?
}
data.m_eResult = EResult::k_EResultOK;
data.m_fScore = mod.score;
data.m_nReports = 0; // TODO is this ok?
data.m_nVotesAgainst = mod.votesDown;
data.m_nVotesFor = mod.votesUp;
} else { // mod not installed
data.m_eResult = EResult::k_EResultFail; // TODO is this correct?
}
@ -1208,7 +1206,7 @@ SteamAPICall_t Steam_Remote_Storage::UGCDownloadToLocation( UGCHandle_t hContent
// Cloud dynamic state change notification
int32 Steam_Remote_Storage::GetLocalFileChangeCount()
{
PRINT_DEBUG("GetLocalFileChangeCount");
PRINT_DEBUG_TODO();
std::lock_guard<std::recursive_mutex> lock(global_mutex);
return 0;
@ -1216,7 +1214,7 @@ int32 Steam_Remote_Storage::GetLocalFileChangeCount()
const char* Steam_Remote_Storage::GetLocalFileChange( int iFile, ERemoteStorageLocalFileChange *pEChangeType, ERemoteStorageFilePathType *pEFilePathType )
{
PRINT_DEBUG("GetLocalFileChange");
PRINT_DEBUG_TODO();
std::lock_guard<std::recursive_mutex> lock(global_mutex);
return "";
@ -1226,7 +1224,7 @@ const char* Steam_Remote_Storage::GetLocalFileChange( int iFile, ERemoteStorageL
// operations - for example, writing a game save that requires updating two files.
bool Steam_Remote_Storage::BeginFileWriteBatch()
{
PRINT_DEBUG("BeginFileWriteBatch");
PRINT_DEBUG_ENTRY();
std::lock_guard<std::recursive_mutex> lock(global_mutex);
return true;
@ -1234,7 +1232,7 @@ bool Steam_Remote_Storage::BeginFileWriteBatch()
bool Steam_Remote_Storage::EndFileWriteBatch()
{
PRINT_DEBUG("EndFileWriteBatch");
PRINT_DEBUG_ENTRY();
std::lock_guard<std::recursive_mutex> lock(global_mutex);
return true;

View File

@ -68,6 +68,7 @@ Steam_Timeline::Steam_Timeline(class Settings *settings, class Networking *netwo
this->run_every_runcb->add(&Steam_Timeline::steam_run_every_runcb, this);
// timeline starts with a default event as seen here: https://www.youtube.com/watch?v=YwBD0E4-EsI
PRINT_DEBUG("adding an initial game mode");
SetTimelineGameMode(ETimelineGameMode::k_ETimelineGameMode_Invalid);
}
@ -166,7 +167,7 @@ TimelineEventHandle_t Steam_Timeline::AddRangeTimelineEvent( const char *pchTitl
std::lock_guard lock(timeline_mutex);
auto event_id = StartRangeTimelineEvent(pchTitle, pchDescription, pchIcon, unIconPriority, flStartOffsetSeconds, ePossibleClip);
if (!event_id || event_id > timeline_events.size()) return event_id;
if (!event_id || event_id > timeline_events.size()) return 0;
auto& my_event = timeline_events[static_cast<size_t>(event_id - 1)];
my_event.ended = true; // ranged and instantaneous events are ended/closed events, they can't be modified later according to docs

View File

@ -17,7 +17,7 @@
#include "dll/steam_ugc.h"
UGCQueryHandle_t Steam_UGC::new_ugc_query(bool return_all_subscribed, std::set<PublishedFileId_t> return_only)
UGCQueryHandle_t Steam_UGC::new_ugc_query(bool return_all_subscribed, const std::set<PublishedFileId_t> &return_only)
{
std::lock_guard<std::recursive_mutex> lock(global_mutex);
@ -29,7 +29,7 @@ UGCQueryHandle_t Steam_UGC::new_ugc_query(bool return_all_subscribed, std::set<P
query.return_all_subscribed = return_all_subscribed;
query.return_only = return_only;
ugc_queries.push_back(query);
PRINT_DEBUG("handle = %llu", query.handle);
PRINT_DEBUG("new request handle = %llu", query.handle);
return query.handle;
}
@ -295,7 +295,7 @@ UGCQueryHandle_t Steam_UGC::CreateQueryUGCDetailsRequest( PublishedFileId_t *pve
#ifndef EMU_RELEASE_BUILD
for (const auto &id : only) {
PRINT_DEBUG(" file ID = %llu", id);
PRINT_DEBUG(" requesting details for file ID = %llu", id);
}
#endif
@ -1188,9 +1188,6 @@ SteamAPICall_t Steam_UGC::SetUserItemVote( PublishedFileId_t nPublishedFileID, b
if (!settings->isModInstalled(nPublishedFileID)) return k_uAPICallInvalid; // TODO is this correct
auto mod = settings->getMod(nPublishedFileID);
SetUserItemVoteResult_t data{};
data.m_eResult = EResult::k_EResultOK;
data.m_nPublishedFileId = nPublishedFileID;
if (bVoteUp) {
++mod.votesUp;
} else {
@ -1198,6 +1195,11 @@ SteamAPICall_t Steam_UGC::SetUserItemVote( PublishedFileId_t nPublishedFileID, b
}
settings->addModDetails(nPublishedFileID, mod);
SetUserItemVoteResult_t data{};
data.m_eResult = EResult::k_EResultOK;
data.m_nPublishedFileId = nPublishedFileID;
data.m_bVoteUp = bVoteUp;
auto ret = callback_results->addCallResult(data.k_iCallback, &data, sizeof(data));
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
return ret;
@ -1285,7 +1287,7 @@ SteamAPICall_t Steam_UGC::SubscribeItem( PublishedFileId_t nPublishedFileID )
PRINT_DEBUG("%llu", nPublishedFileID);
std::lock_guard<std::recursive_mutex> lock(global_mutex);
RemoteStorageSubscribePublishedFileResult_t data;
RemoteStorageSubscribePublishedFileResult_t data{};
data.m_nPublishedFileId = nPublishedFileID;
if (settings->isModInstalled(nPublishedFileID)) {
data.m_eResult = k_EResultOK;
@ -1305,7 +1307,7 @@ SteamAPICall_t Steam_UGC::UnsubscribeItem( PublishedFileId_t nPublishedFileID )
PRINT_DEBUG("%llu", nPublishedFileID);
std::lock_guard<std::recursive_mutex> lock(global_mutex);
RemoteStorageUnsubscribePublishedFileResult_t data;
RemoteStorageUnsubscribePublishedFileResult_t data{};
data.m_nPublishedFileId = nPublishedFileID;
if (!ugc_bridge->has_subbed_mod(nPublishedFileID)) {
data.m_eResult = k_EResultFail; //TODO: check if this is accurate
@ -1348,18 +1350,20 @@ uint32 Steam_UGC::GetItemState( PublishedFileId_t nPublishedFileID )
{
PRINT_DEBUG("%llu", nPublishedFileID);
std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (ugc_bridge->has_subbed_mod(nPublishedFileID)) {
if (settings->isModInstalled(nPublishedFileID)) {
PRINT_DEBUG(" mod is subscribed and installed");
return k_EItemStateInstalled | k_EItemStateSubscribed;
}
PRINT_DEBUG(" mod is subscribed");
return k_EItemStateSubscribed;
if (!settings->isModInstalled(nPublishedFileID)) {
PRINT_DEBUG(" mod isn't found");
return k_EItemStateNone;
}
PRINT_DEBUG(" mod isn't found");
return k_EItemStateNone;
if (ugc_bridge->has_subbed_mod(nPublishedFileID)) {
PRINT_DEBUG(" mod is subscribed and installed");
return k_EItemStateInstalled | k_EItemStateSubscribed;
}
PRINT_DEBUG(" mod is not subscribed");
return k_EItemStateDisabledLocally;
}
@ -1457,7 +1461,7 @@ bool Steam_UGC::BInitWorkshopForGameServer( DepotId_t unWorkshopDepotID, const c
// SuspendDownloads( true ) will suspend all workshop downloads until SuspendDownloads( false ) is called or the game ends
void Steam_UGC::SuspendDownloads( bool bSuspend )
{
PRINT_DEBUG_ENTRY();
PRINT_DEBUG_TODO();
std::lock_guard<std::recursive_mutex> lock(global_mutex);
}

View File

@ -69,7 +69,7 @@ Steam_User_Stats::Steam_User_Stats(Settings *settings, class Networking *network
try {
trig.name = name;
trig.value_operation = static_cast<std::string const&>(it["progress"]["value"]["operation"]);
std::string stat_name = common_helpers::ascii_to_lowercase(static_cast<std::string const&>(it["progress"]["value"]["operand1"]));
std::string stat_name = common_helpers::to_lower(static_cast<std::string const&>(it["progress"]["value"]["operand1"]));
trig.min_value = static_cast<std::string const&>(it["progress"]["min_val"]);
trig.max_value = static_cast<std::string const&>(it["progress"]["max_val"]);
achievement_stat_trigger[stat_name].push_back(trig);

View File

@ -81,7 +81,7 @@ std::vector<Steam_Leaderboard_Entry> Steam_User_Stats::load_leaderboard_entries(
std::vector<Steam_Leaderboard_Entry> out{};
std::string leaderboard_name(common_helpers::ascii_to_lowercase(name));
std::string leaderboard_name(common_helpers::to_lower(name));
unsigned read_bytes = local_storage->file_size(Local_Storage::leaderboard_storage_folder, leaderboard_name);
if ((read_bytes == 0) ||
(read_bytes < (ELEMENT_SIZE * MAIN_HEADER_ELEMENTS_COUNT)) ||
@ -138,7 +138,7 @@ void Steam_User_Stats::save_my_leaderboard_entry(const Steam_Leaderboard &leader
output.push_back(detail);
}
std::string leaderboard_name(common_helpers::ascii_to_lowercase(leaderboard.name));
std::string leaderboard_name(common_helpers::to_lower(leaderboard.name));
unsigned int buffer_size = static_cast<unsigned int>(output.size() * sizeof(output[0])); // in bytes
local_storage->store_data(Local_Storage::leaderboard_storage_folder, leaderboard_name, (char* )&output[0], buffer_size);
}
@ -186,6 +186,7 @@ unsigned int Steam_User_Stats::cache_leaderboard_ifneeded(const std::string &nam
// create a new entry in-memory and try reading the entries from disk
struct Steam_Leaderboard new_board{};
// don't make this lower/upper case, appid 1372280 later calls GetLeaderboardName() and hangs if the name wasn't the same as the original
new_board.name = name;
new_board.sort_method = eLeaderboardSortMethod;
new_board.display_type = eLeaderboardDisplayType;
@ -318,12 +319,11 @@ SteamAPICall_t Steam_User_Stats::FindLeaderboard( const char *pchLeaderboardName
return ret;
}
std::string name_lower(common_helpers::ascii_to_lowercase(pchLeaderboardName));
std::string board_name(pchLeaderboardName);
const auto &settings_Leaderboards = settings->getLeaderboards();
auto it = settings_Leaderboards.begin();
for (; settings_Leaderboards.end() != it; ++it) {
if (common_helpers::str_cmp_insensitive(it->first, name_lower)) break;
}
auto it = std::find_if(settings_Leaderboards.begin(), settings_Leaderboards.end(), [&board_name](const std::pair<const std::string, Leaderboard_config> &item){
return common_helpers::str_cmp_insensitive(item.first, board_name);
});
if (settings_Leaderboards.end() != it) {
auto &config = it->second;
return FindOrCreateLeaderboard(pchLeaderboardName, config.sort_method, config.display_type);
@ -331,7 +331,7 @@ SteamAPICall_t Steam_User_Stats::FindLeaderboard( const char *pchLeaderboardName
return FindOrCreateLeaderboard(pchLeaderboardName, k_ELeaderboardSortMethodDescending, k_ELeaderboardDisplayTypeNumeric);
} else {
LeaderboardFindResult_t data{};
data.m_hSteamLeaderboard = find_cached_leaderboard(name_lower);
data.m_hSteamLeaderboard = find_cached_leaderboard(board_name);
data.m_bLeaderboardFound = !!data.m_hSteamLeaderboard;
auto ret = callback_results->addCallResult(data.k_iCallback, &data, sizeof(data));
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
@ -347,7 +347,9 @@ const char * Steam_User_Stats::GetLeaderboardName( SteamLeaderboard_t hSteamLead
std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (hSteamLeaderboard > cached_leaderboards.size() || hSteamLeaderboard <= 0) return "";
return cached_leaderboards[static_cast<unsigned>(hSteamLeaderboard - 1)].name.c_str();
auto name_ptr = cached_leaderboards[static_cast<unsigned>(hSteamLeaderboard - 1)].name.c_str();
PRINT_DEBUG(" returned '%s'", name_ptr);
return name_ptr;
}

View File

@ -28,7 +28,7 @@ bool Steam_User_Stats::clear_stats_internal()
bool notify_server = false;
for (const auto &stat : settings->getStats()) {
std::string stat_name(common_helpers::ascii_to_lowercase(stat.first));
std::string stat_name(common_helpers::to_lower(stat.first));
switch (stat.second.type)
{
@ -79,7 +79,7 @@ Steam_User_Stats::InternalSetResult<int32> Steam_User_Stats::set_stat_internal(
Steam_User_Stats::InternalSetResult<int32> result{};
if (!pchName) return result;
std::string stat_name(common_helpers::ascii_to_lowercase(pchName));
std::string stat_name(common_helpers::to_lower(pchName));
const auto &stats_config = settings->getStats();
auto stats_data = stats_config.find(stat_name);
@ -152,7 +152,7 @@ Steam_User_Stats::InternalSetResult<std::pair<GameServerStats_Messages::StatInfo
Steam_User_Stats::InternalSetResult<std::pair<GameServerStats_Messages::StatInfo::Stat_Type, float>> result{};
if (!pchName) return result;
std::string stat_name(common_helpers::ascii_to_lowercase(pchName));
std::string stat_name(common_helpers::to_lower(pchName));
const auto &stats_config = settings->getStats();
auto stats_data = stats_config.find(stat_name);
@ -226,7 +226,7 @@ Steam_User_Stats::InternalSetResult<std::pair<GameServerStats_Messages::StatInfo
Steam_User_Stats::InternalSetResult<std::pair<GameServerStats_Messages::StatInfo::Stat_Type, float>> result{};
if (!pchName) return result;
std::string stat_name(common_helpers::ascii_to_lowercase(pchName));
std::string stat_name(common_helpers::to_lower(pchName));
const auto &stats_config = settings->getStats();
auto stats_data = stats_config.find(stat_name);
@ -305,7 +305,7 @@ bool Steam_User_Stats::GetStat( const char *pchName, int32 *pData )
std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (!pchName) return false;
std::string stat_name = common_helpers::ascii_to_lowercase(pchName);
std::string stat_name = common_helpers::to_lower(pchName);
const auto &stats_config = settings->getStats();
auto stats_data = stats_config.find(stat_name);
@ -344,7 +344,7 @@ bool Steam_User_Stats::GetStat( const char *pchName, float *pData )
std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (!pchName) return false;
std::string stat_name = common_helpers::ascii_to_lowercase(pchName);
std::string stat_name = common_helpers::to_lower(pchName);
const auto &stats_config = settings->getStats();
auto stats_data = stats_config.find(stat_name);
@ -531,7 +531,7 @@ bool Steam_User_Stats::ResetAllStats( bool bAchievementsToo )
clear_stats_internal(); // this will save stats to disk if necessary
if (!settings->disable_sharing_stats_with_gameserver) {
for (const auto &stat : settings->getStats()) {
std::string stat_name(common_helpers::ascii_to_lowercase(stat.first));
std::string stat_name(common_helpers::to_lower(stat.first));
auto &new_stat = (*pending_server_updates.mutable_user_stats())[stat_name];
new_stat.set_stat_type(stat.second.type);

View File

@ -184,7 +184,7 @@ bool Steam_Utils::GetAPICallResult( SteamAPICall_t hSteamAPICall, void *pCallbac
STEAM_PRIVATE_API(
void Steam_Utils::RunFrame()
{
PRINT_DEBUG_TODO();
//PRINT_DEBUG_TODO();
std::lock_guard<std::recursive_mutex> lock(global_mutex);
// Steam_Client *client = get_steam_client();
// client ->RunCallbacks(true, false, false);

View File

@ -225,12 +225,6 @@ bool common_helpers::str_cmp_insensitive(std::wstring_view str1, std::wstring_vi
});
}
std::string common_helpers::ascii_to_lowercase(std::string data) {
std::transform(data.begin(), data.end(), data.begin(),
[](char c){ return std::tolower(c); });
return data;
}
void common_helpers::thisThreadYieldFor(std::chrono::microseconds u)
{
const auto start = std::chrono::high_resolution_clock::now();

View File

@ -71,8 +71,6 @@ std::string uint8_vector_to_hex_string(const std::vector<uint8_t> &v);
bool str_cmp_insensitive(std::string_view str1, std::string_view str2);
bool str_cmp_insensitive(std::wstring_view str1, std::wstring_view str2);
std::string ascii_to_lowercase(std::string data);
void thisThreadYieldFor(std::chrono::microseconds u);
void consume_bom(std::ifstream &input);

View File

@ -765,7 +765,7 @@ struct EquippedProfileItems_t
bool m_bHasProfileModifier;
bool m_bHasProfileBackground;
bool m_bHasMiniProfileBackground;
bool m_bFromCache;
bool m_bFromCache; // added in sdk v1.61
};
#pragma pack( pop )

View File

@ -1213,7 +1213,9 @@ STEAMAPI_API steam_bool SteamAPI_SteamNetworkingIdentity_SetXboxPairwiseID( Stea
STEAMAPI_API const char * SteamAPI_SteamNetworkingIdentity_GetXboxPairwiseID( SteamNetworkingIdentity* self );
STEAMAPI_API void SteamAPI_SteamNetworkingIdentity_SetPSNID( SteamNetworkingIdentity* self, uint64 id );
STEAMAPI_API uint64 SteamAPI_SteamNetworkingIdentity_GetPSNID( SteamNetworkingIdentity* self );
// removed since SDK v1.61
STEAMAPI_API void SteamAPI_SteamNetworkingIdentity_SetStadiaID( SteamNetworkingIdentity* self, uint64 id );
// removed since SDK v1.61
STEAMAPI_API uint64 SteamAPI_SteamNetworkingIdentity_GetStadiaID( SteamNetworkingIdentity* self );
STEAMAPI_API void SteamAPI_SteamNetworkingIdentity_SetIPAddr( SteamNetworkingIdentity* self, const SteamNetworkingIPAddr & addr );
STEAMAPI_API const SteamNetworkingIPAddr * SteamAPI_SteamNetworkingIdentity_GetIPAddr( SteamNetworkingIdentity* self );

View File

@ -1088,6 +1088,8 @@ public:
// and is preferred when the caller knows it's safe to be strict.
// Returns whether the string parsed correctly.
bool SetFromStringStrict( const char *pchSteamID, EUniverse eDefaultUniverse );
// removed in sdk 1.61
bool SetFromSteam2String( const char *pchSteam2ID, EUniverse eUniverse );
inline bool operator==( const CSteamID &val ) const { return m_steamid.m_unAll64Bits == val.m_steamid.m_unAll64Bits; }

View File

@ -341,7 +341,7 @@ struct SteamNetworkingIdentity
union {
uint64 m_steamID64;
uint64 m_PSNID;
uint64 m_stadiaID;
uint64 m_stadiaID; // removed in sdk v1.61
char m_szGenericString[ k_cchMaxGenericString ];
char m_szXboxPairwiseID[ k_cchMaxXboxPairwiseID ];
uint8 m_genericBytes[ k_cbMaxGenericBytes ];