diff --git a/include/Utils/ThreadUtilsImpl.h b/include/Utils/ThreadUtilsImpl.h index 81cc3f9..be2e3ca 100644 --- a/include/Utils/ThreadUtilsImpl.h +++ b/include/Utils/ThreadUtilsImpl.h @@ -32,23 +32,22 @@ namespace SE [&] () { result = f(); - + { - boost::mutex::scoped_lock lock(FunctionMutex); + boost::mutex::scoped_lock lock(ST::FunctionMutex); functionCalled = true; } - FunctionFinishedCondition.notify_one(); + ST::FunctionFinishedCondition.notify_one(); }; - ST::MainThreadIoService.post(func); - boost::mutex::scoped_lock lock(FunctionMutex); + boost::mutex::scoped_lock lock(ST::FunctionMutex); while (!functionCalled) { - FunctionFinishedCondition.wait(lock); + ST::FunctionFinishedCondition.wait(lock); } return result; diff --git a/src/ModelManager/ModelManager.cpp b/src/ModelManager/ModelManager.cpp index f8c0837..072e20f 100644 --- a/src/ModelManager/ModelManager.cpp +++ b/src/ModelManager/ModelManager.cpp @@ -333,7 +333,7 @@ bool TModelManager::AddLiteModel(const std::string& filename, const std::string& if (LiteModelMap.count(modelName) != 0) return true; - boost::shared_array fileArr = CreateMemFromFile((ST::PathToResources + filename), fileSize); + boost::shared_array fileArr = CreateMemFromFile((ST::PathToResources + filename), fileSize); if (!(fileArr[0] == 'L' && fileArr[1] == 'M' && fileArr[2] == 0 && fileArr[3] == 1)) throw ErrorFileNotCorrect(filename); diff --git a/src/SalmonEngineInterface.cpp b/src/SalmonEngineInterface.cpp index 6877321..26e5fae 100644 --- a/src/SalmonEngineInterface.cpp +++ b/src/SalmonEngineInterface.cpp @@ -28,11 +28,10 @@ void TResourceManager::Update(cardinal timer) SoundManager.Update(timer); GUIManager.Update(timer); - - //ST::MainThreadIoService.run(); - ST::MainThreadIoService.run_one(); - - //ST::MainThreadIoService.reset(); + + ST::MainThreadIoService.poll_one(); + ST::MainThreadIoService.reset(); + } TResourceManager::~TResourceManager() diff --git a/src/Utils/IosApi/IosApi.mm b/src/Utils/IosApi/IosApi.mm index aa326c4..bb2526f 100644 --- a/src/Utils/IosApi/IosApi.mm +++ b/src/Utils/IosApi/IosApi.mm @@ -18,7 +18,8 @@ namespace SE std::string IosGetFileReadPath(const std::string& filename) { - + @autoreleasepool + { NSString* nsFullFileName = [NSString stringWithCString:filename.c_str() encoding:NSUTF8StringEncoding]; 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]; return std::string([filePath UTF8String]); + } } std::string IosGetFilePathUserData(const std::string& filename) { + @autoreleasepool + { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); @@ -47,6 +51,7 @@ std::string IosGetFilePathUserData(const std::string& filename) NSString* file = [docDir stringByAppendingString:[NSString stringWithCString:filename.c_str() encoding:NSUTF8StringEncoding]]; return std::string([[NSFileManager defaultManager] fileSystemRepresentationWithPath:file]); + } } void IosSwitchToScreen()