Skip to content

Commit

Permalink
clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
bucanero committed Jun 11, 2024
1 parent 7047ba2 commit 28e47bb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 175 deletions.
2 changes: 0 additions & 2 deletions include/cheats.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ typedef struct
list_t* (*ReadList)(const char*);
} game_list_t;

list_t * ReadUsbList(const char* userPath);
list_t * ReadUserList(const char* userPath);
list_t * ReadOnlineList(const char* urlPath);
list_t * ReadBackupList(const char* userPath);
Expand Down Expand Up @@ -198,7 +197,6 @@ void execCodeCommand(code_entry_t* code, const char* codecmd);
uint64_t patch_hash_calc(const game_entry_t* game, const code_entry_t* code);
char* mc4_decrypt(const char* data);

int get_save_details(const game_entry_t *save, char** details);
int orbis_SaveUmount(const char* mountPath);
int orbis_UpdateSaveParams(const char* mountPath, const char* title, const char* subtitle, const char* details);

Expand Down
2 changes: 0 additions & 2 deletions include/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,9 @@ void drawEndLogo();

int load_app_settings(app_config_t* config);
int save_app_settings(app_config_t* config);
int reset_app_settings(app_config_t* config);

int initialize_jbc();
void terminate_jbc();
int patch_save_libraries();
void initMenuOptions();

#endif
168 changes: 0 additions & 168 deletions source/cheats.c
Original file line number Diff line number Diff line change
Expand Up @@ -1131,26 +1131,6 @@ list_t * ReadUserList(const char* userPath)

list = list_alloc();

/*
item = createGameEntry(CHEAT_FLAG_PS4, CHAR_ICON_COPY " Bulk Cheats Management");
item->type = FILE_TYPE_MENU;
item->codes = list_alloc();
item->path = strdup(userPath);
// item->path = (void*) list; //bulk management hack
cmd = _createCmdCode(PATCH_COMMAND, CHAR_ICON_SIGN " Resign & Unlock all Saves", CMD_RESIGN_ALL_SAVES);
list_append(item->codes, cmd);
cmd = _createCmdCode(PATCH_COMMAND, CHAR_ICON_COPY " Copy all Saves to USB", CMD_CODE_NULL);
cmd->options_count = 1;
cmd->options = _createOptions(2, "Copy Saves to USB", CMD_COPY_SAVES_USB);
list_append(item->codes, cmd);
cmd = _createCmdCode(PATCH_COMMAND, CHAR_ICON_LOCK " Dump all Save Fingerprints", CMD_DUMP_FINGERPRINTS);
list_append(item->codes, cmd);
list_append(list, item);
*/

LOG("Loading JSON files...");
snprintf(fullPath, sizeof(fullPath), "%sjson/", userPath);
read_json_games(fullPath, list);
Expand Down Expand Up @@ -1271,151 +1251,3 @@ list_t * ReadOnlineList(const char* urlPath)
check_game_appdb(list);
return list;
}

int get_save_details(const game_entry_t* save, char **details)
{
/*
char sfoPath[256];
sqlite3 *db;
sqlite3_stmt *res;
if (!(save->flags & CHEAT_FLAG_PS4))
{
asprintf(details, "%s\n\nTitle: %s\n", save->path, save->name);
return 1;
}
if (save->flags & CHEAT_FLAG_TROPHY)
{
if ((db = open_sqlite_db(save->path)) == NULL)
return 0;
char* query = sqlite3_mprintf("SELECT id, description, trophy_num, unlocked_trophy_num, progress,"
"platinum_num, unlocked_platinum_num, gold_num, unlocked_gold_num, silver_num, unlocked_silver_num,"
"bronze_num, unlocked_bronze_num FROM tbl_trophy_title WHERE id = %d", save->blocks);
if (sqlite3_prepare_v2(db, query, -1, &res, NULL) != SQLITE_OK || sqlite3_step(res) != SQLITE_ROW)
{
LOG("Failed to fetch data: %s", sqlite3_errmsg(db));
sqlite3_free(query);
sqlite3_close(db);
return 0;
}
asprintf(details, "Trophy-Set Details\n\n"
"Title: %s\n"
"Description: %s\n"
"NP Comm ID: %s\n"
"Progress: %d/%d - %d%%\n"
"%c Platinum: %d/%d\n"
"%c Gold: %d/%d\n"
"%c Silver: %d/%d\n"
"%c Bronze: %d/%d\n",
save->name, sqlite3_column_text(res, 1), save->title_id,
sqlite3_column_int(res, 3), sqlite3_column_int(res, 2), sqlite3_column_int(res, 4),
CHAR_TRP_PLATINUM, sqlite3_column_int(res, 6), sqlite3_column_int(res, 5),
CHAR_TRP_GOLD, sqlite3_column_int(res, 8), sqlite3_column_int(res, 7),
CHAR_TRP_SILVER, sqlite3_column_int(res, 10), sqlite3_column_int(res, 9),
CHAR_TRP_BRONZE, sqlite3_column_int(res, 12), sqlite3_column_int(res, 11));
sqlite3_free(query);
sqlite3_finalize(res);
sqlite3_close(db);
return 1;
}
if(save->flags & CHEAT_FLAG_LOCKED)
{
asprintf(details, "%s\n\n"
"Title ID: %s\n"
"Dir Name: %s\n"
"Blocks: %d\n"
"Account ID: %.16s\n",
save->path,
save->title_id,
save->version,
save->blocks,
save->path + 23);
return 1;
}
if(save->flags & CHEAT_FLAG_HDD)
{
if ((db = open_sqlite_db(save->path)) == NULL)
return 0;
char* query = sqlite3_mprintf("SELECT sub_title, detail, free_blocks, size_kib, user_id, account_id FROM savedata "
" WHERE title_id = %Q AND dir_name = %Q", save->title_id, save->version);
if (sqlite3_prepare_v2(db, query, -1, &res, NULL) != SQLITE_OK || sqlite3_step(res) != SQLITE_ROW)
{
LOG("Failed to fetch data: %s", sqlite3_errmsg(db));
sqlite3_free(query);
sqlite3_close(db);
return 0;
}
asprintf(details, "%s\n\n"
"Title: %s\n"
"Subtitle: %s\n"
"Detail: %s\n"
"Dir Name: %s\n"
"Blocks: %d (%d Free)\n"
"Size: %d Kb\n"
"User ID: %08x\n"
"Account ID: %016llx\n",
save->path, save->name,
sqlite3_column_text(res, 0),
sqlite3_column_text(res, 1),
save->version,
save->blocks, sqlite3_column_int(res, 2),
sqlite3_column_int(res, 3),
sqlite3_column_int(res, 4),
sqlite3_column_int64(res, 5));
sqlite3_free(query);
sqlite3_finalize(res);
sqlite3_close(db);
return 1;
}
snprintf(sfoPath, sizeof(sfoPath), "%s" "sce_sys/param.sfo", save->path);
LOG("Save Details :: Reading %s...", sfoPath);
sfo_context_t* sfo = sfo_alloc();
if (sfo_read(sfo, sfoPath) < 0) {
LOG("Unable to read from '%s'", sfoPath);
sfo_free(sfo);
return 0;
}
char* subtitle = (char*) sfo_get_param_value(sfo, "SUBTITLE");
char* detail = (char*) sfo_get_param_value(sfo, "DETAIL");
uint64_t* account_id = (uint64_t*) sfo_get_param_value(sfo, "ACCOUNT_ID");
sfo_params_ids_t* param_ids = (sfo_params_ids_t*) sfo_get_param_value(sfo, "PARAMS");
asprintf(details, "%s\n\n"
"Title: %s\n"
"Subtitle: %s\n"
"Detail: %s\n"
"Dir Name: %s\n"
"Blocks: %d\n"
"User ID: %08x\n"
"Account ID: %016lx\n",
save->path, save->name,
subtitle,
detail,
save->version,
save->blocks,
param_ids->user_id,
*account_id);
sfo_free(sfo);
*/
asprintf(details, "%s\n", save->path);
return 1;
}
7 changes: 4 additions & 3 deletions source/exec_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static void togglePatch(const game_entry_t* game, const code_entry_t* code)
show_message("Patch \"%s\" %s", code->name, code->activated ? "Enabled" : "Disabled");
}

static void toggleCheatFile(game_entry_t* game)
static void toggleCheatFile(game_entry_t* game, code_entry_t* code)
{
char file_path[256];

Expand All @@ -70,8 +70,9 @@ static void toggleCheatFile(game_entry_t* game)
game->flags ^= CHEAT_FLAG_LOCKED;
free(game->path);
asprintf(&game->path, "%s", file_path);
memcpy(code->name +1, (game->flags & CHEAT_FLAG_LOCKED) ? "Dis" : " En", 3);

show_message("Cheat File \"%s\" %s", game->name, (game->flags & CHEAT_FLAG_LOCKED) ? "Disabled" : "Enabled");
show_message("Cheat File %s:\n%s", (game->flags & CHEAT_FLAG_LOCKED) ? "Disabled" : "Enabled", game->path);
}

static void updNetCheats(void)
Expand Down Expand Up @@ -392,7 +393,7 @@ void execCodeCommand(code_entry_t* code, const char* codecmd)
break;

case CMD_TOGGLE_CHEAT:
toggleCheatFile(selected_entry);
toggleCheatFile(selected_entry, code);
return;

case CMD_TOGGLE_PATCH:
Expand Down

0 comments on commit 28e47bb

Please sign in to comment.