UFO: Alien Invasion
Toggle main menu visibility
Loading...
Searching...
No Matches
osx_main.cpp
Go to the documentation of this file.
1
5
6
/*
7
Copyright (C) 1997-2001 Id Software, Inc.
8
9
This program is free software; you can redistribute it and/or
10
modify it under the terms of the GNU General Public License
11
as published by the Free Software Foundation; either version 2
12
of the License, or (at your option) any later version.
13
14
This program is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18
See the GNU General Public License for more details.
19
20
You should have received a copy of the GNU General Public License
21
along with this program; if not, write to the Free Software
22
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24
*/
25
26
#include <CoreFoundation/CoreFoundation.h>
27
#include <SDL_main.h>
28
#include <fcntl.h>
29
#include <sys/param.h>
30
#include <unistd.h>
31
32
#include "
../../common/common.h
"
33
38
static
void
SetWorkingDirectory
()
39
{
40
bool
success =
false
;
41
if
(CFBundleRef
const
mainBundle = CFBundleGetMainBundle()) {
42
if
(CFURLRef
const
url = CFBundleCopyBundleURL(mainBundle)) {
43
char
path[MAXPATHLEN];
44
if
(CFURLGetFileSystemRepresentation(url,
true
,
reinterpret_cast<
UInt8*
>
(path),
sizeof
(path))) {
45
Com_DPrintf
(
DEBUG_SYSTEM
,
"%s = new path\n"
, path);
46
chdir(path);
47
success =
true
;
48
}
49
CFRelease(url);
50
}
51
}
52
if
(!success)
53
Com_Printf
(
"Failed to get path of main bundle\n"
);
54
}
55
62
int
main
(
int
argc,
char
**argv)
63
{
64
SetWorkingDirectory
();
65
66
Sys_ConsoleInit
();
67
Qcommon_Init
(argc, argv);
68
fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
69
70
while
(1)
71
Qcommon_Frame
();
72
73
return
0;
74
}
Sys_ConsoleInit
void Sys_ConsoleInit(void)
Initialize the console input (tty mode if possible).
Definition
android_console.cpp:43
Qcommon_Frame
void Qcommon_Frame(void)
This is the function that is called directly from main().
Definition
common.cpp:1511
Com_DPrintf
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
Definition
common.cpp:440
Qcommon_Init
void Qcommon_Init(int argc, char **argv)
Init function.
Definition
common.cpp:1095
Com_Printf
void Com_Printf(const char *const fmt,...)
Definition
common.cpp:428
common.h
definitions common between client and server, but not game lib
DEBUG_SYSTEM
#define DEBUG_SYSTEM
Definition
defines.h:57
SetWorkingDirectory
static void SetWorkingDirectory()
Sets the current working directory to the top of the application bundle hierarchy.
Definition
osx_main.cpp:38
main
int main(int argc, char **argv)
The entry point for OSX server and client.
Definition
osx_main.cpp:62
src
ports
macosx
osx_main.cpp
Generated on __DATE__ __TIME__ for UFO: Alien Invasion by
1.17.0