Merge branch 'master' into metal2

This commit is contained in:
SamoZ256
2024-09-24 09:22:17 +02:00
committed by GitHub
48 changed files with 1691 additions and 242 deletions

View File

@@ -7,9 +7,10 @@
#include <cstdio>
#include <fstream>
#include "version.hpp"
#include "cheats.hpp"
#include "input_mappings.hpp"
#include "sdl_gyro.hpp"
#include "sdl_sensors.hpp"
#include "services/dsp.hpp"
MainWindow::MainWindow(QApplication* app, QWidget* parent) : QMainWindow(parent), keyboardMappings(InputMappings::defaultKeyboardMappings()) {
@@ -98,6 +99,14 @@ MainWindow::MainWindow(QApplication* app, QWidget* parent) : QMainWindow(parent)
}
}
if (emu->getConfig().appVersionOnWindow) {
setWindowTitle("Alber v" PANDA3DS_VERSION);
}
if (emu->getConfig().printAppVersion) {
printf("Welcome to Panda3DS v%s!\n", PANDA3DS_VERSION);
}
// The emulator graphics context for the thread should be initialized in the emulator thread due to how GL contexts work
emuThread = std::thread([this]() {
const RendererType rendererType = emu->getConfig().rendererType;
@@ -609,7 +618,7 @@ void MainWindow::pollControllers() {
case SDL_CONTROLLERSENSORUPDATE: {
if (event.csensor.sensor == SDL_SENSOR_GYRO) {
auto rotation = Gyro::SDL::convertRotation({
auto rotation = Sensors::SDL::convertRotation({
event.csensor.data[0],
event.csensor.data[1],
event.csensor.data[2],
@@ -618,6 +627,9 @@ void MainWindow::pollControllers() {
hid.setPitch(s16(rotation.x));
hid.setRoll(s16(rotation.y));
hid.setYaw(s16(rotation.z));
} else if (event.csensor.sensor == SDL_SENSOR_ACCEL) {
auto accel = Sensors::SDL::convertAcceleration(event.csensor.data);
hid.setAccel(accel.x, accel.y, accel.z);
}
break;
}
@@ -627,8 +639,13 @@ void MainWindow::pollControllers() {
void MainWindow::setupControllerSensors(SDL_GameController* controller) {
bool haveGyro = SDL_GameControllerHasSensor(controller, SDL_SENSOR_GYRO) == SDL_TRUE;
bool haveAccelerometer = SDL_GameControllerHasSensor(controller, SDL_SENSOR_ACCEL) == SDL_TRUE;
if (haveGyro) {
SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_GYRO, SDL_TRUE);
}
if (haveAccelerometer) {
SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_ACCEL, SDL_TRUE);
}
}