Skip to content

Commit

Permalink
Fixed issues with new functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
efosamark committed Sep 4, 2024
1 parent b348ae6 commit 8aa7a46
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
11 changes: 11 additions & 0 deletions source/KipInfoOverlay.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class KipInfoOverlay : public tsl::Gui {
std::vector<std::string> kipInfoCommand;
bool showBackup, hasPages;
bool isFirstPage = true;
tsl::elm::List* p_list;

public:
KipInfoOverlay(const std::vector<std::string>& kipInfoCommand)
Expand Down Expand Up @@ -56,6 +57,7 @@ class KipInfoOverlay : public tsl::Gui {

auto rootFrame = new tsl::elm::OverlayFrame("Kip Management", "Uberhand Package", "", false, footer);
auto list = new tsl::elm::List();
p_list = list;

if (!showBackup) {
textDataPair = dispCustData(kipInfoCommand[isFirstPage ? 1 : 2]);
Expand All @@ -77,6 +79,15 @@ class KipInfoOverlay : public tsl::Gui {

virtual bool handleInput(u64 keysDown, u64 keysHeld, touchPosition touchInput, JoystickPosition leftJoyStick, JoystickPosition rightJoyStick) override
{
// process right stick scrolling
if ((keysHeld | keysDown) & (HidNpadButton_StickRDown)) {
this->p_list->handleInput(HidNpadButton_StickRDown, 0,{},{},{});
return true;
}
if ((keysHeld | keysDown) & (HidNpadButton_StickRUp)) {
this->p_list->handleInput(HidNpadButton_StickRUp, 0,{},{},{});
return true;
}
if (!isFirstPage && (keysDown & KEY_B)) {
tsl::goBack();
tsl::goBack();
Expand Down
18 changes: 15 additions & 3 deletions source/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,11 @@ std::pair<std::string, int> dispCustData(const std::string& jsonPath, const std:
} else {
extent = "";
}
if (j_ref) {
ref = json_string_value(j_ref);
} else {
ref = "";
}

if (offsetStr.find(',') != std::string::npos) {
std::istringstream iss(offsetStr);
Expand Down Expand Up @@ -898,17 +903,24 @@ std::pair<std::string, int> dispCustData(const std::string& jsonPath, const std:
if (!j_ref) {
currentHex = readHexDataAtOffsetF(file, offset, length); // Read the data from kip with offset starting from 'C' in 'CUST'
} else {
currentHex = findCurrentKip(preprocessPath(ref), std::to_string(offset), file, custOffset);
currentHex = findCurrentKip(ref, std::to_string(offset), file, custOffset);
if (currentHex == "\u25B6") {
currentHex = readHexDataAtOffsetF(file, offset, length); // Read the data from kip with offset starting from 'C' in 'CUST'
}
}
} else {
if (!j_ref) {
const size_t offset = custOffset + std::stoul(offsetStr);
currentHex = readHexDataAtOffsetF(file, offset, length); // Read the data from kip with offset starting from 'C' in 'CUST'
} else {
currentHex = findCurrentKip(preprocessPath(ref), offsetStr, file, custOffset);
currentHex = findCurrentKip(ref, offsetStr, file, custOffset);
if (currentHex == "\u25B6") {
const size_t offset = custOffset + std::stoul(offsetStr);
currentHex = readHexDataAtOffsetF(file, offset, length); // Read the data from kip with offset starting from 'C' in 'CUST'
}
}
}
if (!j_ref) {
if (ref != "") {
int intValue = reversedHexToInt(currentHex);
if (j_increment) { // Add increment value from the JSON to the displayed value
intValue += std::stoi(json_string_value(j_increment));
Expand Down

0 comments on commit 8aa7a46

Please sign in to comment.