Skip to content

Commit

Permalink
[RPKG] Add support for version argument in l10n search
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyFuller committed Nov 30, 2023
1 parent 7f1f1d8 commit 04fa9d0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/lib/rpkg_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2156,7 +2156,7 @@ char* get_entry_name(uint32_t temp_index, int entry_index) {
}

int deep_search_localization(char* input_path, char* search_value, int search_dlge, int search_locr, int search_rtlv,
int max_results) {
int max_results, char* version) {
gui_control = READY;
task_single_status = READY;
task_multiple_status = READY;
Expand All @@ -2181,7 +2181,7 @@ int deep_search_localization(char* input_path, char* search_value, int search_dl
search_rtlv_bool = true;

rpkg_function::search_localization(input_path_string, search, output_path, search_dlge_bool,
search_locr_bool, search_rtlv_bool, max_results);
search_locr_bool, search_rtlv_bool, max_results, std::string(version));

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/rpkg_dll.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ RPKG_EXPORT char* get_entry_name(uint32_t temp_index, int entry_index);

RPKG_EXPORT int
deep_search_localization(char* input_path, char* search_value, int search_dlge, int search_locr, int search_rtlv,
int max_results);
int max_results, char* version);

RPKG_EXPORT uint32_t get_localization_search_results_size();

Expand Down
2 changes: 1 addition & 1 deletion src/rpkg_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class rpkg_function {
extract_mati_to_json(std::string& input_path, const std::string& filter, const std::string& output_path);

static void search_localization(std::string& input_path, std::string& search, std::string& output_path,
bool search_dlge, bool search_locr, bool search_rtlv, int max_results);
bool search_dlge, bool search_locr, bool search_rtlv, int max_results, std::string version);

static void search_entities(std::string& input_path,
char** search_strings,
Expand Down
10 changes: 5 additions & 5 deletions src/search_localization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <chrono>
#include <sstream>

void add_search_result(rpkg rpkg, uint32_t hash_index, std::string data) {
void add_search_result(rpkg& rpkg, uint32_t hash_index, std::string& data) {
localization_search_results += rpkg.rpkg_file_path + "||||" +
util::uint64_t_to_hex_string(rpkg.hash.at(hash_index).hash_value) +
"." + rpkg.hash.at(hash_index).hash_resource_type + " " +
Expand All @@ -15,7 +15,7 @@ void add_search_result(rpkg rpkg, uint32_t hash_index, std::string data) {
}

void rpkg_function::search_localization(std::string& input_path, std::string& search, std::string& output_path,
bool search_dlge, bool search_locr, bool search_rtlv, int max_results) {
bool search_dlge, bool search_locr, bool search_rtlv, int max_results, std::string version) {
task_single_status = TASK_EXECUTING;
task_multiple_status = TASK_EXECUTING;

Expand Down Expand Up @@ -119,7 +119,7 @@ void rpkg_function::search_localization(std::string& input_path, std::string& se
localization_hash_count_current++;

rpkg_function::extract_dlge_to_json_from(rpkg.rpkg_file_path, temp_hash_string,
output_path, true, "HM3");
output_path, true, version);

try {
/*for (const auto& it : localization_json.items()) {
Expand Down Expand Up @@ -185,7 +185,7 @@ void rpkg_function::search_localization(std::string& input_path, std::string& se
localization_hash_count_current++;

rpkg_function::extract_locr_to_json_from(rpkg.rpkg_file_path, temp_hash_string,
output_path, true, "HM3");
output_path, true, version);

try {
for (const auto &[lang, strings] : localization_json.at("languages").items()) {
Expand Down Expand Up @@ -232,7 +232,7 @@ void rpkg_function::search_localization(std::string& input_path, std::string& se
localization_hash_count_current++;

rpkg_function::extract_rtlv_to_json_from(rpkg.rpkg_file_path, temp_hash_string,
output_path, true, "HM3");
output_path, true, version);

try {
for (const auto &[lang, string] : localization_json.at("subtitles").items()) {
Expand Down
2 changes: 1 addition & 1 deletion src/task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void task::execute(std::string& command, std::string& input_path, std::string& f
search_categories[1] = (int)entity::search_category::TEMPHASH;
rpkg_function::search_entities(input_path, search_strings, search_types, search_categories, 2, 10, true, true);*/
} else if (command == "-search_localization") {
rpkg_function::search_localization(input_path, search, output_path, true, true, true, 1000);
rpkg_function::search_localization(input_path, search, output_path, true, true, true, 1000, search);
} else if (command == "-get_line_string") {
rpkg_function::get_line_string(input_path, filter, output_path);
} else if (command == "-extract_sdef_to_json") {
Expand Down

0 comments on commit 04fa9d0

Please sign in to comment.