diff options
author | Max Horn | 2009-09-14 13:27:09 +0000 |
---|---|---|
committer | Max Horn | 2009-09-14 13:27:09 +0000 |
commit | 8ac3db080131713a4c7aa50f46557f3e6c726356 (patch) | |
tree | db0b2b6a70c87e937232a96651351685a2b353a1 /engines/sci | |
parent | 0e834d0b87ac62fd10377948a8c4fb6563783636 (diff) | |
download | scummvm-rg350-8ac3db080131713a4c7aa50f46557f3e6c726356.tar.gz scummvm-rg350-8ac3db080131713a4c7aa50f46557f3e6c726356.tar.bz2 scummvm-rg350-8ac3db080131713a4c7aa50f46557f3e6c726356.zip |
SCI: Rename SegManager::kernelDeref*() methods to SegManager::deref*()
svn-id: r44083
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/kfile.cpp | 66 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 20 | ||||
-rw-r--r-- | engines/sci/engine/kmenu.cpp | 6 | ||||
-rw-r--r-- | engines/sci/engine/kmisc.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/kpathing.cpp | 10 | ||||
-rw-r--r-- | engines/sci/engine/kstring.cpp | 46 | ||||
-rw-r--r-- | engines/sci/engine/seg_manager.cpp | 6 | ||||
-rw-r--r-- | engines/sci/engine/seg_manager.h | 6 | ||||
-rw-r--r-- | engines/sci/engine/stringfrag.cpp | 30 | ||||
-rw-r--r-- | engines/sci/gfx/menubar.cpp | 4 |
10 files changed, 101 insertions, 101 deletions
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index dac1c31cec..51ef1ddb7c 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -197,7 +197,7 @@ void file_open(EngineState *s, const char *filename, int mode) { } reg_t kFOpen(EngineState *s, int, int argc, reg_t *argv) { - char *name = s->segMan->kernelDerefString(argv[0]); + char *name = s->segMan->derefString(argv[0]); int mode = argv[1].toUint16(); debug(3, "kFOpen(%s,0x%x)", name, mode); @@ -250,7 +250,7 @@ void fwrite_wrapper(EngineState *s, int handle, char *data, int length) { reg_t kFPuts(EngineState *s, int, int argc, reg_t *argv) { int handle = argv[0].toUint16(); - char *data = s->segMan->kernelDerefString(argv[1]); + char *data = s->segMan->derefString(argv[1]); fwrite_wrapper(s, handle, data, strlen(data)); return s->r_acc; @@ -307,7 +307,7 @@ static void fseek_wrapper(EngineState *s, int handle, int offset, int whence) { } reg_t kFGets(EngineState *s, int, int argc, reg_t *argv) { - char *dest = s->segMan->kernelDerefString(argv[0]); + char *dest = s->segMan->derefString(argv[0]); int maxsize = argv[1].toUint16(); int handle = argv[2].toUint16(); @@ -320,7 +320,7 @@ reg_t kFGets(EngineState *s, int, int argc, reg_t *argv) { * Writes the cwd to the supplied address and returns the address in acc. */ reg_t kGetCWD(EngineState *s, int, int argc, reg_t *argv) { - char *targetaddr = s->segMan->kernelDerefString(argv[0]); + char *targetaddr = s->segMan->derefString(argv[0]); // We do not let the scripts see the file system, instead pretending // we are always in the same directory. @@ -356,8 +356,8 @@ reg_t kDeviceInfo(EngineState *s, int, int argc, reg_t *argv) { switch (mode) { case K_DEVICE_INFO_GET_DEVICE: - input_s = s->segMan->kernelDerefString(argv[1]); - output_s = s->segMan->kernelDerefString(argv[2]); + input_s = s->segMan->derefString(argv[1]); + output_s = s->segMan->derefString(argv[2]); assert(input_s != output_s); strcpy(output_s, "/"); @@ -365,15 +365,15 @@ reg_t kDeviceInfo(EngineState *s, int, int argc, reg_t *argv) { break; case K_DEVICE_INFO_GET_CURRENT_DEVICE: - output_s = s->segMan->kernelDerefString(argv[1]); + output_s = s->segMan->derefString(argv[1]); strcpy(output_s, "/"); debug(3, "K_DEVICE_INFO_GET_CURRENT_DEVICE() -> %s", output_s); break; case K_DEVICE_INFO_PATHS_EQUAL: { - char *path1_s = s->segMan->kernelDerefString(argv[1]); - char *path2_s = s->segMan->kernelDerefString(argv[2]); + char *path1_s = s->segMan->derefString(argv[1]); + char *path2_s = s->segMan->derefString(argv[2]); debug(3, "K_DEVICE_INFO_PATHS_EQUAL(%s,%s)", path1_s, path2_s); return make_reg(0, Common::matchString(path2_s, path1_s, true)); @@ -381,7 +381,7 @@ reg_t kDeviceInfo(EngineState *s, int, int argc, reg_t *argv) { break; case K_DEVICE_INFO_IS_FLOPPY: - input_s = s->segMan->kernelDerefString(argv[1]); + input_s = s->segMan->derefString(argv[1]); debug(3, "K_DEVICE_INFO_IS_FLOPPY(%s)", input_s); return NULL_REG; /* Never */ @@ -390,8 +390,8 @@ reg_t kDeviceInfo(EngineState *s, int, int argc, reg_t *argv) { ** for more information on our workaround for this. */ case K_DEVICE_INFO_GET_SAVECAT_NAME: { - output_s = s->segMan->kernelDerefString(argv[1]); - game_prefix = s->segMan->kernelDerefString(argv[2]); + output_s = s->segMan->derefString(argv[1]); + game_prefix = s->segMan->derefString(argv[2]); sprintf(output_s, "__throwaway"); debug(3, "K_DEVICE_INFO_GET_SAVECAT_NAME(%s) -> %s", game_prefix, output_s); @@ -399,8 +399,8 @@ reg_t kDeviceInfo(EngineState *s, int, int argc, reg_t *argv) { break; case K_DEVICE_INFO_GET_SAVEFILE_NAME: { - output_s = s->segMan->kernelDerefString(argv[1]); - game_prefix = s->segMan->kernelDerefString(argv[2]); + output_s = s->segMan->derefString(argv[1]); + game_prefix = s->segMan->derefString(argv[2]); int savegame_id = argv[3].toUint16(); sprintf(output_s, "__throwaway"); debug(3, "K_DEVICE_INFO_GET_SAVEFILE_NAME(%s,%d) -> %s", game_prefix, savegame_id, output_s); @@ -428,7 +428,7 @@ reg_t kGetSaveDir(EngineState *s, int, int argc, reg_t *argv) { } reg_t kCheckFreeSpace(EngineState *s, int, int argc, reg_t *argv) { - char *path = s->segMan->kernelDerefString(argv[0]); + char *path = s->segMan->derefString(argv[0]); debug(3, "kCheckFreeSpace(%s)", path); // We simply always pretend that there is enough space. @@ -486,7 +486,7 @@ void listSavegames(Common::Array<SavegameDesc> &saves) { } reg_t kCheckSaveGame(EngineState *s, int, int argc, reg_t *argv) { - char *game_id = s->segMan->kernelDerefString(argv[0]); + char *game_id = s->segMan->derefString(argv[0]); int savedir_nr = argv[1].toUint16(); debug(3, "kCheckSaveGame(%s, %d)", game_id, savedir_nr); @@ -522,10 +522,10 @@ reg_t kCheckSaveGame(EngineState *s, int, int argc, reg_t *argv) { } reg_t kGetSaveFiles(EngineState *s, int, int argc, reg_t *argv) { - char *game_id = s->segMan->kernelDerefString(argv[0]); - char *nametarget = s->segMan->kernelDerefString(argv[1]); + char *game_id = s->segMan->derefString(argv[0]); + char *nametarget = s->segMan->derefString(argv[1]); reg_t nametarget_base = argv[1]; - reg_t *nameoffsets = s->segMan->kernelDerefRegPtr(argv[2], 0); + reg_t *nameoffsets = s->segMan->derefRegPtr(argv[2], 0); debug(3, "kGetSaveFiles(%s,%s)", game_id, nametarget); @@ -572,11 +572,11 @@ reg_t kGetSaveFiles(EngineState *s, int, int argc, reg_t *argv) { } reg_t kSaveGame(EngineState *s, int, int argc, reg_t *argv) { - char *game_id = s->segMan->kernelDerefString(argv[0]); + char *game_id = s->segMan->derefString(argv[0]); int savedir_nr = argv[1].toUint16(); int savedir_id; // Savegame ID, derived from savedir_nr and the savegame ID list - char *game_description = s->segMan->kernelDerefString(argv[2]); - char *version = argc > 3 ? strdup(s->segMan->kernelDerefString(argv[3])) : NULL; + char *game_description = s->segMan->derefString(argv[2]); + char *version = argc > 3 ? strdup(s->segMan->derefString(argv[3])) : NULL; debug(3, "kSaveGame(%s,%d,%s,%s)", game_id, savedir_nr, game_description, version); s->game_version = version; @@ -645,7 +645,7 @@ reg_t kSaveGame(EngineState *s, int, int argc, reg_t *argv) { } reg_t kRestoreGame(EngineState *s, int, int argc, reg_t *argv) { - char *game_id = s->segMan->kernelDerefString(argv[0]); + char *game_id = s->segMan->derefString(argv[0]); int savedir_nr = argv[1].toUint16(); debug(3, "kRestoreGame(%s,%d)", game_id, savedir_nr); @@ -684,7 +684,7 @@ reg_t kRestoreGame(EngineState *s, int, int argc, reg_t *argv) { } reg_t kValidPath(EngineState *s, int, int argc, reg_t *argv) { - const char *path = s->segMan->kernelDerefString(argv[0]); + const char *path = s->segMan->derefString(argv[0]); // FIXME: For now, we only accept the (fake) root dir "/" as a valid path. s->r_acc = make_reg(0, 0 == strcmp(path, "/")); @@ -735,7 +735,7 @@ void DirSeeker::nextFile() { return; } - char *mem = _vm->segMan->kernelDerefString(_outbuffer); + char *mem = _vm->segMan->derefString(_outbuffer); memset(mem, 0, 13); // TODO: Transform the string back into a format usable by the SCI scripts. @@ -756,7 +756,7 @@ reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) { switch (func_nr) { case K_FILEIO_OPEN : { - char *name = s->segMan->kernelDerefString(argv[1]); + char *name = s->segMan->derefString(argv[1]); int mode = argv[2].toUint16(); file_open(s, name, mode); @@ -772,7 +772,7 @@ reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) { } case K_FILEIO_READ_RAW : { int handle = argv[1].toUint16(); - char *dest = s->segMan->kernelDerefString(argv[2]); + char *dest = s->segMan->derefString(argv[2]); int size = argv[3].toUint16(); debug(3, "K_FILEIO_READ_RAW(%d,%d)", handle, size); @@ -781,7 +781,7 @@ reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) { } case K_FILEIO_WRITE_RAW : { int handle = argv[1].toUint16(); - char *buf = s->segMan->kernelDerefString(argv[2]); + char *buf = s->segMan->derefString(argv[2]); int size = argv[3].toUint16(); debug(3, "K_FILEIO_WRITE_RAW(%d,%d)", handle, size); @@ -789,7 +789,7 @@ reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) { break; } case K_FILEIO_UNLINK : { - char *name = s->segMan->kernelDerefString(argv[1]); + char *name = s->segMan->derefString(argv[1]); debug(3, "K_FILEIO_UNLINK(%s)", name); Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager(); @@ -800,7 +800,7 @@ reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) { break; } case K_FILEIO_READ_STRING : { - char *dest = s->segMan->kernelDerefString(argv[1]); + char *dest = s->segMan->derefString(argv[1]); int size = argv[2].toUint16(); int handle = argv[3].toUint16(); debug(3, "K_FILEIO_READ_STRING(%d,%d)", handle, size); @@ -811,7 +811,7 @@ reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) { case K_FILEIO_WRITE_STRING : { int handle = argv[1].toUint16(); int size = argv[3].toUint16(); - char *buf = s->segMan->kernelDerefString(argv[2], size); + char *buf = s->segMan->derefString(argv[2], size); debug(3, "K_FILEIO_WRITE_STRING(%d,%d)", handle, size); // FIXME: What is the difference between K_FILEIO_WRITE_STRING and @@ -832,7 +832,7 @@ reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) { break; } case K_FILEIO_FIND_FIRST : { - char *mask = s->segMan->kernelDerefString(argv[1]); + char *mask = s->segMan->derefString(argv[1]); reg_t buf = argv[2]; int attr = argv[3].toUint16(); // We won't use this, Win32 might, though... debug(3, "K_FILEIO_FIND_FIRST(%s,0x%x)", mask, attr); @@ -851,7 +851,7 @@ reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) { break; } case K_FILEIO_FILE_EXISTS : { - char *name = s->segMan->kernelDerefString(argv[1]); + char *name = s->segMan->derefString(argv[1]); // Check for regular file bool exists = Common::File::exists(name); diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index b455974901..f7f81e8ba4 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -602,14 +602,14 @@ reg_t kGraph(EngineState *s, int, int argc, reg_t *argv) { reg_t kTextSize(EngineState *s, int, int argc, reg_t *argv) { int width, height; - char *text = argv[1].segment ? s->segMan->kernelDerefString(argv[1]) : NULL; + char *text = argv[1].segment ? s->segMan->derefString(argv[1]) : NULL; const char *sep = NULL; - reg_t *dest = s->segMan->kernelDerefRegPtr(argv[0], 4); + reg_t *dest = s->segMan->derefRegPtr(argv[0], 4); int maxwidth = (argc > 3) ? argv[3].toUint16() : 0; int font_nr = argv[2].toUint16(); if ((argc > 4) && (argv[4].segment)) - sep = s->segMan->kernelDerefString(argv[4]); + sep = s->segMan->derefString(argv[4]); if (maxwidth < 0) maxwidth = 0; @@ -1298,7 +1298,7 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse); static void disableCertainButtons(SegManager *segMan, Common::String gameName, reg_t obj) { reg_t text_pos = GET_SEL32(obj, text); - char *text = text_pos.isNull() ? NULL : segMan->kernelDerefString(text_pos); + char *text = text_pos.isNull() ? NULL : segMan->derefString(text_pos); int type = GET_SEL32V(obj, type); int state = GET_SEL32V(obj, state); @@ -1396,7 +1396,7 @@ reg_t kEditControl(EngineState *s, int, int argc, reg_t *argv) { reg_t text_pos = GET_SEL32(obj, text); int display_offset = 0; - char *text = s->segMan->kernelDerefString(text_pos); + char *text = s->segMan->derefString(text_pos); int textlen; if (!text) { @@ -1559,7 +1559,7 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) { int font_nr = GET_SEL32V(obj, font); reg_t text_pos = GET_SEL32(obj, text); - const char *text = text_pos.isNull() ? NULL : s->segMan->kernelDerefString(text_pos); + const char *text = text_pos.isNull() ? NULL : s->segMan->derefString(text_pos); int view = GET_SEL32V(obj, view); int cel = sign_extend_byte(GET_SEL32V(obj, cel)); int loop = sign_extend_byte(GET_SEL32V(obj, loop)); @@ -2506,7 +2506,7 @@ reg_t kNewWindow(EngineState *s, int, int argc, reg_t *argv) { lWhite.alpha = 0; lWhite.priority = -1; lWhite.control = -1; - const char *title = argv[4 + argextra].segment ? s->segMan->kernelDerefString(argv[4 + argextra]) : NULL; + const char *title = argv[4 + argextra].segment ? s->segMan->derefString(argv[4 + argextra]) : NULL; window = sciw_new_window(s, gfx_rect(x, y, xl, yl), s->titlebar_port->_font, fgcolor, bgcolor, s->titlebar_port->_font, lWhite, black, title ? s->strSplit(title, NULL).c_str() : NULL, flags); @@ -3135,7 +3135,7 @@ reg_t kDisplay(EngineState *s, int, int argc, reg_t *argv) { if (textp.segment) { argpt = 1; - text = s->segMan->kernelDerefString(textp); + text = s->segMan->derefString(textp); } else { argpt = 2; text = kernel_lookup_text(s, textp, index); @@ -3303,7 +3303,7 @@ reg_t kDisplay(EngineState *s, int, int argc, reg_t *argv) { } static reg_t kShowMovie_Windows(EngineState *s, int argc, reg_t *argv) { - const char *filename = s->segMan->kernelDerefString(argv[1]); + const char *filename = s->segMan->derefString(argv[1]); Graphics::AVIPlayer *player = new Graphics::AVIPlayer(g_system); @@ -3382,7 +3382,7 @@ static reg_t kShowMovie_Windows(EngineState *s, int argc, reg_t *argv) { } static reg_t kShowMovie_DOS(EngineState *s, int argc, reg_t *argv) { - const char *filename = s->segMan->kernelDerefString(argv[0]); + const char *filename = s->segMan->derefString(argv[0]); int delay = argv[1].toUint16(); // Time between frames in ticks int frameNr = 0; SeqDecoder seq; diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp index b2edbe8a45..a8c62bfb45 100644 --- a/engines/sci/engine/kmenu.cpp +++ b/engines/sci/engine/kmenu.cpp @@ -34,8 +34,8 @@ namespace Sci { reg_t kAddMenu(EngineState *s, int, int argc, reg_t *argv) { - char *name = s->segMan->kernelDerefString(argv[0]); - char *contents = s->segMan->kernelDerefString(argv[1]); + char *name = s->segMan->derefString(argv[0]); + char *contents = s->segMan->derefString(argv[1]); s->_menubar->addMenu(s->gfx_state, name, contents, s->titlebar_port->_font, argv[1]); @@ -78,7 +78,7 @@ reg_t kDrawStatus(EngineState *s, int, int argc, reg_t *argv) { s->status_bar_background = bgcolor; if (text.segment) { - const char *tmp = strdup(s->segMan->kernelDerefString(text)); + const char *tmp = strdup(s->segMan->derefString(text)); s->_statusBarText = tmp ? tmp : ""; } diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 5247d76e5b..48fca8056e 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -187,8 +187,8 @@ reg_t kMemory(EngineState *s, int, int argc, reg_t *argv) { break; case K_MEMORY_MEMCPY : { int size = argv[3].toUint16(); - byte *dest = s->segMan->kernelDerefBulkPtr(argv[1], size); - byte *src = s->segMan->kernelDerefBulkPtr(argv[2], size); + byte *dest = s->segMan->derefBulkPtr(argv[1], size); + byte *src = s->segMan->derefBulkPtr(argv[2], size); if (dest && src) memcpy(dest, src, size); @@ -204,7 +204,7 @@ reg_t kMemory(EngineState *s, int, int argc, reg_t *argv) { break; } case K_MEMORY_PEEK : { - byte *ref = s->segMan->kernelDerefBulkPtr(argv[1], 2); + byte *ref = s->segMan->derefBulkPtr(argv[1], 2); if (!ref) { // This occurs in KQ5CD when interacting with certain objects @@ -218,7 +218,7 @@ reg_t kMemory(EngineState *s, int, int argc, reg_t *argv) { break; } case K_MEMORY_POKE : { - byte *ref = s->segMan->kernelDerefBulkPtr(argv[1], 2); + byte *ref = s->segMan->derefBulkPtr(argv[1], 2); if (!ref) { warning("Attempt to poke invalid memory at %04x:%04x", PRINT_REG(argv[1])); diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index 1687434124..81754b19d0 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -295,8 +295,8 @@ static bool polygons_equal(SegManager *segMan, reg_t p1, reg_t p2) { if (size != GET_SEL32(p2, size).toUint16()) return false; - const byte *p1_points = segMan->kernelDerefBulkPtr(GET_SEL32(p1, points), size * POLY_POINT_SIZE); - const byte *p2_points = segMan->kernelDerefBulkPtr(GET_SEL32(p2, points), size * POLY_POINT_SIZE); + const byte *p1_points = segMan->derefBulkPtr(GET_SEL32(p1, points), size * POLY_POINT_SIZE); + const byte *p2_points = segMan->derefBulkPtr(GET_SEL32(p2, points), size * POLY_POINT_SIZE); bool p1_is_reg_t = polygon_is_reg_t(p1_points, size); bool p2_is_reg_t = polygon_is_reg_t(p2_points, size); @@ -359,7 +359,7 @@ static void draw_polygon(EngineState *s, reg_t polygon) { int size = GET_SEL32(polygon, size).toUint16(); int type = GET_SEL32(polygon, type).toUint16(); Common::Point first, prev; - const byte *list = s->segMan->kernelDerefBulkPtr(points, size * POLY_POINT_SIZE); + const byte *list = s->segMan->derefBulkPtr(points, size * POLY_POINT_SIZE); int is_reg_t = polygon_is_reg_t(list, size); int i; @@ -406,7 +406,7 @@ static void print_polygon(SegManager *segMan, reg_t polygon) { int size = GET_SEL32(polygon, size).toUint16(); int type = GET_SEL32(polygon, type).toUint16(); int i; - const byte *point_array = segMan->kernelDerefBulkPtr(points, size * POLY_POINT_SIZE); + const byte *point_array = segMan->derefBulkPtr(points, size * POLY_POINT_SIZE); int is_reg_t = polygon_is_reg_t(point_array, size); Common::Point point; @@ -1230,7 +1230,7 @@ static Polygon *convert_polygon(EngineState *s, reg_t polygon) { int i; reg_t points = GET_SEL32(polygon, points); int size = GET_SEL32(polygon, size).toUint16(); - const byte *list = s->segMan->kernelDerefBulkPtr(points, size * POLY_POINT_SIZE); + const byte *list = s->segMan->derefBulkPtr(points, size * POLY_POINT_SIZE); Polygon *poly = new Polygon(GET_SEL32(polygon, type).toUint16()); int is_reg_t = polygon_is_reg_t(list, size); diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index a17222f205..d7735483ac 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -44,7 +44,7 @@ char *kernel_lookup_text(EngineState *s, reg_t address, int index) { Resource *textres; if (address.segment) - return s->segMan->kernelDerefString(address); + return s->segMan->derefString(address); else { int textlen; int _index = index; @@ -87,7 +87,7 @@ reg_t kSaid(EngineState *s, int, int argc, reg_t *argv) { if (!heap_said_block.segment) return NULL_REG; - said_block = (byte *)s->segMan->kernelDerefBulkPtr(heap_said_block, 0); + said_block = (byte *)s->segMan->derefBulkPtr(heap_said_block, 0); if (!said_block) { warning("Said on non-string, pointer %04x:%04x", PRINT_REG(heap_said_block)); @@ -189,7 +189,7 @@ reg_t kSetSynonyms(EngineState *s, int, int argc, reg_t *argv) { reg_t kParse(EngineState *s, int, int argc, reg_t *argv) { SegManager *segMan = s->segMan; reg_t stringpos = argv[0]; - char *string = s->segMan->kernelDerefString(stringpos); + char *string = s->segMan->derefString(stringpos); char *error; ResultWordList words; reg_t event = argv[1]; @@ -242,7 +242,7 @@ reg_t kParse(EngineState *s, int, int argc, reg_t *argv) { s->r_acc = make_reg(0, 0); PUT_SEL32V(event, claimed, 1); if (error) { - char *pbase_str = s->segMan->kernelDerefString(s->parser_base); + char *pbase_str = s->segMan->derefString(s->parser_base); strcpy(pbase_str, error); debugC(2, kDebugLevelParser, "Word unknown: %s\n", error); /* Issue warning: */ @@ -259,7 +259,7 @@ reg_t kParse(EngineState *s, int, int argc, reg_t *argv) { reg_t kStrEnd(EngineState *s, int, int argc, reg_t *argv) { reg_t address = argv[0]; - char *seeker = s->segMan->kernelDerefString(address); + char *seeker = s->segMan->derefString(address); while (*seeker++) ++address.offset; @@ -268,16 +268,16 @@ reg_t kStrEnd(EngineState *s, int, int argc, reg_t *argv) { } reg_t kStrCat(EngineState *s, int, int argc, reg_t *argv) { - char *s1 = s->segMan->kernelDerefString(argv[0]); - char *s2 = s->segMan->kernelDerefString(argv[1]); + char *s1 = s->segMan->derefString(argv[0]); + char *s2 = s->segMan->derefString(argv[1]); strcat(s1, s2); return argv[0]; } reg_t kStrCmp(EngineState *s, int, int argc, reg_t *argv) { - char *s1 = s->segMan->kernelDerefString(argv[0]); - char *s2 = s->segMan->kernelDerefString(argv[1]); + char *s1 = s->segMan->derefString(argv[0]); + char *s2 = s->segMan->derefString(argv[1]); if (argc > 2) return make_reg(0, strncmp(s1, s2, argv[2].toUint16())); @@ -287,8 +287,8 @@ reg_t kStrCmp(EngineState *s, int, int argc, reg_t *argv) { reg_t kStrCpy(EngineState *s, int, int argc, reg_t *argv) { - char *dest = s->segMan->kernelDerefString(argv[0]); - char *src = s->segMan->kernelDerefString(argv[1]); + char *dest = s->segMan->derefString(argv[0]); + char *src = s->segMan->derefString(argv[1]); if (!dest) { warning("Attempt to strcpy TO invalid pointer %04x:%04x", @@ -352,7 +352,7 @@ static int is_print_str(const char *str) { reg_t kStrAt(EngineState *s, int, int argc, reg_t *argv) { - char *dest = s->segMan->kernelDerefString(argv[0]); + char *dest = s->segMan->derefString(argv[0]); reg_t *dest2; if (!dest) { @@ -394,7 +394,7 @@ reg_t kStrAt(EngineState *s, int, int argc, reg_t *argv) { reg_t kReadNumber(EngineState *s, int, int argc, reg_t *argv) { - char *source = s->segMan->kernelDerefString(argv[0]); + char *source = s->segMan->derefString(argv[0]); while (isspace(*source)) source++; /* Skip whitespace */ @@ -420,7 +420,7 @@ reg_t kReadNumber(EngineState *s, int, int argc, reg_t *argv) { reg_t kFormat(EngineState *s, int, int argc, reg_t *argv) { int *arguments; reg_t dest = argv[0]; - char *target = s->segMan->kernelDerefString(dest); + char *target = s->segMan->derefString(dest); reg_t position = argv[1]; /* source */ int index = argv[2].toUint16(); char *source; @@ -633,7 +633,7 @@ reg_t kFormat(EngineState *s, int, int argc, reg_t *argv) { reg_t kStrLen(EngineState *s, int, int argc, reg_t *argv) { - char *str = s->segMan->kernelDerefString(argv[0]); + char *str = s->segMan->derefString(argv[0]); if (!str) { warning("StrLen: invalid pointer %04x:%04x", PRINT_REG(argv[0])); @@ -665,7 +665,7 @@ reg_t kGetFarText(EngineState *s, int, int argc, reg_t *argv) { ** resource. */ - strcpy(s->segMan->kernelDerefString(argv[2]), seeker); /* Copy the string and get return value */ + strcpy(s->segMan->derefString(argv[2]), seeker); /* Copy the string and get return value */ return argv[2]; } @@ -740,7 +740,7 @@ reg_t kMessage(EngineState *s, int, int argc, reg_t *argv) { if (!bufferReg.isNull()) { int len = str.size() + 1; - buffer = s->segMan->kernelDerefString(bufferReg, len); + buffer = s->segMan->derefString(bufferReg, len); if (buffer) { strcpy(buffer, str.c_str()); @@ -748,7 +748,7 @@ reg_t kMessage(EngineState *s, int, int argc, reg_t *argv) { warning("Message: buffer %04x:%04x invalid or too small to hold the following text of %i bytes: '%s'", PRINT_REG(bufferReg), len, str.c_str()); // Set buffer to empty string if possible - buffer = s->segMan->kernelDerefString(bufferReg, 1); + buffer = s->segMan->derefString(bufferReg, 1); if (buffer) *buffer = 0; } @@ -788,7 +788,7 @@ reg_t kMessage(EngineState *s, int, int argc, reg_t *argv) { case K_MESSAGE_LASTMESSAGE: { MessageTuple msg = s->_msgState.getLastTuple(); int module = s->_msgState.getLastModule(); - byte *buffer = s->segMan->kernelDerefBulkPtr(argv[1], 10); + byte *buffer = s->segMan->derefBulkPtr(argv[1], 10); if (buffer) { WRITE_LE_UINT16(buffer, module); @@ -810,18 +810,18 @@ reg_t kMessage(EngineState *s, int, int argc, reg_t *argv) { } reg_t kSetQuitStr(EngineState *s, int, int argc, reg_t *argv) { - char *quitStr = s->segMan->kernelDerefString(argv[0]); + char *quitStr = s->segMan->derefString(argv[0]); debug("Setting quit string to '%s'", quitStr); return s->r_acc; } reg_t kStrSplit(EngineState *s, int, int argc, reg_t *argv) { - const char *format = s->segMan->kernelDerefString(argv[1]); - const char *sep = !argv[2].isNull() ? s->segMan->kernelDerefString(argv[2]) : NULL; + const char *format = s->segMan->derefString(argv[1]); + const char *sep = !argv[2].isNull() ? s->segMan->derefString(argv[2]) : NULL; Common::String str = s->strSplit(format, sep); // Make sure target buffer is large enough - char *buf = s->segMan->kernelDerefString(argv[0], str.size() + 1); + char *buf = s->segMan->derefString(argv[0], str.size() + 1); if (buf) { strcpy(buf, str.c_str()); diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index f516fa4093..72c2dd25b0 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -950,15 +950,15 @@ static void *_kernel_dereference_pointer(SegManager *segMan, reg_t pointer, int } -byte *SegManager::kernelDerefBulkPtr(reg_t pointer, int entries) { +byte *SegManager::derefBulkPtr(reg_t pointer, int entries) { return (byte *)_kernel_dereference_pointer(this, pointer, entries, 1); } -reg_t *SegManager::kernelDerefRegPtr(reg_t pointer, int entries) { +reg_t *SegManager::derefRegPtr(reg_t pointer, int entries) { return (reg_t *)_kernel_dereference_pointer(this, pointer, entries, sizeof(reg_t)); } -char *SegManager::kernelDerefString(reg_t pointer, int entries) { +char *SegManager::derefString(reg_t pointer, int entries) { return (char *)_kernel_dereference_pointer(this, pointer, entries, 1); } diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h index 1945db1f74..c3d72d5e40 100644 --- a/engines/sci/engine/seg_manager.h +++ b/engines/sci/engine/seg_manager.h @@ -339,7 +339,7 @@ public: * @return A physical reference to the address pointed to, or NULL on error or * if not enough entries were available. */ - byte *kernelDerefBulkPtr(reg_t pointer, int entries); + byte *derefBulkPtr(reg_t pointer, int entries); /** * Dereferences a heap pointer pointing to a (list of) register(s). @@ -349,7 +349,7 @@ public: * @return A physical reference to the address pointed to, or NULL on error or * if not enough entries were available. */ - reg_t *kernelDerefRegPtr(reg_t pointer, int entries); + reg_t *derefRegPtr(reg_t pointer, int entries); /** * Dereferences a heap pointer pointing to raw memory. @@ -358,7 +358,7 @@ public: * @return A physical reference to the address pointed to, or NULL on error or * if not enough entries were available. */ - char *kernelDerefString(reg_t pointer, int entries = 0); + char *derefString(reg_t pointer, int entries = 0); /** * Finds a unique segment by type diff --git a/engines/sci/engine/stringfrag.cpp b/engines/sci/engine/stringfrag.cpp index 05a1b47cf2..94ae3d4c9d 100644 --- a/engines/sci/engine/stringfrag.cpp +++ b/engines/sci/engine/stringfrag.cpp @@ -103,7 +103,7 @@ static int internal_is_valid_stringfrag(EngineState *s, reg_t *buffer) { } int is_valid_stringfrag(EngineState *s, reg_t pos) { - reg_t *buffer = s->segMan->kernelDerefRegPtr(pos, 1); + reg_t *buffer = s->segMan->derefRegPtr(pos, 1); return internal_is_valid_stringfrag(s, buffer); } @@ -138,7 +138,7 @@ static int internal_stringfrag_length(EngineState *s, reg_t *buffer) { } int stringfrag_length(EngineState *s, reg_t pos) { - reg_t *buffer = s->segMan->kernelDerefRegPtr(pos, 1); + reg_t *buffer = s->segMan->derefRegPtr(pos, 1); return internal_stringfrag_length(s, buffer); } @@ -169,7 +169,7 @@ static void internal_stringfrag_to_ascii(EngineState *s, reg_t *buffer) { } void stringfrag_to_ascii(EngineState *s, reg_t pos) { - reg_t *buffer = s->segMan->kernelDerefRegPtr(pos, 1); + reg_t *buffer = s->segMan->derefRegPtr(pos, 1); internal_stringfrag_to_ascii(s, buffer); } @@ -191,7 +191,7 @@ static void internal_ascii_to_stringfrag(EngineState *s, reg_t *buffer) { } void ascii_to_stringfrag(EngineState *s, reg_t pos) { - reg_t *buffer = s->segMan->kernelDerefRegPtr(pos, 1); + reg_t *buffer = s->segMan->derefRegPtr(pos, 1); internal_ascii_to_stringfrag(s, buffer); } @@ -214,7 +214,7 @@ static void internal_stringfrag_append_char(EngineState *s, reg_t *buffer, unsig } void stringfrag_append_char(EngineState *s, reg_t pos, unsigned char c) { - reg_t *buffer = s->segMan->kernelDerefRegPtr(pos, 1); + reg_t *buffer = s->segMan->derefRegPtr(pos, 1); internal_stringfrag_append_char(s, buffer, c); } @@ -311,7 +311,7 @@ static void internal_stringfrag_insert_char(EngineState *s, reg_t *buffer, int p } void stringfrag_insert_char(EngineState *s, reg_t pos, int p, unsigned char c) { - reg_t *buffer = s->segMan->kernelDerefRegPtr(pos, 1); + reg_t *buffer = s->segMan->derefRegPtr(pos, 1); internal_stringfrag_insert_char(s, buffer, p, c); } @@ -343,7 +343,7 @@ static void internal_stringfrag_delete_char(EngineState *s, reg_t *buffer, int p } void stringfrag_delete_char(EngineState *s, reg_t pos, int p) { - reg_t *buffer = s->segMan->kernelDerefRegPtr(pos, 1); + reg_t *buffer = s->segMan->derefRegPtr(pos, 1); internal_stringfrag_delete_char(s, buffer, p); } @@ -360,8 +360,8 @@ void internal_stringfrag_strcpy(EngineState *s, reg_t *dest, reg_t *src) { } void stringfrag_strcpy(EngineState *s, reg_t dest, reg_t src) { - reg_t *destbuf = s->segMan->kernelDerefRegPtr(dest, 1); - reg_t *srcbuf = s->segMan->kernelDerefRegPtr(src, 1); + reg_t *destbuf = s->segMan->derefRegPtr(dest, 1); + reg_t *srcbuf = s->segMan->derefRegPtr(src, 1); internal_stringfrag_strcpy(s, destbuf, srcbuf); } @@ -388,8 +388,8 @@ void internal_stringfrag_strncpy(EngineState *s, reg_t *dest, reg_t *src, int le } void stringfrag_strncpy(EngineState *s, reg_t dest, reg_t src, int len) { - reg_t *destbuf = s->segMan->kernelDerefRegPtr(dest, 1); - reg_t *srcbuf = s->segMan->kernelDerefRegPtr(src, 1); + reg_t *destbuf = s->segMan->derefRegPtr(dest, 1); + reg_t *srcbuf = s->segMan->derefRegPtr(src, 1); internal_stringfrag_strncpy(s, destbuf, srcbuf, len); } @@ -416,8 +416,8 @@ int internal_stringfrag_strcmp(EngineState *s, reg_t *s1, reg_t *s2) { } void stringfrag_strcmp(EngineState *s, reg_t s1, reg_t s2) { - reg_t *s1buf = s->segMan->kernelDerefRegPtr(s1, 1); - reg_t *s2buf = s->segMan->kernelDerefRegPtr(s2, 1); + reg_t *s1buf = s->segMan->derefRegPtr(s1, 1); + reg_t *s2buf = s->segMan->derefRegPtr(s2, 1); internal_stringfrag_strcmp(s, s1buf, s2buf); } @@ -449,8 +449,8 @@ int internal_stringfrag_strncmp(EngineState *s, reg_t *s1, reg_t *s2, int len) { } void stringfrag_strncmp(EngineState *s, reg_t s1, reg_t s2, int len) { - reg_t *s1buf = s->segMan->kernelDerefRegPtr(s1, 1); - reg_t *s2buf = s->segMan->kernelDerefRegPtr(s2, 1); + reg_t *s1buf = s->segMan->derefRegPtr(s1, 1); + reg_t *s2buf = s->segMan->derefRegPtr(s2, 1); internal_stringfrag_strncmp(s, s1buf, s2buf, len); } diff --git a/engines/sci/gfx/menubar.cpp b/engines/sci/gfx/menubar.cpp index 2562ff7ba2..d6debea824 100644 --- a/engines/sci/gfx/menubar.cpp +++ b/engines/sci/gfx/menubar.cpp @@ -294,7 +294,7 @@ int Menubar::setAttribute(EngineState *s, int menu_nr, int item_nr, int attribut case MENU_ATTRIBUTE_SAID: if (value.segment) { item->_saidPos = value; - memcpy(item->_said, s->segMan->kernelDerefBulkPtr(value, 0), MENU_SAID_SPEC_SIZE); // Copy Said spec + memcpy(item->_said, s->segMan->derefBulkPtr(value, 0), MENU_SAID_SPEC_SIZE); // Copy Said spec item->_flags |= MENU_ATTRIBUTE_FLAGS_SAID; } else @@ -304,7 +304,7 @@ int Menubar::setAttribute(EngineState *s, int menu_nr, int item_nr, int attribut case MENU_ATTRIBUTE_TEXT: assert(value.segment); - item->_text = s->segMan->kernelDerefString(value); + item->_text = s->segMan->derefString(value); item->_textPos = value; break; |