This commit is contained in:
Jack Andersen 2016-12-24 15:36:57 -10:00
commit 8166104b32
24 changed files with 102 additions and 473 deletions

View File

@ -8,10 +8,13 @@ namespace DataSpec
struct ITweakGame : BigYAML
{
virtual const std::string& GetWorldPrefix() const=0;
virtual float GetFirstPersonFOV() const =0;
virtual const std::string& GetWorldPrefix() const = 0;
virtual bool GetSplashScreensDisabled() const = 0;
virtual float GetFirstPersonFOV() const = 0;
virtual float GetPressStartDelay() const = 0;
virtual float GetHardModeDamageMultiplier() const = 0;
virtual float GetHardModeWeaponMultiplier() const = 0;
};
}
#endif

View File

@ -32,6 +32,7 @@
#include "Tweaks/CTweakPlayer.hpp"
#include "Tweaks/CTweakCameraBob.hpp"
#include "Tweaks/CTweakSlideShow.hpp"
#include "Tweaks/CTweakGame.hpp"
namespace DataSpec
{
@ -382,6 +383,8 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
return {ExtractTweak<CTweakCameraBob>, {_S(".yaml")}};
if (!name.compare("SlideShow"))
return {ExtractTweak<CTweakSlideShow>, {_S(".yaml")}};
if (!name.compare("Game"))
return {ExtractTweak<CTweakGame>, {_S(".yaml")}};
}
break;
}

View File

@ -17,9 +17,9 @@ struct CTweakGame : ITweakGame
Value<bool> x28_unknown1;
Value<bool> x29_unknown2;
Value<bool> x2a_unknown3;
Value<bool> x2b_unknown4;
Value<float> x2c_cunknown5;
Value<float> x30_unknown6;
Value<bool> x2b_splashScreensDisabled;
Value<float> x2c_unknown5;
Value<float> x30_presStartDelay;
Value<float> x34_unknown7;
Value<float> x38_unknown8;
Value<float> x3c_unknown9;
@ -31,13 +31,21 @@ struct CTweakGame : ITweakGame
Value<float> x54_unknown15;
Value<float> x58_unknown16;
Value<float> x5c_unknown17;
Value<float> x60_unknown18;
Value<float> x64_hardmodeDamageMult;
Value<float> x68_hardmodeWeaponMult;
Value<float> x60_hardmodeDamageMult;
Value<float> x64_hardmodeWeaponMult;
virtual const std::string& GetWorldPrefix() const { return x4_worldPrefix; }
virtual bool GetSplashScreensDisabled() const { return x2b_splashScreensDisabled; }
virtual float GetFirstPersonFOV() const { return x24_fov; }
CTweakGame(athena::io::IStreamReader& in) { this->read(in); x2b_unknown4 = false; }
virtual float GetPressStartDelay() const { return x30_presStartDelay; }
virtual float GetHardModeDamageMultiplier() const { return x60_hardmodeDamageMult; }
virtual float GetHardModeWeaponMultiplier() const { return x64_hardmodeWeaponMult; }
CTweakGame() = default;
CTweakGame(athena::io::IStreamReader& in)
{
this->read(in);
x2b_splashScreensDisabled = false;
}
};
}
}

View File

@ -407,8 +407,8 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
x274_ = __dna_reader.readFloatBig();
/* x278_ */
x278_ = __dna_reader.readFloatBig();
/* x27c_ */
x27c_ = __dna_reader.readFloatBig();
/* x27c_playerBallHalfExtent */
x27c_playerBallHalfExtent = __dna_reader.readFloatBig();
/* x280_ */
x280_ = __dna_reader.readFloatBig();
/* x284_ */
@ -847,8 +847,8 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeFloatBig(x274_);
/* x278_ */
__dna_writer.writeFloatBig(x278_);
/* x27c_ */
__dna_writer.writeFloatBig(x27c_);
/* x27c_playerBallHalfExtent */
__dna_writer.writeFloatBig(x27c_playerBallHalfExtent);
/* x280_ */
__dna_writer.writeFloatBig(x280_);
/* x284_ */
@ -1362,8 +1362,8 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x274_ = __dna_docin.readFloat("x274_");
/* x278_ */
x278_ = __dna_docin.readFloat("x278_");
/* x27c_ */
x27c_ = __dna_docin.readFloat("x27c_");
/* x27c_playerBallHalfExtent */
x27c_playerBallHalfExtent = __dna_docin.readFloat("x27c_playerBallHalfExtent");
/* x280_ */
x280_ = __dna_docin.readFloat("x280_");
/* x284_ */
@ -1862,8 +1862,8 @@ void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout)
__dna_docout.writeFloat("x274_", x274_);
/* x278_ */
__dna_docout.writeFloat("x278_", x278_);
/* x27c_ */
__dna_docout.writeFloat("x27c_", x27c_);
/* x27c_playerBallHalfExtent */
__dna_docout.writeFloat("x27c_playerBallHalfExtent", x27c_playerBallHalfExtent);
/* x280_ */
__dna_docout.writeFloat("x280_", x280_);
/* x284_ */

View File

@ -138,7 +138,7 @@ struct CTweakPlayer : ITweakPlayer
Value<float> x270_playerXYHalfExtent;
Value<float> x274_;
Value<float> x278_;
Value<float> x27c_;
Value<float> x27c_playerBallHalfExtent;
Value<float> x280_;
Value<float> x284_;
Value<float> x288_;
@ -183,7 +183,7 @@ struct CTweakPlayer : ITweakPlayer
float GetPlayerXYHalfExtent() const { return x270_playerXYHalfExtent; }
float GetX274() const { return x274_; }
float GetX278() const { return x278_; }
float GetX27C() const { return x27c_; }
float GetX27C() const { return x27c_playerBallHalfExtent; }
float GetX124() const { return x134_; }
bool GetX228_24() const { return x228_24_; }
float GetX288() const { return x288_; }

View File

@ -56,7 +56,7 @@ void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
TLockedToken<CTexture> xrayPalette = objStore.GetObj("TXTR_XRayPalette");
m_particleView.reset(new ParticleView(*this, m_viewResources, *m_rootView, xrayPalette));
#if 1
#if 0
m_moviePlayer.reset(new CMoviePlayer("Video/SpecialEnding.thp", 1.f, false, true));
m_moviePlayer->SetFrame({-1.0f, 1.0f, 0.f}, {-1.0f, -1.0f, 0.f}, {1.0f, -1.0f, 0.f}, {1.0f, 1.0f, 0.f});
CDvdFile testRSF("Audio/frontend_1.rsf");

View File

@ -2,7 +2,7 @@
#include "boo/boo.hpp"
#include "specter/specter.hpp"
#include "hecl/CVarManager.hpp"
#include "Runtime/CGameAllocator.hpp"
#include "Runtime/CBasics.hpp"
#include <functional>
#include "ViewManager.hpp"

View File

@ -27,7 +27,7 @@ const u64 CBasics::TICKS_PER_SECOND = 60750000LL;
#ifndef _WIN32
static struct tm* localtime_r(const time_t& time, struct tm& timeSt, long& gmtOff)
{
auto ret = localtime_r(&time, &timeSt);
auto ret = ::localtime_r(&time, &timeSt);
if (!ret)
return nullptr;
gmtOff = ret->tm_gmtoff;

View File

@ -1,20 +0,0 @@
#ifndef __URDE_CCALLSTACK_HPP__
#define __URDE_CCALLSTACK_HPP__
namespace urde
{
class CCallStack
{
const char* x0_fileAndLineStr;
const char* x4_typeStr;
public:
CCallStack(const char* fileAndLineStr, const char* typeStr)
: x0_fileAndLineStr(fileAndLineStr), x4_typeStr(typeStr) {}
const char* GetFileAndLineText() const {return x0_fileAndLineStr;}
const char* GetTypeText() const {return x4_typeStr;}
};
}
#endif // __URDE_CCALLSTACK_HPP__

View File

@ -1,99 +0,0 @@
#include "CGameAllocator.hpp"
namespace urde
{
logvisor::Module AllocLog("CGameAllocator");
CGameAllocator::SGameMemInfo* CGameAllocator::FindFreeBlock(u32)
{
return nullptr;
}
CGameAllocator::SGameMemInfo* CGameAllocator::FindFreeBlockFromTopOfHeap(u32)
{
return nullptr;
}
u32 CGameAllocator::FixupAllocPtrs(SGameMemInfo*, u32, u32, EHint, const CCallStack&)
{
return 0;
}
void CGameAllocator::UpdateAllocDebugStats(u32, u32, u32)
{
}
bool CGameAllocator::FreeNormalAllocation(void*)
{
return false;
}
u32 CGameAllocator::GetFreeBinEntryForSize(u32)
{
return 0;
}
void CGameAllocator::AddFreeEntryToFreeList(SGameMemInfo*)
{
}
void CGameAllocator::RemoveFreeEntryFromFreeList(SGameMemInfo*)
{
}
void CGameAllocator::DumpAllocations() const
{
}
u32 CGameAllocator::GetLargestFreeChunk() const
{
return 0;
}
CGameAllocator::SGameMemInfo* CGameAllocator::GetMemInfoFromBlockPtr(void* ptr)
{
return reinterpret_cast<SGameMemInfo*>(reinterpret_cast<u8*>(ptr) - 32);
}
bool CGameAllocator::Initialize()
{
return false;
}
void CGameAllocator::Shutdown()
{
}
void* CGameAllocator::Alloc(size_t sz, EHint, EScope, EType, const CCallStack&)
{
//AllocLog.report(logvisor::Warning, _S("Remind Phil to reimplement Alloc!!!!"));
return malloc(sz);
}
void CGameAllocator::Free(void* ptr)
{
free(ptr);
}
void CGameAllocator::ReleaseAll()
{
}
void* CGameAllocator::AllocSecondary(size_t sz, EHint, EScope, EType, const CCallStack&)
{
return malloc(sz);
}
void CGameAllocator::FreeSecondary(void*)
{
}
void CGameAllocator::ReleaseAllSecondary()
{
}
void CGameAllocator::SetOutOfMemoryCallback(const TOutOfMemoryCallback cb, void* ctx)
{
x58_oomCb = cb;
x5c_oomCtx = ctx;
}
int CGameAllocator::EnumAllocations(const TAllocationVisitCallback, void*, bool) const
{
return 0;
}
CGameAllocator::SAllocInfo CGameAllocator::GetAllocInfo(void*) const
{
return CGameAllocator::SAllocInfo();
}
void CGameAllocator::OffsetFakeStatics(int)
{
}
CGameAllocator::SMetrics CGameAllocator::GetMetrics() const
{
return CGameAllocator::SMetrics();
}
}

View File

@ -1,51 +0,0 @@
#ifndef __URDE_CGAMEALLOCATOR_HPP__
#define __URDE_CGAMEALLOCATOR_HPP__
#include "IAllocator.hpp"
namespace urde
{
class CCallStack;
class CGameAllocator : public IAllocator
{
public:
struct SGameMemInfo
{
};
private:
SGameMemInfo* x10_rootInfo = nullptr;
TOutOfMemoryCallback x58_oomCb = nullptr;
void* x5c_oomCtx = nullptr;
u32 xbc_fakeStaticOff = 0;
public:
SGameMemInfo* FindFreeBlock(u32);
SGameMemInfo* FindFreeBlockFromTopOfHeap(u32);
u32 FixupAllocPtrs(SGameMemInfo*, u32, u32, EHint, const CCallStack&);
void UpdateAllocDebugStats(u32, u32, u32);
bool FreeNormalAllocation(void*);
u32 GetFreeBinEntryForSize(u32);
void AddFreeEntryToFreeList(SGameMemInfo*);
void RemoveFreeEntryFromFreeList(SGameMemInfo*);
void DumpAllocations() const;
u32 GetLargestFreeChunk() const;
SGameMemInfo* GetMemInfoFromBlockPtr(void* ptr);
bool Initialize();
void Shutdown();
void* Alloc(size_t, EHint, EScope, EType, const CCallStack&);
void Free(void*);
void ReleaseAll();
void* AllocSecondary(size_t, EHint, EScope, EType, const CCallStack&);
void FreeSecondary(void*);
void ReleaseAllSecondary();
void SetOutOfMemoryCallback(const TOutOfMemoryCallback, void*);
int EnumAllocations(const TAllocationVisitCallback, void*, bool) const;
SAllocInfo GetAllocInfo(void*) const;
void OffsetFakeStatics(int);
SMetrics GetMetrics() const;
};
}
#endif // __URDE_CGAMEALLOCATOR_HPP__

View File

@ -286,4 +286,14 @@ CWorldState& CGameState::StateForWorld(ResId mlvlId)
return *it;
}
float CGameState::GetHardModeDamageMultiplier() const
{
return g_tweakGame->GetHardModeDamageMultiplier();
}
float CGameState::GetHardModeWeaponMultiplier() const
{
return g_tweakGame->GetHardModeWeaponMultiplier();
}
}

View File

@ -113,6 +113,8 @@ public:
void WriteBackupBuf();
void SetCardSerial(u64 serial) { x210_cardSerial = serial; }
void PutTo(CBitStreamWriter& writer) const;
float GetHardModeDamageMultiplier() const;
float GetHardModeWeaponMultiplier() const;
struct GameFileStateInfo
{

View File

@ -26,7 +26,7 @@ if(WIN32)
elseif(APPLE)
list(APPEND PLAT_SRCS CMemoryCardSysOSX.cpp)
else()
list(APPEND PLAT_SRCS CMemoryCardSysNix.cpp CCallStackNix.cpp)
list(APPEND PLAT_SRCS CMemoryCardSysNix.cpp)
endif()
add_subdirectory(MP1)
@ -48,14 +48,11 @@ add_library(RuntimeCommon
${PARTICLE_SOURCES}
${WORLD_SOURCES}
${WEAPON_SOURCES}
#CMemory.hpp CMemory.cpp
ITweak.hpp
IMain.hpp
CMemoryCardSys.hpp CMemoryCardSys.cpp
CScannableObjectInfo.hpp CScannableObjectInfo.cpp
CSaveWorld.hpp CSaveWorld.cpp
IAllocator.hpp IAllocator.cpp
CGameAllocator.hpp CGameAllocator.cpp
CDependencyGroup.hpp CDependencyGroup.cpp
CBasics.hpp CBasicsPC.cpp
CIOWin.hpp
@ -91,7 +88,6 @@ add_library(RuntimeCommon
CFactoryMgr.hpp CFactoryMgr.cpp
CPakFile.hpp CPakFile.cpp
CStringExtras.hpp
CCallStack.hpp
IOStreams.hpp IOStreams.cpp
CMainFlowBase.hpp CMainFlowBase.cpp
CMFGameBase.hpp

View File

@ -1,146 +0,0 @@
#if 0
#include "CMemory.hpp"
#include "CGameAllocator.hpp"
#include "CCallStack.hpp"
#include "logvisor/logvisor.hpp"
namespace urde
{
static logvisor::Module Log("CMemory");
static CGameAllocator g_gameAllocator;
static IAllocator* g_memoryAllocator = &g_gameAllocator;
static bool g_memoryAllocatorReady = false;
void CMemory::Startup()
{
g_memoryAllocatorReady = g_memoryAllocator->Initialize();
}
void CMemory::Shutdown()
{
g_memoryAllocator->Shutdown();
g_memoryAllocatorReady = false;
}
void CMemory::SetAllocator(IAllocator& alloc)
{
if (&alloc != g_memoryAllocator)
{
g_memoryAllocator = &alloc;
g_memoryAllocator->Initialize();
}
}
void CMemory::OffsetFakeStatics(int val)
{
g_memoryAllocator->OffsetFakeStatics(val);
}
void CMemory::SetOutOfMemoryCallback(const IAllocator::TOutOfMemoryCallback cb, void* ctx)
{
g_memoryAllocator->SetOutOfMemoryCallback(cb, ctx);
}
void CMemory::Free(void* ptr)
{
g_memoryAllocator->Free(ptr);
}
void* CMemory::Alloc(size_t sz, IAllocator::EHint hint, IAllocator::EScope scope,
IAllocator::EType type, const CCallStack& cs)
{
void* newPtr = g_memoryAllocator->Alloc(sz, hint, scope, type, cs);
if (!newPtr)
Log.report(logvisor::Error, "Alloc Failed! - Size %d", sz);
return newPtr;
}
CMemorySys::CMemorySys(IAllocator& alloc)
{
CMemory::Startup();
CMemory::SetAllocator(alloc);
}
CMemorySys::~CMemorySys()
{
CMemory::Shutdown();
}
IAllocator& CMemorySys::GetGameAllocator() {return g_gameAllocator;}
}
void* operator new(std::size_t sz)
{
if (!urde::g_memoryAllocatorReady)
return malloc(sz);
urde::CCallStack cs("?\?(?\?)", "UnknownType");
return urde::CMemory::Alloc(sz,
urde::IAllocator::EHint::None,
urde::IAllocator::EScope::Default,
urde::IAllocator::EType::Primitive,
cs);
}
void* operator new(std::size_t sz,
const char* funcName, const char* typeName)
{
if (!urde::g_memoryAllocatorReady)
return malloc(sz);
urde::CCallStack cs(funcName, typeName);
return urde::CMemory::Alloc(sz,
urde::IAllocator::EHint::None,
urde::IAllocator::EScope::Default,
urde::IAllocator::EType::Primitive,
cs);
}
void operator delete(void* ptr) noexcept
{
if (!urde::g_memoryAllocatorReady)
{
free(ptr);
return;
}
urde::CMemory::Free(ptr);
}
void* operator new[](std::size_t sz)
{
if (!urde::g_memoryAllocatorReady)
return malloc(sz);
urde::CCallStack cs("?\?(?\?)", "UnknownType");
return urde::CMemory::Alloc(sz,
urde::IAllocator::EHint::None,
urde::IAllocator::EScope::Default,
urde::IAllocator::EType::Array,
cs);
}
void* operator new[](std::size_t sz,
const char* funcName, const char* typeName)
{
if (!urde::g_memoryAllocatorReady)
return malloc(sz);
urde::CCallStack cs(funcName, typeName);
return urde::CMemory::Alloc(sz,
urde::IAllocator::EHint::None,
urde::IAllocator::EScope::Default,
urde::IAllocator::EType::Array,
cs);
}
void operator delete[](void* ptr) noexcept
{
if (!urde::g_memoryAllocatorReady)
{
free(ptr);
return;
}
urde::CMemory::Free(ptr);
}
#endif

View File

@ -1,40 +0,0 @@
#ifndef __URDE_CMEMORY_HPP__
#define __URDE_CMEMORY_HPP__
#if 0
#include "IAllocator.hpp"
namespace urde
{
class COsContext;
class CMemory
{
public:
static void Startup();
static void Shutdown();
static void SetAllocator(IAllocator&);
static void OffsetFakeStatics(int);
static void SetOutOfMemoryCallback(const IAllocator::TOutOfMemoryCallback, void*);
static void Free(void*);
static void* Alloc(size_t, IAllocator::EHint, IAllocator::EScope, IAllocator::EType, const CCallStack&);
};
class CMemorySys
{
public:
CMemorySys(IAllocator&);
~CMemorySys();
static IAllocator& GetGameAllocator();
};
}
/* Custom new funcs */
void* operator new(std::size_t sz, const char* funcName, const char* typeName);
void* operator new[](std::size_t sz, const char* funcName, const char* typeName);
#endif
#endif // __URDE_CMEMORY_HPP__

View File

@ -1,7 +1,5 @@
#include "CResLoader.hpp"
#include "CPakFile.hpp"
#include "CMemory.hpp"
#include "CCallStack.hpp"
namespace urde
{

View File

@ -1,6 +0,0 @@
#include "IAllocator.hpp"
namespace urde
{
}

View File

@ -1,79 +0,0 @@
#ifndef __URDE_IALLOCATOR_HPP__
#define __URDE_IALLOCATOR_HPP__
#include "RetroTypes.hpp"
namespace urde
{
class COsContext;
class CCallStack;
class IAllocator
{
public:
virtual ~IAllocator() {}
enum class EHint
{
None = 0x0,
TopOfHeap = 0x1,
Large = 0x2
};
enum class EScope
{
None = 0,
Default = 1
};
enum class EType
{
Primitive = 0,
Array = 1
};
struct SAllocInfo
{
};
struct SMetrics
{
u32 a;
u32 b;
u32 c;
u32 d;
u32 e;
u32 f;
u32 g;
u32 h;
u32 i;
u32 j;
u32 k;
u32 l;
u32 m;
u32 n;
u32 o;
u32 p;
u32 q;
u32 r;
u32 s;
u32 t;
u32 u;
u32 v;
};
typedef bool(*TOutOfMemoryCallback)(void*, u32);
typedef bool(*TAllocationVisitCallback)(const SAllocInfo&, void*);
virtual bool Initialize()=0;
virtual void Shutdown()=0;
virtual void* Alloc(size_t, EHint, EScope, EType, const CCallStack&)=0;
virtual void Free(void*)=0;
virtual void ReleaseAll()=0;
virtual void* AllocSecondary(size_t, EHint, EScope, EType, const CCallStack&)=0;
virtual void FreeSecondary(void*)=0;
virtual void ReleaseAllSecondary()=0;
virtual void SetOutOfMemoryCallback(const TOutOfMemoryCallback, void*)=0;
virtual int EnumAllocations(const TAllocationVisitCallback, void*, bool) const=0;
virtual SAllocInfo GetAllocInfo(void*) const=0;
virtual void OffsetFakeStatics(int)=0;
virtual SMetrics GetMetrics() const=0;
};
}
#endif // __URDE_IALLOCATOR_HPP__

View File

@ -1,5 +1,4 @@
#include "IOStreams.hpp"
#include "CMemory.hpp"
namespace urde
{

51
Runtime/MP1/CBabygoth.hpp Normal file
View File

@ -0,0 +1,51 @@
#ifndef __URDE_MP1_CBABYGOTH_HPP__
#define __URDE_MP1_CBABYGOTH_HPP__
#include "World/CPatterned.hpp"
namespace urde
{
class CBabygothData
{
float x0_;
float x4_;
u32 x8_;
CDamageInfo xc_;
CDamageInfo x28_;
u32 x44_;
u32 x48_;
CDamageInfo x4c_;
CDamageVulnerability x68_;
CDamageVulnerability xd0_;
u32 x138_;
u32 x13c_;
float x140_;
s16 x144_;
u32 x148_;
u32 x14c_;
u32 x150_;
u32 x154_;
s16 x158_;
s16 x15a_;
s16 x15c_;
float x160_;
float x164_;
float x168_;
u32 x16c_;
s16 x170_;
u32 x174_;
public:
CBabygothData(CInputStream&);
ResId GetShellModelResId() const;
void GetFireballDamage() const;
ResId GetFireballResID() const;
const CDamageVulnerability& GetShellDamageVulnerability() const;
void GetSHellHitPoints() const;
void GetFireballAttackVariance() const;
void GetFireballAttackTime() const;
void GetFireBreathDamage() const;
ResId GetFireBreathResId() const;
};
}
#endif // __URDE_MP1_CBABYGOTH_HPP__

View File

@ -16,6 +16,7 @@ set(MP1_SOURCES
CBeetle.hpp CBeetle.cpp
CWarWasp.hpp CWarWasp.cpp
CSpacePirate.hpp CSpacePirate.cpp
CBabygoth.hpp CBabygoth.cpp
CSaveUI.hpp CSaveUI.cpp
CMemoryCardDriver.hpp CMemoryCardDriver.cpp
MP1.hpp MP1.cpp)

View File

@ -4,7 +4,6 @@
#define MP1_USE_BOO 0
#include "IMain.hpp"
#include "CMemory.hpp"
#include "CTweaks.hpp"
#include "CPlayMovie.hpp"
#include "IOStreams.hpp"