1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 22:57:45 +00:00

Windows fix for RNG in scripts

This commit is contained in:
Mordred 2022-02-16 13:50:10 +01:00
parent 63f8187989
commit 4c43108976
3 changed files with 22 additions and 2 deletions

View file

@ -29,6 +29,12 @@ namespace Sapphire::World::Manager
class TerritoryMgr;
class LinkshellMgr;
class WarpMgr;
class RNGMgr;
}
extern "C" EXPORT void win32initRngMgr( std::shared_ptr< Sapphire::World::Manager::RNGMgr > rngMgr )
{
Sapphire::Common::Service< Sapphire::World::Manager::RNGMgr >::set( rngMgr );
}
extern "C" EXPORT void win32initExd( std::shared_ptr< Sapphire::Data::ExdData > exdData )

View file

@ -75,9 +75,9 @@ public:
}
instance.addEObj( "unknown_0", 2000211, 0, 3280858, 4, { 367.827087f, 47.400051f, -226.694305f }, 4.714991f, 0.000432f, 0);
instance.addEObj( "sgvf_w_lvd_b0250", 2001504, 4323996, 4036038, 4, { 94.597588f, 26.865030f, -68.584061f }, 1.000000f, 0.000000f, 0);
instance.addEObj( "sgvf_w_lvd_b0250", 2001504, 4323996, 4036038, 1, { 94.597588f, 26.865030f, -68.584061f }, 1.000000f, 0.000000f, 7);
// States -> vf_bextwall_on (id: 3) vf_bextwall_of (id: 4)
instance.addEObj( "sgvf_w_lvd_b0249", 2001505, 4323997, 4036039, 4, { 95.510597f, 26.620729f, -67.853653f }, 1.000000f, 0.000000f, 0);
instance.addEObj( "sgvf_w_lvd_b0249", 2001505, 4323997, 4036039, 1, { 95.510597f, 26.620729f, -67.853653f }, 1.000000f, 0.000000f, 7);
// States -> vf_line_on (id: 10) vf_line_of (id: 11)
instance.addEObj( "unknown_1", 2001506, 3653862, 4056797, 4, { -9.239832f, 24.789940f, 35.778252f }, 0.991760f, 0.000048f, 0);
instance.addEObj( "sgvf_w_lvd_b0094", 2001507, 4035750, 4056798, 4, { -2.841087f, 23.114571f, 38.090420f }, 0.991760f, 0.000048f, 0);

View file

@ -18,6 +18,7 @@ namespace Sapphire::Data
namespace Sapphire::World::Manager
{
class TerritoryMgr;
class RNGMgr;
}
#endif
@ -123,12 +124,25 @@ Sapphire::ScriptAPI::ScriptObject** Sapphire::Scripting::ScriptLoader::getScript
using win32initFuncLinkshell = void(*)( std::shared_ptr< Sapphire::World::Manager::LinkshellMgr > );
using win32initFuncWarpMgr = void(*)( std::shared_ptr< Sapphire::World::Manager::WarpMgr > );
using win32initIObjectCache = void(*)( std::shared_ptr< Sapphire::InstanceObjectCache > );
using win32initRngMgr = void(*)( std::shared_ptr< Sapphire::World::Manager::RNGMgr > );
auto win32init = reinterpret_cast< win32initFunc >( GetProcAddress( handle, "win32initExd" ) );
auto win32initTeri = reinterpret_cast< win32initFuncTeri >( GetProcAddress( handle, "win32initTeri" ) );
auto win32initLinkshell = reinterpret_cast< win32initFuncLinkshell >( GetProcAddress( handle, "win32initLinkshell" ) );
auto win32initWarp = reinterpret_cast< win32initFuncWarpMgr >( GetProcAddress( handle, "win32initWarpMgr" ) );
auto win32initIObject = reinterpret_cast< win32initIObjectCache >( GetProcAddress( handle, "win32initIObjectCache" ) );
auto win32initRng = reinterpret_cast< win32initRngMgr >( GetProcAddress( handle, "win32initRngMgr" ) );
if( win32initRng )
{
auto ioCache = Common::Service< Sapphire::World::Manager::RNGMgr >::get();
auto ptr = ioCache.lock();
win32initRng( ptr );
}
else
{
Logger::warn( "did not find a win32initRng export on a windows script target - the server will likely crash!" );
}
if( win32initIObject )
{