static bool glue_mapper_init(GError **error_r) { GError *error = NULL; char *music_dir = config_dup_path(CONF_MUSIC_DIR, &error); if (music_dir == NULL && error != NULL) { g_propagate_error(error_r, error); return false; } char *playlist_dir = config_dup_path(CONF_PLAYLIST_DIR, &error); if (playlist_dir == NULL && error != NULL) { g_propagate_error(error_r, error); return false; } #if GLIB_CHECK_VERSION(2,14,0) if (music_dir == NULL) music_dir = g_strdup(g_get_user_special_dir(G_USER_DIRECTORY_MUSIC)); #endif mapper_init(music_dir, playlist_dir); g_free(music_dir); g_free(playlist_dir); return true; }
void emulator_init(int width, int height, void *user) { LOG_INIT(); video_init(width, height, user); mapper_init(); emulator_last_tick = 0; }
int main(int argc, char **argv) { MapOptions opt; int i; SeedTable *seed_tab; ChrTable *chr_tab; Mapper *mapper; gzFile *out_files, reads_f, multi_out_file, unmapped_out_file, out_file; parse_map_options(&opt, argc, argv); write_map_options(stderr, &opt); chr_tab = chr_table_read(opt.chrom_info_file); reads_f = util_must_gzopen(opt.reads_file, "rb"); if(opt.output_type == OUTPUT_TYPE_MULTI) { out_files = open_multi_out_files(opt.output_dir, chr_tab, &unmapped_out_file, &multi_out_file); } else if(opt.output_type == OUTPUT_TYPE_SINGLE) { out_file = open_single_out_file(opt.output_dir, opt.reads_file); out_files = &out_file; unmapped_out_file = NULL; multi_out_file = NULL; } else { out_files = NULL; multi_out_file = unmapped_out_file = NULL; my_err("%s:%d: unknown output type\n", __FILE__, __LINE__); } fprintf(stderr, "reading seed index\n"); seed_tab = seed_table_read(opt.seed_index_file); mapper = mapper_init(seed_tab, chr_tab, opt.fasta_files, opt.n_fasta_files, opt.read_len, opt.n_mismatch); fprintf(stderr, "mapping reads\n"); map_reads(out_files, multi_out_file, unmapped_out_file, reads_f, mapper, opt.reads_format, opt.output_type); if(opt.output_type == OUTPUT_TYPE_MULTI) { for(i = 0; i < chr_tab->n_chr; i++) { gzclose(out_files[i]); } gzclose(multi_out_file); gzclose(unmapped_out_file); } else { gzclose(out_files[0]); } gzclose(reads_f); seed_table_free(seed_tab); chr_table_free(chr_tab); mapper_free(mapper); return 0; }
static void genie_write(u32 addr,u8 data) { if(addr >= 0x8000) { switch(addr) { case 0x8000: if((data & 1) == 0) { //unmap the write function mem_setwritefunc(8,0); //we not using genie anymore reg &= 0x7F; //save old read func readcpu = cpu_getreadfunc(); //setup new read function cpu_setreadfunc(genie_read_cheat); //restore the old mapper nes->mapper = mapper_init(nes->cart->mapperid); //reset the mapper nes->mapper->reset(1); } else { reg = 0x80 | (data & 0x7E); log_printf("genie_write: reg = $%02X (data = $%02X)\n",reg,data); log_printf(" code 0: %s, %s\n",(reg & 0x10) ? "disabled" : "enabled",(reg & 2) ? "compare" : "no compare"); log_printf(" code 1: %s, %s\n",(reg & 0x20) ? "disabled" : "enabled",(reg & 4) ? "compare" : "no compare"); log_printf(" code 2: %s, %s\n",(reg & 0x40) ? "disabled" : "enabled",(reg & 8) ? "compare" : "no compare"); } break; case 0x8001: code[0].addr = (code[0].addr & 0x00FF) | (data << 8); break; case 0x8002: code[0].addr = (code[0].addr & 0xFF00) | (data << 0); break; case 0x8003: code[0].compare = data; break; case 0x8004: code[0].data = data; break; case 0x8005: code[1].addr = (code[1].addr & 0x00FF) | (data << 8); break; case 0x8006: code[1].addr = (code[1].addr & 0xFF00) | (data << 0); break; case 0x8007: code[1].compare = data; break; case 0x8008: code[1].data = data; break; case 0x8009: code[2].addr = (code[2].addr & 0x00FF) | (data << 8); break; case 0x800A: code[2].addr = (code[2].addr & 0xFF00) | (data << 0); break; case 0x800B: code[2].compare = data; break; case 0x800C: code[2].data = data; break; } log_printf("genie write: $%04X = $%02X\n",addr,data); } }
static void glue_mapper_init(void) { const char *music_dir, *playlist_dir; music_dir = config_get_path(CONF_MUSIC_DIR); #if GLIB_CHECK_VERSION(2,14,0) if (music_dir == NULL) music_dir = g_get_user_special_dir(G_USER_DIRECTORY_MUSIC); #endif playlist_dir = config_get_path(CONF_PLAYLIST_DIR); mapper_init(music_dir, playlist_dir); }