Skip to content

Commit 2e48bce

Browse files
committed
Add support for x86 and x64 in Makefiles.
1 parent eea41da commit 2e48bce

File tree

7 files changed

+285
-126
lines changed

7 files changed

+285
-126
lines changed

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ docker_all:
3737
docker_debug:
3838
cd ReClass.NET_Launcher && make docker_debug
3939
cd ReClass.NET && make docker_debug
40-
docker container run --rm -v ${PWD}:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) gcc:latest bash -c "cd NativeCore/Unix && make debug"
40+
docker container run --rm -v ${PWD}:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) gcc_multilib:latest bash -c "cd NativeCore/Unix && make debug"
4141

4242
docker_release:
4343
cd ReClass.NET_Launcher && make docker_release
4444
cd ReClass.NET && make docker_release
45-
docker container run --rm -v ${PWD}:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) gcc:latest bash -c "cd NativeCore/Unix && make release"
45+
docker container run --rm -v ${PWD}:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) gcc_multilib:latest bash -c "cd NativeCore/Unix && make release"
4646

4747
podman_all:
4848
make podman_debug
@@ -52,19 +52,21 @@ podman_all:
5252
podman_debug:
5353
cd ReClass.NET_Launcher && make podman_debug
5454
cd ReClass.NET && make podman_debug
55-
podman container run --rm -v ${PWD}:/build:z -w /build gcc:latest bash -c "cd NativeCore/Unix && make debug"
55+
podman container run --rm -v ${PWD}:/build:z -w /build gcc_multilib:latest bash -c "cd NativeCore/Unix && make debug"
5656

5757
podman_release:
5858
cd ReClass.NET_Launcher && make podman_release
5959
cd ReClass.NET && make podman_release
60-
podman container run --rm -v ${PWD}:/build:z -w /build gcc:latest bash -c "cd NativeCore/Unix && make release"
60+
podman container run --rm -v ${PWD}:/build:z -w /build gcc_multilib:latest bash -c "cd NativeCore/Unix && make release"
6161

6262
dist:
6363
test -d build || mkdir -p build
6464
cp -r ReClass.NET/bin/* build/
6565
cp -r ReClass.NET_Launcher/bin/* build/
66-
cp NativeCore/Unix/build/debug/NativeCore.so build/Debug/x64
67-
cp NativeCore/Unix/build/release/NativeCore.so build/Release/x64
66+
cp NativeCore/Unix/build/debug/x86/NativeCore.so build/Debug/x86
67+
cp NativeCore/Unix/build/debug/x64/NativeCore.so build/Debug/x64
68+
cp NativeCore/Unix/build/release/x86/NativeCore.so build/Release/x86
69+
cp NativeCore/Unix/build/release/x64/NativeCore.so build/Release/x64
6870
test -d build/Debug/x86/Plugins || mkdir build/Debug/x86/Plugins
6971
test -d build/Debug/x64/Plugins || mkdir build/Debug/x64/Plugins
7072
test -d build/Release/x86/Plugins || mkdir build/Release/x86/Plugins

NativeCore/Shared/DistormHelper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ _CodeInfo CreateCodeInfo(const uint8_t* address, int length, const _OffsetType v
6666
info.codeLen = length;
6767
info.features = DF_NONE;
6868

69-
#ifdef RECLASSNET32
70-
info.dt = Decode32Bits;
71-
#else
69+
#ifdef RECLASSNET64
7270
info.dt = Decode64Bits;
71+
#else
72+
info.dt = Decode32Bits;
7373
#endif
7474

7575
return info;

NativeCore/Unix/Makefile

Lines changed: 252 additions & 106 deletions
Large diffs are not rendered by default.

NativeCore/Unix/NativeCore.Unix.vcxproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@
155155
<CppLanguageStandard>c++1y</CppLanguageStandard>
156156
<AdditionalIncludeDirectories>../Dependencies/distorm/include;$(Sysroot)\usr\include;$(StlIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
157157
<AdditionalOptions>-m32 %(AdditionalOptions)</AdditionalOptions>
158-
<PreprocessorDefinitions>RECLASSNET32</PreprocessorDefinitions>
159158
</ClCompile>
160159
<Link>
161160
<AdditionalOptions>-m32 %(AdditionalOptions)</AdditionalOptions>
@@ -168,7 +167,6 @@
168167
<CppLanguageStandard>c++1y</CppLanguageStandard>
169168
<AdditionalIncludeDirectories>../Dependencies/distorm/include;$(Sysroot)\usr\include;$(StlIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
170169
<AdditionalOptions>-m32 %(AdditionalOptions)</AdditionalOptions>
171-
<PreprocessorDefinitions>RECLASSNET32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
172170
<DebugInformationFormat>None</DebugInformationFormat>
173171
<LinkTimeOptimization>true</LinkTimeOptimization>
174172
<RuntimeTypeInfo>false</RuntimeTypeInfo>

NativeCore/Windows/NativeCore.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
</PrecompiledHeader>
104104
<WarningLevel>Level3</WarningLevel>
105105
<Optimization>Disabled</Optimization>
106-
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NATIVECORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;RECLASSNET32;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
106+
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NATIVECORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
107107
<LanguageStandard>stdcpp17</LanguageStandard>
108108
</ClCompile>
109109
<Link>
@@ -137,7 +137,7 @@
137137
<Optimization>MaxSpeed</Optimization>
138138
<FunctionLevelLinking>true</FunctionLevelLinking>
139139
<IntrinsicFunctions>true</IntrinsicFunctions>
140-
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;NATIVECORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;RECLASSNET32;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
140+
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;NATIVECORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
141141
<LanguageStandard>stdcpp17</LanguageStandard>
142142
</ClCompile>
143143
<Link>

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,20 @@ Just download the [latest version](https://github.com/ReClassNET/ReClass.NET/rel
7777
If you want to compile ReClass.NET just fork the repository and open the ReClass.NET.sln file with Visual Studio 2019.
7878
Compile the project and copy the dependencies to the output folder.
7979

80-
To compile the linux native core library, you need WSL [installed and configured](https://learn.microsoft.com/en-us/cpp/build/walkthrough-build-debug-wsl2). If you do not need linux support, simply unload the project in the Solution Explorer.
80+
To compile the linux native core library, you need WSL [installed and configured](https://learn.microsoft.com/en-us/cpp/build/walkthrough-build-debug-wsl2). If you do not need linux support, simply unload the project in the Solution Explorer. If you want to build cross-platform (x86/x64) you have to install `g++-multilib` too.
81+
82+
If you use the `Makefile` with `docker` or `podman` you have to build the needed image `gcc_multilib` from the following `Dockerfile` (`docker build -t gcc_multi .`):
83+
84+
```
85+
FROM ubuntu:latest
86+
87+
RUN apt-get update \
88+
&& apt-get install --assume-yes --no-install-recommends --quiet \
89+
make \
90+
g++ \
91+
g++-multilib \
92+
&& apt-get clean all
93+
```
8194

8295
## Videos
8396

ReClass.NET/Memory/UnionDataType.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,20 @@ public struct UInt64FloatDoubleData
5656
public long LongValue;
5757

5858
public IntPtr IntPtr =>
59-
#if RECLASSNET32
60-
unchecked((IntPtr)(int)LongValue);
61-
#else
59+
#if RECLASSNET64
6260
(IntPtr)LongValue;
61+
#else
62+
unchecked((IntPtr)(int)LongValue);
6363
#endif
6464

6565
[FieldOffset(0)]
6666
public ulong ULongValue;
6767

6868
public UIntPtr UIntPtr =>
69-
#if RECLASSNET32
70-
unchecked((UIntPtr)(uint)ULongValue);
71-
#else
69+
#if RECLASSNET64
7270
(UIntPtr)ULongValue;
71+
#else
72+
unchecked((UIntPtr)(uint)ULongValue);
7373
#endif
7474

7575
[FieldOffset(0)]

0 commit comments

Comments
 (0)