summaryrefslogtreecommitdiff
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
parent0956549379a239182714ca5f06bb40748e3a54a5 (diff)
downloadpcsxr-36e3e89a0d7e27fdae4e6762e41ea03567d7aace.tar.gz
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@48354 e17a0e51-4ae3-4d35-97c3-1a29b211df97
-rw-r--r--ChangeLog5
-rw-r--r--libpcsxcore/plugins.c16
-rw-r--r--macosx/main.m104
3 files changed, 25 insertions, 100 deletions
diff --git a/ChangeLog b/ChangeLog
index fe614786..c4c38a45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+May 20, 2010 Wei Mingzhi <whistler_wmz@users.sf.net>
+
+ * macosx/main.m: Removed obsolete code, added const too function definations.
+ * libpcsxcore/plugins.c: Added brackets around the use of CheckErr().
+
May 19, 2010 Wei Mingzhi <whistler_wmz@users.sf.net>
* plugins/dfsound/sdl.c: Use SDL for Sound Plugin.
diff --git a/libpcsxcore/plugins.c b/libpcsxcore/plugins.c
index 3f27743e..55e51206 100644
--- a/libpcsxcore/plugins.c
+++ b/libpcsxcore/plugins.c
@@ -143,11 +143,11 @@ static const char *err;
#if defined (__MACOSX__)
#define LoadSym(dest, src, name, checkerr) { \
dest = (src)SysLoadSym(drv, name); \
- if (checkerr) CheckErr(name); else SysLibError(); \
+ if (checkerr) { CheckErr(name); } else SysLibError(); \
}
#else
#define LoadSym(dest, src, name, checkerr) { \
- dest = (src)SysLoadSym(drv, name); if (checkerr) CheckErr(name); \
+ dest = (src)SysLoadSym(drv, name); if (checkerr) { CheckErr(name); } \
}
#endif
@@ -444,7 +444,7 @@ static int LoadPAD1plugin(const char *PAD1dll) {
LoadPad1Sym1(open, "PADopen");
LoadPad1Sym1(close, "PADclose");
LoadPad1Sym0(query, "PADquery");
- LoadPad1Sym1(readPort1, "PADreadPort1");
+ LoadPad1Sym1(readPort1, "PADreadPort1");
LoadPad1Sym0(configure, "PADconfigure");
LoadPad1Sym0(test, "PADtest");
LoadPad1Sym0(about, "PADabout");
@@ -457,15 +457,15 @@ static int LoadPAD1plugin(const char *PAD1dll) {
}
unsigned char CALLBACK PAD2__startPoll(int pad) {
- PadDataS padd;
+ PadDataS padd;
- PAD2_readPort2(&padd);
+ PAD2_readPort2(&padd);
- return _PADstartPoll(&padd);
+ return _PADstartPoll(&padd);
}
unsigned char CALLBACK PAD2__poll(unsigned char value) {
- return _PADpoll(value);
+ return _PADpoll(value);
}
long CALLBACK PAD2__configure(void) { return 0; }
@@ -498,7 +498,7 @@ static int LoadPAD2plugin(const char *PAD2dll) {
LoadPad2Sym1(open, "PADopen");
LoadPad2Sym1(close, "PADclose");
LoadPad2Sym0(query, "PADquery");
- LoadPad2Sym1(readPort2, "PADreadPort2");
+ LoadPad2Sym1(readPort2, "PADreadPort2");
LoadPad2Sym0(configure, "PADconfigure");
LoadPad2Sym0(test, "PADtest");
LoadPad2Sym0(about, "PADabout");
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);
}