diff --git a/4JLibs.sln b/4JLibs.sln
index f6036a6..290e692 100644
--- a/4JLibs.sln
+++ b/4JLibs.sln
@@ -12,6 +12,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Headers", "Headers", "{1CB4373E-3F61-460C-B319-78C925BE3B8F}"
ProjectSection(SolutionItems) = preProject
Headers\extraX64.h = Headers\extraX64.h
+ Headers\Ps3Types.h = Headers\Ps3Types.h
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "4J_XTMS", "4J_XTMS\4J_XTMS.vcxproj", "{D0FDED0B-7704-4376-82DC-FF4377A7CD53}"
@@ -69,9 +70,11 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Durango = Debug|Durango
Debug|ORBIS = Debug|ORBIS
+ Debug|PS3 = Debug|PS3
Debug|Windows64 = Debug|Windows64
Release|Durango = Release|Durango
Release|ORBIS = Release|ORBIS
+ Release|PS3 = Release|PS3
Release|Windows64 = Release|Windows64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
@@ -80,6 +83,8 @@ Global
{A9125E77-A460-46FB-8EF3-2166F8657226}.Debug|Durango.Deploy.0 = Debug|Durango
{A9125E77-A460-46FB-8EF3-2166F8657226}.Debug|ORBIS.ActiveCfg = Debug|ORBIS
{A9125E77-A460-46FB-8EF3-2166F8657226}.Debug|ORBIS.Build.0 = Debug|ORBIS
+ {A9125E77-A460-46FB-8EF3-2166F8657226}.Debug|PS3.ActiveCfg = Debug|PS3
+ {A9125E77-A460-46FB-8EF3-2166F8657226}.Debug|PS3.Build.0 = Debug|PS3
{A9125E77-A460-46FB-8EF3-2166F8657226}.Debug|Windows64.ActiveCfg = Debug|x64
{A9125E77-A460-46FB-8EF3-2166F8657226}.Debug|Windows64.Build.0 = Debug|x64
{A9125E77-A460-46FB-8EF3-2166F8657226}.Release|Durango.ActiveCfg = Release|Durango
@@ -87,6 +92,8 @@ Global
{A9125E77-A460-46FB-8EF3-2166F8657226}.Release|Durango.Deploy.0 = Release|Durango
{A9125E77-A460-46FB-8EF3-2166F8657226}.Release|ORBIS.ActiveCfg = Release|ORBIS
{A9125E77-A460-46FB-8EF3-2166F8657226}.Release|ORBIS.Build.0 = Release|ORBIS
+ {A9125E77-A460-46FB-8EF3-2166F8657226}.Release|PS3.ActiveCfg = Release|PS3
+ {A9125E77-A460-46FB-8EF3-2166F8657226}.Release|PS3.Build.0 = Release|PS3
{A9125E77-A460-46FB-8EF3-2166F8657226}.Release|Windows64.ActiveCfg = Release|x64
{A9125E77-A460-46FB-8EF3-2166F8657226}.Release|Windows64.Build.0 = Release|x64
{C3833C67-05E4-4D6C-8707-22F95B6939E4}.Debug|Durango.ActiveCfg = Debug|Durango
@@ -94,6 +101,7 @@ Global
{C3833C67-05E4-4D6C-8707-22F95B6939E4}.Debug|Durango.Deploy.0 = Debug|Durango
{C3833C67-05E4-4D6C-8707-22F95B6939E4}.Debug|ORBIS.ActiveCfg = Debug|ORBIS
{C3833C67-05E4-4D6C-8707-22F95B6939E4}.Debug|ORBIS.Build.0 = Debug|ORBIS
+ {C3833C67-05E4-4D6C-8707-22F95B6939E4}.Debug|PS3.ActiveCfg = Debug|PS3
{C3833C67-05E4-4D6C-8707-22F95B6939E4}.Debug|Windows64.ActiveCfg = Debug|x64
{C3833C67-05E4-4D6C-8707-22F95B6939E4}.Debug|Windows64.Build.0 = Debug|x64
{C3833C67-05E4-4D6C-8707-22F95B6939E4}.Release|Durango.ActiveCfg = Release|Durango
@@ -101,6 +109,7 @@ Global
{C3833C67-05E4-4D6C-8707-22F95B6939E4}.Release|Durango.Deploy.0 = Release|Durango
{C3833C67-05E4-4D6C-8707-22F95B6939E4}.Release|ORBIS.ActiveCfg = Release|ORBIS
{C3833C67-05E4-4D6C-8707-22F95B6939E4}.Release|ORBIS.Build.0 = Release|ORBIS
+ {C3833C67-05E4-4D6C-8707-22F95B6939E4}.Release|PS3.ActiveCfg = Release|PS3
{C3833C67-05E4-4D6C-8707-22F95B6939E4}.Release|Windows64.ActiveCfg = Release|x64
{C3833C67-05E4-4D6C-8707-22F95B6939E4}.Release|Windows64.Build.0 = Release|x64
{22938163-5DDB-4D04-883B-07212EB99FAE}.Debug|Durango.ActiveCfg = Debug|Durango
@@ -108,6 +117,7 @@ Global
{22938163-5DDB-4D04-883B-07212EB99FAE}.Debug|Durango.Deploy.0 = Debug|Durango
{22938163-5DDB-4D04-883B-07212EB99FAE}.Debug|ORBIS.ActiveCfg = Debug|ORBIS
{22938163-5DDB-4D04-883B-07212EB99FAE}.Debug|ORBIS.Build.0 = Debug|ORBIS
+ {22938163-5DDB-4D04-883B-07212EB99FAE}.Debug|PS3.ActiveCfg = Debug|PS3
{22938163-5DDB-4D04-883B-07212EB99FAE}.Debug|Windows64.ActiveCfg = Debug|x64
{22938163-5DDB-4D04-883B-07212EB99FAE}.Debug|Windows64.Build.0 = Debug|x64
{22938163-5DDB-4D04-883B-07212EB99FAE}.Release|Durango.ActiveCfg = Release|Durango
@@ -115,6 +125,7 @@ Global
{22938163-5DDB-4D04-883B-07212EB99FAE}.Release|Durango.Deploy.0 = Release|Durango
{22938163-5DDB-4D04-883B-07212EB99FAE}.Release|ORBIS.ActiveCfg = Release|ORBIS
{22938163-5DDB-4D04-883B-07212EB99FAE}.Release|ORBIS.Build.0 = Release|ORBIS
+ {22938163-5DDB-4D04-883B-07212EB99FAE}.Release|PS3.ActiveCfg = Release|PS3
{22938163-5DDB-4D04-883B-07212EB99FAE}.Release|Windows64.ActiveCfg = Release|x64
{22938163-5DDB-4D04-883B-07212EB99FAE}.Release|Windows64.Build.0 = Release|x64
{2E28BC2E-BF30-4C83-A4D8-C967DD409D70}.Debug|Durango.ActiveCfg = Debug|Durango
@@ -122,6 +133,7 @@ Global
{2E28BC2E-BF30-4C83-A4D8-C967DD409D70}.Debug|Durango.Deploy.0 = Debug|Durango
{2E28BC2E-BF30-4C83-A4D8-C967DD409D70}.Debug|ORBIS.ActiveCfg = Debug|ORBIS
{2E28BC2E-BF30-4C83-A4D8-C967DD409D70}.Debug|ORBIS.Build.0 = Debug|ORBIS
+ {2E28BC2E-BF30-4C83-A4D8-C967DD409D70}.Debug|PS3.ActiveCfg = Debug|PS3
{2E28BC2E-BF30-4C83-A4D8-C967DD409D70}.Debug|Windows64.ActiveCfg = Debug|x64
{2E28BC2E-BF30-4C83-A4D8-C967DD409D70}.Debug|Windows64.Build.0 = Debug|x64
{2E28BC2E-BF30-4C83-A4D8-C967DD409D70}.Release|Durango.ActiveCfg = Release|Durango
@@ -129,6 +141,7 @@ Global
{2E28BC2E-BF30-4C83-A4D8-C967DD409D70}.Release|Durango.Deploy.0 = Release|Durango
{2E28BC2E-BF30-4C83-A4D8-C967DD409D70}.Release|ORBIS.ActiveCfg = Release|ORBIS
{2E28BC2E-BF30-4C83-A4D8-C967DD409D70}.Release|ORBIS.Build.0 = Release|ORBIS
+ {2E28BC2E-BF30-4C83-A4D8-C967DD409D70}.Release|PS3.ActiveCfg = Release|PS3
{2E28BC2E-BF30-4C83-A4D8-C967DD409D70}.Release|Windows64.ActiveCfg = Release|x64
{2E28BC2E-BF30-4C83-A4D8-C967DD409D70}.Release|Windows64.Build.0 = Release|x64
{D0FDED0B-7704-4376-82DC-FF4377A7CD53}.Debug|Durango.ActiveCfg = Debug|Durango
@@ -136,9 +149,11 @@ Global
{D0FDED0B-7704-4376-82DC-FF4377A7CD53}.Debug|Durango.Deploy.0 = Debug|Durango
{D0FDED0B-7704-4376-82DC-FF4377A7CD53}.Debug|ORBIS.ActiveCfg = Debug|ORBIS
{D0FDED0B-7704-4376-82DC-FF4377A7CD53}.Debug|ORBIS.Build.0 = Debug|ORBIS
+ {D0FDED0B-7704-4376-82DC-FF4377A7CD53}.Debug|PS3.ActiveCfg = Debug|PS3
{D0FDED0B-7704-4376-82DC-FF4377A7CD53}.Debug|Windows64.ActiveCfg = Debug|x64
{D0FDED0B-7704-4376-82DC-FF4377A7CD53}.Release|Durango.ActiveCfg = Release|Durango
{D0FDED0B-7704-4376-82DC-FF4377A7CD53}.Release|ORBIS.ActiveCfg = Release|ORBIS
+ {D0FDED0B-7704-4376-82DC-FF4377A7CD53}.Release|PS3.ActiveCfg = Release|PS3
{D0FDED0B-7704-4376-82DC-FF4377A7CD53}.Release|Windows64.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
diff --git a/4J_Input/4J_Input.vcxproj b/4J_Input/4J_Input.vcxproj
index c6c2564..2999950 100644
--- a/4J_Input/4J_Input.vcxproj
+++ b/4J_Input/4J_Input.vcxproj
@@ -9,6 +9,10 @@
Debug
ORBIS
+
+ Debug
+ PS3
+
Debug
x64
@@ -21,6 +25,10 @@
Release
ORBIS
+
+ Release
+ PS3
+
Release
x64
@@ -32,569 +40,777 @@
true
true
true
+ true
+ true
true
true
true
true
+ true
+ true
true
true
true
true
+ true
+ true
true
true
true
true
+ true
+ true
-
-
+
true
true
+ true
+ true
+
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
@@ -605,65 +821,111 @@
true
true
true
+ true
+ true
true
true
true
true
+ true
+ true
true
true
true
true
+ true
+ true
true
true
true
true
+ true
+ true
true
true
true
true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
@@ -697,10 +959,18 @@
Clang
StaticLibrary
+
+ SNC
+ StaticLibrary
+
Clang
StaticLibrary
+
+ SNC
+ StaticLibrary
+
@@ -726,11 +996,21 @@
$(ProjectDir);$(SCE_ORBIS_SDK_DIR)\host_tools\lib\clang\include;$(SCE_ORBIS_SDK_DIR)\target\include;$(SCE_ORBIS_SDK_DIR)\target\include_common;
Build\$(Platform)\$(Configuration)\
+
+ .a
+ $(SCE_PS3_ROOT)\target\ppu\include;$(SCE_PS3_ROOT)\target\common\include;$(SCE_PS3_ROOT)\host-win32\sn\ppu\include;
+ Build\$(Platform)\$(Configuration)\
+
.a
$(ProjectDir);$(SCE_ORBIS_SDK_DIR)\host_tools\lib\clang\include;$(SCE_ORBIS_SDK_DIR)\target\include;$(SCE_ORBIS_SDK_DIR)\target\include_common;
Build\$(Platform)\$(Configuration)\
+
+ .a
+ $(SCE_PS3_ROOT)\target\ppu\include;$(SCE_PS3_ROOT)\target\common\include;$(SCE_PS3_ROOT)\host-win32\sn\ppu\include;
+ Build\$(Platform)\$(Configuration)\
+
Build\$(Platform)\$(Configuration)\
@@ -797,11 +1077,24 @@
NormalWarnings
+
+
+ ../Headers/PS3;../Headers;$(ProjectDir);%(AdditionalIncludeDirectories)
+
+
+ GenerateWarnings
+
+
../Headers/Orbis;../Headers;$(ProjectDir);%(AdditionalIncludeDirectories)
+
+
+ ../Headers/PS3;../Headers;$(ProjectDir);%(AdditionalIncludeDirectories)
+
+
diff --git a/4J_Input/4J_Input.vcxproj.filters b/4J_Input/4J_Input.vcxproj.filters
index 2afc699..bb93be6 100644
--- a/4J_Input/4J_Input.vcxproj.filters
+++ b/4J_Input/4J_Input.vcxproj.filters
@@ -303,6 +303,15 @@
Header Files
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
@@ -341,5 +350,17 @@
Source Files
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
\ No newline at end of file
diff --git a/4J_Input/PS3/4J_Input.cpp b/4J_Input/PS3/4J_Input.cpp
new file mode 100644
index 0000000..df67a8b
--- /dev/null
+++ b/4J_Input/PS3/4J_Input.cpp
@@ -0,0 +1,167 @@
+#include "INP_Main.h"
+
+#include "4J_Input.h"
+#include "INP_OnScreenKeyboard.h"
+#include "INP_MsgBox.h"
+
+C_4JInput InputManager;
+
+void C_4JInput::Initialise( int iInputStateC, unsigned char ucMapC,unsigned char ucActionC, unsigned char ucMenuActionC )
+{
+ InternalInputManager.Initialise(iInputStateC, ucMapC, ucActionC, ucMenuActionC);
+}
+
+void C_4JInput::Tick(void)
+{
+ InternalInputManager.Tick();
+}
+
+void C_4JInput::SetDeadzoneAndMovementRange(unsigned int uiDeadzone, unsigned int uiMovementRangeMax )
+{
+ InternalInputManager.SetDeadzoneAndMovementRange(uiDeadzone, uiMovementRangeMax);
+}
+
+void C_4JInput::SetGameJoypadMaps(unsigned char ucMap,unsigned char ucAction,unsigned int uiActionVal)
+{
+ InternalInputManager.SetGameJoypadMaps(ucMap, ucAction, uiActionVal);
+}
+
+unsigned int C_4JInput::GetGameJoypadMaps(unsigned char ucMap,unsigned char ucAction)
+{
+ return InternalInputManager.GetGameJoypadMaps(ucMap, ucAction);
+}
+
+void C_4JInput::SetJoypadMapVal(int iPad,unsigned char ucMap)
+{
+ InternalInputManager.SetJoypadMapVal(iPad, ucMap);
+}
+
+unsigned char C_4JInput::GetJoypadMapVal(int iPad)
+{
+ return InternalInputManager.GetJoypadMapVal(iPad);
+}
+
+void C_4JInput::SetJoypadSensitivity(int iPad, float fSensitivity)
+{
+ InternalInputManager.SetJoypadSensitivity(iPad, fSensitivity);
+}
+
+unsigned int C_4JInput::GetValue(int iPad,unsigned char ucAction, bool bRepeat)
+{
+ return InternalInputManager.GetValue(iPad, ucAction, bRepeat);
+}
+
+bool C_4JInput::ButtonPressed(int iPad,unsigned char ucAction)
+{
+ return InternalInputManager.ButtonPressed(iPad, ucAction);
+}
+
+bool C_4JInput::ButtonReleased(int iPad,unsigned char ucAction)
+{
+ return InternalInputManager.ButtonReleased(iPad, ucAction);
+}
+
+bool C_4JInput::ButtonDown(int iPad,unsigned char ucAction)
+{
+ return InternalInputManager.ButtonDown(iPad, ucAction);
+}
+
+void C_4JInput::SetJoypadStickAxisMap(int iPad,unsigned int uiFrom, unsigned int uiTo)
+{
+ InternalInputManager.SetJoypadStickAxisMap(iPad, uiFrom, uiTo);
+}
+
+void C_4JInput::SetJoypadStickTriggerMap(int iPad,unsigned int uiFrom, unsigned int uiTo)
+{
+ InternalInputManager.SetJoypadStickTriggerMap(iPad, uiFrom, uiTo);
+}
+
+void C_4JInput::SetKeyRepeatRate(float fRepeatDelaySecs,float fRepeatRateSecs)
+{
+ InternalInputManager.SetKeyRepeatRate(fRepeatDelaySecs, fRepeatRateSecs);
+}
+
+void C_4JInput::SetDebugSequence( const char *chSequenceA,int( *Func)(LPVOID),LPVOID lpParam )
+{
+ InternalInputManager.SetDebugSequence(chSequenceA, Func, lpParam);
+}
+
+FLOAT C_4JInput::GetIdleSeconds(int iPad)
+{
+ return InternalInputManager.GetIdleSeconds(iPad);
+}
+
+bool C_4JInput::IsPadConnected(int iPad)
+{
+ return InternalInputManager.IsPadConnected(iPad);
+}
+
+bool C_4JInput::IsCircleCrossSwapped()
+{
+ return InternalInputManager.m_bSwappedEnter;
+}
+
+float C_4JInput::GetJoypadStick_LX(int iPad, bool bCheckMenuDisplay)
+{
+ return InternalInputManager.GetJoypadStick_LX(iPad, bCheckMenuDisplay);
+}
+
+float C_4JInput::GetJoypadStick_LY(int iPad, bool bCheckMenuDisplay)
+{
+ return InternalInputManager.GetJoypadStick_LY(iPad, bCheckMenuDisplay);
+}
+
+float C_4JInput::GetJoypadStick_RX(int iPad, bool bCheckMenuDisplay)
+{
+ return InternalInputManager.GetJoypadStick_RX(iPad, bCheckMenuDisplay);
+}
+
+float C_4JInput::GetJoypadStick_RY(int iPad, bool bCheckMenuDisplay)
+{
+ return InternalInputManager.GetJoypadStick_RY(iPad, bCheckMenuDisplay);
+}
+
+unsigned char C_4JInput::GetJoypadLTrigger(int iPad, bool bCheckMenuDisplay)
+{
+ return InternalInputManager.GetJoypadLTrigger(iPad, bCheckMenuDisplay);
+}
+
+unsigned char C_4JInput::GetJoypadRTrigger(int iPad, bool bCheckMenuDisplay)
+{
+ return InternalInputManager.GetJoypadRTrigger(iPad, bCheckMenuDisplay);
+}
+
+void C_4JInput::SetMenuDisplayed(int iPad, bool bVal)
+{
+ InternalInputManager.SetMenuDisplayed(iPad, bVal);
+}
+
+EKeyboardResult C_4JInput::RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode)
+{
+ return InternalInputManager.m_Keyboard.RequestKeyboard(Title, Text, dwPad, uiMaxChars, Func, lpParam, eMode);
+}
+
+void C_4JInput::DestroyKeyboard()
+{
+ InternalInputManager.m_Keyboard.DestroyKeyboard();
+}
+
+void C_4JInput::GetText(uint16_t *UTF16String)
+{
+ InternalInputManager.m_Keyboard.GetText(UTF16String);
+}
+
+void C_4JInput::SetLostInputControlCallback(void( *Func)(LPVOID, bool),LPVOID lpParam)
+{
+ InternalInputManager.SetLostInputControlCallback(Func, lpParam);
+}
+
+bool C_4JInput::VerifyStrings(WCHAR **pwStringA,int iStringC,int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam)
+{
+ return false;
+}
+
+EMsgBoxResult C_4JInput::RequestMessageBox(EMSgBoxType eType, DWORD dwPad,void( *Func)(int iButtonType,void *pvUserData),LPVOID lpParam, const char *pchText ,unsigned int uiFocusButton )
+{
+ return InternalInputManager.m_MsgBox.RequestMessageBox(eType, dwPad, Func, lpParam, pchText, uiFocusButton);
+}
\ No newline at end of file
diff --git a/4J_Input/PS3/INP_Main.cpp b/4J_Input/PS3/INP_Main.cpp
new file mode 100644
index 0000000..cd77e9c
--- /dev/null
+++ b/4J_Input/PS3/INP_Main.cpp
@@ -0,0 +1,915 @@
+#include "INP_Main.h"
+
+#include
+#include
+
+#include // sys_time_get_current_time
+#include // cellSysutilGetSystemParamInt
+#include // cellSysutilGetSystemParamInt
+
+CInput InternalInputManager;
+
+CInput::CInput()
+{
+ m_MsgBox = CMsgBox();
+ m_Keyboard = CKeyboard();
+
+ m_uiSigninJoypadMask = 0;
+ for (int i = 0; i < 4; ++i)
+ m_bIsMenuDisplayed[i] = 0;
+
+ InitTime();
+
+ m_fRepeatDelaySecs = 0.5f;
+ m_fRepeatRateSecs = 0.8f;
+ m_sDebugSequenceName = 0;
+ m_uiDebugSequenceIndex = 0;
+ m_pDebugSequenceFn = 0;
+#if TO_BE_IMPLEMENTED
+ *((_BYTE *)&loc_650 + this + 1) = 0;
+#endif
+ m_pLostInputFn = NULL;
+ m_pLostInputParam = NULL;
+}
+
+CInput::~CInput()
+{
+ // ~CKeyboard
+}
+
+void CInput::DebugPrintf(const char *szFormat, ...)
+{
+ va_list ap;
+ va_start(ap, szFormat);
+ char buf[1024];
+ vsnprintf(buf, sizeof(buf), szFormat, ap);
+ va_end(ap);
+ printf(buf);
+}
+
+bool CInput::QueryPerformanceFrequency(_LARGE_INTEGER *)
+{
+#if TO_BE_IMPLEMENTED
+ *(_QWORD *)a2 = 1000000;
+#endif
+ return false;
+}
+
+bool CInput::QueryPerformanceCounter(_LARGE_INTEGER *)
+{
+#if TO_BE_IMPLEMENTED
+ sys_time_get_current_time(&v3, &v4);
+ *(_QWORD *)a2 = 1000000 * v3 + v4 / 1000;
+#endif
+ return true;
+}
+
+void CInput::Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC)
+{
+ assert(iInputStateC > 0);
+ assert(ucMapC > 0);
+ assert(ucActionC > 0);
+
+ int padInit = cellPadInit(MAX_JOYPADS);
+ if ( padInit != CELL_PAD_OK )
+ InternalInputManager.DebugPrintf("cellPadInit failed 0x%08x\n", padInit);
+
+ ZeroMemory(m_Joypads, sizeof(m_Joypads));
+
+ m_ucInputStateC = iInputStateC;
+
+ m_iDeadzone = 0x2;
+ m_iMovementRangeMax = 0x7F;
+
+ m_iEffectiveRange = m_iMovementRangeMax - m_iDeadzone;
+ m_fEffectiveRange = (float)m_iEffectiveRange;
+ m_iHalfRange = m_iEffectiveRange * 0.75;
+
+ for (int i = 0; i < MAX_JOYPADS; i++)
+ {
+ m_Joypads[i].m_pInputStates = new CellPadData[m_ucInputStateC];
+ m_Joypads[i].m_ucInputStateIndex = -1;
+ m_Joypads[i].m_pfLeftThumbXAxisMap = &m_Joypads[i].m_fNormalizedLeftThumbX;
+ m_Joypads[i].m_pfLeftThumbYAxisMap = &m_Joypads[i].m_fNormalizedLeftThumbY;
+ m_Joypads[i].m_pfRightThumbXAxisMap = &m_Joypads[i].m_fNormalizedRightThumbX;
+ m_Joypads[i].m_pfRightThumbYAxisMap = &m_Joypads[i].m_fNormalizedRightThumbY;
+ m_Joypads[i].m_pucLeftTriggerAxisMap = &m_Joypads[i].m_ucLeftTriggerState;
+ m_Joypads[i].m_pucRightTriggerAxisMap = &m_Joypads[i].m_ucRightTriggerState;
+ m_Joypads[i].m_fSensitivity = 1.0f;
+ cellPadSetPortSetting(i, 6);
+ }
+
+ m_JoypadMap = (unsigned int **)operator new[](ucMapC * sizeof(int *));
+ for (int i = 0; i < ucMapC; i++)
+ {
+ m_JoypadMap[i] = (unsigned int *)operator new[](ucActionC * sizeof(int));
+ }
+
+ m_ucJoypadMapC = ucMapC;
+ m_ucJoypadMapActionC = ucActionC;
+ m_ucMenuActionC = ucMenuActionC;
+ m_bJoypadMapArrayIsSetup = false;
+
+ int swappedEnter;
+ cellSysutilGetSystemParamInt(CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN, &swappedEnter);
+
+ if ( swappedEnter )
+ {
+ m_bSwappedEnter = false;
+ }
+ else
+ {
+ m_bSwappedEnter = true;
+ }
+}
+
+void CInput::Tick()
+{
+ UpdateJoypads();
+ m_Keyboard.Tick();
+}
+
+void CInput::SetJoypadValues(JOYPAD *pThisPad)
+{
+ CellPadData *pGamePad = &pThisPad->m_pInputStates[pThisPad->m_ucInputStateIndex];
+
+ pThisPad->m_uiButtons = pThisPad->m_uiOldButtons;
+
+ if (pGamePad->len > 2)
+ {
+ pThisPad->m_uiButtons &= ~(
+ _360_JOY_BUTTON_START |
+ _360_JOY_BUTTON_BACK |
+ _360_JOY_BUTTON_LTHUMB |
+ _360_JOY_BUTTON_RTHUMB |
+ _360_JOY_BUTTON_DPAD_UP |
+ _360_JOY_BUTTON_DPAD_DOWN |
+ _360_JOY_BUTTON_DPAD_LEFT |
+ _360_JOY_BUTTON_DPAD_RIGHT
+ );
+
+ if ((pGamePad->button[CELL_PAD_BTN_OFFSET_DIGITAL1] & CELL_PAD_CTRL_START) != 0)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_START;
+ }
+ if ((pGamePad->button[CELL_PAD_BTN_OFFSET_DIGITAL1] & CELL_PAD_CTRL_SELECT) != 0)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_BACK;
+ }
+
+ if ((pGamePad->button[CELL_PAD_BTN_OFFSET_DIGITAL1] & CELL_PAD_CTRL_L3) != 0)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_LTHUMB;
+ }
+ if ((pGamePad->button[CELL_PAD_BTN_OFFSET_DIGITAL1] & CELL_PAD_CTRL_R3) != 0)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_RTHUMB;
+ }
+
+ if ((pGamePad->button[CELL_PAD_BTN_OFFSET_DIGITAL1] & CELL_PAD_CTRL_UP) != 0)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_DPAD_UP;
+ }
+ if ((pGamePad->button[CELL_PAD_BTN_OFFSET_DIGITAL1] & CELL_PAD_CTRL_DOWN) != 0)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_DPAD_DOWN;
+ }
+ if ((pGamePad->button[CELL_PAD_BTN_OFFSET_DIGITAL1] & CELL_PAD_CTRL_LEFT) != 0)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_DPAD_LEFT;
+ }
+ if ((pGamePad->button[CELL_PAD_BTN_OFFSET_DIGITAL1] & CELL_PAD_CTRL_RIGHT) != 0)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_DPAD_RIGHT;
+ }
+ }
+
+ if (pGamePad->len > 3)
+ {
+ pThisPad->m_uiButtons &= ~(
+ _360_JOY_BUTTON_RB |
+ _360_JOY_BUTTON_LB |
+ _360_JOY_BUTTON_RT |
+ _360_JOY_BUTTON_LT |
+ _360_JOY_BUTTON_A |
+ _360_JOY_BUTTON_B |
+ _360_JOY_BUTTON_X |
+ _360_JOY_BUTTON_Y
+ );
+
+ if ((pGamePad->button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_R1) != 0)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_RB;
+ }
+ if ((pGamePad->button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_L1) != 0)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_LB;
+ }
+
+ if ((pGamePad->button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_R2) != 0)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_RT;
+ }
+ if ((pGamePad->button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_L2) != 0)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_LT;
+ }
+
+ if ((pGamePad->button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_CROSS) != 0)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_A;
+ }
+ if ((pGamePad->button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_CIRCLE) != 0)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_B;
+ }
+
+ if ((pGamePad->button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_SQUARE) != 0)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_X;
+ }
+ if ((pGamePad->button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_TRIANGLE) != 0)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_Y;
+ }
+ }
+
+ if (pGamePad->len > 4)
+ {
+ int sThumbRX = pGamePad->button[CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_X] - 127;
+
+ if (sThumbRX > m_iDeadzone + m_iHalfRange)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_RSTICK_RIGHT;
+ }
+ else if (sThumbRX < -m_iDeadzone - m_iHalfRange)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_RSTICK_LEFT;
+ }
+ else
+ {
+ pThisPad->m_uiButtons &= ~(
+ _360_JOY_BUTTON_RSTICK_RIGHT |
+ _360_JOY_BUTTON_RSTICK_LEFT
+ );
+ }
+
+ if (sThumbRX >= -m_iDeadzone)
+ {
+ if (sThumbRX > m_iDeadzone)
+ pThisPad->m_iRightThumbX = sThumbRX - m_iDeadzone;
+ else
+ pThisPad->m_iRightThumbX = 0;
+ }
+ else
+ {
+ pThisPad->m_iRightThumbX = sThumbRX + m_iDeadzone;
+ }
+ }
+
+ if (pGamePad->len > 5)
+ {
+ int sThumbRY = 127 - pGamePad->button[CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_Y];
+
+ if (sThumbRY > m_iDeadzone + m_iHalfRange)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_RSTICK_UP;
+ }
+ else if (sThumbRY < -m_iDeadzone - m_iHalfRange)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_RSTICK_DOWN;
+ }
+ else
+ {
+ pThisPad->m_uiButtons &= ~(
+ _360_JOY_BUTTON_RSTICK_UP |
+ _360_JOY_BUTTON_RSTICK_DOWN
+ );
+ }
+
+ if (sThumbRY >= -m_iDeadzone)
+ {
+ if (sThumbRY > m_iDeadzone)
+ pThisPad->m_iRightThumbY = sThumbRY - m_iDeadzone;
+ else
+ pThisPad->m_iRightThumbY = 0;
+ }
+ else
+ {
+ pThisPad->m_iRightThumbY = sThumbRY + m_iDeadzone;
+ }
+ }
+
+ if (pGamePad->len > 6)
+ {
+ int sThumbLX = pGamePad->button[CELL_PAD_BTN_OFFSET_ANALOG_LEFT_X] - 127;
+
+ if (sThumbLX > m_iDeadzone + m_iHalfRange)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_LSTICK_RIGHT;
+ }
+ else if (sThumbLX < -m_iDeadzone - m_iHalfRange)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_LSTICK_LEFT;
+ }
+ else
+ {
+ pThisPad->m_uiButtons &= ~(
+ _360_JOY_BUTTON_LSTICK_RIGHT |
+ _360_JOY_BUTTON_LSTICK_LEFT
+ );
+ }
+
+ if (sThumbLX >= -m_iDeadzone)
+ {
+ if (sThumbLX > m_iDeadzone)
+ pThisPad->m_iLeftThumbX = sThumbLX - m_iDeadzone;
+ else
+ pThisPad->m_iLeftThumbX = 0;
+ }
+ else
+ {
+ pThisPad->m_iLeftThumbX = sThumbLX + m_iDeadzone;
+ }
+ }
+
+ if (pGamePad->len > 7)
+ {
+ int sThumbLY = 127 - pGamePad->button[CELL_PAD_BTN_OFFSET_ANALOG_LEFT_Y];
+
+ if (sThumbLY > m_iDeadzone + m_iHalfRange)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_LSTICK_UP;
+ }
+ else if (sThumbLY < -m_iDeadzone - m_iHalfRange)
+ {
+ pThisPad->m_uiButtons |= _360_JOY_BUTTON_LSTICK_DOWN;
+ }
+ else
+ {
+ pThisPad->m_uiButtons &= ~(
+ _360_JOY_BUTTON_LSTICK_UP |
+ _360_JOY_BUTTON_LSTICK_DOWN
+ );
+ }
+
+ if (sThumbLY >= -m_iDeadzone)
+ {
+ if (sThumbLY > m_iDeadzone)
+ pThisPad->m_iLeftThumbY = sThumbLY - m_iDeadzone;
+ else
+ pThisPad->m_iLeftThumbY = 0;
+ }
+ else
+ {
+ pThisPad->m_iLeftThumbY = sThumbLY + m_iDeadzone;
+ }
+ }
+
+ if (pGamePad->len > 18)
+ {
+ pThisPad->m_ucLeftTriggerState = pGamePad->button[CELL_PAD_BTN_OFFSET_PRESS_L2];
+ }
+
+ if (pGamePad->len > 19)
+ {
+ pThisPad->m_ucRightTriggerState = pGamePad->button[CELL_PAD_BTN_OFFSET_PRESS_R2];
+ }
+
+ pThisPad->m_iNormalizedLeftThumbX = pThisPad->m_iLeftThumbX / m_iEffectiveRange;
+ pThisPad->m_iNormalizedLeftThumbY = pThisPad->m_iLeftThumbY / m_iEffectiveRange;
+ pThisPad->m_iNormalizedRightThumbX = pThisPad->m_iRightThumbX / m_iEffectiveRange;
+ pThisPad->m_iNormalizedRightThumbY = pThisPad->m_iRightThumbY / m_iEffectiveRange;
+
+ pThisPad->m_fNormalizedLeftThumbX = pThisPad->m_iLeftThumbX / m_fEffectiveRange;
+ pThisPad->m_fNormalizedLeftThumbY = pThisPad->m_iLeftThumbY / m_fEffectiveRange;
+ pThisPad->m_fNormalizedRightThumbX = pThisPad->m_iRightThumbX / m_fEffectiveRange;
+ pThisPad->m_fNormalizedRightThumbY = pThisPad->m_iRightThumbY / m_fEffectiveRange;
+}
+
+void CInput::SetDeadzoneAndMovementRange(unsigned int uiDeadzone, unsigned int uiMovementRangeMax)
+{
+ m_iDeadzone = uiDeadzone;
+ m_iMovementRangeMax = uiMovementRangeMax;
+ m_iEffectiveRange = uiMovementRangeMax - uiDeadzone;
+}
+
+void CInput::SetJoypadSensitivity(int iPad, float fSensitivity)
+{
+ m_Joypads[iPad].m_fSensitivity = fSensitivity;
+}
+
+void CInput::SetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction, unsigned int uiActionVal)
+{
+ assert(ucMap < m_ucJoypadMapC);
+ assert(ucAction < m_ucJoypadMapActionC);
+
+ m_JoypadMap[ucMap][ucAction] = uiActionVal;
+}
+
+unsigned int CInput::GetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction)
+{
+ assert(ucMap < m_ucJoypadMapC);
+ assert(ucAction < m_ucJoypadMapActionC);
+
+ return m_JoypadMap[ucMap][ucAction];
+}
+
+void CInput::SetJoypadMapVal(int iPad, unsigned char ucMap)
+{
+ m_bJoypadMapArrayIsSetup = true;
+ m_Joypads[iPad].m_ucMappingValue = ucMap;
+}
+
+unsigned char CInput::GetJoypadMapVal(int iPad)
+{
+ return m_Joypads[iPad].m_ucMappingValue;
+}
+
+void CInput::SetJoypadStickAxisMap(int iPad, unsigned int uiFrom, unsigned int uiTo)
+{
+ float *pfTo = NULL;
+
+ switch (uiTo)
+ {
+ case AXIS_MAP_LX:
+ pfTo = &m_Joypads[iPad].m_fNormalizedLeftThumbX;
+ break;
+ case AXIS_MAP_LY:
+ pfTo = &m_Joypads[iPad].m_fNormalizedLeftThumbY;
+ break;
+ case AXIS_MAP_RX:
+ pfTo = &m_Joypads[iPad].m_fNormalizedRightThumbX;
+ break;
+ case AXIS_MAP_RY:
+ pfTo = &m_Joypads[iPad].m_fNormalizedRightThumbY;
+ break;
+ }
+
+ switch (uiFrom)
+ {
+ case AXIS_MAP_LX:
+ m_Joypads[iPad].m_pfLeftThumbXAxisMap = pfTo;
+ break;
+ case AXIS_MAP_LY:
+ m_Joypads[iPad].m_pfLeftThumbYAxisMap = pfTo;
+ break;
+ case AXIS_MAP_RX:
+ m_Joypads[iPad].m_pfRightThumbXAxisMap = pfTo;
+ break;
+ case AXIS_MAP_RY:
+ m_Joypads[iPad].m_pfRightThumbYAxisMap = pfTo;
+ break;
+ }
+}
+
+void CInput::SetJoypadStickTriggerMap(int iPad, unsigned int uiFrom, unsigned int uiTo)
+{
+ unsigned char *pucTo = NULL;
+
+ switch (uiTo)
+ {
+ case TRIGGER_MAP_0:
+ pucTo = &m_Joypads[iPad].m_ucRightTriggerState;
+ break;
+ case TRIGGER_MAP_1:
+ pucTo = &m_Joypads[iPad].m_ucLeftTriggerState;
+ break;
+ }
+
+ switch (uiFrom)
+ {
+ case TRIGGER_MAP_0:
+ m_Joypads[iPad].m_pucRightTriggerAxisMap = pucTo;
+ break;
+ case TRIGGER_MAP_1:
+ m_Joypads[iPad].m_pucLeftTriggerAxisMap = pucTo;
+ break;
+ }
+}
+
+bool CInput::IsPadConnected(int iPad)
+{
+ return m_Joypads[iPad].m_bIsConnected;
+}
+
+void CInput::SetSigninJoypadMask(unsigned int mask)
+{
+ m_uiSigninJoypadMask = mask;
+}
+
+unsigned int CInput::GetValue(int iPad, unsigned char ucAction, bool bRepeat)
+{
+ if (m_bIsMenuDisplayed[iPad] && ucAction > this->m_ucMenuActionC)
+ {
+ return 0;
+ }
+
+ unsigned char ucMap = this->m_Joypads[iPad].m_ucMappingValue;
+ unsigned int uiVal = this->m_JoypadMap[ucMap][ucAction] & this->m_Joypads[iPad].m_uiButtons;
+ if (!uiVal || !bRepeat)
+ {
+ return uiVal;
+ }
+
+ int iKeyVal = 0;
+ for (int iKey = this->m_JoypadMap[ucMap][ucAction]; (iKey & 1) == 0; iKey >>= 1)
+ {
+ iKeyVal++;
+ }
+
+ if (m_fRepeatDelaySecs <= m_Timers[iPad][iKeyVal].m_fTotalHoldTime || m_Timers[iPad][iKeyVal].m_bInitialPressHandled)
+ {
+ if (m_Timers[iPad][iKeyVal].m_fTotalHoldTime < m_fRepeatDelaySecs)
+ {
+ return 0;
+ }
+ else if (m_Timers[iPad][iKeyVal].m_fLastRepeatTime == 0.0f)
+ {
+ m_Timers[iPad][iKeyVal].m_fLastRepeatTime = m_fRepeatDelaySecs;
+ return uiVal;
+ }
+ else if ((m_Timers[iPad][iKeyVal].m_fTotalHoldTime - m_Timers[iPad][iKeyVal].m_fLastRepeatTime) <= m_fRepeatRateSecs)
+ {
+ return 0;
+ }
+ else
+ {
+ m_Timers[iPad][iKeyVal].m_fLastRepeatTime = m_Timers[iPad][iKeyVal].m_fLastRepeatTime + m_fRepeatRateSecs;
+ return uiVal;
+ }
+ }
+ else
+ {
+ m_Timers[iPad][iKeyVal].m_bInitialPressHandled = true;
+ return uiVal;
+ }
+}
+
+bool CInput::IsSet(int iPad, unsigned char ucAction)
+{
+ return (!m_bIsMenuDisplayed[iPad] || ucAction <= m_ucMenuActionC) &&
+ (m_JoypadMap[m_Joypads[iPad].m_ucMappingValue][ucAction] & m_Joypads[iPad].m_uiButtons) != 0;
+}
+
+bool CInput::ButtonPressed(int iPad, unsigned char ucAction)
+{
+ if (ucAction == 255)
+ {
+ return m_Joypads[iPad].m_uiButtonsPressed != 0;
+ }
+
+ if (m_bIsMenuDisplayed[iPad] && ucAction > m_ucMenuActionC)
+ {
+ return 0;
+ }
+
+ return (m_JoypadMap[m_Joypads[iPad].m_ucMappingValue][ucAction] & m_Joypads[iPad].m_uiButtonsPressed) != 0;
+}
+
+bool CInput::ButtonReleased(int iPad, unsigned char ucAction)
+{
+ return (!m_bIsMenuDisplayed[iPad] || ucAction <= m_ucMenuActionC) &&
+ (m_JoypadMap[m_Joypads[iPad].m_ucMappingValue][ucAction] & m_Joypads[iPad].m_uiButtonsReleased) != 0;
+}
+
+bool CInput::ButtonDown(int iPad, unsigned char ucAction)
+{
+ if (ucAction == 255)
+ {
+ return m_Joypads[iPad].m_uiButtons != 0;
+ }
+
+ if (m_bIsMenuDisplayed[iPad] && ucAction > m_ucMenuActionC)
+ {
+ return 0;
+ }
+
+ return (m_JoypadMap[m_Joypads[iPad].m_ucMappingValue][ucAction] & m_Joypads[iPad].m_uiButtons) != 0;
+}
+
+float CInput::GetJoypadStick_Menu_LX(unsigned char ucPad)
+{
+ return m_Joypads[ucPad].m_iNormalizedLeftThumbX;
+}
+
+float CInput::GetJoypadStick_Menu_LY(unsigned char ucPad)
+{
+ return m_Joypads[ucPad].m_iNormalizedLeftThumbY;
+}
+
+float CInput::GetJoypadStick_Menu_RX(unsigned char ucPad)
+{
+ return m_Joypads[ucPad].m_iNormalizedRightThumbX;
+}
+
+float CInput::GetJoypadStick_Menu_RY(unsigned char ucPad)
+{
+ return m_Joypads[ucPad].m_iNormalizedRightThumbY;
+}
+
+unsigned char CInput::GetJoypadLTrigger_Menu(unsigned char ucPad)
+{
+ return m_Joypads[ucPad].m_ucLeftTriggerState;
+}
+
+unsigned char CInput::GetJoypadRTrigger_Menu(unsigned char ucPad)
+{
+ return m_Joypads[ucPad].m_ucRightTriggerState;
+}
+
+float CInput::GetJoypadStick_LX(int iPad, bool bCheckMenuDisplay)
+{
+ if (bCheckMenuDisplay && m_bIsMenuDisplayed[iPad])
+ {
+ return 0.0f;
+ }
+
+ return *m_Joypads[iPad].m_pfLeftThumbXAxisMap * m_Joypads[iPad].m_fSensitivity;
+}
+
+float CInput::GetJoypadStick_LY(int iPad, bool bCheckMenuDisplay)
+{
+ if (bCheckMenuDisplay && m_bIsMenuDisplayed[iPad])
+ {
+ return 0.0f;
+ }
+
+ return *m_Joypads[iPad].m_pfLeftThumbYAxisMap * m_Joypads[iPad].m_fSensitivity;
+}
+
+float CInput::GetJoypadStick_RX(int iPad, bool bCheckMenuDisplay)
+{
+ if (bCheckMenuDisplay && m_bIsMenuDisplayed[iPad])
+ {
+ return 0.0f;
+ }
+
+ return *m_Joypads[iPad].m_pfRightThumbXAxisMap * m_Joypads[iPad].m_fSensitivity;
+}
+
+float CInput::GetJoypadStick_RY(int iPad, bool bCheckMenuDisplay)
+{
+ if (bCheckMenuDisplay && m_bIsMenuDisplayed[iPad])
+ {
+ return 0.0f;
+ }
+
+ return *m_Joypads[iPad].m_pfRightThumbYAxisMap * m_Joypads[iPad].m_fSensitivity;
+}
+
+unsigned char CInput::GetJoypadLTrigger(int iPad, bool bCheckMenuDisplay)
+{
+ if (bCheckMenuDisplay && m_bIsMenuDisplayed[iPad])
+ {
+ return 0;
+ }
+
+ return *m_Joypads[iPad].m_pucLeftTriggerAxisMap;
+}
+
+unsigned char CInput::GetJoypadRTrigger(int iPad, bool bCheckMenuDisplay)
+{
+ if (bCheckMenuDisplay && m_bIsMenuDisplayed[iPad])
+ {
+ return 0;
+ }
+
+ return *m_Joypads[iPad].m_pucRightTriggerAxisMap;
+}
+
+void CInput::SetMenuDisplayed(int iPad, bool bVal)
+{
+ m_bIsMenuDisplayed[iPad] = bVal;
+}
+
+void CInput::SetKeyRepeatRate(float fRepeatDelaySecs, float fRepeatRateSecs)
+{
+ m_fRepeatDelaySecs = fRepeatDelaySecs;
+ m_fRepeatRateSecs = fRepeatRateSecs;
+}
+
+void CInput::SetDebugSequence(const char *chSequenceA, int (*Func)(LPVOID), LPVOID lpParam)
+{
+ int iLen = strlen(chSequenceA);
+
+ m_sDebugSequenceName = (char *)operator new[](iLen);
+ strcpy(m_sDebugSequenceName, chSequenceA);
+
+ m_pDebugSequenceFn = Func;
+ m_pDebugSequenceParam = lpParam;
+}
+
+FLOAT CInput::GetIdleSeconds(int iPad)
+{
+ LARGE_INTEGER qwDeltaTime;
+ QueryPerformanceCounter(&qwDeltaTime);
+#if TO_BE_IMPLEMENTED
+ uint64_t v4 = qwDeltaTime.QuadPart - *(_QWORD *)(v5 + 4696 + 8 * a2);
+ return (float)(*(float *)((char *)&loc_644 + v5) * (float)v4)
+#else
+ return 0.0f;
+#endif
+}
+
+void CInput::SetLostInputControlCallback(void( *Func)(LPVOID, bool),LPVOID lpParam)
+{
+ m_pLostInputFn = Func;
+ m_pLostInputParam = lpParam;
+}
+
+bool CInput::UpdateJoypads()
+{
+ assert(m_bJoypadMapArrayIsSetup);
+
+ for (int i = 0; i < MAX_JOYPADS; i++)
+ {
+ JOYPAD *pThisPad = &m_Joypads[i];
+
+ pThisPad->m_uiOldButtons = pThisPad->m_uiButtons;
+ pThisPad->m_uiButtons = 0;
+ pThisPad->m_ucLeftTriggerState = 0;
+ pThisPad->m_ucRightTriggerState = 0;
+ }
+
+ CellPadInfo2 info;
+ int32_t getInfo2 = cellPadGetInfo2(&info);
+ if ( getInfo2 != CELL_PAD_OK )
+ InternalInputManager.DebugPrintf("cellPadGetInfo2 failed 0x%08x\n", getInfo2);
+
+ for (int i = 0; i < MAX_JOYPADS; i++)
+ {
+ if (!m_Joypads[i].m_bIsDisabled)
+ {
+ JOYPAD *pThisPad = &m_Joypads[i];
+
+ bool bOldIsConnected = pThisPad->m_bIsConnected;
+
+ pThisPad->m_ucInputStateIndex = pThisPad->m_ucInputStateIndex++;
+ if (pThisPad->m_ucInputStateIndex == m_ucInputStateC)
+ {
+ pThisPad->m_ucInputStateIndex = 0;
+ }
+
+ pThisPad->m_bIsConnected = info.port_status[i] & CELL_PAD_STATUS_CONNECTED;
+
+ if ( (info.system_info & CELL_PAD_INFO_INTERCEPTED) != 0)
+ {
+ if (!m_bLostInput)
+ {
+ m_bLostInput = true;
+ if ( m_pLostInputFn )
+ m_pLostInputFn(m_pLostInputParam, true);
+ }
+ }
+ else if ( m_bLostInput )
+ {
+ m_bLostInput = false;
+ if ( m_pLostInputFn )
+ m_pLostInputFn(m_pLostInputParam, false);
+ }
+
+ if (pThisPad->m_bIsConnected)
+ {
+ int32_t getData = cellPadGetData(i, &pThisPad->m_pInputStates[pThisPad->m_ucInputStateIndex]);
+ if ( getData != CELL_PAD_OK )
+ InternalInputManager.DebugPrintf("cellPadGetData failed 0x%08x\n", getData);
+ }
+
+ 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);
+
+ 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);
+ }
+
+ if (m_pDebugSequenceFn && (pThisPad->m_uiButtonsPressed & (_360_JOY_BUTTON_A | _360_JOY_BUTTON_B | _360_JOY_BUTTON_X | _360_JOY_BUTTON_Y |
+ _360_JOY_BUTTON_RB | _360_JOY_BUTTON_LB)) != 0)
+ {
+ char chSeq;
+
+ if ((pThisPad->m_uiButtonsPressed & _360_JOY_BUTTON_A) == _360_JOY_BUTTON_A)
+ {
+ chSeq = 'A';
+ }
+ else if ((pThisPad->m_uiButtonsPressed & _360_JOY_BUTTON_B) == _360_JOY_BUTTON_B)
+ {
+ chSeq = 'B';
+ }
+ else if ((pThisPad->m_uiButtonsPressed & _360_JOY_BUTTON_X) == _360_JOY_BUTTON_X)
+ {
+ chSeq = 'X';
+ }
+ else if ((pThisPad->m_uiButtonsPressed & _360_JOY_BUTTON_Y) == _360_JOY_BUTTON_Y)
+ {
+ chSeq = 'Y';
+ }
+ else if ((pThisPad->m_uiButtonsPressed & _360_JOY_BUTTON_LB) == _360_JOY_BUTTON_LB)
+ {
+ chSeq = 'L';
+ }
+ else if ((pThisPad->m_uiButtonsPressed & _360_JOY_BUTTON_RB) == _360_JOY_BUTTON_RB)
+ {
+ chSeq = 'R';
+ }
+
+ if (m_sDebugSequenceName[m_uiDebugSequenceIndex] == chSeq)
+ {
+ if (!m_sDebugSequenceName[m_uiDebugSequenceIndex++])
+ {
+ m_uiDebugSequenceIndex = 0;
+ (m_pDebugSequenceFn)(m_pDebugSequenceParam);
+ }
+ }
+ else
+ {
+ m_uiDebugSequenceIndex = 0;
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+void CInput::ClearJoypadValues(JOYPAD *pThisPad)
+{
+ pThisPad->m_uiButtonsPressed = 0;
+ pThisPad->m_uiButtonsReleased = 0;
+ pThisPad->m_uiButtons = 0;
+ pThisPad->m_ucLeftTriggerState = 0;
+ pThisPad->m_ucRightTriggerState = 0;
+ pThisPad->m_iRightThumbX = 0;
+ pThisPad->m_iRightThumbY = 0;
+ pThisPad->m_iLeftThumbX = 0;
+ pThisPad->m_iLeftThumbY = 0;
+ pThisPad->m_iNormalizedLeftThumbX = 0;
+ pThisPad->m_iNormalizedLeftThumbY = 0;
+ pThisPad->m_iNormalizedRightThumbX = 0;
+ pThisPad->m_iNormalizedRightThumbY = 0;
+ pThisPad->m_fNormalizedLeftThumbX = 0.0f;
+ pThisPad->m_fNormalizedLeftThumbY = 0.0f;
+ pThisPad->m_fNormalizedRightThumbX = 0.0f;
+ pThisPad->m_fNormalizedRightThumbY = 0.0f;
+}
+
+void CInput::InitTime(void)
+{
+ LARGE_INTEGER qwTicksPerSec;
+ QueryPerformanceFrequency(&qwTicksPerSec);
+
+ m_fTickToSeconds = 1.0 / (float)(int)qwTicksPerSec.LowPart;
+ for (int i = 0; i < MAX_JOYPADS; i++)
+ {
+ m_LastActivityTime[i].QuadPart = 0;
+ }
+}
+
+void CInput::GetStartTime(int iPad, int iKey)
+{
+ QueryPerformanceCounter(&m_Timers[iPad][iKey].m_qwStartTime);
+
+ m_Timers[iPad][iKey].m_qwTotalHoldTicks.QuadPart = 0;
+ m_Timers[iPad][iKey].m_fTotalHoldTime = 0;
+ m_Timers[iPad][iKey].m_fLastRepeatTime = 0;
+ m_Timers[iPad][iKey].m_bInitialPressHandled = false;
+
+ m_LastActivityTime[iPad].QuadPart = m_Timers[iPad][iKey].m_qwStartTime.QuadPart;
+}
+
+void CInput::UpdateTime(int iPad, int iKey)
+{
+ LARGE_INTEGER qwDeltaTime;
+ QueryPerformanceCounter(&qwDeltaTime);
+
+ uint64_t qwNewTime = qwDeltaTime.QuadPart - m_Timers[iPad][iKey].m_qwStartTime.QuadPart;
+ m_Timers[iPad][iKey].m_qwTotalHoldTicks.QuadPart += qwNewTime;
+
+ m_Timers[iPad][iKey].m_qwStartTime = qwDeltaTime;
+ m_Timers[iPad][iKey].m_fTotalHoldTime = m_Timers[iPad][iKey].m_fTotalHoldTime + (m_fTickToSeconds * qwNewTime);
+
+ m_LastActivityTime[iPad].QuadPart = m_Timers[iPad][iKey].m_qwStartTime.QuadPart;
+}
\ No newline at end of file
diff --git a/4J_Input/PS3/INP_Main.h b/4J_Input/PS3/INP_Main.h
new file mode 100644
index 0000000..c3bf795
--- /dev/null
+++ b/4J_Input/PS3/INP_Main.h
@@ -0,0 +1,175 @@
+#include "stdafx.h"
+
+#include "4J_Input.h"
+#include "INP_OnScreenKeyboard.h"
+#include "INP_MsgBox.h"
+
+#include
+
+#define MAX_JOYPADS 4
+
+class CInput
+{
+public:
+ struct XINPUT_STATE {};
+
+ struct JOYPAD
+ {
+ bool m_bIsDisabled;
+ bool m_bIsConnected;
+ bool m_bWasConnected;
+ bool m_bHasConnected;
+
+ unsigned int m_uiButtons;
+ unsigned int m_uiOldButtons;
+ int m_uiButtonsPressed;
+ int m_uiButtonsReleased;
+
+ int m_iRightThumbX;
+ int m_iRightThumbY;
+ int m_iLeftThumbX;
+ int m_iLeftThumbY;
+
+ DWORD m_iNormalizedRightThumbX;
+ DWORD m_iNormalizedRightThumbY;
+ DWORD m_iNormalizedLeftThumbX;
+ DWORD m_iNormalizedLeftThumbY;
+
+ float m_fNormalizedRightThumbX;
+ float m_fNormalizedRightThumbY;
+ float m_fNormalizedLeftThumbX;
+ float m_fNormalizedLeftThumbY;
+
+ unsigned char m_ucLeftTriggerState;
+ unsigned char m_ucRightTriggerState;
+
+ float *m_pfLeftThumbXAxisMap;
+ float *m_pfLeftThumbYAxisMap;
+ float *m_pfRightThumbXAxisMap;
+ float *m_pfRightThumbYAxisMap;
+
+ float m_fSensitivity;
+
+ BYTE *m_pucLeftTriggerAxisMap;
+ BYTE *m_pucRightTriggerAxisMap;
+
+ unsigned char m_ucMappingValue;
+ unsigned char m_ucInputStateIndex;
+ CellPadData *m_pInputStates;
+ };
+
+ struct TimeInfo
+ {
+ LARGE_INTEGER m_qwStartTime;
+ LARGE_INTEGER m_qwTotalHoldTicks;
+ float m_fTotalHoldTime;
+ float m_fLastRepeatTime;
+ bool m_bInitialPressHandled;
+ };
+
+ CInput();
+ ~CInput();
+
+ void DebugPrintf(const char *szFormat, ...);
+ bool QueryPerformanceFrequency(_LARGE_INTEGER *);
+ bool QueryPerformanceCounter(_LARGE_INTEGER *);
+
+ void Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC);
+ void Tick();
+
+ void SetJoypadValues(JOYPAD *);
+ void SetDeadzoneAndMovementRange(unsigned int uiDeadzone, unsigned int uiMovementRangeMax);
+ void SetJoypadSensitivity(int iPad, float fSensitivity);
+
+ void SetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction, unsigned int uiActionVal);
+ unsigned int GetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction);
+
+ void SetJoypadMapVal(int iPad, unsigned char ucMap);
+ unsigned char GetJoypadMapVal(int iPad);
+
+ void SetJoypadStickAxisMap(int iPad, unsigned int uiFrom, unsigned int uiTo);
+ void SetJoypadStickTriggerMap(int iPad, unsigned int uiFrom, unsigned int uiTo);
+
+ bool IsPadConnected(int iPad);
+ void SetSigninJoypadMask(unsigned int mask);
+ unsigned int GetValue(int iPad, unsigned char ucAction, bool bRepeat);
+ bool IsSet(int iPad, unsigned char ucAction);
+
+ bool ButtonPressed(int iPad, unsigned char ucAction);
+ bool ButtonReleased(int iPad, unsigned char ucAction);
+ bool ButtonDown(int iPad, unsigned char ucAction);
+
+ float GetJoypadStick_Menu_LX(unsigned char ucPad);
+ float GetJoypadStick_Menu_LY(unsigned char ucPad);
+ float GetJoypadStick_Menu_RX(unsigned char ucPad);
+ float GetJoypadStick_Menu_RY(unsigned char ucPad);
+ unsigned char GetJoypadLTrigger_Menu(unsigned char ucPad);
+ unsigned char GetJoypadRTrigger_Menu(unsigned char ucPad);
+
+ float GetJoypadStick_LX(int iPad, bool bCheckMenuDisplay = true);
+ float GetJoypadStick_LY(int iPad, bool bCheckMenuDisplay = true);
+ float GetJoypadStick_RX(int iPad, bool bCheckMenuDisplay = true);
+ float GetJoypadStick_RY(int iPad, bool bCheckMenuDisplay = true);
+ unsigned char GetJoypadLTrigger(int iPad, bool bCheckMenuDisplay = true);
+ unsigned char GetJoypadRTrigger(int iPad, bool bCheckMenuDisplay = true);
+
+ void SetMenuDisplayed(int iPad, bool bVal);
+
+ void SetKeyRepeatRate(float fRepeatDelaySecs, float fRepeatRateSecs);
+ void SetDebugSequence(const char *chSequenceA, int (*Func)(LPVOID), LPVOID lpParam);
+ FLOAT GetIdleSeconds(int iPad);
+
+ void SetLostInputControlCallback(void (*a2)(void *, bool), void *a3);
+
+ bool UpdateJoypads();
+ void ClearJoypadValues(JOYPAD *pThisPad);
+ void InitTime(void);
+ void GetStartTime(int iPad, int iKey);
+ void UpdateTime(int, int);
+private:
+ JOYPAD m_Joypads[MAX_JOYPADS];
+
+ int m_iDeadzone;
+ int m_iMovementRangeMax;
+ int m_iEffectiveRange;
+ int m_iHalfRange;
+ float m_fEffectiveRange;
+
+ unsigned char m_ucInputStateC;
+ unsigned char m_ucJoypadMapC;
+ unsigned char m_ucJoypadMapActionC;
+ unsigned char m_ucMenuActionC;
+
+ unsigned int **m_JoypadMap;
+
+ bool m_bSelectBackSwapped;
+ bool m_bLostInput;
+
+ bool m_bJoypadMapArrayIsSetup;
+ unsigned int m_uiSigninJoypadMask;
+ bool m_bIsMenuDisplayed[MAX_JOYPADS];
+
+public:
+ CMsgBox m_MsgBox;
+ CKeyboard m_Keyboard;
+
+ bool m_bSwappedEnter;
+private:
+
+ float m_fTickToSeconds;
+ float m_fRepeatDelaySecs;
+ float m_fRepeatRateSecs;
+
+ TimeInfo m_Timers[MAX_JOYPADS][24];
+ LARGE_INTEGER m_LastActivityTime[MAX_JOYPADS];
+
+ char *m_sDebugSequenceName;
+ unsigned int m_uiDebugSequenceIndex;
+ int (*m_pDebugSequenceFn)(void *);
+ LPVOID m_pDebugSequenceParam;
+
+ void (*m_pLostInputFn)(LPVOID, const bool);
+ LPVOID m_pLostInputParam;
+};
+
+extern CInput InternalInputManager;
\ No newline at end of file
diff --git a/4J_Input/PS3/INP_MsgBox.cpp b/4J_Input/PS3/INP_MsgBox.cpp
new file mode 100644
index 0000000..b6e1ccd
--- /dev/null
+++ b/4J_Input/PS3/INP_MsgBox.cpp
@@ -0,0 +1,51 @@
+#include "INP_Main.h"
+#include "INP_MsgBox.h"
+
+CMsgBox::CMsgBox()
+{
+ m_eResult = EMsgBox_Undefined;
+}
+
+EMsgBoxResult CMsgBox::RequestMessageBox(EMSgBoxType eType, DWORD dwPad,void( *Func)(int iButtonType,void *pvUserData),LPVOID lpParam, const char *pchText ,unsigned int uiFocusButton )
+{
+ InternalInputManager.DebugPrintf("InputManager CMsgBox::RequestMessageBox\n");
+
+ if (m_eResult == EMsgBox_Pending)
+ return EMsgBox_Busy;
+
+ m_eResult = EMsgBox_Pending;
+ int messageType = CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL
+ | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON;
+
+ m_iPad = dwPad;
+ m_pParam = lpParam;
+
+ switch (eType)
+ {
+ case EMSgBoxType_OK:
+ messageType |= CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK;
+ break;
+ case EMSgBoxType_YesNo:
+ messageType |= CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO;
+ if (uiFocusButton)
+ {
+ messageType |= CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO;
+ }
+ break;
+ }
+
+ int msgDialog = cellMsgDialogOpen2(messageType, pchText, Func, this, NULL);
+ if (msgDialog != CELL_OK)
+ {
+ InternalInputManager.DebugPrintf("ERROR : cellMsgDialogOpen2() = 0x%x\n", msgDialog);
+ if (msgDialog == CELL_SYSUTIL_ERROR_BUSY)
+ {
+ InternalInputManager.DebugPrintf("WARN : cellMsgDialogOpen2() = 0x%x (CELL_SYSUTIL_ERROR_BUSY) ... Retry.\n", CELL_SYSUTIL_ERROR_BUSY);
+ return EMsgBox_SysUtilBusy;
+ }
+ return EMsgBox_Undefined;
+ }
+
+ InternalInputManager.DebugPrintf("cellMsgDialogOpen2 - CELL_OK\n");
+ return m_eResult;
+}
\ No newline at end of file
diff --git a/4J_Input/PS3/INP_MsgBox.h b/4J_Input/PS3/INP_MsgBox.h
new file mode 100644
index 0000000..5ee9d98
--- /dev/null
+++ b/4J_Input/PS3/INP_MsgBox.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "4J_Input.h"
+#include // cellMsgDialogOpen2
+
+class CMsgBox
+{
+public:
+ CMsgBox();
+ ~CMsgBox() {};
+
+ EMsgBoxResult RequestMessageBox(EMSgBoxType eType, DWORD dwPad,void( *Func)(int iButtonType,void *pvUserData),LPVOID lpParam, const char *pchText ,unsigned int uiFocusButton );
+ void Tick() {};
+private:
+ EMsgBoxResult m_eResult;
+ DWORD m_iPad;
+ LPVOID m_pParam;
+};
\ No newline at end of file
diff --git a/4J_Input/PS3/INP_OnScreenKeyboard.cpp b/4J_Input/PS3/INP_OnScreenKeyboard.cpp
new file mode 100644
index 0000000..5f57796
--- /dev/null
+++ b/4J_Input/PS3/INP_OnScreenKeyboard.cpp
@@ -0,0 +1,262 @@
+#include "INP_Main.h"
+#include "INP_OnScreenKeyboard.h"
+
+CKeyboard::CKeyboard()
+{
+ m_pInstance = this;
+ m_iMode = 0;
+ cellSysutilRegisterCallback(3, (CellSysutilCallback)&CKeyboard::KeyboardEventsCallback, this);
+ SetKeyboardLanguage();
+}
+
+void CKeyboard::Tick()
+{
+ if (m_iMode == 5)
+ {
+ cellOskDialogUnloadAsync(&m_pDialogReturn);
+ InternalInputManager.DebugPrintf("############## result ##############\n");
+ InternalInputManager.DebugPrintf("OskDialog result status:\t%d\n", m_pDialogReturn);
+ if (m_pDialogReturn.result == CELL_OK)
+ {
+ InternalInputManager.DebugPrintf("OskDialog return chars :\t%d\n", m_pDialogReturn.numCharsResultString);
+ InternalInputManager.DebugPrintf("OskDialog return text :\t%S\n", m_pDialogReturn.pResultString);
+ }
+ InternalInputManager.DebugPrintf("########################################\n\n");
+ if (m_pFunc)
+ {
+ m_pFunc(m_lpParam, m_pDialogReturn.result == CELL_OK);
+ }
+ m_iMode = 0;
+ }
+ else if (m_iMode != 4)
+ {
+ if (m_iMode == 3)
+ {
+ if (m_pTickCountdown)
+ m_pTickCountdown--;
+ else
+ m_iMode = 2;
+ }
+ else if (m_iMode == 2)
+ {
+ register_osk_callback();
+
+ cellOskDialogAddSupportLanguage(CELL_OSKDIALOG_PANELMODE_GERMAN |
+ CELL_OSKDIALOG_PANELMODE_ENGLISH |
+ CELL_OSKDIALOG_PANELMODE_SPANISH |
+ CELL_OSKDIALOG_PANELMODE_FRENCH |
+ CELL_OSKDIALOG_PANELMODE_ITALIAN |
+ CELL_OSKDIALOG_PANELMODE_PORTUGUESE |
+ CELL_OSKDIALOG_PANELMODE_KOREAN |
+ CELL_OSKDIALOG_PANELMODE_TRADITIONAL_CHINESE |
+ CELL_OSKDIALOG_PANELMODE_SIMPLIFIED_CHINESE |
+ CELL_OSKDIALOG_PANELMODE_PORTUGUESE_BRAZIL
+ );
+
+ int iResult;
+
+ iResult = cellOskDialogSetKeyLayoutOption(CELL_OSKDIALOG_10KEY_PANEL | CELL_OSKDIALOG_FULLKEY_PANEL);
+ if ( iResult )
+ InternalInputManager.DebugPrintf("cellOskDialogSetKeyLayoutOption() = 0x%x \n", iResult);
+ iResult = cellOskDialogSetInitialKeyLayout(CELL_OSKDIALOG_INITIAL_PANEL_LAYOUT_FULLKEY);
+ if ( iResult )
+ InternalInputManager.DebugPrintf("cellOskDialogSetKeyLayoutOption()= 0x%x \n", iResult);
+ iResult = cellOskDialogExtSetInitialScale(1.0f);
+ if ( iResult )
+ InternalInputManager.DebugPrintf("cellOskDialogExtSetInitialScale()= 0x%x \n", iResult);
+
+ cellOskDialogSetLayoutMode(CELL_OSKDIALOG_LAYOUTMODE_X_ALIGN_CENTER | CELL_OSKDIALOG_LAYOUTMODE_Y_ALIGN_CENTER);
+
+ iResult = cellOskDialogLoadAsync(SYS_MEMORY_CONTAINER_ID_INVALID, &m_pDialogParam, &inputFieldInfo);
+ if ( iResult != CELL_OK )
+ {
+ InternalInputManager.DebugPrintf("cellOskDialogLoadAsync() = 0x%x \n", iResult);
+ m_iMode = 0;
+ }
+ else
+ {
+ m_iMode = 4;
+ }
+ }
+ else
+ {
+ m_iMode = 3;
+ m_pTickCountdown = 5;
+ }
+ }
+}
+
+void CKeyboard::GetText(uint16_t *UTF16String)
+{
+ memcpy(UTF16String, &m_pText, 2*m_pDialogReturn.numCharsResultString);
+}
+
+EKeyboardResult CKeyboard::RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode)
+{
+ m_pFunc = Func;
+ m_lpParam = lpParam;
+ SetMode(1);
+ inputFieldInfo.message = (uint16_t *)Title;
+ inputFieldInfo.init_text = (uint16_t *)Text;
+ inputFieldInfo.limit_length = uiMaxChars;
+ m_fX = 0.0f;
+ m_fY = 0;
+ m_pDialogParam.allowOskPanelFlg = CELL_OSKDIALOG_PANELMODE_DEFAULT;
+ m_pDialogParam.firstViewPanel = CELL_OSKDIALOG_PANELMODE_DEFAULT;
+
+ switch (eMode)
+ {
+ case C_4JInput::EKeyboardMode_Alphabet_Extended:
+ m_pDialogParam.allowOskPanelFlg = CELL_OSKDIALOG_PANELMODE_LATIN;
+ m_pDialogParam.firstViewPanel = CELL_OSKDIALOG_PANELMODE_LATIN;
+ break;
+ case C_4JInput::EKeyboardMode_Alphabet:
+ m_pDialogParam.allowOskPanelFlg = CELL_OSKDIALOG_PANELMODE_ALPHABET;
+ m_pDialogParam.firstViewPanel = CELL_OSKDIALOG_PANELMODE_ALPHABET;
+ break;
+ case C_4JInput::EKeyboardMode_Password:
+ m_pDialogParam.allowOskPanelFlg = CELL_OSKDIALOG_PANELMODE_PASSWORD;
+ m_pDialogParam.firstViewPanel = CELL_OSKDIALOG_PANELMODE_PASSWORD;
+ break;
+ case C_4JInput::EKeyboardMode_Numeric:
+ m_pDialogParam.allowOskPanelFlg = CELL_OSKDIALOG_PANELMODE_NUMERAL;
+ m_pDialogParam.firstViewPanel = CELL_OSKDIALOG_PANELMODE_NUMERAL;
+ break;
+ }
+
+ m_pDialogParam.controlPoint.x = m_fX;
+ m_pDialogParam.prohibitFlgs = 0;
+ m_pDialogParam.controlPoint.y = m_fY;
+ m_pDialogReturn.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK;
+ m_pDialogReturn.numCharsResultString = uiMaxChars;
+ memset(m_pText, 0, sizeof(*m_pText));
+ m_pDialogReturn.pResultString = (uint16_t *)m_pText;
+ return EKeyboard_Pending;
+}
+
+void CKeyboard::DestroyKeyboard()
+{
+ if (m_iMode == 4)
+ m_pFunc = NULL;
+}
+
+void CKeyboard::register_osk_callback()
+{
+ cellOskDialogExtRegisterKeyboardEventHookCallback(3, &CKeyboard::OSK_KeyhookCallback);
+}
+
+bool CKeyboard::OSK_KeyhookCallback(CellOskDialogKeyMessage *keyMessage, unsigned int *action, void *pActionInfo)
+{
+ *action = CELL_OSKDIALOG_CHANGE_NO_EVENT;
+ return false;
+}
+
+void CKeyboard::KeyboardEventsCallback(uint64_t status, uint64_t param, CKeyboard* userdata)
+{
+ switch (status)
+ {
+ case CELL_SYSUTIL_OSKDIALOG_DISPLAY_CHANGED:
+ InternalInputManager.DebugPrintf("CELL_SYSUTIL_OSKDIALOG_FINISHED");
+ if ( param == CELL_OSKDIALOG_DISPLAY_STATUS_HIDE )
+ {
+ InternalInputManager.DebugPrintf("CELL_SYSUTIL_OSKDIALOG_FINISHED\n");
+ InternalInputManager.DebugPrintf("Completed hide of OSK.\n");
+ }
+ InternalInputManager.DebugPrintf("CELL_SYSUTIL_OSKDIALOG_FINISHED\n");
+ break;
+ case CELL_SYSUTIL_OSKDIALOG_INPUT_DEVICE_CHANGED:
+ InternalInputManager.DebugPrintf("CELL_SYSUTIL_OSKDIALOG_FINISHED\n");
+ if ( param == CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD )
+ {
+ InternalInputManager.DebugPrintf("Input device changed to keyboard.\n");
+ }
+ else if( param == CELL_OSKDIALOG_INPUT_DEVICE_PAD)
+ {
+ InternalInputManager.DebugPrintf("Input device changed to pad.\n");
+ }
+ break;
+ case CELL_SYSUTIL_OSKDIALOG_INPUT_CANCELED:
+ case CELL_SYSUTIL_OSKDIALOG_INPUT_ENTERED:
+ InternalInputManager.DebugPrintf("CELL_SYSUTIL_OSKDIALOG_FINISHED\n");
+ break;
+ case CELL_SYSUTIL_OSKDIALOG_FINISHED:
+ InternalInputManager.DebugPrintf("CELL_SYSUTIL_OSKDIALOG_FINISHED\n");
+
+ if ( userdata->GetMode() == 4 )
+ userdata->SetMode(5);
+
+ break;
+ case CELL_SYSUTIL_OSKDIALOG_LOADED:
+ InternalInputManager.DebugPrintf("CELL_SYSUTIL_OSKDIALOG_LOADED\n");
+ break;
+ case CELL_SYSUTIL_SYSTEM_MENU_CLOSE:
+ InternalInputManager.DebugPrintf("CELL_SYSUTIL_OSKDIALOG_FINISHED\n");
+ InternalInputManager.DebugPrintf("CELL_SYSUTIL_SYSTEM_MENU_CLOSE\n");
+ break;
+ case CELL_SYSUTIL_SYSTEM_MENU_OPEN:
+ InternalInputManager.DebugPrintf("CELL_SYSUTIL_SYSTEM_MENU_OPEN\n");
+ break;
+ }
+}
+
+void CKeyboard::SetKeyboardLanguage()
+{
+ int language;
+ cellSysutilGetSystemParamInt(CELL_SYSUTIL_SYSTEMPARAM_ID_LANG, &language);
+
+ switch (language)
+ {
+ case CELL_SYSUTIL_LANG_PORTUGUESE_BR:
+ m_iLanguage = 0x10000;
+ return;
+ case CELL_SYSUTIL_LANG_CHINESE_T:
+ case CELL_SYSUTIL_LANG_CHINESE_S:
+ m_iLanguage = 0x4000;
+ return;
+ case CELL_SYSUTIL_LANG_PORTUGUESE_PT:
+ m_iLanguage = 0x40;
+ return;
+ case CELL_SYSUTIL_LANG_ITALIAN:
+ m_iLanguage = 0x10;
+ return;
+ case CELL_SYSUTIL_LANG_GERMAN:
+ m_iLanguage = 0x1;
+ return;
+ case CELL_SYSUTIL_LANG_SPANISH:
+ m_iLanguage = 0x4;
+ return;
+ case CELL_SYSUTIL_LANG_FRENCH:
+ m_iLanguage = 0x8;
+ return;
+ case CELL_SYSUTIL_LANG_DUTCH:
+ case CELL_SYSUTIL_LANG_ENGLISH_US:
+ m_iLanguage = 0x2;
+ return;
+ case CELL_SYSUTIL_LANG_JAPANESE:
+ m_iLanguage = 0x200000;
+ return;
+ case CELL_SYSUTIL_LANG_KOREAN:
+ m_iLanguage = 0x1000;
+ return;
+ case CELL_SYSUTIL_LANG_RUSSIAN:
+ m_iLanguage = 0x80;
+ return;
+ }
+
+ m_iLanguage = 0x200000;
+}
+
+void CKeyboard::SetMode(int mode)
+{
+ m_iMode = mode;
+}
+
+CKeyboard *CKeyboard::GetInstance()
+{
+ return m_pInstance;
+}
+
+int CKeyboard::GetMode()
+{
+ return m_iMode;
+}
\ No newline at end of file
diff --git a/4J_Input/PS3/INP_OnScreenKeyboard.h b/4J_Input/PS3/INP_OnScreenKeyboard.h
new file mode 100644
index 0000000..65853db
--- /dev/null
+++ b/4J_Input/PS3/INP_OnScreenKeyboard.h
@@ -0,0 +1,51 @@
+#pragma once
+
+#include "4J_Input.h"
+#include // cellSysutilRegisterCallback
+#include // cellOskDialogUnloadAsync
+#include // cellOskDialogExtRegisterKeyboardEventHookCallback
+#include // cellSysutilGetSystemParamInt
+#include | // SYS_MEMORY_CONTAINER_ID_INVALID
+
+class CKeyboard
+{
+public:
+ // PIEBOT: m_iMode is supposed to be using eKeyboardProcessState
+ // I'll leave that work to someone else.
+ enum eKeyboardProcessState
+ {
+ };
+
+ CKeyboard();
+
+ void Tick();
+ void GetText(uint16_t *UTF16String);
+ EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode);
+ void DestroyKeyboard();
+
+ void register_osk_callback();
+ static bool OSK_KeyhookCallback(CellOskDialogKeyMessage *keyMessage, unsigned int *action, void *pActionInfo);
+ static void KeyboardEventsCallback(uint64_t status, uint64_t param, CKeyboard* userdata);
+ void SetKeyboardLanguage();
+
+ void SetMode(int mode);
+ CKeyboard *GetInstance();
+ int GetMode();
+private:
+ int m_iMode;
+
+ int (*m_pFunc)(LPVOID, const bool);
+ LPVOID m_lpParam;
+ CellOskDialogParam m_pDialogParam;
+ float m_fX;
+ float m_fY;
+ CellOskDialogInputFieldInfo inputFieldInfo;
+
+ CellOskDialogCallbackReturnParam m_pDialogReturn;
+ uint16_t *m_pText[513];
+
+ int m_iLanguage;
+
+ CKeyboard *m_pInstance;
+ int m_pTickCountdown;
+};
\ No newline at end of file
diff --git a/4J_Input/stdafx.h b/4J_Input/stdafx.h
index 694cd67..4f48e1e 100644
--- a/4J_Input/stdafx.h
+++ b/4J_Input/stdafx.h
@@ -23,4 +23,8 @@
#include "extraX64.h"
#endif
+#ifdef __PS3__
+#include "Ps3Types.h"
+#endif
+
#endif //PCH_H
diff --git a/4J_Profile/4J_Profile.vcxproj b/4J_Profile/4J_Profile.vcxproj
index eb81c6c..b79a076 100644
--- a/4J_Profile/4J_Profile.vcxproj
+++ b/4J_Profile/4J_Profile.vcxproj
@@ -9,6 +9,10 @@
Debug
ORBIS
| |
+
+ Debug
+ PS3
+
Debug
x64
@@ -21,6 +25,10 @@
Release
ORBIS
+
+ Release
+ PS3
+
Release
x64
@@ -31,68 +39,90 @@
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
@@ -100,56 +130,74 @@
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
true
true
true
+ true
true
+ true
@@ -183,10 +231,18 @@
Clang
StaticLibrary
+
+ Clang
+ StaticLibrary
+
Clang
StaticLibrary
+
+ SNC
+ StaticLibrary
+
@@ -223,10 +279,18 @@
Build\$(Platform)\$(Configuration)\
.a
+
+ Build\$(Platform)\$(Configuration)\
+ .a
+
Build\$(Platform)\$(Configuration)\
.a
+
+ Build\$(Platform)\$(Configuration)\
+ .a
+
NotUsing
@@ -283,6 +347,12 @@
NormalWarnings
+
+
+ ../Headers/PS3;../Headers;$(ProjectDir);%(AdditionalIncludeDirectories)
+ NormalWarnings
+
+
diff --git a/4J_Render/4J_Render.vcxproj b/4J_Render/4J_Render.vcxproj
index 784b98b..e212a57 100644
--- a/4J_Render/4J_Render.vcxproj
+++ b/4J_Render/4J_Render.vcxproj
@@ -9,6 +9,10 @@
Debug
ORBIS
+
+ Debug
+ PS3
+
Debug
x64
@@ -21,179 +25,267 @@
Release
ORBIS
+
+ Release
+ PS3
+
Release
x64
+
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
+
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
@@ -225,10 +317,18 @@
Clang
StaticLibrary
+
+ Clang
+ StaticLibrary
+
Clang
StaticLibrary
+
+ SNC
+ StaticLibrary
+
@@ -265,10 +365,18 @@
Build\$(Platform)\$(Configuration)\
.a
+
+ Build\$(Platform)\$(Configuration)\
+ .a
+
Build\$(Platform)\$(Configuration)\
.a
+
+ Build\$(Platform)\$(Configuration)\
+ .a
+
NotUsing
@@ -333,6 +441,12 @@
NormalWarnings
+
+
+ ../Headers/PS3;../Headers;$(ProjectDir);%(AdditionalIncludeDirectories)
+ NormalWarnings
+
+
diff --git a/4J_Render/4J_Render.vcxproj.filters b/4J_Render/4J_Render.vcxproj.filters
index 3e8b824..7734516 100644
--- a/4J_Render/4J_Render.vcxproj.filters
+++ b/4J_Render/4J_Render.vcxproj.filters
@@ -90,6 +90,9 @@
Source Files
+
+ Source Files
+
@@ -146,5 +149,8 @@
Header Files
+
+ Header Files
+
\ No newline at end of file
diff --git a/4J_Render/PS3/RendererCore.cpp b/4J_Render/PS3/RendererCore.cpp
new file mode 100644
index 0000000..e69de29
diff --git a/4J_Render/PS3/RendererCore.h b/4J_Render/PS3/RendererCore.h
new file mode 100644
index 0000000..e69de29
diff --git a/4J_Storage/4J_Storage.vcxproj b/4J_Storage/4J_Storage.vcxproj
index 9ea021e..a54218c 100644
--- a/4J_Storage/4J_Storage.vcxproj
+++ b/4J_Storage/4J_Storage.vcxproj
@@ -9,6 +9,10 @@
Debug
ORBIS
+
+ Debug
+ PS3
+
Debug
x64
@@ -21,6 +25,10 @@
Release
ORBIS
+
+ Release
+ PS3
+
Release
x64
@@ -30,34 +38,48 @@
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
true
+ true
@@ -89,10 +111,18 @@
Clang
StaticLibrary
+
+ Clang
+ StaticLibrary
+
Clang
StaticLibrary
+
+ SNC
+ StaticLibrary
+
@@ -123,10 +153,18 @@
Build\$(Platform)\$(Configuration)\
.a
+
+ Build\$(Platform)\$(Configuration)\
+ .a
+
Build\$(Platform)\$(Configuration)\
.a
+
+ Build\$(Platform)\$(Configuration)\
+ .a
+
NotUsing
@@ -183,6 +221,12 @@
NormalWarnings
+
+
+ ../Headers/PS3;../Headers;$(ProjectDir);%(AdditionalIncludeDirectories)
+ NormalWarnings
+
+
diff --git a/4J_XTMS/4J_XTMS.vcxproj b/4J_XTMS/4J_XTMS.vcxproj
index 96a072e..d30c3b6 100644
--- a/4J_XTMS/4J_XTMS.vcxproj
+++ b/4J_XTMS/4J_XTMS.vcxproj
@@ -9,6 +9,10 @@
Debug
ORBIS
+
+ Debug
+ PS3
+
Debug
x64
@@ -21,6 +25,10 @@
Release
ORBIS
+
+ Release
+ PS3
+
Release
x64
@@ -54,9 +62,15 @@
Clang
+
+ Clang
+
Clang
+
+ Clang
+
@@ -84,9 +98,15 @@
Build\$(Platform)\$(Configuration)\
+
+ Build\$(Platform)\$(Configuration)\
+
Build\$(Platform)\$(Configuration)\
+
+ Build\$(Platform)\$(Configuration)\
+
NotUsing
diff --git a/Headers/Ps3Types.h b/Headers/Ps3Types.h
new file mode 100644
index 0000000..5381add
--- /dev/null
+++ b/Headers/Ps3Types.h
@@ -0,0 +1,258 @@
+
+
+#pragma once
+
+
+#define BOOST_NO_CXX11_NULLPTR
+#define BOOST_ENABLE_ASSERT_HANDLER
+#include
+
+#include
+
+
+#define __forceinline inline
+
+//#include "winerror.h"
+
+
+// user the pool_allocator for all unordered_set and unordered_map instances
+// template < class T, class H = hash, class P = std::equal_to, class A = boost::pool_allocator >
+// class unordered_set : public std::tr1::unordered_set
+// {};
+//
+// template , class P = std::equal_to, class A = boost::pool_allocator > >
+// class unordered_map : public std::tr1::unordered_map
+// {};
+
+
+
+// template < class T, class H = hash, class P = std::equal_to, class A = C4JPoolAllocator >
+// class unordered_set : public std::tr1::unordered_set
+// {};
+//
+// template , class P = std::equal_to, class A = C4JPoolAllocator > >
+// class unordered_map : public std::tr1::unordered_map
+// {};
+
+
+// using boost::ublas::vector;
+
+#define static_assert(a,b) BOOST_STATIC_ASSERT(a)
+#define AUTO_VAR BOOST_AUTO
+
+#define RtlEqualMemory(Destination,Source,Length) (!memcmp((Destination),(Source),(Length)))
+#define RtlMoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length))
+#define RtlCopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length))
+#define RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length))
+#define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
+
+#define MoveMemory RtlMoveMemory
+#define CopyMemory RtlCopyMemory
+#define FillMemory RtlFillMemory
+#define ZeroMemory RtlZeroMemory
+
+
+
+
+// #include
+// #include "DirectX\DirectXMath.h"
+// using namespace DirectX;
+
+#define S_OK 0
+
+
+typedef unsigned long DWORD;
+typedef int BOOL;
+typedef unsigned char BYTE;
+typedef unsigned short WORD;
+typedef float FLOAT;
+
+typedef int __int32;
+
+typedef FLOAT *PFLOAT;
+typedef BOOL *PBOOL;
+typedef BOOL *LPBOOL;
+typedef BYTE *PBYTE;
+typedef BYTE *LPBYTE;
+typedef int *PINT;
+typedef int *LPINT;
+typedef WORD *PWORD;
+typedef WORD *LPWORD;
+typedef long *PLONG;
+typedef long *LPLONG;
+typedef DWORD *PDWORD;
+typedef DWORD *LPDWORD;
+typedef void *LPVOID;
+typedef const void *LPCVOID;
+typedef void *PVOID;
+typedef unsigned long ULONG;
+
+typedef unsigned char boolean;
+
+typedef int INT;
+typedef unsigned int UINT;
+typedef unsigned int *PUINT;
+
+
+typedef unsigned char byte;
+typedef long long __int64;
+typedef unsigned long long __uint64;
+typedef unsigned long DWORD;
+typedef int INT;
+typedef unsigned long ULONG_PTR, *PULONG_PTR;
+typedef ULONG_PTR SIZE_T, *PSIZE_T;
+
+typedef __int64 LONG64, *PLONG64;
+
+#define VOID void
+typedef char CHAR;
+typedef short SHORT;
+typedef long LONG;
+typedef __int64 LONGLONG;
+typedef __uint64 ULONGLONG;
+
+
+#define CONST const
+typedef wchar_t WCHAR; // wc, 16-bit UNICODE character
+typedef WCHAR *PWCHAR;
+typedef WCHAR *LPWCH, *PWCH;
+typedef CONST WCHAR *LPCWCH, *PCWCH;
+typedef WCHAR *NWPSTR;
+typedef WCHAR *LPWSTR, *PWSTR;
+typedef CONST WCHAR *LPCWSTR, *PCWSTR;
+
+//
+// ANSI (Multi-byte Character) types
+//
+typedef CHAR *PCHAR;
+typedef CHAR *LPCH, *PCH;
+typedef CONST CHAR *LPCCH, *PCCH;
+typedef CHAR *NPSTR;
+typedef CHAR *LPSTR, *PSTR;
+typedef CONST CHAR *LPCSTR, *PCSTR;
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+
+typedef struct _FILETIME {
+#ifdef _M_PPCBE
+ DWORD dwHighDateTime;
+ DWORD dwLowDateTime;
+#else
+ DWORD dwLowDateTime;
+ DWORD dwHighDateTime;
+#endif
+} FILETIME, *PFILETIME, *LPFILETIME;
+
+
+#if defined(MIDL_PASS)
+typedef struct _LARGE_INTEGER {
+#else // MIDL_PASS
+typedef union _LARGE_INTEGER {
+ struct {
+#if defined(_M_PPCBE)
+ LONG HighPart;
+ DWORD LowPart;
+#else
+ DWORD LowPart;
+ LONG HighPart;
+#endif
+ };
+ struct {
+#if defined(_M_PPCBE)
+ LONG HighPart;
+ DWORD LowPart;
+#else
+ DWORD LowPart;
+ LONG HighPart;
+#endif
+ } u;
+#endif //MIDL_PASS
+ LONGLONG QuadPart;
+} LARGE_INTEGER;
+
+typedef LARGE_INTEGER *PLARGE_INTEGER;
+
+#if defined(MIDL_PASS)
+typedef struct _ULARGE_INTEGER {
+#else // MIDL_PASS
+typedef union _ULARGE_INTEGER {
+ struct {
+#if defined(_M_PPCBE)
+ DWORD HighPart;
+ DWORD LowPart;
+#else
+ DWORD LowPart;
+ DWORD HighPart;
+#endif
+ };
+ struct {
+#if defined(_M_PPCBE)
+ DWORD HighPart;
+ DWORD LowPart;
+#else
+ DWORD LowPart;
+ DWORD HighPart;
+#endif
+ } u;
+#endif //MIDL_PASS
+ ULONGLONG QuadPart;
+} ULARGE_INTEGER;
+
+typedef ULARGE_INTEGER *PULARGE_INTEGER;
+
+// 360 specifics
+typedef long HRESULT;
+typedef void* HANDLE;
+
+#define DECLARE_HANDLE(name) typedef HANDLE name
+DECLARE_HANDLE(HINSTANCE);
+
+typedef HINSTANCE HMODULE; /* HMODULEs can be used in place of HINSTANCEs */
+
+
+typedef struct _OVERLAPPED {
+ ULONG_PTR Internal;
+ ULONG_PTR InternalHigh;
+ DWORD Offset;
+ DWORD OffsetHigh;
+ HANDLE hEvent;
+} OVERLAPPED, *LPOVERLAPPED;
+
+typedef LPVOID PSECURITY_ATTRIBUTES;
+typedef LPVOID LPSECURITY_ATTRIBUTES;
+
+
+
+#define __in_ecount(a)
+#define __in_bcount(a)
+
+
+
+
+
+// const int XUSER_MAX_COUNT = 4;
+
+#include
+#include
+#include
+#include
+
+#ifdef _CONTENT_PACKAGE
+#define PS3_ASSERT(val)
+#define PS3_ASSERT_CELL_ERROR(errVal)
+#elif defined(_RELEASE_FOR_ART)
+#define PS3_ASSERT(val)
+#define PS3_ASSERT_CELL_ERROR(errVal)
+#else
+#define PS3_ASSERT(val) if(!(val)) { printf("----------------------\n"); printf("Assert failed!!!\n"); printf(#val); printf("\n"); printf("%s failed.\nFile %s\nline %d \n----------------------\n", __FUNCTION__, __FILE__, __LINE__); snPause(); }
+#define PS3_ASSERT_CELL_ERROR(errVal) if(errVal != CELL_OK) { printf("----------------------\n %s failed with error %d [0x%08x]\n----------------------\n", __FUNCTION__, errVal, errVal); PS3_ASSERT(0); }
+#endif
+
+#define assert PS3_ASSERT
diff --git a/Headers/extraX64.h b/Headers/extraX64.h
index b907918..cd53654 100644
--- a/Headers/extraX64.h
+++ b/Headers/extraX64.h
@@ -19,12 +19,6 @@ const int XUSER_MAX_COUNT = 4;
const int MINECRAFT_NET_MAX_PLAYERS = 8;
#endif
-// @Patoke: i'm sorry i had to do this for compat
-namespace sigma
-{
- enum class byte : unsigned char {};
-}
-
#ifdef __ORBIS__
#include
#include
@@ -40,10 +34,7 @@ typedef SQRNetworkManager_Orbis::PresenceSyncInfo INVITE_INFO;
#include
#include
#include
-#include "..\..\Minecraft.Client\PS3\PS3_PlayerUID.h"
-#include "..\..\Minecraft.Client\PS3\Network\SQRNetworkManager_PS3.h"
-typedef SQRNetworkManager::SessionID SessionID;
-typedef SQRNetworkManager::PresenceSyncInfo INVITE_INFO;
+#include "Ps3Types.h"
#elif defined __PSVITA__
#include
@@ -69,7 +60,7 @@ class INVITE_INFO;
#endif // __PS3__
-#ifndef _DURANGO
+#if !(defined _DURANGO || __PS3__)
typedef PlayerUID *PPlayerUID;
#endif
typedef struct _XUIOBJ* HXUIOBJ;
@@ -83,49 +74,8 @@ typedef struct _XUIDC* HXUIDC;
// void GetLocalTime(SYSTEMTIME *time);
// #endif
-bool IsEqualXUID(PlayerUID a, PlayerUID b);
-
using namespace std;
-// Temporary implementation of lock free stack with quite a bit more locking than you might expect
-template class XLockFreeStack
-{
- std::vector intStack;
-public:
- XLockFreeStack() {
-#ifdef __ORBIS__
- OrbisInit(); // For PS4, we need to make sure Ult is set up for the critical sections to be able to initialise
-#endif
- InitializeCriticalSectionAndSpinCount(&m_cs,5120);
- }
- ~XLockFreeStack() { DeleteCriticalSection( &m_cs ); }
- void Initialize() {}
- void Push(T *data)
- {
- EnterCriticalSection(&m_cs);
- intStack.push_back(data);
- LeaveCriticalSection(&m_cs);
- }
- T *Pop()
- {
- EnterCriticalSection(&m_cs);
- if( intStack.size() )
- {
- T* ret = intStack.back();
- intStack.pop_back();
- LeaveCriticalSection(&m_cs);
- return ret;
- }
- else
- {
- LeaveCriticalSection(&m_cs);
- return NULL;
- }
- }
-private:
- CRITICAL_SECTION m_cs;
-};
-
void XMemCpy(void *a, const void *b, size_t s);
void XMemSet(void *a, int t, size_t s);
void XMemSet128(void *a, int t, size_t s);
@@ -204,7 +154,6 @@ public:
bool IsHost();
bool IsGuest();
bool IsLocal();
- PlayerUID GetXuid();
LPCWSTR GetGamertag();
int GetSessionIndex();
bool IsTalking();
@@ -258,19 +207,6 @@ typedef struct _XSESSION_SEARCHRESULT_HEADER {
XSESSION_SEARCHRESULT *pResults;
} XSESSION_SEARCHRESULT_HEADER, *PXSESSION_SEARCHRESULT_HEADER;
-typedef struct _XONLINE_FRIEND {
- PlayerUID xuid;
- CHAR szGamertag[XUSER_NAME_SIZE];
- DWORD dwFriendState;
- SessionID sessionID;
- DWORD dwTitleID;
- FILETIME ftUserTime;
- SessionID xnkidInvite;
- FILETIME gameinviteTime;
- DWORD cchRichPresence;
-// WCHAR wszRichPresence[MAX_RICHPRESENCE_SIZE];
-} XONLINE_FRIEND, *PXONLINE_FRIEND;
-
class IQNetCallbacks
{
};
@@ -294,25 +230,6 @@ typedef enum _QNET_STATE
QNET_STATE_SESSION_DELETING
} QNET_STATE, * PQNET_STATE;
-class IQNet
-{
-public:
- HRESULT AddLocalPlayerByUserIndex(DWORD dwUserIndex);
- IQNetPlayer *GetHostPlayer();
- IQNetPlayer *GetLocalPlayerByUserIndex(DWORD dwUserIndex);
- IQNetPlayer *GetPlayerByIndex(DWORD dwPlayerIndex);
- IQNetPlayer *GetPlayerBySmallId(BYTE SmallId);
- IQNetPlayer *GetPlayerByXuid(PlayerUID xuid);
- DWORD GetPlayerCount();
- QNET_STATE GetState();
- bool IsHost();
- HRESULT JoinGameFromInviteInfo(DWORD dwUserIndex, DWORD dwUserMask, const INVITE_INFO *pInviteInfo);
- void HostGame();
- void EndGame();
-
- static IQNetPlayer m_player[4];
-};
-
#ifdef _DURANGO
// 4J Stu - We don't want to be doing string conversions at runtime for timing instrumentation, so do this instead
#define PIXBeginNamedEvent(a, b, ...) PIXBeginEvent(a,L ## b, __VA_ARGS__)
@@ -402,31 +319,13 @@ typedef enum
const int QNET_SENDDATA_RELIABLE = 0;
const int QNET_SENDDATA_SEQUENTIAL = 0;
-struct XRNM_SEND_BUFFER
-{
- DWORD dwDataSize;
- sigma::byte *pbyData;
-};
-
const int D3DBLEND_CONSTANTALPHA = 0;
const int D3DBLEND_INVCONSTANTALPHA = 0;
const int D3DPT_QUADLIST = 0;
-
-typedef struct _XUSER_SIGNIN_INFO {
- PlayerUID xuid;
- DWORD dwGuestNumber;
-} XUSER_SIGNIN_INFO, *PXUSER_SIGNIN_INFO;
-
#define XUSER_GET_SIGNIN_INFO_ONLINE_XUID_ONLY 0x00000001
#define XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY 0x00000002
-DWORD XUserGetSigninInfo(
- DWORD dwUserIndex,
- DWORD dwFlags,
- PXUSER_SIGNIN_INFO pSigninInfo
-);
-
class CXuiStringTable
{
public:
diff --git a/Ps3Types.h b/Ps3Types.h
new file mode 100644
index 0000000..83e1c18
--- /dev/null
+++ b/Ps3Types.h
@@ -0,0 +1,108 @@
+#define S_OK 0
+
+
+typedef unsigned long DWORD;
+typedef int BOOL;
+typedef unsigned char BYTE;
+typedef unsigned short WORD;
+typedef float FLOAT;
+
+typedef int __int32;
+
+typedef FLOAT *PFLOAT;
+typedef BOOL *PBOOL;
+typedef BOOL *LPBOOL;
+typedef BYTE *PBYTE;
+typedef BYTE *LPBYTE;
+typedef int *PINT;
+typedef int *LPINT;
+typedef WORD *PWORD;
+typedef WORD *LPWORD;
+typedef long *PLONG;
+typedef long *LPLONG;
+typedef DWORD *PDWORD;
+typedef DWORD *LPDWORD;
+typedef void *LPVOID;
+typedef const void *LPCVOID;
+typedef void *PVOID;
+typedef unsigned long ULONG;
+
+typedef unsigned char boolean;
+
+typedef int INT;
+typedef unsigned int UINT;
+typedef unsigned int *PUINT;
+
+
+typedef unsigned char byte;
+typedef long long __int64;
+typedef unsigned long long __uint64;
+typedef unsigned long DWORD;
+typedef int INT;
+typedef unsigned long ULONG_PTR, *PULONG_PTR;
+typedef ULONG_PTR SIZE_T, *PSIZE_T;
+
+typedef __int64 LONG64, *PLONG64;
+
+#define VOID void
+typedef char CHAR;
+typedef short SHORT;
+typedef long LONG;
+typedef __int64 LONGLONG;
+typedef __uint64 ULONGLONG;
+
+
+#define CONST const
+typedef wchar_t WCHAR; // wc, 16-bit UNICODE character
+typedef WCHAR *PWCHAR;
+typedef WCHAR *LPWCH, *PWCH;
+typedef CONST WCHAR *LPCWCH, *PCWCH;
+typedef WCHAR *NWPSTR;
+typedef WCHAR *LPWSTR, *PWSTR;
+typedef CONST WCHAR *LPCWSTR, *PCWSTR;
+
+//
+// ANSI (Multi-byte Character) types
+//
+typedef CHAR *PCHAR;
+typedef CHAR *LPCH, *PCH;
+typedef CONST CHAR *LPCCH, *PCCH;
+typedef CHAR *NPSTR;
+typedef CHAR *LPSTR, *PSTR;
+typedef CONST CHAR *LPCSTR, *PCSTR;
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#if defined(MIDL_PASS)
+typedef struct _LARGE_INTEGER {
+#else // MIDL_PASS
+typedef union _LARGE_INTEGER {
+ struct {
+#if defined(_M_PPCBE)
+ LONG HighPart;
+ DWORD LowPart;
+#else
+ DWORD LowPart;
+ LONG HighPart;
+#endif
+ };
+ struct {
+#if defined(_M_PPCBE)
+ LONG HighPart;
+ DWORD LowPart;
+#else
+ DWORD LowPart;
+ LONG HighPart;
+#endif
+ } u;
+#endif //MIDL_PASS
+ LONGLONG QuadPart;
+} LARGE_INTEGER;
+
+typedef LARGE_INTEGER *PLARGE_INTEGER;