feat: orbis lib progress

This commit is contained in:
str1k3r committed 2026-11-10 20:28:20 -05:00
1 parent b96c98cf25
commit 7c5312a69c
5 files changed
+167 -17

No files matched your search

+161 -16
View File
@@ -80,12 +80,22 @@ void CInput::Initialise(int iInputStateC, unsigned char ucMapC, unsigned char uc
m_ucJoypadMapActionC = ucActionC;
m_ucMenuActionC = ucMenuActionC;
m_bJoypadMapArrayIsSetup = false;
#if TO_BE_IMPLEMENTED
*((_QWORD *)this + 1024) = malloc(SCE_REMOTEPLAY_HEAP_SIZE);
int remotePlayInit = sceRemoteplayInitialize(*((_QWORD *)this + 1024), SCE_REMOTEPLAY_HEAP_SIZE);
if (remotePlayInit != SCE_OK)
InternalInputManager.DebugPrintf("sceRemoteplayInitialize failed with error code: %X\n", remotePlayInit);
#endif
}
void CInput::Tick()
{
UpdateJoypads();
m_Keyboard.Tick();
#if TO_BE_IMPLEMENTED
UpdateRemotePlay();
#endif
}
void CInput::SetJoypadValues(JOYPAD *pThisPad)
@@ -95,82 +105,82 @@ void CInput::SetJoypadValues(JOYPAD *pThisPad)
pThisPad->m_uiButtons = pThisPad->m_uiOldButtons;
//str1k3r - decomp uses pThisPad->m_uiButtons not pGamePad->buttons
if (pGamePad->buttons == SCE_PAD_BUTTON_CROSS)
if ((pGamePad->buttons & SCE_PAD_BUTTON_CROSS) != 0)
{
pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_X;
}
if (pGamePad->buttons == SCE_PAD_BUTTON_CIRCLE)
if ((pGamePad->buttons & SCE_PAD_BUTTON_CIRCLE) != 0)
{
pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_O;
}
if (pGamePad->buttons == SCE_PAD_BUTTON_SQUARE)
if ((pGamePad->buttons & SCE_PAD_BUTTON_SQUARE) != 0)
{
pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_SQUARE;
}
if (pGamePad->buttons == SCE_PAD_BUTTON_TRIANGLE)
if ((pGamePad->buttons & SCE_PAD_BUTTON_TRIANGLE) != 0)
{
pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_TRIANGLE;
}
if (pGamePad->buttons == SCE_PAD_BUTTON_R2)
if ((pGamePad->buttons & SCE_PAD_BUTTON_R2) != 0)
{
pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_R2;
}
if (pGamePad->buttons == SCE_PAD_BUTTON_L2)
if ((pGamePad->buttons & SCE_PAD_BUTTON_L2) != 0)
{
pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_L2;
}
if (pGamePad->buttons == SCE_PAD_BUTTON_R1)
if ((pGamePad->buttons & SCE_PAD_BUTTON_R1) != 0)
{
pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_R1;
}
if (pGamePad->buttons == SCE_PAD_BUTTON_L1)
if ((pGamePad->buttons & SCE_PAD_BUTTON_L1) != 0)
{
pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_L1;
}
if (pGamePad->buttons == SCE_PAD_BUTTON_OPTIONS)
if ((pGamePad->buttons & SCE_PAD_BUTTON_OPTIONS) != 0)
{
pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_OPTIONS;
}
if (pGamePad->buttons == SCE_PAD_BUTTON_TOUCH_PAD)
if ((pGamePad->buttons & SCE_PAD_BUTTON_TOUCH_PAD) != 0)
{
pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_TOUCHPAD;
}
if (pGamePad->buttons == SCE_PAD_BUTTON_R3)
if ((pGamePad->buttons & SCE_PAD_BUTTON_R3) != 0)
{
pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_R3;
}
if (pGamePad->buttons == SCE_PAD_BUTTON_L3)
if ((pGamePad->buttons & SCE_PAD_BUTTON_L3) != 0)
{
pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_L3;
}
if (pGamePad->buttons == SCE_PAD_BUTTON_UP)
if ((pGamePad->buttons & SCE_PAD_BUTTON_UP) != 0)
{
pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_DPAD_UP;
}
if (pGamePad->buttons == SCE_PAD_BUTTON_DOWN)
if ((pGamePad->buttons & SCE_PAD_BUTTON_DOWN) != 0)
{
pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_DPAD_DOWN;
}
if (pGamePad->buttons == SCE_PAD_BUTTON_LEFT)
if ((pGamePad->buttons & SCE_PAD_BUTTON_LEFT) != 0)
{
pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_DPAD_LEFT;
}
if (pGamePad->buttons == SCE_PAD_BUTTON_RIGHT)
if ((pGamePad->buttons & SCE_PAD_BUTTON_RIGHT) != 0)
{
pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_DPAD_RIGHT;
}
@@ -534,12 +544,147 @@ bool CInput::UpdateJoypads()
if (ProfileManager.IsSignedIn(i))
{
SceUserServiceUserId UserID = ProfileManager.getUserID(i);
m_Joypads[i].m_iScePadHandle = scePadOpen(UserID, SCE_PAD_PORT_TYPE_STANDARD, 0, NULL);
if (m_Joypads[i].m_iScePadHandle >= 0)
{
if (!m_Joypads[i].m_bIsDisabled)
{
JOYPAD *pThisPad = &m_Joypads[i];
bool bOldIsConnected = pThisPad->m_bIsConnected;
pThisPad->m_ucInputStateIndex++;
if (pThisPad->m_ucInputStateIndex == m_ucInputStateC)
{
pThisPad->m_ucInputStateIndex = 0;
}
ScePadData *pState = &pThisPad->m_pInputStates[pThisPad->m_ucInputStateIndex];
scePadRead(pThisPad->m_iScePadHandle, pState, 1);
pThisPad->m_bIsConnected = pState->connected;
if (!pThisPad->m_bIsConnected)
memset(pState, 0, sizeof(ScePadData));
bool bWasConnected = bOldIsConnected && !pThisPad->m_bIsConnected;
pThisPad->m_bWasConnected = bWasConnected;
bool bHasConnected = !bOldIsConnected && pThisPad->m_bIsConnected;
pThisPad->m_bHasConnected = bHasConnected;
if (pThisPad->m_bIsConnected)
{
SetJoypadValues(pThisPad);
/*if (pThisPad[128] && pThisPad[104])
{
/*v9 = *((unsigned __int16 *)pThisPad + 56) - *((unsigned __int16 *)pThisPad + 68);
x = *((unsigned __int16 *)pThisPad + 57) - *((unsigned __int16 *)pThisPad + 69);
v4 = abs(x);
if (v4 <= abs(v9))
{
if (v9 <= 50)
{
if (v9 < -50)
*((_DWORD *)pThisPad + 1) |= 0x8000u;
}
else
{
*((_DWORD *)pThisPad + 1) |= 0x4000u;
}
}
else if (x <= 50)
{
if (x < -50)
*((_DWORD *)pThisPad + 1) |= 0x200000u;
}
else
{
*((_DWORD *)pThisPad + 1) |= 0x100000u;
}
}*/
pThisPad->m_uiButtonsPressed = ~pThisPad->m_uiOldButtons & pThisPad->m_uiButtons;
pThisPad->m_uiButtonsReleased = ~pThisPad->m_uiButtons & pThisPad->m_uiOldButtons;
for (int bit = 0; bit < 24; ++bit)
{
if ((pThisPad->m_uiButtonsPressed & (1 << bit)) != 0)
{
GetStartTime(i, bit);
}
else if ((pThisPad->m_uiButtons & (1 << bit)) != 0)
{
UpdateTime(i, bit);
}
}
}
else if (pThisPad->m_bWasConnected)
{
ClearJoypadValues(pThisPad);
}
}
}
}
else if (m_Joypads[i].m_iScePadHandle >= 0)
{
scePadClose(m_Joypads[i].m_iScePadHandle);
m_Joypads[i].m_iScePadHandle = -1;
m_Joypads[i].m_ucInputStateIndex = 0;
}
}
return true;
}
bool CInput::UpdateRemotePlay()
{
#if TO_BE_IMPLEMENTED
unsigned int v1;
int v2;
int v4;
int RemotePlayer;
char v6;
int tickCount = GetTickCount();
v1 = TickCount - *((_DWORD *)this + 2043);
if (v1 > 0x3E8)
{
*((_DWORD *)this + 2043) = TickCount;
LOBYTE(v1) = CInput::UsingRemotePlay(this) & 1;
v6 = v1;
if ((v1 & 1) == 0 || (LOBYTE(v1) = (_BYTE)this, (*((_BYTE *)this + 8168) & 1) != 0))
{
if ((v6 & 1) == 0)
{
LOBYTE(v1) = (_BYTE)this;
if ((*((_BYTE *)this + 8168) & 1) != 0)
LOBYTE(v1) = CInput::OnRemotePlayEnd(this);
}
}
else
{
RemotePlayer = CInput::GetRemotePlayer(this);
if ((CInput::IsRemotePlayAllowed(this, RemotePlayer) & 1) != 0)
{
v4 = sceRemoteplayApprove();
if (v4)
CInput::DebugPrintf(this, "CInput:: Remote play approve failed with error code: %X\n", v4);
v2 = CInput::GetRemotePlayer(this);
LOBYTE(v1) = CInput::OnRemotePlayStart(this, v2);
}
else
{
CInput::DebugPrintf(this, "CInput:: Remote play starting but not currently allowed, calling to prohibit\n");
v1 = sceRemoteplayProhibit();
if (v1)
LOBYTE(v1) = CInput::DebugPrintf(this, "CInput:: Remote play prohibit failed with error code: %X\n", v1);
}
}
}
return v1;
#endif
}
void CInput::ClearJoypadValues(JOYPAD *pThisPad)
{
pThisPad->m_uiButtonsPressed = 0;
+3
View File
@@ -12,6 +12,7 @@ public:
struct JOYPAD
{
bool m_bIsDisabled;
bool m_bIsConnected;
bool m_bWasConnected;
bool m_bHasConnected;
@@ -45,6 +46,7 @@ public:
float *m_pfRightThumbYAxisMap;
float m_fSensitivity;
int m_iScePadHandle;
BYTE *m_pucLeftTriggerAxisMap;
BYTE *m_pucRightTriggerAxisMap;
@@ -115,6 +117,7 @@ public:
FLOAT GetIdleSeconds(int iPad);
bool UpdateJoypads();
bool UpdateRemotePlay();
void ClearJoypadValues(JOYPAD *pThisPad);
void InitTime(void);
void GetStartTime(int iPad, int iKey);
+1
View File
@@ -19,6 +19,7 @@
#include <kernel.h>
#include <stdarg.h>
#include <scebase.h>
#include <remoteplay.h>
#include <message_dialog.h>
#endif