Skip to content

Commit

Permalink
[NSF Player] Fixed the status of the "Fadeout" checkbox.
Browse files Browse the repository at this point in the history
  • Loading branch information
punesemu committed Mar 10, 2024
1 parent 80af01c commit 74252de
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/nsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ BYTE nsf_load_rom(void) {
nsf.adr.load = (flags[LOAD_ADR_HI] << 8) | flags[LOAD_ADR_LO];
nsf.adr.init = (flags[INIT_ADR_HI] << 8) | flags[INIT_ADR_LO];
nsf.adr.play = (flags[PLAY_ADR_HI] << 8) | flags[PLAY_ADR_LO];
nsf.info.use_fade = FALSE;

if ((nsf.songs.total == 0) || (nsf.adr.load < 0x6000) || (nsf.adr.init < 0x6000) || (nsf.adr.play < 0x6000)) {
free(rom.data);
Expand Down Expand Up @@ -976,6 +977,8 @@ void nsf_controls_mouse_in_gui(int x_mouse, int y_mouse) {
}
return;
}
}
if (nsf.info.use_fade) {
x = NSF_GUI_OPTIONS_3_PPUX;
if (((x_mouse >= x) && (x_mouse <= (x + w))) && ((y_mouse >= y) && (y_mouse <= (y + h)))) {
cfg->nsf_player_nsf_fadeout = !cfg->nsf_player_nsf_fadeout;
Expand Down Expand Up @@ -1585,7 +1588,7 @@ static void nsf_draw_controls(void) {
}
if (force_draw || (sfadeout != cfg->nsf_player_nsf_fadeout)) {
nsf_print_option(NSF_GUI_OPTIONS_3_PPUX, NSF_GUI_OPTIONS_BOX_PPUY,
uL("Fadeout"), nsf.info_song && nsf.current_song.fade, cfg->nsf_player_nsf_fadeout);
uL("Fadeout"), nsf.info.use_fade, cfg->nsf_player_nsf_fadeout);
sfadeout = cfg->nsf_player_nsf_fadeout;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/core/nsf.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ typedef struct _nsf {
uTCHAR *copyright;
uTCHAR *ripper;
uTCHAR *text;
BYTE use_fade;
} info;
struct _nsf_play_speed {
WORD ntsc;
Expand Down
2 changes: 2 additions & 0 deletions src/core/nsfe.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ BYTE nsfe_load_rom(void) {
info.machine[DATABASE] = DEFAULT;

memset(&nsf2, 0x00, sizeof(_nsf2));
nsf.info.use_fade = FALSE;

for (phase = NSFE_COUNT; phase <= NSFE_READ; phase++) {
rom.position = 4;
Expand Down Expand Up @@ -528,6 +529,7 @@ BYTE nsfe_fade(_rom_mem *rom, BYTE phase) {

rom_mem_memcpy(&song->fade, rom, 4);
nsf.chunk.length -= 4;
nsf.info.use_fade = TRUE;
}

rom->position += nsf.chunk.length;
Expand Down

0 comments on commit 74252de

Please sign in to comment.