Skip to content

Commit

Permalink
Completely remove AtexAsm.
Browse files Browse the repository at this point in the history
Signed-off-by: Khral Steelforge <[email protected]>
  • Loading branch information
kytulendu committed Jan 7, 2014
1 parent 856693e commit a075516
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 47 deletions.
1 change: 0 additions & 1 deletion prj/Gw2Browser.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
<ClInclude Include="..\src\DatIndex.h" />
<ClInclude Include="..\src\Gw2Browser.h" />
<ClInclude Include="..\src\Identifiers\BaseIdentifier.h" />
<ClInclude Include="..\src\Imported\AtexAsm.h" />
<ClInclude Include="..\src\Imported\crc.h" />
<ClInclude Include="..\src\Imported\half.h" />
<ClInclude Include="..\src\PackFile.h" />
Expand Down
3 changes: 0 additions & 3 deletions prj/Gw2Browser.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@
<ClInclude Include="..\src\resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\Imported\AtexAsm.h">
<Filter>Header Files\Imported</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\stdafx.cpp">
Expand Down
20 changes: 0 additions & 20 deletions src/Imported/AtexAsm.h

This file was deleted.

33 changes: 10 additions & 23 deletions src/Readers/ImageReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/

/*
Copyright (C) 2012 Rhoot <https://github.com/rhoot>
Copyright (C) 2014 Khral Steelforge <https://github.com/kytulendu>
Copyright (C) 2012 Rhoot <https://github.com/rhoot>
This file is part of Gw2Browser.
Expand All @@ -26,11 +26,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
#include <wx/mstream.h>

#include "Imported/AtexAsm.h"
#include "ImageReader.h"

#ifdef RGB
# undef RGB
#undef RGB
#endif

namespace gw2b {
Expand Down Expand Up @@ -268,51 +267,39 @@ namespace gw2b {
return false;
}

// Create and init
::SImageDescriptor descriptor;
descriptor.xres = atex->width;
descriptor.yres = atex->height;
descriptor.Data = m_data.GetPointer( );
descriptor.imageformat = 0xf;
descriptor.a = m_data.GetSize( );
descriptor.b = 6;
descriptor.c = 0;

// Init some fields
//auto data = reinterpret_cast<const uint*>( m_data.GetPointer( ) );
auto data = reinterpret_cast<const uint8_t*>( m_data.GetPointer( ) );
po_colors = nullptr;
po_alphas = nullptr;

// Allocate output
auto output = allocate<BGRA>( atex->width * atex->height );
descriptor.image = reinterpret_cast<unsigned char*>( output );

// Fix me
uint32_t aOutBufferSize = 1024 * 1024 * 30; // We make the assumption that no file is bigger than 30 Mb
uint32_t outputBufferSize = 1024 * 1024 * 30; // We make the assumption that no file is bigger than 30 Mb

// Uncompress
switch ( atex->formatInteger ) {
case FCC_DXT1:
gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), descriptor.Data, aOutBufferSize, descriptor.image );
gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), data, outputBufferSize, reinterpret_cast<uint8_t*>( output ) );
this->processDXT1( output, atex->width, atex->height, po_colors, po_alphas );
break;
case FCC_DXT2:
case FCC_DXT3:
case FCC_DXTN:
gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), descriptor.Data, aOutBufferSize, descriptor.image );
gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), data, outputBufferSize, reinterpret_cast<uint8_t*>( output ) );
this->processDXT3( output, atex->width, atex->height, po_colors, po_alphas );
break;
case FCC_DXT4:
case FCC_DXT5:
gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), descriptor.Data, aOutBufferSize, descriptor.image );
gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), data, outputBufferSize, reinterpret_cast<uint8_t*>( output ) );
this->processDXT5( output, atex->width, atex->height, po_colors, po_alphas );
break;
case FCC_DXTA:
gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), descriptor.Data, aOutBufferSize, descriptor.image );
gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), data, outputBufferSize, reinterpret_cast<uint8_t*>( output ) );
this->processDXTA( reinterpret_cast<uint64*>( output ), atex->width, atex->height, po_colors );
break;
case FCC_DXTL:
gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), descriptor.Data, aOutBufferSize, descriptor.image );
gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), data, outputBufferSize, reinterpret_cast<uint8_t*>( output ) );
this->processDXT5( output, atex->width, atex->height, po_colors, po_alphas );

for ( uint i = 0; i < ( static_cast<uint>( atex->width ) * static_cast<uint>( atex->height ) ); i++ ) {
Expand All @@ -322,7 +309,7 @@ namespace gw2b {
}
break;
case FCC_3DCX:
gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), descriptor.Data, aOutBufferSize, descriptor.image );
gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), data, outputBufferSize, reinterpret_cast<uint8_t*>( output ) );
this->process3DCX( reinterpret_cast<RGBA*>( output ), atex->width, atex->height, po_colors, po_alphas );
break;
default:
Expand Down

0 comments on commit a075516

Please sign in to comment.