Merge pull request #6014 from aliaspider/master

(WIIU) updates.
This commit is contained in:
Twinaphex 2017-12-31 14:32:40 +01:00 committed by GitHub
commit e5f986d16d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 309 additions and 516 deletions

View File

@ -1,18 +1,29 @@
TARGET := retroarch_wiiu
BUILD_HBL_ELF = 1
BUILD_RPX = 1
DEBUG = 0
GRIFFIN_BUILD = 0
WHOLE_ARCHIVE_LINK = 0
HAVE_HID = 1
BUILD_HBL_ELF = 1
BUILD_RPX = 1
DEBUG = 0
GRIFFIN_BUILD = 0
SALAMANDER_BUILD = 0
WHOLE_ARCHIVE_LINK = 0
HAVE_HID = 1
BUILD_DIR = objs/wiiu
PC_DEVELOPMENT_IP_ADDRESS ?=
PC_DEVELOPMENT_TCP_PORT ?=
ifeq ($(SALAMANDER_BUILD),1)
BUILD_DIR := $(BUILD_DIR)-salamander
TARGET := $(TARGET)_salamander
endif
ifeq ($(DEBUG),1)
BUILD_DIR := $(BUILD_DIR)-debug
endif
ifneq ($(V), 1)
Q := @
endif
PC_DEVELOPMENT_IP_ADDRESS ?=192.168.29.137
PC_DEVELOPMENT_TCP_PORT ?=4405
OBJ :=
OBJ += wiiu/input/wiiu_hid.o
OBJ += wiiu/input/wpad_driver.o
@ -21,82 +32,107 @@ OBJ += wiiu/input/hidpad_driver.o
OBJ += wiiu/input/pad_functions.o
OBJ += wiiu/system/memory.o
OBJ += wiiu/system/exception_handler.o
OBJ += wiiu/system/missing_libc_functions.o
OBJ += wiiu/fs/sd_fat_devoptab.o
OBJ += wiiu/fs/fs_utils.o
OBJ += wiiu/tex_shader.o
OBJ += wiiu/hbl.o
ifeq ($(ENABLE_CONTROLLER_PATCHER), 1)
OBJ += wiiu/controller_patcher/ControllerPatcher.o
OBJ += wiiu/controller_patcher/ControllerPatcherWrapper.o
OBJ += wiiu/controller_patcher/ConfigReader.o
OBJ += wiiu/controller_patcher/config/ConfigParser.o
OBJ += wiiu/controller_patcher/config/ConfigValues.o
OBJ += wiiu/controller_patcher/network/ControllerPatcherNet.o
OBJ += wiiu/controller_patcher/network/TCPServer.o
OBJ += wiiu/controller_patcher/network/UDPClient.o
OBJ += wiiu/controller_patcher/network/UDPServer.o
OBJ += wiiu/controller_patcher/patcher/ControllerPatcherUtils.o
OBJ += wiiu/controller_patcher/patcher/ControllerPatcherHID.o
OBJ += wiiu/controller_patcher/utils/CPRetainVars.o
OBJ += wiiu/controller_patcher/utils/CPStringTools.o
OBJ += wiiu/controller_patcher/utils/PadConst.o
OBJ += wiiu/controller_patcher/utils/FSHelper.o
endif
DEFINES :=
ifeq ($(GRIFFIN_BUILD), 1)
OBJ += griffin/griffin.o
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_RGUI -DHAVE_LIBRETRODB
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -DHAVE_CC_RESAMPLER
DEFINES += -DHAVE_STB_FONT -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DHAVE_LIBRETRODB -DHAVE_NETWORKING
# DEFINES += -DWANT_IFADDRS
# DEFINES += -DHAVE_FREETYPE
DEFINES += -DHAVE_XMB -DHAVE_MATERIALUI
ifeq ($(SALAMANDER_BUILD),1)
DEFINES += -DRARCH_CONSOLE -DIS_SALAMANDER
OBJ += frontend/frontend_salamander.o
OBJ += frontend/frontend_driver.o
OBJ += frontend/drivers/platform_wiiu.o
OBJ += frontend/drivers/platform_null.o
OBJ += libretro-common/encodings/encoding_utf.o
OBJ += libretro-common/compat/compat_strcasestr.o
OBJ += libretro-common/file/file_path.o
OBJ += libretro-common/string/stdstring.o
OBJ += libretro-common/lists/string_list.o
OBJ += libretro-common/lists/dir_list.o
OBJ += libretro-common/file/retro_dirent.o
OBJ += libretro-common/compat/compat_strl.o
OBJ += libretro-common/file/config_file.o
OBJ += libretro-common/streams/file_stream.o
OBJ += libretro-common/vfs/vfs_implementation.o
OBJ += libretro-common/hash/rhash.o
OBJ += file_path_str.o
OBJ += verbosity.o
else
HAVE_MENU_COMMON = 1
HAVE_RTGA = 1
HAVE_RPNG = 1
HAVE_RJPEG = 1
HAVE_RBMP = 1
HAVE_RGUI = 1
HAVE_ZLIB = 1
HAVE_7ZIP = 1
HAVE_BUILTINZLIB = 1
HAVE_KEYMAPPER = 1
HAVE_LIBRETRODB = 1
HAVE_ZARCH = 0
HAVE_MATERIALUI = 1
HAVE_XMB = 1
HAVE_STB_FONT = 1
# HAVE_FREETYPE = 1
HAVE_LANGEXTRA = 1
HAVE_LIBRETRODB = 1
HAVE_NETWORKING = 1
HAVE_CHEEVOS = 1
# WANT_IFADDRS = 1
HAVE_OVERLAY = 1
HAVE_STATIC_VIDEO_FILTERS = 1
HAVE_STATIC_AUDIO_FILTERS = 1
WANT_LIBFAT = 1
WANT_IOSUHAX = 1
DEFINES += -DRARCH_INTERNAL
DEFINES += -DHAVE_KEYMAPPER
DEFINES += -DHAVE_UPDATE_ASSETS
DEFINES += -DHAVE_FILTERS_BUILTIN
include Makefile.common
BLACKLIST := $(LIBRETRO_COMM_DIR)/net/net_ifinfo.o
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
OBJ += wiiu/system/missing_libc_functions.o
OBJ += wiiu/tex_shader.o
OBJ += gfx/drivers/wiiu_gfx.o
OBJ += gfx/drivers_font/wiiu_font.o
OBJ += menu/drivers_display/menu_display_wiiu.o
OBJ += input/drivers/wiiu_input.o
OBJ += input/drivers_joypad/wiiu_joypad.o
OBJ += audio/drivers/wiiu_audio.o
OBJ += frontend/drivers/platform_wiiu.o
ifeq ($(GRIFFIN_BUILD), 1)
OBJ += griffin/griffin.o
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_RGUI -DHAVE_LIBRETRODB
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -DHAVE_CC_RESAMPLER
DEFINES += -DHAVE_STB_FONT -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DHAVE_LIBRETRODB -DHAVE_NETWORKING
# DEFINES += -DWANT_IFADDRS
# DEFINES += -DHAVE_FREETYPE
DEFINES += -DHAVE_XMB -DHAVE_MATERIALUI
else
HAVE_MENU_COMMON = 1
HAVE_RTGA = 1
HAVE_RPNG = 1
HAVE_RJPEG = 1
HAVE_RBMP = 1
HAVE_RGUI = 1
HAVE_ZLIB = 1
HAVE_7ZIP = 1
HAVE_BUILTINZLIB = 1
HAVE_KEYMAPPER = 1
HAVE_LIBRETRODB = 1
HAVE_ZARCH = 0
HAVE_MATERIALUI = 1
HAVE_XMB = 1
HAVE_STB_FONT = 1
# HAVE_FREETYPE = 1
HAVE_LANGEXTRA = 1
HAVE_LIBRETRODB = 1
HAVE_NETWORKING = 1
HAVE_CHEEVOS = 1
# WANT_IFADDRS = 1
HAVE_OVERLAY = 1
HAVE_STATIC_VIDEO_FILTERS = 1
HAVE_STATIC_AUDIO_FILTERS = 1
WANT_LIBFAT = 1
WANT_IOSUHAX = 1
include Makefile.common
BLACKLIST := $(LIBRETRO_COMM_DIR)/net/net_ifinfo.o
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
OBJ += gfx/drivers/wiiu_gfx.o
OBJ += gfx/drivers_font/wiiu_font.o
OBJ += menu/drivers_display/menu_display_wiiu.o
OBJ += input/drivers/wiiu_input.o
OBJ += input/drivers_joypad/wiiu_joypad.o
OBJ += audio/drivers/wiiu_audio.o
OBJ += frontend/drivers/platform_wiiu.o
endif
endif
DEFINES += -DHAVE_KEYMAPPER
OBJ := $(addprefix $(BUILD_DIR)/,$(OBJ))
#todo: remove -DWIIU and use the built-in macros instead (HW_WUP or __wiiu__).
DEFINES += -DWIIU -DMSB_FIRST -D__WUT__
#DEFINES += -D_GNU_SOURCE
DEFINES += -DHAVE_MAIN
DEFINES += -DRARCH_CONSOLE
ifneq ($(PC_DEVELOPMENT_IP_ADDRESS),)
DEFINES += -DPC_DEVELOPMENT_IP_ADDRESS='"$(PC_DEVELOPMENT_IP_ADDRESS)"'
endif
ifneq ($(PC_DEVELOPMENT_TCP_PORT),)
DEFINES += -DPC_DEVELOPMENT_TCP_PORT=$(PC_DEVELOPMENT_TCP_PORT)
endif
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
@ -126,7 +162,6 @@ else
ELF2RPL := $(ELF2RPL).exe
endif
INCDIRS := -I. -Ideps -Ideps/stb -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Iwiiu -Iwiiu/include -I$(DEVKITPRO)/portlibs/ppc/include
LIBDIRS := -L. -L$(DEVKITPRO)/portlibs/ppc/lib
@ -138,6 +173,7 @@ ifeq ($(DEBUG), 1)
else
CFLAGS += -O3
endif
LDFLAGS := $(CFLAGS)
ASFLAGS := $(CFLAGS) -mregnames
@ -146,29 +182,12 @@ CFLAGS += -ffast-math -Werror=implicit-function-declaration
#CFLAGS += -fomit-frame-pointer -mword-relocations
#CFLAGS += -Wall
#todo: remove -DWIIU and use the built-in macros instead (HW_WUP or __wiiu__).
CFLAGS += -DWIIU -DMSB_FIRST -D__WUT__
CFLAGS += -DHAVE_MAIN
CFLAGS += -DHAVE_UPDATE_ASSETS
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE
ifeq ($(ENABLE_CONTROLLER_PATCHER), 1)
CFLAGS += -DENABLE_CONTROLLER_PATCHER
endif
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)
ifneq ($(PC_DEVELOPMENT_IP_ADDRESS),)
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS='"$(PC_DEVELOPMENT_IP_ADDRESS)"'
endif
ifneq ($(PC_DEVELOPMENT_TCP_PORT),)
CFLAGS += -DPC_DEVELOPMENT_TCP_PORT=$(PC_DEVELOPMENT_TCP_PORT)
endif
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_START := -Wl,--whole-archive
WHOLE_END := -Wl,--no-whole-archive
endif
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -D_GNU_SOURCE
CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions
LDFLAGS += -Wl,--gc-sections
@ -183,8 +202,8 @@ LIBS += -liosuhax
endif
RPX_OBJ = wiiu/system/stubs_rpl.o
HBL_ELF_OBJ = wiiu/system/dynamic.o wiiu/system/stubs_elf.o
RPX_OBJ = $(BUILD_DIR)/wiiu/system/stubs_rpl.o
HBL_ELF_OBJ = $(BUILD_DIR)/wiiu/system/dynamic.o $(BUILD_DIR)/wiiu/system/stubs_elf.o
RPX_LDFLAGS := -pie -fPIE
RPX_LDFLAGS += -z common-page-size=64 -z max-page-size=64
@ -202,64 +221,67 @@ ifeq ($(BUILD_HBL_ELF), 1)
TARGETS += $(TARGET).elf
endif
DEPFLAGS = -MT $@ -MMD -MP -MF $*.Tdepend
POSTCOMPILE = mv -f $*.Tdepend $*.depend
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.depend
all: $(TARGETS)
%.o: %.cpp
%.o: %.cpp %.depend
%: $(BUILD_DIR)/%
cp $< $@
$(BUILD_DIR)/%.o: %.cpp %.depend
@$(if $(Q), echo CXX $<,)
$(Q)$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS) $(DEPFLAGS)
$(Q)$(POSTCOMPILE)
@mkdir -p $(dir $@)
$(Q)$(CXX) -c -o $@ $< $(CXXFLAGS) $(DEFINES) $(INCDIRS) $(DEPFLAGS)
%.o: %.c
%.o: %.c %.depend
$(BUILD_DIR)/%.o: %.c %.depend
@$(if $(Q), echo CC $<,)
$(Q)$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) $(DEPFLAGS)
$(Q)$(POSTCOMPILE)
@mkdir -p $(dir $@)
$(Q)$(CC) -c -o $@ $< $(CFLAGS) $(DEFINES) $(INCDIRS) $(DEPFLAGS)
%.o: %.S
%.o: %.S %.depend
$(BUILD_DIR)/%.o: %.S %.depend
@$(if $(Q), echo AS $<,)
$(Q)$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
$(Q)$(POSTCOMPILE)
@mkdir -p $(dir $@)
$(Q)$(CC) -c -o $@ $< $(ASFLAGS) $(DEFINES) $(INCDIRS) $(DEPFLAGS)
%.o: %.s
%.o: %.s %.depend
$(BUILD_DIR)/%.o: %.s %.depend
@$(if $(Q), echo AS $<,)
@mkdir -p $(dir $@)
$(Q)$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
$(Q)$(POSTCOMPILE)
%.a:
@$(if $(Q), echo AR $<,)
@mkdir -p $(dir $@)
$(Q)$(AR) -rc $@ $^
%.depend: ;
%.last: ;
$(ELF2RPL):
@$(if $(Q), echo MAKE $@,)
$(Q)$(MAKE) -C wiiu/wut/elf2rpl/
$(TARGET).elf: $(OBJ) $(HBL_ELF_OBJ) libretro_wiiu.a wiiu/link_elf.ld
$(BUILD_DIR)/$(TARGET).elf: $(OBJ) $(HBL_ELF_OBJ) libretro_wiiu.a wiiu/link_elf.ld .$(TARGET).elf.last
@$(if $(Q), echo LD $@,)
@touch .$(TARGET).elf.last
$(Q)$(LD) $(OBJ) $(HBL_ELF_OBJ) $(LDFLAGS) $(HBL_ELF_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
$(TARGET).rpx.elf: $(OBJ) $(RPX_OBJ) libretro_wiiu.a wiiu/link_elf.ld
$(BUILD_DIR)/$(TARGET).rpx.elf: $(OBJ) $(RPX_OBJ) libretro_wiiu.a wiiu/link_elf.ld
@$(if $(Q), echo LD $@,)
$(Q)$(LD) $(OBJ) $(RPX_OBJ) $(LDFLAGS) $(RPX_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
$(TARGET).rpx: $(TARGET).rpx.elf $(ELF2RPL)
$(BUILD_DIR)/$(TARGET).rpx: $(BUILD_DIR)/$(TARGET).rpx.elf $(ELF2RPL) .$(TARGET).rpx.last
@$(if $(Q), echo ELF2RPL $@,)
$(Q)-$(ELF2RPL) $(TARGET).rpx.elf $@
@touch .$(TARGET).rpx.last
$(Q)-$(ELF2RPL) $< $@
clean:
rm -f $(OBJ) $(RPX_OBJ) $(HBL_ELF_OBJ) $(TARGET).elf $(TARGET).rpx.elf $(TARGET).rpx
rm -f $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).rpx.elf $(BUILD_DIR)/$(TARGET).rpx
rm -f .$(TARGET).elf.last .$(TARGET).rpx.elf.last .$(TARGET).rpx.last
rm -f $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)
.PHONY: clean all
.PRECIOUS: %.depend
.PRECIOUS: %.depend %.last
-include $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)

View File

@ -1,177 +0,0 @@
TARGET := retroarch_wiiu_salamander
BUILD_HBL_ELF = 1
BUILD_RPX = 1
DEBUG = 0
PC_DEVELOPMENT_IP_ADDRESS =
PC_DEVELOPMENT_TCP_PORT =
OBJ :=
OBJ += wiiu/system/memory.o
OBJ += wiiu/system/exception_handler.o
OBJ += wiiu/fs/sd_fat_devoptab.o
OBJ += wiiu/fs/fs_utils.o
OBJ += wiiu/hbl.o
OBJ += frontend/frontend_salamander.o
OBJ += frontend/frontend_driver.o
OBJ += frontend/drivers/platform_wiiu.o
OBJ += frontend/drivers/platform_null.o
OBJ += libretro-common/encodings/encoding_utf.o
OBJ += libretro-common/compat/compat_strcasestr.o
OBJ += libretro-common/file/file_path.o
OBJ += libretro-common/string/stdstring.o
OBJ += libretro-common/lists/string_list.o
OBJ += libretro-common/lists/dir_list.o
OBJ += libretro-common/file/retro_dirent.o
OBJ += libretro-common/compat/compat_strl.o
OBJ += libretro-common/file/config_file.o
OBJ += libretro-common/streams/file_stream.o
OBJ += libretro-common/vfs/vfs_implementation.o
OBJ += libretro-common/hash/rhash.o
OBJ += file_path_str.o
OBJ += verbosity.o
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPRO")
endif
export PATH := $(PATH):$(DEVKITPPC)/bin
PREFIX := powerpc-eabi-
CC := $(PREFIX)gcc
CXX := $(PREFIX)g++
AS := $(PREFIX)as
AR := $(PREFIX)ar
OBJCOPY := $(PREFIX)objcopy
STRIP := $(PREFIX)strip
NM := $(PREFIX)nm
LD := $(CXX)
ELF2RPL := wiiu/wut/elf2rpl/elf2rpl
ifneq ($(findstring Linux,$(shell uname -a)),)
else ifneq ($(findstring Darwin,$(shell uname -a)),)
else
ELF2RPL := $(ELF2RPL).exe
endif
INCDIRS := -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Iwiiu -Iwiiu/include -I$(DEVKITPRO)/portlibs/ppc/include
LIBDIRS := -L. -L$(DEVKITPRO)/portlibs/ppc/lib
CFLAGS := -mwup -mcpu=750 -meabi -mhard-float
LDFLAGS :=
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
else
CFLAGS += -O3
endif
LDFLAGS := $(CFLAGS)
ASFLAGS := $(CFLAGS) -mregnames
CFLAGS += -ffast-math -Werror=implicit-function-declaration
#CFLAGS += -fomit-frame-pointer -mword-relocations
#CFLAGS += -Wall
#todo: remove -DWIIU and use the built-in macros instead (HW_WUP or __wiiu__).
CFLAGS += -DWIIU -DMSB_FIRST
CFLAGS += -DHAVE_MAIN
CFLAGS += -DRARCH_CONSOLE -DIS_SALAMANDER
ifneq ($(PC_DEVELOPMENT_IP_ADDRESS),)
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS='"$(PC_DEVELOPMENT_IP_ADDRESS)"'
endif
ifneq ($(PC_DEVELOPMENT_TCP_PORT),)
CFLAGS += -DPC_DEVELOPMENT_TCP_PORT=$(PC_DEVELOPMENT_TCP_PORT)
endif
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_START := -Wl,--whole-archive
WHOLE_END := -Wl,--no-whole-archive
endif
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
LDFLAGS += -Wl,--gc-sections
LIBS := $(WHOLE_START) -lretro_wiiu $(WHOLE_END) -lm -lfat -liosuhax
RPX_OBJ = wiiu/system/stubs_rpl.o
HBL_ELF_OBJ = wiiu/system/dynamic.o wiiu/system/stubs_elf.o
RPX_LDFLAGS := -pie -fPIE
RPX_LDFLAGS += -z common-page-size=64 -z max-page-size=64
RPX_LDFLAGS += -T wiiu/link_rpl.ld
RPX_LDFLAGS += -nostartfiles
HBL_ELF_LDFLAGS := -T wiiu/link_elf.ld
TARGETS :=
ifeq ($(BUILD_RPX), 1)
TARGETS += $(TARGET).rpx
endif
ifeq ($(BUILD_HBL_ELF), 1)
TARGETS += $(TARGET).elf
endif
DEPFLAGS = -MT $@ -MMD -MP -MF $*.Tdepend
POSTCOMPILE = mv -f $*.Tdepend $*.depend
all: $(TARGETS)
%.o: %.cpp
%.o: %.cpp %.depend
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS) $(DEPFLAGS)
$(POSTCOMPILE)
%.o: %.c
%.o: %.c %.depend
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) $(DEPFLAGS)
$(POSTCOMPILE)
%.o: %.S
%.o: %.S %.depend
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
$(POSTCOMPILE)
%.o: %.s
%.o: %.s %.depend
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
$(POSTCOMPILE)
%.a:
$(AR) -rc $@ $^
%.depend: ;
$(ELF2RPL):
$(MAKE) -C wiiu/wut/elf2rpl/
$(TARGET).elf: $(OBJ) $(HBL_ELF_OBJ) libretro_wiiu.a wiiu/link_elf.ld
$(LD) $(OBJ) $(HBL_ELF_OBJ) $(LDFLAGS) $(HBL_ELF_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
$(TARGET).rpx.elf: $(OBJ) $(RPX_OBJ) libretro_wiiu.a wiiu/link_elf.ld
$(LD) $(OBJ) $(RPX_OBJ) $(LDFLAGS) $(RPX_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
$(TARGET).rpx: $(TARGET).rpx.elf $(ELF2RPL)
-$(ELF2RPL) $(TARGET).rpx.elf $@
clean:
rm -f $(OBJ) $(RPX_OBJ) $(HBL_ELF_OBJ) $(TARGET).elf $(TARGET).rpx.elf $(TARGET).rpx
rm -f $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)
.PHONY: clean all
.PRECIOUS: %.depend
-include $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)

View File

@ -179,7 +179,7 @@ static int fs_dev_open_r (struct _reent *r, void *fileStruct, const char *path,
}
static int fs_dev_close_r (struct _reent *r, int fd)
static int fs_dev_close_r (struct _reent *r, void *fd)
{
fs_dev_file_state_t *file = (fs_dev_file_state_t *)fd;
if(!file->dev) {
@ -201,7 +201,7 @@ static int fs_dev_close_r (struct _reent *r, int fd)
return 0;
}
static off_t fs_dev_seek_r (struct _reent *r, int fd, off_t pos, int dir)
static off_t fs_dev_seek_r (struct _reent *r, void* fd, off_t pos, int dir)
{
fs_dev_file_state_t *file = (fs_dev_file_state_t *)fd;
if(!file->dev) {
@ -239,7 +239,7 @@ static off_t fs_dev_seek_r (struct _reent *r, int fd, off_t pos, int dir)
return result;
}
static ssize_t fs_dev_write_r (struct _reent *r, int fd, const char *ptr, size_t len)
static ssize_t fs_dev_write_r (struct _reent *r, void *fd, const char *ptr, size_t len)
{
fs_dev_file_state_t *file = (fs_dev_file_state_t *)fd;
if(!file->dev) {
@ -284,7 +284,7 @@ static ssize_t fs_dev_write_r (struct _reent *r, int fd, const char *ptr, size_t
return done;
}
static ssize_t fs_dev_read_r (struct _reent *r, int fd, char *ptr, size_t len)
static ssize_t fs_dev_read_r (struct _reent *r, void *fd, char *ptr, size_t len)
{
fs_dev_file_state_t *file = (fs_dev_file_state_t *)fd;
if(!file->dev) {
@ -330,7 +330,7 @@ static ssize_t fs_dev_read_r (struct _reent *r, int fd, char *ptr, size_t len)
}
static int fs_dev_fstat_r (struct _reent *r, int fd, struct stat *st)
static int fs_dev_fstat_r (struct _reent *r, void *fd, struct stat *st)
{
fs_dev_file_state_t *file = (fs_dev_file_state_t *)fd;
if(!file->dev) {
@ -344,7 +344,7 @@ static int fs_dev_fstat_r (struct _reent *r, int fd, struct stat *st)
memset(st, 0, sizeof(struct stat));
fileStat_s stats;
int result = IOSUHAX_FSA_StatFile(file->dev->fsaFd, fd, &stats);
int result = IOSUHAX_FSA_StatFile(file->dev->fsaFd, (int)fd, &stats);
if(result != 0) {
r->_errno = result;
OSUnlockMutex(file->dev->pMutex);
@ -368,7 +368,7 @@ static int fs_dev_fstat_r (struct _reent *r, int fd, struct stat *st)
return 0;
}
static int fs_dev_ftruncate_r (struct _reent *r, int fd, off_t len)
static int fs_dev_ftruncate_r (struct _reent *r, void *fd, off_t len)
{
fs_dev_file_state_t *file = (fs_dev_file_state_t *)fd;
if(!file->dev) {
@ -381,7 +381,7 @@ static int fs_dev_ftruncate_r (struct _reent *r, int fd, off_t len)
return -1;
}
static int fs_dev_fsync_r (struct _reent *r, int fd)
static int fs_dev_fsync_r (struct _reent *r, void *fd)
{
fs_dev_file_state_t *file = (fs_dev_file_state_t *)fd;
if(!file->dev) {

View File

@ -15,8 +15,8 @@ cp *.info ../pkg/wiiu/retroarch/cores/info/
mkdir -p ../pkg/wiiu/rpx/retroarch/cores/info
cp *.info ../pkg/wiiu/rpx/retroarch/cores/info/
make -C ../ -f Makefile.${platform}.salamander clean || exit 1
make -C ../ -f Makefile.${platform}.salamander BUILD_HBL_ELF=1 BUILD_RPX=1 -j3 || exit 1
make -C ../ -f Makefile.${platform} SALAMANDER_BUILD=1 clean || exit 1
make -C ../ -f Makefile.${platform} SALAMANDER_BUILD=1 BUILD_HBL_ELF=1 BUILD_RPX=1 -j3 || exit 1
mkdir -p ../pkg/wiiu/wiiu/apps/retroarch
mv -f ../retroarch_wiiu_salamander.elf ../pkg/wiiu/wiiu/apps/retroarch/retroarch.elf

View File

@ -18,7 +18,7 @@
#define GX2_COMP_SEL(c0, c1, c2, c3) (((c0) << 24) | ((c1) << 16) | ((c2) << 8) | (c3))
#define COLOR_ABGR(r, g, b, a) (((u32)(a) << 24) | ((u32)(b) << 16) | ((u32)(g) << 8) | ((u32)(r) << 0))
#define COLOR_RGBA(r, g, b, a) (((u32)(a) << 24) | ((u32)(r) << 16) | ((u32)(g) << 8) | ((u32)(b) << 0))
#define COLOR_ARGB(r, g, b, a) (((u32)(a) << 24) | ((u32)(r) << 16) | ((u32)(g) << 8) | ((u32)(b) << 0))
#define COLOR_RGBA(r, g, b, a) (((u32)(r) << 24) | ((u32)(g) << 16) | ((u32)(b) << 8) | ((u32)(a) << 0))
//#define GX2_CAN_ACCESS_DATA_SECTION
@ -30,24 +30,10 @@ typedef struct
GX2TVRenderMode mode;
} wiiu_render_mode_t;
typedef struct
{
float x;
float y;
} position_t;
typedef struct
{
float u;
float v;
} tex_coord_t;
struct gx2_overlay_data
{
GX2Texture tex;
float tex_coord[8];
float vertex_coord[8];
u32 color[4];
tex_shader_vertex_t v[4];
float alpha_mod;
};
@ -60,9 +46,7 @@ typedef struct
int width;
int height;
bool enable;
position_t* position;
tex_coord_t* tex_coord;
u32* color;
tex_shader_vertex_t* v;
} menu;
#ifdef HAVE_OVERLAY
@ -75,17 +59,13 @@ typedef struct
GX2Sampler sampler_nearest;
GX2Sampler sampler_linear;
GX2Texture texture;
position_t* position;
tex_coord_t* tex_coord;
u32* color;
tex_shader_vertex_t* v;
int width;
int height;
struct
{
position_t* positions;
tex_coord_t* tex_coords;
u32* colors;
tex_shader_vertex_t* v;
int size;
int current;
} vertex_cache;

View File

@ -51,31 +51,28 @@ static const wiiu_render_mode_t wiiu_render_mode_map[] =
{1920, 1080, GX2_TV_RENDER_MODE_WIDE_1080P} /* GX2_TV_SCAN_MODE_1080P */
};
static void wiiu_set_position(position_t* position, GX2ColorBuffer* draw_buffer, float x0, float y0, float x1, float y1)
static void wiiu_set_position(tex_shader_vertex_t* v, GX2ColorBuffer* draw_buffer, float x0, float y0, float x1, float y1)
{
position[0].x = (2.0f * x0 / draw_buffer->surface.width) - 1.0f;
position[0].y = (2.0f * y0 / draw_buffer->surface.height) - 1.0f;
position[1].x = (2.0f * x1 / draw_buffer->surface.width) - 1.0f;;
position[1].y = (2.0f * y0 / draw_buffer->surface.height) - 1.0f;
position[2].x = (2.0f * x1 / draw_buffer->surface.width) - 1.0f;;
position[2].y = (2.0f * y1 / draw_buffer->surface.height) - 1.0f;
position[3].x = (2.0f * x0 / draw_buffer->surface.width) - 1.0f;;
position[3].y = (2.0f * y1 / draw_buffer->surface.height) - 1.0f;
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, position, 4 * sizeof(*position));
v[0].pos.x = (2.0f * x0 / draw_buffer->surface.width) - 1.0f;
v[0].pos.y = (2.0f * y0 / draw_buffer->surface.height) - 1.0f;
v[1].pos.x = (2.0f * x1 / draw_buffer->surface.width) - 1.0f;;
v[1].pos.y = (2.0f * y0 / draw_buffer->surface.height) - 1.0f;
v[2].pos.x = (2.0f * x1 / draw_buffer->surface.width) - 1.0f;;
v[2].pos.y = (2.0f * y1 / draw_buffer->surface.height) - 1.0f;
v[3].pos.x = (2.0f * x0 / draw_buffer->surface.width) - 1.0f;;
v[3].pos.y = (2.0f * y1 / draw_buffer->surface.height) - 1.0f;
}
static void wiiu_set_tex_coords(tex_coord_t* tex_coord, GX2Texture* texture, float u0, float v0, float u1, float v1, unsigned rotation)
static void wiiu_set_tex_coords(tex_shader_vertex_t* v, GX2Texture* texture, float u0, float v0, float u1, float v1, unsigned rotation)
{
tex_coord[((0 + rotation) % 4)].u = u0 / texture->surface.width;
tex_coord[((0 + rotation) % 4)].v = (v1 / texture->surface.height);
tex_coord[((1 + rotation) % 4)].u = u1 / texture->surface.width;
tex_coord[((1 + rotation) % 4)].v = (v1 / texture->surface.height);
tex_coord[((2 + rotation) % 4)].u = u1 / texture->surface.width;
tex_coord[((2 + rotation) % 4)].v = (v0 / texture->surface.height);
tex_coord[((3 + rotation) % 4)].u = u0 / texture->surface.width;
tex_coord[((3 + rotation) % 4)].v = (v0 / texture->surface.height);
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, tex_coord, 4 * sizeof(*tex_coord));
v[((0 + rotation) % 4)].coord.u = u0 / texture->surface.width;
v[((0 + rotation) % 4)].coord.v = (v1 / texture->surface.height);
v[((1 + rotation) % 4)].coord.u = u1 / texture->surface.width;
v[((1 + rotation) % 4)].coord.v = (v1 / texture->surface.height);
v[((2 + rotation) % 4)].coord.u = u1 / texture->surface.width;
v[((2 + rotation) % 4)].coord.v = (v0 / texture->surface.height);
v[((3 + rotation) % 4)].coord.u = u0 / texture->surface.width;
v[((3 + rotation) % 4)].coord.v = (v0 / texture->surface.height);
}
static void wiiu_gfx_update_viewport(wiiu_video_t* wiiu)
@ -151,7 +148,7 @@ static void wiiu_gfx_update_viewport(wiiu_video_t* wiiu)
float scale_w = wiiu->color_buffer.surface.width / wiiu->render_mode.width;
float scale_h = wiiu->color_buffer.surface.height / wiiu->render_mode.height;
wiiu_set_position(wiiu->position, &wiiu->color_buffer,
wiiu_set_position(wiiu->v, &wiiu->color_buffer,
wiiu->vp.x * scale_w,
wiiu->vp.y * scale_h,
(wiiu->vp.x + wiiu->vp.width) * scale_w,
@ -316,39 +313,32 @@ static void* wiiu_gfx_init(const video_info_t* video,
GX2SetPixelShader(&wiiu->shader->ps);
GX2SetFetchShader(&wiiu->shader->fs);
wiiu->position = MEM2_alloc(4 * sizeof(*wiiu->position), GX2_VERTEX_BUFFER_ALIGNMENT);
wiiu_set_position(wiiu->position, &wiiu->color_buffer, 0, 0,
wiiu->v = MEM2_alloc(4 * sizeof(*wiiu->v), GX2_VERTEX_BUFFER_ALIGNMENT);
wiiu_set_position(wiiu->v, &wiiu->color_buffer, 0, 0,
wiiu->color_buffer.surface.width, wiiu->color_buffer.surface.height);
wiiu->tex_coord = MEM2_alloc(4 * sizeof(*wiiu->tex_coord), GX2_VERTEX_BUFFER_ALIGNMENT);
wiiu_set_tex_coords(wiiu->tex_coord, &wiiu->texture, 0, 0,
wiiu_set_tex_coords(wiiu->v, &wiiu->texture, 0, 0,
wiiu->texture.surface.width, wiiu->texture.surface.height, wiiu->rotation);
wiiu->color = MEM2_alloc(4 * sizeof(*wiiu->color), GX2_VERTEX_BUFFER_ALIGNMENT);
wiiu->color[0] = 0xFFFFFFFF;
wiiu->color[1] = 0xFFFFFFFF;
wiiu->color[2] = 0xFFFFFFFF;
wiiu->color[3] = 0xFFFFFFFF;
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->color, 4 * sizeof(*wiiu->color));
wiiu->v[0].color = 0xFFFFFFFF;
wiiu->v[1].color = 0xFFFFFFFF;
wiiu->v[2].color = 0xFFFFFFFF;
wiiu->v[3].color = 0xFFFFFFFF;
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->position), sizeof(*wiiu->position), wiiu->position);
GX2SetAttribBuffer(1, 4 * sizeof(*wiiu->tex_coord), sizeof(*wiiu->tex_coord), wiiu->tex_coord);
GX2SetAttribBuffer(2, 4 * sizeof(*wiiu->color), sizeof(*wiiu->color), wiiu->color);
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->v, 4 * sizeof(*wiiu->v));
wiiu->menu.position = MEM2_alloc(4 * sizeof(*wiiu->menu.position), GX2_VERTEX_BUFFER_ALIGNMENT);
wiiu_set_position(wiiu->menu.position, &wiiu->color_buffer, 0, 0,
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->v), sizeof(*wiiu->v), wiiu->v);
wiiu->menu.v = MEM2_alloc(4 * sizeof(*wiiu->menu.v), GX2_VERTEX_BUFFER_ALIGNMENT);
wiiu_set_position(wiiu->menu.v, &wiiu->color_buffer, 0, 0,
wiiu->color_buffer.surface.width, wiiu->color_buffer.surface.height);
wiiu->menu.tex_coord = MEM2_alloc(4 * sizeof(*wiiu->menu.tex_coord), GX2_VERTEX_BUFFER_ALIGNMENT);
wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0,
wiiu_set_tex_coords(wiiu->menu.v, &wiiu->menu.texture, 0, 0,
wiiu->menu.texture.surface.width, wiiu->menu.texture.surface.height, 0);
wiiu->menu.color = MEM2_alloc(4 * sizeof(*wiiu->menu.color), GX2_VERTEX_BUFFER_ALIGNMENT);
wiiu->menu.color[0] = 0xFFFFFF80;
wiiu->menu.color[1] = 0xFFFFFF80;
wiiu->menu.color[2] = 0xFFFFFF80;
wiiu->menu.color[3] = 0xFFFFFF80;
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->menu.color, 4 * sizeof(*wiiu->menu.color));
wiiu->menu.v[0].color = 0xFFFFFF80;
wiiu->menu.v[1].color = 0xFFFFFF80;
wiiu->menu.v[2].color = 0xFFFFFF80;
wiiu->menu.v[3].color = 0xFFFFFF80;
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->menu.v, 4 * sizeof(*wiiu->menu.v));
/* Initialize frame texture */
memset(&wiiu->texture, 0, sizeof(GX2Texture));
@ -401,12 +391,8 @@ static void* wiiu_gfx_init(const video_info_t* video,
wiiu->vertex_cache.size = 0x1000;
wiiu->vertex_cache.current = 0;
wiiu->vertex_cache.positions = MEM2_alloc(wiiu->vertex_cache.size
* sizeof(position_t), GX2_VERTEX_BUFFER_ALIGNMENT);
wiiu->vertex_cache.tex_coords = MEM2_alloc(wiiu->vertex_cache.size
* sizeof(tex_coord_t), GX2_VERTEX_BUFFER_ALIGNMENT);
wiiu->vertex_cache.colors = MEM2_alloc(wiiu->vertex_cache.size
* sizeof(u32), GX2_VERTEX_BUFFER_ALIGNMENT);
wiiu->vertex_cache.v = MEM2_alloc(wiiu->vertex_cache.size
* sizeof(*wiiu->vertex_cache.v), GX2_VERTEX_BUFFER_ALIGNMENT);
/* Initialize samplers */
GX2InitSampler(&wiiu->sampler_nearest, GX2_TEX_CLAMP_MODE_CLAMP, GX2_TEX_XY_FILTER_MODE_POINT);
@ -464,15 +450,15 @@ static void gx2_overlay_tex_geom(void *data, unsigned image,
if (!o)
return;
o->tex_coord[0] = x;
o->tex_coord[1] = y;
o->tex_coord[2] = x + w;
o->tex_coord[3] = y;
o->tex_coord[4] = x + w;
o->tex_coord[5] = y + h;
o->tex_coord[6] = x ;
o->tex_coord[7] = y + h;
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, o->tex_coord, sizeof(o->tex_coord));
o->v[0].coord.u = x;
o->v[0].coord.v = y;
o->v[1].coord.u = x + w;
o->v[1].coord.v = y;
o->v[2].coord.u = x + w;
o->v[2].coord.v = y + h;
o->v[3].coord.u = x ;
o->v[3].coord.v = y + h;
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, o->v, sizeof(o->v));
}
static void gx2_overlay_vertex_geom(void *data, unsigned image,
@ -497,19 +483,19 @@ static void gx2_overlay_vertex_geom(void *data, unsigned image,
if (!o)
return;
o->vertex_coord[0] = x;
o->vertex_coord[1] = y;
o->v[0].pos.x = x;
o->v[0].pos.y = y;
o->vertex_coord[2] = x + w;
o->vertex_coord[3] = y;
o->v[1].pos.x = x + w;
o->v[1].pos.y = y;
o->vertex_coord[4] = x + w;
o->vertex_coord[5] = y + h;
o->v[2].pos.x = x + w;
o->v[2].pos.y = y + h;
o->vertex_coord[6] = x ;
o->vertex_coord[7] = y + h;
o->v[3].pos.x = x ;
o->v[3].pos.y = y + h;
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, o->vertex_coord,sizeof(o->vertex_coord));
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, o->v,sizeof(o->v));
}
static void gx2_free_overlay(wiiu_video_t *gx2)
@ -569,15 +555,13 @@ static bool gx2_overlay_load(void *data,
gx2_overlay_tex_geom(gx2, i, 0, 0, 1, 1);
gx2_overlay_vertex_geom(gx2, i, 0, 0, 1, 1);
gx2->overlay[i].alpha_mod = 1.0f;
gx2->overlay[i].color[0] = 0xFFFFFFFF;
gx2->overlay[i].color[1] = 0xFFFFFFFF;
gx2->overlay[i].color[2] = 0xFFFFFFFF;
gx2->overlay[i].color[3] = 0xFFFFFFFF;
gx2->overlay[i].v[0].color = 0xFFFFFFFF;
gx2->overlay[i].v[1].color = 0xFFFFFFFF;
gx2->overlay[i].v[2].color = 0xFFFFFFFF;
gx2->overlay[i].v[3].color = 0xFFFFFFFF;
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, o->vertex_coord,sizeof(o->vertex_coord));
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, o->tex_coord, sizeof(o->tex_coord));
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, o->color, sizeof(o->color));
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, o->v,sizeof(o->v));
}
@ -604,11 +588,11 @@ static void gx2_overlay_set_alpha(void *data, unsigned image, float mod)
if (gx2)
{
gx2->overlay[image].alpha_mod = mod;
gx2->overlay[image].color[0] = COLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF * gx2->overlay[image].alpha_mod);
gx2->overlay[image].color[1] = gx2->overlay[image].color[0];
gx2->overlay[image].color[2] = gx2->overlay[image].color[0];
gx2->overlay[image].color[3] = gx2->overlay[image].color[0];
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, gx2->overlay[image].color, sizeof(gx2->overlay[image].color));
gx2->overlay[image].v[0].color = COLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF * gx2->overlay[image].alpha_mod);
gx2->overlay[image].v[1].color = gx2->overlay[image].v[0].color;
gx2->overlay[image].v[2].color = gx2->overlay[image].v[0].color;
gx2->overlay[image].v[3].color = gx2->overlay[image].v[0].color;
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, gx2->overlay[image].v, sizeof(gx2->overlay[image].v));
}
}
@ -620,12 +604,7 @@ static void gx2_render_overlay(void *data)
for (i = 0; i < gx2->overlays; i++){
GX2SetAttribBuffer(0, 8 * sizeof(float),
2*sizeof(float), gx2->overlay[i].vertex_coord);
GX2SetAttribBuffer(1, 8 * sizeof(float),
2*sizeof(float), gx2->overlay[i].tex_coord);
GX2SetAttribBuffer(2, 4 * sizeof(u32),
sizeof(u32), gx2->overlay[i].color);
GX2SetAttribBuffer(0, sizeof(gx2->overlay[i].v), sizeof(*gx2->overlay[i].v), gx2->overlay[i].v);
GX2SetPixelTexture(&gx2->overlay[i].tex, gx2->shader->sampler.location);
GX2SetPixelSampler(&gx2->sampler_linear, gx2->shader->sampler.location);
@ -682,9 +661,7 @@ static void wiiu_gfx_free(void* data)
MEM2_free(wiiu->cmd_buffer);
MEM2_free(wiiu->texture.surface.image);
MEM2_free(wiiu->menu.texture.surface.image);
MEM2_free(wiiu->vertex_cache.positions);
MEM2_free(wiiu->vertex_cache.tex_coords);
MEM2_free(wiiu->vertex_cache.colors);
MEM2_free(wiiu->vertex_cache.v);
MEM1_free(wiiu->color_buffer.surface.image);
@ -702,13 +679,8 @@ static void wiiu_gfx_free(void* data)
MEM2_free(wiiu->shader);
#endif
MEM2_free(wiiu->position);
MEM2_free(wiiu->tex_coord);
MEM2_free(wiiu->color);
MEM2_free(wiiu->menu.position);
MEM2_free(wiiu->menu.tex_coord);
MEM2_free(wiiu->menu.color);
MEM2_free(wiiu->v);
MEM2_free(wiiu->menu.v);
free(wiiu);
}
@ -822,15 +794,10 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_TEXTURE, wiiu->texture.surface.image,
wiiu->texture.surface.imageSize);
wiiu_set_tex_coords(wiiu->tex_coord, &wiiu->texture, 0, 0, width, height, wiiu->rotation);
wiiu_set_tex_coords(wiiu->v, &wiiu->texture, 0, 0, width, height, wiiu->rotation);
}
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->position),
sizeof(*wiiu->position), wiiu->position);
GX2SetAttribBuffer(1, 4 * sizeof(*wiiu->tex_coord),
sizeof(*wiiu->tex_coord), wiiu->tex_coord);
GX2SetAttribBuffer(2, 4 * sizeof(*wiiu->color),
sizeof(*wiiu->color), wiiu->color);
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->v), sizeof(*wiiu->v), wiiu->v);
GX2SetPixelTexture(&wiiu->texture, wiiu->shader->sampler.location);
GX2SetPixelSampler(wiiu->smooth? &wiiu->sampler_linear : &wiiu->sampler_nearest,
@ -845,12 +812,7 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
if (wiiu->menu.enable)
{
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->menu.position),
sizeof(*wiiu->menu.position), wiiu->menu.position);
GX2SetAttribBuffer(1, 4 * sizeof(*wiiu->menu.tex_coord),
sizeof(*wiiu->menu.tex_coord), wiiu->menu.tex_coord);
GX2SetAttribBuffer(2, 4 * sizeof(*wiiu->menu.color),
sizeof(*wiiu->menu.color), wiiu->menu.color);
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->menu.v), sizeof(*wiiu->menu.v), wiiu->menu.v);
GX2SetPixelTexture(&wiiu->menu.texture, wiiu->shader->sampler.location);
GX2SetPixelSampler(&wiiu->sampler_linear, wiiu->shader->sampler.location);
@ -859,12 +821,8 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
}
wiiu->vertex_cache.current = 0;
GX2SetAttribBuffer(0, wiiu->vertex_cache.size * sizeof(position_t),
sizeof(position_t), wiiu->vertex_cache.positions);
GX2SetAttribBuffer(1, wiiu->vertex_cache.size * sizeof(tex_coord_t),
sizeof(tex_coord_t), wiiu->vertex_cache.tex_coords);
GX2SetAttribBuffer(2, wiiu->vertex_cache.size * sizeof(u32),
sizeof(u32), wiiu->vertex_cache.colors);
GX2SetAttribBuffer(0, wiiu->vertex_cache.size * sizeof(*wiiu->vertex_cache.v),
sizeof(*wiiu->vertex_cache.v), wiiu->vertex_cache.v);
GX2SetPixelSampler(&wiiu->sampler_linear, wiiu->shader->sampler.location);
wiiu->render_msg_enabled = true;
@ -878,11 +836,7 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
wiiu->render_msg_enabled = false;
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER,
wiiu->vertex_cache.positions, wiiu->vertex_cache.current * sizeof(position_t));
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER,
wiiu->vertex_cache.tex_coords, wiiu->vertex_cache.current * sizeof(tex_coord_t));
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER,
wiiu->vertex_cache.colors, wiiu->vertex_cache.current * sizeof(u32));
wiiu->vertex_cache.v, wiiu->vertex_cache.current * sizeof(*wiiu->vertex_cache.v));
if (wiiu->menu.enable)
GX2DrawDone();
@ -1056,7 +1010,7 @@ static void wiiu_gfx_set_texture_frame(void* data, const void* frame, bool rgb32
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_TEXTURE, wiiu->menu.texture.surface.image,
wiiu->menu.texture.surface.imageSize);
wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0, width, height, 0);
wiiu_set_tex_coords(wiiu->menu.v, &wiiu->menu.texture, 0, 0, width, height, 0);
}
static void wiiu_gfx_set_texture_enable(void* data, bool state, bool full_screen)

View File

@ -160,9 +160,7 @@ static void wiiu_font_render_line(
break;
}
position_t* pos = wiiu->vertex_cache.positions + wiiu->vertex_cache.current;
tex_coord_t* coord = wiiu->vertex_cache.tex_coords + wiiu->vertex_cache.current;
u32* col = wiiu->vertex_cache.colors + wiiu->vertex_cache.current;
tex_shader_vertex_t* v = wiiu->vertex_cache.v + wiiu->vertex_cache.current;
for (i = 0; i < msg_len; i++)
{
@ -200,45 +198,42 @@ static void wiiu_font_render_line(
float u1 = u0 + width;
float v1 = v0 + height;
pos[0].x = (2.0f * x0 / wiiu->color_buffer.surface.width) - 1.0f;
pos[0].y = (-2.0f * y0 / wiiu->color_buffer.surface.height) + 1.0f;
pos[1].x = (2.0f * x1 / wiiu->color_buffer.surface.width) - 1.0f;;
pos[1].y = (-2.0f * y0 / wiiu->color_buffer.surface.height) + 1.0f;
pos[2].x = (2.0f * x1 / wiiu->color_buffer.surface.width) - 1.0f;;
pos[2].y = (-2.0f * y1 / wiiu->color_buffer.surface.height) + 1.0f;
pos[3].x = (2.0f * x0 / wiiu->color_buffer.surface.width) - 1.0f;;
pos[3].y = (-2.0f * y1 / wiiu->color_buffer.surface.height) + 1.0f;
pos += 4;
v[0].pos.x = (2.0f * x0 / wiiu->color_buffer.surface.width) - 1.0f;
v[0].pos.y = (-2.0f * y0 / wiiu->color_buffer.surface.height) + 1.0f;
v[1].pos.x = (2.0f * x1 / wiiu->color_buffer.surface.width) - 1.0f;;
v[1].pos.y = (-2.0f * y0 / wiiu->color_buffer.surface.height) + 1.0f;
v[2].pos.x = (2.0f * x1 / wiiu->color_buffer.surface.width) - 1.0f;;
v[2].pos.y = (-2.0f * y1 / wiiu->color_buffer.surface.height) + 1.0f;
v[3].pos.x = (2.0f * x0 / wiiu->color_buffer.surface.width) - 1.0f;;
v[3].pos.y = (-2.0f * y1 / wiiu->color_buffer.surface.height) + 1.0f;
coord[0].u = u0 / font->texture.surface.width;
coord[0].v = v1 / font->texture.surface.height;
coord[1].u = u1 / font->texture.surface.width;
coord[1].v = v1 / font->texture.surface.height;
coord[2].u = u1 / font->texture.surface.width;
coord[2].v = v0 / font->texture.surface.height;
coord[3].u = u0 / font->texture.surface.width;
coord[3].v = v0 / font->texture.surface.height;
coord += 4;
v[0].coord.u = u0 / font->texture.surface.width;
v[0].coord.v = v1 / font->texture.surface.height;
v[1].coord.u = u1 / font->texture.surface.width;
v[1].coord.v = v1 / font->texture.surface.height;
v[2].coord.u = u1 / font->texture.surface.width;
v[2].coord.v = v0 / font->texture.surface.height;
v[3].coord.u = u0 / font->texture.surface.width;
v[3].coord.v = v0 / font->texture.surface.height;
col[0] = color;
col[1] = color;
col[2] = color;
col[3] = color;
col += 4;
v[0].color = color;
v[1].color = color;
v[2].color = color;
v[3].color = color;
v += 4;
delta_x += glyph->advance_x;
delta_y += glyph->advance_y;
}
int count = pos - wiiu->vertex_cache.positions - wiiu->vertex_cache.current;
int count = v - wiiu->vertex_cache.v - wiiu->vertex_cache.current;
if (!count)
return;
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->vertex_cache.positions + wiiu->vertex_cache.current, count * sizeof(position_t));
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->vertex_cache.tex_coords + wiiu->vertex_cache.current, count * sizeof(tex_coord_t));
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->vertex_cache.colors + wiiu->vertex_cache.current, count * sizeof(u32));
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->vertex_cache.v + wiiu->vertex_cache.current, count * sizeof(wiiu->vertex_cache.v));
if(font->atlas->dirty)
{
@ -261,7 +256,7 @@ static void wiiu_font_render_line(
GX2DrawEx(GX2_PRIMITIVE_MODE_QUADS, count, wiiu->vertex_cache.current, 1);
wiiu->vertex_cache.current = pos - wiiu->vertex_cache.positions;
wiiu->vertex_cache.current = v - wiiu->vertex_cache.v;
}
static void wiiu_font_render_message(

View File

@ -77,9 +77,7 @@ static void menu_display_wiiu_draw(void *data)
if (wiiu->vertex_cache.current + 4 > wiiu->vertex_cache.size)
return;
position_t* pos = wiiu->vertex_cache.positions + wiiu->vertex_cache.current;
tex_coord_t* coord = wiiu->vertex_cache.tex_coords + wiiu->vertex_cache.current;
u32* col = wiiu->vertex_cache.colors + wiiu->vertex_cache.current;
tex_shader_vertex_t* v = wiiu->vertex_cache.v + wiiu->vertex_cache.current;
float x0 = draw->x;
float y0 = draw->y;
@ -90,43 +88,47 @@ static void menu_display_wiiu_draw(void *data)
{
for(int i = 0; i < 4; i++)
{
pos[i].x = draw->coords->vertex[i << 1] * 2.0f - 1.0f;
pos[i].y = draw->coords->vertex[(i << 1) + 1] * 2.0f - 1.0f;
v[i].pos.x = draw->coords->vertex[i << 1] * 2.0f - 1.0f;
v[i].pos.y = draw->coords->vertex[(i << 1) + 1] * 2.0f - 1.0f;
}
}
else
{
pos[0].x = (2.0f * x0 / wiiu->color_buffer.surface.width) - 1.0f;
pos[0].y = (2.0f * y0 / wiiu->color_buffer.surface.height) - 1.0f;
pos[1].x = (2.0f * x1 / wiiu->color_buffer.surface.width) - 1.0f;;
pos[1].y = (2.0f * y0 / wiiu->color_buffer.surface.height) - 1.0f;
pos[2].x = (2.0f * x1 / wiiu->color_buffer.surface.width) - 1.0f;;
pos[2].y = (2.0f * y1 / wiiu->color_buffer.surface.height) - 1.0f;
pos[3].x = (2.0f * x0 / wiiu->color_buffer.surface.width) - 1.0f;;
pos[3].y = (2.0f * y1 / wiiu->color_buffer.surface.height) - 1.0f;
v[0].pos.x = (2.0f * x0 / wiiu->color_buffer.surface.width) - 1.0f;
v[0].pos.y = (2.0f * y0 / wiiu->color_buffer.surface.height) - 1.0f;
v[1].pos.x = (2.0f * x1 / wiiu->color_buffer.surface.width) - 1.0f;;
v[1].pos.y = (2.0f * y0 / wiiu->color_buffer.surface.height) - 1.0f;
v[2].pos.x = (2.0f * x1 / wiiu->color_buffer.surface.width) - 1.0f;;
v[2].pos.y = (2.0f * y1 / wiiu->color_buffer.surface.height) - 1.0f;
v[3].pos.x = (2.0f * x0 / wiiu->color_buffer.surface.width) - 1.0f;;
v[3].pos.y = (2.0f * y1 / wiiu->color_buffer.surface.height) - 1.0f;
}
if(draw->coords->tex_coord && draw->coords->vertices == 4)
{
memcpy(coord, draw->coords->tex_coord, 8 * sizeof(float));
for(int i = 0; i < 4; i++)
{
v[i].coord.u = draw->coords->tex_coord[i << 1];
v[i].coord.v = draw->coords->tex_coord[(i << 1) + 1];
}
}
else
{
coord[0].u = 0.0f;
coord[0].v = 1.0f;
coord[1].u = 1.0f;
coord[1].v = 1.0f;
coord[2].u = 1.0f;
coord[2].v = 0.0f;
coord[3].u = 0.0f;
coord[3].v = 0.0f;
v[0].coord.u = 0.0f;
v[0].coord.v = 1.0f;
v[1].coord.u = 1.0f;
v[1].coord.v = 1.0f;
v[2].coord.u = 1.0f;
v[2].coord.v = 0.0f;
v[3].coord.u = 0.0f;
v[3].coord.v = 0.0f;
}
col[0] = COLOR_RGBA(0xFF * draw->coords->color[0], 0xFF * draw->coords->color[1],
v[0].color = COLOR_RGBA(0xFF * draw->coords->color[0], 0xFF * draw->coords->color[1],
0xFF * draw->coords->color[2], 0xFF * draw->coords->color[3]);
col[1] = col[0];
col[2] = col[0];
col[3] = col[0];
v[1].color = v[0].color;
v[2].color = v[0].color;
v[3].color = v[0].color;
// printf("color : %f, %f, %f, %f --> 0x%08X\n", draw->coords->color[0], draw->coords->color[1], draw->coords->color[2], draw->coords->color[3], col[0]);

View File

@ -190,15 +190,15 @@ tex_shader_t tex_shader =
},
.attribute_stream = {
.color = {
0, 2, 0, GX2_ATTRIB_FORMAT_UNORM_8_8_8_8,
0, 0, offsetof(tex_shader_vertex_t, color), GX2_ATTRIB_FORMAT_UNORM_8_8_8_8,
GX2_ATTRIB_INDEX_PER_VERTEX, 0, GX2_COMP_SEL(_X, _Y, _Z, _W), GX2_ENDIAN_SWAP_DEFAULT
},
.position = {
1, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32,
1, 0, offsetof(tex_shader_vertex_t, pos), GX2_ATTRIB_FORMAT_FLOAT_32_32,
GX2_ATTRIB_INDEX_PER_VERTEX, 0, GX2_COMP_SEL(_X, _Y, _0, _1), GX2_ENDIAN_SWAP_DEFAULT
},
.tex_coord = {
2, 1, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32,
2, 0, offsetof(tex_shader_vertex_t, coord), GX2_ATTRIB_FORMAT_FLOAT_32_32,
GX2_ATTRIB_INDEX_PER_VERTEX, 0, GX2_COMP_SEL(_X, _Y, _0, _1), GX2_ENDIAN_SWAP_DEFAULT
}
},

View File

@ -41,6 +41,23 @@ typedef struct __attribute__((aligned(GX2_VERTEX_BUFFER_ALIGNMENT)))
GX2FetchShader fs;
}tex_shader_t;
typedef struct
{
struct
{
float x;
float y;
}pos;
struct
{
float u;
float v;
}coord;
u32 color;
}tex_shader_vertex_t;
extern tex_shader_t tex_shader;
#ifdef __cplusplus