This commit is contained in:
Jack Andersen 2016-02-24 10:55:04 -10:00
commit 228a4211be
44 changed files with 1287 additions and 176 deletions

View File

@ -77,6 +77,7 @@ set(HECL_DATASPEC_PUSHES
HECL::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP2); HECL::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP2);
HECL::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3);") HECL::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3);")
add_subdirectory(hecl) add_subdirectory(hecl)
add_definitions(${BOO_SYS_DEFINES})
add_subdirectory(libSpecter) add_subdirectory(libSpecter)
set(SPECTER_INCLUDE_DIR libSpecter/include libSpecter/freetype2/include) set(SPECTER_INCLUDE_DIR libSpecter/include libSpecter/freetype2/include)
add_subdirectory(NODLib) add_subdirectory(NODLib)

View File

@ -21,6 +21,7 @@ add_library(DNACommon
ParticleCommon.cpp ParticleCommon.cpp
DeafBabe.hpp DeafBabe.hpp
BabeDead.hpp BabeDead.hpp
NamedResourceCatalog.hpp
Tweaks/ITweakGame.hpp Tweaks/ITweakGame.hpp
Tweaks/ITweakParticle.hpp Tweaks/ITweakParticle.hpp
Tweaks/ITweakPlayer.hpp Tweaks/ITweakPlayer.hpp

View File

@ -0,0 +1,132 @@
#ifndef __DNACOMMON_NAMEDRESOURCECATALOG_HPP__
#define __DNACOMMON_NAMEDRESOURCECATALOG_HPP__
#include "DNACommon.hpp"
namespace DataSpec
{
template <class IDType>
struct NamedResourceCatalog : BigYAML
{
Delete _d;
Value<atUint32> namedResCount = 0;
struct NamedResource : BigYAML
{
Delete _d;
DNAFourCC type;
String<-1> name;
IDType uid;
void read(Athena::io::IStreamReader& __dna_reader)
{
/* type */
type.read(__dna_reader);
/* name */
name = __dna_reader.readString(-1);
/* uid */
uid.read(__dna_reader);
}
void write(Athena::io::IStreamWriter& __dna_writer) const
{
/* type */
type.write(__dna_writer);
/* name */
__dna_writer.writeString(name, -1);
/* uid */
uid.write(__dna_writer);
}
void read(Athena::io::YAMLDocReader& __dna_docin)
{
/* type */
__dna_docin.enumerate("type", type);
/* name */
name = __dna_docin.readString("name");
/* uid */
__dna_docin.enumerate("uid", uid);
}
void write(Athena::io::YAMLDocWriter& __dna_docout) const
{
/* type */
__dna_docout.enumerate("type", type);
/* name */
__dna_docout.writeString("name", name);
/* uid */
__dna_docout.enumerate("uid", uid);
}
static const char* DNAType() { return "DataSpec::DNACommon::NameResourceCatalog::NamedResource"; }
size_t binarySize(size_t __isz) const
{
__isz = type.binarySize(__isz);
__isz += name.size() + 1;
__isz = uid.binarySize(__isz);
return __isz;
}
};
Vector<NamedResource, DNA_COUNT(namedResCount)> namedResources;
void read(Athena::io::IStreamReader& __dna_reader)
{
/* namedResCount */
namedResCount = __dna_reader.readUint32Big();
/* namedResources */
__dna_reader.enumerate(namedResources, namedResCount);
}
void write(Athena::io::IStreamWriter& __dna_writer) const
{
/* namedResCount */
__dna_writer.writeUint32Big(namedResCount);
/* namedResources */
__dna_writer.enumerate(namedResources);
}
void read(Athena::io::YAMLDocReader& __dna_docin)
{
/* namedResCount */
namedResCount = __dna_docin.readUint32("namedResCount");
/* namedResources */
__dna_docin.enumerate("namedResources", namedResources, namedResCount);
}
void write(Athena::io::YAMLDocWriter& __dna_docout) const
{
/* namedResCount */
__dna_docout.writeUint32("namedResCount", namedResCount);
/* namedResources */
__dna_docout.enumerate("namedResources", namedResources);
}
static const char* DNAType()
{
return "DataSpec::DNACommon::NameResourceCatalog";
}
size_t binarySize(size_t __isz) const
{
__isz = __EnumerateSize(__isz, namedResources);
return __isz + 4;
}
void addNamedResource(const std::string& name, const IDType& id, const DNAFourCC& type)
{
NamedResource res;
res.type = type;
res.name = name;
res.uid = id;
auto it = std::find_if(namedResources.begin(), namedResources.end(), [res](const NamedResource& a)->bool
{ return (a.name == res.name && a.type == res.type && a.uid == res.uid); });
if (it != namedResources.end())
return;
namedResources.push_back(std::move(res));
namedResCount++;
}
};
}
#endif // NAMEDRESOURCECATALOG_HPP

View File

@ -2,6 +2,7 @@
#define __DNACOMMON_PAK_HPP__ #define __DNACOMMON_PAK_HPP__
#include "DNACommon.hpp" #include "DNACommon.hpp"
#include "NamedResourceCatalog.hpp"
namespace DataSpec namespace DataSpec
{ {
@ -240,6 +241,7 @@ public:
using EntryType = typename PAKType::Entry; using EntryType = typename PAKType::Entry;
using RigPair = std::pair<IDType, IDType>; using RigPair = std::pair<IDType, IDType>;
private: private:
NamedResourceCatalog<IDType> m_catalog;
const SpecBase& m_dataSpec; const SpecBase& m_dataSpec;
const std::vector<BRIDGETYPE>* m_bridges = nullptr; const std::vector<BRIDGETYPE>* m_bridges = nullptr;
std::vector<std::pair<HECL::ProjectPath,HECL::ProjectPath>> m_bridgePaths; std::vector<std::pair<HECL::ProjectPath,HECL::ProjectPath>> m_bridgePaths;
@ -309,9 +311,21 @@ public:
/* Add RigPairs to global map */ /* Add RigPairs to global map */
bridge.addCMDLRigPairs(*this, m_cmdlRigs); bridge.addCMDLRigPairs(*this, m_cmdlRigs);
/* Add named resources to catalog */
for (const auto& namedEntry : pak.m_nameEntries)
m_catalog.addNamedResource(namedEntry.name, namedEntry.id, namedEntry.type);
progress(++count / bridgesSz); progress(++count / bridgesSz);
++bridgeIdx; ++bridgeIdx;
} }
HECL::SystemString catalogPath = HECL::ProjectPath(m_gameCooked, "catalog.yaml").getAbsolutePath();
FILE* catalog = HECL::Fopen(catalogPath.c_str(), _S("wb"));
if (catalog)
{
m_catalog.toYAMLFile(catalog);
fclose(catalog);
}
} }
void enterPAKBridge(const BRIDGETYPE& pakBridge) void enterPAKBridge(const BRIDGETYPE& pakBridge)

View File

@ -6,6 +6,7 @@ make_dnalist(liblist
CINF CINF
CSKR CSKR
MREA MREA
PTLA
DeafBabe) DeafBabe)
add_library(DNAMP2 add_library(DNAMP2
DNAMP2.hpp DNAMP2.cpp DNAMP2.hpp DNAMP2.cpp

72
DataSpec/DNAMP2/PTLA.hpp Normal file
View File

@ -0,0 +1,72 @@
#ifndef PTLA_HPP
#define PTLA_HPP
#include "../DNACommon/DNACommon.hpp"
namespace DataSpec
{
namespace DNAMP2
{
struct PTLA : BigDNA
{
DECL_DNA
Value<atUint32> magic;
Value<atUint32> version;
struct UnknownStruct1 : BigDNA
{
DECL_DNA
Value<atUint32> count;
struct Entry : BigDNA
{
DECL_DNA
Value<float> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<atUint16> unknown5;
Value<atUint16> unknown6;
};
Vector<Entry, DNA_COUNT(count)> entries;
Value<atVec3f> unknown[2];
};
Value<atUint32> count1;
Vector<UnknownStruct1, DNA_COUNT(count1)> entries1;
struct UnknownStruct2 : BigDNA
{
DECL_DNA
Value<atUint32> count;
struct Entry : BigDNA
{
DECL_DNA
Value<float> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
};
Vector<Entry, DNA_COUNT(count)> entries;
Value<atUint16> unknown;
};
Value<atUint32> count2;
Vector<UnknownStruct2, DNA_COUNT(count2)> entries2;
Value<atUint32> shortCount1;
Vector<atUint16, DNA_COUNT(shortCount1)> shorts1;
Value<atUint32> shortCount2;
Vector<atUint16, DNA_COUNT(shortCount2)> shorts2;
struct UnknownStruct3 : BigDNA
{
DECL_DNA
Value<atVec3f> unknown1[2];
Value<atUint16> unknown2;
Value<atUint16> unknown3;
Value<atUint16> unknown4;
};
Value<atUint32> count3;
Vector<UnknownStruct3, DNA_COUNT(count3)> entries3;
};
}
}
#endif // PTLA_HPP

View File

@ -25,9 +25,12 @@ static const HECL::SystemChar* MomErr[] =
_S("Contradictive narratives unsupported"), _S("Contradictive narratives unsupported"),
_S("Wiimote profile \"NES + Zapper\" not recognized"), _S("Wiimote profile \"NES + Zapper\" not recognized"),
_S("Unable to find Waldo"), _S("Unable to find Waldo"),
_S("Expected Ridley, found furby") _S("Expected Ridley, found furby"),
_S("Adam has not authorized this, please do not bug the developers"),
_S("Error: Lady returned objection")
}; };
constexpr uint32_t MomErrCount = 11;
SpecBase::SpecBase(HECL::Database::Project& project) SpecBase::SpecBase(HECL::Database::Project& project)
: m_project(project), : m_project(project),
m_masterShader(project.getProjectWorkingPath(), ".hecl/RetroMasterShader.blend") {} m_masterShader(project.getProjectWorkingPath(), ".hecl/RetroMasterShader.blend") {}
@ -44,9 +47,9 @@ bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport
unsigned int t = time(nullptr); unsigned int t = time(nullptr);
#if _WIN32 #if _WIN32
rand_s(&t); rand_s(&t);
int r = t % 9; int r = t % MomErrCount;
#else #else
int r = rand_r(&t) % 9; int r = rand_r(&t) % MomErrCount;
#endif #endif
Log.report(LogVisor::FatalError, MomErr[r]); Log.report(LogVisor::FatalError, MomErr[r]);
} }

View File

@ -0,0 +1,25 @@
#include "ModelViewer.hpp"
namespace URDE
{
void ModelViewer::View::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
{
Specter::View::resized(root, sub);
m_scissorRect = sub;
}
void ModelViewer::View::draw(boo::IGraphicsCommandQueue* gfxQ)
{
gfxQ->setScissor(m_scissorRect);
m_mv.m_lineRenderer->Reset();
m_mv.m_lineRenderer->AddVertex({-0.5f, 0.f, -0.5f}, Zeus::CColor::skBlue, 1.f);
m_mv.m_lineRenderer->AddVertex({-0.5f, 0.f, 0.5f}, Zeus::CColor::skBlue, 1.f);
m_mv.m_lineRenderer->AddVertex({0.5f, 10.f, 0.5f}, Zeus::CColor::skRed, 3.f);
m_mv.m_lineRenderer->AddVertex({0.5f, 0.f, -0.5f}, Zeus::CColor::skBlue, 1.f);
m_mv.m_lineRenderer->Render();
gfxQ->setScissor({});
}
}

View File

@ -26,13 +26,20 @@ class ModelViewer : public ViewerSpace
} m_state; } m_state;
const Space::State& spaceState() const { return m_state; } const Space::State& spaceState() const { return m_state; }
std::unique_ptr<pshag::CLineRenderer> m_lineRenderer;
struct View : Specter::View struct View : Specter::View
{ {
ModelViewer& m_mv; ModelViewer& m_mv;
boo::SWindowRect m_scissorRect;
View(ModelViewer& mv, Specter::ViewResources& res) View(ModelViewer& mv, Specter::ViewResources& res)
: Specter::View(res, mv.m_vm.rootView()), m_mv(mv) : Specter::View(res, mv.m_vm.rootView()), m_mv(mv)
{} {
commitResources(res);
}
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
void draw(boo::IGraphicsCommandQueue *gfxQ);
}; };
Camera m_camera; Camera m_camera;
@ -43,6 +50,7 @@ public:
: ViewerSpace(vm, Class::ModelViewer, parent) : ViewerSpace(vm, Class::ModelViewer, parent)
{ {
reloadState(); reloadState();
m_lineRenderer.reset(new pshag::CLineRenderer(pshag::CLineRenderer::EPrimitiveMode::LineStrip, 4, nullptr, true));
} }
ModelViewer(ViewManager& vm, Space* parent, const ModelViewer& other) ModelViewer(ViewManager& vm, Space* parent, const ModelViewer& other)

View File

@ -17,31 +17,26 @@ ProjectResourceFactory::ProjectResourceFactory()
m_factoryMgr.AddFactory(HECL::FOURCC('PART'), pshag::FParticleFactory); m_factoryMgr.AddFactory(HECL::FOURCC('PART'), pshag::FParticleFactory);
} }
void ProjectResourceFactory::RecursiveAddDirObjects(const HECL::ProjectPath& path) void ProjectResourceFactory::BuildObjectMap(const HECL::Database::Project::ProjectDataSpec &spec)
{
HECL::DirectoryEnumerator de = path.enumerateDir();
for (const HECL::DirectoryEnumerator::Entry& ent : de)
{
if (ent.m_isDir)
RecursiveAddDirObjects(HECL::ProjectPath(path, ent.m_name));
if (ent.m_name.size() == 13 && ent.m_name[4] == _S('_'))
{
HECL::SystemUTF8View entu8(ent.m_name);
u32 id = strtoul(entu8.c_str() + 5, nullptr, 16);
if (id)
{
pshag::SObjectTag objTag = {HECL::FourCC(entu8.c_str()), id};
if (m_resPaths.find(objTag) == m_resPaths.end())
m_resPaths[objTag] = HECL::ProjectPath(path, ent.m_name);
}
}
}
}
void ProjectResourceFactory::BuildObjectMap(const HECL::Database::Project::ProjectDataSpec& spec)
{ {
m_resPaths.clear(); m_resPaths.clear();
RecursiveAddDirObjects(spec.cookedPath); m_namedResources.clear();
HECL::SystemString catalogPath = HECL::ProjectPath(spec.cookedPath, HECL::SystemString(spec.spec.m_name) + _S("/catalog.yaml")).getAbsolutePath();
FILE* catalogFile = HECL::Fopen(catalogPath.c_str(), _S("r"));
if (!HECL::StrCmp(spec.spec.m_name, _S("MP3")))
{
DataSpec::NamedResourceCatalog<DataSpec::UniqueID64> catalog;
if (catalogFile)
catalog.fromYAMLFile(catalogFile);
RecursiveAddDirObjects(spec.cookedPath, catalog);
}
else
{
DataSpec::NamedResourceCatalog<DataSpec::UniqueID32> catalog;
if (catalogFile)
catalog.fromYAMLFile(catalogFile);
RecursiveAddDirObjects(spec.cookedPath, catalog);
}
} }
std::unique_ptr<pshag::IObj> ProjectResourceFactory::Build(const pshag::SObjectTag& tag, std::unique_ptr<pshag::IObj> ProjectResourceFactory::Build(const pshag::SObjectTag& tag,
@ -83,9 +78,12 @@ bool ProjectResourceFactory::CanBuild(const pshag::SObjectTag& tag)
return true; return true;
} }
const pshag::SObjectTag* ProjectResourceFactory::GetResourceIdByName(const char*) const const pshag::SObjectTag* ProjectResourceFactory::GetResourceIdByName(const char* name) const
{ {
if (m_namedResources.find(name) == m_namedResources.end())
return nullptr; return nullptr;
const pshag::SObjectTag& tag = m_namedResources.at(name);
return &tag;
} }
} }

View File

@ -3,6 +3,7 @@
#include "Runtime/IFactory.hpp" #include "Runtime/IFactory.hpp"
#include "Runtime/CFactoryMgr.hpp" #include "Runtime/CFactoryMgr.hpp"
#include "DataSpec/DNACommon/NamedResourceCatalog.hpp"
namespace URDE namespace URDE
{ {
@ -10,8 +11,61 @@ namespace URDE
class ProjectResourceFactory : public pshag::IFactory class ProjectResourceFactory : public pshag::IFactory
{ {
std::unordered_map<pshag::SObjectTag, HECL::ProjectPath> m_resPaths; std::unordered_map<pshag::SObjectTag, HECL::ProjectPath> m_resPaths;
std::unordered_map<std::string, pshag::SObjectTag> m_namedResources;
pshag::CFactoryMgr m_factoryMgr; pshag::CFactoryMgr m_factoryMgr;
void RecursiveAddDirObjects(const HECL::ProjectPath& path); template <class IDType>
void RecursiveAddDirObjects(const HECL::ProjectPath& path, const DataSpec::NamedResourceCatalog<IDType>& catalog)
{
HECL::DirectoryEnumerator de = path.enumerateDir();
const int idLen = 5 + (IDType::BinarySize() * 2);
for (const HECL::DirectoryEnumerator::Entry& ent : de)
{
if (ent.m_isDir)
RecursiveAddDirObjects(HECL::ProjectPath(path, ent.m_name), catalog);
if (ent.m_name.size() == idLen && ent.m_name[4] == _S('_'))
{
HECL::SystemUTF8View entu8(ent.m_name);
#if _WIN32
u64 id = _strtoui64(entu8.c_str() + 5, nullptr, 16);
#else
u64 id = strtouq(entu8.c_str() + 5, nullptr, 16);
#endif
if (id)
{
pshag::SObjectTag objTag = {HECL::FourCC(entu8.c_str()), id};
if (m_resPaths.find(objTag) == m_resPaths.end())
m_resPaths[objTag] = HECL::ProjectPath(path, ent.m_name);
}
}
else
{
HECL::SystemUTF8View nameView(ent.m_name);
auto it = std::find_if(catalog.namedResources.begin(), catalog.namedResources.end(),
[&nameView](const typename DataSpec::NamedResourceCatalog<IDType>::NamedResource& res) -> bool
{ return res.name == nameView.str(); });
if (it == catalog.namedResources.end())
continue;
const typename DataSpec::NamedResourceCatalog<IDType>::NamedResource& nr = *it;
pshag::SObjectTag objTag = GetTag<IDType>(nr);
m_namedResources[nr.name.c_str()] = objTag;
m_resPaths[objTag] = HECL::ProjectPath(path, ent.m_name);
}
}
}
template <class IDType>
pshag::SObjectTag GetTag(const DataSpec::NamedResourceCatalog<DataSpec::UniqueID32>::NamedResource &nr,
typename std::enable_if<std::is_same<IDType, DataSpec::UniqueID32>::value>::type* = 0)
{ return { nr.type, nr.uid.toUint32() }; }
template <class IDType>
pshag::SObjectTag GetTag(const typename DataSpec::NamedResourceCatalog<IDType>::NamedResource& nr,
typename std::enable_if<std::is_same<IDType, DataSpec::UniqueID64>::value>::type* = 0)
{ return { nr.type, nr.uid.toUint64() }; }
public: public:
ProjectResourceFactory(); ProjectResourceFactory();
void BuildObjectMap(const HECL::Database::Project::ProjectDataSpec& spec); void BuildObjectMap(const HECL::Database::Project::ProjectDataSpec& spec);

View File

@ -20,7 +20,8 @@ namespace URDE
void ViewManager::BuildTestPART(pshag::IObjectStore& objStore) void ViewManager::BuildTestPART(pshag::IObjectStore& objStore)
{ {
m_partGenDesc = objStore.GetObj({HECL::FOURCC('PART'), 0x1E348530}); //m_partGenDesc = objStore.GetObj({HECL::FOURCC('PART'), 0x972A5CD2});
m_partGenDesc = objStore.GetObj("WallSpark");
m_partGen.reset(new pshag::CElementGen(m_partGenDesc, m_partGen.reset(new pshag::CElementGen(m_partGenDesc,
pshag::CElementGen::EModelOrientationType::Normal, pshag::CElementGen::EModelOrientationType::Normal,
pshag::CElementGen::EOptionalSystemFlags::None)); pshag::CElementGen::EOptionalSystemFlags::None));
@ -200,7 +201,7 @@ void ViewManager::pushRecentFile(const HECL::SystemString& path)
void ViewManager::init(boo::IApplication* app) void ViewManager::init(boo::IApplication* app)
{ {
m_mainWindow = std::unique_ptr<boo::IWindow>(app->newWindow(_S("URDE"))); m_mainWindow = std::unique_ptr<boo::IWindow>(app->newWindow(_S("URDE"), 1));
m_mainWindow->showWindow(); m_mainWindow->showWindow();
m_mainWindow->setWaitCursor(true); m_mainWindow->setWaitCursor(true);

View File

@ -15,26 +15,29 @@ struct Application : boo::IApplicationCallback
{ {
HECL::Runtime::FileStoreManager m_fileMgr; HECL::Runtime::FileStoreManager m_fileMgr;
HECL::CVarManager m_cvarManager; HECL::CVarManager m_cvarManager;
ViewManager m_viewManager; std::unique_ptr<ViewManager> m_viewManager;
bool m_running = true; bool m_running = true;
Application() : Application() :
m_fileMgr(_S("urde")), m_fileMgr(_S("urde")),
m_cvarManager(m_fileMgr), m_cvarManager(m_fileMgr)
m_viewManager(m_fileMgr, m_cvarManager) {} {
m_viewManager.reset(new ViewManager(m_fileMgr, m_cvarManager));
}
int appMain(boo::IApplication* app) int appMain(boo::IApplication* app)
{ {
initialize(app); initialize(app);
m_viewManager.init(app); m_viewManager->init(app);
while (m_running) while (m_running)
{ {
if (!m_viewManager.proc()) if (!m_viewManager->proc())
break; break;
} }
m_viewManager.stop(); m_viewManager->stop();
m_cvarManager.serialize(); m_cvarManager.serialize();
m_viewManager.reset();
return 0; return 0;
} }
void appQuitting(boo::IApplication*) void appQuitting(boo::IApplication*)

View File

@ -12,7 +12,9 @@ class CIOWin;
enum class EArchMsgTarget enum class EArchMsgTarget
{ {
IOWinManager = 0, IOWinManager = 0,
Game = 1 Game = 1,
/* PathShagged targets, we start at 255 */
ArchitectureSupport = 255,
}; };
enum class EArchMsgType enum class EArchMsgType
@ -28,6 +30,8 @@ enum class EArchMsgType
QuitGameplay = 8, QuitGameplay = 8,
UpdateBegin = 10, UpdateBegin = 10,
FrameBegin = 11, FrameBegin = 11,
/* PathShagged messages, we start at 255 */
ApplicationExit = 255,
}; };
struct IArchMsgParm struct IArchMsgParm
@ -39,6 +43,7 @@ struct CArchMsgParmInt32 : IArchMsgParm
{ {
u32 x4_parm; u32 x4_parm;
CArchMsgParmInt32(u32 parm) : x4_parm(parm) {} CArchMsgParmInt32(u32 parm) : x4_parm(parm) {}
virtual ~CArchMsgParmInt32() {}
}; };
struct CArchMsgParmVoidPtr : IArchMsgParm struct CArchMsgParmVoidPtr : IArchMsgParm
@ -46,6 +51,7 @@ struct CArchMsgParmVoidPtr : IArchMsgParm
void* x4_parm1; void* x4_parm1;
CArchMsgParmVoidPtr(void* parm1) CArchMsgParmVoidPtr(void* parm1)
: x4_parm1(parm1) {} : x4_parm1(parm1) {}
virtual ~CArchMsgParmVoidPtr() {}
}; };
struct CArchMsgParmInt32Int32VoidPtr : IArchMsgParm struct CArchMsgParmInt32Int32VoidPtr : IArchMsgParm
@ -55,22 +61,26 @@ struct CArchMsgParmInt32Int32VoidPtr : IArchMsgParm
void* xc_parm3; void* xc_parm3;
CArchMsgParmInt32Int32VoidPtr(u32 parm1, u32 parm2, void* parm3) CArchMsgParmInt32Int32VoidPtr(u32 parm1, u32 parm2, void* parm3)
: x4_parm1(parm1), x8_parm2(parm2), xc_parm3(parm3) {} : x4_parm1(parm1), x8_parm2(parm2), xc_parm3(parm3) {}
virtual ~CArchMsgParmInt32Int32VoidPtr() {}
}; };
struct CArchMsgParmNull : IArchMsgParm struct CArchMsgParmNull : IArchMsgParm
{ {
virtual ~CArchMsgParmNull() {}
}; };
struct CArchMsgParmReal32 : IArchMsgParm struct CArchMsgParmReal32 : IArchMsgParm
{ {
float x4_parm; float x4_parm;
CArchMsgParmReal32(float parm) : x4_parm(parm) {} CArchMsgParmReal32(float parm) : x4_parm(parm) {}
virtual ~CArchMsgParmReal32() {}
}; };
struct CArchMsgParmUserInput : IArchMsgParm struct CArchMsgParmUserInput : IArchMsgParm
{ {
CFinalInput x4_parm; CFinalInput x4_parm;
CArchMsgParmUserInput(const CFinalInput& parm) : x4_parm(parm) {} CArchMsgParmUserInput(const CFinalInput& parm) : x4_parm(parm) {}
virtual ~CArchMsgParmUserInput() {}
}; };
struct CArchMsgParmControllerStatus : IArchMsgParm struct CArchMsgParmControllerStatus : IArchMsgParm
@ -79,6 +89,8 @@ struct CArchMsgParmControllerStatus : IArchMsgParm
bool x6_parm2; bool x6_parm2;
CArchMsgParmControllerStatus(u16 a, bool b) CArchMsgParmControllerStatus(u16 a, bool b)
: x4_parm1(a), x6_parm2(b) {} : x4_parm1(a), x6_parm2(b) {}
virtual ~CArchMsgParmControllerStatus() {}
}; };
class CArchitectureMessage class CArchitectureMessage
@ -143,6 +155,11 @@ public:
{ {
return *msg.GetParm<CArchMsgParmVoidPtr>(); return *msg.GetParm<CArchMsgParmVoidPtr>();
} }
/* PathShagged Messages */
static CArchitectureMessage CreateApplicationExit(EArchMsgTarget target)
{
return CArchitectureMessage(target, EArchMsgType::ApplicationExit, new CArchMsgParmNull());
}
}; };
} }

View File

@ -206,14 +206,12 @@ public:
{ {
g_BooMainCommandQueue->setShaderDataBinding(binding); g_BooMainCommandQueue->setShaderDataBinding(binding);
} }
static void DrawInstances(boo::Primitive prim, size_t start, size_t count, size_t instCount) static void DrawInstances(size_t start, size_t count, size_t instCount)
{ {
g_BooMainCommandQueue->setDrawPrimitive(prim);
g_BooMainCommandQueue->drawInstances(start, count, instCount); g_BooMainCommandQueue->drawInstances(start, count, instCount);
} }
static void DrawArray(boo::Primitive prim, size_t start, size_t count) static void DrawArray(size_t start, size_t count)
{ {
g_BooMainCommandQueue->setDrawPrimitive(prim);
g_BooMainCommandQueue->draw(start, count); g_BooMainCommandQueue->draw(start, count);
} }
}; };

View File

@ -111,10 +111,11 @@ void CTexture::BuildI4FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp;
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
boo::TextureFormat::RGBA8, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, buf.get(), texelCount * 4, tmp);
reinterpret_cast<boo::ITextureS**>(&m_booTex)); m_booTex = tmp;
} }
void CTexture::BuildI8FromGCN(CInputStream& in) void CTexture::BuildI8FromGCN(CInputStream& in)
@ -157,10 +158,11 @@ void CTexture::BuildI8FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp;
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
boo::TextureFormat::RGBA8, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, buf.get(), texelCount * 4, tmp);
reinterpret_cast<boo::ITextureS**>(&m_booTex)); m_booTex = tmp;
} }
void CTexture::BuildIA4FromGCN(CInputStream& in) void CTexture::BuildIA4FromGCN(CInputStream& in)
@ -204,10 +206,11 @@ void CTexture::BuildIA4FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp;
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
boo::TextureFormat::RGBA8, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, buf.get(), texelCount * 4, tmp);
reinterpret_cast<boo::ITextureS**>(&m_booTex)); m_booTex = tmp;
} }
void CTexture::BuildIA8FromGCN(CInputStream& in) void CTexture::BuildIA8FromGCN(CInputStream& in)
@ -251,10 +254,11 @@ void CTexture::BuildIA8FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp;
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
boo::TextureFormat::RGBA8, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, buf.get(), texelCount * 4, tmp);
reinterpret_cast<boo::ITextureS**>(&m_booTex)); m_booTex = tmp;
} }
static std::vector<RGBA8> DecodePalette(int numEntries, CInputStream& in) static std::vector<RGBA8> DecodePalette(int numEntries, CInputStream& in)
@ -357,10 +361,11 @@ void CTexture::BuildC4FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp;
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
boo::TextureFormat::RGBA8, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, buf.get(), texelCount * 4, tmp);
reinterpret_cast<boo::ITextureS**>(&m_booTex)); m_booTex = tmp;
} }
void CTexture::BuildC8FromGCN(CInputStream& in) void CTexture::BuildC8FromGCN(CInputStream& in)
@ -399,10 +404,11 @@ void CTexture::BuildC8FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp;
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
boo::TextureFormat::RGBA8, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, buf.get(), texelCount * 4, tmp);
reinterpret_cast<boo::ITextureS**>(&m_booTex)); m_booTex = tmp;
} }
void CTexture::BuildC14X2FromGCN(CInputStream& in) void CTexture::BuildC14X2FromGCN(CInputStream& in)
@ -449,10 +455,11 @@ void CTexture::BuildRGB565FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp;
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
boo::TextureFormat::RGBA8, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, buf.get(), texelCount * 4, tmp);
reinterpret_cast<boo::ITextureS**>(&m_booTex)); m_booTex = tmp;
} }
void CTexture::BuildRGB5A3FromGCN(CInputStream& in) void CTexture::BuildRGB5A3FromGCN(CInputStream& in)
@ -504,10 +511,11 @@ void CTexture::BuildRGB5A3FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp;
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
boo::TextureFormat::RGBA8, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, buf.get(), texelCount * 4, tmp);
reinterpret_cast<boo::ITextureS**>(&m_booTex)); m_booTex = tmp;
} }
void CTexture::BuildRGBA8FromGCN(CInputStream& in) void CTexture::BuildRGBA8FromGCN(CInputStream& in)
@ -559,10 +567,11 @@ void CTexture::BuildRGBA8FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp;
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
boo::TextureFormat::RGBA8, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, buf.get(), texelCount * 4, tmp);
reinterpret_cast<boo::ITextureS**>(&m_booTex)); m_booTex = tmp;
} }
struct DXT1Block struct DXT1Block
@ -621,10 +630,11 @@ void CTexture::BuildDXT1FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp;
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
boo::TextureFormat::DXT1, boo::TextureFormat::DXT1,
buf.get(), blockCount * 8, buf.get(), blockCount * 8, tmp);
reinterpret_cast<boo::ITextureS**>(&m_booTex)); m_booTex = tmp;
} }
CTexture::CTexture(CInputStream& in) CTexture::CTexture(CInputStream& in)

View File

@ -12,6 +12,8 @@ CTimeProvider::CTimeProvider(const float& time)
if (x8_lastProvider != nullptr) if (x8_lastProvider != nullptr)
x8_lastProvider->x4_first = false; x8_lastProvider->x4_first = false;
g_currentTimeProvider = this;
#if 0 #if 0
CGraphics::SetExternalTimeProvider(this); CGraphics::SetExternalTimeProvider(this);
#endif #endif

View File

@ -31,10 +31,16 @@ void CLineRendererShaders::Initialize()
case boo::IGraphicsDataFactory::Platform::D3D12: case boo::IGraphicsDataFactory::Platform::D3D12:
m_bindFactory.reset(Initialize(*static_cast<boo::ID3DDataFactory*>(CGraphics::g_BooFactory))); m_bindFactory.reset(Initialize(*static_cast<boo::ID3DDataFactory*>(CGraphics::g_BooFactory)));
break; break;
#elif BOO_HAS_METAL #endif
#if BOO_HAS_METAL
case boo::IGraphicsDataFactory::Platform::Metal: case boo::IGraphicsDataFactory::Platform::Metal:
m_bindFactory.reset(Initialize(*static_cast<boo::MetalDataFactory*>(CGraphics::g_BooFactory))); m_bindFactory.reset(Initialize(*static_cast<boo::MetalDataFactory*>(CGraphics::g_BooFactory)));
break; break;
#endif
#if BOO_HAS_VULKAN
case boo::IGraphicsDataFactory::Platform::Vulkan:
m_bindFactory.reset(Initialize(*static_cast<boo::VulkanDataFactory*>(CGraphics::g_BooFactory)));
break;
#endif #endif
default: break; default: break;
} }
@ -154,7 +160,7 @@ void CLineRenderer::Reset()
void CLineRenderer::AddVertex(const Zeus::CVector3f& position, const Zeus::CColor& color, float width, void CLineRenderer::AddVertex(const Zeus::CVector3f& position, const Zeus::CColor& color, float width,
const Zeus::CVector2f& uv) const Zeus::CVector2f& uv)
{ {
if (!m_shaderBind || m_nextVert >= m_maxVerts) if (m_final || !m_shaderBind || m_nextVert >= m_maxVerts)
return; return;
float adjWidth = width / 480.f; float adjWidth = width / 480.f;
@ -385,16 +391,17 @@ void CLineRenderer::Render(const Zeus::CColor& moduColor)
SDrawUniform uniformData = {moduColor}; SDrawUniform uniformData = {moduColor};
m_uniformBuf->load(&uniformData, sizeof(SDrawUniform)); m_uniformBuf->load(&uniformData, sizeof(SDrawUniform));
CGraphics::SetShaderDataBinding(m_shaderBind);
if (m_textured) if (m_textured)
{ {
m_vertBuf->load(g_StaticLineVertsTex.data(), sizeof(SDrawVertTex) * g_StaticLineVertsTex.size()); m_vertBuf->load(g_StaticLineVertsTex.data(), sizeof(SDrawVertTex) * g_StaticLineVertsTex.size());
CGraphics::DrawArray(boo::Primitive::TriStrips, 0, g_StaticLineVertsTex.size()); CGraphics::SetShaderDataBinding(m_shaderBind);
CGraphics::DrawArray(0, g_StaticLineVertsTex.size());
} }
else else
{ {
m_vertBuf->load(g_StaticLineVertsNoTex.data(), sizeof(SDrawVertNoTex) * g_StaticLineVertsNoTex.size()); m_vertBuf->load(g_StaticLineVertsNoTex.data(), sizeof(SDrawVertNoTex) * g_StaticLineVertsNoTex.size());
CGraphics::DrawArray(boo::Primitive::TriStrips, 0, g_StaticLineVertsNoTex.size()); CGraphics::SetShaderDataBinding(m_shaderBind);
CGraphics::DrawArray(0, g_StaticLineVertsNoTex.size());
} }
} }

View File

@ -5,6 +5,7 @@
#include "boo/graphicsdev/GL.hpp" #include "boo/graphicsdev/GL.hpp"
#include "boo/graphicsdev/D3D.hpp" #include "boo/graphicsdev/D3D.hpp"
#include "boo/graphicsdev/Metal.hpp" #include "boo/graphicsdev/Metal.hpp"
#include "boo/graphicsdev/Vulkan.hpp"
namespace pshag namespace pshag
{ {
@ -36,9 +37,13 @@ public:
static IDataBindingFactory* Initialize(boo::GLDataFactory& factory); static IDataBindingFactory* Initialize(boo::GLDataFactory& factory);
#if _WIN32 #if _WIN32
static IDataBindingFactory* Initialize(boo::ID3DDataFactory& factory); static IDataBindingFactory* Initialize(boo::ID3DDataFactory& factory);
#elif BOO_HAS_METAL #endif
#if BOO_HAS_METAL
static IDataBindingFactory* Initialize(boo::MetalDataFactory& factory); static IDataBindingFactory* Initialize(boo::MetalDataFactory& factory);
#endif #endif
#if BOO_HAS_VULKAN
static IDataBindingFactory* Initialize(boo::VulkanDataFactory& factory);
#endif
static void Initialize(); static void Initialize();
static void Shutdown(); static void Shutdown();

View File

@ -6,11 +6,12 @@ namespace pshag
static const char* VS_GLSL_TEX = static const char* VS_GLSL_TEX =
"#version 330\n" "#version 330\n"
BOO_GLSL_BINDING_HEAD
"layout(location=0) in vec4 posIn;\n" "layout(location=0) in vec4 posIn;\n"
"layout(location=1) in vec4 colorIn;\n" "layout(location=1) in vec4 colorIn;\n"
"layout(location=2) in vec4 uvIn;\n" "layout(location=2) in vec4 uvIn;\n"
"\n" "\n"
"uniform LineUniform\n" "UBINDING0 uniform LineUniform\n"
"{\n" "{\n"
" vec4 moduColor;\n" " vec4 moduColor;\n"
"};\n" "};\n"
@ -31,6 +32,7 @@ static const char* VS_GLSL_TEX =
static const char* FS_GLSL_TEX = static const char* FS_GLSL_TEX =
"#version 330\n" "#version 330\n"
BOO_GLSL_BINDING_HEAD
"struct VertToFrag\n" "struct VertToFrag\n"
"{\n" "{\n"
" vec4 color;\n" " vec4 color;\n"
@ -39,7 +41,7 @@ static const char* FS_GLSL_TEX =
"\n" "\n"
"in VertToFrag vtf;\n" "in VertToFrag vtf;\n"
"layout(location=0) out vec4 colorOut;\n" "layout(location=0) out vec4 colorOut;\n"
"uniform sampler2D texs[1];\n" "TBINDING0 uniform sampler2D texs[1];\n"
"void main()\n" "void main()\n"
"{\n" "{\n"
" colorOut = vtf.color * texture(texs[0], vtf.uv);\n" " colorOut = vtf.color * texture(texs[0], vtf.uv);\n"
@ -47,10 +49,11 @@ static const char* FS_GLSL_TEX =
static const char* VS_GLSL_NOTEX = static const char* VS_GLSL_NOTEX =
"#version 330\n" "#version 330\n"
BOO_GLSL_BINDING_HEAD
"layout(location=0) in vec4 posIn;\n" "layout(location=0) in vec4 posIn;\n"
"layout(location=1) in vec4 colorIn;\n" "layout(location=1) in vec4 colorIn;\n"
"\n" "\n"
"uniform LineUniform\n" "UBINDING0 uniform LineUniform\n"
"{\n" "{\n"
" vec4 moduColor;\n" " vec4 moduColor;\n"
"};\n" "};\n"
@ -81,7 +84,7 @@ static const char* FS_GLSL_NOTEX =
" colorOut = vtf.color;\n" " colorOut = vtf.color;\n"
"}\n"; "}\n";
struct GLSLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory struct OGLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
{ {
void BuildShaderDataBinding(CLineRenderer& renderer, boo::IShaderPipeline* pipeline, boo::ITexture* texture) void BuildShaderDataBinding(CLineRenderer& renderer, boo::IShaderPipeline* pipeline, boo::ITexture* texture)
{ {
@ -136,7 +139,63 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
false, false, false); false, false, false);
return new struct GLSLLineDataBindingFactory; return new struct OGLLineDataBindingFactory;
} }
#if BOO_HAS_VULKAN
struct VulkanLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
{
void BuildShaderDataBinding(CLineRenderer& renderer, boo::IShaderPipeline* pipeline, boo::ITexture* texture)
{
int texCount = 0;
boo::ITexture* textures[1];
if (texture)
{
textures[0] = texture;
texCount = 1;
}
boo::IGraphicsBuffer* uniforms[] = {renderer.m_uniformBuf};
renderer.m_shaderBind = CGraphics::g_BooFactory->newShaderDataBinding(pipeline, nullptr, renderer.m_vertBuf,
nullptr, nullptr, 1, uniforms,
texCount, textures);
}
};
CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo::VulkanDataFactory& factory)
{
static const boo::VertexElementDescriptor VtxFmtTex[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4},
{nullptr, nullptr, boo::VertexSemantic::Color},
{nullptr, nullptr, boo::VertexSemantic::UV4}
};
m_texVtxFmt = factory.newVertexFormat(3, VtxFmtTex);
static const boo::VertexElementDescriptor VtxFmtNoTex[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4},
{nullptr, nullptr, boo::VertexSemantic::Color}
};
m_noTexVtxFmt = factory.newVertexFormat(2, VtxFmtNoTex);
m_texAlpha = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_texVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
false, true, false);
m_texAdditive = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_texVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
false, false, false);
m_noTexAlpha = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_noTexVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
false, true, false);
m_noTexAdditive = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_noTexVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
false, false, false);
return new struct VulkanLineDataBindingFactory;
}
#endif
} }

View File

@ -0,0 +1,147 @@
#include "CLineRendererShaders.hpp"
#include "CLineRenderer.hpp"
namespace pshag
{
static const char* VS_HLSL_TEX =
"struct VertData\n"
"{\n"
" float4 posIn : POSITION;\n"
" float4 colorIn : COLOR;\n"
" float4 uvIn : UV;\n"
"};\n"
"\n"
"cbuffer LineUniform : register(b0)\n"
"{\n"
" float4 moduColor;\n"
"};\n"
"\n"
"struct VertToFrag\n"
"{\n"
" float4 position : SV_Position;\n"
" float4 color : COLOR;\n"
" float2 uv : UV;\n"
"};\n"
"\n"
"VertToFrag main(in VertData v)\n"
"{\n"
" VertToFrag vtf;\n"
" vtf.color = v.colorIn * moduColor;\n"
" vtf.uv = v.uvIn.xy;\n"
" vtf.position = v.posIn;\n"
" return vtf;\n"
"}\n";
static const char* FS_HLSL_TEX =
"SamplerState samp : register(s0);\n"
"Texture2D tex0 : register(t0);\n"
"struct VertToFrag\n"
"{\n"
" float4 position : SV_Position;\n"
" float4 color : COLOR;\n"
" float2 uv : UV;\n"
"};\n"
"\n"
"float4 main(in VertToFrag vtf) : SV_Target0\n"
"{\n"
" return vtf.color * tex0.Sample(samp, vtf.uv);\n"
"}\n";
static const char* VS_HLSL_NOTEX =
"struct VertData\n"
"{\n"
" float4 posIn : POSITION;\n"
" float4 colorIn : COLOR;\n"
"};\n"
"\n"
"cbuffer LineUniform : register(b0)\n"
"{\n"
" float4 moduColor;\n"
"};\n"
"\n"
"struct VertToFrag\n"
"{\n"
" float4 position : SV_Position;\n"
" float4 color : COLOR;\n"
"};\n"
"\n"
"VertToFrag main(in VertData v)\n"
"{\n"
" VertToFrag vtf;\n"
" vtf.color = v.colorIn * moduColor;\n"
" vtf.position = v.posIn;\n"
" return vtf;\n"
"}\n";
static const char* FS_HLSL_NOTEX =
"struct VertToFrag\n"
"{\n"
" float4 position : SV_Position;\n"
" float4 color : COLOR;\n"
"};\n"
"\n"
"float4 main(in VertToFrag vtf) : SV_Target0\n"
"{\n"
" return vtf.color;\n"
"}\n";
struct HLSLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
{
void BuildShaderDataBinding(CLineRenderer& renderer, boo::IShaderPipeline* pipeline, boo::ITexture* texture)
{
int texCount = 0;
boo::ITexture* textures[1];
if (texture)
{
textures[0] = texture;
texCount = 1;
}
boo::IGraphicsBuffer* uniforms[] = {renderer.m_uniformBuf};
renderer.m_shaderBind = CGraphics::g_BooFactory->newShaderDataBinding(pipeline, nullptr, renderer.m_vertBuf,
nullptr, nullptr, 1, uniforms,
texCount, textures);
}
};
CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo::ID3DDataFactory& factory)
{
static const boo::VertexElementDescriptor VtxFmtTex[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4},
{nullptr, nullptr, boo::VertexSemantic::Color},
{nullptr, nullptr, boo::VertexSemantic::UV4}
};
m_texVtxFmt = factory.newVertexFormat(3, VtxFmtTex);
static const boo::VertexElementDescriptor VtxFmtNoTex[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4},
{nullptr, nullptr, boo::VertexSemantic::Color}
};
m_noTexVtxFmt = factory.newVertexFormat(2, VtxFmtNoTex);
m_texAlpha = factory.newShaderPipeline(VS_HLSL_TEX, FS_HLSL_TEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
ComPtr<ID3DBlob>(), m_texVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
false, true, false);
m_texAdditive = factory.newShaderPipeline(VS_HLSL_TEX, FS_HLSL_TEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
ComPtr<ID3DBlob>(), m_texVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
false, false, false);
m_noTexAlpha = factory.newShaderPipeline(VS_HLSL_NOTEX, FS_HLSL_NOTEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
ComPtr<ID3DBlob>(), m_noTexVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
false, true, false);
m_noTexAdditive = factory.newShaderPipeline(VS_HLSL_NOTEX, FS_HLSL_NOTEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
ComPtr<ID3DBlob>(), m_noTexVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
false, false, false);
return new struct HLSLLineDataBindingFactory;
}
}

View File

@ -72,6 +72,8 @@ public:
const CKeyboardMouseControllerData& data, const CKeyboardMouseControllerData& data,
const CFinalInput& prevInput); const CFinalInput& prevInput);
CFinalInput& operator|=(const CFinalInput& other); CFinalInput& operator|=(const CFinalInput& other);
bool operator==(const CFinalInput& other)
{ return memcmp(this, &other, sizeof(CFinalInput)) == 0; }
bool PStart() const {return x2e_b31_PStart;} bool PStart() const {return x2e_b31_PStart;}
bool PR() const {return x2e_b26_PR;} bool PR() const {return x2e_b26_PR;}

View File

@ -7,8 +7,14 @@ namespace pshag
void CInputGenerator::Update(float dt, CArchitectureQueue& queue) void CInputGenerator::Update(float dt, CArchitectureQueue& queue)
{ {
if (m_firstFrame)
{
m_firstFrame = false;
return;
}
/* Keyboard/Mouse first */ /* Keyboard/Mouse first */
CFinalInput kbInput = m_windowCb.getFinalInput(0, dt); CFinalInput kbInput = getFinalInput(0, dt);
bool kbUsed = false; bool kbUsed = false;
/* Dolphin controllers next */ /* Dolphin controllers next */

View File

@ -24,6 +24,16 @@ class CInputGenerator : public boo::DeviceFinder
* the logical state */ * the logical state */
float m_leftDiv; float m_leftDiv;
float m_rightDiv; float m_rightDiv;
CKeyboardMouseControllerData m_data;
CFinalInput m_lastUpdate;
const CFinalInput& getFinalInput(unsigned idx, float dt)
{
m_lastUpdate = CFinalInput(idx, dt, m_data, m_lastUpdate);
return m_lastUpdate;
}
bool m_firstFrame = true;
public: public:
CInputGenerator(float leftDiv, float rightDiv) CInputGenerator(float leftDiv, float rightDiv)
: boo::DeviceFinder({typeid(boo::DolphinSmashAdapter)}), : boo::DeviceFinder({typeid(boo::DolphinSmashAdapter)}),
@ -35,9 +45,6 @@ public:
* for buffering events in its own way, then boo flushes the buffer * for buffering events in its own way, then boo flushes the buffer
* at the start of each frame, invoking these methods. No atomic locking * at the start of each frame, invoking these methods. No atomic locking
* is necessary, only absolute state tracking. */ * is necessary, only absolute state tracking. */
struct WindowCallback : boo::IWindowCallback
{
CKeyboardMouseControllerData m_data;
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton button, boo::EModifierKey) void mouseDown(const boo::SWindowCoord&, boo::EMouseButton button, boo::EModifierKey)
{ {
@ -92,14 +99,6 @@ public:
m_data.m_accumScroll.zeroOut(); m_data.m_accumScroll.zeroOut();
} }
CFinalInput m_lastUpdate;
const CFinalInput& getFinalInput(unsigned idx, float dt)
{
m_lastUpdate = CFinalInput(idx, dt, m_data, m_lastUpdate);
return m_lastUpdate;
}
} m_windowCb;
/* Input via the smash adapter is received asynchronously on a USB /* Input via the smash adapter is received asynchronously on a USB
* report thread. This class atomically exchanges that data to the * report thread. This class atomically exchanges that data to the
* game thread as needed */ * game thread as needed */
@ -114,7 +113,7 @@ public:
/* Controller thread */ /* Controller thread */
m_statusChanges[idx].store(EStatusChange::Connected); m_statusChanges[idx].store(EStatusChange::Connected);
} }
void controllerDisconnected(unsigned idx, boo::EDolphinControllerType) void controllerDisconnected(unsigned idx)
{ {
/* Controller thread */ /* Controller thread */
std::unique_lock<std::mutex> lk(m_stateLock); std::unique_lock<std::mutex> lk(m_stateLock);

View File

@ -3,4 +3,7 @@ add_library(RuntimeCommonInput
CKeyboardMouseController.hpp CKeyboardMouseController.hpp
ControlMapper.hpp ControlMapper.cpp ControlMapper.hpp ControlMapper.cpp
CInputGenerator.hpp CInputGenerator.cpp CInputGenerator.hpp CInputGenerator.cpp
CFinalInput.hpp CFinalInput.cpp) CFinalInput.hpp CFinalInput.cpp
CRumbleManager.hpp CRumbleManager.cpp
CRumbleGenerator.hpp CRumbleGenerator.cpp
CRumbleVoice.hpp CRumbleVoice.cpp)

View File

@ -0,0 +1,8 @@
#include "CRumbleGenerator.hpp"
namespace pshag
{
CRumbleGenerator::CRumbleGenerator()
{
}
}

View File

@ -0,0 +1,17 @@
#ifndef CRUMBLEGENERATOR_HPP
#define CRUMBLEGENERATOR_HPP
#include "CRumbleVoice.hpp"
namespace pshag
{
class CRumbleGenerator
{
public:
CRumbleGenerator();
void Update(float);
void HardStopAll();
};
}
#endif // CRUMBLEGENERATOR_HPP

View File

@ -0,0 +1,8 @@
#include "CRumbleManager.hpp"
namespace pshag
{
void CRumbleManager::Update(float dt) { x0_rumbleGenerator.Update(dt); }
}

View File

@ -0,0 +1,21 @@
#ifndef __PSHAG_CRUMBLEMANAGER_HPP__
#define __PSHAG_CRUMBLEMANAGER_HPP__
#include "CRumbleGenerator.hpp"
namespace pshag
{
class CStateManager;
class CRumbleManager
{
CRumbleGenerator x0_rumbleGenerator;
public:
CRumbleManager() = default;
void Update(float);
void StopRumble(u16) {}
void Rumble(ERumbleFxId, CStateManager&, ERumblePriority priority);
void Rumble(ERumbleFxId, float, CStateManager&, ERumblePriority priority);
};
}
#endif // __PSHAG_CRUMBLEMANAGER_HPP__

View File

@ -0,0 +1,5 @@
#include "CRumbleVoice.hpp"
namespace pshag
{
}

View File

@ -0,0 +1,76 @@
#ifndef CRUMBLEVOICE_HPP
#define CRUMBLEVOICE_HPP
#include "RetroTypes.hpp"
namespace pshag
{
enum class ERumbleFxId
{
};
enum class ERumblePriority
{
None
};
struct SAdsrData;
class CRumbleVoice
{
public:
CRumbleVoice() {}
CRumbleVoice(const SAdsrData& data);
};
struct SAdsrData
{
float x0 = 0.f;
float x4 = 0.f;
float x8 = 0.f;
float xc = 0.f;
float x10 = 0.f;
float x14 = 0.f;
union
{
struct { bool x18_24 : 1; bool x18_25 : 1; };
u8 dummy = 0;
};
SAdsrData() = default;
SAdsrData(float a, float b, float c, float d, float e, float f, bool g, bool h)
: x0(a), x4(b), x8(c), xc(d), x10(e), x14(f)
{
x18_24 = g;
x18_25 = h;
}
};
struct SAdsrDelta
{
enum class EPhase
{
Stop,
Start,
};
float x0 = 0.f;
float x4 = 0.f;
float x8 = 0.f;
float xc = 0.f;
float x10 = 0.f;
ERumblePriority x1c_priority;
EPhase x20_phase;
SAdsrDelta(EPhase phase, ERumblePriority priority)
: x1c_priority(priority), x20_phase(phase)
{}
SAdsrDelta(EPhase phase)
: x1c_priority(ERumblePriority::None), x20_phase(phase)
{}
static SAdsrDelta Stopped() { return SAdsrDelta(EPhase::Stop); }
static SAdsrDelta Start(ERumblePriority priority) { return SAdsrDelta(EPhase::Start, priority); }
};
}
#endif // CRUMBLEVOICE_HPP

View File

@ -98,7 +98,7 @@ public:
} }
}; };
class CGameArchitectureSupport class CGameArchitectureSupport : public boo::IWindowCallback
{ {
CArchitectureQueue m_archQueue; CArchitectureQueue m_archQueue;
CAudioSys m_audioSys; CAudioSys m_audioSys;
@ -109,6 +109,38 @@ class CGameArchitectureSupport
CMainFlow m_mainFlow; CMainFlow m_mainFlow;
CConsoleOutputWindow m_consoleWindow; CConsoleOutputWindow m_consoleWindow;
CAudioStateWin m_audioStateWin; CAudioStateWin m_audioStateWin;
boo::SWindowRect m_windowRect;
bool m_rectIsDirty;
void mouseDown(const boo::SWindowCoord &coord, boo::EMouseButton button, boo::EModifierKey mods)
{ m_inputGenerator.mouseDown(coord, button, mods); }
void mouseUp(const boo::SWindowCoord &coord, boo::EMouseButton button, boo::EModifierKey mods)
{ m_inputGenerator.mouseUp(coord, button, mods); }
void mouseMove(const boo::SWindowCoord &coord)
{ m_inputGenerator.mouseMove(coord); }
void scroll(const boo::SWindowCoord &coord, const boo::SScrollDelta &scroll)
{ m_inputGenerator.scroll(coord, scroll); }
void charKeyDown(unsigned long charCode, boo::EModifierKey mods, bool isRepeat)
{ m_inputGenerator.charKeyDown(charCode, mods, isRepeat); }
void charKeyUp(unsigned long charCode, boo::EModifierKey mods)
{ m_inputGenerator.charKeyUp(charCode, mods); }
void specialKeyDown(boo::ESpecialKey key, boo::EModifierKey mods, bool isRepeat)
{ m_inputGenerator.specialKeyDown(key, mods, isRepeat); }
void specialKeyUp(boo::ESpecialKey key, boo::EModifierKey mods)
{ m_inputGenerator.specialKeyUp(key, mods); }
void modKeyDown(boo::EModifierKey mod, bool isRepeat)
{ m_inputGenerator.modKeyDown(mod, isRepeat);}
void modKeyUp(boo::EModifierKey mod)
{ m_inputGenerator.modKeyUp(mod); }
void destroyed() { m_archQueue.Push(std::move(MakeMsg::CreateApplicationExit(EArchMsgTarget::ArchitectureSupport))); }
void resized(const boo::SWindowRect &rect)
{
m_windowRect = rect;
m_rectIsDirty = true;
}
public: public:
CGameArchitectureSupport() CGameArchitectureSupport()
: m_audioSys(0,0,0,0,0), : m_audioSys(0,0,0,0,0),
@ -120,8 +152,33 @@ public:
bool Update() bool Update()
{ {
bool finished = false; bool finished = false;
m_inputGenerator.Update(1.0 / 60.0, m_archQueue);
while(m_archQueue)
{
CArchitectureMessage msg = m_archQueue.Pop();
if (msg.GetTarget() == EArchMsgTarget::ArchitectureSupport)
{
if (msg.GetType() == EArchMsgType::ApplicationExit)
finished = true;
}
if (msg.GetTarget() == EArchMsgTarget::Game && msg.GetType() == EArchMsgType::UserInput)
{
const CArchMsgParmUserInput* input = msg.GetParm<CArchMsgParmUserInput>();
if (input->x4_parm.DStart())
m_archQueue.Push(std::move(MakeMsg::CreateApplicationExit(EArchMsgTarget::ArchitectureSupport)));
}
}
return finished; return finished;
} }
bool isRectDirty() { return m_rectIsDirty; }
const boo::SWindowRect& getWindowRect()
{
m_rectIsDirty = false;
return m_windowRect;
}
}; };
CMain::CMain() CMain::CMain()
@ -167,7 +224,7 @@ void CMain::LoadAudio()
int CMain::appMain(boo::IApplication* app) int CMain::appMain(boo::IApplication* app)
{ {
Zeus::detectCPU(); Zeus::detectCPU();
mainWindow = app->newWindow(_S("Metroid Prime 1 Reimplementation vZygote")); mainWindow = app->newWindow(_S("Metroid Prime 1 Reimplementation vZygote"), 1);
mainWindow->showWindow(); mainWindow->showWindow();
TOneStatic<CGameGlobalObjects> globalObjs; TOneStatic<CGameGlobalObjects> globalObjs;
InitializeSubsystems(); InitializeSubsystems();
@ -177,25 +234,31 @@ int CMain::appMain(boo::IApplication* app)
g_TweakManager->ReadFromMemoryCard("AudioTweaks"); g_TweakManager->ReadFromMemoryCard("AudioTweaks");
FillInAssetIDs(); FillInAssetIDs();
TOneStatic<CGameArchitectureSupport> archSupport; TOneStatic<CGameArchitectureSupport> archSupport;
mainWindow->setCallback(archSupport.GetAllocSpace());
boo::IGraphicsCommandQueue* gfxQ = mainWindow->getCommandQueue(); boo::IGraphicsCommandQueue* gfxQ = mainWindow->getCommandQueue();
float rgba[4] = { 0.5f, 0.5f, 0.5f, 1.0f}; boo::SWindowRect windowRect = mainWindow->getWindowFrame();
boo::ITextureR* renderTex = mainWindow->getMainContextDataFactory()->newRenderTexture(windowRect.size[0], windowRect.size[1]);
float rgba[4] = { 0.2f, 0.2f, 0.2f, 1.0f};
gfxQ->setClearColor(rgba); gfxQ->setClearColor(rgba);
float time = 0.0f;
int frame = 0;
CTimeProvider test(time);
while (!xe8_b24_finished) while (!xe8_b24_finished)
{ {
mainWindow->waitForRetrace();
xe8_b24_finished = archSupport->Update(); xe8_b24_finished = archSupport->Update();
if (archSupport->isRectDirty())
{
const boo::SWindowRect& windowRect = archSupport->getWindowRect();
gfxQ->resizeRenderTexture(renderTex,
windowRect.size[0],
windowRect.size[1]);
}
gfxQ->setRenderTarget(renderTex);
gfxQ->clearTarget(); gfxQ->clearTarget();
gfxQ->resolveDisplay(renderTex);
gfxQ->execute(); gfxQ->execute();
mainWindow->waitForRetrace();
time = (frame++) / 60.f;
//fprintf(stderr, "%f\n", test.x0_currentTime);
} }
return 0; return 0;
} }

View File

@ -1,12 +1,146 @@
#include "CDecalDataFactory.hpp" #include "CDecalDataFactory.hpp"
#include "CDecalDescription.hpp" #include "CDecalDescription.hpp"
#include "CGenDescription.hpp"
#include "CSwooshDescription.hpp"
#include "CElectricDescription.hpp"
#include "CParticleDataFactory.hpp"
#include "CModel.hpp"
#include "CSimplePool.hpp" #include "CSimplePool.hpp"
#include "CRandom16.hpp"
namespace pshag namespace pshag
{ {
std::unique_ptr<IObj> FDealDataFactory(const SObjectTag &tag, CInputStream &in, const CVParamTransfer &vparms) static LogVisor::LogModule Log("pshag::CDecalDataFactory");
using CPF = CParticleDataFactory;
CDecalDescription* CDecalDataFactory::GetGeneratorDesc(CInputStream& in, CSimplePool* resPool)
{
return CreateGeneratorDescription(in, resPool);
}
CDecalDescription* CDecalDataFactory::CreateGeneratorDescription(CInputStream& in, CSimplePool* resPool)
{
FourCC clsId = CPF::GetClassID(in);
if (clsId == FOURCC('DPSM'))
{
CDecalDescription* desc = new CDecalDescription;
if (CreateDPSM(desc, in, resPool))
return desc;
else
delete desc;
}
return nullptr;
}
bool CDecalDataFactory::CreateDPSM(CDecalDescription* desc, CInputStream& in, CSimplePool* resPool)
{
CRandom16 rand{99};
CGlobalRandom gr{rand};
FourCC clsId = CPF::GetClassID(in);
while (clsId != SBIG('_END'))
{
bool loadFirstDesc = false;
switch (clsId)
{
case SBIG('1SZE'):
case SBIG('1LFT'):
case SBIG('1ROT'):
case SBIG('1OFF'):
case SBIG('1CLR'):
case SBIG('1TEX'):
case SBIG('1ADD'):
loadFirstDesc = true;
case SBIG('2LFT'):
case SBIG('2SZE'):
case SBIG('2ROT'):
case SBIG('2OFF'):
case SBIG('2CLR'):
case SBIG('2TEX'):
case SBIG('2ADD'):
if (loadFirstDesc)
GetQuadDecalInfo(in, resPool, clsId, desc->x0_Quad);
else
GetQuadDecalInfo(in, resPool, clsId, desc->x1c_Quad);
break;
case SBIG('DMDL'):
desc->x38_DMDL = CPF::GetModel(in, resPool);
break;
case SBIG('DFLT'):
desc->x48_DFLT.reset(CPF::GetIntElement(in));
break;
case SBIG('DMOP'):
desc->x4c_DMOP.reset(CPF::GetVectorElement(in));
break;
case SBIG('DMRT'):
desc->x50_DMRT.reset(CPF::GetVectorElement(in));
break;
case SBIG('DMSC'):
desc->x54_DMSC.reset(CPF::GetVectorElement(in));
break;
case SBIG('DMCL'):
desc->x58_DMCL.reset(CPF::GetColorElement(in));
break;
case SBIG('DMAB'):
desc->x5c_24_DMAB = CPF::GetBool(in);
break;
case SBIG('DMOO'):
desc->x5c_25_DMOO = CPF::GetBool(in);
break;
default:
{
uint32_t clsName = clsId.toUint32();
Log.report(LogVisor::FatalError, "Unknown DPSC class %.4s @%" PRIi64, &clsName, in.position());
return false;
}
}
clsId = CPF::GetClassID(in);
}
return true;
}
void CDecalDataFactory::GetQuadDecalInfo(CInputStream& in, CSimplePool* resPool, FourCC clsId, SQuadDescr& quad)
{
switch (clsId)
{
case SBIG('1LFT'):
case SBIG('2LFT'):
quad.x0_LFT.reset(CPF::GetIntElement(in));
break;
case SBIG('1SZE'):
case SBIG('2SZE'):
quad.x4_SZE.reset(CPF::GetRealElement(in));
break;
case SBIG('1ROT'):
case SBIG('2ROT'):
quad.x8_ROT.reset(CPF::GetRealElement(in));
break;
case SBIG('1OFF'):
case SBIG('2OFF'):
quad.xc_OFF.reset(CPF::GetVectorElement(in));
break;
case SBIG('1CLR'):
case SBIG('2CLR'):
quad.x10_CLR.reset(CPF::GetColorElement(in));
break;
case SBIG('1TEX'):
case SBIG('2TEX'):
quad.x14_TEX.reset(CPF::GetTextureElement(in, resPool));
break;
case SBIG('1ADD'):
case SBIG('2ADD'):
quad.x18_ADD = CPF::GetBool(in);
break;
}
}
std::unique_ptr<IObj> FDecalDataFactory(const SObjectTag &tag, CInputStream &in, const CVParamTransfer &vparms)
{ {
CSimplePool* sp = static_cast<CSimplePool*>(static_cast<TObjOwnerParam<IObjectStore*>*>(vparms.GetObj())->GetParam()); CSimplePool* sp = static_cast<CSimplePool*>(static_cast<TObjOwnerParam<IObjectStore*>*>(vparms.GetObj())->GetParam());
return TToken<CDecalDescription>::GetIObjObjectFor(std::unique_ptr<CDecalDescription>(CDecalDataFactory::GetGeneratorDesc(in, sp))); return TToken<CDecalDescription>::GetIObjObjectFor(std::unique_ptr<CDecalDescription>(CDecalDataFactory::GetGeneratorDesc(in, sp)));
} }
} }

View File

@ -9,17 +9,19 @@
namespace pshag namespace pshag
{ {
struct SQuadDescr;
class CDecalDescription; class CDecalDescription;
class CSimplePool; class CSimplePool;
class CDecalDataFactory class CDecalDataFactory
{ {
static bool CreateDPSM(CDecalDescription* desc,CInputStream& in,CSimplePool* resPool);
static CDecalDescription* CreateGeneratorDescription(CInputStream& in, CSimplePool* resPool);
static void GetQuadDecalInfo(CInputStream& in, CSimplePool* resPool, FourCC clsId, SQuadDescr& quad);
public: public:
static CDecalDescription* GetGeneratorDesc(CInputStream& in,CSimplePool* resPool); static CDecalDescription* GetGeneratorDesc(CInputStream& in,CSimplePool* resPool);
static CDecalDescription* CreateGeneratorDescription(CInputStream& in, CSimplePool* resPool);
static bool CreateDPSM(CDecalDescription* desc,CInputStream& in,CSimplePool* resPool);
}; };
std::unique_ptr<IObj> FDealDataFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms); std::unique_ptr<IObj> FDecalDataFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms);
} }
#endif // __PSHAG_CDECALDATAFACTORY_HPP__ #endif // __PSHAG_CDECALDATAFACTORY_HPP__

View File

@ -1,10 +1,42 @@
#ifndef __PSHAG_CDECALDESCRIPTION_HPP__ #ifndef __PSHAG_CDECALDESCRIPTION_HPP__
#define __PSHAG_CDECALDESCRIPTION_HPP__ #define __PSHAG_CDECALDESCRIPTION_HPP__
#include "CRealElement.hpp"
#include "CIntElement.hpp"
#include "CVectorElement.hpp"
#include "CColorElement.hpp"
#include "CUVElement.hpp"
#include "CParticleDataFactory.hpp"
namespace pshag namespace pshag
{ {
struct SQuadDescr
{
std::unique_ptr<CIntElement> x0_LFT;
std::unique_ptr<CRealElement> x4_SZE;
std::unique_ptr<CRealElement> x8_ROT;
std::unique_ptr<CVectorElement> xc_OFF;
std::unique_ptr<CColorElement> x10_CLR;
std::unique_ptr<CUVElement> x14_TEX;
bool x18_ADD = false;
};
class CDecalDescription class CDecalDescription
{ {
public:
SQuadDescr x0_Quad;
SQuadDescr x1c_Quad;
SParticleModel x38_DMDL;
std::unique_ptr<CIntElement> x48_DFLT;
std::unique_ptr<CVectorElement> x4c_DMOP;
std::unique_ptr<CVectorElement> x50_DMRT;
std::unique_ptr<CVectorElement> x54_DMSC;
std::unique_ptr<CColorElement> x58_DMCL;
union
{
struct { bool x5c_24_DMAB : 1; bool x5c_25_DMOO : 1;};
u8 dummy = 0;
};
}; };
} }

View File

@ -185,10 +185,16 @@ void CElementGenShaders::Initialize()
case boo::IGraphicsDataFactory::Platform::D3D12: case boo::IGraphicsDataFactory::Platform::D3D12:
m_bindFactory.reset(Initialize(*static_cast<boo::ID3DDataFactory*>(CGraphics::g_BooFactory))); m_bindFactory.reset(Initialize(*static_cast<boo::ID3DDataFactory*>(CGraphics::g_BooFactory)));
break; break;
#elif BOO_HAS_METAL #endif
#if BOO_HAS_METAL
case boo::IGraphicsDataFactory::Platform::Metal: case boo::IGraphicsDataFactory::Platform::Metal:
m_bindFactory.reset(Initialize(*static_cast<boo::MetalDataFactory*>(CGraphics::g_BooFactory))); m_bindFactory.reset(Initialize(*static_cast<boo::MetalDataFactory*>(CGraphics::g_BooFactory)));
break; break;
#endif
#if BOO_HAS_VULKAN
case boo::IGraphicsDataFactory::Platform::Vulkan:
m_bindFactory.reset(Initialize(*static_cast<boo::VulkanDataFactory*>(CGraphics::g_BooFactory)));
break;
#endif #endif
default: break; default: break;
} }
@ -1706,11 +1712,11 @@ void CElementGen::RenderParticles()
{ {
case CElementGenShaders::EShaderClass::Tex: case CElementGenShaders::EShaderClass::Tex:
m_instBuf->load(g_instTexData.data(), g_instTexData.size() * sizeof(SParticleInstanceTex)); m_instBuf->load(g_instTexData.data(), g_instTexData.size() * sizeof(SParticleInstanceTex));
CGraphics::DrawInstances(boo::Primitive::TriStrips, 0, 4, g_instTexData.size()); CGraphics::DrawInstances(0, 4, g_instTexData.size());
break; break;
case CElementGenShaders::EShaderClass::NoTex: case CElementGenShaders::EShaderClass::NoTex:
m_instBuf->load(g_instNoTexData.data(), g_instNoTexData.size() * sizeof(SParticleInstanceNoTex)); m_instBuf->load(g_instNoTexData.data(), g_instNoTexData.size() * sizeof(SParticleInstanceNoTex));
CGraphics::DrawInstances(boo::Primitive::TriStrips, 0, 4, g_instNoTexData.size()); CGraphics::DrawInstances(0, 4, g_instNoTexData.size());
break; break;
default: break; default: break;
} }
@ -1845,11 +1851,11 @@ void CElementGen::RenderParticles()
{ {
case CElementGenShaders::EShaderClass::Tex: case CElementGenShaders::EShaderClass::Tex:
m_instBuf->load(g_instTexData.data(), g_instTexData.size() * sizeof(SParticleInstanceTex)); m_instBuf->load(g_instTexData.data(), g_instTexData.size() * sizeof(SParticleInstanceTex));
CGraphics::DrawInstances(boo::Primitive::TriStrips, 0, 4, g_instTexData.size()); CGraphics::DrawInstances(0, 4, g_instTexData.size());
break; break;
case CElementGenShaders::EShaderClass::NoTex: case CElementGenShaders::EShaderClass::NoTex:
m_instBuf->load(g_instNoTexData.data(), g_instNoTexData.size() * sizeof(SParticleInstanceNoTex)); m_instBuf->load(g_instNoTexData.data(), g_instNoTexData.size() * sizeof(SParticleInstanceNoTex));
CGraphics::DrawInstances(boo::Primitive::TriStrips, 0, 4, g_instNoTexData.size()); CGraphics::DrawInstances(0, 4, g_instNoTexData.size());
break; break;
default: break; default: break;
} }

View File

@ -5,6 +5,7 @@
#include "boo/graphicsdev/GL.hpp" #include "boo/graphicsdev/GL.hpp"
#include "boo/graphicsdev/D3D.hpp" #include "boo/graphicsdev/D3D.hpp"
#include "boo/graphicsdev/Metal.hpp" #include "boo/graphicsdev/Metal.hpp"
#include "boo/graphicsdev/Vulkan.hpp"
namespace pshag namespace pshag
{ {
@ -63,9 +64,13 @@ public:
static IDataBindingFactory* Initialize(boo::GLDataFactory& factory); static IDataBindingFactory* Initialize(boo::GLDataFactory& factory);
#if _WIN32 #if _WIN32
static IDataBindingFactory* Initialize(boo::ID3DDataFactory& factory); static IDataBindingFactory* Initialize(boo::ID3DDataFactory& factory);
#elif BOO_HAS_METAL #endif
#if BOO_HAS_METAL
static IDataBindingFactory* Initialize(boo::MetalDataFactory& factory); static IDataBindingFactory* Initialize(boo::MetalDataFactory& factory);
#endif #endif
#if BOO_HAS_VULKAN
static IDataBindingFactory* Initialize(boo::VulkanDataFactory& factory);
#endif
static void Initialize(); static void Initialize();
static void Shutdown(); static void Shutdown();

View File

@ -10,11 +10,12 @@ namespace pshag
static const char* VS_GLSL_TEX = static const char* VS_GLSL_TEX =
"#version 330\n" "#version 330\n"
BOO_GLSL_BINDING_HEAD
"layout(location=0) in vec4 posIn[4];\n" "layout(location=0) in vec4 posIn[4];\n"
"layout(location=4) in vec4 colorIn;\n" "layout(location=4) in vec4 colorIn;\n"
"layout(location=5) in vec4 uvsIn[4];\n" "layout(location=5) in vec4 uvsIn[4];\n"
"\n" "\n"
"uniform ParticleUniform\n" "UBINDING0 uniform ParticleUniform\n"
"{\n" "{\n"
" mat4 mvp;\n" " mat4 mvp;\n"
" vec4 moduColor;\n" " vec4 moduColor;\n"
@ -36,6 +37,7 @@ static const char* VS_GLSL_TEX =
static const char* FS_GLSL_TEX = static const char* FS_GLSL_TEX =
"#version 330\n" "#version 330\n"
BOO_GLSL_BINDING_HEAD
"struct VertToFrag\n" "struct VertToFrag\n"
"{\n" "{\n"
" vec4 color;\n" " vec4 color;\n"
@ -44,7 +46,7 @@ static const char* FS_GLSL_TEX =
"\n" "\n"
"in VertToFrag vtf;\n" "in VertToFrag vtf;\n"
"layout(location=0) out vec4 colorOut;\n" "layout(location=0) out vec4 colorOut;\n"
"uniform sampler2D texs[1];\n" "TBINDING0 uniform sampler2D texs[1];\n"
"void main()\n" "void main()\n"
"{\n" "{\n"
" colorOut = vtf.color * texture(texs[0], vtf.uv);\n" " colorOut = vtf.color * texture(texs[0], vtf.uv);\n"
@ -52,6 +54,7 @@ static const char* FS_GLSL_TEX =
static const char* FS_GLSL_TEX_REDTOALPHA = static const char* FS_GLSL_TEX_REDTOALPHA =
"#version 330\n" "#version 330\n"
BOO_GLSL_BINDING_HEAD
"struct VertToFrag\n" "struct VertToFrag\n"
"{\n" "{\n"
" vec4 color;\n" " vec4 color;\n"
@ -60,7 +63,7 @@ static const char* FS_GLSL_TEX_REDTOALPHA =
"\n" "\n"
"in VertToFrag vtf;\n" "in VertToFrag vtf;\n"
"layout(location=0) out vec4 colorOut;\n" "layout(location=0) out vec4 colorOut;\n"
"uniform sampler2D texs[1];\n" "TBINDING0 uniform sampler2D texs[1];\n"
"void main()\n" "void main()\n"
"{\n" "{\n"
" colorOut = vtf.color * texture(texs[0], vtf.uv);\n" " colorOut = vtf.color * texture(texs[0], vtf.uv);\n"
@ -69,12 +72,13 @@ static const char* FS_GLSL_TEX_REDTOALPHA =
static const char* VS_GLSL_INDTEX = static const char* VS_GLSL_INDTEX =
"#version 330\n" "#version 330\n"
BOO_GLSL_BINDING_HEAD
"layout(location=0) in vec4 posIn[4];\n" "layout(location=0) in vec4 posIn[4];\n"
"layout(location=4) in vec4 colorIn;\n" "layout(location=4) in vec4 colorIn;\n"
"layout(location=5) in vec4 uvsInTexrTind[4];\n" "layout(location=5) in vec4 uvsInTexrTind[4];\n"
"layout(location=9) in vec2 uvsInScene[4];\n" "layout(location=9) in vec2 uvsInScene[4];\n"
"\n" "\n"
"uniform ParticleUniform\n" "UBINDING0 uniform ParticleUniform\n"
"{\n" "{\n"
" mat4 mvp;\n" " mat4 mvp;\n"
" vec4 moduColor;\n" " vec4 moduColor;\n"
@ -100,6 +104,7 @@ static const char* VS_GLSL_INDTEX =
static const char* FS_GLSL_INDTEX = static const char* FS_GLSL_INDTEX =
"#version 330\n" "#version 330\n"
BOO_GLSL_BINDING_HEAD
"struct VertToFrag\n" "struct VertToFrag\n"
"{\n" "{\n"
" vec4 color;\n" " vec4 color;\n"
@ -110,7 +115,7 @@ static const char* FS_GLSL_INDTEX =
"\n" "\n"
"in VertToFrag vtf;\n" "in VertToFrag vtf;\n"
"layout(location=0) out vec4 colorOut;\n" "layout(location=0) out vec4 colorOut;\n"
"uniform sampler2D texs[3];\n" "TBINDING0 uniform sampler2D texs[3];\n"
"void main()\n" "void main()\n"
"{\n" "{\n"
" vec2 tindTexel = texture(texs[2], vtf.uvTind).ba;\n" " vec2 tindTexel = texture(texs[2], vtf.uvTind).ba;\n"
@ -122,6 +127,7 @@ static const char* FS_GLSL_INDTEX =
static const char* FS_GLSL_CINDTEX = static const char* FS_GLSL_CINDTEX =
"#version 330\n" "#version 330\n"
BOO_GLSL_BINDING_HEAD
"struct VertToFrag\n" "struct VertToFrag\n"
"{\n" "{\n"
" vec4 color;\n" " vec4 color;\n"
@ -132,7 +138,7 @@ static const char* FS_GLSL_CINDTEX =
"\n" "\n"
"in VertToFrag vtf;\n" "in VertToFrag vtf;\n"
"layout(location=0) out vec4 colorOut;\n" "layout(location=0) out vec4 colorOut;\n"
"uniform sampler2D texs[3];\n" "TBINDING0 uniform sampler2D texs[3];\n"
"void main()\n" "void main()\n"
"{\n" "{\n"
" vec2 tindTexel = texture(texs[2], vtf.uvTind).ba;\n" " vec2 tindTexel = texture(texs[2], vtf.uvTind).ba;\n"
@ -142,10 +148,11 @@ static const char* FS_GLSL_CINDTEX =
static const char* VS_GLSL_NOTEX = static const char* VS_GLSL_NOTEX =
"#version 330\n" "#version 330\n"
BOO_GLSL_BINDING_HEAD
"layout(location=0) in vec4 posIn[4];\n" "layout(location=0) in vec4 posIn[4];\n"
"layout(location=4) in vec4 colorIn;\n" "layout(location=4) in vec4 colorIn;\n"
"\n" "\n"
"uniform ParticleUniform\n" "UBINDING0 uniform ParticleUniform\n"
"{\n" "{\n"
" mat4 mvp;\n" " mat4 mvp;\n"
" vec4 moduColor;\n" " vec4 moduColor;\n"
@ -177,7 +184,7 @@ static const char* FS_GLSL_NOTEX =
" colorOut = vtf.color;\n" " colorOut = vtf.color;\n"
"}\n"; "}\n";
struct GLSLElementDataBindingFactory : CElementGenShaders::IDataBindingFactory struct OGLElementDataBindingFactory : CElementGenShaders::IDataBindingFactory
{ {
void BuildShaderDataBinding(CElementGen& gen, void BuildShaderDataBinding(CElementGen& gen,
boo::IShaderPipeline* regPipeline, boo::IShaderPipeline* regPipeline,
@ -333,7 +340,161 @@ CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::GLD
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
false, false, false); false, false, false);
return new struct GLSLElementDataBindingFactory; return new struct OGLElementDataBindingFactory;
} }
#if BOO_HAS_VULKAN
struct VulkanElementDataBindingFactory : CElementGenShaders::IDataBindingFactory
{
void BuildShaderDataBinding(CElementGen& gen,
boo::IShaderPipeline* regPipeline,
boo::IShaderPipeline* redToAlphaPipeline)
{
CGenDescription* desc = gen.GetDesc();
CUVElement* texr = desc->x54_TEXR.get();
CUVElement* tind = desc->x58_TIND.get();
int texCount = 0;
boo::ITexture* textures[3];
if (texr)
{
textures[0] = texr->GetValueTexture(0).GetObj()->GetBooTexture();
texCount = 1;
if (tind)
{
textures[1] = CGraphics::g_SpareTexture;
textures[2] = tind->GetValueTexture(0).GetObj()->GetBooTexture();
texCount = 3;
}
}
boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBuf};
if (regPipeline)
gen.m_normalDataBind = CGraphics::g_BooFactory->newShaderDataBinding(regPipeline, nullptr, nullptr,
gen.m_instBuf, nullptr, 1, uniforms,
texCount, textures);
if (redToAlphaPipeline)
gen.m_redToAlphaDataBind = CGraphics::g_BooFactory->newShaderDataBinding(redToAlphaPipeline, nullptr, nullptr,
gen.m_instBuf, nullptr, 1, uniforms,
texCount, textures);
}
};
CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::VulkanDataFactory& factory)
{
static const boo::VertexElementDescriptor TexFmtTex[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
{nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced},
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0},
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1},
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3}
};
m_vtxFormatTex = factory.newVertexFormat(9, TexFmtTex);
static const boo::VertexElementDescriptor TexFmtIndTex[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
{nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced},
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0},
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1},
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3},
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 4},
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 5},
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 6},
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 7}
};
m_vtxFormatIndTex = CGraphics::g_BooFactory->newVertexFormat(13, TexFmtIndTex);
static const boo::VertexElementDescriptor TexFmtNoTex[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
{nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced}
};
m_vtxFormatNoTex = CGraphics::g_BooFactory->newVertexFormat(5, TexFmtNoTex);
m_texZTestZWrite = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
true, true, false);
m_texNoZTestZWrite = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
false, true, false);
m_texZTestNoZWrite = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
true, false, false);
m_texNoZTestNoZWrite = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
false, false, false);
m_texAdditiveZTest = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
true, false, false);
m_texAdditiveNoZTest = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
false, false, false);
m_texRedToAlphaZTest = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX_REDTOALPHA, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
true, false, false);
m_texRedToAlphaNoZTest = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX_REDTOALPHA, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
false, false, false);
m_indTexZWrite = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
true, true, false);
m_indTexNoZWrite = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
true, false, false);
m_indTexAdditive = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
true, true, false);
m_cindTexZWrite = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
true, true, false);
m_cindTexNoZWrite = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
true, false, false);
m_cindTexAdditive = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
true, true, false);
m_noTexZTestZWrite = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
true, true, false);
m_noTexNoZTestZWrite = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
false, true, false);
m_noTexZTestNoZWrite = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
true, false, false);
m_noTexNoZTestNoZWrite = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
false, false, false);
m_noTexAdditiveZTest = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
true, false, false);
m_noTexAdditiveNoZTest = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
false, false, false);
return new struct VulkanElementDataBindingFactory;
}
#endif
} }

View File

@ -132,7 +132,7 @@ void CParticleElectricDataFactory::LoadELSMTokens(CElectricDescription* desc)
desc->x60_EPSM.m_gen = desc->x60_EPSM.m_token.GetObj(); desc->x60_EPSM.m_gen = desc->x60_EPSM.m_token.GetObj();
} }
std::unique_ptr<pshag::IObj> FParticleElecrticFactory(const pshag::SObjectTag &tag, pshag::CInputStream &in, const pshag::CVParamTransfer &vparms) std::unique_ptr<IObj> FParticleElectricDataFactory(const SObjectTag &tag, CInputStream &in, const CVParamTransfer &vparms)
{ {
CSimplePool* sp = static_cast<CSimplePool*>(static_cast<TObjOwnerParam<IObjectStore*>*>(vparms.GetObj())->GetParam()); CSimplePool* sp = static_cast<CSimplePool*>(static_cast<TObjOwnerParam<IObjectStore*>*>(vparms.GetObj())->GetParam());
return TToken<CElectricDescription>::GetIObjObjectFor(std::unique_ptr<CElectricDescription>(CParticleElectricDataFactory::GetGeneratorDesc(in, sp))); return TToken<CElectricDescription>::GetIObjObjectFor(std::unique_ptr<CElectricDescription>(CParticleElectricDataFactory::GetGeneratorDesc(in, sp)));

View File

@ -23,8 +23,10 @@ CSwooshDescription*CParticleSwooshDataFactory::CreateGeneratorDescription(CInput
if (clsId == FOURCC('SWSH')) if (clsId == FOURCC('SWSH'))
{ {
CSwooshDescription* desc = new CSwooshDescription; CSwooshDescription* desc = new CSwooshDescription;
CreateWPSM(desc, in, resPool); if (CreateWPSM(desc, in, resPool))
return desc; return desc;
else
delete desc;
} }
return nullptr; return nullptr;
} }

View File

@ -78,6 +78,9 @@ bool CProjectileWeaponDataFactory::CreateWPSM(CWeaponDescription* desc, CInputSt
desc->x2a_AP11 = CPF::GetBool(in); desc->x2a_AP11 = CPF::GetBool(in);
break; break;
case SBIG('AP21'): case SBIG('AP21'):
desc->x2b_AP21 = CPF::GetBool(in);
break;
case SBIG('AS11'):
desc->x2c_AS11 = CPF::GetBool(in); desc->x2c_AS11 = CPF::GetBool(in);
break; break;
case SBIG('AS12'): case SBIG('AS12'):

View File

@ -12,7 +12,7 @@ namespace pshag
{ {
using FourCC = HECL::FourCC; using FourCC = HECL::FourCC;
using TResId = u32; using TResId = u64;
struct SObjectTag struct SObjectTag
{ {

2
hecl

@ -1 +1 @@
Subproject commit 92604d9ce5c32aa9a7c58603683b43f2064850b5 Subproject commit 47e72384415a5062cc0358512a272fc939aa1514

@ -1 +1 @@
Subproject commit 38b3396e0853e9bf446859a9d8b042044d9fd78e Subproject commit bb78a20553ea665c0ec301404dce0c6753b8eb09