early-access version 1885

This commit is contained in:
pineappleEA 2021-07-17 23:35:12 +02:00
parent 68315794e1
commit ce7fdf3dce
12 changed files with 139 additions and 31 deletions

View file

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

View file

@ -377,7 +377,7 @@ struct Values {
"udp_input_servers"};
BasicSetting<bool> mouse_panning{false, "mouse_panning"};
BasicSetting<u8> mouse_panning_sensitivity{1, "mouse_panning_sensitivity"};
BasicSetting<u8> mouse_panning_sensitivity{10, "mouse_panning_sensitivity"};
BasicSetting<bool> mouse_enabled{false, "mouse_enabled"};
std::string mouse_device;
MouseButtonsRaw mouse_buttons;

View file

@ -87,6 +87,10 @@ void Controller::Initialize() {
case sizeof(ControllerUpdateFirmwareArg):
controller_private_arg.mode = ControllerSupportMode::ShowControllerFirmwareUpdate;
break;
case sizeof(ControllerKeyRemappingArg):
controller_private_arg.mode =
ControllerSupportMode::ShowControllerKeyRemappingForSystem;
break;
default:
UNIMPLEMENTED_MSG("Unknown ControllerPrivateArg mode={} with arg_size={}",
controller_private_arg.mode, controller_private_arg.arg_size);
@ -99,7 +103,9 @@ void Controller::Initialize() {
// This is always 0 (Application) except with ShowControllerFirmwareUpdateForSystem.
if (controller_private_arg.caller >= ControllerSupportCaller::MaxControllerSupportCaller) {
if (controller_private_arg.flag_1 &&
controller_private_arg.mode == ControllerSupportMode::ShowControllerFirmwareUpdate) {
(controller_private_arg.mode == ControllerSupportMode::ShowControllerFirmwareUpdate ||
controller_private_arg.mode ==
ControllerSupportMode::ShowControllerKeyRemappingForSystem)) {
controller_private_arg.caller = ControllerSupportCaller::System;
} else {
controller_private_arg.caller = ControllerSupportCaller::Application;
@ -121,6 +127,7 @@ void Controller::Initialize() {
std::memcpy(&controller_user_arg_old, user_arg.data(), user_arg.size());
break;
case ControllerAppletVersion::Version7:
case ControllerAppletVersion::Version8:
ASSERT(user_arg.size() == sizeof(ControllerSupportArgNew));
std::memcpy(&controller_user_arg_new, user_arg.data(), user_arg.size());
break;
@ -143,6 +150,16 @@ void Controller::Initialize() {
std::memcpy(&controller_update_arg, update_arg.data(), update_arg.size());
break;
}
case ControllerSupportMode::ShowControllerKeyRemappingForSystem: {
const auto remapping_arg_storage = broker.PopNormalDataToApplet();
ASSERT(remapping_arg_storage != nullptr);
const auto& remapping_arg = remapping_arg_storage->GetData();
ASSERT(remapping_arg.size() == sizeof(ControllerKeyRemappingArg));
std::memcpy(&controller_key_remapping_arg, remapping_arg.data(), remapping_arg.size());
break;
}
default: {
UNIMPLEMENTED_MSG("Unimplemented ControllerSupportMode={}", controller_private_arg.mode);
break;
@ -179,6 +196,7 @@ void Controller::Execute() {
std::vector<ExplainText>(controller_user_arg_old.explain_text.begin(),
controller_user_arg_old.explain_text.end()));
case ControllerAppletVersion::Version7:
case ControllerAppletVersion::Version8:
default:
return ConvertToFrontendParameters(
controller_private_arg, controller_user_arg_new.header,
@ -210,6 +228,7 @@ void Controller::Execute() {
}
case ControllerSupportMode::ShowControllerStrapGuide:
case ControllerSupportMode::ShowControllerFirmwareUpdate:
case ControllerSupportMode::ShowControllerKeyRemappingForSystem:
UNIMPLEMENTED_MSG("ControllerSupportMode={} is not implemented",
controller_private_arg.mode);
ConfigurationComplete();

View file

@ -25,13 +25,15 @@ enum class ControllerAppletVersion : u32_le {
Version3 = 0x3, // 1.0.0 - 2.3.0
Version4 = 0x4, // 3.0.0 - 5.1.0
Version5 = 0x5, // 6.0.0 - 7.0.1
Version7 = 0x7, // 8.0.0+
Version7 = 0x7, // 8.0.0 - 10.2.0
Version8 = 0x8, // 11.0.0+
};
enum class ControllerSupportMode : u8 {
ShowControllerSupport,
ShowControllerStrapGuide,
ShowControllerFirmwareUpdate,
ShowControllerKeyRemappingForSystem,
MaxControllerSupportMode,
};
@ -95,6 +97,14 @@ struct ControllerUpdateFirmwareArg {
static_assert(sizeof(ControllerUpdateFirmwareArg) == 0x4,
"ControllerUpdateFirmwareArg has incorrect size.");
struct ControllerKeyRemappingArg {
u64 unknown{};
u32 unknown_2{};
INSERT_PADDING_WORDS(1);
};
static_assert(sizeof(ControllerKeyRemappingArg) == 0x10,
"ControllerKeyRemappingArg has incorrect size.");
struct ControllerSupportResultInfo {
s8 player_count{};
INSERT_PADDING_BYTES(3);
@ -128,6 +138,7 @@ private:
ControllerSupportArgOld controller_user_arg_old;
ControllerSupportArgNew controller_user_arg_new;
ControllerUpdateFirmwareArg controller_update_arg;
ControllerKeyRemappingArg controller_key_remapping_arg;
bool complete{false};
ResultCode status{ResultSuccess};
bool is_single_mode{false};

View file

@ -84,7 +84,7 @@ public:
std::lock_guard lock{mutex};
const auto axis_value =
static_cast<float>(mouse_input->GetMouseState(button).axis.at(axis));
const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue() * 0.15f;
const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue() * 0.10f;
return axis_value * sensitivity / (100.0f * range);
}

View file

@ -13,12 +13,10 @@ namespace Shader::Backend::GLSL {
namespace {
void Compare(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs,
std::string_view op, bool ordered) {
ctx.AddU1("{}={}{}{}", inst, lhs, op, rhs, lhs, rhs);
if (ordered) {
ctx.Add("&&!isnan({})&&!isnan({});", lhs, rhs);
} else {
ctx.Add("||isnan({})||isnan({});", lhs, rhs);
}
const auto nan_op{ordered ? "&&!" : "||"};
ctx.AddU1("{}={}{}{}"
"{}isnan({}){}isnan({});",
inst, lhs, op, rhs, nan_op, lhs, nan_op, rhs);
}
bool IsPrecise(const IR::Inst& inst) {

View file

@ -300,7 +300,7 @@ Id EmitGetAttribute(EmitContext& ctx, IR::Attribute attr, Id vertex) {
const std::optional<AttrInfo> type{AttrTypes(ctx, index)};
if (!type) {
// Attribute is disabled
return ctx.Const(0.0f);
return ctx.Const(element == 3 ? 1.0f : 0.0f);
}
if (!ctx.runtime_info.previous_stage_stores.Generic(index, element)) {
// Varying component is not written

View file

@ -172,16 +172,14 @@ Device::Device() {
// uniform buffers as "push constants"
has_fast_buffer_sub_data = is_nvidia && !disable_fast_buffer_sub_data;
use_assembly_shaders =
Settings::values.shader_backend.GetValue() == Settings::ShaderBackend::GLASM &&
GLAD_GL_NV_gpu_program5 && GLAD_GL_NV_compute_program5 && GLAD_GL_NV_transform_feedback &&
GLAD_GL_NV_transform_feedback2;
shader_backend = (Settings::values.shader_backend.GetValue() ==
Settings::ShaderBackend::GLASM) == use_assembly_shaders
? Settings::values.shader_backend.GetValue()
: Settings::ShaderBackend::GLSL;
shader_backend = Settings::values.shader_backend.GetValue();
use_assembly_shaders = shader_backend == Settings::ShaderBackend::GLASM &&
GLAD_GL_NV_gpu_program5 && GLAD_GL_NV_compute_program5 &&
GLAD_GL_NV_transform_feedback && GLAD_GL_NV_transform_feedback2;
if (shader_backend == Settings::ShaderBackend::GLASM && !use_assembly_shaders) {
LOG_ERROR(Render_OpenGL, "Assembly shaders enabled but not supported");
shader_backend = Settings::ShaderBackend::GLSL;
}
// Completely disable async shaders for now, as it causes graphical glitches
use_asynchronous_shaders = false;
// Blocks AMD and Intel OpenGL drivers on Windows from using asynchronous shader compilation.
@ -194,11 +192,6 @@ Device::Device() {
LOG_INFO(Render_OpenGL, "Renderer_PreciseBug: {}", has_precise_bug);
LOG_INFO(Render_OpenGL, "Renderer_BrokenTextureViewFormats: {}",
has_broken_texture_view_formats);
if (shader_backend == Settings::ShaderBackend::GLASM && !use_assembly_shaders) {
LOG_ERROR(Render_OpenGL, "Assembly shaders enabled but not supported");
}
if (Settings::values.use_asynchronous_shaders.GetValue() && !use_asynchronous_shaders) {
LOG_WARNING(Render_OpenGL, "Asynchronous shader compilation enabled but not supported");
}

View file

@ -145,7 +145,7 @@ RendererOpenGL::RendererOpenGL(Core::TelemetrySession& telemetry_session_,
GLint max_attribs{};
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &max_attribs);
for (GLint attrib = 0; attrib < max_attribs; ++attrib) {
glVertexAttrib4f(attrib, 0.0f, 0.0f, 0.0f, 0.0f);
glVertexAttrib4f(attrib, 0.0f, 0.0f, 0.0f, 1.0f);
}
// Enable seamless cubemaps when per texture parameters are not available
if (!GLAD_GL_ARB_seamless_cubemap_per_texture && !GLAD_GL_AMD_seamless_cubemap_per_texture) {

View file

@ -412,8 +412,9 @@ void GRenderWindow::mousePressEvent(QMouseEvent* event) {
if (event->source() == Qt::MouseEventSynthesizedBySystem) {
return;
}
auto pos = event->pos();
// Qt sometimes returns the parent coordinates. To avoid this we read the global mouse
// coordinates and map them to the current render area
const auto pos = mapFromGlobal(QCursor::pos());
const auto [x, y] = ScaleTouch(pos);
const auto button = QtButtonToMouseButton(event->button());
input_subsystem->GetMouse()->PressButton(x, y, button);
@ -430,7 +431,9 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
if (event->source() == Qt::MouseEventSynthesizedBySystem) {
return;
}
auto pos = event->pos();
// Qt sometimes returns the parent coordinates. To avoid this we read the global mouse
// coordinates and map them to the current render area
const auto pos = mapFromGlobal(QCursor::pos());
const auto [x, y] = ScaleTouch(pos);
const int center_x = width() / 2;
const int center_y = height() / 2;
@ -565,6 +568,12 @@ std::unique_ptr<Core::Frontend::GraphicsContext> GRenderWindow::CreateSharedCont
bool GRenderWindow::InitRenderTarget() {
ReleaseRenderTarget();
{
// Create a dummy render widget so that Qt
// places the render window at the correct position.
const RenderWidget dummy_widget{this};
}
first_frame = false;
switch (Settings::values.renderer_backend.GetValue()) {

View file

@ -322,8 +322,16 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
this, tr("Set threshold"), tr("Choose a value between 0% and 100%"),
button_threshold, 0, 100);
buttons_param[button_id].Set("threshold", new_threshold / 100.0f);
if (button_id == Settings::NativeButton::ZL) {
ui->sliderZLThreshold->setValue(new_threshold);
}
if (button_id == Settings::NativeButton::ZR) {
ui->sliderZRThreshold->setValue(new_threshold);
}
});
}
context_menu.exec(button_map[button_id]->mapToGlobal(menu_location));
ui->controllerFrame->SetPlayerInput(player_index, buttons_param, analogs_param);
});
@ -352,6 +360,20 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
});
}
connect(ui->sliderZLThreshold, &QSlider::valueChanged, [=, this] {
if (buttons_param[Settings::NativeButton::ZL].Has("threshold")) {
const auto slider_value = ui->sliderZLThreshold->value();
buttons_param[Settings::NativeButton::ZL].Set("threshold", slider_value / 100.0f);
}
});
connect(ui->sliderZRThreshold, &QSlider::valueChanged, [=, this] {
if (buttons_param[Settings::NativeButton::ZR].Has("threshold")) {
const auto slider_value = ui->sliderZRThreshold->value();
buttons_param[Settings::NativeButton::ZR].Set("threshold", slider_value / 100.0f);
}
});
for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; ++analog_id) {
for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; ++sub_button_id) {
auto* const analog_button = analog_map_buttons[analog_id][sub_button_id];
@ -860,6 +882,18 @@ void ConfigureInputPlayer::UpdateUI() {
button_map[button]->setText(ButtonToText(buttons_param[button]));
}
if (buttons_param[Settings::NativeButton::ZL].Has("threshold")) {
const int button_threshold = static_cast<int>(
buttons_param[Settings::NativeButton::ZL].Get("threshold", 0.5f) * 100.0f);
ui->sliderZLThreshold->setValue(button_threshold);
}
if (buttons_param[Settings::NativeButton::ZR].Has("threshold")) {
const int button_threshold = static_cast<int>(
buttons_param[Settings::NativeButton::ZR].Get("threshold", 0.5f) * 100.0f);
ui->sliderZRThreshold->setValue(button_threshold);
}
for (int motion_id = 0; motion_id < Settings::NativeMotion::NumMotions; ++motion_id) {
motion_map[motion_id]->setText(ButtonToText(motions_param[motion_id]));
}

View file

@ -1334,6 +1334,12 @@
</item>
<item>
<widget class="QGroupBox" name="buttonShoulderButtonsButtonZLGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>ZL</string>
</property>
@ -1378,6 +1384,22 @@
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="sliderZLThreshold">
<property name="maximumSize">
<size>
<width>70</width>
<height>15</height>
</size>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -1759,6 +1781,12 @@
</item>
<item>
<widget class="QGroupBox" name="buttonShoulderButtonsZRGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>ZR</string>
</property>
@ -1803,6 +1831,22 @@
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="sliderZRThreshold">
<property name="maximumSize">
<size>
<width>70</width>
<height>15</height>
</size>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>