diff --git a/src/BoE.vsproj/Common/CopyFiles.bat b/src/BoE.vsproj/Common/CopyFiles.bat index 31535a18..0510358f 100644 --- a/src/BoE.vsproj/Common/CopyFiles.bat +++ b/src/BoE.vsproj/Common/CopyFiles.bat @@ -27,7 +27,7 @@ xcopy %ResourceDir%\fonts %TargetDir%\data\fonts /s /y /i /d xcopy %ResourceDir%\strings %TargetDir%\data\strings /s /y /i /d @echo Copying shaders... -xcopy %1\..\..\tools\mask.* %TargetDir%\data\shaders /s /y /i /d +xcopy %ResourceDir%\..\src\tools\mask.* %TargetDir%\data\shaders /s /y /i /d @echo Copying base scenarios... xcopy %ResourceDir%\"Blades of Exile Bases" %ScenEdDir%\"Blades of Exile Base" /s /y /i /d diff --git a/src/tools/graphtool.cpp b/src/tools/graphtool.cpp index 88115a34..f3b2f7c5 100644 --- a/src/tools/graphtool.cpp +++ b/src/tools/graphtool.cpp @@ -50,30 +50,45 @@ void init_graph_tool(){ fs::path fragPath = shaderPath/"mask.frag", vertPath = shaderPath/"mask.vert"; std::ifstream fin; - fin.open(fragPath.c_str()); - if(!fin.good()) std::cerr << std_fmterr << ": Error loading fragment shader" << std::endl; + do { + + std::cerr << "Loading fragment shader from " << fragPath.string() << std::endl; + fin.open(fragPath.string().c_str()); + if(!fin.good()) { + std::cerr << std_fmterr << ": Error loading fragment shader" << std::endl; + break; + } fin.seekg(0, std::ios::end); int size = fin.tellg(); fin.seekg(0); char* fbuf = new char[size + 1]; fbuf[size] = 0; fin.read(fbuf, size); + fbuf[fin.gcount()] = 0; fin.close(); - - fin.open(vertPath.c_str()); - if(!fin.good()) std::cerr << std_fmterr << ": Error loading vertex shader" << std::endl; + + std::cerr << "Loading vertex shader from " << vertPath.string() << std::endl; + fin.open(vertPath.string().c_str()); + if(!fin.good()) { + std::cerr << std_fmterr << ": Error loading vertex shader" << std::endl; + delete[] fbuf; + break; + } fin.seekg(0, std::ios::end); size = fin.tellg(); fin.seekg(0); char* vbuf = new char[size + 1]; vbuf[size] = 0; fin.read(vbuf, size); + vbuf[fin.gcount()] = 0; if(!maskShader.loadFromMemory(vbuf, fbuf)) { std::cerr << "Error: Failed to load shaders from " << shaderPath << "\nVertex:\n" << vbuf << "\nFragment:\n" << fbuf << std::endl; } delete[] fbuf; delete[] vbuf; + + } while(false); int i; // TODO: The duplication of location here shouldn't be necessary static const location pat_offs[17] = {