示例#1
0
bool Manager::sendResult(plter::Result *result) {
    if (getSector()!=NULL) {
        return getSector()->sendResult(result);
    }

    return false;
}
示例#2
0
bool Manager::sendCommand(plter::Command *cmd) {
    if (getSector()!=NULL) {
        return getSector()->sendCommand(cmd);
    } else {
        return false;
    }
}
void CompositeElevationData::addElevationData(ElevationData* data) {
//  ElevationData* d0 = _data[0];

  if ((data->getExtentWidth()  != _width) ||
      (data->getExtentHeight() != _height)) {
    ILogger::instance()->logError("Extents don't match.");
  }

//  Sector s = data->getSector();
//  Sector s2 = d0->getSector();

  if (!data->getSector().isEquals(getSector())) {
    ILogger::instance()->logError("Sectors don't match.");
  }

  _data.push_back(data);
  
  //Checking NoData
  for (int i = 0; i < _width; i++) {
    for (int j = 0; j < _height; j++) {
      double height = getElevationAt(i, j);
      if (ISNAN(height)) {
        _hasNoData = true;
        return;
      }
    }
  }
}
示例#4
0
int getFreeSector(){
	int i;
	for(i=0;i<_MAX_SECTORS;i++)
		if(!getSector(i))
			return i;
	return -1;
}
示例#5
0
int __getFileFreeSector(){
	int i;
	for(i=_FILETABLE_SECTOR_START;i<_MAX_SECTORS;i++)
		if(!getSector(i))
			return i;
	return -1;
}
示例#6
0
void printTable(int from, int to){
	int i;
	for(i=from;i<to;i++){
		int exists = getSector(i);
		printf("Sector %d: %s\n", i, exists ? "exists" : "does not exist");
	}
}	
示例#7
0
int main()
{
  int i = 0;
  struct partition *p;
  prints("booter start in main()\n");

  // initialize the dap struct
  dp = &dap;
  dp->len  = 0x10;        // must be 16
  dp->zero = 0;           // must be 0
  dp->nsector = 1;        // load one sector
  dp->addr = 0;           // will set to addr              
  dp->segment = BOOTSEG;  // load to which segment
  dp->s1 = 0;             // will set to LBA sector#
  dp->s2 = 0;             // high 4-byte address s2=0

  getSector((u32)0, (u16)mbr); // get MBR
//  ==========================================================
//  In the MBR, partition table begins at byte offset 0x1BE
  // DO #1:  WRITE C CODE TO PRINT THE PARTITIONS
//  ==========================================================
  color = CYAN;
//  while(1){
    prints("what's your name? \n");
    gets(ans);

//	prints(ans);
    if (strcmp(ans, "quit")==0){
      prints("\nexit main()\n");
    }
   printf("\nWelcome %s! %d\n", ans, ++i);
    //break;
   printf("let's start booter\n");
 // }
}
示例#8
0
文件: Tile.cpp 项目: AeroGlass/g3m
ElevationData* Tile::createElevationDataSubviewFromAncestor(Tile* ancestor) const{
  ElevationData* ed = ancestor->getElevationData();

  if (ed == NULL){
    ILogger::instance()->logError("Ancestor can't have undefined Elevation Data.");
    return NULL;
  }

  if (ed->getExtentWidth() < 1 || ed->getExtentHeight() < 1){
    ILogger::instance()->logWarning("Tile too small for ancestor elevation data.");
    return NULL;
  }

  if ((_lastElevationDataProvider != NULL) &&
      (_lastTileMeshResolutionX > 0) &&
      (_lastTileMeshResolutionY > 0)) {
//    ElevationData* subView = _lastElevationDataProvider->createSubviewOfElevationData(ed,
//                                                                                      getSector(),
//                                                                                      Vector2I(_lastTileMeshResolutionX, _lastTileMeshResolutionY));
//    return subView;

    return new SubviewElevationData(ed,
                                    //bool ownsElevationData,
                                    getSector(),
                                    Vector2I(_lastTileMeshResolutionX, _lastTileMeshResolutionY));
  }

  ILogger::instance()->logError("Can't create subview of elevation data from ancestor");
  return NULL;

}
示例#9
0
文件: commands.c 项目: mbrx/axe
void printAllSector() {
  int xyz[3];
  for(int i=0;i<nEntFiles;i++) {
    printf("%s : ",entFileNames[i]);
    if(getSector(i,xyz) == 0) printf("fail\n");
    else printf("%d %d %d\n",xyz[0],xyz[1],xyz[2]);
  }
}
 virtual bool execute(Event* e,Object* data){
     CCScene* scene = CCScene::create();
     HelloWorld* hw = HelloWorld::create();
     scene->addChild(hw);
     hw->setManager(getSector()->getManager());
     CCDirector::sharedDirector()->replaceScene(scene);
     return true;
 };
示例#11
0
/*
 * This function sets the size attribute of a specified directory entry.
 * currentDirCluster is the first cluster of the current directory.
 * targetEntry is the entry to be updated.
 * newBytes is the number of bytes to set as the total size.
 */
void setFileSize(FILE *fileImgPtr, unsigned int currentDirCluster,
                unsigned char *targetEntry, int newSize) {

  unsigned char entry[32];
  unsigned int nextCluster;

  // Break the file's size into 4 characters.
  unsigned char sizeA = (newSize & 0xFF000000) >> 24;
  unsigned char sizeB = (newSize & 0x00FF0000) >> 16;
  unsigned char sizeC = (newSize & 0x0000FF00) >> 8;
  unsigned char sizeD = (newSize & 0x000000FF);

  nextCluster = currentDirCluster;

  // Loop until the end of cluster chain is reached or the entry is found.
  do {
    // Seek to the cluster's first sector.
    fseek(fileImgPtr, (getSector(nextCluster) * fsMetadata[BYTES_PER_SECTOR]),
          SEEK_SET);

    // Loop once for each directory entry that can fit in the sector.
    for(int i = 0; i < 16; ++i) {
      // Read in a directory entry.
      for(int j = 0; j < 32; ++j) {
        entry[j] = getc(fileImgPtr);
      }

      // If the entry is a long name entry, do not add it.
      if((entry[11] | 0xF0) == 0xFF)
        continue;
      // If the entry is empty, do not add it.
      if(entry[0] == 0xE5)
        continue;
      // If the entry is free, and is the last entry, end the entire function.
      if(entry[0] == 0x00)
        return;

      // Compare the directory entries. If they have the same first cluster
      // numbers, they are the same entry.
      if(targetEntry[20] == entry[20] && targetEntry[21] == entry[21] &&
        targetEntry[26] == entry[26] && targetEntry[27] == entry[27]) {
        // This is the entry whose size we want to update.
        // Move the file pointer back 4 bytes and write the new size.
        fseek(fileImgPtr, -4, SEEK_CUR);
        putc(sizeD, fileImgPtr);
        putc(sizeC, fileImgPtr);
        putc(sizeB, fileImgPtr);
        putc(sizeA, fileImgPtr);

        return;
      }
    }

    // If next cluster not EOC, set next cluster to next cluster in chain.
    nextCluster = getNextCluster(fileImgPtr, nextCluster);
  } while(nextCluster < EOCMIN);
}
示例#12
0
long Room::getSector(float x, float z, float* floor, float* ceiling) {
    orAssert(floor != nullptr);
    orAssert(ceiling != nullptr);

    long sector = getSector(x, z);

    if ((sector >= 0) && (sector < (long)sectors.size())) {
        *floor = sectors.at(sector)->getFloor();
        *ceiling = sectors.at(sector)->getCeiling();
    }

    return sector;
}
示例#13
0
int main()
{
  int i;
  struct partition *p;
  printf("booter start in main()\n");

  // initialize the dap struct
  dp = &dap;
  dp->len  = 0x10;        // must be 16
  dp->zero = 0;           // must be 0
  dp->nsector = 1;        // load one sector
  dp->addr = 0;           // will set to addr              
  dp->segment = BOOTSEG;  // load to which segment
  dp->s1 = 0;             // will set to LBA sector#
  dp->s2 = 0;             // high 4-byte address s2=0

  getSector((u32)0, (u16)mbr); // get MBR
  //==========================================================
  //In the MBR, partition table begins at byte offset 0x1BE
  // DO #1:  WRITE C CODE TO PRINT THE PARTITIONS
  //==========================================================

  //start of print partitions
  printf("show partition table\n");
  p = (struct partition *)(&mbr[0x1be]);//get first partition from byte offset 0x1BE
  printf("p#  type    start_sector  nr_sectors\n");
  printf("------------------------------------\n");

  //for each partition print partition number, type, start sector, and the number of sectors in partition
  for (i=1; i<=4; i++){
    printf("%d  %x  %l  %l\n", i, p->type, p->start_sector, p->nr_sectors);
    p++;//next partition
  }
  printf("------------------------------------\n");

  //end of print partitions

  color = CYAN;

  while(1)
  {
    printf("what's your name? ");
    gets(ans);
    if (strcmp(ans, "quit")==0)
    {
      printf("\nexit main()\n");
      break;
    }
    printf("\nWelcome %s!\n", ans);
  }
}
IRender_Sector* CRender::detectSector(const Fvector& P)
{
    Sectors_xrc.ray_options	(CDB::OPT_ONLYNEAREST);
    Fvector dir;
    dir.set(0,-1,0);

    // Portals model
    int		id1		= -1;
    float	range1	= 500.f;
    if (rmPortals)
    {
        Sectors_xrc.ray_query	(rmPortals,P,dir,range1);
        if (Sectors_xrc.r_count()) {
            CDB::RESULT *RP1 = Sectors_xrc.r_begin();
            id1 = RP1->id;
            range1 = RP1->range;
        }
    }

    // Geometry model
    int		id2		= -1;
    float	range2	= range1;
    Sectors_xrc.ray_query	(g_pGameLevel->ObjectSpace.GetStaticModel(),P,dir,range2);
    if (Sectors_xrc.r_count()) {
        CDB::RESULT *RP2 = Sectors_xrc.r_begin();
        id2 = RP2->id;
        range2 = RP2->range;
    }

    // Select ID
    int ID;
    if (id1>=0) {
        if (id2>=0) ID = (range1<=range2+EPS)?id1:id2;	// both was found
        else ID = id1;									// only id1 found
    } else if (id2>=0) ID = id2;						// only id2 found
    else return 0;

    if (ID==id1) {
        // Take sector, facing to our point from portal
        CDB::TRI*	pTri	= rmPortals->get_tris() + ID;
        CPortal*	pPortal	= (CPortal*)Portals	[pTri->dummy];
        return pPortal->getSectorFacing(P);
    } else {
        // Take triangle at ID and use it's Sector
        CDB::TRI*	pTri	= g_pGameLevel->ObjectSpace.GetStaticTris()+ID;
        return getSector(pTri->sector);
    }
}
示例#15
0
// Just load it, then do processing
void __loadFileTable(){
	int i;
	for(i=0;i<_MAX_FILES;i++)
		fileTable[i].sector = -1;
	
	for(i=_FILETABLE_SECTOR_START;i<_MAX_SECTORS;i++)
		if(getSector(i)){

			printf("Loading file from sector %d\n", i);
			// Try to load file
			File * file = __loadFile(i);
		}

	// Now process and construct tree
	__constructFileTree();


	__setCurrentDir(fileTable);
}
示例#16
0
//
// HANDLE FLOOR TYPES
//
int EV_DoFloor( line_t*	line, floor_e	floortype )
{
  int			secnum;
  int			rtn;
  int			i;
  sector_t*		sec;
  floormove_t*	floor;

  secnum = -1;
  rtn = 0;
  while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
  {
    sec = &sectors[secnum];

    // ALREADY MOVING?  IF SO, KEEP GOING...
    if (sec->specialdata)
      continue;

    // new floor thinker
    rtn = 1;
    floor = (floormove_t *)Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
    P_AddThinker (&floor->thinker,floor);
    sec->specialdata = floor;
    floor->thinker.function = TT_MoveFloor;
    floor->type = floortype;
    floor->crush = false;

    switch(floortype)
    {
    case lowerFloor:
      floor->direction = -1;
      floor->sector = sec;
      floor->speed = FLOORSPEED;
      floor->floordestheight = 
        P_FindHighestFloorSurrounding(sec);
      break;

    case lowerFloorToLowest:
      floor->direction = -1;
      floor->sector = sec;
      floor->speed = FLOORSPEED;
      floor->floordestheight = 
        P_FindLowestFloorSurrounding(sec);
      break;

    case turboLower:
      floor->direction = -1;
      floor->sector = sec;
      floor->speed = FLOORSPEED * 4;
      floor->floordestheight = 
        P_FindHighestFloorSurrounding(sec);
      if (floor->floordestheight != sec->floorheight)
        floor->floordestheight += 8*FRACUNIT;
      break;

    case raiseFloorCrush:
      floor->crush = true;
    case raiseFloor:
      floor->direction = 1;
      floor->sector = sec;
      floor->speed = FLOORSPEED;
      floor->floordestheight = 
        P_FindLowestCeilingSurrounding(sec);
      if (floor->floordestheight > sec->ceilingheight)
        floor->floordestheight = sec->ceilingheight;
      floor->floordestheight -= (8*FRACUNIT)*
        (floortype == raiseFloorCrush);
      break;

    case raiseFloorTurbo:
      floor->direction = 1;
      floor->sector = sec;
      floor->speed = FLOORSPEED*4;
      floor->floordestheight = 
        P_FindNextHighestFloor(sec,sec->floorheight);
      break;

    case raiseFloorToNearest:
      floor->direction = 1;
      floor->sector = sec;
      floor->speed = FLOORSPEED;
      floor->floordestheight = 
        P_FindNextHighestFloor(sec,sec->floorheight);
      break;

    case raiseFloor24:
      floor->direction = 1;
      floor->sector = sec;
      floor->speed = FLOORSPEED;
      floor->floordestheight = floor->sector->floorheight +
        24 * FRACUNIT;
      break;
    case raiseFloor512:
      floor->direction = 1;
      floor->sector = sec;
      floor->speed = FLOORSPEED;
      floor->floordestheight = floor->sector->floorheight +
        512 * FRACUNIT;
      break;

    case raiseFloor24AndChange:
      floor->direction = 1;
      floor->sector = sec;
      floor->speed = FLOORSPEED;
      floor->floordestheight = floor->sector->floorheight +
        24 * FRACUNIT;
      sec->floorpic = line->frontsector->floorpic;
      sec->special = line->frontsector->special;
      break;

    case raiseToTexture:
      {
        int	minsize = MAXINT;
        side_t*	side;

        floor->direction = 1;
        floor->sector = sec;
        floor->speed = FLOORSPEED;
        for (i = 0; i < sec->linecount; i++)
        {
          if (twoSided (secnum, i) )
          {
            side = getSide(secnum,i,0);
            if (side->bottomtexture >= 0)
              if (textureheight[side->bottomtexture] < 
                minsize)
                minsize = 
                textureheight[side->bottomtexture];
            side = getSide(secnum,i,1);
            if (side->bottomtexture >= 0)
              if (textureheight[side->bottomtexture] < 
                minsize)
                minsize = 
                textureheight[side->bottomtexture];
          }
        }
        floor->floordestheight =
          floor->sector->floorheight + minsize;
      }
      break;

    case lowerAndChange:
      floor->direction = -1;
      floor->sector = sec;
      floor->speed = FLOORSPEED;
      floor->floordestheight = 
        P_FindLowestFloorSurrounding(sec);
      floor->texture = sec->floorpic;

      for (i = 0; i < sec->linecount; i++)
      {
        if ( twoSided(secnum, i) )
        {
          if (getSide(secnum,i,0)->sector-sectors == secnum)
          {
            sec = getSector(secnum,i,1);

            if (sec->floorheight == floor->floordestheight)
            {
              floor->texture = sec->floorpic;
              floor->newspecial = sec->special;
              break;
            }
          }
          else
          {
            sec = getSector(secnum,i,0);

            if (sec->floorheight == floor->floordestheight)
            {
              floor->texture = sec->floorpic;
              floor->newspecial = sec->special;
              break;
            }
          }
        }
      }
    default:
      break;
    }
  }
  return rtn;
}
示例#17
0
void CRender::LoadSectors(IReader* fs)
{
	// allocate memory for portals
	u32 size = fs->find_chunk(fsL_PORTALS); 
	R_ASSERT(0==size%sizeof(b_portal));
	u32 count = size/sizeof(b_portal);
	Portals.resize	(count);
	for (u32 c=0; c<count; c++)
		Portals[c]	= xr_new<CPortal> ();

	// load sectors
	IReader* S = fs->open_chunk(fsL_SECTORS);
	for (u32 i=0; ; i++)
	{
		IReader* P = S->open_chunk(i);
		if (0==P) break;

		CSector* __S		= xr_new<CSector> ();
		__S->load			(*P);
		Sectors.push_back	(__S);

		P->close();
	}
	S->close();

	// load portals
	if (count) 
	{
		CDB::Collector	CL;
		fs->find_chunk	(fsL_PORTALS);
		for (i=0; i<count; i++)
		{
			b_portal	P;
			fs->r		(&P,sizeof(P));
			CPortal*	__P	= (CPortal*)Portals[i];
			__P->Setup	(P.vertices.begin(),P.vertices.size(),
				(CSector*)getSector(P.sector_front),
				(CSector*)getSector(P.sector_back));
			for (u32 j=2; j<P.vertices.size(); j++)
				CL.add_face_packed_D(
				P.vertices[0],P.vertices[j-1],P.vertices[j],
				u32(i)
				);
		}
		if (CL.getTS()<2)
		{
			Fvector					v1,v2,v3;
			v1.set					(-20000.f,-20000.f,-20000.f);
			v2.set					(-20001.f,-20001.f,-20001.f);
			v3.set					(-20002.f,-20002.f,-20002.f);
			CL.add_face_packed_D	(v1,v2,v3,0);
		}

		// build portal model
		rmPortals = xr_new<CDB::MODEL> ();
		rmPortals->build	(CL.getV(),int(CL.getVS()),CL.getT(),int(CL.getTS()));
	} else {
		rmPortals = 0;
	}

	// debug
	//	for (int d=0; d<Sectors.size(); d++)
	//		Sectors[d]->DebugDump	();

	pLastSector = 0;
}
示例#18
0
文件: PlugCD.c 项目: AlexBu/pcsx
unsigned char *CDR__getBuffer(void) {
//    SysPrintf("start CDR_getBuffer()\r\n");
    return getSector();
}
示例#19
0
File * __loadFile(int sector){
	// If it isnt mapped yet...
	if(!getSector(sector))
		return NULL;

	File * file = getFreeFile();


	int i;
	for(i=0;i<_FILE_CHILDREN;i++)
		file->children[i] = NULL;
	

	file->sector = sector;

	// FILE HEADER
	// 255 bytes: name
	// 4 bytes: size
	// 4 bytes: parent sector
	// FILE FOOTER

	int base = 0;

	char header[50];
	char footer[50];

	// Now prepare to read file header on sector
	disk_cmd fileHeader = {ATA0, file->sector, base, strlen(_FILE_HEADER)+1,header};
	base += strlen(_FILE_HEADER)+1;

	disk_cmd fileName = {ATA0, file->sector, base, _FILE_NAMELENGTH, file->name};
	base += _FILE_NAMELENGTH;

	disk_cmd fileSize = {ATA0, file->sector,base, 4,(char*)(&(file->size))};
	base += sizeof(int);

	disk_cmd fileParent = {ATA0, file->sector, base, sizeof(int), (char *)(&file->psector)};
	base += sizeof(int);

	file->parent = NULL;

	disk_cmd fileFooter = {ATA0, file->sector, base, strlen(_FILE_FOOTER)+1,footer};

	// And read it
	System.readDisk(&fileHeader);
	System.readDisk(&fileName);
	System.readDisk(&fileSize);
	System.readDisk(&fileParent);
	System.readDisk(&fileFooter);

	// Its a file
	if(!strcmp(header,_FILE_HEADER) && !strcmp(footer,_FILE_FOOTER)){
		// Blabla, things to do
		return file;
	}


	// File not recognized
	__freeFile(__getFileIndexBySector(file->sector));
	return NULL;
}
示例#20
0
int main(int argc, char *argv[]) {
int		fd, i, br, n;
char		code[8192], data[8192], cdata[8192], *td;
int		fhead, format;
struct set_rw	SetRW;
int		phase;
struct DcStill	Dc;

	Dc.code = code;
	Dc.csize = 8192;
	Dc.data = data;
	Dc.dsize = 8192;

#if READFILE
	if (argc < 2) {
		printf("Usage: %s <code> [data]\n", argv[0]);
		return(1);
		};
	fd = open(argv[1], O_RDONLY, 0644);
	if (fd < 0) {
		printf("Error open '%s'\n", argv[1]);
		return(2);
		};
	if (read(fd, Dc.code, Dc.csize) < 0) {
		printf("Error read '%s'\n", argv[1]);
		close(fd);
		return(3);
		};
	close(fd);
#else
	fd = open("/dev/ravt0", O_RDWR, 0);
	if (fd < 0) {
		printf("Error open '%s'\n", argv[1]);
		return(2);
		};

	SetRW.rate = 200;
	SetRW.flag = IORAW;
	ioctl(fd, VSET_READ, &SetRW);
	phase = 17;
	ioctl(fd, VSET_PHASE, &phase);

	phase = 0;
	for (i = 0; i < 100; i++) {
	phase++;
	bzero(Dc.code, Dc.csize);
	while (!(br=read(fd, Dc.code, Dc.csize)));
#endif
	bzero(Dc.data, Dc.dsize);
	format = FORMAT_RSC_50;
	fhead = DcHeader(Dc.code, &Dc.header, &Dc.coffs, format);
	if (fhead) {
	int lcoffs;
		format = FORMAT_RS;
		for (lcoffs = 0; lcoffs < 9*9*2 && fhead; lcoffs++) {
			fhead = DcHeader(Dc.code+lcoffs, &Dc.header, &Dc.coffs, format);
			printf("Offs: %d/%d [%02X]\n", lcoffs, fhead, code[lcoffs]);
		}
	}
	if (fhead) {
		printf("%d/%d - header nof found!\n", phase,br);
/*		DecoderRS(data, code+offs*2, 0, NGR50, NGR50); */
	} else {
		if (DcData(Dc.code, Dc.data, &Dc.header, Dc.coffs, &Dc.dstat))
			printf("ERROR decode DATA!!!\n");
		printf("Error's:\t%d/%d/%d %d\n",
			DCErrStat.one, DCErrStat.two,
			DCErrStat.tree, DCErrStat.fatal);
#if 1
		flagFromHeader(&Dc);
		printf("Shift:\t%d\n", Dc.coffs);
		printf("Format:\t%02X", Dc.header.g.format);
		switch(Dc.header.g.format) {
		case	FORMAT_RS:
			printf("\t(RS)\n");
			printf("Tape name:\t");
				for (n=0; n<8; n++)
					printf("%c", Dc.header.rs.name[n]);
			printf("\n");
			printf("Tape length:\t%d min.\n", Dc.header.rs.length & LENGTHMASK);
			printf("Tape time:\t%d sec.\n", Dc.header.rs.tapetime);
			break;
		case	FORMAT_RSC:
			printf("\t(RSC)\n");
			if (!(Dc.header.rsc.lenCompress & 0x8000))
				printf("Compress:\t%d\n", Dc.header.rsc.lenCompress);
			printf("Tape ID:\t%08X\n", Dc.header.rsc.tapeID);
			printf("XOR info:\t%02x %02x %02x %02x\n",
				Dc.header.rsc.num_xor, Dc.header.rsc.num_block,
				Dc.header.rsc.nr_xor, Dc.header.rsc.nr_block);
			printf("Tape length:\t%d min.\n", Dc.header.rsc.length & LENGTHMASK);
			printf("Tape time:\t%d sec.\n", Dc.header.rsc.tapetime);
			printf("Spec sector:\t%d %d/%d/%d\n",
				Dc.header.rsc.numSpec, Dc.header.rsc.x0,
				Dc.header.rsc.x1, Dc.header.rsc.x2);
			break;
		case	FORMAT_RSC_50:
			printf("\t(RSC_50)\n");
			if (!(Dc.header.rsc50.lenCompress & 0x8000))
				printf("Compress:\t%d\n", Dc.header.rsc50.lenCompress);
			printf("Tape ID:\t%08X\n", Dc.header.rsc50.tapeID);
			printf("XOR info:\t%02x %02x %02x %02x\n",
				Dc.header.rsc50.num_xor, Dc.header.rsc50.num_block,
				Dc.header.rsc50.nr_xor, Dc.header.rsc50.nr_block);
			printf("Tape length:\t%d min.\n", Dc.header.rsc50.length & LENGTHMASK);
			printf("Tape time:\t%d sec.\n", Dc.header.rsc50.tapetime);
			printf("Spec sector:\t%d %d/%d/%d\n",
				Dc.header.rsc50.numSpec, Dc.header.rsc50.x0,
				Dc.header.rsc50.x1, Dc.header.rsc50.x2);
			printf("Data CRC:\t%08X\n", Dc.header.rsc50.CRC);
			break;
			}; /* format */
		printf("Start sector:\t%u\n", getSector(&Dc.header));
		printf("nSectors:\t%d\n", getAvailSector(&Dc.header));
		printf("Sector flags:\t");
		if (Dc.fDir)			printf("DIR.");
		else				printf("DATA.");
		if (Dc.fHead)			printf("START.");
		if (Dc.fTail)			printf("END.");
		if (Dc.fSpec)			printf("SPEC.");
		printf("\n");
#endif
#if READFILE
		if (argc == 3) {
			fd = open(argv[2], O_WRONLY|O_CREAT, 0644);
			if (fd < 0) {
				printf("Error open '%s'\n", argv[2]);
				return(4);
				};
			br = getSector(&Dc.header);
			i = getAvailSector(&Dc.header);
			i *= 512;
			td = (char *)malloc(i);
			printf("Read bytes:\t%d\n", readData(&Dc, td, br, i));
			if (write(fd, td, i) < 0) {
				printf("Error write '%s'\n", argv[2]);
				close(fd);
				return(5);
				};
			close(fd);
			free(td);
			};
#endif
		}; /* fHead */
#if READFILE
#else
	};
	close(fd);
#endif
};
示例#21
0
bool getPixel(SCREEN* data, unsigned char x, unsigned char y){return getBit(getSector(data, x/8, y), 7-(x%8));}
示例#22
0
void Room::getHeightAtPosition(float x, float* y, float z) {
    long sector = getSector(x, z);
    if ((sector >= 0) && (sector < (long)sectors.size()))
        *y = sectors.at(sector)->getFloor();
}
示例#23
0
int main(int argc, char *argv[]) {
int		fd, fdw, i, br, n;
char		code[8192], data[8192], *td, file[1024];
int		fhead, format;
struct set_rw	SetRW;
int		phase;
struct DcStill	Dc;

	Dc.code = code;
/*	Dc.csize = 8192; */
	Dc.csize = SIZE200;
	Dc.data = data;
	Dc.dsize = 8192;

	fd = open("/dev/ravt0", O_RDWR, 0);
	if (fd < 0) {
		printf("Error open '%s'\n", argv[1]);
		return(2);
		};

	SetRW.rate = 200;
	SetRW.flag = IORAW;
	ioctl(fd, VSET_READ, &SetRW);
	phase = 17;
	ioctl(fd, VSET_PHASE, &phase);

	phase = 0;
	/* пока не конец */
	while (!Dc.fTail) {
		phase++;
		bzero(Dc.code, Dc.csize);
		while (!(br=read(fd, Dc.code, Dc.csize)));
		bzero(Dc.data, Dc.dsize);
		format = FORMAT_RSC_50;
		fhead = DcHeader(Dc.code, &Dc.header, &Dc.coffs, format);
		if (fhead) {
			format = FORMAT_RS;
			fhead = DcHeader(Dc.code, &Dc.header, &Dc.coffs, format);
		};

		if (fhead)
			printf("%d/%d - header nof found!\n", phase,br);
		else
			flagFromHeader(&Dc);

		if (!fhead && Dc.fDir && !Dc.fTail) {
			if (DcData(Dc.code, Dc.data, &Dc.header, Dc.coffs, &Dc.dstat))
				printf("ERROR decode DATA!!!\n");
			printf("Error's:\t%d/%d/%d %d\n",
				DCErrStat.one, DCErrStat.two,
				DCErrStat.tree, DCErrStat.fatal);
#if 1
			printf("Shift:\t%d\n", Dc.coffs);
			printf("Format:\t%02X", Dc.header.g.format);
			switch(Dc.header.g.format) {
			case	FORMAT_RS:
				printf("\t(RS)\n");
				printf("Tape name:\t");
					for (n=0; n<8; n++)
						printf("%c", Dc.header.rs.name[n]);
				printf("\n");
				printf("Tape length:\t%d min.\n", Dc.header.rs.length & LENGTHMASK);
				printf("Tape time:\t%d sec.\n", Dc.header.rs.tapetime);
				break;
			case	FORMAT_RSC:
				printf("\t(RSC)\n");
				if (!(Dc.header.rsc.lenCompress & 0x8000))
					printf("Compress:\t%d\n", Dc.header.rsc.lenCompress);
				printf("Tape ID:\t%08X\n", Dc.header.rsc.tapeID);
				printf("XOR info:\t%02x %02x %02x %02x\n",
					Dc.header.rsc.num_xor, Dc.header.rsc.num_block,
					Dc.header.rsc.nr_xor, Dc.header.rsc.nr_block);
				printf("Tape length:\t%d min.\n", Dc.header.rsc.length & LENGTHMASK);
				printf("Tape time:\t%d sec.\n", Dc.header.rsc.tapetime);
				printf("Spec sector:\t%d %d/%d/%d\n",
					Dc.header.rsc.numSpec, Dc.header.rsc.x0,
					Dc.header.rsc.x1, Dc.header.rsc.x2);
				break;
			case	FORMAT_RSC_50:
				printf("\t(RSC_50)\n");
				if (!(Dc.header.rsc50.lenCompress & 0x8000))
					printf("Compress:\t%d\n", Dc.header.rsc50.lenCompress);
				printf("Tape ID:\t%08X\n", Dc.header.rsc50.tapeID);
				printf("XOR info:\t%02x %02x %02x %02x\n",
					Dc.header.rsc50.num_xor, Dc.header.rsc50.num_block,
					Dc.header.rsc50.nr_xor, Dc.header.rsc50.nr_block);
				printf("Tape length:\t%d min.\n", Dc.header.rsc50.length & LENGTHMASK);
				printf("Tape time:\t%d sec.\n", Dc.header.rsc50.tapetime);
				printf("Spec sector:\t%d %d/%d/%d\n",
					Dc.header.rsc50.numSpec, Dc.header.rsc50.x0,
					Dc.header.rsc50.x1, Dc.header.rsc50.x2);
				printf("Data CRC:\t%08X\n", Dc.header.rsc50.CRC);
				break;
			}; /* switch (format) */
			printf("Start sector:\t%u\n", getSector(&Dc.header));
			printf("nSectors:\t%d\n", getAvailSector(&Dc.header));
			printf("Sector flags:\t");
			if (Dc.fDir)			printf("DIR.");
			else				printf("DATA.");
			if (Dc.fHead)			printf("START.");
			if (Dc.fTail)			printf("END.");
			if (Dc.fSpec)			printf("SPEC.");
			printf("\n");
#endif
			sprintf(file, "%u\0", getSector(&Dc.header));
			fdw = open(file, O_WRONLY|O_CREAT|O_TRUNC, 0644);
			if (fdw < 0)
				printf("Error open '%s'\n", argv[2]);
			else {
#if 0
				br = getSector(&Dc.header);
				i = getAvailSector(&Dc.header);
				i *= 512;
				td = (char *)malloc(i);
				printf("Read bytes:\t%d\n", readData(&Dc, td, br, i));
				if (write(fd, td, i) < 0) {
					printf("Error write '%s'\n", argv[2]);
					close(fd);
					return(5);
					};
				close(fd);
				free(td);
#else
				if (write(fdw, Dc.data, Dc.dsize) < 0)
					printf("Error write '%s'\n", file);
				close(fdw);
#endif
			}; /* if open */
		}; /* fHead && Dc.fDir */
	}; /* while (Dc.fTail) */
	close(fd);
};
示例#24
0
int main()
{
  int i;
  int bsector, partition;
  struct partition *p;
  printf("booter start in main()\n");

  // initialize the dap struct
  dp = &dap;
  dp->len  = 0x10;        // must be 16
  dp->zero = 0;           // must be 0
  dp->nsector = 1;        // load one sector
  dp->addr = 0;           // will set to addr              
  dp->segment = BOOTSEG;  // load to which segment
  dp->s1 = 0;             // will set to LBA sector#
  dp->s2 = 0;             // high 4-byte address s2=0

  getSector((u32)0, (u16)mbr); // get MBR
  /*==========================================================
  In the MBR, partition table begins at byte offset 0x1BE
  // DO #1:  WRITE C CODE TO PRINT THE PARTITIONS
  ==========================================================*/

	/*p = (struct partition *) mbr + 0x1BE; //(446)

	for(i = 0; i < 4; ++i){
		printf("drive = %d\n", p->drive);
		printf("head = %d\n", p->head);
		printf("sector = %d\n", p->sector);
		printf("cylinder = %d\n", p->cylinder);
		printf("sys_type = %d\n", p->type);
		printf("end_head = %d\n", p->end_head);
		printf("end_sector = %d\n", p->end_sector);
		printf("end_cylinder = %d\n", p->end_cylinder);
		printf("start_sector = %d\n", p->start_sector);
		printf("nr_sectors = %d\n", p->nr_sectors);
			
		p += 4; //16 bytes
	}*/
  printf("show partition table\n");
  p = (struct partition *)(&mbr[0x1be]);
  printf("p#  type    start_sector  nr_sectors\n");
  printf("------------------------------------\n");

  for (i=1; i<=4; i++){
    printf("%d  %x  %d  %d\n", 
	   i, p->type, p->start_sector, p->nr_sectors);
    /*if (i==1){
      partition = 1;
      bsector = p->start_sector;
    }*/
    p++;
  }
  printf("------------------------------------\n");	

  color = CYAN;
  while(1){
    printf("what's your name? ");
    gets(ans);
    if (strcmp(ans, "quit")==0){
      printf("\nexit main()\n");
      break;
    }
    printf("\nWelcome %s!\n", ans);
  }

}
示例#25
0
	void SettingsManager::loadSector(MyGUI::xml::ElementPtr _sectorNode)
	{
		SettingsSector* sector = getSector(_sectorNode->getName());
		sector->deserialization(_sectorNode, MyGUI::Version());
	}