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_ucJoypadMapActionC = ucActionC;
m_ucMenuActionC = ucMenuActionC; m_ucMenuActionC = ucMenuActionC;
m_bJoypadMapArrayIsSetup = false; 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() void CInput::Tick()
{ {
UpdateJoypads(); UpdateJoypads();
m_Keyboard.Tick(); m_Keyboard.Tick();
#if TO_BE_IMPLEMENTED
UpdateRemotePlay();
#endif
} }
void CInput::SetJoypadValues(JOYPAD *pThisPad) void CInput::SetJoypadValues(JOYPAD *pThisPad)
@@ -95,82 +105,82 @@ void CInput::SetJoypadValues(JOYPAD *pThisPad)
pThisPad->m_uiButtons = pThisPad->m_uiOldButtons; pThisPad->m_uiButtons = pThisPad->m_uiOldButtons;
//str1k3r - decomp uses pThisPad->m_uiButtons not pGamePad->buttons //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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; pThisPad->m_uiButtons |= _PS4_JOY_BUTTON_DPAD_RIGHT;
} }
@@ -534,12 +544,147 @@ bool CInput::UpdateJoypads()
if (ProfileManager.IsSignedIn(i)) if (ProfileManager.IsSignedIn(i))
{ {
SceUserServiceUserId UserID = ProfileManager.getUserID(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; 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) void CInput::ClearJoypadValues(JOYPAD *pThisPad)
{ {
pThisPad->m_uiButtonsPressed = 0; pThisPad->m_uiButtonsPressed = 0;
+3
View File
@@ -12,6 +12,7 @@ public:
struct JOYPAD struct JOYPAD
{ {
bool m_bIsDisabled;
bool m_bIsConnected; bool m_bIsConnected;
bool m_bWasConnected; bool m_bWasConnected;
bool m_bHasConnected; bool m_bHasConnected;
@@ -45,6 +46,7 @@ public:
float *m_pfRightThumbYAxisMap; float *m_pfRightThumbYAxisMap;
float m_fSensitivity; float m_fSensitivity;
int m_iScePadHandle;
BYTE *m_pucLeftTriggerAxisMap; BYTE *m_pucLeftTriggerAxisMap;
BYTE *m_pucRightTriggerAxisMap; BYTE *m_pucRightTriggerAxisMap;
@@ -115,6 +117,7 @@ public:
FLOAT GetIdleSeconds(int iPad); FLOAT GetIdleSeconds(int iPad);
bool UpdateJoypads(); bool UpdateJoypads();
bool UpdateRemotePlay();
void ClearJoypadValues(JOYPAD *pThisPad); void ClearJoypadValues(JOYPAD *pThisPad);
void InitTime(void); void InitTime(void);
void GetStartTime(int iPad, int iKey); void GetStartTime(int iPad, int iKey);
+1
View File
@@ -19,6 +19,7 @@
#include <kernel.h> #include <kernel.h>
#include <stdarg.h> #include <stdarg.h>
#include <scebase.h> #include <scebase.h>
#include <remoteplay.h>
#include <message_dialog.h> #include <message_dialog.h>
#endif #endif
+1 -1
View File
@@ -191,7 +191,7 @@ public:
void SetMenuDisplayed(int iPad, bool bVal); void SetMenuDisplayed(int iPad, bool bVal);
C_4JInput::EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode); EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode);
void DestroyKeyboard(); void DestroyKeyboard();
void GetText(uint16_t *UTF16String); void GetText(uint16_t *UTF16String);
+1
View File
@@ -23,6 +23,7 @@ const int MINECRAFT_NET_MAX_PLAYERS = 8;
#include <net.h> #include <net.h>
#include <np/np_npid.h> #include <np/np_npid.h>
#include <user_service.h> #include <user_service.h>
#include "OrbisTypes.h"
#elif __PS3__ #elif __PS3__
#include <np.h> #include <np.h>
#include <sysutil/sysutil_userinfo.h> #include <sysutil/sysutil_userinfo.h>