(OSX PPC) Start making things more backwards compatible with OSX 10.4 - avoid CGFloat, NSUinteger, NSInteger, use <AvailabilityMacros.h> instead of <Availability.h>, etc.

This commit is contained in:
neville 2015-03-30 17:10:31 +02:00
parent fc498c02dc
commit ddb5aab3ed
9 changed files with 18 additions and 20 deletions

View File

@ -16,8 +16,6 @@
#include <string.h>
#include <objc/runtime.h>
#import "../common/RetroArch_Apple.h"
#include "../../input/drivers/apple_input.h"
#include "../../frontend/frontend.h"
@ -52,7 +50,7 @@ void apple_rarch_exited(void)
if (!apple)
return;
switch ((NSInteger)event_type)
switch ((int32_t)event_type)
{
case NSKeyDown:
case NSKeyUp:
@ -63,7 +61,7 @@ void apple_rarch_exited(void)
if (ch && ch.length != 0)
{
NSUInteger i;
uint32_t i;
character = [ch characterAtIndex:0];
if (event.modifierFlags & NSAlphaShiftKeyMask)
@ -79,7 +77,7 @@ void apple_rarch_exited(void)
if (event.modifierFlags & NSNumericPadKeyMask)
mod |= RETROKMOD_NUMLOCK;
for (i = 1; i < ch.length; i ++)
for (i = 1; i < ch.length; i++)
apple_input_keyboard_event(event_type == NSKeyDown,
0, [ch characterAtIndex:i], mod, RETRO_DEVICE_KEYBOARD);
}
@ -432,7 +430,7 @@ static void poll_iteration(void)
rarch_main_command(cmd);
}
- (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
- (void)alertDidEnd:(NSAlert *)alert returnCode:(int32_t)returnCode contextInfo:(void *)contextInfo
{
[[NSApplication sharedApplication] stopModal];
}

View File

@ -14,7 +14,6 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#import <objc/runtime.h>
#import "../common/RetroArch_Apple.h"
#include <retro_miscellaneous.h>
#include "../../settings.h"
@ -210,12 +209,12 @@ NSWindowDelegate>
}
#pragma mark Section Table
- (NSInteger)numberOfRowsInTableView:(NSTableView*)view
- (int32_t)numberOfRowsInTableView:(NSTableView*)view
{
return self.settings.count;
}
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int32_t)row
{
#if defined(MAC_OS_X_VERSION_10_6)
return objc_getAssociatedObject([self.settings objectAtIndex:row], associated_name_tag);
@ -232,12 +231,12 @@ NSWindowDelegate>
}
#pragma mark Setting Outline
- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
- (int32_t)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
{
return (item == nil) ? [self.currentGroup count] : [item count];
}
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)idx ofItem:(id)item
- (id)outlineView:(NSOutlineView *)outlineView child:(int32_t)idx ofItem:(id)item
{
return (item == nil) ? [self.currentGroup objectAtIndex:idx] : [item objectAtIndex:idx];
}

View File

@ -14,7 +14,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#import <Availability.h>
#import <AvailabilityMacros.h>
#import "RetroArch_Apple.h"
#include "../../general.h"
#include "../../runloop.h"

View File

@ -228,9 +228,9 @@ static bool apple_gfx_ctx_set_video_mode(void *data, unsigned width, unsigned he
return true;
}
CGFloat apple_gfx_ctx_get_native_scale(void)
float apple_gfx_ctx_get_native_scale(void)
{
static CGFloat ret = 0.0f;
static float ret = 0.0f;
SEL selector = NSSelectorFromString(BOXSTRING("nativeScale"));
RAScreen *screen = (RAScreen*)get_chosen_screen();
@ -261,7 +261,7 @@ static void apple_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned*
RAScreen *screen = (RAScreen*)get_chosen_screen();
CGRect size = screen.bounds;
gl_t *gl = (gl_t*)data;
CGFloat screenscale = apple_gfx_ctx_get_native_scale();
float screenscale = apple_gfx_ctx_get_native_scale();
if (gl)
{

View File

@ -60,10 +60,11 @@ void apple_display_alert(const char *message, const char *title)
- (BOOL)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error
{
unsigned i;
bool hasDot = false;
if (partialString.length)
for (NSUInteger i = 0; i < partialString.length; i ++)
for (i = 0; i < partialString.length; i ++)
{
unichar ch = [partialString characterAtIndex:i];

View File

@ -75,7 +75,7 @@ static bool font_renderer_create_atlas(CTFontRef face, ct_font_renderer_t *handl
CGGlyph glyphs[CT_ATLAS_SIZE];
CGRect bounds[CT_ATLAS_SIZE];
CGSize advances[CT_ATLAS_SIZE];
CGFloat ascent, descent;
float ascent, descent;
CGContextRef offscreen;
CFStringRef keys[] = { kCTFontAttributeName };
CFDictionaryRef attr;

View File

@ -27,7 +27,7 @@ static void video_texture_png_load_gl(struct texture_image *ti,
unsigned *id)
{
/* Generate the OpenGL texture object */
glGenTextures(1, id);
glGenTextures(1, (GLuint*)id);
gl_load_texture_data((GLuint)*id,
RARCH_WRAP_EDGE, filter_type,
4 /* TODO/FIXME - dehardcode */,

View File

@ -1,4 +1,4 @@
#include <Availability.h>
#include <AvailabilityMacros.h>
#ifndef __IPHONE_OS_VERSION_MAX_ALLOWED
#define __IPHONE_OS_VERSION_MAX_ALLOWED 00000

View File

@ -124,7 +124,7 @@ static void remove_device(void* context, IOReturn result, void* sender)
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
struct pad_connection* connection = (struct pad_connection*)context;
if (connection && connection->slot < MAX_USERS)
if (connection && (connection->slot < MAX_USERS))
{
char msg[PATH_MAX_LENGTH];