From a0567c3c774ed6f05381dfbb22cb0fde054e3ff8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 17 May 2014 15:45:14 +0200 Subject: [PATCH] (BB10) Start cleaning up some include header references (Android) Uniquely name symbols - platform_android.c --- blackberry-qnx/bb10/.project | 7 ++- blackberry-qnx/bb10/precompiled.h | 2 - blackberry-qnx/bb10/src/ButtonMap.cpp | 43 ++++++++----------- blackberry-qnx/bb10/src/ButtonMap.h | 6 +-- .../bb10/src/RetroArch-Cascades.cpp | 43 ++++++------------- blackberry-qnx/bb10/src/main.cpp | 20 +-------- frontend/platform/platform_android.c | 28 ++++++------ 7 files changed, 55 insertions(+), 94 deletions(-) delete mode 100644 blackberry-qnx/bb10/precompiled.h diff --git a/blackberry-qnx/bb10/.project b/blackberry-qnx/bb10/.project index 2ac321a0db..c71496f4bb 100644 --- a/blackberry-qnx/bb10/.project +++ b/blackberry-qnx/bb10/.project @@ -5,6 +5,11 @@ + + org.eclipse.wst.jsdt.core.javascriptValidator + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder @@ -80,7 +85,7 @@ - com.rim.tad.tools.wst.jsdt.core.jsNature + org.eclipse.wst.jsdt.core.jsNature org.eclipse.cdt.core.cnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature diff --git a/blackberry-qnx/bb10/precompiled.h b/blackberry-qnx/bb10/precompiled.h deleted file mode 100644 index 6213dc4ba7..0000000000 --- a/blackberry-qnx/bb10/precompiled.h +++ /dev/null @@ -1,2 +0,0 @@ -// This file is used to store precompiled headers. -// It is intentionally left blank. It is up to you to decide which headers should be included here. diff --git a/blackberry-qnx/bb10/src/ButtonMap.cpp b/blackberry-qnx/bb10/src/ButtonMap.cpp index 8a65787b84..dcb80035b1 100644 --- a/blackberry-qnx/bb10/src/ButtonMap.cpp +++ b/blackberry-qnx/bb10/src/ButtonMap.cpp @@ -5,17 +5,19 @@ #include "ButtonMap.h" #include "RetroArch-Cascades.h" -#include "input/input_common.h" +#include "../../../input/input_common.h" #include "../../frontend_qnx.h" ButtonMap::ButtonMap(screen_context_t screen_ctx, QString groupId, int coid) { + int rc, usage, format, z; + screen_display_t screen_disp; + this->screen_cxt = screen_ctx; this->groupId = groupId; this->coid = coid; - const int usage = SCREEN_USAGE_NATIVE | SCREEN_USAGE_WRITE | SCREEN_USAGE_READ; - int rc; + usage = SCREEN_USAGE_NATIVE | SCREEN_USAGE_WRITE | SCREEN_USAGE_READ; if(screen_create_window_type(&screen_win, screen_cxt, SCREEN_CHILD_WINDOW)) { @@ -23,12 +25,11 @@ ButtonMap::ButtonMap(screen_context_t screen_ctx, QString groupId, int coid) } screen_join_window_group(screen_win, (const char *)groupId.toAscii().constData()); - int format = SCREEN_FORMAT_RGBA8888; + format = SCREEN_FORMAT_RGBA8888; screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_FORMAT, &format); screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_USAGE, &usage); - screen_display_t screen_disp; if (screen_get_window_property_pv(screen_win, SCREEN_PROPERTY_DISPLAY, (void **)&screen_disp)) { RARCH_ERR("screen_get_window_property_pv [SCREEN_PROPERTY_DISPLAY] failed.\n"); @@ -40,19 +41,16 @@ ButtonMap::ButtonMap(screen_context_t screen_ctx, QString groupId, int coid) } rc = screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, screen_resolution); - if (rc) { + if (rc) perror("screen_set_window_property_iv"); - } - int z = -10; - if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ZORDER, &z) != 0) { + z = -10; + if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ZORDER, &z) != 0) return; - } rc = screen_create_window_buffers(screen_win, 1); - if (rc) { + if (rc) perror("screen_create_window_buffers"); - } screen_get_window_property_pv(screen_win, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)&screen_buf); @@ -80,15 +78,13 @@ QString ButtonMap::getLabel(int button) int ButtonMap::mapNextButtonPressed() { + int sym, z; bps_event_t *event = NULL; - int sym; //use in frontend run loop, get key pressed back, and map - int z = 10; + z = 10; if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ZORDER, &z) != 0) - { return -1; - } screen_post_window(screen_win, screen_buf, 1, screen_resolution, 0); @@ -106,8 +102,8 @@ int ButtonMap::mapNextButtonPressed() if (domain == screen_get_domain()) { - screen_event_t screen_event = screen_event_get_event(event); int screen_val; + screen_event_t screen_event = screen_event_get_event(event); screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &screen_val); //TODO: Should we only let the buttons through that we are trying to map? @@ -134,9 +130,7 @@ int ButtonMap::mapNextButtonPressed() z = -10; if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ZORDER, &z) != 0) - { return -1; - } screen_post_window(screen_win, screen_buf, 1, screen_resolution, 0); @@ -159,11 +153,12 @@ void ButtonMap::mapDevice(int index, int player) void ButtonMap::refreshButtonMap(int player) { + int i; QVariantMap map; buttonDataModel->clear(); - for (int i=0; i<16; ++i) + for (i=0; i < 16; ++i) { QString desc = QString(input_config_bind_map[i].desc); int index = desc.indexOf("("); @@ -209,18 +204,16 @@ int ButtonMap::mapButton(int player, int button) QString ButtonMap::buttonToString(int player, int button) { + int i; + if(g_settings.input.device[player] == DEVICE_KEYPAD || g_settings.input.device[player] == DEVICE_KEYBOARD) - { return QString(button); - } else { - for(int i=0;i<20;++i) + for(i = 0; i < 20; ++i) { if(platform_keys[i].joykey == (uint)button) - { return QString(platform_keys[i].desc); - } } return (button!=NO_BTN) ? QString(button) : QString("Not Mapped"); diff --git a/blackberry-qnx/bb10/src/ButtonMap.h b/blackberry-qnx/bb10/src/ButtonMap.h index 5403d7ae24..3f8e5f9e1d 100644 --- a/blackberry-qnx/bb10/src/ButtonMap.h +++ b/blackberry-qnx/bb10/src/ButtonMap.h @@ -7,9 +7,9 @@ #include #include -#include "general.h" -#include "conf/config_file.h" -#include "file.h" +#include "../../../general.h" +#include "../../../conf/config_file.h" +#include "../../../file.h" /* typedef struct { diff --git a/blackberry-qnx/bb10/src/RetroArch-Cascades.cpp b/blackberry-qnx/bb10/src/RetroArch-Cascades.cpp index c2e14a16dc..74d393c62f 100644 --- a/blackberry-qnx/bb10/src/RetroArch-Cascades.cpp +++ b/blackberry-qnx/bb10/src/RetroArch-Cascades.cpp @@ -1,26 +1,8 @@ -/* Copyright (c) 2012 Research In Motion Limited. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ #include "RetroArch-Cascades.h" -#include "general.h" -#include "conf/config_file.h" -#include "file.h" -#include "core_info.h" - -#ifdef HAVE_RGUI -#include "frontend/menu/rgui.h" -#endif +#include "../../../general.h" +#include "../../../conf/config_file.h" +#include "../../../file.h" +#include "../../../frontend/info/core_info.h" #include "../../frontend_qnx.h" @@ -53,6 +35,9 @@ extern screen_context_t screen_ctx; RetroArch::RetroArch() { + bool res; + QmlDocument *qml; + qmlRegisterType("bb.cascades.pickers", 1, 0, "FilePicker"); qmlRegisterUncreatableType("bb.cascades.pickers", 1, 0, "FileType", ""); @@ -60,7 +45,7 @@ RetroArch::RetroArch() chid = ChannelCreate(0); coid = ConnectAttach(0, 0, chid, _NTO_SIDE_CHANNEL, 0); - bool res = connect( + res = connect( OrientationSupport::instance(), SIGNAL(rotationCompleted()), this, SLOT(onRotationCompleted())); @@ -74,7 +59,7 @@ RetroArch::RetroArch() //Stop config overwritting values g_extern.block_config_read = true; - QmlDocument *qml = QmlDocument::create("asset:///main.qml"); + qml = QmlDocument::create("asset:///main.qml"); if (!qml->hasErrors()) { @@ -236,9 +221,7 @@ void RetroArch::onRotationCompleted() if (OrientationSupport::instance()->orientation() == UIOrientation::Landscape) { if (state == RETROARCH_START_REQUESTED) - { startEmulator(); - } } } @@ -267,9 +250,7 @@ void RetroArch::startEmulator() if (OrientationSupport::instance()->orientation() == UIOrientation::Portrait && OrientationSupport::instance()->supportedDisplayOrientation() != SupportedDisplayOrientation::DeviceNorth) - { OrientationSupport::instance()->setSupportedDisplayOrientation(SupportedDisplayOrientation::DisplayLandscape); - } else { recv_msg msg; @@ -315,9 +296,7 @@ void RetroArch::findDevices() //QML shows player 1 by default, so set dropdown to their controller. if(devices[i].port == 0 || devices[i].device == DEVICE_KEYPAD) - { deviceSelection->setSelectedIndex(i); - } } } @@ -333,10 +312,12 @@ void RetroArch::discoverController(int player) void RetroArch::initRASettings() { + HardwareInfo *hwInfo; + strlcpy(g_settings.libretro,(char *)core.toAscii().constData(), sizeof(g_settings.libretro)); strlcpy(g_extern.fullpath, (char *)rom.toAscii().constData(), sizeof(g_extern.fullpath)); - HardwareInfo *hwInfo = new HardwareInfo(); + hwInfo = new HardwareInfo(); //If Physical keyboard or a device mapped to player 1, hide overlay //TODO: Should there be a minimized/quick settings only overlay? diff --git a/blackberry-qnx/bb10/src/main.cpp b/blackberry-qnx/bb10/src/main.cpp index 1f9cd50ca1..99f55c10d8 100644 --- a/blackberry-qnx/bb10/src/main.cpp +++ b/blackberry-qnx/bb10/src/main.cpp @@ -1,19 +1,3 @@ -/* Copyright (c) 2012 Research In Motion Limited. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - - #include "RetroArch-Cascades.h" #include @@ -21,12 +5,12 @@ using ::bb::cascades::Application; Q_DECL_EXPORT int main(int argc, char **argv) { + RetroArch mainApp; + // Instantiate the main application constructor. Application app(argc, argv); // Initialize our application. - RetroArch mainApp; - QObject::connect(&app, SIGNAL( aboutToQuit() ), &mainApp, SLOT( aboutToQuit() )); // We complete the transaction started in the main application constructor and start the diff --git a/frontend/platform/platform_android.c b/frontend/platform/platform_android.c index 74ef8c54e4..e440372983 100644 --- a/frontend/platform/platform_android.c +++ b/frontend/platform/platform_android.c @@ -33,8 +33,8 @@ struct android_app *g_android; static pthread_key_t thread_key; //forward decls -static void system_deinit(void *data); -static void system_shutdown(bool unused); +static void frontend_android_deinit(void *data); +static void frontend_android_shutdown(bool unused); extern void android_app_entry(void *args); void engine_handle_cmd(void *data) @@ -376,7 +376,7 @@ static bool android_run_events (void *data) return true; } -static void get_environment_settings(int argc, char *argv[], void *data) +static void frontend_android_get_environment_settings(int argc, char *argv[], void *data) { JNIEnv *env; struct android_app* android_app = (struct android_app*)data; @@ -550,7 +550,7 @@ static void process_pending_intent(void *data) #endif } -static int process_events(void *data) +static int frontend_android_process_events(void *data) { //jboolean hasPendingIntent; //JNIEnv *env; @@ -572,7 +572,7 @@ static int process_events(void *data) return 0; } -static void system_init(void *data) +static void frontend_android_init(void *data) { JNIEnv *env; jclass class = NULL; @@ -599,8 +599,8 @@ static void system_init(void *data) { if (!android_run_events(android_app)) { - system_deinit(android_app); - system_shutdown(android_app); + frontend_android_deinit(android_app); + frontend_android_shutdown(android_app); } } @@ -628,7 +628,7 @@ static void system_init(void *data) GET_METHOD_ID(env, android_app->getStringExtra, class, "getStringExtra", "(Ljava/lang/String;)Ljava/lang/String;"); } -static void system_deinit(void *data) +static void frontend_android_deinit(void *data) { struct android_app* android_app = (struct android_app*)data; @@ -640,7 +640,7 @@ static void system_deinit(void *data) AInputQueue_detachLooper(android_app->inputQueue); } -static void system_shutdown(bool unused) +static void frontend_android_shutdown(bool unused) { (void)unused; // exit() here is nasty. @@ -657,14 +657,14 @@ static int frontend_android_get_rating(void) } const frontend_ctx_driver_t frontend_ctx_android = { - get_environment_settings, /* get_environment_settings */ - system_init, /* init */ - system_deinit, /* deinit */ + frontend_android_get_environment_settings, /* get_environment_settings */ + frontend_android_init, /* init */ + frontend_android_deinit, /* deinit */ NULL, /* exitspawn */ NULL, /* process_args */ - process_events, /* process_events */ + frontend_android_process_events, /* process_events */ NULL, /* exec */ - system_shutdown, /* shutdown */ + frontend_android_shutdown, /* shutdown */ frontend_android_get_rating, /* get_rating */ "android", };