Added create_kyradat to our regular build system, too; fixed some warnings (and added a FIXME about ambiguious code)

svn-id: r29012
This commit is contained in:
Max Horn 2007-09-22 07:32:28 +00:00
parent 47b8dbbf52
commit 79e323d6dd
4 changed files with 43 additions and 12 deletions

View File

@ -58,7 +58,7 @@ const ExtractType extractTypeTable[] = {
{ kTypeRoomList, extractRooms, createFilename },
{ kTypeShapeList, extractShapes, createFilename },
{ kTypeRawData, extractRaw, createFilename },
{ -1, 0 }
{ -1, 0, 0}
};
const ExtractFilename extractFilenames[] = {
@ -336,10 +336,16 @@ bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32
// We simply skip every other string
if (i == size)
continue;
uint32 size = strlen((const char*) data + i);
i += size; targetsize = --targetsize - size;
uint32 len = strlen((const char*) data + i);
i += len;
#if 1
// FIXME: Not sure whether this correct; the original code was ambiguious, see below
targetsize = targetsize - 1 - len;
#else
targetsize = --targetsize - len; // FIXME: This operation is undefined
#endif
while (!data[++i]) {
if (i == size)
if (i == len)
break;
targetsize--;
}
@ -404,7 +410,7 @@ bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32
} else if (g->special == kAmigaVersion) {
// we need to strip some aligment zeros out here
int dstPos = 0;
for (int i = 0; i < size; ++i) {
for (uint32 i = 0; i < size; ++i) {
if (!data[i] && ((i+1) & 0x1))
continue;
*output++ = data[i];

View File

@ -0,0 +1,16 @@
MODULE := tools/create_kyradat
MODULE_DIRS += \
tools/create_kyradat/
TOOLS += \
$(MODULE)/create_kyradat$(EXEEXT)
MODULE_OBJS := \
$(MODULE)/create_kyradat.o \
$(MODULE)/pak.o \
$(MODULE)/md5.o \
$(MODULE)/util.o
$(MODULE)/create_kyradat$(EXEEXT): $(MODULE_OBJS)
$(CXX) $(LDFLAGS) $+ -o $@

View File

@ -0,0 +1,14 @@
MODULE := tools/create_lure
MODULE_DIRS += \
tools/create_lure/
TOOLS += \
$(MODULE)/create_lure$(EXEEXT)
MODULE_OBJS := \
$(MODULE)/create_lure_dat.o \
$(MODULE)/process_actions.o
$(MODULE)/create_lure$(EXEEXT): $(MODULE_OBJS)
$(CXX) $(LDFLAGS) $+ -o $@

View File

@ -10,9 +10,9 @@ MODULE_DIRS += \
TOOLS := \
tools/convbdf$(EXEEXT) \
tools/md5table$(EXEEXT) \
tools/create_lure/create_lure$(EXEEXT)
tools/md5table$(EXEEXT)
include $(srcdir)/tools/*/module.mk
# Make sure the 'all' / 'clean' targets build/clean the tools, too
all: tools
@ -36,10 +36,6 @@ tools/md5table$(EXEEXT): $(srcdir)/tools/md5table.c
$(MKDIR) tools/$(DEPDIR)
$(CC) $(CFLAGS) -Wall -o $@ $<
tools/create_lure/create_lure$(EXEEXT): tools/create_lure/create_lure_dat.o tools/create_lure/process_actions.o
$(MKDIR) tools/create_lure/$(DEPDIR)
$(CXX) $(LDFLAGS) $+ -o $@
#
# Rules to explicitly rebuild the credits / MD5 tables.
# The rules for the files in the "web" resp. "docs" modules
@ -79,5 +75,4 @@ md5scumm: tools/md5table$(EXEEXT)
# $(srcdir)/tools/credits.pl --cpp > $@
.PHONY: clean-tools tools credits md5scumm md5simon