This commit is contained in:
altalk23 2023-06-08 19:04:45 +03:00
commit 9c3759b398
52 changed files with 2283 additions and 595 deletions

View file

@ -1,5 +1,10 @@
# Geode Changelog
## v1.0.0-beta.17
* Fix `Mod::addHook` (372e2aa)
* Enable ANSI color support on Windows for logs (af8d4a0)
* Better unicode support for paths on Windows (a1e9ac4)
## v1.0.0-beta.16
* Fix mod.json not loading because of broken working directory on MacOS (d7ccfde)
* Fix markdown resources not updating between versions (b0cf6dc)

View file

@ -73,10 +73,15 @@ include(cmake/GeodeFile.cmake)
include(cmake/Platform.cmake)
include(cmake/CPM.cmake)
if (PROJECT_IS_TOP_LEVEL AND NOT GEODE_BUILDING_DOCS)
set(MAT_JSON_AS_INTERFACE ON)
endif()
CPMAddPackage("gh:geode-sdk/json#19cf6f4")
CPMAddPackage("gh:fmtlib/fmt#9.1.0")
CPMAddPackage("gh:gulrak/filesystem#3e5b930")
target_compile_definitions(${PROJECT_NAME} INTERFACE MAT_JSON_DYNAMIC=1)
# this is needed for cross compilation on linux,
# since fmtlib will fail to compile otherwise
if (GEODE_DISABLE_FMT_CONSTEVAL)

View file

@ -1 +1 @@
1.0.0-beta.17
1.0.0-beta.18

View file

@ -159,9 +159,9 @@ class cocos2d::CCDrawNode {
auto drawDot(cocos2d::CCPoint const&, float, cocos2d::_ccColor4F const&) = mac 0x379100;
auto getBlendFunc() const = mac 0x379ea0;
auto init() = mac 0x378e00;
virtual auto init() = mac 0x378e00;
auto setBlendFunc(cocos2d::_ccBlendFunc const&) = mac 0x379eb0;
auto draw() = mac 0x379020;
virtual auto draw() = mac 0x379020;
virtual ~CCDrawNode() = mac 0x378cc0;
}
@ -220,6 +220,7 @@ class cocos2d::CCEGLView {
virtual void swapBuffers() = mac 0x295510;
void updateWindow(int width, int height);
void setupWindow(cocos2d::CCRect);
bool initGlew();
void toggleFullScreen(bool fullscreen);
void pollEvents();
void onGLFWCharCallback(GLFWwindow* window, unsigned int entered);
@ -237,9 +238,12 @@ class cocos2d::CCEGLView {
}
class cocos2d::CCEGLViewProtocol {
CCEGLViewProtocol();
virtual ~CCEGLViewProtocol();
auto getViewPortRect() const = mac 0x29e2f0;
auto getScaleX() const = mac 0x29e300;
auto getScaleY() const = mac 0x29e310;
virtual auto setDesignResolutionSize(float, float, ResolutionPolicy);
auto setFrameSize(float, float) = mac 0x29d960;
}
@ -291,6 +295,8 @@ class cocos2d::CCIMEDispatcher {
class cocos2d::CCImage {
CCImage() = mac 0x24fa00;
virtual ~CCImage() = mac 0x24fa80;
auto initWithImageFile(const char*, cocos2d::CCImage::EImageFormat imageType);
auto initWithImageFileThreadSafe(const char*, cocos2d::CCImage::EImageFormat imageType);
auto initWithImageData(void*, int, cocos2d::CCImage::EImageFormat, int, int, int) = mac 0x24fcb0;
}
@ -397,7 +403,7 @@ class cocos2d::CCLayer {
}
class cocos2d::CCLayerColor {
CCLayerColor() = mac 0x274320, ios 0xc8aec, win 0xa1710;
CCLayerColor() = mac 0x274320, ios 0xc8aec;
static cocos2d::CCLayerColor* create(cocos2d::_ccColor4B const&, float, float) = mac 0x2745e0;
static cocos2d::CCLayerColor* create(cocos2d::_ccColor4B const&) = mac 0x2744c0;
virtual auto draw() = mac 0x274b50, ios 0xc8fe0;
@ -410,7 +416,7 @@ class cocos2d::CCLayerColor {
virtual auto setContentSize(cocos2d::CCSize const&) = mac 0x2749f0, ios 0xc8f64;
virtual auto setOpacity(unsigned char) = mac 0x274db0, ios 0xc9108;
virtual auto updateColor() = mac 0x274ae0, ios 0xc8f80;
virtual ~CCLayerColor() = mac 0x2743d0, ios 0x2743e0, win 0xa1a20;
virtual ~CCLayerColor() = mac 0x2743d0, ios 0x2743e0;
}
class cocos2d::CCLayerRGBA {
@ -512,6 +518,7 @@ class cocos2d::CCMotionStreak {
auto resumeStroke() = mac 0x2edb30;
auto stopStroke() = mac 0x2edb20;
bool initWithFade(float fade, float minSeg, float stroke, cocos2d::ccColor3B const& color, cocos2d::CCTexture2D* texture) = mac 0x2ed6f0;
virtual auto draw();
}
class cocos2d::CCMouseDispatcher {
@ -686,13 +693,22 @@ class cocos2d::CCObject {
}
class cocos2d::CCParticleSystem {
CCParticleSystem();
virtual ~CCParticleSystem();
virtual auto update(float);
virtual auto draw();
auto initParticle(cocos2d::tCCParticle*);
auto resetSystem() = mac 0x46bd50;
auto resumeSystem() = mac 0x46bd40;
auto stopSystem() = mac 0x46bd10;
}
class cocos2d::CCParticleSystemQuad {
CCParticleSystemQuad();
virtual ~CCParticleSystemQuad();
static cocos2d::CCParticleSystemQuad* create(char const*) = mac 0x36b000;
virtual auto draw();
auto setupVBO();
}
class cocos2d::CCPoolManager {
@ -928,6 +944,8 @@ class cocos2d::CCTexture2D {
auto initWithData(void const*, cocos2d::CCTexture2DPixelFormat, unsigned int, unsigned int, cocos2d::CCSize const&) = mac 0x2465d0;
auto setAliasTexParameters() = mac 0x247a20;
auto setAntiAliasTexParameters() = mac 0x247a80;
static void setDefaultAlphaPixelFormat(cocos2d::CCTexture2DPixelFormat);
static cocos2d::CCTexture2DPixelFormat defaultAlphaPixelFormat();
auto setMaxS(float) = mac 0x2464f0;
auto setMaxT(float) = mac 0x246510;
auto setShaderProgram(cocos2d::CCGLProgram*) = mac 0x246530;
@ -935,6 +953,13 @@ class cocos2d::CCTexture2D {
auto setTexParameters(cocos2d::_ccTexParams*) = mac 0x247980;
}
class cocos2d::CCTextureAtlas {
CCTextureAtlas();
virtual ~CCTextureAtlas();
auto drawNumberOfQuads(unsigned int, unsigned int);
auto mapBuffers();
}
class cocos2d::CCTextFieldTTF {
static auto textFieldWithPlaceHolder(char const*, char const*, float) = mac 0x126220;
}
@ -1099,6 +1124,7 @@ class cocos2d {
static float ccpDistance(cocos2d::CCPoint const&, cocos2d::CCPoint const&) = mac 0x1aaf90;
static void ccDrawPoly(cocos2d::CCPoint const*, unsigned int, bool) = mac 0xed0a0;
static void ccDrawColor4B(GLubyte, GLubyte, GLubyte, GLubyte) = mac 0xeddd0;
static void CCMessageBox(const char* msg, const char* title) = mac 0xbabc0;
}
class DS_Dictionary {

View file

@ -149,7 +149,7 @@ class BoomListView : cocos2d::CCLayer, TableViewDelegate, TableViewDataSource {
virtual void TableViewCommitCellEditingStyleForRowAtIndexPath(TableView*, TableViewCellEditingStyle, CCIndexPath&) {}
virtual void TableViewWillReloadCellForRowAtIndexPath(CCIndexPath&, TableViewCell*, TableView*) {}
virtual TableViewCell* getListCell(const char*) = mac 0x18f200, win 0x10ed0;
virtual void loadCell(TableViewCell*, unsigned int) = mac 0x18f4a0, win 0x10ff0;
virtual void loadCell(TableViewCell*, int) = mac 0x18f4a0, win 0x10ff0;
inline bool init(cocos2d::CCArray* entries, BoomListType type, float width, float height) {
return this->init(entries, height, width, 0, type);
}
@ -246,7 +246,7 @@ class ButtonSprite : cocos2d::CCSprite {
void updateBGImage(const char*) = mac 0x502d0, win 0x13af0;
static ButtonSprite* create(char const*, float) = mac 0x4fa60;
void setString(const char* txt) = mac 0x4fec0, win 0x14030;
void updateSpriteBGSize(cocos2d::CCPoint const& offset) = win 0x13c00;
void updateSpriteBGSize() = win 0x13c00;
void setColor(cocos2d::ccColor3B color) = mac 0x50410, win 0x143e0;
PAD = mac 0x18, win 0x18;
@ -261,7 +261,7 @@ class ButtonSprite : cocos2d::CCSprite {
class CCAnimatedSprite : cocos2d::CCSprite {
void runAnimation(gd::string) = mac 0x1a6430, win 0x14f60;
void tweenToAnimation(gd::string, float) = mac 0x1a65b0, win 0x15080;
static CCAnimatedSprite* create(const char* file) = win 0x14540;
static CCAnimatedSprite* createWithType(const char* file) = win 0x14540;
gd::string m_unknown1;
gd::string m_unknown2;
@ -328,7 +328,7 @@ class CCContentLayer : cocos2d::CCLayerColor {
}
class CCIndexPath : cocos2d::CCObject {
static CCIndexPath* create(unsigned int idk1, int idk2) = win 0x30e40;
static CCIndexPath* CCIndexPathWithSectionRow(int idk1, int idk2) = win 0x30e40;
inline CCIndexPath() = default;
int m_unknown1;
int m_unknown2;
@ -710,10 +710,10 @@ class ColorAction : cocos2d::CCNode {
void setupFromString(gd::string) = mac 0x17f270, win 0x11b730;
bool m_stepFinished;
cocos2d::ccColor3B m_fromColor;
cocos2d::ccColor3B m_color;
float m_currentOpacity;
float m_deltaTime;
cocos2d::ccColor3B m_color;
cocos2d::ccColor3B m_fromColor;
cocos2d::ccColor3B m_targetColor;
float m_duration;
bool m_blending;
@ -919,7 +919,7 @@ class CustomListView : BoomListView {
return CustomListView::create(entries, width, height, 0, type);
}
virtual TableViewCell* getListCell(const char*) = mac 0x10d560, win 0x58050;
virtual void loadCell(TableViewCell*, unsigned int) = mac 0x10e610, win 0x585c0;
virtual void loadCell(TableViewCell*, int) = mac 0x10e610, win 0x585c0;
virtual void setupList() = mac 0x116e70, win 0x58870;
inline CustomListView() {}
}
@ -1016,8 +1016,9 @@ class DialogLayer : cocos2d::CCLayerColor {
}
static DialogLayer* createDialogLayer(DialogObject*, cocos2d::CCArray*, int) = mac 0x2047d0, win 0x6D470, ios 0x459d0;
bool init(DialogLayer*, DialogObject*, cocos2d::CCArray*, int) = win 0x6D520;
cocos2d::CCAction* animateIn(int location) = win 0x6E130;
bool init(DialogObject*, cocos2d::CCArray*, int) = win 0x6D520;
void animateIn(DialogAnimationType location) = win 0x6E130, mac 0x205a70;
void updateChatPlacement(DialogChatPlacement placement) = mac 0x205360;
~DialogLayer() = mac 0x204720;
virtual void onEnter() = mac 0x205900, win 0x23750; // same as every other FLAlertLayer
@ -1148,7 +1149,7 @@ class EditLevelLayer : cocos2d::CCLayer, FLAlertLayerProtocol, TextInputDelegate
static EditLevelLayer* create(GJGameLevel* level) = mac 0xe1e50, win 0x6f530, ios 0x82420;
bool init(GJGameLevel* level) = mac 0xe1fd0, win 0x6f5d0;
void onLevelInfo() = win 0x70660;
void onLevelInfo(cocos2d::CCObject*) = win 0x70660;
cocos2d::CCMenu* m_buttonMenu;
GJGameLevel* m_level;
@ -1291,7 +1292,7 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ
this->updateScaleControl();
}
void constrainGameLayerPosition(float x, float y) = mac 0x18890, win 0x8f920;
void moveGameLayer(cocos2d::CCPoint const& pos) = mac 0x1ca90, win 0x79290;
void moveGamelayer(cocos2d::CCPoint pos) = mac 0x1ca90, win 0x79290;
void showUI(bool show) = mac 0x245b0, win 0x87180;
void resetUI() = mac 0x18520, win 0x7ac10;
void editObject2(cocos2d::CCObject* sender) = win 0x8d1b0;
@ -2321,7 +2322,7 @@ class GJGarageLayer : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol,
}
void onPlayerColor1(cocos2d::CCObject*) = mac 0x1ba640, win 0x129470, ios 0x22531c;
void onPlayerColor2(cocos2d::CCObject*) = mac 0x1ba8c0, win 0x129590, ios 0x225408;
static GJGarageLayer* create() = win 0x125220;
static GJGarageLayer* node() = win 0x125220;
virtual bool init() = mac 0x1b4980, win 0x1255d0;
void onSelectTab(cocos2d::CCObject* sender) = win 0x127c30;
void onPlayerIcon(cocos2d::CCObject* sender) = win 0x127f30;
@ -2381,12 +2382,12 @@ class GJItemIcon : cocos2d::CCSprite {
}
class GJLevelScoreCell : TableViewCell {
void updateBGColor(unsigned int index) = win 0x5c6b0;
void updateBGColor(int index) = win 0x5c6b0;
}
class GJListLayer : cocos2d::CCLayerColor {
~GJListLayer() = mac 0x344350;
static GJListLayer* create(cocos2d::CCObject* target, const char* title, cocos2d::ccColor4B color, float width, float height) = mac 0x343e10, win 0x12e000;
static GJListLayer* create(BoomListView* target, const char* title, cocos2d::ccColor4B color, float width, float height) = mac 0x343e10, win 0x12e000;
BoomListView* m_listView;
}
@ -2409,7 +2410,7 @@ class GJMapPack : cocos2d::CCNode {
}
class GJMessageCell : TableViewCell {
void updateBGColor(unsigned int index) = win 0x5c6b0;
void updateBGColor(int index) = win 0x5c6b0;
void loadFromMessage(GJUserMessage *) = win 0x64b60;
}
@ -2419,7 +2420,7 @@ class GJOptionsLayer : FLAlertLayer {
}
class GJRequestCell : TableViewCell {
void updateBGColor(unsigned int index) = win 0x5c6b0;
void updateBGColor(int index) = win 0x5c6b0;
}
class GJRewardDelegate {}
@ -2461,7 +2462,7 @@ class GJRotationControl : cocos2d::CCLayer {
m_sliderThumb->setPosition(m_sliderPosition);
}
void updateSliderPosition(cocos2d::CCPoint const& pos) = win 0x94020;
void updateSliderPosition(cocos2d::CCPoint pos) = win 0x94020;
float m_unknown0;
float m_unknown1;
@ -2505,7 +2506,7 @@ class GJScoreCell : TableViewCell {
virtual void FLAlert_Clicked(FLAlertLayer*, bool) = win 0x624a0;
void loadFromScore(GJUserScore* score) = win 0x61440;
void onViewProfile(cocos2d::CCObject* sender) = win 0x62380;
void updateBGColor(unsigned int index) = win 0x5c6b0;
void updateBGColor(int index) = win 0x5c6b0;
}
class GJSearchObject : cocos2d::CCNode {
@ -2565,7 +2566,7 @@ class GJSpriteColor : cocos2d::CCNode {
}
class GJUserCell : TableViewCell {
void updateBGColor(unsigned int index) = win 0x5c6b0;
void updateBGColor(int index) = win 0x5c6b0;
}
class GJUserMessage : cocos2d::CCNode {
@ -2702,7 +2703,7 @@ class GameLevelManager : cocos2d::CCNode {
GJGameLevel* getMainLevel(int id, bool unk) = win 0xa0940;
bool hasLikedItemFullCheck(LikeItemType type, int itemID, int commentSourceID) = mac 0x2d83d0;
bool hasRatedLevelStars(int levelID) = mac 0x2ca3a0;
callback void ProcessHttpRequest(gd::string, gd::string, gd::string, int) = mac 0x2a8670, win 0x9f8e0;
callback void ProcessHttpRequest(gd::string, gd::string, gd::string, GJHttpType) = mac 0x2a8670, win 0x9f8e0;
cocos2d::CCDictionary* responseToDict(gd::string response, bool comment) = win 0xbba50;
void storeUserNames(gd::string) = win 0xa1840;
gd::string userNameForUserID(int id) = win 0xa1c20;
@ -3059,7 +3060,7 @@ class GameObject : CCSpritePlus {
GameObject() = mac 0xdc4c0, win 0x983e0; // yeah why is this here wtf, seems life ego ctor created this
~GameObject() = mac 0x2f4ca0, win 0xcf340;
virtual void update(float) = mac 0x2fbb90, win 0xce440;
virtual void update(float) = mac 0x2fbb90, win 0x30e00;
virtual void setScaleX(float) = mac 0x335b00, win 0xe5050;
virtual void setScaleY(float) = mac 0x335b90, win 0xe50e0;
virtual void setScale(float) = mac 0x335c20, win 0xe5170;
@ -3114,7 +3115,7 @@ class GameObject : CCSpritePlus {
void activatedByPlayer(GameObject*) = mac 0x342a20, win 0xef0e0;
void addColorSprite() = mac 0x2f7fe0, win 0xd0670;
void addColorSpriteToParent(bool) = mac 0x2fb470, win 0xeb3f0;
void addGlow() = mac 0x2f5c10;
void addGlow() = mac 0x2f5c10, win 0xcfef0;
void addToTempOffset(float, float) = mac 0x335700;
void calculateOrientedBox() = mac 0x342b20, win 0xef1a0;
void canChangeCustomColor() = mac 0x342db0;
@ -3387,7 +3388,6 @@ class GameStatsManager : cocos2d::CCNode {
void awardSecretKey() = mac 0x4b1e0;
int getAwardedCurrencyForLevel(GJGameLevel*) = win 0xf83e0;
int getBaseCurrencyForLevel(GJGameLevel*) = win 0xf8530;
const char* getCoinKey(int) = win 0xbda50;
GJChallengeItem* getChallenge(int id) = win 0xa2fb0;
void getSecretCoinKey(char const*) = mac 0x429f0;
int getStat(char const*) = mac 0x3d310, win 0xf3580;
@ -3433,14 +3433,13 @@ class GameStatsManager : cocos2d::CCNode {
}
class GameToolbox {
static gd::string stringFromHSV(cocos2d::ccHSVValue hsv) = mac 0x28cf90;
static cocos2d::ccHSVValue hsvFromString(gd::string str) = mac 0x28cc30;
static gd::string stringFromHSV(cocos2d::ccHSVValue hsv, const char* separator) = mac 0x28cf90;
static cocos2d::ccHSVValue hsvFromString(gd::string str, char const* separator) = mac 0x28cc30, win 0x26da0;
static cocos2d::CCDictionary* stringSetupToDict(gd::string text, char const* delimeter) = mac 0x28d700, win 0x272a0;
static CCMenuItemToggler* createToggleButton(gd::string text, cocos2d::SEL_MenuHandler onToggled, bool isToggled, cocos2d::CCMenu* toggleMenu, cocos2d::CCPoint position, cocos2d::CCNode* callbackTarget, cocos2d::CCNode* labelParent, cocos2d::CCArray* toggleArray) = mac 0x28bc90, win 0x25fe0;
static CCMenuItemToggler* createToggleButton(gd::string text, cocos2d::SEL_MenuHandler onToggled, bool isToggled, cocos2d::CCMenu* toggleMenu, cocos2d::CCPoint position, cocos2d::CCNode* callbackTarget, cocos2d::CCNode* labelParent, float checkboxScale, float labelSize, float maxWidth, cocos2d::CCPoint labelOffset, const char* unknown, bool anchorHorizontally, int toggleTag, cocos2d::CCArray* toggleArray) = mac 0x28bdd0, win 0x25fe0;
static void transformColor(cocos2d::ccColor3B* src, cocos2d::ccColor3B* dest, cocos2d::ccHSVValue hsv) = win 0x26a60;
static void alignItemsHorisontally(cocos2d::CCArray* array, bool idk, cocos2d::CCPoint start, float pad) = win 0x25b20;
static cocos2d::_ccHSVValue hsvFromString(gd::string, char const*) = mac 0x28cc30, win 0x26da0;
static cocos2d::ccColor3B transformColor(cocos2d::ccColor3B const& src, cocos2d::ccHSVValue hsv) = win 0x26a60;
static void alignItemsHorisontally(cocos2d::CCArray* array, float pad, cocos2d::CCPoint start, bool idk) = win 0x25b20;
static gd::map<gd::string, gd::string> stringSetupToMap(gd::string, char const*) = mac 0x28d4c0;
static cocos2d::ccColor3B multipliedColorValue(cocos2d::ccColor3B color1, cocos2d::ccColor3B color2, float factor) = win 0x26CE0;
}
@ -3472,7 +3471,7 @@ class GaragePage : cocos2d::CCLayer, ListButtonBarDelegate {
}
class GauntletSelectLayer {
static GauntletSelectLayer* create() = win 0x105120;
static GauntletSelectLayer* create(int) = win 0x105120;
}
class GhostTrailEffect {}
@ -3511,10 +3510,10 @@ class HardStreak : cocos2d::CCDrawNode {
}
class InfoAlertButton : CCMenuItemSpriteExtra {
bool init(gd::string const& title, gd::string const& text, float scale) = win 0x14ef50;
bool init(gd::string title, gd::string text, float scale) = win 0x14ef50;
void activate() = win 0x14f050;
inline InfoAlertButton() {}
static InfoAlertButton* create(gd::string const& title, gd::string const& text, float scale) = win 0x14ed20, mac 0x2ecad0;
static InfoAlertButton* create(gd::string title, gd::string text, float scale) = win 0x14ed20, mac 0x2ecad0;
}
class InfoLayer : FLAlertLayer, LevelCommentDelegate, CommentUploadDelegate, FLAlertLayerProtocol {
@ -3522,7 +3521,7 @@ class InfoLayer : FLAlertLayer, LevelCommentDelegate, CommentUploadDelegate, FLA
void setupCommentsBrowser(cocos2d::CCArray* comments) = win 0x152270;
void onMore(cocos2d::CCObject* sender) = win 0x151500;
void onLevelInfo(cocos2d::CCObject* sender) = win 0x151850;
void loadPage(int page) = win 0x151e70;
void loadPage(int page, bool) = win 0x151e70;
static InfoLayer* create(GJGameLevel* level, GJUserScore* score) = win 0x14f4f0;
GJGameLevel* m_level;
@ -3610,7 +3609,7 @@ class LevelCell : TableViewCell {
void onViewProfile(cocos2d::CCObject*) = win 0x5c790;
void loadCustomLevelCell() = mac 0x1183b0, win 0x5a020;
void updateBGColor(unsigned int index) = win 0x5c6b0;
void updateBGColor(int index) = win 0x5c6b0;
}
class LevelCommentDelegate {
@ -3865,8 +3864,8 @@ class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDeleg
class LevelLeaderboard : FLAlertLayer {
void onChangeType(cocos2d::CCObject* sender) = win 0x17d090;
void onGarage(cocos2d::CCObject* sender) = win 0x17d1b0;
bool init(GJGameLevel* level, int type) = mac 0x20d710, win 0x17c4f0;
void onUpdate(cocos2d::CCObject* sender) = win 0x17d1b0;
bool init(GJGameLevel* level, LevelLeaderboardType type) = mac 0x20d710, win 0x17c4f0;
static LevelLeaderboard* create(GJGameLevel* level, LevelLeaderboardType leaderboardType) = win 0x17c440;
}
@ -3900,6 +3899,14 @@ class LevelSettingsDelegate {
virtual void levelSettingsUpdated() {}
}
class SecretLayer4 : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, DialogDelegate {
static SecretLayer4* create() = mac 0x1ed500;
static cocos2d::CCScene* scene() = mac 0x1ed4c0;
bool init() = mac 0x1ed640;
void showDialog(int message) = mac 0x1effd0;
}
class SelectArtDelegate {
virtual void selectArtClosed(SelectArtLayer*) {}
}
@ -4068,11 +4075,11 @@ class LocalLevelManager : GManager {
}
class MapPackCell : TableViewCell {
void updateBGColor(unsigned int index) = win 0x5c6b0;
void updateBGColor(int index) = win 0x5c6b0;
void loadFromMapPack(GJMapPack *) = win 0x5cac0;
}
class MenuGameLayer {
class MenuGameLayer : cocos2d::CCLayer {
void resetPlayer() = mac 0x28fdc0, win 0x18f4b0;
void destroyPlayer() = win 0x190100;
virtual void update(float) = mac 0x28fa70, win 0x18f190;
@ -4118,7 +4125,7 @@ class MoreSearchLayer : FLAlertLayer {
virtual bool init() = win 0x1825c0;
}
class MoreOptionsLayer {
class MoreOptionsLayer : FLAlertLayer, TextInputDelegate, GooglePlayDelegate {
static MoreOptionsLayer* create() = win 0x1de850;
virtual bool init() = mac 0x43f470, win 0x1DE8F0;
void addToggle(const char* name, const char* key, const char* info) = mac 0x440430, win 0x1df6b0;
@ -4722,10 +4729,10 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate {
void preCollision() = mac 0x21ccc0;
void preSlopeCollision(float, GameObject*) = mac 0x21ec80;
void propellPlayer(float) = mac 0x22d8e0, win 0x1f8b50;
void pushButton(int) = mac 0x22aa00, win 0x1f4e40;
void pushButton(PlayerButton) = mac 0x22aa00, win 0x1f4e40;
void pushDown() = mac 0x22dbd0;
void pushPlayer(float) = mac 0x22dbb0;
void releaseButton(int) = mac 0x22b6f0, win 0x1f4f70;
void releaseButton(PlayerButton) = mac 0x22b6f0, win 0x1f4f70;
void removeAllParticles() = mac 0x218ac0;
void removePendingCheckpoint() = mac 0x2237b0, win 0x1fa260;
void resetAllParticles() = mac 0x21adb0, win 0x1e8ef0;
@ -5285,7 +5292,7 @@ class SliderTouchLogic : cocos2d::CCMenu {
}
class SongCell : TableViewCell {
void updateBGColor(unsigned int index) = win 0x5c6b0;
void updateBGColor(int index) = win 0x5c6b0;
}
class SongInfoLayer : FLAlertLayer {
@ -5345,7 +5352,7 @@ class StartPosObject : EffectGameObject {
class StatsCell : TableViewCell {
inline StatsCell() {}
inline StatsCell(char const* identifier, float parentHeight, float height) : TableViewCell(identifier, parentHeight, height) {}
void updateBGColor(unsigned int index) = win 0x59cf0;
void updateBGColor(int index) = win 0x59cf0;
virtual void draw() = mac 0x11bf80, win 0x59d40;
}
@ -5449,7 +5456,7 @@ class TeleportPortalObject : GameObject {
}
class TextAlertPopup : cocos2d::CCNode {
static TextAlertPopup* create(gd::string const& text, float time, float scale) = win 0x1450b0;
static TextAlertPopup* create(gd::string text, float time, float scale) = win 0x1450b0;
}
class TextArea : cocos2d::CCSprite {
@ -5557,9 +5564,27 @@ class UploadPopupDelegate {
class UserInfoDelegate {}
class VideoOptionsLayer : FLAlertLayer {
PAD = win 0x18;
VideoOptionsLayer* create() = win 0x1e0d70;
bool init() = win 0x1e0e10;
void onAdvanced(cocos2d::CCObject*) = win 0x1e1b40;
void onFullscreen(cocos2d::CCObject*) = win 0x1e1b60;
void onTextureQualityNext(cocos2d::CCObject*) = win 0x1e1b80;
void onTextureQualityPrev(cocos2d::CCObject*) = win 0x1e1b90;
void updateTextureQuality(int index) = win 0x1e1ba0;
void onResolutionPrev(cocos2d::CCObject*) = win 0x1e1c40;
void onResolutionNext(cocos2d::CCObject*) = win 0x1e1c50;
void updateResolution(int index) = win 0x1e1c60;
void toggleResolution() = win 0x1e1d90;
void onApply(cocos2d::CCObject*) = win 0x1e1e70;
CCMenuItemSpriteExtra* m_prevResolution;
CCMenuItemSpriteExtra* m_nextResolution;
cocos2d::CCLabelBMFont* m_resolutionLabel;
cocos2d::CCLabelBMFont* m_resolutionText;
cocos2d::CCLabelBMFont* m_qualityLabel;
cocos2d::TextureQuality m_quality;
cocos2d::CCArray* m_resolutions;
PAD = win 0x4;
bool m_isFullscreen;
int m_currentResolution;
}
@ -5570,9 +5595,9 @@ class LevelTools {
static bool verifyLevelIntegrity(gd::string, int) = mac 0x294360, win 0x18b180;
static float xPosForTime(float, cocos2d::CCArray*, int) = mac 0x293d90, win 0x18acd0;
static float timeForXPos(float, cocos2d::CCArray*, int) = mac 0x293eb0, win 0x18ae70;
static gd::string getAudioFilename(int) = mac 0x292840;
static gd::string getAudioFileName(int) = mac 0x292840;
static gd::string getAudioTitle(int) = mac 0x2922f0;
static gd::string getArtistForAudio(int) = mac 0x292d90;
static gd::string getURLForAudio(int) = mac 0x292f10;
static gd::string artistForAudio(int) = mac 0x292d90;
static gd::string urlForAudio(int) = mac 0x292f10;
}
// clang-format on

View file

@ -7,6 +7,8 @@ if (NOT DEFINED GEODE_TARGET_PLATFORM)
endif()
elseif(WIN32)
set(GEODE_TARGET_PLATFORM "Win32")
elseif(ANDROID)
set(GEODE_TARGET_PLATFORM "Android")
else()
message(FATAL_ERROR "Unable to detect platform, please set GEODE_TARGET_PLATFORM in the root CMake file.")
endif()
@ -64,5 +66,17 @@ elseif (GEODE_TARGET_PLATFORM STREQUAL "Win32")
# Windows links against .lib and not .dll
set(GEODE_PLATFORM_BINARY "Geode.lib")
elseif (GEODE_TARGET_PLATFORM STREQUAL "Android")
message(FATAL_ERROR "IDK figure it out")
set_target_properties(${PROJECT_NAME} PROPERTIES
SYSTEM_NAME Android
)
target_link_libraries(${PROJECT_NAME} INTERFACE
${GEODE_LOADER_PATH}/include/link/android/libcocos2dcpp.so
${GEODE_LOADER_PATH}/include/link/android/libcurl.a
${GEODE_LOADER_PATH}/include/link/android/libssl.a
${GEODE_LOADER_PATH}/include/link/android/libcrypto.a
log
)
set(GEODE_PLATFORM_BINARY "Geode.so")
endif()

View file

@ -1,10 +1,12 @@
#include "Shared.hpp"
#include <ghc/filesystem.hpp> // bruh
using namespace codegen;
int main(int argc, char** argv) try {
if (argc != 4) throw codegen::error("Invalid number of parameters (expected 3 found {})", argc-1);
if (argc != 4)
throw codegen::error("Invalid number of parameters (expected 3 found {})", argc - 1);
std::string p = argv[1];
@ -14,7 +16,8 @@ int main(int argc, char** argv) try {
else if (p == "Android") codegen::platform = Platform::Android;
else throw codegen::error("Invalid platform {}\n", p);
chdir(argv[2]);
auto rootDir = ghc::filesystem::path(argv[2]);
ghc::filesystem::current_path(rootDir);
auto writeDir = ghc::filesystem::path(argv[3]) / "Geode";
ghc::filesystem::create_directories(writeDir);
@ -25,7 +28,8 @@ int main(int argc, char** argv) try {
for (auto cls : root.classes) {
for (auto dep : cls.depends) {
if(!is_cocos_class(dep) && std::find(root.classes.begin(), root.classes.end(), dep) == root.classes.end()) {
if (!is_cocos_class(dep) &&
std::find(root.classes.begin(), root.classes.end(), dep) == root.classes.end()) {
throw codegen::error("Class {} depends on unknown class {}", cls.name, dep);
}
}
@ -38,7 +42,9 @@ int main(int argc, char** argv) try {
writeFile(writeDir / "GeneratedBinding.hpp", generateBindingHeader(root, writeDir / "binding"));
writeFile(writeDir / "GeneratedPredeclare.hpp", generatePredeclareHeader(root));
writeFile(writeDir / "GeneratedSource.cpp", generateBindingSource(root));
} catch(std::exception& e) {
}
catch (std::exception& e) {
std::cout << "Codegen error: " << e.what() << "\n";
return 1;
}

View file

@ -4,8 +4,8 @@
#include <broma.hpp>
#include <fmt/format.h>
#include <fmt/ranges.h>
#include <ghc/filesystem.hpp>
#include <fstream>
#include <ghc/filesystem.hpp>
using std::istreambuf_iterator;
@ -13,12 +13,6 @@ using std::istreambuf_iterator;
#pragma warning(disable : 4996)
#endif
#if _WIN32
#include <direct.h>
#else
#include <unistd.h>
#endif
std::string generateAddressHeader(Root& root);
std::string generateModifyHeader(Root& root, ghc::filesystem::path const& singleFolder);
std::string generateWrapperHeader(Root& root);
@ -113,13 +107,12 @@ namespace codegen {
return BindStatus::Binded;
}
if (fb->type == FunctionType::Normal) {
if (field.parent.rfind("fmod::", 0) == 0) return BindStatus::Binded;
if (
(field.parent.rfind("cocos2d::", 0) == 0 || field.parent == "DS_Dictionary") &&
p == Platform::Windows
) return BindStatus::Binded;
if ((field.parent.rfind("cocos2d::", 0) == 0 || field.parent == "DS_Dictionary") &&
p == Platform::Windows)
return BindStatus::Binded;
}
return BindStatus::Unbindable;

View file

@ -43,6 +43,7 @@ file(GLOB SOURCES CONFIGURE_DEPENDS
src/internal/*.cpp
src/platform/mac/*.cpp
src/platform/ios/*.cpp
src/platform/android/*.cpp
src/loader/*.cpp
src/main.cpp
src/utils/*.cpp
@ -87,6 +88,13 @@ elseif(APPLE)
list(APPEND SOURCES ${MAC_SOURCES})
list(APPEND SOURCES ${OBJC_SOURCES})
elseif(ANDROID)
file(GLOB ANDROID_SOURCES CONFIGURE_DEPENDS
src/platform/android/*.cpp
)
list(APPEND SOURCES ${ANDROID_SOURCES})
endif()
# Embed version info in binary
@ -149,7 +157,7 @@ if (APPLE)
#set_property(TARGET ${PROJECT_NAME} PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_COMMAND} -E time")
endif()
target_compile_definitions(${PROJECT_NAME} PUBLIC GEODE_EXPORTING)
target_compile_definitions(${PROJECT_NAME} PUBLIC GEODE_EXPORTING MAT_JSON_EXPORTING)
# These are only needed for building source :-)
if (NOT GEODE_BUILDING_DOCS)
@ -204,17 +212,6 @@ if (APPLE)
elseif (WIN32)
add_subdirectory(launcher/windows)
CPMAddPackage("gh:TsudaKageyu/minhook#49d03ad")
target_link_libraries(${PROJECT_NAME} minhook)
# target_include_directories(${PROJECT_NAME} PRIVATE dobby/include)
# target_link_directories(${PROJECT_NAME} PRIVATE dobby)
# target_link_libraries(${PROJECT_NAME} dobby)
# set(DOBBY_GENERATE_SHARED OFF CACHE BOOL "Build dobby shared library" FORCE)
# # set(DOBBY_DEBUG ON CACHE BOOL "Build dobby shared library" FORCE)
# add_subdirectory(dobby)
target_link_libraries(${PROJECT_NAME} dbghelp)
# disable warnings about CCNode::setID

View file

@ -80,6 +80,8 @@ namespace geode {
GEODE_MACOS(GEODE_FILL_CONSTRUCTOR(Class_, 0){}) \
GEODE_IOS(GEODE_FILL_CONSTRUCTOR(Class_, 0){}) \
GEODE_WINDOWS(Class_(geode::CutoffConstructorType, size_t fill) \
: Class_() {}) \
GEODE_ANDROID(Class_(geode::CutoffConstructorType, size_t fill) \
: Class_() {})
#define GEODE_CUTOFF_CONSTRUCTOR_COCOS(Class_, Base_) \
@ -88,6 +90,8 @@ namespace geode {
GEODE_IOS(Class_(geode::CutoffConstructorType, size_t fill) \
: Base_(geode::CutoffConstructor, fill){}) \
GEODE_WINDOWS(Class_(geode::CutoffConstructorType, size_t fill) \
: Class_() {}) \
GEODE_ANDROID(Class_(geode::CutoffConstructorType, size_t fill) \
: Class_() {})
#define GEODE_CUTOFF_CONSTRUCTOR_GD(Class_, Base_) \
@ -96,10 +100,13 @@ namespace geode {
GEODE_MACOS(Class_(geode::CutoffConstructorType, size_t fill) \
: Base_(geode::CutoffConstructor, fill){}) \
GEODE_IOS(Class_(geode::CutoffConstructorType, size_t fill) \
: Base_(geode::CutoffConstructor, fill){}) \
GEODE_ANDROID(Class_(geode::CutoffConstructorType, size_t fill) \
: Base_(geode::CutoffConstructor, fill){})
#define GEODE_CUTOFF_CONSTRUCTOR_CUTOFF(Class_, Base_) \
GEODE_WINDOWS(GEODE_FILL_CONSTRUCTOR(Class_, sizeof(Base_)) : Base_(){}) \
GEODE_ANDROID(GEODE_FILL_CONSTRUCTOR(Class_, sizeof(Base_)) : Base_(){}) \
GEODE_MACOS(Class_(geode::CutoffConstructorType, size_t fill) \
: Base_(geode::CutoffConstructor, fill){}) \
GEODE_IOS(Class_(geode::CutoffConstructorType, size_t fill) \

View file

@ -313,6 +313,25 @@ enum class LevelLeaderboardType {
Weekly = 2
};
enum class GJHttpType {
};
enum class DialogChatPlacement {
Center = 0,
Top = 1,
Bottom = 2,
};
enum class DialogAnimationType {
Instant = 0,
FromCenter = 1,
FromLeft = 2,
FromRight = 3,
FromTop = 4,
// a 5th type is defined which acts exactly the same as FromTop
};
// Geode Addition
enum class ComparisonType {
Equals = 0,

View file

@ -458,7 +458,7 @@ protected:
void setNextScene(void);
void showStats();
void createStatsLabel();
RT_REMOVE(void createStatsLabel();)
void calculateMPF();
void getFPSImageData(unsigned char** datapointer, unsigned int* length);

View file

@ -92,6 +92,11 @@ void CC_DLL ccDrawPoints( const CCPoint *points, unsigned int numberOfPoints );
/** draws a line given the origin and destination point measured in points */
void CC_DLL ccDrawLine( const CCPoint& origin, const CCPoint& destination );
RT_ADD(
/** draws an array of lines. */
void CC_DLL ccDrawLines( const CCPoint *lines, unsigned int numberOfLines );
)
/** draws a rectangle given the origin and destination point measured in points. */
void CC_DLL ccDrawRect( CCPoint origin, CCPoint destination );
@ -112,6 +117,7 @@ void CC_DLL ccDrawSolidPoly( const CCPoint *poli, unsigned int numberOfPoints, c
/** draws a circle given the center, radius and number of segments. */
void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY);
void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter);
RT_ADD(void CC_DLL ccDrawFilledCircle( const CCPoint& center, float radius, float angle, unsigned int segments);)
/** draws a quad bezier path
@warning This function could be pretty slow. Use it only for debugging purposes.

View file

@ -245,7 +245,7 @@ It should work same as apples CFSwapInt32LittleToHost(..)
Increments the GL Draws counts by one.
The number of calls per frame are displayed on the screen when the CCDirector's stats are enabled.
*/
extern unsigned int CC_DLL g_uNumberOfDraws;
extern unsigned int ACTUAL_CC_DLL g_uNumberOfDraws;
#define CC_INCREMENT_GL_DRAWS(__n__) g_uNumberOfDraws += __n__
/*******************/

Binary file not shown.

View file

@ -51,12 +51,13 @@ class CC_DLL CCMotionStreak :
public CCGLBufferedNode
#endif // EMSCRIPTEN
{
GEODE_FRIEND_MODIFY
public:
/**
* @js ctor
*/
CCMotionStreak();
GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCMotionStreak, CCNodeRGBA)
/**
* @js NA
* @lua NA
@ -112,7 +113,10 @@ public:
virtual void setOpacityModifyRGB(bool bValue);
virtual bool isOpacityModifyRGB(void);
RT_ADD(void resumeStroke(); void stopStroke(););
RT_ADD(
void resumeStroke();
void stopStroke();
)
/** When fast mode is enabled, new points are added faster but with lower precision */
inline bool isFastMode() {
@ -134,6 +138,7 @@ public:
protected:
bool m_bFastMode;
bool m_bStartingPositionInitialized;
bool m_bStroke;
/** texture used for the motion streak */
CCTexture2D* m_pTexture;
ccBlendFunc m_tBlendFunc;
@ -155,6 +160,15 @@ protected:
ccVertex2F* m_pVertices;
GLubyte* m_pColorPointer;
ccTex2F* m_pTexCoords;
RT_ADD(
bool m_bRepeatMode;
float m_fRepeatSpeed;
float m_fRepeatTime;
bool m_idk;
float m_fMaxSeg;
bool m_bDontOpacityFade;
)
};
// end of misc_nodes group

View file

@ -173,7 +173,8 @@ emitter.startSpin = 0;
*/
class CC_DLL CCParticleSystem : public CCNode, public CCTextureProtocol
{
{
GEODE_FRIEND_MODIFY
protected:
gd::string m_sPlistFile;
//! time elapsed since the start of the system (in seconds)
@ -235,8 +236,12 @@ protected:
/** weak reference to the CCSpriteBatchNode that renders the CCSprite */
CC_PROPERTY(CCParticleBatchNode*, m_pBatchNode, BatchNode);
// RobTop removed this
///CC_SYNTHESIZE(unsigned int, m_uAtlasIndex, AtlasIndex);
RT_REMOVE(
CC_SYNTHESIZE(unsigned int, m_uAtlasIndex, AtlasIndex);
)
RT_ADD(
CC_SYNTHESIZE_NV(unsigned int, m_uAtlasIndex, AtlasIndex);
)
//true if scaled or rotated
bool m_bTransformSystemDirty;
@ -373,6 +378,7 @@ public:
* @js ctor
*/
CCParticleSystem();
GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCParticleSystem, CCNode)
/**
* @js NA
* @lua NA
@ -418,6 +424,9 @@ public:
void stopSystem();
//! Kill all living particles.
void resetSystem();
RT_ADD(
void resumeSystem();
)
//! whether or not the system is full
bool isFull();
@ -431,13 +440,26 @@ public:
protected:
virtual void updateBlendFunc();
RT_ADD(
// saved/loaded in loadDefaults, loadScaledDefaults and saveDefaults
float m_fDefaultStartSize;
float m_fDefaultStartSizeVar;
// saved as m_fEndSize but not loaded,
// probably was supposed to be m_fDefaultEndSizeVar and saved and loaded as m_fEndSizeVar but was scrapped?
float m_fDefaultEndSize2;
float m_fDefaultEndSize;
float m_fDefaultModeASpeed;
float m_fDefaultModeASpeedVar;
CCPoint m_tDefaultPosVar;
)
public:
RT_ADD(
void saveDefaults(void);
void loadDefaults(void);
void loadScaledDefaults(float);
void resumeSystem(void);
void saveDefaults(void);
);
)
};
// end of particle_nodes group

View file

@ -55,7 +55,6 @@ class CC_DLL CCParticleSystemQuad : public CCParticleSystem
GEODE_FRIEND_MODIFY
protected:
ccV3F_C4B_T2F_Quad *m_pQuads; // quads to be rendered
GLushort *m_pIndices; // indices
@ -70,6 +69,7 @@ public:
* @js ctor
*/
CCParticleSystemQuad();
GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCParticleSystemQuad, CCParticleSystem)
/**
* @js NA
* @lua NA

View file

@ -49,6 +49,7 @@ public:
* @lua NA
*/
CCEGLViewProtocol();
GEODE_CUSTOM_CONSTRUCTOR_BEGIN(CCEGLViewProtocol)
/**
* @lua NA
*/
@ -57,22 +58,22 @@ public:
/** Force destroying EGL view, subclass must implement this method.
* @lua NA
*/
virtual void end() = 0;
virtual void end() {}
/** Get whether opengl render system is ready, subclass must implement this method.
* @lua NA
*/
virtual bool isOpenGLReady() = 0;
virtual bool isOpenGLReady() { return false; }
/** Exchanges the front and back buffers, subclass must implement this method.
* @lua NA
*/
virtual void swapBuffers() = 0;
virtual void swapBuffers() {}
/** Open or close IME keyboard , subclass must implement this method.
* @lua NA
*/
virtual void setIMEKeyboardState(bool bOpen) = 0;
virtual void setIMEKeyboardState(bool bOpen) {}
/**
* Get the frame size of EGL view.

View file

@ -12,6 +12,7 @@ class CC_DLL CCApplication : public CCApplicationProtocol
{
GEODE_FRIEND_MODIFY
public:
GEODE_CUSTOM_CONSTRUCTOR_BEGIN(CCApplication)
CCApplication();
virtual ~CCApplication();
@ -19,7 +20,7 @@ public:
@brief Callback by CCDirector to limit FPS.
@interval The time, expressed in seconds, between current frame and next.
*/
void setAnimationInterval(double interval);
virtual void setAnimationInterval(double interval) override;
/**
@brief Run the message loop.
@ -38,12 +39,14 @@ public:
@brief Get current language config
@return Current language config
*/
virtual ccLanguageType getCurrentLanguage();
virtual ccLanguageType getCurrentLanguage() override;
/**
@brief Get target platform
*/
virtual TargetPlatform getTargetPlatform();
virtual TargetPlatform getTargetPlatform() override;
virtual void openURL(char const* url) override;
protected:
static CCApplication * sm_pSharedApplication;

View file

@ -8,6 +8,7 @@
#else
#define CC_DLL
#endif
#define ACTUAL_CC_DLL CC_DLL
#define CC_NO_MESSAGE_PSEUDOASSERT(cond) \
if (!(cond)) { \

View file

@ -8,6 +8,7 @@
#else
#define CC_DLL
#endif
#define ACTUAL_CC_DLL CC_DLL
#define CC_ASSERT(cond) assert(cond)

View file

@ -8,6 +8,7 @@
#else
#define CC_DLL
#endif
#define ACTUAL_CC_DLL CC_DLL
#if CC_DISABLE_ASSERT > 0

View file

@ -64,10 +64,11 @@ public:
protected:
RT_REMOVE( virtual bool Create(); )
void setupWindow(cocos2d::CCRect rect);
RT_ADD(bool initGlew();)
public:
bool initGL();
void destroyGL();
RT_REMOVE(bool initGL();)
RT_REMOVE(void destroyGL();)
RT_REMOVE( virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); )
@ -153,7 +154,13 @@ protected:
RT_ADD(
GLFWwindow* m_pMainWindow;
GLFWmonitor* m_pPrimaryMonitor;
CCSize m_obWindowedSize;
)
public:
RT_ADD(
CC_SYNTHESIZE_NV(CCSize, m_obWindowedSize, WindowedSize);
)
protected:
RT_ADD(
float m_fMouseX;
float m_fMouseY;
bool m_bIsFullscreen;

View file

@ -9,8 +9,10 @@
#if defined(_USRDLL)
#define CC_DLL
#define ACTUAL_CC_DLL
#else // use a DLL library
#define CC_DLL
#define ACTUAL_CC_DLL __declspec(dllimport)
#endif
#include <assert.h>

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -1,7 +1,6 @@
/*************************************************************************
* GLFW - An OpenGL library
* API version: 3.0
* WWW: http://www.glfw.org/
* GLFW 3.1 - www.glfw.org
* A library for OpenGL, window and input
*------------------------------------------------------------------------
* Copyright (c) 2002-2006 Marcus Geelnard
* Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -41,13 +40,13 @@ extern "C" {
/*! @defgroup native Native access
*
* **By using the native API, you assert that you know what you are doing and
* how to fix problems caused by using it. If you don't, you shouldn't be
* using it.**
* **By using the native access functions you assert that you know what you're
* doing and how to fix problems caused by using them. If you don't, you
* shouldn't be using them.**
*
* Before the inclusion of @ref glfw3native.h, you must define exactly one
* window API macro and exactly one context API macro. Failure to do this
* will cause a compile-time error.
* window system API macro and exactly one context creation API macro. Failure
* to do this will cause a compile-time error.
*
* The available window API macros are:
* * `GLFW_EXPOSE_NATIVE_WIN32`
@ -60,8 +59,8 @@ extern "C" {
* * `GLFW_EXPOSE_NATIVE_GLX`
* * `GLFW_EXPOSE_NATIVE_EGL`
*
* These macros select which of the native access functions are declared and
* which platform-specific headers to include. It is then up your (by
* These macros select which of the native access functions that are declared
* and which platform-specific headers to include. It is then up your (by
* definition platform-specific) code to handle which of these should be
* defined.
*/
@ -72,8 +71,13 @@ extern "C" {
*************************************************************************/
#if defined(GLFW_EXPOSE_NATIVE_WIN32)
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
// example to allow applications to correctly declare a GL_ARB_debug_output
// callback) but windows.h assumes no one will define APIENTRY before it does
#undef APIENTRY
#include <windows.h>
#elif defined(GLFW_EXPOSE_NATIVE_COCOA)
#include <ApplicationServices/ApplicationServices.h>
#if defined(__OBJC__)
#import <Cocoa/Cocoa.h>
#else
@ -81,8 +85,9 @@ extern "C" {
#endif
#elif defined(GLFW_EXPOSE_NATIVE_X11)
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
#else
#error "No window API specified"
#error "No window API selected"
#endif
#if defined(GLFW_EXPOSE_NATIVE_WGL)
@ -94,7 +99,7 @@ extern "C" {
#elif defined(GLFW_EXPOSE_NATIVE_EGL)
#include <EGL/egl.h>
#else
#error "No context API specified"
#error "No context API selected"
#endif
@ -103,8 +108,49 @@ extern "C" {
*************************************************************************/
#if defined(GLFW_EXPOSE_NATIVE_WIN32)
/*! @brief Returns the adapter device name of the specified monitor.
*
* @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`)
* of the specified monitor, or `NULL` if an [error](@ref error_handling)
* occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.1.
*
* @ingroup native
*/
GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
/*! @brief Returns the display device name of the specified monitor.
*
* @return The UTF-8 encoded display device name (for example
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.1.
*
* @ingroup native
*/
GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
/*! @brief Returns the `HWND` of the specified window.
* @return The `HWND` of the specified window.
*
* @return The `HWND` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.0.
*
* @ingroup native
*/
GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
@ -112,15 +158,48 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
#if defined(GLFW_EXPOSE_NATIVE_WGL)
/*! @brief Returns the `HGLRC` of the specified window.
* @return The `HGLRC` of the specified window.
*
* @return The `HGLRC` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.0.
*
* @ingroup native
*/
GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_COCOA)
/*! @brief Returns the `CGDirectDisplayID` of the specified monitor.
*
* @return The `CGDirectDisplayID` of the specified monitor, or
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.1.
*
* @ingroup native
*/
GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
/*! @brief Returns the `NSWindow` of the specified window.
* @return The `NSWindow` of the specified window.
*
* @return The `NSWindow` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.0.
*
* @ingroup native
*/
GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
@ -128,7 +207,16 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
/*! @brief Returns the `NSOpenGLContext` of the specified window.
* @return The `NSOpenGLContext` of the specified window.
*
* @return The `NSOpenGLContext` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.0.
*
* @ingroup native
*/
GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
@ -136,12 +224,61 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
#if defined(GLFW_EXPOSE_NATIVE_X11)
/*! @brief Returns the `Display` used by GLFW.
* @return The `Display` used by GLFW.
*
* @return The `Display` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.0.
*
* @ingroup native
*/
GLFWAPI Display* glfwGetX11Display(void);
/*! @brief Returns the `RRCrtc` of the specified monitor.
*
* @return The `RRCrtc` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.1.
*
* @ingroup native
*/
GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
/*! @brief Returns the `RROutput` of the specified monitor.
*
* @return The `RROutput` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.1.
*
* @ingroup native
*/
GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
/*! @brief Returns the `Window` of the specified window.
* @return The `Window` of the specified window.
*
* @return The `Window` of the specified window, or `None` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.0.
*
* @ingroup native
*/
GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
@ -149,7 +286,16 @@ GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
#if defined(GLFW_EXPOSE_NATIVE_GLX)
/*! @brief Returns the `GLXContext` of the specified window.
* @return The `GLXContext` of the specified window.
*
* @return The `GLXContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.0.
*
* @ingroup native
*/
GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
@ -157,17 +303,46 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
#if defined(GLFW_EXPOSE_NATIVE_EGL)
/*! @brief Returns the `EGLDisplay` used by GLFW.
* @return The `EGLDisplay` used by GLFW.
*
* @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.0.
*
* @ingroup native
*/
GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
/*! @brief Returns the `EGLContext` of the specified window.
* @return The `EGLContext` of the specified window.
*
* @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.0.
*
* @ingroup native
*/
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
/*! @brief Returns the `EGLSurface` of the specified window.
* @return The `EGLSurface` of the specified window.
*
* @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.0.
*
* @ingroup native
*/
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);

View file

@ -81,6 +81,7 @@ public:
* @js ctor
*/
CCTextureAtlas();
GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCTextureAtlas, CCObject)
/**
* @js NA
* @lua NA

View file

@ -153,7 +153,7 @@ namespace geode {
template <class T>
T setSettingValue(std::string const& key, T const& value) {
if (auto sett = this->getSetting(key)) {
auto old = this->getSettingValue<T>(sett);
auto old = this->getSettingValue<T>(key);
SettingValueSetter<T>::set(sett, value);
return old;
}

View file

@ -58,15 +58,15 @@ namespace geode {
// clang-format off
#define $on_mod(type) \
template<class> \
void GEODE_CONCAT(geodeExecFunction, __LINE__)(ModStateEvent*); \
namespace { \
struct GEODE_CONCAT(ExecFuncUnique, __LINE__) {}; \
} \
static inline auto GEODE_CONCAT(Exec, __LINE__) = (new geode::EventListener( \
&GEODE_CONCAT(geodeExecFunction, __LINE__)<GEODE_CONCAT(ExecFuncUnique, __LINE__)>,\
geode::ModStateFilter(geode::getMod(), geode::ModEventType::type)\
), 0); \
template<class> \
void GEODE_CONCAT(geodeExecFunction, __LINE__)(ModStateEvent*)
template<class> \
void GEODE_CONCAT(geodeExecFunction, __LINE__)(geode::ModStateEvent*); \
namespace { \
struct GEODE_CONCAT(ExecFuncUnique, __LINE__) {}; \
} \
static inline auto GEODE_CONCAT(Exec, __LINE__) = (new geode::EventListener( \
&GEODE_CONCAT(geodeExecFunction, __LINE__)<GEODE_CONCAT(ExecFuncUnique, __LINE__)>, \
geode::ModStateFilter(geode::getMod(), geode::ModEventType::type) \
), 0); \
template<class> \
void GEODE_CONCAT(geodeExecFunction, __LINE__)(geode::ModStateEvent*)
// clang-format on

View file

@ -2,6 +2,12 @@
#include <dlfcn.h>
namespace geode {
struct PlatformInfo {
void* m_so;
};
}
namespace geode::base {
GEODE_NOINLINE inline uintptr_t get() {
static uintptr_t base = reinterpret_cast<uintptr_t>(dlopen("libcocos2dcpp.so", RTLD_LAZY));

View file

@ -24,7 +24,7 @@ namespace geode {
protected:
void setupList() override;
TableViewCell* getListCell(char const* key) override;
void loadCell(TableViewCell* cell, unsigned int index) override;
void loadCell(TableViewCell* cell, int index) override;
public:
/**

View file

@ -2,6 +2,7 @@
#include <Geode/DefaultInclude.hpp>
#include <memory>
#include <concepts>
namespace geode::utils {

View file

@ -276,7 +276,7 @@ namespace geode {
#define GEODE_UNWRAP_INTO(into, ...) \
auto GEODE_CONCAT(unwrap_res_, __LINE__) = (__VA_ARGS__); \
if (GEODE_CONCAT(unwrap_res_, __LINE__).isErr()) { \
return Err(std::move(GEODE_CONCAT(unwrap_res_, __LINE__).unwrapErr())); \
return geode::Err(std::move(GEODE_CONCAT(unwrap_res_, __LINE__).unwrapErr())); \
} \
into = std::move(GEODE_CONCAT(unwrap_res_, __LINE__).unwrap())
@ -284,7 +284,7 @@ namespace geode {
{ \
auto GEODE_CONCAT(unwrap_res_, __LINE__) = (__VA_ARGS__); \
if (GEODE_CONCAT(unwrap_res_, __LINE__).isErr()) { \
return Err(std::move(GEODE_CONCAT(unwrap_res_, __LINE__).unwrapErr())); \
return geode::Err(std::move(GEODE_CONCAT(unwrap_res_, __LINE__).unwrapErr())); \
} \
}
}

View file

@ -214,6 +214,8 @@ namespace geode {
return version > m_version;
case VersionCompare::Exact:
return version == m_version;
default:
return false;
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,15 @@
#include <Geode/modify/GJBaseGameLayer.hpp>
using namespace geode::prelude;
struct PickupTriggerFix : Modify<PickupTriggerFix, GJBaseGameLayer> {
void collectItem(int item, int count) {
item = std::clamp(item, 0, 1099);
GJBaseGameLayer::collectItem(item, count);
}
void collectedObject(EffectGameObject* object) {
object->m_itemBlockAID = std::clamp(object->m_itemBlockAID, 0, 1099);
GJBaseGameLayer::collectedObject(object);
}
};

View file

@ -54,6 +54,15 @@ extern "C" __attribute__((visibility("default"))) void dynamicTrigger() {
// remove when we can figure out how to not remove it
auto dynamicTriggerRef = &dynamicTrigger;
#elif defined(GEODE_IS_ANDROID)
#include <jni.h>
extern "C" [[gnu::visibility("default")]] jint JNI_OnLoad(JavaVM* vm, void* reserved) {
geodeEntry(nullptr);
return JNI_VERSION_1_1;
}
#elif defined(GEODE_IS_WINDOWS)
#include <Windows.h>

View file

@ -0,0 +1,27 @@
#include <FileWatcher.hpp>
#ifdef GEODE_IS_ANDROID
FileWatcher::FileWatcher(
ghc::filesystem::path const& file, FileWatchCallback callback, ErrorCallback error
) {
m_filemode = ghc::filesystem::is_regular_file(file);
m_platformHandle = nullptr;
m_file = file;
m_callback = callback;
m_error = error;
}
FileWatcher::~FileWatcher() {
}
void FileWatcher::watch() {
// TODO: setup inotify or something
}
bool FileWatcher::watching() const {
return false;
}
#endif

View file

@ -0,0 +1,55 @@
#include <Geode/loader/IPC.hpp>
#include <Geode/loader/Log.hpp>
#include <loader/ModImpl.hpp>
#include <iostream>
#include <loader/LoaderImpl.hpp>
#include <Geode/utils/string.hpp>
using namespace geode::prelude;
#ifdef GEODE_IS_ANDROID
#include <android/log.h>
namespace {
android_LogPriority getLogSeverityForSeverity(Severity severity) {
switch (severity) {
case Severity::Debug: return ANDROID_LOG_DEBUG;
case Severity::Info: return ANDROID_LOG_INFO;
case Severity::Warning: return ANDROID_LOG_WARN;
case Severity::Error: return ANDROID_LOG_ERROR;
default: return ANDROID_LOG_DEFAULT;
}
}
}
void Loader::Impl::platformMessageBox(char const* title, std::string const& info) {
cocos2d::CCMessageBox(info.c_str(), title);
}
void Loader::Impl::logConsoleMessageWithSeverity(std::string const& msg, Severity severity) {
__android_log_print(
getLogSeverityForSeverity(severity),
"Geode",
"%s",
msg.c_str()
);
}
void Loader::Impl::openPlatformConsole() {
return;
}
void Loader::Impl::closePlatformConsole() {
return;
}
void Loader::Impl::setupIPC() {
log::warn("IPC is not supported on this platform!");
}
bool Loader::Impl::userTriedToLoadDLLs() const {
return false;
}
#endif

View file

@ -0,0 +1,36 @@
#include <Geode/DefaultInclude.hpp>
#ifdef GEODE_IS_ANDROID
#include <Geode/loader/Mod.hpp>
#include <loader/ModImpl.hpp>
using namespace geode::prelude;
Result<> Mod::Impl::loadPlatformBinary() {
auto so = dlopen((m_tempDirName / m_info.binaryName()).string().c_str(), RTLD_LAZY);
if (so) {
if (m_platformInfo) {
delete m_platformInfo;
}
m_platformInfo = new PlatformInfo{so};
return Ok();
}
std::string err = dlerror();
return Err("Unable to load the SO: dlerror returned (" + err + ")");
}
Result<> Mod::Impl::unloadPlatformBinary() {
auto so = m_platformInfo->m_so;
delete m_platformInfo;
m_platformInfo = nullptr;
if (dlclose(so) == 0) {
return Ok();
}
else {
return Err("Unable to free library");
}
}
#endif

View file

@ -0,0 +1,17 @@
#include <crashlog.hpp>
#ifdef GEODE_IS_ANDROID
ghc::filesystem::path crashlog::getCrashLogDirectory() {
return geode::dirs::getSaveDir();
}
bool crashlog::setupPlatformHandler() {
return false;
}
bool crashlog::didLastLaunchCrash() {
return false;
}
#endif

View file

@ -0,0 +1,33 @@
#include <Geode/DefaultInclude.hpp>
#ifdef GEODE_IS_ANDROID
using namespace geode::prelude;
#include <Geode/utils/cocos.hpp>
#include <Geode/loader/Dirs.hpp>
#include <Geode/utils/web.hpp>
#include <ghc/filesystem.hpp>
ghc::filesystem::path dirs::getGameDir() {
return ghc::filesystem::path(CCFileUtils::sharedFileUtils()->getWritablePath().c_str());
}
ghc::filesystem::path dirs::getSaveDir() {
return ghc::filesystem::path(CCFileUtils::sharedFileUtils()->getWritablePath().c_str());
}
void utils::web::openLinkInBrowser(std::string const& url) {
CCApplication::sharedApplication()->openURL(url.c_str());
}
bool utils::file::openFolder(ghc::filesystem::path const&) {
return false;
}
geode::Result<ghc::filesystem::path> utils::file::
pickFile(geode::utils::file::PickMode, geode::utils::file::FilePickOptions const&) {
return geode::Err("This function is currently unimplemented");
}
#endif

View file

@ -114,7 +114,7 @@ TableViewCell* HookListView::getListCell(char const* key) {
return HookCell::create(key, CCSize { m_width, m_itemSeparation });
}
void HookListView::loadCell(TableViewCell* cell, unsigned int index) {
void HookListView::loadCell(TableViewCell* cell, int index) {
as<HookCell*>(cell)->loadFromHook(
as<HookItem*>(m_entries->objectAtIndex(index))->m_hook, m_mod
);

View file

@ -39,7 +39,7 @@ protected:
void setupList() override;
TableViewCell* getListCell(char const* key) override;
void loadCell(TableViewCell* cell, unsigned int index) override;
void loadCell(TableViewCell* cell, int index) override;
public:
static HookListView* create(CCArray* hooks, Mod* Mod, float width, float height);

View file

@ -24,7 +24,8 @@
#include <loader/LoaderImpl.hpp>
static constexpr int const TAG_CONFIRM_UNINSTALL = 5;
static constexpr int const TAG_DELETE_SAVEDATA = 6;
static constexpr int const TAG_CONFIRM_UPDATE = 6;
static constexpr int const TAG_DELETE_SAVEDATA = 7;
static const CCSize LAYER_SIZE = {440.f, 290.f};
bool ModInfoPopup::init(ModInfo const& info, ModListLayer* list) {
@ -280,8 +281,17 @@ void ModInfoPopup::setInstallStatus(std::optional<UpdateProgress> const& progres
}
// LocalModInfoPopup
LocalModInfoPopup::LocalModInfoPopup()
: m_installListener(
this, &LocalModInfoPopup::onUpdateProgress,
ModInstallFilter("")
) {}
bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) {
m_item = Index::get()->getMajorItem(mod->getModInfo().id());
if (m_item)
m_installListener.setFilter(m_item->info.id());
m_mod = mod;
if (!ModInfoPopup::init(mod->getModInfo(), list)) return false;
@ -347,12 +357,8 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) {
uninstallBtn->setPosition(-85.f, 75.f);
m_buttonMenu->addChild(uninstallBtn);
auto latestIndexItem = Index::get()->getMajorItem(
mod->getModInfo().id()
);
// todo: show update button on loader that invokes the installer
if (latestIndexItem && Index::get()->isUpdateAvailable(latestIndexItem)) {
if (m_item && Index::get()->isUpdateAvailable(m_item)) {
m_installBtnSpr = IconButtonSprite::create(
"GE_button_01.png"_spr,
CCSprite::createWithSpriteFrameName("install.png"_spr),
@ -361,7 +367,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) {
);
m_installBtnSpr->setScale(.6f);
m_installBtn = CCMenuItemSpriteExtra::create(m_installBtnSpr, this, nullptr);
m_installBtn = CCMenuItemSpriteExtra::create(m_installBtnSpr, this, menu_selector(LocalModInfoPopup::onUpdate));
m_installBtn->setPosition(-8.0f, 75.f);
m_buttonMenu->addChild(m_installBtn);
@ -377,10 +383,10 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) {
// TODO: use column layout here?
if (latestIndexItem->info.version().getMajor() > minorIndexItem->info.version().getMajor()) {
if (m_item->info.version().getMajor() > minorIndexItem->info.version().getMajor()) {
// has major update
m_latestVersionLabel = CCLabelBMFont::create(
("Available: " + latestIndexItem->info.version().toString()).c_str(),
("Available: " + m_item->info.version().toString()).c_str(),
"bigFont.fnt"
);
m_latestVersionLabel->setScale(.35f);
@ -452,6 +458,101 @@ void LocalModInfoPopup::onIssues(CCObject*) {
geode::openIssueReportPopup(m_mod);
}
void LocalModInfoPopup::onUpdateProgress(ModInstallEvent* event) {
std::visit(makeVisitor {
[&](UpdateFinished const&) {
this->setInstallStatus(std::nullopt);
FLAlertLayer::create(
"Update complete",
"Mod succesfully updated! :) "
"(You may need to <cy>restart the game</c> "
"for the mod to take full effect)",
"OK"
)->show();
if (m_layer) {
m_layer->reloadList();
}
this->onClose(nullptr);
},
[&](UpdateProgress const& progress) {
this->setInstallStatus(progress);
},
[&](UpdateFailed const& info) {
this->setInstallStatus(std::nullopt);
FLAlertLayer::create(
"Update failed :(", info, "OK"
)->show();
m_installBtn->setEnabled(true);
m_installBtn->setTarget(
this, menu_selector(LocalModInfoPopup::onUpdate)
);
m_installBtnSpr->setString("Update");
m_installBtnSpr->setBG("GE_button_01.png"_spr, false);
}
}, event->status);
}
void LocalModInfoPopup::onUpdate(CCObject*) {
auto list = Index::get()->getInstallList(m_item);
if (!list) {
return FLAlertLayer::create(
"Unable to Update",
list.unwrapErr(),
"OK"
)->show();
}
auto layer = FLAlertLayer::create(
this,
"Confirm Update",
fmt::format(
"The following mods will be updated:\n {}",
// le nest
ranges::join(
ranges::map<std::vector<std::string>>(
list.unwrap().list,
[](IndexItemHandle handle) {
return fmt::format(
" - <cr>{}</c> (<cy>{}</c>)",
handle->info.name(), handle->info.id()
);
}
),
"\n "
)
),
"Cancel", "OK"
);
layer->setTag(TAG_CONFIRM_UPDATE);
layer->show();
}
void LocalModInfoPopup::onCancel(CCObject*) {
Index::get()->cancelInstall(m_item);
}
void LocalModInfoPopup::doUpdate() {
if (m_latestVersionLabel) {
m_latestVersionLabel->setVisible(false);
}
if (m_minorVersionLabel) {
m_minorVersionLabel->setVisible(false);
}
this->setInstallStatus(UpdateProgress(0, "Starting update"));
m_installBtn->setTarget(
this, menu_selector(LocalModInfoPopup::onCancel)
);
m_installBtnSpr->setString("Cancel");
m_installBtnSpr->setBG("GJ_button_06.png", false);
Index::get()->install(m_item);
}
void LocalModInfoPopup::onUninstall(CCObject*) {
auto layer = FLAlertLayer::create(
this,
@ -533,6 +634,12 @@ void LocalModInfoPopup::FLAlert_Clicked(FLAlertLayer* layer, bool btn2) {
}
this->onClose(nullptr);
} break;
case TAG_CONFIRM_UPDATE: {
if (btn2) {
this->doUpdate();
}
} break;
}
}

View file

@ -57,6 +57,8 @@ protected:
class LocalModInfoPopup : public ModInfoPopup, public FLAlertLayerProtocol {
protected:
IndexItemHandle m_item;
EventListener<ModInstallFilter> m_installListener;
Mod* m_mod;
bool init(Mod* mod, ModListLayer* list);
@ -70,11 +72,19 @@ protected:
void onOpenConfigDir(CCObject*);
void doUninstall();
void onUpdateProgress(ModInstallEvent* event);
void onUpdate(CCObject*);
void onCancel(CCObject*);
void doUpdate();
void FLAlert_Clicked(FLAlertLayer*, bool) override;
CCNode* createLogo(CCSize const& size) override;
ModInfo getModInfo() const override;
LocalModInfoPopup();
public:
static LocalModInfoPopup* create(Mod* mod, ModListLayer* list);
};

View file

@ -52,7 +52,7 @@ TableViewCell* ListView::getListCell(char const* key) {
return GenericListCell::create(key, { m_width, m_itemSeparation });
}
void ListView::loadCell(TableViewCell* cell, unsigned int index) {
void ListView::loadCell(TableViewCell* cell, int index) {
auto node = dynamic_cast<CCNode*>(m_entries->objectAtIndex(index));
if (node) {
auto lcell = as<GenericListCell*>(cell);