Skip to content

Commit

Permalink
improve cheat details
Browse files Browse the repository at this point in the history
  • Loading branch information
bucanero committed Nov 11, 2022
1 parent 5488fbc commit b2edffe
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 33 deletions.
28 changes: 26 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,38 @@ All notable changes to the `GoldHEN Cheats Manager` project will be documented i

## [Unreleased]()

## [v1.0.0](https://github.com/GoldHEN/GoldHEN_Cheat_Manager/releases/tag/v1.0.0) - 2022-11-12

### Added

- Support for Game Patches
- List available patches
- Enable/Disable patches
- Update latest patches from the Web
- `MC4` cheat format support
- List available cheats
- Update `.mc4` cheat files from the Web
- New "File Overwrite" setting
- Allows to overwrite current cheat files with updated ones

### Changed

- Updated networking code to `libcurl`+`polarssl` (TLS 1.2)
- Visual improvements, icons, background (thanks to Chronoss)

### Fixed

- Fixed networking issues (thanks to LightingMods for the help)
- Fixed version detection for some "remaster" titles

## [v0.7.0](https://github.com/GoldHEN/GoldHEN_Cheat_Manager/releases/tag/v0.7.0) - 2022-07-05

### Added

- Installed Game list filter to show only available cheats
- Offline cheat pack (.zip) installation from USB/HDD
- /mnt/usb0/GoldHEN_Cheat_Repository-main.zip
- /data/GoldHEN_Cheat_Repository-main.zip
- `/mnt/usb0/GoldHEN_Cheat_Repository-main.zip`
- `/data/GoldHEN_Cheat_Repository-main.zip`

## [v0.6.0](https://github.com/GoldHEN/GoldHEN_Cheat_Manager/releases/tag/v0.6.0) - 2022-04-07

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package metadata.
TITLE := GoldHEN Cheats Manager
VERSION := 00.70
VERSION := 01.00
TITLE_ID := GOLD00777
CONTENT_ID := IV0000-GOLD00777_00-GOLDCHEATS000PS4

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ You need to have installed:
- [SDL2](https://github.com/PacBrew/SDL/tree/ps4) library
- [libJbc](https://github.com/bucanero/ps4-libjbc) library
- [Mini-XML](https://github.com/bucanero/mxml) library
- [PolarSSL](https://github.com/bucanero/oosdk_libraries/tree/master/polarssl-1.3.9) library
- [libcurl](https://github.com/bucanero/oosdk_libraries/tree/master/curl-7.64.1) library
- [dbglogger](https://github.com/bucanero/dbglogger) library (required for debug logging)

Run `make` to create a release build. If you want to include the latest save patches in your `.pkg` file, run `make createzip`.
Expand Down
4 changes: 3 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ See the [latest changes here](CHANGELOG.md).

# Donations

My GitHub projects are open to a [sponsor program](https://patreon.com/dparrino). If you feel that my tools helped you in some way or you would like to support it, you can consider a [PayPal donation](https://www.paypal.me/bucanerodev).
My GitHub projects are open to a [Patreon sponsor program](https://patreon.com/dparrino). If you feel that my tools helped you in some way or you would like to support future developments, you can consider a [PayPal donation](https://www.paypal.me/bucanerodev).

# Setup instructions

Expand Down Expand Up @@ -67,6 +67,8 @@ You need to have installed:
- [SDL2](https://github.com/PacBrew/SDL/tree/ps4) library
- [libJbc](https://github.com/bucanero/ps4-libjbc) library
- [Mini-XML](https://github.com/bucanero/mxml) library
- [PolarSSL](https://github.com/bucanero/oosdk_libraries/tree/master/polarssl-1.3.9) library
- [libcurl](https://github.com/bucanero/oosdk_libraries/tree/master/curl-7.64.1) library
- [dbglogger](https://github.com/bucanero/dbglogger) library (required for debug logging)

Run `make` to create a release build. If you want to include the latest save patches in your `.pkg` file, run `make createzip`.
Expand Down
60 changes: 32 additions & 28 deletions source/cheats.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,12 @@ char * readTextFile(const char * path, long* size)
fclose(f);

string[fsize] = 0;
*size = fsize;
if (size)
*size = fsize;

return string;
}

/*
static code_entry_t* _createCmdCode(uint8_t type, const char* name, char code)
{
code_entry_t* entry = (code_entry_t *)calloc(1, sizeof(code_entry_t));
Expand All @@ -209,7 +211,7 @@ static code_entry_t* _createCmdCode(uint8_t type, const char* name, char code)
return entry;
}
/*
static option_entry_t* _initOptions(int count)
{
option_entry_t* options = (option_entry_t*)malloc(sizeof(option_entry_t));
Expand Down Expand Up @@ -255,8 +257,7 @@ int set_json_codes(game_entry_t* item)

LOG("Parsing \"%s\"...", item->path);

long bsize;
char *buffer = readTextFile(item->path, &bsize);
char *buffer = readTextFile(item->path, NULL);
cJSON *cheat = cJSON_Parse(buffer);

if (!cheat)
Expand All @@ -270,6 +271,7 @@ int set_json_codes(game_entry_t* item)

const cJSON *mod;
const cJSON *mods = cJSON_GetObjectItemCaseSensitive(cheat, "mods");
const cJSON *proc = cJSON_GetObjectItemCaseSensitive(cheat, "process");
cJSON_ArrayForEach(mod, mods)
{
cJSON *mod_name = cJSON_GetObjectItemCaseSensitive(mod, "name");
Expand All @@ -278,10 +280,15 @@ int set_json_codes(game_entry_t* item)
if (!cJSON_IsString(mod_name) || !cJSON_IsString(mod_type))
continue;

cmd = _createCmdCode(PATCH_VIEW, mod_name->valuestring, CMD_CODE_NULL);
cmd = (code_entry_t *)calloc(1, sizeof(code_entry_t));
cmd->type = PATCH_VIEW;
cmd->name = strdup(mod_name->valuestring);
cmd->file = strdup(cJSON_IsString(proc) ? proc->valuestring : "");

const cJSON *mem = cJSON_GetObjectItemCaseSensitive(mod, "memory");
cmd->codes = cJSON_Print(mem);
char* code = cJSON_Print(mem);
asprintf(&cmd->codes, "Path: %s\n\nCode: %s\n", item->path, code);
free(code);

LOG("Added '%s' (%s)", mod_name->valuestring, mod_type->valuestring);
list_append(item->codes, cmd);
Expand Down Expand Up @@ -311,9 +318,7 @@ int set_shn_codes(game_entry_t* item)

LOG("Parsing %s...", item->path);

long bsize;
char *buffer = readTextFile(item->path, &bsize);

char *buffer = readTextFile(item->path, NULL);
mxml_node_t *node, *tree = NULL;

/* parse the file and get the DOM */
Expand All @@ -327,18 +332,23 @@ int set_shn_codes(game_entry_t* item)
return 0;
}

node = mxmlFindElement(tree, tree, "Trainer", "Game", NULL, MXML_DESCEND);
const char* author = mxmlElementGetAttr(node, "Moder");
const char* procfn = mxmlElementGetAttr(node, "Process");

/* Get the cheat element nodes */
for (node = mxmlFindElement(tree, tree, "Cheat", "Text", NULL, MXML_DESCEND); node != NULL;
node = mxmlFindElement(node, tree, "Cheat", "Text", NULL, MXML_DESCEND))
{
mxml_node_t *value = mxmlFindElement(node, node, "Cheatline", NULL, NULL, MXML_DESCEND);
char* code = value ? mxmlSaveAllocString(node, &xml_whitespace_cb) : calloc(1, 1);

cmd = _createCmdCode(PATCH_VIEW, mxmlElementGetAttr(node, "Text"), CMD_CODE_NULL);
if (value)
{
free(cmd->codes);
cmd->codes = mxmlSaveAllocString(node, &xml_whitespace_cb);
}
cmd = (code_entry_t *)calloc(1, sizeof(code_entry_t));
cmd->type = PATCH_VIEW;
cmd->name = strdup(mxmlElementGetAttr(node, "Text"));
cmd->file = strdup(procfn);
asprintf(&cmd->codes, "Path: %s\nAuthor: %s\n\n%s", item->path, author, code);
free(code);

LOG("Added '%s' (%d)", cmd->name, cmd->type);
list_append(item->codes, cmd);
Expand Down Expand Up @@ -443,8 +453,7 @@ list_t * ReadBackupList(const char* userPath)
int ret = extract_zip_gh(GOLDCHEATS_LOCAL_CACHE "appdata.zip", GOLDCHEATS_PATCH_PATH);
if (ret > 0)
{
s64 bsize = 0;
char *patch_ver = readTextFile(GOLDCHEATS_PATCH_PATH "json/build.txt", &bsize);
char *patch_ver = readTextFile(GOLDCHEATS_PATCH_PATH "json/build.txt", NULL);
show_message("Successfully installed %d patch files\n%s", ret, patch_ver);
free(patch_ver);
}
Expand Down Expand Up @@ -622,10 +631,9 @@ list_t * ReadPatchList(const char* userPath)

LOG("Reading %s...", fullPath);

long bsize;
char *ver = fullPath;
char *app = fullPath;
char *buffer = readTextFile(fullPath, &bsize);
char *buffer = readTextFile(fullPath, NULL);
cJSON *cheat = cJSON_Parse(buffer);

if (!cheat)
Expand Down Expand Up @@ -678,13 +686,12 @@ list_t * ReadPatchList(const char* userPath)

int ReadPatches(game_entry_t * game)
{
long bsize;
code_entry_t* cmd;
game->codes = list_alloc();

LOG("Loading patches from '%s'...", game->path);

char *buffer = readTextFile(game->path, &bsize);
char *buffer = readTextFile(game->path, NULL);
cJSON *cheat = cJSON_Parse(buffer);

if (!cheat)
Expand Down Expand Up @@ -877,9 +884,7 @@ static void read_shn_games(const char* userPath, const char* fext, list_t *list)

LOG("Reading %s...", dir->d_name);

long bsize;
char *buffer = readTextFile(fullPath, &bsize);

char *buffer = readTextFile(fullPath, NULL);
mxml_node_t *node, *tree = NULL;

/* parse the file and get the DOM */
Expand Down Expand Up @@ -941,8 +946,7 @@ static void read_json_games(const char* userPath, list_t *list)

LOG("Reading %s...", dir->d_name);

long bsize;
char *buffer = readTextFile(fullPath, &bsize);
char *buffer = readTextFile(fullPath, NULL);
cJSON *cheat = cJSON_Parse(buffer);
const cJSON *jobject;

Expand Down Expand Up @@ -1070,7 +1074,7 @@ static void _ReadOnlineListEx(const char* urlPath, const char* fext, uint16_t fl
char *data = readTextFile(path, &fsize);

char *ptr = data;
char *end = data + fsize + 1;
char *end = data + fsize;

while (ptr < end && *ptr)
{
Expand Down
2 changes: 1 addition & 1 deletion source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ save_list_t hdd_saves = {
*/
save_list_t hdd_patches = {
.icon_id = header_ico_cht_png_index,
.title = "HDD Patches",
.title = "Game Patches",
.list = NULL,
.path = GOLDCHEATS_PATCH_PATH "json/",
.ReadList = &ReadPatchList,
Expand Down

0 comments on commit b2edffe

Please sign in to comment.