diff --git a/core/sourcehook/sourcehook_impl.h b/core/sourcehook/sourcehook_impl.h index 9755ab94..fd9fb43c 100644 --- a/core/sourcehook/sourcehook_impl.h +++ b/core/sourcehook/sourcehook_impl.h @@ -181,7 +181,9 @@ New SH_CALL #include "sourcehook_impl_chookidman.h" #include +#ifndef SOURCEHOOK_STANDALONE void mm_LogMessage(const char* msg, ...); +#endif namespace SourceHook { @@ -206,7 +208,11 @@ namespace SourceHook if (log_level < sh_log_level) { return; } +#ifdef SOURCEHOOK_STANDALONE + printf(message, args...); +#else mm_LogMessage(message, args...); +#endif } struct CHookContext : IHookContext diff --git a/core/sourcehook/test/AMBuilder b/core/sourcehook/test/AMBuilder index 4a6c2fa4..56e7950f 100644 --- a/core/sourcehook/test/AMBuilder +++ b/core/sourcehook/test/AMBuilder @@ -11,6 +11,10 @@ for cxx in MMS.all_targets: binary.compiler.cxxflags += ['-fno-devirtualize'] if binary.compiler.version >= 'clang-2.9' or binary.compiler.version >= 'apple-clang-3.0': binary.compiler.cxxflags += ['-Wno-null-dereference'] + + binary.compiler.defines += [ + 'SOURCEHOOK_STANDALONE', + ] binary.sources += [ 'main.cpp', @@ -19,6 +23,7 @@ for cxx in MMS.all_targets: '../sourcehook_impl_chookidman.cpp', '../sourcehook_impl_cproto.cpp', '../sourcehook_impl_cvfnptr.cpp', + '../sourcehook_hookmangen.cpp', 'test1.cpp', 'test2.cpp', 'test3.cpp', @@ -36,7 +41,9 @@ for cxx in MMS.all_targets: 'testrefret.cpp', 'testvphooks.cpp', ] - if binary.compiler.target.arch == 'x86': - binary.sources += ['../sourcehook_hookmangen.cpp'] + if cxx.target.arch == 'x86': + binary.sources += ['sourcehook/sourcehook_hookmangen_x86.cpp'] + elif binary.compiler.target.arch == 'x86_64' and binary.compiler.target.platform != 'linux': + binary.sources += ['sourcehook/sourcehook_hookmangen_x86_64.cpp'] builder.Add(binary)