Fixed graphics analysis -gfx-state option

This commit is contained in:
Bart Trzynadlowski 2023-11-11 13:55:02 -08:00
parent a57b379498
commit 47253d8398
2 changed files with 16 additions and 10 deletions

View file

@ -116,7 +116,7 @@ public:
else else
rom_set.get_rom("vrom").CopyTo(m_vrom.get(), 64*0x100000); rom_set.get_rom("vrom").CopyTo(m_vrom.get(), 64*0x100000);
int stepping = ((m_game.stepping[0] - '0') << 4) | (m_game.stepping[2] - '0'); int stepping = ((m_game.stepping[0] - '0') << 4) | (m_game.stepping[2] - '0');
m_real3D.SetStepping(stepping, false); m_real3D.SetStepping(stepping);
return OKAY; return OKAY;
} }

View file

@ -547,6 +547,7 @@ void Screenshot()
#include <fstream> #include <fstream>
static std::string s_gfxStatePath; static std::string s_gfxStatePath;
static const std::string k_gfxAnalysisPath = "GraphicsAnalysis/";
static std::string GetFileBaseName(const std::string &file) static std::string GetFileBaseName(const std::string &file)
{ {
@ -603,7 +604,7 @@ static void TestPolygonHeaderBits(IEmulator *Emu)
if ((unknownPolyBits[idx] & mask)) if ((unknownPolyBits[idx] & mask))
{ {
Emu->RenderFrame(); Emu->RenderFrame();
std::string file = Util::Format() << s_analysisPath << GetFileBaseName(s_gfxStatePath) << "." << "poly" << "." << idx << "_" << Util::Hex(mask) << ".bmp"; std::string file = Util::Format() << k_gfxAnalysisPath << GetFileBaseName(s_gfxStatePath) << "." << "poly" << "." << idx << "_" << Util::Hex(mask) << ".bmp";
SaveFrameBuffer(file); SaveFrameBuffer(file);
} }
} }
@ -619,7 +620,7 @@ static void TestPolygonHeaderBits(IEmulator *Emu)
if ((unknownCullingNodeBits[idx] & mask)) if ((unknownCullingNodeBits[idx] & mask))
{ {
Emu->RenderFrame(); Emu->RenderFrame();
std::string file = Util::Format() << s_analysisPath << GetFileBaseName(s_gfxStatePath) << "." << "culling" << "." << idx << "_" << Util::Hex(mask) << ".bmp"; std::string file = Util::Format() << k_gfxAnalysisPath << GetFileBaseName(s_gfxStatePath) << "." << "culling" << "." << idx << "_" << Util::Hex(mask) << ".bmp";
SaveFrameBuffer(file); SaveFrameBuffer(file);
} }
} }
@ -628,7 +629,7 @@ static void TestPolygonHeaderBits(IEmulator *Emu)
glReadBuffer(readBuffer); glReadBuffer(readBuffer);
// Generate the HTML GUI // Generate the HTML GUI
std::string file = Util::Format() << s_analysisPath << "_" << GetFileBaseName(s_gfxStatePath) << ".html"; std::string file = Util::Format() << k_gfxAnalysisPath << "_" << GetFileBaseName(s_gfxStatePath) << ".html";
std::ofstream fs(file); std::ofstream fs(file);
if (!fs.good()) if (!fs.good())
ErrorLog("Unable to open '%s' for writing.", file.c_str()); ErrorLog("Unable to open '%s' for writing.", file.c_str());
@ -1603,8 +1604,13 @@ static void Help(void)
#ifdef SUPERMODEL_DEBUGGER #ifdef SUPERMODEL_DEBUGGER
puts(" -disable-debugger Completely disable debugger functionality"); puts(" -disable-debugger Completely disable debugger functionality");
puts(" -enter-debugger Enter debugger at start of emulation"); puts(" -enter-debugger Enter debugger at start of emulation");
puts("");
#endif // SUPERMODEL_DEBUGGER #endif // SUPERMODEL_DEBUGGER
#ifdef DEBUG
puts(" -gfx-state=<file> Produce graphics analysis for save state (works only");
puts(" with the legacy 3D engine and requires a");
puts(" GraphicsAnalysis directory to exist)");
#endif
puts("");
} }
struct ParsedCommandLine struct ParsedCommandLine