| 332 | |
| 333 | #ifdef DAEDALUS_DEBUG_DISPLAYLIST |
| 334 | void 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 |
nothing calls this directly
no test coverage detected