mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
Calculate movie aspect ratio using vertices (#84)
This commit is contained in:
parent
4b7f2c0ae7
commit
666f93843d
2 changed files with 23 additions and 4 deletions
|
|
@ -7,8 +7,23 @@ namespace SWA
|
||||||
class CMovieDisplayer : public Hedgehog::Universe::CUpdateUnit, public Hedgehog::Mirage::CRenderable
|
class CMovieDisplayer : public Hedgehog::Universe::CUpdateUnit, public Hedgehog::Mirage::CRenderable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
struct SVertexData
|
||||||
|
{
|
||||||
|
be<float> X;
|
||||||
|
be<float> Y;
|
||||||
|
be<float> Z;
|
||||||
|
be<float> U;
|
||||||
|
be<float> V;
|
||||||
|
};
|
||||||
|
|
||||||
SWA_INSERT_PADDING(0x04);
|
SWA_INSERT_PADDING(0x04);
|
||||||
be<uint32_t> m_MovieWidth;
|
be<uint32_t> m_MovieWidth;
|
||||||
be<uint32_t> m_MovieHeight;
|
be<uint32_t> m_MovieHeight;
|
||||||
|
SWA_INSERT_PADDING(0x74);
|
||||||
|
SVertexData m_TopLeft;
|
||||||
|
SVertexData m_TopRight;
|
||||||
|
SVertexData m_BottomRight;
|
||||||
|
SVertexData m_BottomLeft;
|
||||||
|
SWA_INSERT_PADDING(0xF0);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,20 @@ using SVertexData = SWA::Sequence::Utility::CPlayMovieWrapper::CRender::SVertexD
|
||||||
PPC_FUNC_IMPL(__imp__sub_82AE30D8);
|
PPC_FUNC_IMPL(__imp__sub_82AE30D8);
|
||||||
PPC_FUNC(sub_82AE30D8)
|
PPC_FUNC(sub_82AE30D8)
|
||||||
{
|
{
|
||||||
auto movieWidth = *(be<float>*)g_memory.Translate(ctx.r4.u32 - 0x10);
|
auto pViewportWidth = (be<uint32_t>*)g_memory.Translate(ctx.r4.u32 + 0x14);
|
||||||
auto movieHeight = *(be<float>*)g_memory.Translate(ctx.r4.u32 - 0x0C);
|
auto pViewportHeight = (be<uint32_t>*)g_memory.Translate(ctx.r4.u32 + 0x18);
|
||||||
auto movieAspectRatio = movieWidth / movieHeight;
|
|
||||||
auto windowAspectRatio = (float)GameWindow::s_width / (float)GameWindow::s_height;
|
|
||||||
|
|
||||||
auto pTopLeft = (SVertexData*)g_memory.Translate(ctx.r4.u32 + 0x6C);
|
auto pTopLeft = (SVertexData*)g_memory.Translate(ctx.r4.u32 + 0x6C);
|
||||||
auto pTopRight = (SVertexData*)g_memory.Translate(ctx.r4.u32 + 0x6C + sizeof(SVertexData));
|
auto pTopRight = (SVertexData*)g_memory.Translate(ctx.r4.u32 + 0x6C + sizeof(SVertexData));
|
||||||
auto pBottomRight = (SVertexData*)g_memory.Translate(ctx.r4.u32 + 0x6C + sizeof(SVertexData) * 2);
|
auto pBottomRight = (SVertexData*)g_memory.Translate(ctx.r4.u32 + 0x6C + sizeof(SVertexData) * 2);
|
||||||
auto pBottomLeft = (SVertexData*)g_memory.Translate(ctx.r4.u32 + 0x6C + sizeof(SVertexData) * 3);
|
auto pBottomLeft = (SVertexData*)g_memory.Translate(ctx.r4.u32 + 0x6C + sizeof(SVertexData) * 3);
|
||||||
|
|
||||||
|
auto quadWidth = std::fabs(pTopRight->X - pTopLeft->X) * ((float)*pViewportWidth / 2);
|
||||||
|
auto quadHeight = std::fabs(pTopLeft->Y - pBottomLeft->Y) * ((float)*pViewportHeight / 2);
|
||||||
|
|
||||||
|
auto movieAspectRatio = quadWidth / quadHeight;
|
||||||
|
auto windowAspectRatio = (float)GameWindow::s_width / (float)GameWindow::s_height;
|
||||||
|
|
||||||
auto a = -1.00078f;
|
auto a = -1.00078f;
|
||||||
auto b = 1.00139f;
|
auto b = 1.00139f;
|
||||||
auto scaleU = 1.0f;
|
auto scaleU = 1.0f;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue