diff --git a/src/format.h b/src/format.h index 793cf62..0577ba8 100644 --- a/src/format.h +++ b/src/format.h @@ -2519,10 +2519,10 @@ namespace TR { stream.seek(-4); // get file name without extension - int len = strlen(stream.name); + size_t len = strlen(stream.name); char *name = new char[len + 1]; memcpy(name, stream.name, len); - for (int i = len - 1; i >= 0; i--) { + for (int i = int(len) - 1; i >= 0; i--) { if (name[i] == '/' || name[i] == '\\') break; if (name[i] == '.') { @@ -2549,7 +2549,7 @@ namespace TR { cin = new Stream(name); } else { len = strlen(name); - for (int i = len - 1; i >= 0; i--) + for (int i = int(len) - 1; i >= 0; i--) if (name[i] == '/' || name[i] == '\\') { char *newName = new char[len + 11 + 1]; name[i] = 0; diff --git a/src/gameflow.h b/src/gameflow.h index 7c5f613..89b71f9 100644 --- a/src/gameflow.h +++ b/src/gameflow.h @@ -670,7 +670,7 @@ namespace TR { if (name) { // skip directory path int start = 0; - for (int i = strlen(name) - 1; i >= 0; i--) + for (int i = int(strlen(name)) - 1; i >= 0; i--) if (name[i] == '/' || name[i] == '\\') { start = i + 1; break; @@ -1344,4 +1344,4 @@ namespace TR { #undef CHECK_FILE -#endif \ No newline at end of file +#endif diff --git a/src/libs/minimp3/minimp3.cpp b/src/libs/minimp3/minimp3.cpp index d8e2fe7..e285c84 100644 --- a/src/libs/minimp3/minimp3.cpp +++ b/src/libs/minimp3/minimp3.cpp @@ -54,10 +54,10 @@ #define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5)) #ifndef _MSC_VER - #define MULL(a,b) (((int64_t)(a) * (int64_t)(b)) >> FRAC_BITS) - #define MULH(a,b) (((int64_t)(a) * (int64_t)(b)) >> 32) + #define MULL(a,b) int32_t(((int64_t)(a) * (int64_t)(b)) >> FRAC_BITS) + #define MULH(a,b) int32_t(((int64_t)(a) * (int64_t)(b)) >> 32) #else - static INLINE int MULL(int a, int b) { + static INLINE int32_t MULL(int a, int b) { int res; __asm { mov eax, a @@ -69,7 +69,7 @@ } return res; } - static INLINE int MULH(int a, int b) { + static INLINE int32_t MULH(int a, int b) { int res; __asm { mov eax, a @@ -1659,7 +1659,7 @@ static void compute_imdct( if (v != 0) break; } - sblimit = ((ptr - g->sb_hybrid) / 18) + 1; + sblimit = int((ptr - g->sb_hybrid) / 18) + 1; if (g->block_type == 2) { /* XXX: check for 8000 Hz */ diff --git a/src/platform/osx/OpenLara.xcodeproj/project.pbxproj b/src/platform/osx/OpenLara.xcodeproj/project.pbxproj index 5d9c158..ef21f87 100644 --- a/src/platform/osx/OpenLara.xcodeproj/project.pbxproj +++ b/src/platform/osx/OpenLara.xcodeproj/project.pbxproj @@ -7,10 +7,14 @@ objects = { /* Begin PBXBuildFile section */ - 99713CC9204CAD9900006FAC /* tinflate.c in Sources */ = {isa = PBXBuildFile; fileRef = 99713CC8204CAD9900006FAC /* tinflate.c */; }; 523F97E41DDF7AA5006FE2FC /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 523F97E31DDF7AA5006FE2FC /* Cocoa.framework */; }; 523F97E61DDF926E006FE2FC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 523F97E51DDF926E006FE2FC /* QuartzCore.framework */; }; - 99BFB6A21DCA7F5300E2E997 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 99BFB6A11DCA7F5300E2E997 /* main.mm */; }; + 99713CC9204CAD9900006FAC /* tinflate.c in Sources */ = {isa = PBXBuildFile; fileRef = 99713CC8204CAD9900006FAC /* tinflate.c */; }; + 99BF38CD21E7176900D90A38 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 99BF38CC21E7176900D90A38 /* main.mm */; }; + 99BF38D221E7202500D90A38 /* audio in Resources */ = {isa = PBXBuildFile; fileRef = 99BF38CE21E7202500D90A38 /* audio */; }; + 99BF38D321E7202500D90A38 /* DELDATA in Resources */ = {isa = PBXBuildFile; fileRef = 99BF38CF21E7202500D90A38 /* DELDATA */; }; + 99BF38D421E7202500D90A38 /* PSXDATA in Resources */ = {isa = PBXBuildFile; fileRef = 99BF38D021E7202500D90A38 /* PSXDATA */; }; + 99BF38D521E7202500D90A38 /* FMV in Resources */ = {isa = PBXBuildFile; fileRef = 99BF38D121E7202500D90A38 /* FMV */; }; 99BFB6A91DCA87BF00E2E997 /* stb_vorbis.c in Sources */ = {isa = PBXBuildFile; fileRef = 99BFB6A81DCA87BF00E2E997 /* stb_vorbis.c */; }; 99BFB6AB1DCA87C500E2E997 /* minimp3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 99BFB6AA1DCA87C500E2E997 /* minimp3.cpp */; }; 99C4C0BA1796AB810032DE85 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 99C4C0931796A96F0032DE85 /* OpenGL.framework */; }; @@ -47,8 +51,12 @@ 99713CC5204CA3DA00006FAC /* ui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ui.h; path = ../../ui.h; sourceTree = ""; }; 99713CC6204CA3DA00006FAC /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = utils.h; path = ../../utils.h; sourceTree = ""; }; 99713CC8204CAD9900006FAC /* tinflate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tinflate.c; path = ../../libs/tinf/tinflate.c; sourceTree = ""; }; + 99BF38CC21E7176900D90A38 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = ""; }; + 99BF38CE21E7202500D90A38 /* audio */ = {isa = PBXFileReference; lastKnownFileType = folder; name = audio; path = ../../../../Desktop/OpenLara_TR1/audio; sourceTree = ""; }; + 99BF38CF21E7202500D90A38 /* DELDATA */ = {isa = PBXFileReference; lastKnownFileType = folder; name = DELDATA; path = ../../../../Desktop/OpenLara_TR1/DELDATA; sourceTree = ""; }; + 99BF38D021E7202500D90A38 /* PSXDATA */ = {isa = PBXFileReference; lastKnownFileType = folder; name = PSXDATA; path = ../../../../Desktop/OpenLara_TR1/PSXDATA; sourceTree = ""; }; + 99BF38D121E7202500D90A38 /* FMV */ = {isa = PBXFileReference; lastKnownFileType = folder; name = FMV; path = ../../../../Desktop/OpenLara_TR1/FMV; sourceTree = ""; }; 99BFB69E1DCA7F1700E2E997 /* libs */ = {isa = PBXFileReference; lastKnownFileType = folder; name = libs; path = ../../libs; sourceTree = ""; }; - 99BFB6A11DCA7F5300E2E997 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; 99BFB6A81DCA87BF00E2E997 /* stb_vorbis.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = stb_vorbis.c; path = ../../libs/stb_vorbis/stb_vorbis.c; sourceTree = ""; }; 99BFB6AA1DCA87C500E2E997 /* minimp3.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = minimp3.cpp; path = ../../libs/minimp3/minimp3.cpp; sourceTree = ""; }; 99C4C0931796A96F0032DE85 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; }; @@ -79,7 +87,11 @@ 99C4C0771796A8230032DE85 = { isa = PBXGroup; children = ( - 99BFB69E1DCA7F1700E2E997 /* libs */, + 99BF38CE21E7202500D90A38 /* audio */, + 99BF38CF21E7202500D90A38 /* DELDATA */, + 99BF38D121E7202500D90A38 /* FMV */, + 99BF38D021E7202500D90A38 /* PSXDATA */, + 99BF38CC21E7176900D90A38 /* main.mm */, 995C97EF1E91A857003825B2 /* shaders */, 99713CAE204CA3DA00006FAC /* animation.h */, 99713CAF204CA3DA00006FAC /* cache.h */, @@ -110,24 +122,6 @@ 99BFB6A81DCA87BF00E2E997 /* stb_vorbis.c */, 99713CC8204CAD9900006FAC /* tinflate.c */, 99BFB69E1DCA7F1700E2E997 /* libs */, - 99BFB6A11DCA7F5300E2E997 /* main.mm */, - 99BFB68D1DCA7F1700E2E997 /* lara.h */, - 99BFB68E1DCA7F1700E2E997 /* format.h */, - 99BFB68F1DCA7F1700E2E997 /* level.h */, - 99BFB6901DCA7F1700E2E997 /* mesh.h */, - 99BFB6911DCA7F1700E2E997 /* debug.h */, - 99BFB6921DCA7F1700E2E997 /* controller.h */, - 99BFB6931DCA7F1700E2E997 /* utils.h */, - 99BFB6941DCA7F1700E2E997 /* sound.h */, - 99BFB6951DCA7F1700E2E997 /* camera.h */, - 99BFB6961DCA7F1700E2E997 /* core.h */, - 99BFB6971DCA7F1700E2E997 /* trigger.h */, - 99BFB6981DCA7F1700E2E997 /* shader.h */, - 99BFB6991DCA7F1700E2E997 /* shader.glsl */, - 99BFB69A1DCA7F1700E2E997 /* input.h */, - 99BFB69B1DCA7F1700E2E997 /* enemy.h */, - 99BFB69C1DCA7F1700E2E997 /* game.h */, - 99BFB69D1DCA7F1700E2E997 /* texture.h */, 99C4C0A31796AACF0032DE85 /* Supporting Files */, 99C4C0821796A8230032DE85 /* Frameworks */, 99C4C0811796A8230032DE85 /* Products */, @@ -217,6 +211,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 99BF38D221E7202500D90A38 /* audio in Resources */, + 99BF38D321E7202500D90A38 /* DELDATA in Resources */, + 99BF38D421E7202500D90A38 /* PSXDATA in Resources */, + 99BF38D521E7202500D90A38 /* FMV in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -227,9 +225,9 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 99BF38CD21E7176900D90A38 /* main.mm in Sources */, 99713CC9204CAD9900006FAC /* tinflate.c in Sources */, 99BFB6AB1DCA87C500E2E997 /* minimp3.cpp in Sources */, - 99BFB6A21DCA7F5300E2E997 /* main.mm in Sources */, 99BFB6A91DCA87BF00E2E997 /* stb_vorbis.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -273,6 +271,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = "-v"; SDKROOT = macosx; }; name = Debug; @@ -305,6 +304,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.6; + OTHER_LDFLAGS = "-v"; SDKROOT = macosx; }; name = Release; @@ -312,12 +312,14 @@ 99C4C0B51796AAD00032DE85 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + ARCHS = "$(ARCHS_STANDARD)"; + CLANG_CXX_LIBRARY = "libc++"; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = "OpenLara-Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.7; + OTHER_LDFLAGS = "--verbose"; PRODUCT_BUNDLE_IDENTIFIER = "com.xproger.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; @@ -327,13 +329,15 @@ 99C4C0B61796AAD00032DE85 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + ARCHS = "$(ARCHS_STANDARD)"; + CLANG_CXX_LIBRARY = "libc++"; COMBINE_HIDPI_IMAGES = YES; GCC_OPTIMIZATION_LEVEL = 3; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = "OpenLara-Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.7; + OTHER_LDFLAGS = "--verbose"; PRODUCT_BUNDLE_IDENTIFIER = "com.xproger.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; diff --git a/src/platform/osx/main.mm b/src/platform/osx/main.mm new file mode 100644 index 0000000..acd5de3 --- /dev/null +++ b/src/platform/osx/main.mm @@ -0,0 +1,261 @@ +#include +#include +#include + +#include "game.h" + +// sound +#define SND_SIZE 2352 + +static AudioQueueRef audioQueue; + +void soundFill(void* inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer) { + void* frames = inBuffer->mAudioData; + UInt32 count = inBuffer->mAudioDataBytesCapacity / 4; + Sound::fill((Sound::Frame*)frames, count); + inBuffer->mAudioDataByteSize = count * 4; + AudioQueueEnqueueBuffer(audioQueue, inBuffer, 0, NULL); +} + +void soundInit() { + AudioStreamBasicDescription deviceFormat; + deviceFormat.mSampleRate = 44100; + deviceFormat.mFormatID = kAudioFormatLinearPCM; + deviceFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger; + deviceFormat.mBytesPerPacket = 4; + deviceFormat.mFramesPerPacket = 1; + deviceFormat.mBytesPerFrame = 4; + deviceFormat.mChannelsPerFrame = 2; + deviceFormat.mBitsPerChannel = 16; + deviceFormat.mReserved = 0; + + AudioQueueNewOutput(&deviceFormat, soundFill, NULL, NULL, NULL, 0, &audioQueue); + + for (int i = 0; i < 2; i++) { + AudioQueueBufferRef mBuffer; + AudioQueueAllocateBuffer(audioQueue, SND_SIZE, &mBuffer); + soundFill(NULL, audioQueue, mBuffer); + } + AudioQueueStart(audioQueue, NULL); +} + +// common input functions +InputKey keyToInputKey(int code) { + static const int codes[] = { + 0x7B, 0x7C, 0x7E, 0x7D, 0x31, 0x30, 0x24, 0x35, 0x38, 0x3B, 0x3A, + 0x1D, 0x12, 0x13, 0x14, 0x15, 0x17, 0x16, 0x1A, 0x1C, 0x19, // 0..9 + 0x00, 0x0B, 0x08, 0x02, 0x0E, 0x03, 0x05, 0x04, 0x22, 0x26, 0x28, 0x25, 0x2E, // A..M + 0x2D, 0x1F, 0x23, 0x0C, 0x0F, 0x01, 0x11, 0x20, 0x09, 0x0D, 0x07, 0x10, 0x06, // N..Z + }; + + for (int i = 0; i < sizeof(codes) / sizeof(codes[0]); i++) + if (codes[i] == code) { + return (InputKey)(ikLeft + i); + LOG("%d\n", code); + } + return ikNone; +} + +InputKey mouseToInputKey(int btn) { + switch (btn) { + case 1 : return ikMouseL; + case 2 : return ikMouseR; + case 3 : return ikMouseM; + } + return ikNone; +} + +bool osJoyReady(int index) { + return false; +} + +void osJoyVibrate(int index, float L, float R) { + // TODO +} + +// timing +int osGetTime() { + static mach_timebase_info_data_t timebaseInfo; + if (timebaseInfo.denom == 0) { + mach_timebase_info(&timebaseInfo); + } + + uint64_t absolute = mach_absolute_time(); + uint64_t milliseconds = absolute * timebaseInfo.numer / (timebaseInfo.denom * 1000000ULL); + return int(milliseconds); +} + +@interface OpenLaraGLView : NSOpenGLView + +@end + +@implementation OpenLaraGLView + +- (InputKey)inputKeyForMouseEvent:(NSEvent *)theEvent { + switch (theEvent.buttonNumber) { + case 0 : return ikMouseL; + case 1 : return ikMouseR; + case 2 : return ikMouseM; + default : return ikNone; + } +} + +- (vec2)inputPositionForMouseEvent:(NSEvent *)theEvent { + NSPoint inWindow = theEvent.locationInWindow; + NSPoint inView = [self convertPoint:inWindow fromView:nil]; + return vec2(inView.x, Core::height - inView.y); +} + +- (void)mouseDown:(NSEvent *)theEvent { + InputKey inputKey = [self inputKeyForMouseEvent:theEvent]; + Input::setPos(inputKey, [self inputPositionForMouseEvent:theEvent]); + Input::setDown(inputKey, true); +} + +- (void)rightMouseDown:(NSEvent *)theEvent { + [self mouseDown:theEvent]; +} + +- (void)otherMouseDown:(NSEvent *)theEvent { + [self mouseDown:theEvent]; +} + +- (void)mouseUp:(NSEvent *)theEvent { + InputKey inputKey = [self inputKeyForMouseEvent:theEvent]; + Input::setPos(inputKey, [self inputPositionForMouseEvent:theEvent]); + Input::setDown(inputKey, false); +} + +- (void)rightMouseUp:(NSEvent *)theEvent { + [self mouseUp:theEvent]; +} + +- (void)otherMouseUp:(NSEvent *)theEvent { + [self mouseUp:theEvent]; +} + +- (void)mouseDragged:(NSEvent *)theEvent { + InputKey inputKey = [self inputKeyForMouseEvent:theEvent]; + Input::setPos(inputKey, [self inputPositionForMouseEvent:theEvent]); +} + +- (void)rightMouseDragged:(NSEvent *)theEvent { + [self mouseDragged:theEvent]; +} + +- (void)otherMouseDragged:(NSEvent *)theEvent { + [self mouseDragged:theEvent]; +} + +- (void)keyDown:(NSEvent *)theEvent { + unsigned short keyCode = theEvent.keyCode; + Input::setDown(keyToInputKey(keyCode), true); +} + +- (void)keyUp:(NSEvent *)theEvent { + unsigned short keyCode = theEvent.keyCode; + Input::setDown(keyToInputKey(keyCode), false); +} + +- (void)flagsChanged:(NSEvent *)theEvent { + NSEventModifierFlags modifiers = theEvent.modifierFlags; + Input::setDown(ikShift, modifiers & NSEventModifierFlagShift); + Input::setDown(ikCtrl, modifiers & NSEventModifierFlagControl); + Input::setDown(ikAlt, modifiers & NSEventModifierFlagOption); +} + +- (BOOL)acceptsFirstResponder { + return YES; +} + +- (void)reshape { + NSRect bounds = self.bounds; + Core::width = bounds.size.width; + Core::height = bounds.size.height; +} + +- (void)prepareOpenGL { + GLint swapInt = 1; + [[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval]; +} + +- (void)drawRect:(NSRect)dirtyRect { + NSOpenGLContext *context = [self openGLContext]; + + if (!Game::update()) + return; + Game::render(); + + [context flushBuffer]; + + BOOL arg = YES; + NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:@selector(setNeedsDisplay:)]]; + [inv setSelector:@selector(setNeedsDisplay:)]; + [inv setTarget:self]; + [inv setArgument:&arg atIndex:2]; + [inv performSelector:@selector(invoke) withObject:self afterDelay:0.01]; +} + +@end + +@interface OpenLaraWindowDelegate : NSObject +@end + +@implementation OpenLaraWindowDelegate + +- (void)windowWillClose:(NSNotification *)notification { + [[NSApplication sharedApplication] terminate:self]; +} + +@end + +int main() { + cacheDir[0] = saveDir[0] = contentDir[0] = 0; + + NSApplication *application = [NSApplication sharedApplication]; + + // init window + NSRect rect = NSMakeRect(0, 0, 1280, 720); + NSWindow *mainWindow = [[NSWindow alloc] initWithContentRect:rect styleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask backing:NSBackingStoreBuffered defer:YES]; + mainWindow.title = @"OpenLara"; + mainWindow.acceptsMouseMovedEvents = YES; + mainWindow.delegate = [[OpenLaraWindowDelegate alloc] init]; + + // init OpenGL context + NSOpenGLPixelFormatAttribute attribs[] = { + NSOpenGLPFADoubleBuffer, + NSOpenGLPFAColorSize, 32, + NSOpenGLPFADepthSize, 24, + NSOpenGLPFAStencilSize, 8, + NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy, + 0 + }; + NSOpenGLPixelFormat *format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; + + OpenLaraGLView *view = [[OpenLaraGLView alloc] initWithFrame:mainWindow.contentLayoutRect pixelFormat:format]; + view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; + mainWindow.contentView = view; + [view.openGLContext makeCurrentContext]; + + // get path to game content + NSBundle *bundle = [NSBundle mainBundle]; + NSURL *resourceURL = bundle.resourceURL; + [resourceURL getFileSystemRepresentation:contentDir maxLength:sizeof(contentDir)]; + strcat(contentDir, "/"); + + // show window + [mainWindow center]; + [mainWindow makeKeyAndOrderFront:nil]; + + soundInit(); + Game::init(); + + if (!Core::isQuit) { + [application run]; + } + + Game::deinit(); + // TODO: sndFree + + return 0; +} diff --git a/src/utils.h b/src/utils.h index bd7da34..9ad0d78 100644 --- a/src/utils.h +++ b/src/utils.h @@ -4,6 +4,7 @@ #include #include #include +#include //#define TEST_SLOW_FIO @@ -1412,7 +1413,8 @@ struct Stream { if (bufferIndex != bIndex) { bufferIndex = bIndex; - int readed, part; + size_t readed; + int part; if (fpos == pos) { part = min(count / STREAM_BUFFER_SIZE * STREAM_BUFFER_SIZE, size - fpos); @@ -1420,7 +1422,7 @@ struct Stream { readed = fread(ptr, 1, part, f); #ifdef TEST_SLOW_FIO - LOG("%s read %d + %d\n", name, fpos, readed); + LOG("%s read %d + %d\n", name, fpos, (int)readed); Sleep(5); #endif @@ -1594,9 +1596,7 @@ void osReadSlot(Stream *stream) { void* osMutexInit() { pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); -#if !defined(_OS_WEB) && !defined(_OS_IOS) - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); -#endif + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_t *mutex = new pthread_mutex_t(); pthread_mutex_init(mutex, &attr); @@ -1804,7 +1804,7 @@ struct FixedStr { } FixedStr& operator = (const char *str) { - int len = min(sizeof(data), strlen(str)); + size_t len = min(sizeof(data), strlen(str)); memset(data, 0, sizeof(data)); memcpy(data, str, len); return *this;