@@ -243,10 +243,6 @@ static game_entry_t* createGameEntry(uint16_t flag, const char* name)
243
243
int set_json_codes (game_entry_t * item )
244
244
{
245
245
code_entry_t * cmd ;
246
- item -> codes = list_alloc ();
247
-
248
- // cmd = _createCmdCode(PATCH_COMMAND, CHAR_ICON_USER " View Save Details", CMD_VIEW_DETAILS);
249
- // list_append(item->codes, cmd);
250
246
251
247
LOG ("Parsing \"%s\"..." , item -> path );
252
248
@@ -331,13 +327,22 @@ char* mc4_decrypt(const char* data)
331
327
aes_setkey_dec (& aes_ctx , (uint8_t * ) MC4_AES256CBC_KEY , 256 );
332
328
aes_crypt_cbc (& aes_ctx , AES_DECRYPT , enc_size , iv , enc_data , enc_data );
333
329
330
+ // replace html entities in the decrypted XML data
331
+ for (size_t i = 0 ; i < (enc_size - 3 ); i ++ )
332
+ {
333
+ if (strncmp ((char * ) & enc_data [i ], "<" , 4 ) == 0 )
334
+ memcpy (enc_data + i , "< " , 4 );
335
+
336
+ else if (strncmp ((char * ) & enc_data [i ], ">" , 4 ) == 0 )
337
+ memcpy (enc_data + i , "> " , 4 );
338
+ }
339
+
334
340
return (char * ) enc_data ;
335
341
}
336
342
337
343
int set_shn_codes (game_entry_t * item )
338
344
{
339
345
code_entry_t * cmd ;
340
- item -> codes = list_alloc ();
341
346
342
347
LOG ("Parsing %s..." , item -> path );
343
348
char * buffer = readTextFile (item -> path , NULL );
@@ -415,6 +420,11 @@ int set_shn_codes(game_entry_t* item)
415
420
*/
416
421
int ReadCodes (game_entry_t * save )
417
422
{
423
+ save -> codes = list_alloc ();
424
+ list_append (save -> codes , _createCmdCode (PATCH_COMMAND ,
425
+ (save -> flags & CHEAT_FLAG_LOCKED ) ? CHAR_ICON_LOCK " Enable Cheat File" : CHAR_ICON_LOCK "Disable Cheat File" ,
426
+ CMD_TOGGLE_CHEAT ));
427
+
418
428
if (save -> flags & CHEAT_FLAG_JSON )
419
429
return set_json_codes (save );
420
430
@@ -458,6 +468,7 @@ int ReadOnlineCodes(game_entry_t * game)
458
468
459
469
char * tmp = game -> path ;
460
470
game -> path = path ;
471
+ game -> codes = list_alloc ();
461
472
462
473
if (game -> flags & CHEAT_FLAG_JSON )
463
474
set_json_codes (game );
@@ -913,7 +924,7 @@ static void read_shn_games(const char* userPath, list_t *list)
913
924
914
925
while ((dir = readdir (d )) != NULL )
915
926
{
916
- if (!endsWith (dir -> d_name , ".shn" ))
927
+ if (!endsWith (dir -> d_name , ".shn" ) && ! endsWith ( dir -> d_name , ".shn-disabled" ) )
917
928
continue ;
918
929
919
930
snprintf (fullPath , sizeof (fullPath ), "%s%s" , userPath , dir -> d_name );
@@ -951,6 +962,9 @@ static void read_shn_games(const char* userPath, list_t *list)
951
962
mxmlDelete (tree );
952
963
free (buffer );
953
964
965
+ if (endsWith (dir -> d_name , ".shn-disabled" ))
966
+ item -> flags |= CHEAT_FLAG_LOCKED ;
967
+
954
968
LOG ("[%s] F(%d) '%s'" , item -> title_id , item -> flags , item -> name );
955
969
list_append (list , item );
956
970
}
@@ -972,7 +986,7 @@ static void read_mc4_games(const char* userPath, list_t *list)
972
986
973
987
while ((dir = readdir (d )) != NULL )
974
988
{
975
- if (!endsWith (dir -> d_name , ".mc4" ))
989
+ if (!endsWith (dir -> d_name , ".mc4" ) && ! endsWith ( dir -> d_name , ".mc4-disabled" ) )
976
990
continue ;
977
991
978
992
snprintf (fullPath , sizeof (fullPath ), "%s%s" , userPath , dir -> d_name );
@@ -1027,6 +1041,9 @@ static void read_mc4_games(const char* userPath, list_t *list)
1027
1041
mxmlDelete (tree );
1028
1042
free (buffer );
1029
1043
1044
+ if (endsWith (dir -> d_name , ".mc4-disabled" ))
1045
+ item -> flags |= CHEAT_FLAG_LOCKED ;
1046
+
1030
1047
LOG ("[%s] F(%d) '%s'" , item -> title_id , item -> flags , item -> name );
1031
1048
list_append (list , item );
1032
1049
}
@@ -1049,7 +1066,7 @@ static void read_json_games(const char* userPath, list_t *list)
1049
1066
1050
1067
while ((dir = readdir (d )) != NULL )
1051
1068
{
1052
- if (!endsWith (dir -> d_name , ".json" ))
1069
+ if (!endsWith (dir -> d_name , ".json" ) && ! endsWith ( dir -> d_name , ".json-disabled" ) )
1053
1070
continue ;
1054
1071
1055
1072
snprintf (fullPath , sizeof (fullPath ), "%s%s" , userPath , dir -> d_name );
@@ -1082,6 +1099,9 @@ static void read_json_games(const char* userPath, list_t *list)
1082
1099
cJSON_Delete (cheat );
1083
1100
free (buffer );
1084
1101
1102
+ if (endsWith (dir -> d_name , ".json-disabled" ))
1103
+ item -> flags |= CHEAT_FLAG_LOCKED ;
1104
+
1085
1105
LOG ("[%s] F(%d) '%s'" , item -> title_id , item -> flags , item -> name );
1086
1106
list_append (list , item );
1087
1107
}
@@ -1111,26 +1131,6 @@ list_t * ReadUserList(const char* userPath)
1111
1131
1112
1132
list = list_alloc ();
1113
1133
1114
- /*
1115
- item = createGameEntry(CHEAT_FLAG_PS4, CHAR_ICON_COPY " Bulk Cheats Management");
1116
- item->type = FILE_TYPE_MENU;
1117
- item->codes = list_alloc();
1118
- item->path = strdup(userPath);
1119
- // item->path = (void*) list; //bulk management hack
1120
-
1121
- cmd = _createCmdCode(PATCH_COMMAND, CHAR_ICON_SIGN " Resign & Unlock all Saves", CMD_RESIGN_ALL_SAVES);
1122
- list_append(item->codes, cmd);
1123
-
1124
- cmd = _createCmdCode(PATCH_COMMAND, CHAR_ICON_COPY " Copy all Saves to USB", CMD_CODE_NULL);
1125
- cmd->options_count = 1;
1126
- cmd->options = _createOptions(2, "Copy Saves to USB", CMD_COPY_SAVES_USB);
1127
- list_append(item->codes, cmd);
1128
-
1129
- cmd = _createCmdCode(PATCH_COMMAND, CHAR_ICON_LOCK " Dump all Save Fingerprints", CMD_DUMP_FINGERPRINTS);
1130
- list_append(item->codes, cmd);
1131
- list_append(list, item);
1132
- */
1133
-
1134
1134
LOG ("Loading JSON files..." );
1135
1135
snprintf (fullPath , sizeof (fullPath ), "%sjson/" , userPath );
1136
1136
read_json_games (fullPath , list );
@@ -1251,151 +1251,3 @@ list_t * ReadOnlineList(const char* urlPath)
1251
1251
check_game_appdb (list );
1252
1252
return list ;
1253
1253
}
1254
-
1255
- int get_save_details (const game_entry_t * save , char * * details )
1256
- {
1257
- /*
1258
- char sfoPath[256];
1259
- sqlite3 *db;
1260
- sqlite3_stmt *res;
1261
-
1262
-
1263
- if (!(save->flags & CHEAT_FLAG_PS4))
1264
- {
1265
- asprintf(details, "%s\n\nTitle: %s\n", save->path, save->name);
1266
- return 1;
1267
- }
1268
-
1269
- if (save->flags & CHEAT_FLAG_TROPHY)
1270
- {
1271
- if ((db = open_sqlite_db(save->path)) == NULL)
1272
- return 0;
1273
-
1274
- char* query = sqlite3_mprintf("SELECT id, description, trophy_num, unlocked_trophy_num, progress,"
1275
- "platinum_num, unlocked_platinum_num, gold_num, unlocked_gold_num, silver_num, unlocked_silver_num,"
1276
- "bronze_num, unlocked_bronze_num FROM tbl_trophy_title WHERE id = %d", save->blocks);
1277
-
1278
- if (sqlite3_prepare_v2(db, query, -1, &res, NULL) != SQLITE_OK || sqlite3_step(res) != SQLITE_ROW)
1279
- {
1280
- LOG("Failed to fetch data: %s", sqlite3_errmsg(db));
1281
- sqlite3_free(query);
1282
- sqlite3_close(db);
1283
- return 0;
1284
- }
1285
-
1286
- asprintf(details, "Trophy-Set Details\n\n"
1287
- "Title: %s\n"
1288
- "Description: %s\n"
1289
- "NP Comm ID: %s\n"
1290
- "Progress: %d/%d - %d%%\n"
1291
- "%c Platinum: %d/%d\n"
1292
- "%c Gold: %d/%d\n"
1293
- "%c Silver: %d/%d\n"
1294
- "%c Bronze: %d/%d\n",
1295
- save->name, sqlite3_column_text(res, 1), save->title_id,
1296
- sqlite3_column_int(res, 3), sqlite3_column_int(res, 2), sqlite3_column_int(res, 4),
1297
- CHAR_TRP_PLATINUM, sqlite3_column_int(res, 6), sqlite3_column_int(res, 5),
1298
- CHAR_TRP_GOLD, sqlite3_column_int(res, 8), sqlite3_column_int(res, 7),
1299
- CHAR_TRP_SILVER, sqlite3_column_int(res, 10), sqlite3_column_int(res, 9),
1300
- CHAR_TRP_BRONZE, sqlite3_column_int(res, 12), sqlite3_column_int(res, 11));
1301
-
1302
- sqlite3_free(query);
1303
- sqlite3_finalize(res);
1304
- sqlite3_close(db);
1305
-
1306
- return 1;
1307
- }
1308
-
1309
- if(save->flags & CHEAT_FLAG_LOCKED)
1310
- {
1311
- asprintf(details, "%s\n\n"
1312
- "Title ID: %s\n"
1313
- "Dir Name: %s\n"
1314
- "Blocks: %d\n"
1315
- "Account ID: %.16s\n",
1316
- save->path,
1317
- save->title_id,
1318
- save->version,
1319
- save->blocks,
1320
- save->path + 23);
1321
-
1322
- return 1;
1323
- }
1324
-
1325
- if(save->flags & CHEAT_FLAG_HDD)
1326
- {
1327
- if ((db = open_sqlite_db(save->path)) == NULL)
1328
- return 0;
1329
-
1330
- char* query = sqlite3_mprintf("SELECT sub_title, detail, free_blocks, size_kib, user_id, account_id FROM savedata "
1331
- " WHERE title_id = %Q AND dir_name = %Q", save->title_id, save->version);
1332
-
1333
- if (sqlite3_prepare_v2(db, query, -1, &res, NULL) != SQLITE_OK || sqlite3_step(res) != SQLITE_ROW)
1334
- {
1335
- LOG("Failed to fetch data: %s", sqlite3_errmsg(db));
1336
- sqlite3_free(query);
1337
- sqlite3_close(db);
1338
- return 0;
1339
- }
1340
-
1341
- asprintf(details, "%s\n\n"
1342
- "Title: %s\n"
1343
- "Subtitle: %s\n"
1344
- "Detail: %s\n"
1345
- "Dir Name: %s\n"
1346
- "Blocks: %d (%d Free)\n"
1347
- "Size: %d Kb\n"
1348
- "User ID: %08x\n"
1349
- "Account ID: %016llx\n",
1350
- save->path, save->name,
1351
- sqlite3_column_text(res, 0),
1352
- sqlite3_column_text(res, 1),
1353
- save->version,
1354
- save->blocks, sqlite3_column_int(res, 2),
1355
- sqlite3_column_int(res, 3),
1356
- sqlite3_column_int(res, 4),
1357
- sqlite3_column_int64(res, 5));
1358
-
1359
- sqlite3_free(query);
1360
- sqlite3_finalize(res);
1361
- sqlite3_close(db);
1362
-
1363
- return 1;
1364
- }
1365
-
1366
- snprintf(sfoPath, sizeof(sfoPath), "%s" "sce_sys/param.sfo", save->path);
1367
- LOG("Save Details :: Reading %s...", sfoPath);
1368
-
1369
- sfo_context_t* sfo = sfo_alloc();
1370
- if (sfo_read(sfo, sfoPath) < 0) {
1371
- LOG("Unable to read from '%s'", sfoPath);
1372
- sfo_free(sfo);
1373
- return 0;
1374
- }
1375
-
1376
- char* subtitle = (char*) sfo_get_param_value(sfo, "SUBTITLE");
1377
- char* detail = (char*) sfo_get_param_value(sfo, "DETAIL");
1378
- uint64_t* account_id = (uint64_t*) sfo_get_param_value(sfo, "ACCOUNT_ID");
1379
- sfo_params_ids_t* param_ids = (sfo_params_ids_t*) sfo_get_param_value(sfo, "PARAMS");
1380
-
1381
- asprintf(details, "%s\n\n"
1382
- "Title: %s\n"
1383
- "Subtitle: %s\n"
1384
- "Detail: %s\n"
1385
- "Dir Name: %s\n"
1386
- "Blocks: %d\n"
1387
- "User ID: %08x\n"
1388
- "Account ID: %016lx\n",
1389
- save->path, save->name,
1390
- subtitle,
1391
- detail,
1392
- save->version,
1393
- save->blocks,
1394
- param_ids->user_id,
1395
- *account_id);
1396
-
1397
- sfo_free(sfo);
1398
- */
1399
- asprintf (details , "%s\n" , save -> path );
1400
- return 1 ;
1401
- }
0 commit comments