Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added in check for titles or contents dir #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions source/guis/gui_cheats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static const std::vector<u8> dataTypeSizes = { 1, 1, 2, 2,
static const std::vector<s128> dataTypeMaxValues = { std::numeric_limits<u8>::max(), std::numeric_limits<s8>::max(), std::numeric_limits<u16>::max(), std::numeric_limits<s16>::max(), std::numeric_limits<u32>::max(), std::numeric_limits<s32>::max(), std::numeric_limits<u64>::max(), std::numeric_limits<s64>::max(), std::numeric_limits<s32>::max(), std::numeric_limits<s64>::max(), std::numeric_limits<u64>::max() };
static const std::vector<s128> dataTypeMinValues = { std::numeric_limits<u8>::min(), std::numeric_limits<s8>::min(), std::numeric_limits<u16>::min(), std::numeric_limits<s16>::min(), std::numeric_limits<u32>::min(), std::numeric_limits<s32>::min(), std::numeric_limits<u64>::min(), std::numeric_limits<s64>::min(), std::numeric_limits<s32>::min(), std::numeric_limits<s64>::min(), std::numeric_limits<u64>::min() };

static std::string titleNameStr, tidStr, pidStr, buildIDStr;
static std::string titleNameStr, tidStr, pidStr, buildIDStr, getRealCheatPath;

static u32 cheatListOffset = 0;

Expand Down Expand Up @@ -1418,17 +1418,27 @@ void GuiCheats::searchMemoryValuesTertiary(Debugger *debugger, searchType_t sear

static void _moveLonelyCheats(u8 *buildID, u64 titleID) {
std::stringstream lonelyCheatPath;
std::stringstream realCheatPath;

std::stringstream realCheatPath;
std::stringstream buildIDStr;


//lets check for titles or contents on atmosphere here :)
// ELY M.
if (std::filesystem::exists("atmosphere/contents")) {
getRealCheatPath = "/atmosphere/contents/";
} else {
getRealCheatPath = "/atmosphere/titles/";
}



for (u8 i = 0; i < 8; i++)
buildIDStr << std::nouppercase << std::hex << std::setfill('0') << std::setw(2) << (u16)buildID[i];

lonelyCheatPath << EDIZON_DIR "/cheats/" << buildIDStr.str() << ".txt";

if (access(lonelyCheatPath.str().c_str(), F_OK) == 0) {
realCheatPath << "/atmosphere/contents/" << std::uppercase << std::hex << std::setfill('0') << std::setw(sizeof(u64) * 2) << titleID;
realCheatPath << getRealCheatPath << std::uppercase << std::hex << std::setfill('0') << std::setw(sizeof(u64) * 2) << titleID;
mkdir(realCheatPath.str().c_str(), 0777);
realCheatPath << "/cheats/";
mkdir(realCheatPath.str().c_str(), 0777);
Expand All @@ -1443,8 +1453,17 @@ static void _moveLonelyCheats(u8 *buildID, u64 titleID) {

static bool _wrongCheatsPresent(u8 *buildID, u64 titleID) {
std::stringstream ss;

ss << "/atmosphere/contents/" << std::uppercase << std::hex << std::setfill('0') << std::setw(sizeof(u64) * 2) << titleID << "/cheats/";


//lets check for titles or contents on atmosphere here :)
// ELY M.
if (std::filesystem::exists("atmosphere/contents")) {
getRealCheatPath = "/atmosphere/contents/";
} else {
getRealCheatPath = "/atmosphere/titles/";
}

ss << getRealCheatPath << std::uppercase << std::hex << std::setfill('0') << std::setw(sizeof(u64) * 2) << titleID << "/cheats/";

if (!std::filesystem::exists(ss.str()))
return false;
Expand Down
13 changes: 11 additions & 2 deletions source/update_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,17 @@ Updates UpdateManager::checkUpdate() {
}
}
}

for (auto p : std::filesystem::recursive_directory_iterator("/atmosphere/contents")) {

//lets check for titles or contents on atmosphere here :)
// ELY M.
std::string getamspath;
if (std::filesystem::exists("atmosphere/contents")) {
getamspath = "/atmosphere/contents/";
} else {
getamspath = "/atmosphere/titles/";
}

for (auto p : std::filesystem::recursive_directory_iterator(getamspath)) {
std::string currPath = p.path().c_str();
if (remote[currPath] == nullptr) {
if (!p.is_directory() && currPath.find("cheats") != std::string::npos) {
Expand Down