early-access version 3952

This commit is contained in:
pineappleEA 2023-10-30 02:46:39 +01:00
parent 97b5538b05
commit e0a0f1dbda
8 changed files with 62 additions and 7 deletions

View file

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

View file

@ -13,3 +13,4 @@ Exec=yuzu %f
Categories=Game;Emulator;Qt; Categories=Game;Emulator;Qt;
MimeType=application/x-nx-nro;application/x-nx-nso;application/x-nx-nsp;application/x-nx-xci; MimeType=application/x-nx-nro;application/x-nx-nso;application/x-nx-nsp;application/x-nx-xci;
Keywords=Nintendo;Switch; Keywords=Nintendo;Switch;
StartupWMClass=yuzu

View file

@ -26,7 +26,7 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.navigation.findNavController import androidx.navigation.findNavController
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import com.google.android.material.transition.MaterialSharedAxis import com.google.android.material.transition.MaterialSharedAxis
import org.yuzu.yuzu_emu.BuildConfig import org.yuzu.yuzu_emu.BuildConfig
import org.yuzu.yuzu_emu.HomeNavigationDirections import org.yuzu.yuzu_emu.HomeNavigationDirections
@ -186,7 +186,8 @@ class HomeSettingsFragment : Fragment() {
} }
binding.homeSettingsList.apply { binding.homeSettingsList.apply {
layoutManager = LinearLayoutManager(requireContext()) layoutManager =
GridLayoutManager(requireContext(), resources.getInteger(R.integer.grid_columns))
adapter = HomeSettingAdapter( adapter = HomeSettingAdapter(
requireActivity() as AppCompatActivity, requireActivity() as AppCompatActivity,
viewLifecycleOwner, viewLifecycleOwner,

View file

@ -16,7 +16,8 @@
<LinearLayout <LinearLayout
android:id="@+id/option_layout" android:id="@+id/option_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:layout_gravity="center_vertical">
<ImageView <ImageView
android:id="@+id/option_icon" android:id="@+id/option_icon"

View file

@ -25,6 +25,7 @@ void ConfigureNvidiaEnvironmentFlags() {
void(_putenv(fmt::format("__GL_SHADER_DISK_CACHE_PATH={}", windows_path_string).c_str())); void(_putenv(fmt::format("__GL_SHADER_DISK_CACHE_PATH={}", windows_path_string).c_str()));
void(_putenv("__GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1")); void(_putenv("__GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1"));
void(_putenv("__GL_THREADED_OPTIMIZATIONS=1"));
#endif #endif
} }

View file

@ -190,7 +190,7 @@ void SetupDirtySpecialOps(Tables& tables) {
void SetupDirtyViewportSwizzles(Tables& tables) { void SetupDirtyViewportSwizzles(Tables& tables) {
static constexpr size_t swizzle_offset = 6; static constexpr size_t swizzle_offset = 6;
for (size_t index = 0; index < Regs::NumViewports; ++index) { for (size_t index = 0; index < Regs::NumViewports; ++index) {
tables[0][OFF(viewport_transform) + index * NUM(viewport_transform[0]) + swizzle_offset] = tables[1][OFF(viewport_transform) + index * NUM(viewport_transform[0]) + swizzle_offset] =
ViewportSwizzles; ViewportSwizzles;
} }
} }

View file

@ -1072,7 +1072,7 @@ void GMainWindow::InitializeWidgets() {
}); });
volume_popup->layout()->addWidget(volume_slider); volume_popup->layout()->addWidget(volume_slider);
volume_button = new QPushButton(); volume_button = new VolumeButton();
volume_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); volume_button->setObjectName(QStringLiteral("TogglableStatusBarButton"));
volume_button->setFocusPolicy(Qt::NoFocus); volume_button->setFocusPolicy(Qt::NoFocus);
volume_button->setCheckable(true); volume_button->setCheckable(true);
@ -1103,6 +1103,8 @@ void GMainWindow::InitializeWidgets() {
context_menu.exec(volume_button->mapToGlobal(menu_location)); context_menu.exec(volume_button->mapToGlobal(menu_location));
volume_button->repaint(); volume_button->repaint();
}); });
connect(volume_button, &VolumeButton::VolumeChanged, this, &GMainWindow::UpdateVolumeUI);
statusBar()->insertPermanentWidget(0, volume_button); statusBar()->insertPermanentWidget(0, volume_button);
// setup AA button // setup AA button
@ -5126,6 +5128,32 @@ void GMainWindow::changeEvent(QEvent* event) {
QWidget::changeEvent(event); QWidget::changeEvent(event);
} }
void VolumeButton::wheelEvent(QWheelEvent* event) {
int num_degrees = event->angleDelta().y() / 8;
int num_steps = (num_degrees / 15) * scroll_multiplier;
// Stated in QT docs: Most mouse types work in steps of 15 degrees, in which case the delta
// value is a multiple of 120; i.e., 120 units * 1/8 = 15 degrees.
if (num_steps > 0) {
Settings::values.volume.SetValue(
std::min(200, Settings::values.volume.GetValue() + num_steps));
} else {
Settings::values.volume.SetValue(
std::max(0, Settings::values.volume.GetValue() + num_steps));
}
scroll_multiplier = std::min(MaxMultiplier, scroll_multiplier * 2);
scroll_timer.start(100); // reset the multiplier if no scroll event occurs within 100 ms
emit VolumeChanged();
event->accept();
}
void VolumeButton::ResetMultiplier() {
scroll_multiplier = 1;
}
#ifdef main #ifdef main
#undef main #undef main
#endif #endif

View file

@ -8,6 +8,7 @@
#include <QMainWindow> #include <QMainWindow>
#include <QMessageBox> #include <QMessageBox>
#include <QPushButton>
#include <QTimer> #include <QTimer>
#include <QTranslator> #include <QTranslator>
@ -137,6 +138,28 @@ namespace VkDeviceInfo {
class Record; class Record;
} }
class VolumeButton : public QPushButton {
Q_OBJECT
public:
explicit VolumeButton(QWidget* parent = nullptr) : QPushButton(parent), scroll_multiplier(1) {
connect(&scroll_timer, &QTimer::timeout, this, &VolumeButton::ResetMultiplier);
}
signals:
void VolumeChanged();
protected:
void wheelEvent(QWheelEvent* event) override;
private slots:
void ResetMultiplier();
private:
int scroll_multiplier;
QTimer scroll_timer;
constexpr static int MaxMultiplier = 8;
};
class GMainWindow : public QMainWindow { class GMainWindow : public QMainWindow {
Q_OBJECT Q_OBJECT
@ -481,7 +504,7 @@ private:
QPushButton* dock_status_button = nullptr; QPushButton* dock_status_button = nullptr;
QPushButton* filter_status_button = nullptr; QPushButton* filter_status_button = nullptr;
QPushButton* aa_status_button = nullptr; QPushButton* aa_status_button = nullptr;
QPushButton* volume_button = nullptr; VolumeButton* volume_button = nullptr;
QWidget* volume_popup = nullptr; QWidget* volume_popup = nullptr;
QSlider* volume_slider = nullptr; QSlider* volume_slider = nullptr;
QTimer status_bar_update_timer; QTimer status_bar_update_timer;