MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / DumpTexture

Method DumpTexture

Source/HLEGraphics/CachedTexture.cpp:334–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332
333#ifdef DAEDALUS_DEBUG_DISPLAYLIST
334void CachedTexture::DumpTexture( const TextureInfo & ti, const CNativeTexture * texture )
335{
336 DAEDALUS_ASSERT(texture != nullptr, "Should have a texture");
337
338 if( texture != nullptr && texture->HasData() )
339 {
340 IO::Filename filename;
341 IO::Filename filepath;
342 IO::Filename dumpdir;
343
344 IO::Path::Combine( dumpdir, g_ROM.settings.GameName.c_str(), "Textures" );
345
346 Dump_GetDumpDirectory( filepath, dumpdir );
347
348 sprintf( filename, "%08x-%s_%dbpp-%dx%d-%dx%d.png",
349 ti.GetLoadAddress(), ti.GetFormatName(), ti.GetSizeInBits(),
350 0, 0, // Left/Top
351 ti.GetWidth(), ti.GetHeight() );
352
353 IO::Path::Append( filepath, filename );
354
355 void * texels;
356 void * palette;
357
358 // Note that we re-convert the texels because those in the native texture may well already
359 // be swizzle. Maybe we should just have an unswizzle routine?
360 if( GenerateTexels( &texels, &palette, ti, texture->GetFormat(), texture->GetStride(), texture->GetBytesRequired() ) )
361 {
362 // NB - this does not include the mirrored texels
363
364 // NB we use the palette from the native texture. This is a total hack.
365 // We have to do this because the palette texels come from emulated tmem, rather
366 // than ram. This means that when we dump out the texture here, tmem won't necessarily
367 // contain our pixels.
368 const void * native_palette = texture->GetPalette();
369
370 PngSaveImage( filepath, texels, native_palette, texture->GetFormat(), texture->GetStride(), ti.GetWidth(), ti.GetHeight(), true );
371 }
372 }
373}
374#endif // DAEDALUS_DEBUG_DISPLAYLIST

Callers

nothing calls this directly

Calls 15

Dump_GetDumpDirectoryFunction · 0.85
GenerateTexelsFunction · 0.85
PngSaveImageFunction · 0.85
GetLoadAddressMethod · 0.80
GetFormatNameMethod · 0.80
GetSizeInBitsMethod · 0.80
CombineFunction · 0.50
AppendFunction · 0.50
HasDataMethod · 0.45
c_strMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected