This commit is contained in:
fr500 2015-04-19 13:58:56 -05:00
commit 8b31719bfb
105 changed files with 3123 additions and 1419 deletions

View File

@ -56,6 +56,7 @@ endif
ifneq ($(findstring Darwin,$(OS)),)
OSX := 1
LIBS += -framework AppKit
JOYCONFIG_LIBS += -framework CoreFoundation
else
OSX := 0
endif
@ -64,7 +65,8 @@ ifneq ($(findstring Linux,$(OS)),)
LIBS += -lrt
JOYCONFIG_LIBS += -lrt -lpthread
OBJ += input/drivers/linuxraw_input.o \
input/drivers_joypad/linuxraw_joypad.o
input/drivers_joypad/linuxraw_joypad.o \
frontend/drivers/platform_linux.o
endif
ifeq ($(findstring Haiku,$(OS)),)
@ -172,6 +174,7 @@ OBJ += frontend/frontend.o \
playlist.o \
movie.o \
record/record_driver.o \
record/drivers/record_null.o \
performance.o
@ -252,6 +255,10 @@ ifeq ($(HAVE_AL), 1)
endif
endif
ifeq ($(OSX), 1)
OBJ += frontend/drivers/platform_apple.o
endif
ifeq ($(HAVE_JACK),1)
OBJ += audio/drivers/jack.o
LIBS += $(JACK_LIBS)
@ -430,14 +437,15 @@ ifeq ($(HAVE_PARPORT), 1)
OBJ += input/drivers_joypad/parport_joypad.o
endif
OBJ += gfx/video_context_driver.o \
gfx/drivers_context/gfx_null_ctx.o
# Video
#
ifeq ($(HAVE_OPENGL), 1)
DEFINES += -DHAVE_OPENGL -DHAVE_GLSL
OBJ += gfx/drivers/gl.o \
gfx/drivers/gl_common.o \
gfx/video_context_driver.o \
gfx/drivers_context/gfx_null_ctx.o \
gfx/drivers_font/gl_raster_font.o \
libretro-common/gfx/math/matrix_4x4.o \
gfx/video_state_tracker.o \
@ -640,13 +648,10 @@ endif
ifeq ($(HAVE_ZLIB), 1)
ZLIB_OBJS = decompress/zip_support.o
OBJ += libretro-common/formats/png/rpng_nbio.o \
libretro-common/formats/png/rpng_fbio.o \
libretro-common/formats/png/rpng_decode.o \
libretro-common/formats/png/rpng_encode.o \
libretro-common/file/file_extract.o
OBJ += libretro-common/file/file_extract.o
OBJ += $(ZLIB_OBJS)
DEFINES += -DHAVE_ZLIB
HAVE_RPNG = 1
HAVE_COMPRESSION = 1
ifeq ($(WANT_ZLIB), 1)
DEFINES += -DWANT_ZLIB
@ -656,6 +661,17 @@ ifeq ($(HAVE_ZLIB), 1)
endif
endif
ifdef HAVE_RPNG
DEFINES += -DHAVE_RPNG
endif
ifeq ($(HAVE_RPNG), 1)
OBJ += libretro-common/formats/png/rpng_nbio.o \
libretro-common/formats/png/rpng_fbio.o \
libretro-common/formats/png/rpng_decode.o \
libretro-common/formats/png/rpng_encode.o
endif
ifdef HAVE_COMPRESSION
DEFINES += -DHAVE_COMPRESSION
endif

View File

@ -39,7 +39,7 @@ CFLAGS += -I. -Ideps/zlib -Ideps/7zip -Ilibretro-common/include
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE -DSINC_LOWEST_QUALITY
CFLAGS += -DHAVE_GRIFFIN=1 -DHAVE_FILTERS_BUILTIN -DHAVE_MENU -DHAVE_RGUI
CFLAGS += -DHAVE_ZLIB -DWANT_ZLIB -DHAVE_BUILTIN_AUTOCONFIG
CFLAGS += -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_BUILTIN_AUTOCONFIG
#-DHAVE_LIBRETRO_MANAGEMENT -DWANT_RPNG -DHAVE_7ZIP

View File

@ -76,6 +76,7 @@ endif
HAVE_FILTERS_BUILTIN := 1
HAVE_THREADS := 1
HAVE_ZLIB := 1
HAVE_RPNG := 1
HAVE_7ZIP := 1
HAVE_RPNG := 1
HAVE_OVERLAY := 1
@ -119,6 +120,7 @@ HAVE_7ZIP := 1
HAVE_LIBRETRO_MANAGEMENT := 1
HAVE_ZLIB := 1
HAVE_RPNG := 1
HAVE_RPNG := 1
HAVE_OVERLAY := 1
HAVE_LIBSICKSAXIS := 0
HAVE_BUILTIN_AUTOCONFIG := 1
@ -172,6 +174,10 @@ ifeq ($(HAVE_ZLIB), 1)
CFLAGS += -DHAVE_ZLIB -DWANT_ZLIB
endif
ifeq ($(HAVE_RPNG), 1)
CFLAGS += -DHAVE_RPNG
endif
ifeq ($(HAVE_7ZIP), 1)
CFLAGS += -DHAVE_7ZIP
endif

View File

@ -106,7 +106,7 @@ PPU_LDLIBS = $(FONT_LIBS) $(GL_LIBS) $(WHOLE_START) -lretro_ps3 $(WHOLE_END) -l
PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_7Z -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETPLAY=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_FILTERS_BUILTIN -DHAVE_BUILTIN_AUTOCONFIG
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_7Z -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETPLAY=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_FILTERS_BUILTIN -DHAVE_BUILTIN_AUTOCONFIG
ifeq ($(DEBUG), 1)
PPU_OPTIMIZE_LV := -O0 -g

View File

@ -106,7 +106,7 @@ PPU_LDLIBS = $(FONT_LIBS) $(GL_LIBS) $(WHOLE_START) -lretro_ps3 $(WHOLE_END) -l
PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=0 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=0 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
ifeq ($(DEBUG), 1)
PPU_OPTIMIZE_LV := -O0 -g

View File

@ -90,7 +90,7 @@ ifeq ($(HAVE_FILE_LOGGER), 1)
CFLAGS += -DHAVE_FILE_LOGGER
endif
SHARED_FLAGS := -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts
SHARED_FLAGS := -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts
CFLAGS += -std=gnu99 $(SHARED_FLAGS)
CXXFLAGS += $(SHARED_FLAGS)

View File

@ -23,7 +23,7 @@ INCDIR = deps/zlib deps/7zip libretro-common/include
CFLAGS = $(OPTIMIZE_LV) -G0 -std=gnu99 -ffast-math
ASFLAGS = $(CFLAGS)
RARCH_DEFINES = -DPSP -D_MIPS_ARCH_ALLEGREX -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_ZLIB -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_MENU -DHAVE_RGUI -DWANT_RPNG -DSINC_LOWEST_QUALITY -DHAVE_BUILTIN_AUTOCONFIG -DHAVE_FILTERS_BUILTIN -DHAVE_7ZIP
RARCH_DEFINES = -DPSP -D_MIPS_ARCH_ALLEGREX -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_MENU -DHAVE_RGUI -DWANT_RPNG -DSINC_LOWEST_QUALITY -DHAVE_BUILTIN_AUTOCONFIG -DHAVE_FILTERS_BUILTIN -DHAVE_7ZIP
LIBDIR =
LDFLAGS =

View File

@ -18,7 +18,7 @@ RARCH_DEFINES = -DPSP -DIS_SALAMANDER -DRARCH_CONSOLE
LIBDIR =
LDFLAGS =
LIBS = -lstdc++ -lm
LIBS = -lstdc++ -lm -lpsppower
ifeq ($(HAVE_FILE_LOGGER), 1)
CFLAGS += -DHAVE_FILE_LOGGER

View File

@ -58,7 +58,7 @@ else
endif
LOCAL_CFLAGS += -Wall -pthread -Wno-unused-function -fno-stack-protector -funroll-loops -DRARCH_MOBILE -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_FBO -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_DYLIB -DHAVE_GLSL -DHAVE_MENU -DHAVE_RGUI -DHAVE_ZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREADS -D__LIBRETRO__ -DHAVE_RSOUND -DHAVE_NETPLAY -DHAVE_NETWORKING -DRARCH_INTERNAL -DHAVE_FILTERS_BUILTIN -DHAVE_GLUI -DHAVE_XMB -std=gnu99 -DHAVE_LIBRETRODB
LOCAL_CFLAGS += -Wall -pthread -Wno-unused-function -fno-stack-protector -funroll-loops -DRARCH_MOBILE -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_FBO -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_DYLIB -DHAVE_GLSL -DHAVE_MENU -DHAVE_RGUI -DHAVE_ZLIB -DHAVE_RPNG -DINLINE=inline -DLSB_FIRST -DHAVE_THREADS -D__LIBRETRO__ -DHAVE_RSOUND -DHAVE_NETPLAY -DHAVE_NETWORKING -DRARCH_INTERNAL -DHAVE_FILTERS_BUILTIN -DHAVE_GLUI -DHAVE_XMB -std=gnu99 -DHAVE_LIBRETRODB
LOCAL_CFLAGS += -DHAVE_7ZIP
ifeq ($(NDK_DEBUG),1)

View File

@ -1,57 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2013-2014 - Jason Fetters
* Copyright (C) 2011-2015 - 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 __RARCH_OSX_PLATFORM_H
#define __RARCH_OSX_PLATFORM_H
#include <AppKit/AppKit.h>
#ifdef HAVE_LOCATION
#include <CoreLocation/CoreLocation.h>
#endif
#include "../common/CFExtensions.h"
@interface RAGameView : NSView
#ifdef HAVE_LOCATION
<CLLocationManagerDelegate>
#endif
+ (RAGameView*)get;
#ifndef OSX
- (void)display;
#endif
@end
@interface RetroArch_OSX : NSObject<RetroArch_Platform>
{
NSWindow* _window;
NSWindowController* _settingsWindow;
NSWindow* _coreSelectSheet;
NSString* _file;
NSString* _core;
}
@property (nonatomic, retain) NSWindow IBOutlet* window;
+ (RetroArch_OSX*)get;
- (void)loadingCore:(NSString*)core withFile:(const char*)file;
- (void)unloadingCore;
@end
#endif

View File

@ -17,14 +17,12 @@
#include <string.h>
#import "../common/RetroArch_Apple.h"
#include "../../input/drivers/apple_input.h"
#include "../../input/drivers/cocoa_input.h"
#include "../../frontend/frontend.h"
#include "../../menu/menu.h"
#include "../../retroarch.h"
#include <objc/objc-runtime.h>
static void* const associated_core_key = (void*)&associated_core_key;
id<RetroArch_Platform> apple_platform;
void apple_rarch_exited(void);
@ -42,11 +40,11 @@ void apple_rarch_exited(void)
- (void)sendEvent:(NSEvent *)event
{
NSEventType event_type;
apple_input_data_t *apple = NULL;
cocoa_input_data_t *apple = NULL;
driver_t *driver = driver_get_ptr();
[super sendEvent:event];
apple = (apple_input_data_t*)driver->input_data;
apple = (cocoa_input_data_t*)driver->input_data;
event_type = event.type;
if (!apple)
@ -80,11 +78,11 @@ void apple_rarch_exited(void)
mod |= RETROKMOD_NUMLOCK;
for (i = 1; i < ch.length; i++)
apple_input_keyboard_event(event_type == NSKeyDown,
cocoa_input_keyboard_event(event_type == NSKeyDown,
0, [ch characterAtIndex:i], mod, RETRO_DEVICE_KEYBOARD);
}
apple_input_keyboard_event(event_type == NSKeyDown,
cocoa_input_keyboard_event(event_type == NSKeyDown,
event.keyCode, character, mod, RETRO_DEVICE_KEYBOARD);
}
break;
@ -95,7 +93,7 @@ void apple_rarch_exited(void)
bool down = (new_flags & old_flags) == old_flags;
old_flags = new_flags;
apple_input_keyboard_event(down, event.keyCode,
cocoa_input_keyboard_event(down, event.keyCode,
0, event.modifierFlags, RETRO_DEVICE_KEYBOARD);
}
break;
@ -195,7 +193,7 @@ static void poll_iteration(void)
{
NSEvent *event = NULL;
driver_t *driver = driver_get_ptr();
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
if (!apple)
return;
@ -325,7 +323,6 @@ static void poll_iteration(void)
- (IBAction)coreWasChosen:(id)sender
{
NSComboBox* cb = NULL;
global_t *global = global_get_ptr();
[[NSApplication sharedApplication] stopModal];
@ -335,14 +332,6 @@ static void poll_iteration(void)
if (global && global->system.shutdown)
return;
/* TODO - rewrite this. */
cb = (NSComboBox*)[[self.coreSelectSheet contentView] viewWithTag:1];
#if defined(MAC_OS_X_VERSION_10_6)
/* FIXME - Rewrite this so that this is no longer an associated object - requires ObjC 2.0 runtime */
self.core = objc_getAssociatedObject(cb.objectValueOfSelectedItem, associated_core_key);
#endif
if (global && !global->main_is_init)
{
/* TODO/FIXME: Set core/content here. */
@ -353,7 +342,6 @@ static void poll_iteration(void)
event_command(EVENT_CMD_QUIT);
}
#pragma mark RetroArch_Platform
- (void)loadingCore:(const NSString*)core withFile:(const char*)file
{
if (file)
@ -365,7 +353,6 @@ static void poll_iteration(void)
[[NSApplication sharedApplication] terminate:nil];
}
#pragma mark Menus
- (IBAction)showCoresDirectory:(id)sender
{
settings_t *settings = config_get_ptr();

View File

@ -17,7 +17,7 @@
#import "../common/RetroArch_Apple.h"
#include <retro_miscellaneous.h>
#include "../../settings.h"
#include "../../input/drivers/apple_input.h"
#include "../../input/drivers/cocoa_input.h"
#include "../../driver.h"
#include "../../input/input_common.h"
@ -76,11 +76,11 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
if (self.setting->index)
idx = self.setting->index - 1;
if ((value = apple_input_find_any_key()))
if ((value = cocoa_input_find_any_key()))
BINDFOR(*[self setting]).key = input_keymaps_translate_keysym_to_rk(value);
else if ((value = apple_input_find_any_button(idx)) >= 0)
else if ((value = cocoa_input_find_any_button(idx)) >= 0)
BINDFOR(*[self setting]).joykey = value;
else if ((value = apple_input_find_any_axis(idx)))
else if ((value = cocoa_input_find_any_axis(idx)))
BINDFOR(*[self setting]).joyaxis = (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(abs(value) - 1);
else
return;

View File

@ -282,6 +282,8 @@
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"-DHAVE_GRIFFIN",
"-DHAVE_CORETEXT",
"-DHAVE_IOHIDMANAGER",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DOSX",
@ -296,6 +298,8 @@
"-DHAVE_DYNAMIC",
"-DHAVE_OVERLAY",
"-DHAVE_ZLIB",
"-DHAVE_RPNG",
"-DHAVE_COCOA",
"-DWANT_ZLIB",
"-DSINC_LOWER_QUALITY",
"-DHAVE_NETPLAY",
@ -343,6 +347,7 @@
"-DNS_BLOCK_ASSERTIONS=1",
"-DNDEBUG",
"-DHAVE_GRIFFIN",
"-DHAVE_IOHIDMANAGER",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DOSX",
@ -357,6 +362,8 @@
"-DHAVE_DYNAMIC",
"-DHAVE_OVERLAY",
"-DHAVE_ZLIB",
"-DHAVE_RPNG",
"-DHAVE_COCOA",
"-DWANT_ZLIB",
"-DSINC_LOWER_QUALITY",
"-DHAVE_NETPLAY",

View File

@ -325,6 +325,8 @@
MACOSX_DEPLOYMENT_TARGET = 10.5;
OTHER_CFLAGS = (
"-DHAVE_GRIFFIN",
"-DHAVE_CORETEXT",
"-DHAVE_IOHIDMANAGER",
"-DHAVE_LOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
@ -339,6 +341,8 @@
"-DHAVE_DYNAMIC",
"-DHAVE_OVERLAY",
"-DHAVE_ZLIB",
"-DHAVE_RPNG",
"-DHAVE_COCOA",
"-DWANT_ZLIB",
"-DSINC_LOWER_QUALITY",
"-DHAVE_NETPLAY",
@ -379,6 +383,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.5;
OTHER_CFLAGS = (
"-DHAVE_GRIFFIN",
"-DHAVE_IOHIDMANAGER",
"-DHAVE_LOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
@ -393,6 +398,8 @@
"-DHAVE_DYNAMIC",
"-DHAVE_OVERLAY",
"-DHAVE_ZLIB",
"-DHAVE_RPNG",
"-DHAVE_COCOA",
"-DWANT_ZLIB",
"-DSINC_LOWER_QUALITY",
"-DHAVE_NETPLAY",

View File

@ -1,7 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2013-2014 - Jason Fetters
* Copyright (C) 2011-2015 - Daniel De Matteis
* Copyright (C) 2014-2015 - Jay McCarthy
*
*
* 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.
@ -14,9 +14,10 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _CFEXTENSIONS_H
#define _CFEXTENSIONS_H
#ifndef __CFEXTENSIONS_H
#define __CFEXTENSIONS_H
#import <CoreFoundation/CoreFoundation.h>
#include <CoreFoundation/CFArray.h>
typedef enum

View File

@ -18,10 +18,12 @@
#define __RARCH_APPLE_H
#include <Foundation/Foundation.h>
#import <CoreFoundation/CoreFoundation.h>
#include "CFExtensions.h"
#include "../../core_info.h"
#include "../../playlist.h"
#include "../../settings.h"
#include "../../menu/menu.h"
@protocol RetroArch_Platform
- (void)loadingCore:(NSString*)core withFile:(const char*)file;
@ -30,9 +32,194 @@
#ifdef IOS
#include <UIKit/UIKit.h>
#import "../iOS/platform.h"
#include <CoreLocation/CoreLocation.h>
#import <AVFoundation/AVCaptureOutput.h>
@protocol RAMenuItemBase
- (UITableViewCell*)cellForTableView:(UITableView*)tableView;
- (void)wasSelectedOnTableView:(UITableView*)tableView ofController:(UIViewController*)controller;
@end
/*********************************************/
/* RAMenuBase */
/* A menu class that displays RAMenuItemBase */
/* objects. */
/*********************************************/
@interface RAMenuBase : UITableViewController
@property (nonatomic) NSMutableArray* sections;
@property (nonatomic) BOOL hidesHeaders;
- (id)initWithStyle:(UITableViewStyle)style;
- (id)itemForIndexPath:(NSIndexPath*)indexPath;
@end
/*********************************************/
/* RAMenuItemBasic */
/* A simple menu item that displays a text */
/* description and calls a block object when */
/* selected. */
/*********************************************/
@interface RAMenuItemBasic : NSObject<RAMenuItemBase>
@property (nonatomic) NSString* description;
@property (nonatomic) id userdata;
@property (copy) void (^action)(id userdata);
@property (copy) NSString* (^detail)(id userdata);
+ (RAMenuItemBasic*)itemWithDescription:(NSString*)description action:(void (^)())action;
+ (RAMenuItemBasic*)itemWithDescription:(NSString*)description action:(void (^)())action detail:(NSString* (^)())detail;
+ (RAMenuItemBasic*)itemWithDescription:(NSString*)description association:(id)userdata action:(void (^)())action detail:(NSString* (^)())detail;
@end
/*********************************************/
/* RAMenuItemGeneralSetting */
/* A simple menu item that displays the */
/* state, and allows editing, of a string or */
/* numeric setting. */
/*********************************************/
@interface RAMenuItemGeneralSetting : NSObject<RAMenuItemBase>
@property (nonatomic) rarch_setting_t* setting;
@property (copy) void (^action)();
@property (nonatomic, weak) UITableView* parentTable;
+ (id)itemForSetting:(rarch_setting_t*)setting action:(void (^)())action;
- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action;
@end
/*********************************************/
/* RAMenuItemBooleanSetting */
/* A simple menu item that displays the */
/* state, and allows editing, of a boolean */
/* setting. */
/*********************************************/
@interface RAMenuItemBooleanSetting : NSObject<RAMenuItemBase>
@property (nonatomic) rarch_setting_t* setting;
@property (copy) void (^action)();
- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action;
@end
/*********************************************/
/* RAMenuItemPathSetting */
/* A menu item that displays and allows */
/* browsing for a path setting. */
/*********************************************/
@interface RAMenuItemPathSetting : RAMenuItemGeneralSetting<RAMenuItemBase> @end
/*********************************************/
/* RAMenuItemEnumSetting */
/* A menu item that displays and allows */
/* a setting to be set from a list of */
/* allowed choices. */
/*********************************************/
@interface RAMenuItemEnumSetting : RAMenuItemGeneralSetting<RAMenuItemBase> @end
/*********************************************/
/* RAMenuItemBindSetting */
/* A menu item that displays and allows */
/* mapping of a keybinding. */
/*********************************************/
@interface RAMenuItemBindSetting : RAMenuItemGeneralSetting<RAMenuItemBase> @end
/*********************************************/
/* RAMainMenu */
/* Menu object that is displayed immediately */
/* after startup. */
/*********************************************/
@interface RAMainMenu : RAMenuBase
@property (nonatomic) NSString* core;
@end
@interface RADirectoryItem : NSObject<RAMenuItemBase>
@property (nonatomic) NSString* path;
@property (nonatomic) bool isDirectory;
@end
@interface RADirectoryList : RAMenuBase<UIActionSheetDelegate>
@property (nonatomic, weak) RADirectoryItem* selectedItem;
@property (nonatomic, copy) void (^chooseAction)(RADirectoryList* list, RADirectoryItem* item);
@property (nonatomic, copy) NSString* path;
@property (nonatomic, copy) NSString* extensions;
@property (nonatomic) bool allowBlank;
@property (nonatomic) bool forDirectory;
- (id)initWithPath:(NSString*)path extensions:(const char*)extensions action:(void (^)(RADirectoryList* list, RADirectoryItem* item))action;
- (void)browseTo:(NSString*)path;
@end
@interface RAFoldersList : RAMenuBase
- (id) initWithFilePath:(NSString*)path;
@end
typedef struct
{
char orientations[32];
unsigned orientation_flags;
char bluetooth_mode[64];
} apple_frontend_settings_t;
extern apple_frontend_settings_t apple_frontend_settings;
@interface RAGameView : UIViewController<CLLocationManagerDelegate, AVCaptureAudioDataOutputSampleBufferDelegate>
+ (RAGameView*)get;
@end
@interface RetroArch_iOS : UINavigationController<UIApplicationDelegate, UINavigationControllerDelegate, RetroArch_Platform>
@property (nonatomic) UIWindow* window;
@property (nonatomic) NSString* documentsDirectory; // e.g. /var/mobile/Documents
+ (RetroArch_iOS*)get;
- (void)showGameView;
- (void)toggleUI;
- (void)loadingCore:(NSString*)core withFile:(const char*)file;
- (void)unloadingCore;
- (void)refreshSystemConfig;
@end
void get_ios_version(int *major, int *minor);
#elif defined(OSX)
#import "../OSX/platform.h"
#include <AppKit/AppKit.h>
#ifdef HAVE_LOCATION
#include <CoreLocation/CoreLocation.h>
#endif
@interface RAGameView : NSView
#ifdef HAVE_LOCATION
<CLLocationManagerDelegate>
#endif
+ (RAGameView*)get;
#ifndef OSX
- (void)display;
#endif
@end
@interface RetroArch_OSX : NSObject<RetroArch_Platform>
{
NSWindow* _window;
NSWindowController* _settingsWindow;
NSWindow* _coreSelectSheet;
NSString* _file;
NSString* _core;
}
@property (nonatomic, retain) NSWindow IBOutlet* window;
+ (RetroArch_OSX*)get;
- (void)loadingCore:(NSString*)core withFile:(const char*)file;
- (void)unloadingCore;
@end
#endif
extern id<RetroArch_Platform> apple_platform;

View File

@ -19,7 +19,6 @@
#include <CoreFoundation/CFArray.h>
#include <CoreFoundation/CFString.h>
#import <Foundation/NSPathUtilities.h>
#include "CFExtensions.h"
#import "RetroArch_Apple.h"
#include "../../general.h"
#include "../../runloop.h"
@ -172,11 +171,6 @@ void apple_display_alert(const char *message, const char *title)
/* Define compatibility symbols and categories. */
//#if defined(MAC_OS_X_VERSION_10_7) || defined(__IPHONE_4_0)
#if defined(__IPHONE_4_0) && defined(IOS)
#define HAVE_AVFOUNDATION
#endif
#ifdef HAVE_AVFOUNDATION
#include <AVFoundation/AVCaptureSession.h>
#include <AVFoundation/AVCaptureDevice.h>
@ -200,7 +194,7 @@ void *nsview_get_ptr(void)
#endif
/* forward declarations */
void apple_gfx_ctx_update(void);
void cocoagl_gfx_ctx_update(void);
void *glkitview_init(void);
@implementation RAGameView
@ -232,7 +226,7 @@ void *glkitview_init(void);
{
[super setFrame:frameRect];
apple_gfx_ctx_update();
cocoagl_gfx_ctx_update();
}
/* Stop the annoying sound when pressing a key. */
@ -636,7 +630,7 @@ camera_driver_t camera_apple = {
apple_camera_start,
apple_camera_stop,
apple_camera_poll,
"apple",
"avfoundation",
};
#endif

View File

@ -494,6 +494,7 @@
"-DHAVE_NETWORKING",
"-DHAVE_CAMERA",
"-DHAVE_GRIFFIN",
"-DHAVE_CORETEXT",
"-DHAVE_LOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
@ -512,6 +513,8 @@
"-DHAVE_DYNAMIC",
"-DHAVE_OVERLAY",
"-DHAVE_ZLIB",
"-DHAVE_RPNG",
"-DHAVE_COCOATOUCH",
"-DWANT_ZLIB",
"-DSINC_LOWER_QUALITY",
"-DRARCH_INTERNAL",
@ -575,6 +578,8 @@
"-DHAVE_DYNAMIC",
"-DHAVE_OVERLAY",
"-DHAVE_ZLIB",
"-DHAVE_RPNG",
"-DHAVE_COCOATOUCH",
"-DWANT_ZLIB",
"-DSINC_LOWER_QUALITY",
"-DRARCH_INTERNAL",
@ -612,6 +617,8 @@
"-DRARCH_INTERNAL",
"-DHAVE_OVERLAY",
"-DHAVE_ZLIB",
"-DHAVE_RPNG",
"-DHAVE_COCOATOUCH",
"-DWANT_ZLIB",
"-DSINC_LOWER_QUALITY",
"-DHAVE_THREADS",
@ -681,6 +688,8 @@
"-DHAVE_FBO",
"-DHAVE_OVERLAY",
"-DHAVE_ZLIB",
"-DHAVE_RPNG",
"-DHAVE_COCOATOUCH",
"-DWANT_ZLIB",
"-DSINC_LOWER_QUALITY",
);
@ -739,6 +748,8 @@
"-DHAVE_FBO",
"-DHAVE_OVERLAY",
"-DHAVE_ZLIB",
"-DHAVE_RPNG",
"-DHAVE_COCOATOUCH",
"-DWANT_ZLIB",
"-DSINC_LOWER_QUALITY",
);
@ -796,6 +807,8 @@
"-DHAVE_DYNAMIC",
"-DHAVE_OVERLAY",
"-DHAVE_ZLIB",
"-DHAVE_RPNG",
"-DHAVE_COCOATOUCH",
"-DWANT_ZLIB",
"-DSINC_LOWER_QUALITY",
"-DRARCH_INTERNAL",
@ -805,6 +818,7 @@
"-DHAVE_XMB",
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_AVFOUNDATION",
);
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
@ -860,6 +874,8 @@
"-DHAVE_DYNAMIC",
"-DHAVE_OVERLAY",
"-DHAVE_ZLIB",
"-DHAVE_RPNG",
"-DHAVE_COCOATOUCH",
"-DWANT_ZLIB",
"-DSINC_LOWER_QUALITY",
"-DRARCH_INTERNAL",
@ -870,6 +886,7 @@
"-DHAVE_XMB",
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_AVFOUNDATION",
);
"OTHER_CFLAGS[arch=*]" = (
"-DNS_BLOCK_ASSERTIONS=1",
@ -898,6 +915,8 @@
"-DRARCH_INTERNAL",
"-DHAVE_OVERLAY",
"-DHAVE_ZLIB",
"-DHAVE_RPNG",
"-DHAVE_COCOATOUCH",
"-DWANT_ZLIB",
"-DSINC_LOWER_QUALITY",
"-DHAVE_THREADS",
@ -907,6 +926,7 @@
"-DHAVE_XMB",
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_AVFOUNDATION",
);
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";

View File

@ -16,9 +16,7 @@
#include <file/file_extract.h>
#import "../common/RetroArch_Apple.h"
#import "views.h"
#include "../common/RetroArch_Apple.h"
#include "../../content.h"
#include "../../general.h"
#include <file/dir_list.h>

View File

@ -1,118 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2013-2014 - Jason Fetters
* Copyright (C) 2014-2015 - Jay McCarthy
*
* 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 __APPLE_RARCH_IOS_MENU_H__
#define __APPLE_RARCH_IOS_MENU_H__
#include "../../playlist.h"
#include "views.h"
#include "../../settings.h"
@protocol RAMenuItemBase
- (UITableViewCell*)cellForTableView:(UITableView*)tableView;
- (void)wasSelectedOnTableView:(UITableView*)tableView ofController:(UIViewController*)controller;
@end
/*********************************************/
/* RAMenuBase */
/* A menu class that displays RAMenuItemBase */
/* objects. */
/*********************************************/
@interface RAMenuBase : UITableViewController
@property (nonatomic) NSMutableArray* sections;
@property (nonatomic) BOOL hidesHeaders;
- (id)initWithStyle:(UITableViewStyle)style;
- (id)itemForIndexPath:(NSIndexPath*)indexPath;
@end
/*********************************************/
/* RAMenuItemBasic */
/* A simple menu item that displays a text */
/* description and calls a block object when */
/* selected. */
/*********************************************/
@interface RAMenuItemBasic : NSObject<RAMenuItemBase>
@property (nonatomic) NSString* description;
@property (nonatomic) id userdata;
@property (copy) void (^action)(id userdata);
@property (copy) NSString* (^detail)(id userdata);
+ (RAMenuItemBasic*)itemWithDescription:(NSString*)description action:(void (^)())action;
+ (RAMenuItemBasic*)itemWithDescription:(NSString*)description action:(void (^)())action detail:(NSString* (^)())detail;
+ (RAMenuItemBasic*)itemWithDescription:(NSString*)description association:(id)userdata action:(void (^)())action detail:(NSString* (^)())detail;
@end
/*********************************************/
/* RAMenuItemGeneralSetting */
/* A simple menu item that displays the */
/* state, and allows editing, of a string or */
/* numeric setting. */
/*********************************************/
@interface RAMenuItemGeneralSetting : NSObject<RAMenuItemBase>
@property (nonatomic) rarch_setting_t* setting;
@property (copy) void (^action)();
@property (nonatomic, weak) UITableView* parentTable;
+ (id)itemForSetting:(rarch_setting_t*)setting action:(void (^)())action;
- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action;
@end
/*********************************************/
/* RAMenuItemBooleanSetting */
/* A simple menu item that displays the */
/* state, and allows editing, of a boolean */
/* setting. */
/*********************************************/
@interface RAMenuItemBooleanSetting : NSObject<RAMenuItemBase>
@property (nonatomic) rarch_setting_t* setting;
@property (copy) void (^action)();
- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action;
@end
/*********************************************/
/* RAMenuItemPathSetting */
/* A menu item that displays and allows */
/* browsing for a path setting. */
/*********************************************/
@interface RAMenuItemPathSetting : RAMenuItemGeneralSetting<RAMenuItemBase> @end
/*********************************************/
/* RAMenuItemEnumSetting */
/* A menu item that displays and allows */
/* a setting to be set from a list of */
/* allowed choices. */
/*********************************************/
@interface RAMenuItemEnumSetting : RAMenuItemGeneralSetting<RAMenuItemBase> @end
/*********************************************/
/* RAMenuItemBindSetting */
/* A menu item that displays and allows */
/* mapping of a keybinding. */
/*********************************************/
@interface RAMenuItemBindSetting : RAMenuItemGeneralSetting<RAMenuItemBase> @end
/*********************************************/
/* RAMainMenu */
/* Menu object that is displayed immediately */
/* after startup. */
/*********************************************/
@interface RAMainMenu : RAMenuBase
@property (nonatomic) NSString* core;
@end
#endif

View File

@ -17,14 +17,12 @@
#include "../common/RetroArch_Apple.h"
#include "../../input/input_common.h"
#include "../../input/input_keymaps.h"
#include "../../input/drivers/apple_input.h"
#include "../../input/drivers/cocoa_input.h"
#include <file/file_path.h>
#include <retro_miscellaneous.h>
#include "menu.h"
#include <objc/runtime.h>
#include "../../menu/menu.h"
#include "../../menu/menu_entries.h"
#include "../../menu/drivers/shared.h"
@ -543,7 +541,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
[self.bindTimer invalidate];
self.bindTimer = nil;
apple_input_reset_icade_buttons();
cocoa_input_reset_icade_buttons();
}
- (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
@ -566,11 +564,11 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
if (self.setting->index)
idx = self.setting->index - 1;
if ((value = apple_input_find_any_key()))
if ((value = cocoa_input_find_any_key()))
BINDFOR(*self.setting).key = input_keymaps_translate_keysym_to_rk(value);
else if ((value = apple_input_find_any_button(idx)) >= 0)
else if ((value = cocoa_input_find_any_button(idx)) >= 0)
BINDFOR(*self.setting).joykey = value;
else if ((value = apple_input_find_any_axis(idx)))
else if ((value = cocoa_input_find_any_axis(idx)))
BINDFOR(*self.setting).joyaxis = (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(abs(value) - 1);
else
return;

View File

@ -1,54 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2013-2014 - Jason Fetters
* Copyright (C) 2011-2015 - 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 __RARCH_IOS_PLATFORM_H
#define __RARCH_IOS_PLATFORM_H
#include <CoreLocation/CoreLocation.h>
#import <AVFoundation/AVCaptureOutput.h>
#include "views.h"
typedef struct
{
char orientations[32];
unsigned orientation_flags;
char bluetooth_mode[64];
} apple_frontend_settings_t;
extern apple_frontend_settings_t apple_frontend_settings;
@interface RAGameView : UIViewController<CLLocationManagerDelegate, AVCaptureAudioDataOutputSampleBufferDelegate>
+ (RAGameView*)get;
@end
@interface RetroArch_iOS : UINavigationController<UIApplicationDelegate, UINavigationControllerDelegate, RetroArch_Platform>
@property (nonatomic) UIWindow* window;
@property (nonatomic) NSString* documentsDirectory; // e.g. /var/mobile/Documents
+ (RetroArch_iOS*)get;
- (void)showGameView;
- (void)toggleUI;
- (void)loadingCore:(NSString*)core withFile:(const char*)file;
- (void)unloadingCore;
- (void)refreshSystemConfig;
@end
void get_ios_version(int *major, int *minor);
#endif

View File

@ -17,15 +17,12 @@
#include <string.h>
#include "../common/RetroArch_Apple.h"
#include "../../input/drivers/apple_input.h"
#include "../../input/drivers/cocoa_input.h"
#include "../../settings.h"
#ifdef HAVE_MFI
#include "../../input/drivers_hid/mfi_hid.h"
#endif
#include "menu.h"
#include "../../menu/menu.h"
#import "views.h"
#include "../../input/drivers_hid/btstack_hid.h"
id<RetroArch_Platform> apple_platform;
@ -55,9 +52,6 @@ static void rarch_draw(CFRunLoopObserverRef observer, CFRunLoopActivity activity
if (runloop->is_idle)
return;
if (g_view)
[g_view display];
CFRunLoopWakeUp(CFRunLoopGetMain());
}
@ -68,6 +62,41 @@ void apple_rarch_exited(void)
apple_frontend_settings_t apple_frontend_settings;
enum frontend_powerstate ios_get_powerstate(int *seconds, int *percent)
{
float level;
enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE;
UIDevice *uidev = [UIDevice currentDevice];
if (!uidev)
return ret;
[uidev setBatteryMonitoringEnabled:true];
switch (uidev.batteryState)
{
case UIDeviceBatteryStateCharging:
ret = FRONTEND_POWERSTATE_CHARGING;
break;
case UIDeviceBatteryStateFull:
ret = FRONTEND_POWERSTATE_CHARGED;
break;
case UIDeviceBatteryStateUnplugged:
ret = FRONTEND_POWERSTATE_ON_POWER_SOURCE;
break;
case UIDeviceBatteryStateUnknown:
break;
}
level = uidev.batteryLevel;
*percent = ((level < 0.0f) ? -1 : ((int)((level * 100) + 0.5f)));
[uidev setBatteryMonitoringEnabled:false];
return ret;
}
void get_ios_version(int *major, int *minor)
{
NSArray *decomposed_os_version = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
@ -78,15 +107,15 @@ void get_ios_version(int *major, int *minor)
*minor = [decomposed_os_version[1] integerValue];
}
extern float apple_gfx_ctx_get_native_scale(void);
extern float cocoagl_gfx_ctx_get_native_scale(void);
/* Input helpers: This is kept here because it needs ObjC */
static void handle_touch_event(NSArray* touches)
{
unsigned i;
driver_t *driver = driver_get_ptr();
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
float scale = apple_gfx_ctx_get_native_scale();
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
float scale = cocoagl_gfx_ctx_get_native_scale();
if (!apple)
return;
@ -177,17 +206,17 @@ enum
unsigned i;
character = [ch characterAtIndex:0];
apple_input_keyboard_event(event._isKeyDown,
cocoa_input_keyboard_event(event._isKeyDown,
(uint32_t)event._keyCode, 0, mod,
RETRO_DEVICE_KEYBOARD);
for (i = 1; i < ch.length; i++)
apple_input_keyboard_event(event._isKeyDown,
cocoa_input_keyboard_event(event._isKeyDown,
0, [ch characterAtIndex:i], mod,
RETRO_DEVICE_KEYBOARD);
}
apple_input_keyboard_event(event._isKeyDown,
cocoa_input_keyboard_event(event._isKeyDown,
(uint32_t)event._keyCode, character, mod,
RETRO_DEVICE_KEYBOARD);
}
@ -222,7 +251,7 @@ enum
{
case GSEVENT_TYPE_KEYDOWN:
case GSEVENT_TYPE_KEYUP:
apple_input_keyboard_event(eventType == GSEVENT_TYPE_KEYDOWN,
cocoa_input_keyboard_event(eventType == GSEVENT_TYPE_KEYDOWN,
*(uint16_t*)&eventMem[0x3C], 0, 0, RETRO_DEVICE_KEYBOARD);
break;
}
@ -329,10 +358,9 @@ enum
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
apple_input_reset_icade_buttons();
cocoa_input_reset_icade_buttons();
[self setToolbarHidden:![[viewController toolbarItems] count] animated:YES];
// Workaround to keep frontend settings fresh
[self refreshSystemConfig];
}
@ -354,10 +382,13 @@ enum
- (IBAction)showPauseMenu:(id)sender
{
runloop_t *runloop = rarch_main_get_ptr();
runloop->is_paused = true;
runloop->is_idle = true;
runloop->ui_companion_is_on_foreground = true;
if (runloop)
{
runloop->is_paused = true;
runloop->is_idle = true;
runloop->ui_companion_is_on_foreground = true;
}
[[UIApplication sharedApplication] setStatusBarHidden:false withAnimation:UIStatusBarAnimationNone];
[[UIApplication sharedApplication] setIdleTimerDisabled:false];
@ -409,8 +440,8 @@ enum
is_icade = !(strcmp(apple_frontend_settings.bluetooth_mode, "icade"));
is_btstack = !(strcmp(apple_frontend_settings.bluetooth_mode, "btstack"));
apple_input_enable_small_keyboard(small_keyboard);
apple_input_enable_icade(is_icade);
cocoa_input_enable_small_keyboard(small_keyboard);
cocoa_input_enable_icade(is_icade);
btstack_set_poweron(is_btstack);
}

View File

@ -1,51 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2013-2014 - Jason Fetters
* Copyright (C) 2011-2015 - 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 _RARCH_APPLE_VIEWS_H
#define _RARCH_APPLE_VIEWS_H
#include <UIKit/UIKit.h>
#include "../../core_info.h"
#include "menu.h"
// browser.m
@interface RADirectoryItem : NSObject<RAMenuItemBase>
@property (nonatomic) NSString* path;
@property (nonatomic) bool isDirectory;
@end
@interface RADirectoryList : RAMenuBase<UIActionSheetDelegate>
@property (nonatomic, weak) RADirectoryItem* selectedItem;
@property (nonatomic, copy) void (^chooseAction)(RADirectoryList* list, RADirectoryItem* item);
@property (nonatomic, copy) NSString* path;
@property (nonatomic, copy) NSString* extensions;
@property (nonatomic) bool allowBlank;
@property (nonatomic) bool forDirectory;
- (id)initWithPath:(NSString*)path extensions:(const char*)extensions action:(void (^)(RADirectoryList* list, RADirectoryItem* item))action;
- (void)browseTo:(NSString*)path;
@end
// browser.m
@interface RAFoldersList : RAMenuBase
- (id) initWithFilePath:(NSString*)path;
@end
#endif

View File

@ -19,7 +19,7 @@
#include <queues/fifo_buffer.h>
#include <stdlib.h>
#include <boolean.h>
#include <rthreads/rthreads.h>
#include <pthread.h>
#ifdef OSX
#include <CoreAudio/CoreAudio.h>
@ -33,8 +33,8 @@
typedef struct coreaudio
{
slock_t *lock;
scond_t *cond;
pthread_mutex_t lock;
pthread_cond_t cond;
#ifdef OSX_PPC
ComponentInstance dev;
@ -71,8 +71,8 @@ static void coreaudio_free(void *data)
if (dev->buffer)
fifo_free(dev->buffer);
slock_free(dev->lock);
scond_free(dev->cond);
pthread_mutex_destroy(&dev->lock);
pthread_cond_destroy(&dev->cond);
free(dev);
}
@ -82,8 +82,8 @@ static OSStatus audio_write_cb(void *userdata,
const AudioTimeStamp *time_stamp, UInt32 bus_number,
UInt32 number_frames, AudioBufferList *io_data)
{
void *outbuf;
unsigned write_avail;
void *outbuf = NULL;
coreaudio_t *dev = (coreaudio_t*)userdata;
(void)time_stamp;
@ -96,9 +96,9 @@ static OSStatus audio_write_cb(void *userdata,
return noErr;
write_avail = io_data->mBuffers[0].mDataByteSize;
outbuf = io_data->mBuffers[0].mData;
outbuf = io_data->mBuffers[0].mData;
slock_lock(dev->lock);
pthread_mutex_lock(&dev->lock);
if (fifo_read_avail(dev->buffer) < write_avail)
{
@ -107,15 +107,16 @@ static OSStatus audio_write_cb(void *userdata,
/* Seems to be needed. */
memset(outbuf, 0, write_avail);
goto end;
pthread_mutex_unlock(&dev->lock);
/* Technically possible to deadlock without. */
pthread_cond_signal(&dev->cond);
return noErr;
}
fifo_read(dev->buffer, outbuf, write_avail);
end:
slock_unlock(dev->lock);
scond_signal(dev->cond);
pthread_mutex_unlock(&dev->lock);
pthread_cond_signal(&dev->cond);
return noErr;
}
@ -123,8 +124,7 @@ end:
static void choose_output_device(coreaudio_t *dev, const char* device)
{
unsigned i;
UInt32 size = 0, deviceCount;
AudioDeviceID *devices = NULL;
AudioDeviceID *devices;
AudioObjectPropertyAddress propaddr =
{
kAudioHardwarePropertyDevices,
@ -132,23 +132,22 @@ static void choose_output_device(coreaudio_t *dev, const char* device)
kAudioObjectPropertyElementMaster
};
UInt32 size = 0, deviceCount;
if (AudioObjectGetPropertyDataSize(kAudioObjectSystemObject,
&propaddr, 0, 0, &size) != noErr)
return;
deviceCount = size / sizeof(AudioDeviceID);
devices = (AudioDeviceID*)malloc(size);
deviceCount = size / sizeof(AudioDeviceID);
devices = (AudioDeviceID*)malloc(size);
if (!devices)
goto done;
if (AudioObjectGetPropertyData(kAudioObjectSystemObject,
if (!devices || AudioObjectGetPropertyData(kAudioObjectSystemObject,
&propaddr, 0, 0, &size, devices) != noErr)
goto done;
propaddr.mScope = kAudioDevicePropertyScopeOutput;
propaddr.mScope = kAudioDevicePropertyScopeOutput;
propaddr.mSelector = kAudioDevicePropertyDeviceName;
size = 1024;
size = 1024;
for (i = 0; i < deviceCount; i ++)
{
@ -196,12 +195,12 @@ static void *coreaudio_init(const char *device,
AudioStreamBasicDescription stream_desc = {0};
static bool session_initialized = false;
coreaudio_t *dev = NULL;
settings_t *settings = config_get_ptr();
#ifdef OSX_PPC
ComponentDescription desc = {0};
#else
AudioComponentDescription desc = {0};
#endif
settings_t *settings = config_get_ptr();
(void)session_initialized;
(void)device;
@ -210,22 +209,8 @@ static void *coreaudio_init(const char *device,
if (!dev)
return NULL;
dev->lock = slock_new();
if (!dev->lock)
{
free(dev);
return NULL;
}
dev->cond = scond_new();
if (!dev->cond)
{
free(dev->lock);
free(dev);
return NULL;
}
pthread_mutex_init(&dev->lock, NULL);
pthread_cond_init(&dev->cond, NULL);
#ifdef IOS
if (!session_initialized)
@ -284,8 +269,7 @@ static void *coreaudio_init(const char *device,
goto error;
/* Check returned audio format. */
i_size = sizeof(real_desc);
i_size = sizeof(real_desc);
if (AudioUnitGetProperty(dev->dev, kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input, 0, &real_desc, &i_size) != noErr)
goto error;
@ -351,40 +335,46 @@ static ssize_t coreaudio_write(void *data, const void *buf_, size_t size)
size_t written = 0;
#ifdef IOS
struct timespec timeout;
struct timeval time;
gettimeofday(&time, 0);
memset(&timeout, 0, sizeof(timeout));
timeout.tv_sec = time.tv_sec + 3;
timeout.tv_nsec = time.tv_usec * 1000;
#endif
while (!g_interrupted && size > 0)
{
size_t write_avail;
slock_lock(dev->lock);
pthread_mutex_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;
buf += write_avail;
written += write_avail;
size -= write_avail;
size -= write_avail;
if (dev->nonblock)
{
slock_unlock(dev->lock);
pthread_mutex_unlock(&dev->lock);
break;
}
#ifdef IOS
if (write_avail == 0 && !scond_wait_timeout(
dev->cond, dev->lock, time.tv_usec))
if (write_avail == 0 && pthread_cond_timedwait(
&dev->cond, &dev->lock, &timeout) == ETIMEDOUT)
g_interrupted = true;
#else
if (write_avail == 0)
scond_wait(dev->cond, dev->lock);
pthread_cond_wait(&dev->cond, &dev->lock);
#endif
slock_unlock(dev->lock);
pthread_mutex_unlock(&dev->lock);
}
return written;
@ -434,9 +424,9 @@ static size_t coreaudio_write_avail(void *data)
size_t avail;
coreaudio_t *dev = (coreaudio_t*)data;
slock_lock(dev->lock);
pthread_mutex_lock(&dev->lock);
avail = fifo_write_avail(dev->buffer);
slock_unlock(dev->lock);
pthread_mutex_unlock(&dev->lock);
return avail;
}

View File

@ -21,20 +21,24 @@
typedef struct
{
bool nonblocking;
bool playing;
int16_t* l;
int16_t* r;
int16_t* silence;
uint32_t l_paddr;
uint32_t r_paddr;
uint32_t silence_paddr;
uint32_t pos;
uint32_t playpos;
uint32_t cpu_ticks_per_sample;
uint64_t cpu_ticks_last;
int rate;
} ctr_audio_t;
#define CTR_AUDIO_COUNT (1u << 12u)
#define CTR_AUDIO_COUNT (1u << 11u)
#define CTR_AUDIO_COUNT_MASK (CTR_AUDIO_COUNT - 1u)
#define CTR_AUDIO_SIZE (CTR_AUDIO_COUNT * sizeof(int16_t))
#define CTR_AUDIO_SIZE_MASK (CTR_AUDIO_SIZE - 1u)
@ -52,31 +56,30 @@ static void *ctr_audio_init(const char *device, unsigned rate, unsigned latency)
ctr_audio_t *ctr = (ctr_audio_t*)calloc(1, sizeof(ctr_audio_t));
ctr->l = linearAlloc(CTR_AUDIO_SIZE);
ctr->r = linearAlloc(CTR_AUDIO_SIZE);
ctr->silence = linearAlloc(CTR_AUDIO_SIZE);
ctr->l = linearAlloc(CTR_AUDIO_SIZE);
ctr->r = linearAlloc(CTR_AUDIO_SIZE);
memset(ctr->l, 0, CTR_AUDIO_SIZE);
memset(ctr->r, 0, CTR_AUDIO_SIZE);
memset(ctr->silence, 0, CTR_AUDIO_SIZE);
memset(ctr->l, 0, CTR_AUDIO_SIZE);
memset(ctr->r, 0, CTR_AUDIO_SIZE);
ctr->l_paddr = osConvertVirtToPhys((u32)ctr->l);
ctr->r_paddr = osConvertVirtToPhys((u32)ctr->r);
ctr->silence_paddr = osConvertVirtToPhys((u32)ctr->silence);
ctr->l_paddr = osConvertVirtToPhys((u32)ctr->l);
ctr->r_paddr = osConvertVirtToPhys((u32)ctr->r);
ctr->pos = 0;
ctr->rate = rate;
ctr->cpu_ticks_per_sample = CSND_TIMER(rate) * 4;
GSPGPU_FlushDataCache(NULL, (u8*)ctr->silence, CTR_AUDIO_SIZE);
GSPGPU_FlushDataCache(NULL, (u8*)ctr->l_paddr, CTR_AUDIO_SIZE);
GSPGPU_FlushDataCache(NULL, (u8*)ctr->r_paddr, CTR_AUDIO_SIZE);
csndPlaySound(0x8, SOUND_LOOPMODE(CSND_LOOPMODE_NORMAL)| SOUND_FORMAT(CSND_ENCODING_PCM16),
rate, ctr->silence, ctr->silence, CTR_AUDIO_SIZE);
rate, 1.0, -1.0, ctr->l, ctr->l, CTR_AUDIO_SIZE);
csndPlaySound(0x9, SOUND_LOOPMODE(CSND_LOOPMODE_NORMAL)| SOUND_FORMAT(CSND_ENCODING_PCM16),
rate, ctr->silence, ctr->silence, CTR_AUDIO_SIZE);
rate, 1.0, 1.0, ctr->r, ctr->r, CTR_AUDIO_SIZE);
CSND_SetVol(0x8, 0xFFFF, 0);
CSND_SetVol(0x9, 0, 0xFFFF);
csndExecCmds(false);
ctr->playpos = 0;
ctr->cpu_ticks_last = svcGetSystemTick();
ctr->playing = true;
return ctr;
}
@ -92,7 +95,6 @@ static void ctr_audio_free(void *data)
linearFree(ctr->l);
linearFree(ctr->r);
linearFree(ctr->silence);
free(ctr);
}
@ -107,45 +109,35 @@ static ssize_t ctr_audio_write(void *data, const void *buf, size_t size)
int i;
const uint16_t* src = buf;
RARCH_PERFORMANCE_INIT(ctraudio_f);
RARCH_PERFORMANCE_INIT(ctraudio_f);
RARCH_PERFORMANCE_START(ctraudio_f);
CSND_ChnInfo channel_info;
csndGetState(0x8, &channel_info);
uint64_t current_tick = svcGetSystemTick();
uint32_t samples_played = (current_tick - ctr->cpu_ticks_last) / ctr->cpu_ticks_per_sample;
ctr->playpos = (ctr->playpos + samples_played) & CTR_AUDIO_COUNT_MASK;
ctr->cpu_ticks_last += samples_played * ctr->cpu_ticks_per_sample;
uint32_t playpos;
if((channel_info.samplePAddr >= (ctr->l_paddr)) &&
(channel_info.samplePAddr < (ctr->l_paddr + CTR_AUDIO_SIZE)))
{
playpos = (channel_info.samplePAddr - ctr->l_paddr) / sizeof(uint16_t);
}
else
{
CSND_SetBlock(0x8, 1, ctr->l_paddr, CTR_AUDIO_SIZE);
CSND_SetBlock(0x9, 1, ctr->r_paddr, CTR_AUDIO_SIZE);
csndExecCmds(false);
playpos = 0;
}
if((((playpos - ctr->pos) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 2)) ||
(((ctr->pos - playpos ) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 4)) ||
(((playpos - ctr->pos) & CTR_AUDIO_COUNT_MASK) < (size >> 2)))
if((((ctr->playpos - ctr->pos) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 2)) ||
(((ctr->pos - ctr->playpos ) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 4)) ||
(((ctr->playpos - ctr->pos) & CTR_AUDIO_COUNT_MASK) < (size >> 2)))
{
if (ctr->nonblocking)
ctr->pos = (playpos + (CTR_AUDIO_COUNT >> 1)) & CTR_AUDIO_COUNT_MASK;
ctr->pos = (ctr->playpos + (CTR_AUDIO_COUNT >> 1)) & CTR_AUDIO_COUNT_MASK;
else
{
do{
svcSleepThread(100000);
// svcSleepThread(((s64)(CTR_AUDIO_COUNT >> 8) * 1000000000) / ctr->rate);
csndGetState(0x8, &channel_info);
playpos = (channel_info.samplePAddr - ctr->l_paddr) / sizeof(uint16_t);
}while (((playpos - ctr->pos) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 1)
|| (((ctr->pos - playpos) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 4)));
/* todo: compute the correct sleep period */
rarch_sleep(1);
current_tick = svcGetSystemTick();
samples_played = (current_tick - ctr->cpu_ticks_last) / ctr->cpu_ticks_per_sample;
ctr->playpos = (ctr->playpos + samples_played) & CTR_AUDIO_COUNT_MASK;
ctr->cpu_ticks_last += samples_played * ctr->cpu_ticks_per_sample;
}while (((ctr->playpos - ctr->pos) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 1)
|| (((ctr->pos - ctr->playpos) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 4)));
}
}
for (i = 0; i < (size >> 1); i += 2)
{
ctr->l[ctr->pos] = src[i];
@ -153,6 +145,9 @@ static ssize_t ctr_audio_write(void *data, const void *buf, size_t size)
ctr->pos++;
ctr->pos &= CTR_AUDIO_COUNT_MASK;
}
GSPGPU_FlushDataCache(NULL, (u8*)ctr->l, CTR_AUDIO_SIZE);
GSPGPU_FlushDataCache(NULL, (u8*)ctr->r, CTR_AUDIO_SIZE);
RARCH_PERFORMANCE_STOP(ctraudio_f);
@ -163,31 +158,51 @@ static bool ctr_audio_stop(void *data)
{
ctr_audio_t* ctr = (ctr_audio_t*)data;
CSND_SetBlock(0x8, 1, ctr->silence_paddr, CTR_AUDIO_SIZE);
CSND_SetBlock(0x9, 1, ctr->silence_paddr, CTR_AUDIO_SIZE);
/* using SetPlayState would make tracking the playback
* position more difficult */
// CSND_SetPlayState(0x8, 0);
// CSND_SetPlayState(0x9, 0);
/* setting the channel volume to 0 seems to make it
* impossible to set it back to full volume later */
CSND_SetVol(0x8, 0x00000001, 0);
CSND_SetVol(0x9, 0x00010000, 0);
csndExecCmds(false);
ctr->playing = false;
return true;
}
static bool ctr_audio_alive(void *data)
{
(void)data;
return true;
ctr_audio_t* ctr = (ctr_audio_t*)data;
return ctr->playing;
}
static bool ctr_audio_start(void *data)
{
ctr_audio_t* ctr = (ctr_audio_t*)data;
global_t *global = global_get_ptr();
// csndPlaySound(0x8, SOUND_LOOPMODE(CSND_LOOPMODE_NORMAL)| SOUND_FORMAT(CSND_ENCODING_PCM16),
// ctr->rate, ctr->l_paddr + ((ctr->pos + (CTR_AUDIO_SIZE / 2)) & CTR_AUDIO_SIZE_MASK),
// (u32*)ctr->silence_paddr, CTR_AUDIO_SIZE);
/* prevents restarting audio when the menu
* is toggled off on shutdown */
if (global->system.shutdown)
return true;
// CSND_SetPlayState(0x8, 1);
// CSND_SetPlayState(0x9, 1);
CSND_SetVol(0x8, 0x00008000, 0);
CSND_SetVol(0x9, 0x80000000, 0);
CSND_SetBlock(0x8, 1, ctr->l_paddr, CTR_AUDIO_SIZE);
CSND_SetBlock(0x9, 1, ctr->r_paddr, CTR_AUDIO_SIZE);
csndExecCmds(false);
ctr->playing = true;
return true;
}

View File

@ -31,7 +31,7 @@ static const camera_driver_t *camera_drivers[] = {
#ifdef ANDROID
&camera_android,
#endif
#if defined(__IPHONE_4_0) && defined(IOS)
#ifdef HAVE_AVFOUNDATION
&camera_apple,
#endif
&camera_null,

View File

@ -622,12 +622,13 @@ static void event_set_savestate_auto_index(void)
static bool event_init_content(void)
{
driver_t *driver = driver_get_ptr();
global_t *global = global_get_ptr();
/* No content to be loaded for dummy core,
* just successfully exit. */
if (global->libretro_dummy)
return true;
goto end;
if (!global->libretro_no_content)
rarch_fill_pathnames();
@ -647,22 +648,30 @@ static bool event_init_content(void)
event_command(EVENT_CMD_BSV_MOVIE_INIT);
event_command(EVENT_CMD_NETPLAY_INIT);
end:
retro_init_libretro_cbs(&driver->retro_ctx);
rarch_init_system_av_info();
return true;
}
static bool event_init_core(void)
{
driver_t *driver = driver_get_ptr();
global_t *global = global_get_ptr();
if (config_load_override())
global->overrides_active = true;
else
global->overrides_active = false;
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
if(settings->auto_overrides_enable)
{
if (config_load_override())
global->overrides_active = true;
else
global->overrides_active = false;
}
pretro_set_environment(rarch_environment_cb);
config_load_remap();
if(settings->auto_remaps_enable)
config_load_remap();
rarch_verify_api_version();
pretro_init();
@ -673,9 +682,6 @@ static bool event_init_core(void)
if (!event_init_content())
return false;
retro_init_libretro_cbs(&driver->retro_ctx);
rarch_init_system_av_info();
return true;
}
@ -724,6 +730,7 @@ static bool event_save_core_config(void)
config_path[PATH_MAX_LENGTH], msg[PATH_MAX_LENGTH];
bool ret = false;
bool found_path = false;
bool overrides_active = false;
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
@ -785,6 +792,13 @@ static bool event_save_core_config(void)
sizeof(config_path));
}
/* Overrides block config file saving, make it appear as overrides weren't enabled for a manual save */
if (global->overrides_active)
{
global->overrides_active = false;
overrides_active = true;
}
if ((ret = config_save_file(config_path)))
{
strlcpy(global->config_path, config_path,
@ -801,7 +815,7 @@ static bool event_save_core_config(void)
}
rarch_main_msg_queue_push(msg, 1, 180, true);
global->overrides_active = overrides_active;
return ret;
}

View File

@ -88,7 +88,7 @@ enum
INPUT_XINPUT,
INPUT_UDEV,
INPUT_LINUXRAW,
INPUT_APPLE,
INPUT_COCOA,
INPUT_QNX,
INPUT_RWEBINPUT,
INPUT_NULL,
@ -111,7 +111,7 @@ enum
CAMERA_V4L2,
CAMERA_RWEBCAM,
CAMERA_ANDROID,
CAMERA_APPLE,
CAMERA_AVFOUNDATION,
CAMERA_NULL,
LOCATION_ANDROID,
@ -126,6 +126,9 @@ enum
MENU_RMENU_XUI,
MENU_GLUI,
MENU_XMB,
RECORD_FFMPEG,
RECORD_NULL,
};
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) || defined(__CELLOS_LV2__)
@ -210,6 +213,12 @@ enum
#define AUDIO_DEFAULT_RESAMPLER_DRIVER AUDIO_RESAMPLER_SINC
#endif
#if defined(HAVE_FFMPEG)
#define RECORD_DEFAULT_DRIVER RECORD_FFMPEG
#else
#define RECORD_DEFAULT_DRIVER RECORD_NULL
#endif
#if defined(XENON)
#define INPUT_DEFAULT_DRIVER INPUT_XENON360
#elif defined(_XBOX360) || defined(_XBOX) || defined(HAVE_XINPUT2) || defined(HAVE_XINPUT_XBOX1)
@ -236,8 +245,8 @@ enum
#define INPUT_DEFAULT_DRIVER INPUT_X
#elif defined(HAVE_WAYLAND)
#define INPUT_DEFAULT_DRIVER INPUT_WAYLAND
#elif defined(IOS) || defined(OSX)
#define INPUT_DEFAULT_DRIVER INPUT_APPLE
#elif defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
#define INPUT_DEFAULT_DRIVER INPUT_COCOA
#elif defined(__QNX__)
#define INPUT_DEFAULT_DRIVER INPUT_QNX
#elif defined(HAVE_SDL)
@ -284,8 +293,8 @@ enum
#define CAMERA_DEFAULT_DRIVER CAMERA_RWEBCAM
#elif defined(ANDROID)
#define CAMERA_DEFAULT_DRIVER CAMERA_ANDROID
#elif defined(MAC_OS_X_VERSION_10_7) || defined(__IPHONE_4_0)
#define CAMERA_DEFAULT_DRIVER CAMERA_APPLE
#elif defined(HAVE_AVFOUNDATION)
#define CAMERA_DEFAULT_DRIVER CAMERA_AVFOUNDATION
#else
#define CAMERA_DEFAULT_DRIVER CAMERA_NULL
#endif
@ -407,7 +416,11 @@ static unsigned swap_interval = 1;
*/
static const bool video_threaded = false;
#ifdef HAVE_THREADS
static const bool threaded_data_runloop_enable = true;
#else
static const bool threaded_data_runloop_enable = false;
#endif
/* Set to true if HW render cores should get their private context. */
static const bool video_shared_context = false;
@ -478,6 +491,9 @@ static bool default_core_specific_config = true;
static bool default_core_specific_config = false;
#endif
static bool default_auto_overrides_enable = false;
static bool default_auto_remaps_enable = false;
/* Crop overscanned frames. */
static const bool crop_overscan = true;

View File

@ -8,6 +8,36 @@
#include "config.h"
#endif
#ifdef HAVE_OVERLAY
static const bool _overlay_supp = true;
#else
static const bool _overlay_supp = false;
#endif
#ifdef HAVE_V4L2
static const bool _v4l2_supp = true;
#else
static const bool _v4l2_supp = false;
#endif
#ifdef HAVE_COMMAND
static const bool _command_supp = true;
#else
static const bool _command_supp = false;
#endif
#ifdef HAVE_NETWORK_CMD
static const bool _network_command_supp = true;
#else
static const bool _network_command_supp = false;
#endif
#ifdef HAVE_LIBUSB
static const bool _libusb_supp = true;
#else
static const bool _libusb_supp = false;
#endif
#ifdef HAVE_SDL
static const bool _sdl_supp = true;
#else
@ -32,6 +62,12 @@ static const bool _opengl_supp = true;
static const bool _opengl_supp = false;
#endif
#if defined(HAVE_OPENGLES) || defined(HAVE_OPENGLES2) || defined(HAVE_OPENGLES3)
static const bool _opengles_supp = true;
#else
static const bool _opengles_supp = false;
#endif
#ifdef HAVE_KMS
static const bool _kms_supp = true;
#else
@ -80,6 +116,12 @@ static const bool _alsa_supp = true;
static const bool _alsa_supp = false;
#endif
#ifdef HAVE_COREAUDIO
static const bool _coreaudio_supp = true;
#else
static const bool _coreaudio_supp = false;
#endif
#if defined(HAVE_OSS) || defined(HAVE_OSS_BSD)
static const bool _oss_supp = true;
#else
@ -92,6 +134,18 @@ static const bool _al_supp = true;
static const bool _al_supp = false;
#endif
#ifdef HAVE_SL
static const bool _sl_supp = true;
#else
static const bool _sl_supp = false;
#endif
#ifdef HAVE_LIBRETRODB
static const bool _libretrodb_supp = true;
#else
static const bool _libretrodb_supp = false;
#endif
#ifdef HAVE_RSOUND
static const bool _rsound_supp = true;
#else
@ -134,6 +188,12 @@ static const bool _zlib_supp = true;
static const bool _zlib_supp = false;
#endif
#ifdef HAVE_7ZIP
static const bool _7zip_supp = true;
#else
static const bool _7zip_supp = false;
#endif
#ifdef HAVE_DYLIB
static const bool _dylib_supp = true;
#else
@ -146,6 +206,18 @@ static const bool _cg_supp = true;
static const bool _cg_supp = false;
#endif
#ifdef HAVE_GLSL
static const bool _glsl_supp = true;
#else
static const bool _glsl_supp = false;
#endif
#ifdef HAVE_HLSL
static const bool _hlsl_supp = true;
#else
static const bool _hlsl_supp = false;
#endif
#ifdef HAVE_LIBXML2
static const bool _libxml2_supp = true;
#else
@ -194,6 +266,36 @@ static const bool _python_supp = true;
static const bool _python_supp = false;
#endif
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
static const bool _cocoa_supp = true;
#else
static const bool _cocoa_supp = false;
#endif
#ifdef HAVE_QT
static const bool _qt_supp = true;
#else
static const bool _qt_supp = false;
#endif
#ifdef HAVE_RPNG
static const bool _rpng_supp = true;
#else
static const bool _rpng_supp = false;
#endif
#ifdef HAVE_CORETEXT
static const bool _coretext_supp = true;
#else
static const bool _coretext_supp = false;
#endif
#ifdef HAVE_AVFOUNDATION
static const bool _avfoundation_supp = true;
#else
static const bool _avfoundation_supp = false;
#endif
#if !defined(_WIN32) && !defined(GLOBAL_CONFIG_DIR)
#if defined(__HAIKU__)
#define GLOBAL_CONFIG_DIR "/system/settings"

View File

@ -124,6 +124,19 @@ const char *config_get_default_audio(void)
return "null";
}
const char *config_get_default_record(void)
{
switch (RECORD_DEFAULT_DRIVER)
{
case RECORD_FFMPEG:
return "ffmpeg";
default:
break;
}
return "null";
}
/**
* config_get_default_audio_resampler:
*
@ -238,8 +251,8 @@ const char *config_get_default_input(void)
return "linuxraw";
case INPUT_UDEV:
return "udev";
case INPUT_APPLE:
return "apple_input";
case INPUT_COCOA:
return "cocoa";
case INPUT_QNX:
return "qnx_input";
case INPUT_RWEBINPUT:
@ -346,8 +359,8 @@ const char *config_get_default_camera(void)
return "rwebcam";
case CAMERA_ANDROID:
return "android";
case CAMERA_APPLE:
return "apple";
case CAMERA_AVFOUNDATION:
return "avfoundation";
default:
break;
}
@ -397,6 +410,7 @@ static void config_set_defaults(void)
#endif
const char *def_camera = config_get_default_camera();
const char *def_location = config_get_default_location();
const char *def_record = config_get_default_record();
if (def_camera)
strlcpy(settings->camera.driver,
@ -419,6 +433,9 @@ static void config_set_defaults(void)
if (def_joypad)
strlcpy(settings->input.joypad_driver,
def_joypad, sizeof(settings->input.joypad_driver));
if (def_record)
strlcpy(settings->record.driver,
def_record, sizeof(settings->record.driver));
#ifdef HAVE_MENU
if (def_menu)
strlcpy(settings->menu.driver,
@ -633,8 +650,8 @@ static void config_set_defaults(void)
if (!global->has_set_ips_pref)
global->ips_pref = false;
*global->recording.output_dir = '\0';
*global->recording.config_dir = '\0';
*global->record.output_dir = '\0';
*global->record.config_dir = '\0';
*settings->core_options_path = '\0';
*settings->content_history_path = '\0';
@ -664,6 +681,8 @@ static void config_set_defaults(void)
*settings->menu_config_directory = '\0';
#endif
settings->core_specific_config = default_core_specific_config;
settings->auto_overrides_enable = default_auto_overrides_enable;
settings->auto_remaps_enable = default_auto_remaps_enable;
settings->user_language = 0;
global->console.sound.system_bgm_enable = false;
@ -1068,7 +1087,7 @@ static void config_read_keybinds_conf(config_file_t *conf)
}
/* Also dumps inherited values, useful for logging. */
#if 0
static void config_file_dump_all(config_file_t *conf)
{
struct config_entry_list *list = NULL;
@ -1084,12 +1103,12 @@ static void config_file_dump_all(config_file_t *conf)
while (list)
{
RARCH_LOG("%s = \"%s\" %s\n", list->key,
list->value, list->readonly ? "(included)" : "");
RARCH_LOG("%s = \"%s\"%s\n", list->key,
list->value, list->readonly ? " (included)" : "");
list = list->next;
}
}
#endif
/**
* config_load:
* @path : path to be read from.
@ -1138,14 +1157,14 @@ static bool config_load_file(const char *path, bool set_defaults)
RARCH_ERR("Failed to append config \"%s\"\n", extra_path);
extra_path = strtok_r(NULL, "|", &save);
}
#if 0
if (global->verbosity)
{
RARCH_LOG_OUTPUT("=== Config ===\n");
config_file_dump_all(conf);
RARCH_LOG_OUTPUT("=== Config end ===\n");
}
#endif
CONFIG_GET_FLOAT_BASE(conf, settings, video.scale, "video_scale");
CONFIG_GET_INT_BASE (conf, settings, video.fullscreen_x, "video_fullscreen_x");
@ -1420,8 +1439,8 @@ static bool config_load_file(const char *path, bool set_defaults)
CONFIG_GET_INT_BASE(conf, settings, archive.mode, "archive_mode");
config_get_path(conf, "recording_output_directory", global->recording.output_dir, sizeof(global->recording.output_dir));
config_get_path(conf, "recording_config_directory", global->recording.config_dir, sizeof(global->recording.config_dir));
config_get_path(conf, "recording_output_directory", global->record.output_dir, sizeof(global->record.output_dir));
config_get_path(conf, "recording_config_directory", global->record.config_dir, sizeof(global->record.config_dir));
#ifdef HAVE_OVERLAY
config_get_path(conf, "overlay_directory", global->overlay_dir, sizeof(global->overlay_dir));
@ -1578,6 +1597,8 @@ static bool config_load_file(const char *path, bool set_defaults)
config_read_keybinds_conf(conf);
CONFIG_GET_BOOL_BASE(conf, settings, core_specific_config, "core_specific_config");
CONFIG_GET_BOOL_BASE(conf, settings, auto_overrides_enable, "auto_overrides_enable");
CONFIG_GET_BOOL_BASE(conf, settings, auto_remaps_enable, "auto_remaps_enable");
config_file_free(conf);
return true;
@ -1712,7 +1733,7 @@ bool config_load_override(void)
if (settings->core_specific_config)
{
RARCH_LOG("Can't use overrides in conjunction with per-core configs, disabling overrides\n");
return false;
return false;
}
RARCH_LOG("Core-specific overrides found at %s. Appending.\n", core_path);
strlcpy(global->append_config_path, core_path, sizeof(global->append_config_path));
@ -1892,7 +1913,7 @@ bool config_load_remap(void)
{
RARCH_LOG("No core-specific remap found at %s.\n", core_path);
*settings->input.remapping_path= '\0';
input_remapping_set_defaults();
input_remapping_set_defaults();
}
new_conf = NULL;
@ -2176,8 +2197,8 @@ bool config_save_file(const char *path)
config_set_path(conf, "libretro_path", settings->libretro);
config_set_path(conf, "core_options_path", settings->core_options_path);
config_set_path(conf, "recording_output_directory", global->recording.output_dir);
config_set_path(conf, "recording_config_directory", global->recording.config_dir);
config_set_path(conf, "recording_output_directory", global->record.output_dir);
config_set_path(conf, "recording_config_directory", global->record.config_dir);
config_set_bool(conf, "suspend_screensaver_enable", settings->ui.suspend_screensaver_enable);
config_set_path(conf, "libretro_directory", settings->libretro_directory);
@ -2450,6 +2471,10 @@ bool config_save_file(const char *path)
config_set_bool(conf, "core_specific_config",
settings->core_specific_config);
config_set_bool(conf, "auto_overrides_enable",
settings->auto_overrides_enable);
config_set_bool(conf, "auto_remaps_enable",
settings->auto_remaps_enable);
config_set_int(conf, "libretro_log_level", settings->libretro_log_level);
config_set_bool(conf, "log_verbosity", global->verbosity);
config_set_bool(conf, "perfcnt_enable", global->perfcnt_enable);

View File

@ -92,6 +92,11 @@ typedef struct settings
bool force_srgb_disable;
} video;
struct
{
char driver[32];
} record;
struct
{
bool menubar_enable;
@ -303,6 +308,8 @@ typedef struct settings
bool load_dummy_on_core_shutdown;
bool core_specific_config;
bool auto_overrides_enable;
bool auto_remaps_enable;
char username[32];
unsigned int user_language;
@ -393,6 +400,8 @@ const char *config_get_default_joypad(void);
const char *config_get_default_menu(void);
#endif
const char *config_get_default_record(void);
/**
* config_load:
*

View File

@ -73,9 +73,11 @@ static bool read_content_file(unsigned i, const char *path, void **buf,
if (!global->block_patch)
patch_content(&ret_buf, length);
#ifdef HAVE_ZLIB
global->content_crc = zlib_crc32_calculate(ret_buf, *length);
RARCH_LOG("CRC32: 0x%x .\n", (unsigned)global->content_crc);
#endif
*buf = ret_buf;
return true;

View File

@ -141,9 +141,11 @@ static int database_info_iterate_rdl_write(
rarch_main_msg_queue_push(msg, 1, 180, true);
#ifdef HAVE_ZLIB
crc = zlib_crc32_calculate(ret_buf, ret);
RARCH_LOG("CRC32: 0x%x .\n", (unsigned)crc);
#endif
if (ret_buf)
free(ret_buf);

View File

@ -123,6 +123,12 @@ static const void *find_driver_nonempty(const char *label, int i,
if (drv)
strlcpy(str, audio_driver_find_ident(i), sizeof_str);
}
else if (!strcmp(label, "record_driver"))
{
drv = record_driver_find_handle(i);
if (drv)
strlcpy(str, record_driver_find_ident(i), sizeof_str);
}
else if (!strcmp(label, "audio_resampler_driver"))
{
drv = audio_resampler_driver_find_handle(i);

View File

@ -199,7 +199,7 @@ typedef struct driver
const camera_driver_t *camera;
const location_driver_t *location;
const rarch_resampler_t *resampler;
const ffemu_backend_t *recording;
const record_driver_t *recording;
struct retro_callbacks retro_ctx;
void *audio_data;

View File

@ -66,6 +66,10 @@
#include <unistd.h>
#endif
#ifdef __APPLE__
#include <CoreFoundation/CoreFoundation.h>
#endif
void fill_pathname_expand_special(char *out_path,
const char *in_path, size_t size)
{

View File

@ -869,5 +869,6 @@ const frontend_ctx_driver_t frontend_ctx_android = {
NULL, /* get_os */
frontend_android_get_rating, /* get_rating */
NULL, /* load_content */
NULL, /* get_powerstate */
"android",
};

View File

@ -15,123 +15,152 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <CoreFoundation/CoreFoundation.h>
#include <retro_miscellaneous.h>
#include <file/file_path.h>
#include "../../apple/common/CFExtensions.h"
#include "../frontend_driver.h"
#include "../../ui/ui_companion_driver.h"
#include "../../general.h"
#include <stdint.h>
#include <boolean.h>
#include <stddef.h>
#include <string.h>
#ifdef IOS
#include <sys/utsname.h>
#if defined(OSX)
#include <Carbon/Carbon.h>
#include <IOKit/ps/IOPowerSources.h>
#include <IOKit/ps/IOPSKeys.h>
#endif
#if defined(IOS)
void get_ios_version(int *major, int *minor);
enum frontend_powerstate ios_get_powerstate(int *seconds, int *percent);
#endif
static bool CopyModel(char** model, uint32_t *majorRev, uint32_t *minorRev)
#if defined(OSX)
#define PMGMT_STRMATCH(a,b) (CFStringCompare(a, b, 0) == kCFCompareEqualTo)
#define PMGMT_GETVAL(k,v) CFDictionaryGetValueIfPresent(dict, CFSTR(k), (const void **) v)
/* Note that AC power sources also include a laptop battery it is charging. */
static void checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery,
bool * charging, int *seconds, int *percent)
{
#ifdef OSX
int mib[2];
int count;
unsigned long modelLen;
char *revStr;
#endif
char *machineModel;
bool success = true;
size_t length = 1024;
if (!model || !majorRev || !minorRev)
{
RARCH_ERR("CopyModel: Passing NULL arguments\n");
return false;
}
#ifdef IOS
sysctlbyname("hw.machine", NULL, &length, NULL, 0);
#endif
machineModel = malloc(length);
if (!machineModel)
{
success = false;
goto exit;
}
#ifdef IOS
sysctlbyname("hw.machine", machineModel, &length, NULL, 0);
*model = strndup(machineModel, length);
#else
mib[0] = CTL_HW;
mib[1] = HW_MODEL;
if (sysctl(mib, 2, machineModel, &length, NULL, 0))
{
printf("CopyModel: sysctl (error %d)\n", errno);
success = false;
goto exit;
}
modelLen = strcspn(machineModel, "0123456789");
if (modelLen == 0)
{
RARCH_ERR("CopyModel: Could not find machine model name\n");
success = false;
goto exit;
}
*model = strndup(machineModel, modelLen);
if (*model == NULL)
{
RARCH_ERR("CopyModel: Could not find machine model name\n");
success = false;
goto exit;
}
*majorRev = 0;
*minorRev = 0;
revStr = strpbrk(machineModel, "0123456789");
if (!revStr)
{
RARCH_ERR("CopyModel: Could not find machine version number, inferred value is 0,0\n");
success = true;
goto exit;
}
count = sscanf(revStr, "%d,%d", majorRev, minorRev);
if (count < 2)
{
RARCH_ERR("CopyModel: Could not find machine version number\n");
if (count < 1)
*majorRev = 0;
*minorRev = 0;
success = true;
goto exit;
}
#endif
exit:
if (machineModel)
free(machineModel);
if (!success)
{
if (*model)
free(*model);
*model = NULL;
*majorRev = 0;
*minorRev = 0;
}
return success;
CFStringRef strval; /* don't CFRelease() this. */
CFBooleanRef bval;
CFNumberRef numval;
bool charge = false;
bool choose = false;
bool is_ac = false;
int secs = -1;
int maxpct = -1;
int pct = -1;
if ((PMGMT_GETVAL(kIOPSIsPresentKey, &bval)) && (bval == kCFBooleanFalse))
return; /* nothing to see here. */
if (!PMGMT_GETVAL(kIOPSPowerSourceStateKey, &strval))
return;
if (PMGMT_STRMATCH(strval, CFSTR(kIOPSACPowerValue)))
is_ac = *have_ac = true;
else if (!PMGMT_STRMATCH(strval, CFSTR(kIOPSBatteryPowerValue)))
return; /* not a battery? */
if ((PMGMT_GETVAL(kIOPSIsChargingKey, &bval)) && (bval == kCFBooleanTrue))
charge = true;
if (PMGMT_GETVAL(kIOPSMaxCapacityKey, &numval))
{
SInt32 val = -1;
CFNumberGetValue(numval, kCFNumberSInt32Type, &val);
if (val > 0)
{
*have_battery = true;
maxpct = (int) val;
}
}
if (PMGMT_GETVAL(kIOPSMaxCapacityKey, &numval))
{
SInt32 val = -1;
CFNumberGetValue(numval, kCFNumberSInt32Type, &val);
if (val > 0)
{
*have_battery = true;
maxpct = (int) val;
}
}
if (PMGMT_GETVAL(kIOPSTimeToEmptyKey, &numval))
{
SInt32 val = -1;
CFNumberGetValue(numval, kCFNumberSInt32Type, &val);
/* Mac OS X reports 0 minutes until empty if you're plugged in. :( */
if ((val == 0) && (is_ac))
val = -1; /* !!! FIXME: calc from timeToFull and capacity? */
secs = (int) val;
if (secs > 0)
secs *= 60; /* value is in minutes, so convert to seconds. */
}
if (PMGMT_GETVAL(kIOPSCurrentCapacityKey, &numval))
{
SInt32 val = -1;
CFNumberGetValue(numval, kCFNumberSInt32Type, &val);
pct = (int) val;
}
if ((pct > 0) && (maxpct > 0))
pct = (int) ((((double) pct) / ((double) maxpct)) * 100.0);
if (pct > 100)
pct = 100;
/*
* We pick the battery that claims to have the most minutes left.
* (failing a report of minutes, we'll take the highest percent.)
*/
if ((secs < 0) && (*seconds < 0))
{
if ((pct < 0) && (*percent < 0))
choose = true; /* at least we know there's a battery. */
if (pct > *percent)
choose = true;
}
else if (secs > *seconds)
choose = true;
if (choose)
{
*seconds = secs;
*percent = pct;
*charging = charge;
}
}
#endif
static void frontend_apple_get_name(char *name, size_t sizeof_name)
{
uint32_t major_rev, minor_rev;
CopyModel(&name, &major_rev, &minor_rev);
#if defined(IOS)
struct utsname buffer;
if (uname(&buffer) != 0)
return;
strlcpy(name, buffer.machine, sizeof_name);
#elif defined(OSX)
size_t length = 0;
sysctlbyname("hw.model", name, &length, NULL, 0);
#endif
}
static void frontend_apple_get_os(char *name, size_t sizeof_name, int *major, int *minor)
@ -141,15 +170,18 @@ static void frontend_apple_get_os(char *name, size_t sizeof_name, int *major, in
(void)major;
(void)minor;
#ifdef IOS
#if defined(IOS)
get_ios_version(major, minor);
snprintf(name, sizeof_name, "iOS %d.%d", *major, *minor);
strlcpy(name, "iOS", sizeof_name);
#elif defined(OSX)
strlcpy(name, "OSX", sizeof_name);
#endif
}
static void frontend_apple_get_environment_settings(int *argc, char *argv[],
void *args, void *params_data)
{
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
char temp_dir[PATH_MAX_LENGTH];
char bundle_path_buf[PATH_MAX_LENGTH], home_dir_buf[PATH_MAX_LENGTH];
CFURLRef bundle_url;
@ -214,9 +246,12 @@ static void frontend_apple_get_environment_settings(int *argc, char *argv[],
CFRelease(bundle_path);
CFRelease(bundle_url);
#endif
}
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
extern void apple_rarch_exited(void);
#endif
static void frontend_apple_load_content(void)
{
@ -229,7 +264,9 @@ static void frontend_apple_load_content(void)
static void frontend_apple_shutdown(bool unused)
{
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
apple_rarch_exited();
#endif
}
static int frontend_apple_get_rating(void)
@ -297,20 +334,100 @@ static int frontend_apple_get_rating(void)
return -1;
}
static enum frontend_powerstate frontend_apple_get_powerstate(int *seconds, int *percent)
{
enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE;
#if defined(OSX)
CFIndex i, total;
CFArrayRef list;
bool have_ac, have_battery, charging;
CFTypeRef blob = IOPSCopyPowerSourcesInfo();
*seconds = -1;
*percent = -1;
if (!blob)
goto end;
list = IOPSCopyPowerSourcesList(blob);
if (!list)
goto end;
/* don't CFRelease() the list items, or dictionaries! */
have_ac = false;
have_battery = false;
charging = false;
total = CFArrayGetCount(list);
for (i = 0; i < total; i++)
{
CFTypeRef ps = (CFTypeRef)CFArrayGetValueAtIndex(list, i);
CFDictionaryRef dict = IOPSGetPowerSourceDescription(blob, ps);
if (dict)
checkps(dict, &have_ac, &have_battery, &charging,
seconds, percent);
}
if (!have_battery)
ret = FRONTEND_POWERSTATE_NO_SOURCE;
else if (charging)
ret = FRONTEND_POWERSTATE_CHARGING;
else if (have_ac)
ret = FRONTEND_POWERSTATE_CHARGED;
else
ret = FRONTEND_POWERSTATE_ON_POWER_SOURCE;
CFRelease(list);
end:
if (blob)
CFRelease(blob);
#elif defined(IOS)
ret = ios_get_powerstate(seconds, percent);
#endif
return ret;
}
enum frontend_architecture frontend_apple_get_architecture(void)
{
struct utsname buffer;
if (uname(&buffer) != 0)
return FRONTEND_ARCH_NONE;
#ifdef OSX
if (!strcmp(buffer.machine, "x86_64"))
return FRONTEND_ARCH_X86_64;
if (!strcmp(buffer.machine, "x86"))
return FRONTEND_ARCH_X86;
if (!strcmp(buffer.machine, "Power Macintosh"))
return FRONTEND_ARCH_PPC;
#endif
return FRONTEND_ARCH_NONE;
}
const frontend_ctx_driver_t frontend_ctx_apple = {
frontend_apple_get_environment_settings, /* environment_get */
frontend_apple_get_environment_settings,
NULL, /* init */
NULL, /* deinit */
NULL, /* exitspawn */
NULL, /* process_args */
NULL, /* exec */
NULL, /* set_fork */
frontend_apple_shutdown, /* shutdown */
frontend_apple_get_name, /* get_name */
frontend_apple_get_os, /* get_os */
frontend_apple_get_rating, /* get_rating */
frontend_apple_load_content, /* load_content */
frontend_apple_shutdown,
frontend_apple_get_name,
frontend_apple_get_os,
frontend_apple_get_rating,
frontend_apple_load_content,
frontend_apple_get_architecture,
frontend_apple_get_powerstate,
"apple",
};
#if !defined(HAVE_COCOA) && !defined(HAVE_COCOATOUCH)
int main(int argc, char *argv[])
{
return rarch_main(argc, argv);
}
#endif

View File

@ -29,12 +29,11 @@
int __stacksize__ = 1*1024*1024;
//char elf_path[512];
const char* elf_path_cst = "sdmc:/retroarch/test.3dsx";
void wait_for_input(void);
#define DEBUG_HOLD() do{printf("%s@%s:%d.\n",__FUNCTION__, __FILE__, __LINE__);fflush(stdout);wait_for_input();}while(0)
static void frontend_ctr_get_environment_settings(int *argc, char *argv[],
@ -42,7 +41,6 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[],
{
(void)args;
// return;
#ifndef IS_SALAMANDER
#if defined(HAVE_LOGGER)
logger_init();
@ -52,9 +50,6 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[],
#endif
#endif
// strlcpy(elf_path, argv[0], sizeof(elf_path));
// fill_pathname_basedir(g_defaults.port_dir, argv[0], sizeof(g_defaults.port_dir));
fill_pathname_basedir(g_defaults.port_dir, elf_path_cst, sizeof(g_defaults.port_dir));
RARCH_LOG("port dir: [%s]\n", g_defaults.port_dir);
@ -76,34 +71,36 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[],
"retroarch.cfg", sizeof(g_defaults.config_path));
#ifndef IS_SALAMANDER
// if (argv[1] && (argv[1][0] != '\0'))
// {
// static char path[PATH_MAX_LENGTH];
// struct rarch_main_wrap *args = NULL;
#if 0
if (argv[1] && (argv[1][0] != '\0'))
{
static char path[PATH_MAX_LENGTH];
struct rarch_main_wrap *args = NULL;
// *path = '\0';
// args = (struct rarch_main_wrap*)params_data;
*path = '\0';
args = (struct rarch_main_wrap*)params_data;
// if (args)
// {
// strlcpy(path, argv[1], sizeof(path));
if (args)
{
strlcpy(path, argv[1], sizeof(path));
// args->touched = true;
// args->no_content = false;
// args->verbose = false;
// args->config_path = NULL;
// args->sram_path = NULL;
// args->state_path = NULL;
// args->content_path = path;
// args->libretro_path = NULL;
args->touched = true;
args->no_content = false;
args->verbose = false;
args->config_path = NULL;
args->sram_path = NULL;
args->state_path = NULL;
args->content_path = path;
args->libretro_path = NULL;
// RARCH_LOG("argv[0]: %s\n", argv[0]);
// RARCH_LOG("argv[1]: %s\n", argv[1]);
// RARCH_LOG("argv[2]: %s\n", argv[2]);
RARCH_LOG("argv[0]: %s\n", argv[0]);
RARCH_LOG("argv[1]: %s\n", argv[1]);
RARCH_LOG("argv[2]: %s\n", argv[2]);
// RARCH_LOG("Auto-start game %s.\n", argv[1]);
// }
// }
RARCH_LOG("Auto-start game %s.\n", argv[1]);
}
}
#endif
#endif
}
@ -125,11 +122,13 @@ static void frontend_ctr_deinit(void *data)
csndExit();
gfxExit();
// sdmcExit();
// fsExit();
// hidExit();
// aptExit();
// srvExit();
#if 0
sdmcExit();
fsExit();
hidExit();
aptExit();
srvExit();
#endif
#endif
}
@ -140,6 +139,7 @@ static void frontend_ctr_shutdown(bool unused)
#define PRINTFPOS(X,Y) "\x1b["#X";"#Y"H"
#define PRINTFPOS_STR(X,Y) "\x1b["X";"Y"H"
static void frontend_ctr_init(void *data)
{
#ifndef IS_SALAMANDER
@ -147,20 +147,21 @@ static void frontend_ctr_init(void *data)
global_t *global = global_get_ptr();
global->verbosity = true;
// srvInit();
// aptInit();
// hidInit();
// fsInit();
// sdmcInit();
#if 0
srvInit();
aptInit();
hidInit();
fsInit();
sdmcInit();
// APT_SetAppCpuTimeLimit(NULL, 80);
// gfxInitDefault();
APT_SetAppCpuTimeLimit(NULL, 80);
gfxInitDefault();
#endif
gfxInit(GSP_BGR8_OES,GSP_RGB565_OES,false);
csndInit();
gfxSet3D(false);
consoleInit(GFX_BOTTOM, NULL);
#endif
}
@ -168,36 +169,51 @@ static int frontend_ctr_get_rating(void)
{
return 3;
}
bool select_pressed = false;
void wait_for_input()
void wait_for_input(void)
{
printf("\n\nPress Start.\n\n");fflush(stdout);
printf("\n\nPress Start.\n\n");
fflush(stdout);
while(aptMainLoop())
{
u32 kDown;
hidScanInput();
u32 kDown = hidKeysDown();
kDown = hidKeysDown();
if (kDown & KEY_START)
break;
if (kDown & KEY_SELECT)
select_pressed = true;
svcSleepThread(1000000);
rarch_sleep(1);
}
}
enum frontend_architecture frontend_ctr_get_architecture(void)
{
return FRONTEND_ARCH_ARM;
}
const frontend_ctx_driver_t frontend_ctx_ctr = {
frontend_ctr_get_environment_settings, /* get_environment_settings */
frontend_ctr_init, /* init */
frontend_ctr_deinit, /* deinit */
frontend_ctr_get_environment_settings,
frontend_ctr_init,
frontend_ctr_deinit,
NULL, /* exitspawn */
NULL, /* process_args */
NULL, /* exec */
NULL, /* set_fork */
frontend_ctr_shutdown, /* shutdown */
frontend_ctr_shutdown,
NULL, /* get_name */
NULL, /* get_os */
frontend_ctr_get_rating, /* get_rating */
frontend_ctr_get_rating,
NULL, /* load_content */
frontend_ctr_get_architecture,
NULL, /* get_powerstate */
"ctr",
};

View File

@ -376,18 +376,25 @@ static int frontend_gx_get_rating(void)
#endif
}
static enum frontend_architecture frontend_gx_get_architecture(void)
{
return FRONTEND_ARCH_PPC;
}
const frontend_ctx_driver_t frontend_ctx_gx = {
frontend_gx_get_environment_settings, /* get_environment_settings */
frontend_gx_init, /* init */
frontend_gx_get_environment_settings,
frontend_gx_init,
NULL, /* deinit */
frontend_gx_exitspawn, /* exitspawn */
frontend_gx_process_args, /* process_args */
frontend_gx_exec, /* exec */
frontend_gx_set_fork, /* set_fork */
frontend_gx_exitspawn,
frontend_gx_process_args,
frontend_gx_exec,
frontend_gx_set_fork,
NULL, /* shutdown */
NULL, /* get_name */
NULL, /* get_os */
frontend_gx_get_rating, /* get_rating */
frontend_gx_get_rating,
NULL, /* load_content */
frontend_gx_get_architecture,
NULL, /* get_powerstate */
"gx",
};

View File

@ -0,0 +1,441 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - Daniel De Matteis
* Copyright (C) 2012-2015 - Jason Fetters
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
* * You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../frontend_driver.h"
#include <stdio.h>
#include <stdint.h>
#include <boolean.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/utsname.h>
#include <compat/strl.h>
static const char *proc_apm_path = "/proc/apm";
static const char *proc_acpi_battery_path = "/proc/acpi/battery";
static const char *proc_acpi_ac_adapter_path = "/proc/acpi/ac_adapter";
static int open_acpi_file(const char *base, const char *node, const char *key)
{
const size_t pathlen = strlen(base) + strlen(node) + strlen(key) + 3;
char *path = (char *)alloca(pathlen);
if (!path)
return -1;
snprintf(path, pathlen, "%s/%s/%s", base, node, key);
return open(path, O_RDONLY);
}
static bool load_acpi_file(const char *base, const char *node, const char *key,
char *buf, size_t buflen)
{
ssize_t br = 0;
const int fd = open_acpi_file(base, node, key);
if (fd == -1)
return false;
br = read(fd, buf, buflen-1);
close(fd);
if (br < 0)
return false;
buf[br] = '\0'; /* null-terminate the string. */
return true;
}
static bool make_proc_acpi_key_val(char **_ptr, char **_key, char **_val)
{
char *ptr = *_ptr;
while (*ptr == ' ')
ptr++; /* skip whitespace. */
if (*ptr == '\0')
return false; /* EOF. */
*_key = ptr;
while ((*ptr != ':') && (*ptr != '\0'))
ptr++;
if (*ptr == '\0')
return false; /* (unexpected) EOF. */
*(ptr++) = '\0'; /* terminate the key. */
while ((*ptr == ' ') && (*ptr != '\0'))
ptr++; /* skip whitespace. */
if (*ptr == '\0')
return false; /* (unexpected) EOF. */
*_val = ptr;
while ((*ptr != '\n') && (*ptr != '\0'))
ptr++;
if (*ptr != '\0')
*(ptr++) = '\0'; /* terminate the value. */
*_ptr = ptr; /* store for next time. */
return true;
}
static void
check_proc_acpi_battery(const char * node, bool * have_battery,
bool * charging, int *seconds, int *percent)
{
const char *base = proc_acpi_battery_path;
char info[1024];
char state[1024];
char *ptr = NULL;
char *key = NULL;
char *val = NULL;
bool charge = false;
bool choose = false;
int maximum = -1;
int remaining = -1;
int secs = -1;
int pct = -1;
if (!load_acpi_file(base, node, "state", state, sizeof (state)))
return;
else if (!load_acpi_file(base, node, "info", info, sizeof (info)))
return;
ptr = &state[0];
while (make_proc_acpi_key_val(&ptr, &key, &val))
{
if (!strcmp(key, "present"))
{
if (!strcmp(val, "yes"))
*have_battery = true;
}
else if (!strcmp(key, "charging state"))
{
/* !!! FIXME: what exactly _does_ charging/discharging mean? */
if (!strcmp(val, "charging/discharging"))
charge = true;
else if (!strcmp(val, "charging"))
charge = true;
}
else if (!strcmp(key, "remaining capacity"))
{
char *endptr = NULL;
const int cvt = (int) strtol(val, &endptr, 10);
if (*endptr == ' ')
remaining = cvt;
}
}
ptr = &info[0];
while (make_proc_acpi_key_val(&ptr, &key, &val))
{
if (!strcmp(key, "design capacity"))
{
char *endptr = NULL;
const int cvt = (int) strtol(val, &endptr, 10);
if (*endptr == ' ')
maximum = cvt;
}
}
if ((maximum >= 0) && (remaining >= 0))
{
pct = (int) ((((float) remaining) / ((float) maximum)) * 100.0f);
if (pct < 0)
pct = 0;
else if (pct > 100)
pct = 100;
}
/* !!! FIXME: calculate (secs). */
/*
* We pick the battery that claims to have the most minutes left.
* (failing a report of minutes, we'll take the highest percent.)
*/
if ((secs < 0) && (*seconds < 0))
{
if ((pct < 0) && (*percent < 0))
choose = true; /* at least we know there's a battery. */
if (pct > *percent)
choose = true;
}
else if (secs > *seconds)
choose = true;
if (choose)
{
*seconds = secs;
*percent = pct;
*charging = charge;
}
}
static void
check_proc_acpi_ac_adapter(const char * node, bool *have_ac)
{
const char *base = proc_acpi_ac_adapter_path;
char state[256];
char *ptr = NULL;
char *key = NULL;
char *val = NULL;
if (!load_acpi_file(base, node, "state", state, sizeof (state)))
return;
ptr = &state[0];
while (make_proc_acpi_key_val(&ptr, &key, &val))
{
if (!strcmp(key, "state"))
{
if (!strcmp(val, "on-line"))
*have_ac = true;
}
}
}
static bool next_string(char **_ptr, char **_str)
{
char *ptr = *_ptr;
char *str = *_str;
while (*ptr == ' ') /* skip any spaces... */
ptr++;
if (*ptr == '\0')
return false;
str = ptr;
while ((*ptr != ' ') && (*ptr != '\n') && (*ptr != '\0'))
ptr++;
if (*ptr != '\0')
*(ptr++) = '\0';
*_str = str;
*_ptr = ptr;
return true;
}
static bool int_string(char *str, int *val)
{
char *endptr = NULL;
*val = (int) strtol(str, &endptr, 0);
return ((*str != '\0') && (*endptr == '\0'));
}
bool frontend_linux_powerstate_check_apm(enum frontend_powerstate *state,
int *seconds, int *percent)
{
int ac_status = 0;
int battery_status = 0;
int battery_flag = 0;
int battery_percent = 0;
int battery_time = 0;
const int fd = open(proc_apm_path, O_RDONLY);
char buf[128];
char *ptr = &buf[0];
char *str = NULL;
ssize_t br;
if (fd == -1)
return false; /* can't use this interface. */
br = read(fd, buf, sizeof (buf) - 1);
close(fd);
if (br < 0)
return false;
buf[br] = '\0'; /* null-terminate the string. */
if (!next_string(&ptr, &str)) /* driver version */
return false;
if (!next_string(&ptr, &str)) /* BIOS version */
return false;
if (!next_string(&ptr, &str)) /* APM flags */
return false;
if (!next_string(&ptr, &str)) /* AC line status */
return false;
else if (!int_string(str, &ac_status))
return false;
if (!next_string(&ptr, &str)) /* battery status */
return false;
else if (!int_string(str, &battery_status))
return false;
if (!next_string(&ptr, &str)) /* battery flag */
return false;
else if (!int_string(str, &battery_flag))
return false;
if (!next_string(&ptr, &str)) /* remaining battery life percent */
return false;
if (str[strlen(str) - 1] == '%')
str[strlen(str) - 1] = '\0';
if (!int_string(str, &battery_percent))
return false;
if (!next_string(&ptr, &str)) /* remaining battery life time */
return false;
else if (!int_string(str, &battery_time))
return false;
if (!next_string(&ptr, &str)) /* remaining battery life time units */
return false;
else if (!strcmp(str, "min"))
battery_time *= 60;
if (battery_flag == 0xFF) /* unknown state */
*state = FRONTEND_POWERSTATE_NONE;
else if (battery_flag & (1 << 7)) /* no battery */
*state = FRONTEND_POWERSTATE_NO_SOURCE;
else if (battery_flag & (1 << 3)) /* charging */
*state = FRONTEND_POWERSTATE_CHARGING;
else if (ac_status == 1)
*state = FRONTEND_POWERSTATE_CHARGED; /* on AC, not charging. */
else
*state = FRONTEND_POWERSTATE_ON_POWER_SOURCE;
const int pct = battery_percent;
const int secs = battery_time;
if (pct >= 0) /* -1 == unknown */
*percent = (pct > 100) ? 100 : pct; /* clamp between 0%, 100% */
if (secs >= 0) /* -1 == unknown */
*seconds = secs;
return true;
}
bool frontend_linux_powerstate_check_acpi(enum frontend_powerstate *state,
int *seconds, int *percent)
{
struct dirent *dent = NULL;
DIR *dirp = NULL;
bool have_battery = false;
bool have_ac = false;
bool charging = false;
*state = FRONTEND_POWERSTATE_NONE;
dirp = opendir(proc_acpi_battery_path);
if (dirp == NULL)
return false; /* can't use this interface. */
while ((dent = readdir(dirp)) != NULL)
{
const char *node = dent->d_name;
check_proc_acpi_battery(node, &have_battery, &charging,
seconds, percent);
}
closedir(dirp);
dirp = opendir(proc_acpi_ac_adapter_path);
if (dirp == NULL)
return false; /* can't use this interface. */
while ((dent = readdir(dirp)) != NULL)
{
const char *node = dent->d_name;
check_proc_acpi_ac_adapter(node, &have_ac);
}
closedir(dirp);
if (!have_battery)
*state = FRONTEND_POWERSTATE_NO_SOURCE;
else if (charging)
*state = FRONTEND_POWERSTATE_CHARGING;
else if (have_ac)
*state = FRONTEND_POWERSTATE_CHARGED;
else
*state = FRONTEND_POWERSTATE_ON_POWER_SOURCE;
return true; /* definitive answer. */
}
static enum frontend_powerstate
frontend_linux_get_powerstate(int *seconds, int *percent)
{
enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE;
if (frontend_linux_powerstate_check_apm(&ret, seconds, percent))
return ret;
if (frontend_linux_powerstate_check_acpi(&ret, seconds, percent))
return ret;
return FRONTEND_POWERSTATE_NONE;
}
enum frontend_architecture frontend_linux_get_architecture(void)
{
struct utsname buffer;
if (uname(&buffer) != 0)
return FRONTEND_ARCH_NONE;
if (!strcmp(buffer.machine, "x86_64"))
return FRONTEND_ARCH_X86_64;
if (!strcmp(buffer.machine, "x86"))
return FRONTEND_ARCH_X86;
if (!strcmp(buffer.machine, "arm"))
return FRONTEND_ARCH_ARM;
if (!strcmp(buffer.machine, "ppc64"))
return FRONTEND_ARCH_PPC;
if (!strcmp(buffer.machine, "mips"))
return FRONTEND_ARCH_MIPS;
if (!strcmp(buffer.machine, "tile"))
return FRONTEND_ARCH_TILE;
return FRONTEND_ARCH_NONE;
}
static void frontend_linux_get_os(char *name, size_t sizeof_name, int *major, int *minor)
{
unsigned krel;
struct utsname buffer;
if (uname(&buffer) != 0)
return;
sscanf(buffer.release, "%u.%u.%u", major, minor, &krel);
strlcpy(name, "Linux", sizeof_name);
}
const frontend_ctx_driver_t frontend_ctx_linux = {
NULL, /* environment_get */
NULL, /* init */
NULL, /* deinit */
NULL, /* exitspawn */
NULL, /* process_args */
NULL, /* exec */
NULL, /* set_fork */
NULL, /* shutdown */
NULL, /* get_name */
frontend_linux_get_os,
NULL, /* get_rating */
NULL, /* load_content */
frontend_linux_get_architecture,
frontend_linux_get_powerstate,
"linux",
};

View File

@ -34,5 +34,7 @@ const frontend_ctx_driver_t frontend_ctx_null = {
NULL, /* get_os */
NULL, /* get_rating */
NULL, /* load_content */
NULL, /* get_architecture */
NULL, /* get_powerstate */
"null",
};

View File

@ -439,18 +439,25 @@ static int frontend_ps3_get_rating(void)
return 10;
}
enum frontend_architecture frontend_ps3_get_architecture(void)
{
return FRONTEND_ARCH_PPC;
}
const frontend_ctx_driver_t frontend_ctx_ps3 = {
frontend_ps3_get_environment_settings, /* get_environment_settings */
frontend_ps3_init, /* init */
frontend_ps3_deinit, /* deinit */
frontend_ps3_exitspawn, /* exitspawn */
frontend_ps3_get_environment_settings,
frontend_ps3_init,
frontend_ps3_deinit,
frontend_ps3_exitspawn,
NULL, /* process_args */
frontend_ps3_exec, /* exec */
frontend_ps3_set_fork, /* set_fork */
frontend_ps3_exec,
frontend_ps3_set_fork,
NULL, /* shutdown */
NULL, /* get_name */
NULL, /* get_os */
frontend_ps3_get_rating, /* get_rating */
frontend_ps3_get_rating,
NULL, /* load_content */
frontend_ps3_get_architecture,
NULL, /* get_powerstate */
"ps3",
};

View File

@ -236,18 +236,51 @@ static int frontend_psp_get_rating(void)
return 4;
}
static enum frontend_powerstate frontend_psp_get_powerstate(int *seconds, int *percent)
{
enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE;
int battery = scePowerIsBatteryExist();
int plugged = scePowerIsPowerOnline();
int charging = scePowerIsBatteryCharging();
*percent = scePowerGetBatteryLifePercent();
*seconds = scePowerGetBatteryLifeTime() * 60;
if (!battery)
{
ret = FRONTEND_POWERSTATE_NO_SOURCE;
*seconds = -1;
*percent = -1;
}
else if (charging)
ret = FRONTEND_POWERSTATE_CHARGING;
else if (plugged)
ret = FRONTEND_POWERSTATE_CHARGED;
else
ret = FRONTEND_POWERSTATE_ON_POWER_SOURCE;
return ret;
}
enum frontend_architecture frontend_psp_get_architecture(void)
{
return FRONTEND_ARCH_MIPS;
}
const frontend_ctx_driver_t frontend_ctx_psp = {
frontend_psp_get_environment_settings, /* get_environment_settings */
frontend_psp_init, /* init */
frontend_psp_deinit, /* deinit */
frontend_psp_exitspawn, /* exitspawn */
frontend_psp_get_environment_settings,
frontend_psp_init,
frontend_psp_deinit,
frontend_psp_exitspawn,
NULL, /* process_args */
frontend_psp_exec, /* exec */
frontend_psp_set_fork, /* set_fork */
frontend_psp_shutdown, /* shutdown */
frontend_psp_exec,
frontend_psp_set_fork,
frontend_psp_shutdown,
NULL, /* get_name */
NULL, /* get_os */
frontend_psp_get_rating, /* get_rating */
frontend_psp_get_rating,
NULL, /* load_content */
frontend_psp_get_architecture,
frontend_psp_get_powerstate,
"psp",
};

View File

@ -59,18 +59,25 @@ static void frontend_qnx_get_environment_settings(int *argc, char *argv[],
"playlists", sizeof(g_defaults.playlist_dir));
}
enum frontend_architecture frontend_qnx_get_architecture(void)
{
return FRONTEND_ARCH_ARM;
}
const frontend_ctx_driver_t frontend_ctx_qnx = {
frontend_qnx_get_environment_settings, /* get_environment_settings */
frontend_qnx_init, /* init */
frontend_qnx_get_environment_settings,
frontend_qnx_init,
NULL, /* deinit */
NULL, /* exitspawn */
NULL, /* process_args */
NULL, /* exec */
NULL, /* set_fork */
frontend_qnx_shutdown, /* shutdown */
frontend_qnx_shutdown,
NULL, /* get_name */
NULL, /* get_os */
frontend_qnx_get_rating, /* get_rating */
frontend_qnx_get_rating,
NULL, /* load_content */
frontend_qnx_get_architecture,
NULL, /* get_powerstate */
"qnx",
};

View File

@ -103,6 +103,59 @@ static void frontend_win32_get_os(char *name, size_t sizeof_name, int *major, in
*major = (DWORD)(LOBYTE(LOWORD(version)));
*minor = (DWORD)(HIBYTE(LOWORD(version)));
switch (*major)
{
case 6:
switch (*minor)
{
case 3:
strlcpy(name, "Windows 8.1", sizeof_name);
break;
case 2:
strlcpy(name, "Windows 8", sizeof_name);
break;
case 1:
strlcpy(name, "Windows 7/2008 R2", sizeof_name);
break;
case 0:
strlcpy(name, "Windows Vista/2008", sizeof_name);
break;
default:
break;
}
break;
case 5:
switch (*minor)
{
case 2:
strlcpy(name, "Windows 2003", sizeof_name);
break;
case 1:
strlcpy(name, "Windows XP", sizeof_name);
break;
case 0:
strlcpy(name, "Windows 2000", sizeof_name);
break;
}
break;
case 4:
switch (*minor)
{
case 0:
strlcpy(name, "Windows NT 4.0", sizeof_name);
break;
case 90:
strlcpy(name, "Windows ME", sizeof_name);
break;
case 10:
strlcpy(name, "Windows 98", sizeof_name);
break;
}
break;
default:
break;
}
}
static void frontend_win32_init(void *data)
@ -125,9 +178,40 @@ static void frontend_win32_init(void *data)
gfx_set_dwm();
}
enum frontend_powerstate frontend_win32_get_powerstate(int *seconds, int *percent)
{
SYSTEM_POWER_STATUS status;
enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE;
if (!GetSystemPowerStatus(&status))
return ret;
if (status.BatteryFlag == 0xFF)
ret = FRONTEND_POWERSTATE_NONE;
if (status.BatteryFlag & (1 << 7))
ret = FRONTEND_POWERSTATE_NO_SOURCE;
else if (status.BatteryFlag & (1 << 3))
ret = FRONTEND_POWERSTATE_CHARGING;
else if (status.ACLineStatus == 1)
ret = FRONTEND_POWERSTATE_CHARGED;
else
ret = FRONTEND_POWERSTATE_ON_POWER_SOURCE;
*percent = (int)status.BatteryLifePercent;
*seconds = (int)status.BatteryLifeTime;
return ret;
}
enum frontend_architecture frontend_win32_get_architecture(void)
{
/* stub */
return FRONTEND_ARCH_NONE;
}
const frontend_ctx_driver_t frontend_ctx_win32 = {
NULL, /* environment_get */
frontend_win32_init, /* init */
frontend_win32_init,
NULL, /* deinit */
NULL, /* exitspawn */
NULL, /* process_args */
@ -135,8 +219,10 @@ const frontend_ctx_driver_t frontend_ctx_win32 = {
NULL, /* set_fork */
NULL, /* shutdown */
NULL, /* get_name */
frontend_win32_get_os, /* get_os */
frontend_win32_get_os,
NULL, /* get_rating */
NULL, /* load_content */
frontend_win32_get_architecture,
frontend_win32_get_powerstate,
"win32",
};

View File

@ -367,18 +367,31 @@ static int frontend_xdk_get_rating(void)
#endif
}
enum frontend_architecture frontend_xdk_get_architecture(void)
{
#if defined(_XBOX360)
return FRONTEND_ARCH_PPC;
#elif defined(_XBOX1)
return FRONTEND_ARCH_X86;
#else
return FRONTEND_ARCH_NONE;
#endif
}
const frontend_ctx_driver_t frontend_ctx_xdk = {
frontend_xdk_get_environment_settings, /* get_environment_settings */
frontend_xdk_init, /* init */
frontend_xdk_get_environment_settings,
frontend_xdk_init,
NULL, /* deinit */
frontend_xdk_exitspawn, /* exitspawn */
frontend_xdk_exitspawn,
NULL, /* process_args */
frontend_xdk_exec, /* exec */
frontend_xdk_set_fork, /* set_fork */
frontend_xdk_exec,
frontend_xdk_set_fork,
NULL, /* shutdown */
NULL, /* get_name */
NULL, /* get_os */
frontend_xdk_get_rating, /* get_rating */
frontend_xdk_get_rating,
NULL, /* load_content */
frontend_xdk_get_architecture,
NULL, /* get_powerstate */
"xdk",
};

View File

@ -35,12 +35,15 @@ static const frontend_ctx_driver_t *frontend_ctx_drivers[] = {
#if defined(__QNX__)
&frontend_ctx_qnx,
#endif
#if defined(IOS) || defined(OSX)
#if defined(__APPLE__)
&frontend_ctx_apple,
#endif
#if defined(ANDROID)
&frontend_ctx_android,
#endif
#if defined(__linux__) && !defined(ANDROID)
&frontend_ctx_linux,
#endif
#if defined(PSP)
&frontend_ctx_psp,
#endif

View File

@ -28,6 +28,26 @@
extern "C" {
#endif
enum frontend_powerstate
{
FRONTEND_POWERSTATE_NONE = 0,
FRONTEND_POWERSTATE_NO_SOURCE,
FRONTEND_POWERSTATE_CHARGING,
FRONTEND_POWERSTATE_CHARGED,
FRONTEND_POWERSTATE_ON_POWER_SOURCE,
};
enum frontend_architecture
{
FRONTEND_ARCH_NONE = 0,
FRONTEND_ARCH_X86,
FRONTEND_ARCH_X86_64,
FRONTEND_ARCH_PPC,
FRONTEND_ARCH_ARM,
FRONTEND_ARCH_MIPS,
FRONTEND_ARCH_TILE,
};
typedef void (*environment_get_t)(int *argc, char *argv[], void *args,
void *params_data);
typedef void (*process_args_t)(int *argc, char *argv[]);
@ -47,6 +67,8 @@ typedef struct frontend_ctx_driver
void (*get_os)(char *, size_t, int *major, int *minor);
int (*get_rating)(void);
void (*content_loaded)(void);
enum frontend_architecture (*get_architecture)(void);
enum frontend_powerstate (*get_powerstate)(int *seconds, int *percent);
const char *ident;
@ -59,6 +81,7 @@ extern const frontend_ctx_driver_t frontend_ctx_xdk;
extern const frontend_ctx_driver_t frontend_ctx_qnx;
extern const frontend_ctx_driver_t frontend_ctx_apple;
extern const frontend_ctx_driver_t frontend_ctx_android;
extern const frontend_ctx_driver_t frontend_ctx_linux;
extern const frontend_ctx_driver_t frontend_ctx_psp;
extern const frontend_ctx_driver_t frontend_ctx_ctr;
extern const frontend_ctx_driver_t frontend_ctx_win32;

View File

@ -759,7 +759,7 @@ static void *d3d_init(const video_info_t *info,
}
#endif
vid = (d3d_video_t*)calloc(1, sizeof(*vid));
vid = new d3d_video_t();
if (!vid)
goto error;
@ -800,7 +800,7 @@ static void *d3d_init(const video_info_t *info,
error:
if (vid)
free(vid);
delete vid;
if (driver)
driver->video_context = NULL;
return NULL;
@ -839,7 +839,7 @@ static void d3d_free(void *data)
#endif
if (d3d)
free(d3d);
delete d3d;
#ifndef _XBOX
UnregisterClass("RetroArch", GetModuleHandle(NULL));

View File

@ -228,28 +228,37 @@ static bool ctr_frame(void* data, const void* frame,
extern bool select_pressed;
RARCH_PERFORMANCE_INIT(ctrframe_f);
RARCH_PERFORMANCE_START(ctrframe_f);
if (!width || !height)
{
gspWaitForEvent(GSPEVENT_VBlank0, true);
goto end;
return true;
}
if(!aptMainLoop())
{
event_command(EVENT_CMD_QUIT);
goto end;
return true;
}
if (select_pressed)
{
event_command(EVENT_CMD_QUIT);
goto end;
return true;
}
svcWaitSynchronization(gspEvents[GSPEVENT_P3D], 20000000);
svcClearEvent(gspEvents[GSPEVENT_P3D]);
svcWaitSynchronization(gspEvents[GSPEVENT_PPF], 20000000);
svcClearEvent(gspEvents[GSPEVENT_PPF]);
gfxSwapBuffersGpu();
frames++;
if (ctr->vsync)
svcWaitSynchronization(gspEvents[GSPEVENT_VBlank0], U64_MAX);
svcClearEvent(gspEvents[GSPEVENT_VBlank0]);
currentTick = svcGetSystemTick();
uint32_t diff = currentTick - lastTick;
if(diff > CTR_CPU_TICKS_PER_SECOND)
@ -260,23 +269,10 @@ static bool ctr_frame(void* data, const void* frame,
}
printf("fps: %8.4f frames: %i\r", fps, total_frames++);
// fflush(stdout);
fflush(stdout);
/* enable this to profile the core without video output */
#if 0
if (!ctr->menu_texture_enable)
goto end;
#endif
svcWaitSynchronization(gspEvents[GSPEVENT_P3D], 20000000);
svcClearEvent(gspEvents[GSPEVENT_P3D]);
svcWaitSynchronization(gspEvents[GSPEVENT_PPF], 20000000);
svcClearEvent(gspEvents[GSPEVENT_PPF]);
gfxSwapBuffersGpu();
if (ctr->vsync)
gspWaitForEvent(GSPEVENT_VBlank0, true);
RARCH_PERFORMANCE_INIT(ctrframe_f);
RARCH_PERFORMANCE_START(ctrframe_f);
ctrGuSetMemoryFill(true, (u32*)CTR_GPU_FRAMEBUFFER, 0x00000000,
(u32*)(CTR_GPU_FRAMEBUFFER + CTR_TOP_FRAMEBUFFER_WIDTH * CTR_TOP_FRAMEBUFFER_HEIGHT * sizeof(uint32_t)),
@ -363,9 +359,6 @@ static bool ctr_frame(void* data, const void* frame,
ctrGuDisplayTransfer(true, CTR_GPU_FRAMEBUFFER, 240,400, CTRGU_RGBA8,
gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), 240,400,CTRGU_RGB8, CTRGU_MULTISAMPLE_NONE);
end:
// gspWaitForEvent(GSPEVENT_VBlank0, true);
RARCH_PERFORMANCE_STOP(ctrframe_f);
return true;
}

View File

@ -304,8 +304,8 @@ static void gl_disable_client_arrays(gl_t *gl)
#ifdef IOS
/* There is no default frame buffer on iOS. */
void apple_bind_game_view_fbo(void);
#define gl_bind_backbuffer() apple_bind_game_view_fbo()
void cocoagl_bind_game_view_fbo(void);
#define gl_bind_backbuffer() cocoagl_bind_game_view_fbo()
#else
#define gl_bind_backbuffer() glBindFramebuffer(RARCH_GL_FRAMEBUFFER, 0)
#endif
@ -1197,7 +1197,7 @@ static void gl_init_textures(gl_t *gl, const video_info_t *video)
(void)texture_fmt;
#if defined(HAVE_EGL) && defined(HAVE_OPENGLES2)
// Use regular textures if we use HW render.
/* Use regular textures if we use HW render. */
gl->egl_images = !gl->hw_render_use && gl_check_eglimage_proc() &&
gfx_ctx_image_buffer_init(gl, video);
#else

View File

@ -109,7 +109,7 @@ void *glkitview_init(void)
}
#ifdef IOS
void apple_bind_game_view_fbo(void)
void cocoagl_bind_game_view_fbo(void)
{
if (g_context)
[g_view bindDrawable];
@ -133,7 +133,7 @@ static RAScreen* get_chosen_screen(void)
#endif
}
void apple_gfx_ctx_update(void)
void cocoagl_gfx_ctx_update(void)
{
#ifdef OSX
#if MAC_OS_X_VERSION_10_7 && !defined(HAVE_NSOPENGL)
@ -144,7 +144,7 @@ void apple_gfx_ctx_update(void)
#endif
}
static bool apple_gfx_ctx_init(void *data)
static bool cocoagl_gfx_ctx_init(void *data)
{
(void)data;
@ -192,7 +192,7 @@ static bool apple_gfx_ctx_init(void *data)
return true;
}
static void apple_gfx_ctx_destroy(void *data)
static void cocoagl_gfx_ctx_destroy(void *data)
{
(void)data;
@ -216,7 +216,7 @@ static void apple_gfx_ctx_destroy(void *data)
g_context = nil;
}
static bool apple_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor)
static bool cocoagl_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor)
{
(void)data;
#if defined(IOS)
@ -233,7 +233,7 @@ static bool apple_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned ma
return true;
}
static void apple_gfx_ctx_swap_interval(void *data, unsigned interval)
static void cocoagl_gfx_ctx_swap_interval(void *data, unsigned interval)
{
(void)data;
#ifdef IOS // < No way to disable Vsync on iOS?
@ -251,7 +251,7 @@ static void apple_gfx_ctx_swap_interval(void *data, unsigned interval)
#endif
}
static bool apple_gfx_ctx_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen)
static bool cocoagl_gfx_ctx_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen)
{
#ifdef OSX
RAGameView *g_view = (RAGameView*)nsview_get_ptr();
@ -276,12 +276,12 @@ static bool apple_gfx_ctx_set_video_mode(void *data, unsigned width, unsigned he
(void)data;
// TODO: Maybe iOS users should be apple to show/hide the status bar here?
// TODO: Maybe iOS users should be able to show/hide the status bar here?
return true;
}
float apple_gfx_ctx_get_native_scale(void)
float cocoagl_gfx_ctx_get_native_scale(void)
{
static float ret = 0.0f;
SEL selector = NSSelectorFromString(BOXSTRING("nativeScale"));
@ -309,11 +309,11 @@ float apple_gfx_ctx_get_native_scale(void)
return ret;
}
static void apple_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height)
static void cocoagl_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height)
{
RAScreen *screen = (RAScreen*)get_chosen_screen();
CGRect size = screen.bounds;
float screenscale = apple_gfx_ctx_get_native_scale();
float screenscale = cocoagl_gfx_ctx_get_native_scale();
#if defined(OSX)
RAGameView *g_view = (RAGameView*)nsview_get_ptr();
@ -327,7 +327,7 @@ static void apple_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned*
*height = CGRectGetHeight(size) * screenscale;
}
static void apple_gfx_ctx_update_window_title(void *data)
static void cocoagl_gfx_ctx_update_window_title(void *data)
{
static char buf[128], buf_fps[128];
bool got_text = video_monitor_get_fps(buf, sizeof(buf),
@ -346,7 +346,7 @@ static void apple_gfx_ctx_update_window_title(void *data)
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
}
static bool apple_gfx_ctx_get_metrics(void *data, enum display_metric_types type,
static bool cocoagl_gfx_ctx_get_metrics(void *data, enum display_metric_types type,
float *value)
{
#ifdef OSX
@ -361,7 +361,7 @@ static bool apple_gfx_ctx_get_metrics(void *data, enum display_metric_types type
float physical_width = display_physical_size.width;
float physical_height = display_physical_size.height;
#elif defined(IOS)
float scale = apple_gfx_ctx_get_native_scale();
float scale = cocoagl_gfx_ctx_get_native_scale();
CGRect screen_rect = [[UIScreen mainScreen] bounds];
float display_width = screen_rect.size.width;
@ -393,7 +393,7 @@ static bool apple_gfx_ctx_get_metrics(void *data, enum display_metric_types type
return true;
}
static bool apple_gfx_ctx_has_focus(void *data)
static bool cocoagl_gfx_ctx_has_focus(void *data)
{
(void)data;
#ifdef IOS
@ -403,7 +403,7 @@ static bool apple_gfx_ctx_has_focus(void *data)
#endif
}
static bool apple_gfx_ctx_suppress_screensaver(void *data, bool enable)
static bool cocoagl_gfx_ctx_suppress_screensaver(void *data, bool enable)
{
(void)data;
(void)enable;
@ -411,7 +411,7 @@ static bool apple_gfx_ctx_suppress_screensaver(void *data, bool enable)
return false;
}
static bool apple_gfx_ctx_has_windowed(void *data)
static bool cocoagl_gfx_ctx_has_windowed(void *data)
{
(void)data;
@ -422,24 +422,27 @@ static bool apple_gfx_ctx_has_windowed(void *data)
#endif
}
static void apple_gfx_ctx_swap_buffers(void *data)
static void cocoagl_gfx_ctx_swap_buffers(void *data)
{
if (!(--g_fast_forward_skips < 0))
return;
#ifdef OSX
#if defined(OSX)
#ifdef HAVE_NSOPENGL
[g_context flushBuffer];
#else
if (g_context.CGLContextObj)
CGLFlushDrawable(g_context.CGLContextObj);
#endif
#elif defined(IOS)
if (g_view)
[g_view display];
#endif
g_fast_forward_skips = g_is_syncing ? 0 : 3;
}
static gfx_ctx_proc_t apple_gfx_ctx_get_proc_address(const char *symbol_name)
static gfx_ctx_proc_t cocoagl_gfx_ctx_get_proc_address(const char *symbol_name)
{
return (gfx_ctx_proc_t)CFBundleGetFunctionPointerForName(CFBundleGetBundleWithIdentifier(GLFrameworkID),
(
@ -452,7 +455,7 @@ CFStringRef)BOXSTRING(symbol_name)
);
}
static void apple_gfx_ctx_check_window(void *data, bool *quit,
static void cocoagl_gfx_ctx_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
unsigned new_width, new_height;
@ -460,7 +463,7 @@ static void apple_gfx_ctx_check_window(void *data, bool *quit,
*quit = false;
apple_gfx_ctx_get_video_size(data, &new_width, &new_height);
cocoagl_gfx_ctx_get_video_size(data, &new_width, &new_height);
if (new_width != *width || new_height != *height)
{
*width = new_width;
@ -469,21 +472,21 @@ static void apple_gfx_ctx_check_window(void *data, bool *quit,
}
}
static void apple_gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
static void cocoagl_gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
}
static void apple_gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data)
static void cocoagl_gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data)
{
(void)data;
*input = NULL;
*input_data = NULL;
}
static void apple_gfx_ctx_bind_hw_render(void *data, bool enable)
static void cocoagl_gfx_ctx_bind_hw_render(void *data, bool enable)
{
(void)data;
g_use_hw_ctx = enable;
@ -494,30 +497,30 @@ static void apple_gfx_ctx_bind_hw_render(void *data, bool enable)
[g_context makeCurrentContext];
}
const gfx_ctx_driver_t gfx_ctx_apple = {
apple_gfx_ctx_init,
apple_gfx_ctx_destroy,
apple_gfx_ctx_bind_api,
apple_gfx_ctx_swap_interval,
apple_gfx_ctx_set_video_mode,
apple_gfx_ctx_get_video_size,
const gfx_ctx_driver_t gfx_ctx_cocoagl = {
cocoagl_gfx_ctx_init,
cocoagl_gfx_ctx_destroy,
cocoagl_gfx_ctx_bind_api,
cocoagl_gfx_ctx_swap_interval,
cocoagl_gfx_ctx_set_video_mode,
cocoagl_gfx_ctx_get_video_size,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
apple_gfx_ctx_get_metrics,
cocoagl_gfx_ctx_get_metrics,
NULL,
apple_gfx_ctx_update_window_title,
apple_gfx_ctx_check_window,
apple_gfx_ctx_set_resize,
apple_gfx_ctx_has_focus,
apple_gfx_ctx_suppress_screensaver,
apple_gfx_ctx_has_windowed,
apple_gfx_ctx_swap_buffers,
apple_gfx_ctx_input_driver,
apple_gfx_ctx_get_proc_address,
cocoagl_gfx_ctx_update_window_title,
cocoagl_gfx_ctx_check_window,
cocoagl_gfx_ctx_set_resize,
cocoagl_gfx_ctx_has_focus,
cocoagl_gfx_ctx_suppress_screensaver,
cocoagl_gfx_ctx_has_windowed,
cocoagl_gfx_ctx_swap_buffers,
cocoagl_gfx_ctx_input_driver,
cocoagl_gfx_ctx_get_proc_address,
NULL,
NULL,
NULL,
"apple",
apple_gfx_ctx_bind_hw_render,
"cocoagl",
cocoagl_gfx_ctx_bind_hw_render,
};

View File

@ -933,7 +933,7 @@ static bool gfx_ctx_drm_egl_bind_api(void *data,
case GFX_CTX_OPENVG_API:
return eglBindAPI(EGL_OPENVG_API);
default:
return false;
break;
}
return false;

View File

@ -200,8 +200,10 @@ static bool gfx_ctx_emscripten_bind_api(void *data,
case GFX_CTX_OPENGL_ES_API:
return eglBindAPI(EGL_OPENGL_ES_API);
default:
return false;
break;
}
return false;
}
static void gfx_ctx_emscripten_destroy(void *data)

View File

@ -22,8 +22,6 @@
#include <signal.h>
#include <stdint.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <GL/glx.h>
static int (*g_pglSwapInterval)(int);

View File

@ -368,8 +368,10 @@ static bool gfx_ctx_vc_bind_api(void *data,
case GFX_CTX_OPENVG_API:
return eglBindAPI(EGL_OPENVG_API);
default:
return false;
break;
}
return false;
}
static void gfx_ctx_vc_destroy(void *data)

View File

@ -721,8 +721,10 @@ static bool gfx_ctx_wl_bind_api(void *data,
case GFX_CTX_OPENVG_API:
return eglBindAPI(EGL_OPENVG_API);
default:
return false;
break;
}
return false;
}
static void gfx_ctx_wl_bind_hw_render(void *data, bool enable)

View File

@ -28,8 +28,6 @@
#include <stdint.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#ifndef EGL_OPENGL_ES3_BIT_KHR
#define EGL_OPENGL_ES3_BIT_KHR 0x0040
@ -783,8 +781,10 @@ static bool gfx_ctx_xegl_bind_api(void *data,
case GFX_CTX_OPENVG_API:
return eglBindAPI(EGL_OPENVG_API);
default:
return false;
break;
}
return false;
}
static void gfx_ctx_xegl_show_mouse(void *data, bool state)

View File

@ -25,7 +25,7 @@ static const font_renderer_driver_t *font_backends[] = {
#ifdef HAVE_FREETYPE
&freetype_font_renderer,
#endif
#ifdef __APPLE__
#if defined(__APPLE__) && defined(HAVE_CORETEXT)
&coretext_font_renderer,
#endif
&bitmap_font_renderer,

View File

@ -19,7 +19,9 @@
#endif
#include <formats/image.h>
#ifdef HAVE_RPNG
#include <formats/rpng.h>
#endif
#include <formats/tga.h>
#ifdef _XBOX1
#include "../d3d/d3d_wrapper.h"
@ -46,7 +48,7 @@
#endif
#ifdef HAVE_ZLIB
#ifdef HAVE_RPNG
static bool rpng_image_load_argb_shift(const char *path,
struct texture_image *out_img,
unsigned a_shift, unsigned r_shift,
@ -397,13 +399,12 @@ bool texture_image_load(struct texture_image *out_img, const char *path)
if (buf)
free(buf);
}
#ifdef HAVE_ZLIB
#ifdef HAVE_RPNG
else if (strstr(path, ".png"))
{
ret = rpng_image_load_argb_shift(path, out_img,
a_shift, r_shift, g_shift, b_shift);
}
#endif
#ifdef GEKKO
if (ret)
@ -416,6 +417,9 @@ bool texture_image_load(struct texture_image *out_img, const char *path)
}
#endif
#endif
return ret;
}
#endif

View File

@ -59,9 +59,8 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
#if defined(__QNX__)
&gfx_ctx_bbqnx,
#endif
#if defined(IOS) || defined(OSX)
/* Don't use __APPLE__ as it breaks basic SDL builds. */
&gfx_ctx_apple,
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
&gfx_ctx_cocoagl,
#endif
#if (defined(HAVE_SDL) || defined(HAVE_SDL2)) && defined(HAVE_OPENGL)
&gfx_ctx_sdl_gl,
@ -91,6 +90,15 @@ void gfx_ctx_free(void *data)
ctx = NULL;
}
const char *gfx_ctx_get_ident(void)
{
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
if (!ctx)
return NULL;
return ctx->ident;
}
void gfx_ctx_update_window_title(void *data)
{
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
@ -174,6 +182,8 @@ bool gfx_ctx_get_metrics(enum display_metric_types type, float *value)
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
if (!ctx || !driver)
return false;
if (!ctx->get_metrics)
return false;
return ctx->get_metrics(driver->video_context_data, type,
value);
}

View File

@ -163,7 +163,7 @@ extern const gfx_ctx_driver_t gfx_ctx_ps3;
extern const gfx_ctx_driver_t gfx_ctx_wgl;
extern const gfx_ctx_driver_t gfx_ctx_videocore;
extern const gfx_ctx_driver_t gfx_ctx_bbqnx;
extern const gfx_ctx_driver_t gfx_ctx_apple;
extern const gfx_ctx_driver_t gfx_ctx_cocoagl;
extern const gfx_ctx_driver_t gfx_ctx_emscripten;
extern const gfx_ctx_driver_t gfx_ctx_null;
@ -243,6 +243,8 @@ void gfx_ctx_get_video_output_prev(void *data);
void gfx_ctx_get_video_output_next(void *data);
const char *gfx_ctx_get_ident(void);
void gfx_ctx_free(void *data);
void gfx_ctx_input_driver(void *data,

View File

@ -116,13 +116,7 @@ VIDEO CONTEXT
#if defined(HAVE_VIDEOCORE)
#include "../gfx/drivers_context/vc_egl_ctx.c"
#endif
#if defined(HAVE_X11) && !defined(HAVE_OPENGLES)
#include "../gfx/drivers_context/glx_ctx.c"
#endif
#if defined(HAVE_EGL)
#include "../gfx/drivers_context/xegl_ctx.c"
#endif
#if defined(_WIN32) && !defined(_XBOX)
#include "../gfx/drivers_context/wgl_ctx.c"
@ -131,8 +125,17 @@ VIDEO CONTEXT
#endif
#ifdef HAVE_X11
#if defined(HAVE_X11)
#include "../gfx/common/x11_common.c"
#ifndef HAVE_OPENGLES
#include "../gfx/drivers_context/glx_ctx.c"
#endif
#ifdef HAVE_EGL
#include "../gfx/drivers_context/xegl_ctx.c"
#endif
#endif
@ -170,10 +173,13 @@ VIDEO IMAGE
#include "../gfx/video_texture.c"
#include "../libretro-common/formats/tga/tga_decode.c"
#ifdef HAVE_RPNG
#include "../libretro-common/formats/png/rpng_fbio.c"
#include "../libretro-common/formats/png/rpng_nbio.c"
#include "../libretro-common/formats/png/rpng_decode.c"
#include "../libretro-common/formats/png/rpng_encode.c"
#endif
/*============================================================
VIDEO DRIVER
@ -244,7 +250,7 @@ FONTS
#include "../gfx/drivers_font_renderer/freetype.c"
#endif
#if defined(__APPLE__)
#if defined(__APPLE__) && defined(HAVE_CORETEXT)
#include "../gfx/drivers_font_renderer/coretext.c"
#endif
@ -311,8 +317,8 @@ INPUT
#elif defined(ANDROID)
#include "../input/drivers/android_input.c"
#include "../input/drivers_joypad/android_joypad.c"
#elif defined(__APPLE__)
#include "../input/drivers/apple_input.c"
#elif defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
#include "../input/drivers/cocoa_input.c"
#elif defined(__QNX__)
#include "../input/drivers/qnx_input.c"
#include "../input/drivers_joypad/qnx_joypad.c"
@ -359,7 +365,7 @@ INPUT (HID)
#if defined(__APPLE__) && defined(IOS)
#include "../input/drivers_hid/btstack_hid.c"
#elif defined(__APPLE__) && !defined(IOS)
#elif defined(__APPLE__) && defined(HAVE_IOHIDMANAGER)
#include "../input/drivers_hid/apple_hid.c"
#endif
@ -603,10 +609,12 @@ FRONTEND
#include "../frontend/drivers/platform_ctr.c"
#elif defined(__QNX__)
#include "../frontend/drivers/platform_qnx.c"
#elif defined(OSX) || defined(IOS)
#elif defined(__APPLE__)
#include "../frontend/drivers/platform_apple.c"
#elif defined(ANDROID)
#include "../frontend/drivers/platform_android.c"
#elif defined(__linux__) && !defined(ANDROID)
#include "../frontend/drivers/platform_linux.c"
#endif
#include "../frontend/drivers/platform_null.c"
@ -632,6 +640,14 @@ MAIN
#include "../frontend/frontend.c"
#endif
/*============================================================
GIT
============================================================ */
#ifdef HAVE_GIT_VERSION
#include "../git_version.c"
#endif
/*============================================================
RETROARCH
============================================================ */
@ -645,6 +661,7 @@ RECORDING
============================================================ */
#include "../movie.c"
#include "../record/record_driver.c"
#include "../record/drivers/record_null.c"
/*============================================================
THREAD
@ -817,6 +834,7 @@ XML
#include "../database_info.c"
#endif
#ifdef __cplusplus
}
#endif

View File

@ -23,19 +23,27 @@
#define __IPHONE_OS_VERSION_MAX_ALLOWED 00000
#endif
#if defined(HAVE_COCOATOUCH) || defined(HAVE_COCOA)
#include "../gfx/drivers_context/apple_cocoa_gl.m"
#include "../apple/common/apple_cocoa_common.m"
#if defined(HAVE_COCOATOUCH)
#if TARGET_OS_IPHONE
#include "../apple/iOS/platform.m"
#include "../apple/iOS/menu.m"
#include "../apple/iOS/browser.m"
#include "../apple/iOS/platform.m"
#include "../ui/drivers/ui_cocoatouch.m"
#else
#endif
#elif defined(HAVE_COCOA)
#include "../apple/OSX/platform.m"
#include "../apple/OSX/settings.m"
#endif
#endif
#ifdef HAVE_MFI
#include "../input/drivers_hid/mfi_hid.m"
#endif

View File

@ -20,7 +20,7 @@
#include "../input_common.h"
#include "../input_joypad.h"
#include "../input_keymaps.h"
#include "apple_input.h"
#include "cocoa_input.h"
#include "../../general.h"
#include "../../driver.h"
@ -125,18 +125,18 @@ const struct apple_key_name_map_entry apple_key_name_map[] =
{ "nul", 0x00},
};
void apple_input_enable_small_keyboard(bool on)
void cocoa_input_enable_small_keyboard(bool on)
{
driver_t *driver = driver_get_ptr();
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
if (apple)
apple->small_keyboard_enabled = on;
}
void apple_input_enable_icade(bool on)
void cocoa_input_enable_icade(bool on)
{
driver_t *driver = driver_get_ptr();
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
if (!apple)
return;
@ -145,20 +145,20 @@ void apple_input_enable_icade(bool on)
apple->icade_buttons = 0;
}
void apple_input_reset_icade_buttons(void)
void cocoa_input_reset_icade_buttons(void)
{
driver_t *driver = driver_get_ptr();
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
if (apple)
apple->icade_buttons = 0;
}
int32_t apple_input_find_any_key(void)
int32_t cocoa_input_find_any_key(void)
{
unsigned i;
driver_t *driver =driver_get_ptr();
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
if (!apple)
return 0;
@ -173,11 +173,11 @@ int32_t apple_input_find_any_key(void)
return 0;
}
int32_t apple_input_find_any_button(uint32_t port)
int32_t cocoa_input_find_any_button(uint32_t port)
{
unsigned i, buttons = 0;
driver_t *driver = driver_get_ptr();
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
if (!apple)
return -1;
@ -197,11 +197,11 @@ int32_t apple_input_find_any_button(uint32_t port)
return -1;
}
int32_t apple_input_find_any_axis(uint32_t port)
int32_t cocoa_input_find_any_axis(uint32_t port)
{
int i;
driver_t *driver = driver_get_ptr();
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
if (apple && apple->joypad)
apple->joypad->poll();
@ -217,7 +217,7 @@ int32_t apple_input_find_any_axis(uint32_t port)
return 0;
}
static int16_t apple_input_is_pressed(apple_input_data_t *apple, unsigned port_num,
static int16_t cocoa_input_is_pressed(cocoa_input_data_t *apple, unsigned port_num,
const struct retro_keybind *binds, unsigned id)
{
if (id < RARCH_BIND_LIST_END)
@ -229,10 +229,10 @@ static int16_t apple_input_is_pressed(apple_input_data_t *apple, unsigned port_n
return 0;
}
static void *apple_input_init(void)
static void *cocoa_input_init(void)
{
settings_t *settings = config_get_ptr();
apple_input_data_t *apple = (apple_input_data_t*)calloc(1, sizeof(*apple));
cocoa_input_data_t *apple = (cocoa_input_data_t*)calloc(1, sizeof(*apple));
if (!apple)
return NULL;
@ -243,10 +243,10 @@ static void *apple_input_init(void)
return apple;
}
static void apple_input_poll(void *data)
static void cocoa_input_poll(void *data)
{
uint32_t i;
apple_input_data_t *apple = (apple_input_data_t*)data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
if (!apple)
return;
@ -267,7 +267,7 @@ static void apple_input_poll(void *data)
BIT32_SET(apple->buttons[0], apple->icade_buttons);
}
static int16_t apple_mouse_state(apple_input_data_t *apple,
static int16_t cocoa_mouse_state(cocoa_input_data_t *apple,
unsigned id)
{
switch (id)
@ -289,7 +289,7 @@ static int16_t apple_mouse_state(apple_input_data_t *apple,
return 0;
}
static int16_t apple_pointer_state(apple_input_data_t *apple,
static int16_t cocoa_pointer_state(cocoa_input_data_t *apple,
unsigned device, unsigned idx, unsigned id)
{
const bool want_full = (device == RARCH_DEVICE_POINTER_SCREEN);
@ -297,7 +297,7 @@ static int16_t apple_pointer_state(apple_input_data_t *apple,
if (idx < apple->touch_count && (idx < MAX_TOUCHES))
{
int16_t x, y;
const apple_touch_data_t *touch = (const apple_touch_data_t *)
const cocoa_touch_data_t *touch = (const cocoa_touch_data_t *)
&apple->touches[idx];
if (!touch)
@ -326,17 +326,17 @@ static int16_t apple_pointer_state(apple_input_data_t *apple,
return 0;
}
static int16_t apple_keyboard_state(apple_input_data_t *apple, unsigned id)
static int16_t cocoa_keyboard_state(cocoa_input_data_t *apple, unsigned id)
{
unsigned bit = input_keymaps_translate_rk_to_keysym((enum retro_key)id);
return (id < RETROK_LAST) && apple->key_state[bit];
}
static int16_t apple_input_state(void *data,
static int16_t cocoa_input_state(void *data,
const struct retro_keybind **binds, unsigned port,
unsigned device, unsigned idx, unsigned id)
{
apple_input_data_t *apple = (apple_input_data_t*)data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
if (!apple || !apple->joypad)
return 0;
@ -344,36 +344,36 @@ static int16_t apple_input_state(void *data,
switch (device)
{
case RETRO_DEVICE_JOYPAD:
return apple_input_is_pressed(apple, port, binds[port], id) ||
return cocoa_input_is_pressed(apple, port, binds[port], id) ||
input_joypad_pressed(apple->joypad, port, binds[port], id);
case RETRO_DEVICE_ANALOG:
return input_joypad_analog(apple->joypad, port,
idx, id, binds[port]);
case RETRO_DEVICE_KEYBOARD:
return apple_keyboard_state(apple, id);
return cocoa_keyboard_state(apple, id);
case RETRO_DEVICE_MOUSE:
return apple_mouse_state(apple, id);
return cocoa_mouse_state(apple, id);
case RETRO_DEVICE_POINTER:
case RARCH_DEVICE_POINTER_SCREEN:
return apple_pointer_state(apple, device, idx, id);
return cocoa_pointer_state(apple, device, idx, id);
}
return 0;
}
static bool apple_input_bind_button_pressed(void *data, int key)
static bool cocoa_input_bind_button_pressed(void *data, int key)
{
apple_input_data_t *apple = (apple_input_data_t*)data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
settings_t *settings = config_get_ptr();
if (apple && apple->joypad)
return apple_input_is_pressed(apple, 0, settings->input.binds[0], key) ||
return cocoa_input_is_pressed(apple, 0, settings->input.binds[0], key) ||
input_joypad_pressed(apple->joypad, 0, settings->input.binds[0], key);
return false;
}
static void apple_input_free(void *data)
static void cocoa_input_free(void *data)
{
apple_input_data_t *apple = (apple_input_data_t*)data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
if (!apple || !data)
return;
@ -384,10 +384,10 @@ static void apple_input_free(void *data)
free(apple);
}
static bool apple_input_set_rumble(void *data,
static bool cocoa_input_set_rumble(void *data,
unsigned port, enum retro_rumble_effect effect, uint16_t strength)
{
apple_input_data_t *apple = (apple_input_data_t*)data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
if (apple && apple->joypad)
return input_joypad_set_rumble(apple->joypad,
@ -395,7 +395,7 @@ static bool apple_input_set_rumble(void *data,
return false;
}
static uint64_t apple_input_get_capabilities(void *data)
static uint64_t cocoa_input_get_capabilities(void *data)
{
(void)data;
@ -407,33 +407,33 @@ static uint64_t apple_input_get_capabilities(void *data)
(1 << RETRO_DEVICE_ANALOG);
}
static void apple_input_grab_mouse(void *data, bool state)
static void cocoa_input_grab_mouse(void *data, bool state)
{
/* Dummy for now. Might be useful in the future. */
(void)data;
(void)state;
}
static const input_device_driver_t *apple_input_get_joypad_driver(void *data)
static const input_device_driver_t *cocoa_input_get_joypad_driver(void *data)
{
apple_input_data_t *apple = (apple_input_data_t*)data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
if (apple && apple->joypad)
return apple->joypad;
return NULL;
}
input_driver_t input_apple = {
apple_input_init,
apple_input_poll,
apple_input_state,
apple_input_bind_button_pressed,
apple_input_free,
input_driver_t input_cocoa = {
cocoa_input_init,
cocoa_input_poll,
cocoa_input_state,
cocoa_input_bind_button_pressed,
cocoa_input_free,
NULL,
NULL,
apple_input_get_capabilities,
"apple_input",
apple_input_grab_mouse,
apple_input_set_rumble,
apple_input_get_joypad_driver
cocoa_input_get_capabilities,
"cocoa",
cocoa_input_grab_mouse,
cocoa_input_set_rumble,
cocoa_input_get_joypad_driver
};

View File

@ -14,8 +14,8 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __APPLE_RARCH_INPUT_H__
#define __APPLE_RARCH_INPUT_H__
#ifndef __COCOA_INPUT_H__
#define __COCOA_INPUT_H__
#include <stdint.h>
#include "../../general.h"
@ -33,11 +33,11 @@ typedef struct
int16_t screen_x, screen_y;
int16_t fixed_x, fixed_y;
int16_t full_x, full_y;
} apple_touch_data_t;
} cocoa_touch_data_t;
typedef struct
{
apple_touch_data_t touches[MAX_TOUCHES];
cocoa_touch_data_t touches[MAX_TOUCHES];
uint32_t touch_count;
uint32_t mouse_buttons;
@ -58,21 +58,21 @@ typedef struct
uint32_t icade_buttons;
const input_device_driver_t *joypad;
} apple_input_data_t;
} cocoa_input_data_t;
void apple_input_enable_icade(bool on);
void cocoa_input_enable_icade(bool on);
void apple_input_enable_small_keyboard(bool on);
void cocoa_input_enable_small_keyboard(bool on);
void apple_input_reset_icade_buttons(void);
void cocoa_input_reset_icade_buttons(void);
void apple_input_keyboard_event(bool down, unsigned code,
void cocoa_input_keyboard_event(bool down, unsigned code,
uint32_t character, uint32_t mod, unsigned device);
extern int32_t apple_input_find_any_key(void);
extern int32_t cocoa_input_find_any_key(void);
extern int32_t apple_input_find_any_button(uint32_t port);
extern int32_t cocoa_input_find_any_button(uint32_t port);
extern int32_t apple_input_find_any_axis(uint32_t port);
extern int32_t cocoa_input_find_any_axis(uint32_t port);
#endif

View File

@ -655,7 +655,7 @@ static const input_device_driver_t *dinput_get_joypad_driver(void *data)
{
struct dinput_input *di = (struct dinput_input*)data;
if (!di)
return false;
return NULL;
return di->joypad;
}

View File

@ -17,7 +17,7 @@
#include <IOKit/hid/IOHIDManager.h>
#include <IOKit/hid/IOHIDKeys.h>
#include "../connect/joypad_connection.h"
#include "../drivers/apple_input.h"
#include "../drivers/cocoa_input.h"
#include "../input_hid_driver.h"
typedef struct apple_hid
@ -139,7 +139,7 @@ static void apple_hid_device_input_callback(void *data, IOReturn result,
void* sender, IOHIDValueRef value)
{
driver_t *driver = driver_get_ptr();
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
struct apple_hid_adapter *adapter = (struct apple_hid_adapter*)data;
IOHIDElementRef element = IOHIDValueGetElement(value);
uint32_t type = IOHIDElementGetType(element);
@ -210,7 +210,7 @@ static void apple_hid_device_input_callback(void *data, IOReturn result,
static void apple_hid_device_remove(void *data, IOReturn result, void* sender)
{
driver_t *driver = driver_get_ptr();
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
struct apple_hid_adapter *adapter = (struct apple_hid_adapter*)data;
apple_hid_t *hid = driver ? (apple_hid_t*)driver->hid_data : NULL;

View File

@ -188,6 +188,7 @@ static int add_adapter(void *data, struct libusb_device *dev)
if (!adapter || !hid)
{
free(adapter);
fprintf(stderr, "Allocation of adapter failed.\n");
return -1;
}

View File

@ -17,7 +17,7 @@
#import <GameController/GameController.h>
#include <boolean.h>
#include "mfi_hid.h"
#include "../../input/drivers/apple_input.h"
#include "../../input/drivers/cocoa_input.h"
enum
{
@ -44,7 +44,7 @@ static void apple_gamecontroller_poll(GCController *controller)
{
uint32_t slot, pause;
driver_t *driver = driver_get_ptr();
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
if (!apple || !controller || controller.playerIndex == MAX_USERS)
return;
@ -105,7 +105,7 @@ void apple_gamecontroller_poll_all(void)
static void apple_gamecontroller_register(GCGamepad *gamepad)
{
driver_t *driver = driver_get_ptr();
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
gamepad.valueChangedHandler = ^(GCGamepad *updateGamepad, GCControllerElement *element) {
apple_gamecontroller_poll(updateGamepad.controller);
};

View File

@ -19,7 +19,7 @@
#include "../input_common.h"
#include "../input_keymaps.h"
#include "../drivers/apple_input.h"
#include "../drivers/cocoa_input.h"
#include "../../general.h"
#include "../../driver.h"
@ -70,7 +70,7 @@ static bool handle_small_keyboard(unsigned* code, bool down)
{ 0 }
};
driver_t *driver = driver_get_ptr();
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
unsigned translated_code = 0;
if (!map_initialized)
@ -122,7 +122,7 @@ static void handle_icade_event(unsigned keycode)
{ false, 4 }, { true , 1 }, { false, -1 }, { false, -1 } // C
};
driver_t *driver = driver_get_ptr();
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
if (apple->icade_enabled && (keycode < 0x20)
&& (icade_map[keycode].button >= 0))
@ -136,11 +136,11 @@ static void handle_icade_event(unsigned keycode)
}
}
void apple_input_keyboard_event(bool down,
void cocoa_input_keyboard_event(bool down,
unsigned code, uint32_t character, uint32_t mod, unsigned device)
{
driver_t *driver = driver_get_ptr();
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
if (!apple)
return;

View File

@ -59,9 +59,8 @@ static const input_driver_t *input_drivers[] = {
#if defined(__linux__) && !defined(ANDROID)
&input_linuxraw,
#endif
#if defined(IOS) || defined(OSX)
/* Don't use __APPLE__ as it breaks basic SDL builds */
&input_apple,
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
&input_cocoa,
#endif
#ifdef __QNX__
&input_qnx,

View File

@ -90,7 +90,7 @@ extern input_driver_t input_gx;
extern input_driver_t input_xinput;
extern input_driver_t input_linuxraw;
extern input_driver_t input_udev;
extern input_driver_t input_apple;
extern input_driver_t input_cocoa;
extern input_driver_t input_qnx;
extern input_driver_t input_rwebinput;
extern input_driver_t input_null;

View File

@ -26,7 +26,7 @@ static hid_driver_t *hid_drivers[] = {
#if defined(__APPLE__) && defined(IOS)
&btstack_hid,
#endif
#if defined(__APPLE__) && !defined(IOS)
#if defined(__APPLE__) && defined(HAVE_IOHIDMANAGER)
&apple_hid,
#endif
#ifdef HAVE_LIBUSB

View File

@ -34,6 +34,8 @@ extern "C" {
bool string_is_empty(const char *data);
char *string_to_upper(char *s);
char *string_replace_substring(const char *in, const char *pattern,
const char *by);

View File

@ -21,6 +21,7 @@
*/
#include <string/stdstring.h>
#include <ctype.h>
bool string_is_empty(const char *data)
{
@ -35,6 +36,14 @@ bool string_is_empty(const char *data)
return false;
}
char *string_to_upper(char *s)
{
unsigned char *ucs = (unsigned char *)s;
for ( ; *ucs != '\0'; ucs++)
*ucs = toupper(*ucs);
return s;
}
char *string_replace_substring(const char *in, const char *pattern, const char *replacement)
{
char *needle = NULL;

View File

@ -35,10 +35,8 @@
typedef struct glui_handle
{
unsigned line_height;
unsigned glyph_width;
unsigned margin;
unsigned term_width;
unsigned term_height;
unsigned ticker_limit;
char box_message[PATH_MAX_LENGTH];
struct
{
@ -49,7 +47,7 @@ typedef struct glui_handle
} bg;
} textures;
gl_font_raster_block_t raster_block;
gl_font_raster_block_t list_block;
bool use_blocks;
} glui_handle_t;
@ -81,7 +79,7 @@ static int glui_entry_iterate(unsigned action)
return -1;
}
static void glui_blit_line(gl_t *gl, float x, float y, const char *message, uint32_t color)
static void glui_blit_line(gl_t *gl, float x, float y, const char *message, uint32_t color, enum text_alignment text_align)
{
struct font_params params = {0};
@ -90,6 +88,7 @@ static void glui_blit_line(gl_t *gl, float x, float y, const char *message, uint
params.scale = 1.0;
params.color = color;
params.full_screen = true;
params.text_align = text_align;
video_driver_set_osd_msg(message, &params, NULL);
}
@ -160,9 +159,9 @@ static void glui_render_background(settings_t *settings,
gl->coords.color = gl->white_color_ptr;
}
static void glui_draw_cursor(gl_t *gl, float x, float y)
static void glui_render_quad(gl_t *gl, int x, int y, int w, int h,
float r, float g, float b, float a)
{
struct gl_coords coords;
static const GLfloat vertex[] = {
0, 0,
1, 0,
@ -176,14 +175,17 @@ static void glui_draw_cursor(gl_t *gl, float x, float y)
0, 0,
1, 0,
};
struct gl_coords coords;
GLfloat color[] = {
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f,
r, g, b, a,
r, g, b, a,
r, g, b, a,
r, g, b, a,
};
glViewport(x - 5, gl->win_height - y + 5, 11, 11);
glViewport(x, gl->win_height - y - h, w, h);
coords.vertices = 4;
coords.vertex = vertex;
@ -204,6 +206,11 @@ static void glui_draw_cursor(gl_t *gl, float x, float y)
gl->coords.color = gl->white_color_ptr;
}
static void glui_draw_cursor(gl_t *gl, float x, float y)
{
glui_render_quad(gl, x-5, y-5, 10, 10, 1, 1, 1, 1);
}
static void glui_get_message(const char *message)
{
glui_handle_t *glui = NULL;
@ -253,8 +260,8 @@ static void glui_render_messagebox(const char *message)
if (list->elems == 0)
goto end;
x = gl->win_width / 2 - strlen(list->elems[0].data) * glui->glyph_width / 2;
y = gl->win_height / 2 - list->size * glui->line_height / 2;
x = gl->win_width / 2;
y = gl->win_height / 2 - list->size * settings->video.font_size / 2;
normal_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_normal_color);
@ -262,7 +269,7 @@ static void glui_render_messagebox(const char *message)
{
const char *msg = list->elems[i].data;
if (msg)
glui_blit_line(gl, x, y + i * glui->line_height, msg, normal_color);
glui_blit_line(gl, x, y + i * settings->video.font_size, msg, normal_color, TEXT_ALIGN_CENTER);
}
end:
@ -271,6 +278,7 @@ end:
static void glui_render(void)
{
int bottom;
glui_handle_t *glui = NULL;
gl_t *gl = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
@ -289,46 +297,121 @@ static void glui_render(void)
if (!gl)
return;
glui->line_height = settings->video.font_size * 4 / 3;
glui->glyph_width = glui->line_height / 2;
glui->margin = gl->win_width / 20 ;
glui->term_width = (gl->win_width - glui->margin * 2) / glui->glyph_width;
glui->term_height = (gl->win_height - glui->margin * 2) / glui->line_height - 2;
menu->frame_buf.width = gl->win_width;
menu->frame_buf.height = gl->win_height;
menu->mouse.ptr = (menu->mouse.y - glui->margin) /
glui->line_height - 2 + menu->begin;
if (settings->menu.pointer.enable)
{
menu->pointer.ptr =
(menu->pointer.y - glui->line_height + menu->scroll_y - 16)
/ glui->line_height;
if (menu->mouse.wheeldown && menu->begin
< menu_list_get_size(menu->menu_list) - glui->term_height)
menu->begin++;
if (menu->pointer.dragging)
menu->scroll_y -= menu->pointer.dy;
}
if (menu->mouse.wheelup && menu->begin > 0)
menu->begin--;
if (settings->menu.mouse.enable)
{
if (menu->mouse.scrolldown)
menu->scroll_y += 10;
/* Do not scroll if all items are visible. */
if (menu_list_get_size(menu->menu_list) <= glui->term_height)
menu->begin = 0;
if (menu->mouse.scrollup)
menu->scroll_y -= 10;
menu->mouse.ptr =
(menu->mouse.y - glui->line_height + menu->scroll_y - 16)
/ glui->line_height;
}
if (menu->scroll_y < 0)
menu->scroll_y = 0;
bottom = (menu_list_get_size(menu->menu_list)-1) * glui->line_height
- gl->win_height + menu->header_height * 2;
if (menu->scroll_y > bottom)
menu->scroll_y = bottom;
if ((menu_list_get_size(menu->menu_list)-1) * glui->line_height
< gl->win_height - menu->header_height*2)
menu->scroll_y = 0;
}
static void glui_render_menu_list(runloop_t *runloop, gl_t *gl, glui_handle_t *glui,
menu_handle_t *menu, const char *label, uint32_t normal_color,
uint32_t hover_color)
{
const struct font_renderer *font_driver = (const struct font_renderer *)gl->font_driver;
size_t i = 0;
if (glui->use_blocks)
font_driver->bind_block(gl->font_handle, &glui->list_block);
if (!menu_display_update_pending())
goto draw_text;
glui->list_block.carr.coords.vertices = 0;
for (i = 0; i < menu_list_get_size(menu->menu_list); i++)
{
char message[PATH_MAX_LENGTH], type_str[PATH_MAX_LENGTH],
entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH],
path_buf[PATH_MAX_LENGTH];
const char *path = NULL, *entry_label = NULL;
unsigned type = 0, w = 0;
bool selected = false;
menu_file_list_cbs_t *cbs = NULL;
menu_list_get_at_offset(menu->menu_list->selection_buf, i, &path,
&entry_label, &type);
cbs = (menu_file_list_cbs_t*)
menu_list_get_actiondata_at_offset(menu->menu_list->selection_buf, i);
if (cbs && cbs->action_get_representation)
cbs->action_get_representation(menu->menu_list->selection_buf,
&w, type, i, label,
type_str, sizeof(type_str),
entry_label, path,
path_buf, sizeof(path_buf));
selected = (i == menu->navigation.selection_ptr);
menu_animation_ticker_line(entry_title_buf, glui->ticker_limit,
runloop->frames.video.count / 100, path_buf, selected);
menu_animation_ticker_line(type_str_buf, glui->ticker_limit,
runloop->frames.video.count / 100, type_str, selected);
strlcpy(message, entry_title_buf, sizeof(message));
unsigned y = menu->header_height - menu->scroll_y + (glui->line_height * i);
glui_blit_line(gl, glui->margin, y, message,
selected ? hover_color : normal_color, TEXT_ALIGN_LEFT);
glui_blit_line(gl, gl->win_width - glui->margin, y, type_str_buf,
selected ? hover_color : normal_color, TEXT_ALIGN_RIGHT);
}
draw_text:
if (glui->use_blocks)
{
font_driver->flush(gl->font_handle);
font_driver->bind_block(gl->font_handle, NULL);
}
}
static void glui_frame(void)
{
unsigned x, y;
size_t i;
char title[PATH_MAX_LENGTH], title_buf[PATH_MAX_LENGTH],
title_msg[PATH_MAX_LENGTH];
char timedate[PATH_MAX_LENGTH];
const char *dir = NULL;
const char *label = NULL;
unsigned menu_type = 0;
size_t end;
gl_t *gl = NULL;
glui_handle_t *glui = NULL;
const char *core_name = NULL;
const char *core_version = NULL;
const struct font_renderer *font_driver = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
settings_t *settings = config_get_ptr();
const uint32_t normal_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_normal_color);
@ -345,8 +428,6 @@ static void glui_frame(void)
if (!gl)
return;
font_driver = (const struct font_renderer*)gl->font_driver;
glui = (glui_handle_t*)menu->userdata;
if (!glui)
@ -361,34 +442,35 @@ static void glui_frame(void)
glui_render_background(settings, gl, glui, false);
if (glui->use_blocks)
{
font_driver->bind_block(gl->font_handle, &glui->raster_block);
menu_list_get_last_stack(menu->menu_list, &dir, &label, &menu_type);
if (!menu_display_update_pending())
goto draw_text;
}
get_title(label, dir, menu_type, title, sizeof(title));
glui->raster_block.carr.coords.vertices = 0;
glui_render_quad(gl, 0,
menu->header_height - menu->scroll_y + glui->line_height *
menu->navigation.selection_ptr - glui->line_height / 2 - 4,
gl->win_width, glui->line_height, 1, 1, 1, 0.1);
glui_render_menu_list(runloop, gl, glui, menu, label, normal_color, hover_color);
runloop->frames.video.current.menu.animation.is_active = false;
runloop->frames.video.current.menu.label.is_updated = false;
runloop->frames.video.current.menu.framebuf.dirty = false;
end = (menu->begin + glui->term_height <=
menu_list_get_size(menu->menu_list)) ?
menu->begin + glui->term_height :
menu_list_get_size(menu->menu_list);
glui_render_quad(gl, 0, 0, gl->win_width,
menu->header_height - glui->line_height/2 - 4, 0.2, 0.2, 0.2, 1);
menu_animation_ticker_line(title_buf, glui->ticker_limit,
runloop->frames.video.count / 100, title, true);
glui_blit_line(gl, gl->win_width/2, glui->line_height, title_buf, title_color, TEXT_ALIGN_CENTER);
menu_list_get_last_stack(menu->menu_list, &dir, &label, &menu_type);
if (file_list_get_size(menu->menu_list->menu_stack) > 1)
glui_blit_line(gl, glui->margin, glui->line_height, "BACK", title_color, TEXT_ALIGN_LEFT);
get_title(label, dir, menu_type, title, sizeof(title));
menu_animation_ticker_line(title_buf, glui->term_width - 3,
runloop->frames.video.count / glui->margin, title, true);
glui_blit_line(gl, glui->margin * 2, glui->margin + glui->line_height,
title_buf, title_color);
glui_render_quad(gl, 0,
gl->win_height - (menu->header_height - glui->line_height/2 + 4),
gl->win_width, menu->header_height - glui->line_height/2 + 4,
0.2, 0.2, 0.2, 1);
core_name = global->menu.info.library_name;
if (!core_name)
@ -407,69 +489,16 @@ static void glui_frame(void)
snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION,
core_name, core_version);
glui_blit_line(gl,
glui->margin * 2,
glui->margin + glui->term_height * glui->line_height
+ glui->line_height * 2, title_msg, title_color);
glui_blit_line(gl, glui->margin, gl->win_height - glui->line_height, title_msg,
title_color, TEXT_ALIGN_LEFT);
}
if (settings->menu.timedate_enable)
{
disp_timedate_set_label(timedate, sizeof(timedate), 0);
glui_blit_line(gl,
glui->margin * 14,
glui->margin + glui->term_height * glui->line_height
+ glui->line_height * 2, timedate, hover_color);
}
x = glui->margin;
y = glui->margin + glui->line_height * 2;
for (i = menu->begin; i < end; i++, y += glui->line_height)
{
char message[PATH_MAX_LENGTH], type_str[PATH_MAX_LENGTH],
entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH],
path_buf[PATH_MAX_LENGTH];
const char *path = NULL, *entry_label = NULL;
unsigned type = 0, w = 0;
bool selected = false;
menu_file_list_cbs_t *cbs = NULL;
menu_list_get_at_offset(menu->menu_list->selection_buf, i, &path,
&entry_label, &type);
cbs = (menu_file_list_cbs_t*)
menu_list_get_actiondata_at_offset(menu->menu_list->selection_buf,
i);
if (cbs && cbs->action_get_representation)
cbs->action_get_representation(menu->menu_list->selection_buf,
&w, type, i, label,
type_str, sizeof(type_str),
entry_label, path,
path_buf, sizeof(path_buf));
selected = (i == menu->navigation.selection_ptr);
menu_animation_ticker_line(entry_title_buf, glui->term_width - (w + 1 + 2),
runloop->frames.video.count / glui->margin, path_buf, selected);
menu_animation_ticker_line(type_str_buf, w,
runloop->frames.video.count / glui->margin, type_str, selected);
strlcpy(message, entry_title_buf, sizeof(message));
glui_blit_line(gl, x, y, message, selected ? hover_color : normal_color);
glui_blit_line(gl, gl->win_width - glui->glyph_width * w - glui->margin ,
y, type_str_buf, selected ? hover_color : normal_color);
}
draw_text:
if (glui->use_blocks)
{
font_driver->flush(gl->font_handle);
font_driver->bind_block(gl->font_handle, NULL);
glui_blit_line(gl, gl->win_width - glui->margin,
gl->win_height - glui->line_height, timedate, hover_color,
TEXT_ALIGN_RIGHT);
}
if (menu->keyboard.display)
@ -512,7 +541,7 @@ static void *glui_init(void)
}
font_driver = (const struct font_renderer*)gl->font_driver;
menu = (menu_handle_t*)calloc(1, sizeof(*menu));
menu = (menu_handle_t*)calloc(1, sizeof(*menu));
if (!menu)
goto error;
@ -522,7 +551,12 @@ static void *glui_init(void)
if (!menu->userdata)
goto error;
glui = (glui_handle_t*)menu->userdata;
glui = (glui_handle_t*)menu->userdata;
glui->line_height = 44;
glui->margin = 22;
glui->ticker_limit = 44;
menu->header_height = 88;
glui->textures.bg.id = 0;
if (font_driver->bind_block && font_driver->flush)
@ -548,7 +582,7 @@ static void glui_free(void *data)
if (!glui)
return;
gl_coord_array_free(&glui->raster_block.carr);
gl_coord_array_free(&glui->list_block.carr);
font_driver = (const struct font_renderer*)gl->font_driver;
@ -562,8 +596,6 @@ static void glui_free(void *data)
free(menu->userdata);
}
static void glui_context_destroy(void)
{
glui_handle_t *glui = NULL;
@ -606,14 +638,18 @@ static bool glui_load_wallpaper(void *data)
static void glui_navigation_clear(bool pending_push)
{
menu_handle_t *menu = menu_driver_get_ptr();
if (menu)
menu->begin = 0;
if (!menu)
return;
menu->begin = 0;
menu->scroll_y = 0;
}
static void glui_navigation_set(bool scroll)
{
glui_handle_t *glui = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
gl_t *gl = (gl_t*)video_driver_get_ptr(NULL);
if (!menu)
return;
@ -625,16 +661,12 @@ static void glui_navigation_set(bool scroll)
if (!scroll)
return;
if (menu->navigation.selection_ptr < glui->term_height/2)
menu->begin = 0;
else if (menu->navigation.selection_ptr >= glui->term_height/2
&& menu->navigation.selection_ptr <
menu_list_get_size(menu->menu_list) - glui->term_height/2)
menu->begin = menu->navigation.selection_ptr - glui->term_height/2;
else if (menu->navigation.selection_ptr >=
menu_list_get_size(menu->menu_list) - glui->term_height/2)
menu->begin = menu_list_get_size(menu->menu_list)
- glui->term_height;
int half = (gl->win_height / glui->line_height) / 2;
if (menu->navigation.selection_ptr < half)
menu->scroll_y = 0;
else
menu->scroll_y = ((menu->navigation.selection_ptr + 2 - half) * glui->line_height);
}
static void glui_navigation_set_last(void)

View File

@ -349,6 +349,7 @@ static void rgui_blit_cursor(menu_handle_t *menu)
static void rgui_render(void)
{
size_t i, end;
int bottom;
char title[256], title_buf[256], title_msg[64];
char timedate[PATH_MAX_LENGTH];
unsigned x, y, menu_type = 0;
@ -383,19 +384,39 @@ static void rgui_render(void)
runloop->frames.video.current.menu.animation.is_active = false;
runloop->frames.video.current.menu.label.is_updated = false;
menu->mouse.ptr = menu->mouse.y / 11 - 2 + menu->begin;
if (settings->menu.pointer.enable)
{
menu->pointer.ptr = menu->pointer.y / 11 - 2 + menu->begin;
if (menu->mouse.scrolldown && menu->begin
< menu_list_get_size(menu->menu_list) - RGUI_TERM_HEIGHT)
menu->begin++;
if (menu->pointer.dragging)
{
menu->scroll_y += menu->pointer.dy;
menu->begin = -menu->scroll_y / 11 + 2;
if (menu->scroll_y > 0)
menu->scroll_y = 0;
}
}
if (settings->menu.mouse.enable)
{
if (menu->mouse.scrolldown && menu->begin
< menu_list_get_size(menu->menu_list) - RGUI_TERM_HEIGHT)
menu->begin++;
if (menu->mouse.scrollup && menu->begin > 0)
menu->begin--;
if (menu->mouse.scrollup && menu->begin > 0)
menu->begin--;
menu->mouse.ptr = menu->mouse.y / 11 - 2 + menu->begin;
}
/* Do not scroll if all items are visible. */
if (menu_list_get_size(menu->menu_list) <= RGUI_TERM_HEIGHT)
menu->begin = 0;
bottom = menu_list_get_size(menu->menu_list) - RGUI_TERM_HEIGHT;
if (menu->begin > bottom)
menu->begin = bottom;
end = (menu->begin + RGUI_TERM_HEIGHT <=
menu_list_get_size(menu->menu_list)) ?
menu->begin + RGUI_TERM_HEIGHT :
@ -412,13 +433,20 @@ static void rgui_render(void)
get_title(label, dir, menu_type, title, sizeof(title));
menu_animation_ticker_line(title_buf, RGUI_TERM_WIDTH - 3,
menu_animation_ticker_line(title_buf, RGUI_TERM_WIDTH - 10,
runloop->frames.video.count / RGUI_TERM_START_X, title, true);
hover_color = HOVER_COLOR(settings);
normal_color = NORMAL_COLOR(settings);
blit_line(menu, RGUI_TERM_START_X + RGUI_TERM_START_X, RGUI_TERM_START_X, title_buf, TITLE_COLOR(settings));
if (file_list_get_size(menu->menu_list->menu_stack) > 1)
blit_line(menu,
RGUI_TERM_START_X, RGUI_TERM_START_X,
"BACK", TITLE_COLOR(settings));
blit_line(menu,
RGUI_TERM_START_X + (RGUI_TERM_WIDTH - strlen(title_buf)) * FONT_WIDTH_STRIDE / 2,
RGUI_TERM_START_X, title_buf, TITLE_COLOR(settings));
core_name = global->menu.info.library_name;
if (!core_name)
@ -434,11 +462,10 @@ static void rgui_render(void)
if (!core_version)
core_version = "";
snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION,
core_name, core_version);
blit_line(menu,
RGUI_TERM_START_X + RGUI_TERM_START_X,
RGUI_TERM_START_X,
(RGUI_TERM_HEIGHT * FONT_HEIGHT_STRIDE) +
RGUI_TERM_START_Y + 2, title_msg, hover_color);
}
@ -448,12 +475,11 @@ static void rgui_render(void)
disp_timedate_set_label(timedate, sizeof(timedate), 3);
blit_line(menu,
(RGUI_TERM_WIDTH * FONT_HEIGHT_STRIDE) + (60),
RGUI_TERM_WIDTH * FONT_WIDTH_STRIDE - RGUI_TERM_START_X,
(RGUI_TERM_HEIGHT * FONT_HEIGHT_STRIDE) +
RGUI_TERM_START_Y + 2, timedate, hover_color);
}
x = RGUI_TERM_START_X;
y = RGUI_TERM_START_Y;
@ -546,6 +572,7 @@ static void *rgui_init(void)
menu->frame_buf.width = 320;
menu->frame_buf.height = 240;
menu->header_height = FONT_HEIGHT_STRIDE * 2;
menu->begin = 0;
menu->frame_buf.pitch = menu->frame_buf.width * sizeof(uint16_t);
@ -608,8 +635,11 @@ static void rgui_set_texture(void)
static void rgui_navigation_clear(bool pending_push)
{
menu_handle_t *menu = menu_driver_get_ptr();
if (menu)
menu->begin = 0;
if (!menu)
return;
menu->begin = 0;
menu->scroll_y = 0;
}
static void rgui_navigation_set(bool scroll)

View File

@ -18,6 +18,7 @@
#include "../../settings.h"
#include <string/string_list.h>
#include <string/stdstring.h>
#include <time.h>
static INLINE void get_title(const char *label, const char *dir,
@ -57,8 +58,8 @@ static INLINE void get_title(const char *label, const char *dir,
#endif
if (!strcmp(label, "core_list"))
snprintf(title, sizeof_title, "CORE SELECTION %s", dir);
else if (!strcmp(label, "core_updater_list"))
snprintf(title, sizeof_title, "CORE UPDATER %s", dir);
else if (!strcmp(label, "deferred_core_updater_list"))
strlcpy(title, "CORE UPDATER", sizeof_title);
else if (!strcmp(label, "deferred_database_manager_list"))
snprintf(title, sizeof_title, "DATABASE SELECTION - %s", (elem0_path[0] != '\0') ? path_basename(elem0_path) : "");
else if (!strcmp(label, "database_manager_list"))
@ -103,127 +104,53 @@ static INLINE void get_title(const char *label, const char *dir,
snprintf(title, sizeof_title, "CONFIG %s", dir);
else if (!strcmp(label, "disk_image_append"))
snprintf(title, sizeof_title, "DISK APPEND %s", dir);
else if (!strcmp(elem0, "Recording Settings"))
strlcpy(title, "RECORDING SETTINGS", sizeof_title);
else if (!strcmp(elem0, "Video Settings"))
else if (!strcmp(elem0, "Video Settings")
|| !strcmp(elem0, "Overlay Settings")
|| !strcmp(elem0, "Recording Settings")
|| !strcmp(elem0, "Menu Settings")
|| !strcmp(elem0, "General Settings")
|| !strcmp(elem0, "Patch Settings")
|| !strcmp(elem0, "UI Settings")
|| !strcmp(elem0, "Playlist Settings")
|| !strcmp(elem0, "Network Settings")
|| !strcmp(elem0, "Core Updater Settings")
|| !strcmp(elem0, "User Settings")
|| !strcmp(elem0, "Path Settings")
|| !strcmp(elem0, "Driver Settings")
|| !strcmp(elem0, "Privacy Settings")
|| !strcmp(elem0, "Onscreen Keyboard Overlay Settings")
|| !strcmp(elem0, "Audio Settings")
|| !strcmp(elem0, "Font Settings")
|| !strcmp(elem0, "Shader Settings")
|| !strcmp(elem0, "Archive Settings")
|| !strcmp(elem0, "Input Settings")
)
{
strlcpy(title, "VIDEO SETTINGS", sizeof_title);
if (!strcmp(elem1, "Monitor"))
strlcat(title, " - MONITOR", sizeof_title);
else if (!strcmp(elem1, "Aspect"))
strlcat(title, " - ASPECT", sizeof_title);
else if (!strcmp(elem1, "Scaling"))
strlcat(title, " - SCALING", sizeof_title);
else if (!strcmp(elem1, "Synchronization"))
strlcat(title, " - SYNCHRONIZATION", sizeof_title);
else if (!strcmp(elem1, "Miscellaneous"))
strlcat(title, " - MISCELLANEOUS", sizeof_title);
else if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
strlcpy(title, string_to_upper(elem0), sizeof_title);
if (elem1[0] != '\0')
{
strlcat(title, " - ", sizeof_title);
strlcat(title, string_to_upper(elem1), sizeof_title);
}
}
else if (!strcmp(elem0, "Input Settings") ||
menu_type == MENU_SETTINGS_CUSTOM_BIND ||
else if (menu_type == MENU_SETTINGS_CUSTOM_BIND ||
menu_type == MENU_SETTINGS_CUSTOM_BIND_KEYBOARD)
{
strlcpy(title, "INPUT SETTINGS", sizeof_title);
if (strstr(elem1, "User"))
strlcat(title, " - USER", sizeof_title);
else if (!strcmp(elem1, "Meta Keys"))
strlcat(title, " - META KEYS", sizeof_title);
else if (!strcmp(elem1, "Turbo/Deadzone"))
strlcat(title, " - TURBO / DEADZONE", sizeof_title);
else if (!strcmp(elem1, "Input Device Mapping"))
strlcat(title, " - INPUT DEVICE MAPPING", sizeof_title);
else if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
else if (!strcmp(elem1, "Miscellaneous"))
strlcat(title, " - MISCELLANEOUS", sizeof_title);
if (elem1[0] != '\0')
{
strlcat(title, " - ", sizeof_title);
strlcat(title, string_to_upper(elem1), sizeof_title);
}
}
else if (!strcmp(elem0, "Overlay Settings"))
else if (!strcmp(label, "management")
|| !strcmp(label, "options")
|| !strcmp(label, "settings")
)
{
strlcpy(title, "OVERLAY SETTINGS", sizeof_title);
if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
}
else if (!strcmp(elem0, "Menu Settings"))
{
strlcpy(title, "MENU SETTINGS", sizeof_title);
if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
else if (!strcmp(elem1, "Navigation"))
strlcat(title, " - NAVIGATION", sizeof_title);
else if (!strcmp(elem1, "Settings View"))
strlcat(title, " - SETTINGS VIEW", sizeof_title);
else if (!strcmp(elem1, "Browser"))
strlcat(title, " - BROWSER", sizeof_title);
}
else if (!strcmp(elem0, "Onscreen Keyboard Overlay Settings"))
{
strlcpy(title, "ONSCREEN KEYBOARD OVERLAY SETTINGS", sizeof_title);
if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
}
else if (!strcmp(elem0, "Patch Settings"))
{
strlcpy(title, "PATCH SETTINGS", sizeof_title);
if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
}
else if (!strcmp(elem0, "UI Settings"))
{
strlcpy(title, "UI SETTINGS", sizeof_title);
if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
}
else if (!strcmp(elem0, "Playlist Settings"))
{
strlcpy(title, "PLAYLIST SETTINGS", sizeof_title);
if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
if (!strcmp(elem1, "History"))
strlcat(title, " - HISTORY", sizeof_title);
}
else if (!strcmp(elem0, "Network Settings"))
{
strlcpy(title, "NETWORK SETTINGS", sizeof_title);
if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
if (!strcmp(elem1, "Netplay"))
strlcat(title, " - NETPLAY", sizeof_title);
if (!strcmp(elem1, "Miscellaneous"))
strlcat(title, " - MISCELLANEOUS", sizeof_title);
}
else if (!strcmp(elem0, "Core Updater Settings"))
{
strlcpy(title, "CORE UPDATER SETTINGS", sizeof_title);
if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
}
else if (!strcmp(elem0, "User Settings"))
{
strlcpy(title, "USER SETTINGS", sizeof_title);
if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
}
else if (!strcmp(elem0, "Path Settings"))
{
strlcpy(title, "PATH SETTINGS", sizeof_title);
if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
if (!strcmp(elem1, "Paths"))
strlcat(title, " - PATHS", sizeof_title);
}
else if (!strcmp(label, "management"))
strlcpy(title, "MANAGEMENT", sizeof_title);
else if (!strcmp(label, "options"))
strlcpy(title, "OPTIONS", sizeof_title);
else if (!strcmp(label, "settings"))
strlcpy(title, "SETTINGS", sizeof_title);
else if (!strcmp(elem0, "Driver Settings"))
{
strlcpy(title, "DRIVER SETTINGS", sizeof_title);
if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
char upper_label[PATH_MAX_LENGTH];
strlcpy(upper_label, label, sizeof(upper_label));
strlcpy(title, string_to_upper(upper_label), sizeof_title);
}
else if (!strcmp(label, "performance_counters"))
strlcpy(title, "PERFORMANCE COUNTERS", sizeof_title);
@ -231,44 +158,10 @@ static INLINE void get_title(const char *label, const char *dir,
strlcpy(title, "FRONTEND PERFORMANCE COUNTERS", sizeof_title);
else if (!strcmp(label, "core_counters"))
strlcpy(title, "CORE PERFORMANCE COUNTERS", sizeof_title);
else if (!strcmp(elem0, "Shader Settings"))
{
strlcpy(title, "SHADER SETTINGS", sizeof_title);
if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
}
else if (!strcmp(elem0, "Archive Settings"))
{
strlcpy(title, "ARCHIVE SETTINGS", sizeof_title);
if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
}
else if (!strcmp(label, "video_shader_parameters"))
strlcpy(title, "SHADER PARAMETERS (CURRENT)", sizeof_title);
else if (!strcmp(label, "video_shader_preset_parameters"))
strlcpy(title, "SHADER PARAMETERS (MENU PRESET)", sizeof_title);
else if (!strcmp(elem0, "Font Settings"))
{
strlcpy(title, "FONT SETTINGS", sizeof_title);
if (!strcmp(elem1, "Messages"))
strlcat(title, " - MESSAGES", sizeof_title);
}
else if (!strcmp(elem0, "General Settings"))
{
strlcpy(title, "GENERAL SETTINGS", sizeof_title);
if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
}
else if (!strcmp(elem0, "Audio Settings"))
{
strlcpy(title, "AUDIO SETTINGS", sizeof_title);
if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
else if (!strcmp(elem1, "Synchronization"))
strlcat(title, " - SYNCHRONIZATION", sizeof_title);
else if (!strcmp(elem1, "Miscellaneous"))
strlcat(title, " - MISCELLANEOUS", sizeof_title);
}
else if (!strcmp(label, "disk_options"))
strlcpy(title, "DISK OPTIONS", sizeof_title);
else if (!strcmp(label, "core_options"))
@ -283,12 +176,8 @@ static INLINE void get_title(const char *label, const char *dir,
strlcpy(title, "CORE INPUT REMAPPING OPTIONS", sizeof_title);
else if (!strcmp(label, "core_information"))
strlcpy(title, "CORE INFO", sizeof_title);
else if (!strcmp(elem0, "Privacy Settings"))
{
strlcpy(title, "PRIVACY SETTINGS", sizeof_title);
if (!strcmp(elem1, "State"))
strlcat(title, " - STATE", sizeof_title);
}
else if (!strcmp(label, "system_information"))
strlcpy(title, "SYSTEM INFO", sizeof_title);
else if (!strcmp(label, "video_shader_pass"))
snprintf(title, sizeof_title, "SHADER %s", dir);
else if (!strcmp(label, "video_shader_preset"))

View File

@ -1211,6 +1211,8 @@ static void xmb_render(void)
{
unsigned i, current, end;
runloop_t *runloop = rarch_main_get_ptr();
settings_t *settings = config_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
if (!menu)
@ -1226,12 +1228,26 @@ static void xmb_render(void)
current = menu->navigation.selection_ptr;
end = menu_list_get_size(menu->menu_list);
for (i = 0; i < end; i++)
if (settings->menu.pointer.enable)
{
float item_y = xmb->margins.screen.top + xmb_item_y(xmb, i, current);
for (i = 0; i < end; i++)
{
float item_y = xmb->margins.screen.top + xmb_item_y(xmb, i, current);
if (menu->mouse.y > item_y && menu->mouse.y < item_y + xmb->icon.size)
menu->mouse.ptr = i;
if (menu->pointer.y > item_y && menu->pointer.y < item_y + xmb->icon.size)
menu->pointer.ptr = i;
}
}
if (settings->menu.mouse.enable)
{
for (i = 0; i < end; i++)
{
float item_y = xmb->margins.screen.top + xmb_item_y(xmb, i, current);
if (menu->mouse.y > item_y && menu->mouse.y < item_y + xmb->icon.size)
menu->mouse.ptr = i;
}
}
runloop->frames.video.current.menu.animation.is_active = false;
@ -1498,6 +1514,7 @@ static void *xmb_init(void)
xmb->margins.setting.left = 600.0 * scale_factor;
menu->categories.size = 1;
menu->header_height = xmb->icon.size;
if (global->core_info)
menu->categories.size = global->core_info->count + 1;

View File

@ -87,6 +87,7 @@ typedef enum
MENU_FILE_RDB,
MENU_FILE_RDB_ENTRY,
MENU_FILE_CURSOR,
MENU_FILE_RECORD_CONFIG,
MENU_SETTINGS,
MENU_SETTING_DRIVER,
MENU_SETTING_ACTION,

View File

@ -112,6 +112,8 @@ typedef struct
} delay;
size_t begin;
unsigned header_height;
int scroll_y;
menu_list_t *menu_list;
menu_navigation_t navigation;
@ -175,13 +177,20 @@ typedef struct
struct
{
int16_t x;
int16_t y;
int16_t dx;
int16_t dy;
int16_t old_x;
int16_t old_y;
bool pressed[2];
bool oldpressed[2];
bool back;
bool oldback;
bool cancel;
int16_t start_x;
int16_t start_y;
bool pressed[2];
bool oldpressed[2];
bool dragging;
bool back;
bool oldback;
unsigned ptr;
} pointer;
struct

View File

@ -39,18 +39,12 @@ void menu_entries_common_load_content(bool persist)
menu->msg_force = true;
}
int menu_action_setting_set_current_string(
rarch_setting_t *setting, const char *str)
{
strlcpy(setting->value.string, str, setting->size);
return menu_setting_generic(setting);
}
#ifdef HAVE_NETWORKING
/* HACK - we have to find some way to pass state inbetween
* function pointer callback functions that don't necessarily
* call each other. */
#ifdef HAVE_ZLIB
static int zlib_extract_core_callback(const char *name, const char *valid_exts,
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
uint32_t crc32, void *userdata)
@ -92,6 +86,7 @@ error:
RARCH_ERR("Failed to deflate to: %s.\n", path);
return 0;
}
#endif
int cb_core_updater_download(void *data, size_t len)
{
@ -138,6 +133,7 @@ int menu_entries_common_is_settings_entry(const char *label)
!strcmp(label, "Driver Settings") ||
!strcmp(label, "General Settings") ||
!strcmp(label, "Video Settings") ||
!strcmp(label, "Recording Settings") ||
!strcmp(label, "Shader Settings") ||
!strcmp(label, "Font Settings") ||
!strcmp(label, "Audio Settings") ||

View File

@ -30,6 +30,8 @@
#include "menu_database.h"
#include "../gfx/video_shader_driver.h"
#include "../git_version.h"
#include "../config.features.h"
#ifdef HAVE_LIBRETRODB
static int create_string_list_rdb_entry_string(const char *desc, const char *label,
@ -268,6 +270,412 @@ static int deferred_push_core_information(void *data, void *userdata,
return 0;
}
static int deferred_push_system_information(void *data, void *userdata,
const char *path, const char *label, unsigned type)
{
file_list_t *list = (file_list_t*)data;
file_list_t *menu_list = (file_list_t*)userdata;
if (!list || !menu_list)
return -1;
menu_list_clear(list);
{
char tmp[PATH_MAX_LENGTH];
const char *tmp_string;
char tmp2[PATH_MAX_LENGTH];
const frontend_ctx_driver_t *frontend = frontend_get_ptr();
snprintf(tmp, sizeof(tmp), "Build date: %s", __DATE__);
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
#ifdef HAVE_GIT_VERSION
snprintf(tmp, sizeof(tmp), "Git version: %s", rarch_git_version);
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
#endif
rarch_print_compiler(tmp, sizeof(tmp));
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
{
char cpu_str[PATH_MAX_LENGTH];
uint64_t cpu = rarch_get_cpu_features();
snprintf(cpu_str, sizeof(cpu_str), "CPU Features: ");
if (cpu & RETRO_SIMD_MMX)
strlcat(cpu_str, "MMX ", sizeof(cpu_str));
if (cpu & RETRO_SIMD_MMXEXT)
strlcat(cpu_str, "MMXEXT ", sizeof(cpu_str));
if (cpu & RETRO_SIMD_SSE)
strlcat(cpu_str, "SSE1 ", sizeof(cpu_str));
if (cpu & RETRO_SIMD_SSE2)
strlcat(cpu_str, "SSE2 ", sizeof(cpu_str));
if (cpu & RETRO_SIMD_SSE3)
strlcat(cpu_str, "SSE3 ", sizeof(cpu_str));
if (cpu & RETRO_SIMD_SSSE3)
strlcat(cpu_str, "SSSE3 ", sizeof(cpu_str));
if (cpu & RETRO_SIMD_SSE4)
strlcat(cpu_str, "SSE4 ", sizeof(cpu_str));
if (cpu & RETRO_SIMD_SSE42)
strlcat(cpu_str, "SSE4.2 ", sizeof(cpu_str));
if (cpu & RETRO_SIMD_AVX)
strlcat(cpu_str, "AVX ", sizeof(cpu_str));
if (cpu & RETRO_SIMD_AVX2)
strlcat(cpu_str, "AVX2 ", sizeof(cpu_str));
if (cpu & RETRO_SIMD_VFPU)
strlcat(cpu_str, "VFPU ", sizeof(cpu_str));
if (cpu & RETRO_SIMD_NEON)
strlcat(cpu_str, "NEON ", sizeof(cpu_str));
if (cpu & RETRO_SIMD_PS)
strlcat(cpu_str, "PS ", sizeof(cpu_str));
if (cpu & RETRO_SIMD_AES)
strlcat(cpu_str, "AES ", sizeof(cpu_str));
if (cpu & RETRO_SIMD_VMX)
strlcat(cpu_str, "VMX ", sizeof(cpu_str));
if (cpu & RETRO_SIMD_VMX128)
strlcat(cpu_str, "VMX128 ", sizeof(cpu_str));
menu_list_push(list, cpu_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (frontend)
{
int major = 0, minor = 0;
snprintf(tmp, sizeof(tmp), "Frontend identifier: %s",
frontend->ident);
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
if (frontend->get_name)
{
frontend->get_name(tmp2, sizeof(tmp2));
snprintf(tmp, sizeof(tmp), "Frontend name: %s",
frontend->get_name ? tmp2 : "N/A");
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (frontend->get_os)
{
frontend->get_os(tmp2, sizeof(tmp2), &major, &minor);
snprintf(tmp, sizeof(tmp), "Frontend OS: %s %d.%d",
frontend->get_os ? tmp2 : "N/A", major, minor);
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
snprintf(tmp, sizeof(tmp), "RetroRating level: %d",
frontend->get_rating ? frontend->get_rating() : -1);
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
if (frontend->get_powerstate)
{
int seconds = 0, percent = 0;
enum frontend_powerstate state = frontend->get_powerstate(&seconds, &percent);
tmp2[0] = '\0';
if (percent != 0)
snprintf(tmp2, sizeof(tmp2), "%d%%", percent);
switch (state)
{
case FRONTEND_POWERSTATE_NONE:
strlcat(tmp2, " N/A", sizeof(tmp));
break;
case FRONTEND_POWERSTATE_NO_SOURCE:
strlcat(tmp2, " (No source)", sizeof(tmp));
break;
case FRONTEND_POWERSTATE_CHARGING:
strlcat(tmp2, " (Charging)", sizeof(tmp));
break;
case FRONTEND_POWERSTATE_CHARGED:
strlcat(tmp2, " (Charged)", sizeof(tmp));
break;
case FRONTEND_POWERSTATE_ON_POWER_SOURCE:
strlcat(tmp2, " (Discharging)", sizeof(tmp));
break;
}
snprintf(tmp, sizeof(tmp), "Power source : %s",
tmp2);
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
}
tmp_string = gfx_ctx_get_ident();
snprintf(tmp, sizeof(tmp), "Video context driver: %s",
tmp_string ? tmp_string : "N/A");
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
{
float val = 0.0f;
if (gfx_ctx_get_metrics(DISPLAY_METRIC_MM_WIDTH, &val))
{
snprintf(tmp, sizeof(tmp), "Display metric width (mm): %.2f",
val);
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (gfx_ctx_get_metrics(DISPLAY_METRIC_MM_HEIGHT, &val))
{
snprintf(tmp, sizeof(tmp), "Display metric height (mm): %.2f",
val);
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (gfx_ctx_get_metrics(DISPLAY_METRIC_DPI, &val))
{
snprintf(tmp, sizeof(tmp), "Display metric DPI: %.2f",
val);
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
}
}
{
char feat_str[PATH_MAX_LENGTH];
snprintf(feat_str, sizeof(feat_str),
"LibretroDB support: %s", _libretrodb_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"Overlay support: %s", _overlay_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"Command interface support: %s", _command_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"Network Command interface support: %s", _network_command_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"Cocoa support: %s", _cocoa_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"PNG support (RPNG): %s", _rpng_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"SDL1.2 support: %s", _sdl_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"SDL2 support: %s", _sdl2_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"OpenGL support: %s", _opengl_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"OpenGL ES support: %s", _opengles_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"Threading support: %s", _thread_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"KMS/EGL support: %s", _kms_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"Udev support: %s", _udev_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"OpenVG support: %s", _vg_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"EGL support: %s", _egl_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"X11 support: %s", _x11_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"Wayland support: %s", _wayland_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"XVideo support: %s", _xvideo_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"ALSA support: %s", _alsa_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"OSS support: %s", _oss_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"OpenAL support: %s", _al_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"OpenSL support: %s", _sl_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"RSound support: %s", _rsound_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"RoarAudio support: %s", _roar_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"JACK support: %s", _jack_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"PulseAudio support: %s", _pulse_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"DirectSound support: %s", _dsound_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"XAudio2 support: %s", _xaudio_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"Zlib support: %s", _zlib_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"7zip support: %s", _7zip_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"Dynamic library support: %s", _dylib_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"Cg support: %s", _cg_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"GLSL support: %s", _glsl_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"HLSL support: %s", _hlsl_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"libxml2 XML parsing support: %s", _libxml2_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"SDL image support: %s", _sdl_image_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"OpenGL/Direct3D render-to-texture (multi-pass shaders) support: %s", _fbo_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"FFmpeg support: %s", _ffmpeg_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"CoreText support: %s", _coretext_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"FreeType support: %s", _freetype_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"Netplay (peer-to-peer) support: %s", _netplay_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"Python (script support in shaders) support: %s", _python_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"Video4Linux2 support: %s", _v4l2_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(feat_str, sizeof(feat_str),
"Libusb support: %s", _libusb_supp ? "true" : "false");
menu_list_push(list, feat_str, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
menu_driver_populate_entries(path, label, type);
return 0;
}
static int deferred_push_rdb_entry_detail(void *data, void *userdata,
const char *path, const char *label, unsigned type)
{
@ -1550,9 +1958,6 @@ static void print_buf_lines(file_list_t *list, char *buf, int buf_size,
/* HACK - we have to find some way to pass state inbetween
* function pointer callback functions that don't necessarily
* call each other. */
extern char core_updater_list_path[PATH_MAX_LENGTH];
extern char core_updater_list_label[PATH_MAX_LENGTH];
extern unsigned core_updater_list_type;
static char *core_buf;
static size_t core_len;
@ -1566,6 +1971,9 @@ int cb_core_updater_list(void *data_, size_t len)
if (!data)
return -1;
if (core_buf)
free(core_buf);
core_buf = (char*)malloc(len * sizeof(char));
if (!core_buf)
@ -1587,11 +1995,7 @@ static int deferred_push_core_updater_list(void *data, void *userdata,
print_buf_lines(list, core_buf, core_len, MENU_FILE_DOWNLOAD_CORE);
if (core_buf)
free(core_buf);
menu_list_populate_generic(list, core_updater_list_path,
core_updater_list_label, core_updater_list_type);
menu_list_populate_generic(list, path, label, type);
return 0;
}
@ -1763,6 +2167,13 @@ static int deferred_push_remap_file_load(void *data, void *userdata,
MENU_FILE_REMAP, "rmp", NULL);
}
static int deferred_push_record_configfile(void *data, void *userdata,
const char *path, const char *label, unsigned type)
{
return menu_entries_parse_list((file_list_t*)data, (file_list_t*)userdata, path, label, type,
MENU_FILE_RECORD_CONFIG, "cfg", NULL);
}
static int deferred_push_input_overlay(void *data, void *userdata,
const char *path, const char *label, unsigned type)
{
@ -1875,6 +2286,8 @@ void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs,
cbs->action_deferred_push = deferred_push_cheat_file_load;
else if (!strcmp(label, "remap_file_load"))
cbs->action_deferred_push = deferred_push_remap_file_load;
else if (!strcmp(label, "record_config"))
cbs->action_deferred_push = deferred_push_record_configfile;
else if (!strcmp(label, "content_actions"))
cbs->action_deferred_push = deferred_push_content_actions;
else if (!strcmp(label, "shader_options"))
@ -1916,6 +2329,8 @@ void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs,
cbs->action_deferred_push = deferred_push_cursor_manager_list_deferred_query_subsearch;
else if (!strcmp(label, "core_information"))
cbs->action_deferred_push = deferred_push_core_information;
else if (!strcmp(label, "system_information"))
cbs->action_deferred_push = deferred_push_system_information;
else if (!strcmp(label, "performance_counters"))
cbs->action_deferred_push = deferred_push_performance_counters;
else if (!strcmp(label, "core_counters"))

View File

@ -137,19 +137,6 @@ static int load_or_open_zip_iterate(unsigned action)
return 0;
}
static INLINE struct video_shader *shader_manager_get_current_shader(const char *label, unsigned type)
{
menu_handle_t *menu = menu_driver_get_ptr();
if (!menu)
return NULL;
if (!strcmp(label, "video_shader_preset_parameters"))
return menu->shader;
else if (!strcmp(label, "video_shader_parameters"))
return video_shader_driver_get_current_shader();
return NULL;
}
static int action_iterate_help(const char *label, unsigned action)
{
unsigned i;

View File

@ -27,9 +27,6 @@
#include "../input/input_remapping.h"
/* FIXME - Global variables, refactor */
char core_updater_list_path[PATH_MAX_LENGTH];
char core_updater_list_label[PATH_MAX_LENGTH];
unsigned core_updater_list_type;
unsigned rdb_entry_start_game_selection_ptr;
size_t hack_shader_pass = 0;
#ifdef HAVE_NETWORKING
@ -288,11 +285,6 @@ static int action_ok_core_updater_list(const char *path,
driver->menu->nonblocking_refresh = true;
(void)url_path;
#ifdef HAVE_NETWORKING
strlcpy(core_updater_list_path, path, sizeof(core_updater_list_path));
strlcpy(core_updater_list_label, label, sizeof(core_updater_list_label));
core_updater_list_type = type;
#endif
if (settings->network.buildbot_url[0] == '\0')
return -1;
@ -327,6 +319,21 @@ static int action_ok_remap_file(const char *path,
label, type, idx);
}
static int action_ok_record_configfile(const char *path,
const char *label, unsigned type, size_t idx)
{
menu_handle_t *menu = menu_driver_get_ptr();
global_t *global = global_get_ptr();
if (!menu)
return -1;
return menu_list_push_stack_refresh(
menu->menu_list,
global->record.config_dir,
label, type, idx);
}
static int action_ok_core_list(const char *path,
const char *label, unsigned type, size_t idx)
{
@ -342,6 +349,24 @@ static int action_ok_core_list(const char *path,
label, type, idx);
}
static int action_ok_record_configfile_load(const char *path,
const char *label, unsigned type, size_t idx)
{
const char *menu_path = NULL;
global_t *global = global_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
if (!menu || !global)
return -1;
menu_list_get_last_stack(menu->menu_list, &menu_path, NULL,
NULL);
fill_pathname_join(global->record.config, menu_path, path, sizeof(global->record.config));
menu_list_flush_stack_by_needle(menu->menu_list, "Recording Settings");
return 0;
}
static int action_ok_remap_file_load(const char *path,
const char *label, unsigned type, size_t idx)
{
@ -593,7 +618,8 @@ static int action_ok_path_use_directory(const char *path,
if (setting->type != ST_DIR)
return -1;
menu_action_setting_set_current_string(setting, menu_path);
strlcpy(setting->value.string, menu_path, setting->size);
menu_setting_generic(setting);
menu_list_pop_stack_by_needle(menu->menu_list, setting->name);
return 0;
@ -1231,7 +1257,9 @@ void menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs,
if (!menu)
return;
#if 0
RARCH_LOG("path: %s, label: %s, elem0 : %s, elem1: %s\n", path, label, elem0, elem1);
#endif
cbs->action_ok = action_ok_lookup_setting;
@ -1287,6 +1315,8 @@ void menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs,
cbs->action_ok = action_ok_video_filter;
else if (!strcmp(label, "remap_file_load"))
cbs->action_ok = action_ok_remap_file;
else if (!strcmp(label, "record_config"))
cbs->action_ok = action_ok_record_configfile;
else if (!strcmp(label, "core_updater_list"))
cbs->action_ok = action_ok_core_updater_list;
else if (!strcmp(label, "video_shader_parameters") ||
@ -1301,6 +1331,7 @@ void menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs,
!strcmp(label, "core_cheat_options") ||
!strcmp(label, "core_input_remapping_options") ||
!strcmp(label, "core_information") ||
!strcmp(label, "system_information") ||
!strcmp(label, "disk_options") ||
!strcmp(label, "settings") ||
!strcmp(label, "performance_counters") ||
@ -1359,6 +1390,9 @@ void menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs,
case MENU_FILE_CHEAT:
cbs->action_ok = action_ok_cheat_file_load;
break;
case MENU_FILE_RECORD_CONFIG:
cbs->action_ok = action_ok_record_configfile_load;
break;
case MENU_FILE_REMAP:
cbs->action_ok = action_ok_remap_file_load;
break;

View File

@ -134,7 +134,10 @@ void menu_input_st_string_callback(void *userdata, const char *str)
if ((current_setting = (rarch_setting_t*)
setting_find_setting(
menu->list_settings, menu->keyboard.label_setting)))
menu_action_setting_set_current_string(current_setting, str);
{
strlcpy(current_setting->value.string, str, current_setting->size);
menu_setting_generic(current_setting);
}
else
{
if (!strcmp(menu->keyboard.label_setting, "video_shader_preset_save_as"))
@ -664,7 +667,7 @@ static int menu_input_mouse(unsigned *action)
static int menu_input_pointer(unsigned *action)
{
int pointer_device, pointer_x, pointer_y, screen_x, screen_y;
int pointer_device, pointer_x, pointer_y;
const struct retro_keybind *binds[MAX_USERS];
menu_handle_t *menu = menu_driver_get_ptr();
runloop_t *runloop = rarch_main_get_ptr();
@ -680,11 +683,6 @@ static int menu_input_pointer(unsigned *action)
return 0;
}
#if defined(HAVE_XMB)
if (driver->menu_ctx == &menu_ctx_xmb)
return 0;
#endif
pointer_device = driver->menu_ctx->set_texture?
RETRO_DEVICE_POINTER : RARCH_DEVICE_POINTER_SCREEN;
@ -698,65 +696,13 @@ static int menu_input_pointer(unsigned *action)
pointer_x = input_driver_state(binds, 0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_X);
pointer_y = input_driver_state(binds, 0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_Y);
/* by multiple presses, the main press will be the one closest to the previous coordinates */
if(menu->pointer.pressed[1])
{
int pointer_x2, pointer_y2, dist1, dist2;
menu->pointer.x = ((pointer_x + 0x7fff) * (int)menu->frame_buf.width) / 0xFFFF;
menu->pointer.y = ((pointer_y + 0x7fff) * (int)menu->frame_buf.height) / 0xFFFF;
pointer_x2 = input_driver_state(binds, 0, pointer_device, 1, RETRO_DEVICE_ID_POINTER_X);
pointer_y2 = input_driver_state(binds, 0, pointer_device, 1, RETRO_DEVICE_ID_POINTER_Y);
dist1 = (pointer_x - menu->pointer.old_x) * (pointer_x - menu->pointer.old_x) +
(pointer_y - menu->pointer.old_y) * (pointer_y - menu->pointer.old_y);
dist2 = (pointer_x2 - menu->pointer.old_x) * (pointer_x2 - menu->pointer.old_x) +
(pointer_y2 - menu->pointer.old_y) * (pointer_y2 - menu->pointer.old_y);
if (dist2 < dist1)
{
int temp;
pointer_x = pointer_x2;
pointer_y = pointer_y2;
temp = menu->pointer.pressed[0];
menu->pointer.pressed[0] = menu->pointer.pressed[1];
menu->pointer.pressed[1] = temp;
}
}
menu->pointer.old_x = pointer_x;
menu->pointer.old_y = pointer_y;
screen_x = ((pointer_x + 0x7fff) * (int)menu->frame_buf.width) / 0xFFFF;
screen_y = ((pointer_y + 0x7fff) * (int)menu->frame_buf.height) / 0xFFFF;
if (menu->pointer.pressed[0])
{
menu->mouse.x = screen_x;
menu->mouse.y = screen_y;
if (menu->mouse.x < 5)
menu->mouse.x = 5;
if (menu->mouse.y < 5)
menu->mouse.y = 5;
if (menu->mouse.x > (int)menu->frame_buf.width - 5)
menu->mouse.x = menu->frame_buf.width - 5;
if (menu->mouse.y > (int)menu->frame_buf.height - 5)
menu->mouse.y = menu->frame_buf.height - 5;
menu->mouse.scrollup = (menu->mouse.y == 5);
menu->mouse.scrolldown = (menu->mouse.y == (int)menu->frame_buf.height - 5);
menu->pointer.cancel = false;
if(menu->pointer.oldpressed[1] && !menu->pointer.pressed[1])
menu->pointer.back = true;
}
else
menu->pointer.cancel = screen_x < 5 || screen_x > (int)menu->frame_buf.width - 5
|| screen_x < 5 || screen_x > (int)menu->frame_buf.height - 5;
menu->pointer.oldpressed[1] = menu->pointer.pressed[1];
if (menu->pointer.pressed[0] || menu->pointer.back || menu->mouse.x != screen_x || menu->mouse.y != screen_y)
runloop->frames.video.current.menu.animation.is_active = true;
if (menu->pointer.pressed[0] || menu->pointer.oldpressed[0]
|| menu->pointer.back || menu->pointer.dragging
|| menu->pointer.dy != 0 || menu->pointer.dx != 0)
runloop->frames.video.current.menu.animation.is_active = true;
return 0;
}
@ -839,13 +785,38 @@ static int menu_input_mouse_post_iterate(menu_file_list_cbs_t *cbs,
return 0;
}
static int pointer_tap(menu_file_list_cbs_t *cbs, const char *path,
const char *label, unsigned type, unsigned action)
{
menu_handle_t *menu = menu_driver_get_ptr();
driver_t *driver = driver_get_ptr();
rarch_setting_t *setting =
(rarch_setting_t*)setting_find_setting
(driver->menu->list_settings,
driver->menu->menu_list->selection_buf->list[menu->navigation.selection_ptr].label);
if (menu->pointer.ptr == menu->navigation.selection_ptr
&& cbs && cbs->action_toggle && setting &&
(setting->type == ST_BOOL || setting->type == ST_UINT
|| setting->type == ST_FLOAT || setting->type == ST_STRING))
return cbs->action_toggle(type, label, MENU_ACTION_RIGHT, true);
else if (menu->pointer.ptr == menu->navigation.selection_ptr)
return cbs->action_ok(path, label, type, menu->navigation.selection_ptr);
else
menu_navigation_set(&menu->navigation, menu->pointer.ptr, false);
return 0;
}
static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs,
const char *path,
const char *label, unsigned type, unsigned action)
{
menu_handle_t *menu = menu_driver_get_ptr();
settings_t *settings = config_get_ptr();
driver_t *driver = driver_get_ptr();
int ret = 0;
menu_handle_t *menu = menu_driver_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
if (!menu)
return -1;
@ -854,46 +825,53 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs,
#ifdef HAVE_OVERLAY
|| (settings->input.overlay_enable && driver && driver->overlay)
#endif
)
)
return 0;
#if defined(HAVE_XMB)
if (driver->menu_ctx == &menu_ctx_xmb)
return 0;
#endif
if (menu->pointer.pressed[0])
{
if (menu->pointer.oldpressed[0])
if (!menu->pointer.oldpressed[0])
{
if (menu->mouse.ptr <= menu_list_get_size(menu->menu_list)-1)
menu_navigation_set(&menu->navigation, menu->mouse.ptr, false);
}
else
menu->pointer.start_x = menu->pointer.x;
menu->pointer.start_y = menu->pointer.y;
menu->pointer.old_x = menu->pointer.x;
menu->pointer.old_y = menu->pointer.y;
menu->pointer.oldpressed[0] = true;
}
else if (menu->pointer.x != menu->pointer.start_x
&& menu->pointer.y != menu->pointer.start_y)
{
menu->pointer.dragging = true;
menu->pointer.dx = menu->pointer.x - menu->pointer.old_x;
menu->pointer.dy = menu->pointer.y - menu->pointer.old_y;
menu->pointer.old_x = menu->pointer.x;
menu->pointer.old_y = menu->pointer.y;
}
}
else
{
if (menu->pointer.oldpressed[0])
{
rarch_setting_t *setting = NULL;
if (!menu->pointer.dragging)
{
if (menu->pointer.start_y < menu->header_height)
{
menu_list_pop_stack(menu->menu_list);
}
else if (menu->pointer.ptr <= menu_list_get_size(menu->menu_list)-1)
{
menu->pointer.oldpressed[0] = false;
ret = pointer_tap(cbs, path, label, type, action);
}
}
menu->pointer.oldpressed[0] = false;
setting = (rarch_setting_t*)setting_find_setting
(menu->list_settings,
menu->menu_list->selection_buf->list[menu->navigation.selection_ptr].label);
if (menu->mouse.ptr == menu->navigation.selection_ptr && !menu->pointer.cancel
&& cbs && cbs->action_toggle && setting &&
(setting->type == ST_BOOL || setting->type == ST_UINT || setting->type == ST_FLOAT
|| setting->type == ST_STRING))
return cbs->action_toggle(type, label, MENU_ACTION_RIGHT, true);
if (menu->mouse.ptr == menu->navigation.selection_ptr && !menu->pointer.cancel
&& cbs && cbs->action_ok)
return cbs->action_ok(path, label, type,
menu->navigation.selection_ptr);
else if (menu->mouse.ptr <= menu_list_get_size(menu->menu_list) - 1)
menu_navigation_set(&menu->navigation, menu->mouse.ptr, false);
menu->pointer.start_x = 0;
menu->pointer.start_y = 0;
menu->pointer.old_x = 0;
menu->pointer.old_y = 0;
menu->pointer.dx = 0;
menu->pointer.dy = 0;
menu->pointer.dragging = false;
}
}
@ -907,14 +885,18 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs,
}
menu->pointer.oldback = menu->pointer.back;
return 0;
return ret;
}
void menu_input_post_iterate(int *ret, menu_file_list_cbs_t *cbs, const char *path,
const char *label, unsigned type, unsigned action)
{
*ret = menu_input_mouse_post_iterate (cbs, path, label, type, action);
*ret |= menu_input_pointer_post_iterate(cbs, path, label, type, action);
settings_t *settings = config_get_ptr();
if (settings->menu.mouse.enable)
*ret = menu_input_mouse_post_iterate (cbs, path, label, type, action);
if (settings->menu.pointer.enable)
*ret |= menu_input_pointer_post_iterate(cbs, path, label, type, action);
}
unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
@ -931,6 +913,7 @@ unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
| (1ULL << RETRO_DEVICE_ID_JOYPAD_R);
menu_handle_t *menu = menu_driver_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
if (!menu || !driver)
return 0;
@ -999,8 +982,11 @@ unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
else
ret = MENU_ACTION_NOOP;
menu_input_mouse(&ret);
menu_input_pointer(&ret);
if (settings->menu.mouse.enable)
menu_input_mouse(&ret);
if (settings->menu.pointer.enable)
menu_input_pointer(&ret);
return ret;
}

View File

@ -27,9 +27,6 @@ int menu_setting_generic(rarch_setting_t *setting);
int menu_setting_handler(rarch_setting_t *setting, unsigned action);
int menu_action_setting_set_current_string(
rarch_setting_t *setting, const char *str);
int menu_setting_set(unsigned type, const char *label,
unsigned action, bool wraparound);

15
patch.c
View File

@ -50,7 +50,9 @@ struct bps_data
static uint8_t bps_read(struct bps_data *bps)
{
uint8_t data = bps->modify_data[bps->modify_offset++];
#ifdef HAVE_ZLIB
bps->modify_checksum = zlib_crc32_adjust(bps->modify_checksum, data);
#endif
return data;
}
@ -77,7 +79,9 @@ static void bps_write(struct bps_data *bps, uint8_t data)
return;
bps->target_data[bps->output_offset++] = data;
#ifdef HAVE_ZLIB
bps->target_checksum = zlib_crc32_adjust(bps->target_checksum, data);
#endif
}
patch_error_t bps_apply_patch(
@ -175,7 +179,12 @@ patch_error_t bps_apply_patch(
for (i = 0; i < 32; i += 8)
modify_modify_checksum |= bps_read(&bps) << i;
#ifdef HAVE_ZLIB
bps.source_checksum = zlib_crc32_calculate(bps.source_data, bps.source_length);
#else
return PATCH_PATCH_CHECKSUM_INVALID;
#endif
bps.target_checksum = ~bps.target_checksum;
if (bps.source_checksum != modify_source_checksum)
@ -204,7 +213,9 @@ static uint8_t ups_patch_read(struct ups_data *data)
if (data && data->patch_offset < data->patch_length)
{
uint8_t n = data->patch_data[data->patch_offset++];
#ifdef HAVE_ZLIB
data->patch_checksum = zlib_crc32_adjust(data->patch_checksum, n);
#endif
return n;
}
return 0x00;
@ -215,7 +226,9 @@ static uint8_t ups_source_read(struct ups_data *data)
if (data && data->source_offset < data->source_length)
{
uint8_t n = data->source_data[data->source_offset++];
#ifdef HAVE_ZLIB
data->source_checksum = zlib_crc32_adjust(data->source_checksum, n);
#endif
return n;
}
return 0x00;
@ -226,7 +239,9 @@ static void ups_target_write(struct ups_data *data, uint8_t n)
if (data && data->target_offset < data->target_length)
{
data->target_data[data->target_offset] = n;
#ifdef HAVE_ZLIB
data->target_checksum = zlib_crc32_adjust(data->target_checksum, n);
#endif
}
if (data)

View File

@ -258,7 +258,12 @@ if [ "$HAVE_THREADS" != 'no' ]; then
check_pkgconf AVUTIL libavutil 51
check_pkgconf SWSCALE libswscale 2.1
check_header AV_CHANNEL_LAYOUT libavutil/channel_layout.h
( [ "$HAVE_FFMPEG" = 'auto' ] && ( [ "$HAVE_AVCODEC" = 'no' ] || [ "$HAVE_AVFORMAT" = 'no' ] || [ "$HAVE_AVUTIL" = 'no' ] || [ "$HAVE_SWSCALE" = 'no' ] ) && HAVE_FFMPEG='no' ) || HAVE_FFMPEG='yes'
HAVE_FFMPEG='yes'
if [ "$HAVE_AVCODEC" = 'no' ] || [ "$HAVE_AVFORMAT" = 'no' ] || [ "$HAVE_AVUTIL" = 'no' ] || [ "$HAVE_SWSCALE" = 'no' ]; then
HAVE_FFMPEG='no'
echo "Notice: FFmpeg recording disabled due to missing or unsuitable packages."
fi
fi
else
echo "Notice: Not building with threading support. Will skip FFmpeg."

View File

@ -26,7 +26,13 @@ if [ -z "$CROSS_COMPILE" ] || [ -z "$OS" ]; then
esac
fi
echo "$ECHOBUF ... $OS"
DISTRO=''
if [ -e /etc/lsb-release ]; then
. /etc/lsb-release
DISTRO="(${DISTRIB_DESCRIPTION} ${DISTRIB_RELEASE})"
fi
echo "$ECHOBUF ... $OS ${DISTRO}"
# Checking for working C compiler
if [ "$USE_LANG_C" = 'yes' ]; then
@ -37,7 +43,7 @@ if [ "$USE_LANG_C" = 'yes' ]; then
int main(void) { puts("Hai world!"); return 0; }
EOF
if [ -z "$CC" ]; then
for CC in ${CC:=$(which ${CROSS_COMPILE}gcc ${CROSS_COMPILE}cc ${CROSS_COMPILE}clang)} ''; do
for CC in ${CC:=$(which ${CROSS_COMPILE}gcc ${CROSS_COMPILE}cc ${CROSS_COMPILE}clang 2>/dev/null)} ''; do
"$CC" -o "$TEMP_EXE" "$TEMP_C" >/dev/null 2>&1 && break
done
fi
@ -55,7 +61,7 @@ if [ "$USE_LANG_CXX" = 'yes' ]; then
int main() { std::cout << "Hai guise" << std::endl; return 0; }
EOF
if [ -z "$CXX" ]; then
for CXX in ${CXX:=$(which ${CROSS_COMPILE}g++ ${CROSS_COMPILE}c++ ${CROSS_COMPILE}clang++)} ''; do
for CXX in ${CXX:=$(which ${CROSS_COMPILE}g++ ${CROSS_COMPILE}c++ ${CROSS_COMPILE}clang++ 2>/dev/null)} ''; do
"$CXX" -o "$TEMP_EXE" "$TEMP_CXX" >/dev/null 2>&1 && break
done
fi
@ -72,3 +78,23 @@ if [ "$OS" = "Win32" ]; then
fi
echo "$ECHOBUF ... $WINDRES"
fi
ECHOBUF="Checking for pkg-config"
[ -n "$PKG_CONF_PATH" ] || {
PKG_CONF_PATH="none"
for path in $(which "${CROSS_COMPILE}pkg-config" 2>/dev/null) ''; do
[ -n "$path" ] && {
PKG_CONF_PATH=$path;
break;
}
done
}
echo "$ECHOBUF ... $PKG_CONF_PATH"
if [ "$PKG_CONF_PATH" = "none" ]; then
echo "Warning: pkg-config not found, package checks will fail."
fi

View File

@ -104,25 +104,26 @@ check_pkgconf() #$1 = HAVE_$1 $2 = package $3 = version $4 = critical error mess
{ tmpval="$(eval echo \$HAVE_$1)"
[ "$tmpval" = 'no' ] && return 0
[ "$PKG_CONF_PATH" ] || {
ECHOBUF="Checking for pkg-config"
# echo -n "Checking for pkg-config"
for PKG_CONF_PATH in $(which "${CROSS_COMPILE}pkg-config") ''; do [ "$PKG_CONF_PATH" ] && break; done
[ "$PKG_CONF_PATH" ] || { echo "pkg-config not found. Exiting ..."; exit 1;}
echo "$ECHOBUF ... $PKG_CONF_PATH"
ECHOBUF="Checking presence of package $2"
[ "$3" ] && ECHOBUF="$ECHOBUF >= $3"
[ "$PKG_CONF_PATH" = "none" ] && {
eval HAVE_$1="no"
echo "$ECHOBUF ... no"
return 0
}
ECHOBUF="Checking presence of package $2"
[ "$3" ] && ECHOBUF="$ECHOBUF with minimum version $3"
# echo -n "$ECHOBUF ... "
answer='no'
version='no'
$PKG_CONF_PATH --atleast-version="${3:-0.0}" "$2" && {
answer='yes'
version=$($PKG_CONF_PATH --modversion "$2")
eval $1_CFLAGS=\"$($PKG_CONF_PATH $2 --cflags)\"
eval $1_LIBS=\"$($PKG_CONF_PATH $2 --libs)\"
}
eval HAVE_$1="$answer"; echo "$ECHOBUF ... $answer"
eval HAVE_$1="$answer";
echo "$ECHOBUF ... $version"
PKG_CONF_USED="$PKG_CONF_USED $1"
[ "$answer" = 'no' ] && {
[ "$4" ] && { echo "$4"; exit 1;}

View File

@ -1408,7 +1408,7 @@ static void ffmpeg_thread(void *data)
av_free(audio_buf);
}
const ffemu_backend_t ffemu_ffmpeg = {
const record_driver_t ffemu_ffmpeg = {
ffmpeg_new,
ffmpeg_free,
ffmpeg_push_video,

View File

@ -0,0 +1,62 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - 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/>.
*/
#include <compat/msvc.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <boolean.h>
#include "../record_driver.h"
static void record_null_free(void *data)
{
}
static void *record_null_new(const struct ffemu_params *params)
{
return NULL;
}
static bool record_null_push_video(void *data,
const struct ffemu_video_data *video_data)
{
return false;
}
static bool record_null_push_audio(void *data,
const struct ffemu_audio_data *audio_data)
{
return false;
}
static bool record_null_finalize(void *data)
{
return false;
}
const record_driver_t ffemu_null = {
record_null_new,
record_null_free,
record_null_push_video,
record_null_push_audio,
record_null_finalize,
"null",
};

View File

@ -15,6 +15,7 @@
*/
#include <string.h>
#include <file/file_path.h>
#include "record_driver.h"
#include "../driver.h"
@ -30,13 +31,114 @@
#include "../config.h"
#endif
static const ffemu_backend_t *ffemu_backends[] = {
static const record_driver_t *record_drivers[] = {
#ifdef HAVE_FFMPEG
&ffemu_ffmpeg,
#endif
&ffemu_null,
NULL,
};
/**
* record_driver_find_ident:
* @idx : index of driver to get handle to.
*
* Returns: Human-readable identifier of record driver at index. Can be NULL
* if nothing found.
**/
const char *record_driver_find_ident(int idx)
{
const record_driver_t *drv = record_drivers[idx];
if (!drv)
return NULL;
return drv->ident;
}
/**
* record_driver_find_handle:
* @idx : index of driver to get handle to.
*
* Returns: handle to record driver at index. Can be NULL
* if nothing found.
**/
const void *record_driver_find_handle(int idx)
{
const void *drv = record_drivers[idx];
if (!drv)
return NULL;
return drv;
}
/**
* config_get_record_driver_options:
*
* Get an enumerated list of all record driver names, separated by '|'.
*
* Returns: string listing of all record driver names, separated by '|'.
**/
const char* config_get_record_driver_options(void)
{
union string_list_elem_attr attr;
unsigned i;
char *options = NULL;
int options_len = 0;
struct string_list *options_l = string_list_new();
attr.i = 0;
if (!options_l)
return NULL;
for (i = 0; record_driver_find_handle(i); i++)
{
const char *opt = record_driver_find_ident(i);
options_len += strlen(opt) + 1;
string_list_append(options_l, opt, attr);
}
options = (char*)calloc(options_len, sizeof(char));
if (!options)
{
string_list_free(options_l);
options_l = NULL;
return NULL;
}
string_list_join_concat(options, options_len, options_l, "|");
string_list_free(options_l);
options_l = NULL;
return options;
}
void find_record_driver(void)
{
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
int i = find_driver_index("record_driver", settings->record.driver);
if (i >= 0)
driver->recording = (const record_driver_t*)audio_driver_find_handle(i);
else
{
unsigned d;
RARCH_ERR("Couldn't find any audio driver named \"%s\"\n",
settings->audio.driver);
RARCH_LOG_OUTPUT("Available audio drivers are:\n");
for (d = 0; audio_driver_find_handle(d); d++)
RARCH_LOG_OUTPUT("\t%s\n", record_driver_find_ident(d));
RARCH_WARN("Going to default to first audio driver...\n");
driver->audio = (const audio_driver_t*)audio_driver_find_handle(0);
if (!driver->audio)
rarch_fail(1, "find_audio_driver()");
}
}
/**
* ffemu_find_backend:
* @ident : Identifier of driver to find.
@ -46,19 +148,20 @@ static const ffemu_backend_t *ffemu_backends[] = {
* Returns: recording driver handle if successful, otherwise
* NULL.
**/
const ffemu_backend_t *ffemu_find_backend(const char *ident)
const record_driver_t *ffemu_find_backend(const char *ident)
{
unsigned i;
for (i = 0; ffemu_backends[i]; i++)
for (i = 0; record_drivers[i]; i++)
{
if (!strcmp(ffemu_backends[i]->ident, ident))
return ffemu_backends[i];
if (!strcmp(record_drivers[i]->ident, ident))
return record_drivers[i];
}
return NULL;
}
/**
* gfx_ctx_init_first:
* @backend : Recording backend handle.
@ -69,19 +172,19 @@ const ffemu_backend_t *ffemu_find_backend(const char *ident)
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool ffemu_init_first(const ffemu_backend_t **backend, void **data,
bool record_driver_init_first(const record_driver_t **backend, void **data,
const struct ffemu_params *params)
{
unsigned i;
for (i = 0; ffemu_backends[i]; i++)
for (i = 0; record_drivers[i]; i++)
{
void *handle = ffemu_backends[i]->init(params);
void *handle = record_drivers[i]->init(params);
if (!handle)
continue;
*backend = ffemu_backends[i];
*backend = record_drivers[i];
*data = handle;
return true;
}
@ -183,6 +286,7 @@ bool recording_deinit(void)
**/
bool recording_init(void)
{
char recording_file[PATH_MAX_LENGTH];
struct ffemu_params params = {0};
global_t *global = global_get_ptr();
driver_t *driver = driver_get_ptr();
@ -209,12 +313,19 @@ bool recording_init(void)
(float)global->system.av_info.timing.fps,
(float)global->system.av_info.timing.sample_rate);
strlcpy(recording_file, global->record.path, sizeof(recording_file));
if (global->record.use_output_dir)
fill_pathname_join(recording_file,
global->record.output_dir,
global->record.path, sizeof(recording_file));
params.out_width = info->geometry.base_width;
params.out_height = info->geometry.base_height;
params.fb_width = info->geometry.max_width;
params.fb_height = info->geometry.max_height;
params.channels = 2;
params.filename = global->record.path;
params.filename = recording_file;
params.fps = global->system.av_info.timing.fps;
params.samplerate = global->system.av_info.timing.sample_rate;
params.pix_fmt = (global->system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888) ?
@ -299,7 +410,7 @@ bool recording_init(void)
params.fb_width, params.fb_height,
(unsigned)params.pix_fmt);
if (!ffemu_init_first(&driver->recording, &driver->recording_data, &params))
if (!record_driver_init_first(&driver->recording, &driver->recording_data, &params))
{
RARCH_ERR(RETRO_LOG_INIT_RECORDING_FAILED);
event_command(EVENT_CMD_GPU_RECORD_DEINIT);

View File

@ -13,7 +13,6 @@
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __RECORD_DRIVER_H
#define __RECORD_DRIVER_H
@ -81,7 +80,7 @@ struct ffemu_audio_data
size_t frames;
};
typedef struct ffemu_backend
typedef struct record_driver
{
void *(*init)(const struct ffemu_params *params);
void (*free)(void *data);
@ -89,9 +88,19 @@ typedef struct ffemu_backend
bool (*push_audio)(void *data, const struct ffemu_audio_data *audio_data);
bool (*finalize)(void *data);
const char *ident;
} ffemu_backend_t;
} record_driver_t;
extern const ffemu_backend_t ffemu_ffmpeg;
extern const record_driver_t ffemu_ffmpeg;
extern const record_driver_t ffemu_null;
/**
* config_get_record_driver_options:
*
* Get an enumerated list of all record driver names, separated by '|'.
*
* Returns: string listing of all record driver names, separated by '|'.
**/
const char* config_get_record_driver_options(void);
/**
* ffemu_find_backend:
@ -102,7 +111,25 @@ extern const ffemu_backend_t ffemu_ffmpeg;
* Returns: recording driver handle if successful, otherwise
* NULL.
**/
const ffemu_backend_t *ffemu_find_backend(const char *ident);
const record_driver_t *ffemu_find_backend(const char *ident);
/**
* record_driver_find_handle:
* @idx : index of driver to get handle to.
*
* Returns: handle to record driver at index. Can be NULL
* if nothing found.
**/
const void *record_driver_find_handle(int idx);
/**
* record_driver_find_ident:
* @idx : index of driver to get handle to.
*
* Returns: Human-readable identifier of record driver at index. Can be NULL
* if nothing found.
**/
const char *record_driver_find_ident(int idx);
/**
* gfx_ctx_init_first:
@ -114,7 +141,7 @@ const ffemu_backend_t *ffemu_find_backend(const char *ident);
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool ffemu_init_first(const ffemu_backend_t **backend, void **data,
bool record_driver_init_first(const record_driver_t **backend, void **data,
const struct ffemu_params *params);
void recording_dump_frame(const void *data, unsigned width,

View File

@ -92,70 +92,84 @@ static void print_features(void)
{
puts("");
puts("Features:");
_PSUPP(sdl, "SDL", "SDL drivers");
_PSUPP(sdl2, "SDL2", "SDL2 drivers");
_PSUPP(x11, "X11", "X11 drivers");
_PSUPP(wayland, "wayland", "Wayland drivers");
_PSUPP(libretrodb, "LibretroDB", "LibretroDB support");
_PSUPP(command, "Command", "Command interface support");
_PSUPP(network_command, "Network Command", "Network Command interface support");
_PSUPP(sdl, "SDL", "SDL input/audio/video drivers");
_PSUPP(sdl2, "SDL2", "SDL2 input/audio/video drivers");
_PSUPP(x11, "X11", "X11 input/video drivers");
_PSUPP(wayland, "wayland", "Wayland input/video drivers");
_PSUPP(thread, "Threads", "Threading support");
_PSUPP(opengl, "OpenGL", "OpenGL driver");
_PSUPP(kms, "KMS", "KMS/EGL context support");
_PSUPP(opengles, "OpenGL ES", "OpenGL ES driver");
_PSUPP(xvideo, "XVideo", "Video driver");
_PSUPP(udev, "UDEV", "UDEV/EVDEV input driver support");
_PSUPP(egl, "EGL", "EGL context support");
_PSUPP(vg, "OpenVG", "OpenVG output support");
_PSUPP(xvideo, "XVideo", "XVideo output");
_PSUPP(alsa, "ALSA", "audio driver");
_PSUPP(oss, "OSS", "audio driver");
_PSUPP(jack, "Jack", "audio driver");
_PSUPP(rsound, "RSound", "audio driver");
_PSUPP(roar, "RoarAudio", "audio driver");
_PSUPP(pulse, "PulseAudio", "audio driver");
_PSUPP(dsound, "DirectSound", "audio driver");
_PSUPP(xaudio, "XAudio2", "audio driver");
_PSUPP(zlib, "zlib", "PNG encode/decode and .zip extraction");
_PSUPP(al, "OpenAL", "audio driver");
_PSUPP(egl, "EGL", "video context driver");
_PSUPP(kms, "KMS", "video context driver");
_PSUPP(vg, "OpenVG", "video context driver");
_PSUPP(coreaudio, "CoreAudio", "Audio driver");
_PSUPP(alsa, "ALSA", "Audio driver");
_PSUPP(oss, "OSS", "Audio driver");
_PSUPP(jack, "Jack", "Audio driver");
_PSUPP(rsound, "RSound", "Audio driver");
_PSUPP(roar, "RoarAudio", "Audio driver");
_PSUPP(pulse, "PulseAudio", "Audio driver");
_PSUPP(dsound, "DirectSound", "Audio driver");
_PSUPP(xaudio, "XAudio2", "Audio driver");
_PSUPP(al, "OpenAL", "Audio driver");
_PSUPP(sl, "OpenSL", "Audio driver");
_PSUPP(7zip, "7zip", "7zip support");
_PSUPP(zlib, "zlib", ".zip extraction");
_PSUPP(dylib, "External", "External filter and plugin support");
_PSUPP(cg, "Cg", "Cg pixel shaders");
_PSUPP(cg, "Cg", "Fragment/vertex shader driver");
_PSUPP(glsl, "GLSL", "Fragment/vertex shader driver");
_PSUPP(glsl, "HLSL", "Fragment/vertex shader driver");
_PSUPP(libxml2, "libxml2", "libxml2 XML parsing");
_PSUPP(sdl_image, "SDL_image", "SDL_image image loading");
_PSUPP(rpng, "rpng", "PNG image loading/encoding");
_PSUPP(fbo, "FBO", "OpenGL render-to-texture (multi-pass shaders)");
_PSUPP(dynamic, "Dynamic", "Dynamic run-time loading of libretro library");
_PSUPP(ffmpeg, "FFmpeg", "On-the-fly recording of gameplay with libavcodec");
_PSUPP(freetype, "FreeType", "TTF font rendering with FreeType");
_PSUPP(freetype, "FreeType", "TTF font rendering driver");
_PSUPP(coretext, "CoreText", "TTF font rendering driver (for OSX and/or iOS)");
_PSUPP(netplay, "Netplay", "Peer-to-peer netplay");
_PSUPP(python, "Python", "Script support in shaders");
_PSUPP(libusb, "Libusb", "Libusb support");
_PSUPP(cocoa, "Cocoa", "Cocoa UI companion support (for OSX and/or iOS)");
_PSUPP(qt, "QT", "QT UI companion support");
_PSUPP(avfoundation, "AVFoundation", "Camera driver");
_PSUPP(v4l2, "Video4Linux2", "Camera driver");
}
#undef _PSUPP
/**
* print_compiler:
* rarch_print_compiler:
*
* Prints compiler that was used for compiling RetroArch.
**/
static void print_compiler(FILE *file)
void rarch_print_compiler(char *str, size_t sizeof_str)
{
fprintf(file, "\nCompiler: ");
#if defined(_MSC_VER)
fprintf(file, "MSVC (%d) %u-bit\n", _MSC_VER, (unsigned)
snprintf(str, sizeof_str, "Compiler: MSVC (%d) %u-bit", _MSC_VER, (unsigned)
(CHAR_BIT * sizeof(size_t)));
#elif defined(__SNC__)
fprintf(file, "SNC (%d) %u-bit\n",
snprintf(str, sizeof_str, "Compiler: SNC (%d) %u-bit",
__SN_VER__, (unsigned)(CHAR_BIT * sizeof(size_t)));
#elif defined(_WIN32) && defined(__GNUC__)
fprintf(file, "MinGW (%d.%d.%d) %u-bit\n",
snprintf(str, sizeof_str, "Compiler: MinGW (%d.%d.%d) %u-bit",
__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__, (unsigned)
(CHAR_BIT * sizeof(size_t)));
#elif defined(__clang__)
fprintf(file, "Clang/LLVM (%s) %u-bit\n",
snprintf(str, sizeof_str, "Compiler: Clang/LLVM (%s) %u-bit",
__clang_version__, (unsigned)(CHAR_BIT * sizeof(size_t)));
#elif defined(__GNUC__)
fprintf(file, "GCC (%d.%d.%d) %u-bit\n",
snprintf(str, sizeof_str, "Compiler: GCC (%d.%d.%d) %u-bit",
__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__, (unsigned)
(CHAR_BIT * sizeof(size_t)));
#else
fprintf(file, "Unknown compiler %u-bit\n",
snprintf(str, sizeof_str, "Unknown compiler %u-bit",
(unsigned)(CHAR_BIT * sizeof(size_t)));
#endif
fprintf(file, "Built: %s\n", __DATE__);
}
/**
@ -165,13 +179,17 @@ static void print_compiler(FILE *file)
**/
static void print_help(void)
{
char str[PATH_MAX_LENGTH];
puts("===================================================================");
#ifdef HAVE_GIT_VERSION
printf(RETRO_FRONTEND ": Frontend for libretro -- v" PACKAGE_VERSION " -- %s --\n", rarch_git_version);
#else
puts(RETRO_FRONTEND ": Frontend for libretro -- v" PACKAGE_VERSION " --");
#endif
print_compiler(stdout);
rarch_print_compiler(str, sizeof(str));
fprintf(stdout, "%s", str);
fprintf(stdout, "Built: %s\n", __DATE__);
puts("===================================================================");
puts("Usage: retroarch [content file] [options...]");
puts("\t-h/--help: Show this help message.");
@ -1097,8 +1115,12 @@ int rarch_main_init(int argc, char *argv[])
if (global->verbosity)
{
char str[PATH_MAX_LENGTH];
RARCH_LOG_OUTPUT("=== Build =======================================");
print_compiler(stderr);
rarch_print_compiler(str, sizeof(str));
fprintf(stderr, "%s", str);
fprintf(stderr, "Built: %s\n", __DATE__);
RARCH_LOG_OUTPUT("Version: %s\n", PACKAGE_VERSION);
#ifdef HAVE_GIT_VERSION
RARCH_LOG_OUTPUT("Git: %s\n", rarch_git_version);

View File

@ -167,6 +167,13 @@ void rarch_init_system_av_info(void);
void rarch_set_paths(const char *path);
/**
* rarch_print_compiler:
*
* Prints compiler that was used for compiling RetroArch.
**/
void rarch_print_compiler(char *str, size_t sizeof_str);
#ifdef __cplusplus
}
#endif

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