mirror of
https://github.com/Vita3K/psvpfsparser.git
synced 2024-11-26 23:20:27 +00:00
implement zrif2rif
This commit is contained in:
parent
5843816ed7
commit
66f9f70661
@ -46,6 +46,7 @@ FILE (GLOB HEADER_FILES "../FilesDbParser.h"
|
||||
"../PfsFilesystem.h"
|
||||
"../PfsFile.h"
|
||||
"../rif2zrif.h"
|
||||
"../zrif2rif.h"
|
||||
)
|
||||
source_group ("Header Files" FILES ${HEADER_FILES})
|
||||
|
||||
@ -74,6 +75,7 @@ FILE (GLOB SOURCE_FILES "../FilesDbParser.cpp"
|
||||
"../PfsFilesystem.cpp"
|
||||
"../PfsFile.cpp"
|
||||
"../rif2zrif.cpp"
|
||||
"../zrif2rif.cpp"
|
||||
)
|
||||
source_group ("Source Files" FILES ${SOURCE_FILES})
|
||||
|
||||
|
22
zrif2rif.cpp
Normal file
22
zrif2rif.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include <b64/cdecode.h>
|
||||
#include <zRIF/keyflate.h>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
void zrif2rif(const std::string &zrif, std::ofstream &outfile) {
|
||||
constexpr auto MAX_KEY_SIZE = 2048;
|
||||
constexpr auto MIN_KEY_SIZE = 512;
|
||||
|
||||
unsigned char out[MIN_KEY_SIZE];
|
||||
unsigned char license_data[MIN_KEY_SIZE];
|
||||
base64_decodestate state;
|
||||
base64_init_decodestate(&state);
|
||||
base64_decode_block(zrif.c_str(), zrif.size(), (char *)out, &state);
|
||||
inflateKey(out, MIN_KEY_SIZE, license_data, MIN_KEY_SIZE);
|
||||
|
||||
outfile.write((char *)license_data, sizeof(license_data));
|
||||
outfile.close();
|
||||
}
|
4
zrif2rif.h
Normal file
4
zrif2rif.h
Normal file
@ -0,0 +1,4 @@
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
void zrif2rif(const std::string &zrif, std::ofstream &outfile);
|
Loading…
Reference in New Issue
Block a user