Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <psp2kern/display.h>
- #define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1))
- #define SCREEN_PITCH 1024
- #define SCREEN_W 960
- #define SCREEN_H 544
- static SceUID fb_uid = -1;
- int module_start(SceSize argc, const void *args)
- {
- unsigned int fb_size = ALIGN(4 * SCREEN_PITCH * SCREEN_H, 256 * 1024);
- fb_uid = ksceKernelAllocMemBlock("fb", 0x40404006 , fb_size, NULL);
- void *fb_addr = NULL;
- ksceKernelGetMemBlockBase(fb_uid, &fb_addr);
- for (int i = 0; i < 544; i++) {
- for (int j = 0; j < 960; j++) {
- ((unsigned int *)fb_addr)[j + i * SCREEN_PITCH] = 0xFF0000FF;
- }
- }
- SceDisplayFrameBuf fb;
- fb.size = sizeof(fb);
- fb.base = fb_addr;
- fb.pitch = SCREEN_PITCH;
- fb.pixelformat = SCE_DISPLAY_PIXELFORMAT_A8B8G8R8;
- fb.width = SCREEN_W;
- fb.height = SCREEN_H;
- ksceDisplaySetFrameBuf(&fb, 1);
- return SCE_KERNEL_START_SUCCESS;
- }
- int module_stop(SceSize argc, const void *args)
- {
- if (fb_uid) {
- ksceKernelFreeMemBlock(fb_uid);
- }
- return SCE_KERNEL_STOP_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement