Skip to content

Commit

Permalink
Merge pull request #19 from 0xvpr/dev
Browse files Browse the repository at this point in the history
full asm transition complete
  • Loading branch information
0xvpr authored Feb 26, 2024
2 parents d6a0af1 + d116067 commit d095d34
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 338 deletions.
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

0 comments on commit d095d34

Please sign in to comment.