Skip to content

Commit

Permalink
Renamed stack_access_mode to results_num.
Browse files Browse the repository at this point in the history
Renamed stack_access_mode to results_num.
  • Loading branch information
Rinnegatamante committed Sep 6, 2016
1 parent 5da57e9 commit caa55aa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions main.c
Expand Up @@ -213,9 +213,9 @@ int main_thread(SceSize args, void *argp) {
blit_set_color(0x00ffffff);

// Search menu results
if (menu_state == SEARCH_MENU && stack_access_mode != -2){
if (stack_access_mode == 0) blit_stringf(5, 225, "No matches");
else blit_stringf(5, 225, "Found %d matches", stack_access_mode);
if (menu_state == SEARCH_MENU && results_num != -2){
if (results_num == 0) blit_stringf(5, 225, "No matches");
else blit_stringf(5, 225, "Found %d matches", results_num);
}

// Functions
Expand Down Expand Up @@ -345,17 +345,17 @@ int main_thread(SceSize args, void *argp) {
int_state = DO_ABS_SEARCH_EXT;
break;
case 4:
if (stack_access_mode != -2){
if (results_num != -2){
int_state = DO_REL_SEARCH;
}
break;
case 5:
if (stack_access_mode != -2){
if (results_num != -2){
int_state = INJECT_STACK;
}
break;
case 6:
if (stack_access_mode != -2){
if (results_num != -2){
int_state = SAVE_OFFSETS;
}
break;
Expand Down Expand Up @@ -471,7 +471,7 @@ int main_thread(SceSize args, void *argp) {
case DO_ABS_SEARCH:

blit_stringf(5, 35, "Scanning stack, please wait");
stack_access_mode = scanStack(status.stack,status.stackSize,dval,search_type[search_id]);
results_num = scanStack(status.stack,status.stackSize,dval,search_type[search_id]);
int_state = MENU;
break;

Expand Down Expand Up @@ -546,8 +546,8 @@ int main_thread(SceSize args, void *argp) {
case DO_ABS_SEARCH_EXT:

blit_stringf(5, 35, "Scanning memory, please wait");
stack_access_mode = scanStack(status.stack,status.stackSize,dval,search_type[search_id]);
stack_access_mode += scanHeap(dval, search_type[search_id]);
results_num = scanStack(status.stack,status.stackSize,dval,search_type[search_id]);
results_num += scanHeap(dval, search_type[search_id]);
int_state = MENU;
break;
}
Expand Down
10 changes: 5 additions & 5 deletions memory.c
Expand Up @@ -23,7 +23,7 @@
#include <psp2/io/fcntl.h>
#include <psp2/io/stat.h>
#include "memory.h"
int stack_access_mode = -2;
int results_num = -2;
int ram_mode = 0;
static int results_fd = 0;

Expand Down Expand Up @@ -82,11 +82,11 @@ void scanResults(uint64_t val, int val_size){
uint32_t cur_val;
sceIoLseek(results_fd, 0x0, SEEK_SET);
int i = 0;
while (sceIoRead(results_fd, &cur_val, 4) > 0 && i < stack_access_mode){
while (sceIoRead(results_fd, &cur_val, 4) > 0 && i < results_num){
if (memcmp((uint8_t*)cur_val, &val, val_size) == 0){
sceIoWrite(fd, &cur_val, 4);
i++;
}else stack_access_mode--;
}else results_num--;
}
sceIoClose(fd);
sceIoClose(results_fd);
Expand All @@ -113,7 +113,7 @@ void injectMemory(uint64_t val, int val_size){
sceIoLseek(results_fd, 0x0, SEEK_SET);
uint32_t addr;
int i = 0;
while (sceIoRead(results_fd, &addr, 4) > 0 && i++ < stack_access_mode){
while (sceIoRead(results_fd, &addr, 4) > 0 && i++ < results_num){
injectValue((uint8_t*)addr,val,val_size);
}
}
Expand All @@ -124,7 +124,7 @@ void saveOffsets(char* filename){
uint32_t addr;
int fd = sceIoOpen(filename, SCE_O_CREAT|SCE_O_WRONLY|SCE_O_APPEND, 0777);
int i = 0;
while (sceIoRead(results_fd, &addr, 4) > 0 && i++ < stack_access_mode){
while (sceIoRead(results_fd, &addr, 4) > 0 && i++ < results_num){
char data[16];
sprintf(data, "0x%lX\n", addr);
sceIoWrite(fd, data, strlen(data));
Expand Down
2 changes: 1 addition & 1 deletion memory.h
Expand Up @@ -16,7 +16,7 @@
*
*/

extern int stack_access_mode;
extern int results_num;
extern int ram_mode;

void scanMemory(uint32_t* cur_matches, void* mem, uint32_t mem_size, uint64_t val, int val_size);
Expand Down

0 comments on commit caa55aa

Please sign in to comment.