Makefile additions and part of SDL2.C Pi-GLES define
This commit is contained in:
parent
e154bf4445
commit
dba8760aad
49
Makefile
49
Makefile
|
@ -19,6 +19,8 @@ COMPARE ?= 1
|
||||||
NON_MATCHING ?= 0
|
NON_MATCHING ?= 0
|
||||||
# Build for the N64 (turn this off for ports)
|
# Build for the N64 (turn this off for ports)
|
||||||
TARGET_N64 ?= 0
|
TARGET_N64 ?= 0
|
||||||
|
# Build and optimize for Raspberry Pi(s)
|
||||||
|
TARGET_RPI ?= 0
|
||||||
# Compiler to use (ido or gcc)
|
# Compiler to use (ido or gcc)
|
||||||
COMPILER ?= ido
|
COMPILER ?= ido
|
||||||
|
|
||||||
|
@ -79,7 +81,7 @@ ifeq ($(VERSION),sh)
|
||||||
GRUCODE_ASFLAGS := --defsym F3D_NEW=1
|
GRUCODE_ASFLAGS := --defsym F3D_NEW=1
|
||||||
TARGET := sm64.sh
|
TARGET := sm64.sh
|
||||||
# TODO: GET RID OF THIS!!! We should mandate assets for Shindou like EU but we dont have the addresses extracted yet so we'll just pretend you have everything extracted for now.
|
# TODO: GET RID OF THIS!!! We should mandate assets for Shindou like EU but we dont have the addresses extracted yet so we'll just pretend you have everything extracted for now.
|
||||||
NOEXTRACT := 1
|
NOEXTRACT := 1
|
||||||
else
|
else
|
||||||
$(error unknown version "$(VERSION)")
|
$(error unknown version "$(VERSION)")
|
||||||
endif
|
endif
|
||||||
|
@ -130,6 +132,9 @@ endif
|
||||||
|
|
||||||
ifeq ($(NON_MATCHING),1)
|
ifeq ($(NON_MATCHING),1)
|
||||||
VERSION_CFLAGS := $(VERSION_CFLAGS) -DNON_MATCHING -DAVOID_UB
|
VERSION_CFLAGS := $(VERSION_CFLAGS) -DNON_MATCHING -DAVOID_UB
|
||||||
|
ifeq ($(TARGET_RPI),1) # Define RPi to change SDL2 title & GLES2 hints
|
||||||
|
VERSION_CFLAGS += -DTARGET_RPI
|
||||||
|
endif
|
||||||
VERSION_ASFLAGS := --defsym AVOID_UB=1
|
VERSION_ASFLAGS := --defsym AVOID_UB=1
|
||||||
COMPARE := 0
|
COMPARE := 0
|
||||||
endif
|
endif
|
||||||
|
@ -185,10 +190,17 @@ EXE := $(BUILD_DIR)/$(TARGET).html
|
||||||
else
|
else
|
||||||
ifeq ($(WINDOWS_BUILD),1)
|
ifeq ($(WINDOWS_BUILD),1)
|
||||||
EXE := $(BUILD_DIR)/$(TARGET).exe
|
EXE := $(BUILD_DIR)/$(TARGET).exe
|
||||||
|
|
||||||
|
else #Linux builds here
|
||||||
|
ifeq ($(TARGET_RPI),1)
|
||||||
|
EXE := $(BUILD_DIR)/$(TARGET).arm
|
||||||
else
|
else
|
||||||
EXE := $(BUILD_DIR)/$(TARGET)
|
EXE := $(BUILD_DIR)/$(TARGET)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
ROM := $(BUILD_DIR)/$(TARGET).z64
|
ROM := $(BUILD_DIR)/$(TARGET).z64
|
||||||
ELF := $(BUILD_DIR)/$(TARGET).elf
|
ELF := $(BUILD_DIR)/$(TARGET).elf
|
||||||
LD_SCRIPT := sm64.ld
|
LD_SCRIPT := sm64.ld
|
||||||
|
@ -242,8 +254,32 @@ endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Use a default opt flag for gcc
|
# Use a default opt flag for gcc
|
||||||
ifeq ($(COMPILER),gcc)
|
ifeq ($(NON_MATCHING),1)
|
||||||
OPT_FLAGS := -O2
|
OPT_FLAGS := -O2
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_RPI),1)
|
||||||
|
machine = $(shell sh -c 'uname -m 2>/dev/null || echo unknown')
|
||||||
|
# Raspberry Pi B+, Zero, etc
|
||||||
|
ifneq (,$(findstring armv6l,$(machine)))
|
||||||
|
OPT_FLAGS := -march=armv6zk+fp -mfpu=vfp -Ofast
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Raspberry Pi 2 and 3
|
||||||
|
ifneq (,$(findstring armv7l,$(machine)))
|
||||||
|
model = $(shell sh -c 'cat /sys/firmware/devicetree/base/model 2>/dev/null || echo unknown')
|
||||||
|
|
||||||
|
ifneq (,$(findstring 3,$(model)))
|
||||||
|
OPT_FLAGS := -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -O3
|
||||||
|
else
|
||||||
|
OPT_FLAGS := -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -O3
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# RPi4 / ARM A64 NEEDS TESTING 32BIT.
|
||||||
|
ifneq (,$(findstring aarch64,$(machine)))
|
||||||
|
OPT_FLAGS := -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -O3
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# File dependencies and variables for specific files
|
# File dependencies and variables for specific files
|
||||||
|
@ -466,6 +502,7 @@ CFLAGS := $(OPT_FLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -fn
|
||||||
else ifeq ($(TARGET_WEB),1)
|
else ifeq ($(TARGET_WEB),1)
|
||||||
CC_CHECK := $(CC) -fsyntax-only -fsigned-char $(INCLUDE_CFLAGS) -Wall -Wextra -Wno-format-security $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -s USE_SDL=2
|
CC_CHECK := $(CC) -fsyntax-only -fsigned-char $(INCLUDE_CFLAGS) -Wall -Wextra -Wno-format-security $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -s USE_SDL=2
|
||||||
CFLAGS := $(OPT_FLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -fno-strict-aliasing -fwrapv -s USE_SDL=2
|
CFLAGS := $(OPT_FLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -fno-strict-aliasing -fwrapv -s USE_SDL=2
|
||||||
|
# Linux / Other builds below
|
||||||
else
|
else
|
||||||
CC_CHECK := $(CC) -fsyntax-only -fsigned-char $(INCLUDE_CFLAGS) -Wall -Wextra -Wno-format-security $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) `$(CROSS)sdl2-config --cflags`
|
CC_CHECK := $(CC) -fsyntax-only -fsigned-char $(INCLUDE_CFLAGS) -Wall -Wextra -Wno-format-security $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) `$(CROSS)sdl2-config --cflags`
|
||||||
CFLAGS := $(OPT_FLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -fno-strict-aliasing -fwrapv `$(CROSS)sdl2-config --cflags`
|
CFLAGS := $(OPT_FLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -fno-strict-aliasing -fwrapv `$(CROSS)sdl2-config --cflags`
|
||||||
|
@ -479,9 +516,14 @@ else
|
||||||
ifeq ($(WINDOWS_BUILD),1)
|
ifeq ($(WINDOWS_BUILD),1)
|
||||||
LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -Llib -lpthread -lglew32 `$(CROSS)sdl2-config --static-libs` -lm -lglu32 -lsetupapi -ldinput8 -luser32 -lgdi32 -limm32 -lole32 -loleaut32 -lshell32 -lwinmm -lversion -luuid -lopengl32 -no-pie -static
|
LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -Llib -lpthread -lglew32 `$(CROSS)sdl2-config --static-libs` -lm -lglu32 -lsetupapi -ldinput8 -luser32 -lgdi32 -limm32 -lole32 -loleaut32 -lshell32 -lwinmm -lversion -luuid -lopengl32 -no-pie -static
|
||||||
else
|
else
|
||||||
|
# Linux / Other builds below
|
||||||
|
ifeq ($(TARGET_RPI),1)
|
||||||
|
LDFLAGS := $(OPT_FLAGS) -lm -lGLESv2 `$(CROSS)sdl2-config --libs` -no-pie
|
||||||
|
else
|
||||||
LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -lm -lGL `$(CROSS)sdl2-config --libs` -no-pie -lpthread
|
LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -lm -lGL `$(CROSS)sdl2-config --libs` -no-pie -lpthread
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
endif #Added for Pi ifeq
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -839,7 +881,6 @@ $(EXE): $(O_FILES) $(MIO0_FILES:.mio0=.o) $(SOUND_OBJ_FILES) $(ULTRA_O_FILES) $(
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: all clean distclean default diff test load libultra
|
.PHONY: all clean distclean default diff test load libultra
|
||||||
.PRECIOUS: $(BUILD_DIR)/bin/%.elf $(SOUND_BIN_DIR)/%.ctl $(SOUND_BIN_DIR)/%.tbl $(SOUND_SAMPLE_TABLES) $(SOUND_BIN_DIR)/%.s $(BUILD_DIR)/%
|
.PRECIOUS: $(BUILD_DIR)/bin/%.elf $(SOUND_BIN_DIR)/%.ctl $(SOUND_BIN_DIR)/%.tbl $(SOUND_SAMPLE_TABLES) $(SOUND_BIN_DIR)/%.s $(BUILD_DIR)/%
|
||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
|
|
@ -80,15 +80,28 @@ const SDL_Scancode scancode_rmapping_nonextended[][2] = {
|
||||||
|
|
||||||
static void gfx_sdl_init(void) {
|
static void gfx_sdl_init(void) {
|
||||||
SDL_Init(SDL_INIT_VIDEO);
|
SDL_Init(SDL_INIT_VIDEO);
|
||||||
|
SDL_ShowCursor(SDL_DISABLE); // Removes the cursor from view when upon the game's window.
|
||||||
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
||||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||||
|
|
||||||
|
#ifdef TARGET_RPI
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); // These attributes allow for hardware acceleration on RPis.
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
||||||
|
#endif
|
||||||
|
|
||||||
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
||||||
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
||||||
|
|
||||||
|
#ifndef TARGET_RPI
|
||||||
wnd = SDL_CreateWindow("Super Mario 64 PC-Port", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
wnd = SDL_CreateWindow("Super Mario 64 PC-Port", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||||
DESIRED_SCREEN_WIDTH, DESIRED_SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
|
DESIRED_SCREEN_WIDTH, DESIRED_SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
|
||||||
|
#else
|
||||||
|
wnd = SDL_CreateWindow("Super Mario 64 RPi (GLES2)", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||||
|
DESIRED_SCREEN_WIDTH, DESIRED_SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (configFullscreen)
|
if (configFullscreen)
|
||||||
{
|
{
|
||||||
|
@ -204,4 +217,4 @@ struct GfxWindowManagerAPI gfx_sdl = {
|
||||||
gfx_sdl_swap_buffers_begin,
|
gfx_sdl_swap_buffers_begin,
|
||||||
gfx_sdl_swap_buffers_end,
|
gfx_sdl_swap_buffers_end,
|
||||||
gfx_sdl_get_time
|
gfx_sdl_get_time
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user