diff options
author | Matthew Hoops | 2010-01-30 02:40:15 +0000 |
---|---|---|
committer | Matthew Hoops | 2010-01-30 02:40:15 +0000 |
commit | bc64dfb52e09345b149071674db480aebe456a76 (patch) | |
tree | 09ae058b63fdd655f75d07c0b2071765078e2f2a /engines/sci/engine/kernel32.cpp | |
parent | da46fc9b35287237ad6f9336159703e605ef565c (diff) | |
download | scummvm-rg350-bc64dfb52e09345b149071674db480aebe456a76.tar.gz scummvm-rg350-bc64dfb52e09345b149071674db480aebe456a76.tar.bz2 scummvm-rg350-bc64dfb52e09345b149071674db480aebe456a76.zip |
Implement kString(Printf) and resizing of SCI32 strings in kFormat().
svn-id: r47697
Diffstat (limited to 'engines/sci/engine/kernel32.cpp')
-rw-r--r-- | engines/sci/engine/kernel32.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp index 1a63eceba9..31ea2ac1df 100644 --- a/engines/sci/engine/kernel32.cpp +++ b/engines/sci/engine/kernel32.cpp @@ -612,10 +612,18 @@ reg_t kString(EngineState *s, int argc, reg_t *argv) { return GET_SEL32(s->_segMan, argv[1], data); case 10: // Stringlen return make_reg(0, s->_segMan->strlen(argv[1])); - case 11: // Printf - // TODO: Return a new formatting string - warning("kString(Printf)"); - break; + case 11: { // Printf + reg_t stringHandle; + s->_segMan->allocateString(&stringHandle); + + reg_t *adjustedArgs = new reg_t[argc]; + adjustedArgs[0] = stringHandle; + memcpy(&adjustedArgs[1], argv + 1, argc - 1); + + kFormat(s, argc, adjustedArgs); + delete[] adjustedArgs; + return stringHandle; + } case 12: // Printf Buf return kFormat(s, argc - 1, argv + 1); case 13: { // atoi |