static int mainInternal(QApplication &a) { #ifdef MOBILE_DEVICE emugl = new MainUI(); emugl->resize(pixel_xres, pixel_yres); emugl->showFullScreen(); #endif EnableFZ(); // Disable screensaver #ifdef __SYMBIAN32__ QSystemScreenSaver ssObject(emugl); ssObject.setScreenSaverInhibit(); QScopedPointer<SymbianMediaKeys> mediakeys(new SymbianMediaKeys()); #elif defined(QT_HAS_SYSTEMINFO) QScreenSaver ssObject(emugl); ssObject.setScreenSaverEnabled(false); #endif #ifdef SDL SDLJoystick joy(true); joy.startEventLoop(); SDL_Init(SDL_INIT_AUDIO); SDL_AudioSpec fmt, ret_fmt; memset(&fmt, 0, sizeof(fmt)); fmt.freq = 44100; fmt.format = AUDIO_S16; fmt.channels = 2; fmt.samples = 2048; fmt.callback = &mixaudio; fmt.userdata = (void *)0; if (SDL_OpenAudio(&fmt, &ret_fmt) < 0) { ELOG("Failed to open audio: %s", SDL_GetError()); } else { if (ret_fmt.samples != fmt.samples) // Notify, but still use it ELOG("Output audio samples: %d (requested: %d)", ret_fmt.samples, fmt.samples); if (ret_fmt.freq != fmt.freq || ret_fmt.format != fmt.format || ret_fmt.channels != fmt.channels) { ELOG("Sound buffer format does not match requested format."); ELOG("Output audio freq: %d (requested: %d)", ret_fmt.freq, fmt.freq); ELOG("Output audio format: %d (requested: %d)", ret_fmt.format, fmt.format); ELOG("Output audio channels: %d (requested: %d)", ret_fmt.channels, fmt.channels); ELOG("Provided output format does not match requirement, turning audio off"); SDL_CloseAudio(); } } SDL_PauseAudio(0); #else QScopedPointer<MainAudio> audio(new MainAudio()); audio->run(); #endif return a.exec(); }
Q_DECL_EXPORT #endif int main(int argc, char *argv[]) { #if defined(Q_OS_LINUX) && !defined(MAEMO) QApplication::setAttribute(Qt::AA_X11InitThreads, true); #endif QApplication a(argc, argv); QSize res = QApplication::desktop()->screenGeometry().size(); if (res.width() < res.height()) res.transpose(); pixel_xres = res.width(); pixel_yres = res.height(); g_dpi_scale = CalculateDPIScale(); dp_xres = (int)(pixel_xres * g_dpi_scale); dp_yres = (int)(pixel_yres * g_dpi_scale); net::Init(); #ifdef __SYMBIAN32__ const char *savegame_dir = "E:/PPSSPP/"; const char *assets_dir = "E:/PPSSPP/"; #elif defined(BLACKBERRY) const char *savegame_dir = "/accounts/1000/shared/misc/"; const char *assets_dir = "app/native/assets/"; #elif defined(MEEGO_EDITION_HARMATTAN) || defined(MAEMO) const char *savegame_dir = "/home/user/MyDocs/PPSSPP/"; const char *assets_dir = "/opt/PPSSPP/"; #else const char *savegame_dir = "./"; const char *assets_dir = "./"; #endif NativeInit(argc, (const char **)argv, savegame_dir, assets_dir, "BADCOFFEE"); #ifdef USING_GLES2 emugl = new MainUI(); emugl->resize(pixel_xres, pixel_yres); emugl->showFullScreen(); #endif #ifdef __SYMBIAN32__ // Set RunFast hardware mode for VFPv2. User::SetFloatingPointMode(EFpModeRunFast); // Disable screensaver QScopedPointer<QSystemScreenSaver> ssObject(new QSystemScreenSaver(emugl)); ssObject->setScreenSaverInhibit(); QScopedPointer<SymbianMediaKeys> mediakeys(new SymbianMediaKeys()); #endif QScopedPointer<QThread> thread(new QThread); QScopedPointer<MainAudio> audio(new MainAudio()); audio->moveToThread(thread.data()); QObject::connect(thread.data(), SIGNAL(started()), audio.data(), SLOT(run())); thread->start(); #ifdef QT_HAS_SDL SDLJoystick joy(true); joy.startEventLoop(); #endif int ret = a.exec(); thread->quit(); NativeShutdown(); net::Shutdown(); return ret; }
static int mainInternal(QApplication &a) { #ifdef USING_GLES2 emugl = new MainUI(); emugl->resize(pixel_xres, pixel_yres); emugl->showFullScreen(); #endif #ifdef __SYMBIAN32__ // Set RunFast hardware mode for VFPv2. User::SetFloatingPointMode(EFpModeRunFast); // Disable screensaver QScopedPointer<QSystemScreenSaver> ssObject(new QSystemScreenSaver(emugl)); ssObject->setScreenSaverInhibit(); QScopedPointer<SymbianMediaKeys> mediakeys(new SymbianMediaKeys()); #endif QScopedPointer<QThread> thread(new QThread); QScopedPointer<MainAudio> audio(new MainAudio()); audio->moveToThread(thread.data()); QObject::connect(thread.data(), SIGNAL(started()), audio.data(), SLOT(run())); thread->start(); #ifdef QT_HAS_SDL SDLJoystick joy(true); joy.startEventLoop(); #endif int ret = a.exec(); thread->quit(); return ret; }
static int mainInternal(QApplication &a) { #ifdef MOBILE_DEVICE emugl = new MainUI(); emugl->resize(pixel_xres, pixel_yres); emugl->showFullScreen(); #endif #ifdef __SYMBIAN32__ // Set RunFast hardware mode for VFPv2. User::SetFloatingPointMode(EFpModeRunFast); // Disable screensaver QScopedPointer<QSystemScreenSaver> ssObject(new QSystemScreenSaver(emugl)); ssObject->setScreenSaverInhibit(); QScopedPointer<SymbianMediaKeys> mediakeys(new SymbianMediaKeys()); #endif #ifdef QT_HAS_SDL SDLJoystick joy(true); joy.startEventLoop(); SDL_Init(SDL_INIT_AUDIO); SDL_AudioSpec fmt, ret_fmt; memset(&fmt, 0, sizeof(fmt)); fmt.freq = 44100; fmt.format = AUDIO_S16; fmt.channels = 2; fmt.samples = 2048; fmt.callback = &mixaudio; fmt.userdata = (void *)0; if (SDL_OpenAudio(&fmt, &ret_fmt) < 0) { ELOG("Failed to open audio: %s", SDL_GetError()); } else { if (ret_fmt.samples != fmt.samples) // Notify, but still use it ELOG("Output audio samples: %d (requested: %d)", ret_fmt.samples, fmt.samples); if (ret_fmt.freq != fmt.freq || ret_fmt.format != fmt.format || ret_fmt.channels != fmt.channels) { ELOG("Sound buffer format does not match requested format."); ELOG("Output audio freq: %d (requested: %d)", ret_fmt.freq, fmt.freq); ELOG("Output audio format: %d (requested: %d)", ret_fmt.format, fmt.format); ELOG("Output audio channels: %d (requested: %d)", ret_fmt.channels, fmt.channels); ELOG("Provided output format does not match requirement, turning audio off"); SDL_CloseAudio(); } } // Audio must be unpaused _after_ NativeInit() SDL_PauseAudio(0); #else QScopedPointer<QThread> thread(new QThread); QScopedPointer<MainAudio> audio(new MainAudio()); audio->moveToThread(thread.data()); QObject::connect(thread.data(), SIGNAL(started()), audio.data(), SLOT(run())); thread->start(); #endif int ret = a.exec(); #ifndef QT_HAS_SDL thread->quit(); #endif return ret; }