Skip to content

Commit

Permalink
Add ps3 to configure.ac.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolf3s committed Aug 13, 2024
1 parent fdfbc15 commit 847a65a
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 327 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,19 @@ jobs:
id: slug
run: |
echo "sha_name=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV
# using pre-compiled sdk
- name: Download PSL1GHT Toolchain
run: |
curl -sL https://github.com/bucanero/ps3toolchain/releases/download/ubuntu-latest-fad3b5fb/ps3dev-ubuntu-latest-2020-08-31.tar.gz | tar xvz -C ./
echo "PS3DEV=${GITHUB_WORKSPACE}/ps3dev" >> $GITHUB_ENV
echo "PSL1GHT=${GITHUB_WORKSPACE}/ps3dev" >> $GITHUB_ENV
echo "PSL1GHT=${GITHUB_WORKSPACE}/ps3dev" >> $GITHUB_ENV
- name: build libsmb2
run: |
cd lib
make -f Makefile.PS3_PPU clean
make -f Makefile.PS3_PPU
sh ./bootstrap AR="ppu-ar" CC="ppu-gcc" CFLAGS="-O2 -Wall" RANLIB="ppu-ranlib"
sh ./configure --prefix="${PS3DEV}/host/ppu" --host=powerpc64-ps3-elf --includedir="${PORTLIBS}/include" --libdir="${PORTLIBS}/lib" CFLAGS="-DPS3_PPU_PLATFORM -DNEED_READV -DNEED_WRITEV -DNEED_GETLOGIN_R -DBUCANERO_PS3SDK -DNEED_SRANDOM -DNEED_GETADDRINFO -DNEED_FREEADDRINFO -O2 -Wall -fno-strict-aliasing -I${PSL1GHT}/ppu/include -I${PORTLIBS}/include -L${PSL1GHT}/ppu/lib" --enable-examples=no --without-libkrb5
make all clean
build-ps4:
name: PS4
Expand Down
8 changes: 8 additions & 0 deletions Makefile.platform
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ ps2_irx_all:
ps2_irx_install: ps2_irx_all
cmake --build build --target install

ps3_ppu_all:
sh ./bootstrap AR="ppu-ar" CC="ppu-gcc" CFLAGS="-O2 -Wall" RANLIB="ppu-ranlib"
sh ./configure --prefix="${PS3DEV}/host/ppu" --host=powerpc64-ps3-elf --includedir="${PSL1GHT}/ppu/include" --libdir="${PSL1GHT}/ppu/lib" CFLAGS="-DPS3_PPU_PLATFORM -DNEED_READV -DNEED_WRITEV -DNEED_GETLOGIN_R -DNEED_RANDOM -DNEED_SRANDOM -DNEED_GETADDRINFO -DNEED_FREEADDRINFO -O2 -Wall -fno-strict-aliasing -I${PSL1GHT}/ppu/include -L${PSL1GHT}/ppu/lib" --enable-examples=no --without-libkrb5
make all

ps3_ppu_install: ps3_ppu_all
make install

ps4_all:
cmake -S . -B build "-DCMAKE_TOOLCHAIN_FILE=/opt/pacbrew/ps4/openorbis/cmake/ps4.cmake" "-DCMAKE_INSTALL_PREFIX=/opt/pacbrew/ps4/openorbis/" "-DCMAKE_PREFIX_PATH=/opt/pacbrew/ps4/openorbis/"
cmake --build build
Expand Down
3 changes: 1 addition & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ To compile libsmb2 for the PS3 PPU, first install the PS3 toolchain and
PSL1GHT SDK and set it up.

Then to build libsmb2, run
$ cd lib
$ make -f Makefile.PS3_PPU install
$ make ps3_ppu_install -f Makefile.platform

The process will copy the resulting libsmb2.a and the include/smb2 headers to your
PSL1GHT SDK portlibs folder.
Expand Down
139 changes: 0 additions & 139 deletions include/ps3/config.h

This file was deleted.

100 changes: 0 additions & 100 deletions lib/Makefile.PS3_PPU

This file was deleted.

21 changes: 21 additions & 0 deletions lib/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,13 +538,34 @@ ssize_t readv(t_socket fd, const struct iovec *iov, int iovcnt);

#ifdef PS3_PPU_PLATFORM

/* FOR OLD PS3SDK. */
#ifndef FD_SETSIZE
#define FD_SETSIZE 1024
#endif

# ifndef NBBY
# define NBBY 8 /* number of bits in a byte */
# endif

# ifndef NFDBITS
typedef long fd_mask;
# define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */
# endif

# ifndef howmany
# define howmany(x,y) (((x)+((y)-1))/(y))
# endif

#include <sys/time.h>
#include <netdb.h>
#include <net/poll.h>

int getlogin_r(char *buf, size_t size);
void srandom(unsigned int seed);
#ifndef BUCANERO_PS3SDK
int random(void);
#endif

#define getaddrinfo smb2_getaddrinfo
#define freeaddrinfo smb2_freeaddrinfo

Expand Down
6 changes: 3 additions & 3 deletions lib/dcerpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ static int
dcerpc_decode_3264(struct dcerpc_context *ctx, struct dcerpc_pdu *pdu,
struct smb2_iovec *iov, int offset, void *ptr)
{
uint32_t u32 = 0;
uint32_t u32_val = 0;

if (offset < 0) {
return offset;
Expand All @@ -659,8 +659,8 @@ dcerpc_decode_3264(struct dcerpc_context *ctx, struct dcerpc_pdu *pdu,
dcerpc_get_uint64(ctx, iov, offset, ptr);
offset += 8;
} else {
dcerpc_get_uint32(ctx, iov, offset, &u32);
*(uint64_t *)ptr = u32;
dcerpc_get_uint32(ctx, iov, offset, &u32_val);
*(uint64_t *)ptr = u32_val;
offset += 4;
}
return offset;
Expand Down
Loading

0 comments on commit 847a65a

Please sign in to comment.