Windows fixes

This commit is contained in:
Jack Andersen 2015-10-11 18:38:49 -10:00
parent 60374a472a
commit bcd025f375
8 changed files with 26 additions and 20 deletions

View File

@ -463,26 +463,26 @@ BlenderConnection::DataStream::Mesh::Mesh(BlenderConnection& conn, int skinSlotC
uint32_t matSetCount; uint32_t matSetCount;
conn._readBuf(&matSetCount, 4); conn._readBuf(&matSetCount, 4);
materialSets.reserve(matSetCount); materialSets.reserve(matSetCount);
for (int i=0 ; i<matSetCount ; ++i) for (uint32_t i=0 ; i<matSetCount ; ++i)
{ {
materialSets.emplace_back(); materialSets.emplace_back();
std::vector<Material>& materials = materialSets.back(); std::vector<Material>& materials = materialSets.back();
uint32_t matCount; uint32_t matCount;
conn._readBuf(&matCount, 4); conn._readBuf(&matCount, 4);
materials.reserve(matCount); materials.reserve(matCount);
for (int i=0 ; i<matCount ; ++i) for (uint32_t i=0 ; i<matCount ; ++i)
materials.emplace_back(conn); materials.emplace_back(conn);
} }
uint32_t count; uint32_t count;
conn._readBuf(&count, 4); conn._readBuf(&count, 4);
pos.reserve(count); pos.reserve(count);
for (int i=0 ; i<count ; ++i) for (uint32_t i=0 ; i<count ; ++i)
pos.emplace_back(conn); pos.emplace_back(conn);
conn._readBuf(&count, 4); conn._readBuf(&count, 4);
norm.reserve(count); norm.reserve(count);
for (int i=0 ; i<count ; ++i) for (uint32_t i=0 ; i<count ; ++i)
norm.emplace_back(conn); norm.emplace_back(conn);
conn._readBuf(&colorLayerCount, 4); conn._readBuf(&colorLayerCount, 4);
@ -490,7 +490,7 @@ BlenderConnection::DataStream::Mesh::Mesh(BlenderConnection& conn, int skinSlotC
LogModule.report(LogVisor::FatalError, "mesh has %u color-layers; max 4", colorLayerCount); LogModule.report(LogVisor::FatalError, "mesh has %u color-layers; max 4", colorLayerCount);
conn._readBuf(&count, 4); conn._readBuf(&count, 4);
color.reserve(count); color.reserve(count);
for (int i=0 ; i<count ; ++i) for (uint32_t i=0 ; i<count ; ++i)
color.emplace_back(conn); color.emplace_back(conn);
conn._readBuf(&uvLayerCount, 4); conn._readBuf(&uvLayerCount, 4);
@ -498,12 +498,12 @@ BlenderConnection::DataStream::Mesh::Mesh(BlenderConnection& conn, int skinSlotC
LogModule.report(LogVisor::FatalError, "mesh has %u UV-layers; max 8", uvLayerCount); LogModule.report(LogVisor::FatalError, "mesh has %u UV-layers; max 8", uvLayerCount);
conn._readBuf(&count, 4); conn._readBuf(&count, 4);
uv.reserve(count); uv.reserve(count);
for (int i=0 ; i<count ; ++i) for (uint32_t i=0 ; i<count ; ++i)
uv.emplace_back(conn); uv.emplace_back(conn);
conn._readBuf(&count, 4); conn._readBuf(&count, 4);
boneNames.reserve(count); boneNames.reserve(count);
for (int i=0 ; i<count ; ++i) for (uint32_t i=0 ; i<count ; ++i)
{ {
char name[128]; char name[128];
conn._readLine(name, 128); conn._readLine(name, 128);
@ -512,14 +512,14 @@ BlenderConnection::DataStream::Mesh::Mesh(BlenderConnection& conn, int skinSlotC
conn._readBuf(&count, 4); conn._readBuf(&count, 4);
skins.reserve(count); skins.reserve(count);
for (int i=0 ; i<count ; ++i) for (uint32_t i=0 ; i<count ; ++i)
{ {
skins.emplace_back(); skins.emplace_back();
std::vector<SkinBind>& binds = skins.back(); std::vector<SkinBind>& binds = skins.back();
uint32_t bindCount; uint32_t bindCount;
conn._readBuf(&bindCount, 4); conn._readBuf(&bindCount, 4);
binds.reserve(bindCount); binds.reserve(bindCount);
for (int j=0 ; j<bindCount ; ++j) for (uint32_t j=0 ; j<bindCount ; ++j)
binds.emplace_back(conn); binds.emplace_back(conn);
} }
@ -565,7 +565,7 @@ BlenderConnection::DataStream::Mesh::Material::Material
uint32_t texCount; uint32_t texCount;
conn._readBuf(&texCount, 4); conn._readBuf(&texCount, 4);
texs.reserve(texCount); texs.reserve(texCount);
for (int i=0 ; i<texCount ; ++i) for (uint32_t i=0 ; i<texCount ; ++i)
{ {
conn._readLine(buf, 4096); conn._readLine(buf, 4096);
#if HECL_UCS2 #if HECL_UCS2
@ -605,9 +605,9 @@ BlenderConnection::DataStream::Mesh::Surface::Vert::Vert
{ {
conn._readBuf(&iPos, 4); conn._readBuf(&iPos, 4);
conn._readBuf(&iNorm, 4); conn._readBuf(&iNorm, 4);
for (int i=0 ; i<parent.colorLayerCount ; ++i) for (uint32_t i=0 ; i<parent.colorLayerCount ; ++i)
conn._readBuf(&iColor[i], 4); conn._readBuf(&iColor[i], 4);
for (int i=0 ; i<parent.uvLayerCount ; ++i) for (uint32_t i=0 ; i<parent.uvLayerCount ; ++i)
conn._readBuf(&iUv[i], 4); conn._readBuf(&iUv[i], 4);
conn._readBuf(&iSkin, 4); conn._readBuf(&iSkin, 4);
} }

View File

@ -272,7 +272,7 @@ public:
m_parent->_readBuf(&count, 4); m_parent->_readBuf(&count, 4);
std::vector<std::string> retval; std::vector<std::string> retval;
retval.reserve(count); retval.reserve(count);
for (int i=0 ; i<count ; ++i) for (uint32_t i=0 ; i<count ; ++i)
{ {
char name[128]; char name[128];
m_parent->_readLine(name, 128); m_parent->_readLine(name, 128);

View File

@ -1,4 +1,7 @@
#if _WIN32 #if _WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#define WIN_PAUSE 1 #define WIN_PAUSE 1
#include <objbase.h> #include <objbase.h>
#endif #endif

View File

@ -3,7 +3,7 @@
namespace HECL namespace HECL
{ {
namespace Frontend {class IR;} namespace Frontend {struct IR;}
namespace Backend namespace Backend
{ {

View File

@ -81,7 +81,7 @@ struct IR
OpSwizzle /**< Vector insertion/extraction/swizzling operation */ OpSwizzle /**< Vector insertion/extraction/swizzling operation */
}; };
using RegID = ssize_t; using RegID = int;
struct Instruction struct Instruction
{ {
@ -116,7 +116,7 @@ struct IR
struct struct
{ {
ssize_t m_idxs[4] = {-1}; int m_idxs[4] = {-1};
size_t m_instIdx; size_t m_instIdx;
} m_swizzle; } m_swizzle;

View File

@ -38,7 +38,7 @@ namespace HECL
namespace Database namespace Database
{ {
class Project; class Project;
class DataSpecEntry; struct DataSpecEntry;
} }

View File

@ -4,6 +4,9 @@
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1 #define WIN32_LEAN_AND_MEAN 1
#endif #endif
#ifndef NOMINMAX
#define NOMINMAX 1
#endif
#include "windows.h" #include "windows.h"
void* memmem(const void *haystack, size_t hlen, const void *needle, size_t nlen); void* memmem(const void *haystack, size_t hlen, const void *needle, size_t nlen);

View File

@ -94,7 +94,7 @@ void ProjectPath::assign(Database::Project& project, const std::string& path)
{ {
m_proj = &project; m_proj = &project;
std::wstring wpath = UTF8ToWide(path); std::wstring wpath = UTF8ToWide(path);
m_relPath = canonRelPath(wpath); m_relPath = CanonRelPath(wpath);
m_absPath = project.getProjectRootPath().getAbsolutePath() + _S('/') + m_relPath; m_absPath = project.getProjectRootPath().getAbsolutePath() + _S('/') + m_relPath;
SanitizePath(m_relPath); SanitizePath(m_relPath);
SanitizePath(m_absPath); SanitizePath(m_absPath);
@ -122,9 +122,9 @@ void ProjectPath::assign(const ProjectPath& parentPath, const SystemString& path
#if HECL_UCS2 #if HECL_UCS2
void ProjectPath::assign(const ProjectPath& parentPath, const std::string& path) void ProjectPath::assign(const ProjectPath& parentPath, const std::string& path)
{ {
m_projRoot = parentPath.m_projRoot; m_proj = parentPath.m_proj;
std::wstring wpath = UTF8ToWide(path); std::wstring wpath = UTF8ToWide(path);
m_relPath = canonRelPath(parentPath.m_relPath + _S('/') + wpath); m_relPath = CanonRelPath(parentPath.m_relPath + _S('/') + wpath);
m_absPath = m_proj->getProjectRootPath().getAbsolutePath() + _S('/') + m_relPath; m_absPath = m_proj->getProjectRootPath().getAbsolutePath() + _S('/') + m_relPath;
SanitizePath(m_relPath); SanitizePath(m_relPath);
SanitizePath(m_absPath); SanitizePath(m_absPath);