[Scummvm-cvs-logs] scummvm master -> e8ab1f5088fad1de4e8fa5d56bb1c518ee1008a8

clone2727 clone2727 at gmail.com
Sat Jun 9 04:24:42 CEST 2012


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

Summary:
e8ab1f5088 SCUMM: Implement listing playbook files in football2002


Commit: e8ab1f5088fad1de4e8fa5d56bb1c518ee1008a8
    https://github.com/scummvm/scummvm/commit/e8ab1f5088fad1de4e8fa5d56bb1c518ee1008a8
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2012-06-08T19:22:38-07:00

Commit Message:
SCUMM: Implement listing playbook files in football2002

Changed paths:
    engines/scumm/he/intern_he.h
    engines/scumm/he/logic/football.cpp



diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h
index cdc5faa..fc5e4bc 100644
--- a/engines/scumm/he/intern_he.h
+++ b/engines/scumm/he/intern_he.h
@@ -187,6 +187,8 @@ public:
 
 	Wiz *_wiz;
 
+	virtual int setupStringArray(int size);
+
 protected:
 	virtual void setupOpcodes();
 
@@ -201,7 +203,6 @@ protected:
 	virtual void clearDrawQueues();
 
 	int getStringCharWidth(byte chr);
-	virtual int setupStringArray(int size);
 	void appendSubstring(int dst, int src, int len2, int len);
 	void adjustRect(Common::Rect &rect);
 
@@ -258,6 +259,9 @@ public:
 
 	virtual void resetScumm();
 
+	virtual byte *getStringAddress(ResId idx);
+	virtual int setupStringArray(int size);
+
 protected:
 	virtual void setupOpcodes();
 
@@ -265,7 +269,6 @@ protected:
 	virtual void resetScummVars();
 	virtual void readArrayFromIndexFile();
 
-	virtual byte *getStringAddress(ResId idx);
 	virtual void readMAXS(int blockSize);
 
 	virtual void redrawBGAreas();
@@ -280,7 +283,6 @@ protected:
 	void copyArray(int array1, int a1_dim2start, int a1_dim2end, int a1_dim1start, int a1_dim1end,
 					int array2, int a2_dim2start, int a2_dim2end, int a2_dim1start, int a2_dim1end);
 	void copyArrayHelper(ArrayHeader *ah, int idx2, int idx1, int len1, byte **data, int *size, int *num);
-	virtual int setupStringArray(int size);
 	int readFileToArray(int slot, int32 size);
 	void writeFileFromArray(int slot, int32 resID);
 
diff --git a/engines/scumm/he/logic/football.cpp b/engines/scumm/he/logic/football.cpp
index 73f9161..f67e07c 100644
--- a/engines/scumm/he/logic/football.cpp
+++ b/engines/scumm/he/logic/football.cpp
@@ -20,6 +20,8 @@
  *
  */
 
+#include "common/savefile.h"
+
 #include "scumm/he/intern_he.h"
 #include "scumm/he/logic_he.h"
 
@@ -356,8 +358,30 @@ int LogicHEfootball2002::initScreenTranslations() {
 }
 
 int LogicHEfootball2002::getPlaybookFiles(int32 *args) {
-	// TODO: Get list of playbook files
-	error("STUB: LogicHEfootball2002::getPlaybookFiles()");
+	// Get the pattern and then skip over the directory prefix ("*\" or "*:")
+	Common::String pattern = (const char *)_vm->getStringAddress(args[0] & ~0x33539000) + 2;
+
+	// Prepare a buffer to hold the file names
+	char buffer[1000];
+	buffer[0] = 0;
+
+	// Get the list of file names that match the pattern and iterate over it
+	Common::StringArray fileList = _vm->getSaveFileManager()->listSavefiles(pattern);
+
+	for (uint32 i = 0; i < fileList.size() && strlen(buffer) < 970; i++) {
+		// Isolate the base part of the filename and concatenate it to our buffer
+		Common::String fileName = Common::String(fileList[i].c_str(), fileList[i].size() - (pattern.size() - 1));
+		strcat(buffer, fileName.c_str());
+		strcat(buffer, ">"); // names separated by '>'
+	}
+
+	// Now store the result in an array
+	int array = _vm->setupStringArray(strlen(buffer));
+	strcpy((char *)_vm->getStringAddress(array), buffer);
+
+	// And store the array index in variable 108
+	writeScummVar(108, array);
+
 	return 1;
 }
 






More information about the Scummvm-git-logs mailing list