shithub: pt2-clone

Download patch

ref: dff7f1d51ef505477cd408ce51b789059f749831
parent: 871c59c2513acc611f3b1f4242453fc3bd1f6460
author: Olav Sørensen <olav.sorensen@live.no>
date: Fri Dec 9 07:46:52 EST 2022

Disk Op. bugfix for "ask dialogs"

- Disk Op.: Fixed a bug from v1.54 where sequential ask dialogs resulted in an empty file list inbetween the two dialogs

--- a/src/pt2_askbox.c
+++ b/src/pt2_askbox.c
@@ -96,16 +96,18 @@
 
 	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)
 	{
--- a/src/pt2_header.h
+++ b/src/pt2_header.h
@@ -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 '\\'
--- a/src/pt2_mouse.c
+++ b/src/pt2_mouse.c
@@ -3548,17 +3548,26 @@
 
 		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;
 
@@ -3758,17 +3767,26 @@
 
 		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;
 
--- a/src/pt2_visuals.c
+++ b/src/pt2_visuals.c
@@ -860,6 +860,7 @@
 void renderPosEdScreen(void)
 {
 	blit32(120, 0, 200, 99, posEdBMP);
+	ui.updatePosEd = true;
 }
 
 void renderMuteButtons(void)