This commit is contained in:
ConfiG 2023-06-26 13:46:18 +03:00
commit 887f448627
No known key found for this signature in database
GPG key ID: 44DA1983F524C11B
7 changed files with 79 additions and 41 deletions

View file

@ -145,7 +145,7 @@ jobs:
dest: geode-nightly-win.zip dest: geode-nightly-win.zip
- name: Update release - name: Update release
uses: IsaacShelton/update-existing-release@v1.3.1 uses: IsaacShelton/update-existing-release@v1.3.2
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
files: ./geode-nightly-mac.zip ./geode-nightly-win.zip files: ./geode-nightly-mac.zip ./geode-nightly-win.zip

View file

@ -122,6 +122,10 @@ file(GLOB CODEGEN_DEPENDS CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/codegen/src/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/codegen/src/*.hpp
) )
if (NOT GEODE_BINDINGS_PATH)
set(GEODE_BINDINGS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bindings)
endif()
file(GLOB CODEGEN_OUTPUTS CONFIGURE_DEPENDS file(GLOB CODEGEN_OUTPUTS CONFIGURE_DEPENDS
${GEODE_CODEGEN_PATH}/Geode/binding/*.hpp ${GEODE_CODEGEN_PATH}/Geode/binding/*.hpp
) )
@ -129,7 +133,7 @@ file(GLOB CODEGEN_OUTPUTS CONFIGURE_DEPENDS
add_custom_command( add_custom_command(
DEPENDS ${CODEGEN_DEPENDS} DEPENDS ${CODEGEN_DEPENDS}
DEPENDS CodegenProject DEPENDS CodegenProject
COMMAND ${GEODE_CODEGEN_BINARY_OUT}/Codegen ${GEODE_TARGET_PLATFORM} bindings ${GEODE_CODEGEN_PATH} COMMAND ${GEODE_CODEGEN_BINARY_OUT}/Codegen ${GEODE_TARGET_PLATFORM} ${GEODE_BINDINGS_PATH} ${GEODE_CODEGEN_PATH}
COMMAND echo codegen > ${GEODE_CODEGEN_PATH}/.stamp COMMAND echo codegen > ${GEODE_CODEGEN_PATH}/.stamp
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Run Codegen" COMMENT "Run Codegen"

View file

@ -2256,7 +2256,7 @@ class GJGameLevel : cocos2d::CCNode {
void getNormalPercent() = mac 0x2b8b20; void getNormalPercent() = mac 0x2b8b20;
void levelWasAltered() = mac 0x2db530, win 0xbd550; void levelWasAltered() = mac 0x2db530, win 0xbd550;
void savePercentage(int, bool, int, int, bool) = mac 0x2db700; void savePercentage(int, bool, int, int, bool) = mac 0x2db700;
void dataLoaded(DS_Dictionary* dict) = mac 0x2922f0, win 0xbded0, ios 0x6fca4; void dataLoaded(DS_Dictionary* dict) = mac 0x2dc0e0, win 0xbded0, ios 0x6fca4;
GJDifficulty getAverageDifficulty() = win 0xbd9b0; GJDifficulty getAverageDifficulty() = win 0xbd9b0;
gd::string getUnpackedLevelDescription() = win 0xbf890; gd::string getUnpackedLevelDescription() = win 0xbf890;
gd::string lengthKeyToString(int key) = win 0xbd910; gd::string lengthKeyToString(int key) = win 0xbd910;
@ -2310,7 +2310,7 @@ class GJGameLevel : cocos2d::CCNode {
int m_chk; int m_chk;
bool m_isChkValid; bool m_isChkValid;
bool m_isCompletionLegitimate; bool m_isCompletionLegitimate;
geode::SeedValueVSR m_normalPercent; geode::SeedValueVRS m_normalPercent;
geode::SeedValueRSV m_orbCompletion; geode::SeedValueRSV m_orbCompletion;
geode::SeedValueRSV m_newNormalPercent2; geode::SeedValueRSV m_newNormalPercent2;
int m_practicePercent; int m_practicePercent;
@ -2576,8 +2576,8 @@ class GJSearchObject : cocos2d::CCNode {
return m_searchType; return m_searchType;
} }
static GJSearchObject* create(SearchType nID) = win 0xc2b90; static GJSearchObject* create(SearchType nID) = win 0xc2b90, mac 0x2df120;
static GJSearchObject* create(SearchType nID, gd::string str) = win 0xc2c80; static GJSearchObject* create(SearchType nID, gd::string str) = win 0xc2c80, mac 0x2df310;
SearchType m_searchType; SearchType m_searchType;
gd::string m_searchQuery; gd::string m_searchQuery;
@ -3670,13 +3670,13 @@ class LevelBrowserLayer : cocos2d::CCLayer {
void updateLevelsLabel() = win 0x15c350; void updateLevelsLabel() = win 0x15c350;
static LevelBrowserLayer* create(GJSearchObject* search) = mac 0x251210, win 0x159fa0, ios 0x2d0a00; static LevelBrowserLayer* create(GJSearchObject* search) = mac 0x251210, win 0x159fa0, ios 0x2d0a00;
PAD = win 0x18; PAD = win 0x18, mac 0x30;
GJListLayer* m_list; GJListLayer* m_list;
CCMenuItemSpriteExtra* m_leftArrow; CCMenuItemSpriteExtra* m_leftArrow;
CCMenuItemSpriteExtra* m_rightArrow; CCMenuItemSpriteExtra* m_rightArrow;
PAD = win 0x10; PAD = win 0x10, mac 0x20;
GJSearchObject* m_searchObject; GJSearchObject* m_searchObject;
PAD = win 0x14; PAD = win 0x14, mac 0x28;
int m_itemCount; int m_itemCount;
int m_pageStartIdx; int m_pageStartIdx;
int m_pageEndIdx; int m_pageEndIdx;
@ -3923,14 +3923,14 @@ class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDeleg
void setupProgressBars() = win 0x177fc0; void setupProgressBars() = win 0x177fc0;
void downloadLevel() = win 0x177d90; void downloadLevel() = win 0x177d90;
PAD = win 0x4; PAD = win 0x4, mac 0x8;
cocos2d::CCMenu* m_playBtnMenu; cocos2d::CCMenu* m_playBtnMenu;
GJGameLevel* m_level; GJGameLevel* m_level;
cocos2d::CCArray* m_unknown; cocos2d::CCArray* m_unknown;
CCMenuItemSpriteExtra* m_likeBtn; CCMenuItemSpriteExtra* m_likeBtn;
CCMenuItemSpriteExtra* m_starRateBtn; CCMenuItemSpriteExtra* m_starRateBtn;
CCMenuItemSpriteExtra* m_demonRateBtn; CCMenuItemSpriteExtra* m_demonRateBtn;
PAD = win 0x4; PAD = win 0x4, mac 0x8;
CCMenuItemToggler* m_toggler; CCMenuItemToggler* m_toggler;
cocos2d::CCLabelBMFont* m_label0; cocos2d::CCLabelBMFont* m_label0;
cocos2d::CCLabelBMFont* m_label1; cocos2d::CCLabelBMFont* m_label1;
@ -3939,7 +3939,7 @@ class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDeleg
cocos2d::CCLabelBMFont* m_label4; cocos2d::CCLabelBMFont* m_label4;
cocos2d::CCLabelBMFont* m_label5; cocos2d::CCLabelBMFont* m_label5;
CCMenuItemSpriteExtra* m_cloneBtn; CCMenuItemSpriteExtra* m_cloneBtn;
PAD = win 0x4; PAD = win 0x4, mac 0x8;
} }
class LevelLeaderboard : FLAlertLayer { class LevelLeaderboard : FLAlertLayer {
@ -4148,7 +4148,7 @@ class LocalLevelManager : GManager {
cocos2d::CCDictionary* getAllLevelsInDict() = mac 0x35e3d0, win 0x18d7c0; cocos2d::CCDictionary* getAllLevelsInDict() = mac 0x35e3d0, win 0x18d7c0;
PAD = mac 0x10, win 0x1C; PAD = mac 0x4, win 0x1C;
cocos2d::CCDictionary* m_loadData; cocos2d::CCDictionary* m_loadData;
cocos2d::CCDictionary* m_levelData; cocos2d::CCDictionary* m_levelData;
cocos2d::CCArray* m_localLevels; cocos2d::CCArray* m_localLevels;

View file

@ -4,7 +4,7 @@
[project] [project]
name = "Geode" name = "Geode"
version = "v1.0.0-beta" version = "v1.0.0"
repository = "https://github.com/geode-sdk/geode" repository = "https://github.com/geode-sdk/geode"
tree = "https://github.com/geode-sdk/geode/tree/main" tree = "https://github.com/geode-sdk/geode/tree/main"
icon = "loader/resources/logos/geode-circle.png" icon = "loader/resources/logos/geode-circle.png"
@ -60,4 +60,4 @@ build-args = [
] ]
# The file we use to get all the include paths and such # The file we use to get all the include paths and such
infer-args-from = "loader/src/main.cpp" infer-args-from = "loader/src/load.cpp"

View file

@ -53,7 +53,7 @@ namespace geode {
template<class T, class N> template<class T, class N>
concept InheritsEnterLayer = std::is_base_of_v<EnterLayerEvent<N>, T>; concept InheritsEnterLayer = std::is_base_of_v<EnterLayerEvent<N>, T>;
template<class N, InheritsEnterLayer<N> T> template<class N, InheritsEnterLayer<N> T = EnterLayerEvent<N>>
class EnterLayerFilter : public EventFilter<EnterLayerEvent<N>> { class EnterLayerFilter : public EventFilter<EnterLayerEvent<N>> {
public: public:
using Callback = void(T*); using Callback = void(T*);

View file

@ -75,25 +75,14 @@ void utils::web::openLinkInBrowser(std::string const& url) {
@implementation FileDialog @implementation FileDialog
+(Result<std::vector<ghc::filesystem::path>>) filePickerWithMode:(file::PickMode)mode options:(file::FilePickOptions const&)options multiple:(bool)mult { +(Result<std::vector<ghc::filesystem::path>>) filePickerWithMode:(file::PickMode)mode options:(file::FilePickOptions const&)options multiple:(bool)mult {
NSOpenPanel* panel = [NSOpenPanel openPanel]; NSSavePanel* panel;
if (mode == file::PickMode::SaveFile)
panel = [NSSavePanel savePanel];
else
panel = [NSOpenPanel openPanel];
// allowed files [panel setCanCreateDirectories: TRUE];
NSMutableArray* allowed = [NSMutableArray array];
for (auto& f : options.filters) {
for (auto& i : f.files) {
auto nsstr = [NSString stringWithUTF8String: i.c_str()];
if (![allowed containsObject: nsstr])
[allowed addObject: nsstr];
}
}
if (options.filters.size())
[panel setAllowedFileTypes: allowed];
// multiple
[panel setAllowsMultipleSelection: mult];
// default path // default path
if (options.defaultPath) { if (options.defaultPath) {
@ -102,8 +91,36 @@ void utils::web::openLinkInBrowser(std::string const& url) {
} }
// other // other
[panel setCanChooseDirectories: NO]; if (mode != file::PickMode::SaveFile) {
[panel setCanChooseFiles: YES]; auto openPanel = (NSOpenPanel*)panel;
if (mode == file::PickMode::OpenFile){
[openPanel setCanChooseDirectories: NO];
[openPanel setCanChooseFiles: YES];
}
else {
[openPanel setCanChooseDirectories: YES];
[openPanel setCanChooseFiles: NO];
}
[openPanel setAllowsMultipleSelection: mult];
// allowed files
// TODO: allowed files using the NSOpenSavePanelDelegate xd
// NSMutableArray* allowed = [NSMutableArray array];
// for (auto& f : options.filters) {
// for (auto& i : f.files) {
// auto nsstr = [NSString stringWithUTF8String: i.c_str()];
// if (![allowed containsObject: nsstr])
// [allowed addObject: nsstr];
// }
// }
// if (options.filters.size())
// [panel setAllowedFileTypes: allowed];
}
// run thing // run thing
@ -111,11 +128,16 @@ void utils::web::openLinkInBrowser(std::string const& url) {
if (result == NSModalResponseOK) { if (result == NSModalResponseOK) {
std::vector<ghc::filesystem::path> fileURLs; std::vector<ghc::filesystem::path> fileURLs;
if (mode == file::PickMode::SaveFile) {
fileURLs.push_back(std::string([[[panel URL] path] UTF8String]));
}
else {
auto openPanel = (NSOpenPanel*)panel;
for (NSURL* i in panel.URLs) { for (NSURL* i in openPanel.URLs) {
fileURLs.push_back(std::string(i.path.UTF8String)); fileURLs.push_back(std::string(i.path.UTF8String));
} }
}
return Ok(fileURLs); return Ok(fileURLs);
} else { } else {
return Err("File picker cancelled"); return Err("File picker cancelled");
@ -143,10 +165,11 @@ Result<std::vector<ghc::filesystem::path>> utils::file::pickFiles(
} }
CCPoint cocos::getMousePos() { CCPoint cocos::getMousePos() {
auto frame = NSApp.mainWindow.frame; auto windowFrame = NSApp.mainWindow.frame;
auto scaleFactor = CCPoint(CCDirector::get()->getWinSize()) / ccp(frame.size.width, frame.size.height); auto viewFrame = NSApp.mainWindow.contentView.frame;
auto scaleFactor = CCPoint(CCDirector::get()->getWinSize()) / ccp(viewFrame.size.width, viewFrame.size.height);
auto mouse = [NSEvent mouseLocation]; auto mouse = [NSEvent mouseLocation];
return ccp(mouse.x - frame.origin.x, mouse.y - frame.origin.y) * scaleFactor; return ccp(mouse.x - windowFrame.origin.x, mouse.y - windowFrame.origin.y) * scaleFactor;
} }
ghc::filesystem::path dirs::getGameDir() { ghc::filesystem::path dirs::getGameDir() {

View file

@ -64,4 +64,15 @@ GEODE_MEMBER_CHECK(SetupPulsePopup, m_pulseMode, 0x38c);
// ColorSelectPopup // ColorSelectPopup
GEODE_MEMBER_CHECK(ColorSelectPopup, m_copyColor, 0x372); GEODE_MEMBER_CHECK(ColorSelectPopup, m_copyColor, 0x372);
// LevelInfoLayer
GEODE_MEMBER_CHECK(LevelInfoLayer, m_level, 0x1c0);
// LevelBrowserLayer
GEODE_MEMBER_CHECK(LevelBrowserLayer, m_leftArrow, 0x1a8);
GEODE_MEMBER_CHECK(LevelBrowserLayer, m_searchObject, 0x1d8);
GEODE_MEMBER_CHECK(LevelBrowserLayer, m_itemCount, 0x208);
// LocalLevelManager
GEODE_MEMBER_CHECK(LocalLevelManager, m_localLevels, 0x140);
#endif #endif