RetroArch
Classes | Typedefs | Enumerations | Functions
task_patch.c File Reference
#include <stdint.h>
#include <string.h>
#include <boolean.h>
#include <compat/msvc.h>
#include <file/file_path.h>
#include <streams/file_stream.h>
#include <string/stdstring.h>
#include <encodings/crc32.h>
#include "../msg_hash.h"
#include "../verbosity.h"
Include dependency graph for task_patch.c:
This graph shows which files directly or indirectly include this file:

Classes

struct  bps_data
 
struct  ups_data
 

Typedefs

typedef enum patch_error(* patch_func_t) (const uint8_t *, uint64_t, const uint8_t *, uint64_t, uint8_t *, uint64_t *)
 

Enumerations

enum  bps_mode { SOURCE_READ = 0, TARGET_READ, SOURCE_COPY, TARGET_COPY }
 
enum  patch_error {
  PATCH_UNKNOWN = 0, PATCH_SUCCESS, PATCH_PATCH_TOO_SMALL, PATCH_PATCH_INVALID_HEADER,
  PATCH_PATCH_INVALID, PATCH_SOURCE_TOO_SMALL, PATCH_TARGET_TOO_SMALL, PATCH_SOURCE_INVALID,
  PATCH_TARGET_INVALID, PATCH_SOURCE_CHECKSUM_INVALID, PATCH_TARGET_CHECKSUM_INVALID, PATCH_PATCH_CHECKSUM_INVALID
}
 

Functions

static uint8_t bps_read (struct bps_data *bps)
 
static uint64_t bps_decode (struct bps_data *bps)
 
static void bps_write (struct bps_data *bps, uint8_t data)
 
static enum patch_error bps_apply_patch (const uint8_t *modify_data, uint64_t modify_length, const uint8_t *source_data, uint64_t source_length, uint8_t *target_data, uint64_t *target_length)
 
static uint8_t ups_patch_read (struct ups_data *data)
 
static uint8_t ups_source_read (struct ups_data *data)
 
static void ups_target_write (struct ups_data *data, uint8_t n)
 
static uint64_t ups_decode (struct ups_data *data)
 
static enum patch_error ups_apply_patch (const uint8_t *patchdata, uint64_t patchlength, const uint8_t *sourcedata, uint64_t sourcelength, uint8_t *targetdata, uint64_t *targetlength)
 
static enum patch_error ips_apply_patch (const uint8_t *patchdata, uint64_t patchlen, const uint8_t *sourcedata, uint64_t sourcelength, uint8_t *targetdata, uint64_t *targetlength)
 
static bool apply_patch_content (uint8_t **buf, ssize_t *size, const char *patch_desc, const char *patch_path, patch_func_t func, void *patch_data, int64_t patch_size)
 
static bool try_bps_patch (bool allow_bps, const char *name_bps, uint8_t **buf, ssize_t *size)
 
static bool try_ups_patch (bool allow_ups, const char *name_ups, uint8_t **buf, ssize_t *size)
 
static bool try_ips_patch (bool allow_ips, const char *name_ips, uint8_t **buf, ssize_t *size)
 
static void patch_content (bool is_ips_pref, bool is_bps_pref, bool is_ups_pref, const char *name_ips, const char *name_bps, const char *name_ups, uint8_t **buf, void *data)
 

Typedef Documentation

◆ patch_func_t

typedef enum patch_error(* patch_func_t) (const uint8_t *, uint64_t, const uint8_t *, uint64_t, uint8_t *, uint64_t *)

Enumeration Type Documentation

◆ bps_mode

enum bps_mode
Enumerator
SOURCE_READ 
TARGET_READ 
SOURCE_COPY 
TARGET_COPY 

◆ patch_error

Enumerator
PATCH_UNKNOWN 
PATCH_SUCCESS 
PATCH_PATCH_TOO_SMALL 
PATCH_PATCH_INVALID_HEADER 
PATCH_PATCH_INVALID 
PATCH_SOURCE_TOO_SMALL 
PATCH_TARGET_TOO_SMALL 
PATCH_SOURCE_INVALID 
PATCH_TARGET_INVALID 
PATCH_SOURCE_CHECKSUM_INVALID 
PATCH_TARGET_CHECKSUM_INVALID 
PATCH_PATCH_CHECKSUM_INVALID 

Function Documentation

◆ apply_patch_content()

static bool apply_patch_content ( uint8_t **  buf,
ssize_t *  size,
const char *  patch_desc,
const char *  patch_path,
patch_func_t  func,
void patch_data,
int64_t  patch_size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bps_apply_patch()

static enum patch_error bps_apply_patch ( const uint8_t modify_data,
uint64_t  modify_length,
const uint8_t source_data,
uint64_t  source_length,
uint8_t target_data,
uint64_t target_length 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bps_decode()

static uint64_t bps_decode ( struct bps_data bps)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bps_read()

static uint8_t bps_read ( struct bps_data bps)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bps_write()

static void bps_write ( struct bps_data bps,
uint8_t  data 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ips_apply_patch()

static enum patch_error ips_apply_patch ( const uint8_t patchdata,
uint64_t  patchlen,
const uint8_t sourcedata,
uint64_t  sourcelength,
uint8_t targetdata,
uint64_t targetlength 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ patch_content()

static void patch_content ( bool  is_ips_pref,
bool  is_bps_pref,
bool  is_ups_pref,
const char *  name_ips,
const char *  name_bps,
const char *  name_ups,
uint8_t **  buf,
void data 
)
static

patch_content: : buffer of the content file. : size of the content file.

Apply patch to the content file in-memory.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ try_bps_patch()

static bool try_bps_patch ( bool  allow_bps,
const char *  name_bps,
uint8_t **  buf,
ssize_t *  size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ try_ips_patch()

static bool try_ips_patch ( bool  allow_ips,
const char *  name_ips,
uint8_t **  buf,
ssize_t *  size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ try_ups_patch()

static bool try_ups_patch ( bool  allow_ups,
const char *  name_ups,
uint8_t **  buf,
ssize_t *  size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ups_apply_patch()

static enum patch_error ups_apply_patch ( const uint8_t patchdata,
uint64_t  patchlength,
const uint8_t sourcedata,
uint64_t  sourcelength,
uint8_t targetdata,
uint64_t targetlength 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ups_decode()

static uint64_t ups_decode ( struct ups_data data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ups_patch_read()

static uint8_t ups_patch_read ( struct ups_data data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ups_source_read()

static uint8_t ups_source_read ( struct ups_data data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ups_target_write()

static void ups_target_write ( struct ups_data data,
uint8_t  n 
)
static
Here is the call graph for this function:
Here is the caller graph for this function: