Compare commits

..

3 commits

3 changed files with 177 additions and 0 deletions

View file

@ -111,6 +111,8 @@ void Profile::refreshValues() {
getCarbonizedSkin();
getEngineUnlocks();
getOsUnlocks();
getArchUnlocks();
}
auto Profile::companyName() const -> std::string const& {
@ -1054,3 +1056,105 @@ void Profile::getEngineUnlocks() {
_lastError = "The profile save seems to be corrupted or the game didn't release the handle on the file.";
}
}
auto Profile::osInventory() -> Containers::ArrayView<Int> {
return _osInventory;
}
auto Profile::moduleInventory() -> Containers::ArrayView<Int> {
return _moduleInventory;
}
void Profile::getOsUnlocks() {
auto mmap = Utility::Directory::map(Utility::Directory::join(_profileDirectory, _filename));
auto iter = std::search(mmap.begin(), mmap.end(), &os_inventory_locator[0], &os_inventory_locator[29]);
if(iter != mmap.end()) {
Int* int_iter = reinterpret_cast<Int*>(iter + 0x37);
Int size = *(int_iter++);
if(size > 0) {
_osInventory = Containers::Array<Int>{DefaultInit, std::size_t(size)};
std::copy_n(int_iter, size, _osInventory.data());
Utility::Debug{} << "_osInventory:" << _osInventory;
iter = std::search(mmap.begin(), mmap.end(), &module_inventory_locator[0], &module_inventory_locator[33]);
if(iter == mmap.end()) {
return;
}
int_iter = reinterpret_cast<Int*>(iter + 0x3B);
size = *(int_iter++);
if(size <= 0) {
return;
}
_moduleInventory = Containers::Array<Int>{DefaultInit, std::size_t(size)};
std::copy_n(int_iter, size, _moduleInventory.data());
Utility::Debug{} << "_moduleInventory:" << _moduleInventory;
}
else {
_lastError = "An array can't have a null or negative size.";
Utility::Fatal{EXIT_FAILURE} << _lastError.c_str();
}
}
else {
_lastError = "The profile save seems to be corrupted or the game didn't release the handle on the file.";
}
}
auto Profile::archInventory() -> Containers::ArrayView<Int> {
return _archInventory;
}
auto Profile::techInventory() -> Containers::ArrayView<Int> {
return _techInventory;
}
void Profile::getArchUnlocks() {
auto mmap = Utility::Directory::map(Utility::Directory::join(_profileDirectory, _filename));
auto iter = std::search(mmap.begin(), mmap.end(), &arch_inventory_locator[0], &arch_inventory_locator[36]);
if(iter != mmap.end()) {
Int* int_iter = reinterpret_cast<Int*>(iter + 0x3E);
Int size = *(int_iter++);
if(size > 0) {
_archInventory = Containers::Array<Int>{DefaultInit, std::size_t(size)};
std::copy_n(int_iter, size, _archInventory.data());
Utility::Debug{} << "_archInventory:" << _archInventory;
iter = std::search(mmap.begin(), mmap.end(), &tech_inventory_locator[0], &tech_inventory_locator[31]);
if(iter == mmap.end()) {
return;
}
int_iter = reinterpret_cast<Int*>(iter + 0x39);
size = *(int_iter++);
if(size <= 0) {
return;
}
_techInventory = Containers::Array<Int>{DefaultInit, std::size_t(size)};
std::copy_n(int_iter, size, _techInventory.data());
Utility::Debug{} << "_techInventory:" << _techInventory;
}
else {
_lastError = "An array can't have a null or negative size.";
Utility::Fatal{EXIT_FAILURE} << _lastError.c_str();
}
}
else {
_lastError = "The profile save seems to be corrupted or the game didn't release the handle on the file.";
}
}

View file

@ -147,6 +147,14 @@ class Profile {
auto gearInventory() -> Containers::ArrayView<Int>;
void getEngineUnlocks();
auto osInventory() -> Containers::ArrayView<Int>;
auto moduleInventory() -> Containers::ArrayView<Int>;
void getOsUnlocks();
auto archInventory() -> Containers::ArrayView<Int>;
auto techInventory() -> Containers::ArrayView<Int>;
void getArchUnlocks();
private:
std::string _profileDirectory;
std::string _filename;

View file

@ -86,6 +86,71 @@ enum EngineIDs: Int {
enum OSIDs: Int {
// Tier 1
NeuralOS = 300010,
ExoSkelOS,
Shields1,
Enhancements1,
FuelSave1,
LongRange1,
// Tier 2
SparkOS,
ImprovedNeuralOS,
EnhancedSkeletonOS,
ExtendedArtsLibrary,
SustainableShield1,
Shields2,
SustainableRecharger1,
Enhancements2,
FuelSave2,
LongRange2,
EmpoweredArtsLibrary,
//Tier 3
BlazeOS,
NeurolinkOS,
PoweredGuardianOS,
SustainableShields2,
Shields3,
SustainableRecharger2,
Enhancements3,
FuelSave3,
LongRange3,
// Tier 4
IgnitionOS,
AlteredFuelOS,
MindlinkOS,
FramelinkOS,
SlayerOS,
SustainableShields3,
Shields4,
SustainableRecharger3,
Enhancements4,
FuelSave4,
LongRange4,
CellburnOS,
StorageShielder1,
Realignment1,
AlphaAssault1,
BetaAssault1,
// Tier 5
BrightburnOS,
OmniaOS,
FullConnectOS,
FullDiveOS,
SpartoiOS,
SustainableShields4,
Shields5,
SustainableRecharger5,
Enhancements5,
FuelSave5,
LongRange5,
FirestormOS,
StorageShielder2,
Realignment2,
AlphaAssault2,
BetaAssault2,
};
enum ArchIDs: Int {