Exemple #1
0
// On windows we're transcribing the whole of any resource based asset tree into a RAM-based
// streamer, so that when we're running across a high-latency filesystem we're not affected as much.
static ZAsset sGetAssetRootFromExecutable(const string& iAssetTreeName)
	{
	#if !ZCONFIG(OS, Win32)

		return ZUtil_Asset::sGetAssetRootFromExecutable(iAssetTreeName);

	#else
		HINSTANCE theHINSTANCE;
		if (ZUtil_Win::sUseWAPI())
			theHINSTANCE = ::GetModuleHandleW(nil);
		else
			theHINSTANCE = ::GetModuleHandleA(nil);

		ZRef<ZStreamerRWPos> theStreamer = new ZStreamerRWPos_T<ZStreamRWPos_RAM>;
		theStreamer->GetStreamWPos().CopyAllFrom(ZStreamRPos_Win_MultiResource(theHINSTANCE, "ZAO_", iAssetTreeName));
		theStreamer->GetStreamWPos().SetPosition(0);

		ZRef<ZAssetTree> theAssetTree = new ZAssetTree_Std_Streamer(theStreamer);
		return theAssetTree->GetRoot();
	#endif

	return ZAsset();
	}