• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ sceIoClose函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: parseDiff

int parseDiff( const char * file, tSceModule * mod )
{
	int off = inCtf( file );
	if ( off < 0 )
	{
		log( "there's no patch for %s\n", file );
		return 0;
	}
	
	int ctf = sceIoOpen( cxmb_theme_file, PSP_O_RDONLY, 0644 );
	if ( ctf < 0 )
	{
		log( "no ctf file found!\n" );
		return -1;
	}
	sceIoLseek( ctf, ctf_header[off].start, PSP_SEEK_SET );
	
	log( "patch %s!\nstart: %08x\nsize: %08x\n", file, ctf_header[off].start, ctf_header[off].size );
	
	unsigned int attr[2];
	int i = 0;
	while( i < ctf_header[off].size )
	{
		sceIoRead( ctf, attr, 8 );
		sceIoRead( ctf, ( void * )( mod->text_addr + attr[0] ), attr[1] );
		i ++;
	}
	sceIoClose( ctf );
	
	sceKernelIcacheInvalidateAll();
	sceKernelDcacheWritebackInvalidateAll();
	
	log( "%s patched!\n", file );
	return 0;
}
开发者ID:ErikPshat,项目名称:cxmb,代码行数:35,代码来源:main.c


示例2: 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


示例3: retro_fclose

int retro_fclose(RFILE *stream)
{
   if (!stream)
      return -1;

#if defined(VITA) || defined(PSP)
   if (stream->fd > 0)
      sceIoClose(stream->fd);
#elif defined(__CELLOS_LV2__)
   if (stream->fd > 0)
      cellFsClose(stream->fd);
#else
#if defined(HAVE_BUFFERED_IO)
   if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
   {
      if (stream->fp)
         fclose(stream->fp);
   }
   else
#endif
#ifdef HAVE_MMAP
      if (stream->hints & RFILE_HINT_MMAP)
         munmap(stream->mapped, stream->mapsize);
#endif

      if (stream->fd > 0)
         close(stream->fd);
#endif
   free(stream);

   return 0;
}
开发者ID:Kivutar,项目名称:RetroArch,代码行数:32,代码来源:retro_file.c


示例4: fclose

/*
**
**  [func] - fclose.
**  [desc] - if stream is a valid FILE stream and able to close the stream file
**           then returns 0. else returns EOF.
**  [entr] - FILE *stream; the pointer to the FILE stream.
**  [exit] - int; 0 if able to close the stream file. else EOF.
**  [prec] - stream is a valid FILE pointer.
**  [post] - the stream file is closed.
**
*/
int fclose(FILE *stream)
{
  int ret;

  /* test the file stream type. */
  switch(LOCAL_FILE(stream)->type) {
    case STD_IOBUF_TYPE_NONE:
    case STD_IOBUF_TYPE_GE:
    case STD_IOBUF_TYPE_STDOUTHOST:
      /* cannot close stdin, stdout, or stderr. */
      // duh.. this is wrong. One SHOULD be able to close
      // std*. That's a common unix doing. However, I doubt
      // allowing this madness could be a good idea.
      ret = EOF;
      break;
    default:
      if ((LOCAL_FILE(stream)->fd >= 0) && (sceIoClose(LOCAL_FILE(stream)->fd) >= 0)) {
        LOCAL_FILE(stream)->type = STD_IOBUF_TYPE_NONE;
        LOCAL_FILE(stream)->fd = -1;
        LOCAL_FILE(stream)->cnt = 0;
        LOCAL_FILE(stream)->flag = 0;
        ret = 0;
      }
      else ret = EOF;
  }
  return (ret);
}
开发者ID:CDragu,项目名称:pspsdk,代码行数:38,代码来源:stdio.c


示例5: pspgl_ge_writefile

static
void pspgl_ge_writefile (void *buf, unsigned long len)
{
	int fd = sceIoOpen(PSPGL_GE_DUMPFILE, PSP_O_CREAT | PSP_O_APPEND | PSP_O_WRONLY, 0644);
	sceIoWrite(fd, buf, len);
	sceIoClose(fd);
}
开发者ID:artart78,项目名称:psp-ports,代码行数:7,代码来源:pspgl_misc.c


示例6: sceIoOpen

frame_t *frame_factory_from_cfg_file(const char *cfg_file)
{
    SceUID fd = -1;
    frame_cfg_t *cfg = NULL;
    frame_t *ret = NULL;

    fd = sceIoOpen(cfg_file, PSP_O_RDONLY, 0777);
    if (fd < 0) {
        printf("can't open cfg file!\n");
        goto cleanup;
    }
    cfg = frame_factory_read_cfg(fd);
    if (cfg == NULL) {
        printf("read cfg failed!\n");
        goto cleanup;
    }
    ret = frame_factory_from_cfg(cfg);
cleanup:
    if (fd >= 0) {
        sceIoClose(fd);
    }
    if (cfg != NULL) {
        free(cfg);
    }
    return ret;
}
开发者ID:mariodon,项目名称:psp-taikoclone,代码行数:26,代码来源:frame_factory.c


示例7: 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


示例8: load_quest_index

int load_quest_index() {
    mib_table = NULL;
    mib_elems = 0;
    k1 = pspSdkSetK1(0);
    model_go = sceKernelGetModel() == 4 ? 1 : 0;
    strcpy(filename, "xxx:/mhp3rd/quest/mib_id.dat");
    SET_DEVICENAME(filename, model_go);
    kprintf("trying to open %s\n", filename);
    SceUID fd = sceIoOpen(filename, PSP_O_RDONLY, 0777);
    if(fd < 0) {
        kprintf("Cannot find mib_id.dat\n");
        pspSdkSetK1(k1);
        return fd;
    }
    SceSize size = (SceSize)sceIoLseek(fd, 0, PSP_SEEK_END);
    sceIoLseek(fd, 0, PSP_SEEK_SET);
    index_id = sceKernelAllocPartitionMemory(PSP_MEMORY_PARTITION_KERNEL, "mhp3mib", PSP_SMEM_High, size, NULL);
    if(index_id >= 0) {
        mib_table = sceKernelGetBlockHeadAddr(index_id);
        sceIoRead(fd, mib_table, size);
        mib_elems = size / (sizeof(u32) * 2);
        quest_number = mib_table + mib_elems;
        kprintf("index size: %i bytes, entries: %i\n", size, index_elems);
    } else {
        kprintf("failed to allocate memory for table\n");
    }
    sceIoClose(fd);
    pspSdkSetK1(k1);
    return 0;
}
开发者ID:Rolen47,项目名称:prxpatch,代码行数:30,代码来源:loader.c


示例9: diva_poll

int diva_poll(SceUID fd, SceInt64 *res) {
    int ret;
    u32 k1;

    if(wait_fd >= 0 && fd == datafd) {
        kprintf("polling for fd: %08X\n", wait_fd);
        k1 = pspSdkSetK1(0);
        ret = sceIoPollAsync(wait_fd, res);
        if(ret <= 0) {
            if(ret == 0) {
                kprintf("Async read completed: %i bytes\n", (u32)*res);
                *res = wait_size;
            } else {
                kprintf("polling error: %08X\n", ret);
            }
            sceIoClose(wait_fd);
            wait_fd = -1;
        } else {
            kprintf("poll result: %08X\n", ret);
        }
        pspSdkSetK1(k1);
        return ret;
    }
    return sceIoPollAsync(fd, res);
}
开发者ID:Rolen47,项目名称:prxpatch,代码行数:25,代码来源:reader.c


示例10: is_encrypted

static int is_encrypted(const char *path)
{
    SceUID fd = -1;
    u32 magic;
    u32 result = 0;

    fd = sceIoOpen(path, PSP_O_RDONLY, 0);

    if (fd < 0) {
        goto exit;
    }

    if (sizeof(magic) != sceIoRead(fd, &magic, sizeof(magic))) {
        goto exit;
    }

    if (CRYPT_MAGIC == magic) {
        result = 1;
    }

exit:
    if (fd >= 0) {
        sceIoClose(fd);
        fd = -1;
    }

    return result;
}
开发者ID:DreamingPiggy,项目名称:xreader-hg,代码行数:28,代码来源:passwdmgr.c


示例11: save_passwords

bool save_passwords(void)
{
    password *pwd;
    SceUID fd;
    char path[PATH_MAX];
    u32 magic;

    STRCPY_S(path, scene_appdir());
    STRCAT_S(path, "password.lst");

    rc4_prepare_key((u8 *) CRYPT_KEY, sizeof(CRYPT_KEY) - 1, &g_key);

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

    if (fd < 0) {
        return false;
    }

    magic = CRYPT_MAGIC;
    sceIoWrite(fd, &magic, sizeof(magic));

    for (pwd = g_pwd_head.next; pwd != NULL; pwd = pwd->next) {
        write_chars(fd, pwd->b->ptr, strlen(pwd->b->ptr));
        write_chars(fd, "\r\n", sizeof("\r\n") - 1);
    }

    sceIoClose(fd);

    return true;
}
开发者ID:DreamingPiggy,项目名称:xreader-hg,代码行数:30,代码来源:passwdmgr.c


示例12: locate_umd_img1

int locate_umd_img1(const char *umdfile, size_t file_offset, SceUID * pfd)
{
	int ret = -1;
	char buf[9] = { 0 };
	size_t stread = 0;

	if (!umdfile || !pfd || file_offset < 0)
		return -1;
	*pfd = -1;
	do {
		struct UMDHeaderDataEx *pEx;

		if ((*pfd = sceIoOpen(umdfile, PSP_O_RDONLY, 0777)) < 0) {
			return -2;
		}
		if (0 < sceIoLseek(*pfd, file_offset, SEEK_SET))
			return -3;
		if ((stread = sceIoRead(*pfd, buf, 9)) < 0) {
			dbg_printf(d, "%s read umd file head chunk error!", __func__);
			break;
		}

		pEx = (struct UMDHeaderDataEx *) &buf;

		if (!pEx || pEx->Mark != '$' || pEx->Length < 9)
			break;
		return pEx->Length - 9;
	} while (false);
	if (*pfd) {
		sceIoClose(*pfd);
		*pfd = -1;
	}
	return ret;
}
开发者ID:DreamingPiggy,项目名称:xreader-hg,代码行数:34,代码来源:unumd.c


示例13: MP3SleepCheck

static int MP3SleepCheck(void)
{
	if (Sleep)
	{
		if (mp3_fd >= 0) sceIoClose(mp3_fd);

		mp3_sleep = 1;

		do
		{
			sceKernelDelayThread(5000000);
		} while (Sleep);

		mp3_sleep = 0;

		if ((mp3_fd = sceIoOpen(MP3_file, PSP_O_RDONLY, 0777)) < 0)
		{
			mp3_fd = -1;
			mp3_status = MP3_STOP;
			ui_popup(TEXT(COULD_NOT_REOPEN_MP3_FILEx), strrchr(MP3_file, '/') + 1);
			return 1;
		}

		sceIoLseek(mp3_fd, mp3_filepos, PSP_SEEK_SET);
	}
	else if (mp3_status == MP3_STOP)
	{
		return 1;
	}

	return 0;
}
开发者ID:173210,项目名称:mvspsp,代码行数:32,代码来源:mp3.c


示例14: makeTestFile

int makeTestFile(const char *name) {
	SceUID fd = sceIoOpen(name, PSP_O_WRONLY | PSP_O_CREAT, 0777);
	if (fd < 0) {
		return fd;
	}
	return sceIoClose(fd);
}
开发者ID:JulianoAmaralChaves,项目名称:pspautotests,代码行数:7,代码来源:rename.c


示例15: filestream_close

int filestream_close(RFILE *stream)
{
   if (!stream)
      goto error;

   if (stream->ext)
      free(stream->ext);

#if  defined(PSP)
   if (stream->fd > 0)
      sceIoClose(stream->fd);
#else
#if defined(HAVE_BUFFERED_IO)
   if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
   {
      if (stream->fp)
         fclose(stream->fp);
   }
   else
#endif
#ifdef HAVE_MMAP
      if (stream->hints & RFILE_HINT_MMAP)
         munmap(stream->mapped, stream->mapsize);
#endif

   if (stream->fd > 0)
      close(stream->fd);
#endif
   free(stream);

   return 0;

error:
   return -1;
}
开发者ID:Alcaro,项目名称:RetroArch,代码行数:35,代码来源:file_stream.c


示例16: sceIoOpen

pgeObj *pgeObjLoad(const char *filename)
{	
	int fd = sceIoOpen(filename, PSP_O_RDONLY, 0777);
	
	if(fd < 0)
		return NULL;

	long filesize;
	
	filesize = sceIoLseek32(fd, 0, PSP_SEEK_END);
	sceIoLseek32(fd, 0, PSP_SEEK_SET);
	
	unsigned char *data = pgeMalloc(filesize);
	
	if(!data)
		return NULL;
	
	sceIoRead(fd, data, filesize);
	
	sceIoClose(fd);
	
	pgeObj *obj = pgeObjLoadInternal(data, filesize);
	
	if(data)
		pgeFree(data);
	
	return obj;
}
开发者ID:EgorTF,项目名称:Minecraft-PSP-beta,代码行数:28,代码来源:pgeObj.c


示例17: uvl_load_file

/********************************************//**
 *  \brief Loads file to memory
 *  
 *  \returns Zero on success, otherwise error
 ***********************************************/
int
uvl_load_file (const char *filename,    ///< File to load
                     void **data,       ///< Output pointer to data
                  PsvSSize *size)       ///< Output pointer to data size
{
    PsvUID fd;
    PsvUID memblock;
    char *base;
    PsvOff filesz;
    PsvOff nread;
    PsvSSize nbytes;

    fd = sceIoOpen (filename, PSP2_O_RDONLY, 0);
    if (fd < 0)
    {
        LOG ("Failed to open %s for reading.", filename);
        return -1;
    }
    filesz = sceIoLseek (fd, 0LL, PSP2_SEEK_END);
    if (filesz < 0)
    {
        LOG ("Failed to find file size: 0x%X", filesz);
        return -1;
    }
    sceIoLseek (fd, 0LL, PSP2_SEEK_SET);
    memblock = sceKernelAllocMemBlock ("UVLTemp", 0xC20D060, (filesz + 0xFFF) & ~0xFFF, NULL);
    if (memblock < 0)
    {
        LOG ("Failed allocate %u bytes of memory.", memblock);
        return -1;
    }
    if (sceKernelGetMemBlockBase (memblock, &base) < 0)
    {
        LOG ("Failed to locate base for block 0x%08X.", memblock);
        return -1;
    }
    base = (char *)(((u32_t)base + 0xFFF) & ~0xFFF); // align memory base
    nbytes = 0;
    while ((nread = sceIoRead (fd, base+nbytes, filesz)) < filesz-nbytes)
    {
        nbytes += nread;
    }
    if (nbytes < 0)
    {
        LOG ("Failed to read %s: 0x%08X", filename, nbytes);
        return -1;
    }
    IF_DEBUG LOG ("Read %u bytes from %s", nbytes, filename);
    if (sceIoClose (fd) < 0)
    {
        LOG ("Failed to close file.");
        return -1;
    }

    *data = base;
    *size = nbytes;

    return 0;
}
开发者ID:TheOfficialFloW,项目名称:UVLoader,代码行数:64,代码来源:load.c


示例18: __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


示例19: fileGetSize

int fileGetSize(char *filein) {
	SceUID fd = sceIoOpen(filein, PSP_O_RDONLY, 0777);
	if (fd < 0)	return -1;
	fsize = sceIoLseek(fd, 0, SEEK_END);
	sceIoLseek(fd, 0, SEEK_SET);
	sceIoClose(fd);
	return fsize;
}
开发者ID:DenielX,项目名称:psptools,代码行数:8,代码来源:file.c


示例20: releaseWaveData

void releaseWaveData(WAVDATA* p_wav)  // WAVE释放
{
	if (p_wav->fd==-1)
		free(p_wav->buffer);
	else
		sceIoClose(p_wav->fd);
	memset(p_wav, 0, sizeof(WAVDATA));
}
开发者ID:Leajian,项目名称:cspsp-nightly,代码行数:8,代码来源:JAudio3.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sceIoRead函数代码示例发布时间:2022-05-30
下一篇:
C++ sceGuFinish函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap