mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2025-08-05 07:05:34 +02:00
Initial implementation of GetQueryUGCMetadata()
This commit is contained in:
parent
753b0d9121
commit
8794403c10
5 changed files with 15 additions and 4 deletions
|
@ -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{};
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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 (...) {}
|
||||
|
|
|
@ -535,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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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": {
|
||||
|
|
Loading…
Add table
Reference in a new issue