(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.
This commit is contained in:
		@@ -55,8 +55,6 @@ static const char *CocoaSoundStart(const char * const *parm)
 | 
				
			|||||||
	struct AudioUnitInputCallback callback;
 | 
						struct AudioUnitInputCallback callback;
 | 
				
			||||||
	AudioStreamBasicDescription requestedDesc;
 | 
						AudioStreamBasicDescription requestedDesc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	DEBUG(driver, 1)("cocoa_s: CocoaSoundStart");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Setup a AudioStreamBasicDescription with the requested format */
 | 
						/* Setup a AudioStreamBasicDescription with the requested format */
 | 
				
			||||||
	requestedDesc.mFormatID = kAudioFormatLinearPCM;
 | 
						requestedDesc.mFormatID = kAudioFormatLinearPCM;
 | 
				
			||||||
	requestedDesc.mFormatFlags = kLinearPCMFormatFlagIsPacked;
 | 
						requestedDesc.mFormatFlags = kLinearPCMFormatFlagIsPacked;
 | 
				
			||||||
@@ -122,11 +120,9 @@ static void CocoaSoundStop(void)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	struct AudioUnitInputCallback callback;
 | 
						struct AudioUnitInputCallback callback;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	DEBUG(driver, 1)("cocoa_s: CocoaSoundStop");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* stop processing the audio unit */
 | 
						/* stop processing the audio unit */
 | 
				
			||||||
	if (AudioOutputUnitStop(_outputAudioUnit) != noErr) {
 | 
						if (AudioOutputUnitStop(_outputAudioUnit) != noErr) {
 | 
				
			||||||
		DEBUG(driver, 1)("cocoa_s: Core_CloseAudio: AudioOutputUnitStop failed");
 | 
							DEBUG(driver, 0, "cocoa_s: Core_CloseAudio: AudioOutputUnitStop failed");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -134,12 +130,12 @@ static void CocoaSoundStop(void)
 | 
				
			|||||||
	callback.inputProc = 0;
 | 
						callback.inputProc = 0;
 | 
				
			||||||
	callback.inputProcRefCon = 0;
 | 
						callback.inputProcRefCon = 0;
 | 
				
			||||||
	if (AudioUnitSetProperty(_outputAudioUnit, kAudioUnitProperty_SetInputCallback, kAudioUnitScope_Input, 0, &callback, sizeof(callback)) != noErr) {
 | 
						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;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (CloseComponent(_outputAudioUnit) != noErr) {
 | 
						if (CloseComponent(_outputAudioUnit) != noErr) {
 | 
				
			||||||
		DEBUG(driver, 1)("cocoa_s: Core_CloseAudio: CloseComponent failed");
 | 
							DEBUG(driver, 0, "cocoa_s: Core_CloseAudio: CloseComponent failed");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -349,9 +349,9 @@ static void QZ_KeyEvent(unsigned short keycode, unsigned short unicode, BOOL dow
 | 
				
			|||||||
	if (down) {
 | 
						if (down) {
 | 
				
			||||||
		uint32 pressed_key = QZ_MapKey(keycode) | unicode;
 | 
							uint32 pressed_key = QZ_MapKey(keycode) | unicode;
 | 
				
			||||||
		HandleKeypress(pressed_key);
 | 
							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 {
 | 
						} 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 @@ static void QZ_GameLoop(void)
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	DEBUG(driver, 1)("cocoa_v: QZ_GameLoop");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef _DEBUG
 | 
					#ifdef _DEBUG
 | 
				
			||||||
	et0 = GetTick();
 | 
						et0 = GetTick();
 | 
				
			||||||
	st = 0;
 | 
						st = 0;
 | 
				
			||||||
@@ -742,10 +740,10 @@ static void QZ_GameLoop(void)
 | 
				
			|||||||
#ifdef _DEBUG
 | 
					#ifdef _DEBUG
 | 
				
			||||||
	et = GetTick();
 | 
						et = GetTick();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	DEBUG(driver, 1)("cocoa_v: nextEventMatchingMask took %i ms total", _cocoa_video_data.tEvent);
 | 
						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: 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 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 total)/(game loop without sleep total) is %f%%", (double)_cocoa_video_data.tEvent / (double)(et - et0 - st) * 100);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1936,8 +1934,6 @@ static void setupApplication(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static void CocoaVideoStop(void)
 | 
					static void CocoaVideoStop(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	DEBUG(driver, 1)("cocoa_v: CocoaVideoStop");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (!_cocoa_video_started) return;
 | 
						if (!_cocoa_video_started) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (_cocoa_video_data.isset) QZ_UnsetVideoMode();
 | 
						if (_cocoa_video_data.isset) QZ_UnsetVideoMode();
 | 
				
			||||||
@@ -1951,8 +1947,6 @@ static const char *CocoaVideoStart(const char * const *parm)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	const char *ret;
 | 
						const char *ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	DEBUG(driver, 1)("cocoa_v: CocoaVideoStart");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (_cocoa_video_started) return "Already started";
 | 
						if (_cocoa_video_started) return "Already started";
 | 
				
			||||||
	_cocoa_video_started = true;
 | 
						_cocoa_video_started = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1984,20 +1978,15 @@ static void CocoaVideoMakeDirty(int left, int top, int width, int height)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static void CocoaVideoMainLoop(void)
 | 
					static void CocoaVideoMainLoop(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	DEBUG(driver, 1)("cocoa_v: CocoaVideoMainLoop");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Start the main event loop */
 | 
						/* Start the main event loop */
 | 
				
			||||||
	[NSApp run];
 | 
						[NSApp run];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool CocoaVideoChangeRes(int w, int h)
 | 
					static bool CocoaVideoChangeRes(int w, int h)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const char *ret;
 | 
						const char *ret = QZ_SetVideoModeAndRestoreOnFailure((uint)w, (uint)h, _cocoa_video_data.fullscreen);
 | 
				
			||||||
	DEBUG(driver, 1)("cocoa_v: CocoaVideoChangeRes");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ret = QZ_SetVideoModeAndRestoreOnFailure((uint)w, (uint)h, _cocoa_video_data.fullscreen);
 | 
					 | 
				
			||||||
	if (ret != NULL) {
 | 
						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;
 | 
						return ret == NULL;
 | 
				
			||||||
@@ -2005,13 +1994,9 @@ static bool CocoaVideoChangeRes(int w, int h)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static void CocoaVideoFullScreen(bool full_screen)
 | 
					static void CocoaVideoFullScreen(bool full_screen)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const char *ret;
 | 
						const char *ret = QZ_SetVideoModeAndRestoreOnFailure(_cocoa_video_data.width, _cocoa_video_data.height, full_screen);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	DEBUG(driver, 1)("cocoa_v: CocoaVideoFullScreen");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ret = QZ_SetVideoModeAndRestoreOnFailure(_cocoa_video_data.width, _cocoa_video_data.height, full_screen);
 | 
					 | 
				
			||||||
	if (ret != NULL) {
 | 
						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;
 | 
						_fullscreen = _cocoa_video_data.fullscreen;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user