diff --git a/README.md b/README.md index 8d79c03f..a44fafe1 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Here's a **Hello World** mod in Geode: #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; class $modify(MenuLayer) { void onMoreGames(CCObject*) { diff --git a/loader/include/Geode/DefaultInclude.hpp b/loader/include/Geode/DefaultInclude.hpp index 6956f302..05e6805f 100644 --- a/loader/include/Geode/DefaultInclude.hpp +++ b/loader/include/Geode/DefaultInclude.hpp @@ -1,47 +1,10 @@ #pragma once +#include #include #include #include -// Because C++ doesn't like using a -// namespace that doesn't exist - -namespace geode {} - -namespace geode::addresser {} - -namespace geode::cast {} - -namespace geode::cocos {} - -namespace geode::utils {} - -namespace geode::helper {} - -namespace geode::op {} - -namespace geode::stream {} - -namespace geode::view {} - -namespace cocos2d {} - -namespace cocos2d::extension {} - -#define USE_GEODE_NAMESPACE() \ - using namespace geode; \ - using namespace geode::addresser; \ - using namespace geode::cast; \ - using namespace geode::cocos; \ - using namespace geode::helper; \ - using namespace geode::utils; \ - using namespace geode::op; \ - using namespace geode::stream; \ - using namespace geode::view; \ - using namespace cocos2d; \ - using namespace cocos2d::extension; - #define GEODE_STATIC_PTR(type, name) \ static type* s_##name; \ inline type* name() { \ diff --git a/loader/include/Geode/Prelude.hpp b/loader/include/Geode/Prelude.hpp new file mode 100644 index 00000000..a808e8a3 --- /dev/null +++ b/loader/include/Geode/Prelude.hpp @@ -0,0 +1,40 @@ +#pragma once + +// Because C++ doesn't like using +// namespaces that don't exist +namespace geode { + namespace addresser {} + namespace cast {} + namespace cocos {} + namespace utils {} + namespace helper {} + namespace op {} + namespace stream {} + namespace view {} +} + +namespace cocos2d { + namespace extension {} +} + +namespace geode { + namespace prelude { + using namespace ::geode; + using namespace ::geode::addresser; + using namespace ::geode::cast; + using namespace ::geode::cocos; + using namespace ::geode::helper; + using namespace ::geode::utils; + using namespace ::geode::op; + using namespace ::geode::stream; + using namespace ::geode::view; + using namespace ::cocos2d; + using namespace ::cocos2d::extension; + } + + namespace [[deprecated("Use `using namespace geode::prelude` instead!")]] old_prelude { + using namespace ::geode::prelude; + } +} + +#define USE_GEODE_NAMESPACE() using namespace geode::old_prelude; \ No newline at end of file diff --git a/loader/src/cocos2d-ext/CCFileUtils.cpp b/loader/src/cocos2d-ext/CCFileUtils.cpp index 8e78280a..ba4c6f49 100644 --- a/loader/src/cocos2d-ext/CCFileUtils.cpp +++ b/loader/src/cocos2d-ext/CCFileUtils.cpp @@ -3,7 +3,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; static std::vector PACKS; static std::vector PATHS; diff --git a/loader/src/cocos2d-ext/Layout.cpp b/loader/src/cocos2d-ext/Layout.cpp index c4e64a5f..b399d8d9 100644 --- a/loader/src/cocos2d-ext/Layout.cpp +++ b/loader/src/cocos2d-ext/Layout.cpp @@ -5,7 +5,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; #pragma warning(disable: 4273) diff --git a/loader/src/hooks/DynamicCastFix.cpp b/loader/src/hooks/DynamicCastFix.cpp index 2eec794a..3986eeae 100644 --- a/loader/src/hooks/DynamicCastFix.cpp +++ b/loader/src/hooks/DynamicCastFix.cpp @@ -2,7 +2,7 @@ #ifdef GEODE_IS_MACOS -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; #include #include diff --git a/loader/src/hooks/GeodeNodeMetadata.cpp b/loader/src/hooks/GeodeNodeMetadata.cpp index cf2777ac..280cc47b 100644 --- a/loader/src/hooks/GeodeNodeMetadata.cpp +++ b/loader/src/hooks/GeodeNodeMetadata.cpp @@ -4,7 +4,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; using namespace geode::modifier; #pragma warning(push) diff --git a/loader/src/hooks/LoadingLayer.cpp b/loader/src/hooks/LoadingLayer.cpp index 125cefd2..1b70c098 100644 --- a/loader/src/hooks/LoadingLayer.cpp +++ b/loader/src/hooks/LoadingLayer.cpp @@ -5,7 +5,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; struct CustomLoadingLayer : Modify { bool m_updatingResources; diff --git a/loader/src/hooks/MenuLayer.cpp b/loader/src/hooks/MenuLayer.cpp index b72c0eda..7edb0b24 100644 --- a/loader/src/hooks/MenuLayer.cpp +++ b/loader/src/hooks/MenuLayer.cpp @@ -14,7 +14,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; #pragma warning(disable : 4217) diff --git a/loader/src/hooks/MessageBoxFix.cpp b/loader/src/hooks/MessageBoxFix.cpp index 7d659109..047a659f 100644 --- a/loader/src/hooks/MessageBoxFix.cpp +++ b/loader/src/hooks/MessageBoxFix.cpp @@ -6,7 +6,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; // for some reason RobTop uses MessageBoxW in his GLFW error handler. // no one knows how this is possible (he passes char* to wchar_t*). diff --git a/loader/src/hooks/TouchDispatcherFix.cpp b/loader/src/hooks/TouchDispatcherFix.cpp index 7a3c6264..b278fe5a 100644 --- a/loader/src/hooks/TouchDispatcherFix.cpp +++ b/loader/src/hooks/TouchDispatcherFix.cpp @@ -1,4 +1,4 @@ -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; #include diff --git a/loader/src/hooks/persist.cpp b/loader/src/hooks/persist.cpp index 643aea0c..3f216069 100644 --- a/loader/src/hooks/persist.cpp +++ b/loader/src/hooks/persist.cpp @@ -1,6 +1,6 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; #include diff --git a/loader/src/hooks/save.cpp b/loader/src/hooks/save.cpp index a0db4471..c3dfde14 100644 --- a/loader/src/hooks/save.cpp +++ b/loader/src/hooks/save.cpp @@ -1,6 +1,6 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; #include diff --git a/loader/src/hooks/update.cpp b/loader/src/hooks/update.cpp index 80f90399..287fb783 100644 --- a/loader/src/hooks/update.cpp +++ b/loader/src/hooks/update.cpp @@ -1,6 +1,6 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; #include diff --git a/loader/src/hooks/updateResources.cpp b/loader/src/hooks/updateResources.cpp index c9eeaf46..d2ae3e13 100644 --- a/loader/src/hooks/updateResources.cpp +++ b/loader/src/hooks/updateResources.cpp @@ -2,7 +2,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; struct ResourcesUpdate : Modify { void loadAssets() { diff --git a/loader/src/ids/AddIDs.hpp b/loader/src/ids/AddIDs.hpp index 77693e91..15a1848b 100644 --- a/loader/src/ids/AddIDs.hpp +++ b/loader/src/ids/AddIDs.hpp @@ -3,13 +3,13 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; static constexpr int32_t GEODE_ID_PRIORITY = 0x100000; -template +template requires std::is_base_of_v -T* setIDSafe(CCNode* node, int index, const char* id) { +T* setIDSafe(CCNode* node, int index, char const* id) { if constexpr (std::is_same_v) { if (auto child = getChild(node, index)) { child->setID(id); @@ -56,8 +56,10 @@ static void switchChildrenToMenu(CCNode* parent, CCMenu* menu, Args... args) { } } -template -static CCMenu* detachAndCreateMenu(CCNode* parent, const char* menuID, Layout* layout, T first, Args... args) { +template +static CCMenu* detachAndCreateMenu( + CCNode* parent, char const* menuID, Layout* layout, T first, Args... args +) { if (!first) { auto menu = CCMenu::create(); menu->setID(menuID); diff --git a/loader/src/ids/CreatorLayer.cpp b/loader/src/ids/CreatorLayer.cpp index 1b0b05a8..48a342f8 100644 --- a/loader/src/ids/CreatorLayer.cpp +++ b/loader/src/ids/CreatorLayer.cpp @@ -4,7 +4,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; template static void reorderButtons(Args... args) { diff --git a/loader/src/ids/EditLevelLayer.cpp b/loader/src/ids/EditLevelLayer.cpp index 5a0fc534..86ec5632 100644 --- a/loader/src/ids/EditLevelLayer.cpp +++ b/loader/src/ids/EditLevelLayer.cpp @@ -5,7 +5,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; $register_ids(EditLevelLayer) { setIDs( diff --git a/loader/src/ids/EditorPauseLayer.cpp b/loader/src/ids/EditorPauseLayer.cpp index 00b96c68..7c44a3f7 100644 --- a/loader/src/ids/EditorPauseLayer.cpp +++ b/loader/src/ids/EditorPauseLayer.cpp @@ -2,7 +2,7 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; // special class for this because making it a CCMenuItemToggler would be very UB // (not gonna reinterpret_cast that into the members) diff --git a/loader/src/ids/EditorUI.cpp b/loader/src/ids/EditorUI.cpp index 29eefc35..43ca07b6 100644 --- a/loader/src/ids/EditorUI.cpp +++ b/loader/src/ids/EditorUI.cpp @@ -4,7 +4,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; $register_ids(EditorUI) { setIDSafe(this, 0, "position-slider"); diff --git a/loader/src/ids/GJGarageLayer.cpp b/loader/src/ids/GJGarageLayer.cpp index 55d3d663..57d644c5 100644 --- a/loader/src/ids/GJGarageLayer.cpp +++ b/loader/src/ids/GJGarageLayer.cpp @@ -4,7 +4,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; $register_ids(GJGarageLayer) { setIDSafe(this, 2, "username-label"); diff --git a/loader/src/ids/LevelBrowserLayer.cpp b/loader/src/ids/LevelBrowserLayer.cpp index bd7ffdc4..d3ef28e2 100644 --- a/loader/src/ids/LevelBrowserLayer.cpp +++ b/loader/src/ids/LevelBrowserLayer.cpp @@ -4,7 +4,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; $register_ids(LevelBrowserLayer) { auto winSize = CCDirector::get()->getWinSize(); diff --git a/loader/src/ids/LevelSettingsLayer.cpp b/loader/src/ids/LevelSettingsLayer.cpp index a898d013..35c27791 100644 --- a/loader/src/ids/LevelSettingsLayer.cpp +++ b/loader/src/ids/LevelSettingsLayer.cpp @@ -4,7 +4,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; $register_ids(LevelSettingsLayer) { bool startPos = m_mainLayer->getChildrenCount() < 10; diff --git a/loader/src/ids/MenuLayer.cpp b/loader/src/ids/MenuLayer.cpp index 8bc228ed..70f6486f 100644 --- a/loader/src/ids/MenuLayer.cpp +++ b/loader/src/ids/MenuLayer.cpp @@ -4,7 +4,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; $register_ids(MenuLayer) { // set IDs to everything diff --git a/loader/src/ids/PauseLayer.cpp b/loader/src/ids/PauseLayer.cpp index 2dfcb0e8..d5f9d906 100644 --- a/loader/src/ids/PauseLayer.cpp +++ b/loader/src/ids/PauseLayer.cpp @@ -4,7 +4,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; $register_ids(PauseLayer) { setIDs( diff --git a/loader/src/ids/UILayer.cpp b/loader/src/ids/UILayer.cpp index da2a216e..8ffe70ba 100644 --- a/loader/src/ids/UILayer.cpp +++ b/loader/src/ids/UILayer.cpp @@ -4,7 +4,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; $register_ids(UILayer) { if (auto menu = getChildOfType(this, 0)) { diff --git a/loader/src/loader/Dirs.cpp b/loader/src/loader/Dirs.cpp index eb463679..8935f4e5 100644 --- a/loader/src/loader/Dirs.cpp +++ b/loader/src/loader/Dirs.cpp @@ -4,7 +4,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; ghc::filesystem::path dirs::getGameDir() { return ghc::filesystem::path(CCFileUtils::sharedFileUtils()->getWritablePath2().c_str()); diff --git a/loader/src/loader/Event.cpp b/loader/src/loader/Event.cpp index 133263b2..92ebcf3c 100644 --- a/loader/src/loader/Event.cpp +++ b/loader/src/loader/Event.cpp @@ -1,6 +1,6 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; void EventListenerProtocol::enable() { Event::listeners().insert(this); diff --git a/loader/src/loader/Hook.cpp b/loader/src/loader/Hook.cpp index 752072ca..7ae74b37 100644 --- a/loader/src/loader/Hook.cpp +++ b/loader/src/loader/Hook.cpp @@ -7,7 +7,7 @@ #include "ModImpl.hpp" #include "HookImpl.hpp" -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; Hook::Hook(std::shared_ptr&& impl) : m_impl(std::move(impl)) {} Hook::~Hook() {} diff --git a/loader/src/loader/HookImpl.hpp b/loader/src/loader/HookImpl.hpp index 762cdae8..92538f4c 100644 --- a/loader/src/loader/HookImpl.hpp +++ b/loader/src/loader/HookImpl.hpp @@ -6,7 +6,7 @@ #include #include "ModImpl.hpp" -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; class Hook::Impl { public: diff --git a/loader/src/loader/IPC.cpp b/loader/src/loader/IPC.cpp index ea26d467..7fd01fed 100644 --- a/loader/src/loader/IPC.cpp +++ b/loader/src/loader/IPC.cpp @@ -1,7 +1,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; std::monostate geode::listenForIPC(std::string const& messageID, json::Value(*callback)(IPCEvent*)) { (void) new EventListener( diff --git a/loader/src/loader/Index.cpp b/loader/src/loader/Index.cpp index 4d5c0cda..ea84f529 100644 --- a/loader/src/loader/Index.cpp +++ b/loader/src/loader/Index.cpp @@ -9,7 +9,7 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; // ModInstallEvent diff --git a/loader/src/loader/Loader.cpp b/loader/src/loader/Loader.cpp index 5748de8a..706ca4b9 100644 --- a/loader/src/loader/Loader.cpp +++ b/loader/src/loader/Loader.cpp @@ -1,6 +1,6 @@ #include "LoaderImpl.hpp" -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; Loader::Loader() : m_impl(new Impl) {} diff --git a/loader/src/loader/LoaderImpl.cpp b/loader/src/loader/LoaderImpl.cpp index 5d3c97b8..5972a75a 100644 --- a/loader/src/loader/LoaderImpl.cpp +++ b/loader/src/loader/LoaderImpl.cpp @@ -25,7 +25,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; Loader::Impl* LoaderImpl::get() { return Loader::get()->m_impl.get(); diff --git a/loader/src/loader/Log.cpp b/loader/src/loader/Log.cpp index afe0b196..e17befbd 100644 --- a/loader/src/loader/Log.cpp +++ b/loader/src/loader/Log.cpp @@ -9,7 +9,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; using namespace geode::log; using namespace cocos2d; diff --git a/loader/src/loader/Mod.cpp b/loader/src/loader/Mod.cpp index 0c402e3b..3af20ee0 100644 --- a/loader/src/loader/Mod.cpp +++ b/loader/src/loader/Mod.cpp @@ -2,7 +2,7 @@ #include #include "ModImpl.hpp" -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; Mod::Mod(ModInfo const& info) : m_impl(std::make_unique(this, info)) {} diff --git a/loader/src/loader/ModEvent.cpp b/loader/src/loader/ModEvent.cpp index d83e02a5..3f063eba 100644 --- a/loader/src/loader/ModEvent.cpp +++ b/loader/src/loader/ModEvent.cpp @@ -1,6 +1,6 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; ModStateEvent::ModStateEvent(Mod* mod, ModEventType type) : m_mod(mod), m_type(type) {} diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index d0e69d2d..bf03e241 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -14,7 +14,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; Mod::Impl* ModImpl::getImpl(Mod* mod) { return mod->m_impl.get(); diff --git a/loader/src/loader/ModInfo.cpp b/loader/src/loader/ModInfo.cpp index 78a5ef63..16370f2a 100644 --- a/loader/src/loader/ModInfo.cpp +++ b/loader/src/loader/ModInfo.cpp @@ -7,7 +7,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; bool Dependency::isResolved() const { return !this->required || diff --git a/loader/src/loader/Patch.cpp b/loader/src/loader/Patch.cpp index d374bac7..c7a71c1f 100644 --- a/loader/src/loader/Patch.cpp +++ b/loader/src/loader/Patch.cpp @@ -1,7 +1,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; bool Patch::apply() { return bool(tulip::hook::writeMemory(m_address, m_patch.data(), m_patch.size())); diff --git a/loader/src/loader/Setting.cpp b/loader/src/loader/Setting.cpp index 837a05d6..ccce4622 100644 --- a/loader/src/loader/Setting.cpp +++ b/loader/src/loader/Setting.cpp @@ -9,7 +9,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; template static void parseCommon(T& sett, JsonMaybeObject& obj) { diff --git a/loader/src/loader/SettingNode.cpp b/loader/src/loader/SettingNode.cpp index ca53c63b..17f3e67b 100644 --- a/loader/src/loader/SettingNode.cpp +++ b/loader/src/loader/SettingNode.cpp @@ -1,7 +1,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; void SettingNode::dispatchChanged() { if (m_delegate) { diff --git a/loader/src/main.cpp b/loader/src/main.cpp index 14b8e105..5314365d 100644 --- a/loader/src/main.cpp +++ b/loader/src/main.cpp @@ -11,7 +11,7 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; int geodeEntry(void* platformData); // platform-specific entry points diff --git a/loader/src/platform/Objcpp.mm b/loader/src/platform/Objcpp.mm index 6d3ef6e1..7e3e9216 100644 --- a/loader/src/platform/Objcpp.mm +++ b/loader/src/platform/Objcpp.mm @@ -1,7 +1,7 @@ // Only a single objc++ file is used because since pch doesnt work, each file adds a lot to the compile times #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; #if defined(GEODE_IS_MACOS) diff --git a/loader/src/platform/ios/ModImpl.cpp b/loader/src/platform/ios/ModImpl.cpp index 64c4d465..a472e1ff 100644 --- a/loader/src/platform/ios/ModImpl.cpp +++ b/loader/src/platform/ios/ModImpl.cpp @@ -6,7 +6,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; template T findSymbolOrMangled(void* dylib, char const* name, char const* mangled) { diff --git a/loader/src/platform/ios/util.mm b/loader/src/platform/ios/util.mm index faa9ba3c..5fe585f9 100644 --- a/loader/src/platform/ios/util.mm +++ b/loader/src/platform/ios/util.mm @@ -3,7 +3,7 @@ #ifdef GEODE_IS_IOS -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; #include #include diff --git a/loader/src/platform/mac/LoaderImpl.cpp b/loader/src/platform/mac/LoaderImpl.cpp index bdee6eb3..3760eb96 100644 --- a/loader/src/platform/mac/LoaderImpl.cpp +++ b/loader/src/platform/mac/LoaderImpl.cpp @@ -8,7 +8,7 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; void Loader::Impl::platformMessageBox(char const* title, std::string const& info) { CFStringRef cfTitle = CFStringCreateWithCString(NULL, title, kCFStringEncodingUTF8); diff --git a/loader/src/platform/mac/ModImpl.cpp b/loader/src/platform/mac/ModImpl.cpp index 079e5683..b5232e4d 100644 --- a/loader/src/platform/mac/ModImpl.cpp +++ b/loader/src/platform/mac/ModImpl.cpp @@ -6,7 +6,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; template T findSymbolOrMangled(void* dylib, char const* name, char const* mangled) { diff --git a/loader/src/platform/mac/util.mm b/loader/src/platform/mac/util.mm index f9c40ee3..374ac092 100644 --- a/loader/src/platform/mac/util.mm +++ b/loader/src/platform/mac/util.mm @@ -3,7 +3,7 @@ #ifdef GEODE_IS_MACOS -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; #import #include diff --git a/loader/src/platform/windows/LoaderImpl.cpp b/loader/src/platform/windows/LoaderImpl.cpp index 0343411e..15bed851 100644 --- a/loader/src/platform/windows/LoaderImpl.cpp +++ b/loader/src/platform/windows/LoaderImpl.cpp @@ -5,7 +5,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; #ifdef GEODE_IS_WINDOWS diff --git a/loader/src/platform/windows/ModImpl.cpp b/loader/src/platform/windows/ModImpl.cpp index fe81db7b..17784dd1 100644 --- a/loader/src/platform/windows/ModImpl.cpp +++ b/loader/src/platform/windows/ModImpl.cpp @@ -5,7 +5,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; template T findSymbolOrMangled(HMODULE load, char const* name, char const* mangled) { diff --git a/loader/src/platform/windows/crashlog.cpp b/loader/src/platform/windows/crashlog.cpp index e8c345a3..28a7f10d 100644 --- a/loader/src/platform/windows/crashlog.cpp +++ b/loader/src/platform/windows/crashlog.cpp @@ -20,7 +20,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; static bool g_lastLaunchCrashed = false; static bool g_symbolsInitialized = false; diff --git a/loader/src/platform/windows/nfdwin.hpp b/loader/src/platform/windows/nfdwin.hpp index 56537644..aa3d01dc 100644 --- a/loader/src/platform/windows/nfdwin.hpp +++ b/loader/src/platform/windows/nfdwin.hpp @@ -44,7 +44,7 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; enum class NFDMode { OpenFile, diff --git a/loader/src/platform/windows/util.cpp b/loader/src/platform/windows/util.cpp index 78e35ac5..8300d451 100644 --- a/loader/src/platform/windows/util.cpp +++ b/loader/src/platform/windows/util.cpp @@ -3,7 +3,7 @@ #ifdef GEODE_IS_WINDOWS -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; #include "nfdwin.hpp" #include diff --git a/loader/src/ui/internal/dev/HookListView.hpp b/loader/src/ui/internal/dev/HookListView.hpp index f87862f8..27fdd89e 100644 --- a/loader/src/ui/internal/dev/HookListView.hpp +++ b/loader/src/ui/internal/dev/HookListView.hpp @@ -3,7 +3,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; static constexpr const BoomListType kBoomListType_Hooks = static_cast(0x358); diff --git a/loader/src/ui/internal/dev/HotReloadLayer.hpp b/loader/src/ui/internal/dev/HotReloadLayer.hpp index 20345586..737e65d1 100644 --- a/loader/src/ui/internal/dev/HotReloadLayer.hpp +++ b/loader/src/ui/internal/dev/HotReloadLayer.hpp @@ -2,7 +2,7 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; class HotReloadLayer : public CCLayer { protected: diff --git a/loader/src/ui/internal/info/DevProfilePopup.hpp b/loader/src/ui/internal/info/DevProfilePopup.hpp index 054cc172..af47a572 100644 --- a/loader/src/ui/internal/info/DevProfilePopup.hpp +++ b/loader/src/ui/internal/info/DevProfilePopup.hpp @@ -2,7 +2,7 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; class DevProfilePopup : public Popup { protected: diff --git a/loader/src/ui/internal/info/ModInfoPopup.hpp b/loader/src/ui/internal/info/ModInfoPopup.hpp index 0fbed632..9a6ac92f 100644 --- a/loader/src/ui/internal/info/ModInfoPopup.hpp +++ b/loader/src/ui/internal/info/ModInfoPopup.hpp @@ -7,7 +7,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; class ModListLayer; class ModObject; diff --git a/loader/src/ui/internal/info/TagNode.hpp b/loader/src/ui/internal/info/TagNode.hpp index 5f4d0ecb..f88d25c6 100644 --- a/loader/src/ui/internal/info/TagNode.hpp +++ b/loader/src/ui/internal/info/TagNode.hpp @@ -2,7 +2,7 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; enum class TagNodeStyle { Tag, diff --git a/loader/src/ui/internal/list/ModListCell.hpp b/loader/src/ui/internal/list/ModListCell.hpp index 783633ed..e65488fb 100644 --- a/loader/src/ui/internal/list/ModListCell.hpp +++ b/loader/src/ui/internal/list/ModListCell.hpp @@ -6,7 +6,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; class ModListLayer; enum class ModListDisplay; diff --git a/loader/src/ui/internal/list/ModListLayer.hpp b/loader/src/ui/internal/list/ModListLayer.hpp index b78d3b98..4bb386db 100644 --- a/loader/src/ui/internal/list/ModListLayer.hpp +++ b/loader/src/ui/internal/list/ModListLayer.hpp @@ -3,7 +3,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; class SearchFilterPopup; class ModListCell; diff --git a/loader/src/ui/internal/list/SearchFilterPopup.hpp b/loader/src/ui/internal/list/SearchFilterPopup.hpp index 1c5f29a6..5038bf89 100644 --- a/loader/src/ui/internal/list/SearchFilterPopup.hpp +++ b/loader/src/ui/internal/list/SearchFilterPopup.hpp @@ -2,7 +2,7 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; class ModListLayer; enum class ModListType; diff --git a/loader/src/ui/internal/settings/GeodeSettingNode.hpp b/loader/src/ui/internal/settings/GeodeSettingNode.hpp index 604406d9..074b1ee6 100644 --- a/loader/src/ui/internal/settings/GeodeSettingNode.hpp +++ b/loader/src/ui/internal/settings/GeodeSettingNode.hpp @@ -13,7 +13,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; #define IMPL_SETT_CREATE(type_) \ static type_##SettingNode* create( \ diff --git a/loader/src/ui/internal/settings/ModSettingsPopup.hpp b/loader/src/ui/internal/settings/ModSettingsPopup.hpp index 56358952..834214d5 100644 --- a/loader/src/ui/internal/settings/ModSettingsPopup.hpp +++ b/loader/src/ui/internal/settings/ModSettingsPopup.hpp @@ -4,7 +4,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; class ModSettingsPopup : public Popup, public SettingNodeDelegate { protected: diff --git a/loader/src/ui/nodes/BasedButton.cpp b/loader/src/ui/nodes/BasedButton.cpp index 01033a6d..468a0cb1 100644 --- a/loader/src/ui/nodes/BasedButton.cpp +++ b/loader/src/ui/nodes/BasedButton.cpp @@ -1,6 +1,6 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; TabButton* TabButton::create( TabBaseColor unselected, TabBaseColor selected, char const* text, cocos2d::CCObject* target, diff --git a/loader/src/ui/nodes/BasedButtonSprite.cpp b/loader/src/ui/nodes/BasedButtonSprite.cpp index 9af04c49..861b5dc7 100644 --- a/loader/src/ui/nodes/BasedButtonSprite.cpp +++ b/loader/src/ui/nodes/BasedButtonSprite.cpp @@ -2,7 +2,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; const char* geode::baseEnumToString(CircleBaseSize value) { switch (value) { diff --git a/loader/src/ui/nodes/ColorPickPopup.cpp b/loader/src/ui/nodes/ColorPickPopup.cpp index b77a0c4a..0fafb50f 100644 --- a/loader/src/ui/nodes/ColorPickPopup.cpp +++ b/loader/src/ui/nodes/ColorPickPopup.cpp @@ -5,7 +5,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; static GLubyte parseInt(char const* str) { try { diff --git a/loader/src/ui/nodes/Colors.cpp b/loader/src/ui/nodes/Colors.cpp index 133ca19d..5a07121b 100644 --- a/loader/src/ui/nodes/Colors.cpp +++ b/loader/src/ui/nodes/Colors.cpp @@ -2,7 +2,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; ColorManager::ColorManager() : m_colors({ { GDColor::NormalModeProgressBar, {{ ccColor3B { 0, 255, 0 }, Mod::get() }} }, diff --git a/loader/src/ui/nodes/EnterLayerEvent.cpp b/loader/src/ui/nodes/EnterLayerEvent.cpp index 3805cae2..1f68f53f 100644 --- a/loader/src/ui/nodes/EnterLayerEvent.cpp +++ b/loader/src/ui/nodes/EnterLayerEvent.cpp @@ -1,6 +1,6 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; AEnterLayerEvent::AEnterLayerEvent( std::string const& layerID, diff --git a/loader/src/ui/nodes/General.cpp b/loader/src/ui/nodes/General.cpp index b73b9423..b5163d29 100644 --- a/loader/src/ui/nodes/General.cpp +++ b/loader/src/ui/nodes/General.cpp @@ -1,7 +1,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; CCSprite* geode::createLayerBG() { auto winSize = CCDirector::get()->getWinSize(); diff --git a/loader/src/ui/nodes/IconButtonSprite.cpp b/loader/src/ui/nodes/IconButtonSprite.cpp index 5fd5bb65..7d55b299 100644 --- a/loader/src/ui/nodes/IconButtonSprite.cpp +++ b/loader/src/ui/nodes/IconButtonSprite.cpp @@ -1,7 +1,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; bool IconButtonSprite::init( char const* bg, bool bgIsFrame, cocos2d::CCNode* icon, char const* text, char const* font diff --git a/loader/src/ui/nodes/InputNode.cpp b/loader/src/ui/nodes/InputNode.cpp index cc592904..f1067762 100644 --- a/loader/src/ui/nodes/InputNode.cpp +++ b/loader/src/ui/nodes/InputNode.cpp @@ -1,7 +1,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; char const* InputNode::getString() { return m_input->getString(); diff --git a/loader/src/ui/nodes/ListView.cpp b/loader/src/ui/nodes/ListView.cpp index ffa9d5c6..438a069b 100644 --- a/loader/src/ui/nodes/ListView.cpp +++ b/loader/src/ui/nodes/ListView.cpp @@ -5,7 +5,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; GenericListCell::GenericListCell(char const* name, CCSize size) : TableViewCell(name, size.width, size.height) {} diff --git a/loader/src/ui/nodes/MDPopup.cpp b/loader/src/ui/nodes/MDPopup.cpp index 64b23545..2f0929da 100644 --- a/loader/src/ui/nodes/MDPopup.cpp +++ b/loader/src/ui/nodes/MDPopup.cpp @@ -2,7 +2,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; bool MDPopup::setup( std::string const& title, std::string const& info, char const* btn1Text, char const* btn2Text, diff --git a/loader/src/ui/nodes/MDTextArea.cpp b/loader/src/ui/nodes/MDTextArea.cpp index 2e2c1758..48cf9025 100644 --- a/loader/src/ui/nodes/MDTextArea.cpp +++ b/loader/src/ui/nodes/MDTextArea.cpp @@ -9,7 +9,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; static constexpr float g_fontScale = .5f; static constexpr float g_paragraphPadding = 7.f; diff --git a/loader/src/ui/nodes/Notification.cpp b/loader/src/ui/nodes/Notification.cpp index 20cf137e..58ec88cd 100644 --- a/loader/src/ui/nodes/Notification.cpp +++ b/loader/src/ui/nodes/Notification.cpp @@ -2,7 +2,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; constexpr auto NOTIFICATION_FADEIN = .3f; constexpr auto NOTIFICATION_FADEOUT = 1.f; diff --git a/loader/src/ui/nodes/Popup.cpp b/loader/src/ui/nodes/Popup.cpp index 08717a74..2703241f 100644 --- a/loader/src/ui/nodes/Popup.cpp +++ b/loader/src/ui/nodes/Popup.cpp @@ -1,6 +1,6 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; class QuickPopup : public FLAlertLayer, public FLAlertLayerProtocol { protected: diff --git a/loader/src/ui/nodes/SceneManager.cpp b/loader/src/ui/nodes/SceneManager.cpp index 1a088d73..0ec112d7 100644 --- a/loader/src/ui/nodes/SceneManager.cpp +++ b/loader/src/ui/nodes/SceneManager.cpp @@ -1,7 +1,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; bool SceneManager::setup() { m_persistedNodes = CCArray::create(); diff --git a/loader/src/ui/nodes/ScrollLayer.cpp b/loader/src/ui/nodes/ScrollLayer.cpp index 7af4d29d..6ab57e38 100644 --- a/loader/src/ui/nodes/ScrollLayer.cpp +++ b/loader/src/ui/nodes/ScrollLayer.cpp @@ -1,7 +1,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; GenericContentLayer* GenericContentLayer::create(float width, float height) { auto ret = new GenericContentLayer(); diff --git a/loader/src/ui/nodes/Scrollbar.cpp b/loader/src/ui/nodes/Scrollbar.cpp index dd2b331e..850525e3 100644 --- a/loader/src/ui/nodes/Scrollbar.cpp +++ b/loader/src/ui/nodes/Scrollbar.cpp @@ -1,7 +1,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; bool Scrollbar::ccTouchBegan(CCTouch* touch, CCEvent* event) { // hitbox diff --git a/loader/src/ui/nodes/TextRenderer.cpp b/loader/src/ui/nodes/TextRenderer.cpp index 9d38dd7c..fe2c712d 100644 --- a/loader/src/ui/nodes/TextRenderer.cpp +++ b/loader/src/ui/nodes/TextRenderer.cpp @@ -3,7 +3,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; using namespace std::string_literals; bool TextDecorationWrapper::init( diff --git a/loader/src/utils/JsonValidation.cpp b/loader/src/utils/JsonValidation.cpp index 0a592fc3..0612a59e 100644 --- a/loader/src/utils/JsonValidation.cpp +++ b/loader/src/utils/JsonValidation.cpp @@ -1,6 +1,6 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; json::Value& JsonMaybeSomething::json() { diff --git a/loader/src/utils/PlatformID.cpp b/loader/src/utils/PlatformID.cpp index 45714ed7..e2303213 100644 --- a/loader/src/utils/PlatformID.cpp +++ b/loader/src/utils/PlatformID.cpp @@ -2,7 +2,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; PlatformID PlatformID::from(const char* str) { switch (hash(str)) { diff --git a/loader/src/utils/VersionInfo.cpp b/loader/src/utils/VersionInfo.cpp index 23269a82..1b22586e 100644 --- a/loader/src/utils/VersionInfo.cpp +++ b/loader/src/utils/VersionInfo.cpp @@ -6,7 +6,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; // VersionTag diff --git a/loader/src/utils/cocos.cpp b/loader/src/utils/cocos.cpp index 13fdb1a9..977d4c1f 100644 --- a/loader/src/utils/cocos.cpp +++ b/loader/src/utils/cocos.cpp @@ -2,7 +2,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; json::Value json::Serialize::to_json(ccColor3B const& color) { return json::Object { diff --git a/loader/src/utils/file.cpp b/loader/src/utils/file.cpp index 22f13908..2a889a21 100644 --- a/loader/src/utils/file.cpp +++ b/loader/src/utils/file.cpp @@ -12,7 +12,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; using namespace geode::utils::file; Result utils::file::readString(ghc::filesystem::path const& path) { diff --git a/loader/src/utils/string.cpp b/loader/src/utils/string.cpp index 1200acc5..c839191c 100644 --- a/loader/src/utils/string.cpp +++ b/loader/src/utils/string.cpp @@ -1,7 +1,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; #ifdef GEODE_IS_WINDOWS diff --git a/loader/src/utils/web.cpp b/loader/src/utils/web.cpp index 5b13fb43..70d715c6 100644 --- a/loader/src/utils/web.cpp +++ b/loader/src/utils/web.cpp @@ -5,7 +5,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; using namespace web; namespace geode::utils::fetch { diff --git a/loader/test/dependency/main.cpp b/loader/test/dependency/main.cpp index f6703726..323766f3 100644 --- a/loader/test/dependency/main.cpp +++ b/loader/test/dependency/main.cpp @@ -1,6 +1,6 @@ #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; #include #include diff --git a/loader/test/main/main.cpp b/loader/test/main/main.cpp index a94d3001..188524dc 100644 --- a/loader/test/main/main.cpp +++ b/loader/test/main/main.cpp @@ -2,7 +2,7 @@ #include #include -USE_GEODE_NAMESPACE(); +using namespace geode::prelude; auto test = []() { log::info("Static logged");