Skip to content

Commit

Permalink
Apply requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnvdwerf authored and janisozaur committed Jan 24, 2018
1 parent ab4b4a7 commit 46fb400
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ endif()

if (APPLE)
target_link_libraries(${PROJECT} "-framework Cocoa")
target_compile_definitions(${PROJECT} PRIVATE COMPAT_STD_BYTE=1)
endif ()

if(EXISTS /Users/Marijn/Downloads/SDL2-2.0.7/build/libSDL2.dylib)
Expand Down
4 changes: 2 additions & 2 deletions src/openloco/interop/hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ namespace openloco::interop
static void* _smallHooks;
static uint8_t* _offset;

static void* makeJump(uint32_t address, void* fn)
static void* make_jump(uint32_t address, void* fn)
{

if (!_smallHooks)
Expand Down Expand Up @@ -262,7 +262,7 @@ namespace openloco::interop
{
uint8_t data[4] = { 0 };

void* hook = makeJump(address, fn);
void* hook = make_jump(address, fn);

uintptr_t addr = reinterpret_cast<uintptr_t>(hook);

Expand Down
2 changes: 1 addition & 1 deletion src/openloco/interop/hooks.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <assert.h>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <system_error>
Expand Down
13 changes: 11 additions & 2 deletions src/openloco/interop/interop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@

#define assert_struct_size(x, y) static_assert(sizeof(x) == (y), "Improper struct size")

#ifdef COMPAT_STD_BYTE
namespace std
{
enum class byte : unsigned char
{
};
}
#endif

namespace openloco::interop
{

Expand Down Expand Up @@ -157,10 +166,10 @@ namespace openloco::interop
private:
uintptr_t begin = 0;
uintptr_t end = 0;
std::vector<uint8_t> state;
std::vector<std::byte> state;

public:
const std::vector<uint8_t>& get_state() const
const std::vector<std::byte>& get_state() const
{
return state;
}
Expand Down

0 comments on commit 46fb400

Please sign in to comment.