diff --git a/Code/Misc/Misc.vcxproj b/Code/Misc/Misc.vcxproj
index 58c71f07..3adbb7c8 100644
--- a/Code/Misc/Misc.vcxproj
+++ b/Code/Misc/Misc.vcxproj
@@ -69,21 +69,29 @@
$(SolutionDir)..\External\Lib\$(ProjectName)\
$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\
$(ProjectName)_$(PlatformShortName)D
+ C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)
+ C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)
$(SolutionDir)..\External\Lib\$(ProjectName)\
$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\
$(ProjectName)_$(PlatformShortName)
+ C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)
+ C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)
$(SolutionDir)..\External\Lib\$(ProjectName)\
$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\
$(ProjectName)_$(PlatformShortName)D
+ C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)
+ C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)
$(SolutionDir)..\External\Lib\$(ProjectName)\
$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\
$(ProjectName)_$(PlatformShortName)
+ C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)
+ C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)
@@ -138,10 +146,16 @@
+
+
+
+
+
+
diff --git a/Code/Misc/Misc.vcxproj.filters b/Code/Misc/Misc.vcxproj.filters
index 6f633e1d..03a248f4 100644
--- a/Code/Misc/Misc.vcxproj.filters
+++ b/Code/Misc/Misc.vcxproj.filters
@@ -21,6 +21,15 @@
Source Files
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
@@ -32,5 +41,14 @@
Header Files
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
\ No newline at end of file
diff --git a/Code/Misc/Resource/Loaders/Textloader.cpp b/Code/Misc/Resource/Loaders/Textloader.cpp
new file mode 100644
index 00000000..b42891cc
--- /dev/null
+++ b/Code/Misc/Resource/Loaders/Textloader.cpp
@@ -0,0 +1,156 @@
+
+#include "..\OResource.h"
+#include "..\..\Utilities.h"
+
+#include
+
+using namespace Oyster::Resource;
+bool readANSI = false;
+
+
+
+bool ReadFromFile(const wchar_t fileName[], const wchar_t openFlag[], std::wstring& outData, size_t elemSize)
+{
+ size_t bytesTotal = 0;
+ size_t bytesRead = 0;
+ FILE *stream;
+
+ if( _wfopen_s( &stream, fileName, openFlag ) == 0 )
+ {
+ //Get size of the file
+ fseek(stream, 0L, SEEK_END);
+ bytesTotal = ftell(stream);
+ fseek(stream, 0L, SEEK_SET);
+
+ //Sanity check
+ if(bytesTotal == 0) return false;
+
+ //Create the new byte buffer
+ wchar_t *buff = new wchar_t[bytesTotal + 1];
+
+ //Read the bytes to the end
+ bytesRead = fread_s( buff, bytesTotal, elemSize, bytesTotal ,stream );
+ fclose( stream );
+
+ //Did we read enough bytes
+ if(!readANSI && bytesRead != bytesTotal) return false;
+
+ //Add delimiter
+ buff[bytesRead] = L'\0';
+
+ outData.resize(bytesTotal);
+ outData = buff;
+
+ delete [] buff;
+ }
+ else
+ {
+ std::wstring msg = L"Failed to open file: \n";
+ msg.append(fileName);
+
+ return false;
+ }
+
+ return true;
+}
+bool ReadFromFile(const wchar_t fileName[], const char openFlag[], std::string& outData, size_t elemSize)
+{
+ std::string sFilename;
+ std::wstring wsFile = fileName;
+ ::Utility::String::WStringToString(wsFile, sFilename);
+ size_t bytesTotal = 0;
+ size_t bytesRead = 0;
+ FILE *stream;
+
+ if( fopen_s( &stream, sFilename.c_str(), openFlag ) == 0 )
+ {
+ //Get size of the file
+ fseek(stream, 0L, SEEK_END);
+ bytesTotal = ftell(stream);
+ fseek(stream, 0L, SEEK_SET);
+ fflush(stream);
+
+ //Sanity check
+ if(bytesTotal == 0) return false;
+
+ //Create the new byte buffer
+ char *buff = new char[bytesTotal + 1];
+
+ //Read the bytes to the end
+ bytesRead = fread_s( buff, bytesTotal, elemSize, bytesTotal ,stream );
+ fclose( stream );
+
+ //Did we read enough bytes (Get the bytes if we read with ANSI since the hidden characters is ignored)
+ if(!readANSI && bytesRead != bytesTotal) return false;
+
+ buff[bytesRead + 1];
+
+ outData.clear();
+ outData.resize(bytesRead);
+ memcpy(&outData[0], &buff[0], bytesRead);
+
+ delete [] buff;
+ }
+ else
+ {
+ std::string msg = "Failed to open file: \n";
+ msg.append(sFilename.c_str());
+
+ return false;
+ }
+
+ return true;
+}
+
+
+OResource* OResource::ByteLoader(const wchar_t filename[], ResourceType type)
+{
+ OResource *resource = 0;
+ std::wstring wOut;
+ std::string sOut;
+ bool success = false;
+
+ switch (type)
+ {
+ case Oyster::Resource::ResourceType_UNKNOWN:
+ case Oyster::Resource::ResourceType_Byte_Raw:
+ success = ReadFromFile(filename, "rb", sOut, sizeof(char));
+ break;
+
+ case Oyster::Resource::ResourceType_Byte_ANSI:
+ readANSI = true;
+ success = ReadFromFile(filename, "r", sOut, sizeof(char));
+ readANSI = false;
+ break;
+
+ case Oyster::Resource::ResourceType_Byte_UTF8:
+ success = ReadFromFile(filename, "r, ccs=UTF-8", sOut, sizeof(char));
+ break;
+
+ case Oyster::Resource::ResourceType_Byte_UNICODE:
+ success = ReadFromFile(filename, "r, ccs=UNICODE", sOut, sizeof(char));
+ break;
+
+ case Oyster::Resource::ResourceType_Byte_UTF16LE:
+ success = ReadFromFile(filename, "r, ccs=UTF-16LE", sOut, sizeof(char));
+ break;
+ }
+
+ if(!success) return 0;
+ if(wOut.size())
+ {
+ //const wchar_t *data = new wchar_t[wOut.size()];
+ //resource = new OResource((void*)data, type, (sizeof(wchar_t) * wOut.size()), sizeof(wchar_t), filename);
+ }
+ else if(sOut.size())
+ {
+ char *data = new char[sOut.size()+1];
+ data[sOut.size()] = '\0';
+ memcpy(&data[0], &sOut[0], sOut.size());
+ resource = new OResource((OHRESOURCE)data, type, (sizeof(char) * sOut.size()), sizeof(char), filename);
+
+ }
+ return resource;
+}
+
+
diff --git a/Code/Misc/Resource/OResource.cpp b/Code/Misc/Resource/OResource.cpp
new file mode 100644
index 00000000..9bd9e83b
--- /dev/null
+++ b/Code/Misc/Resource/OResource.cpp
@@ -0,0 +1,64 @@
+#include "OResource.h"
+
+using namespace Oyster::Resource;
+
+OResource::OResource(OHRESOURCE handle, ResourceType type, size_t resourceSize, size_t elementSize, ::std::wstring filename)
+ : resourceData (handle)
+ , resourceFilename (filename)
+ , resourceSize (resourceSize)
+ , resourceElementSize (elementSize)
+ , resourceType (type)
+{
+
+}
+OResource::~OResource()
+{}
+
+bool OResource::Release()
+{
+ if(this->resourceRef.Decref() == 0)
+ {
+ Remove(this->resourceType, this->resourceData);
+ return true;
+ }
+ return false;
+}
+
+void OResource::Remove(ResourceType t, OHRESOURCE& r)
+{
+ switch (t)
+ {
+ case Oyster::Resource::ResourceType_Texture_PNG:
+ case Oyster::Resource::ResourceType_Texture_DDS:
+ case Oyster::Resource::ResourceType_Texture_JPG:
+
+ break;
+
+ case Oyster::Resource::ResourceType_Mesh_VertexData:
+ case Oyster::Resource::ResourceType_Mesh_AnimationData:
+
+ break;
+
+ case Oyster::Resource::ResourceType_Audio_mp3:
+
+ break;
+
+ case Oyster::Resource::ResourceType_Shader_Vertex:
+ case Oyster::Resource::ResourceType_Shader_Hull:
+ case Oyster::Resource::ResourceType_Shader_Domain:
+ case Oyster::Resource::ResourceType_Shader_Geometry:
+ case Oyster::Resource::ResourceType_Shader_Pixel:
+ case Oyster::Resource::ResourceType_Shader_Compute:
+
+ break;
+
+ case Oyster::Resource::ResourceType_UNKNOWN:
+ case Oyster::Resource::ResourceType_Byte_Raw:
+ case Oyster::Resource::ResourceType_Byte_ANSI:
+ case Oyster::Resource::ResourceType_Byte_UTF8:
+ case Oyster::Resource::ResourceType_Byte_UNICODE:
+ case Oyster::Resource::ResourceType_Byte_UTF16LE:
+ delete ((char*)r);
+ break;
+ }
+}
\ No newline at end of file
diff --git a/Code/Misc/Resource/OResource.h b/Code/Misc/Resource/OResource.h
new file mode 100644
index 00000000..e9af19b0
--- /dev/null
+++ b/Code/Misc/Resource/OResource.h
@@ -0,0 +1,60 @@
+/////////////////////////////////////////////////////////////////////
+// Created by [Dennis Andersen] [2013]
+/////////////////////////////////////////////////////////////////////
+
+#ifndef MISC_O_RESOURCE_H
+#define MISC_O_RESOURCE_H
+
+#include "..\Utilities.h"
+#include "OysterResource.h"
+#include
+
+namespace Oyster
+{
+ namespace Resource
+ {
+ class OResource
+ {
+ public:
+ OResource(OHRESOURCE handle, ResourceType type, size_t size, size_t elementSize, ::std::wstring resourceFilename);
+ virtual~ OResource();
+ bool Release();
+
+ inline ResourceType GetResourceType() const
+ { return this->resourceType; }
+ inline const wchar_t* GetResourceFilename() const
+ { return this->resourceFilename.c_str(); }
+ inline OHRESOURCE GetResourceHandle() const
+ { return this->resourceData; }
+ inline unsigned long long GetResourceSize() const
+ { return this->resourceSize; }
+ inline unsigned long long GetResourceElementSize() const
+ { return this->resourceElementSize; }
+ inline unsigned int GetResourceID() const
+ { return this->resourceID; }
+ inline void SetResourceID(unsigned int id)
+ { this->resourceID = id; }
+
+ public:
+ static OResource* TextureLoader (const wchar_t filename[], ResourceType type) {return 0;}
+ static OResource* MeshLoader (const wchar_t filename[], ResourceType type) {return 0;};
+ static OResource* AudioLoader (const wchar_t filename[], ResourceType type) {return 0;};
+ static OResource* ShaderLoader (const wchar_t filename[], ResourceType type) {return 0;};
+ static OResource* ByteLoader (const wchar_t filename[], ResourceType type);
+
+ Utility::DynamicMemory::RefCount resourceRef;
+
+ private:
+ static void Remove (ResourceType t, OHRESOURCE& r);
+
+ OHRESOURCE resourceData;
+ ResourceType resourceType;
+ size_t resourceSize;
+ size_t resourceElementSize;
+ ::std::wstring resourceFilename;
+ unsigned int resourceID;
+ };
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/Code/Misc/Resource/OResourceHandler.cpp b/Code/Misc/Resource/OResourceHandler.cpp
new file mode 100644
index 00000000..3db14dfb
--- /dev/null
+++ b/Code/Misc/Resource/OResourceHandler.cpp
@@ -0,0 +1,182 @@
+/////////////////////////////////////////////////////////////////////
+// Created by [Dennis Andersen] [2013]
+/////////////////////////////////////////////////////////////////////
+
+
+#include "OysterResource.h"
+#include "OResource.h"
+#include
+#include