From cab89769b4c228a919f96a8b4fc54a208dfe4cf7 Mon Sep 17 00:00:00 2001 From: dhewg Date: Sat, 31 Dec 2011 15:31:49 +0100 Subject: [PATCH] Get rid of dead code in the OSX backend Not used by anything. --- neo/CMakeLists.txt | 3 - neo/sys/osx/DOOMController.mm | 11 -- neo/sys/osx/macosx_common.h | 2 - neo/sys/osx/macosx_glimp.mm | 12 -- neo/sys/osx/macosx_guids.cpp | 5 - neo/sys/osx/macosx_local.h | 6 - neo/sys/osx/macosx_sys.h | 9 -- neo/sys/osx/macosx_sys.mm | 254 ---------------------------------- neo/sys/osx/macosx_timers.h | 17 --- neo/sys/osx/macosx_utils.mm | 164 ---------------------- 10 files changed, 483 deletions(-) delete mode 100644 neo/sys/osx/macosx_common.h delete mode 100644 neo/sys/osx/macosx_guids.cpp delete mode 100644 neo/sys/osx/macosx_sys.mm delete mode 100644 neo/sys/osx/macosx_timers.h delete mode 100644 neo/sys/osx/macosx_utils.mm diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index fbcc8a0a..dd9053bc 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -634,13 +634,10 @@ if (APPLE) sys/posix/posix_input.cpp sys/osx/PickMonitor.cpp sys/osx/PreferencesDialog.cpp - sys/osx/macosx_guids.cpp sys/osx/DOOMController.mm sys/osx/macosx_event.mm sys/osx/macosx_glimp.mm sys/osx/macosx_misc.mm -# sys/osx/macosx_utils.mm -# sys/osx/macosx_sys.mm ) elseif (WIN32) set(src_sys_base diff --git a/neo/sys/osx/DOOMController.mm b/neo/sys/osx/DOOMController.mm index 904373cf..551a34bc 100644 --- a/neo/sys/osx/DOOMController.mm +++ b/neo/sys/osx/DOOMController.mm @@ -44,7 +44,6 @@ If you have questions concerning this license or the applicable additional terms #import "idlib/Str.h" #import "framework/Licensee.h" #import "framework/Common.h" -#import "sys/osx/macosx_common.h" #import "sys/osx/macosx_local.h" #import "sys/osx/macosx_sys.h" @@ -136,12 +135,10 @@ FPU_EXCEPTION_DIVIDE_BY_ZERO | \ } extern void CL_Quit_f(void); -//extern void SetProgramPath(const char *path); - (IBAction)requestTerminate:(id)sender; { - //osxQuit(); common->Quit(); } @@ -333,11 +330,6 @@ extern void CL_Quit_f(void); [NSApp activateIgnoringOtherApps:YES]; while (1) { -#ifdef OMNI_TIMER - OTPeriodicTimerReset(); - OTNodeStart(RootNode); -#endif - // maintain exceptions in case system calls are turning them off (is that needed) //Sys_FPU_EnableExceptions( TEST_FPU_EXCEPTIONS ); @@ -346,9 +338,6 @@ extern void CL_Quit_f(void); // We should think about doing this less frequently than every frame [pool release]; pool = [[NSAutoreleasePool alloc] init]; -#ifdef OMNI_TIMER - OTNodeStop(RootNode); -#endif } [pool release]; diff --git a/neo/sys/osx/macosx_common.h b/neo/sys/osx/macosx_common.h deleted file mode 100644 index 1cf65990..00000000 --- a/neo/sys/osx/macosx_common.h +++ /dev/null @@ -1,2 +0,0 @@ -const char *macosx_scanForLibraryDirectory(void); - diff --git a/neo/sys/osx/macosx_glimp.mm b/neo/sys/osx/macosx_glimp.mm index 8f7e32ca..1c8f5470 100644 --- a/neo/sys/osx/macosx_glimp.mm +++ b/neo/sys/osx/macosx_glimp.mm @@ -455,13 +455,6 @@ GLimp_Init Don't return unless OpenGL has been properly initialized =================== */ - -#ifdef OMNI_TIMER -static void GLImp_Dump_Stamp_List_f(void) { - OTStampListDumpToFile(glThreadStampList, "/tmp/gl_stamps"); -} -#endif - bool GLimp_Init( glimpParms_t parms ) { char *buf; @@ -1227,11 +1220,6 @@ GLExtension_t GLimp_ExtensionPointer(const char *name) { return (GLExtension_t)(NSAddressOfSymbol(symbol)); } -void * wglGetProcAddress(const char *name) { - return (void *)GLimp_ExtensionPointer( name ); -} - - /* ** GLW_InitExtensions */ diff --git a/neo/sys/osx/macosx_guids.cpp b/neo/sys/osx/macosx_guids.cpp deleted file mode 100644 index 78e6bcf3..00000000 --- a/neo/sys/osx/macosx_guids.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "sys/platform.h" - -#define INITGUID - -#include "sound/snd_local.h" diff --git a/neo/sys/osx/macosx_local.h b/neo/sys/osx/macosx_local.h index 4806dacc..2e98dbf7 100644 --- a/neo/sys/osx/macosx_local.h +++ b/neo/sys/osx/macosx_local.h @@ -3,8 +3,6 @@ #include "sys/sys_public.h" -void OutputDebugString( const char *text ); - // input void Sys_InitInput( void ); void Sys_ShutdownInput( void ); @@ -15,8 +13,4 @@ void IN_ActivateMouse( void); void IN_Activate (bool active); void IN_Frame (void); -void * wglGetProcAddress(const char *name); - -void Sleep( const int time ); - void Sys_UpdateWindowMouseInputRect( void ); diff --git a/neo/sys/osx/macosx_sys.h b/neo/sys/osx/macosx_sys.h index 045bc268..b5841c08 100644 --- a/neo/sys/osx/macosx_sys.h +++ b/neo/sys/osx/macosx_sys.h @@ -6,20 +6,11 @@ #import #import -// sys - -const char *macosx_scanForLibraryDirectory(void); - // In macosx_input.m -void Sys_InitInput(void); -void Sys_ShutdownInput(void); CGDirectDisplayID Sys_DisplayToUse(void); -//extern void osxQuit(); void SetProgramPath(char *path); void Sys_SetMouseInputRect(CGRect newRect); -void Sys_AnnoyingBanner(); - // In macosx_glimp.m bool Sys_Hide(); bool Sys_Unhide(); diff --git a/neo/sys/osx/macosx_sys.mm b/neo/sys/osx/macosx_sys.mm deleted file mode 100644 index 4b74cf73..00000000 --- a/neo/sys/osx/macosx_sys.mm +++ /dev/null @@ -1,254 +0,0 @@ -/* -=========================================================================== - -Doom 3 GPL Source Code -Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). - -Doom 3 Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 Source Code. If not, see . - -In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -// -*- mode: objc -*- -#import - -#import -#import -#import -#import -#import -#import - -#import "sys/platform.h" -#import "sys/osx/macosx_common.h" -#import "sys/osx/macosx_local.h" -#import "sys/osx/macosx_sys.h" - -#ifdef OMNI_TIMER -#import "sys/osx/macosx_timers.h" -#endif - -void Sys_Init (void); - -char *Sys_GetCurrentUser( void ); - -void Sys_Error( const char *error, ...); -void Sys_Quit (void); -char *Sys_GetClipboardData( void ); // note that this isn't journaled... - -void Sys_Print( const char *msg ); -//=========================================================================== - -int main(int argc, char *argv[]) { - return NSApplicationMain(argc, (const char **)argv); -} - -//=========================================================================== - -void EditorPrintConsole( const char *test ) { -} - -/* -================= -Sys_UnloadDll - -================= -*/ -void Sys_UnloadDll( void *dllHandle ) { -} - -/* -================= -Sys_LoadDll - -Used to load a development dll instead of a virtual machine -================= -*/ -extern char *FS_BuildOSPath( const char *base, const char *game, const char *qpath ); - -void *Sys_LoadDll( const char *name, int (**entryPoint)(int, ...), - int (*systemcalls)(int, ...) ) -{ - return NULL; -} - -//=========================================================================== - -char *Sys_GetClipboardData(void) // FIXME -{ - NSPasteboard *pasteboard; - NSArray *pasteboardTypes; - - pasteboard = [NSPasteboard generalPasteboard]; - pasteboardTypes = [pasteboard types]; - if ([pasteboardTypes containsObject:NSStringPboardType]) { - NSString *clipboardString; - - clipboardString = [pasteboard stringForType:NSStringPboardType]; - if (clipboardString && [clipboardString length] > 0) { - return strdup([clipboardString cString]); - } - } - return NULL; -} - -//=========================================================================== - -void Sys_BeginProfiling(void) -{ -} - -void Sys_EndProfiling(void) -{ -} - -//=========================================================================== - -/* -================ -Sys_Init - -The cvar and file system has been setup, so configurations are loaded -================ -*/ -void Sys_Init(void) -{ -// Sys_InitNetwork(); - Sys_InitInput(); -} - -/* -================= -Sys_Shutdown -================= -*/ -void Sys_Shutdown(void) -{ - common->Printf( "----- Sys_Shutdown -----\n" ); - Sys_EndProfiling(); - Sys_ShutdownInput(); - common->Printf( "------------------------\n" ); -} - -void Sys_Error(const char *error, ...) -{ - va_list argptr; - NSString *formattedString; - - Sys_Shutdown(); - - va_start(argptr,error); - formattedString = [[NSString alloc] initWithFormat:[NSString stringWithCString:error] arguments:argptr]; - va_end(argptr); - - NSLog(@"Sys_Error: %@", formattedString); - NSRunAlertPanel(@"DOOM Error", formattedString, nil, nil, nil); - - Sys_Quit(); -} - -void Sys_Quit(void) -{ - Sys_Shutdown(); - [NSApp terminate:nil]; -} - -/* -================ -Sys_Print - -This is called for all console output, even if the game is running -full screen and the dedicated console window is hidden. -================ -*/ - -char *ansiColors[8] = - { "\033[30m" , /* ANSI Black */ - "\033[31m" , /* ANSI Red */ - "\033[32m" , /* ANSI Green */ - "\033[33m" , /* ANSI Yellow */ - "\033[34m" , /* ANSI Blue */ - "\033[36m" , /* ANSI Cyan */ - "\033[35m" , /* ANSI Magenta */ - "\033[37m" }; /* ANSI White */ - -void Sys_Print(const char *text) -{ -#if 0 - /* Okay, this is a stupid hack, but what the hell, I was bored. ;) */ - char *scan = text; - char code; - int index; - - /* Make sure terminal mode is reset at the start of the line... */ - fputs("\033[0m", stdout); - - while(*scan) { - /* See if we have a color control code. If so, snarf the character, - print what we have so far, print the ANSI Terminal color code, - skip over the color control code and continue */ - if(Q_IsColorString(scan)) { - index = ColorIndex(scan[1]); - - /* Flush current message */ - if(scan != text) { - fwrite(text, scan - text, 1, stdout); - } - - /* Write ANSI color code */ - fputs(ansiColors[index], stdout); - - /* Reset search */ - text = scan+2; - scan = text; - continue; - } - scan++; - } - - /* Flush whatever's left */ - fputs(text, stdout); - - /* Make sure terminal mode is reset at the end of the line too... */ - fputs("\033[0m", stdout); - -#else - fputs(text, stdout); -#endif -} - -void OutputDebugString( const char *text ) { - Sys_Print( text ); -} - -void Sys_OutputDebugString( const char *text ) { - OutputDebugString( text ); -} - -/* -================ -Sys_CheckCD - -Return true if the proper CD is in the drive -================ -*/ -bool Sys_CheckCD( void ) { - return macosx_scanForLibraryDirectory() != NULL; -} diff --git a/neo/sys/osx/macosx_timers.h b/neo/sys/osx/macosx_timers.h deleted file mode 100644 index 02e8e747..00000000 --- a/neo/sys/osx/macosx_timers.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifdef OMNI_TIMER - -#import - -extern OTTimerNode *RootNode; -extern OTTimerNode *FrameNode; -extern OTTimerNode *UpdateScreenNode; -extern OTTimerNode *SurfaceMeshNode; -extern OTTimerNode *LerpMeshVertexesNode; -extern OTTimerNode *LerpMeshVertexesNode1; -extern OTTimerNode *LerpMeshVertexesNode2; -extern OTTimerNode *VectorArrayNormalizeNode; - -extern void InitializeTimers(); -extern void PrintTimers(); - -#endif // OMNI_TIMER diff --git a/neo/sys/osx/macosx_utils.mm b/neo/sys/osx/macosx_utils.mm deleted file mode 100644 index 036d82cb..00000000 --- a/neo/sys/osx/macosx_utils.mm +++ /dev/null @@ -1,164 +0,0 @@ -/* -=========================================================================== - -Doom 3 GPL Source Code -Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. - -This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). - -Doom 3 Source Code is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Doom 3 Source Code is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Doom 3 Source Code. If not, see . - -In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. - -If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - -=========================================================================== -*/ - -// -*- mode: objc -*- -#import -#import -#import - -#import "sys/platform.h" -#import "sys/osx/macosx_local.h" -#import "sys/osx/macosx_sys.h" - -//extern "C" void *vm_allocate(unsigned, unsigned*, unsigned, int); -//extern "C" void vm_deallocate(unsigned, unsigned*, unsigned); - -const char *macosx_scanForLibraryDirectory(void) -{ - return "/Library/DOOM"; -} - -// EEEK! -static long size_save; - -void *osxAllocateMemoryNV(long size, float readFrequency, float writeFrequency, float priority) -{ - kern_return_t kr; - vm_address_t buffer; - - kr = vm_allocate(mach_task_self(), - (vm_address_t *)&buffer, - size, - VM_FLAGS_ANYWHERE); - if(kr == 0) { - size_save = size; - return buffer; - } - else - { - size_save = 0; - return NULL; - } - -} - -void osxFreeMemoryNV(void *pointer) -{ - if(size_save) { - vm_deallocate(mach_task_self(), - (vm_address_t)pointer, - size_save); - size_save = 0; - } -} - -void *osxAllocateMemory(long size) -{ - kern_return_t kr; - vm_address_t buffer; - - size += sizeof( int ); - kr = vm_allocate(mach_task_self(), - (vm_address_t *)&buffer, - size, - VM_FLAGS_ANYWHERE); - if(kr == 0) { - int *ptr = buffer; - *ptr = size; - ptr = ptr + 1; - return ptr; - } - else - { - return NULL; - } - -} - -void osxFreeMemory(void *pointer) -{ - int size; - int *ptr = pointer; - ptr = ptr - 1; - size = *ptr; - vm_deallocate(mach_task_self(), (vm_address_t)ptr, size); -} - -static inline void __eieio(void) -{ - __asm__ ("eieio"); -} - -static inline void __sync(void) -{ - __asm__ ("sync"); -} - -static inline void __isync(void) -{ - __asm__ ("isync"); -} - -static inline void __dcbf(void *base, unsigned long offset) -{ - __asm__ ("dcbf %0, %1" - : - : "r" (base), "r" (offset) - : "r0"); -} - -static inline void __dcbst(void *base, unsigned long offset) -{ - __asm__ ("dcbst %0, %1" - : - : "r" (base), "r" (offset) - : "r0"); -} - -static inline void __dcbz(void *base, unsigned long offset) -{ - __asm__ ("dcbz %0, %1" - : - : "r" (base), "r" (offset) - : "r0"); -} - -void Sys_FlushCacheMemory( void *base, int bytes ) { - unsigned long i; - - for(i = 0; i < bytes; i+= 32) { - __dcbf(base,i); - } - __sync(); - __isync(); - __dcbf(base, i); - __sync(); - __isync(); - *(volatile unsigned long *)(base + i); - __isync(); -}