mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
ok
This commit is contained in:
commit
accc9fcd84
84 changed files with 127 additions and 93 deletions
4
.gitattributes
vendored
4
.gitattributes
vendored
|
@ -1,2 +1,2 @@
|
|||
Source/Geode/fmod/** linguist-vendored
|
||||
Source/Geode/gen/data/** linguist-vendored
|
||||
include/fmod/** linguist-vendored
|
||||
*.bro linguist-language=C++
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <Geode>
|
||||
#include <Geode.hpp>
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <Geode>
|
||||
#include <Geode.hpp>
|
||||
|
||||
#include "custom-layer.hpp"
|
||||
|
||||
|
|
10
README.md
10
README.md
|
@ -15,7 +15,7 @@ Make sure you include the flag `-T host=x64` if you are building for Windows, th
|
|||
|
||||
Geode comes with a neat little way to hook very quickly. This let's you automatically hook functions without needing to manually find the address each time. It works by subclassing some of the Geode classes and overriding some of the methods. Geode classes are just like normal GD classes but prefixed with a `$`. To easily subclass these classes there is a macro called `$()`. To use it I give the macro the class I want to hook. Example:
|
||||
```cpp
|
||||
#include <Geode>
|
||||
#include <Geode.hpp>
|
||||
#include <iostream>
|
||||
|
||||
class $(EditorUI) {
|
||||
|
@ -27,7 +27,7 @@ class $(EditorUI) {
|
|||
|
||||
If you want to call the original function, there is also an easy way to do that as well:
|
||||
```cpp
|
||||
#include <Geode>
|
||||
#include <Geode.hpp>
|
||||
#include <iostream>
|
||||
|
||||
class $(EditorUI) {
|
||||
|
@ -40,7 +40,7 @@ class $(EditorUI) {
|
|||
|
||||
If you need the name of the hook class you can use the `$()` macro with 2 parameters:
|
||||
```cpp
|
||||
#include <Geode>
|
||||
#include <Geode.hpp>
|
||||
#include <iostream>
|
||||
|
||||
class $(EditorUI, EditorUIHook) {
|
||||
|
@ -57,7 +57,7 @@ class $(EditorUI, EditorUIHook) {
|
|||
|
||||
Since the Geode classes subclass the GD classes, we can use the members and functions like we would in a normal class.
|
||||
```cpp
|
||||
#include <Geode>
|
||||
#include <Geode.hpp>
|
||||
#include <iostream>
|
||||
|
||||
class $(EditorUI) {
|
||||
|
@ -70,7 +70,7 @@ class $(EditorUI) {
|
|||
|
||||
If you want, you can also use a function with the name `inject` to run code after the mod is loaded.
|
||||
```cpp
|
||||
#include <Geode>
|
||||
#include <Geode.hpp>
|
||||
#include <iostream>
|
||||
|
||||
class $(EditorUI) {
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#include <InterfaceBase.hpp>
|
||||
#include "utils/include.hpp"
|
||||
#include "loader/GeodeLoader"
|
||||
#include "loader/GeodeLoader.hpp"
|
|
@ -3,6 +3,7 @@
|
|||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4251) // dll-interface
|
||||
#pragma warning(disable: 4099) // type first seen as 'class'
|
||||
#pragma warning(disable: 4584) // CCKeyboardDelegate included twice in UILayer
|
||||
#endif
|
||||
|
||||
#include <Macros.hpp>
|
||||
|
|
|
@ -71,7 +71,6 @@ struct GEODE_HIDDEN _##derived<_orig, derived##UUID> final \
|
|||
#define $modify(...) GEODE_INVOKE(GEODE_CONCAT(GEODE_CRTP, GEODE_NUMBER_OF_ARGS(__VA_ARGS__)), __VA_ARGS__)
|
||||
#define $(...) $modify(__VA_ARGS__)
|
||||
|
||||
|
||||
namespace geode {
|
||||
struct GEODE_CODEGEN_DLL temp_name_find_better {
|
||||
#include <gen/TempName.hpp>
|
||||
|
@ -108,6 +107,7 @@ namespace geode {
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
struct field_t {
|
||||
uint64_t padding;
|
||||
|
|
|
@ -73,15 +73,6 @@ namespace geode {
|
|||
|
||||
#define GEODE_API extern "C" __declspec(dllexport)
|
||||
#define GEODE_EXPORT __declspec(dllexport)
|
||||
|
||||
#define GEODE_INIT() \
|
||||
void geode_main(Mod* mod); \
|
||||
extern "C" __declspec(dllexport) bool __stdcall geode_load(Mod* mod) { \
|
||||
Interface::get()->init(mod); \
|
||||
geode_main(mod); \
|
||||
return true; \
|
||||
} \
|
||||
extern "C" __declspec(dllexport) void __stdcall geode_unload() {}
|
||||
|
||||
#include "platform/windows.hpp"
|
||||
|
||||
|
@ -111,15 +102,6 @@ namespace geode {
|
|||
#define GEODE_API extern "C" __attribute__((visibility("default")))
|
||||
#define GEODE_EXPORT __attribute__((visibility("default")))
|
||||
|
||||
#define GEODE_INIT() \
|
||||
void geode_main(Mod* mod); \
|
||||
extern "C" __attribute__((visibility("default"))) bool /*__stdcall?*/ geode_load(Mod* mod) { \
|
||||
Interface::get()->init(mod); \
|
||||
geode_main(mod); \
|
||||
return true; \
|
||||
} \
|
||||
extern "C" __attribute__((visibility("default"))) void /*__stdcall?*/ geode_unload() {}
|
||||
|
||||
#include <platform/macos.hpp>
|
||||
|
||||
#else
|
||||
|
@ -144,15 +126,6 @@ namespace geode {
|
|||
#define GEODE_API extern "C" __attribute__((visibility("default")))
|
||||
#define GEODE_EXPORT __attribute__((visibility("default")))
|
||||
|
||||
#define GEODE_INIT() \
|
||||
void geode_main(Mod* mod); \
|
||||
extern "C" __attribute__((visibility("default"))) bool /*__stdcall?*/ geode_load(Mod* mod) { \
|
||||
Interface::get()->init(mod); \
|
||||
geode_main(mod); \
|
||||
return true; \
|
||||
} \
|
||||
extern "C" __attribute__((visibility("default"))) void /*__stdcall?*/ geode_unload() {}
|
||||
|
||||
#error "Implement platform/ios.hpp please"
|
||||
|
||||
#else
|
||||
|
@ -180,15 +153,6 @@ namespace geode {
|
|||
#define GEODE_API extern "C" __attribute__((visibility("default")))
|
||||
#define GEODE_EXPORT __attribute__((visibility("default")))
|
||||
|
||||
#define GEODE_INIT() \
|
||||
void geode_main(Mod* mod); \
|
||||
extern "C" __attribute__((visibility("default"))) bool /*__stdcall?*/ geode_load(Mod* mod) { \
|
||||
Interface::get()->init(mod); \
|
||||
geode_main(mod); \
|
||||
return true; \
|
||||
} \
|
||||
extern "C" __attribute__((visibility("default"))) void /*__stdcall?*/ geode_unload() {}
|
||||
|
||||
#error "Implement platform/android.hpp please"
|
||||
|
||||
#else
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <map>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <utils/platform.hpp>
|
||||
#include "../utils/platform.hpp"
|
||||
|
||||
namespace geode::base {
|
||||
uintptr_t get();
|
||||
|
|
|
@ -59,10 +59,6 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
inline CCString(const gd::string& str) : m_sString(str.c_str()) {}
|
||||
/**
|
||||
* @lua NA
|
||||
*/
|
||||
inline CCString(const std::string& str) : m_sString(str.c_str()) {}
|
||||
/**
|
||||
* @lua NA
|
||||
*/
|
||||
|
|
6
include/implicitEntry.cpp
Normal file
6
include/implicitEntry.cpp
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include <Geode.hpp>
|
||||
|
||||
GEODE_API bool GEODE_CALL geode_implicit_load(geode::Mod* mod) {
|
||||
geode::Interface::get()->init(mod);
|
||||
return true;
|
||||
}
|
|
@ -162,7 +162,7 @@ namespace geode {
|
|||
* Get a list of all loaded mods
|
||||
* @returns List of all loaded mods
|
||||
*/
|
||||
std::vector<Mod*> getLoadedMods() const;
|
||||
std::vector<Mod*> getLoadedMods(bool resolved = false) const;
|
||||
/**
|
||||
* Get the count of loaded mods
|
||||
* @returns Tuple where the first element is the count of
|
||||
|
|
|
@ -139,6 +139,10 @@ namespace geode {
|
|||
* Settings
|
||||
*/
|
||||
std::unordered_map<std::string, Setting*> m_settings;
|
||||
/**
|
||||
* Whether the mod can be disabled or not
|
||||
*/
|
||||
bool m_supportsDisabling = true;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -178,10 +182,6 @@ namespace geode {
|
|||
* Whether the mod is loadable or not
|
||||
*/
|
||||
bool m_resolved = false;
|
||||
/**
|
||||
* Whether the mod can be disabled or not
|
||||
*/
|
||||
bool m_supportsDisabling = true;
|
||||
/**
|
||||
* Mod temp directory name
|
||||
*/
|
||||
|
@ -189,7 +189,7 @@ namespace geode {
|
|||
/**
|
||||
* Mod save directory name
|
||||
*/
|
||||
ghc::filesystem::path m_saveDirName;
|
||||
ghc::filesystem::path m_saveDirPath;
|
||||
/**
|
||||
* Pointers to mods that depend on
|
||||
* this Mod. Makes it possible to
|
||||
|
@ -197,10 +197,14 @@ namespace geode {
|
|||
* when their dependency is disabled.
|
||||
*/
|
||||
std::vector<Mod*> m_parentDependencies;
|
||||
/**
|
||||
* Pointer to the Mod's implicit load function
|
||||
*/
|
||||
geode_load m_implicitLoadFunc = nullptr;
|
||||
/**
|
||||
* Pointer to the Mod's load function
|
||||
*/
|
||||
geode_load m_loadFunc = nullptr;
|
||||
geode_load m_loadFunc = nullptr;
|
||||
/**
|
||||
* Pointer to the Mod's unload function
|
||||
*/
|
||||
|
@ -397,6 +401,9 @@ namespace geode {
|
|||
*/
|
||||
Result<> disable();
|
||||
|
||||
Result<> saveData();
|
||||
Result<> loadData();
|
||||
|
||||
/**
|
||||
* Get the value of a setting
|
||||
* @param key The setting's key
|
||||
|
|
|
@ -53,8 +53,8 @@ namespace geode {
|
|||
|
||||
std::string getKey() const { return m_key; }
|
||||
|
||||
virtual void save(nlohmann::json& json) const;
|
||||
virtual void load(nlohmann::json const& json);
|
||||
virtual Result<> save(nlohmann::json& json) const = 0;
|
||||
virtual Result<> load(nlohmann::json const& json) = 0;
|
||||
|
||||
static Result<Setting*> parseFromJSON(nlohmann::json const& json);
|
||||
|
||||
|
@ -142,6 +142,9 @@ namespace geode {
|
|||
protected:
|
||||
friend class GeodeSetting<BoolSetting>;
|
||||
|
||||
Result<> save(nlohmann::json& json) const override;
|
||||
Result<> load(nlohmann::json const& json) override;
|
||||
|
||||
public:
|
||||
inline virtual SettingType getType() override { return SettingType::Bool; }
|
||||
};
|
||||
|
@ -149,6 +152,9 @@ namespace geode {
|
|||
class IntSetting : public SingleSetting<int, IntSetting>, public INumericSetting<int, IntSetting, false, true, true> {
|
||||
protected:
|
||||
friend class GeodeSetting<IntSetting>;
|
||||
|
||||
Result<> save(nlohmann::json& json) const override;
|
||||
Result<> load(nlohmann::json const& json) override;
|
||||
|
||||
public:
|
||||
inline virtual SettingType getType() override { return SettingType::Int; }
|
||||
|
@ -156,8 +162,13 @@ namespace geode {
|
|||
|
||||
class FloatSetting : public SingleSetting<float, FloatSetting>, public INumericSetting<int, FloatSetting, true, true, true> {
|
||||
protected:
|
||||
size_t m_precision = 0;
|
||||
|
||||
friend class GeodeSetting<FloatSetting>;
|
||||
|
||||
Result<> save(nlohmann::json& json) const override;
|
||||
Result<> load(nlohmann::json const& json) override;
|
||||
|
||||
public:
|
||||
inline virtual SettingType getType() override { return SettingType::Float; }
|
||||
};
|
||||
|
@ -168,6 +179,9 @@ namespace geode {
|
|||
|
||||
friend class GeodeSetting<StringSetting>;
|
||||
|
||||
Result<> save(nlohmann::json& json) const override;
|
||||
Result<> load(nlohmann::json const& json) override;
|
||||
|
||||
public:
|
||||
static bool replaceWithBuiltInFilter(std::string& filter);
|
||||
inline virtual SettingType getType() override { return SettingType::String; }
|
||||
|
@ -179,6 +193,9 @@ namespace geode {
|
|||
|
||||
friend class GeodeSetting<ColorSetting>;
|
||||
|
||||
Result<> save(nlohmann::json& json) const override;
|
||||
Result<> load(nlohmann::json const& json) override;
|
||||
|
||||
public:
|
||||
inline virtual SettingType getType() override { return SettingType::Color; }
|
||||
};
|
||||
|
@ -189,6 +206,9 @@ namespace geode {
|
|||
|
||||
friend class GeodeSetting<ColorAlphaSetting>;
|
||||
|
||||
Result<> save(nlohmann::json& json) const override;
|
||||
Result<> load(nlohmann::json const& json) override;
|
||||
|
||||
public:
|
||||
inline virtual SettingType getType() override { return SettingType::ColorAlpha; }
|
||||
};
|
||||
|
@ -197,6 +217,9 @@ namespace geode {
|
|||
protected:
|
||||
friend class GeodeSetting<PathSetting>;
|
||||
|
||||
Result<> save(nlohmann::json& json) const override;
|
||||
Result<> load(nlohmann::json const& json) override;
|
||||
|
||||
public:
|
||||
inline virtual SettingType getType() override { return SettingType::Path; }
|
||||
};
|
||||
|
@ -205,11 +228,18 @@ namespace geode {
|
|||
protected:
|
||||
friend class GeodeSetting<StringSelectSetting>;
|
||||
|
||||
Result<> save(nlohmann::json& json) const override;
|
||||
Result<> load(nlohmann::json const& json) override;
|
||||
|
||||
public:
|
||||
inline virtual SettingType getType() override { return SettingType::StringSelect; }
|
||||
};
|
||||
|
||||
class CustomSettingPlaceHolder : public Setting {
|
||||
protected:
|
||||
Result<> save(nlohmann::json& json) const override;
|
||||
Result<> load(nlohmann::json const& json) override;
|
||||
|
||||
public:
|
||||
inline virtual SettingType getType() override { return SettingType::Custom; }
|
||||
};
|
||||
|
|
|
@ -62,8 +62,11 @@ namespace geode::addresser {
|
|||
auto ins = new T(*ptr);
|
||||
// this is how the first human was made
|
||||
|
||||
auto thunk = thunkOf(func);
|
||||
std::cout << "thunkOf(func) = " << thunk << "\n";
|
||||
|
||||
// [[this + thunk] + offset] is the f we want
|
||||
auto address = *(intptr_t*)(*(intptr_t*)(pointerOf(ins) + thunkOf(func)) + indexOf(func));
|
||||
auto address = *(intptr_t*)(*(intptr_t*)(pointerOf(ins) + thunk) + indexOf(func));
|
||||
|
||||
// And we delete the new instance because we are good girls
|
||||
// and we don't leak memories
|
||||
|
@ -113,13 +116,17 @@ namespace geode::addresser {
|
|||
template<typename T>
|
||||
inline intptr_t getVirtual(T func) {
|
||||
Interface::get()->logInfo("Get virtual function address from " + utils::intToHex(Addresser::pointerOf(func)), Severity::Debug);
|
||||
return Addresser::addressOfVirtual(func);
|
||||
auto addr = Addresser::addressOfVirtual(func);
|
||||
Interface::get()->logInfo("The address is: " + utils::intToHex(addr), Severity::Debug);
|
||||
return addr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline intptr_t getNonVirtual(T func) {
|
||||
Interface::get()->logInfo("Get non virtual function address from " + utils::intToHex(Addresser::pointerOf(func)), Severity::Debug);
|
||||
return Addresser::addressOfNonVirtual(func);
|
||||
auto addr = Addresser::addressOfNonVirtual(func);
|
||||
Interface::get()->logInfo("The address is: " + utils::intToHex(addr), Severity::Debug);
|
||||
return addr;
|
||||
}
|
||||
|
||||
template<typename T, typename F>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <Geode>
|
||||
#include <Geode.hpp>
|
||||
|
||||
namespace geode::cocos {
|
||||
void ccDrawColor4B(cocos2d::ccColor4B const& color);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <Geode>
|
||||
#include <Geode.hpp>
|
||||
|
||||
namespace geode::cocos {
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <Geode>
|
||||
#include <Geode.hpp>
|
||||
|
||||
namespace geode {
|
||||
static cocos2d::CCPoint operator*=(cocos2d::CCPoint & pos, float mul) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <Macros.hpp>
|
||||
#include "../base/Macros.hpp"
|
||||
#include "Result.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <Geode>
|
||||
#include <Geode.hpp>
|
||||
|
||||
namespace geode::stream {
|
||||
std::ostream& operator<<(std::ostream& stream, cocos2d::CCPoint const& pos);
|
||||
|
|
|
@ -20,10 +20,10 @@ function(create_geode_file proname)
|
|||
else()
|
||||
if (GEODE_AUTO_INSTALL_IN_API)
|
||||
set(INSTALL_FLAGS --install --api)
|
||||
message(STATUS "Installing in geode/api after build")
|
||||
message(STATUS "Installing ${proname} in geode/api after build")
|
||||
else()
|
||||
set(INSTALL_FLAGS --install)
|
||||
message(STATUS "Installing in geode/mods after build")
|
||||
message(STATUS "Installing ${proname} in geode/mods after build")
|
||||
endif()
|
||||
endif()
|
||||
add_custom_command(
|
||||
|
|
|
@ -34,8 +34,16 @@ include(CheckIPOSupported)
|
|||
check_ipo_supported(RESULT supported OUTPUT error)
|
||||
|
||||
if (GEODE_BUILD_CODEGEN)
|
||||
if (GEODE_IMPLICIT_ENTRY)
|
||||
set(IMPLICIT_PATH ${GEODE_INCLUDE_DIR}/implicitEntry.cpp)
|
||||
else()
|
||||
set(IMPLICIT_PATH "")
|
||||
endif()
|
||||
set_source_files_properties(${GEODE_CODEGEN_DIR}/Source.cpp PROPERTIES GENERATED 1)
|
||||
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${GEODE_CODEGEN_DIR}/Source.cpp)
|
||||
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES}
|
||||
${GEODE_CODEGEN_DIR}/Source.cpp
|
||||
${IMPLICIT_PATH}
|
||||
)
|
||||
# set_property(TARGET ${PROJECT_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
# target_link_options(${PROJECT_NAME} PUBLIC -dead_strip)
|
||||
else()
|
||||
|
@ -72,13 +80,12 @@ if (NOT DEFINED GEODE_NO_LINK_LOADER)
|
|||
endif()
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||
${GEODE_INCLUDE_DIR}/
|
||||
${GEODE_INCLUDE_DIR}
|
||||
${GEODE_INCLUDE_DIR}/helpers
|
||||
${GEODE_INCLUDE_DIR}/base
|
||||
${GEODE_INCLUDE_DIR}/c++stl
|
||||
${GEODE_INCLUDE_DIR}/hook
|
||||
${GEODE_INCLUDE_DIR}/loader
|
||||
${GEODE_INCLUDE_DIR}/keybinds
|
||||
${GEODE_INCLUDE_DIR}/utils
|
||||
${GEODE_INCLUDE_DIR}/meta
|
||||
${GEODE_INCLUDE_DIR}/cocos/
|
||||
|
@ -88,7 +95,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC
|
|||
${GEODE_INCLUDE_DIR}/cocos/cocos2dx/kazmath/include
|
||||
${GEODE_INCLUDE_DIR}/cocos/extensions
|
||||
${GEODE_INCLUDE_DIR}/fmod
|
||||
${GEODE_SDK_DIR}/kit/gen/fmt/include
|
||||
${GEODE_INCLUDE_DIR}/fmt/include
|
||||
${INCLUDE_DIRECTORIES}
|
||||
)
|
||||
|
||||
|
|
|
@ -22,7 +22,9 @@ link_prebuilts(${PROJECT_NAME})
|
|||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out)
|
||||
set(CMAKE_SIZEOF_VOID_P 4)
|
||||
set(CMAKE_SYSTEM_PROCESSOR "i686")
|
||||
set(CMAKE_GENERATOR_PLATFORM x86)
|
||||
if(MSVC)
|
||||
set(CMAKE_GENERATOR_PLATFORM x86)
|
||||
endif()
|
||||
install(
|
||||
TARGETS ${PROJECT_NAME}
|
||||
DESTINATION ${CMAKE_BINARY_DIR}/out/
|
||||
|
|
|
@ -3,7 +3,7 @@ project(Codegen LANGUAGES C CXX)
|
|||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
add_subdirectory(fmt)
|
||||
add_subdirectory(../../include/fmt ${CMAKE_BINARY_DIR}/fmt)
|
||||
|
||||
macro(add_gen project file)
|
||||
add_executable(${project}Gen ${project}Gen.cpp)
|
||||
|
|
|
@ -45,7 +45,7 @@ struct ${class_name} : {raw_class_name}, ModifierBase {{
|
|||
using baseType{global_index} = temp_name_find_better::ret{global_index}({class_name}::*)({raw_arg_types}) {const};
|
||||
constexpr auto baseAddress{global_index} = (baseType{global_index})(&{class_name}::{function_name});
|
||||
using derivedType{global_index} = temp_name_find_better::ret{global_index}(D<baseAddress{global_index}, UUID>::*)({raw_arg_types}) {const};
|
||||
constexpr auto derivedAddress{global_index} = (derivedType{global_index})(&D<baseAddress{global_index}, UUID>::{function_name});
|
||||
auto derivedAddress{global_index} = (derivedType{global_index})(&D<baseAddress{global_index}, UUID>::{function_name});
|
||||
if (baseAddress{global_index} != derivedAddress{global_index}) {{
|
||||
Interface::get()->logInfo("Adding hook at function {class_name}::{function_name}", Severity::Debug);
|
||||
Interface::get()->addHook("{class_name}::{function_name}", (void*)temp_name_find_better::address{global_index}(), (void*)addresser::get{non_virtual}Virtual(derivedAddress{global_index}));
|
||||
|
@ -56,7 +56,7 @@ struct ${class_name} : {raw_class_name}, ModifierBase {{
|
|||
using baseType{global_index} = temp_name_find_better::ret{global_index}(${class_name}::*)({raw_arg_types}) {const};
|
||||
constexpr auto baseAddress{global_index} = (baseType{global_index})(&${class_name}::{function_name});
|
||||
using derivedType{global_index} = temp_name_find_better::ret{global_index}(D<baseAddress{global_index}, UUID>::*)({raw_arg_types}) {const};
|
||||
constexpr auto derivedAddress{global_index} = (derivedType{global_index})(&D<baseAddress{global_index}, UUID>::{function_name});
|
||||
auto derivedAddress{global_index} = (derivedType{global_index})(&D<baseAddress{global_index}, UUID>::{function_name});
|
||||
if (baseAddress{global_index} != derivedAddress{global_index}) {{
|
||||
Interface::get()->logInfo("Adding hook at function {class_name}::{function_name}", Severity::Debug);
|
||||
Interface::get()->addHook("{class_name}::{function_name}", (void*)temp_name_find_better::address{global_index}(), (void*)addresser::get{non_virtual}Virtual(derivedAddress{global_index}));
|
||||
|
@ -67,7 +67,7 @@ struct ${class_name} : {raw_class_name}, ModifierBase {{
|
|||
using baseType{global_index} = temp_name_find_better::ret{global_index}(*)({raw_arg_types});
|
||||
constexpr auto baseAddress{global_index} = (baseType{global_index})(&{class_name}::{function_name});
|
||||
using derivedType{global_index} = temp_name_find_better::ret{global_index}(*)({raw_arg_types});
|
||||
constexpr auto derivedAddress{global_index} = (derivedType{global_index})(&D<baseAddress{global_index}, UUID>::{function_name});
|
||||
auto derivedAddress{global_index} = (derivedType{global_index})(&D<baseAddress{global_index}, UUID>::{function_name});
|
||||
if (baseAddress{global_index} != derivedAddress{global_index}) {{
|
||||
Interface::get()->logInfo("Adding hook at function {class_name}::{function_name}", Severity::Debug);
|
||||
Interface::get()->addHook("{class_name}::{function_name}", (void*)temp_name_find_better::address{global_index}(), (void*)addresser::getNonVirtual(derivedAddress{global_index}));
|
||||
|
@ -84,9 +84,14 @@ struct ${class_name} : {raw_class_name}, ModifierBase {{
|
|||
int main(int argc, char** argv) {
|
||||
auto root = CacShare::init(argc, argv);
|
||||
string output;
|
||||
int files = 0;
|
||||
auto origPath = CacShare::writePath;
|
||||
|
||||
size_t ix = 0;
|
||||
for (auto& [name, c] : root.classes) {
|
||||
string unqualifiedName = CacShare::toUnqualified(name);
|
||||
if (unqualifiedName == "AppDelegate")
|
||||
printf("what the fuck %d\n", files);
|
||||
|
||||
output += fmt::format(format_strings::interface_start, fmt::arg("class_name", unqualifiedName), fmt::arg("raw_class_name", name));
|
||||
|
||||
|
@ -152,8 +157,23 @@ int main(int argc, char** argv) {
|
|||
|
||||
output += format_strings::apply_end;
|
||||
output += "};\n";
|
||||
|
||||
++ix;
|
||||
if (output.size() > 80000 || ix == root.classes.size()) {
|
||||
files++;
|
||||
CacShare::writePath = origPath + "." + std::to_string(files);
|
||||
CacShare::writeFile(output);
|
||||
output = "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string fullRes = "";
|
||||
for (auto i = 0; i < files; i++) {
|
||||
auto path = origPath + "." + std::to_string(i+1);
|
||||
fullRes += "#include \"" + path + "\"\n";
|
||||
}
|
||||
|
||||
CacShare::writePath = origPath;
|
||||
// fmt::print("{}", output);
|
||||
CacShare::writeFile(output);
|
||||
CacShare::writeFile(fullRes);
|
||||
}
|
||||
|
|
|
@ -105,7 +105,8 @@ class AppDelegate : cocos2d::CCApplication {
|
|||
virtual void applicationWillEnterForeground() = mac 0x3aac80, win 0x0, ios 0x0;
|
||||
virtual void applicationWillBecomeActive() = mac 0x3aab30, win 0x0, ios 0x0;
|
||||
virtual void applicationWillResignActive() = mac 0x3aab50, win 0x0, ios 0x0;
|
||||
virtual void trySaveGame() = mac 0x3aaf10, win 0x0, ios 0x0;
|
||||
virtual void trySaveGame() = mac 0x3aaf10, win 0x3d5e0, ios 0x0;
|
||||
void trySaveGame_() = mac 0x3aaf10, win 0x3d5e0, ios 0x0;
|
||||
virtual void willSwitchToScene(cocos2d::CCScene*) = mac 0x3aaf40, win 0x0, ios 0x0;
|
||||
static AppDelegate* get() = mac 0x3aab10, win 0x0, ios 0x0;
|
||||
|
||||
|
@ -1130,11 +1131,6 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ
|
|||
void alignObjects(cocos2d::CCArray* objs, bool alignY) = mac 0x0, win 0x8f320, ios 0x0;
|
||||
virtual void keyUp(cocos2d::enumKeyCodes key) = mac 0x312b0, win 0x92180, ios 0x0;
|
||||
|
||||
LevelEditorLayer* editorLayer = mac 0x408, win 0x0, android 0x0;
|
||||
cocos2d::CCArray* editBars = mac 0x358, win 0x0, android 0x0;
|
||||
cocos2d::CCNode* locationSlider = mac 0x228, win 0x0, android 0x0;
|
||||
GameObject* lastSelectedObject = mac 0x440, win 0x0, android 0x0;
|
||||
gd::string clipboard = mac 0x458, win 0x0, android 0x0;
|
||||
EditButtonBar* m_buttonBar;
|
||||
PAD = mac 0x8, win 0x4, android 0x0;
|
||||
cocos2d::CCArray* m_hideableUIElementArray;
|
||||
|
@ -2555,10 +2551,6 @@ class GameManager : GManager {
|
|||
void toggleGameVariable(const char* key) = mac 0x0, win 0xc9e90, ios 0x0;
|
||||
static void returnToLastScene(GJGameLevel* level) = mac 0x0, win 0xce6a0, ios 0x0;
|
||||
|
||||
PlayLayer* playLayer = mac 0x180, win 0x0, android 0x0;
|
||||
LevelEditorLayer* editorLayer = mac 0x188, win 0x0, android 0x0;
|
||||
int scene = mac 0x1f4, win 0x0, android 0x0;
|
||||
bool ldm = mac 0x2a1, win 0x0, android 0x0;
|
||||
bool m_switchModes;
|
||||
bool m_toFullscreen;
|
||||
bool m_reloading;
|
||||
|
@ -4629,8 +4621,8 @@ class TouchToggleAction : cocos2d::CCNode {
|
|||
|
||||
class TriggerEffectDelegate {}
|
||||
|
||||
class UILayer : cocos2d::CCLayerColor { //, cocos2d::CCKeyboardDelegate {
|
||||
static UILayer* create() = mac 0x27fd10, win 0x0, ios 0x0;
|
||||
class UILayer : cocos2d::CCLayerColor {
|
||||
static UILayer* create() = mac 0x27fd10, win 0x25f310, ios 0x0;
|
||||
void disableMenu() = mac 0x280960, win 0x0, ios 0x0;
|
||||
void enableMenu() = mac 0x280940, win 0x0, ios 0x0;
|
||||
void pCommand(cocos2d::CCNode*) = mac 0x280830, win 0x0, ios 0x0;
|
||||
|
@ -4640,6 +4632,8 @@ class UILayer : cocos2d::CCLayerColor { //, cocos2d::CCKeyboardDelegate {
|
|||
void onPause(cocos2d::CCObject* pSender) = mac 0x2803c0, win 0x25fad0, ios 0x0;
|
||||
virtual void keyDown(cocos2d::enumKeyCodes key) = mac 0x280470, win 0x25f890, ios 0x0;
|
||||
virtual void keyUp(cocos2d::enumKeyCodes key) = mac 0x280600, win 0x25fa10, ios 0x0;
|
||||
UILayer() = win 0x25f230;
|
||||
~UILayer() = win 0x25fef0;
|
||||
|
||||
PAD = mac 0x16, win 0x8, android 0x8;
|
||||
cocos2d::CCMenu* m_checkPointMenu;
|
||||
|
|
Loading…
Reference in a new issue