early-access version 2465

This commit is contained in:
pineappleEA 2022-02-02 05:57:17 +01:00
parent 8de64a0df5
commit 09a56f2db3
9 changed files with 55 additions and 37 deletions

View File

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

View File

@ -65,16 +65,20 @@ private:
#ifdef ARCHITECTURE_x86_64 #ifdef ARCHITECTURE_x86_64
std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, std::unique_ptr<WallClock> CreateBestMatchingClock(u64 emulated_cpu_frequency,
u32 emulated_clock_frequency) { u64 emulated_clock_frequency) {
const auto& caps = GetCPUCaps(); const auto& caps = GetCPUCaps();
u64 rtsc_frequency = 0; u64 rtsc_frequency = 0;
if (caps.invariant_tsc) { if (caps.invariant_tsc) {
rtsc_frequency = EstimateRDTSCFrequency(); rtsc_frequency = EstimateRDTSCFrequency();
} }
// Fallback to StandardWallClock if rtsc period is higher than a nano second // Fallback to StandardWallClock if the hardware TSC does not have the precision greater than:
if (rtsc_frequency <= 1000000000) { // - A nanosecond
// - The emulated CPU frequency
// - The emulated clock counter frequency (CNTFRQ)
if (rtsc_frequency <= WallClock::NS_RATIO || rtsc_frequency <= emulated_cpu_frequency ||
rtsc_frequency <= emulated_clock_frequency) {
return std::make_unique<StandardWallClock>(emulated_cpu_frequency, return std::make_unique<StandardWallClock>(emulated_cpu_frequency,
emulated_clock_frequency); emulated_clock_frequency);
} else { } else {
@ -85,8 +89,8 @@ std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency,
#else #else
std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, std::unique_ptr<WallClock> CreateBestMatchingClock(u64 emulated_cpu_frequency,
u32 emulated_clock_frequency) { u64 emulated_clock_frequency) {
return std::make_unique<StandardWallClock>(emulated_cpu_frequency, emulated_clock_frequency); return std::make_unique<StandardWallClock>(emulated_cpu_frequency, emulated_clock_frequency);
} }

View File

@ -13,6 +13,10 @@ namespace Common {
class WallClock { class WallClock {
public: public:
static constexpr u64 NS_RATIO = 1'000'000'000;
static constexpr u64 US_RATIO = 1'000'000;
static constexpr u64 MS_RATIO = 1'000;
virtual ~WallClock() = default; virtual ~WallClock() = default;
/// Returns current wall time in nanoseconds /// Returns current wall time in nanoseconds
@ -49,7 +53,7 @@ private:
bool is_native; bool is_native;
}; };
[[nodiscard]] std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, [[nodiscard]] std::unique_ptr<WallClock> CreateBestMatchingClock(u64 emulated_cpu_frequency,
u32 emulated_clock_frequency); u64 emulated_clock_frequency);
} // namespace Common } // namespace Common

View File

@ -47,9 +47,9 @@ NativeClock::NativeClock(u64 emulated_cpu_frequency_, u64 emulated_clock_frequen
_mm_mfence(); _mm_mfence();
time_point.inner.last_measure = __rdtsc(); time_point.inner.last_measure = __rdtsc();
time_point.inner.accumulated_ticks = 0U; time_point.inner.accumulated_ticks = 0U;
ns_rtsc_factor = GetFixedPoint64Factor(1000000000, rtsc_frequency); ns_rtsc_factor = GetFixedPoint64Factor(NS_RATIO, rtsc_frequency);
us_rtsc_factor = GetFixedPoint64Factor(1000000, rtsc_frequency); us_rtsc_factor = GetFixedPoint64Factor(US_RATIO, rtsc_frequency);
ms_rtsc_factor = GetFixedPoint64Factor(1000, rtsc_frequency); ms_rtsc_factor = GetFixedPoint64Factor(MS_RATIO, rtsc_frequency);
clock_rtsc_factor = GetFixedPoint64Factor(emulated_clock_frequency, rtsc_frequency); clock_rtsc_factor = GetFixedPoint64Factor(emulated_clock_frequency, rtsc_frequency);
cpu_rtsc_factor = GetFixedPoint64Factor(emulated_cpu_frequency, rtsc_frequency); cpu_rtsc_factor = GetFixedPoint64Factor(emulated_cpu_frequency, rtsc_frequency);
} }

View File

@ -217,7 +217,7 @@ private:
int index) const; int index) const;
mutable std::mutex mutex; mutable std::mutex mutex;
mutable std::mutex mutex_callback; mutable std::recursive_mutex mutex_callback;
bool configuring{false}; bool configuring{false};
const std::string input_engine; const std::string input_engine;
int last_callback_key = 0; int last_callback_key = 0;

View File

@ -109,7 +109,7 @@ void ConfigureDialog::ApplyConfiguration() {
ui_tab->ApplyConfiguration(); ui_tab->ApplyConfiguration();
system_tab->ApplyConfiguration(); system_tab->ApplyConfiguration();
profile_tab->ApplyConfiguration(); profile_tab->ApplyConfiguration();
filesystem_tab->applyConfiguration(); filesystem_tab->ApplyConfiguration();
input_tab->ApplyConfiguration(); input_tab->ApplyConfiguration();
hotkeys_tab->ApplyConfiguration(registry); hotkeys_tab->ApplyConfiguration(registry);
cpu_tab->ApplyConfiguration(); cpu_tab->ApplyConfiguration();

View File

@ -14,7 +14,7 @@
ConfigureFilesystem::ConfigureFilesystem(QWidget* parent) ConfigureFilesystem::ConfigureFilesystem(QWidget* parent)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureFilesystem>()) { : QWidget(parent), ui(std::make_unique<Ui::ConfigureFilesystem>()) {
ui->setupUi(this); ui->setupUi(this);
this->setConfiguration(); SetConfiguration();
connect(ui->nand_directory_button, &QToolButton::pressed, this, connect(ui->nand_directory_button, &QToolButton::pressed, this,
[this] { SetDirectory(DirectoryTarget::NAND, ui->nand_directory_edit); }); [this] { SetDirectory(DirectoryTarget::NAND, ui->nand_directory_edit); });
@ -38,7 +38,15 @@ ConfigureFilesystem::ConfigureFilesystem(QWidget* parent)
ConfigureFilesystem::~ConfigureFilesystem() = default; ConfigureFilesystem::~ConfigureFilesystem() = default;
void ConfigureFilesystem::setConfiguration() { void ConfigureFilesystem::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QWidget::changeEvent(event);
}
void ConfigureFilesystem::SetConfiguration() {
ui->nand_directory_edit->setText( ui->nand_directory_edit->setText(
QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::NANDDir))); QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::NANDDir)));
ui->sdmc_directory_edit->setText( ui->sdmc_directory_edit->setText(
@ -60,7 +68,7 @@ void ConfigureFilesystem::setConfiguration() {
UpdateEnabledControls(); UpdateEnabledControls();
} }
void ConfigureFilesystem::applyConfiguration() { void ConfigureFilesystem::ApplyConfiguration() {
Common::FS::SetYuzuPath(Common::FS::YuzuPath::NANDDir, Common::FS::SetYuzuPath(Common::FS::YuzuPath::NANDDir,
ui->nand_directory_edit->text().toStdString()); ui->nand_directory_edit->text().toStdString());
Common::FS::SetYuzuPath(Common::FS::YuzuPath::SDMCDir, Common::FS::SetYuzuPath(Common::FS::YuzuPath::SDMCDir,
@ -143,6 +151,6 @@ void ConfigureFilesystem::UpdateEnabledControls() {
!ui->gamecard_current_game->isChecked()); !ui->gamecard_current_game->isChecked());
} }
void ConfigureFilesystem::retranslateUi() { void ConfigureFilesystem::RetranslateUI() {
ui->retranslateUi(this); ui->retranslateUi(this);
} }

View File

@ -20,11 +20,13 @@ public:
explicit ConfigureFilesystem(QWidget* parent = nullptr); explicit ConfigureFilesystem(QWidget* parent = nullptr);
~ConfigureFilesystem() override; ~ConfigureFilesystem() override;
void applyConfiguration(); void ApplyConfiguration();
void retranslateUi();
private: private:
void setConfiguration(); void changeEvent(QEvent* event) override;
void RetranslateUI();
void SetConfiguration();
enum class DirectoryTarget { enum class DirectoryTarget {
NAND, NAND,

View File

@ -178,52 +178,52 @@ void ConfigureHotkeys::SetPollingResult(Core::HID::NpadButton button, const bool
QString ConfigureHotkeys::GetButtonName(Core::HID::NpadButton button) const { QString ConfigureHotkeys::GetButtonName(Core::HID::NpadButton button) const {
Core::HID::NpadButtonState state{button}; Core::HID::NpadButtonState state{button};
if (state.a) { if (state.a) {
return tr("A"); return QStringLiteral("A");
} }
if (state.b) { if (state.b) {
return tr("B"); return QStringLiteral("B");
} }
if (state.x) { if (state.x) {
return tr("X"); return QStringLiteral("X");
} }
if (state.y) { if (state.y) {
return tr("Y"); return QStringLiteral("Y");
} }
if (state.l || state.right_sl || state.left_sl) { if (state.l || state.right_sl || state.left_sl) {
return tr("L"); return QStringLiteral("L");
} }
if (state.r || state.right_sr || state.left_sr) { if (state.r || state.right_sr || state.left_sr) {
return tr("R"); return QStringLiteral("R");
} }
if (state.zl) { if (state.zl) {
return tr("ZL"); return QStringLiteral("ZL");
} }
if (state.zr) { if (state.zr) {
return tr("ZR"); return QStringLiteral("ZR");
} }
if (state.left) { if (state.left) {
return tr("Dpad_Left"); return QStringLiteral("Dpad_Left");
} }
if (state.right) { if (state.right) {
return tr("Dpad_Right"); return QStringLiteral("Dpad_Right");
} }
if (state.up) { if (state.up) {
return tr("Dpad_Up"); return QStringLiteral("Dpad_Up");
} }
if (state.down) { if (state.down) {
return tr("Dpad_Down"); return QStringLiteral("Dpad_Down");
} }
if (state.stick_l) { if (state.stick_l) {
return tr("Left_Stick"); return QStringLiteral("Left_Stick");
} }
if (state.stick_r) { if (state.stick_r) {
return tr("Right_Stick"); return QStringLiteral("Right_Stick");
} }
if (state.minus) { if (state.minus) {
return tr("Minus"); return QStringLiteral("Minus");
} }
if (state.plus) { if (state.plus) {
return tr("Plus"); return QStringLiteral("Plus");
} }
return tr("Invalid"); return tr("Invalid");
} }