reformat remaining files
This commit is contained in:
+9
-15
@@ -159,8 +159,7 @@ public:
|
||||
};
|
||||
|
||||
struct KeyFile {
|
||||
// initial_keys are actually a stream of uint32_ts, but we treat them as
|
||||
// bytes for code simplicity
|
||||
// initial_keys are actually a stream of uint32_ts, but we treat them as bytes for code simplicity
|
||||
union InitialKeys {
|
||||
uint8_t jsd1_stream_offset;
|
||||
parray<uint8_t, 0x48> as8;
|
||||
@@ -176,11 +175,9 @@ public:
|
||||
} __packed_ws__(PrivateKeys, 0x1000);
|
||||
InitialKeys initial_keys;
|
||||
PrivateKeys private_keys;
|
||||
// This field only really needs to be one byte, but annoyingly, some
|
||||
// compilers pad this structure to a longer alignment, presumably because
|
||||
// the unions above contain structures with 32-bit alignment. To prevent
|
||||
// this structure's size from not matching the .nsk files' sizes, we use
|
||||
// an unnecessarily large size for this field.
|
||||
// This field only really needs to be one byte, but annoyingly, some compilers pad this structure to a longer
|
||||
// alignment, presumably because the unions above contain structures with 32-bit alignment. To prevent this
|
||||
// structure's size from not matching the .nsk files' sizes, we use an unnecessarily large size for this field.
|
||||
le_uint64_t subtype;
|
||||
} __packed_ws__(KeyFile, 0x1050);
|
||||
|
||||
@@ -198,8 +195,8 @@ protected:
|
||||
void apply_seed(const void* original_seed, size_t seed_size);
|
||||
};
|
||||
|
||||
// The following classes provide support for automatically detecting which type
|
||||
// of encryption a client is using based on their initial response to the server
|
||||
// The following classes provide support for automatically detecting which type of encryption a client is using based
|
||||
// on their initial response to the server
|
||||
|
||||
class PSOV2OrV3DetectorEncryption : public PSOEncryption {
|
||||
public:
|
||||
@@ -234,9 +231,8 @@ protected:
|
||||
std::shared_ptr<PSOEncryption> active_crypt;
|
||||
};
|
||||
|
||||
// The following classes provide support for multiple PSOBB private keys, and
|
||||
// the ability to automatically detect which key the client is using based on
|
||||
// the first 8 bytes they send
|
||||
// The following classes provide support for multiple PSOBB private keys, and the ability to automatically detect which
|
||||
// key the client is using based on the first 8 bytes they send
|
||||
|
||||
class PSOBBMultiKeyDetectorEncryption : public PSOEncryption {
|
||||
public:
|
||||
@@ -397,9 +393,7 @@ DecryptedPR2 decrypt_pr2_data(const std::string& data) {
|
||||
throw std::runtime_error("not enough data for PR2 header");
|
||||
}
|
||||
phosg::StringReader r(data);
|
||||
DecryptedPR2 ret = {
|
||||
.compressed_data = data.substr(8),
|
||||
.decompressed_size = r.get<U32T<BE>>()};
|
||||
DecryptedPR2 ret = {.compressed_data = data.substr(8), .decompressed_size = r.get<U32T<BE>>()};
|
||||
PSOV2Encryption crypt(r.get<U32T<BE>>());
|
||||
if (BE) {
|
||||
crypt.encrypt_big_endian(ret.compressed_data.data(), ret.compressed_data.size());
|
||||
|
||||
Reference in New Issue
Block a user