keyboard + linux stuff

This commit is contained in:
vladislav.khorev committed 2013-06-12 16:09:17 +00:00
1 parent a89cfc0371
commit 490cdad867
9 files changed
+136 -1

No files matched your search

+25
View File
@@ -15,6 +15,9 @@ Use global variable Console like that:
#ifdef TARGET_WIN32
#include <fstream>
#endif
#ifdef TARGET_LINUX
#include <fstream>
#endif
#ifdef TARGET_ANDROID
#include <asm/page.h>
#include <limits.h>
@@ -88,6 +91,28 @@ public:
#endif
#ifdef TARGET_LINUX
class TFileConsole : public TSimpleConsole
{
protected:
std::string filename;
std::ofstream f;
public:
TFileConsole();
TFileConsole(const std::string& Afilename);
~TFileConsole();
TFileConsole& operator<<(const std::string& s);
void PrintImmediate(const std::string& s);
};
#endif
#ifdef TARGET_ANDROID
class TJavaConsole : public TSimpleConsole
+4
View File
@@ -15,6 +15,10 @@ namespace SE
extern TFileConsole* Console;
#endif
#ifdef TARGET_LINUX
extern TFileConsole* Console;
#endif
#ifdef TARGET_ANDROID
extern TJavaConsole* Console;
#endif
+45
View File
@@ -158,6 +158,51 @@ boost::shared_array<TYPENAME> CreateMemFromFile(const std::string& fileName, car
}
#endif
#ifdef TARGET_LINUX
template<typename TYPENAME>
boost::shared_array<TYPENAME> CreateMemFromFile(const std::string& fileName, cardinal& intCount)
{
cardinal SIZEOF_TYPENAME = sizeof(TYPENAME);
FILE * pFile;
long fSize;
size_t result;
TYPENAME* fileData;
if (fopen(&pFile, fileName.c_str(), "rb" ) != 0)
{
throw ErrorToLog("File not loaded: " + fileName);
}
// obtain file size:
fseek (pFile , 0 , SEEK_END);
fSize = ftell (pFile);
rewind (pFile);
fileData = new TYPENAME [fSize % SIZEOF_TYPENAME == 0 ? fSize/SIZEOF_TYPENAME : fSize/SIZEOF_TYPENAME + 1];
result = fread (&fileData[0], 1, fSize, pFile);
if (result != fSize)
{
throw ErrorToLog("File not loaded: " + fileName);
}
// terminate
fclose (pFile);
intCount = fSize;
return boost::shared_array<TYPENAME>(fileData);
}
#endif
#ifdef TARGET_ANDROID
template<typename TYPENAME>