Skip to content

Commit

Permalink
ps3netsrv 20240709
Browse files Browse the repository at this point in the history
makeiso_rip creates ISO with PS3UPDAT.PUP truncated (saves 256MB per ISO)
  • Loading branch information
aldostools committed Jul 10, 2024
1 parent e492a28 commit 485bf43
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 9 deletions.
4 changes: 4 additions & 0 deletions _Projects_/ps3netsrv/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ CPPFLAGS += -Wall -Wno-format -I./include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_B
#CFLAGS += -DMAKEISO
#CPPFLAGS += -DMAKEISO

#CFLAGS += -DNO_UPDATE
#CPPFLAGS += -DNO_UPDATE
#OUTPUT := makeiso_rip

#CFLAGS += -DNOSSL
#CPPFLAGS +=-DNOSSL
#OBJS = src/main.o src/compat.o src/mem.o src/File.o src/VIsoFile.o
Expand Down
4 changes: 4 additions & 0 deletions _Projects_/ps3netsrv/Makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ CPPFLAGS += -Doff64_t=off_t
#CFLAGS += -DMAKEISO
#CPPFLAGS += -DMAKEISO

#CFLAGS += -DNO_UPDATE
#CPPFLAGS += -DNO_UPDATE
#OUTPUT := makeiso_rip

#CFLAGS += -DNOSSL
#CPPFLAGS +=-DNOSSL
#OBJS = src/main.o src/compat.o src/mem.o src/File.o src/VIsoFile.o
Expand Down
4 changes: 4 additions & 0 deletions _Projects_/ps3netsrv/Makefile.macos
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ CPPFLAGS += -Doff64_t=off_t
#CFLAGS += -DMAKEISO
#CPPFLAGS += -DMAKEISO

#CFLAGS += -DNO_UPDATE
#CPPFLAGS += -DNO_UPDATE
#OUTPUT := makeiso_rip

#CFLAGS += -DNOSSL
#CPPFLAGS +=-DNOSSL
#OBJS = src/main.o src/compat.o src/mem.o src/File.o src/VIsoFile.o
Expand Down
2 changes: 1 addition & 1 deletion _Projects_/ps3netsrv/bins/Linux/Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# ps3netsrv for Linux

Here is a RELEASE build of the latest ps3netsrv source code (build 20240707). Built on Ubuntu 22.04 LTS.
Here is a RELEASE build of the latest ps3netsrv source code (build 20240709). Built on Ubuntu 22.04 LTS.
Binary file modified _Projects_/ps3netsrv/bins/Linux/makeiso
Binary file not shown.
Binary file added _Projects_/ps3netsrv/bins/Linux/makeiso_rip
Binary file not shown.
Binary file modified _Projects_/ps3netsrv/bins/Linux/ps3netsrv_linuxX86_64
Binary file not shown.
Binary file modified _Projects_/ps3netsrv/bins/Windows/makeiso.exe
Binary file not shown.
Binary file not shown.
Binary file modified _Projects_/ps3netsrv/bins/Windows/ps3netsrv.exe
Binary file not shown.
2 changes: 2 additions & 0 deletions _Projects_/ps3netsrv/include/AbstractFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class AbstractFile
public:
virtual ~AbstractFile() {}

bool ps3Mode;

virtual int open(const char *path, int flags) = 0;
virtual int close(void) = 0;
virtual ssize_t read(void *buf, size_t nbyte) = 0;
Expand Down
2 changes: 2 additions & 0 deletions _Projects_/ps3netsrv/include/File.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class File : public AbstractFile
File();
virtual ~File();

bool ps3Mode;

virtual int open(const char *path, int flags);
virtual int close(void);
virtual ssize_t read(void *buf, size_t nbyte);
Expand Down
3 changes: 1 addition & 2 deletions _Projects_/ps3netsrv/include/VIsoFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ class VIsoFile : public AbstractFile
{
private:

bool ps3Mode;

off64_t vFilePtr;

uint8_t *fsBuf;
Expand Down Expand Up @@ -124,6 +122,7 @@ class VIsoFile : public AbstractFile
virtual ssize_t write(void *buf, size_t nbyte);
virtual int64_t seek(int64_t offset, int whence);
virtual int fstat(file_stat_t *fs);
bool ps3Mode;
};

#endif
Expand Down
2 changes: 2 additions & 0 deletions _Projects_/ps3netsrv/src/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ int File::open(const char *path, int flags)
else if(enc_type_ == kDiscType3k3yDec)
printf("3K3YDec key found.\n");

ps3Mode = (enc_type_ > kDiscTypeNone);

return SUCCEEDED;
#endif //#ifndef NOSSL
}
Expand Down
10 changes: 10 additions & 0 deletions _Projects_/ps3netsrv/src/compat.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <string.h>
#include "compat.h"
#include "mem.h"

Expand Down Expand Up @@ -306,6 +307,10 @@ int stat_file(const char *path, file_stat_t *fs)

fs->file_size = ((uint64_t)wfd.nFileSizeHigh << 32) | wfd.nFileSizeLow;

#ifdef NO_UPDATE
if(strstr(path, "/PS3UPDAT.PUP")) fs->file_size = 0;
#endif

fs->ctime = FileTimeToUnixTime(&wfd.ftCreationTime, NULL);
fs->atime = FileTimeToUnixTime(&wfd.ftLastAccessTime, NULL);
fs->mtime = FileTimeToUnixTime(&wfd.ftLastWriteTime, NULL);
Expand Down Expand Up @@ -403,6 +408,11 @@ int stat_file(const char *path, file_stat_t *fs)
return ret;

fs->file_size = st.st_size;

#ifdef NO_UPDATE
if(strstr(path, "/PS3UPDAT.PUP")) fs->file_size = 0;
#endif

fs->mtime = st.st_mtime;
fs->ctime = st.st_ctime;
fs->atime = st.st_atime;
Expand Down
17 changes: 11 additions & 6 deletions _Projects_/ps3netsrv/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,13 @@ static int create_iso(char *folder_path, char *fileout, int viso)
const uint32_t buf_size = 0x10000;
char *buffer = (char *)client.buf;
uint64_t offset = 0;
uint64_t rem_size = st.file_size % buf_size;
uint64_t iso_size = st.file_size - rem_size;
uint64_t file_size = st.file_size;
#ifdef NO_UPDATE
if(client.ro_file->ps3Mode && (viso == VISO_NONE) && (file_size > 268435456))
file_size -= 268435456; // truncate last 256 MB (PS3UPDAT.PUP) from encrypted ISO
#endif
uint64_t rem_size = file_size % buf_size;
uint64_t iso_size = file_size - rem_size;
uint16_t count = 0x100;
if(iso_size >= buf_size)
{
Expand All @@ -336,7 +341,7 @@ static int create_iso(char *folder_path, char *fileout, int viso)
client.ro_file->read(buffer, rem_size);
write_file(fd_out, buffer, rem_size);
}
printf("Dumped ISO: %llu bytes\n", (long long unsigned int)st.file_size);
printf("Dumped ISO: %llu bytes\n", (long long unsigned int)file_size);
}

close_file(fd_out);
Expand Down Expand Up @@ -1794,9 +1799,9 @@ int main(int argc, char *argv[])
// Show build number
set_white_text();
#ifndef MAKEISO
printf("ps3netsrv build 20240707");
printf("ps3netsrv build 20240709");
#else
printf("makeiso build 20240707");
printf("makeiso build 20240709");
#endif

set_red_text();
Expand Down Expand Up @@ -2116,7 +2121,7 @@ int main(int argc, char *argv[])
for(int i = 1; i < argc; i++)
{
file_stat_t st;
if(stat_file(argv[i], &st) < 0 || st.mode & S_IFDIR != S_IFDIR)
if(stat_file(argv[i], &st) < 0)
{
printf("Invalid path: %s\n", argv[i]);
continue;
Expand Down

0 comments on commit 485bf43

Please sign in to comment.