Added support for windows MinGW build (#800)
This commit is contained in:
1 parent
92822c6412
commit
252a900b91
8 files changed
+61
-59
No files matched your search
+9
-3
@@ -177,9 +177,15 @@ def main():
|
|||||||
# presence of the correct roms automatically
|
# presence of the correct roms automatically
|
||||||
|
|
||||||
# Make sure tools exist
|
# Make sure tools exist
|
||||||
subprocess.check_call(
|
tools = [ "n64graphics", "skyconv", "mio0", "aifc_decode" ]
|
||||||
["make", "-s", "-C", "tools/", "n64graphics", "skyconv", "mio0", "aifc_decode"]
|
if os.name == 'nt':
|
||||||
)
|
tools = [tool + ".exe" for tool in tools]
|
||||||
|
make = "mingw32-make"
|
||||||
|
else:
|
||||||
|
make = "make"
|
||||||
|
|
||||||
|
cmd = [make, "-s", "-C", "tools/"] + tools
|
||||||
|
subprocess.check_call(cmd)
|
||||||
|
|
||||||
# Go through the assets in roughly alphabetical order (but assets in the same
|
# Go through the assets in roughly alphabetical order (but assets in the same
|
||||||
# mio0 file still go together).
|
# mio0 file still go together).
|
||||||
|
|||||||
@@ -175,9 +175,9 @@ SECTIONS
|
|||||||
#ifdef LIBPL
|
#ifdef LIBPL
|
||||||
BUILD_DIR/lib/libpl*.o(.text*);
|
BUILD_DIR/lib/libpl*.o(.text*);
|
||||||
#endif
|
#endif
|
||||||
*/ULTRALIB.a:*.o(.text*);
|
*ULTRALIB.a:*.o(.text*);
|
||||||
*/libnustd.a:*.o(.text*);
|
*/libnustd.a:*.o(.text*);
|
||||||
*/libgcc.a:*.o(.text*);
|
*libgcc.a:*.o(.text*);
|
||||||
*/libz.a:*.o(.text*);
|
*/libz.a:*.o(.text*);
|
||||||
*/libhvqm2.a:*.o(.text*);
|
*/libhvqm2.a:*.o(.text*);
|
||||||
lib/rspboot.o(.text*);
|
lib/rspboot.o(.text*);
|
||||||
@@ -197,7 +197,7 @@ SECTIONS
|
|||||||
#ifdef LIBPL
|
#ifdef LIBPL
|
||||||
BUILD_DIR/lib/libpl*.o(.*data*);
|
BUILD_DIR/lib/libpl*.o(.*data*);
|
||||||
#endif
|
#endif
|
||||||
*/ULTRALIB.a:*.o(.data*);
|
*ULTRALIB.a:*.o(.data*);
|
||||||
*/libhvqm2.a:*.o(.data*);
|
*/libhvqm2.a:*.o(.data*);
|
||||||
*/libz.a:*.o(.data*);
|
*/libz.a:*.o(.data*);
|
||||||
#include "rspdata.inc.ld"
|
#include "rspdata.inc.ld"
|
||||||
@@ -215,8 +215,8 @@ SECTIONS
|
|||||||
#ifdef LIBPL
|
#ifdef LIBPL
|
||||||
BUILD_DIR/lib/libpl*.o(.rodata*);
|
BUILD_DIR/lib/libpl*.o(.rodata*);
|
||||||
#endif
|
#endif
|
||||||
*/ULTRALIB.a:*.o(.rodata*);
|
*ULTRALIB.a:*.o(.rodata*);
|
||||||
*/libgcc.a:*.o(.rodata*);
|
*libgcc.a:*.o(.rodata*);
|
||||||
*/libz.a:*.o(.rodata*);
|
*/libz.a:*.o(.rodata*);
|
||||||
|
|
||||||
lib/PR/hvqm/hvqm2sp1.o(.rodata*);
|
lib/PR/hvqm/hvqm2sp1.o(.rodata*);
|
||||||
@@ -234,9 +234,9 @@ SECTIONS
|
|||||||
#ifdef LIBPL
|
#ifdef LIBPL
|
||||||
BUILD_DIR/lib/libpl*.o(.*bss*);
|
BUILD_DIR/lib/libpl*.o(.*bss*);
|
||||||
#endif
|
#endif
|
||||||
*/ULTRALIB.a:*.o(COMMON);
|
*ULTRALIB.a:*.o(COMMON);
|
||||||
*/ULTRALIB.a:*.o(.scommon);
|
*ULTRALIB.a:*.o(.scommon);
|
||||||
*/ULTRALIB.a:*.o(.*bss*);
|
*ULTRALIB.a:*.o(.*bss*);
|
||||||
*/libhvqm2.a:*.o(.bss*);
|
*/libhvqm2.a:*.o(.bss*);
|
||||||
*/libz.a:*.o(.bss*);
|
*/libz.a:*.o(.bss*);
|
||||||
. = ALIGN(0x8);
|
. = ALIGN(0x8);
|
||||||
|
|||||||
+1
-30
@@ -109,30 +109,6 @@ public:
|
|||||||
#define flipsversion "Floating IPS"
|
#define flipsversion "Floating IPS"
|
||||||
|
|
||||||
|
|
||||||
#if defined(FLIPS_WINDOWS)
|
|
||||||
#define UNICODE
|
|
||||||
#define _WIN32_WINNT 0x0501
|
|
||||||
#define _WIN32_IE 0x0600
|
|
||||||
|
|
||||||
#define NOMINMAX // this seems automatically on in C++ - crazy.
|
|
||||||
#ifdef __MINGW32__
|
|
||||||
#include <stdlib.h>
|
|
||||||
#undef __USE_MINGW_ANSI_STDIO // must remove this, to avoid a libgcc_s_sjlj-1.dll dependency on 32bit
|
|
||||||
#endif // comments say libstdc++ demands a POSIX printf, but I'm not using that, so I don't care
|
|
||||||
#include <windows.h>
|
|
||||||
#include <windowsx.h>
|
|
||||||
#include <shlobj.h>
|
|
||||||
#include <wchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <commctrl.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
#define wcsicmp _wcsicmp // wcsicmp deprecated? okay, have a define
|
|
||||||
#define wcsdup _wcsdup
|
|
||||||
#define wtoi _wtoi
|
|
||||||
|
|
||||||
|
|
||||||
#else
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -190,7 +166,6 @@ static inline char* strdup(const char * in)
|
|||||||
memcpy(ret, in, len+1);
|
memcpy(ret, in, len+1);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
@@ -341,11 +316,7 @@ void bpsdeltaEnd();
|
|||||||
int GUIShow(LPCWSTR filename);
|
int GUIShow(LPCWSTR filename);
|
||||||
void GUILoadConfig();
|
void GUILoadConfig();
|
||||||
//LPCWSTR GUIGetFileFor(uint32_t crc32); // use FindRomForPatch instead
|
//LPCWSTR GUIGetFileFor(uint32_t crc32); // use FindRomForPatch instead
|
||||||
#ifdef FLIPS_WINDOWS
|
#define GUIClaimConsole()
|
||||||
void GUIClaimConsole();
|
|
||||||
#else
|
|
||||||
#define GUIClaimConsole() // all other platforms have consoles already
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//the OS port is responsible for main()
|
//the OS port is responsible for main()
|
||||||
//Module name: crc32
|
//Module name: crc32
|
||||||
|
|||||||
+23
-7
@@ -10,6 +10,14 @@ LDFLAGS := -lm
|
|||||||
ALL_PROGRAMS := armips filesizer rncpack n64graphics n64graphics_ci mio0 slienc n64cksum textconv aifc_decode aiff_extract_codebook vadpcm_enc tabledesign extract_data_for_mio skyconv flips
|
ALL_PROGRAMS := armips filesizer rncpack n64graphics n64graphics_ci mio0 slienc n64cksum textconv aifc_decode aiff_extract_codebook vadpcm_enc tabledesign extract_data_for_mio skyconv flips
|
||||||
LIBAUDIOFILE := audiofile/libaudiofile.a
|
LIBAUDIOFILE := audiofile/libaudiofile.a
|
||||||
|
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
EXT := .exe
|
||||||
|
OUTPUTS := $(ALL_PROGRAMS:=.exe)
|
||||||
|
else
|
||||||
|
EXT :=
|
||||||
|
OUTPUTS := $(ALL_PROGRAMS)
|
||||||
|
endif
|
||||||
|
|
||||||
# Only build armips from tools if it is not found on the system
|
# Only build armips from tools if it is not found on the system
|
||||||
ifeq ($(call find-command,armips),)
|
ifeq ($(call find-command,armips),)
|
||||||
BUILD_PROGRAMS := $(ALL_PROGRAMS)
|
BUILD_PROGRAMS := $(ALL_PROGRAMS)
|
||||||
@@ -43,7 +51,7 @@ aifc_decode_SOURCES := aifc_decode.c
|
|||||||
|
|
||||||
aiff_extract_codebook_SOURCES := aiff_extract_codebook.c
|
aiff_extract_codebook_SOURCES := aiff_extract_codebook.c
|
||||||
|
|
||||||
tabledesign: $(LIBAUDIOFILE)
|
tabledesign$(EXT): $(LIBAUDIOFILE)
|
||||||
tabledesign_SOURCES := sdk-tools/tabledesign/codebook.c sdk-tools/tabledesign/estimate.c sdk-tools/tabledesign/print.c sdk-tools/tabledesign/tabledesign.c
|
tabledesign_SOURCES := sdk-tools/tabledesign/codebook.c sdk-tools/tabledesign/estimate.c sdk-tools/tabledesign/print.c sdk-tools/tabledesign/tabledesign.c
|
||||||
tabledesign_CFLAGS := -Iaudiofile -Wno-uninitialized
|
tabledesign_CFLAGS := -Iaudiofile -Wno-uninitialized
|
||||||
tabledesign_LDFLAGS := -Laudiofile -laudiofile -lstdc++
|
tabledesign_LDFLAGS := -Laudiofile -laudiofile -lstdc++
|
||||||
@@ -56,22 +64,30 @@ extract_data_for_mio_SOURCES := extract_data_for_mio.c
|
|||||||
skyconv_SOURCES := skyconv.c n64graphics.c utils.c
|
skyconv_SOURCES := skyconv.c n64graphics.c utils.c
|
||||||
skyconv_CFLAGS := -g -I../include
|
skyconv_CFLAGS := -g -I../include
|
||||||
|
|
||||||
armips: CC := $(CXX)
|
armips$(EXT): CC := $(CXX)
|
||||||
armips_SOURCES := armips.cpp
|
armips_SOURCES := armips.cpp
|
||||||
armips_CFLAGS := -std=c++11 -fno-exceptions -fno-rtti -pipe
|
armips_CFLAGS := -std=gnu++11 -fno-exceptions -fno-rtti -pipe
|
||||||
armips_LDFLAGS := -pthread
|
armips_LDFLAGS := -pthread
|
||||||
ifeq ($(HOST_ENV),MinGW)
|
ifeq ($(HOST_ENV),MinGW)
|
||||||
armips_LDFLAGS += -municode
|
armips_LDFLAGS += -municode
|
||||||
endif
|
endif
|
||||||
|
|
||||||
flips: CC := $(CXX)
|
flips$(EXT): CC := $(CXX)
|
||||||
flips_SOURCES := FlipsSrc/Flips.cpp
|
flips_SOURCES := FlipsSrc/Flips.cpp
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
flips_CFLAGS := -Wall -Wextra -fopenmp -Os -flto -fuse-linker-plugin -fomit-frame-pointer -fmerge-all-constants \
|
||||||
|
-fvisibility=hidden -fno-exceptions -fno-rtti -fno-unwind-tables -fno-asynchronous-unwind-tables \
|
||||||
|
-ffunction-sections -fdata-sections -Wl,--gc-sections
|
||||||
|
else
|
||||||
flips_CFLAGS := -Wall -Wextra -fopenmp -Os -flto -fuse-linker-plugin -fomit-frame-pointer -fmerge-all-constants \
|
flips_CFLAGS := -Wall -Wextra -fopenmp -Os -flto -fuse-linker-plugin -fomit-frame-pointer -fmerge-all-constants \
|
||||||
-fvisibility=hidden -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables \
|
-fvisibility=hidden -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables \
|
||||||
-ffunction-sections -fdata-sections -Wl,--gc-sections \
|
-ffunction-sections -fdata-sections -Wl,--gc-sections \
|
||||||
|
-fvisibility=hidden -fno-exceptions -fno-rtti -fno-unwind-tables -fno-asynchronous-unwind-tables \
|
||||||
|
-ffunction-sections -fdata-sections -Wl,--gc-sections \
|
||||||
-Wl,-z,relro,-z,now,--as-needed,--hash-style=gnu,--relax
|
-Wl,-z,relro,-z,now,--as-needed,--hash-style=gnu,--relax
|
||||||
|
endif
|
||||||
|
|
||||||
all-except-recomp: $(LIBAUDIOFILE) $(BUILD_PROGRAMS)
|
all-except-recomp: $(LIBAUDIOFILE) $(OUTPUTS)
|
||||||
|
|
||||||
all: all-except-recomp
|
all: all-except-recomp
|
||||||
|
|
||||||
@@ -83,8 +99,8 @@ clean:
|
|||||||
distclean: clean
|
distclean: clean
|
||||||
|
|
||||||
define COMPILE
|
define COMPILE
|
||||||
$(1): $($1_SOURCES)
|
$(1)$$(EXT): $($1_SOURCES)
|
||||||
$$(CC) $(CFLAGS) $($1_CFLAGS) $$^ -o $$@ $($1_LDFLAGS) $(LDFLAGS)
|
$$(CC) $(CFLAGS) $($1_CFLAGS) $$^ -o $(1) $($1_LDFLAGS) $(LDFLAGS)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(foreach p,$(BUILD_PROGRAMS),$(eval $(call COMPILE,$(p))))
|
$(foreach p,$(BUILD_PROGRAMS),$(eval $(call COMPILE,$(p))))
|
||||||
|
|||||||
+3
-8
@@ -15496,7 +15496,7 @@ int64_t fileSize(const std::wstring& fileName)
|
|||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
WIN32_FILE_ATTRIBUTE_DATA attr;
|
WIN32_FILE_ATTRIBUTE_DATA attr;
|
||||||
if (!GetFileAttributesEx(fileName.c_str(),GetFileExInfoStandard,&attr)
|
if (!GetFileAttributesExW(fileName.c_str(),GetFileExInfoStandard,&attr)
|
||||||
|| (attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
|| (attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||||
return 0;
|
return 0;
|
||||||
return ((int64_t) attr.nFileSizeHigh << 32) | (int64_t) attr.nFileSizeLow;
|
return ((int64_t) attr.nFileSizeHigh << 32) | (int64_t) attr.nFileSizeLow;
|
||||||
@@ -15514,10 +15514,10 @@ bool fileExists(const std::wstring& strFilename)
|
|||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifdef ARMIPS_WINDOWS_UWP
|
#ifdef ARMIPS_WINDOWS_UWP
|
||||||
return GetFileAttributes(strFilename.c_str()) != INVALID_FILE_ATTRIBUTES;
|
return GetFileAttributesW(strFilename.c_str()) != INVALID_FILE_ATTRIBUTES;
|
||||||
#else
|
#else
|
||||||
int OldMode = SetErrorMode(SEM_FAILCRITICALERRORS);
|
int OldMode = SetErrorMode(SEM_FAILCRITICALERRORS);
|
||||||
bool success = GetFileAttributes(strFilename.c_str()) != INVALID_FILE_ATTRIBUTES;
|
bool success = GetFileAttributesW(strFilename.c_str()) != INVALID_FILE_ATTRIBUTES;
|
||||||
SetErrorMode(OldMode);
|
SetErrorMode(OldMode);
|
||||||
return success;
|
return success;
|
||||||
#endif
|
#endif
|
||||||
@@ -19877,8 +19877,6 @@ int wmain(int argc, wchar_t* argv[])
|
|||||||
return runFromCommandLine(arguments);
|
return runFromCommandLine(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// convert input to wstring
|
// convert input to wstring
|
||||||
@@ -19901,6 +19899,3 @@ int main(int argc, char* argv[])
|
|||||||
delete[] wargv;
|
delete[] wargv;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+14
-1
@@ -1,4 +1,17 @@
|
|||||||
#include <byteswap.h>
|
#ifndef _WIN32
|
||||||
|
#include <byteswap.h>
|
||||||
|
#else
|
||||||
|
#define __bswap_constant_32(x) \
|
||||||
|
((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \
|
||||||
|
(((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24))
|
||||||
|
|
||||||
|
static __inline unsigned int
|
||||||
|
__bswap_32 (unsigned int __bsx)
|
||||||
|
{
|
||||||
|
return __bswap_constant_32 (__bsx);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|||||||
+2
-2
@@ -45,7 +45,7 @@ lightStructs = {}
|
|||||||
# FIRST PASS: COLLECT LIGHT STRUCT INFO, REMOVE LIGHT STRUCTS
|
# FIRST PASS: COLLECT LIGHT STRUCT INFO, REMOVE LIGHT STRUCTS
|
||||||
for file in lightFiles:
|
for file in lightFiles:
|
||||||
changed = False
|
changed = False
|
||||||
with open(file, "r") as f:
|
with open(file, "r", encoding='utf-8') as f:
|
||||||
fileLines = f.readlines()
|
fileLines = f.readlines()
|
||||||
index = 0
|
index = 0
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ def index_delta(mat_name, orig_index, delta):
|
|||||||
# SECOND PASS - CHANGE LIGHT COMMANDS
|
# SECOND PASS - CHANGE LIGHT COMMANDS
|
||||||
for file in lightFiles:
|
for file in lightFiles:
|
||||||
changed = False
|
changed = False
|
||||||
with open(file, "r") as f:
|
with open(file, "r", encoding='utf-8') as f:
|
||||||
fileLines = f.readlines()
|
fileLines = f.readlines()
|
||||||
index = 0
|
index = 0
|
||||||
dl_index = -1
|
dl_index = -1
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#define SCALE_3_8(VAL_) ((VAL_) * 0x24)
|
#define SCALE_3_8(VAL_) ((VAL_) * 0x24)
|
||||||
#define SCALE_8_3(VAL_) ((VAL_) / 0x24)
|
#define SCALE_8_3(VAL_) ((VAL_) / 0x24)
|
||||||
|
|
||||||
|
#define bcopy(s1, s2, n) memcpy((s2), (s1), (n))
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user