Rev 1 | Rev 4 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 2 | ||
---|---|---|---|
Line 14... | Line 14... | ||
14 | #include <SDL.h> |
14 | #include <SDL.h> |
15 | 15 | ||
16 | #include <signal.h> |
16 | #include <signal.h> |
17 | 17 | ||
18 | #include "system.h" |
18 | #include "system.h" |
- | 19 | #ifdef WIN32 |
|
19 | #include "windows.h" |
20 | #include "windows.h" |
- | 21 | char *sys_getbasepath (void) |
|
- | 22 | { |
|
- | 23 | static char app_path[1024] = ""; |
|
- | 24 | if (app_path[0] == 0) |
|
- | 25 | { |
|
- | 26 | GetModuleFileName (NULL, app_path, 1024); |
|
- | 27 | if (strrchr (app_path, '\\') != NULL) |
|
- | 28 | *strrchr (app_path, '\\') = 0; |
|
- | 29 | } |
|
- | 30 | return (app_path); |
|
- | 31 | } |
|
- | 32 | #else // !WIN32 |
|
- | 33 | #ifdef __APPLE__ |
|
- | 34 | #include <CoreFoundation/CoreFoundation.h> |
|
- | 35 | #include <dlfcn.h> |
|
- | 36 | void MessageBox (void *handle, char *msg, char *title, int buttons) |
|
- | 37 | { |
|
- | 38 | const void *keys[2]; |
|
- | 39 | const void *values[2]; |
|
- | 40 | SInt32 result; |
|
- | 41 | ||
- | 42 | if (title == NULL) |
|
- | 43 | title = ""; |
|
- | 44 | ||
- | 45 | keys[0] = kCFUserNotificationAlertHeaderKey; |
|
- | 46 | values[0] = CFStringCreateWithCString (kCFAllocatorDefault, title, kCFStringEncodingUTF8);; |
|
- | 47 | ||
- | 48 | keys[1] = kCFUserNotificationAlertMessageKey; |
|
- | 49 | values[1] = CFStringCreateWithCString (kCFAllocatorDefault, msg, kCFStringEncodingUTF8); |
|
- | 50 | ||
- | 51 | result = 0; |
|
- | 52 | CFUserNotificationCreate |
|
- | 53 | ( |
|
- | 54 | kCFAllocatorDefault, |
|
- | 55 | 0, |
|
- | 56 | kCFUserNotificationPlainAlertLevel, |
|
- | 57 | &result, |
|
- | 58 | CFDictionaryCreate |
|
- | 59 | ( |
|
- | 60 | 0, |
|
- | 61 | keys, |
|
- | 62 | values, |
|
- | 63 | sizeof (keys) / sizeof (*keys), |
|
- | 64 | &kCFTypeDictionaryKeyCallBacks, |
|
- | 65 | &kCFTypeDictionaryValueCallBacks |
|
- | 66 | ) |
|
- | 67 | ); |
|
- | 68 | } |
|
- | 69 | #define MB_OK 0 |
|
- | 70 | char *sys_getbasepath (void) |
|
- | 71 | { |
|
- | 72 | static char app_path[1024] = ""; |
|
- | 73 | if (app_path[0] == 0) |
|
- | 74 | { |
|
- | 75 | Dl_info addr_info; |
|
- | 76 | if (dladdr (main, &addr_info) == 0) |
|
- | 77 | return ("."); |
|
- | 78 | strcpy_s (app_path, 1024, addr_info.dli_fname); |
|
- | 79 | if (strrchr (app_path, '/') != NULL) |
|
- | 80 | *strrchr (app_path, '/') = 0; |
|
- | 81 | } |
|
- | 82 | return (app_path); |
|
- | 83 | } |
|
- | 84 | #else // !__APPLE__ |
|
- | 85 | #define MessageBox(handle,msg,title,btns) fprintf (stderr, msg) |
|
- | 86 | #define MB_OK 0 |
|
- | 87 | char *sys_getbasepath (void) |
|
- | 88 | { |
|
- | 89 | return ("."); |
|
- | 90 | } |
|
- | 91 | #endif // __APPLE__ |
|
- | 92 | #endif // WIN32 |
|
20 | 93 | ||
21 | 94 | ||
22 | /* |
95 | /* |
23 | * Panic |
96 | * Panic |
24 | */ |
97 | */ |