Code: Select all
/* ========================================================================== */
/* */
/* main.c */
/* (c) 2008 Author: -DaRealXecon- */
/* */
/* Description: OpenOS */
/* */
/* ========================================================================== */
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspgu.h>
#include <psppower.h>
#include <pspsdk.h>
#include <psptypes.h>
#include <png.h>
#include <stdio.h>
#include <pspusb.h>
#include <pspusbstor.h>
#include <pspusbcam.h>
#include <psppower.h>
#include "graphics.h"
#include "startPbpUmdIso.h"
#include "psploadexec_kernel.h"
#include "pspumd.h"
#include <psputility.h>
#include <psputility_usbmodules.h>
// #include "callback.h"
PSP_MODULE_INFO("OpenOS", 1, 1, 1);
#define printf pspDebugScreenPrintf
#define clrscr pspDebugScreenClear
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
#define PSP_USB_MODULE_CAM 4
void usb_activated()
{
pspSdkLoadStartModule("flash0:/kd/semawm.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstor.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstormgr.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstorms.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstorboot.prx", PSP_MEMORY_PARTITION_KERNEL);
sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0);
sceUsbstorBootSetCapacity(0x800000);
sceUsbActivate(0x1c8);
}
void usb_deactivated()
{
sceUsbDeactivate(0);
sceUsbStop(PSP_USBSTOR_DRIVERNAME, 0, 0);
sceUsbStop(PSP_USBBUS_DRIVERNAME, 0, 0);
}
int main(void) {
initGraphics();
/*
char buffer0[200]; // Splash // Splash
Image* splash_0001;
sprintf(buffer0, "sys/img/splash_0001.png");
splash_0001 = loadImage(buffer0);
int splash_y1 = -272;
int i;
for(i = 0; i < 400; i++ ) {
splash_y1 += 5;
if(splash_y1 >= 0) {
splash_y1 = 0;
}
blitAlphaImageToScreen(0 ,0 ,480 , 272, splash_0001, 0,splash_y1);
flipScreen();
} // Splash, END
*/
char buffer0[200]; // Splash // Splash
char buffer1[200]; // Splash Credits
Image* splash_0001;
Image* splash_credits_0001;
sprintf(buffer0, "sys/img/splash_0001.png");
sprintf(buffer1, "sys/img/splash_credits_0001.png");
splash_0001 = loadImage(buffer0);
splash_credits_0001 = loadImage(buffer1);
int splash_credits_y1 = 148;
int i;
for(i = 0; i < 500; i++ ) {
splash_credits_y1 -= 1;
blitAlphaImageToScreen(0 ,0 ,183 , 480, splash_credits_0001, 244,splash_credits_y1);
blitAlphaImageToScreen(0 ,0 ,480 , 272, splash_0001, 0,0);
flipScreen();
} // Splash, END
// SetupCallbacks();
pspDebugScreenInit();
SceCtrlData pad;
char buffer2[200]; // BG Image // Load Images
char buffer3[200]; // Cursor 1
char buffer4[200]; // Taskbar
char buffer5[200]; // Toolbar
char buffer6[200]; // UMD Icon (Desktop)
char buffer7[200]; // Toolbar USB Button Aktiv
char buffer8[200]; // Toolbar USB Button Inaktiv
char buffer9[200]; // Toolbar Shutdown Button
char buffer10[200]; // Toolbar Go!Cam Button
char buffer11[200]; // Toolbar Exit Button
Image* bg_0001;
Image* cursor_0001;
Image* task_bar_0001;
Image* tool_bar_0001;
Image* dsk_icon_umd;
Image* tool_bar_usb_activ;
Image* tool_bar_usb_deactiv;
Image* tool_bar_shutdown;
Image* tool_bar_gocam;
Image* tool_bar_exit_os;
sprintf(buffer2, "sys/img/bg_0001.png");
sprintf(buffer3, "sys/img/cursor_0001.png");
sprintf(buffer4, "sys/img/task_bar_0001.png");
sprintf(buffer5, "sys/img/tool_bar_0001.png");
sprintf(buffer6, "sys/img/dsk_icon_umd_0001.png");
sprintf(buffer7, "sys/img/tool_icon_usb_activ_0001.png");
sprintf(buffer8, "sys/img/tool_icon_usb_deactiv_0001.png");
sprintf(buffer9, "sys/img/tool_icon_shutdown_0001.png");
sprintf(buffer10, "sys/img/tool_icon_gocam_0001.png");
sprintf(buffer11, "sys/img/tool_icon_exit_os_0001.png");
bg_0001 = loadImage(buffer2);
cursor_0001 = loadImage(buffer3);
task_bar_0001 = loadImage(buffer4);
tool_bar_0001 = loadImage(buffer5);
dsk_icon_umd = loadImage(buffer6);
tool_bar_usb_activ = loadImage(buffer7);
tool_bar_usb_deactiv = loadImage(buffer8);
tool_bar_shutdown = loadImage(buffer9);
tool_bar_gocam = loadImage(buffer10);
tool_bar_exit_os = loadImage(buffer11); // Load Images, END
int cursor_x1 = 70;
int cursor_y1 = 100;
int task_bar_x1 = 0;
int task_bar_y1 = 222;
int task_bar_state = 0; // 1 is Hide, 0 is Show
int usb_state = 1;
int inumd;
int usb_state_icon_pos_x1 = 402;
int usb_state_icon_pos_x2 = 481;
scePowerSetCpuClockFrequency(333);
scePowerSetBusClockFrequency(166);
while(1) {
sceDisplayWaitVblankStart();
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_START) {
if(pad.Buttons & PSP_CTRL_SELECT) {
sceKernelExitGame();
}
}
if(pad.Buttons & PSP_CTRL_UP) {
cursor_y1 -= 6;
}
if(pad.Buttons & PSP_CTRL_DOWN) {
cursor_y1 += 6;
}
if(pad.Buttons & PSP_CTRL_LEFT) {
cursor_x1 -= 8;
}
if(pad.Buttons & PSP_CTRL_RIGHT) {
cursor_x1 += 8;
}
if(cursor_x1 <= 0) {
cursor_x1 = 0;
}
if(cursor_y1 <= 0) {
cursor_y1 = 0;
}
if(cursor_x1 >= 480) {
cursor_x1 = 480;
}
if (cursor_y1 >= 272) {
cursor_y1 = 272;
}
if(task_bar_x1 <= -470) {
task_bar_x1 = -470;
}
if(task_bar_x1 >= 0) {
task_bar_x1 = 0;
}
if(task_bar_state == 0) {
task_bar_x1 = 0;
}
else
if(task_bar_state == 1) {
task_bar_x1 = -483;
}
if(cursor_x1 > 0 && cursor_x1 < 20 && cursor_y1 > 250 && cursor_y1 < 272) { // Taskbar verstecken
if(pad.Buttons & PSP_CTRL_CROSS && task_bar_state == 0) {
sceKernelDelayThread(1000000);
task_bar_state = 1;
}
else
if(pad.Buttons & PSP_CTRL_CROSS && task_bar_state == 1) {
sceKernelDelayThread(1000000);
task_bar_state = 0;
}
} // Taskbar verstecken, END
if(cursor_x1 > 15 && cursor_x1 < 75 && cursor_y1 > 15 && cursor_y1 < 75) { // Desktop Icons [Klickfunktion]
if(pad.Buttons & PSP_CTRL_CROSS) {
inumd = sceUmdCheckMedium(0);
if(inumd == 1) {
startPUI(NULL,1);
} else {
pspDebugScreenSetXY( 200, 150);
printf("Keine UMD eingelegt!");
sceKernelDelayThread(2000000);
clrscr();
}
}
} // Desktop Icons [Klickfunktion], END
if(cursor_x1 > 402 && cursor_x1 < 422 && cursor_y1 > 21 && cursor_y1 < 41) {// Toolbar Icons [Klickfunktion]
if(pad.Buttons & PSP_CTRL_CROSS && usb_state == 1) {
usb_activated();
usb_state_icon_pos_x1 = 481;
usb_state_icon_pos_x2 = 402;
usb_state = 0;
sceKernelDelayThread(1000000);
}
else
if(pad.Buttons & PSP_CTRL_CROSS && usb_state == 0) {
usb_deactivated();
usb_state_icon_pos_x2 = 481;
usb_state_icon_pos_x1 = 402;
usb_state = 1;
sceKernelDelayThread(1000000);
}
}
if(cursor_x1 > 439 && cursor_x1 < 459 && cursor_y1 > 21 && cursor_y1 < 41) {
if(pad.Buttons & PSP_CTRL_CROSS) {
sceKernelDelayThread(500000);
scePowerRequestSuspend();
}
}
if(cursor_x1 > 402 && cursor_x1 < 422 && cursor_y1 > 46 && cursor_y1 < 66) {
if(pad.Buttons & PSP_CTRL_CROSS) {
sceKernelDelayThread(500000);
sceUtilityLoadUsbModule(PSP_USB_MODULE_CAM);
}
}
if(cursor_x1 > 439 && cursor_x1 < 459 && cursor_y1 > 46 && cursor_y1 < 66) {
if(pad.Buttons & PSP_CTRL_CROSS) {
sceKernelDelayThread(1000000);
sceKernelExitGame();
}
} // Toolbar Icons [Klickfunktion], END
clearScreen(0);
blitAlphaImageToScreen(0 ,0 ,480 , 272, bg_0001, 0,0);
blitAlphaImageToScreen(0 ,0 ,180 , 272, tool_bar_0001, 300,0);
blitAlphaImageToScreen(0 ,0 ,501 , 50, task_bar_0001, task_bar_x1,task_bar_y1);
blitAlphaImageToScreen(0 ,0 ,60 , 60, dsk_icon_umd, 15,15);
blitAlphaImageToScreen(0 ,0 ,20 , 20, tool_bar_usb_deactiv, usb_state_icon_pos_x1,21);
blitAlphaImageToScreen(0 ,0 ,20 , 20, tool_bar_usb_activ, usb_state_icon_pos_x2,21);
blitAlphaImageToScreen(0 ,0 ,20 , 20, tool_bar_shutdown, 439,21);
blitAlphaImageToScreen(0 ,0 ,20 , 20, tool_bar_gocam, 402,46);
blitAlphaImageToScreen(0 ,0 ,20 , 20, tool_bar_exit_os, 439,46);
blitAlphaImageToScreen(0 ,0 ,10 , 17, cursor_0001, cursor_x1,cursor_y1);
flipScreen();
}
sceKernelSleepThread();
return 0;
}
When you got an idea... I haven't one :(