Merge branch 'master' into master

This commit is contained in:
Rob Loach 2020-01-27 09:07:06 -05:00 committed by GitHub
commit 6b4b5ec2a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
238 changed files with 7390 additions and 10132 deletions

View File

@ -32,6 +32,8 @@ matrix:
env: CXX_BUILD=1 CROSS_COMPILE=x86_64-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501"
- compiler: gcc
env: CC=gcc-8 CXX=g++-8
- compiler: gcc
env: CC="gcc-8 --sysroot=/" CXX="g++-8 --sysroot=/"
- compiler: gcc
env: C89_BUILD=1 CC=gcc-8 CXX=g++-8
- compiler: gcc
@ -105,7 +107,7 @@ matrix:
before_install:
- |
if [ "$CC" = gcc-8 ]; then
if [[ "$CC" =~ ^gcc-8.* ]]; then
# Install a more recent gcc than the default
sudo apt-get install -y g++-8
elif [ "$CC" = clang-6.0 ]; then

View File

@ -1,10 +1,38 @@
# Future
- BUGFIX: Fix mouse capture hotkey not working
- CHEEVOS/BUGFIX: Achievement triggers could cause Retroarch to Crash
- CHEEVOS: Support for extended Sega CD memory
- EMSCRIPTEN: Recreate input event listeners properly
- LIBRETRO: Add disk control interface API extension
- LOCALIZATION: Update Polish translation
- VIDEO: Set hardware 'Bilinear filtering' off by default
# 1.8.4
- ANDROID/BUGFIX: Prevent crash when Android device is minimized and you go back to the app
- CAMERA/BUGFIX: Fix crash when a core requires the camera driver and the platform only has a null driver. This would crash mgba on Wii for example
- DISK CONTROL: Cycle Disk Tray now becomes Eject Disk or Insert Disk depending upon current drive state
- DISK CONTROL: Current Disk Index is only shown when the current disk has been ejected
- DISK CONTROL: The old Insert Disk entry has been changed to Load New Disk, and is only shown when a disk is currently inserted (this is because loading a new disk from the filesystem - i.e. bypassing the m3u playlist disk index interface - automatically ejects and inserts disks, and so cannot be done while the virtual drive is empty)
- DISK CONTROL: The Current Disk Index may now be set more easily via a drop-down list.
- DISK CONTROL: Selecting Eject Disk automatically moves the menu selection to the Current Disk Index entry
- DISK CONTROL: Selecting an index via the Current Disk Index drop-down list automatically moves the menu selection back to Insert Disk
- DISK CONTROL: The Disk Control entry sublabels have been changed for greater clarity
- DISK CONTROL: All of the horrendous notification spam has been removed. Notifications are now only shown in the event of an error, or when the menu itself does not provide sufficient visual feedback (note that using hotkeys to swap disks still produces the old style notifications, since this is typically only done while content is running - i.e. no menu). The duration of disk-related info notifications has also been reduced to a more sane level.
- DISK CONTROL: A new Resume content after changing disks option has been added under Settings > User Interface. When enabled (default setting), content is resumed automatically after selecting either Insert Disk or Load New Disk (when disabled, the menu remains open, obviously...)
- DISK CONTROL/BUGFIX: The Disk Control menu now has the correct title
- DISK CONTROL/BUGFIX: Selecting a disk via the Load New Disk file browser no longer flushes the user back to the top level menu (it now correctly returns to the Disk Control menu)
- LIBNX/SWITCH: Updated libnx integration to v3.0.0. This also cherry-picks libnx commit 583d6bb92dcbb33b6bb4a0fa1a9df6e3725d6ef6, which should fix the requirement having to turn rumble off and on in the system settings once per reboot
- PLAYLISTS: Add 'Clean Playlist' option
# 1.8.3
- ANDROID/BUGFIX: Fix 'Install or Restore Core' regression
- BUGFIX: Ensure core info is always initialised when calling 'drivers_init()'. This bug could prevent cores from doing content runtime logging
- BUGFIX/MENU: History size can only be set to 1 at a minimum
- BUGFIX/MENU: (XMB/OZONE) Fix 'quick menu' detection. XMB would not display savestate thumbnails in the quick menu if it was accessed via the main menu
- BUGFIX/CRASH/CORE UPDATER: Fix potential double free error
- BUGFIX/CRASH/OPENGL/WINDOWS: Fix regression in 1.8.2 that would cause GL-based cores to fail because it would try to erroneously load libGLESv2.dll instead of OpenGL32.dll (cores affected: VitaQuake 2/3/Dhewm3, possibly more)
- BUGFIX/MENU/DESKTOP UI: Show desktop menu on startup does not launch Qt UI on Linux
- BUGFIX: Entries in the Playlist Thumbnails Updater list were displaying improper sublabels. I have no idea when this broke... The issue is now fixed
- CHEEVOS: Don't disable achievement when AddAddress generates an out-of-range address
- CHEEVOS: Don't reset triggers/leaderboards that failed to load
- CHEEVOS: Don't count unsupported achievements as unlocked
@ -13,6 +41,8 @@
- D3D11: Block FL9_3 devices from D3D11 driver because they don't work anyway (current D3D11 driver uses SM4.0 which requires FL10_0 and up)
- D3D11: Fallback to GL driver when D3D11 fails
- EMSCRIPTEN: Fix assets
- HISTORY/FAVORITES: Bump up default to 200 entries from 100
- FFMPEG CORE: Implement packet buffer, fixes MP4 video playback for many files
- LOCALIZATION: Update Italian translation
- LOCALIZATION: Update Polish translation
- LOCALIZATION: Update Russian translation
@ -20,11 +50,14 @@
- MENU: Added 'Hosting' menu under Netplay menu
- MENU: Added 'Subsystems' menu
- MENU/FILEBROWSER: Fix file selection issues when starting from (or navigating to) the top level directory
- MENU/WIDGETS: Prevent looping of task title text
- RASPBERRY PI: Fix BGRA8888 color inversion issues in the menu and elsewhere with VideoCore GL drivers
- NETPLAY/RELAY: Add Sao Paulo (Brazil) relay server
- NETPLAY/RELAY: Fix the “spectator” bug when using the relay server When a player switches into the spectator mode (pressing “i”) while using the relay server, all players will disconnect.
- NETPLAY/RELAY: Overall stability has improved. Fixed a memory leak that would cause the relay server to become unresponsive after some time.
- NETPLAY/RELAY: Fixed critical bug that would cause all players to be disconnected from the relay server if one player was leaving the game. That bug had been open for one year and we were finally able to fix it.
- SWITCH/LIBNX/BUGFIX: Fix onscreen keyboard input regression
- THUMBNAIL UPDATER: When waiting for individual thumbnail file http transfers to complete, the task status checking is more accurate. This uses the same method as the new core updater - we now wait until the task is 'really' complete, instead of relying on the (slightly nebulous) 'task finished' state
- UWP: Add ANGLE support
- UWP: Wire up get_metrics to the fake context of D3D9/10/11/12 driver, enabling proper scaling and mouse/touch gestures
- VITA: Re-add Online Updater

View File

@ -45,6 +45,8 @@ else
DEF_FLAGS += -ffast-math
endif
DEF_FLAGS += -Wall
ifneq ($(findstring BSD,$(OS)),)
DEF_FLAGS += -DBSD
LDFLAGS += -L/usr/local/lib
@ -68,7 +70,7 @@ endif
include Makefile.common
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang"),1)
DEFINES += -Wno-invalid-source-encoding -Wno-incompatible-ms-struct
DEF_FLAGS += -Wno-invalid-source-encoding -Wno-incompatible-ms-struct
endif
ifeq ($(shell $(CC) -v 2>&1 | grep -c "tcc"),1)
@ -80,7 +82,7 @@ endif
HEADERS = $(wildcard */*/*.h) $(wildcard */*.h) $(wildcard *.h)
ifeq ($(MISSING_DECLS), 1)
DEFINES += -Werror=missing-declarations
DEF_FLAGS += -Werror=missing-declarations
endif
ifeq ($(HAVE_DYLIB), 1)
@ -106,10 +108,20 @@ ifneq ($(findstring Win32,$(OS)),)
LDFLAGS += -mwindows
endif
DEF_FLAGS += -Wall $(INCLUDE_DIRS) -I. -Ideps -Ideps/stb
ifneq ($(CXX_BUILD), 1)
ifneq ($(C89_BUILD),)
CFLAGS += -std=c89 -ansi -pedantic -Werror=pedantic -Wno-long-long
else ifeq ($(HAVE_C99), 1)
CFLAGS += $(C99_CFLAGS)
endif
CFLAGS += -D_GNU_SOURCE
endif
DEF_FLAGS += $(INCLUDE_DIRS) -I. -Ideps -Ideps/stb
CFLAGS += $(DEF_FLAGS)
CXXFLAGS += $(DEF_FLAGS) -std=c++11 -D__STDC_CONSTANT_MACROS
CXXFLAGS += $(DEF_FLAGS) -D__STDC_CONSTANT_MACROS
OBJCFLAGS := $(CFLAGS) -D__STDC_CONSTANT_MACROS
ifeq ($(HAVE_CXX), 1)
@ -127,29 +139,6 @@ else
LINK = $(CC)
endif
ifneq ($(CXX_BUILD), 1)
ifneq ($(GNU90_BUILD), 1)
ifneq ($(findstring icc,$(CC)),)
CFLAGS += -std=c99 -D_GNU_SOURCE
else
CFLAGS += -std=gnu99 -D_GNU_SOURCE
endif
endif
ifneq ($(C89_BUILD),)
CFLAGS += -std=c89 -ansi -pedantic -Werror=pedantic -Wno-long-long
endif
endif
ifeq ($(NOUNUSED), yes)
CFLAGS += -Wno-unused-result
CXXFLAGS += -Wno-unused-result
endif
ifeq ($(NOUNUSED_VARIABLE), yes)
CFLAGS += -Wno-unused-variable
CXXFLAGS += -Wno-unused-variable
endif
RARCH_OBJ := $(addprefix $(OBJDIR)/,$(OBJ))
ifneq ($(X86),)

View File

@ -7,6 +7,18 @@ ifeq ($(HAVE_STACK_USAGE), 1)
DEF_FLAGS += -fstack-usage
endif
ifeq ($(HAVE_NOUNUSED), 1)
DEF_FLAGS += $(NOUNUSED_CFLAGS)
endif
ifeq ($(HAVE_NOUNUSED_VARIABLE), 1)
DEF_FLAGS += $(NOUNUSED_VARIABLE_CFLAGS)
endif
ifeq ($(HAVE_CXX11), 1)
CXXFLAGS += $(CXX11_CFLAGS)
endif
ifeq ($(HAVE_GL_CONTEXT),)
HAVE_GL_CONTEXT = 0
HAVE_GL_MODERN = 0
@ -158,6 +170,7 @@ OBJ += frontend/frontend_driver.o \
intl/msg_hash_us.o \
$(LIBRETRO_COMM_DIR)/queues/task_queue.o \
tasks/task_content.o \
tasks/task_patch.o \
tasks/task_save.o \
tasks/task_file_transfer.o \
tasks/task_image.o \
@ -201,6 +214,7 @@ endif
OBJ += \
$(LIBRETRO_COMM_DIR)/file/nbio/nbio_intf.o \
$(LIBRETRO_COMM_DIR)/file/file_path.o \
$(LIBRETRO_COMM_DIR)/file/file_path_io.o \
file_path_special.o \
file_path_str.o \
$(LIBRETRO_COMM_DIR)/hash/rhash.o \
@ -228,6 +242,7 @@ OBJ += \
$(LIBRETRO_COMM_DIR)/file/config_file.o \
$(LIBRETRO_COMM_DIR)/file/config_file_userdata.o \
runtime_file.o \
disk_index_file.o \
tasks/task_screenshot.o \
tasks/task_powerstate.o \
$(LIBRETRO_COMM_DIR)/gfx/scaler/scaler.o \
@ -245,9 +260,14 @@ OBJ += \
$(LIBRETRO_COMM_DIR)/features/features_cpu.o \
performance_counters.o \
verbosity.o \
midi/drivers/null_midi.o \
$(LIBRETRO_COMM_DIR)/playlists/label_sanitization.o \
manual_content_scan.o
manual_content_scan.o \
disk_control_interface.o
ifeq ($(HAVE_BLISSBOX), 1)
DEFINES += -DHAVE_BLISSBOX
OBJ += tasks/task_autodetect_blissbox.o
endif
ifeq ($(HAVE_AUDIOMIXER), 1)
DEFINES += -DHAVE_AUDIOMIXER
@ -1748,6 +1768,11 @@ ifeq ($(HAVE_V4L2),1)
LIBS += $(V4L2_LIBS)
endif
# Accessibility
ifeq ($(HAVE_ACCESSIBILITY), 1)
DEFINES += -DHAVE_ACCESSIBILITY
endif
# Things that depend on network availability
ifeq ($(HAVE_NETWORKING), 1)

View File

@ -28,6 +28,7 @@ OBJ := ctr/ctr_system.o \
libretro-common/compat/compat_strcasestr.o \
libretro-common/compat/fopen_utf8.o \
libretro-common/file/file_path.o \
libretro-common/file/file_path_io.o \
libretro-common/string/stdstring.o \
libretro-common/lists/string_list.o \
libretro-common/lists/dir_list.o \

View File

@ -71,6 +71,7 @@ PPU_SRCS = griffin/griffin.c
#DEFINES += -DHAVE_VIDEO_LAYOUT
DEFINES += -DHAVE_MENU -DHAVE_MENU_WIDGETS -DHAVE_RGUI -DHAVE_XMB -DHAVE_OZONE -DHAVE_LIBRETRODB -DHAVE_MATERIALUI -DHAVE_SHADERPIPELINE -DRARCH_INTERNAL -DMSB_FIRST -DHAVE_OVERLAY -DHAVE_CC_RESAMPLER -DHAVE_STB_VORBIS -DHAVE_STB_FONT -DHAVE_RUNAHEAD -DHAVE_DR_MP3 -DHAVE_DR_FLAC
DEFINES += -DHAVE_ONLINE_UPDATER -DHAVE_UPDATE_ASSETS -DHAVE_UPDATE_CORES
ifeq ($(DEX_BUILD), 1)
DEFINES += -DDEX_BUILD

View File

@ -46,6 +46,7 @@ PPU_SRCS = frontend/frontend_salamander.c \
frontend/frontend_driver.c \
frontend/drivers/platform_ps3.c \
libretro-common/file/file_path.c \
libretro-common/file/file_path_io.c \
libretro-common/lists/dir_list.c \
libretro-common/lists/string_list.c \
libretro-common/file/retro_dirent.c \

View File

@ -36,6 +36,7 @@ OBJS = frontend/frontend_salamander.o \
frontend/frontend_driver.o \
frontend/drivers/platform_psp.o \
libretro-common/file/file_path.o \
libretro-common/file/file_path_io.o \
libretro-common/string/stdstring.o \
libretro-common/lists/string_list.o \
libretro-common/lists/dir_list.o \

View File

@ -36,6 +36,7 @@ OBJS = frontend/frontend_salamander.o \
frontend/frontend_driver.o \
frontend/drivers/platform_psp.o \
libretro-common/file/file_path.o \
libretro-common/file/file_path_io.o \
libretro-common/string/stdstring.o \
libretro-common/lists/string_list.o \
libretro-common/lists/dir_list.o \

View File

@ -56,6 +56,7 @@ OBJ = frontend/frontend_salamander.o \
frontend/drivers/platform_gx.o \
frontend/drivers/platform_wii.o \
libretro-common/file/file_path.o \
libretro-common/file/file_path_io.o \
libretro-common/hash/rhash.o \
libretro-common/string/stdstring.o \
libretro-common/lists/string_list.o \

View File

@ -57,6 +57,7 @@ ifeq ($(SALAMANDER_BUILD),1)
OBJ += libretro-common/compat/compat_strcasestr.o
OBJ += libretro-common/compat/fopen_utf8.o
OBJ += libretro-common/file/file_path.o
OBJ += libretro-common/file/file_path_io.o
OBJ += libretro-common/string/stdstring.o
OBJ += libretro-common/lists/string_list.o
OBJ += libretro-common/lists/dir_list.o

42
accessibility.h Normal file
View File

@ -0,0 +1,42 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __RETROARCH_ACCESSIBILITY_H
#define __RETROARCH_ACCESSIBILITY_H
#include <stdint.h>
#include <stddef.h>
#include <sys/types.h>
#include <stdlib.h>
#include <boolean.h>
#include <retro_inline.h>
#include <retro_common_api.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
RETRO_BEGIN_DECLS
bool is_accessibility_enabled(void);
bool accessibility_speak_priority(const char* speak_text, int priority);
RETRO_END_DECLS
#endif

View File

@ -53,7 +53,7 @@ typedef struct coreaudio
} coreaudio_t;
#if TARGET_OS_IOS
static bool g_interrupted = false;
static bool g_interrupted;
#endif
static void coreaudio_free(void *data)
@ -245,7 +245,7 @@ static void *coreaudio_init(const char *device,
#else
comp = AudioComponentFindNext(NULL, &desc);
#endif
if (!comp)
if (comp == NULL)
goto error;
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
@ -346,61 +346,40 @@ static ssize_t coreaudio_write(void *data, const void *buf_, size_t size)
const uint8_t *buf = (const uint8_t*)buf_;
size_t written = 0;
if (dev->nonblock)
{
bool cond = size > 0;
#if TARGET_OS_IOS
cond = cond && !g_interrupted;
while (!g_interrupted && size > 0)
#else
while (size > 0)
#endif
if (cond)
{
size_t write_avail;
slock_lock(dev->lock);
write_avail = fifo_write_avail(dev->buffer);
if (write_avail > size)
write_avail = size;
fifo_write(dev->buffer, buf, write_avail);
buf += write_avail;
written += write_avail;
size -= write_avail;
slock_unlock(dev->lock);
}
}
else
{
#if TARGET_OS_IOS
while (!g_interrupted && size > 0)
#else
while (size > 0)
#endif
size_t write_avail;
slock_lock(dev->lock);
write_avail = fifo_write_avail(dev->buffer);
if (write_avail > size)
write_avail = size;
fifo_write(dev->buffer, buf, write_avail);
buf += write_avail;
written += write_avail;
size -= write_avail;
if (dev->nonblock)
{
size_t write_avail;
slock_lock(dev->lock);
write_avail = fifo_write_avail(dev->buffer);
if (write_avail > size)
write_avail = size;
fifo_write(dev->buffer, buf, write_avail);
buf += write_avail;
written += write_avail;
size -= write_avail;
#if TARGET_OS_IPHONE
if (write_avail == 0 && !scond_wait_timeout(
dev->cond, dev->lock, 3000000))
g_interrupted = true;
#else
if (write_avail == 0)
scond_wait(dev->cond, dev->lock);
#endif
slock_unlock(dev->lock);
break;
}
#if TARGET_OS_IOS
if (write_avail == 0 && !scond_wait_timeout(
dev->cond, dev->lock, 3000000))
g_interrupted = true;
#else
if (write_avail == 0)
scond_wait(dev->cond, dev->lock);
#endif
slock_unlock(dev->lock);
}
return written;

View File

@ -260,37 +260,22 @@ static bool g_interrupted;
- (ssize_t)writeFloat:(const float *)data samples:(size_t)samples {
size_t written = 0;
if (_nonBlock)
while (!g_interrupted && samples > 0)
{
if (!g_interrupted && samples > 0)
{
size_t write_avail = rb_avail(&_rb);
if (write_avail > samples)
write_avail = samples;
size_t write_avail = rb_avail(&_rb);
if (write_avail > samples)
write_avail = samples;
rb_write_data(&_rb, data, write_avail);
data += write_avail;
written += write_avail;
samples -= write_avail;
}
}
else
{
while (!g_interrupted && samples > 0)
{
size_t write_avail = rb_avail(&_rb);
if (write_avail > samples)
write_avail = samples;
rb_write_data(&_rb, data, write_avail);
data += write_avail;
written += write_avail;
samples -= write_avail;
rb_write_data(&_rb, data, write_avail);
data += write_avail;
written += write_avail;
samples -= write_avail;
if (_nonBlock)
break;
if (write_avail == 0)
dispatch_semaphore_wait(_sema, DISPATCH_TIME_FOREVER);
}
if (write_avail == 0)
dispatch_semaphore_wait(_sema, DISPATCH_TIME_FOREVER);
}
return written;

View File

@ -17,7 +17,7 @@ typedef Thread compat_thread;
typedef CondVar compat_condvar;
#define compat_thread_create(thread, func, data, stack_size, prio, cpu) \
threadCreate(thread, func, data, stack_size, prio, cpu)
threadCreate(thread, func, data, NULL, stack_size, prio, cpu)
#define compat_thread_start(thread) \
threadStart(thread)
#define compat_thread_join(thread) \

View File

@ -232,7 +232,7 @@ static void *libnx_audren_thread_audio_init(const char *device, unsigned rate, u
svcGetThreadPriority(&thread_priority, CUR_THREAD_HANDLE);
rc = threadCreate(&aud->thread, &thread_job,
(void*)aud, thread_stack_size,
(void*)aud, NULL, thread_stack_size,
thread_priority - 1, thread_preferred_cpu);
if (R_FAILED(rc))
{

View File

@ -210,7 +210,7 @@ static void rcheevos_get_user_agent(char* buffer)
int major, minor;
char tmp[64];
ptr = rcheevos_user_agent_prefix + sprintf(rcheevos_user_agent_prefix, "RetroArch/" PACKAGE_VERSION);
ptr = rcheevos_user_agent_prefix + sprintf(rcheevos_user_agent_prefix, "RetroArch/%s", PACKAGE_VERSION);
if (frontend && frontend->get_os)
{
@ -2486,8 +2486,6 @@ found:
*************************************************************************/
CORO_SUB(RCHEEVOS_HTTP_GET)
rcheevos_get_user_agent(buffer);
for (coro->k = 0; coro->k < 5; coro->k++)
{
if (coro->k != 0)
@ -2513,6 +2511,7 @@ found:
continue;
}
rcheevos_get_user_agent(buffer);
net_http_connection_set_user_agent(coro->conn, buffer);
coro->http = net_http_new(coro->conn);

View File

@ -124,6 +124,7 @@ const uint8_t* rcheevos_patch_address(unsigned address, int console)
{
rarch_system_info_t* system = runloop_get_system_info();
const void* pointer = NULL;
unsigned original_address = address;
if (console == RC_CONSOLE_NINTENDO)
{
@ -208,6 +209,21 @@ const uint8_t* rcheevos_patch_address(unsigned address, int console)
address += 0x006000 - 0x020000;
}
}
else if (console == RC_CONSOLE_SEGA_CD)
{
if (address < 0x010000)
{
/* Work RAM. */
address += 0xFF0000;
CHEEVOS_LOG(RCHEEVOS_TAG "Sega CD memory address %X adjusted to %X\n", original_address, address);
}
else
{
/* CD-ROM peripheral RAM - exposed at virtual address to avoid banking */
address += 0x80020000 - 0x010000;
CHEEVOS_LOG(RCHEEVOS_TAG "Sega CD memory address %X adjusted to %X\n", original_address, address);
}
}
desc = system->mmaps.descriptors;
end = desc + system->mmaps.num_descriptors;
@ -216,19 +232,18 @@ const uint8_t* rcheevos_patch_address(unsigned address, int console)
{
if (((desc->core.start ^ address) & desc->core.select) == 0)
{
unsigned addr = address;
pointer = desc->core.ptr;
pointer = desc->core.ptr;
address -= desc->core.start;
address = (unsigned)rcheevos_var_reduce(
(addr - desc->core.start) & desc->disconnect_mask,
desc->core.disconnect);
if (desc->disconnect_mask)
address = (unsigned)rcheevos_var_reduce(address & desc->disconnect_mask, desc->core.disconnect);
if (address >= desc->core.len)
address -= rcheevos_var_highest_bit(address);
address += desc->core.offset;
CHEEVOS_LOG(RCHEEVOS_TAG "address %X set to descriptor %d at offset %X\n", addr, (int)((desc - system->mmaps.descriptors) + 1), address);
CHEEVOS_LOG(RCHEEVOS_TAG "address %X set to descriptor %d at offset %X\n", original_address, (int)((desc - system->mmaps.descriptors) + 1), address);
break;
}
}
@ -236,7 +251,6 @@ const uint8_t* rcheevos_patch_address(unsigned address, int console)
else
{
unsigned i;
unsigned addr = address;
for (i = 0; i < 4; i++)
{
@ -260,10 +274,9 @@ const uint8_t* rcheevos_patch_address(unsigned address, int console)
core_get_memory(&meminfo);
if (addr < meminfo.size)
if (address < meminfo.size)
{
pointer = meminfo.data;
address = addr;
break;
}
@ -272,15 +285,15 @@ const uint8_t* rcheevos_patch_address(unsigned address, int console)
* it's size is not always set correctly in the core.
*/
if (i == 0 && console == RC_CONSOLE_NINTENDO)
addr -= 0x6000;
address -= 0x6000;
else
addr -= meminfo.size;
address -= meminfo.size;
}
}
if (pointer == NULL)
{
CHEEVOS_LOG(RCHEEVOS_TAG "address %X not supported\n", address);
CHEEVOS_LOG(RCHEEVOS_TAG "address %X not supported\n", original_address);
return NULL;
}

View File

@ -180,6 +180,8 @@ enum event_command
CMD_EVENT_DISK_NEXT,
/* Cycle to previous disk. */
CMD_EVENT_DISK_PREV,
/* Switch to specified disk index */
CMD_EVENT_DISK_INDEX,
/* Appends disk image to disk image list. */
CMD_EVENT_DISK_APPEND_IMAGE,
/* Stops rumbling. */

View File

@ -329,7 +329,11 @@
#endif
/* Smooths picture. */
#if defined(_3DS) || defined(GEKKO) || defined(HW_RVL) || defined(PSP) || defined(VITA) || defined(SN_TARGET_PSP2) || defined(PS2) || defined(_XBOX)
#define DEFAULT_VIDEO_SMOOTH true
#else
#define DEFAULT_VIDEO_SMOOTH false
#endif
/* On resize and fullscreen, rendering area will stay 4:3 */
#define DEFAULT_FORCE_ASPECT true
@ -468,7 +472,9 @@ static bool quick_menu_show_save_core_overrides = true;
static bool quick_menu_show_save_game_overrides = true;
static bool quick_menu_show_save_content_dir_overrides = true;
#ifdef HAVE_NETWORKING
static bool quick_menu_show_download_thumbnails = true;
#endif
static bool kiosk_mode_enable = false;
@ -507,6 +513,8 @@ static bool menu_savestate_resume = true;
static bool menu_savestate_resume = false;
#endif
#define DEFAULT_MENU_INSERT_DISK_RESUME true
static bool content_show_settings = true;
static bool content_show_favorites = true;
#ifdef HAVE_IMAGEVIEWER
@ -915,11 +923,11 @@ static const bool network_on_demand_thumbnails = false;
#endif
/* Number of entries that will be kept in content history playlist file. */
static const unsigned default_content_history_size = 100;
static const unsigned default_content_history_size = 200;
/* Number of entries that will be kept in content favorites playlist file.
* -1 == 'unlimited' (99999) */
static const int default_content_favorites_size = 100;
static const int default_content_favorites_size = 200;
/* Sort all playlists (apart from histories) alphabetically */
static const bool playlist_sort_alphabetical = true;

View File

@ -1341,7 +1341,6 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("frame_time_counter_reset_after_load_state", &settings->bools.frame_time_counter_reset_after_load_state, true, false, false);
SETTING_BOOL("frame_time_counter_reset_after_save_state", &settings->bools.frame_time_counter_reset_after_save_state, true, false, false);
SETTING_BOOL("crt_switch_resolution_use_custom_refresh_rate", &settings->bools.crt_switch_custom_refresh_enable, true, false, false);
SETTING_BOOL("automatically_add_content_to_playlist", &settings->bools.automatically_add_content_to_playlist, true, DEFAULT_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, false);
SETTING_BOOL("ui_companion_start_on_boot", &settings->bools.ui_companion_start_on_boot, true, ui_companion_start_on_boot, false);
SETTING_BOOL("ui_companion_enable", &settings->bools.ui_companion_enable, true, ui_companion_enable, false);
SETTING_BOOL("ui_companion_toggle", &settings->bools.ui_companion_toggle, false, ui_companion_toggle, false);
@ -1460,6 +1459,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("menu_horizontal_animation", &settings->bools.menu_horizontal_animation, true, DEFAULT_MENU_HORIZONTAL_ANIMATION, false);
SETTING_BOOL("menu_pause_libretro", &settings->bools.menu_pause_libretro, true, true, false);
SETTING_BOOL("menu_savestate_resume", &settings->bools.menu_savestate_resume, true, menu_savestate_resume, false);
SETTING_BOOL("menu_insert_disk_resume", &settings->bools.menu_insert_disk_resume, true, DEFAULT_MENU_INSERT_DISK_RESUME, false);
SETTING_BOOL("menu_mouse_enable", &settings->bools.menu_mouse_enable, true, DEFAULT_MOUSE_ENABLE, false);
SETTING_BOOL("menu_pointer_enable", &settings->bools.menu_pointer_enable, true, DEFAULT_POINTER_ENABLE, false);
SETTING_BOOL("menu_timedate_enable", &settings->bools.menu_timedate_enable, true, true, false);

View File

@ -154,6 +154,7 @@ typedef struct settings
bool menu_show_start_screen;
bool menu_pause_libretro;
bool menu_savestate_resume;
bool menu_insert_disk_resume;
bool menu_timedate_enable;
bool menu_battery_level_enable;
bool menu_core_enable;
@ -360,7 +361,6 @@ typedef struct settings
bool bluetooth_enable;
bool localap_enable;
bool automatically_add_content_to_playlist;
bool video_window_show_decorations;
bool video_window_save_positions;

5
core.h
View File

@ -25,6 +25,7 @@
#include "core_type.h"
#include "input/input_defines.h"
#include "disk_control_interface.h"
RETRO_BEGIN_DECLS
@ -67,8 +68,8 @@ typedef struct rarch_system_info
bool supports_vfs;
struct retro_disk_control_callback disk_control_cb;
struct retro_location_callback location_cb;
disk_control_interface_t disk_control;
struct retro_location_callback location_cb;
struct
{

View File

@ -21,14 +21,12 @@
#include <file/file_path.h>
#include <lists/dir_list.h>
#include <file/archive_file.h>
#include <streams/file_stream.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "retroarch.h"
#include "verbosity.h"
#include "core_info.h"
#include "file_path_special.h"
@ -610,10 +608,7 @@ static bool core_info_list_update_missing_firmware_internal(
info->firmware[i].path, path_size);
info->firmware[i].missing = !path_is_valid(path);
if (info->firmware[i].missing && !info->firmware[i].optional)
{
*set_missing_bios = true;
RARCH_WARN("Firmware missing: %s\n", info->firmware[i].path);
}
}
free(path);

View File

@ -94,7 +94,13 @@ static unsigned sw_sws_threads;
static video_buffer_t *video_buffer;
static tpool_t *tpool;
#if LIBAVUTIL_VERSION_MAJOR > 55
/* If libavutil is at least version 55 or higher,
* and if libavcodec is at least version 57.80.100 or higher,
* enable hardware acceleration */
#define ENABLE_HW_ACCEL ((LIBAVUTIL_VERSION_MAJOR > 55) && ENABLE_HW_ACCEL_CHECK2())
#define ENABLE_HW_ACCEL_CHECK2() ((LIBAVCODEC_VERSION_MAJOR == 57 && LIBAVCODEC_VERSION_MINOR >= 80 && LIBAVCODEC_VERSION_MICRO >= 100) || (LIBAVCODEC_VERSION_MAJOR > 57))
#if ENABLE_HW_ACCEL
static enum AVHWDeviceType hw_decoder;
static bool hw_decoding_enabled;
static enum AVPixelFormat pix_fmt;
@ -278,11 +284,11 @@ void CORE_PREFIX(retro_get_system_av_info)(struct retro_system_av_info *info)
void CORE_PREFIX(retro_set_environment)(retro_environment_t cb)
{
static const struct retro_variable vars[] = {
#if LIBAVUTIL_VERSION_MAJOR > 55
#if ENABLE_HW_ACCEL
{ "ffmpeg_hw_decoder", "Use Hardware decoder (restart); off|auto|"
"cuda|d3d11va|drm|dxva2|mediacodec|opencl|qsv|vaapi|vdpau|videotoolbox" },
#endif
{ "ffmpeg_sw_decoder_threads", "Software decoder thread count (restart); auto|1|2|4|8|16" },
{ "ffmpeg_sw_decoder_threads", "Software decoder thread count (restart); auto|1|2|4|6|8|10|12|14|16" },
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
{ "ffmpeg_temporal_interp", "Temporal Interpolation; disabled|enabled" },
#ifdef HAVE_GL_FFT
@ -409,7 +415,7 @@ static void check_variables(bool firststart)
slock_unlock(decode_thread_lock);
}
#if LIBAVUTIL_VERSION_MAJOR > 55
#if ENABLE_HW_ACCEL
if (firststart)
{
hw_var.key = "ffmpeg_hw_decoder";
@ -837,7 +843,7 @@ void CORE_PREFIX(retro_run)(void)
CORE_PREFIX(audio_batch_cb)(audio_buffer, to_read_frames);
}
#if LIBAVUTIL_VERSION_MAJOR > 55
#if ENABLE_HW_ACCEL
/*
* Try to initialize a specific HW decoder defined by type.
* Optionaly tests the pixel format list for a compatible pixel format.
@ -936,7 +942,7 @@ static enum AVPixelFormat select_decoder(AVCodecContext *ctx,
{
enum AVPixelFormat format = AV_PIX_FMT_NONE;
#if LIBAVUTIL_VERSION_MAJOR > 55
#if ENABLE_HW_ACCEL
if (!force_sw_decoder)
{
if (hw_decoder == AV_HWDEVICE_TYPE_NONE)
@ -960,7 +966,7 @@ static enum AVPixelFormat select_decoder(AVCodecContext *ctx,
format = fctx->streams[video_stream_index]->codec->pix_fmt;
#if LIBAVUTIL_VERSION_MAJOR > 55
#if ENABLE_HW_ACCEL
hw_decoding_enabled = false;
}
else
@ -970,7 +976,7 @@ static enum AVPixelFormat select_decoder(AVCodecContext *ctx,
return format;
}
#if LIBAVUTIL_VERSION_MAJOR > 55
#if ENABLE_HW_ACCEL
/* Callback used by ffmpeg to configure the pixelformat to use. */
static enum AVPixelFormat get_format(AVCodecContext *ctx,
const enum AVPixelFormat *pix_fmts)
@ -1005,7 +1011,7 @@ static bool open_codec(AVCodecContext **ctx, enum AVMediaType type, unsigned ind
{
video_stream_index = index;
#if LIBAVUTIL_VERSION_MAJOR > 55
#if ENABLE_HW_ACCEL
vctx->get_format = get_format;
pix_fmt = select_decoder((*ctx), NULL);
#else
@ -1293,7 +1299,7 @@ static void sws_worker_thread(void *arg)
AVFrame *tmp_frame = NULL;
video_decoder_context_t *ctx = (video_decoder_context_t*) arg;
#if LIBAVUTIL_VERSION_MAJOR > 55
#if ENABLE_HW_ACCEL
if (hw_decoding_enabled)
tmp_frame = ctx->hw_source;
else
@ -1336,7 +1342,7 @@ static void sws_worker_thread(void *arg)
#endif
av_frame_unref(ctx->source);
#if LIBAVUTIL_VERSION_MAJOR > 55
#if ENABLE_HW_ACCEL
av_frame_unref(ctx->hw_source);
#endif
@ -1394,7 +1400,7 @@ static void decode_video(AVCodecContext *ctx, AVPacket *pkt, size_t frame_size)
goto end;
}
#if LIBAVUTIL_VERSION_MAJOR > 55
#if ENABLE_HW_ACCEL
if (hw_decoding_enabled)
/* Copy data from VRAM to RAM */
if ((ret = av_hwframe_transfer_data(decoder_ctx->hw_source, decoder_ctx->source, 0)) < 0)
@ -1530,8 +1536,16 @@ static void decode_thread_seek(double time)
#endif
}
static bool earlier_or_close_enough(double p1, double p2) {
return (p1 <= p2 || (p1-p2) <= 0.001);
/**
* This function makes sure that we don't decode too many
* packets and cause stalls in our decoding pipeline.
* This could happen if we decode too many packets and
* saturate our buffers. We have a window of "still okay"
* to decode, that depends on the media fps.
**/
static bool earlier_or_close_enough(double p1, double p2)
{
return (p1 <= p2 || (p1-p2) < (1.0 / media.interpolate_fps) );
}
static void decode_thread(void *data)
@ -1643,15 +1657,17 @@ static void decode_thread(void *data)
/*
* Decode audio packet if:
* 1. there is a vido packet for in the buffer
* 2. it's the start of file
* 3. it's audio only media
* 4. EOF
* 1. it's the start of file or it's audio only media
* 2. there is a video packet for in the buffer
* 3. EOF
**/
if (!packet_buffer_empty(audio_packet_buffer) &&
((!eof && earlier_or_close_enough(next_audio_start, next_video_end)) ||
next_video_end == 0.0 ||
eof))
(
next_video_end == 0.0 ||
(!eof && earlier_or_close_enough(next_audio_start, next_video_end)) ||
eof
)
)
{
packet_buffer_get_packet(audio_packet_buffer, pkt);
last_audio_end = audio_timebase * (pkt->pts + pkt->duration);
@ -1668,7 +1684,12 @@ static void decode_thread(void *data)
* 3. EOF
**/
if (!packet_buffer_empty(video_packet_buffer) &&
((!eof && earlier_or_close_enough(next_video_end, last_audio_end)) || !actx_active || eof ))
(
(!eof && earlier_or_close_enough(next_video_end, last_audio_end)) ||
!actx_active ||
eof
)
)
{
packet_buffer_get_packet(video_packet_buffer, pkt);
@ -1733,8 +1754,10 @@ static void decode_thread(void *data)
for (i = 0; (int)i < audio_streams_num; i++)
swr_free(&swr[i]);
#if ENABLE_HW_ACCEL
if (vctx && vctx->hw_device_ctx)
av_buffer_unref(&vctx->hw_device_ctx);
#endif
packet_buffer_destroy(audio_packet_buffer);
packet_buffer_destroy(video_packet_buffer);

View File

@ -16,7 +16,7 @@ struct packet_buffer
packet_buffer_t *packet_buffer_create()
{
packet_buffer_t *b = malloc(sizeof(packet_buffer_t));
packet_buffer_t *b = (packet_buffer_t*)malloc(sizeof(packet_buffer_t));
if (!b)
return NULL;

View File

@ -25,14 +25,14 @@ struct video_buffer
video_buffer_t *video_buffer_create(size_t capacity, int frame_size, int width, int height)
{
video_buffer_t *b = malloc(sizeof(video_buffer_t));
video_buffer_t *b = (video_buffer_t*)malloc(sizeof(video_buffer_t));
if (!b)
return NULL;
memset(b, 0, sizeof(video_buffer_t));
b->capacity = capacity;
b->status = malloc(sizeof(enum kbStatus) * capacity);
b->status = (enum kbStatus*)malloc(sizeof(enum kbStatus) * capacity);
if (!b->status)
goto fail;
for (int i = 0; i < capacity; i++)
@ -44,21 +44,21 @@ video_buffer_t *video_buffer_create(size_t capacity, int frame_size, int width,
if (!b->lock || !b->open_cond || !b->finished_cond)
goto fail;
b->buffer = malloc(sizeof(video_decoder_context_t) * capacity);
b->buffer = (video_decoder_context_t*)malloc(sizeof(video_decoder_context_t) * capacity);
if (!b->buffer)
goto fail;
for (int i = 0; i < capacity; i++)
{
b->buffer[i].index = i;
b->buffer[i].pts = 0;
b->buffer[i].sws = sws_alloc_context();
b->buffer[i].source = av_frame_alloc();
b->buffer[i].index = i;
b->buffer[i].pts = 0;
b->buffer[i].sws = sws_alloc_context();
b->buffer[i].source = av_frame_alloc();
#if LIBAVUTIL_VERSION_MAJOR > 55
b->buffer[i].hw_source = av_frame_alloc();
#endif
b->buffer[i].target = av_frame_alloc();
b->buffer[i].frame_buf = av_malloc(frame_size);
b->buffer[i].target = av_frame_alloc();
b->buffer[i].frame_buf = (uint8_t*)av_malloc(frame_size);
avpicture_fill((AVPicture*)b->buffer[i].target, (const uint8_t*)b->buffer[i].frame_buf,
PIX_FMT_RGB32, width, height);

View File

@ -8,6 +8,7 @@ image_core.so: image_core.c
../../libretro-common/compat/compat_strcasestr.c \
../../libretro-common/compat/compat_strl.c \
../../libretro-common/file/file_path.c \
../../libretro-common/file/file_path_io.c \
../../libretro-common/file/retro_dirent.c \
../../libretro-common/lists/dir_list.c \
../../libretro-common/lists/string_list.c \

View File

@ -29,7 +29,6 @@
#include "core_info.h"
#include "database_info.h"
#include "verbosity.h"
int database_info_build_query_enum(char *s, size_t len,
enum database_query_type type,
@ -105,7 +104,6 @@ int database_info_build_query_enum(char *s, size_t len,
add_quotes = false;
break;
case DATABASE_QUERY_NONE:
RARCH_LOG("Unknown type: %d\n", type);
break;
}
@ -122,10 +120,6 @@ int database_info_build_query_enum(char *s, size_t len,
strlcat(s, "}", len);
#if 0
RARCH_LOG("query: %s\n", s);
#endif
return 0;
}
@ -289,10 +283,6 @@ static int database_cursor_iterate(libretrodb_cursor_t *cur,
else if (string_is_equal(str, "md5"))
db_info->md5 = bin_to_hex_alloc(
(uint8_t*)val->val.binary.buff, val->val.binary.len);
else
{
RARCH_LOG("Unknown key: %s\n", str);
}
}
rmsgpack_dom_value_free(&item);

View File

@ -1,92 +0,0 @@
---
AccessModifierOffset: -4
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Stroustrup
BreakBeforeInheritanceComma: true
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: ''
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
FixNamespaceComments: true
ForEachMacros: []
IndentCaseLabels: false
IncludeCategories:
- Regex: '^("|<)stdafx\.h(pp)?("|>)'
Priority: -1
- Regex: '^<(W|w)indows.h>'
Priority: 1
- Regex: '^<'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '(_test|_win|_linux|_mac|_ios|_osx|_null)?$'
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakAssignment: 0
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 9999999
PointerAlignment: Left
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
---
Language: Cpp
---
Language: ObjC
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: false
---
Language: Java
BasedOnStyle: Google
BreakAfterJavaFieldAnnotations: true
...

View File

@ -1,5 +0,0 @@
/build*/
/.vscode/
/thirdparty/
.vs/
.DS_Store

View File

@ -1,47 +0,0 @@
language: cpp
env:
global:
- CLANG_FORMAT_SUFFIX="-dummy" # don't use formatting on Travis, this is
# needed not to use default 3.5 version
# which is too old.
matrix:
include:
- os: linux
env: MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-5
- os: linux
env: MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0"
addons:
apt:
sources:
- llvm-toolchain-trusty-4.0
packages:
- clang-4.0
- os: linux
env: MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0"
addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
packages:
- clang-5.0
- os: osx
osx_image: xcode9
# prevent Travis from overwriting our CXX variables
before_install:
- eval "${MATRIX_EVAL}"
- echo $CXX
script:
- mkdir build
- cd build
- cmake -DCLANG_FORMAT_SUFFIX=$CLANG_FORMAT_SUFFIX --config Release ..
- cmake --build . -- -j2

View File

@ -1,56 +0,0 @@
cmake_minimum_required (VERSION 3.2.0)
project (DiscordRPC)
include(GNUInstallDirs)
option(BUILD_EXAMPLES "Build example apps" ON)
# format
file(GLOB_RECURSE ALL_SOURCE_FILES
examples/*.cpp examples/*.h examples/*.c
include/*.h
src/*.cpp src/*.h src/*.c
)
# Set CLANG_FORMAT_SUFFIX if you are using custom clang-format, e.g. clang-format-5.0
find_program(CLANG_FORMAT_CMD clang-format${CLANG_FORMAT_SUFFIX})
if (CLANG_FORMAT_CMD)
add_custom_target(
clangformat
COMMAND ${CLANG_FORMAT_CMD}
-i -style=file -fallback-style=none
${ALL_SOURCE_FILES}
DEPENDS
${ALL_SOURCE_FILES}
)
endif(CLANG_FORMAT_CMD)
# thirdparty stuff
execute_process(
COMMAND mkdir ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty
ERROR_QUIET
)
find_file(RAPIDJSONTEST NAMES rapidjson rapidjson-1.1.0 PATHS ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty CMAKE_FIND_ROOT_PATH_BOTH)
if (NOT RAPIDJSONTEST)
message("no rapidjson, download")
set(RJ_TAR_FILE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/v1.1.0.tar.gz)
file(DOWNLOAD https://github.com/miloyip/rapidjson/archive/v1.1.0.tar.gz ${RJ_TAR_FILE})
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xzf ${RJ_TAR_FILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty
)
file(REMOVE ${RJ_TAR_FILE})
endif(NOT RAPIDJSONTEST)
find_file(RAPIDJSON NAMES rapidjson rapidjson-1.1.0 PATHS ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty CMAKE_FIND_ROOT_PATH_BOTH)
add_library(rapidjson STATIC IMPORTED ${RAPIDJSON})
# add subdirs
add_subdirectory(src)
if (BUILD_EXAMPLES)
add_subdirectory(examples/send-presence)
endif(BUILD_EXAMPLES)

View File

@ -1,91 +0,0 @@
# Discord RPC
This is a library for interfacing your game with a locally running Discord desktop client. It's known to work on Windows, macOS, and Linux. You can use the lib directly if you like, or use it as a guide to writing your own if it doesn't suit your game as is. PRs/feedback welcome if you have an improvement everyone might want, or can describe how this doesn't meet your needs.
Included here are some quick demos that implement the very minimal subset to show current status, and
have callbacks for where a more complete game would do more things (joining, spectating, etc).
## Documentation
The most up to date documentation for Rich Presence can always be found on our [developer site](https://discordapp.com/developers/docs/rich-presence/how-to)! If you're interested in rolling your own native implementation of Rich Presence via IPC sockets instead of using our SDK—hey, you've got free time, right?—check out the ["Hard Mode" documentation](https://github.com/discordapp/discord-rpc/blob/master/documentation/hard-mode.md).
## Basic Usage
Zeroith, you should be set up to build things because you are a game developer, right?
First, head on over to the [Discord developers site](https://discordapp.com/developers/applications/me) and make yourself an app. Keep track of `Client ID` -- you'll need it here to pass to the init function.
### From package
Download a release package for your platform(s) -- they have subdirs with various prebuilt options, select the one you need add `/include` to your compile includes, `/lib` to your linker paths, and link with `discord-rpc`. For the dynamically linked builds, you'll need to ship the associated file along with your game.
### From repo
First-eth, you'll want `CMake`. There's a few different ways to install it on your system, and you should refer to [their website](https://cmake.org/install/). Many package managers provide ways of installing CMake as well.
To make sure it's installed correctly, type `cmake --version` into your flavor of terminal/cmd. If you get a response with a version number, you're good to go!
There's a [CMake](https://cmake.org/download/) file that should be able to generate the lib for you; Sometimes I use it like this:
```sh
cd <path to discord-rpc>
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=<path to install discord-rpc to>
cmake --build . --config Release --target install
```
There is a wrapper build script `build.py` that runs `cmake` with a few different options.
Usually, I run `build.py` to get things started, then use the generated project files as I work on things. It does depend on `click` library, so do a quick `pip install click` to make sure you have it if you want to run `build.py`.
There are some CMake options you might care about:
| flag | default | does |
|------|---------|------|
| `ENABLE_IO_THREAD` | `ON` | When enabled, we start up a thread to do io processing, if disabled you should call `Discord_UpdateConnection` yourself.
| `USE_STATIC_CRT` | `OFF` | (Windows) Enable to statically link the CRT, avoiding requiring users install the redistributable package. (The prebuilt binaries enable this option)
| [`BUILD_SHARED_LIBS`](https://cmake.org/cmake/help/v3.7/variable/BUILD_SHARED_LIBS.html) | `OFF` | Build library as a DLL
| `WARNINGS_AS_ERRORS` | `OFF` | When enabled, compiles with `-Werror` (on *nix platforms). |
## Continuous Builds
Why do we have three of these? Three times the fun!
| CI | badge |
|----|-------|
| TravisCI | [![Build status](https://travis-ci.org/discordapp/discord-rpc.svg?branch=master)](https://travis-ci.org/discordapp/discord-rpc)
| AppVeyor | [![Build status](https://ci.appveyor.com/api/projects/status/qvkoc0w1c4f4b8tj?svg=true)](https://ci.appveyor.com/project/crmarsh/discord-rpc)
| Buildkite (internal) | [![Build status](https://badge.buildkite.com/e103d79d247f6776605a15246352a04b8fd83d69211b836111.svg)](https://buildkite.com/discord/discord-rpc)
## Sample: send-presence
This is a text adventure "game" that inits/deinits the connection to Discord, and sends a presence update on each command.
## Sample: button-clicker
This is a sample [Unity](https://unity3d.com/) project that wraps a DLL version of the library, and sends presence updates when you click on a button. Run `python build.py unity` in the root directory to build the correct library files and place them in their respective folders.
## Sample: unrealstatus
This is a sample [Unreal](https://www.unrealengine.com) project that wraps the DLL version of the library with an Unreal plugin, exposes a blueprint class for interacting with it, and uses that to make a very simple UI. Run `python build.py unreal` in the root directory to build the correct library files and place them in their respective folders.
## Wrappers and Implementations
Below is a table of unofficial, community-developed wrappers for and implementations of Rich Presence in various languages. If you would like to have yours added, please make a pull request adding your repository to the table. The repository should include:
- The code
- A brief ReadMe of how to use it
- A working example
###### Rich Presence Wrappers and Implementations
| Name | Language |
|------|----------|
| [DerelictDiscordRPC](https://github.com/voidblaster/DerelictDiscordRPC) | [D](https://dlang.org/) |
| [discord-rpc.jar](https://github.com/Vatuu/discord-rpc "Discord-RPC.jar") | Java |
| [java-discord-rpc](https://github.com/MinnDevelopment/java-discord-rpc) | Java |
| [Discord-IPC](https://github.com/jagrosh/DiscordIPC) | Java |
| [Discord Rich Presence](https://npmjs.org/discord-rich-presence) | JavaScript |
| [drpc4k](https://github.com/Bluexin/drpc4k) | [Kotlin](https://kotlinlang.org/) |
| [lua-discordRPC](https://github.com/pfirsich/lua-discordRPC) | LuaJIT (FFI) |
| [pypresence](https://github.com/qwertyquerty/pypresence) | [Python](https://python.org/) |
| [SwordRPC](https://github.com/Azoy/SwordRPC) | [Swift](https://swift.org) |

View File

@ -1,17 +0,0 @@
version: '{build}'
install:
- python -m pip install click
build_script:
- mkdir examples\unrealstatus\Plugins\discordrpc\Binaries\ThirdParty\discordrpcLibrary\Win64
- python build.py
artifacts:
- path: builds\install\win32-dynamic
name: win32-dynamic
- path: builds\install\win32-static
name: win32-static
- path: builds\install\win64-dynamic
name: win64-dynamic
- path: builds\install\win64-static
name: win64-static

View File

@ -1,304 +0,0 @@
#!/usr/bin/env python
import os
import subprocess
import sys
import shutil
import zipfile
from contextlib import contextmanager
import click
def get_platform():
""" a name for the platform """
if sys.platform.startswith('win'):
return 'win'
elif sys.platform == 'darwin':
return 'osx'
elif sys.platform.startswith('linux'):
return 'linux'
raise Exception('Unsupported platform ' + sys.platform)
SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
# we use Buildkite which sets this env variable by default
IS_BUILD_MACHINE = os.environ.get('CI', '') == 'true'
PLATFORM = get_platform()
INSTALL_ROOT = os.path.join(SCRIPT_PATH, 'builds', 'install')
def get_signtool():
""" get path to code signing tool """
if PLATFORM == 'win':
sdk_dir = 'c:\\Program Files (x86)\\Windows Kits\\10' # os.environ['WindowsSdkDir']
return os.path.join(sdk_dir, 'bin', 'x86', 'signtool.exe')
elif PLATFORM == 'osx':
return '/usr/bin/codesign'
@contextmanager
def cd(new_dir):
""" Temporarily change current directory """
if new_dir:
old_dir = os.getcwd()
os.chdir(new_dir)
yield
if new_dir:
os.chdir(old_dir)
def mkdir_p(path):
""" mkdir -p """
if not os.path.isdir(path):
click.secho('Making ' + path, fg='yellow')
os.makedirs(path)
@click.group(invoke_without_command=True)
@click.pass_context
@click.option('--clean', is_flag=True)
def cli(ctx, clean):
""" click wrapper for command line stuff """
if ctx.invoked_subcommand is None:
ctx.invoke(libs, clean=clean)
if IS_BUILD_MACHINE:
ctx.invoke(sign)
ctx.invoke(archive)
@cli.command()
@click.pass_context
def unity(ctx):
""" build just dynamic libs for use in unity project """
ctx.invoke(libs, clean=False, static=False, shared=True, skip_formatter=True, just_release=True)
BUILDS = []
click.echo('--- Copying libs and header into unity example')
UNITY_PROJECT_PATH = os.path.join(SCRIPT_PATH, 'examples', 'button-clicker', 'Assets', 'Plugins')
if sys.platform.startswith('win'):
LIBRARY_NAME = 'discord-rpc.dll'
BUILD_64_BASE_PATH = os.path.join(SCRIPT_PATH, 'builds', 'win64-dynamic', 'src', 'Release')
UNITY_64_DLL_PATH = os.path.join(UNITY_PROJECT_PATH, 'x86_64')
BUILDS.append({BUILD_64_BASE_PATH: UNITY_64_DLL_PATH})
BUILD_32_BASE_PATH = os.path.join(SCRIPT_PATH, 'builds', 'win32-dynamic', 'src', 'Release')
UNITY_32_DLL_PATH = os.path.join(UNITY_PROJECT_PATH, 'x86')
BUILDS.append({BUILD_32_BASE_PATH: UNITY_32_DLL_PATH})
elif sys.platform == 'darwin':
LIBRARY_NAME = 'discord-rpc.bundle'
BUILD_BASE_PATH = os.path.join(SCRIPT_PATH, 'builds', 'osx-dynamic', 'src')
UNITY_DLL_PATH = UNITY_PROJECT_PATH
os.rename(
os.path.join(BUILD_BASE_PATH, 'libdiscord-rpc.dylib'), os.path.join(BUILD_BASE_PATH, 'discord-rpc.bundle'))
BUILDS.append({BUILD_BASE_PATH: UNITY_DLL_PATH})
elif sys.platform.startswith('linux'):
LIBRARY_NAME = 'discord-rpc.so'
BUILD_BASE_PATH = os.path.join(SCRIPT_PATH, 'builds', 'linux-dynamic', 'src')
UNITY_DLL_PATH = os.path.join(UNITY_PROJECT_PATH, 'x86')
os.rename(os.path.join(BUILD_BASE_PATH, 'libdiscord-rpc.so'), os.path.join(BUILD_BASE_PATH, 'discord-rpc.so'))
BUILDS.append({BUILD_BASE_PATH: UNITY_DLL_PATH})
else:
raise Exception('Unsupported platform ' + sys.platform)
for build in BUILDS:
for i in build:
mkdir_p(build[i])
shutil.copy(os.path.join(i, LIBRARY_NAME), build[i])
@cli.command()
@click.pass_context
def unreal(ctx):
""" build libs and copy them into the unreal project """
ctx.invoke(libs, clean=False, static=False, shared=True, skip_formatter=True, just_release=True)
BUILDS = []
click.echo('--- Copying libs and header into unreal example')
UNREAL_PROJECT_PATH = os.path.join(SCRIPT_PATH, 'examples', 'unrealstatus', 'Plugins', 'discordrpc')
UNREAL_INCLUDE_PATH = os.path.join(UNREAL_PROJECT_PATH, 'Source', 'ThirdParty', 'DiscordRpcLibrary', 'Include')
mkdir_p(UNREAL_INCLUDE_PATH)
shutil.copy(os.path.join(SCRIPT_PATH, 'include', 'discord_rpc.h'), UNREAL_INCLUDE_PATH)
if sys.platform.startswith('win'):
LIBRARY_NAME = 'discord-rpc.lib'
BUILD_64_BASE_PATH = os.path.join(SCRIPT_PATH, 'builds', 'win64-dynamic', 'src', 'Release')
UNREAL_64_DLL_PATH = os.path.join(UNREAL_PROJECT_PATH, 'Source', 'ThirdParty', 'DiscordRpcLibrary', 'Win64')
BUILDS.append({BUILD_64_BASE_PATH: UNREAL_64_DLL_PATH})
BUILD_32_BASE_PATH = os.path.join(SCRIPT_PATH, 'builds', 'win32-dynamic', 'src', 'Release')
UNREAL_32_DLL_PATH = os.path.join(UNREAL_PROJECT_PATH, 'Source', 'ThirdParty', 'DiscordRpcLibrary', 'Win32')
BUILDS.append({BUILD_32_BASE_PATH: UNREAL_32_DLL_PATH})
elif sys.platform == 'darwin':
LIBRARY_NAME = 'libdiscord-rpc.dylib'
BUILD_BASE_PATH = os.path.join(SCRIPT_PATH, 'builds', 'osx-dynamic', 'src')
UNREAL_DLL_PATH = os.path.join(UNREAL_PROJECT_PATH, 'Source', 'ThirdParty', 'DiscordRpcLibrary', 'Mac')
BUILDS.append({BUILD_BASE_PATH: UNREAL_DLL_PATH})
elif sys.platform.startswith('linux'):
LIBRARY_NAME = 'libdiscord-rpc.so'
BUILD_BASE_PATH = os.path.join(SCRIPT_PATH, 'builds', 'linux-dynamic', 'src')
UNREAL_DLL_PATH = os.path.join(UNREAL_PROJECT_PATH, 'Source', 'ThirdParty', 'DiscordRpcLibrary', 'Linux')
BUILDS.append({BUILD_BASE_PATH: UNREAL_DLL_PATH})
else:
raise Exception('Unsupported platform ' + sys.platform)
for build in BUILDS:
for i in build:
mkdir_p(build[i])
shutil.copy(os.path.join(i, LIBRARY_NAME), build[i])
def build_lib(build_name, generator, options, just_release):
""" Create a dir under builds, run build and install in it """
build_path = os.path.join(SCRIPT_PATH, 'builds', build_name)
install_path = os.path.join(INSTALL_ROOT, build_name)
mkdir_p(build_path)
mkdir_p(install_path)
with cd(build_path):
initial_cmake = ['cmake', SCRIPT_PATH, '-DCMAKE_INSTALL_PREFIX=%s' % os.path.join('..', 'install', build_name)]
if generator:
initial_cmake.extend(['-G', generator])
for key in options:
val = options[key]
if type(val) is bool:
val = 'ON' if val else 'OFF'
initial_cmake.append('-D%s=%s' % (key, val))
click.echo('--- Building ' + build_name)
subprocess.check_call(initial_cmake)
if not just_release:
subprocess.check_call(['cmake', '--build', '.', '--config', 'Debug'])
subprocess.check_call(['cmake', '--build', '.', '--config', 'Release', '--target', 'install'])
@cli.command()
def archive():
""" create zip of install dir """
click.echo('--- Archiving')
archive_file_path = os.path.join(SCRIPT_PATH, 'builds', 'discord-rpc-%s.zip' % get_platform())
archive_file = zipfile.ZipFile(archive_file_path, 'w', zipfile.ZIP_DEFLATED)
archive_src_base_path = INSTALL_ROOT
archive_dst_base_path = 'discord-rpc'
with cd(archive_src_base_path):
for path, _, filenames in os.walk('.'):
for fname in filenames:
fpath = os.path.join(path, fname)
dst_path = os.path.normpath(os.path.join(archive_dst_base_path, fpath))
click.echo('Adding ' + dst_path)
archive_file.write(fpath, dst_path)
@cli.command()
def sign():
""" Do code signing within install directory using our cert """
tool = get_signtool()
signable_extensions = set()
if PLATFORM == 'win':
signable_extensions.add('.dll')
sign_command_base = [
tool,
'sign',
'/n',
'Discord Inc.',
'/a',
'/tr',
'http://timestamp.digicert.com/rfc3161',
'/as',
'/td',
'sha256',
'/fd',
'sha256',
]
elif PLATFORM == 'osx':
signable_extensions.add('.dylib')
sign_command_base = [
tool,
'--keychain',
os.path.expanduser('~/Library/Keychains/login.keychain'),
'-vvvv',
'--deep',
'--force',
'--sign',
'Developer ID Application: Hammer & Chisel Inc. (53Q6R32WPB)',
]
else:
click.secho('Not signing things on this platform yet', fg='red')
return
click.echo('--- Signing')
for path, _, filenames in os.walk(INSTALL_ROOT):
for fname in filenames:
ext = os.path.splitext(fname)[1]
if ext not in signable_extensions:
continue
fpath = os.path.join(path, fname)
click.echo('Sign ' + fpath)
sign_command = sign_command_base + [fpath]
subprocess.check_call(sign_command)
@cli.command()
@click.option('--clean', is_flag=True)
@click.option('--static', is_flag=True)
@click.option('--shared', is_flag=True)
@click.option('--skip_formatter', is_flag=True)
@click.option('--just_release', is_flag=True)
def libs(clean, static, shared, skip_formatter, just_release):
""" Do all the builds for this platform """
if clean:
shutil.rmtree('builds', ignore_errors=True)
mkdir_p('builds')
if not (static or shared):
static = True
shared = True
static_options = {}
dynamic_options = {
'BUILD_SHARED_LIBS': True,
'USE_STATIC_CRT': True,
}
if skip_formatter or IS_BUILD_MACHINE:
static_options['CLANG_FORMAT_SUFFIX'] = 'none'
dynamic_options['CLANG_FORMAT_SUFFIX'] = 'none'
if IS_BUILD_MACHINE:
just_release = True
static_options['WARNINGS_AS_ERRORS'] = True
dynamic_options['WARNINGS_AS_ERRORS'] = True
if PLATFORM == 'win':
generator32 = 'Visual Studio 14 2015'
generator64 = 'Visual Studio 14 2015 Win64'
if static:
build_lib('win32-static', generator32, static_options, just_release)
build_lib('win64-static', generator64, static_options, just_release)
if shared:
build_lib('win32-dynamic', generator32, dynamic_options, just_release)
build_lib('win64-dynamic', generator64, dynamic_options, just_release)
elif PLATFORM == 'osx':
if static:
build_lib('osx-static', None, static_options, just_release)
if shared:
build_lib('osx-dynamic', None, dynamic_options, just_release)
elif PLATFORM == 'linux':
if static:
build_lib('linux-static', None, static_options, just_release)
if shared:
build_lib('linux-dynamic', None, dynamic_options, just_release)
if __name__ == '__main__':
os.chdir(SCRIPT_PATH)
sys.exit(cli())

View File

@ -1,164 +0,0 @@
# Hard Mode: Roll Your Own Client
Discord's Rich Presence feature is designed as an obfuscated addition to our existing [RPC infrastructure](https://discordapp.com/developers/docs/topics/rpc). The standalone library and header files make it easy for any dev to drop it into their game.
Our library communicates with Discord over the local Discord RPC socket. We've already done the work in connecting properly, handling disconnects and reconnects, and other RPC intracacies, but those who have done this implementation for our private alpha Voice and Chat SDK can simply make use of the new RPC commands and events to implement Rich Presence.
## Hark! A warning!
By committing to an RPC-only integration, you decide to forego the work our library and header file have done for you in the way of error handling, state storage, disconnecting and reconnecting, and other quality of life abstractions. While simply implementing the new RPC command and events will enable Rich Presence for your game, we highly suggest that you do your best to mimic the functionality of the SDK the most that you can. It ensure not only code quality on your part, but also an excellent experience on the part of your players.
## Application Protocol Registration
One thing that cannot be explicitly done over RPC is registering an application protocol for your game. If you choose to do an RPC-only implementation, you will have to register your application protocol yourself in the format of `discord-[your_app_id]://`. You can use `Discord_Register()` as a good(?) example of how to properly register an application protocol for use with Discord. For OSX and Linux it is probably simpler to handle the protocol registration as part of your install/packaging.
## New RPC Command
The new RPC command for Rich Presence is `SET_ACTIVITY`. The fields are similar to what is outlined in the SDK; we've combined similar fields into objects for the sake of less data on the wire.
The one major difference is the `party.size` field. It is an array with a size of two. The first element is the current party size, `partySize` from the main documentation. The second element is the maximum party size, `partyMax` from the main documentation.
Below is a full example of a `SET_ACTIVITY` command. Field restrictions like size are the same as outlined in the main documentation.
```
{
"cmd": "SET_ACTIVITY",
"args": {
"pid": 9999, // Your application's process id - required field
"activity": {
"state": "In a Group",
"details": "Competitive | In a Match",
"timestamps": {
"start": time(nullptr),
"end": time(nullptr) + ((60 * 5) + 23)
},
"assets": {
"large_image": "numbani_map",
"large_text": "Numbani",
"small_image": "pharah_profile",
"small_text": "Pharah"
},
"party": {
"id": GameEngine.GetPartyId(),
"size": [3, 6]
},
"secrets": {
"join": "025ed05c71f639de8bfaa0d679d7c94b2fdce12f",
"spectate": "e7eb30d2ee025ed05c71ea495f770b76454ee4e0",
"match": "4b2fdce12f639de8bfa7e3591b71a0d679d7c93f"
},
"instance": true
}
},
"nonce": "647d814a-4cf8-4fbb-948f-898abd24f55b"
}
```
## New RPC Events
The three new RPC events for Rich Presence power the ability to join and spectate your friends' games.
First is the `ACTIVITY_JOIN` event:
```json
{
"cmd": "DISPATCH",
"data": {
"secret": "025ed05c71f639de8bfaa0d679d7c94b2fdce12f"
},
"evt": "ACTIVITY_JOIN"
}
```
Second is the `ACTIVITY_SPECTATE` event:
```json
{
"cmd": "DISPATCH",
"data": {
"secret": "e7eb30d2ee025ed05c71ea495f770b76454ee4e0"
},
"evt": "ACTIVITY_SPECTATE"
}
```
And third is the `ACTIVITY_JOIN_REQUEST` event:
```json
{
"cmd": "DISPATCH",
"data": {
"user": {
"id": "53908232506183680",
"username": "Mason",
"discriminator": "1337",
"avatar": "a_bab14f271d565501444b2ca3be944b25"
}
},
"evt": "ACTIVITY_JOIN_REQUEST"
}
```
In order to receive these events, you need to [subscribe](https://discordapp.com/developers/docs/topics/rpc#subscribe) to them like so:
```json
{
"nonce": "be9a6de3-31d0-4767-a8e9-4818c5690015",
"evt": "ACTIVITY_JOIN",
"cmd": "SUBSCRIBE"
}
```
```json
{
"nonce": "ae9qdde3-31d0-8989-a8e9-dnakwy174he",
"evt": "ACTIVITY_SPECTATE",
"cmd": "SUBSCRIBE"
}
```
```json
{
"nonce": "5dc0c062-98c6-47a0-8922-bbb52e9d6afa",
"evt": "ACTIVITY_JOIN_REQUEST",
"cmd": "SUBSCRIBE"
}
```
To unsubscribe from these events, resend with the command `UNSUBSCRIBE`
## Responding
A discord user will request access to the game. If the ACTIVITY_JOIN_REQUEST has been subscribed too, the ACTIVITY_JOIN_REQUEST event will be sent to the host's game. Accept it with following model:
```json
{
"nonce": "5dc0c062-98c6-47a0-8922-15aerg126",
"cmd": "SEND_ACTIVITY_JOIN_INVITE",
"args":
{
"user_id": "53908232506183680"
}
}
```
To reject the request, use `CLOSE_ACTIVITY_REQUEST`:
```json
{
"nonce": "5dc0c062-98c6-47a0-8922-dasg256eafg",
"cmd": "CLOSE_ACTIVITY_REQUEST",
"args":
{
"user_id": "53908232506183680"
}
}
```
## Notes
Here are just some quick notes to help with some common troubleshooting problems.
* IPC will echo back every command you send as a response. Use this as a lock-step feature to avoid flooding messages. Can be used to validate messages such as the Presence or Subscribes.
* The pipe expects for frames to be written in a single byte array. You cannot do multiple `stream.Write(opcode);` `stream.Write(length);` as it will break the pipe. Instead create a buffer, write the data to the buffer, then send the entire buffer to the stream.
* Discord can be on any pipe ranging from `discord-ipc-0` to `discord-ipc-9`. It is a good idea to try and connect to each one and keeping the first one you connect too. For multiple clients (eg Discord and Canary), you might want to add a feature to manually select the pipe so you can more easily debug the application.
* All enums are `lower_snake_case`.
* The opcode and length in the header are `Little Endian Unsigned Integers (32bits)`. In some languages, you must convert them as they can be architecture specific.
* [Discord Rich Presence How-To](https://discordapp.com/developers/docs/rich-presence/how-to) contains a lot of the information this document doesn't. For example, it will tell you about the response payload.
* In the documentation, DISCORD_REPLY_IGNORE is just implemented the same as DISCORD_REPLY_NO.
* You can test the Join / Spectate feature by enabling them in your profile and whitelisting a test account. Use Canary to run 2 accounts on the same machine.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,8 +0,0 @@
/Library/
/Temp/
/obj/
/Assets/Plugins/
/Assets/Plugins.meta
*.sln
*.csproj
*.userprefs

View File

@ -1,129 +0,0 @@
using UnityEngine;
[System.Serializable]
public class DiscordJoinEvent : UnityEngine.Events.UnityEvent<string> { }
[System.Serializable]
public class DiscordSpectateEvent : UnityEngine.Events.UnityEvent<string> { }
[System.Serializable]
public class DiscordJoinRequestEvent : UnityEngine.Events.UnityEvent<DiscordRpc.DiscordUser> { }
public class DiscordController : MonoBehaviour
{
public DiscordRpc.RichPresence presence = new DiscordRpc.RichPresence();
public string applicationId;
public string optionalSteamId;
public int callbackCalls;
public int clickCounter;
public DiscordRpc.DiscordUser joinRequest;
public UnityEngine.Events.UnityEvent onConnect;
public UnityEngine.Events.UnityEvent onDisconnect;
public UnityEngine.Events.UnityEvent hasResponded;
public DiscordJoinEvent onJoin;
public DiscordJoinEvent onSpectate;
public DiscordJoinRequestEvent onJoinRequest;
DiscordRpc.EventHandlers handlers;
public void OnClick()
{
Debug.Log("Discord: on click!");
clickCounter++;
presence.details = string.Format("Button clicked {0} times", clickCounter);
DiscordRpc.UpdatePresence(presence);
}
public void RequestRespondYes()
{
Debug.Log("Discord: responding yes to Ask to Join request");
DiscordRpc.Respond(joinRequest.userId, DiscordRpc.Reply.Yes);
hasResponded.Invoke();
}
public void RequestRespondNo()
{
Debug.Log("Discord: responding no to Ask to Join request");
DiscordRpc.Respond(joinRequest.userId, DiscordRpc.Reply.No);
hasResponded.Invoke();
}
public void ReadyCallback(ref DiscordRpc.DiscordUser connectedUser)
{
++callbackCalls;
Debug.Log(string.Format("Discord: connected to {0}#{1}: {2}", connectedUser.username, connectedUser.discriminator, connectedUser.userId));
onConnect.Invoke();
}
public void DisconnectedCallback(int errorCode, string message)
{
++callbackCalls;
Debug.Log(string.Format("Discord: disconnect {0}: {1}", errorCode, message));
onDisconnect.Invoke();
}
public void ErrorCallback(int errorCode, string message)
{
++callbackCalls;
Debug.Log(string.Format("Discord: error {0}: {1}", errorCode, message));
}
public void JoinCallback(string secret)
{
++callbackCalls;
Debug.Log(string.Format("Discord: join ({0})", secret));
onJoin.Invoke(secret);
}
public void SpectateCallback(string secret)
{
++callbackCalls;
Debug.Log(string.Format("Discord: spectate ({0})", secret));
onSpectate.Invoke(secret);
}
public void RequestCallback(ref DiscordRpc.DiscordUser request)
{
++callbackCalls;
Debug.Log(string.Format("Discord: join request {0}#{1}: {2}", request.username, request.discriminator, request.userId));
joinRequest = request;
onJoinRequest.Invoke(request);
}
void Start()
{
}
void Update()
{
DiscordRpc.RunCallbacks();
}
void OnEnable()
{
Debug.Log("Discord: init");
callbackCalls = 0;
handlers = new DiscordRpc.EventHandlers();
handlers.readyCallback = ReadyCallback;
handlers.disconnectedCallback += DisconnectedCallback;
handlers.errorCallback += ErrorCallback;
handlers.joinCallback += JoinCallback;
handlers.spectateCallback += SpectateCallback;
handlers.requestCallback += RequestCallback;
DiscordRpc.Initialize(applicationId, ref handlers, true, optionalSteamId);
}
void OnDisable()
{
Debug.Log("Discord: shutdown");
DiscordRpc.Shutdown();
}
void OnDestroy()
{
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 27f0a5f59ffffa84c86547736e2e730a
timeCreated: 1501697692
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,198 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
public class DiscordRpc
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void ReadyCallback(ref DiscordUser connectedUser);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void DisconnectedCallback(int errorCode, string message);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void ErrorCallback(int errorCode, string message);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void JoinCallback(string secret);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void SpectateCallback(string secret);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void RequestCallback(ref DiscordUser request);
public struct EventHandlers
{
public ReadyCallback readyCallback;
public DisconnectedCallback disconnectedCallback;
public ErrorCallback errorCallback;
public JoinCallback joinCallback;
public SpectateCallback spectateCallback;
public RequestCallback requestCallback;
}
[Serializable, StructLayout(LayoutKind.Sequential)]
public struct RichPresenceStruct
{
public IntPtr state; /* max 128 bytes */
public IntPtr details; /* max 128 bytes */
public long startTimestamp;
public long endTimestamp;
public IntPtr largeImageKey; /* max 32 bytes */
public IntPtr largeImageText; /* max 128 bytes */
public IntPtr smallImageKey; /* max 32 bytes */
public IntPtr smallImageText; /* max 128 bytes */
public IntPtr partyId; /* max 128 bytes */
public int partySize;
public int partyMax;
public IntPtr matchSecret; /* max 128 bytes */
public IntPtr joinSecret; /* max 128 bytes */
public IntPtr spectateSecret; /* max 128 bytes */
public bool instance;
}
[Serializable]
public struct DiscordUser
{
public string userId;
public string username;
public string discriminator;
public string avatar;
}
public enum Reply
{
No = 0,
Yes = 1,
Ignore = 2
}
[DllImport("discord-rpc", EntryPoint = "Discord_Initialize", CallingConvention = CallingConvention.Cdecl)]
public static extern void Initialize(string applicationId, ref EventHandlers handlers, bool autoRegister, string optionalSteamId);
[DllImport("discord-rpc", EntryPoint = "Discord_Shutdown", CallingConvention = CallingConvention.Cdecl)]
public static extern void Shutdown();
[DllImport("discord-rpc", EntryPoint = "Discord_RunCallbacks", CallingConvention = CallingConvention.Cdecl)]
public static extern void RunCallbacks();
[DllImport("discord-rpc", EntryPoint = "Discord_UpdatePresence", CallingConvention = CallingConvention.Cdecl)]
private static extern void UpdatePresenceNative(ref RichPresenceStruct presence);
[DllImport("discord-rpc", EntryPoint = "Discord_ClearPresence", CallingConvention = CallingConvention.Cdecl)]
public static extern void ClearPresence();
[DllImport("discord-rpc", EntryPoint = "Discord_Respond", CallingConvention = CallingConvention.Cdecl)]
public static extern void Respond(string userId, Reply reply);
[DllImport("discord-rpc", EntryPoint = "Discord_UpdateHandlers", CallingConvention = CallingConvention.Cdecl)]
public static extern void UpdateHandlers(ref EventHandlers handlers);
public static void UpdatePresence(RichPresence presence)
{
var presencestruct = presence.GetStruct();
UpdatePresenceNative(ref presencestruct);
presence.FreeMem();
}
public class RichPresence
{
private RichPresenceStruct _presence;
private readonly List<IntPtr> _buffers = new List<IntPtr>(10);
public string state; /* max 128 bytes */
public string details; /* max 128 bytes */
public long startTimestamp;
public long endTimestamp;
public string largeImageKey; /* max 32 bytes */
public string largeImageText; /* max 128 bytes */
public string smallImageKey; /* max 32 bytes */
public string smallImageText; /* max 128 bytes */
public string partyId; /* max 128 bytes */
public int partySize;
public int partyMax;
public string matchSecret; /* max 128 bytes */
public string joinSecret; /* max 128 bytes */
public string spectateSecret; /* max 128 bytes */
public bool instance;
/// <summary>
/// Get the <see cref="RichPresenceStruct"/> reprensentation of this instance
/// </summary>
/// <returns><see cref="RichPresenceStruct"/> reprensentation of this instance</returns>
internal RichPresenceStruct GetStruct()
{
if (_buffers.Count > 0)
{
FreeMem();
}
_presence.state = StrToPtr(state);
_presence.details = StrToPtr(details);
_presence.startTimestamp = startTimestamp;
_presence.endTimestamp = endTimestamp;
_presence.largeImageKey = StrToPtr(largeImageKey);
_presence.largeImageText = StrToPtr(largeImageText);
_presence.smallImageKey = StrToPtr(smallImageKey);
_presence.smallImageText = StrToPtr(smallImageText);
_presence.partyId = StrToPtr(partyId);
_presence.partySize = partySize;
_presence.partyMax = partyMax;
_presence.matchSecret = StrToPtr(matchSecret);
_presence.joinSecret = StrToPtr(joinSecret);
_presence.spectateSecret = StrToPtr(spectateSecret);
_presence.instance = instance;
return _presence;
}
/// <summary>
/// Returns a pointer to a representation of the given string with a size of maxbytes
/// </summary>
/// <param name="input">String to convert</param>
/// <returns>Pointer to the UTF-8 representation of <see cref="input"/></returns>
private IntPtr StrToPtr(string input)
{
if (string.IsNullOrEmpty(input)) return IntPtr.Zero;
var convbytecnt = Encoding.UTF8.GetByteCount(input);
var buffer = Marshal.AllocHGlobal(convbytecnt + 1);
for (int i = 0; i < convbytecnt + 1; i++)
{
Marshal.WriteByte(buffer, i , 0);
}
_buffers.Add(buffer);
Marshal.Copy(Encoding.UTF8.GetBytes(input), 0, buffer, convbytecnt);
return buffer;
}
/// <summary>
/// Convert string to UTF-8 and add null termination
/// </summary>
/// <param name="toconv">string to convert</param>
/// <returns>UTF-8 representation of <see cref="toconv"/> with added null termination</returns>
private static string StrToUtf8NullTerm(string toconv)
{
var str = toconv.Trim();
var bytes = Encoding.Default.GetBytes(str);
if (bytes.Length > 0 && bytes[bytes.Length - 1] != 0)
{
str += "\0\0";
}
return Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(str));
}
/// <summary>
/// Free the allocated memory for conversion to <see cref="RichPresenceStruct"/>
/// </summary>
internal void FreeMem()
{
for (var i = _buffers.Count - 1; i >= 0; i--)
{
Marshal.FreeHGlobal(_buffers[i]);
_buffers.RemoveAt(i);
}
}
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: b4474a677de9d80409e98c5393ec5b1e
timeCreated: 1501697692
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,101 +0,0 @@
using UnityEditor;
using System.Diagnostics;
using System.IO;
[InitializeOnLoad]
public class ScriptBatch
{
static ScriptBatch()
{
EnsureDLL();
}
public static bool FileExists(string filename)
{
return new FileInfo(filename).Exists;
}
public static bool RunRpcBuildScript()
{
UnityEngine.Debug.Log("Try to run build script");
Process proc = new Process();
#if UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX
proc.StartInfo.UseShellExecute = false;
// brew installs cmake in /usr/local/bin, which Unity seems to strip from PATH?
string newPath = proc.StartInfo.EnvironmentVariables["PATH"] + ":/usr/local/bin";
proc.StartInfo.EnvironmentVariables["PATH"] = newPath;
#endif
proc.StartInfo.FileName = "python";
proc.StartInfo.Arguments = "build.py unity";
proc.StartInfo.WorkingDirectory = "../..";
proc.Start();
proc.WaitForExit();
return proc.ExitCode == 0;
}
public static void EnsureDLL()
{
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
string[] dstDirs = { "Assets/Plugins", "Assets/Plugins/x86", "Assets/Plugins/x86_64" };
string[] dstDlls = { "Assets/Plugins/x86/discord-rpc.dll", "Assets/Plugins/x86_64/discord-rpc.dll" };
string[] srcDlls = { "../../builds/install/win64-dynamic/bin/discord-rpc.dll", "../../builds/install/win64-dynamic/bin/discord-rpc.dll" };
#elif UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX
string[] dstDirs = { "Assets/Plugins" };
string[] dstDlls = { "Assets/Plugins/discord-rpc.bundle" };
string[] srcDlls = { "../../builds/install/osx-dynamic/lib/libdiscord-rpc.dylib" };
#else
string[] dstDirs = { "Assets/Plugins", "Assets/Plugins/x86", "Assets/Plugins/x86_64" };
string[] dstDlls = { "Assets/Plugins/discord-rpc.so" };
string[] srcDlls = { "../../builds/install/linux-dynamic/lib/libdiscord-rpc.so" };
#endif
Debug.Assert(dstDlls.Length == srcDlls.Length);
bool exists = true;
foreach (string fname in dstDlls)
{
if (!FileExists(fname))
{
exists = false;
break;
}
}
if (exists)
{
return;
}
exists = true;
foreach (string fname in srcDlls)
{
if (!FileExists(fname))
{
exists = false;
break;
}
}
if (!exists)
{
if (!RunRpcBuildScript())
{
UnityEngine.Debug.LogError("Build failed");
return;
}
}
// make sure the dirs exist
foreach (string dirname in dstDirs)
{
Directory.CreateDirectory(dirname);
}
// Copy dlls
for (int i = 0; i < dstDlls.Length; ++i)
{
FileUtil.CopyFileOrDirectory(srcDlls[i], dstDlls[i]);
}
}
}

View File

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: e5aecc4633e5f594b85eaa39f49bb402
timeCreated: 1512071254
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 3b03d21bb25fa494e8694cd6e4b6d769
timeCreated: 1501696924
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,17 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!11 &1
AudioManager:
m_ObjectHideFlags: 0
m_Volume: 1
Rolloff Scale: 1
Doppler Factor: 1
Default Speaker Mode: 2
m_SampleRate: 0
m_DSPBufferSize: 0
m_VirtualVoiceCount: 512
m_RealVoiceCount: 32
m_SpatializerPlugin:
m_AmbisonicDecoderPlugin:
m_DisableAudio: 0
m_VirtualizeEffects: 1

View File

@ -1,6 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!236 &1
ClusterInputManager:
m_ObjectHideFlags: 0
m_Inputs: []

View File

@ -1,20 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!55 &1
PhysicsManager:
m_ObjectHideFlags: 0
serializedVersion: 3
m_Gravity: {x: 0, y: -9.81, z: 0}
m_DefaultMaterial: {fileID: 0}
m_BounceThreshold: 2
m_SleepThreshold: 0.005
m_DefaultContactOffset: 0.01
m_DefaultSolverIterations: 6
m_DefaultSolverVelocityIterations: 1
m_QueriesHitBackfaces: 0
m_QueriesHitTriggers: 1
m_EnableAdaptiveForce: 0
m_EnablePCM: 1
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1
m_AutoSyncTransforms: 1

View File

@ -1,10 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1045 &1
EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes:
- enabled: 1
path: Assets/main.unity
guid: 3b03d21bb25fa494e8694cd6e4b6d769

View File

@ -1,16 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!159 &1
EditorSettings:
m_ObjectHideFlags: 0
serializedVersion: 4
m_ExternalVersionControlSupport: Visible Meta Files
m_SerializationMode: 2
m_DefaultBehaviorMode: 1
m_SpritePackerMode: 4
m_SpritePackerPaddingPower: 1
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd
m_ProjectGenerationRootNamespace:
m_UserGeneratedProjectSuffix:
m_CollabEditorSettings:
inProgressEnabled: 1

View File

@ -1,61 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!30 &1
GraphicsSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_Deferred:
m_Mode: 1
m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}
m_DeferredReflections:
m_Mode: 1
m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0}
m_ScreenSpaceShadows:
m_Mode: 1
m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0}
m_LegacyDeferred:
m_Mode: 1
m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0}
m_DepthNormals:
m_Mode: 1
m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0}
m_MotionVectors:
m_Mode: 1
m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0}
m_LightHalo:
m_Mode: 1
m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0}
m_LensFlare:
m_Mode: 1
m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0}
m_AlwaysIncludedShaders:
- {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}
m_CustomRenderPipeline: {fileID: 0}
m_TransparencySortMode: 0
m_TransparencySortAxis: {x: 0, y: 0, z: 1}
m_DefaultRenderingPath: 1
m_DefaultMobileRenderingPath: 1
m_TierSettings: []
m_LightmapStripping: 0
m_FogStripping: 0
m_InstancingStripping: 0
m_LightmapKeepPlain: 1
m_LightmapKeepDirCombined: 1
m_LightmapKeepDynamicPlain: 1
m_LightmapKeepDynamicDirCombined: 1
m_LightmapKeepShadowMask: 1
m_LightmapKeepSubtractive: 1
m_FogKeepLinear: 1
m_FogKeepExp: 1
m_FogKeepExp2: 1
m_AlbedoSwatchInfos: []
m_LightsUseLinearIntensity: 0
m_LightsUseColorTemperature: 0

View File

@ -1,295 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!13 &1
InputManager:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Axes:
- serializedVersion: 3
m_Name: Horizontal
descriptiveName:
descriptiveNegativeName:
negativeButton: left
positiveButton: right
altNegativeButton: a
altPositiveButton: d
gravity: 3
dead: 0.001
sensitivity: 3
snap: 1
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Vertical
descriptiveName:
descriptiveNegativeName:
negativeButton: down
positiveButton: up
altNegativeButton: s
altPositiveButton: w
gravity: 3
dead: 0.001
sensitivity: 3
snap: 1
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire1
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: left ctrl
altNegativeButton:
altPositiveButton: mouse 0
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire2
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: left alt
altNegativeButton:
altPositiveButton: mouse 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire3
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: left shift
altNegativeButton:
altPositiveButton: mouse 2
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Jump
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: space
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Mouse X
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Mouse Y
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 1
joyNum: 0
- serializedVersion: 3
m_Name: Mouse ScrollWheel
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 2
joyNum: 0
- serializedVersion: 3
m_Name: Horizontal
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.19
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Vertical
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.19
sensitivity: 1
snap: 0
invert: 1
type: 2
axis: 1
joyNum: 0
- serializedVersion: 3
m_Name: Fire1
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 0
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire2
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 1
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire3
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 2
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Jump
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 3
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Submit
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: return
altNegativeButton:
altPositiveButton: joystick button 0
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Submit
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: enter
altNegativeButton:
altPositiveButton: space
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Cancel
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: escape
altNegativeButton:
altPositiveButton: joystick button 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0

View File

@ -1,89 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!126 &1
NavMeshProjectSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
areas:
- name: Walkable
cost: 1
- name: Not Walkable
cost: 1
- name: Jump
cost: 2
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
m_LastAgentTypeID: -887442657
m_Settings:
- serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.75
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
m_SettingNames:
- Humanoid

View File

@ -1,8 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!149 &1
NetworkManager:
m_ObjectHideFlags: 0
m_DebugLevel: 0
m_Sendrate: 15
m_AssetToPrefab: {}

View File

@ -1,37 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!19 &1
Physics2DSettings:
m_ObjectHideFlags: 0
serializedVersion: 3
m_Gravity: {x: 0, y: -9.81}
m_DefaultMaterial: {fileID: 0}
m_VelocityIterations: 8
m_PositionIterations: 3
m_VelocityThreshold: 1
m_MaxLinearCorrection: 0.2
m_MaxAngularCorrection: 8
m_MaxTranslationSpeed: 100
m_MaxRotationSpeed: 360
m_BaumgarteScale: 0.2
m_BaumgarteTimeOfImpactScale: 0.75
m_TimeToSleep: 0.5
m_LinearSleepTolerance: 0.01
m_AngularSleepTolerance: 2
m_DefaultContactOffset: 0.01
m_AutoSimulation: 1
m_QueriesHitTriggers: 1
m_QueriesStartInColliders: 1
m_ChangeStopsCallbacks: 0
m_CallbacksOnDisable: 1
m_AutoSyncTransforms: 1
m_AlwaysShowColliders: 0
m_ShowColliderSleep: 1
m_ShowColliderContacts: 0
m_ShowColliderAABB: 0
m_ContactArrowScale: 0.2
m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412}
m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432}
m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745}
m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804}
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

View File

@ -1,610 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!129 &1
PlayerSettings:
m_ObjectHideFlags: 0
serializedVersion: 13
productGUID: 5eccc60d3e382a346a65f512d6b81b84
AndroidProfiler: 0
AndroidFilterTouchesWhenObscured: 0
defaultScreenOrientation: 4
targetDevice: 2
useOnDemandResources: 0
accelerometerFrequency: 60
companyName: Discord Inc.
productName: button-clicker
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
m_ShowUnitySplashScreen: 1
m_ShowUnitySplashLogo: 1
m_SplashScreenOverlayOpacity: 1
m_SplashScreenAnimation: 1
m_SplashScreenLogoStyle: 1
m_SplashScreenDrawMode: 0
m_SplashScreenBackgroundAnimationZoom: 1
m_SplashScreenLogoAnimationZoom: 1
m_SplashScreenBackgroundLandscapeAspect: 1
m_SplashScreenBackgroundPortraitAspect: 1
m_SplashScreenBackgroundLandscapeUvs:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
m_SplashScreenBackgroundPortraitUvs:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
m_SplashScreenLogos: []
m_VirtualRealitySplashScreen: {fileID: 0}
m_HolographicTrackingLossScreen: {fileID: 0}
defaultScreenWidth: 1024
defaultScreenHeight: 768
defaultScreenWidthWeb: 960
defaultScreenHeightWeb: 600
m_StereoRenderingPath: 0
m_ActiveColorSpace: 0
m_MTRendering: 1
m_StackTraceTypes: 010000000100000001000000010000000100000001000000
iosShowActivityIndicatorOnLoading: -1
androidShowActivityIndicatorOnLoading: -1
tizenShowActivityIndicatorOnLoading: -1
iosAppInBackgroundBehavior: 0
displayResolutionDialog: 1
iosAllowHTTPDownload: 1
allowedAutorotateToPortrait: 1
allowedAutorotateToPortraitUpsideDown: 1
allowedAutorotateToLandscapeRight: 1
allowedAutorotateToLandscapeLeft: 1
useOSAutorotation: 1
use32BitDisplayBuffer: 1
disableDepthAndStencilBuffers: 0
androidBlitType: 0
defaultIsFullScreen: 1
defaultIsNativeResolution: 1
macRetinaSupport: 1
runInBackground: 0
captureSingleScreen: 0
muteOtherAudioSources: 0
Prepare IOS For Recording: 0
Force IOS Speakers When Recording: 0
submitAnalytics: 1
usePlayerLog: 1
bakeCollisionMeshes: 0
forceSingleInstance: 0
resizableWindow: 0
useMacAppStoreValidation: 0
macAppStoreCategory: public.app-category.games
gpuSkinning: 0
graphicsJobs: 0
xboxPIXTextureCapture: 0
xboxEnableAvatar: 0
xboxEnableKinect: 0
xboxEnableKinectAutoTracking: 0
xboxEnableFitness: 0
visibleInBackground: 1
allowFullscreenSwitch: 1
graphicsJobMode: 0
macFullscreenMode: 2
d3d9FullscreenMode: 1
d3d11FullscreenMode: 1
xboxSpeechDB: 0
xboxEnableHeadOrientation: 0
xboxEnableGuest: 0
xboxEnablePIXSampling: 0
metalFramebufferOnly: 0
n3dsDisableStereoscopicView: 0
n3dsEnableSharedListOpt: 1
n3dsEnableVSync: 0
ignoreAlphaClear: 0
xboxOneResolution: 0
xboxOneMonoLoggingLevel: 0
xboxOneLoggingLevel: 1
xboxOneDisableEsram: 0
xboxOnePresentImmediateThreshold: 0
videoMemoryForVertexBuffers: 0
psp2PowerMode: 0
psp2AcquireBGM: 1
wiiUTVResolution: 0
wiiUGamePadMSAA: 1
wiiUSupportsNunchuk: 0
wiiUSupportsClassicController: 0
wiiUSupportsBalanceBoard: 0
wiiUSupportsMotionPlus: 0
wiiUSupportsProController: 0
wiiUAllowScreenCapture: 1
wiiUControllerCount: 0
m_SupportedAspectRatios:
4:3: 1
5:4: 1
16:10: 1
16:9: 1
Others: 1
bundleVersion: 1.0
preloadedAssets: []
metroInputSource: 0
m_HolographicPauseOnTrackingLoss: 1
xboxOneDisableKinectGpuReservation: 0
xboxOneEnable7thCore: 0
vrSettings:
cardboard:
depthFormat: 0
enableTransitionView: 0
daydream:
depthFormat: 0
useSustainedPerformanceMode: 0
enableVideoLayer: 0
useProtectedVideoMemory: 0
hololens:
depthFormat: 1
protectGraphicsMemory: 0
useHDRDisplay: 0
m_ColorGamuts: 00000000
targetPixelDensity: 0
resolutionScalingMode: 0
androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1
applicationIdentifier: {}
buildNumber: {}
AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 16
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1
aotOptions:
stripEngineCode: 1
iPhoneStrippingLevel: 0
iPhoneScriptCallOptimization: 0
ForceInternetPermission: 0
ForceSDCardPermission: 0
CreateWallpaper: 0
APKExpansionFiles: 0
keepLoadedShadersAlive: 0
StripUnusedMeshComponents: 0
VertexChannelCompressionMask:
serializedVersion: 2
m_Bits: 238
iPhoneSdkVersion: 988
iOSTargetOSVersionString: 7.0
tvOSSdkVersion: 0
tvOSRequireExtendedGameController: 0
tvOSTargetOSVersionString: 9.0
uIPrerenderedIcon: 0
uIRequiresPersistentWiFi: 0
uIRequiresFullScreen: 1
uIStatusBarHidden: 1
uIExitOnSuspend: 0
uIStatusBarStyle: 0
iPhoneSplashScreen: {fileID: 0}
iPhoneHighResSplashScreen: {fileID: 0}
iPhoneTallHighResSplashScreen: {fileID: 0}
iPhone47inSplashScreen: {fileID: 0}
iPhone55inPortraitSplashScreen: {fileID: 0}
iPhone55inLandscapeSplashScreen: {fileID: 0}
iPadPortraitSplashScreen: {fileID: 0}
iPadHighResPortraitSplashScreen: {fileID: 0}
iPadLandscapeSplashScreen: {fileID: 0}
iPadHighResLandscapeSplashScreen: {fileID: 0}
appleTVSplashScreen: {fileID: 0}
tvOSSmallIconLayers: []
tvOSLargeIconLayers: []
tvOSTopShelfImageLayers: []
tvOSTopShelfImageWideLayers: []
iOSLaunchScreenType: 0
iOSLaunchScreenPortrait: {fileID: 0}
iOSLaunchScreenLandscape: {fileID: 0}
iOSLaunchScreenBackgroundColor:
serializedVersion: 2
rgba: 0
iOSLaunchScreenFillPct: 100
iOSLaunchScreenSize: 100
iOSLaunchScreenCustomXibPath:
iOSLaunchScreeniPadType: 0
iOSLaunchScreeniPadImage: {fileID: 0}
iOSLaunchScreeniPadBackgroundColor:
serializedVersion: 2
rgba: 0
iOSLaunchScreeniPadFillPct: 100
iOSLaunchScreeniPadSize: 100
iOSLaunchScreeniPadCustomXibPath:
iOSDeviceRequirements: []
iOSURLSchemes: []
iOSBackgroundModes: 0
iOSMetalForceHardShadows: 0
metalEditorSupport: 1
metalAPIValidation: 1
iOSRenderExtraFrameOnPause: 0
appleDeveloperTeamID:
iOSManualSigningProvisioningProfileID:
tvOSManualSigningProvisioningProfileID:
appleEnableAutomaticSigning: 0
AndroidTargetDevice: 0
AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0}
AndroidKeystoreName:
AndroidKeyaliasName:
AndroidTVCompatibility: 1
AndroidIsGame: 1
AndroidEnableTango: 0
androidEnableBanner: 1
androidUseLowAccuracyLocation: 0
m_AndroidBanners:
- width: 320
height: 180
banner: {fileID: 0}
androidGamepadSupportLevel: 0
resolutionDialogBanner: {fileID: 0}
m_BuildTargetIcons: []
m_BuildTargetBatching: []
m_BuildTargetGraphicsAPIs: []
m_BuildTargetVRSettings: []
m_BuildTargetEnableVuforiaSettings: []
openGLRequireES31: 0
openGLRequireES31AEP: 0
m_TemplateCustomTags: {}
mobileMTRendering:
Android: 1
iPhone: 1
tvOS: 1
wiiUTitleID: 0005000011000000
wiiUGroupID: 00010000
wiiUCommonSaveSize: 4096
wiiUAccountSaveSize: 2048
wiiUOlvAccessKey: 0
wiiUTinCode: 0
wiiUJoinGameId: 0
wiiUJoinGameModeMask: 0000000000000000
wiiUCommonBossSize: 0
wiiUAccountBossSize: 0
wiiUAddOnUniqueIDs: []
wiiUMainThreadStackSize: 3072
wiiULoaderThreadStackSize: 1024
wiiUSystemHeapSize: 128
wiiUTVStartupScreen: {fileID: 0}
wiiUGamePadStartupScreen: {fileID: 0}
wiiUDrcBufferDisabled: 0
wiiUProfilerLibPath:
playModeTestRunnerEnabled: 0
actionOnDotNetUnhandledException: 1
enableInternalProfiler: 0
logObjCUncaughtExceptions: 1
enableCrashReportAPI: 0
cameraUsageDescription:
locationUsageDescription:
microphoneUsageDescription:
switchNetLibKey:
switchSocketMemoryPoolSize: 6144
switchSocketAllocatorPoolSize: 128
switchSocketConcurrencyLimit: 14
switchScreenResolutionBehavior: 2
switchUseCPUProfiler: 0
switchApplicationID: 0x01004b9000490000
switchNSODependencies:
switchTitleNames_0:
switchTitleNames_1:
switchTitleNames_2:
switchTitleNames_3:
switchTitleNames_4:
switchTitleNames_5:
switchTitleNames_6:
switchTitleNames_7:
switchTitleNames_8:
switchTitleNames_9:
switchTitleNames_10:
switchTitleNames_11:
switchPublisherNames_0:
switchPublisherNames_1:
switchPublisherNames_2:
switchPublisherNames_3:
switchPublisherNames_4:
switchPublisherNames_5:
switchPublisherNames_6:
switchPublisherNames_7:
switchPublisherNames_8:
switchPublisherNames_9:
switchPublisherNames_10:
switchPublisherNames_11:
switchIcons_0: {fileID: 0}
switchIcons_1: {fileID: 0}
switchIcons_2: {fileID: 0}
switchIcons_3: {fileID: 0}
switchIcons_4: {fileID: 0}
switchIcons_5: {fileID: 0}
switchIcons_6: {fileID: 0}
switchIcons_7: {fileID: 0}
switchIcons_8: {fileID: 0}
switchIcons_9: {fileID: 0}
switchIcons_10: {fileID: 0}
switchIcons_11: {fileID: 0}
switchSmallIcons_0: {fileID: 0}
switchSmallIcons_1: {fileID: 0}
switchSmallIcons_2: {fileID: 0}
switchSmallIcons_3: {fileID: 0}
switchSmallIcons_4: {fileID: 0}
switchSmallIcons_5: {fileID: 0}
switchSmallIcons_6: {fileID: 0}
switchSmallIcons_7: {fileID: 0}
switchSmallIcons_8: {fileID: 0}
switchSmallIcons_9: {fileID: 0}
switchSmallIcons_10: {fileID: 0}
switchSmallIcons_11: {fileID: 0}
switchManualHTML:
switchAccessibleURLs:
switchLegalInformation:
switchMainThreadStackSize: 1048576
switchPresenceGroupId: 0x01004b9000490000
switchLogoHandling: 0
switchReleaseVersion: 0
switchDisplayVersion: 1.0.0
switchStartupUserAccount: 0
switchTouchScreenUsage: 0
switchSupportedLanguagesMask: 0
switchLogoType: 0
switchApplicationErrorCodeCategory:
switchUserAccountSaveDataSize: 0
switchUserAccountSaveDataJournalSize: 0
switchApplicationAttribute: 0
switchCardSpecSize: 4
switchCardSpecClock: 25
switchRatingsMask: 0
switchRatingsInt_0: 0
switchRatingsInt_1: 0
switchRatingsInt_2: 0
switchRatingsInt_3: 0
switchRatingsInt_4: 0
switchRatingsInt_5: 0
switchRatingsInt_6: 0
switchRatingsInt_7: 0
switchRatingsInt_8: 0
switchRatingsInt_9: 0
switchRatingsInt_10: 0
switchRatingsInt_11: 0
switchLocalCommunicationIds_0: 0x01004b9000490000
switchLocalCommunicationIds_1:
switchLocalCommunicationIds_2:
switchLocalCommunicationIds_3:
switchLocalCommunicationIds_4:
switchLocalCommunicationIds_5:
switchLocalCommunicationIds_6:
switchLocalCommunicationIds_7:
switchParentalControl: 0
switchAllowsScreenshot: 1
switchDataLossConfirmation: 0
switchSupportedNpadStyles: 3
switchSocketConfigEnabled: 0
switchTcpInitialSendBufferSize: 32
switchTcpInitialReceiveBufferSize: 64
switchTcpAutoSendBufferSizeMax: 256
switchTcpAutoReceiveBufferSizeMax: 256
switchUdpSendBufferSize: 9
switchUdpReceiveBufferSize: 42
switchSocketBufferEfficiency: 4
switchSocketInitializeEnabled: 1
switchNetworkInterfaceManagerInitializeEnabled: 1
switchPlayerConnectionEnabled: 1
ps4NPAgeRating: 12
ps4NPTitleSecret:
ps4NPTrophyPackPath:
ps4ParentalLevel: 11
ps4ContentID: ED1633-NPXX51362_00-0000000000000000
ps4Category: 0
ps4MasterVersion: 01.00
ps4AppVersion: 01.00
ps4AppType: 0
ps4ParamSfxPath:
ps4VideoOutPixelFormat: 0
ps4VideoOutInitialWidth: 1920
ps4VideoOutBaseModeInitialWidth: 1920
ps4VideoOutReprojectionRate: 120
ps4PronunciationXMLPath:
ps4PronunciationSIGPath:
ps4BackgroundImagePath:
ps4StartupImagePath:
ps4SaveDataImagePath:
ps4SdkOverride:
ps4BGMPath:
ps4ShareFilePath:
ps4ShareOverlayImagePath:
ps4PrivacyGuardImagePath:
ps4NPtitleDatPath:
ps4RemotePlayKeyAssignment: -1
ps4RemotePlayKeyMappingDir:
ps4PlayTogetherPlayerCount: 0
ps4EnterButtonAssignment: 1
ps4ApplicationParam1: 0
ps4ApplicationParam2: 0
ps4ApplicationParam3: 0
ps4ApplicationParam4: 0
ps4DownloadDataSize: 0
ps4GarlicHeapSize: 2048
ps4ProGarlicHeapSize: 2560
ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ
ps4pnSessions: 1
ps4pnPresence: 1
ps4pnFriends: 1
ps4pnGameCustomData: 1
playerPrefsSupport: 0
restrictedAudioUsageRights: 0
ps4UseResolutionFallback: 0
ps4ReprojectionSupport: 0
ps4UseAudio3dBackend: 0
ps4SocialScreenEnabled: 0
ps4ScriptOptimizationLevel: 0
ps4Audio3dVirtualSpeakerCount: 14
ps4attribCpuUsage: 0
ps4PatchPkgPath:
ps4PatchLatestPkgPath:
ps4PatchChangeinfoPath:
ps4PatchDayOne: 0
ps4attribUserManagement: 0
ps4attribMoveSupport: 0
ps4attrib3DSupport: 0
ps4attribShareSupport: 0
ps4attribExclusiveVR: 0
ps4disableAutoHideSplash: 0
ps4videoRecordingFeaturesUsed: 0
ps4contentSearchFeaturesUsed: 0
ps4attribEyeToEyeDistanceSettingVR: 0
ps4IncludedModules: []
monoEnv:
psp2Splashimage: {fileID: 0}
psp2NPTrophyPackPath:
psp2NPSupportGBMorGJP: 0
psp2NPAgeRating: 12
psp2NPTitleDatPath:
psp2NPCommsID:
psp2NPCommunicationsID:
psp2NPCommsPassphrase:
psp2NPCommsSig:
psp2ParamSfxPath:
psp2ManualPath:
psp2LiveAreaGatePath:
psp2LiveAreaBackroundPath:
psp2LiveAreaPath:
psp2LiveAreaTrialPath:
psp2PatchChangeInfoPath:
psp2PatchOriginalPackage:
psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui
psp2KeystoneFile:
psp2MemoryExpansionMode: 0
psp2DRMType: 0
psp2StorageType: 0
psp2MediaCapacity: 0
psp2DLCConfigPath:
psp2ThumbnailPath:
psp2BackgroundPath:
psp2SoundPath:
psp2TrophyCommId:
psp2TrophyPackagePath:
psp2PackagedResourcesPath:
psp2SaveDataQuota: 10240
psp2ParentalLevel: 1
psp2ShortTitle: Not Set
psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF
psp2Category: 0
psp2MasterVersion: 01.00
psp2AppVersion: 01.00
psp2TVBootMode: 0
psp2EnterButtonAssignment: 2
psp2TVDisableEmu: 0
psp2AllowTwitterDialog: 1
psp2Upgradable: 0
psp2HealthWarning: 0
psp2UseLibLocation: 0
psp2InfoBarOnStartup: 0
psp2InfoBarColor: 0
psp2ScriptOptimizationLevel: 0
psmSplashimage: {fileID: 0}
splashScreenBackgroundSourceLandscape: {fileID: 0}
splashScreenBackgroundSourcePortrait: {fileID: 0}
spritePackerPolicy:
webGLMemorySize: 256
webGLExceptionSupport: 1
webGLNameFilesAsHashes: 0
webGLDataCaching: 0
webGLDebugSymbols: 0
webGLEmscriptenArgs:
webGLModulesDirectory:
webGLTemplate: APPLICATION:Default
webGLAnalyzeBuildSize: 0
webGLUseEmbeddedResources: 0
webGLUseWasm: 0
webGLCompressionFormat: 1
scriptingDefineSymbols: {}
platformArchitecture: {}
scriptingBackend: {}
incrementalIl2cppBuild: {}
additionalIl2CppArgs:
scriptingRuntimeVersion: 0
apiCompatibilityLevelPerPlatform: {}
m_RenderingPath: 1
m_MobileRenderingPath: 1
metroPackageName: button-clicker
metroPackageVersion:
metroCertificatePath:
metroCertificatePassword:
metroCertificateSubject:
metroCertificateIssuer:
metroCertificateNotAfter: 0000000000000000
metroApplicationDescription: button-clicker
wsaImages: {}
metroTileShortName:
metroCommandLineArgsFile:
metroTileShowName: 0
metroMediumTileShowName: 0
metroLargeTileShowName: 0
metroWideTileShowName: 0
metroDefaultTileSize: 1
metroTileForegroundText: 2
metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0}
metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628,
a: 1}
metroSplashScreenUseBackgroundColor: 0
platformCapabilities: {}
metroFTAName:
metroFTAFileTypes: []
metroProtocolName:
metroCompilationOverrides: 1
tizenProductDescription:
tizenProductURL:
tizenSigningProfileName:
tizenGPSPermissions: 0
tizenMicrophonePermissions: 0
tizenDeploymentTarget:
tizenDeploymentTargetType: -1
tizenMinOSVersion: 1
n3dsUseExtSaveData: 0
n3dsCompressStaticMem: 1
n3dsExtSaveDataNumber: 0x12345
n3dsStackSize: 131072
n3dsTargetPlatform: 2
n3dsRegion: 7
n3dsMediaSize: 0
n3dsLogoStyle: 3
n3dsTitle: GameName
n3dsProductCode:
n3dsApplicationId: 0xFF3FF
stvDeviceAddress:
stvProductDescription:
stvProductAuthor:
stvProductAuthorEmail:
stvProductLink:
stvProductCategory: 0
XboxOneProductId:
XboxOneUpdateKey:
XboxOneSandboxId:
XboxOneContentId:
XboxOneTitleId:
XboxOneSCId:
XboxOneGameOsOverridePath:
XboxOnePackagingOverridePath:
XboxOneAppManifestOverridePath:
XboxOnePackageEncryption: 0
XboxOnePackageUpdateGranularity: 2
XboxOneDescription:
XboxOneLanguage:
- enus
XboxOneCapability: []
XboxOneGameRating: {}
XboxOneIsContentPackage: 0
XboxOneEnableGPUVariability: 0
XboxOneSockets: {}
XboxOneSplashScreen: {fileID: 0}
XboxOneAllowedProductIds: []
XboxOnePersistentLocalStorageSize: 0
xboxOneScriptCompiler: 0
vrEditorSettings:
daydream:
daydreamIconForeground: {fileID: 0}
daydreamIconBackground: {fileID: 0}
cloudServicesEnabled: {}
facebookSdkVersion: 7.9.4
apiCompatibilityLevel: 2
cloudProjectId:
projectName:
organizationId:
cloudEnabled: 0
enableNativePlatformBackendsForNewInputSystem: 0
disableOldInputManagerSupport: 0

View File

@ -1 +0,0 @@
m_EditorVersion: 2017.2.0f3

View File

@ -1,193 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!47 &1
QualitySettings:
m_ObjectHideFlags: 0
serializedVersion: 5
m_CurrentQuality: 5
m_QualitySettings:
- serializedVersion: 2
name: Very Low
pixelLightCount: 0
shadows: 0
shadowResolution: 0
shadowProjection: 1
shadowCascades: 1
shadowDistance: 15
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0
blendWeights: 1
textureQuality: 1
anisotropicTextures: 0
antiAliasing: 0
softParticles: 0
softVegetation: 0
realtimeReflectionProbes: 0
billboardsFaceCameraPosition: 0
vSyncCount: 0
lodBias: 0.3
maximumLODLevel: 0
particleRaycastBudget: 4
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 4
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
- serializedVersion: 2
name: Low
pixelLightCount: 0
shadows: 0
shadowResolution: 0
shadowProjection: 1
shadowCascades: 1
shadowDistance: 20
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0
blendWeights: 2
textureQuality: 0
anisotropicTextures: 0
antiAliasing: 0
softParticles: 0
softVegetation: 0
realtimeReflectionProbes: 0
billboardsFaceCameraPosition: 0
vSyncCount: 0
lodBias: 0.4
maximumLODLevel: 0
particleRaycastBudget: 16
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 4
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
- serializedVersion: 2
name: Medium
pixelLightCount: 1
shadows: 1
shadowResolution: 0
shadowProjection: 1
shadowCascades: 1
shadowDistance: 20
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0
blendWeights: 2
textureQuality: 0
anisotropicTextures: 1
antiAliasing: 0
softParticles: 0
softVegetation: 0
realtimeReflectionProbes: 0
billboardsFaceCameraPosition: 0
vSyncCount: 1
lodBias: 0.7
maximumLODLevel: 0
particleRaycastBudget: 64
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 4
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
- serializedVersion: 2
name: High
pixelLightCount: 2
shadows: 2
shadowResolution: 1
shadowProjection: 1
shadowCascades: 2
shadowDistance: 40
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1
blendWeights: 2
textureQuality: 0
anisotropicTextures: 1
antiAliasing: 0
softParticles: 0
softVegetation: 1
realtimeReflectionProbes: 1
billboardsFaceCameraPosition: 1
vSyncCount: 1
lodBias: 1
maximumLODLevel: 0
particleRaycastBudget: 256
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 4
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
- serializedVersion: 2
name: Very High
pixelLightCount: 3
shadows: 2
shadowResolution: 2
shadowProjection: 1
shadowCascades: 2
shadowDistance: 70
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1
blendWeights: 4
textureQuality: 0
anisotropicTextures: 2
antiAliasing: 2
softParticles: 1
softVegetation: 1
realtimeReflectionProbes: 1
billboardsFaceCameraPosition: 1
vSyncCount: 1
lodBias: 1.5
maximumLODLevel: 0
particleRaycastBudget: 1024
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 4
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
- serializedVersion: 2
name: Ultra
pixelLightCount: 4
shadows: 2
shadowResolution: 2
shadowProjection: 1
shadowCascades: 4
shadowDistance: 150
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1
blendWeights: 4
textureQuality: 0
anisotropicTextures: 2
antiAliasing: 2
softParticles: 1
softVegetation: 1
realtimeReflectionProbes: 1
billboardsFaceCameraPosition: 1
vSyncCount: 1
lodBias: 2
maximumLODLevel: 0
particleRaycastBudget: 4096
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 4
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
m_PerPlatformDefaultQuality:
Android: 2
Nintendo 3DS: 5
Nintendo Switch: 5
PS4: 5
PSM: 5
PSP2: 2
Samsung TV: 2
Standalone: 5
Tizen: 2
Web: 5
WebGL: 3
WiiU: 5
Windows Store Apps: 5
XboxOne: 5
iPhone: 2
tvOS: 2

View File

@ -1,43 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!78 &1
TagManager:
serializedVersion: 2
tags: []
layers:
- Default
- TransparentFX
- Ignore Raycast
-
- Water
- UI
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
m_SortingLayers:
- name: Default
uniqueID: 0
locked: 0

View File

@ -1,9 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!5 &1
TimeManager:
m_ObjectHideFlags: 0
Fixed Timestep: 0.02
Maximum Allowed Timestep: 0.33333334
m_TimeScale: 1
Maximum Particle Timestep: 0.03

View File

@ -1,34 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!310 &1
UnityConnectSettings:
m_ObjectHideFlags: 0
m_Enabled: 0
m_TestMode: 0
m_TestEventUrl:
m_TestConfigUrl:
m_TestInitMode: 0
CrashReportingSettings:
m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes
m_Enabled: 0
m_CaptureEditorExceptions: 1
UnityPurchasingSettings:
m_Enabled: 0
m_TestMode: 0
UnityAnalyticsSettings:
m_Enabled: 0
m_InitializeOnStartup: 1
m_TestMode: 0
m_TestEventUrl:
m_TestConfigUrl:
UnityAdsSettings:
m_Enabled: 0
m_InitializeOnStartup: 1
m_TestMode: 0
m_EnabledPlatforms: 4294967295
m_IosGameId:
m_AndroidGameId:
m_GameIds: {}
m_GameId:
PerformanceReportingSettings:
m_Enabled: 0

View File

@ -1,4 +0,0 @@
{
"dependencies": {
}
}

View File

@ -1,21 +0,0 @@
include_directories(${PROJECT_SOURCE_DIR}/include)
add_executable(
send-presence
MACOSX_BUNDLE
send-presence.c
)
set_target_properties(send-presence PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "Send Presence"
MACOSX_BUNDLE_GUI_IDENTIFIER "com.discordapp.examples.send-presence"
)
target_link_libraries(send-presence discord-rpc)
install(
TARGETS send-presence
RUNTIME
DESTINATION "bin"
CONFIGURATIONS Release
BUNDLE
DESTINATION "bin"
CONFIGURATIONS Release
)

View File

@ -1,205 +0,0 @@
/*
This is a simple example in C of using the rich presence API asynchronously.
*/
#define _CRT_SECURE_NO_WARNINGS /* thanks Microsoft */
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "discord_rpc.h"
static const char* APPLICATION_ID = "345229890980937739";
static int FrustrationLevel = 0;
static int64_t StartTime;
static int SendPresence = 1;
static int prompt(char* line, size_t size)
{
int res;
char* nl;
printf("\n> ");
fflush(stdout);
res = fgets(line, (int)size, stdin) ? 1 : 0;
line[size - 1] = 0;
nl = strchr(line, '\n');
if (nl) {
*nl = 0;
}
return res;
}
static void updateDiscordPresence()
{
if (SendPresence) {
char buffer[256];
DiscordRichPresence discordPresence;
memset(&discordPresence, 0, sizeof(discordPresence));
discordPresence.state = "West of House";
sprintf(buffer, "Frustration level: %d", FrustrationLevel);
discordPresence.details = buffer;
discordPresence.startTimestamp = StartTime;
discordPresence.endTimestamp = time(0) + 5 * 60;
discordPresence.largeImageKey = "canary-large";
discordPresence.smallImageKey = "ptb-small";
discordPresence.partyId = "party1234";
discordPresence.partySize = 1;
discordPresence.partyMax = 6;
discordPresence.matchSecret = "xyzzy";
discordPresence.joinSecret = "join";
discordPresence.spectateSecret = "look";
discordPresence.instance = 0;
Discord_UpdatePresence(&discordPresence);
}
else {
Discord_ClearPresence();
}
}
static void handleDiscordReady(const DiscordUser* connectedUser)
{
printf("\nDiscord: connected to user %s#%s - %s\n",
connectedUser->username,
connectedUser->discriminator,
connectedUser->userId);
}
static void handleDiscordDisconnected(int errcode, const char* message)
{
printf("\nDiscord: disconnected (%d: %s)\n", errcode, message);
}
static void handleDiscordError(int errcode, const char* message)
{
printf("\nDiscord: error (%d: %s)\n", errcode, message);
}
static void handleDiscordJoin(const char* secret)
{
printf("\nDiscord: join (%s)\n", secret);
}
static void handleDiscordSpectate(const char* secret)
{
printf("\nDiscord: spectate (%s)\n", secret);
}
static void handleDiscordJoinRequest(const DiscordUser* request)
{
int response = -1;
char yn[4];
printf("\nDiscord: join request from %s#%s - %s\n",
request->username,
request->discriminator,
request->userId);
do {
printf("Accept? (y/n)");
if (!prompt(yn, sizeof(yn))) {
break;
}
if (!yn[0]) {
continue;
}
if (yn[0] == 'y') {
response = DISCORD_REPLY_YES;
break;
}
if (yn[0] == 'n') {
response = DISCORD_REPLY_NO;
break;
}
} while (1);
if (response != -1) {
Discord_Respond(request->userId, response);
}
}
static void discordInit()
{
DiscordEventHandlers handlers;
memset(&handlers, 0, sizeof(handlers));
handlers.ready = handleDiscordReady;
handlers.disconnected = handleDiscordDisconnected;
handlers.errored = handleDiscordError;
handlers.joinGame = handleDiscordJoin;
handlers.spectateGame = handleDiscordSpectate;
handlers.joinRequest = handleDiscordJoinRequest;
Discord_Initialize(APPLICATION_ID, &handlers, 1, NULL);
}
static void gameLoop()
{
char line[512];
char* space;
StartTime = time(0);
printf("You are standing in an open field west of a white house.\n");
while (prompt(line, sizeof(line))) {
if (line[0]) {
if (line[0] == 'q') {
break;
}
if (line[0] == 't') {
printf("Shutting off Discord.\n");
Discord_Shutdown();
continue;
}
if (line[0] == 'c') {
if (SendPresence) {
printf("Clearing presence information.\n");
SendPresence = 0;
}
else {
printf("Restoring presence information.\n");
SendPresence = 1;
}
updateDiscordPresence();
continue;
}
if (line[0] == 'y') {
printf("Reinit Discord.\n");
discordInit();
continue;
}
if (time(NULL) & 1) {
printf("I don't understand that.\n");
}
else {
space = strchr(line, ' ');
if (space) {
*space = 0;
}
printf("I don't know the word \"%s\".\n", line);
}
++FrustrationLevel;
updateDiscordPresence();
}
#ifdef DISCORD_DISABLE_IO_THREAD
Discord_UpdateConnection();
#endif
Discord_RunCallbacks();
}
}
int main(int argc, char* argv[])
{
discordInit();
gameLoop();
Discord_Shutdown();
return 0;
}

View File

@ -1,78 +0,0 @@
# Visual Studio 2015 user specific files
.vs/
# Visual Studio 2015 database file
*.VC.db
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
*.ipa
# These project files can be generated by the engine
*.xcodeproj
*.xcworkspace
*.sln
*.suo
*.opensdf
*.sdf
*.VC.db
*.VC.opendb
# Precompiled Assets
SourceArt/**/*.png
SourceArt/**/*.tga
# Binary Files
Binaries/
# Builds
Build/*
# Whitelist PakBlacklist-<BuildConfiguration>.txt files
!Build/*/
Build/*/**
!Build/*/PakBlacklist*.txt
# Don't ignore icon files in Build
!Build/**/*.ico
# Built data for maps
*_BuiltData.uasset
# Configuration files generated by the Editor
Saved/*
# Compiled source files for the engine to use
Intermediate/
# Cache files for the editor to use
DerivedDataCache/
# Library headers must be copied automatically by the build script (build.py unreal)
Plugins/DiscordRpc/Source/ThirdParty/DiscordRpcLibrary/Include

View File

@ -1,54 +0,0 @@
[URL]
[/Script/HardwareTargeting.HardwareTargetingSettings]
TargetedHardwareClass=Desktop
AppliedTargetedHardwareClass=Desktop
DefaultGraphicsPerformance=Maximum
AppliedDefaultGraphicsPerformance=Maximum
[/Script/Engine.EndUserSettings]
bSendAnonymousUsageDataToEpic=False
[/Script/Engine.PhysicsSettings]
DefaultGravityZ=-980.000000
DefaultTerminalVelocity=4000.000000
DefaultFluidFriction=0.300000
SimulateScratchMemorySize=262144
RagdollAggregateThreshold=4
TriangleMeshTriangleMinAreaThreshold=5.000000
bEnableAsyncScene=False
bEnableShapeSharing=False
bEnablePCM=False
bEnableStabilization=False
bWarnMissingLocks=True
bEnable2DPhysics=False
LockedAxis=Invalid
DefaultDegreesOfFreedom=Full3D
BounceThresholdVelocity=200.000000
FrictionCombineMode=Average
RestitutionCombineMode=Average
MaxAngularVelocity=3600.000000
MaxDepenetrationVelocity=0.000000
ContactOffsetMultiplier=0.010000
MinContactOffset=0.000100
MaxContactOffset=1.000000
bSimulateSkeletalMeshOnDedicatedServer=True
DefaultShapeComplexity=CTF_UseSimpleAndComplex
bDefaultHasComplexCollision=True
bSuppressFaceRemapTable=False
bSupportUVFromHitResults=False
bDisableActiveActors=False
bDisableCCD=False
MaxPhysicsDeltaTime=0.033333
bSubstepping=False
bSubsteppingAsync=False
MaxSubstepDeltaTime=0.016667
MaxSubsteps=6
SyncSceneSmoothingFactor=0.000000
AsyncSceneSmoothingFactor=0.990000
InitialAverageFrameRate=0.016667
[/Script/EngineSettings.GameMapsSettings]
EditorStartupMap=/Game/ShowTheUILevel.ShowTheUILevel
GameDefaultMap=/Game/ShowTheUILevel.ShowTheUILevel

View File

@ -1,7 +0,0 @@
[/Script/EngineSettings.GeneralProjectSettings]
ProjectID=E5977A24492699DF20B8ADBF736AF6C6
ProjectName=Discord RPC Example
CompanyName=Discord Inc.
Homepage="https://discordapp.com/"
CopyrightNotice=

View File

@ -1,29 +0,0 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.0",
"FriendlyName": "Discord RPC",
"Description": "Wrap the Discord RPC library.",
"Category": "Messaging",
"CreatedBy": "Chris Marsh <chris@discordapp.com>",
"CreatedByURL": "https://discordapp.com/",
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "",
"CanContainContent": true,
"IsBetaVersion": true,
"Installed": false,
"Modules": [
{
"Name": "DiscordRpc",
"Type": "Runtime",
"LoadingPhase": "PreDefault",
"WhitelistPlatforms" :
[
"Win64",
"Linux",
"Mac"
]
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

View File

@ -1,57 +0,0 @@
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.IO;
public class DiscordRpc : ModuleRules
{
#if WITH_FORWARDED_MODULE_RULES_CTOR
public DiscordRpc(ReadOnlyTargetRules Target) : base(Target)
#else
public DiscordRpc(TargetInfo Target)
#endif
{
Definitions.Add("DISCORD_DYNAMIC_LIB=1");
PublicIncludePaths.AddRange(
new string[] {
"DiscordRpc/Public"
}
);
PrivateIncludePaths.AddRange(
new string[] {
"DiscordRpc/Private"
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"DiscordRpcLibrary"
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
"Projects"
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
string BaseDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "Source", "ThirdParty", "DiscordRpcLibrary"));
PublicIncludePaths.Add(Path.Combine(BaseDirectory, "Include"));
}
}

View File

@ -1,76 +0,0 @@
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "DiscordRpcPrivatePCH.h"
#include "IPluginManager.h"
#include "ModuleManager.h"
#define LOCTEXT_NAMESPACE "FDiscordRpcModule"
void FDiscordRpcModule::StartupModule()
{
#if !PLATFORM_LINUX
#if defined(DISCORD_DYNAMIC_LIB)
// Get the base directory of this plugin
FString BaseDir = IPluginManager::Get().FindPlugin("DiscordRpc")->GetBaseDir();
const FString SDKDir =
FPaths::Combine(*BaseDir, TEXT("Source"), TEXT("ThirdParty"), TEXT("DiscordRpcLibrary"));
#if PLATFORM_WINDOWS
const FString LibName = TEXT("discord-rpc");
const FString LibDir = FPaths::Combine(*SDKDir, TEXT("Win64"));
if (!LoadDependency(LibDir, LibName, DiscordRpcLibraryHandle)) {
FMessageDialog::Open(
EAppMsgType::Ok,
LOCTEXT(LOCTEXT_NAMESPACE,
"Failed to load DiscordRpc plugin. Plug-in will not be functional."));
FreeDependency(DiscordRpcLibraryHandle);
}
#elif PLATFORM_MAC
const FString LibName = TEXT("libdiscord-rpc");
const FString LibDir = FPaths::Combine(*SDKDir, TEXT("Mac"));
if (!LoadDependency(LibDir, LibName, DiscordRpcLibraryHandle)) {
FMessageDialog::Open(
EAppMsgType::Ok,
LOCTEXT(LOCTEXT_NAMESPACE,
"Failed to load DiscordRpc plugin. Plug-in will not be functional."));
FreeDependency(DiscordRpcLibraryHandle);
}
#endif
#endif
#endif
}
void FDiscordRpcModule::ShutdownModule()
{
// Free the dll handle
#if !PLATFORM_LINUX
#if defined(DISCORD_DYNAMIC_LIB)
FreeDependency(DiscordRpcLibraryHandle);
#endif
#endif
}
bool FDiscordRpcModule::LoadDependency(const FString& Dir, const FString& Name, void*& Handle)
{
FString Lib = Name + TEXT(".") + FPlatformProcess::GetModuleExtension();
FString Path = Dir.IsEmpty() ? *Lib : FPaths::Combine(*Dir, *Lib);
Handle = FPlatformProcess::GetDllHandle(*Path);
if (Handle == nullptr) {
return false;
}
return true;
}
void FDiscordRpcModule::FreeDependency(void*& Handle)
{
if (Handle != nullptr) {
FPlatformProcess::FreeDllHandle(Handle);
Handle = nullptr;
}
}
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FDiscordRpcModule, DiscordRpc)

View File

@ -1,171 +0,0 @@
#include "DiscordRpcPrivatePCH.h"
#include "DiscordRpcBlueprint.h"
#include "discord_rpc.h"
DEFINE_LOG_CATEGORY(Discord)
static UDiscordRpc* self = nullptr;
static void ReadyHandler(const DiscordUser* connectedUser)
{
FDiscordUserData ud;
ud.userId = ANSI_TO_TCHAR(connectedUser->userId);
ud.username = ANSI_TO_TCHAR(connectedUser->username);
ud.discriminator = ANSI_TO_TCHAR(connectedUser->discriminator);
ud.avatar = ANSI_TO_TCHAR(connectedUser->avatar);
UE_LOG(Discord,
Log,
TEXT("Discord connected to %s - %s#%s"),
*ud.userId,
*ud.username,
*ud.discriminator);
if (self) {
self->IsConnected = true;
self->OnConnected.Broadcast(ud);
}
}
static void DisconnectHandler(int errorCode, const char* message)
{
auto msg = FString(message);
UE_LOG(Discord, Log, TEXT("Discord disconnected (%d): %s"), errorCode, *msg);
if (self) {
self->IsConnected = false;
self->OnDisconnected.Broadcast(errorCode, msg);
}
}
static void ErroredHandler(int errorCode, const char* message)
{
auto msg = FString(message);
UE_LOG(Discord, Log, TEXT("Discord error (%d): %s"), errorCode, *msg);
if (self) {
self->OnErrored.Broadcast(errorCode, msg);
}
}
static void JoinGameHandler(const char* joinSecret)
{
auto secret = FString(joinSecret);
UE_LOG(Discord, Log, TEXT("Discord join %s"), *secret);
if (self) {
self->OnJoin.Broadcast(secret);
}
}
static void SpectateGameHandler(const char* spectateSecret)
{
auto secret = FString(spectateSecret);
UE_LOG(Discord, Log, TEXT("Discord spectate %s"), *secret);
if (self) {
self->OnSpectate.Broadcast(secret);
}
}
static void JoinRequestHandler(const DiscordUser* request)
{
FDiscordUserData ud;
ud.userId = ANSI_TO_TCHAR(request->userId);
ud.username = ANSI_TO_TCHAR(request->username);
ud.discriminator = ANSI_TO_TCHAR(request->discriminator);
ud.avatar = ANSI_TO_TCHAR(request->avatar);
UE_LOG(Discord,
Log,
TEXT("Discord join request from %s - %s#%s"),
*ud.userId,
*ud.username,
*ud.discriminator);
if (self) {
self->OnJoinRequest.Broadcast(ud);
}
}
void UDiscordRpc::Initialize(const FString& applicationId,
bool autoRegister,
const FString& optionalSteamId)
{
self = this;
IsConnected = false;
DiscordEventHandlers handlers{};
handlers.ready = ReadyHandler;
handlers.disconnected = DisconnectHandler;
handlers.errored = ErroredHandler;
if (OnJoin.IsBound()) {
handlers.joinGame = JoinGameHandler;
}
if (OnSpectate.IsBound()) {
handlers.spectateGame = SpectateGameHandler;
}
if (OnJoinRequest.IsBound()) {
handlers.joinRequest = JoinRequestHandler;
}
auto appId = StringCast<ANSICHAR>(*applicationId);
auto steamId = StringCast<ANSICHAR>(*optionalSteamId);
Discord_Initialize(
(const char*)appId.Get(), &handlers, autoRegister, (const char*)steamId.Get());
}
void UDiscordRpc::Shutdown()
{
Discord_Shutdown();
self = nullptr;
}
void UDiscordRpc::RunCallbacks()
{
Discord_RunCallbacks();
}
void UDiscordRpc::UpdatePresence()
{
DiscordRichPresence rp{};
auto state = StringCast<ANSICHAR>(*RichPresence.state);
rp.state = state.Get();
auto details = StringCast<ANSICHAR>(*RichPresence.details);
rp.details = details.Get();
auto largeImageKey = StringCast<ANSICHAR>(*RichPresence.largeImageKey);
rp.largeImageKey = largeImageKey.Get();
auto largeImageText = StringCast<ANSICHAR>(*RichPresence.largeImageText);
rp.largeImageText = largeImageText.Get();
auto smallImageKey = StringCast<ANSICHAR>(*RichPresence.smallImageKey);
rp.smallImageKey = smallImageKey.Get();
auto smallImageText = StringCast<ANSICHAR>(*RichPresence.smallImageText);
rp.smallImageText = smallImageText.Get();
auto partyId = StringCast<ANSICHAR>(*RichPresence.partyId);
rp.partyId = partyId.Get();
auto matchSecret = StringCast<ANSICHAR>(*RichPresence.matchSecret);
rp.matchSecret = matchSecret.Get();
auto joinSecret = StringCast<ANSICHAR>(*RichPresence.joinSecret);
rp.joinSecret = joinSecret.Get();
auto spectateSecret = StringCast<ANSICHAR>(*RichPresence.spectateSecret);
rp.spectateSecret = spectateSecret.Get();
rp.startTimestamp = RichPresence.startTimestamp;
rp.endTimestamp = RichPresence.endTimestamp;
rp.partySize = RichPresence.partySize;
rp.partyMax = RichPresence.partyMax;
rp.instance = RichPresence.instance;
Discord_UpdatePresence(&rp);
}
void UDiscordRpc::ClearPresence()
{
Discord_ClearPresence();
}
void UDiscordRpc::Respond(const FString& userId, int reply)
{
UE_LOG(Discord, Log, TEXT("Responding %d to join request from %s"), reply, *userId);
FTCHARToUTF8 utf8_userid(*userId);
Discord_Respond(utf8_userid.Get(), reply);
}

View File

@ -1,2 +0,0 @@
#include "Core.h"
#include "DiscordRpc.h"

View File

@ -1,20 +0,0 @@
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "ModuleManager.h"
class FDiscordRpcModule : public IModuleInterface {
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
private:
/** Handle to the test dll we will load */
void* DiscordRpcLibraryHandle;
/** StartupModule is covered with defines, these functions are the place to put breakpoints */
static bool LoadDependency(const FString& Dir, const FString& Name, void*& Handle);
static void FreeDependency(void*& Handle);
};

View File

@ -1,169 +0,0 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine.h"
#include "DiscordRpcBlueprint.generated.h"
// unreal's header tool hates clang-format
// clang-format off
/**
* Ask to join callback data
*/
USTRUCT(BlueprintType)
struct FDiscordUserData {
GENERATED_USTRUCT_BODY()
UPROPERTY(BlueprintReadOnly)
FString userId;
UPROPERTY(BlueprintReadOnly)
FString username;
UPROPERTY(BlueprintReadOnly)
FString discriminator;
UPROPERTY(BlueprintReadOnly)
FString avatar;
};
/**
* Valid response codes for Respond function
*/
UENUM(BlueprintType)
enum class EDiscordJoinResponseCodes : uint8
{
DISCORD_REPLY_NO UMETA(DisplayName="No"),
DISCORD_REPLY_YES UMETA(DisplayName="Yes"),
DISCORD_REPLY_IGNORE UMETA(DisplayName="Ignore")
};
DECLARE_LOG_CATEGORY_EXTERN(Discord, Log, All);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDiscordConnected, const FDiscordUserData&, joinRequest);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDiscordDisconnected, int, errorCode, const FString&, errorMessage);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDiscordErrored, int, errorCode, const FString&, errorMessage);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDiscordJoin, const FString&, joinSecret);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDiscordSpectate, const FString&, spectateSecret);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDiscordJoinRequest, const FDiscordUserData&, joinRequest);
// clang-format on
/**
* Rich presence data
*/
USTRUCT(BlueprintType)
struct FDiscordRichPresence {
GENERATED_USTRUCT_BODY()
UPROPERTY(BlueprintReadWrite)
FString state;
UPROPERTY(BlueprintReadWrite)
FString details;
// todo, timestamps are 64bit, does that even matter?
UPROPERTY(BlueprintReadWrite)
int startTimestamp;
UPROPERTY(BlueprintReadWrite)
int endTimestamp;
UPROPERTY(BlueprintReadWrite)
FString largeImageKey;
UPROPERTY(BlueprintReadWrite)
FString largeImageText;
UPROPERTY(BlueprintReadWrite)
FString smallImageKey;
UPROPERTY(BlueprintReadWrite)
FString smallImageText;
UPROPERTY(BlueprintReadWrite)
FString partyId;
UPROPERTY(BlueprintReadWrite)
int partySize;
UPROPERTY(BlueprintReadWrite)
int partyMax;
UPROPERTY(BlueprintReadWrite)
FString matchSecret;
UPROPERTY(BlueprintReadWrite)
FString joinSecret;
UPROPERTY(BlueprintReadWrite)
FString spectateSecret;
UPROPERTY(BlueprintReadWrite)
bool instance;
};
/**
*
*/
UCLASS(BlueprintType, meta = (DisplayName = "Discord RPC"), Category = "Discord")
class DISCORDRPC_API UDiscordRpc : public UObject {
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable,
meta = (DisplayName = "Initialize connection", Keywords = "Discord rpc"),
Category = "Discord")
void Initialize(const FString& applicationId,
bool autoRegister,
const FString& optionalSteamId);
UFUNCTION(BlueprintCallable,
meta = (DisplayName = "Shut down connection", Keywords = "Discord rpc"),
Category = "Discord")
void Shutdown();
UFUNCTION(BlueprintCallable,
meta = (DisplayName = "Check for callbacks", Keywords = "Discord rpc"),
Category = "Discord")
void RunCallbacks();
UFUNCTION(BlueprintCallable,
meta = (DisplayName = "Send presence", Keywords = "Discord rpc"),
Category = "Discord")
void UpdatePresence();
UFUNCTION(BlueprintCallable,
meta = (DisplayName = "Clear presence", Keywords = "Discord rpc"),
Category = "Discord")
void ClearPresence();
UFUNCTION(BlueprintCallable,
meta = (DisplayName = "Respond to join request", Keywords = "Discord rpc"),
Category = "Discord")
void Respond(const FString& userId, int reply);
UPROPERTY(BlueprintReadOnly,
meta = (DisplayName = "Is Discord connected", Keywords = "Discord rpc"),
Category = "Discord")
bool IsConnected;
UPROPERTY(BlueprintAssignable,
meta = (DisplayName = "On connection", Keywords = "Discord rpc"),
Category = "Discord")
FDiscordConnected OnConnected;
UPROPERTY(BlueprintAssignable,
meta = (DisplayName = "On disconnection", Keywords = "Discord rpc"),
Category = "Discord")
FDiscordDisconnected OnDisconnected;
UPROPERTY(BlueprintAssignable,
meta = (DisplayName = "On error message", Keywords = "Discord rpc"),
Category = "Discord")
FDiscordErrored OnErrored;
UPROPERTY(BlueprintAssignable,
meta = (DisplayName = "When Discord user presses join", Keywords = "Discord rpc"),
Category = "Discord")
FDiscordJoin OnJoin;
UPROPERTY(BlueprintAssignable,
meta = (DisplayName = "When Discord user presses spectate", Keywords = "Discord rpc"),
Category = "Discord")
FDiscordSpectate OnSpectate;
UPROPERTY(BlueprintAssignable,
meta = (DisplayName = "When Discord another user sends a join request",
Keywords = "Discord rpc"),
Category = "Discord")
FDiscordJoinRequest OnJoinRequest;
UPROPERTY(BlueprintReadWrite,
meta = (DisplayName = "Rich presence info", Keywords = "Discord rpc"),
Category = "Discord")
FDiscordRichPresence RichPresence;
};

View File

@ -1,59 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
using System.IO;
using UnrealBuildTool;
public class DiscordRpcLibrary : ModuleRules
{
#if WITH_FORWARDED_MODULE_RULES_CTOR
public DiscordRpcLibrary(ReadOnlyTargetRules Target) : base(Target)
#else
public DiscordRpcLibrary(TargetInfo Target)
#endif
{
Type = ModuleType.External;
Definitions.Add("DISCORD_DYNAMIC_LIB=1");
string BaseDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "DiscordRpcLibrary"));
if (Target.Platform == UnrealTargetPlatform.Win64)
{
string lib = Path.Combine(BaseDirectory, "Win64");
// Include headers
PublicIncludePaths.Add(Path.Combine(BaseDirectory, "Include"));
// Add the import library
PublicLibraryPaths.Add(lib);
PublicAdditionalLibraries.Add(Path.Combine(lib, "discord-rpc.lib"));
// Dynamic
RuntimeDependencies.Add(new RuntimeDependency(Path.Combine(lib, "discord-rpc.dll")));
PublicDelayLoadDLLs.Add("discord-rpc.dll");
}
else if (Target.Platform == UnrealTargetPlatform.Linux)
{
string lib = Path.Combine(BaseDirectory, "Linux", "x86_64-unknown-linux-gnu");
// Include headers
PublicIncludePaths.Add(Path.Combine(BaseDirectory, "Include"));
// Add the import library
PublicLibraryPaths.Add(lib);
PublicAdditionalLibraries.Add(Path.Combine(lib, "libdiscord-rpc.so"));
RuntimeDependencies.Add(new RuntimeDependency(Path.Combine(lib, "libdiscord-rpc.so")));
}
else if (Target.Platform == UnrealTargetPlatform.Mac)
{
string lib = Path.Combine(BaseDirectory, "Mac");
// Include headers
PublicIncludePaths.Add(Path.Combine(BaseDirectory, "Include"));
// Add the import library
PublicLibraryPaths.Add(lib);
PublicAdditionalLibraries.Add(Path.Combine(lib, "libdiscord-rpc.dylib"));
RuntimeDependencies.Add(new RuntimeDependency(Path.Combine(lib, "libdiscord-rpc.dylib")));
}
}
}

View File

@ -1,14 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
using System.Collections.Generic;
public class unrealstatusTarget : TargetRules
{
public unrealstatusTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
ExtraModuleNames.AddRange( new string[] { "unrealstatus" } );
}
}

View File

@ -1,23 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
public class unrealstatus : ModuleRules
{
public unrealstatus(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
PrivateDependencyModuleNames.AddRange(new string[] { });
// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
}
}

View File

@ -1,6 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "unrealstatus.h"
#include "Modules/ModuleManager.h"
IMPLEMENT_PRIMARY_GAME_MODULE(FDefaultGameModuleImpl, unrealstatus, "unrealstatus");

View File

@ -1,5 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"

View File

@ -1,3 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "unrealstatusGameModeBase.h"

View File

@ -1,15 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "unrealstatusGameModeBase.generated.h"
/**
*
*/
UCLASS()
class UNREALSTATUS_API AunrealstatusGameModeBase : public AGameModeBase {
GENERATED_BODY()
};

View File

@ -1,14 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
using System.Collections.Generic;
public class unrealstatusEditorTarget : TargetRules
{
public unrealstatusEditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
ExtraModuleNames.AddRange( new string[] { "unrealstatus" } );
}
}

View File

@ -1,19 +0,0 @@
{
"FileVersion": 3,
"EngineAssociation": "4.18",
"Category": "",
"Description": "",
"Modules": [
{
"Name": "unrealstatus",
"Type": "Runtime",
"LoadingPhase": "Default"
}
],
"TargetPlatforms": [
"LinuxNoEditor",
"MacNoEditor",
"WindowsNoEditor",
"AllDesktop"
]
}

View File

@ -1,18 +1,6 @@
#pragma once
#if defined(DISCORD_DYNAMIC_LIB)
#if defined(_WIN32)
#if defined(DISCORD_BUILDING_SDK)
#define DISCORD_EXPORT __declspec(dllexport)
#else
#define DISCORD_EXPORT __declspec(dllimport)
#endif
#else
#define DISCORD_EXPORT __attribute__((visibility("default")))
#endif
#else
#define DISCORD_EXPORT
#endif
#ifdef __cplusplus
extern "C" {

View File

@ -1,19 +1,20 @@
#pragma once
#include <stdint.h>
// clang-format off
/* clang-format off */
# define DISCORD_EXPORT
// clang-format on
/* clang-format on */
#ifdef __cplusplus
extern "C" {
#endif
typedef struct DiscordRichPresence {
const char* state; /* max 128 bytes */
const char* details; /* max 128 bytes */
typedef struct DiscordRichPresence
{
const char* state; /* max 128 bytes */
const char* details; /* max 128 bytes */
int64_t startTimestamp;
int64_t endTimestamp;
const char* largeImageKey; /* max 32 bytes */
@ -29,14 +30,16 @@ typedef struct DiscordRichPresence {
int8_t instance;
} DiscordRichPresence;
typedef struct DiscordUser {
typedef struct DiscordUser
{
const char* userId;
const char* username;
const char* discriminator;
const char* avatar;
} DiscordUser;
typedef struct DiscordEventHandlers {
typedef struct DiscordEventHandlers
{
void (*ready)(const DiscordUser* request);
void (*disconnected)(int errorCode, const char* message);
void (*errored)(int errorCode, const char* message);
@ -58,7 +61,8 @@ DISCORD_EXPORT void Discord_Shutdown(void);
/* checks for incoming messages, dispatches callbacks */
DISCORD_EXPORT void Discord_RunCallbacks(void);
/* If you disable the lib starting its own io thread, you'll need to call this from your own */
/* 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);
#endif
@ -66,7 +70,8 @@ DISCORD_EXPORT void Discord_UpdateConnection(void);
DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence);
DISCORD_EXPORT void Discord_ClearPresence(void);
DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply);
DISCORD_EXPORT void Discord_Respond(const char* userid,
/* DISCORD_REPLY_ */ int reply);
DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers* handlers);

View File

@ -1,11 +1,11 @@
#pragma once
// This is to wrap the platform specific kinds of connect/read/write.
/* This is to wrap the platform specific kinds of connect/read/write. */
#include <stdint.h>
#include <stdlib.h>
// not really connectiony, but need per-platform
/* not really connectiony, but need per-platform */
int GetProcessId();
struct BaseConnection {

View File

@ -4,7 +4,6 @@
#define NOMCX
#define NOSERVICE
#define NOIME
#include <assert.h>
#include <windows.h>
int GetProcessId()
@ -48,7 +47,7 @@ bool BaseConnection::Open()
return true;
}
auto lastError = GetLastError();
DWORD lastError = GetLastError();
if (lastError == ERROR_FILE_NOT_FOUND)
{
if (pipeName[pipeDigit] < L'9')
@ -71,26 +70,24 @@ bool BaseConnection::Close()
{
auto self = reinterpret_cast<BaseConnectionWin*>(this);
::CloseHandle(self->pipe);
self->pipe = INVALID_HANDLE_VALUE;
self->pipe = INVALID_HANDLE_VALUE;
self->isOpen = false;
return true;
}
bool BaseConnection::Write(const void* data, size_t length)
{
DWORD bytesWritten = 0;
const DWORD bytesLength = (DWORD)length;
if (length == 0)
return true;
auto self = reinterpret_cast<BaseConnectionWin*>(this);
assert(self);
if (!self)
return false;
if (self->pipe == INVALID_HANDLE_VALUE)
return false;
assert(data);
if (!data)
return false;
const DWORD bytesLength = (DWORD)length;
DWORD bytesWritten = 0;
return ::WriteFile(self->pipe, data, bytesLength,
&bytesWritten, nullptr) == TRUE &&
bytesWritten == bytesLength;
@ -98,27 +95,27 @@ bool BaseConnection::Write(const void* data, size_t length)
bool BaseConnection::Read(void* data, size_t length)
{
assert(data);
DWORD bytesAvailable = 0;
if (!data)
return false;
auto self = reinterpret_cast<BaseConnectionWin*>(this);
assert(self);
if (!self)
return false;
if (self->pipe == INVALID_HANDLE_VALUE)
return false;
DWORD bytesAvailable = 0;
if (::PeekNamedPipe(self->pipe, nullptr, 0, nullptr, &bytesAvailable, nullptr)) {
if (::PeekNamedPipe(self->pipe, nullptr, 0, nullptr,
&bytesAvailable, nullptr))
{
if (bytesAvailable >= length)
{
DWORD bytesToRead = (DWORD)length;
DWORD bytesRead = 0;
if (::ReadFile(self->pipe, data, bytesToRead, &bytesRead, nullptr) == TRUE) {
assert(bytesToRead == bytesRead);
DWORD bytesRead = 0;
if (::ReadFile(self->pipe, data, bytesToRead,
&bytesRead, nullptr) == TRUE)
return true;
}
else
Close();
Close();
}
}
else

View File

@ -10,16 +10,8 @@
#include <unistd.h>
#include <boolean.h>
static bool Mkdir(const char* path)
{
int result = mkdir(path, 0755);
if (result == 0)
return true;
if (errno == EEXIST)
return true;
return false;
}
#include <file/file_path.h>
#include <compat/strl.h>
/* we want to register games so we can run them from
* Discord client as discord-<appid>:// */
@ -64,15 +56,15 @@ void Discord_Register(const char* applicationId, const char* command)
snprintf(desktopFilename, sizeof(desktopFilename), "/discord-%s.desktop", applicationId);
snprintf(desktopFilePath, sizeof(desktopFilePath), "%s/.local", home);
if (!Mkdir(desktopFilePath))
if (!path_mkdir(desktopFilePath))
return;
strcat(desktopFilePath, "/share");
if (!Mkdir(desktopFilePath))
strlcat(desktopFilePath, "/share", sizeof(desktopFilePath));
if (!path_mkdir(desktopFilePath))
return;
strcat(desktopFilePath, "/applications");
if (!Mkdir(desktopFilePath))
strlcat(desktopFilePath, "/applications", sizeof(desktopFilePath));
if (!path_mkdir(desktopFilePath))
return;
strcat(desktopFilePath, desktopFilename);
strlcat(desktopFilePath, desktopFilename, sizeof(desktopFilePath));
fp = fopen(desktopFilePath, "w");
if (!fp)
@ -95,6 +87,6 @@ void Discord_RegisterSteamGame(
const char* steamId)
{
char command[256];
sprintf(command, "xdg-open steam://rungameid/%s", steamId);
snprintf(command, sizeof(command), "xdg-open steam://rungameid/%s", steamId);
Discord_Register(applicationId, command);
}

View File

@ -7,26 +7,26 @@
static void RegisterCommand(const char* applicationId, const char* command)
{
// There does not appear to be a way to register arbitrary commands on OSX, so instead we'll save the command
// to a file in the Discord config path, and when it is needed, Discord can try to load the file there, open
// the command therein (will pass to js's window.open, so requires a url-like thing)
/* There does not appear to be a way to register arbitrary commands on OSX, so instead we'll save the command
* to a file in the Discord config path, and when it is needed, Discord can try to load the file there, open
* the command therein (will pass to js's window.open, so requires a url-like thing)
*/
// Note: will not work for sandboxed apps
NSString *home = NSHomeDirectory();
if (!home) {
return;
}
/* Note: will not work for sandboxed apps */
NSString *home = NSHomeDirectory();
if (!home)
return;
NSString *path = [[[[[[home stringByAppendingPathComponent:@"Library"]
stringByAppendingPathComponent:@"Application Support"]
stringByAppendingPathComponent:@"discord"]
stringByAppendingPathComponent:@"games"]
stringByAppendingPathComponent:[NSString stringWithUTF8String:applicationId]]
stringByAppendingPathExtension:@"json"];
[[NSFileManager defaultManager] createDirectoryAtPath:[path stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:nil error:nil];
NSString *path = [[[[[[home stringByAppendingPathComponent:@"Library"]
stringByAppendingPathComponent:@"Application Support"]
stringByAppendingPathComponent:@"discord"]
stringByAppendingPathComponent:@"games"]
stringByAppendingPathComponent:[NSString stringWithUTF8String:applicationId]]
stringByAppendingPathExtension:@"json"];
[[NSFileManager defaultManager] createDirectoryAtPath:[path stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:nil error:nil];
NSString *jsonBuffer = [NSString stringWithFormat:@"{\"command\": \"%s\"}", command];
[jsonBuffer writeToFile:path atomically:NO encoding:NSUTF8StringEncoding error:nil];
NSString *jsonBuffer = [NSString stringWithFormat:@"{\"command\": \"%s\"}", command];
[jsonBuffer writeToFile:path atomically:NO encoding:NSUTF8StringEncoding error:nil];
}
static void RegisterURL(const char* applicationId)
@ -34,38 +34,42 @@ 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];
if (!myBundleId) {
if (!myBundleId)
{
fprintf(stderr, "No bundle id found\n");
return;
}
NSURL* myURL = [[NSBundle mainBundle] bundleURL];
if (!myURL) {
if (!myURL)
{
fprintf(stderr, "No bundle url found\n");
return;
}
OSStatus status = LSSetDefaultHandlerForURLScheme(cfURL, (__bridge CFStringRef)myBundleId);
if (status != noErr) {
if (status != noErr)
{
fprintf(stderr, "Error in LSSetDefaultHandlerForURLScheme: %d\n", (int)status);
return;
}
status = LSRegisterURL((__bridge CFURLRef)myURL, true);
if (status != noErr) {
if (status != noErr)
{
fprintf(stderr, "Error in LSRegisterURL: %d\n", (int)status);
}
}
void Discord_Register(const char* applicationId, const char* command)
{
if (command) {
if (command)
RegisterCommand(applicationId, command);
}
else {
// raii lite
else
{
/* RAII Lite */
@autoreleasepool {
RegisterURL(applicationId);
}
@ -75,6 +79,6 @@ void Discord_Register(const char* applicationId, const char* command)
void Discord_RegisterSteamGame(const char* applicationId, const char* steamId)
{
char command[256];
snprintf(command, 256, "steam://rungameid/%s", steamId);
snprintf(command, sizeof(command), "steam://rungameid/%s", steamId);
Discord_Register(applicationId, command);
}

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