Merge pull request #58 from Clownacy/master

Cleanup, ARM Linux portability improvements, an accuracy fix, and dependency generation
This commit is contained in:
Cucky 2019-02-11 15:47:47 -05:00 committed by GitHub
commit e796a55a75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 19 deletions

View file

@ -1,14 +1,14 @@
ifeq ($(RELEASE), 1)
CXXFLAGS := -O3 -s
CXXFLAGS = -O3 -s
FILENAME_DEF = release
else
CXXFLAGS := -O0 -g
CXXFLAGS = -O0 -g
FILENAME_DEF = debug
endif
ifeq ($(JAPANESE), 1)
CXXFLAGS += -DJAPANESE
LIBS += -liconv
ifeq ($(RELEASE), 1)
FILENAME_DEF = releasejp
else
@ -26,16 +26,20 @@ ifeq ($(WINDOWS), 1)
ifeq ($(CONSOLE), 1)
CXXFLAGS += -mconsole
endif
ifeq ($(JAPANESE), 1)
LIBS += -liconv
endif
CXXFLAGS += -DWINDOWS
LIBS += -lkernel32
endif
CXXFLAGS += `sdl2-config --cflags` `pkg-config freetype2 --cflags`
CXXFLAGS += `sdl2-config --cflags` `pkg-config freetype2 --cflags` -MMD -MP -MF $@.d
LIBS += `sdl2-config --static-libs` `pkg-config freetype2 --libs`
ifeq ($(STATIC), 1)
CXXFLAGS += -static
LIBS += -lharfbuzz -lfreetype -lbz2 -lpng -lz -lgraphite2 -lRpcrt4 -lDwrite -lusp10
CXXFLAGS += -static
LIBS += -lharfbuzz -lfreetype -lbz2 -lpng -lz -lgraphite2 -lRpcrt4 -lDwrite -lusp10
endif
# For an accurate result to the original's code, compile in alphabetical order
@ -186,27 +190,28 @@ ifneq ($(WINDOWS), 1)
endif
OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
DEPENDENCIES = $(addprefix obj/$(FILENAME)/, $(addsuffix .o.d, $(SOURCES)))
ifeq ($(WINDOWS), 1)
OBJECTS += obj/$(FILENAME)/win_icon.o
OBJECTS += obj/$(FILENAME)/win_icon.o
endif
all: build/$(FILENAME)
build/$(FILENAME): $(OBJECTS)
@mkdir -p $(@D)
@g++ $(CXXFLAGS) $^ -o $@ $(LIBS)
@$(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS)
@echo Finished compiling: $@
obj/$(FILENAME)/%.o: src/%.cpp
@mkdir -p $(@D)
@echo Compiling $^
@g++ $(CXXFLAGS) $^ -o $@ -c
@echo Compiling $<
@$(CXX) $(CXXFLAGS) $< -o $@ -c
obj/$(FILENAME)/Resource.o: src/Resource.cpp $(addprefix src/Resource/, $(addsuffix .h, $(RESOURCES)))
@mkdir -p $(@D)
@echo Compiling $<
@g++ $(CXXFLAGS) $< -o $@ -c
@$(CXX) $(CXXFLAGS) $< -o $@ -c
src/Resource/%.h: res/% obj/bin2h
@mkdir -p $(@D)
@ -216,7 +221,9 @@ src/Resource/%.h: res/% obj/bin2h
obj/bin2h: res/bin2h.c
@mkdir -p $(@D)
@echo Compiling $^
@gcc -O3 -s -static $^ -o $@
@$(CC) -O3 -s -static $^ -o $@
include $(wildcard $(DEPENDENCIES))
obj/$(FILENAME)/win_icon.o: res/ICON/ICON.rc res/ICON/0.ico res/ICON/ICON_MINI.ico
@mkdir -p $(@D)

View file

@ -16,7 +16,7 @@ bool GetCompileVersion(int *v1, int *v2, int *v3, int *v4)
bool CheckFileExists(const char *name)
{
char path[PATH_LENGTH];
sprintf(path, "%s\\%s", gModulePath, name);
sprintf(path, "%s/%s", gModulePath, name);
FILE *file = fopen(path, "rb");
if (file)

View file

@ -280,7 +280,6 @@ int main(int argc, char *argv[])
}
//Create window
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
gWindow = SDL_CreateWindow(lpWindowName, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, gWindowWidth, gWindowHeight, bFullscreen ? SDL_WINDOW_FULLSCREEN : 0);
if (gWindow)

View file

@ -260,9 +260,9 @@ void ActNpc104(NPCHAR *npc)
if (bJump)
{
if (gMC.x > npc->x)
npc->direct = 0;
else
npc->direct = 2;
else
npc->direct = 0;
npc->act_no = 10;
npc->ani_no = 2;
@ -272,7 +272,7 @@ void ActNpc104(NPCHAR *npc)
PlaySoundObject(30, 1);
if (npc->direct == 0)
npc->xm = -0x200u;
npc->xm = -0x200;
else
npc->xm = 0x200;
}

View file

@ -6,7 +6,7 @@
#include "WindowsWrapper.h"
static char gWaveModelTable[6][256];
static signed char gWaveModelTable[6][256];
void MakeWaveTables(void)
{

View file

@ -323,7 +323,7 @@ size_t MakePixToneObject(const PIXTONEPARAMETER *ptp, int ptp_num, int no)
if (pcm_buffer[j] + mixed_pcm_buffer[j] - 0x100 < -0x7F)
mixed_pcm_buffer[j] = 0;
else if (pcm_buffer[j] + mixed_pcm_buffer[j] - 0x100 > 0x7F)
mixed_pcm_buffer[j] = -1;
mixed_pcm_buffer[j] = 0xFF;
else
mixed_pcm_buffer[j] += pcm_buffer[j] + -0x80;
}