Skip to content

Commit

Permalink
Disk Op. bugfix for "ask dialogs"
Browse files Browse the repository at this point in the history
- Disk Op.: Fixed a bug from v1.54 where sequential ask dialogs resulted in an empty file list inbetween the two dialogs
  • Loading branch information
8bitbubsy committed Dec 9, 2022
1 parent 871c59c commit dff7f1d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 15 deletions.
10 changes: 6 additions & 4 deletions src/pt2_askbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,18 @@ void removeAskBox(void)

if (ui.diskOpScreenShown)
{
renderDiskOpScreen();
renderDiskOpScreen(); // also sets update flags
updateDiskOp(); // redraw requested updates
}
else if (ui.posEdScreenShown)
{
renderPosEdScreen();
ui.updatePosEd = true;
renderPosEdScreen(); // also sets update flags
updatePosEd(); // redraw requested updates
}
else if (ui.editOpScreenShown)
{
renderEditOpScreen();
renderEditOpScreen(); // also sets update flags
updateEditOp(); // redraw requested updates
}
else if (ui.aboutScreenShown)
{
Expand Down
2 changes: 1 addition & 1 deletion src/pt2_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "pt2_unicode.h"
#include "pt2_palette.h"

#define PROG_VER_STR "1.54"
#define PROG_VER_STR "1.55"

#ifdef _WIN32
#define DIR_DELIMITER '\\'
Expand Down
38 changes: 28 additions & 10 deletions src/pt2_mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -3548,17 +3548,26 @@ static bool handleGUIButtons(int32_t button) // are you prepared to enter the ju

case PTB_DO_SAVESAMPLE:
{
if (diskop.mode != DISKOP_MODE_SMP)
bool changeLoadMode = (diskop.mode != DISKOP_MODE_SMP);
if (changeLoadMode)
{
diskop.mode = DISKOP_MODE_SMP;
setPathFromDiskOpMode();
diskop.scrollOffset = 0;
diskop.cached = false;
ui.updateLoadMode = true;
ui.updateLoadMode = true; // redraw load mode cursor
updateDiskOp();
}

if (askBox(ASKBOX_YES_NO, "SAVE SAMPLE ?"))
saveSample(CHECK_IF_FILE_EXIST, DONT_GIVE_NEW_FILENAME);
saveSample(CHECK_IF_FILE_EXIST, DONT_GIVE_NEW_FILENAME); // also updates file list

// if we changed mode, re-read directory in Disk Op.
if (changeLoadMode)
{
diskop.scrollOffset = 0;
diskop.cached = false; // read new directory
ui.updateDiskOpFileList = true;
updateDiskOp();
}
}
break;

Expand Down Expand Up @@ -3758,17 +3767,26 @@ static bool handleGUIButtons(int32_t button) // are you prepared to enter the ju

case PTB_DO_SAVEMODULE:
{
if (diskop.mode != DISKOP_MODE_MOD)
bool changeLoadMode = (diskop.mode != DISKOP_MODE_MOD);
if (changeLoadMode)
{
diskop.mode = DISKOP_MODE_MOD;
setPathFromDiskOpMode();
diskop.scrollOffset = 0;
diskop.cached = false;
ui.updateLoadMode = true;
ui.updateLoadMode = true; // redraw load mode cursor
updateDiskOp();
}

if (askBox(ASKBOX_YES_NO, "SAVE MODULE ?"))
saveModule(CHECK_IF_FILE_EXIST, DONT_GIVE_NEW_FILENAME);
saveModule(CHECK_IF_FILE_EXIST, DONT_GIVE_NEW_FILENAME); // also updates file list

// if we changed mode, re-read directory in Disk Op.
if (changeLoadMode)
{
diskop.scrollOffset = 0;
diskop.cached = false; // read new directory
ui.updateDiskOpFileList = true;
updateDiskOp();
}
}
break;

Expand Down
1 change: 1 addition & 0 deletions src/pt2_visuals.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@ void updatePosEd(void)
void renderPosEdScreen(void)
{
blit32(120, 0, 200, 99, posEdBMP);
ui.updatePosEd = true;
}

void renderMuteButtons(void)
Expand Down

0 comments on commit dff7f1d

Please sign in to comment.