diff --git a/DataSpec/Blender/RetroMasterShader.py b/DataSpec/Blender/RetroMasterShader.py index fe97fd640..70f837978 100644 --- a/DataSpec/Blender/RetroMasterShader.py +++ b/DataSpec/Blender/RetroMasterShader.py @@ -768,8 +768,8 @@ def make_retro_shader_mp3_color(): input.default_value = (0.0, 0.0, 0.0, 1.0) input = new_grp.inputs.new("NodeSocketInt", "Add INCA") input.default_value = 0 - input.min_value = 0.000000 - input.max_value = 1.000000 + input.min_value = 0 + input.max_value = 1 input = new_grp.inputs.new("NodeSocketFloatFactor", "OPAC") input.default_value = 1.0 input.min_value = 0.000000 @@ -1057,8 +1057,8 @@ def make_retro_shader_mp3_bloom(): input.max_value = 1.000000 input = new_grp.inputs.new("NodeSocketInt", "Add INCA") input.default_value = 0 - input.min_value = 0.000000 - input.max_value = 1.000000 + input.min_value = 0 + input.max_value = 1 new_grp.outputs.new("NodeSocketShader", "Shader") nodes = {} node = new_grp.nodes.new("ShaderNodeMath") @@ -1261,8 +1261,8 @@ def make_retro_shader_mp3(): input.max_value = 1.000000 input = new_grp.inputs.new("NodeSocketInt", "Add INCA") input.default_value = 0 - input.min_value = 0.000000 - input.max_value = 1.000000 + input.min_value = 0 + input.max_value = 1 input = new_grp.inputs.new("NodeSocketFloatFactor", "BNIF") input.default_value = 0.0 input.min_value = 0.000000 diff --git a/DataSpec/DNAMP1/DNAMP1.cpp b/DataSpec/DNAMP1/DNAMP1.cpp index b071c99da..aeda873f6 100644 --- a/DataSpec/DNAMP1/DNAMP1.cpp +++ b/DataSpec/DNAMP1/DNAMP1.cpp @@ -215,17 +215,19 @@ void PAKBridge::addCMDLRigPairs(PAKRouter& pakRouter, CharacterAssoci PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdl); PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskr); PAK::Entry* cinfEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cinf); - cmdlEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_model"), id, ci.name); - cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_skin"), id, ci.name); - cinfEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_skel"), id, ci.name); - if (ci.cmdlIce.isValid() && ci.cskrIce.isValid()) { - charAssoc.m_cmdlRigs[ci.cmdlIce] = {ci.cskrIce, ci.cinf}; - charAssoc.m_cskrToCharacter[ci.cskrIce] = - std::make_pair(entry.id, fmt::format(FMT_STRING("{}.ICE_{}.CSKR"), ci.name, ci.cskrIce)); - PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlIce); - PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrIce); - cmdlEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_icemodel"), id, ci.name); - cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_iceskin"), id, ci.name); + if (cmdlEnt != nullptr && cskrEnt != nullptr && cinfEnt != nullptr) { + cmdlEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_model"), id, ci.name); + cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_skin"), id, ci.name); + cinfEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_skel"), id, ci.name); + if (ci.cmdlIce.isValid() && ci.cskrIce.isValid()) { + charAssoc.m_cmdlRigs[ci.cmdlIce] = {ci.cskrIce, ci.cinf}; + charAssoc.m_cskrToCharacter[ci.cskrIce] = + std::make_pair(entry.id, fmt::format(FMT_STRING("{}.ICE_{}.CSKR"), ci.name, ci.cskrIce)); + PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlIce); + PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrIce); + cmdlEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_icemodel"), id, ci.name); + cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_iceskin"), id, ci.name); + } } } std::map> animInfo; diff --git a/DataSpec/DNAMP1/FRME.cpp b/DataSpec/DNAMP1/FRME.cpp index 1927a6129..27e89411a 100644 --- a/DataSpec/DNAMP1/FRME.cpp +++ b/DataSpec/DNAMP1/FRME.cpp @@ -338,7 +338,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: "cam.lens_unit = 'FOV'\n" "cam.clip_start = {}\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); if (proj->aspect > 1.f) os.format(FMT_STRING("cam.angle = math.atan2({}, 1.0 / math.tan(math.radians({} / 2.0))) * 2.0\n"), diff --git a/DataSpec/DNAMP1/MREA.cpp b/DataSpec/DNAMP1/MREA.cpp index 46636f73a..d3ab74930 100644 --- a/DataSpec/DNAMP1/MREA.cpp +++ b/DataSpec/DNAMP1/MREA.cpp @@ -651,11 +651,16 @@ bool MREA::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat secs.emplace_back(preVisiLen, 0); memcpy(secs.back().data(), preVisiData.get(), preVisiLen); 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 (!visiGood) { 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); } } +#endif #endif } } diff --git a/DataSpec/DNAMP1/SCLY.cpp b/DataSpec/DNAMP1/SCLY.cpp index e99d97bf4..8ac610788 100644 --- a/DataSpec/DNAMP1/SCLY.cpp +++ b/DataSpec/DNAMP1/SCLY.cpp @@ -108,7 +108,7 @@ void SCLY::ScriptLayer::Enumerate(athena::io::IStreamReader& rs) { [&type](const ScriptObjectSpec* obj) -> bool { return obj->type == type; }); if (iter != SCRIPT_OBJECT_DB.end()) { - std::unique_ptr obj((*iter)->a()); + std::unique_ptr obj((*iter)->loader()); obj->type = type; obj->read(rs); objects.push_back(std::move(obj)); @@ -141,7 +141,7 @@ void SCLY::ScriptLayer::Enumerate(athena::io::YAMLDocReader& r [&type](const ScriptObjectSpec* obj) -> bool { return obj->type == type; }); if (iter != SCRIPT_OBJECT_DB.end()) { - std::unique_ptr obj((*iter)->a()); + std::unique_ptr obj((*iter)->loader()); obj->read(rs); obj->type = type; objects.push_back(std::move(obj)); diff --git a/DataSpec/DNAMP1/ScriptObjects/MazeNode.hpp b/DataSpec/DNAMP1/ScriptObjects/MazeNode.hpp index c6e740f19..b93a60691 100644 --- a/DataSpec/DNAMP1/ScriptObjects/MazeNode.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/MazeNode.hpp @@ -10,12 +10,12 @@ struct MazeNode : IScriptObject { String<-1> name; Value location; Value orientation; - Value unknown1; - Value unknown2; - Value unknown3; - Value unknown4; - Value unknown5; - Value unknown6; - Value unknown7; + Value active; + Value col; + Value row; + Value side; + Value actorPos; + Value triggerPos; + Value effectPos; }; } // namespace DataSpec::DNAMP1 diff --git a/DataSpec/DNAMP1/ScriptObjects/ScriptTypes.hpp b/DataSpec/DNAMP1/ScriptObjects/ScriptTypes.hpp index a354c9430..b0febb999 100644 --- a/DataSpec/DNAMP1/ScriptObjects/ScriptTypes.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/ScriptTypes.hpp @@ -9,7 +9,7 @@ struct IScriptObject; struct ScriptObjectSpec { atUint8 type; - IScriptObject* (*a)(); + IScriptObject* (*loader)(); }; using ScriptObjectDBArray = std::array; diff --git a/Runtime/CBasics.hpp b/Runtime/CBasics.hpp index 8e76e67fe..7e761fea0 100644 --- a/Runtime/CBasics.hpp +++ b/Runtime/CBasics.hpp @@ -34,6 +34,7 @@ public: static OSTime ToWiiTime(std::chrono::system_clock::time_point time); static std::chrono::system_clock::time_point FromWiiTime(OSTime wiiTime); + static OSTime GetTime() { return ToWiiTime(std::chrono::system_clock::now()); } static u64 GetGCTicks(); static constexpr u64 GetGCTicksPerSec() { return 486000000ull; } diff --git a/Runtime/CGameState.cpp b/Runtime/CGameState.cpp index c054f1ad5..ccfbc9a6c 100644 --- a/Runtime/CGameState.cpp +++ b/Runtime/CGameState.cpp @@ -221,7 +221,7 @@ void CGameState::PutTo(CBitStreamWriter& writer) { 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_25_initPowerupsAtFirstSpawn, 1); writer.WriteEncoded(u32(x84_mlvlId.Value()), 32); diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index 3fe04ea60..56ab6ec29 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -1330,8 +1330,14 @@ void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMes } if (m_logScripting) { - LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg), - dest->GetName(), dest->GetUniqueId()); + auto srcObj = GetObjectById(src); + 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); @@ -1349,8 +1355,14 @@ void CStateManager::SendScriptMsgAlways(TUniqueId dest, TUniqueId src, EScriptOb } if (m_logScripting) { - LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg), - dst->GetName(), dst->GetUniqueId()); + auto srcObj = GetObjectById(src); + 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); diff --git a/Runtime/MP1/World/CMetroidPrimeExo.cpp b/Runtime/MP1/World/CMetroidPrimeExo.cpp index a3f214bf2..4d4da58a5 100644 --- a/Runtime/MP1/World/CMetroidPrimeExo.cpp +++ b/Runtime/MP1/World/CMetroidPrimeExo.cpp @@ -359,7 +359,7 @@ void CMetroidPrimeExo::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId other SetBoneTrackingTarget(mgr, true); CreatePlasmaProjectiles(mgr); CreatePhysicsDummy(mgr); - sub802755ac(mgr, true); + EnableParticles(mgr, true); CreateHUDBillBoard(mgr); mgr.GetPlayer().SetFrozenTimeoutBias(2.f); break; @@ -440,6 +440,7 @@ void CMetroidPrimeExo::Touch(CActor& act, CStateManager& mgr) { void CMetroidPrimeExo::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) { if (type == EUserEventType::ScreenShake) { + // TODO: Implement return; } if (type == EUserEventType::EffectOff) { @@ -457,14 +458,14 @@ void CMetroidPrimeExo::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& } if (type == EUserEventType::DamageOn) { if (x92c_ == 11) { - sub802755ac(mgr, true); + EnableParticles(mgr, true); x1054_26_ = true; } else if (x92c_ == 7) { FirePlasmaProjectile(mgr, true); } } else if (type == EUserEventType::DamageOff) { if (x92c_ == 1) { - sub802755ac(mgr, false); + EnableParticles(mgr, false); } else if (x92c_ == 7) { FirePlasmaProjectile(mgr, false); } @@ -506,8 +507,8 @@ void CMetroidPrimeExo::Run(CStateManager& mgr, EStateMsg msg, float arg) { TUniqueId wpId = GetNextAttackWaypoint(mgr, true); if (TCastToConstPtr wp = mgr.GetObjectById(wpId)) { GetBodyController()->SetLocomotionType(sub80275e14(1)); - SetDestPos(wp->GetTranslation()); x2dc_destObj = wpId; + SetDestPos(wp->GetTranslation()); x2ec_reflectedDestPos = GetTranslation(); x328_24_inPosition = false; } @@ -548,7 +549,7 @@ void CMetroidPrimeExo::TurnAround(CStateManager& mgr, EStateMsg msg, float arg) x1078_ = 1; zeus::CVector3f vec = sub8027464c(mgr); 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) { x92c_ = 0; @@ -656,7 +657,7 @@ void CMetroidPrimeExo::Suck(CStateManager& mgr, EStateMsg msg, float arg) { x1078_ = 1; GetBodyController()->SetLocomotionType(skLocomotions[x1078_]); x92c_ = 0; - sub802755ac(mgr, false); + EnableParticles(mgr, false); sub802738d4(mgr); x1088_ = 0.6f; 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) { if (GetBodyController()->GetPercentageFrozen() > 0.f && x1054_24_) { - sub802755ac(mgr, false); + EnableParticles(mgr, false); x1054_25_ = true; } @@ -1156,7 +1157,7 @@ void CMetroidPrimeExo::UpdateParticles(float f1, CStateManager& mgr) { 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) { x1000_[i]->SetParticleEmission(b1); if (!b1) { @@ -1500,7 +1501,7 @@ TUniqueId CMetroidPrimeExo::GetWaypointForBehavior(CStateManager& mgr, EScriptOb const auto* ent = mgr.GetObjectById(uid); if (ent != nullptr && ent->GetActive()) { uids.push_back(uid); - if (uids.size() == 8) { + if (uids.size() >= 8) { break; } } diff --git a/Runtime/MP1/World/CMetroidPrimeExo.hpp b/Runtime/MP1/World/CMetroidPrimeExo.hpp index 2410cf9da..5a843e5e7 100644 --- a/Runtime/MP1/World/CMetroidPrimeExo.hpp +++ b/Runtime/MP1/World/CMetroidPrimeExo.hpp @@ -216,7 +216,7 @@ class CMetroidPrimeExo : public CPatterned { 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 UpdateParticles(float f1, CStateManager& mgr); - void sub802755ac(CStateManager& mgr, bool b1); + void EnableParticles(CStateManager& mgr, bool b1); void EnableHeadOrbitAndTarget(CStateManager& mgr); void DisableHeadOrbitAndTarget(CStateManager& mgr); void UpdateTimers(float mgr); diff --git a/Runtime/Weapon/CPhazonBeam.cpp b/Runtime/Weapon/CPhazonBeam.cpp index a88b40a58..df3d3a809 100644 --- a/Runtime/Weapon/CPhazonBeam.cpp +++ b/Runtime/Weapon/CPhazonBeam.cpp @@ -208,9 +208,9 @@ void CPhazonBeam::Draw(bool drawSuitArm, const CStateManager& mgr, const zeus::C } if (x274_26_veinsAlphaActive) { 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 { - x224_phazonVeinsData->Render(mgr, xf, lights, flags); + x224_phazonVeinsData->Render(mgr, modelXf, lights, flags); } } } diff --git a/Runtime/Weapon/CPlayerGun.cpp b/Runtime/Weapon/CPlayerGun.cpp index 60d5eb6c5..1ed26b45a 100644 --- a/Runtime/Weapon/CPlayerGun.cpp +++ b/Runtime/Weapon/CPlayerGun.cpp @@ -632,7 +632,7 @@ void CPlayerGun::HandlePhazonBeamChange(CStateManager& mgr) { inMorph = true; break; case EPhazonBeamState::Active: - if (!x835_25_inPhazonBeam) { + if (!x835_24_canFirePhazon) { SetPhazonBeamMorph(true); x338_nextState = ENextState::ExitPhazonBeam; inMorph = true; diff --git a/Runtime/World/CPlayerCameraBob.cpp b/Runtime/World/CPlayerCameraBob.cpp index 84656c2f3..f7516d96f 100644 --- a/Runtime/World/CPlayerCameraBob.cpp +++ b/Runtime/World/CPlayerCameraBob.cpp @@ -1,8 +1,6 @@ #include "Runtime/World/CPlayerCameraBob.hpp" #include "Runtime/CStateManager.hpp" -#include "Runtime/Camera/CCameraManager.hpp" -#include "Runtime/Particle/CGenDescription.hpp" #include "Runtime/World/CPlayer.hpp" #include diff --git a/Runtime/World/CScriptTrigger.cpp b/Runtime/World/CScriptTrigger.cpp index 5fe743afa..161b3594b 100644 --- a/Runtime/World/CScriptTrigger.cpp +++ b/Runtime/World/CScriptTrigger.cpp @@ -33,6 +33,13 @@ CScriptTrigger::CScriptTrigger(TUniqueId uid, std::string_view name, const CEnti GetEditorId(), GetAreaIdAlways()); 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 } diff --git a/Runtime/World/CStateMachine.hpp b/Runtime/World/CStateMachine.hpp index 671030044..b2600f39d 100644 --- a/Runtime/World/CStateMachine.hpp +++ b/Runtime/World/CStateMachine.hpp @@ -4,9 +4,9 @@ #include "Runtime/CToken.hpp" #include "Runtime/GCNTypes.hpp" +#include "Runtime/IOStreams.hpp" #include "Runtime/IObj.hpp" #include "Runtime/IObjFactory.hpp" -#include "Runtime/IOStreams.hpp" #include "Runtime/World/CAiFuncMap.hpp" namespace metaforce { diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index aa543a1d2..3c59d0b25 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -3760,15 +3760,15 @@ CEntity* ScriptLoader::LoadMazeNode(CStateManager& mgr, CInputStream& in, int pr SActorHead aHead = LoadActorHead(in, mgr); bool active = in.readBool(); - u32 w1 = in.readUint32Big(); - u32 w2 = in.readUint32Big(); - u32 w3 = in.readUint32Big(); - zeus::CVector3f vec1 = zeus::CVector3f::ReadBig(in); - zeus::CVector3f vec2 = zeus::CVector3f::ReadBig(in); - zeus::CVector3f vec3 = zeus::CVector3f::ReadBig(in); + u32 col = in.readUint32Big(); + u32 row = in.readUint32Big(); + u32 side = in.readUint32Big(); + zeus::CVector3f actorPos = zeus::CVector3f::ReadBig(in); + zeus::CVector3f triggerPos = 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, - vec2, vec3); + return new CScriptMazeNode(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, col, row, side, + actorPos, triggerPos, effectPos); } CEntity* ScriptLoader::LoadOmegaPirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { diff --git a/Runtime/platforms/freedesktop/metaforce.desktop b/Runtime/platforms/freedesktop/metaforce.desktop new file mode 100644 index 000000000..9c669db56 --- /dev/null +++ b/Runtime/platforms/freedesktop/metaforce.desktop @@ -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 diff --git a/Runtime/platforms/freedesktop/urde.desktop b/Runtime/platforms/freedesktop/urde.desktop deleted file mode 100644 index a79047f29..000000000 --- a/Runtime/platforms/freedesktop/urde.desktop +++ /dev/null @@ -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; diff --git a/extern/nod b/extern/nod index 2f53b2174..30697375a 160000 --- a/extern/nod +++ b/extern/nod @@ -1 +1 @@ -Subproject commit 2f53b2174040eb0bc84fce8799b7a9be630eabd5 +Subproject commit 30697375adee818e9c14015584c6629e12d27ab4 diff --git a/hecl/blender/hecl/sact/SACTAction.py b/hecl/blender/hecl/sact/SACTAction.py index 1a25ce9a9..742becd32 100644 --- a/hecl/blender/hecl/sact/SACTAction.py +++ b/hecl/blender/hecl/sact/SACTAction.py @@ -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_new = 60 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: 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_new = action_obj.hecl_fps 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 #SACTEvent.clear_action_events(self, context, actor_data) diff --git a/hecl/blender/hecl_blendershell.py b/hecl/blender/hecl_blendershell.py index 7af8a934f..14c01ad04 100644 --- a/hecl/blender/hecl_blendershell.py +++ b/hecl/blender/hecl_blendershell.py @@ -505,7 +505,11 @@ try: bpy.context.preferences.filepaths.save_version = 0 print('SAVING %s' % 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') else: writepipestr(b'CANCELLED') diff --git a/hecl/include/hecl/Blender/FindBlender.hpp b/hecl/include/hecl/Blender/FindBlender.hpp index 7ebdde3ca..bfce482a0 100644 --- a/hecl/include/hecl/Blender/FindBlender.hpp +++ b/hecl/include/hecl/Blender/FindBlender.hpp @@ -3,11 +3,10 @@ #include "hecl/hecl.hpp" 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 FindBlender(int& major, int& minor); - +bool IsVersionSupported(int major, int minor); +std::pair GetLatestSupportedVersion(); +std::pair GetEarliestSupportedVersion(); +std::pair GetRecommendedVersion(); +void SetOverridePath(std::string_view overridePath); } // namespace hecl::blender diff --git a/hecl/lib/Blender/Connection.cpp b/hecl/lib/Blender/Connection.cpp index bb596b22c..19527c565 100644 --- a/hecl/lib/Blender/Connection.cpp +++ b/hecl/lib/Blender/Connection.cpp @@ -466,8 +466,9 @@ Connection::Connection(int verbosityLevel) { BlenderLog.report(logvisor::Fatal, FMT_STRING("Unable to find blender")); } else if (lineStr == "INVALIDBLENDERVER") { _closePipe(); + auto [major, minor] = hecl::blender::GetEarliestSupportedVersion(); BlenderLog.report(logvisor::Fatal, FMT_STRING("Installed blender version must be >= {}.{}"), - MinBlenderMajorSearch, MinBlenderMinorSearch); + major, minor); } else if (lineStr == "NOADDON") { _closePipe(); if (blenderAddonPath != "SKIPINSTALL") diff --git a/hecl/lib/Blender/FindBlender.cpp b/hecl/lib/Blender/FindBlender.cpp index a3c59f114..733359d9b 100644 --- a/hecl/lib/Blender/FindBlender.cpp +++ b/hecl/lib/Blender/FindBlender.cpp @@ -2,9 +2,24 @@ #include "hecl/SteamFinder.hpp" +#include #include 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__ #define DEFAULT_BLENDER_BIN "/Applications/Blender.app/Contents/MacOS/blender" @@ -40,8 +55,14 @@ std::optional FindBlender(int& major, int& minor) { major = 0; minor = 0; - /* User-specified blender path */ - auto blenderBin = GetEnv("BLENDER_BIN"); + std::optional blenderBin; + if (!OverridePath.empty()) { + blenderBin = {OverridePath}; + } else { + /* User-specified blender path */ + blenderBin = GetEnv("BLENDER_BIN"); + } + if (blenderBin && !RegFileExists(blenderBin->c_str())) { blenderBin.reset(); } @@ -63,19 +84,12 @@ std::optional FindBlender(int& major, int& minor) { wchar_t wProgFiles[256]; if (GetEnvironmentVariableW(L"ProgramFiles", wProgFiles, 256)) { auto progFiles = nowide::narrow(wProgFiles); - for (size_t major = MaxBlenderMajorSearch; major >= MinBlenderMajorSearch; --major) { - bool found = false; - for (size_t minor = MaxBlenderMinorSearch; minor >= MinBlenderMinorSearch; --minor) { - std::string blenderBinBuf = fmt::format(FMT_STRING("{}\\Blender Foundation\\Blender {}.{}\\blender.exe"), - progFiles, major, minor); - if (RegFileExists(blenderBinBuf.c_str())) { - blenderBin = std::move(blenderBinBuf); - found = true; - break; - } - } - - if (found) { + for (const auto& version : SupportedVersions) { + std::string blenderBinBuf = + fmt::format(FMT_STRING("{}\\Blender Foundation\\Blender {}.{}\\blender.exe"), + progFiles, version.Major, version.Minor); + if (RegFileExists(blenderBinBuf.c_str())) { + blenderBin = std::move(blenderBinBuf); break; } } @@ -133,7 +147,7 @@ std::optional FindBlender(int& major, int& minor) { std::string command = std::string("\"") + blenderBin.value() + "\" --version"; FILE* fp = popen(command.c_str(), "r"); char versionBuf[256]; - size_t rdSize = fread(versionBuf, 1, 255, fp); + size_t rdSize = fread(&versionBuf[0], 1, 255, fp); versionBuf[rdSize] = '\0'; pclose(fp); @@ -147,4 +161,21 @@ std::optional FindBlender(int& major, int& minor) { 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 GetLatestSupportedVersion() { + return {SupportedVersions.front().Major, SupportedVersions.front().Minor}; +} +std::pair GetEarliestSupportedVersion() { + return {SupportedVersions.back().Major, SupportedVersions.back().Minor}; +} + +std::pair GetRecommendedVersion() { return {RecommendedVersion.Major, RecommendedVersion.Minor}; } + +void SetOverridePath(std::string_view overridePath) { OverridePath = overridePath; } } // namespace hecl::blender diff --git a/hecl/lib/Blender/SDNARead.cpp b/hecl/lib/Blender/SDNARead.cpp index 723d2986e..4b839131d 100644 --- a/hecl/lib/Blender/SDNARead.cpp +++ b/hecl/lib/Blender/SDNARead.cpp @@ -79,44 +79,51 @@ SDNARead::SDNARead(std::string_view path) { r.readUBytesToBuf(magicBuf, 7); r.seek(0, athena::SeekOrigin::Begin); if (strncmp(magicBuf, "BLENDER", 7)) { - /* Try gzip decompression */ - std::unique_ptr 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; + atUint32 magic = hecl::SLittle(*(atUint32*)(magicBuf)); + if (magic == 0xfd2fb528) { + /* Try zstandard decompression */ + // TODO: Implement + m_data = {}; + } else if (magic == 0x88b1f) { + /* Try gzip decompression */ + std::unique_ptr 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; - while ((rs = r.readUBytesToBuf(compBuf.get(), 4096))) { - int inflateRet; - zstrm.next_in = compBuf.get(); - zstrm.avail_in = rs; - while (zstrm.avail_in) { - if (!zstrm.avail_out) { - zstrm.avail_out = m_data.size(); - m_data.resize(zstrm.avail_out * 2); - zstrm.next_out = (Bytef*)m_data.data() + zstrm.avail_out; + atUint64 rs; + while ((rs = r.readUBytesToBuf(compBuf.get(), 4096))) { + int inflateRet; + zstrm.next_in = compBuf.get(); + zstrm.avail_in = rs; + while (zstrm.avail_in) { + if (!zstrm.avail_out) { + zstrm.avail_out = m_data.size(); + m_data.resize(zstrm.avail_out * 2); + 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(); + return; + } } - inflateRet = inflate(&zstrm, Z_NO_FLUSH); if (inflateRet == Z_STREAM_END) break; - if (inflateRet != Z_OK) { - inflateEnd(&zstrm); - m_data = std::vector(); - return; - } } - if (inflateRet == Z_STREAM_END) - break; - } - inflateEnd(&zstrm); + inflateEnd(&zstrm); - if (strncmp((char*)m_data.data(), "BLENDER", 7)) { - m_data = std::vector(); - return; + if (strncmp((char*)m_data.data(), "BLENDER", 7)) { + m_data = std::vector(); + return; + } } } else { m_data.resize(length); diff --git a/hecl/lib/hecl.cpp b/hecl/lib/hecl.cpp index ce55f8c7b..a5e871850 100644 --- a/hecl/lib/hecl.cpp +++ b/hecl/lib/hecl.cpp @@ -161,7 +161,7 @@ bool IsPathBlend(const hecl::ProjectPath& path) { } buf = hecl::SLittle(buf); - return buf == 0x4e454c42 || buf == 0x88b1f; + return buf == 0x4e454c42 || buf == 0x88b1f || buf == 0xfd2fb528; } bool IsPathYAML(const hecl::ProjectPath& path) { diff --git a/metaforce-gui/CMakeLists.txt b/metaforce-gui/CMakeLists.txt index 46a0747f2..10b0731f7 100644 --- a/metaforce-gui/CMakeLists.txt +++ b/metaforce-gui/CMakeLists.txt @@ -131,11 +131,13 @@ elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") endif () 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 platforms/win/metaforce-gui.manifest platforms/win/metaforce-gui.rc ) elseif (APPLE) + configure_file(platforms/mac/Info.plist.in "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist" @ONLY) set_target_properties(metaforce-gui PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist" ) diff --git a/metaforce-gui/FileDirDialog.hpp b/metaforce-gui/FileDirDialog.hpp index ade623493..6eeca5a52 100644 --- a/metaforce-gui/FileDirDialog.hpp +++ b/metaforce-gui/FileDirDialog.hpp @@ -5,5 +5,7 @@ class FileDirDialog : public QFileDialog { Q_OBJECT public: - FileDirDialog(QWidget* parent = nullptr) : QFileDialog(parent) { setFileMode(QFileDialog::Directory); } + FileDirDialog(QWidget* parent = nullptr, QFileDialog::FileMode mode = QFileDialog::Directory) : QFileDialog(parent) { + setFileMode(mode); + } }; diff --git a/metaforce-gui/MainWindow.cpp b/metaforce-gui/MainWindow.cpp index 7b3ef4649..828dfe81e 100644 --- a/metaforce-gui/MainWindow.cpp +++ b/metaforce-gui/MainWindow.cpp @@ -14,6 +14,8 @@ #include "FileDirDialog.hpp" #include "ExtractZip.hpp" +#include "hecl/Blender/FindBlender.hpp" + #if _WIN32 #include #include @@ -131,6 +133,7 @@ MainWindow::MainWindow(QWidget* parent) m_dlManager.fetchIndex(); setPath(m_settings.value(QStringLiteral("working_dir")).toString()); + setBlenderOverride(m_settings.value(QStringLiteral("blender_override_path")).toString()); resize(1024, 768); } @@ -154,6 +157,9 @@ void MainWindow::onExtract() { QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert(QStringLiteral("TERM"), QStringLiteral("xterm-color")); 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); disconnect(&m_heclProc, qOverload(&QProcess::finished), nullptr, nullptr); connect(&m_heclProc, qOverload(&QProcess::finished), this, &MainWindow::onExtractFinished); @@ -189,6 +195,9 @@ void MainWindow::onPackage() { QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert(QStringLiteral("TERM"), QStringLiteral("xterm-color")); 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); disconnect(&m_heclProc, qOverload(&QProcess::finished), nullptr, nullptr); connect(&m_heclProc, qOverload(&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); } if (!err && !m_ui->sysReqTable->isBlenderVersionOk()) { - m_ui->downloadErrorLabel->setText( - 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)); } } @@ -318,6 +333,8 @@ void MainWindow::disableOperations() { m_ui->launchBtn->setEnabled(false); m_ui->pathEdit->setEnabled(false); m_ui->browseBtn->setEnabled(false); + m_ui->blenderEdit->setEnabled(false); + m_ui->blenderBtn->setEnabled(false); m_ui->downloadButton->setEnabled(false); m_ui->warpBtn->setEnabled(false); } @@ -326,6 +343,8 @@ void MainWindow::enableOperations() { disableOperations(); m_ui->pathEdit->setEnabled(true); m_ui->browseBtn->setEnabled(true); + m_ui->blenderEdit->setEnabled(true); + m_ui->blenderBtn->setEnabled(true); if (hecl::com_enableCheats->toBoolean()) { m_ui->warpBtn->show(); @@ -357,7 +376,14 @@ void MainWindow::enableOperations() { } 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()) { insertContinueNote(tr("Package complete - Press 'Launch' to start Metaforce.")); } else if (m_ui->packageBtn->isEnabled()) { @@ -514,15 +540,60 @@ void MainWindow::initSlots() { if (res == QFileDialog::Rejected) return; - if (dialog.selectedFiles().size() <= 0) + if (dialog.selectedFiles().empty()) return; setPath(dialog.selectedFiles().at(0)); }); 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); } +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) { m_inContinueNote = false; diff --git a/metaforce-gui/MainWindow.hpp b/metaforce-gui/MainWindow.hpp index 2c4de4f32..1c431b0d1 100644 --- a/metaforce-gui/MainWindow.hpp +++ b/metaforce-gui/MainWindow.hpp @@ -35,6 +35,7 @@ class MainWindow : public QMainWindow { QString m_path; QString m_metaforcePath; QString m_heclPath; + QString m_blenderOverridePath; QProcess m_heclProc; DownloadManager m_dlManager; QStringList m_warpSettings; @@ -77,4 +78,5 @@ private: void initGraphicsApiOption(QRadioButton* action, bool hidden, bool isDefault); void initNumberComboOption(QComboBox* action, hecl::CVar* cvar); void initCheckboxOption(QCheckBox* action, hecl::CVar* cvar); + void setBlenderOverride(const QString& path); }; diff --git a/metaforce-gui/MainWindow.ui b/metaforce-gui/MainWindow.ui index f8a7ca099..83a6e6bd7 100644 --- a/metaforce-gui/MainWindow.ui +++ b/metaforce-gui/MainWindow.ui @@ -21,7 +21,85 @@ - + + + + + + + 0 + 0 + + + + + 32 + 16777215 + + + + ... + + + + + + + + 0 + 0 + + + + Extract Directory: + + + pathEdit + + + + + + + + 0 + 0 + + + + + 1 + 0 + + + + + + + + + + + Blender Override Path: + + + + + + + + 32 + 16777215 + + + + ... + + + + + + 2 @@ -251,8 +329,8 @@ 0 0 - 428 - 592 + 464 + 656 @@ -402,8 +480,8 @@ 0 0 - 161 - 89 + 155 + 80 @@ -451,8 +529,8 @@ 0 0 - 212 - 47 + 209 + 32 @@ -486,8 +564,8 @@ 0 0 - 210 - 366 + 189 + 358 @@ -629,6 +707,232 @@ &System Check + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + <html><head/><body><p align="center"><span style=" color:#ff0000;">Continuous track selected!<br/>Continuous builds are built after every commit <br/>and have </span><span style=" font-weight:600; color:#ff0000;">no</span><span style=" color:#ff0000;"> guarantee of working at all.</span></p></body></html> + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 68 + 68 + 68 + + + + + + + + QAbstractItemView::NoSelection + + + + + + + 12 + + + + + Downloaded Metaforce version: + + + + + + + none + + + + + + + Recommended Metaforce version: + + + + + + + fetching... + + + + + + + Update track: + + + + + + + + 0 + 0 + + + + + Stable + + + + + Development + + + + + Continuous + + + + + + + + + + false + + + 0 + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + + + + + + 255 + 47 + 0 + + + + + + + + + 255 + 47 + 0 + + + + + + + + + 164 + 166 + 168 + + + + + + + + + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + @@ -711,220 +1015,7 @@ - - - - - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - - - 68 - 68 - 68 - - - - - - - - QAbstractItemView::NoSelection - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - 12 - - - - - Downloaded Metaforce version: - - - - - - - none - - - - - - - Recommended Metaforce version: - - - - - - - fetching... - - - - - - - Update track: - - - - - - - - 0 - 0 - - - - - Stable - - - - - Development - - - - - Continuous - - - - - - - - - - - - - - - 255 - 47 - 0 - - - - - - - - - 255 - 47 - 0 - - - - - - - - - 164 - 166 - 168 - - - - - - - - - - - true - - - - - - <html><head/><body><p align="center"><span style=" color:#ff0000;">Continuous track selected!<br/>Continuous builds are built after every commit <br/>and have </span><span style=" font-weight:600; color:#ff0000;">no</span><span style=" color:#ff0000;"> guarantee of working at all.</span></p></body></html> - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - false - - - 0 - - - - <html><head/><body><p align="center"><span style=" color:#1a5fb4;">Development track selected!<br/>Development builds are considered unstable and may cause crashes.</span></p></body></html> @@ -934,19 +1025,6 @@ - - - - Qt::Vertical - - - - 0 - 0 - - - - @@ -1205,19 +1283,19 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'.AppleSystemUIFont'; font-size:13pt; font-weight:400; font-style:normal;"> -<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:10pt; font-weight:600;">About Metaforce</span></p> -<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:10pt;"><br />The Metaforce frontend UI is designed and built by </span><a href="https://axiodl.com"><span style=" font-family:'Noto Sans'; font-size:10pt; text-decoration: underline; color:#007af4;">Axiomatic Data Laboratories</span></a><span style=" font-family:'Noto Sans'; font-size:10pt;"> Copyright 2020<br /><br /></span><span style=" font-family:'Noto Sans'; font-size:10pt; font-weight:600;">Authors:</span><span style=" font-family:'Noto Sans'; font-size:10pt;"><br />Phillip &quot;Antidote&quot; Stephens<br />Jack &quot;jackoalan&quot; Andersen<br />Luke &quot;encounter&quot; Street</span></p> -<p style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New'; font-size:10pt;">The MIT License</span></p> -<p style="-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;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New'; font-size:10pt;">Copyright (c) 2015-2021 Metaforce Contributors</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New'; font-size:10pt;">Original Authors: Jack Andersen and Phillip &quot;Antidote&quot; Stephens</span></p> -<p style="-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;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New'; font-size:10pt;">Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&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:</span></p> -<p style="-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;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New'; font-size:10pt;">The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</span></p> -<p style="-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;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New'; font-size:10pt;">THE SOFTWARE IS PROVIDED &quot;AS IS&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.</span></p></body></html> +</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">About Metaforce</span></p> +<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br />The Metaforce frontend UI is designed and built by <a href="https://axiodl.com"><span style=" text-decoration: underline; color:#007af4;">Axiomatic Data Laboratories</span></a> Copyright 2020<br /><br /><span style=" font-weight:600;">Authors:</span><br />Phillip &quot;Antidote&quot; Stephens<br />Jack &quot;jackoalan&quot; Andersen<br />Luke &quot;encounter&quot; Street</p> +<p style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">The MIT License</span></p> +<p style="-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';"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">Copyright (c) 2015-2021 Metaforce Contributors</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">Original Authors: Jack Andersen and Phillip &quot;Antidote&quot; Stephens</span></p> +<p style="-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';"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&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:</span></p> +<p style="-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';"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</span></p> +<p style="-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';"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">THE SOFTWARE IS PROVIDED &quot;AS IS&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.</span></p></body></html> true @@ -1228,62 +1306,7 @@ p, li { white-space: pre-wrap; } - - - - - - - 0 - 0 - - - - Extract Directory: - - - pathEdit - - - - - - - - 0 - 0 - - - - - 1 - 0 - - - - - - - - - 0 - 0 - - - - - 32 - 16777215 - - - - ... - - - - - - + diff --git a/metaforce-gui/SysReqTableView.cpp b/metaforce-gui/SysReqTableView.cpp index 11f43d85a..68433342f 100644 --- a/metaforce-gui/SysReqTableView.cpp +++ b/metaforce-gui/SysReqTableView.cpp @@ -82,6 +82,15 @@ void SysReqTableModel::updateFreeDiskSpace(const QString& path) { } 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; } @@ -128,9 +137,10 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const { return {}; #endif case 3: + auto [major, minor] = hecl::blender::GetRecommendedVersion(); return QStringLiteral("Blender %1.%2+") - .arg(hecl::blender::MinBlenderMajorSearch) - .arg(hecl::blender::MinBlenderMinorSearch); + .arg(major) + .arg(minor); } } else if (index.column() == 1) { /* Your System */ @@ -178,9 +188,7 @@ QVariant SysReqTableModel::headerData(int section, Qt::Orientation orientation, } bool SysReqTableModel::isBlenderVersionOk() const { - return (m_blendMajor >= hecl::blender::MinBlenderMajorSearch && - m_blendMajor <= hecl::blender::MaxBlenderMajorSearch) && - (m_blendMinor >= hecl::blender::MinBlenderMinorSearch && m_blendMinor <= hecl::blender::MaxBlenderMinorSearch); + return hecl::blender::IsVersionSupported(m_blendMajor, m_blendMinor); } void SysReqTableView::paintEvent(QPaintEvent* e) { diff --git a/metaforce-gui/SysReqTableView.hpp b/metaforce-gui/SysReqTableView.hpp index c9c4aface..7cc5dbf5c 100644 --- a/metaforce-gui/SysReqTableView.hpp +++ b/metaforce-gui/SysReqTableView.hpp @@ -30,6 +30,7 @@ public: QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; bool isBlenderVersionOk() const; void updateFreeDiskSpace(const QString& path); + void updateBlender(); }; class SysReqTableView : public QTableView { @@ -43,4 +44,5 @@ public: const SysReqTableModel& getModel() const { return m_model; } bool isBlenderVersionOk() const { return m_model.isBlenderVersionOk(); } void updateFreeDiskSpace(const QString& path) { m_model.updateFreeDiskSpace(path); } + void updateBlender() { m_model.updateBlender(); } }; diff --git a/metaforce-gui/platforms/mac/Info.plist b/metaforce-gui/platforms/mac/Info.plist.in similarity index 100% rename from metaforce-gui/platforms/mac/Info.plist rename to metaforce-gui/platforms/mac/Info.plist.in diff --git a/metaforce-gui/platforms/win/metaforce-gui.rc b/metaforce-gui/platforms/win/metaforce-gui.rc.in similarity index 100% rename from metaforce-gui/platforms/win/metaforce-gui.rc rename to metaforce-gui/platforms/win/metaforce-gui.rc.in diff --git a/version.h.in b/version.h.in index 0570f8a08..b4b9c9d57 100644 --- a/version.h.in +++ b/version.h.in @@ -2,7 +2,7 @@ #define VERSION_H #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_REVISION "@METAFORCE_WC_REVISION@"