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

@ -1,12 +1,12 @@
/** /**
** Supermodel ** Supermodel
** A Sega Model 3 Arcade Emulator. ** A Sega Model 3 Arcade Emulator.
** Copyright 2011-2016 Bart Trzynadlowski, Nik Henson ** Copyright 2011-2016 Bart Trzynadlowski, Nik Henson
** **
** This file is part of Supermodel. ** This file is part of Supermodel.
** **
** Supermodel is free software: you can redistribute it and/or modify it under ** Supermodel is free software: you can redistribute it and/or modify it under
** the terms of the GNU General Public License as published by the Free ** the terms of the GNU General Public License as published by the Free
** Software Foundation, either version 3 of the License, or (at your option) ** Software Foundation, either version 3 of the License, or (at your option)
** any later version. ** any later version.
** **
@ -18,10 +18,10 @@
** You should have received a copy of the GNU General Public License along ** You should have received a copy of the GNU General Public License along
** with Supermodel. If not, see <http://www.gnu.org/licenses/>. ** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/ **/
/* /*
* Model3GraphicsState.h * Model3GraphicsState.h
* *
* Minimalistic implementation of IEmulator designed to load and view graphics * Minimalistic implementation of IEmulator designed to load and view graphics
* state. * state.
*/ */
@ -52,7 +52,7 @@ public:
void SaveState(CBlockFile *SaveState) override void SaveState(CBlockFile *SaveState) override
{ {
} }
void LoadState(CBlockFile *SaveState) override void LoadState(CBlockFile *SaveState) override
{ {
m_real3D.LoadState(SaveState); m_real3D.LoadState(SaveState);
@ -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