Exemplo n.º 1
0
void GraphicsManager::SetupGraphics()
{

	

	ClearObjects();
}
Exemplo n.º 2
0
//================================================================================
void ATHObjectManager::Shutdown()
{
	ClearObjects();
	delete m_pWorld;

	if (m_szLibraryBuffer)
		delete m_szLibraryBuffer;
}
Exemplo n.º 3
0
Application::~Application(){
	ClearObjects();
	delete World;
	delete Solver;
	delete Dispatcher;
	delete BroadPhase;
	delete CollisionConfiguration;

	irrDevice->drop();
}
void TUserIniFile::LoadValues()
{
  TStringList* ASections, *AValues;
  if ((FileName != "") && FileExists(FileName)) {
    ClearObjects();
    ASections = new TStringList();
    try {
      ReadSections(ASections);
      for(int i=0; i < ASections->Count; i++) {
        AValues = new TStringList();
        ReadSectionValues(ASections->Strings[i], AValues);
        Sections->AddObject(ASections->Strings[i], (TObject*)AValues);
      };
    }
    __finally {
      delete ASections;
    };
  };
Exemplo n.º 5
0
void TMaps::LoadNextMap() {
    MapStatus = MS_Loading;
    if (MapFiles.size() == 0) {
        throw UException("No maps found");
    }
    CurrentMap ++;
    if (CurrentMap >= MapFiles.size()) {
        CurrentMap = 0;
    }
    emit ClearObjects();
    emit ClearBorders();
    LoadConfig("maps/" + MapFiles[CurrentMap] + "/config.ini");
    LoadObjects("maps/" + MapFiles[CurrentMap] + "/objects.txt");
    LoadRespPoints("maps/" + MapFiles[CurrentMap] + "/points.txt");
    emit SpawnBorders(GetMapSize());
    MapStatus = MS_Ready;
    emit MapLoaded();
}
Exemplo n.º 6
0
void gameInit(){
	(&player)->~Player();
    new (&player) Player(116,76);
	
	for(int i = 0; i < enemies.size(); i++){
		enemies.at(i).setDead(true);
	}
	
	for(int i = 0; i < bullets.size(); i++){
		bullets.at(i).setDead(true);
	}
	
	(&crate)->~Crate();
    new (&crate) Crate(0,0,0);
	
	weapon = 1;
	score = 0;

	//Set-up Objects
	ClearObjects();
	
	//Weapon
	int shape = 0;
	if(weapon == 8)shape = 1;
	SetObject(0,
	          ATTR0_SHAPE(shape) | ATTR0_8BPP | ATTR0_REG | ATTR0_Y(player.getY()+1),
			  ATTR1_SIZE(0) | ATTR1_X(player.getX()+4),
			  ATTR2_ID8(22+weapon));
	
	//Crate
	SetObject(1,
	          ATTR0_SHAPE(0) | ATTR0_8BPP | ATTR0_REG | ATTR0_Y(crate.getY()),
			  ATTR1_SIZE(0) | ATTR1_X(crate.getX()),
			  ATTR2_ID8(14));
	
	//Player
	SetObject(2,
	          ATTR0_SHAPE(0) | ATTR0_8BPP | ATTR0_REG | ATTR0_Y(player.getY()),
			  ATTR1_SIZE(0) | ATTR1_X(player.getX()),
			  ATTR2_ID8(1));
}
Exemplo n.º 7
0
//  Take a 'turn' (throw three darts)
void Player::TakeTurn(int cursoractual[], int cursorpos[], int BGPos[], bool playertothrow) {
	int throws = 3;
	int wait = 0;
	p_turnthrows = 0;
	p_turnstartpoints = p_points;
	SetTile(27, 23+5*playertothrow, 1, 5);
	SetTile(27, 23+5*playertothrow-1, 1, 5);
	SetTile(27, 23+5*playertothrow-2, 1, 5);
	
	while ((throws > 0 && p_points > 0) || wait < 40) {
		UpdateObjects();
		
		if (throws > 0 && p_points > 0) {	
			WaitVSync();
			UpdateObjects();
			TakeAShot(cursoractual, cursorpos, BGPos);
			DrawPoints(20+5*playertothrow, 4 + p_throws);
			
			SetTile(27, 23+5*playertothrow-p_turnthrows, 1, 4);
			
			p_throws++;
			p_turnthrows++;
			throws--;
		} else {
			wait++;
		}
		
		for (int i = 0; i < p_turnthrows; i++) {
			darts[i].UpdateDart(BGPos);			
		}
	}
	SetTile(27, 23+5*playertothrow, 1, 4);
	SetTile(27, 23+5*playertothrow-1, 1, 4);
	SetTile(27, 23+5*playertothrow-2, 1, 4);
	ClearObjects();
}
Exemplo n.º 8
0
void enterMenu(int menu){
	LoadPaletteBGData(0, menuBGPal, menuBGPalLen);
	
	bool active = true;
	int option = 0;
	int keyPressCoolDown = 30;
	if(menu == 0)ClearObjects();
	
	//MENU LOOP
	while(active){
		keyPressCoolDown--;
		if(keyPressCoolDown <= 0)keyPressCoolDown = 0;
		clearText();
		switch(menu){
			case 0://Main menu
			if((REG_KEYINPUT & KEY_UP) == 0){
				option = 0;
			}
			if((REG_KEYINPUT & KEY_DOWN) == 0){
				option = 1;
			}
			if((REG_KEYINPUT & KEY_A) == 0 && keyPressCoolDown == 0){
				if(option == 0){
					active = false;
					gameInit();
				}else{
					menu = 1;
					keyPressCoolDown = 30;
				}
			}
			drawText(60,20,"Super Crate Box");
			drawText(105,65,"PLAY");
			drawText(93,90,"CREDITS");
			
			if(option == 0)drawText(90, 65, ">      <");
			if(option == 1)drawText(78, 90, ">         <");
			break;
			
			case 1://Credits
			if((REG_KEYINPUT & KEY_A) == 0 && keyPressCoolDown == 0){
				menu = 0;
				keyPressCoolDown = 30;
			}
			if((REG_KEYINPUT & KEY_B) == 0 && keyPressCoolDown == 0){
				menu = 0;
				keyPressCoolDown = 30;
			}
			
			drawText(30, 20, "GBA - Super Crate Box");
			drawText(30,60, "Created by Peter Black");
			drawText(70,80, "for CGA 2014");
			drawText(8, 135, "Assets & Gameplay C Vlambeer");
			break;
			
			case 2://Game Over
			if((REG_KEYINPUT & KEY_A) == 0 && keyPressCoolDown == 0){
				active = false;
				gameInit();
			}
			if((REG_KEYINPUT & KEY_B) == 0 && keyPressCoolDown == 0){
				menu = 0;
				ClearObjects();
				keyPressCoolDown = 30;
			}
		
			drawText(82,60,"GAME OVER");
			drawText(85,80,"Score:");
			drawText(133,80,toString(score));
			drawText(77, 125,"A = Retry");
			drawText(65, 135,"B = Main Menu");
			
			
			break;
		}
		
		
		WaitVSync();
		UpdateObjects();
	}
	
	LoadPaletteBGData(0, backgroundPal, backgroundPalLen);
}
Exemplo n.º 9
0
ObjectManager::~ObjectManager()
{
  ClearObjects();
}
Exemplo n.º 10
0
void C4LSector::Clear()
{
	// clear objects
	ClearObjects();
}
Exemplo n.º 11
0
// Destructor
_ObjectManager::~_ObjectManager() {

	ClearObjects();

	delete[] ObjectArray;
}
Exemplo n.º 12
0
FileObjectTable::~FileObjectTable()
{
    ClearObjects();
}
Exemplo n.º 13
0
// Creates a base box
void Application::CreateStartScene() {
	ClearObjects();
	CreateBox(btVector3(0.0f, 0.0f, 0.0f), vector3df(10.0f, 0.5f, 10.0f), 0.0f, "ice0.jpg");
}
Exemplo n.º 14
0
int main()
{
	// Set display options.
	// DCNT_MODE0 sets mode 0, which provides four tiled backgrounds.
	// DCNT_OBJ enables objects.
	// DCNT_OBJ_1D make object tiles mapped in 1D (which makes life easier).
	REG_DISPCNT = DCNT_MODE0 | DCNT_BG0 | DCNT_BG1 | DCNT_BG2 | DCNT_OBJ;
	
	REG_BG0CNT = BG_CBB(0) | BG_SBB(30) | BG_8BPP | BG_REG_32x32 | BG_PRIO(0);
	
	REG_BG1CNT = BG_CBB(0) | BG_SBB(29) | BG_8BPP | BG_REG_32x32 | BG_PRIO(1);
	
	REG_BG2CNT = BG_CBB(0) | BG_SBB(25) | BG_8BPP | BG_REG_64x64 | BG_PRIO(2);
	REG_BG2HOFS = 0;
	REG_BG2VOFS = 0;
	
	ClearObjects();
	
	SetPaletteBG(1, RGB(31, 31, 31)); // white
	
	//Load each tile in font_bold into it's corresponding position in charblock 0
	for (int i = 0; i < 128; i++)
	{
		LoadTile8(0, i, font_bold[i]);
	}
	
	DrawText(5, (SCREEN_HEIGHT / 16) - 2, "DECEPTIVE DIMENSIONS");
	DrawText(5, (SCREEN_HEIGHT / 16), "Press start to begin");
	
	Buttons buttons;
	int framecounter = 0;
	
	//Title screen (under construction)
	while (true)
	{
		buttons.Update();
		
		if (buttons.StartJustPressed())
		{
			break;
		}
		
		WaitVSync();	
	}
	
	while (true)
	{
		//Load Custom spritesheet
		LoadPaletteObjData(0, spritesheet4Pal, sizeof spritesheet4Pal);
		LoadPaletteBGData(0, backgroundnewnewPal, sizeof backgroundnewnewPal);
		LoadTileData(4, 0, spritesheet4Tiles, sizeof spritesheet4Tiles);
		LoadTileData(0, 0, backgroundnewnewTiles, sizeof backgroundnewnewTiles);
		
		int levelnumber = 1;
		
		Level level(levelnumber);
		
		for (int screenblock = 21; screenblock < 31; screenblock++)
		{
			level.FillScreenblock(screenblock, 0);
		}
		
		level.DrawBackground(level.curdimension);
		
		bool gamerunning = true;
		
		//Main game loop
		while (gamerunning)
		{
			buttons.Update();
			
			gamerunning = level.CheckIfLevelComplete();
			level.TakeInput(buttons);
			level.MoveObjects();
			level.Draw();
			level.UpdateLevelObjects(framecounter);

			framecounter++;
			
			WaitVSync();
			FlipBuffers();
		}
		
		//Reload each tile in font_bold into it's corresponding position in charblock 0
		for (int i = 0; i < 128; i++)
		{
			LoadTile8(0, i, font_bold[i]);
		}
		
		SetPaletteBG(0, RGB(0, 0, 0)); // black
		SetPaletteBG(1, RGB(31, 31, 31)); // white		
		
		for (int screenblock = 25; screenblock < 31; screenblock++)
		{
			for (int y = 0; y < 32; y++)
			{
				for (int x = 0; x < 32; x++)
				{
					SetTile(screenblock, x, y, 0);
				}
			}
		}
		
		level.player.drawx = SCREEN_WIDTH;
		
		SetObject(level.player.GetObjNum(),
		  ATTR0_SHAPE(2) | ATTR0_8BPP | ATTR0_HIDE,
		  ATTR1_SIZE(2) | ATTR1_X(level.player.drawx),
		  ATTR2_ID8(0) | ATTR2_PRIO(2));
		
		UpdateObjects();
		
		DrawText(6, (SCREEN_HEIGHT / 16) - 2, "That's all folks!!");
		DrawText(3, (SCREEN_HEIGHT / 16), "Press start to try again");
		
		while (true)
		{
			buttons.Update();
			
			if (buttons.StartJustPressed())
			{
				break;
			}
			
			WaitVSync();
		}
	}
}
Exemplo n.º 15
0
int main()
{
    LoadAssets();
    ClearObjects();
    InitialiseStage();

    uint16_t oldKeys = REG_P1;

    Cursor cursor = Cursor(0);

    bool pieceSelected = false;
    int currentPiece = 0;
    int* moves = new int[28];
    int* takingMoves = new int[16];

    int currentTurnColor = WHITE;
    for(int i = 0; i < 2; i++)
        for(int j = 0; j < 16; j++)
            _lostPieces[i][j] = -1;


    while (true)
    {
        if(!(REG_P1 & KEY_RIGHT) && (oldKeys & KEY_RIGHT))
            cursor.Move(1,  0);
        if(!(REG_P1 & KEY_LEFT) && (oldKeys & KEY_LEFT))
            cursor.Move(-1, 0);
        if(!(REG_P1 & KEY_DOWN) && (oldKeys & KEY_DOWN))
            cursor.Move(0,  1);
        if(!(REG_P1 & KEY_UP) && (oldKeys & KEY_UP))
            cursor.Move(0, -1);

        if(!(REG_P1 & KEY_A) && (oldKeys & KEY_A))
        {
            if(PieceAt(cursor.X(), cursor.Y()))
            {
                pieceSelected = true;
                for(int i = 0; i < 16 && takingMoves[i] >= 0; i++)
                    if(takingMoves[i] % 8 == cursor.X() && takingMoves[i] / 8 == cursor.Y())
                    {
                        TakePiece(currentPiece % 8, currentPiece / 8, cursor.X(), cursor.Y());
                        currentTurnColor = (currentTurnColor == WHITE ? BLACK : WHITE);
                        pieceSelected = false;
                        ClearHighlights();
                        takingMoves[0] = -1;
                        break;
                    }

                if(pieceSelected && PieceColor(cursor.X(), cursor.Y()) == currentTurnColor)
                {
                    ClearHighlights();

                    AvailableMoves(cursor.X(), cursor.Y(), moves, takingMoves);

                    currentPiece = cursor.Y() * 8 + cursor.X();

                    for(int i = 0; i < 28 && moves[i] >= 0; i++)
                        Highlight(moves[i] % 8, moves[i] / 8, GREEN);

                    for(int i = 0; i < 16 && takingMoves[i] >= 0; i++)
                        Highlight(takingMoves[i] % 8, takingMoves[i] / 8, RED);
                }
            }
            else if(pieceSelected)
            {
                ClearHighlights();

                if(!PieceAt(cursor.X(), cursor.Y()))
                {
                    for(int i = 0; i < 28 && moves[i] >= 0; i++)
                        if(moves[i] % 8 == cursor.X() && moves[i] / 8 == cursor.Y())
                        {
                            MovePiece(currentPiece % 8, currentPiece / 8, cursor.X(), cursor.Y());
                            currentTurnColor = (currentTurnColor == WHITE ? BLACK : WHITE);
                            pieceSelected = false;
                            break;
                        }
                }
            }
        }

        oldKeys = REG_P1;

        if(currentTurnColor == WHITE)
            DrawString(20, 1, "WHITE", 5);
        else
            DrawString(20, 1, "BLACK", 5);

        WaitVSync();
        UpdateObjects();
    }

    return 0;
}
Exemplo n.º 16
0
bool UPKReader::ReadPackageHeader()
{
    ClearObjects(); /// clear ObjectsMap
    CompressedHeader = FCompressedChunkHeader{};
    ReadError = UPKReadErrors::NoErrors;
    Compressed = false;
    CompressedChunk = false;
    LastAccessedExportObjIdx = 0;
    LogDebug("Reading package Summary...");
    UPKStream.seekg(0);
    UPKStream.read(reinterpret_cast<char*>(&Summary.Signature), 4);
    if (Summary.Signature != 0x9E2A83C1)
    {
        LogErrorState(UPKReadErrors::BadSignature);
        return false;
    }
    int32_t tmpVer;
    UPKStream.read(reinterpret_cast<char*>(&tmpVer), 4);
    Summary.Version = tmpVer % (1 << 16);
    Summary.LicenseeVersion = tmpVer >> 16;
    if (Summary.Version != 845)
    {
        LogDebug("Bad version, checking if package is fully compressed...");
        return ReadCompressedHeader();
    }
    Summary.HeaderSizeOffset = UPKStream.tellg();
    UPKStream.read(reinterpret_cast<char*>(&Summary.HeaderSize), 4);
    UPKStream.read(reinterpret_cast<char*>(&Summary.FolderNameLength), 4);
    if (Summary.FolderNameLength > 0)
    {
        getline(UPKStream, Summary.FolderName, '\0');
    }
    else
    {
        Summary.FolderName = "";
    }
    UPKStream.read(reinterpret_cast<char*>(&Summary.PackageFlags), 4);
    Summary.NameCountOffset = UPKStream.tellg();
    UPKStream.read(reinterpret_cast<char*>(&Summary.NameCount), 4);
    UPKStream.read(reinterpret_cast<char*>(&Summary.NameOffset), 4);
    UPKStream.read(reinterpret_cast<char*>(&Summary.ExportCount), 4);
    UPKStream.read(reinterpret_cast<char*>(&Summary.ExportOffset), 4);
    UPKStream.read(reinterpret_cast<char*>(&Summary.ImportCount), 4);
    UPKStream.read(reinterpret_cast<char*>(&Summary.ImportOffset), 4);
    UPKStream.read(reinterpret_cast<char*>(&Summary.DependsOffset), 4);
    UPKStream.read(reinterpret_cast<char*>(&Summary.SerialOffset), 4);
    UPKStream.read(reinterpret_cast<char*>(&Summary.Unknown2), 4);
    UPKStream.read(reinterpret_cast<char*>(&Summary.Unknown3), 4);
    UPKStream.read(reinterpret_cast<char*>(&Summary.Unknown4), 4);
    UPKStream.read(reinterpret_cast<char*>(&Summary.GUID), sizeof(Summary.GUID));
    UPKStream.read(reinterpret_cast<char*>(&Summary.GenerationsCount), 4);
    Summary.Generations.clear();
    for (unsigned i = 0; i < Summary.GenerationsCount; ++i)
    {
        FGenerationInfo EntryToRead;
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.ExportCount), 4);
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.NameCount), 4);
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.NetObjectCount), 4);
        Summary.Generations.push_back(EntryToRead);
    }
    UPKStream.read(reinterpret_cast<char*>(&Summary.EngineVersion), 4);
    UPKStream.read(reinterpret_cast<char*>(&Summary.CookerVersion), 4);
    UPKStream.read(reinterpret_cast<char*>(&Summary.CompressionFlags), 4);
    UPKStream.read(reinterpret_cast<char*>(&Summary.NumCompressedChunks), 4);
    Compressed = ((Summary.NumCompressedChunks > 0) || (Summary.CompressionFlags != 0));
    LogDebug("Reading CompressedChunks...");
    Summary.CompressedChunks.clear();
    for (unsigned i = 0; i < Summary.NumCompressedChunks; ++i)
    {
        FCompressedChunk CompressedChunk;
        UPKStream.read(reinterpret_cast<char*>(&CompressedChunk.UncompressedOffset), 4);
        UPKStream.read(reinterpret_cast<char*>(&CompressedChunk.UncompressedSize), 4);
        UPKStream.read(reinterpret_cast<char*>(&CompressedChunk.CompressedOffset), 4);
        UPKStream.read(reinterpret_cast<char*>(&CompressedChunk.CompressedSize), 4);
        Summary.CompressedChunks.push_back(CompressedChunk);
    }
    LogDebug("Reading UnknownDataChunk...");
    Summary.UnknownDataChunk.clear();
    /// for uncompressed packages unknown data is located between NumCompressedChunks and NameTable
    if (Summary.NumCompressedChunks < 1 && Summary.NameOffset - UPKStream.tellg() > 0)
    {
        Summary.UnknownDataChunk.resize(Summary.NameOffset - UPKStream.tellg());
    }
    /// for compressed packages unknown data is located between last CompressedChunk entry and first compressed data
    else if (Summary.NumCompressedChunks > 0 && Summary.CompressedChunks[0].CompressedOffset - UPKStream.tellg() > 0)
    {
        Summary.UnknownDataChunk.resize(Summary.CompressedChunks[0].CompressedOffset - UPKStream.tellg());
    }
    if (Summary.UnknownDataChunk.size() > 0)
    {
        UPKStream.read(Summary.UnknownDataChunk.data(), Summary.UnknownDataChunk.size());
    }
    if (Compressed == true)
    {
        LogDebug("Package is compressed, decompressing...");
        if (!Decompress())
        {
            LogErrorState(UPKReadErrors::IsCompressed);
            return false;
        }
        return true;
    }
    LogDebug("Reading NameTable...");
    NameTable.clear();
    UPKStream.seekg(Summary.NameOffset);
    for (unsigned i = 0; i < Summary.NameCount; ++i)
    {
        FNameEntry EntryToRead;
        EntryToRead.EntryOffset = UPKStream.tellg();
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.NameLength), 4);
        if (EntryToRead.NameLength > 0)
        {
            getline(UPKStream, EntryToRead.Name, '\0');
        }
        else
        {
            EntryToRead.Name = "";
        }
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.NameFlagsL), 4);
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.NameFlagsH), 4);
        EntryToRead.EntrySize = (unsigned)UPKStream.tellg() - EntryToRead.EntryOffset;
        NameTable.push_back(EntryToRead);
        if (EntryToRead.Name == "None")
            NoneIdx = i;
    }
    LogDebug("Reading ImportTable...");
    ImportTable.clear();
    UPKStream.seekg(Summary.ImportOffset);
    ImportTable.push_back(FObjectImport()); /// null object (default zero-initialization)
    for (unsigned i = 0; i < Summary.ImportCount; ++i)
    {
        FObjectImport EntryToRead;
        EntryToRead.EntryOffset = UPKStream.tellg();
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.PackageIdx), sizeof(EntryToRead.PackageIdx));
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.TypeIdx), sizeof(EntryToRead.TypeIdx));
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.OwnerRef), sizeof(EntryToRead.OwnerRef));
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.NameIdx), sizeof(EntryToRead.NameIdx));
        EntryToRead.EntrySize = (unsigned)UPKStream.tellg() - EntryToRead.EntryOffset;
        ImportTable.push_back(EntryToRead);
    }
    LogDebug("Reading ExportTable...");
    ExportTable.clear();
    UPKStream.seekg(Summary.ExportOffset);
    ExportTable.push_back(FObjectExport()); /// null-object
    for (unsigned i = 0; i < Summary.ExportCount; ++i)
    {
        FObjectExport EntryToRead;
        EntryToRead.EntryOffset = UPKStream.tellg();
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.TypeRef), sizeof(EntryToRead.TypeRef));
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.ParentClassRef), sizeof(EntryToRead.ParentClassRef));
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.OwnerRef), sizeof(EntryToRead.OwnerRef));
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.NameIdx), sizeof(EntryToRead.NameIdx));
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.ArchetypeRef), sizeof(EntryToRead.ArchetypeRef));
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.ObjectFlagsH), sizeof(EntryToRead.ObjectFlagsH));
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.ObjectFlagsL), sizeof(EntryToRead.ObjectFlagsL));
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.SerialSize), sizeof(EntryToRead.SerialSize));
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.SerialOffset), sizeof(EntryToRead.SerialOffset));
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.ExportFlags), sizeof(EntryToRead.ExportFlags));
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.NetObjectCount), sizeof(EntryToRead.NetObjectCount));
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.GUID), sizeof(EntryToRead.GUID));
        UPKStream.read(reinterpret_cast<char*>(&EntryToRead.Unknown1), sizeof(EntryToRead.Unknown1));
        EntryToRead.NetObjects.resize(EntryToRead.NetObjectCount);
        if (EntryToRead.NetObjectCount > 0)
        {
            UPKStream.read(reinterpret_cast<char*>(EntryToRead.NetObjects.data()), EntryToRead.NetObjects.size()*4);
        }
        EntryToRead.EntrySize = (unsigned)UPKStream.tellg() - EntryToRead.EntryOffset;
        ExportTable.push_back(EntryToRead);
    }
    LogDebug("Reading DependsBuf...");
    DependsBuf.clear();
    DependsBuf.resize(Summary.SerialOffset - Summary.DependsOffset);
    if (DependsBuf.size() > 0)
    {
        UPKStream.read(DependsBuf.data(), DependsBuf.size());
    }
    /// resolve names
    LogDebug("Resolving ImportTable names...");
    for (unsigned i = 1; i < ImportTable.size(); ++i)
    {
        ImportTable[i].Name = IndexToName(ImportTable[i].NameIdx);
        ImportTable[i].FullName = ResolveFullName(-i);
        ImportTable[i].Type = IndexToName(ImportTable[i].TypeIdx);
        if (ImportTable[i].Type == "")
        {
            ImportTable[i].Type = "Class";
        }
    }
    LogDebug("Resolving ExportTable names...");
    for (unsigned i = 1; i < ExportTable.size(); ++i)
    {
        ExportTable[i].Name = IndexToName(ExportTable[i].NameIdx);
        ExportTable[i].FullName = ResolveFullName(i);
        ExportTable[i].Type = ObjRefToName(ExportTable[i].TypeRef);
        if (ExportTable[i].Type == "")
        {
            ExportTable[i].Type = "Class";
        }
    }
    LogDebug("Package header read successfully.");
    UPKFileSize = UPKStream.str().size();
    return true;
}
Exemplo n.º 17
0
UPKReader::~UPKReader()
{
    ClearObjects();
    _UnregisterPackage(PackageName);
    LogDebug("Package " + PackageName + " unregistered.");
}