Psp2Ui::Psp2Ui(int width, int height) : BaseUi() { starttick = sceKernelGetProcessTimeWide() / 1000; frame = 0; zoom_state = 0; trigger_state = false; vita2d_init(); vita2d_texture_set_alloc_memblock_type(SCE_KERNEL_MEMBLOCK_TYPE_USER_RW); current_display_mode.width = width; current_display_mode.height = height; current_display_mode.bpp = 32; const DynamicFormat format( 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000, PF::Alpha); main_texture = vita2d_create_empty_texture_format( width, height, SCE_GXM_TEXTURE_FORMAT_A8B8G8R8); Bitmap::SetFormat(Bitmap::ChooseFormat(format)); main_surface = Bitmap::Create(vita2d_texture_get_datap(main_texture),width, height, vita2d_texture_get_stride(main_texture), format); #ifdef SUPPORT_AUDIO audio_.reset(new Psp2Audio()); #endif scePowerSetArmClockFrequency(444); sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG); }
int main() { char rom_path[PATH_MAX]; printf("Starting NES4Vita by SMOKE"); vita2d_init(); while (1) { emu = new Nes_Emu(); file_choose( "cache0:/VitaDefilerClient/Documents", rom_path, "Choose a NES ROM:", supported_ext ); printf("Loading emulator.... %s", rom_path); run_emu(rom_path); delete emu; } vita2d_fini(); sceKernelExitProcess(0); return 0; }
static void *vita2d_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { vita_video_t *vita = (vita_video_t *)calloc(1, sizeof(vita_video_t)); if (!vita) return NULL; *input = NULL; *input_data = NULL; RARCH_LOG("vita2d_gfx_init: w: %i h: %i\n", video->width, video->height); RARCH_LOG("RARCH_SCALE_BASE: %i input_scale: %i = %i\n", RARCH_SCALE_BASE, video->input_scale, RARCH_SCALE_BASE * video->input_scale); vita2d_init(); vita2d_set_clear_color(RGBA8(0x00, 0x00, 0x00, 0xFF)); vita2d_set_vblank_wait(video->vsync); if (vita->rgb32) { RARCH_LOG("Format: SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1RGB\n"); vita->format = SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1RGB; } else { RARCH_LOG("Format: SCE_GXM_TEXTURE_FORMAT_R5G6B5\n"); vita->format = SCE_GXM_TEXTURE_FORMAT_R5G6B5; } vita->fullscreen = video->fullscreen; vita->texture = NULL; vita->menu.texture = NULL; vita->menu.active = 0; vita->menu.width = 0; vita->menu.height = 0; vita->vsync = video->vsync; vita->rgb32 = video->rgb32; vita->tex_filter = video->smooth? SCE_GXM_TEXTURE_FILTER_LINEAR : SCE_GXM_TEXTURE_FILTER_POINT; if (input && input_data) { void *pspinput = input_psp.init(); *input = pspinput ? &input_psp : NULL; *input_data = pspinput; } vita->keep_aspect = true; vita->should_resize = true; #ifdef HAVE_OVERLAY vita->overlay_enable = false; #endif return vita; }
Psp2Ui::Psp2Ui(int width, int height) : BaseUi() { starttick = sceKernelGetProcessTimeWide() / 1000; frame = 0; zoom_state = 0; in_use_shader = 0; touch_x_start = -1; trigger_state = false; set_shader = true; vita2d_init(); vita2d_set_vblank_wait(0); shaders[0] = vita2d_create_shader((SceGxmProgram*) opaque_v, (SceGxmProgram*) texture_f); shaders[1] = vita2d_create_shader((SceGxmProgram*) sharp_bilinear_v, (SceGxmProgram*) sharp_bilinear_f); shaders[2] = vita2d_create_shader((SceGxmProgram*) lcd3x_v, (SceGxmProgram*) lcd3x_f); shaders[3] = vita2d_create_shader((SceGxmProgram*) xbr_2x_fast_v, (SceGxmProgram*) xbr_2x_fast_f); gpu_texture = vita2d_create_empty_texture_format( width, height, SCE_GXM_TEXTURE_FORMAT_A8B8G8R8); vita2d_texture_set_alloc_memblock_type(SCE_KERNEL_MEMBLOCK_TYPE_USER_RW); current_display_mode.width = width; current_display_mode.height = height; current_display_mode.bpp = 32; const DynamicFormat format( 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000, PF::Alpha); main_texture = vita2d_create_empty_texture_format( width, height, SCE_GXM_TEXTURE_FORMAT_A8B8G8R8); next_texture = vita2d_create_empty_texture_format( width, height, SCE_GXM_TEXTURE_FORMAT_A8B8G8R8); Bitmap::SetFormat(Bitmap::ChooseFormat(format)); main_surface = Bitmap::Create(vita2d_texture_get_datap(main_texture),width, height, vita2d_texture_get_stride(main_texture), format); #ifdef SUPPORT_AUDIO audio_.reset(new Psp2Audio()); #endif scePowerSetArmClockFrequency(444); scePowerSetBusClockFrequency(222); scePowerSetGpuClockFrequency(222); scePowerSetGpuXbarClockFrequency(222); sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG); sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START); GPU_Mutex = sceKernelCreateSema("GPU Mutex", 0, 1, 1, NULL); GPU_Cleanup_Mutex = sceKernelCreateSema("GPU Cleanup Mutex", 0, 1, 1, NULL); GPU_Thread = sceKernelCreateThread("GPU Thread", &renderThread, 0x10000100, 0x10000, 0, 0, NULL); sceKernelStartThread(GPU_Thread, sizeof(GPU_Thread), &GPU_Thread); }
void video_Init(){ vita2d_init(); vita2d_set_vblank_wait(0); vita2d_set_clear_color(RGBA8(0, 0, 0, 0xFF)); fb = vita2d_create_empty_texture_format(256, 192*2, SCE_GXM_TEXTURE_FORMAT_U1U5U5U5_ABGR); data = vita2d_texture_get_datap(fb); }
int main() { SceCtrlData pad; vita2d_pgf *pgf; vita2d_texture *image; float rad = 0.0f; vita2d_init(); vita2d_set_clear_color(RGBA8(0x40, 0x40, 0x40, 0xFF)); pgf = vita2d_load_default_pgf(); /* * Load the statically compiled image.png file. */ image = vita2d_load_PNG_buffer(&_binary_image_png_start); memset(&pad, 0, sizeof(pad)); while (1) { sceCtrlPeekBufferPositive(0, &pad, 1); if (pad.buttons & SCE_CTRL_START) break; vita2d_start_drawing(); vita2d_clear_screen(); vita2d_draw_rectangle(20, 20, 400, 250, RGBA8(255, 0, 0, 255)); vita2d_draw_rectangle(680, 350, 100, 150, RGBA8(0, 0, 255, 255)); vita2d_draw_fill_circle(200, 420, 100, RGBA8(0, 255,0 ,255)); vita2d_draw_texture_rotate(image, 940/2, 544/2, rad); vita2d_draw_line(500, 30, 800, 300, RGBA8(255, 0, 255, 255)); vita2d_pgf_draw_text(pgf, 700, 30, RGBA8(0,255,0,255), 1.0f, "PGF Font sample!"); vita2d_end_drawing(); vita2d_swap_buffers(); rad += 0.1f; } /* * vita2d_fini() waits until the GPU has finished rendering, * then we can free the assets freely. */ vita2d_fini(); vita2d_free_texture(image); vita2d_free_pgf(pgf); sceKernelExitProcess(0); return 0; }
int main() { vita2d_init(); vita2d_set_clear_color(RGBA8(0x40, 0x40, 0x40, 0xFF)); vita2d_pgf *pgf = vita2d_load_default_pgf(); vita2d_texture *tex = vita2d_create_empty_texture(128, 128); unsigned int *tex_data = vita2d_texture_get_datap(tex); SceCtrlData pad; memset(&pad, 0, sizeof(pad)); float rad = 0.0f; while (1) { sceCtrlPeekBufferPositive(0, &pad, 1); if (pad.buttons & SCE_CTRL_START) break; vita2d_start_drawing(); vita2d_clear_screen(); vita2d_draw_rectangle(20, 20, 400, 250, RGBA8(255, 0, 0, 255)); vita2d_draw_rectangle(680, 350, 100, 150, RGBA8(0, 0, 255, 255)); vita2d_draw_fill_circle(200, 420, 100, RGBA8(0, 255,0 ,255)); /* Fill the texture with random data */ int i, j; for (i = 0; i < 128; i++) { for (j = 0; j < 128; j++) { tex_data[j + i*128] = rand(); } } vita2d_draw_texture_rotate(tex, 940/2, 544/2, rad); vita2d_draw_line(500, 30, 800, 300, RGBA8(255, 0, 255, 255)); vita2d_pgf_draw_text(pgf, 700, 30, RGBA8(0,255,0,255), 1.0f, "PGF Font sample!"); vita2d_end_drawing(); vita2d_swap_buffers(); rad += 0.1f; } vita2d_fini(); vita2d_free_texture(tex); vita2d_free_pgf(pgf); sceKernelExitProcess(0); return 0; }
int main() { char rom_path[PATH_MAX]; printf("\nRealBoy %s\n", "0.2.2"); sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG); vita2d_init(); vita2d_set_clear_color(RGBA8(0x40, 0x40, 0x40, 0xFF)); while (1) { strcpy(current_dir, "ux0:"); int ret = file_choose( current_dir, rom_path, "Choose a GB/GB Color/Super GB ROM:", supported_ext ); if (ret == -1) break; if ( (rom_file = fopen(rom_path, "r")) == NULL) { printf("\nError opening %s\n", rom_path); continue; } file_path = strndup(rom_path, 256); if (rom_file != NULL) { init_conf(); int ret_val; // value returned from emulation /* Start Virtual Machine */ ret_val = start_vm(); /* Error returned if file not valid */ if (ret_val == -1) { printf("File %s not a gb binary\n\n", rom_path); } } free(file_path); } vita2d_fini(); sceKernelExitProcess(0); return 0; }
int main() { printf("Starting NES4Vita by SMOKE"); vita2d_init(); printf("vita2d initialized"); char *path = (char*)malloc(sizeof(char) * (strlen("cache0:/VitaDefilerClient/Documents/rom.nes"))); sprintf(path, "cache0:/VitaDefilerClient/Documents/rom.nes"); printf("Loading emulator.... %s",path); run_emu(path); vita2d_fini(); return 0; }
static void init(void) { vita2d_init(); vita2d_set_clear_color(RGBA8(0x40, 0x40, 0x40, 0xFF)); sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG); fullscreen_scale_x = SCREEN_W / (float)GAMEBOY_WIDTH; fullscreen_scale_y = SCREEN_H / (float)GAMEBOY_HEIGHT; gb_texture = vita2d_create_empty_texture(GAMEBOY_WIDTH, GAMEBOY_HEIGHT); gb_texture_pixels = vita2d_texture_get_datap(gb_texture); set_scale(3); theGearboyCore = new GearboyCore(); theGearboyCore->Init(); }
void initVita2dLib() { vita2d_init(); font = vita2d_load_default_pgf(); // Font size cache int i; for (i = 0; i < 256; i++) { char character[2]; character[0] = i; character[1] = '\0'; font_size_cache[i] = vita2d_pgf_text_width(font, FONT_SIZE, character); } battery_image = vita2d_load_PNG_buffer(&_binary_resources_battery_png_start); battery_bar_red_image = vita2d_load_PNG_buffer(&_binary_resources_battery_bar_red_png_start); battery_bar_green_image = vita2d_load_PNG_buffer(&_binary_resources_battery_bar_green_png_start); }
int main() { SceCtrlData pad; vita2d_pgf *pgf; vita2d_texture *image; float rad = 0.0f; vita2d_init(); vita2d_set_clear_color(RGBA8(0x40, 0x40, 0x40, 0xFF)); pgf = vita2d_load_default_pgf(); image = vita2d_load_PNG_buffer(&_binary_image_png_start); memset(&pad, 0, sizeof(pad)); while (1) { sceCtrlPeekBufferPositive(0, &pad, 1); if (pad.buttons & SCE_CTRL_START) break; vita2d_start_drawing(); vita2d_clear_screen(); vita2d_draw_texture_rotate(image, 940/2, 544/2, rad); vita2d_pgf_draw_text(pgf, 50, 50, RGBA8(255,255,255,255), 1.0f, "ミクのおっぱい柔かぁい。柔軟剤使ったのか?"); vita2d_end_drawing(); vita2d_swap_buffers(); rad += 0.1f; } vita2d_fini(); vita2d_free_texture(image); vita2d_free_pgf(pgf); sceKernelExitProcess(0); return 0; }
int main() { vita2d_init(); vita2d_set_clear_color(RGBA8(0x40, 0x40, 0x40, 0xFF)); vita2d_pgf *pgf = vita2d_load_default_pgf(); SceCtrlData pad; memset(&pad, 0, sizeof(pad)); vu_rectangle *r = vu_rectangle_new(); vu_rectangle_set_color(r, (vec4){0xFF, 0x00, 0x00, 0xFF}); vu_rectangle_resize(r, (vec2){200, 200}); while (1) { sceCtrlPeekBufferPositive(0, &pad, 1); if (pad.buttons & SCE_CTRL_START) break; vita2d_start_drawing(); vita2d_clear_screen(); vu_rectangle_render(r); vita2d_pgf_draw_text(pgf, 20, 30, RGBA8(0xFF,0xFF,0xFF,0xFF), 1.0f, "PS Vita Package Manager"); vita2d_end_drawing(); vita2d_swap_buffers(); } vita2d_free_pgf(pgf); //vita2d_fini(); crashes sceKernelExitProcess(0); return 0; }
int main() { char vita_ip[16]; unsigned short int vita_port = 0; vita2d_init(); vita2d_set_clear_color(RGBA8(0x00, 0x00, 0x00, 0xFF)); clr_color = 0x000000FF; vita2d_texture* texture_splash = vita2d_load_JPEG_buffer(splash, size_splash); vita2d_start_drawing(); vita2d_draw_texture(texture_splash, 0, 0); vita2d_end_drawing(); vita2d_swap_buffers(); sceKernelDelayThread(4000000); vita2d_start_drawing(); vita2d_clear_screen(); vita2d_end_drawing(); vita2d_swap_buffers(); vita2d_free_texture(texture_splash); SceCtrlData pad; SceCtrlData oldpad; while (1) { // Load main script SceUID id = sceIoDopen("cache0:/lpp"); SceIoDirent entry; memset(&entry, 0, sizeof(SceIoDirent)); while (sceIoDread(id, &entry) > 0){ script_files++; memset(&entry, 0, sizeof(SceIoDirent)); } sceIoDclose(id); if (script_files>1) errMsg = runScript((const char*)main_menu, true); else{ SceUID main_file = sceIoOpen("cache0:/lpp/index.lua", PSP2_O_RDONLY, 0777); if (main_file < 0) errMsg = "index.lua not found."; else{ SceOff size = sceIoLseek(main_file, 0, SEEK_END); if (size < 1) errMsg = "Invalid main script."; else{ sceIoLseek(main_file, 0, SEEK_SET); script = (unsigned char*)malloc(size + 1); sceIoRead(main_file, script, size); script[size] = 0; sceIoClose(main_file); errMsg = runScript((const char*)script, true); free(script); } } } if (errMsg != NULL){ if (strstr(errMsg, "lpp_shutdown")) break; else{ int restore = 0; bool s = true; while (restore == 0){ vita2d_start_drawing(); vita2d_clear_screen(); font_draw_string(10, 10, RGBA8(255, 255, 255, 255), "An error occurred:"); font_draw_string(10, 30, RGBA8(255, 255, 255, 255), errMsg); font_draw_string(10, 70, RGBA8(255, 255, 255, 255), "Press X to restart."); font_draw_string(10, 90, RGBA8(255, 255, 255, 255), "Press O to enable/disable FTP."); if (vita_port != 0){ font_draw_stringf(10, 150, RGBA8(255, 255, 255, 255), "PSVITA listening on IP %s , Port %u", vita_ip, vita_port); } vita2d_end_drawing(); vita2d_swap_buffers(); if (s){ sceKernelDelayThread(800000); s = false; } sceCtrlPeekBufferPositive(0, &pad, 1); if (pad.buttons & PSP2_CTRL_CROSS) { errMsg = NULL; restore = 1; if (vita_port != 0){ ftp_fini(); vita_port = 0; } sceKernelDelayThread(800000); }else if ((pad.buttons & PSP2_CTRL_CIRCLE) && (!(oldpad.buttons & PSP2_CTRL_CIRCLE))){ if (vita_port == 0) ftp_init(vita_ip, &vita_port); else{ ftp_fini(); vita_port = 0; } } oldpad = pad; } } } } vita2d_fini(); sceKernelExitProcess(0); return 0; }
static void *vita2d_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { vita_video_t *vita = (vita_video_t *)calloc(1, sizeof(vita_video_t)); settings_t *settings = config_get_ptr(); if (!vita) return NULL; *input = NULL; *input_data = NULL; RARCH_LOG("vita2d_gfx_init: w: %i h: %i\n", video->width, video->height); RARCH_LOG("RARCH_SCALE_BASE: %i input_scale: %i = %i\n", RARCH_SCALE_BASE, video->input_scale, RARCH_SCALE_BASE * video->input_scale); vita2d_init(); vita2d_set_clear_color(RGBA8(0x00, 0x00, 0x00, 0xFF)); vita2d_set_vblank_wait(video->vsync); if (vita->rgb32) { RARCH_LOG("Format: SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1RGB\n"); vita->format = SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1RGB; } else { RARCH_LOG("Format: SCE_GXM_TEXTURE_FORMAT_R5G6B5\n"); vita->format = SCE_GXM_TEXTURE_FORMAT_R5G6B5; } vita->fullscreen = video->fullscreen; vita->texture = NULL; vita->menu.texture = NULL; vita->menu.active = 0; vita->menu.width = 0; vita->menu.height = 0; vita->vsync = video->vsync; vita->rgb32 = video->rgb32; vita->tex_filter = video->smooth? SCE_GXM_TEXTURE_FILTER_LINEAR : SCE_GXM_TEXTURE_FILTER_POINT; if (input && input_data) { void *pspinput = input_psp.init(); *input = pspinput ? &input_psp : NULL; *input_data = pspinput; } vita->keep_aspect = true; vita->should_resize = true; #ifdef HAVE_OVERLAY vita->overlay_enable = false; #endif if (!font_driver_init_first(NULL, NULL, vita, *settings->path.font ? settings->path.font : NULL, settings->video.font_size, false, FONT_DRIVER_RENDER_VITA2D)) { RARCH_ERR("Font: Failed to initialize font renderer.\n"); return false; } return vita; }
/* Programme "Flocon de Koch" */ int main(int argc, char *argv[]) { struct parameters parameters; struct list *koch = NULL; uint32_t *picture = NULL; char *outfile = NULL; bool screenshots = false; srand(time(NULL)); #ifdef PSP2 vita2d_init(); vita2d_set_clear_color(RGBA8(0, 0, 0, 0xFF)); vita2d_texture *tex = vita2d_create_empty_texture(960, 544); uint32_t *tex_data = vita2d_texture_get_datap(tex); SceCtrlData pad, lastbuttons; memset(&pad, 0, sizeof(pad)); #endif /* Initialisations */ init_parameters(¶meters, argc, argv); show_parameters(parameters); init_koch(&koch, parameters.image_size, parameters.segment_length); outfile = malloc(3 + strlen(parameters.outfile) + 1); int32_t i = 0, step = 1; bool done = false; /* Génération de chaque flocon */ while (!done) { #ifdef PSP2 lastbuttons = pad; sceCtrlPeekBufferPositive(0, &pad, 1); if (pad.buttons & PSP2_CTRL_TRIANGLE) break; if (PRESSED(lastbuttons.buttons, pad.buttons, PSP2_CTRL_LTRIGGER)) parameters.fg_color = RGBA8(rand()%255, rand()%255, rand()%255, 255); //if (PRESSED(lastbuttons.buttons, pad.buttons, PSP2_CTRL_RTRIGGER)) // screenshots ^= 1; vita2d_start_drawing(); vita2d_clear_screen(); #endif sprintf(outfile, "%02d_%s", i, parameters.outfile); if (step > 0) generer_koch(koch, i); else { for (uint32_t j = 0; j < i; j++) generer_koch(koch, j); } //show_koch_list(koch); /* Ne générer l'image que si c'est la dernière ou qu'on les génère toutes */ if (parameters.all_images || i == parameters.nb_iterations) { init_picture(&picture, parameters.image_size, parameters.bg_color); render_image_bresenham(picture, koch, parameters.image_size, parameters.fg_color); #ifndef PSP2 const uint32_t LEN = 960 * 544; uint32_t *data = calloc(LEN, sizeof(uint32_t)); for (uint32_t i = 0; i < LEN; i++) data[i] = 0; uint32_t k = 0; for (uint32_t i = 0; i < 544; i++) for (uint32_t j = 0; j < 960; j++) { if (208 <= j && j < 752 && k < 544*544) data[i * 960 + j] = picture[k++]; else data[i * 960 + j] = 0; } create_image(data, 960, 544, outfile); //create_image(picture, parameters.image_size, parameters.image_size, outfile); #else uint32_t k = 0; for (uint32_t i = 0; i < 544; i++) for (uint32_t j = 0; j < 960; j++) { if (208 <= j && j < 752 && k < 544*544) tex_data[i * 960 + j] = picture[k++]; else tex_data[i * 960 + j] = 0; } if (screenshots) create_image(tex_data, 960, 544, outfile); #endif } #ifdef PSP2 vita2d_draw_texture(tex, 0, 0); vita2d_end_drawing(); vita2d_swap_buffers(); sceKernelDelayThread(100000); #endif i = i + step; if (i == parameters.nb_iterations) #ifdef PSP2 i--, step = -1; #else done = true; #endif else if (i == 0) { step = 1; free_koch(koch); init_koch(&koch, parameters.image_size, parameters.segment_length); } if (step < 0) { free_koch(koch); init_koch(&koch, parameters.image_size, parameters.segment_length); } if (parameters.nb_iterations == 1) done = true; }
int pl_gfx_init(unsigned int format) { return vita2d_init(); }
static void *vita2d_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { vita_video_t *vita = (vita_video_t *)calloc(1, sizeof(vita_video_t)); unsigned temp_width = PSP_FB_WIDTH; unsigned temp_height = PSP_FB_HEIGHT; if (!vita) return NULL; *input = NULL; *input_data = NULL; RARCH_LOG("vita2d_gfx_init: w: %i h: %i\n", video->width, video->height); RARCH_LOG("RARCH_SCALE_BASE: %i input_scale: %i = %i\n", RARCH_SCALE_BASE, video->input_scale, RARCH_SCALE_BASE * video->input_scale); vita2d_init(); vita2d_set_clear_color(RGBA8(0x00, 0x00, 0x00, 0xFF)); vita2d_set_vblank_wait(video->vsync); if (video->rgb32) { RARCH_LOG("Format: SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1RGB\n"); vita->format = SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1RGB; } else { RARCH_LOG("Format: SCE_GXM_TEXTURE_FORMAT_R5G6B5\n"); vita->format = SCE_GXM_TEXTURE_FORMAT_R5G6B5; } vita->fullscreen = video->fullscreen; vita->texture = NULL; vita->menu.texture = NULL; vita->menu.active = 0; vita->menu.width = 0; vita->menu.height = 0; vita->vsync = video->vsync; vita->rgb32 = video->rgb32; vita->tex_filter = video->smooth ? SCE_GXM_TEXTURE_FILTER_LINEAR : SCE_GXM_TEXTURE_FILTER_POINT; video_driver_set_size(&temp_width, &temp_height); vita2d_gfx_set_viewport(vita, temp_width, temp_height, false, true); if (input && input_data) { settings_t *settings = config_get_ptr(); void *pspinput = input_psp.init(settings->input.joypad_driver); *input = pspinput ? &input_psp : NULL; *input_data = pspinput; } vita->keep_aspect = true; vita->should_resize = true; #ifdef HAVE_OVERLAY vita->overlay_enable = false; #endif font_driver_init_osd(vita, false, FONT_DRIVER_RENDER_VITA2D); return vita; }
int main() { lua_State *lua = luaL_newstate(); lua_atpanic(lua, panic); // Net init sceSysmoduleLoadModule(SCE_SYSMODULE_NET); SceNetInitParam netInitParam; int size = 1024 * 512; netInitParam.memory = malloc(size); netInitParam.size = size; netInitParam.flags = 0; sceNetInit(&netInitParam); sceSysmoduleLoadModule(SCE_SYSMODULE_HTTP); #ifdef DEBUGGER_IP debugNetInit(DEBUGGER_IP, DEBUGGER_PORT, DEBUG); #endif sceHttpInit(1024 * 50); // Init libs debugf("Init libs....\n"); debugf("vita2d...\n"); vita2d_init(); debugf("physfs\n"); PHYSFS_init(NULL); debugf("lualibs\n"); luaL_openlibs(lua); debugf("ffi\n"); open_ffi(lua); lua_pushcfunction(lua, print); lua_setglobal(lua, "print"); /* // Display splash unsigned int goal = 2*60; unsigned int counter = 0; vita2d_texture *tex = vita2d_load_PNG_buffer(splash_data); SceCtrlData pad; memset(&pad, 0, sizeof(pad)); for (;;) { ++counter; if (counter >= goal) break; sceCtrlPeekBufferPositive(0, &pad, 1); if (pad.buttons & SCE_CTRL_ANY) break; vita2d_start_drawing(); vita2d_clear_screen(); vita2d_draw_texture(tex, 0, 0); vita2d_end_drawing(); vita2d_swap_buffers(); } */ debugf("[Lua] Loading app0:/lib/init.lua ...\n"); if(luaL_loadfile(lua, "app0:/lib/init.lua") == 0) { if(lua_pcall(lua, 0, 0, 0) != 0) { debugf("[Lua] init error: %s\n", lua_tostring(lua, -1)); lua_pop(lua, 1); } } /*debugf("[Lua] Loading app0:/boot.lua ...\n"); if(luaL_loadfile(lua, "app0:/boot.lua") == 0) { if(lua_pcall(lua, 0, 0, 0) != 0) { debugf("[Lua] bootscript err: %s\n", lua_tostring(lua, -1)); lua_pop(lua, 1); } } else { debugf("[Lua] bootscript load err: %s\n", lua_tostring(lua, -1)); lua_pop(lua, 1); }*/ debugf("Deinit. Goodbye.\n"); sceHttpTerm(); PHYSFS_deinit(); vita2d_fini(); //vita2d_free_texture(tex); sceKernelExitProcess(0); return 0; }