From c579c16bf15aa2651a0c9f2030c4f5db95080f8f Mon Sep 17 00:00:00 2001 From: James Brown Date: Tue, 9 Jul 2002 14:31:00 +0000 Subject: [PATCH] Dumb up filename case insensitivity svn-id: r4504 --- Makefile | 4 ++-- Makefile.common | 23 +++++++++++------------ resource.cpp | 15 +++++++++++++-- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index e678e578ff4..8434ab7cf9f 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,8 @@ INCLUDES:= -I./ -I./sound LIBS = -lncurses # Uncomment this to activate the MAD lib for compressed sound files -DEFINES += -DCOMPRESSED_SOUND_FILE -LIBS += -lmad +#DEFINES += -DCOMPRESSED_SOUND_FILE +#LIBS += -lmad # Uncomment this to activate the ALSA lib for midi # DEFINES += -DUSE_ALSA diff --git a/Makefile.common b/Makefile.common index 63ddd8c5a98..b96410b9961 100644 --- a/Makefile.common +++ b/Makefile.common @@ -32,20 +32,19 @@ clean: .PHONY: all clean dist # Default (dumb) compile & dependcy rules -.cpp.o: - $(CC) $(CFLAGS) $(CPPFLAGS) -c $(<) -o $*.o -$(OBJS): $(INCS) +#.cpp.o: +# $(CC) $(CFLAGS) $(CPPFLAGS) -c $(<) -o $*.o +#$(OBJS): $(INCS) # If you use GCC, disable the above and enable this for intelligent # dependency tracking. -#DEPDIR := .deps -#.cpp.o: -# mkdir -p $(DEPDIR) -# $(CC) -Wp,-MMD,"$(DEPDIR)/$(*F).d2" $(CFLAGS) $(CPPFLAGS) -c $(<) -o $*.o -# echo -n "$(*D)/" > $(DEPDIR)/$(*F).d -# cat "$(DEPDIR)/$(*F).d2" >> "$(DEPDIR)/$(*F).d" -# rm -f "$(DEPDIR)/$(*F).d2" -# -#-include $(DEPDIR)/*.d +DEPDIR := .deps +.cpp.o: + mkdir -p $(DEPDIR) + $(CC) -Wp,-MMD,"$(DEPDIR)/$(*F).d2" $(CFLAGS) $(CPPFLAGS) -c $(<) -o $*.o + echo -n "$(*D)/" > $(DEPDIR)/$(*F).d + cat "$(DEPDIR)/$(*F).d2" >> "$(DEPDIR)/$(*F).d" + rm -f "$(DEPDIR)/$(*F).d2" +-include $(DEPDIR)/*.d diff --git a/resource.cpp b/resource.cpp index c98f1bdcd05..92d1dd0afea 100644 --- a/resource.cpp +++ b/resource.cpp @@ -22,6 +22,7 @@ #include "stdafx.h" #include "scumm.h" +#include /* Open a room */ void Scumm::openRoom(int room) @@ -174,7 +175,7 @@ bool Scumm::openResourceFile(const char *filename) debug(9, "openResourceFile(%s)", filename); strcpy(buf, filename); - + printf("asked to open %s\n", filename); if (_fileHandle != NULL) { fileClose(_fileHandle); _fileHandle = NULL; @@ -182,13 +183,23 @@ bool Scumm::openResourceFile(const char *filename) _fileHandle = fileOpen(buf, 1); if (!_fileHandle) { - char *e = buf; + char *e=strrchr(buf, '/'); + if (!e) e=buf; do *e = tolower(*e); while (*e++); _fileHandle = fileOpen(buf, 1); } + if (!_fileHandle) { + char *e=strrchr(buf, '/'); + if (!e) e=buf; + do + *e = toupper(*e); + while (*e++); + _fileHandle = fileOpen(buf, 1); + } + return _fileHandle != NULL; }