Skip to content

Commit

Permalink
Improved "view save details"
Browse files Browse the repository at this point in the history
  • Loading branch information
bucanero committed Sep 12, 2020
1 parent 19ef3f4 commit 6583d1f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
29 changes: 20 additions & 9 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,13 @@ code_entry_t* LoadSaveDetails()
char sfoPath[256];
code_entry_t* centry = calloc(1, sizeof(code_entry_t));

asprintf(&centry->name, selected_entry->title_id);

if (!(selected_entry->flags & SAVE_FLAG_PS3))
{
asprintf(&centry->codes, "%s\n\nTitle: %s\n", selected_entry->path, selected_entry->name);
return(centry);
}

snprintf(sfoPath, sizeof(sfoPath), "%s" "PARAM.SFO", selected_entry->path);
LOG("Save Details :: Reading %s...", sfoPath);
Expand All @@ -609,7 +614,6 @@ code_entry_t* LoadSaveDetails()
sfo_params_ids_t* param_ids = (sfo_params_ids_t*)(sfo_get_param_value(sfo, "PARAMS") + 0x1C);
param_ids->user_id = ES32(param_ids->user_id);

asprintf(&centry->name, selected_entry->title_id);
asprintf(&centry->codes, "%s\n\n"
"Title: %s\n"
"Sub-Title: %s\n"
Expand Down Expand Up @@ -962,17 +966,24 @@ void doOptionsMenu()
Draw_OptionsMenu();
}

void doPatchViewMenu()
int count_code_lines()
{
//Calc max
int max = 0;
const char * str;

for(str = selected_centry->codes; *str; ++str)
max += (*str == '\n');
//max += -((512 - (120*2))/18) + 1; //subtract the max per page

if (max <= 0)
max = 1;

return max;
}

void doPatchViewMenu()
{
int max = count_code_lines();

// Check the pads.
if (readPad(0))
Expand Down Expand Up @@ -1035,17 +1046,17 @@ void doCodeOptionsMenu()

void doSaveDetailsMenu()
{
int max = count_code_lines();

// Check the pads.
if (readPad(0))
{
if(paddata[0].BTN_UP)
{
move_selection_back(9, 1);
}
move_selection_back(max, 1);

else if(paddata[0].BTN_DOWN)
{
move_selection_fwd(9, 1);
}
move_selection_fwd(max, 1);

if (paddata[0].BTN_CIRCLE)
{
if (selected_centry->name)
Expand Down
9 changes: 5 additions & 4 deletions source/saves.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,10 @@ int set_psx_import_codes(save_entry_t* item)
{
int i = 0;

item->code_count = 1;
item->code_count = 2;
item->codes = (code_entry_t *)calloc(1, sizeof(code_entry_t) * (item->code_count));

_setManualCode(&item->codes[i++], PATCH_COMMAND, "\x07 View Save Details", CMD_VIEW_DETAILS);
_setManualCode(&item->codes[i], PATCH_COMMAND, "\x0b Convert to .PSV", 0);
item->codes[i].options_count = 1;
item->codes[i].options = _createOptions(2, "Save .PSV file to USB", CMD_CONVERT_TO_PSV);
Expand All @@ -452,8 +453,8 @@ int set_psv_codes(save_entry_t* item)
item->code_count = 2;
item->codes = (code_entry_t *)calloc(1, sizeof(code_entry_t) * (item->code_count));

_setManualCode(&item->codes[i++], PATCH_COMMAND, "\x06 Resign PSV", CMD_RESIGN_PSV);
_setManualCode(&item->codes[i++], PATCH_COMMAND, "\x07 View Save Details", CMD_VIEW_DETAILS);
_setManualCode(&item->codes[i++], PATCH_COMMAND, "\x06 Resign .PSV file", CMD_RESIGN_PSV);

return item->code_count;
}
Expand All @@ -465,6 +466,8 @@ int set_ps2_codes(save_entry_t* item)
item->code_count = 6;
item->codes = (code_entry_t *)calloc(1, sizeof(code_entry_t) * (item->code_count));

_setManualCode(&item->codes[i++], PATCH_COMMAND, "\x07 View Save Details", CMD_VIEW_DETAILS);

_setManualCode(&item->codes[i], PATCH_COMMAND, "\x0b Decrypt SCEVMC0.VME", 0);
asprintf(&item->codes[i].file, "SCEVMC0.VME");
item->codes[i].options_count = 1;
Expand Down Expand Up @@ -499,8 +502,6 @@ int set_ps2_codes(save_entry_t* item)
item->codes[i].options = _createOptions(2, "Copy APOLLO-99PS2.PSV to USB", CMD_COPY_DUMMY_PSV);
i++;

_setManualCode(&item->codes[i++], PATCH_COMMAND, "\x07 View Save Details", CMD_VIEW_DETAILS);

return item->code_count;
}

Expand Down

0 comments on commit 6583d1f

Please sign in to comment.