int main() { initOSLib(); //Initializes OsLib oslIntraFontInit(INTRAFONT_CACHE_ALL | INTRAFONT_STRING_UTF8); //Initializes OSL fonts //Loads our audio tones camera_click = oslLoadSoundFile("system/media/audio/ui/camera_click.wav", OSL_FMT_NONE); KeypressStandard = oslLoadSoundFile("system/media/audio/ui/KeypressStandard.wav", OSL_FMT_NONE); Lock = oslLoadSoundFile("system/media/audio/ui/Lock.wav", OSL_FMT_NONE); Unlock = oslLoadSoundFile("system/media/audio/ui/Unlock.wav", OSL_FMT_NONE); strcpy(backgroundPath, setFileDefaultsChar("system/settings/background.bin", "system/framework/framework-res/res/background1.png", backgroundPath)); strcpy(fontPath, setFileDefaultsChar("system/settings/font.bin", "system/fonts/Roboto.pgf", fontPath)); hrTime = setFileDefaultsInt("system/app/clock/timeSet.bin", 0, hrTime); language = setFileDefaultsInt("system/settings/language.bin", 0, language); batteryM = setFileDefaultsInt("system/settings/battery.bin", 1, batteryM); experimentalF = setFileDefaultsInt("system/settings/experimentalFeatures.bin", 0, experimentalF); DARK = setFileDefaultsInt("system/settings/darkTheme.bin", 0, DARK); fontSize = setFileDefaultsFloat("system/settings/fontSize.bin", 0.5, fontSize); checkGBootActivation(); createDirs(); themesLoad(); FILE *temp; if (!(fileExists(rgbValuesPath))) { temp = fopen(rgbValuesPath, "w"); fprintf(temp, "0\n149\n135"); fclose(temp); } temp = fopen(rgbValuesPath, "r"); fscanf(temp, "%d %d %d", &r, &g, &b); fclose(temp); quickSettings = oslLoadImageFile(quickSettingsBgPath, OSL_IN_VRAM, OSL_PF_8888); batt100 = oslLoadImageFile("system/home/icons/100.png", OSL_IN_VRAM, OSL_PF_8888); batt80 = oslLoadImageFile("system/home/icons/80.png", OSL_IN_VRAM, OSL_PF_8888); batt60 = oslLoadImageFile("system/home/icons/60.png", OSL_IN_VRAM, OSL_PF_8888); batt40 = oslLoadImageFile("system/home/icons/40.png", OSL_IN_VRAM, OSL_PF_8888); batt20 = oslLoadImageFile("system/home/icons/20.png", OSL_IN_VRAM, OSL_PF_8888); batt10 = oslLoadImageFile("system/home/icons/10.png", OSL_IN_VRAM, OSL_PF_8888); batt0 = oslLoadImageFile("system/home/icons/0.png", OSL_IN_VRAM, OSL_PF_8888); battcharge = oslLoadImageFile("system/home/icons/charge.png", OSL_IN_VRAM, OSL_PF_8888); volumeBar = oslLoadImageFilePNG("system/home/menu/volumeBar.png", OSL_IN_RAM, OSL_PF_8888); volumeControl = oslLoadImageFile(volumeControlPath, OSL_IN_RAM, OSL_PF_8888); layerA = oslLoadImageFilePNG("system/home/icons/layerA.png", OSL_IN_RAM, OSL_PF_8888); layerB = oslLoadImageFilePNG("system/home/icons/layerB.png", OSL_IN_RAM, OSL_PF_8888); navbarHighlight = oslLoadImageFilePNG(navbarHighlightPath, OSL_IN_RAM, OSL_PF_8888); navbarHighlight2 = oslLoadImageFilePNG(navbarHighlight2Path, OSL_IN_RAM, OSL_PF_8888); Roboto = oslLoadIntraFontFile(fontPath, INTRAFONT_CACHE_ALL | INTRAFONT_STRING_UTF8); oslSetFont(Roboto); //Load and set font SceUID kModule[3]; kModule[0] = pspSdkLoadStartModule("modules/display.prx", PSP_MEMORY_PARTITION_KERNEL); kModule[1] = pspSdkLoadStartModule("modules/control.prx", PSP_MEMORY_PARTITION_KERNEL); kModule[2] = pspSdkLoadStartModule("modules/impose.prx", PSP_MEMORY_PARTITION_KERNEL); int i; for (i = 0; i < 3; i++) { if (kModule[i] < 0) { pspDebugScreenPrintf("Error 0x%08X starting module.\n", kModule[i]); break; } } deleteUpdateFile(); //Delete update.zip setCpuBoot(); //Set default CPU or load pre-existing value setPowerManagement(); //Set default power save settings or load pre-existing values. getPSPNickname(); //Get PSP name before hand strcpy (pspname, nickname); //Main loop to run the program while (!osl_quit) { bootAnimation(); //Ends Printing and Drawing oslEndDrawing(); //End's Frame oslEndFrame(); //Synchronizes the screen oslSyncFrame(); } //Terminates/Ends the program oslQuit(); return 0; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Main: /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int main(){ int skip = 0; int enabled = 1; int selectedConfig = 0; SetupCallbacks(); initOSLib(); oslIntraFontInit(INTRAFONT_CACHE_MED); oslNetInit(); //Loads image: bkg = oslLoadImageFilePNG("bkg.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); //Load font: OSL_FONT *font = oslLoadFontFile("flash0:/font/ltn0.pgf"); oslSetFont(font); if (!oslIsWlanPowerOn()) sprintf(message, "Please turn on the WLAN."); //Get connections list: struct oslNetConfig configs[OSL_MAX_NET_CONFIGS]; int numconfigs = oslGetNetConfigs(configs); if (!numconfigs){ sprintf(message, "No configuration found!"); enabled = 0; } while(runningFlag && !osl_quit){ if (!skip){ oslStartDrawing(); oslDrawImageXY(bkg, 0, 0); if (enabled){ sprintf(buffer, "Press X to connect to %s.", configs[selectedConfig].name); oslDrawString(30, 50, buffer); oslDrawString(30, 80, "Press UP and DOWN to change settings."); } oslDrawString(30, 150, "Press /\\ to quit."); oslDrawString(30, 200, message); oslEndDrawing(); } oslEndFrame(); skip = oslSyncFrame(); oslReadKeys(); if (osl_keys->released.triangle) runningFlag = 0; if (osl_keys->released.cross){ connectToAP(selectedConfig + 1); }else if (osl_keys->released.up){ if (++selectedConfig >= numconfigs) selectedConfig = numconfigs - 1; }else if (osl_keys->released.down){ if (--selectedConfig < 0) selectedConfig = 0; } } //Quit OSL: oslNetTerm(); oslEndGfx(); sceKernelExitGame(); return 0; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Main: /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int main(){ SetupCallbacks(); oslSrand(1); //Init network (for net conf dialog): oslNetInit(); int skip = 0; LedAnimFreq.f=2; const int calx1=-20,calx2=20,caly1=-20,caly2=20; //float fx,fy; float_or_int_t _movW,_movX,_movY,_movZ; DroneSck = oslNetSocketCreate(); DroneUdp = make_udpsocket(AT_PORT); initOSLib(); oslIntraFontInit(INTRAFONT_CACHE_MED); //Loads image: //OSL_IMAGE *bkg = oslLoadImageFileJPG("back1.jpg", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); OSL_IMAGE *bkg = oslLoadImageFileJPG("back1.jpg", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_5650); OSL_IMAGE *img1 = oslCreateImage (130,130,OSL_IN_RAM,OSL_PF_8BIT); FirePalette (img1,255); oslClearImage (img1,0); //Load font: OSL_FONT *font = oslLoadFontFile("flash0:/font/ltn0.pgf"); oslSetFont(font); while(runningFlag && !osl_quit){ if (!skip){ oslStartDrawing(); oslDrawImageXY(bkg, 0, 0); oslReadKeys(); _movX.f = ((float)osl_pad.analogX/128)*mscale; _movY.f = ((float)osl_pad.analogY/128)*mscale; _movZ.f = 0; _movW.f = 0; if ((osl_pad.analogX > calx1) && (osl_pad.analogX < calx2)) _movX.f = 0; //Deadzone X if ((osl_pad.analogY > caly1) && (osl_pad.analogY < caly2)) _movY.f = 0; //Deadzone Y if (osl_pad.held.triangle) _movZ.f = delta; //Up if (osl_pad.held.cross) _movZ.f = -delta; //Down if (osl_pad.held.L) _movW.f = -delta; //CW if (osl_pad.held.R) _movW.f = delta; //CCW if (_movX.f==0 && _movY.f==0 && _movZ.f==0 && _movW.f==0) Hover=0; else Hover=1; oslDrawStringf(320, 10, "Tic#= %d",AT_SEQ); oslDrawStringf(10, 220, "x= %d y= %d z= %d w= %d !Hvr= %d",osl_pad.analogX,osl_pad.analogY,_movZ.i,_movW.i,Hover); oslDrawStringf(10, 240, "xf= %1.2f yf= %1.2f Scl= %1.2f",_movX.f,_movY.f,mscale); if (Connected==1) GameTic++; if (drawMenu==1) { Menu();} else { if (osl_pad.pressed.up) { //Drone.AddCmd "AT*ANIM=", CStr(Seq) & "," & Anim_Time(Seq) vb anim code snprintf(netbuf,1024,"AT*ANIM=%d,%d,%d%c",AT_SEQ++,ARDRONE_ANIM_FLIP_AHEAD,MAYDAY_TIMEOUT[ARDRONE_ANIM_FLIP_AHEAD],CR); sendto(DroneUdp, netbuf, strlen(netbuf), 0, (struct sockaddr*)&dest, sizeof(dest));} if (osl_pad.pressed.down) { snprintf(netbuf,1024,"AT*ANIM=%d,%d,%d%c",AT_SEQ++,ARDRONE_ANIM_FLIP_BEHIND,MAYDAY_TIMEOUT[ARDRONE_ANIM_FLIP_BEHIND],CR); sendto(DroneUdp, netbuf, strlen(netbuf), 0, (struct sockaddr*)&dest, sizeof(dest));} if (osl_pad.pressed.right) { snprintf(netbuf,1024,"AT*ANIM=%d,%d,%d%c",AT_SEQ++,ARDRONE_ANIM_FLIP_RIGHT,MAYDAY_TIMEOUT[ARDRONE_ANIM_FLIP_RIGHT],CR); sendto(DroneUdp, netbuf, strlen(netbuf), 0, (struct sockaddr*)&dest, sizeof(dest));} if (osl_pad.pressed.left) { snprintf(netbuf,1024,"AT*ANIM=%d,%d,%d%c",AT_SEQ++,ARDRONE_ANIM_FLIP_LEFT,MAYDAY_TIMEOUT[ARDRONE_ANIM_FLIP_LEFT],CR); sendto(DroneUdp, netbuf, strlen(netbuf), 0, (struct sockaddr*)&dest, sizeof(dest));} if (osl_pad.pressed.start) { drawMenu=1;} if (osl_pad.pressed.circle){//Take off snprintf(netbuf,1024,"AT*REF=%d,%d%c",AT_SEQ++,AT_REF|512,CR);//TAKE OFF sendto(DroneUdp, netbuf, strlen(netbuf), 0, (struct sockaddr*)&dest, sizeof(dest));} if (osl_pad.pressed.square){//Land snprintf(netbuf,1024,"AT*REF=%d,%d%c",AT_SEQ++,AT_REF,CR); sendto(DroneUdp, netbuf, strlen(netbuf), 0, (struct sockaddr*)&dest, sizeof(dest));} } if (showjoypad) JoyPadGfx(img1); if (showfire) FireFx(img1); if (showjoypad||showfire) oslDrawImageXY(img1, 345, 85); oslEndDrawing(); } if (GameTic >= TicRoof){ GameTic=0; //snprintf(netbuf,1024,"AT*COMWDG=%d%cAT*PCMD=%d,%d,%d,%d,%d,%d%c",AT_SEQ++,CR,AT_SEQ++,Hover,_movX.i,_movY.i,_movZ.i,_movW.i,CR);//XY snprintf(netbuf,1024,"AT*PCMD=%d,%d,%d,%d,%d,%d%c",AT_SEQ++,Hover,_movX.i,_movY.i,_movZ.i,_movW.i,CR);//XY sendto(DroneUdp, netbuf, strlen(netbuf), 0, (struct sockaddr*)&dest, sizeof(dest));} oslEndFrame(); skip = oslSyncFrame(); } //Quit OSL: oslNetTerm(); oslEndGfx(); oslQuit(); sceKernelExitGame(); return 0; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Main: /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int main(){ int skip = 0; SetupCallbacks(); initOSLib(); oslIntraFontInit(INTRAFONT_CACHE_MED); //Loads image: OSL_IMAGE *bkg = oslLoadImageFilePNG("bkg.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); OSL_IMAGE *rect_01 = oslLoadImageFilePNG("rect_01.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); //Load fonts: OSL_FONT *pgfFont = oslLoadFontFile("flash0:/font/ltn0.pgf"); oslIntraFontSetStyle(pgfFont, 0.5, RGBA(255,255,255,255), RGBA(0,0,0,0), INTRAFONT_ALIGN_LEFT); OSL_FONT *oftFont = oslLoadFontFile("font.oft"); oslSetTextColor(RGBA(255,255,255,255)); oslSetBkColor(RGBA(0,0,0,0)); while(runningFlag && !osl_quit){ if (!skip){ oslStartDrawing(); oslDrawImageXY(bkg, 0, 0); oslDrawImageXY(rect_01, 50, 50); oslSetFont(pgfFont); oslDrawString(55, 55, "pgf on alpha image"); oslSetFont(oftFont); oslDrawString(55, 70, "oft on alpha image"); oslDrawFillRect(30, 150, 200, 250, RGB(150, 150, 150)); oslSetFont(pgfFont); oslDrawString(35, 155, "pgf on rect"); oslSetFont(oftFont); oslDrawString(35, 170, "oft on rect"); oslDrawFillRect(300, 150, 400, 250, RGB(100, 100, 100)); oslSetFont(pgfFont); oslDrawString(305, 155, "pgf on rect"); oslSetFont(oftFont); oslDrawString(305, 170, "oft on rect"); oslDrawGradientRect(300, 20, 430, 120, RGBA(100, 100, 100, 100),RGBA(100, 100, 100, 100), RGBA(200, 200, 200, 100), RGBA(200, 200, 200, 100)); oslSetFont(pgfFont); oslDrawString(305, 25, "pgf on gradient rect"); oslSetFont(oftFont); oslDrawString(305, 40, "oft on gradient rect"); oslEndDrawing(); } oslEndFrame(); skip = oslSyncFrame(); } //Quit OSL: oslEndGfx(); oslQuit(); sceKernelExitGame(); return 0; }