early-access version 3105

This commit is contained in:
pineappleEA 2022-11-11 00:55:26 +01:00
parent e34c1a72d4
commit 17e11613ac
5 changed files with 153 additions and 266 deletions

View File

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

View File

@ -20,8 +20,12 @@ void KEvent::Initialize(KProcess* owner) {
m_readable_event.Initialize(this);
// Set our owner process.
// HACK: this should never be nullptr, but service threads don't have a
// proper parent process yet.
if (owner != nullptr) {
m_owner = owner;
m_owner->Open();
}
// Mark initialized.
m_initialized = true;
@ -50,8 +54,11 @@ Result KEvent::Clear() {
void KEvent::PostDestroy(uintptr_t arg) {
// Release the event count resource the owner process holds.
KProcess* owner = reinterpret_cast<KProcess*>(arg);
if (owner != nullptr) {
owner->GetResourceLimit()->Release(LimitableResource::EventCountMax, 1);
owner->Close();
}
}
} // namespace Kernel

View File

@ -40,7 +40,6 @@ private:
std::mutex m_session_mutex;
std::map<KServerSession*, std::shared_ptr<SessionRequestManager>> m_sessions;
KEvent* m_wakeup_event;
KProcess* m_process;
KThread* m_thread;
std::atomic<bool> m_shutdown_requested;
const std::string m_service_name;
@ -180,39 +179,17 @@ ServiceThread::Impl::~Impl() {
// Close thread.
m_thread->Close();
// Close process.
m_process->Close();
}
ServiceThread::Impl::Impl(KernelCore& kernel_, const std::string& service_name)
: kernel{kernel_}, m_service_name{service_name} {
// Initialize process.
m_process = KProcess::Create(kernel);
KProcess::Initialize(m_process, kernel.System(), service_name,
KProcess::ProcessType::KernelInternal, kernel.GetSystemResourceLimit());
// Reserve a new event from the process resource limit
KScopedResourceReservation event_reservation(m_process, LimitableResource::EventCountMax);
ASSERT(event_reservation.Succeeded());
// Initialize event.
m_wakeup_event = KEvent::Create(kernel);
m_wakeup_event->Initialize(m_process);
// Commit the event reservation.
event_reservation.Commit();
// Reserve a new thread from the process resource limit
KScopedResourceReservation thread_reservation(m_process, LimitableResource::ThreadCountMax);
ASSERT(thread_reservation.Succeeded());
m_wakeup_event->Initialize(nullptr);
// Initialize thread.
m_thread = KThread::Create(kernel);
ASSERT(KThread::InitializeDummyThread(m_thread, m_process).IsSuccess());
// Commit the thread reservation.
thread_reservation.Commit();
ASSERT(KThread::InitializeDummyThread(m_thread, nullptr).IsSuccess());
// Start thread.
m_host_thread = std::jthread([this] { LoopProcess(); });

View File

@ -401,226 +401,129 @@ void GRenderWindow::closeEvent(QCloseEvent* event) {
}
int GRenderWindow::QtKeyToSwitchKey(Qt::Key qt_key) {
switch (qt_key) {
case Qt::Key_A:
return Settings::NativeKeyboard::A;
case Qt::Key_B:
return Settings::NativeKeyboard::B;
case Qt::Key_C:
return Settings::NativeKeyboard::C;
case Qt::Key_D:
return Settings::NativeKeyboard::D;
case Qt::Key_E:
return Settings::NativeKeyboard::E;
case Qt::Key_F:
return Settings::NativeKeyboard::F;
case Qt::Key_G:
return Settings::NativeKeyboard::G;
case Qt::Key_H:
return Settings::NativeKeyboard::H;
case Qt::Key_I:
return Settings::NativeKeyboard::I;
case Qt::Key_J:
return Settings::NativeKeyboard::J;
case Qt::Key_K:
return Settings::NativeKeyboard::K;
case Qt::Key_L:
return Settings::NativeKeyboard::L;
case Qt::Key_M:
return Settings::NativeKeyboard::M;
case Qt::Key_N:
return Settings::NativeKeyboard::N;
case Qt::Key_O:
return Settings::NativeKeyboard::O;
case Qt::Key_P:
return Settings::NativeKeyboard::P;
case Qt::Key_Q:
return Settings::NativeKeyboard::Q;
case Qt::Key_R:
return Settings::NativeKeyboard::R;
case Qt::Key_S:
return Settings::NativeKeyboard::S;
case Qt::Key_T:
return Settings::NativeKeyboard::T;
case Qt::Key_U:
return Settings::NativeKeyboard::U;
case Qt::Key_V:
return Settings::NativeKeyboard::V;
case Qt::Key_W:
return Settings::NativeKeyboard::W;
case Qt::Key_X:
return Settings::NativeKeyboard::X;
case Qt::Key_Y:
return Settings::NativeKeyboard::Y;
case Qt::Key_Z:
return Settings::NativeKeyboard::Z;
case Qt::Key_1:
return Settings::NativeKeyboard::N1;
case Qt::Key_2:
return Settings::NativeKeyboard::N2;
case Qt::Key_3:
return Settings::NativeKeyboard::N3;
case Qt::Key_4:
return Settings::NativeKeyboard::N4;
case Qt::Key_5:
return Settings::NativeKeyboard::N5;
case Qt::Key_6:
return Settings::NativeKeyboard::N6;
case Qt::Key_7:
return Settings::NativeKeyboard::N7;
case Qt::Key_8:
return Settings::NativeKeyboard::N8;
case Qt::Key_9:
return Settings::NativeKeyboard::N9;
case Qt::Key_0:
return Settings::NativeKeyboard::N0;
case Qt::Key_Return:
return Settings::NativeKeyboard::Return;
case Qt::Key_Escape:
return Settings::NativeKeyboard::Escape;
case Qt::Key_Backspace:
return Settings::NativeKeyboard::Backspace;
case Qt::Key_Tab:
return Settings::NativeKeyboard::Tab;
case Qt::Key_Space:
return Settings::NativeKeyboard::Space;
case Qt::Key_Minus:
return Settings::NativeKeyboard::Minus;
case Qt::Key_Plus:
case Qt::Key_questiondown:
return Settings::NativeKeyboard::Plus;
case Qt::Key_BracketLeft:
case Qt::Key_BraceLeft:
return Settings::NativeKeyboard::OpenBracket;
case Qt::Key_BracketRight:
case Qt::Key_BraceRight:
return Settings::NativeKeyboard::CloseBracket;
case Qt::Key_Bar:
return Settings::NativeKeyboard::Pipe;
case Qt::Key_Dead_Tilde:
return Settings::NativeKeyboard::Tilde;
case Qt::Key_Ntilde:
case Qt::Key_Semicolon:
return Settings::NativeKeyboard::Semicolon;
case Qt::Key_Apostrophe:
return Settings::NativeKeyboard::Quote;
case Qt::Key_Dead_Grave:
return Settings::NativeKeyboard::Backquote;
case Qt::Key_Comma:
return Settings::NativeKeyboard::Comma;
case Qt::Key_Period:
return Settings::NativeKeyboard::Period;
case Qt::Key_Slash:
return Settings::NativeKeyboard::Slash;
case Qt::Key_CapsLock:
return Settings::NativeKeyboard::CapsLock;
case Qt::Key_F1:
return Settings::NativeKeyboard::F1;
case Qt::Key_F2:
return Settings::NativeKeyboard::F2;
case Qt::Key_F3:
return Settings::NativeKeyboard::F3;
case Qt::Key_F4:
return Settings::NativeKeyboard::F4;
case Qt::Key_F5:
return Settings::NativeKeyboard::F5;
case Qt::Key_F6:
return Settings::NativeKeyboard::F6;
case Qt::Key_F7:
return Settings::NativeKeyboard::F7;
case Qt::Key_F8:
return Settings::NativeKeyboard::F8;
case Qt::Key_F9:
return Settings::NativeKeyboard::F9;
case Qt::Key_F10:
return Settings::NativeKeyboard::F10;
case Qt::Key_F11:
return Settings::NativeKeyboard::F11;
case Qt::Key_F12:
return Settings::NativeKeyboard::F12;
case Qt::Key_Print:
return Settings::NativeKeyboard::PrintScreen;
case Qt::Key_ScrollLock:
return Settings::NativeKeyboard::ScrollLock;
case Qt::Key_Pause:
return Settings::NativeKeyboard::Pause;
case Qt::Key_Insert:
return Settings::NativeKeyboard::Insert;
case Qt::Key_Home:
return Settings::NativeKeyboard::Home;
case Qt::Key_PageUp:
return Settings::NativeKeyboard::PageUp;
case Qt::Key_Delete:
return Settings::NativeKeyboard::Delete;
case Qt::Key_End:
return Settings::NativeKeyboard::End;
case Qt::Key_PageDown:
return Settings::NativeKeyboard::PageDown;
case Qt::Key_Right:
return Settings::NativeKeyboard::Right;
case Qt::Key_Left:
return Settings::NativeKeyboard::Left;
case Qt::Key_Down:
return Settings::NativeKeyboard::Down;
case Qt::Key_Up:
return Settings::NativeKeyboard::Up;
case Qt::Key_NumLock:
return Settings::NativeKeyboard::NumLock;
static constexpr std::array<std::pair<Qt::Key, Settings::NativeKeyboard::Keys>, 106> key_map = {
std::pair<Qt::Key, Settings::NativeKeyboard::Keys>{Qt::Key_A, Settings::NativeKeyboard::A},
{Qt::Key_A, Settings::NativeKeyboard::A},
{Qt::Key_B, Settings::NativeKeyboard::B},
{Qt::Key_C, Settings::NativeKeyboard::C},
{Qt::Key_D, Settings::NativeKeyboard::D},
{Qt::Key_E, Settings::NativeKeyboard::E},
{Qt::Key_F, Settings::NativeKeyboard::F},
{Qt::Key_G, Settings::NativeKeyboard::G},
{Qt::Key_H, Settings::NativeKeyboard::H},
{Qt::Key_I, Settings::NativeKeyboard::I},
{Qt::Key_J, Settings::NativeKeyboard::J},
{Qt::Key_K, Settings::NativeKeyboard::K},
{Qt::Key_L, Settings::NativeKeyboard::L},
{Qt::Key_M, Settings::NativeKeyboard::M},
{Qt::Key_N, Settings::NativeKeyboard::N},
{Qt::Key_O, Settings::NativeKeyboard::O},
{Qt::Key_P, Settings::NativeKeyboard::P},
{Qt::Key_Q, Settings::NativeKeyboard::Q},
{Qt::Key_R, Settings::NativeKeyboard::R},
{Qt::Key_S, Settings::NativeKeyboard::S},
{Qt::Key_T, Settings::NativeKeyboard::T},
{Qt::Key_U, Settings::NativeKeyboard::U},
{Qt::Key_V, Settings::NativeKeyboard::V},
{Qt::Key_W, Settings::NativeKeyboard::W},
{Qt::Key_X, Settings::NativeKeyboard::X},
{Qt::Key_Y, Settings::NativeKeyboard::Y},
{Qt::Key_Z, Settings::NativeKeyboard::Z},
{Qt::Key_1, Settings::NativeKeyboard::N1},
{Qt::Key_2, Settings::NativeKeyboard::N2},
{Qt::Key_3, Settings::NativeKeyboard::N3},
{Qt::Key_4, Settings::NativeKeyboard::N4},
{Qt::Key_5, Settings::NativeKeyboard::N5},
{Qt::Key_6, Settings::NativeKeyboard::N6},
{Qt::Key_7, Settings::NativeKeyboard::N7},
{Qt::Key_8, Settings::NativeKeyboard::N8},
{Qt::Key_9, Settings::NativeKeyboard::N9},
{Qt::Key_0, Settings::NativeKeyboard::N0},
{Qt::Key_Return, Settings::NativeKeyboard::Return},
{Qt::Key_Escape, Settings::NativeKeyboard::Escape},
{Qt::Key_Backspace, Settings::NativeKeyboard::Backspace},
{Qt::Key_Tab, Settings::NativeKeyboard::Tab},
{Qt::Key_Space, Settings::NativeKeyboard::Space},
{Qt::Key_Minus, Settings::NativeKeyboard::Minus},
{Qt::Key_Plus, Settings::NativeKeyboard::Plus},
{Qt::Key_questiondown, Settings::NativeKeyboard::Plus},
{Qt::Key_BracketLeft, Settings::NativeKeyboard::OpenBracket},
{Qt::Key_BraceLeft, Settings::NativeKeyboard::OpenBracket},
{Qt::Key_BracketRight, Settings::NativeKeyboard::CloseBracket},
{Qt::Key_BraceRight, Settings::NativeKeyboard::CloseBracket},
{Qt::Key_Bar, Settings::NativeKeyboard::Pipe},
{Qt::Key_Dead_Tilde, Settings::NativeKeyboard::Tilde},
{Qt::Key_Ntilde, Settings::NativeKeyboard::Semicolon},
{Qt::Key_Semicolon, Settings::NativeKeyboard::Semicolon},
{Qt::Key_Apostrophe, Settings::NativeKeyboard::Quote},
{Qt::Key_Dead_Grave, Settings::NativeKeyboard::Backquote},
{Qt::Key_Comma, Settings::NativeKeyboard::Comma},
{Qt::Key_Period, Settings::NativeKeyboard::Period},
{Qt::Key_Slash, Settings::NativeKeyboard::Slash},
{Qt::Key_CapsLock, Settings::NativeKeyboard::CapsLockKey},
{Qt::Key_F1, Settings::NativeKeyboard::F1},
{Qt::Key_F2, Settings::NativeKeyboard::F2},
{Qt::Key_F3, Settings::NativeKeyboard::F3},
{Qt::Key_F4, Settings::NativeKeyboard::F4},
{Qt::Key_F5, Settings::NativeKeyboard::F5},
{Qt::Key_F6, Settings::NativeKeyboard::F6},
{Qt::Key_F7, Settings::NativeKeyboard::F7},
{Qt::Key_F8, Settings::NativeKeyboard::F8},
{Qt::Key_F9, Settings::NativeKeyboard::F9},
{Qt::Key_F10, Settings::NativeKeyboard::F10},
{Qt::Key_F11, Settings::NativeKeyboard::F11},
{Qt::Key_F12, Settings::NativeKeyboard::F12},
{Qt::Key_Print, Settings::NativeKeyboard::PrintScreen},
{Qt::Key_ScrollLock, Settings::NativeKeyboard::ScrollLockKey},
{Qt::Key_Pause, Settings::NativeKeyboard::Pause},
{Qt::Key_Insert, Settings::NativeKeyboard::Insert},
{Qt::Key_Home, Settings::NativeKeyboard::Home},
{Qt::Key_PageUp, Settings::NativeKeyboard::PageUp},
{Qt::Key_Delete, Settings::NativeKeyboard::Delete},
{Qt::Key_End, Settings::NativeKeyboard::End},
{Qt::Key_PageDown, Settings::NativeKeyboard::PageDown},
{Qt::Key_Right, Settings::NativeKeyboard::Right},
{Qt::Key_Left, Settings::NativeKeyboard::Left},
{Qt::Key_Down, Settings::NativeKeyboard::Down},
{Qt::Key_Up, Settings::NativeKeyboard::Up},
{Qt::Key_NumLock, Settings::NativeKeyboard::NumLockKey},
// Numpad keys are missing here
case Qt::Key_F13:
return Settings::NativeKeyboard::F13;
case Qt::Key_F14:
return Settings::NativeKeyboard::F14;
case Qt::Key_F15:
return Settings::NativeKeyboard::F15;
case Qt::Key_F16:
return Settings::NativeKeyboard::F16;
case Qt::Key_F17:
return Settings::NativeKeyboard::F17;
case Qt::Key_F18:
return Settings::NativeKeyboard::F18;
case Qt::Key_F19:
return Settings::NativeKeyboard::F19;
case Qt::Key_F20:
return Settings::NativeKeyboard::F20;
case Qt::Key_F21:
return Settings::NativeKeyboard::F21;
case Qt::Key_F22:
return Settings::NativeKeyboard::F22;
case Qt::Key_F23:
return Settings::NativeKeyboard::F23;
case Qt::Key_F24:
return Settings::NativeKeyboard::F24;
// case Qt:::
// return Settings::NativeKeyboard::KPComma;
// case Qt:::
// return Settings::NativeKeyboard::Ro;
case Qt::Key_Hiragana_Katakana:
return Settings::NativeKeyboard::KatakanaHiragana;
case Qt::Key_yen:
return Settings::NativeKeyboard::Yen;
case Qt::Key_Henkan:
return Settings::NativeKeyboard::Henkan;
case Qt::Key_Muhenkan:
return Settings::NativeKeyboard::Muhenkan;
// case Qt:::
// return Settings::NativeKeyboard::NumPadCommaPc98;
case Qt::Key_Hangul:
return Settings::NativeKeyboard::HangulEnglish;
case Qt::Key_Hangul_Hanja:
return Settings::NativeKeyboard::Hanja;
case Qt::Key_Katakana:
return Settings::NativeKeyboard::KatakanaKey;
case Qt::Key_Hiragana:
return Settings::NativeKeyboard::HiraganaKey;
case Qt::Key_Zenkaku_Hankaku:
return Settings::NativeKeyboard::ZenkakuHankaku;
{Qt::Key_F13, Settings::NativeKeyboard::F13},
{Qt::Key_F14, Settings::NativeKeyboard::F14},
{Qt::Key_F15, Settings::NativeKeyboard::F15},
{Qt::Key_F16, Settings::NativeKeyboard::F16},
{Qt::Key_F17, Settings::NativeKeyboard::F17},
{Qt::Key_F18, Settings::NativeKeyboard::F18},
{Qt::Key_F19, Settings::NativeKeyboard::F19},
{Qt::Key_F20, Settings::NativeKeyboard::F20},
{Qt::Key_F21, Settings::NativeKeyboard::F21},
{Qt::Key_F22, Settings::NativeKeyboard::F22},
{Qt::Key_F23, Settings::NativeKeyboard::F23},
{Qt::Key_F24, Settings::NativeKeyboard::F24},
// {Qt::..., Settings::NativeKeyboard::KPComma},
// {Qt::..., Settings::NativeKeyboard::Ro},
{Qt::Key_Hiragana_Katakana, Settings::NativeKeyboard::KatakanaHiragana},
{Qt::Key_yen, Settings::NativeKeyboard::Yen},
{Qt::Key_Henkan, Settings::NativeKeyboard::Henkan},
{Qt::Key_Muhenkan, Settings::NativeKeyboard::Muhenkan},
// {Qt::..., Settings::NativeKeyboard::NumPadCommaPc98},
{Qt::Key_Hangul, Settings::NativeKeyboard::HangulEnglish},
{Qt::Key_Hangul_Hanja, Settings::NativeKeyboard::Hanja},
{Qt::Key_Katakana, Settings::NativeKeyboard::KatakanaKey},
{Qt::Key_Hiragana, Settings::NativeKeyboard::HiraganaKey},
{Qt::Key_Zenkaku_Hankaku, Settings::NativeKeyboard::ZenkakuHankaku},
// Modifier keys are handled by the modifier property
default:
return Settings::NativeKeyboard::None;
};
for (const auto& [qkey, nkey] : key_map) {
if (qt_key == qkey) {
return nkey;
}
}
return Settings::NativeKeyboard::None;
}
int GRenderWindow::QtModifierToSwitchModifier(Qt::KeyboardModifiers qt_modifiers) {
int modifier = 0;

View File

@ -65,9 +65,9 @@
<attribute name="pageId">
<string notr="true">1</string>
</attribute>
<layout class="QFormLayout" name="formLayout">
<layout class="QFormLayout" name="formLayout1">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lbl_Independent">
<widget class="QLabel" name="lbl_Independent1">
<property name="font">
<font>
<pointsize>10</pointsize>
@ -82,7 +82,7 @@
</widget>
</item>
<item row="1" column="0" colspan="2">
<spacer name="verticalSpacer">
<spacer name="verticalSpacer1">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -104,7 +104,7 @@
<item row="4" column="0">
<widget class="QRadioButton" name="radioButton_GameBoot_No">
<property name="text">
<string>No The game doesn't get past the "Launching..." screen</string>
<string>No The game doesn't get past the &quot;Launching...&quot; screen</string>
</property>
</widget>
</item>
@ -117,7 +117,7 @@
<attribute name="pageId">
<string notr="true">2</string>
</attribute>
<layout class="QFormLayout" name="formLayout">
<layout class="QFormLayout" name="formLayout2">
<item row="2" column="0">
<widget class="QRadioButton" name="radioButton_Gameplay_Yes">
<property name="text">
@ -133,7 +133,7 @@
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lbl_Independent">
<widget class="QLabel" name="lbl_Independent2">
<property name="font">
<font>
<pointsize>10</pointsize>
@ -148,7 +148,7 @@
</widget>
</item>
<item row="1" column="0" colspan="2">
<spacer name="verticalSpacer">
<spacer name="verticalSpacer2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -169,7 +169,7 @@
<attribute name="pageId">
<string notr="true">3</string>
</attribute>
<layout class="QFormLayout" name="formLayout">
<layout class="QFormLayout" name="formLayout3">
<item row="2" column="0">
<widget class="QRadioButton" name="radioButton_NoFreeze_Yes">
<property name="text">
@ -185,7 +185,7 @@
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lbl_Independent">
<widget class="QLabel" name="lbl_Independent3">
<property name="font">
<font>
<pointsize>10</pointsize>
@ -200,7 +200,7 @@
</widget>
</item>
<item row="1" column="0" colspan="2">
<spacer name="verticalSpacer">
<spacer name="verticalSpacer3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -221,7 +221,7 @@
<attribute name="pageId">
<string notr="true">4</string>
</attribute>
<layout class="QFormLayout" name="formLayout">
<layout class="QFormLayout" name="formLayout4">
<item row="2" column="0">
<widget class="QRadioButton" name="radioButton_Complete_Yes">
<property name="text">
@ -237,7 +237,7 @@
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lbl_Independent">
<widget class="QLabel" name="lbl_Independent4">
<property name="font">
<font>
<pointsize>10</pointsize>
@ -252,7 +252,7 @@
</widget>
</item>
<item row="1" column="0" colspan="2">
<spacer name="verticalSpacer">
<spacer name="verticalSpacer4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -273,7 +273,7 @@
<attribute name="pageId">
<string notr="true">5</string>
</attribute>
<layout class="QFormLayout" name="formLayout">
<layout class="QFormLayout" name="formLayout5">
<item row="2" column="0">
<widget class="QRadioButton" name="radioButton_Graphical_Major">
<property name="text">
@ -296,7 +296,7 @@
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lbl_Independent">
<widget class="QLabel" name="lbl_Independent5">
<property name="font">
<font>
<pointsize>10</pointsize>
@ -311,7 +311,7 @@
</widget>
</item>
<item row="1" column="0" colspan="2">
<spacer name="verticalSpacer">
<spacer name="verticalSpacer5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -332,7 +332,7 @@
<attribute name="pageId">
<string notr="true">6</string>
</attribute>
<layout class="QFormLayout" name="formLayout">
<layout class="QFormLayout" name="formLayout6">
<item row="2" column="0">
<widget class="QRadioButton" name="radioButton_Audio_Major">
<property name="text">
@ -355,7 +355,7 @@
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lbl_Independent">
<widget class="QLabel" name="lbl_Independent6">
<property name="font">
<font>
<pointsize>10</pointsize>
@ -370,7 +370,7 @@
</widget>
</item>
<item row="1" column="0" colspan="2">
<spacer name="verticalSpacer">
<spacer name="verticalSpacer6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>