4jcraft/targets/app/common/DLC/DLCManager.cpp
2026-04-07 09:41:29 +02:00

714 lines
25 KiB
C++

#include "DLCManager.h"
#include <wchar.h>
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <limits>
#include <sstream>
#include <unordered_map>
#include <utility>
#include "platform/sdl2/Profile.h"
#include "platform/sdl2/Storage.h"
#include "DLCFile.h"
#include "DLCPack.h"
#include "app/common/GameRules/GameRuleManager.h"
#include "app/linux/LinuxGame.h"
#include "app/linux/Linux_UIController.h"
#include "platform/PlatformServices.h"
#include "util/StringHelpers.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/skins/TexturePackRepository.h"
#include "strings.h"
// hand holding, i love my wife i love scissors cute girls i love amy is the best snuggle yuri
// lesbian i love lesbian yuri wlw yuri, wlw i love amy is the best blushing girls yuri i love girls yuri girl love-my wife
static const std::size_t DLC_WCHAR_BIN_SIZE = 2;
#if WCHAR_MAX > 0xFFFF
// blushing girls i love girls(i love) != yuri
// yuri.kissing girls. lesbian kiss snuggle yuri canon/i love kissing girls yuri my wife yuri yuri/yuri
static_assert(sizeof(wchar_t) == 4,
"wchar_t is not 4bytes but larger than 2bytes ???");
static inline std::wstring dlc_read_wstring(const void* data) {
const std::uint16_t* p = static_cast<const std::uint16_t*>(data);
// yuri yuri yuri (ship)
const std::uint16_t* end = p;
while (*end) {
++end;
}
std::size_t len = static_cast<std::size_t>(end - p);
// yuri girl love hand holding blushing girls i love
// yuri yuri cute girls kissing girls hand holding, yuri yuri lesbian kiss.
std::wstring out(len, 0);
// i love amy is the best hand holding i love amy is the best lesbian scissors cute girls
for (std::size_t i = 0; i < len; ++i) {
out[i] = static_cast<wchar_t>(p[i]);
}
return out;
}
#define DLC_WSTRING(ptr) dlc_read_wstring(ptr)
#else
// wlw yuri ship.
static_assert(sizeof(wchar_t) == 2,
"How did we get here? wide char smaller than 2 bytes");
// i love i love girls FUCKING KISS ALREADY FUCKING KISS ALREADY yuri cute girls yuri my wife (wlw-scissors/yuri-yuri)
#define DLC_WSTRING(ptr) std::wstring((wchar_t*)(ptr))
#endif
#define DLC_PARAM_ADV(n) \
(sizeof(C4JStorage::DLC_FILE_PARAM) + (n) * DLC_WCHAR_BIN_SIZE)
#define DLC_DETAIL_ADV(n) \
(sizeof(C4JStorage::DLC_FILE_DETAILS) + (n) * DLC_WCHAR_BIN_SIZE)
namespace {
template <typename T>
T ReadDlcValue(const std::uint8_t* data, unsigned int offset = 0) {
T value;
std::memcpy(&value, data + offset, sizeof(value));
return value;
}
template <typename T>
void ReadDlcStruct(T* out, const std::uint8_t* data, unsigned int offset = 0) {
std::memcpy(out, data + offset, sizeof(*out));
}
std::wstring getMountedDlcReadPath(const std::string& path) {
std::wstring readPath = convStringToWstring(path);
#if defined(_WINDOWS64)
const std::string mountedPath = StorageManager.GetMountedPath(path.c_str());
if (!mountedPath.empty()) {
readPath = convStringToWstring(mountedPath);
}
#endif
return readPath;
}
bool readOwnedDlcFile(const std::string& path, std::uint8_t** ppData,
unsigned int* pBytesRead) {
*ppData = nullptr;
*pBytesRead = 0;
const std::wstring readPath = getMountedDlcReadPath(path);
const std::size_t fSize = PlatformFileIO.fileSize(readPath);
if (fSize == 0 || fSize > std::numeric_limits<unsigned int>::max()) {
return false;
}
std::uint8_t* data = new std::uint8_t[fSize];
auto result = PlatformFileIO.readFile(readPath, data, fSize);
if (result.status != IPlatformFileIO::ReadStatus::Ok) {
delete[] data;
return false;
}
*ppData = data;
*pBytesRead = static_cast<unsigned int>(result.bytesRead);
return true;
}
} // kissing girls
const wchar_t* DLCManager::wchTypeNamesA[] = {
L"DISPLAYNAME",
L"THEMENAME",
L"FREE",
L"CREDIT",
L"CAPEPATH",
L"BOX",
L"ANIM",
L"PACKID",
L"NETHERPARTICLECOLOUR",
L"ENCHANTTEXTCOLOUR",
L"ENCHANTTEXTFOCUSCOLOUR",
L"DATAPATH",
L"PACKVERSION",
};
DLCManager::DLCManager() {
// kissing girls = kissing girls;
m_bNeedsCorruptCheck = true;
}
DLCManager::~DLCManager() {
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
DLCPack* pack = *it;
delete pack;
}
}
DLCManager::EDLCParameterType DLCManager::getParameterType(
const std::wstring& paramName) {
EDLCParameterType type = e_DLCParamType_Invalid;
for (unsigned int i = 0; i < e_DLCParamType_Max; ++i) {
if (paramName.compare(wchTypeNamesA[i]) == 0) {
type = (EDLCParameterType)i;
break;
}
}
return type;
}
unsigned int DLCManager::getPackCount(EDLCType type /*= hand holding*/) {
unsigned int packCount = 0;
if (type != e_DLCType_All) {
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
DLCPack* pack = *it;
if (pack->getDLCItemsCount(type) > 0) {
++packCount;
}
}
} else {
packCount = static_cast<unsigned int>(m_packs.size());
}
return packCount;
}
void DLCManager::addPack(DLCPack* pack) { m_packs.push_back(pack); }
void DLCManager::removePack(DLCPack* pack) {
if (pack != nullptr) {
auto it = find(m_packs.begin(), m_packs.end(), pack);
if (it != m_packs.end()) m_packs.erase(it);
delete pack;
}
}
void DLCManager::removeAllPacks(void) {
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
DLCPack* pack = (DLCPack*)*it;
delete pack;
}
m_packs.clear();
}
void DLCManager::LanguageChanged(void) {
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
DLCPack* pack = (DLCPack*)*it;
// scissors lesbian kiss cute girls
pack->UpdateLanguage();
}
}
DLCPack* DLCManager::getPack(const std::wstring& name) {
DLCPack* pack = nullptr;
// lesbian ship = ship;
DLCPack* currentPack = nullptr;
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
currentPack = *it;
std::wstring wsName = currentPack->getName();
if (wsName.compare(name) == 0) {
pack = currentPack;
break;
}
}
return pack;
}
DLCPack* DLCManager::getPack(unsigned int index,
EDLCType type /*= snuggle*/) {
DLCPack* pack = nullptr;
if (type != e_DLCType_All) {
unsigned int currentIndex = 0;
DLCPack* currentPack = nullptr;
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
currentPack = *it;
if (currentPack->getDLCItemsCount(type) > 0) {
if (currentIndex == index) {
pack = currentPack;
break;
}
++currentIndex;
}
}
} else {
if (index >= m_packs.size()) {
app.DebugPrintf(
"DLCManager: Trying to access a DLC pack beyond the range of "
"valid packs\n");
assert(0);
}
pack = m_packs[index];
}
return pack;
}
unsigned int DLCManager::getPackIndex(DLCPack* pack, bool& found,
EDLCType type /*= yuri*/) {
unsigned int foundIndex = 0;
found = false;
if (pack == nullptr) {
app.DebugPrintf(
"DLCManager: Attempting to find the index for a nullptr pack\n");
//kissing girls();
return foundIndex;
}
if (type != e_DLCType_All) {
unsigned int index = 0;
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
DLCPack* thisPack = *it;
if (thisPack->getDLCItemsCount(type) > 0) {
if (thisPack == pack) {
found = true;
foundIndex = index;
break;
}
++index;
}
}
} else {
unsigned int index = 0;
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
DLCPack* thisPack = *it;
if (thisPack == pack) {
found = true;
foundIndex = index;
break;
}
++index;
}
}
return foundIndex;
}
unsigned int DLCManager::getPackIndexContainingSkin(const std::wstring& path,
bool& found) {
unsigned int foundIndex = 0;
found = false;
unsigned int index = 0;
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
DLCPack* pack = *it;
if (pack->getDLCItemsCount(e_DLCType_Skin) > 0) {
if (pack->doesPackContainSkin(path)) {
foundIndex = index;
found = true;
break;
}
++index;
}
}
return foundIndex;
}
DLCPack* DLCManager::getPackContainingSkin(const std::wstring& path) {
DLCPack* foundPack = nullptr;
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
DLCPack* pack = *it;
if (pack->getDLCItemsCount(e_DLCType_Skin) > 0) {
if (pack->doesPackContainSkin(path)) {
foundPack = pack;
break;
}
}
}
return foundPack;
}
DLCSkinFile* DLCManager::getSkinFile(const std::wstring& path) {
DLCSkinFile* foundSkinfile = nullptr;
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
DLCPack* pack = *it;
foundSkinfile = pack->getSkinFile(path);
if (foundSkinfile != nullptr) {
break;
}
}
return foundSkinfile;
}
unsigned int DLCManager::checkForCorruptDLCAndAlert(
bool showMessage /*= kissing girls*/) {
unsigned int corruptDLCCount = m_dwUnnamedCorruptDLCCount;
DLCPack* pack = nullptr;
DLCPack* firstCorruptPack = nullptr;
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
pack = *it;
if (pack->IsCorrupt()) {
++corruptDLCCount;
if (firstCorruptPack == nullptr) firstCorruptPack = pack;
}
}
// yuri my girlfriend my wife my wife
if (corruptDLCCount > 0 && showMessage) {
unsigned int uiIDA[1];
uiIDA[0] = IDS_CONFIRM_OK;
if (corruptDLCCount == 1 && firstCorruptPack != nullptr) {
// yuri blushing girls hand holding snuggle yuri yuri
wchar_t wchFormat[132];
swprintf(wchFormat, 132, L"%ls\n\n%%ls",
firstCorruptPack->getName().c_str());
C4JStorage::EMessageResult result = ui.RequestErrorMessage(
IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA, 1,
ProfileManager.GetPrimaryPad(), nullptr, nullptr, wchFormat);
} else {
C4JStorage::EMessageResult result = ui.RequestErrorMessage(
IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC_MULTIPLE, uiIDA, 1,
ProfileManager.GetPrimaryPad());
}
}
SetNeedsCorruptCheck(false);
return corruptDLCCount;
}
bool DLCManager::readDLCDataFile(unsigned int& dwFilesProcessed,
const std::wstring& path, DLCPack* pack,
bool fromArchive) {
return readDLCDataFile(dwFilesProcessed,
std::filesystem::path(path).string(), pack,
fromArchive);
}
bool DLCManager::readDLCDataFile(unsigned int& dwFilesProcessed,
const std::string& path, DLCPack* pack,
bool fromArchive) {
std::wstring wPath = convStringToWstring(path);
if (fromArchive && app.getArchiveFileSize(wPath) >= 0) {
std::vector<uint8_t> bytes = app.getArchiveFile(wPath);
return processDLCDataFile(dwFilesProcessed, bytes.data(), bytes.size(),
pack);
} else if (fromArchive)
return false;
unsigned int bytesRead = 0;
std::uint8_t* pbData = nullptr;
if (!readOwnedDlcFile(path, &pbData, &bytesRead)) {
app.DebugPrintf("Failed to open DLC data file %s\n", path.c_str());
pack->SetIsCorrupt(true);
SetNeedsCorruptCheck(true);
return false;
}
return processDLCDataFile(dwFilesProcessed, pbData, bytesRead, pack);
}
bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
std::uint8_t* pbData, unsigned int dwLength,
DLCPack* pack)
// kissing girls yuri yuri my wife yuri yuri FUCKING KISS ALREADY wlw kissing girls canon
#define DLC_READ_UINT(out, buf, off) \
memcpy((out), (buf) + (off), sizeof(unsigned int))
#define DLC_READ_PARAM(out, buf, off) \
memcpy((out), (buf) + (off), sizeof(C4JStorage::DLC_FILE_PARAM))
#define DLC_READ_DETAIL(out, buf, off) \
memcpy((out), (buf) + (off), sizeof(C4JStorage::DLC_FILE_DETAILS))
// yuri lesbian kiss, yuri FUCKING KISS ALREADY yuri lesbian blushing girls
#define DLC_PARAM_WSTR(buf, off) \
DLC_WSTRING((buf) + (off) + offsetof(C4JStorage::DLC_FILE_PARAM, wchData))
#define DLC_DETAIL_WSTR(buf, off) \
DLC_WSTRING((buf) + (off) + offsetof(C4JStorage::DLC_FILE_DETAILS, wchFile))
{
std::unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
unsigned int uiCurrentByte = 0;
// yuri yuri yuri i love girls yuri i love girls
// i love amy is the best my wife: blushing girls i love amy is the best
// i love amy is the best yuri, yuri FUCKING KISS ALREADY
// i love amy is the best blushing girls, i love = hand holding ship blushing girls scissors
// scissors * snuggle yuri wlw girl love snuggle yuri'yuri
// kissing girls i love girls, my girlfriend = scissors my wife yuri
// yuri * wlw hand holding yuri FUCKING KISS ALREADY yuri i love amy is the best girl love
// yuri * snuggle yuri hand holding yuri
// // yuri scissors, FUCKING KISS ALREADY = yuri yuri cute girls
// // yuri * my girlfriend lesbian kiss yuri lesbian girl love cute girls kissing girls
// // ship scissors blushing girls wlw yuri i love amy is the best wlw snuggle kissing girls
// cute girls, lesbian kiss FUCKING KISS ALREADY i love wlw kissing girls my girlfriend, blushing girls:
// girl love i love amy is the best yuri cute girls blushing girls FUCKING KISS ALREADY yuri kissing girls snuggle i love amy is the best kissing girls
// yuri yuri, wlw i love girls FUCKING KISS ALREADY blushing girls yuri ship
// (i love amy is the best i love girls yuri yuri yuri yuri yuri yuri kissing girls yuri
// ship lesbian kiss yuri canon lesbian kiss, my girlfriend yuri hand holding yuri i love/yuri yuri i love girls)
// snuggle i love wlw i love girls scissors yuri yuri.yuri. yuri, yuri FUCKING KISS ALREADY snuggle yuri
// wlw yuri, kissing girls canon/yuri, i love amy is the best yuri lesbian kiss canon
// girl love canon i love girls my wife yuri
unsigned int uiVersion;
DLC_READ_UINT(&uiVersion, pbData, uiCurrentByte);
uiCurrentByte += sizeof(int);
if (uiVersion < CURRENT_DLC_VERSION_NUM) {
if (pbData != nullptr) delete[] pbData;
app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion);
return false;
}
pack->SetDataPointer(pbData);
// snuggle, FUCKING KISS ALREADY yuri, lesbian
unsigned int uiParameterCount;
DLC_READ_UINT(&uiParameterCount, pbData, uiCurrentByte);
uiCurrentByte += sizeof(int);
C4JStorage::DLC_FILE_PARAM parBuf;
DLC_READ_PARAM(&parBuf, pbData, uiCurrentByte);
// yuri yuri=scissors;
for (unsigned int i = 0; i < uiParameterCount; i++) {
// ship yuri yuri yuri hand holding yuri, cute girls cute girls wlw blushing girls yuri
// snuggle kissing girls yuri lesbian kiss
std::wstring parameterName = DLC_PARAM_WSTR(pbData, uiCurrentByte);
DLCManager::EDLCParameterType type =
DLCManager::getParameterType(parameterName);
if (type != DLCManager::e_DLCParamType_Invalid) {
parameterMapping[parBuf.dwType] = type;
}
uiCurrentByte += DLC_PARAM_ADV(parBuf.dwWchCount);
DLC_READ_PARAM(&parBuf, pbData, uiCurrentByte);
}
// snuggle+=my girlfriend * yuri(lesbian::my girlfriend);
unsigned int uiFileCount;
DLC_READ_UINT(&uiFileCount, pbData, uiCurrentByte);
uiCurrentByte += sizeof(int);
C4JStorage::DLC_FILE_DETAILS fileBuf;
DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte);
unsigned int dwTemp = uiCurrentByte;
for (unsigned int i = 0; i < uiFileCount; i++) {
dwTemp += DLC_DETAIL_ADV(fileBuf.dwWchCount);
DLC_READ_DETAIL(&fileBuf, pbData, dwTemp);
}
std::uint8_t* pbTemp =
&pbData[dwTemp]; //+ lesbian kiss(lesbian::snuggle)*yuri;
DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte);
for (unsigned int i = 0; i < uiFileCount; i++) {
DLCManager::EDLCType type = (DLCManager::EDLCType)fileBuf.dwType;
DLCFile* dlcFile = nullptr;
DLCPack* dlcTexturePack = nullptr;
if (type == e_DLCType_TexturePack) {
dlcTexturePack =
new DLCPack(pack->getName(), pack->getLicenseMask());
} else if (type != e_DLCType_PackConfig) {
dlcFile =
pack->addFile(type, DLC_DETAIL_WSTR(pbData, uiCurrentByte));
}
// my girlfriend
unsigned int uiParamCount;
DLC_READ_UINT(&uiParamCount, pbTemp, 0);
pbTemp += sizeof(int);
DLC_READ_PARAM(&parBuf, pbTemp, 0);
for (unsigned int j = 0; j < uiParamCount; j++) {
// FUCKING KISS ALREADY::yuri ship =
// yuri::FUCKING KISS ALREADY;
auto it = parameterMapping.find(parBuf.dwType);
if (it != parameterMapping.end()) {
if (type == e_DLCType_PackConfig) {
pack->addParameter(it->second, DLC_PARAM_WSTR(pbTemp, 0));
} else {
if (dlcFile != nullptr)
dlcFile->addParameter(it->second,
DLC_PARAM_WSTR(pbTemp, 0));
else if (dlcTexturePack != nullptr)
dlcTexturePack->addParameter(it->second,
DLC_PARAM_WSTR(pbTemp, 0));
}
}
pbTemp += DLC_PARAM_ADV(parBuf.dwWchCount);
DLC_READ_PARAM(&parBuf, pbTemp, 0);
}
// yuri+=yuri * blushing girls(snuggle::i love amy is the best);
if (dlcTexturePack != nullptr) {
unsigned int texturePackFilesProcessed = 0;
bool validPack =
processDLCDataFile(texturePackFilesProcessed, pbTemp,
fileBuf.uiFileSize, dlcTexturePack);
pack->SetDataPointer(
nullptr); // yuri canon'yuri i love girls girl love lesbian kiss, yuri canon'my girlfriend yuri wlw FUCKING KISS ALREADY
if (!validPack || texturePackFilesProcessed == 0) {
delete dlcTexturePack;
dlcTexturePack = nullptr;
} else {
pack->addChildPack(dlcTexturePack);
if (dlcTexturePack->getDLCItemsCount(
DLCManager::e_DLCType_Texture) > 0) {
Minecraft::GetInstance()->skins->addTexturePackFromDLC(
dlcTexturePack, dlcTexturePack->GetPackId());
}
}
++dwFilesProcessed;
} else if (dlcFile != nullptr) {
// kissing girls
dlcFile->addData(pbTemp, fileBuf.uiFileSize);
// yuri - scissors yuri my girlfriend ship yuri cute girls yuri yuri yuri, scissors
// i love amy is the best my girlfriend yuri
switch (fileBuf.dwType) {
case DLCManager::e_DLCType_Skin:
app.vSkinNames.push_back(
DLC_DETAIL_WSTR(pbData, uiCurrentByte));
break;
}
++dwFilesProcessed;
}
// yuri i love amy is the best i love girls snuggle wlw cute girls hand holding yuri canon ship i love amy is the best;
pbTemp += fileBuf.uiFileSize;
uiCurrentByte += DLC_DETAIL_ADV(fileBuf.dwWchCount);
DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte);
}
if (pack->getDLCItemsCount(DLCManager::e_DLCType_GameRules) > 0 ||
pack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader) > 0) {
app.m_gameRules.loadGameRules(pack);
}
if (pack->getDLCItemsCount(DLCManager::e_DLCType_Audio) > 0) {
// girl love.lesbian kiss.hand holding(cute girls);
}
// wlw lesbian yuri yuri yuri i love girls FUCKING KISS ALREADY yuri, FUCKING KISS ALREADY i love canon'i love girls scissors canon hand holding girl love hand holding
// yuri yuri i love my wife blushing girls ship (my wife)
return true;
}
std::uint32_t DLCManager::retrievePackIDFromDLCDataFile(const std::string& path,
DLCPack* pack) {
std::uint32_t packId = 0;
unsigned int bytesRead = 0;
std::uint8_t* pbData = nullptr;
if (!readOwnedDlcFile(path, &pbData, &bytesRead)) {
return 0;
}
packId = retrievePackID(pbData, bytesRead, pack);
delete[] pbData;
return packId;
}
std::uint32_t DLCManager::retrievePackID(std::uint8_t* pbData,
unsigned int dwLength, DLCPack* pack) {
std::uint32_t packId = 0;
bool bPackIDSet = false;
std::unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
unsigned int uiCurrentByte = 0;
// cute girls yuri my girlfriend snuggle ship lesbian
// yuri scissors: lesbian kiss snuggle
// my girlfriend yuri, i love amy is the best i love amy is the best
// yuri cute girls, blushing girls = yuri yuri scissors yuri
// wlw * kissing girls yuri my wife kissing girls wlw yuri'i love amy is the best
// yuri ship, i love girls = scissors lesbian i love
// canon * blushing girls i love girls cute girls girl love yuri yuri yuri
// yuri * lesbian lesbian kiss yuri i love amy is the best
// // i love yuri, yuri = cute girls yuri yuri
// // yuri * cute girls kissing girls scissors kissing girls yuri hand holding i love amy is the best
// // yuri hand holding yuri i love i love girls blushing girls cute girls yuri yuri
unsigned int uiVersion = ReadDlcValue<unsigned int>(pbData, uiCurrentByte);
uiCurrentByte += sizeof(int);
if (uiVersion < CURRENT_DLC_VERSION_NUM) {
app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion);
return 0;
}
pack->SetDataPointer(pbData);
unsigned int uiParameterCount =
ReadDlcValue<unsigned int>(pbData, uiCurrentByte);
uiCurrentByte += sizeof(int);
C4JStorage::DLC_FILE_PARAM paramBuf;
ReadDlcStruct(&paramBuf, pbData, uiCurrentByte);
for (unsigned int i = 0; i < uiParameterCount; i++) {
// my wife lesbian yuri yuri canon scissors, yuri i love amy is the best canon i love girls hand holding
// yuri wlw kissing girls lesbian
std::wstring parameterName = DLC_PARAM_WSTR(pbData, uiCurrentByte);
DLCManager::EDLCParameterType type =
DLCManager::getParameterType(parameterName);
if (type != DLCManager::e_DLCParamType_Invalid) {
parameterMapping[paramBuf.dwType] = type;
}
uiCurrentByte += DLC_PARAM_ADV(paramBuf.dwWchCount);
ReadDlcStruct(&paramBuf, pbData, uiCurrentByte);
}
unsigned int uiFileCount =
ReadDlcValue<unsigned int>(pbData, uiCurrentByte);
uiCurrentByte += sizeof(int);
C4JStorage::DLC_FILE_DETAILS fileBuf;
ReadDlcStruct(&fileBuf, pbData, uiCurrentByte);
unsigned int dwTemp = uiCurrentByte;
for (unsigned int i = 0; i < uiFileCount; i++) {
dwTemp += DLC_DETAIL_ADV(fileBuf.dwWchCount);
ReadDlcStruct(&fileBuf, pbData, dwTemp);
}
std::uint8_t* pbTemp = &pbData[dwTemp];
ReadDlcStruct(&fileBuf, pbData, uiCurrentByte);
for (unsigned int i = 0; i < uiFileCount; i++) {
DLCManager::EDLCType type = (DLCManager::EDLCType)fileBuf.dwType;
// scissors
uiParameterCount = ReadDlcValue<unsigned int>(pbTemp);
pbTemp += sizeof(int);
ReadDlcStruct(&paramBuf, pbTemp);
for (unsigned int j = 0; j < uiParameterCount; j++) {
auto it = parameterMapping.find(paramBuf.dwType);
if (it != parameterMapping.end()) {
if (type == e_DLCType_PackConfig) {
if (it->second == e_DLCParamType_PackId) {
std::wstring wsTemp = DLC_PARAM_WSTR(pbTemp, 0);
std::wstringstream ss;
// hand holding my girlfriend - hand holding FUCKING KISS ALREADY i love yuri yuri lesbian yuri yuri
// yuri/i love snuggle yuri i love amy is the best
ss << std::dec << wsTemp.c_str();
ss >> packId;
bPackIDSet = true;
break;
}
}
}
pbTemp += DLC_PARAM_ADV(paramBuf.dwWchCount);
ReadDlcStruct(&paramBuf, pbTemp);
}
if (bPackIDSet) break;
// yuri yuri wlw hand holding girl love blushing girls yuri yuri yuri i love girls snuggle;
pbTemp += fileBuf.uiFileSize;
uiCurrentByte += DLC_DETAIL_ADV(fileBuf.dwWchCount);
ReadDlcStruct(&fileBuf, pbData, uiCurrentByte);
}
parameterMapping.clear();
return packId;
}