mirror of
https://github.com/eden-emulator/mirror.git
synced 2026-06-06 07:25:52 +08:00
ANDROID -> __ANDROID__
This commit is contained in:
parent
9ae4915e9c
commit
48945f7082
@ -303,7 +303,7 @@ namespace {
|
||||
}
|
||||
[[nodiscard]] s64 GetHostCNTFRQ() noexcept {
|
||||
u64 cntfrq_el0 = 0;
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
std::string_view board{""};
|
||||
char buffer[PROP_VALUE_MAX];
|
||||
int len{__system_property_get("ro.product.board", buffer)};
|
||||
|
||||
@ -30,7 +30,7 @@ std::string NativeErrorToString(int e) {
|
||||
return ret;
|
||||
#else
|
||||
char err_str[255];
|
||||
#if defined(ANDROID) || \
|
||||
#if defined(__ANDROID__) || \
|
||||
(defined(__GLIBC__) && (_GNU_SOURCE || (_POSIX_C_SOURCE < 200112L && _XOPEN_SOURCE < 600)))
|
||||
// Thread safe (GNU-specific)
|
||||
const char* str = strerror_r(e, err_str, sizeof(err_str));
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#include "common/assert.h"
|
||||
#include "common/fs/file.h"
|
||||
#include "common/fs/fs.h"
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
#include "common/fs/fs_android.h"
|
||||
#endif
|
||||
#include "common/logging.h"
|
||||
@ -259,7 +259,7 @@ void IOFile::Open(const fs::path& path, FileAccessMode mode, FileType type, File
|
||||
} else {
|
||||
_wfopen_s(&file, path.c_str(), AccessModeToWStr(mode, type));
|
||||
}
|
||||
#elif ANDROID
|
||||
#elif __ANDROID__
|
||||
if (Android::IsContentUri(path)) {
|
||||
ASSERT_MSG(mode == FileAccessMode::Read, "Content URI file access is for read-only!");
|
||||
const auto fd = Android::OpenContentUri(path, Android::OpenMode::Read);
|
||||
@ -396,7 +396,7 @@ u64 IOFile::GetSize() const {
|
||||
// Flush any unwritten buffered data into the file prior to retrieving the file size.
|
||||
std::fflush(file);
|
||||
|
||||
#if ANDROID
|
||||
#ifdef __ANDROID__
|
||||
u64 file_size = 0;
|
||||
if (Android::IsContentUri(file_path)) {
|
||||
file_size = Android::GetSize(file_path);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
#include "common/fs/file.h"
|
||||
#include "common/fs/fs.h"
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
#include "common/fs/fs_android.h"
|
||||
#endif
|
||||
#include "common/fs/path_util.h"
|
||||
@ -532,7 +532,7 @@ void IterateDirEntriesRecursively(const std::filesystem::path& path,
|
||||
|
||||
bool Exists(const fs::path& path) {
|
||||
std::error_code ec;
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
if (Android::IsContentUri(path)) {
|
||||
return Android::Exists(path);
|
||||
} else {
|
||||
@ -545,7 +545,7 @@ bool Exists(const fs::path& path) {
|
||||
|
||||
bool IsFile(const fs::path& path) {
|
||||
std::error_code ec;
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
if (Android::IsContentUri(path)) {
|
||||
return !Android::IsDirectory(path);
|
||||
} else {
|
||||
@ -558,7 +558,7 @@ bool IsFile(const fs::path& path) {
|
||||
|
||||
bool IsDir(const fs::path& path) {
|
||||
std::error_code ec;
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
if (Android::IsContentUri(path)) {
|
||||
return Android::IsDirectory(path);
|
||||
} else {
|
||||
@ -611,7 +611,7 @@ fs::file_type GetEntryType(const fs::path& path) {
|
||||
}
|
||||
|
||||
u64 GetSize(const fs::path& path) {
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
if (Android::IsContentUri(path)) {
|
||||
return Android::GetSize(path);
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/fs/fs.h"
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
#include "common/fs/fs_android.h"
|
||||
#endif
|
||||
#include "common/fs/fs_paths.h"
|
||||
@ -126,7 +126,7 @@ public:
|
||||
LEGACY_PATH(Yuzu, YUZU)
|
||||
LEGACY_PATH(Suyu, SUYU)
|
||||
#undef LEGACY_PATH
|
||||
#elif ANDROID
|
||||
#elif __ANDROID__
|
||||
ASSERT(!eden_path.empty());
|
||||
eden_path_cache = eden_path / CACHE_DIR;
|
||||
eden_path_config = eden_path / CONFIG_DIR;
|
||||
@ -447,11 +447,11 @@ std::vector<std::string> SplitPathComponentsCopy(std::string_view filename) {
|
||||
|
||||
std::string SanitizePath(std::string_view path_, DirectorySeparator directory_separator) {
|
||||
std::string path(path_);
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
if (Android::IsContentUri(path)) {
|
||||
return path;
|
||||
}
|
||||
#endif // ANDROID
|
||||
#endif // __ANDROID__
|
||||
|
||||
char type1 = directory_separator == DirectorySeparator::BackwardSlash ? '/' : '\\';
|
||||
char type2 = directory_separator == DirectorySeparator::BackwardSlash ? '\\' : '/';
|
||||
@ -482,7 +482,7 @@ std::string GetParentPath(std::string_view path) {
|
||||
return std::string(path);
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
if (path[0] != '/') {
|
||||
std::string path_string{path};
|
||||
return FS::Android::GetParentDirectory(path_string);
|
||||
|
||||
@ -320,7 +320,7 @@ struct DebuggerBackend final : public Backend {
|
||||
void Flush() noexcept override {}
|
||||
};
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
/// @brief Backend that writes to the Android logcat
|
||||
struct LogcatBackend : public Backend {
|
||||
explicit LogcatBackend() noexcept = default;
|
||||
@ -359,7 +359,7 @@ struct Impl {
|
||||
#ifdef _WIN32
|
||||
lambda(static_cast<Backend&>(debugger_backend));
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
lambda(static_cast<Backend&>(lc_backend));
|
||||
#endif
|
||||
}
|
||||
@ -372,7 +372,7 @@ struct Impl {
|
||||
#ifdef _WIN32
|
||||
DebuggerBackend debugger_backend{};
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
LogcatBackend lc_backend{};
|
||||
#endif
|
||||
std::chrono::steady_clock::time_point time_origin{std::chrono::steady_clock::now()};
|
||||
|
||||
@ -359,7 +359,7 @@ struct Values {
|
||||
true,
|
||||
true};
|
||||
SwitchableSetting<int, true> fsr_sharpening_slider{linkage,
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
0,
|
||||
#else
|
||||
25,
|
||||
@ -417,7 +417,7 @@ struct Values {
|
||||
linkage, 0, "bg_blue", Category::Renderer, Specialization::Default, true, true};
|
||||
|
||||
SwitchableSetting<GpuAccuracy, true> gpu_accuracy{linkage,
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
GpuAccuracy::Low,
|
||||
#else
|
||||
GpuAccuracy::Medium,
|
||||
@ -447,7 +447,7 @@ struct Values {
|
||||
"nvdec_emulation", Category::RendererAdvanced};
|
||||
|
||||
SwitchableSetting<AnisotropyMode, true> max_anisotropy{linkage,
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
AnisotropyMode::Default,
|
||||
#else
|
||||
AnisotropyMode::Automatic,
|
||||
@ -500,7 +500,7 @@ struct Values {
|
||||
Category::RendererAdvanced};
|
||||
|
||||
SwitchableSetting<bool> use_reactive_flushing{linkage,
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
false,
|
||||
#else
|
||||
true,
|
||||
@ -519,7 +519,7 @@ struct Values {
|
||||
true,
|
||||
true};
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
SwitchableSetting<bool> use_optimized_vertex_buffers{linkage,
|
||||
false,
|
||||
"use_optimized_vertex_buffers",
|
||||
@ -553,7 +553,7 @@ struct Values {
|
||||
true,
|
||||
true};
|
||||
SwitchableSetting<bool> async_presentation{linkage,
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
false,
|
||||
#else
|
||||
false,
|
||||
@ -599,7 +599,7 @@ struct Values {
|
||||
Category::RendererHacks};
|
||||
|
||||
SwitchableSetting<ExtendedDynamicState> dyna_state{linkage,
|
||||
#if defined(ANDROID)
|
||||
#if defined(__ANDROID__)
|
||||
ExtendedDynamicState::Disabled,
|
||||
#elif defined(__APPLE__)
|
||||
ExtendedDynamicState::Disabled,
|
||||
@ -618,7 +618,7 @@ struct Values {
|
||||
Specialization::Scalar};
|
||||
|
||||
SwitchableSetting<bool> vertex_input_dynamic_state{linkage,
|
||||
#if defined (ANDROID)
|
||||
#ifdef __ANDROID__
|
||||
false,
|
||||
#else
|
||||
true,
|
||||
@ -634,7 +634,7 @@ struct Values {
|
||||
linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug};
|
||||
Setting<bool> enable_renderdoc_hotkey{linkage, false, "renderdoc_hotkey",
|
||||
Category::RendererDebug};
|
||||
#if defined(ANDROID) && defined(ARCHITECTURE_arm64)
|
||||
#if defined(__ANDROID__) && defined(ARCHITECTURE_arm64)
|
||||
// Debug override for automatic BCn patching detection
|
||||
Setting<bool> patch_old_qcom_drivers{linkage, false, "patch_old_qcom_drivers",
|
||||
Category::RendererDebug};
|
||||
@ -679,7 +679,7 @@ struct Values {
|
||||
Setting<s32> current_user{linkage, 0, "current_user", Category::System};
|
||||
|
||||
SwitchableSetting<ConsoleMode> use_docked_mode{linkage,
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
ConsoleMode::Handheld,
|
||||
#else
|
||||
ConsoleMode::Docked,
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
#include <common/fs/fs_android.h>
|
||||
#endif
|
||||
|
||||
@ -45,7 +45,7 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _
|
||||
if (full_path.empty())
|
||||
return false;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
if (full_path[0] != '/') {
|
||||
*_pPath = Common::FS::Android::GetParentDirectory(full_path);
|
||||
*_pFilename = Common::FS::Android::GetFilename(full_path);
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/version.hpp>
|
||||
|
||||
#if BOOST_VERSION > 108400 && (!defined(_WINDOWS) && !defined(ANDROID)) || defined(YUZU_BOOST_v1)
|
||||
#if BOOST_VERSION > 108400 && (!defined(_WINDOWS) && !defined(__ANDROID__)) || defined(YUZU_BOOST_v1)
|
||||
#define USE_BOOST_v1
|
||||
#endif
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
#define stat _stat64
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
#include "common/fs/fs_android.h"
|
||||
#endif
|
||||
|
||||
@ -288,7 +288,7 @@ RealVfsFile::~RealVfsFile() {
|
||||
}
|
||||
|
||||
std::string RealVfsFile::GetName() const {
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
if (path[0] != '/') {
|
||||
return FS::Android::GetFilename(path);
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ RenderdocAPI::RenderdocAPI() {
|
||||
#elif defined(__HAIKU__)
|
||||
// no rtld on haiku
|
||||
#else
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
static constexpr const char RENDERDOC_LIB[] = "libVkLayer_GLES_RenderDoc.so";
|
||||
#else
|
||||
static constexpr const char RENDERDOC_LIB[] = "librenderdoc.so";
|
||||
|
||||
@ -1009,7 +1009,7 @@ std::string Config::AdjustOutputString(const std::string& string) {
|
||||
|
||||
// Windows requires that two forward slashes are used at the start of a path for unmapped
|
||||
// network drives so we have to watch for that here
|
||||
#ifndef ANDROID
|
||||
#ifndef __ANDROID__
|
||||
if (string.substr(0, 2) == "//") {
|
||||
boost::replace_all(adjusted_string, "//", "/");
|
||||
adjusted_string.insert(0, "/");
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
#include "core/crypto/key_manager.h"
|
||||
#include "frontend_common/content_manager.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
#include <jni.h>
|
||||
#include <common/android/id_cache.h>
|
||||
#include <common/android/android_common.h>
|
||||
@ -25,7 +25,7 @@ FirmwareManager::InstallKeys(std::string location, std::string extension) {
|
||||
|
||||
const auto keys_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::KeysDir);
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
JNIEnv *env = Common::Android::GetEnvForThread();
|
||||
|
||||
jstring jsrc = Common::Android::ToJString(env, location);
|
||||
|
||||
@ -179,7 +179,7 @@ void EmulatedController::LoadDevices() {
|
||||
if (npad_id_type == NpadIdType::Player1 || npad_id_type == NpadIdType::Handheld) {
|
||||
camera_params[1] = Common::ParamPackage{"engine:camera,camera:1"};
|
||||
nfc_params[0] = Common::ParamPackage{"engine:virtual_amiibo,nfc:1"};
|
||||
#ifndef ANDROID
|
||||
#ifndef __ANDROID__
|
||||
ring_params[1] = Common::ParamPackage{"engine:joycon,axis_x:100,axis_y:101"};
|
||||
#else
|
||||
android_params = Common::ParamPackage{"engine:android,port:100"};
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
#include "input_common/drivers/sdl_driver.h"
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
#include "input_common/drivers/android.h"
|
||||
#endif
|
||||
|
||||
@ -85,7 +85,7 @@ struct InputSubsystem::Impl {
|
||||
RegisterEngine("cemuhookudp", udp_client);
|
||||
RegisterEngine("tas", tas_input);
|
||||
RegisterEngine("camera", camera);
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
RegisterEngine("android", android);
|
||||
#endif
|
||||
RegisterEngine("virtual_amiibo", virtual_amiibo);
|
||||
@ -119,7 +119,7 @@ struct InputSubsystem::Impl {
|
||||
UnregisterEngine(udp_client);
|
||||
UnregisterEngine(tas_input);
|
||||
UnregisterEngine(camera);
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
UnregisterEngine(android);
|
||||
#endif
|
||||
UnregisterEngine(virtual_amiibo);
|
||||
@ -138,13 +138,13 @@ struct InputSubsystem::Impl {
|
||||
Common::ParamPackage{{"display", "Any"}, {"engine", "any"}},
|
||||
};
|
||||
|
||||
#ifndef ANDROID
|
||||
#ifndef __ANDROID__
|
||||
auto keyboard_devices = keyboard->GetInputDevices();
|
||||
devices.insert(devices.end(), keyboard_devices.begin(), keyboard_devices.end());
|
||||
auto mouse_devices = mouse->GetInputDevices();
|
||||
devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end());
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
auto android_devices = android->GetInputDevices();
|
||||
devices.insert(devices.end(), android_devices.begin(), android_devices.end());
|
||||
#endif
|
||||
@ -176,7 +176,7 @@ struct InputSubsystem::Impl {
|
||||
if (engine == mouse->GetEngineName()) {
|
||||
return mouse;
|
||||
}
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
if (engine == android->GetEngineName()) {
|
||||
return android;
|
||||
}
|
||||
@ -261,7 +261,7 @@ struct InputSubsystem::Impl {
|
||||
if (engine == mouse->GetEngineName()) {
|
||||
return true;
|
||||
}
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
if (engine == android->GetEngineName()) {
|
||||
return true;
|
||||
}
|
||||
@ -294,7 +294,7 @@ struct InputSubsystem::Impl {
|
||||
void BeginConfiguration() {
|
||||
keyboard->BeginConfiguration();
|
||||
mouse->BeginConfiguration();
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
android->BeginConfiguration();
|
||||
#endif
|
||||
#ifdef ENABLE_LIBUSB
|
||||
@ -310,7 +310,7 @@ struct InputSubsystem::Impl {
|
||||
void EndConfiguration() {
|
||||
keyboard->EndConfiguration();
|
||||
mouse->EndConfiguration();
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
android->EndConfiguration();
|
||||
#endif
|
||||
#ifdef ENABLE_LIBUSB
|
||||
@ -355,7 +355,7 @@ struct InputSubsystem::Impl {
|
||||
std::shared_ptr<Joycons> joycon;
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
std::shared_ptr<Android> android;
|
||||
#endif
|
||||
};
|
||||
@ -412,7 +412,7 @@ const Camera* InputSubsystem::GetCamera() const {
|
||||
return impl->camera.get();
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
Android* InputSubsystem::GetAndroid() {
|
||||
return impl->android.get();
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ Id EmitConvertU32U64(EmitContext& ctx, Id value) {
|
||||
}
|
||||
|
||||
Id EmitConvertF16F32(EmitContext& ctx, Id value) {
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
return ctx.OpFConvert(ctx.F16[1], value);
|
||||
#else
|
||||
const auto result = ctx.OpFConvert(ctx.F16[1], value);
|
||||
|
||||
@ -506,7 +506,7 @@ Id EmitImageSampleExplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value&
|
||||
Id result = Emit(&EmitContext::OpImageSparseSampleExplicitLod,
|
||||
&EmitContext::OpImageSampleExplicitLod, ctx, inst, ctx.F32[4],
|
||||
Texture(ctx, info, index), coords, operands.Mask(), operands.Span());
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
if (Settings::values.fix_bloom_effects.GetValue()) {
|
||||
result = ctx.OpVectorTimesScalar(ctx.F32[4], result, ctx.Const(0.98f));
|
||||
}
|
||||
|
||||
@ -801,7 +801,7 @@ void BufferCache<P>::UpdateVertexBufferSlot(u32 index, const Binding& binding) {
|
||||
template <class P>
|
||||
void BufferCache<P>::BindHostVertexBuffers() {
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
const bool use_optimized_vertex_buffers = Settings::values.use_optimized_vertex_buffers.GetValue();
|
||||
#else
|
||||
constexpr bool use_optimized_vertex_buffers = true;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
|
||||
#include "video_core/gpu_logging/freedreno_debug.h"
|
||||
#include "common/logging.h"
|
||||
@ -49,4 +49,4 @@ std::string FreedrenoDebugger::GetBreadcrumbs() {
|
||||
|
||||
} // namespace GPU::Logging::Freedreno
|
||||
|
||||
#endif // ANDROID
|
||||
#endif // __ANDROID__
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
|
||||
#include <string>
|
||||
|
||||
@ -29,4 +29,4 @@ private:
|
||||
|
||||
} // namespace GPU::Logging::Freedreno
|
||||
|
||||
#endif // ANDROID
|
||||
#endif // __ANDROID__
|
||||
|
||||
@ -28,7 +28,7 @@ namespace {
|
||||
constexpr AVPixelFormat PreferredGpuFormat = AV_PIX_FMT_NV12;
|
||||
constexpr AVPixelFormat PreferredCpuFormat = AV_PIX_FMT_YUV420P;
|
||||
constexpr std::array PreferredGpuDecoders = {
|
||||
#if defined (_WIN32)
|
||||
#if defined(_WIN32)
|
||||
AV_HWDEVICE_TYPE_CUDA,
|
||||
AV_HWDEVICE_TYPE_D3D11VA,
|
||||
AV_HWDEVICE_TYPE_DXVA2,
|
||||
@ -39,7 +39,7 @@ constexpr std::array PreferredGpuDecoders = {
|
||||
AV_HWDEVICE_TYPE_DRM,
|
||||
#elif defined(__APPLE__)
|
||||
AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
|
||||
#elif defined(ANDROID)
|
||||
#elif defined(__ANDROID__)
|
||||
AV_HWDEVICE_TYPE_MEDIACODEC,
|
||||
#elif defined(__unix__)
|
||||
AV_HWDEVICE_TYPE_CUDA,
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
||||
#include "video_core/gpu_logging/gpu_logging.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
#include "../../android/app/src/main/jni/android_settings.h"
|
||||
#endif
|
||||
|
||||
@ -328,7 +328,7 @@ Shader::RuntimeInfo MakeRuntimeInfo(std::span<const Shader::IR::Program> program
|
||||
size_t GetTotalPipelineWorkers() {
|
||||
const size_t max_core_threads =
|
||||
std::max<size_t>(static_cast<size_t>(std::thread::hardware_concurrency()), 2ULL) - 1ULL;
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
const int configured = AndroidSettings::values.pipeline_worker_count.GetValue();
|
||||
const int clamped = std::clamp(configured, 4, 8);
|
||||
const size_t desired = static_cast<size_t>(clamped);
|
||||
|
||||
@ -309,7 +309,7 @@ void PresentManager::CopyToSwapchain(Frame* frame) {
|
||||
try {
|
||||
// Recreate surface and swapchain if needed.
|
||||
if (requires_recreation) {
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
surface = CreateSurface(instance, render_window.GetWindowInfo());
|
||||
#endif
|
||||
RecreateSwapchain(frame);
|
||||
|
||||
@ -928,13 +928,13 @@ void RasterizerVulkan::LoadDiskResources(u64 title_id, std::stop_token stop_load
|
||||
}
|
||||
|
||||
void RasterizerVulkan::FlushWork() {
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
static constexpr u32 DRAWS_TO_DISPATCH = 512;
|
||||
static constexpr u32 CHECK_MASK = 3;
|
||||
#else
|
||||
static constexpr u32 DRAWS_TO_DISPATCH = 4096;
|
||||
static constexpr u32 CHECK_MASK = 7;
|
||||
#endif // ANDROID
|
||||
#endif // __ANDROID__
|
||||
|
||||
static_assert(DRAWS_TO_DISPATCH % (CHECK_MASK + 1) == 0);
|
||||
if ((++draw_counter & CHECK_MASK) != CHECK_MASK) {
|
||||
|
||||
@ -288,7 +288,7 @@ void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities) {
|
||||
.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE,
|
||||
.queueFamilyIndexCount = 0,
|
||||
.pQueueFamilyIndices = nullptr,
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
// On Android, do not allow surface rotation to deviate from the frontend.
|
||||
.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR,
|
||||
#else
|
||||
@ -313,7 +313,7 @@ void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities) {
|
||||
swapchain_ci.imageFormat, // Base format MUST be first
|
||||
VK_FORMAT_B8G8R8A8_UNORM,
|
||||
VK_FORMAT_B8G8R8A8_SRGB,
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
VK_FORMAT_R8G8B8A8_UNORM, // Android may use RGBA
|
||||
VK_FORMAT_R8G8B8A8_SRGB,
|
||||
#endif
|
||||
@ -338,7 +338,7 @@ void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities) {
|
||||
|
||||
images = swapchain.GetImages();
|
||||
image_count = static_cast<u32>(images.size());
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
// Android is already ordered the same as Switch.
|
||||
image_view_format = VK_FORMAT_R8G8B8A8_UNORM;
|
||||
#else
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#if defined(ANDROID) && defined(ARCHITECTURE_arm64)
|
||||
#if defined(__ANDROID__) && defined(ARCHITECTURE_arm64)
|
||||
#include <adrenotools/driver.h>
|
||||
#endif
|
||||
|
||||
@ -20,7 +20,7 @@ namespace Vulkan {
|
||||
using namespace Common::Literals;
|
||||
|
||||
TurboMode::TurboMode(const vk::Instance& instance, const vk::InstanceDispatch& dld)
|
||||
#ifndef ANDROID
|
||||
#ifndef __ANDROID__
|
||||
: m_device{CreateDevice(instance, dld, VK_NULL_HANDLE)}, m_allocator{m_device}
|
||||
#endif
|
||||
{
|
||||
@ -40,7 +40,7 @@ void TurboMode::QueueSubmitted() {
|
||||
}
|
||||
|
||||
void TurboMode::Run(std::stop_token stop_token) {
|
||||
#ifndef ANDROID
|
||||
#ifndef __ANDROID__
|
||||
auto& dld = m_device.GetLogical();
|
||||
|
||||
// Allocate buffer. 2MiB should be sufficient.
|
||||
@ -154,7 +154,7 @@ void TurboMode::Run(std::stop_token stop_token) {
|
||||
#endif
|
||||
|
||||
while (!stop_token.stop_requested()) {
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
#ifdef ARCHITECTURE_arm64
|
||||
adrenotools_set_turbo(true);
|
||||
#endif
|
||||
@ -232,7 +232,7 @@ void TurboMode::Run(std::stop_token stop_token) {
|
||||
std::chrono::milliseconds{100};
|
||||
});
|
||||
}
|
||||
#if defined(ANDROID) && defined(ARCHITECTURE_arm64)
|
||||
#if defined(__ANDROID__) && defined(ARCHITECTURE_arm64)
|
||||
adrenotools_set_turbo(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ public:
|
||||
private:
|
||||
void Run(std::stop_token stop_token);
|
||||
|
||||
#ifndef ANDROID
|
||||
#ifndef __ANDROID__
|
||||
Device m_device;
|
||||
MemoryAllocator m_allocator;
|
||||
#endif
|
||||
|
||||
@ -27,7 +27,7 @@ VkBool32 DebugUtilCallback(VkDebugUtilsMessageSeverityFlagBitsEXT severity,
|
||||
[[maybe_unused]] void* user_data) {
|
||||
// Skip logging known false-positive validation errors
|
||||
switch (static_cast<u32>(data->messageIdNumber)) {
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
case 0xbf9cf353u: // VUID-vkCmdBindVertexBuffers2-pBuffers-04111
|
||||
// The below are due to incorrect reporting of extendedDynamicState
|
||||
case 0x1093bebbu: // VUID-vkCmdSetCullMode-None-03384
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
||||
#include "video_core/gpu_logging/gpu_logging.h"
|
||||
|
||||
#if defined(ANDROID) && defined(ARCHITECTURE_arm64)
|
||||
#if defined(__ANDROID__) && defined(ARCHITECTURE_arm64)
|
||||
#include <adrenotools/bcenabler.h>
|
||||
#include <android/api-level.h>
|
||||
#endif
|
||||
@ -294,7 +294,7 @@ ankerl::unordered_dense::map<VkFormat, VkFormatProperties> GetFormatProperties(v
|
||||
return format_properties;
|
||||
}
|
||||
|
||||
#if defined(ANDROID) && defined(ARCHITECTURE_arm64)
|
||||
#if defined(__ANDROID__) && defined(ARCHITECTURE_arm64)
|
||||
void OverrideBcnFormats(ankerl::unordered_dense::map<VkFormat, VkFormatProperties>& format_properties) {
|
||||
// These properties are extracted from Adreno driver 512.687.0
|
||||
constexpr VkFormatFeatureFlags tiling_features{VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT |
|
||||
@ -504,7 +504,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
||||
features.shader_atomic_int64.shaderSharedInt64Atomics = false;
|
||||
features.features.shaderInt64 = false;
|
||||
|
||||
#if defined(ANDROID) && defined(ARCHITECTURE_arm64)
|
||||
#if defined(__ANDROID__) && defined(ARCHITECTURE_arm64)
|
||||
// BCn patching only safe on Android 9+ (API 28+). Older versions crash on driver load.
|
||||
const auto major = (properties.properties.driverVersion >> 24) << 2;
|
||||
const auto minor = (properties.properties.driverVersion >> 12) & 0xFFFU;
|
||||
|
||||
@ -16,7 +16,7 @@ namespace Vulkan {
|
||||
std::shared_ptr<Common::DynamicLibrary> OpenLibrary(
|
||||
[[maybe_unused]] Core::Frontend::GraphicsContext* context) {
|
||||
LOG_DEBUG(Render_Vulkan, "Looking for a Vulkan library");
|
||||
#if defined(ANDROID) && defined(ARCHITECTURE_arm64)
|
||||
#if defined(__ANDROID__) && defined(ARCHITECTURE_arm64)
|
||||
// Android manages its Vulkan driver from the frontend.
|
||||
return context->GetDriverLibrary();
|
||||
#else
|
||||
|
||||
@ -453,7 +453,7 @@ public:
|
||||
return handle != Type{};
|
||||
}
|
||||
|
||||
#ifndef ANDROID
|
||||
#ifndef __ANDROID__
|
||||
/**
|
||||
* Releases ownership of the managed handle.
|
||||
* The caller is responsible for managing the lifetime of the returned handle.
|
||||
@ -535,7 +535,7 @@ public:
|
||||
return handle != Type{};
|
||||
}
|
||||
|
||||
#ifndef ANDROID
|
||||
#ifndef __ANDROID__
|
||||
/**
|
||||
* Releases ownership of the managed handle.
|
||||
* The caller is responsible for managing the lifetime of the returned handle.
|
||||
|
||||
@ -19,7 +19,12 @@ Dumb script that serves as a ad-hoc cpp-linter
|
||||
|
||||
Commands:
|
||||
once Check for #pragma once prescence in header files
|
||||
|
||||
osdef Fixes OS defines that are not recommended to use:
|
||||
ANDROID
|
||||
_WIN64
|
||||
linux
|
||||
__unix__
|
||||
__unix
|
||||
EOF
|
||||
}
|
||||
|
||||
@ -31,6 +36,9 @@ while :; do
|
||||
;;
|
||||
osdef)
|
||||
find "$ROOTDIR/src" -type f -name "*.h" -exec grep -nw "ANDROID" {} +
|
||||
find "$ROOTDIR/src" -type f -name "*.h" -exec grep -nw "_WIN64" {} +
|
||||
find "$ROOTDIR/src" -type f -name "*.h" -exec grep -nw "__linux" {} +
|
||||
find "$ROOTDIR/src" -type f -name "*.h" -exec grep -nw "__unix" {} +
|
||||
break
|
||||
;;
|
||||
*) usage ;;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user