Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ pkg2zip.exe
*.obj
*.pdb
*.zip
.direnv
result
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 75 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
description = "A Nix-flake-based C/C++ development environment";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};

outputs =
{ self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" ];
forEachSupportedSystem =
f:
nixpkgs.lib.genAttrs supportedSystems (
system:
f {
pkgs = import nixpkgs { inherit system; };
}
);
in
{
devShells = forEachSupportedSystem (
{ pkgs }:
{
default =
pkgs.mkShell.override
{
stdenv = pkgs.gccStdenv;
}
{
packages = with pkgs; [
python3
gcc
clang-tools
gdb
typos
pkg-config
];

};
}
);

packages = forEachSupportedSystem (
{ pkgs }:
{
default = pkgs.stdenv.mkDerivation {
pname = "pkg2zip";
version = "0.1";

src = ./.;

# nativeBuildInputs = [ pkgs.makeWrapper ]; # If you need wrappers
buildInputs = [ ]; # Add dependencies like pkgs.openssl if needed

buildPhase = ''
printenv
make
'';

installPhase = ''
mkdir -p $out/bin
cp ./pkg2zip $out/bin/
'';

meta = {
description = "Decrypts PlayStation Vita pkg file and packages to zip archive";
license = pkgs.lib.licenses.unlicense;
platforms = pkgs.lib.platforms.linux;
};
};
}
);
};
}
2 changes: 1 addition & 1 deletion pkg2zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ static void find_psp_sfo(const aes128_key* key, const aes128_key* ps3_key, const

static void find_pbp_sfo(const aes128_key* key, const aes128_key* ps3_key, const uint8_t* iv, sys_file pkg, uint64_t pkg_size, uint64_t enc_offset, uint64_t items_offset, uint32_t item_count, char* discid)
{
memset(discid, 0x00, 0x10);
memset(discid, 0x00, 0x0A);
for (uint32_t item_index = 0; item_index < item_count; item_index++)
{
uint8_t item[32];
Expand Down