mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-09 03:29:43 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f44e0db97c | ||
|
|
a4eae00ac2 | ||
|
|
c9c46b8060 | ||
|
|
9324f257fc | ||
|
|
681396b151 | ||
|
|
bd153870c2 | ||
|
|
43b949a9a0 | ||
|
|
4f0233fbf9 | ||
|
|
777af02e82 | ||
|
|
f6c6f64a20 | ||
|
|
7f505afda7 | ||
|
|
55105303ac | ||
|
|
dd239fc85d | ||
|
|
f8ea62e703 | ||
|
|
48b99b1f48 | ||
|
|
a983c8269e | ||
|
|
3ce5ad9243 | ||
|
|
452c6afaf0 | ||
|
|
212337c7c1 | ||
|
|
fcc8c5dae7 | ||
|
|
9f27b9b56d | ||
|
|
fbdc30e7bb | ||
|
|
b4687fdb2b | ||
|
|
a5c83da839 | ||
|
|
c824f7af15 | ||
|
|
6a1d423700 | ||
|
|
14ec006412 | ||
|
|
9a38ec28b0 | ||
|
|
2c42ad3c96 | ||
|
|
dfe79c3fcd | ||
|
|
21dc363e0f | ||
|
|
64fe30281c | ||
|
|
302089e8d8 | ||
|
|
5a4db266e8 | ||
|
|
5cc163a10b | ||
|
|
2fb7d32a53 | ||
|
|
4ec00de5c8 | ||
|
|
794bcc53c3 | ||
|
|
4b9fea617c | ||
|
|
4fb78bf3cd | ||
|
|
a7bd7f332d | ||
|
|
e4533fb7ec | ||
|
|
0b4fd4328d | ||
|
|
8c8a3085a5 | ||
|
|
8323d06d3d | ||
|
|
f35690e2e5 | ||
|
|
09a183df3f | ||
|
|
85575f4acc | ||
|
|
e738b57cf8 | ||
|
|
e920e5f1b9 | ||
|
|
039e2acc49 | ||
|
|
5f513d2af0 | ||
|
|
3427d08c34 | ||
|
|
58ebbdeada | ||
|
|
26bcfa8d89 | ||
|
|
1b2632e7fa | ||
|
|
647438ae93 | ||
|
|
e2942f2de1 | ||
|
|
9245113738 | ||
|
|
2c08dc0f4f |
No files matched your search
@@ -1,7 +1,7 @@
|
||||
%rename link old_link
|
||||
|
||||
*link:
|
||||
%(old_link) -T 3dsx.ld%s -d --emit-relocs --use-blx
|
||||
%(old_link) -T 3dsx.ld%s -d --emit-relocs --use-blx --gc-sections
|
||||
|
||||
*startfile:
|
||||
ctr/3dsx_custom_crt0%O%s crti%O%s crtbegin%O%s
|
||||
|
||||
@@ -30,6 +30,7 @@ __system_runflags:
|
||||
startup:
|
||||
@ Save return address
|
||||
mov r4, lr
|
||||
bics sp, sp, #7
|
||||
|
||||
@ Clear the BSS section
|
||||
ldr r0, =__bss_start__
|
||||
@@ -39,7 +40,6 @@ startup:
|
||||
|
||||
@ System initialization
|
||||
mov r0, r4
|
||||
and r4, sp, #7
|
||||
bl initSystem
|
||||
|
||||
@ Set up argc/argv arguments for main()
|
||||
@@ -50,8 +50,6 @@ startup:
|
||||
|
||||
@ Jump to user code
|
||||
ldr r3, =main
|
||||
cmp r4, #0
|
||||
ldrne r3, =ctr_request_update
|
||||
ldr lr, =__ctru_exit
|
||||
bx r3
|
||||
|
||||
|
||||
@@ -195,23 +195,6 @@ void __attribute__((noreturn)) __ctru_exit(int rc)
|
||||
__libctru_exit(rc);
|
||||
}
|
||||
|
||||
int ctr_request_update(void)
|
||||
{
|
||||
gfxInit(GSP_BGR8_OES,GSP_RGB565_OES,false);
|
||||
gfxSet3D(false);
|
||||
consoleInit(GFX_BOTTOM, NULL);
|
||||
|
||||
printf("\n\nunsupported version\n\n");
|
||||
printf("Please update your payload\n");
|
||||
|
||||
wait_for_input();
|
||||
|
||||
gfxExit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
typedef union{
|
||||
struct
|
||||
{
|
||||
@@ -263,10 +246,6 @@ void wait_for_input(void)
|
||||
}
|
||||
}
|
||||
|
||||
int usleep (useconds_t us)
|
||||
{
|
||||
svcSleepThread((int64_t)us * 1000);
|
||||
}
|
||||
|
||||
long sysconf(int name)
|
||||
{
|
||||
|
||||
Binary file not shown.
@@ -16,7 +16,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <boolean.h>
|
||||
|
||||
#include <3ds.h>
|
||||
@@ -89,7 +89,8 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[],
|
||||
*argc = 0;
|
||||
while (i)
|
||||
{
|
||||
if(argv[i] && argv[i][0])
|
||||
if(argv[i] && isalnum(argv[i][0])
|
||||
&& strncmp(argv[i], "3dslink:/", 9))
|
||||
{
|
||||
argv[1] = argv[i];
|
||||
argv[2] = NULL;
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
#include <AppKit/NSOpenGL.h>
|
||||
#elif defined(HAVE_COCOATOUCH)
|
||||
#include <GLKit/GLKit.h>
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <retro_assert.h>
|
||||
@@ -41,6 +44,10 @@
|
||||
#define GLFrameworkID CFSTR("com.apple.opengles")
|
||||
#define RAScreen UIScreen
|
||||
|
||||
#ifndef UIUserInterfaceIdiomTV
|
||||
#define UIUserInterfaceIdiomTV 2
|
||||
#endif
|
||||
|
||||
@interface EAGLContext (OSXCompat) @end
|
||||
@implementation EAGLContext (OSXCompat)
|
||||
+ (void)clearCurrentContext { [EAGLContext setCurrentContext:nil]; }
|
||||
@@ -115,34 +122,69 @@ void *glkitview_init(void)
|
||||
#if defined(HAVE_COCOATOUCH)
|
||||
void cocoagl_bind_game_view_fbo(void)
|
||||
{
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
/* Implicitly initializes your audio session */
|
||||
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
|
||||
[audioSession setCategory: AVAudioSessionCategoryAmbient error: nil];
|
||||
[audioSession setActive:YES error:nil];
|
||||
#endif
|
||||
if (g_context)
|
||||
[g_view bindDrawable];
|
||||
}
|
||||
#endif
|
||||
|
||||
static float get_from_selector(Class obj_class, id obj_id, SEL selector, CGFloat *ret)
|
||||
{
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:
|
||||
[obj_class instanceMethodSignatureForSelector:selector]];
|
||||
[invocation setSelector:selector];
|
||||
[invocation setTarget:obj_id];
|
||||
[invocation invoke];
|
||||
[invocation getReturnValue:ret];
|
||||
return *ret;
|
||||
}
|
||||
|
||||
void *get_chosen_screen(void)
|
||||
{
|
||||
#if defined(HAVE_COCOA) && !defined(MAC_OS_X_VERSION_10_6)
|
||||
return [RAScreen mainScreen];
|
||||
#else
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (settings->video.monitor_index >= RAScreen.screens.count)
|
||||
NSArray *screens = [RAScreen screens];
|
||||
if (!screens || !settings)
|
||||
return NULL;
|
||||
|
||||
if (settings->video.monitor_index >= screens.count)
|
||||
{
|
||||
RARCH_WARN("video_monitor_index is greater than the number of connected monitors; using main screen instead.\n");
|
||||
#if __has_feature(objc_arc)
|
||||
return (__bridge void*)RAScreen.mainScreen;
|
||||
return (__bridge void*)screens;
|
||||
#else
|
||||
return (void*)RAScreen.mainScreen;
|
||||
return (void*)screens;
|
||||
#endif
|
||||
}
|
||||
|
||||
NSArray *screens = [RAScreen screens];
|
||||
#if __has_feature(objc_arc)
|
||||
return ((__bridge void*)[screens objectAtIndex:settings->video.monitor_index]);
|
||||
#else
|
||||
return ((void*)[screens objectAtIndex:settings->video.monitor_index]);
|
||||
#endif
|
||||
}
|
||||
|
||||
float get_backing_scale_factor(void)
|
||||
{
|
||||
#if __has_feature(objc_arc)
|
||||
RAScreen *screen = (__bridge RAScreen*)get_chosen_screen();
|
||||
#else
|
||||
RAScreen *screen = (RAScreen*)get_chosen_screen();
|
||||
#endif
|
||||
if (!screen)
|
||||
return 0.0;
|
||||
#ifdef HAVE_COCOA
|
||||
CGFloat ret;
|
||||
CocoaView *g_view = (CocoaView*)nsview_get_ptr();
|
||||
SEL selector = NSSelectorFromString(BOXSTRING("backingScaleFactor"));
|
||||
if ([screen respondsToSelector:selector])
|
||||
return (float)get_from_selector([[g_view window] class], [g_view window], selector, &ret);
|
||||
#endif
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
void cocoagl_gfx_ctx_update(void)
|
||||
@@ -162,9 +204,9 @@ static void *cocoagl_gfx_ctx_init(void *video_driver)
|
||||
|
||||
#if defined(HAVE_COCOA)
|
||||
CocoaView *g_view = (CocoaView*)nsview_get_ptr();
|
||||
#if MAC_OS_X_VERSION_10_7
|
||||
[g_view setWantsBestResolutionOpenGLSurface:YES];
|
||||
#endif
|
||||
if ([g_view respondsToSelector: @selector(setWantsBestResolutionOpenGLSurface:)])
|
||||
[g_view setWantsBestResolutionOpenGLSurface:YES];
|
||||
|
||||
NSOpenGLPixelFormatAttribute attributes [] = {
|
||||
NSOpenGLPFAColorSize, 24,
|
||||
NSOpenGLPFADoubleBuffer,
|
||||
@@ -310,20 +352,9 @@ static bool cocoagl_gfx_ctx_set_video_mode(void *data,
|
||||
return true;
|
||||
}
|
||||
|
||||
static float cocoagl_gfx_ctx_get_scale_from_selector(RAScreen *screen, SEL selector, float *ret)
|
||||
{
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:
|
||||
[[screen class] instanceMethodSignatureForSelector:selector]];
|
||||
[invocation setSelector:selector];
|
||||
[invocation setTarget:screen];
|
||||
[invocation invoke];
|
||||
[invocation getReturnValue:ret];
|
||||
return *ret;
|
||||
}
|
||||
|
||||
float cocoagl_gfx_ctx_get_native_scale(void)
|
||||
{
|
||||
static float ret = 0.0f;
|
||||
static CGFloat ret = 0.0f;
|
||||
SEL selector = NSSelectorFromString(BOXSTRING("nativeScale"));
|
||||
#if __has_feature(objc_arc)
|
||||
RAScreen *screen = (__bridge RAScreen*)get_chosen_screen();
|
||||
@@ -337,41 +368,36 @@ float cocoagl_gfx_ctx_get_native_scale(void)
|
||||
return 0.0f;
|
||||
|
||||
if ([screen respondsToSelector:selector])
|
||||
return cocoagl_gfx_ctx_get_scale_from_selector(screen, selector, &ret);
|
||||
return (float)get_from_selector([screen class], screen, selector, &ret);
|
||||
|
||||
ret = 1.0f;
|
||||
if ([screen respondsToSelector:@selector(scale)])
|
||||
ret = screen.scale;
|
||||
ret = 1.0f;
|
||||
selector = NSSelectorFromString(BOXSTRING("scale"));
|
||||
if ([screen respondsToSelector:selector])
|
||||
ret = screen.scale;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void cocoagl_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height)
|
||||
{
|
||||
#if __has_feature(objc_arc)
|
||||
RAScreen *screen = (__bridge RAScreen*)get_chosen_screen();
|
||||
#else
|
||||
RAScreen *screen = (RAScreen*)get_chosen_screen();
|
||||
#endif
|
||||
CGRect size = screen.bounds;
|
||||
float screenscale = cocoagl_gfx_ctx_get_native_scale();
|
||||
|
||||
float screenscale = cocoagl_gfx_ctx_get_native_scale();
|
||||
#if defined(HAVE_COCOA)
|
||||
CocoaView *g_view = (CocoaView*)nsview_get_ptr();
|
||||
#if MAC_OS_X_VERSION_10_7
|
||||
NSRect backingBounds = [g_view convertRectToBacking:[g_view bounds]];
|
||||
GLsizei backingPixelWidth = (GLsizei)(backingBounds.size.width),
|
||||
backingPixelHeight = (GLsizei)(backingBounds.size.height);
|
||||
size = CGRectMake(0, 0, backingPixelWidth, backingPixelHeight);
|
||||
#else
|
||||
CGRect cgrect = NSRectToCGRect([g_view frame]);
|
||||
size = CGRectMake(0, 0, CGRectGetWidth(cgrect), CGRectGetHeight(cgrect));
|
||||
#endif
|
||||
#else
|
||||
size = g_view.bounds;
|
||||
CGRect size;
|
||||
GLsizei backingPixelWidth, backingPixelHeight;
|
||||
CocoaView *g_view = (CocoaView*)nsview_get_ptr();
|
||||
CGRect cgrect = NSRectToCGRect([g_view frame]);
|
||||
#if MAC_OS_X_VERSION_10_7
|
||||
SEL selector = NSSelectorFromString(BOXSTRING("convertRectToBacking:"));
|
||||
if ([g_view respondsToSelector:selector])
|
||||
cgrect = NSRectToCGRect([g_view convertRectToBacking:[g_view bounds]]);
|
||||
#endif
|
||||
|
||||
*width = CGRectGetWidth(size) * screenscale;
|
||||
*height = CGRectGetHeight(size) * screenscale;
|
||||
backingPixelWidth = CGRectGetWidth(cgrect);
|
||||
backingPixelHeight = CGRectGetHeight(cgrect);
|
||||
size = CGRectMake(0, 0, backingPixelWidth, backingPixelHeight);
|
||||
#else
|
||||
CGRect size = g_view.bounds;
|
||||
#endif
|
||||
*width = CGRectGetWidth(size) * screenscale;
|
||||
*height = CGRectGetHeight(size) * screenscale;
|
||||
}
|
||||
|
||||
static void cocoagl_gfx_ctx_update_window_title(void *data)
|
||||
@@ -412,28 +438,30 @@ static bool cocoagl_gfx_ctx_get_metrics(void *data, enum display_metric_types ty
|
||||
float display_height = display_pixel_size.height;
|
||||
float physical_width = display_physical_size.width;
|
||||
float physical_height = display_physical_size.height;
|
||||
#if MAC_OS_X_VERSION_10_7
|
||||
float scale = screen.backingScaleFactor;
|
||||
#else
|
||||
float scale = 1.0f;
|
||||
#endif
|
||||
float scale = get_backing_scale_factor();
|
||||
float dpi = (display_width/ physical_width) * 25.4f * scale;
|
||||
#elif defined(HAVE_COCOATOUCH)
|
||||
float scale = cocoagl_gfx_ctx_get_native_scale();
|
||||
CGRect screen_rect = [screen bounds];
|
||||
|
||||
//float display_width = screen_rect.size.width;
|
||||
float display_height = screen_rect.size.height;
|
||||
float physical_width = screen_rect.size.width * scale;
|
||||
float physical_height = screen_rect.size.height * scale;
|
||||
float dpi = 0;
|
||||
float dpi = 160 * scale;
|
||||
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
dpi = 132 * scale;
|
||||
} else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
|
||||
dpi = 163 * scale;
|
||||
} else {
|
||||
dpi = 160 * scale;
|
||||
switch (UI_USER_INTERFACE_IDIOM())
|
||||
{
|
||||
case UIUserInterfaceIdiomUnspecified:
|
||||
/* TODO */
|
||||
break;
|
||||
case UIUserInterfaceIdiomPad:
|
||||
dpi = 132 * scale;
|
||||
break;
|
||||
case UIUserInterfaceIdiomPhone:
|
||||
dpi = 163 * scale;
|
||||
break;
|
||||
case UIUserInterfaceIdiomTV:
|
||||
/* TODO */
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -507,11 +535,9 @@ static gfx_ctx_proc_t cocoagl_gfx_ctx_get_proc_address(const char *symbol_name)
|
||||
{
|
||||
return (gfx_ctx_proc_t)CFBundleGetFunctionPointerForName(CFBundleGetBundleWithIdentifier(GLFrameworkID),
|
||||
(
|
||||
#if MAC_OS_X_VERSION_10_7
|
||||
#if __has_feature(objc_arc)
|
||||
__bridge
|
||||
#endif
|
||||
#endif
|
||||
CFStringRef)BOXSTRING(symbol_name)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#endif
|
||||
|
||||
#define MAX_TOUCH 16
|
||||
#define MAX_NUM_KEYBOARDS 3
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -53,9 +54,10 @@ struct input_pointer
|
||||
int16_t full_x, full_y;
|
||||
};
|
||||
|
||||
static int id_1 = -1;
|
||||
static int id_2 = -1;
|
||||
static int id_3 = -1;
|
||||
static int pad_id1 = -1;
|
||||
static int pad_id2 = -1;
|
||||
static int kbd_id[MAX_NUM_KEYBOARDS];
|
||||
static int kbd_num = 0;
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -450,8 +452,8 @@ static bool android_input_init_handle(void)
|
||||
RARCH_LOG("Set engine_handle_dpad to 'Get Axis Value' (for reading extra analog sticks)");
|
||||
engine_handle_dpad = engine_handle_dpad_getaxisvalue;
|
||||
}
|
||||
id_1 = -1;
|
||||
id_2 = -1;
|
||||
pad_id1 = -1;
|
||||
pad_id2 = -1;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -549,6 +551,14 @@ static INLINE int android_input_poll_event_type_motion(
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool is_keyboard_id(int id)
|
||||
{
|
||||
for(int i=0; i<kbd_num; i++)
|
||||
if (id == kbd_id[i]) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static INLINE void android_input_poll_event_type_keyboard(
|
||||
AInputEvent *event, int keycode, int *handled)
|
||||
{
|
||||
@@ -668,6 +678,14 @@ static void handle_hotplug(android_input_data_t *android_data,
|
||||
* Also group the NVIDIA button on the controller with the
|
||||
* main controller inputs so it's usable. It's mapped to
|
||||
* menu by default
|
||||
*
|
||||
* The NVIDIA button is identified as "Virtual" device when first
|
||||
* pressed. CEC remote input is also identified as "Virtual" device.
|
||||
* If a virtual device is detected before a controller then it will
|
||||
* be assigned to port 0 as "SHIELD Virtual Controller". When a real
|
||||
* controller is detected it will overwrite the virtual controller
|
||||
* and be grouped with the NVIDIA button of the virtual device.
|
||||
*
|
||||
*/
|
||||
if(strstr(device_model, "SHIELD Android TV") && (
|
||||
strstr(device_name, "Virtual") ||
|
||||
@@ -677,33 +695,34 @@ static void handle_hotplug(android_input_data_t *android_data,
|
||||
RARCH_LOG("Special Device Detected: %s\n", device_model);
|
||||
{
|
||||
#if 0
|
||||
RARCH_LOG("- Pads Mapped: %d\n- Device Name: %s\n- IDS: %d, %d, %d", android_data->pads_connected, device_name, id, id_1, id_2);
|
||||
RARCH_LOG("- Pads Mapped: %d\n- Device Name: %s\n- IDS: %d, %d, %d", android_data->pads_connected, device_name, id, pad_id1, pad_id2);
|
||||
#endif
|
||||
/* remove the remote if it is mapped */
|
||||
if (strstr(android_data->pad_states[0].name,"SHIELD Remote"))
|
||||
/* remove the remote or virtual controller device if it is mapped */
|
||||
if (strstr(android_data->pad_states[0].name,"SHIELD Remote") ||
|
||||
strstr(android_data->pad_states[0].name,"SHIELD Virtual Controller"))
|
||||
{
|
||||
id_1 = -1;
|
||||
id_2 = -1;
|
||||
pad_id1 = -1;
|
||||
pad_id2 = -1;
|
||||
android_data->pads_connected = 0;
|
||||
*port = 0;
|
||||
strlcpy(name_buf, device_name, sizeof(name_buf));
|
||||
}
|
||||
/* early return, we don't want this to be mapped unless the actual controller has been mapped*/
|
||||
/* if the actual controller has not been mapped yet, then configure Virtual device for now */
|
||||
if (strstr(device_name, "Virtual") && android_data->pads_connected==0)
|
||||
return;
|
||||
strlcpy (name_buf, "SHIELD Virtual Controller", sizeof(name_buf));
|
||||
else
|
||||
strlcpy (name_buf, "NVIDIA SHIELD Controller", sizeof(name_buf));
|
||||
|
||||
/* apply the hack only for the first controller
|
||||
* store the id for later use
|
||||
*/
|
||||
if (strstr(device_name, "NVIDIA Corporation NVIDIA Controller v01.03") && android_data->pads_connected==0)
|
||||
id_1 = id;
|
||||
else if (strstr(device_name, "Virtual") && id_1 != -1)
|
||||
pad_id1 = id;
|
||||
else if (strstr(device_name, "Virtual") && pad_id1 != -1)
|
||||
{
|
||||
id = id_1;
|
||||
id = pad_id1;
|
||||
return;
|
||||
}
|
||||
|
||||
strlcpy (name_buf, "NVIDIA SHIELD Controller", sizeof(name_buf));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -718,12 +737,12 @@ static void handle_hotplug(android_input_data_t *android_data,
|
||||
/* only use the hack if the device is one of the built-in devices */
|
||||
RARCH_LOG("Special Device Detected: %s\n", device_model);
|
||||
{
|
||||
if ( id_1 < 0 )
|
||||
id_1 = id;
|
||||
if ( pad_id1 < 0 )
|
||||
pad_id1 = id;
|
||||
else
|
||||
id_2 = id;
|
||||
pad_id2 = id;
|
||||
|
||||
if ( id_2 > 0)
|
||||
if ( pad_id2 > 0)
|
||||
return;
|
||||
|
||||
strlcpy (name_buf, "NVIDIA SHIELD Portable", sizeof(name_buf));
|
||||
@@ -741,12 +760,12 @@ static void handle_hotplug(android_input_data_t *android_data,
|
||||
/* only use the hack if the device is one of the built-in devices */
|
||||
RARCH_LOG("Special Device Detected: %s\n", device_model);
|
||||
{
|
||||
if ( id_1 < 0 )
|
||||
id_1 = id;
|
||||
if ( pad_id1 < 0 )
|
||||
pad_id1 = id;
|
||||
else
|
||||
id_2 = id;
|
||||
pad_id2 = id;
|
||||
|
||||
if ( id_2 > 0)
|
||||
if ( pad_id2 > 0)
|
||||
return;
|
||||
|
||||
strlcpy (name_buf, "GPD XD", sizeof(name_buf));
|
||||
@@ -764,12 +783,12 @@ static void handle_hotplug(android_input_data_t *android_data,
|
||||
/* only use the hack if the device is one of the built-in devices */
|
||||
RARCH_LOG("Special Device Detected: %s\n", device_model);
|
||||
{
|
||||
if ( id_1 < 0 )
|
||||
id_1 = id;
|
||||
if ( pad_id1 < 0 )
|
||||
pad_id1 = id;
|
||||
else
|
||||
id_2 = id;
|
||||
pad_id2 = id;
|
||||
|
||||
if ( id_2 > 0)
|
||||
if ( pad_id2 > 0)
|
||||
return;
|
||||
|
||||
strlcpy (name_buf, "XPERIA Play", sizeof(name_buf));
|
||||
@@ -787,12 +806,12 @@ static void handle_hotplug(android_input_data_t *android_data,
|
||||
/* only use the hack if the device is one of the built-in devices */
|
||||
RARCH_LOG("ARCHOS GAMEPAD Detected: %s\n", device_model);
|
||||
{
|
||||
if ( id_1 < 0 )
|
||||
id_1 = id;
|
||||
if ( pad_id1 < 0 )
|
||||
pad_id1 = id;
|
||||
else
|
||||
id_2 = id;
|
||||
pad_id2 = id;
|
||||
|
||||
if ( id_2 > 0)
|
||||
if ( pad_id2 > 0)
|
||||
return;
|
||||
|
||||
strlcpy (name_buf, "ARCHOS GamePad", sizeof(name_buf));
|
||||
@@ -846,17 +865,17 @@ static void handle_hotplug(android_input_data_t *android_data,
|
||||
strlcpy(name_buf, "Moga IME", sizeof(name_buf));
|
||||
|
||||
// if device is keyboard only and didn't match any of the devices above
|
||||
// then assume it is a keyboard, register the id, and return unless another
|
||||
// keyboard is already registered
|
||||
else if(source == AINPUT_SOURCE_KEYBOARD && id_3 == -1)
|
||||
// then assume it is a keyboard, register the id, and return unless the
|
||||
// maximum number of keyboards are already registered
|
||||
else if(source == AINPUT_SOURCE_KEYBOARD && kbd_num < MAX_NUM_KEYBOARDS)
|
||||
{
|
||||
id_3 = id;
|
||||
kbd_id[kbd_num] = id;
|
||||
kbd_num++;
|
||||
return;
|
||||
}
|
||||
|
||||
// if device was not keyboard only, yet did not match any of the devices
|
||||
// above or another keyboard was already mapped, then try to autoconfigure
|
||||
// as gamepad based on device_name
|
||||
// then try to autoconfigure as gamepad based on device_name
|
||||
else if (!string_is_empty(device_name))
|
||||
strlcpy(name_buf, device_name, sizeof(name_buf));
|
||||
|
||||
@@ -915,8 +934,8 @@ static int android_input_get_id(AInputEvent *event)
|
||||
{
|
||||
int id = AInputEvent_getDeviceId(event);
|
||||
|
||||
if (id == id_2)
|
||||
id = id_1;
|
||||
if (id == pad_id2)
|
||||
id = pad_id1;
|
||||
|
||||
return id;
|
||||
}
|
||||
@@ -940,7 +959,7 @@ static void android_input_poll_input(void *data)
|
||||
int id = android_input_get_id(event);
|
||||
int port = android_input_get_id_port(android_data, id, source);
|
||||
|
||||
if (port < 0 && id != id_3)
|
||||
if (port < 0 && !is_keyboard_id(id))
|
||||
handle_hotplug(android_data, android_app,
|
||||
&port, id, source);
|
||||
|
||||
@@ -955,8 +974,10 @@ static void android_input_poll_input(void *data)
|
||||
{
|
||||
int keycode = AKeyEvent_getKeyCode(event);
|
||||
|
||||
if (id == id_3 && !predispatched)
|
||||
android_input_poll_event_type_keyboard(event, keycode, &handled);
|
||||
if (is_keyboard_id(id))
|
||||
{
|
||||
if (!predispatched) android_input_poll_event_type_keyboard(event, keycode, &handled);
|
||||
}
|
||||
else
|
||||
android_input_poll_event_type_key(android_app,
|
||||
event, port, keycode, source, type_event, &handled);
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
|
||||
#include "../drivers_keyboard/keyboard_event_apple.h"
|
||||
|
||||
/* Forward declarations */
|
||||
extern float get_backing_scale_factor(void);
|
||||
|
||||
int32_t cocoa_input_find_any_key(void)
|
||||
{
|
||||
cocoa_input_data_t *apple = (cocoa_input_data_t*)input_driver_get_data();
|
||||
@@ -140,8 +143,16 @@ static void cocoa_input_poll(void *data)
|
||||
{
|
||||
uint32_t i;
|
||||
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
|
||||
#ifndef IOS
|
||||
float backing_scale_factor = get_backing_scale_factor();
|
||||
#endif
|
||||
|
||||
for (i = 0; i < apple->touch_count; i++)
|
||||
{
|
||||
#ifndef IOS
|
||||
apple->touches[i].screen_x *= backing_scale_factor;
|
||||
apple->touches[i].screen_y *= backing_scale_factor;
|
||||
#endif
|
||||
input_translate_coord_viewport(
|
||||
apple->touches[i].screen_x,
|
||||
apple->touches[i].screen_y,
|
||||
@@ -149,6 +160,7 @@ static void cocoa_input_poll(void *data)
|
||||
&apple->touches[i].fixed_y,
|
||||
&apple->touches[i].full_x,
|
||||
&apple->touches[i].full_y);
|
||||
}
|
||||
|
||||
if (apple->joypad)
|
||||
apple->joypad->poll();
|
||||
@@ -184,17 +196,27 @@ static int16_t cocoa_mouse_state(cocoa_input_data_t *apple,
|
||||
static int16_t cocoa_mouse_state_screen(cocoa_input_data_t *apple,
|
||||
unsigned id)
|
||||
{
|
||||
int16_t val;
|
||||
#ifndef IOS
|
||||
float backing_scale_factor = get_backing_scale_factor();
|
||||
#endif
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_DEVICE_ID_MOUSE_X:
|
||||
return apple->window_pos_x;
|
||||
case RETRO_DEVICE_ID_MOUSE_Y:
|
||||
return apple->window_pos_y;
|
||||
default:
|
||||
val = apple->window_pos_x;
|
||||
break;
|
||||
case RETRO_DEVICE_ID_MOUSE_Y:
|
||||
val = apple->window_pos_y;
|
||||
break;
|
||||
default:
|
||||
return cocoa_mouse_state(apple, id);
|
||||
}
|
||||
|
||||
return cocoa_mouse_state(apple, id);
|
||||
|
||||
#ifndef IOS
|
||||
val *= backing_scale_factor;
|
||||
#endif
|
||||
return val;
|
||||
}
|
||||
|
||||
static int16_t cocoa_pointer_state(cocoa_input_data_t *apple,
|
||||
|
||||
@@ -314,7 +314,7 @@
|
||||
"-DHAVE_HID",
|
||||
"-DHAVE_XMB",
|
||||
"-DHAVE_MMAP",
|
||||
"-DHAVE_LIBRETRODB",
|
||||
"-DHAVE_LIBRETRODB",
|
||||
"-DHAVE_FILTERS_BUILTIN",
|
||||
);
|
||||
OTHER_LDFLAGS = "-lz";
|
||||
|
||||
@@ -74,6 +74,7 @@ extern apple_frontend_settings_t apple_frontend_settings;
|
||||
|
||||
- (void)showGameView;
|
||||
- (void)toggleUI;
|
||||
- (void)supportOtherAudioSessions;
|
||||
|
||||
- (void)refreshSystemConfig;
|
||||
- (void)mainMenuPushPop: (bool)pushp;
|
||||
|
||||
+121
-90
@@ -33,8 +33,6 @@
|
||||
|
||||
static id apple_platform;
|
||||
|
||||
void *get_chosen_screen(void);
|
||||
|
||||
void apple_rarch_exited(void)
|
||||
{
|
||||
[[NSApplication sharedApplication] terminate:nil];
|
||||
@@ -107,31 +105,22 @@ void apple_rarch_exited(void)
|
||||
{
|
||||
NSPoint pos;
|
||||
NSPoint mouse_pos;
|
||||
CGFloat backing_scale_factor = 1.0f;
|
||||
NSScreen *screen = (NSScreen*)get_chosen_screen();
|
||||
|
||||
apple = (cocoa_input_data_t*)input_driver_get_data();
|
||||
apple = (cocoa_input_data_t*)input_driver_get_data();
|
||||
if (!apple)
|
||||
return;
|
||||
|
||||
(void)screen;
|
||||
|
||||
/* Relative */
|
||||
apple->mouse_rel_x = event.deltaX;
|
||||
apple->mouse_rel_y = event.deltaY;
|
||||
|
||||
#if MAC_OS_X_VERSION_10_7
|
||||
backing_scale_factor = screen.backingScaleFactor;
|
||||
#endif
|
||||
|
||||
/* Absolute */
|
||||
pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil];
|
||||
apple->touches[0].screen_x = pos.x * backing_scale_factor;
|
||||
apple->touches[0].screen_y = pos.y * backing_scale_factor;
|
||||
apple->touches[0].screen_x = pos.x;
|
||||
apple->touches[0].screen_y = pos.y;
|
||||
|
||||
mouse_pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil];
|
||||
apple->window_pos_x = (int16_t)mouse_pos.x * backing_scale_factor;
|
||||
apple->window_pos_y = (int16_t)mouse_pos.y * backing_scale_factor;
|
||||
apple->window_pos_x = (int16_t)mouse_pos.x;
|
||||
apple->window_pos_y = (int16_t)mouse_pos.y;
|
||||
}
|
||||
break;
|
||||
case NSScrollWheel:
|
||||
@@ -173,14 +162,20 @@ static char** waiting_argv;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
#define NS_WINDOW_COLLECTION_BEHAVIOR_FULLSCREEN_PRIMARY (1 << 17)
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
||||
{
|
||||
unsigned i;
|
||||
apple_platform = self;
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||
[self.window setCollectionBehavior:[self.window collectionBehavior] | NSWindowCollectionBehaviorFullScreenPrimary];
|
||||
#endif
|
||||
SEL selector = NSSelectorFromString(BOXSTRING("setCollectionBehavior:"));
|
||||
SEL fsselector = NSSelectorFromString(BOXSTRING("toggleFullScreen:"));
|
||||
apple_platform = self;
|
||||
|
||||
if ([self.window respondsToSelector:selector])
|
||||
{
|
||||
if ([self.window respondsToSelector:fsselector])
|
||||
[self.window setCollectionBehavior:NS_WINDOW_COLLECTION_BEHAVIOR_FULLSCREEN_PRIMARY];
|
||||
}
|
||||
|
||||
[self.window setAcceptsMouseMovedEvents: YES];
|
||||
|
||||
@@ -202,6 +197,8 @@ static char** waiting_argv;
|
||||
apple_rarch_exited();
|
||||
|
||||
waiting_argc = 0;
|
||||
|
||||
[self performSelectorOnMainThread:@selector(rarch_main) withObject:nil waitUntilDone:NO];
|
||||
}
|
||||
|
||||
static void poll_iteration(void)
|
||||
@@ -235,7 +232,6 @@ static void poll_iteration(void)
|
||||
|
||||
- (void)applicationDidBecomeActive:(NSNotification *)notification
|
||||
{
|
||||
[self performSelectorOnMainThread:@selector(rarch_main) withObject:nil waitUntilDone:NO];
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(NSNotification *)notification
|
||||
@@ -290,96 +286,123 @@ extern void action_ok_push_quick_menu(void);
|
||||
}
|
||||
}
|
||||
|
||||
static void open_core_handler(NSOpenPanel *panel, NSInteger result)
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
case NSOKButton:
|
||||
if (panel.URL)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
NSURL *url = (NSURL*)panel.URL;
|
||||
NSString *__core = url.path;
|
||||
|
||||
if (!__core)
|
||||
return;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)__core.UTF8String);
|
||||
ui_companion_event_command(EVENT_CMD_LOAD_CORE);
|
||||
|
||||
if (menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL) && settings->core.set_supports_no_game_enable)
|
||||
{
|
||||
int ret = 0;
|
||||
runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL);
|
||||
ret = menu_common_load_content(NULL, NULL, false, CORE_TYPE_PLAIN);
|
||||
if (ret == -1)
|
||||
action_ok_push_quick_menu();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NSCancelButton:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void open_document_handler(NSOpenPanel *panel, NSInteger result)
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
case NSOKButton:
|
||||
if (panel.URL)
|
||||
{
|
||||
struct retro_system_info *system = NULL;
|
||||
NSURL *url = (NSURL*)panel.URL;
|
||||
NSString *__core = url.path;
|
||||
const char *core_name = NULL;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
if (system)
|
||||
core_name = system->library_name;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, (void*)__core.UTF8String);
|
||||
|
||||
if (core_name)
|
||||
ui_companion_event_command(EVENT_CMD_LOAD_CONTENT);
|
||||
}
|
||||
break;
|
||||
case NSCancelButton:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)openCore:(id)sender {
|
||||
NSOpenPanel* panel = (NSOpenPanel*)[NSOpenPanel openPanel];
|
||||
#if defined(MAC_OS_X_VERSION_10_6)
|
||||
settings_t *settings = config_get_ptr();
|
||||
NSString *startdir = BOXSTRING(settings->libretro_directory);
|
||||
NSArray *filetypes = [[NSArray alloc] initWithObjects:BOXSTRING("dylib"), BOXSTRING("Core"), nil];
|
||||
[panel setAllowedFileTypes:filetypes];
|
||||
#if defined(MAC_OS_X_VERSION_10_6)
|
||||
[panel setMessage:BOXSTRING("Load Core")];
|
||||
[panel setDirectoryURL:[NSURL fileURLWithPath:startdir]];
|
||||
[panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result)
|
||||
{
|
||||
[[NSApplication sharedApplication] stopModal];
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case NSOKButton:
|
||||
if (panel.URL)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
NSURL *url = (NSURL*)panel.URL;
|
||||
NSString *__core = url.path;
|
||||
|
||||
if (!__core)
|
||||
return;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)__core.UTF8String);
|
||||
ui_companion_event_command(EVENT_CMD_LOAD_CORE);
|
||||
|
||||
if (menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL) && settings->core.set_supports_no_game_enable)
|
||||
{
|
||||
int ret = 0;
|
||||
runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL);
|
||||
ret = menu_common_load_content(NULL, NULL, false, CORE_TYPE_PLAIN);
|
||||
if (ret == -1)
|
||||
action_ok_push_quick_menu();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NSCancelButton:
|
||||
break;
|
||||
}
|
||||
open_core_handler(panel, result);
|
||||
}];
|
||||
#else
|
||||
[panel beginSheetForDirectory:nil file:nil modalForWindopw:[self window] modalDelegate:self didEndSelector:@selector(didEndSaveSheet:returnCode:contextInfo:) contextInfo:NULL];
|
||||
#endif
|
||||
[[NSApplication sharedApplication] runModalForWindow:panel];
|
||||
#else
|
||||
[panel setTitle:NSLocalizedString(BOXSTRING("Load Core"), BOXSTRING("open panel"))];
|
||||
[panel setDirectory:startdir];
|
||||
[panel setCanChooseDirectories:NO];
|
||||
[panel setCanChooseFiles:YES];
|
||||
[panel setAllowsMultipleSelection:NO];
|
||||
[panel setTreatsFilePackagesAsDirectories:NO];
|
||||
NSInteger result = [panel runModal];
|
||||
if (result == 1)
|
||||
open_core_handler(panel, result);
|
||||
#endif
|
||||
[g_context makeCurrentContext];
|
||||
}
|
||||
|
||||
- (void)openDocument:(id)sender
|
||||
{
|
||||
NSOpenPanel* panel = (NSOpenPanel*)[NSOpenPanel openPanel];
|
||||
NSOpenPanel* panel = (NSOpenPanel*)[NSOpenPanel openPanel];
|
||||
settings_t *settings = config_get_ptr();
|
||||
NSString *startdir = BOXSTRING(settings->menu_content_directory);
|
||||
|
||||
if (!startdir.length)
|
||||
startdir = BOXSTRING("/");
|
||||
#if defined(MAC_OS_X_VERSION_10_6)
|
||||
settings_t *settings = config_get_ptr();
|
||||
NSString *startdir = BOXSTRING(settings->menu_content_directory);
|
||||
if (!startdir.length)
|
||||
startdir = BOXSTRING("/");
|
||||
[panel setDirectoryURL:[NSURL fileURLWithPath:startdir]];
|
||||
[panel setMessage:BOXSTRING("Load Content")];
|
||||
[panel setMessage:BOXSTRING("Load Content")];
|
||||
[panel setDirectoryURL:[NSURL fileURLWithPath:startdir]];
|
||||
[panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result)
|
||||
{
|
||||
[[NSApplication sharedApplication] stopModal];
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case NSOKButton:
|
||||
if (panel.URL)
|
||||
{
|
||||
struct retro_system_info *system = NULL;
|
||||
NSURL *url = (NSURL*)panel.URL;
|
||||
NSString *__core = url.path;
|
||||
const char *core_name = NULL;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
if (system)
|
||||
core_name = system->library_name;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, (void*)__core.UTF8String);
|
||||
|
||||
if (core_name)
|
||||
ui_companion_event_command(EVENT_CMD_LOAD_CONTENT);
|
||||
}
|
||||
break;
|
||||
case NSCancelButton:
|
||||
break;
|
||||
}
|
||||
open_document_handler(panel, result);
|
||||
}];
|
||||
#else
|
||||
[panel beginSheetForDirectory:nil file:nil modalForWindopw:[self window] modalDelegate:self didEndSelector:@selector(didEndSaveSheet:returnCode:contextInfo:) contextInfo:NULL];
|
||||
#endif
|
||||
[[NSApplication sharedApplication] runModalForWindow:panel];
|
||||
#else
|
||||
[panel setTitle:NSLocalizedString(BOXSTRING("Load Content"), BOXSTRING("open panel"))];
|
||||
[panel setDirectory:startdir];
|
||||
[panel setCanChooseDirectories:NO];
|
||||
[panel setCanChooseFiles:YES];
|
||||
[panel setAllowsMultipleSelection:NO];
|
||||
[panel setTreatsFilePackagesAsDirectories:NO];
|
||||
NSInteger result = [panel runModal];
|
||||
if (result == 1)
|
||||
open_document_handler(panel, result);
|
||||
#endif
|
||||
[g_context makeCurrentContext];
|
||||
}
|
||||
|
||||
@@ -458,8 +481,16 @@ extern void action_ok_push_quick_menu(void);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc == 2)
|
||||
{
|
||||
if (argv[1] != '\0')
|
||||
if (!strncmp(argv[1], "-psn", 4))
|
||||
argc = 1;
|
||||
}
|
||||
|
||||
waiting_argc = argc;
|
||||
waiting_argv = argv;
|
||||
|
||||
return NSApplicationMain(argc, (const char **) argv);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
#include "../../input/drivers/cocoa_input.h"
|
||||
#include "../../input/drivers_keyboard/keyboard_event_apple.h"
|
||||
#include "../../retroarch.h"
|
||||
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#endif
|
||||
#include "../../frontend/frontend.h"
|
||||
#include "../../runloop.h"
|
||||
|
||||
@@ -44,6 +46,12 @@ void apple_rarch_exited(void);
|
||||
|
||||
static void rarch_enable_ui(void)
|
||||
{
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
|
||||
[audioSession setCategory: AVAudioSessionCategoryAmbient error: nil];
|
||||
[audioSession setActive:YES error:nil];
|
||||
#endif
|
||||
|
||||
bool boolean = true;
|
||||
|
||||
ui_companion_set_foreground(true);
|
||||
@@ -62,6 +70,11 @@ static void rarch_disable_ui(void)
|
||||
runloop_ctl(RUNLOOP_CTL_SET_PAUSED, &boolean);
|
||||
runloop_ctl(RUNLOOP_CTL_SET_IDLE, &boolean);
|
||||
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
|
||||
[audioSession setCategory: AVAudioSessionCategoryAmbient error: nil];
|
||||
[audioSession setActive:YES error:nil];
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ui_companion_cocoatouch_event_command(
|
||||
@@ -314,6 +327,12 @@ enum
|
||||
|
||||
+ (RetroArch_iOS*)get
|
||||
{
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
/* Implicitly initializes your audio session. */
|
||||
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
|
||||
[audioSession setCategory: AVAudioSessionCategoryAmbient error: nil];
|
||||
[audioSession setActive:YES error:nil];
|
||||
#endif
|
||||
return (RetroArch_iOS*)[[UIApplication sharedApplication] delegate];
|
||||
}
|
||||
|
||||
@@ -326,6 +345,11 @@ enum
|
||||
if (rarch_main(0, NULL, NULL))
|
||||
apple_rarch_exited();
|
||||
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
/* Other background audio check */
|
||||
[self supportOtherAudioSessions];
|
||||
#endif
|
||||
|
||||
/* Setup window */
|
||||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
[self.window makeKeyAndVisible];
|
||||
@@ -337,6 +361,10 @@ enum
|
||||
[self refreshSystemConfig];
|
||||
[self showGameView];
|
||||
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
[self supportOtherAudioSessions];
|
||||
#endif
|
||||
|
||||
if (rarch_main(0, NULL, NULL))
|
||||
apple_rarch_exited();
|
||||
|
||||
@@ -352,7 +380,9 @@ enum
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application
|
||||
{
|
||||
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
[self supportOtherAudioSessions];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application
|
||||
@@ -365,7 +395,10 @@ enum
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
[self supportOtherAudioSessions];
|
||||
#endif
|
||||
if (settings->ui.companion_start_on_boot)
|
||||
return;
|
||||
|
||||
@@ -374,6 +407,9 @@ enum
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application
|
||||
{
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
[self supportOtherAudioSessions];
|
||||
#endif
|
||||
dispatch_async(dispatch_get_main_queue(),
|
||||
^{
|
||||
ui_companion_cocoatouch_event_command(NULL, EVENT_CMD_MENU_SAVE_CURRENT_CONFIG);
|
||||
@@ -385,7 +421,7 @@ enum
|
||||
{
|
||||
NSString *filename = (NSString*)url.path.lastPathComponent;
|
||||
NSError *error = nil;
|
||||
|
||||
|
||||
[[NSFileManager defaultManager] moveItemAtPath:[url path] toPath:[self.documentsDirectory stringByAppendingPathComponent:filename] error:&error];
|
||||
|
||||
if (error)
|
||||
@@ -402,6 +438,10 @@ enum
|
||||
|
||||
- (void)showGameView
|
||||
{
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
/* implicitly initializes your audio session */
|
||||
[self supportOtherAudioSessions];
|
||||
#endif
|
||||
[self popToRootViewControllerAnimated:NO];
|
||||
[self setToolbarHidden:true animated:NO];
|
||||
[[UIApplication sharedApplication] setStatusBarHidden:true withAnimation:UIStatusBarAnimationNone];
|
||||
@@ -414,7 +454,9 @@ enum
|
||||
|
||||
- (IBAction)showPauseMenu:(id)sender
|
||||
{
|
||||
#ifndef HAVE_AVFOUNDATION
|
||||
ui_companion_cocoatouch_event_command(NULL, EVENT_CMD_AUDIO_STOP);
|
||||
#endif
|
||||
rarch_enable_ui();
|
||||
|
||||
[[UIApplication sharedApplication] setStatusBarHidden:false withAnimation:UIStatusBarAnimationNone];
|
||||
@@ -433,6 +475,9 @@ enum
|
||||
{
|
||||
[self showPauseMenu:self];
|
||||
}
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
[self supportOtherAudioSessions];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)refreshSystemConfig
|
||||
@@ -471,6 +516,16 @@ enum
|
||||
}
|
||||
}
|
||||
|
||||
- (void)supportOtherAudioSessions
|
||||
{
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
/* implicitly initializes your audio session */
|
||||
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
|
||||
[audioSession setCategory: AVAudioSessionCategoryAmbient error: nil];
|
||||
[audioSession setActive:YES error:nil];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)mainMenuRenderMessageBox:(NSString *)msg
|
||||
{
|
||||
[self.mainmenu renderMessageBox:msg];
|
||||
@@ -501,6 +556,9 @@ void apple_rarch_exited(void)
|
||||
|
||||
if (!ap)
|
||||
return;
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
[ap supportOtherAudioSessions];
|
||||
#endif
|
||||
[ap showPauseMenu:ap];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user