Duckstation/src/util/platform_misc.h

33 lines
993 B
C
Raw Normal View History

// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
2024-09-01 12:08:31 +00:00
// SPDX-License-Identifier: PolyForm-Strict-1.0.0
2023-08-23 12:06:48 +00:00
#include "window_info.h"
#include <optional>
2024-05-25 13:49:14 +00:00
class Error;
2023-08-23 12:06:48 +00:00
namespace PlatformMisc {
2024-05-25 13:49:14 +00:00
bool InitializeSocketSupport(Error* error);
void SuspendScreensaver();
2022-09-21 12:44:52 +00:00
void ResumeScreensaver();
/// Returns the size of pages for the current host.
size_t GetRuntimePageSize();
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);
}