
include "sbox/engineglue.h"

native static class EngineGlue as NativeEngine.EngineGlue
{
	KeyValues3 JsonToKeyValues3( string json );
	string KeyValuesToJson( string kv );
	string KeyValues3ToJson( KeyValues3 kv );
	KeyValues3 LoadKeyValues3( string kvString );
	uint GetStringToken( string str );
	string GetStringTokenValue( uint token );

	void AddSearchPath( string path, string groupid, bool head );
	bool RemoveSearchPath( string path, string groupid );

	ulong ApproximateProcessMemoryUsage();

	string ReadCompiledResourceFileJson( void* data );

	inline void* ReadCompiledResourceFileBlock( string blockName, CastTo[ResourceFileHeader_t*] void* pHeader, cref out int nSize )
	{
		auto blockId = MK_RSRC_BLOCK_ID( blockName[0], blockName[1], blockName[2], blockName[3] );

		ResourceHeaderBlockInfo_t info;
		if ( !Resource_FindBlockInfo( pHeader, blockId, &info ) )
			return nullptr;

		*__nSize = info.m_nBlockSize;
		return info.m_pBlockData;
	}

	string ReadCompiledResourceFileJsonFromFilesystem( string filename );

	void SetEngineLoggingVerbose( bool verbose );

	void RequestWebAuthTicket();
	void CancelWebAuthTicket();
	string GetWebAuthTicket();
}
