当前位置: 首页>>代码示例>>C++>>正文


C++ sceIoWrite函数代码示例

本文整理汇总了C++中sceIoWrite函数的典型用法代码示例。如果您正苦于以下问题:C++ sceIoWrite函数的具体用法?C++ sceIoWrite怎么用?C++ sceIoWrite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sceIoWrite函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: neogeo_exit

void neogeo_exit(void)
{
	SceUID fd;
	char path[MAX_PATH];

	msg_printf(TEXT(PLEASE_WAIT2));

   sprintf(path, "%smemcard/%s.bin", launchDir, game_name);
   if ((fd = sceIoOpen(path, PSP_O_WRONLY|PSP_O_CREAT, 0777)) >= 0)
   {
      sceIoWrite(fd, neogeo_memcard, 0x800);
      sceIoClose(fd);
   }

   sprintf(path, "%snvram/%s.nv", launchDir, game_name);
   if ((fd = sceIoOpen(path, PSP_O_WRONLY|PSP_O_CREAT, 0777)) >= 0)
   {
      swab(neogeo_sram16, neogeo_sram16, 0x2000);
      sceIoWrite(fd, neogeo_sram16, 0x2000);
      sceIoClose(fd);
   }

	msg_printf(TEXT(DONE2));
   sound_exit();
   memory_shutdown();
}
开发者ID:aliaspider,项目名称:NJEMU-libretro,代码行数:26,代码来源:mvs.c

示例2: write_callback

/* Buffer up the data */
size_t write_callback(void *ptr, size_t size, size_t nmemb, void *data)
{
	int *fd = (int *) data;
	int totalsize = size * nmemb;
	int ret = totalsize;

	if((totalsize + g_writebufpos) < WRITEBUF_SIZE)
	{
		memcpy(&g_writebuf[g_writebufpos], ptr, totalsize);
		g_writebufpos += totalsize;
	}
	else
	{
		if(g_writebufpos > 0)
		{
			sceIoWrite(*fd, g_writebuf, g_writebufpos);
			g_writebufpos = 0;
		}

		while(totalsize > WRITEBUF_SIZE)
		{
			sceIoWrite(*fd, ptr, WRITEBUF_SIZE);
			totalsize -= WRITEBUF_SIZE;
			ptr += WRITEBUF_SIZE;
		}

		if(totalsize > 0)
		{
			memcpy(g_writebuf, ptr, totalsize);
			g_writebufpos = totalsize;
		}
	}

	return ret;
}
开发者ID:Falaina,项目名称:psplinkusb,代码行数:36,代码来源:webget.c

示例3: __pspgl_vram_dump

void __pspgl_vram_dump (void)
{
	unsigned long vram_start = (unsigned long) sceGeEdramGetAddr();
	unsigned long vram_size = (unsigned long) sceGeEdramGetSize() * 4;
	unsigned long header [4];
	unsigned char vram_copy [0x10000];
	int fd;
	int i;

	fd = sceIoOpen(PSPGL_GE_DUMPFILE, PSP_O_CREAT | PSP_O_APPEND | PSP_O_WRONLY, 0644);

	if (pspgl_curctx) {
		struct pspgl_surface *s = pspgl_curctx->draw;
		struct pspgl_dump_surfaces surf;

		header[0] = PSPGL_GE_DUMP_SURFACES;
		header[1] = sizeof(header) + sizeof(surf);
		header[2] = 0;
		header[3] = 0;

		memset(&surf, 0, sizeof(surf));

		surf.pixfmt = s->pixfmt;
		surf.alpha_mask = s->alpha_mask;
		surf.stencil_mask = s->stencil_mask;

		surf.front.start = s->color_front->base - sceGeEdramGetAddr();
		surf.front.size = s->height * s->pixelperline * (s->pixfmt == GE_RGBA_8888 ? 4 : 2);
		surf.front.stride = s->pixelperline;

		surf.back.start = s->color_back->base - sceGeEdramGetAddr();
		surf.back.size = s->height * s->pixelperline * (s->pixfmt == GE_RGBA_8888 ? 4 : 2);
		surf.back.stride = s->pixelperline;

		if (s->depth_buffer) {
			surf.depth.start = s->depth_buffer->base - sceGeEdramGetAddr();
			surf.depth.size = s->height * s->pixelperline * 2;
			surf.depth.stride = s->pixelperline;
		}

		sceIoWrite(fd, header, sizeof(header));
		sceIoWrite(fd, &surf, sizeof(surf));
	}

	header[0] = PSPGL_GE_DUMP_VRAM;
	header[1] = sizeof(header) + vram_size;
	header[2] = vram_start;
	header[3] = vram_size;

	sceIoWrite(fd, header, sizeof(header));

	/* copy in blocks, direct writes from VRAM to file don't seem to work... */
	for (i=0; i<vram_size/sizeof(vram_copy); i++, vram_start+=sizeof(vram_copy)) {
		memcpy(vram_copy, (void *) vram_start, sizeof(vram_copy));
		sceIoWrite(fd, (void *) vram_copy, sizeof(vram_copy));
	}

	sceIoClose(fd);
}
开发者ID:Bracket-,项目名称:psp-ports,代码行数:59,代码来源:pspgl_misc.c

示例4: colorconfig_write

int colorconfig_write(ColorConfig* prConfig, SceUID fd) {
    if (prConfig == NULL) {
        return COLORCONFIG_NULLPTR;
    }
    sceIoWrite(fd, &prConfig->background, sizeof(u32));
    sceIoWrite(fd, &prConfig->text, sizeof(u32));
    return COLORCONFIG_SUCCESS;
}
开发者ID:opalmirror,项目名称:cefive,代码行数:8,代码来源:colorconfig.c

示例5: printf_char

// 0244
void printf_char(void *ctx, int ch)
{   
    dbg_printf("Calling %s\n", __FUNCTION__);
    if (ch == 0x200) {
        *(short*)(ctx + 2) = 0;
        return;
    }
    if (ch == 0x201)
    {   
        // 031C
        short cnt = *(short*)(ctx + 2);
        if (cnt <= 0)
            return;

        if (sceKernelDipsw(59) == 1)
            sceKernelDebugWrite(*(short*)(ctx + 0), ctx + 4, *(short*)(ctx + 2));
        else
        {   
            short fd = *(short*)(ctx + 0);
            if (fd == STDOUT)
                fd = g_stdout;
            // 0348
            if (fd == STDERR)
                fd = g_stderr;
            // 0354
            sceIoWrite(fd, ctx + 4, *(short*)(ctx + 2));
        }
        return;
    }
    if (ch == '\n') {
        // 030C
        printf_char(ctx, '\r');
    }
    // 027C
    (*(short*)(ctx + 2))++;
    *(char*)(ctx + 3 + *(short*)(ctx + 2)) = ch;
    if (ch == '\200')
    {   
        short fd = *(short*)(ctx + 0);
        // 02AC
        if (sceKernelDipsw(59) == 1)
        {   
            // 02F8
            sceKernelDebugWrite(fd, ctx + 4, *(short*)(ctx + 2));
        }
        else
        {   
            if (fd == STDOUT)
                fd = g_stdout;
            // 02C8
            if (fd == STDERR)
                fd = g_stderr;
            // 02D4
            sceIoWrite(fd, ctx + 4, *(short*)(ctx + 2));
        }
        *(short*)(ctx + 2) = 0;
    }
}
开发者ID:esxgx,项目名称:uofw,代码行数:59,代码来源:stdio.c

示例6: sceIoOpen

void PBPParse::Parse(const char *file){
	fid = sceIoOpen(file, PSP_O_RDONLY, 0777);

	sceIoMkdir("ms0:/TMP", 0777);
	if (fid >= 0)
	{
		if (sceIoRead(fid, &header, sizeof(PBPHeader)) == sizeof(PBPHeader)){

			char *temp = (char*)malloc(header.icon0 - header.sfo);
			sceIoLseek(fid, header.sfo, PSP_SEEK_SET);
			sceIoRead(fid, temp, header.icon0 - header.sfo);
			SceUID sfoFile = sceIoOpen("ms0:/TMP/PARAM.SFO", PSP_O_CREAT | PSP_O_WRONLY, 0777);
			sceIoWrite(sfoFile, temp, header.icon0 - header.sfo);
			sceIoClose(sfoFile);
			free(temp);
			sfo.Parse("ms0:/TMP/PARAM.SFO");

			temp = (char*)malloc(header.icon1 - header.icon0);
			sceIoLseek(fid, header.icon0, PSP_SEEK_SET);
			sceIoRead(fid, temp, header.icon1 - header.icon0);
			SceUID icoFile = sceIoOpen("ms0:/TMP/ICON0.PNG", PSP_O_CREAT | PSP_O_WRONLY, 0777);
			sceIoWrite(icoFile, temp, header.icon1 - header.icon0);
			sceIoClose(icoFile);
			if (header.icon1 - header.icon0 > 0){
				OSL_IMAGE *ico = oslLoadImageFilePNG("ms0:/TMP/ICON0.PNG", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_5650);
				icon = oslScaleImageCreate(ico, OSL_IN_RAM, 64, 64, OSL_PF_5650);
				oslDeleteImage(ico);
				oslWriteImageFilePNG(icon, "ms0:/TMP/ICON0.PNG", 0);
			}
			else{
				icon = oslCreateImageCopy(defaultUNKN, OSL_IN_RAM);
			}
			free(temp);

			temp = (char*)malloc(header.snd - header.pic1);
			sceIoLseek(fid, header.pic1, PSP_SEEK_SET);
			sceIoRead(fid, temp, header.snd - header.pic1);
			SceUID picFile = sceIoOpen("ms0:/TMP/PIC1.PNG", PSP_O_CREAT | PSP_O_WRONLY, 0777);
			sceIoWrite(picFile, temp, header.snd - header.pic1);
			sceIoClose(picFile);
			if (header.snd - header.pic1 > 0){
				pic = oslLoadImageFilePNG("ms0:/TMP/PIC1.PNG", OSL_IN_RAM, OSL_PF_8888);

				OSL_IMAGE *tmpPic = oslScaleImageCreate(pic, OSL_IN_RAM, 128, 128, OSL_PF_8888);
				oslUnswizzleImage(tmpPic);
				oslWriteImageFilePNG(tmpPic, "ms0:/TMP/PIC1SC.PNG", 0);
				oslDeleteImage(tmpPic);
				oslDeleteImage(pic);	//Get rid of the pic file for now, we don't need it
			}
			free(temp);

			sceIoClose(fid);
		}
	}
}
开发者ID:smgx360420,项目名称:Mentro,代码行数:55,代码来源:PBPParse.cpp

示例7: emulatorEmitScreenshot

void emulatorEmitScreenshot() {
	int file;

	if (RUNNING_ON_EMULATOR) {
		sceIoDevctl("kemulator:", EMULATOR_DEVCTL__EMIT_SCREENSHOT, NULL, 0, NULL, 0);
	}
	else
	{
		uint topaddr;
		int bufferwidth;
		int pixelformat;

		sceDisplayGetFrameBuf((void **)&topaddr, &bufferwidth, &pixelformat, 0);
		
        if (topaddr & 0x80000000) {
            topaddr |= 0xA0000000;
        } else {
            topaddr |= 0x40000000;
        }
	
		if ((file = sceIoOpen("__screenshot.bmp", PSP_O_CREAT | PSP_O_WRONLY | PSP_O_TRUNC, 0777)) >= 0) {
			int y, x;
			uint c;
			uint* vram_row;
			uint* row_buf = (uint *)malloc(512 * 4);
			sceIoWrite(file, &bmpHeader, sizeof(bmpHeader));
			for (y = 0; y < 272; y++) {
				vram_row = (uint *)(topaddr + 512 * 4 * (271 - y));
				for (x = 0; x < 512; x++) {
					c = vram_row[x];
					/*
					row_buf[x] = (
						((extractBits(c,  0, 8)) <<  0) |
						((extractBits(c,  8, 8)) <<  8) |
						((extractBits(c, 16, 8)) << 16) |
						((                0x00 ) << 24) |
					0);
					*/
					row_buf[x] = (
						((extractBits(c, 16, 8)) <<  0) |
						((extractBits(c,  8, 8)) <<  8) |
						((extractBits(c,  0, 8)) << 16) |
						((                0x00 ) << 24) |
					0);
				}
				sceIoWrite(file, row_buf, 512 * 4);
			}
			free(row_buf);
			//sceIoWrite(file, (void *)topaddr, bufferwidth * 272 * 4);
			//sceIoFlush();
			sceIoClose(file);
		}
	}
}
开发者ID:Falaina,项目名称:cspspemu,代码行数:54,代码来源:common.c

示例8: save_cache

static int save_cache(void)
{
    int i;
    SceUID fd;
    u32 magic = get_isocache_magic();

    if (g_caches == NULL) {
        return -33;
    }

    for(i=0; i<g_caches_cnt; ++i) {
        if (g_caches[i].enabled && !g_referenced[i]) {
            g_need_update = 1;
            memset(&g_caches[i], 0, sizeof(g_caches[i]));
        }
    }

    if(!g_need_update) {
        printk("%s: no need to update\n", __func__);

        return 0;
    }

    for(i=0; i<3; ++i) {
        fd = sceIoOpen(PSP_CACHE_PATH, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);

        if (fd >= 0) {
            break;
        }

        printk("%s: open %s -> 0x%08X\n", __func__, PSP_CACHE_PATH, fd);

        fd = sceIoOpen(PSPGO_CACHE_PATH, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);

        if (fd >= 0) {
            break;
        }

        printk("%s: open %s -> 0x%08X\n", __func__, PSPGO_CACHE_PATH, fd);
    }

    if (fd < 0) {
        return -21;
    }

    sceIoWrite(fd, &magic, sizeof(magic));
    sceIoWrite(fd, g_caches, sizeof(g_caches[0])*g_caches_cnt);
    sceIoClose(fd);

    g_need_update = 0;

    return 0;
}
开发者ID:sseary,项目名称:procfw-chn,代码行数:53,代码来源:virtual_pbp.c

示例9: neogeo_exit

static void neogeo_exit(void)
{
	SceUID fd;
	char path[MAX_PATH];

	video_set_mode(32);
	video_clear_screen();

	ui_popup_reset();

	video_clear_screen();
	msg_screen_init(WP_LOGO, ICON_SYSTEM, TEXT(EXIT_EMULATION2));

	msg_printf(TEXT(PLEASE_WAIT2));

#ifdef ADHOC
	if (!adhoc_enable)
#endif
	{
		sprintf(path, "%smemcard/%s.bin", launchDir, game_name);
		if ((fd = sceIoOpen(path, PSP_O_WRONLY|PSP_O_CREAT, 0777)) >= 0)
		{
			sceIoWrite(fd, neogeo_memcard, 0x800);
			sceIoClose(fd);
		}

		sprintf(path, "%snvram/%s.nv", launchDir, game_name);
		if ((fd = sceIoOpen(path, PSP_O_WRONLY|PSP_O_CREAT, 0777)) >= 0)
		{
			swab(neogeo_sram16, neogeo_sram16, 0x2000);
			sceIoWrite(fd, neogeo_sram16, 0x2000);
			sceIoClose(fd);
		}


#ifdef COMMAND_LIST
		free_commandlist();
#endif

		if (neogeo_save_sound_flag) option_sound_enable = 1;
		save_gamecfg(game_name);
	}

	msg_printf(TEXT(DONE2));

#ifdef ADHOC
	if (adhoc_enable) adhocTerm();
#endif

	show_exit_screen();
}
开发者ID:AMSMM,项目名称:NJEMU,代码行数:51,代码来源:mvs.c

示例10: makeDiff

int makeDiff( const char * file, const char * ori, int heap_id, int ctf )
{
	log( "detect %s, start to make diff!\n", file );
	u8 * buf = NULL, * buf_ori = NULL;
	int bytes = readPrx( file, heap_id, &buf );
	if ( bytes < 0 )
	{
		log( "failed in read %s!\n", file );
		return -1;
	}
	if ( readPrx( ori, heap_id, &buf_ori ) != bytes )
	{
		log( "failed in read %s!\n", ori );
		sceKernelFreeHeapMemory( heap_id, buf );
		sceKernelFreeHeapMemory( heap_id, buf_ori );
		return -1;
	}
	int sub = ( strstr( file, diff_files[1] ) ? 0xA0: 0xC0 );
	int diff_count = 0;
	unsigned int offset = 0, rec_attr[2];
	int rec = 0;
	memset( rec_attr, 0, 8 );
	while( offset < bytes )
	{
		if ( buf[offset] != buf_ori[offset] )
		{
			if ( !rec )
			{
				rec_attr[0] = offset - sub;
				rec_attr[1] = 0;
				rec = 1;
			}
			rec_attr[1] ++;
		}
		else
		{
			if ( rec )
			{
				log( "diff_start: %08x\nsize: %08x\n", rec_attr[0], rec_attr[1] );
				sceIoWrite( ctf, rec_attr, 8 );
				sceIoWrite( ctf, &buf[rec_attr[0] + sub], rec_attr[1] );
				diff_count ++;
				rec = 0;
			}
		}
		offset ++;
	}
	sceKernelFreeHeapMemory( heap_id, buf_ori );
	sceKernelFreeHeapMemory( heap_id, buf );
	return diff_count;
}
开发者ID:ErikPshat,项目名称:cxmb,代码行数:51,代码来源:ctf.c

示例11: __pspgl_dlist_dump

void __pspgl_dlist_dump (unsigned long *cmd_buf, unsigned long len)
{
	unsigned long header [3];
	int fd;

	header[0] = PSPGL_GE_DUMP_DLIST;
	header[1] = sizeof(header) + len * sizeof(cmd_buf[0]);
	header[2] = (unsigned long) cmd_buf;

	fd = sceIoOpen(PSPGL_GE_DUMPFILE, PSP_O_CREAT | PSP_O_APPEND | PSP_O_WRONLY, 0644);
	sceIoWrite(fd, header, sizeof(header));
	sceIoWrite(fd, (void *) cmd_buf, len * sizeof(cmd_buf[0]));
	sceIoClose(fd);
}
开发者ID:Bracket-,项目名称:psp-ports,代码行数:14,代码来源:pspgl_misc.c

示例12: write_file

int write_file(const char *path, unsigned char *buf, int size)
{
	SceUID fd;
	int ret;

	fd = sceIoOpen(path, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);

	if (fd < 0) {
		goto error;
	}

	ret = sceIoWrite(fd, buf, size);

	if (ret < 0) {
		goto error;
	}

	sceIoClose(fd);

	return 0;
error:
	if (fd >= 0)
		sceIoClose(fd);

	return -1;
}
开发者ID:AnnaKozlowska,项目名称:procfw,代码行数:26,代码来源:main.c

示例13: IoClose_new

int IoClose_new( PspIoDrvFileArg * arg )
{
	PspIoDrvArg * drv = arg->drv;
	int num = isRedirected( arg );
	if( num >= 0 && arg->fs_num == 0 )
	{
		arg->drv = ms_drv;
		handler_count --;
		memcpy( &ctf_handler[num], &ctf_handler[num + 1], sizeof( CtfHandler ) * ( handler_count - num ) );
		int ret = fatms_drv->funcs->IoClose( arg );
		arg->drv = drv;
		return ret;
	}
	if ( arg->arg == t_record )
	{
		log( "write finished!\n" );
		int fd = sceIoOpen( CXMB_CONF_FILE, PSP_O_RDWR | PSP_O_CREAT | PSP_O_TRUNC, 0777 );
		if ( fd < 0 )
		{
			log( "failed in openning %s\n", CXMB_CONF_FILE );
		}
		else
		{
			sceIoWrite( fd, selected_theme_file, strlen( selected_theme_file ) + 1 );
			sceIoClose( fd );
		}
		IoClose( arg );
		sceKernelSignalSema( sema, 1 );
	}
	arg->drv = drv;
	int ret = IoClose(arg);
	return ret;
}
开发者ID:ErikPshat,项目名称:cxmb,代码行数:33,代码来源:main.c

示例14: receive_file

static void receive_file(ClientInfo *client, const char *path)
{
	unsigned char *buffer;
	SceUID fd;
	unsigned int bytes_recv;

	DEBUG("Opening: %s\n", path);

	if ((fd = sceIoOpen(path, PSP2_O_CREAT | PSP2_O_WRONLY | PSP2_O_TRUNC, 0777)) >= 0) {

		buffer = malloc(FILE_BUF_SIZE);
		if (buffer == NULL) {
			client_send_ctrl_msg(client, "550 Could not allocate memory.\n");
			return;
		}

		client_open_data_connection(client);
		client_send_ctrl_msg(client, "150 Opening Image mode data transfer.\n");

		while ((bytes_recv = client_send_recv_raw(client, buffer, FILE_BUF_SIZE)) > 0) {
			sceIoWrite(fd, buffer, bytes_recv);
		}

		sceIoClose(fd);
		free(buffer);
		client_send_ctrl_msg(client, "226 Transfer completed.\n");
		client_close_data_connection(client);

	} else {
		client_send_ctrl_msg(client, "550 File not found.\n");
	}
}
开发者ID:jadfeitrouni,项目名称:FTPVita,代码行数:32,代码来源:ftp.c

示例15: printResult

void printResult(char *name, int durationMillis, float pspDurationMillis)
{
	char s[1000];
	sprintf(s, "%-25s: %5d ms (%5.0f%%) @ %d MHz\n", name, durationMillis, pspDurationMillis / durationMillis * 100, scePowerGetCpuClockFrequencyInt());
//	pspDebugScreenPrintf("%s", s);
	sceIoWrite(logFd, s, strlen(s));
}
开发者ID:psce4all,项目名称:pspe4all-psptests,代码行数:7,代码来源:main.c


注:本文中的sceIoWrite函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。