AGSC/ATBL/CSNG extracting and cooking

This commit is contained in:
Jack Andersen 2016-09-18 13:47:48 -10:00
parent d2e4049c3a
commit b9baa84b1d
65 changed files with 1004 additions and 338 deletions

View File

@ -64,7 +64,8 @@ set(DATA_SPEC_LIBS
DNAMP2
DNAMP1
ScriptObjectsMP1
DNACommon)
DNACommon
amuse)
set(HECL_DATASPEC_DECLS
"/* RetroCommon specs */
namespace DataSpec

View File

@ -1,5 +1,5 @@
#include <stdint.h>
#include <BlenderConnection.hpp>
#include "hecl/Blender/BlenderConnection.hpp"
#include "BlenderSupport.hpp"
extern "C" uint8_t RETRO_MASTER_SHADER[];

View File

@ -3,7 +3,7 @@
#include <unordered_set>
#include "DNACommon.hpp"
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "CMDL.hpp"
#include "RigInverter.hpp"
@ -53,7 +53,7 @@ bool ReadANCSToBlender(hecl::BlenderConnection& conn,
if (cmdlE)
{
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
if (force || cmdlPath.getPathType() == hecl::ProjectPath::Type::None)
if (force || cmdlPath.isNone())
{
if (!conn.createBlend(cmdlPath, hecl::BlenderConnection::BlendType::Mesh))
return false;

View File

@ -0,0 +1,64 @@
#include "ATBL.hpp"
#include "Athena/Athena/DNAYaml.hpp"
namespace DataSpec
{
namespace DNAAudio
{
bool ATBL::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
size_t idxCount = rs.length() / 2;
athena::io::YAMLDocWriter w("ATBL");
for (size_t i=0 ; i<idxCount ; ++i)
{
uint16_t idx = rs.readUint16Big();
if (idx == 0xffff)
continue;
char iStr[16];
snprintf(iStr, 16, "0x%04X", int(i));
w.writeUint16(iStr, idx);
}
athena::io::FileWriter fw(outPath.getAbsolutePath());
w.finish(&fw);
return true;
}
bool ATBL::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{
athena::io::FileReader r(inPath.getAbsolutePath());
if (r.hasError())
return false;
athena::io::YAMLDocReader dr;
if (!dr.parse(&r))
return false;
unsigned long maxI = 0;
for (const auto& pair : dr.getRootNode()->m_mapChildren)
{
unsigned long i = strtoul(pair.first.c_str(), nullptr, 0);
maxI = std::max(maxI, i);
}
std::vector<uint16_t> vecOut;
vecOut.resize(maxI + 1, 0xffff);
for (const auto& pair : dr.getRootNode()->m_mapChildren)
{
unsigned long i = strtoul(pair.first.c_str(), nullptr, 0);
vecOut[i] = hecl::SBig(uint16_t(strtoul(pair.second->m_scalarString.c_str(), nullptr, 0)));
}
athena::io::FileWriter w(outPath.getAbsolutePath());
if (w.hasError())
return false;
w.writeBytes(vecOut.data(), vecOut.size() * 2);
return true;
}
}
}

View File

@ -0,0 +1,22 @@
#ifndef _DNACOMMON_ATBL_HPP_
#define _DNACOMMON_ATBL_HPP_
#include "DNACommon.hpp"
#include "PAK.hpp"
namespace DataSpec
{
namespace DNAAudio
{
class ATBL
{
public:
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath);
};
}
}
#endif // _DNACOMMON_ATBL_HPP_

View File

@ -1,7 +1,7 @@
#ifndef _DNACOMMON_BABEDEAD_HPP_
#define _DNACOMMON_BABEDEAD_HPP_
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "zeus/Math.hpp"
#include <cfloat>

View File

@ -82,7 +82,7 @@ void ReadMaterialSetToBlender_1_2(hecl::BlenderConnection::PyOutStream& os,
const nod::Node* node;
const typename PAKRouter::EntryType* texEntry = pakRouter.lookupEntry(tex, &node);
hecl::ProjectPath txtrPath = pakRouter.getWorking(texEntry);
if (txtrPath.getPathType() == hecl::ProjectPath::Type::None)
if (!txtrPath.isNone())
{
PAKEntryReadStream rs = texEntry->beginReadStream(*node);
TXTR::Extract(rs, txtrPath);

View File

@ -5,7 +5,7 @@
#include <hecl/Frontend.hpp>
#include <hecl/Backend/GX.hpp>
#include "PAK.hpp"
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "GX.hpp"
#include "TXTR.hpp"
#include "zeus/CAABox.hpp"

View File

@ -27,6 +27,7 @@ add_library(DNACommon
ParticleCommon.cpp
FONT.hpp FONT.cpp
DGRP.hpp DGRP.cpp
ATBL.hpp ATBL.cpp
DeafBabe.hpp DeafBabe.cpp
BabeDead.hpp BabeDead.cpp
RigInverter.hpp RigInverter.cpp

View File

@ -2,7 +2,7 @@
#define _DNACOMMON_DEAFBABE_HPP_
#include "DNACommon.hpp"
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
namespace DataSpec
{

View File

@ -100,7 +100,7 @@ bool ReadMAPAToBlender(hecl::BlenderConnection& conn,
/* We're not in a world pak, so lets keep the original name */
mapaPath = outPath;
if (!force && mapaPath.getPathType() == hecl::ProjectPath::Type::File)
if (!force && mapaPath.isFile())
return true;
if (!conn.createBlend(mapaPath, hecl::BlenderConnection::BlendType::MapArea))
@ -296,7 +296,7 @@ bool ReadMAPAToBlender(hecl::BlenderConnection& conn,
/* World background */
hecl::ProjectPath worldBlend(outPath.getParentPath().getParentPath(), "!world.blend");
if (worldBlend.getPathType() == hecl::ProjectPath::Type::File)
if (worldBlend.isFile())
os.linkBackground("//../!world.blend", "World");
os.centerView();

View File

@ -24,7 +24,7 @@ bool ReadMLVLToBlender(hecl::BlenderConnection& conn,
else
/* We're not in a world pak, so lets keep the original name */
mlvlPath = outPath;
if (!force && mlvlPath.getPathType() == hecl::ProjectPath::Type::File)
if (!force && mlvlPath.isFile())
return true;
/* Create World Blend */

View File

@ -2,7 +2,7 @@
#define __DNACOMMON_MLVL_HPP__
#include "DNACommon.hpp"
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "zeus/CVector3f.hpp"
namespace DataSpec

View File

@ -268,6 +268,8 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
#endif
if (extractor.fileExts[0] && !extractor.fileExts[1])
entName += extractor.fileExts[0];
else if (extractor.fileExts[0])
entName += _S(".*");
return hecl::ProjectPath(pakPath, entName);
}
}
@ -285,6 +287,8 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
#endif
if (extractor.fileExts[0] && !extractor.fileExts[1])
entName += extractor.fileExts[0];
else if (extractor.fileExts[0])
entName += _S(".*");
if (bridge.getPAK().m_noShare)
{
return hecl::ProjectPath(pakPath, entName);
@ -307,6 +311,8 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
hecl::SystemString entName = entBase;
if (extractor.fileExts[0] && !extractor.fileExts[1])
entName += extractor.fileExts[0];
else if (extractor.fileExts[0])
entName += _S(".*");
hecl::ProjectPath sharedPath(m_sharedWorking, entName);
m_sharedWorking.makeDir();
return sharedPath;
@ -464,7 +470,7 @@ bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool f
/* Extract first, so they start out invalid */
hecl::ProjectPath cooked = getCooked(item);
if (force || cooked.getPathType() == hecl::ProjectPath::Type::None)
if (force || cooked.isNone())
{
PAKEntryReadStream s = item->beginReadStream(*node);
FILE* fout = hecl::Fopen(cooked.getAbsolutePath().c_str(), _S("wb"));
@ -474,7 +480,7 @@ bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool f
if (extractor.func_a) /* Doesn't need PAKRouter access */
{
if (force || working.getPathType() == hecl::ProjectPath::Type::None)
if (force || working.isNone())
{
PAKEntryReadStream s = item->beginReadStream(*node);
extractor.func_a(s, working);
@ -482,7 +488,7 @@ bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool f
}
else if (extractor.func_b) /* Needs PAKRouter access */
{
if (force || working.getPathType() == hecl::ProjectPath::Type::None)
if (force || working.isNone())
{
PAKEntryReadStream s = item->beginReadStream(*node);
extractor.func_b(m_dataSpec, s, working, *this, *item, force, btok,

View File

@ -45,7 +45,7 @@ public:
atUint64 bufEnd = m_pos + len;
if (bufEnd > m_sz)
len -= bufEnd - m_sz;
memcpy(buf, m_buf.get() + m_pos, len);
memmove(buf, m_buf.get() + m_pos, len);
m_pos += len;
return len;
}
@ -84,10 +84,26 @@ struct ResExtractor
std::function<bool(const SpecBase&, PAKEntryReadStream&, const hecl::ProjectPath&, PAKRouter<PAKBRIDGE>&,
const typename PAKBRIDGE::PAKType::Entry&, bool, hecl::BlenderToken&,
std::function<void(const hecl::SystemChar*)>)> func_b;
const hecl::SystemChar* fileExts[4];
unsigned weight;
std::array<const hecl::SystemChar*, 6> fileExts = {};
unsigned weight = 0;
std::function<void(const SpecBase&, PAKEntryReadStream&, PAKRouter<PAKBRIDGE>&,
typename PAKBRIDGE::PAKType::Entry&)> func_name;
ResExtractor() = default;
ResExtractor(std::function<bool(PAKEntryReadStream&, const hecl::ProjectPath&)>&& func,
std::array<const hecl::SystemChar*, 6>&& fileExtsIn, unsigned weightin=0,
std::function<void(const SpecBase&, PAKEntryReadStream&, PAKRouter<PAKBRIDGE>&,
typename PAKBRIDGE::PAKType::Entry&)>&& nfunc={})
: func_a(std::move(func)), fileExts(std::move(fileExtsIn)), weight(weightin), func_name(std::move(nfunc)) {}
ResExtractor(std::function<bool(const SpecBase&, PAKEntryReadStream&, const hecl::ProjectPath&, PAKRouter<PAKBRIDGE>&,
const typename PAKBRIDGE::PAKType::Entry&, bool, hecl::BlenderToken&,
std::function<void(const hecl::SystemChar*)>)>&& func,
std::array<const hecl::SystemChar*, 6>&& fileExtsIn, unsigned weightin=0,
std::function<void(const SpecBase&, PAKEntryReadStream&, PAKRouter<PAKBRIDGE>&,
typename PAKBRIDGE::PAKType::Entry&)>&& nfunc={})
: func_b(std::move(func)), fileExts(std::move(fileExtsIn)), weight(weightin), func_name(std::move(nfunc)) {}
};
/** Level hierarchy representation */

View File

@ -4,7 +4,7 @@
#include "zeus/CVector3f.hpp"
#include "zeus/CMatrix3f.hpp"
#include "zeus/CQuaternion.hpp"
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
namespace DataSpec
{

View File

@ -2,12 +2,14 @@
#define __DNACOMMON_ITWEAKGUNRES_HPP__
#include "../DNACommon.hpp"
#include "Runtime/IFactory.hpp"
namespace DataSpec
{
struct ITweakGunRes : BigYAML
{
using ResId = int64_t;
enum class EBeamId
{
Power,
@ -17,6 +19,94 @@ struct ITweakGunRes : BigYAML
Phazon
};
ResId x4_gunMotion;
ResId x8_grappleArm;
ResId xc_rightHand;
ResId x10_powerBeam;
ResId x14_iceBeam;
ResId x18_waveBeam;
ResId x1c_plasmaBeam;
ResId x20_phazonBeam;
ResId x24_holoTransition;
ResId x28_bombSet;
ResId x2c_bombExplode;
ResId x30_powerBombExplode;
/* Power, Ice, Wave, Plasma, Phazon / Beam, Ball */
ResId x34_weapons[5][2];
ResId x84_muzzle[5];
ResId x94_charge[5];
ResId xa4_auxMuzzle[5];
ResId xb4_grappleSegment;
ResId xb8_grappleClaw;
ResId xbc_grappleHit;
ResId xc0_grappleMuzzle;
ResId xc4_grappleSwoosh;
ResId GetBeamModel(EBeamId beam) const
{
int b = int(beam);
if (b < 0 || b > 4)
b = 0;
switch (EBeamId(b))
{
case EBeamId::Power:
default:
return x10_powerBeam;
case EBeamId::Ice:
return x14_iceBeam;
case EBeamId::Plasma:
return x1c_plasmaBeam;
case EBeamId::Wave:
return x18_waveBeam;
case EBeamId::Phazon:
return x20_phazonBeam;
}
}
void ResolveResources(const urde::IFactory& factory)
{
x4_gunMotion = factory.GetResourceIdByName(GetGunMotion().c_str())->id;
x8_grappleArm = factory.GetResourceIdByName(GetGrappleArm().c_str())->id;
xc_rightHand = factory.GetResourceIdByName(GetRightHand().c_str())->id;
x10_powerBeam = factory.GetResourceIdByName(GetPowerBeam().c_str())->id;
x14_iceBeam = factory.GetResourceIdByName(GetIceBeam().c_str())->id;
x18_waveBeam = factory.GetResourceIdByName(GetWaveBeam().c_str())->id;
x1c_plasmaBeam = factory.GetResourceIdByName(GetPlasmaBeam().c_str())->id;
x20_phazonBeam = factory.GetResourceIdByName(GetPhazonBeam().c_str())->id;
x24_holoTransition = factory.GetResourceIdByName(GetHoloTransition().c_str())->id;
x28_bombSet = factory.GetResourceIdByName(GetBombSet().c_str())->id;
x2c_bombExplode = factory.GetResourceIdByName(GetBombExplode().c_str())->id;
x30_powerBombExplode = factory.GetResourceIdByName(GetPowerBombExplode().c_str())->id;
for (int i=0 ; i<5 ; ++i)
for (int j=0 ; j<2 ; ++j)
x34_weapons[i][j] = factory.GetResourceIdByName(GetWeapon(i, j).c_str())->id;
for (int i=0 ; i<5 ; ++i)
x84_muzzle[i] = factory.GetResourceIdByName(GetMuzzleParticle(i).c_str())->id;
for (int i=0 ; i<5 ; ++i)
x94_charge[i] = factory.GetResourceIdByName(GetChargeParticle(i).c_str())->id;
for (int i=0 ; i<5 ; ++i)
xa4_auxMuzzle[i] = factory.GetResourceIdByName(GetAuxMuzzleParticle(i).c_str())->id;
xb4_grappleSegment = factory.GetResourceIdByName(GetGrappleSegmentParticle().c_str())->id;
xb8_grappleClaw = factory.GetResourceIdByName(GetGrappleClawParticle().c_str())->id;
xbc_grappleHit = factory.GetResourceIdByName(GetGrappleHitParticle().c_str())->id;
xc0_grappleMuzzle = factory.GetResourceIdByName(GetGrappleMuzzleParticle().c_str())->id;
xc4_grappleSwoosh = factory.GetResourceIdByName(GetGrappleSwooshParticle().c_str())->id;
}
protected:
virtual const std::string& GetGunMotion() const=0;
virtual const std::string& GetGrappleArm() const=0;
virtual const std::string& GetRightHand() const=0;
@ -33,61 +123,16 @@ struct ITweakGunRes : BigYAML
virtual const std::string& GetBombExplode() const=0;
virtual const std::string& GetPowerBombExplode() const=0;
virtual const std::string& GetPowerBeamWeapon() const=0;
virtual const std::string& GetPowerBallWeapon() const=0;
virtual const std::string& GetIceBeamWeapon() const=0;
virtual const std::string& GetIceBallWeapon() const=0;
virtual const std::string& GetWaveBeamWeapon() const=0;
virtual const std::string& GetWaveBallWeapon() const=0;
virtual const std::string& GetPlasmaBeamWeapon() const=0;
virtual const std::string& GetPlasmaBallWeapon() const=0;
virtual const std::string& GetPhazonBeamWeapon() const=0;
virtual const std::string& GetPhazonBallWeapon() const=0;
virtual const std::string& GetPowerMuzzleParticle() const=0;
virtual const std::string& GetIceMuzzleParticle() const=0;
virtual const std::string& GetWaveMuzzleParticle() const=0;
virtual const std::string& GetPlasmaMuzzleParticle() const=0;
virtual const std::string& GetPhazonMuzzleParticle() const=0;
virtual const std::string& GetPowerChargeParticle() const=0;
virtual const std::string& GetIceChargeParticle() const=0;
virtual const std::string& GetWaveChargeParticle() const=0;
virtual const std::string& GetPlasmaChargeParticle() const=0;
virtual const std::string& GetPhazonChargeParticle() const=0;
virtual const std::string& GetPowerAuxMuzzleParticle() const=0;
virtual const std::string& GetIceAuxMuzzleParticle() const=0;
virtual const std::string& GetWaveAuxMuzzleParticle() const=0;
virtual const std::string& GetPlasmaAuxMuzzleParticle() const=0;
virtual const std::string& GetPhazonAuxMuzzleParticle() const=0;
virtual const std::string& GetWeapon(size_t idx, bool ball) const=0;
virtual const std::string& GetMuzzleParticle(size_t idx) const=0;
virtual const std::string& GetChargeParticle(size_t idx) const=0;
virtual const std::string& GetAuxMuzzleParticle(size_t idx) const=0;
virtual const std::string& GetGrappleSegmentParticle() const=0;
virtual const std::string& GetGrappleClawParticle() const=0;
virtual const std::string& GetGrappleHitParticle() const=0;
virtual const std::string& GetGrappleMuzzleParticle() const=0;
virtual const std::string& GetGrappleSwooshParticle() const=0;
const std::string& GetBeamModel(EBeamId beam) const
{
int b = int(beam);
if (b < 0 || b > 4)
b = 0;
switch (EBeamId(b))
{
case EBeamId::Power:
default:
return GetPowerBeam();
case EBeamId::Ice:
return GetIceBeam();
case EBeamId::Plasma:
return GetPlasmaBeam();
case EBeamId::Wave:
return GetWaveBeam();
case EBeamId::Phazon:
return GetPhazonBeam();
}
}
};
}

View File

@ -2,12 +2,14 @@
#define __DNACOMMON_ITWEAKPLAYERRES_HPP__
#include "../DNACommon.hpp"
#include "Runtime/IFactory.hpp"
namespace DataSpec
{
struct ITweakPlayerRes : BigYAML
{
using ResId = int64_t;
enum class EBeamId
{
Power,
@ -17,6 +19,128 @@ struct ITweakPlayerRes : BigYAML
Phazon
};
ResId x4_saveStationIcon;
ResId x8_missileStationIcon;
ResId xc_elevatorIcon;
ResId x10_minesBreakFirstTopIcon;
ResId x14_minesBreakFirstBottomIcon;
ResId x18_minesBreakSecondTopIcon;
ResId x1c_minesBreakSecondBottomIcon;
/* N, U, UL, L, DL, D, DR, R, UR */
ResId x24_lStick[9];
ResId x4c_cStick[9];
/* Out, In */
ResId x74_lTrigger[2];
ResId x80_rTrigger[2];
ResId x8c_startButton[2];
ResId x98_aButton[2];
ResId xa4_bButton[2];
ResId xb0_xButton[2];
ResId xbc_yButton[2];
ResId xc4_ballTransitionsANCS;
/* Power, Ice, Wave, Plasma, Phazon */
ResId xc8_ballTransitions[5];
ResId xc8_cineGun[5];
float xf0_unkFloat;
ResId GetBeamBallTransitionModel(EBeamId beam) const
{
int b = int(beam);
if (b < 0 || b > 4)
b = 0;
switch (EBeamId(b))
{
case EBeamId::Power:
default:
return xc8_ballTransitions[0];
case EBeamId::Ice:
return xc8_ballTransitions[1];
case EBeamId::Plasma:
return xc8_ballTransitions[3];
case EBeamId::Wave:
return xc8_ballTransitions[2];
case EBeamId::Phazon:
return xc8_ballTransitions[4];
}
}
ResId GetBeamCineModel(EBeamId beam) const
{
int b = int(beam);
if (b < 0 || b > 4)
b = 0;
switch (EBeamId(b))
{
case EBeamId::Power:
default:
return xc8_cineGun[0];
case EBeamId::Ice:
return xc8_cineGun[1];
case EBeamId::Plasma:
return xc8_cineGun[3];
case EBeamId::Wave:
return xc8_cineGun[2];
case EBeamId::Phazon:
return xc8_cineGun[4];
}
}
void ResolveResources(const urde::IFactory& factory)
{
x4_saveStationIcon = factory.GetResourceIdByName(GetSaveStationIcon().c_str())->id;
x8_missileStationIcon = factory.GetResourceIdByName(GetMissileStationIcon().c_str())->id;
xc_elevatorIcon = factory.GetResourceIdByName(GetElevatorIcon().c_str())->id;
x10_minesBreakFirstTopIcon = factory.GetResourceIdByName(GetMinesBreakFirstTopIcon().c_str())->id;
x14_minesBreakFirstBottomIcon = factory.GetResourceIdByName(GetMinesBreakFirstTopIcon().c_str())->id;
x18_minesBreakSecondTopIcon = factory.GetResourceIdByName(GetMinesBreakFirstTopIcon().c_str())->id;
x1c_minesBreakSecondBottomIcon = factory.GetResourceIdByName(GetMinesBreakFirstTopIcon().c_str())->id;
for (int i=0 ; i<9 ; ++i)
x24_lStick[i] = factory.GetResourceIdByName(GetLStick(i).c_str())->id;
for (int i=0 ; i<9 ; ++i)
x4c_cStick[i] = factory.GetResourceIdByName(GetCStick(i).c_str())->id;
for (int i=0 ; i<2 ; ++i)
x74_lTrigger[i] = factory.GetResourceIdByName(GetLTrigger(i).c_str())->id;
for (int i=0 ; i<2 ; ++i)
x80_rTrigger[i] = factory.GetResourceIdByName(GetRTrigger(i).c_str())->id;
for (int i=0 ; i<2 ; ++i)
x8c_startButton[i] = factory.GetResourceIdByName(GetStartButton(i).c_str())->id;
for (int i=0 ; i<2 ; ++i)
x98_aButton[i] = factory.GetResourceIdByName(GetAButton(i).c_str())->id;
for (int i=0 ; i<2 ; ++i)
xa4_bButton[i] = factory.GetResourceIdByName(GetBButton(i).c_str())->id;
for (int i=0 ; i<2 ; ++i)
xb0_xButton[i] = factory.GetResourceIdByName(GetXButton(i).c_str())->id;
for (int i=0 ; i<2 ; ++i)
xbc_yButton[i] = factory.GetResourceIdByName(GetYButton(i).c_str())->id;
xc4_ballTransitionsANCS = factory.GetResourceIdByName(GetBallTransitionsANCS().c_str())->id;
for (int i=0 ; i<5 ; ++i)
xc8_ballTransitions[i] = factory.GetResourceIdByName(GetBallTransitionModel(i).c_str())->id;
for (int i=0 ; i<5 ; ++i)
xc8_cineGun[i] = factory.GetResourceIdByName(GetBeamCineModel(i).c_str())->id;
xf0_unkFloat = GetUnkFloat();
}
protected:
virtual const std::string& GetSaveStationIcon() const=0;
virtual const std::string& GetMissileStationIcon() const=0;
virtual const std::string& GetElevatorIcon() const=0;
@ -26,96 +150,23 @@ struct ITweakPlayerRes : BigYAML
virtual const std::string& GetMinesBreakSecondTopIcon() const=0;
virtual const std::string& GetMinesBreakSecondBottomIcon() const=0;
virtual const std::string& GetLStickN() const=0;
virtual const std::string& GetLStickU() const=0;
virtual const std::string& GetLStickUL() const=0;
virtual const std::string& GetLStickL() const=0;
virtual const std::string& GetLStickDL() const=0;
virtual const std::string& GetLStickD() const=0;
virtual const std::string& GetLStickDR() const=0;
virtual const std::string& GetLStickR() const=0;
virtual const std::string& GetLStickUR() const=0;
virtual const std::string& GetLStick(size_t idx) const=0;
virtual const std::string& GetCStick(size_t idx) const=0;
virtual const std::string& GetCStickN() const=0;
virtual const std::string& GetCStickU() const=0;
virtual const std::string& GetCStickUL() const=0;
virtual const std::string& GetCStickL() const=0;
virtual const std::string& GetCStickDL() const=0;
virtual const std::string& GetCStickD() const=0;
virtual const std::string& GetCStickDR() const=0;
virtual const std::string& GetCStickR() const=0;
virtual const std::string& GetCStickUR() const=0;
virtual const std::string& GetLTriggerOut() const=0;
virtual const std::string& GetLTriggerIn() const=0;
virtual const std::string& GetRTriggerOut() const=0;
virtual const std::string& GetRTriggerIn() const=0;
virtual const std::string& GetStartButtonOut() const=0;
virtual const std::string& GetStartButtonIn() const=0;
virtual const std::string& GetAButtonOut() const=0;
virtual const std::string& GetAButtonIn() const=0;
virtual const std::string& GetBButtonOut() const=0;
virtual const std::string& GetBButtonIn() const=0;
virtual const std::string& GetXButtonOut() const=0;
virtual const std::string& GetXButtonIn() const=0;
virtual const std::string& GetYButtonOut() const=0;
virtual const std::string& GetYButtonIn() const=0;
virtual const std::string& GetLTrigger(size_t idx) const=0;
virtual const std::string& GetRTrigger(size_t idx) const=0;
virtual const std::string& GetStartButton(size_t idx) const=0;
virtual const std::string& GetAButton(size_t idx) const=0;
virtual const std::string& GetBButton(size_t idx) const=0;
virtual const std::string& GetXButton(size_t idx) const=0;
virtual const std::string& GetYButton(size_t idx) const=0;
virtual const std::string& GetBallTransitionsANCS() const=0;
virtual const std::string& GetBallTransitionsPowerBeamModel() const=0;
virtual const std::string& GetBallTransitionsIceBeamModel() const=0;
virtual const std::string& GetBallTransitionsWaveBeamModel() const=0;
virtual const std::string& GetBallTransitionsPlasmaBeamModel() const=0;
virtual const std::string& GetBallTransitionsPhazonBeamModel() const=0;
virtual const std::string& GetPowerBeamCineModel() const=0;
virtual const std::string& GetIceBeamCineModel() const=0;
virtual const std::string& GetWaveBeamCineModel() const=0;
virtual const std::string& GetPlasmaBeamCineModel() const=0;
virtual const std::string& GetPhazonBeamCineModel() const=0;
virtual const std::string& GetBallTransitionModel(size_t idx) const=0;
virtual const std::string& GetBeamCineModel(size_t idx) const=0;
const std::string& GetBeamBallTransitionModel(EBeamId beam) const
{
int b = int(beam);
if (b < 0 || b > 4)
b = 0;
switch (EBeamId(b))
{
case EBeamId::Power:
default:
return GetBallTransitionsPowerBeamModel();
case EBeamId::Ice:
return GetBallTransitionsIceBeamModel();
case EBeamId::Plasma:
return GetBallTransitionsPlasmaBeamModel();
case EBeamId::Wave:
return GetBallTransitionsWaveBeamModel();
case EBeamId::Phazon:
return GetBallTransitionsPhazonBeamModel();
}
}
const std::string& GetBeamCineModel(EBeamId beam) const
{
int b = int(beam);
if (b < 0 || b > 4)
b = 0;
switch (EBeamId(b))
{
case EBeamId::Power:
default:
return GetPowerBeamCineModel();
case EBeamId::Ice:
return GetIceBeamCineModel();
case EBeamId::Plasma:
return GetPlasmaBeamCineModel();
case EBeamId::Wave:
return GetWaveBeamCineModel();
case EBeamId::Phazon:
return GetPhazonBeamCineModel();
}
}
virtual float GetUnkFloat() const=0;
};
}

104
DataSpec/DNAMP1/AGSC.cpp Normal file
View File

@ -0,0 +1,104 @@
#include "AGSC.hpp"
namespace DataSpec
{
namespace DNAMP1
{
bool AGSC::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
Header head;
head.read(rs);
{
hecl::ProjectPath poolPath = outPath.getWithExtension(_S(".pool"), true);
uint32_t poolLen = rs.readUint32Big();
athena::io::FileWriter w(poolPath.getAbsolutePath());
w.writeBytes(rs.readBytes(poolLen).get(), poolLen);
}
{
hecl::ProjectPath projPath = outPath.getWithExtension(_S(".proj"), true);
uint32_t projLen = rs.readUint32Big();
athena::io::FileWriter w(projPath.getAbsolutePath());
w.writeBytes(rs.readBytes(projLen).get(), projLen);
}
{
hecl::ProjectPath sampPath = outPath.getWithExtension(_S(".samp"), true);
uint32_t sampLen = rs.readUint32Big();
athena::io::FileWriter w(sampPath.getAbsolutePath());
w.writeBytes(rs.readBytes(sampLen).get(), sampLen);
}
{
hecl::ProjectPath sdirPath = outPath.getWithExtension(_S(".sdir"), true);
uint32_t sdirLen = rs.readUint32Big();
athena::io::FileWriter w(sdirPath.getAbsolutePath());
w.writeBytes(rs.readBytes(sdirLen).get(), sdirLen);
}
return true;
}
bool AGSC::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{
athena::io::FileWriter w(outPath.getAbsolutePath());
if (w.hasError())
return false;
hecl::ProjectPath woExt = inPath.getWithExtension(nullptr, true);
std::string lastComp = woExt.getLastComponentUTF8();
if (hecl::StringUtils::EndsWith(lastComp, "_AGSC"))
lastComp.assign(lastComp.cbegin(), lastComp.cend() - 5);
Header head;
head.audioDir = "Audio/";
head.groupName = lastComp;
head.write(w);
{
hecl::ProjectPath poolPath = inPath.getWithExtension(_S(".pool"), true);
athena::io::FileReader r(poolPath.getAbsolutePath());
if (r.hasError())
return false;
uint32_t poolLen = r.length();
w.writeUint32Big(poolLen);
w.writeBytes(r.readBytes(poolLen).get(), poolLen);
}
{
hecl::ProjectPath projPath = inPath.getWithExtension(_S(".proj"), true);
athena::io::FileReader r(projPath.getAbsolutePath());
if (r.hasError())
return false;
uint32_t projLen = r.length();
w.writeUint32Big(projLen);
w.writeBytes(r.readBytes(projLen).get(), projLen);
}
{
hecl::ProjectPath sampPath = inPath.getWithExtension(_S(".samp"), true);
athena::io::FileReader r(sampPath.getAbsolutePath());
if (r.hasError())
return false;
uint32_t sampLen = r.length();
w.writeUint32Big(sampLen);
w.writeBytes(r.readBytes(sampLen).get(), sampLen);
}
{
hecl::ProjectPath sdirPath = inPath.getWithExtension(_S(".sdir"), true);
athena::io::FileReader r(sdirPath.getAbsolutePath());
if (r.hasError())
return false;
uint32_t sdirLen = r.length();
w.writeUint32Big(sdirLen);
w.writeBytes(r.readBytes(sdirLen).get(), sdirLen);
}
return true;
}
}
}

28
DataSpec/DNAMP1/AGSC.hpp Normal file
View File

@ -0,0 +1,28 @@
#ifndef _DNAMP1_AGSC_HPP_
#define _DNAMP1_AGSC_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec
{
namespace DNAMP1
{
class AGSC
{
struct Header : BigDNA
{
DECL_DNA
String<-1> audioDir;
String<-1> groupName;
};
public:
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath);
};
}
}
#endif // _DNAMP1_AGSC_HPP_

View File

@ -1017,9 +1017,9 @@ bool ANCS::Extract(const SpecBase& dataSpec,
hecl::BlenderToken& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"));
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"), true);
hecl::ProjectPath::Type yamlType = yamlPath.getPathType();
hecl::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"));
hecl::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"), true);
hecl::ProjectPath::Type blendType = blendPath.getPathType();
ANCS ancs;
@ -1053,7 +1053,7 @@ bool ANCS::Extract(const SpecBase& dataSpec,
hecl::SystemStringView sysStr(res.second.name);
hecl::ProjectPath evntYamlPath = outPath.getWithExtension((hecl::SystemString(_S(".")) +
sysStr.sys_str() +
_S(".evnt.yaml")).c_str());
_S(".evnt.yaml")).c_str(), true);
hecl::ProjectPath::Type evntYamlType = evntYamlPath.getPathType();
if (force || evntYamlType == hecl::ProjectPath::Type::None)
@ -1080,7 +1080,7 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
{
/* Search for yaml */
hecl::ProjectPath yamlPath = inPath.getWithExtension(_S(".yaml"), true);
if (yamlPath.getPathType() != hecl::ProjectPath::Type::File)
if (!yamlPath.isFile())
Log.report(logvisor::Fatal, _S("'%s' not found as file"),
yamlPath.getRelativePath().c_str());
@ -1189,12 +1189,11 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& modelPath = subtype->mesh;
if (modelPath.getPathType() != hecl::ProjectPath::Type::File)
if (!modelPath.isFile())
Log.report(logvisor::Fatal, _S("unable to resolve '%s'"), modelPath.getRelativePath().c_str());
hecl::ProjectPath skinIntPath = modelPath.getCookedPath(SpecEntMP1PC).getWithExtension(_S(".skinint"));
if (skinIntPath.getPathType() != hecl::ProjectPath::Type::File ||
skinIntPath.getModtime() < modelPath.getModtime())
if (!skinIntPath.isFileOrGlob() || skinIntPath.getModtime() < modelPath.getModtime())
if (!modelCookFunc(modelPath))
Log.report(logvisor::Fatal, _S("unable to cook '%s'"), modelPath.getRelativePath().c_str());
@ -1269,7 +1268,7 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
hecl::ProjectPath evntYamlPath = inPath.getWithExtension((hecl::SystemString(_S(".")) +
sysStr.sys_str() +
_S(".evnt.yaml")).c_str(), true);
if (evntYamlPath.getPathType() == hecl::ProjectPath::Type::File)
if (evntYamlPath.isFile())
{
athena::io::FileReader reader(evntYamlPath.getAbsolutePath());
if (reader.isOpen())

View File

@ -5,7 +5,7 @@
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/ANCS.hpp"
#include "CMDLMaterials.hpp"
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "CINF.hpp"
#include "CSKR.hpp"
#include "ANIM.hpp"

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP1_ANIM_HPP_
#define _DNAMP1_ANIM_HPP_
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "DNAMP1.hpp"
#include "../DNACommon/ANIM.hpp"
#include "DataSpec/DNACommon/RigInverter.hpp"

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP1_CINF_HPP_
#define _DNAMP1_CINF_HPP_
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/RigInverter.hpp"

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP1_CMDL_MATERIALS_HPP_
#define _DNAMP1_CMDL_MATERIALS_HPP_
#include <BlenderConnection.hpp>
#include "hecl/Blender/BlenderConnection.hpp"
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/GX.hpp"
#include "../DNACommon/CMDL.hpp"

View File

@ -3,6 +3,8 @@ add_subdirectory(ScriptObjects)
make_dnalist(liblist
PAK
MLVL
AGSC
CSNG
AFSM
ANCS
ANIM
@ -33,6 +35,8 @@ add_library(DNAMP1
${liblist}
PAK.cpp
STRG.hpp STRG.cpp
AGSC.cpp
CSNG.cpp
ANCS.cpp
ANIM.cpp
CINF.cpp

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP1_CSKR_HPP_
#define _DNAMP1_CSKR_HPP_
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "../DNACommon/DNACommon.hpp"
#include "CINF.hpp"

92
DataSpec/DNAMP1/CSNG.cpp Normal file
View File

@ -0,0 +1,92 @@
#include "CSNG.hpp"
#include "amuse/SongConverter.hpp"
namespace DataSpec
{
namespace DNAMP1
{
bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
hecl::ProjectPath midPath = outPath.getWithExtension(_S(".mid"), true);
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"), true);
Header head;
head.read(rs);
{
athena::io::YAMLDocWriter dw("CSNG");
dw.writeUint32("midiSetupId", head.midiSetupId);
dw.writeUint32("songGroupId", head.songGroupId);
dw.enterSubRecord("agscId");
head.agscId.write(dw);
dw.leaveSubRecord();
athena::io::FileWriter w(yamlPath.getAbsolutePath());
if (w.hasError())
return false;
dw.finish(&w);
}
{
auto sng = rs.readUBytes(head.sngLength);
int version;
bool isBig;
auto midi = amuse::SongConverter::SongToMIDI(sng.get(), version, isBig);
athena::io::FileWriter w(midPath.getAbsolutePath());
if (w.hasError())
return false;
w.writeUBytes(midi.data(), midi.size());
}
return true;
}
bool CSNG::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{
hecl::ProjectPath midPath = inPath.getWithExtension(_S(".mid"), true);
hecl::ProjectPath yamlPath = inPath.getWithExtension(_S(".yaml"), true);
std::vector<uint8_t> sngData;
{
athena::io::FileReader midR(midPath.getAbsolutePath());
if (midR.hasError())
return false;
uint32_t midLen = midR.length();
std::vector<uint8_t> midData;
midData.resize(midLen);
midR.readUBytesToBuf(midData.data(), midLen);
sngData = amuse::SongConverter::MIDIToSong(midData, 1, true);
}
athena::io::FileWriter w(outPath.getAbsolutePath());
if (w.hasError())
return false;
{
athena::io::FileReader yamlR(yamlPath.getAbsolutePath());
if (yamlR.hasError())
return false;
athena::io::YAMLDocReader dr;
if (!dr.parse(&yamlR))
return false;
Header head;
head.midiSetupId = dr.readUint32("midiSetupId");
head.songGroupId = dr.readUint32("songGroupId");
dr.enterSubRecord("agscId");
head.agscId.read(dr);
dr.leaveSubRecord();
head.sngLength = sngData.size();
head.write(w);
}
w.writeUBytes(sngData.data(), sngData.size());
return true;
}
}
}

31
DataSpec/DNAMP1/CSNG.hpp Normal file
View File

@ -0,0 +1,31 @@
#ifndef _DNAMP1_CSNG_HPP_
#define _DNAMP1_CSNG_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec
{
namespace DNAMP1
{
class CSNG
{
struct Header : BigDNA
{
DECL_DNA
Value<atUint32> magic = 0x2;
Value<atUint32> midiSetupId;
Value<atUint32> songGroupId;
UniqueID32 agscId;
Value<atUint32> sngLength;
};
public:
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath);
};
}
}
#endif // _DNAMP1_CSNG_HPP_

View File

@ -14,6 +14,7 @@
#include "../DNACommon/DPSC.hpp"
#include "../DNACommon/FONT.hpp"
#include "../DNACommon/DGRP.hpp"
#include "../DNACommon/ATBL.hpp"
#include "HINT.hpp"
#include "CMDL.hpp"
#include "AFSM.hpp"
@ -22,6 +23,8 @@
#include "MREA.hpp"
#include "MAPA.hpp"
#include "FRME.hpp"
#include "AGSC.hpp"
#include "CSNG.hpp"
#include "../DNACommon/Tweaks/TweakWriter.hpp"
#include "Tweaks/CTweakPlayerRes.hpp"
@ -269,45 +272,51 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
switch (entry.type)
{
case SBIG('STRG'):
return {STRG::Extract, nullptr, {_S(".yaml")}};
return {STRG::Extract, {_S(".yaml")}};
case SBIG('SCAN'):
return {SCAN::Extract, nullptr, {_S(".yaml")}, 0, SCAN::Name};
return {SCAN::Extract, {_S(".yaml")}, 0, SCAN::Name};
case SBIG('HINT'):
return {HINT::Extract, nullptr, {_S(".yaml")}};
return {HINT::Extract, {_S(".yaml")}};
case SBIG('SAVW'):
return {SAVWCommon::ExtractSAVW<SAVW>, nullptr, {_S(".yaml")}};
return {SAVWCommon::ExtractSAVW<SAVW>, {_S(".yaml")}};
case SBIG('TXTR'):
return {TXTR::Extract, nullptr, {_S(".png")}};
return {TXTR::Extract, {_S(".png")}};
case SBIG('AFSM'):
return {AFSM::Extract, nullptr, {_S(".yaml")}};
return {AFSM::Extract, {_S(".yaml")}};
case SBIG('FRME'):
return {nullptr, FRME::Extract, {_S(".blend")}, 2};
return {FRME::Extract, {_S(".blend")}, 2};
case SBIG('CMDL'):
return {nullptr, CMDL::Extract, {_S(".blend")}, 1, CMDL::Name};
return {CMDL::Extract, {_S(".blend")}, 1, CMDL::Name};
case SBIG('ANCS'):
return {nullptr, ANCS::Extract, {_S(".yaml"), _S(".blend")}, 2};
return {ANCS::Extract, {_S(".yaml"), _S(".blend")}, 2};
case SBIG('MLVL'):
return {nullptr, MLVL::Extract, {_S(".blend")}, 3};
return {MLVL::Extract, {_S(".blend")}, 3};
case SBIG('MREA'):
return {nullptr, MREA::Extract, {_S(".blend")}, 4, MREA::Name};
return {MREA::Extract, {_S(".blend")}, 4, MREA::Name};
case SBIG('MAPA'):
return {nullptr, MAPA::Extract, {_S(".blend")}, 4};
return {MAPA::Extract, {_S(".blend")}, 4};
case SBIG('PART'):
return {DNAParticle::ExtractGPSM<UniqueID32>, nullptr, {_S(".gpsm.yaml")}};
return {DNAParticle::ExtractGPSM<UniqueID32>, {_S(".gpsm.yaml")}};
case SBIG('ELSC'):
return {DNAParticle::ExtractELSM<UniqueID32>, nullptr, {_S(".elsm.yaml")}};
return {DNAParticle::ExtractELSM<UniqueID32>, {_S(".elsm.yaml")}};
case SBIG('SWHC'):
return {DNAParticle::ExtractSWSH<UniqueID32>, nullptr, {_S(".swsh.yaml")}};
return {DNAParticle::ExtractSWSH<UniqueID32>, {_S(".swsh.yaml")}};
case SBIG('CRSC'):
return {DNAParticle::ExtractCRSM<UniqueID32>, nullptr, {_S(".crsm.yaml")}};
return {DNAParticle::ExtractCRSM<UniqueID32>, {_S(".crsm.yaml")}};
case SBIG('WPSC'):
return {DNAParticle::ExtractWPSM<UniqueID32>, nullptr, {_S(".wpsm.yaml")}};
return {DNAParticle::ExtractWPSM<UniqueID32>, {_S(".wpsm.yaml")}};
case SBIG('DPSC'):
return {DNAParticle::ExtractDPSM<UniqueID32>, nullptr, {_S(".dpsm.yaml")}};
return {DNAParticle::ExtractDPSM<UniqueID32>, {_S(".dpsm.yaml")}};
case SBIG('FONT'):
return {DNAFont::ExtractFONT<UniqueID32>, nullptr, {_S(".yaml")}};
return {DNAFont::ExtractFONT<UniqueID32>, {_S(".yaml")}};
case SBIG('DGRP'):
return {DNADGRP::ExtractDGRP<UniqueID32>, nullptr, {_S(".yaml")}};
return {DNADGRP::ExtractDGRP<UniqueID32>, {_S(".yaml")}};
case SBIG('AGSC'):
return {AGSC::Extract, {_S(".pool"), _S(".proj"), _S(".samp"), _S(".sdir")}};
case SBIG('CSNG'):
return {CSNG::Extract, {_S(".mid"), _S(".yaml")}};
case SBIG('ATBL'):
return {DNAAudio::ATBL::Extract, {_S(".yaml")}};
case SBIG('CTWK'):
{
bool named;
@ -315,15 +324,15 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
if (named)
{
if (!name.compare("PlayerRes"))
return {ExtractTweak<CTweakPlayerRes>, nullptr, {_S(".yaml")}};
return {ExtractTweak<CTweakPlayerRes>, {_S(".yaml")}};
if (!name.compare("GunRes"))
return {ExtractTweak<CTweakGunRes>, nullptr, {_S(".yaml")}};
return {ExtractTweak<CTweakGunRes>, {_S(".yaml")}};
if (!name.compare("Player"))
return {ExtractTweak<CTweakPlayer>, nullptr, {_S(".yaml")}};
return {ExtractTweak<CTweakPlayer>, {_S(".yaml")}};
if (!name.compare("CameraBob"))
return {ExtractTweak<CTweakCameraBob>, nullptr, {_S(".yaml")}};
return {ExtractTweak<CTweakCameraBob>, {_S(".yaml")}};
if (!name.compare("SlideShow"))
return {ExtractTweak<CTweakSlideShow>, nullptr, {_S(".yaml")}};
return {ExtractTweak<CTweakSlideShow>, {_S(".yaml")}};
}
break;
}

View File

@ -326,7 +326,7 @@ bool FRME::Extract(const SpecBase &dataSpec,
hecl::BlenderConnection& conn = btok.getBlenderConnection();
#if 0
if (!force && outPath.getPathType() == hecl::ProjectPath::Type::File)
if (!force && outPath.isFile())
return true;
#endif
@ -481,7 +481,7 @@ bool FRME::Extract(const SpecBase &dataSpec,
const nod::Node* node;
const PAKRouter<PAKBridge>::EntryType* texEntry = pakRouter.lookupEntry(info->texture, &node);
hecl::ProjectPath txtrPath = pakRouter.getWorking(texEntry);
if (txtrPath.getPathType() == hecl::ProjectPath::Type::None)
if (txtrPath.isNone())
{
PAKEntryReadStream rs = texEntry->beginReadStream(*node);
TXTR::Extract(rs, txtrPath);

View File

@ -73,7 +73,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
/* We're not in a world pak, so lets keep the original name */
mreaPath = outPath;
if (!force && mreaPath.getPathType() == hecl::ProjectPath::Type::File)
if (!force && mreaPath.isFile())
return true;
/* Do extract */
@ -271,7 +271,7 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
for (const hecl::DirectoryEnumerator::Entry& ent : dEnum)
{
hecl::ProjectPath layerScriptPath(areaDirPath, ent.m_name + _S("/objects.yaml"));
if (layerScriptPath.getPathType() == hecl::ProjectPath::Type::File)
if (layerScriptPath.isFile())
layerScriptPaths.push_back(std::move(layerScriptPath));
}
}

View File

@ -42,7 +42,7 @@ void SCLY::exportToLayerDirectories(const PAK::Entry& entry, PAKRouter<PAKBridge
{
bool active;
hecl::ProjectPath layerPath = pakRouter.getAreaLayerWorking(entry.id, i, active);
if (layerPath.getPathType() == hecl::ProjectPath::Type::None)
if (layerPath.isNone())
layerPath.makeDir();
if (active)
@ -52,7 +52,7 @@ void SCLY::exportToLayerDirectories(const PAK::Entry& entry, PAKRouter<PAKBridge
}
hecl::ProjectPath yamlFile(layerPath, _S("objects.yaml"));
if (force || yamlFile.getPathType() == hecl::ProjectPath::Type::None)
if (force || yamlFile.isNone())
{
athena::io::FileWriter writer(yamlFile.getAbsolutePath());
layers[i].toYAMLStream(writer);

View File

@ -79,34 +79,10 @@ struct CTweakGunRes : ITweakGunRes
const std::string& GetBombExplode() const { return m_bombExplode; }
const std::string& GetPowerBombExplode() const { return m_powerBombExplode; }
const std::string& GetPowerBeamWeapon() const { return m_powerBeamWp; }
const std::string& GetPowerBallWeapon() const { return m_powerBallWp; }
const std::string& GetIceBeamWeapon() const { return m_iceBeamWp; }
const std::string& GetIceBallWeapon() const { return m_iceBallWp; }
const std::string& GetWaveBeamWeapon() const { return m_waveBeamWp; }
const std::string& GetWaveBallWeapon() const { return m_waveBallWp; }
const std::string& GetPlasmaBeamWeapon() const { return m_plasmaBeamWp; }
const std::string& GetPlasmaBallWeapon() const { return m_plasmaBallWp; }
const std::string& GetPhazonBeamWeapon() const { return m_phazonBeamWp; }
const std::string& GetPhazonBallWeapon() const { return m_phazonBallWp; }
const std::string& GetPowerMuzzleParticle() const { return m_powerMuzzle; }
const std::string& GetIceMuzzleParticle() const { return m_iceMuzzle; }
const std::string& GetWaveMuzzleParticle() const { return m_waveMuzzle; }
const std::string& GetPlasmaMuzzleParticle() const { return m_plasmaMuzzle; }
const std::string& GetPhazonMuzzleParticle() const { return m_phazonMuzzle; }
const std::string& GetPowerChargeParticle() const { return m_powerCharge; }
const std::string& GetIceChargeParticle() const { return m_iceCharge; }
const std::string& GetWaveChargeParticle() const { return m_waveCharge; }
const std::string& GetPlasmaChargeParticle() const { return m_plasmaCharge; }
const std::string& GetPhazonChargeParticle() const { return m_phazonCharge; }
const std::string& GetPowerAuxMuzzleParticle() const { return m_powerAuxMuzzle; }
const std::string& GetIceAuxMuzzleParticle() const { return m_iceAuxMuzzle; }
const std::string& GetWaveAuxMuzzleParticle() const { return m_waveAuxMuzzle; }
const std::string& GetPlasmaAuxMuzzleParticle() const { return m_plasmaAuxMuzzle; }
const std::string& GetPhazonAuxMuzzleParticle() const { return m_phazonAuxMuzzle; }
const std::string& GetWeapon(size_t idx, bool ball) const { return (&m_powerBeamWp)[idx * 2 + ball]; }
const std::string& GetMuzzleParticle(size_t idx) const { return (&m_powerMuzzle)[idx]; }
const std::string& GetChargeParticle(size_t idx) const { return (&m_powerCharge)[idx]; }
const std::string& GetAuxMuzzleParticle(size_t idx) const { return (&m_powerAuxMuzzle)[idx]; }
const std::string& GetGrappleSegmentParticle() const { return m_grappleSegment; }
const std::string& GetGrappleClawParticle() const { return m_grappleClaw; }

View File

@ -70,6 +70,8 @@ struct CTweakPlayerRes : ITweakPlayerRes
String<-1> m_cinePlasma;
String<-1> m_cinePhazon;
Value<float> m_unkFloat;
const std::string& GetSaveStationIcon() const { return m_saveStationIcon; }
const std::string& GetMissileStationIcon() const { return m_missileStationIcon; }
const std::string& GetElevatorIcon() const { return m_elevatorIcon; }
@ -79,54 +81,23 @@ struct CTweakPlayerRes : ITweakPlayerRes
const std::string& GetMinesBreakSecondTopIcon() const { return m_minesBreakSecondTopIcon; }
const std::string& GetMinesBreakSecondBottomIcon() const { return m_minesBreakSecondBottomIcon; }
const std::string& GetLStickN() const { return m_lStickN; }
const std::string& GetLStickU() const { return m_lStickU; }
const std::string& GetLStickUL() const { return m_lStickUL; }
const std::string& GetLStickL() const { return m_lStickL; }
const std::string& GetLStickDL() const { return m_lStickDL; }
const std::string& GetLStickD() const { return m_lStickD; }
const std::string& GetLStickDR() const { return m_lStickDR; }
const std::string& GetLStickR() const { return m_lStickR; }
const std::string& GetLStickUR() const { return m_lStickUR; }
const std::string& GetLStick(size_t idx) const { return (&m_lStickN)[idx]; }
const std::string& GetCStick(size_t idx) const { return (&m_cStickN)[idx]; }
const std::string& GetCStickN() const { return m_cStickN; }
const std::string& GetCStickU() const { return m_cStickU; }
const std::string& GetCStickUL() const { return m_cStickUL; }
const std::string& GetCStickL() const { return m_cStickL; }
const std::string& GetCStickDL() const { return m_cStickDL; }
const std::string& GetCStickD() const { return m_cStickD; }
const std::string& GetCStickDR() const { return m_cStickDR; }
const std::string& GetCStickR() const { return m_cStickR; }
const std::string& GetCStickUR() const { return m_cStickUR; }
const std::string& GetLTriggerOut() const { return m_lTriggerOut; }
const std::string& GetLTriggerIn() const { return m_lTriggerIn; }
const std::string& GetRTriggerOut() const { return m_rTriggerOut; }
const std::string& GetRTriggerIn() const { return m_rTriggerIn; }
const std::string& GetStartButtonOut() const { return m_startButtonOut; }
const std::string& GetStartButtonIn() const { return m_startButtonIn; }
const std::string& GetAButtonOut() const { return m_aButtonOut; }
const std::string& GetAButtonIn() const { return m_aButtonIn; }
const std::string& GetBButtonOut() const { return m_bButtonOut; }
const std::string& GetBButtonIn() const { return m_bButtonIn; }
const std::string& GetXButtonOut() const { return m_xButtonOut; }
const std::string& GetXButtonIn() const { return m_xButtonIn; }
const std::string& GetYButtonOut() const { return m_yButtonOut; }
const std::string& GetYButtonIn() const { return m_yButtonIn; }
const std::string& GetLTrigger(size_t idx) const { return (&m_lTriggerOut)[idx]; }
const std::string& GetRTrigger(size_t idx) const { return (&m_rTriggerOut)[idx]; }
const std::string& GetStartButton(size_t idx) const { return (&m_startButtonOut)[idx]; }
const std::string& GetAButton(size_t idx) const { return (&m_aButtonOut)[idx]; }
const std::string& GetBButton(size_t idx) const { return (&m_bButtonOut)[idx]; }
const std::string& GetXButton(size_t idx) const { return (&m_xButtonOut)[idx]; }
const std::string& GetYButton(size_t idx) const { return (&m_yButtonOut)[idx]; }
const std::string& GetBallTransitionsANCS() const { return m_ballTransitionsANCS; }
const std::string& GetBallTransitionsPowerBeamModel() const { return m_ballTransitionsPower; }
const std::string& GetBallTransitionsIceBeamModel() const { return m_ballTransitionsIce; }
const std::string& GetBallTransitionsWaveBeamModel() const { return m_ballTransitionsWave; }
const std::string& GetBallTransitionsPlasmaBeamModel() const { return m_ballTransitionsPlasma; }
const std::string& GetBallTransitionsPhazonBeamModel() const { return m_ballTransitionsPhazon; }
const std::string& GetPowerBeamCineModel() const { return m_cinePower; }
const std::string& GetIceBeamCineModel() const { return m_cineIce; }
const std::string& GetWaveBeamCineModel() const { return m_cineWave; }
const std::string& GetPlasmaBeamCineModel() const { return m_cinePlasma; }
const std::string& GetPhazonBeamCineModel() const { return m_cinePhazon; }
const std::string& GetBallTransitionModel(size_t idx) const { return (&m_ballTransitionsPower)[idx]; }
const std::string& GetBeamCineModel(size_t idx) const { return (&m_cinePower)[idx]; }
float GetUnkFloat() const { return m_unkFloat; }
CTweakPlayerRes() = default;
CTweakPlayerRes(athena::io::IStreamReader& in) { read(in); }

97
DataSpec/DNAMP2/AGSC.cpp Normal file
View File

@ -0,0 +1,97 @@
#include "AGSC.hpp"
namespace DataSpec
{
namespace DNAMP2
{
bool AGSC::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
Header head;
head.read(rs);
{
hecl::ProjectPath poolPath = outPath.getWithExtension(_S(".pool"), true);
athena::io::FileWriter w(poolPath.getAbsolutePath());
w.writeBytes(rs.readBytes(head.poolSz).get(), head.poolSz);
}
{
hecl::ProjectPath projPath = outPath.getWithExtension(_S(".proj"), true);
athena::io::FileWriter w(projPath.getAbsolutePath());
w.writeBytes(rs.readBytes(head.projSz).get(), head.projSz);
}
{
hecl::ProjectPath sdirPath = outPath.getWithExtension(_S(".sdir"), true);
athena::io::FileWriter w(sdirPath.getAbsolutePath());
w.writeBytes(rs.readBytes(head.sdirSz).get(), head.sdirSz);
}
{
hecl::ProjectPath sampPath = outPath.getWithExtension(_S(".samp"), true);
athena::io::FileWriter w(sampPath.getAbsolutePath());
w.writeBytes(rs.readBytes(head.sampSz).get(), head.sampSz);
}
return true;
}
bool AGSC::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{
athena::io::FileWriter w(outPath.getAbsolutePath());
if (w.hasError())
return false;
hecl::ProjectPath woExt = inPath.getWithExtension(nullptr, true);
std::string lastComp = woExt.getLastComponentUTF8();
if (hecl::StringUtils::EndsWith(lastComp, "_AGSC"))
lastComp.assign(lastComp.cbegin(), lastComp.cend() - 5);
hecl::ProjectPath poolPath = inPath.getWithExtension(_S(".pool"), true);
athena::io::FileReader poolR(poolPath.getAbsolutePath());
if (poolR.hasError())
return false;
uint32_t poolLen = poolR.length();
hecl::ProjectPath projPath = inPath.getWithExtension(_S(".proj"), true);
athena::io::FileReader projR(projPath.getAbsolutePath());
if (projR.hasError())
return false;
uint32_t projLen = projR.length();
hecl::ProjectPath sdirPath = inPath.getWithExtension(_S(".sdir"), true);
athena::io::FileReader sdirR(sdirPath.getAbsolutePath());
if (sdirR.hasError())
return false;
uint32_t sdirLen = sdirR.length();
hecl::ProjectPath sampPath = inPath.getWithExtension(_S(".samp"), true);
athena::io::FileReader sampR(sampPath.getAbsolutePath());
if (sampR.hasError())
return false;
uint32_t sampLen = sampR.length();
projR.seek(4, athena::SeekOrigin::Begin);
uint16_t groupId = projR.readUint16Big();
projR.seek(0, athena::SeekOrigin::Begin);
Header head;
head.groupName = lastComp;
head.groupId = groupId;
head.poolSz = poolLen;
head.projSz = projLen;
head.sdirSz = sdirLen;
head.sampSz = sampLen;
head.write(w);
w.writeBytes(poolR.readBytes(poolLen).get(), poolLen);
w.writeBytes(projR.readBytes(projLen).get(), projLen);
w.writeBytes(sdirR.readBytes(sdirLen).get(), sdirLen);
w.writeBytes(sampR.readBytes(sampLen).get(), sampLen);
return true;
}
}
}

32
DataSpec/DNAMP2/AGSC.hpp Normal file
View File

@ -0,0 +1,32 @@
#ifndef _DNAMP2_AGSC_HPP_
#define _DNAMP2_AGSC_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "DNAMP2.hpp"
namespace DataSpec
{
namespace DNAMP2
{
class AGSC
{
struct Header : BigDNA
{
DECL_DNA
String<-1> groupName;
Value<atUint16> groupId = -1;
Value<atUint32> poolSz = 0;
Value<atUint32> projSz = 0;
Value<atUint32> sdirSz = 0;
Value<atUint32> sampSz = 0;
};
public:
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath);
};
}
}
#endif // _DNAMP2_AGSC_HPP_

View File

@ -5,7 +5,7 @@
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/ANCS.hpp"
#include "CMDLMaterials.hpp"
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "CINF.hpp"
#include "CSKR.hpp"
#include "ANIM.hpp"
@ -226,9 +226,9 @@ struct ANCS : BigYAML
hecl::BlenderToken& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"));
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"), true);
hecl::ProjectPath::Type yamlType = yamlPath.getPathType();
hecl::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"));
hecl::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"), true);
hecl::ProjectPath::Type blendType = blendPath.getPathType();
if (force ||

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP2_ANIM_HPP_
#define _DNAMP2_ANIM_HPP_
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "DNAMP2.hpp"
#include "../DNACommon/ANIM.hpp"
#include "../DNACommon/RigInverter.hpp"

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP2_CINF_HPP_
#define _DNAMP2_CINF_HPP_
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/RigInverter.hpp"

View File

@ -1,6 +1,7 @@
make_dnalist(liblist
MLVL
ANIM
AGSC
ANCS
CMDLMaterials
CINF
@ -13,6 +14,7 @@ add_library(DNAMP2
DNAMP2.hpp DNAMP2.cpp
${liblist}
ANIM.cpp
AGSC.cpp
CINF.cpp
ANCS.cpp
CMDL.hpp

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP2_CSKR_HPP_
#define _DNAMP2_CSKR_HPP_
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "../DNACommon/DNACommon.hpp"
#include "CINF.hpp"
#include "../DNAMP1/CSKR.hpp"

View File

@ -8,11 +8,14 @@
#include "MAPA.hpp"
#include "AFSM.hpp"
#include "SAVW.hpp"
#include "AGSC.hpp"
#include "../DNAMP1/HINT.hpp"
#include "../DNAMP1/CSNG.hpp"
#include "../DNACommon/FSM2.hpp"
#include "../DNACommon/TXTR.hpp"
#include "../DNACommon/FONT.hpp"
#include "../DNACommon/DGRP.hpp"
#include "../DNACommon/ATBL.hpp"
namespace DataSpec
{
@ -205,31 +208,37 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const DNAMP1::PAK& pak, const
switch (entry.type)
{
case SBIG('HINT'):
return {DNAMP1::HINT::Extract, nullptr, {_S(".yaml")}};
return {DNAMP1::HINT::Extract, {_S(".yaml")}};
case SBIG('STRG'):
return {STRG::Extract, nullptr, {_S(".yaml")}};
return {STRG::Extract, {_S(".yaml")}};
case SBIG('TXTR'):
return {TXTR::Extract, nullptr, {_S(".png")}};
return {TXTR::Extract, {_S(".png")}};
case SBIG('AFSM'):
return {AFSM::Extract, nullptr, {_S(".yaml")}};
return {AFSM::Extract, {_S(".yaml")}};
case SBIG('SAVW'):
return {SAVWCommon::ExtractSAVW<SAVW>, nullptr, {_S(".yaml")}};
return {SAVWCommon::ExtractSAVW<SAVW>, {_S(".yaml")}};
case SBIG('CMDL'):
return {nullptr, CMDL::Extract, {_S(".blend")}, 1};
return {CMDL::Extract, {_S(".blend")}, 1};
case SBIG('ANCS'):
return {nullptr, ANCS::Extract, {_S(".yaml"), _S(".blend")}, 2};
return {ANCS::Extract, {_S(".yaml"), _S(".blend")}, 2};
case SBIG('MLVL'):
return {nullptr, MLVL::Extract, {_S(".blend")}, 3};
return {MLVL::Extract, {_S(".blend")}, 3};
case SBIG('MREA'):
return {nullptr, MREA::Extract, {_S(".blend")}, 4};
return {MREA::Extract, {_S(".blend")}, 4};
case SBIG('MAPA'):
return {nullptr, MAPA::Extract, {_S(".blend")}, 4};
return {MAPA::Extract, {_S(".blend")}, 4};
case SBIG('FSM2'):
return {DNAFSM2::ExtractFSM2<UniqueID32>, nullptr, {_S(".yaml")}};
return {DNAFSM2::ExtractFSM2<UniqueID32>, {_S(".yaml")}};
case SBIG('FONT'):
return {DNAFont::ExtractFONT<UniqueID32>, nullptr, {_S(".yaml")}};
return {DNAFont::ExtractFONT<UniqueID32>, {_S(".yaml")}};
case SBIG('DGRP'):
return {DNADGRP::ExtractDGRP<UniqueID32>, nullptr, {_S(".yaml")}};
return {DNADGRP::ExtractDGRP<UniqueID32>, {_S(".yaml")}};
case SBIG('AGSC'):
return {AGSC::Extract, {_S(".pool"), _S(".proj"), _S(".samp"), _S(".sdir")}};
case SBIG('CSNG'):
return {DNAMP1::CSNG::Extract, {_S(".mid"), _S(".yaml")}};
case SBIG('ATBL'):
return {DNAAudio::ATBL::Extract, {_S(".yaml")}};
}
return {};
}

View File

@ -177,7 +177,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
/* We're not in a world pak, so lets keep the original name */
mreaPath = outPath;
if (!force && mreaPath.getPathType() == hecl::ProjectPath::Type::File)
if (!force && mreaPath.isFile())
return true;
/* Do extract */

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP3_ANIM_HPP_
#define _DNAMP3_ANIM_HPP_
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "DNAMP3.hpp"
#include "../DNACommon/ANIM.hpp"
#include "../DNACommon/RigInverter.hpp"

View File

@ -5,7 +5,7 @@
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/ANCS.hpp"
#include "CMDLMaterials.hpp"
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "CINF.hpp"
#include "CSKR.hpp"
#include "ANIM.hpp"
@ -315,9 +315,9 @@ struct CHAR : BigYAML
hecl::BlenderToken& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"));
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"), true);
hecl::ProjectPath::Type yamlType = yamlPath.getPathType();
hecl::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"));
hecl::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"), true);
hecl::ProjectPath::Type blendType = blendPath.getPathType();
if (force ||

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP3_CINF_HPP_
#define _DNAMP3_CINF_HPP_
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "../DNACommon/DNACommon.hpp"
#include "../DNAMP2/CINF.hpp"

View File

@ -124,7 +124,7 @@ void Material::SectionPASS::constructNode(hecl::BlenderConnection::PyOutStream&
const nod::Node* node;
const PAK::Entry* texEntry = pakRouter.lookupEntry(txtrId, &node);
hecl::ProjectPath txtrPath = pakRouter.getWorking(texEntry);
if (txtrPath.getPathType() == hecl::ProjectPath::Type::None)
if (txtrPath.isNone())
{
PAKEntryReadStream rs = texEntry->beginReadStream(*node);
TXTR::Extract(rs, txtrPath);

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP3_CSKR_HPP_
#define _DNAMP3_CSKR_HPP_
#include "hecl/blender/BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "../DNACommon/DNACommon.hpp"
#include "CINF.hpp"
#include "../DNAMP2/CSKR.hpp"

View File

@ -216,31 +216,31 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
switch (entry.type)
{
case SBIG('CAUD'):
return {CAUD::Extract, nullptr, {_S(".yaml")}};
return {CAUD::Extract, {_S(".yaml")}};
case SBIG('STRG'):
return {STRG::Extract, nullptr, {_S(".yaml")}};
return {STRG::Extract, {_S(".yaml")}};
case SBIG('TXTR'):
return {TXTR::Extract, nullptr, {_S(".png")}};
return {TXTR::Extract, {_S(".png")}};
case SBIG('SAVW'):
return {SAVWCommon::ExtractSAVW<SAVW>, nullptr, {_S(".yaml")}};
return {SAVWCommon::ExtractSAVW<SAVW>, {_S(".yaml")}};
case SBIG('HINT'):
return {HINT::Extract, nullptr, {_S(".yaml")}};
return {HINT::Extract, {_S(".yaml")}};
case SBIG('CMDL'):
return {nullptr, CMDL::Extract, {_S(".blend")}, 1};
return {CMDL::Extract, {_S(".blend")}, 1};
case SBIG('CHAR'):
return {nullptr, CHAR::Extract, {_S(".yaml"), _S(".blend")}, 2};
return {CHAR::Extract, {_S(".yaml"), _S(".blend")}, 2};
case SBIG('MLVL'):
return {nullptr, MLVL::Extract, {_S(".blend")}, 3};
return {MLVL::Extract, {_S(".blend")}, 3};
case SBIG('MREA'):
return {nullptr, MREA::Extract, {_S(".blend")}, 4};
return {MREA::Extract, {_S(".blend")}, 4};
case SBIG('MAPA'):
return {nullptr, MAPA::Extract, {_S(".blend")}, 4};
return {MAPA::Extract, {_S(".blend")}, 4};
case SBIG('FSM2'):
return {DNAFSM2::ExtractFSM2<UniqueID64>, nullptr, {_S(".yaml")}};
return {DNAFSM2::ExtractFSM2<UniqueID64>, {_S(".yaml")}};
case SBIG('FONT'):
return {DNAFont::ExtractFONT<UniqueID64>, nullptr, {_S(".yaml")}};
return {DNAFont::ExtractFONT<UniqueID64>, {_S(".yaml")}};
case SBIG('DGRP'):
return {DNADGRP::ExtractDGRP<UniqueID64>, nullptr, {_S(".yaml")}};
return {DNADGRP::ExtractDGRP<UniqueID64>, {_S(".yaml")}};
}
return {};
}

View File

@ -86,7 +86,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
/* We're not in a world pak, so lets keep the original name */
mreaPath = outPath;
if (!force && mreaPath.getPathType() == hecl::ProjectPath::Type::File)
if (!force && mreaPath.isFile())
return true;
/* Do extract */

View File

@ -5,7 +5,7 @@
#include "SpecBase.hpp"
#include "Blender/BlenderSupport.hpp"
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "DNACommon/DNACommon.hpp"
#include "DNACommon/TXTR.hpp"
@ -123,6 +123,26 @@ void SpecBase::doExtract(const ExtractPassInfo& info, FProgress progress)
extractFromDisc(*m_disc, info.force, progress);
}
static bool IsPathAudioGroup(const hecl::ProjectPath& path)
{
if (path.getPathType() != hecl::ProjectPath::Type::Glob ||
!path.getWithExtension(_S(".pool"), true).isFile() ||
!path.getWithExtension(_S(".proj"), true).isFile() ||
!path.getWithExtension(_S(".sdir"), true).isFile() ||
!path.getWithExtension(_S(".samp"), true).isFile())
return false;
return true;
}
static bool IsPathSong(const hecl::ProjectPath& path)
{
if (path.getPathType() != hecl::ProjectPath::Type::Glob ||
!path.getWithExtension(_S(".mid"), true).isFile() ||
!path.getWithExtension(_S(".yaml"), true).isFile())
return false;
return true;
}
bool SpecBase::canCook(const hecl::ProjectPath& path, hecl::BlenderToken& btok)
{
if (!checkPathPrefix(path))
@ -145,6 +165,14 @@ bool SpecBase::canCook(const hecl::ProjectPath& path, hecl::BlenderToken& btok)
bool retval = validateYAMLDNAType(reader);
return retval;
}
else if (IsPathAudioGroup(path))
{
return true;
}
else if (IsPathSong(path))
{
return true;
}
return false;
}
@ -223,6 +251,14 @@ void SpecBase::doCook(const hecl::ProjectPath& path, const hecl::ProjectPath& co
athena::io::FileReader reader(path.getAbsolutePath());
cookYAML(cookedPath, path, reader, progress);
}
else if (IsPathAudioGroup(path))
{
cookAudioGroup(cookedPath, path, progress);
}
else if (IsPathSong(path))
{
cookSong(cookedPath, path, progress);
}
}
bool SpecBase::canPackage(const PackagePassInfo& info)

View File

@ -5,7 +5,7 @@
#include <hecl/Database.hpp>
#include <nod/nod.hpp>
#include "BlenderConnection.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
namespace DataSpec
{
@ -69,6 +69,10 @@ struct SpecBase : hecl::Database::IDataSpec
FCookProgress progress)=0;
virtual void cookYAML(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
athena::io::IStreamReader& fin, FCookProgress progress)=0;
virtual void cookAudioGroup(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
FCookProgress progress)=0;
virtual void cookSong(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
FCookProgress progress)=0;
const hecl::ProjectPath& getMasterShaderPath() const {return m_masterShader;}

View File

@ -11,6 +11,8 @@
#include "DNAMP1/CMDL.hpp"
#include "DNAMP1/MREA.hpp"
#include "DNAMP1/ANCS.hpp"
#include "DNAMP1/AGSC.hpp"
#include "DNAMP1/CSNG.hpp"
#include "DNACommon/FONT.hpp"
#include "DNACommon/PART.hpp"
#include "DNACommon/SWHC.hpp"
@ -365,6 +367,8 @@ struct SpecMP1 : SpecBase
return true;
else if (!strcmp(classType, DNAMP1::HINT::DNAType()))
return true;
else if (!strcmp(classType, "ATBL"))
return true;
return false;
});
}
@ -541,6 +545,20 @@ struct SpecMP1 : SpecBase
}
progress(_S("Done"));
}
void cookAudioGroup(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
FCookProgress progress)
{
DNAMP1::AGSC::Cook(in, out);
progress(_S("Done"));
}
void cookSong(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
FCookProgress progress)
{
DNAMP1::CSNG::Cook(in, out);
progress(_S("Done"));
}
};
hecl::Database::DataSpecEntry SpecEntMP1 =

View File

@ -5,6 +5,8 @@
#include "DNAMP2/MLVL.hpp"
#include "DNAMP2/STRG.hpp"
#include "DNAMP2/AGSC.hpp"
#include "DNAMP1/CSNG.hpp"
#include "hecl/ClientProcess.hpp"
@ -287,11 +289,18 @@ struct SpecMP2 : SpecBase
bool validateYAMLDNAType(athena::io::IStreamReader& fp) const
{
if (BigYAML::ValidateFromYAMLStream<DNAMP2::MLVL>(fp))
return true;
if (BigYAML::ValidateFromYAMLStream<DNAMP2::STRG>(fp))
return true;
return false;
athena::io::YAMLDocReader reader;
yaml_parser_set_input(reader.getParser(), (yaml_read_handler_t*)athena::io::YAMLAthenaReader, &fp);
return reader.ClassTypeOperation([](const char* classType)
{
if (!strcmp(classType, DNAMP2::MLVL::DNAType()))
return true;
else if (!strcmp(classType, DNAMP2::STRG::DNAType()))
return true;
else if (!strcmp(classType, "ATBL"))
return true;
return false;
});
}
void cookMesh(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
@ -316,6 +325,20 @@ struct SpecMP2 : SpecBase
athena::io::IStreamReader& fin, FCookProgress progress)
{
}
void cookAudioGroup(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
FCookProgress progress)
{
DNAMP2::AGSC::Cook(in, out);
progress(_S("Done"));
}
void cookSong(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
FCookProgress progress)
{
DNAMP1::CSNG::Cook(in, out);
progress(_S("Done"));
}
};
hecl::Database::DataSpecEntry SpecEntMP2

View File

@ -511,6 +511,16 @@ struct SpecMP3 : SpecBase
athena::io::IStreamReader& fin, FCookProgress progress)
{
}
void cookAudioGroup(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
FCookProgress progress)
{
}
void cookSong(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
FCookProgress progress)
{
}
};
hecl::Database::DataSpecEntry SpecEntMP3

View File

@ -41,7 +41,7 @@ target_link_libraries(urde
RuntimeCommon
DNAMP3 DNAMP2 DNAMP1
DNACommon specter specter-fonts freetype ${DATA_SPEC_LIBS}
hecl-database hecl-runtime hecl-backend hecl-frontend hecl-hmdl hecl-blender hecl-common
hecl-common hecl-blender-addon
athena-core nod logvisor athena-libyaml amuse boo ${PNG_LIB} libjpeg-turbo squish xxhash zeus
kabufuda ${ZLIB_LIBRARIES} ${LZO_LIB}
${BOO_SYS_LIBS})

View File

@ -64,8 +64,21 @@ void ProjectResourceFactoryBase::ReadCatalog(const hecl::ProjectPath& catalogPat
if (m_catalogNameToTag.find(p.first) != m_catalogNameToTag.cend())
continue;
hecl::ProjectPath path(m_proj->getProjectWorkingPath(), p.second->m_scalarString);
if (path.getPathType() != hecl::ProjectPath::Type::File)
athena::io::YAMLNode& node = *p.second;
hecl::ProjectPath path(m_proj->getProjectWorkingPath(), node.m_scalarString);
if (node.m_type == YAML_SCALAR_NODE)
{
path = hecl::ProjectPath(m_proj->getProjectWorkingPath(), node.m_scalarString);
}
else if (node.m_type == YAML_SEQUENCE_NODE)
{
if (node.m_seqChildren.size() >= 2)
path = hecl::ProjectPath(m_proj->getProjectWorkingPath(), node.m_seqChildren[0]->m_scalarString).
ensureAuxInfo(node.m_seqChildren[1]->m_scalarString);
else if (node.m_seqChildren.size() == 1)
path = hecl::ProjectPath(m_proj->getProjectWorkingPath(), node.m_seqChildren[0]->m_scalarString);
}
if (!path.isFileOrGlob())
continue;
SObjectTag pathTag = TagFromPath(path, m_backgroundBlender);
if (pathTag)
@ -98,7 +111,7 @@ void ProjectResourceFactoryBase::BackgroundIndexRecursiveCatalogs(const hecl::Pr
BackgroundIndexRecursiveCatalogs(path, nameWriter, level+1);
else
{
if (path.getPathType() != hecl::ProjectPath::Type::File)
if (!path.isFile())
continue;
/* Read catalog.yaml for .pak directory if exists */
@ -216,7 +229,7 @@ void ProjectResourceFactoryBase::BackgroundIndexRecursiveProc(const hecl::Projec
BackgroundIndexRecursiveProc(path, cacheWriter, nameWriter, level+1);
else
{
if (path.getPathType() != hecl::ProjectPath::Type::File)
if (!path.isFile())
continue;
/* Read catalog.yaml for .pak directory if exists */
@ -246,7 +259,7 @@ void ProjectResourceFactoryBase::BackgroundIndexProc()
athena::io::YAMLDocWriter nameWriter(nullptr);
/* Read in tag cache */
if (tagCachePath.getPathType() == hecl::ProjectPath::Type::File)
if (tagCachePath.isFile())
{
athena::io::FileReader reader(tagCachePath.getAbsolutePath());
if (reader.isOpen())
@ -273,7 +286,7 @@ void ProjectResourceFactoryBase::BackgroundIndexProc()
path = path.ensureAuxInfo(sys.sys_str());
}
if (path.getPathType() == hecl::ProjectPath::Type::File)
if (path.isFile())
{
SObjectTag pathTag(type, id);
m_tagToPath[pathTag] = path;
@ -288,7 +301,7 @@ void ProjectResourceFactoryBase::BackgroundIndexProc()
Log.report(logvisor::Info, _S("Cache index of '%s' loaded; %d tags"),
m_origSpec->m_name, m_tagToPath.size());
if (nameCachePath.getPathType() == hecl::ProjectPath::Type::File)
if (nameCachePath.isFile())
{
/* Read in name cache */
Log.report(logvisor::Info, _S("Name index of '%s' loading"), m_origSpec->m_name);
@ -399,7 +412,7 @@ void ProjectResourceFactoryBase::AsyncTask::EnsurePath(const urde::SObjectTag& t
m_workingPath = path;
/* Ensure requested resource is on the filesystem */
if (path.getPathType() != hecl::ProjectPath::Type::File)
if (!path.isFile())
{
Log.report(logvisor::Error, _S("unable to find resource path '%s'"),
path.getRelativePath().c_str());
@ -422,7 +435,7 @@ void ProjectResourceFactoryBase::AsyncTask::EnsurePath(const urde::SObjectTag& t
m_cookedPath = m_parent.GetCookedPath(path, true);
/* Perform mod-time comparison */
if (m_cookedPath.getPathType() != hecl::ProjectPath::Type::File ||
if (!m_cookedPath.isFile() ||
m_cookedPath.getModtime() < path.getModtime())
{
/* Start a background cook here */
@ -510,7 +523,7 @@ ProjectResourceFactoryBase::PrepForReadSync(const SObjectTag& tag,
std::experimental::optional<athena::io::FileReader>& fr)
{
/* Ensure requested resource is on the filesystem */
if (path.getPathType() != hecl::ProjectPath::Type::File)
if (!path.isFile())
{
Log.report(logvisor::Error, _S("unable to find resource path '%s'"),
path.getAbsolutePath().c_str());
@ -531,7 +544,7 @@ ProjectResourceFactoryBase::PrepForReadSync(const SObjectTag& tag,
hecl::ProjectPath cooked = GetCookedPath(path, true);
/* Perform mod-time comparison */
if (cooked.getPathType() != hecl::ProjectPath::Type::File ||
if (!cooked.isFile() ||
cooked.getModtime() < path.getModtime())
{
/* Do a blocking cook here */
@ -703,7 +716,7 @@ bool ProjectResourceFactoryBase::CanBuild(const urde::SObjectTag& tag)
if (!WaitForTagReady(tag, resPath))
return false;
if (resPath->getPathType() == hecl::ProjectPath::Type::File)
if (resPath->isFile())
return true;
return false;

View File

@ -6,7 +6,7 @@ namespace urde
bool ResourceBrowser::navigateToPath(const hecl::ProjectPath& pathIn)
{
if (pathIn.getPathType() == hecl::ProjectPath::Type::File)
if (pathIn.isFile())
m_path = pathIn.getParentPath();
else
m_path = pathIn;

View File

@ -211,7 +211,7 @@ public:
void reloadState()
{
hecl::ProjectPath pp(*m_vm.project(), m_state.path);
if (m_state.path.empty() || pp.getPathType() == hecl::ProjectPath::Type::None)
if (m_state.path.empty() || pp.isNone())
{
m_state.path = m_vm.project()->getProjectWorkingPath().getRelativePathUTF8();
navigateToPath(hecl::ProjectPath(*m_vm.project(), m_state.path));

View File

@ -53,7 +53,7 @@ public:
}
static bool FileExists(const char* path)
{
return hecl::ProjectPath(m_DvdRoot, path).getPathType() != hecl::ProjectPath::Type::File;
return hecl::ProjectPath(m_DvdRoot, path).isFile();
}
void CloseFile()
{

View File

@ -55,10 +55,12 @@ void CTweaks::RegisterResourceTweaks()
const SObjectTag* tag = factory.GetResourceIdByName("GunRes");
strm.emplace(factory.LoadResourceSync(*tag).release(), factory.ResourceSize(*tag));
g_tweakGunRes = new DataSpec::DNAMP1::CTweakGunRes(*strm);
g_tweakGunRes->ResolveResources(factory);
tag = factory.GetResourceIdByName("PlayerRes");
strm.emplace(factory.LoadResourceSync(*tag).release(), factory.ResourceSize(*tag));
g_tweakPlayerRes = new DataSpec::DNAMP1::CTweakPlayerRes(*strm);
g_tweakPlayerRes->ResolveResources(factory);
}
}

View File

@ -336,10 +336,10 @@ void CWorldTransManager::EnableTransition(const CAnimRes& samusRes,
x8_textData.reset();
x20_random.SetSeed(99);
const std::string& modelName = g_tweakPlayerRes->GetBeamCineModel(
ResId beamModelId = g_tweakPlayerRes->GetBeamCineModel(
DataSpec::ITweakPlayerRes::EBeamId(g_GameState->GetPlayerState()->GetCurrentBeam()));
x4_modelData->x14c_beamModel = g_SimplePool->GetObj(modelName.c_str());
x4_modelData->x14c_beamModel = g_SimplePool->GetObj(SObjectTag{FOURCC('CMDL'), beamModelId});
TToken<CCharacterFactory> fac = g_CharFactoryBuilder->GetFactory(samusRes);
const CCharacterInfo& info = fac.GetObj()->GetCharInfo(GetSuitCharIdx());

2
hecl

@ -1 +1 @@
Subproject commit 41c2107a921e238660b63f5042a13588d68ef7a3
Subproject commit a0748dc4e2232491db9dad971819c7a93f2a5691

2
nod

@ -1 +1 @@
Subproject commit 9d6b6ceb718a403da594d37480c3a941e045a1f2
Subproject commit 02d9f800fcf327ad6cd99de618db81a24e58e380