mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator
synced 2025-05-23 21:57:40 +08:00
Add more debug logging to achievement image loads.
This commit is contained in:
parent
7d0555b6ee
commit
17d4701e88
@ -174,6 +174,7 @@ inline void reset_LastError()
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iterator>
|
||||
#include <typeinfo>
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
@ -139,11 +139,19 @@ int32 achievement_image_data_gray_find(std::string key) {
|
||||
void load_achievements_db()
|
||||
{
|
||||
uint64 count = 0;
|
||||
uint64 bad_count = 0;
|
||||
uint64 corrupt_count = 0;
|
||||
uint64 missing_normal_images = 0;
|
||||
uint64 missing_gray_images = 0;
|
||||
uint64 unreadable_normal_images = 0;
|
||||
uint64 unreadable_gray_images = 0;
|
||||
std::string name = "";
|
||||
std::string file_path = Local_Storage::get_game_settings_path() + achievements_user_file;
|
||||
local_storage->load_json(file_path, defined_achievements);
|
||||
for (auto & it : defined_achievements) {
|
||||
name = "";
|
||||
try {
|
||||
std::string name = static_cast<std::string const&>(it["name"]);
|
||||
name = static_cast<std::string const&>(it["name"]);
|
||||
if (name.length() > 0) {
|
||||
std::string normal = Local_Storage::get_game_settings_path() + static_cast<std::string const&>(it["icon"]);
|
||||
std::string gray = Local_Storage::get_game_settings_path() + static_cast<std::string const&>(it["icongray"]);
|
||||
@ -175,13 +183,56 @@ void load_achievements_db()
|
||||
achievement_image_data_normal[name] = settings->add_image(normalStr, normal_width, normal_height);
|
||||
achievement_image_data_gray[name] = settings->add_image(grayStr, gray_width, gray_height);
|
||||
count++;
|
||||
} else {
|
||||
corrupt_count++;
|
||||
if (normal_width <= 0 || normal_height <= 0)
|
||||
unreadable_normal_images++;
|
||||
if (gray_width <= 0 || gray_height <= 0)
|
||||
unreadable_gray_images++;
|
||||
PRINT_DEBUG("%s %s %s.\n",
|
||||
"Unable to load images for achievement",
|
||||
name.c_str(),
|
||||
"unable to get resolution from images.");
|
||||
}
|
||||
} else {
|
||||
corrupt_count++;
|
||||
if (normal.length() <= 0)
|
||||
missing_normal_images++;
|
||||
if (gray.length() <= 0)
|
||||
missing_gray_images++;
|
||||
PRINT_DEBUG("%s %s %s.\n",
|
||||
"Unable to load images for achievement",
|
||||
name.c_str(),
|
||||
"an image path is not configured");
|
||||
}
|
||||
} else {
|
||||
bad_count++;
|
||||
PRINT_DEBUG("%s %s %s %" PRIu64 " %s.\n",
|
||||
"Invalid achievement json at",
|
||||
file_path.c_str(),
|
||||
"for achievement number",
|
||||
count + corrupt_count + bad_count + 1,
|
||||
"is invalid");
|
||||
}
|
||||
} catch (...) {}
|
||||
} catch (std::exception &e) {
|
||||
bad_count++;
|
||||
PRINT_DEBUG("Loading image data for achievement %s failed. Exception type: %s Reason: %s.\n",
|
||||
(name.length() > 0) ? name.c_str() : "ERROR: NAME PARSING FROM JSON FAILED",
|
||||
typeid(e).name(),
|
||||
e.what());
|
||||
}
|
||||
}
|
||||
|
||||
PRINT_DEBUG("loaded %llu achievement images.\n", count);
|
||||
PRINT_DEBUG("loaded %" PRIu64 " achievement images.\npartial loaded %" PRIu64 " achievements.\nskipped %" PRIu64 " invalid achievements.\n",
|
||||
count,
|
||||
corrupt_count,
|
||||
bad_count);
|
||||
PRINT_DEBUG("ignored %" PRIu64 " missing normal achivement images.\nignored %" PRIu64 " missing gray achivement images.\n",
|
||||
missing_normal_images,
|
||||
missing_gray_images);
|
||||
PRINT_DEBUG("ignored %" PRIu64 " unreadable normal achivement images.\nignored %" PRIu64 " unreadable gray achivement images.\n",
|
||||
unreadable_normal_images,
|
||||
unreadable_gray_images);
|
||||
}
|
||||
|
||||
void load_achievements()
|
||||
|
Loading…
x
Reference in New Issue
Block a user