early-access version 2220

This commit is contained in:
pineappleEA 2021-11-19 12:58:50 +01:00
parent 5ba3e92e3f
commit 056fe9650a
15 changed files with 38 additions and 26 deletions

View File

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

View File

@ -300,15 +300,16 @@ struct KernelCore::Impl {
// Gets the dummy KThread for the caller, allocating a new one if this is the first time
KThread* GetHostDummyThread() {
auto make_thread = [this]() {
std::unique_ptr<KThread> thread = std::make_unique<KThread>(system.Kernel());
std::lock_guard lk(dummy_thread_lock);
auto& thread = dummy_threads.emplace_back(std::make_unique<KThread>(system.Kernel()));
KAutoObject::Create(thread.get());
ASSERT(KThread::InitializeDummyThread(thread.get()).IsSuccess());
thread->SetName(fmt::format("DummyThread:{}", GetHostThreadId()));
return thread;
return thread.get();
};
thread_local auto thread = make_thread();
return thread.get();
thread_local KThread* saved_thread = make_thread();
return saved_thread;
}
/// Registers a CPU core thread by allocating a host thread ID for it
@ -695,6 +696,12 @@ struct KernelCore::Impl {
return port;
}
std::mutex server_ports_lock;
std::mutex server_sessions_lock;
std::mutex registered_objects_lock;
std::mutex registered_in_use_objects_lock;
std::mutex dummy_thread_lock;
std::atomic<u32> next_object_id{0};
std::atomic<u64> next_kernel_process_id{KProcess::InitialKIPIDMin};
std::atomic<u64> next_user_process_id{KProcess::ProcessIDMin};
@ -725,10 +732,6 @@ struct KernelCore::Impl {
std::unordered_set<KServerSession*> server_sessions;
std::unordered_set<KAutoObject*> registered_objects;
std::unordered_set<KAutoObject*> registered_in_use_objects;
std::mutex server_ports_lock;
std::mutex server_sessions_lock;
std::mutex registered_objects_lock;
std::mutex registered_in_use_objects_lock;
std::unique_ptr<Core::ExclusiveMonitor> exclusive_monitor;
std::vector<Kernel::PhysicalCore> cores;
@ -753,6 +756,9 @@ struct KernelCore::Impl {
std::array<Core::CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES> interrupts{};
std::array<std::unique_ptr<Kernel::KScheduler>, Core::Hardware::NUM_CPU_CORES> schedulers{};
// Specifically tracked to be automatically destroyed with kernel
std::vector<std::unique_ptr<KThread>> dummy_threads;
bool is_multicore{};
bool is_phantom_mode_for_singlecore{};
u32 single_core_thread_id{};

View File

@ -69,7 +69,7 @@ private:
libusb_device_handle* handle{};
};
GCAdapter::GCAdapter(const std::string input_engine_) : InputEngine(input_engine_) {
GCAdapter::GCAdapter(const std::string& input_engine_) : InputEngine(input_engine_) {
if (usb_adapter_handle) {
return;
}

View File

@ -24,7 +24,7 @@ class LibUSBDeviceHandle;
class GCAdapter : public InputCommon::InputEngine {
public:
explicit GCAdapter(const std::string input_engine_);
explicit GCAdapter(const std::string& input_engine_);
~GCAdapter();
Common::Input::VibrationError SetRumble(

View File

@ -24,7 +24,7 @@ constexpr PadIdentifier identifier = {
.pad = 0,
};
Mouse::Mouse(const std::string input_engine_) : InputEngine(input_engine_) {
Mouse::Mouse(const std::string& input_engine_) : InputEngine(input_engine_) {
PreSetController(identifier);
PreSetAxis(identifier, mouse_axis_x);
PreSetAxis(identifier, mouse_axis_y);

View File

@ -29,7 +29,7 @@ enum class MouseButton {
*/
class Mouse final : public InputCommon::InputEngine {
public:
explicit Mouse(const std::string input_engine_);
explicit Mouse(const std::string& input_engine_);
/**
* Signals that mouse has moved.

View File

@ -929,7 +929,7 @@ std::string SDLDriver::GetHatButtonName(u8 direction_value) const {
}
}
u8 SDLDriver::GetHatButtonId(const std::string direction_name) const {
u8 SDLDriver::GetHatButtonId(const std::string& direction_name) const {
Uint8 direction;
if (direction_name == "up") {
direction = SDL_HAT_UP;

View File

@ -56,7 +56,7 @@ public:
std::string GetUIName(const Common::ParamPackage& params) const override;
std::string GetHatButtonName(u8 direction_value) const override;
u8 GetHatButtonId(const std::string direction_name) const override;
u8 GetHatButtonId(const std::string& direction_name) const override;
Common::Input::VibrationError SetRumble(
const PadIdentifier& identifier, const Common::Input::VibrationStatus vibration) override;

View File

@ -47,7 +47,7 @@ constexpr std::array<std::pair<std::string_view, TasButton>, 20> text_to_tas_but
{"KEY_ZR", TasButton::TRIGGER_ZR},
};
Tas::Tas(const std::string input_engine_) : InputCommon::InputEngine(input_engine_) {
Tas::Tas(const std::string& input_engine_) : InputCommon::InputEngine(input_engine_) {
for (size_t player_index = 0; player_index < PLAYER_NUMBER; player_index++) {
PadIdentifier identifier{
.guid = Common::UUID{},

View File

@ -83,7 +83,7 @@ enum class TasState {
class Tas final : public InputCommon::InputEngine {
public:
explicit Tas(const std::string input_engine_);
explicit Tas(const std::string& input_engine_);
~Tas();
/**

View File

@ -13,7 +13,7 @@ constexpr PadIdentifier identifier = {
.pad = 0,
};
TouchScreen::TouchScreen(const std::string input_engine_) : InputEngine(input_engine_) {
TouchScreen::TouchScreen(const std::string& input_engine_) : InputEngine(input_engine_) {
PreSetController(identifier);
}

View File

@ -14,7 +14,7 @@ namespace InputCommon {
*/
class TouchScreen final : public InputCommon::InputEngine {
public:
explicit TouchScreen(const std::string input_engine_);
explicit TouchScreen(const std::string& input_engine_);
/**
* Signals that mouse has moved.

View File

@ -300,8 +300,8 @@ void InputEngine::TriggerOnMotionChange(const PadIdentifier& identifier, int mot
if (!configuring || !mapping_callback.on_data) {
return;
}
if (std::abs(value.gyro_x) < 1.0f && std::abs(value.gyro_y) < 1.0f &&
std::abs(value.gyro_z) < 1.0f) {
if (std::abs(value.gyro_x) < 0.6f && std::abs(value.gyro_y) < 0.6f &&
std::abs(value.gyro_z) < 0.6f) {
return;
}
mapping_callback.on_data(MappingData{

View File

@ -166,7 +166,7 @@ public:
};
/// Retrieves the index number of the given hat button direction
virtual u8 GetHatButtonId([[maybe_unused]] const std::string direction_name) const {
virtual u8 GetHatButtonId([[maybe_unused]] const std::string& direction_name) const {
return 0;
};

View File

@ -1335,8 +1335,14 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
std::make_unique<QtWebBrowser>(*this), // Web Browser
});
const Core::SystemResultStatus result{
system->Load(*render_window, filename.toStdString(), program_id, program_index)};
Core::SystemResultStatus result{};
auto load_thread = std::jthread(
[this, filename, program_id, program_index](Core::SystemResultStatus& result) {
result =
system->Load(*render_window, filename.toStdString(), program_id, program_index);
},
std::ref(result));
load_thread.join();
const auto drd_callout = (UISettings::values.callout_flags.GetValue() &
static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0;
@ -3306,9 +3312,9 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
if (!errors.isEmpty()) {
QMessageBox::warning(
this, tr("Derivation Components Missing"),
tr("Components are missing that may hinder key derivation from completing. "
tr("Encryption keys are missing. "
"<br>Please follow <a href='https://yuzu-emu.org/help/quickstart/'>the yuzu "
"quickstart guide</a> to get all your keys and "
"quickstart guide</a> to get all your keys, firmware and "
"games.<br><br><small>(%1)</small>")
.arg(errors));
}