Mercurial > hg > openttd
changeset 5383:2a31a9428c08 draft
(svn r7569) -Fix (r7565): cocoa files were (somehow) forgotten.
-Change: messages about failures is cocoa should be debug level 0 and show what went wrong. " failed with message X" isn't really descriptive.
-Change: remove unneeded level 1 debug messages for entering some cocoa functions.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Tue, 26 Dec 2006 22:04:53 +0000 |
parents | c483d7751315 |
children | 8d01a08502fc |
files | sound/cocoa_s.c video/cocoa_v.m |
diffstat | 2 files changed, 13 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/sound/cocoa_s.c +++ b/sound/cocoa_s.c @@ -55,8 +55,6 @@ struct AudioUnitInputCallback callback; AudioStreamBasicDescription requestedDesc; - DEBUG(driver, 1)("cocoa_s: CocoaSoundStart"); - /* Setup a AudioStreamBasicDescription with the requested format */ requestedDesc.mFormatID = kAudioFormatLinearPCM; requestedDesc.mFormatFlags = kLinearPCMFormatFlagIsPacked; @@ -122,11 +120,9 @@ { struct AudioUnitInputCallback callback; - DEBUG(driver, 1)("cocoa_s: CocoaSoundStop"); - /* stop processing the audio unit */ if (AudioOutputUnitStop(_outputAudioUnit) != noErr) { - DEBUG(driver, 1)("cocoa_s: Core_CloseAudio: AudioOutputUnitStop failed"); + DEBUG(driver, 0, "cocoa_s: Core_CloseAudio: AudioOutputUnitStop failed"); return; } @@ -134,12 +130,12 @@ callback.inputProc = 0; callback.inputProcRefCon = 0; if (AudioUnitSetProperty(_outputAudioUnit, kAudioUnitProperty_SetInputCallback, kAudioUnitScope_Input, 0, &callback, sizeof(callback)) != noErr) { - DEBUG(driver, 1)("cocoa_s: Core_CloseAudio: AudioUnitSetProperty (kAudioUnitProperty_SetInputCallback) failed"); + DEBUG(driver, 0, "cocoa_s: Core_CloseAudio: AudioUnitSetProperty (kAudioUnitProperty_SetInputCallback) failed"); return; } if (CloseComponent(_outputAudioUnit) != noErr) { - DEBUG(driver, 1)("cocoa_s: Core_CloseAudio: CloseComponent failed"); + DEBUG(driver, 0, "cocoa_s: Core_CloseAudio: CloseComponent failed"); return; } }
--- a/video/cocoa_v.m +++ b/video/cocoa_v.m @@ -349,9 +349,9 @@ if (down) { uint32 pressed_key = QZ_MapKey(keycode) | unicode; HandleKeypress(pressed_key); - DEBUG(driver, 2)("cocoa_v: QZ_KeyEvent: %x (%x), down, mapping: %x", keycode, unicode, pressed_key); + DEBUG(driver, 2, "cocoa_v: QZ_KeyEvent: %x (%x), down, mapping: %x", keycode, unicode, pressed_key); } else { - DEBUG(driver, 2)("cocoa_v: QZ_KeyEvent: %x (%x), up", keycode, unicode); + DEBUG(driver, 2, "cocoa_v: QZ_KeyEvent: %x (%x), up", keycode, unicode); } } @@ -663,8 +663,6 @@ #endif int i; - DEBUG(driver, 1)("cocoa_v: QZ_GameLoop"); - #ifdef _DEBUG et0 = GetTick(); st = 0; @@ -742,10 +740,10 @@ #ifdef _DEBUG et = GetTick(); - DEBUG(driver, 1)("cocoa_v: nextEventMatchingMask took %i ms total", _cocoa_video_data.tEvent); - DEBUG(driver, 1)("cocoa_v: game loop took %i ms total (%i ms without sleep)", et - et0, et - et0 - st); - DEBUG(driver, 1)("cocoa_v: (nextEventMatchingMask total)/(game loop total) is %f%%", (double)_cocoa_video_data.tEvent / (double)(et - et0) * 100); - DEBUG(driver, 1)("cocoa_v: (nextEventMatchingMask total)/(game loop without sleep total) is %f%%", (double)_cocoa_video_data.tEvent / (double)(et - et0 - st) * 100); + DEBUG(driver, 1, "cocoa_v: nextEventMatchingMask took %i ms total", _cocoa_video_data.tEvent); + DEBUG(driver, 1, "cocoa_v: game loop took %i ms total (%i ms without sleep)", et - et0, et - et0 - st); + DEBUG(driver, 1, "cocoa_v: (nextEventMatchingMask total)/(game loop total) is %f%%", (double)_cocoa_video_data.tEvent / (double)(et - et0) * 100); + DEBUG(driver, 1, "cocoa_v: (nextEventMatchingMask total)/(game loop without sleep total) is %f%%", (double)_cocoa_video_data.tEvent / (double)(et - et0 - st) * 100); #endif } @@ -1936,8 +1934,6 @@ static void CocoaVideoStop(void) { - DEBUG(driver, 1)("cocoa_v: CocoaVideoStop"); - if (!_cocoa_video_started) return; if (_cocoa_video_data.isset) QZ_UnsetVideoMode(); @@ -1951,8 +1947,6 @@ { const char *ret; - DEBUG(driver, 1)("cocoa_v: CocoaVideoStart"); - if (_cocoa_video_started) return "Already started"; _cocoa_video_started = true; @@ -1984,20 +1978,15 @@ static void CocoaVideoMainLoop(void) { - DEBUG(driver, 1)("cocoa_v: CocoaVideoMainLoop"); - /* Start the main event loop */ [NSApp run]; } static bool CocoaVideoChangeRes(int w, int h) { - const char *ret; - DEBUG(driver, 1)("cocoa_v: CocoaVideoChangeRes"); - - ret = QZ_SetVideoModeAndRestoreOnFailure((uint)w, (uint)h, _cocoa_video_data.fullscreen); + const char *ret = QZ_SetVideoModeAndRestoreOnFailure((uint)w, (uint)h, _cocoa_video_data.fullscreen); if (ret != NULL) { - DEBUG(driver, 1)("cocoa_v: failed with message: %s", ret); + DEBUG(driver, 0, "cocoa_v: CocoaVideoChangeRes failed with message: %s", ret); } return ret == NULL; @@ -2005,13 +1994,9 @@ static void CocoaVideoFullScreen(bool full_screen) { - const char *ret; - - DEBUG(driver, 1)("cocoa_v: CocoaVideoFullScreen"); - - ret = QZ_SetVideoModeAndRestoreOnFailure(_cocoa_video_data.width, _cocoa_video_data.height, full_screen); + const char *ret = QZ_SetVideoModeAndRestoreOnFailure(_cocoa_video_data.width, _cocoa_video_data.height, full_screen); if (ret != NULL) { - DEBUG(driver, 1)("cocoa_v: failed with message: %s", ret); + DEBUG(driver, 0, "cocoa_v: CocoaVideoFullScreen failed with message: %s", ret); } _fullscreen = _cocoa_video_data.fullscreen;