Merge branch 'master' of ssh://git.eden-emu.dev/eden-emu/eden into HEAD

This commit is contained in:
lizzie 2025-07-11 19:08:33 +01:00
commit 2e7214da5f
9 changed files with 88 additions and 30 deletions

View file

@ -17,6 +17,10 @@ if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /WX-")
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
endif()
# Check if SDL2::SDL2 target exists; if not, create an alias
if (TARGET SDL2::SDL2-static)
add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static)
@ -27,8 +31,12 @@ endif()
# Set bundled sdl2/qt as dependent options.
option(ENABLE_SDL2 "Enable the SDL2 frontend" ON)
CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON "ENABLE_SDL2;MSVC" OFF)
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
# On Linux system SDL2 is likely to be lacking HIDAPI support which have drawbacks but is needed for SDL motion
CMAKE_DEPENDENT_OPTION(YUZU_USE_EXTERNAL_SDL2 "Compile external SDL2" OFF "ENABLE_SDL2;NOT MSVC" OFF)
else()
CMAKE_DEPENDENT_OPTION(YUZU_USE_EXTERNAL_SDL2 "Compile external SDL2" ON "ENABLE_SDL2;NOT MSVC" OFF)
endif()
cmake_dependent_option(ENABLE_LIBUSB "Enable the use of LibUSB" ON "NOT ANDROID" OFF)
@ -43,13 +51,29 @@ CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" "${MSV
option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON)
option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" "ON")
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" OFF)
else()
option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" ON)
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
option(YUZU_USE_EXTERNAL_VULKAN_HEADERS "Use Vulkan-Headers from externals" OFF)
else()
option(YUZU_USE_EXTERNAL_VULKAN_HEADERS "Use Vulkan-Headers from externals" ON)
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
option(YUZU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES "Use Vulkan-Utility-Libraries from externals" OFF)
else()
option(YUZU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES "Use Vulkan-Utility-Libraries from externals" ON)
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
option(YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS "Use SPIRV-Tools from externals" OFF)
else()
option(YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS "Use SPIRV-Tools from externals" ON)
endif()
option(YUZU_USE_QT_MULTIMEDIA "Use QtMultimedia for Camera" OFF)
@ -61,7 +85,11 @@ option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF)
option(YUZU_TESTS "Compile tests" "${BUILD_TESTING}")
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
option(YUZU_USE_PRECOMPILED_HEADERS "Use precompiled headers" OFF)
else()
option(YUZU_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON)
endif()
option(YUZU_DOWNLOAD_ANDROID_VVL "Download validation layer binary for android" ON)
@ -75,7 +103,11 @@ CMAKE_DEPENDENT_OPTION(YUZU_CRASH_DUMPS "Compile crash dump (Minidump) support"
option(YUZU_USE_BUNDLED_VCPKG "Use vcpkg for yuzu dependencies" "${MSVC}")
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
option(YUZU_CHECK_SUBMODULES "Check if submodules are present" OFF)
else()
option(YUZU_CHECK_SUBMODULES "Check if submodules are present" ON)
endif()
option(YUZU_ENABLE_LTO "Enable link-time optimization" OFF)
@ -337,8 +369,12 @@ if (NOT YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS)
endif()
if (ENABLE_LIBUSB)
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
find_package(libusb MODULE)
else()
find_package(libusb 1.0.24 MODULE)
endif()
endif()
if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64)
find_package(xbyak 7 CONFIG)
@ -429,7 +465,13 @@ if (ENABLE_QT)
list(APPEND CMAKE_PREFIX_PATH "${Qt6_DIR}")
endif()
# QT6 Multimedia pulls in unneeded audio systems (ALSA, Pulseaudio) for FreeBSD
# ALSA is the default sound system on Linux, but FreeBSD uses OSS which works well enough
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
find_package(Qt6 REQUIRED COMPONENTS Widgets Concurrent)
else()
find_package(Qt6 REQUIRED COMPONENTS Widgets Multimedia Concurrent)
endif()
if (UNIX AND NOT APPLE)
find_package(Qt6 REQUIRED COMPONENTS DBus)
@ -485,7 +527,8 @@ if (UNIX AND NOT APPLE AND NOT ANDROID)
endif()
if (NOT YUZU_USE_BUNDLED_FFMPEG)
# Use system installed FFmpeg
find_package(FFmpeg 4.3 REQUIRED QUIET COMPONENTS ${FFmpeg_COMPONENTS})
#find_package(FFmpeg 4.3 REQUIRED QUIET COMPONENTS ${FFmpeg_COMPONENTS})
find_package(FFmpeg REQUIRED QUIET COMPONENTS ${FFmpeg_COMPONENTS})
endif()
if(ENABLE_QT)

View file

@ -42,6 +42,8 @@
#define RENDERDOC_CC
#elif defined(__APPLE__)
#define RENDERDOC_CC
#elif defined(__FreeBSD__)
#define RENDERDOC_CC
#else
#error "Unknown platform"
#endif

View file

@ -5,6 +5,7 @@ package org.yuzu.yuzu_emu.features.settings.model.view
import androidx.annotation.ArrayRes
import androidx.annotation.StringRes
import org.yuzu.yuzu_emu.features.settings.model.AbstractByteSetting
import org.yuzu.yuzu_emu.features.settings.model.AbstractIntSetting
import org.yuzu.yuzu_emu.features.settings.model.AbstractSetting
@ -24,8 +25,14 @@ class SingleChoiceSetting(
fun getSelectedValue(needsGlobal: Boolean = false) =
when (setting) {
is AbstractIntSetting -> setting.getInt(needsGlobal)
is AbstractByteSetting -> setting.getByte(needsGlobal).toInt()
else -> -1
}
fun setSelectedValue(value: Int) = (setting as AbstractIntSetting).setInt(value)
fun setSelectedValue(value: Int) =
when (setting) {
is AbstractIntSetting -> setting.setInt(value)
is AbstractByteSetting -> setting.setByte(value.toByte())
else -> -1
}
}

View file

@ -643,13 +643,19 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
val battery: BatteryManager =
requireContext().getSystemService(Context.BATTERY_SERVICE) as BatteryManager
val batteryIntent = requireContext().registerReceiver(null,
IntentFilter(Intent.ACTION_BATTERY_CHANGED))
val capacity = battery.getIntProperty(BATTERY_PROPERTY_CAPACITY)
val nowUAmps = battery.getIntProperty(BATTERY_PROPERTY_CURRENT_NOW)
sb.append(String.format("%.1fA (%d%%)", nowUAmps / 1000000.0, capacity))
if (battery.isCharging || nowUAmps > 0.0) {
val status = batteryIntent?.getIntExtra(BatteryManager.EXTRA_STATUS, -1)
val isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING ||
status == BatteryManager.BATTERY_STATUS_FULL
if (isCharging) {
sb.append(" ${getString(R.string.charging)}")
}
}

View file

@ -74,7 +74,7 @@
<string name="veil_extensions">GPU Extensions</string>
<string name="dyna_state">Extended Dynamic State</string>
<string name="dyna_state_description">Enables Vulkan features to improve performance, rendering, and save resources on pipeline creation while maintaining lower CPU/GPU usage. These extensions may increase device temperature, and GPUs belonging to the older A6XX line may not react properly. Set to 0 to use Legacy emulated formats.</string>
<string name="dyna_state_description">Enables Vulkan features to improve performance, rendering, and save resources on pipeline creation while maintaining lower CPU/GPU usage. These extensions may increase device temperature, and GPUs belonging to the older A6XX line may not react properly. Disable to emulate scaled formats.</string>
<string name="disabled">Disabled</string>
<string name="provoking_vertex">Provoking Vertex</string>
<string name="provoking_vertex_description">Improves lighting and vertex handling in certain games. Only supported on Vulkan 1.0+ GPUs.</string>
@ -95,11 +95,11 @@
<string name="firmware_uninstalling">Uninstalling firmware</string>
<string name="firmware_uninstalled_success">Firmware uninstalled successfully</string>
<string name="veil_misc">Miscellaneous</string>
<string name="veil_misc">CPU and Memory</string>
<string name="use_sync_core">Synchronize Core Speed</string>
<string name="use_sync_core_description">Synchronize the core tick speed to the maximum speed percentage to improve performance without altering the game\'s actual speed.</string>
<string name="use_lru_cache">Enable LRU Cache</string>
<string name="use_lru_cache_description">Enable or disable the Least Recently Used (LRU) cache, increasing performance by saving CPU process usage. Some games have issue with it, notably TotK 1.2.1, so disable if the game doesn\'t boot or crashes randomly.</string>
<string name="use_lru_cache_description">Enable or disable the Least Recently Used (LRU) cache, increasing performance by saving CPU process usage. Some games have issues with it, notably TotK 1.2.1, so disable if the game doesn\'t boot or crashes randomly.</string>
<string name="use_fast_cpu_time">Fast CPU Time</string>
<string name="use_fast_cpu_time_description">Forces the emulated CPU to run at a higher clock, reducing certain FPS limiters. This option is hacky and may cause issues, and weaker CPUs may see reduced performance.</string>
<string name="custom_cpu_ticks">Custom CPU Ticks</string>

View file

@ -331,7 +331,7 @@ struct Values {
SwitchableSetting<bool> use_disk_shader_cache{linkage, true, "use_disk_shader_cache",
Category::Renderer};
SwitchableSetting<SpirvOptimizeMode, true> optimize_spirv_output{linkage,
SpirvOptimizeMode::OnLoad,
SpirvOptimizeMode::Never,
SpirvOptimizeMode::Never,
SpirvOptimizeMode::Always,
"optimize_spirv_output",
@ -477,7 +477,7 @@ struct Values {
SwitchableSetting<bool> use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders",
Category::RendererAdvanced};
SwitchableSetting<bool> use_fast_gpu_time{linkage,
false,
true,
"use_fast_gpu_time",
Category::RendererAdvanced,
Specialization::Paired,

View file

@ -1150,7 +1150,7 @@ add_library(core STATIC
tools/renderdoc.h
)
if (UNIX AND NOT APPLE AND NOT ANDROID)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
# find_package(libiw REQUIRED)
target_link_libraries(core PRIVATE iw)
endif()

View file

@ -1,6 +1,3 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@ -354,7 +351,7 @@ std::optional<StorageBufferAddr> Track(const IR::Value& value, const Bias* bias)
.index = index.U32(),
.offset = offset.U32(),
};
const u32 alignment{bias ? bias->alignment : 16U};
const u32 alignment{bias ? bias->alignment : 8U};
if (!Common::IsAligned(storage_buffer.offset, alignment)) {
// The SSBO pointer has to be aligned
return std::nullopt;
@ -375,9 +372,9 @@ void CollectStorageBuffers(IR::Block& block, IR::Inst& inst, StorageInfo& info)
// avoid getting false positives
static constexpr Bias nvn_bias{
.index = 0,
.offset_begin = 0x110,
.offset_end = 0x800,
.alignment = 32,
.offset_begin = 0x100,
.offset_end = 0x700,
.alignment = 16,
};
// Track the low address of the instruction
const std::optional<LowAddrInfo> low_addr_info{TrackLowAddress(&inst)};
@ -429,10 +426,7 @@ IR::U32 StorageOffset(IR::Block& block, IR::Inst& inst, StorageBufferAddr buffer
// Align the offset base to match the host alignment requirements
low_cbuf = ir.BitwiseAnd(low_cbuf, ir.Imm32(~(alignment - 1U)));
// It aligns the memory strongly
IR::U32 res = ir.ISub(offset, low_cbuf);
return res;
return ir.ISub(offset, low_cbuf);
}
/// Replace a global memory load instruction with its storage buffer equivalent

View file

@ -25,7 +25,13 @@ extern "C" {
#include <libavcodec/avcodec.h>
#include <libavutil/opt.h>
#include <libavutil/pixdesc.h>
// Works quite fine, and omits the hacky ffmpeg building for now...
#if defined(__FreeBSD__)
#include <libavcodec/codec.h>
#else
#include <libavcodec/codec_internal.h>
#endif
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop