void new_video_window(char *filename) { #ifndef IPOD pz_error("No video support on the desktop."); #else /* IPOD */ if (full_hw_version==0) { full_hw_version = ipod_get_hw_version(); } outl(1, VAR_VIDEO_ON); outl(0, VAR_VIDEO_MODE); cop_wakeup(); init_variables(); video_status = VIDEO_CONTROL_MODE_STARTING; video_curPosition = 0; video_gc = pz_get_gc(1); GrSetGCUseBackground(video_gc, GR_FALSE); GrSetGCForeground(video_gc, GR_RGB(0,0,0)); //nes_window("Create win"); video_wid = pz_new_window(0, 0, screen_info.cols, screen_info.rows, video_do_draw, video_do_keystroke); GrSelectEvents(video_wid, GR_EVENT_MASK_KEY_DOWN| GR_EVENT_MASK_KEY_UP); GrMapWindow(video_wid); GrClearWindow(video_wid, GR_FALSE); //nes_window("Load"); video_status_message("Loading video..."); //nes_window("Play"); playVideo(filename); outl(0, VAR_VIDEO_ON); #endif }
static void populate_about() { int i; char kern[BUFSIZR], fstype[BUFSIZR]; char *gens[NUM_GENS] = {"", "1st Generation", "2nd Generation", "3rd Generation", "Mini", "4th Generation", "Photo", "2nd Gen Mini", "", "", "", "5th Generation", "Nano" }; #ifdef IPOD char fslist[BUFSIZR], fsmount[11]; #endif FILE *ptr; #if defined(__linux__) || defined(IPOD) if((ptr = popen("uname -rv", "r")) != NULL) { #else if((ptr = popen("uname -r", "r")) != NULL) { #endif while(fgets(kern, BUFSIZR, ptr)!=NULL); pclose(ptr); } #ifdef IPOD if((ptr = fopen("/proc/mounts", "r")) != NULL) { while(fgets(fslist, BUFSIZR, ptr)!=NULL) { sscanf(fslist, "%s%*s%s", fsmount, fstype); if(strcmp(fsmount, "/dev/root")==0) break; } if(strncmp(fstype, "hfs", 3)==0) sprintf(fstype, "Mac iPod."); else sprintf(fstype, "Win iPod."); fclose(ptr); } #else sprintf(fstype, "Not an iPod."); #endif i = hw_version; if (i > NUM_GENS || i < 0) i = 0; buf = malloc(sizeof(char) * (32 + strlen(PZ_VER) + strlen(kern) + strlen(fstype) + strlen(gens[i]))); sprintf(buf, "%s\n\n%s\n%s %s\n Rev. 0x%05lX", PZ_VER, kern, fstype, gens[i], ipod_get_hw_version()); } void about_podzilla() { populate_about(); new_stringview_window(buf, "About"); free(buf); buf = NULL; }
int __init ipod_ide_register(void) { hw_regs_t hw; ide_ioreg_t reg; ide_hwif_t *hwifp; int i; int hw_ver = ipod_get_hw_version() >> 16; if (hw_ver > 0x3) { /* PP5020 */ outl(inl(0xc3000028) | (1 << 5), 0xc3000028); outl(inl(0xc3000028) & ~0x10000000, 0xc3000028); outl(0x10, 0xc3000000); outl(0x80002150, 0xc3000004); } else { /* PP5002 */ outl(inl(0xc0003024) | (1 << 7), 0xc0003024); outl(inl(0xc0003024) & ~(1<<2), 0xc0003024); outl(0x10, 0xc0003000); outl(0x80002150, 0xc0003004); } memset(&hw, 0, sizeof(hw)); if (hw_ver > 0x3) { reg = PP5020_IDE_PRIMARY_BASE; } else { reg = PP5002_IDE_PRIMARY_BASE; } for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { hw.io_ports[i] = reg; reg += 4; /* our registers are on word boundaries */ } if (hw_ver > 0x3) { hw.io_ports[IDE_CONTROL_OFFSET] = PP5020_IDE_PRIMARY_CONTROL; hw.irq = PP5020_IDE_IRQ; } else { hw.io_ports[IDE_CONTROL_OFFSET] = PP5002_IDE_PRIMARY_CONTROL; hw.irq = PP5002_IDE_IRQ; } ide_register_hw(&hw, &hwifp); return 0; }