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

full asm transition complete #19

Merged
merged 1 commit into from
Feb 26, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 10 additions & 47 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,78 +1,41 @@
PROJECT = sp3

CC = i686-w64-mingw32-gcc
CFLAGS = -std=c99 -O2 -m32\
-Wall -Wextra -Werror -Wshadow -Wconversion\
-Wno-attributes\

LD = i686-w64-mingw32-ld
LDFLAGS = -shared --entry=_DllMain@12
LDFLAGS = -s -shared --entry=_DllMain@12

ASM = nasm
ASFLAGS = -f win32

BIN = lib
LIB = lib
BUILD = build
DEBUG = $(OBJ)/debug
RELEASE = $(OBJ)/release

SRC = src
OBJ = build
SOURCES = $(wildcard $(SRC)/*.c)
DBG_OBJECTS = $(patsubst $(SRC)/%.c,$(DEBUG)/%_d.o,$(SOURCES))
REL_OBJECTS = $(patsubst $(SRC)/%.c,$(RELEASE)/%.o,$(SOURCES))

INCLUDE = include
INCLUDES = $(addprefix -I,$(INCLUDE))
HEADERS = $(wildcard $(INCLUDE)/*.h)
SOURCES = $(wildcard $(SRC)/*.asm)
OBJECTS = $(patsubst $(SRC)/%.asm,$(OBJ)/%.obj,$(SOURCES))

LIB_FILES = d3d9 d3dx9 kernel32 user32 msvcrt
LIBS = $(addprefix -l,$(LIB_FILES))

ASM_TARGET = health_detour
ASM_SRC = $(SRC)
ASM_OBJ = $(BUILD)
ASM_SOURCES = $(wildcard $(ASM_SRC)/*.asm)
ASM_OBJECTS = $(patsubst $(ASM_SRC)/%.asm,$(ASM_OBJ)/%.obj,$(ASM_SOURCES))

MAKEFLAGS += $(addprefix -j,$(shell nproc))

all: release

debug: $(DEBUG)
$(DEBUG): $(BIN)/$(PROJECT)_d.dll
$(DEBUG): CFLAGS += -g

release: $(PROJECT)
$(PROJECT): $(BIN)/$(PROJECT).dll
$(PROJECT): CFLAGS += -march=native -mavx2 -mtune=native -Ofast -fPIE -funsafe-math-optimizations -fomit-frame-pointer
$(PROJECT): CFLAGS += -funroll-loops -funsafe-loop-optimizations -funswitch-loops -floop-parallelize-all
$(PROJECT): CFLAGS += -finline-functions -falign-functions -falign-loops -falign-jumps -fno-function-sections
$(PROJECT): CFLAGS += -fno-ident -fvisibility=hidden -fstrict-aliasing
$(PROJECT): CFLAGS += -DUNICODE -D_WIN32 -DVC_EXTRALEAN
#$(PROJECT): LDFLAGS += -s
$(PROJECT): $(LIB)/$(PROJECT).dll

$(BIN)/$(PROJECT)_d.dll: $(OBJ) $(BIN) $(ASM_OBJECTS) $(DBG_OBJECTS)
$(LD) $(LDFLAGS) $(ASM_OBJECTS) $(DBG_OBJECTS) $(LIBS) -o $@
$(LIB)/$(PROJECT).dll: $(OBJ) $(LIB) $(OBJECTS)
$(LD) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@

$(BIN)/$(PROJECT).dll: $(OBJ) $(BIN) $(ASM_OBJECTS) $(REL_OBJECTS)
$(LD) $(LDFLAGS) $(ASM_OBJECTS) $(REL_OBJECTS) $(LIBS) -o $@

$(ASM_OBJECTS): $(ASM_OBJ)/%.obj: $(ASM_SRC)/%.asm
$(OBJECTS): $(OBJ)/%.obj: $(SRC)/%.asm
$(ASM) $(ASFLAGS) $^ -o $@

$(DBG_OBJECTS): $(DEBUG)/%_d.o: $(SRC)/%.c
$(CC) $(CFLAGS) $(INCLUDES) -c $^ -o $@

$(REL_OBJECTS): $(RELEASE)/%.o: $(SRC)/%.c
$(CC) $(CFLAGS) $(INCLUDES) -c $^ -o $@

$(OBJ):
mkdir -p build/asm
mkdir -p build/debug
mkdir -p build/release
mkdir -p build

$(BIN):
$(LIB):
mkdir -p lib

.PHONY: docker-container
Expand Down
9 changes: 0 additions & 9 deletions compile_flags.txt

This file was deleted.

78 changes: 0 additions & 78 deletions include/entity.h

This file was deleted.

84 changes: 0 additions & 84 deletions include/hacks.h

This file was deleted.

61 changes: 0 additions & 61 deletions include/mem.h

This file was deleted.

13 changes: 0 additions & 13 deletions include/offsets.h

This file was deleted.

Loading