Skip to content
This repository has been archived by the owner on Apr 7, 2021. It is now read-only.

Commit

Permalink
Fix magics (needs proper fix)
Browse files Browse the repository at this point in the history
Implement windows profile directory retrieval
  • Loading branch information
Antidote committed Nov 14, 2015
1 parent b88cfd7 commit 63282c3
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion extern/Athena
16 changes: 16 additions & 0 deletions lib/Runtime/FileStoreManager.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "HECL/Runtime.hpp"
#include <LogVisor/LogVisor.hpp>
#if _WIN32
#include <ShlObj.h>
#endif

namespace HECL
{
Expand All @@ -11,6 +14,19 @@ FileStoreManager::FileStoreManager(const SystemString& domain)
: m_domain(domain)
{
#if _WIN32
WCHAR home[MAX_PATH];
if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, home)))
Log.report(LogVisor::FatalError, _S("unable to locate profile for file store"));

SystemString path(home);

path += _S("/.heclrun");

HECL::MakeDir(path.c_str());
path += _S('/') + domain;

HECL::MakeDir(path.c_str());
m_storeRoot = path;
#elif __APPLE__
#else
const char* home = getenv("HOME");
Expand Down
12 changes: 9 additions & 3 deletions lib/Runtime/ShaderCacheManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace HECL
namespace Runtime
{
static LogVisor::LogModule Log("ShaderCacheManager");
static uint64_t IDX_MAGIC = SBIG(0xDEADFEEDC001D00D);
static uint64_t DAT_MAGIC = SBIG(0xC001D00DDEADBABE);
static uint64_t IDX_MAGIC = SBig(0xDEADFEEDC001D00D);
static uint64_t DAT_MAGIC = SBig(0xC001D00DDEADBABE);
static uint64_t ZERO64 = 0;

static uint64_t timeHash()
Expand Down Expand Up @@ -49,7 +49,13 @@ void ShaderCacheManager::BootstrapIndex()
fwrite(&ZERO64, 1, 8, idxFp);
fclose(idxFp);

FILE* datFp = HECL::Fopen(idxFilename.c_str(), _S("wb"));
#if _WIN32
SystemString datFilename = m_datFr.wfilename();
#else
SystemString datFilename = m_datFr.filename();
#endif

FILE* datFp = HECL::Fopen(datFilename.c_str(), _S("wb"));
if (!datFp)
Log.report(LogVisor::FatalError, _S("unable to write shader cache data at %s"),
idxFilename.c_str());
Expand Down
1 change: 1 addition & 0 deletions test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct HECLApplicationCallback : boo::IApplicationCallback

m_mainWindow = app->newWindow(_S("HECL Test"));
m_mainWindow->setCallback(&m_windowCb);
m_mainWindow->showWindow();
boo::IGraphicsCommandQueue* gfxQ = m_mainWindow->getCommandQueue();
boo::IGraphicsDataFactory* gfxF = m_mainWindow->getLoadContextDataFactory();
boo::SWindowRect mainWindowRect = m_mainWindow->getWindowFrame();
Expand Down

0 comments on commit 63282c3

Please sign in to comment.