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 = 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

View File

@ -215,6 +215,7 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& 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);
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);
@ -228,6 +229,7 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssoci
cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_iceskin"), id, ci.name);
}
}
}
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>> animInfo;
ancs.getAnimationResInfo(&pakRouter, animInfo);
for (auto& [animIdx, animResInfo] : animInfo) {

View File

@ -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"),

View File

@ -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;
}
}
}
// 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
}
}

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; });
if (iter != SCRIPT_OBJECT_DB.end()) {
std::unique_ptr<IScriptObject> obj((*iter)->a());
std::unique_ptr<IScriptObject> obj((*iter)->loader());
obj->type = type;
obj->read(rs);
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; });
if (iter != SCRIPT_OBJECT_DB.end()) {
std::unique_ptr<IScriptObject> obj((*iter)->a());
std::unique_ptr<IScriptObject> obj((*iter)->loader());
obj->read(rs);
obj->type = type;
objects.push_back(std::move(obj));

View File

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

View File

@ -9,7 +9,7 @@ struct IScriptObject;
struct ScriptObjectSpec {
atUint8 type;
IScriptObject* (*a)();
IScriptObject* (*loader)();
};
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 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; }

View File

@ -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);

View File

@ -1330,9 +1330,15 @@ void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMes
}
if (m_logScripting) {
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,9 +1355,15 @@ void CStateManager::SendScriptMsgAlways(TUniqueId dest, TUniqueId src, EScriptOb
}
if (m_logScripting) {
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);
}

View File

@ -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<CScriptWaypoint> 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;
}
}

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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;

View File

@ -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 <zeus/Math.hpp>

View File

@ -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
}

View File

@ -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 {

View File

@ -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) {

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_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)

View File

@ -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')

View File

@ -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<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

View File

@ -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")

View File

@ -2,9 +2,24 @@
#include "hecl/SteamFinder.hpp"
#include <array>
#include <sstream>
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<std::string> FindBlender(int& major, int& minor) {
major = 0;
minor = 0;
std::optional<std::string> blenderBin;
if (!OverridePath.empty()) {
blenderBin = {OverridePath};
} else {
/* User-specified blender path */
auto blenderBin = GetEnv("BLENDER_BIN");
blenderBin = GetEnv("BLENDER_BIN");
}
if (blenderBin && !RegFileExists(blenderBin->c_str())) {
blenderBin.reset();
}
@ -63,19 +84,12 @@ std::optional<std::string> 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);
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);
found = true;
break;
}
}
if (found) {
break;
}
}
@ -133,7 +147,7 @@ std::optional<std::string> 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<std::string> 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<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

View File

@ -79,6 +79,12 @@ SDNARead::SDNARead(std::string_view path) {
r.readUBytesToBuf(magicBuf, 7);
r.seek(0, athena::SeekOrigin::Begin);
if (strncmp(magicBuf, "BLENDER", 7)) {
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<uint8_t[]> compBuf(new uint8_t[4096]);
m_data.resize((length * 2 + 4095) & ~4095);
@ -118,6 +124,7 @@ SDNARead::SDNARead(std::string_view path) {
m_data = std::vector<uint8_t>();
return;
}
}
} else {
m_data.resize(length);
r.readUBytesToBuf(m_data.data(), length);

View File

@ -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) {

View File

@ -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"
)

View File

@ -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);
}
};

View File

@ -14,6 +14,8 @@
#include "FileDirDialog.hpp"
#include "ExtractZip.hpp"
#include "hecl/Blender/FindBlender.hpp"
#if _WIN32
#include <Windows.h>
#include <shellapi.h>
@ -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<int, QProcess::ExitStatus>(&QProcess::finished), nullptr, nullptr);
connect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&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<int, QProcess::ExitStatus>(&QProcess::finished), nullptr, nullptr);
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);
}
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;

View File

@ -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);
};

View File

@ -21,7 +21,85 @@
</property>
<widget class="QWidget" name="centralwidget">
<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">
<property name="currentIndex">
<number>2</number>
@ -251,8 +329,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>428</width>
<height>592</height>
<width>464</width>
<height>656</height>
</rect>
</property>
<attribute name="label">
@ -402,8 +480,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>161</width>
<height>89</height>
<width>155</width>
<height>80</height>
</rect>
</property>
<attribute name="label">
@ -451,8 +529,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>212</width>
<height>47</height>
<width>209</width>
<height>32</height>
</rect>
</property>
<attribute name="label">
@ -486,8 +564,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>210</width>
<height>366</height>
<width>189</width>
<height>358</height>
</rect>
</property>
<attribute name="label">
@ -629,6 +707,232 @@
<string>&amp;System Check</string>
</attribute>
<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">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
@ -711,220 +1015,7 @@
</item>
</layout>
</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">
<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">
<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>
@ -934,19 +1025,6 @@
</property>
</widget>
</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>
</widget>
<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;
&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; }
&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;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-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 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;-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; 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'; 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;-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; 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;-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; 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;-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; 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;/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-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;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';&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';&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';&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;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';&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';&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';&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';&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';&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';&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 name="openExternalLinks">
<bool>true</bool>
@ -1228,62 +1306,7 @@ p, li { white-space: pre-wrap; }
</widget>
</widget>
</item>
<item row="1" column="0">
<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">
<item row="5" column="0" rowspan="3">
<layout class="QHBoxLayout" name="bottomButtonBox">
<item>
<spacer name="horizontalSpacer_2">

View File

@ -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) {

View File

@ -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(); }
};

View File

@ -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@"