aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/he/logic
diff options
context:
space:
mode:
authorMatthew Hoops2012-06-08 22:22:38 -0400
committerMatthew Hoops2012-06-08 22:22:38 -0400
commite8ab1f5088fad1de4e8fa5d56bb1c518ee1008a8 (patch)
treed098c1a460559e529851cc0f4aeffbe20a8a6c7c /engines/scumm/he/logic
parentf22661e4b931609609fb785b503c1e534bfe14d7 (diff)
downloadscummvm-rg350-e8ab1f5088fad1de4e8fa5d56bb1c518ee1008a8.tar.gz
scummvm-rg350-e8ab1f5088fad1de4e8fa5d56bb1c518ee1008a8.tar.bz2
scummvm-rg350-e8ab1f5088fad1de4e8fa5d56bb1c518ee1008a8.zip
SCUMM: Implement listing playbook files in football2002
Diffstat (limited to 'engines/scumm/he/logic')
-rw-r--r--engines/scumm/he/logic/football.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/engines/scumm/he/logic/football.cpp b/engines/scumm/he/logic/football.cpp
index 73f9161d95..f67e07c475 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;
}