示例#1
0
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;
}
示例#2
0
文件: bookmark.c 项目: azuwis/xreader
static void cache_invalidate_hack(void)
{
	int fd;
	int t[20];
	char conffile[PATH_MAX];

	SPRINTF_S(conffile, "%s%s%d%s", scene_appdir(), "config", 0, ".ini");

	fd = xrIoOpen(conffile, PSP_O_RDONLY, 0777);

	if (fd >= 0) {
		xrIoRead(fd, t, sizeof(t));
		xrIoClose(fd);
	}
}
示例#3
0
bool load_passwords(void)
{
    SceUID fd;
    char linebuf[LINEBUF], path[PATH_MAX];
    rc4_key *pkey;

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

    if (is_encrypted(path)) {
        rc4_prepare_key((u8 *) CRYPT_KEY, sizeof(CRYPT_KEY) - 1, &g_key);
        pkey = &g_key;
    } else {
        pkey = NULL;
    }

    fd = sceIoOpen(path, PSP_O_RDONLY, 0);

    if (fd < 0) {
        return false;
    }

    if (pkey != NULL) {
        sceIoLseek(fd, 4, PSP_SEEK_SET);
    }

    linebuf[sizeof(linebuf) - 1] = '\0';

    while (read_lines(fd, linebuf, sizeof(linebuf) - 1, pkey) >= 0) {
        add_password(linebuf);
    }

    sceIoClose(fd);

    return true;
}
示例#4
0
文件: conf.c 项目: azuwis/xreader
static void conf_default(p_conf conf)
{
	memset(conf, 0, sizeof(t_conf));
	STRCPY_S(conf->path, "ms0:/");
	STRCPY_S(conf->shortpath, "ms0:/");
	STRCPY_S(conf->lastfile, "");
	STRCPY_S(conf->bgarch, "");
	STRCPY_S(conf->bgfile, scene_appdir());
	STRCAT_S(conf->bgfile, "bg.png");
	conf->bgwhere = scene_in_zip;
	conf->confver = XREADER_VERSION_NUM;
	conf->forecolor = 0xFFFFFFFF;
	conf->giftranscolor = 0xFFFFFFFF;
	conf->bgcolor = 0;
	conf->have_bg = true;
	conf->rowspace = 2;
	conf->wordspace = 0;
	conf->borderspace = 0;
	conf->vertread = 0;
	conf->infobar = conf_infobar_info;
	conf->infobar_style = 0;
	conf->rlastrow = false;
	conf->autobm = true;
	conf->encode = conf_encode_gbk;
	conf->fit = conf_fit_none;
	conf->imginfobar = false;
	conf->scrollbar = false;
	conf->scale = 0;
	conf->rotate = conf_rotate_0;
	conf->enable_analog = true;
	conf->img_enable_analog = true;
	conf->txtkey[0] = PSP_CTRL_SQUARE;
	conf->txtkey[1] = PSP_CTRL_LTRIGGER;
	conf->txtkey[2] = PSP_CTRL_RTRIGGER;
	conf->txtkey[3] = PSP_CTRL_UP | PSP_CTRL_CIRCLE;
	conf->txtkey[4] = PSP_CTRL_DOWN | PSP_CTRL_CIRCLE;
	conf->txtkey[5] = PSP_CTRL_LEFT | PSP_CTRL_CIRCLE;
	conf->txtkey[6] = PSP_CTRL_RIGHT | PSP_CTRL_CIRCLE;
	conf->txtkey[7] = PSP_CTRL_LTRIGGER | PSP_CTRL_CIRCLE;
	conf->txtkey[8] = PSP_CTRL_RTRIGGER | PSP_CTRL_CIRCLE;
	conf->txtkey[9] = 0;
	conf->txtkey[10] = 0;
	conf->txtkey[11] = PSP_CTRL_CROSS;
	conf->txtkey[12] = PSP_CTRL_TRIANGLE;
	conf->imgkey[0] = PSP_CTRL_LTRIGGER;
	conf->imgkey[1] = PSP_CTRL_RTRIGGER;
	conf->imgkey[2] = PSP_CTRL_TRIANGLE;
	conf->imgkey[3] = PSP_CTRL_UP | PSP_CTRL_CIRCLE;
	conf->imgkey[4] = PSP_CTRL_DOWN | PSP_CTRL_CIRCLE;
	conf->imgkey[5] = PSP_CTRL_LEFT | PSP_CTRL_CIRCLE;
	conf->imgkey[6] = PSP_CTRL_RIGHT | PSP_CTRL_CIRCLE;
	conf->imgkey[7] = PSP_CTRL_SQUARE;
	conf->imgkey[8] = PSP_CTRL_CIRCLE;
	conf->imgkey[9] = PSP_CTRL_CROSS;
	conf->imgkey[10] = PSP_CTRL_LTRIGGER | PSP_CTRL_CIRCLE;
	conf->imgkey[11] = 0;
	conf->imgkey[12] = PSP_CTRL_UP;
	conf->imgkey[13] = PSP_CTRL_DOWN;
	conf->imgkey[14] = PSP_CTRL_LEFT;
	conf->imgkey[15] = PSP_CTRL_RIGHT;
	conf->flkey[0] = PSP_CTRL_CIRCLE;
	conf->flkey[1] = PSP_CTRL_LTRIGGER;
	conf->flkey[2] = PSP_CTRL_RTRIGGER;
	conf->flkey[3] = PSP_CTRL_CROSS;
	conf->flkey[4] = 0;
	conf->flkey[5] = PSP_CTRL_TRIANGLE;
	conf->flkey[6] = PSP_CTRL_SQUARE;
	conf->flkey[7] = PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER;
	conf->bicubic = false;
	conf->mp3encode = conf_encode_gbk;
	conf->lyricencode = conf_encode_gbk;
	conf->mp3cycle = conf_cycle_repeat;
	conf->isreading = false;
	conf->slideinterval = 5;
	conf->hprmctrl = false;
	conf->grayscale = 30;
	conf->showhidden = true;
	conf->showunknown = true;
	conf->showfinfo = true;
	conf->allowdelete = true;
	conf->arrange = conf_arrange_name;
	conf->enableusb = false;
	conf->viewpos = conf_viewpos_leftup;
	conf->imgmvspd = 8;
	conf->imgpaging = conf_imgpaging_direct;
	conf->imgpaging_spd = 8;
	conf->imgpaging_interval = 10;
	conf->imgpaging_duration = 10;
	conf->fontsize = 12;
	conf->bookfontsize = 12;
	conf->reordertxt = false;
	conf->pagetonext = false;
	conf->autopage = 0;
	conf->autopagetype = 2;
	conf->autolinedelay = 0;
	conf->thumb = conf_thumb_scroll;
	conf->imgpagereserve = 0;
#if defined(ENABLE_MUSIC) && defined(ENABLE_LYRIC)
	conf->lyricex = 1;
#else
	conf->lyricex = 0;
#endif
	conf->autoplay = false;
	conf->usettf = 0;
	conf->freqs[0] = 1;
	conf->freqs[1] = 5;
	conf->freqs[2] = 8;
	conf->imgbrightness = 100;
	conf->dis_scrsave = false;
	conf->autosleep = 0;
	conf->load_exif = true;
	conf->prev_autopage = 2;
	conf->launchtype = 2;

	/*
	   conf->titlecolor = RGB(0x80, 0x10, 0x10);
	   conf->menutextcolor = RGB(0xDF, 0xDF, 0xDF);
	   conf->menubcolor  = RGB(0x40, 0x10, 0x10);
	   conf->selicolor = RGB(0xFF, 0xFF, 0x40);
	   conf->selbcolor = RGB(0x20, 0x20, 0xDF);
	   conf->msgbcolor = RGB(0x18, 0x28, 0x50);
	 */

	conf->titlecolor = RGB(0x30, 0x60, 0x30);
	conf->menutextcolor = RGB(0xDF, 0xDF, 0xDF);
	conf->menubcolor = RGB(0x10, 0x30, 0x20);
	conf->selicolor = RGB(0xFF, 0xFF, 0x40);
	conf->selbcolor = RGB(0x20, 0x20, 0xDF);
	conf->msgbcolor = RGB(0x18, 0x28, 0x50);
	conf->usedyncolor = false;

	STRCPY_S(conf->cttfpath, scene_appdir());
	STRCAT_S(conf->cttfpath, "fonts/gbk.ttf");
	STRCPY_S(conf->ettfpath, scene_appdir());
	STRCAT_S(conf->ettfpath, "fonts/asc.ttf");

	conf->infobar_use_ttf_mode = true;
	conf->img_no_repeat = false;
	conf->hide_flash = true;
	conf->tabstop = 4;
	conf->apetagorder = true;
	STRCPY_S(conf->language, "zh_CN");
	conf->filelistwidth = 160;
	if (kuKernelGetModel() == PSP_MODEL_STANDARD) {
		conf->ttf_load_to_memory = false;
	} else {
		conf->ttf_load_to_memory = true;
	}
	conf->save_password = true;
	conf->scrollbar_width = 5;
	conf->hide_last_row = false;
	conf->infobar_show_timer = true;
	conf->infobar_fontsize = 12;
	conf->englishtruncate = true;
	conf->image_scroll_chgn_speed = true;
	conf->ttf_haste_up = true;
	conf->linenum_style = false;
	conf->infobar_align = conf_align_left;
	conf->show_encoder_msg = false;
	SPRINTF_S(conf->musicdrv_opts,
			  "mp3_brute_mode=off mp3_use_me=on mp3_check_crc=off mp3_buffer_size=%d "
			  "wma_buffer_size=%d aac_buffer_size=%d wav_buffer_size=%d wv_buffer_size=%d "
			  "aa3_buffer_size=%d at3_buffer_size=%d m4a_buffer_size=%d "
			  "flac_buffer_size=%d",
			  BUFFERED_READER_BUFFER_SIZE, BUFFERED_READER_BUFFER_SIZE,
			  BUFFERED_READER_BUFFER_SIZE, BUFFERED_READER_BUFFER_SIZE,
			  WVPACK_BUFFERED_READER_BUFFER_SIZE, BUFFERED_READER_BUFFER_SIZE,
			  BUFFERED_READER_BUFFER_SIZE, BUFFERED_READER_BUFFER_SIZE,
			  BUFFERED_READER_BUFFER_SIZE);
	conf->magnetic_scrolling = true;
	conf->use_image_queue = true;
	conf->max_cache_img = 10;
}