gbe_fork/dll/ugc_remote_storage_bridge.cpp
otavepto 0d1e54e9a2 * a working impl to bridge ugc/remote_storage as suggested by Detanup01
* edits by Kola124 + other changes in the settings parser

* random ugc mod handle at object creation

* file size using std::filesystem + fix warnings + some print + arg validation
2024-01-20 18:46:43 +02:00

34 lines
1009 B
C++

#include "dll/ugc_remote_storage_bridge.h"
void Ugc_Remote_Storage_Bridge::add_ugc_query_result(UGCHandle_t file_handle, PublishedFileId_t fileid, bool handle_of_primary_file)
{
std::lock_guard lock(global_mutex);
steam_ugc_queries[file_handle].mod_id = fileid;
steam_ugc_queries[file_handle].is_primary_file = handle_of_primary_file;
}
bool Ugc_Remote_Storage_Bridge::remove_ugc_query_result(UGCHandle_t file_handle)
{
std::lock_guard lock(global_mutex);
return !!steam_ugc_queries.erase(file_handle);
}
std::optional<Ugc_Remote_Storage_Bridge::QueryInfo> Ugc_Remote_Storage_Bridge::get_ugc_query_result(UGCHandle_t file_handle)
{
std::lock_guard lock(global_mutex);
auto it = steam_ugc_queries.find(file_handle);
if (steam_ugc_queries.end() == it) return std::nullopt;
return it->second;
}
Ugc_Remote_Storage_Bridge::~Ugc_Remote_Storage_Bridge()
{
std::lock_guard lock(global_mutex);
steam_ugc_queries.clear();
}