Join Us and become a Member for a Verified Badge to access private areas with the latest PS4 PKGs.
PS4 CFW and Hacks       Thread starter PSXHAX       Start date Nov 2, 2017 at 12:09 AM       3      
Status
Not open for further replies.
If you're a PlayStation 4 developer working on PS4 homebrew or planning to here are some updates that may be of interest to you courtesy of both Sony Computer Entertainment Worldwide Studios open source game development software (SonyWWS) and Thunder07 on Github! :geek:

Download: SLED-master.zip (GIT) / PS4.toolchain.cmake.zip (GIT) / libPS4freetype2-master.zip (GIT)
  • SLED (Script Language Editor and Debugger) provides a script debugger and runtime, with built-in support for Lua. The SLED project enables users to create, edit, and debug in-game Lua scripts easily and quickly.
  • PS4 cmake toolchain can be used for PS4 homebrew build management
  • libPS4freetype2 is a wrapper for upstream freetype2 to display text in PS4 homebrew
From the SLED README.md file, to quote: SLED (Script Language Editor and Debugger) provides a script debugger and runtime, with built-in support for Lua.

The SLED project enables users to create, edit, and debug in-game Lua scripts easily and quickly. It also provides memory tracking and performance-analysis capabilities. Highly flexible, and equipped with an array of powerful features, this toolset can reduce script-development time while helping to increase script performance and robustness. For a list of features, see Features and Benefits.

SLED has been used by several Sony Computer Entertainment first party game studios during their game development, such as Bend Studio, Guerilla Games, and JAPAN Studio.

This figure shows a SLED dialog displaying an opened script file with a breakpoint and an environmental variable watch window.

SLED (Script Language Editor and Debugger) & PS4 Homebrew Tools.jpg

SLED is an open source project. See License.txt.

More Info

The SLED wiki is at https://github.com/SonyWWS/SLED/wiki.

We have PDF files in the Docs folder or Documentation.

Bugs, feature requests, and questions: https://github.com/SonyWWS/SLED/issues.

Contact, in English or Japanese: sledpatsony AT gmail.com

From the PS4.toolchain.cmake Github.com page:
Code:
set(triple "x86_64-scei-ps4")
set(CMAKE_SYSTEM_NAME "FreeBSD")

set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
set(CMAKE_C_COMPILER_AR "ar")
set(CMAKE_LINKER "clang")
set(CMAKE_ASM_COMPILER "clang")
set(CMAKE_FIND_ROOT_PATH "$ENV{PS4SDK}/usr" CACHE STRING "")
set(CMAKE_SYSROOT "$ENV{PS4SDK}/usr" CACHE STRING "")
set(CMAKE_CXX_COMPILER_FORCED on)
set(CMAKE_C_COMPILER_TARGET "${triple}")
set(CMAKE_CXX_COMPILER_TARGET "${triple}")

# only search for libraries and includes in the PS4SDK directory
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_SKIP_RPATH true)

set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" CACHE STRING "")
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" CACHE STRING "")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -Wall -pedantic -m64 -mcmodel=large -nostdlib -nostdinc -ffreestanding -fPIE -fno-builtin -fno-stack-protector -D__PS4__" CACHE STRING "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -m64 -mcmodel=large -nostdlib -nostdinc -ffreestanding -fPIE -fno-stack-protector -D__PS4__" CACHE STRING "")
set(CMAKE_EXE_LINKER_FLAGS "-O3 -Wall -m64 -pie -nostartfiles -nostdlib  $ENV{PS4SDK}/crt0.s " CACHE STRING "")

link_directories("$ENV{PS4SDK}/lib")

set(TOOLCHAIN_PS4SDK_LIBS)
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS Ps4_extension_kernel_execute_dynlib_prepare_dlclose Ps4_extension_kernel_call_standard)
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS Ps4_common_kernel Ps4_common_user Ps4_common_generic)
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS Ps4_common_generic)
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS Ps4LibCInternalAdaptive_stub Ps4LibKernelAdaptive_stub)
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS SceLibcInternal_stub kernel_stub)
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS ps4Kernel_stub)
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS Ps4_base_stub_resolve_minimal)
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS Ps4_base_kernel_dlsym_standard Ps4_base_kernel_seek_elf_address_standard)
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS Ps4_base_assembler_register_parameter_standard)
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS Ps4_base_assembler_system_call_rop_0x93a4FFFF8)


# this is a work around to avoid duplicate library warning,
# as the toolchain file can be proccessed multiple times
# people over cmake IRC suggest I move this to a find module
if(NOT TARGET PS4::LIBS)
    add_library(PS4LIBS INTERFACE)
    add_library(PS4::LIBS ALIAS PS4LIBS)
    target_link_libraries(PS4LIBS INTERFACE ${TOOLCHAIN_PS4SDK_LIBS})
endif()

if(NOT TARGET PS4::HEADERS)
    add_library(PS4HEADERS INTERFACE)
    add_library(PS4::HEADERS ALIAS PS4HEADERS)
    target_include_directories(PS4HEADERS INTERFACE "$ENV{PS4SDK}/include/c++/v1/" "$ENV{PS4SDK}/include/" "$ENV{PS4SDK}/include/sce/" "$ENV{PS4SDK}/include/ps4/")
    include_directories(SYSTEM "$ENV{PS4SDK}/include/c++/v1/" "$ENV{PS4SDK}/include/" "$ENV{PS4SDK}/include/sce/" "$ENV{PS4SDK}/include/ps4/")
endif()
To quote from Zer0xFF's Blog for beginner cmake users: PS4 CMake toolchain
  • requisites
    • Linux based OS e.g Ubuntu
      • you can also use OSX but then you must build clang from source (instructions from bigboss, Note: my setup is slightly different and if you dont know what your doing, I recommand you wait for my blog post)
    • clang compiler (on Ubuntu the default one would most likely work, however as i stated earlier I tend to build mine from source)
    • Hito's PS4SDK (maybe a blog post on how to set it up?) with your enviromental variable PS4SDK pointing to it
  • download PS4-CMake-Toolchain
    • edit lines 10 & 11 and remove /usr
    • optional: save the toolchain to $PS4SDK/cmake/PS4.toolchain.cmake
  • create a new folder for your app e.g PS4Test
  • inside PS4Test folder create these new folders and call them source, include & build
  • inside source create main.c which will contain your code
  • go back to your root project directory PS4Test and create a file called CMakeLists.txt
Code:
cmake_minimum_required(VERSION 3.0.0)
project(PS4Test)

set(src
   ./source/main.c
)

# optional: we dont currently any headers
# and even if we did, we dont have to add them, but I prefer to do so, more on that at the bottom of this post
set(headers
   ./include/main.h
)

add_executable(PS4App ${src} ${headers})
target_link_libraries(PS4App PS4::LIBS PS4::HEADERS)
  • go back to PS4Test open build
  • inside build run the following command cmake -DCMAKE_TOOLCHAIN_FILE=/location/to/PS4.toolchain.cmake ..
  • the .. refers to the location of CMakeLists.txt
  • run cmake --build . to start the build
  • congradulation, you just compiled your 1st app with cmake
On ubuntu I use Qt Creator to work with CMake projects as it's able to parse CMakeLists.txt, Qt Creator is actually now smart enough to be able to auto detect your headers and display them on the side navigation view, but it wasn't before, as such you had to include the headers as part of your build, now you don't but as a personal now, I still do it.

And from the libPS4freetype2 README.md file, to quote: libPS4freetype2 is a C & C++ wrapper around standard upstream freetype2

you might be asking, why not use PS4 builtin library? well, (1) there are few reasons, i dont actually have a hackable PS4 Console, (2) that would require some Reverse Engineering and (3) I've been working on getting CMake setup for PS4 projects and wanted to test it on non-PS4 cmake make projects and it worked a treat in this very case (more about CMake later).

How-To CMake
  • to use this library, just add it as subdirectory in cmake add_subdirectory
  • link your app with library PS4freetype2 will automatically include headers directory
  • include one of the following headers C PS4freetype2.h or C++: PS4freetype2.hpp in your project
  • build your cmake project or this project with -DCMAKE_TOOLCHAIN_FILE=$PS4SDK/cmake/PS4.toolchain.cmake argument to set the correct build flags for PS4
Methods Documantation
  • C Methods
    • int initPS4FreeType(int height, int width, DrawText drawText);
    • void finishPS4FreeType();
    • void drawPS4FreeTypeText(int x, int y, const char *text, int size, int color);
    • int addFontPS4FreeType(char* filename);
    • void drawCustomFontPS4FreeTypeText(int x, int y, const char *text, int size, int color, int index);
  • C++ Methods
    • PS4freetype2(int height, int width, DrawText); Constructor
    • void drawText(int x, int y, const char *text, int size, int color);
    • void drawCustomFontText(int x, int y, const char *text, int size, int color, int font_index);
    • int addFont(char* filename);
How-To Methods
  • if you're calling these methods through C
  • initPS4FreeType() should be called 1st, height/width is the screen height/width, whole DrawText is a pointer to the draw method provided by your app that takes 3 paramaters int x, int y, int color e.g orbis2dDrawPixelColor()
  • drawPS4FreeTypeText() is self explaintory, x/y are screen positions, size is point per 30 ppi, color is in the format your draw method takes
  • addFontPS4FreeType() takes path location to otf or ttf font, on success return font_index > 0, on fail returns -1
  • drawCustomFontPS4FreeTypeText() works the same as drawPS4FreeTypeText() except the method requires font_index as provided by addFontPS4FreeType()
  • C++ methods work exactly the same, as they're merely wrappers for convience
    • PS4freetype2() the constructor takes place instead of initPS4FreeType()
    • there is no equivalent to finishPS4FreeType(), as it will be called automatically on deconstructor
Note
  • The font will look a bit fuzzy, that's most likely because we dont currently have a way to print pixels with alpha support, as such that channel is completely ignored
  • once we find a different way, I'm likely to update the DrawText method to pass on the Alpha value
Bugs
  • currently the the free'ing method in finishPS4FreeType() crashes on free(face), so it's been commented out, not sure if there is something wrong, or a misunderstanding on my part
  • the C++ wrapper has not been tested, but it's assumed to work, since it's a mere wrapper
Credit
  • Thanks to ZeraTron & Fx0day for testing for me (as I dont have a hackable PS4)
And some more Tweets warming up the PlayStation Twitter scene today:

From @xxmcvapourxx: L1L1R1R1L2L2R2R2 secret combo for ps4 psn first one who finds this I will release the whole file
Download: ps4sdk-405.zip / GIT
 

Comments

from discord : vapour - Aujourd'hui à 02:44 @vinnibea3 it's not a joke
Code:
i.prototype.lookForSecretButtonCombo = function(a) { var b = "L1L1R1R1L2L2R2R2"; if (this.keyCache || (this.keyCache = ""), "L1" === a || "R1" === a || "L2" === a || "R2" === a) { if (this.keyCache += a, this.keyCache.length >= b.length) { var c = this.keyCache.indexOf(b); c >= 0 ? (g.actions.welcomeMat.setWelcomeTourEngagement(!1), this.keyCache = "") : this.keyCache.length > 32 && (this.keyCache = "")
This is what sony has left in there stupid servers
 
Status
Not open for further replies.
Back
Top