Skip to content

Commit

Permalink
Merge pull request #111 from otavepto/patch-minor-fixes
Browse files Browse the repository at this point in the history
some minor fixes
  • Loading branch information
Detanup01 authored Dec 7, 2024
2 parents a07d5e2 + 49a9cfa commit 9dc32d0
Show file tree
Hide file tree
Showing 24 changed files with 95 additions and 88 deletions.
2 changes: 1 addition & 1 deletion dll/callsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
15 changes: 8 additions & 7 deletions dll/dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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);
}

Expand All @@ -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()
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
}

Expand All @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion dll/dll/steam_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public ISteamClient
// 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
Expand Down
2 changes: 1 addition & 1 deletion dll/dll/steam_ugc.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public ISteamUGC

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);

Expand Down
2 changes: 1 addition & 1 deletion dll/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
5 changes: 4 additions & 1 deletion dll/steam_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);

Expand Down
10 changes: 6 additions & 4 deletions dll/steam_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions dll/steam_inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 (...)
{
Expand All @@ -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 (...)
{
Expand Down
4 changes: 2 additions & 2 deletions dll/steam_matchmaking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dll/steam_networking_messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion dll/steam_networking_sockets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 17 additions & 19 deletions dll/steam_remote_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,15 +476,15 @@ 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;
}

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;
Expand Down Expand Up @@ -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?
}
Expand All @@ -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?
}
Expand Down Expand Up @@ -1208,15 +1206,15 @@ 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;
}

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 "";
Expand All @@ -1226,15 +1224,15 @@ 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;
}

bool Steam_Remote_Storage::EndFileWriteBatch()
{
PRINT_DEBUG("EndFileWriteBatch");
PRINT_DEBUG_ENTRY();
std::lock_guard<std::recursive_mutex> lock(global_mutex);

return true;
Expand Down
3 changes: 2 additions & 1 deletion dll/steam_timeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 9dc32d0

Please sign in to comment.