Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dll/dll/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ struct Mod_entry {
uint64 total_files_sizes{}; // added in sdk 1.60, "Total size of all files (non-legacy), excluding the preview file"
std::string min_game_branch{}; // added in sdk 1.60
std::string max_game_branch{}; // added in sdk 1.60
std::string metadata{};

std::string workshopItemURL{};

Expand Down
1 change: 1 addition & 0 deletions dll/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ void Settings::addModDetails(PublishedFileId_t id, const Mod_entry &details)
f->total_files_sizes = details.total_files_sizes;
f->min_game_branch = details.min_game_branch;
f->max_game_branch = details.max_game_branch;
f->metadata = details.metadata;
}
}

Expand Down
3 changes: 3 additions & 0 deletions dll/settings_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,7 @@ static void try_parse_mods_file(class Settings *settings_client, Settings *setti
newMod.total_files_sizes = mod.value().value("total_files_sizes", newMod.primaryFileSize);
newMod.min_game_branch = mod.value().value("min_game_branch", "");
newMod.max_game_branch = mod.value().value("max_game_branch", "");
newMod.metadata = mod.value().value("metadata", "");

newMod.workshopItemURL = mod.value().value("workshop_item_url", "https://steamcommunity.com/sharedfiles/filedetails/?id=" + std::string(mod.key()));
newMod.votesUp = mod.value().value("upvotes", (uint32)500);
Expand Down Expand Up @@ -1110,6 +1111,7 @@ static void try_parse_mods_file(class Settings *settings_client, Settings *setti
PRINT_DEBUG(" total_files_sizes: %llu", settings_client->getMod(newMod.id).total_files_sizes);
PRINT_DEBUG(" min_game_branch: '%s'", settings_client->getMod(newMod.id).min_game_branch.c_str());
PRINT_DEBUG(" max_game_branch: '%s'", settings_client->getMod(newMod.id).max_game_branch.c_str());
PRINT_DEBUG(" metadata: '%s'", settings_client->getMod(newMod.id).metadata.c_str());
PRINT_DEBUG(" workshop_item_url: '%s'", newMod.workshopItemURL.c_str());
PRINT_DEBUG(" preview_url: '%s'", newMod.previewURL.c_str());
} catch (std::exception& e) {
Expand Down Expand Up @@ -1178,6 +1180,7 @@ static void try_detect_mods_folder(class Settings *settings_client, Settings *se
PRINT_DEBUG(" total_files_sizes: '%llu'", newMod.total_files_sizes);
PRINT_DEBUG(" min_game_branch: '%s'", newMod.min_game_branch.c_str());
PRINT_DEBUG(" max_game_branch: '%s'", newMod.max_game_branch.c_str());
PRINT_DEBUG(" metadata: '%s'", newMod.metadata.c_str());
PRINT_DEBUG(" workshop_item_url: '%s'", newMod.workshopItemURL.c_str());
PRINT_DEBUG(" preview_url: '%s'", newMod.previewURL.c_str());
} catch (...) {}
Expand Down
14 changes: 10 additions & 4 deletions dll/steam_ugc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ UGCQueryHandle_t Steam_UGC::CreateQueryUserUGCRequest( AccountID_t unAccountID,
PRINT_DEBUG("%u %i %i %i %u %u %u", unAccountID, eListType, eMatchingUGCType, eSortOrder, nCreatorAppID, nConsumerAppID, unPage);
std::lock_guard<std::recursive_mutex> lock(global_mutex);

if (nCreatorAppID != settings->get_local_game_id().AppID() || nConsumerAppID != settings->get_local_game_id().AppID()) return k_UGCQueryHandleInvalid;
// TODO: more info needed to decide which UGCs will be returned
// if (nCreatorAppID != settings->get_local_game_id().AppID() || nConsumerAppID != settings->get_local_game_id().AppID()) return k_UGCQueryHandleInvalid;
if (unPage < 1) return k_UGCQueryHandleInvalid;
if (eListType < 0) return k_UGCQueryHandleInvalid;
if (unAccountID != settings->get_local_steam_id().GetAccountID()) return k_UGCQueryHandleInvalid;
Expand Down Expand Up @@ -534,11 +535,16 @@ bool Steam_UGC::GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, STEA
PRINT_DEBUG_TODO();
std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (handle == k_UGCQueryHandleInvalid) return false;
if (!pchMetadata || !cchMetadatasize) return false;

auto request = std::find_if(ugc_queries.begin(), ugc_queries.end(), [&handle](struct UGC_query const& item) { return item.handle == handle; });
if (ugc_queries.end() == request) return false;
auto res = get_query_ugc(handle, index);
if (!res.has_value()) return false;

return false;
auto &mod = res.value();
PRINT_DEBUG("Steam_UGC:GetQueryUGCMetadata: '%s'", mod.metadata.c_str());
memset(pchMetadata, 0, cchMetadatasize);
mod.metadata.copy(pchMetadata, cchMetadatasize - 1);
return true;
}


Expand Down
3 changes: 2 additions & 1 deletion post_build/steam_settings.EXAMPLE/mods.EXAMPLE.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"num_children": 0,
"path": "C:\\games\\my_game\\steam_settings\\mods_data\\mod_111111111_data_folder",
"preview_url": "file:///C:/games/my_game/steam_settings/mod_images/my_preview.jpg",
"score": 0.7
"score": 0.7,
"metadata": "some needed metadata"
},

"222222222": {
Expand Down