Compare commits

..

5 Commits

Author SHA1 Message Date
lizzie 088df3a52f Trigger build 2026-09-06 21:49:45 +00:00
lizzie 9bd8924aeb 2026-09-05 05:55:38
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2026-09-05 23:57:00 +02:00
lizzie 702fb672c2 2026-09-05 05:53:11
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2026-09-05 23:57:00 +02:00
lizzie 4dca6ccdb1 2026-09-04 23:59:41
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2026-09-05 23:57:00 +02:00
lizzie 06dc97a290 2026-09-04 23:57:52
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2026-09-05 23:57:00 +02:00
10 changed files with 75 additions and 71 deletions
+2
View File
@@ -321,6 +321,8 @@ static void RunTestInstance(Dynarmic::A32::Jit& jit,
uni_env.PadCodeMem();
jit_env.modified_memory.clear();
uni_env.modified_memory.clear();
jit_env.interrupts.clear();
uni_env.interrupts.clear();
jit.Regs() = regs;
jit.ExtRegs() = vecs;
@@ -176,6 +176,8 @@ static void RunTestInstance(Dynarmic::A64::Jit& jit, A64Unicorn& uni, A64TestEnv
uni_env.code_mem_start_address = instructions_start;
jit_env.modified_memory.clear();
uni_env.modified_memory.clear();
jit_env.interrupts.clear();
uni_env.interrupts.clear();
const u64 initial_sp = RandInt<u64>(0x30'0000'0000, 0x40'0000'0000) * 4;
+10 -4
View File
@@ -282,17 +282,20 @@ int main(int argc, char** argv) {
return 1;
}
const char* const hex_instruction = [s = argv[2]] {
if (strlen(s) > 2 && s[0] == '0' && s[1] == 'x')
return s + 2;
return s;
const char* const hex_instruction = [argv] {
if (strlen(argv[2]) > 2 && argv[2][0] == '0' && argv[2][1] == 'x') {
return argv[2] + 2;
}
return argv[2];
}();
if (strlen(hex_instruction) > 8) {
fmt::print("hex string too long\n");
return 1;
}
const u32 instruction = strtol(hex_instruction, nullptr, 16);
if (strcmp(argv[1], "a32") == 0) {
PrintA32Instruction(instruction);
} else if (strcmp(argv[1], "a64") == 0) {
@@ -303,11 +306,13 @@ int main(int argc, char** argv) {
fmt::print("Invalid mode: {}\nValid values: a32, a64, thumb\n", argv[1]);
return 1;
}
if (argc == 4) {
if (strcmp(argv[3], "-exec") != 0) {
fmt::print("Invalid option {}\n", argv[3]);
return 1;
}
if (strcmp(argv[1], "a32") == 0) {
ExecuteA32Instruction(instruction);
} else {
@@ -315,5 +320,6 @@ int main(int argc, char** argv) {
return 1;
}
}
return 0;
}
+24 -40
View File
@@ -354,8 +354,6 @@ u32 GenRandomA64Inst(u64 pc, bool is_last_inst) {
"MSR_reg",
"MSR_imm",
"MRS",
// generates F16
"FCADD_vec",
};
for (const auto& [fn, bitstring] : list) {
@@ -442,6 +440,7 @@ void RunTestInstance(Dynarmic::A32::Jit& jit,
std::copy(instructions.begin(), instructions.end(), jit_env.code_mem.begin() + num_words);
jit_env.PadCodeMem();
jit_env.modified_memory.clear();
jit_env.interrupts.clear();
jit.Regs() = regs;
jit.ExtRegs() = vecs;
@@ -511,6 +510,7 @@ void RunTestInstance(Dynarmic::A64::Jit& jit,
jit_env.code_mem.emplace_back(0x14000000); // B .
jit_env.code_mem_start_address = start_address;
jit_env.modified_memory.clear();
jit_env.interrupts.clear();
jit.SetRegisters(regs);
jit.SetVectors(vecs);
@@ -536,52 +536,36 @@ void RunTestInstance(Dynarmic::A64::Jit& jit,
fmt::print("initial_regs:");
for (u64 i : regs)
fmt::print(" {:016x}", i);
fmt::print(
"\n"
"initial_vecs:"
);
fmt::print("\n");
fmt::print("initial_vecs:");
for (auto i : vecs)
fmt::print(" {:016x}:{:016x}", i[0], i[1]);
fmt::print(
"\n"
"initial_sp: {:016x}\n"
"initial_pstate: {:08x}\n"
"initial_fpcr: {:08x}\n"
"final_regs:"
, initial_sp
, pstate
, fpcr
);
fmt::print("\n");
fmt::print("initial_sp: {:016x}\n", initial_sp);
fmt::print("initial_pstate: {:08x}\n", pstate);
fmt::print("initial_fpcr: {:08x}\n", fpcr);
fmt::print("final_regs:");
for (u64 i : jit.GetRegisters())
fmt::print(" {:016x}", i);
fmt::print(
"\n"
"final_vecs:"
);
fmt::print("\n");
fmt::print("final_vecs:");
for (auto i : jit.GetVectors())
fmt::print(" {:016x}:{:016x}", i[0], i[1]);
fmt::print(
"\n"
"final_sp: {:016x}\n"
"final_pc: {:016x}\n"
"final_pstate: {:08x}\n"
"final_fpcr: {:08x}\n"
"final_qc : {}\n"
"mod_mem:"
, jit.GetSP()
, jit.GetPC()
, jit.GetPstate()
, jit.GetFpcr()
, FP::FPSR{jit.GetFpsr()}.QC()
);
fmt::print("\n");
fmt::print("final_sp: {:016x}\n", jit.GetSP());
fmt::print("final_pc: {:016x}\n", jit.GetPC());
fmt::print("final_pstate: {:08x}\n", jit.GetPstate());
fmt::print("final_fpcr: {:08x}\n", jit.GetFpcr());
fmt::print("final_qc : {}\n", FP::FPSR{jit.GetFpsr()}.QC());
fmt::print("mod_mem:");
for (auto [addr, value] : jit_env.modified_memory)
fmt::print(" {:08x}:{:02x}", addr, value);
fmt::print(
"\n"
"===\n"
"{}"
, jit.Disassemble()
);
fmt::print("\n");
fmt::print("interrupts:\n");
for (const auto& i : jit_env.interrupts)
std::puts(i.c_str());
fmt::print("===\n");
fmt::print("{}", jit.Disassemble());
}
}
+2
View File
@@ -99,6 +99,7 @@ void RunTestInstance(Dynarmic::A32::Jit& jit,
std::copy(instructions.begin(), instructions.end(), jit_env.code_mem.begin() + num_words);
jit_env.PadCodeMem();
jit_env.modified_memory.clear();
jit_env.interrupts.clear();
jit.Regs() = regs;
jit.ExtRegs() = vecs;
@@ -191,6 +192,7 @@ void RunTestInstance(A64::Jit& jit,
jit_env.code_mem.emplace_back(0x14000000); // B .
jit_env.code_mem_start_address = start_address;
jit_env.modified_memory.clear();
jit_env.interrupts.clear();
jit.SetRegisters(regs);
jit.SetVectors(vecs);
+11 -13
View File
@@ -4,17 +4,16 @@
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <thread>
#include <chrono>
#include <fmt/ranges.h>
#include <math.h>
#include "common/param_package.h"
#include "common/settings.h"
#include "common/thread.h"
#include "common/steady_clock.h"
#include "input_common/drivers/mouse.h"
namespace InputCommon {
constexpr int update_time = 10;
constexpr float default_panning_sensitivity = 0.0010f;
constexpr float default_stick_sensitivity = 0.0006f;
constexpr float default_deadzone_counterweight = 0.01f;
@@ -74,7 +73,7 @@ Mouse::Mouse(std::string input_engine_) : InputEngine(std::move(input_engine_))
last_motion_change = {};
}
void Mouse::UpdateStickInput() {
void Mouse::UpdateStickInput(Common::SteadyClock::time_point timestamp) {
if (!IsMousePanningEnabled()) {
return;
}
@@ -100,12 +99,9 @@ void Mouse::UpdateStickInput() {
last_mouse_change *= clamped_decay;
}
void Mouse::UpdateMotionInput() {
const float sensitivity =
IsMousePanningEnabled() ? default_motion_panning_sensitivity : default_motion_sensitivity;
const float rotation_velocity = std::sqrt(last_motion_change.x * last_motion_change.x +
last_motion_change.y * last_motion_change.y);
void Mouse::UpdateMotionInput(Common::SteadyClock::time_point timestamp) {
const float sensitivity = IsMousePanningEnabled() ? default_motion_panning_sensitivity : default_motion_sensitivity;
const float rotation_velocity = std::sqrt(last_motion_change.x * last_motion_change.x + last_motion_change.y * last_motion_change.y);
// Clamp rotation speed
if (rotation_velocity > maximum_rotation_speed / sensitivity) {
@@ -121,7 +117,7 @@ void Mouse::UpdateMotionInput() {
.accel_x = 0,
.accel_y = 0,
.accel_z = 0,
.delta_timestamp = update_time * 1000,
.delta_timestamp = u64(std::chrono::duration_cast<std::chrono::microseconds>(timestamp - last_notify_timestamp).count()),
};
if (IsMousePanningEnabled()) {
@@ -177,8 +173,10 @@ void Mouse::Move(int x, int y, int center_x, int center_y) {
}
void Mouse::NotifyChanged() {
UpdateStickInput();
UpdateMotionInput();
auto const timestamp = Common::SteadyClock::Now();
UpdateStickInput(timestamp);
UpdateMotionInput(timestamp);
last_notify_timestamp = Common::SteadyClock::Now();
}
void Mouse::MouseMove(f32 touch_x, f32 touch_y) {
+10 -7
View File
@@ -7,7 +7,9 @@
#pragma once
#include <thread>
#include <chrono>
#include "common/steady_clock.h"
#include "common/polyfill_thread.h"
#include "common/vector_math.h"
#include "input_common/input_engine.h"
@@ -101,17 +103,18 @@ public:
Common::Input::ButtonNames GetUIName(const Common::ParamPackage& params) const override;
private:
void UpdateStickInput();
void UpdateMotionInput();
void UpdateStickInput(Common::SteadyClock::time_point timestamp);
void UpdateMotionInput(Common::SteadyClock::time_point timestamp);
bool IsMousePanningEnabled();
Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const;
Common::Vec2<int> mouse_origin;
Common::Vec2<int> last_mouse_position;
Common::Vec2<float> last_mouse_change;
Common::Vec3<float> last_motion_change;
Common::Vec2<int> wheel_position;
Common::Vec2<int> mouse_origin{};
Common::Vec2<int> last_mouse_position{};
Common::Vec2<float> last_mouse_change{};
Common::Vec3<float> last_motion_change{};
Common::Vec2<int> wheel_position{};
Common::SteadyClock::time_point last_notify_timestamp{};
bool button_pressed = false;
};
+5 -7
View File
@@ -538,6 +538,7 @@ void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) {
}
void GRenderWindow::ConstrainMouse() {
input_subsystem->GetMouse()->NotifyChanged(); // required to reset mouse once it's no longer moved
if (QtCommon::emu_thread == nullptr || !Settings::values.mouse_panning) {
mouse_constrain_timer.stop();
return;
@@ -552,15 +553,12 @@ void GRenderWindow::ConstrainMouse() {
const auto pos = mapFromGlobal(QCursor::pos());
const int new_pos_x = std::clamp(pos.x(), 0, width());
const int new_pos_y = std::clamp(pos.y(), 0, height());
QCursor::setPos(mapToGlobal(QPoint{new_pos_x, new_pos_y}));
return;
} else {
const int center_x = width() / 2;
const int center_y = height() / 2;
QCursor::setPos(mapToGlobal(QPoint{center_x, center_y}));
}
const int center_x = width() / 2;
const int center_y = height() / 2;
QCursor::setPos(mapToGlobal(QPoint{center_x, center_y}));
}
void GRenderWindow::wheelEvent(QWheelEvent* event) {
@@ -37,10 +37,16 @@ EmuWindow_SDL3::EmuWindow_SDL3(InputCommon::InputSubsystem* input_subsystem_, Co
SDL_SetWindowTitle(this_->render_window, title.c_str());
return 2000;
}, this);
mouse_timer = SDL_AddTimer(100, [](void *userdata, SDL_TimerID, Uint32) -> Uint32 {
auto* this_ = (EmuWindow_SDL3*)userdata;
this_->input_subsystem->GetMouse()->NotifyChanged();
return 100;
}, this);
}
EmuWindow_SDL3::~EmuWindow_SDL3() {
SDL_RemoveTimer(titlebar_timer);
SDL_RemoveTimer(mouse_timer);
system.HIDCore().UnloadInputDevices();
input_subsystem->Shutdown();
SDL_Quit();
@@ -84,6 +84,9 @@ protected:
/// Periodic changer of titlebar (independent of event loop)
SDL_TimerID titlebar_timer;
// Mouse resetter once it
SDL_TimerID mouse_timer;
/// Is the window still open?
bool is_open = true;