Beispiel #1
0
void quest_override(u32 mod_number) {
    u32 *result;

    if(mod_number == QUEST_START_MARKER) {
        kprintf("quest started\n");
        quest_started = 1;
        loaded_mib = 0;
    }
    if(quest_started == 1) {
        if(mod_number >= 2820 && mod_number <= 3972) {
            kprintf("detected quest: %i\n", mod_number);
            loaded_mib = mod_number;
        }
        if(mod_number > 5000) {
            if(loaded_mib == 0) {
                kprintf("no quest has been loaded, starting mib analysis\n");
                result = search_exact(get_address_id((u8 *)MIB_ADDR, MIB_ID_SIZE), mib_table, mib_elems);
                if(result) {
                    loaded_mib = get_quest_number(result);
                    kprintf("mib number found: %i\n", loaded_mib);
                } else {
                    kprintf("unknown mib file, skipping\n");
                }
            }
            quest_started = 2;
        }
    }
    if(mod_number == QUEST_END_MARKER) {
        kprintf("quest finished\n");
        quest_started = 0;
        loaded_mib = 0;
    }
}
Beispiel #2
0
static alpm_list_t *resolve_targets(alpm_list_t *dblist, alpm_list_t *targets)
{
  if(targets == NULL) {
    return all_packages(dblist);
  }

  if(opt_what == SEARCH_REGEX) {
    return search_packages(dblist, targets);
  }

  if(opt_what == SEARCH_GROUPS) {
    return search_groups(dblist, targets);
  }

  return search_exact(dblist, targets);
}
Beispiel #3
0
int _diva_read(SceUID fd, void *data, SceSize size, int async) {
    u32 file_offset;
    cpknode *file_index;
    SceUID modfd;
    int res;
    u32 k1;

    if (fd == datafd) {
        // get the current file pointer
        file_offset = (u32)sceIoLseek(fd, 0, PSP_SEEK_CUR);
        // and find if the file part that the game is trying to read is in our list
        // of files to replace
        file_index = search_exact(file_offset, cpk_table, cpk_count);
        if(file_index != NULL) {
            kprintf("index found: %08X\n", *(u32 *)file_index);
            k1 = pspSdkSetK1(0);
            modfd = open_file(image_filenames + file_index->filename_offset);
            if(modfd >= 0) {
                kprintf("reading offset %08X, size: %08X\n", file_offset, size);
                // read our modified file instead, fooling the game
                res = async ? sceIoReadAsync(modfd, data, size) : sceIoRead(modfd, data, size);
                kprintf("read returned %08X\n", res);
                // make sure to return the read bytes that the game is expecting
                if(!async) {
                    res = (int)size;
                    sceIoClose(modfd);
                } else {
                    wait_size = size;
                    wait_fd = modfd;
                }
                // and advance the file pointer so we fully simulated that the read from the
                // cpk has been done
                sceIoLseek(fd, size, PSP_SEEK_CUR);
                pspSdkSetK1(k1);
                return res;
            }
            pspSdkSetK1(k1);
        }
    }
    kprintf("reading %i bytes from fd: %08X, offset: %08X, async: %i\n", size, fd, (u32)sceIoLseek(fd, 0, PSP_SEEK_CUR), async);
    return async ? sceIoReadAsync(fd, data, size) : sceIoRead(fd, data, size);
}