Merge remote-tracking branch 'origin/main' into wgpu

# Conflicts:
#	extern/boo
This commit is contained in:
Luke Street 2022-02-08 03:46:22 -05:00
commit 5a41dab870
38 changed files with 621 additions and 442 deletions

View File

@ -768,8 +768,8 @@ def make_retro_shader_mp3_color():
input.default_value = (0.0, 0.0, 0.0, 1.0) input.default_value = (0.0, 0.0, 0.0, 1.0)
input = new_grp.inputs.new("NodeSocketInt", "Add INCA") input = new_grp.inputs.new("NodeSocketInt", "Add INCA")
input.default_value = 0 input.default_value = 0
input.min_value = 0.000000 input.min_value = 0
input.max_value = 1.000000 input.max_value = 1
input = new_grp.inputs.new("NodeSocketFloatFactor", "OPAC") input = new_grp.inputs.new("NodeSocketFloatFactor", "OPAC")
input.default_value = 1.0 input.default_value = 1.0
input.min_value = 0.000000 input.min_value = 0.000000
@ -1057,8 +1057,8 @@ def make_retro_shader_mp3_bloom():
input.max_value = 1.000000 input.max_value = 1.000000
input = new_grp.inputs.new("NodeSocketInt", "Add INCA") input = new_grp.inputs.new("NodeSocketInt", "Add INCA")
input.default_value = 0 input.default_value = 0
input.min_value = 0.000000 input.min_value = 0
input.max_value = 1.000000 input.max_value = 1
new_grp.outputs.new("NodeSocketShader", "Shader") new_grp.outputs.new("NodeSocketShader", "Shader")
nodes = {} nodes = {}
node = new_grp.nodes.new("ShaderNodeMath") node = new_grp.nodes.new("ShaderNodeMath")
@ -1261,8 +1261,8 @@ def make_retro_shader_mp3():
input.max_value = 1.000000 input.max_value = 1.000000
input = new_grp.inputs.new("NodeSocketInt", "Add INCA") input = new_grp.inputs.new("NodeSocketInt", "Add INCA")
input.default_value = 0 input.default_value = 0
input.min_value = 0.000000 input.min_value = 0
input.max_value = 1.000000 input.max_value = 1
input = new_grp.inputs.new("NodeSocketFloatFactor", "BNIF") input = new_grp.inputs.new("NodeSocketFloatFactor", "BNIF")
input.default_value = 0.0 input.default_value = 0.0
input.min_value = 0.000000 input.min_value = 0.000000

View File

@ -215,17 +215,19 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssoci
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdl); PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdl);
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskr); PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskr);
PAK::Entry* cinfEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cinf); PAK::Entry* cinfEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cinf);
cmdlEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_model"), id, ci.name); if (cmdlEnt != nullptr && cskrEnt != nullptr && cinfEnt != nullptr) {
cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_skin"), id, ci.name); cmdlEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_model"), id, ci.name);
cinfEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_skel"), id, ci.name); cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_skin"), id, ci.name);
if (ci.cmdlIce.isValid() && ci.cskrIce.isValid()) { cinfEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_skel"), id, ci.name);
charAssoc.m_cmdlRigs[ci.cmdlIce] = {ci.cskrIce, ci.cinf}; if (ci.cmdlIce.isValid() && ci.cskrIce.isValid()) {
charAssoc.m_cskrToCharacter[ci.cskrIce] = charAssoc.m_cmdlRigs[ci.cmdlIce] = {ci.cskrIce, ci.cinf};
std::make_pair(entry.id, fmt::format(FMT_STRING("{}.ICE_{}.CSKR"), ci.name, ci.cskrIce)); charAssoc.m_cskrToCharacter[ci.cskrIce] =
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlIce); std::make_pair(entry.id, fmt::format(FMT_STRING("{}.ICE_{}.CSKR"), ci.name, ci.cskrIce));
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrIce); PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlIce);
cmdlEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_icemodel"), id, ci.name); PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrIce);
cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_iceskin"), id, ci.name); cmdlEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_icemodel"), id, ci.name);
cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_iceskin"), id, ci.name);
}
} }
} }
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>> animInfo; std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>> animInfo;

View File

@ -338,7 +338,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
"cam.lens_unit = 'FOV'\n" "cam.lens_unit = 'FOV'\n"
"cam.clip_start = {}\n" "cam.clip_start = {}\n"
"cam.clip_end = {}\n" "cam.clip_end = {}\n"
"bpy.context.scene.render.resolution_x = 480 * {}\n"), "bpy.context.scene.render.resolution_x = int(480 * {})\n"),
proj->znear, proj->zfar, proj->aspect); proj->znear, proj->zfar, proj->aspect);
if (proj->aspect > 1.f) if (proj->aspect > 1.f)
os.format(FMT_STRING("cam.angle = math.atan2({}, 1.0 / math.tan(math.radians({} / 2.0))) * 2.0\n"), os.format(FMT_STRING("cam.angle = math.atan2({}, 1.0 / math.tan(math.radians({} / 2.0))) * 2.0\n"),

View File

@ -651,11 +651,16 @@ bool MREA::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
secs.emplace_back(preVisiLen, 0); secs.emplace_back(preVisiLen, 0);
memcpy(secs.back().data(), preVisiData.get(), preVisiLen); memcpy(secs.back().data(), preVisiData.get(), preVisiLen);
visiGood = true; visiGood = true;
} else {
// TODO: Fix visigen and remove this hack
secs.emplace_back(preVisiLen, 0);
memcpy(secs.back().data(), preVisiData.get(), preVisiLen);
visiGood = true;
} }
} }
} }
visiGood = true; // TODO: fix visigen so this can be re-enabled
#if 0
#if !WINDOWS_STORE #if !WINDOWS_STORE
if (!visiGood) { if (!visiGood) {
hecl::ProjectPath visiIntOut = outPath.getWithExtension(".visiint"); hecl::ProjectPath visiIntOut = outPath.getWithExtension(".visiint");
@ -723,6 +728,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
Log.report(logvisor::Fatal, FMT_STRING("Unable to launch {}"), VisiGenPath); Log.report(logvisor::Fatal, FMT_STRING("Unable to launch {}"), VisiGenPath);
} }
} }
#endif
#endif #endif
} }
} }

View File

@ -108,7 +108,7 @@ void SCLY::ScriptLayer::Enumerate<BigDNA::Read>(athena::io::IStreamReader& rs) {
[&type](const ScriptObjectSpec* obj) -> bool { return obj->type == type; }); [&type](const ScriptObjectSpec* obj) -> bool { return obj->type == type; });
if (iter != SCRIPT_OBJECT_DB.end()) { if (iter != SCRIPT_OBJECT_DB.end()) {
std::unique_ptr<IScriptObject> obj((*iter)->a()); std::unique_ptr<IScriptObject> obj((*iter)->loader());
obj->type = type; obj->type = type;
obj->read(rs); obj->read(rs);
objects.push_back(std::move(obj)); objects.push_back(std::move(obj));
@ -141,7 +141,7 @@ void SCLY::ScriptLayer::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& r
[&type](const ScriptObjectSpec* obj) -> bool { return obj->type == type; }); [&type](const ScriptObjectSpec* obj) -> bool { return obj->type == type; });
if (iter != SCRIPT_OBJECT_DB.end()) { if (iter != SCRIPT_OBJECT_DB.end()) {
std::unique_ptr<IScriptObject> obj((*iter)->a()); std::unique_ptr<IScriptObject> obj((*iter)->loader());
obj->read(rs); obj->read(rs);
obj->type = type; obj->type = type;
objects.push_back(std::move(obj)); objects.push_back(std::move(obj));

View File

@ -10,12 +10,12 @@ struct MazeNode : IScriptObject {
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;
Value<bool> unknown1; Value<bool> active;
Value<atUint32> unknown2; Value<atUint32> col;
Value<atUint32> unknown3; Value<atUint32> row;
Value<atUint32> unknown4; Value<atUint32> side;
Value<atVec3f> unknown5; Value<atVec3f> actorPos;
Value<atVec3f> unknown6; Value<atVec3f> triggerPos;
Value<atVec3f> unknown7; Value<atVec3f> effectPos;
}; };
} // namespace DataSpec::DNAMP1 } // namespace DataSpec::DNAMP1

View File

@ -9,7 +9,7 @@ struct IScriptObject;
struct ScriptObjectSpec { struct ScriptObjectSpec {
atUint8 type; atUint8 type;
IScriptObject* (*a)(); IScriptObject* (*loader)();
}; };
using ScriptObjectDBArray = std::array<const ScriptObjectSpec*, 127>; using ScriptObjectDBArray = std::array<const ScriptObjectSpec*, 127>;

View File

@ -34,6 +34,7 @@ public:
static OSTime ToWiiTime(std::chrono::system_clock::time_point time); static OSTime ToWiiTime(std::chrono::system_clock::time_point time);
static std::chrono::system_clock::time_point FromWiiTime(OSTime wiiTime); static std::chrono::system_clock::time_point FromWiiTime(OSTime wiiTime);
static OSTime GetTime() { return ToWiiTime(std::chrono::system_clock::now()); }
static u64 GetGCTicks(); static u64 GetGCTicks();
static constexpr u64 GetGCTicksPerSec() { return 486000000ull; } static constexpr u64 GetGCTicksPerSec() { return 486000000ull; }

View File

@ -221,7 +221,7 @@ void CGameState::PutTo(CBitStreamWriter& writer) {
writer.WriteEncoded(u32(value), 8); writer.WriteEncoded(u32(value), 8);
} }
writer.WriteEncoded(CBasics::ToWiiTime(std::chrono::system_clock::now()) / CBasics::TICKS_PER_SECOND, 32); writer.WriteEncoded(CBasics::GetTime() / CBasics::TICKS_PER_SECOND, 32);
writer.WriteEncoded(x228_24_hardMode, 1); writer.WriteEncoded(x228_24_hardMode, 1);
writer.WriteEncoded(x228_25_initPowerupsAtFirstSpawn, 1); writer.WriteEncoded(x228_25_initPowerupsAtFirstSpawn, 1);
writer.WriteEncoded(u32(x84_mlvlId.Value()), 32); writer.WriteEncoded(u32(x84_mlvlId.Value()), 32);

View File

@ -1330,8 +1330,14 @@ void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMes
} }
if (m_logScripting) { if (m_logScripting) {
LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg), auto srcObj = GetObjectById(src);
dest->GetName(), dest->GetUniqueId()); if (srcObj != nullptr) {
LogModule.report(logvisor::Info, FMT_STRING("{} is sending '{}' to '{}' id= {} -> {}"), srcObj->GetName(),
ScriptObjectMessageToStr(msg), dest->GetName(), dest->GetUniqueId(), src, dest->GetUniqueId());
} else {
LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
dest->GetName(), dest->GetUniqueId());
}
} }
dest->AcceptScriptMsg(msg, src, *this); dest->AcceptScriptMsg(msg, src, *this);
@ -1349,8 +1355,14 @@ void CStateManager::SendScriptMsgAlways(TUniqueId dest, TUniqueId src, EScriptOb
} }
if (m_logScripting) { if (m_logScripting) {
LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg), auto srcObj = GetObjectById(src);
dst->GetName(), dst->GetUniqueId()); if (srcObj != nullptr) {
LogModule.report(logvisor::Info, FMT_STRING("{} is sending '{}' to '{}' id= {} -> {}"), srcObj->GetName(),
ScriptObjectMessageToStr(msg), dst->GetName(), dst->GetUniqueId(), src, dst->GetUniqueId());
} else {
LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
dst->GetName(), dst->GetUniqueId());
}
} }
dst->AcceptScriptMsg(msg, src, *this); dst->AcceptScriptMsg(msg, src, *this);

View File

@ -359,7 +359,7 @@ void CMetroidPrimeExo::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId other
SetBoneTrackingTarget(mgr, true); SetBoneTrackingTarget(mgr, true);
CreatePlasmaProjectiles(mgr); CreatePlasmaProjectiles(mgr);
CreatePhysicsDummy(mgr); CreatePhysicsDummy(mgr);
sub802755ac(mgr, true); EnableParticles(mgr, true);
CreateHUDBillBoard(mgr); CreateHUDBillBoard(mgr);
mgr.GetPlayer().SetFrozenTimeoutBias(2.f); mgr.GetPlayer().SetFrozenTimeoutBias(2.f);
break; break;
@ -440,6 +440,7 @@ void CMetroidPrimeExo::Touch(CActor& act, CStateManager& mgr) {
void CMetroidPrimeExo::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) { void CMetroidPrimeExo::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) {
if (type == EUserEventType::ScreenShake) { if (type == EUserEventType::ScreenShake) {
// TODO: Implement
return; return;
} }
if (type == EUserEventType::EffectOff) { if (type == EUserEventType::EffectOff) {
@ -457,14 +458,14 @@ void CMetroidPrimeExo::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode&
} }
if (type == EUserEventType::DamageOn) { if (type == EUserEventType::DamageOn) {
if (x92c_ == 11) { if (x92c_ == 11) {
sub802755ac(mgr, true); EnableParticles(mgr, true);
x1054_26_ = true; x1054_26_ = true;
} else if (x92c_ == 7) { } else if (x92c_ == 7) {
FirePlasmaProjectile(mgr, true); FirePlasmaProjectile(mgr, true);
} }
} else if (type == EUserEventType::DamageOff) { } else if (type == EUserEventType::DamageOff) {
if (x92c_ == 1) { if (x92c_ == 1) {
sub802755ac(mgr, false); EnableParticles(mgr, false);
} else if (x92c_ == 7) { } else if (x92c_ == 7) {
FirePlasmaProjectile(mgr, false); FirePlasmaProjectile(mgr, false);
} }
@ -506,8 +507,8 @@ void CMetroidPrimeExo::Run(CStateManager& mgr, EStateMsg msg, float arg) {
TUniqueId wpId = GetNextAttackWaypoint(mgr, true); TUniqueId wpId = GetNextAttackWaypoint(mgr, true);
if (TCastToConstPtr<CScriptWaypoint> wp = mgr.GetObjectById(wpId)) { if (TCastToConstPtr<CScriptWaypoint> wp = mgr.GetObjectById(wpId)) {
GetBodyController()->SetLocomotionType(sub80275e14(1)); GetBodyController()->SetLocomotionType(sub80275e14(1));
SetDestPos(wp->GetTranslation());
x2dc_destObj = wpId; x2dc_destObj = wpId;
SetDestPos(wp->GetTranslation());
x2ec_reflectedDestPos = GetTranslation(); x2ec_reflectedDestPos = GetTranslation();
x328_24_inPosition = false; x328_24_inPosition = false;
} }
@ -548,7 +549,7 @@ void CMetroidPrimeExo::TurnAround(CStateManager& mgr, EStateMsg msg, float arg)
x1078_ = 1; x1078_ = 1;
zeus::CVector3f vec = sub8027464c(mgr); zeus::CVector3f vec = sub8027464c(mgr);
if ((vec - GetTranslation()).normalized().dot(mgr.GetPlayer().GetTranslation() - GetTranslation()) < 15.f) { if ((vec - GetTranslation()).normalized().dot(mgr.GetPlayer().GetTranslation() - GetTranslation()) < 15.f) {
sub802747b8(arg, mgr, vec); sub802747b8(arg, mgr, vec - GetTranslation());
} }
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
x92c_ = 0; x92c_ = 0;
@ -656,7 +657,7 @@ void CMetroidPrimeExo::Suck(CStateManager& mgr, EStateMsg msg, float arg) {
x1078_ = 1; x1078_ = 1;
GetBodyController()->SetLocomotionType(skLocomotions[x1078_]); GetBodyController()->SetLocomotionType(skLocomotions[x1078_]);
x92c_ = 0; x92c_ = 0;
sub802755ac(mgr, false); EnableParticles(mgr, false);
sub802738d4(mgr); sub802738d4(mgr);
x1088_ = 0.6f; x1088_ = 0.6f;
if (mgr.GetPlayer().GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed) { if (mgr.GetPlayer().GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed) {
@ -1074,7 +1075,7 @@ void CMetroidPrimeExo::sub802749e8(float f1, float f2, float f3, const zeus::CVe
void CMetroidPrimeExo::UpdateParticles(float f1, CStateManager& mgr) { void CMetroidPrimeExo::UpdateParticles(float f1, CStateManager& mgr) {
if (GetBodyController()->GetPercentageFrozen() > 0.f && x1054_24_) { if (GetBodyController()->GetPercentageFrozen() > 0.f && x1054_24_) {
sub802755ac(mgr, false); EnableParticles(mgr, false);
x1054_25_ = true; x1054_25_ = true;
} }
@ -1156,7 +1157,7 @@ void CMetroidPrimeExo::UpdateParticles(float f1, CStateManager& mgr) {
mgr.GetPlayer().SetAccelerationChangeTimer(2.f * f1); mgr.GetPlayer().SetAccelerationChangeTimer(2.f * f1);
} }
void CMetroidPrimeExo::sub802755ac(CStateManager& mgr, bool b1) { void CMetroidPrimeExo::EnableParticles(CStateManager& mgr, bool b1) {
for (size_t i = 0; i < 2; ++i) { for (size_t i = 0; i < 2; ++i) {
x1000_[i]->SetParticleEmission(b1); x1000_[i]->SetParticleEmission(b1);
if (!b1) { if (!b1) {
@ -1500,7 +1501,7 @@ TUniqueId CMetroidPrimeExo::GetWaypointForBehavior(CStateManager& mgr, EScriptOb
const auto* ent = mgr.GetObjectById(uid); const auto* ent = mgr.GetObjectById(uid);
if (ent != nullptr && ent->GetActive()) { if (ent != nullptr && ent->GetActive()) {
uids.push_back(uid); uids.push_back(uid);
if (uids.size() == 8) { if (uids.size() >= 8) {
break; break;
} }
} }

View File

@ -216,7 +216,7 @@ class CMetroidPrimeExo : public CPatterned {
void sub802747b8(float f1, CStateManager& mgr, const zeus::CVector3f& vec); void sub802747b8(float f1, CStateManager& mgr, const zeus::CVector3f& vec);
void sub802749e8(float f1, float f2, float f3, const zeus::CVector3f& vec1, const zeus::CVector3f& vec2, s32 idx); void sub802749e8(float f1, float f2, float f3, const zeus::CVector3f& vec1, const zeus::CVector3f& vec2, s32 idx);
void UpdateParticles(float f1, CStateManager& mgr); void UpdateParticles(float f1, CStateManager& mgr);
void sub802755ac(CStateManager& mgr, bool b1); void EnableParticles(CStateManager& mgr, bool b1);
void EnableHeadOrbitAndTarget(CStateManager& mgr); void EnableHeadOrbitAndTarget(CStateManager& mgr);
void DisableHeadOrbitAndTarget(CStateManager& mgr); void DisableHeadOrbitAndTarget(CStateManager& mgr);
void UpdateTimers(float mgr); void UpdateTimers(float mgr);

View File

@ -208,9 +208,9 @@ void CPhazonBeam::Draw(bool drawSuitArm, const CStateManager& mgr, const zeus::C
} }
if (x274_26_veinsAlphaActive) { if (x274_26_veinsAlphaActive) {
CModelFlags useFlags(5, 0, 3, zeus::CColor(1.f, 0.5f * x270_indirectAlpha)); CModelFlags useFlags(5, 0, 3, zeus::CColor(1.f, 0.5f * x270_indirectAlpha));
x224_phazonVeinsData->Render(mgr, xf, lights, useFlags); x224_phazonVeinsData->Render(mgr, modelXf * zeus::CTransform::Scale(x270_indirectAlpha), lights, useFlags);
} else { } else {
x224_phazonVeinsData->Render(mgr, xf, lights, flags); x224_phazonVeinsData->Render(mgr, modelXf, lights, flags);
} }
} }
} }

View File

@ -632,7 +632,7 @@ void CPlayerGun::HandlePhazonBeamChange(CStateManager& mgr) {
inMorph = true; inMorph = true;
break; break;
case EPhazonBeamState::Active: case EPhazonBeamState::Active:
if (!x835_25_inPhazonBeam) { if (!x835_24_canFirePhazon) {
SetPhazonBeamMorph(true); SetPhazonBeamMorph(true);
x338_nextState = ENextState::ExitPhazonBeam; x338_nextState = ENextState::ExitPhazonBeam;
inMorph = true; inMorph = true;

View File

@ -1,8 +1,6 @@
#include "Runtime/World/CPlayerCameraBob.hpp" #include "Runtime/World/CPlayerCameraBob.hpp"
#include "Runtime/CStateManager.hpp" #include "Runtime/CStateManager.hpp"
#include "Runtime/Camera/CCameraManager.hpp"
#include "Runtime/Particle/CGenDescription.hpp"
#include "Runtime/World/CPlayer.hpp" #include "Runtime/World/CPlayer.hpp"
#include <zeus/Math.hpp> #include <zeus/Math.hpp>

View File

@ -33,6 +33,13 @@ CScriptTrigger::CScriptTrigger(TUniqueId uid, std::string_view name, const CEnti
GetEditorId(), GetAreaIdAlways()); GetEditorId(), GetAreaIdAlways());
x11c_forceField.x() = 0.f; x11c_forceField.x() = 0.f;
} }
#else
// HACK: For some reason MetroidPrime's lair doesn't enable this trigger until after the cutscene, activate it in debug build
if (GetEditorId() == 0x000B01DB && !GetActive()) {
Log.report(logvisor::Warning, FMT_STRING("BUG THIS!: Overriding active for trigger {} in area {}"), GetEditorId(),
GetAreaIdAlways());
SetActive(true);
}
#endif #endif
} }

View File

@ -4,9 +4,9 @@
#include "Runtime/CToken.hpp" #include "Runtime/CToken.hpp"
#include "Runtime/GCNTypes.hpp" #include "Runtime/GCNTypes.hpp"
#include "Runtime/IOStreams.hpp"
#include "Runtime/IObj.hpp" #include "Runtime/IObj.hpp"
#include "Runtime/IObjFactory.hpp" #include "Runtime/IObjFactory.hpp"
#include "Runtime/IOStreams.hpp"
#include "Runtime/World/CAiFuncMap.hpp" #include "Runtime/World/CAiFuncMap.hpp"
namespace metaforce { namespace metaforce {

View File

@ -3760,15 +3760,15 @@ CEntity* ScriptLoader::LoadMazeNode(CStateManager& mgr, CInputStream& in, int pr
SActorHead aHead = LoadActorHead(in, mgr); SActorHead aHead = LoadActorHead(in, mgr);
bool active = in.readBool(); bool active = in.readBool();
u32 w1 = in.readUint32Big(); u32 col = in.readUint32Big();
u32 w2 = in.readUint32Big(); u32 row = in.readUint32Big();
u32 w3 = in.readUint32Big(); u32 side = in.readUint32Big();
zeus::CVector3f vec1 = zeus::CVector3f::ReadBig(in); zeus::CVector3f actorPos = zeus::CVector3f::ReadBig(in);
zeus::CVector3f vec2 = zeus::CVector3f::ReadBig(in); zeus::CVector3f triggerPos = zeus::CVector3f::ReadBig(in);
zeus::CVector3f vec3 = zeus::CVector3f::ReadBig(in); zeus::CVector3f effectPos = zeus::CVector3f::ReadBig(in);
return new CScriptMazeNode(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, w1, w2, w3, vec1, return new CScriptMazeNode(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, col, row, side,
vec2, vec3); actorPos, triggerPos, effectPos);
} }
CEntity* ScriptLoader::LoadOmegaPirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { CEntity* ScriptLoader::LoadOmegaPirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {

View File

@ -0,0 +1,9 @@
[Desktop Entry]
Name=Metaforce
GenericName=Game Engine Replacement
Comment=Engine reimplementation for Metroid Prime 1
Exec=metaforce
Icon=metaforce
Terminal=false
Type=Application
Categories=Graphics;3DGraphics;Games

View File

@ -1,9 +0,0 @@
[Desktop Entry]
Name=URDE
GenericName=Game Data Editor
Comment=Edit 3D assets from games by Retro Studios
Exec=metaforce
Icon=metaforce
Terminal=false
Type=Application
Categories=Graphics;3DGraphics;

2
extern/nod vendored

@ -1 +1 @@
Subproject commit 2f53b2174040eb0bc84fce8799b7a9be630eabd5 Subproject commit 30697375adee818e9c14015584c6629e12d27ab4

View File

@ -176,13 +176,13 @@ class SACTAction_load(bpy.types.Operator):
bpy.context.scene.render.frame_map_old = action_obj.hecl_fps bpy.context.scene.render.frame_map_old = action_obj.hecl_fps
bpy.context.scene.render.frame_map_new = 60 bpy.context.scene.render.frame_map_new = 60
bpy.context.scene.frame_start = 0 bpy.context.scene.frame_start = 0
bpy.context.scene.frame_end = action_obj.frame_range[1] * (60 / action_obj.hecl_fps) bpy.context.scene.frame_end = int(action_obj.frame_range[1] * (60 / action_obj.hecl_fps))
else: else:
bpy.context.scene.render.fps = action_obj.hecl_fps bpy.context.scene.render.fps = action_obj.hecl_fps
bpy.context.scene.render.frame_map_old = action_obj.hecl_fps bpy.context.scene.render.frame_map_old = action_obj.hecl_fps
bpy.context.scene.render.frame_map_new = action_obj.hecl_fps bpy.context.scene.render.frame_map_new = action_obj.hecl_fps
bpy.context.scene.frame_start = 0 bpy.context.scene.frame_start = 0
bpy.context.scene.frame_end = action_obj.frame_range[1] bpy.context.scene.frame_end = int(action_obj.frame_range[1])
# Events # Events
#SACTEvent.clear_action_events(self, context, actor_data) #SACTEvent.clear_action_events(self, context, actor_data)

View File

@ -505,7 +505,11 @@ try:
bpy.context.preferences.filepaths.save_version = 0 bpy.context.preferences.filepaths.save_version = 0
print('SAVING %s' % loaded_blend) print('SAVING %s' % loaded_blend)
if loaded_blend: if loaded_blend:
if 'FINISHED' in bpy.ops.wm.save_as_mainfile(filepath=loaded_blend, check_existing=False, compress=True): if bpy.app.version >= (3, 0, 0):
ret = bpy.ops.wm.save_as_mainfile(filepath=loaded_blend, check_existing=False, compress=False)
else:
ret = bpy.ops.wm.save_as_mainfile(filepath=loaded_blend, check_existing=False, compress=True)
if 'FINISHED' in ret:
writepipestr(b'FINISHED') writepipestr(b'FINISHED')
else: else:
writepipestr(b'CANCELLED') writepipestr(b'CANCELLED')

View File

@ -3,11 +3,10 @@
#include "hecl/hecl.hpp" #include "hecl/hecl.hpp"
namespace hecl::blender { namespace hecl::blender {
constexpr uint32_t MinBlenderMajorSearch = 2;
constexpr uint32_t MaxBlenderMajorSearch = 2;
constexpr uint32_t MinBlenderMinorSearch = 83;
constexpr uint32_t MaxBlenderMinorSearch = 93;
std::optional<std::string> FindBlender(int& major, int& minor); std::optional<std::string> FindBlender(int& major, int& minor);
bool IsVersionSupported(int major, int minor);
std::pair<uint32_t, uint32_t> GetLatestSupportedVersion();
std::pair<uint32_t, uint32_t> GetEarliestSupportedVersion();
std::pair<uint32_t, uint32_t> GetRecommendedVersion();
void SetOverridePath(std::string_view overridePath);
} // namespace hecl::blender } // namespace hecl::blender

View File

@ -466,8 +466,9 @@ Connection::Connection(int verbosityLevel) {
BlenderLog.report(logvisor::Fatal, FMT_STRING("Unable to find blender")); BlenderLog.report(logvisor::Fatal, FMT_STRING("Unable to find blender"));
} else if (lineStr == "INVALIDBLENDERVER") { } else if (lineStr == "INVALIDBLENDERVER") {
_closePipe(); _closePipe();
auto [major, minor] = hecl::blender::GetEarliestSupportedVersion();
BlenderLog.report(logvisor::Fatal, FMT_STRING("Installed blender version must be >= {}.{}"), BlenderLog.report(logvisor::Fatal, FMT_STRING("Installed blender version must be >= {}.{}"),
MinBlenderMajorSearch, MinBlenderMinorSearch); major, minor);
} else if (lineStr == "NOADDON") { } else if (lineStr == "NOADDON") {
_closePipe(); _closePipe();
if (blenderAddonPath != "SKIPINSTALL") if (blenderAddonPath != "SKIPINSTALL")

View File

@ -2,9 +2,24 @@
#include "hecl/SteamFinder.hpp" #include "hecl/SteamFinder.hpp"
#include <array>
#include <sstream> #include <sstream>
namespace hecl::blender { namespace hecl::blender {
namespace {
struct SBlenderVersion {
uint32_t Major;
uint32_t Minor;
};
// Supported blender versions in reverse order, with the most recently supported version first
constexpr std::array SupportedVersions{
SBlenderVersion{3, 0}, SBlenderVersion{2, 93}, SBlenderVersion{2, 92},
SBlenderVersion{2, 91}, SBlenderVersion{2, 90}, SBlenderVersion{2, 83},
};
// The most recent version with the most testing
constexpr SBlenderVersion RecommendedVersion{2, 93};
static std::string OverridePath;
} // namespace
#ifdef __APPLE__ #ifdef __APPLE__
#define DEFAULT_BLENDER_BIN "/Applications/Blender.app/Contents/MacOS/blender" #define DEFAULT_BLENDER_BIN "/Applications/Blender.app/Contents/MacOS/blender"
@ -40,8 +55,14 @@ std::optional<std::string> FindBlender(int& major, int& minor) {
major = 0; major = 0;
minor = 0; minor = 0;
/* User-specified blender path */ std::optional<std::string> blenderBin;
auto blenderBin = GetEnv("BLENDER_BIN"); if (!OverridePath.empty()) {
blenderBin = {OverridePath};
} else {
/* User-specified blender path */
blenderBin = GetEnv("BLENDER_BIN");
}
if (blenderBin && !RegFileExists(blenderBin->c_str())) { if (blenderBin && !RegFileExists(blenderBin->c_str())) {
blenderBin.reset(); blenderBin.reset();
} }
@ -63,19 +84,12 @@ std::optional<std::string> FindBlender(int& major, int& minor) {
wchar_t wProgFiles[256]; wchar_t wProgFiles[256];
if (GetEnvironmentVariableW(L"ProgramFiles", wProgFiles, 256)) { if (GetEnvironmentVariableW(L"ProgramFiles", wProgFiles, 256)) {
auto progFiles = nowide::narrow(wProgFiles); auto progFiles = nowide::narrow(wProgFiles);
for (size_t major = MaxBlenderMajorSearch; major >= MinBlenderMajorSearch; --major) { for (const auto& version : SupportedVersions) {
bool found = false; std::string blenderBinBuf =
for (size_t minor = MaxBlenderMinorSearch; minor >= MinBlenderMinorSearch; --minor) { fmt::format(FMT_STRING("{}\\Blender Foundation\\Blender {}.{}\\blender.exe"),
std::string blenderBinBuf = fmt::format(FMT_STRING("{}\\Blender Foundation\\Blender {}.{}\\blender.exe"), progFiles, version.Major, version.Minor);
progFiles, major, minor); if (RegFileExists(blenderBinBuf.c_str())) {
if (RegFileExists(blenderBinBuf.c_str())) { blenderBin = std::move(blenderBinBuf);
blenderBin = std::move(blenderBinBuf);
found = true;
break;
}
}
if (found) {
break; break;
} }
} }
@ -133,7 +147,7 @@ std::optional<std::string> FindBlender(int& major, int& minor) {
std::string command = std::string("\"") + blenderBin.value() + "\" --version"; std::string command = std::string("\"") + blenderBin.value() + "\" --version";
FILE* fp = popen(command.c_str(), "r"); FILE* fp = popen(command.c_str(), "r");
char versionBuf[256]; char versionBuf[256];
size_t rdSize = fread(versionBuf, 1, 255, fp); size_t rdSize = fread(&versionBuf[0], 1, 255, fp);
versionBuf[rdSize] = '\0'; versionBuf[rdSize] = '\0';
pclose(fp); pclose(fp);
@ -147,4 +161,21 @@ std::optional<std::string> FindBlender(int& major, int& minor) {
return blenderBin; return blenderBin;
} }
bool IsVersionSupported(int major, int minor) {
auto it =
std::find_if(SupportedVersions.cbegin(), SupportedVersions.cend(),
[&major, &minor](const auto& version) { return version.Major == major && version.Minor == minor; });
return it != SupportedVersions.cend();
}
std::pair<uint32_t, uint32_t> GetLatestSupportedVersion() {
return {SupportedVersions.front().Major, SupportedVersions.front().Minor};
}
std::pair<uint32_t, uint32_t> GetEarliestSupportedVersion() {
return {SupportedVersions.back().Major, SupportedVersions.back().Minor};
}
std::pair<uint32_t, uint32_t> GetRecommendedVersion() { return {RecommendedVersion.Major, RecommendedVersion.Minor}; }
void SetOverridePath(std::string_view overridePath) { OverridePath = overridePath; }
} // namespace hecl::blender } // namespace hecl::blender

View File

@ -79,44 +79,51 @@ SDNARead::SDNARead(std::string_view path) {
r.readUBytesToBuf(magicBuf, 7); r.readUBytesToBuf(magicBuf, 7);
r.seek(0, athena::SeekOrigin::Begin); r.seek(0, athena::SeekOrigin::Begin);
if (strncmp(magicBuf, "BLENDER", 7)) { if (strncmp(magicBuf, "BLENDER", 7)) {
/* Try gzip decompression */ atUint32 magic = hecl::SLittle(*(atUint32*)(magicBuf));
std::unique_ptr<uint8_t[]> compBuf(new uint8_t[4096]); if (magic == 0xfd2fb528) {
m_data.resize((length * 2 + 4095) & ~4095); /* Try zstandard decompression */
z_stream zstrm = {}; // TODO: Implement
inflateInit2(&zstrm, 16 + MAX_WBITS); m_data = {};
zstrm.next_out = (Bytef*)m_data.data(); } else if (magic == 0x88b1f) {
zstrm.avail_out = m_data.size(); /* Try gzip decompression */
zstrm.total_out = 0; std::unique_ptr<uint8_t[]> compBuf(new uint8_t[4096]);
m_data.resize((length * 2 + 4095) & ~4095);
z_stream zstrm = {};
inflateInit2(&zstrm, 16 + MAX_WBITS);
zstrm.next_out = (Bytef*)m_data.data();
zstrm.avail_out = m_data.size();
zstrm.total_out = 0;
atUint64 rs; atUint64 rs;
while ((rs = r.readUBytesToBuf(compBuf.get(), 4096))) { while ((rs = r.readUBytesToBuf(compBuf.get(), 4096))) {
int inflateRet; int inflateRet;
zstrm.next_in = compBuf.get(); zstrm.next_in = compBuf.get();
zstrm.avail_in = rs; zstrm.avail_in = rs;
while (zstrm.avail_in) { while (zstrm.avail_in) {
if (!zstrm.avail_out) { if (!zstrm.avail_out) {
zstrm.avail_out = m_data.size(); zstrm.avail_out = m_data.size();
m_data.resize(zstrm.avail_out * 2); m_data.resize(zstrm.avail_out * 2);
zstrm.next_out = (Bytef*)m_data.data() + zstrm.avail_out; zstrm.next_out = (Bytef*)m_data.data() + zstrm.avail_out;
}
inflateRet = inflate(&zstrm, Z_NO_FLUSH);
if (inflateRet == Z_STREAM_END)
break;
if (inflateRet != Z_OK) {
inflateEnd(&zstrm);
m_data = std::vector<uint8_t>();
return;
}
} }
inflateRet = inflate(&zstrm, Z_NO_FLUSH);
if (inflateRet == Z_STREAM_END) if (inflateRet == Z_STREAM_END)
break; break;
if (inflateRet != Z_OK) {
inflateEnd(&zstrm);
m_data = std::vector<uint8_t>();
return;
}
} }
if (inflateRet == Z_STREAM_END)
break;
}
inflateEnd(&zstrm); inflateEnd(&zstrm);
if (strncmp((char*)m_data.data(), "BLENDER", 7)) { if (strncmp((char*)m_data.data(), "BLENDER", 7)) {
m_data = std::vector<uint8_t>(); m_data = std::vector<uint8_t>();
return; return;
}
} }
} else { } else {
m_data.resize(length); m_data.resize(length);

View File

@ -161,7 +161,7 @@ bool IsPathBlend(const hecl::ProjectPath& path) {
} }
buf = hecl::SLittle(buf); buf = hecl::SLittle(buf);
return buf == 0x4e454c42 || buf == 0x88b1f; return buf == 0x4e454c42 || buf == 0x88b1f || buf == 0xfd2fb528;
} }
bool IsPathYAML(const hecl::ProjectPath& path) { bool IsPathYAML(const hecl::ProjectPath& path) {

View File

@ -131,11 +131,13 @@ elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
endif () endif ()
if (WIN32) if (WIN32)
configure_file(platforms/win/metaforce-gui.rc.in "${CMAKE_CURRENT_SOURCE_DIR}/platforms/win/metaforce-gui.rc" @ONLY)
target_sources(metaforce-gui PRIVATE target_sources(metaforce-gui PRIVATE
platforms/win/metaforce-gui.manifest platforms/win/metaforce-gui.manifest
platforms/win/metaforce-gui.rc platforms/win/metaforce-gui.rc
) )
elseif (APPLE) elseif (APPLE)
configure_file(platforms/mac/Info.plist.in "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist" @ONLY)
set_target_properties(metaforce-gui PROPERTIES set_target_properties(metaforce-gui PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist" MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist"
) )

View File

@ -5,5 +5,7 @@
class FileDirDialog : public QFileDialog { class FileDirDialog : public QFileDialog {
Q_OBJECT Q_OBJECT
public: public:
FileDirDialog(QWidget* parent = nullptr) : QFileDialog(parent) { setFileMode(QFileDialog::Directory); } FileDirDialog(QWidget* parent = nullptr, QFileDialog::FileMode mode = QFileDialog::Directory) : QFileDialog(parent) {
setFileMode(mode);
}
}; };

View File

@ -14,6 +14,8 @@
#include "FileDirDialog.hpp" #include "FileDirDialog.hpp"
#include "ExtractZip.hpp" #include "ExtractZip.hpp"
#include "hecl/Blender/FindBlender.hpp"
#if _WIN32 #if _WIN32
#include <Windows.h> #include <Windows.h>
#include <shellapi.h> #include <shellapi.h>
@ -131,6 +133,7 @@ MainWindow::MainWindow(QWidget* parent)
m_dlManager.fetchIndex(); m_dlManager.fetchIndex();
setPath(m_settings.value(QStringLiteral("working_dir")).toString()); setPath(m_settings.value(QStringLiteral("working_dir")).toString());
setBlenderOverride(m_settings.value(QStringLiteral("blender_override_path")).toString());
resize(1024, 768); resize(1024, 768);
} }
@ -154,6 +157,9 @@ void MainWindow::onExtract() {
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert(QStringLiteral("TERM"), QStringLiteral("xterm-color")); env.insert(QStringLiteral("TERM"), QStringLiteral("xterm-color"));
env.insert(QStringLiteral("ConEmuANSI"), QStringLiteral("ON")); env.insert(QStringLiteral("ConEmuANSI"), QStringLiteral("ON"));
if (!m_blenderOverridePath.isEmpty() && QFile::exists(m_blenderOverridePath)) {
env.insert(QStringLiteral("BLENDER_BIN"), m_blenderOverridePath);
}
m_heclProc.setProcessEnvironment(env); m_heclProc.setProcessEnvironment(env);
disconnect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), nullptr, nullptr); disconnect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), nullptr, nullptr);
connect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, &MainWindow::onExtractFinished); connect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, &MainWindow::onExtractFinished);
@ -189,6 +195,9 @@ void MainWindow::onPackage() {
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert(QStringLiteral("TERM"), QStringLiteral("xterm-color")); env.insert(QStringLiteral("TERM"), QStringLiteral("xterm-color"));
env.insert(QStringLiteral("ConEmuANSI"), QStringLiteral("ON")); env.insert(QStringLiteral("ConEmuANSI"), QStringLiteral("ON"));
if (!m_blenderOverridePath.isEmpty() && QFile::exists(m_blenderOverridePath)) {
env.insert(QStringLiteral("BLENDER_BIN"), m_blenderOverridePath);
}
m_heclProc.setProcessEnvironment(env); m_heclProc.setProcessEnvironment(env);
disconnect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), nullptr, nullptr); disconnect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), nullptr, nullptr);
connect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, &MainWindow::onPackageFinished); connect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, &MainWindow::onPackageFinished);
@ -302,8 +311,14 @@ void MainWindow::onBinaryDownloaded(QuaZip& file) {
m_ui->downloadErrorLabel->setText(tr("Download successful - Press 'Extract' to continue."), true); m_ui->downloadErrorLabel->setText(tr("Download successful - Press 'Extract' to continue."), true);
} }
if (!err && !m_ui->sysReqTable->isBlenderVersionOk()) { if (!err && !m_ui->sysReqTable->isBlenderVersionOk()) {
m_ui->downloadErrorLabel->setText( auto [recMajor, recMinor] = hecl::blender::GetRecommendedVersion();
tr("Blender 2.90 or greater must be installed. Please download via Steam or blender.org.")); auto [minMajor, minMinor] = hecl::blender::GetEarliestSupportedVersion();
insertContinueNote(
tr("Blender %1.%2 or greater must be installed (%3.%4 recommended). Please download via Steam or blender.org.")
.arg(minMajor)
.arg(minMinor)
.arg(recMajor)
.arg(recMinor));
} }
} }
@ -318,6 +333,8 @@ void MainWindow::disableOperations() {
m_ui->launchBtn->setEnabled(false); m_ui->launchBtn->setEnabled(false);
m_ui->pathEdit->setEnabled(false); m_ui->pathEdit->setEnabled(false);
m_ui->browseBtn->setEnabled(false); m_ui->browseBtn->setEnabled(false);
m_ui->blenderEdit->setEnabled(false);
m_ui->blenderBtn->setEnabled(false);
m_ui->downloadButton->setEnabled(false); m_ui->downloadButton->setEnabled(false);
m_ui->warpBtn->setEnabled(false); m_ui->warpBtn->setEnabled(false);
} }
@ -326,6 +343,8 @@ void MainWindow::enableOperations() {
disableOperations(); disableOperations();
m_ui->pathEdit->setEnabled(true); m_ui->pathEdit->setEnabled(true);
m_ui->browseBtn->setEnabled(true); m_ui->browseBtn->setEnabled(true);
m_ui->blenderEdit->setEnabled(true);
m_ui->blenderBtn->setEnabled(true);
if (hecl::com_enableCheats->toBoolean()) { if (hecl::com_enableCheats->toBoolean()) {
m_ui->warpBtn->show(); m_ui->warpBtn->show();
@ -357,7 +376,14 @@ void MainWindow::enableOperations() {
} }
if (!m_ui->sysReqTable->isBlenderVersionOk()) { if (!m_ui->sysReqTable->isBlenderVersionOk()) {
insertContinueNote(tr("Blender 2.90 or greater must be installed. Please download via Steam or blender.org.")); auto [recMajor, recMinor] = hecl::blender::GetRecommendedVersion();
auto [minMajor, minMinor] = hecl::blender::GetEarliestSupportedVersion();
insertContinueNote(
tr("Blender %1.%2 or greater must be installed (%3.%4 recommended). Please download via Steam or blender.org.")
.arg(minMajor)
.arg(minMinor)
.arg(recMajor)
.arg(recMinor));
} else if (m_ui->launchBtn->isEnabled()) { } else if (m_ui->launchBtn->isEnabled()) {
insertContinueNote(tr("Package complete - Press 'Launch' to start Metaforce.")); insertContinueNote(tr("Package complete - Press 'Launch' to start Metaforce."));
} else if (m_ui->packageBtn->isEnabled()) { } else if (m_ui->packageBtn->isEnabled()) {
@ -514,15 +540,60 @@ void MainWindow::initSlots() {
if (res == QFileDialog::Rejected) if (res == QFileDialog::Rejected)
return; return;
if (dialog.selectedFiles().size() <= 0) if (dialog.selectedFiles().empty())
return; return;
setPath(dialog.selectedFiles().at(0)); setPath(dialog.selectedFiles().at(0));
}); });
connect(m_ui->pathEdit, &QLineEdit::editingFinished, [this]() { setPath(m_ui->pathEdit->text()); }); connect(m_ui->pathEdit, &QLineEdit::editingFinished, [this]() { setPath(m_ui->pathEdit->text()); });
connect(m_ui->blenderEdit, &QLineEdit::editingFinished, [this]() { setBlenderOverride(m_ui->blenderEdit->text()); });
connect(m_ui->blenderBtn, &QPushButton::clicked, [this]() {
FileDirDialog dialog(this, QFileDialog::ExistingFiles);
#ifdef Q_OS_WIN
dialog.setNameFilter(QStringLiteral("blender.exe"));
#else
dialog.setNameFilter(QStringLiteral("blender"));
#endif
dialog.setDirectory(m_path);
dialog.setWindowTitle(tr("Select Blender binary"));
int res = dialog.exec();
if (res == QFileDialog::Rejected)
return;
if (dialog.selectedFiles().size() <= 0)
return;
setBlenderOverride(dialog.selectedFiles().at(0));
});
connect(m_ui->downloadButton, &QPushButton::clicked, this, &MainWindow::onDownloadPressed); connect(m_ui->downloadButton, &QPushButton::clicked, this, &MainWindow::onDownloadPressed);
} }
void MainWindow::setBlenderOverride(const QString& path) {
const QFileInfo finfo(path);
QString usePath;
if (!path.isEmpty() && finfo.isFile()) {
usePath = finfo.absoluteFilePath();
}
m_blenderOverridePath = usePath;
hecl::blender::SetOverridePath(m_blenderOverridePath.toStdString());
int major = 0;
int minor = 0;
auto realPath = hecl::blender::FindBlender(major, minor);
if (realPath) {
m_blenderOverridePath.fromStdString(*realPath);
}
m_settings.setValue(QStringLiteral("blender_override_path"), m_blenderOverridePath);
auto oldState = m_ui->blenderEdit->blockSignals(true);
m_ui->blenderEdit->setText(m_blenderOverridePath);
m_ui->blenderEdit->blockSignals(oldState);
m_ui->sysReqTable->updateBlender();
}
void MainWindow::setTextTermFormatting(const QString& text) { void MainWindow::setTextTermFormatting(const QString& text) {
m_inContinueNote = false; m_inContinueNote = false;

View File

@ -35,6 +35,7 @@ class MainWindow : public QMainWindow {
QString m_path; QString m_path;
QString m_metaforcePath; QString m_metaforcePath;
QString m_heclPath; QString m_heclPath;
QString m_blenderOverridePath;
QProcess m_heclProc; QProcess m_heclProc;
DownloadManager m_dlManager; DownloadManager m_dlManager;
QStringList m_warpSettings; QStringList m_warpSettings;
@ -77,4 +78,5 @@ private:
void initGraphicsApiOption(QRadioButton* action, bool hidden, bool isDefault); void initGraphicsApiOption(QRadioButton* action, bool hidden, bool isDefault);
void initNumberComboOption(QComboBox* action, hecl::CVar* cvar); void initNumberComboOption(QComboBox* action, hecl::CVar* cvar);
void initCheckboxOption(QCheckBox* action, hecl::CVar* cvar); void initCheckboxOption(QCheckBox* action, hecl::CVar* cvar);
void setBlenderOverride(const QString& path);
}; };

View File

@ -21,7 +21,85 @@
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="2" column="0"> <item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="2">
<widget class="QPushButton" name="browseBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Extract Directory:</string>
</property>
<property name="buddy">
<cstring>pathEdit</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="pathEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeIncrement">
<size>
<width>1</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="blenderEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Blender Override Path:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="blenderBtn">
<property name="maximumSize">
<size>
<width>32</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QTabWidget" name="heclTabs"> <widget class="QTabWidget" name="heclTabs">
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>2</number>
@ -251,8 +329,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>428</width> <width>464</width>
<height>592</height> <height>656</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@ -402,8 +480,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>161</width> <width>155</width>
<height>89</height> <height>80</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@ -451,8 +529,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>212</width> <width>209</width>
<height>47</height> <height>32</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@ -486,8 +564,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>210</width> <width>189</width>
<height>366</height> <height>358</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@ -629,6 +707,232 @@
<string>&amp;System Check</string> <string>&amp;System Check</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="10" column="1">
<widget class="QLabel" name="continuousTrackWarning">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;Continuous track selected!&lt;br/&gt;Continuous builds are built after every commit &lt;br/&gt;and have &lt;/span&gt;&lt;span style=&quot; font-weight:600; color:#ff0000;&quot;&gt;no&lt;/span&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt; guarantee of working at all.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="SysReqTableView" name="sysReqTable">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>68</green>
<blue>68</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QFormLayout" name="formLayout">
<property name="horizontalSpacing">
<number>12</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Downloaded Metaforce version:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="currentBinaryLabel">
<property name="text">
<string>none</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Recommended Metaforce version:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="recommendedBinaryLabel">
<property name="text">
<string>fetching...</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Update track:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="updateTrackComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Stable</string>
</property>
</item>
<item>
<property name="text">
<string>Development</string>
</property>
</item>
<item>
<property name="text">
<string>Continuous</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="5" column="1">
<widget class="QProgressBar" name="downloadProgressBar">
<property name="enabled">
<bool>false</bool>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="11" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="1">
<widget class="ErrorLabel" name="downloadErrorLabel">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>47</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>47</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="96">
<red>164</red>
<green>166</green>
<blue>168</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1"> <item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
@ -711,220 +1015,7 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="0" column="1">
<widget class="SysReqTableView" name="sysReqTable">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>68</green>
<blue>68</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<layout class="QFormLayout" name="formLayout">
<property name="horizontalSpacing">
<number>12</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Downloaded Metaforce version:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="currentBinaryLabel">
<property name="text">
<string>none</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Recommended Metaforce version:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="recommendedBinaryLabel">
<property name="text">
<string>fetching...</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Update track:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="updateTrackComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Stable</string>
</property>
</item>
<item>
<property name="text">
<string>Development</string>
</property>
</item>
<item>
<property name="text">
<string>Continuous</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="5" column="1">
<widget class="ErrorLabel" name="downloadErrorLabel">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>47</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>47</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="96">
<red>164</red>
<green>166</green>
<blue>168</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="1"> <item row="9" column="1">
<widget class="QLabel" name="continuousTrackWarning">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;Continuous track selected!&lt;br/&gt;Continuous builds are built after every commit &lt;br/&gt;and have &lt;/span&gt;&lt;span style=&quot; font-weight:600; color:#ff0000;&quot;&gt;no&lt;/span&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt; guarantee of working at all.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="1">
<widget class="QProgressBar" name="downloadProgressBar">
<property name="enabled">
<bool>false</bool>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLabel" name="devTrackWarning"> <widget class="QLabel" name="devTrackWarning">
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; color:#1a5fb4;&quot;&gt;Development track selected!&lt;br/&gt;Development builds are considered unstable and may cause crashes.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; color:#1a5fb4;&quot;&gt;Development track selected!&lt;br/&gt;Development builds are considered unstable and may cause crashes.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@ -934,19 +1025,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="aboutTab"> <widget class="QWidget" name="aboutTab">
@ -1205,19 +1283,19 @@
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.AppleSystemUIFont'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Noto Sans'; font-size:10pt; font-weight:600;&quot;&gt;About Metaforce&lt;/span&gt;&lt;/p&gt; &lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;About Metaforce&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Noto Sans'; font-size:10pt;&quot;&gt;&lt;br /&gt;The Metaforce frontend UI is designed and built by &lt;/span&gt;&lt;a href=&quot;https://axiodl.com&quot;&gt;&lt;span style=&quot; font-family:'Noto Sans'; font-size:10pt; text-decoration: underline; color:#007af4;&quot;&gt;Axiomatic Data Laboratories&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Noto Sans'; font-size:10pt;&quot;&gt; Copyright 2020&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-family:'Noto Sans'; font-size:10pt; font-weight:600;&quot;&gt;Authors:&lt;/span&gt;&lt;span style=&quot; font-family:'Noto Sans'; font-size:10pt;&quot;&gt;&lt;br /&gt;Phillip &amp;quot;Antidote&amp;quot; Stephens&lt;br /&gt;Jack &amp;quot;jackoalan&amp;quot; Andersen&lt;br /&gt;Luke &amp;quot;encounter&amp;quot; Street&lt;/span&gt;&lt;/p&gt; &lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;The Metaforce frontend UI is designed and built by &lt;a href=&quot;https://axiodl.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#007af4;&quot;&gt;Axiomatic Data Laboratories&lt;/span&gt;&lt;/a&gt; Copyright 2020&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Authors:&lt;/span&gt;&lt;br /&gt;Phillip &amp;quot;Antidote&amp;quot; Stephens&lt;br /&gt;Jack &amp;quot;jackoalan&amp;quot; Andersen&lt;br /&gt;Luke &amp;quot;encounter&amp;quot; Street&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:10pt;&quot;&gt;The MIT License&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New';&quot;&gt;The MIT License&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New'; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:10pt;&quot;&gt;Copyright (c) 2015-2021 Metaforce Contributors&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New';&quot;&gt;Copyright (c) 2015-2021 Metaforce Contributors&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:10pt;&quot;&gt;Original Authors: Jack Andersen and Phillip &amp;quot;Antidote&amp;quot; Stephens&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New';&quot;&gt;Original Authors: Jack Andersen and Phillip &amp;quot;Antidote&amp;quot; Stephens&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New'; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:10pt;&quot;&gt;Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &amp;quot;Software&amp;quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New';&quot;&gt;Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &amp;quot;Software&amp;quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New'; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:10pt;&quot;&gt;The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New';&quot;&gt;The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New'; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:10pt;&quot;&gt;THE SOFTWARE IS PROVIDED &amp;quot;AS IS&amp;quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New';&quot;&gt;THE SOFTWARE IS PROVIDED &amp;quot;AS IS&amp;quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="openExternalLinks"> <property name="openExternalLinks">
<bool>true</bool> <bool>true</bool>
@ -1228,62 +1306,7 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="5" column="0" rowspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Extract Directory:</string>
</property>
<property name="buddy">
<cstring>pathEdit</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="pathEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeIncrement">
<size>
<width>1</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="browseBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0" rowspan="3">
<layout class="QHBoxLayout" name="bottomButtonBox"> <layout class="QHBoxLayout" name="bottomButtonBox">
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">

View File

@ -82,6 +82,15 @@ void SysReqTableModel::updateFreeDiskSpace(const QString& path) {
} }
emit dataChanged(index(1, 0), index(1, 0)); emit dataChanged(index(1, 0), index(1, 0));
} }
void SysReqTableModel::updateBlender() {
hecl::blender::FindBlender(m_blendMajor, m_blendMinor);
if (m_blendMajor != 0) {
m_blendVersionStr = tr("Blender %1.%2").arg(QString::number(m_blendMajor), QString::number(m_blendMinor));
} else {
m_blendVersionStr = tr("Not Found");
}
emit dataChanged(index(1, 3), index(1, 3));
}
int SysReqTableModel::rowCount(const QModelIndex& parent) const { return 4; } int SysReqTableModel::rowCount(const QModelIndex& parent) const { return 4; }
@ -128,9 +137,10 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const {
return {}; return {};
#endif #endif
case 3: case 3:
auto [major, minor] = hecl::blender::GetRecommendedVersion();
return QStringLiteral("Blender %1.%2+") return QStringLiteral("Blender %1.%2+")
.arg(hecl::blender::MinBlenderMajorSearch) .arg(major)
.arg(hecl::blender::MinBlenderMinorSearch); .arg(minor);
} }
} else if (index.column() == 1) { } else if (index.column() == 1) {
/* Your System */ /* Your System */
@ -178,9 +188,7 @@ QVariant SysReqTableModel::headerData(int section, Qt::Orientation orientation,
} }
bool SysReqTableModel::isBlenderVersionOk() const { bool SysReqTableModel::isBlenderVersionOk() const {
return (m_blendMajor >= hecl::blender::MinBlenderMajorSearch && return hecl::blender::IsVersionSupported(m_blendMajor, m_blendMinor);
m_blendMajor <= hecl::blender::MaxBlenderMajorSearch) &&
(m_blendMinor >= hecl::blender::MinBlenderMinorSearch && m_blendMinor <= hecl::blender::MaxBlenderMinorSearch);
} }
void SysReqTableView::paintEvent(QPaintEvent* e) { void SysReqTableView::paintEvent(QPaintEvent* e) {

View File

@ -30,6 +30,7 @@ public:
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
bool isBlenderVersionOk() const; bool isBlenderVersionOk() const;
void updateFreeDiskSpace(const QString& path); void updateFreeDiskSpace(const QString& path);
void updateBlender();
}; };
class SysReqTableView : public QTableView { class SysReqTableView : public QTableView {
@ -43,4 +44,5 @@ public:
const SysReqTableModel& getModel() const { return m_model; } const SysReqTableModel& getModel() const { return m_model; }
bool isBlenderVersionOk() const { return m_model.isBlenderVersionOk(); } bool isBlenderVersionOk() const { return m_model.isBlenderVersionOk(); }
void updateFreeDiskSpace(const QString& path) { m_model.updateFreeDiskSpace(path); } void updateFreeDiskSpace(const QString& path) { m_model.updateFreeDiskSpace(path); }
void updateBlender() { m_model.updateBlender(); }
}; };

View File

@ -2,7 +2,7 @@
#define VERSION_H #define VERSION_H
#define METAFORCE_WC_DESCRIBE "@METAFORCE_WC_DESCRIBE@" #define METAFORCE_WC_DESCRIBE "@METAFORCE_WC_DESCRIBE@"
#define METAFORCE_VERSION_STRING "@METAFORCE_VERISON_STRING@" #define METAFORCE_VERSION_STRING "@METAFORCE_VERSION_STRING@"
#define METAFORCE_WC_BRANCH "@METAFORCE_WC_BRANCH@" #define METAFORCE_WC_BRANCH "@METAFORCE_WC_BRANCH@"
#define METAFORCE_WC_REVISION "@METAFORCE_WC_REVISION@" #define METAFORCE_WC_REVISION "@METAFORCE_WC_REVISION@"