mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-26 17:36:05 -05:00
force update to 4.0.1 on forward compat
This commit is contained in:
parent
480b12e86c
commit
2ed18863a7
3 changed files with 31 additions and 12 deletions
|
@ -68,14 +68,15 @@ void tryShowForwardCompat() {
|
|||
LoaderImpl::get()->getGameVersion())
|
||||
return;
|
||||
|
||||
// TODO: change text later
|
||||
console::messageBox(
|
||||
"Forward Compatibility Warning",
|
||||
"Geode is running in a newer version of GD than Geode targets.\n"
|
||||
"UI is going to be disabled, platform console is forced on and crashes can be more common.\n"
|
||||
"However, if your game crashes, it is probably caused by an outdated mod and not Geode itself.",
|
||||
Severity::Warning
|
||||
);
|
||||
/*Loader::get()->queueInMainThread([]{
|
||||
console::messageBox(
|
||||
"Forward Compatibility Warning",
|
||||
"This version of Geode is for an older version of GD.\n"
|
||||
"Please wait a few minutes for Geode to update\n"
|
||||
"and then restart the game.",
|
||||
Severity::Warning
|
||||
);
|
||||
});*/
|
||||
|
||||
Mod::get()->setSavedValue<std::string>(
|
||||
"last-forward-compat-warn-popup-ver",
|
||||
|
|
|
@ -52,6 +52,11 @@ void updater::fetchLatestGithubRelease(
|
|||
return then(s_latestGithubRelease.value());
|
||||
}
|
||||
|
||||
//quick hack to make sure it always attempts an update check in forward compat
|
||||
if(Loader::get()->isForwardCompatMode()) {
|
||||
force = true;
|
||||
}
|
||||
|
||||
auto version = VersionInfo::parse(
|
||||
Mod::get()->getSavedValue("latest-version-auto-update-check", std::string("0.0.0"))
|
||||
);
|
||||
|
@ -68,9 +73,14 @@ void updater::fetchLatestGithubRelease(
|
|||
auto req = web::WebRequest();
|
||||
req.header("If-Modified-Since", modifiedSince);
|
||||
req.userAgent("github_api/1.0");
|
||||
//Force fetching v4.0.1 as the latest release for forward compat mode
|
||||
RUNNING_REQUESTS.emplace(
|
||||
"@loaderAutoUpdateCheck",
|
||||
req.get("https://api.github.com/repos/geode-sdk/geode/releases/latest").map(
|
||||
req.get(
|
||||
Loader::get()->isForwardCompatMode()
|
||||
? "https://api.github.com/repos/geode-sdk/geode/releases/tags/v4.0.1"
|
||||
: "https://api.github.com/repos/geode-sdk/geode/releases/latest"
|
||||
).map(
|
||||
[expect = std::move(expect), then = std::move(then)](web::WebResponse* response) {
|
||||
if (response->ok()) {
|
||||
if (response->data().empty()) {
|
||||
|
@ -318,6 +328,10 @@ void updater::downloadLoaderUpdate(std::string const& url) {
|
|||
if (ok) {
|
||||
s_isNewUpdateDownloaded = true;
|
||||
LoaderUpdateEvent(UpdateFinished()).post();
|
||||
if(
|
||||
Loader::get()->isForwardCompatMode()
|
||||
&& CCScene::get()->getChildByType<MenuLayer>(0)
|
||||
) utils::game::restart();
|
||||
}
|
||||
else {
|
||||
LoaderUpdateEvent(
|
||||
|
@ -382,8 +396,8 @@ void updater::checkForLoaderUpdates() {
|
|||
return;
|
||||
}
|
||||
|
||||
// don't auto-update major versions
|
||||
if (ver.getMajor() > Loader::get()->getVersion().getMajor()) {
|
||||
// don't auto-update major versions when not on forward compat
|
||||
if (!Loader::get()->isForwardCompatMode() && ver.getMajor() > Loader::get()->getVersion().getMajor()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -218,5 +218,9 @@ void console::messageBox(char const* title, std::string const& info, Severity se
|
|||
icon = MB_ICONERROR;
|
||||
break;
|
||||
}
|
||||
MessageBoxA(nullptr, info.c_str(), title, icon);
|
||||
|
||||
//run in another thread so auto update can run in the background
|
||||
std::thread([info, title, icon]{
|
||||
MessageBoxA(nullptr, info.c_str(), title, icon | MB_SETFOREGROUND);
|
||||
}).detach();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue