early-access version 1942

This commit is contained in:
pineappleEA 2021-07-29 21:34:06 +02:00
parent 21ca602747
commit 80ad76aa9e
11 changed files with 44 additions and 49 deletions

View file

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

View file

@ -18,7 +18,7 @@ UUID UUID::Generate() {
} }
std::string UUID::Format() const { std::string UUID::Format() const {
return fmt::format("0x{:016X}{:016X}", uuid[1], uuid[0]); return fmt::format("{:016x}{:016x}", uuid[1], uuid[0]);
} }
std::string UUID::FormatSwitch() const { std::string UUID::FormatSwitch() const {

View file

@ -292,7 +292,7 @@ public:
protected: protected:
void Get(Kernel::HLERequestContext& ctx) { void Get(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format()); LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format());
ProfileBase profile_base{}; ProfileBase profile_base{};
ProfileData data{}; ProfileData data{};
if (profile_manager.GetProfileBaseAndData(user_id, profile_base, data)) { if (profile_manager.GetProfileBaseAndData(user_id, profile_base, data)) {
@ -301,7 +301,7 @@ protected:
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
rb.PushRaw(profile_base); rb.PushRaw(profile_base);
} else { } else {
LOG_ERROR(Service_ACC, "Failed to get profile base and data for user={}", LOG_ERROR(Service_ACC, "Failed to get profile base and data for user=0x{}",
user_id.Format()); user_id.Format());
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code
@ -309,14 +309,14 @@ protected:
} }
void GetBase(Kernel::HLERequestContext& ctx) { void GetBase(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format()); LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format());
ProfileBase profile_base{}; ProfileBase profile_base{};
if (profile_manager.GetProfileBase(user_id, profile_base)) { if (profile_manager.GetProfileBase(user_id, profile_base)) {
IPC::ResponseBuilder rb{ctx, 16}; IPC::ResponseBuilder rb{ctx, 16};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
rb.PushRaw(profile_base); rb.PushRaw(profile_base);
} else { } else {
LOG_ERROR(Service_ACC, "Failed to get profile base for user={}", user_id.Format()); LOG_ERROR(Service_ACC, "Failed to get profile base for user=0x{}", user_id.Format());
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code
} }
@ -372,7 +372,7 @@ protected:
const auto user_data = ctx.ReadBuffer(); const auto user_data = ctx.ReadBuffer();
LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid={}", LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid=0x{}",
Common::StringFromFixedZeroTerminatedBuffer( Common::StringFromFixedZeroTerminatedBuffer(
reinterpret_cast<const char*>(base.username.data()), base.username.size()), reinterpret_cast<const char*>(base.username.data()), base.username.size()),
base.timestamp, base.user_uuid.Format()); base.timestamp, base.user_uuid.Format());
@ -405,7 +405,7 @@ protected:
const auto user_data = ctx.ReadBuffer(); const auto user_data = ctx.ReadBuffer();
const auto image_data = ctx.ReadBuffer(1); const auto image_data = ctx.ReadBuffer(1);
LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid={}", LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid=0x{}",
Common::StringFromFixedZeroTerminatedBuffer( Common::StringFromFixedZeroTerminatedBuffer(
reinterpret_cast<const char*>(base.username.data()), base.username.size()), reinterpret_cast<const char*>(base.username.data()), base.username.size()),
base.timestamp, base.user_uuid.Format()); base.timestamp, base.user_uuid.Format());
@ -662,7 +662,7 @@ void Module::Interface::GetUserCount(Kernel::HLERequestContext& ctx) {
void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) { void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
Common::UUID user_id = rp.PopRaw<Common::UUID>(); Common::UUID user_id = rp.PopRaw<Common::UUID>();
LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format()); LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format());
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
@ -693,7 +693,7 @@ void Module::Interface::GetLastOpenedUser(Kernel::HLERequestContext& ctx) {
void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) { void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
Common::UUID user_id = rp.PopRaw<Common::UUID>(); Common::UUID user_id = rp.PopRaw<Common::UUID>();
LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format()); LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format());
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
@ -802,7 +802,7 @@ void Module::Interface::GetProfileEditor(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
Common::UUID user_id = rp.PopRaw<Common::UUID>(); Common::UUID user_id = rp.PopRaw<Common::UUID>();
LOG_DEBUG(Service_ACC, "called, user_id={}", user_id.Format()); LOG_DEBUG(Service_ACC, "called, user_id=0x{}", user_id.Format());
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
@ -844,7 +844,7 @@ void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestCont
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const auto uuid = rp.PopRaw<Common::UUID>(); const auto uuid = rp.PopRaw<Common::UUID>();
LOG_WARNING(Service_ACC, "(STUBBED) called, uuid={}", uuid.Format()); LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}", uuid.Format());
// TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable // TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable
// way of confirming things like the TID, we're going to assume a non zero value for the time // way of confirming things like the TID, we're going to assume a non zero value for the time
@ -858,7 +858,7 @@ void Module::Interface::StoreSaveDataThumbnailSystem(Kernel::HLERequestContext&
const auto uuid = rp.PopRaw<Common::UUID>(); const auto uuid = rp.PopRaw<Common::UUID>();
const auto tid = rp.Pop<u64_le>(); const auto tid = rp.Pop<u64_le>();
LOG_WARNING(Service_ACC, "(STUBBED) called, uuid={}, tid={:016X}", uuid.Format(), tid); LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}, tid={:016X}", uuid.Format(), tid);
StoreSaveDataThumbnail(ctx, uuid, tid); StoreSaveDataThumbnail(ctx, uuid, tid);
} }

View file

@ -158,7 +158,7 @@ private:
const auto local_play = rp.Pop<bool>(); const auto local_play = rp.Pop<bool>();
const auto uuid = rp.PopRaw<Common::UUID>(); const auto uuid = rp.PopRaw<Common::UUID>();
LOG_WARNING(Service_Friend, "(STUBBED) called local_play={} uuid={}", local_play, LOG_WARNING(Service_Friend, "(STUBBED) called, local_play={}, uuid=0x{}", local_play,
uuid.Format()); uuid.Format());
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
@ -171,7 +171,7 @@ private:
const auto uuid = rp.PopRaw<Common::UUID>(); const auto uuid = rp.PopRaw<Common::UUID>();
[[maybe_unused]] const auto filter = rp.PopRaw<SizedFriendFilter>(); [[maybe_unused]] const auto filter = rp.PopRaw<SizedFriendFilter>();
const auto pid = rp.Pop<u64>(); const auto pid = rp.Pop<u64>();
LOG_WARNING(Service_Friend, "(STUBBED) called, offset={}, uuid={}, pid={}", friend_offset, LOG_WARNING(Service_Friend, "(STUBBED) called, offset={}, uuid=0x{}, pid={}", friend_offset,
uuid.Format(), pid); uuid.Format(), pid);
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
@ -289,7 +289,7 @@ void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
auto uuid = rp.PopRaw<Common::UUID>(); auto uuid = rp.PopRaw<Common::UUID>();
LOG_DEBUG(Service_Friend, "called, uuid={}", uuid.Format()); LOG_DEBUG(Service_Friend, "called, uuid=0x{}", uuid.Format());
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);

View file

@ -344,8 +344,10 @@ std::optional<ApplicationLanguage> ConvertToApplicationLanguage(
return ApplicationLanguage::Russian; return ApplicationLanguage::Russian;
case Set::LanguageCode::KO: case Set::LanguageCode::KO:
return ApplicationLanguage::Korean; return ApplicationLanguage::Korean;
case Set::LanguageCode::ZH_TW:
case Set::LanguageCode::ZH_HANT: case Set::LanguageCode::ZH_HANT:
return ApplicationLanguage::TraditionalChinese; return ApplicationLanguage::TraditionalChinese;
case Set::LanguageCode::ZH_CN:
case Set::LanguageCode::ZH_HANS: case Set::LanguageCode::ZH_HANS:
return ApplicationLanguage::SimplifiedChinese; return ApplicationLanguage::SimplifiedChinese;
default: default:

View file

@ -170,7 +170,7 @@ public:
float GetAxis(int axis, float range, float offset) const { float GetAxis(int axis, float range, float offset) const {
std::lock_guard lock{mutex}; std::lock_guard lock{mutex};
const float value = static_cast<float>(state.axes.at(axis)) / 32767.0f; const float value = static_cast<float>(state.axes.at(axis)) / 32767.0f;
return (value + offset) * range; return (value + offset) / range;
} }
bool RumblePlay(u16 amp_low, u16 amp_high) { bool RumblePlay(u16 amp_low, u16 amp_high) {
@ -538,8 +538,8 @@ public:
} }
std::tuple<float, float> GetRawStatus() const override { std::tuple<float, float> GetRawStatus() const override {
const float x = joystick->GetAxis(axis_x, 1.0f, offset_x); const float x = joystick->GetAxis(axis_x, range, offset_x);
const float y = joystick->GetAxis(axis_y, 1.0f, offset_y); const float y = joystick->GetAxis(axis_y, range, offset_y);
return {x, -y}; return {x, -y};
} }

View file

@ -47,8 +47,7 @@ Tas::Tas() {
} }
Tas::~Tas() { Tas::~Tas() {
SwapToStoredController(); Stop();
is_running = false;
}; };
void Tas::LoadTasFiles() { void Tas::LoadTasFiles() {
@ -189,8 +188,7 @@ std::string Tas::ButtonsToString(u32 button) const {
void Tas::UpdateThread() { void Tas::UpdateThread() {
if (!Settings::values.tas_enable) { if (!Settings::values.tas_enable) {
if (is_running) { if (is_running) {
SwapToStoredController(); Stop();
is_running = false;
} }
return; return;
} }
@ -305,14 +303,19 @@ void Tas::StartStop() {
if (!Settings::values.tas_enable) { if (!Settings::values.tas_enable) {
return; return;
} }
is_running = !is_running;
if (is_running) { if (is_running) {
SwapToTasController(); Stop();
} else { } else {
SwapToStoredController(); is_running = true;
SwapToTasController();
} }
} }
void Tas::Stop() {
is_running = false;
SwapToStoredController();
}
void Tas::SwapToTasController() { void Tas::SwapToTasController() {
if (!Settings::values.tas_swap_controllers) { if (!Settings::values.tas_swap_controllers) {
return; return;

View file

@ -105,6 +105,9 @@ public:
// Sets the flag to start or stop the TAS command excecution and swaps controllers profiles // Sets the flag to start or stop the TAS command excecution and swaps controllers profiles
void StartStop(); void StartStop();
// Stop the TAS and reverts any controller profile
void Stop();
// Sets the flag to reload the file and start from the begining in the next update // Sets the flag to reload the file and start from the begining in the next update
void Reset(); void Reset();

View file

@ -635,22 +635,9 @@ void VKBlitScreen::CreateFramebuffers() {
const VkExtent2D size{swapchain.GetSize()}; const VkExtent2D size{swapchain.GetSize()};
framebuffers.resize(image_count); framebuffers.resize(image_count);
VkFramebufferCreateInfo ci{
.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,
.pNext = nullptr,
.flags = 0,
.renderPass = *renderpass,
.attachmentCount = 1,
.pAttachments = nullptr,
.width = size.width,
.height = size.height,
.layers = 1,
};
for (std::size_t i = 0; i < image_count; ++i) { for (std::size_t i = 0; i < image_count; ++i) {
const VkImageView image_view{swapchain.GetImageViewIndex(i)}; const VkImageView image_view{swapchain.GetImageViewIndex(i)};
ci.pAttachments = &image_view; framebuffers[i] = CreateFramebuffer(image_view, size);
framebuffers[i] = device.GetLogical().CreateFramebuffer(ci);
} }
} }

View file

@ -61,11 +61,16 @@ struct DrawParams {
VkViewport GetViewportState(const Device& device, const Maxwell& regs, size_t index) { VkViewport GetViewportState(const Device& device, const Maxwell& regs, size_t index) {
const auto& src = regs.viewport_transform[index]; const auto& src = regs.viewport_transform[index];
const float width = src.scale_x * 2.0f; const float width = src.scale_x * 2.0f;
const float height = src.scale_y * 2.0f; float y = src.translate_y - src.scale_y;
float height = src.scale_y * 2.0f;
if (regs.screen_y_control.y_negate) {
y += height;
height = -height;
}
const float reduce_z = regs.depth_mode == Maxwell::DepthMode::MinusOneToOne ? 1.0f : 0.0f; const float reduce_z = regs.depth_mode == Maxwell::DepthMode::MinusOneToOne ? 1.0f : 0.0f;
VkViewport viewport{ VkViewport viewport{
.x = src.translate_x - src.scale_x, .x = src.translate_x - src.scale_x,
.y = src.translate_y - src.scale_y, .y = y,
.width = width != 0.0f ? width : 1.0f, .width = width != 0.0f ? width : 1.0f,
.height = height != 0.0f ? height : 1.0f, .height = height != 0.0f ? height : 1.0f,
.minDepth = src.translate_z - src.scale_z * reduce_z, .minDepth = src.translate_z - src.scale_z * reduce_z,

View file

@ -1044,12 +1044,7 @@ void GMainWindow::InitializeHotkeys() {
input_subsystem->GetTas()->StartStop(); input_subsystem->GetTas()->StartStop();
}); });
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("TAS Reset"), this), connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("TAS Reset"), this),
&QShortcut::activated, this, [&] { &QShortcut::activated, this, [&] { input_subsystem->GetTas()->Reset(); });
if (emulation_running) {
input_subsystem->GetTas()->Reset();
}
input_subsystem->GetTas()->Reset();
});
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("TAS Record"), this), connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("TAS Record"), this),
&QShortcut::activated, this, [&] { &QShortcut::activated, this, [&] {
if (!emulation_running) { if (!emulation_running) {
@ -1515,7 +1510,7 @@ void GMainWindow::ShutdownGame() {
} }
game_list->SetFilterFocus(); game_list->SetFilterFocus();
tas_label->clear(); tas_label->clear();
input_subsystem->GetTas()->~Tas(); input_subsystem->GetTas()->Stop();
render_window->removeEventFilter(render_window); render_window->removeEventFilter(render_window);
render_window->setAttribute(Qt::WA_Hover, false); render_window->setAttribute(Qt::WA_Hover, false);