Esempio n. 1
0
short* bitmap_copy(const char* filename)
{
	bitmap_t* bmp = (bitmap_t*) bitmap_read(filename);
	short* buffer = (short*) buffer_create();
	bitmap_draw(bmp, buffer, 0, 0);
	free(bmp);
	return ((short*) buffer);
}
/* Opens the free map file and reads it from disk. */
void
free_map_open (void) 
{
  free_map_file = file_open (inode_open (FREE_MAP_SECTOR));
  if (free_map_file == NULL)
    PANIC ("can't open free map");
  if (!bitmap_read (free_map, free_map_file))
    PANIC ("can't read free map");
}
Esempio n. 3
0
static void load_bitmaps(void)
{
	int i;
	for(i = 22; i < NUM_TYPES; ++i)
	{
		char num[5], *path, *part, *full;
		sprintf(num, "%04d", i);

		path = input_path_concat("types/gal_");
		part = concat(path, num);
		full = concat(part, ".bmp");

		scene.typeImages[i] = bitmap_read(full);
		free(path); free(part); free(full);
	}
}
Esempio n. 4
0
/** 
 *  Load and extract a file *.spr into 'fonte' structure
 */
bool
bitmap_load (const char *fname, bitmap * fonte, Uint32 num_of_obj,
             Uint32 num_of_images)
{
  char *addr;
  char *file = load_file (fname);
  if (file == NULL)
    {
      return FALSE;
    }
  addr = bitmap_read (fonte, num_of_obj, num_of_images, file, num_of_images);
  if (addr == NULL)
    {
      free_memory (file);
      return FALSE;
    }
  free_memory (file);
  return TRUE;
}
Esempio n. 5
0
// Changes the directory
int	fs_cd(char * name) {
	int start_inode = current_ttyc()->pwd;
	
	int namenode = fs_indir(name, start_inode);
	if (namenode) {
		inode_read(namenode, &n);
		if(n.mode & EXT2_S_IFLNK)	{
			if (bitmap_read(bm_inodes, n.data_blocks[0] - 1))
				current_ttyc()->pwd = n.data_blocks[0];
			else {
				return ERR_NO_EXIST;
			}
			
		} else {
			current_ttyc()->pwd = namenode;
		}
		return 1;
	} else {
		return ERR_NO_EXIST;
	}
}
Esempio n. 6
0
uint8 SA1::bus_read(unsigned addr) {
  if((addr & 0x40fe00) == 0x002200) {  //$00-3f|80-bf:2200-23ff
    return mmio_read(addr);
  }

  if((addr & 0x408000) == 0x008000) {  //$00-3f|80-bf:8000-ffff
    return mmc_read(addr);
  }

  if((addr & 0xc00000) == 0xc00000) {  //$c0-ff:0000-ffff
    return mmc_read(addr);
  }

  if((addr & 0x40e000) == 0x006000) {  //$00-3f|80-bf:6000-7fff
    return mmc_sa1_read(addr);
  }

  if((addr & 0x40f800) == 0x000000) {  //$00-3f|80-bf:0000-07ff
    synchronize_cpu();
    return iram.read(addr & 2047);
  }

  if((addr & 0x40f800) == 0x003000) {  //$00-3f|80-bf:3000-37ff
    synchronize_cpu();
    return iram.read(addr & 2047);
  }

  if((addr & 0xf00000) == 0x400000) {  //$40-4f:0000-ffff
    synchronize_cpu();
    return bwram.read(addr & (bwram.size() - 1));
  }

  if((addr & 0xf00000) == 0x600000) {  //$60-6f:0000-ffff
    synchronize_cpu();
    return bitmap_read(addr & 0x0fffff);
  }
}