Merge branch 'master' of ssh+git://git.axiodl.com:6431/AxioDL/urde

This commit is contained in:
Phillip Stephens 2020-06-03 04:12:11 -07:00
commit 86942c44ef
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
7 changed files with 60 additions and 41 deletions

View File

@ -173,7 +173,7 @@ else()
-Wno-unused-variable -Wno-unused-result -Wno-unused-variable -Wno-unused-result
-Wno-unused-function -Wno-sign-compare -Wno-unknown-pragmas -Werror) -Wno-unused-function -Wno-sign-compare -Wno-unknown-pragmas -Werror)
# doesn't work with generator expression in add_compile_options? # doesn't work with generator expression in add_compile_options?
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
add_compile_options(-Wno-unknown-warning-option -Wno-unused-private-field) add_compile_options(-Wno-unknown-warning-option -Wno-unused-private-field)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-Wno-lto-type-mismatch) add_compile_options(-Wno-lto-type-mismatch)

View File

@ -1844,6 +1844,12 @@ CFrontEndUI::CFrontEndUI() : CIOWin("FrontEndUI") {
m_touchBar->SetPhase(CFrontEndUITouchBar::EPhase::None); m_touchBar->SetPhase(CFrontEndUITouchBar::EPhase::None);
} }
CFrontEndUI::~CFrontEndUI() {
if (x14_phase >= EPhase::DisplayFrontEnd) {
CAudioSys::RemoveAudioGroup(x44_frontendAudioGrp->GetAudioGroupData());
}
}
void CFrontEndUI::StartSlideShow(CArchitectureQueue& queue) { void CFrontEndUI::StartSlideShow(CArchitectureQueue& queue) {
xf4_curAudio->StopMixing(); xf4_curAudio->StopMixing();
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, std::make_shared<CSlideShow>())); queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, std::make_shared<CSlideShow>()));

View File

@ -371,6 +371,7 @@ private:
public: public:
CFrontEndUI(); CFrontEndUI();
~CFrontEndUI();
void StartSlideShow(CArchitectureQueue& queue); void StartSlideShow(CArchitectureQueue& queue);
std::string GetAttractMovieFileName(int idx); std::string GetAttractMovieFileName(int idx);
std::string GetNextAttractMovieFileName(); std::string GetNextAttractMovieFileName();

View File

@ -120,10 +120,11 @@ void COmegaPirate::CFlash::Render(CStateManager& mgr) {
COmegaPirate::COmegaPirate(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, COmegaPirate::COmegaPirate(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms, CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms,
CElitePirateData data, CAssetId w1, CAssetId w2, CAssetId w3) CElitePirateData data, CAssetId skeletonModelId, CAssetId skeletonSkinRulesId,
CAssetId skeletonLayoutInfoId)
: CElitePirate(uid, name, info, xf, std::move(mData), pInfo, actParms, data) : CElitePirate(uid, name, info, xf, std::move(mData), pInfo, actParms, data)
, x9d0_initialScale(GetModelData()->GetScale()) , x9d0_initialScale(GetModelData()->GetScale())
, x9f0_skeletonModel(*g_SimplePool, w1, w2, w3, 0, 0) , x9f0_skeletonModel(*g_SimplePool, skeletonModelId, skeletonSkinRulesId, skeletonLayoutInfoId, 0, 0)
, xb70_thermalSpot(g_SimplePool->GetObj("Thermal_Spot_2"sv)) { , xb70_thermalSpot(g_SimplePool->GetObj("Thermal_Spot_2"sv)) {
x9a4_scriptWaypointPlatforms.reserve(3); x9a4_scriptWaypointPlatforms.reserve(3);
x9b8_scriptEffects.reserve(24); x9b8_scriptEffects.reserve(24);

View File

@ -122,7 +122,7 @@ private:
public: public:
COmegaPirate(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, COmegaPirate(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms, CElitePirateData data, CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms, CElitePirateData data,
CAssetId w1, CAssetId w2, CAssetId w3); CAssetId skeletonModelId, CAssetId skeletonSkinRulesId, CAssetId skeletonLayoutInfoId);
void Think(float dt, CStateManager& mgr) override; void Think(float dt, CStateManager& mgr) override;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override; void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;

View File

@ -3659,11 +3659,14 @@ CEntity* ScriptLoader::LoadOmegaPirate(CStateManager& mgr, CInputStream& in, int
return nullptr; return nullptr;
} }
const CAssetId skeletonModelId{in};
const CAssetId skeletonSkinRulesId{in};
const CAssetId skeletonLayoutInfoId{in};
CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(), CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(),
actHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true)); actHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::COmegaPirate(mgr.AllocateUniqueId(), actHead.x0_name, info, actHead.x10_transform, std::move(mData), return new MP1::COmegaPirate(mgr.AllocateUniqueId(), actHead.x0_name, info, actHead.x10_transform, std::move(mData),
pInfo, actParms, elitePirateData, CAssetId(in), CAssetId(in), CAssetId(in)); pInfo, actParms, elitePirateData, skeletonModelId, skeletonSkinRulesId,
skeletonLayoutInfoId);
} }
CEntity* ScriptLoader::LoadPhazonPool(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { CEntity* ScriptLoader::LoadPhazonPool(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {

View File

@ -1,8 +1,10 @@
#include <iostream>
#include <cstdint> #include <cstdint>
#include <iostream>
#include <memory>
#include <vector> #include <vector>
#include <logvisor/logvisor.hpp>
#include "tinyxml2/tinyxml2.h" #include "tinyxml2/tinyxml2.h"
#include "logvisor/logvisor.hpp"
#ifndef _WIN32 #ifndef _WIN32
#include <cstdlib> #include <cstdlib>
@ -30,7 +32,9 @@
#endif #endif
#endif #endif
static logvisor::Module Log("AssetNameParser"); namespace {
logvisor::Module Log("AssetNameParser");
// TODO: Clean this up // TODO: Clean this up
#undef bswap16 #undef bswap16
#undef bswap32 #undef bswap32
@ -133,45 +137,54 @@ struct SAsset {
enum class FileLockType { None = 0, Read, Write }; enum class FileLockType { None = 0, Read, Write };
#if IS_UCS2 #if IS_UCS2
typedef wchar_t SystemChar; using SystemChar = wchar_t;
typedef std::wstring SystemString; using SystemString = std::wstring;
#ifndef _SYS_STR #ifndef _SYS_STR
#define _SYS_STR(val) L##val #define _SYS_STR(val) L##val
#endif #endif
typedef struct _stat Sstat; using Sstat = struct _stat;
#else #else
typedef char SystemChar; using SystemChar = char;
typedef std::string SystemString; using SystemString = std::string;
#ifndef _SYS_STR #ifndef _SYS_STR
#define _SYS_STR(val) val #define _SYS_STR(val) val
#endif #endif
typedef struct stat Sstat; using Sstat = struct stat;
#endif #endif
static FILE* Fopen(const SystemChar* path, const SystemChar* mode, FileLockType lock = FileLockType::None) { struct FILEDeleter {
void operator()(FILE* file) const { std::fclose(file); }
};
using FILEPtr = std::unique_ptr<FILE, FILEDeleter>;
FILEPtr Fopen(const SystemChar* path, const SystemChar* mode, FileLockType lock = FileLockType::None) {
#if IS_UCS2 #if IS_UCS2
FILE* fp = _wfopen(path, mode); FILEPtr fp{_wfopen(path, mode)};
if (!fp) if (!fp) {
return nullptr; return nullptr;
}
#else #else
FILE* fp = fopen(path, mode); FILEPtr fp{std::fopen(path, mode)};
if (!fp) if (!fp) {
return nullptr; return nullptr;
}
#endif #endif
if (lock != FileLockType::None) { if (lock != FileLockType::None) {
#if _WIN32 #if _WIN32
OVERLAPPED ov = {}; OVERLAPPED ov = {};
LockFileEx((HANDLE)(uintptr_t)_fileno(fp), (lock == FileLockType::Write) ? LOCKFILE_EXCLUSIVE_LOCK : 0, 0, 0, 1, LockFileEx((HANDLE)(uintptr_t)_fileno(fp.get()), (lock == FileLockType::Write) ? LOCKFILE_EXCLUSIVE_LOCK : 0, 0, 0,
&ov); 1, &ov);
#else #else
if (flock(fileno(fp), ((lock == FileLockType::Write) ? LOCK_EX : LOCK_SH) | LOCK_NB)) if (flock(fileno(fp.get()), ((lock == FileLockType::Write) ? LOCK_EX : LOCK_SH) | LOCK_NB)) {
fprintf(stderr, "flock %s: %s", path, strerror(errno)); std::fprintf(stderr, "flock %s: %s", path, strerror(errno));
}
#endif #endif
} }
return fp; return fp;
} }
} // Anonymous namespace
#if _WIN32 #if _WIN32
int wmain(int argc, const wchar_t* argv[]) int wmain(int argc, const wchar_t* argv[])
@ -191,8 +204,8 @@ int main(int argc, const char* argv[])
tinyxml2::XMLDocument doc; tinyxml2::XMLDocument doc;
std::vector<SAsset> assets; std::vector<SAsset> assets;
FILE* docF = Fopen(inPath.c_str(), _SYS_STR("rb")); FILEPtr docF = Fopen(inPath.c_str(), _SYS_STR("rb"));
if (doc.LoadFile(docF) == tinyxml2::XML_SUCCESS) { if (doc.LoadFile(docF.get()) == tinyxml2::XML_SUCCESS) {
const tinyxml2::XMLElement* elm = doc.RootElement(); const tinyxml2::XMLElement* elm = doc.RootElement();
if (strcmp(elm->Name(), "AssetNameMap") != 0) { if (strcmp(elm->Name(), "AssetNameMap") != 0) {
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Invalid database supplied"))); Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Invalid database supplied")));
@ -238,7 +251,7 @@ int main(int argc, const char* argv[])
elm = elm->NextSiblingElement("Asset"); elm = elm->NextSiblingElement("Asset");
} }
FILE* f = Fopen(outPath.c_str(), _SYS_STR("wb")); FILEPtr f = Fopen(outPath.c_str(), _SYS_STR("wb"));
if (f == nullptr) { if (f == nullptr) {
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to open destination"))); Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to open destination")));
return 0; return 0;
@ -246,28 +259,23 @@ int main(int argc, const char* argv[])
uint32_t assetCount = SBig(uint32_t(assets.size())); uint32_t assetCount = SBig(uint32_t(assets.size()));
FourCC sentinel(SBIG('AIDM')); FourCC sentinel(SBIG('AIDM'));
fwrite(&sentinel, 1, 4, f); fwrite(&sentinel, sizeof(sentinel), 1, f.get());
fwrite(&assetCount, 1, 4, f); fwrite(&assetCount, sizeof(assetCount), 1, f.get());
for (const SAsset& asset : assets) { for (const SAsset& asset : assets) {
fwrite(&asset.type, 1, 4, f); fwrite(&asset.type, sizeof(asset.type), 1, f.get());
uint64_t id = SBig(asset.id); uint64_t id = SBig(asset.id);
fwrite(&id, 1, 8, f); fwrite(&id, sizeof(id), 1, f.get());
uint32_t tmp = SBig(uint32_t(asset.name.length())); uint32_t tmp = SBig(uint32_t(asset.name.length()));
fwrite(&tmp, 1, 4, f); fwrite(&tmp, sizeof(tmp), 1, f.get());
fwrite(asset.name.c_str(), 1, SBig(tmp), f); fwrite(asset.name.c_str(), 1, SBig(tmp), f.get());
tmp = SBig(uint32_t(asset.dir.length())); tmp = SBig(uint32_t(asset.dir.length()));
fwrite(&tmp, 1, 4, f); fwrite(&tmp, sizeof(tmp), 1, f.get());
fwrite(asset.dir.c_str(), 1, SBig(tmp), f); fwrite(asset.dir.c_str(), SBig(tmp), 1, f.get());
} }
fflush(f); fflush(f.get());
fclose(f);
fclose(docF);
return 0; return 0;
} }
if (docF)
fclose(docF);
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("failed to load"))); Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("failed to load")));
return 1; return 1;
} }