Decompile 2 functions in Source/Archive/PakFile.cpp, Source/Archive/PakCipher.cpp, ...
Batch #13629 by eAthena: 2 byte-identical, 0 confirmed by peer review. - fn_04016 myGPack::CGPakRead::ReadEntry: byte-identical (already on main) - fn_18131 myGPack::CGPakRead::DerivePakKey: byte-identical Merged automatically: every function is byte-identical to the original.
This commit is contained in:
parent
452b06e94b
commit
f90aef2edf
4 changed files with 23 additions and 28 deletions
|
|
@ -30,6 +30,7 @@ namespace myGPack {
|
|||
public:
|
||||
bool ReadEntry(PakEntry* entry, void* buffer);
|
||||
void CollectNames(std::set<std::string>& names) const;
|
||||
std::uint8_t* DerivePakKey(const char* name, std::uint8_t* key);
|
||||
};
|
||||
|
||||
struct PakFreeBlock {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "Archive/PakCipher.h"
|
||||
|
||||
#include "Archive/GPakUpdate.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
|
|
@ -459,7 +461,7 @@ namespace myGPack {
|
|||
|
||||
// OFFSET: 0x00AEBC90
|
||||
// FUNCTION: fn_18131
|
||||
std::uint8_t* DerivePakKey(const char* name, std::uint8_t* key) {
|
||||
std::uint8_t* CGPakRead::DerivePakKey(const char* name, std::uint8_t* key) {
|
||||
const char* base = name;
|
||||
const std::size_t length = std::strlen(name);
|
||||
const char* const end = name + length;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ namespace myGPack {
|
|||
};
|
||||
|
||||
static_assert(sizeof(PakCipher) == 128);
|
||||
std::uint8_t* DerivePakKey(const char* name, std::uint8_t* key);
|
||||
int InitialPermutation(std::uint8_t* block);
|
||||
int FinalPermutation(std::uint8_t* block);
|
||||
int EncodeBlock(int rounds, const std::uint8_t (*roundKeys)[8], std::uint32_t inputLow, std::uint32_t inputHigh, std::uint8_t* output);
|
||||
|
|
|
|||
|
|
@ -53,34 +53,27 @@ namespace {
|
|||
|
||||
// INLINED
|
||||
int CountDigits(std::uint32_t value) {
|
||||
int digits;
|
||||
if (value >= 1000000000) {
|
||||
return 10;
|
||||
digits = 9;
|
||||
} else if (value >= 100000000) {
|
||||
digits = 8;
|
||||
} else if (value >= 10000000) {
|
||||
digits = 7;
|
||||
} else if (value >= 1000000) {
|
||||
digits = 6;
|
||||
} else if (value >= 100000) {
|
||||
digits = 5;
|
||||
} else if (value >= 10000) {
|
||||
digits = 4;
|
||||
} else if (value >= 1000) {
|
||||
digits = 3;
|
||||
} else if (value >= 100) {
|
||||
digits = 2;
|
||||
} else {
|
||||
digits = value >= 10;
|
||||
}
|
||||
if (value >= 100000000) {
|
||||
return 9;
|
||||
}
|
||||
if (value >= 10000000) {
|
||||
return 8;
|
||||
}
|
||||
if (value >= 1000000) {
|
||||
return 7;
|
||||
}
|
||||
if (value >= 100000) {
|
||||
return 6;
|
||||
}
|
||||
if (value >= 10000) {
|
||||
return 5;
|
||||
}
|
||||
if (value >= 1000) {
|
||||
return 4;
|
||||
}
|
||||
if (value >= 100) {
|
||||
return 3;
|
||||
}
|
||||
if (value >= 10) {
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
return digits + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue