mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-23 19:25:35 +08:00
new option in mods.json for the new param of total files sizes
This commit is contained in:
parent
f5ae22a1e6
commit
a307cc13e5
@ -54,6 +54,9 @@ struct Mod_entry {
|
|||||||
int32 primaryFileSize{};
|
int32 primaryFileSize{};
|
||||||
std::string previewFileName{};
|
std::string previewFileName{};
|
||||||
int32 previewFileSize{};
|
int32 previewFileSize{};
|
||||||
|
|
||||||
|
uint64 total_files_sizes{}; // added in sdk 1.60, "Total size of all files (non-legacy), excluding the preview file"
|
||||||
|
|
||||||
std::string workshopItemURL{};
|
std::string workshopItemURL{};
|
||||||
|
|
||||||
// voting information
|
// voting information
|
||||||
|
@ -1015,6 +1015,8 @@ static void try_parse_mods_file(class Settings *settings_client, Settings *setti
|
|||||||
}
|
}
|
||||||
newMod.previewFileSize = mod.value().value("preview_filesize", preview_filesize);
|
newMod.previewFileSize = mod.value().value("preview_filesize", preview_filesize);
|
||||||
|
|
||||||
|
newMod.total_files_sizes = mod.value().value("total_files_sizes", primary_filesize);
|
||||||
|
|
||||||
newMod.workshopItemURL = mod.value().value("workshop_item_url", "https://steamcommunity.com/sharedfiles/filedetails/?id=" + std::string(mod.key()));
|
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);
|
newMod.votesUp = mod.value().value("upvotes", (uint32)500);
|
||||||
newMod.votesDown = mod.value().value("downvotes", (uint32)12);
|
newMod.votesDown = mod.value().value("downvotes", (uint32)12);
|
||||||
@ -1043,6 +1045,7 @@ static void try_parse_mods_file(class Settings *settings_client, Settings *setti
|
|||||||
PRINT_DEBUG(" preview_filename: '%s'", newMod.previewFileName.c_str());
|
PRINT_DEBUG(" preview_filename: '%s'", newMod.previewFileName.c_str());
|
||||||
PRINT_DEBUG(" preview_filesize: %i bytes", newMod.previewFileSize);
|
PRINT_DEBUG(" preview_filesize: %i bytes", newMod.previewFileSize);
|
||||||
PRINT_DEBUG(" preview file handle: %llu", settings_client->getMod(newMod.id).handlePreviewFile);
|
PRINT_DEBUG(" preview file handle: %llu", settings_client->getMod(newMod.id).handlePreviewFile);
|
||||||
|
PRINT_DEBUG(" total_files_sizes: %llu", settings_client->getMod(newMod.id).total_files_sizes);
|
||||||
PRINT_DEBUG(" workshop_item_url: '%s'", newMod.workshopItemURL.c_str());
|
PRINT_DEBUG(" workshop_item_url: '%s'", newMod.workshopItemURL.c_str());
|
||||||
PRINT_DEBUG(" preview_url: '%s'", newMod.previewURL.c_str());
|
PRINT_DEBUG(" preview_url: '%s'", newMod.previewURL.c_str());
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
@ -1085,6 +1088,8 @@ static void try_detect_mods_folder(class Settings *settings_client, Settings *se
|
|||||||
newMod.previewFileName = mod_preview_files.size() ? mod_preview_files[0] : "";
|
newMod.previewFileName = mod_preview_files.size() ? mod_preview_files[0] : "";
|
||||||
newMod.previewFileSize = (int32)get_file_size_safe(newMod.previewFileName, mod_images_fullpath);
|
newMod.previewFileSize = (int32)get_file_size_safe(newMod.previewFileName, mod_images_fullpath);
|
||||||
|
|
||||||
|
newMod.total_files_sizes = newMod.primaryFileSize;
|
||||||
|
|
||||||
newMod.workshopItemURL = "https://steamcommunity.com/sharedfiles/filedetails/?id=" + mod_folder;
|
newMod.workshopItemURL = "https://steamcommunity.com/sharedfiles/filedetails/?id=" + mod_folder;
|
||||||
newMod.votesUp = (uint32)500;
|
newMod.votesUp = (uint32)500;
|
||||||
newMod.votesDown = (uint32)12;
|
newMod.votesDown = (uint32)12;
|
||||||
@ -1105,6 +1110,7 @@ static void try_detect_mods_folder(class Settings *settings_client, Settings *se
|
|||||||
PRINT_DEBUG(" preview_filename: '%s'", newMod.previewFileName.c_str());
|
PRINT_DEBUG(" preview_filename: '%s'", newMod.previewFileName.c_str());
|
||||||
PRINT_DEBUG(" preview_filesize: %i bytes", newMod.previewFileSize);
|
PRINT_DEBUG(" preview_filesize: %i bytes", newMod.previewFileSize);
|
||||||
PRINT_DEBUG(" preview file handle: %llu", settings_client->getMod(newMod.id).handlePreviewFile);
|
PRINT_DEBUG(" preview file handle: %llu", settings_client->getMod(newMod.id).handlePreviewFile);
|
||||||
|
PRINT_DEBUG(" total_files_sizes: '%s'", newMod.total_files_sizes);
|
||||||
PRINT_DEBUG(" workshop_item_url: '%s'", newMod.workshopItemURL.c_str());
|
PRINT_DEBUG(" workshop_item_url: '%s'", newMod.workshopItemURL.c_str());
|
||||||
PRINT_DEBUG(" preview_url: '%s'", newMod.previewURL.c_str());
|
PRINT_DEBUG(" preview_url: '%s'", newMod.previewURL.c_str());
|
||||||
} catch (...) {}
|
} catch (...) {}
|
||||||
|
@ -106,8 +106,8 @@ void Steam_UGC::set_details(PublishedFileId_t id, SteamUGCDetails_t *pDetails)
|
|||||||
// TODO should we enable this?
|
// TODO should we enable this?
|
||||||
// pDetails->m_unNumChildren = mod.numChildren;
|
// pDetails->m_unNumChildren = mod.numChildren;
|
||||||
|
|
||||||
// TODO make the filesize is good (have a custom json shit I guess)
|
// TODO make the filesize is good
|
||||||
pDetails->m_ulTotalFilesSize = mod.primaryFileSize + mod.previewFileSize;
|
pDetails->m_ulTotalFilesSize = mod.total_files_sizes;
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG(" mod isn't installed, returning failure");
|
PRINT_DEBUG(" mod isn't installed, returning failure");
|
||||||
pDetails->m_eResult = k_EResultFail;
|
pDetails->m_eResult = k_EResultFail;
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
"primary_filesize": 1000000,
|
"primary_filesize": 1000000,
|
||||||
"preview_filename": "test.png",
|
"preview_filename": "test.png",
|
||||||
"preview_filesize": 1000000,
|
"preview_filesize": 1000000,
|
||||||
|
"total_files_sizes": 9977664411,
|
||||||
"workshop_item_url": "https://steamcommunity.com/sharedfiles/filedetails/?id=111111111",
|
"workshop_item_url": "https://steamcommunity.com/sharedfiles/filedetails/?id=111111111",
|
||||||
"upvotes": 10,
|
"upvotes": 10,
|
||||||
"downvotes": 1,
|
"downvotes": 1,
|
||||||
|
Loading…
Reference in New Issue
Block a user