Merge branch 'master' into qt

This commit is contained in:
Andrés Suárez 2016-12-11 15:08:19 -05:00 committed by GitHub
commit f9c3869b43
284 changed files with 21248 additions and 14808 deletions

2
.gitmodules vendored
View File

@ -1,6 +1,6 @@
[submodule "deps/glslang/glslang"]
path = deps/glslang/glslang
url = https://github.com/KhronosGroup/glslang.git
url = https://github.com/libretro/glslang.git
[submodule "deps/SPIRV-Cross"]
path = deps/SPIRV-Cross
url = https://github.com/KhronosGroup/SPIRV-Cross

View File

@ -183,7 +183,7 @@ OBJ += frontend/frontend.o \
$(LIBRETRO_COMM_DIR)/queues/message_queue.o \
managers/state_manager.o \
gfx/drivers_font_renderer/bitmapfont.o \
input/input_autodetect.o \
tasks/task_autodetect.o \
input/input_autodetect_builtin.o \
input/input_joypad_driver.o \
input/input_config.o \
@ -636,6 +636,7 @@ ifeq ($(HAVE_UDEV), 1)
DEFINES += $(UDEV_CFLAGS)
LIBS += $(UDEV_LIBS)
OBJ += input/drivers/udev_input.o \
input/common/udev_common.o \
input/drivers_keyboard/keyboard_event_udev.o \
input/drivers_joypad/udev_joypad.o
endif
@ -710,6 +711,16 @@ ifeq ($(HAVE_KMS), 1)
LIBS += $(GBM_LIBS) $(DRM_LIBS) $(EGL_LIBS)
endif
ifeq ($(HAVE_CACA), 1)
DEFINES += -DHAVE_CACA
OBJ += gfx/drivers/caca_gfx.o gfx/drivers_font/caca_font.o
LIBS += -lcaca
ifeq ($(HAVE_MENU_COMMON), 1)
OBJ += menu/drivers_display/menu_display_caca.o
endif
endif
ifeq ($(HAVE_PLAIN_DRM), 1)
OBJ += gfx/drivers/drm_gfx.o
CFLAGS += -I/usr/include/libdrm
@ -857,7 +868,8 @@ ifeq ($(HAVE_VULKAN), 1)
$(wildcard $(DEPS_DIR)/glslang/glslang/hlsl/*.cpp) \
$(wildcard $(DEPS_DIR)/glslang/glslang/glslang/OSDependent/$(GLSLANG_PLATFORM)/*.cpp)
SPIRV_CROSS_SOURCES := $(DEPS_DIR)/SPIRV-Cross/spirv_cross.cpp
SPIRV_CROSS_SOURCES := $(DEPS_DIR)/SPIRV-Cross/spirv_cross.cpp \
$(DEPS_DIR)/SPIRV-Cross/spirv_cfg.cpp
ifneq ($(findstring Win32,$(OS)),)
# Trivial temporary workaround for MinGW and glslang.
CXXFLAGS += -fpermissive
@ -876,7 +888,7 @@ ifeq ($(HAVE_VULKAN), 1)
CXXFLAGS += -Wno-switch -Wno-sign-compare -fno-strict-aliasing -Wno-maybe-uninitialized -Wno-reorder -Wno-parentheses -Igfx/include
CFLAGS += -Igfx/include
GLSLANG_OBJ := $(GLSLANG_SOURCES:.cpp=.o)
GLSLANG_OBJ := $(GLSLANG_SOURCES:.cpp=.o)
SPIRV_CROSS_OBJ := $(SPIRV_CROSS_SOURCES:.cpp=.o)
OBJ += gfx/drivers/vulkan.o \
@ -975,7 +987,9 @@ endif
# Compression/Archive
OBJ += $(LIBRETRO_COMM_DIR)/file/archive_file.o
OBJ += $(LIBRETRO_COMM_DIR)/file/archive_file.o \
$(LIBRETRO_COMM_DIR)/streams/trans_stream.o \
$(LIBRETRO_COMM_DIR)/streams/trans_stream_pipe.o
ifeq ($(HAVE_7ZIP),1)
CFLAGS += -I$(DEPS_DIR)/7zip
@ -1001,7 +1015,8 @@ endif
ifeq ($(HAVE_ZLIB), 1)
OBJ += $(LIBRETRO_COMM_DIR)/file/archive_file_zlib.o
OBJ += $(LIBRETRO_COMM_DIR)/file/archive_file_zlib.o \
$(LIBRETRO_COMM_DIR)/streams/trans_stream_zlib.o
OBJ += $(ZLIB_OBJS)
DEFINES += -DHAVE_ZLIB
HAVE_COMPRESSION = 1
@ -1081,8 +1096,11 @@ ifeq ($(HAVE_NETWORKING), 1)
OBJ += $(LIBRETRO_COMM_DIR)/net/net_compat.o \
$(LIBRETRO_COMM_DIR)/net/net_http.o \
$(LIBRETRO_COMM_DIR)/net/net_socket.o \
$(LIBRETRO_COMM_DIR)/net/net_natt.o \
network/net_http_special.o \
tasks/task_http.o
tasks/task_http.o \
tasks/task_netplay_lan_scan.o \
tasks/task_wifi.o
ifneq ($(HAVE_SOCKET_LEGACY),1)
OBJ += $(LIBRETRO_COMM_DIR)/net/net_ifinfo.o
@ -1102,6 +1120,7 @@ ifeq ($(HAVE_NETWORKING), 1)
OBJ += network/netplay/netplay_net.o \
network/netplay/netplay_spectate.o \
network/netplay/netplay_common.o \
network/netplay/netplay_discovery.o \
network/netplay/netplay.o
# Retro Achievements (also depends on threads)
@ -1118,6 +1137,10 @@ ifeq ($(HAVE_NETWORKING), 1)
OBJ += input/input_remote.o \
cores/libretro-net-retropad/net_retropad_core.o
endif
ifeq ($(HAVE_MINIUPNPC), 1)
LIBS += -lminiupnpc
endif
endif
ifneq ($(findstring Win32,$(OS)),)

View File

@ -101,7 +101,7 @@ $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>dev
endif
ifeq ($(strip $(CTRULIB)),)
CTRULIB = $(DEVKITPRO)/ctrulib
CTRULIB = $(DEVKITPRO)/libctru
endif
APP_TITLE := $(shell echo "$(APP_TITLE)" | cut -c1-128)

View File

@ -1,5 +1,6 @@
TARGET := retroarch_wiiu
RPX_BUILD = 0
BUILD_HBL_ELF = 1
BUILD_RPX = 1
DEBUG = 0
GRIFFIN_BUILD = 0
WHOLE_ARCHIVE_LINK = 0
@ -14,11 +15,6 @@ OBJ += wiiu/fs/sd_fat_devoptab.o
OBJ += wiiu/fs/fs_utils.o
OBJ += wiiu/tex_shader.o
ifneq ($(RPX_BUILD), 1)
OBJ += wiiu/system/dynamic.o
OBJ += wiiu/system/dyn_stubs.o
endif
DEFINES :=
ifeq ($(GRIFFIN_BUILD), 1)
@ -115,7 +111,7 @@ else
endif
LDFLAGS := $(CFLAGS)
ASFLAGS := $(CFLAGS) -mregnames $(INCDIRS)
ASFLAGS := $(CFLAGS) -mregnames
CFLAGS += -ffast-math -Werror=implicit-function-declaration
#CFLAGS += -fomit-frame-pointer -mword-relocations
@ -123,7 +119,7 @@ CFLAGS += -ffast-math -Werror=implicit-function-declaration
CFLAGS += -Dstatic_assert=_Static_assert
CFLAGS += -DWIIU -DMSB_FIRST
CFLAGS += -DHAVE_MAIN
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE -DSINC_LOWEST_QUALITY
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)
ifneq ($(PC_DEVELOPMENT_IP_ADDRESS),)
@ -140,54 +136,77 @@ ifeq ($(WHOLE_ARCHIVE_LINK), 1)
endif
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ifeq ($(RPX_BUILD), 1)
CFLAGS += -fno-builtin -ffreestanding -DRPX_BUILD
LIBDIRS += -L$(WUT_ROOT)/lib -L$(DEVKITPPC)/lib
LDFLAGS += -pie -fPIE
LDFLAGS += -z common-page-size=64 -z max-page-size=64
LDFLAGS += -lcoreinit -lgx2 -lnsysnet -lproc_ui -lsndcore2 -lsysapp -lvpad
LDFLAGS += -T $(WUT_ROOT)/rules/rpl.ld
# LDFLAGS += -T wiiu/link_rpl.ld
LDFLAGS += -nostartfiles
else
LDFLAGS += -T wiiu/link_elf.ld
endif
LDFLAGS += -Wl,--gc-sections
LIBS := $(WHOLE_START) -lretro_wiiu $(WHOLE_END) -lm
ifeq ($(RPX_BUILD), 1)
all: $(TARGET).elf $(TARGET).rpx
else
all: $(TARGET).elf
RPX_OBJ = wiiu/system/stubs_rpl.o
HBL_ELF_OBJ = wiiu/system/dynamic.o wiiu/system/stubs_elf.o
RPX_LDFLAGS := -L$(WUT_ROOT)/lib -L$(DEVKITPPC)/lib
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
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS)
%.o: %.cpp %.depend
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS) $(DEPFLAGS)
$(POSTCOMPILE)
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS)
%.o: %.c %.depend
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) $(DEPFLAGS)
$(POSTCOMPILE)
%.o: %.s
$(CC) -c -o $@ $< $(ASFLAGS)
%.o: %.S
$(CC) -c -o $@ $< $(ASFLAGS)
%.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 $@ $^
$(TARGET).elf: $(OBJ) libretro_wiiu.a wiiu/link_elf.ld wiiu/link_rpl.ld
$(LD) $(OBJ) $(LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
%.depend: ;
%.rpx: %.elf
$(ELF2RPL) $(notdir $<) $@
$(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) $(notdir $<) $@
clean:
rm -f $(OBJ)
rm -f $(TARGET).elf
rm -f $(TARGET).rpx
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

@ -1,8 +1,5 @@
[![Build Status](https://travis-ci.org/libretro/RetroArch.svg?branch=master)](https://travis-ci.org/libretro/RetroArch)
<a href="https://scan.coverity.com/projects/retroarch">
<img alt="Coverity Scan Build Status"
src="https://scan.coverity.com/projects/8936/badge.svg"/>
</a>
[![Coverity Scan Build Status](https://scan.coverity.com/projects/8936/badge.svg)](https://scan.coverity.com/projects/retroarch)
# RetroArch
@ -24,11 +21,11 @@ interface to include support for emulators and/or game engines. libretro is comp
## Binaries
Latest Windows binaries are currently hosted on the buildbot -(http://buildbot.libretro.com/).
Latest Windows binaries are currently hosted on the [buildbot](http://buildbot.libretro.com/).
## Support
To reach developers, either make an issue here on Github, make a thread on the [forum](http://www.libretro.com/forums/),
To reach developers, either make an issue here on GitHub, make a thread on the [forum](http://www.libretro.com/forums/),
or visit our IRC channel: #retroarch @ irc.freenode.org.
## Documentation
@ -57,7 +54,7 @@ RetroArch also emphasizes on being easy to integrate into various launcher front
RetroArch has been ported to the following platforms outside PC:
- PlayStation3
- PlayStation 3
- Xbox 360 (Libxenon/XeXDK)
- Xbox 1
- Wii, Gamecube (Libogc)
@ -119,10 +116,10 @@ A sample configuration file is installed to /etc/retroarch.cfg. This is the syst
RetroArch will on startup create a config file in $XDG\_CONFIG\_HOME/retroarch/retroarch.cfg if doesn't exist.
Users only need to configure a certain option if the desired value deviates from the value defined in config.def.h.
To configure joypads, use the built-in menu or the <tt>retroarch-joyconfig</tt> command-line tool.
To configure joypads, use the built-in menu or the `retroarch-joyconfig` command-line tool.
## Compiling and installing
<b>Linux</b><br/>
**Linux**
- Prerequisites:
```bash
sudo apt-get install -y make git-core curl g++ pkg-config libglu1-mesa-dev freeglut3-dev mesa-common-dev libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev
@ -133,7 +130,7 @@ sudo apt-get install -y make git-core curl g++ pkg-config libglu1-mesa-dev freeg
make
```
<b>Mac</b><br/>
**Mac**
- Prerequisites: [XCode](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB4QFjAA&url=https%3A%2F%2Fitunes.apple.com%2Fus%2Fapp%2Fxcode%2Fid497799835%3Fmt%3D12&ei=ZmfeVNPtIILVoASBnoCYBw&usg=AFQjCNGrxKmVtXUdvUU3MhqZhP4MHT6Gtg&sig2=RIXKsWQ79YTQBt_lK5fdKA&bvm=bv.85970519,d.cGU), [Cg](https://developer.nvidia.com/cg-toolkit-download).
- You can open the project (**pkg/apple/RetroArch.xcodeproj**) in the Xcode IDE and build (**&#8984;-B**) and run (**&#8984;-R**) it there. Or you can use the command line...
- Debug:
@ -151,62 +148,62 @@ xcodebuild -target RetroArch -configuration Release -project pkg/apple/RetroArch
open ./pkg/apple/build/Release/RetroArch.app/
```
<b>PC</b><br/>
**PC**
Instructions for compiling on PC can be found in the [wiki](https://github.com/Themaister/RetroArch/wiki).
<b>PlayStation3</b><br/>
**PlayStation 3**
RetroArch PS3 needs to be compiled in the following order:
1) Compile RetroArch Salamander
<tt>make -f Makefile.ps3.salamander</tt>
make -f Makefile.ps3.salamander
2) Finally, compile RetroArch packed together with the GUI:
<tt>make -f Makefile.ps3</tt>
make -f Makefile.ps3
<b>PlayStation3 - Creating a PKG installable file</b><br />
**PlayStation 3 - Creating a PKG installable file**
You can add `pkg` as a parameter in order to make a PKG file - for example:
<tt>make -f Makefile.ps3 pkg</tt>
make -f Makefile.ps3 pkg
This creates an NPDRM package. This can be installed on debug PS3s.
To make a non-NPDRM package that can be installed on a jailbroken/CFW PS3 (such as PSGroove or PS3 CFWs and other 3.55 CFW derivatives), do:
<tt>make -f Makefile.ps3 pkg-signed</tt>
make -f Makefile.ps3 pkg-signed
If you're using Kmeaw 3.55 firmware, the package needs to be signed:
<tt>make -f Makefile.ps3 pkg-signed-cfw</tt>
make -f Makefile.ps3 pkg-signed-cfw
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch PS3. This file needs to be called <em><b>`libretro_ps3.a`</b></em>.
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch PS3. This file needs to be called ***`libretro_ps3.a`***.
<b> Xbox 360 (XeXDK)</b><br />
**Xbox 360 (XeXDK)**
You will need Microsoft Visual Studio 2010 installed (or higher) in order to compile RetroArch 360.
The solution file can be found at the following location:
<tt>pkg/msvc-360/RetroArch-360.sln</tt>
pkg/msvc-360/RetroArch-360.sln
NOTE: A pre-existing libretro library needs to be present in the `pkg/msvc-360/RetroArch-360/Release` directory in order to link RetroArch 360. This file needs to be
called <em><b>`libretro_xdk360.lib`</b></em>.
called ***`libretro_xdk360.lib`***.
<b> Xbox 360 (Libxenon)</b><br />
**Xbox 360 (Libxenon)**
You will need to have the libxenon libraries and a working Devkit Xenon toolchain installed in order to compile RetroArch 360 Libxenon.
<tt>make -f Makefile.xenon</tt>
make -f Makefile.xenon
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch 360 Libxenon. This file needs to be called <em><b>`libretro_xenon360.a`</b></em>.
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch 360 Libxenon. This file needs to be called ***`libretro_xenon360.a`***.
<b> Wii</b><br >
**Wii**
You will need to have the libogc libraries and a working Devkit PPC toolchain installed in order to compile RetroArch Wii.
<tt>make -f Makefile.griffin platform=wii</tt>
make -f Makefile.griffin platform=wii
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch Wii. This file needs to be called <em><b>`libretro_wii.a`</b></em>.
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch Wii. This file needs to be called ***`libretro_wii.a`***.

View File

@ -488,21 +488,22 @@ void audio_driver_set_nonblocking_state(bool enable)
**/
static bool audio_driver_flush(const int16_t *data, size_t samples)
{
struct resampler_data src_data;
static struct retro_perf_counter resampler_proc = {0};
static struct retro_perf_counter audio_convert_s16 = {0};
struct resampler_data src_data;
const void *output_data = NULL;
unsigned output_frames = 0;
size_t output_size = sizeof(float);
settings_t *settings = config_get_ptr();
const void *output_data = NULL;
unsigned output_frames = 0;
size_t output_size = sizeof(float);
settings_t *settings = config_get_ptr();
src_data.data_in = NULL;
src_data.data_out = NULL;
src_data.input_frames = 0;
src_data.output_frames = 0;
src_data.ratio = 0.0f;
src_data.data_in = NULL;
src_data.data_out = NULL;
src_data.input_frames = 0;
src_data.output_frames = 0;
src_data.ratio = 0.0f;
recording_push_audio(data, samples);
if (recording_data)
recording_push_audio(data, samples);
if (runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL) || settings->audio.mute_enable)
return true;
@ -867,7 +868,7 @@ bool audio_driver_set_callback(const void *data)
bool audio_driver_enable_callback(void)
{
if (!audio_driver_has_callback())
if (!audio_callback.callback)
return false;
if (audio_callback.set_state)
audio_callback.set_state(true);
@ -876,7 +877,7 @@ bool audio_driver_enable_callback(void)
bool audio_driver_disable_callback(void)
{
if (!audio_driver_has_callback())
if (!audio_callback.callback)
return false;
if (audio_callback.set_state)
@ -897,7 +898,7 @@ void audio_driver_monitor_set_rate(void)
bool audio_driver_callback(void)
{
if (!audio_driver_has_callback())
if (!audio_callback.callback)
return false;
if (audio_callback.callback)
@ -955,10 +956,11 @@ void audio_driver_unset_callback(void)
bool audio_driver_alive(void)
{
if (!current_audio || !current_audio->alive
|| !audio_driver_context_audio_data)
return false;
return current_audio->alive(audio_driver_context_audio_data);
if ( current_audio
&& current_audio->alive
&& audio_driver_context_audio_data)
return current_audio->alive(audio_driver_context_audio_data);
return false;
}
void audio_driver_frame_is_reverse(void)
@ -999,11 +1001,6 @@ void audio_driver_unset_active(void)
audio_driver_active = false;
}
bool audio_driver_is_active(void)
{
return audio_driver_active;
}
void audio_driver_destroy(void)
{
audio_driver_active = false;

View File

@ -94,8 +94,6 @@ void audio_driver_set_active(void);
void audio_driver_unset_active(void);
bool audio_driver_is_active(void);
void audio_driver_destroy(void);
void audio_driver_deinit_resampler(void);

View File

@ -0,0 +1,22 @@
filters = 4
filter0 = eq
filter1 = reverb
filter2 = iir
filter3 = panning
eq_frequencies = "32 64 125 250 500 1000 2000 4000 8000 16000 20000"
eq_gains = "6 9 12 7 6 5 7 9 11 6 0"
# Reverb - slight reverb
reverb_drytime = 0.5
reverb_wettime = 0.15
reverb_damping = 0.8
reverb_roomwidth = 0.25
reverb_roomsize = 0.25
# IIR - filters out some harsh sounds on the upper end
iir_type = RIAA_CD
# Panning - cut the volume a bit
panning_left_mix = "0.75 0.0"
panning_right_mix = "0.0 0.75"

View File

@ -103,10 +103,11 @@ static void shutdown_cb(void *data)
static int parse_ports(char **dest_ports, const char **jports)
{
int i;
char *save = NULL;
int parsed = 0;
settings_t *settings = config_get_ptr();
const char *con = strtok_r(settings->audio.device, ",", &save);
char *save = NULL;
int parsed = 0;
settings_t *settings = config_get_ptr();
char *audio_device_cpy = strdup(settings->audio.device);
const char *con = strtok_r(audio_device_cpy, ",", &save);
if (con)
dest_ports[parsed++] = strdup(con);
@ -117,6 +118,7 @@ static int parse_ports(char **dest_ports, const char **jports)
for (i = parsed; i < 2; i++)
dest_ports[i] = strdup(jports[i]);
free(audio_device_cpy);
return 2;
}

View File

@ -1,5 +1,6 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2014-2016 - Ali Bouhlel
* Copyright (C) 2016 - FIX94
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
@ -25,10 +26,11 @@
#include <coreinit/time.h>
#include <coreinit/cache.h>
#include <coreinit/thread.h>
#include <coreinit/spinlock.h>
#include "wiiu/wiiu_dbg.h"
#include "wiiu/system/memory.h"
#include "wiiu/multivoice.h"
#include "audio/audio_driver.h"
#include "configuration.h"
@ -37,46 +39,50 @@
typedef struct
{
AXVoice* voice_l;
AXVoice* voice_r;
AXMVoice* mvoice;
uint16_t* buffer_l;
uint16_t* buffer_r;
bool nonblocking;
uint32_t pos;
uint32_t written;
OSSpinLock spinlock;
} ax_audio_t;
#define AX_AUDIO_COUNT_SHIFT 13u
#define AX_AUDIO_COUNT (1u << AX_AUDIO_COUNT_SHIFT)
#define AX_AUDIO_COUNT_MASK (AX_AUDIO_COUNT - 1u)
//3072 samples main buffer, 64ms total
#define AX_AUDIO_COUNT 3072
#define AX_AUDIO_SIZE (AX_AUDIO_COUNT << 1u)
#define AX_AUDIO_SIZE_MASK (AX_AUDIO_SIZE - 1u)
//#define AX_AUDIO_FRAME_COUNT 144
#define AX_AUDIO_FRAME_COUNT 160
#define AX_AUDIO_SAMPLE_COUNT 144 //3ms
#define AX_AUDIO_SAMPLE_MIN (AX_AUDIO_SAMPLE_COUNT * 3) //9ms
#define AX_AUDIO_SAMPLE_LOAD (AX_AUDIO_SAMPLE_COUNT * 10) //30ms
#define AX_AUDIO_MAX_FREE (AX_AUDIO_COUNT - (AX_AUDIO_SAMPLE_COUNT * 2))
#define AX_AUDIO_RATE 48000
//#define ax_audio_ticks_to_samples(ticks) (((ticks) * 64) / 82875)
//#define ax_audio_samples_to_ticks(samples) (((samples) * 82875) / 64)
static inline int ax_diff(int v1, int v2)
static volatile ax_audio_t *wiiu_cb_ax = NULL;
void wiiu_ax_callback(void)
{
return ((v1 - v2) << (32u - AX_AUDIO_COUNT_SHIFT)) >> (32u - AX_AUDIO_COUNT_SHIFT);
}
//possibly called before unregister
if(wiiu_cb_ax == NULL)
return;
AXResult ax_aux_callback(void* data, ax_audio_t* ax)
{
AXVoiceOffsets offsets;
AXGetVoiceOffsets(ax->voice_l, &offsets);
if (ax_diff(offsets.currentOffset, ax->pos) < 0)
ax_audio_t *ax = (ax_audio_t*)wiiu_cb_ax;
if(AXIsMultiVoiceRunning(ax->mvoice))
{
AXSetVoiceState(ax->voice_l, AX_VOICE_STATE_STOPPED);
AXSetVoiceState(ax->voice_r, AX_VOICE_STATE_STOPPED);
if(OSUninterruptibleSpinLock_Acquire(&ax->spinlock))
{
//buffer underrun, stop playback to let it fill up
if(ax->written < AX_AUDIO_SAMPLE_MIN)
AXSetMultiVoiceState(ax->mvoice, AX_VOICE_STATE_STOPPED);
ax->written -= AX_AUDIO_SAMPLE_COUNT;
OSUninterruptibleSpinLock_Release(&ax->spinlock);
}
}
return AX_RESULT_SUCCESS;
}
extern void AXRegisterFrameCallback(void *cb);
static void* ax_audio_init(const char* device, unsigned rate, unsigned latency)
{
ax_audio_t* ax = (ax_audio_t*)calloc(1, sizeof(ax_audio_t));
@ -88,10 +94,11 @@ static void* ax_audio_init(const char* device, unsigned rate, unsigned latency)
AXInitWithParams(&init);
ax->voice_l = AXAcquireVoice(10, NULL, ax);
ax->voice_r = AXAcquireVoice(10, NULL, ax);
u16 setup_buf[0x30] = {0};
setup_buf[0x25] = 2; //we request 2 channels
AXAcquireMultiVoice(31, NULL, 0, setup_buf, &ax->mvoice);
if (!ax->voice_l || !ax->voice_r)
if (!ax->mvoice || ax->mvoice->channels != 2)
{
free(ax);
return NULL;
@ -99,44 +106,45 @@ static void* ax_audio_init(const char* device, unsigned rate, unsigned latency)
ax->buffer_l = MEM1_alloc(AX_AUDIO_SIZE, 0x100);
ax->buffer_r = MEM1_alloc(AX_AUDIO_SIZE, 0x100);
memset(ax->buffer_l,0,AX_AUDIO_SIZE);
memset(ax->buffer_r,0,AX_AUDIO_SIZE);
DCFlushRange(ax->buffer_l,AX_AUDIO_SIZE);
DCFlushRange(ax->buffer_r,AX_AUDIO_SIZE);
AXVoiceOffsets offsets;
//shared by both voices
AXVoiceOffsets offsets[2];
offsets[0].currentOffset = 0;
offsets[0].loopOffset = 0;
offsets[0].endOffset = AX_AUDIO_COUNT - 1;
offsets[0].loopingEnabled = AX_VOICE_LOOP_ENABLED;
offsets[0].dataType = AX_VOICE_FORMAT_LPCM16;
memcpy(&offsets[1], &offsets[0], sizeof(AXVoiceOffsets));
offsets.data = ax->buffer_l;
offsets.currentOffset = 0;
offsets.loopOffset = 0;
offsets.endOffset = AX_AUDIO_COUNT - 1;
offsets.loopingEnabled = AX_VOICE_LOOP_ENABLED;
offsets.dataType = AX_VOICE_FORMAT_LPCM16;
AXSetVoiceOffsets(ax->voice_l, &offsets);
//different buffers per voice
offsets[0].data = ax->buffer_l;
offsets[1].data = ax->buffer_r;
AXSetMultiVoiceOffsets(ax->mvoice, offsets);
offsets.data = ax->buffer_r;
AXSetVoiceOffsets(ax->voice_r, &offsets);
AXSetMultiVoiceSrcType(ax->mvoice, AX_VOICE_SRC_TYPE_NONE);
AXSetMultiVoiceSrcRatio(ax->mvoice, 1.0f);
AXSetVoiceSrcType(ax->voice_l, AX_VOICE_SRC_TYPE_NONE);
AXSetVoiceSrcType(ax->voice_r, AX_VOICE_SRC_TYPE_NONE);
AXSetVoiceSrcRatio(ax->voice_l, 1.0f);
AXSetVoiceSrcRatio(ax->voice_r, 1.0f);
AXVoiceVeData ve = {0x8000, 0};
AXSetVoiceVe(ax->voice_l, &ve);
AXSetVoiceVe(ax->voice_r, &ve);
u32 mix[24] = {0};
mix[0] = 0x80000000;
AXSetVoiceDeviceMix(ax->voice_l, AX_DEVICE_TYPE_DRC, 0, (AXVoiceDeviceMixData*)mix);
AXSetVoiceDeviceMix(ax->voice_l, AX_DEVICE_TYPE_TV, 0, (AXVoiceDeviceMixData*)mix);
mix[0] = 0;
mix[4] = 0x80000000;
AXSetVoiceDeviceMix(ax->voice_r, AX_DEVICE_TYPE_DRC, 0, (AXVoiceDeviceMixData*)mix);
AXSetVoiceDeviceMix(ax->voice_r, AX_DEVICE_TYPE_TV, 0, (AXVoiceDeviceMixData*)mix);
AXVoiceVeData ve = {0xF000, 0};
AXSetMultiVoiceVe(ax->mvoice, &ve);
AXSetVoiceState(ax->voice_l, AX_VOICE_STATE_STOPPED);
AXSetVoiceState(ax->voice_r, AX_VOICE_STATE_STOPPED);
AXSetMultiVoiceDeviceMix(ax->mvoice, AX_DEVICE_TYPE_DRC, 0, 0, 0x8000, 0);
AXSetMultiVoiceDeviceMix(ax->mvoice, AX_DEVICE_TYPE_TV, 0, 0, 0x8000, 0);
AXSetMultiVoiceState(ax->mvoice, AX_VOICE_STATE_STOPPED);
ax->pos = 0;
ax->written = 0;
config_get_ptr()->audio.out_rate = AX_AUDIO_RATE;
AXRegisterAuxCallback(AX_DEVICE_TYPE_DRC, 0, 0, (AXAuxCallback)ax_aux_callback, ax);
OSInitSpinLock(&ax->spinlock);
wiiu_cb_ax = ax;
AXRegisterFrameCallback(wiiu_ax_callback);
return ax;
}
@ -144,115 +152,32 @@ static void* ax_audio_init(const char* device, unsigned rate, unsigned latency)
static void ax_audio_free(void* data)
{
ax_audio_t* ax = (ax_audio_t*)data;
wiiu_cb_ax = NULL;
AXRegisterAuxCallback(AX_DEVICE_TYPE_DRC, 0, 0, NULL, NULL);
AXRegisterFrameCallback(NULL);
AXFreeMultiVoice(ax->mvoice);
AXQuit();
MEM1_free(ax->buffer_l);
MEM1_free(ax->buffer_r);
free(ax);
AXQuit();
}
static void ax_audio_buffer_write(ax_audio_t* ax, const uint16_t* src, int count)
{
uint16_t* dst_l = ax->buffer_l + ax->pos;
uint16_t* dst_r = ax->buffer_r + ax->pos;
uint16_t* dst_l_max = ax->buffer_l + AX_AUDIO_COUNT;
while(count-- && (dst_l < dst_l_max))
{
*dst_l++ = *src++;
*dst_r++ = *src++;
}
DCFlushRange(ax->buffer_l + ax->pos, (dst_l - ax->pos - ax->buffer_l) << 1);
DCFlushRange(ax->buffer_r + ax->pos, (dst_r - ax->pos - ax->buffer_r) << 1);
if(++count)
{
dst_l = ax->buffer_l;
dst_r = ax->buffer_r;
while(count-- && (dst_l < dst_l_max))
{
*dst_l++ = *src++;
*dst_r++ = *src++;
}
DCFlushRange(ax->buffer_l, (dst_l - ax->buffer_l) << 1);
DCFlushRange(ax->buffer_r, (dst_r - ax->buffer_r) << 1);
}
ax->pos = dst_l - ax->buffer_l;
ax->pos &= AX_AUDIO_COUNT_MASK;
}
static ssize_t ax_audio_write(void* data, const void* buf, size_t size)
{
static struct retro_perf_counter ax_audio_write_perf = {0};
ax_audio_t* ax = (ax_audio_t*)data;
const uint16_t* src = buf;
int i;
performance_counter_init(&ax_audio_write_perf, "ax_audio_write");
performance_counter_start(&ax_audio_write_perf);
int count = size >> 2;
AXVoiceOffsets offsets;
AXGetVoiceOffsets(ax->voice_l, &offsets);
if((((offsets.currentOffset - ax->pos) & AX_AUDIO_COUNT_MASK) < (AX_AUDIO_COUNT >> 2)) ||
(((ax->pos - offsets.currentOffset ) & AX_AUDIO_COUNT_MASK) < (AX_AUDIO_COUNT >> 4)) ||
(((offsets.currentOffset - ax->pos) & AX_AUDIO_COUNT_MASK) < (size >> 2)))
{
if (ax->nonblocking)
ax->pos = (offsets.currentOffset + (AX_AUDIO_COUNT >> 1)) & AX_AUDIO_COUNT_MASK;
else
{
do{
retro_sleep(1);
AXGetVoiceOffsets(ax->voice_l, &offsets);
}while(AXIsVoiceRunning(ax->voice_l) &&
(((offsets.currentOffset - ax->pos) & AX_AUDIO_COUNT_MASK) < (AX_AUDIO_COUNT >> 1) ||
(((ax->pos - offsets.currentOffset) & AX_AUDIO_COUNT_MASK) < (AX_AUDIO_COUNT >> 4))));
}
}
// ax_audio_buffer_write(ax, buf, count);
for (i = 0; i < (size >> 1); i += 2)
{
ax->buffer_l[ax->pos] = src[i];
ax->buffer_r[ax->pos] = src[i + 1];
ax->pos++;
ax->pos &= AX_AUDIO_COUNT_MASK;
}
DCFlushRange(ax->buffer_l, AX_AUDIO_SIZE);
DCFlushRange(ax->buffer_r, AX_AUDIO_SIZE);
// if(!AXIsVoiceRunning(ax->voice_l) && (((ax->pos - offsets.currentOffset) & AX_AUDIO_COUNT_MASK) > AX_AUDIO_FRAME_COUNT))
// {
AXSetVoiceState(ax->voice_l, AX_VOICE_STATE_PLAYING);
AXSetVoiceState(ax->voice_r, AX_VOICE_STATE_PLAYING);
// }
performance_counter_stop(&ax_audio_write_perf);
return size;
}
static bool ax_audio_stop(void* data)
{
ax_audio_t* ax = (ax_audio_t*)data;
AXSetVoiceState(ax->voice_l, AX_VOICE_STATE_STOPPED);
AXSetVoiceState(ax->voice_r, AX_VOICE_STATE_STOPPED);
AXSetMultiVoiceState(ax->mvoice, AX_VOICE_STATE_STOPPED);
return true;
}
static bool ax_audio_alive(void* data)
static int ax_audio_limit(int in)
{
ax_audio_t* ax = (ax_audio_t*)data;
return AXIsVoiceRunning(ax->voice_l);
if(in < 0)
in += AX_AUDIO_COUNT;
else if(in >= AX_AUDIO_COUNT)
in -= AX_AUDIO_COUNT;
return in;
}
static bool ax_audio_start(void* data)
@ -265,12 +190,110 @@ static bool ax_audio_start(void* data)
if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
return true;
AXSetVoiceState(ax->voice_l, AX_VOICE_STATE_PLAYING);
AXSetVoiceState(ax->voice_r, AX_VOICE_STATE_PLAYING);
//set back to playing on enough buffered data
if(ax->written > AX_AUDIO_SAMPLE_LOAD)
{
AXSetMultiVoiceCurrentOffset(ax->mvoice, ax_audio_limit(ax->pos - ax->written));
AXSetMultiVoiceState(ax->mvoice, AX_VOICE_STATE_PLAYING);
}
return true;
}
static ssize_t ax_audio_write(void* data, const void* buf, size_t size)
{
static struct retro_perf_counter ax_audio_write_perf = {0};
ax_audio_t* ax = (ax_audio_t*)data;
const uint16_t* src = buf;
int i;
if(!size || (size & 0x3))
return 0;
//measure copy performance from here
performance_counter_init(&ax_audio_write_perf, "ax_audio_write");
performance_counter_start(&ax_audio_write_perf);
int count = size >> 2;
if(count > AX_AUDIO_MAX_FREE)
count = AX_AUDIO_MAX_FREE;
size_t countAvail = (ax->written > AX_AUDIO_MAX_FREE ? 0 : (AX_AUDIO_MAX_FREE - ax->written));
if (ax->nonblocking)
{
//not enough available for 3ms of data
if(countAvail < AX_AUDIO_SAMPLE_COUNT)
count = 0;
}
else if(countAvail < count)
{
//sync, wait for free memory
while(AXIsMultiVoiceRunning(ax->mvoice) && (countAvail < count))
{
OSYieldThread(); //gives threads with same priority time to run
countAvail = (ax->written > AX_AUDIO_MAX_FREE ? 0 : (AX_AUDIO_MAX_FREE - ax->written));
}
}
//over available space, do as much as possible
if(count > countAvail)
count = countAvail;
//make sure we have input size
if(count > 0)
{
//write in new data
size_t startPos = ax->pos;
int flushP2needed = 0;
int flushP2 = 0;
for (i = 0; i < (count << 1); i += 2)
{
ax->buffer_l[ax->pos] = src[i];
ax->buffer_r[ax->pos] = src[i + 1];
ax->pos = ax_audio_limit(ax->pos + 1);
//wrapped around, make sure to store cache
if(ax->pos == 0)
{
flushP2needed = 1;
flushP2 = ((count << 1) - i);
DCStoreRangeNoSync(ax->buffer_l+startPos, (AX_AUDIO_COUNT-startPos) << 1);
DCStoreRangeNoSync(ax->buffer_r+startPos, (AX_AUDIO_COUNT-startPos) << 1);
}
}
//standard cache store case
if(!flushP2needed)
{
DCStoreRangeNoSync(ax->buffer_l+startPos, count << 1);
DCStoreRange(ax->buffer_r+startPos, count << 1);
} //store the rest after wrap
else if(flushP2 > 0)
{
DCStoreRangeNoSync(ax->buffer_l, flushP2);
DCStoreRange(ax->buffer_r, flushP2);
}
//add in new audio data
if(OSUninterruptibleSpinLock_Acquire(&ax->spinlock))
{
ax->written += count;
OSUninterruptibleSpinLock_Release(&ax->spinlock);
}
}
//possibly buffer underrun
if(!AXIsMultiVoiceRunning(ax->mvoice))
{
//checks if it can be started
ax_audio_start(ax);
}
//done copying new data
performance_counter_stop(&ax_audio_write_perf);
//return what was actually copied
return (count << 2);
}
static bool ax_audio_alive(void* data)
{
ax_audio_t* ax = (ax_audio_t*)data;
return AXIsMultiVoiceRunning(ax->mvoice);
}
static void ax_audio_set_nonblock_state(void* data, bool state)
{
ax_audio_t* ax = (ax_audio_t*)data;
@ -289,10 +312,9 @@ static size_t ax_audio_write_avail(void* data)
{
ax_audio_t* ax = (ax_audio_t*)data;
AXVoiceOffsets offsets;
AXGetVoiceOffsets(ax->voice_l, &offsets);
size_t ret = AX_AUDIO_COUNT - ax->written;
return (offsets.currentOffset - ax->pos) & AX_AUDIO_COUNT_MASK;
return (ret < AX_AUDIO_SAMPLE_COUNT ? 0 : ret);
}
static size_t ax_audio_buffer_size(void* data)

203
cheevos.c
View File

@ -18,6 +18,7 @@
#include <formats/jsonsax.h>
#include <streams/file_stream.h>
#include <compat/strl.h>
#include <rhash.h>
#include <libretro.h>
@ -62,6 +63,10 @@
* from retroachievements.org. */
#undef CHEEVOS_JSON_OVERRIDE
/* Define this macro to have the password and token logged. THIS WILL DISCLOSE
* THE USER'S PASSWORD, TAKE CARE! */
#undef CHEEVOS_LOG_PASSWORD
/* C89 wants only int values in enums. */
#define CHEEVOS_JSON_KEY_GAMEID 0xb4960eecU
#define CHEEVOS_JSON_KEY_ACHIEVEMENTS 0x69749ae1U
@ -268,7 +273,6 @@ typedef struct
typedef struct
{
int loaded;
int console_id;
bool core_supports;
@ -280,9 +284,9 @@ typedef struct
retro_ctx_memory_info_t meminfo[4];
} cheevos_locals_t;
static cheevos_locals_t cheevos_locals =
{
0,
0,
true,
{NULL, 0},
@ -290,13 +294,74 @@ static cheevos_locals_t cheevos_locals =
{0}
};
static int cheats_are_enabled = 0;
static int cheats_were_enabled = 0;
bool cheevos_loaded = false;
int cheats_are_enabled = 0;
int cheats_were_enabled = 0;
/*****************************************************************************
Supporting functions.
*****************************************************************************/
#ifdef CHEEVOS_LOG_URLS
static void cheevos_log_url(const char* format, const char* url)
{
#ifdef CHEEVOS_LOG_PASSWORD
RARCH_LOG(format, url);
#else
char copy[256];
char* aux;
char* next;
strlcpy(copy, url, sizeof(copy));
aux = strstr(copy, "?p=");
if (aux == NULL)
aux = strstr(copy, "&p=");
if (aux != NULL)
{
aux += 3;
next = strchr(aux, '&');
if (next != NULL)
{
do
{
*aux++ = *next++;
}
while (next[-1] != 0);
}
else
*aux = 0;
}
aux = strstr(copy, "?t=");
if (aux == NULL)
aux = strstr(copy, "&t=");
if (aux != NULL)
{
aux += 3;
next = strchr(aux, '&');
if (next != NULL)
{
do
{
*aux++ = *next++;
}
while (next[-1] != 0);
}
else
*aux = 0;
}
RARCH_LOG(format, copy);
#endif
}
#endif
#ifdef CHEEVOS_VERBOSE
static void cheevos_add_char(char** aux, size_t* left, char k)
{
@ -396,17 +461,6 @@ static void cheevos_log_cond(const cheevos_cond_t* cond)
static void cheevos_log_cheevo(const cheevo_t* cheevo,
const cheevos_field_t* memaddr_ud)
{
char memaddr[256];
size_t length;
length = memaddr_ud->length + 1;
if (length >= sizeof(memaddr))
length = sizeof(memaddr);
strncpy(memaddr, memaddr_ud->string, length - 1);
memaddr[length - 1] = 0;
RARCH_LOG("CHEEVOS cheevo %p\n", cheevo);
RARCH_LOG("CHEEVOS id: %u\n", cheevo->id);
RARCH_LOG("CHEEVOS title: %s\n", cheevo->title);
@ -415,7 +469,7 @@ static void cheevos_log_cheevo(const cheevo_t* cheevo,
RARCH_LOG("CHEEVOS badge: %s\n", cheevo->badge);
RARCH_LOG("CHEEVOS points: %u\n", cheevo->points);
RARCH_LOG("CHEEVOS sets: TBD\n");
RARCH_LOG("CHEEVOS memaddr: %s\n", memaddr);
RARCH_LOG("CHEEVOS memaddr: %.*s\n", (int)memaddr_ud->length, memaddr_ud->string);
}
static void cheevos_add_var_size(char** aux, size_t* left,
@ -687,8 +741,7 @@ static int cheevos_get_value(const char *json, unsigned key_hash,
if ((jsonsax_parse(json, &handlers, (void*)&ud) == JSONSAX_OK)
&& ud.value && ud.length < length)
{
strncpy(value, ud.value, length);
value[ud.length] = 0;
strlcpy(value, ud.value, ud.length + 1);
return 0;
}
@ -919,9 +972,8 @@ void cheevos_parse_guest_addr(cheevos_var_t *var, unsigned value)
switch (cheevos_locals.console_id)
{
/* Patch the address to correctly map it to the mmaps */
case CHEEVOS_CONSOLE_GAMEBOY_ADVANCE:
/* Patch the address to correctly map it to the mmaps */
if (var->value < 0x8000) /* Internal RAM */
var->value += 0x3000000;
else /* Work RAM */
@ -930,6 +982,15 @@ void cheevos_parse_guest_addr(cheevos_var_t *var, unsigned value)
case CHEEVOS_CONSOLE_PC_ENGINE:
var->value += 0x1f0000;
break;
case CHEEVOS_CONSOLE_SUPER_NINTENDO:
if (var->value < 0x020000) /* Work RAM */
var->value += 0x7e0000;
else /* Save RAM */
{
var->value -= 0x020000;
var->value += 0x006000;
}
break;
default:
break;
}
@ -1445,18 +1506,25 @@ Test all the achievements (call once per frame).
uint8_t *cheevos_get_memory(const cheevos_var_t *var)
{
uint8_t *memory;
if (var->bank_id >= 0)
{
rarch_system_info_t *system;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if (system->mmaps.num_descriptors != 0)
return (uint8_t *)system->mmaps.descriptors[var->bank_id].core.ptr + var->value;
return (uint8_t *)cheevos_locals.meminfo[var->bank_id].data + var->value;
memory = (uint8_t *)system->mmaps.descriptors[var->bank_id].core.ptr;
else
memory = (uint8_t *)cheevos_locals.meminfo[var->bank_id].data;
if (memory)
memory += var->value;
}
return NULL;
else
memory = NULL;
return memory;
}
static unsigned cheevos_get_var_value(cheevos_var_t *var)
@ -1781,7 +1849,7 @@ static int cheevos_login(retro_time_t *timeout)
request[sizeof(request) - 1] = 0;
#ifdef CHEEVOS_LOG_URLS
RARCH_LOG("CHEEVOS url to login: %s\n", request);
cheevos_log_url("CHEEVOS url to login: %s\n", request);
#endif
if (!cheevos_http_get(&json, NULL, request, timeout))
@ -1797,9 +1865,6 @@ static int cheevos_login(retro_time_t *timeout)
runloop_msg_queue_push("Retro Achievements login error.",
0, 5 * 60, false);
runloop_msg_queue_push(
"Please make sure your account information is correct.",
0, 5 * 60, false);
RARCH_ERR("CHEEVOS error getting user token.\n");
return -1;
}
@ -1818,7 +1883,7 @@ static void cheevos_make_unlock_url(const cheevo_t *cheevo, char* url, size_t ur
url[url_size - 1] = 0;
#ifdef CHEEVOS_LOG_URLS
RARCH_LOG("CHEEVOS url to award the cheevo: %s\n", url);
cheevos_log_url("CHEEVOS url to award the cheevo: %s\n", url);
#endif
}
@ -1942,7 +2007,7 @@ static int cheevos_get_by_game_id(const char **json,
request[sizeof(request) - 1] = 0;
#ifdef CHEEVOS_LOG_URLS
RARCH_LOG("CHEEVOS url to get the list of cheevos: %s\n", request);
cheevos_log_url("CHEEVOS url to get the list of cheevos: %s\n", request);
#endif
if (!cheevos_http_get(json, NULL, request, timeout))
@ -1987,7 +2052,7 @@ static unsigned cheevos_get_game_id(unsigned char *hash, retro_time_t *timeout)
request[sizeof(request) - 1] = 0;
#ifdef CHEEVOS_LOG_URLS
RARCH_LOG("CHEEVOS url to get the game's id: %s\n", request);
cheevos_log_url("CHEEVOS url to get the game's id: %s\n", request);
#endif
if (!cheevos_http_get(&json, NULL, request, timeout))
@ -2021,7 +2086,7 @@ static void cheevos_make_playing_url(unsigned game_id, char* url, size_t url_siz
url[url_size - 1] = 0;
#ifdef CHEEVOS_LOG_URLS
RARCH_LOG("CHEEVOS url to post the 'playing' activity: %s\n", url);
cheevos_log_url("CHEEVOS url to post the 'playing' activity: %s\n", url);
#endif
}
@ -2148,7 +2213,7 @@ static int cheevos_deactivate_unlocks(unsigned game_id, retro_time_t *timeout)
request[sizeof(request) - 1] = 0;
#ifdef CHEEVOS_LOG_URLS
RARCH_LOG("CHEEVOS url to get the list of unlocked cheevos in softcore: %s\n", request);
cheevos_log_url("CHEEVOS url to get the list of unlocked cheevos in softcore: %s\n", request);
#endif
if (!cheevos_http_get(&json, NULL, request, timeout))
@ -2177,7 +2242,7 @@ static int cheevos_deactivate_unlocks(unsigned game_id, retro_time_t *timeout)
request[sizeof(request) - 1] = 0;
#ifdef CHEEVOS_LOG_URLS
RARCH_LOG("CHEEVOS url to get the list of unlocked cheevos in hardcore: %s\n", request);
cheevos_log_url("CHEEVOS url to get the list of unlocked cheevos in hardcore: %s\n", request);
#endif
if (!cheevos_http_get(&json, NULL, request, timeout))
@ -2244,13 +2309,10 @@ static size_t cheevos_eval_md5(
size_t size = 0;
RFILE *file = filestream_open(info->path, RFILE_MODE_READ, 0);
filestream_seek(file, offset, SEEK_SET);
if (!file)
return 0;
if (max_size == 0)
max_size = (size_t)-1;
filestream_seek(file, offset, SEEK_SET);
for (;;)
{
@ -2258,7 +2320,7 @@ static size_t cheevos_eval_md5(
ssize_t num_read;
size_t to_read = sizeof(buffer);
if (to_read > max_size)
if (max_size != 0 && to_read > max_size)
to_read = max_size;
num_read = filestream_read(file, (void*)buffer, to_read);
@ -2268,7 +2330,14 @@ static size_t cheevos_eval_md5(
MD5_Update(ctx, (void*)buffer, num_read);
size += num_read;
max_size -= num_read;
if (max_size != 0)
{
max_size -= num_read;
if (max_size == 0)
break;
}
}
filestream_close(file);
@ -2328,9 +2397,10 @@ static unsigned cheevos_find_game_id_snes(
return 0;
}
cheevos_fill_md5(CHEEVOS_EIGHT_MB - count, 0, &ctx);
if (count < CHEEVOS_EIGHT_MB)
cheevos_fill_md5(CHEEVOS_EIGHT_MB - count, 0, &ctx);
MD5_Final(hash, &ctx);
return cheevos_get_game_id(hash, &timeout);
}
@ -2347,9 +2417,10 @@ static unsigned cheevos_find_game_id_genesis(
return 0;
}
cheevos_fill_md5(CHEEVOS_SIX_MB - count, 0, &ctx);
if (count < CHEEVOS_SIX_MB)
cheevos_fill_md5(CHEEVOS_SIX_MB - count, 0, &ctx);
MD5_Final(hash, &ctx);
return cheevos_get_game_id(hash, &timeout);
}
@ -2487,7 +2558,7 @@ bool cheevos_load(const void *data)
url[0] = '\0';
cheevos_locals.loaded = 0;
cheevos_loaded = 0;
/* Just return OK if the core doesn't support cheevos, or info is NULL. */
if (!cheevos_locals.core_supports || !info)
@ -2505,7 +2576,6 @@ bool cheevos_load(const void *data)
cheevos_locals.meminfo[3].id = RETRO_MEMORY_RTC;
core_get_memory(&cheevos_locals.meminfo[3]);
#ifdef CHEEVOS_VERBOSE
RARCH_LOG("CHEEVOS system RAM: %p %u\n",
cheevos_locals.meminfo[0].data, cheevos_locals.meminfo[0].size);
RARCH_LOG("CHEEVOS save RAM: %p %u\n",
@ -2514,7 +2584,6 @@ bool cheevos_load(const void *data)
cheevos_locals.meminfo[2].data, cheevos_locals.meminfo[2].size);
RARCH_LOG("CHEEVOS RTC: %p %u\n",
cheevos_locals.meminfo[3].data, cheevos_locals.meminfo[3].size);
#endif
/* Bail out if cheevos are disabled.
* But set the above anyways, command_read_ram needs it. */
@ -2600,14 +2669,14 @@ found:
fclose(file);
}
#else
if (!cheevos_get_by_game_id(&json, game_id, &timeout))
if (cheevos_get_by_game_id(&json, game_id, &timeout) == 0 && json != NULL)
#endif
{
if (!cheevos_parse(json))
{
cheevos_deactivate_unlocks(game_id, &timeout);
free((void*)json);
cheevos_locals.loaded = 1;
cheevos_loaded = true;
cheevos_make_playing_url(game_id, url, sizeof(url));
task_push_http_transfer(url, true, NULL,
@ -2629,17 +2698,13 @@ void cheevos_reset_game(void)
const cheevo_t *end = cheevo + cheevos_locals.core.count;
for (; cheevo < end; cheevo++)
{
cheevo->last = 1;
}
cheevo = cheevos_locals.unofficial.cheevos;
end = cheevo + cheevos_locals.unofficial.count;
for (; cheevo < end; cheevo++)
{
cheevo->last = 1;
}
}
void cheevos_populate_menu(void *data, bool hardcore)
@ -2757,9 +2822,7 @@ bool cheevos_get_description(cheevos_ctx_desc_t *desc)
desc->idx -= cheevos_locals.unofficial.count;
}
strncpy(desc->s, cheevos[desc->idx].description, desc->len);
desc->s[desc->len - 1] = 0;
strlcpy(desc->s, cheevos[desc->idx].description, desc->len);
return true;
}
@ -2773,13 +2836,13 @@ bool cheevos_apply_cheats(bool *data_bool)
bool cheevos_unload(void)
{
if (!cheevos_locals.loaded)
if (!cheevos_loaded)
return false;
cheevos_free_cheevo_set(&cheevos_locals.core);
cheevos_free_cheevo_set(&cheevos_locals.unofficial);
cheevos_locals.loaded = 0;
cheevos_loaded = false;
return true;
}
@ -2809,28 +2872,18 @@ bool cheevos_toggle_hardcore_mode(void)
return true;
}
bool cheevos_test(void)
void cheevos_test(void)
{
if (!cheevos_locals.loaded)
return false;
settings_t *settings = config_get_ptr();
if (!cheats_are_enabled && !cheats_were_enabled)
{
settings_t *settings = config_get_ptr();
if (!settings->cheevos.enable)
return false;
cheevos_test_cheevo_set(&cheevos_locals.core);
cheevos_test_cheevo_set(&cheevos_locals.core);
if (settings->cheevos.test_unofficial)
cheevos_test_cheevo_set(&cheevos_locals.unofficial);
if (settings->cheevos.test_unofficial)
cheevos_test_cheevo_set(&cheevos_locals.unofficial);
#if 0
cheevos_test_leaderboards();
cheevos_test_leaderboards();
#endif
}
return true;
}
bool cheevos_set_cheats(void)

View File

@ -53,7 +53,7 @@ bool cheevos_unload(void);
bool cheevos_toggle_hardcore_mode(void);
bool cheevos_test(void);
void cheevos_test(void);
bool cheevos_set_cheats(void);
@ -65,6 +65,10 @@ void cheevos_parse_guest_addr(cheevos_var_t *var, unsigned value);
uint8_t *cheevos_get_memory(const cheevos_var_t *var);
extern bool cheevos_loaded;
extern int cheats_are_enabled;
extern int cheats_were_enabled;
RETRO_END_DECLS
#endif /* __RARCH_CHEEVOS_H */

View File

@ -294,6 +294,7 @@ static const struct cmd_map map[] = {
{ "DISK_NEXT", RARCH_DISK_NEXT },
{ "DISK_PREV", RARCH_DISK_PREV },
{ "GRAB_MOUSE_TOGGLE", RARCH_GRAB_MOUSE_TOGGLE },
{ "GAME_FOCUS_TOGGLE", RARCH_GAME_FOCUS_TOGGLE },
{ "MENU_TOGGLE", RARCH_MENU_TOGGLE },
{ "MENU_UP", RETRO_DEVICE_ID_JOYPAD_UP },
{ "MENU_DOWN", RETRO_DEVICE_ID_JOYPAD_DOWN },
@ -1899,7 +1900,7 @@ bool command_event(enum event_command cmd, void *data)
settings->state_slot++;
break;
case CMD_EVENT_TAKE_SCREENSHOT:
if (!take_screenshot())
if (!take_screenshot(path_get(RARCH_PATH_BASENAME), false))
return false;
break;
case CMD_EVENT_UNLOAD_CORE:
@ -1936,6 +1937,7 @@ bool command_event(enum event_command cmd, void *data)
video_driver_reinit();
/* Poll input to avoid possibly stale data to corrupt things. */
input_driver_poll();
command_event(CMD_EVENT_GAME_FOCUS_TOGGLE, (void *) -1);
#ifdef HAVE_MENU
menu_display_set_framebuffer_dirty_flag();
@ -2034,7 +2036,8 @@ bool command_event(enum event_command cmd, void *data)
break;
case CMD_EVENT_OVERLAY_DEINIT:
#ifdef HAVE_OVERLAY
input_overlay_free();
input_overlay_free(overlay_ptr);
overlay_ptr = NULL;
#endif
break;
case CMD_EVENT_OVERLAY_INIT:
@ -2046,7 +2049,7 @@ bool command_event(enum event_command cmd, void *data)
break;
case CMD_EVENT_OVERLAY_NEXT:
#ifdef HAVE_OVERLAY
input_overlay_next(settings->input.overlay_opacity);
input_overlay_next(overlay_ptr, settings->input.overlay_opacity);
#endif
break;
case CMD_EVENT_DSP_FILTER_DEINIT:
@ -2184,17 +2187,17 @@ bool command_event(enum event_command cmd, void *data)
break;
case CMD_EVENT_OVERLAY_SET_SCALE_FACTOR:
#ifdef HAVE_OVERLAY
input_overlay_set_scale_factor(NULL, settings->input.overlay_scale);
input_overlay_set_scale_factor(overlay_ptr, settings->input.overlay_scale);
#endif
break;
case CMD_EVENT_OVERLAY_SET_ALPHA_MOD:
#ifdef HAVE_OVERLAY
input_overlay_set_alpha_mod(settings->input.overlay_opacity);
input_overlay_set_alpha_mod(overlay_ptr, settings->input.overlay_opacity);
#endif
break;
case CMD_EVENT_AUDIO_REINIT:
{
int flags = DRIVER_AUDIO;
int flags = DRIVER_AUDIO_MASK;
driver_ctl(RARCH_DRIVER_CTL_UNINIT, &flags);
driver_ctl(RARCH_DRIVER_CTL_INIT, &flags);
}
@ -2358,7 +2361,7 @@ bool command_event(enum event_command cmd, void *data)
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
#ifdef HAVE_NETWORKING
if (!init_netplay(
settings->netplay.is_spectate, settings->netplay.server,
settings->netplay.is_spectate, data, settings->netplay.server,
settings->netplay.port))
return false;
#endif
@ -2494,6 +2497,47 @@ bool command_event(enum event_command cmd, void *data)
video_driver_show_mouse();
}
break;
case CMD_EVENT_GAME_FOCUS_TOGGLE:
{
static bool game_focus_state = false;
long int mode = (long int)data;
/* mode = -1: restores current game focus state
* mode = 1: force set game focus, instead of toggling
* any other: toggle
*/
if (mode == 1)
game_focus_state = true;
else if (mode != -1)
game_focus_state = !game_focus_state;
RARCH_LOG("%s: %s.\n",
"Game focus is: ",
game_focus_state ? "on" : "off");
if (game_focus_state)
{
input_driver_grab_mouse();
video_driver_hide_mouse();
input_driver_set_hotkey_block();
input_driver_keyboard_mapping_set_block(1);
if (mode != -1)
runloop_msg_queue_push(msg_hash_to_str(MSG_GAME_FOCUS_ON),
1, 120, true);
}
else
{
input_driver_ungrab_mouse();
video_driver_show_mouse();
input_driver_unset_hotkey_block();
input_driver_keyboard_mapping_set_block(0);
if (mode != -1)
runloop_msg_queue_push(msg_hash_to_str(MSG_GAME_FOCUS_OFF),
1, 120, true);
}
}
break;
case CMD_EVENT_PERFCNT_REPORT_FRONTEND_LOG:
rarch_perf_log();
break;

View File

@ -204,6 +204,8 @@ enum event_command
CMD_EVENT_RUMBLE_STOP,
/* Toggles mouse grab. */
CMD_EVENT_GRAB_MOUSE_TOGGLE,
/* Toggles game focus. */
CMD_EVENT_GAME_FOCUS_TOGGLE,
/* Toggles fullscreen mode. */
CMD_EVENT_FULLSCREEN_TOGGLE,
CMD_EVENT_PERFCNT_REPORT_FRONTEND_LOG,

View File

@ -25,9 +25,9 @@
#include "config.h"
#endif
enum
enum video_driver_enum
{
VIDEO_GL = 0,
VIDEO_GL = 0,
VIDEO_VULKAN,
VIDEO_DRM,
VIDEO_XVIDEO,
@ -43,13 +43,16 @@ enum
VIDEO_CTR,
VIDEO_D3D9,
VIDEO_VG,
VIDEO_NULL,
VIDEO_OMAP,
VIDEO_EXYNOS,
VIDEO_SUNXI,
VIDEO_DISPMANX,
VIDEO_NULL
};
AUDIO_RSOUND,
enum audio_driver_enum
{
AUDIO_RSOUND = VIDEO_NULL + 1,
AUDIO_OSS,
AUDIO_ALSA,
AUDIO_ALSATHREAD,
@ -71,13 +74,20 @@ enum
AUDIO_RWEBAUDIO,
AUDIO_PSP,
AUDIO_CTR,
AUDIO_NULL,
AUDIO_NULL
};
AUDIO_RESAMPLER_CC,
enum audio_resampler_driver_enum
{
AUDIO_RESAMPLER_CC = AUDIO_NULL + 1,
AUDIO_RESAMPLER_SINC,
AUDIO_RESAMPLER_NEAREST,
AUDIO_RESAMPLER_NULL
};
INPUT_ANDROID,
enum input_driver_enum
{
INPUT_ANDROID = AUDIO_RESAMPLER_NULL + 1,
INPUT_SDL,
INPUT_SDL2,
INPUT_X,
@ -95,9 +105,12 @@ enum
INPUT_COCOA,
INPUT_QNX,
INPUT_RWEBINPUT,
INPUT_NULL,
INPUT_NULL
};
JOYPAD_PS3,
enum joypad_driver_enum
{
JOYPAD_PS3 = INPUT_NULL + 1,
JOYPAD_XINPUT,
JOYPAD_GX,
JOYPAD_WIIU,
@ -111,31 +124,50 @@ enum
JOYPAD_SDL,
JOYPAD_HID,
JOYPAD_QNX,
JOYPAD_NULL,
JOYPAD_NULL
};
CAMERA_V4L2,
enum camera_driver_enum
{
CAMERA_V4L2 = JOYPAD_NULL + 1,
CAMERA_RWEBCAM,
CAMERA_ANDROID,
CAMERA_AVFOUNDATION,
CAMERA_NULL,
CAMERA_NULL
};
WIFI_CONNMANCTL,
WIFI_NULL,
enum wifi_driver_enum
{
WIFI_CONNMANCTL = CAMERA_NULL + 1,
WIFI_NULL
};
LOCATION_ANDROID,
enum location_driver_enum
{
LOCATION_ANDROID = WIFI_NULL + 1,
LOCATION_CORELOCATION,
LOCATION_NULL,
LOCATION_NULL
};
OSK_PS3,
OSK_NULL,
enum osk_driver_enum
{
OSK_PS3 = LOCATION_NULL + 1,
OSK_NULL
};
MENU_RGUI,
enum menu_driver_enum
{
MENU_RGUI = OSK_NULL + 1,
MENU_XUI,
MENU_MATERIALUI,
MENU_XMB,
MENU_NUKLEAR,
MENU_NULL
};
RECORD_FFMPEG,
enum record_driver_enum
{
RECORD_FFMPEG = MENU_NULL + 1,
RECORD_NULL
};
@ -191,12 +223,12 @@ enum
#define AUDIO_DEFAULT_DRIVER AUDIO_PSP
#elif defined(_3DS)
#define AUDIO_DEFAULT_DRIVER AUDIO_CTR
#elif defined(HAVE_PULSE)
#define AUDIO_DEFAULT_DRIVER AUDIO_PULSE
#elif defined(HAVE_ALSA) && defined(HAVE_VIDEOCORE)
#define AUDIO_DEFAULT_DRIVER AUDIO_ALSATHREAD
#elif defined(HAVE_ALSA)
#define AUDIO_DEFAULT_DRIVER AUDIO_ALSA
#elif defined(HAVE_PULSE)
#define AUDIO_DEFAULT_DRIVER AUDIO_PULSE
#elif defined(HAVE_OSS)
#define AUDIO_DEFAULT_DRIVER AUDIO_OSS
#elif defined(HAVE_JACK)
@ -351,8 +383,10 @@ enum
#define MENU_DEFAULT_DRIVER MENU_MATERIALUI
#elif defined(HAVE_XMB)
#define MENU_DEFAULT_DRIVER MENU_XMB
#else
#elif defined(HAVE_RGUI)
#define MENU_DEFAULT_DRIVER MENU_RGUI
#else
#define MENU_DEFAULT_DRIVER MENU_NULL
#endif
#if defined(XENON) || defined(_XBOX360) || defined(__CELLOS_LV2__)
@ -421,6 +455,12 @@ static const bool windowed_fullscreen = true;
* specific monitors, 1 being the first monitor. */
static const unsigned monitor_index = 0;
/* Window */
/* Window size. A value of 0 uses window scale
* multiplied by the core framebuffer size. */
static const unsigned window_x = 0;
static const unsigned window_y = 0;
/* Fullscreen resolution. A value of 0 uses the desktop
* resolution. */
static const unsigned fullscreen_x = 0;
@ -431,7 +471,7 @@ static const bool load_dummy_on_core_shutdown = false;
#else
static const bool load_dummy_on_core_shutdown = true;
#endif
static const bool check_firmware_before_loading = false;
/* Forcibly disable composition.
* Only valid on Windows Vista/7/8 for now. */
static const bool disable_composition = false;
@ -599,14 +639,6 @@ static bool default_auto_shaders_enable = true;
static bool default_sort_savefiles_enable = false;
static bool default_sort_savestates_enable = false;
static unsigned default_menu_btn_ok = RETRO_DEVICE_ID_JOYPAD_A;
static unsigned default_menu_btn_cancel = RETRO_DEVICE_ID_JOYPAD_B;
static unsigned default_menu_btn_search = RETRO_DEVICE_ID_JOYPAD_X;
static unsigned default_menu_btn_default = RETRO_DEVICE_ID_JOYPAD_START;
static unsigned default_menu_btn_info = RETRO_DEVICE_ID_JOYPAD_SELECT;
static unsigned default_menu_btn_scroll_down = RETRO_DEVICE_ID_JOYPAD_R;
static unsigned default_menu_btn_scroll_up = RETRO_DEVICE_ID_JOYPAD_L;
#if defined(__CELLOS_LV2__) || defined(_XBOX1) || defined(_XBOX360)
static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_L3_R3;
#elif defined(VITA)
@ -620,12 +652,14 @@ static unsigned input_backtouch_enable = false;
static unsigned input_backtouch_toggle = false;
#endif
#ifdef ANDROID
static bool back_as_menu_toggle_enable = true;
#endif
static bool all_users_control_menu = false;
#if defined(ANDROID) || defined(_WIN32)
static bool menu_swap_ok_cancel_buttons = true;
#else
static bool menu_swap_ok_cancel_buttons = false;
#endif
/* Crop overscanned frames. */
static const bool crop_overscan = true;
@ -764,6 +798,10 @@ static const unsigned autosave_interval = 0;
* user 1 rather than user 2. */
static const bool netplay_client_swap_input = true;
static const unsigned netplay_delay_frames = 16;
static const unsigned netplay_check_frames = 30;
/* On save state load, block SRAM from being overwritten.
* This could potentially lead to buggy games. */
static const bool block_sram_overwrite = false;
@ -781,6 +819,8 @@ static const bool savestate_auto_index = false;
static const bool savestate_auto_save = false;
static const bool savestate_auto_load = false;
static const bool savestate_thumbnail_enable = false;
/* Slowmotion ratio. */
static const float slowmotion_ratio = 3.0;
@ -877,7 +917,7 @@ static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/apple/
#elif defined(_WIN32) && !defined(_XBOX)
#if defined(__x86_64__)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/win-x86_64/latest/";
#elif defined(__i386__) || defined(__i486__) || defined(__i686__)
#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_IX86) || defined(_M_IA64)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/win-x86/latest/";
#endif
#elif defined(__linux__)
@ -957,6 +997,7 @@ static const struct retro_keybind retro_keybinds_1[] = {
{ true, RARCH_DISK_NEXT, MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_NEXT, RETROK_UNKNOWN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_DISK_PREV, MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_PREV, RETROK_UNKNOWN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_GRAB_MOUSE_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_GRAB_MOUSE_TOGGLE, RETROK_F11, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_GAME_FOCUS_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_GAME_FOCUS_TOGGLE, RETROK_SCROLLOCK, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_MENU_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_MENU_TOGGLE, RETROK_F1, NO_BTN, 0, AXIS_NONE },
};

View File

@ -158,7 +158,9 @@ bool config_init(void)
**/
const char *config_get_default_audio(void)
{
switch (AUDIO_DEFAULT_DRIVER)
enum audio_driver_enum default_driver = AUDIO_DEFAULT_DRIVER;
switch (default_driver)
{
case AUDIO_RSOUND:
return "rsound";
@ -206,7 +208,9 @@ const char *config_get_default_audio(void)
return "csnd";
case AUDIO_RWEBAUDIO:
return "rwebaudio";
default:
case AUDIO_JACK:
return "jack";
case AUDIO_NULL:
break;
}
@ -215,11 +219,13 @@ const char *config_get_default_audio(void)
const char *config_get_default_record(void)
{
switch (RECORD_DEFAULT_DRIVER)
enum record_driver_enum default_driver = RECORD_DEFAULT_DRIVER;
switch (default_driver)
{
case RECORD_FFMPEG:
return "ffmpeg";
default:
case RECORD_NULL:
break;
}
@ -235,7 +241,9 @@ const char *config_get_default_record(void)
**/
const char *config_get_default_audio_resampler(void)
{
switch (AUDIO_DEFAULT_RESAMPLER_DRIVER)
enum audio_resampler_driver_enum default_driver = AUDIO_DEFAULT_RESAMPLER_DRIVER;
switch (default_driver)
{
case AUDIO_RESAMPLER_CC:
return "cc";
@ -243,7 +251,7 @@ const char *config_get_default_audio_resampler(void)
return "sinc";
case AUDIO_RESAMPLER_NEAREST:
return "nearest";
default:
case AUDIO_RESAMPLER_NULL:
break;
}
@ -259,7 +267,9 @@ const char *config_get_default_audio_resampler(void)
**/
const char *config_get_default_video(void)
{
switch (VIDEO_DEFAULT_DRIVER)
enum video_driver_enum default_driver = VIDEO_DEFAULT_DRIVER;
switch (default_driver)
{
case VIDEO_GL:
return "gl";
@ -300,7 +310,7 @@ const char *config_get_default_video(void)
return "dispmanx";
case VIDEO_SUNXI:
return "sunxi";
default:
case VIDEO_NULL:
break;
}
@ -316,7 +326,9 @@ const char *config_get_default_video(void)
**/
const char *config_get_default_input(void)
{
switch (INPUT_DEFAULT_DRIVER)
enum input_driver_enum default_driver = INPUT_DEFAULT_DRIVER;
switch (default_driver)
{
case INPUT_ANDROID:
return "android";
@ -358,8 +370,8 @@ const char *config_get_default_input(void)
return "qnx_input";
case INPUT_RWEBINPUT:
return "rwebinput";
default:
break;
case INPUT_NULL:
break;
}
return "null";
@ -374,7 +386,9 @@ const char *config_get_default_input(void)
**/
const char *config_get_default_joypad(void)
{
switch (JOYPAD_DEFAULT_DRIVER)
enum joypad_driver_enum default_driver = JOYPAD_DEFAULT_DRIVER;
switch (default_driver)
{
case JOYPAD_PS3:
return "ps3";
@ -412,7 +426,7 @@ const char *config_get_default_joypad(void)
return "hid";
case JOYPAD_QNX:
return "qnx";
default:
case JOYPAD_NULL:
break;
}
@ -429,7 +443,9 @@ const char *config_get_default_joypad(void)
**/
const char *config_get_default_camera(void)
{
switch (CAMERA_DEFAULT_DRIVER)
enum camera_driver_enum default_driver = CAMERA_DEFAULT_DRIVER;
switch (default_driver)
{
case CAMERA_V4L2:
return "video4linux2";
@ -439,7 +455,7 @@ const char *config_get_default_camera(void)
return "android";
case CAMERA_AVFOUNDATION:
return "avfoundation";
default:
case CAMERA_NULL:
break;
}
@ -455,11 +471,13 @@ const char *config_get_default_camera(void)
**/
const char *config_get_default_wifi(void)
{
switch (WIFI_DEFAULT_DRIVER)
enum wifi_driver_enum default_driver = WIFI_DEFAULT_DRIVER;
switch (default_driver)
{
case WIFI_CONNMANCTL:
return "connmanctl";
default:
case WIFI_NULL:
break;
}
@ -475,13 +493,15 @@ const char *config_get_default_wifi(void)
**/
const char *config_get_default_location(void)
{
switch (LOCATION_DEFAULT_DRIVER)
enum location_driver_enum default_driver = LOCATION_DEFAULT_DRIVER;
switch (default_driver)
{
case LOCATION_ANDROID:
return "android";
case LOCATION_CORELOCATION:
return "corelocation";
default:
case LOCATION_NULL:
break;
}
@ -498,10 +518,12 @@ const char *config_get_default_location(void)
**/
const char *config_get_default_menu(void)
{
enum menu_driver_enum default_driver = MENU_DEFAULT_DRIVER;
if (!string_is_empty(g_defaults.settings.menu))
return g_defaults.settings.menu;
switch (MENU_DEFAULT_DRIVER)
switch (default_driver)
{
case MENU_RGUI:
return "rgui";
@ -513,26 +535,13 @@ const char *config_get_default_menu(void)
return "xmb";
case MENU_NUKLEAR:
return "nuklear";
default:
case MENU_NULL:
break;
}
return "null";
}
static unsigned config_menu_btn_ok_default(void)
{
if (g_defaults.menu.controls.set)
return g_defaults.menu.controls.menu_btn_ok;
return default_menu_btn_ok;
}
static unsigned config_menu_btn_cancel_default(void)
{
if (g_defaults.menu.controls.set)
return g_defaults.menu.controls.menu_btn_cancel;
return default_menu_btn_cancel;
}
#endif
bool config_overlay_enable_default(void)
@ -630,8 +639,6 @@ static int populate_settings_path(settings_t *settings, struct config_path_setti
#ifdef HAVE_OVERLAY
SETTING_PATH("input_overlay",
settings->path.overlay, false, NULL, true);
SETTING_PATH("input_osk_overlay",
settings->path.osk_overlay, false, NULL, true);
#endif
SETTING_PATH("video_font_path",
settings->path.font, false, NULL, true);
@ -681,10 +688,6 @@ static int populate_settings_path(settings_t *settings, struct config_path_setti
SETTING_PATH("overlay_directory",
settings->directory.overlay, true, NULL, true);
#endif
#ifdef HAVE_OVERLAY
SETTING_PATH("osk_overlay_directory",
dir_get_ptr(RARCH_DIR_OSK_OVERLAY), true, NULL, true);
#endif
#ifndef HAVE_DYNAMIC
SETTING_PATH("libretro_path",
path_get_ptr(RARCH_PATH_CORE), false, NULL, false);
@ -710,14 +713,15 @@ static int populate_settings_bool(settings_t *settings, struct config_bool_setti
SETTING_BOOL("ui_companion_enable", &settings->ui.companion_enable, true, ui_companion_enable, false);
SETTING_BOOL("video_gpu_record", &settings->video.gpu_record, true, gpu_record, false);
SETTING_BOOL("input_remap_binds_enable", &settings->input.remap_binds_enable, true, true, false);
SETTING_BOOL("back_as_menu_toggle_enable", &settings->input.back_as_menu_toggle_enable, true, true, false);
SETTING_BOOL("all_users_control_menu", &settings->input.all_users_control_menu, true, all_users_control_menu, false);
SETTING_BOOL("menu_swap_ok_cancel_buttons", &settings->input.menu_swap_ok_cancel_buttons, true, menu_swap_ok_cancel_buttons, false);
#ifdef HAVE_NETWORKING
SETTING_BOOL("netplay_client_swap_input", &settings->netplay.swap_input, true, netplay_client_swap_input, false);
#endif
SETTING_BOOL("input_descriptor_label_show", &settings->input.input_descriptor_label_show, true, input_descriptor_label_show, false);
SETTING_BOOL("input_descriptor_hide_unbound", &settings->input.input_descriptor_hide_unbound, true, input_descriptor_hide_unbound, false);
SETTING_BOOL("load_dummy_on_core_shutdown", &settings->load_dummy_on_core_shutdown, true, load_dummy_on_core_shutdown, false);
SETTING_BOOL("check_firmware_before_loading", &settings->check_firmware_before_loading, true, check_firmware_before_loading, false);
SETTING_BOOL("builtin_mediaplayer_enable", &settings->multimedia.builtin_mediaplayer_enable, false, false /* TODO */, false);
SETTING_BOOL("builtin_imageviewer_enable", &settings->multimedia.builtin_imageviewer_enable, true, true, false);
SETTING_BOOL("fps_show", &settings->fps_show, true, false, false);
@ -769,6 +773,7 @@ static int populate_settings_bool(settings_t *settings, struct config_bool_setti
SETTING_BOOL("video_vfilter", &settings->video.vfilter, true, video_vfilter, false);
#endif
#ifdef HAVE_MENU
SETTING_BOOL("menu_unified_controls", &settings->menu.unified_controls, true, false, false);
#ifdef HAVE_THREADS
SETTING_BOOL("threaded_data_runloop_enable", &settings->threaded_data_runloop_enable, true, threaded_data_runloop_enable, false);
#endif
@ -808,7 +813,6 @@ static int populate_settings_bool(settings_t *settings, struct config_bool_setti
SETTING_BOOL("input_overlay_enable", &settings->input.overlay_enable, true, config_overlay_enable_default(), false);
SETTING_BOOL("input_overlay_enable_autopreferred", &settings->input.overlay_enable_autopreferred, true, true, false);
SETTING_BOOL("input_overlay_hide_in_menu", &settings->input.overlay_hide_in_menu, true, overlay_hide_in_menu, false);
SETTING_BOOL("input_osk_overlay_enable", &settings->osk.enable, true, true, false);
#endif
#ifdef HAVE_COMMAND
SETTING_BOOL("network_cmd_enable", &settings->network_cmd_enable, true, network_cmd_enable, false);
@ -819,11 +823,13 @@ static int populate_settings_bool(settings_t *settings, struct config_bool_setti
#endif
#ifdef HAVE_NETWORKING
SETTING_BOOL("netplay_spectator_mode_enable",&settings->netplay.is_spectate, false, false /* TODO */, false);
SETTING_BOOL("netplay_nat_traversal", &settings->netplay.nat_traversal, true, true, false);
#endif
SETTING_BOOL("block_sram_overwrite", &settings->block_sram_overwrite, true, block_sram_overwrite, false);
SETTING_BOOL("savestate_auto_index", &settings->savestate_auto_index, true, savestate_auto_index, false);
SETTING_BOOL("savestate_auto_save", &settings->savestate_auto_save, true, savestate_auto_save, false);
SETTING_BOOL("savestate_auto_load", &settings->savestate_auto_load, true, savestate_auto_load, false);
SETTING_BOOL("savestate_thumbnail_enable", &settings->savestate_thumbnail_enable, true, savestate_thumbnail_enable, false);
SETTING_BOOL("history_list_enable", &settings->history_list_enable, true, def_history_list_enable, false);
SETTING_BOOL("game_specific_options", &settings->game_specific_options, true, default_game_specific_options, false);
SETTING_BOOL("auto_overrides_enable", &settings->auto_overrides_enable, true, default_auto_overrides_enable, false);
@ -895,23 +901,19 @@ static int populate_settings_int(settings_t *settings, struct config_int_setting
SETTING_INT("keyboard_gamepad_mapping_type",&settings->input.keyboard_gamepad_mapping_type, true, 1, false);
SETTING_INT("input_poll_type_behavior", &settings->input.poll_type_behavior, true, 2, false);
#ifdef HAVE_MENU
SETTING_INT("menu_ok_btn", &settings->menu_ok_btn, true, config_menu_btn_ok_default(), false);
SETTING_INT("menu_cancel_btn", &settings->menu_cancel_btn, true, config_menu_btn_cancel_default(), false);
SETTING_INT("menu_search_btn", &settings->menu_search_btn, true, default_menu_btn_search, false);
SETTING_INT("menu_info_btn", &settings->menu_info_btn, true, default_menu_btn_info, false);
SETTING_INT("menu_default_btn", &settings->menu_default_btn, true, default_menu_btn_default, false);
SETTING_INT("menu_scroll_down_btn", &settings->menu_scroll_down_btn, true, default_menu_btn_scroll_down, false);
#endif
SETTING_INT("video_monitor_index", &settings->video.monitor_index, true, monitor_index, false);
SETTING_INT("video_fullscreen_x", &settings->video.fullscreen_x, true, fullscreen_x, false);
SETTING_INT("video_fullscreen_y", &settings->video.fullscreen_y, true, fullscreen_y, false);
SETTING_INT("video_window_x", &settings->video.window_x, true, fullscreen_x, false);
SETTING_INT("video_window_y", &settings->video.window_y, true, fullscreen_y, false);
#ifdef HAVE_COMMAND
SETTING_INT("network_cmd_port", &settings->network_cmd_port, true, network_cmd_port, false);
#endif
#ifdef HAVE_NETWORKGAMEPAD
SETTING_INT("network_remote_base_port", &settings->network_remote_base_port, true, network_remote_base_port, false);
#endif
SETTING_INT("menu_scroll_up_btn", &settings->menu_scroll_up_btn, true, default_menu_btn_scroll_up, false);
#ifdef HAVE_GEKKO
SETTING_INT("video_viwidth", &settings->video.viwidth, true, video_viwidth, false);
#endif
@ -943,9 +945,9 @@ static int populate_settings_int(settings_t *settings, struct config_int_setting
SETTING_INT("aspect_ratio_index", &settings->video.aspect_ratio_idx, true, aspect_ratio_idx, false);
SETTING_INT("state_slot", (unsigned*)&settings->state_slot, false, 0 /* TODO */, false);
#ifdef HAVE_NETWORKING
SETTING_INT("netplay_ip_port", &settings->netplay.port, false, 0 /* TODO */, false);
SETTING_INT("netplay_delay_frames", &settings->netplay.sync_frames, true, 16, false);
SETTING_INT("netplay_check_frames", &settings->netplay.check_frames, false, 30, false);
SETTING_INT("netplay_ip_port", &settings->netplay.port, true, RARCH_DEFAULT_PORT, false);
SETTING_INT("netplay_delay_frames", &settings->netplay.delay_frames, true, netplay_delay_frames, false);
SETTING_INT("netplay_check_frames", &settings->netplay.check_frames, true, netplay_check_frames, false);
#endif
#ifdef HAVE_LANGEXTRA
SETTING_INT("user_language", &settings->user_language, true, RETRO_LANGUAGE_ENGLISH, false);
@ -1283,31 +1285,8 @@ static void config_set_defaults(void)
sizeof(settings->path.overlay));
#endif
}
if (!string_is_empty(g_defaults.dir.osk_overlay))
{
char temp_path[PATH_MAX_LENGTH];
temp_path[0] = '\0';
fill_pathname_expand_special(temp_path,
g_defaults.dir.osk_overlay, sizeof(temp_path));
dir_set(RARCH_DIR_OSK_OVERLAY, temp_path);
}
else
{
char temp_path[PATH_MAX_LENGTH];
temp_path[0] = '\0';
strlcpy(temp_path,
settings->directory.overlay,
sizeof(temp_path));
dir_set(RARCH_DIR_OSK_OVERLAY, temp_path);
}
#endif
#ifdef HAVE_MENU
if (!string_is_empty(g_defaults.dir.menu_config))
strlcpy(settings->directory.menu_config,
@ -1645,6 +1624,28 @@ static void config_read_keybinds_conf(config_file_t *conf)
read_keybinds_user(conf, i);
}
static bool check_shader_compatibility(enum file_path_enum enum_idx)
{
settings_t *settings = config_get_ptr();
if (string_is_equal("vulkan", settings->video.driver))
{
if (enum_idx != FILE_PATH_SLANGP_EXTENSION)
return false;
return true;
}
if (string_is_equal("gl", settings->video.driver) ||
string_is_equal("d3d9", settings->video.driver))
{
if (enum_idx == FILE_PATH_SLANGP_EXTENSION)
return false;
return true;
}
return false;
}
#if 0
static bool config_read_keybinds(const char *path)
{
@ -1862,7 +1863,7 @@ static bool config_load_file(const char *path, bool set_defaults,
#ifdef HAVE_NETWORKING
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_NETPLAY_DELAY_FRAMES, NULL))
CONFIG_GET_INT_BASE(conf, settings, netplay.sync_frames, "netplay_delay_frames");
CONFIG_GET_INT_BASE(conf, settings, netplay.delay_frames, "netplay_delay_frames");
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_NETPLAY_CHECK_FRAMES, NULL))
CONFIG_GET_INT_BASE(conf, settings, netplay.check_frames, "netplay_check_frames");
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_NETPLAY_IP_PORT, NULL))
@ -2104,8 +2105,6 @@ static bool config_load_file(const char *path, bool set_defaults,
#ifdef HAVE_OVERLAY
if (string_is_equal(settings->directory.overlay, "default"))
*settings->directory.overlay = '\0';
if (string_is_equal(dir_get(RARCH_DIR_OSK_OVERLAY), "default"))
dir_clear(RARCH_DIR_OSK_OVERLAY);
#endif
if (string_is_equal(settings->directory.system, "default"))
*settings->directory.system = '\0';
@ -2168,6 +2167,19 @@ static bool config_load_file(const char *path, bool set_defaults,
config_read_keybinds_conf(conf);
ret = true;
for(i = FILE_PATH_CGP_EXTENSION; i <= FILE_PATH_SLANGP_EXTENSION; i++)
{
if(strstr(file_path_str((enum file_path_enum)(i)), path_get_extension(settings->path.shader)))
{
if (!check_shader_compatibility((enum file_path_enum)i))
{
RARCH_LOG("Incompatible shader for backend %s, clearing...\n", settings->video.driver);
settings->path.shader[0] = '\0';
break;
}
}
}
end:
if (conf)
@ -2452,28 +2464,6 @@ bool config_load_remap(void)
return false;
}
static bool check_shader_compatibility(enum file_path_enum enum_idx)
{
settings_t *settings = config_get_ptr();
if (string_is_equal("vulkan", settings->video.driver))
{
if (enum_idx != FILE_PATH_SLANGP_EXTENSION)
return false;
return true;
}
if (string_is_equal("gl", settings->video.driver) ||
string_is_equal("d3d9", settings->video.driver))
{
if (enum_idx == FILE_PATH_SLANGP_EXTENSION)
return false;
return true;
}
return false;
}
/**
* config_load_shader_preset:
*
@ -2520,7 +2510,7 @@ bool config_load_shader_preset(void)
RARCH_LOG("Shaders: preset directory: %s\n", shader_directory);
for(idx = FILE_PATH_CGP_EXTENSION; idx < FILE_PATH_SLANGP_EXTENSION; idx++)
for(idx = FILE_PATH_CGP_EXTENSION; idx <= FILE_PATH_SLANGP_EXTENSION; idx++)
{
config_file_t *new_conf = NULL;
@ -2557,7 +2547,7 @@ bool config_load_shader_preset(void)
return true;
}
for(idx = FILE_PATH_CGP_EXTENSION; idx < FILE_PATH_SLANGP_EXTENSION; idx++)
for(idx = FILE_PATH_CGP_EXTENSION; idx <= FILE_PATH_SLANGP_EXTENSION; idx++)
{
config_file_t *new_conf = NULL;
@ -3218,6 +3208,33 @@ bool config_save_overrides(int override_type)
}
}
for (i = 0; i < MAX_USERS; i++)
{
char cfg[64];
cfg[0] = '\0';
if (settings->input.device[i] != overrides->input.device[i])
{
snprintf(cfg, sizeof(cfg), "input_device_p%u", i + 1);
config_set_int(conf, cfg, overrides->input.device[i]);
}
if (settings->input.joypad_map[i] != overrides->input.joypad_map[i])
{
snprintf(cfg, sizeof(cfg), "input_player%u_joypad_index", i + 1);
config_set_int(conf, cfg, overrides->input.joypad_map[i]);
}
if (settings->input.libretro_device[i] != overrides->input.libretro_device[i])
{
snprintf(cfg, sizeof(cfg), "input_libretro_device_p%u", i + 1);
config_set_int(conf, cfg, overrides->input.libretro_device[i]);
}
if (settings->input.analog_dpad_mode[i] != overrides->input.analog_dpad_mode[i])
{
snprintf(cfg, sizeof(cfg), "input_player%u_analog_dpad_mode", i + 1);
config_set_int(conf, cfg, overrides->input.analog_dpad_mode[i]);
}
}
ret = false;
switch (override_type)

View File

@ -54,6 +54,8 @@ typedef struct settings
char driver[32];
char context_driver[32];
float scale;
unsigned window_x;
unsigned window_y;
bool fullscreen;
bool windowed_fullscreen;
unsigned monitor_index;
@ -202,6 +204,8 @@ typedef struct settings
{
unsigned menu_color_theme;
} materialui;
bool unified_controls;
} menu;
#endif
@ -294,8 +298,9 @@ typedef struct settings
bool input_descriptor_hide_unbound;
unsigned menu_toggle_gamepad_combo;
bool back_as_menu_toggle_enable;
bool all_users_control_menu;
bool menu_swap_ok_cancel_buttons;
#if defined(VITA)
bool backtouch_enable;
bool backtouch_toggle;
@ -308,13 +313,6 @@ typedef struct settings
unsigned poll_type_behavior;
} input;
struct
{
bool enable;
float opacity;
float scale;
} osk;
struct
{
unsigned mode;
@ -356,7 +354,6 @@ typedef struct settings
{
char cheat_database[PATH_MAX_LENGTH];
char content_database[PATH_MAX_LENGTH];
char osk_overlay[PATH_MAX_LENGTH];
char overlay[PATH_MAX_LENGTH];
char menu_wallpaper[PATH_MAX_LENGTH];
char audio_dsp_plugin[PATH_MAX_LENGTH];
@ -404,10 +401,11 @@ typedef struct settings
{
char server[255];
unsigned port;
unsigned sync_frames;
unsigned delay_frames;
unsigned check_frames;
bool is_spectate;
bool swap_input;
bool nat_traversal;
} netplay;
#endif
@ -432,6 +430,7 @@ typedef struct settings
bool savestate_auto_index;
bool savestate_auto_save;
bool savestate_auto_load;
bool savestate_thumbnail_enable;
bool network_cmd_enable;
unsigned network_cmd_port;
@ -445,6 +444,7 @@ typedef struct settings
#endif
bool fps_show;
bool load_dummy_on_core_shutdown;
bool check_firmware_before_loading;
bool game_specific_options;
bool auto_overrides_enable;
@ -454,14 +454,6 @@ typedef struct settings
bool sort_savefiles_enable;
bool sort_savestates_enable;
unsigned menu_ok_btn;
unsigned menu_cancel_btn;
unsigned menu_search_btn;
unsigned menu_default_btn;
unsigned menu_info_btn;
unsigned menu_scroll_down_btn;
unsigned menu_scroll_up_btn;
char username[32];
#ifdef HAVE_LANGEXTRA
unsigned int user_language;
@ -505,15 +497,6 @@ const char *config_get_default_wifi(void);
**/
const char *config_get_default_location(void);
/**
* config_get_default_osk:
*
* Gets default OSK driver.
*
* Returns: Default OSK driver.
**/
const char *config_get_default_osk(void);
/**
* config_get_default_video:
*

1
core.h
View File

@ -21,7 +21,6 @@
#include <boolean.h>
#include <libretro.h>
#include <retro_miscellaneous.h>
#include <retro_common_api.h>
#include "core_type.h"

View File

@ -26,6 +26,9 @@
#include "config.h"
#endif
#include "runloop.h"
#include "verbosity.h"
#include "config.def.h"
#include "core_info.h"
#include "configuration.h"
@ -410,7 +413,7 @@ static bool core_info_list_update_missing_firmware_internal(
if (!info)
return false;
runloop_ctl(RUNLOOP_CTL_UNSET_MISSING_BIOS, NULL);
for (i = 0; i < info->firmware_count; i++)
{
if (!info->firmware[i].path)
@ -419,6 +422,11 @@ static bool core_info_list_update_missing_firmware_internal(
fill_pathname_join(path, systemdir,
info->firmware[i].path, sizeof(path));
info->firmware[i].missing = !path_file_exists(path);
if (info->firmware[i].missing && !info->firmware[i].optional)
{
runloop_ctl(RUNLOOP_CTL_SET_MISSING_BIOS, NULL);
RARCH_WARN("Firmware missing: %s\n", info->firmware[i].path);
}
}
return true;
@ -522,7 +530,6 @@ bool core_info_list_update_missing_firmware(core_info_ctx_firmware_t *info)
{
if (!info)
return false;
return core_info_list_update_missing_firmware_internal(
core_info_curr_list,
info->path, info->directory.system);
@ -757,9 +764,14 @@ bool core_info_database_supports_content_path(const char *database_path, const c
const core_info_t *info = &core_info_curr_list->list[i];
if (string_list_find_elem(info->databases_list, database))
{
if (string_list_find_elem(info->supported_extensions_list, "zip") ||
string_list_find_elem(info->supported_extensions_list, "7z"))
return false;
{
free(database);
return false;
}
}
}
}

View File

@ -423,7 +423,7 @@ database_info_handle_t *database_info_dir_init(const char *dir,
{
const char *path = db->list->elems[i].data;
if (path_is_compressed_file(path))
if (path_is_compressed_file(path) && !path_contains_compressed_file(path))
{
struct string_list *archive_list =
file_archive_get_file_list(path, NULL);

View File

@ -62,7 +62,6 @@ struct defaults
char core[PATH_MAX_LENGTH];
char core_info[PATH_MAX_LENGTH];
char overlay[PATH_MAX_LENGTH];
char osk_overlay[PATH_MAX_LENGTH];
char port[PATH_MAX_LENGTH];
char shader[PATH_MAX_LENGTH];
char savestate[PATH_MAX_LENGTH];

2
deps/SPIRV-Cross vendored

@ -1 +1 @@
Subproject commit 5c24d99ff22a25ef38e9e39985f80cf57a1e7418
Subproject commit 875c32fd39a06f624814effe5eab691b078429f5

View File

@ -132,6 +132,7 @@ mg_static_assert(sizeof(void *) >= sizeof(int), "data type size check");
#include <mach/mach_time.h>
#include <assert.h>
#include <compat/strl.h>
/* clock_gettime is not implemented on OSX */
int clock_gettime(int clk_id, struct timespec *t);
@ -5654,8 +5655,8 @@ mg_modify_passwords_file(const char *fname,
}
/* Create a temporary file name. Length has been checked before. */
strcpy(tmp, fname);
strcat(tmp, ".tmp");
strlcpy(tmp, fname, sizeof(tmp));
strlcat(tmp, ".tmp", sizeof(tmp));
/* Create the file if does not exist */
/* Use of fopen here is OK, since fname is only ASCII */

@ -1 +1 @@
Subproject commit a4a4d5e22c375d37bd286106904ef819eafff29b
Subproject commit be8462149a3c150fc89db84e57ef06de3ab90d47

105
diff.diff
View File

@ -1,105 +0,0 @@
diff --git a/gfx/drivers_shader/shader_glsl.c b/gfx/drivers_shader/shader_glsl.c
index 203f0c6..6cb5f9a 100644
--- a/gfx/drivers_shader/shader_glsl.c
+++ b/gfx/drivers_shader/shader_glsl.c
@@ -1330,15 +1330,13 @@ fallback:
#define gl_glsl_set_coord_array(attr, coord1, coord2, coords, size, multiplier) \
{ \
- unsigned y; \
- attr->loc = coord1; \
- attr->size = multiplier; \
- attr->offset = size * sizeof(GLfloat); \
- attribs_size++; \
- attr++; \
- for (y = 0; y < (multiplier * coords->vertices); y++) \
- buffer[y + size] = coord2[y]; \
- size += multiplier * coords->vertices; \
+ attr->loc = coord1; \
+ attr->size = multiplier; \
+ attr->offset = size * sizeof(GLfloat); \
+ attribs_size++; \
+ glBufferSubData(GL_ARRAY_BUFFER, attr->offset, multiplier * coords->vertices * sizeof(GLfloat), coord2); \
+ size += multiplier * coords->vertices; \
+ attr++; \
}
static bool gl_glsl_set_coords(void *handle_data, void *shader_data, const struct video_coords *coords)
@@ -1357,35 +1355,56 @@ static bool gl_glsl_set_coords(void *handle_data, void *shader_data, const struc
goto fallback;
buffer = short_buffer;
- if (coords->vertices > 4)
- buffer = (GLfloat*)calloc(coords->vertices *
- (2 + 2 + 4 + 2), sizeof(*buffer));
-
- if (!buffer)
- goto fallback;
attr = attribs;
uni = &glsl->uniforms[glsl->active_idx];
- if (uni->tex_coord >= 0)
- gl_glsl_set_coord_array(attr, uni->tex_coord, coords->tex_coord, coords, size, 2);
+ glBindBuffer(GL_ARRAY_BUFFER, glsl->vbo[glsl->active_idx].vbo_primary);
+ {
+ size_t i;
+ size_t elems = 0;
- if (uni->vertex_coord >= 0)
- gl_glsl_set_coord_array(attr, uni->vertex_coord, coords->vertex, coords, size, 2);
+ elems += (uni->color >= 0) * 4;
+ elems += (uni->tex_coord >= 0) * 2;
+ elems += (uni->vertex_coord >= 0) * 2;
+ elems += (uni->lut_tex_coord >= 0) * 2;
- if (uni->color >= 0)
- gl_glsl_set_coord_array(attr, uni->color, coords->color, coords, size, 4);
+ elems *= coords->vertices;
- if (uni->lut_tex_coord >= 0)
- gl_glsl_set_coord_array(attr, uni->lut_tex_coord, coords->lut_tex_coord, coords, size, 2);
+ if (elems) {
- if (size)
- gl_glsl_set_attribs(glsl,
- glsl->vbo[glsl->active_idx].vbo_primary,
- &glsl->vbo[glsl->active_idx].buffer_primary,
- &glsl->vbo[glsl->active_idx].size_primary,
- buffer, size,
- attribs, attribs_size);
+ glBufferData(GL_ARRAY_BUFFER, elems * sizeof(GLfloat), NULL, GL_STREAM_DRAW);
+
+ if (uni->tex_coord >= 0)
+ gl_glsl_set_coord_array(attr, uni->tex_coord, coords->tex_coord, coords, size, 2);
+
+ if (uni->vertex_coord >= 0)
+ gl_glsl_set_coord_array(attr, uni->vertex_coord, coords->vertex, coords, size, 2);
+
+ if (uni->color >= 0)
+ gl_glsl_set_coord_array(attr, uni->color, coords->color, coords, size, 4);
+
+ if (uni->lut_tex_coord >= 0)
+ gl_glsl_set_coord_array(attr, uni->lut_tex_coord, coords->lut_tex_coord, coords, size, 2);
+
+ for (i = 0; i < attribs_size; i++)
+ {
+ GLint loc = attribs[i].loc;
+
+ if (glsl->attribs.index < ARRAY_SIZE(glsl->attribs.elems))
+ {
+ glEnableVertexAttribArray(loc);
+ glVertexAttribPointer(loc, attribs[i].size, GL_FLOAT, GL_FALSE, 0,
+ (const GLvoid*)(uintptr_t)attribs[i].offset);
+ glsl->attribs.elems[glsl->attribs.index++] = loc;
+ }
+ else
+ RARCH_WARN("Attrib array buffer was overflown!\n");
+ }
+ }
+
+ }
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
if (buffer != short_buffer)
free(buffer);

17
dirs.c
View File

@ -42,7 +42,6 @@ struct rarch_dir_list
static struct rarch_dir_list dir_shader_list;
static char dir_osk_overlay[PATH_MAX_LENGTH] = {0};
static char dir_system[PATH_MAX_LENGTH] = {0};
static char dir_savefile[PATH_MAX_LENGTH] = {0};
static char current_savefile_dir[PATH_MAX_LENGTH] = {0};
@ -183,8 +182,6 @@ bool dir_is_empty(enum rarch_dir_type type)
return string_is_empty(dir_savestate);
case RARCH_DIR_CURRENT_SAVESTATE:
return string_is_empty(current_savestate_dir);
case RARCH_DIR_OSK_OVERLAY:
return string_is_empty(dir_osk_overlay);
case RARCH_DIR_NONE:
break;
}
@ -208,8 +205,6 @@ size_t dir_get_size(enum rarch_dir_type type)
return sizeof(dir_savefile);
case RARCH_DIR_CURRENT_SAVEFILE:
return sizeof(current_savefile_dir);
case RARCH_DIR_OSK_OVERLAY:
return sizeof(dir_osk_overlay);
case RARCH_DIR_NONE:
break;
}
@ -238,9 +233,6 @@ void dir_clear(enum rarch_dir_type type)
case RARCH_DIR_SYSTEM:
*dir_system = '\0';
break;
case RARCH_DIR_OSK_OVERLAY:
*dir_osk_overlay = '\0';
break;
case RARCH_DIR_NONE:
break;
}
@ -249,7 +241,6 @@ void dir_clear(enum rarch_dir_type type)
void dir_clear_all(void)
{
dir_clear(RARCH_DIR_SYSTEM);
dir_clear(RARCH_DIR_OSK_OVERLAY);
dir_clear(RARCH_DIR_SAVEFILE);
dir_clear(RARCH_DIR_SAVESTATE);
}
@ -260,8 +251,6 @@ char *dir_get_ptr(enum rarch_dir_type type)
{
switch (type)
{
case RARCH_DIR_OSK_OVERLAY:
return dir_osk_overlay;
case RARCH_DIR_SAVEFILE:
return dir_savefile;
case RARCH_DIR_CURRENT_SAVEFILE:
@ -283,8 +272,6 @@ const char *dir_get(enum rarch_dir_type type)
{
switch (type)
{
case RARCH_DIR_OSK_OVERLAY:
return dir_osk_overlay;
case RARCH_DIR_SAVEFILE:
return dir_savefile;
case RARCH_DIR_CURRENT_SAVEFILE:
@ -326,10 +313,6 @@ void dir_set(enum rarch_dir_type type, const char *path)
strlcpy(dir_system, path,
sizeof(dir_system));
break;
case RARCH_DIR_OSK_OVERLAY:
strlcpy(dir_osk_overlay, path,
sizeof(dir_osk_overlay));
break;
case RARCH_DIR_NONE:
break;
}

3
dirs.h
View File

@ -28,8 +28,7 @@ enum rarch_dir_type
RARCH_DIR_SAVESTATE,
RARCH_DIR_CURRENT_SAVEFILE,
RARCH_DIR_CURRENT_SAVESTATE,
RARCH_DIR_SYSTEM,
RARCH_DIR_OSK_OVERLAY
RARCH_DIR_SYSTEM
};
bool dir_init_shader(void);

View File

@ -14,54 +14,111 @@ mkdir -p ../pkg/wiiu/wiiu/apps/
make -C ../ -f Makefile.${platform} clean || exit 1
lookup()
{
cat | grep "$1 = " | sed "s/$1 = \"//" | sed s/\"//
}
gen_meta_xml()
{
info="$1"_libretro.info
if [ -e $info ] ; then
display_name=`cat $info | grep "display_name = " | sed "s/display_name = \"//" | sed s/\"//`
corename=`cat $info | grep "corename = " | sed "s/corename = \"//" | sed s/\"//`
authors=`cat $info | grep "authors = " | sed "s/authors = \"//" | sed s/\"// | sed s/\|/\ -\ /g`
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' > "$libretro"_meta.xml
echo '<app version="1">' >> "$libretro"_meta.xml
echo ' <name>'$corename'</name>' >> "$libretro"_meta.xml
echo ' <coder>'$authors'</coder>' >> "$libretro"_meta.xml
echo ' <version>'$RARCH_VERSION'</version>' >> "$libretro"_meta.xml
echo ' <release_date>'`date +%Y%m%d%H%M%S`'</release_date>' >> "$libretro"_meta.xml
echo ' <short_description>RetroArch</short_description>' >> "$libretro"_meta.xml
echo ' <long_description>'$display_name'</long_description>' >> "$libretro"_meta.xml
echo '</app>' >> "$libretro"_meta.xml
display_name=`cat $info | lookup "display_name"`
corename=`cat $info | lookup "corename"`
authors=`cat $info | lookup "authors" | sed s/\|/\ -\ /g`
systemname=`cat $info | lookup "systemname"`
license=`cat $info | lookup "license"`
date=`date +%Y%m%d%H%M%S`
build_hash=`git rev-parse --short HEAD 2>/dev/null`
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' > "$1"_meta.xml
echo '<app version="1">' >> "$1"_meta.xml
echo ' <name>'$corename'</name>' >> "$1"_meta.xml
echo ' <coder>'$authors'</coder>' >> "$1"_meta.xml
echo ' <version>'$RARCH_VERSION' r'$build_hash'</version>' >> "$1"_meta.xml
echo ' <release_date>'$date'</release_date>' >> "$1"_meta.xml
echo ' <short_description>RetroArch</short_description>' >> "$1"_meta.xml
echo -e ' <long_description>'$display_name'\n\nSystem: '$systemname'\nLicense: '$license'</long_description>' >> "$1"_meta.xml
echo ' <category>emu</category>' >> "$1"_meta.xml
echo ' <url>https://github.com/libretro</url>' >> "$1"_meta.xml
echo '</app>' >> "$1"_meta.xml
fi
}
for f in `ls -v *_${platform}.${EXT}`; do
name=`echo "$f" | sed "s/\(_libretro_${platform}\|\).${EXT}$//"`
whole_archive=
build_hbl_elf=1
build_rpx=1
if [ $name = "nxengine" ] ; then
echo "Applying whole archive linking..."
whole_archive="WHOLE_ARCHIVE_LINK=1"
fi
if [ $name = "mame2003" ] ; then
build_hbl_elf=0
fi
if [ $name = "fbalpha2012" ] ; then
build_hbl_elf=0
fi
if [ $name = "mame2003_midway" ] ; then
build_rpx=0
fi
if [ $name = "fbalpha2012_cps1" ] ; then
build_rpx=0
fi
if [ $name = "fbalpha2012_cps2" ] ; then
build_rpx=0
fi
if [ $name = "fbalpha2012_cps3" ] ; then
build_rpx=0
fi
if [ $name = "fbalpha2012_neogeo" ] ; then
build_rpx=0
fi
echo "-- Building core: $name --"
cp -f "$f" ../libretro_${platform}.${EXT}
echo NAME: $name
# Compile core
make -C ../ -f Makefile.${platform} LIBRETRO=$name $whole_archive -j3 || exit 1
mkdir -p ../pkg/wiiu/wiiu/apps/${name}_libretro
mv -f ../retroarch_wiiu.elf ../pkg/wiiu/wiiu/apps/${name}_libretro/${name}_libretro.elf
make -C ../ -f Makefile.${platform} LIBRETRO=$name BUILD_HBL_ELF=$build_hbl_elf BUILD_RPX=$build_rpx $whole_archive -j3 || exit 1
gen_meta_xml $name
if [ -e $info ] ; then
mv -f "$libretro"_meta.xml ../pkg/wiiu/wiiu/apps/${name}_libretro/meta.xml
else
cp -f ../pkg/wiiu/meta.xml ../pkg/wiiu/wiiu/apps/${name}_libretro/meta.xml
if [ -e ../retroarch_wiiu.elf ] ; then
mkdir -p ../pkg/wiiu/wiiu/apps/${name}_libretro
mv -f ../retroarch_wiiu.elf ../pkg/wiiu/wiiu/apps/${name}_libretro/${name}_libretro.elf
if [ -e ${name}_meta.xml ] ; then
cp -f ${name}_meta.xml ../pkg/wiiu/wiiu/apps/${name}_libretro/meta.xml
else
cp -f ../pkg/wiiu/meta.xml ../pkg/wiiu/wiiu/apps/${name}_libretro/meta.xml
fi
if [ -e $name.png ] ; then
cp -f $name.png ../pkg/wiiu/wiiu/apps/${name}_libretro/icon.png
else
cp -f ../pkg/wiiu/icon.png ../pkg/wiiu/wiiu/apps/${name}_libretro/icon.png
fi
fi
if [ -e $name.png ] ; then
cp -f $name.png ../pkg/wiiu/wiiu/apps/${name}_libretro/icon.png
else
cp -f ../pkg/wiiu/icon.png ../pkg/wiiu/wiiu/apps/${name}_libretro/icon.png
if [ -e ../retroarch_wiiu.rpx ] ; then
mkdir -p ../pkg/wiiu/rpx/wiiu/apps/${name}_libretro
mv -f ../retroarch_wiiu.rpx ../pkg/wiiu/rpx/wiiu/apps/${name}_libretro/${name}_libretro.rpx
rm -f ../retroarch_wiiu.rpx.elf
if [ -e ${name}_meta.xml ] ; then
cp -f ${name}_meta.xml ../pkg/wiiu/rpx/wiiu/apps/${name}_libretro/meta.xml
else
cp -f ../pkg/wiiu/meta.xml ../pkg/wiiu/rpx/wiiu/apps/${name}_libretro/meta.xml
fi
if [ -e $name.png ] ; then
cp -f $name.png ../pkg/wiiu/rpx/wiiu/apps/${name}_libretro/icon.png
else
cp -f ../pkg/wiiu/icon.png ../pkg/wiiu/rpx/wiiu/apps/${name}_libretro/icon.png
fi
fi
rm -rf ${name}_meta.xml
rm -rf $name.png
done
# Additional build step

View File

@ -293,17 +293,17 @@ static bool driver_update_system_av_info(const struct retro_system_av_info *info
**/
static void init_drivers(int flags)
{
if (flags & DRIVER_VIDEO)
if (flags & DRIVER_VIDEO_MASK)
video_driver_unset_own_driver();
if (flags & DRIVER_AUDIO)
if (flags & DRIVER_AUDIO_MASK)
audio_driver_unset_own_driver();
if (flags & DRIVER_INPUT)
if (flags & DRIVER_INPUT_MASK)
input_driver_unset_own_driver();
if (flags & DRIVER_CAMERA)
if (flags & DRIVER_CAMERA_MASK)
camera_driver_ctl(RARCH_CAMERA_CTL_UNSET_OWN_DRIVER, NULL);
if (flags & DRIVER_LOCATION)
if (flags & DRIVER_LOCATION_MASK)
location_driver_ctl(RARCH_LOCATION_CTL_UNSET_OWN_DRIVER, NULL);
if (flags & DRIVER_WIFI)
if (flags & DRIVER_WIFI_MASK)
wifi_driver_ctl(RARCH_WIFI_CTL_UNSET_OWN_DRIVER, NULL);
#ifdef HAVE_MENU
@ -311,10 +311,10 @@ static void init_drivers(int flags)
menu_driver_ctl(RARCH_MENU_CTL_SET_OWN_DRIVER, NULL);
#endif
if (flags & (DRIVER_VIDEO | DRIVER_AUDIO))
if (flags & (DRIVER_VIDEO_MASK | DRIVER_AUDIO_MASK))
driver_adjust_system_rates();
if (flags & DRIVER_VIDEO)
if (flags & DRIVER_VIDEO_MASK)
{
struct retro_hw_render_callback *hwr =
video_driver_get_hw_context();
@ -330,29 +330,29 @@ static void init_drivers(int flags)
runloop_ctl(RUNLOOP_CTL_SET_FRAME_TIME_LAST, NULL);
}
if (flags & DRIVER_AUDIO)
if (flags & DRIVER_AUDIO_MASK)
{
audio_driver_init();
audio_driver_new_devices_list();
}
/* Only initialize camera driver if we're ever going to use it. */
if ((flags & DRIVER_CAMERA) && camera_driver_ctl(RARCH_CAMERA_CTL_IS_ACTIVE, NULL))
if ((flags & DRIVER_CAMERA_MASK) && camera_driver_ctl(RARCH_CAMERA_CTL_IS_ACTIVE, NULL))
camera_driver_ctl(RARCH_CAMERA_CTL_INIT, NULL);
/* Only initialize location driver if we're ever going to use it. */
if ((flags & DRIVER_LOCATION) && location_driver_ctl(RARCH_LOCATION_CTL_IS_ACTIVE, NULL))
if ((flags & DRIVER_LOCATION_MASK) && location_driver_ctl(RARCH_LOCATION_CTL_IS_ACTIVE, NULL))
init_location();
#ifdef HAVE_MENU
if (flags & DRIVER_MENU)
if (flags & DRIVER_MENU_MASK)
{
menu_driver_ctl(RARCH_MENU_CTL_INIT, NULL);
menu_driver_ctl(RARCH_MENU_CTL_CONTEXT_RESET, NULL);
}
#endif
if (flags & (DRIVER_VIDEO | DRIVER_AUDIO))
if (flags & (DRIVER_VIDEO_MASK | DRIVER_AUDIO_MASK))
{
/* Keep non-throttled state as good as possible. */
if (input_driver_is_nonblock_state())
@ -388,32 +388,32 @@ static void init_drivers(int flags)
static void uninit_drivers(int flags)
{
#ifdef HAVE_MENU
if (flags & DRIVER_MENU)
if (flags & DRIVER_MENU_MASK)
menu_driver_ctl(RARCH_MENU_CTL_DEINIT, NULL);
#endif
if ((flags & DRIVER_LOCATION) && !location_driver_ctl(RARCH_LOCATION_CTL_OWNS_DRIVER, NULL))
if ((flags & DRIVER_LOCATION_MASK) && !location_driver_ctl(RARCH_LOCATION_CTL_OWNS_DRIVER, NULL))
location_driver_ctl(RARCH_LOCATION_CTL_DEINIT, NULL);
if ((flags & DRIVER_CAMERA) && !camera_driver_ctl(RARCH_CAMERA_CTL_OWNS_DRIVER, NULL))
if ((flags & DRIVER_CAMERA_MASK) && !camera_driver_ctl(RARCH_CAMERA_CTL_OWNS_DRIVER, NULL))
camera_driver_ctl(RARCH_CAMERA_CTL_DEINIT, NULL);
if (flags & DRIVER_AUDIO)
if (flags & DRIVER_AUDIO_MASK)
audio_driver_deinit();
if ((flags & DRIVER_WIFI) && !wifi_driver_ctl(RARCH_WIFI_CTL_OWNS_DRIVER, NULL))
if ((flags & DRIVER_WIFI_MASK) && !wifi_driver_ctl(RARCH_WIFI_CTL_OWNS_DRIVER, NULL))
wifi_driver_ctl(RARCH_WIFI_CTL_DEINIT, NULL);
if (flags & DRIVERS_VIDEO_INPUT)
video_driver_deinit();
if ((flags & DRIVER_VIDEO) && !video_driver_owns_driver())
if ((flags & DRIVER_VIDEO_MASK) && !video_driver_owns_driver())
video_driver_destroy_data();
if ((flags & DRIVER_INPUT) && !input_driver_owns_driver())
if ((flags & DRIVER_INPUT_MASK) && !input_driver_owns_driver())
input_driver_destroy_data();
if ((flags & DRIVER_AUDIO) && !audio_driver_owns_driver())
if ((flags & DRIVER_AUDIO_MASK) && !audio_driver_owns_driver())
audio_driver_destroy_data();
}

View File

@ -27,25 +27,37 @@
RETRO_BEGIN_DECLS
#define DRIVERS_CMD_ALL \
( DRIVER_AUDIO \
| DRIVER_VIDEO \
| DRIVER_INPUT \
| DRIVER_CAMERA \
| DRIVER_LOCATION \
| DRIVER_MENU \
| DRIVERS_VIDEO_INPUT \
| DRIVER_WIFI )
( DRIVER_AUDIO_MASK \
| DRIVER_VIDEO_MASK \
| DRIVER_INPUT_MASK \
| DRIVER_CAMERA_MASK \
| DRIVER_LOCATION_MASK \
| DRIVER_MENU_MASK \
| DRIVERS_VIDEO_INPUT_MASK \
| DRIVER_WIFI_MASK )
enum
{
DRIVER_AUDIO = 1 << 0,
DRIVER_VIDEO = 1 << 1,
DRIVER_INPUT = 1 << 2,
DRIVER_CAMERA = 1 << 3,
DRIVER_LOCATION = 1 << 4,
DRIVER_MENU = 1 << 5,
DRIVERS_VIDEO_INPUT = 1 << 6,
DRIVER_WIFI = 1 << 7
DRIVER_AUDIO = 0,
DRIVER_VIDEO,
DRIVER_INPUT,
DRIVER_CAMERA,
DRIVER_LOCATION,
DRIVER_MENU,
DRIVERS_VIDEO_INPUT,
DRIVER_WIFI
};
enum
{
DRIVER_AUDIO_MASK = 1 << DRIVER_AUDIO,
DRIVER_VIDEO_MASK = 1 << DRIVER_VIDEO,
DRIVER_INPUT_MASK = 1 << DRIVER_INPUT,
DRIVER_CAMERA_MASK = 1 << DRIVER_CAMERA,
DRIVER_LOCATION_MASK = 1 << DRIVER_LOCATION,
DRIVER_MENU_MASK = 1 << DRIVER_MENU,
DRIVERS_VIDEO_INPUT_MASK = 1 << DRIVERS_VIDEO_INPUT,
DRIVER_WIFI_MASK = 1 << DRIVER_WIFI
};
enum driver_ctl_state

View File

@ -215,7 +215,7 @@ static bool load_dynamic_core(void)
/* Try to verify that -lretro was not linked in from other modules
* since loading it dynamically and with -l will fail hard. */
RARCH_ERR("Serious problem. RetroArch wants to load libretro cores"
"dyamically, but it is already linked.\n");
" dynamically, but it is already linked.\n");
RARCH_ERR("This could happen if other modules RetroArch depends on "
"link against libretro directly.\n");
RARCH_ERR("Proceeding could cause a crash. Aborting ...\n");

View File

@ -46,7 +46,6 @@
#include "file_path_special.h"
#include "paths.h"
#include "runloop.h"
#include "verbosity.h"
void fill_pathname_expand_special(char *out_path,
@ -208,6 +207,7 @@ void fill_pathname_application_path(char *s, size_t len)
#endif
#ifdef _WIN32
DWORD ret;
wchar_t ws[PATH_MAX_LENGTH] = {0};
#endif
#ifdef __HAIKU__
image_info info;

View File

@ -115,8 +115,6 @@ static void frontend_emscripten_get_env(int *argc, char *argv[],
"bundle/info", sizeof(g_defaults.dir.core_info));
fill_pathname_join(g_defaults.dir.overlay, base_path,
"bundle/overlays", sizeof(g_defaults.dir.overlay));
fill_pathname_join(g_defaults.dir.osk_overlay, base_path,
"bundle/overlays", sizeof(g_defaults.dir.osk_overlay));
fill_pathname_join(g_defaults.dir.shader, base_path,
"bundle/shaders", sizeof(g_defaults.dir.shader));

View File

@ -1474,8 +1474,6 @@ static void frontend_linux_get_env(int *argc,
"shaders", sizeof(g_defaults.dir.shader));
fill_pathname_join(g_defaults.dir.overlay, app_dir,
"overlays", sizeof(g_defaults.dir.overlay));
fill_pathname_join(g_defaults.dir.osk_overlay, app_dir,
"overlays", sizeof(g_defaults.dir.osk_overlay));
fill_pathname_join(g_defaults.dir.core, app_dir,
"cores", sizeof(g_defaults.dir.core));
fill_pathname_join(g_defaults.dir.core_info,
@ -1494,7 +1492,7 @@ static void frontend_linux_get_env(int *argc,
app_dir, "database/cursors", sizeof(g_defaults.dir.cursor));
fill_pathname_join(g_defaults.dir.wallpapers,
app_dir, "assets/wallpapers", sizeof(g_defaults.dir.wallpapers));
if(*downloads_dir && test_permissions(downloads_dir))
if(!string_is_empty(downloads_dir) && test_permissions(downloads_dir))
{
fill_pathname_join(g_defaults.dir.core_assets,
downloads_dir, "", sizeof(g_defaults.dir.core_assets));
@ -1510,24 +1508,10 @@ static void frontend_linux_get_env(int *argc,
"RetroArch", "[ENV]: default download folder: [%s]",
g_defaults.dir.core_assets);
if(*screenshot_dir && test_permissions(screenshot_dir))
{
fill_pathname_join(g_defaults.dir.screenshot,
screenshot_dir, "", sizeof(g_defaults.dir.screenshot));
}
else
{
fill_pathname_join(g_defaults.dir.screenshot,
app_dir, "screenshots", sizeof(g_defaults.dir.screenshot));
path_mkdir(g_defaults.dir.screenshot);
}
__android_log_print(ANDROID_LOG_INFO,
"RetroArch", "[ENV]: default screenshot folder: [%s]",
g_defaults.dir.screenshot);
switch (perms)
{
/* Set defaults for this since we can't guarantee saving on content dir will
work in this case */
case INTERNAL_STORAGE_APPDIR_WRITABLE:
fill_pathname_join(g_defaults.dir.sram,
internal_storage_app_path, "saves", sizeof(g_defaults.dir.sram));
@ -1547,19 +1531,25 @@ static void frontend_linux_get_env(int *argc,
fill_pathname_join(g_defaults.dir.cheats,
internal_storage_app_path, "cheats", sizeof(g_defaults.dir.cheats));
/* TODO/FIXME - Test if this is needed at all, as far as I know,
* every directory we set in g_defaults already gets created if it
* doesn't exist already */
if(!string_is_empty(screenshot_dir) && test_permissions(screenshot_dir))
{
fill_pathname_join(g_defaults.dir.screenshot,
screenshot_dir, "", sizeof(g_defaults.dir.screenshot));
}
else
{
fill_pathname_join(g_defaults.dir.screenshot,
internal_storage_app_path, "screenshots", sizeof(g_defaults.dir.screenshot));
path_mkdir(g_defaults.dir.screenshot);
}
path_mkdir(g_defaults.dir.sram);
path_mkdir(g_defaults.dir.savestate);
path_mkdir(g_defaults.dir.system);
path_mkdir(g_defaults.dir.menu_config);
path_mkdir(g_defaults.dir.remap);
path_mkdir(g_defaults.dir.thumbnails);
path_mkdir(g_defaults.dir.playlist);
path_mkdir(g_defaults.dir.cheats);
break;
case INTERNAL_STORAGE_NOT_WRITABLE:
/* Set defaults for this since we can't guarantee saving on content dir will
work in this case */
fill_pathname_join(g_defaults.dir.sram,
app_dir, "saves", sizeof(g_defaults.dir.sram));
fill_pathname_join(g_defaults.dir.savestate,
@ -1578,19 +1568,25 @@ static void frontend_linux_get_env(int *argc,
fill_pathname_join(g_defaults.dir.cheats,
app_dir, "cheats", sizeof(g_defaults.dir.cheats));
/* TODO/FIXME - Test if this is needed at all, as far as I know,
* every directory we set in g_defaults already gets created if it
* doesn't exist already */
if(!string_is_empty(screenshot_dir) && test_permissions(screenshot_dir))
{
fill_pathname_join(g_defaults.dir.screenshot,
screenshot_dir, "", sizeof(g_defaults.dir.screenshot));
}
else
{
fill_pathname_join(g_defaults.dir.screenshot,
app_dir, "screenshots", sizeof(g_defaults.dir.screenshot));
path_mkdir(g_defaults.dir.screenshot);
}
path_mkdir(g_defaults.dir.sram);
path_mkdir(g_defaults.dir.savestate);
path_mkdir(g_defaults.dir.system);
path_mkdir(g_defaults.dir.menu_config);
path_mkdir(g_defaults.dir.remap);
path_mkdir(g_defaults.dir.thumbnails);
path_mkdir(g_defaults.dir.playlist);
path_mkdir(g_defaults.dir.cheats);
break;
case INTERNAL_STORAGE_WRITABLE:
/* Don't set defaults for saves, states, system or screenshots
in this case to be able to honour saving on content dir */
fill_pathname_join(g_defaults.dir.menu_config,
internal_storage_path, "RetroArch/config", sizeof(g_defaults.dir.menu_config));
fill_pathname_join(g_defaults.dir.remap,
@ -1601,38 +1597,14 @@ static void frontend_linux_get_env(int *argc,
internal_storage_path, "RetroArch/playlists", sizeof(g_defaults.dir.playlist));
fill_pathname_join(g_defaults.dir.cheats,
internal_storage_path, "RetroArch/cheats", sizeof(g_defaults.dir.cheats));
/* TODO/FIXME - Test if this is needed at all, as far as I know,
* every directory we set in g_defaults already gets created if it
* doesn't exist already */
path_mkdir(g_defaults.dir.menu_config);
path_mkdir(g_defaults.dir.remap);
path_mkdir(g_defaults.dir.thumbnails);
path_mkdir(g_defaults.dir.playlist);
path_mkdir(g_defaults.dir.cheats);
default:
break;
}
/* create save and system directories in the internal dir too */
fill_pathname_join(buf, app_dir, "saves", sizeof(buf));
path_mkdir(buf);
fill_pathname_join(buf, app_dir, "states", sizeof(buf));
path_mkdir(buf);
fill_pathname_join(buf, app_dir, "system", sizeof(buf));
path_mkdir(buf);
/* create save and system directories in the internal sd too */
fill_pathname_join(buf, internal_storage_app_path, "saves", sizeof(buf));
path_mkdir(buf);
fill_pathname_join(buf, internal_storage_app_path, "states", sizeof(buf));
path_mkdir(buf);
fill_pathname_join(buf, internal_storage_app_path, "system", sizeof(buf));
path_mkdir(buf);
path_mkdir(g_defaults.dir.menu_config);
path_mkdir(g_defaults.dir.remap);
path_mkdir(g_defaults.dir.thumbnails);
path_mkdir(g_defaults.dir.playlist);
path_mkdir(g_defaults.dir.cheats);
__android_log_print(ANDROID_LOG_INFO,
"RetroArch", "[ENV]: default savefile folder: [%s]",
@ -1643,6 +1615,9 @@ static void frontend_linux_get_env(int *argc,
__android_log_print(ANDROID_LOG_INFO,
"RetroArch", "[ENV]: default system folder: [%s]",
g_defaults.dir.system);
__android_log_print(ANDROID_LOG_INFO,
"RetroArch", "[ENV]: default screenshot folder: [%s]",
g_defaults.dir.screenshot);
}
}
}
@ -1749,8 +1724,6 @@ static void frontend_linux_get_env(int *argc,
"cheats", sizeof(g_defaults.dir.cheats));
fill_pathname_join(g_defaults.dir.overlay, base_path,
"overlay", sizeof(g_defaults.dir.overlay));
fill_pathname_join(g_defaults.dir.osk_overlay, base_path,
"overlay", sizeof(g_defaults.dir.osk_overlay));
fill_pathname_join(g_defaults.dir.core_assets, base_path,
"downloads", sizeof(g_defaults.dir.core_assets));
fill_pathname_join(g_defaults.dir.screenshot, base_path,
@ -1892,8 +1865,12 @@ static int frontend_linux_parse_drive_list(void *data)
FILE_TYPE_DIRECTORY, 0, 0);
menu_entries_append_enum(list,
internal_storage_path,
msg_hash_to_str(MSG_INTERNAL_MEMORY),
MSG_INTERNAL_MEMORY, FILE_TYPE_DIRECTORY, 0, 0);
msg_hash_to_str(MSG_INTERNAL_STORAGE),
MSG_INTERNAL_STORAGE, FILE_TYPE_DIRECTORY, 0, 0);
menu_entries_append_enum(list,
"/storage",
msg_hash_to_str(MSG_REMOVABLE_STORAGE),
MSG_REMOVABLE_STORAGE, FILE_TYPE_DIRECTORY, 0, 0);
#endif
menu_entries_append_enum(list, "/", "",

View File

@ -163,8 +163,6 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[],
"BUNDLE/DATABASE/RDB", sizeof(g_defaults.dir.database));
fill_pathname_join(g_defaults.dir.overlay, base_path,
"BUNDLE/OVERLAYS", sizeof(g_defaults.dir.overlay));
fill_pathname_join(g_defaults.dir.osk_overlay, base_path,
"BUNDLE/OVERLAYS", sizeof(g_defaults.dir.osk_overlay));
fill_pathname_join(g_defaults.dir.shader, base_path,
"BUNDLE/SHADERS", sizeof(g_defaults.dir.shader));
*/

View File

@ -273,6 +273,8 @@ int main(int argc, char **argv)
DEBUG_STR(argv[0]);
DEBUG_STR(argv[1]);
fflush(stdout);
#if 1
#if 0
int argc_ = 2;
// char* argv_[] = {WIIU_SD_PATH "retroarch/retroarch.elf", WIIU_SD_PATH "rom.nes", NULL};
@ -296,6 +298,7 @@ int main(int argc, char **argv)
}while(1);
main_exit(NULL);
#endif
fflush(stdout);
fflush(stderr);
ProcUIShutdown();
@ -316,8 +319,26 @@ void __eabi()
}
void __init();
void __fini();
__attribute__((weak))
void __init(void)
{
extern void(*__CTOR_LIST__[])(void);
void(**ctor)(void) = __CTOR_LIST__;
while(*ctor)
(*ctor++)();
}
__attribute__((weak))
void __fini(void)
{
extern void(*__DTOR_LIST__[])(void);
void(**ctor)(void) = __DTOR_LIST__;
while(*ctor)
(*ctor++)();
}
/* HBL elf entry point */
int __entry_menu(int argc, char **argv)
{
InitFunctionPointers();
@ -333,15 +354,16 @@ int __entry_menu(int argc, char **argv)
return ret;
}
/* RPX entry point */
__attribute__((noreturn))
void _start(int argc, char **argv)
{
memoryInitialize();
mount_sd_fat("sd");
// __init();
__init();
int ret = main(argc, argv);
// __fini();
__fini();
unmount_sd_fat("sd");
memoryRelease();

View File

@ -17,11 +17,11 @@
#include <stddef.h>
#include <string.h>
#include <retro_miscellaneous.h>
#include <windows.h>
#include <boolean.h>
#include <compat/strl.h>
#include <retro_miscellaneous.h>
#include <dynamic/dylib.h>
#include <lists/file_list.h>
#include <file/file_path.h>
@ -168,6 +168,7 @@ static void frontend_win32_get_os(char *s, size_t len, int *major, int *minor)
}
break;
default:
sprintf(s, "Windows %i.%i", *major, *minor);
break;
}
}
@ -176,7 +177,7 @@ static void frontend_win32_init(void *data)
{
typedef BOOL (WINAPI *isProcessDPIAwareProc)();
typedef BOOL (WINAPI *setProcessDPIAwareProc)();
HMODULE handle = GetModuleHandle(TEXT("User32.dll"));
HMODULE handle = GetModuleHandle("User32.dll");
isProcessDPIAwareProc isDPIAwareProc = (isProcessDPIAwareProc)dylib_proc(handle, "IsProcessDPIAware");
setProcessDPIAwareProc setDPIAwareProc = (setProcessDPIAwareProc)dylib_proc(handle, "SetProcessDPIAware");
@ -271,10 +272,6 @@ static void frontend_win32_environment_get(int *argc, char *argv[],
":\\thumbnails", sizeof(g_defaults.dir.thumbnails));
fill_pathname_expand_special(g_defaults.dir.overlay,
":\\overlays", sizeof(g_defaults.dir.overlay));
fill_pathname_expand_special(g_defaults.dir.osk_overlay,
":\\overlays", sizeof(g_defaults.dir.osk_overlay));
fill_pathname_expand_special(g_defaults.dir.osk_overlay,
":\\overlays", sizeof(g_defaults.dir.osk_overlay));
fill_pathname_expand_special(g_defaults.dir.core,
":\\cores", sizeof(g_defaults.dir.core));
fill_pathname_expand_special(g_defaults.dir.core_info,
@ -324,22 +321,29 @@ static uint64_t frontend_win32_get_mem_used(void)
static void frontend_win32_attach_console(void)
{
#ifdef _WIN32
#if(_WIN32_WINNT >= 0x0500)
if (!AttachConsole(ATTACH_PARENT_PROCESS))
{
AllocConsole();
AttachConsole( GetCurrentProcessId()) ;
freopen( "CON", "w", stdout );
freopen( "CON", "w", stderr );
}
freopen( "CON", "w", stdout );
freopen( "CON", "w", stderr );
#endif
#endif
}
static void frontend_win32_detach_console(void)
{
#if defined(_WIN32) && !defined(_XBOX)
HWND wnd = GetConsoleWindow();
FreeConsole();
PostMessage(wnd, WM_CLOSE, 0, 0);
#if(_WIN32_WINNT >= 0x0500)
if (!AttachConsole(ATTACH_PARENT_PROCESS))
{
HWND wnd = GetConsoleWindow();
FreeConsole();
PostMessage(wnd, WM_CLOSE, 0, 0);
}
#endif
#endif
}

View File

@ -22,6 +22,7 @@
#include <xgraphics.h>
#include <file/file_path.h>
#include <compat/strl.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
@ -35,12 +36,15 @@
#include "../frontend_driver.h"
#include "../../defaults.h"
#include "../../file_path_special.h"
#include "../../paths.h"
#ifndef IS_SALAMANDER
#include "../../retroarch.h"
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#endif
#include "../../verbosity.h"
#ifdef _XBOX360
@ -1271,7 +1275,7 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
snprintf((char*)ptr.Data, sizeof(ptr.Data), "%s", path_get(RARCH_PATH_CONTENT));
if (!string_is_empty(path))
XLaunchNewImage(path, !string_is_empty(ptr.Data) ? &ptr : NULL);
XLaunchNewImage(path, !string_is_empty((const char*)ptr.Data) ? &ptr : NULL);
#elif defined(_XBOX360)
char game_path[1024] = {0};

View File

@ -34,7 +34,10 @@
#include "../driver.h"
#include "../paths.h"
#include "../retroarch.h"
#ifndef HAVE_MAIN
#include "../runloop.h"
#endif
/**
* main_exit:

36
gfx/common/caca_common.h Normal file
View File

@ -0,0 +1,36 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* copyright (c) 2011-2015 - Daniel De Matteis
* copyright (c) 2016 - Brad Parker
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CACA_COMMON_H
#define __CACA_COMMON_H
struct caca_canvas;
struct caca_dither;
struct caca_display;
typedef struct caca_canvas caca_canvas_t;
typedef struct caca_dither caca_dither_t;
typedef struct caca_display caca_display_t;
typedef struct caca
{
caca_canvas_t **caca_cv;
caca_dither_t **caca_dither;
caca_display_t **caca_display;
} caca_t;
#endif

View File

@ -18,7 +18,9 @@
#include "d3d_common.h"
#ifdef HAVE_D3D9
#include "../include/d3d9/d3dx9tex.h"
#endif
bool d3d_swap(void *data, LPDIRECT3DDEVICE dev)
{
@ -367,8 +369,9 @@ void d3d_set_viewports(LPDIRECT3DDEVICE dev, D3DVIEWPORT *vp)
}
void d3d_set_texture(LPDIRECT3DDEVICE dev, unsigned sampler,
LPDIRECT3DTEXTURE tex)
void *tex_data)
{
LPDIRECT3DTEXTURE tex = (LPDIRECT3DTEXTURE)tex_data;
#if defined(_XBOX1)
D3DDevice_SetTexture(sampler, tex);
#elif defined(_XBOX360)
@ -475,8 +478,10 @@ void d3d_frame_postprocess(void *data)
if (!dev)
return;
#if 0
if (!d3d_restore_device(dev))
return;
#endif
dev->SetFlickerFilter(global->console.screen.flicker_filter_index);
dev->SetSoftDisplayFilter(global->console.softfilter_enable);

View File

@ -81,7 +81,7 @@ void d3d_lock_rectangle_clear(LPDIRECT3DTEXTURE tex,
void d3d_unlock_rectangle(LPDIRECT3DTEXTURE tex);
void d3d_set_texture(LPDIRECT3DDEVICE dev, unsigned sampler,
LPDIRECT3DTEXTURE tex);
void *tex_data);
HRESULT d3d_set_vertex_shader(LPDIRECT3DDEVICE dev, unsigned index,
void *data);

View File

@ -20,17 +20,18 @@
#include "drm_common.h"
uint32_t g_connector_id;
int g_drm_fd;
uint32_t g_crtc_id;
static drmModeCrtc *g_orig_crtc;
struct pollfd g_drm_fds;
static drmModeRes *g_drm_resources;
drmModeConnector *g_drm_connector;
static drmModeEncoder *g_drm_encoder;
drmModeModeInfo *g_drm_mode;
uint32_t g_connector_id = 0;
int g_drm_fd = 0;
uint32_t g_crtc_id = 0;
static drmModeCrtc *g_orig_crtc = NULL;
static drmModeRes *g_drm_resources = NULL;
drmModeConnector *g_drm_connector = NULL;
static drmModeEncoder *g_drm_encoder = NULL;
drmModeModeInfo *g_drm_mode = NULL;
drmEventContext g_drm_evctx;

View File

@ -29,7 +29,7 @@
#include "../../verbosity.h"
#include "../../frontend/frontend_driver.h"
bool g_egl_inited;
bool g_egl_inited = false;
unsigned g_egl_major = 0;
unsigned g_egl_minor = 0;

View File

@ -47,6 +47,8 @@
extern "C" {
#endif
#include <encodings/utf.h>
LRESULT win32_menu_loop(HWND owner, WPARAM wparam);
#ifndef _MSC_VER
@ -111,8 +113,8 @@ typedef REASON_CONTEXT POWER_REQUEST_CONTEXT, *PPOWER_REQUEST_CONTEXT, *LPPOWER_
#endif
static HMONITOR win32_monitor_last;
static unsigned win32_monitor_count;
static HMONITOR win32_monitor_all[MAX_MONITORS];
static unsigned win32_monitor_count = 0;
extern "C"
{
@ -215,7 +217,7 @@ void win32_monitor_get_info(void)
memset(&current_mon, 0, sizeof(current_mon));
current_mon.cbSize = sizeof(MONITORINFOEX);
GetMonitorInfo(win32_monitor_last, (MONITORINFO*)&current_mon);
GetMonitorInfo(win32_monitor_last, (MONITORINFOEX*)&current_mon);
ChangeDisplaySettingsEx(current_mon.szDevice, NULL, NULL, 0, NULL);
}
@ -253,7 +255,7 @@ void win32_monitor_info(void *data, void *hm_data, unsigned *mon_id)
memset(mon, 0, sizeof(*mon));
mon->cbSize = sizeof(MONITORINFOEX);
GetMonitorInfo(*hm_to_use, (MONITORINFO*)mon);
GetMonitorInfo(*hm_to_use, (MONITORINFOEX*)mon);
}
/* Get the count of the files dropped */
@ -269,7 +271,7 @@ static int win32_drag_query_file(HWND hwnd, WPARAM wparam)
core_info_list_t *core_info_list = NULL;
const core_info_t *core_info = NULL;
DragQueryFile((HDROP)wparam, 0, szFilename, 1024);
DragQueryFile((HDROP)wparam, 0, szFilename, sizeof(szFilename));
core_info_get_list(&core_info_list);
@ -588,6 +590,7 @@ static bool win32_monitor_set_fullscreen(unsigned width, unsigned height,
RARCH_LOG("Setting fullscreen to %ux%u @ %uHz on device %s.\n",
width, height, refresh, dev_name);
return ChangeDisplaySettingsEx(dev_name, &devmode,
NULL, CDS_FULLSCREEN, NULL) == DISP_CHANGE_SUCCESSFUL;
#endif
@ -646,7 +649,7 @@ bool win32_suppress_screensaver(void *data, bool enable)
typedef HANDLE (WINAPI * PowerCreateRequestPtr)(REASON_CONTEXT *context);
typedef BOOL (WINAPI * PowerSetRequestPtr)(HANDLE PowerRequest,
POWER_REQUEST_TYPE RequestType);
HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
HMODULE kernel32 = GetModuleHandle("kernel32.dll");
PowerCreateRequestPtr powerCreateRequest =
(PowerCreateRequestPtr)GetProcAddress(kernel32, "PowerCreateRequest");
PowerSetRequestPtr powerSetRequest =
@ -679,6 +682,7 @@ bool win32_suppress_screensaver(void *data, bool enable)
#endif
}
/* FIXME: It should not be necessary to add the W after MONITORINFOEX, but linking fails without it. */
void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use,
unsigned *width, unsigned *height, bool fullscreen, bool windowed_full,
RECT *rect, RECT *mon_rect, DWORD *style)
@ -711,7 +715,7 @@ void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use,
{}
/* Display settings might have changed, get new coordinates. */
GetMonitorInfo(*hm_to_use, (MONITORINFO*)current_mon);
GetMonitorInfo(*hm_to_use, (MONITORINFOEX*)current_mon);
*mon_rect = current_mon->rcMonitor;
}
}

View File

@ -94,9 +94,12 @@ void win32_check_window(bool *quit,
void win32_set_window(unsigned *width, unsigned *height,
bool fullscreen, bool windowed_full, void *rect_data);
#ifndef _XBOX
/* FIXME: It should not be necessary to add the W after MONITORINFOEX, but linking fails without it. */
void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use,
unsigned *width, unsigned *height, bool fullscreen, bool windowed_full,
RECT *rect, RECT *mon_rect, DWORD *style);
#endif
void win32_window_reset(void);

View File

@ -40,22 +40,22 @@ static DBusConnection* dbus_connection = NULL;
static unsigned int dbus_screensaver_cookie = 0;
#endif
static bool xdg_screensaver_available = true;
static bool xdg_screensaver_available = true;
bool g_x11_entered = false;
static bool g_x11_has_focus = false;
static bool g_x11_true_full = false;
Display *g_x11_dpy = NULL;
Colormap g_x11_cmap;
Window g_x11_win;
Display *g_x11_dpy;
static Atom XA_NET_WM_STATE;
static Atom XA_NET_WM_STATE_FULLSCREEN;
static Atom XA_NET_MOVERESIZE_WINDOW;
static Atom g_x11_quit_atom;
static bool g_x11_has_focus;
static XIM g_x11_xim;
static XIC g_x11_xic;
static bool g_x11_true_full;
bool g_x11_entered = false;
unsigned g_x11_screen;
@ -563,7 +563,7 @@ bool x11_alive(void *data)
while (XPending(g_x11_dpy))
{
bool filter;
bool filter = false;
/* Can get events from older windows. Check this. */
XNextEvent(g_x11_dpy, &event);

355
gfx/drivers/caca_gfx.c Normal file
View File

@ -0,0 +1,355 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis
* Copyright (C) 2016 - Brad Parker
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <retro_miscellaneous.h>
#include <caca.h>
#include "../../driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
#include "../../menu/menu_driver.h"
#include "../common/caca_common.h"
static caca_canvas_t *caca_cv = NULL;
static caca_dither_t *caca_dither = NULL;
static caca_display_t *caca_display = NULL;
static unsigned char *caca_menu_frame = NULL;
static unsigned caca_menu_width = 0;
static unsigned caca_menu_height = 0;
static unsigned caca_menu_pitch = 0;
static unsigned caca_video_width = 0;
static unsigned caca_video_height = 0;
static unsigned caca_video_pitch = 0;
static bool caca_rgb32 = 0;
static void caca_gfx_free(void *data);
static void caca_gfx_create()
{
caca_display = caca_create_display(NULL);
caca_cv = caca_get_canvas(caca_display);
if(!caca_video_width || !caca_video_height)
{
caca_video_width = caca_get_canvas_width(caca_cv);
caca_video_height = caca_get_canvas_height(caca_cv);
}
if (caca_rgb32)
caca_dither = caca_create_dither(32, caca_video_width, caca_video_height, caca_video_pitch,
0x00ff0000, 0xff00, 0xff, 0x0);
else
caca_dither = caca_create_dither(16, caca_video_width, caca_video_height, caca_video_pitch,
0xf800, 0x7e0, 0x1f, 0x0);
video_driver_set_size(&caca_video_width, &caca_video_height);
}
static void *caca_gfx_init(const video_info_t *video,
const input_driver_t **input, void **input_data)
{
settings_t *settings = config_get_ptr();
caca_t *caca = (caca_t*)calloc(1, sizeof(*caca));
caca->caca_cv = &caca_cv;
caca->caca_dither = &caca_dither;
caca->caca_display = &caca_display;
*input = NULL;
*input_data = NULL;
caca_video_width = video->width;
caca_video_height = video->height;
caca_rgb32 = video->rgb32;
if (video->rgb32)
caca_video_pitch = video->width * 4;
else
caca_video_pitch = video->width * 2;
caca_gfx_create();
if (!caca_cv || !caca_dither || !caca_display)
{
/* TODO: handle errors */
}
if (settings->video.font_enable)
font_driver_init_osd(NULL, false, FONT_DRIVER_RENDER_CACA);
return caca;
}
static bool caca_gfx_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height, uint64_t frame_count,
unsigned pitch, const char *msg)
{
size_t len = 0;
void *buffer = NULL;
const void *frame_to_copy = frame;
unsigned width = 0;
unsigned height = 0;
bool draw = true;
(void)data;
(void)frame;
(void)frame_width;
(void)frame_height;
(void)pitch;
(void)msg;
if (!frame || !frame_width || !frame_height)
return true;
if (caca_video_width != frame_width || caca_video_height != frame_height || caca_video_pitch != pitch)
{
if (frame_width > 4 && frame_height > 4)
{
caca_video_width = frame_width;
caca_video_height = frame_height;
caca_video_pitch = pitch;
caca_gfx_free(NULL);
caca_gfx_create();
}
}
if (!caca_cv)
return true;
if (caca_menu_frame)
frame_to_copy = caca_menu_frame;
width = caca_get_canvas_width(caca_cv);
height = caca_get_canvas_height(caca_cv);
if (frame_to_copy == frame && frame_width == 4 && frame_height == 4 && (frame_width < width && frame_height < height))
draw = false;
caca_clear_canvas(caca_cv);
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL);
#endif
if (msg)
font_driver_render_msg(NULL, msg, NULL);
if (draw)
{
caca_dither_bitmap(caca_cv, 0, 0,
width,
height,
caca_dither, frame_to_copy);
buffer = caca_export_canvas_to_memory(caca_cv, "caca", &len);
if (buffer)
{
if (len)
caca_refresh_display(caca_display);
free(buffer);
}
}
return true;
}
static void caca_gfx_set_nonblock_state(void *data, bool toggle)
{
(void)data;
(void)toggle;
}
static bool caca_gfx_alive(void *data)
{
(void)data;
video_driver_set_size(&caca_video_width, &caca_video_height);
return true;
}
static bool caca_gfx_focus(void *data)
{
(void)data;
return true;
}
static bool caca_gfx_suppress_screensaver(void *data, bool enable)
{
(void)data;
(void)enable;
return false;
}
static bool caca_gfx_has_windowed(void *data)
{
(void)data;
return true;
}
static void caca_gfx_free(void *data)
{
(void)data;
if (caca_display)
{
caca_free_display(caca_display);
caca_display = NULL;
}
if (caca_dither)
{
caca_free_dither(caca_dither);
caca_dither = NULL;
}
if (caca_menu_frame)
{
free(caca_menu_frame);
caca_menu_frame = NULL;
}
}
static bool caca_gfx_set_shader(void *data,
enum rarch_shader_type type, const char *path)
{
(void)data;
(void)type;
(void)path;
return false;
}
static void caca_gfx_set_rotation(void *data,
unsigned rotation)
{
(void)data;
(void)rotation;
}
static void caca_gfx_viewport_info(void *data,
struct video_viewport *vp)
{
(void)data;
(void)vp;
}
static bool caca_gfx_read_viewport(void *data, uint8_t *buffer)
{
(void)data;
(void)buffer;
return true;
}
static void caca_set_texture_frame(void *data,
const void *frame, bool rgb32, unsigned width, unsigned height,
float alpha)
{
unsigned pitch = width * 2;
if (rgb32)
pitch = width * 4;
if (caca_menu_frame)
{
free(caca_menu_frame);
caca_menu_frame = NULL;
}
if (!caca_menu_frame || caca_menu_width != width || caca_menu_height != height || caca_menu_pitch != pitch)
if (pitch && height)
caca_menu_frame = (unsigned char*)malloc(pitch * height);
if (caca_menu_frame && frame && pitch && height)
memcpy(caca_menu_frame, frame, pitch * height);
}
static void caca_set_osd_msg(void *data, const char *msg,
const struct font_params *params, void *font)
{
font_driver_render_msg(font, msg, params);
}
static const video_poke_interface_t caca_poke_interface = {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
#ifdef HAVE_FBO
NULL,
#else
NULL,
#endif
NULL,
NULL,
NULL,
#if defined(HAVE_MENU)
caca_set_texture_frame,
NULL,
caca_set_osd_msg,
NULL,
#else
NULL,
NULL,
NULL,
NULL,
#endif
NULL,
#ifdef HAVE_MENU
NULL,
#endif
};
static void caca_gfx_get_poke_interface(void *data,
const video_poke_interface_t **iface)
{
(void)data;
*iface = &caca_poke_interface;
}
void caca_gfx_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate)
{
}
video_driver_t video_caca = {
caca_gfx_init,
caca_gfx_frame,
caca_gfx_set_nonblock_state,
caca_gfx_alive,
caca_gfx_focus,
caca_gfx_suppress_screensaver,
caca_gfx_has_windowed,
caca_gfx_set_shader,
caca_gfx_free,
"caca",
caca_gfx_set_viewport,
caca_gfx_set_rotation,
caca_gfx_viewport_info,
caca_gfx_read_viewport,
NULL, /* read_frame_raw */
#ifdef HAVE_OVERLAY
NULL, /* overlay_interface */
#endif
caca_gfx_get_poke_interface,
};

View File

@ -757,7 +757,7 @@ static bool ctr_frame(void* data, const void* frame,
}
if (font_driver_has_render_msg() && msg)
if (msg)
font_driver_render_msg(NULL, msg, NULL);
// font_driver_render_msg(NULL, "TEST: 123 ABC àüî", NULL);

View File

@ -51,6 +51,7 @@
#include "../../performance_counters.h"
#include "../../defines/d3d_defines.h"
#include "../../runloop.h"
#include "../../verbosity.h"
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
@ -488,7 +489,7 @@ void d3d_make_d3dpp(void *data,
{
d3d_video_t *d3d = (d3d_video_t*)data;
settings_t *settings = config_get_ptr();
#ifdef _XBOX
#ifdef _XBOX360
/* TODO/FIXME - get rid of global state dependencies. */
global_t *global = global_get_ptr();
#endif
@ -1166,7 +1167,6 @@ static void *d3d_init(const video_info_t *info,
d3d->keep_aspect = info->force_aspect;
#ifdef _XBOX
video_driver_set_own_driver();
video_input_ctl(RARCH_INPUT_CTL_SET_OWN_DRIVER, NULL);
#endif
return d3d;
@ -1226,69 +1226,6 @@ static void d3d_free(void *data)
win32_destroy_window();
}
#ifdef _XBOX
#ifdef _XBOX1
#include <formats/image.h>
static bool texture_image_render(d3d_video_t *d3d,
struct texture_image *out_img,
int x, int y, int w, int h, bool force_fullscreen)
{
LPDIRECT3DTEXTURE d3dt;
LPDIRECT3DVERTEXBUFFER d3dv;
void *verts = NULL;
float fX = (float)(x);
float fY = (float)(y);
if (!d3d)
return false;
d3dt = (LPDIRECT3DTEXTURE)out_img->texture_buf;
d3dv = (LPDIRECT3DVERTEXBUFFER)out_img->vertex_buf;
if (!d3dt || !d3dv)
return false;
/* Create the new vertices. */
Vertex newVerts[] =
{
// x, y, z, color, u ,v
{fX, fY, 0.0f, 0, 0, 0},
{fX + w, fY, 0.0f, 0, 1, 0},
{fX + w, fY + h, 0.0f, 0, 1, 1},
{fX, fY + h, 0.0f, 0, 0, 1}
};
/* Load the existing vertices */
verts = d3d_vertex_buffer_lock(d3dv);
if (!verts)
return false;
/* Copy the new verts over the old verts */
memcpy(verts, newVerts, sizeof(newVerts));
d3d_vertex_buffer_unlock(d3dv);
d3d_enable_blend_func(d3d->dev);
d3d_enable_alpha_blend_texture_func(d3d->dev);
/* Draw the quad. */
d3d_set_texture(d3d->dev, 0, d3dt);
d3d_set_stream_source(d3d->dev, 0,
d3dv, 0, sizeof(Vertex));
d3d_set_vertex_shader(d3d->dev, D3DFVF_CUSTOMVERTEX, NULL);
if (force_fullscreen)
d3d_set_viewport(d3d, w, h, force_fullscreen, false);
d3d_draw_primitive(d3d->dev, D3DPT_QUADLIST, 0, 1);
return true;
}
#endif
#endif
#ifdef HAVE_OVERLAY
static void d3d_overlay_tex_geom(
void *data,
@ -1503,7 +1440,7 @@ static bool d3d_frame(void *data, const void *frame,
return false;
}
if (font_driver_has_render_msg() && msg)
if (msg)
{
struct font_params font_parms = {0};
font_driver_render_msg(NULL, msg, &font_parms);

View File

@ -17,6 +17,12 @@
#include <string.h>
#include <retro_inline.h>
#include "render_chain_driver.h"
#include "../d3d.h"
#include "../../common/d3d_common.h"
#include "../../video_shader_driver.h"
#include "../../../configuration.h"
#include "../../../verbosity.h"
@ -41,7 +47,9 @@ typedef struct xdk_renderchain
static void renderchain_set_mvp(void *data, unsigned vp_width,
unsigned vp_height, unsigned rotation)
{
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
video_shader_ctx_mvp_t mvp;
#endif
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
@ -51,7 +59,7 @@ static void renderchain_set_mvp(void *data, unsigned vp_width,
mvp.data = d3d;
mvp.matrix = NULL;
video_shadser_driver_set_mvp(&mvp);
video_shadser_driver_set_mvp(mvp);
#elif defined(HAVE_D3D8)
D3DXMATRIX p_out, p_rotate, mat;
D3DXMatrixOrthoOffCenterLH(&mat, 0, vp_width, vp_height, 0, 0.0f, 1.0f);
@ -135,9 +143,11 @@ static bool renderchain_create_first_pass(void *data,
static void renderchain_set_vertices(void *data, unsigned pass,
unsigned vert_width, unsigned vert_height, uint64_t frame_count)
{
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
#ifdef _XBOX
video_shader_ctx_params_t params;
video_shader_ctx_info_t shader_info;
#endif
#endif
unsigned width, height;
d3d_video_t *d3d = (d3d_video_t*)data;
@ -225,7 +235,7 @@ static void renderchain_set_vertices(void *data, unsigned pass,
shader_info.idx = pass;
shader_info.set_active = true;
video_shader_driver_use(&shader_info);
video_shader_driver_use(shader_info);
params.data = d3d;
params.width = vert_width;
@ -241,7 +251,7 @@ static void renderchain_set_vertices(void *data, unsigned pass,
params.fbo_info = NULL;
params.fbo_info_cnt = 0;
video_shader_driver_set_parameters(&params);
video_shader_driver_set_parameters(params);
#endif
#endif
}

View File

@ -20,6 +20,7 @@
#include <sys/mman.h>
#include <errno.h>
#include <compat/strl.h>
#include <rthreads/rthreads.h>
#include <string/stdstring.h>
@ -377,7 +378,7 @@ static void drm_format_name(const unsigned int fourcc, char *format_str)
for (i = 0; i < ARRAY_SIZE(format_info); i++)
{
if (format_info[i].format == fourcc)
strcpy(format_str, format_info[i].name);
strlcpy(format_str, format_info[i].name, sizeof(format_str));
}
}
@ -728,10 +729,13 @@ static void *drm_gfx_init(const video_info_t *video,
if (!init_drm())
{
RARCH_ERR ("DRM: Failed to initialize DRM\n");
free(_drmvars);
return NULL;
}
else
RARCH_LOG ("DRM: Init succesful.\n");
{
RARCH_LOG ("DRM: Init successful.\n");
}
_drmvars->kms_width = drm.current_mode->hdisplay;
_drmvars->kms_height = drm.current_mode->vdisplay;

View File

@ -234,7 +234,7 @@ static void gl_render_overlay(gl_t *gl)
shader_info.idx = VIDEO_SHADER_STOCK_BLEND;
shader_info.set_active = true;
video_shader_driver_use(&shader_info);
video_shader_driver_use(shader_info);
gl->coords.vertex = gl->overlay_vertex_coord;
gl->coords.tex_coord = gl->overlay_tex_coord;
@ -244,12 +244,12 @@ static void gl_render_overlay(gl_t *gl)
coords.handle_data = NULL;
coords.data = &gl->coords;
video_shader_driver_set_coords(&coords);
video_shader_driver_set_coords(coords);
mvp.data = gl;
mvp.matrix = &gl->mvp_no_rot;
video_shader_driver_set_mvp(&mvp);
video_shader_driver_set_mvp(mvp);
for (i = 0; i < gl->overlays; i++)
{
@ -521,7 +521,6 @@ static void gl_update_input_size(gl_t *gl, unsigned width,
GLfloat xamt, yamt;
bool set_coords = false;
if ((width != gl->last_width[gl->tex_index] ||
height != gl->last_height[gl->tex_index]) && gl->empty_buf)
{
@ -607,7 +606,12 @@ static void gl_init_textures_reference(gl_t *gl, unsigned i,
if (gl->egl_images)
return;
glTexImage2D(GL_TEXTURE_2D,
#ifndef HAVE_OPENGLES2
if (gl_check_capability(GL_CAPS_TEX_STORAGE))
glTexStorage2D(GL_TEXTURE_2D, 1, internal_fmt, gl->tex_w, gl->tex_h);
else
#endif
glTexImage2D(GL_TEXTURE_2D,
0, internal_fmt, gl->tex_w, gl->tex_h, 0, texture_type,
texture_fmt, gl->empty_buf ? gl->empty_buf : NULL);
#endif
@ -643,7 +647,7 @@ static void gl_init_textures(gl_t *gl, const video_info_t *video)
texture_fmt = gl->texture_fmt;
#endif
#ifdef HAVE_OPENGLES2
#ifdef HAVE_OPENGLES
/* GLES is picky about which format we use here.
* Without extensions, we can *only* render to 16-bit FBOs. */
@ -651,7 +655,12 @@ static void gl_init_textures(gl_t *gl, const video_info_t *video)
{
if (gl_check_capability(GL_CAPS_ARGB8))
{
internal_fmt = GL_RGBA;
#if !defined(HAVE_PSGL)
if (gl_check_capability(GL_CAPS_GLES3_SUPPORTED))
internal_fmt = GL_RGBA8_OES;
else
#endif
internal_fmt = GL_RGBA;
texture_type = GL_RGBA;
texture_fmt = GL_UNSIGNED_BYTE;
}
@ -826,7 +835,7 @@ static INLINE void gl_set_shader_viewport(gl_t *gl, unsigned idx)
shader_info.idx = idx;
shader_info.set_active = true;
video_shader_driver_use(&shader_info);
video_shader_driver_use(shader_info);
gl_set_viewport(gl, width, height, false, true);
}
@ -1041,19 +1050,19 @@ static INLINE void gl_draw_texture(gl_t *gl)
shader_info.idx = VIDEO_SHADER_STOCK_BLEND;
shader_info.set_active = true;
video_shader_driver_use(&shader_info);
video_shader_driver_use(shader_info);
gl->coords.vertices = 4;
coords.handle_data = NULL;
coords.data = &gl->coords;
video_shader_driver_set_coords(&coords);
video_shader_driver_set_coords(coords);
mvp.data = gl;
mvp.matrix = &gl->mvp_no_rot;
video_shader_driver_set_mvp(&mvp);
video_shader_driver_set_mvp(mvp);
glEnable(GL_BLEND);
@ -1109,7 +1118,7 @@ static bool gl_frame(void *data, const void *frame,
shader_info.idx = 1;
shader_info.set_active = true;
video_shader_driver_use(&shader_info);
video_shader_driver_use(shader_info);
#ifdef IOS
/* Apparently the viewport is lost each frame, thanks Apple. */
@ -1241,18 +1250,18 @@ static bool gl_frame(void *data, const void *frame,
params.fbo_info = NULL;
params.fbo_info_cnt = 0;
video_shader_driver_set_parameters(&params);
video_shader_driver_set_parameters(params);
gl->coords.vertices = 4;
coords.handle_data = NULL;
coords.data = &gl->coords;
video_shader_driver_set_coords(&coords);
video_shader_driver_set_coords(coords);
mvp.data = gl;
mvp.matrix = &gl->mvp;
video_shader_driver_set_mvp(&mvp);
video_shader_driver_set_mvp(mvp);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
@ -1274,7 +1283,7 @@ static bool gl_frame(void *data, const void *frame,
}
#endif
if (font_driver_has_render_msg() && msg)
if (msg)
font_driver_render_msg(NULL, msg, NULL);
#ifdef HAVE_OVERLAY
@ -1293,7 +1302,7 @@ static bool gl_frame(void *data, const void *frame,
shader_info.idx = 0;
shader_info.set_active = true;
video_shader_driver_use(&shader_info);
video_shader_driver_use(shader_info);
glBindTexture(GL_TEXTURE_2D, 0);
#ifndef NO_GL_FF_VERTEX

View File

@ -153,72 +153,63 @@ void gl_renderchain_convert_geometry(gl_t *gl,
}
}
static bool gl_recreate_fbo(
struct video_fbo_rect *fbo_rect,
GLuint fbo,
GLuint texture
GLuint* texture
)
{
glBindFramebuffer(RARCH_GL_FRAMEBUFFER, fbo);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D,
0, RARCH_GL_INTERNAL_FORMAT32,
fbo_rect->width,
fbo_rect->height,
0, RARCH_GL_TEXTURE_TYPE32,
RARCH_GL_FORMAT32, NULL);
glDeleteTextures(1, texture);
glGenTextures(1, texture);
glBindTexture(GL_TEXTURE_2D, *texture);
#if !defined(HAVE_OPENGLES2) && !defined(HAVE_PSGL)
if (gl_check_capability(GL_CAPS_TEX_STORAGE))
glTexStorage2D(GL_TEXTURE_2D, 1, RARCH_GL_INTERNAL_FORMAT32,
fbo_rect->width, fbo_rect->height);
else
#endif
glTexImage2D(GL_TEXTURE_2D,
0, RARCH_GL_INTERNAL_FORMAT32,
fbo_rect->width,
fbo_rect->height,
0, RARCH_GL_TEXTURE_TYPE32,
RARCH_GL_FORMAT32, NULL);
glFramebufferTexture2D(RARCH_GL_FRAMEBUFFER,
RARCH_GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
texture, 0);
*texture, 0);
if (glCheckFramebufferStatus(RARCH_GL_FRAMEBUFFER) != RARCH_GL_FRAMEBUFFER_COMPLETE)
{
RARCH_WARN("Failed to reinitialize FBO texture.\n");
return false;
}
if (glCheckFramebufferStatus(RARCH_GL_FRAMEBUFFER)
== RARCH_GL_FRAMEBUFFER_COMPLETE)
return true;
return true;
RARCH_WARN("Failed to reinitialize FBO texture.\n");
return false;
}
static void gl_check_fbo_dimension(gl_t *gl, unsigned i,
GLuint fbo, GLuint texture, bool update_feedback)
bool update_feedback)
{
unsigned img_width, img_height, max, pow2_size;
bool check_dimensions = false;
struct video_fbo_rect *fbo_rect = &gl->fbo_rect[i];
if (!fbo_rect)
return;
check_dimensions =
(fbo_rect->max_img_width > fbo_rect->width) ||
(fbo_rect->max_img_height > fbo_rect->height);
if (!check_dimensions)
return;
/* Check proactively since we might suddently
* get sizes of tex_w width or tex_h height. */
img_width = fbo_rect->max_img_width;
img_height = fbo_rect->max_img_height;
max = img_width > img_height ? img_width : img_height;
pow2_size = next_pow2(max);
unsigned img_width = fbo_rect->max_img_width;
unsigned img_height = fbo_rect->max_img_height;
unsigned max = img_width > img_height ? img_width : img_height;
unsigned pow2_size = next_pow2(max);
fbo_rect->width = fbo_rect->height = pow2_size;
fbo_rect->width = pow2_size;
fbo_rect->height = pow2_size;
gl_recreate_fbo(fbo_rect, fbo, texture);
gl_recreate_fbo(fbo_rect, gl->fbo[i], &gl->fbo_texture[i]);
/* Update feedback texture in-place so we avoid having to
* juggle two different fbo_rect structs since they get updated here. */
if (update_feedback)
{
if (gl_recreate_fbo(fbo_rect, gl->fbo_feedback,
gl->fbo_feedback_texture))
&gl->fbo_feedback_texture))
{
/* Make sure the feedback textures are cleared
* so we don't feedback noise. */
@ -243,8 +234,12 @@ void gl_check_fbo_dimensions(gl_t *gl)
{
bool update_feedback = gl->fbo_feedback_enable
&& (unsigned)i == gl->fbo_feedback_pass;
gl_check_fbo_dimension(gl, i, gl->fbo[i],
gl->fbo_texture[i], update_feedback);
struct video_fbo_rect *fbo_rect = &gl->fbo_rect[i];
bool check_dimensions =
(fbo_rect->max_img_width > fbo_rect->width) ||
(fbo_rect->max_img_height > fbo_rect->height);
if (fbo_rect && check_dimensions)
gl_check_fbo_dimension(gl, i, update_feedback);
}
}
void gl_renderchain_render(gl_t *gl,
@ -302,7 +297,7 @@ void gl_renderchain_render(gl_t *gl,
shader_info.idx = i + 1;
shader_info.set_active = true;
video_shader_driver_use(&shader_info);
video_shader_driver_use(shader_info);
glBindTexture(GL_TEXTURE_2D, gl->fbo_texture[i - 1]);
mip_level = i + 1;
@ -330,19 +325,19 @@ void gl_renderchain_render(gl_t *gl,
params.fbo_info = fbo_tex_info;
params.fbo_info_cnt = fbo_tex_info_cnt;
video_shader_driver_set_parameters(&params);
video_shader_driver_set_parameters(params);
gl->coords.vertices = 4;
coords.handle_data = NULL;
coords.data = &gl->coords;
video_shader_driver_set_coords(&coords);
video_shader_driver_set_coords(coords);
mvp.data = gl;
mvp.matrix = &gl->mvp;
video_shader_driver_set_mvp(&mvp);
video_shader_driver_set_mvp(mvp);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@ -377,7 +372,7 @@ void gl_renderchain_render(gl_t *gl,
shader_info.idx = gl->fbo_pass + 1;
shader_info.set_active = true;
video_shader_driver_use(&shader_info);
video_shader_driver_use(shader_info);
glBindTexture(GL_TEXTURE_2D, gl->fbo_texture[gl->fbo_pass - 1]);
@ -404,7 +399,7 @@ void gl_renderchain_render(gl_t *gl,
params.fbo_info = fbo_tex_info;
params.fbo_info_cnt = fbo_tex_info_cnt;
video_shader_driver_set_parameters(&params);
video_shader_driver_set_parameters(params);
gl->coords.vertex = gl->vertex_ptr;
@ -413,12 +408,12 @@ void gl_renderchain_render(gl_t *gl,
coords.handle_data = NULL;
coords.data = &gl->coords;
video_shader_driver_set_coords(&coords);
video_shader_driver_set_coords(coords);
mvp.data = gl;
mvp.matrix = &gl->mvp;
video_shader_driver_set_mvp(&mvp);
video_shader_driver_set_mvp(mvp);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
gl->coords.tex_coord = gl->tex_info.coord;
@ -529,11 +524,17 @@ static void gl_create_fbo_texture(gl_t *gl, unsigned i, GLuint texture)
RARCH_ERR("[GL]: Floating-point FBO was requested, but is not supported. Falling back to UNORM. Result may band/clip/etc.!\n");
}
#ifndef HAVE_OPENGLES2
#if !defined(HAVE_OPENGLES2)
if (fp_fbo && gl->has_fp_fbo)
{
RARCH_LOG("[GL]: FBO pass #%d is floating-point.\n", i);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F,
#if !defined(HAVE_PSGL)
if (gl_check_capability(GL_CAPS_TEX_STORAGE))
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA32F,
gl->fbo_rect[i].width, gl->fbo_rect[i].height);
else
#endif
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F,
gl->fbo_rect[i].width, gl->fbo_rect[i].height,
0, GL_RGBA, GL_FLOAT, NULL);
}
@ -564,7 +565,11 @@ static void gl_create_fbo_texture(gl_t *gl, unsigned i, GLuint texture)
gl->has_srgb_fbo_gles3 ? GL_RGBA : GL_SRGB_ALPHA_EXT,
GL_UNSIGNED_BYTE, NULL);
#else
glTexImage2D(GL_TEXTURE_2D,
if (gl_check_capability(GL_CAPS_TEX_STORAGE))
glTexStorage2D(GL_TEXTURE_2D, 1, GL_SRGB8_ALPHA8,
gl->fbo_rect[i].width, gl->fbo_rect[i].height);
else
glTexImage2D(GL_TEXTURE_2D,
0, GL_SRGB8_ALPHA8,
gl->fbo_rect[i].width, gl->fbo_rect[i].height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
@ -573,7 +578,7 @@ static void gl_create_fbo_texture(gl_t *gl, unsigned i, GLuint texture)
else
#endif
{
#ifdef HAVE_OPENGLES2
#if defined(HAVE_OPENGLES2) || defined(HAVE_PSGL)
glTexImage2D(GL_TEXTURE_2D,
0, GL_RGBA,
gl->fbo_rect[i].width, gl->fbo_rect[i].height, 0,
@ -581,7 +586,11 @@ static void gl_create_fbo_texture(gl_t *gl, unsigned i, GLuint texture)
#else
/* Avoid potential performance
* reductions on particular platforms. */
glTexImage2D(GL_TEXTURE_2D,
if (gl_check_capability(GL_CAPS_TEX_STORAGE))
glTexStorage2D(GL_TEXTURE_2D, 1, RARCH_GL_INTERNAL_FORMAT32,
gl->fbo_rect[i].width, gl->fbo_rect[i].height);
else
glTexImage2D(GL_TEXTURE_2D,
0, RARCH_GL_INTERNAL_FORMAT32,
gl->fbo_rect[i].width, gl->fbo_rect[i].height, 0,
RARCH_GL_TEXTURE_TYPE32, RARCH_GL_FORMAT32, NULL);

View File

@ -0,0 +1,14 @@
#include "shaders_common.h"
static const char *stock_vertex_xmb_snow_legacy = GLSL(
attribute vec3 VertexCoord;
uniform float time;
void main()
{
vec3 v = vec3(VertexCoord.x, 0.0, VertexCoord.y);
vec3 v2 = v;
v.y = v.z;
gl_Position = vec4(VertexCoord.x, VertexCoord.y, VertexCoord.y, 1.0);
}
);

View File

@ -1,6 +1,6 @@
#include "shaders_common.h"
static const char *stock_vertex_xmb_legacy = GLSL(
static const char *stock_vertex_xmb_ribbon_legacy = GLSL(
attribute vec3 VertexCoord;
uniform float time;
varying vec3 fragVertexEc;

View File

@ -1,6 +1,6 @@
#include "shaders_common.h"
static const char *stock_vertex_xmb_simple_legacy = GLSL(
static const char *stock_vertex_xmb_ribbon_simple_legacy = GLSL(
attribute vec3 VertexCoord;
uniform float time;
float iqhash( float n )

View File

@ -0,0 +1,16 @@
#include "shaders_common.h"
/* Need to duplicate these to work around broken stuff on Android.
* Must enforce alpha = 1.0 or 32-bit games can potentially go black. */
static const char *stock_vertex_xmb_snow_modern = GLSL(
attribute vec2 TexCoord;
attribute vec2 VertexCoord;
attribute vec4 Color;
uniform mat4 MVPMatrix;
varying vec2 tex_coord;
void main() {
gl_Position = MVPMatrix * vec4(VertexCoord, 0.0, 1.0);
tex_coord = TexCoord;
}
);

View File

@ -1,6 +1,6 @@
#include "shaders_common.h"
static const char *stock_vertex_xmb_modern = GLSL(
static const char *stock_vertex_xmb_ribbon_modern = GLSL(
in vec3 VertexCoord;
uniform float time;
out vec3 fragVertexEc;

View File

@ -0,0 +1,60 @@
#include "shaders_common.h"
static const char *stock_xmb_snow = CG(
struct input
{
float time;
};
float iqhash(float n)
{
return frac(sin(n)*43758.5453);
}
float noise(float3 x)
{
float3 p = floor(x);
float3 f = frac(x);
f = f * f * (3.0 - 2.0 * f);
float n = p.x + p.y * 57.0 + 113.0 * p.z;
return lerp(lerp(lerp(iqhash(n+0.0), iqhash(n+1.0), f.x),
lerp(iqhash(n+57.0), iqhash(n+58.0), f.x), f.y),
lerp(lerp(iqhash(n+113.0), iqhash(n+114.0), f.x),
lerp(iqhash(n+170.0), iqhash(n+171.0), f.x), f.y), f.z);
}
void main_vertex
(
float2 position : POSITION,
float4 color : COLOR,
float2 texCoord : TEXCOORD0,
uniform input IN,
out float4 oPosition : POSITION,
out float4 oColor : COLOR,
out float2 otexCoord : TEXCOORD
)
{
float3 v = float3(position.x, 0.0, position.y);
float3 v2 = v;
v2.x = v2.x + IN.time / 2.0;
v2.z = v.z * 3.0;
v.y = -cos((v.x + v.z / 3.0 + IN.time) * 2.0) / 10.0 - noise(v2.xyz) / 3.0;
oPosition = float4(v, 1.0);
oColor = color;
otexCoord = texCoord;
}
struct output
{
float4 color : COLOR;
};
output main_fragment(uniform input IN)
{
output OUT;
OUT.color = float4(1.0, 1.0, 1.0, 0.05);
return OUT;
}
);

View File

@ -0,0 +1,69 @@
#include "shaders_common.h"
static const char* stock_fragment_xmb_snow = GLSL(
uniform float time;
uniform vec2 OutputSize;
float baseScale = 3.5; // [1.0 .. 10.0]
float density = 0.7; // [0.01 .. 1.0]
float speed = 0.25; // [0.1 .. 1.0]
float rand(vec2 co)
{
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
}
float dist_func(vec2 distv)
{
float dist = sqrt((distv.x * distv.x) + (distv.y * distv.y)) * (40.0 / baseScale);
dist = clamp(dist, 0.0, 1.0);
return cos(dist * (3.14159265358 * 0.5)) * 0.5;
}
float random_dots(vec2 co)
{
float part = 1.0 / 20.0;
vec2 cd = floor(co / part);
float p = rand(cd);
if (p > 0.005 * (density * 40.0))
return 0.0;
vec2 dpos = (vec2(fract(p * 2.0) , p) + vec2(2.0, 2.0)) * 0.25;
vec2 cellpos = fract(co / part);
vec2 distv = (cellpos - dpos);
return dist_func(distv);
}
float snow(vec2 pos, float time, float scale)
{
// add wobble
pos.x += cos(pos.y * 1.2 + time * 3.14159 * 2.0 + 1.0 / scale) / (8.0 / scale) * 4.0;
// add gravity
pos += time * scale * vec2(-0.5, 1.0) * 4.0;
return random_dots(pos / scale) * (scale * 0.5 + 0.5);
}
void main(void)
{
float tim = time * 0.4 * speed;
vec2 pos = gl_FragCoord.xy / OutputSize.xx;
float a = 0.0;
// Each of these is a layer of snow
// Remove some for better performance
// Changing the scale (3rd value) will mess with the looping
a += snow(pos, tim, 1.0);
a += snow(pos, tim, 0.7);
a += snow(pos, tim, 0.6);
a += snow(pos, tim, 0.5);
a += snow(pos, tim, 0.4);
a += snow(pos, tim, 0.3);
a += snow(pos, tim, 0.25);
a += snow(pos, tim, 0.125);
a = a * min(pos.y * 4.0, 1.0);
gl_FragColor = vec4(1.0, 1.0, 1.0, a);
}
);

View File

@ -0,0 +1,69 @@
#include "shaders_common.h"
static const char *stock_fragment_xmb_simple_snow = GLSL(
uniform float time;
uniform vec2 OutputSize;
float baseScale = 1.25; // [1.0 .. 10.0]
float density = 0.5; // [0.01 .. 1.0]
float speed = 0.15; // [0.1 .. 1.0]
float rand(vec2 co)
{
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
}
float dist_func(vec2 distv)
{
float dist = sqrt((distv.x * distv.x) + (distv.y * distv.y)) * (40.0 / baseScale);
dist = clamp(dist, 0.0, 1.0);
return cos(dist * (3.14159265358 * 0.5)) * 0.5;
}
float random_dots(vec2 co)
{
float part = 1.0 / 20.0;
vec2 cd = floor(co / part);
float p = rand(cd);
if (p > 0.005 * (density * 40.0))
return 0.0;
vec2 dpos = (vec2(fract(p * 2.0) , p) + vec2(2.0, 2.0)) * 0.25;
vec2 cellpos = fract(co / part);
vec2 distv = (cellpos - dpos);
return dist_func(distv);
}
float snow(vec2 pos, float time, float scale)
{
// add wobble
pos.x += cos(pos.y * 1.2 + time * 3.14159 * 2.0 + 1.0 / scale) / (8.0 / scale) * 4.0;
// add gravity
pos += time * scale * vec2(-0.5, 1.0) * 4.0;
return random_dots(pos / scale) * (scale * 0.5 + 0.5);
}
void main(void)
{
float tim = time * 0.4 * speed;
vec2 pos = gl_FragCoord.xy / OutputSize.xx;
float a = 0.0;
// Each of these is a layer of snow
// Remove some for better performance
// Changing the scale (3rd value) will mess with the looping
a += snow(pos, tim, 1.0);
a += snow(pos, tim, 0.7);
a += snow(pos, tim, 0.6);
a += snow(pos, tim, 0.5);
a += snow(pos, tim, 0.4);
a += snow(pos, tim, 0.3);
a += snow(pos, tim, 0.25);
a += snow(pos, tim, 0.125);
a = a * min(pos.y * 4.0, 1.0);
gl_FragColor = vec4(1.0, 1.0, 1.0, a);
}
);

View File

@ -1,6 +1,6 @@
#include "shaders_common.h"
static const char *stock_xmb_simple = CG(
static const char *stock_xmb_ribbon_simple = CG(
struct input
{
float time;

View File

@ -1,6 +1,6 @@
#include "shaders_common.h"
static const char *stock_fragment_xmb_simple = GLSL(
static const char *stock_fragment_xmb_ribbon_simple = GLSL(
uniform float time;
void main()

View File

@ -3,8 +3,26 @@
#if defined(HAVE_OPENGLES)
#define CG(src) "" #src
#define GLSL(src) "precision mediump float;\n" #src
#define GLSL_330(src) "#version 330 es\nprecision mediump float;\n" #src
#define GLSL(src) "#extension GL_OES_standard_derivatives : enable\n" \
"#ifdef GL_ES\n" \
" #ifdef GL_FRAGMENT_PRECISION_HIGH\n" \
" precision highp float;\n" \
" #else\n" \
" precision mediump float;\n" \
" #endif\n" \
"#else\n" \
" precision mediump float;\n" \
"#endif\n" #src
#define GLSL_330(src) "#version 330 es\n" \
"#ifdef GL_ES\n" \
" #ifdef GL_FRAGMENT_PRECISION_HIGH\n" \
" precision highp float;\n" \
" #else\n" \
" precision mediump float;\n" \
" #endif\n" \
"#else\n" \
" precision mediump float;\n" \
"#endif\n" #src
#else
#define CG(src) "" #src
#define GLSL(src) "" #src

View File

@ -43,7 +43,6 @@ static void *vita2d_gfx_init(const video_info_t *video,
const input_driver_t **input, void **input_data)
{
vita_video_t *vita = (vita_video_t *)calloc(1, sizeof(vita_video_t));
settings_t *settings = config_get_ptr();
unsigned temp_width = PSP_FB_WIDTH;
unsigned temp_height = PSP_FB_HEIGHT;
@ -133,7 +132,6 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
vita_video_t *vita = (vita_video_t *)data;
settings_t *settings = config_get_ptr();
if (frame)
{
if(!(vita->texture&&vita2d_texture_get_datap(vita->texture)==frame)){

View File

@ -1282,7 +1282,7 @@ static void vulkan_set_rotation(void *data, unsigned rotation)
if (!vk)
return;
vk->rotation = 90 * rotation;
vk->rotation = 270 * rotation;
vulkan_set_projection(vk, &ortho, true);
}
@ -2076,9 +2076,9 @@ static void vulkan_set_texture_frame(void *data,
uint8_t *dst = NULL;
const uint8_t *src = NULL;
vk_t *vk = (vk_t*)data;
unsigned index = vk->context->current_swapchain_index;
struct vk_texture *texture = &vk->menu.textures[index];
struct vk_texture *texture_optimal = &vk->menu.textures_optimal[index];
unsigned index = 0;
struct vk_texture *texture = NULL;
struct vk_texture *texture_optimal = NULL;
const VkComponentMapping br_swizzle = {
VK_COMPONENT_SWIZZLE_B,
VK_COMPONENT_SWIZZLE_G,
@ -2089,6 +2089,10 @@ static void vulkan_set_texture_frame(void *data,
if (!vk)
return;
index = vk->context->current_swapchain_index;
texture = &vk->menu.textures[index];
texture_optimal = &vk->menu.textures_optimal[index];
/* B4G4R4A4 must be supported, but R4G4B4A4 is optional,
* just apply the swizzle in the image view instead. */
*texture = vulkan_create_texture(vk,
@ -2151,16 +2155,42 @@ static uintptr_t vulkan_load_texture(void *video_data, void *data,
vk_t *vk = (vk_t*)video_data;
struct texture_image *image = (struct texture_image*)data;
struct vk_texture *texture = (struct vk_texture*)calloc(1, sizeof(*texture));
if (!texture)
if (!image || !texture)
return 0;
*texture = vulkan_create_texture(vk, NULL,
image->width, image->height, VK_FORMAT_B8G8R8A8_UNORM,
image->pixels, NULL, VULKAN_TEXTURE_STATIC);
if (!image->pixels || !image->width || !image->height)
{
/* Create a dummy texture instead. */
#define T0 0xff000000u
#define T1 0xffffffffu
static const uint32_t checkerboard[] = {
T0, T1, T0, T1, T0, T1, T0, T1,
T1, T0, T1, T0, T1, T0, T1, T0,
T0, T1, T0, T1, T0, T1, T0, T1,
T1, T0, T1, T0, T1, T0, T1, T0,
T0, T1, T0, T1, T0, T1, T0, T1,
T1, T0, T1, T0, T1, T0, T1, T0,
T0, T1, T0, T1, T0, T1, T0, T1,
T1, T0, T1, T0, T1, T0, T1, T0,
};
#undef T0
#undef T1
*texture = vulkan_create_texture(vk, NULL,
8, 8, VK_FORMAT_B8G8R8A8_UNORM,
checkerboard, NULL, VULKAN_TEXTURE_STATIC);
texture->default_smooth = false;
texture->mipmap = false;
}
else
{
*texture = vulkan_create_texture(vk, NULL,
image->width, image->height, VK_FORMAT_B8G8R8A8_UNORM,
image->pixels, NULL, VULKAN_TEXTURE_STATIC);
texture->default_smooth =
filter_type == TEXTURE_FILTER_MIPMAP_LINEAR || filter_type == TEXTURE_FILTER_LINEAR;
texture->mipmap = filter_type == TEXTURE_FILTER_MIPMAP_LINEAR;
texture->default_smooth =
filter_type == TEXTURE_FILTER_MIPMAP_LINEAR || filter_type == TEXTURE_FILTER_LINEAR;
texture->mipmap = filter_type == TEXTURE_FILTER_MIPMAP_LINEAR;
}
return (uintptr_t)texture;
}

View File

@ -0,0 +1,13 @@
#version 310 es
layout(location = 0) in vec3 VertexCoord;
layout(std140, set = 0, binding = 0) uniform UBO
{
float time;
} constants;
void main()
{
gl_Position = MVPMatrix * vec4(VertexCoord, 0.0, 1.0);
}

View File

@ -0,0 +1,66 @@
#version 310 es
precision highp float;
layout(std140, set = 0, binding = 0) uniform UBO
{
float time;
} constants;
layout(location = 0) out vec4 FragColor;
vec2 res = vec2(1920*3, 1080*3);
// High quality = larger patterns
// quality * 84 is the number of seconds in a loop
float quality = 8.0;
float Cellular2D(vec2 P) {
// https://github.com/BrianSharpe/Wombat/blob/master/Cellular2D.glsl
vec2 Pi = floor(P);
vec2 Pf = P - Pi;
vec2 Pt = vec2( Pi.x, Pi.y + 1.0 );
Pt = Pt - floor(Pt * ( 1.0 / 71.0 )) * 71.0;
Pt += vec2( 26.0, 161.0 ).xy;
Pt *= Pt;
Pt = Pt.xy * Pt.yx;
float hash_x = fract( Pt * ( 1.0 / 951.135664 ) ).x * 2.0 - 1.0;
float hash_y = fract( Pt * ( 1.0 / 642.949883 ) ).y * 2.0 - 1.0;
const float JITTER_WINDOW = 0.25;
hash_x = ( ( hash_x * hash_x * hash_x ) - sign( hash_x ) ) * JITTER_WINDOW;
hash_y = ( ( hash_y * hash_y * hash_y ) - sign( hash_y ) ) * JITTER_WINDOW;
vec2 dd = vec2(Pf.x - hash_x, Pf.y - hash_y);
float d = dd.x * dd.x + dd.y * dd.y;
return d * ( 1.0 / 1.125 );
}
float snow(vec2 pos, float time, float scale) {
// add wobble
pos.x += cos(pos.y*4.0 + time*3.14159*2.0 + 1.0/scale)/(8.0/scale);
// add gravity
pos += time*scale*vec2(-0.5, 1.0);
return max(
1.0 - Cellular2D(mod(pos/scale, scale*quality)*16.0)*1024.0,
0.0
) * (scale*0.5 + 0.5);
}
void main()
{
float winscale = max(res.x, res.y);
float tim = mod(constants.time/800.0, 84.0*quality);
vec2 pos = gl_FragCoord.xy/winscale;
float a = 0.0;
// Each of these is a layer of snow
// Remove some for better performance
// Changing the scale (3rd value) will mess with the looping
a += snow(pos, tim, 1.0);
a += snow(pos, tim, 0.7);
a += snow(pos, tim, 0.6);
a += snow(pos, tim, 0.5);
a += snow(pos, tim, 0.4);
a += snow(pos, tim, 0.3);
a += snow(pos, tim, 0.25);
a += snow(pos, tim, 0.125);
a = a * min(pos.y*4.0, 1.0);
FragColor = vec4(1.0, 1.0, 1.0, a);
}

View File

@ -16,6 +16,7 @@
#include "../../driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
#include "performance_counters.h"
#include <string.h>
#include <coreinit/screen.h>
@ -474,6 +475,9 @@ static void* wiiu_gfx_init(const video_info_t* video,
wiiu->vp.full_height = 480;
video_driver_set_size(&wiiu->vp.width, &wiiu->vp.height);
float refresh_rate = 60.0f / 1.001f;
driver_ctl(RARCH_DRIVER_CTL_SET_REFRESH_RATE, &refresh_rate);
return wiiu;
}
static void wiiu_gfx_free(void* data)
@ -582,16 +586,17 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
printf("\rfps: %8.8f frames : %5i", fps, wiiu->frames++);
fflush(stdout);
static struct retro_perf_counter gfx_frame_perf = {0};
performance_counter_init(&gfx_frame_perf, "gfx_frame");
performance_counter_start(&gfx_frame_perf);
if (wiiu->should_resize)
wiiu_gfx_update_viewport(wiiu);
GX2ClearColor(&wiiu->color_buffer, 0.0f, 0.0f, 0.0f, 1.0f);
/* can't call GX2ClearColor after GX2SetContextState for whatever reason */
GX2SetContextState(wiiu->ctx_state);
if(frame)
{
if (width > wiiu->texture.surface.width)
@ -655,6 +660,7 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
GX2SetPixelSampler(&wiiu->sampler_linear, wiiu->shader->sampler.location);
GX2DrawEx(GX2_PRIMITIVE_MODE_QUADS, 4, 0, 1);
GX2DrawDone();
}
GX2CopyColorBufferToScanBuffer(&wiiu->color_buffer, GX2_SCAN_TARGET_DRC);
@ -662,6 +668,7 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
GX2SwapScanBuffers();
GX2Flush();
performance_counter_stop(&gfx_frame_perf);
return true;
}

View File

@ -40,13 +40,13 @@
#include "../../configuration.h"
#include "../../runloop.h"
static enum gfx_ctx_api android_api;
static enum gfx_ctx_api android_api = GFX_CTX_NONE;
/* forward declaration */
int system_property_get(const char *cmd, const char *args, char *value);
#ifdef HAVE_OPENGLES
static bool g_es3;
static bool g_es3 = false;
#ifndef EGL_OPENGL_ES3_BIT_KHR
#define EGL_OPENGL_ES3_BIT_KHR 0x0040
@ -105,11 +105,15 @@ static void *android_gfx_ctx_init(void *video_driver)
#ifdef HAVE_OPENGLES
EGLint n, major, minor;
EGLint format;
#if 0
struct retro_hw_render_callback *hwr = video_driver_get_hw_context();
bool debug = hwr->debug_context;
#endif
EGLint context_attributes[] = {
EGL_CONTEXT_CLIENT_VERSION, g_es3 ? 3 : 2,
#if 0
EGL_CONTEXT_FLAGS_KHR, debug ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0,
#endif
EGL_NONE
};
EGLint attribs[] = {
@ -247,8 +251,8 @@ static void android_gfx_ctx_check_window(void *data, bool *quit,
#ifdef HAVE_VULKAN
/* Swapchains are recreated in set_resize as a
* central place, so use that to trigger swapchain reinit. */
*resize = and->vk.need_new_swapchain;
new_width = and->width;
*resize = and->vk.need_new_swapchain;
new_width = and->width;
new_height = and->height;
#endif
break;
@ -276,7 +280,7 @@ static bool android_gfx_ctx_set_resize(void *data,
unsigned width, unsigned height)
{
#ifdef HAVE_VULKAN
android_ctx_data_t *and = (android_ctx_data_t*)data;
android_ctx_data_t *and = (android_ctx_data_t*)data;
struct android_app *android_app = (struct android_app*)g_android;
#endif
(void)data;
@ -367,7 +371,7 @@ static void android_gfx_ctx_input_driver(void *data,
(void)data;
*input = androidinput ? &input_android : NULL;
*input = androidinput ? &input_android : NULL;
*input_data = androidinput;
}
@ -403,6 +407,7 @@ static bool android_gfx_ctx_bind_api(void *data,
#else
break;
#endif
case GFX_CTX_NONE:
default:
break;
}
@ -412,7 +417,7 @@ static bool android_gfx_ctx_bind_api(void *data,
static bool android_gfx_ctx_has_focus(void *data)
{
bool focused;
bool focused = false;
struct android_app *android_app = (struct android_app*)g_android;
if (!android_app)
return true;

View File

@ -24,12 +24,15 @@
#include "../../config.h"
#endif
#include <compat/strl.h>
#include "../drivers/d3d.h"
#include "../common/win32_common.h"
#include "../../configuration.h"
#include "../../runloop.h"
#include "../../verbosity.h"
#include "../../ui/ui_companion_driver.h"
#ifdef _MSC_VER
#ifndef _XBOX

View File

@ -61,14 +61,14 @@
#endif
static enum gfx_ctx_api drm_api;
static enum gfx_ctx_api drm_api = GFX_CTX_NONE;
static struct gbm_bo *g_bo;
static struct gbm_bo *g_next_bo;
static struct gbm_surface *g_gbm_surface;
static struct gbm_device *g_gbm_dev;
static struct gbm_bo *g_bo = NULL;
static struct gbm_bo *g_next_bo = NULL;
static struct gbm_surface *g_gbm_surface = NULL;
static struct gbm_device *g_gbm_dev = NULL;
static bool waiting_for_flip;
static bool waiting_for_flip = false;
typedef struct gfx_ctx_drm_data
{
@ -277,8 +277,11 @@ static void gfx_ctx_drm_update_window_title(void *data)
char buf_fps[128];
settings_t *settings = config_get_ptr();
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (settings->fps_show)
runloop_msg_queue_push( buf_fps, 1, 1, false);
}
@ -362,7 +365,7 @@ static void *gfx_ctx_drm_init(void *video_driver)
unsigned gpu_index = 0;
const char *gpu = NULL;
struct string_list *gpu_descriptors = NULL;
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)
calloc(1, sizeof(gfx_ctx_drm_data_t));
if (!drm)

View File

@ -50,12 +50,12 @@ typedef struct
unsigned width, height;
} mali_ctx_data_t;
static enum gfx_ctx_api mali_api;
static enum gfx_ctx_api mali_api = GFX_CTX_NONE;
static void gfx_ctx_mali_fbdev_destroy(void *data)
{
int fb;
RFILE *fd;
RFILE *fd = NULL;
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;
if (mali)
@ -160,11 +160,11 @@ static bool gfx_ctx_mali_fbdev_set_resize(void *data,
static void gfx_ctx_mali_fbdev_update_window_title(void *data)
{
char buf[128] = {0};
char buf_fps[128] = {0};
char buf[128];
char buf_fps[128];
settings_t *settings = config_get_ptr();
(void)data;
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps));

View File

@ -255,7 +255,7 @@ static gfx_ctx_proc_t gfx_ctx_opendingux_get_proc_address(const char *symbol)
{
#ifdef HAVE_EGL
return egl_get_proc_address(symbol);
#else
#endif
}
static void gfx_ctx_opendingux_bind_hw_render(void *data, bool enable)

View File

@ -25,6 +25,8 @@
#include <sys/un.h>
#include <poll.h>
#include <compat/strl.h>
#include <GL/osmesa.h>
#include "../../runloop.h"
@ -73,7 +75,7 @@ static void osmesa_fifo_open(gfx_ctx_osmesa_data_t *osmesa)
saun.sun_family = AF_UNIX;
strcpy(saun.sun_path, g_osmesa_fifo);
strlcpy(saun.sun_path, g_osmesa_fifo, sizeof(saun.sun_path));
unlink(g_osmesa_fifo);

View File

@ -75,7 +75,7 @@ typedef struct gfx_ctx_wayland_data
#endif
} gfx_ctx_wayland_data_t;
static enum gfx_ctx_api wl_api;
static enum gfx_ctx_api wl_api = GFX_CTX_NONE;
#ifndef EGL_OPENGL_ES3_BIT_KHR
#define EGL_OPENGL_ES3_BIT_KHR 0x0040
@ -138,8 +138,9 @@ static void display_handle_geometry(void *data,
(void)transform;
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
wl->physical_width = physical_width;
wl->physical_height = physical_height;
wl->physical_width = physical_width;
wl->physical_height = physical_height;
RARCH_LOG("[Wayland]: Physical width: %d mm x %d mm.\n",
physical_width, physical_height);
}
@ -155,8 +156,8 @@ static void display_handle_mode(void *data,
(void)flags;
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
wl->width = width;
wl->height = height;
wl->width = width;
wl->height = height;
/* Certain older Wayland implementations report in Hz,
* but it should be mHz. */
@ -192,8 +193,8 @@ static const struct wl_output_listener output_listener = {
static void registry_handle_global(void *data, struct wl_registry *reg,
uint32_t id, const char *interface, uint32_t version)
{
struct wl_output *output = NULL;
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
struct wl_output *output;
(void)version;
@ -302,7 +303,7 @@ static void flush_wayland_fd(gfx_ctx_wayland_data_t *wl)
wl_display_dispatch_pending(wl->dpy);
wl_display_flush(wl->dpy);
fd.fd = wl->fd;
fd.fd = wl->fd;
fd.events = POLLIN | POLLOUT | POLLERR | POLLHUP;
if (poll(&fd, 1, 0) > 0)
@ -324,14 +325,14 @@ static void gfx_ctx_wl_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height,
unsigned frame_count)
{
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
unsigned new_width, new_height;
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
(void)frame_count;
flush_wayland_fd(wl);
new_width = *width;
new_width = *width;
new_height = *height;
gfx_ctx_wl_get_video_size(data, &new_width, &new_height);
@ -620,16 +621,19 @@ static EGLint *egl_fill_attribs(gfx_ctx_wayland_data_t *wl, EGLint *attr)
#ifdef EGL_KHR_create_context
case GFX_CTX_OPENGL_API:
{
bool debug = false;
bool debug = false;
#ifdef HAVE_OPENGL
unsigned version = wl->egl.major * 1000 + wl->egl.minor;
bool core = version >= 3001;
#ifdef GL_DEBUG
debug = true;
#else
bool core = version >= 3001;
#ifndef GL_DEBUG
struct retro_hw_render_callback *hwr =
video_driver_get_hw_context();
debug = hwr->debug_context;
#endif
#ifdef GL_DEBUG
debug = true;
#else
debug = hwr->debug_context;
#endif
if (core)

View File

@ -23,6 +23,10 @@
#define _WIN32_WINNT 0x0500 //_WIN32_WINNT_WIN2K
#endif
#define UNICODE
#include <tchar.h>
#include <wchar.h>
#include <string.h>
#include <math.h>
@ -82,23 +86,22 @@ static wglCreateContextAttribsProc pcreate_context;
#endif
static BOOL (APIENTRY *p_swap_interval)(int);
static bool g_use_hw_ctx;
static HGLRC g_hrc;
static HGLRC g_hw_hrc;
static HDC g_hdc;
static bool g_core_hw_context_enable;
static HGLRC win32_hrc;
static HGLRC win32_hw_hrc;
static HDC win32_hdc;
static bool win32_use_hw_ctx = false;
static bool win32_core_hw_context_enable = false;
#ifdef HAVE_VULKAN
static gfx_ctx_vulkan_data_t g_vk;
static gfx_ctx_vulkan_data_t win32_vk;
#endif
static unsigned g_major;
static unsigned g_minor;
static enum gfx_ctx_api g_api;
static unsigned win32_major = 0;
static unsigned win32_minor = 0;
static unsigned win32_interval = 0;
static enum gfx_ctx_api win32_api = GFX_CTX_NONE;
static unsigned g_interval;
static dylib_t dll_handle = NULL; /* Handle to OpenGL32.dll */
static dylib_t dll_handle = NULL; /* Handle to OpenGL32.dll */
static void setup_pixel_format(HDC hdc)
{
@ -118,38 +121,34 @@ static void setup_pixel_format(HDC hdc)
#if defined(HAVE_OPENGL)
static void create_gl_context(HWND hwnd, bool *quit)
{
bool core_context;
struct retro_hw_render_callback *hwr = NULL;
bool debug = false;
struct retro_hw_render_callback *hwr = video_driver_get_hw_context();
bool debug = hwr->debug_context;
bool core_context = (win32_major * 1000 + win32_minor) >= 3001;
dll_handle = dylib_load("OpenGL32.dll");
win32_hdc = GetDC(hwnd);
hwr = video_driver_get_hw_context();
debug = hwr->debug_context;
dll_handle = dylib_load("OpenGL32.dll");
g_hdc = GetDC(hwnd);
setup_pixel_format(g_hdc);
setup_pixel_format(win32_hdc);
#ifdef GL_DEBUG
debug = true;
#endif
core_context = (g_major * 1000 + g_minor) >= 3001;
if (g_hrc)
if (win32_hrc)
{
RARCH_LOG("[WGL]: Using cached GL context.\n");
video_driver_set_video_cache_context_ack();
}
else
{
g_hrc = wglCreateContext(g_hdc);
win32_hrc = wglCreateContext(win32_hdc);
/* We'll create shared context later if not. */
if (g_hrc && !core_context && !debug)
if (win32_hrc && !core_context && !debug)
{
g_hw_hrc = wglCreateContext(g_hdc);
if (g_hw_hrc)
win32_hw_hrc = wglCreateContext(win32_hdc);
if (win32_hw_hrc)
{
if (!wglShareLists(g_hrc, g_hw_hrc))
if (!wglShareLists(win32_hrc, win32_hw_hrc))
{
RARCH_LOG("[WGL]: Failed to share contexts.\n");
*quit = true;
@ -160,9 +159,9 @@ static void create_gl_context(HWND hwnd, bool *quit)
}
}
if (g_hrc)
if (win32_hrc)
{
if (wglMakeCurrent(g_hdc, g_hrc))
if (wglMakeCurrent(win32_hdc, win32_hrc))
g_inited = true;
else
*quit = true;
@ -181,15 +180,15 @@ static void create_gl_context(HWND hwnd, bool *quit)
if (core_context)
{
*aptr++ = WGL_CONTEXT_MAJOR_VERSION_ARB;
*aptr++ = g_major;
*aptr++ = win32_major;
*aptr++ = WGL_CONTEXT_MINOR_VERSION_ARB;
*aptr++ = g_minor;
*aptr++ = win32_minor;
/* Technically, we don't have core/compat until 3.2.
* Version 3.1 is either compat or not depending
* on GL_ARB_compatibility.
*/
if ((g_major * 1000 + g_minor) >= 3002)
if ((win32_major * 1000 + win32_minor) >= 3002)
{
*aptr++ = WGL_CONTEXT_PROFILE_MASK_ARB;
*aptr++ = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
@ -210,23 +209,23 @@ static void create_gl_context(HWND hwnd, bool *quit)
if (pcreate_context)
{
HGLRC context = pcreate_context(g_hdc, NULL, attribs);
HGLRC context = pcreate_context(win32_hdc, NULL, attribs);
if (context)
{
wglMakeCurrent(NULL, NULL);
wglDeleteContext(g_hrc);
g_hrc = context;
if (!wglMakeCurrent(g_hdc, g_hrc))
wglDeleteContext(win32_hrc);
win32_hrc = context;
if (!wglMakeCurrent(win32_hdc, win32_hrc))
*quit = true;
}
else
RARCH_ERR("[WGL]: Failed to create core context. Falling back to legacy context.\n");
if (g_use_hw_ctx)
if (win32_use_hw_ctx)
{
g_hw_hrc = pcreate_context(g_hdc, context, attribs);
if (!g_hw_hrc)
win32_hw_hrc = pcreate_context(win32_hdc, context, attribs);
if (!win32_hw_hrc)
{
RARCH_ERR("[WGL]: Failed to create shared context.\n");
*quit = true;
@ -241,7 +240,7 @@ static void create_gl_context(HWND hwnd, bool *quit)
void create_graphics_context(HWND hwnd, bool *quit)
{
switch (g_api)
switch (win32_api)
{
case GFX_CTX_OPENGL_API:
#if defined(HAVE_OPENGL)
@ -257,9 +256,9 @@ void create_graphics_context(HWND hwnd, bool *quit)
unsigned height = rect.bottom - rect.top;
GetClientRect(hwnd, &rect);
HINSTANCE instance = GetModuleHandle(NULL);
if (!vulkan_surface_create(&g_vk, VULKAN_WSI_WIN32,
if (!vulkan_surface_create(&win32_vk, VULKAN_WSI_WIN32,
&instance, &hwnd,
width, height, g_interval))
width, height, win32_interval))
*quit = true;
g_inited = true;
#endif
@ -277,30 +276,30 @@ void *dinput_wgl;
static void gfx_ctx_wgl_swap_interval(void *data, unsigned interval)
{
(void)data;
g_interval = interval;
win32_interval = interval;
switch (g_api)
switch (win32_api)
{
case GFX_CTX_OPENGL_API:
#ifdef HAVE_OPENGL
if (!g_hrc)
if (!win32_hrc)
return;
if (!p_swap_interval)
return;
RARCH_LOG("[WGL]: wglSwapInterval(%u)\n", g_interval);
if (!p_swap_interval(g_interval))
RARCH_LOG("[WGL]: wglSwapInterval(%u)\n", win32_interval);
if (!p_swap_interval(win32_interval))
RARCH_WARN("[WGL]: wglSwapInterval() failed.\n");
#endif
break;
case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
if (g_interval != interval)
if (win32_interval != interval)
{
g_interval = interval;
if (g_vk.swapchain)
g_vk.need_new_swapchain = true;
win32_interval = interval;
if (win32_vk.swapchain)
win32_vk.need_new_swapchain = true;
}
#endif
break;
@ -316,11 +315,11 @@ static void gfx_ctx_wgl_check_window(void *data, bool *quit,
{
win32_check_window(quit, resize, width, height);
switch (g_api)
switch (win32_api)
{
case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
if (g_vk.need_new_swapchain)
if (win32_vk.need_new_swapchain)
*resize = true;
#endif
break;
@ -335,18 +334,18 @@ static void gfx_ctx_wgl_swap_buffers(void *data)
{
(void)data;
switch (g_api)
switch (win32_api)
{
case GFX_CTX_OPENGL_API:
#ifdef HAVE_OPENGL
SwapBuffers(g_hdc);
SwapBuffers(win32_hdc);
#endif
break;
case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
vulkan_present(&g_vk, g_vk.context.current_swapchain_index);
vulkan_acquire_next_image(&g_vk);
vulkan_present(&win32_vk, win32_vk.context.current_swapchain_index);
vulkan_acquire_next_image(&win32_vk);
#endif
break;
@ -363,18 +362,18 @@ static bool gfx_ctx_wgl_set_resize(void *data,
(void)width;
(void)height;
switch (g_api)
switch (win32_api)
{
case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
if (!vulkan_create_swapchain(&g_vk, width, height, g_interval))
if (!vulkan_create_swapchain(&win32_vk, width, height, win32_interval))
{
RARCH_ERR("[Win32/Vulkan]: Failed to update swapchain.\n");
return false;
}
g_vk.context.invalid_swapchain = true;
g_vk.need_new_swapchain = false;
win32_vk.context.invalid_swapchain = true;
win32_vk.need_new_swapchain = false;
#endif
break;
@ -390,7 +389,7 @@ static void gfx_ctx_wgl_update_window_title(void *data)
{
char buf[128];
char buf_fps[128];
settings_t *settings = config_get_ptr();
settings_t *settings = config_get_ptr();
const ui_window_t *window = ui_companion_driver_get_window_ptr();
buf[0] = buf_fps[0] = '\0';
@ -410,10 +409,10 @@ static void gfx_ctx_wgl_get_video_size(void *data,
if (!window)
{
unsigned mon_id;
RECT mon_rect;
MONITORINFOEX current_mon;
HMONITOR hm_to_use = NULL;
unsigned mon_id = 0;
HMONITOR hm_to_use = NULL;
win32_monitor_info(&current_mon, &hm_to_use, &mon_id);
mon_rect = current_mon.rcMonitor;
@ -443,11 +442,11 @@ static void *gfx_ctx_wgl_init(void *video_driver)
if (!win32_window_init(&wndclass, true, NULL))
return NULL;
switch (g_api)
switch (win32_api)
{
case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
if (!vulkan_context_init(&g_vk, VULKAN_WSI_WIN32))
if (!vulkan_context_init(&win32_vk, VULKAN_WSI_WIN32))
return NULL;
#endif
break;
@ -465,22 +464,22 @@ static void gfx_ctx_wgl_destroy(void *data)
(void)data;
switch (g_api)
switch (win32_api)
{
case GFX_CTX_OPENGL_API:
#ifdef HAVE_OPENGL
if (g_hrc)
if (win32_hrc)
{
glFinish();
wglMakeCurrent(NULL, NULL);
if (!video_driver_is_video_cache_context())
{
if (g_hw_hrc)
wglDeleteContext(g_hw_hrc);
wglDeleteContext(g_hrc);
g_hrc = NULL;
g_hw_hrc = NULL;
if (win32_hw_hrc)
wglDeleteContext(win32_hw_hrc);
wglDeleteContext(win32_hrc);
win32_hrc = NULL;
win32_hw_hrc = NULL;
}
}
#endif
@ -488,10 +487,10 @@ static void gfx_ctx_wgl_destroy(void *data)
case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
vulkan_context_destroy(&g_vk, g_vk.vk_surface != VK_NULL_HANDLE);
if (g_vk.context.queue_lock)
slock_free(g_vk.context.queue_lock);
memset(&g_vk, 0, sizeof(g_vk));
vulkan_context_destroy(&win32_vk, win32_vk.vk_surface != VK_NULL_HANDLE);
if (win32_vk.context.queue_lock)
slock_free(win32_vk.context.queue_lock);
memset(&win32_vk, 0, sizeof(win32_vk));
#endif
break;
@ -500,10 +499,10 @@ static void gfx_ctx_wgl_destroy(void *data)
break;
}
if (window && g_hdc)
if (window && win32_hdc)
{
ReleaseDC(window, g_hdc);
g_hdc = NULL;
ReleaseDC(window, win32_hdc);
win32_hdc = NULL;
}
if (window)
@ -518,11 +517,11 @@ static void gfx_ctx_wgl_destroy(void *data)
g_restore_desktop = false;
}
g_core_hw_context_enable = false;
g_inited = false;
g_major = 0;
g_minor = 0;
p_swap_interval = NULL;
win32_core_hw_context_enable = false;
g_inited = false;
win32_major = 0;
win32_minor = 0;
p_swap_interval = NULL;
}
static bool gfx_ctx_wgl_set_video_mode(void *data,
@ -535,7 +534,7 @@ static bool gfx_ctx_wgl_set_video_mode(void *data,
goto error;
}
switch (g_api)
switch (win32_api)
{
case GFX_CTX_OPENGL_API:
#ifdef HAVE_OPENGL
@ -549,7 +548,7 @@ static bool gfx_ctx_wgl_set_video_mode(void *data,
break;
}
gfx_ctx_wgl_swap_interval(data, g_interval);
gfx_ctx_wgl_swap_interval(data, win32_interval);
return true;
error:
@ -607,9 +606,9 @@ static bool gfx_ctx_wgl_bind_api(void *data,
{
(void)data;
g_major = major;
g_minor = minor;
g_api = api;
win32_major = major;
win32_minor = minor;
win32_api = api;
#if defined(HAVE_OPENGL)
if (api == GFX_CTX_OPENGL_API)
@ -631,14 +630,14 @@ static void gfx_ctx_wgl_show_mouse(void *data, bool state)
static void gfx_ctx_wgl_bind_hw_render(void *data, bool enable)
{
switch (g_api)
switch (win32_api)
{
case GFX_CTX_OPENGL_API:
#ifdef HAVE_OPENGL
g_use_hw_ctx = enable;
win32_use_hw_ctx = enable;
if (g_hdc)
wglMakeCurrent(g_hdc, enable ? g_hw_hrc : g_hrc);
if (win32_hdc)
wglMakeCurrent(win32_hdc, enable ? win32_hw_hrc : win32_hrc);
#endif
break;
@ -652,14 +651,14 @@ static void gfx_ctx_wgl_bind_hw_render(void *data, bool enable)
static void *gfx_ctx_wgl_get_context_data(void *data)
{
(void)data;
return &g_vk.context;
return &win32_vk.context;
}
#endif
static uint32_t gfx_ctx_wgl_get_flags(void *data)
{
uint32_t flags = 0;
if (g_core_hw_context_enable)
if (win32_core_hw_context_enable)
{
BIT32_SET(flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT);
}
@ -673,7 +672,7 @@ static uint32_t gfx_ctx_wgl_get_flags(void *data)
static void gfx_ctx_wgl_set_flags(void *data, uint32_t flags)
{
if (BIT32_GET(flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT))
g_core_hw_context_enable = true;
win32_core_hw_context_enable = true;
}
const gfx_ctx_driver_t gfx_ctx_wgl = {

View File

@ -0,0 +1,138 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis
* Copyright (C) 2016 - Brad Parker
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <string/stdstring.h>
#include <caca.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#include "../font_driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
#include "../common/caca_common.h"
typedef struct
{
const font_renderer_driver_t *caca_font_driver;
void *caca_font_data;
caca_t *caca;
} caca_raster_t;
static void *caca_init_font(void *data,
const char *font_path, float font_size)
{
caca_raster_t *font = (caca_raster_t*)calloc(1, sizeof(*font));
if (!font)
return NULL;
font->caca = (caca_t*)data;
font_size = 1;
if (!font_renderer_create_default((const void**)&font->caca_font_driver,
&font->caca_font_data, font_path, font_size))
{
RARCH_WARN("Couldn't initialize font renderer.\n");
return NULL;
}
return font;
}
static void caca_render_free_font(void *data)
{
}
static int caca_get_message_width(void *data, const char *msg,
unsigned msg_len, float scale)
{
return 0;
}
static const struct font_glyph *caca_font_get_glyph(
void *data, uint32_t code)
{
return NULL;
}
static void caca_render_msg(void *data, const char *msg,
const void *userdata)
{
caca_raster_t *font = (caca_raster_t*)data;
float x, y;
unsigned width, height;
unsigned newX, newY;
settings_t *settings = config_get_ptr();
const struct font_params *params = (const struct font_params*)userdata;
if (!font || string_is_empty(msg))
return;
if (params)
{
x = params->x;
y = params->y;
}
else
{
x = settings->video.msg_pos_x;
y = settings->video.msg_pos_y;
}
if (!font->caca || !font->caca->caca_cv || !font->caca->caca_display ||
!*font->caca->caca_cv || !*font->caca->caca_display)
return;
width = caca_get_canvas_width(*font->caca->caca_cv);
height = caca_get_canvas_height(*font->caca->caca_cv);
newX = x * width;
newY = height - (y * height);
if (strlen(msg) + newX > width)
newX -= strlen(msg) + newX - width;
caca_put_str(*font->caca->caca_cv, newX, newY, msg);
caca_refresh_display(*font->caca->caca_display);
}
static void caca_font_flush_block(void* data)
{
(void)data;
}
static void caca_font_bind_block(void* data, void* userdata)
{
(void)data;
}
font_renderer_t caca_font = {
caca_init_font,
caca_render_free_font,
caca_render_msg,
"caca font",
caca_font_get_glyph, /* get_glyph */
caca_font_bind_block, /* bind_block */
caca_font_flush_block, /* flush */
caca_get_message_width /* get_message_width */
};

View File

@ -22,9 +22,10 @@
#include "../font_driver.h"
#include "../../configuration.h"
#include "../../runloop.h"
#ifdef HAVE_D3D9
#include "../include/d3d9/d3dx9core.h"
#endif
typedef struct
{
@ -45,7 +46,11 @@ static void *d3dfonts_w32_init_font(void *video_data,
OUT_TT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_PITCH,
"Verdana" /* Hardcode FTL */
#ifdef _MSC_VER /* MSVC needs w_char* */
L"Verdana" /* Hardcode FTL */
#else
"Verdana"
#endif
};
d3dfonts = (d3dfonts_t*)calloc(1, sizeof(*d3dfonts));

View File

@ -259,12 +259,12 @@ static void gl_raster_font_draw_vertices(gl_raster_t *font, const video_coords_t
coords_data.handle_data = NULL;
coords_data.data = coords;
video_shader_driver_set_coords(&coords_data);
video_shader_driver_set_coords(coords_data);
mvp.data = font->gl;
mvp.matrix = &font->gl->mvp_no_rot;
video_shader_driver_set_mvp(&mvp);
video_shader_driver_set_mvp(mvp);
glDrawArrays(GL_TRIANGLES, 0, coords->vertices);
}
@ -430,7 +430,7 @@ static void gl_raster_font_setup_viewport(gl_raster_t *font, bool full_screen)
shader_info.idx = VIDEO_SHADER_STOCK_BLEND;
shader_info.set_active = true;
video_shader_driver_use(&shader_info);
video_shader_driver_use(shader_info);
}
static void gl_raster_font_restore_viewport(gl_t *gl, bool full_screen)

View File

@ -20,8 +20,9 @@
#include "../../config.h"
#endif
#include "../drivers/d3d.h"
#include "../font_driver.h"
#include "../../runloop.h"
typedef struct
{

View File

@ -18,13 +18,8 @@
#include <string/stdstring.h>
#ifdef HAVE_CONFIG_H
#include "../../runloop.h"
#endif
#include "../d3d/d3d.h"
#include "../font_driver.h"
#include "../../runloop.h"
#include "../drivers/d3d_shaders/font.hlsl.d3d9.h"
@ -630,7 +625,6 @@ static void xdk360_free_font(void *data)
static void xdk360_render_msg_post(xdk360_video_font_t * font)
{
/* Cache the global pointer into a register */
LPDIRECT3DDEVICE d3dr = font->d3d->dev;
d3d_set_texture(d3dr, 0, NULL);

View File

@ -32,7 +32,6 @@
#endif
#include "../font_driver.h"
#include "../../runloop.h"
#define CT_ATLAS_ROWS 16
#define CT_ATLAS_COLS 16

View File

@ -41,6 +41,7 @@
#ifdef HAVE_SHADERPIPELINE
#include "../drivers/gl_shaders/pipeline_xmb_ribbon_simple.cg.h"
#include "../drivers/gl_shaders/pipeline_snow.cg.h"
#endif
#include "../include/Cg/cg.h"
@ -515,24 +516,26 @@ static bool gl_cg_compile_program(
void *program_data,
struct shader_program_info *program_info)
{
const char *list = NULL;
const char *argv[2 + GFX_MAX_SHADERS];
bool ret = true;
char *listing_f = NULL;
char *listing_v = NULL;
unsigned i, argc = 0;
const char *list = NULL;
bool ret = true;
char *listing_f = NULL;
char *listing_v = NULL;
unsigned i, argc = 0;
struct shader_program_cg *program = (struct shader_program_cg*)program_data;
cg_shader_data_t *cg = (cg_shader_data_t*)data;
cg_shader_data_t *cg = (cg_shader_data_t*)data;
if (!program)
program = &cg->prg[idx];
argv[argc++] = "-DPARAMETER_UNIFORM";
for (i = 0; i < GFX_MAX_SHADERS; i++)
{
if (*(cg->alias_define[i]))
argv[argc++] = cg->alias_define[i];
}
argv[argc] = NULL;
if (program_info->is_file)
@ -586,7 +589,7 @@ end:
static void gl_cg_set_program_base_attrib(void *data, unsigned i)
{
cg_shader_data_t *cg = (cg_shader_data_t*)data;
cg_shader_data_t *cg = (cg_shader_data_t*)data;
CGparameter param = cgGetFirstParameter(
cg->prg[i].vprg, CG_PROGRAM);
@ -594,8 +597,8 @@ static void gl_cg_set_program_base_attrib(void *data, unsigned i)
{
uint32_t semantic_hash;
const char *semantic = NULL;
if (cgGetParameterDirection(param) != CG_IN
|| cgGetParameterVariability(param) != CG_VARYING)
if ( (cgGetParameterDirection(param) != CG_IN)
|| (cgGetParameterVariability(param) != CG_VARYING))
continue;
semantic = cgGetParameterSemantic(param);
@ -638,7 +641,7 @@ static void gl_cg_set_program_base_attrib(void *data, unsigned i)
static bool gl_cg_load_stock(void *data)
{
struct shader_program_info program_info;
cg_shader_data_t *cg = (cg_shader_data_t*)data;
cg_shader_data_t *cg = (cg_shader_data_t*)data;
program_info.combined = stock_cg_gl_program;
program_info.is_file = false;
@ -658,6 +661,7 @@ error:
static bool gl_cg_load_plain(void *data, const char *path)
{
cg_shader_data_t *cg = (cg_shader_data_t*)data;
if (!gl_cg_load_stock(cg))
return false;
@ -668,7 +672,12 @@ static bool gl_cg_load_plain(void *data, const char *path)
cg->shader->passes = 1;
if (path)
if (string_is_empty(path))
{
RARCH_LOG("Loading stock Cg file.\n");
cg->prg[1] = cg->prg[0];
}
else
{
struct shader_program_info program_info;
@ -681,11 +690,6 @@ static bool gl_cg_load_plain(void *data, const char *path)
if (!gl_cg_compile_program(data, 1, &cg->prg[1], &program_info))
return false;
}
else
{
RARCH_LOG("Loading stock Cg file.\n");
cg->prg[1] = cg->prg[0];
}
video_shader_resolve_parameters(NULL, cg->shader);
return true;
@ -696,7 +700,7 @@ static bool gl_cg_load_imports(void *data)
unsigned i;
retro_ctx_memory_info_t mem_info;
struct state_tracker_info tracker_info = {0};
cg_shader_data_t *cg = (cg_shader_data_t*)data;
cg_shader_data_t *cg = (cg_shader_data_t*)data;
if (!cg->shader->variables)
return true;
@ -727,9 +731,9 @@ static bool gl_cg_load_imports(void *data)
}
}
mem_info.data = NULL;
mem_info.size = 0;
mem_info.id = RETRO_MEMORY_SYSTEM_RAM;
mem_info.data = NULL;
mem_info.size = 0;
mem_info.id = RETRO_MEMORY_SYSTEM_RAM;
core_get_memory(&mem_info);
@ -740,7 +744,7 @@ static bool gl_cg_load_imports(void *data)
#ifdef HAVE_PYTHON
if (*cg->shader->script_path)
{
tracker_info.script = cg->shader->script_path;
tracker_info.script = cg->shader->script_path;
tracker_info.script_is_file = true;
}
@ -758,7 +762,7 @@ static bool gl_cg_load_imports(void *data)
static bool gl_cg_load_shader(void *data, unsigned i)
{
struct shader_program_info program_info;
cg_shader_data_t *cg = (cg_shader_data_t*)data;
cg_shader_data_t *cg = (cg_shader_data_t*)data;
program_info.combined = cg->shader->pass[i].source.path;
program_info.is_file = true;
@ -775,7 +779,7 @@ static bool gl_cg_load_shader(void *data, unsigned i)
static bool gl_cg_load_preset(void *data, const char *path)
{
unsigned i;
config_file_t *conf = NULL;
config_file_t *conf = NULL;
cg_shader_data_t *cg = (cg_shader_data_t*)data;
if (!gl_cg_load_stock(cg))
@ -815,11 +819,13 @@ static bool gl_cg_load_preset(void *data, const char *path)
}
for (i = 0; i < cg->shader->passes; i++)
{
if (*cg->shader->pass[i].alias)
snprintf(cg->alias_define[i],
sizeof(cg->alias_define[i]),
"-D%s_ALIAS",
cg->shader->pass[i].alias);
}
for (i = 0; i < cg->shader->passes; i++)
{
@ -1041,7 +1047,8 @@ static void *gl_cg_init(void *data, const char *path)
memset(cg->alias_define, 0, sizeof(cg->alias_define));
if (path && string_is_equal(path_get_extension(path), "cgp"))
if ( !string_is_empty(path)
&& string_is_equal(path_get_extension(path), "cgp"))
{
if (!gl_cg_load_preset(cg, path))
goto error;
@ -1070,7 +1077,7 @@ static void *gl_cg_init(void *data, const char *path)
gl_cg_set_shaders(cg->prg[1].fprg, cg->prg[1].vprg);
#ifdef HAVE_SHADERPIPELINE
shader_prog_info.combined = stock_xmb_simple;
shader_prog_info.combined = stock_xmb_ribbon_simple;
shader_prog_info.is_file = false;
gl_cg_compile_program(
@ -1080,15 +1087,25 @@ static void *gl_cg_init(void *data, const char *path)
&shader_prog_info);
gl_cg_set_program_base_attrib(cg, VIDEO_SHADER_MENU);
shader_prog_info.combined = stock_xmb_simple;
shader_prog_info.combined = stock_xmb_ribbon_simple;
shader_prog_info.is_file = false;
gl_cg_compile_program(
cg,
VIDEO_SHADER_MENU_SEC,
&cg->prg[VIDEO_SHADER_MENU_SEC],
VIDEO_SHADER_MENU_2,
&cg->prg[VIDEO_SHADER_MENU_2],
&shader_prog_info);
gl_cg_set_program_base_attrib(cg, VIDEO_SHADER_MENU_SEC);
gl_cg_set_program_base_attrib(cg, VIDEO_SHADER_MENU_2);
shader_prog_info.combined = stock_xmb_snow;
shader_prog_info.is_file = false;
gl_cg_compile_program(
cg,
VIDEO_SHADER_MENU_3,
&cg->prg[VIDEO_SHADER_MENU_3],
&shader_prog_info);
gl_cg_set_program_base_attrib(cg, VIDEO_SHADER_MENU_3);
#endif
gl_cg_reset_attrib(cg);

View File

@ -121,13 +121,15 @@ static const char *glsl_prefixes[] = {
#ifdef HAVE_SHADERPIPELINE
#include "../drivers/gl_shaders/legacy_pipeline_xmb_ribbon_simple.glsl.vert.h"
#include "../drivers/gl_shaders/modern_pipeline_xmb_ribbon_simple.glsl.vert.h"
#include "../drivers/gl_shaders/modern_pipeline_snow.glsl.vert.h"
#include "../drivers/gl_shaders/pipeline_xmb_ribbon_simple.glsl.frag.h"
#if !defined(HAVE_OPENGLES)
#include "../drivers/gl_shaders/pipeline_snow.glsl.frag.h"
#include "../drivers/gl_shaders/pipeline_snow_simple.glsl.frag.h"
#include "../drivers/gl_shaders/legacy_pipeline_snow.glsl.vert.h"
#include "../drivers/gl_shaders/legacy_pipeline_xmb_ribbon.glsl.vert.h"
#include "../drivers/gl_shaders/modern_pipeline_xmb_ribbon.glsl.vert.h"
#include "../drivers/gl_shaders/pipeline_xmb_ribbon.glsl.frag.h"
#endif
#endif
typedef struct glsl_shader_data
{
@ -412,12 +414,7 @@ static bool gl_glsl_load_source_path(struct video_shader_pass *pass,
const char *path)
{
ssize_t len;
int nitems = 0;
if (!pass)
return false;
nitems = filestream_read_file(path,
int nitems = filestream_read_file(path,
(void**)&pass->source.string.vertex, &len);
if (nitems <= 0 || len <= 0)
@ -448,17 +445,18 @@ static bool gl_glsl_compile_programs(
* load the file here, and pretend
* we were really using XML all along.
*/
if (*pass->source.path && !gl_glsl_load_source_path(
pass, pass->source.path))
if ( !string_is_empty(pass->source.path)
&& !gl_glsl_load_source_path(pass, pass->source.path))
{
RARCH_ERR("Failed to load GLSL shader: %s.\n",
pass->source.path);
return false;
}
*pass->source.path = '\0';
vertex = pass->source.string.vertex;
fragment = pass->source.string.fragment;
*pass->source.path = '\0';
vertex = pass->source.string.vertex;
fragment = pass->source.string.fragment;
shader_prog_info.vertex = vertex;
shader_prog_info.fragment = fragment;
@ -558,10 +556,10 @@ static void gl_glsl_find_uniforms_frame(glsl_shader_data_t *glsl,
texture[0] = texture_size[0] = input_size[0] = tex_coord[0] = '\0';
snprintf(texture, sizeof(texture), "%s%s", base, "Texture");
snprintf(texture, sizeof(texture), "%s%s", base, "Texture");
snprintf(texture_size, sizeof(texture_size), "%s%s", base, "TextureSize");
snprintf(input_size, sizeof(input_size), "%s%s", base, "InputSize");
snprintf(tex_coord, sizeof(tex_coord), "%s%s", base, "TexCoord");
snprintf(input_size, sizeof(input_size), "%s%s", base, "InputSize");
snprintf(tex_coord, sizeof(tex_coord), "%s%s", base, "TexCoord");
if (frame->texture < 0)
frame->texture = gl_glsl_get_uniform(glsl, prog, texture);
@ -885,7 +883,7 @@ static void *gl_glsl_init(void *data, const char *path)
retro_ctx_memory_info_t mem_info;
struct state_tracker_info info = {0};
mem_info.id = RETRO_MEMORY_SYSTEM_RAM;
mem_info.id = RETRO_MEMORY_SYSTEM_RAM;
core_get_memory(&mem_info);
@ -934,12 +932,20 @@ static void *gl_glsl_init(void *data, const char *path)
}
#ifdef HAVE_SHADERPIPELINE
#if defined(HAVE_OPENGLES)
shader_prog_info.vertex = stock_vertex_xmb_simple_legacy;
shader_prog_info.fragment = stock_fragment_xmb_simple;
#ifdef HAVE_OPENGLES
if (gl_query_extension("GL_OES_standard_derivatives"))
{
shader_prog_info.vertex = glsl_core ? stock_vertex_xmb_ribbon_modern : stock_vertex_xmb_ribbon_legacy;
shader_prog_info.fragment = stock_fragment_xmb;
}
else
{
shader_prog_info.vertex = stock_vertex_xmb_ribbon_simple_legacy;
shader_prog_info.fragment = stock_fragment_xmb_ribbon_simple;
}
#else
shader_prog_info.vertex = glsl_core ? stock_vertex_xmb_modern : stock_vertex_xmb_legacy;
shader_prog_info.fragment = stock_fragment_xmb;
shader_prog_info.vertex = glsl_core ? stock_vertex_xmb_ribbon_modern : stock_vertex_xmb_ribbon_legacy;
shader_prog_info.fragment = stock_fragment_xmb;
#endif
shader_prog_info.is_file = false;
@ -951,16 +957,46 @@ static void *gl_glsl_init(void *data, const char *path)
gl_glsl_find_uniforms(glsl, 0, glsl->prg[VIDEO_SHADER_MENU].id,
&glsl->uniforms[VIDEO_SHADER_MENU]);
shader_prog_info.vertex = glsl_core ? stock_vertex_xmb_simple_modern : stock_vertex_xmb_simple_legacy;
shader_prog_info.fragment = stock_fragment_xmb_simple;
shader_prog_info.vertex = glsl_core ? stock_vertex_xmb_simple_modern : stock_vertex_xmb_ribbon_simple_legacy;
shader_prog_info.fragment = stock_fragment_xmb_ribbon_simple;
gl_glsl_compile_program(
glsl,
VIDEO_SHADER_MENU_SEC,
&glsl->prg[VIDEO_SHADER_MENU_SEC],
VIDEO_SHADER_MENU_2,
&glsl->prg[VIDEO_SHADER_MENU_2],
&shader_prog_info);
gl_glsl_find_uniforms(glsl, 0, glsl->prg[VIDEO_SHADER_MENU_SEC].id,
&glsl->uniforms[VIDEO_SHADER_MENU_SEC]);
gl_glsl_find_uniforms(glsl, 0, glsl->prg[VIDEO_SHADER_MENU_2].id,
&glsl->uniforms[VIDEO_SHADER_MENU_2]);
#if defined(HAVE_OPENGLES)
shader_prog_info.vertex = stock_vertex_xmb_snow_modern;
#else
shader_prog_info.vertex = glsl_core ? stock_vertex_xmb_snow_modern : stock_vertex_xmb_snow_legacy;
#endif
shader_prog_info.fragment = stock_fragment_xmb_simple_snow;
gl_glsl_compile_program(
glsl,
VIDEO_SHADER_MENU_3,
&glsl->prg[VIDEO_SHADER_MENU_3],
&shader_prog_info);
gl_glsl_find_uniforms(glsl, 0, glsl->prg[VIDEO_SHADER_MENU_3].id,
&glsl->uniforms[VIDEO_SHADER_MENU_3]);
#if defined(HAVE_OPENGLES)
shader_prog_info.vertex = stock_vertex_xmb_snow_modern;
#else
shader_prog_info.vertex = glsl_core ? stock_vertex_xmb_snow_modern : stock_vertex_xmb_snow_legacy;
#endif
shader_prog_info.fragment = stock_fragment_xmb_snow;
gl_glsl_compile_program(
glsl,
VIDEO_SHADER_MENU_4,
&glsl->prg[VIDEO_SHADER_MENU_4],
&shader_prog_info);
gl_glsl_find_uniforms(glsl, 0, glsl->prg[VIDEO_SHADER_MENU_4].id,
&glsl->uniforms[VIDEO_SHADER_MENU_4]);
#endif
gl_glsl_reset_attrib(glsl);

View File

@ -2851,7 +2851,7 @@ vulkan_filter_chain_t *vulkan_filter_chain_create_from_preset(
return nullptr;
unique_ptr<config_file_t, ConfigDeleter> conf{ config_file_new(path) };
if (!path)
if (!conf)
return nullptr;
if (!video_shader_read_conf_cgp(conf.get(), shader.get()))

View File

@ -387,18 +387,25 @@ float py_state_get(py_state_t *handle, const char *id,
for (i = 0; i < MAX_USERS; i++)
{
input_push_analog_dpad(settings->input.binds[i],
settings->input.analog_dpad_mode[i]);
input_push_analog_dpad(settings->input.autoconf_binds[i],
settings->input.analog_dpad_mode[i]);
struct retro_keybind *general_binds = settings->input.binds[i];
struct retro_keybind *auto_binds = settings->input.autoconf_binds[i];
enum analog_dpad_mode dpad_mode = settings->input.analog_dpad_mode[i];
if (dpad_mode == ANALOG_DPAD_NONE)
continue;
input_push_analog_dpad(general_binds, dpad_mode);
input_push_analog_dpad(auto_binds, dpad_mode);
}
ret = PyObject_CallMethod(handle->inst, (char*)id, (char*)"I", frame_count);
for (i = 0; i < MAX_USERS; i++)
{
input_pop_analog_dpad(settings->input.binds[i]);
input_pop_analog_dpad(settings->input.autoconf_binds[i]);
struct retro_keybind *general_binds = settings->input.binds[i];
struct retro_keybind *auto_binds = settings->input.autoconf_binds[i];
input_pop_analog_dpad(general_binds);
input_pop_analog_dpad(auto_binds);
}
if (!ret)

View File

@ -149,6 +149,35 @@ static bool gl_font_init_first(
}
#endif
#ifdef HAVE_CACA
static const font_renderer_t *caca_font_backends[] = {
&caca_font,
NULL,
};
static bool caca_font_init_first(
const void **font_driver, void **font_handle,
void *video_data, const char *font_path, float font_size)
{
unsigned i;
for (i = 0; caca_font_backends[i]; i++)
{
void *data = caca_font_backends[i]->init(
video_data, font_path, font_size);
if (!data)
continue;
*font_driver = caca_font_backends[i];
*font_handle = data;
return true;
}
return false;
}
#endif
#ifdef HAVE_VULKAN
static const font_renderer_t *vulkan_font_backends[] = {
&vulkan_raster_font,
@ -267,6 +296,11 @@ static bool font_init_first(
case FONT_DRIVER_RENDER_CTR:
return ctr_font_init_first(font_driver, font_handle,
video_data, font_path, font_size);
#endif
#ifdef HAVE_CACA
case FONT_DRIVER_RENDER_CACA:
return caca_font_init_first(font_driver, font_handle,
video_data, font_path, font_size);
#endif
case FONT_DRIVER_RENDER_DONT_CARE:
/* TODO/FIXME - lookup graphics driver's 'API' */
@ -278,11 +312,6 @@ static bool font_init_first(
return false;
}
bool font_driver_has_render_msg(void)
{
return true;
}
void font_driver_render_msg(void *font_data,
const char *msg, const struct font_params *params)
{

View File

@ -31,7 +31,8 @@ enum font_driver_render_api
FONT_DRIVER_RENDER_DIRECT3D_API,
FONT_DRIVER_RENDER_VITA2D,
FONT_DRIVER_RENDER_CTR,
FONT_DRIVER_RENDER_VULKAN_API
FONT_DRIVER_RENDER_VULKAN_API,
FONT_DRIVER_RENDER_CACA
};
enum text_alignment
@ -138,8 +139,6 @@ typedef struct
int font_renderer_create_default(const void **driver,
void **handle, const char *font_path, unsigned font_size);
bool font_driver_has_render_msg(void);
void font_driver_render_msg(void *font_data, const char *msg, const struct font_params *params);
void font_driver_bind_block(void *font_data, void *block);
@ -164,6 +163,7 @@ extern font_renderer_t d3d_win32_font;
extern font_renderer_t vita2d_vita_font;
extern font_renderer_t ctr_font;
extern font_renderer_t vulkan_raster_font;
extern font_renderer_t caca_font;
extern font_renderer_driver_t stb_font_renderer;
extern font_renderer_driver_t stb_unicode_font_renderer;

View File

@ -93,8 +93,8 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
NULL
};
static const gfx_ctx_driver_t *current_video_context = NULL;
static void *video_context_data = NULL;
const gfx_ctx_driver_t *current_video_context = NULL;
void *video_context_data = NULL;
/**
* find_video_context_driver_driver_index:
@ -268,40 +268,39 @@ const gfx_ctx_driver_t *video_context_driver_init_first(void *data,
bool video_context_driver_check_window(gfx_ctx_size_t *size_data)
{
uint64_t *frame_count = NULL;
frame_count = video_driver_get_frame_count_ptr();
if ( video_context_data
&& current_video_context
&& current_video_context->check_window)
{
current_video_context->check_window(video_context_data,
size_data->quit,
size_data->resize,
size_data->width,
size_data->height, ((unsigned int)*video_driver_get_frame_count_ptr()));
return true;
}
if (!video_context_data || !size_data)
return false;
if (!current_video_context || !current_video_context->check_window)
return false;
current_video_context->check_window(video_context_data,
size_data->quit,
size_data->resize,
size_data->width,
size_data->height, (unsigned int)*frame_count);
return true;
return false;
}
bool video_context_driver_init_image_buffer(const video_info_t *data)
{
if (!current_video_context || !current_video_context->image_buffer_init)
return false;
if (!current_video_context->image_buffer_init(video_context_data, data))
return false;
return true;
if ( current_video_context
&& current_video_context->image_buffer_init
&& current_video_context->image_buffer_init(video_context_data, data))
return true;
return false;
}
bool video_context_driver_write_to_image_buffer(gfx_ctx_image_t *img)
{
if (!current_video_context || !current_video_context->image_buffer_write)
return false;
if (!current_video_context->image_buffer_write(video_context_data,
if ( current_video_context
&& current_video_context->image_buffer_write
&& current_video_context->image_buffer_write(video_context_data,
img->frame, img->width, img->height, img->pitch,
img->rgb32, img->index, img->handle))
return false;
return true;
return true;
return false;
}
bool video_context_driver_get_video_output_prev(void)
@ -332,10 +331,8 @@ bool video_context_driver_bind_hw_render(bool *enable)
void video_context_driver_make_current(bool release)
{
if (!current_video_context || !current_video_context->make_current)
return;
current_video_context->make_current(release);
if (current_video_context && current_video_context->make_current)
current_video_context->make_current(release);
}
bool video_context_driver_set(const gfx_ctx_driver_t *data)
@ -351,31 +348,6 @@ void video_context_driver_destroy(void)
current_video_context = NULL;
}
bool video_context_driver_update_window_title(void)
{
if (!current_video_context || !current_video_context->update_window_title)
return false;
current_video_context->update_window_title(video_context_data);
return true;
}
bool video_context_driver_swap_buffers(void)
{
if (!current_video_context || !current_video_context->swap_buffers)
return false;
current_video_context->swap_buffers(video_context_data);
return true;
}
bool video_context_driver_focus(void)
{
if (!video_context_data || !current_video_context->has_focus)
return false;
if (!current_video_context->has_focus(video_context_data))
return false;
return true;
}
bool video_context_driver_translate_aspect(gfx_ctx_aspect_t *aspect)
{
if (!video_context_data || !aspect)
@ -387,15 +359,6 @@ bool video_context_driver_translate_aspect(gfx_ctx_aspect_t *aspect)
return true;
}
bool video_context_driver_has_windowed(void)
{
if (!video_context_data)
return false;
if (!current_video_context->has_windowed(video_context_data))
return false;
return true;
}
void video_context_driver_free(void)
{
if (current_video_context->destroy)
@ -435,13 +398,13 @@ bool video_context_driver_get_proc_address(gfx_ctx_proc_address_t *proc)
bool video_context_driver_get_metrics(gfx_ctx_metrics_t *metrics)
{
if (!current_video_context || !current_video_context->get_metrics)
return false;
if (!current_video_context->get_metrics(video_context_data,
if ( current_video_context
&& current_video_context->get_metrics
&& current_video_context->get_metrics(video_context_data,
metrics->type,
metrics->value))
return false;
return true;
return true;
return false;
}
bool video_context_driver_input_driver(gfx_ctx_input_t *inp)
@ -455,12 +418,12 @@ bool video_context_driver_input_driver(gfx_ctx_input_t *inp)
bool video_context_driver_suppress_screensaver(bool *bool_data)
{
if (!video_context_data || !current_video_context)
return false;
if (!current_video_context->suppress_screensaver(
if ( video_context_data
&& current_video_context
&& current_video_context->suppress_screensaver(
video_context_data, *bool_data))
return false;
return true;
return true;
return false;
}
bool video_context_driver_get_ident(gfx_ctx_ident_t *ident)

View File

@ -56,6 +56,7 @@ enum display_flags
GFX_CTX_FLAGS_CUSTOMIZABLE_SWAPCHAIN_IMAGES
};
typedef void (*gfx_ctx_proc_t)(void);
typedef struct gfx_ctx_driver
@ -167,6 +168,7 @@ typedef struct gfx_ctx_driver
void (*make_current)(bool release);
} gfx_ctx_driver_t;
typedef struct gfx_ctx_flags
{
uint32_t flags;
@ -288,11 +290,15 @@ bool video_context_driver_set(const gfx_ctx_driver_t *data);
void video_context_driver_destroy(void);
bool video_context_driver_update_window_title(void);
#define video_context_driver_update_window_title() \
if (current_video_context && current_video_context->update_window_title) \
current_video_context->update_window_title(video_context_data)
bool video_context_driver_swap_buffers(void);
#define video_context_driver_swap_buffers() \
if (current_video_context && current_video_context->swap_buffers) \
current_video_context->swap_buffers(video_context_data)
bool video_context_driver_focus(void);
#define video_context_driver_focus() ((video_context_data && current_video_context->has_focus && current_video_context->has_focus(video_context_data)) ? true : false)
bool video_context_driver_get_video_output_size(gfx_ctx_size_t *size_data);
@ -326,10 +332,14 @@ bool video_context_driver_translate_aspect(gfx_ctx_aspect_t *aspect);
bool video_context_driver_input_driver(gfx_ctx_input_t *inp);
bool video_context_driver_has_windowed(void);
#define video_context_driver_has_windowed() ((video_context_data && current_video_context->has_windowed(video_context_data)) ? true : false)
void video_context_driver_free(void);
extern const gfx_ctx_driver_t *current_video_context;
extern void *video_context_data;
RETRO_END_DECLS
#endif

View File

@ -74,8 +74,8 @@ typedef struct video_pixel_scaler
* Used by e.g. input drivers which bind to a window.
* Drivers are responsible for setting these if an input driver
* could potentially make use of this. */
static uintptr_t video_driver_display;
static uintptr_t video_driver_window;
static uintptr_t video_driver_display = 0;
static uintptr_t video_driver_window = 0;
static rarch_softfilter_t *video_driver_state_filter = NULL;
static void *video_driver_state_buffer = NULL;
@ -85,7 +85,7 @@ static bool video_driver_state_out_rgb32 = false;
static enum retro_pixel_format video_driver_pix_fmt = RETRO_PIXEL_FORMAT_0RGB1555;
static const void *frame_cache_data = NULL;
const void *frame_cache_data = NULL;
static unsigned frame_cache_width = 0;
static unsigned frame_cache_height = 0;
static size_t frame_cache_pitch = 0;
@ -101,13 +101,13 @@ static retro_time_t video_driver_frame_time_samples[MEASURE_FRAME_TIME_SAMPLES_C
static uint64_t video_driver_frame_time_count = 0;
static uint64_t video_driver_frame_count = 0;
static void *video_driver_data = NULL;
static video_driver_t *current_video = NULL;
void *video_driver_data = NULL;
video_driver_t *current_video = NULL;
/* Interface for "poking". */
static const video_poke_interface_t *video_driver_poke = NULL;
/* Used for 16-bit -> 16-bit conversions that take place before
/* Used for 15-bit -> 16-bit conversions that take place before
* being passed to video driver. */
static video_pixel_scaler_t *video_driver_scaler_ptr = NULL;
@ -223,6 +223,9 @@ static const video_driver_t *video_drivers[] = {
#endif
#ifdef HAVE_XSHM
&video_xshm,
#endif
#ifdef HAVE_CACA
&video_caca,
#endif
&video_null,
NULL,
@ -674,16 +677,24 @@ static bool init_video(void)
}
else
{
if (settings->video.force_aspect)
if(settings->video.window_x || settings->video.window_y)
{
/* Do rounding here to simplify integer scale correctness. */
unsigned base_width =
roundf(geom->base_height * video_driver_get_aspect_ratio());
width = roundf(base_width * settings->video.scale);
width = settings->video.window_x;
height = settings->video.window_y;
}
else
width = roundf(geom->base_width * settings->video.scale);
height = roundf(geom->base_height * settings->video.scale);
{
if (settings->video.force_aspect)
{
/* Do rounding here to simplify integer scale correctness. */
unsigned base_width =
roundf(geom->base_height * video_driver_get_aspect_ratio());
width = roundf(base_width * settings->video.scale);
}
else
width = roundf(geom->base_width * settings->video.scale);
height = roundf(geom->base_height * settings->video.scale);
}
}
if (width && height)
@ -1103,7 +1114,7 @@ static bool video_driver_frame_filter(const void *data,
data, width, height, pitch);
performance_counter_stop(&softfilter_process);
if (settings->video.post_filter_record)
if (settings->video.post_filter_record && recording_data)
recording_dump_frame(video_driver_state_buffer,
*output_width, *output_height, *output_pitch);
@ -1136,7 +1147,7 @@ bool video_driver_cached_frame(void)
void *recording = recording_driver_get_data_ptr();
/* Cannot allow recording when pushing duped frames. */
recording_driver_clear_data_ptr();
recording_data = NULL;
/* Not 100% safe, since the library might have
* freed the memory, but no known implementations do this.
@ -1150,7 +1161,7 @@ bool video_driver_cached_frame(void)
core_frame(&info);
recording_driver_set_data_ptr(recording);
recording_data = recording;
return true;
}
@ -1281,7 +1292,7 @@ void video_driver_menu_settings(void **list_data, void *list_info_data,
#ifdef _XBOX1
CONFIG_UINT(
list, list_info,
&settings->video.swap_interval,
&global->console.screen.flicker_filter_index,
MENU_ENUM_LABEL_VIDEO_FILTER_FLICKER,
MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_FLICKER,
0,
@ -1296,31 +1307,24 @@ void video_driver_menu_settings(void **list_data, void *list_info_data,
}
static void video_driver_lock(void)
{
#ifdef HAVE_THREADS
if (!display_lock)
return;
slock_lock(display_lock);
#endif
}
#define video_driver_lock() \
if (display_lock) \
slock_lock(display_lock)
static void video_driver_unlock(void)
{
#ifdef HAVE_THREADS
if (!display_lock)
return;
slock_unlock(display_lock);
#endif
}
#define video_driver_unlock() \
if (display_lock) \
slock_unlock(display_lock)
static void video_driver_lock_free(void)
{
#ifdef HAVE_THREADS
slock_free(display_lock);
display_lock = NULL;
#define video_driver_lock_free() \
slock_free(display_lock); \
display_lock = NULL
#else
#define video_driver_lock() ((void)0)
#define video_driver_unlock() ((void)0)
#define video_driver_lock_free() ((void)0)
#endif
}
static void video_driver_lock_new(void)
{
@ -1570,17 +1574,13 @@ void video_driver_set_aspect_ratio(void)
void video_driver_show_mouse(void)
{
if (!video_driver_poke)
return;
if (video_driver_poke->show_mouse)
if (video_driver_poke && video_driver_poke->show_mouse)
video_driver_poke->show_mouse(video_driver_data, true);
}
void video_driver_hide_mouse(void)
{
if (!video_driver_poke)
return;
if (video_driver_poke->show_mouse)
if (video_driver_poke && video_driver_poke->show_mouse)
video_driver_poke->show_mouse(video_driver_data, false);
}
@ -1668,40 +1668,11 @@ void video_driver_apply_state_changes(void)
bool video_driver_read_viewport(uint8_t *buffer)
{
if (!current_video->read_viewport)
return false;
if (!current_video->read_viewport(video_driver_data, buffer))
return false;
if ( current_video->read_viewport
&& current_video->read_viewport(video_driver_data, buffer))
return true;
return true;
}
bool video_driver_cached_frame_has_valid_framebuffer(void)
{
if (!frame_cache_data)
return false;
return frame_cache_data == RETRO_HW_FRAME_BUFFER_VALID;
}
bool video_driver_is_alive(void)
{
if (current_video)
return current_video->alive(video_driver_data);
return true;
}
bool video_driver_is_focused(void)
{
return current_video->focus(video_driver_data);
}
bool video_driver_has_windowed(void)
{
#if defined(RARCH_CONSOLE) || defined(RARCH_MOBILE)
return false;
#else
return current_video->has_windowed(video_driver_data);
#endif
}
uint64_t *video_driver_get_frame_count_ptr(void)
@ -1902,29 +1873,26 @@ void video_driver_gpu_record_deinit(void)
bool video_driver_get_current_software_framebuffer(struct retro_framebuffer *fb)
{
if (
!video_driver_poke ||
!video_driver_poke->get_current_software_framebuffer)
return false;
if (!video_driver_poke->get_current_software_framebuffer(
video_driver_poke
&& video_driver_poke->get_current_software_framebuffer
&& video_driver_poke->get_current_software_framebuffer(
video_driver_data, fb))
return false;
return true;
return true;
return false;
}
bool video_driver_get_hw_render_interface(
const struct retro_hw_render_interface **iface)
{
if (
!video_driver_poke ||
!video_driver_poke->get_hw_render_interface)
return false;
if (!video_driver_poke->get_hw_render_interface(
video_driver_poke
&& video_driver_poke->get_hw_render_interface
&& video_driver_poke->get_hw_render_interface(
video_driver_data, iface))
return false;
return true;
return true;
return false;
}
bool video_driver_get_viewport_info(struct video_viewport *viewport)
@ -2115,8 +2083,8 @@ void video_driver_frame(const void *data, unsigned width,
!video_driver_state_filter
|| !settings->video.post_filter_record
|| !data
|| video_driver_has_gpu_record()
)
|| video_driver_record_gpu_buffer
) && recording_data
)
recording_dump_frame(data, width, height, pitch);
@ -2197,3 +2165,57 @@ bool video_driver_texture_unload(uintptr_t *id)
*id = 0;
return true;
}
/**
* video_driver_translate_coord_viewport:
* @mouse_x : Pointer X coordinate.
* @mouse_y : Pointer Y coordinate.
* @res_x : Scaled X coordinate.
* @res_y : Scaled Y coordinate.
* @res_screen_x : Scaled screen X coordinate.
* @res_screen_y : Scaled screen Y coordinate.
*
* Translates pointer [X,Y] coordinates into scaled screen
* coordinates based on viewport info.
*
* Returns: true (1) if successful, false if video driver doesn't support
* viewport info.
**/
bool video_driver_translate_coord_viewport(
void *data,
int mouse_x, int mouse_y,
int16_t *res_x, int16_t *res_y,
int16_t *res_screen_x, int16_t *res_screen_y)
{
int scaled_screen_x, scaled_screen_y, scaled_x, scaled_y;
struct video_viewport *vp = (struct video_viewport*)data;
int norm_full_vp_width = (int)vp->full_width;
int norm_full_vp_height = (int)vp->full_height;
if (norm_full_vp_width <= 0 || norm_full_vp_height <= 0)
return false;
scaled_screen_x = (2 * mouse_x * 0x7fff) / norm_full_vp_width - 0x7fff;
scaled_screen_y = (2 * mouse_y * 0x7fff) / norm_full_vp_height - 0x7fff;
if (scaled_screen_x < -0x7fff || scaled_screen_x > 0x7fff)
scaled_screen_x = -0x8000; /* OOB */
if (scaled_screen_y < -0x7fff || scaled_screen_y > 0x7fff)
scaled_screen_y = -0x8000; /* OOB */
mouse_x -= vp->x;
mouse_y -= vp->y;
scaled_x = (2 * mouse_x * 0x7fff) / norm_full_vp_width - 0x7fff;
scaled_y = (2 * mouse_y * 0x7fff) / norm_full_vp_height - 0x7fff;
if (scaled_x < -0x7fff || scaled_x > 0x7fff)
scaled_x = -0x8000; /* OOB */
if (scaled_y < -0x7fff || scaled_y > 0x7fff)
scaled_y = -0x8000; /* OOB */
*res_x = scaled_x;
*res_y = scaled_y;
*res_screen_x = scaled_screen_x;
*res_screen_y = scaled_screen_y;
return true;
}

View File

@ -213,6 +213,18 @@ struct aspect_ratio_elem
extern struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END];
#define video_driver_is_alive() ((current_video) ? current_video->alive(video_driver_data) : true)
#define video_driver_is_focused() (current_video->focus(video_driver_data))
#if defined(RARCH_CONSOLE) || defined(RARCH_MOBILE)
#define video_driver_has_windowed() (false)
#else
#define video_driver_has_windowed() (current_video->has_windowed(video_driver_data))
#endif
#define video_driver_cached_frame_has_valid_framebuffer() (frame_cache_data ? (frame_cache_data == RETRO_HW_FRAME_BUFFER_VALID) : false)
void video_driver_destroy(void);
void video_driver_set_cached_frame_ptr(const void *data);
void video_driver_set_stub_frame(void);
@ -240,11 +252,7 @@ void video_driver_set_nonblock_state(bool toggle);
bool video_driver_find_driver(void);
void video_driver_apply_state_changes(void);
bool video_driver_read_viewport(uint8_t *buffer);
bool video_driver_cached_frame_has_valid_framebuffer(void);
bool video_driver_cached_frame(void);
bool video_driver_is_alive(void);
bool video_driver_is_focused(void);
bool video_driver_has_windowed(void);
uint64_t *video_driver_get_frame_count_ptr(void);
bool video_driver_frame_filter_alive(void);
bool video_driver_frame_filter_is_32bit(void);
@ -464,6 +472,30 @@ const video_poke_interface_t *video_driver_get_poke(void);
void video_driver_frame(const void *data, unsigned width,
unsigned height, size_t pitch);
#define video_driver_translate_coord_viewport_wrap(vp, mouse_x, mouse_y, res_x, res_y, res_screen_x, res_screen_y) \
(video_driver_get_viewport_info(vp) ? video_driver_translate_coord_viewport(vp, mouse_x, mouse_y, res_x, res_y, res_screen_x, res_screen_y) : false)
/**
* video_driver_translate_coord_viewport:
* @mouse_x : Pointer X coordinate.
* @mouse_y : Pointer Y coordinate.
* @res_x : Scaled X coordinate.
* @res_y : Scaled Y coordinate.
* @res_screen_x : Scaled screen X coordinate.
* @res_screen_y : Scaled screen Y coordinate.
*
* Translates pointer [X,Y] coordinates into scaled screen
* coordinates based on viewport info.
*
* Returns: true (1) if successful, false if video driver doesn't support
* viewport info.
**/
bool video_driver_translate_coord_viewport(
void *data,
int mouse_x, int mouse_y,
int16_t *res_x, int16_t *res_y, int16_t *res_screen_x,
int16_t *res_screen_y);
uintptr_t video_driver_display_get(void);
enum rarch_display_type video_driver_display_type_get(void);
@ -504,8 +536,14 @@ extern video_driver_t video_dispmanx;
extern video_driver_t video_sunxi;
extern video_driver_t video_drm;
extern video_driver_t video_xshm;
extern video_driver_t video_caca;
extern video_driver_t video_null;
extern const void *frame_cache_data;
extern void *video_driver_data;
extern video_driver_t *current_video;
RETRO_END_DECLS
#endif

View File

@ -38,8 +38,8 @@ static const shader_backend_t *shader_ctx_drivers[] = {
NULL
};
static const shader_backend_t *current_shader = NULL;
static void *shader_data = NULL;
const shader_backend_t *current_shader = NULL;
void *shader_data = NULL;
static const shader_backend_t *video_shader_set_backend(enum rarch_shader_type type)
{
@ -137,37 +137,6 @@ bool video_shader_driver_deinit(void)
return true;
}
bool video_shader_driver_set_parameter(struct uniform_info *param)
{
if (!current_shader || !param)
return false;
current_shader->set_uniform_parameter(shader_data,
param, NULL);
return true;
}
bool video_shader_driver_set_parameters(video_shader_ctx_params_t *params)
{
if (!current_shader || !current_shader->set_params)
return false;
current_shader->set_params(
params->data,
shader_data,
params->width,
params->height,
params->tex_width,
params->tex_height,
params->out_width,
params->out_height,
params->frame_counter,
params->info,
params->prev_info,
params->feedback_info,
params->fbo_info,
params->fbo_info_cnt);
return true;
}
/* Finds first suitable shader context driver. */
bool video_shader_driver_init_first(void)
{
@ -206,30 +175,19 @@ bool video_shader_driver_init(video_shader_ctx_init_t *init)
bool video_shader_driver_get_feedback_pass(unsigned *data)
{
if (!current_shader || !current_shader->get_feedback_pass)
return false;
if (!current_shader->get_feedback_pass(shader_data, data))
return false;
return true;
if ( current_shader
&& current_shader->get_feedback_pass
&& current_shader->get_feedback_pass(shader_data, data))
return true;
return false;
}
bool video_shader_driver_mipmap_input(unsigned *index)
{
if (!current_shader)
return false;
if (!current_shader->mipmap_input(shader_data, *index))
return false;
return true;
}
bool video_shader_driver_set_coords(video_shader_ctx_coords_t *coords)
{
if (!current_shader || !current_shader->set_coords)
return false;
if (!current_shader->set_coords(coords->handle_data,
shader_data, (const struct video_coords*)coords->data))
return false;
return true;
if ( current_shader
&& current_shader->mipmap_input(shader_data, *index))
return true;
return false;
}
bool video_shader_driver_scale(video_shader_ctx_scale_t *scaler)
@ -257,25 +215,15 @@ bool video_shader_driver_info(video_shader_ctx_info_t *shader_info)
return true;
}
bool video_shader_driver_set_mvp(video_shader_ctx_mvp_t *mvp)
{
if (!current_shader || !current_shader->set_mvp)
return false;
if (!mvp || !mvp->matrix)
return false;
if (!current_shader->set_mvp(mvp->data, shader_data, mvp->matrix))
return false;
return true;
}
bool video_shader_driver_filter_type(video_shader_ctx_filter_t *filter)
{
if (!current_shader || !current_shader->filter_type || !filter)
return false;
if (!current_shader->filter_type(shader_data,
if ( filter
&& current_shader
&& current_shader->filter_type
&& current_shader->filter_type(shader_data,
filter->index, filter->smooth))
return false;
return true;
return true;
return false;
}
bool video_shader_driver_compile_program(struct shader_program_info *program_info)
@ -286,14 +234,6 @@ bool video_shader_driver_compile_program(struct shader_program_info *program_inf
program_info->idx, NULL, program_info);
}
bool video_shader_driver_use(video_shader_ctx_info_t *shader_info)
{
if (!current_shader || !shader_info)
return false;
current_shader->use(shader_info->data, shader_data, shader_info->idx, shader_info->set_active);
return true;
}
bool video_shader_driver_wrap_type(video_shader_ctx_wrap_t *wrap)
{
if (!current_shader || !current_shader->wrap_type)

View File

@ -36,7 +36,9 @@
#define VIDEO_SHADER_STOCK_BLEND (GFX_MAX_SHADERS - 1)
#define VIDEO_SHADER_MENU (GFX_MAX_SHADERS - 2)
#define VIDEO_SHADER_MENU_SEC (GFX_MAX_SHADERS - 3)
#define VIDEO_SHADER_MENU_2 (GFX_MAX_SHADERS - 3)
#define VIDEO_SHADER_MENU_3 (GFX_MAX_SHADERS - 4)
#define VIDEO_SHADER_MENU_4 (GFX_MAX_SHADERS - 5)
#endif
@ -276,9 +278,13 @@ bool video_shader_driver_direct_get_current_shader(video_shader_ctx_t *shader);
bool video_shader_driver_deinit(void);
bool video_shader_driver_set_parameter(struct uniform_info *param);
#define video_shader_driver_set_parameter(param) \
if (current_shader && current_shader->set_uniform_parameter) \
current_shader->set_uniform_parameter(shader_data, &param, NULL)
bool video_shader_driver_set_parameters(video_shader_ctx_params_t *params);
#define video_shader_driver_set_parameters(params) \
if (current_shader && current_shader->set_params) \
current_shader->set_params(params.data, shader_data, params.width, params.height, params.tex_width, params.tex_height, params.out_width, params.out_height, params.frame_counter, params.info, params.prev_info, params.feedback_info, params.fbo_info, params.fbo_info_cnt)
bool video_shader_driver_init_first(void);
@ -288,22 +294,31 @@ bool video_shader_driver_get_feedback_pass(unsigned *data);
bool video_shader_driver_mipmap_input(unsigned *index);
bool video_shader_driver_set_coords(video_shader_ctx_coords_t *coords);
#define video_shader_driver_set_coords(coords) \
if (current_shader && current_shader->set_coords) \
current_shader->set_coords(coords.handle_data, shader_data, (const struct video_coords*)coords.data)
bool video_shader_driver_scale(video_shader_ctx_scale_t *scaler);
bool video_shader_driver_info(video_shader_ctx_info_t *shader_info);
bool video_shader_driver_set_mvp(video_shader_ctx_mvp_t *mvp);
#define video_shader_driver_set_mvp(mvp) \
if (mvp.matrix && current_shader && current_shader->set_mvp) \
current_shader->set_mvp(mvp.data, shader_data, mvp.matrix) \
bool video_shader_driver_filter_type(video_shader_ctx_filter_t *filter);
bool video_shader_driver_compile_program(struct shader_program_info *program_info);
bool video_shader_driver_use(video_shader_ctx_info_t *shader_info);
#define video_shader_driver_use(shader_info) \
if (current_shader) \
current_shader->use(shader_info.data, shader_data, shader_info.idx, shader_info.set_active)
bool video_shader_driver_wrap_type(video_shader_ctx_wrap_t *wrap);
extern const shader_backend_t *current_shader;
extern void *shader_data;
extern const shader_backend_t gl_glsl_backend;
extern const shader_backend_t hlsl_backend;
extern const shader_backend_t gl_cg_backend;

View File

@ -116,6 +116,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
struct video_shader_pass *pass, unsigned i)
{
char tmp_str[PATH_MAX_LENGTH];
char tmp_path[PATH_MAX_LENGTH];
char shader_name[64];
char filter_name_buf[64];
char wrap_name_buf[64];
@ -148,8 +149,14 @@ static bool video_shader_parse_pass(config_file_t *conf,
return false;
}
strlcpy(pass->source.path, tmp_str, sizeof(pass->source.path));
strlcpy(tmp_path, tmp_str, sizeof(tmp_path));
path_resolve_realpath(tmp_path, sizeof(tmp_path));
if (!path_file_exists(tmp_path))
strlcpy(pass->source.path, tmp_str, sizeof(pass->source.path));
else
strlcpy(pass->source.path, tmp_path, sizeof(pass->source.path));
/* Smooth */
snprintf(filter_name_buf, sizeof(filter_name_buf), "filter_linear%u", i);
@ -323,6 +330,7 @@ static bool video_shader_parse_textures(config_file_t *conf,
char textures[1024];
const char *id = NULL;
char *save = NULL;
char tmp_path[PATH_MAX_LENGTH];
textures[0] = '\0';
@ -349,6 +357,15 @@ static bool video_shader_parse_textures(config_file_t *conf,
return false;
}
strlcpy(tmp_path, shader->lut[shader->luts].path, sizeof(tmp_path));
path_resolve_realpath(tmp_path, sizeof(tmp_path));
if (path_file_exists(tmp_path))
{
strlcpy(shader->lut[shader->luts].path,
tmp_path, sizeof(shader->lut[shader->luts].path));
}
strlcpy(shader->lut[shader->luts].id, id,
sizeof(shader->lut[shader->luts].id));
@ -842,12 +859,17 @@ void video_shader_write_conf_cgp(config_file_t *conf,
for (i = 0; i < shader->passes; i++)
{
char key[64];
char tmp[PATH_MAX_LENGTH];
const struct video_shader_pass *pass = &shader->pass[i];
key[0] = '\0';
snprintf(key, sizeof(key), "shader%u", i);
config_set_string(conf, key, pass->source.path);
strlcpy(tmp, pass->source.path, sizeof(tmp));
if (!path_is_absolute(tmp))
path_resolve_realpath(tmp, sizeof(tmp));
config_set_string(conf, key, tmp);
if (pass->filter != RARCH_FILTER_UNSPEC)
{

View File

@ -64,6 +64,16 @@ ARCHIVE FILE
#include "../libretro-common/file/archive_file_7z.c"
#endif
/*============================================================
COMPRESSION
============================================================ */
#include "../libretro-common/streams/trans_stream.c"
#include "../libretro-common/streams/trans_stream_pipe.c"
#ifdef HAVE_ZLIB
#include "../libretro-common/streams/trans_stream_zlib.c"
#endif
/*============================================================
ENCODINGS
============================================================ */
@ -310,8 +320,10 @@ VIDEO DRIVER
#ifndef HAVE_PSGL
#include "../libretro-common/glsym/rglgen.c"
#ifdef HAVE_OPENGLES2
#if defined(HAVE_OPENGLES2)
#include "../libretro-common/glsym/glsym_es2.c"
#elif defined(HAVE_OPENGLES3)
#include "../libretro-common/glsym/glsym_es3.c"
#else
#include "../libretro-common/glsym/glsym_gl.c"
#endif
@ -386,6 +398,10 @@ FONTS
#include "../gfx/drivers_font/ctr_font.c"
#endif
#if defined(HAVE_CACA)
#include "../gfx/drivers_font/caca_font.c"
#endif
#if defined(HAVE_VULKAN)
#include "../gfx/drivers_font/vulkan_raster_font.c"
@ -394,7 +410,7 @@ FONTS
/*============================================================
INPUT
============================================================ */
#include "../input/input_autodetect.c"
#include "../tasks/task_autodetect.c"
#include "../input/input_joypad_driver.c"
#include "../input/input_config.c"
#include "../input/input_keymaps.c"
@ -463,6 +479,7 @@ INPUT
#endif
#ifdef HAVE_UDEV
#include "../input/common/udev_common.c"
#include "../input/drivers/udev_input.c"
#include "../input/drivers_keyboard/keyboard_event_udev.c"
#include "../input/drivers_joypad/udev_joypad.c"
@ -865,14 +882,18 @@ NETPLAY
#include "../network/netplay/netplay_net.c"
#include "../network/netplay/netplay_spectate.c"
#include "../network/netplay/netplay_common.c"
#include "../network/netplay/netplay_discovery.c"
#include "../network/netplay/netplay.c"
#include "../libretro-common/net/net_compat.c"
#include "../libretro-common/net/net_socket.c"
#include "../libretro-common/net/net_http.c"
#include "../libretro-common/net/net_natt.c"
#ifndef HAVE_SOCKET_LEGACY
#include "../libretro-common/net/net_ifinfo.c"
#endif
#include "../tasks/task_http.c"
#include "../tasks/task_netplay_lan_scan.c"
#include "../tasks/task_wifi.c"
#endif
/*============================================================
@ -960,6 +981,10 @@ MENU
#include "../menu/drivers_display/menu_display_ctr.c"
#endif
#ifdef HAVE_CACA
#include "../menu/drivers_display/menu_display_caca.c"
#endif
#endif

View File

@ -29,48 +29,56 @@
#ifdef HAVE_VULKAN
#include "../deps/glslang/glslang.cpp"
#include "../deps/glslang/glslang_tab.cpp"
#include "../deps/glslang/glslang/SPIRV/SpvBuilder.cpp"
#include "../deps/glslang/glslang/SPIRV/SPVRemapper.cpp"
#include "../deps/glslang/glslang/SPIRV/InReadableOrder.cpp"
#include "../deps/glslang/glslang/SPIRV/disassemble.cpp"
#include "../deps/glslang/glslang/SPIRV/doc.cpp"
#include "../deps/glslang/glslang/SPIRV/GlslangToSpv.cpp"
#include "../deps/glslang/glslang/SPIRV/disassemble.cpp"
#include "../deps/glslang/glslang/SPIRV/logger.cpp"
#include "../deps/glslang/glslang/SPIRV/InReadableOrder.cpp"
#include "../deps/glslang/glslang/SPIRV/Logger.cpp"
#include "../deps/glslang/glslang/SPIRV/SpvBuilder.cpp"
#include "../deps/glslang/glslang/SPIRV/SPVRemapper.cpp"
#include "../deps/glslang/glslang/glslang/GenericCodeGen/CodeGen.cpp"
#include "../deps/glslang/glslang/glslang/GenericCodeGen/Link.cpp"
#include "../deps/glslang/glslang/glslang/GenericCodeGen/CodeGen.cpp"
#include "../deps/glslang/glslang/hlsl/hlslGrammar.cpp"
#include "../deps/glslang/glslang/hlsl/hlslOpMap.cpp"
#include "../deps/glslang/glslang/hlsl/hlslTokenStream.cpp"
#include "../deps/glslang/glslang/hlsl/hlslScanContext.cpp"
#include "../deps/glslang/glslang/hlsl/hlslParseHelper.cpp"
#include "../deps/glslang/glslang/hlsl/hlslParseables.cpp"
#include "../deps/glslang/glslang/glslang/GenericCodeGen/CodeGen.cpp"
#include "../deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/Intermediate.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/propagateNoContraction.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/Versions.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/RemoveTree.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/limits.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/intermOut.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/Initialize.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/SymbolTable.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/parseConst.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/ParseHelper.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/IntermTraverse.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/InfoSink.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/Constant.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/Scan.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/reflection.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/glslang_tab.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/InfoSink.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/Initialize.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/Intermediate.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/intermOut.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/IntermTraverse.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/iomapper.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/limits.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/linkValidate.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/parseConst.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/ParseContextBase.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/ParseHelper.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/PoolAlloc.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/propagateNoContraction.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/reflection.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/RemoveTree.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/Scan.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/SymbolTable.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/Versions.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpMemory.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpSymbols.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp"
#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp"
#include "../deps/glslang/glslang/hlsl/hlslAttributes.cpp"
#include "../deps/glslang/glslang/hlsl/hlslGrammar.cpp"
#include "../deps/glslang/glslang/hlsl/hlslOpMap.cpp"
#include "../deps/glslang/glslang/hlsl/hlslParseables.cpp"
#include "../deps/glslang/glslang/hlsl/hlslParseHelper.cpp"
#include "../deps/glslang/glslang/hlsl/hlslScanContext.cpp"
#include "../deps/glslang/glslang/hlsl/hlslTokenStream.cpp"
#ifdef _WIN32
#include "../deps/glslang/glslang/glslang/OSDependent/Windows/ossource.cpp"
@ -179,6 +187,7 @@ VIDEO DRIVER
#include "../gfx/drivers_shader/glslang_util.cpp"
#include "../gfx/drivers_shader/slang_reflection.cpp"
#include "../deps/SPIRV-Cross/spirv_cross.cpp"
#include "../deps/SPIRV-Cross/spirv_cfg.cpp"
#endif
/*============================================================

View File

@ -19,48 +19,36 @@
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/epoll.h>
#include "epoll_common.h"
#include "../../verbosity.h"
static int g_epoll;
static bool epoll_inited;
static bool epoll_first_inited_is_joypad;
bool epoll_new(bool is_joypad)
bool epoll_new(int *epoll_fd)
{
if (epoll_inited)
return true;
g_epoll = epoll_create(32);
if (g_epoll < 0)
*epoll_fd = epoll_create(32);
if (*epoll_fd < 0)
return false;
epoll_first_inited_is_joypad = is_joypad;
epoll_inited = true;
return true;
}
void epoll_free(bool is_joypad)
void epoll_free(int *epoll_fd)
{
if (!epoll_inited || (is_joypad && !epoll_first_inited_is_joypad))
return;
if (*epoll_fd >= 0)
close(*epoll_fd);
if (g_epoll >= 0)
close(g_epoll);
g_epoll = -1;
epoll_inited = false;
epoll_first_inited_is_joypad = false;
*epoll_fd = -1;
}
int epoll_waiting(struct epoll_event *events, int maxevents, int timeout)
int epoll_waiting(int *epoll_fd, void *events, int maxevents, int timeout)
{
return epoll_wait(g_epoll, events, maxevents, timeout);
return epoll_wait(*epoll_fd, (struct epoll_event*)events, maxevents, timeout);
}
bool epoll_add(int fd, void *device)
bool epoll_add(int *epoll_fd, int fd, void *device)
{
struct epoll_event event = {0};
@ -68,7 +56,7 @@ bool epoll_add(int fd, void *device)
event.data.ptr = device;
/* Shouldn't happen, but just check it. */
if (epoll_ctl(g_epoll, EPOLL_CTL_ADD, fd, &event) < 0)
if (epoll_ctl(*epoll_fd, EPOLL_CTL_ADD, fd, &event) < 0)
{
RARCH_ERR("Failed to add FD (%d) to epoll list (%s).\n",
fd, strerror(errno));

Some files were not shown because too many files have changed in this diff Show More