@@ -483,6 +483,45 @@ int trophy_lock(const save_entry_t* game, int trp_id, int grp_id, int type)
483483 return 1 ;
484484}
485485
486+ int trophySet_delete (const save_entry_t * game )
487+ {
488+ char dbpath [256 ];
489+ sqlite3 * db ;
490+
491+ snprintf (dbpath , sizeof (dbpath ), TROPHY_DB_PATH , apollo_config .user_id );
492+ if ((db = open_sqlite_db (dbpath )) == NULL )
493+ return 0 ;
494+
495+ char * query = sqlite3_mprintf ("DELETE FROM tbl_trophy_title WHERE (id=%d);\n"
496+ "DELETE FROM tbl_trophy_title_entry WHERE (id=%d);\n"
497+ "DELETE FROM tbl_trophy_flag WHERE (title_id=%d);" ,
498+ game -> blocks , game -> blocks , game -> blocks );
499+
500+ if (sqlite3_exec (db , query , NULL , NULL , NULL ) != SQLITE_OK )
501+ {
502+ LOG ("Error updating '%s': %s" , game -> title_id , sqlite3_errmsg (db ));
503+ sqlite3_free (query );
504+ sqlite3_close (db );
505+ return 0 ;
506+ }
507+
508+ LOG ("Saving database to %s" , dbpath );
509+ sqlite3_memvfs_dump (db , NULL , dbpath );
510+ sqlite3_free (query );
511+ sqlite3_close (db );
512+
513+ snprintf (dbpath , sizeof (dbpath ), TROPHY_PATH_HDD "%s/sealedkey" , apollo_config .user_id , game -> title_id );
514+ unlink_secure (dbpath );
515+
516+ snprintf (dbpath , sizeof (dbpath ), TROPHY_PATH_HDD "%s/trophy.img" , apollo_config .user_id , game -> title_id );
517+ unlink_secure (dbpath );
518+
519+ * strrchr (dbpath , '/' ) = 0 ;
520+ rmdir (dbpath );
521+
522+ return 1 ;
523+ }
524+
486525int orbis_SaveDelete (const save_entry_t * save )
487526{
488527 OrbisSaveDataDelete del ;
@@ -1060,6 +1099,15 @@ int ReadTrophies(save_entry_t * game)
10601099 trophy = _createCmdCode (PATCH_COMMAND , CHAR_ICON_SIGN " Apply Changes to Trophy Set" , CMD_UPDATE_TROPHY );
10611100 list_append (game -> codes , trophy );
10621101
1102+ trophy = _createCmdCode (PATCH_COMMAND , CHAR_ICON_USER " View Trophy Set Details" , CMD_VIEW_DETAILS );
1103+ list_append (game -> codes , trophy );
1104+
1105+ trophy = _createCmdCode (PATCH_COMMAND , CHAR_ICON_WARN " Delete Trophy Set" , CMD_DELETE_SAVE );
1106+ list_append (game -> codes , trophy );
1107+
1108+ trophy = _createCmdCode (PATCH_NULL , "----- " UTF8_CHAR_STAR " File Backup " UTF8_CHAR_STAR " -----" , CMD_CODE_NULL );
1109+ list_append (game -> codes , trophy );
1110+
10631111 trophy = _createCmdCode (PATCH_COMMAND , CHAR_ICON_COPY " Backup Trophy files to USB" , CMD_CODE_NULL );
10641112 trophy -> file = strdup (game -> path );
10651113 trophy -> options_count = 1 ;
@@ -1074,9 +1122,6 @@ int ReadTrophies(save_entry_t * game)
10741122 asprintf (& trophy -> options -> value [2 ], "%c" , CMD_EXPORT_ZIP_HDD );
10751123 list_append (game -> codes , trophy );
10761124
1077- trophy = _createCmdCode (PATCH_NULL , "----- " UTF8_CHAR_STAR " File Backup " UTF8_CHAR_STAR " -----" , CMD_CODE_NULL );
1078- list_append (game -> codes , trophy );
1079-
10801125 trophy = _createCmdCode (PATCH_COMMAND , CHAR_ICON_COPY " Export decrypted trophy files" , CMD_CODE_NULL );
10811126 trophy -> options_count = 1 ;
10821127 trophy -> options = _getFileOptions (game -> path , "*" , CMD_DECRYPT_FILE );
0 commit comments