[Scummvm-git-logs] scummvm master -> 0cd1383698986839df1a3b8fc25d111ce275ca86

sev- noreply at scummvm.org
Mon Apr 20 18:21:26 UTC 2026


This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
7cb4da96d3 MADS: PHANTOM: Remove some non-portable stuff
d8d2a794c6 MADS: PHANTOM: Fix incorrect comparison
f4759ece20 MADS: PHANTOM: Remove more non-portable unused stuff
e81276497f MADS: PHANTOM: More compilation fixes, some code just commented out
52eaafb6b6 MADS: PHANTOM: Use portable C functions
0cd1383698 MADS: PHANTOM: Remove dos-style error hanling


Commit: 7cb4da96d34b8b67be5c2d7b9cb13a54b8c8cb8d
    https://github.com/scummvm/scummvm/commit/7cb4da96d34b8b67be5c2d7b9cb13a54b8c8cb8d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-04-20T20:11:15+02:00

Commit Message:
MADS: PHANTOM: Remove some non-portable stuff

Changed paths:
    engines/mads/madsv2/core/env.cpp
    engines/mads/madsv2/core/env.h
    engines/mads/madsv2/core/general.h
    engines/mads/madsv2/core/vocab.cpp


diff --git a/engines/mads/madsv2/core/env.cpp b/engines/mads/madsv2/core/env.cpp
index f1123af21bb..22d1fbf2089 100644
--- a/engines/mads/madsv2/core/env.cpp
+++ b/engines/mads/madsv2/core/env.cpp
@@ -530,44 +530,6 @@ int env_exist(const char *filename) {
 	return exist;
 }
 
-char *env_dos_error_name(char *error_buf) {
-	switch (errno) {
-	case EEXIST:
-		Common::strcpy_s(error_buf, 65536, "File already exists.");
-		break;
-
-	case EINVAL:
-		Common::strcpy_s(error_buf, 65536, "Invalid argument.");
-		break;
-
-	case EMFILE:
-		Common::strcpy_s(error_buf, 65536, "Too many open files.");
-		break;
-
-	case ENOENT:
-		Common::strcpy_s(error_buf, 65536, "No such file or directory.");
-		break;
-
-	case ENOSPC:
-		Common::strcpy_s(error_buf, 65536, "Disk full.");
-		break;
-
-	case EACCES:
-		Common::strcpy_s(error_buf, 65536, "Permission denied.");
-		break;
-
-	case EBADF:
-		Common::strcpy_s(error_buf, 65536, "Bad file number.");
-		break;
-
-	default:
-		Common::sprintf_s(error_buf, 65536, "Error Code %d.", errno);
-		break;
-	}
-
-	return error_buf;
-}
-
 char *env_get_level_path(char *out, int item_type, const char *file_spec, int first_level, int second_level) {
 	char temp_buf[80];
 	char *result;
diff --git a/engines/mads/madsv2/core/env.h b/engines/mads/madsv2/core/env.h
index a3ca7293120..37cf6bf63d1 100644
--- a/engines/mads/madsv2/core/env.h
+++ b/engines/mads/madsv2/core/env.h
@@ -81,7 +81,6 @@ extern long env_get_file_size(Common::SeekableReadStream *handle);
 extern char *env_get_path(char *madspath, const char *infile);
 extern char *env_catint(char *out, int value, int digits);
 extern char *env_fill_path(char *path, int env_mode, int env_room);
-extern char *env_dos_error_name(char *error_buf);
 extern char *env_get_level_path(char *out, int item_type, const char *file_spec,
 	int first_level, int second_level);
 extern Common::SeekableReadStream *env_open_level(int item_type, const char *file_spec,
diff --git a/engines/mads/madsv2/core/general.h b/engines/mads/madsv2/core/general.h
index c7a2b86b6d2..2a78c61d33b 100644
--- a/engines/mads/madsv2/core/general.h
+++ b/engines/mads/madsv2/core/general.h
@@ -86,8 +86,6 @@ extern long _timer_clock;
 #define timer_speed_300       3920    /* 300/s */
 #define timer_speed_60        19600   /* 60/s  */
 
-#define wait_state()          _asm {jmp short $+2}
-
 
 /* video defines */
 
diff --git a/engines/mads/madsv2/core/vocab.cpp b/engines/mads/madsv2/core/vocab.cpp
index 4c27dbb6365..635ba66fe35 100644
--- a/engines/mads/madsv2/core/vocab.cpp
+++ b/engines/mads/madsv2/core/vocab.cpp
@@ -205,7 +205,7 @@ int vocab_load(int allocation_flag) {
 						} else {
 							result = VC_ERR_WORDTOOLONG;
 						}
-					}					
+					}
 				}
 
 				delete handle;
@@ -354,8 +354,7 @@ void vocab_report_error(int number) {
 	}
 
 	if (dos_flag) {
-		env_dos_error_name(temp_buf_3);
-		dialog_alert_ok(temp_buf_1, temp_buf_2, temp_buf_3, NULL);
+		dialog_alert_ok(temp_buf_1, temp_buf_2, "Error", NULL);
 	} else {
 		dialog_alert_ok(temp_buf_1, NULL, NULL, NULL);
 	}


Commit: d8d2a794c6ac550120ab50de893ffb864cd10d98
    https://github.com/scummvm/scummvm/commit/d8d2a794c6ac550120ab50de893ffb864cd10d98
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-04-20T20:11:47+02:00

Commit Message:
MADS: PHANTOM: Fix incorrect comparison

Changed paths:
    engines/mads/madsv2/core/buffer.cpp


diff --git a/engines/mads/madsv2/core/buffer.cpp b/engines/mads/madsv2/core/buffer.cpp
index 3ba248cf189..da11790ec70 100644
--- a/engines/mads/madsv2/core/buffer.cpp
+++ b/engines/mads/madsv2/core/buffer.cpp
@@ -929,7 +929,7 @@ int buffer_to_disk(Buffer *source, int x, int y, int xs, int ys) {
 	buffer_tracking[buffer_accum] = true;
 
 	handle = g_system->getSavefileManager()->openForSaving(file_name, false);
-	if (handle = nullptr)
+	if (handle == nullptr)
 		goto done;
 
 	for (count = 0; count < ys; count++) {


Commit: f4759ece201cd323985fc0d57558c8bdc2fc7d07
    https://github.com/scummvm/scummvm/commit/f4759ece201cd323985fc0d57558c8bdc2fc7d07
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-04-20T20:13:20+02:00

Commit Message:
MADS: PHANTOM: Remove more non-portable unused stuff

Changed paths:
    engines/mads/madsv2/core/fileio.cpp
    engines/mads/madsv2/core/fileio.h


diff --git a/engines/mads/madsv2/core/fileio.cpp b/engines/mads/madsv2/core/fileio.cpp
index e865e9bbcd3..fbcee18c714 100644
--- a/engines/mads/madsv2/core/fileio.cpp
+++ b/engines/mads/madsv2/core/fileio.cpp
@@ -52,26 +52,6 @@ void fileio_purge_trailing_spaces(char *myline) {
 	} while (again);
 }
 
-void fileio_name_new_ext(char *bakfile, char *mainfile, char *new_ext) {
-	char temp_full[80];
-	char temp_drive[4];
-	char temp_dir[80];
-	char temp_name[10];
-	char temp_ext[8];
-
-	Common::strcpy_s(temp_dir, mainfile);
-
-	mads_fullpath(temp_full, temp_dir, 80);
-
-	_splitpath(temp_full, temp_drive, temp_dir, temp_name, temp_ext);
-
-	Common::strcpy_s(bakfile, 65536, temp_drive);
-	Common::strcat_s(bakfile, 65536, temp_dir);
-	Common::strcat_s(bakfile, 65536, temp_name);
-	Common::strcat_s(bakfile, 65536, new_ext);
-}
-
-
 char *fileio_ffgets(char *mystring, int num, Common::SeekableReadStream *stream) {
 	char *temp;
 	char *from;
diff --git a/engines/mads/madsv2/core/fileio.h b/engines/mads/madsv2/core/fileio.h
index e5bc6cf3b54..eb053be9f57 100644
--- a/engines/mads/madsv2/core/fileio.h
+++ b/engines/mads/madsv2/core/fileio.h
@@ -33,7 +33,6 @@ extern bool fileio_suppress_unbuffering;
 
 
 extern void fileio_purge_trailing_spaces(char *myline);
-extern void fileio_name_new_ext(char *bakfile, char *mainfile, const char *new_ext);
 extern char *fileio_ffgets(char *mystring, int num, Common::SeekableReadStream *stream);
 extern int fileio_ffputs(const char *mystring, Common::WriteStream *stream);
 extern char *fileio_fix_lf_input(char *mystring);


Commit: e81276497f8ce8bcf999e34ba7bc2ec1a1812991
    https://github.com/scummvm/scummvm/commit/e81276497f8ce8bcf999e34ba7bc2ec1a1812991
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-04-20T20:15:54+02:00

Commit Message:
MADS: PHANTOM: More compilation fixes, some code just commented out

Changed paths:
    engines/mads/madsv2/core/matte.cpp
    engines/mads/madsv2/core/xms.h


diff --git a/engines/mads/madsv2/core/matte.cpp b/engines/mads/madsv2/core/matte.cpp
index 28d7a9826a9..fa4602a7e73 100644
--- a/engines/mads/madsv2/core/matte.cpp
+++ b/engines/mads/madsv2/core/matte.cpp
@@ -447,7 +447,8 @@ static void combine_mattes(MattePtr matte1, MattePtr matte2) {
 	/* Mark matte2 as EMPTY, but leave behind a pointer to matte1 */
 
 	matte2->valid = false;
-	matte2->y = (int)matte1;
+	//matte2->y = (int)matte1;
+	error("FIXME: Horrible non-portable cast from pointer to (int)");
 
 	/* Set matte1's update flag TRUE; we need to redraw everything in */
 	/* this matte.                                                    */
diff --git a/engines/mads/madsv2/core/xms.h b/engines/mads/madsv2/core/xms.h
index c0039e3f784..d78be452edd 100644
--- a/engines/mads/madsv2/core/xms.h
+++ b/engines/mads/madsv2/core/xms.h
@@ -41,7 +41,7 @@ extern word xms_umb_list[XMS_MAX_UMB];
 extern word xms_umb_mark;
 
 inline int xms_detect() { return 0; }
-inline long xms_umb_get_avail() {}
+inline long xms_umb_get_avail() { return 0;}
 inline void *xms_umb_get(long mem_to_get) { return nullptr; }
 inline void xms_umb_free(void *mem_to_free) {}
 inline void xms_umb_purge() {}


Commit: 52eaafb6b62aa1f6ba14dea43374762a657bf043
    https://github.com/scummvm/scummvm/commit/52eaafb6b62aa1f6ba14dea43374762a657bf043
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-04-20T20:17:16+02:00

Commit Message:
MADS: PHANTOM: Use portable C functions

Changed paths:
    engines/mads/madsv2/core/popup.cpp


diff --git a/engines/mads/madsv2/core/popup.cpp b/engines/mads/madsv2/core/popup.cpp
index 155f66909d6..2cdcbcd0db6 100644
--- a/engines/mads/madsv2/core/popup.cpp
+++ b/engines/mads/madsv2/core/popup.cpp
@@ -1040,7 +1040,7 @@ int popup_ask_number(long *value, int maxlen, int save_screen) {
 	popup_asking_number = true;
 
 	if (value) {
-		ltoa(*value, temp_buf, 10);
+		snprintf(temp_buf, 80, "%ld", *value);
 	} else {
 		temp_buf[0] = 0;
 	}


Commit: 0cd1383698986839df1a3b8fc25d111ce275ca86
    https://github.com/scummvm/scummvm/commit/0cd1383698986839df1a3b8fc25d111ce275ca86
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-04-20T20:20:36+02:00

Commit Message:
MADS: PHANTOM: Remove dos-style error hanling

We check for file existence, so there is no need to double check
with `errno`

Changed paths:
    engines/mads/madsv2/core/room.cpp
    engines/mads/madsv2/core/vocab.cpp


diff --git a/engines/mads/madsv2/core/room.cpp b/engines/mads/madsv2/core/room.cpp
index a3092bed29b..c1991a311a9 100644
--- a/engines/mads/madsv2/core/room.cpp
+++ b/engines/mads/madsv2/core/room.cpp
@@ -100,33 +100,27 @@ int room_read_def(int room_code, char *room_file, char *picture_base, int mads_m
 			Common::strcpy_s(picture_base, 65536, roomdef.picture_base);
 
 	} else {
-		if (errno == ENOENT) {
+		roomdef.num_hotspots = 0;
+		roomdef.num_rails = 0;
 
-			roomdef.num_hotspots = 0;
-			roomdef.num_rails = 0;
-
-			for (count = 0; count < 10; count++) {
-				roomdef.misc[count] = 0;
-			}
-
-			roomdef.front_y = display_y - 1;
-			roomdef.back_y = 0;
-			roomdef.front_scale = 100;
-			roomdef.back_scale = 100;
+		for (count = 0; count < 10; count++) {
+			roomdef.misc[count] = 0;
+		}
 
-			for (count = 0; count < 16; count++) {
-				roomdef.depth_table[count] = 0;
-			}
+		roomdef.front_y = display_y - 1;
+		roomdef.back_y = 0;
+		roomdef.front_scale = 100;
+		roomdef.back_scale = 100;
 
-			roomdef.shadow.num_shadow_colors = 0;
+		for (count = 0; count < 16; count++) {
+			roomdef.depth_table[count] = 0;
+		}
 
-			Common::strcpy_s(roomdef.picture_base, picture_base);
+		roomdef.shadow.num_shadow_colors = 0;
 
-			result = 0;
+		Common::strcpy_s(roomdef.picture_base, picture_base);
 
-		} else {
-			result = -1;
-		}
+		result = 0;
 	}
 
 done:
@@ -443,48 +437,42 @@ int room_read_pict(int room_code, char *room_file, int mads_mode) {
 		result = !fileio_fread_f(&roompict, sizeof(RoomPict), 1, &handle);
 		roompict.id = room_code;
 	} else {
-		if (errno == ENOENT) {
-
-			roompict.id = room_code;
-			roompict.picture_id = room_code;
-			roompict.format = ROOM_FORMAT_NORMAL;
-
-			roompict.xs = video_x;
-			roompict.ys = display_y;
-
-			for (count = 0; count < 10; count++) {
-				roompict.misc[count] = 0;
-			}
+		roompict.id = room_code;
+		roompict.picture_id = room_code;
+		roompict.format = ROOM_FORMAT_NORMAL;
 
-			roompict.num_series = 0;
-			roompict.num_images = 0;
+		roompict.xs = video_x;
+		roompict.ys = display_y;
 
-			roompict.num_variants = 0;
-			roompict.num_translated = 0;
+		for (count = 0; count < 10; count++) {
+			roompict.misc[count] = 0;
+		}
 
-			roompict.color_list.num_colors = 0;
-			roompict.cycle_list.num_cycles = 0;
+		roompict.num_series = 0;
+		roompict.num_images = 0;
 
-			Common::strcpy_s(roompict.variant_desc[0], "The One True Variant");
-			Common::strcpy_s(roompict.variant_desc[1], "False Variant");
-			Common::strcpy_s(roompict.variant_desc[2], "Blasphemous Variant");
-			Common::strcpy_s(roompict.variant_desc[3], "Heretical Variant");
-			Common::strcpy_s(roompict.variant_desc[4], "Usurper Variant");
-			Common::strcpy_s(roompict.variant_desc[5], "Untrue Variant");
-			Common::strcpy_s(roompict.variant_desc[6], "Most Untrue Variant");
-			Common::strcpy_s(roompict.variant_desc[7], "Why so many variants, eh, boy?");
-			Common::strcpy_s(roompict.variant_desc[8], "Geez, guys! C'moff it already!");
-			Common::strcpy_s(roompict.variant_desc[9], "And THAT is absolutely IT, dammit!");
+		roompict.num_variants = 0;
+		roompict.num_translated = 0;
 
-			if (!mads_mode) {
-				Common::strcpy_s(roompict.artwork_file, room_file);
-			}
+		roompict.color_list.num_colors = 0;
+		roompict.cycle_list.num_cycles = 0;
 
-			result = 0;
+		Common::strcpy_s(roompict.variant_desc[0], "The One True Variant");
+		Common::strcpy_s(roompict.variant_desc[1], "False Variant");
+		Common::strcpy_s(roompict.variant_desc[2], "Blasphemous Variant");
+		Common::strcpy_s(roompict.variant_desc[3], "Heretical Variant");
+		Common::strcpy_s(roompict.variant_desc[4], "Usurper Variant");
+		Common::strcpy_s(roompict.variant_desc[5], "Untrue Variant");
+		Common::strcpy_s(roompict.variant_desc[6], "Most Untrue Variant");
+		Common::strcpy_s(roompict.variant_desc[7], "Why so many variants, eh, boy?");
+		Common::strcpy_s(roompict.variant_desc[8], "Geez, guys! C'moff it already!");
+		Common::strcpy_s(roompict.variant_desc[9], "And THAT is absolutely IT, dammit!");
 
-		} else {
-			result = -1;
+		if (!mads_mode) {
+			Common::strcpy_s(roompict.artwork_file, room_file);
 		}
+
+		result = 0;
 	}
 
 done:
diff --git a/engines/mads/madsv2/core/vocab.cpp b/engines/mads/madsv2/core/vocab.cpp
index 635ba66fe35..7eea99fb4d2 100644
--- a/engines/mads/madsv2/core/vocab.cpp
+++ b/engines/mads/madsv2/core/vocab.cpp
@@ -129,11 +129,7 @@ int vocab_load(int allocation_flag) {
 						result = VC_ERR_READMAINFILE;
 					}
 				} else {
-					if (errno == ENOENT) {
-						vocab_exist = false;
-					} else {
-						result = VC_ERR_OPENMAINFILE;
-					}
+					vocab_exist = false;
 				}
 			} else {
 				result = VC_ERR_READHARDFILE;




More information about the Scummvm-git-logs mailing list