diff --git a/CMakeLists.txt b/CMakeLists.txt index e724ec6939..b92314f113 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2013,6 +2013,8 @@ if(TargetBin) add_executable(${TargetBin} MACOSX_BUNDLE ${ICON_PATH_ABS} ${NativeAssets} ${SHADER_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource}) if(TARGET SDL2::SDL2 AND NOT USING_QT_UI) add_custom_command(TARGET ${TargetBin} POST_BUILD COMMAND /bin/bash "${CMAKE_SOURCE_DIR}/SDL/macbundle.sh" "${CMAKE_BINARY_DIR}/PPSSPPSDL.app") + elseif(USING_QT_UI) + add_custom_command(TARGET ${TargetBin} POST_BUILD COMMAND /bin/bash "${CMAKE_SOURCE_DIR}/Qt/macbundle.sh" "${CMAKE_BINARY_DIR}/PPSSPPQt.app") endif() endif() elseif(WIN32) diff --git a/Core/Core.cpp b/Core/Core.cpp index 93c6eaf8d8..3f66794576 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -150,8 +150,13 @@ static bool IsWindowSmall(int pixelWidth, int pixelHeight) { // TODO: Feels like this belongs elsewhere. bool UpdateScreenScale(int width, int height) { bool smallWindow; -#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP) - g_dpi = (float)System_GetPropertyInt(SYSPROP_DISPLAY_DPI); +#if defined(USING_QT_UI) + g_dpi = System_GetPropertyFloat(SYSPROP_DISPLAY_DPI); + float g_logical_dpi = System_GetPropertyFloat(SYSPROP_DISPLAY_LOGICAL_DPI); + g_dpi_scale_x = g_logical_dpi / g_dpi; + g_dpi_scale_y = g_logical_dpi / g_dpi; +#elif PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP) + g_dpi = System_GetPropertyFloat(SYSPROP_DISPLAY_DPI); g_dpi_scale_x = 96.0f / g_dpi; g_dpi_scale_y = 96.0f / g_dpi; #else diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index d1a2de1110..3e6b526a8f 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -435,8 +435,7 @@ static bool IsRunningSlow() { best = std::max(fpsHistory[index], best); } - // Note that SYSPROP_DISPLAY_REFRESH_RATE is multiplied by 1000. - return best < System_GetPropertyInt(SYSPROP_DISPLAY_REFRESH_RATE) * (1.0 / 1001.0); + return best < System_GetPropertyFloat(SYSPROP_DISPLAY_REFRESH_RATE) * 0.999; } return false; @@ -510,12 +509,12 @@ static void DoFrameDropLogging(float scaledTimestep) { static int CalculateFrameSkip() { int frameSkipNum; - if (g_Config.iFrameSkipType == 1) { + if (g_Config.iFrameSkipType == 1) { // Calculate the frames to skip dynamically using the set percentage of the current fps - frameSkipNum = ceil( flips * (static_cast(g_Config.iFrameSkip) / 100.00) ); - } else { + frameSkipNum = ceil( flips * (static_cast(g_Config.iFrameSkip) / 100.00) ); + } else { // Use the set number of frames to skip - frameSkipNum = g_Config.iFrameSkip; + frameSkipNum = g_Config.iFrameSkip; } return frameSkipNum; } diff --git a/Core/HW/StereoResampler.cpp b/Core/HW/StereoResampler.cpp index 8bf58c3f4c..3894e6d771 100644 --- a/Core/HW/StereoResampler.cpp +++ b/Core/HW/StereoResampler.cpp @@ -71,7 +71,7 @@ StereoResampler::StereoResampler() // Some Android devices are v-synced to non-60Hz framerates. We simply timestretch audio to fit. // TODO: should only do this if auto frameskip is off? - float refresh = System_GetPropertyInt(SYSPROP_DISPLAY_REFRESH_RATE) / 1000.0f; + float refresh = System_GetPropertyFloat(SYSPROP_DISPLAY_REFRESH_RATE); // If framerate is "close"... if (refresh != 60.0f && refresh > 50.0f && refresh < 70.0f) { diff --git a/Qt/QtMain.cpp b/Qt/QtMain.cpp index 3c9641c1bd..f117d3a762 100644 --- a/Qt/QtMain.cpp +++ b/Qt/QtMain.cpp @@ -42,7 +42,7 @@ #include MainUI *emugl = nullptr; -static int refreshRate = 60000; +static float refreshRate = 60.f; static int browseFileEvent = -1; static int browseFolderEvent = -1; @@ -145,8 +145,6 @@ int System_GetPropertyInt(SystemProperty prop) { switch (prop) { case SYSPROP_AUDIO_SAMPLE_RATE: return 44100; - case SYSPROP_DISPLAY_REFRESH_RATE: - return refreshRate; case SYSPROP_DEVICE_TYPE: #if defined(__ANDROID__) return DEVICE_TYPE_MOBILE; @@ -159,6 +157,21 @@ int System_GetPropertyInt(SystemProperty prop) { #else return DEVICE_TYPE_DESKTOP; #endif + case SYSPROP_DISPLAY_COUNT: + return QApplication::screens().size(); + default: + return -1; + } +} + +float System_GetPropertyFloat(SystemProperty prop) { + switch (prop) { + case SYSPROP_DISPLAY_REFRESH_RATE: + return refreshRate; + case SYSPROP_DISPLAY_LOGICAL_DPI: + return QApplication::primaryScreen()->logicalDotsPerInch(); + case SYSPROP_DISPLAY_DPI: + return QApplication::primaryScreen()->physicalDotsPerInch(); default: return -1; } @@ -229,16 +242,6 @@ void LaunchBrowser(const char *url) QDesktopServices::openUrl(QUrl(url)); } -float CalculateDPIScale() -{ - // Sane default rather than check DPI -#if defined(USING_GLES2) - return 1.2f; -#else - return 1.0f; -#endif -} - static int mainInternal(QApplication &a) { #ifdef MOBILE_DEVICE emugl = new MainUI(); @@ -628,19 +631,21 @@ int main(int argc, char *argv[]) QGLFormat::setDefaultFormat(format); QApplication a(argc, argv); - QSize res = QApplication::desktop()->screenGeometry().size(); + QScreen* screen = a.primaryScreen(); + QSizeF res = screen->physicalSize(); if (res.width() < res.height()) res.transpose(); pixel_xres = res.width(); pixel_yres = res.height(); - g_dpi_scale_x = CalculateDPIScale(); - g_dpi_scale_y = CalculateDPIScale(); + + g_dpi_scale_x = screen->logicalDotsPerInchX() / screen->physicalDotsPerInchX(); + g_dpi_scale_y = screen->logicalDotsPerInchY() / screen->physicalDotsPerInchY(); g_dpi_scale_real_x = g_dpi_scale_x; g_dpi_scale_real_y = g_dpi_scale_y; dp_xres = (int)(pixel_xres * g_dpi_scale_x); dp_yres = (int)(pixel_yres * g_dpi_scale_y); - refreshRate = (int)(a.primaryScreen()->refreshRate() * 1000); + refreshRate = screen->refreshRate(); std::string savegame_dir = "."; std::string external_dir = "."; @@ -669,4 +674,3 @@ int main(int argc, char *argv[]) glslang::FinalizeProcess(); return ret; } - diff --git a/Qt/macbundle.sh b/Qt/macbundle.sh new file mode 100644 index 0000000000..3272de6657 --- /dev/null +++ b/Qt/macbundle.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +PPSSPP="${1}" +PPSSPPQt="${PPSSPP}/Contents/MacOS/PPSSPPQt" + +if [ ! -f "${PPSSPPQt}" ]; then + echo "No such file: ${PPSSPPQt}!" + exit 0 +fi + +plutil -replace NSPrincipalClass -string NSApplication ${PPSSPP}/Contents/Info.plist +plutil -replace NSHighResolutionCapable -bool YES ${PPSSPP}/Contents/Info.plist + +# TODO: install SDL and Qt frameworks diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 4b4a6aaaf7..8b59c683ea 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -24,7 +24,7 @@ MainWindow::MainWindow(QWidget *parent, bool fullscreen) : { QDesktopWidget *desktop = QApplication::desktop(); int screenNum = QProcessEnvironment::systemEnvironment().value("SDL_VIDEO_FULLSCREEN_HEAD", "0").toInt(); - + // Move window to the center of selected screen QRect rect = desktop->screenGeometry(screenNum); move((rect.width()-frameGeometry().width()) / 4, (rect.height()-frameGeometry().height()) / 4); @@ -295,19 +295,22 @@ void MainWindow::consoleAct() void MainWindow::raiseTopMost() { setWindowState( (windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); - raise(); + raise(); activateWindow(); } void MainWindow::SetFullScreen(bool fullscreen) { if (fullscreen) { +#if !PPSSPP_PLATFORM(MAC) menuBar()->hide(); - + emugl->setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); + // TODO: Shouldn't this be physicalSize()? emugl->resizeGL(emugl->size().width(), emugl->size().height()); // TODO: Won't showFullScreen do this for us? setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); +#endif showFullScreen(); InitPadLayout(dp_xres, dp_yres); @@ -315,8 +318,10 @@ void MainWindow::SetFullScreen(bool fullscreen) { if (GetUIState() == UISTATE_INGAME && !g_Config.bShowTouchControls) QApplication::setOverrideCursor(QCursor(Qt::BlankCursor)); } else { +#if !PPSSPP_PLATFORM(MAC) menuBar()->show(); updateMenus(); +#endif showNormal(); SetWindowScale(-1); @@ -346,7 +351,7 @@ void MainWindow::forumAct() QDesktopServices::openUrl(QUrl("https://forums.ppsspp.org/")); } -void MainWindow::gitAct() +void MainWindow::gitAct() { QDesktopServices::openUrl(QUrl("https://github.com/hrydgard/ppsspp/")); } @@ -394,9 +399,14 @@ void MainWindow::SetWindowScale(int zoom) { g_Config.iWindowWidth = width; g_Config.iWindowHeight = height; +#if !PPSSPP_PLATFORM(MAC) emugl->setFixedSize(g_Config.iWindowWidth, g_Config.iWindowHeight); + // TODO: Shouldn't this be scaled size? emugl->resizeGL(g_Config.iWindowWidth, g_Config.iWindowHeight); setFixedSize(sizeHint()); +#else + resize(g_Config.iWindowWidth, g_Config.iWindowHeight); +#endif } void MainWindow::SetGameTitle(QString text) @@ -585,7 +595,7 @@ void MainWindow::createMenus() } } langMenu->addActions(langGroup->actions()); - + // Help MenuTree* helpMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Help")); helpMenu->add(new MenuAction(this, SLOT(websiteAct()), QT_TR_NOOP("Official &website"), QKeySequence::HelpContents)); diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index e8bc75fc4d..548d588ea5 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -65,7 +65,7 @@ static int g_QuitRequested = 0; static int g_DesktopWidth = 0; static int g_DesktopHeight = 0; -static int g_RefreshRate = 60000; +static float g_RefreshRate = 60.f; int getDisplayNumber(void) { int displayNumber = 0; @@ -307,8 +307,6 @@ int System_GetPropertyInt(SystemProperty prop) { switch (prop) { case SYSPROP_AUDIO_SAMPLE_RATE: return 44100; - case SYSPROP_DISPLAY_REFRESH_RATE: - return g_RefreshRate; case SYSPROP_DEVICE_TYPE: #if defined(MOBILE_DEVICE) return DEVICE_TYPE_MOBILE; @@ -322,6 +320,15 @@ int System_GetPropertyInt(SystemProperty prop) { } } +float System_GetPropertyFloat(SystemProperty prop) { + switch (prop) { + case SYSPROP_DISPLAY_REFRESH_RATE: + return g_RefreshRate; + default: + return -1; + } +} + bool System_GetPropertyBool(SystemProperty prop) { switch (prop) { case SYSPROP_HAS_BACK_BUTTON: @@ -511,7 +518,7 @@ int main(int argc, char *argv[]) { } g_DesktopWidth = displayMode.w; g_DesktopHeight = displayMode.h; - g_RefreshRate = (int)(displayMode.refresh_rate * 1000); + g_RefreshRate = displayMode.refresh_rate; SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp index 1f77adf425..35739b4dc8 100644 --- a/UWP/PPSSPP_UWPMain.cpp +++ b/UWP/PPSSPP_UWPMain.cpp @@ -96,7 +96,7 @@ PPSSPP_UWPMain::PPSSPP_UWPMain(App ^app, const std::shared_ptrGetSampleRate() : -1; - case SYSPROP_DISPLAY_REFRESH_RATE: - return 60000; case SYSPROP_DEVICE_TYPE: { auto ver = Windows::System::Profile::AnalyticsInfo::VersionInfo; @@ -375,6 +373,15 @@ int System_GetPropertyInt(SystemProperty prop) { } } +float System_GetPropertyFloat(SystemProperty prop) { + switch (prop) { + case SYSPROP_DISPLAY_REFRESH_RATE: + return 60.f; + default: + return -1; + } +} + bool VulkanMayBeAvailable() { return false; } @@ -477,7 +484,7 @@ bool System_InputBoxGetWString(const wchar_t *title, const std::wstring &default std::string GetCPUBrandString() { Platform::String^ cpu_id = nullptr; Platform::String^ cpu_name = nullptr; - + // GUID_DEVICE_PROCESSOR: {97FADB10-4E33-40AE-359C-8BEF029DBDD0} Platform::String^ if_filter = L"System.Devices.InterfaceClassGuid:=\"{97FADB10-4E33-40AE-359C-8BEF029DBDD0}\""; diff --git a/Windows/MainWindow.cpp b/Windows/MainWindow.cpp index 2462568dba..3d835c9ea0 100644 --- a/Windows/MainWindow.cpp +++ b/Windows/MainWindow.cpp @@ -154,7 +154,7 @@ namespace MainWindow // Register classes - Main Window WNDCLASSEX wcex; memset(&wcex, 0, sizeof(wcex)); - wcex.cbSize = sizeof(WNDCLASSEX); + wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = 0; // Show in taskbar wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.hInstance = hInstance; @@ -228,7 +228,7 @@ namespace MainWindow if (++g_Config.iInternalResolution > RESOLUTION_MAX) g_Config.iInternalResolution = 0; } - + // Taking auto-texture scaling into account if (g_Config.iTexScalingLevel == TEXSCALING_AUTO) setTexScalingMultiplier(0); @@ -329,7 +329,7 @@ namespace MainWindow dwStyle &= ~WS_POPUP; // Re-add caption and border styles. dwStyle |= WS_OVERLAPPEDWINDOW; - + // Put back the menu bar. ::SetMenu(hWnd, menu); } else { @@ -437,7 +437,7 @@ namespace MainWindow bool portrait = g_Config.IsPortrait(); // We want to adjust for DPI but still get an integer pixel scaling ratio. - double dpi_scale = 96.0 / System_GetPropertyInt(SYSPROP_DISPLAY_DPI); + double dpi_scale = 96.0 / System_GetPropertyFloat(SYSPROP_DISPLAY_DPI); int scale = (int)ceil(2.0 / dpi_scale); GetWindowSizeAtResolution(scale * (portrait ? 272 : 480), scale * (portrait ? 480 : 272), &windowWidth, &windowHeight); @@ -547,7 +547,7 @@ namespace MainWindow if (disasmWindow[0]) delete disasmWindow[0]; disasmWindow[0] = 0; - + #if PPSSPP_API(ANY_GL) DialogManager::RemoveDlg(geDebuggerWindow); if (geDebuggerWindow) @@ -682,7 +682,7 @@ namespace MainWindow } return 0; } - + LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_CREATE: @@ -691,7 +691,7 @@ namespace MainWindow RemoveMenu(GetMenu(hWnd), ID_OPTIONS_DIRECT3D11, MF_BYCOMMAND); } break; - + case WM_GETMINMAXINFO: { MINMAXINFO *minmax = reinterpret_cast(lParam); @@ -975,10 +975,10 @@ namespace MainWindow case WM_SYSCOMMAND: { switch (wParam) { - case SC_SCREENSAVE: + case SC_SCREENSAVE: return 0; case SC_MONITORPOWER: - return 0; + return 0; } return DefWindowProc(hWnd, message, wParam, lParam); } @@ -988,7 +988,7 @@ namespace MainWindow } return 0; } - + void Redraw() { InvalidateRect(hwndDisplay,0,0); } diff --git a/Windows/main.cpp b/Windows/main.cpp index 5ceb76d849..facf559935 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -126,7 +126,7 @@ std::string GetVideoCardDriverVersion() { } IWbemLocator *pIWbemLocator = NULL; - hr = CoCreateInstance(__uuidof(WbemLocator), NULL, CLSCTX_INPROC_SERVER, + hr = CoCreateInstance(__uuidof(WbemLocator), NULL, CLSCTX_INPROC_SERVER, __uuidof(IWbemLocator), (LPVOID *)&pIWbemLocator); if (FAILED(hr)) { CoUninitialize(); @@ -143,9 +143,9 @@ std::string GetVideoCardDriverVersion() { return retvalue; } - hr = CoSetProxyBlanket(pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, + hr = CoSetProxyBlanket(pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL,EOAC_DEFAULT); - + BSTR bstrWQL = SysAllocString(L"WQL"); BSTR bstrPath = SysAllocString(L"select * from Win32_VideoController"); IEnumWbemClassObject* pEnum; @@ -232,12 +232,8 @@ int System_GetPropertyInt(SystemProperty prop) { switch (prop) { case SYSPROP_AUDIO_SAMPLE_RATE: return winAudioBackend ? winAudioBackend->GetSampleRate() : -1; - case SYSPROP_DISPLAY_REFRESH_RATE: - return 60000; case SYSPROP_DEVICE_TYPE: return DEVICE_TYPE_DESKTOP; - case SYSPROP_DISPLAY_DPI: - return ScreenDPI(); case SYSPROP_DISPLAY_COUNT: return GetSystemMetrics(SM_CMONITORS); default: @@ -245,6 +241,17 @@ int System_GetPropertyInt(SystemProperty prop) { } } +float System_GetPropertyFloat(SystemProperty prop) { + switch (prop) { + case SYSPROP_DISPLAY_REFRESH_RATE: + return 60.f; + case SYSPROP_DISPLAY_DPI: + return (float)ScreenDPI(); + default: + return -1; + } +} + bool System_GetPropertyBool(SystemProperty prop) { switch (prop) { case SYSPROP_HAS_FILE_BROWSER: @@ -491,7 +498,7 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin LogManager::Init(); - // On Win32 it makes more sense to initialize the system directories here + // On Win32 it makes more sense to initialize the system directories here // because the next place it was called was in the EmuThread, and it's too late by then. g_Config.internalDataDirectory = W32Util::UserDocumentsPath(); InitSysDirectories(); @@ -589,7 +596,7 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin // - The -l switch is expected to show the log console, REGARDLESS of config settings. // - It should be possible to log to a file without showing the console. LogManager::GetInstance()->GetConsoleListener()->Init(showLog, 150, 120, "PPSSPP Debug Console"); - + if (debugLogLevel) LogManager::GetInstance()->SetAllLogLevels(LogTypes::LDEBUG); @@ -603,7 +610,7 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin HWND hwndMain = MainWindow::GetHWND(); HWND hwndDisplay = MainWindow::GetDisplayHWND(); - + //initialize custom controls CtrlDisAsmView::init(); CtrlMemView::init(); @@ -636,7 +643,7 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin { //hack to enable/disable menu command accelerate keys MainWindow::UpdateCommands(); - + //hack to make it possible to get to main window from floating windows with Esc if (msg.hwnd != hwndMain && msg.wParam == VK_ESCAPE) BringWindowToTop(hwndMain); diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index dd8058df43..0ceace3732 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -303,8 +303,15 @@ int System_GetPropertyInt(SystemProperty prop) { return optimalSampleRate; case SYSPROP_AUDIO_OPTIMAL_FRAMES_PER_BUFFER: return optimalFramesPerBuffer; + default: + return -1; + } +} + +float System_GetPropertyFloat(SystemProperty prop) { + switch (prop) { case SYSPROP_DISPLAY_REFRESH_RATE: - return (int)(display_hz * 1000.0); + return display_hz; default: return -1; } @@ -682,7 +689,7 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeRenderer_displayRender(JNIEnv *env, hasSetThreadName = true; setCurrentThreadName("AndroidRender"); } - + if (useCPUThread) { // This is the "GPU thread". if (graphicsContext) diff --git a/ext/native/base/NativeApp.h b/ext/native/base/NativeApp.h index da2fba06ba..f1f348acc7 100644 --- a/ext/native/base/NativeApp.h +++ b/ext/native/base/NativeApp.h @@ -148,7 +148,8 @@ enum SystemProperty { SYSPROP_SYSTEMVERSION, SYSPROP_DISPLAY_XRES, SYSPROP_DISPLAY_YRES, - SYSPROP_DISPLAY_REFRESH_RATE, // returns 1000*the refresh rate in Hz as it can be non-integer + SYSPROP_DISPLAY_REFRESH_RATE, + SYSPROP_DISPLAY_LOGICAL_DPI, SYSPROP_DISPLAY_DPI, SYSPROP_DISPLAY_COUNT, SYSPROP_MOGA_VERSION, @@ -173,6 +174,7 @@ enum SystemProperty { std::string System_GetProperty(SystemProperty prop); int System_GetPropertyInt(SystemProperty prop); +float System_GetPropertyFloat(SystemProperty prop); bool System_GetPropertyBool(SystemProperty prop); std::vector __cameraGetDeviceList(); diff --git a/headless/Headless.cpp b/headless/Headless.cpp index 72c6620c6c..b92f36d6ba 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -74,6 +74,9 @@ std::string System_GetProperty(SystemProperty prop) { return ""; } int System_GetPropertyInt(SystemProperty prop) { return -1; } +float System_GetPropertyFloat(SystemProperty prop) { + return -1; +} bool System_GetPropertyBool(SystemProperty prop) { return false; } @@ -225,7 +228,7 @@ int main(int argc, const char* argv[]) const char *stateToLoad = 0; GPUCore gpuCore = GPUCORE_NULL; CPUCore cpuCore = CPUCore::JIT; - + std::vector testFilenames; const char *mountIso = 0; const char *mountRoot = 0; @@ -321,7 +324,7 @@ int main(int argc, const char* argv[]) LogManager::Init(); LogManager *logman = LogManager::GetInstance(); - + PrintfLogger *printfLogger = new PrintfLogger(); for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++) { diff --git a/ios/main.mm b/ios/main.mm index dfa1548296..eee92a0cad 100644 --- a/ios/main.mm +++ b/ios/main.mm @@ -80,8 +80,6 @@ int System_GetPropertyInt(SystemProperty prop) { switch (prop) { case SYSPROP_AUDIO_SAMPLE_RATE: return 44100; - case SYSPROP_DISPLAY_REFRESH_RATE: - return 60000; case SYSPROP_DEVICE_TYPE: return DEVICE_TYPE_MOBILE; default: @@ -89,6 +87,15 @@ int System_GetPropertyInt(SystemProperty prop) { } } +float System_GetPropertyFloat(SystemProperty prop) { + switch (prop) { + case SYSPROP_DISPLAY_REFRESH_RATE: + return 60.f; + default: + return -1; + } +} + bool System_GetPropertyBool(SystemProperty prop) { switch (prop) { case SYSPROP_HAS_BACK_BUTTON: @@ -139,7 +146,7 @@ BOOL SupportsTaptic() { return NO; } - + // http://www.mikitamanko.com/blog/2017/01/29/haptic-feedback-with-uifeedbackgenerator/ // use private API against UIDevice to determine the haptic stepping // 2 - iPhone 7 or above, full taptic feedback @@ -150,7 +157,7 @@ BOOL SupportsTaptic() } void Vibrate(int mode) { - + if(SupportsTaptic()) { PPSSPPUIApplication* app = (PPSSPPUIApplication*)[UIApplication sharedApplication]; @@ -165,10 +172,10 @@ void Vibrate(int mode) { { NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; NSArray *pattern = @[@YES, @30, @NO, @2]; - + dictionary[@"VibePattern"] = pattern; dictionary[@"Intensity"] = @2; - + AudioServicesPlaySystemSoundWithVibration(kSystemSoundID_Vibrate, nil, dictionary); } } @@ -180,15 +187,15 @@ int main(int argc, char *argv[]) fprintf(stderr, "Unable to cleanly obtain CS_DEBUGGED - probably not jailbroken. Attempting old method.\n"); ptrace(PTRACE_TRACEME, 0, 0, 0); } - + PROFILE_INIT(); - + @autoreleasepool { NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *bundlePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/assets/"]; - + NativeInit(argc, (const char**)argv, documentsPath.UTF8String, bundlePath.UTF8String, NULL); - + return UIApplicationMain(argc, argv, NSStringFromClass([PPSSPPUIApplication class]), NSStringFromClass([AppDelegate class])); } } diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index 9335063608..11ddce7d24 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -322,10 +322,10 @@ void retro_init(void) { g_Config.bEnableSound = true; g_Config.bAudioResampler = false; g_Config.iCwCheatRefreshRate = 60; - + g_Config.iFirmwareVersion = PSP_DEFAULT_FIRMWARE; g_Config.iPSPModel = PSP_MODEL_SLIM; - + LogManager::Init(); host = new LibretroHost; @@ -730,7 +730,7 @@ bool retro_serialize(void *data, size_t size) { if (useEmuThread) { EmuThreadPause(); // Does nothing if already paused } - + SaveState::SaveStart state; assert(CChunkFileReader::MeasurePtr(state) <= size); bool retVal = CChunkFileReader::SavePtr((u8 *)data, state) == CChunkFileReader::ERROR_NONE; @@ -739,7 +739,7 @@ bool retro_serialize(void *data, size_t size) { EmuThreadStart(); sleep_ms(4); } - + return retVal; } @@ -786,8 +786,15 @@ int System_GetPropertyInt(SystemProperty prop) { switch (prop) { case SYSPROP_AUDIO_SAMPLE_RATE: return SAMPLERATE; + default: + return -1; + } +} + +float System_GetPropertyFloat(SystemProperty prop) { + switch (prop) { case SYSPROP_DISPLAY_REFRESH_RATE: - return 60000; + return 60.f; default: return -1; } diff --git a/unittest/UnitTest.cpp b/unittest/UnitTest.cpp index 8e0d47f122..e2b94af96a 100644 --- a/unittest/UnitTest.cpp +++ b/unittest/UnitTest.cpp @@ -55,6 +55,9 @@ std::string System_GetProperty(SystemProperty prop) { return ""; } int System_GetPropertyInt(SystemProperty prop) { return -1; } +float System_GetPropertyFloat(SystemProperty prop) { + return -1; +} bool System_GetPropertyBool(SystemProperty prop) { return false; } @@ -157,7 +160,7 @@ void fcs(float angle, float &sinout, float &cosout) { int phasein = angle * (1 << BITSPERQUARTER); // Modulo phase into quarter, convert to float 0..1 float modphase = (phasein & ((1<> BITSPERQUARTER; // Recognize quarter if (!quarter) {