Merge altalk23:main

This commit is contained in:
altalk23 2022-10-13 15:43:34 +03:00
commit 1822860d50
103 changed files with 1003 additions and 673 deletions
.github/workflows
CMakeLists.txtREADME.md
bindings
codegen/src
entry.cpp
loader

View file

@ -21,7 +21,7 @@ jobs:
- name: "macOS"
os: macos-latest
prefixes: 'PATH="/usr/local/opt/ccache/libexec:$PATH"'
extra_flags: "-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON"
extra_flags: "-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
out_paths: './bin/nightly/Geode.dylib ./bin/nightly/GeodeBootstrapper.dylib'
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}

View file

@ -14,6 +14,10 @@ endif()
add_library(${PROJECT_NAME} INTERFACE)
if (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
target_compile_definitions(${PROJECT_NAME} INTERFACE -DGEODE_DEBUG)
endif()
# Rerun CMake on VERSION file change
set_target_properties(${PROJECT_NAME} PROPERTIES CMAKE_CONFIGURE_DEPENDS VERSION)
@ -39,21 +43,22 @@ add_custom_target(CodegenRun ALL
COMMAND Codegen ${GEODE_TARGET_PLATFORM} bindings ${GEODE_CODEGEN_PATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Run Codegen"
BYPRODUCTS ${GEODE_CODEGEN_PATH}/GeneratedSource.cpp
BYPRODUCTS ${GEODE_CODEGEN_PATH}/Geode/GeneratedSource.cpp
)
add_dependencies(${PROJECT_NAME} CodegenRun)
add_dependencies(CodegenRun Codegen)
# Hacky way to supress the not generated error
if (NOT EXISTS ${GEODE_CODEGEN_PATH}/GeneratedSource.cpp)
if (NOT EXISTS ${GEODE_CODEGEN_PATH}/Geode/GeneratedSource.cpp)
make_directory(${GEODE_CODEGEN_PATH})
file(TOUCH ${GEODE_CODEGEN_PATH}/GeneratedSource.cpp)
make_directory(${GEODE_CODEGEN_PATH}/Geode)
file(TOUCH ${GEODE_CODEGEN_PATH}/Geode/GeneratedSource.cpp)
endif()
target_sources(${PROJECT_NAME} INTERFACE ${GEODE_CODEGEN_PATH}/GeneratedSource.cpp)
target_include_directories(${PROJECT_NAME} INTERFACE ${GEODE_CODEGEN_PATH}/..)
target_sources(${PROJECT_NAME} INTERFACE ${GEODE_CODEGEN_PATH}/Geode/GeneratedSource.cpp)
target_include_directories(${PROJECT_NAME} INTERFACE
${GEODE_CODEGEN_PATH}
${GEODE_LOADER_PATH}/include
${GEODE_LOADER_PATH}/include/Geode/cocos/
${GEODE_LOADER_PATH}/include/Geode/cocos/cocos2dx

View file

@ -9,7 +9,8 @@
There's nothing worse than having to read thousands of words just to see what some library's code actually looks like, so instead, here's a **Hello World** in Geode right off the bat:
```cpp
#include <Geode/Geode.hpp>
#include <Geode/bindings.hpp>
#include <Geode/modify/MenuLayer.hpp>
USE_GEODE_NAMESPACE();

View file

@ -341,17 +341,17 @@ class cocos2d::CCLayerColor {
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;
auto draw() = mac 0x274b50, ios 0xc8fe0;
auto getBlendFunc() = mac 0x274480, ios 0xc8bcc;
auto init() = mac 0x274800, ios 0xc8de8;
auto initWithColor(cocos2d::_ccColor4B const&) = mac 0x2749a0, ios 0xc8f14;
auto initWithColor(cocos2d::_ccColor4B const&, float, float) = mac 0x274850, ios 0xc8e34;
auto setBlendFunc(cocos2d::_ccBlendFunc) = mac 0x2744a0, ios 0xc8bdc;
auto setColor(cocos2d::_ccColor3B const&) = mac 0x274c20, ios 0xc90ac;
auto setContentSize(cocos2d::CCSize const&) = mac 0x2749f0, ios 0xc8f64;
auto setOpacity(unsigned char) = mac 0x274db0, ios 0xc9108;
auto updateColor() = mac 0x274ae0, ios 0xc8f80;
~CCLayerColor() = mac 0x2743d0, ios 0x2743e0;
virtual auto draw() = mac 0x274b50, ios 0xc8fe0;
virtual auto getBlendFunc() = mac 0x274480, ios 0xc8bcc;
virtual auto init() = mac 0x274800, ios 0xc8de8;
virtual auto initWithColor(cocos2d::_ccColor4B const&) = mac 0x2749a0, ios 0xc8f14;
virtual auto initWithColor(cocos2d::_ccColor4B const&, float, float) = mac 0x274850, ios 0xc8e34;
virtual auto setBlendFunc(cocos2d::_ccBlendFunc) = mac 0x2744a0, ios 0xc8bdc;
virtual auto setColor(cocos2d::_ccColor3B const&) = mac 0x274c20, ios 0xc90ac;
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;
}
class cocos2d::CCLayerRGBA {

View file

@ -92,8 +92,8 @@ class AudioEffectsLayer {
}
class BoomListView : cocos2d::CCLayer, TableViewDelegate, TableViewDataSource {
inline BoomListView() {}
inline ~BoomListView() {
BoomListView() {}
~BoomListView() {
CC_SAFE_RELEASE(m_entries);
}

View file

@ -3,7 +3,7 @@
namespace { namespace format_strings {
char const* declare_address = R"GEN(
GEODE_NOINLINE GEODE_HIDDEN inline static uintptr_t address{index}() {{
GEODE_INLINE GEODE_HIDDEN static uintptr_t address{index}() {{
static uintptr_t ret = {address};
return ret;
}}

View file

@ -3,34 +3,43 @@
#include <set>
namespace { namespace format_strings {
char const* class_predeclare = "class {class_name};\n";
// requires: base_classes, class_name
char const* binding_include = R"GEN(#include "binding/{file_name}"
)GEN";
char const* class_includes = R"GEN(#pragma once
#include <Geode/c++stl/gdstdlib.hpp>
#include <cocos2d.h>
#include <cocos-ext.h>
#include <Geode/GeneratedPredeclare.hpp>
#include <Geode/Enums.hpp>
)GEN";
char const* class_include_prereq = R"GEN(#include "{file_name}"
)GEN";
char const* class_start = R"GEN(
class {class_name}{base_classes} {{
public:
)GEN";
char const* monostate_constructor = R"GEN(
GEODE_MONOSTATE_CONSTRUCTOR_GD({class_name}, {first_base})
char const* monostate_constructor = R"GEN( GEODE_MONOSTATE_CONSTRUCTOR_GD({class_name}, {first_base})
)GEN";
char const* monostate_constructor_cutoff = R"GEN(
GEODE_MONOSTATE_CONSTRUCTOR_CUTOFF({class_name}, {first_base})
char const* monostate_constructor_cutoff = R"GEN( GEODE_MONOSTATE_CONSTRUCTOR_CUTOFF({class_name}, {first_base})
)GEN";
char const* function_definition = R"GEN(
{docs}{static}{virtual}{return_type} {function_name}({parameters}){const};
char const* function_definition = R"GEN({docs} {static}{virtual}{return_type} {function_name}({parameters}){const};
)GEN";
char const* error_definition = R"GEN(
template <bool T=false>
char const* error_definition = R"GEN( template <bool T=false>
{static}{return_type} {function_name}({parameters}){const}{{
static_assert(T, "Implement {class_name}::{function_name}");
}}
)GEN";
char const* error_definition_virtual = R"GEN(
[[deprecated("Use of undefined virtual function - will crash at runtime!!!")]]
char const* error_definition_virtual = R"GEN( [[deprecated("Use of undefined virtual function - will crash at runtime!!!")]]
{virtual}{return_type} {function_name}({parameters}){const}{{
#ifdef GEODE_NO_UNDEFINED_VIRTUALS
static_assert(false, "Undefined virtual function - implement in GeometryDash.bro");
@ -43,52 +52,52 @@ public:
{function_name}({parameters});)GEN";
// requires: type, member_name, array
char const* member_definition = R"GEN(
{type} {member_name};)GEN";
char const* member_definition = R"GEN( {type} {member_name};
)GEN";
char const* pad_definition = R"GEN(
GEODE_PAD({hardcode});)GEN";
char const* unimplemented_definition = R"GEN(
GEODE_UNIMPLEMENTED_PAD)GEN";
char const* pad_definition = R"GEN( GEODE_PAD({hardcode});
)GEN";
// requires: hardcode_macro, type, member_name, hardcode
char const* hardcode_definition = R"GEN(
CLASSPARAM({type}, {member_name}, {hardcode});)GEN";
char const* class_end = R"GEN(
};
char const* class_end = R"GEN(};
)GEN";
}}
std::string generateGDHeader(Root& root) {
std::string output("#pragma once\n#include <Geode/c++stl/gdstdlib.hpp>\n#include <cocos2d.h>\n");
for (auto& cls : root.classes) {
if (can_find(cls.name, "cocos2d"))
continue;
output += fmt::format(::format_strings::class_predeclare,
fmt::arg("class_name", cls.name)
);
}
std::string generateBindingHeader(Root& root, ghc::filesystem::path const& singleFolder) {
std::string output;
for (auto& cls : root.classes) {
if (can_find(cls.name, "cocos2d"))
continue;
std::string filename = (codegen::getUnqualifiedClassName(cls.name) + ".hpp");
output += fmt::format(format_strings::binding_include,
fmt::arg("file_name", filename)
);
std::string single_output;
single_output += format_strings::class_includes;
for (auto dep : cls.depends) {
if (can_find(dep, "cocos2d::")) continue;
std::string depfilename = (codegen::getUnqualifiedClassName(dep) + ".hpp");
single_output += fmt::format(format_strings::class_include_prereq, fmt::arg("file_name", depfilename));
}
std::string supers = str_if(
fmt::format(" : public {}", fmt::join(cls.superclasses, ", ")),
!cls.superclasses.empty()
);
output += fmt::format(::format_strings::class_start,
single_output += fmt::format(::format_strings::class_start,
fmt::arg("class_name", cls.name),
fmt::arg("base_classes", supers)
);
// what.
if (!cls.superclasses.empty()) {
output += fmt::format(
single_output += fmt::format(
can_find(cls.superclasses[0], "cocos2d")
? format_strings::monostate_constructor_cutoff
: format_strings::monostate_constructor,
@ -97,15 +106,17 @@ std::string generateGDHeader(Root& root) {
);
}
bool unimplementedField = false;
for (auto field : cls.fields) {
FunctionBegin* fb;
char const* used_format = format_strings::function_definition;
if (auto i = field.get_as<InlineField>()) {
output += "\t" + i->inner + "\n";
single_output += "\t" + i->inner + "\n";
continue;
} else if (auto m = field.get_as<MemberField>()) {
output += fmt::format(format_strings::member_definition,
if (unimplementedField) single_output += "\t[[deprecated(\"Member placed incorrectly - will crash at runtime!!!\")]]\n";
single_output += fmt::format(format_strings::member_definition,
fmt::arg("type", m->type.name),
fmt::arg("member_name", m->name + str_if(fmt::format("[{}]", m->count), m->count))
);
@ -114,9 +125,9 @@ std::string generateGDHeader(Root& root) {
auto hardcode = codegen::platformNumber(p->amount);
if (hardcode) {
output += fmt::format(format_strings::pad_definition, fmt::arg("hardcode", hardcode));
single_output += fmt::format(format_strings::pad_definition, fmt::arg("hardcode", hardcode));
} else {
output += "\n GEODE_UNIMPLEMENTED_PAD";
unimplementedField = true;
}
continue;
} else if (auto fn = field.get_as<OutOfLineField>()) {
@ -135,7 +146,7 @@ std::string generateGDHeader(Root& root) {
}
}
output += fmt::format(used_format,
single_output += fmt::format(used_format,
fmt::arg("virtual", str_if("virtual ", fb->is_virtual)),
fmt::arg("static", str_if("static ", fb->is_static)),
fmt::arg("class_name", cls.name),
@ -149,9 +160,9 @@ std::string generateGDHeader(Root& root) {
}
// if (hasClass)
output += ::format_strings::class_end;
single_output += ::format_strings::class_end;
// queued.pop_front();
writeFile(singleFolder / filename, single_output);
}
return output;

View file

@ -3,21 +3,6 @@
using namespace codegen;
void writeFile(ghc::filesystem::path const& writePath, std::string const& output) {
std::ifstream readfile;
readfile >> std::noskipws;
readfile.open(writePath);
std::string data((std::istreambuf_iterator<char>(readfile)), std::istreambuf_iterator<char>());
readfile.close();
if (data != output) {
std::ofstream writefile;
writefile.open(writePath);
writefile << output;
writefile.close();
}
}
int main(int argc, char** argv) try {
if (argc != 4) throw codegen::error("Invalid number of parameters (expected 3 found {})", argc-1);
@ -31,8 +16,10 @@ int main(int argc, char** argv) try {
chdir(argv[2]);
ghc::filesystem::path writeDir = argv[3];
auto writeDir = ghc::filesystem::path(argv[3]) / "Geode";
ghc::filesystem::create_directories(writeDir);
ghc::filesystem::create_directories(writeDir / "modify");
ghc::filesystem::create_directories(writeDir / "binding");
Root root = broma::parse_file("Entry.bro");
@ -45,11 +32,12 @@ int main(int argc, char** argv) try {
}
writeFile(writeDir / "GeneratedAddress.hpp", generateAddressHeader(root));
writeFile(writeDir / "GeneratedModify.hpp", generateModifyHeader(root)); // pretty much obsolete with a custom compiler
writeFile(writeDir / "GeneratedModify.hpp", generateModifyHeader(root, writeDir / "modify")); // pretty much obsolete with a custom compiler
writeFile(writeDir / "GeneratedWrapper.hpp", generateWrapperHeader(root)); // pretty much obsolete with a custom compiler
writeFile(writeDir / "GeneratedType.hpp", generateTypeHeader(root)); // pretty much obsolete with a custom compiler
writeFile(writeDir / "GeneratedHeader.hpp", generateGDHeader(root));
writeFile(writeDir / "GeneratedSource.cpp", generateGDSource(root));
writeFile(writeDir / "GeneratedBinding.hpp", generateBindingHeader(root, writeDir / "binding"));
writeFile(writeDir / "GeneratedPredeclare.hpp", generatePredeclareHeader(root));
writeFile(writeDir / "GeneratedSource.cpp", generateBindingSource(root));
} catch(std::exception& e) {
std::cout << "Codegen error: " << e.what() << "\n";
return 1;

View file

@ -3,34 +3,51 @@
namespace { namespace format_strings {
// requires: class_name
char const* modify_start = R"GEN(
template<class Derived>
struct Modify<Derived, {class_name}> : ModifyBase<Modify<Derived, {class_name}>> {{
using ModifyBase<Modify<Derived, {class_name}>>::ModifyBase;
using Base = {class_name};
static void apply() {{
using namespace geode::core::meta;
char const* modify_start = R"GEN(#pragma once
#include <Geode/modify/Modify.hpp>
#include <Geode/modify/Field.hpp>
#include <Geode/modify/InternalMacros.hpp>
using namespace geode::modifier;
namespace geode::modifier {{
template<class Derived>
struct Modify<Derived, {class_name}> : ModifyBase<Modify<Derived, {class_name}>> {{
using ModifyBase<Modify<Derived, {class_name}>>::ModifyBase;
using Base = {class_name};
static void apply() {{
using namespace geode::core::meta;
)GEN";
// requires: index, class_name, arg_types, function_name, raw_arg_types, non_virtual
char const* apply_function = R"GEN(
GEODE_APPLY_MODIFY_FOR_FUNCTION({index}, {function_convention}, {class_name}, {function_name}))GEN";
GEODE_APPLY_MODIFY_FOR_FUNCTION({index}, {function_convention}, {class_name}, {function_name}))GEN";
char const* modify_end = R"GEN(
}
};
}
};
}
)GEN";
char const* modify_include = R"GEN(#include "modify/{file_name}"
)GEN";
}}
std::string generateModifyHeader(Root& root) {
std::string generateModifyHeader(Root& root, ghc::filesystem::path const& singleFolder) {
std::string output;
for (auto c : root.classes) {
if (c.name == "cocos2d")
continue;
output += fmt::format(format_strings::modify_start,
std::string filename = (codegen::getUnqualifiedClassName(c.name) + ".hpp");
output += fmt::format(format_strings::modify_include,
fmt::arg("file_name", filename)
);
std::string single_output;
single_output += fmt::format(format_strings::modify_start,
fmt::arg("class_name", c.name)
);
@ -52,7 +69,7 @@ std::string generateModifyHeader(Root& root) {
break;
}
output += fmt::format(format_strings::apply_function,
single_output += fmt::format(format_strings::apply_function,
fmt::arg("index", f.field_id),
fmt::arg("class_name", c.name),
fmt::arg("function_name", function_name),
@ -61,7 +78,9 @@ std::string generateModifyHeader(Root& root) {
}
}
output += format_strings::modify_end;
single_output += format_strings::modify_end;
writeFile(singleFolder / filename, single_output);
}
return output;

View file

@ -0,0 +1,22 @@
#include "Shared.hpp"
#include <iostream>
#include <set>
namespace { namespace format_strings {
char const* class_predeclare = "class {class_name};\n";
}}
std::string generatePredeclareHeader(Root& root) {
std::string output("#pragma once\n");
for (auto& cls : root.classes) {
if (can_find(cls.name, "cocos2d"))
continue;
output += fmt::format(::format_strings::class_predeclare,
fmt::arg("class_name", cls.name)
);
}
return output;
}

View file

@ -5,6 +5,7 @@
#include <fmt/format.h>
#include <fmt/ranges.h>
#include <fstream>
#include <fs/filesystem.hpp> // bruh
using std::istreambuf_iterator;
@ -19,13 +20,29 @@ using std::istreambuf_iterator;
#endif
std::string generateAddressHeader(Root& root);
std::string generateModifyHeader(Root& root);
std::string generateModifyHeader(Root& root, ghc::filesystem::path const& singleFolder);
std::string generateWrapperHeader(Root& root);
std::string generateTypeHeader(Root& root);
std::string generateGDHeader(Root& root);
std::string generateGDSource(Root& root);
std::string generateBindingHeader(Root& root, ghc::filesystem::path const& singleFolder);
std::string generatePredeclareHeader(Root& root);
std::string generateBindingSource(Root& root);
std::string generateTidyHeader(Root& root);
inline void writeFile(ghc::filesystem::path const& writePath, std::string const& output) {
std::ifstream readfile;
readfile >> std::noskipws;
readfile.open(writePath);
std::string data((std::istreambuf_iterator<char>(readfile)), std::istreambuf_iterator<char>());
readfile.close();
if (data != output) {
std::ofstream writefile;
writefile.open(writePath);
writefile << output;
writefile.close();
}
}
inline std::string str_if(std::string&& str, bool cond) {
return cond ? str : "";
}

View file

@ -72,7 +72,7 @@ types::ret{index} {class_name}::{function_name}({parameters}){const} {{
)GEN";
}}
std::string generateGDSource(Root& root) {
std::string generateBindingSource(Root& root) {
std::string output(format_strings::source_start);
for (auto& c : root.classes) {

View file

@ -1,6 +1,6 @@
// included by default in every geode project
#include <Geode/Geode.hpp>
#include <Geode/Loader.hpp>
GEODE_API bool GEODE_CALL geode_implicit_load(geode::Mod* m) {
geode::Mod::setSharedMod(m);

View file

@ -117,12 +117,13 @@ target_link_libraries(${PROJECT_NAME} z lilac_hook geode-sdk)
set_source_files_properties(${OBJC_SOURCES} PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
target_precompile_headers(${PROJECT_NAME} PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/DefaultInclude.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Utils.hpp"
# "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Utils.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Loader.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/UI.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Bindings.hpp"
# "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Bindings.hpp"
# "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Modify.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/cocos/cocos2dx/include/cocos2d.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/cocos/extensions/cocos-ext.h"
)
# Create launcher

View file

@ -15,341 +15,11 @@
#include <type_traits>
#include <unordered_map>
#include <Geode/utils/addresser.hpp>
#include "Enums.hpp"
namespace geode::core::meta {}
template<auto F>
struct address_of_t {
static inline auto value = geode::base::get();
};
template<auto F>
inline auto address_of = address_of_t<F>::value;
//thanks pie
enum class SearchType {
Search = 0,
Downloaded = 1,
MostLiked = 2,
Trending = 3,
Recent = 4,
UsersLevels = 5,
Featured = 6,
Magic = 7,
Sends = 8,
MapPack = 9,
MapPackOnClick = 10,
Awarded = 11,
Followed = 12,
Friends = 13,
Users = 14,
LikedGDW = 15,
HallOfFame = 16,
FeaturedGDW = 17,
Similar = 18,
MyLevels = 98,
SavedLevels = 99,
FavouriteLevels = 100
};
// jesus fucking christ (painfully written by @hjfod)
enum class GameObjectType {
Solid = 0,
Hazard = 2,
InverseGravityPortal = 3,
NormalGravityPortal = 4,
ShipPortal = 5,
CubePortal = 6,
Decoration = 7,
YellowJumpPad = 8,
PinkJumpPad = 9,
GravityPad = 10,
YellowJumpRing = 11,
PinkJumpRing = 12,
GravityRing = 13,
InverseMirrorPortal = 14,
NormalMirrorPortal = 15,
BallPortal = 16,
RegularSizePortal = 17,
MiniSizePortal = 18,
UfoPortal = 19,
Modifier = 20,
SecretCoin = 22,
DualPortal = 23,
SoloPortal = 24,
Slope = 25,
WavePortal = 26,
RobotPortal = 27,
TeleportPortal = 28,
GreenRing = 29,
Collectible = 30,
UserCoin = 31,
DropRing = 32,
SpiderPortal = 33,
RedJumpPad = 34,
RedJumpRing = 35,
CustomRing = 36,
DashRing = 37,
GravityDashRing = 38,
CollisionObject = 39,
Special = 40,
};
enum class PulseEffectType {};
enum class TouchTriggerType {};
enum class PlayerButton {};
enum class GhostType {};
enum class TableViewCellEditingStyle {};
enum class UserListType {};
enum class GJErrorCode {};
enum class AccountError {};
enum class GJSongError {};
enum class LikeItemType {
Unknown = 0,
Level = 1,
Comment = 2,
AccountComment = 3
};
enum class GJStoreItem {};
enum class CommentError {};
enum class BackupAccountError {};
enum class BoomListType {
Default = 0x0,
User = 0x2,
Stats = 0x3,
Achievement = 0x4,
Level = 0x5,
Level2 = 0x6,
Comment = 0x7,
Comment2 = 0x8,
Song = 0xb,
Score = 0xc,
MapPack = 0xd,
CustomSong = 0xe,
Comment3 = 0xf,
User2 = 0x10,
Request = 0x11,
Message = 0x12,
LevelScore = 0x13,
Artist = 0x14,
};
enum class MenuAnimationType {
Scale = 0,
Move = 1,
};
enum class ShopType {
Normal,
Secret,
Community
};
// Geode Addition
enum class ZLayer {
B4 = -3,
B3 = -1,
B2 = 1,
B1 = 3,
Default = 0,
T1 = 5,
T2 = 7,
T3 = 9,
};
enum class UpdateResponse {
Unknown,
UpToDate,
GameVerOutOfDate,
UpdateSuccess,
};
enum class UnlockType {
Cube = 0x1,
Col1 = 0x2,
Col2 = 0x3,
Ship = 0x4,
Ball = 0x5,
Bird = 0x6,
Dart = 0x7,
Robot = 0x8,
Spider = 0x9,
Streak = 0xA,
Death = 0xB,
GJItem = 0xC,
};
enum class SpecialRewardItem {
FireShard = 0x1,
IceShard = 0x2,
PoisonShard = 0x3,
ShadowShard = 0x4,
LavaShard = 0x5,
BonusKey = 0x6,
Orbs = 0x7,
Diamonds = 0x8,
CustomItem = 0x9,
};
enum class EditCommand {
SmallLeft = 1,
SmallRight = 2,
SmallUp = 3,
SmallDown = 4,
Left = 5,
Right = 6,
Up = 7,
Down = 8,
BigLeft = 9,
BigRight = 10,
BigUp = 11,
BigDown = 12,
TinyLeft = 13,
TinyRight = 14,
TinyUp = 15,
TinyDown = 16,
FlipX = 17,
FlipY = 18,
RotateCW = 19,
RotateCCW = 20,
RotateCW45 = 21,
RotateCCW45 = 22,
RotateFree = 23,
RotateSnap = 24,
Scale = 25,
};
// Geode Addition
enum class PlaybackMode {
Not = 0,
Playing = 1,
Paused = 2,
};
enum class SelectArtType {
Background = 0,
Ground = 1,
};
enum class UndoCommand {
Delete = 1,
New = 2,
Paste = 3,
DeleteMulti = 4,
Transform = 5,
Select = 6,
};
enum class EasingType {
None = 0,
EaseInOut = 1,
EaseIn = 2,
EaseOut = 3,
ElasticInOut = 4,
ElasticIn = 5,
ElasticOut = 6,
BounceInOut = 7,
BounceIn = 8,
BounceOut = 9,
ExponentialInOut = 10,
ExponentialIn = 11,
ExponentialOut = 12,
SineInOut = 13,
SineIn = 14,
SineOut = 15,
BackInOut = 16,
BackIn = 17,
BackOut = 18,
};
enum class GJDifficulty {
Auto = 0,
Easy = 1,
Normal = 2,
Hard = 3,
Harder = 4,
Insane = 5,
Demon = 6,
DemonEasy = 7,
DemonMedium = 8,
DemonInsane = 9,
DemonExtreme = 10
};
enum class GJLevelType {
Local = 1,
Editor = 2,
Saved = 3
};
enum class IconType {
Cube = 0,
Ship = 1,
Ball = 2,
Ufo = 3,
Wave = 4,
Robot = 5,
Spider = 6,
DeathEffect = 98,
Special = 99,
};
enum class GJChallengeType {
Unknown = 0,
Orbs = 1,
UserCoins = 2,
Stars = 3
};
enum class GJScoreType {
Unknown = 0,
Creator = 1
};
enum class LevelLeaderboardType {
Friends = 0,
Global = 1,
Weekly = 2
};
// Geode Addition
enum class ComparisonType {
Equals = 0,
Larger = 1,
Smaller = 2,
};
// Geode Addition
enum class MoveTargetType {
Both = 0,
XOnly = 1,
YOnly = 2,
};
// Geode Addition
enum class TouchToggleMode {
Normal = 0,
ToggleOn = 1,
ToggleOff = 2,
};
// Geode Addition
enum class LeaderboardState {
Default = 0,
Top100 = 1,
Global = 2,
Creator = 3,
Friends = 4,
};
#define CLASSPARAM(...)
#define STRUCTPARAM(...)
#include <codegenned/GeneratedHeader.hpp>
#include <Geode/GeneratedBinding.hpp>

View file

@ -103,82 +103,82 @@ _61,_62,_63,N,...) N
9, 8, 7, 6, 5, 4, 3, 2, 1, 0
#define GEODE_NEST1(macro, begin) \
macro(GEODE_CONCAT(begin, 0)), \
macro(GEODE_CONCAT(begin, 1)), \
macro(GEODE_CONCAT(begin, 2)), \
macro(GEODE_CONCAT(begin, 3)), \
macro(GEODE_CONCAT(begin, 4)), \
macro(GEODE_CONCAT(begin, 5)), \
macro(GEODE_CONCAT(begin, 6)), \
macro(GEODE_CONCAT(begin, 7)), \
macro(GEODE_CONCAT(begin, 8)), \
macro(GEODE_CONCAT(begin, 9)), \
macro(GEODE_CONCAT(begin, a)), \
macro(GEODE_CONCAT(begin, b)), \
macro(GEODE_CONCAT(begin, c)), \
macro(GEODE_CONCAT(begin, d)), \
macro(GEODE_CONCAT(begin, e)), \
macro(GEODE_CONCAT(begin, f))
// #define GEODE_NEST1(macro, begin) \
// macro(GEODE_CONCAT(begin, 0)), \
// macro(GEODE_CONCAT(begin, 1)), \
// macro(GEODE_CONCAT(begin, 2)), \
// macro(GEODE_CONCAT(begin, 3)), \
// macro(GEODE_CONCAT(begin, 4)), \
// macro(GEODE_CONCAT(begin, 5)), \
// macro(GEODE_CONCAT(begin, 6)), \
// macro(GEODE_CONCAT(begin, 7)), \
// macro(GEODE_CONCAT(begin, 8)), \
// macro(GEODE_CONCAT(begin, 9)), \
// macro(GEODE_CONCAT(begin, a)), \
// macro(GEODE_CONCAT(begin, b)), \
// macro(GEODE_CONCAT(begin, c)), \
// macro(GEODE_CONCAT(begin, d)), \
// macro(GEODE_CONCAT(begin, e)), \
// macro(GEODE_CONCAT(begin, f))
#define GEODE_NEST2(macro, begin) \
GEODE_NEST1(macro, GEODE_CONCAT(begin, 0)), \
GEODE_NEST1(macro, GEODE_CONCAT(begin, 1)), \
GEODE_NEST1(macro, GEODE_CONCAT(begin, 2)), \
GEODE_NEST1(macro, GEODE_CONCAT(begin, 3)), \
GEODE_NEST1(macro, GEODE_CONCAT(begin, 4)), \
GEODE_NEST1(macro, GEODE_CONCAT(begin, 5)), \
GEODE_NEST1(macro, GEODE_CONCAT(begin, 6)), \
GEODE_NEST1(macro, GEODE_CONCAT(begin, 7)), \
GEODE_NEST1(macro, GEODE_CONCAT(begin, 8)), \
GEODE_NEST1(macro, GEODE_CONCAT(begin, 9)), \
GEODE_NEST1(macro, GEODE_CONCAT(begin, a)), \
GEODE_NEST1(macro, GEODE_CONCAT(begin, b)), \
GEODE_NEST1(macro, GEODE_CONCAT(begin, c)), \
GEODE_NEST1(macro, GEODE_CONCAT(begin, d)), \
GEODE_NEST1(macro, GEODE_CONCAT(begin, e)), \
GEODE_NEST1(macro, GEODE_CONCAT(begin, f))
// #define GEODE_NEST2(macro, begin) \
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 0)), \
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 1)), \
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 2)), \
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 3)), \
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 4)), \
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 5)), \
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 6)), \
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 7)), \
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 8)), \
// GEODE_NEST1(macro, GEODE_CONCAT(begin, 9)), \
// GEODE_NEST1(macro, GEODE_CONCAT(begin, a)), \
// GEODE_NEST1(macro, GEODE_CONCAT(begin, b)), \
// GEODE_NEST1(macro, GEODE_CONCAT(begin, c)), \
// GEODE_NEST1(macro, GEODE_CONCAT(begin, d)), \
// GEODE_NEST1(macro, GEODE_CONCAT(begin, e)), \
// GEODE_NEST1(macro, GEODE_CONCAT(begin, f))
#define GEODE_NEST3(macro, begin) \
GEODE_NEST2(macro, GEODE_CONCAT(begin, 0)), \
GEODE_NEST2(macro, GEODE_CONCAT(begin, 1)), \
GEODE_NEST2(macro, GEODE_CONCAT(begin, 2)), \
GEODE_NEST2(macro, GEODE_CONCAT(begin, 3)), \
GEODE_NEST2(macro, GEODE_CONCAT(begin, 4)), \
GEODE_NEST2(macro, GEODE_CONCAT(begin, 5)), \
GEODE_NEST2(macro, GEODE_CONCAT(begin, 6)), \
GEODE_NEST2(macro, GEODE_CONCAT(begin, 7)), \
GEODE_NEST2(macro, GEODE_CONCAT(begin, 8)), \
GEODE_NEST2(macro, GEODE_CONCAT(begin, 9)), \
GEODE_NEST2(macro, GEODE_CONCAT(begin, a)), \
GEODE_NEST2(macro, GEODE_CONCAT(begin, b)), \
GEODE_NEST2(macro, GEODE_CONCAT(begin, c)), \
GEODE_NEST2(macro, GEODE_CONCAT(begin, d)), \
GEODE_NEST2(macro, GEODE_CONCAT(begin, e)), \
GEODE_NEST2(macro, GEODE_CONCAT(begin, f))
// #define GEODE_NEST3(macro, begin) \
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 0)), \
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 1)), \
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 2)), \
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 3)), \
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 4)), \
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 5)), \
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 6)), \
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 7)), \
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 8)), \
// GEODE_NEST2(macro, GEODE_CONCAT(begin, 9)), \
// GEODE_NEST2(macro, GEODE_CONCAT(begin, a)), \
// GEODE_NEST2(macro, GEODE_CONCAT(begin, b)), \
// GEODE_NEST2(macro, GEODE_CONCAT(begin, c)), \
// GEODE_NEST2(macro, GEODE_CONCAT(begin, d)), \
// GEODE_NEST2(macro, GEODE_CONCAT(begin, e)), \
// GEODE_NEST2(macro, GEODE_CONCAT(begin, f))
#define GEODE_NEST4(macro, begin) \
GEODE_NEST3(macro, GEODE_CONCAT(begin, 0)), \
GEODE_NEST3(macro, GEODE_CONCAT(begin, 1)), \
GEODE_NEST3(macro, GEODE_CONCAT(begin, 2)), \
GEODE_NEST3(macro, GEODE_CONCAT(begin, 3)), \
GEODE_NEST3(macro, GEODE_CONCAT(begin, 4)), \
GEODE_NEST3(macro, GEODE_CONCAT(begin, 5)), \
GEODE_NEST3(macro, GEODE_CONCAT(begin, 6)), \
GEODE_NEST3(macro, GEODE_CONCAT(begin, 7)), \
GEODE_NEST3(macro, GEODE_CONCAT(begin, 8)), \
GEODE_NEST3(macro, GEODE_CONCAT(begin, 9)), \
GEODE_NEST3(macro, GEODE_CONCAT(begin, a)), \
GEODE_NEST3(macro, GEODE_CONCAT(begin, b)), \
GEODE_NEST3(macro, GEODE_CONCAT(begin, c)), \
GEODE_NEST3(macro, GEODE_CONCAT(begin, d)), \
GEODE_NEST3(macro, GEODE_CONCAT(begin, e)), \
GEODE_NEST3(macro, GEODE_CONCAT(begin, f))
// #define GEODE_NEST4(macro, begin) \
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 0)), \
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 1)), \
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 2)), \
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 3)), \
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 4)), \
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 5)), \
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 6)), \
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 7)), \
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 8)), \
// GEODE_NEST3(macro, GEODE_CONCAT(begin, 9)), \
// GEODE_NEST3(macro, GEODE_CONCAT(begin, a)), \
// GEODE_NEST3(macro, GEODE_CONCAT(begin, b)), \
// GEODE_NEST3(macro, GEODE_CONCAT(begin, c)), \
// GEODE_NEST3(macro, GEODE_CONCAT(begin, d)), \
// GEODE_NEST3(macro, GEODE_CONCAT(begin, e)), \
// GEODE_NEST3(macro, GEODE_CONCAT(begin, f))
#define GEODE_ENUM_OFFSETS_DEFINE(hex) GEODE_CONCAT($, hex)
#define GEODE_ENUM_OFFSETS_SET() GEODE_NEST4(GEODE_ENUM_OFFSETS_DEFINE, 0x)
// #define GEODE_ENUM_OFFSETS_DEFINE(hex) GEODE_CONCAT($, hex)
// #define GEODE_ENUM_OFFSETS_SET() GEODE_NEST4(GEODE_ENUM_OFFSETS_DEFINE, 0x)
enum class PrinterOffsets {
GEODE_ENUM_OFFSETS_SET()
};
// enum class PrinterOffsets {
// GEODE_ENUM_OFFSETS_SET()
// };

View file

@ -0,0 +1,324 @@
#pragma once
//thanks pie
enum class SearchType {
Search = 0,
Downloaded = 1,
MostLiked = 2,
Trending = 3,
Recent = 4,
UsersLevels = 5,
Featured = 6,
Magic = 7,
Sends = 8,
MapPack = 9,
MapPackOnClick = 10,
Awarded = 11,
Followed = 12,
Friends = 13,
Users = 14,
LikedGDW = 15,
HallOfFame = 16,
FeaturedGDW = 17,
Similar = 18,
MyLevels = 98,
SavedLevels = 99,
FavouriteLevels = 100
};
// jesus fucking christ (painfully written by @hjfod)
enum class GameObjectType {
Solid = 0,
Hazard = 2,
InverseGravityPortal = 3,
NormalGravityPortal = 4,
ShipPortal = 5,
CubePortal = 6,
Decoration = 7,
YellowJumpPad = 8,
PinkJumpPad = 9,
GravityPad = 10,
YellowJumpRing = 11,
PinkJumpRing = 12,
GravityRing = 13,
InverseMirrorPortal = 14,
NormalMirrorPortal = 15,
BallPortal = 16,
RegularSizePortal = 17,
MiniSizePortal = 18,
UfoPortal = 19,
Modifier = 20,
SecretCoin = 22,
DualPortal = 23,
SoloPortal = 24,
Slope = 25,
WavePortal = 26,
RobotPortal = 27,
TeleportPortal = 28,
GreenRing = 29,
Collectible = 30,
UserCoin = 31,
DropRing = 32,
SpiderPortal = 33,
RedJumpPad = 34,
RedJumpRing = 35,
CustomRing = 36,
DashRing = 37,
GravityDashRing = 38,
CollisionObject = 39,
Special = 40,
};
enum class PulseEffectType {};
enum class TouchTriggerType {};
enum class PlayerButton {};
enum class GhostType {};
enum class TableViewCellEditingStyle {};
enum class UserListType {};
enum class GJErrorCode {};
enum class AccountError {};
enum class GJSongError {};
enum class LikeItemType {
Unknown = 0,
Level = 1,
Comment = 2,
AccountComment = 3
};
enum class GJStoreItem {};
enum class CommentError {};
enum class BackupAccountError {};
enum class BoomListType {
Default = 0x0,
User = 0x2,
Stats = 0x3,
Achievement = 0x4,
Level = 0x5,
Level2 = 0x6,
Comment = 0x7,
Comment2 = 0x8,
Song = 0xb,
Score = 0xc,
MapPack = 0xd,
CustomSong = 0xe,
Comment3 = 0xf,
User2 = 0x10,
Request = 0x11,
Message = 0x12,
LevelScore = 0x13,
Artist = 0x14,
};
enum class MenuAnimationType {
Scale = 0,
Move = 1,
};
enum class ShopType {
Normal,
Secret,
Community
};
// Geode Addition
enum class ZLayer {
B4 = -3,
B3 = -1,
B2 = 1,
B1 = 3,
Default = 0,
T1 = 5,
T2 = 7,
T3 = 9,
};
enum class UpdateResponse {
Unknown,
UpToDate,
GameVerOutOfDate,
UpdateSuccess,
};
enum class UnlockType {
Cube = 0x1,
Col1 = 0x2,
Col2 = 0x3,
Ship = 0x4,
Ball = 0x5,
Bird = 0x6,
Dart = 0x7,
Robot = 0x8,
Spider = 0x9,
Streak = 0xA,
Death = 0xB,
GJItem = 0xC,
};
enum class SpecialRewardItem {
FireShard = 0x1,
IceShard = 0x2,
PoisonShard = 0x3,
ShadowShard = 0x4,
LavaShard = 0x5,
BonusKey = 0x6,
Orbs = 0x7,
Diamonds = 0x8,
CustomItem = 0x9,
};
enum class EditCommand {
SmallLeft = 1,
SmallRight = 2,
SmallUp = 3,
SmallDown = 4,
Left = 5,
Right = 6,
Up = 7,
Down = 8,
BigLeft = 9,
BigRight = 10,
BigUp = 11,
BigDown = 12,
TinyLeft = 13,
TinyRight = 14,
TinyUp = 15,
TinyDown = 16,
FlipX = 17,
FlipY = 18,
RotateCW = 19,
RotateCCW = 20,
RotateCW45 = 21,
RotateCCW45 = 22,
RotateFree = 23,
RotateSnap = 24,
Scale = 25,
};
// Geode Addition
enum class PlaybackMode {
Not = 0,
Playing = 1,
Paused = 2,
};
enum class SelectArtType {
Background = 0,
Ground = 1,
};
enum class UndoCommand {
Delete = 1,
New = 2,
Paste = 3,
DeleteMulti = 4,
Transform = 5,
Select = 6,
};
enum class EasingType {
None = 0,
EaseInOut = 1,
EaseIn = 2,
EaseOut = 3,
ElasticInOut = 4,
ElasticIn = 5,
ElasticOut = 6,
BounceInOut = 7,
BounceIn = 8,
BounceOut = 9,
ExponentialInOut = 10,
ExponentialIn = 11,
ExponentialOut = 12,
SineInOut = 13,
SineIn = 14,
SineOut = 15,
BackInOut = 16,
BackIn = 17,
BackOut = 18,
};
enum class GJDifficulty {
Auto = 0,
Easy = 1,
Normal = 2,
Hard = 3,
Harder = 4,
Insane = 5,
Demon = 6,
DemonEasy = 7,
DemonMedium = 8,
DemonInsane = 9,
DemonExtreme = 10
};
enum class GJLevelType {
Local = 1,
Editor = 2,
Saved = 3
};
enum class IconType {
Cube = 0,
Ship = 1,
Ball = 2,
Ufo = 3,
Wave = 4,
Robot = 5,
Spider = 6,
DeathEffect = 98,
Special = 99,
};
enum class GJChallengeType {
Unknown = 0,
Orbs = 1,
UserCoins = 2,
Stars = 3
};
enum class GJScoreType {
Unknown = 0,
Creator = 1
};
enum class LevelLeaderboardType {
Friends = 0,
Global = 1,
Weekly = 2
};
// Geode Addition
enum class ComparisonType {
Equals = 0,
Larger = 1,
Smaller = 2,
};
// Geode Addition
enum class MoveTargetType {
Both = 0,
XOnly = 1,
YOnly = 2,
};
// Geode Addition
enum class TouchToggleMode {
Normal = 0,
ToggleOn = 1,
ToggleOff = 2,
};
// Geode Addition
enum class LeaderboardState {
Default = 0,
Top100 = 1,
Global = 2,
Creator = 3,
Friends = 4,
};

View file

@ -2,8 +2,7 @@
#include <Geode/DefaultInclude.hpp>
#include "modify/Traits.hpp"
#include "modify/Modify.hpp"
#include <Geode/GeneratedModify.hpp>
#include "modify/Field.hpp"
#include "modify/InternalMacros.hpp"

View file

@ -107,7 +107,6 @@ It's new in cocos2d-x since v0.99.5
class GeodeNodeMetadata;
namespace geode {
struct modify;
struct temp_name_find_better;
namespace modifier {
struct addresses;
struct types;
@ -115,10 +114,9 @@ namespace geode {
}
}
#define GEODE_FRIEND_MODIFY GEODE_ADD(\
friend struct geode::modify;\
friend struct geode::modifier::addresses;\
friend struct geode::modifier::types;\
friend struct geode::temp_name_find_better;\
friend struct ::geode::modify;\
friend struct ::geode::modifier::addresses;\
friend struct ::geode::modifier::types;\
friend class ::GeodeNodeMetadata;\
)
#define GEODE_ADD(...) __VA_ARGS__

View file

@ -1,6 +1,6 @@
#pragma once
#include <Event.hpp>
#include "Event.hpp"
#include <string>
#include <tuple>
#include <functional>

View file

@ -5,7 +5,7 @@
#include <Geode/utils/types.hpp>
#include <string_view>
#include "../hook-core/Hook.hpp"
#include <Geode/hook-core/Hook.hpp>
namespace geode {
class Mod;

View file

@ -10,9 +10,7 @@
#include <functional>
#include <unordered_set>
#include <fs/filesystem.hpp>
#include <Geode/utils/json.hpp>
#include "Log.hpp"
#include <Geode/utils/VersionInfo.hpp>
namespace geode {
#pragma warning(disable: 4251)
@ -27,6 +25,7 @@ namespace geode {
class Mod;
class Hook;
struct ModInfo;
class VersionInfo;
namespace modifier {
template<class, class, class>

View file

@ -3,15 +3,14 @@
#include <Geode/DefaultInclude.hpp>
#include "Types.hpp"
#include "Hook.hpp"
#include "../utils/types.hpp"
#include "../utils/Result.hpp"
#include "../utils/VersionInfo.hpp"
#include <Geode/utils/types.hpp>
#include <Geode/utils/Result.hpp>
#include <Geode/utils/VersionInfo.hpp>
#include <Geode/utils/json.hpp>
#include <string_view>
#include <vector>
#include <unordered_map>
#include <type_traits>
#include <cocos2d.h>
#include "Setting.hpp"
#include <optional>

View file

@ -3,12 +3,12 @@
#include <Geode/DefaultInclude.hpp>
#include <optional>
#include <unordered_set>
#include "../utils/container.hpp"
#include "../utils/json.hpp"
#include "../utils/Result.hpp"
#include "../utils/JsonValidation.hpp"
#include "../utils/convert.hpp"
#include "../utils/platform.hpp"
#include <Geode/utils/container.hpp>
#include <Geode/utils/json.hpp>
#include <Geode/utils/Result.hpp>
#include <Geode/utils/JsonValidation.hpp>
#include <Geode/utils/convert.hpp>
#include <Geode/utils/platform.hpp>
#include <regex>
#pragma warning(push)

View file

@ -1,7 +1,7 @@
#pragma once
#include "Setting.hpp"
#include <Geode/Bindings.hpp>
#include <cocos2d.h>
namespace geode {
class SettingNode;

View file

@ -4,6 +4,6 @@
namespace geode::modifier {
struct addresses {
#include <codegenned/GeneratedAddress.hpp>
#include <Geode/GeneratedAddress.hpp>
};
}

View file

@ -26,6 +26,6 @@ namespace geode::modifier {
>> {
constexpr static inline bool value = true;
};
#include <codegenned/GeneratedCompare.hpp>
#include <Geode/GeneratedCompare.hpp>
};
}

View file

@ -1,10 +1,13 @@
#pragma once
#include <Geode/Bindings.hpp>
#include "Traits.hpp"
#include <Geode/loader/Loader.hpp>
#include <vector>
namespace cocos2d {
class CCNode;
}
namespace geode::modifier {
class FieldContainer {
private:

View file

@ -44,6 +44,4 @@ namespace geode::modifier {
static_assert(core::meta::always_false<Derived>, "Custom Modify not implemented.");
}
};
#include <codegenned/GeneratedModify.hpp>
}

View file

@ -28,7 +28,7 @@ namespace geode::modifier {
using type = FunctionType*;
};
using geode::core::meta::always_false;
using ::geode::core::meta::always_false;
/**
* The ~unevaluated~ function that gets the appropriate
* version of a function type from its return, parameters, and classes.

View file

@ -3,6 +3,6 @@
namespace geode::modifier {
struct types {
#include <codegenned/GeneratedType.hpp>
#include <Geode/GeneratedType.hpp>
};
}

View file

@ -68,7 +68,7 @@ namespace geode::modifier {
struct wrap {
GEODE_WRAPPER_FOR_IDENTIFIER(constructor)
GEODE_WRAPPER_FOR_IDENTIFIER(destructor)
#include <codegenned/GeneratedWrapper.hpp>
#include <Geode/GeneratedWrapper.hpp>
};
// template <template<class, class, class=void> class Identifier, class Base, class Derived, class ...Types>

View file

@ -71,7 +71,7 @@ namespace std {
#define GEODE_PLATFORM_TARGET PlatformID::Windows
#define GEODE_HIDDEN
#define GEODE_DUPABLE __forceinline
#define GEODE_INLINE __forceinline
#define GEODE_VIRTUAL_CONSTEXPR
#define GEODE_NOINLINE __declspec(noinline)
@ -90,7 +90,7 @@ namespace std {
#define GEODE_PLATFORM_TARGET PlatformID::MacOS
#define GEODE_HIDDEN __attribute__((visibility("hidden")))
#define GEODE_DUPABLE __attribute__((always_inline))
#define GEODE_INLINE inline __attribute__((always_inline))
#define GEODE_VIRTUAL_CONSTEXPR constexpr
#define GEODE_NOINLINE __attribute__((noinline))
@ -109,7 +109,7 @@ namespace std {
#define GEODE_PLATFORM_TARGET PlatformID::iOS
#define GEODE_HIDDEN __attribute__((visibility("hidden")))
#define GEODE_DUPABLE __attribute__((always_inline))
#define GEODE_INLINE inline __attribute__((always_inline))
#define GEODE_VIRTUAL_CONSTEXPR constexpr
#define GEODE_NOINLINE __attribute__((noinline))
@ -128,7 +128,7 @@ namespace std {
#define GEODE_PLATFORM_TARGET PlatformID::Android
#define GEODE_HIDDEN __attribute__((visibility("hidden")))
#define GEODE_DUPABLE __attribute__((always_inline))
#define GEODE_INLINE inline __attribute__((always_inline))
#define GEODE_VIRTUAL_CONSTEXPR constexpr
#define GEODE_NOINLINE __attribute__((noinline))

View file

@ -1,6 +1,7 @@
#pragma once
#include "BasedButtonSprite.hpp"
#include <Geode/binding/CCMenuItemToggler.hpp>
#pragma warning(disable : 4275)

View file

@ -1,6 +1,6 @@
#pragma once
#include <Geode/Bindings.hpp>
#include <cocos2d.h>
namespace geode {
enum class CircleBaseSize {

View file

@ -1,6 +1,8 @@
#include "Popup.hpp"
#include "InputNode.hpp"
#include <Geode/binding/TextInputDelegate.hpp>
namespace geode {
class ColorPickPopupDelegate {
public:

View file

@ -1,6 +1,10 @@
#pragma once
#include <Geode/Bindings.hpp>
#include <cocos2d.h>
namespace cocos2d::extension {
class CCScale9Sprite;
}
namespace geode {
class GEODE_DLL IconButtonSprite :

View file

@ -1,6 +1,6 @@
#pragma once
#include <Geode/Bindings.hpp>
#include <cocos2d.h>
namespace geode {
class GEODE_DLL InputNode : public cocos2d::CCMenuItem {

View file

@ -1,6 +1,7 @@
#pragma once
#include <Geode/Bindings.hpp>
#include <Geode/binding/TableViewCell.hpp>
#include <Geode/binding/CustomListView.hpp>
namespace geode {
class GEODE_DLL GenericListCell : public TableViewCell {

View file

@ -1,10 +1,11 @@
#pragma once
#include <Geode/Bindings.hpp>
#include <Geode/binding/FLAlertLayerProtocol.hpp>
#include "TextRenderer.hpp"
#include "ScrollLayer.hpp"
struct MDParser;
class CCScrollLayerExt;
namespace geode {
/**

View file

@ -1,6 +1,6 @@
#pragma once
#include <Geode/Bindings.hpp>
#include <cocos2d.h>
#include "SceneManager.hpp"
#include <chrono>
#include "../utils/Ref.hpp"

View file

@ -1,6 +1,7 @@
#pragma once
#include <Geode/Bindings.hpp>
#include <Geode/binding/FLAlertLayer.hpp>
#include <Geode/binding/CCMenuItemSpriteExtra.hpp>
namespace geode {
template<typename... InitArgs>

View file

@ -1,6 +1,9 @@
#pragma once
#include <Geode/Bindings.hpp>
namespace cocos2d {
class CCArray;
class CCNode;
}
namespace geode {
class GEODE_DLL SceneManager {

View file

@ -1,6 +1,7 @@
#pragma once
#include <Geode/Bindings.hpp>
#include <Geode/binding/CCContentLayer.hpp>
#include <Geode/binding/CCScrollLayerExt.hpp>
namespace geode {
/**

View file

@ -1,6 +1,6 @@
#pragma once
#include <Geode/Bindings.hpp>
#include <cocos2d.h>
namespace geode {
class GEODE_DLL Scrollbar : public cocos2d::CCLayer {

View file

@ -1,6 +1,6 @@
#pragma once
#include <Geode/Bindings.hpp>
#include <Geode/binding/CCMenuItemSpriteExtra.hpp>
namespace geode {

View file

@ -1,6 +1,6 @@
#pragma once
#include <Geode/Bindings.hpp>
#include <cocos2d.h>
namespace geode {
enum class TextAlignment {

View file

@ -247,14 +247,20 @@ namespace geode::cocos {
}
};
}
namespace std {
template <typename T>
struct std::iterator_traits<CCArrayIterator<T>> {
struct iterator_traits<geode::cocos::CCArrayIterator<T>> {
using difference_type = ptrdiff_t;
using value_type = T;
using pointer = T*;
using reference = T&;
using iterator_category = std::random_access_iterator_tag; // its random access but im too lazy to implement it
};
}
namespace geode::cocos {
struct GEODE_DLL CCArrayInserter {
public:

View file

@ -1,6 +1,6 @@
#pragma once
#include <Geode/Geode.hpp>
#include <cocos2d.h>
namespace geode {
static cocos2d::CCPoint& operator*=(cocos2d::CCPoint & pos, float mul) {

View file

@ -1,7 +1,7 @@
#include <Geode/Bindings.hpp>
#include <cocos2d.h>
#include <Geode/utils/Ref.hpp>
#include <Geode/Modify.hpp>
#include <Geode/utils/WackyGeodeMacros.hpp>
#include <Geode/utils/cocos.hpp>
#include <Geode/modify/Field.hpp>
USE_GEODE_NAMESPACE();
using namespace geode::modifier;
@ -59,6 +59,7 @@ public:
};
// proxy forwards
#include <Geode/modify/CCNode.hpp>
class $modify(ProxyCCNode, CCNode) {
virtual CCObject* getUserObject() {
return GeodeNodeMetadata::set(this)->m_userObject;
@ -82,7 +83,7 @@ void CCNode::setID(std::string const& id) {
}
CCNode* CCNode::getChildByID(std::string const& id) {
CCARRAY_FOREACH_B_TYPE(m_pChildren, child, CCNode) {
for (auto child : CCArrayExt<CCNode>(m_pChildren)) {
if (child->getID() == id) {
return child;
}
@ -94,7 +95,7 @@ CCNode* CCNode::getChildByIDRecursive(std::string const& id) {
if (auto child = this->getChildByID(id)) {
return child;
}
CCARRAY_FOREACH_B_TYPE(m_pChildren, child, CCNode) {
for (auto child : CCArrayExt<CCNode>(m_pChildren)) {
if ((child = child->getChildByIDRecursive(id))) {
return child;
}

View file

@ -1,8 +1,8 @@
#include <Geode/Modify.hpp>
#include <array>
USE_GEODE_NAMESPACE();
#include <Geode/modify/LoadingLayer.hpp>
class $modify(CustomLoadingLayer, LoadingLayer) {
bool init(bool fromReload) {
if (!LoadingLayer::init(fromReload))

View file

@ -1,5 +1,4 @@
#include <Geode/Geode.hpp>
#include <Geode/utils/WackyGeodeMacros.hpp>
#include <Geode/utils/cocos.hpp>
#include <Geode/ui/BasedButtonSprite.hpp>
#include <Geode/ui/Notification.hpp>
#include <Index.hpp>
@ -8,7 +7,6 @@
#include <InternalMod.hpp>
#include "../ui/internal/info/ModInfoLayer.hpp"
#include <InternalLoader.hpp>
#include <Geode/Modify.hpp>
USE_GEODE_NAMESPACE();
@ -64,6 +62,7 @@ static void updateIndexProgress(
}
}
#include <Geode/modify/MenuLayer.hpp>
class $modify(CustomMenuLayer, MenuLayer) {
void destructor() {
g_geodeButton = nullptr;
@ -163,7 +162,7 @@ class $modify(CustomMenuLayer, MenuLayer) {
bottomMenu->alignItemsHorizontallyWithPadding(3.f);
CCARRAY_FOREACH_B_TYPE(bottomMenu->getChildren(), node, CCNode) {
for (auto node : CCArrayExt<CCNode>(bottomMenu->getChildren())) {
node->setPositionY(y);
}
if (chest) {

View file

@ -1,6 +1,6 @@
#include <Geode/Modify.hpp>
#ifdef GEODE_IS_WINDOWS
#include <Geode/loader/Mod.hpp>
#include <Geode/modify/InternalMacros.hpp>
USE_GEODE_NAMESPACE();
using geode::core::meta::x86::Thiscall;

View file

@ -1,7 +1,6 @@
#include <Geode/Modify.hpp>
USE_GEODE_NAMESPACE();
#include <Geode/modify/CCTouchDispatcher.hpp>
class $modify(CCTouchDispatcher) {
void addTargetedDelegate(CCTouchDelegate *delegate, int priority, bool swallowsTouches) {
m_bForcePrio = false;

View file

@ -1,4 +1,3 @@
// #include <Geode/Geode.hpp>
// // this is the fix for the dynamic_cast problems
// USE_GEODE_NAMESPACE();

View file

@ -1,13 +1,10 @@
#include <Geode/Modify.hpp>
// this is the fix for the dynamic_cast problems
// TODO: completely replace dynamic_cast on macos
using namespace cocos2d;
using namespace geode::modifier;
#if defined(GEODE_IS_IOS) || defined(GEODE_IS_MACOS)
namespace geode::fixes {
using namespace geode::cast;
#define HandlerFixFor(CCUtility) \
@ -49,10 +46,14 @@ class $modify(CCUtility##HandlerTypeinfoFix, CCUtility##Handler) {
} \
}
#include <Geode/modify/CCKeypadHandler.hpp>
HandlerFixFor(CCKeypad);
#include <Geode/modify/CCKeyboardHandler.hpp>
HandlerFixFor(CCKeyboard);
#include <Geode/modify/CCMouseHandler.hpp>
HandlerFixFor(CCMouse);
#include <Geode/modify/CCTargetedTouchHandler.hpp>
class $modify(CCTargetedTouchHandlerTypeinfoFix, CCTargetedTouchHandler) {
void destructor() {
if (m_pDelegate) {
@ -99,6 +100,7 @@ class $modify(CCTargetedTouchHandlerTypeinfoFix, CCTargetedTouchHandler) {
}
};
#include <Geode/modify/CCStandardTouchHandler.hpp>
class $modify(CCStandardTouchHandlerTypeinfoFix, CCStandardTouchHandler) {
void destructor() {
if (m_pDelegate) {
@ -140,6 +142,4 @@ class $modify(CCStandardTouchHandlerTypeinfoFix, CCStandardTouchHandler) {
}
};
} // geode::fixes
#endif

View file

@ -1,8 +1,8 @@
#include <Geode/Modify.hpp>
#include <Geode/ui/SceneManager.hpp>
USE_GEODE_NAMESPACE();
#include <Geode/modify/AchievementNotifier.hpp>
class $modify(AchievementNotifier) {
void willSwitchToScene(CCScene* scene) {
AchievementNotifier::willSwitchToScene(scene);

View file

@ -1,8 +1,8 @@
#include <Geode/Modify.hpp>
#include <Geode/loader/Loader.hpp>
USE_GEODE_NAMESPACE();
#include <Geode/modify/AppDelegate.hpp>
class $modify(AppDelegate) {
void trySaveGame() {
log::log(Severity::Info, Loader::getInternalMod(), "Saving...");

View file

@ -1,8 +1,8 @@
#include <Geode/Modify.hpp>
#include <InternalLoader.hpp>
USE_GEODE_NAMESPACE();
#include <Geode/modify/CCScheduler.hpp>
class $modify(CCScheduler) {
void update(float dt) {
InternalLoader::get()->executeGDThreadQueue();

View file

@ -1,8 +1,8 @@
#include <Geode/Modify.hpp>
#include <Geode/loader/Loader.hpp>
USE_GEODE_NAMESPACE();
#include <Geode/modify/GameManager.hpp>
class $modify(GameManager) {
void reloadAllStep2() {
GameManager::reloadAllStep2();
@ -10,6 +10,7 @@ class $modify(GameManager) {
}
};
#include <Geode/modify/LoadingLayer.hpp>
class $modify(LoadingLayer) {
void loadAssets() {
LoadingLayer::loadAssets();

View file

@ -4,6 +4,9 @@
#include <Geode/utils/JsonValidation.hpp>
#include <Geode/utils/fetch.hpp>
#include <hash.hpp>
#include <Geode/utils/file.hpp>
#include <Geode/utils/string.hpp>
#include <Geode/utils/vector.hpp>
#define GITHUB_DONT_RATE_LIMIT_ME_PLS 0

View file

@ -1,6 +1,5 @@
#pragma once
#include <Geode/Geode.hpp>
#include <mutex>
#include <optional>
#include <Geode/utils/fetch.hpp>

View file

@ -0,0 +1,203 @@
#include "Index.hpp"
#include <thread>
#include <Geode/utils/json.hpp>
#include <hash.hpp>
#include <Geode/utils/fetch.hpp>
#include <Geode/utils/file.hpp>
#include <Geode/utils/string.hpp>
void InstallTicket::postProgress(
UpdateStatus status,
std::string const& info,
uint8_t percentage
) {
if (m_progress) {
Loader::get()->queueInGDThread([this, status, info, percentage]() -> void {
m_progress(this, status, info, percentage);
});
}
if (status == UpdateStatus::Failed || status == UpdateStatus::Finished) {
log::info("Deleting InstallTicket at {}", this);
// clean up own memory
delete this;
}
}
InstallTicket::InstallTicket(
Index* index,
std::vector<std::string> const& list,
ItemInstallCallback progress
) : m_index(index),
m_installList(list),
m_progress(progress) {}
std::vector<std::string> InstallTicket::getInstallList() const {
return m_installList;
}
void InstallTicket::install(std::string const& id) {
// run installing in another thread in order
// to render progress on screen while installing
auto indexDir = Loader::get()->getGeodeDirectory() / "index";
auto item = m_index->getKnownItem(id);
this->postProgress(UpdateStatus::Progress, "Checking status", 0);
// download to temp file in index dir
auto tempFile = indexDir / item.m_download.m_filename;
this->postProgress(UpdateStatus::Progress, "Fetching binary", 0);
auto res = web::fetchFile(
item.m_download.m_url,
tempFile,
[this, tempFile](double now, double total) -> int {
// check if cancelled
std::lock_guard cancelLock(m_cancelMutex);
if (m_cancelling) {
try { ghc::filesystem::remove(tempFile); } catch(...) {}
return false;
}
// no need to scope the lock guard more as this
// function is going to exit right after anyway
this->postProgress(
UpdateStatus::Progress,
"Downloading binary",
static_cast<uint8_t>(now / total * 100.0)
);
return true;
}
);
if (!res) {
try { ghc::filesystem::remove(tempFile); } catch(...) {}
return this->postProgress(
UpdateStatus::Failed,
"Downloading failed: " + res.error()
);
}
// check if cancelled
{
std::lock_guard cancelLock(m_cancelMutex);
if (m_cancelling) {
ghc::filesystem::remove(tempFile);
return;
}
// scope ends here since we don't need to
// access m_cancelling anymore
}
// check for 404
auto notFound = utils::file::readString(tempFile);
if (notFound && notFound.value() == "Not Found") {
try { ghc::filesystem::remove(tempFile); } catch(...) {}
return this->postProgress(
UpdateStatus::Failed,
"Binary file download returned \"Not found\". Report "
"this to the Geode development team."
);
}
// verify checksum
this->postProgress(UpdateStatus::Progress, "Verifying", 100);
auto checksum = ::calculateHash(tempFile.string());
if (checksum != item.m_download.m_hash) {
try { ghc::filesystem::remove(tempFile); } catch(...) {}
return this->postProgress(
UpdateStatus::Failed,
"Checksum mismatch! (Downloaded file did not match what "
"was expected. Try again, and if the download fails another time, "
"report this to the Geode development team."
);
}
// move temp file to geode directory
try {
auto modDir = Loader::get()->getGeodeDirectory() / "mods";
auto targetFile = modDir / item.m_download.m_filename;
// find valid filename that doesn't exist yet
if (!m_replaceFiles) {
auto filename = ghc::filesystem::path(
item.m_download.m_filename
).replace_extension("").string();
size_t number = 0;
while (ghc::filesystem::exists(targetFile)) {
targetFile = modDir /
(filename + std::to_string(number) + ".geode");
number++;
}
}
// move file
ghc::filesystem::rename(tempFile, targetFile);
} catch(std::exception& e) {
try { ghc::filesystem::remove(tempFile); } catch(...) {}
return this->postProgress(
UpdateStatus::Failed,
"Unable to move downloaded file to mods directory: \"" +
std::string(e.what()) + " \" "
"(This might be due to insufficient permissions to "
"write files under SteamLibrary, try running GD as "
"administrator)"
);
}
// call next in queue or post finish message
Loader::get()->queueInGDThread([this, id]() -> void {
// todo: Loader::get()->refreshMods(m_updateMod);
// where the Loader unloads the mod binary and
// reloads it from disk (this should prolly be
// done only for the installed mods)
Loader::get()->refreshMods();
// already in GD thread, so might aswell do the
// progress posting manually
if (m_progress) {
(m_progress)(
this, UpdateStatus::Finished, "", 100
);
}
// clean up memory
delete this;
});
}
void InstallTicket::cancel() {
// really no point in using std::lock_guard here
// since just plain locking and unlocking the mutex
// will do the job just fine with the same legibility
m_cancelMutex.lock();
m_cancelling = true;
m_cancelMutex.unlock();
}
void InstallTicket::start(InstallMode mode) {
if (m_installing) return;
// make sure we have stuff to install
if (!m_installList.size()) {
return this->postProgress(
UpdateStatus::Failed, "Nothing to install", 0
);
}
m_installing = true;
switch (mode) {
case InstallMode::Concurrent: {
for (auto& id : m_installList) {
std::thread(&InstallTicket::install, this, id).detach();
}
} break;
case InstallMode::Order: {
std::thread([this]() -> void {
for (auto& id : m_installList) {
this->install(id);
}
}).detach();
} break;
}
}

View file

@ -6,7 +6,6 @@
#include "InternalMod.hpp"
#include <Geode/loader/Log.hpp>
#include <Geode/loader/Loader.hpp>
#include <Geode/Geode.hpp>
#include <Geode/utils/fetch.hpp>
#include <thread>

View file

@ -4,7 +4,8 @@
#ifdef GEODE_IS_WINDOWS
#include <Geode/Geode.hpp>
#include <Geode/utils/casts.hpp>
#include <Geode/utils/file.hpp>
#include "../crashlog.hpp"
#include <Windows.h>

View file

@ -10,7 +10,6 @@
#include <Geode/utils/map.hpp>
#include <Geode/utils/types.hpp>
#include <mutex>
#include <Geode/Geode.hpp>
#include <about.hpp>
#include <crashlog.hpp>

View file

@ -1,4 +1,3 @@
#include <Geode/Geode.hpp>
#include <Geode/loader/Log.hpp>
#include <Geode/loader/Mod.hpp>
#include <Geode/loader/Loader.hpp>

View file

@ -2,7 +2,7 @@
#ifdef GEODE_IS_IOS
#include <Geode/Geode.hpp>
#include <Geode/loader/Mod.hpp>
#include <dlfcn.h>
USE_GEODE_NAMESPACE();

View file

@ -2,7 +2,7 @@
#ifdef GEODE_IS_WINDOWS
#include <Geode/Geode.hpp>
#include <Geode/loader/Mod.hpp>
USE_GEODE_NAMESPACE();
template<typename T>

View file

@ -1,4 +1,4 @@
#include <Geode/Geode.hpp>
#include <Geode/utils/string.hpp>
USE_GEODE_NAMESPACE();

View file

@ -1,4 +1,5 @@
#include "HookListLayer.hpp"
#include <Geode/binding/GJListLayer.hpp>
bool HookListLayer::init(Mod* mod) {
if (!GJDropDownLayer::init("Hooks", 220.f))

View file

@ -1,6 +1,7 @@
#pragma once
#include "HookListView.hpp"
#include <Geode/binding/GJDropDownLayer.hpp>
class HookListLayer : public GJDropDownLayer {
protected:

View file

@ -1,4 +1,7 @@
#include "HookListView.hpp"
#include <Geode/binding/TableView.hpp>
#include <Geode/binding/StatsCell.hpp>
#include <Geode/utils/casts.hpp>
HookCell::HookCell(const char* name, CCSize size) :
TableViewCell(name, size.width, size.height) {}

View file

@ -1,6 +1,7 @@
#pragma once
#include <Geode/Geode.hpp>
#include <Geode/binding/TableViewCell.hpp>
#include <Geode/binding/CustomListView.hpp>
USE_GEODE_NAMESPACE();

View file

@ -1,6 +1,6 @@
#pragma once
#include <Geode/Geode.hpp>
#include <cocos2d.h>
USE_GEODE_NAMESPACE();

View file

@ -1,6 +1,6 @@
#pragma once
#include <Geode/Geode.hpp>
#include <cocos2d.h>
USE_GEODE_NAMESPACE();

View file

@ -2,11 +2,18 @@
#include "../dev/HookListLayer.hpp"
#include <Geode/ui/BasedButton.hpp>
#include "../list/ModListView.hpp"
#include <Geode/utils/WackyGeodeMacros.hpp>
#include <Geode/utils/casts.hpp>
#include <Geode/utils/vector.hpp>
#include <Geode/ui/IconButtonSprite.hpp>
#include <Geode/ui/MDPopup.hpp>
#include "../settings/ModSettingsPopup.hpp"
#include <InternalLoader.hpp>
#include <Geode/binding/Slider.hpp>
#include <Geode/binding/SliderThumb.hpp>
#include <Geode/binding/ButtonSprite.hpp>
#include <Geode/binding/SliderTouchLogic.hpp>
#include <Geode/binding/GJListLayer.hpp>
#include <Geode/binding/CCTextInputNode.hpp>
// TODO: die
#undef min

View file

@ -1,6 +1,7 @@
#pragma once
#include <Geode/Geode.hpp>
#include <Geode/binding/FLAlertLayer.hpp>
#include <Geode/binding/FLAlertLayerProtocol.hpp>
#include <Index.hpp>
#include <Geode/ui/MDTextArea.hpp>
#include <Geode/ui/Scrollbar.hpp>

View file

@ -3,6 +3,15 @@
#include "SearchFilterPopup.hpp"
#include <Geode/ui/Notification.hpp>
#include <optional>
#include <Geode/binding/GJListLayer.hpp>
#include <Geode/binding/CCTextInputNode.hpp>
#include <Geode/binding/ButtonSprite.hpp>
#include <Geode/binding/LoadingCircle.hpp>
#include <Geode/binding/MenuLayer.hpp>
#include <Geode/binding/GameToolbox.hpp>
#include <Geode/binding/StatsCell.hpp>
#include <Geode/binding/TableView.hpp>
#include <Geode/utils/casts.hpp>
static ModListType g_tab = ModListType::Installed;
static ModListLayer* g_instance = nullptr;

View file

@ -1,6 +1,6 @@
#pragma once
#include <Geode/Geode.hpp>
#include <Geode/binding/TextInputDelegate.hpp>
#include "ModListView.hpp"
#include <Index.hpp>

View file

@ -1,10 +1,15 @@
#include "ModListView.hpp"
#include "../info/ModInfoLayer.hpp"
#include <Geode/utils/WackyGeodeMacros.hpp>
#include <Geode/utils/cocos.hpp>
#include <Geode/utils/casts.hpp>
#include <Geode/utils/string.hpp>
#include <Index.hpp>
#include "ModListLayer.hpp"
#include <InternalLoader.hpp>
#include "../info/CategoryNode.hpp"
#include <Geode/binding/StatsCell.hpp>
#include <Geode/binding/ButtonSprite.hpp>
#include <Geode/binding/TableView.hpp>
template<class T>
static bool tryOrAlert(Result<T> const& res, const char* title) {
@ -384,7 +389,7 @@ ModCell* ModCell::create(ModListView* list, bool expanded, const char* key, CCSi
void ModListView::updateAllStates(ModCell* toggled) {
CCARRAY_FOREACH_B_TYPE(m_tableView->m_cellArray, cell, ModCell) {
for (auto cell : CCArrayExt<ModCell>(m_tableView->m_cellArray)) {
cell->updateState(toggled == cell);
}
}

View file

@ -1,6 +1,8 @@
#pragma once
#include <Geode/Geode.hpp>
#include <Geode/binding/TableViewCell.hpp>
#include <Geode/binding/FLAlertLayerProtocol.hpp>
#include <Geode/binding/CustomListView.hpp>
#include <Index.hpp>
#include <optional>

View file

@ -3,6 +3,7 @@
#include "ModListView.hpp"
#include <Geode/ui/SelectList.hpp>
#include "../info/CategoryNode.hpp"
#include <Geode/binding/GameToolbox.hpp>
bool SearchFilterPopup::setup(ModListLayer* layer, ModListType type) {
m_noElasticity = true;

View file

@ -1,5 +1,9 @@
#include "GeodeSettingNode.hpp"
#include <Geode/utils/platform.hpp>
#include <Geode/binding/ColorChannelSprite.hpp>
#include <Geode/binding/ButtonSprite.hpp>
#include <Geode/binding/CCTextInputNode.hpp>
#include <Geode/binding/Slider.hpp>
// BoolSettingNode

View file

@ -2,7 +2,10 @@
#include <Geode/loader/Setting.hpp>
#include <Geode/loader/SettingNode.hpp>
#include <Geode/Bindings.hpp>
#include <Geode/binding/CCMenuItemSpriteExtra.hpp>
#include <Geode/binding/CCTextInputNode.hpp>
#include <Geode/binding/Slider.hpp>
#include <Geode/binding/SliderThumb.hpp>
#include <Geode/ui/InputNode.hpp>
#include <Geode/ui/BasedButtonSprite.hpp>
#include <Geode/utils/convert.hpp>
@ -297,7 +300,7 @@ namespace {
decArrowSpr->setScale(.3f);
m_decArrow = CCMenuItemSpriteExtra::create(
decArrowSpr, self(), menu_selector(ImplArrows::onDecrement)
decArrowSpr, self(), menu_selector(ImplArrows::Callbacks::onDecrement)
);
m_decArrow->setPosition(-width / 2 + 80.f, yPos);
self()->m_menu->addChild(m_decArrow);
@ -306,7 +309,7 @@ namespace {
incArrowSpr->setScale(.3f);
m_incArrow = CCMenuItemSpriteExtra::create(
incArrowSpr, self(), menu_selector(ImplArrows::onIncrement)
incArrowSpr, self(), menu_selector(ImplArrows::Callbacks::onIncrement)
);
m_incArrow->setPosition(-10.f, yPos);
self()->m_menu->addChild(m_incArrow);
@ -318,7 +321,7 @@ namespace {
decArrowSpr->setScale(.3f);
m_bigDecArrow = CCMenuItemSpriteExtra::create(
decArrowSpr, self(), menu_selector(ImplArrows::onBigDecrement)
decArrowSpr, self(), menu_selector(ImplArrows::Callbacks::onBigDecrement)
);
m_bigDecArrow->setPosition(-width / 2 + 65.f, yPos);
self()->m_menu->addChild(m_bigDecArrow);
@ -327,50 +330,46 @@ namespace {
incArrowSpr->setScale(.3f);
m_bigIncArrow = CCMenuItemSpriteExtra::create(
incArrowSpr, self(), menu_selector(ImplArrows::onBigIncrement)
incArrowSpr, self(), menu_selector(ImplArrows::Callbacks::onBigIncrement)
);
m_bigIncArrow->setPosition(5.f, yPos);
self()->m_menu->addChild(m_bigIncArrow);
}
}
void onIncrement(CCObject*) {
// intentionally refcast to prevent warnings on clang and
// not to offset this as it has already been offset to the
// correct vtable when it's passed to CCMenuItemSpriteExtra
auto self = reference_cast<C*>(this);
self->m_uncommittedValue += std::static_pointer_cast<T>(
self->m_setting
)->getArrowStepSize();
self->valueChanged(true);
}
// intentionally a subclass to make it relatively safe to
// use as callbacks for the child class, since we give the
// child class as the target to CCMenuItemSpriteExtra
struct Callbacks : public C {
void onIncrement(CCObject*) {
this->m_uncommittedValue += std::static_pointer_cast<T>(
this->m_setting
)->getArrowStepSize();
this->valueChanged(true);
}
void onDecrement(CCObject*) {
// intentional, see ImplArrows::onIncrement
auto self = reference_cast<C*>(this);
self->m_uncommittedValue -= std::static_pointer_cast<T>(
self->m_setting
)->getArrowStepSize();
self->valueChanged(true);
}
void onDecrement(CCObject*) {
this->m_uncommittedValue -= std::static_pointer_cast<T>(
this->m_setting
)->getArrowStepSize();
this->valueChanged(true);
}
void onBigIncrement(CCObject*) {
// intentional, see ImplArrows::onIncrement
auto self = reference_cast<C*>(this);
self->m_uncommittedValue += std::static_pointer_cast<T>(
self->m_setting
)->getBigArrowStepSize();
self->valueChanged(true);
}
void onBigIncrement(CCObject*) {
this->m_uncommittedValue += std::static_pointer_cast<T>(
this->m_setting
)->getBigArrowStepSize();
this->valueChanged(true);
}
void onBigDecrement(CCObject*) {
this->m_uncommittedValue -= std::static_pointer_cast<T>(
this->m_setting
)->getBigArrowStepSize();
this->valueChanged(true);
}
};
void onBigDecrement(CCObject*) {
// intentional, see ImplArrows::onIncrement
auto self = reference_cast<C*>(this);
self->m_uncommittedValue -= std::static_pointer_cast<T>(
self->m_setting
)->getBigArrowStepSize();
self->valueChanged(true);
}
};
template<class C, class T>
@ -413,7 +412,7 @@ namespace {
void setupSlider(std::shared_ptr<T> setting, float width) {
if (setting->hasSlider()) {
m_slider = Slider::create(
self(), menu_selector(ImplSlider::onSlider), .5f
self(), menu_selector(ImplSlider::Callbacks::onSlider), .5f
);
m_slider->setPosition(-50.f, -15.f);
self()->m_menu->addChild(m_slider);
@ -432,17 +431,21 @@ namespace {
}
}
void onSlider(CCObject* slider) {
// intentional, see ImplArrows::onIncrement
auto self = reference_cast<C*>(this);
auto setting = std::static_pointer_cast<T>(self->m_setting);
// intentionally a subclass to make it relatively safe to
// use as callbacks for the child class, since we give the
// child class as the target to CCMenuItemSpriteExtra
struct Callbacks : public C {
void onSlider(CCObject* slider) {
auto setting = std::static_pointer_cast<T>(this->m_setting);
self->m_uncommittedValue = valueFromSlider(
setting,
static_cast<SliderThumb*>(slider)->getValue()
);
self->valueChanged(true);
}
this->m_uncommittedValue = valueFromSlider(
setting,
static_cast<SliderThumb*>(slider)->getValue()
);
this->valueChanged(true);
}
};
};
}

View file

@ -3,6 +3,7 @@
#include <Geode/loader/Setting.hpp>
#include <Geode/utils/cocos.hpp>
#include <Geode/utils/convert.hpp>
#include <Geode/binding/ButtonSprite.hpp>
bool ModSettingsPopup::setup(Mod* mod) {
m_noElasticity = true;

View file

@ -1,5 +1,9 @@
#include <Geode/ui/ColorPickPopup.hpp>
#include <Geode/utils/operators.hpp>
#include <Geode/binding/ButtonSprite.hpp>
#include <Geode/binding/CCTextInputNode.hpp>
#include <Geode/binding/Slider.hpp>
#include <Geode/binding/SliderThumb.hpp>
USE_GEODE_NAMESPACE();

View file

@ -1,5 +1,5 @@
#include <Geode/ui/IconButtonSprite.hpp>
#include <Geode/Utils.hpp>
#include <Geode/utils/cocos.hpp>
USE_GEODE_NAMESPACE();

View file

@ -1,4 +1,5 @@
#include <Geode/ui/InputNode.hpp>
#include <Geode/binding/CCTextInputNode.hpp>
USE_GEODE_NAMESPACE();

View file

@ -1,5 +1,8 @@
#include <Geode/ui/ListView.hpp>
#include <Geode/Utils.hpp>
#include <Geode/binding/StatsCell.hpp>
#include <Geode/binding/TableView.hpp>
#include <Geode/utils/casts.hpp>
#include <Geode/utils/cocos.hpp>
USE_GEODE_NAMESPACE();

View file

@ -1,5 +1,6 @@
#include <Geode/ui/MDPopup.hpp>
#include <Geode/utils/string.hpp>
#include <Geode/binding/ButtonSprite.hpp>
USE_GEODE_NAMESPACE();

View file

@ -1,7 +1,10 @@
#include <Geode/ui/MDTextArea.hpp>
#include <Geode/utils/WackyGeodeMacros.hpp>
#include <md4c.h>
#include <Geode/Utils.hpp>
#include <Geode/binding/ProfilePage.hpp>
#include <Geode/utils/cocos.hpp>
#include <Geode/utils/string.hpp>
#include <Geode/utils/casts.hpp>
#include <Geode/utils/vector.hpp>
USE_GEODE_NAMESPACE();
@ -53,7 +56,7 @@ public:
// so that's why based MDContentLayer expects itself
// to have a CCMenu :-)
if (m_content) {
CCARRAY_FOREACH_B_TYPE(m_content->getChildren(), child, CCNode) {
for (auto child : CCArrayExt<CCNode>(m_content->getChildren())) {
auto y = this->getPositionY() + child->getPositionY();
child->setVisible(!(
(m_content->getContentSize().height < y) ||

View file

@ -1,7 +1,8 @@
#include <Geode/ui/Notification.hpp>
#include <Geode/ui/TextRenderer.hpp>
#include <Geode/utils/WackyGeodeMacros.hpp>
#include <Geode/Utils.hpp>
#include <Geode/binding/GameSoundManager.hpp>
#include <Geode/utils/cocos.hpp>
#include <Geode/utils/vector.hpp>
USE_GEODE_NAMESPACE();
@ -220,7 +221,7 @@ bool Notification::init(
m_obContentSize.width += iconSpace;
m_icon->setPositionX(m_icon->getPositionX() - iconSpace / 2);
m_title->setPositionX(m_title->getPositionX() - iconSpace / 2);
CCARRAY_FOREACH_B_TYPE(m_labels, label, CCNode) {
for (auto label : CCArrayExt<CCNode>(m_labels)) {
label->setPosition(
label->getPositionX() + iconSpace - m_obContentSize.width / 2,
label->getPositionY() - m_obContentSize.height / 2 + 2.f

View file

@ -1,5 +1,5 @@
#include <Geode/ui/SceneManager.hpp>
#include <Geode/utils/WackyGeodeMacros.hpp>
#include <Geode/utils/cocos.hpp>
USE_GEODE_NAMESPACE();
@ -31,7 +31,7 @@ void SceneManager::forget(CCNode* node) {
}
void SceneManager::willSwitchToScene(CCScene* scene) {
CCARRAY_FOREACH_B_TYPE(m_persistedNodes, node, CCNode) {
for (auto node : CCArrayExt<CCNode>(m_persistedNodes)) {
// no cleanup in order to keep actions running
node->removeFromParentAndCleanup(false);
scene->addChild(node);

View file

@ -1,5 +1,5 @@
#include <Geode/ui/ScrollLayer.hpp>
#include <Geode/utils/WackyGeodeMacros.hpp>
#include <Geode/utils/cocos.hpp>
USE_GEODE_NAMESPACE();
@ -18,7 +18,7 @@ void GenericContentLayer::setPosition(CCPoint const& pos) {
// all be TableViewCells
CCLayerColor::setPosition(pos);
CCARRAY_FOREACH_B_TYPE(m_pChildren, child, CCNode) {
for (auto child : CCArrayExt<CCNode>(m_pChildren)) {
auto y = this->getPositionY() + child->getPositionY();
child->setVisible(!(
(m_obContentSize.height < y) ||

View file

@ -1,5 +1,6 @@
#include <Geode/ui/Scrollbar.hpp>
#include <Geode/Utils.hpp>
#include <Geode/utils/operators.hpp>
#include <Geode/utils/cocos.hpp>
// TODO: die
#undef min

View file

@ -1,6 +1,8 @@
#include <Geode/ui/TextRenderer.hpp>
#include <Geode/utils/WackyGeodeMacros.hpp>
#include <Geode/Utils.hpp>
#include <Geode/utils/operators.hpp>
#include <Geode/utils/cocos.hpp>
#include <Geode/utils/string.hpp>
#include <Geode/utils/casts.hpp>
#undef max
#undef min
@ -279,7 +281,7 @@ CCNode* TextRenderer::end(
padY = std::max(m_size.height - renderedHeight, 0.f); break;
}
// adjust child positions
CCARRAY_FOREACH_B_TYPE(m_target->getChildren(), child, CCNode) {
for (auto child : CCArrayExt<CCNode>(m_target->getChildren())) {
child->setPosition(
child->getPositionX() + padX,
child->getPositionY() +

View file

@ -27,7 +27,7 @@ CCRect geode::cocos::calculateNodeCoverage(std::vector<CCNode*> const& nodes) {
CCRect geode::cocos::calculateNodeCoverage(CCArray* nodes) {
CCRect coverage;
CCARRAY_FOREACH_B_TYPE(nodes, child, CCNode) {
for (auto child : CCArrayExt<CCNode>(nodes)) {
auto pos = child->getPosition() - child->getScaledContentSize() * child->getAnchorPoint();
auto csize = child->getPosition() + child->getScaledContentSize() * (CCPoint { 1.f, 1.f } - child->getAnchorPoint());
if (pos.x < coverage.origin.x) {

View file

@ -1,7 +1,6 @@
#include <Geode/utils/file.hpp>
#include <Geode/utils/string.hpp>
#include <fstream>
#include <Geode/Bindings.hpp>
USE_GEODE_NAMESPACE();

View file

@ -1,5 +1,5 @@
#include <Geode/utils/platform.hpp>
#include <Geode/Geode.hpp>
#include <fs/filesystem.hpp>
#ifdef GEODE_IS_WINDOWS

Some files were not shown because too many files have changed in this diff Show more