Compare commits

...

7 commits

Author SHA1 Message Date
TimeStepYT
ba584726b8
Merge 7291a9d14e into 6e11d0a6b0 2024-11-16 18:41:45 +01:00
HJfod
6e11d0a6b0 Merge branch 'main' of https://github.com/geode-sdk/geode into main
Some checks are pending
Build Binaries / Build Windows (push) Waiting to run
Build Binaries / Build macOS (push) Waiting to run
Build Binaries / Build Android (64-bit) (push) Waiting to run
Build Binaries / Build Android (32-bit) (push) Waiting to run
Build Binaries / Publish (push) Blocked by required conditions
2024-11-16 18:37:32 +02:00
HJfod
c94a533d1c fix updating causing the ui to lag out like hell 2024-11-16 18:36:45 +02:00
HJfod
b9fb2f6778 fix CCCallFuncExt 2024-11-16 18:36:34 +02:00
acaruso-xx
3fa91241aa
Add missing CCHttpRequest members and member functions (#1161) 2024-11-16 16:37:49 +01:00
HJfod
302eea1f47 disable enable button on outdated mods 2024-11-16 16:22:03 +02:00
Rod
06eb32310c
Changed PortuguesePT to Portuguese (#1160)
* Added Portuguese Portuguese

* sry i forgot this

* idk

* fixed bug

* fix

* fixed portuguese

* removed portuguese extra

---------

Co-authored-by: OmgRod <rlimafonseca2010@gmail.com>
Co-authored-by: Cvolton <cvolton@cvolton.eu>
2024-11-16 14:14:12 +01:00
7 changed files with 91 additions and 13 deletions

View file

@ -1,4 +1,4 @@
!insertmacro LANGFILE_EXT PortuguesePT !insertmacro LANGFILE_EXT Portuguese
!pragma warning disable 6030 !pragma warning disable 6030
${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "O instalador irá guiá-lo através da instalação de $(^NameDA).$\r$\n$\r$\nAntes de iniciar a instalação, certifique-se de que o Geometry Dash não está aberto.$\r$\n$\r$\n$_CLICK" ${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "O instalador irá guiá-lo através da instalação de $(^NameDA).$\r$\n$\r$\nAntes de iniciar a instalação, certifique-se de que o Geometry Dash não está aberto.$\r$\n$\r$\n$_CLICK"

View file

@ -59,7 +59,7 @@
!insertmacro GEODE_LANGUAGE "Polish" !insertmacro GEODE_LANGUAGE "Polish"
!insertmacro GEODE_LANGUAGE "Russian" !insertmacro GEODE_LANGUAGE "Russian"
!insertmacro GEODE_LANGUAGE "PortugueseBR" !insertmacro GEODE_LANGUAGE "PortugueseBR"
!insertmacro GEODE_LANGUAGE "PortuguesePT" !insertmacro GEODE_LANGUAGE "Portuguese"
!insertmacro GEODE_LANGUAGE "Ukrainian" !insertmacro GEODE_LANGUAGE "Ukrainian"
!insertmacro GEODE_LANGUAGE "Czech" !insertmacro GEODE_LANGUAGE "Czech"
!insertmacro GEODE_LANGUAGE "Turkish" !insertmacro GEODE_LANGUAGE "Turkish"

View file

@ -28,6 +28,8 @@
#include "../../include/cocos2d.h" #include "../../include/cocos2d.h"
#include "../ExtensionMacros.h" #include "../ExtensionMacros.h"
enum class GJHttpType;
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
class CC_DLL CCHttpClient; class CC_DLL CCHttpClient;
@ -216,6 +218,50 @@ public:
return _headers; return _headers;
} }
inline int getType() {
return _type;
}
inline void setType(int type) {
_type = type;
}
// @note Geode addition
inline void setType(GJHttpType type) {
_type = static_cast<int>(type);
}
inline bool getShouldCancel() {
return _shouldCancel;
}
inline void setShouldCancel(bool shouldCancel) {
_shouldCancel = shouldCancel;
}
inline int getDownloadProgress() {
return _downloadProgress;
}
inline void setDownloadProgress(int downloadProgress) {
_downloadProgress = downloadProgress;
}
inline int getReadTimeout() {
return _readTimeout;
}
inline void setReadTimeout(int readTimeout) {
_readTimeout = readTimeout;
}
inline int getConnectTimeout() {
return _connectTimeout;
}
inline void setConnectTimeout(int connectTimeout) {
_connectTimeout = connectTimeout;
}
protected: protected:
// properties // properties
@ -229,13 +275,15 @@ protected:
gd::vector<gd::string> _headers; /// custom http headers gd::vector<gd::string> _headers; /// custom http headers
// @note RobTop Addition // @note RobTop Addition
int _requestTypeGJ; int _type;
// @note RobTop Addition // @note RobTop Addition
bool _shouldCancel; bool _shouldCancel;
// @note RobTop Addition // @note RobTop Addition
int _downloadProgress; int _downloadProgress;
// @note RobTop Addition // @note RobTop Addition
int _readTimeout; int _readTimeout;
// @note RobTop Addition
int _connectTimeout;
}; };
NS_CC_EXT_END NS_CC_EXT_END

View file

@ -1331,15 +1331,13 @@ namespace geode::cocos {
class CallFuncExtImpl : public cocos2d::CCActionInstant { class CallFuncExtImpl : public cocos2d::CCActionInstant {
public: public:
static CallFuncExtImpl* create(const F& func) { static CallFuncExtImpl* create(const F& func) {
auto ret = new CallFuncExtImpl; auto ret = new CallFuncExtImpl(func);
ret->m_func = func;
ret->autorelease(); ret->autorelease();
return ret; return ret;
} }
static CallFuncExtImpl* create(F&& func) { static CallFuncExtImpl* create(F&& func) {
auto ret = new CallFuncExtImpl; auto ret = new CallFuncExtImpl(std::move(func));
ret->m_func = std::move(func);
ret->autorelease(); ret->autorelease();
return ret; return ret;
} }
@ -1347,8 +1345,17 @@ namespace geode::cocos {
private: private:
F m_func; F m_func;
// F may not be default-constructible
CallFuncExtImpl(F&& func) : m_func(std::move(func)) {}
CallFuncExtImpl(F const& func) : m_func(func) {}
void update(float) override { void update(float) override {
if (m_func) this->m_func(); // Make sure any `std::function`s are valid
if constexpr (requires { static_cast<bool>(m_func); }) {
if (m_func) m_func();
} else {
m_func();
}
} }
}; };

View file

@ -28,6 +28,7 @@ public:
DownloadStatus m_status; DownloadStatus m_status;
EventListener<ServerRequest<ServerModVersion>> m_infoListener; EventListener<ServerRequest<ServerModVersion>> m_infoListener;
EventListener<web::WebTask> m_downloadListener; EventListener<web::WebTask> m_downloadListener;
unsigned int m_scheduledEventForFrame = 0;
Impl( Impl(
std::string const& id, std::string const& id,
@ -83,7 +84,14 @@ public:
} }
if (!ModDownloadManager::get()->checkAutoConfirm()) { if (!ModDownloadManager::get()->checkAutoConfirm()) {
ModDownloadEvent(m_id).post(); // Throttle events to only once per frame to not cause a
// billion UI updates at once
if (m_scheduledEventForFrame != CCDirector::get()->getTotalFrames()) {
m_scheduledEventForFrame = CCDirector::get()->getTotalFrames();
Loader::get()->queueInMainThread([id = m_id]() {
ModDownloadEvent(id).post();
});
}
} }
}); });
auto fetchVersion = version.has_value() ? ModVersion(*version) : ModVersion(ModVersionLatest()); auto fetchVersion = version.has_value() ? ModVersion(*version) : ModVersion(ModVersionLatest());
@ -157,7 +165,14 @@ public:
else if (event->isCancelled()) { else if (event->isCancelled()) {
m_status = DownloadStatusCancelled(); m_status = DownloadStatusCancelled();
} }
ModDownloadEvent(m_id).post(); // Throttle events to only once per frame to not cause a
// billion UI updates at once
if (m_scheduledEventForFrame != CCDirector::get()->getTotalFrames()) {
m_scheduledEventForFrame = CCDirector::get()->getTotalFrames();
Loader::get()->queueInMainThread([id = m_id]() {
ModDownloadEvent(id).post();
});
}
}); });
auto req = web::WebRequest(); auto req = web::WebRequest();

View file

@ -466,8 +466,12 @@ void ModItem::updateState() {
if (m_enableToggle && m_source.asMod()) { if (m_enableToggle && m_source.asMod()) {
m_enableToggle->toggle(m_source.asMod()->isOrWillBeEnabled()); m_enableToggle->toggle(m_source.asMod()->isOrWillBeEnabled());
// Disable the toggle if the mod has been uninstalled // Disable the toggle if the mod has been uninstalled or if the mod is
if (modRequestedActionIsUninstall(m_source.asMod()->getRequestedAction())) { // outdated
if (
modRequestedActionIsUninstall(m_source.asMod()->getRequestedAction()) ||
m_source.asMod()->targetsOutdatedVersion()
) {
m_enableToggle->setEnabled(false); m_enableToggle->setEnabled(false);
auto off = typeinfo_cast<CCRGBAProtocol*>(m_enableToggle->m_offButton->getNormalImage()); auto off = typeinfo_cast<CCRGBAProtocol*>(m_enableToggle->m_offButton->getNormalImage());
auto on = typeinfo_cast<CCRGBAProtocol*>(m_enableToggle->m_onButton->getNormalImage()); auto on = typeinfo_cast<CCRGBAProtocol*>(m_enableToggle->m_onButton->getNormalImage());

View file

@ -672,7 +672,11 @@ void ModPopup::updateState() {
m_cancelBtn->setVisible(false); m_cancelBtn->setVisible(false);
m_enableBtn->toggle(asMod && asMod->isOrWillBeEnabled()); m_enableBtn->toggle(asMod && asMod->isOrWillBeEnabled());
m_enableBtn->setVisible(asMod && asMod->getRequestedAction() == ModRequestedAction::None); m_enableBtn->setVisible(
asMod &&
asMod->getRequestedAction() == ModRequestedAction::None &&
!asMod->targetsOutdatedVersion()
);
m_reenableBtn->toggle(m_enableBtn->isToggled()); m_reenableBtn->toggle(m_enableBtn->isToggled());
m_reenableBtn->setVisible(asMod && modRequestedActionIsToggle(asMod->getRequestedAction())); m_reenableBtn->setVisible(asMod && modRequestedActionIsToggle(asMod->getRequestedAction()));