Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS fixes #50

Merged
merged 3 commits into from Jan 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions CMakeLists.txt
Expand Up @@ -108,8 +108,6 @@ SET(SDL2LIBS ${SDL2_DEFINITIONS})

if (USE_BOOST_FILESYSTEM)
set(Boost_USE_STATIC_LIBS OFF)
set(BOOST_INCLUDEDIR "/Users/Marijn/Downloads/boost_1_66_0")
set(BOOST_LIBRARYDIR "/Users/Marijn/Downloads/boost_1_66_0/stage/lib")
find_package(Boost COMPONENTS filesystem)
if (NOT Boost_FOUND)
message("Dynamic Boost not found, retrying with static")
Expand Down Expand Up @@ -150,7 +148,3 @@ 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)
target_link_libraries(${PROJECT} /Users/Marijn/Downloads/SDL2-2.0.7/build/libSDL2.dylib "/Users/Marijn/Downloads/boost_1_66_0/stage/lib/libboost_filesystem.a")
endif()
2 changes: 1 addition & 1 deletion src/openloco/interop/hook.cpp
Expand Up @@ -190,7 +190,7 @@ namespace openloco::interop
passAddress = address;
register_hook(
address,
[](registers& regs) -> uint8_t {
[](registers& regs) FORCE_ALIGN_ARG_POINTER -> uint8_t {
std::printf(" fn %08" PRIXPTR "\n", passAddress);
return 0;
});
Expand Down
2 changes: 0 additions & 2 deletions src/openloco/interop/hooks.cpp
Expand Up @@ -25,11 +25,9 @@ using namespace openloco;
#ifdef _MSC_VER
#define STDCALL __stdcall
#define CDECL __cdecl
#define FORCE_ALIGN_ARG_POINTER
#elif defined(__GNUC__)
#define STDCALL __attribute__((stdcall))
#define CDECL __attribute__((cdecl))
#define FORCE_ALIGN_ARG_POINTER __attribute__((force_align_arg_pointer))
#else
#error Unknown compiler, please define STDCALL and CDECL
#endif
Expand Down
6 changes: 6 additions & 0 deletions src/openloco/interop/interop.hpp
Expand Up @@ -8,6 +8,12 @@

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

#if defined(__GNUC__)
#define FORCE_ALIGN_ARG_POINTER __attribute__((force_align_arg_pointer))
#else
#define FORCE_ALIGN_ARG_POINTER
#endif

#ifdef COMPAT_STD_BYTE
namespace std
{
Expand Down
2 changes: 1 addition & 1 deletion src/openloco/openloco.cpp
Expand Up @@ -329,7 +329,7 @@ namespace openloco
// This address is where those routines jump back to to end the tick prematurely
register_hook(
0x0046AD71,
[](registers& regs) -> uint8_t {
[](registers& regs) FORCE_ALIGN_ARG_POINTER -> uint8_t {
longjmp(tickJump, 1);
});

Expand Down