mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-25 23:52:29 +01:00
byuu says: Changelog: - SNES mid-scanline BGMODE fixes finally merged (can run atx2.zip{mode7.smc}+mtest(2).sfc properly now) - Makefile now discards all built-in rules and variables - switch on bool warning disabled for GCC now as well (was already disabled for Clang) - when loading a game, if any required files are missing, display a warning message box (manifest.bml, program.rom, bios.rom, etc) - when loading a game (or a game slot), if manifest.bml is missing, it will invoke icarus to try and generate it - if that fails (icarus is missing or the folder is bad), you will get a warning telling you that the manifest can't be loaded The warning prompt on missing files work for both games and the .sys folders and their files. For some reason, failing to load the DMG/CGB BIOS is causing a crash before I can display the modal dialog. I have no idea why, and the stack frame backtrace is junk. I also can't seem to abort the failed loading process. If I call Program::unloadMedia(), I get a nasty segfault. Again with a really nasty stack trace. So for now, it'll just end up sitting there emulating an empty ROM (solid black screen.) In time, I'd like to fix that too. Lastly, I need a better method than popen for Windows. popen is kind of ugly and flashes a console window for a brief second even if the application launched is linked with -mwindows. Not sure if there even is one (I need to read the stdout result, so CreateProcess may not work unless I do something nasty like "> %tmp%/temp") I'm also using the regular popen instead of _wpopen, so for this WIP, it won't work if your game folder has non-English letters in the path.
156 lines
3.4 KiB
Makefile
156 lines
3.4 KiB
Makefile
# disable built-in rules and variables
|
|
MAKEFLAGS := Rr
|
|
.SUFFIXES:
|
|
|
|
[A-Z] = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
|
|
[a-z] = a b c d e f g h i j k l m n o p q r s t u v w x y z
|
|
[0-9] = 0 1 2 3 4 5 6 7 8 9
|
|
[markup] = ` ~ ! @ \# $$ % ^ & * ( ) - _ = + [ { ] } \ | ; : ' " , < . > / ?
|
|
[all] = $([A-Z]) $([a-z]) $([0-9]) $([markup])
|
|
[space] :=
|
|
[space] +=
|
|
|
|
# platform detection
|
|
ifeq ($(platform),)
|
|
uname := $(shell uname -s)
|
|
ifeq ($(uname),)
|
|
platform := windows
|
|
delete = del $(subst /,\,$1)
|
|
else ifneq ($(findstring Windows,$(uname)),)
|
|
platform := windows
|
|
delete = del $(subst /,\,$1)
|
|
else ifneq ($(findstring _NT,$(uname)),)
|
|
platform := windows
|
|
delete = del $(subst /,\,$1)
|
|
else ifneq ($(findstring Darwin,$(uname)),)
|
|
platform := macosx
|
|
delete = rm -f $1
|
|
else ifneq ($(findstring Linux,$(uname)),)
|
|
platform := linux
|
|
delete = rm -f $1
|
|
else ifneq ($(findstring BSD,$(uname)),)
|
|
platform := bsd
|
|
delete = rm -f $1
|
|
else
|
|
$(error unknown platform, please specify manually.)
|
|
endif
|
|
endif
|
|
|
|
cflags := -x c -std=c99
|
|
objcflags := -x objective-c -std=c99
|
|
cppflags := -x c++ -std=c++14
|
|
objcppflags := -x objective-c++ -std=c++14
|
|
flags :=
|
|
link :=
|
|
|
|
# compiler detection
|
|
ifeq ($(compiler),)
|
|
ifeq ($(platform),windows)
|
|
compiler := g++
|
|
cppflags := -x c++ -std=gnu++14
|
|
else ifeq ($(platform),macosx)
|
|
compiler := clang++
|
|
else ifeq ($(platform),linux)
|
|
compiler := g++-4.9
|
|
else ifeq ($(platform),bsd)
|
|
compiler := g++49
|
|
else
|
|
compiler := g++
|
|
endif
|
|
endif
|
|
|
|
# clang settings
|
|
ifeq ($(findstring clang++,$(compiler)),clang++)
|
|
flags += -fwrapv
|
|
# gcc settings
|
|
else ifeq ($(findstring g++,$(compiler)),g++)
|
|
flags += -fwrapv
|
|
endif
|
|
|
|
# windows settings
|
|
ifeq ($(platform),windows)
|
|
link := $(link) -lws2_32 -lole32
|
|
endif
|
|
|
|
# macosx settings
|
|
ifeq ($(platform),macosx)
|
|
flags += -stdlib=libc++
|
|
link += -lc++ -lobjc
|
|
endif
|
|
|
|
# bsd settings
|
|
ifeq ($(platform),bsd)
|
|
flags += -I/usr/local/include
|
|
link += -Wl,-rpath=/usr/local/lib
|
|
link += -Wl,-rpath=/usr/local/lib/gcc49
|
|
endif
|
|
|
|
# threading support
|
|
ifeq ($(threaded),true)
|
|
ifneq ($(filter $(platform),linux bsd),)
|
|
flags += -pthread
|
|
link += -lrt
|
|
endif
|
|
endif
|
|
|
|
# cross-compilation support
|
|
ifeq ($(arch),x86)
|
|
flags := -m32 $(flags)
|
|
link := -m32 $(link)
|
|
endif
|
|
|
|
# paths
|
|
prefix := $(HOME)/.local
|
|
|
|
# function rwildcard(directory, pattern)
|
|
rwildcard = \
|
|
$(strip \
|
|
$(filter $(if $2,$2,%), \
|
|
$(foreach f, \
|
|
$(wildcard $1*), \
|
|
$(eval t = $(call rwildcard,$f/)) \
|
|
$(if $t,$t,$f) \
|
|
) \
|
|
) \
|
|
)
|
|
|
|
# function strtr(source, from, to)
|
|
strtr = \
|
|
$(eval __temp := $1) \
|
|
$(strip \
|
|
$(foreach c, \
|
|
$(join $(addsuffix :,$2),$3), \
|
|
$(eval __temp := \
|
|
$(subst $(word 1,$(subst :, ,$c)),$(word 2,$(subst :, ,$c)),$(__temp)) \
|
|
) \
|
|
) \
|
|
$(__temp) \
|
|
)
|
|
|
|
# function strupper(source)
|
|
strupper = $(call strtr,$1,$([a-z]),$([A-Z]))
|
|
|
|
# function strlower(source)
|
|
strlower = $(call strtr,$1,$([A-Z]),$([a-z]))
|
|
|
|
# function strlen(source)
|
|
strlen = \
|
|
$(eval __temp := $(subst $([space]),_,$1)) \
|
|
$(words \
|
|
$(strip \
|
|
$(foreach c, \
|
|
$([all]), \
|
|
$(eval __temp := \
|
|
$(subst $c,$c ,$(__temp)) \
|
|
) \
|
|
) \
|
|
$(__temp) \
|
|
) \
|
|
)
|
|
|
|
# function streq(source)
|
|
streq = $(if $(filter-out xx,x$(subst $1,,$2)$(subst $2,,$1)x),,1)
|
|
|
|
# function strne(source)
|
|
strne = $(if $(filter-out xx,x$(subst $1,,$2)$(subst $2,,$1)x),1,)
|