diff --git a/.gitignore b/.gitignore index 7c08de3..6129662 100644 --- a/.gitignore +++ b/.gitignore @@ -23,8 +23,10 @@ Executables/ mono_crash.* # Build results +Orbis_[Dd]ebug/ [Dd]ebug/ [Dd]ebugPublic/ +Orbis_[Rr]elease/ [Rr]elease/ [Rr]eleases/ x64/ @@ -103,6 +105,10 @@ StyleCopReport.xml *.pidb *.svclog *.scc +*.obj +*.a +*.o +*.tlog # Chutzpah Test files _Chutzpah* diff --git a/Orbis Suite 3.0.sln b/Orbis Suite 3.0.sln index 7b88266..55acb9e 100644 --- a/Orbis Suite 3.0.sln +++ b/Orbis Suite 3.0.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.0.31919.166 +VisualStudioVersion = 17.4.33213.308 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Windows", "Windows", "{8F0E1457-FB1E-47A4-9DA8-74A6B757CAA4}" EndProject @@ -51,13 +51,21 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrbisLib2", "Windows\Librar EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrbisPeeknPoke", "Windows\OrbisPeeknPoke\OrbisPeeknPoke.csproj", "{90180080-9585-499C-99A8-6F4D1725CAF4}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OrbisLibAPI-2.0", "Playstation\OrbisLibAPI-2.0\OrbisLibAPI-2.0.vcxproj", "{02162131-862F-4D65-A3FB-A670D4790F7E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OrbisUtils", "Playstation\OrbisUtils\OrbisUtils.vcxproj", "{6616120A-EACC-4A05-8F48-6B9B32DEEE75}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "v2", "v2", "{F9EC9EAD-0B38-467B-BF57-2E6A4DA29756}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|ORBIS = Debug|ORBIS Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|ORBIS = Release|ORBIS Release|Win32 = Release|Win32 Release|x64 = Release|x64 Release|x86 = Release|x86 @@ -65,6 +73,8 @@ Global GlobalSection(ProjectConfigurationPlatforms) = postSolution {81B068F7-776C-429F-BB7B-5563F75F1A39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {81B068F7-776C-429F-BB7B-5563F75F1A39}.Debug|Any CPU.Build.0 = Debug|Any CPU + {81B068F7-776C-429F-BB7B-5563F75F1A39}.Debug|ORBIS.ActiveCfg = Debug|Any CPU + {81B068F7-776C-429F-BB7B-5563F75F1A39}.Debug|ORBIS.Build.0 = Debug|Any CPU {81B068F7-776C-429F-BB7B-5563F75F1A39}.Debug|Win32.ActiveCfg = Debug|Any CPU {81B068F7-776C-429F-BB7B-5563F75F1A39}.Debug|Win32.Build.0 = Debug|Any CPU {81B068F7-776C-429F-BB7B-5563F75F1A39}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -73,6 +83,8 @@ Global {81B068F7-776C-429F-BB7B-5563F75F1A39}.Debug|x86.Build.0 = Debug|Any CPU {81B068F7-776C-429F-BB7B-5563F75F1A39}.Release|Any CPU.ActiveCfg = Release|Any CPU {81B068F7-776C-429F-BB7B-5563F75F1A39}.Release|Any CPU.Build.0 = Release|Any CPU + {81B068F7-776C-429F-BB7B-5563F75F1A39}.Release|ORBIS.ActiveCfg = Release|Any CPU + {81B068F7-776C-429F-BB7B-5563F75F1A39}.Release|ORBIS.Build.0 = Release|Any CPU {81B068F7-776C-429F-BB7B-5563F75F1A39}.Release|Win32.ActiveCfg = Release|Any CPU {81B068F7-776C-429F-BB7B-5563F75F1A39}.Release|Win32.Build.0 = Release|Any CPU {81B068F7-776C-429F-BB7B-5563F75F1A39}.Release|x64.ActiveCfg = Release|Any CPU @@ -81,6 +93,8 @@ Global {81B068F7-776C-429F-BB7B-5563F75F1A39}.Release|x86.Build.0 = Release|Any CPU {D7CFB2D5-FAC2-42D5-ABA7-81CE762575EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D7CFB2D5-FAC2-42D5-ABA7-81CE762575EF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7CFB2D5-FAC2-42D5-ABA7-81CE762575EF}.Debug|ORBIS.ActiveCfg = Debug|Any CPU + {D7CFB2D5-FAC2-42D5-ABA7-81CE762575EF}.Debug|ORBIS.Build.0 = Debug|Any CPU {D7CFB2D5-FAC2-42D5-ABA7-81CE762575EF}.Debug|Win32.ActiveCfg = Debug|Any CPU {D7CFB2D5-FAC2-42D5-ABA7-81CE762575EF}.Debug|Win32.Build.0 = Debug|Any CPU {D7CFB2D5-FAC2-42D5-ABA7-81CE762575EF}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -89,6 +103,8 @@ Global {D7CFB2D5-FAC2-42D5-ABA7-81CE762575EF}.Debug|x86.Build.0 = Debug|Any CPU {D7CFB2D5-FAC2-42D5-ABA7-81CE762575EF}.Release|Any CPU.ActiveCfg = Release|Any CPU {D7CFB2D5-FAC2-42D5-ABA7-81CE762575EF}.Release|Any CPU.Build.0 = Release|Any CPU + {D7CFB2D5-FAC2-42D5-ABA7-81CE762575EF}.Release|ORBIS.ActiveCfg = Release|Any CPU + {D7CFB2D5-FAC2-42D5-ABA7-81CE762575EF}.Release|ORBIS.Build.0 = Release|Any CPU {D7CFB2D5-FAC2-42D5-ABA7-81CE762575EF}.Release|Win32.ActiveCfg = Release|Any CPU {D7CFB2D5-FAC2-42D5-ABA7-81CE762575EF}.Release|Win32.Build.0 = Release|Any CPU {D7CFB2D5-FAC2-42D5-ABA7-81CE762575EF}.Release|x64.ActiveCfg = Release|Any CPU @@ -97,6 +113,7 @@ Global {D7CFB2D5-FAC2-42D5-ABA7-81CE762575EF}.Release|x86.Build.0 = Release|Any CPU {228AA300-11F5-49B1-A6B5-4986635C6D0B}.Debug|Any CPU.ActiveCfg = Debug|x64 {228AA300-11F5-49B1-A6B5-4986635C6D0B}.Debug|Any CPU.Build.0 = Debug|x64 + {228AA300-11F5-49B1-A6B5-4986635C6D0B}.Debug|ORBIS.ActiveCfg = Debug|Win32 {228AA300-11F5-49B1-A6B5-4986635C6D0B}.Debug|Win32.ActiveCfg = Debug|Win32 {228AA300-11F5-49B1-A6B5-4986635C6D0B}.Debug|Win32.Build.0 = Debug|Win32 {228AA300-11F5-49B1-A6B5-4986635C6D0B}.Debug|x64.ActiveCfg = Debug|x64 @@ -105,6 +122,7 @@ Global {228AA300-11F5-49B1-A6B5-4986635C6D0B}.Debug|x86.Build.0 = Debug|x64 {228AA300-11F5-49B1-A6B5-4986635C6D0B}.Release|Any CPU.ActiveCfg = Release|x64 {228AA300-11F5-49B1-A6B5-4986635C6D0B}.Release|Any CPU.Build.0 = Release|x64 + {228AA300-11F5-49B1-A6B5-4986635C6D0B}.Release|ORBIS.ActiveCfg = Release|Win32 {228AA300-11F5-49B1-A6B5-4986635C6D0B}.Release|Win32.ActiveCfg = Release|x64 {228AA300-11F5-49B1-A6B5-4986635C6D0B}.Release|Win32.Build.0 = Release|x64 {228AA300-11F5-49B1-A6B5-4986635C6D0B}.Release|x64.ActiveCfg = Release|x64 @@ -113,6 +131,7 @@ Global {228AA300-11F5-49B1-A6B5-4986635C6D0B}.Release|x86.Build.0 = Release|x64 {57244F52-BA7C-4D89-9C38-D80AD9727721}.Debug|Any CPU.ActiveCfg = Debug|x64 {57244F52-BA7C-4D89-9C38-D80AD9727721}.Debug|Any CPU.Build.0 = Debug|x64 + {57244F52-BA7C-4D89-9C38-D80AD9727721}.Debug|ORBIS.ActiveCfg = Debug|x64 {57244F52-BA7C-4D89-9C38-D80AD9727721}.Debug|Win32.ActiveCfg = Debug|x64 {57244F52-BA7C-4D89-9C38-D80AD9727721}.Debug|Win32.Build.0 = Debug|x64 {57244F52-BA7C-4D89-9C38-D80AD9727721}.Debug|x64.ActiveCfg = Debug|x64 @@ -121,6 +140,7 @@ Global {57244F52-BA7C-4D89-9C38-D80AD9727721}.Debug|x86.Build.0 = Debug|x64 {57244F52-BA7C-4D89-9C38-D80AD9727721}.Release|Any CPU.ActiveCfg = Release|x64 {57244F52-BA7C-4D89-9C38-D80AD9727721}.Release|Any CPU.Build.0 = Release|x64 + {57244F52-BA7C-4D89-9C38-D80AD9727721}.Release|ORBIS.ActiveCfg = Release|x64 {57244F52-BA7C-4D89-9C38-D80AD9727721}.Release|Win32.ActiveCfg = Release|x64 {57244F52-BA7C-4D89-9C38-D80AD9727721}.Release|Win32.Build.0 = Release|x64 {57244F52-BA7C-4D89-9C38-D80AD9727721}.Release|x64.ActiveCfg = Release|x64 @@ -129,6 +149,7 @@ Global {57244F52-BA7C-4D89-9C38-D80AD9727721}.Release|x86.Build.0 = Release|x64 {0978D0B2-FFA5-42B2-81AC-0CFD85DE9184}.Debug|Any CPU.ActiveCfg = Debug|x86 {0978D0B2-FFA5-42B2-81AC-0CFD85DE9184}.Debug|Any CPU.Build.0 = Debug|x86 + {0978D0B2-FFA5-42B2-81AC-0CFD85DE9184}.Debug|ORBIS.ActiveCfg = Debug|x86 {0978D0B2-FFA5-42B2-81AC-0CFD85DE9184}.Debug|Win32.ActiveCfg = Debug|x86 {0978D0B2-FFA5-42B2-81AC-0CFD85DE9184}.Debug|Win32.Build.0 = Debug|x86 {0978D0B2-FFA5-42B2-81AC-0CFD85DE9184}.Debug|x64.ActiveCfg = Debug|x86 @@ -137,6 +158,7 @@ Global {0978D0B2-FFA5-42B2-81AC-0CFD85DE9184}.Debug|x86.Build.0 = Debug|x86 {0978D0B2-FFA5-42B2-81AC-0CFD85DE9184}.Release|Any CPU.ActiveCfg = Release|x86 {0978D0B2-FFA5-42B2-81AC-0CFD85DE9184}.Release|Any CPU.Build.0 = Release|x86 + {0978D0B2-FFA5-42B2-81AC-0CFD85DE9184}.Release|ORBIS.ActiveCfg = Release|x86 {0978D0B2-FFA5-42B2-81AC-0CFD85DE9184}.Release|Win32.ActiveCfg = Release|x86 {0978D0B2-FFA5-42B2-81AC-0CFD85DE9184}.Release|Win32.Build.0 = Release|x86 {0978D0B2-FFA5-42B2-81AC-0CFD85DE9184}.Release|x64.ActiveCfg = Release|x86 @@ -145,6 +167,7 @@ Global {0978D0B2-FFA5-42B2-81AC-0CFD85DE9184}.Release|x86.Build.0 = Release|x86 {A37095E9-80BD-4A6B-AF8B-33D278CF92F3}.Debug|Any CPU.ActiveCfg = Debug|x86 {A37095E9-80BD-4A6B-AF8B-33D278CF92F3}.Debug|Any CPU.Build.0 = Debug|x86 + {A37095E9-80BD-4A6B-AF8B-33D278CF92F3}.Debug|ORBIS.ActiveCfg = Debug|x86 {A37095E9-80BD-4A6B-AF8B-33D278CF92F3}.Debug|Win32.ActiveCfg = Debug|x86 {A37095E9-80BD-4A6B-AF8B-33D278CF92F3}.Debug|Win32.Build.0 = Debug|x86 {A37095E9-80BD-4A6B-AF8B-33D278CF92F3}.Debug|x64.ActiveCfg = Debug|x86 @@ -153,6 +176,7 @@ Global {A37095E9-80BD-4A6B-AF8B-33D278CF92F3}.Debug|x86.Build.0 = Debug|x86 {A37095E9-80BD-4A6B-AF8B-33D278CF92F3}.Release|Any CPU.ActiveCfg = Release|x86 {A37095E9-80BD-4A6B-AF8B-33D278CF92F3}.Release|Any CPU.Build.0 = Release|x86 + {A37095E9-80BD-4A6B-AF8B-33D278CF92F3}.Release|ORBIS.ActiveCfg = Release|x86 {A37095E9-80BD-4A6B-AF8B-33D278CF92F3}.Release|Win32.ActiveCfg = Release|x86 {A37095E9-80BD-4A6B-AF8B-33D278CF92F3}.Release|Win32.Build.0 = Release|x86 {A37095E9-80BD-4A6B-AF8B-33D278CF92F3}.Release|x64.ActiveCfg = Release|x86 @@ -161,6 +185,8 @@ Global {A37095E9-80BD-4A6B-AF8B-33D278CF92F3}.Release|x86.Build.0 = Release|x86 {33C378F9-36C5-4C2C-8350-FD1C8DD5AB66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {33C378F9-36C5-4C2C-8350-FD1C8DD5AB66}.Debug|Any CPU.Build.0 = Debug|Any CPU + {33C378F9-36C5-4C2C-8350-FD1C8DD5AB66}.Debug|ORBIS.ActiveCfg = Debug|Any CPU + {33C378F9-36C5-4C2C-8350-FD1C8DD5AB66}.Debug|ORBIS.Build.0 = Debug|Any CPU {33C378F9-36C5-4C2C-8350-FD1C8DD5AB66}.Debug|Win32.ActiveCfg = Debug|Any CPU {33C378F9-36C5-4C2C-8350-FD1C8DD5AB66}.Debug|Win32.Build.0 = Debug|Any CPU {33C378F9-36C5-4C2C-8350-FD1C8DD5AB66}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -169,6 +195,8 @@ Global {33C378F9-36C5-4C2C-8350-FD1C8DD5AB66}.Debug|x86.Build.0 = Debug|Any CPU {33C378F9-36C5-4C2C-8350-FD1C8DD5AB66}.Release|Any CPU.ActiveCfg = Release|Any CPU {33C378F9-36C5-4C2C-8350-FD1C8DD5AB66}.Release|Any CPU.Build.0 = Release|Any CPU + {33C378F9-36C5-4C2C-8350-FD1C8DD5AB66}.Release|ORBIS.ActiveCfg = Release|Any CPU + {33C378F9-36C5-4C2C-8350-FD1C8DD5AB66}.Release|ORBIS.Build.0 = Release|Any CPU {33C378F9-36C5-4C2C-8350-FD1C8DD5AB66}.Release|Win32.ActiveCfg = Release|Any CPU {33C378F9-36C5-4C2C-8350-FD1C8DD5AB66}.Release|Win32.Build.0 = Release|Any CPU {33C378F9-36C5-4C2C-8350-FD1C8DD5AB66}.Release|x64.ActiveCfg = Release|Any CPU @@ -177,6 +205,8 @@ Global {33C378F9-36C5-4C2C-8350-FD1C8DD5AB66}.Release|x86.Build.0 = Release|Any CPU {53869FE9-BAFF-4FED-B8E3-20660865426C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {53869FE9-BAFF-4FED-B8E3-20660865426C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {53869FE9-BAFF-4FED-B8E3-20660865426C}.Debug|ORBIS.ActiveCfg = Debug|Any CPU + {53869FE9-BAFF-4FED-B8E3-20660865426C}.Debug|ORBIS.Build.0 = Debug|Any CPU {53869FE9-BAFF-4FED-B8E3-20660865426C}.Debug|Win32.ActiveCfg = Debug|Any CPU {53869FE9-BAFF-4FED-B8E3-20660865426C}.Debug|Win32.Build.0 = Debug|Any CPU {53869FE9-BAFF-4FED-B8E3-20660865426C}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -185,6 +215,8 @@ Global {53869FE9-BAFF-4FED-B8E3-20660865426C}.Debug|x86.Build.0 = Debug|Any CPU {53869FE9-BAFF-4FED-B8E3-20660865426C}.Release|Any CPU.ActiveCfg = Release|Any CPU {53869FE9-BAFF-4FED-B8E3-20660865426C}.Release|Any CPU.Build.0 = Release|Any CPU + {53869FE9-BAFF-4FED-B8E3-20660865426C}.Release|ORBIS.ActiveCfg = Release|Any CPU + {53869FE9-BAFF-4FED-B8E3-20660865426C}.Release|ORBIS.Build.0 = Release|Any CPU {53869FE9-BAFF-4FED-B8E3-20660865426C}.Release|Win32.ActiveCfg = Release|Any CPU {53869FE9-BAFF-4FED-B8E3-20660865426C}.Release|Win32.Build.0 = Release|Any CPU {53869FE9-BAFF-4FED-B8E3-20660865426C}.Release|x64.ActiveCfg = Release|Any CPU @@ -193,6 +225,7 @@ Global {53869FE9-BAFF-4FED-B8E3-20660865426C}.Release|x86.Build.0 = Release|Any CPU {22E600CA-B7A4-4FA1-A1DB-6BA4736E6121}.Debug|Any CPU.ActiveCfg = Debug|x64 {22E600CA-B7A4-4FA1-A1DB-6BA4736E6121}.Debug|Any CPU.Build.0 = Debug|x64 + {22E600CA-B7A4-4FA1-A1DB-6BA4736E6121}.Debug|ORBIS.ActiveCfg = Debug|x64 {22E600CA-B7A4-4FA1-A1DB-6BA4736E6121}.Debug|Win32.ActiveCfg = Debug|x64 {22E600CA-B7A4-4FA1-A1DB-6BA4736E6121}.Debug|Win32.Build.0 = Debug|x64 {22E600CA-B7A4-4FA1-A1DB-6BA4736E6121}.Debug|x64.ActiveCfg = Debug|x64 @@ -201,6 +234,7 @@ Global {22E600CA-B7A4-4FA1-A1DB-6BA4736E6121}.Debug|x86.Build.0 = Debug|x64 {22E600CA-B7A4-4FA1-A1DB-6BA4736E6121}.Release|Any CPU.ActiveCfg = Release|x64 {22E600CA-B7A4-4FA1-A1DB-6BA4736E6121}.Release|Any CPU.Build.0 = Release|x64 + {22E600CA-B7A4-4FA1-A1DB-6BA4736E6121}.Release|ORBIS.ActiveCfg = Release|x64 {22E600CA-B7A4-4FA1-A1DB-6BA4736E6121}.Release|Win32.ActiveCfg = Release|x64 {22E600CA-B7A4-4FA1-A1DB-6BA4736E6121}.Release|Win32.Build.0 = Release|x64 {22E600CA-B7A4-4FA1-A1DB-6BA4736E6121}.Release|x64.ActiveCfg = Release|x64 @@ -209,6 +243,7 @@ Global {22E600CA-B7A4-4FA1-A1DB-6BA4736E6121}.Release|x86.Build.0 = Release|x64 {F0E3446E-D9D7-4F44-AC98-797C5124BE91}.Debug|Any CPU.ActiveCfg = Debug|x64 {F0E3446E-D9D7-4F44-AC98-797C5124BE91}.Debug|Any CPU.Build.0 = Debug|x64 + {F0E3446E-D9D7-4F44-AC98-797C5124BE91}.Debug|ORBIS.ActiveCfg = Debug|x64 {F0E3446E-D9D7-4F44-AC98-797C5124BE91}.Debug|Win32.ActiveCfg = Debug|x64 {F0E3446E-D9D7-4F44-AC98-797C5124BE91}.Debug|Win32.Build.0 = Debug|x64 {F0E3446E-D9D7-4F44-AC98-797C5124BE91}.Debug|x64.ActiveCfg = Debug|x64 @@ -217,6 +252,7 @@ Global {F0E3446E-D9D7-4F44-AC98-797C5124BE91}.Debug|x86.Build.0 = Debug|x64 {F0E3446E-D9D7-4F44-AC98-797C5124BE91}.Release|Any CPU.ActiveCfg = Release|x64 {F0E3446E-D9D7-4F44-AC98-797C5124BE91}.Release|Any CPU.Build.0 = Release|x64 + {F0E3446E-D9D7-4F44-AC98-797C5124BE91}.Release|ORBIS.ActiveCfg = Release|x64 {F0E3446E-D9D7-4F44-AC98-797C5124BE91}.Release|Win32.ActiveCfg = Release|x64 {F0E3446E-D9D7-4F44-AC98-797C5124BE91}.Release|Win32.Build.0 = Release|x64 {F0E3446E-D9D7-4F44-AC98-797C5124BE91}.Release|x64.ActiveCfg = Release|x64 @@ -225,6 +261,8 @@ Global {F0E3446E-D9D7-4F44-AC98-797C5124BE91}.Release|x86.Build.0 = Release|x64 {75BA171D-708A-40AA-A27D-57150E5DFB7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {75BA171D-708A-40AA-A27D-57150E5DFB7B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {75BA171D-708A-40AA-A27D-57150E5DFB7B}.Debug|ORBIS.ActiveCfg = Debug|Any CPU + {75BA171D-708A-40AA-A27D-57150E5DFB7B}.Debug|ORBIS.Build.0 = Debug|Any CPU {75BA171D-708A-40AA-A27D-57150E5DFB7B}.Debug|Win32.ActiveCfg = Debug|Any CPU {75BA171D-708A-40AA-A27D-57150E5DFB7B}.Debug|Win32.Build.0 = Debug|Any CPU {75BA171D-708A-40AA-A27D-57150E5DFB7B}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -233,6 +271,8 @@ Global {75BA171D-708A-40AA-A27D-57150E5DFB7B}.Debug|x86.Build.0 = Debug|Any CPU {75BA171D-708A-40AA-A27D-57150E5DFB7B}.Release|Any CPU.ActiveCfg = Release|Any CPU {75BA171D-708A-40AA-A27D-57150E5DFB7B}.Release|Any CPU.Build.0 = Release|Any CPU + {75BA171D-708A-40AA-A27D-57150E5DFB7B}.Release|ORBIS.ActiveCfg = Release|Any CPU + {75BA171D-708A-40AA-A27D-57150E5DFB7B}.Release|ORBIS.Build.0 = Release|Any CPU {75BA171D-708A-40AA-A27D-57150E5DFB7B}.Release|Win32.ActiveCfg = Release|Any CPU {75BA171D-708A-40AA-A27D-57150E5DFB7B}.Release|Win32.Build.0 = Release|Any CPU {75BA171D-708A-40AA-A27D-57150E5DFB7B}.Release|x64.ActiveCfg = Release|Any CPU @@ -241,6 +281,8 @@ Global {75BA171D-708A-40AA-A27D-57150E5DFB7B}.Release|x86.Build.0 = Release|Any CPU {90180080-9585-499C-99A8-6F4D1725CAF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {90180080-9585-499C-99A8-6F4D1725CAF4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {90180080-9585-499C-99A8-6F4D1725CAF4}.Debug|ORBIS.ActiveCfg = Debug|Any CPU + {90180080-9585-499C-99A8-6F4D1725CAF4}.Debug|ORBIS.Build.0 = Debug|Any CPU {90180080-9585-499C-99A8-6F4D1725CAF4}.Debug|Win32.ActiveCfg = Debug|Any CPU {90180080-9585-499C-99A8-6F4D1725CAF4}.Debug|Win32.Build.0 = Debug|Any CPU {90180080-9585-499C-99A8-6F4D1725CAF4}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -249,12 +291,46 @@ Global {90180080-9585-499C-99A8-6F4D1725CAF4}.Debug|x86.Build.0 = Debug|Any CPU {90180080-9585-499C-99A8-6F4D1725CAF4}.Release|Any CPU.ActiveCfg = Release|Any CPU {90180080-9585-499C-99A8-6F4D1725CAF4}.Release|Any CPU.Build.0 = Release|Any CPU + {90180080-9585-499C-99A8-6F4D1725CAF4}.Release|ORBIS.ActiveCfg = Release|Any CPU + {90180080-9585-499C-99A8-6F4D1725CAF4}.Release|ORBIS.Build.0 = Release|Any CPU {90180080-9585-499C-99A8-6F4D1725CAF4}.Release|Win32.ActiveCfg = Release|Any CPU {90180080-9585-499C-99A8-6F4D1725CAF4}.Release|Win32.Build.0 = Release|Any CPU {90180080-9585-499C-99A8-6F4D1725CAF4}.Release|x64.ActiveCfg = Release|Any CPU {90180080-9585-499C-99A8-6F4D1725CAF4}.Release|x64.Build.0 = Release|Any CPU {90180080-9585-499C-99A8-6F4D1725CAF4}.Release|x86.ActiveCfg = Release|Any CPU {90180080-9585-499C-99A8-6F4D1725CAF4}.Release|x86.Build.0 = Release|Any CPU + {02162131-862F-4D65-A3FB-A670D4790F7E}.Debug|Any CPU.ActiveCfg = Debug|ORBIS + {02162131-862F-4D65-A3FB-A670D4790F7E}.Debug|ORBIS.ActiveCfg = Debug|ORBIS + {02162131-862F-4D65-A3FB-A670D4790F7E}.Debug|ORBIS.Build.0 = Debug|ORBIS + {02162131-862F-4D65-A3FB-A670D4790F7E}.Debug|Win32.ActiveCfg = Debug|ORBIS + {02162131-862F-4D65-A3FB-A670D4790F7E}.Debug|x64.ActiveCfg = Debug|ORBIS + {02162131-862F-4D65-A3FB-A670D4790F7E}.Debug|x86.ActiveCfg = Debug|ORBIS + {02162131-862F-4D65-A3FB-A670D4790F7E}.Release|Any CPU.ActiveCfg = Release|ORBIS + {02162131-862F-4D65-A3FB-A670D4790F7E}.Release|ORBIS.ActiveCfg = Release|ORBIS + {02162131-862F-4D65-A3FB-A670D4790F7E}.Release|ORBIS.Build.0 = Release|ORBIS + {02162131-862F-4D65-A3FB-A670D4790F7E}.Release|Win32.ActiveCfg = Release|ORBIS + {02162131-862F-4D65-A3FB-A670D4790F7E}.Release|x64.ActiveCfg = Release|ORBIS + {02162131-862F-4D65-A3FB-A670D4790F7E}.Release|x86.ActiveCfg = Release|ORBIS + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Debug|Any CPU.ActiveCfg = Debug|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Debug|Any CPU.Build.0 = Debug|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Debug|ORBIS.ActiveCfg = Debug|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Debug|ORBIS.Build.0 = Debug|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Debug|Win32.ActiveCfg = Debug|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Debug|Win32.Build.0 = Debug|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Debug|x64.ActiveCfg = Debug|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Debug|x64.Build.0 = Debug|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Debug|x86.ActiveCfg = Debug|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Debug|x86.Build.0 = Debug|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Release|Any CPU.ActiveCfg = Release|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Release|Any CPU.Build.0 = Release|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Release|ORBIS.ActiveCfg = Release|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Release|ORBIS.Build.0 = Release|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Release|Win32.ActiveCfg = Release|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Release|Win32.Build.0 = Release|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Release|x64.ActiveCfg = Release|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Release|x64.Build.0 = Release|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Release|x86.ActiveCfg = Release|x64 + {6616120A-EACC-4A05-8F48-6B9B32DEEE75}.Release|x86.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -274,6 +350,9 @@ Global {F0E3446E-D9D7-4F44-AC98-797C5124BE91} = {8E8E4C8D-E3E1-4CB9-BD78-7ADAB2F2CF45} {75BA171D-708A-40AA-A27D-57150E5DFB7B} = {72E29C1E-8723-4885-A5ED-BD3A929D81B6} {90180080-9585-499C-99A8-6F4D1725CAF4} = {8F0E1457-FB1E-47A4-9DA8-74A6B757CAA4} + {02162131-862F-4D65-A3FB-A670D4790F7E} = {F9EC9EAD-0B38-467B-BF57-2E6A4DA29756} + {6616120A-EACC-4A05-8F48-6B9B32DEEE75} = {F9EC9EAD-0B38-467B-BF57-2E6A4DA29756} + {F9EC9EAD-0B38-467B-BF57-2E6A4DA29756} = {8E8E4C8D-E3E1-4CB9-BD78-7ADAB2F2CF45} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4B6EE1D0-5ADF-44A2-B6EE-E5C8E110EE47} diff --git a/Playstation/OrbisLibAPI-2.0/API.cpp b/Playstation/OrbisLibAPI-2.0/API.cpp new file mode 100644 index 0000000..4adda61 --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/API.cpp @@ -0,0 +1,2 @@ +#include "stdafx.h" +#include "API.h" \ No newline at end of file diff --git a/Playstation/OrbisLibAPI-2.0/API.h b/Playstation/OrbisLibAPI-2.0/API.h new file mode 100644 index 0000000..6f70f09 --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/API.h @@ -0,0 +1 @@ +#pragma once diff --git a/Playstation/OrbisLibAPI-2.0/Config.h b/Playstation/OrbisLibAPI-2.0/Config.h new file mode 100644 index 0000000..ce8104a --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/Config.h @@ -0,0 +1,4 @@ +#pragma once + +#define API_PORT 6900 +#define EVENT_PORT 6901 diff --git a/Playstation/OrbisLibAPI-2.0/Events.cpp b/Playstation/OrbisLibAPI-2.0/Events.cpp new file mode 100644 index 0000000..70db167 --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/Events.cpp @@ -0,0 +1,69 @@ +#include "stdafx.h" +#include "Events.h" + +std::vector Events::HostList; +std::mutex Events::HostListMtx; + +void Events::AddHost(SceNetInAddr_t HostAddress) +{ + // Aquire a lock for the list. + std::unique_lock lock(HostListMtx); + + // Add the host to the list if it does not exist already. + if (std::find(HostList.begin(), HostList.end(), HostAddress) == HostList.end()) + { + klog("New host (%i.%i.%i.%i)\n", HostAddress & 0xFF, (HostAddress >> 8) & 0xFF, (HostAddress >> 16) & 0xFF, (HostAddress >> 24) & 0xFF); + HostList.push_back(HostAddress); + } +} + +void Events::RemoveHost(SceNetInAddr_t HostAddress) +{ + // Aquire a lock for the list. + std::unique_lock lock(HostListMtx); + + // Remove this host if it exists in the list. + if (std::find(HostList.begin(), HostList.end(), HostAddress) != HostList.end()) + { + klog("Lost host (%i.%i.%i.%i)\n", HostAddress & 0xFF, (HostAddress >> 8) & 0xFF, (HostAddress >> 16) & 0xFF, (HostAddress >> 24) & 0xFF); + std::remove(HostList.begin(), HostList.end(), HostAddress); + } +} + +void Events::SendEvent(int EventId, int pid) +{ + if (HostList.empty()) + { + klog("SendEvent(): Host List Empty :(\n"); + return; + } + + for (const auto& host : HostList) + { + // Aquire a lock for the list. + std::unique_lock lock(HostListMtx); + + klog("SendEvent(%d): Sending for host %i.%i.%i.%i\n", EventId, host & 0xFF, (host >> 8) & 0xFF, (host >> 16) & 0xFF, (host >> 24) & 0xFF); + + auto sock = Sockets::Connect(host, EVENT_PORT, 4); + if (sock) + { + // Send EventId + Sockets::SendInt(sock, EventId); + + if (EventId == EVENT_ATTACH && pid != -1) + { + Sockets::SendInt(sock, pid); + } + + // Close the socket. + sceNetSocketClose(sock); + } + else + { + klog("SendEvent(): Failed to connect to host %i.%i.%i.%i\n", host & 0xFF, (host >> 8) & 0xFF, (host >> 16) & 0xFF, (host >> 24) & 0xFF); + + RemoveHost(host); + } + } +} \ No newline at end of file diff --git a/Playstation/OrbisLibAPI-2.0/Events.h b/Playstation/OrbisLibAPI-2.0/Events.h new file mode 100644 index 0000000..dfe3587 --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/Events.h @@ -0,0 +1,31 @@ +#pragma once + +class Events +{ +public: + enum EventId + { + EVENT_EXCEPTION, + EVENT_CONTINUE, + EVENT_DIE, + EVENT_ATTACH, + EVENT_DETACH, + EVENT_SUSPEND, + EVENT_RESUME, + EVENT_SHUTDOWN, + }; + + static bool Init(); + static void Term(); + + static void AddHost(SceNetInAddr_t HostAddress); + static void RemoveHost(SceNetInAddr_t HostAddress); + static void SendEvent(int EventId, int pid = -1); + +private: + static std::vector HostList; + static std::mutex HostListMtx; + + static SceNetId Connect(SceNetInAddr_t HostAddress); +}; + diff --git a/Playstation/OrbisLibAPI-2.0/Main.cpp b/Playstation/OrbisLibAPI-2.0/Main.cpp new file mode 100644 index 0000000..b01d180 --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/Main.cpp @@ -0,0 +1,58 @@ +#include "stdafx.h" + + +void exit() +{ + + // Terminate Thread Pool + ThreadPool::Term(); +} + +int main(int argc, char** arg) +{ + // Jailbreak our current process. + //if (!Jailbreak()) + //{ + // Notify("Failed to jailbreak Process..."); + // sceSystemServiceLoadExec("exit", 0); + // return 0; + //} + + // Load internal system modules. + if (!LoadModules()) + { + Notify("Failed to Load Modules..."); + sceSystemServiceLoadExec("exit", 0); + return 0; + } + + // Copy back up of sflash so we can read it and not break things :) + CopySflash(); + + // Set the Name of this process so it shows up as something other than eboot.bin. + //sceKernelSetProcessName("OrbisLibAPI"); + + // Log the loaded version string. + klog("\n%s\n\n", ORBISLIB_BUILDSTRING); + + // Start up the thread pool. + ThreadPool::Init(10); + + // Init a thread to monitor the system usage stats. + // SystemMonitor::Init(); + + // Start up the API. + //if (!API::Init()) + //{ + // Notify("Failed to init API..."); + // sceSystemServiceLoadExec("exit", 0); + // return 0; + //} + + // Blocking run monitor. + // Monitor::Run(); + + atexit(exit); + + return 0; +} \ No newline at end of file diff --git a/Playstation/OrbisLibAPI-2.0/OrbisLibAPI-2.0.vcxproj b/Playstation/OrbisLibAPI-2.0/OrbisLibAPI-2.0.vcxproj new file mode 100644 index 0000000..42ffb03 --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/OrbisLibAPI-2.0.vcxproj @@ -0,0 +1,110 @@ + + + + + Debug + ORBIS + + + Release + ORBIS + + + + {02162131-862F-4D65-A3FB-A670D4790F7E} + + + + Application + Clang + + + Application + + + v142 + + + v142 + + + + + + + + + + + + + + + + + + + + + + $(SolutionDir)Playstation\OrbisLibAPI-2.0\build\$(Configuration)\ + $(SolutionDir)Playstation\OrbisUtils;$(IncludePath) + + + + _DEBUG;DEBUG;%(PreprocessorDefinitions) + true + Use + true + 32 + Cpp17 + true + + + NonAslr + $(SolutionDir)Playstation\OrbisUtils\build;%(AdditionalLibraryDirectories) + -lc_stub_weak;-lkernel_stub_weak;-lScePad_stub_weak;-lSceRtc_stub_weak;-lSceUserService_stub_weak;-lSceSystemService_stub_weak;-lSceNet_stub_weak;%(AdditionalDependencies) + + + "C:\Python27\python.exe" $(SolutionDir)Playstation\OrbisLibAPI-2.0\build\make_fself.py $(OutputPath)$(ProjectName).elf $(OutputPath)eboot.bin + + + call "$(SolutionDir)\Misc\Increment.bat" "Version.h" "ORBISLIB_BUILDVERSION" + + + + + NDEBUG;%(PreprocessorDefinitions); + Level2 + Use + + + + + + + + + + + + + + + + + + + Create + Create + + + + + + + + + + + \ No newline at end of file diff --git a/Playstation/OrbisLibAPI-2.0/OrbisLibAPI-2.0.vcxproj.filters b/Playstation/OrbisLibAPI-2.0/OrbisLibAPI-2.0.vcxproj.filters new file mode 100644 index 0000000..911ad6c --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/OrbisLibAPI-2.0.vcxproj.filters @@ -0,0 +1,74 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cxx;cc;s;asm + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp + + + {bdc2fb30-c2db-4ce1-8266-2f6f93dc9e67} + + + {d1452c2c-c0db-4cfe-86a4-77f1079bbb07} + + + {a253b4b7-0c90-4f79-a868-9dfb32c9d3e4} + + + {3ccc78e7-0ce7-46af-ba6e-aa85e0ff0b2c} + + + + + Source Files + + + Source Files\Utilities + + + Source Files\Utilities + + + Source Files\Utilities + + + Source Files\API + + + Source Files\API + + + Source Files\Utilities + + + + + Header Files\Utilities + + + Header Files\Utilities + + + Header Files\Utilities + + + Header Files\Utilities + + + Header Files\API + + + Header Files\API + + + Header Files\Utilities + + + Header Files\API + + + \ No newline at end of file diff --git a/Playstation/OrbisLibAPI-2.0/Sockets.cpp b/Playstation/OrbisLibAPI-2.0/Sockets.cpp new file mode 100644 index 0000000..ba22e3d --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/Sockets.cpp @@ -0,0 +1,110 @@ +#include "stdafx.h" +#include "Sockets.h" + +SceNetId Sockets::Connect(SceNetInAddr_t address, uint16_t port, int timeOutSeconds) +{ + // Set up socket params. + SceNetSockaddrIn addr = { 0 }; + addr.sin_family = SCE_NET_AF_INET; + addr.sin_addr.s_addr = address; + addr.sin_port = sceNetHtons(port); + + // Create socket. + auto sock = sceNetSocket("SendEventSock", SCE_NET_AF_INET, SCE_NET_SOCK_STREAM, SCE_NET_IPPROTO_TCP); + if (sock < 0) + { + klog("Sockets::Connect() Failed to allocate sock: %llX %llX\n", sock, *sceNetErrnoLoc()); + return -1; + } + + // Set connection/transmission time out. + int sock_timeout = timeOutSeconds * 1000000; + sceNetSetsockopt(sock, SCE_NET_SOL_SOCKET, SCE_NET_SO_CONNECTTIMEO, &sock_timeout, sizeof(sock_timeout)); + sceNetSetsockopt(sock, SCE_NET_SOL_SOCKET, SCE_NET_SO_SNDTIMEO, &sock_timeout, sizeof(sock_timeout)); + sceNetSetsockopt(sock, SCE_NET_SOL_SOCKET, SCE_NET_SO_RCVTIMEO, &sock_timeout, sizeof(sock_timeout)); + + // Connect to the socket. + auto res = sceNetConnect(sock, (SceNetSockaddr*)&addr, sizeof(addr)); + if (!res) + return sock; + else + { + klog("Sockets::Connect() sceNetConnect(): %llX %llX\n", res, *sceNetErrnoLoc()); + return -1; + } +} + +bool Sockets::SendInt(SceNetId Sock, int val) +{ + auto res = sceNetSend(Sock, &val, sizeof(int), 0); + if (res <= 0) + { + klog("SendInt(): Failed to send %llX\n", res); + + return false; + } + + return true; +} + +bool Sockets::RecvInt(SceNetId Sock, int* val) +{ + auto res = sceNetRecv(Sock, val, sizeof(int), 0); + if (res <= 0) + { + klog("RecvInt(): Failed to recv %llX\n", res); + + return false; + } + + return true; +} + +bool Sockets::SendLargeData(SceNetId Sock, unsigned char* data, size_t dataLen) +{ + unsigned char* CurrentPosition = data; + size_t DataLeft = dataLen; + int res = 0; + + while (DataLeft > 0) + { + size_t DataChunkSize = std::min((size_t)8192, DataLeft); + + res = sceNetSend(Sock, CurrentPosition, DataChunkSize, 0); + + if (res < 0) + { + klog("SendLargeData() Error: %llX(%llX)\n", res, *sceNetErrnoLoc()); + return false; + } + + DataLeft -= res; + CurrentPosition += res; + } + + return true; +} + +bool Sockets::RecvLargeData(SceNetId Sock, unsigned char* data, size_t dataLen) +{ + size_t DataLeft = dataLen; + int Received = 0; + int res = 0; + + while (DataLeft > 0) + { + size_t DataChunkSize = std::min((size_t)8192, DataLeft); + res = sceNetRecv(Sock, data + Received, DataChunkSize, 0); + + if (res < 0) + { + klog("RecvLargeData() Error: %llX(%llX)\n", res, *sceNetErrnoLoc()); + return false; + } + + Received += res; + DataLeft -= res; + } + + return true; +} \ No newline at end of file diff --git a/Playstation/OrbisLibAPI-2.0/Sockets.h b/Playstation/OrbisLibAPI-2.0/Sockets.h new file mode 100644 index 0000000..48c70cc --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/Sockets.h @@ -0,0 +1,13 @@ +#pragma once + +class Sockets +{ +public: + static SceNetId Connect(SceNetInAddr_t address, uint16_t port, int timeOutSeconds); + static bool SendInt(SceNetId Sock, int val); + static bool RecvInt(SceNetId Sock, int* val); + static bool SendLargeData(SceNetId Sock, unsigned char* data, size_t dataLen); + static bool RecvLargeData(SceNetId Sock, unsigned char* data, size_t dataLen); +private: + +}; \ No newline at end of file diff --git a/Playstation/OrbisLibAPI-2.0/ThreadPool.cpp b/Playstation/OrbisLibAPI-2.0/ThreadPool.cpp new file mode 100644 index 0000000..3b68c34 --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/ThreadPool.cpp @@ -0,0 +1,90 @@ +#include "stdafx.h" +#include "ThreadPool.h" + +bool ThreadPool::ShouldRun; +std::mutex ThreadPool::JobQueueMtx; +std::condition_variable ThreadPool::MtxCondition; +std::vector ThreadPool::ThreadsPool; +std::queue> ThreadPool::JobQueue; + +void ThreadPool::WorkingLoop() +{ + while (true) + { + try + { + std::function job; + { + std::unique_lock lock(JobQueueMtx); + MtxCondition.wait(lock, + [] + { + return !JobQueue.empty() || !ShouldRun; + }); + + if (!ShouldRun) + return; + + job = JobQueue.front(); + JobQueue.pop(); + } + + job(); + } + catch (const std::exception& ex) + { + klog("Std Error: %s\n", ex.what()); + } + catch (...) + { + klog("Other Uknown Error Occured in Worker Thread.\n"); + } + } +} + +void ThreadPool::Init(int poolSize) +{ + ShouldRun = true; + ThreadsPool.resize(poolSize); + for (int i = 0; i < poolSize; i++) + { + char threadName[0x200]; + snprintf(threadName, sizeof(threadName), "WorkerThread%i", i); + scePthreadCreate(&ThreadsPool.at(i), nullptr, [](void*) -> void* + { + ThreadPool::WorkingLoop(); + + // Clean up the thread. + scePthreadExit(nullptr); + return nullptr; + }, nullptr, threadName); + + scePthreadSetaffinity(ThreadsPool.at(i), SCE_KERNEL_CPUMASK_7CPU_ALL); + } +} + +void ThreadPool::Term() +{ + { + std::unique_lock lock(JobQueueMtx); + ShouldRun = false; + } + + MtxCondition.notify_all(); + + for (auto& activeThread : ThreadsPool) + { + scePthreadJoin(activeThread, nullptr); + } + + ThreadsPool.clear(); +} + +void ThreadPool::QueueJob(const std::function& job) +{ + { + std::unique_lock lock(JobQueueMtx); + JobQueue.push(job); + } + MtxCondition.notify_one(); +} \ No newline at end of file diff --git a/Playstation/OrbisLibAPI-2.0/ThreadPool.h b/Playstation/OrbisLibAPI-2.0/ThreadPool.h new file mode 100644 index 0000000..4130e5d --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/ThreadPool.h @@ -0,0 +1,18 @@ +#pragma once + +class ThreadPool +{ +public: + static void Init(int poolSize); + static void Term(); + static void QueueJob(const std::function& job); + +private: + static void WorkingLoop(); + + static bool ShouldRun; + static std::mutex JobQueueMtx; + static std::condition_variable MtxCondition; + static std::vector ThreadsPool; + static std::queue> JobQueue; +}; diff --git a/Playstation/OrbisLibAPI-2.0/Utilities.cpp b/Playstation/OrbisLibAPI-2.0/Utilities.cpp new file mode 100644 index 0000000..5029509 --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/Utilities.cpp @@ -0,0 +1,193 @@ +#include "stdafx.h" +#include "Utilities.h" +#include + +int(*sceKernelDebugOutText)(int dbg_channel, const char* text, ...); +int(*sceKernelSendNotificationRequest)(int device, SceNotificationRequest* req, size_t size, int blocking); +int(*sceKernelGetModuleInfo)(SceKernelModule handle, SceDbgModuleInfo* info); + +bool LoadModules() +{ + int res = 0; + //auto res = sceSysmoduleLoadModule(SCE_SYSMODULE_INTERNAL_SYSTEM_SERVICE); + //if (res != 0) + //{ + // klog("LoadModules(): Failed to load SCE_SYSMODULE_INTERNAL_SYSTEM_SERVICE (%llX)\n", res); + // return false; + //} + // + //res = sceSysmoduleLoadModule(SCE_SYSMODULE_INTERNAL_APPINSTUTIL); + //if (res != 0) + //{ + // klog("LoadModules(): Failed to load SCE_SYSMODULE_INTERNAL_APPINSTUTIL (%llX)\n", res); + // return false; + //} + // + //res = sceSysmoduleLoadModuleInternal(SCE_SYSMODULE_INTERNAL_USER_SERVICE); + //if (res != 0) + //{ + // klog("LoadModules(): Failed to load SCE_SYSMODULE_INTERNAL_USER_SERVICE (%llX)\n", res); + // return false; + //} + // + //res = sceSysmoduleLoadModuleInternal(SCE_SYSMODULE_INTERNAL_SYS_CORE); + //if (res != 0) + //{ + // klog("LoadModules(): Failed to load SCE_SYSMODULE_INTERNAL_SYS_CORE (%llX)\n", res); + // return false; + //} + // + //res = sceSysmoduleLoadModuleInternal(SCE_SYSMODULE_INTERNAL_NETCTL); + //if (res != 0) + //{ + // klog("LoadModules(): Failed to load SCE_SYSMODULE_INTERNAL_NETCTL (%llX)\n", res); + // return false; + //} + // + //res = sceSysmoduleLoadModuleInternal(SCE_SYSMODULE_INTERNAL_NET); + //if (res != 0) + //{ + // klog("LoadModules(): Failed to load SCE_SYSMODULE_INTERNAL_NET (%llX)\n", res); + // return false; + //} + // + //res = sceSysmoduleLoadModuleInternal(SCE_SYSMODULE_INTERNAL_HTTP); + //if (res != 0) + //{ + // klog("LoadModules(): Failed to load SCE_SYSMODULE_INTERNAL_HTTP (%llX)\n", res); + // return false; + //} + // + //res = sceSysmoduleLoadModuleInternal(SCE_SYSMODULE_INTERNAL_BGFT); + //if (res != 0) + //{ + // klog("LoadModules(): Failed to load SCE_SYSMODULE_INTERNAL_BGFT (%llX)\n", res); + // return false; + //} + // + //sceSysmoduleLoadModuleInternal(0x8000000D); + + // Start up networking interface + res = sceNetInit(); + if (res != 0) + { + klog("LoadModules(): sceNetInit failed\n"); + return false; + } + + // Start up user service. + res = sceUserServiceInitialize(nullptr); + if (res != 0) + { + klog("LoadModules(): sceUserServiceInitialize failed (%llX)\n", res); + return false; + } + + int libKernelHandle = sceKernelLoadStartModule("libkernel.sprx", 0, nullptr, 0, nullptr, nullptr); + if (libKernelHandle > 0) + { + if (sceKernelDlsym(libKernelHandle, "sceKernelDebugOutText", (void**)&sceKernelDebugOutText) != 0) + { + klog("Failed to resolve: sceKernelDebugOutText\n"); + return false; + } + + if (sceKernelDlsym(libKernelHandle, "sceKernelSendNotificationRequest", (void**)&sceKernelSendNotificationRequest) != 0) + { + klog("Failed to resolve: sceKernelSendNotificationRequest\n"); + return false; + } + + if (sceKernelDlsym(libKernelHandle, "sceKernelGetModuleInfo", (void**)&sceKernelGetModuleInfo) != 0) + { + klog("Failed to resolve: sceKernelGetModuleInfo\n"); + return false; + } + } + + klog("LoadModules(): Success!\n"); + return true; +} + +void klog(const char* fmt, ...) +{ + char Buffer[0x200]; + + //Create full string from va list. + va_list args; + va_start(args, fmt); + vsprintf(Buffer, fmt, args); + va_end(args); + + sceKernelDebugOutText(0, Buffer); +} + +void Notify(const char* MessageFMT, ...) +{ + SceNotificationRequest Buffer; + + //Create full string from va list. + va_list args; + va_start(args, MessageFMT); + vsprintf(Buffer.message, MessageFMT, args); + va_end(args); + + //Populate the notify buffer. + Buffer.type = SceNotificationRequestType::NotificationRequest; //this one is just a standard one and will print what ever is stored at the buffer.Message. + Buffer.unk3 = 0; + Buffer.useIconImageUri = 1; //Bool to use a custom uri. + Buffer.targetId = -1; //Not sure if name is correct but is always set to -1. + strcpy(Buffer.iconUri, "https://i.imgur.com/SJPIBGG.png"); //Copy the uri to the buffer. + + //From user land we can call int64_t sceKernelSendNotificationRequest(int64_t unk1, char* Buffer, size_t size, int64_t unk2) which is a libkernel import. + sceKernelSendNotificationRequest(0, &Buffer, 3120, 0); +} + +void NotifyCustom(const char* IconURI, const char* MessageFMT, ...) +{ + SceNotificationRequest Buffer; + + //Create full string from va list. + va_list args; + va_start(args, MessageFMT); + vsprintf(Buffer.message, MessageFMT, args); + va_end(args); + + //Populate the notify buffer. + Buffer.type = SceNotificationRequestType::NotificationRequest; //this one is just a standard one and will print what ever is stored at the buffer.Message. + Buffer.unk3 = 0; + Buffer.useIconImageUri = 1; //Bool to use a custom uri. + Buffer.targetId = -1; //Not sure if name is correct but is always set to -1. + strcpy(Buffer.iconUri, IconURI); //Copy the uri to the buffer. + + //From user land we can call int64_t sceKernelSendNotificationRequest(int64_t unk1, char* Buffer, size_t size, int64_t unk2) which is a libkernel import. + sceKernelSendNotificationRequest(0, &Buffer, 3120, 0); +} + +bool CopySflash() +{ + int sflashFd = sceKernelOpen("/dev/sflash0", SCE_KERNEL_O_RDONLY, 0); + int backupFd = sceKernelOpen("/data/Orbis Suite/sflash0", SCE_KERNEL_O_CREAT | SCE_KERNEL_O_WRONLY | SCE_KERNEL_O_APPEND, 0777); + if (sflashFd && backupFd) + { + auto buffer = (unsigned char*)malloc(4 * 1024 * 1024); + if (buffer == nullptr) + { + klog("failled to allocate memory for sflash read.\n"); + return false; + } + + size_t bytesRead = 0; + while ((bytesRead = sceKernelRead(sflashFd, buffer, 4 * 1024 * 1024)) > 0) + { + sceKernelWrite(backupFd, buffer, bytesRead); + } + + free(buffer); + sceKernelClose(sflashFd); + sceKernelClose(backupFd); + return true; + } + + return false; +} diff --git a/Playstation/OrbisLibAPI-2.0/Utilities.h b/Playstation/OrbisLibAPI-2.0/Utilities.h new file mode 100644 index 0000000..80ab16b --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/Utilities.h @@ -0,0 +1,58 @@ +#pragma once + +enum SceNotificationRequestType +{ + NotificationRequest = 0, + SystemNotification = 1, + SystemNotificationWithUserId = 2, + SystemNotificationWithDeviceId = 3, + SystemNotificationWithDeviceIdRelatedToUser = 4, + SystemNotificationWithText = 5, + SystemNotificationWithTextRelatedToUser = 6, + SystemNotificationWithErrorCode = 7, + SystemNotificationWithAppId = 8, + SystemNotificationWithAppName = 9, + SystemNotificationWithAppInfo = 9, + SystemNotificationWithAppNameRelatedToUser = 10, + SystemNotificationWithParams = 11, + SendSystemNotificationWithUserName = 12, + SystemNotificationWithUserNameInfo = 13, + SendAddressingSystemNotification = 14, + AddressingSystemNotificationWithDeviceId = 15, + AddressingSystemNotificationWithUserName = 16, + AddressingSystemNotificationWithUserId = 17, + + UNK_1 = 100, + TrcCheckNotificationRequest = 101, + NpDebugNotificationRequest = 102, + UNK_2 = 102, +}; + +typedef struct +{ + enum SceNotificationRequestType type; + int reqId; + int priority; + int msgId; + int targetId; + int userId; + int unk1; + int unk2; + int appId; + int errorNum; + int unk3; + unsigned char useIconImageUri; + char message[1024]; + char iconUri[1024]; + char unk[1024]; +} SceNotificationRequest; + +extern int(*sceKernelDebugOutText)(int dbg_channel, const char* text, ...); +extern int(*sceKernelSendNotificationRequest)(int device, SceNotificationRequest* req, size_t size, int blocking); +extern int(*sceKernelGetModuleInfo)(SceKernelModule handle, SceDbgModuleInfo* info); + +bool LoadModules(); +void klog(const char* fmt, ...); +void Notify(const char* MessageFMT, ...); +void NotifyCustom(const char* IconURI, const char* MessageFMT, ...); +bool CopySflash(); \ No newline at end of file diff --git a/Playstation/OrbisLibAPI-2.0/Version.h b/Playstation/OrbisLibAPI-2.0/Version.h new file mode 100644 index 0000000..8d5214b --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/Version.h @@ -0,0 +1,11 @@ +#pragma once +#define ORBISLIB_MAJOR 2 +#define ORBISLIB_MINOR 0 +#define ORBISLIB_BUILDVERSION 1194 +#define stringify(a) stringify_(a) +#define stringify_(a) #a +#if defined(_DEBUG) +#define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Dev Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__) +#else +#define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__) +#endif diff --git a/Playstation/OrbisLibAPI-2.0/build/make_fself.py b/Playstation/OrbisLibAPI-2.0/build/make_fself.py new file mode 100644 index 0000000..40fb5b7 --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/build/make_fself.py @@ -0,0 +1,816 @@ +#!/usr/bin/env python + +import sys, os, struct, traceback +import hashlib, hmac +import argparse, re, string + +def int_with_base_type(val): + return int(val, 0) + +def try_parse_int(x, base=0): + try: + return int(x, base) if isinstance(x, str) else int(x) + except: + return None + +def align_up(x, alignment): + return (x + (alignment - 1)) & ~(alignment - 1) + +def align_down(x, alignment): + return x & ~(alignment - 1) + +def ilog2(x): + if x <= 0: + raise ValueError('math domain error') + return len(bin(x)) - 3 + +def is_intervals_overlap(p1, p2): + return p1[0] <= p2[1] and p1[1] <= p2[0] + +def check_file_magic(f, expected_magic): + old_offset = f.tell() + try: + magic = f.read(len(expected_magic)) + except: + return False + finally: + f.seek(old_offset) + return magic == expected_magic + +def parse_version(version): + major, minor, patch = (version >> 8) & 0xFF, version & 0xFF, 0 # FIXME + major = 10 * (major >> 4) + (major & 0xF) + minor = 10 * (minor >> 4) + (minor & 0xF) + return '{0:d}.{1:02d}.{2:03d}'.format(major, minor, patch) + +def sha256(data): + return hashlib.sha256(data).digest() + +def hmac_sha256(key, data): + return hmac.new(key=key, msg=data, digestmod=hashlib.sha256).digest() + +class ElfError(Exception): + def __init__(self, msg): + self.msg = msg + + def __str__(self): + return repr(self.msg) + +class ElfEHdr(object): + FMT = '<4s5B6xB' + EX_FMT = '<2HI3QI6H' + + MAGIC = '\x7FELF' + CLASS64 = 0x2 + DATA2LSB = 0x1 + EM_X86_64 = 0x3E + EV_CURRENT = 0x1 + + ET_EXEC = 0x2 + ET_SCE_EXEC = 0xFE00 + ET_SCE_EXEC_ASLR = 0xFE10 + ET_SCE_DYNAMIC = 0xFE18 + + def __init__(self): + self.magic = None + self.machine_class = None + self.data_encoding = None + self.version = None + self.os_abi = None + self.abi_version = None + self.nident_size = None + self.type = None + self.machine = None + self.version = None + self.entry = None + self.phoff = None + self.shoff = None + self.flags = None + self.ehsize = None + self.phentsize = None + self.phnum = None + self.shentsize = None + self.shnum = None + self.shstridx = None + + def load(self, f): + #if not check_file_magic(f, ElfEHdr.MAGIC): + # raise ElfError('Invalid magic.') + + self.magic, self.machine_class, self.data_encoding, self.version, self.os_abi, self.abi_version, self.nident_size = struct.unpack(ElfEHdr.FMT, f.read(struct.calcsize(ElfEHdr.FMT))) + if self.machine_class != ElfEHdr.CLASS64 or self.data_encoding != ElfEHdr.DATA2LSB: + raise ElfError('Unsupported class or data encoding.') + self.type, self.machine, self.version, self.entry, self.phoff, self.shoff, self.flags, self.ehsize, self.phentsize, self.phnum, self.shentsize, self.shnum, self.shstridx = struct.unpack(ElfEHdr.EX_FMT, f.read(struct.calcsize(ElfEHdr.EX_FMT))) + if self.machine != ElfEHdr.EM_X86_64 or self.version != ElfEHdr.EV_CURRENT: + raise ElfError('Unsupported machine type or version.') + if self.phentsize != struct.calcsize(ElfPHdr.FMT) or (self.shentsize > 0 and self.shentsize != struct.calcsize(ElfSHdr.FMT)): + raise ElfError('Unsupported header entry size.') + if self.type not in [ElfEHdr.ET_EXEC, ElfEHdr.ET_SCE_EXEC, ElfEHdr.ET_SCE_EXEC_ASLR, ElfEHdr.ET_SCE_DYNAMIC]: + raise ElfError('Unsupported type.') + + def save(self, f): + f.write(struct.pack(ElfEHdr.FMT, self.magic, self.machine_class, self.data_encoding, self.version, self.os_abi, self.abi_version, self.nident_size)) + f.write(struct.pack(ElfEHdr.EX_FMT, self.type, self.machine, self.version, self.entry, self.phoff, self.shoff, self.flags, self.ehsize, self.phentsize, self.phnum, self.shentsize, self.shnum, self.shstridx)) + + def has_segments(self): + return self.phentsize > 0 and self.phnum > 0 + + def has_sections(self): + return self.shentsize > 0 and self.shnum > 0 + +class ElfPHdr(object): + FMT = '<2I6Q' + + PT_LOAD = 0x1 + PT_DYNAMIC = 0x2 + PT_INTERP = 0x3 + PT_TLS = 0x7 + PT_GNU_EH_FRAME = 0x6474E550 + PT_GNU_STACK = 0x6474E551 + PT_SCE_RELA = 0x60000000, + PT_SCE_DYNLIBDATA = 0x61000000 + PT_SCE_PROCPARAM = 0x61000001 + PT_SCE_MODULE_PARAM = 0x61000002 + PT_SCE_RELRO = 0x61000010 + PT_SCE_COMMENT = 0x6FFFFF00 + PT_SCE_VERSION = 0x6FFFFF01 + + PF_EXEC = 0x1 + PF_WRITE = 0x2 + PF_READ = 0x4 + PF_READ_EXEC = PF_READ | PF_EXEC + PF_READ_WRITE = PF_READ | PF_WRITE + + def __init__(self, idx): + self.idx = idx + self.type = None + self.flags = None + self.offset = None + self.vaddr = None + self.paddr = None + self.filesz = None + self.memsz = None + self.align = None + + def load(self, f): + self.type, self.flags, self.offset, self.vaddr, self.paddr, self.filesz, self.memsz, self.align = struct.unpack(ElfPHdr.FMT, f.read(struct.calcsize(ElfPHdr.FMT))) + + def save(self, f): + f.write(struct.pack(ElfPHdr.FMT, self.type, self.flags, self.offset, self.vaddr, self.paddr, self.filesz, self.memsz, self.align)) + + def name(self): + if self.type == ElfPHdr.PT_LOAD: + if (self.flags & ElfPHdr.PF_READ_EXEC) == ElfPHdr.PF_READ_EXEC: + return '.text' + elif (self.flags & ElfPHdr.PF_READ_WRITE) == ElfPHdr.PF_READ_WRITE: + return '.data' + else: + return '.load_{0:02}'.format(self.idx) + else: + return { + ElfPHdr.PT_DYNAMIC: '.dynamic', + ElfPHdr.PT_INTERP: '.interp', + ElfPHdr.PT_TLS: '.tls', + ElfPHdr.PT_GNU_EH_FRAME: '.eh_frame_hdr', + ElfPHdr.PT_SCE_DYNLIBDATA: '.sce_dynlib_data', + ElfPHdr.PT_SCE_PROCPARAM: '.sce_process_param', + ElfPHdr.PT_SCE_MODULE_PARAM: '.sce_module_param', + ElfPHdr.PT_SCE_COMMENT: '.sce_comment', + }.get(self.type, None) + + def class_name(self): + if (self.flags & ElfPHdr.PF_READ_EXEC) == ElfPHdr.PF_READ_EXEC: + return 'CODE' + else: + return 'DATA' + +class ElfSHdr(object): + FMT = '<2I4Q2I2Q' + + def __init__(self, idx): + self.idx = idx + self.name = None + self.type = None + self.flags = None + self.addr = None + self.offset = None + self.size = None + self.link = None + self.info = None + self.align = None + self.entsize = None + + def load(self, f): + self.name, self.type, self.flags, self.addr, self.offset, self.size, self.link, self.info, self.align, self.entsize = struct.unpack(ElfSHdr.FMT, f.read(struct.calcsize(ElfSHdr.FMT))) + + def save(self, f): + f.write(struct.pack(ElfSHdr.FMT, self.name, self.type, self.flags, self.addr, self.offset, self.size, self.link, self.info, self.align, self.entsize)) + +class ElfFile(object): + def __init__(self, **kwargs): + self.ehdr = None + self.phdrs = None + self.shdrs = None + self.file_size = None + self.digest = None + self.segments = None + self.sections = None + self.ignore_shdrs = 'ignore_shdrs' in kwargs and kwargs['ignore_shdrs'] + + def load(self, f): + start_offset = f.tell() + data = f.read() + self.file_size = len(data) + self.digest = sha256(data) + f.seek(start_offset) + + self.ehdr = ElfEHdr() + self.ehdr.load(f) + + if self.ignore_shdrs: + self.ehdr.shnum = 0 + + self.phdrs = [] + self.segments = [] + if self.ehdr.has_segments(): + for i in xrange(self.ehdr.phnum): + f.seek(start_offset + self.ehdr.phoff + i * self.ehdr.phentsize) + phdr = ElfPHdr(i) + phdr.load(f) + self.phdrs.append(phdr) + if phdr.filesz > 0: + f.seek(start_offset + phdr.offset) + data = f.read(phdr.filesz) + else: + data = '' + self.segments.append(data) + + self.shdrs = [] + self.sections = [] + if self.ehdr.has_sections(): + for i in xrange(self.ehdr.shnum): + f.seek(start_offset + self.ehdr.shoff + i * self.ehdr.shentsize) + shdr = ElfSHdr(i) + shdr.load(f) + self.shdrs.append(shdr) + if phdr.filesz > 0: + f.seek(start_offset + shdr.offset) + data = f.read(phdr.filesz) + else: + data = '' + self.sections.append(data) + + def save(self, f, no_sections=False): + start_offset = f.tell() + + self.ehdr.save(f) + + if not no_sections: + if self.ehdr.has_sections(): + for i in xrange(self.ehdr.shnum): + f.seek(start_offset + self.ehdr.shoff + i * self.ehdr.shentsize) + shdr = self.shdrs[i] + shdr.save(f) + + if self.ehdr.has_segments(): + for i in xrange(self.ehdr.phnum): + f.seek(start_offset + self.ehdr.phoff + i * self.ehdr.phentsize) + phdr = self.phdrs[i] + phdr.save(f) + +DIGEST_SIZE = 0x20 +SIGNATURE_SIZE = 0x100 +BLOCK_SIZE = 0x4000 +DEFAULT_BLOCK_SIZE = 0x1000 + +SELF_CONTROL_BLOCK_TYPE_NPDRM = 0x3 +SELF_NPDRM_CONTROL_BLOCK_CONTENT_ID_SIZE = 0x13 +SELF_NPDRM_CONTROL_BLOCK_RANDOM_PAD_SIZE = 0xD + +EMPTY_DIGEST = '\0' * DIGEST_SIZE +EMPTY_SIGNATURE = '\0' * SIGNATURE_SIZE + +class SignedElfEntry(object): + FMT = '<4Q' + + PROPS_ORDER_SHIFT = 0 + PROPS_ORDER_MASK = 0x1 + PROPS_ENCRYPTED_SHIFT = 1 + PROPS_ENCRYPTED_MASK = 0x1 + PROPS_SIGNED_SHIFT = 2 + PROPS_SIGNED_MASK = 0x1 + PROPS_COMPRESSED_SHIFT = 3 + PROPS_COMPRESSED_MASK = 0x1 + PROPS_WINDOW_BITS_SHIFT = 8 + PROPS_WINDOW_BITS_MASK = 0x7 + PROPS_HAS_BLOCKS_SHIFT = 11 + PROPS_HAS_BLOCKS_MASK = 0x1 + PROPS_BLOCK_SIZE_SHIFT = 12 + PROPS_BLOCK_SIZE_MASK = 0xF + PROPS_HAS_DIGESTS_SHIFT = 16 + PROPS_HAS_DIGESTS_MASK = 0x1 + PROPS_HAS_EXTENTS_SHIFT = 17 + PROPS_HAS_EXTENTS_MASK = 0x1 + PROPS_HAS_META_SEGMENT_SHIFT = 20 + PROPS_HAS_META_SEGMENT_MASK = 0x1 + PROPS_SEGMENT_INDEX_SHIFT = 20 + PROPS_SEGMENT_INDEX_MASK = 0xFFFF + PROPS_DEFAULT_BLOCK_SIZE = 0x1000 + PROPS_META_SEGMENT_MASK = 0xF0000 + + def __init__(self, index): + self.index = index + + self.props = None + self.offset = None + self.filesz = None + self.memsz = None + + self.data = None + + def save(self, f): + f.write(struct.pack(SignedElfEntry.FMT, self.props, self.offset, self.filesz, self.memsz)) + + @property + def order(self): + return (self.props >> SignedElfEntry.PROPS_ORDER_SHIFT) & SignedElfEntry.PROPS_ORDER_MASK + + @order.setter + def order(self, value): + self.props &= ~(SignedElfEntry.PROPS_ORDER_MASK << SignedElfEntry.PROPS_ORDER_SHIFT) + self.props |= (value & SignedElfEntry.PROPS_ORDER_MASK) << SignedElfEntry.PROPS_ORDER_SHIFT + + @property + def encrypted(self): + return ((self.props >> SignedElfEntry.PROPS_ENCRYPTED_SHIFT) & SignedElfEntry.PROPS_ENCRYPTED_MASK) != 0 + + @encrypted.setter + def encrypted(self, value): + self.props &= ~(SignedElfEntry.PROPS_ENCRYPTED_MASK << SignedElfEntry.PROPS_ENCRYPTED_SHIFT) + if value: + self.props |= SignedElfEntry.PROPS_ENCRYPTED_MASK << SignedElfEntry.PROPS_ENCRYPTED_SHIFT + + @property + def signed(self): + return ((self.props >> SignedElfEntry.PROPS_SIGNED_SHIFT) & SignedElfEntry.PROPS_SIGNED_MASK) != 0 + + @signed.setter + def signed(self, value): + self.props &= ~(SignedElfEntry.PROPS_SIGNED_MASK << SignedElfEntry.PROPS_SIGNED_SHIFT) + if value: + self.props |= SignedElfEntry.PROPS_SIGNED_MASK << SignedElfEntry.PROPS_SIGNED_SHIFT + + @property + def compressed(self): + return ((self.props >> SignedElfEntry.PROPS_COMPRESSED_SHIFT) & SignedElfEntry.PROPS_COMPRESSED_MASK) != 0 + + @compressed.setter + def compressed(self, value): + self.props &= ~(SignedElfEntry.PROPS_COMPRESSED_MASK << SignedElfEntry.PROPS_COMPRESSED_SHIFT) + if value: + self.props |= SignedElfEntry.PROPS_COMPRESSED_MASK << SignedElfEntry.PROPS_COMPRESSED_SHIFT + + @property + def has_blocks(self): + return ((self.props >> SignedElfEntry.PROPS_HAS_BLOCKS_SHIFT) & SignedElfEntry.PROPS_HAS_BLOCKS_MASK) != 0 + + @has_blocks.setter + def has_blocks(self, value): + self.props &= ~(SignedElfEntry.PROPS_HAS_BLOCKS_MASK << SignedElfEntry.PROPS_HAS_BLOCKS_SHIFT) + if value: + self.props |= SignedElfEntry.PROPS_HAS_BLOCKS_MASK << SignedElfEntry.PROPS_HAS_BLOCKS_SHIFT + + @property + def has_digests(self): + return ((self.props >> SignedElfEntry.PROPS_HAS_DIGESTS_SHIFT) & SignedElfEntry.PROPS_HAS_DIGESTS_MASK) != 0 + + @has_digests.setter + def has_digests(self, value): + self.props &= ~(SignedElfEntry.PROPS_HAS_DIGESTS_MASK << SignedElfEntry.PROPS_HAS_DIGESTS_SHIFT) + if value: + self.props |= SignedElfEntry.PROPS_HAS_DIGESTS_MASK << SignedElfEntry.PROPS_HAS_DIGESTS_SHIFT + + @property + def has_extents(self): + return ((self.props >> SignedElfEntry.PROPS_HAS_EXTENTS_SHIFT) & SignedElfEntry.PROPS_HAS_EXTENTS_MASK) != 0 + + @has_extents.setter + def has_extents(self, value): + self.props &= ~(SignedElfEntry.PROPS_HAS_EXTENTS_MASK << SignedElfEntry.PROPS_HAS_EXTENTS_SHIFT) + if value: + self.props |= SignedElfEntry.PROPS_HAS_EXTENTS_MASK << SignedElfEntry.PROPS_HAS_EXTENTS_SHIFT + + @property + def has_meta_segment(self): + return ((self.props >> SignedElfEntry.PROPS_HAS_META_SEGMENT_SHIFT) & SignedElfEntry.PROPS_HAS_META_SEGMENT_MASK) != 0 + + @has_meta_segment.setter + def has_meta_segment(self, value): + self.props &= ~(SignedElfEntry.PROPS_HAS_META_SEGMENT_MASK << SignedElfEntry.PROPS_HAS_META_SEGMENT_SHIFT) + if value: + self.props |= SignedElfEntry.PROPS_HAS_META_SEGMENT_MASK << SignedElfEntry.PROPS_HAS_META_SEGMENT_SHIFT + + @property + def wbits(self): + return (self.props >> SignedElfEntry.PROPS_WINDOW_BITS_SHIFT) & SignedElfEntry.PROPS_WINDOW_BITS_MASK + + @wbits.setter + def wbits(self, value): + self.props &= ~(SignedElfEntry.PROPS_WINDOW_BITS_MASK << SignedElfEntry.PROPS_WINDOW_BITS_SHIFT) + self.props |= (value & SignedElfEntry.PROPS_WINDOW_BITS_MASK) << SignedElfEntry.PROPS_WINDOW_BITS_SHIFT + + @property + def block_size(self): + if self.has_blocks: + return 1 << (12 + (self.props >> SignedElfEntry.PROPS_BLOCK_SIZE_SHIFT) & SignedElfEntry.PROPS_BLOCK_SIZE_MASK) + else: + return DEFAULT_BLOCK_SIZE + + @block_size.setter + def block_size(self, value): + self.props &= ~(SignedElfEntry.PROPS_BLOCK_SIZE_MASK << SignedElfEntry.PROPS_BLOCK_SIZE_SHIFT) + if self.has_blocks: + value = ilog2(value) - 12 + else: + value = 0 # TODO: check + self.props |= (value & SignedElfEntry.PROPS_BLOCK_SIZE_MASK) << SignedElfEntry.PROPS_BLOCK_SIZE_SHIFT + + @property + def segment_index(self): + return (self.props >> SignedElfEntry.PROPS_SEGMENT_INDEX_SHIFT) & SignedElfEntry.PROPS_SEGMENT_INDEX_MASK + + @wbits.setter + def segment_index(self, value): + self.props &= ~(SignedElfEntry.PROPS_SEGMENT_INDEX_MASK << SignedElfEntry.PROPS_SEGMENT_INDEX_SHIFT) + self.props |= (value & SignedElfEntry.PROPS_SEGMENT_INDEX_MASK) << SignedElfEntry.PROPS_SEGMENT_INDEX_SHIFT + + def is_meta_segment(self): # TODO: check + return (self.props & SignedElfEntry.PROPS_META_SEGMENT_MASK) != 0 + + def __repr__(self): + return 'prs:0x{0:X} ofs:0x{1:X} fsz:0x{2:X} msz:0x{3:X}'.format(self.props, self.offset, self.filesz, self.memsz) + +class SignedElfExInfo(object): + FMT = '<4Q32s' + + PTYPE_FAKE = 0x1 + PTYPE_NPDRM_EXEC = 0x4 + PTYPE_NPDRM_DYNLIB = 0x5 + PTYPE_SYSTEM_EXEC = 0x8 + PTYPE_SYSTEM_DYNLIB = 0x9 # including Mono binaries + PTYPE_HOST_KERNEL = 0xC + PTYPE_SECURE_MODULE = 0xE + PTYPE_SECURE_KERNEL = 0xF + + def __init__(self): + self.paid = None + self.ptype = None + self.app_version = None + self.fw_version = None + self.digest = None + + def save(self, f): + f.write(struct.pack(SignedElfExInfo.FMT, self.paid, self.ptype, self.app_version, self.fw_version, self.digest)) + +class SignedElfNpdrmControlBlock(object): + FMT = ' 0: + if val.startswith('0x') or val.startswith('0X'): + val = val[2:] + if len(val) % 2 != 0 or not all(x in string.hexdigits for x in val): + return None + val = val.decode('hex') + val_size = len(val) + + if not exact_size is None and val_size != exact_size: + return None + else: + if not min_size is None and val_size < min_size: + return None + if not max_size is None and val_size > max_size: + return None + + return val + +def input_file_type(val): + if not os.access(val, os.F_OK | os.R_OK) or not os.path.isfile(val): + raise argparse.ArgumentTypeError('invalid input file: {0}'.format(val)) + return val + +def output_file_type(val): + if os.access(val, os.F_OK) and (not os.path.isfile(val) or not os.access(val, os.F_OK | os.W_OK)): + raise argparse.ArgumentTypeError('invalid output file: {0}'.format(val)) + return val + +def auth_info_type(val): + new_val = ensure_hex_string(val, exact_size=0x88) + if new_val is None: + raise argparse.ArgumentTypeError('invalid auth info: {0}'.format(val)) + return new_val + +class MyParser(argparse.ArgumentParser): + def error(self, message): + self.print_help() + sys.stderr.write('\nerror: {0}\n'.format(message)) + sys.exit(2) + +parser = MyParser(description='fake signed elf maker') +parser.add_argument('input', type=input_file_type, default=None, help='elf/prx file path') +parser.add_argument('output', type=output_file_type, default=None, help='self/sprx file path') +parser.add_argument('--paid', type=int_with_base_type, default=0x3100000000000002, help='program authentication id') +parser.add_argument('--ptype', default=None, help='program type {fake, npdrm_exec, npdrm_dynlib, system_exec, system_dynlib, host_kernel, secure_module, secure_kernel}') +parser.add_argument('--app-version', type=int_with_base_type, default=0, help='application version') +parser.add_argument('--fw-version', type=int_with_base_type, default=0, help='firmware version') +parser.add_argument('--auth-info', type=auth_info_type, default=None, help='authentication info') + +if len(sys.argv) == 1: + parser.print_usage() + sys.exit(1) + +args = parser.parse_args() + +paid = args.paid +if not (0 <= paid <= 0xFFFFFFFFFFFFFFFF): + parser.error('invalid program authentication id: 0x{0:016X}'.format(paid)) + +ptype = SignedElfExInfo.PTYPE_FAKE +if not args.ptype is None: + ptype = { + 'fake': SignedElfExInfo.PTYPE_FAKE, + 'npdrm_exec': SignedElfExInfo.PTYPE_NPDRM_EXEC, + 'npdrm_dynlib': SignedElfExInfo.PTYPE_NPDRM_DYNLIB, + 'system_exec': SignedElfExInfo.PTYPE_SYSTEM_EXEC, + 'system_dynlib': SignedElfExInfo.PTYPE_SYSTEM_DYNLIB, + 'host_kernel': SignedElfExInfo.PTYPE_HOST_KERNEL, + 'secure_module': SignedElfExInfo.PTYPE_SECURE_MODULE, + 'secure_kernel': SignedElfExInfo.PTYPE_SECURE_KERNEL, + }.get(args.ptype.strip().lower(), None) + if ptype is None: + ptype = try_parse_int(args.ptype) + if ptype is None: + parser.error('invalid program type: 0x{0:016X}'.format(ptype)) +if not (0 <= ptype <= 0xFFFFFFFFFFFFFFFF): + parser.error('invalid program type: 0x{0:016X}'.format(ptype)) + +app_version = args.app_version +if not (0 <= app_version <= 0xFFFFFFFFFFFFFFFF): + parser.error('invalid application version: 0x{0:016X}'.format(app_version)) + +fw_version = args.fw_version +if not (0 <= fw_version <= 0xFFFFFFFFFFFFFFFF): + parser.error('invalid firmware version: 0x{0:016X}'.format(fw_version)) + +auth_info = args.auth_info + +elf_file_path = args.input +fself_file_path = args.output + +print('loading elf file: {0}'.format(elf_file_path)) +try: + with open(elf_file_path, 'rb') as f: + elf_file = ElfFile(ignore_shdrs=True) + elf_file.load(f) +except Exception as err: + traceback.print_exc() + print('') + parser.error('unable to load elf file: {0} ({1})'.format(elf_file_path, err)) + +print('saving fake signed elf file: {0}'.format(fself_file_path)) +try: + with open(fself_file_path, 'wb') as f: + self_file = SignedElfFile(elf_file, paid=paid, ptype=ptype, app_version=app_version, fw_version=fw_version, auth_info=auth_info) + self_file.save(f) +except Exception as err: + traceback.print_exc() + print('') + parser.error('unable to save fself file: {0} ({1})'.format(elf_file_path, err)) + +print('done') diff --git a/Playstation/OrbisLibAPI-2.0/stdafx.cpp b/Playstation/OrbisLibAPI-2.0/stdafx.cpp new file mode 100644 index 0000000..53fddb5 --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/stdafx.cpp @@ -0,0 +1,7 @@ +// stdafx.cpp : source file that includes just the standard includes +// OrbisLibAPI-2.0.pch will be the pre-compiled header + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/Playstation/OrbisLibAPI-2.0/stdafx.h b/Playstation/OrbisLibAPI-2.0/stdafx.h new file mode 100644 index 0000000..9078420 --- /dev/null +++ b/Playstation/OrbisLibAPI-2.0/stdafx.h @@ -0,0 +1,20 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Version.h" +#include "Config.h" +#include "Utilities.h" +#include "ThreadPool.h" +#include "Sockets.h" +#include "Events.h" \ No newline at end of file diff --git a/Playstation/OrbisLibAPI/ByteStream.cpp b/Playstation/OrbisLibAPI/ByteStream.cpp new file mode 100644 index 0000000..0ea3f65 --- /dev/null +++ b/Playstation/OrbisLibAPI/ByteStream.cpp @@ -0,0 +1,65 @@ +#include "Common.h" +#include "ByteStream.h" + +ByteStream::ByteStream(std::vector data) +{ + Data = data; +} + +ByteStream::~ByteStream() +{ + +} + +int ByteStream::ReadInt(bool littleEndian) +{ + int value = 0; + + // Convert the data to int depending on the endianess. + if (littleEndian) + { + for (int j = 0; j < sizeof(int); j++) { + value |= Data[j] << (8 * j); + } + } + else + { + for (int j = sizeof(int) - 1; j >= 0; j--) { + value |= Data[j] << (8 * (sizeof(int) - j - 1)); + } + } + + // Remove this data from the stream. + Data.erase(Data.begin(), Data.begin() + sizeof(int)); + + // return the int. + return value; +} + +std::string ByteStream::ReadString(int length) +{ + // Read the string. + std::string tempStr(Data.begin(), Data.begin() + length); + + // Erase this data from the stream. + Data.erase(Data.begin(), Data.begin() + length); + + // Return the desired string. + return tempStr; +} + +std::vector ByteStream::ReadBytes(int length) +{ + std::vector block; + for (size_t i = 0; i < length; i++) + { + if (i >= Data.size()) + { + // Handle out-of-bounds access + break; + } + block.push_back(Data.at(i)); + } + + return block; +} \ No newline at end of file diff --git a/Playstation/OrbisLibAPI/ByteStream.h b/Playstation/OrbisLibAPI/ByteStream.h new file mode 100644 index 0000000..40a05eb --- /dev/null +++ b/Playstation/OrbisLibAPI/ByteStream.h @@ -0,0 +1,16 @@ +#pragma once + +class ByteStream +{ +public: + ByteStream(std::vector data); + ~ByteStream(); + + int ReadInt(bool littleEndian = true); + std::string ReadString(int length); + std::vector ReadBytes(int length); + +private: + std::vector Data; +}; + diff --git a/Playstation/OrbisLibAPI/Common.h b/Playstation/OrbisLibAPI/Common.h index 1c53e6c..e482e45 100644 --- a/Playstation/OrbisLibAPI/Common.h +++ b/Playstation/OrbisLibAPI/Common.h @@ -29,6 +29,7 @@ #include #include #include +#include #include "Config.h" #include "SocketListener.h" diff --git a/Playstation/OrbisLibAPI/OrbisLibAPI.vcxproj b/Playstation/OrbisLibAPI/OrbisLibAPI.vcxproj index 5cd8719..cfa69e4 100644 --- a/Playstation/OrbisLibAPI/OrbisLibAPI.vcxproj +++ b/Playstation/OrbisLibAPI/OrbisLibAPI.vcxproj @@ -66,12 +66,15 @@ del /s /q /f $(IntDir)\*.oelf + + + @@ -91,12 +94,15 @@ del /s /q /f $(IntDir)\*.oelf + + + diff --git a/Playstation/OrbisLibAPI/OrbisLibAPI.vcxproj.filters b/Playstation/OrbisLibAPI/OrbisLibAPI.vcxproj.filters index baa43f8..73290b7 100644 --- a/Playstation/OrbisLibAPI/OrbisLibAPI.vcxproj.filters +++ b/Playstation/OrbisLibAPI/OrbisLibAPI.vcxproj.filters @@ -105,6 +105,15 @@ Source Files\Utilities + + Source Files\API + + + Source Files\API + + + Source Files\Utilities + @@ -179,5 +188,14 @@ Header Files\Utilities + + Header Files\API + + + Header Files\API + + + Header Files\Utilities + \ No newline at end of file diff --git a/Playstation/OrbisLibAPI/PacketBuilder.cpp b/Playstation/OrbisLibAPI/PacketBuilder.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Playstation/OrbisLibAPI/PacketBuilder.h b/Playstation/OrbisLibAPI/PacketBuilder.h new file mode 100644 index 0000000..6f70f09 --- /dev/null +++ b/Playstation/OrbisLibAPI/PacketBuilder.h @@ -0,0 +1 @@ +#pragma once diff --git a/Playstation/OrbisLibAPI/PacketReader.cpp b/Playstation/OrbisLibAPI/PacketReader.cpp new file mode 100644 index 0000000..ff5c033 --- /dev/null +++ b/Playstation/OrbisLibAPI/PacketReader.cpp @@ -0,0 +1,120 @@ +#include "Common.h" +#include "ByteStream.h" +#include "PacketReader.h" + +PacketReader::PacketReader(OrbisNetId socket) +{ + Socket = socket; +} + +PacketReader::~PacketReader() +{ + +} + +bool PacketReader::ReadPacket() +{ + // Get the initial packet info. + auto initialPacket = std::make_unique(); + if (sceNetRecv(Socket, initialPacket.get(), sizeof(InitialPacket), 0) < sizeof(InitialPacket)) + { + klog("[PacketReader] Failed to recieve the initial packet\n"); + return false; + } + + // Make sure the packet version matches up. + if (initialPacket->Version != PacketVersion || strcmp(initialPacket->Magic, "ORBIS_SUITE")) + { + klog("[PacketReader] Packet validation failed. MagicStr '%s' and version '%d' does not meet the requirements of 'ORBIS_SUITE' and '%d'.\n", initialPacket->Magic, initialPacket->Version, PacketVersion); + return false; + } + + // Read the packet data. + std::vector rawData; + rawData.resize(initialPacket->Size); + if (sceNetRecv(Socket, rawData.data(), initialPacket->Size, 0) < initialPacket->Size) + { + klog("[PacketReader] Failed to recieve the packet data\n"); + return false; + } + + // Set the byte stream. + Data = std::make_shared(rawData); + + // Read the fields. + for (int i = 0; i < initialPacket->FieldCount; i++) + ReadField(); + + return true; +} + +bool PacketReader::ReadField() +{ + // Read the field type. + int fieldType = Data->ReadInt(); + + // Read the feild size. + int fieldSize = Data->ReadInt(); + + // Read the field name length. + int fieldNameLen = Data->ReadInt(); + + // Read the field name. + auto fieldName = Data->ReadString(fieldNameLen); + + // Recieve the field data. + switch ((FieldTypes)fieldType) + { + default: + klog("[PacketReader] Unknown field type of %d\n", fieldType); + return false; + + case FT_INT: + { + // Set up the field. + auto fieldTemp = std::make_shared>(); + fieldTemp->FieldType = fieldType; + fieldTemp->Size = fieldSize; + fieldTemp->Value = Data->ReadInt(); + + // Set the field into the field list. + Fields[fieldName] = (std::shared_ptr)fieldTemp.get(); + + return true; + } + + case FT_STR: + { + // Set up the field. + auto fieldTemp = std::make_shared>(); + fieldTemp->FieldType = fieldType; + fieldTemp->Size = fieldSize; + + // Read the string. + auto stringLen = Data->ReadInt(); + fieldTemp->Value = Data->ReadString(stringLen); + + // Set the field into the field list. + Fields[fieldName] = (std::shared_ptr)fieldTemp.get(); + + return true; + } + + case FT_BYTES: + { + // Set up the field. + auto fieldTemp = std::make_shared>>(); + fieldTemp->FieldType = fieldType; + fieldTemp->Size = fieldSize; + + // Read the string. + auto stringLen = Data->ReadInt(); + fieldTemp->Value = Data->ReadBytes(stringLen); + + // Set the field into the field list. + Fields[fieldName] = (std::shared_ptr)fieldTemp.get(); + + return true; + } + } +} diff --git a/Playstation/OrbisLibAPI/PacketReader.h b/Playstation/OrbisLibAPI/PacketReader.h new file mode 100644 index 0000000..06774aa --- /dev/null +++ b/Playstation/OrbisLibAPI/PacketReader.h @@ -0,0 +1,48 @@ +#pragma once + +enum FieldTypes +{ + FT_INT, + FT_STR, + FT_BYTES, +}; + +class IDataType +{ +public: + int FieldType; + int Size; +}; + +template +class DataField : public IDataType +{ +public: + T Value; +}; + +class PacketReader +{ +public: + PacketReader(OrbisNetId sock); + ~PacketReader(); + + bool ReadPacket(); + bool ReadField(); + +private: + static const int PacketVersion = 1; + + struct InitialPacket + { + char Magic[12]; + int Version; + int Size; + int FieldCount; + }; + + OrbisNetId Socket; + + std::shared_ptr Data; + std::map> Fields; +}; diff --git a/Playstation/OrbisLibAPI/ThreadPool.cpp b/Playstation/OrbisLibAPI/ThreadPool.cpp index 9cfe3a6..05b5b5c 100644 --- a/Playstation/OrbisLibAPI/ThreadPool.cpp +++ b/Playstation/OrbisLibAPI/ThreadPool.cpp @@ -11,25 +11,24 @@ void ThreadPool::WorkingLoop() { while (true) { - std::function job; - { - - std::unique_lock lock(JobQueueMtx); - MtxCondition.wait(lock, - [] - { - return !JobQueue.empty() || !ShouldRun; - }); - - if (!ShouldRun) - return; - - job = JobQueue.front(); - JobQueue.pop(); - } - try { + std::function job; + { + std::unique_lock lock(JobQueueMtx); + MtxCondition.wait(lock, + [] + { + return !JobQueue.empty() || !ShouldRun; + }); + + if (!ShouldRun) + return; + + job = JobQueue.front(); + JobQueue.pop(); + } + job(); } catch(const std::exception& ex) diff --git a/Playstation/OrbisLibAPI/Version.h b/Playstation/OrbisLibAPI/Version.h index abb779b..4e4f233 100644 --- a/Playstation/OrbisLibAPI/Version.h +++ b/Playstation/OrbisLibAPI/Version.h @@ -1,11 +1,11 @@ -#pragma once -#define ORBISLIB_MAJOR 3 -#define ORBISLIB_MINOR 0 -#define ORBISLIB_BUILDVERSION 1169 -#define stringify(a) stringify_(a) -#define stringify_(a) #a -#if defined(_DEBUG) -#define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Dev Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__) -#else -#define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__) -#endif +#pragma once +#define ORBISLIB_MAJOR 3 +#define ORBISLIB_MINOR 0 +#define ORBISLIB_BUILDVERSION 1185 +#define stringify(a) stringify_(a) +#define stringify_(a) #a +#if defined(_DEBUG) +#define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Dev Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__) +#else +#define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__) +#endif diff --git a/Playstation/OrbisMonitor/build.bat b/Playstation/OrbisMonitor/build.bat deleted file mode 100644 index 3e46feb..0000000 --- a/Playstation/OrbisMonitor/build.bat +++ /dev/null @@ -1,80 +0,0 @@ -SETLOCAL EnableDelayedExpansion - -Rem Package information -set PKG_TITLE="My Homebrew" -set PKG_VERSION="1.00" -set PKG_ASSETS="assets" -set PKG_TITLE_ID="BREW00100" -set PKG_CONTENT_ID="IV0000-BREW00100_00-MYHOMEBREW000000" - -Rem Libraries to link in -set libraries=-lc -lkernel -lc++ - -Rem set extra_flags= - -Rem Read the script arguments into local vars -set intdir=%1 -set targetname=%~2 -set outputPath=%3 - -set outputElf=%intdir%\%targetname%.elf -set outputOelf=%intdir%\%targetname%.oelf - -@mkdir %intdir% - -Rem Compile object files for all the source files -for %%f in (*.c) do ( - clang --target=x86_64-pc-freebsd12-elf -fPIC -funwind-tables -I"%OO_PS4_TOOLCHAIN%\\include" -I"%OO_PS4_TOOLCHAIN%\\include\\c++\\v1" %extra_flags% -c -o %intdir%\%%~nf.o %%~nf.c -) - -for %%f in (*.cpp) do ( - clang++ --target=x86_64-pc-freebsd12-elf -fPIC -funwind-tables -I"%OO_PS4_TOOLCHAIN%\\include" -I"%OO_PS4_TOOLCHAIN%\\include\\c++\\v1" %extra_flags% -c -o %intdir%\%%~nf.o %%~nf.cpp -) - -Rem Get a list of object files for linking -set obj_files= -for %%f in (%1\\*.o) do set obj_files=!obj_files! .\%%f - -Rem Link the input ELF -ld.lld -m elf_x86_64 -pie --script "%OO_PS4_TOOLCHAIN%\link.x" --eh-frame-hdr -o "%outputElf%" "-L%OO_PS4_TOOLCHAIN%\\lib" %libraries% --verbose "%OO_PS4_TOOLCHAIN%\lib\crt1.o" %obj_files% - -Rem Create the eboot -%OO_PS4_TOOLCHAIN%\bin\windows\create-fself.exe -in "%outputElf%" --out "%outputOelf%" --eboot "eboot.bin" --paid 0x3800000000000011 - -Rem Create param.sfo -%OO_PS4_TOOLCHAIN%\bin\windows\PkgTool.Core.exe sfo_new sce_sys/param.sfo -%OO_PS4_TOOLCHAIN%\bin\windows\PkgTool.Core.exe sfo_setentry sce_sys/param.sfo APP_TYPE --type Integer --maxsize 4 --value 1 -%OO_PS4_TOOLCHAIN%\bin\windows\PkgTool.Core.exe sfo_setentry sce_sys/param.sfo APP_VER --type Utf8 --maxsize 8 --value %PKG_VERSION% -%OO_PS4_TOOLCHAIN%\bin\windows\PkgTool.Core.exe sfo_setentry sce_sys/param.sfo ATTRIBUTE --type Integer --maxsize 4 --value 0 -%OO_PS4_TOOLCHAIN%\bin\windows\PkgTool.Core.exe sfo_setentry sce_sys/param.sfo CATEGORY --type Utf8 --maxsize 4 --value "gd" -%OO_PS4_TOOLCHAIN%\bin\windows\PkgTool.Core.exe sfo_setentry sce_sys/param.sfo CONTENT_ID --type Utf8 --maxsize 48 --value %PKG_CONTENT_ID% -%OO_PS4_TOOLCHAIN%\bin\windows\PkgTool.Core.exe sfo_setentry sce_sys/param.sfo DOWNLOAD_DATA_SIZE --type Integer --maxsize 4 --value 0 -%OO_PS4_TOOLCHAIN%\bin\windows\PkgTool.Core.exe sfo_setentry sce_sys/param.sfo SYSTEM_VER --type Integer --maxsize 4 --value 0 -%OO_PS4_TOOLCHAIN%\bin\windows\PkgTool.Core.exe sfo_setentry sce_sys/param.sfo TITLE --type Utf8 --maxsize 128 --value %PKG_TITLE% -%OO_PS4_TOOLCHAIN%\bin\windows\PkgTool.Core.exe sfo_setentry sce_sys/param.sfo TITLE_ID --type Utf8 --maxsize 12 --value %PKG_TITLE_ID% -%OO_PS4_TOOLCHAIN%\bin\windows\PkgTool.Core.exe sfo_setentry sce_sys/param.sfo VERSION --type Utf8 --maxsize 8 --value %PKG_VERSION% - -Rem Get a list of assets for packaging -set module_files= -for %%f in (sce_module\\*) do set module_files=!module_files! sce_module/%%~nxf - -set asset_audio_files= -for %%f in (assets\\audio\\*) do set asset_audio_files=!asset_audio_files! assets/audio/%%~nxf - -set asset_fonts_files= -for %%f in (assets\\fonts\\*) do set asset_fonts_files=!asset_fonts_files! assets/fonts/%%~nxf - -set asset_images_files= -for %%f in (assets\\images\\*) do set asset_images_files=!asset_images_files! assets/images/%%~nxf - -set asset_misc_files= -for %%f in (assets\\misc\\*) do set asset_misc_files=!asset_misc_files! assets/misc/%%~nxf - -set asset_videos_files= -for %%f in (assets\\videos\\*) do set asset_videos_files=!asset_videos_files! assets/videos/%%~nxf - -Rem Create gp4 -%OO_PS4_TOOLCHAIN%\bin\windows\create-gp4.exe -out pkg.gp4 --content-id=%PKG_CONTENT_ID% --files "eboot.bin sce_sys/about/right.sprx sce_sys/param.sfo sce_sys/icon0.png %module_files% %asset_audio_files% %asset_fonts_files% %asset_images_files% %asset_misc_files% %asset_videos_files%" - -Rem Create pkg -%OO_PS4_TOOLCHAIN%\bin\windows\PkgTool.Core.exe pkg_build pkg.gp4 .. diff --git a/Playstation/OrbisMonitor/main.cpp b/Playstation/OrbisMonitor/main.cpp deleted file mode 100644 index ec1c64d..0000000 --- a/Playstation/OrbisMonitor/main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main() -{ - // Your code here... - return 0; -} \ No newline at end of file diff --git a/Playstation/OrbisToolbox-2.0/Version.h b/Playstation/OrbisToolbox-2.0/Version.h index b2a5aa1..495c9b3 100644 --- a/Playstation/OrbisToolbox-2.0/Version.h +++ b/Playstation/OrbisToolbox-2.0/Version.h @@ -1,11 +1,11 @@ -#pragma once -#define ORBIS_TOOLBOX_MAJOR 2 -#define ORBIS_TOOLBOX_MINOR 0 -#define ORBIS_TOOLBOX_BUILDVERSION 346 -#define stringify(a) stringify_(a) -#define stringify_(a) #a -#if defined(ORBIS_TOOLBOX_DEBUG) -#define ORBIS_TOOLBOX_BUILDSTRING ("[Orbis Toolbox " stringify(ORBIS_TOOLBOX_MAJOR) "." stringify(ORBIS_TOOLBOX_MINOR) "] Dev Build " stringify(ORBIS_TOOLBOX_BUILDVERSION) " " __DATE__ " " __TIME__) -#else -#define ORBIS_TOOLBOX_BUILDSTRING ("[Orbis Toolbox " stringify(ORBIS_TOOLBOX_MAJOR) "." stringify(ORBIS_TOOLBOX_MINOR) "] Build " stringify(ORBIS_TOOLBOX_BUILDVERSION) " " __DATE__ " " __TIME__) -#endif +#pragma once +#define ORBIS_TOOLBOX_MAJOR 2 +#define ORBIS_TOOLBOX_MINOR 0 +#define ORBIS_TOOLBOX_BUILDVERSION 347 +#define stringify(a) stringify_(a) +#define stringify_(a) #a +#if defined(ORBIS_TOOLBOX_DEBUG) +#define ORBIS_TOOLBOX_BUILDSTRING ("[Orbis Toolbox " stringify(ORBIS_TOOLBOX_MAJOR) "." stringify(ORBIS_TOOLBOX_MINOR) "] Dev Build " stringify(ORBIS_TOOLBOX_BUILDVERSION) " " __DATE__ " " __TIME__) +#else +#define ORBIS_TOOLBOX_BUILDSTRING ("[Orbis Toolbox " stringify(ORBIS_TOOLBOX_MAJOR) "." stringify(ORBIS_TOOLBOX_MINOR) "] Build " stringify(ORBIS_TOOLBOX_BUILDVERSION) " " __DATE__ " " __TIME__) +#endif diff --git a/Playstation/OrbisUtils/LncUtil.cpp b/Playstation/OrbisUtils/LncUtil.cpp new file mode 100644 index 0000000..c36b8f1 --- /dev/null +++ b/Playstation/OrbisUtils/LncUtil.cpp @@ -0,0 +1,41 @@ +#include +#include +#include "LncUtil.h" + +namespace LncUtil +{ + int IsAppLaunched(const char* titleId, bool* isLaunched) + { + return sceLncUtilIsAppLaunched(titleId, isLaunched); + } + + int IsAppSuspended(int appId, bool* isSuspended) + { + return sceLncUtilIsAppSuspended(appId, isSuspended); + } + + int GetAppId(const char* titleId) + { + return sceLncUtilGetAppId(titleId); + } + + int LaunchApp(const char* titleId, char** args, LncLaunchAppParam* appParam) + { + return sceLncUtilLaunchApp(titleId, args, (LaunchAppParam*)appParam); + } + + int SuspendApp(int appId, int flags) + { + return sceLncUtilSuspendApp(appId, flags); + } + + int ResumeApp(int appId, int flags) + { + return sceLncUtilResumeApp(appId, flags); + } + + int SetAppFocus(int appId, int flags) + { + return sceLncUtilSetAppFocus(appId, flags); + } +}; diff --git a/Playstation/OrbisUtils/LncUtil.h b/Playstation/OrbisUtils/LncUtil.h new file mode 100644 index 0000000..15a41d0 --- /dev/null +++ b/Playstation/OrbisUtils/LncUtil.h @@ -0,0 +1,21 @@ +#pragma once + +namespace LncUtil +{ + struct LncLaunchAppParam + { + unsigned int size; //0x00 + int userId; //0x04 + int appAttr; //0x08 + int enableCrashReport; //0x0C + uint64_t checkFlag; //0x10 + }; + + int IsAppLaunched(const char* titleId, bool* isLaunched); + int IsAppSuspended(int appId, bool* isSuspended); + int GetAppId(const char* titleId); + int LaunchApp(const char* titleId, char** args, LncLaunchAppParam* appParam); + int SuspendApp(int appId, int flags); + int ResumeApp(int appId, int flags); + int SetAppFocus(int appId, int flags); +} \ No newline at end of file diff --git a/Playstation/OrbisMonitor/OrbisMonitor.vcxproj b/Playstation/OrbisUtils/OrbisUtils.vcxproj similarity index 83% rename from Playstation/OrbisMonitor/OrbisMonitor.vcxproj rename to Playstation/OrbisUtils/OrbisUtils.vcxproj index b383a7d..df4fca4 100644 --- a/Playstation/OrbisMonitor/OrbisMonitor.vcxproj +++ b/Playstation/OrbisUtils/OrbisUtils.vcxproj @@ -12,7 +12,7 @@ 15.0 - {95716bec-ff5a-4666-b8fe-547512ca38e0} + {6616120a-eacc-4a05-8f48-6b9b32deee75} Win32Proj @@ -38,8 +38,10 @@ + + WIN32;_DEBUG;$(NMakePreprocessorDefinitions) + - eboot.bin _DEBUG;$(NMakePreprocessorDefinitions) call build.bat $(IntDir) "$(TargetName)" "$(SolutionDir)" del /s /q /f $(IntDir)\*.o @@ -52,15 +54,22 @@ del /s /q /f $(IntDir)\*.oelf $(SolutionDir) $(OO_PS4_TOOLCHAIN)\include;$(NMakeIncludeSearchPath) + + WIN32;NDEBUG;$(NMakePreprocessorDefinitions) + - eboot.bin NDEBUG;$(NMakePreprocessorDefinitions) - - + + + + + + + diff --git a/Playstation/OrbisMonitor/OrbisMonitor.vcxproj.filters b/Playstation/OrbisUtils/OrbisUtils.vcxproj.filters similarity index 74% rename from Playstation/OrbisMonitor/OrbisMonitor.vcxproj.filters rename to Playstation/OrbisUtils/OrbisUtils.vcxproj.filters index 1309513..3ba8f9a 100644 --- a/Playstation/OrbisMonitor/OrbisMonitor.vcxproj.filters +++ b/Playstation/OrbisUtils/OrbisUtils.vcxproj.filters @@ -11,9 +11,16 @@ - + Source Files - + + + + + + + Header Files + \ No newline at end of file diff --git a/Playstation/OrbisUtils/build.bat b/Playstation/OrbisUtils/build.bat new file mode 100644 index 0000000..c945136 --- /dev/null +++ b/Playstation/OrbisUtils/build.bat @@ -0,0 +1,62 @@ +SETLOCAL EnableDelayedExpansion + +Rem Libraries to link in +set libraries=-lc++ -lc -lkernel -lSceSystemService -lSceLncUtil -lSceUserService -lSceRegMgr -lSceFreeType -lSceSysCore -lSceSystemStateMgr + +Rem Read the script arguments into local vars +set intdir=%1 +set targetname=%~2 +set outputPath=%~3 + +set outputElf=%intdir%%targetname%.elf +set outputOelf=%intdir%%targetname%.oelf +set outputPrx=%intdir%%targetname%.prx +set outputStub=%intdir%%targetname%_stub.so + +Rem Compile object files for all the source files +for %%f in (*.cpp) do ( + clang++ -cc1 -triple x86_64-scei-ps4-elf -I"%OO_PS4_TOOLCHAIN%\include" -I"%OO_PS4_TOOLCHAIN%\\include\\c++\\v1" -emit-obj -o %intdir%\%%~nf.o %%~nf.cpp +) + +Rem Compile object files for all the assembly files +for %%f in (*.s) do ( + clang -m64 -nodefaultlibs -nostdlib --target=x86_64-scei-ps4-elf -c -o %intdir%\%%~nf.o %%~nf.s +) + +Rem Get a list of object files for linking +set obj_files= +for %%f in (%intdir%\\*.o) do set obj_files=!obj_files! .\%%f + +Rem Link the input ELF +ld.lld -m elf_x86_64 -pie --script "%OO_PS4_TOOLCHAIN%\link.x" --eh-frame-hdr -o "%outputElf%" "-L%OO_PS4_TOOLCHAIN%\lib" %libraries% --verbose "%OO_PS4_TOOLCHAIN%\lib\crtlib.o" %obj_files% + +Rem Create stub shared libraries +for %%f in (*.cpp) do ( + clang++ -target x86_64-pc-linux-gnu -ffreestanding -nostdlib -fno-builtin -fPIC -c -I"%OO_PS4_TOOLCHAIN%\include" -I"%OO_PS4_TOOLCHAIN%\\include\\c++\\v1" -o %intdir%\%%~nf.o.stub %%~nf.cpp +) + +set stub_obj_files= +for %%f in (%intdir%\\*.o.stub) do set stub_obj_files=!stub_obj_files! .\%%f + +clang++ -target x86_64-pc-linux-gnu -shared -fuse-ld=lld -ffreestanding -nostdlib -fno-builtin "-L%OO_PS4_TOOLCHAIN%\lib" %libraries% %stub_obj_files% -o "%outputStub%" + +Rem Create the prx +%OO_PS4_TOOLCHAIN%\bin\windows\create-fself.exe -in "%outputElf%" --out "%outputOelf%" --lib "%outputPrx%" --paid 0x3800000000010003 + +Rem Cleanup +copy "%outputPrx%" "%outputPath%\Playstation\Build\pkg\Orbis Toolbox\%targetname%.sprx" +del "%outputPrx%" + +REM Generate the script. Will overwrite any existing temp.txt +echo open 1.1.0.15 2121> temp.txt +echo anonymous>> temp.txt +echo anonymous>> temp.txt +echo cd "/system/vsh/app/ORBS30000/">> temp.txt +echo send "%outputPath%\Playstation\Build\pkg\Daemons\ORBS30000\%targetname%.sprx">> temp.txt +echo quit>> temp.txt + +REM Launch FTP and pass it the script +ftp -s:temp.txt + +REM Clean up. +del temp.txt \ No newline at end of file diff --git a/Playstation/OrbisUtils/testbuild.bat b/Playstation/OrbisUtils/testbuild.bat new file mode 100644 index 0000000..6d15b69 --- /dev/null +++ b/Playstation/OrbisUtils/testbuild.bat @@ -0,0 +1,24 @@ +@echo off +rem GoldHEN SDK static lib build script + +rem change these if you need: +rem C compiler +set CC=clang +rem AR archiver +set AR=llvm-ar + +rem usually you do not need to change the stuff below: + +set CFLAGS=--target=x86_64-pc-freebsd12-elf -DORBIS=1 -D__ORBIS__=1 -DPS4=1 -DOO=1 -D__PS4__=1 -DOOPS4=1 -D__OOPS4__=1 -D__BSD_VISIBLE=1 -D_BSD_SOURCE=1 -march=btver2 -mtune=btver2 -fPIC -std=c++11 -isysroot "%OO_PS4_TOOLCHAIN%" -isystem "%OO_PS4_TOOLCHAIN%\include" -I"%OO_PS4_TOOLCHAIN%\\include\\c++\\v1" -Iinclude + +rmdir /s /q build +mkdir build + +for %%f in (*.cpp) do ( + %CC% %CFLAGS% -c %%f -o build\%%~nf.o +) + +%CC% -target x86_64-pc-linux-gnu -ffreestanding -nostdlib -fno-builtin -fPIC -isysroot "%OO_PS4_TOOLCHAIN%" -isystem "%OO_PS4_TOOLCHAIN%\include" -I"%OO_PS4_TOOLCHAIN%\\include\\c++\\v1" -Iinclude -o "%OO_PS4_TOOLCHAIN%\lib\crtlib.o" +%AR% --format=bsd rcs build\libOrbisUtils.a build\*.o "%OO_PS4_TOOLCHAIN%\lib\crtlib.o" + +pause \ No newline at end of file diff --git a/Windows/OrbisPeeknPoke/MainWindow.xaml b/Windows/OrbisPeeknPoke/MainWindow.xaml index 929555f..f790e44 100644 --- a/Windows/OrbisPeeknPoke/MainWindow.xaml +++ b/Windows/OrbisPeeknPoke/MainWindow.xaml @@ -141,8 +141,7 @@ LineInfoVisible="True" ColumnInfoVisible="True" GroupSeparatorVisible="false" - Font="Segoe UI" - + InfoForeColor="186, 105, 105" ForeColor="220, 220, 220" BackColor="60, 63, 65"