Skip to content

Commit

Permalink
Merge pull request #43 from berichan/master
Browse files Browse the repository at this point in the history
pointerRelative for offset relative to heap. Fix final jump sign corruption
  • Loading branch information
berichan authored Aug 29, 2021
2 parents a962bb0 + 0bcb7c7 commit 6a51b14
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions sys-botbase/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ int argmain(int argc, char **argv)
{
if(argc < 3)
return 0;
u64 finalJump = parseStringToSignedLong(argv[argc-1]);
s64 finalJump = parseStringToSignedLong(argv[argc-1]);
u64 count = argc - 2;
s64 jumps[count];
for (int i = 1; i < argc-1; i++)
Expand All @@ -452,14 +452,31 @@ int argmain(int argc, char **argv)
solved += finalJump;
printf("%016lX\n", solved);
}

// pointerRelative <first (main) jump> <additional jumps> <final jump in pointerexpr>
if (!strcmp(argv[0], "pointerRelative"))
{
if(argc < 3)
return 0;
s64 finalJump = parseStringToSignedLong(argv[argc-1]);
u64 count = argc - 2;
s64 jumps[count];
for (int i = 1; i < argc-1; i++)
jumps[i-1] = parseStringToSignedLong(argv[i]);
u64 solved = followMainPointer(jumps, count);
solved += finalJump;
MetaData meta = getMetaData();
solved -= meta.heap_base;
printf("%016lX\n", solved);
}

// pointerPeek <amount of bytes in hex or dec> <first (main) jump> <additional jumps> <final jump in pointerexpr>
if (!strcmp(argv[0], "pointerPeek"))
{
if(argc < 4)
return 0;

u64 finalJump = parseStringToSignedLong(argv[argc-1]);
s64 finalJump = parseStringToSignedLong(argv[argc-1]);
u64 size = parseStringToInt(argv[1]);
u64 count = argc - 3;
s64 jumps[count];
Expand All @@ -476,7 +493,7 @@ int argmain(int argc, char **argv)
if(argc < 4)
return 0;

u64 finalJump = parseStringToSignedLong(argv[argc-1]);
s64 finalJump = parseStringToSignedLong(argv[argc-1]);
u64 count = argc - 3;
s64 jumps[count];
for (int i = 2; i < argc-1; i++)
Expand Down Expand Up @@ -756,7 +773,7 @@ int main()
mutexInit(&clickMutex);
rc = threadCreate(&clickThread, sub_click, (void*)currentClick, NULL, THREAD_SIZE, 0x2C, -2);
if (R_SUCCEEDED(rc))
{rc = threadStart(&clickThread);} // curly brackets remove compiler warning
rc = threadStart(&clickThread);

flashLed();

Expand Down

0 comments on commit 6a51b14

Please sign in to comment.