diff --git a/apple/common/rarch_wrapper.h b/apple/common/rarch_wrapper.h index 471f56bcf4..1f2163ab49 100644 --- a/apple/common/rarch_wrapper.h +++ b/apple/common/rarch_wrapper.h @@ -38,6 +38,4 @@ gfx_ctx_proc_t apple_gfx_ctx_get_proc_address(const char *symbol_name); void apple_bind_game_view_fbo(void); #endif -#define ios_add_log_message(...) printf(__VA_ARGS__) - #endif diff --git a/apple/iOS/bluetooth/btdynamic.c b/apple/iOS/bluetooth/btdynamic.c index bfdcde2857..1fc48ebb4c 100644 --- a/apple/iOS/bluetooth/btdynamic.c +++ b/apple/iOS/bluetooth/btdynamic.c @@ -71,7 +71,7 @@ bool btstack_try_load() if (btstack_tested) return btstack_loaded; - ios_add_log_message("BTstack: Attempting to load"); + RARCH_LOG("BTstack: Attempting to load\n"); btstack_tested = true; btstack_loaded = false; @@ -80,8 +80,8 @@ bool btstack_try_load() if (!btstack) { - ios_add_log_message("BTstack: /usr/lib/libBTstack.dylib not loadable"); - ios_add_log_message("BTstack: Not loaded"); + RARCH_LOG("BTstack: /usr/lib/libBTstack.dylib not loadable\n"); + RARCH_LOG("BTstack: Not loaded\n"); return false; } @@ -91,8 +91,8 @@ bool btstack_try_load() if (!*grabbers[i].target) { - ios_add_log_message("BTstack: Symbol %s not found in /usr/lib/libBTstack.dylib", grabbers[i].name); - ios_add_log_message("BTstack: Not loaded"); + RARCH_LOG("BTstack: Symbol %s not found in /usr/lib/libBTstack.dylib\n", grabbers[i].name); + RARCH_LOG("BTstack: Not loaded\n"); dlclose(btstack); return false; @@ -102,7 +102,7 @@ bool btstack_try_load() run_loop_init_ptr(RUN_LOOP_COCOA); bt_register_packet_handler_ptr(btpad_packet_handler); - ios_add_log_message("BTstack: Loaded"); + RARCH_LOG("BTstack: Loaded\n"); btstack_loaded = true; return true; @@ -115,7 +115,7 @@ void btstack_set_poweron(bool on) if (!btstack_open && bt_open_ptr()) { - ios_add_log_message("BTstack: bt_open failed"); + RARCH_LOG("BTstack: bt_open failed\n"); btstack_loaded = false; return; } @@ -124,7 +124,7 @@ void btstack_set_poweron(bool on) if (on != btstack_poweron) { btstack_poweron = on; - ios_add_log_message("BTstack: Turning %s", on ? "on" : "off"); + RARCH_LOG("BTstack: Turning %s\n", on ? "on" : "off"); bt_send_cmd_ptr(btstack_set_power_mode_ptr, on ? HCI_POWER_ON : HCI_POWER_OFF); } } diff --git a/apple/iOS/bluetooth/btpad.c b/apple/iOS/bluetooth/btpad.c index 12525b353f..d1ba2aeafa 100644 --- a/apple/iOS/bluetooth/btpad.c +++ b/apple/iOS/bluetooth/btpad.c @@ -145,8 +145,8 @@ void btpad_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet if (COMMAND_COMPLETE_EVENT(packet, (*hci_read_bd_addr_ptr))) { bt_flip_addr_ptr(event_addr, &packet[6]); - if (!packet[5]) ios_add_log_message("BTpad: Local address is %s", bd_addr_to_str_ptr(event_addr)); - else ios_add_log_message("BTpad: Failed to get local address (Status: %02X)", packet[5]); + if (!packet[5]) RARCH_LOG("BTpad: Local address is %s\n", bd_addr_to_str_ptr(event_addr)); + else RARCH_LOG("BTpad: Failed to get local address (Status: %02X)\n", packet[5]); } } break; @@ -160,7 +160,7 @@ void btpad_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet struct apple_pad_connection* connection = btpad_find_empty_connection(); if (connection) { - ios_add_log_message("BTpad: Inquiry found device"); + RARCH_LOG("BTpad: Inquiry found device\n"); memset(connection, 0, sizeof(struct apple_pad_connection)); memcpy(connection->address, event_addr, sizeof(bd_addr_t)); @@ -197,11 +197,11 @@ void btpad_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet { if (!connection) { - ios_add_log_message("BTpad: Got L2CAP 'Channel Opened' event for unrecognized device"); + RARCH_LOG("BTpad: Got L2CAP 'Channel Opened' event for unrecognized device\n"); break; } - ios_add_log_message("BTpad: L2CAP channel opened: (PSM: %02X)", psm); + RARCH_LOG("BTpad: L2CAP channel opened: (PSM: %02X)\n", psm); connection->handle = handle; if (psm == PSM_HID_CONTROL) @@ -209,16 +209,16 @@ void btpad_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet else if (psm == PSM_HID_INTERRUPT) connection->channels[1] = channel_id; else - ios_add_log_message("BTpad: Got unknown L2CAP PSM, ignoring (PSM: %02X)", psm); + RARCH_LOG("BTpad: Got unknown L2CAP PSM, ignoring (PSM: %02X)\n", psm); if (connection->channels[0] && connection->channels[1]) { - ios_add_log_message("BTpad: Got both L2CAP channels, requesting name"); + RARCH_LOG("BTpad: Got both L2CAP channels, requesting name\n"); btpad_queue_hci_remote_name_request(connection->address, 0, 0, 0); } } else - ios_add_log_message("BTpad: Got failed L2CAP 'Channel Opened' event (PSM: %02X, Status: %02X)", psm, packet[2]); + RARCH_LOG("BTpad: Got failed L2CAP 'Channel Opened' event (PSM: %02X, Status: %02X)\n", psm, packet[2]); } break; @@ -236,7 +236,7 @@ void btpad_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet connection = btpad_find_empty_connection(); if (connection) { - ios_add_log_message("BTpad: Got new incoming connection"); + RARCH_LOG("BTpad: Got new incoming connection\n"); memset(connection, 0, sizeof(struct apple_pad_connection)); @@ -248,7 +248,7 @@ void btpad_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet else break; } - ios_add_log_message("BTpad: Incoming L2CAP connection (PSM: %02X)", psm); + RARCH_LOG("BTpad: Incoming L2CAP connection (PSM: %02X)\n", psm); bt_send_cmd_ptr(l2cap_accept_connection_ptr, channel_id); } break; @@ -261,11 +261,11 @@ void btpad_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet if (!connection) { - ios_add_log_message("BTpad: Got unexpected remote name, ignoring"); + RARCH_LOG("BTpad: Got unexpected remote name, ignoring\n"); break; } - ios_add_log_message("BTpad: Got %.200s", (char*)&packet[9]); + RARCH_LOG("BTpad: Got %.200s\n", (char*)&packet[9]); connection->slot = apple_joypad_connect((char*)packet + 9, connection); connection->state = BTPAD_CONNECTED; @@ -274,7 +274,7 @@ void btpad_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet case HCI_EVENT_PIN_CODE_REQUEST: { - ios_add_log_message("BTpad: Sending WiiMote PIN"); + RARCH_LOG("BTpad: Sending WiiMote PIN\n"); bt_flip_addr_ptr(event_addr, &packet[2]); btpad_queue_hci_pin_code_request_reply(event_addr, &packet[2]); @@ -297,14 +297,14 @@ void btpad_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet } } else - ios_add_log_message("BTpad: Got failed 'Disconnection Complete' event (Status: %02X)", packet[2]); + RARCH_LOG("BTpad: Got failed 'Disconnection Complete' event (Status: %02X)\n", packet[2]); } break; case L2CAP_EVENT_SERVICE_REGISTERED: { if (!packet[2]) - ios_add_log_message("BTpad: Got failed 'Service Registered' event (PSM: %02X, Status: %02X)", READ_BT_16(packet, 3), packet[2]); + RARCH_LOG("BTpad: Got failed 'Service Registered' event (PSM: %02X, Status: %02X)\n", READ_BT_16(packet, 3), packet[2]); } break; } diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m index a24fe79be2..553d405473 100644 --- a/apple/iOS/platform.m +++ b/apple/iOS/platform.m @@ -42,7 +42,6 @@ int get_ios_version_major() return version; } - void ios_set_bluetooth_mode(NSString* mode) { apple_input_enable_icade([mode isEqualToString:@"icade"]); diff --git a/logger/ios_logger_override.h b/logger/ios_logger_override.h index 83a01dec9d..ed5eff129f 100644 --- a/logger/ios_logger_override.h +++ b/logger/ios_logger_override.h @@ -17,17 +17,28 @@ #ifndef __APPLE_IOS_LOGGER_H #define __APPLE_IOS_LOGGER_H +#include + +#if TARGET_IPHONE_SIMULATOR +#include +#else #include +#endif + #include static inline void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap) { +#if TARGET_IPHONE_SIMULATOR + vprintf(fmt, ap); +#else aslmsg msg = asl_new(ASL_TYPE_MSG); asl_set(msg, ASL_KEY_READ_UID, "-1"); if (tag) asl_log(NULL, msg, ASL_LEVEL_NOTICE, "%s", tag); asl_vlog(NULL, msg, ASL_LEVEL_NOTICE, fmt, ap); asl_free(msg); +#endif } static inline void RARCH_LOG(const char *fmt, ...)