Skip to content
Permalink
Browse files
Fixed a possible crash.
  • Loading branch information
punesemu committed Jan 13, 2019
1 parent 89bb90f commit 707657f9005f0fcb65daaaf377a863c804a1fd56
Showing with 21 additions and 17 deletions.
  1. +5 −5 src/core/fds.c
  2. +8 −6 src/core/mappers.c
  3. +4 −3 src/core/patcher.c
  4. +4 −3 src/core/save_slot.c
@@ -453,14 +453,14 @@ void fds_diff_op(BYTE mode, uint32_t position, WORD value) {
uTCHAR ext[10], basename[255], *last_dot;

gui_utf_basename(info.rom.file, basename, usizeof(basename));
usnprintf(file, usizeof(file), uL("" uPERCENTs DIFF_FOLDER "/" uPERCENTs),
info.base_folder, basename);
usnprintf(file, usizeof(file), uL("" uPERCENTs DIFF_FOLDER "/" uPERCENTs), info.base_folder, basename);
usnprintf(ext, usizeof(ext), uL("dif"));

// rintraccio l'ultimo '.' nel nome
last_dot = ustrrchr(file, uL('.'));
// elimino l'estensione
*last_dot = 0x00;
if ((last_dot = ustrrchr(file, uL('.')))) {
// elimino l'estensione
*last_dot = 0x00;
};
// aggiungo l'estensione
ustrcat(file, ext);

@@ -1104,9 +1104,10 @@ void map_prg_ram_init(void) {
uL("" uPERCENTs PRB_FOLDER "/" uPERCENTs), info.base_folder, basename);

/* rintraccio l'ultimo '.' nel nome */
last_dot = ustrrchr(prg_ram_file, uL('.'));
/* elimino l'estensione */
*last_dot = 0x00;
if ((last_dot = ustrrchr(prg_ram_file, uL('.')))) {
/* elimino l'estensione */
*last_dot = 0x00;
}
/* aggiungo l'estensione prb */
ustrcat(prg_ram_file, uL(".prb"));
/* provo ad aprire il file */
@@ -1175,9 +1176,10 @@ void map_prg_ram_battery_save(void) {
uL("" uPERCENTs PRB_FOLDER "/" uPERCENTs), info.base_folder, basename);

/* rintraccio l'ultimo '.' nel nome */
last_dot = ustrrchr(prg_ram_file, uL('.'));
/* elimino l'estensione */
*last_dot = 0x00;
if ((last_dot = ustrrchr(prg_ram_file, uL('.')))) {
/* elimino l'estensione */
*last_dot = 0x00;
}
/* aggiungo l'estensione prb */
ustrcat(prg_ram_file, uL(".prb"));
/* apro il file */
@@ -121,9 +121,10 @@ BYTE patcher_ctrl_if_exist(uTCHAR *patch) {
uTCHAR *last_dot;

// rintraccio l'ultimo '.' nel nome
last_dot = ustrrchr(file, uL('.'));
// elimino l'estensione
*last_dot = 0x00;
if ((last_dot = ustrrchr(file, uL('.')))) {
// elimino l'estensione
*last_dot = 0x00;
};
// aggiungo l'estensione
ustrcat(file, patch_ext[i]);

@@ -832,9 +832,10 @@ static uTCHAR *name_slot_file(BYTE slot) {
}

// rintraccio l'ultimo '.' nel nome
last_dot = ustrrchr(file, uL('.'));
// elimino l'estensione
*last_dot = 0x00;
if ((last_dot = ustrrchr(file, uL('.')))) {
// elimino l'estensione
*last_dot = 0x00;
}
// aggiungo l'estensione
ustrcat(file, ext);

0 comments on commit 707657f

Please sign in to comment.