From 71dc6af4d2c0486f63423c5c9866f8cb1455332d Mon Sep 17 00:00:00 2001 From: Yvan Janssens Date: Sun, 27 Oct 2019 12:52:06 +0000 Subject: [PATCH 1/6] Added +x flag to perl scripts. Added the +x flag to the perl scripts to enable building on non-NT platforms. --- src/dep/scripts/cave_sprite_func.pl | 0 src/dep/scripts/cave_tile_func.pl | 0 src/dep/scripts/fixrc.pl | 0 src/dep/scripts/gamelist.pl | 0 src/dep/scripts/license2rtf.pl | 0 src/dep/scripts/neo_sprite_func.pl | 0 src/dep/scripts/psikyo_tile_func.pl | 0 src/dep/scripts/toa_gp9001_func.pl | 0 8 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 src/dep/scripts/cave_sprite_func.pl mode change 100644 => 100755 src/dep/scripts/cave_tile_func.pl mode change 100644 => 100755 src/dep/scripts/fixrc.pl mode change 100644 => 100755 src/dep/scripts/gamelist.pl mode change 100644 => 100755 src/dep/scripts/license2rtf.pl mode change 100644 => 100755 src/dep/scripts/neo_sprite_func.pl mode change 100644 => 100755 src/dep/scripts/psikyo_tile_func.pl mode change 100644 => 100755 src/dep/scripts/toa_gp9001_func.pl diff --git a/src/dep/scripts/cave_sprite_func.pl b/src/dep/scripts/cave_sprite_func.pl old mode 100644 new mode 100755 diff --git a/src/dep/scripts/cave_tile_func.pl b/src/dep/scripts/cave_tile_func.pl old mode 100644 new mode 100755 diff --git a/src/dep/scripts/fixrc.pl b/src/dep/scripts/fixrc.pl old mode 100644 new mode 100755 diff --git a/src/dep/scripts/gamelist.pl b/src/dep/scripts/gamelist.pl old mode 100644 new mode 100755 diff --git a/src/dep/scripts/license2rtf.pl b/src/dep/scripts/license2rtf.pl old mode 100644 new mode 100755 diff --git a/src/dep/scripts/neo_sprite_func.pl b/src/dep/scripts/neo_sprite_func.pl old mode 100644 new mode 100755 diff --git a/src/dep/scripts/psikyo_tile_func.pl b/src/dep/scripts/psikyo_tile_func.pl old mode 100644 new mode 100755 diff --git a/src/dep/scripts/toa_gp9001_func.pl b/src/dep/scripts/toa_gp9001_func.pl old mode 100644 new mode 100755 From 462968274e366266f5f60f345394bc1c0b87cdc4 Mon Sep 17 00:00:00 2001 From: Yvan Janssens Date: Sun, 27 Oct 2019 12:58:53 +0000 Subject: [PATCH 2/6] Replace deprecated header definition In modern Windows SDKs, InitGuid.h is deprecated in favour of guiddef.h. Mingw-w64 also follows this change. --- src/intf/audio/win32/aud_dsound3.cpp | 2 +- src/intf/audio/win32/aud_xaudio2.cpp | 2 +- src/intf/input/win32/inp_dinput.cpp | 2 +- src/intf/video/win32/vid_d3d.cpp | 2 +- src/intf/video/win32/vid_ddraw.cpp | 2 +- src/intf/video/win32/vid_ddrawfx.cpp | 2 +- src/intf/video/win32/vid_directx9.cpp | 2 +- src/intf/video/win32/vid_directx_support.cpp | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/intf/audio/win32/aud_dsound3.cpp b/src/intf/audio/win32/aud_dsound3.cpp index b5e770d61..e9dbf4462 100644 --- a/src/intf/audio/win32/aud_dsound3.cpp +++ b/src/intf/audio/win32/aud_dsound3.cpp @@ -3,7 +3,7 @@ #include "aud_dsp.h" #include -#include +#include #define DIRECTSOUND_VERSION 0x0300 // Only need version from DirectX 3 #include diff --git a/src/intf/audio/win32/aud_xaudio2.cpp b/src/intf/audio/win32/aud_xaudio2.cpp index a6d534b89..d27349d92 100644 --- a/src/intf/audio/win32/aud_xaudio2.cpp +++ b/src/intf/audio/win32/aud_xaudio2.cpp @@ -2,7 +2,7 @@ #include "aud_dsp.h" //#ifdef _MSC_VER -#include +#include #include #include diff --git a/src/intf/input/win32/inp_dinput.cpp b/src/intf/input/win32/inp_dinput.cpp index 476f32a16..12141a8d8 100644 --- a/src/intf/input/win32/inp_dinput.cpp +++ b/src/intf/input/win32/inp_dinput.cpp @@ -4,7 +4,7 @@ #include "burner.h" #include "inp_keys.h" -#include +#include #define DIRECTINPUT_VERSION 0x0800 #include diff --git a/src/intf/video/win32/vid_d3d.cpp b/src/intf/video/win32/vid_d3d.cpp index b92e6547a..dd033b889 100644 --- a/src/intf/video/win32/vid_d3d.cpp +++ b/src/intf/video/win32/vid_d3d.cpp @@ -7,7 +7,7 @@ #if !defined BUILD_X64_EXE // #include "vid_directx_support.h" -#include +#include #include "vid_softfx.h" // #define ENABLE_PROFILING FBA_DEBUG diff --git a/src/intf/video/win32/vid_ddraw.cpp b/src/intf/video/win32/vid_ddraw.cpp index cd60700d2..11c3e68b6 100644 --- a/src/intf/video/win32/vid_ddraw.cpp +++ b/src/intf/video/win32/vid_ddraw.cpp @@ -6,7 +6,7 @@ #include "vid_directx_support.h" #endif -#include +#include #define DIRECT3D_VERSION 0x0700 // Use this Direct3D version #if defined BUILD_X64_EXE diff --git a/src/intf/video/win32/vid_ddrawfx.cpp b/src/intf/video/win32/vid_ddrawfx.cpp index 230e85eab..d720cc1b7 100644 --- a/src/intf/video/win32/vid_ddrawfx.cpp +++ b/src/intf/video/win32/vid_ddrawfx.cpp @@ -6,7 +6,7 @@ #include "vid_softfx.h" #endif -#include +#include #define DIRECT3D_VERSION 0x0700 // Use this Direct3D version #if defined BUILD_X64_EXE diff --git a/src/intf/video/win32/vid_directx9.cpp b/src/intf/video/win32/vid_directx9.cpp index 27a28e51c..575753a76 100644 --- a/src/intf/video/win32/vid_directx9.cpp +++ b/src/intf/video/win32/vid_directx9.cpp @@ -10,7 +10,7 @@ // #define ENABLE_PROFILING FBA_DEBUG // #define LOAD_EFFECT_FROM_FILE -#include +#include #define DIRECT3D_VERSION 0x0900 // Use this Direct3D version #define D3D_OVERLOADS #include diff --git a/src/intf/video/win32/vid_directx_support.cpp b/src/intf/video/win32/vid_directx_support.cpp index b2842b8ae..e02cd5473 100644 --- a/src/intf/video/win32/vid_directx_support.cpp +++ b/src/intf/video/win32/vid_directx_support.cpp @@ -5,7 +5,7 @@ #include "vid_directx_support.h" #endif -#include +#include #define DIRECT3D_VERSION 0x0700 // Use this Direct3D version #if defined BUILD_X64_EXE From 020549299a40b3b0db2993d4518af287f68354fc Mon Sep 17 00:00:00 2001 From: Yvan Janssens Date: Sun, 27 Oct 2019 13:42:50 +0000 Subject: [PATCH 3/6] Updated deprecated header use. Misused the new header, fixed in this commit. --- src/intf/audio/win32/aud_xaudio2.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/intf/audio/win32/aud_xaudio2.cpp b/src/intf/audio/win32/aud_xaudio2.cpp index d27349d92..b6f1eb7b1 100644 --- a/src/intf/audio/win32/aud_xaudio2.cpp +++ b/src/intf/audio/win32/aud_xaudio2.cpp @@ -2,6 +2,7 @@ #include "aud_dsp.h" //#ifdef _MSC_VER +#define INITGUID #include #include #include From bf539b863b0946c3be1e3f3ce7ae511c9c234ac2 Mon Sep 17 00:00:00 2001 From: Yvan Janssens Date: Sun, 27 Oct 2019 13:45:07 +0000 Subject: [PATCH 4/6] Created .gitignore This file prevents binaries and autogenerated files from polluting the build. --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..000abe7c9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +obj/ +src/dep/generated/* +gamelist.txt +fba.exe +fbad.exe From 3044b6c7a4e942288c3939b19ba5ba6c94e3c598 Mon Sep 17 00:00:00 2001 From: Yvan Janssens Date: Sun, 27 Oct 2019 13:45:36 +0000 Subject: [PATCH 5/6] Allow cross-compilation from Linux This patch allows the cross-compilation from Linux, which would later on enable e.g. CI integration. --- makefile.mingw | 61 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/makefile.mingw b/makefile.mingw index 5bbb30f00..a67db0ed8 100644 --- a/makefile.mingw +++ b/makefile.mingw @@ -73,6 +73,11 @@ else NAME := $(NAME)$(CPUTYPE) endif +# determine if cross-compiling +HOST = $(uname) +ifeq (,$(findstring NT,$(HOST))) + CROSS = 1 +endif # @@ -109,12 +114,15 @@ endif ifdef GCC510 incdir = $(foreach dir,$(alldir),-I$(srcdir)$(dir)) -I$(objdir)dep/generated -I$(srcdir)dep/mingw/include -I$(srcdir)dep/mingw/include/directx9 -I$(srcdir)dep/mingw/include/xaudio2 endif +ifdef CROSS +incdir = $(foreach dir,$(alldir),-I$(srcdir)$(dir)) -I$(objdir)dep/generated -I$(srcdir)dep/mingw/include -I$(srcdir)dep/mingw/include/directx9 -I$(srcdir)dep/mingw/include/xaudio2 +endif ifdef UNICODE # lib = -lunicows endif -lib += -luser32 -lgdi32 -lcomdlg32 -lcomctl32 -lshell32 -lwinmm -lshlwapi -ladvapi32 -lsetupapi -lole32 -luuid -lwininet +lib += -luser32 -lgdi32 -lcomdlg32 -lcomctl32 -lshell32 -lwinmm -lshlwapi -ladvapi32 -lsetupapi -lole32 -luuid -lwininet -ldxguid -lxaudio2_8 ifdef INCLUDE_AVI_RECORDING lib += -lvfw32 @@ -130,6 +138,8 @@ ifdef BUILD_A68K a68k.o = $(objdir)cpu/a68k/a68k.o endif + + app_gnuc.rc = $(srcdir)dep/generated/app_gnuc.rc license.rtf = $(srcdir)dep/generated/license.rtf driverlist.h = $(srcdir)dep/generated/driverlist.h @@ -178,8 +188,16 @@ autdrv := $(drvsrc:.cpp=.o) # # -CC = gcc -CXX = g++ +ifdef CROSS + ifdef BUILD_X64_EXE + PREFIX = x86_64-w64-mingw32- + else + PREFIX = i686-w64-mingw32- + endif +endif + +CC = $(PREFIX)gcc +CXX = $(PREFIX)g++ LD = $(CXX) AS = nasm @@ -293,6 +311,29 @@ else endif endif +ifdef CROSS +CFLAGS = -pipe \ + -std=gnu99 -O1 \ + -mwindows \ + -fforce-addr -finline-limit=1200 -fthread-jumps \ + -fexpensive-optimizations \ + -Wall -Wno-long-long -Wno-sign-compare -Wno-uninitialized -Wno-unused \ + -Wno-sequence-point -Wno-pedantic \ + $(DEF) $(incdir) + +CXXFLAGS = -pipe \ + -std=gnu++11 -O1 \ + -mwindows \ + -fforce-addr -finline-limit=1200 -fthread-jumps \ + -fexpensive-optimizations -fcheck-new \ + -Wall -W -pedantic -Wshadow -Wno-long-long -Wno-write-strings \ + -Wunknown-pragmas -Wundef -Wno-conversion -Wno-missing-braces -Wno-multichar \ + -Wuninitialized -Wpointer-arith -Wno-inline -Wno-address -Wno-unused-value \ + -Wno-unused-but-set-variable -Wno-sequence-point -Wno-narrowing -Wno-extra \ + -Wno-pedantic \ + $(DEF) $(incdir) +endif + ASFLAGS = -O1 -f coff -w-orphan-labels # D3DUtils & D3DMath need these @@ -596,11 +637,12 @@ $(objdir)cpu/m68k/m68kops.o: $(objdir)cpu/m68k/m68kmake.exe $(objdir)dep/generat @$(CC) $(CFLAGS) -c $(objdir)dep/generated/m68kops.c -o $(objdir)cpu/m68k/m68kops.o $(objdir)dep/generated/m68kops.h: $(objdir)cpu/m68k/m68kmake.exe $(srcdir)cpu/m68k/m68k_in.c - $(objdir)/cpu/m68k/m68kmake $(objdir)dep/generated/ $(srcdir)cpu/m68k/m68k_in.c + $(objdir)/cpu/m68k/m68kmake.exe $(objdir)dep/generated/ $(srcdir)cpu/m68k/m68k_in.c $(objdir)cpu/m68k/m68kmake.exe: $(srcdir)cpu/m68k/m68kmake.c @echo Compiling Musashi MC680x0 core \(m68kmake.c\)... - @$(CC) $(CFLAGS) $(srcdir)cpu/m68k/m68kmake.c -o $(objdir)cpu/m68k/m68kmake.exe + # need to build using native cc to allow cross-compilations + @cc $(srcdir)cpu/m68k/m68kmake.c -o $(objdir)cpu/m68k/m68kmake.exe # @@ -687,6 +729,13 @@ endif %.o: %.rc @echo Compiling resource file $( Date: Sun, 27 Oct 2019 13:52:05 +0000 Subject: [PATCH 6/6] Fixed missing shell statement Fixed missing shell statement to determine host. --- makefile.mingw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile.mingw b/makefile.mingw index a67db0ed8..d6a2772b1 100644 --- a/makefile.mingw +++ b/makefile.mingw @@ -74,7 +74,7 @@ else endif # determine if cross-compiling -HOST = $(uname) +HOST = $(shell uname) ifeq (,$(findstring NT,$(HOST))) CROSS = 1 endif