Skip to content

Commit

Permalink
initial ps5-payload-sdk support
Browse files Browse the repository at this point in the history
  • Loading branch information
barisyild committed Oct 14, 2024
1 parent c97ab28 commit fb0fcae
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/hx/Date.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#endif
#if defined(__ORBIS__)
// fill in for a missing localtime_r with localtime_s
#define localtime_r localtime_s
#define gmtime_r gmtime_s
//#define localtime_r localtime_s
//#define gmtime_r gmtime_s
#endif
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/hx/libs/std/Process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# include <memory.h>
# include <errno.h>
# include <signal.h>
# if defined(ANDROID) || defined(BLACKBERRY) || defined(EMSCRIPTEN)
# if defined(ANDROID) || defined(BLACKBERRY) || defined(EMSCRIPTEN) || defined(__ORBIS__)
# include <sys/wait.h>
# elif !defined(NEKO_MAC)
# include <wait.h>
Expand Down
6 changes: 3 additions & 3 deletions src/hx/libs/std/Socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ int _hx_std_host_resolve( String host )
struct hostent *h = 0;
hx::strbuf hostBuf;

# if defined(NEKO_WINDOWS) || defined(NEKO_MAC) || defined(BLACKBERRY) || defined(EMSCRIPTEN)
# if defined(NEKO_WINDOWS) || defined(NEKO_MAC) || defined(BLACKBERRY) || defined(EMSCRIPTEN) || defined(__ORBIS__)
h = gethostbyname(host.utf8_str(&hostBuf));
# else
struct hostent hbase;
Expand Down Expand Up @@ -501,7 +501,7 @@ String _hx_std_host_reverse( int host )
struct hostent *h = 0;
unsigned int ip = host;
hx::EnterGCFreeZone();
#if defined(NEKO_WINDOWS) || defined(NEKO_MAC) || defined(ANDROID) || defined(BLACKBERRY) || defined(EMSCRIPTEN)
#if defined(NEKO_WINDOWS) || defined(NEKO_MAC) || defined(ANDROID) || defined(BLACKBERRY) || defined(EMSCRIPTEN) || defined(__ORBIS__)
h = gethostbyaddr((char *)&ip,4,AF_INET);
#else
struct hostent htmp;
Expand All @@ -522,7 +522,7 @@ String _hx_std_host_reverse_ipv6( Array<unsigned char> host )

struct hostent *h = 0;
hx::EnterGCFreeZone();
#if defined(NEKO_WINDOWS) || defined(NEKO_MAC) || defined(ANDROID) || defined(BLACKBERRY) || defined(EMSCRIPTEN)
#if defined(NEKO_WINDOWS) || defined(NEKO_MAC) || defined(ANDROID) || defined(BLACKBERRY) || defined(EMSCRIPTEN) || defined(__ORBIS__)
h = gethostbyaddr((char *)&host[0],16,AF_INET6);
#else
struct hostent htmp;
Expand Down
17 changes: 11 additions & 6 deletions src/hx/libs/std/Sys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
#include <sys/wait.h>
#endif

#ifdef __ORBIS__
#include <sys/wait.h>
#endif

#ifndef CLK_TCK
#define CLK_TCK 100
#endif
Expand Down Expand Up @@ -157,7 +161,7 @@ bool _hx_std_set_time_locale( String l )
return false;
#else

#ifdef NEKO_POSIX
#if defined(NEKO_POSIX) && !defined(__ORBIS__)
locale_t lc, old;
lc = newlocale(LC_TIME_MASK,l.utf8_str(),NULL);
if( !lc )
Expand Down Expand Up @@ -845,18 +849,19 @@ Array<String> _hx_std_sys_env()
#ifdef HX_ANDROID
#define tcsetattr(fd,opt,s) ioctl(fd,opt,s)
#define tcgetattr(fd,s) ioctl(fd,TCGETS,s)
#endif

static __inline__ void inline_cfmakeraw(struct termios *s)
{
#if defined(HX_ANDROID) || defined(__ORBIS__)
static __inline__ void inline_cfmakeraw(struct termios *s)
{
s->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
s->c_oflag &= ~OPOST;
s->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
s->c_cflag &= ~(CSIZE|PARENB);
s->c_cflag |= CS8;
}

#define cfmakeraw inline_cfmakeraw
}

#define cfmakeraw inline_cfmakeraw
#endif

/**
Expand Down
41 changes: 41 additions & 0 deletions toolchain/prospero-toolchain.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<xml>
<!-- PROSPERO TOOLS -->
<set name="CXX" value="${PS5_PAYLOAD_SDK}/bin/prospero-clang++" />
<set name="HXCPP_CPP11" value="1" unless="HXCPP_NO_CPP11" />

<include name="toolchain/gcc-toolchain.xml"/>

<compiler id="prospero" exe="${CXX}">
<exe name="${CXX}" if="CXX" />
<flag value="-c"/>
<cppflag value='-Wall' />
<cppflag value='-Werror' />
<cppflag value='-g' />
<cppflag value='-o' />
<flag value='-D__ORBIS__'/>
<!-- <flag value='-I.'/> -->
<flag value='-w'/>
<flag value="-Wno-overflow" />
<cppflag value="-Wno-invalid-offsetof" />
<!-- <flag value="-DHX_LINUX"/> -->
<flag value="-DHXCPP_MULTI_THREADED" if="HXCPP_MULTI_THREADED"/>
<flag value="-DHXCPP_BIG_ENDIAN" if="HXCPP_BIG_ENDIAN"/>
<flag value="-DHXCPP_THREAD_INFO_PTHREAD" />
<include name="toolchain/common-defines.xml" />
<flag value="-I${HXCPP}/include"/>
<objdir value="obj/prospero${OBJEXT}/"/>
<outflag value="-o"/>
<ext value=".o"/>
</compiler>

<linker id="exe" exe="/opt/ps5-payload-sdk/bin/prospero-lld">
<exe name="${CXX}" if="CXX" />
<fromfile value="" if="GCC_OLD" />
<flag value="-debug" if="debug"/>
<flag value="-lkernel" />
<flag value="-lkernel_sys" />
<lib name="-ldl"/>
<ext value=""/>
<outflag value="-o "/>
</linker>
</xml>

0 comments on commit fb0fcae

Please sign in to comment.