Compare commits
3 Commits
18b484b05b
...
2757a1e6dc
Author | SHA1 | Date |
---|---|---|
The-Little-Wolf | 2757a1e6dc | |
The-Little-Wolf | 80a5aa907d | |
Gliniak | 11f14e8488 |
|
@ -41,7 +41,8 @@ void InputSystem::AddDriver(std::unique_ptr<InputDriver> driver) {
|
|||
void InputSystem::UpdateUsedSlot(InputDriver* driver, uint8_t slot,
|
||||
bool connected) {
|
||||
if (slot == XUserIndexAny) {
|
||||
slot = 0;
|
||||
XELOGW("{} received requrest for slot any! Unsupported", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (connected_slots.test(slot) == connected) {
|
||||
|
@ -136,18 +137,16 @@ X_RESULT InputSystem::GetKeystroke(uint32_t user_index, uint32_t flags,
|
|||
|
||||
bool any_connected = false;
|
||||
for (auto& driver : drivers_) {
|
||||
// connected_slots
|
||||
X_RESULT result = driver->GetKeystroke(user_index, flags, out_keystroke);
|
||||
if (result == X_ERROR_INVALID_PARAMETER) {
|
||||
if (result == X_ERROR_INVALID_PARAMETER ||
|
||||
result == X_ERROR_DEVICE_NOT_CONNECTED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (result != X_ERROR_DEVICE_NOT_CONNECTED) {
|
||||
any_connected = true;
|
||||
}
|
||||
any_connected = true;
|
||||
|
||||
if (result == X_ERROR_SUCCESS || result == X_ERROR_EMPTY) {
|
||||
UpdateUsedSlot(driver.get(), user_index, any_connected);
|
||||
|
||||
if (result == X_ERROR_SUCCESS) {
|
||||
last_used_slot = user_index;
|
||||
}
|
||||
|
@ -158,7 +157,6 @@ X_RESULT InputSystem::GetKeystroke(uint32_t user_index, uint32_t flags,
|
|||
continue;
|
||||
}
|
||||
}
|
||||
UpdateUsedSlot(nullptr, user_index, any_connected);
|
||||
return any_connected ? X_ERROR_EMPTY : X_ERROR_DEVICE_NOT_CONNECTED;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace xe {
|
|||
namespace hid {
|
||||
namespace winkey {
|
||||
|
||||
bool static IsPassthroughEnabled(uint32_t user_index) {
|
||||
bool static IsPassthroughEnabled() {
|
||||
return static_cast<KeyboardMode>(cvars::keyboard_mode) ==
|
||||
KeyboardMode::Passthrough;
|
||||
}
|
||||
|
@ -272,6 +272,14 @@ X_RESULT WinKeyInputDriver::SetState(uint32_t user_index,
|
|||
|
||||
X_RESULT WinKeyInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags,
|
||||
X_INPUT_KEYSTROKE* out_keystroke) {
|
||||
if (!is_active()) {
|
||||
return X_ERROR_DEVICE_NOT_CONNECTED;
|
||||
}
|
||||
|
||||
if (!IsKeyboardForUserEnabled(user_index) && !IsPassthroughEnabled()) {
|
||||
return X_ERROR_DEVICE_NOT_CONNECTED;
|
||||
}
|
||||
|
||||
// Pop from the queue.
|
||||
KeyEvent evt;
|
||||
{
|
||||
|
@ -284,15 +292,6 @@ X_RESULT WinKeyInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags,
|
|||
key_events_.pop();
|
||||
}
|
||||
|
||||
if (!IsKeyboardForUserEnabled(user_index) &&
|
||||
!IsPassthroughEnabled(user_index)) {
|
||||
return X_ERROR_DEVICE_NOT_CONNECTED;
|
||||
}
|
||||
|
||||
if (!is_active()) {
|
||||
return X_ERROR_EMPTY;
|
||||
}
|
||||
|
||||
X_RESULT result = X_ERROR_EMPTY;
|
||||
|
||||
ui::VirtualKey xinput_virtual_key = ui::VirtualKey::kNone;
|
||||
|
@ -302,7 +301,7 @@ X_RESULT WinKeyInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags,
|
|||
|
||||
bool capital = IsKeyToggled(VK_CAPITAL) || IsKeyDown(VK_SHIFT);
|
||||
|
||||
if (!IsPassthroughEnabled(user_index)) {
|
||||
if (!IsPassthroughEnabled()) {
|
||||
if (IsKeyboardForUserEnabled(user_index)) {
|
||||
for (const KeyBinding& b : key_bindings_) {
|
||||
if (b.input_key == evt.virtual_key &&
|
||||
|
@ -338,7 +337,7 @@ X_RESULT WinKeyInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags,
|
|||
keystroke_flags |= 0x0002; // XINPUT_KEYSTROKE_KEYUP
|
||||
}
|
||||
|
||||
if (IsPassthroughEnabled(user_index)) {
|
||||
if (IsPassthroughEnabled()) {
|
||||
if (GetKeyboardState(key_map_)) {
|
||||
WCHAR buf;
|
||||
if (ToUnicode(uint8_t(xinput_virtual_key), 0, key_map_, &buf, 1, 0) ==
|
||||
|
@ -373,7 +372,8 @@ void WinKeyInputDriver::WinKeyWindowInputListener::OnKeyUp(ui::KeyEvent& e) {
|
|||
}
|
||||
|
||||
void WinKeyInputDriver::OnKey(ui::KeyEvent& e, bool is_down) {
|
||||
if (!is_active()) {
|
||||
if (!is_active() || static_cast<KeyboardMode>(cvars::keyboard_mode) ==
|
||||
KeyboardMode::Disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2022 Ben Vanik. All rights reserved. *
|
||||
* Copyright 2024 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
@ -17,8 +17,9 @@ namespace xe {
|
|||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
// Start/End
|
||||
dword_result_t XamAvatarInitialize_entry(
|
||||
dword_t unk1, // 1, 4, etc
|
||||
dword_t unk1, // 1, 2, 4, etc
|
||||
dword_t unk2, // 0 or 1
|
||||
dword_t processor_number, // for thread creation?
|
||||
lpdword_t function_ptrs, // 20b, 5 pointers
|
||||
|
@ -26,15 +27,179 @@ dword_result_t XamAvatarInitialize_entry(
|
|||
dword_t unk6 // flags - 0x00300000, 0x30, etc
|
||||
) {
|
||||
// Negative to fail. Game should immediately call XamAvatarShutdown.
|
||||
return ~0u;
|
||||
return X_STATUS_SUCCESS; //~0u;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarInitialize, kAvatars, kStub);
|
||||
|
||||
void XamAvatarShutdown_entry() {
|
||||
// No-op.
|
||||
// Calls XMsgStartIORequestEx(0xf3,0x600002,0,0,0,0).
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarShutdown, kAvatars, kStub);
|
||||
|
||||
// Get & Set
|
||||
dword_result_t XamAvatarGetManifestLocalUser_entry(dword_t unk1, dword_t unk2,
|
||||
qword_t unk3) {
|
||||
// XMsgStartIORequestEx(0xf3, 0x600003, unk3, stack1, 8, 0)
|
||||
|
||||
XELOGD("Stubbed");
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarGetManifestLocalUser, kAvatars, kStub);
|
||||
|
||||
dword_result_t XamAvatarGetManifestsByXuid_entry(dword_t unk1, qword_t unk2,
|
||||
qword_t unk3, dword_t unk4,
|
||||
dword_t unk5, qword_t unk6) {
|
||||
// Function_818D1738(0x600004,param_6,&uStack_d0,0x90,0)
|
||||
|
||||
XELOGD("Stubbed");
|
||||
return X_E_ACCESS_DENIED;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarGetManifestsByXuid, kAvatars, kStub)
|
||||
|
||||
dword_result_t XamAvatarGetAssetsResultSize_entry(qword_t unk1, qword_t unk2,
|
||||
dword_t unk3) {
|
||||
// return XMsgInProcessCall(0xf3,0x600005,local_20,0);
|
||||
|
||||
XELOGD("Stubbed");
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarGetAssetsResultSize, kAvatars, kStub);
|
||||
|
||||
dword_result_t XamAvatarGetAssets_entry(qword_t unk1, word_t unk2, dword_t unk3,
|
||||
dword_t unk4, dword_t unk5,
|
||||
qword_t unk6) {
|
||||
XELOGD("Stubbed");
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarGetAssets, kAvatars, kStub);
|
||||
|
||||
dword_result_t XamAvatarSetCustomAsset_entry(qword_t unk1, qword_t unk2,
|
||||
dword_t unk3, dword_t unk4,
|
||||
dword_t unk5, dword_t unk6) {
|
||||
// XMsgInProcessCall(0xf3,0x60000a,local_30,0);
|
||||
|
||||
XELOGD("Stubbed");
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarSetCustomAsset, kAvatars, kStub)
|
||||
|
||||
dword_result_t XamAvatarSetManifest_entry(qword_t unk1, qword_t unk2,
|
||||
qword_t unk3) {
|
||||
// Function_818D1738(0x600009,param_3,&local_410,0x3ec,0);
|
||||
|
||||
XELOGD("Stubbed");
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarSetManifest, kAvatars, kStub);
|
||||
|
||||
dword_result_t XamAvatarGetMetadataRandom_entry(qword_t unk1, qword_t unk2,
|
||||
dword_t unk3, qword_t unk4) {
|
||||
XELOGD("Stubbed");
|
||||
// some_function(0x600010,param_4,local_28,0xc,local_30)
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarGetMetadataRandom, kAvatars, kStub);
|
||||
|
||||
dword_result_t XamAvatarManifestGetBodyType_entry(qword_t body_type) {
|
||||
// return either char of 1 - male, 2 - female, else - unknown
|
||||
XELOGD("Stubbed");
|
||||
return '\x01';
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarManifestGetBodyType, kAvatars, kStub);
|
||||
|
||||
dword_result_t XamAvatarGetInstrumentation_entry(qword_t unk1, lpdword_t unk2) {
|
||||
return 1;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarGetInstrumentation, kAvatars, kStub);
|
||||
|
||||
dword_result_t XamAvatarGetAssetIcon_entry(lpqword_t unk1, dword_t unk2,
|
||||
dword_t unk3, dword_t unk4,
|
||||
qword_t unk5) {
|
||||
// XMsgStartIORequestEx(0xf3, 0x60000B, unk5, stack1, 0x1C, 0x10000000)
|
||||
|
||||
XELOGD("Stubbed");
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarGetAssetIcon, kAvatars, kStub);
|
||||
|
||||
dword_result_t XamAvatarGetAssetBinary_entry(lpqword_t unk1, dword_t unk2,
|
||||
dword_t unk3, dword_t unk4,
|
||||
qword_t unk5) {
|
||||
// Function_818D1738(0x600008,param_5,&uStack_60,0x1c,auStack_70);
|
||||
|
||||
XELOGD("Stubbed");
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarGetAssetBinary, kAvatars, kStub);
|
||||
|
||||
dword_result_t XamAvatarGetInstalledAssetPackageDescription_entry(
|
||||
qword_t unk1, qword_t unk2) {
|
||||
XELOGD("Stubbed");
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarGetInstalledAssetPackageDescription, kAvatars,
|
||||
kStub);
|
||||
|
||||
void XamAvatarSetMocks_entry() {
|
||||
// No-op.
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarSetMocks, kAvatars, kStub);
|
||||
|
||||
// Animation
|
||||
|
||||
// https://github.com/xenia-canary/xenia-canary/commit/212c99eee2724de15f471148d10197d89794ff32
|
||||
dword_result_t XamAvatarLoadAnimation_entry(lpqword_t asset_id_ptr,
|
||||
dword_t flags, dword_t output,
|
||||
qword_t unk1) {
|
||||
// XMsgStartIORequestEx(0xf3, 0x60000F, unk4, stack1, 0x18, 0x10000000)
|
||||
|
||||
XELOGD("Stubbed");
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarLoadAnimation, kAvatars, kStub);
|
||||
|
||||
// Enum
|
||||
dword_result_t XamAvatarBeginEnumAssets_entry(qword_t unk1, qword_t unk2,
|
||||
dword_t unk3, int_t unk4,
|
||||
dword_t unk5, qword_t unk6) {
|
||||
// XMsgStartIORequestEx(0xf3, 0x60000c, unkn6, stack1, 0x14, stack2)
|
||||
XELOGD("Stubbed");
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarBeginEnumAssets, kAvatars, kStub);
|
||||
|
||||
dword_result_t XamAvatarEnumAssets_entry(dword_t unk1, dword_t unk2,
|
||||
qword_t unk3) {
|
||||
// XMsgStartIORequestEx(0xf3, 0x60000d, unk3, stack1, 8, stack2)
|
||||
|
||||
XELOGD("Stubbed");
|
||||
return X_E_NO_MORE_FILES; // Stop it from calling endlessly
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarEnumAssets, kAvatars, kStub);
|
||||
|
||||
dword_result_t XamAvatarEndEnumAssets_entry(qword_t unk1) {
|
||||
// some_function(0x60000e,param_1,0,0,local_10)
|
||||
|
||||
XELOGD("Stubbed");
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarEndEnumAssets, kAvatars, kStub);
|
||||
|
||||
// Other
|
||||
dword_result_t XamAvatarWearNow_entry(qword_t unk1, lpdword_t unk2,
|
||||
qword_t unk3) {
|
||||
XELOGD("Stubbed");
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarWearNow, kAvatars, kStub);
|
||||
|
||||
dword_result_t XamAvatarReinstallAwardedAsset_entry(qword_t unk1, qword_t unk2,
|
||||
qword_t unk3) {
|
||||
XELOGD("Stubbed");
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamAvatarReinstallAwardedAsset, kAvatars, kStub);
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
|
|
@ -121,6 +121,7 @@ typedef uint32_t X_HRESULT;
|
|||
|
||||
#define X_E_FALSE static_cast<X_HRESULT>(0x80000000L)
|
||||
#define X_E_SUCCESS X_HRESULT_FROM_WIN32(X_ERROR_SUCCESS)
|
||||
#define X_E_ACCESS_DENIED X_HRESULT_FROM_WIN32(X_ERROR_ACCESS_DENIED)
|
||||
#define X_E_FAIL static_cast<X_HRESULT>(0x80004005L)
|
||||
#define X_E_NO_MORE_FILES X_HRESULT_FROM_WIN32(X_ERROR_NO_MORE_FILES)
|
||||
#define X_E_INVALIDARG X_HRESULT_FROM_WIN32(X_ERROR_INVALID_PARAMETER)
|
||||
|
|
Loading…
Reference in New Issue