mirror of https://github.com/AxioDL/metaforce.git
Merge branch 'master' of ssh://gitlab.axiodl.com:6431/AxioDL/urde
This commit is contained in:
commit
a29cca3c47
|
@ -11,6 +11,7 @@
|
||||||
#include "Audio/CStreamAudioManager.hpp"
|
#include "Audio/CStreamAudioManager.hpp"
|
||||||
#include "Graphics/CMoviePlayer.hpp"
|
#include "Graphics/CMoviePlayer.hpp"
|
||||||
#include "CStateManager.hpp"
|
#include "CStateManager.hpp"
|
||||||
|
#include "hecl/CVarManager.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -26,7 +27,8 @@ static const SGameOption VisorOpts[] =
|
||||||
|
|
||||||
static const SGameOption DisplayOpts[] =
|
static const SGameOption DisplayOpts[] =
|
||||||
{
|
{
|
||||||
{EGameOption::ScreenBrightness, 25, 0.f, 8.f, 1.f, EOptionType::Float},
|
//{EGameOption::ScreenBrightness, 25, 0.f, 8.f, 1.f, EOptionType::Float},
|
||||||
|
{EGameOption::ScreenBrightness, 25, -100.f, 100.f, 1.f, EOptionType::Float},
|
||||||
{EGameOption::ScreenOffsetX, 26, -30.f, 30.f, 1.f, EOptionType::Float},
|
{EGameOption::ScreenOffsetX, 26, -30.f, 30.f, 1.f, EOptionType::Float},
|
||||||
{EGameOption::ScreenOffsetY, 27, -30.f, 30.f, 1.f, EOptionType::Float},
|
{EGameOption::ScreenOffsetY, 27, -30.f, 30.f, 1.f, EOptionType::Float},
|
||||||
{EGameOption::ScreenStretch, 28, -10.f, 10.f, 1.f, EOptionType::Float},
|
{EGameOption::ScreenStretch, 28, -10.f, 10.f, 1.f, EOptionType::Float},
|
||||||
|
@ -243,14 +245,32 @@ void CGameOptions::InitSoundMode()
|
||||||
/* If system is mono, force x44 to mono, otherwise honor user preference */
|
/* If system is mono, force x44 to mono, otherwise honor user preference */
|
||||||
}
|
}
|
||||||
static float BrightnessCopyFilter = 0.f;
|
static float BrightnessCopyFilter = 0.f;
|
||||||
void CGameOptions::SetScreenBrightness(s32 val, bool b)
|
void CGameOptions::SetScreenBrightness(s32 val, bool apply)
|
||||||
{
|
{
|
||||||
x48_screenBrightness = zeus::clamp(0, val, 8);
|
x48_screenBrightness = zeus::clamp(0, val, 8);
|
||||||
|
|
||||||
if (b)
|
if (apply)
|
||||||
BrightnessCopyFilter = TuneScreenBrightness();
|
BrightnessCopyFilter = TuneScreenBrightness();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGameOptions::ApplyGamma()
|
||||||
|
{
|
||||||
|
float gammaT = -m_gamma / 100.f + 1.f;
|
||||||
|
if (gammaT < 1.f)
|
||||||
|
gammaT = gammaT * 0.5f + 0.5f;
|
||||||
|
if (zeus::close_enough(gammaT, 1.f, 0.05f))
|
||||||
|
gammaT = 1.f;
|
||||||
|
CGraphics::g_BooFactory->setDisplayGamma(gammaT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::SetGamma(s32 val, bool apply)
|
||||||
|
{
|
||||||
|
m_gamma = zeus::clamp(-100, val, 100);
|
||||||
|
|
||||||
|
if (apply)
|
||||||
|
ApplyGamma();
|
||||||
|
}
|
||||||
|
|
||||||
void CGameOptions::SetScreenPositionX(s32 pos, bool apply)
|
void CGameOptions::SetScreenPositionX(s32 pos, bool apply)
|
||||||
{
|
{
|
||||||
x4c_screenXOffset = zeus::clamp(-30, pos, 30);
|
x4c_screenXOffset = zeus::clamp(-30, pos, 30);
|
||||||
|
@ -414,6 +434,7 @@ void CGameOptions::ResetControllerAssets(int controls)
|
||||||
void CGameOptions::EnsureSettings()
|
void CGameOptions::EnsureSettings()
|
||||||
{
|
{
|
||||||
SetScreenBrightness(x48_screenBrightness, true);
|
SetScreenBrightness(x48_screenBrightness, true);
|
||||||
|
SetGamma(m_gamma, true);
|
||||||
SetScreenPositionX(x4c_screenXOffset, true);
|
SetScreenPositionX(x4c_screenXOffset, true);
|
||||||
SetScreenPositionY(x50_screenYOffset, true);
|
SetScreenPositionY(x50_screenYOffset, true);
|
||||||
SetScreenStretch(x54_screenStretch, true);
|
SetScreenStretch(x54_screenStretch, true);
|
||||||
|
@ -462,6 +483,7 @@ void CGameOptions::TryRestoreDefaults(const CFinalInput& input, int category,
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
gameOptions.SetScreenBrightness(4, true);
|
gameOptions.SetScreenBrightness(4, true);
|
||||||
|
gameOptions.SetGamma(0, true);
|
||||||
gameOptions.SetScreenPositionX(0, true);
|
gameOptions.SetScreenPositionX(0, true);
|
||||||
gameOptions.SetScreenPositionY(0, true);
|
gameOptions.SetScreenPositionY(0, true);
|
||||||
gameOptions.SetScreenStretch(0, true);
|
gameOptions.SetScreenStretch(0, true);
|
||||||
|
@ -502,7 +524,7 @@ void CGameOptions::SetOption(EGameOption option, int value)
|
||||||
options.SetIsHintSystemEnabled(value);
|
options.SetIsHintSystemEnabled(value);
|
||||||
break;
|
break;
|
||||||
case EGameOption::ScreenBrightness:
|
case EGameOption::ScreenBrightness:
|
||||||
options.SetScreenBrightness(value, true);
|
options.SetGamma(value, true);
|
||||||
break;
|
break;
|
||||||
case EGameOption::ScreenOffsetX:
|
case EGameOption::ScreenOffsetX:
|
||||||
options.SetScreenPositionX(value, true);
|
options.SetScreenPositionX(value, true);
|
||||||
|
@ -550,7 +572,7 @@ int CGameOptions::GetOption(EGameOption option)
|
||||||
case EGameOption::HintSystem:
|
case EGameOption::HintSystem:
|
||||||
return options.GetIsHintSystemEnabled();
|
return options.GetIsHintSystemEnabled();
|
||||||
case EGameOption::ScreenBrightness:
|
case EGameOption::ScreenBrightness:
|
||||||
return options.GetScreenBrightness();
|
return options.GetGamma();
|
||||||
case EGameOption::ScreenOffsetX:
|
case EGameOption::ScreenOffsetX:
|
||||||
return options.GetScreenPositionX();
|
return options.GetScreenPositionX();
|
||||||
case EGameOption::ScreenOffsetY:
|
case EGameOption::ScreenOffsetY:
|
||||||
|
|
|
@ -129,6 +129,8 @@ class CGameOptions
|
||||||
u32 x60_hudAlpha = 0xff;
|
u32 x60_hudAlpha = 0xff;
|
||||||
u32 x64_helmetAlpha = 0xff;
|
u32 x64_helmetAlpha = 0xff;
|
||||||
|
|
||||||
|
s32 m_gamma = 0;
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
|
@ -155,6 +157,9 @@ public:
|
||||||
float TuneScreenBrightness();
|
float TuneScreenBrightness();
|
||||||
void SetScreenBrightness(s32, bool);
|
void SetScreenBrightness(s32, bool);
|
||||||
s32 GetScreenBrightness() const { return x48_screenBrightness; }
|
s32 GetScreenBrightness() const { return x48_screenBrightness; }
|
||||||
|
void ApplyGamma();
|
||||||
|
void SetGamma(s32, bool);
|
||||||
|
s32 GetGamma() const { return m_gamma; }
|
||||||
void SetScreenPositionX(s32, bool);
|
void SetScreenPositionX(s32, bool);
|
||||||
s32 GetScreenPositionX() const { return x4c_screenXOffset; }
|
s32 GetScreenPositionX() const { return x4c_screenXOffset; }
|
||||||
void SetScreenPositionY(s32, bool);
|
void SetScreenPositionY(s32, bool);
|
||||||
|
|
|
@ -793,13 +793,18 @@ void CBooRenderer::UpdateAreaUniforms(int areaIdx, bool shadowRender)
|
||||||
SetupRendererStates();
|
SetupRendererStates();
|
||||||
|
|
||||||
CModelFlags flags;
|
CModelFlags flags;
|
||||||
|
int bufIdx;
|
||||||
if (shadowRender)
|
if (shadowRender)
|
||||||
{
|
{
|
||||||
flags.m_extendedShader = EExtendedShader::SolidColor;
|
flags.m_extendedShader = EExtendedShader::SolidColor;
|
||||||
flags.x4_color = zeus::CColor::skBlack;
|
flags.x4_color = zeus::CColor::skBlack;
|
||||||
|
bufIdx = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||||
|
bufIdx = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (CAreaListItem& item : x1c_areaListItems)
|
for (CAreaListItem& item : x1c_areaListItems)
|
||||||
{
|
{
|
||||||
|
@ -807,7 +812,7 @@ void CBooRenderer::UpdateAreaUniforms(int areaIdx, bool shadowRender)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
item.m_shaderSet->m_geomLayout->Update(flags, nullptr, nullptr, &item.m_shaderSet->m_matSet,
|
item.m_shaderSet->m_geomLayout->Update(flags, nullptr, nullptr, &item.m_shaderSet->m_matSet,
|
||||||
item.m_shaderSet->m_geomLayout->m_sharedBuffer[shadowRender]);
|
item.m_shaderSet->m_geomLayout->m_sharedBuffer[bufIdx]);
|
||||||
|
|
||||||
for (auto it = item.x10_models.begin(); it != item.x10_models.end(); ++it)
|
for (auto it = item.x10_models.begin(); it != item.x10_models.end(); ++it)
|
||||||
{
|
{
|
||||||
|
@ -815,7 +820,7 @@ void CBooRenderer::UpdateAreaUniforms(int areaIdx, bool shadowRender)
|
||||||
if (model->TryLockTextures())
|
if (model->TryLockTextures())
|
||||||
{
|
{
|
||||||
ActivateLightsForModel(&item, *model);
|
ActivateLightsForModel(&item, *model);
|
||||||
model->UpdateUniformData(flags, nullptr, nullptr, shadowRender);
|
model->UpdateUniformData(flags, nullptr, nullptr, bufIdx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,7 @@ private:
|
||||||
zeus::CMatrix4f m_proj;
|
zeus::CMatrix4f m_proj;
|
||||||
zeus::CMatrix4f m_texMtxs[9]; // Pad out to 768 bytes
|
zeus::CMatrix4f m_texMtxs[9]; // Pad out to 768 bytes
|
||||||
CModelShaders::LightingUniform m_lighting;
|
CModelShaders::LightingUniform m_lighting;
|
||||||
|
zeus::CVector3f m_pad; // Pad out to 768 bytes
|
||||||
};
|
};
|
||||||
|
|
||||||
std::experimental::optional<TLockedToken<CTexture>> m_patternTex1;
|
std::experimental::optional<TLockedToken<CTexture>> m_patternTex1;
|
||||||
|
|
|
@ -7,11 +7,13 @@ namespace urde
|
||||||
CTexturedQuadFilter::CTexturedQuadFilter(const boo::ObjToken<boo::ITexture>& tex)
|
CTexturedQuadFilter::CTexturedQuadFilter(const boo::ObjToken<boo::ITexture>& tex)
|
||||||
: m_booTex(tex)
|
: m_booTex(tex)
|
||||||
{
|
{
|
||||||
|
m_flipRect = CGraphics::g_BooFactory->platform() == boo::IGraphicsDataFactory::Platform::Vulkan;
|
||||||
}
|
}
|
||||||
|
|
||||||
CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, const boo::ObjToken<boo::ITexture>& tex, bool gequal)
|
CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, const boo::ObjToken<boo::ITexture>& tex, bool gequal)
|
||||||
: m_booTex(tex), m_gequal(gequal)
|
: m_booTex(tex), m_gequal(gequal)
|
||||||
{
|
{
|
||||||
|
m_flipRect = CGraphics::g_BooFactory->platform() == boo::IGraphicsDataFactory::Platform::Vulkan;
|
||||||
tex->setClampMode(boo::TextureClampMode::ClampToEdge);
|
tex->setClampMode(boo::TextureClampMode::ClampToEdge);
|
||||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
|
@ -26,6 +28,7 @@ CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type,
|
||||||
TLockedToken<CTexture> tex)
|
TLockedToken<CTexture> tex)
|
||||||
: CTexturedQuadFilter(type, (tex ? tex->GetBooTexture() : nullptr))
|
: CTexturedQuadFilter(type, (tex ? tex->GetBooTexture() : nullptr))
|
||||||
{
|
{
|
||||||
|
m_flipRect = CGraphics::g_BooFactory->platform() == boo::IGraphicsDataFactory::Platform::Vulkan;
|
||||||
m_tex = tex;
|
m_tex = tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,10 +43,20 @@ void CTexturedQuadFilter::draw(const zeus::CColor& color, float uvScale, const z
|
||||||
};
|
};
|
||||||
m_vbo->load(verts, sizeof(verts));
|
m_vbo->load(verts, sizeof(verts));
|
||||||
|
|
||||||
m_uniform.m_matrix[0][0] = rect.size.x * 2.f;
|
if (!m_flipRect)
|
||||||
m_uniform.m_matrix[1][1] = rect.size.y * 2.f;
|
{
|
||||||
m_uniform.m_matrix[3][0] = rect.position.x * 2.f - 1.f;
|
m_uniform.m_matrix[0][0] = rect.size.x * 2.f;
|
||||||
m_uniform.m_matrix[3][1] = rect.position.y * 2.f - 1.f;
|
m_uniform.m_matrix[1][1] = rect.size.y * 2.f;
|
||||||
|
m_uniform.m_matrix[3][0] = rect.position.x * 2.f - 1.f;
|
||||||
|
m_uniform.m_matrix[3][1] = rect.position.y * 2.f - 1.f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_uniform.m_matrix[0][0] = rect.size.x * 2.f;
|
||||||
|
m_uniform.m_matrix[1][1] = rect.size.y * -2.f;
|
||||||
|
m_uniform.m_matrix[3][0] = rect.position.x * 2.f - 1.f;
|
||||||
|
m_uniform.m_matrix[3][1] = rect.position.y * -2.f + 1.f;
|
||||||
|
}
|
||||||
m_uniform.m_color = color;
|
m_uniform.m_color = color;
|
||||||
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ protected:
|
||||||
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||||
Uniform m_uniform;
|
Uniform m_uniform;
|
||||||
bool m_gequal;
|
bool m_gequal;
|
||||||
|
bool m_flipRect = false;
|
||||||
|
|
||||||
CTexturedQuadFilter(const boo::ObjToken<boo::ITexture>& tex);
|
CTexturedQuadFilter(const boo::ObjToken<boo::ITexture>& tex);
|
||||||
|
|
||||||
|
|
|
@ -500,6 +500,7 @@ void CMain::UpdateDiscordPresence(CAssetId worldSTRG)
|
||||||
DiscordRichPresence discordPresence = {};
|
DiscordRichPresence discordPresence = {};
|
||||||
discordPresence.state = DiscordState.c_str();
|
discordPresence.state = DiscordState.c_str();
|
||||||
discordPresence.details = DiscordWorldName.c_str();
|
discordPresence.details = DiscordWorldName.c_str();
|
||||||
|
discordPresence.largeImageKey = "default";
|
||||||
discordPresence.startTimestamp = DiscordStartTime;
|
discordPresence.startTimestamp = DiscordStartTime;
|
||||||
Discord_UpdatePresence(&discordPresence);
|
Discord_UpdatePresence(&discordPresence);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue