From a52814225480428b67e56cb8adf2f04b7da1e357 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 20 Jan 2015 21:49:57 +0100 Subject: [PATCH] Fixed on windows. --- src/image.cpp | 10 +++++++--- tests/gl/Makefile | 2 ++ tests/gl/Makefile.mingw | 4 +++- tests/gl/main.cpp | 7 +++++-- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/image.cpp b/src/image.cpp index a79bfdc..98c965f 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -297,8 +297,10 @@ Image::getFilename(const char *name) // TGA I/O // -//#pragma pack(push) -//#pragma pack(1) +#ifndef RW_PS2 +#pragma pack(push) +#pragma pack(1) +#endif struct __attribute__((__packed__)) TGAHeader { int8 IDlen; @@ -312,7 +314,9 @@ struct __attribute__((__packed__)) TGAHeader uint8 depth; uint8 descriptor; }; -//#pragma pack(push) +#ifndef RW_PS2 +#pragma pack(push) +#endif Image* readTGA(const char *afilename) diff --git a/tests/gl/Makefile b/tests/gl/Makefile index 9cfc2c7..10096a3 100755 --- a/tests/gl/Makefile +++ b/tests/gl/Makefile @@ -10,9 +10,11 @@ rwtest: $(OBJ) $(RWDIR)/librw-opengl.a /usr/local/lib/libglfw3.a $(CXX) $^ $(LDLIBS) -o $@ $(BUILDDIR)/%.o: %.cpp + @mkdir -p $(@D) $(CXX) $(CFLAGS) -c $< -o $@ $(BUILDDIR)/%.d: %.cpp + @mkdir -p $(@D) $(CXX) -MM -MT '$(patsubst %.cpp,$(BUILDDIR)%.o,$<)' $(CFLAGS) $< > $@ clean: diff --git a/tests/gl/Makefile.mingw b/tests/gl/Makefile.mingw index 7c48528..2c8e7f6 100755 --- a/tests/gl/Makefile.mingw +++ b/tests/gl/Makefile.mingw @@ -6,13 +6,15 @@ RWDIR=$(HOME)/src/librw LDLIBS=-static -lglfw3 -lglew32 -lopengl32 -lgdi32 CFLAGS=-g -I$(RWDIR) -Wall -Wextra -DGLEW_STATIC -rwtest: $(OBJ) $(RWDIR)/librw.a +rwtest: $(OBJ) $(RWDIR)/librw-opengl.a $(CXX) $^ $(LDLIBS) -o $@ $(BUILDDIR)/%.o: %.cpp + @mkdir -p $(@D) $(CXX) $(CFLAGS) -c $< -o $@ $(BUILDDIR)/%.d: %.cpp + @mkdir -p $(@D) $(CXX) -MM -MT '$(patsubst %.cpp,$(BUILDDIR)%.o,$<)' $(CFLAGS) $< > $@ dep: $(DEP) diff --git a/tests/gl/main.cpp b/tests/gl/main.cpp index f814b59..bc95210 100755 --- a/tests/gl/main.cpp +++ b/tests/gl/main.cpp @@ -183,7 +183,9 @@ init(void) Rw::CurrentTexDictionary = new Rw::TexDictionary; // Rw::Image::setSearchPath("/home/aap/gamedata/ps2/gtasa/models/gta3_archive/txd_extracted/"); // Rw::Image::setSearchPath("/home/aap/gamedata/ps2/gtavc/MODELS/gta3_archive/txd_extracted/"); - Rw::Image::setSearchPath("/home/aap/gamedata/ps2/gtavc/MODELS/gta3_archive/txd_extracted/;/home/aap/gamedata/ps2/gtasa/models/gta3_archive/txd_extracted/"); + Rw::Image::setSearchPath( + "/home/aap/gamedata/ps2/gtavc/MODELS/gta3_archive/txd_extracted/;/home/aap/gamedata/ps2/gtasa/models/gta3_archive/txd_extracted/"); + //"D:\\rockstargames\\ps2\\gtavc\\MODELS\\gta3_archive\\txd_extracted\\;D:\\rockstargames\\ps2\\gtasa\\models\\gta3_archive\\txd_extracted\\"); Rw::Gl::RegisterNativeRaster(); Rw::RegisterMaterialRightsPlugin(); Rw::RegisterMatFXPlugin(); @@ -199,7 +201,8 @@ init(void) Rw::RegisterMeshPlugin(); Rw::StreamFile in; - in.open(filename, "rb"); + if(in.open(filename, "rb") == NULL) + printf("couldn't open file\n"); Rw::FindChunk(&in, Rw::ID_CLUMP, NULL, NULL); clump = Rw::Clump::streamRead(&in); assert(clump);