diff --git a/Assets/dll/libsameboy.dll b/Assets/dll/libsameboy.dll index b62b931641..d81f1e6498 100644 Binary files a/Assets/dll/libsameboy.dll and b/Assets/dll/libsameboy.dll differ diff --git a/Assets/dll/libsameboy.so b/Assets/dll/libsameboy.so index e041be9f08..d19c2c4b9f 100755 Binary files a/Assets/dll/libsameboy.so and b/Assets/dll/libsameboy.so differ diff --git a/submodules/sameboy/.gitignore b/submodules/sameboy/.gitignore deleted file mode 100644 index e6e61f31d1..0000000000 --- a/submodules/sameboy/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.sconsign.dblite -BizInterface.os -blip_buf.os -config.log -libsameboy.dll.a -.sconf_temp diff --git a/submodules/sameboy/Makefile b/submodules/sameboy/Makefile new file mode 100644 index 0000000000..af2db09c12 --- /dev/null +++ b/submodules/sameboy/Makefile @@ -0,0 +1,96 @@ +ROOT_DIR := $(realpath .) +CORE_DIR := $(realpath $(ROOT_DIR)/libsameboy/Core) +OUTPUTDLL_DIR := $(realpath $(ROOT_DIR)/../../Assets/dll) +OUTPUTDLLCOPY_DIR := $(realpath $(ROOT_DIR)/../../output/dll) + +OUT_DIR := $(ROOT_DIR)/obj +OBJ_DIR := $(OUT_DIR)/release +DOBJ_DIR := $(OUT_DIR)/debug + +CC := gcc +CCFLAGS := -I$(CORE_DIR) -Wall -Wextra -std=gnu11 -fomit-frame-pointer -Wno-strict-aliasing \ + -Wno-multichar -Wno-implicit-fallthrough -Wno-sign-compare -Wno-unused-parameter \ + -Wno-int-in-bool-context -Wno-missing-field-initializers -Wno-overflow -Wno-unused-result \ + -D_GNU_SOURCE -D_USE_MATH_DEFINES -DNDEBUG -DGB_INTERNAL -DGB_DISABLE_DEBUGGER \ + -DGB_DISABLE_CHEATS -DGB_DISABLE_TIMEKEEPING -DGB_DISABLE_REWIND -DGB_VERSION= + +ifeq ($(OS),Windows_NT) +TARGET := libsameboy.dll +else +TARGET := libsameboy.so +endif + +SRCS := \ + $(CORE_DIR)/apu.c \ + $(CORE_DIR)/random.c \ + $(CORE_DIR)/camera.c \ + $(CORE_DIR)/rumble.c \ + $(CORE_DIR)/save_state.c \ + $(CORE_DIR)/display.c \ + $(CORE_DIR)/sgb.c \ + $(CORE_DIR)/gb.c \ + $(CORE_DIR)/sm83_cpu.c \ + $(CORE_DIR)/mbc.c \ + $(CORE_DIR)/memory.c \ + $(CORE_DIR)/timing.c \ + $(CORE_DIR)/printer.c \ + $(CORE_DIR)/joypad.c \ + $(ROOT_DIR)/BizInterface.c \ + $(ROOT_DIR)/blip_buf.c + +LDFLAGS := -shared -Wno-attributes +CCFLAGS_DEBUG := -O0 -g +CCFLAGS_RELEASE := -O3 -flto +LDFLAGS_DEBUG := +LDFLAGS_RELEASE := -s + +_OBJS := $(addsuffix .o,$(realpath $(SRCS))) +OBJS := $(patsubst $(ROOT_DIR)%,$(OBJ_DIR)%,$(_OBJS)) +DOBJS := $(patsubst $(ROOT_DIR)%,$(DOBJ_DIR)%,$(_OBJS)) + +$(OBJ_DIR)/%.c.o: %.c + @echo cc $< + @mkdir -p $(@D) + @$(CC) -c -o $@ $< $(CCFLAGS) $(CCFLAGS_RELEASE) +$(DOBJ_DIR)/%.c.o: %.c + @echo cc $< + @mkdir -p $(@D) + @$(CC) -c -o $@ $< $(CCFLAGS) $(CCFLAGS_DEBUG) + +.DEFAULT_GOAL := install + +TARGET_RELEASE := $(OBJ_DIR)/$(TARGET) +TARGET_DEBUG := $(DOBJ_DIR)/$(TARGET) + +.PHONY: release debug install install-debug + +release: $(TARGET_RELEASE) +debug: $(TARGET_DEBUG) + +$(TARGET_RELEASE): $(OBJS) + @echo ld $@ + @$(CC) -o $@ $(LDFLAGS) $(LDFLAGS_RELEASE) $(CCFLAGS) $(CCFLAGS_RELEASE) $(OBJS) +$(TARGET_DEBUG): $(DOBJS) + @echo ld $@ + @$(CC) -o $@ $(LDFLAGS) $(LDFLAGS_DEBUG) $(CCFLAGS) $(CCFLAGS_DEBUG) $(DOBJS) + +install: $(TARGET_RELEASE) + @cp -f $< $(OUTPUTDLL_DIR) + @cp $(OUTPUTDLL_DIR)/$(TARGET) $(OUTPUTDLLCOPY_DIR)/$(TARGET) || true + @echo Release build of $(TARGET) installed. + +install-debug: $(TARGET_DEBUG) + @cp -f $< $(OUTPUTDLL_DIR) + @cp $(OUTPUTDLL_DIR)/$(TARGET) $(OUTPUTDLLCOPY_DIR)/$(TARGET) || true + @echo Debug build of $(TARGET) installed. + +.PHONY: clean clean-release clean-debug +clean: + rm -rf $(OUT_DIR) +clean-release: + rm -rf $(OUT_DIR)/release +clean-debug: + rm -rf $(OUT_DIR)/debug + +-include $(OBJS:%o=%d) +-include $(DOBJS:%o=%d) diff --git a/submodules/sameboy/SConstruct b/submodules/sameboy/SConstruct deleted file mode 100644 index 1c563a218d..0000000000 --- a/submodules/sameboy/SConstruct +++ /dev/null @@ -1,38 +0,0 @@ -global_cflags = ARGUMENTS.get('CFLAGS', '-I./libsameboy/Core -Wall -Wextra -O3 -std=gnu11 -fomit-frame-pointer -flto') -global_cflags += ARGUMENTS.get('CFLAGS', ' -Wno-strict-aliasing -Wno-multichar -Wno-implicit-fallthrough -Wno-sign-compare') -global_cflags += ARGUMENTS.get('CFLAGS', ' -Wno-unused-parameter -Wno-int-in-bool-context -Wno-missing-field-initializers -Wno-overflow') -global_defines = ' -D_GNU_SOURCE -D_USE_MATH_DEFINES -DNDEBUG -DGB_INTERNAL -DGB_DISABLE_DEBUGGER -DGB_DISABLE_CHEATS -DGB_DISABLE_TIMEKEEPING -DGB_DISABLE_REWIND -DGB_VERSION=' -vars = Variables() -vars.Add('CC') - -import os -env = Environment(ENV = os.environ, - CFLAGS = global_cflags + global_defines, - variables = vars) - -sourceFiles = Split(''' - libsameboy/Core/apu.c - libsameboy/Core/random.c - libsameboy/Core/camera.c - libsameboy/Core/rumble.c - libsameboy/Core/save_state.c - libsameboy/Core/display.c - libsameboy/Core/sgb.c - libsameboy/Core/gb.c - libsameboy/Core/sm83_cpu.c - libsameboy/Core/mbc.c - libsameboy/Core/memory.c - libsameboy/Core/timing.c - libsameboy/Core/printer.c - libsameboy/Core/joypad.c -''') - -conf = env.Configure() - -conf.Finish() - -shlib = env.SharedLibrary('sameboy', sourceFiles + ['BizInterface.c'] + ['blip_buf.c'], - LINKFLAGS = env['LINKFLAGS'] + ' -s -Wno-attributes', - SHLIBPREFIX = "lib") - -env.Default(shlib) diff --git a/submodules/sameboy/build.sh b/submodules/sameboy/build.sh deleted file mode 100644 index bf53f1a4e1..0000000000 --- a/submodules/sameboy/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -scons -mv ./libsameboy.dll ../../Assets/dll/ -mv ./libsameboy.so ../../Assets/dll/ \ No newline at end of file diff --git a/submodules/sameboy/libsameboy b/submodules/sameboy/libsameboy index 52ab200544..7efd26c548 160000 --- a/submodules/sameboy/libsameboy +++ b/submodules/sameboy/libsameboy @@ -1 +1 @@ -Subproject commit 52ab20054486330a8757641230f55c716ea525e6 +Subproject commit 7efd26c548f3ce1f1969a53c7ce5b1ed96a42f7b