Skip to content

Commit

Permalink
[NSFe] Fixed initialization of scroll->x variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
punesemu committed Mar 3, 2024
1 parent 71a91a9 commit 49586cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/core/nsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,6 @@ void nsf_after_load_rom(void) {
nsf.scroll_info_nsf.rect.h = 16;
nsf.scroll_info_nsf.timer = 4.0f;
nsf.scroll_info_nsf.reload = 4.0f;
nsf.scroll_info_nsf.x = SCR_COLUMNS;
nsf.scroll_info_nsf.velocity = 6;

nsf.scroll_title_song.rect.x = 0;
Expand All @@ -575,7 +574,6 @@ void nsf_after_load_rom(void) {
nsf.scroll_title_song.rect.h = NSF_GUI_TITLE_H;
nsf.scroll_title_song.timer = 4.0f;
nsf.scroll_title_song.reload = 4.0f;
nsf.scroll_title_song.x = NSF_GUI_TITLE_W;
nsf.scroll_title_song.velocity = 6;

nsf.curtain_title_song.reload.r1 = 50;
Expand Down Expand Up @@ -1698,6 +1696,10 @@ static void nsf_reset_song_variables(void) {
nsf.current_song.time = -1;
nsf.current_song.fade = -1;
}
if (nsf.scroll_title_song.pimage.data) {
free(nsf.scroll_title_song.pimage.data);
nsf.scroll_title_song.pimage.data = NULL;
}
nsf_reset_song_title();
}
static void ustrncat(uTCHAR *buffer, size_t buffer_size, const uTCHAR *fmt, ...) {
Expand Down
2 changes: 1 addition & 1 deletion src/gui/draw_on_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,10 @@ void dos_text_scroll_tick(BYTE nidx, int ppu_x, int ppu_y, const WORD fg_def, co

if (!scroll->pimage.data) {
dos_text_pixels_size(&scroll->pimage.w, &scroll->pimage.h, font_family, font_size, &text[0]);

if (!scroll->pimage.w || !scroll->pimage.h) {
return;
}
scroll->x = -(scroll->pimage.w - scroll->velocity);
scroll->pimage.w += scroll->rect.w;
scroll->pimage.data = _dos_text_to_ppu_image(0, 0, scroll->pimage.w, scroll->pimage.h,
fg_def, bg_def, font_family, font_size, &text[0]);
Expand Down

0 comments on commit 49586cd

Please sign in to comment.