Duckstation/src/util/platform_misc.h

33 lines
1 KiB
C
Raw Normal View History

// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
2023-08-23 12:06:48 +00:00
#include "window_info.h"
#include <optional>
namespace PlatformMisc {
void SuspendScreensaver();
2022-09-21 12:44:52 +00:00
void ResumeScreensaver();
/// Returns the size of pages for the current host.
size_t GetRuntimePageSize();
/// Returns the size of a cache line for the current host.
size_t GetRuntimeCacheLineSize();
2022-09-21 12:44:52 +00:00
/// Abstracts platform-specific code for asynchronously playing a sound.
/// On Windows, this will use PlaySound(). On Linux, it will shell out to aplay. On MacOS, it uses NSSound.
bool PlaySoundAsync(const char* path);
2023-08-23 12:06:48 +00:00
} // namespace PlatformMisc
2023-08-23 12:06:48 +00:00
namespace Host {
/// Return the current window handle. Needed for DInput.
std::optional<WindowInfo> GetTopLevelWindowInfo();
2024-05-23 15:59:35 +00:00
} // namespace Host
// TODO: Move all the other Cocoa stuff in here.
namespace CocoaTools {
/// Returns the refresh rate of the display the window is placed on.
std::optional<float> GetViewRefreshRate(const WindowInfo& wi);
}