diff --git a/Makefile.psp1 b/Makefile.psp1
index 3ff29be9b6..72d5638159 100644
--- a/Makefile.psp1
+++ b/Makefile.psp1
@@ -1,11 +1,9 @@
RARCH_VERSION = "0.9.8-beta2"
-TARGET = retroarch_psp
-OBJS = console/griffin/griffin.o
+TARGET = retroarchpsp
INCDIR =
-CFLAGS = -O2 -G0 -Wall -std=gnu99
-CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
+CFLAGS = -O2 -G0 -Wall -g -std=gnu99 -ffast-math
ASFLAGS = $(CFLAGS)
RARCH_DEFINES = -DPSP -DHAVE_DEFAULT_RETROPAD_INPUT -DRARCH_CONSOLE -DHAVE_GETOPT_LONG -DHAVE_FILEBROWSER -DHAVE_RARCH_MAIN_WRAP -DHAVE_ZLIB -DWANT_RZLIB -DHAVE_CONFIGFILE=1 -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -Dmain=rarch_main
@@ -13,10 +11,14 @@ CFLAGS += $(RARCH_DEFINES)
LIBDIR =
LDFLAGS =
-#LIBS = -lpspaudiolib -lpspaudio
-LIBS = -lpspgu -lpspgum -lretro_psp1 -lm
+LIBS = -lretro_psp1 -lstdc++ -lpspgu -lpspgum -lm
-#EXTRA_TARGETS = EBOOT.PBP
-#PSP_EBOOT_TITLE = RetroArch PSP1
+EXTRA_TARGETS = EBOOT.PBP
+PSP_EBOOT_TITLE = RetroArch PSP1
+PSP_OBJECTS = console/griffin/griffin.o
+
+OBJS = $(PSP_OBJECTS)
+
+PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
diff --git a/console/griffin/griffin.c b/console/griffin/griffin.c
index 0561fb308e..4d1c638566 100644
--- a/console/griffin/griffin.c
+++ b/console/griffin/griffin.c
@@ -329,6 +329,8 @@ MAIN
#include "../../gx/frontend/main.c"
#elif defined(__CELLOS_LV2__)
#include "../../ps3/frontend/main.c"
+#elif defined(PSP)
+#include "../../psp/frontend/main.c"
#elif defined(ANDROID)
#include "../../android/native/jni/main.c"
#endif
diff --git a/console/rarch_console_rzlib.c b/console/rarch_console_rzlib.c
index 6130ccd1be..8487a77412 100644
--- a/console/rarch_console_rzlib.c
+++ b/console/rarch_console_rzlib.c
@@ -145,6 +145,8 @@ int rarch_extract_zipfile(const char *zip_path, const char *current_dir, char *f
unzFile uf = unzOpen(zip_path);
unz_global_info gi;
+ memset(&gi, 0, sizeof(unz_global_info));
+
int ret = unzGetGlobalInfo(uf, &gi);
if(ret != UNZ_OK)
RARCH_ERR("Error %d while trying to get ZIP file global info.\n", ret);
diff --git a/psp/frontend/main.c b/psp/frontend/main.c
new file mode 100644
index 0000000000..2fc88c7589
--- /dev/null
+++ b/psp/frontend/main.c
@@ -0,0 +1,84 @@
+/* RetroArch - A frontend for libretro.
+ * Copyright (C) 2010-2012 - Hans-Kristian Arntzen
+ * Copyright (C) 2011-2012 - Daniel De Matteis
+ *
+ * RetroArch is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Found-
+ * ation, either version 3 of the License, or (at your option) any later version.
+ *
+ * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with RetroArch.
+ * If not, see .
+ */
+
+#include
+#include
+
+#include
+#include "../../boolean.h"
+#include
+#include
+
+#undef main
+#include "../sdk_defines.h"
+
+PSP_MODULE_INFO("RetroArch PSP", 0, 1, 1);
+PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
+PSP_HEAP_SIZE_MAX();
+
+int rarch_main(int argc, char *argv[]);
+
+static int exit_callback(int arg1, int arg2, void *common)
+{
+ return 0;
+}
+
+static void get_environment_settings(int argc, char *argv[])
+{
+ g_extern.verbose = true;
+
+ g_extern.verbose = false;
+}
+
+int callback_thread(SceSize args, void *argp)
+{
+ int cbid = sceKernelCreateCallback("Exit callback", exit_callback, NULL);
+ sceKernelRegisterExitCallback(cbid);
+ sceKernelSleepThreadCB();
+
+ return 0;
+}
+
+static int setup_callback(void)
+{
+ int thread_id = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, 0);
+
+ if (thread_id >= 0)
+ sceKernelStartThread(thread_id, 0, 0);
+
+ return thread_id;
+}
+
+int main(int argc, char *argv[])
+{
+ //initialize debug screen
+ pspDebugScreenInit();
+ pspDebugScreenClear();
+
+ setup_callback();
+
+ get_environment_settings(argc, argv);
+
+ sceDisplayWaitVblankStart();
+ pspDebugScreenClear();
+ pspDebugScreenSetXY(0, 0);
+ printf("RetroArch PSP test.\n");
+
+ rarch_sleep(20);
+
+ sceKernelExitGame();
+ return 1;
+}
diff --git a/psp1/psp1_video.c b/psp1/psp1_video.c
index 7744532669..e9962d8029 100644
--- a/psp1/psp1_video.c
+++ b/psp1/psp1_video.c
@@ -134,7 +134,8 @@ static bool psp_gfx_frame(void *data, const void *frame,
sceGuFinish();
sceDisplayWaitVblankStart();
- DisplaySetFrameBuf(frame, pitch,
+ void *frame_ptr = &frame;
+ DisplaySetFrameBuf(frame_ptr, pitch,
vid->rgb32 ? PSP_DISPLAY_PIXEL_FORMAT_8888 : PSP_DISPLAY_PIXEL_FORMAT_565,
PSP_DISPLAY_SETBUF_IMMEDIATE);