Skip to content

Commit

Permalink
ps3netsrv 20240210
Browse files Browse the repository at this point in the history
- Added command line option to build local ISO file from directory
- Added command line option to decrypt ISO (Rebug/3k3y encrypted) into new ISO
- New makeiso tool based on ps3netsrv
  • Loading branch information
aldostools committed Feb 10, 2024
1 parent dd0edb4 commit 96741a3
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 24 deletions.
4 changes: 4 additions & 0 deletions _Projects_/ps3netsrv/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ CPPFLAGS += -Wall -Wno-format -I./include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_B
#CFLAGS += -DOPT_FILE_SEEK
#CPPFLAGS += -DOPT_FILE_SEEK

#OUTPUT := makeiso
#CFLAGS += -DMAKEISO
#CPPFLAGS += -DMAKEISO

#CFLAGS += -DNOSSL
#CPPFLAGS +=-DNOSSL
#OBJS = src/main.o src/compat.o src/mem.o src/File.o src/VIsoFile.o
Expand Down
Binary file added _Projects_/ps3netsrv/bins/Windows/makeiso.exe
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/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ static void set_red_text(void)
#endif
}

#ifndef MAKEISO
static void set_gray_text(void)
{
#ifdef WIN32
Expand All @@ -56,5 +57,6 @@ static void set_gray_text(void)
printf("\033[1;30m");
#endif
}
#endif

#endif
20 changes: 12 additions & 8 deletions _Projects_/ps3netsrv/src/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "common.h"
#include "compat.h"

extern int make_iso;

static const int FAILED = -1;
static const int SUCCEEDED = 0;

Expand Down Expand Up @@ -98,15 +100,17 @@ int File::open(const char *path, int flags)
path_ps3iso_loc = strstr((char *)path, (char *)"ps3iso");

char *path_ext_loc = NULL;
if (path_ps3iso_loc)
if (path_ps3iso_loc || make_iso)
{
path_ext_loc = strstr((char *)(path + flen), (char *)".iso");
if (path_ext_loc == NULL)
path_ext_loc = strstr((char *)(path + flen), (char *)".ISO");
}

// Encryption only makes sense for .iso or .ISO files in the .../PS3ISO/ folder so exit quick if req is is not related.
if (is_multipart || (path_ps3iso_loc == NULL) || (path_ext_loc == NULL) || (path_ext_loc < path_ps3iso_loc))
if(make_iso)
;
else if (is_multipart || (path_ps3iso_loc == NULL) || (path_ext_loc == NULL) || (path_ext_loc < path_ps3iso_loc))
{
// Clean-up old region_info_ (even-though it shouldn't be needed).
if (region_info_ != NULL)
Expand Down Expand Up @@ -161,20 +165,20 @@ int File::open(const char *path, int flags)
key_path[path_ext_loc - path + 4] = 'y';
key_path[path_ext_loc - path + 5] = '\0';

key_fd = open_file(key_path, flags);
key_fd = open_file(key_path, O_RDONLY);

if (!FD_OK(key_fd))
if (!FD_OK(key_fd) && (path_ext_loc > path))
{
// Check for redump encrypted mode by looking for the ".key" is the same path of the ".iso".
key_path[path_ext_loc - path + 1] = 'k';
key_path[path_ext_loc - path + 2] = 'e';
key_path[path_ext_loc - path + 3] = 'y';
key_path[path_ext_loc - path + 4] = '\0';

key_fd = open_file(key_path, flags);
key_fd = open_file(key_path, O_RDONLY);
}

if (!FD_OK(key_fd))
if (!FD_OK(key_fd) && (path_ps3iso_loc > path))
{
// Check for redump encrypted mode by looking for the ".key" or ".dkey" file in the "REDKEY" folder.
key_path[path_ps3iso_loc - path + 0] = 'R';
Expand All @@ -184,7 +188,7 @@ int File::open(const char *path, int flags)
key_path[path_ps3iso_loc - path + 4] = 'E';
key_path[path_ps3iso_loc - path + 5] = 'Y';

key_fd = open_file(key_path, flags);
key_fd = open_file(key_path, O_RDONLY);

if (!FD_OK(key_fd))
{
Expand All @@ -195,7 +199,7 @@ int File::open(const char *path, int flags)
key_path[path_ext_loc - path + 4] = 'y';
key_path[path_ext_loc - path + 5] = '\0';

key_fd = open_file(key_path, flags);
key_fd = open_file(key_path, O_RDONLY);
}
}

Expand Down
Loading

0 comments on commit 96741a3

Please sign in to comment.