ios stuff

This commit is contained in:
Vladislav Khorev 2013-03-04 20:27:47 +00:00
parent 013b1dc344
commit da5bd119ab
4 changed files with 16 additions and 13 deletions

View File

@ -34,21 +34,20 @@ namespace SE
result = f(); result = f();
{ {
boost::mutex::scoped_lock lock(FunctionMutex); boost::mutex::scoped_lock lock(ST::FunctionMutex);
functionCalled = true; functionCalled = true;
} }
FunctionFinishedCondition.notify_one(); ST::FunctionFinishedCondition.notify_one();
}; };
ST::MainThreadIoService.post(func); ST::MainThreadIoService.post(func);
boost::mutex::scoped_lock lock(FunctionMutex); boost::mutex::scoped_lock lock(ST::FunctionMutex);
while (!functionCalled) while (!functionCalled)
{ {
FunctionFinishedCondition.wait(lock); ST::FunctionFinishedCondition.wait(lock);
} }
return result; return result;

View File

@ -333,7 +333,7 @@ bool TModelManager::AddLiteModel(const std::string& filename, const std::string&
if (LiteModelMap.count(modelName) != 0) if (LiteModelMap.count(modelName) != 0)
return true; return true;
boost::shared_array<byte> fileArr = CreateMemFromFile<byte>((ST::PathToResources + filename), fileSize); boost::shared_array<unsigned char> fileArr = CreateMemFromFile<unsigned char>((ST::PathToResources + filename), fileSize);
if (!(fileArr[0] == 'L' && fileArr[1] == 'M' && fileArr[2] == 0 && fileArr[3] == 1)) if (!(fileArr[0] == 'L' && fileArr[1] == 'M' && fileArr[2] == 0 && fileArr[3] == 1))
throw ErrorFileNotCorrect(filename); throw ErrorFileNotCorrect(filename);

View File

@ -29,10 +29,9 @@ void TResourceManager::Update(cardinal timer)
GUIManager.Update(timer); GUIManager.Update(timer);
//ST::MainThreadIoService.run(); ST::MainThreadIoService.poll_one();
ST::MainThreadIoService.run_one(); ST::MainThreadIoService.reset();
//ST::MainThreadIoService.reset();
} }
TResourceManager::~TResourceManager() TResourceManager::~TResourceManager()

View File

@ -18,7 +18,8 @@ namespace SE
std::string IosGetFileReadPath(const std::string& filename) std::string IosGetFileReadPath(const std::string& filename)
{ {
@autoreleasepool
{
NSString* nsFullFileName = [NSString stringWithCString:filename.c_str() encoding:NSUTF8StringEncoding]; NSString* nsFullFileName = [NSString stringWithCString:filename.c_str() encoding:NSUTF8StringEncoding];
NSString* nsFileShortName = [nsFullFileName lastPathComponent]; NSString* nsFileShortName = [nsFullFileName lastPathComponent];
@ -32,11 +33,14 @@ std::string IosGetFileReadPath(const std::string& filename)
NSString *filePath = [[NSBundle mainBundle] pathForResource:nsFileShortNameWithoutExt ofType:nsFileExt inDirectory:nsFilePath]; NSString *filePath = [[NSBundle mainBundle] pathForResource:nsFileShortNameWithoutExt ofType:nsFileExt inDirectory:nsFilePath];
return std::string([filePath UTF8String]); return std::string([filePath UTF8String]);
}
} }
std::string IosGetFilePathUserData(const std::string& filename) std::string IosGetFilePathUserData(const std::string& filename)
{ {
@autoreleasepool
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES); NSUserDomainMask, YES);
@ -47,6 +51,7 @@ std::string IosGetFilePathUserData(const std::string& filename)
NSString* file = [docDir stringByAppendingString:[NSString stringWithCString:filename.c_str() encoding:NSUTF8StringEncoding]]; NSString* file = [docDir stringByAppendingString:[NSString stringWithCString:filename.c_str() encoding:NSUTF8StringEncoding]];
return std::string([[NSFileManager defaultManager] fileSystemRepresentationWithPath:file]); return std::string([[NSFileManager defaultManager] fileSystemRepresentationWithPath:file]);
}
} }
void IosSwitchToScreen() void IosSwitchToScreen()