Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "plugin.h"
- #include "gob.h"
- void *util_alloc(size_t sz);
- enum plugin_status plugin_start(const void* parameter)
- {
- /*TODO this is a temporary warning suppressor for parameter, which is not yet used*/
- (void)parameter;
- #ifdef HAVE_ADJUSTABLE_CPU_FREQ
- rb->cpu_boost(true);
- #endif
- /*read in the gob files indexes to one big index*/
- int dark_file = rb->open("/.rockbox/dark/DARK.GOB", O_RDONLY);
- int sprites_file = rb->open("/.rockbox/dark/SPRITES.GOB", O_RDONLY);
- int tex_file = rb->open("/.rockbox/dark/TEXTURES.GOB", O_RDONLY);
- int sound_file = rb->open("/.rockbox/dark/SOUNDS.GOB", O_RDONLY);
- struct gob_header current_header;
- uint32_t current_mastern, total_mastern = 0, ofs_mastern;
- /*get the total number of ix entries*/
- rb->read(dark_file, ¤t_header, sizeof(struct gob_header));
- rb->lseek(dark_file, current_header.MASTERX, SEEK_SET);
- rb->read(dark_file, ¤t_mastern, sizeof(uint32_t));
- total_mastern += current_mastern;
- rb->read(sprites_file, ¤t_header, sizeof(struct gob_header));
- rb->lseek(sprites_file, current_header.MASTERX, SEEK_SET);
- rb->read(sprites_file, ¤t_mastern, sizeof(uint32_t));
- total_mastern += current_mastern;
- rb->read(tex_file, ¤t_header, sizeof(struct gob_header));
- rb->lseek(tex_file, current_header.MASTERX, SEEK_SET);
- rb->read(tex_file, ¤t_mastern, sizeof(uint32_t));
- total_mastern += current_mastern;
- rb->read(sound_file, ¤t_header, sizeof(struct gob_header));
- rb->lseek(sound_file, current_header.MASTERX, SEEK_SET);
- rb->read(sound_file, ¤t_mastern, sizeof(uint32_t));
- total_mastern += current_mastern;
- /*allocate the idx struct array*/
- struct gob_idx_entry* idx = util_alloc(sizeof(struct gob_idx_entry) * total_mastern);
- /*and then read the idx portion of the files into the idx struct array*/
- rb->read(dark_file, ¤t_header, sizeof(struct gob_header));
- rb->lseek(dark_file, current_header.MASTERX, SEEK_SET);
- rb->read(dark_file, ¤t_mastern, sizeof(uint32_t));
- rb->read(dark_file, &idx[0], sizeof(struct gob_idx_entry) * current_mastern);
- ofs_mastern = current_mastern;
- rb->read(sprites_file, ¤t_header, sizeof(struct gob_header));
- rb->lseek(sprites_file, current_header.MASTERX, SEEK_SET);
- rb->read(sprites_file, ¤t_mastern, sizeof(uint32_t));
- rb->read(dark_file, &idx[ofs_mastern], sizeof(struct gob_idx_entry) * current_mastern);
- ofs_mastern = current_mastern;
- rb->read(sprites_file, ¤t_header, sizeof(struct gob_header));
- rb->lseek(sprites_file, current_header.MASTERX, SEEK_SET);
- rb->read(sprites_file, ¤t_mastern, sizeof(uint32_t));
- rb->read(dark_file, &idx[ofs_mastern], sizeof(struct gob_idx_entry) * current_mastern);
- ofs_mastern = current_mastern;
- rb->read(sprites_file, ¤t_header, sizeof(struct gob_header));
- rb->lseek(sprites_file, current_header.MASTERX, SEEK_SET);
- rb->read(sprites_file, ¤t_mastern, sizeof(uint32_t));
- rb->read(dark_file, &idx[ofs_mastern], sizeof(struct gob_idx_entry) * current_mastern);
- rb->close(dark_file);
- return PLUGIN_OK;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement