PspImage* pspVideoGetVramBufferCopy() { int i, j; unsigned short *pixel; uint32_t *vram_addr = vita2d_get_current_fb(); uint32_t pixv; PspImage *image; if (!(image = pspImageCreate(SCR_WIDTH, SCR_HEIGHT, PSP_IMAGE_16BPP))) return NULL; image->Viewport.Width = SCR_WIDTH; for (i = 0; i < image->Height; i++) { for (j = 0; j < image->Viewport.Width; j++) { pixel = (unsigned short*)image->Pixels + (i * image->Width + j); pixv = *(vram_addr + (i * BUF_WIDTH + j)); *pixel = RGB(RED_32(pixv),GREEN_32(pixv),BLUE_32(pixv)); } } return image; }
void InitMenu() { /* Reset variables */ TabIndex = TAB_ABOUT; Background = NULL; /* Initialize paths */ sprintf(SaveStatePath, "%ssavedata/", pl_psp_get_app_directory()); sprintf(ScreenshotPath, "%sscreenshot/", pl_psp_get_app_directory()); sprintf(GamePath, "%s", pl_psp_get_app_directory()); if (!pl_file_exists(SaveStatePath)) pl_file_mkdir_recursive(SaveStatePath); /* Initialize options */ LoadOptions(); InitEmulator(); /* Load the background image */ pl_file_path background; snprintf(background, sizeof(background) - 1, "%sbackground.png", pl_psp_get_app_directory()); Background = pspImageLoadPng(background); //Background = pspImageLoadPng("background.png"); /* Init NoSaveState icon image */ NoSaveIcon = pspImageCreate(136, 114, PSP_IMAGE_16BPP); pspImageClear(NoSaveIcon, RGB(0x0c,0,0x3f)); /* Initialize state menu */ int i; pl_menu_item *item; for (i = 0; i < 10; i++) { item = pl_menu_append_item(&SaveStateGallery.Menu, i, NULL); pl_menu_set_item_help_text(item, EmptySlotText); } /* Initialize menus */ pl_menu_create(&SystemUiMenu.Menu, SystemMenuDef); pl_menu_create(&OptionUiMenu.Menu, OptionMenuDef); pl_menu_create(&ControlUiMenu.Menu, ControlMenuDef); /* Load default configuration */ LoadButtonConfig(); /* Initialize UI components */ UiMetric.Background = Background; UiMetric.Font = &PspStockFont; UiMetric.Left = 16; UiMetric.Top = 48; UiMetric.Right = 944; UiMetric.Bottom = 500; UiMetric.OkButton = (!Options.ControlMode) ? PSP_CTRL_CROSS : PSP_CTRL_CIRCLE; UiMetric.CancelButton = (!Options.ControlMode) ? PSP_CTRL_CIRCLE : PSP_CTRL_CROSS; UiMetric.ScrollbarColor = PSP_COLOR_GRAY; UiMetric.ScrollbarBgColor = 0x44ffffff; UiMetric.ScrollbarWidth = 10; UiMetric.TextColor = PSP_COLOR_GRAY; UiMetric.SelectedColor = PSP_COLOR_YELLOW; UiMetric.SelectedBgColor = COLOR(0xff,0xff,0xff,0x44); UiMetric.StatusBarColor = PSP_COLOR_WHITE; UiMetric.BrowserFileColor = PSP_COLOR_GRAY; UiMetric.BrowserDirectoryColor = PSP_COLOR_YELLOW; UiMetric.GalleryIconsPerRow = 5; UiMetric.GalleryIconMarginWidth = 8; UiMetric.MenuItemMargin = 20; UiMetric.MenuSelOptionBg = PSP_COLOR_BLACK; UiMetric.MenuOptionBoxColor = PSP_COLOR_GRAY; UiMetric.MenuOptionBoxBg = COLOR(0, 0, 33, 0xBB); UiMetric.MenuDecorColor = PSP_COLOR_YELLOW; UiMetric.DialogFogColor = COLOR(0, 0, 0, 88); UiMetric.TitlePadding = 4; UiMetric.TitleColor = PSP_COLOR_WHITE; UiMetric.MenuFps = 30; UiMetric.TabBgColor = COLOR(0x74,0x74,0xbe,0xff); UiMetric.BrowserScreenshotPath = ScreenshotPath; UiMetric.BrowserScreenshotDelay = 30; }