[Scummvm-git-logs] scummvm master -> c6a6988a925627ba04fc5baaf297d83c59dbd6fb

ccawley2011 ccawley2011 at gmail.com
Sat Nov 9 19:37:40 CET 2019


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

Summary:
48ab35f358 RISCOS: Improve file system code
c6a6988a92 RISCOS: Reduce the required DigitalRenderer version


Commit: 48ab35f3589b27647279e51035581a6fee3c693d
    https://github.com/scummvm/scummvm/commit/48ab35f3589b27647279e51035581a6fee3c693d
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2019-11-09T18:30:21Z

Commit Message:
RISCOS: Improve file system code

Changed paths:
    backends/fs/riscos/riscos-fs.cpp
    backends/fs/riscos/riscos-fs.h


diff --git a/backends/fs/riscos/riscos-fs.cpp b/backends/fs/riscos/riscos-fs.cpp
index 338e7cf..5979ee4 100644
--- a/backends/fs/riscos/riscos-fs.cpp
+++ b/backends/fs/riscos/riscos-fs.cpp
@@ -22,7 +22,6 @@
 
 // Re-enable some forbidden symbols to avoid clashes with stat.h and unistd.h.
 #define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
-#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
 
 #include "common/scummsys.h"
 
@@ -33,12 +32,9 @@
 #include "backends/fs/stdiostream.h"
 #include "common/algorithm.h"
 
-#include <limits.h>
-#include <stdio.h>
+// TODO: Replace use of access()
 #include <unistd.h>
-#include <fcntl.h>
 
-#include <unixlib/local.h>
 #include <kernel.h>
 #include <swis.h>
 
@@ -55,11 +51,15 @@ bool RISCOSFilesystemNode::isWritable() const {
 }
 
 void RISCOSFilesystemNode::setFlags() {
-	int type = _swi(OS_File, _INR(0,1)|_RETURN(0), 20, RISCOS_Utils::toRISCOS(_path).c_str());
-	if (type == 0) {
+	_kernel_swi_regs regs;
+	regs.r[0] = 23;
+	regs.r[1] = (int)_nativePath.c_str();
+	_kernel_swi(OS_File, &regs, &regs);
+
+	if (regs.r[0] == 0) {
 		_isDirectory = false;
 		_isValid = false;
-	} else if (type == 2) {
+	} else if (regs.r[0] == 2) {
 		_isDirectory = true;
 		_isValid = true;
 	} else {
@@ -71,9 +71,11 @@ void RISCOSFilesystemNode::setFlags() {
 RISCOSFilesystemNode::RISCOSFilesystemNode(const Common::String &p) {
 	_path = p;
 	if (p == "/") {
+		_nativePath = "";
 		_isDirectory = true;
 		_isValid = true;
 	} else {
+		_nativePath = RISCOS_Utils::toRISCOS(p);
 		setFlags();
 	}
 }
@@ -100,47 +102,60 @@ bool RISCOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bo
 
 	if (_path == "/") {
 		// Special case for the root dir: List all drives
-		char fsname[PATH_MAX] = "";
+		char fsname[MAXPATHLEN] = "";
 		for (int fsNum = 0; fsNum < 256; fsNum += 1) {
-			_swi(OS_FSControl, _INR(0,3), 33, fsNum, fsname, sizeof(fsname));
-			if (strcmp(fsname, "") != 0) {
-				if (!(fsNum == 46 || fsNum == 53 || fsNum == 99)) {
-					int drives = 9;
-					if (fsNum == 193)
-						drives = 23;
-
-					for (int discnum = 0; discnum <= drives; discnum += 1) {
-						const Common::String path = Common::String::format("%s::%d.$", fsname, discnum);
-						char outpath[PATH_MAX] = "";
-						if(_swix(OS_FSControl, _INR(0,2)|_IN(5), 37, path.c_str(), outpath, sizeof(outpath)) == NULL) {
-							int exist;
-							if (_swix(OS_File, _INR(0,1)|_OUT(0), 23, outpath, &exist) != NULL || exist != 2)
-								continue;
-
-							RISCOSFilesystemNode *entry = new RISCOSFilesystemNode();
-							entry->_isDirectory = true;
-							entry->_isValid = true;
-							entry->_path = Common::String::format("/%s", outpath);
-							entry->_displayName = outpath;
-							myList.push_back(entry);
-						}
-					}
-				}
+			if (fsNum == 33 || fsNum == 46 || fsNum == 53 || fsNum == 99)
+				continue;
+
+			_kernel_swi_regs regs;
+			regs.r[0] = 33;
+			regs.r[1] = fsNum;
+			regs.r[2] = (int)fsname;
+			regs.r[3] = sizeof(fsname);
+			_kernel_swi(OS_FSControl, &regs, &regs);
+			if (fsname[0] == 0)
+				continue;
+
+			int drives = (fsNum == 193) ? 23 : 9;
+
+			for (int discnum = 0; discnum <= drives; discnum += 1) {
+				const Common::String path = Common::String::format("%s::%d.$", fsname, discnum);
+				char outpath[MAXPATHLEN] = "";
+				regs.r[0] = 37;
+				regs.r[1] = (int)path.c_str();
+				regs.r[2] = (int)outpath;
+				regs.r[3] = 0;
+				regs.r[4] = 0;
+				regs.r[5] = sizeof(outpath);
+				if (_kernel_swi(OS_FSControl, &regs, &regs) != NULL)
+					continue;
+
+				RISCOSFilesystemNode *entry = new RISCOSFilesystemNode();
+				entry->_nativePath = outpath;
+				entry->_path = Common::String('/') + outpath;
+				entry->_displayName = outpath;
+				entry->setFlags();
+				if (entry->_isDirectory)
+					myList.push_back(entry);
 			}
 		}
 		return true;
 	}
 
-	int count = 0;
-	int read = 0;
-	char file[PATH_MAX];
-	Common::String dir = _path;
-
-	while (count != -1) {
-		_swix(OS_GBPB, _INR(0,5)|_OUTR(3,4), 9, RISCOS_Utils::toRISCOS(dir).c_str(), file, 1, count, sizeof(file), &read, &count);
-
-		if (count == -1)
-			continue;
+	char file[MAXPATHLEN];
+	_kernel_swi_regs regs;
+	regs.r[0] = 9;
+	regs.r[1] = (int)_nativePath.c_str();
+	regs.r[2] = (int)file;
+	regs.r[3] = 1;
+	regs.r[4] = 0;
+	regs.r[5] = sizeof(file);
+	regs.r[6] = 0;
+	while (regs.r[4] != -1) {
+		_kernel_swi(OS_GBPB, &regs, &regs);
+
+		if (regs.r[4] == -1)
+			break;
 
 		// Start with a clone of this node, with the correct path set
 		RISCOSFilesystemNode entry(*this);
@@ -149,15 +164,10 @@ bool RISCOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bo
 		if (_path.lastChar() != '/')
 			entry._path += '/';
 		entry._path += entry._displayName;
-
-		int type = _swi(OS_File, _INR(0,1)|_RETURN(0), 20, RISCOS_Utils::toRISCOS(entry._path).c_str());
-		if (type == 0) {
+		entry._nativePath = RISCOS_Utils::toRISCOS(entry._path);
+		entry.setFlags();
+		if (!entry._isValid)
 			continue;
-		} else if (type == 2) {
-			entry._isDirectory = true;
-		} else {
-			entry._isDirectory = false;
-		}
 
 		// Honor the chosen mode
 		if ((mode == Common::FSNode::kListFilesOnly && entry._isDirectory) ||
@@ -205,7 +215,10 @@ Common::WriteStream *RISCOSFilesystemNode::createWriteStream() {
 }
 
 bool RISCOSFilesystemNode::createDirectory() {
-	if (_swix(OS_File, _INR(0,1), 8, RISCOS_Utils::toRISCOS(_path).c_str()) == NULL)
+	_kernel_swi_regs regs;
+	regs.r[0] = 8;
+	regs.r[1] = (int)_nativePath.c_str();
+	if (_kernel_swi(OS_File, &regs, &regs) == NULL)
 		setFlags();
 
 	return _isValid && _isDirectory;
diff --git a/backends/fs/riscos/riscos-fs.h b/backends/fs/riscos/riscos-fs.h
index f068022..e3640e5 100644
--- a/backends/fs/riscos/riscos-fs.h
+++ b/backends/fs/riscos/riscos-fs.h
@@ -33,6 +33,7 @@
 class RISCOSFilesystemNode : public AbstractFSNode {
 protected:
 	Common::String _displayName;
+	Common::String _nativePath;
 	Common::String _path;
 	bool _isDirectory;
 	bool _isValid;


Commit: c6a6988a925627ba04fc5baaf297d83c59dbd6fb
    https://github.com/scummvm/scummvm/commit/c6a6988a925627ba04fc5baaf297d83c59dbd6fb
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2019-11-09T18:36:48Z

Commit Message:
RISCOS: Reduce the required DigitalRenderer version

Changed paths:
    dists/riscos/!Run,feb


diff --git a/dists/riscos/!Run,feb b/dists/riscos/!Run,feb
index ec1591b..1b5f769 100644
--- a/dists/riscos/!Run,feb
+++ b/dists/riscos/!Run,feb
@@ -5,8 +5,8 @@ Set Alias$RMLoadIfThere IfThere %%0 Then RMLoad %%*0
 RMEnsure SharedUnixLibrary 1.14 RMLoadIfThere System:Modules.SharedULib
 RMEnsure SharedUnixLibrary 1.14 Error ScummVM requires SharedUnixLibrary 1.14 or later. This can be downloaded from https://www.riscos.info/packages/LibraryDetails.html#SharedUnixLibrary
 
-RMEnsure DigitalRenderer 0.56 RMLoadIfThere System:Modules.DRenderer
-RMEnsure DigitalRenderer 0.56 Error ScummVM requires DigitalRenderer 0.56 or later. This can be downloaded from https://www.riscos.info/packages/LibraryDetails.html#DRenderer
+RMEnsure DigitalRenderer 0.55 RMLoadIfThere System:Modules.DRenderer
+RMEnsure DigitalRenderer 0.55 Error ScummVM requires DigitalRenderer 0.55 or later. This can be downloaded from https://www.riscos.info/packages/LibraryDetails.html#DRenderer
 
 RMEnsure Iconv 0.12 RMLoadIfThere System:Modules.Iconv
 RMEnsure Iconv 0.12 Error ScummVM requires Iconv 0.12 or later. This can be downloaded from https://www.netsurf-browser.org/projects/iconv/





More information about the Scummvm-git-logs mailing list