Compare commits

...

30 Commits

Author SHA1 Message Date
ReinUsesLisp
81c8f92f2e vk_device: Fix build error on old MSVC versions
Designated initializers on old MSVC versions fail to build when they
take the address of a constant.
2020-07-17 20:27:53 -03:00
bunnei
5d95e62443 Merge pull request #4344 from VolcaEM/c3
dmnt_cheat_vm: Implement opcode 0xC3 (ReadWriteStaticRegister)
2020-07-17 17:11:52 -04:00
bunnei
0f0b756775 Merge pull request #4309 from Morph1984/fix-romfs-bug
fs: Fix RomFS building when zero byte files are present
2020-07-17 17:01:20 -04:00
bunnei
19c6bf72db Merge pull request #4322 from ReinUsesLisp/fix-dynstate
vk_state_tracker: Fix dirty flags for stencil_enable on VK_EXT_extended_dynamic_state
2020-07-17 09:50:45 -04:00
LC
47956a3bbc Merge pull request #4369 from lioncash/hle-macro
macro_hle: Remove unnecessary std::make_pair calls
2020-07-17 05:20:41 -04:00
LC
9d3cbf6a90 Merge pull request #4340 from lioncash/remove
shader_cache: Make use of std::erase_if
2020-07-17 05:19:20 -04:00
David
c783cf443e Merge pull request #4347 from lioncash/logging
settings: Make use of std::string_view over std::string for logging
2020-07-17 13:25:06 +10:00
David
92f37a229e Merge pull request #4371 from lioncash/cmake2
core/CMakeLists: Add missing physical_memory.h header file
2020-07-17 13:22:19 +10:00
David
adbf5ca50b Merge pull request #4357 from lioncash/unused4
kernel: Remove unused variables
2020-07-17 13:18:31 +10:00
David
69f8b6a53e Merge pull request #4358 from lioncash/unused5
kernel/thread: Remove unimplemented function prototype
2020-07-17 13:17:52 +10:00
Lioncash
c0650cd82c macro_hle: Remove unnecessary static keywords
These functions are already in an anonymous namespace which makes the
functions internally linked.
2020-07-16 23:17:17 -04:00
David
0d10c863a5 Merge pull request #4367 from lioncash/inc2
constants: Add missing <array> include
2020-07-17 13:14:01 +10:00
David
9cca0c2f83 Merge pull request #4368 from lioncash/macro
macro: Resolve missing parameter in doxygen comment
2020-07-17 13:13:22 +10:00
David
3ce4edba64 Merge pull request #4370 from lioncash/simplify
macro_hle: Simplify shift expression in HLE_771BB18C62444DA0()
2020-07-17 13:13:05 +10:00
Lioncash
311f500753 core/CMakeLists: Add missing physical_memory.h header file
Allows this header file to show up in IDE CMake generators.
2020-07-16 22:56:31 -04:00
Lioncash
be6b7591d9 macro_hle: Simplify shift expression in HLE_771BB18C62444DA0()
Given the expression involves a 32-bit value, this simplifies down to
just: 0x3ffffff. This is likely a remnant from testing that was never
cleaned up.

Resolves a -Wshift-overflow warning.
2020-07-16 22:16:11 -04:00
Lioncash
cc935d997b macro_hle: Remove unnecessary std::make_pair calls
The purpose of make_pair is generally to deduce the types within the
pair without explicitly specifying the types, so these usages were
generally unnecessary, particularly when the type is enforced by the
array declaration.
2020-07-16 21:59:25 -04:00
Lioncash
502dbfb9eb macro: Resolve missing parameter in doxygen comment
Resolves a -Wdocumentation warning.
2020-07-16 21:54:42 -04:00
Lioncash
e07eb5b223 constants: Add missing <array> include
Eliminates reliance on an indirect include.
2020-07-16 21:43:20 -04:00
Rodrigo Locatti
39ae2deb28 Merge pull request #4363 from lioncash/mismatch
vk_texture_cache: Amend mismatched access masks and indices in UploadBuffer
2020-07-16 21:54:40 -03:00
Lioncash
169759e069 vk_texture_cache: Amend mismatched access masks and indices in UploadBuffer
Discovered while converting relevant parts of the codebase over to
designated initializers.
2020-07-16 19:45:46 -04:00
Lioncash
8bef49cde5 kernel/thread: Remove unimplemented function prototype
This isn't used, so it can be removed.
2020-07-16 14:32:46 -04:00
Lioncash
2bab07c367 kernel: Remove unused variables
Resolves some compiler warnings in the Linux build.
2020-07-16 14:17:50 -04:00
Lioncash
af5a56ddc4 settings: Resolve a sign conversion warning within GetTimeZoneString()
A sign conversion warning was occurring due to an int < size_t
comparison.
2020-07-15 13:45:22 -04:00
Lioncash
5dbf91d739 settings: Make use of std::string_view over std::string for logging
In all usages of LogSetting(), string literals are provided.
std::string_view is better suited here, as we won't churn a bunch of
string allocations every time the settings are logged out.

While we're at it, we can fold LogSetting() into LogSettings(), given
it's only ever used there.
2020-07-15 13:37:33 -04:00
VolcaEM
e90802e762 clang-format 2020-07-15 01:22:52 +02:00
VolcaEM
b608acd688 dmnt_cheat_vm: Implement opcode 0xC3 (ReadWriteStaticRegister)
This was based on Atmosphére's DMNT Cheat VM:

- https://github.com/Atmosphere-NX/Atmosphere/blob/master/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.hpp
- https://github.com/Atmosphere-NX/Atmosphere/blob/master/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.cpp

From Atmosphére's documentation: "Code type 0xC3 reads or writes a static register with a given register"

There are now only two remaining opcodes to implement (PauseProcess and BreakProcess)

This is untested because I don't have any experience in testing cheats on yuzu
2020-07-15 01:19:22 +02:00
Lioncash
969100d41a shader_cache: Make use of std::erase_if
Now that we use C++20, we can also make use of std::erase_if instead of
needing to do the erase-remove idiom.
2020-07-14 15:49:15 -04:00
ReinUsesLisp
0fe09df386 vk_state_tracker: Fix dirty flags for stencil_enable on VK_EXT_extended_dynamic_state
Fixes a regression on any game using stencil on devices with
VK_EXT_extended_dynamic_state.
2020-07-12 20:43:42 -03:00
Morph
fd1c3aa14e fs: Fix RomFS building when zero byte files are present
When zero byte files are present, the key (offset) for that file is identical to the file right after. A std::map isn't able to fit key-value pairs with identical keys (offsets), therefore, the solution is to use std::multimap which permits multiple entries with the same key.

This most prominently fixes Pokemon Sword and Shield weather with any RomFS mod applied.
2020-07-12 04:33:35 -04:00
19 changed files with 115 additions and 82 deletions

View File

@@ -185,6 +185,7 @@ add_library(core STATIC
hle/kernel/object.h
hle/kernel/physical_core.cpp
hle/kernel/physical_core.h
hle/kernel/physical_memory.h
hle/kernel/process.cpp
hle/kernel/process.h
hle/kernel/process_capability.cpp

View File

@@ -4,6 +4,7 @@
#pragma once
#include <array>
#include "common/common_types.h"
// This is to consolidate system-wide constants that are used by multiple components of yuzu.

View File

@@ -240,7 +240,7 @@ RomFSBuildContext::RomFSBuildContext(VirtualDir base_, VirtualDir ext_)
RomFSBuildContext::~RomFSBuildContext() = default;
std::map<u64, VirtualFile> RomFSBuildContext::Build() {
std::multimap<u64, VirtualFile> RomFSBuildContext::Build() {
const u64 dir_hash_table_entry_count = romfs_get_hash_table_count(num_dirs);
const u64 file_hash_table_entry_count = romfs_get_hash_table_count(num_files);
dir_hash_table_size = 4 * dir_hash_table_entry_count;
@@ -294,7 +294,7 @@ std::map<u64, VirtualFile> RomFSBuildContext::Build() {
cur_dir->parent->child = cur_dir;
}
std::map<u64, VirtualFile> out;
std::multimap<u64, VirtualFile> out;
// Populate file tables.
for (const auto& it : files) {

View File

@@ -43,7 +43,7 @@ public:
~RomFSBuildContext();
// This finalizes the context.
std::map<u64, VirtualFile> Build();
std::multimap<u64, VirtualFile> Build();
private:
VirtualDir base;

View File

@@ -11,7 +11,7 @@
namespace FileSys {
static bool VerifyConcatenationMapContinuity(const std::map<u64, VirtualFile>& map) {
static bool VerifyConcatenationMapContinuity(const std::multimap<u64, VirtualFile>& map) {
const auto last_valid = --map.end();
for (auto iter = map.begin(); iter != last_valid;) {
const auto old = iter++;
@@ -27,12 +27,12 @@ ConcatenatedVfsFile::ConcatenatedVfsFile(std::vector<VirtualFile> files_, std::s
: name(std::move(name)) {
std::size_t next_offset = 0;
for (const auto& file : files_) {
files[next_offset] = file;
files.emplace(next_offset, file);
next_offset += file->GetSize();
}
}
ConcatenatedVfsFile::ConcatenatedVfsFile(std::map<u64, VirtualFile> files_, std::string name)
ConcatenatedVfsFile::ConcatenatedVfsFile(std::multimap<u64, VirtualFile> files_, std::string name)
: files(std::move(files_)), name(std::move(name)) {
ASSERT(VerifyConcatenationMapContinuity(files));
}
@@ -50,7 +50,7 @@ VirtualFile ConcatenatedVfsFile::MakeConcatenatedFile(std::vector<VirtualFile> f
}
VirtualFile ConcatenatedVfsFile::MakeConcatenatedFile(u8 filler_byte,
std::map<u64, VirtualFile> files,
std::multimap<u64, VirtualFile> files,
std::string name) {
if (files.empty())
return nullptr;

View File

@@ -15,7 +15,7 @@ namespace FileSys {
// read-only.
class ConcatenatedVfsFile : public VfsFile {
ConcatenatedVfsFile(std::vector<VirtualFile> files, std::string name);
ConcatenatedVfsFile(std::map<u64, VirtualFile> files, std::string name);
ConcatenatedVfsFile(std::multimap<u64, VirtualFile> files, std::string name);
public:
~ConcatenatedVfsFile() override;
@@ -25,7 +25,7 @@ public:
/// Convenience function that turns a map of offsets to files into a concatenated file, filling
/// gaps with a given filler byte.
static VirtualFile MakeConcatenatedFile(u8 filler_byte, std::map<u64, VirtualFile> files,
static VirtualFile MakeConcatenatedFile(u8 filler_byte, std::multimap<u64, VirtualFile> files,
std::string name);
std::string GetName() const override;
@@ -40,7 +40,7 @@ public:
private:
// Maps starting offset to file -- more efficient.
std::map<u64, VirtualFile> files;
std::multimap<u64, VirtualFile> files;
std::string name;
};

View File

@@ -24,7 +24,6 @@ namespace Kernel {
// Wake up num_to_wake (or all) threads in a vector.
void AddressArbiter::WakeThreads(const std::vector<std::shared_ptr<Thread>>& waiting_threads,
s32 num_to_wake) {
auto& time_manager = system.Kernel().TimeManager();
// Only process up to 'target' threads, unless 'target' is <= 0, in which case process
// them all.
std::size_t last = waiting_threads.size();

View File

@@ -458,9 +458,7 @@ static ResultCode WaitSynchronization(Core::System& system, Handle* index, VAddr
return ERR_OUT_OF_RANGE;
}
auto* const thread = system.CurrentScheduler().GetCurrentThread();
auto& kernel = system.Kernel();
using ObjectPtr = Thread::ThreadSynchronizationObjects::value_type;
Thread::ThreadSynchronizationObjects objects(handle_count);
const auto& handle_table = kernel.CurrentProcess()->GetHandleTable();
@@ -1750,9 +1748,9 @@ static void SignalProcessWideKey(Core::System& system, VAddr condition_variable_
// Only process up to 'target' threads, unless 'target' is less equal 0, in which case process
// them all.
std::size_t last = waiting_threads.size();
if (target > 0)
if (target > 0) {
last = std::min(waiting_threads.size(), static_cast<std::size_t>(target));
auto& time_manager = kernel.TimeManager();
}
for (std::size_t index = 0; index < last; ++index) {
auto& thread = waiting_threads[index];
@@ -1763,7 +1761,6 @@ static void SignalProcessWideKey(Core::System& system, VAddr condition_variable_
const std::size_t current_core = system.CurrentCoreIndex();
auto& monitor = system.Monitor();
auto& memory = system.Memory();
// Atomically read the value of the mutex.
u32 mutex_val = 0;

View File

@@ -19,7 +19,6 @@ Synchronization::Synchronization(Core::System& system) : system{system} {}
void Synchronization::SignalObject(SynchronizationObject& obj) const {
auto& kernel = system.Kernel();
SchedulerLock lock(kernel);
auto& time_manager = kernel.TimeManager();
if (obj.IsSignaled()) {
for (auto thread : obj.GetWaitingThreads()) {
if (thread->GetSchedulingStatus() == ThreadSchedStatus::Paused) {

View File

@@ -583,8 +583,6 @@ private:
void SetCurrentPriority(u32 new_priority);
void AdjustSchedulingOnAffinity(u64 old_affinity_mask, s32 old_core);
Common::SpinLock context_guard{};
ThreadContext32 context_32{};
ThreadContext64 context_64{};

View File

@@ -190,6 +190,15 @@ void DmntCheatVm::LogOpcode(const CheatVmOpcode& opcode) {
callbacks->CommandLog(
fmt::format("Act[{:02X}]: {:d}", i, save_restore_regmask->should_operate[i]));
}
} else if (auto rw_static_reg = std::get_if<ReadWriteStaticRegisterOpcode>(&opcode.opcode)) {
callbacks->CommandLog("Opcode: Read/Write Static Register");
if (rw_static_reg->static_idx < NumReadableStaticRegisters) {
callbacks->CommandLog("Op Type: ReadStaticRegister");
} else {
callbacks->CommandLog("Op Type: WriteStaticRegister");
}
callbacks->CommandLog(fmt::format("Reg Idx {:X}", rw_static_reg->idx));
callbacks->CommandLog(fmt::format("Stc Idx {:X}", rw_static_reg->static_idx));
} else if (auto debug_log = std::get_if<DebugLogOpcode>(&opcode.opcode)) {
callbacks->CommandLog("Opcode: Debug Log");
callbacks->CommandLog(fmt::format("Bit Width: {:X}", debug_log->bit_width));
@@ -544,6 +553,16 @@ bool DmntCheatVm::DecodeNextOpcode(CheatVmOpcode& out) {
}
opcode.opcode = save_restore_regmask;
} break;
case CheatVmOpcodeType::ReadWriteStaticRegister: {
ReadWriteStaticRegisterOpcode rw_static_reg{};
// C3000XXx
// C3 = opcode 0xC3.
// XX = static register index.
// x = register index.
rw_static_reg.static_idx = ((first_dword >> 4) & 0xFF);
rw_static_reg.idx = (first_dword & 0xF);
opcode.opcode = rw_static_reg;
} break;
case CheatVmOpcodeType::DebugLog: {
DebugLogOpcode debug_log{};
// FFFTIX##
@@ -667,6 +686,7 @@ void DmntCheatVm::ResetState() {
registers.fill(0);
saved_values.fill(0);
loop_tops.fill(0);
static_registers.fill(0);
instruction_ptr = 0;
condition_depth = 0;
decode_success = true;
@@ -1153,6 +1173,15 @@ void DmntCheatVm::Execute(const CheatProcessMetadata& metadata) {
}
}
}
} else if (auto rw_static_reg =
std::get_if<ReadWriteStaticRegisterOpcode>(&cur_opcode.opcode)) {
if (rw_static_reg->static_idx < NumReadableStaticRegisters) {
// Load a register with a static register.
registers[rw_static_reg->idx] = static_registers[rw_static_reg->static_idx];
} else {
// Store a register to a static register.
static_registers[rw_static_reg->static_idx] = registers[rw_static_reg->idx];
}
} else if (auto debug_log = std::get_if<DebugLogOpcode>(&cur_opcode.opcode)) {
// Read value from memory.
u64 log_value = 0;

View File

@@ -56,6 +56,7 @@ enum class CheatVmOpcodeType : u32 {
BeginRegisterConditionalBlock = 0xC0,
SaveRestoreRegister = 0xC1,
SaveRestoreRegisterMask = 0xC2,
ReadWriteStaticRegister = 0xC3,
// This is a meta entry, and not a real opcode.
// This is to facilitate multi-nybble instruction decoding.
@@ -237,6 +238,11 @@ struct SaveRestoreRegisterMaskOpcode {
std::array<bool, 0x10> should_operate{};
};
struct ReadWriteStaticRegisterOpcode {
u32 static_idx{};
u32 idx{};
};
struct DebugLogOpcode {
u32 bit_width{};
u32 log_id{};
@@ -259,7 +265,8 @@ struct CheatVmOpcode {
PerformArithmeticStaticOpcode, BeginKeypressConditionalOpcode,
PerformArithmeticRegisterOpcode, StoreRegisterToAddressOpcode,
BeginRegisterConditionalOpcode, SaveRestoreRegisterOpcode,
SaveRestoreRegisterMaskOpcode, DebugLogOpcode, UnrecognizedInstruction>
SaveRestoreRegisterMaskOpcode, ReadWriteStaticRegisterOpcode, DebugLogOpcode,
UnrecognizedInstruction>
opcode{};
};
@@ -281,6 +288,10 @@ public:
static constexpr std::size_t MaximumProgramOpcodeCount = 0x400;
static constexpr std::size_t NumRegisters = 0x10;
static constexpr std::size_t NumReadableStaticRegisters = 0x80;
static constexpr std::size_t NumWritableStaticRegisters = 0x80;
static constexpr std::size_t NumStaticRegisters =
NumReadableStaticRegisters + NumWritableStaticRegisters;
explicit DmntCheatVm(std::unique_ptr<Callbacks> callbacks);
~DmntCheatVm();
@@ -302,6 +313,7 @@ private:
std::array<u32, MaximumProgramOpcodeCount> program{};
std::array<u64, NumRegisters> registers{};
std::array<u64, NumRegisters> saved_values{};
std::array<u64, NumStaticRegisters> static_registers{};
std::array<std::size_t, NumRegisters> loop_tops{};
bool DecodeNextOpcode(CheatVmOpcode& out);

View File

@@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <string_view>
#include "common/file_util.h"
#include "core/core.h"
#include "core/gdbstub/gdbstub.h"
@@ -65,18 +67,18 @@ Values values = {};
bool configuring_global = true;
std::string GetTimeZoneString() {
static constexpr std::array<const char*, 46> timezones{{
static constexpr std::array timezones{
"auto", "default", "CET", "CST6CDT", "Cuba", "EET", "Egypt", "Eire",
"EST", "EST5EDT", "GB", "GB-Eire", "GMT", "GMT+0", "GMT-0", "GMT0",
"Greenwich", "Hongkong", "HST", "Iceland", "Iran", "Israel", "Jamaica", "Japan",
"Kwajalein", "Libya", "MET", "MST", "MST7MDT", "Navajo", "NZ", "NZ-CHAT",
"Poland", "Portugal", "PRC", "PST8PDT", "ROC", "ROK", "Singapore", "Turkey",
"UCT", "Universal", "UTC", "W-SU", "WET", "Zulu",
}};
};
ASSERT(Settings::values.time_zone_index.GetValue() < timezones.size());
return timezones[Settings::values.time_zone_index.GetValue()];
const auto time_zone_index = static_cast<std::size_t>(values.time_zone_index.GetValue());
ASSERT(time_zone_index < timezones.size());
return timezones[time_zone_index];
}
void Apply() {
@@ -91,41 +93,40 @@ void Apply() {
Service::HID::ReloadInputDevices();
}
template <typename T>
void LogSetting(const std::string& name, const T& value) {
LOG_INFO(Config, "{}: {}", name, value);
}
void LogSettings() {
const auto log_setting = [](std::string_view name, const auto& value) {
LOG_INFO(Config, "{}: {}", name, value);
};
LOG_INFO(Config, "yuzu Configuration:");
LogSetting("Controls_UseDockedMode", Settings::values.use_docked_mode);
LogSetting("System_RngSeed", Settings::values.rng_seed.GetValue().value_or(0));
LogSetting("System_CurrentUser", Settings::values.current_user);
LogSetting("System_LanguageIndex", Settings::values.language_index.GetValue());
LogSetting("System_RegionIndex", Settings::values.region_index.GetValue());
LogSetting("System_TimeZoneIndex", Settings::values.time_zone_index.GetValue());
LogSetting("Core_UseMultiCore", Settings::values.use_multi_core.GetValue());
LogSetting("Renderer_UseResolutionFactor", Settings::values.resolution_factor.GetValue());
LogSetting("Renderer_UseFrameLimit", Settings::values.use_frame_limit.GetValue());
LogSetting("Renderer_FrameLimit", Settings::values.frame_limit.GetValue());
LogSetting("Renderer_UseDiskShaderCache", Settings::values.use_disk_shader_cache.GetValue());
LogSetting("Renderer_GPUAccuracyLevel", Settings::values.gpu_accuracy.GetValue());
LogSetting("Renderer_UseAsynchronousGpuEmulation",
Settings::values.use_asynchronous_gpu_emulation.GetValue());
LogSetting("Renderer_UseVsync", Settings::values.use_vsync.GetValue());
LogSetting("Renderer_UseAssemblyShaders", Settings::values.use_assembly_shaders.GetValue());
LogSetting("Renderer_AnisotropicFilteringLevel", Settings::values.max_anisotropy.GetValue());
LogSetting("Audio_OutputEngine", Settings::values.sink_id);
LogSetting("Audio_EnableAudioStretching", Settings::values.enable_audio_stretching.GetValue());
LogSetting("Audio_OutputDevice", Settings::values.audio_device_id);
LogSetting("DataStorage_UseVirtualSd", Settings::values.use_virtual_sd);
LogSetting("DataStorage_NandDir", FileUtil::GetUserPath(FileUtil::UserPath::NANDDir));
LogSetting("DataStorage_SdmcDir", FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir));
LogSetting("Debugging_UseGdbstub", Settings::values.use_gdbstub);
LogSetting("Debugging_GdbstubPort", Settings::values.gdbstub_port);
LogSetting("Debugging_ProgramArgs", Settings::values.program_args);
LogSetting("Services_BCATBackend", Settings::values.bcat_backend);
LogSetting("Services_BCATBoxcatLocal", Settings::values.bcat_boxcat_local);
log_setting("Controls_UseDockedMode", values.use_docked_mode);
log_setting("System_RngSeed", values.rng_seed.GetValue().value_or(0));
log_setting("System_CurrentUser", values.current_user);
log_setting("System_LanguageIndex", values.language_index.GetValue());
log_setting("System_RegionIndex", values.region_index.GetValue());
log_setting("System_TimeZoneIndex", values.time_zone_index.GetValue());
log_setting("Core_UseMultiCore", values.use_multi_core.GetValue());
log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue());
log_setting("Renderer_UseFrameLimit", values.use_frame_limit.GetValue());
log_setting("Renderer_FrameLimit", values.frame_limit.GetValue());
log_setting("Renderer_UseDiskShaderCache", values.use_disk_shader_cache.GetValue());
log_setting("Renderer_GPUAccuracyLevel", values.gpu_accuracy.GetValue());
log_setting("Renderer_UseAsynchronousGpuEmulation",
values.use_asynchronous_gpu_emulation.GetValue());
log_setting("Renderer_UseVsync", values.use_vsync.GetValue());
log_setting("Renderer_UseAssemblyShaders", values.use_assembly_shaders.GetValue());
log_setting("Renderer_AnisotropicFilteringLevel", values.max_anisotropy.GetValue());
log_setting("Audio_OutputEngine", values.sink_id);
log_setting("Audio_EnableAudioStretching", values.enable_audio_stretching.GetValue());
log_setting("Audio_OutputDevice", values.audio_device_id);
log_setting("DataStorage_UseVirtualSd", values.use_virtual_sd);
log_setting("DataStorage_NandDir", FileUtil::GetUserPath(FileUtil::UserPath::NANDDir));
log_setting("DataStorage_SdmcDir", FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir));
log_setting("Debugging_UseGdbstub", values.use_gdbstub);
log_setting("Debugging_GdbstubPort", values.gdbstub_port);
log_setting("Debugging_ProgramArgs", values.program_args);
log_setting("Services_BCATBackend", values.bcat_backend);
log_setting("Services_BCATBoxcatLocal", values.bcat_boxcat_local);
}
float Volume() {

View File

@@ -103,8 +103,9 @@ public:
virtual ~CachedMacro() = default;
/**
* Executes the macro code with the specified input parameters.
* @param code The macro byte code to execute
*
* @param parameters The parameters of the macro
* @param method The method to execute
*/
virtual void Execute(const std::vector<u32>& parameters, u32 method) = 0;
};

View File

@@ -12,13 +12,11 @@ namespace Tegra {
namespace {
// HLE'd functions
static void HLE_771BB18C62444DA0(Engines::Maxwell3D& maxwell3d,
const std::vector<u32>& parameters) {
void HLE_771BB18C62444DA0(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& parameters) {
const u32 instance_count = parameters[2] & maxwell3d.GetRegisterValue(0xD1B);
maxwell3d.regs.draw.topology.Assign(
static_cast<Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology>(parameters[0] &
~(0x3ffffff << 26)));
static_cast<Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology>(parameters[0] & 0x3ffffff));
maxwell3d.regs.vb_base_instance = parameters[5];
maxwell3d.mme_draw.instance_count = instance_count;
maxwell3d.regs.vb_element_base = parameters[3];
@@ -33,8 +31,7 @@ static void HLE_771BB18C62444DA0(Engines::Maxwell3D& maxwell3d,
maxwell3d.mme_draw.current_mode = Engines::Maxwell3D::MMEDrawMode::Undefined;
}
static void HLE_0D61FC9FAAC9FCAD(Engines::Maxwell3D& maxwell3d,
const std::vector<u32>& parameters) {
void HLE_0D61FC9FAAC9FCAD(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& parameters) {
const u32 count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]);
maxwell3d.regs.vertex_buffer.first = parameters[3];
@@ -52,8 +49,7 @@ static void HLE_0D61FC9FAAC9FCAD(Engines::Maxwell3D& maxwell3d,
maxwell3d.mme_draw.current_mode = Engines::Maxwell3D::MMEDrawMode::Undefined;
}
static void HLE_0217920100488FF7(Engines::Maxwell3D& maxwell3d,
const std::vector<u32>& parameters) {
void HLE_0217920100488FF7(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& parameters) {
const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]);
const u32 element_base = parameters[4];
const u32 base_instance = parameters[5];
@@ -81,12 +77,12 @@ static void HLE_0217920100488FF7(Engines::Maxwell3D& maxwell3d,
maxwell3d.CallMethodFromMME(0x8e5, 0x0);
maxwell3d.mme_draw.current_mode = Engines::Maxwell3D::MMEDrawMode::Undefined;
}
} // namespace
} // Anonymous namespace
constexpr std::array<std::pair<u64, HLEFunction>, 3> hle_funcs{{
std::make_pair<u64, HLEFunction>(0x771BB18C62444DA0, &HLE_771BB18C62444DA0),
std::make_pair<u64, HLEFunction>(0x0D61FC9FAAC9FCAD, &HLE_0D61FC9FAAC9FCAD),
std::make_pair<u64, HLEFunction>(0x0217920100488FF7, &HLE_0217920100488FF7),
{0x771BB18C62444DA0, &HLE_771BB18C62444DA0},
{0x0D61FC9FAAC9FCAD, &HLE_0D61FC9FAAC9FCAD},
{0x0217920100488FF7, &HLE_0217920100488FF7},
}};
HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d) : maxwell3d(maxwell3d) {}

View File

@@ -757,14 +757,14 @@ std::vector<VkDeviceQueueCreateInfo> VKDevice::GetDeviceQueueCreateInfos() const
queue_cis.reserve(unique_queue_families.size());
for (const u32 queue_family : unique_queue_families) {
queue_cis.push_back({
auto& ci = queue_cis.emplace_back(VkDeviceQueueCreateInfo{
.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
.pNext = nullptr,
.flags = 0,
.queueFamilyIndex = queue_family,
.queueCount = 1,
.pQueuePriorities = &QUEUE_PRIORITY,
});
ci.queueCount = 1;
ci.pQueuePriorities = &QUEUE_PRIORITY;
}
return queue_cis;

View File

@@ -158,6 +158,7 @@ void StateTracker::Initialize() {
SetupDirtyFrontFace(tables);
SetupDirtyPrimitiveTopology(tables);
SetupDirtyStencilOp(tables);
SetupDirtyStencilTestEnable(tables);
}
void StateTracker::InvalidateCommandBufferState() {

View File

@@ -281,12 +281,10 @@ void CachedSurface::UploadBuffer(const std::vector<u8>& staging_buffer) {
VkBufferMemoryBarrier barrier;
barrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
barrier.pNext = nullptr;
barrier.srcAccessMask = VK_PIPELINE_STAGE_TRANSFER_BIT;
barrier.dstAccessMask = VK_PIPELINE_STAGE_VERTEX_SHADER_BIT;
barrier.srcQueueFamilyIndex = VK_ACCESS_TRANSFER_WRITE_BIT;
barrier.dstQueueFamilyIndex = VK_ACCESS_SHADER_READ_BIT;
barrier.srcQueueFamilyIndex = 0;
barrier.dstQueueFamilyIndex = 0;
barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; // They'll be ignored anyway
barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
barrier.buffer = dst_buffer;
barrier.offset = 0;
barrier.size = size;

View File

@@ -209,11 +209,11 @@ private:
}
// Remove them from the cache
const auto is_removed = [&removed_shaders](std::unique_ptr<T>& shader) {
const auto is_removed = [&removed_shaders](const std::unique_ptr<T>& shader) {
return std::find(removed_shaders.begin(), removed_shaders.end(), shader.get()) !=
removed_shaders.end();
};
storage.erase(std::remove_if(storage.begin(), storage.end(), is_removed), storage.end());
std::erase_if(storage, is_removed);
}
/// @brief Creates a new entry in the lookup cache and returns its pointer