Disable auto-updater for client localization
This commit is contained in:
parent
b116134aff
commit
471585cc55
@ -19,7 +19,9 @@
|
|||||||
#include <utils/properties.hpp>
|
#include <utils/properties.hpp>
|
||||||
#include <utils/string.hpp>
|
#include <utils/string.hpp>
|
||||||
|
|
||||||
#define MASTER "https://h1-mod.fed.cat/"
|
// Ahrimdon
|
||||||
|
#define MASTER ""
|
||||||
|
// #define MASTER "https://h1-mod.fed.cat/"
|
||||||
|
|
||||||
#define FILES_PATH "files.json"
|
#define FILES_PATH "files.json"
|
||||||
#define FILES_PATH_DEV "files-dev.json"
|
#define FILES_PATH_DEV "files-dev.json"
|
||||||
@ -160,7 +162,7 @@ namespace updater
|
|||||||
{
|
{
|
||||||
return utils::string::va("%i", uint32_t(time(nullptr)));
|
return utils::string::va("%i", uint32_t(time(nullptr)));
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
std::optional<utils::http::result> download_data_file(const std::string& name)
|
std::optional<utils::http::result> download_data_file(const std::string& name)
|
||||||
{
|
{
|
||||||
const auto file = std::format("{}{}?{}", select(DATA_PATH, DATA_PATH_DEV), name, get_time_str());
|
const auto file = std::format("{}{}?{}", select(DATA_PATH, DATA_PATH_DEV), name, get_time_str());
|
||||||
@ -172,7 +174,7 @@ namespace updater
|
|||||||
const auto file = std::format("{}?{}", select(FILES_PATH, FILES_PATH_DEV), get_time_str());
|
const auto file = std::format("{}?{}", select(FILES_PATH, FILES_PATH_DEV), get_time_str());
|
||||||
return updater::get_server_file(file);
|
return updater::get_server_file(file);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
bool has_old_data_files()
|
bool has_old_data_files()
|
||||||
{
|
{
|
||||||
bool has = false;
|
bool has = false;
|
||||||
@ -306,7 +308,7 @@ namespace updater
|
|||||||
return utils::string::va("%s (%i)", str_error, code);
|
return utils::string::va("%s (%i)", str_error, code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
std::optional<utils::http::result> get_server_file(const std::string& endpoint)
|
std::optional<utils::http::result> get_server_file(const std::string& endpoint)
|
||||||
{
|
{
|
||||||
static std::vector<std::string> server_urls =
|
static std::vector<std::string> server_urls =
|
||||||
@ -334,7 +336,19 @@ namespace updater
|
|||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
// While stubbing works, comments minimize overhead
|
||||||
|
// Ahrimdon
|
||||||
|
/*
|
||||||
|
std::optional<utils::http::result> updater::get_server_file(const std::string& endpoint)
|
||||||
|
{
|
||||||
|
// Optionally log that this function was called.
|
||||||
|
console::debug("[HTTP] Stubbed get_server_file called with endpoint: %s\n", endpoint.c_str());
|
||||||
|
|
||||||
|
// Return an empty optional to signify failure (or that there's no file to download).
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
*/
|
||||||
void relaunch()
|
void relaunch()
|
||||||
{
|
{
|
||||||
const auto mode = game::environment::is_mp() ? "-multiplayer" : "-singleplayer";
|
const auto mode = game::environment::is_mp() ? "-multiplayer" : "-singleplayer";
|
||||||
@ -430,7 +444,8 @@ namespace updater
|
|||||||
data_.cancelled = true;
|
data_.cancelled = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// Ahrimdon
|
||||||
|
/*
|
||||||
void start_update_check()
|
void start_update_check()
|
||||||
{
|
{
|
||||||
cancel_update();
|
cancel_update();
|
||||||
@ -525,10 +540,26 @@ namespace updater
|
|||||||
notify("update_check_done");
|
notify("update_check_done");
|
||||||
}, scheduler::pipeline::async);
|
}, scheduler::pipeline::async);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
void start_update_check() // Ahrimdon
|
||||||
|
{
|
||||||
|
console::debug("[Updater] Skipping update check as master server is not defined.\n");
|
||||||
|
|
||||||
|
update_data.access([](update_data_t& data_)
|
||||||
|
{
|
||||||
|
data_.check.done = true;
|
||||||
|
data_.check.success = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
notify("update_check_done");
|
||||||
|
}
|
||||||
|
|
||||||
void start_update_download()
|
void start_update_download()
|
||||||
{
|
{
|
||||||
console::debug("[Updater] starting update download\n");
|
// console::debug("[Updater] starting update download\n"); - Ahrimdon
|
||||||
|
console::debug("[Updater] Skipping update download as master server is not defined.\n");
|
||||||
|
return;
|
||||||
|
|
||||||
if (!is_update_check_done() || !get_update_check_status() || is_update_cancelled())
|
if (!is_update_check_done() || !get_update_check_status() || is_update_cancelled())
|
||||||
{
|
{
|
||||||
@ -577,17 +608,17 @@ namespace updater
|
|||||||
{
|
{
|
||||||
data_.current_file = file;
|
data_.current_file = file;
|
||||||
});
|
});
|
||||||
|
/*
|
||||||
console::debug("[Updater] downloading file %s\n", file.data());
|
console::debug("[Updater] downloading file %s\n", file.data());
|
||||||
|
|
||||||
const auto data = download_data_file(file);
|
const auto data = download_data_file(file);
|
||||||
|
*/
|
||||||
if (is_update_cancelled())
|
if (is_update_cancelled())
|
||||||
{
|
{
|
||||||
reset_data();
|
reset_data();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (!data.has_value())
|
if (!data.has_value())
|
||||||
{
|
{
|
||||||
set_update_download_status(true, false, utils::string::va(ERR_DOWNLOAD_FAIL, file.data(), "Unknown error"));
|
set_update_download_status(true, false, utils::string::va(ERR_DOWNLOAD_FAIL, file.data(), "Unknown error"));
|
||||||
@ -603,8 +634,9 @@ namespace updater
|
|||||||
}
|
}
|
||||||
|
|
||||||
downloads.push_back({file, value.buffer});
|
downloads.push_back({file, value.buffer});
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
for (const auto& download : downloads)
|
for (const auto& download : downloads)
|
||||||
{
|
{
|
||||||
if (!write_file(download.name, download.data))
|
if (!write_file(download.name, download.data))
|
||||||
@ -613,7 +645,7 @@ namespace updater
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
set_update_download_status(true, true);
|
set_update_download_status(true, true);
|
||||||
}, scheduler::pipeline::async);
|
}, scheduler::pipeline::async);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user