Update TulipHook and fix some really minor stuff

This commit is contained in:
altalk23 2022-12-14 17:17:52 +03:00
parent 641c56e7be
commit 1bdc8f408c
9 changed files with 22 additions and 18 deletions

View file

@ -126,6 +126,7 @@ elseif(EXISTS ${GEODE_PLATFORM_BIN_PATH})
target_precompile_headers(${PROJECT_NAME} INTERFACE
"${GEODE_LOADER_PATH}/include/Geode/DefaultInclude.hpp"
"${GEODE_LOADER_PATH}/include/Geode/Loader.hpp"
"${GEODE_LOADER_PATH}/include/Geode/Utils.hpp"
# please stop adding modify here its not here because it makes windows compilation take longer than geode 1.0 release date
"${GEODE_LOADER_PATH}/include/Geode/UI.hpp"
"${GEODE_LOADER_PATH}/include/Geode/cocos/include/cocos2d.h"

View file

@ -1,5 +1,17 @@
#include <Geode/loader/Mod.hpp>
#include <Geode/loader/Loader.hpp>
#include <Geode/loader/Mod.hpp>
namespace geode {
/**
* To bypass the need for cyclic dependencies,
* this function does the exact same as Mod::get()
* However, it can be externed, unlike Mod::get()
* @returns Same thing Mod::get() returns
*/
Mod* getMod() {
return Mod::get();
}
}
namespace {
// to make sure the instance is set into the sharedMod<> in load time

View file

@ -136,14 +136,14 @@ CPMAddPackage("gh:google/re2#954656f")
target_include_directories(${PROJECT_NAME} PRIVATE ${md4c_SOURCE_DIR}/src)
# Tulip hook (hooking)
CPMAddPackage("gh:altalk23/TulipHook#ecbe8d7")
CPMAddPackage("gh:altalk23/TulipHook#2a97005")
target_link_libraries(${PROJECT_NAME} md4c z TulipHook geode-sdk re2)
# Use precompiled headers for faster builds
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"

View file

@ -1,7 +1,6 @@
#pragma once
#include "../utils/casts.hpp"
#include "Mod.hpp"
#include <Geode/DefaultInclude.hpp>
#include <type_traits>
@ -11,6 +10,8 @@ namespace geode {
class Mod;
class Event;
Mod* getMod();
enum class ListenerResult {
Propagate,
Stop

View file

@ -15,7 +15,7 @@ namespace geode {
#pragma warning(disable : 4251)
class Mod;
inline Mod* getMod();
Mod* getMod();
namespace log {
using log_clock = std::chrono::system_clock;

View file

@ -336,16 +336,6 @@ namespace geode {
friend class ModImpl;
};
/**
* To bypass the need for cyclic dependencies,
* this function does the exact same as Mod::get()
* However, it can be externed, unlike Mod::get()
* @returns Same thing Mod::get() returns
*/
inline GEODE_HIDDEN Mod* getMod() {
return Mod::get();
}
}
inline char const* operator"" _spr(char const* str, size_t) {

View file

@ -23,7 +23,7 @@ namespace geode {
using ByteVector = std::vector<uint8_t>;
template <typename T>
ByteVector to_byte_array(T const& a) {
ByteVector toByteArray(T const& a) {
ByteVector out;
out.resize(sizeof(T));
std::memcpy(out.data(), &a, sizeof(T));

View file

@ -34,7 +34,7 @@ static CCEGLView* CCEGLView_CCEGLView(CCEGLView* self) {
reinterpret_cast<CCEGLView*(__thiscall*)(CCEGLView*)>(CCEGLVIEW_CON_ADDR)(self);
static auto p = Mod::get()->patch(
reinterpret_cast<void*>(geode::base::getCocos() + 0x19feec),
to_byte_array(&fixedErrorHandler)
toByteArray(&fixedErrorHandler)
);
return self;
}

View file

@ -662,7 +662,7 @@ CCObject* CCArray::randomObject()
return NULL;
}
float r = CCRANDOM_0_1();
float r = ((float)rand()/(float)RAND_MAX);
if (r == 1) // to prevent from accessing data-arr[data->num], out of range.
{