mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-12 18:45:33 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9552f87157 | ||
|
|
2b10350edc | ||
|
|
9f4a9e9cd6 | ||
|
|
02bc3ee1e8 | ||
|
|
a62cac03e6 | ||
|
|
63f5723b27 | ||
|
|
434f046244 | ||
|
|
63c7deb583 | ||
|
|
a1210d63cc | ||
|
|
23916f88c7 | ||
|
|
fc8b76708a | ||
|
|
e179a8e568 | ||
|
|
fec69828a9 | ||
|
|
a1ed747a7f | ||
|
|
2386ec8f0c | ||
|
|
7cfbe73288 | ||
|
|
c637686a76 | ||
|
|
fda235518a | ||
|
|
1c45a070d1 | ||
|
|
922d5a00e1 | ||
|
|
24ca499570 | ||
|
|
b70451d550 | ||
|
|
602d3d285c | ||
|
|
bcefb124f3 | ||
|
|
3db672a60d | ||
|
|
d6fca804b4 | ||
|
|
1fd777106d | ||
|
|
d3519a2b82 | ||
|
|
18912ac23d | ||
|
|
230198fe4a | ||
|
|
089c64f427 | ||
|
|
950bf29c27 | ||
|
|
2e26a05875 | ||
|
|
d1f4279b8f | ||
|
|
31ff7e384f | ||
|
|
fa37234a49 | ||
|
|
a1752db25a | ||
|
|
737718ba5d | ||
|
|
8bf11e9b18 | ||
|
|
bc226305d7 | ||
|
|
e030986837 | ||
|
|
bcbad532e6 | ||
|
|
88b8e5a16a | ||
|
|
d9bbe604e9 | ||
|
|
67f0df94f9 | ||
|
|
53beaee6e6 | ||
|
|
5b562c4c24 | ||
|
|
1a2fdffd5b | ||
|
|
8ada7049c2 | ||
|
|
93e8edf2f9 | ||
|
|
8ce192de82 | ||
|
|
376b62e8fa | ||
|
|
64c30610f5 | ||
|
|
b6561ee9ca | ||
|
|
cf1bc2634d | ||
|
|
2f836f786f | ||
|
|
1431a0b275 | ||
|
|
1c8b6bebce | ||
|
|
cebc01cb1e | ||
|
|
2ac18a621a | ||
|
|
51b868b6a4 | ||
|
|
c9c2d8a0b6 | ||
|
|
54a07eaa60 | ||
|
|
3f5eb55405 | ||
|
|
77829a8e5b | ||
|
|
1d4462b198 | ||
|
|
62bb1d4da4 | ||
|
|
cdaf08b908 | ||
|
|
af3006c3d7 | ||
|
|
5c3a7a7e7f | ||
|
|
3613b666e5 | ||
|
|
3689a719fd | ||
|
|
5397f1c046 | ||
|
|
4991245cdf | ||
|
|
5e772350b4 | ||
|
|
eb92274f9b | ||
|
|
b5fe162c32 | ||
|
|
c4b4961ed1 | ||
|
|
32a4607eb6 | ||
|
|
cfe68a4c2d | ||
|
|
cde22645e5 | ||
|
|
4ea0f232ef | ||
|
|
0c9499a88e | ||
|
|
3a057d594b | ||
|
|
a8a5372c6b | ||
|
|
cff87ab1e0 | ||
|
|
9b73f2a38c | ||
|
|
4cdd5dce38 | ||
|
|
020ee2d289 | ||
|
|
de8267d2e2 | ||
|
|
942d82593b | ||
|
|
a86e8e0f36 | ||
|
|
c8940c130d | ||
|
|
4a388668a3 | ||
|
|
5e3fd8e95e | ||
|
|
9c4fde00ce | ||
|
|
6591b53547 | ||
|
|
7d6c0417eb | ||
|
|
268bf61da6 | ||
|
|
506271e769 | ||
|
|
5e88958e26 | ||
|
|
6408da2ae4 | ||
|
|
b3a4c02d05 | ||
|
|
2518ad47d9 | ||
|
|
65534f0286 | ||
|
|
8c7e785661 | ||
|
|
1db42a5611 | ||
|
|
44a254264b | ||
|
|
d2d16ea171 | ||
|
|
89f5eefb92 | ||
|
|
9fe01ff0c8 | ||
|
|
8894caddc2 | ||
|
|
852eb8ab8e | ||
|
|
d717f3537a | ||
|
|
4478167634 | ||
|
|
dd612a6637 | ||
|
|
923dc52f87 | ||
|
|
80c1b54b52 | ||
|
|
421bcb07d3 | ||
|
|
eaba575c9e | ||
|
|
31674f9246 | ||
|
|
9f4b3b0fc6 | ||
|
|
7cbb79277d | ||
|
|
6044f8b335 | ||
|
|
d24498bdf1 | ||
|
|
00d7c40c7a | ||
|
|
a97c884159 | ||
|
|
5ad36f7040 | ||
|
|
2f57d3cbea | ||
|
|
6652bb4795 | ||
|
|
955e25fc39 | ||
|
|
2052f1595c | ||
|
|
f2bb7e29a4 | ||
|
|
a6030f89fe | ||
|
|
3cd320fa83 | ||
|
|
ec9efcb4b0 | ||
|
|
6dcaa04a93 | ||
|
|
70957aa52a | ||
|
|
1c4cb37e61 | ||
|
|
875791b40c | ||
|
|
6dc758a080 | ||
|
|
ede03659ca | ||
|
|
4b4a8693ac | ||
|
|
0edd97d5db | ||
|
|
a9cf718e75 | ||
|
|
52e8c102fc | ||
|
|
29e9a54000 | ||
|
|
f522cfcce8 | ||
|
|
04016ed4a6 | ||
|
|
e1e6f2db51 | ||
|
|
6fa4350ade | ||
|
|
70f57974c7 | ||
|
|
4f2566ad50 | ||
|
|
a4f143a71a | ||
|
|
2037de5b33 | ||
|
|
6173d11b62 | ||
|
|
060ad38905 | ||
|
|
41fd598195 | ||
|
|
0fced84f93 | ||
|
|
50cb20592c | ||
|
|
1eeb3dcf30 | ||
|
|
a3d3e18369 | ||
|
|
69ec94fe47 | ||
|
|
41cee583e3 | ||
|
|
4713bf5cef | ||
|
|
c346e1f816 | ||
|
|
3d677ee90c | ||
|
|
e43111d9cb | ||
|
|
2768655267 | ||
|
|
057ae3c134 | ||
|
|
e64b4c1d24 | ||
|
|
aeb3f692d5 | ||
|
|
af01b97a11 | ||
|
|
d9ab59cb4a | ||
|
|
4a20709645 | ||
|
|
647bdc5cbd | ||
|
|
115e779cf0 | ||
|
|
3387170d62 | ||
|
|
03ea12d334 | ||
|
|
a8fdfd77ce | ||
|
|
cb5de27631 | ||
|
|
d9ccd3a737 | ||
|
|
5874bb8b27 | ||
|
|
2f42fc5932 | ||
|
|
0bbd5b7a45 | ||
|
|
d1c130d60a | ||
|
|
692f37b91a | ||
|
|
13279eb0d4 | ||
|
|
9e5f00ba27 | ||
|
|
1e21bf5074 | ||
|
|
51c1064609 | ||
|
|
a188826a10 | ||
|
|
24dd7409bc | ||
|
|
cc2d70f044 | ||
|
|
7b5b14b0a7 | ||
|
|
969475254f | ||
|
|
2cc776d2d9 | ||
|
|
5852251d56 | ||
|
|
182ad31c63 | ||
|
|
2a36fa0855 | ||
|
|
ad1aa59ce1 | ||
|
|
6d37d014a0 | ||
|
|
bc522c3fa5 | ||
|
|
73b9b5b270 | ||
|
|
4b90fcdeac | ||
|
|
7eaa771d57 | ||
|
|
521f4bfefc | ||
|
|
6800fadafe | ||
|
|
26c6c34817 | ||
|
|
3f98cbc52d | ||
|
|
9ace693ec0 | ||
|
|
0aff65e77b | ||
|
|
8c63ea2515 | ||
|
|
f9f0c5aea6 | ||
|
|
5eee8daa4f | ||
|
|
d4dd1f71a5 | ||
|
|
25888db0af | ||
|
|
2b19a50775 | ||
|
|
8c0b15052a | ||
|
|
5e904c4dc3 | ||
|
|
54fd445c75 | ||
|
|
27a7ab20e2 | ||
|
|
646efb91e1 | ||
|
|
c805fd3213 | ||
|
|
2d83b58703 | ||
|
|
582f967fb0 | ||
|
|
12af4ed7e3 | ||
|
|
f5623edec1 | ||
|
|
0be52f8a49 | ||
|
|
83410572cc | ||
|
|
70fba3e92e | ||
|
|
41541128c5 | ||
|
|
cdaf907467 | ||
|
|
f22af81e7d | ||
|
|
9107e5767c | ||
|
|
6946f878ef | ||
|
|
9631719061 | ||
|
|
056a5d1466 | ||
|
|
493dd1749c | ||
|
|
f5a880b6c5 | ||
|
|
ec624f7baa | ||
|
|
d51cd37fa8 | ||
|
|
695203212c | ||
|
|
7d849ac8fb |
No files matched your search
+46
@@ -1,5 +1,51 @@
|
||||
# Future
|
||||
|
||||
# 1.8.8
|
||||
- AUDIO/JACK: Fix regression introduced after 1.8.4 - would hang at startup
|
||||
- CHEEVOS: Disable hardcore when cheats are enabled
|
||||
- CHD: Return false when special track cannot be found
|
||||
- DISCORD/MATCHMAKING: Fix Discord 'Ask To Join' functionality
|
||||
- FILE PATH: Various file path handling optimisations
|
||||
- FONT: Fix Arabic, Chinese and Korean font rendering
|
||||
- INPUT MAPPING/REMAPPING: Restore broken 'reset to default' functionality with RetroPad 'start' button
|
||||
- INPUT MAPPING/REMAPPING: Fix 'reset to default' action for analog sticks and undefined core inputs
|
||||
- LOCALIZATION: Update Arabic translation
|
||||
- LOCALIZATION: Update Chinese (Simplified) translation
|
||||
- LOCALIZATION: Update Chinese (Traditional) translation
|
||||
- LOCALIZATION: Update German translation
|
||||
- LOCALIZATION: Update Greek translation
|
||||
- LOCALIZATION: Update Spanish translation
|
||||
- LOCALIZATION: Update French translation
|
||||
- LOCALIZATION: Update Italian translation
|
||||
- LOCALIZATION: Update Japanese translation
|
||||
- LOCALIZATION: Update Korean translation
|
||||
- LOCALIZATION: Update Dutch translation
|
||||
- LOCALIZATION: Update Polish translation
|
||||
- LOCALIZATION: Update Portuguese Brazilian translation
|
||||
- LOCALIZATION: Update Russian translation
|
||||
- LOCALIZATION: Update Turkish translation
|
||||
- LOCALIZATION: Update Vietnamese translation
|
||||
- LOCALIZATION: Add Slovak translation
|
||||
- MENU: Small buffer optimizations
|
||||
- MENU/THUMBNAILS/BUGFIX: Fix heap-use-after-free error
|
||||
- MENU/OZONE: Add option to sort playlists after name truncation
|
||||
- MENU/OZONE/ANDROIDTV: Default to Ozone menu driver
|
||||
- MENU/OZONE/ANDROID: Gamepad-like devices default to Ozone now (Shield Portable)
|
||||
- NETPLAY: Lower announcement rate
|
||||
- OVERLAYS: Fix memory leak when loading overlays
|
||||
- SHADER PRESETS: Improved shader preset dirs
|
||||
- TIME/DATE: Enable configuration of date seperator in clock and runtime 'last played' displays
|
||||
- VITA: Fix upside-down vertical games
|
||||
- UWP: Enable playlist and savefile compression by default (because of slow file I/O)
|
||||
- WIIU: Gamepad hotplugging support
|
||||
- WIIU: Theoretical multi-gamepad support
|
||||
- VIDEO/WIDGETS: Fix overlapping text when simultaneous pop-up notifications and core/shader messages are being displayed
|
||||
- X11: Fix crash in x11_display_server_get_screen_orientation
|
||||
- X11/XSHM: Allow X11/XHSM video driver to operate without SHM extension
|
||||
- X11/XSHM: Fix compatibility with X11 input driver
|
||||
- XVIDEO: Fix keyboard input initialization
|
||||
- XVIDEO/XWAYLAND: Fix XVideo support on xwayland (by supporting I420 and YZ12)
|
||||
|
||||
# 1.8.7
|
||||
- 3DS: Add IDs for Frodo
|
||||
- 3DS: Enable basic networking / cheevos
|
||||
|
||||
+10
-8
@@ -327,7 +327,8 @@ ifeq ($(HAVE_LANGEXTRA), 1)
|
||||
intl/msg_hash_cht.o \
|
||||
intl/msg_hash_ar.o \
|
||||
intl/msg_hash_el.o \
|
||||
intl/msg_hash_tr.o
|
||||
intl/msg_hash_tr.o \
|
||||
intl/msg_hash_sk.o
|
||||
endif
|
||||
|
||||
ifneq ($(HAVE_GETOPT_LONG), 1)
|
||||
@@ -1845,11 +1846,11 @@ ifeq ($(HAVE_NETWORKING), 1)
|
||||
DEFINES += -DHAVE_CHEEVOS
|
||||
INCLUDE_DIRS += -Ideps/rcheevos/include
|
||||
|
||||
OBJ += cheevos-new/cheevos.o \
|
||||
cheevos-new/badges.o \
|
||||
cheevos-new/fixup.o \
|
||||
cheevos-new/parser.o \
|
||||
cheevos-new/hash.o \
|
||||
OBJ += cheevos/cheevos.o \
|
||||
cheevos/badges.o \
|
||||
cheevos/fixup.o \
|
||||
cheevos/parser.o \
|
||||
cheevos/hash.o \
|
||||
$(LIBRETRO_COMM_DIR)/formats/cdfs/cdfs.o \
|
||||
deps/rcheevos/src/rcheevos/alloc.o \
|
||||
deps/rcheevos/src/rcheevos/compat.o \
|
||||
@@ -1914,7 +1915,8 @@ ifeq ($(HAVE_NETWORKING), 1)
|
||||
ifeq ($(HAVE_DISCORD), 1)
|
||||
NEED_CXX_LINKER = 1
|
||||
DEFINES += -DHAVE_DISCORD
|
||||
INCLUDE_DIRS += -Ideps/discord-rpc/include/ -Ideps/discord-rpc/thirdparty/rapidjson-1.1.0/include/
|
||||
INCLUDE_DIRS += -Ideps/discord-rpc/include \
|
||||
-Ideps/discord-rpc/thirdparty/rapidjson-1.1.0/include/
|
||||
|
||||
ifneq ($(HAVE_THREADS), 1)
|
||||
DEFINES += -DDISCORD_DISABLE_IO_THREAD
|
||||
@@ -1923,7 +1925,7 @@ ifeq ($(HAVE_NETWORKING), 1)
|
||||
OBJ += deps/discord-rpc/src/discord_rpc.o \
|
||||
deps/discord-rpc/src/rpc_connection.o \
|
||||
deps/discord-rpc/src/serialization.o \
|
||||
discord/discord.o
|
||||
network/discord.o
|
||||
|
||||
ifneq ($(findstring Win32,$(OS)),)
|
||||
OBJ += deps/discord-rpc/src/discord_register_win.o \
|
||||
|
||||
+10
-17
@@ -11,8 +11,6 @@ PS2_IP = 192.168.1.150
|
||||
TARGET = retroarchps2.elf
|
||||
TARGET_RELEASE = retroarchps2-release.elf
|
||||
|
||||
# Lib CDVD
|
||||
CDVD_DIR = ps2/libcdvd
|
||||
|
||||
# Compile the IRXs first
|
||||
IRX_DIR = ps2/irx
|
||||
@@ -30,7 +28,7 @@ ifeq ($(MUTE_WARNINGS), 1)
|
||||
DISABLE_WARNINGS := -Wno-sign-compare -Wno-unused -Wno-parentheses
|
||||
endif
|
||||
|
||||
INCDIR = -I$(PS2DEV)/gsKit/include -I$(PS2SDK)/ports/include -I$(CDVD_DIR)/ee
|
||||
INCDIR = -I$(PS2DEV)/gsKit/include -I$(PS2SDK)/ports/include
|
||||
INCDIR += -Ips2 -Ips2/include -Ilibretro-common/include -Ideps -Ideps/stb -Ideps/7zip
|
||||
INCDIR += -Ideps/pthreads -Ideps/pthreads/platform/ps2 -Ideps/pthreads/platform/helper
|
||||
GPVAL = -G0
|
||||
@@ -41,9 +39,9 @@ RARCH_DEFINES += -DPS2 -DUSE_IOP_CTYPE_MACRO -D_MIPS_ARCH_R5900 -DHAVE_ZLIB -DHA
|
||||
RARCH_DEFINES += -DHAVE_GRIFFIN=1 -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_MENU -DHAVE_CONFIGFILE -DHAVE_RGUI -DHAVE_FILTERS_BUILTIN -DHAVE_7ZIP -DHAVE_CC_RESAMPLER
|
||||
|
||||
LIBDIR =
|
||||
LDFLAGS += -L$(PS2SDK)/ports/lib -L$(PS2DEV)/gsKit/lib -L$(PS2SDK)/ee/lib -L$(CDVD_DIR)/lib -L.
|
||||
LIBS += -lretro_ps2 -lgskit -ldmakit -lgskit_toolkit -laudsrv -lmf -lpadx -lmtap -lmc -lhdd -lsdl -lfileXio -lz
|
||||
LIBS += -lcdvdfs -lpatches -lpoweroff
|
||||
LDFLAGS += -L$(PS2SDK)/ports/lib -L$(PS2DEV)/gsKit/lib -L$(PS2SDK)/ee/lib -L.
|
||||
LIBS += -lretro_ps2 -lgskit -ldmakit -lgskit_toolkit -laudsrv -lpadx -lmtap -lmc -lhdd -lsdl -lfileXio -lz
|
||||
LIBS += -lpatches -lpoweroff
|
||||
|
||||
ifeq ($(BUILD_FOR_PCSX2), 1)
|
||||
RARCH_DEFINES += -DBUILD_FOR_PCSX2
|
||||
@@ -71,13 +69,10 @@ CFLAGS += $(RARCH_DEFINES)
|
||||
EE_OBJS += $(IRX_DIR)/freemtap_irx.o $(IRX_DIR)/freepad_irx.o $(IRX_DIR)/freesio2_irx.o $(IRX_DIR)/iomanX_irx.o
|
||||
EE_OBJS += $(IRX_DIR)/fileXio_irx.o $(IRX_DIR)/mcman_irx.o $(IRX_DIR)/mcserv_irx.o $(IRX_DIR)/usbd_irx.o
|
||||
EE_OBJS += $(IRX_DIR)/usbhdfsd_irx.o $(IRX_DIR)/freesd_irx.o $(IRX_DIR)/audsrv_irx.o $(IRX_DIR)/poweroff_irx.o
|
||||
EE_OBJS += $(IRX_DIR)/cdvd_irx.o
|
||||
|
||||
# Missing objecst on the PS2SDK
|
||||
EE_OBJS += ps2/compat_files/compat_ctype.o ps2/compat_files/time.o ps2/compat_files/ps2_devices.o
|
||||
EE_OBJS += ps2/compat_files/fileXio_cdvd.o ps2/compat_files/ps2_descriptor.o
|
||||
EE_OBJS += ps2/compat_files/ps2_devices.o
|
||||
|
||||
#EE_OBJS = griffin/griffin.o bootstrap/ps2/kernel_functions.o
|
||||
EE_OBJS += griffin/griffin.o
|
||||
|
||||
EE_CFLAGS = $(CFLAGS)
|
||||
@@ -106,7 +101,10 @@ prepare:
|
||||
run:
|
||||
ps2client -h $(PS2_IP) execee host:$(EE_BIN)
|
||||
|
||||
debug: clean prepare all run
|
||||
sim:
|
||||
PCSX2 --elf=$(PWD)/$(EE_BIN) --nogui
|
||||
|
||||
debug: clean all run
|
||||
|
||||
package:
|
||||
ps2-packer $(EE_BIN) $(TARGET_RELEASE)
|
||||
@@ -115,9 +113,4 @@ release: clean all package
|
||||
|
||||
#Include preferences
|
||||
include $(PS2SDK)/samples/Makefile.pref
|
||||
include $(PS2SDK)/samples/Makefile.eeglobal
|
||||
|
||||
#Linking with C++
|
||||
$(EE_BIN): $(EE_OBJS) $(PS2SDK)/ee/startup/crt0.o
|
||||
$(EE_CXX) $(EE_NO_CRT) -T$(PS2SDK)/ee/startup/linkfile $(EE_CXXFLAGS) \
|
||||
-o $(EE_BIN) $(PS2SDK)/ee/startup/crt0.o $(CRTI_OBJ) $(CRTBEGIN_OBJ) $(EE_OBJS) $(CRTEND_OBJ) $(CRTN_OBJ) $(EE_LDFLAGS) $(EE_LIBS)
|
||||
include $(PS2SDK)/samples/Makefile.eeglobal_cpp
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <boolean.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
@@ -96,13 +97,13 @@ static void shutdown_cb(void *data)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int parse_ports(const char *audio_device,
|
||||
char **dest_ports, const char **jports)
|
||||
static int parse_ports(char **dest_ports, const char **jports)
|
||||
{
|
||||
int i;
|
||||
char *save = NULL;
|
||||
int parsed = 0;
|
||||
char *audio_device_cpy = strdup(audio_device);
|
||||
settings_t *settings = config_get_ptr();
|
||||
char *audio_device_cpy = strdup(settings->arrays.audio_device);
|
||||
const char *con = strtok_r(audio_device_cpy, ",", &save);
|
||||
|
||||
if (con)
|
||||
@@ -203,7 +204,7 @@ static void *ja_init(const char *device,
|
||||
}
|
||||
}
|
||||
|
||||
parsed = parse_ports(device, dest_ports, jports);
|
||||
parsed = parse_ports(dest_ports, jports);
|
||||
|
||||
if (jack_activate(jd->client) < 0)
|
||||
{
|
||||
|
||||
@@ -105,8 +105,11 @@ static bool ra_alive(void *data)
|
||||
static void ra_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
roar_t *roar = (roar_t*)data;
|
||||
|
||||
if (roar_vs_blocking(roar->vss, (state) ? ROAR_VS_FALSE : ROAR_VS_TRUE, NULL) < 0)
|
||||
fprintf(stderr, "RetroArch [ERROR]: Can't set nonblocking. Will not be able to fast-forward.\n");
|
||||
{
|
||||
RARCH_ERR("Can't set nonblocking. Will not be able to fast-forward.\n");
|
||||
}
|
||||
roar->nonblocking = state;
|
||||
}
|
||||
|
||||
|
||||
@@ -1525,7 +1525,7 @@ static struct pcm_params *pcm_params_get(unsigned int card, unsigned int device,
|
||||
fd = open(fn, O_RDWR|O_NONBLOCK);
|
||||
if (fd < 0)
|
||||
{
|
||||
fprintf(stderr, "cannot open device '%s'\n", fn);
|
||||
RARCH_ERR("[TINYALSA] Cannot open device '%s'\n", fn);
|
||||
goto err_open;
|
||||
}
|
||||
|
||||
@@ -1538,7 +1538,7 @@ static struct pcm_params *pcm_params_get(unsigned int card, unsigned int device,
|
||||
param_init(params);
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_HW_REFINE, params))
|
||||
{
|
||||
fprintf(stderr, "SNDRV_PCM_IOCTL_HW_REFINE error (%d)\n", errno);
|
||||
RARCH_ERR("[TINYALSA] SNDRV_PCM_IOCTL_HW_REFINE error (%d)\n", errno);
|
||||
goto err_hw_refine;
|
||||
}
|
||||
|
||||
@@ -2019,7 +2019,7 @@ static int pcm_mmap_transfer(struct pcm *pcm, const void *buffer, unsigned int b
|
||||
avail = pcm_avail_update(pcm);
|
||||
if (avail < 0)
|
||||
{
|
||||
fprintf(stderr, "cannot determine available mmap frames");
|
||||
RARCH_ERR("[TINYALSA] Cannot determine available mmap frames");
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -2029,7 +2029,7 @@ static int pcm_mmap_transfer(struct pcm *pcm, const void *buffer, unsigned int b
|
||||
{
|
||||
if (pcm_start(pcm) < 0)
|
||||
{
|
||||
fprintf(stderr, "start error: hw 0x%x app 0x%x avail 0x%x\n",
|
||||
RARCH_ERR("[TINYALSA] Start error: hw 0x%x app 0x%x avail 0x%x\n",
|
||||
(unsigned int)pcm->mmap_status->hw_ptr,
|
||||
(unsigned int)pcm->mmap_control->appl_ptr,
|
||||
avail);
|
||||
@@ -2052,7 +2052,7 @@ static int pcm_mmap_transfer(struct pcm *pcm, const void *buffer, unsigned int b
|
||||
{
|
||||
pcm->prepared = 0;
|
||||
pcm->running = 0;
|
||||
fprintf(stderr, "wait error: hw 0x%x app 0x%x avail 0x%x\n",
|
||||
RARCH_ERR("[TINYALSA] Wait error: hw 0x%x app 0x%x avail 0x%x\n",
|
||||
(unsigned int)pcm->mmap_status->hw_ptr,
|
||||
(unsigned int)pcm->mmap_control->appl_ptr,
|
||||
avail);
|
||||
@@ -2073,7 +2073,7 @@ static int pcm_mmap_transfer(struct pcm *pcm, const void *buffer, unsigned int b
|
||||
frames = pcm_mmap_transfer_areas(pcm, (void *)buffer, offset, frames);
|
||||
if (frames < 0)
|
||||
{
|
||||
fprintf(stderr, "write error: hw 0x%x app 0x%x avail 0x%x\n",
|
||||
RARCH_ERR("[TINYALSA] Write error: hw 0x%x app 0x%x avail 0x%x\n",
|
||||
(unsigned int)pcm->mmap_status->hw_ptr,
|
||||
(unsigned int)pcm->mmap_control->appl_ptr,
|
||||
avail);
|
||||
|
||||
@@ -402,7 +402,7 @@ static bool v4l_poll(void *data,
|
||||
|
||||
if (preprocess_image(data))
|
||||
{
|
||||
if (frame_raw_cb != NULL)
|
||||
if (frame_raw_cb)
|
||||
frame_raw_cb(v4l->buffer_output, v4l->width,
|
||||
v4l->height, v4l->width * 4);
|
||||
return true;
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -47,7 +47,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DISCORD
|
||||
#include "../discord/discord.h"
|
||||
#include "../network/discord.h"
|
||||
#endif
|
||||
|
||||
#include "badges.h"
|
||||
@@ -207,8 +207,6 @@ bool rcheevos_loaded = false;
|
||||
bool rcheevos_hardcore_active = false;
|
||||
bool rcheevos_hardcore_paused = false;
|
||||
bool rcheevos_state_loaded_flag = false;
|
||||
int rcheevos_cheats_are_enabled = 0;
|
||||
int rcheevos_cheats_were_enabled = 0;
|
||||
char rcheevos_user_agent_prefix[128] = "";
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
@@ -1269,12 +1267,9 @@ bool rcheevos_get_description(rcheevos_ctx_desc_t* desc)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rcheevos_apply_cheats(bool* data_bool)
|
||||
void rcheevos_pause_hardcore()
|
||||
{
|
||||
rcheevos_cheats_are_enabled = *data_bool;
|
||||
rcheevos_cheats_were_enabled |= rcheevos_cheats_are_enabled;
|
||||
|
||||
return true;
|
||||
rcheevos_hardcore_paused = true;
|
||||
}
|
||||
|
||||
bool rcheevos_unload(void)
|
||||
@@ -1398,12 +1393,6 @@ void rcheevos_test(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool rcheevos_set_cheats(void)
|
||||
{
|
||||
rcheevos_cheats_were_enabled = rcheevos_cheats_are_enabled;
|
||||
return true;
|
||||
}
|
||||
|
||||
void rcheevos_set_support_cheevos(bool state)
|
||||
{
|
||||
rcheevos_locals.core_supports = state;
|
||||
@@ -49,7 +49,7 @@ void rcheevos_get_achievement_state(unsigned index, char* buffer, size_t buffer_
|
||||
|
||||
bool rcheevos_get_description(rcheevos_ctx_desc_t *desc);
|
||||
|
||||
bool rcheevos_apply_cheats(bool *data_bool);
|
||||
void rcheevos_pause_hardcore();
|
||||
|
||||
bool rcheevos_unload(void);
|
||||
|
||||
@@ -57,8 +57,6 @@ bool rcheevos_toggle_hardcore_mode(void);
|
||||
|
||||
void rcheevos_test(void);
|
||||
|
||||
bool rcheevos_set_cheats(void);
|
||||
|
||||
void rcheevos_set_support_cheevos(bool state);
|
||||
|
||||
bool rcheevos_get_support_cheevos(void);
|
||||
@@ -73,8 +71,6 @@ extern bool rcheevos_loaded;
|
||||
extern bool rcheevos_hardcore_active;
|
||||
extern bool rcheevos_hardcore_paused;
|
||||
extern bool rcheevos_state_loaded_flag;
|
||||
extern int rcheevos_cheats_are_enabled;
|
||||
extern int rcheevos_cheats_were_enabled;
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+16
-3
@@ -413,6 +413,7 @@
|
||||
#define DEFAULT_OZONE_COLOR_THEME 1
|
||||
#define DEFAULT_OZONE_COLLAPSE_SIDEBAR false
|
||||
#define DEFAULT_OZONE_TRUNCATE_PLAYLIST_NAME true
|
||||
#define DEFAULT_OZONE_SORT_AFTER_TRUNCATE_PLAYLIST_NAME true
|
||||
#define DEFAULT_OZONE_SCROLL_CONTENT_METADATA false
|
||||
#endif
|
||||
|
||||
@@ -921,7 +922,11 @@ static const bool savestate_thumbnail_enable = false;
|
||||
|
||||
/* When creating save (srm) files, compress
|
||||
* written data */
|
||||
#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
||||
#define DEFAULT_SAVE_FILE_COMPRESSION true
|
||||
#else
|
||||
#define DEFAULT_SAVE_FILE_COMPRESSION false
|
||||
#endif
|
||||
|
||||
/* When creating save state files, compress
|
||||
* written data */
|
||||
@@ -952,10 +957,13 @@ static const bool stdin_cmd_enable = false;
|
||||
|
||||
static const uint16_t network_remote_base_port = 55400;
|
||||
|
||||
#define DEFAULT_NETWORK_BUILDBOT_AUTO_EXTRACT_ARCHIVE true
|
||||
#define DEFAULT_NETWORK_BUILDBOT_SHOW_EXPERIMENTAL_CORES false
|
||||
|
||||
#if defined(ANDROID) || defined(IOS)
|
||||
static const bool network_on_demand_thumbnails = true;
|
||||
#define DEFAULT_NETWORK_ON_DEMAND_THUMBNAILS true
|
||||
#else
|
||||
static const bool network_on_demand_thumbnails = false;
|
||||
#define DEFAULT_NETWORK_ON_DEMAND_THUMBNAILS false
|
||||
#endif
|
||||
|
||||
/* Number of entries that will be kept in content history playlist file. */
|
||||
@@ -972,7 +980,11 @@ static const int default_content_favorites_size = 200;
|
||||
#define DEFAULT_PLAYLIST_USE_OLD_FORMAT false
|
||||
|
||||
/* When creating/updating playlists, compress written data */
|
||||
#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
||||
#define DEFAULT_PLAYLIST_COMPRESSION true
|
||||
#else
|
||||
#define DEFAULT_PLAYLIST_COMPRESSION false
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
/* Specify when to display 'core name' inline on playlist entries */
|
||||
@@ -1070,7 +1082,8 @@ static const unsigned menu_left_thumbnails_default = 0;
|
||||
static const unsigned gfx_thumbnail_upscale_threshold = 0;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
static const unsigned menu_timedate_style = MENU_TIMEDATE_STYLE_DDMM_HM;
|
||||
#define DEFAULT_MENU_TIMEDATE_STYLE MENU_TIMEDATE_STYLE_DDMM_HM
|
||||
#define DEFAULT_MENU_TIMEDATE_DATE_SEPARATOR MENU_TIMEDATE_DATE_SEPARATOR_HYPHEN
|
||||
#endif
|
||||
|
||||
static const bool xmb_vertical_thumbnails = false;
|
||||
|
||||
+6
-3
@@ -1369,7 +1369,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("netplay_request_device_p14", &settings->bools.netplay_request_devices[13], true, false, false);
|
||||
SETTING_BOOL("netplay_request_device_p15", &settings->bools.netplay_request_devices[14], true, false, false);
|
||||
SETTING_BOOL("netplay_request_device_p16", &settings->bools.netplay_request_devices[15], true, false, false);
|
||||
SETTING_BOOL("network_on_demand_thumbnails", &settings->bools.network_on_demand_thumbnails, true, network_on_demand_thumbnails, false);
|
||||
SETTING_BOOL("network_on_demand_thumbnails", &settings->bools.network_on_demand_thumbnails, true, DEFAULT_NETWORK_ON_DEMAND_THUMBNAILS, false);
|
||||
#endif
|
||||
SETTING_BOOL("input_descriptor_label_show", &settings->bools.input_descriptor_label_show, true, input_descriptor_label_show, false);
|
||||
SETTING_BOOL("input_descriptor_hide_unbound", &settings->bools.input_descriptor_hide_unbound, true, input_descriptor_hide_unbound, false);
|
||||
@@ -1435,7 +1435,8 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("audio_fastforward_mute", &settings->bools.audio_fastforward_mute, true, DEFAULT_AUDIO_FASTFORWARD_MUTE, false);
|
||||
SETTING_BOOL("location_allow", &settings->bools.location_allow, true, false, false);
|
||||
SETTING_BOOL("video_font_enable", &settings->bools.video_font_enable, true, DEFAULT_FONT_ENABLE, false);
|
||||
SETTING_BOOL("core_updater_auto_extract_archive", &settings->bools.network_buildbot_auto_extract_archive, true, true, false);
|
||||
SETTING_BOOL("core_updater_auto_extract_archive", &settings->bools.network_buildbot_auto_extract_archive, true, DEFAULT_NETWORK_BUILDBOT_AUTO_EXTRACT_ARCHIVE, false);
|
||||
SETTING_BOOL("core_updater_show_experimental_cores", &settings->bools.network_buildbot_show_experimental_cores, true, DEFAULT_NETWORK_BUILDBOT_SHOW_EXPERIMENTAL_CORES, false);
|
||||
SETTING_BOOL("camera_allow", &settings->bools.camera_allow, true, false, false);
|
||||
SETTING_BOOL("discord_allow", &settings->bools.discord_enable, true, false, false);
|
||||
#if defined(VITA)
|
||||
@@ -1667,6 +1668,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
#ifdef HAVE_OZONE
|
||||
SETTING_BOOL("ozone_collapse_sidebar", &settings->bools.ozone_collapse_sidebar, true, DEFAULT_OZONE_COLLAPSE_SIDEBAR, false);
|
||||
SETTING_BOOL("ozone_truncate_playlist_name", &settings->bools.ozone_truncate_playlist_name, true, DEFAULT_OZONE_TRUNCATE_PLAYLIST_NAME, false);
|
||||
SETTING_BOOL("ozone_sort_after_truncate_playlist_name", &settings->bools.ozone_sort_after_truncate_playlist_name, true, DEFAULT_OZONE_SORT_AFTER_TRUNCATE_PLAYLIST_NAME, false);
|
||||
SETTING_BOOL("ozone_scroll_content_metadata",&settings->bools.ozone_scroll_content_metadata, true, DEFAULT_OZONE_SCROLL_CONTENT_METADATA, false);
|
||||
#endif
|
||||
SETTING_BOOL("log_to_file", &settings->bools.log_to_file, true, DEFAULT_LOG_TO_FILE, false);
|
||||
@@ -1791,7 +1793,8 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
|
||||
SETTING_UINT("menu_thumbnails", &settings->uints.gfx_thumbnails, true, gfx_thumbnails_default, false);
|
||||
SETTING_UINT("menu_left_thumbnails", &settings->uints.menu_left_thumbnails, true, menu_left_thumbnails_default, false);
|
||||
SETTING_UINT("menu_thumbnail_upscale_threshold", &settings->uints.gfx_thumbnail_upscale_threshold, true, gfx_thumbnail_upscale_threshold, false);
|
||||
SETTING_UINT("menu_timedate_style", &settings->uints.menu_timedate_style, true, menu_timedate_style, false);
|
||||
SETTING_UINT("menu_timedate_style", &settings->uints.menu_timedate_style, true, DEFAULT_MENU_TIMEDATE_STYLE, false);
|
||||
SETTING_UINT("menu_timedate_date_separator", &settings->uints.menu_timedate_date_separator, true, DEFAULT_MENU_TIMEDATE_DATE_SEPARATOR, false);
|
||||
SETTING_UINT("menu_ticker_type", &settings->uints.menu_ticker_type, true, DEFAULT_MENU_TICKER_TYPE, false);
|
||||
#ifdef HAVE_RGUI
|
||||
SETTING_UINT("rgui_menu_color_theme", &settings->uints.menu_rgui_color_theme, true, DEFAULT_RGUI_COLOR_THEME, false);
|
||||
|
||||
@@ -285,6 +285,7 @@ typedef struct settings
|
||||
|
||||
/* Network */
|
||||
bool network_buildbot_auto_extract_archive;
|
||||
bool network_buildbot_show_experimental_cores;
|
||||
bool network_on_demand_thumbnails;
|
||||
|
||||
/* UI */
|
||||
@@ -394,6 +395,7 @@ typedef struct settings
|
||||
bool enable_device_vibration;
|
||||
bool ozone_collapse_sidebar;
|
||||
bool ozone_truncate_playlist_name;
|
||||
bool ozone_sort_after_truncate_playlist_name;
|
||||
bool ozone_scroll_content_metadata;
|
||||
|
||||
bool log_to_file;
|
||||
@@ -545,6 +547,7 @@ typedef struct settings
|
||||
unsigned accessibility_narrator_speech_speed;
|
||||
|
||||
unsigned menu_timedate_style;
|
||||
unsigned menu_timedate_date_separator;
|
||||
unsigned gfx_thumbnails;
|
||||
unsigned menu_left_thumbnails;
|
||||
unsigned gfx_thumbnail_upscale_threshold;
|
||||
|
||||
+108
-1
@@ -189,6 +189,7 @@ static void core_info_list_free(core_info_list_t *core_info_list)
|
||||
free(info->databases);
|
||||
free(info->notes);
|
||||
free(info->required_hw_api);
|
||||
free(info->description);
|
||||
string_list_free(info->supported_extensions_list);
|
||||
string_list_free(info->authors_list);
|
||||
string_list_free(info->note_list);
|
||||
@@ -232,7 +233,7 @@ static config_file_t *core_info_list_iterate(
|
||||
current_path,
|
||||
info_path_base_size);
|
||||
|
||||
#if defined(RARCH_MOBILE) || (defined(RARCH_CONSOLE) && !defined(PSP) && !defined(_3DS) && !defined(VITA) && !defined(PS2) && !defined(HW_WUP))
|
||||
#if defined(RARCH_MOBILE) || (defined(RARCH_CONSOLE) && !defined(PSP) && !defined(_3DS) && !defined(VITA) && !defined(HW_WUP))
|
||||
{
|
||||
char *substr = strrchr(info_path_base, '_');
|
||||
if (substr)
|
||||
@@ -471,6 +472,14 @@ static core_info_list_t *core_info_list_new(const char *path,
|
||||
tmp = NULL;
|
||||
}
|
||||
|
||||
if (config_get_string(conf, "description", &tmp))
|
||||
{
|
||||
if (!string_is_empty(tmp))
|
||||
core_info[i].description = strdup(tmp);
|
||||
free(tmp);
|
||||
tmp = NULL;
|
||||
}
|
||||
|
||||
if (tmp)
|
||||
free(tmp);
|
||||
tmp = NULL;
|
||||
@@ -484,6 +493,10 @@ static core_info_list_t *core_info_list_new(const char *path,
|
||||
if (config_get_bool(conf, "database_match_archive_member",
|
||||
&tmp_bool))
|
||||
core_info[i].database_match_archive_member = tmp_bool;
|
||||
|
||||
if (config_get_bool(conf, "is_experimental",
|
||||
&tmp_bool))
|
||||
core_info[i].is_experimental = tmp_bool;
|
||||
}
|
||||
|
||||
core_info[i].config_data = conf;
|
||||
@@ -1003,6 +1016,100 @@ bool core_info_get_display_name(const char *path, char *s, size_t len)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Returns core_info parameters required for
|
||||
* core updater tasks, read from specified file.
|
||||
* Returned core_updater_info_t object must be
|
||||
* freed using core_info_free_core_updater_info().
|
||||
* Returns NULL if 'path' is invalid. */
|
||||
core_updater_info_t *core_info_get_core_updater_info(const char *path)
|
||||
{
|
||||
char *tmp_str = NULL;
|
||||
bool tmp_bool = false;
|
||||
core_updater_info_t *info = NULL;
|
||||
config_file_t *conf = NULL;
|
||||
|
||||
if (string_is_empty(path))
|
||||
return NULL;
|
||||
|
||||
/* Read config file */
|
||||
conf = config_file_new_from_path_to_string(path);
|
||||
|
||||
if (!conf)
|
||||
return NULL;
|
||||
|
||||
/* Create info struct */
|
||||
info = (core_updater_info_t*)calloc(1, sizeof(*info));
|
||||
|
||||
if (!info)
|
||||
return NULL;
|
||||
|
||||
/* Fetch required parameters */
|
||||
|
||||
/* > is_experimental */
|
||||
info->is_experimental = false;
|
||||
if (config_get_bool(conf, "is_experimental", &tmp_bool))
|
||||
info->is_experimental = tmp_bool;
|
||||
|
||||
/* > display_name */
|
||||
info->display_name = NULL;
|
||||
if (config_get_string(conf, "display_name", &tmp_str))
|
||||
{
|
||||
if (!string_is_empty(tmp_str))
|
||||
info->display_name = tmp_str;
|
||||
else
|
||||
free(tmp_str);
|
||||
|
||||
tmp_str = NULL;
|
||||
}
|
||||
|
||||
/* > description */
|
||||
info->description = NULL;
|
||||
if (config_get_string(conf, "description", &tmp_str))
|
||||
{
|
||||
if (!string_is_empty(tmp_str))
|
||||
info->description = tmp_str;
|
||||
else
|
||||
free(tmp_str);
|
||||
|
||||
tmp_str = NULL;
|
||||
}
|
||||
|
||||
/* > licenses */
|
||||
info->licenses = NULL;
|
||||
if (config_get_string(conf, "license", &tmp_str))
|
||||
{
|
||||
if (!string_is_empty(tmp_str))
|
||||
info->licenses = tmp_str;
|
||||
else
|
||||
free(tmp_str);
|
||||
|
||||
tmp_str = NULL;
|
||||
}
|
||||
|
||||
/* Clean up */
|
||||
config_file_free(conf);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
void core_info_free_core_updater_info(core_updater_info_t *info)
|
||||
{
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
if (info->display_name)
|
||||
free(info->display_name);
|
||||
|
||||
if (info->description)
|
||||
free(info->description);
|
||||
|
||||
if (info->licenses)
|
||||
free(info->licenses);
|
||||
|
||||
free(info);
|
||||
info = NULL;
|
||||
}
|
||||
|
||||
static int core_info_qsort_func_path(const core_info_t *a,
|
||||
const core_info_t *b)
|
||||
{
|
||||
|
||||
+20
@@ -39,6 +39,7 @@ typedef struct
|
||||
{
|
||||
bool supports_no_game;
|
||||
bool database_match_archive_member;
|
||||
bool is_experimental;
|
||||
size_t firmware_count;
|
||||
char *path;
|
||||
void *config_data;
|
||||
@@ -56,6 +57,7 @@ typedef struct
|
||||
char *databases;
|
||||
char *notes;
|
||||
char *required_hw_api;
|
||||
char *description;
|
||||
struct string_list *categories_list;
|
||||
struct string_list *databases_list;
|
||||
struct string_list *note_list;
|
||||
@@ -68,6 +70,16 @@ typedef struct
|
||||
void *userdata;
|
||||
} core_info_t;
|
||||
|
||||
/* A subset of core_info parameters required for
|
||||
* core updater tasks */
|
||||
typedef struct
|
||||
{
|
||||
bool is_experimental;
|
||||
char *display_name;
|
||||
char *description;
|
||||
char *licenses;
|
||||
} core_updater_info_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
core_info_t *list;
|
||||
@@ -109,6 +121,14 @@ bool core_info_list_get_display_name(core_info_list_t *list,
|
||||
|
||||
bool core_info_get_display_name(const char *path, char *s, size_t len);
|
||||
|
||||
/* Returns core_info parameters required for
|
||||
* core updater tasks, read from specified file.
|
||||
* Returned core_updater_info_t object must be
|
||||
* freed using core_info_free_core_updater_info().
|
||||
* Returns NULL if 'path' is invalid. */
|
||||
core_updater_info_t *core_info_get_core_updater_info(const char *path);
|
||||
void core_info_free_core_updater_info(core_updater_info_t *info);
|
||||
|
||||
void core_info_get_name(const char *path, char *s, size_t len,
|
||||
const char *path_info, const char *dir_cores,
|
||||
const char *exts, bool show_hidden_files,
|
||||
|
||||
+104
-18
@@ -82,6 +82,18 @@ static void core_updater_list_free_entry(core_updater_list_entry_t *entry)
|
||||
free(entry->display_name);
|
||||
entry->display_name = NULL;
|
||||
}
|
||||
|
||||
if (entry->description)
|
||||
{
|
||||
free(entry->description);
|
||||
entry->description = NULL;
|
||||
}
|
||||
|
||||
if (entry->licenses_list)
|
||||
{
|
||||
string_list_free(entry->licenses_list);
|
||||
entry->licenses_list = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Creates a new, empty core updater list.
|
||||
@@ -410,13 +422,11 @@ static bool core_updater_list_set_paths(
|
||||
char remote_core_path[PATH_MAX_LENGTH];
|
||||
char local_core_path[PATH_MAX_LENGTH];
|
||||
char local_info_path[PATH_MAX_LENGTH];
|
||||
char display_name[255];
|
||||
bool is_archive;
|
||||
|
||||
remote_core_path[0] = '\0';
|
||||
local_core_path[0] = '\0';
|
||||
local_info_path[0] = '\0';
|
||||
display_name[0] = '\0';
|
||||
|
||||
if (!entry || string_is_empty(filename_str))
|
||||
return false;
|
||||
@@ -518,29 +528,94 @@ static bool core_updater_list_set_paths(
|
||||
|
||||
entry->local_info_path = strdup(local_info_path);
|
||||
|
||||
/* display_name
|
||||
* > Note: It's a bit rubbish that we have to
|
||||
* read the actual core info files here...
|
||||
* Would be better to cache this globally
|
||||
* (at present, we only cache info for
|
||||
* *installed* cores...) */
|
||||
if (path_is_valid(local_info_path))
|
||||
if (!core_info_get_display_name(
|
||||
local_info_path, display_name, sizeof(display_name)))
|
||||
display_name[0] = '\0';
|
||||
return true;
|
||||
}
|
||||
|
||||
/* > If info file does not exist, just use
|
||||
* core filename */
|
||||
if (string_is_empty(display_name))
|
||||
strlcpy(display_name, filename_str, sizeof(display_name));
|
||||
/* Reads info file associated with core and
|
||||
* adds relevant information to updater list
|
||||
* entry */
|
||||
static bool core_updater_list_set_core_info(
|
||||
core_updater_list_entry_t *entry,
|
||||
const char *local_info_path,
|
||||
const char *filename_str)
|
||||
{
|
||||
core_updater_info_t *core_info = NULL;
|
||||
|
||||
if (!entry ||
|
||||
string_is_empty(local_info_path) ||
|
||||
string_is_empty(filename_str))
|
||||
return false;
|
||||
|
||||
/* Clear any existing core info */
|
||||
if (entry->display_name)
|
||||
{
|
||||
free(entry->display_name);
|
||||
entry->display_name = NULL;
|
||||
}
|
||||
|
||||
entry->display_name = strdup(display_name);
|
||||
if (entry->description)
|
||||
{
|
||||
free(entry->description);
|
||||
entry->description = NULL;
|
||||
}
|
||||
|
||||
if (entry->licenses_list)
|
||||
{
|
||||
/* Note: We can safely leave this as NULL if
|
||||
* the core info file is invalid */
|
||||
string_list_free(entry->licenses_list);
|
||||
entry->licenses_list = NULL;
|
||||
}
|
||||
|
||||
entry->is_experimental = false;
|
||||
|
||||
/* Read core info file
|
||||
* > Note: It's a bit rubbish that we have to
|
||||
* read the actual core info files here...
|
||||
* Would be better to cache this globally
|
||||
* (at present, we only cache info for
|
||||
* *installed* cores...) */
|
||||
core_info = core_info_get_core_updater_info(local_info_path);
|
||||
|
||||
if (core_info)
|
||||
{
|
||||
/* display_name + is_experimental */
|
||||
if (!string_is_empty(core_info->display_name))
|
||||
{
|
||||
entry->display_name = strdup(core_info->display_name);
|
||||
entry->is_experimental = core_info->is_experimental;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If display name is blank, use core filename and
|
||||
* assume core is experimental (i.e. all 'fit for consumption'
|
||||
* cores must have a valid/complete core info file) */
|
||||
entry->display_name = strdup(filename_str);
|
||||
entry->is_experimental = true;
|
||||
}
|
||||
|
||||
/* description */
|
||||
if (!string_is_empty(core_info->description))
|
||||
entry->description = strdup(core_info->description);
|
||||
else
|
||||
entry->description = strdup("");
|
||||
|
||||
/* licenses_list */
|
||||
if (!string_is_empty(core_info->licenses))
|
||||
entry->licenses_list = string_split(core_info->licenses, "|");
|
||||
|
||||
/* Clean up */
|
||||
core_info_free_core_updater_info(core_info);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If info file is missing, use core filename and
|
||||
* assume core is experimental (i.e. all 'fit for consumption'
|
||||
* cores must have a valid/complete core info file) */
|
||||
entry->display_name = strdup(filename_str);
|
||||
entry->is_experimental = true;
|
||||
entry->description = strdup("");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -576,10 +651,15 @@ static bool core_updater_list_push_entry(
|
||||
list_entry->remote_core_path = entry->remote_core_path;
|
||||
list_entry->local_core_path = entry->local_core_path;
|
||||
list_entry->local_info_path = entry->local_info_path;
|
||||
|
||||
/* Assign core info */
|
||||
list_entry->display_name = entry->display_name;
|
||||
list_entry->description = entry->description;
|
||||
list_entry->licenses_list = entry->licenses_list;
|
||||
list_entry->is_experimental = entry->is_experimental;
|
||||
|
||||
/* Copy crc */
|
||||
list_entry->crc = entry->crc;
|
||||
list_entry->crc = entry->crc;
|
||||
|
||||
/* Copy date */
|
||||
memcpy(&list_entry->date, &entry->date, sizeof(core_updater_list_date_t));
|
||||
@@ -644,6 +724,12 @@ static void core_updater_list_add_entry(
|
||||
filename_str))
|
||||
goto error;
|
||||
|
||||
if (!core_updater_list_set_core_info(
|
||||
&entry,
|
||||
entry.local_info_path,
|
||||
filename_str))
|
||||
goto error;
|
||||
|
||||
/* Add entry to list */
|
||||
if (!core_updater_list_push_entry(core_list, &entry))
|
||||
goto error;
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include <retro_common_api.h>
|
||||
#include <libretro.h>
|
||||
|
||||
#include <lists/string_list.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
@@ -52,6 +54,9 @@ typedef struct
|
||||
char *local_core_path;
|
||||
char *local_info_path;
|
||||
char *display_name;
|
||||
char *description;
|
||||
struct string_list *licenses_list;
|
||||
bool is_experimental;
|
||||
uint32_t crc;
|
||||
core_updater_list_date_t date;
|
||||
} core_updater_list_entry_t;
|
||||
|
||||
+6
-5
@@ -1,14 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#define DISCORD_EXPORT
|
||||
#include <retro_common_api.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if defined(__cplusplus) && !defined(CXX_BUILD)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
DISCORD_EXPORT void Discord_Register(const char* applicationId, const char* command);
|
||||
DISCORD_EXPORT void Discord_RegisterSteamGame(const char* applicationId, const char* steamId);
|
||||
int get_process_id(void);
|
||||
void Discord_Register(const char* applicationId, const char* command);
|
||||
void Discord_RegisterSteamGame(const char* applicationId, const char* steamId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if defined(__cplusplus) && !defined(CXX_BUILD)
|
||||
}
|
||||
#endif
|
||||
+11
-17
@@ -1,12 +1,6 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
# define DISCORD_EXPORT
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -52,28 +46,28 @@ typedef struct DiscordEventHandlers
|
||||
#define DISCORD_REPLY_YES 1
|
||||
#define DISCORD_REPLY_IGNORE 2
|
||||
|
||||
DISCORD_EXPORT void Discord_Initialize(const char* applicationId,
|
||||
DiscordEventHandlers* handlers,
|
||||
int autoRegister,
|
||||
const char* optionalSteamId);
|
||||
DISCORD_EXPORT void Discord_Shutdown(void);
|
||||
void Discord_Initialize(const char* applicationId,
|
||||
DiscordEventHandlers* handlers,
|
||||
int autoRegister,
|
||||
const char* optionalSteamId);
|
||||
void Discord_Shutdown(void);
|
||||
|
||||
/* checks for incoming messages, dispatches callbacks */
|
||||
DISCORD_EXPORT void Discord_RunCallbacks(void);
|
||||
void Discord_RunCallbacks(void);
|
||||
|
||||
/* If you disable the lib starting its own I/O thread,
|
||||
* you'll need to call this from your own */
|
||||
#ifdef DISCORD_DISABLE_IO_THREAD
|
||||
DISCORD_EXPORT void Discord_UpdateConnection(void);
|
||||
void Discord_UpdateConnection(void);
|
||||
#endif
|
||||
|
||||
DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence);
|
||||
DISCORD_EXPORT void Discord_ClearPresence(void);
|
||||
void Discord_UpdatePresence(const DiscordRichPresence* presence);
|
||||
void Discord_ClearPresence(void);
|
||||
|
||||
DISCORD_EXPORT void Discord_Respond(const char* userid,
|
||||
void Discord_Respond(const char* userid,
|
||||
/* DISCORD_REPLY_ */ int reply);
|
||||
|
||||
DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers* handlers);
|
||||
void Discord_UpdateHandlers(DiscordEventHandlers* handlers);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
Vendored
+28
-27
@@ -5,36 +5,37 @@
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
struct Backoff {
|
||||
int64_t minAmount;
|
||||
int64_t maxAmount;
|
||||
int64_t current;
|
||||
int fails;
|
||||
std::mt19937_64 randGenerator;
|
||||
std::uniform_real_distribution<> randDistribution;
|
||||
struct Backoff
|
||||
{
|
||||
int64_t minAmount;
|
||||
int64_t maxAmount;
|
||||
int64_t current;
|
||||
int fails;
|
||||
std::mt19937_64 randGenerator;
|
||||
std::uniform_real_distribution<> randDistribution;
|
||||
|
||||
double rand01() { return randDistribution(randGenerator); }
|
||||
double rand01() { return randDistribution(randGenerator); }
|
||||
|
||||
Backoff(int64_t min, int64_t max)
|
||||
Backoff(int64_t min, int64_t max)
|
||||
: minAmount(min)
|
||||
, maxAmount(max)
|
||||
, current(min)
|
||||
, fails(0)
|
||||
, randGenerator((uint64_t)time(0))
|
||||
{
|
||||
}
|
||||
, maxAmount(max)
|
||||
, current(min)
|
||||
, fails(0)
|
||||
, randGenerator((uint64_t)time(0))
|
||||
{
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
fails = 0;
|
||||
current = minAmount;
|
||||
}
|
||||
void reset()
|
||||
{
|
||||
fails = 0;
|
||||
current = minAmount;
|
||||
}
|
||||
|
||||
int64_t nextDelay()
|
||||
{
|
||||
++fails;
|
||||
int64_t delay = (int64_t)((double)current * 2.0 * rand01());
|
||||
current = std::min(current + delay, maxAmount);
|
||||
return current;
|
||||
}
|
||||
int64_t nextDelay()
|
||||
{
|
||||
++fails;
|
||||
int64_t delay = (int64_t)((double)current * 2.0 * rand01());
|
||||
current = std::min(current + delay, maxAmount);
|
||||
return current;
|
||||
}
|
||||
};
|
||||
Vendored
+9
-11
@@ -5,15 +5,13 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* not really connectiony, but need per-platform */
|
||||
int GetProcessId();
|
||||
|
||||
struct BaseConnection {
|
||||
static BaseConnection* Create();
|
||||
static void Destroy(BaseConnection*&);
|
||||
bool isOpen{false};
|
||||
bool Open();
|
||||
bool Close();
|
||||
bool Write(const void* data, size_t length);
|
||||
bool Read(void* data, size_t length);
|
||||
struct BaseConnection
|
||||
{
|
||||
static BaseConnection* Create();
|
||||
static void Destroy(BaseConnection*&);
|
||||
bool isOpen{false};
|
||||
bool Open();
|
||||
bool Close();
|
||||
bool Write(const void* data, size_t length);
|
||||
bool Read(void* data, size_t length);
|
||||
};
|
||||
-5
@@ -9,11 +9,6 @@
|
||||
#include <sys/un.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int GetProcessId()
|
||||
{
|
||||
return ::getpid();
|
||||
}
|
||||
|
||||
struct BaseConnectionUnix : public BaseConnection {
|
||||
int sock{-1};
|
||||
};
|
||||
|
||||
-5
@@ -6,11 +6,6 @@
|
||||
#define NOIME
|
||||
#include <windows.h>
|
||||
|
||||
int GetProcessId()
|
||||
{
|
||||
return (int)::GetCurrentProcessId();
|
||||
}
|
||||
|
||||
struct BaseConnectionWin : public BaseConnection
|
||||
{
|
||||
HANDLE pipe{INVALID_HANDLE_VALUE};
|
||||
|
||||
+12
-6
@@ -1,21 +1,29 @@
|
||||
#include "discord_rpc.h"
|
||||
#include "discord_register.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/un.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <file/file_path.h>
|
||||
#include <compat/strl.h>
|
||||
|
||||
#include <discord_rpc.h>
|
||||
|
||||
int get_process_id(void)
|
||||
{
|
||||
return getpid();
|
||||
}
|
||||
|
||||
/* we want to register games so we can run them from
|
||||
* Discord client as discord-<appid>:// */
|
||||
void Discord_Register(const char* applicationId, const char* command)
|
||||
void Discord_Register(const char *applicationId, const char *command)
|
||||
{
|
||||
FILE* fp;
|
||||
int fileLen;
|
||||
@@ -82,9 +90,7 @@ void Discord_Register(const char* applicationId, const char* command)
|
||||
fprintf(stderr, "Failed to register mime handler\n");
|
||||
}
|
||||
|
||||
void Discord_RegisterSteamGame(
|
||||
const char* applicationId,
|
||||
const char* steamId)
|
||||
void Discord_RegisterSteamGame(const char *applicationId, const char *steamId)
|
||||
{
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "xdg-open steam://rungameid/%s", steamId);
|
||||
|
||||
+40
-39
@@ -3,7 +3,10 @@
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
#include "../include/discord_register.h"
|
||||
int get_process_id(void)
|
||||
{
|
||||
return getpid();
|
||||
}
|
||||
|
||||
static void RegisterCommand(const char* applicationId, const char* command)
|
||||
{
|
||||
@@ -31,54 +34,52 @@ static void RegisterCommand(const char* applicationId, const char* command)
|
||||
|
||||
static void RegisterURL(const char* applicationId)
|
||||
{
|
||||
char url[256];
|
||||
snprintf(url, sizeof(url), "discord-%s", applicationId);
|
||||
CFStringRef cfURL = CFStringCreateWithCString(NULL, url, kCFStringEncodingUTF8);
|
||||
NSString* myBundleId = [[NSBundle mainBundle] bundleIdentifier];
|
||||
char url[256];
|
||||
snprintf(url, sizeof(url), "discord-%s", applicationId);
|
||||
CFStringRef cfURL = CFStringCreateWithCString(NULL, url, kCFStringEncodingUTF8);
|
||||
NSString* myBundleId = [[NSBundle mainBundle] bundleIdentifier];
|
||||
|
||||
if (!myBundleId)
|
||||
{
|
||||
fprintf(stderr, "No bundle id found\n");
|
||||
return;
|
||||
}
|
||||
if (!myBundleId)
|
||||
{
|
||||
fprintf(stderr, "No bundle id found\n");
|
||||
return;
|
||||
}
|
||||
|
||||
NSURL* myURL = [[NSBundle mainBundle] bundleURL];
|
||||
if (!myURL)
|
||||
{
|
||||
fprintf(stderr, "No bundle url found\n");
|
||||
return;
|
||||
}
|
||||
NSURL* myURL = [[NSBundle mainBundle] bundleURL];
|
||||
if (!myURL)
|
||||
{
|
||||
fprintf(stderr, "No bundle url found\n");
|
||||
return;
|
||||
}
|
||||
|
||||
OSStatus status = LSSetDefaultHandlerForURLScheme(cfURL, (__bridge CFStringRef)myBundleId);
|
||||
if (status != noErr)
|
||||
{
|
||||
fprintf(stderr, "Error in LSSetDefaultHandlerForURLScheme: %d\n", (int)status);
|
||||
return;
|
||||
}
|
||||
OSStatus status = LSSetDefaultHandlerForURLScheme(cfURL, (__bridge CFStringRef)myBundleId);
|
||||
if (status != noErr)
|
||||
{
|
||||
fprintf(stderr, "Error in LSSetDefaultHandlerForURLScheme: %d\n", (int)status);
|
||||
return;
|
||||
}
|
||||
|
||||
status = LSRegisterURL((__bridge CFURLRef)myURL, true);
|
||||
if (status != noErr)
|
||||
{
|
||||
fprintf(stderr, "Error in LSRegisterURL: %d\n", (int)status);
|
||||
}
|
||||
status = LSRegisterURL((__bridge CFURLRef)myURL, true);
|
||||
if (status != noErr)
|
||||
fprintf(stderr, "Error in LSRegisterURL: %d\n", (int)status);
|
||||
}
|
||||
|
||||
void Discord_Register(const char* applicationId, const char* command)
|
||||
{
|
||||
if (command)
|
||||
RegisterCommand(applicationId, command);
|
||||
else
|
||||
{
|
||||
/* RAII Lite */
|
||||
@autoreleasepool {
|
||||
RegisterURL(applicationId);
|
||||
}
|
||||
}
|
||||
if (command)
|
||||
RegisterCommand(applicationId, command);
|
||||
else
|
||||
{
|
||||
/* RAII Lite */
|
||||
@autoreleasepool {
|
||||
RegisterURL(applicationId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Discord_RegisterSteamGame(const char* applicationId, const char* steamId)
|
||||
{
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "steam://rungameid/%s", steamId);
|
||||
Discord_Register(applicationId, command);
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "steam://rungameid/%s", steamId);
|
||||
Discord_Register(applicationId, command);
|
||||
}
|
||||
+80
-75
@@ -1,5 +1,4 @@
|
||||
#include "discord_rpc.h"
|
||||
#include "discord_register.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMCX
|
||||
@@ -10,6 +9,11 @@
|
||||
#include <wchar.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int get_process_id(void)
|
||||
{
|
||||
return (int)GetCurrentProcessId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updated fixes for MinGW and WinXP
|
||||
* This block is written the way it does not involve changing the rest of the code
|
||||
@@ -53,99 +57,99 @@ static LSTATUS regset(HKEY hkey,
|
||||
const void* data,
|
||||
DWORD len)
|
||||
{
|
||||
HKEY htkey = hkey, hsubkey = NULL;
|
||||
LSTATUS ret;
|
||||
if (subkey && subkey[0])
|
||||
{
|
||||
if ((ret = RegCreateKeyExW(hkey, subkey, 0, 0, 0, KEY_ALL_ACCESS, 0, &hsubkey, 0)) !=
|
||||
LSTATUS ret;
|
||||
HKEY htkey = hkey, hsubkey = NULL;
|
||||
if (subkey && subkey[0])
|
||||
{
|
||||
if ((ret = RegCreateKeyExW(hkey, subkey, 0, 0, 0, KEY_ALL_ACCESS, 0, &hsubkey, 0)) !=
|
||||
ERROR_SUCCESS)
|
||||
return ret;
|
||||
htkey = hsubkey;
|
||||
}
|
||||
ret = RegSetValueExW(htkey, name, 0, type, (const BYTE*)data, len);
|
||||
if (hsubkey && hsubkey != hkey)
|
||||
RegCloseKey(hsubkey);
|
||||
return ret;
|
||||
return ret;
|
||||
htkey = hsubkey;
|
||||
}
|
||||
ret = RegSetValueExW(htkey, name, 0, type, (const BYTE*)data, len);
|
||||
if (hsubkey && hsubkey != hkey)
|
||||
RegCloseKey(hsubkey);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void Discord_RegisterW(
|
||||
const wchar_t* applicationId, const wchar_t* command)
|
||||
{
|
||||
/* https://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx
|
||||
* we want to register games so we can run them as discord-<appid>://
|
||||
* Update the HKEY_CURRENT_USER, because it doesn't seem to require special permissions. */
|
||||
/* https://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx
|
||||
* we want to register games so we can run them as discord-<appid>://
|
||||
* Update the HKEY_CURRENT_USER, because it doesn't seem to require special permissions. */
|
||||
|
||||
DWORD len;
|
||||
LSTATUS result;
|
||||
wchar_t urlProtocol = 0;
|
||||
wchar_t keyName[256];
|
||||
wchar_t protocolName[64];
|
||||
wchar_t protocolDescription[128];
|
||||
wchar_t exeFilePath[MAX_PATH];
|
||||
DWORD exeLen = GetModuleFileNameW(NULL, exeFilePath, MAX_PATH);
|
||||
wchar_t openCommand[1024];
|
||||
DWORD len;
|
||||
LSTATUS result;
|
||||
wchar_t urlProtocol = 0;
|
||||
wchar_t keyName[256];
|
||||
wchar_t protocolName[64];
|
||||
wchar_t protocolDescription[128];
|
||||
wchar_t exeFilePath[MAX_PATH];
|
||||
DWORD exeLen = GetModuleFileNameW(NULL, exeFilePath, MAX_PATH);
|
||||
wchar_t openCommand[1024];
|
||||
|
||||
if (command && command[0])
|
||||
StringCbPrintfW(openCommand, sizeof(openCommand), L"%S", command);
|
||||
else
|
||||
StringCbPrintfW(openCommand, sizeof(openCommand), L"%S", exeFilePath);
|
||||
if (command && command[0])
|
||||
StringCbPrintfW(openCommand, sizeof(openCommand), L"%S", command);
|
||||
else
|
||||
StringCbPrintfW(openCommand, sizeof(openCommand), L"%S", exeFilePath);
|
||||
|
||||
StringCbPrintfW(protocolName, sizeof(protocolName),
|
||||
L"discord-%S", applicationId);
|
||||
StringCbPrintfW(
|
||||
protocolDescription, sizeof(protocolDescription),
|
||||
L"URL:Run game %S protocol", applicationId);
|
||||
StringCbPrintfW(keyName, sizeof(keyName), L"Software\\Classes\\%S", protocolName);
|
||||
HKEY key;
|
||||
LSTATUS status =
|
||||
StringCbPrintfW(protocolName, sizeof(protocolName),
|
||||
L"discord-%S", applicationId);
|
||||
StringCbPrintfW(
|
||||
protocolDescription, sizeof(protocolDescription),
|
||||
L"URL:Run game %S protocol", applicationId);
|
||||
StringCbPrintfW(keyName, sizeof(keyName), L"Software\\Classes\\%S", protocolName);
|
||||
HKEY key;
|
||||
LSTATUS status =
|
||||
RegCreateKeyExW(HKEY_CURRENT_USER, keyName, 0, NULL, 0, KEY_WRITE, NULL, &key, NULL);
|
||||
if (status != ERROR_SUCCESS)
|
||||
{
|
||||
fprintf(stderr, "Error creating key\n");
|
||||
return;
|
||||
}
|
||||
len = (DWORD)lstrlenW(protocolDescription) + 1;
|
||||
result =
|
||||
if (status != ERROR_SUCCESS)
|
||||
{
|
||||
fprintf(stderr, "Error creating key\n");
|
||||
return;
|
||||
}
|
||||
len = (DWORD)lstrlenW(protocolDescription) + 1;
|
||||
result =
|
||||
RegSetKeyValueW(key, NULL, NULL, REG_SZ, protocolDescription, len * sizeof(wchar_t));
|
||||
if (FAILED(result)) {
|
||||
fprintf(stderr, "Error writing description\n");
|
||||
}
|
||||
if (FAILED(result))
|
||||
fprintf(stderr, "Error writing description\n");
|
||||
|
||||
len = (DWORD)lstrlenW(protocolDescription) + 1;
|
||||
result = RegSetKeyValueW(key, NULL, L"URL Protocol", REG_SZ, &urlProtocol, sizeof(wchar_t));
|
||||
if (FAILED(result))
|
||||
fprintf(stderr, "Error writing description\n");
|
||||
len = (DWORD)lstrlenW(protocolDescription) + 1;
|
||||
result = RegSetKeyValueW(key, NULL, L"URL Protocol", REG_SZ, &urlProtocol, sizeof(wchar_t));
|
||||
if (FAILED(result))
|
||||
fprintf(stderr, "Error writing description\n");
|
||||
|
||||
result = RegSetKeyValueW(
|
||||
key, L"DefaultIcon", NULL, REG_SZ, exeFilePath, (exeLen + 1) * sizeof(wchar_t));
|
||||
if (FAILED(result))
|
||||
fprintf(stderr, "Error writing icon\n");
|
||||
result = RegSetKeyValueW(
|
||||
key, L"DefaultIcon", NULL, REG_SZ, exeFilePath, (exeLen + 1) * sizeof(wchar_t));
|
||||
if (FAILED(result))
|
||||
fprintf(stderr, "Error writing icon\n");
|
||||
|
||||
len = (DWORD)lstrlenW(openCommand) + 1;
|
||||
result = RegSetKeyValueW(
|
||||
key, L"shell\\open\\command", NULL, REG_SZ, openCommand, len * sizeof(wchar_t));
|
||||
if (FAILED(result))
|
||||
fprintf(stderr, "Error writing command\n");
|
||||
RegCloseKey(key);
|
||||
len = (DWORD)lstrlenW(openCommand) + 1;
|
||||
result = RegSetKeyValueW(
|
||||
key, L"shell\\open\\command", NULL, REG_SZ, openCommand, len * sizeof(wchar_t));
|
||||
if (FAILED(result))
|
||||
fprintf(stderr, "Error writing command\n");
|
||||
RegCloseKey(key);
|
||||
}
|
||||
|
||||
void Discord_Register(const char* applicationId, const char* command)
|
||||
{
|
||||
wchar_t openCommand[1024];
|
||||
const wchar_t* wcommand = NULL;
|
||||
wchar_t appId[32];
|
||||
wchar_t appId[32];
|
||||
wchar_t openCommand[1024];
|
||||
const wchar_t* wcommand = NULL;
|
||||
|
||||
MultiByteToWideChar(CP_UTF8, 0, applicationId, -1, appId, 32);
|
||||
if (command && command[0])
|
||||
{
|
||||
const int commandBufferLen =
|
||||
sizeof(openCommand) / sizeof(*openCommand);
|
||||
MultiByteToWideChar(CP_UTF8, 0, command, -1,
|
||||
openCommand, commandBufferLen);
|
||||
wcommand = openCommand;
|
||||
}
|
||||
MultiByteToWideChar(CP_UTF8, 0, applicationId, -1, appId, 32);
|
||||
|
||||
Discord_RegisterW(appId, wcommand);
|
||||
if (command && command[0])
|
||||
{
|
||||
const int commandBufferLen =
|
||||
sizeof(openCommand) / sizeof(*openCommand);
|
||||
MultiByteToWideChar(CP_UTF8, 0, command, -1,
|
||||
openCommand, commandBufferLen);
|
||||
wcommand = openCommand;
|
||||
}
|
||||
|
||||
Discord_RegisterW(appId, wcommand);
|
||||
}
|
||||
|
||||
void Discord_RegisterSteamGame(
|
||||
@@ -172,7 +176,8 @@ void Discord_RegisterSteamGame(
|
||||
status = RegQueryValueExW(key,
|
||||
L"SteamExe", NULL, NULL, (BYTE*)steamPath, &pathBytes);
|
||||
RegCloseKey(key);
|
||||
if (status != ERROR_SUCCESS || pathBytes < 1) {
|
||||
if (status != ERROR_SUCCESS || pathBytes < 1)
|
||||
{
|
||||
fprintf(stderr, "Error reading SteamExe key\n");
|
||||
return;
|
||||
}
|
||||
|
||||
Vendored
+86
-83
@@ -1,7 +1,7 @@
|
||||
#include "discord_rpc.h"
|
||||
#include "discord_register.h"
|
||||
|
||||
#include "backoff.h"
|
||||
#include "discord_register.h"
|
||||
#include "msg_queue.h"
|
||||
#include "rpc_connection.h"
|
||||
#include "serialization.h"
|
||||
@@ -15,14 +15,10 @@
|
||||
#include <thread>
|
||||
#endif
|
||||
|
||||
constexpr size_t MaxMessageSize{16 * 1024};
|
||||
constexpr size_t MessageQueueSize{8};
|
||||
constexpr size_t JoinQueueSize{8};
|
||||
|
||||
struct QueuedMessage
|
||||
{
|
||||
size_t length;
|
||||
char buffer[MaxMessageSize];
|
||||
char buffer[16384];
|
||||
|
||||
void Copy(const QueuedMessage& other)
|
||||
{
|
||||
@@ -50,25 +46,32 @@ struct User
|
||||
* from future changes in these sizes */
|
||||
};
|
||||
|
||||
static int Pid{0};
|
||||
static int Nonce{1};
|
||||
static int LastErrorCode{0};
|
||||
static int LastDisconnectErrorCode{0};
|
||||
|
||||
static char JoinGameSecret[256];
|
||||
static char SpectateGameSecret[256];
|
||||
static char LastErrorMessage[256];
|
||||
static char LastDisconnectErrorMessage[256];
|
||||
|
||||
static RpcConnection* Connection{nullptr};
|
||||
|
||||
static DiscordEventHandlers QueuedHandlers{};
|
||||
static DiscordEventHandlers Handlers{};
|
||||
|
||||
static std::atomic_bool WasJustConnected{false};
|
||||
static std::atomic_bool WasJustDisconnected{false};
|
||||
static std::atomic_bool GotErrorMessage{false};
|
||||
static std::atomic_bool WasJoinGame{false};
|
||||
static std::atomic_bool WasSpectateGame{false};
|
||||
static char JoinGameSecret[256];
|
||||
static char SpectateGameSecret[256];
|
||||
static int LastErrorCode{0};
|
||||
static char LastErrorMessage[256];
|
||||
static int LastDisconnectErrorCode{0};
|
||||
static char LastDisconnectErrorMessage[256];
|
||||
|
||||
static std::mutex PresenceMutex;
|
||||
static std::mutex HandlerMutex;
|
||||
static QueuedMessage QueuedPresence{};
|
||||
static MsgQueue<QueuedMessage, MessageQueueSize> SendQueue;
|
||||
static MsgQueue<User, JoinQueueSize> JoinAskQueue;
|
||||
static MsgQueue<QueuedMessage, 8> SendQueue;
|
||||
static MsgQueue<User, 8> JoinAskQueue;
|
||||
static User connectedUser;
|
||||
|
||||
/* We want to auto connect, and retry on failure,
|
||||
@@ -76,64 +79,64 @@ static User connectedUser;
|
||||
* backoff from 0.5 seconds to 1 minute */
|
||||
static Backoff ReconnectTimeMs(500, 60 * 1000);
|
||||
static auto NextConnect = std::chrono::system_clock::now();
|
||||
static int Pid{0};
|
||||
static int Nonce{1};
|
||||
|
||||
#ifndef DISCORD_DISABLE_IO_THREAD
|
||||
static void Discord_UpdateConnection(void);
|
||||
class IoThreadHolder {
|
||||
private:
|
||||
std::atomic_bool keepRunning{true};
|
||||
std::mutex waitForIOMutex;
|
||||
std::condition_variable waitForIOActivity;
|
||||
std::thread ioThread;
|
||||
class IoThreadHolder
|
||||
{
|
||||
private:
|
||||
std::atomic_bool keepRunning{true};
|
||||
std::mutex waitForIOMutex;
|
||||
std::condition_variable waitForIOActivity;
|
||||
std::thread ioThread;
|
||||
|
||||
public:
|
||||
void Start()
|
||||
{
|
||||
keepRunning.store(true);
|
||||
ioThread = std::thread([&]() {
|
||||
const std::chrono::duration<int64_t, std::milli> maxWait{500LL};
|
||||
Discord_UpdateConnection();
|
||||
while (keepRunning.load()) {
|
||||
std::unique_lock<std::mutex> lock(waitForIOMutex);
|
||||
waitForIOActivity.wait_for(lock, maxWait);
|
||||
Discord_UpdateConnection();
|
||||
}
|
||||
});
|
||||
}
|
||||
public:
|
||||
void Start()
|
||||
{
|
||||
keepRunning.store(true);
|
||||
ioThread = std::thread([&]() {
|
||||
const std::chrono::duration<int64_t, std::milli> maxWait{500LL};
|
||||
Discord_UpdateConnection();
|
||||
while (keepRunning.load()) {
|
||||
std::unique_lock<std::mutex> lock(waitForIOMutex);
|
||||
waitForIOActivity.wait_for(lock, maxWait);
|
||||
Discord_UpdateConnection();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Notify() { waitForIOActivity.notify_all(); }
|
||||
void Notify() { waitForIOActivity.notify_all(); }
|
||||
|
||||
void Stop()
|
||||
{
|
||||
keepRunning.exchange(false);
|
||||
Notify();
|
||||
if (ioThread.joinable())
|
||||
void Stop()
|
||||
{
|
||||
keepRunning.exchange(false);
|
||||
Notify();
|
||||
if (ioThread.joinable())
|
||||
ioThread.join();
|
||||
}
|
||||
}
|
||||
|
||||
~IoThreadHolder() { Stop(); }
|
||||
~IoThreadHolder() { Stop(); }
|
||||
};
|
||||
#else
|
||||
class IoThreadHolder {
|
||||
public:
|
||||
void Start() {}
|
||||
void Stop() {}
|
||||
void Notify() {}
|
||||
class IoThreadHolder
|
||||
{
|
||||
public:
|
||||
void Start() {}
|
||||
void Stop() {}
|
||||
void Notify() {}
|
||||
};
|
||||
#endif /* DISCORD_DISABLE_IO_THREAD */
|
||||
|
||||
static IoThreadHolder* IoThread{nullptr};
|
||||
|
||||
static void UpdateReconnectTime()
|
||||
static void UpdateReconnectTime(void)
|
||||
{
|
||||
NextConnect = std::chrono::system_clock::now() +
|
||||
std::chrono::duration<int64_t, std::milli>{ReconnectTimeMs.nextDelay()};
|
||||
}
|
||||
|
||||
#ifdef DISCORD_DISABLE_IO_THREAD
|
||||
extern "C" DISCORD_EXPORT void Discord_UpdateConnection(void)
|
||||
extern "C" void Discord_UpdateConnection(void)
|
||||
#else
|
||||
static void Discord_UpdateConnection(void)
|
||||
#endif
|
||||
@@ -160,18 +163,18 @@ static void Discord_UpdateConnection(void)
|
||||
if (!Connection->Read(message))
|
||||
break;
|
||||
|
||||
const char* evtName = GetStrMember(&message, "evt");
|
||||
const char* nonce = GetStrMember(&message, "nonce");
|
||||
const char *evtName = GetStrMember(&message, "evt");
|
||||
const char *nonce = GetStrMember(&message, "nonce");
|
||||
|
||||
if (nonce)
|
||||
{
|
||||
/* in responses only --
|
||||
* should use to match up response when needed. */
|
||||
|
||||
if (evtName && strcmp(evtName, "ERROR") == 0)
|
||||
if (evtName && !strcmp(evtName, "ERROR"))
|
||||
{
|
||||
auto data = GetObjMember(&message, "data");
|
||||
LastErrorCode = GetIntMember(data, "code");
|
||||
JsonValue *data = GetObjMember(&message, "data");
|
||||
LastErrorCode = GetIntMember(data, "code");
|
||||
StringCopy(LastErrorMessage, GetStrMember(data, "message", ""));
|
||||
GotErrorMessage.store(true);
|
||||
}
|
||||
@@ -182,39 +185,40 @@ static void Discord_UpdateConnection(void)
|
||||
if (!evtName)
|
||||
continue;
|
||||
|
||||
auto data = GetObjMember(&message, "data");
|
||||
JsonValue *data = GetObjMember(&message, "data");
|
||||
|
||||
if (strcmp(evtName, "ACTIVITY_JOIN") == 0)
|
||||
if (!strcmp(evtName, "ACTIVITY_JOIN"))
|
||||
{
|
||||
auto secret = GetStrMember(data, "secret");
|
||||
const char *secret = GetStrMember(data, "secret");
|
||||
if (secret)
|
||||
{
|
||||
StringCopy(JoinGameSecret, secret);
|
||||
WasJoinGame.store(true);
|
||||
}
|
||||
}
|
||||
else if (strcmp(evtName, "ACTIVITY_SPECTATE") == 0)
|
||||
else if (!strcmp(evtName, "ACTIVITY_SPECTATE"))
|
||||
{
|
||||
auto secret = GetStrMember(data, "secret");
|
||||
const char *secret = GetStrMember(data, "secret");
|
||||
if (secret)
|
||||
{
|
||||
StringCopy(SpectateGameSecret, secret);
|
||||
WasSpectateGame.store(true);
|
||||
}
|
||||
}
|
||||
else if (strcmp(evtName, "ACTIVITY_JOIN_REQUEST") == 0)
|
||||
else if (!strcmp(evtName, "ACTIVITY_JOIN_REQUEST"))
|
||||
{
|
||||
auto user = GetObjMember(data, "user");
|
||||
auto userId = GetStrMember(user, "id");
|
||||
auto username = GetStrMember(user, "username");
|
||||
auto avatar = GetStrMember(user, "avatar");
|
||||
auto joinReq = JoinAskQueue.GetNextAddMessage();
|
||||
JsonValue *user = GetObjMember(data, "user");
|
||||
const char *userId = GetStrMember(user, "id");
|
||||
const char *username = GetStrMember(user, "username");
|
||||
const char *avatar = GetStrMember(user, "avatar");
|
||||
auto joinReq = JoinAskQueue.GetNextAddMessage();
|
||||
|
||||
if (userId && username && joinReq)
|
||||
{
|
||||
StringCopy(joinReq->userId, userId);
|
||||
StringCopy(joinReq->username, username);
|
||||
auto discriminator = GetStrMember(user, "discriminator");
|
||||
const char *discriminator = GetStrMember(user,
|
||||
"discriminator");
|
||||
if (discriminator)
|
||||
StringCopy(joinReq->discriminator, discriminator);
|
||||
if (avatar)
|
||||
@@ -283,7 +287,7 @@ static bool DeregisterForEvent(const char* evtName)
|
||||
return false;
|
||||
}
|
||||
|
||||
extern "C" DISCORD_EXPORT void Discord_Initialize(
|
||||
extern "C" void Discord_Initialize(
|
||||
const char* applicationId,
|
||||
DiscordEventHandlers* handlers,
|
||||
int autoRegister,
|
||||
@@ -301,7 +305,7 @@ extern "C" DISCORD_EXPORT void Discord_Initialize(
|
||||
Discord_Register(applicationId, nullptr);
|
||||
}
|
||||
|
||||
Pid = GetProcessId();
|
||||
Pid = get_process_id();
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(HandlerMutex);
|
||||
@@ -321,16 +325,16 @@ extern "C" DISCORD_EXPORT void Discord_Initialize(
|
||||
Connection->onConnect = [](JsonDocument& readyMessage)
|
||||
{
|
||||
Discord_UpdateHandlers(&QueuedHandlers);
|
||||
auto data = GetObjMember(&readyMessage, "data");
|
||||
auto user = GetObjMember(data, "user");
|
||||
auto userId = GetStrMember(user, "id");
|
||||
auto username = GetStrMember(user, "username");
|
||||
auto avatar = GetStrMember(user, "avatar");
|
||||
JsonValue *data = GetObjMember(&readyMessage, "data");
|
||||
JsonValue *user = GetObjMember(data, "user");
|
||||
const char *userId = GetStrMember(user, "id");
|
||||
const char *username = GetStrMember(user, "username");
|
||||
const char *avatar = GetStrMember(user, "avatar");
|
||||
if (userId && username)
|
||||
{
|
||||
StringCopy(connectedUser.userId, userId);
|
||||
StringCopy(connectedUser.username, username);
|
||||
auto discriminator = GetStrMember(user, "discriminator");
|
||||
const char *discriminator = GetStrMember(user, "discriminator");
|
||||
if (discriminator)
|
||||
StringCopy(connectedUser.discriminator, discriminator);
|
||||
if (avatar)
|
||||
@@ -356,7 +360,7 @@ extern "C" DISCORD_EXPORT void Discord_Initialize(
|
||||
IoThread->Start();
|
||||
}
|
||||
|
||||
extern "C" DISCORD_EXPORT void Discord_Shutdown(void)
|
||||
extern "C" void Discord_Shutdown(void)
|
||||
{
|
||||
if (!Connection)
|
||||
return;
|
||||
@@ -373,8 +377,7 @@ extern "C" DISCORD_EXPORT void Discord_Shutdown(void)
|
||||
RpcConnection::Destroy(Connection);
|
||||
}
|
||||
|
||||
extern "C" DISCORD_EXPORT void
|
||||
Discord_UpdatePresence(const DiscordRichPresence* presence)
|
||||
extern "C" void Discord_UpdatePresence(const DiscordRichPresence* presence)
|
||||
{
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(PresenceMutex);
|
||||
@@ -385,12 +388,12 @@ Discord_UpdatePresence(const DiscordRichPresence* presence)
|
||||
IoThread->Notify();
|
||||
}
|
||||
|
||||
extern "C" DISCORD_EXPORT void Discord_ClearPresence(void)
|
||||
extern "C" void Discord_ClearPresence(void)
|
||||
{
|
||||
Discord_UpdatePresence(nullptr);
|
||||
}
|
||||
|
||||
extern "C" DISCORD_EXPORT void Discord_Respond(const char* userId, /* DISCORD_REPLY_ */ int reply)
|
||||
extern "C" void Discord_Respond(const char* userId, /* DISCORD_REPLY_ */ int reply)
|
||||
{
|
||||
/* if we are not connected, let's not batch up stale messages for later */
|
||||
if (!Connection || !Connection->IsOpen())
|
||||
@@ -406,7 +409,7 @@ extern "C" DISCORD_EXPORT void Discord_Respond(const char* userId, /* DISCORD_RE
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" DISCORD_EXPORT void Discord_RunCallbacks(void)
|
||||
extern "C" void Discord_RunCallbacks(void)
|
||||
{
|
||||
/* Note on some weirdness: internally we might connect, get other signals, disconnect any number
|
||||
* of times inbetween calls here. Externally, we want the sequence to seem sane, so any other
|
||||
@@ -498,7 +501,7 @@ extern "C" DISCORD_EXPORT void Discord_RunCallbacks(void)
|
||||
DeregisterForEvent(event)
|
||||
#endif
|
||||
|
||||
extern "C" DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers* newHandlers)
|
||||
extern "C" void Discord_UpdateHandlers(DiscordEventHandlers* newHandlers)
|
||||
{
|
||||
if (newHandlers)
|
||||
{
|
||||
|
||||
+5
-4
@@ -3,7 +3,8 @@
|
||||
|
||||
#include <atomic>
|
||||
|
||||
static const int RpcVersion = 1;
|
||||
#define RPC_VERSION 1
|
||||
|
||||
static RpcConnection Instance;
|
||||
|
||||
/*static*/ RpcConnection* RpcConnection::Create(const char* applicationId)
|
||||
@@ -36,8 +37,8 @@ void RpcConnection::Open()
|
||||
JsonDocument message;
|
||||
if (Read(message))
|
||||
{
|
||||
auto cmd = GetStrMember(&message, "cmd");
|
||||
auto evt = GetStrMember(&message, "evt");
|
||||
const char *cmd = GetStrMember(&message, "cmd");
|
||||
const char *evt = GetStrMember(&message, "evt");
|
||||
if (cmd && evt
|
||||
&& !strcmp(cmd, "DISPATCH")
|
||||
&& !strcmp(evt, "READY"))
|
||||
@@ -52,7 +53,7 @@ void RpcConnection::Open()
|
||||
{
|
||||
sendFrame.opcode = Opcode::Handshake;
|
||||
sendFrame.length = (uint32_t)JsonWriteHandshakeObj(
|
||||
sendFrame.message, sizeof(sendFrame.message), RpcVersion, appId);
|
||||
sendFrame.message, sizeof(sendFrame.message), RPC_VERSION, appId);
|
||||
|
||||
if (connection->Write(&sendFrame,
|
||||
sizeof(MessageFrameHeader) + sendFrame.length))
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
|
||||
/* I took this from the buffer size libuv uses for named pipes;
|
||||
* I suspect ours would usually be much smaller. */
|
||||
constexpr size_t MaxRpcFrameSize = 64 * 1024;
|
||||
#define MAX_RPC_FRAMESIZE 65536
|
||||
|
||||
struct RpcConnection
|
||||
{
|
||||
@@ -33,7 +33,7 @@ struct RpcConnection
|
||||
|
||||
struct MessageFrame : public MessageFrameHeader
|
||||
{
|
||||
char message[MaxRpcFrameSize - sizeof(MessageFrameHeader)];
|
||||
char message[MAX_RPC_FRAMESIZE - sizeof(MessageFrameHeader)];
|
||||
};
|
||||
|
||||
enum class State : uint32_t
|
||||
|
||||
Vendored
+4
-4
@@ -99,7 +99,7 @@ void* rc_file_open(const char* path)
|
||||
handle = filereader->open(path);
|
||||
if (handle && verbose_message_callback)
|
||||
{
|
||||
char message[1024];
|
||||
char message[2048];
|
||||
snprintf(message, sizeof(message), "Opened %s", rc_path_get_filename(path));
|
||||
verbose_message_callback(message);
|
||||
}
|
||||
@@ -363,7 +363,7 @@ static int rc_hash_3do(char hash[33], const char* path)
|
||||
{
|
||||
if (verbose_message_callback)
|
||||
{
|
||||
char message[128];
|
||||
char message[4096];
|
||||
snprintf(message, sizeof(message), "Found 3DO CD, title=%s", &buffer[0x28]);
|
||||
verbose_message_callback(message);
|
||||
}
|
||||
@@ -653,7 +653,7 @@ static int rc_hash_pce_cd(char hash[33], const char* path)
|
||||
|
||||
if (verbose_message_callback)
|
||||
{
|
||||
char message[128];
|
||||
char message[4096];
|
||||
buffer[128] = '\0';
|
||||
snprintf(message, sizeof(message), "Found PC Engine CD, title=%s", &buffer[106]);
|
||||
verbose_message_callback(message);
|
||||
@@ -1075,7 +1075,7 @@ static const char* rc_hash_get_first_item_from_playlist(const char* path)
|
||||
|
||||
if (verbose_message_callback)
|
||||
{
|
||||
char message[1024];
|
||||
char message[2048];
|
||||
snprintf(message, sizeof(message), "Extracted %s from playlist", buffer);
|
||||
verbose_message_callback(message);
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ static void disk_control_get_index_set_msg(
|
||||
unsigned *msg_duration, char *msg, size_t len)
|
||||
{
|
||||
bool has_label = false;
|
||||
char image_label[PATH_MAX_LENGTH];
|
||||
char image_label[128];
|
||||
|
||||
image_label[0] = '\0';
|
||||
|
||||
|
||||
+18
-12
@@ -152,6 +152,7 @@ static void disk_index_file_reset(disk_index_file_t *disk_index_file)
|
||||
* Does nothing if disk index file does not exist. */
|
||||
static bool disk_index_file_read(disk_index_file_t *disk_index_file)
|
||||
{
|
||||
const char *file_path = NULL;
|
||||
bool success = false;
|
||||
DCifJSONContext context = {0};
|
||||
RFILE *file = NULL;
|
||||
@@ -160,14 +161,16 @@ static bool disk_index_file_read(disk_index_file_t *disk_index_file)
|
||||
if (!disk_index_file)
|
||||
return false;
|
||||
|
||||
if ( string_is_empty(disk_index_file->file_path) ||
|
||||
!path_is_valid(disk_index_file->file_path)
|
||||
file_path = disk_index_file->file_path;
|
||||
|
||||
if ( string_is_empty(file_path) ||
|
||||
!path_is_valid(file_path)
|
||||
)
|
||||
return false;
|
||||
|
||||
/* Attempt to open disk index file */
|
||||
file = filestream_open(
|
||||
disk_index_file->file_path,
|
||||
file_path,
|
||||
RETRO_VFS_FILE_ACCESS_READ,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
|
||||
@@ -175,7 +178,7 @@ static bool disk_index_file_read(disk_index_file_t *disk_index_file)
|
||||
{
|
||||
RARCH_ERR(
|
||||
"[disk index file] Failed to open disk index record file: %s\n",
|
||||
disk_index_file->file_path);
|
||||
file_path);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -210,7 +213,7 @@ static bool disk_index_file_read(disk_index_file_t *disk_index_file)
|
||||
{
|
||||
RARCH_ERR(
|
||||
"[disk index file] Failed to read disk index file: %s\n",
|
||||
disk_index_file->file_path);
|
||||
file_path);
|
||||
JSON_Parser_Free(context.parser);
|
||||
goto end;
|
||||
}
|
||||
@@ -220,7 +223,7 @@ static bool disk_index_file_read(disk_index_file_t *disk_index_file)
|
||||
{
|
||||
RARCH_ERR(
|
||||
"[disk index file] Error parsing chunk of disk index file: %s\n---snip---\n%s\n---snip---\n",
|
||||
disk_index_file->file_path, chunk);
|
||||
file_path, chunk);
|
||||
DCifJSONLogError(&context);
|
||||
JSON_Parser_Free(context.parser);
|
||||
goto end;
|
||||
@@ -232,7 +235,7 @@ static bool disk_index_file_read(disk_index_file_t *disk_index_file)
|
||||
{
|
||||
RARCH_WARN(
|
||||
"[disk index file] Error parsing disk index file: %s\n",
|
||||
disk_index_file->file_path);
|
||||
file_path);
|
||||
DCifJSONLogError(&context);
|
||||
JSON_Parser_Free(context.parser);
|
||||
goto end;
|
||||
@@ -403,11 +406,12 @@ void disk_index_file_set(
|
||||
/* Saves specified disk index file to disk */
|
||||
bool disk_index_file_save(disk_index_file_t *disk_index_file)
|
||||
{
|
||||
int n;
|
||||
char value_string[32];
|
||||
const char *file_path;
|
||||
DCifJSONContext context = {0};
|
||||
RFILE *file = NULL;
|
||||
bool success = false;
|
||||
int n;
|
||||
|
||||
value_string[0] = '\0';
|
||||
|
||||
@@ -421,17 +425,19 @@ bool disk_index_file_save(disk_index_file_t *disk_index_file)
|
||||
* 'failure' */
|
||||
if (!disk_index_file->modified)
|
||||
return true;
|
||||
|
||||
file_path = disk_index_file->file_path;
|
||||
|
||||
if (string_is_empty(disk_index_file->file_path))
|
||||
if (string_is_empty(file_path))
|
||||
return false;
|
||||
|
||||
RARCH_LOG(
|
||||
"[disk index file] Saving disk index file: %s\n",
|
||||
disk_index_file->file_path);
|
||||
file_path);
|
||||
|
||||
/* Attempt to open disk index file */
|
||||
file = filestream_open(
|
||||
disk_index_file->file_path,
|
||||
file_path,
|
||||
RETRO_VFS_FILE_ACCESS_WRITE,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
|
||||
@@ -439,7 +445,7 @@ bool disk_index_file_save(disk_index_file_t *disk_index_file)
|
||||
{
|
||||
RARCH_ERR(
|
||||
"[disk index file] Failed to open disk index file: %s\n",
|
||||
disk_index_file->file_path);
|
||||
file_path);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,6 @@ bool libretro_get_shared_context(void);
|
||||
#define SUBSYSTEM_MAX_SUBSYSTEM_ROMS 10
|
||||
|
||||
extern struct retro_subsystem_info subsystem_data[SUBSYSTEM_MAX_SUBSYSTEMS];
|
||||
extern struct retro_subsystem_rom_info subsystem_data_roms[SUBSYSTEM_MAX_SUBSYSTEMS][SUBSYSTEM_MAX_SUBSYSTEM_ROMS];
|
||||
extern unsigned subsystem_current_count;
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
+67
-8
@@ -63,6 +63,7 @@
|
||||
#include "configuration.h"
|
||||
#include "file_path_special.h"
|
||||
|
||||
#include "msg_hash.h"
|
||||
#include "paths.h"
|
||||
#include "verbosity.h"
|
||||
|
||||
@@ -165,6 +166,18 @@ void fill_pathname_application_special(char *s,
|
||||
fill_pathname_basedir(s, path_get(RARCH_PATH_CONFIG), len);
|
||||
}
|
||||
break;
|
||||
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG:
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
char *s1 = (char*)malloc(
|
||||
PATH_MAX_LENGTH * sizeof(char));
|
||||
const char *dir_assets = settings->paths.directory_assets;
|
||||
s1[0] = '\0';
|
||||
fill_pathname_join(s1, dir_assets, "pkg", PATH_MAX_LENGTH * sizeof(char));
|
||||
strlcpy(s, s1, len);
|
||||
free(s1);
|
||||
}
|
||||
break;
|
||||
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS:
|
||||
#ifdef HAVE_XMB
|
||||
{
|
||||
@@ -327,10 +340,33 @@ void fill_pathname_application_special(char *s,
|
||||
|
||||
s1[0] = '\0';
|
||||
|
||||
fill_pathname_application_special(s1,
|
||||
PATH_MAX_LENGTH * sizeof(char),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI);
|
||||
fill_pathname_join(s, s1, "font.ttf", len);
|
||||
switch (*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE))
|
||||
{
|
||||
case RETRO_LANGUAGE_ARABIC:
|
||||
fill_pathname_application_special(s1,
|
||||
PATH_MAX_LENGTH * sizeof(char),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
|
||||
fill_pathname_join(s, s1, "fallback-font.ttf", len);
|
||||
break;
|
||||
case RETRO_LANGUAGE_CHINESE_SIMPLIFIED:
|
||||
case RETRO_LANGUAGE_CHINESE_TRADITIONAL:
|
||||
fill_pathname_application_special(s1,
|
||||
PATH_MAX_LENGTH * sizeof(char),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
|
||||
fill_pathname_join(s, s1, "chinese-fallback-font.ttf", len);
|
||||
break;
|
||||
case RETRO_LANGUAGE_KOREAN:
|
||||
fill_pathname_application_special(s1,
|
||||
PATH_MAX_LENGTH * sizeof(char),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
|
||||
fill_pathname_join(s, s1, "korean-fallback-font.ttf", len);
|
||||
break;
|
||||
default:
|
||||
fill_pathname_application_special(s1,
|
||||
PATH_MAX_LENGTH * sizeof(char),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI);
|
||||
fill_pathname_join(s, s1, "font.ttf", len);
|
||||
}
|
||||
|
||||
free(s1);
|
||||
}
|
||||
@@ -350,10 +386,33 @@ void fill_pathname_application_special(char *s,
|
||||
|
||||
s1[0] = '\0';
|
||||
|
||||
fill_pathname_application_special(s1,
|
||||
PATH_MAX_LENGTH * sizeof(char),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB);
|
||||
fill_pathname_join(s, s1, "font.ttf", len);
|
||||
switch (*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE))
|
||||
{
|
||||
case RETRO_LANGUAGE_ARABIC:
|
||||
fill_pathname_application_special(s1,
|
||||
PATH_MAX_LENGTH * sizeof(char),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
|
||||
fill_pathname_join(s, s1, "fallback-font.ttf", len);
|
||||
break;
|
||||
case RETRO_LANGUAGE_CHINESE_SIMPLIFIED:
|
||||
case RETRO_LANGUAGE_CHINESE_TRADITIONAL:
|
||||
fill_pathname_application_special(s1,
|
||||
PATH_MAX_LENGTH * sizeof(char),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
|
||||
fill_pathname_join(s, s1, "chinese-fallback-font.ttf", len);
|
||||
break;
|
||||
case RETRO_LANGUAGE_KOREAN:
|
||||
fill_pathname_application_special(s1,
|
||||
PATH_MAX_LENGTH * sizeof(char),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
|
||||
fill_pathname_join(s, s1, "korean-fallback-font.ttf", len);
|
||||
break;
|
||||
default:
|
||||
fill_pathname_application_special(s1,
|
||||
PATH_MAX_LENGTH * sizeof(char),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB);
|
||||
fill_pathname_join(s, s1, "font.ttf", len);
|
||||
}
|
||||
free(s1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +104,9 @@ enum application_special_type
|
||||
APPLICATION_SPECIAL_NONE = 0,
|
||||
APPLICATION_SPECIAL_DIRECTORY_AUTOCONFIG,
|
||||
APPLICATION_SPECIAL_DIRECTORY_CONFIG,
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG,
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG_AR_FONT,
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG_CJK_FONT,
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI,
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_FONT,
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_ICONS,
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
#include "../frontend_driver.h"
|
||||
|
||||
#include <io_common.h>
|
||||
#include <loadfile.h>
|
||||
#include <unistd.h>
|
||||
#include <sbv_patches.h>
|
||||
@@ -27,12 +26,8 @@
|
||||
#include <libmtap.h>
|
||||
#include <audsrv.h>
|
||||
#include <libpad.h>
|
||||
#include <libcdvd-common.h>
|
||||
#include <cdvd_rpc.h>
|
||||
#include <fileXio_cdvd.h>
|
||||
#include <ps2_devices.h>
|
||||
#include <ps2_irx_variables.h>
|
||||
#include <ps2_descriptor.h>
|
||||
|
||||
char eboot_path[512];
|
||||
char user_path[512];
|
||||
@@ -186,9 +181,6 @@ static void frontend_ps2_init(void *data)
|
||||
SifExecModuleBuffer(&freesd_irx, size_freesd_irx, 0, NULL, NULL);
|
||||
SifExecModuleBuffer(&audsrv_irx, size_audsrv_irx, 0, NULL, NULL);
|
||||
|
||||
/* CDVD */
|
||||
SifExecModuleBuffer(&cdvd_irx, size_cdvd_irx, 0, NULL, NULL);
|
||||
|
||||
if (mcInit(MC_TYPE_XMC)) {
|
||||
RARCH_ERR("mcInit library not initalizated\n");
|
||||
}
|
||||
@@ -210,20 +202,6 @@ static void frontend_ps2_init(void *data)
|
||||
RARCH_ERR("mtapPortOpen library not initalizated\n");
|
||||
}
|
||||
|
||||
/* Initializes CDVD library */
|
||||
/* SCECdINoD init without check for a disc. Reduces risk of a lockup if the drive is in a erroneous state. */
|
||||
sceCdInit(SCECdINoD);
|
||||
if (CDVD_Init() != 1) {
|
||||
RARCH_ERR("CDVD_Init library not initalizated\n");
|
||||
}
|
||||
|
||||
_init_ps2_io();
|
||||
|
||||
/* Prepare device */
|
||||
getcwd(cwd, sizeof(cwd));
|
||||
bootDeviceID=getBootDeviceID(cwd);
|
||||
waitUntilDeviceIsReady(bootDeviceID);
|
||||
|
||||
#if defined(HAVE_FILE_LOGGER)
|
||||
retro_main_log_file_init("retroarch.log", false);
|
||||
verbosity_enable();
|
||||
@@ -237,11 +215,8 @@ static void frontend_ps2_deinit(void *data)
|
||||
verbosity_disable();
|
||||
command_event(CMD_EVENT_LOG_FILE_DEINIT, NULL);
|
||||
#endif
|
||||
_free_ps2_io();
|
||||
CDVD_Stop();
|
||||
padEnd();
|
||||
audsrv_quit();
|
||||
fileXioExit();
|
||||
Exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ static void frontend_psp_init(void *data)
|
||||
scePowerSetGpuClockFrequency(222);
|
||||
scePowerSetGpuXbarClockFrequency(166);
|
||||
sceSysmoduleLoadModule(SCE_SYSMODULE_NET);
|
||||
|
||||
|
||||
SceAppUtilInitParam appUtilParam;
|
||||
SceAppUtilBootParam appUtilBootParam;
|
||||
memset(&appUtilParam, 0, sizeof(SceAppUtilInitParam));
|
||||
@@ -532,6 +532,11 @@ enum retro_language psp_get_retro_lang_from_langid(int langid)
|
||||
return RETRO_LANGUAGE_PORTUGUESE_BRAZIL;
|
||||
case SCE_SYSTEM_PARAM_LANG_TURKISH:
|
||||
return RETRO_LANGUAGE_TURKISH;
|
||||
#if 0
|
||||
/* TODO/FIXME - this doesn't seem to actually exist */
|
||||
case SCE_SYSTEM_PARAM_LANG_SLOVAK:
|
||||
return RETRO_LANGUAGE_SLOVAK;
|
||||
#endif
|
||||
case SCE_SYSTEM_PARAM_LANG_ENGLISH_US:
|
||||
case SCE_SYSTEM_PARAM_LANG_ENGLISH_GB:
|
||||
default:
|
||||
@@ -540,7 +545,7 @@ enum retro_language psp_get_retro_lang_from_langid(int langid)
|
||||
}
|
||||
|
||||
enum retro_language frontend_psp_get_user_language(void)
|
||||
{
|
||||
{
|
||||
int langid;
|
||||
sceAppUtilSystemParamGetInt(SCE_SYSTEM_PARAM_ID_LANG, &langid);
|
||||
return psp_get_retro_lang_from_langid(langid);
|
||||
|
||||
@@ -164,7 +164,7 @@ int system_property_get(const char *command,
|
||||
|
||||
while (!feof(pipe))
|
||||
{
|
||||
if (fgets(buffer, 128, pipe) != NULL)
|
||||
if (fgets(buffer, 128, pipe))
|
||||
{
|
||||
int curlen = strlen(buffer);
|
||||
|
||||
@@ -306,11 +306,11 @@ static void* onSaveInstanceState(
|
||||
while (!android_app->stateSaved)
|
||||
scond_wait(android_app->cond, android_app->mutex);
|
||||
|
||||
if (android_app->savedState != NULL)
|
||||
if (android_app->savedState)
|
||||
{
|
||||
savedState = android_app->savedState;
|
||||
*outLen = android_app->savedStateSize;
|
||||
android_app->savedState = NULL;
|
||||
savedState = android_app->savedState;
|
||||
*outLen = android_app->savedStateSize;
|
||||
android_app->savedState = NULL;
|
||||
android_app->savedStateSize = 0;
|
||||
}
|
||||
|
||||
@@ -451,9 +451,9 @@ static struct android_app* android_app_create(ANativeActivity* activity,
|
||||
android_app->mutex = slock_new();
|
||||
android_app->cond = scond_new();
|
||||
|
||||
if (savedState != NULL)
|
||||
if (savedState)
|
||||
{
|
||||
android_app->savedState = malloc(savedStateSize);
|
||||
android_app->savedState = malloc(savedStateSize);
|
||||
android_app->savedStateSize = savedStateSize;
|
||||
memcpy(android_app->savedState, savedState, savedStateSize);
|
||||
}
|
||||
@@ -1679,7 +1679,7 @@ static void frontend_unix_get_env(int *argc,
|
||||
/* For gamepad-like/console devices:
|
||||
*
|
||||
* - Explicitly disable input overlay by default
|
||||
* - Use XMB menu driver by default
|
||||
* - Use Ozone menu driver by default
|
||||
*
|
||||
* */
|
||||
|
||||
@@ -1687,7 +1687,7 @@ static void frontend_unix_get_env(int *argc,
|
||||
{
|
||||
g_defaults.overlay.set = true;
|
||||
g_defaults.overlay.enable = false;
|
||||
strlcpy(g_defaults.settings.menu, "xmb",
|
||||
strlcpy(g_defaults.settings.menu, "ozone",
|
||||
sizeof(g_defaults.settings.menu));
|
||||
}
|
||||
#else
|
||||
@@ -1783,10 +1783,10 @@ static void free_saved_state(struct android_app* android_app)
|
||||
{
|
||||
slock_lock(android_app->mutex);
|
||||
|
||||
if (android_app->savedState != NULL)
|
||||
if (android_app->savedState)
|
||||
{
|
||||
free(android_app->savedState);
|
||||
android_app->savedState = NULL;
|
||||
android_app->savedState = NULL;
|
||||
android_app->savedStateSize = 0;
|
||||
}
|
||||
|
||||
@@ -2414,7 +2414,7 @@ enum retro_language frontend_unix_get_user_language(void)
|
||||
#else
|
||||
char *envvar = getenv("LANG");
|
||||
|
||||
if (envvar != NULL)
|
||||
if (envvar)
|
||||
lang = rarch_get_language_from_iso(envvar);
|
||||
#endif
|
||||
#endif
|
||||
@@ -2432,8 +2432,8 @@ static bool accessibility_speak_unix(int speed,
|
||||
{
|
||||
int pid;
|
||||
const char *language = get_user_language_iso639_1(true);
|
||||
char* voice_out = (char *)malloc(3+strlen(language));
|
||||
char* speed_out = (char *)malloc(3+3);
|
||||
char* voice_out = (char*)malloc(3+strlen(language));
|
||||
char* speed_out = (char*)malloc(3+3);
|
||||
const char* speeds[10] = {"80", "100", "125", "150", "170", "210", "260", "310", "380", "450"};
|
||||
|
||||
if (speed < 1)
|
||||
@@ -2482,7 +2482,7 @@ static bool accessibility_speak_unix(int speed,
|
||||
char* cmd[] = { (char*) "espeak", NULL, NULL, NULL, NULL};
|
||||
cmd[1] = voice_out;
|
||||
cmd[2] = speed_out;
|
||||
cmd[3] = (char *) speak_text;
|
||||
cmd[3] = (char*)speak_text;
|
||||
execvp("espeak", cmd);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -956,8 +956,6 @@ static bool accessibility_speak_windows(int speed,
|
||||
bool res = false;
|
||||
const char* speeds[10] = {"-10", "-7.5", "-5", "-2.5", "0", "2", "4", "6", "8", "10"};
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
if (speed < 1)
|
||||
speed = 1;
|
||||
else if (speed > 10)
|
||||
@@ -973,7 +971,7 @@ static bool accessibility_speak_windows(int speed,
|
||||
{
|
||||
if (strlen(language) > 0)
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
"powershell.exe -NoProfile -WindowStyle Hidden -Command \"Add-Type -AssemblyName System.Speech; $synth = New-Object System.Speech.Synthesis.SpeechSynthesizer; $synth.SelectVoice(\\\"%s\\\"); $synth.Rate = %s; $synth.Speak(\\\"%s\\\");\"", language, speeds[speed-1], (char*) speak_text);
|
||||
"powershell.exe -NoProfile -WindowStyle Hidden -Command \"Add-Type -AssemblyName System.Speech; $synth = New-Object System.Speech.Synthesis.SpeechSynthesizer; $synth.SelectVoice(\\\"%s\\\"); $synth.Rate = %s; $synth.Speak(\\\"%s\\\");\"", language, speeds[speed-1], (char*) speak_text);
|
||||
else
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
"powershell.exe -NoProfile -WindowStyle Hidden -Command \"Add-Type -AssemblyName System.Speech; $synth = New-Object System.Speech.Synthesis.SpeechSynthesizer; $synth.Rate = %s; $synth.Speak(\\\"%s\\\");\"", speeds[speed-1], (char*) speak_text);
|
||||
@@ -986,7 +984,6 @@ static bool accessibility_speak_windows(int speed,
|
||||
return true;
|
||||
}
|
||||
pi_set = true;
|
||||
return true;
|
||||
}
|
||||
#ifdef HAVE_NVDA
|
||||
else if (USE_NVDA)
|
||||
@@ -1002,23 +999,19 @@ static bool accessibility_speak_windows(int speed,
|
||||
RARCH_LOG("Error communicating with NVDA\n");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
nvdaController_cancelSpeech();
|
||||
}
|
||||
|
||||
nvdaController_cancelSpeech();
|
||||
|
||||
if (USE_NVDA_BRAILLE)
|
||||
nvdaController_brailleMessage(wc);
|
||||
else
|
||||
{
|
||||
nvdaController_speakText(wc);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_SAPI
|
||||
else
|
||||
{
|
||||
HRESULT hr;
|
||||
/* stop the old voice if running */
|
||||
if (pVoice)
|
||||
{
|
||||
@@ -1038,14 +1031,14 @@ static bool accessibility_speak_windows(int speed,
|
||||
{
|
||||
wchar_t wtext[1200];
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
"<rate speed=\"%s\"/><volume level=\"80\"/><lang langid=\"%s\"/>%s", speeds[speed], langid, speak_text);
|
||||
"<rate speed=\"%s\"/><volume level=\"80\"/><lang langid=\"%s\"/>%s", speeds[speed], langid, speak_text);
|
||||
mbstowcs(wtext, speak_text, sizeof(wtext));
|
||||
|
||||
|
||||
hr = ISpVoice_Speak(pVoice, wtext, SPF_ASYNC /*SVSFlagsAsync*/, NULL);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -93,7 +93,7 @@ bool dbus_screensaver_inhibit(void)
|
||||
reply = dbus_connection_send_with_reply_and_block(dbus_connection,
|
||||
msg, 300, NULL);
|
||||
|
||||
if (reply != NULL)
|
||||
if (reply)
|
||||
{
|
||||
if (!dbus_message_get_args(reply, NULL,
|
||||
DBUS_TYPE_UINT32, &dbus_screensaver_cookie,
|
||||
|
||||
@@ -443,6 +443,8 @@
|
||||
|
||||
- (void)_drawMenu:(video_frame_info_t *)video_info
|
||||
{
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (!_menu.enabled)
|
||||
return;
|
||||
|
||||
@@ -470,7 +472,7 @@
|
||||
{
|
||||
[rce pushDebugGroup:@"menu"];
|
||||
[_context resetRenderViewport:kFullscreenViewport];
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
[rce popDebugGroup];
|
||||
}
|
||||
#endif
|
||||
|
||||
+3
-11
@@ -219,23 +219,15 @@ static void xdg_screensaver_inhibit(Window wnd)
|
||||
}
|
||||
}
|
||||
|
||||
void x11_suspend_screensaver_xdg_screensaver(Window wnd, bool enable)
|
||||
{
|
||||
/* Check if screensaver suspend is enabled in config */
|
||||
if (!enable)
|
||||
return;
|
||||
|
||||
if (xdg_screensaver_available)
|
||||
xdg_screensaver_inhibit(wnd);
|
||||
}
|
||||
|
||||
void x11_suspend_screensaver(Window wnd, bool enable)
|
||||
{
|
||||
#ifdef HAVE_DBUS
|
||||
if (dbus_suspend_screensaver(enable))
|
||||
return;
|
||||
#endif
|
||||
x11_suspend_screensaver_xdg_screensaver(wnd, enable);
|
||||
if (enable)
|
||||
if (xdg_screensaver_available)
|
||||
xdg_screensaver_inhibit(wnd);
|
||||
}
|
||||
|
||||
float x11_get_refresh_rate(void *data)
|
||||
|
||||
@@ -63,7 +63,9 @@ typedef struct
|
||||
unsigned orig_width;
|
||||
unsigned orig_height;
|
||||
unsigned orig_refresh;
|
||||
#ifdef HAS_TASKBAR_EXT
|
||||
ITaskbarList3 *taskbar_list;
|
||||
#endif
|
||||
} dispserv_win32_t;
|
||||
|
||||
/*
|
||||
|
||||
@@ -480,10 +480,13 @@ static void x11_display_server_set_screen_orientation(enum rotation rotation)
|
||||
static enum rotation x11_display_server_get_screen_orientation(void)
|
||||
{
|
||||
int i, j;
|
||||
Display *dpy = x11_display_server_open_display();
|
||||
XRRScreenResources *screen = XRRGetScreenResources(dpy, DefaultRootWindow(dpy));
|
||||
XRRScreenConfiguration *config = XRRGetScreenInfo(dpy, DefaultRootWindow(dpy));
|
||||
enum rotation rotation = ORIENTATION_NORMAL;
|
||||
XRRScreenConfiguration *config = NULL;
|
||||
enum rotation rotation = ORIENTATION_NORMAL;
|
||||
Display *dpy = x11_display_server_open_display();
|
||||
XRRScreenResources *screen = XRRGetScreenResources(dpy, DefaultRootWindow(dpy));
|
||||
if (!screen)
|
||||
return ORIENTATION_NORMAL;
|
||||
config = XRRGetScreenInfo(dpy, DefaultRootWindow(dpy));
|
||||
|
||||
for (i = 0; i < screen->noutput; i++)
|
||||
{
|
||||
|
||||
@@ -141,7 +141,7 @@ static bool caca_gfx_frame(void *data, const void *frame,
|
||||
caca_clear_canvas(caca->cv);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
if (msg)
|
||||
|
||||
@@ -546,7 +546,7 @@ static bool ctr_frame(void* data, const void* frame,
|
||||
int custom_vp_y = video_info->custom_vp_y;
|
||||
unsigned custom_vp_width = video_info->custom_vp_width;
|
||||
unsigned custom_vp_height = video_info->custom_vp_height;
|
||||
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (!width || !height || !settings)
|
||||
{
|
||||
@@ -873,9 +873,8 @@ static bool ctr_frame(void* data, const void* frame,
|
||||
}
|
||||
|
||||
ctr->msg_rendering_enabled = true;
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
ctr->msg_rendering_enabled = false;
|
||||
|
||||
}
|
||||
else if (statistics_show)
|
||||
{
|
||||
|
||||
+2
-1
@@ -1211,6 +1211,7 @@ static bool d3d10_gfx_frame(
|
||||
*osd_params = (struct font_params*)
|
||||
&video_info->osd_stat_params;
|
||||
const char *stat_text = video_info->stat_text;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (d3d10->resize_chain)
|
||||
{
|
||||
@@ -1471,7 +1472,7 @@ static bool d3d10_gfx_frame(
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if (d3d10->menu.enabled)
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
else
|
||||
#endif
|
||||
if (statistics_show)
|
||||
|
||||
+2
-1
@@ -1290,6 +1290,7 @@ static bool d3d11_gfx_frame(
|
||||
unsigned video_height = video_info->height;
|
||||
bool statistics_show = video_info->statistics_show;
|
||||
struct font_params* osd_params = (struct font_params*)&video_info->osd_stat_params;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (d3d11->resize_chain)
|
||||
{
|
||||
@@ -1544,7 +1545,7 @@ static bool d3d11_gfx_frame(
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if (d3d11->menu.enabled)
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
else
|
||||
#endif
|
||||
if (statistics_show)
|
||||
|
||||
+2
-1
@@ -1174,6 +1174,7 @@ static bool d3d12_gfx_frame(
|
||||
unsigned video_height = video_info->height;
|
||||
struct font_params *osd_params = (struct font_params*)
|
||||
&video_info->osd_stat_params;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
|
||||
d3d12_gfx_sync(d3d12);
|
||||
@@ -1513,7 +1514,7 @@ static bool d3d12_gfx_frame(
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if (d3d12->menu.enabled)
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
else
|
||||
#endif
|
||||
if (statistics_show)
|
||||
|
||||
+2
-1
@@ -1489,6 +1489,7 @@ static bool d3d8_frame(void *data, const void *frame,
|
||||
const char *stat_text = video_info->stat_text;
|
||||
bool statistics_show = video_info->statistics_show;
|
||||
bool black_frame_insertion = video_info->black_frame_insertion;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
(void)i;
|
||||
|
||||
@@ -1556,7 +1557,7 @@ static bool d3d8_frame(void *data, const void *frame,
|
||||
d3d8_set_stream_source(d3d->dev, 0, d3d->menu_display.buffer, 0, sizeof(Vertex));
|
||||
|
||||
d3d8_set_viewports(d3d->dev, &screen_vp);
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
}
|
||||
else if (statistics_show)
|
||||
{
|
||||
|
||||
+4
-4
@@ -645,8 +645,8 @@ void d3d9_make_d3dpp(void *data,
|
||||
#ifdef _XBOX
|
||||
/* TODO/FIXME - get rid of global state dependencies. */
|
||||
global_t *global = global_get_ptr();
|
||||
bool gamma_enable = global ?
|
||||
global->console.screen.gamma_correction : false;
|
||||
int gamma_enable = global ?
|
||||
global->console.screen.gamma_correction : 0;
|
||||
#endif
|
||||
bool windowed_enable = d3d9_is_windowed_enable(info->fullscreen);
|
||||
|
||||
@@ -1532,7 +1532,7 @@ static bool d3d9_frame(void *data, const void *frame,
|
||||
struct font_params *osd_params = (struct font_params*)
|
||||
&video_info->osd_stat_params;
|
||||
const char *stat_text = video_info->stat_text;
|
||||
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (!frame)
|
||||
return true;
|
||||
@@ -1602,7 +1602,7 @@ static bool d3d9_frame(void *data, const void *frame,
|
||||
d3d9_set_stream_source(d3d->dev, 0, (LPDIRECT3DVERTEXBUFFER9)d3d->menu_display.buffer, 0, sizeof(Vertex));
|
||||
|
||||
d3d9_set_viewports(d3d->dev, &screen_vp);
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
}
|
||||
else if (statistics_show)
|
||||
{
|
||||
|
||||
@@ -439,6 +439,7 @@ static bool dispmanx_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
struct dispmanx_video *_dispvars = data;
|
||||
float aspect = video_driver_get_aspect_ratio();
|
||||
unsigned max_swapchain_images = video_info->max_swapchain_images;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (!frame)
|
||||
return true;
|
||||
@@ -456,7 +457,7 @@ static bool dispmanx_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
_dispvars->core_pitch = pitch;
|
||||
_dispvars->aspect_ratio = aspect;
|
||||
|
||||
if (_dispvars->main_surface != NULL)
|
||||
if (_dispvars->main_surface)
|
||||
dispmanx_surface_free(_dispvars, &_dispvars->main_surface);
|
||||
|
||||
/* Internal resolution or ratio has changed, so we need
|
||||
@@ -480,7 +481,7 @@ static bool dispmanx_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
/* Update main surface: locate free page, blit and flip. */
|
||||
|
||||
@@ -757,6 +757,7 @@ static bool drm_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
struct drm_video *_drmvars = data;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if ( ( width != _drmvars->core_width) ||
|
||||
(height != _drmvars->core_height))
|
||||
@@ -769,7 +770,7 @@ static bool drm_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
_drmvars->core_height = height;
|
||||
_drmvars->core_pitch = pitch;
|
||||
|
||||
if (_drmvars->main_surface != NULL)
|
||||
if (_drmvars->main_surface)
|
||||
drm_surface_free(_drmvars, &_drmvars->main_surface);
|
||||
|
||||
/* We need to recreate the main surface and it's pages (buffers). */
|
||||
@@ -790,7 +791,7 @@ static bool drm_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
/* Update main surface: locate free page, blit and flip. */
|
||||
|
||||
+15
-10
@@ -247,7 +247,7 @@ static void exynos_clean_up_pages(struct exynos_page *p, unsigned cnt)
|
||||
|
||||
for (i = 0; i < cnt; ++i)
|
||||
{
|
||||
if (p[i].bo != NULL)
|
||||
if (p[i].bo)
|
||||
{
|
||||
if (p[i].buf_id != 0)
|
||||
drmModeRmFB(p[i].buf_id, p[i].bo->handle);
|
||||
@@ -902,10 +902,13 @@ static void exynos_set_fake_blit(struct exynos_data *pdata)
|
||||
pdata->pages[i].clear = true;
|
||||
}
|
||||
|
||||
static int exynos_blit_frame(struct exynos_data *pdata, const void *frame,
|
||||
unsigned src_pitch)
|
||||
static int exynos_blit_frame(
|
||||
struct exynos_data *pdata,
|
||||
const void *frame,
|
||||
unsigned src_pitch)
|
||||
{
|
||||
const enum exynos_buffer_type buf_type = defaults[EXYNOS_IMAGE_FRAME].buf_type;
|
||||
const enum exynos_buffer_type
|
||||
buf_type = defaults[EXYNOS_IMAGE_FRAME].buf_type;
|
||||
const unsigned size = src_pitch * pdata->blit_params[5];
|
||||
struct g2d_image *src = pdata->src[EXYNOS_IMAGE_FRAME];
|
||||
|
||||
@@ -1268,7 +1271,7 @@ static void exynos_gfx_free(void *data)
|
||||
|
||||
free(pdata);
|
||||
|
||||
if (vid->font != NULL && vid->font_driver != NULL)
|
||||
if (vid->font && vid->font_driver)
|
||||
vid->font_driver->free(vid->font);
|
||||
|
||||
free(vid);
|
||||
@@ -1280,12 +1283,13 @@ static bool exynos_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
{
|
||||
struct exynos_video *vid = data;
|
||||
struct exynos_page *page = NULL;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
/* Check if neither menu nor core framebuffer is to be displayed. */
|
||||
if (!vid->menu_active && !frame)
|
||||
return true;
|
||||
|
||||
if (frame != NULL)
|
||||
if (frame)
|
||||
{
|
||||
if (width != vid->width || height != vid->height)
|
||||
{
|
||||
@@ -1315,15 +1319,16 @@ static bool exynos_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
if (!page)
|
||||
page = exynos_free_page(vid->data);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if (vid->menu_active)
|
||||
{
|
||||
if (exynos_blend_menu(vid->data, vid->menu_rotation) != 0)
|
||||
goto fail;
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
#endif
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
}
|
||||
else if (video_info->statistics_show)
|
||||
else
|
||||
#endif
|
||||
if (video_info->statistics_show)
|
||||
{
|
||||
struct font_params *osd_params = video_info ?
|
||||
(struct font_params*)&video_info->osd_stat_params : NULL;
|
||||
|
||||
@@ -209,12 +209,13 @@ static bool fpga_gfx_frame(void *data, const void *frame,
|
||||
bool draw = true;
|
||||
fpga_t *fpga = (fpga_t*)data;
|
||||
unsigned bits = fpga->video_bits;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (!frame || !frame_width || !frame_height)
|
||||
return true;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
if ( fpga->video_width != frame_width ||
|
||||
|
||||
@@ -189,6 +189,7 @@ static bool gdi_gfx_frame(void *data, const void *frame,
|
||||
gdi_t *gdi = (gdi_t*)data;
|
||||
unsigned bits = gdi->video_bits;
|
||||
HWND hwnd = win32_get_window();
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
/* FIXME: Force these settings off as they interfere with the rendering */
|
||||
video_info->xmb_shadows_enable = false;
|
||||
@@ -198,7 +199,7 @@ static bool gdi_gfx_frame(void *data, const void *frame,
|
||||
return true;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
if ( gdi->video_width != frame_width ||
|
||||
|
||||
+2
-1
@@ -2829,6 +2829,7 @@ static bool gl2_frame(void *data, const void *frame,
|
||||
struct font_params *osd_params = (struct font_params*)
|
||||
&video_info->osd_stat_params;
|
||||
const char *stat_text = video_info->stat_text;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (!gl)
|
||||
return false;
|
||||
@@ -3036,7 +3037,7 @@ static bool gl2_frame(void *data, const void *frame,
|
||||
#if defined(HAVE_MENU)
|
||||
if (gl->menu_texture_enable)
|
||||
{
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
|
||||
if (gl->menu_texture)
|
||||
gl2_draw_texture(gl);
|
||||
|
||||
+19
-18
@@ -696,6 +696,7 @@ static bool gl1_gfx_frame(void *data, const void *frame,
|
||||
unsigned pot_height = 0;
|
||||
unsigned video_width = video_info->width;
|
||||
unsigned video_height = video_info->height;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
gl1_context_bind_hw_render(gl1, false);
|
||||
|
||||
@@ -790,9 +791,8 @@ static bool gl1_gfx_frame(void *data, const void *frame,
|
||||
if (draw)
|
||||
{
|
||||
if (frame_to_copy)
|
||||
{
|
||||
draw_tex(gl1, pot_width, pot_height, width, height, gl1->tex, frame_to_copy);
|
||||
}
|
||||
draw_tex(gl1, pot_width, pot_height,
|
||||
width, height, gl1->tex, frame_to_copy);
|
||||
}
|
||||
|
||||
if (gl1->menu_frame && video_info->menu_is_alive)
|
||||
@@ -837,25 +837,26 @@ static bool gl1_gfx_frame(void *data, const void *frame,
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if (gl1->menu_texture_enable)
|
||||
menu_driver_frame(video_info);
|
||||
else if (video_info->statistics_show)
|
||||
{
|
||||
struct font_params *osd_params = (struct font_params*)
|
||||
&video_info->osd_stat_params;
|
||||
|
||||
if (osd_params)
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
else
|
||||
#endif
|
||||
if (video_info->statistics_show)
|
||||
{
|
||||
font_driver_render_msg(gl1, video_info->stat_text,
|
||||
(const struct font_params*)&video_info->osd_stat_params, NULL);
|
||||
struct font_params *osd_params = (struct font_params*)
|
||||
&video_info->osd_stat_params;
|
||||
|
||||
if (osd_params)
|
||||
{
|
||||
font_driver_render_msg(gl1, video_info->stat_text,
|
||||
(const struct font_params*)&video_info->osd_stat_params, NULL);
|
||||
#if 0
|
||||
osd_params->y = 0.350f;
|
||||
osd_params->scale = 0.75f;
|
||||
font_driver_render_msg(gl1, video_info->chat_text,
|
||||
(const struct font_params*)&video_info->osd_stat_params, NULL);
|
||||
osd_params->y = 0.350f;
|
||||
osd_params->scale = 0.75f;
|
||||
font_driver_render_msg(gl1, video_info->chat_text,
|
||||
(const struct font_params*)&video_info->osd_stat_params, NULL);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GFX_WIDGETS
|
||||
gfx_widgets_frame(video_info);
|
||||
|
||||
@@ -1850,6 +1850,8 @@ static bool gl_core_frame(void *data, const void *frame,
|
||||
bool runloop_is_paused = video_info->runloop_is_paused;
|
||||
bool runloop_is_slowmotion = video_info->runloop_is_slowmotion;
|
||||
bool input_driver_nonblock_state = video_info->input_driver_nonblock_state;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (!gl)
|
||||
return false;
|
||||
|
||||
@@ -1919,7 +1921,7 @@ static bool gl_core_frame(void *data, const void *frame,
|
||||
#if defined(HAVE_MENU)
|
||||
if (gl->menu_texture_enable)
|
||||
{
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
if (gl->menu_texture_enable && gl->menu_texture)
|
||||
gl_core_draw_menu_texture(gl, width, height);
|
||||
}
|
||||
|
||||
+50
-42
@@ -1047,6 +1047,7 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
{
|
||||
uint32_t i;
|
||||
wiiu_video_t *wiiu = (wiiu_video_t *) data;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
(void)msg;
|
||||
|
||||
@@ -1140,44 +1141,45 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
|
||||
if (wiiu->shader_preset)
|
||||
{
|
||||
unsigned i;
|
||||
int32_t frame_direction = state_manager_frame_is_reversed() ? -1 : 1;
|
||||
|
||||
for (int i = 0; i < wiiu->shader_preset->passes; i++)
|
||||
for (i = 0; i < wiiu->shader_preset->passes; i++)
|
||||
{
|
||||
|
||||
unsigned j;
|
||||
GX2SetVertexShader(wiiu->pass[i].gfd->vs);
|
||||
|
||||
for (int j = 0; j < 2 && j < wiiu->pass[i].gfd->vs->uniformBlockCount; j++)
|
||||
for (j = 0; j < 2 && j < wiiu->pass[i].gfd->vs->uniformBlockCount; j++)
|
||||
{
|
||||
wiiu_gfx_update_uniform_block(wiiu, i, wiiu->pass[i].vs_ubos[j], j,
|
||||
wiiu->pass[i].gfd->vs->uniformBlocks[j].size,
|
||||
wiiu->pass[i].gfd->vs->uniformVarCount, wiiu->pass[i].gfd->vs->uniformVars,
|
||||
frame_count, frame_direction);
|
||||
wiiu->pass[i].gfd->vs->uniformBlocks[j].size,
|
||||
wiiu->pass[i].gfd->vs->uniformVarCount, wiiu->pass[i].gfd->vs->uniformVars,
|
||||
frame_count, frame_direction);
|
||||
GX2SetVertexUniformBlock(wiiu->pass[i].gfd->vs->uniformBlocks[j].offset,
|
||||
wiiu->pass[i].gfd->vs->uniformBlocks[j].size, wiiu->pass[i].vs_ubos[j]);
|
||||
wiiu->pass[i].gfd->vs->uniformBlocks[j].size, wiiu->pass[i].vs_ubos[j]);
|
||||
}
|
||||
|
||||
GX2SetPixelShader(wiiu->pass[i].gfd->ps);
|
||||
|
||||
for (int j = 0; j < 2 && j < wiiu->pass[i].gfd->ps->uniformBlockCount; j++)
|
||||
for (j = 0; j < 2 && j < wiiu->pass[i].gfd->ps->uniformBlockCount; j++)
|
||||
{
|
||||
wiiu_gfx_update_uniform_block(wiiu, i, wiiu->pass[i].ps_ubos[j], j,
|
||||
wiiu->pass[i].gfd->ps->uniformBlocks[j].size,
|
||||
wiiu->pass[i].gfd->ps->uniformVarCount, wiiu->pass[i].gfd->ps->uniformVars,
|
||||
frame_count, frame_direction);
|
||||
wiiu->pass[i].gfd->ps->uniformBlocks[j].size,
|
||||
wiiu->pass[i].gfd->ps->uniformVarCount, wiiu->pass[i].gfd->ps->uniformVars,
|
||||
frame_count, frame_direction);
|
||||
GX2SetPixelUniformBlock(wiiu->pass[i].gfd->ps->uniformBlocks[j].offset,
|
||||
wiiu->pass[i].gfd->ps->uniformBlocks[j].size, wiiu->pass[i].ps_ubos[j]);
|
||||
wiiu->pass[i].gfd->ps->uniformBlocks[j].size, wiiu->pass[i].ps_ubos[j]);
|
||||
}
|
||||
|
||||
for (int j = 0; j < wiiu->pass[i].gfd->ps->samplerVarCount; j++)
|
||||
for (j = 0; j < wiiu->pass[i].gfd->ps->samplerVarCount; j++)
|
||||
{
|
||||
if (string_is_equal(wiiu->pass[i].gfd->ps->samplerVars[j].name, "Source"))
|
||||
{
|
||||
GX2SetPixelTexture(texture, wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
GX2SetPixelSampler(wiiu->shader_preset->pass[i].filter ?
|
||||
&wiiu->sampler_linear[wiiu->shader_preset->pass[i].wrap] :
|
||||
&wiiu->sampler_nearest[wiiu->shader_preset->pass[i].wrap],
|
||||
wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
&wiiu->sampler_linear[wiiu->shader_preset->pass[i].wrap] :
|
||||
&wiiu->sampler_nearest[wiiu->shader_preset->pass[i].wrap],
|
||||
wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1185,9 +1187,9 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
{
|
||||
GX2SetPixelTexture(&wiiu->texture, wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
GX2SetPixelSampler(wiiu->shader_preset->pass[0].filter ?
|
||||
&wiiu->sampler_linear[wiiu->shader_preset->pass[0].wrap] :
|
||||
&wiiu->sampler_nearest[wiiu->shader_preset->pass[0].wrap],
|
||||
wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
&wiiu->sampler_linear[wiiu->shader_preset->pass[0].wrap] :
|
||||
&wiiu->sampler_nearest[wiiu->shader_preset->pass[0].wrap],
|
||||
wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1203,9 +1205,9 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
GX2Texture *source = (index > 0) ? &wiiu->pass[index - 1].texture : &wiiu->texture;
|
||||
GX2SetPixelTexture(source, wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
GX2SetPixelSampler(wiiu->shader_preset->pass[index].filter ?
|
||||
&wiiu->sampler_linear[wiiu->shader_preset->pass[index].wrap] :
|
||||
&wiiu->sampler_nearest[wiiu->shader_preset->pass[index].wrap],
|
||||
wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
&wiiu->sampler_linear[wiiu->shader_preset->pass[index].wrap] :
|
||||
&wiiu->sampler_nearest[wiiu->shader_preset->pass[index].wrap],
|
||||
wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1216,9 +1218,9 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
index = i - 1;
|
||||
GX2SetPixelTexture(&wiiu->pass[index].texture, wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
GX2SetPixelSampler(wiiu->shader_preset->pass[index].filter ?
|
||||
&wiiu->sampler_linear[wiiu->shader_preset->pass[index].wrap] :
|
||||
&wiiu->sampler_nearest[wiiu->shader_preset->pass[index].wrap],
|
||||
wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
&wiiu->sampler_linear[wiiu->shader_preset->pass[index].wrap] :
|
||||
&wiiu->sampler_nearest[wiiu->shader_preset->pass[index].wrap],
|
||||
wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1231,9 +1233,9 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
|
||||
GX2SetPixelTexture(&wiiu->pass[index].texture, wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
GX2SetPixelSampler(wiiu->shader_preset->pass[i].filter ?
|
||||
&wiiu->sampler_linear[wiiu->shader_preset->pass[i].wrap] :
|
||||
&wiiu->sampler_nearest[wiiu->shader_preset->pass[i].wrap],
|
||||
wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
&wiiu->sampler_linear[wiiu->shader_preset->pass[i].wrap] :
|
||||
&wiiu->sampler_nearest[wiiu->shader_preset->pass[i].wrap],
|
||||
wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1244,9 +1246,9 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
{
|
||||
GX2SetPixelTexture(&wiiu->luts[k], wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
GX2SetPixelSampler(wiiu->shader_preset->lut[k].filter ?
|
||||
&wiiu->sampler_linear[wiiu->shader_preset->lut[k].wrap] :
|
||||
&wiiu->sampler_nearest[wiiu->shader_preset->lut[k].wrap],
|
||||
wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
&wiiu->sampler_linear[wiiu->shader_preset->lut[k].wrap] :
|
||||
&wiiu->sampler_nearest[wiiu->shader_preset->lut[k].wrap],
|
||||
wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1308,12 +1310,11 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
0.0f, 1.0f);
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
|
||||
if (wiiu->overlay_enable)
|
||||
gx2_render_overlay(wiiu);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if (wiiu->menu.enable)
|
||||
{
|
||||
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->menu.v), sizeof(*wiiu->menu.v), wiiu->menu.v);
|
||||
@@ -1325,6 +1326,7 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
|
||||
GX2DrawEx(GX2_PRIMITIVE_MODE_POINTS, 1, 0, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
wiiu->vertex_cache.current = 0;
|
||||
wiiu->vertex_cache_tex.current = 0;
|
||||
@@ -1335,9 +1337,12 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
|
||||
wiiu->render_msg_enabled = true;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if (wiiu->menu.enable)
|
||||
menu_driver_frame(video_info);
|
||||
else if (video_info->statistics_show)
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
else
|
||||
#endif
|
||||
if (video_info->statistics_show)
|
||||
{
|
||||
struct font_params *osd_params = (struct font_params*)
|
||||
&video_info->osd_stat_params;
|
||||
@@ -1446,6 +1451,7 @@ static bool wiiu_gfx_set_shader(void *data,
|
||||
|
||||
for (i = 0; i < wiiu->shader_preset->passes; i++)
|
||||
{
|
||||
unsigned j;
|
||||
char gfdpath[PATH_MAX_LENGTH];
|
||||
struct video_shader_pass *pass = &wiiu->shader_preset->pass[i];
|
||||
|
||||
@@ -1470,22 +1476,22 @@ static bool wiiu_gfx_set_shader(void *data,
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int j = 0; j < 2 && j < wiiu->pass[i].gfd->vs->uniformBlockCount; j++)
|
||||
for (j = 0; j < 2 && j < wiiu->pass[i].gfd->vs->uniformBlockCount; j++)
|
||||
{
|
||||
wiiu->pass[i].vs_ubos[j] = MEM2_alloc(wiiu->pass[i].gfd->vs->uniformBlocks[j].size,
|
||||
GX2_UNIFORM_BLOCK_ALIGNMENT);
|
||||
GX2_UNIFORM_BLOCK_ALIGNMENT);
|
||||
memset(wiiu->pass[i].vs_ubos[j], 0, wiiu->pass[i].gfd->vs->uniformBlocks[j].size);
|
||||
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_UNIFORM_BLOCK, wiiu->pass[i].vs_ubos[j],
|
||||
wiiu->pass[i].gfd->vs->uniformBlocks[j].size);
|
||||
wiiu->pass[i].gfd->vs->uniformBlocks[j].size);
|
||||
}
|
||||
|
||||
for (int j = 0; j < 2 && j < wiiu->pass[i].gfd->ps->uniformBlockCount; j++)
|
||||
for (j = 0; j < 2 && j < wiiu->pass[i].gfd->ps->uniformBlockCount; j++)
|
||||
{
|
||||
wiiu->pass[i].ps_ubos[j] = MEM2_alloc(wiiu->pass[i].gfd->ps->uniformBlocks[j].size,
|
||||
GX2_UNIFORM_BLOCK_ALIGNMENT);
|
||||
GX2_UNIFORM_BLOCK_ALIGNMENT);
|
||||
memset(wiiu->pass[i].ps_ubos[j], 0, wiiu->pass[i].gfd->ps->uniformBlocks[j].size);
|
||||
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_UNIFORM_BLOCK, wiiu->pass[i].ps_ubos[j],
|
||||
wiiu->pass[i].gfd->ps->uniformBlocks[j].size);
|
||||
wiiu->pass[i].gfd->ps->uniformBlocks[j].size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1495,6 +1501,8 @@ static bool wiiu_gfx_set_shader(void *data,
|
||||
|
||||
if (image_texture_load(&image, wiiu->shader_preset->lut[i].path))
|
||||
{
|
||||
unsigned j;
|
||||
|
||||
wiiu->luts[i].surface.width = image.width;
|
||||
wiiu->luts[i].surface.height = image.height;
|
||||
wiiu->luts[i].surface.depth = 1;
|
||||
@@ -1510,7 +1518,7 @@ static bool wiiu_gfx_set_shader(void *data,
|
||||
wiiu->luts[i].surface.image = MEM2_alloc(wiiu->luts[i].surface.imageSize,
|
||||
wiiu->luts[i].surface.alignment);
|
||||
|
||||
for (int j = 0; (j < image.height) && (j < wiiu->luts[i].surface.height); j++)
|
||||
for (j = 0; (j < image.height) && (j < wiiu->luts[i].surface.height); j++)
|
||||
memcpy((uint32_t *)wiiu->luts[i].surface.image + (j * wiiu->luts[i].surface.pitch),
|
||||
image.pixels + (j * image.width), image.width * sizeof(image.pixels));
|
||||
|
||||
|
||||
@@ -1574,6 +1574,7 @@ static bool gx_frame(void *data, const void *frame,
|
||||
unsigned overscan_corr_bottom = settings->uints.video_overscan_correction_bottom;
|
||||
bool video_smooth = settings->bools.video_smooth;
|
||||
unsigned video_aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
fps_text_buf[0] = '\0';
|
||||
|
||||
@@ -1615,7 +1616,7 @@ static bool gx_frame(void *data, const void *frame,
|
||||
gx->old_height = height;
|
||||
}
|
||||
|
||||
g_draw_done = false;
|
||||
g_draw_done = false;
|
||||
gx->current_framebuf ^= 1;
|
||||
|
||||
if (frame)
|
||||
@@ -1649,7 +1650,7 @@ static bool gx_frame(void *data, const void *frame,
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
GX_InvalidateTexAll();
|
||||
|
||||
+21
-14
@@ -178,26 +178,30 @@ static bool network_gfx_frame(void *data, const void *frame,
|
||||
unsigned pixfmt = NETWORK_VIDEO_PIXELFORMAT_RGB565;
|
||||
bool draw = true;
|
||||
network_video_t *network = (network_video_t*)data;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (!frame || !frame_width || !frame_height)
|
||||
return true;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
if (network_video_width != frame_width || network_video_height != frame_height || network_video_pitch != pitch)
|
||||
if ( network_video_width != frame_width ||
|
||||
network_video_height != frame_height ||
|
||||
network_video_pitch != pitch)
|
||||
{
|
||||
if (frame_width > 4 && frame_height > 4)
|
||||
{
|
||||
network_video_width = frame_width;
|
||||
network_video_height = frame_height;
|
||||
network_video_pitch = pitch;
|
||||
network->screen_width = network_video_width;
|
||||
network_video_width = frame_width;
|
||||
network_video_height = frame_height;
|
||||
network_video_pitch = pitch;
|
||||
network->screen_width = network_video_width;
|
||||
network->screen_height = network_video_height;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if (network_menu_frame && video_info->menu_is_alive)
|
||||
{
|
||||
frame_to_copy = network_menu_frame;
|
||||
@@ -207,16 +211,21 @@ static bool network_gfx_frame(void *data, const void *frame,
|
||||
bits = network_menu_bits;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
width = network_video_width;
|
||||
height = network_video_height;
|
||||
pitch = network_video_pitch;
|
||||
|
||||
if (frame_width == 4 && frame_height == 4 && (frame_width < width && frame_height < height))
|
||||
if ( frame_width == 4 &&
|
||||
frame_height == 4 &&
|
||||
(frame_width < width && frame_height < height))
|
||||
draw = false;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if (video_info->menu_is_alive)
|
||||
draw = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (network->video_width != width || network->video_height != height)
|
||||
@@ -225,9 +234,7 @@ static bool network_gfx_frame(void *data, const void *frame,
|
||||
network->video_height = height;
|
||||
|
||||
if (network_video_temp_buf)
|
||||
{
|
||||
free(network_video_temp_buf);
|
||||
}
|
||||
|
||||
network_video_temp_buf = (unsigned*)malloc(network->screen_width * network->screen_height * sizeof(unsigned));
|
||||
}
|
||||
@@ -246,8 +253,8 @@ static bool network_gfx_frame(void *data, const void *frame,
|
||||
for (x = 0; x < network->screen_width; x++)
|
||||
{
|
||||
/* scale incoming frame to fit the screen */
|
||||
unsigned scaled_x = (width * x) / network->screen_width;
|
||||
unsigned scaled_y = (height * y) / network->screen_height;
|
||||
unsigned scaled_x = (width * x) / network->screen_width;
|
||||
unsigned scaled_y = (height * y) / network->screen_height;
|
||||
unsigned short pixel = ((unsigned short*)frame_to_copy)[width * scaled_y + scaled_x];
|
||||
|
||||
/* convert RGBX4444 to RGBX8888 */
|
||||
@@ -272,8 +279,8 @@ static bool network_gfx_frame(void *data, const void *frame,
|
||||
for (x = 0; x < network->screen_width; x++)
|
||||
{
|
||||
/* scale incoming frame to fit the screen */
|
||||
unsigned scaled_x = (width * x) / network->screen_width;
|
||||
unsigned scaled_y = (height * y) / network->screen_height;
|
||||
unsigned scaled_x = (width * x) / network->screen_width;
|
||||
unsigned scaled_y = (height * y) / network->screen_height;
|
||||
unsigned short pixel = ((unsigned short*)frame_to_copy)[(pitch / (bits / 8)) * scaled_y + scaled_x];
|
||||
|
||||
/* convert RGB565 to RGBX8888 */
|
||||
@@ -306,7 +313,7 @@ static bool network_gfx_frame(void *data, const void *frame,
|
||||
/* scale incoming frame to fit the screen */
|
||||
unsigned scaled_x = (width * x) / network->screen_width;
|
||||
unsigned scaled_y = (height * y) / network->screen_height;
|
||||
unsigned pixel = ((unsigned*)frame_to_copy)[(pitch / (bits / 8)) * scaled_y + scaled_x];
|
||||
unsigned pixel = ((unsigned*)frame_to_copy)[(pitch / (bits / 8)) * scaled_y + scaled_x];
|
||||
|
||||
network_video_temp_buf[network->screen_width * y + x] = pixel;
|
||||
}
|
||||
|
||||
+180
-157
@@ -76,85 +76,91 @@ go2_rotation_t oga_rotation = GO2_ROTATION_DEGREES_0;
|
||||
|
||||
static void oga_gfx_free(void *data)
|
||||
{
|
||||
oga_video_t *vid = (oga_video_t*)data;
|
||||
if (!vid)
|
||||
return;
|
||||
unsigned i;
|
||||
oga_video_t *vid = (oga_video_t*)data;
|
||||
|
||||
if (vid->font) {
|
||||
vid->font_driver->free(vid->font);
|
||||
vid->font_driver = NULL;
|
||||
}
|
||||
if (!vid)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < NUM_PAGES; ++i)
|
||||
{
|
||||
go2_frame_buffer_t* frameBuffer = vid->frameBuffer[i];
|
||||
go2_surface_t* surface = go2_frame_buffer_surface_get(frameBuffer);
|
||||
if (vid->font)
|
||||
{
|
||||
vid->font_driver->free(vid->font);
|
||||
vid->font_driver = NULL;
|
||||
}
|
||||
|
||||
go2_frame_buffer_destroy(frameBuffer);
|
||||
go2_surface_destroy(surface);
|
||||
}
|
||||
for (i = 0; i < NUM_PAGES; ++i)
|
||||
{
|
||||
go2_frame_buffer_t* frameBuffer = vid->frameBuffer[i];
|
||||
go2_surface_t* surface = go2_frame_buffer_surface_get(frameBuffer);
|
||||
|
||||
go2_surface_destroy(vid->frame);
|
||||
go2_surface_destroy(vid->menu_surface);
|
||||
go2_presenter_destroy(vid->presenter);
|
||||
go2_display_destroy(vid->display);
|
||||
go2_frame_buffer_destroy(frameBuffer);
|
||||
go2_surface_destroy(surface);
|
||||
}
|
||||
|
||||
free(vid);
|
||||
vid = NULL;
|
||||
go2_surface_destroy(vid->frame);
|
||||
go2_surface_destroy(vid->menu_surface);
|
||||
go2_presenter_destroy(vid->presenter);
|
||||
go2_display_destroy(vid->display);
|
||||
|
||||
free(vid);
|
||||
vid = NULL;
|
||||
}
|
||||
|
||||
static void *oga_gfx_init(const video_info_t *video,
|
||||
input_driver_t **input, void **input_data)
|
||||
{
|
||||
oga_video_t *vid = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
|
||||
oga_video_t *vid = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
|
||||
|
||||
frontend_driver_install_signal_handler();
|
||||
|
||||
if (input && input_data) {
|
||||
void* udev = input_udev.init(settings->arrays.input_joypad_driver);
|
||||
if (udev) {
|
||||
*input = &input_udev;
|
||||
*input_data = udev;
|
||||
}
|
||||
else
|
||||
*input = NULL;
|
||||
}
|
||||
if (input && input_data)
|
||||
{
|
||||
void* udev = input_udev.init(settings->arrays.input_joypad_driver);
|
||||
if (udev)
|
||||
{
|
||||
*input = &input_udev;
|
||||
*input_data = udev;
|
||||
}
|
||||
else
|
||||
*input = NULL;
|
||||
}
|
||||
|
||||
vid = (oga_video_t*)calloc(1, sizeof(*vid));
|
||||
vid = (oga_video_t*)calloc(1, sizeof(*vid));
|
||||
|
||||
vid->menu_frame = NULL;
|
||||
vid->display = go2_display_create();
|
||||
vid->presenter = go2_presenter_create(vid->display, DRM_FORMAT_RGB565, 0xff000000, false);
|
||||
vid->menu_surface = go2_surface_create(vid->display, NATIVE_WIDTH, NATIVE_HEIGHT, DRM_FORMAT_RGB565);
|
||||
vid->font = NULL;
|
||||
vid->font_driver = NULL;
|
||||
vid->menu_frame = NULL;
|
||||
vid->display = go2_display_create();
|
||||
vid->presenter = go2_presenter_create(vid->display, DRM_FORMAT_RGB565, 0xff000000, false);
|
||||
vid->menu_surface = go2_surface_create(vid->display, NATIVE_WIDTH, NATIVE_HEIGHT, DRM_FORMAT_RGB565);
|
||||
vid->font = NULL;
|
||||
vid->font_driver = NULL;
|
||||
|
||||
int aw = MAX(ALIGN(av_info->geometry.max_width, 32), NATIVE_WIDTH);
|
||||
int ah = MAX(ALIGN(av_info->geometry.max_height, 32), NATIVE_HEIGHT);
|
||||
int aw = MAX(ALIGN(av_info->geometry.max_width, 32), NATIVE_WIDTH);
|
||||
int ah = MAX(ALIGN(av_info->geometry.max_height, 32), NATIVE_HEIGHT);
|
||||
|
||||
printf("oga_gfx_init video %dx%d rgb32 %d smooth %d input_scale %u force_aspect %d fullscreen %d aw %d ah %d rgb %d\n",
|
||||
video->width, video->height, video->rgb32, video->smooth, video->input_scale, video->force_aspect,
|
||||
video->fullscreen, aw, ah, video->rgb32);
|
||||
printf("oga_gfx_init video %dx%d rgb32 %d smooth %d input_scale %u force_aspect %d fullscreen %d aw %d ah %d rgb %d\n",
|
||||
video->width, video->height, video->rgb32, video->smooth, video->input_scale, video->force_aspect,
|
||||
video->fullscreen, aw, ah, video->rgb32);
|
||||
|
||||
vid->frame = go2_surface_create(vid->display, aw, ah, video->rgb32 ? DRM_FORMAT_XRGB8888 : DRM_FORMAT_RGB565);
|
||||
vid->frame = go2_surface_create(vid->display, aw, ah, video->rgb32 ? DRM_FORMAT_XRGB8888 : DRM_FORMAT_RGB565);
|
||||
|
||||
// bitmap only for now
|
||||
if (settings->bools.video_font_enable) {
|
||||
vid->font_driver = &bitmap_font_renderer;
|
||||
vid->font = vid->font_driver->init("", settings->floats.video_font_size);
|
||||
}
|
||||
/* bitmap only for now */
|
||||
if (settings->bools.video_font_enable)
|
||||
{
|
||||
vid->font_driver = &bitmap_font_renderer;
|
||||
vid->font = vid->font_driver->init("", settings->floats.video_font_size);
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUM_PAGES; ++i)
|
||||
{
|
||||
go2_surface_t* surface = go2_surface_create(vid->display, NATIVE_HEIGHT, NATIVE_WIDTH,
|
||||
video->rgb32 ? DRM_FORMAT_XRGB8888 : DRM_FORMAT_XRGB8888);
|
||||
vid->frameBuffer[i] = go2_frame_buffer_create(surface);
|
||||
}
|
||||
vid->cur_page = 0;
|
||||
for (int i = 0; i < NUM_PAGES; ++i)
|
||||
{
|
||||
go2_surface_t* surface = go2_surface_create(vid->display, NATIVE_HEIGHT, NATIVE_WIDTH,
|
||||
video->rgb32 ? DRM_FORMAT_XRGB8888 : DRM_FORMAT_XRGB8888);
|
||||
vid->frameBuffer[i] = go2_frame_buffer_create(surface);
|
||||
}
|
||||
vid->cur_page = 0;
|
||||
|
||||
return vid;
|
||||
return vid;
|
||||
}
|
||||
|
||||
int get_message_width(oga_video_t* vid, const char* msg)
|
||||
@@ -171,110 +177,126 @@ int get_message_width(oga_video_t* vid, const char* msg)
|
||||
return width;
|
||||
}
|
||||
|
||||
static void render_msg(oga_video_t* vid, go2_surface_t* surface, const char* msg, int width, int bpp)
|
||||
static void render_msg(oga_video_t* vid,
|
||||
go2_surface_t* surface, const char* msg, int width, int bpp)
|
||||
{
|
||||
const struct font_atlas* atlas = vid->font_driver->get_atlas(vid->font);
|
||||
int msg_width = get_message_width(vid, msg);
|
||||
int dest_x = MAX(0, width - get_message_width(vid, msg));
|
||||
int dest_stride = go2_surface_stride_get(surface);
|
||||
const struct font_atlas* atlas = vid->font_driver->get_atlas(vid->font);
|
||||
int msg_width = get_message_width(vid, msg);
|
||||
int dest_x = MAX(0, width - get_message_width(vid, msg));
|
||||
int dest_stride = go2_surface_stride_get(surface);
|
||||
const char *c = msg;
|
||||
|
||||
const char* c = msg;
|
||||
while (*c) {
|
||||
const struct font_glyph* g = vid->font_driver->get_glyph(vid->font, *c);
|
||||
if (!g)
|
||||
continue;
|
||||
if (dest_x + g->advance_x >= width)
|
||||
break;
|
||||
while (*c)
|
||||
{
|
||||
const struct font_glyph* g = vid->font_driver->get_glyph(vid->font, *c);
|
||||
if (!g)
|
||||
continue;
|
||||
if (dest_x + g->advance_x >= width)
|
||||
break;
|
||||
|
||||
const uint8_t* source = atlas->buffer + g->atlas_offset_y * atlas->width + g->atlas_offset_x;
|
||||
uint8_t* dest = (uint8_t*)go2_surface_map(surface) + dest_x * bpp;
|
||||
const uint8_t* source = atlas->buffer + g->atlas_offset_y * atlas->width + g->atlas_offset_x;
|
||||
uint8_t* dest = (uint8_t*)go2_surface_map(surface) + dest_x * bpp;
|
||||
|
||||
for (int y = 0; y < g->height; y++) {
|
||||
for (int x = 0; x < g->advance_x; x++) {
|
||||
uint8_t px = (x < g->width) ? *(source++) : 0x00;
|
||||
if (bpp == 4) {
|
||||
*(dest++) = px;
|
||||
*(dest++) = px;
|
||||
*(dest++) = px;
|
||||
*(dest++) = px;
|
||||
}
|
||||
else {
|
||||
*(dest++) = px;
|
||||
*(dest++) = px;
|
||||
}
|
||||
for (int y = 0; y < g->height; y++)
|
||||
{
|
||||
for (int x = 0; x < g->advance_x; x++)
|
||||
{
|
||||
uint8_t px = (x < g->width) ? *(source++) : 0x00;
|
||||
if (bpp == 4)
|
||||
{
|
||||
*(dest++) = px;
|
||||
*(dest++) = px;
|
||||
*(dest++) = px;
|
||||
*(dest++) = px;
|
||||
}
|
||||
dest += dest_stride - g->advance_x * bpp;
|
||||
source += atlas->width - g->width;
|
||||
}
|
||||
else
|
||||
{
|
||||
*(dest++) = px;
|
||||
*(dest++) = px;
|
||||
}
|
||||
}
|
||||
dest += dest_stride - g->advance_x * bpp;
|
||||
source += atlas->width - g->width;
|
||||
}
|
||||
|
||||
c++;
|
||||
dest_x += g->advance_x;
|
||||
}
|
||||
c++;
|
||||
dest_x += g->advance_x;
|
||||
}
|
||||
}
|
||||
|
||||
static bool oga_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg, video_frame_info_t *video_info)
|
||||
{
|
||||
oga_video_t* vid = (oga_video_t*)data;
|
||||
go2_surface_t* dst_surface = vid->frame;
|
||||
uint8_t* src = (uint8_t*)frame;
|
||||
int bpp = go2_drm_format_get_bpp(go2_surface_format_get(dst_surface)) / 8;
|
||||
int out_w, out_h;
|
||||
int yy, stride, dst_stride;
|
||||
int out_x = 0;
|
||||
int out_y = 0;
|
||||
go2_display_t *display = NULL;
|
||||
go2_frame_buffer_t *dstFrameBuffer = NULL;
|
||||
go2_surface_t *dstSurface = NULL;
|
||||
uint8_t *dst = NULL;
|
||||
oga_video_t *vid = (oga_video_t*)data;
|
||||
go2_surface_t *dst_surface = vid->frame;
|
||||
uint8_t *src = (uint8_t*)frame;
|
||||
int bpp = go2_drm_format_get_bpp(
|
||||
go2_surface_format_get(dst_surface)) / 8;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (unlikely(video_info->menu_is_alive)) {
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
if (unlikely(menu_is_alive))
|
||||
{
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
dst_surface = vid->menu_surface;
|
||||
src = (uint8_t*)vid->menu_frame;
|
||||
width = vid->menu_width;
|
||||
height = vid->menu_height;
|
||||
pitch = vid->menu_pitch;
|
||||
bpp = vid->menu_pitch / vid->menu_width;
|
||||
}
|
||||
#endif
|
||||
dst_surface = vid->menu_surface;
|
||||
src = (uint8_t*)vid->menu_frame;
|
||||
width = vid->menu_width;
|
||||
height = vid->menu_height;
|
||||
pitch = vid->menu_pitch;
|
||||
bpp = vid->menu_pitch / vid->menu_width;
|
||||
}
|
||||
|
||||
if (unlikely(!frame || width == 0 || height == 0))
|
||||
return true;
|
||||
if (unlikely(!frame || width == 0 || height == 0))
|
||||
return true;
|
||||
|
||||
// copy buffer to surface
|
||||
uint8_t* dst = (uint8_t*)go2_surface_map(dst_surface);
|
||||
int yy = height;
|
||||
int stride = width * bpp;
|
||||
int dst_stride = go2_surface_stride_get(dst_surface);
|
||||
while (yy > 0) {
|
||||
memcpy(dst, src, stride);
|
||||
src += pitch;
|
||||
dst += dst_stride;
|
||||
--yy;
|
||||
}
|
||||
/* copy buffer to surface */
|
||||
dst = (uint8_t*)go2_surface_map(dst_surface);
|
||||
yy = height;
|
||||
stride = width * bpp;
|
||||
dst_stride = go2_surface_stride_get(dst_surface);
|
||||
|
||||
int out_w = NATIVE_WIDTH;
|
||||
int out_h = NATIVE_HEIGHT;
|
||||
int out_x = 0;
|
||||
int out_y = 0;
|
||||
while (yy > 0)
|
||||
{
|
||||
memcpy(dst, src, stride);
|
||||
src += pitch;
|
||||
dst += dst_stride;
|
||||
--yy;
|
||||
}
|
||||
|
||||
if ((out_w != width || out_h != height))
|
||||
{
|
||||
out_w = MIN(out_h * video_driver_get_aspect_ratio(), NATIVE_WIDTH);
|
||||
out_x = MAX((NATIVE_WIDTH - out_w) / 2, 0);
|
||||
}
|
||||
out_w = NATIVE_WIDTH;
|
||||
out_h = NATIVE_HEIGHT;
|
||||
|
||||
if (msg && vid->font) {
|
||||
render_msg(vid, dst_surface, msg, width, bpp);
|
||||
}
|
||||
if ((out_w != width || out_h != height))
|
||||
{
|
||||
out_w = MIN(out_h * video_driver_get_aspect_ratio(), NATIVE_WIDTH);
|
||||
out_x = MAX((NATIVE_WIDTH - out_w) / 2, 0);
|
||||
}
|
||||
|
||||
go2_frame_buffer_t* dstFrameBuffer = vid->frameBuffer[vid->cur_page];
|
||||
go2_surface_t* dstSurface = go2_frame_buffer_surface_get(dstFrameBuffer);
|
||||
if (msg && vid->font)
|
||||
render_msg(vid, dst_surface, msg, width, bpp);
|
||||
|
||||
go2_surface_blit(dst_surface, 0, 0, width, height,
|
||||
dstSurface, out_y, out_x, out_h, out_w,
|
||||
!video_info->menu_is_alive ? oga_rotation : GO2_ROTATION_DEGREES_270, 2);
|
||||
dstFrameBuffer = vid->frameBuffer[vid->cur_page];
|
||||
dstSurface = go2_frame_buffer_surface_get(dstFrameBuffer);
|
||||
|
||||
go2_display_t* display = go2_presenter_display_get(vid->presenter);
|
||||
go2_display_present(display, dstFrameBuffer);
|
||||
vid->cur_page = !vid->cur_page;
|
||||
go2_surface_blit(dst_surface, 0, 0, width, height,
|
||||
dstSurface, out_y, out_x, out_h, out_w,
|
||||
!menu_is_alive ? oga_rotation : GO2_ROTATION_DEGREES_270, 2);
|
||||
|
||||
return true;
|
||||
display = go2_presenter_display_get(vid->presenter);
|
||||
go2_display_present(display, dstFrameBuffer);
|
||||
vid->cur_page = !vid->cur_page;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void oga_set_texture_frame(void *data, const void *frame, bool rgb32,
|
||||
@@ -353,25 +375,26 @@ static const video_poke_interface_t oga_poke_interface = {
|
||||
|
||||
void oga_set_rotation(void *data, unsigned rotation)
|
||||
{
|
||||
// called before init?
|
||||
(void)data;
|
||||
switch (rotation) {
|
||||
case 0:
|
||||
oga_rotation = GO2_ROTATION_DEGREES_270;
|
||||
break;
|
||||
case 1:
|
||||
oga_rotation = GO2_ROTATION_DEGREES_180;
|
||||
break;
|
||||
case 2:
|
||||
oga_rotation = GO2_ROTATION_DEGREES_90;
|
||||
break;
|
||||
case 3:
|
||||
oga_rotation = GO2_ROTATION_DEGREES_0;
|
||||
break;
|
||||
default:
|
||||
RARCH_ERR("Unhandled rotation %hu\n", rotation);
|
||||
break;
|
||||
}
|
||||
/* called before init? */
|
||||
(void)data;
|
||||
switch (rotation)
|
||||
{
|
||||
case 0:
|
||||
oga_rotation = GO2_ROTATION_DEGREES_270;
|
||||
break;
|
||||
case 1:
|
||||
oga_rotation = GO2_ROTATION_DEGREES_180;
|
||||
break;
|
||||
case 2:
|
||||
oga_rotation = GO2_ROTATION_DEGREES_90;
|
||||
break;
|
||||
case 3:
|
||||
oga_rotation = GO2_ROTATION_DEGREES_0;
|
||||
break;
|
||||
default:
|
||||
RARCH_ERR("Unhandled rotation %hu\n", rotation);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void oga_get_poke_interface(void *data, const video_poke_interface_t **iface)
|
||||
|
||||
@@ -989,7 +989,8 @@ static bool omap_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
omap_video_t *vid = (omap_video_t*)data;
|
||||
omap_video_t *vid = (omap_video_t*)data;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (!frame)
|
||||
return true;
|
||||
@@ -1012,13 +1013,13 @@ static bool omap_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
omapfb_blit_frame(vid->omap, frame, vid->height, pitch);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
#endif
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
|
||||
if (vid->menu.active)
|
||||
omapfb_blit_frame(vid->omap, vid->menu.frame,
|
||||
vid->menu.scaler.out_height,
|
||||
vid->menu.scaler.out_stride);
|
||||
#endif
|
||||
|
||||
if (msg)
|
||||
omap_render_msg(vid, msg);
|
||||
|
||||
+18
-118
@@ -33,7 +33,6 @@
|
||||
|
||||
typedef struct ps2_video
|
||||
{
|
||||
bool clearVRAM;
|
||||
/* I need to create this additional field
|
||||
* to be used in the font driver*/
|
||||
bool clearVRAM_font;
|
||||
@@ -93,6 +92,8 @@ static GSTEXTURE *prepare_new_texture(void)
|
||||
static void init_ps2_video(ps2_video_t *ps2)
|
||||
{
|
||||
ps2->gsGlobal = init_GSGlobal();
|
||||
gsKit_TexManager_init(ps2->gsGlobal);
|
||||
|
||||
ps2->menuTexture = prepare_new_texture();
|
||||
ps2->coreTexture = prepare_new_texture();
|
||||
|
||||
@@ -108,16 +109,8 @@ static void ps2_gfx_deinit_texture(GSTEXTURE *texture)
|
||||
texture->Clut = NULL;
|
||||
}
|
||||
|
||||
static bool texture_need_prepare(GSTEXTURE *texture,
|
||||
int width, int height, int PSM)
|
||||
{
|
||||
return texture->Width != width ||
|
||||
texture->Height != height ||
|
||||
texture->PSM != PSM;
|
||||
}
|
||||
|
||||
static void transfer_texture(GSTEXTURE *texture, const void *frame,
|
||||
int width, int height, int PSM, int filter, bool color_correction)
|
||||
static void set_texture(GSTEXTURE *texture, const void *frame,
|
||||
int width, int height, int PSM, int filter)
|
||||
{
|
||||
texture->Width = width;
|
||||
texture->Height = height;
|
||||
@@ -126,25 +119,6 @@ static void transfer_texture(GSTEXTURE *texture, const void *frame,
|
||||
texture->Mem = (void *)frame;
|
||||
}
|
||||
|
||||
static void vram_alloc(GSGLOBAL *gsGlobal, GSTEXTURE *texture)
|
||||
{
|
||||
uint32_t size = gsKit_texture_size(texture->Width,
|
||||
texture->Height, texture->PSM);
|
||||
texture->Vram = gsKit_vram_alloc(gsGlobal, size, GSKIT_ALLOC_USERBUFFER);
|
||||
|
||||
if(texture->Vram == GSKIT_ALLOC_ERROR)
|
||||
{
|
||||
printf("VRAM Allocation Failed. Will not upload texture.\n");
|
||||
}
|
||||
|
||||
if (texture->Clut)
|
||||
{
|
||||
/* Right now just supporting 16 x 16 = 256 colours */
|
||||
size = gsKit_texture_size(16, 16, texture->ClutPSM);
|
||||
texture->VramClut = gsKit_vram_alloc(gsGlobal, size , GSKIT_ALLOC_USERBUFFER);
|
||||
}
|
||||
}
|
||||
|
||||
static void prim_texture(GSGLOBAL *gsGlobal, GSTEXTURE *texture, int zPosition, bool force_aspect, struct retro_hw_ps2_insets padding)
|
||||
{
|
||||
float x1, y1, x2, y2;
|
||||
@@ -185,65 +159,13 @@ static void prim_texture(GSGLOBAL *gsGlobal, GSTEXTURE *texture, int zPosition,
|
||||
GS_TEXT);
|
||||
}
|
||||
|
||||
static void clearVRAMIfNeeded(ps2_video_t *ps2,
|
||||
const void *frame, int width, int height)
|
||||
{
|
||||
if (!ps2->clearVRAM)
|
||||
{
|
||||
if(frame && frame != RETRO_HW_FRAME_BUFFER_VALID)
|
||||
{
|
||||
bool coreVRAMClear = texture_need_prepare(
|
||||
ps2->coreTexture, width, height, ps2->PSM);
|
||||
ps2->clearVRAM = ps2->clearVRAM || coreVRAMClear;
|
||||
}
|
||||
}
|
||||
|
||||
if (ps2->clearVRAM)
|
||||
{
|
||||
gsKit_vram_clear(ps2->gsGlobal);
|
||||
ps2->iface.updatedPalette = true;
|
||||
/* we need to upload also palette in the font driver */
|
||||
ps2->clearVRAM_font = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void refreshScreen(ps2_video_t *ps2)
|
||||
{
|
||||
if (ps2->vsync)
|
||||
gsKit_sync_flip(ps2->gsGlobal);
|
||||
gsKit_queue_exec(ps2->gsGlobal);
|
||||
gsKit_TexManager_nextFrame(ps2->gsGlobal);
|
||||
|
||||
/* Here we are just puting in false the ps2->clearVRAM field
|
||||
however, the ps2->clearVRAM_font should be done in the ps2_font driver */
|
||||
ps2->clearVRAM = false;
|
||||
}
|
||||
|
||||
static void ps2_texture_upload(GSGLOBAL *gsGlobal, GSTEXTURE *Texture,
|
||||
bool sendPalette)
|
||||
{
|
||||
gsKit_setup_tbw(Texture);
|
||||
|
||||
if (Texture->PSM == GS_PSM_T8)
|
||||
{
|
||||
gsKit_texture_send(Texture->Mem, Texture->Width, Texture->Height, Texture->Vram, Texture->PSM, Texture->TBW, GS_CLUT_TEXTURE);
|
||||
if (sendPalette)
|
||||
{
|
||||
gsKit_texture_send(Texture->Clut, 16, 16, Texture->VramClut, Texture->ClutPSM, 1, GS_CLUT_PALLETE);
|
||||
}
|
||||
|
||||
}
|
||||
else if (Texture->PSM == GS_PSM_T4)
|
||||
{
|
||||
gsKit_texture_send(Texture->Mem, Texture->Width, Texture->Height, Texture->Vram, Texture->PSM, Texture->TBW, GS_CLUT_TEXTURE);
|
||||
if (sendPalette)
|
||||
{
|
||||
gsKit_texture_send(Texture->Clut, 8, 2, Texture->VramClut, Texture->ClutPSM, 1, GS_CLUT_PALLETE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gsKit_texture_send(Texture->Mem, Texture->Width, Texture->Height, Texture->Vram, Texture->PSM, Texture->TBW, GS_CLUT_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void *ps2_gfx_init(const video_info_t *video,
|
||||
@@ -270,7 +192,6 @@ static void *ps2_gfx_init(const video_info_t *video,
|
||||
ps2->core_filter = video->smooth ? GS_FILTER_LINEAR : GS_FILTER_NEAREST;
|
||||
ps2->force_aspect = video->force_aspect;
|
||||
ps2->vsync = video->vsync;
|
||||
ps2->clearVRAM = true;
|
||||
|
||||
if (input && input_data)
|
||||
{
|
||||
@@ -294,43 +215,30 @@ static bool ps2_gfx_frame(void *data, const void *frame,
|
||||
return false;
|
||||
|
||||
#if defined(DEBUG)
|
||||
if (frame_count%60==0)
|
||||
{
|
||||
if (frame_count%180==0)
|
||||
printf("ps2_gfx_frame %lu\n", frame_count);
|
||||
}
|
||||
#endif
|
||||
|
||||
clearVRAMIfNeeded(ps2, frame, width, height);
|
||||
gsKit_clear(ps2->gsGlobal, GS_BLACK);
|
||||
|
||||
if (frame)
|
||||
{
|
||||
bool sendPalette = false;
|
||||
struct retro_hw_ps2_insets padding = empty_ps2_insets;
|
||||
/* Checking if the transfer is done in the core */
|
||||
if (frame != RETRO_HW_FRAME_BUFFER_VALID)
|
||||
{
|
||||
/* Checking if the transfer is done in the core */
|
||||
{
|
||||
/* calculate proper width based in the pitch */
|
||||
int bytes_per_pixel = (ps2->PSM == GS_PSM_CT32) ? 4 : 2;
|
||||
int real_width = pitch / bytes_per_pixel;
|
||||
|
||||
transfer_texture(ps2->coreTexture, frame, real_width, height, ps2->PSM, ps2->core_filter, 1);
|
||||
int shifh_per_bytes = (ps2->PSM == GS_PSM_CT32) ? 2 : 1;
|
||||
int real_width = pitch >> shifh_per_bytes;
|
||||
set_texture(ps2->coreTexture, frame, real_width, height, ps2->PSM, ps2->core_filter);
|
||||
|
||||
padding.right = real_width - width;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendPalette = ps2->iface.updatedPalette;
|
||||
ps2->iface.updatedPalette = false;
|
||||
padding = ps2->iface.padding;
|
||||
if (ps2->iface.clearTexture)
|
||||
ps2->iface.clearTexture = false;
|
||||
}
|
||||
|
||||
if(ps2->clearVRAM)
|
||||
vram_alloc(ps2->gsGlobal, ps2->coreTexture);
|
||||
|
||||
ps2_texture_upload(ps2->gsGlobal, ps2->coreTexture, sendPalette);
|
||||
gsKit_TexManager_invalidate(ps2->gsGlobal, ps2->coreTexture);
|
||||
gsKit_TexManager_bind(ps2->gsGlobal, ps2->coreTexture);
|
||||
prim_texture(ps2->gsGlobal, ps2->coreTexture, 1, ps2->force_aspect, padding);
|
||||
}
|
||||
|
||||
@@ -339,9 +247,6 @@ static bool ps2_gfx_frame(void *data, const void *frame,
|
||||
bool texture_empty = !ps2->menuTexture->Width || !ps2->menuTexture->Height;
|
||||
if (!texture_empty)
|
||||
{
|
||||
if(ps2->clearVRAM)
|
||||
vram_alloc(ps2->gsGlobal, ps2->menuTexture);
|
||||
gsKit_texture_upload(ps2->gsGlobal, ps2->menuTexture);
|
||||
prim_texture(ps2->gsGlobal, ps2->menuTexture, 2, ps2->fullscreen, empty_ps2_insets);
|
||||
}
|
||||
}
|
||||
@@ -412,12 +317,11 @@ static void ps2_set_texture_frame(void *data, const void *frame, bool rgb32,
|
||||
{
|
||||
ps2_video_t *ps2 = (ps2_video_t*)data;
|
||||
|
||||
bool color_correction = false;
|
||||
int PSM = (rgb32 ? GS_PSM_CT32 : GS_PSM_CT16);
|
||||
bool texture_changed = texture_need_prepare(ps2->menuTexture, width, height, PSM);
|
||||
|
||||
transfer_texture(ps2->menuTexture, frame, width, height, PSM, ps2->menu_filter, color_correction);
|
||||
ps2->clearVRAM = ps2->clearVRAM || texture_changed;
|
||||
set_texture(ps2->menuTexture, frame, width, height, PSM, ps2->menu_filter);
|
||||
gsKit_TexManager_invalidate(ps2->gsGlobal, ps2->menuTexture);
|
||||
gsKit_TexManager_bind(ps2->gsGlobal, ps2->menuTexture);
|
||||
}
|
||||
|
||||
static void ps2_set_texture_enable(void *data, bool enable, bool fullscreen)
|
||||
@@ -426,10 +330,8 @@ static void ps2_set_texture_enable(void *data, bool enable, bool fullscreen)
|
||||
|
||||
if (ps2->menuVisible != enable)
|
||||
{
|
||||
/* If Menu change status, CLEAR VRAM */
|
||||
ps2->clearVRAM = true;
|
||||
ps2->iface.clearTexture = true;
|
||||
ps2->iface.updatedPalette = true;
|
||||
/* If Menu change status, CLEAR SCREEN */
|
||||
gsKit_clear(ps2->gsGlobal, GS_BLACK);
|
||||
}
|
||||
ps2->menuVisible = enable;
|
||||
ps2->fullscreen = fullscreen;
|
||||
@@ -439,8 +341,6 @@ static bool ps2_get_hw_render_interface(void* data,
|
||||
const struct retro_hw_render_interface** iface)
|
||||
{
|
||||
ps2_video_t *ps2 = (ps2_video_t*)data;
|
||||
ps2->iface.clearTexture = ps2->clearVRAM;
|
||||
ps2->iface.updatedPalette = true;
|
||||
ps2->iface.padding = empty_ps2_insets;
|
||||
*iface =
|
||||
(const struct retro_hw_render_interface*)&ps2->iface;
|
||||
|
||||
@@ -475,7 +475,8 @@ static bool psp_frame(void *data, const void *frame,
|
||||
unsigned width, unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg, video_frame_info_t *video_info)
|
||||
{
|
||||
psp1_video_t *psp = (psp1_video_t*)data;
|
||||
psp1_video_t *psp = (psp1_video_t*)data;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (!width || !height)
|
||||
return false;
|
||||
@@ -536,7 +537,7 @@ static bool psp_frame(void *data, const void *frame,
|
||||
sceGuFinish();
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
if(psp->menu.active)
|
||||
|
||||
@@ -487,13 +487,14 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg, video_frame_info_t *video_info)
|
||||
{
|
||||
sdl2_video_t *vid = (sdl2_video_t*)data;
|
||||
char title[128];
|
||||
sdl2_video_t *vid = (sdl2_video_t*)data;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (vid->should_resize)
|
||||
sdl_refresh_viewport(vid);
|
||||
|
||||
if (frame && video_info->libretro_running)
|
||||
if (frame)
|
||||
{
|
||||
SDL_RenderClear(vid->renderer);
|
||||
sdl_refresh_input_size(vid, false, vid->video.rgb32, width, height, pitch);
|
||||
@@ -503,7 +504,7 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
SDL_RenderCopyEx(vid->renderer, vid->frame.tex, NULL, NULL, vid->rotation, NULL, SDL_FLIP_NONE);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
if (vid->menu.active)
|
||||
|
||||
@@ -70,9 +70,10 @@ static void *sdl_dingux_gfx_init(const video_info_t *video,
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
FILE* f = fopen("/sys/devices/platform/jz-lcd.0/allow_downscaling", "w");
|
||||
if (f) {
|
||||
fprintf(f, "%d", 1);
|
||||
fclose(f);
|
||||
if (f)
|
||||
{
|
||||
fprintf(f, "%d", 1);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
if (SDL_WasInit(0) == 0)
|
||||
@@ -130,19 +131,21 @@ error:
|
||||
|
||||
static void clear_screen(void* data)
|
||||
{
|
||||
sdl_dingux_video_t* vid = (sdl_dingux_video_t*)data;
|
||||
SDL_FillRect(vid->screen, 0, 0);
|
||||
SDL_Flip(vid->screen);
|
||||
SDL_FillRect(vid->screen, 0, 0);
|
||||
SDL_Flip(vid->screen);
|
||||
SDL_FillRect(vid->screen, 0, 0);
|
||||
SDL_Flip(vid->screen);
|
||||
sdl_dingux_video_t* vid = (sdl_dingux_video_t*)data;
|
||||
SDL_FillRect(vid->screen, 0, 0);
|
||||
SDL_Flip(vid->screen);
|
||||
SDL_FillRect(vid->screen, 0, 0);
|
||||
SDL_Flip(vid->screen);
|
||||
SDL_FillRect(vid->screen, 0, 0);
|
||||
SDL_Flip(vid->screen);
|
||||
}
|
||||
|
||||
static void set_output(sdl_dingux_video_t* vid, int width, int height, int pitch, bool rgb)
|
||||
static void sdl_dingux_set_output(
|
||||
sdl_dingux_video_t* vid,
|
||||
int width, int height, int pitch, bool rgb)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
printf("set_output current w %d h %d pitch %d new_w %d new_h %d pitch %d rgb %d\n",
|
||||
printf("sdl_dingux_set_output current w %d h %d pitch %d new_w %d new_h %d pitch %d rgb %d\n",
|
||||
vid->screen->w, vid->screen->h, vid->screen->pitch, width, height, pitch, (int)vid->rgb);
|
||||
#endif
|
||||
|
||||
@@ -153,61 +156,62 @@ static void set_output(sdl_dingux_video_t* vid, int width, int height, int pitch
|
||||
|
||||
static void blit(uint32_t* d, uint32_t* s, int width, int height, int pitch)
|
||||
{
|
||||
int skip = pitch/4 - width;
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
for (int j = 0; j < width; j++)
|
||||
*(d++) = *(s++);
|
||||
s += skip;
|
||||
}
|
||||
unsigned i;
|
||||
int skip = pitch/4 - width;
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
unsigned j;
|
||||
for (j = 0; j < width; j++)
|
||||
*(d++) = *(s++);
|
||||
s += skip;
|
||||
}
|
||||
}
|
||||
|
||||
static bool sdl_dingux_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg, video_frame_info_t *video_info)
|
||||
{
|
||||
sdl_dingux_video_t* vid = (sdl_dingux_video_t*)data;
|
||||
sdl_dingux_video_t* vid = (sdl_dingux_video_t*)data;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (unlikely(!frame))
|
||||
return true;
|
||||
if (unlikely(!frame))
|
||||
return true;
|
||||
|
||||
if (unlikely((vid->screen->w != width || vid->screen->h != height) && !vid->menu_active))
|
||||
{
|
||||
set_output(vid, width, height, pitch, vid->rgb);
|
||||
}
|
||||
if (unlikely((vid->screen->w != width || vid->screen->h != height) && !vid->menu_active))
|
||||
sdl_dingux_set_output(vid, width, height, pitch, vid->rgb);
|
||||
|
||||
menu_driver_frame(video_info);
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
if (likely(!vid->menu_active))
|
||||
{
|
||||
blit((uint32_t*)vid->screen->pixels, (uint32_t*)frame, vid->rgb ? width : width/2, height, pitch);
|
||||
if (unlikely(vid->was_in_menu))
|
||||
vid->was_in_menu = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!vid->was_in_menu)
|
||||
{
|
||||
set_output(vid, 320, 240, 320*2, false);
|
||||
vid->was_in_menu = true;
|
||||
}
|
||||
memcpy(vid->screen->pixels, vid->menu_frame, 320*240*2);
|
||||
}
|
||||
if (likely(!vid->menu_active))
|
||||
{
|
||||
blit((uint32_t*)vid->screen->pixels, (uint32_t*)frame, vid->rgb ? width : width/2, height, pitch);
|
||||
if (unlikely(vid->was_in_menu))
|
||||
vid->was_in_menu = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!vid->was_in_menu)
|
||||
{
|
||||
sdl_dingux_set_output(vid, 320, 240, 320*2, false);
|
||||
vid->was_in_menu = true;
|
||||
}
|
||||
memcpy(vid->screen->pixels, vid->menu_frame, 320*240*2);
|
||||
}
|
||||
|
||||
SDL_Flip(vid->screen);
|
||||
SDL_Flip(vid->screen);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void sdl_dingux_set_texture_enable(void *data, bool state, bool full_screen)
|
||||
{
|
||||
sdl_dingux_video_t *vid = (sdl_dingux_video_t*)data;
|
||||
(void)full_screen;
|
||||
sdl_dingux_video_t *vid = (sdl_dingux_video_t*)data;
|
||||
(void)full_screen;
|
||||
|
||||
if (vid->menu_active != state)
|
||||
{
|
||||
vid->menu_active = state;
|
||||
}
|
||||
if (vid->menu_active != state)
|
||||
vid->menu_active = state;
|
||||
}
|
||||
|
||||
static void sdl_dingux_set_texture_frame(void *data, const void *frame, bool rgb32,
|
||||
|
||||
@@ -363,8 +363,9 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg, video_frame_info_t *video_info)
|
||||
{
|
||||
sdl_video_t *vid = (sdl_video_t*)data;
|
||||
char title[128];
|
||||
sdl_video_t *vid = (sdl_video_t*)data;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (!frame)
|
||||
return true;
|
||||
@@ -389,11 +390,11 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
pitch);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
#endif
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
|
||||
if (vid->menu.active)
|
||||
SDL_BlitSurface(vid->menu.frame, NULL, vid->screen, NULL);
|
||||
#endif
|
||||
|
||||
if (msg)
|
||||
sdl_render_msg(vid, vid->screen,
|
||||
|
||||
@@ -269,12 +269,13 @@ static bool sixel_gfx_frame(void *data, const void *frame,
|
||||
unsigned pixfmt = SIXEL_PIXELFORMAT_RGB565;
|
||||
bool draw = true;
|
||||
sixel_t *sixel = (sixel_t*)data;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (!frame || !frame_width || !frame_height)
|
||||
return true;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
if (sixel_video_width != frame_width || sixel_video_height != frame_height || sixel_video_pitch != pitch)
|
||||
@@ -418,7 +419,7 @@ static bool sixel_gfx_frame(void *data, const void *frame,
|
||||
|
||||
if (SIXEL_FAILED(sixel->sixel_status))
|
||||
{
|
||||
fprintf(stderr, "%s\n%s\n",
|
||||
RARCH_ERR("%s\n%s\n",
|
||||
sixel_helper_format_error(sixel->sixel_status),
|
||||
sixel_helper_get_additional_message());
|
||||
}
|
||||
|
||||
@@ -776,6 +776,7 @@ static bool sunxi_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
struct sunxi_video *_dispvars = (struct sunxi_video*)data;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (_dispvars->src_width != width || _dispvars->src_height != height)
|
||||
{
|
||||
@@ -790,7 +791,7 @@ static bool sunxi_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
if (_dispvars->menu_active)
|
||||
|
||||
+17
-16
@@ -142,7 +142,7 @@ static bool switch_frame(void *data, const void *frame,
|
||||
uint64_t frame_count, unsigned pitch,
|
||||
const char *msg, video_frame_info_t *video_info)
|
||||
{
|
||||
static uint64_t last_frame = 0;
|
||||
static uint64_t last_frame = 0;
|
||||
|
||||
unsigned x, y;
|
||||
result_t r;
|
||||
@@ -152,6 +152,7 @@ static bool switch_frame(void *data, const void *frame,
|
||||
int xsf = 1280 / width;
|
||||
int ysf = 720 / height;
|
||||
int sf = xsf;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (ysf < sf)
|
||||
sf = ysf;
|
||||
@@ -170,8 +171,8 @@ static bool switch_frame(void *data, const void *frame,
|
||||
|
||||
if(width > 0 && height > 0)
|
||||
{
|
||||
if(sw->last_width != width ||
|
||||
sw->last_height != height)
|
||||
if(sw->last_width != width ||
|
||||
sw->last_height != height)
|
||||
{
|
||||
scaler_ctx_gen_reset(&sw->scaler);
|
||||
|
||||
@@ -197,31 +198,31 @@ static bool switch_frame(void *data, const void *frame,
|
||||
sw->last_height = height;
|
||||
}
|
||||
|
||||
scaler_ctx_scale(&sw->scaler, sw->image + (centery * 1280) + centerx, frame);
|
||||
scaler_ctx_scale(&sw->scaler, sw->image + (centery * 1280) + centerx, frame);
|
||||
}
|
||||
|
||||
#if defined(HAVE_MENU)
|
||||
if (sw->menu_texture.enable)
|
||||
{
|
||||
menu_driver_frame(video_info);
|
||||
{
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
|
||||
if (sw->menu_texture.pixels)
|
||||
{
|
||||
if (sw->menu_texture.pixels)
|
||||
{
|
||||
#if 0
|
||||
if (sw->menu_texture.fullscreen)
|
||||
if (sw->menu_texture.fullscreen)
|
||||
{
|
||||
#endif
|
||||
scaler_ctx_scale(&sw->menu_texture.scaler, sw->image +
|
||||
((720-sw->menu_texture.tgth)/2)*1280 +
|
||||
((1280-sw->menu_texture.tgtw)/2), sw->menu_texture.pixels);
|
||||
scaler_ctx_scale(&sw->menu_texture.scaler, sw->image +
|
||||
((720-sw->menu_texture.tgth)/2)*1280 +
|
||||
((1280-sw->menu_texture.tgtw)/2), sw->menu_texture.pixels);
|
||||
#if 0
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (video_info->statistics_show)
|
||||
{
|
||||
struct font_params *osd_params = (struct font_params*)
|
||||
@@ -246,11 +247,11 @@ static bool switch_frame(void *data, const void *frame,
|
||||
|
||||
r = surface_dequeue_buffer(&sw->surface, &out_buffer);
|
||||
if(r != RESULT_OK)
|
||||
return true; /* just skip the frame */
|
||||
return true; /* just skip the frame */
|
||||
|
||||
r = surface_wait_buffer(&sw->surface);
|
||||
if(r != RESULT_OK)
|
||||
return true;
|
||||
return true;
|
||||
gfx_slow_swizzling_blit(out_buffer, sw->image, 1280, 720, 0, 0);
|
||||
|
||||
r = surface_queue_buffer(&sw->surface);
|
||||
|
||||
+107
-104
@@ -344,135 +344,138 @@ static bool switch_frame(void *data, const void *frame,
|
||||
uint64_t frame_count, unsigned pitch,
|
||||
const char *msg, video_frame_info_t *video_info)
|
||||
{
|
||||
switch_video_t *sw = data;
|
||||
uint32_t *out_buffer = NULL;
|
||||
bool ffwd_mode = video_info->input_driver_nonblock_state;
|
||||
uint32_t stride;
|
||||
switch_video_t *sw = data;
|
||||
uint32_t *out_buffer = NULL;
|
||||
bool ffwd_mode = video_info->input_driver_nonblock_state;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (!frame)
|
||||
return true;
|
||||
if (!frame)
|
||||
return true;
|
||||
|
||||
if (ffwd_mode && !sw->is_threaded)
|
||||
{
|
||||
/* render every 4th frame when in ffwd mode and not threaded */
|
||||
if ((frame_count % 4) != 0)
|
||||
return true;
|
||||
}
|
||||
if (ffwd_mode && !sw->is_threaded)
|
||||
{
|
||||
/* render every 4th frame when in ffwd mode and not threaded */
|
||||
if ((frame_count % 4) != 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( sw->should_resize ||
|
||||
width != sw->last_width ||
|
||||
height != sw->last_height)
|
||||
{
|
||||
switch_update_viewport(sw, video_info);
|
||||
if ( sw->should_resize ||
|
||||
width != sw->last_width ||
|
||||
height != sw->last_height)
|
||||
{
|
||||
switch_update_viewport(sw, video_info);
|
||||
|
||||
/* Sanity check */
|
||||
sw->vp.width = MIN(sw->vp.width, sw->vp.full_width);
|
||||
sw->vp.height = MIN(sw->vp.height, sw->vp.full_height);
|
||||
/* Sanity check */
|
||||
sw->vp.width = MIN(sw->vp.width, sw->vp.full_width);
|
||||
sw->vp.height = MIN(sw->vp.height, sw->vp.full_height);
|
||||
|
||||
scaler_ctx_gen_reset(&sw->scaler);
|
||||
scaler_ctx_gen_reset(&sw->scaler);
|
||||
|
||||
sw->scaler.in_width = width;
|
||||
sw->scaler.in_height = height;
|
||||
sw->scaler.in_stride = pitch;
|
||||
sw->scaler.in_fmt = sw->rgb32
|
||||
? SCALER_FMT_ARGB8888
|
||||
: SCALER_FMT_RGB565;
|
||||
sw->scaler.in_width = width;
|
||||
sw->scaler.in_height = height;
|
||||
sw->scaler.in_stride = pitch;
|
||||
sw->scaler.in_fmt = sw->rgb32
|
||||
? SCALER_FMT_ARGB8888
|
||||
: SCALER_FMT_RGB565;
|
||||
|
||||
if (!sw->smooth)
|
||||
{
|
||||
sw->scaler.out_width = sw->vp.width;
|
||||
sw->scaler.out_height = sw->vp.height;
|
||||
sw->scaler.out_stride = sw->vp.full_width * sizeof(uint32_t);
|
||||
}
|
||||
else
|
||||
{
|
||||
sw->scaler.out_width = width;
|
||||
sw->scaler.out_height = height;
|
||||
sw->scaler.out_stride = width * sizeof(uint32_t);
|
||||
if (!sw->smooth)
|
||||
{
|
||||
sw->scaler.out_width = sw->vp.width;
|
||||
sw->scaler.out_height = sw->vp.height;
|
||||
sw->scaler.out_stride = sw->vp.full_width * sizeof(uint32_t);
|
||||
}
|
||||
else
|
||||
{
|
||||
sw->scaler.out_width = width;
|
||||
sw->scaler.out_height = height;
|
||||
sw->scaler.out_stride = width * sizeof(uint32_t);
|
||||
|
||||
float screen_ratio = (float)sw->vp.full_width / sw->vp.full_height;
|
||||
float tgt_ratio = (float)sw->vp.width / sw->vp.height;
|
||||
float screen_ratio = (float)sw->vp.full_width / sw->vp.full_height;
|
||||
float tgt_ratio = (float)sw->vp.width / sw->vp.height;
|
||||
|
||||
sw->hw_scale.width = ceil(screen_ratio / tgt_ratio * sw->scaler.out_width);
|
||||
sw->hw_scale.height = sw->scaler.out_height;
|
||||
sw->hw_scale.x_offset = ceil((sw->hw_scale.width - sw->scaler.out_width) / 2.0);
|
||||
if (!video_info->menu_is_alive)
|
||||
{
|
||||
clear_screen(sw);
|
||||
nwindowSetDimensions(sw->win, sw->hw_scale.width, sw->hw_scale.height);
|
||||
}
|
||||
}
|
||||
sw->scaler.out_fmt = SCALER_FMT_ABGR8888;
|
||||
sw->hw_scale.width = ceil(screen_ratio / tgt_ratio * sw->scaler.out_width);
|
||||
sw->hw_scale.height = sw->scaler.out_height;
|
||||
sw->hw_scale.x_offset = ceil((sw->hw_scale.width - sw->scaler.out_width) / 2.0);
|
||||
if (!video_info->menu_is_alive)
|
||||
{
|
||||
clear_screen(sw);
|
||||
nwindowSetDimensions(sw->win, sw->hw_scale.width, sw->hw_scale.height);
|
||||
}
|
||||
}
|
||||
sw->scaler.out_fmt = SCALER_FMT_ABGR8888;
|
||||
|
||||
sw->scaler.scaler_type = SCALER_TYPE_POINT;
|
||||
sw->scaler.scaler_type = SCALER_TYPE_POINT;
|
||||
|
||||
if (!scaler_ctx_gen_filter(&sw->scaler))
|
||||
return false;
|
||||
if (!scaler_ctx_gen_filter(&sw->scaler))
|
||||
return false;
|
||||
|
||||
sw->last_width = width;
|
||||
sw->last_height = height;
|
||||
sw->last_width = width;
|
||||
sw->last_height = height;
|
||||
|
||||
sw->should_resize = false;
|
||||
}
|
||||
sw->should_resize = false;
|
||||
}
|
||||
|
||||
uint32_t stride;
|
||||
out_buffer = (uint32_t *)framebufferBegin(&sw->fb, &stride);
|
||||
sw->out_buffer = out_buffer;
|
||||
sw->stride = stride;
|
||||
|
||||
out_buffer = (uint32_t *)framebufferBegin(&sw->fb, &stride);
|
||||
sw->out_buffer = out_buffer;
|
||||
sw->stride = stride;
|
||||
if (sw->in_menu && !video_info->menu_is_alive && sw->smooth)
|
||||
{
|
||||
memset(out_buffer, 0, stride * sw->vp.full_height);
|
||||
nwindowSetDimensions(sw->win, sw->hw_scale.width, sw->hw_scale.height);
|
||||
}
|
||||
sw->in_menu = video_info->menu_is_alive;
|
||||
|
||||
if (sw->in_menu && !video_info->menu_is_alive && sw->smooth)
|
||||
{
|
||||
memset(out_buffer, 0, stride * sw->vp.full_height);
|
||||
nwindowSetDimensions(sw->win, sw->hw_scale.width, sw->hw_scale.height);
|
||||
}
|
||||
sw->in_menu = video_info->menu_is_alive;
|
||||
#ifdef HAVE_MENU
|
||||
if (sw->menu_texture.enable)
|
||||
{
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
|
||||
if (sw->menu_texture.enable)
|
||||
{
|
||||
menu_driver_frame(video_info);
|
||||
if (sw->menu_texture.pixels)
|
||||
{
|
||||
memset(out_buffer, 0, stride * sw->vp.full_height);
|
||||
scaler_ctx_scale(&sw->menu_texture.scaler, sw->tmp_image + ((sw->vp.full_height - sw->menu_texture.tgth) / 2) * sw->vp.full_width + ((sw->vp.full_width - sw->menu_texture.tgtw) / 2), sw->menu_texture.pixels);
|
||||
gfx_cpy_dsp_buf(out_buffer, sw->tmp_image, sw->vp.full_width, sw->vp.full_height, stride, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (sw->smooth) /* bilinear */
|
||||
{
|
||||
int w, h;
|
||||
unsigned x, y;
|
||||
struct scaler_ctx *ctx = &sw->scaler;
|
||||
scaler_ctx_scale_direct(ctx, sw->image, frame);
|
||||
w = sw->scaler.out_width;
|
||||
h = sw->scaler.out_height;
|
||||
|
||||
if (sw->menu_texture.pixels)
|
||||
{
|
||||
memset(out_buffer, 0, stride * sw->vp.full_height);
|
||||
scaler_ctx_scale(&sw->menu_texture.scaler, sw->tmp_image + ((sw->vp.full_height - sw->menu_texture.tgth) / 2) * sw->vp.full_width + ((sw->vp.full_width - sw->menu_texture.tgtw) / 2), sw->menu_texture.pixels);
|
||||
gfx_cpy_dsp_buf(out_buffer, sw->tmp_image, sw->vp.full_width, sw->vp.full_height, stride, true);
|
||||
}
|
||||
}
|
||||
else if (sw->smooth) /* bilinear */
|
||||
{
|
||||
int w, h;
|
||||
unsigned x, y;
|
||||
struct scaler_ctx *ctx = &sw->scaler;
|
||||
scaler_ctx_scale_direct(ctx, sw->image, frame);
|
||||
w = sw->scaler.out_width;
|
||||
h = sw->scaler.out_height;
|
||||
|
||||
for (y = 0; y < h; y++)
|
||||
for (y = 0; y < h; y++)
|
||||
for (x = 0; x < w; x++)
|
||||
out_buffer[y * stride / sizeof(uint32_t) + (x + sw->hw_scale.x_offset)] = sw->image[y * w + x];
|
||||
}
|
||||
else
|
||||
{
|
||||
struct scaler_ctx *ctx = &sw->scaler;
|
||||
scaler_ctx_scale(ctx, sw->image + (sw->vp.y * sw->vp.full_width) + sw->vp.x, frame);
|
||||
gfx_cpy_dsp_buf(out_buffer, sw->image, sw->vp.full_width, sw->vp.full_height, stride, false);
|
||||
}
|
||||
out_buffer[y * stride / sizeof(uint32_t) + (x + sw->hw_scale.x_offset)] = sw->image[y * w + x];
|
||||
}
|
||||
else
|
||||
{
|
||||
struct scaler_ctx *ctx = &sw->scaler;
|
||||
scaler_ctx_scale(ctx, sw->image + (sw->vp.y * sw->vp.full_width) + sw->vp.x, frame);
|
||||
gfx_cpy_dsp_buf(out_buffer, sw->image, sw->vp.full_width, sw->vp.full_height, stride, false);
|
||||
}
|
||||
|
||||
if (video_info->statistics_show && !sw->smooth)
|
||||
{
|
||||
struct font_params *osd_params = (struct font_params *)&video_info->osd_stat_params;
|
||||
if (video_info->statistics_show && !sw->smooth)
|
||||
{
|
||||
struct font_params *osd_params = (struct font_params *)&video_info->osd_stat_params;
|
||||
|
||||
if (osd_params)
|
||||
font_driver_render_msg(sw, video_info->stat_text,
|
||||
(const struct font_params *)&video_info->osd_stat_params, NULL);
|
||||
}
|
||||
if (osd_params)
|
||||
font_driver_render_msg(sw, video_info->stat_text,
|
||||
(const struct font_params *)&video_info->osd_stat_params, NULL);
|
||||
}
|
||||
|
||||
if (msg)
|
||||
font_driver_render_msg(sw, msg, NULL, NULL);
|
||||
if (msg)
|
||||
font_driver_render_msg(sw, msg, NULL, NULL);
|
||||
|
||||
framebufferEnd(&sw->fb);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void switch_set_nonblock_state(void *data, bool toggle, bool c, unsigned d)
|
||||
|
||||
+4
-3
@@ -416,8 +416,9 @@ static bool vg_frame(void *data, const void *frame,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
vg_t *vg = (vg_t*)data;
|
||||
unsigned width = video_info->width;
|
||||
unsigned height = video_info->height;
|
||||
unsigned width = video_info->width;
|
||||
unsigned height = video_info->height;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if ( frame_width != vg->mRenderWidth
|
||||
|| frame_height != vg->mRenderHeight
|
||||
@@ -444,7 +445,7 @@ static bool vg_frame(void *data, const void *frame,
|
||||
vg_copy_frame(vg, frame, frame_width, frame_height, pitch);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
vgDrawImage(vg->mImage);
|
||||
|
||||
@@ -144,12 +144,13 @@ static bool vga_gfx_frame(void *data, const void *frame,
|
||||
const void *frame_to_copy = frame;
|
||||
bool draw = true;
|
||||
vga_t *vga = (vga_t*)data;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (!frame || !frame_width || !frame_height)
|
||||
return true;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
if ( vga->vga_video_width != frame_width ||
|
||||
|
||||
@@ -145,6 +145,7 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
|
||||
{
|
||||
void *tex_p;
|
||||
vita_video_t *vita = (vita_video_t *)data;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (frame)
|
||||
{
|
||||
@@ -209,7 +210,7 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
|
||||
PSP_FB_HEIGHT / (float)vita->height);
|
||||
else
|
||||
{
|
||||
const float radian = 90 * 0.0174532925f;
|
||||
const float radian = 270 * 0.0174532925f;
|
||||
const float rad = vita->rotation * radian;
|
||||
float scalex = vita->vp.width / (float)vita->width;
|
||||
float scaley = vita->vp.height / (float)vita->height;
|
||||
@@ -221,7 +222,7 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
|
||||
if (vita->menu.active)
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
if(vita->menu.texture)
|
||||
|
||||
@@ -1685,6 +1685,7 @@ static bool vulkan_frame(void *data, const void *frame,
|
||||
unsigned video_height = video_info->height;
|
||||
struct font_params *osd_params = (struct font_params*)
|
||||
&video_info->osd_stat_params;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
VkCommandBufferBeginInfo begin_info = {
|
||||
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO };
|
||||
@@ -1934,7 +1935,7 @@ static bool vulkan_frame(void *data, const void *frame,
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool menu_linear_filter = settings->bools.menu_linear_filter;
|
||||
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
|
||||
if (vk->menu.textures[vk->menu.last_index].image != VK_NULL_HANDLE ||
|
||||
vk->menu.textures[vk->menu.last_index].buffer != VK_NULL_HANDLE)
|
||||
|
||||
@@ -198,7 +198,8 @@ static bool xenon360_gfx_frame(void *data,
|
||||
uint64_t frame_count, unsigned pitch, const char *msg,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
xenos_t *xenos = (xenos_t*)data;
|
||||
xenos_t *xenos = (xenos_t*)data;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
ScreenUv[UV_TOP] = ((float) (width) / (float) XE_W)*2;
|
||||
ScreenUv[UV_LEFT] = ((float) (height) / (float) XE_H)*2;
|
||||
@@ -238,7 +239,7 @@ static bool xenon360_gfx_frame(void *data,
|
||||
Xe_SetShader(xenos->device, SHADER_TYPE_VERTEX, xenos->g_pVertexShader, 0);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
/* Draw */
|
||||
|
||||
+76
-35
@@ -32,17 +32,17 @@
|
||||
#include "../../menu/menu_driver.h"
|
||||
#endif
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../font_driver.h"
|
||||
|
||||
#include "../common/x11_common.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct xshm
|
||||
{
|
||||
Display* display;
|
||||
Window wndw;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
bool use_shm;
|
||||
uint8_t *fbptr;
|
||||
|
||||
XShmSegmentInfo shmInfo;
|
||||
XImage* image;
|
||||
@@ -54,66 +54,107 @@ static void *xshm_gfx_init(const video_info_t *video,
|
||||
{
|
||||
xshm_t* xshm = (xshm_t*)malloc(sizeof(xshm_t));
|
||||
Window parent;
|
||||
XSetWindowAttributes attributes;
|
||||
|
||||
XInitThreads();
|
||||
|
||||
xshm->display = XOpenDisplay(NULL);
|
||||
g_x11_dpy = XOpenDisplay(NULL);
|
||||
|
||||
xshm->use_shm = true;
|
||||
|
||||
if (!XShmQueryExtension(g_x11_dpy))
|
||||
{
|
||||
RARCH_LOG("[X11]: XShm extension not found.\n");
|
||||
xshm->use_shm = false;
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
parent = DefaultRootWindow(xshm->display);
|
||||
parent = DefaultRootWindow(g_x11_dpy);
|
||||
#else
|
||||
parent = video->parent;
|
||||
#endif
|
||||
XSetWindowAttributes attributes;
|
||||
attributes.border_pixel=0;
|
||||
xshm->wndw = XCreateWindow(xshm->display, parent,
|
||||
0, 0, video->width, video->height,
|
||||
0, 24, CopyFromParent, NULL, CWBorderPixel, &attributes);
|
||||
XSetWindowBackground(xshm->display, xshm->wndw, 0);
|
||||
XMapWindow(xshm->display, xshm->wndw);
|
||||
g_x11_win = XCreateWindow(g_x11_dpy, parent,
|
||||
0, 0, video->width, video->height,
|
||||
0, 24, CopyFromParent, NULL, CWBorderPixel, &attributes);
|
||||
XSetWindowBackground(g_x11_dpy, g_x11_win, 0);
|
||||
XMapWindow(g_x11_dpy, g_x11_win);
|
||||
|
||||
xshm->shmInfo.shmid = shmget(IPC_PRIVATE, sizeof(uint32_t) * video->width * video->height,
|
||||
IPC_CREAT|0600);
|
||||
if (xshm->shmInfo.shmid<0) abort();//seems like an out of memory situation... let's just blow up
|
||||
if (xshm->use_shm)
|
||||
{
|
||||
xshm->shmInfo.shmid = shmget(IPC_PRIVATE, sizeof(uint32_t) * video->width * video->height,
|
||||
IPC_CREAT|0600);
|
||||
if (xshm->shmInfo.shmid<0) abort();/* seems like an out of memory situation... let's just blow up. */
|
||||
|
||||
xshm->shmInfo.shmaddr = (char*)shmat(xshm->shmInfo.shmid, 0, 0);
|
||||
xshm->shmInfo.readOnly = False;
|
||||
XShmAttach(xshm->display, &xshm->shmInfo);
|
||||
XSync(xshm->display, False);//no idea why this is required, but I get weird errors without it
|
||||
xshm->image = XShmCreateImage(xshm->display, NULL, 24, ZPixmap,
|
||||
xshm->shmInfo.shmaddr, &xshm->shmInfo, video->width, video->height);
|
||||
xshm->shmInfo.shmaddr = (char*)shmat(xshm->shmInfo.shmid, 0, 0);
|
||||
xshm->shmInfo.readOnly = False;
|
||||
XShmAttach(g_x11_dpy, &xshm->shmInfo);
|
||||
XSync(g_x11_dpy, False);/* no idea why this is required, but I get weird errors without it. */
|
||||
xshm->image = XShmCreateImage(g_x11_dpy, NULL, 24, ZPixmap,
|
||||
xshm->shmInfo.shmaddr, &xshm->shmInfo, video->width, video->height);
|
||||
xshm->fbptr = (uint8_t*)xshm->shmInfo.shmaddr;
|
||||
} else {
|
||||
size_t pitch = video->width * 4;
|
||||
void *data = malloc (pitch * video->height);
|
||||
if (!data) abort();/* seems like an out of memory situation... let's just blow up. */
|
||||
xshm->image = XCreateImage(g_x11_dpy, NULL, 24, ZPixmap, 0,
|
||||
(char *) data, video->width,
|
||||
video->height, 8, pitch);
|
||||
xshm->fbptr = (uint8_t*)data;
|
||||
XSync(g_x11_dpy, False);
|
||||
}
|
||||
|
||||
xshm->gc = XCreateGC(xshm->display, xshm->wndw, 0, NULL);
|
||||
xshm->gc = XCreateGC(g_x11_dpy, g_x11_win, 0, NULL);
|
||||
|
||||
xshm->width = video->width;
|
||||
xshm->height = video->height;
|
||||
|
||||
if (input) *input = NULL;
|
||||
if (input_data) *input_data = NULL;
|
||||
if (!x11_input_ctx_new(true))
|
||||
goto error;
|
||||
|
||||
if (input && input_data)
|
||||
{
|
||||
void *xinput = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
xinput = input_x.init(settings->arrays.input_joypad_driver);
|
||||
if (xinput)
|
||||
{
|
||||
*input = &input_x;
|
||||
*input_data = xinput;
|
||||
}
|
||||
else
|
||||
*input = NULL;
|
||||
}
|
||||
|
||||
return xshm;
|
||||
error:
|
||||
free (xshm);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool xshm_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg, video_frame_info_t *video_info)
|
||||
{
|
||||
xshm_t* xshm = (xshm_t*)data;
|
||||
int y;
|
||||
unsigned y;
|
||||
xshm_t *xshm = (xshm_t*)data;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
for (y=0;y<height;y++)
|
||||
{
|
||||
memcpy((uint8_t*)xshm->shmInfo.shmaddr + sizeof(uint32_t)*xshm->width*y,
|
||||
for (y = 0; y < height; y++)
|
||||
memcpy(xshm->fbptr + sizeof(uint32_t)*xshm->width*y,
|
||||
(uint8_t*)frame + pitch*y, pitch);
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
XShmPutImage(xshm->display, xshm->wndw, xshm->gc, xshm->image,
|
||||
0, 0, 0, 0, xshm->width, xshm->height, False);
|
||||
XFlush(xshm->display);
|
||||
if (xshm->use_shm)
|
||||
XShmPutImage(g_x11_dpy, g_x11_win, xshm->gc, xshm->image,
|
||||
0, 0, 0, 0, xshm->width, xshm->height, False);
|
||||
else
|
||||
XPutImage(g_x11_dpy, g_x11_win, xshm->gc, xshm->image,
|
||||
0, 0, 0, 0, xshm->width, xshm->height);
|
||||
XFlush(g_x11_dpy);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -234,7 +275,7 @@ video_driver_t video_xshm = {
|
||||
NULL, /* has_windowed */
|
||||
xshm_gfx_set_shader,
|
||||
xshm_gfx_free,
|
||||
"xshm",
|
||||
"x11",
|
||||
|
||||
NULL,
|
||||
NULL, /* set_rotation */
|
||||
|
||||
+225
-58
@@ -83,6 +83,10 @@ typedef struct xv
|
||||
|
||||
void (*render_func)(struct xv*, const void *frame,
|
||||
unsigned width, unsigned height, unsigned pitch);
|
||||
|
||||
void (*render_glyph)(struct xv*, int base_x, int base_y,
|
||||
const uint8_t *glyph, int atlas_width,
|
||||
int glyph_width, int glyph_height);
|
||||
} xv_t;
|
||||
|
||||
static void xv_set_nonblock_state(void *data, bool state, bool c, unsigned d)
|
||||
@@ -295,34 +299,242 @@ static void render32_uyvy(xv_t *xv, const void *input_,
|
||||
}
|
||||
}
|
||||
|
||||
static void render32_yuv12(xv_t *xv, const void *input_,
|
||||
unsigned width, unsigned height, unsigned pitch)
|
||||
{
|
||||
unsigned x, y;
|
||||
const uint32_t *input = (const uint32_t*)input_;
|
||||
unsigned w0 = xv->width >> 1;
|
||||
unsigned w1 = w0 << 1;
|
||||
unsigned h0 = xv->height >> 1;
|
||||
uint8_t *output = (uint8_t*)xv->image->data;
|
||||
uint8_t *outputu = (uint8_t*)xv->image->data + 4 * w0 * h0;
|
||||
uint8_t *outputv = (uint8_t*)xv->image->data + 5 * w0 * h0;
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
uint8_t y0, u, v;
|
||||
unsigned img_width;
|
||||
uint32_t p = *input++;
|
||||
p = ((p >> 8) & 0xf800) | ((p >> 5) & 0x07e0)
|
||||
| ((p >> 3) & 0x1f); /* ARGB -> RGB16 */
|
||||
|
||||
y0 = xv->ytable[p];
|
||||
u = xv->utable[p];
|
||||
v = xv->vtable[p];
|
||||
|
||||
output[0] = output[w1] = y0;
|
||||
output[1] = output[w1+1] = y0;
|
||||
output+=2;
|
||||
*outputu++ = u;
|
||||
*outputv++ = v;
|
||||
}
|
||||
|
||||
input += (pitch >> 2) - width;
|
||||
output += 4 * w0 - 2 * width;
|
||||
outputu += (w0 - width);
|
||||
outputv += (w0 - width);
|
||||
}
|
||||
}
|
||||
|
||||
static void render16_yuv12(xv_t *xv, const void *input_,
|
||||
unsigned width, unsigned height, unsigned pitch)
|
||||
{
|
||||
unsigned x, y;
|
||||
const uint16_t *input = (const uint16_t*)input_;
|
||||
unsigned w0 = xv->width >> 1;
|
||||
unsigned w1 = w0 << 1;
|
||||
unsigned h0 = xv->height >> 1;
|
||||
uint8_t *output = (uint8_t*)xv->image->data;
|
||||
uint8_t *outputu = (uint8_t*)xv->image->data + 4 * w0 * h0;
|
||||
uint8_t *outputv = (uint8_t*)xv->image->data + 5 * w0 * h0;
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
uint16_t p = *input++;
|
||||
uint8_t y0 = xv->ytable[p];
|
||||
uint8_t u = xv->utable[p];
|
||||
uint8_t v = xv->vtable[p];
|
||||
|
||||
output[0] = output[w1] = y0;
|
||||
output[1] = output[w1+1] = y0;
|
||||
output+=2;
|
||||
*outputu++ = u;
|
||||
*outputv++ = v;
|
||||
}
|
||||
|
||||
input += (pitch >> 1) - width;
|
||||
output += 4 * w0 - 2 * width;
|
||||
outputu += (w0 - width);
|
||||
outputv += (w0 - width);
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void render_glyph_yuv12(xv_t *xv, int base_x, int base_y,
|
||||
const uint8_t *glyph, int atlas_width,
|
||||
int glyph_width, int glyph_height)
|
||||
{
|
||||
uint8_t *out_luma, *out_u, *out_v;
|
||||
int x, y, i;
|
||||
|
||||
out_luma = (uint8_t*)xv->image->data + base_y * xv->width + (base_x);
|
||||
out_u = (uint8_t*)xv->image->data + xv->width * xv->height + (base_y / 2) * xv->width / 2 + (base_x / 2);
|
||||
out_v= (uint8_t*)xv->image->data + xv->width * xv->height * 5 / 4 + (base_y / 2) * xv->width / 2 + (base_x / 2);
|
||||
|
||||
for (y = 0; y < glyph_height; y++, glyph += atlas_width, out_luma += xv->width)
|
||||
{
|
||||
/* 2 input pixels => 4 bytes (2Y, 1U, 1V). */
|
||||
|
||||
for (x = 0; x < glyph_width; x += 2)
|
||||
{
|
||||
unsigned alpha[2], alpha_sub, blended;
|
||||
|
||||
alpha[0] = glyph[x + 0];
|
||||
alpha[1] = 0;
|
||||
|
||||
if (x + 1 < glyph_width)
|
||||
alpha[1] = glyph[x + 1];
|
||||
|
||||
/* Blended alpha for the sub-sampled U/V channels. */
|
||||
alpha_sub = (alpha[0] + alpha[1]) >> 1;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
unsigned blended = (xv->font_y * alpha[i]
|
||||
+ ((256 - alpha[i]) * out_luma[x+i])) >> 8;
|
||||
out_luma[x+i] = blended;
|
||||
}
|
||||
|
||||
/* Blend chroma channels */
|
||||
if (y & 1)
|
||||
{
|
||||
blended = (xv->font_u * alpha_sub
|
||||
+ ((256 - alpha_sub) * out_u[x/2])) >> 8;
|
||||
out_u[x / 2] = blended;
|
||||
|
||||
blended = (xv->font_v * alpha_sub
|
||||
+ ((256 - alpha_sub) * out_v[x/2])) >> 8;
|
||||
out_v[x/2] = blended;
|
||||
}
|
||||
}
|
||||
|
||||
if (y & 1)
|
||||
{
|
||||
out_u += xv->width / 2;
|
||||
out_v += xv->width / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void render_glyph_yuv_packed(xv_t *xv, int base_x, int base_y,
|
||||
const uint8_t *glyph, int atlas_width,
|
||||
int glyph_width, int glyph_height)
|
||||
{
|
||||
uint8_t *out = NULL;
|
||||
int x, y, i;
|
||||
unsigned luma_index[2], pitch;
|
||||
unsigned chroma_u_index, chroma_v_index;
|
||||
|
||||
luma_index[0] = xv->luma_index[0];
|
||||
luma_index[1] = xv->luma_index[1];
|
||||
|
||||
chroma_u_index = xv->chroma_u_index;
|
||||
chroma_v_index = xv->chroma_v_index;
|
||||
|
||||
pitch = xv->width << 1; /* YUV formats used are 16 bpp. */
|
||||
out = (uint8_t*)xv->image->data + base_y * pitch + (base_x << 1);
|
||||
|
||||
for (y = 0; y < glyph_height; y++, glyph += atlas_width, out += pitch)
|
||||
{
|
||||
/* 2 input pixels => 4 bytes (2Y, 1U, 1V). */
|
||||
|
||||
for (x = 0; x < glyph_width; x += 2)
|
||||
{
|
||||
unsigned alpha[2], alpha_sub, blended;
|
||||
int out_x = x << 1;
|
||||
|
||||
alpha[0] = glyph[x + 0];
|
||||
alpha[1] = 0;
|
||||
|
||||
if (x + 1 < glyph_width)
|
||||
alpha[1] = glyph[x + 1];
|
||||
|
||||
/* Blended alpha for the sub-sampled U/V channels. */
|
||||
alpha_sub = (alpha[0] + alpha[1]) >> 1;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
unsigned blended = (xv->font_y * alpha[i]
|
||||
+ ((256 - alpha[i]) * out[out_x + luma_index[i]])) >> 8;
|
||||
out[out_x + luma_index[i]] = blended;
|
||||
}
|
||||
|
||||
/* Blend chroma channels */
|
||||
blended = (xv->font_u * alpha_sub
|
||||
+ ((256 - alpha_sub) * out[out_x + chroma_u_index])) >> 8;
|
||||
out[out_x + chroma_u_index] = blended;
|
||||
|
||||
blended = (xv->font_v * alpha_sub
|
||||
+ ((256 - alpha_sub) * out[out_x + chroma_v_index])) >> 8;
|
||||
out[out_x + chroma_v_index] = blended;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct format_desc
|
||||
{
|
||||
void (*render_16)(xv_t *xv, const void *input,
|
||||
unsigned width, unsigned height, unsigned pitch);
|
||||
void (*render_32)(xv_t *xv, const void *input,
|
||||
unsigned width, unsigned height, unsigned pitch);
|
||||
void (*render_glyph)(xv_t *xv, int base_x, int base_y,
|
||||
const uint8_t *glyph, int atlas_width,
|
||||
int glyph_width, int glyph_height);
|
||||
char components[4];
|
||||
unsigned luma_index[2];
|
||||
unsigned u_index;
|
||||
unsigned v_index;
|
||||
unsigned bits;
|
||||
int format;
|
||||
};
|
||||
|
||||
static const struct format_desc formats[] = {
|
||||
{
|
||||
render16_yuy2,
|
||||
render32_yuy2,
|
||||
render_glyph_yuv_packed,
|
||||
{ 'Y', 'U', 'Y', 'V' },
|
||||
{ 0, 2 },
|
||||
1,
|
||||
3,
|
||||
16,
|
||||
XvPacked
|
||||
},
|
||||
{
|
||||
render16_uyvy,
|
||||
render32_uyvy,
|
||||
render_glyph_yuv_packed,
|
||||
{ 'U', 'Y', 'V', 'Y' },
|
||||
{ 1, 3 },
|
||||
0,
|
||||
2,
|
||||
16,
|
||||
XvPacked
|
||||
},
|
||||
{
|
||||
render16_yuv12,
|
||||
render32_yuv12,
|
||||
render_glyph_yuv12,
|
||||
{ 'Y', 'U', 'V', 0 },
|
||||
{ 1, 3 },
|
||||
0,
|
||||
2,
|
||||
12,
|
||||
XvPlanar
|
||||
},
|
||||
};
|
||||
|
||||
@@ -343,8 +555,8 @@ static bool xv_adaptor_set_format(xv_t *xv, Display *dpy,
|
||||
for (j = 0; j < ARRAY_SIZE(formats); j++)
|
||||
{
|
||||
if (format[i].type == XvYUV
|
||||
&& format[i].bits_per_pixel == 16
|
||||
&& format[i].format == XvPacked)
|
||||
&& format[i].bits_per_pixel == formats[j].bits
|
||||
&& format[i].format == formats[j].format)
|
||||
{
|
||||
if (format[i].component_order[0] == formats[j].components[0] &&
|
||||
format[i].component_order[1] == formats[j].components[1] &&
|
||||
@@ -354,6 +566,7 @@ static bool xv_adaptor_set_format(xv_t *xv, Display *dpy,
|
||||
xv->fourcc = format[i].id;
|
||||
xv->render_func = video->rgb32
|
||||
? formats[j].render_32 : formats[j].render_16;
|
||||
xv->render_glyph = formats[j].render_glyph;
|
||||
|
||||
xv->luma_index[0] = formats[j].luma_index[0];
|
||||
xv->luma_index[1] = formats[j].luma_index[1];
|
||||
@@ -637,6 +850,12 @@ static void *xv_init(const video_info_t *video,
|
||||
|
||||
frontend_driver_install_signal_handler();
|
||||
|
||||
xv_init_yuv_tables(xv);
|
||||
xv_init_font(xv, settings->paths.path_font, settings->floats.video_font_size);
|
||||
|
||||
if (!x11_input_ctx_new(true))
|
||||
goto error;
|
||||
|
||||
if (input && input_data)
|
||||
{
|
||||
xinput = input_x.init(settings->arrays.input_joypad_driver);
|
||||
@@ -649,12 +868,6 @@ static void *xv_init(const video_info_t *video,
|
||||
*input = NULL;
|
||||
}
|
||||
|
||||
xv_init_yuv_tables(xv);
|
||||
xv_init_font(xv, settings->paths.path_font, settings->floats.video_font_size);
|
||||
|
||||
if (!x11_input_ctx_new(true))
|
||||
goto error;
|
||||
|
||||
XGetWindowAttributes(g_x11_dpy, g_x11_win, &target);
|
||||
xv_calc_out_rect(xv->keep_aspect, &xv->vp, target.width, target.height);
|
||||
xv->vp.full_width = target.width;
|
||||
@@ -724,9 +937,7 @@ static bool xv_check_resize(xv_t *xv, unsigned width, unsigned height)
|
||||
static void xv_render_msg(xv_t *xv, const char *msg,
|
||||
unsigned width, unsigned height)
|
||||
{
|
||||
int x, y, msg_base_x, msg_base_y;
|
||||
unsigned i, luma_index[2], pitch;
|
||||
unsigned chroma_u_index, chroma_v_index;
|
||||
int msg_base_x, msg_base_y;
|
||||
const struct font_atlas *atlas = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
float video_msg_pos_x = settings->floats.video_msg_pos_x;
|
||||
@@ -740,19 +951,10 @@ static void xv_render_msg(xv_t *xv, const char *msg,
|
||||
msg_base_x = video_msg_pos_x * width;
|
||||
msg_base_y = height * (1.0f - video_msg_pos_y);
|
||||
|
||||
luma_index[0] = xv->luma_index[0];
|
||||
luma_index[1] = xv->luma_index[1];
|
||||
|
||||
chroma_u_index = xv->chroma_u_index;
|
||||
chroma_v_index = xv->chroma_v_index;
|
||||
|
||||
pitch = width << 1; /* YUV formats used are 16 bpp. */
|
||||
|
||||
for (; *msg; msg++)
|
||||
{
|
||||
int base_x, base_y, glyph_width, glyph_height, max_width, max_height;
|
||||
const uint8_t *src = NULL;
|
||||
uint8_t *out = NULL;
|
||||
const struct font_glyph *glyph =
|
||||
xv->font_driver->get_glyph(xv->font, (uint8_t)*msg);
|
||||
|
||||
@@ -795,43 +997,7 @@ static void xv_render_msg(xv_t *xv, const char *msg,
|
||||
if (glyph_height > max_height)
|
||||
glyph_height = max_height;
|
||||
|
||||
out = (uint8_t*)xv->image->data + base_y * pitch + (base_x << 1);
|
||||
|
||||
for (y = 0; y < glyph_height; y++, src += atlas->width, out += pitch)
|
||||
{
|
||||
/* 2 input pixels => 4 bytes (2Y, 1U, 1V). */
|
||||
|
||||
for (x = 0; x < glyph_width; x += 2)
|
||||
{
|
||||
unsigned alpha[2], alpha_sub, blended;
|
||||
int out_x = x << 1;
|
||||
|
||||
alpha[0] = src[x + 0];
|
||||
alpha[1] = 0;
|
||||
|
||||
if (x + 1 < glyph_width)
|
||||
alpha[1] = src[x + 1];
|
||||
|
||||
/* Blended alpha for the sub-sampled U/V channels. */
|
||||
alpha_sub = (alpha[0] + alpha[1]) >> 1;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
unsigned blended = (xv->font_y * alpha[i]
|
||||
+ ((256 - alpha[i]) * out[out_x + luma_index[i]])) >> 8;
|
||||
out[out_x + luma_index[i]] = blended;
|
||||
}
|
||||
|
||||
/* Blend chroma channels */
|
||||
blended = (xv->font_u * alpha_sub
|
||||
+ ((256 - alpha_sub) * out[out_x + chroma_u_index])) >> 8;
|
||||
out[out_x + chroma_u_index] = blended;
|
||||
|
||||
blended = (xv->font_v * alpha_sub
|
||||
+ ((256 - alpha_sub) * out[out_x + chroma_v_index])) >> 8;
|
||||
out[out_x + chroma_v_index] = blended;
|
||||
}
|
||||
}
|
||||
xv->render_glyph(xv, base_x, base_y, src, atlas->width, glyph_width, glyph_height);
|
||||
|
||||
msg_base_x += glyph->advance_x;
|
||||
msg_base_y += glyph->advance_y;
|
||||
@@ -844,6 +1010,7 @@ static bool xv_frame(void *data, const void *frame, unsigned width,
|
||||
{
|
||||
XWindowAttributes target;
|
||||
xv_t *xv = (xv_t*)data;
|
||||
bool menu_is_alive = video_info->menu_is_alive;
|
||||
|
||||
if (!frame)
|
||||
return true;
|
||||
@@ -859,7 +1026,7 @@ static bool xv_frame(void *data, const void *frame, unsigned width,
|
||||
xv->vp.full_height = target.height;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
menu_driver_frame(menu_is_alive, video_info);
|
||||
#endif
|
||||
|
||||
if (msg)
|
||||
|
||||
@@ -95,8 +95,8 @@ static void osmesa_fifo_open(gfx_ctx_osmesa_data_t *osmesa)
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(stderr, "[osmesa] Frame size is %ix%ix%i\n", osmesa->width, osmesa->height, osmesa->pixsize);
|
||||
fprintf(stderr, "[osmesa] Please connect to unix:%s\n", g_osmesa_fifo);
|
||||
RARCH_ERR("[osmesa] Frame size is %ix%ix%i\n", osmesa->width, osmesa->height, osmesa->pixsize);
|
||||
RARCH_ERR("[osmesa] Please connect to unix:%s\n", g_osmesa_fifo);
|
||||
}
|
||||
|
||||
static void osmesa_fifo_accept(gfx_ctx_osmesa_data_t *osmesa)
|
||||
@@ -116,7 +116,7 @@ static void osmesa_fifo_accept(gfx_ctx_osmesa_data_t *osmesa)
|
||||
else if (res > 0)
|
||||
{
|
||||
osmesa->client = accept(osmesa->socket, NULL, NULL);
|
||||
fprintf(stderr, "[osmesa] Client %i connected.\n", osmesa->client);
|
||||
RARCH_LOG("[osmesa] Client %i connected.\n", osmesa->client);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ static void osmesa_fifo_write(gfx_ctx_osmesa_data_t *osmesa)
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
fprintf(stderr, "[osmesa] Lost connection to %i: %s\n", osmesa->client, strerror(errno));
|
||||
RARCH_LOG("[osmesa] Lost connection to %i: %s\n", osmesa->client, strerror(errno));
|
||||
close(osmesa->client);
|
||||
osmesa->client = -1;
|
||||
break;
|
||||
|
||||
@@ -132,7 +132,7 @@ static int GLXExtensionSupported(Display *dpy, const char *extension)
|
||||
const char *client_extensions = glXGetClientString(dpy, GLX_EXTENSIONS);
|
||||
const char *pos = strstr(extensionsString, extension);
|
||||
|
||||
if ( (pos != NULL) &&
|
||||
if ( pos &&
|
||||
(pos == extensionsString || pos[-1] == ' ') &&
|
||||
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0')
|
||||
)
|
||||
@@ -141,7 +141,7 @@ static int GLXExtensionSupported(Display *dpy, const char *extension)
|
||||
pos = strstr(client_extensions, extension);
|
||||
|
||||
if (
|
||||
(pos != NULL) &&
|
||||
pos &&
|
||||
(pos == extensionsString || pos[-1] == ' ') &&
|
||||
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0')
|
||||
)
|
||||
@@ -878,7 +878,7 @@ static bool gfx_ctx_x_set_video_mode(void *data,
|
||||
x->g_glx_win, x->g_glx_win, x->g_ctx);
|
||||
|
||||
version = (const char*)glGetString(GL_VERSION);
|
||||
if (strstr(version, " Mesa ") != NULL || !x->g_core_es)
|
||||
if (strstr(version, " Mesa ") || !x->g_core_es)
|
||||
{
|
||||
/* we are done, break switch case */
|
||||
XSetErrorHandler(old_handler);
|
||||
|
||||
+14
-96
@@ -13,17 +13,16 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <gsKit.h>
|
||||
#include <dmaKit.h>
|
||||
#include <gsToolkit.h>
|
||||
|
||||
#include "../font_driver.h"
|
||||
|
||||
#define FONTM_VRAM_SIZE 4096
|
||||
#define FONTM_TEXTURE_COLOR GS_SETREG_RGBAQ(0x80,0x80,0x80,0x80,0x00)
|
||||
#define FONTM_TEXTURE_WIDTH 52
|
||||
#define FONTM_TEXTURE_HEIGHT 832
|
||||
#define FONTM_TEXTURE_SPACING 1.0f
|
||||
#define FONTM_TEXTURE_SCALED 0.5f
|
||||
#define FONTM_TEXTURE_LEFT_MARGIN 0
|
||||
#define FONTM_TEXTURE_BOTTOM_MARGIN 15
|
||||
@@ -35,87 +34,14 @@ typedef struct ps2_font_info
|
||||
GSFONTM *gsFontM;
|
||||
} ps2_font_info_t;
|
||||
|
||||
/* Copied from GSKIT FONTM CLUT
|
||||
FONTM Textures are GS_PSM_T4, and need a 16x16 CLUT
|
||||
This is a greyscale ramp CLUT, with linear alpha. */
|
||||
static u32 gsKit_fontm_clut[16] = {
|
||||
0x00000000, 0x11111111, 0x22222222, 0x33333333, \
|
||||
0x44444444, 0x55555555, 0x66666666, 0x77777777, \
|
||||
0x80888888, 0x80999999, 0x80AAAAAA, 0x80BBBBBB, \
|
||||
0x80CCCCCC, 0x80DDDDDD, 0x80EEEEEE, 0x80FFFFFF
|
||||
};
|
||||
|
||||
static void deinit_gsfont_texture(GSTEXTURE *texture)
|
||||
{
|
||||
if (texture->Mem)
|
||||
free(texture->Mem);
|
||||
texture->Mem = NULL;
|
||||
|
||||
if (texture->Mem)
|
||||
free(texture->Clut);
|
||||
texture->Clut = NULL;
|
||||
}
|
||||
|
||||
static void deinit_gsfont(GSFONTM *gsFontM)
|
||||
{
|
||||
deinit_gsfont_texture(gsFontM->Texture);
|
||||
free(gsFontM->TexBase);
|
||||
gsFontM->TexBase = NULL;
|
||||
free(gsFontM);
|
||||
}
|
||||
|
||||
static void ps2_prepare_font(GSGLOBAL *gsGlobal, GSFONTM *gsFontM)
|
||||
{
|
||||
if (gsKit_fontm_unpack(gsFontM) == 0)
|
||||
{
|
||||
gsFontM->Texture->Width = FONTM_TEXTURE_WIDTH;
|
||||
gsFontM->Texture->Height = FONTM_TEXTURE_HEIGHT;
|
||||
gsFontM->Texture->PSM = GS_PSM_T4;
|
||||
gsFontM->Texture->ClutPSM = GS_PSM_CT32;
|
||||
gsFontM->Texture->Filter = GS_FILTER_LINEAR;
|
||||
gsKit_setup_tbw(gsFontM->Texture);
|
||||
}
|
||||
}
|
||||
|
||||
static void ps2_upload_font(GSGLOBAL *gsGlobal, GSFONTM *gsFontM)
|
||||
{
|
||||
unsigned i;
|
||||
int TexSize = gsKit_texture_size(
|
||||
gsFontM->Texture->Width,
|
||||
gsFontM->Texture->Height,
|
||||
gsFontM->Texture->PSM);
|
||||
|
||||
gsFontM->Texture->VramClut = gsKit_vram_alloc(
|
||||
gsGlobal, FONTM_VRAM_SIZE, GSKIT_ALLOC_USERBUFFER);
|
||||
|
||||
for (i = 0; i < GS_FONTM_PAGE_COUNT; ++i)
|
||||
{
|
||||
gsFontM->Vram[i] = gsKit_vram_alloc(
|
||||
gsGlobal, TexSize, GSKIT_ALLOC_USERBUFFER);
|
||||
gsFontM->LastPage[i] = (u32) -1;
|
||||
}
|
||||
|
||||
gsFontM->Texture->Vram = gsFontM->Vram[0];
|
||||
gsFontM->VramIdx = 0;
|
||||
gsFontM->Spacing = FONTM_TEXTURE_SPACING;
|
||||
gsFontM->Align = GSKIT_FALIGN_LEFT;
|
||||
|
||||
gsFontM->Texture->Clut = memalign(GS_VRAM_TBWALIGN_CLUT, GS_VRAM_TBWALIGN);
|
||||
memcpy(gsFontM->Texture->Clut, gsKit_fontm_clut, GS_VRAM_TBWALIGN);
|
||||
gsKit_texture_send(gsFontM->Texture->Clut, 8, 2, gsFontM->Texture->VramClut, gsFontM->Texture->ClutPSM, 1, GS_CLUT_PALLETE);
|
||||
free(gsFontM->Texture->Clut);
|
||||
}
|
||||
|
||||
static void *ps2_font_init_font(void *gl_data, const char *font_path,
|
||||
float font_size, bool is_threaded)
|
||||
{
|
||||
ps2_font_info_t *ps2 = (ps2_font_info_t*)calloc(1, sizeof(ps2_font_info_t));
|
||||
ps2->ps2_video = (ps2_video_t *)gl_data;
|
||||
ps2->gsFontM = gsKit_init_fontm();
|
||||
|
||||
ps2->ps2_video = (ps2_video_t *)gl_data;
|
||||
ps2->gsFontM = gsKit_init_fontm();
|
||||
|
||||
ps2_prepare_font(ps2->ps2_video->gsGlobal, ps2->gsFontM);
|
||||
ps2_upload_font(ps2->ps2_video->gsGlobal, ps2->gsFontM);
|
||||
gsKit_fontm_upload(ps2->ps2_video->gsGlobal, ps2->gsFontM);
|
||||
|
||||
return ps2;
|
||||
}
|
||||
@@ -123,34 +49,26 @@ static void *ps2_font_init_font(void *gl_data, const char *font_path,
|
||||
static void ps2_font_free_font(void *data, bool is_threaded)
|
||||
{
|
||||
ps2_font_info_t *ps2 = (ps2_font_info_t *)data;
|
||||
|
||||
deinit_gsfont(ps2->gsFontM);
|
||||
|
||||
gsKit_free_fontm(ps2->ps2_video->gsGlobal, ps2->gsFontM);
|
||||
ps2->ps2_video = NULL;
|
||||
ps2 = NULL;
|
||||
|
||||
free(ps2);
|
||||
ps2 = NULL;
|
||||
}
|
||||
|
||||
static void ps2_font_render_msg(
|
||||
void *userdata,
|
||||
void *data,
|
||||
const char *msg,
|
||||
video_frame_info_t *video_info,
|
||||
void *data, const char *msg,
|
||||
const struct font_params *params)
|
||||
{
|
||||
ps2_font_info_t *ps2 = (ps2_font_info_t *)data;
|
||||
|
||||
if (ps2)
|
||||
if (ps2)
|
||||
{
|
||||
int x = FONTM_TEXTURE_LEFT_MARGIN;
|
||||
int y = ps2->ps2_video->gsGlobal->Height - FONTM_TEXTURE_BOTTOM_MARGIN;
|
||||
|
||||
if (ps2->ps2_video->clearVRAM_font)
|
||||
{
|
||||
ps2_upload_font(ps2->ps2_video->gsGlobal, ps2->gsFontM);
|
||||
ps2->ps2_video->clearVRAM_font = false;
|
||||
}
|
||||
|
||||
gsKit_fontm_print_scaled(
|
||||
ps2->ps2_video->gsGlobal,
|
||||
ps2->ps2_video->gsGlobal,
|
||||
ps2->gsFontM, x, y, FONTM_TEXTURE_ZPOSITION,
|
||||
FONTM_TEXTURE_SCALED , FONTM_TEXTURE_COLOR, msg);
|
||||
}
|
||||
|
||||
@@ -400,12 +400,14 @@ bool glslang::compile_spirv(const string &source, Stage stage,
|
||||
|
||||
EShMessages messages = static_cast<EShMessages>(EShMsgDefault | EShMsgVulkanRules | EShMsgSpvRules);
|
||||
|
||||
auto forbid_include = glslang::TShader::ForbidIncluder();
|
||||
glslang::TShader::ForbidIncluder forbid_include =
|
||||
glslang::TShader::ForbidIncluder();
|
||||
|
||||
if (!shader.preprocess(&process.GetResources(),
|
||||
100, ENoProfile, false, false,
|
||||
messages, &msg, forbid_include))
|
||||
{
|
||||
fprintf(stderr, "%s\n", msg.c_str());
|
||||
RARCH_ERR("%s\n", msg.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ static std::string build_stage_source(
|
||||
return "";
|
||||
|
||||
/* Version header. */
|
||||
str << lines->elems[0].data;;
|
||||
str << lines->elems[0].data;
|
||||
str << '\n';
|
||||
|
||||
for (i = 1; i < lines->size; i++)
|
||||
|
||||
@@ -73,7 +73,8 @@ get_semantic_name(slang_reflection& reflection,
|
||||
"FrameCount",
|
||||
"FrameDirection",
|
||||
};
|
||||
if ((int)semantic < sizeof(names) / sizeof(*names))
|
||||
int size = sizeof(names) / sizeof(*names);
|
||||
if ((int)semantic < size)
|
||||
return std::string(names[semantic]);
|
||||
|
||||
return get_semantic_name(reflection.semantic_map, semantic, index);
|
||||
@@ -86,9 +87,11 @@ get_semantic_name(slang_reflection& reflection,
|
||||
static const char* names[] = {
|
||||
"Original", "Source", "OriginalHistory", "PassOutput", "PassFeedback",
|
||||
};
|
||||
int size;
|
||||
if ((int)semantic < (int)SLANG_TEXTURE_SEMANTIC_ORIGINAL_HISTORY)
|
||||
return std::string(names[semantic]);
|
||||
else if ((int)semantic < sizeof(names) / sizeof(*names))
|
||||
size = sizeof(names) / sizeof(*names);
|
||||
if ((int)semantic < size)
|
||||
return std::string(names[semantic]) + to_string(index);
|
||||
|
||||
return get_semantic_name(reflection.texture_semantic_map, semantic, index);
|
||||
@@ -101,9 +104,11 @@ static string get_size_semantic_name(
|
||||
static const char* names[] = {
|
||||
"OriginalSize", "SourceSize", "OriginalHistorySize", "PassOutputSize", "PassFeedbackSize",
|
||||
};
|
||||
int size;
|
||||
if ((int)semantic < (int)SLANG_TEXTURE_SEMANTIC_ORIGINAL_HISTORY)
|
||||
return std::string(names[semantic]);
|
||||
if ((int)semantic < sizeof(names) / sizeof(*names))
|
||||
size = sizeof(names) / sizeof(*names);
|
||||
if ((int)semantic < size)
|
||||
return std::string(names[semantic]) + to_string(index);
|
||||
|
||||
return get_semantic_name(reflection.texture_semantic_uniform_map, semantic, index);
|
||||
|
||||
+16
-8
@@ -940,13 +940,20 @@ static INLINE unsigned font_get_replacement(const char* src, const char* start)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char* font_driver_reshape_msg(const char* msg)
|
||||
static char* font_driver_reshape_msg(const char* msg, unsigned char *buffer, size_t buffer_size)
|
||||
{
|
||||
/* worst case transformations are 2 bytes to 4 bytes */
|
||||
unsigned char* buffer = (unsigned char*)malloc((strlen(msg) * 2) + 1);
|
||||
unsigned char* dst_buffer = buffer;
|
||||
const unsigned char* src = (const unsigned char*)msg;
|
||||
unsigned char* dst = (unsigned char*)buffer;
|
||||
unsigned char* dst;
|
||||
bool reverse = false;
|
||||
size_t msg_size = (strlen(msg) * 2) + 1;
|
||||
|
||||
/* fallback to heap allocated buffer if the buffer is too small */
|
||||
/* worst case transformations are 2 bytes to 4 bytes -- aliaspider */
|
||||
if (buffer_size < msg_size)
|
||||
dst_buffer = (unsigned char*)malloc(msg_size);
|
||||
|
||||
dst = (unsigned char*)dst_buffer;
|
||||
|
||||
while (*src || reverse)
|
||||
{
|
||||
@@ -1025,7 +1032,7 @@ static char* font_driver_reshape_msg(const char* msg)
|
||||
end:
|
||||
*dst = '\0';
|
||||
|
||||
return (char*)buffer;
|
||||
return (char*)dst_buffer;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1042,15 +1049,16 @@ void font_driver_render_msg(
|
||||
if (msg && *msg && font && font->renderer && font->renderer->render_msg)
|
||||
{
|
||||
#ifdef HAVE_LANGEXTRA
|
||||
char *new_msg = font_driver_reshape_msg(msg);
|
||||
unsigned char tmp_buffer[64];
|
||||
char *new_msg = font_driver_reshape_msg(msg, tmp_buffer, sizeof(tmp_buffer));
|
||||
#else
|
||||
char *new_msg = (char*)msg;
|
||||
#endif
|
||||
|
||||
font->renderer->render_msg(data,
|
||||
font->renderer_data, new_msg, params);
|
||||
#ifdef HAVE_LANGEXTRA
|
||||
free(new_msg);
|
||||
if (new_msg != (char*)tmp_buffer)
|
||||
free(new_msg);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
+10
-4
@@ -1679,6 +1679,7 @@ bool gfx_animation_ticker_smooth(gfx_animation_ctx_ticker_smooth_t *ticker)
|
||||
size_t i;
|
||||
size_t src_str_len = 0;
|
||||
size_t spacer_len = 0;
|
||||
unsigned small_src_char_widths[64] = {0};
|
||||
unsigned src_str_width = 0;
|
||||
unsigned spacer_width = 0;
|
||||
unsigned *src_char_widths = NULL;
|
||||
@@ -1706,9 +1707,14 @@ bool gfx_animation_ticker_smooth(gfx_animation_ctx_ticker_smooth_t *ticker)
|
||||
if (src_str_len < 1)
|
||||
goto end;
|
||||
|
||||
src_char_widths = (unsigned*)calloc(src_str_len, sizeof(unsigned));
|
||||
if (!src_char_widths)
|
||||
goto end;
|
||||
src_char_widths = small_src_char_widths;
|
||||
|
||||
if (src_str_len > ARRAY_SIZE(small_src_char_widths))
|
||||
{
|
||||
src_char_widths = (unsigned*)calloc(src_str_len, sizeof(unsigned));
|
||||
if (!src_char_widths)
|
||||
goto end;
|
||||
}
|
||||
|
||||
str_ptr = ticker->src_str;
|
||||
for (i = 0; i < src_str_len; i++)
|
||||
@@ -1881,7 +1887,7 @@ bool gfx_animation_ticker_smooth(gfx_animation_ctx_ticker_smooth_t *ticker)
|
||||
|
||||
end:
|
||||
|
||||
if (src_char_widths)
|
||||
if (src_char_widths != small_src_char_widths && src_char_widths)
|
||||
{
|
||||
free(src_char_widths);
|
||||
src_char_widths = NULL;
|
||||
|
||||
+2
-2
@@ -210,11 +210,11 @@ enum menu_driver_id_type gfx_display_get_driver_id(void)
|
||||
static float gfx_display_get_adjusted_scale_internal(
|
||||
float base_scale, float scale_factor, unsigned width)
|
||||
{
|
||||
gfx_display_t *p_disp = disp_get_ptr();
|
||||
/* Apply user-set scaling factor */
|
||||
float adjusted_scale = base_scale * scale_factor;
|
||||
|
||||
#ifdef HAVE_OZONE
|
||||
gfx_display_t *p_disp = disp_get_ptr();
|
||||
|
||||
/* Ozone has a capped scale factor */
|
||||
if (p_disp->menu_driver_id == MENU_DRIVER_ID_OZONE)
|
||||
{
|
||||
|
||||
@@ -187,6 +187,7 @@ typedef struct gfx_display_ctx_datetime
|
||||
char *s;
|
||||
size_t len;
|
||||
unsigned time_mode;
|
||||
unsigned date_separator;
|
||||
} gfx_display_ctx_datetime_t;
|
||||
|
||||
typedef struct gfx_display_ctx_powerstate
|
||||
|
||||
+22
-8
@@ -155,6 +155,18 @@ bool gfx_thumbnail_get_fade_missing(bool fade_missing)
|
||||
|
||||
/* Callbacks */
|
||||
|
||||
/* Fade animation callback - simply resets thumbnail
|
||||
* 'fade_active' status */
|
||||
static void gfx_thumbnail_fade_cb(void *userdata)
|
||||
{
|
||||
gfx_thumbnail_t *thumbnail = (gfx_thumbnail_t*)userdata;
|
||||
|
||||
if (!thumbnail)
|
||||
return;
|
||||
|
||||
thumbnail->fade_active = false;
|
||||
}
|
||||
|
||||
/* Initialises thumbnail 'fade in' animation */
|
||||
static void gfx_thumbnail_init_fade(gfx_thumbnail_t *thumbnail)
|
||||
{
|
||||
@@ -175,15 +187,16 @@ static void gfx_thumbnail_init_fade(gfx_thumbnail_t *thumbnail)
|
||||
{
|
||||
gfx_animation_ctx_entry_t animation_entry;
|
||||
|
||||
thumbnail->alpha = 0.0f;
|
||||
thumbnail->alpha = 0.0f;
|
||||
thumbnail->fade_active = true;
|
||||
|
||||
animation_entry.easing_enum = EASING_OUT_QUAD;
|
||||
animation_entry.tag = (uintptr_t)&thumbnail->alpha;
|
||||
animation_entry.duration = p_gfx_thumb->fade_duration;
|
||||
animation_entry.target_value = 1.0f;
|
||||
animation_entry.subject = &thumbnail->alpha;
|
||||
animation_entry.cb = NULL;
|
||||
animation_entry.userdata = NULL;
|
||||
animation_entry.cb = gfx_thumbnail_fade_cb;
|
||||
animation_entry.userdata = thumbnail;
|
||||
|
||||
gfx_animation_push(&animation_entry);
|
||||
}
|
||||
@@ -449,14 +462,14 @@ void gfx_thumbnail_reset(gfx_thumbnail_t *thumbnail)
|
||||
if (!thumbnail)
|
||||
return;
|
||||
|
||||
/* Unload texture */
|
||||
if (thumbnail->texture)
|
||||
{
|
||||
gfx_animation_ctx_tag tag = (uintptr_t)&thumbnail->alpha;
|
||||
|
||||
/* Unload texture */
|
||||
video_driver_texture_unload(&thumbnail->texture);
|
||||
|
||||
/* Ensure any 'fade in' animation is killed */
|
||||
/* Ensure any 'fade in' animation is killed */
|
||||
if (thumbnail->fade_active)
|
||||
{
|
||||
gfx_animation_ctx_tag tag = (uintptr_t)&thumbnail->alpha;
|
||||
gfx_animation_kill_by_tag(&tag);
|
||||
}
|
||||
|
||||
@@ -467,6 +480,7 @@ void gfx_thumbnail_reset(gfx_thumbnail_t *thumbnail)
|
||||
thumbnail->height = 0;
|
||||
thumbnail->alpha = 0.0f;
|
||||
thumbnail->delay_timer = 0.0f;
|
||||
thumbnail->fade_active = false;
|
||||
}
|
||||
|
||||
/* Stream processing */
|
||||
|
||||
Loaded 100 of 257 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user