early-access version 1390

This commit is contained in:
pineappleEA 2021-01-28 19:16:34 +01:00
parent 817df4ca70
commit ef74ce8ba1
10 changed files with 109 additions and 69 deletions

View File

@ -1,7 +1,7 @@
yuzu emulator early access
=============
This is the source code for early-access 1387.
This is the source code for early-access 1390.
## Legal Notice

View File

@ -110,7 +110,6 @@ struct UserCallbacks {
virtual void ExceptionRaised(VAddr pc, Exception exception) = 0;
virtual void DataCacheOperationRaised(DataCacheOperation /*op*/, VAddr /*value*/) {}
virtual void InstructionSynchronizationBarrierRaised() {}
// Timing-related callbacks
// ticks ticks have passed
@ -154,11 +153,6 @@ struct UserConfig {
/// Executing DC ZVA in this mode will result in zeros being written to memory.
bool hook_data_cache_operations = false;
/// When set to true, UserCallbacks::InstructionSynchronizationBarrierRaised will be
/// called when an ISB instruction is executed.
/// When set to false, ISB will be treated as a NOP instruction.
bool hook_isb = false;
/// When set to true, UserCallbacks::ExceptionRaised will be called when any hint
/// instruction is executed.
bool hook_hint_instructions = false;

View File

@ -660,12 +660,10 @@ void A64EmitX64::EmitA64DataMemoryBarrier(A64EmitContext&, IR::Inst*) {
}
void A64EmitX64::EmitA64InstructionSynchronizationBarrier(A64EmitContext& ctx, IR::Inst* ) {
if (!conf.hook_isb) {
return;
}
ctx.reg_alloc.HostCall(nullptr);
Devirtualize<&A64::UserCallbacks::InstructionSynchronizationBarrierRaised>(conf.callbacks).EmitCall(code);
code.mov(code.ABI_PARAM1, reinterpret_cast<u64>(jit_interface));
code.CallLambda([](A64::Jit* jit) { jit->ClearCache(); });
}
void A64EmitX64::EmitA64GetCNTFRQ(A64EmitContext& ctx, IR::Inst* inst) {

View File

@ -338,6 +338,28 @@ std::size_t HLERequestContext::GetWriteBufferSize(std::size_t buffer_index) cons
return 0;
}
bool HLERequestContext::CanReadBuffer(std::size_t buffer_index) const {
const bool is_buffer_a{BufferDescriptorA().size() > buffer_index &&
BufferDescriptorA()[buffer_index].Size()};
if (is_buffer_a) {
return BufferDescriptorA().size() > buffer_index;
} else {
return BufferDescriptorX().size() > buffer_index;
}
}
bool HLERequestContext::CanWriteBuffer(std::size_t buffer_index) const {
const bool is_buffer_b{BufferDescriptorB().size() > buffer_index &&
BufferDescriptorB()[buffer_index].Size()};
if (is_buffer_b) {
return BufferDescriptorB().size() > buffer_index;
} else {
return BufferDescriptorC().size() > buffer_index;
}
}
std::string HLERequestContext::Description() const {
if (!command_header) {
return "No command header available";

View File

@ -204,6 +204,12 @@ public:
/// Helper function to get the size of the output buffer
std::size_t GetWriteBufferSize(std::size_t buffer_index = 0) const;
/// Helper function to test whether the input buffer at buffer_index can be read
bool CanReadBuffer(std::size_t buffer_index = 0) const;
/// Helper function to test whether the output buffer at buffer_index can be written
bool CanWriteBuffer(std::size_t buffer_index = 0) const;
template <typename T>
std::shared_ptr<T> GetCopyObject(std::size_t index) {
return DynamicObjectCast<T>(copy_objects.at(index));

View File

@ -946,20 +946,19 @@ void Controller_NPad::SetSixAxisEnabled(bool six_axis_status) {
sixaxis_sensors_enabled = six_axis_status;
}
void Controller_NPad::SetSixAxisFusionParameters(const DeviceHandle& handle, f32 parameter1,
f32 parameter2) {
void Controller_NPad::SetSixAxisFusionParameters(f32 parameter1, f32 parameter2) {
sixaxis_fusion_parameter1 = parameter1;
sixaxis_fusion_parameter2 = parameter2;
}
std::pair<f32, f32> Controller_NPad::GetSixAxisFusionParameters(const DeviceHandle& handle) {
std::pair<f32, f32> Controller_NPad::GetSixAxisFusionParameters() {
return {
sixaxis_fusion_parameter1,
sixaxis_fusion_parameter2,
};
}
void Controller_NPad::ResetSixAxisFusionParameters(const DeviceHandle& handle) {
void Controller_NPad::ResetSixAxisFusionParameters() {
sixaxis_fusion_parameter1 = 0.0f;
sixaxis_fusion_parameter2 = 0.0f;
}

View File

@ -202,9 +202,9 @@ public:
GyroscopeZeroDriftMode GetGyroscopeZeroDriftMode() const;
bool IsSixAxisSensorAtRest() const;
void SetSixAxisEnabled(bool six_axis_status);
void SetSixAxisFusionParameters(const DeviceHandle& handle, f32 parameter1, f32 parameter2);
std::pair<f32, f32> GetSixAxisFusionParameters(const DeviceHandle& handle);
void ResetSixAxisFusionParameters(const DeviceHandle& handle);
void SetSixAxisFusionParameters(f32 parameter1, f32 parameter2);
std::pair<f32, f32> GetSixAxisFusionParameters();
void ResetSixAxisFusionParameters();
LedPattern GetLedPattern(u32 npad_id);
bool IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const;
void SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled, u32 npad_id);

View File

@ -520,6 +520,7 @@ void Hid::EnableSixAxisSensorFusion(Kernel::HLERequestContext& ctx) {
Controller_NPad::DeviceHandle sixaxis_handle;
u64 applet_resource_user_id;
};
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
const auto parameters{rp.PopRaw<Parameters>()};
@ -542,19 +543,19 @@ void Hid::SetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) {
f32 parameter2;
u64 applet_resource_user_id;
};
static_assert(sizeof(Parameters) == 0x18, "Parameters has incorrect size.");
const auto parameters{rp.PopRaw<Parameters>()};
applet_resource->GetController<Controller_NPad>(HidController::NPad)
.SetSixAxisFusionParameters(parameters.sixaxis_handle, parameters.parameter1,
parameters.parameter2);
.SetSixAxisFusionParameters(parameters.parameter1, parameters.parameter2);
LOG_WARNING(Service_HID,
"(STUBBED) called, float1={}, float2={}, npad_type={}, npad_id={}, "
"device_index={}, applet_resource_user_id={}",
parameters.parameter1, parameters.parameter2, parameters.sixaxis_handle.npad_type,
parameters.sixaxis_handle.npad_id, parameters.sixaxis_handle.device_index,
parameters.applet_resource_user_id);
"(STUBBED) called, npad_type={}, npad_id={}, device_index={}, parameter1={}, "
"parameter2={}, applet_resource_user_id={}",
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
parameters.sixaxis_handle.device_index, parameters.parameter1,
parameters.parameter2, parameters.applet_resource_user_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
@ -566,6 +567,7 @@ void Hid::GetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) {
Controller_NPad::DeviceHandle sixaxis_handle;
u64 applet_resource_user_id;
};
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
f32 parameter1 = 0;
f32 parameter2 = 0;
@ -573,11 +575,11 @@ void Hid::GetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) {
std::tie(parameter1, parameter2) =
applet_resource->GetController<Controller_NPad>(HidController::NPad)
.GetSixAxisFusionParameters(parameters.sixaxis_handle);
.GetSixAxisFusionParameters();
LOG_WARNING(Service_HID,
"(STUBBED) called, npad_type={}, npad_id={}, "
"device_index={}, applet_resource_user_id={}",
LOG_WARNING(
Service_HID,
"(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}",
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id);
@ -593,15 +595,16 @@ void Hid::ResetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) {
Controller_NPad::DeviceHandle sixaxis_handle;
u64 applet_resource_user_id;
};
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
const auto parameters{rp.PopRaw<Parameters>()};
applet_resource->GetController<Controller_NPad>(HidController::NPad)
.ResetSixAxisFusionParameters(parameters.sixaxis_handle);
.ResetSixAxisFusionParameters();
LOG_WARNING(Service_HID,
"(STUBBED) called, npad_type={}, npad_id={}, "
"device_index={}, applet_resource_user_id={}",
LOG_WARNING(
Service_HID,
"(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}",
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id);

View File

@ -23,8 +23,8 @@ public:
{10101, &PlayReport::SaveReportWithUser<Core::Reporter::PlayReportType::Old>, "SaveReportWithUserOld"},
{10102, &PlayReport::SaveReport<Core::Reporter::PlayReportType::Old2>, "SaveReportOld2"},
{10103, &PlayReport::SaveReportWithUser<Core::Reporter::PlayReportType::Old2>, "SaveReportWithUserOld2"},
{10104, nullptr, "SaveReport"},
{10105, nullptr, "SaveReportWithUser"},
{10104, &PlayReport::SaveReport<Core::Reporter::PlayReportType::New>, "SaveReport"},
{10105, &PlayReport::SaveReportWithUser<Core::Reporter::PlayReportType::New>, "SaveReportWithUser"},
{10200, nullptr, "RequestImmediateTransmission"},
{10300, nullptr, "GetTransmissionStatus"},
{10400, nullptr, "GetSystemSessionId"},
@ -59,16 +59,22 @@ private:
IPC::RequestParser rp{ctx};
const auto process_id = rp.PopRaw<u64>();
std::vector<std::vector<u8>> data{ctx.ReadBuffer(0)};
if constexpr (Type == Core::Reporter::PlayReportType::Old2) {
data.emplace_back(ctx.ReadBuffer(1));
const auto data1 = ctx.ReadBuffer(0);
const auto data2 = [ctx] {
if (ctx.CanReadBuffer(1)) {
return ctx.ReadBuffer(1);
}
LOG_DEBUG(Service_PREPO, "called, type={:02X}, process_id={:016X}, data1_size={:016X}",
Type, process_id, data[0].size());
return std::vector<u8>{};
}();
LOG_DEBUG(Service_PREPO,
"called, type={:02X}, process_id={:016X}, data1_size={:016X}, data2_size={:016X}",
Type, process_id, data1.size(), data2.size());
const auto& reporter{system.GetReporter()};
reporter.SavePlayReport(Type, system.CurrentProcess()->GetTitleID(), data, process_id);
reporter.SavePlayReport(Type, system.CurrentProcess()->GetTitleID(), {data1, data2},
process_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
@ -79,24 +85,24 @@ private:
IPC::RequestParser rp{ctx};
const auto user_id = rp.PopRaw<u128>();
const auto process_id = rp.PopRaw<u64>();
std::vector<std::vector<u8>> data{ctx.ReadBuffer(0)};
if constexpr (Type == Core::Reporter::PlayReportType::Old2) {
const auto read_buffer_count =
ctx.BufferDescriptorX().size() + ctx.BufferDescriptorA().size();
if (read_buffer_count > 1) {
data.emplace_back(ctx.ReadBuffer(1));
}
const auto data1 = ctx.ReadBuffer(0);
const auto data2 = [ctx] {
if (ctx.CanReadBuffer(1)) {
return ctx.ReadBuffer(1);
}
LOG_DEBUG(
Service_PREPO,
"called, type={:02X}, user_id={:016X}{:016X}, process_id={:016X}, data1_size={:016X}",
Type, user_id[1], user_id[0], process_id, data[0].size());
return std::vector<u8>{};
}();
LOG_DEBUG(Service_PREPO,
"called, type={:02X}, user_id={:016X}{:016X}, process_id={:016X}, "
"data1_size={:016X}, data2_size={:016X}",
Type, user_id[1], user_id[0], process_id, data1.size(), data2.size());
const auto& reporter{system.GetReporter()};
reporter.SavePlayReport(Type, system.CurrentProcess()->GetTitleID(), data, process_id,
user_id);
reporter.SavePlayReport(Type, system.CurrentProcess()->GetTitleID(), {data1, data2},
process_id, user_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
@ -107,7 +113,13 @@ private:
const auto title_id = rp.PopRaw<u64>();
const auto data1 = ctx.ReadBuffer(0);
const auto data2 = ctx.ReadBuffer(1);
const auto data2 = [ctx] {
if (ctx.CanReadBuffer(1)) {
return ctx.ReadBuffer(1);
}
return std::vector<u8>{};
}();
LOG_DEBUG(Service_PREPO, "called, title_id={:016X}, data1_size={:016X}, data2_size={:016X}",
title_id, data1.size(), data2.size());
@ -125,7 +137,13 @@ private:
const auto title_id = rp.PopRaw<u64>();
const auto data1 = ctx.ReadBuffer(0);
const auto data2 = ctx.ReadBuffer(1);
const auto data2 = [ctx] {
if (ctx.CanReadBuffer(1)) {
return ctx.ReadBuffer(1);
}
return std::vector<u8>{};
}();
LOG_DEBUG(Service_PREPO,
"called, user_id={:016X}{:016X}, title_id={:016X}, data1_size={:016X}, "

View File

@ -6,10 +6,12 @@
#include <atomic>
#include <condition_variable>
#include <cstddef>
#include <memory>
#include <stack>
#include <thread>
#include <utility>
#include "common/alignment.h"
#include "common/common_types.h"
#include "common/threadsafe_queue.h"
#include "video_core/renderer_vulkan/vk_master_semaphore.h"
@ -136,12 +138,11 @@ private:
using FuncType = TypedCommand<T>;
static_assert(sizeof(FuncType) < sizeof(data), "Lambda is too large");
command_offset = Common::AlignUp(command_offset, alignof(FuncType));
if (command_offset > sizeof(data) - sizeof(FuncType)) {
return false;
}
Command* current_last = last;
Command* const current_last = last;
last = new (data.data() + command_offset) FuncType(std::move(command));
if (current_last) {
@ -149,7 +150,6 @@ private:
} else {
first = last;
}
command_offset += sizeof(FuncType);
return true;
}
@ -162,8 +162,8 @@ private:
Command* first = nullptr;
Command* last = nullptr;
std::size_t command_offset = 0;
std::array<u8, 0x8000> data{};
size_t command_offset = 0;
alignas(std::max_align_t) std::array<u8, 0x8000> data{};
};
struct State {