From 3cae0f3452233bc03ce5964e0bf7567798f35856 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Tue, 27 Jul 2010 18:45:32 +0000 Subject: SCI: kCheckFreeSpace support for sci1.1 and possible sci32 svn-id: r51383 --- engines/sci/engine/kernel_tables.h | 1 + engines/sci/engine/kfile.cpp | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h index ca4c8754a1..a2006a0578 100644 --- a/engines/sci/engine/kernel_tables.h +++ b/engines/sci/engine/kernel_tables.h @@ -312,6 +312,7 @@ static SciKernelMapEntry s_kernelMap[] = { { MAP_CALL(CelHigh), SIG_EVERYWHERE, "ii(i)", NULL, NULL }, { MAP_CALL(CelWide), SIG_EVERYWHERE, "ii(i)", NULL, NULL }, { MAP_CALL(CheckFreeSpace), SIG_SCI32, SIGFOR_ALL, "r.*", NULL, NULL }, + { MAP_CALL(CheckFreeSpace), SIG_SCI11, SIGFOR_ALL, "ri", NULL, NULL }, { MAP_CALL(CheckFreeSpace), SIG_EVERYWHERE, "r", NULL, NULL }, { MAP_CALL(CheckSaveGame), SIG_EVERYWHERE, ".*", NULL, NULL }, { MAP_CALL(Clone), SIG_EVERYWHERE, "o", NULL, NULL }, diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index 24c96be111..0cc562c7c1 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -365,11 +365,25 @@ reg_t kGetSaveDir(EngineState *s, int argc, reg_t *argv) { } reg_t kCheckFreeSpace(EngineState *s, int argc, reg_t *argv) { -#ifdef ENABLE_SCI32 - // TODO: SCI32 uses a parameter here. - if (argc > 1) - warning("kCheckFreeSpace called with %d parameter(s): %04x:%04x", argc, PRINT_REG(argv[1])); -#endif + if (argc > 1) { + // SCI1.1/SCI32 + // TODO: don't know if those are right for SCI32 as well + // Please note that sierra sci supported both calls either w/ or w/o opcode in SCI1.1 + switch (argv[1].toUint16()) { + case 0: // return saved game size + return make_reg(0, 0); // we return 0 + + case 1: // return free harddisc space (shifted right somehow) + return make_reg(0, 0x7fff); // we return maximum + + case 2: // same as call w/o opcode + break; + return make_reg(0, 1); + + default: + error("kCheckFreeSpace: called with unknown sub-op %d", argv[1].toUint16()); + } + } Common::String path = s->_segMan->getString(argv[0]); -- cgit v1.2.3