Exemplo n.º 1
0
void IndexCategories(Category *head[], const char *path, int location)
{
    SceIoDirent dir;
    SceUID fd;
    u64 mtime;
    char full_path[16];
    int match;

    sce_paf_private_strcpy(full_path, path);
    SET_DEVICENAME(full_path, location);

    if((fd = sceIoDopen(full_path)) < 0) {
        return;
    }

    kprintf("Indexing categories from %s, loc: %i\n", path, location);
    match = 0;
    sce_paf_private_memset(&dir, 0, sizeof(SceIoDirent));

    while(1) {
        if(sceIoDread(fd, &dir) <= 0) {
            kprintf("End of directory list\n");
            sceIoDclose(fd);
            break;
        }
        kprintf("checking [%s], length: %i\n", dir.d_name, sce_paf_private_strlen(dir.d_name));
        if (FIO_S_ISDIR(dir.d_stat.st_mode) && dir.d_name[0] != '.') {
            if(!config.prefix && !is_game_folder(full_path, dir.d_name)) {
                if(has_directories(full_path, dir.d_name) > 0) {
                    match = 1;
                }
            } else if(config.prefix && sce_paf_private_strncmp(dir.d_name, "CAT_", 4) == 0) {
                if(has_directories(full_path, dir.d_name) > 0) {
                    sce_paf_private_strcpy(dir.d_name, dir.d_name + 4);
                    match = 1;
                }
            }
            if(match) {
                match = 0;
                sceRtcGetTick((pspTime *) &dir.d_stat.st_mtime, &mtime);
                kprintf("Adding category: [%s]\n", dir.d_name);
                AddCategory(head, dir.d_name, mtime, location);
            }
        }
    }
}
Exemplo n.º 2
0
Arquivo: mode.c Projeto: kimus/gclite
/* Functions */
int CategorizeGamePatched(void *unk, int folder, int unk2) {
    int i;
    u32 *array = (u32 *) *(u32 *) ((*(u32 *) (text_addr_game + patches.struct_addr[patch_index])) + ((u32) folder << 2));
    char *title = (char *) array[68 / 4];
    kprintf("called\n");
    Category *p = GetNextCategory(folder_list, NULL, global_pos);

    for (i = patches.index[patch_index]; p; i++) {
        char *name = &p->name;
        kprintf("name: %s\n", name);
        int len = sce_paf_private_strlen(name);

        if (sce_paf_private_strncmp(name, title, len) == 0) {
            if (title[len] == '/') {
                return CategorizeGame(unk, i, unk2);
            }
        }

        p = GetNextCategory(folder_list, p, 0);
    }

    /* uncategorized */
    return CategorizeGame(unk, i - 1, unk2);
}