1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #include <Foundation/Foundation.h>
- #include <UIKit/UIKit.h>
- #include "common.h"
- #include "SDL_filesystem.h"
- LPCSTR
- UTIL_BasePath(
- VOID
- )
- {
- static char buf[4096] = "";
- if (buf[0] == '\0')
- {
- #ifdef CYDIA
- char *p = SDL_GetBasePath();
- if (p != NULL)
- {
- strcpy(buf, p);
- free(p);
- }
- #else
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
- NSString *documentsDirectory = [[paths objectAtIndex:0] stringByAppendingString:@"/"];
- strcpy(buf, [documentsDirectory UTF8String]);
- #endif
- }
- return buf;
- }
- LPCSTR
- UTIL_SavePath(
- VOID
- )
- {
- static char buf[4096] = "";
- if (buf[0] == '\0')
- {
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
- NSString *documentsDirectory = [[paths objectAtIndex:0] stringByAppendingString:@"/"];
- strcpy(buf, [documentsDirectory UTF8String]);
- }
- return buf;
- }
- BOOL
- UTIL_GetScreenSize(
- DWORD *pdwScreenWidth,
- DWORD *pdwScreenHeight
- )
- {
- if (!pdwScreenWidth || !pdwScreenHeight) return FALSE;
-
- CGRect rect = [UIScreen mainScreen].nativeBounds;
- *pdwScreenWidth = rect.size.height;
- *pdwScreenHeight = rect.size.width;
-
- return TRUE;
- }
|