예제 #1
0
파일: main.cpp 프로젝트: MrNetrix/NES4Vita
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;
}
예제 #2
0
파일: main.cpp 프로젝트: xerpi/Gearboy-vita
static void end(void)
{
	SafeDeleteArray(theFrameBuffer);
	SafeDelete(theGearboyCore);
	vita2d_fini();
	vita2d_free_texture(gb_texture);
}
예제 #3
0
/***
 * Cleans up the long-lived memory we've allocated.
 */
void vita_cleanup()
{
    free(pad);

    vita2d_fini();
    audio_shutdown();
    video_shutdown();
}
예제 #4
0
파일: main.c 프로젝트: DavisDev/libvita2d
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;
}
예제 #5
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;
}
예제 #6
0
파일: init.c 프로젝트: Bulkman/VitaShell
void finishVita2dLib() {
	vita2d_free_texture(battery_bar_green_image);
	vita2d_free_texture(battery_bar_red_image);
	vita2d_free_texture(battery_image);
	vita2d_free_pgf(font);
	vita2d_fini();

	battery_bar_green_image = NULL;
	battery_bar_red_image = NULL;
	battery_image = NULL;
	font = NULL;
}
예제 #7
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;
}
예제 #8
0
파일: psp2_ui.cpp 프로젝트: EasyRPG/Player
Psp2Ui::~Psp2Ui() {
	sceKernelWaitSema(GPU_Cleanup_Mutex, 1, NULL);
	for (int i = 0; i < SHADERS_NUM; i++){
		vita2d_free_shader(shaders[i]);
	}
	vita2d_free_texture(main_texture);
	main_texture = NULL;
	sceKernelSignalSema(GPU_Cleanup_Mutex, 1);
	sceKernelWaitThreadEnd(GPU_Thread, NULL, NULL);
	vita2d_free_texture(next_texture);
	vita2d_free_texture(gpu_texture);
	sceKernelDeleteSema(GPU_Mutex);
	sceKernelDeleteSema(GPU_Cleanup_Mutex);
	vita2d_fini();
}
예제 #9
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;
}
예제 #10
0
static void vita2d_gfx_free(void *data)
{
   vita_video_t *vita = (vita_video_t *)data;

   vita2d_fini();

   if (vita->menu.texture)
   {
      vita2d_free_texture(vita->menu.texture);
      vita->menu.texture = NULL;
   }

   if (vita->texture)
   {
      vita2d_free_texture(vita->texture);
      vita->texture = NULL;
   }

   font_driver_free_osd();
}
예제 #11
0
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;
}
예제 #12
0
static void vita2d_gfx_free(void *data)
{
   vita_video_t *vita = (vita_video_t *)data;

   RARCH_LOG("vita2d_gfx_free()\n");

   vita2d_fini();

   if (vita->menu.texture)
   {
      vita2d_free_texture(vita->menu.texture);
      vita->menu.texture = NULL;
   }

   if (vita->texture)
   {
      vita2d_free_texture(vita->texture);
      vita->texture = NULL;
   }

   RARCH_LOG("vita2d_gfx_free() done\n");
}
예제 #13
0
void pl_gfx_shutdown()
{
  vita2d_fini();
}
Psp2Ui::~Psp2Ui() {
	vita2d_free_texture(main_texture);
	vita2d_fini();
}
예제 #15
0
void pspVideoShutdown()
{
  vita2d_fini();
}
예제 #16
0
void video_Exit(){
	vita2d_fini();
	if (fb) {
		vita2d_free_texture(fb);
	}
}
예제 #17
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;
}
예제 #18
0
void	VID_Shutdown (void)
{
	vita2d_free_texture(tex_buffer);
	vita2d_fini();
	free(surfcache);
}
예제 #19
0
파일: main.c 프로젝트: Stary2001/vita-lua
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;
}