mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
Compare commits
4 commits
3ddfdd0d69
...
e472259c3a
Author | SHA1 | Date | |
---|---|---|---|
|
e472259c3a | ||
|
280b6efa94 | ||
|
4a40835f71 | ||
|
74d0924bcb |
6 changed files with 55 additions and 15 deletions
|
@ -164,7 +164,27 @@ function(setup_geode_mod proname)
|
||||||
set(HAS_HEADERS Off)
|
set(HAS_HEADERS Off)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (HAS_HEADERS AND WIN32)
|
if (GEODE_BUNDLE_PDB AND WIN32 AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
|
||||||
|
if (HAS_HEADERS)
|
||||||
|
add_custom_target(${proname}_PACKAGE ALL
|
||||||
|
DEPENDS ${proname} ${CMAKE_CURRENT_SOURCE_DIR}/mod.json
|
||||||
|
COMMAND ${GEODE_CLI} package new ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
--binary $<TARGET_FILE:${proname}> $<TARGET_LINKER_FILE:${proname}> $<TARGET_PDB_FILE:${proname}>
|
||||||
|
--output ${CMAKE_CURRENT_BINARY_DIR}/${MOD_ID}.geode
|
||||||
|
${INSTALL_ARG} ${PDB_ARG}
|
||||||
|
VERBATIM USES_TERMINAL
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
add_custom_target(${proname}_PACKAGE ALL
|
||||||
|
DEPENDS ${proname} ${CMAKE_CURRENT_SOURCE_DIR}/mod.json
|
||||||
|
COMMAND ${GEODE_CLI} package new ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
--binary $<TARGET_FILE:${proname}> $<TARGET_PDB_FILE:${proname}>
|
||||||
|
--output ${CMAKE_CURRENT_BINARY_DIR}/${MOD_ID}.geode
|
||||||
|
${INSTALL_ARG} ${PDB_ARG}
|
||||||
|
VERBATIM USES_TERMINAL
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
elseif (HAS_HEADERS AND WIN32)
|
||||||
# this adds the .lib file on windows, which is needed for linking with the headers
|
# this adds the .lib file on windows, which is needed for linking with the headers
|
||||||
add_custom_target(${proname}_PACKAGE ALL
|
add_custom_target(${proname}_PACKAGE ALL
|
||||||
DEPENDS ${proname} ${CMAKE_CURRENT_SOURCE_DIR}/mod.json
|
DEPENDS ${proname} ${CMAKE_CURRENT_SOURCE_DIR}/mod.json
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <fmt/chrono.h>
|
#include <fmt/chrono.h>
|
||||||
#include <loader/LoaderImpl.hpp>
|
#include <loader/LoaderImpl.hpp>
|
||||||
#include "../internal/about.hpp"
|
#include "../internal/about.hpp"
|
||||||
|
#include "Geode/loader/Loader.hpp"
|
||||||
|
|
||||||
using namespace server;
|
using namespace server;
|
||||||
|
|
||||||
|
@ -647,7 +648,7 @@ ServerRequest<ServerModVersion> server::getModVersion(std::string const& id, Mod
|
||||||
},
|
},
|
||||||
}, version);
|
}, version);
|
||||||
|
|
||||||
return req.get(formatServerURL("/mods/{}/versions/{}", id, versionURL)).map(
|
return req.get(formatServerURL("/mods/{}/versions/{}?gd={}", id, versionURL, Loader::get()->getGameVersion())).map(
|
||||||
[](web::WebResponse* response) -> Result<ServerModVersion, ServerError> {
|
[](web::WebResponse* response) -> Result<ServerModVersion, ServerError> {
|
||||||
if (response->ok()) {
|
if (response->ok()) {
|
||||||
// Parse payload
|
// Parse payload
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <Geode/utils/ColorProvider.hpp>
|
#include <Geode/utils/ColorProvider.hpp>
|
||||||
#include <Geode/binding/ButtonSprite.hpp>
|
#include <Geode/binding/ButtonSprite.hpp>
|
||||||
#include <Geode/loader/Loader.hpp>
|
#include <Geode/loader/Loader.hpp>
|
||||||
|
#include "server/DownloadManager.hpp"
|
||||||
#include "ui/mods/GeodeStyle.hpp"
|
#include "ui/mods/GeodeStyle.hpp"
|
||||||
#include "ui/mods/popups/ModPopup.hpp"
|
#include "ui/mods/popups/ModPopup.hpp"
|
||||||
#include "ui/mods/popups/DevPopup.hpp"
|
#include "ui/mods/popups/DevPopup.hpp"
|
||||||
|
@ -631,18 +632,7 @@ void ModItem::onEnable(CCObject*) {
|
||||||
UpdateModListStateEvent(UpdateModState(m_source.getID())).post();
|
UpdateModListStateEvent(UpdateModState(m_source.getID())).post();
|
||||||
}
|
}
|
||||||
void ModItem::onInstall(CCObject*) {
|
void ModItem::onInstall(CCObject*) {
|
||||||
if (auto updates = m_source.hasUpdates()) {
|
m_source.startInstall();
|
||||||
if (updates->replacement.has_value()) {
|
|
||||||
server::ModDownloadManager::get()->startDownload(
|
|
||||||
updates->replacement->id,
|
|
||||||
updates->replacement->version,
|
|
||||||
std::nullopt,
|
|
||||||
m_source.getID()
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
server::ModDownloadManager::get()->startDownload(m_source.getID(), std::nullopt);
|
|
||||||
}
|
}
|
||||||
void ModItem::onDevelopers(CCObject*) {
|
void ModItem::onDevelopers(CCObject*) {
|
||||||
DevListPopup::create(m_source)->show();
|
DevListPopup::create(m_source)->show();
|
||||||
|
|
|
@ -7,11 +7,13 @@
|
||||||
#include <Geode/loader/ModSettingsManager.hpp>
|
#include <Geode/loader/ModSettingsManager.hpp>
|
||||||
#include <Geode/ui/GeodeUI.hpp>
|
#include <Geode/ui/GeodeUI.hpp>
|
||||||
#include <Geode/utils/ColorProvider.hpp>
|
#include <Geode/utils/ColorProvider.hpp>
|
||||||
|
#include <optional>
|
||||||
#include "ConfirmUninstallPopup.hpp"
|
#include "ConfirmUninstallPopup.hpp"
|
||||||
#include "../settings/ModSettingsPopup.hpp"
|
#include "../settings/ModSettingsPopup.hpp"
|
||||||
#include "../../../internal/about.hpp"
|
#include "../../../internal/about.hpp"
|
||||||
#include "../../GeodeUIEvent.hpp"
|
#include "../../GeodeUIEvent.hpp"
|
||||||
#include "../popups/ModtoberPopup.hpp"
|
#include "../popups/ModtoberPopup.hpp"
|
||||||
|
#include "server/DownloadManager.hpp"
|
||||||
|
|
||||||
class FetchTextArea : public CCNode {
|
class FetchTextArea : public CCNode {
|
||||||
public:
|
public:
|
||||||
|
@ -1047,7 +1049,9 @@ void ModPopup::onInstall(CCObject*) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
server::ModDownloadManager::get()->startDownload(m_source.getID(), std::nullopt);
|
|
||||||
|
m_source.startInstall();
|
||||||
|
|
||||||
this->onClose(nullptr);
|
this->onClose(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -240,3 +240,27 @@ server::ServerRequest<std::optional<server::ServerModUpdate>> ModSource::checkUp
|
||||||
},
|
},
|
||||||
}, m_value);
|
}, m_value);
|
||||||
}
|
}
|
||||||
|
void ModSource::startInstall() {
|
||||||
|
if (auto updates = this->hasUpdates()) {
|
||||||
|
if (updates->replacement.has_value()) {
|
||||||
|
server::ModDownloadManager::get()->startDownload(
|
||||||
|
updates->replacement->id,
|
||||||
|
updates->replacement->version,
|
||||||
|
std::nullopt,
|
||||||
|
this->getID()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
server::ModDownloadManager::get()->startDownload(
|
||||||
|
this->getID(),
|
||||||
|
updates->version
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
server::ModDownloadManager::get()->startDownload(
|
||||||
|
this->getID(),
|
||||||
|
this->asServer()
|
||||||
|
? std::optional{this->asServer()->latestVersion().getVersion()}
|
||||||
|
: std::nullopt
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -49,4 +49,5 @@ public:
|
||||||
server::ServerRequest<std::optional<std::string>> fetchChangelog() const;
|
server::ServerRequest<std::optional<std::string>> fetchChangelog() const;
|
||||||
server::ServerRequest<std::unordered_set<std::string>> fetchValidTags() const;
|
server::ServerRequest<std::unordered_set<std::string>> fetchValidTags() const;
|
||||||
server::ServerRequest<std::optional<server::ServerModUpdate>> checkUpdates();
|
server::ServerRequest<std::optional<server::ServerModUpdate>> checkUpdates();
|
||||||
|
void startInstall();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue