This commit is contained in:
altalk23 2023-02-18 13:53:05 +03:00
commit c397c297f5
7 changed files with 44 additions and 28 deletions

View file

@ -12,6 +12,14 @@ body:
- "Windows" - "Windows"
validations: validations:
required: true required: true
- type: input
id: commit
attributes:
label: SDK commit
description: The commit you used to compile your code with. If the bug is not related with your mod, you can leave this field empty.
placeholder: "Example: a674b97"
validations:
required: false
- type: input - type: input
id: version id: version
attributes: attributes:

View file

@ -54,6 +54,12 @@ include(cmake/GeodeFile.cmake)
include(cmake/Platform.cmake) include(cmake/Platform.cmake)
include(cmake/CPM.cmake) include(cmake/CPM.cmake)
# this is needed for cross compilation on linux,
# since fmtlib will fail to compile otherwise
if (GEODE_DISABLE_FMT_CONSTEVAL)
target_compile_definitions(${PROJECT_NAME} INTERFACE -DFMT_CONSTEVAL=)
endif()
CPMAddPackage("gh:geode-sdk/json#2b76460") CPMAddPackage("gh:geode-sdk/json#2b76460")
CPMAddPackage("gh:fmtlib/fmt#9.1.0") CPMAddPackage("gh:fmtlib/fmt#9.1.0")
CPMAddPackage("gh:gulrak/filesystem#3e5b930") CPMAddPackage("gh:gulrak/filesystem#3e5b930")

View file

@ -219,9 +219,9 @@ namespace geode {
using ColorAlphaSettingValue = GeodeSettingValue<ColorAlphaSetting>; using ColorAlphaSettingValue = GeodeSettingValue<ColorAlphaSetting>;
template<class T> template<class T>
struct SettingValueSetter { struct GEODE_DLL SettingValueSetter {
static GEODE_DLL T get(SettingValue* setting); static T get(SettingValue* setting);
static GEODE_DLL void set(SettingValue* setting, T const& value); static void set(SettingValue* setting, T const& value);
}; };
} }

View file

@ -106,7 +106,7 @@ namespace geode::modifier {
class ModifyDerive { class ModifyDerive {
public: public:
ModifyDerive() { ModifyDerive() {
static_assert(alwaysFalse<Derived>, "Custom Modify not implemented."); static_assert(alwaysFalse<Derived>, "Modified class not recognized, please include <Geode/modify/ClassName.hpp> to be able to use it.");
} }
}; };
} }

View file

@ -163,18 +163,7 @@ namespace geode::addresser {
return addressOfNonVirtual(reinterpret_cast<R (T::*)(Ps...)>(func)); return addressOfNonVirtual(reinterpret_cast<R (T::*)(Ps...)>(func));
} }
static inline intptr_t followThunkFunction(intptr_t address) { static intptr_t followThunkFunction(intptr_t address);
#ifdef GEODE_IS_WINDOWS
// check if first instruction is a jmp dword ptr [....], i.e. if the func is a thunk
if (*reinterpret_cast<uint8_t*>(address) == 0xFF && *reinterpret_cast<uint8_t*>(address + 1) == 0x25) {
// read where the jmp reads from
address = *reinterpret_cast<uint32_t*>(address + 2);
// that then contains the actual address of the func
address = *reinterpret_cast<uintptr_t*>(address);
}
#endif
return address;
}
template <typename R, typename T, typename... Ps> template <typename R, typename T, typename... Ps>
static intptr_t addressOfNonVirtual(R (T::*func)(Ps...)) { static intptr_t addressOfNonVirtual(R (T::*func)(Ps...)) {

View file

@ -275,18 +275,6 @@ std::string SettingValue::getKey() const {
typename type_##Setting::ValueType const& value \ typename type_##Setting::ValueType const& value \
) const ) const
// instantiate value setters
namespace geode {
template struct SettingValueSetter<typename BoolSetting::ValueType>;
template struct SettingValueSetter<typename IntSetting::ValueType>;
template struct SettingValueSetter<typename FloatSetting::ValueType>;
template struct SettingValueSetter<typename StringSetting::ValueType>;
template struct SettingValueSetter<typename FileSetting::ValueType>;
template struct SettingValueSetter<typename ColorSetting::ValueType>;
template struct SettingValueSetter<typename ColorAlphaSetting::ValueType>;
}
// instantiate values // instantiate values
namespace geode { namespace geode {
@ -370,6 +358,18 @@ IMPL_NODE_AND_SETTERS(File);
IMPL_NODE_AND_SETTERS(Color); IMPL_NODE_AND_SETTERS(Color);
IMPL_NODE_AND_SETTERS(ColorAlpha); IMPL_NODE_AND_SETTERS(ColorAlpha);
// instantiate value setters
namespace geode {
template struct SettingValueSetter<typename BoolSetting::ValueType>;
template struct SettingValueSetter<typename IntSetting::ValueType>;
template struct SettingValueSetter<typename FloatSetting::ValueType>;
template struct SettingValueSetter<typename StringSetting::ValueType>;
template struct SettingValueSetter<typename FileSetting::ValueType>;
template struct SettingValueSetter<typename ColorSetting::ValueType>;
template struct SettingValueSetter<typename ColorAlphaSetting::ValueType>;
}
// SettingChangedEvent // SettingChangedEvent
SettingChangedEvent::SettingChangedEvent(Mod* mod, SettingValue* value) SettingChangedEvent::SettingChangedEvent(Mod* mod, SettingValue* value)

View file

@ -65,3 +65,16 @@ namespace {
Addresser::MultipleInheritance* Addresser::instance() { Addresser::MultipleInheritance* Addresser::instance() {
return reinterpret_cast<Addresser::MultipleInheritance*>(&TableTable::table); return reinterpret_cast<Addresser::MultipleInheritance*>(&TableTable::table);
} }
intptr_t Addresser::followThunkFunction(intptr_t address) {
#ifdef GEODE_IS_WINDOWS
// check if first instruction is a jmp dword ptr [....], i.e. if the func is a thunk
if (*reinterpret_cast<uint8_t*>(address) == 0xFF && *reinterpret_cast<uint8_t*>(address + 1) == 0x25) {
// read where the jmp reads from
address = *reinterpret_cast<uint32_t*>(address + 2);
// that then contains the actual address of the func
address = *reinterpret_cast<uintptr_t*>(address);
}
#endif
return address;
}