ref: e796a55a75d6b4adf5611165e193b14f8ce3c024
parent: 5aea2ad77be112076e51c79a27aada9b3893d84f
parent: a5860afeb9114a7c905b8d23d54b88e674f28aba
author: Cucky <44537737+cuckydev@users.noreply.github.com>
date: Mon Feb 11 10:47:47 EST 2019
Merge pull request #58 from Clownacy/master Cleanup, ARM Linux portability improvements, an accuracy fix, and dependency generation
--- a/Makefile
+++ b/Makefile
@@ -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 ($(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,9 +190,10 @@
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)
@@ -195,18 +200,18 @@
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 @@
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)
--- a/src/Generic.cpp
+++ b/src/Generic.cpp
@@ -16,7 +16,7 @@
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)
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -280,7 +280,6 @@
}
//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)
--- a/src/NpcAct100.cpp
+++ b/src/NpcAct100.cpp
@@ -260,9 +260,9 @@
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 @@
PlaySoundObject(30, 1);
if (npc->direct == 0)
- npc->xm = -0x200u;
+ npc->xm = -0x200;
else
npc->xm = 0x200;
}
--- a/src/PixTone.cpp
+++ b/src/PixTone.cpp
@@ -6,7 +6,7 @@
#include "WindowsWrapper.h"
-static char gWaveModelTable[6][256];
+static signed char gWaveModelTable[6][256];
void MakeWaveTables(void)
{
--- a/src/Sound.cpp
+++ b/src/Sound.cpp
@@ -323,7 +323,7 @@
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;
}