Skip to content

Commit

Permalink
ps3netsrv 20220421
Browse files Browse the repository at this point in the history
  • Loading branch information
jhonathanc committed Jul 6, 2022
1 parent b65081f commit 5181b2a
Show file tree
Hide file tree
Showing 16 changed files with 515 additions and 375 deletions.
15 changes: 13 additions & 2 deletions LICENSE.TXT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## License
### 2014-2020 webMAN MOD / ps3netsrv
### 2014-2022 webMAN MOD / ps3netsrv

webMAN MOD is a FREE software and all its components (ps3netsrv included) are
distributed and protected under GNU General Public License version 3 (GPL v3)
Expand All @@ -14,6 +14,17 @@ It is NOT permitted to distribute modified versions with the same name
of this software. A similar name or misleading name should NOT be used,
to avoid confusion about the origin or the version in use.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The names of the authors may not be used to endorse or promote products
derived from this software without specific prior written permission.

For futher information about GPL v3, refer to:
https://www.gnu.org/licenses/gpl-3.0.en.html

Expand All @@ -37,7 +48,7 @@ the software.



(C) 2010-2020 multiMAN / webMAN by DeanK
(C) 2010-2022 multiMAN / webMAN / sMAN / sLaunch / prepNTFS by DeanK

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ OS = windows
BUILD_TYPE = release_static

OUTPUT := ps3netsrv
OBJS = src/main.o src/padlock.o src/aes.o src/compat.o src/File.o src/VIsoFile.o
OBJS = src/main.o src/padlock.o src/aes.o src/compat.o src/mem.o src/File.o src/VIsoFile.o

CFLAGS = -Wall -Wno-format -I./include -std=gnu99 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DPOLARSSL
CPPFLAGS += -Wall -Wno-format -I./include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DPOLARSSL
Expand All @@ -15,7 +15,7 @@ CPPFLAGS += -Wall -Wno-format -I./include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_B

#CFLAGS += -DNOSSL
#CPPFLAGS +=-DNOSSL
#OBJS = src/main.o src/compat.o src/File.o src/VIsoFile.o
#OBJS = src/main.o src/compat.o src/mem.o src/File.o src/VIsoFile.o

LDFLAGS = -L.
LIBS = -lstdc++
Expand Down
4 changes: 2 additions & 2 deletions Makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ OS = linux
BUILD_TYPE = release_static

OUTPUT := ps3netsrv
OBJS = src/main.o src/padlock.o src/aes.o src/compat.o src/File.o src/VIsoFile.o
OBJS = src/main.o src/padlock.o src/aes.o src/compat.o src/mem.o src/File.o src/VIsoFile.o

CFLAGS = -Wall -I./include -std=gnu99 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DPOLARSSL
CPPFLAGS += -Wall -I./include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DPOLARSSL
Expand All @@ -12,7 +12,7 @@ CPPFLAGS += -Doff64_t=off_t

#CFLAGS += -DNOSSL
#CPPFLAGS +=-DNOSSL
#OBJS = src/main.o src/compat.o src/File.o src/VIsoFile.o
#OBJS = src/main.o src/compat.o src/mem.o src/File.o src/VIsoFile.o

LDFLAGS = -L.
LIBS = -lstdc++
Expand Down
4 changes: 2 additions & 2 deletions Makefile.macos
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ OS = macos
BUILD_TYPE = release

OUTPUT := ps3netsrv
OBJS = src/main.o src/padlock.o src/aes.o src/compat.o src/File.o src/VIsoFile.o
OBJS = src/main.o src/padlock.o src/aes.o src/compat.o src/mem.o src/File.o src/VIsoFile.o

CFLAGS = -Wall -I./include -std=gnu99 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DPOLARSSL
CPPFLAGS += -Wall -I./include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DPOLARSSL
Expand All @@ -12,7 +12,7 @@ CPPFLAGS += -Doff64_t=off_t

#CFLAGS += -DNOSSL
#CPPFLAGS +=-DNOSSL
#OBJS = src/main.o src/compat.o src/File.o src/VIsoFile.o
#OBJS = src/main.o src/compat.o src/mem.o src/File.o src/VIsoFile.o

LDFLAGS = -L.
LIBS = -lstdc++
Expand Down
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,38 @@ To build ps3netsrv using the bundled POLARSSL library instead of mbed TLS and wi

On Linux this will statically link ps3netsrv.

```
sudo apt-get update
sudo apt-get install make
sudo apt-get install g++
./Make.sh
```

## Docker Container
Docker Engine enables applications built in containers packages to run anywhere consistently on any infrastructure.

Docker container packages for ps3netsrv are available at:
https://hub.docker.com/search?q=ps3netsrv

## Other ports / forks
Docker container:
https://github.com/shawly/docker-ps3netsrv

Xcode (macOS / Linux / FreeBSD 10):
https://github.com/klahjn/ps3netsrvXCODE
https://github.com/klahjn/macOSPS3NetServerGUI

Java / Android:
https://github.com/jhonathanc/ps3netsrv-android

Google Go:
https://github.com/xakep666/ps3netsrv-go

ps3netsrv modified for encrypted (3k3y/redump) isos:
http://forum.redump.org/topic/14472

ps3netsrv modified for multiMAN:
http://deanbg.com/ps3netsrv.zip

Original ps3netsrv by Cobra for Linux / Windows:
https://github.com/Joonie86/Cobra-7.00/tree/master/446/PC/ps3netsrv
2 changes: 1 addition & 1 deletion include/File.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class File : public AbstractFile
file_t fp[64];
int64_t last_seek;
int8_t is_multipart;
int64_t part_size;
uint64_t part_size;
int8_t index;

public:
Expand Down
4 changes: 4 additions & 0 deletions include/VIsoFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,13 @@ class VIsoFile : public AbstractFile
off64_t padAreaStart;
off64_t padAreaSize;

file_t fd;
file_stat_t st;

char *lastPath;

void reset(void);
void fd_reset(void);

DirList *getParent(DirList *dirList);
bool isDirectChild(DirList *dir, DirList *parentCheck);
Expand Down
2 changes: 1 addition & 1 deletion include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#endif

#ifndef _OS_WINDOWS
#include <endian.h>
#include <sys/types.h>
#define __BIG_ENDIAN__ (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#endif
#if __BIG_ENDIAN__
Expand Down
2 changes: 2 additions & 0 deletions include/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ ssize_t write_file(file_t fd, void *buf, size_t nbyte);
int64_t seek_file(file_t fd, int64_t offset, int whence);
int fstat_file(file_t fd, file_stat_t *fs);
int stat_file(const char *path, file_stat_t *fs);
void _memset(void *m, size_t n);
void _memcpy(void *dst, void *src, size_t n);

#ifdef __cplusplus
}
Expand Down
18 changes: 18 additions & 0 deletions include/mem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef __MEM_H__
#define __MEM_H__

#include <stdlib.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

void _memset(void *m, size_t n);
void _memcpy(void *dst, void *src, size_t n);

#ifdef __cplusplus
}
#endif

#endif /* __MEM_H__ */
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ project('ps3netsrv', ['c', 'cpp'],

ps3netsrv_inc = include_directories('include')
ps3netsrv_src = files(
'src/mem.c',
'src/compat.c',
'src/File.cpp',
'src/main.cpp',
Expand Down
14 changes: 7 additions & 7 deletions src/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,16 +321,16 @@ ssize_t File::read(void *buf, size_t nbyte)

// read encrypted-3k3yredump-isos by NvrBst //
int64_t read_position = seek(0, SEEK_CUR);
ssize_t ret = read_file(fd, buf, nbyte);

add_last_seek(ret);

if (read_position < 0LL)
{
printf("ERROR: read > enc > seek: Returning decrypted data.\n");
return ret;
return FAILED;
}

ssize_t ret = read_file(fd, buf, nbyte);

add_last_seek(ret);

// If this is a 3k3y iso, and the 0xF70 data is being requests by ps3, we should null it out.
if ((enc_type_ == kDiscType3k3yDec) || (enc_type_ == kDiscType3k3yEnc))
{
Expand All @@ -339,7 +339,7 @@ ssize_t File::read(void *buf, size_t nbyte)
// Zero out the 0xF70 - 0x1070 overlap.
unsigned char *bufb = reinterpret_cast<unsigned char *>(buf);
unsigned char *buf_overlap_start = read_position < 0xF70LL ? bufb + 0xF70LL - read_position : bufb;
memset(buf_overlap_start, 0x00, read_position + ret < 0x1070LL ? ret - (buf_overlap_start - bufb) : 0x100 - (buf_overlap_start - bufb));
_memset(buf_overlap_start, read_position + ret < 0x1070LL ? ret - (buf_overlap_start - bufb) : 0x100 - (buf_overlap_start - bufb));
}

// If it's a dec image then return, else go on to the decryption logic.
Expand Down Expand Up @@ -437,7 +437,7 @@ int File::fstat(file_stat_t *fs)
return fstat_file(fd, fs);

// fstat multi part (2015 AV) - return sum of size of iso parts
int64_t size = 0;
uint64_t size = 0;
file_stat_t statbuf;

for(uint8_t i = 0; i < is_multipart; i++)
Expand Down
Loading

0 comments on commit 5181b2a

Please sign in to comment.