summaryrefslogtreecommitdiff
path: root/macosx/main.m
diff options
context:
space:
mode:
authorSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2010-05-20 00:27:30 +0000
committerSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2010-05-20 00:27:30 +0000
commit36e3e89a0d7e27fdae4e6762e41ea03567d7aace (patch)
tree61d33b3327d920a77879dd20fb560b91f2801c11 /macosx/main.m
parent0956549379a239182714ca5f06bb40748e3a54a5 (diff)
downloadpcsxr-36e3e89a0d7e27fdae4e6762e41ea03567d7aace.tar.gz
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@48354 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/main.m')
-rw-r--r--macosx/main.m104
1 files changed, 12 insertions, 92 deletions
diff --git a/macosx/main.m b/macosx/main.m
index e9f77b9f..ebd6e136 100644
--- a/macosx/main.m
+++ b/macosx/main.m
@@ -17,8 +17,7 @@
static BOOL sysInited = NO;
//#define EMU_LOG
-int main(int argc, const char *argv[])
-{
+int main(int argc, const char *argv[]) {
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
char parentdir[MAXPATHLEN];
char *c;
@@ -79,7 +78,7 @@ void SysReset() {
//EmuReset();
}
-void SysPrintf(char *fmt, ...) {
+void SysPrintf(const char *fmt, ...) {
va_list list;
char msg[512];
@@ -95,8 +94,7 @@ void SysPrintf(char *fmt, ...) {
#endif
}
-void SysMessage(char *fmt, ...)
-{
+void SysMessage(const char *fmt, ...) {
va_list list;
char msg[512];
@@ -111,8 +109,7 @@ void SysMessage(char *fmt, ...)
nil, nil, nil);
}
-#if 1
-void *SysLoadLibrary(char *lib) {
+void *SysLoadLibrary(const char *lib) {
NSBundle *bundle = [NSBundle bundleWithPath:[NSString stringWithCString:lib]];
if (bundle != nil) {
return dlopen([[bundle executablePath] fileSystemRepresentation], RTLD_LAZY /*RTLD_NOW*/);
@@ -120,7 +117,7 @@ void *SysLoadLibrary(char *lib) {
return dlopen(lib, RTLD_LAZY);
}
-void *SysLoadSym(void *lib, char *sym) {
+void *SysLoadSym(void *lib, const char *sym) {
return dlsym(lib, sym);
}
@@ -131,96 +128,20 @@ const char *SysLibError() {
void SysCloseLibrary(void *lib) {
//dlclose(lib);
}
-#else
-static int LoadResult = 0;
-void *SysLoadLibrary(char *lib)
-{
- CFBundleRef myBundle;
- CFURLRef bundleURL;
- CFStringRef path;
-
- path = CFStringCreateWithCString(kCFAllocatorDefault, lib, CFStringGetSystemEncoding());
- if (!path)
- goto error;
-
- bundleURL = CFURLCreateWithFileSystemPath(
- kCFAllocatorDefault,
- path,
- kCFURLPOSIXPathStyle,
- true );
- if (!bundleURL)
- goto error;
-
- myBundle = CFBundleCreate( kCFAllocatorDefault, bundleURL );
-
- if (!CFBundleLoadExecutable(myBundle))
- goto error;
-
-good:
- if (path) CFRelease(path);
- if (bundleURL) CFRelease(bundleURL);
-
- return myBundle;
-
-error:
- if (LoadResult == 0) LoadResult = -1;
- myBundle = NULL;
- goto good;
-}
-
-void *SysLoadSym(void *lib, char *sym)
-{
- CFStringRef funcName;
- void *func;
-
- funcName = CFStringCreateWithCString(kCFAllocatorDefault, sym, CFStringGetSystemEncoding());
- func = CFBundleGetFunctionPointerForName((CFBundleRef)lib, funcName);
- if (func == nil) {
- LoadResult = -2;
- }
-
- CFRelease(funcName);
- return func;
-}
-
-const char *SysLibError()
-{
- char *result = NULL;
-
- if (LoadResult != 0)
- result = "Error loading code";
-
- LoadResult = 0;
- return result;
-}
-void SysCloseLibrary(void *lib)
-{
- if (lib) {
- CFBundleUnloadExecutable((CFBundleRef)lib);
- CFRelease((CFBundleRef)lib);
- }
-}
-#endif
-
-void PADhandleKey(int key);
// Called periodically from the emu thread
-void SysUpdate()
-{
+void SysUpdate() {
UpdateSystemActivity(UsrActivity);
- PADhandleKey(PAD1_keypressed());
- //PADhandleKey(PAD2_keypressed());
-
[emuThread handleEvents];
}
-void SysRunGui() // Returns to the Gui
-{
-
+// Returns to the Gui
+void SysRunGui() {
}
-void SysClose() // Close mem and plugins
-{
+
+// Close mem and plugins
+void SysClose() {
EmuShutdown();
ReleasePlugins();
@@ -229,8 +150,7 @@ void SysClose() // Close mem and plugins
sysInited = NO;
}
-void OnFile_Exit()
-{
+void OnFile_Exit() {
SysClose();
exit(0);
}