mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-22 02:45:49 -04:00
Merge branch 'main' of https://github.com/geode-sdk/geode
This commit is contained in:
commit
f6dd88aed1
5 changed files with 107 additions and 13 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.0.0-beta.8
|
||||
1.0.0-beta.9
|
|
@ -866,7 +866,7 @@ class CreatorLayer : cocos2d::CCLayer {
|
|||
void onFameLevels(cocos2d::CCObject*) = win 0x4ee70;
|
||||
void onMapPacks(cocos2d::CCObject*) = win 0x4efb0;
|
||||
void onOnlineLevels(cocos2d::CCObject*) = win 0x4ef60;
|
||||
void onGauntlets(cocos2d::CCObject*) = win 0x4f0a0;
|
||||
void onGauntlets(cocos2d::CCObject*) = mac 0x142b20, win 0x4f0a0;
|
||||
void onSecretVault(cocos2d::CCObject*) = win 0x4f1d0;
|
||||
void onTreasureRoom(cocos2d::CCObject*) = win 0x4f540;
|
||||
virtual void sceneWillResume() = win 0x4fb50;
|
||||
|
@ -1159,7 +1159,6 @@ class EditorPauseLayer : CCBlockLayer, FLAlertLayerProtocol {
|
|||
void onSong(cocos2d::CCObject*) = win 0x74e70, mac 0x13e470;
|
||||
|
||||
bool m_saved;
|
||||
PAD = mac 0x4, win 0x4;
|
||||
CCMenuItemSpriteExtra* m_guidelinesOffButton;
|
||||
CCMenuItemSpriteExtra* m_guidelinesOnButton;
|
||||
LevelEditorLayer* m_editorLayer;
|
||||
|
@ -1276,6 +1275,7 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ
|
|||
void alignObjects(cocos2d::CCArray* objs, bool alignY) = mac 0x2cea0, win 0x8f320;
|
||||
virtual void scrollWheel(float vertical, float horizontal) = win 0x921d0, mac 0x31370, ios 0x2c4884;
|
||||
void createMoveMenu() = mac 0x275e0, win 0x8c0d0;
|
||||
void sliderChanged(cocos2d::CCObject* slider) = win 0x78cc0;
|
||||
|
||||
bool m_isPlayingMusic;
|
||||
EditButtonBar* m_buttonBar;
|
||||
|
@ -3476,7 +3476,7 @@ class LeaderboardManagerDelegate {}
|
|||
|
||||
class LeaderboardsLayer : cocos2d::CCLayer {
|
||||
static LeaderboardsLayer* create(LeaderboardState state) = win 0x158710;
|
||||
bool init(LeaderboardState state) = win 0x1587b0;
|
||||
bool init(LeaderboardState state) = mac 0x29f6d0, win 0x1587b0;
|
||||
}
|
||||
|
||||
class LevelBrowserLayer : cocos2d::CCLayer {
|
||||
|
@ -3763,7 +3763,7 @@ 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) = win 0x17c4f0;
|
||||
bool init(GJGameLevel* level, int type) = mac 0x20d710, win 0x17c4f0;
|
||||
static LevelLeaderboard* create(GJGameLevel* level, LevelLeaderboardType leaderboardType) = win 0x17c440;
|
||||
}
|
||||
|
||||
|
@ -3929,6 +3929,7 @@ class LocalLevelManager : cocos2d::CCNode {
|
|||
inline static LocalLevelManager* get() {
|
||||
return LocalLevelManager::sharedState();
|
||||
}
|
||||
bool init() = mac 0x2384e0;
|
||||
|
||||
PAD = mac 0x10, win 0x1C;
|
||||
cocos2d::CCDictionary* m_loadData;
|
||||
|
@ -5406,11 +5407,15 @@ class VideoOptionsLayer : FLAlertLayer {
|
|||
}
|
||||
|
||||
class LevelTools {
|
||||
static gd::string base64EncodeString(gd::string) = win 0x18b310;
|
||||
static gd::string base64EncodeString(gd::string) = mac 0x294470, win 0x18b310;
|
||||
static gd::string base64DecodeString(gd::string) = mac 0x294510, win 0x18b3b0;
|
||||
static GJGameLevel *getLevel(int, bool) = win 0x189370;
|
||||
static bool verifyLevelIntegrity(gd::string, int) = win 0x18b180;
|
||||
static float xPosForTime(float, cocos2d::CCArray*, int) = win 0x18acd0;
|
||||
static float timeForXPos(float, cocos2d::CCArray*, int) = win 0x18ae70;
|
||||
static GJGameLevel* getLevel(int, bool) = mac 0x2908c0, win 0x189370;
|
||||
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 getAudioTitle(int) = mac 0x2922f0;
|
||||
static gd::string getArtistForAudio(int) = mac 0x292d90;
|
||||
static gd::string getURLForAudio(int) = mac 0x292f10;
|
||||
}
|
||||
// clang-format on
|
||||
|
|
|
@ -204,6 +204,50 @@ namespace geode {
|
|||
[[nodiscard]] constexpr decltype(auto) errorOr(U&& val) const& {
|
||||
return this->Base::error_or(std::forward<U>(val));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the result into an optional containing the value if Ok, and
|
||||
* nullopt if Err
|
||||
*/
|
||||
[[nodiscard]] constexpr decltype(auto) ok() const& {
|
||||
if (this->isOk()) {
|
||||
return std::optional(this->unwrap());
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the result into an optional containing the value if Ok, and
|
||||
* nullopt if Err
|
||||
*/
|
||||
[[nodiscard]] constexpr decltype(auto) ok() && {
|
||||
if (this->isOk()) {
|
||||
return std::optional(this->unwrap());
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the result into an optional containing the error if Err, and
|
||||
* nullopt if Ok
|
||||
*/
|
||||
[[nodiscard]] constexpr decltype(auto) err() const& {
|
||||
if (this->isErr()) {
|
||||
return std::optional(this->unwrapErr());
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the result into an optional containing the error if Err, and
|
||||
* nullopt if Ok
|
||||
*/
|
||||
[[nodiscard]] constexpr decltype(auto) err() && {
|
||||
if (this->isErr()) {
|
||||
return std::optional(this->unwrapErr());
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T = impl::DefaultValue>
|
||||
|
|
|
@ -187,6 +187,10 @@ namespace geode::utils::file {
|
|||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Open a folder / file in the system's file explorer
|
||||
* @param path Folder / file to open
|
||||
*/
|
||||
GEODE_DLL bool openFolder(ghc::filesystem::path const& path);
|
||||
|
||||
enum class PickMode {
|
||||
|
@ -203,10 +207,27 @@ namespace geode::utils::file {
|
|||
std::unordered_set<std::string> files;
|
||||
};
|
||||
|
||||
ghc::filesystem::path defaultPath;
|
||||
/**
|
||||
* On PickMode::SaveFile and PickMode::OpenFile, last item is assumed
|
||||
* to be a filename, unless it points to an extant directory.
|
||||
* On PickMode::OpenFolder, path is treated as leading up to a directory
|
||||
*/
|
||||
std::optional<ghc::filesystem::path> defaultPath;
|
||||
/**
|
||||
* File extension filters to show on the file picker
|
||||
*/
|
||||
std::vector<Filter> filters;
|
||||
};
|
||||
|
||||
/**
|
||||
* Prompt the user to pick a file using the system's file system picker
|
||||
* @param mode Type of file selection prompt to show
|
||||
* @param options Picker options
|
||||
*/
|
||||
GEODE_DLL Result<ghc::filesystem::path> pickFile(PickMode mode, FilePickOptions const& options);
|
||||
/**
|
||||
* Prompt the user to pick a bunch of files for opening using the system's file system picker
|
||||
* @param options Picker options
|
||||
*/
|
||||
GEODE_DLL Result<std::vector<ghc::filesystem::path>> pickFiles(FilePickOptions const& options);
|
||||
}
|
||||
|
|
|
@ -125,6 +125,14 @@ static bool setDefaultPath(
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool setDefaultFile(
|
||||
IFileDialog* dialog,
|
||||
ghc::filesystem::path const& fileName
|
||||
) {
|
||||
dialog->SetFileName(fileName.wstring().c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
struct Holder {
|
||||
T m_deallocator;
|
||||
|
@ -173,8 +181,24 @@ Result<> nfdPick(
|
|||
if (!addFiltersToDialog(dialog, options.filters)) {
|
||||
return Err("Unable to add filters to dialog");
|
||||
}
|
||||
if (!setDefaultPath(dialog, options.defaultPath)) {
|
||||
return Err("Unable to set default path to dialog");
|
||||
if (options.defaultPath && options.defaultPath.value().wstring().size()) {
|
||||
ghc::filesystem::path path = options.defaultPath.value();
|
||||
if (mode == NFDMode::OpenFile || mode == NFDMode::SaveFile) {
|
||||
if (!ghc::filesystem::exists(path) || !ghc::filesystem::is_directory(path)) {
|
||||
if (path.has_filename()) {
|
||||
setDefaultFile(dialog, path.filename());
|
||||
}
|
||||
if (path.has_parent_path()) {
|
||||
path = path.parent_path();
|
||||
}
|
||||
else {
|
||||
path = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (path.wstring().size() && !setDefaultPath(dialog, path)) {
|
||||
return Err("Unable to set default path to dialog");
|
||||
}
|
||||
}
|
||||
|
||||
if (mode == NFDMode::OpenFiles) {
|
||||
|
|
Loading…
Reference in a new issue