mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-24 13:47:46 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
21a1837306
17 changed files with 558 additions and 358 deletions
|
@ -11,7 +11,7 @@
|
||||||
<LobbyHost>127.0.0.1</LobbyHost>
|
<LobbyHost>127.0.0.1</LobbyHost>
|
||||||
<!-- IP of the frontier server -->
|
<!-- IP of the frontier server -->
|
||||||
<FrontierHost>127.0.0.1</FrontierHost>
|
<FrontierHost>127.0.0.1</FrontierHost>
|
||||||
<!-- Secret used for server auth -->
|
<!-- Secret used for server auth - you *must* change this for public servers -->
|
||||||
<ServerSecret>default</ServerSecret>
|
<ServerSecret>default</ServerSecret>
|
||||||
<!-- Web server port -->
|
<!-- Web server port -->
|
||||||
<HttpPort>80</HttpPort>
|
<HttpPort>80</HttpPort>
|
||||||
|
@ -23,4 +23,9 @@
|
||||||
<Database>sapphire</Database>
|
<Database>sapphire</Database>
|
||||||
</Mysql>
|
</Mysql>
|
||||||
</General>
|
</General>
|
||||||
|
|
||||||
|
<Parameters>
|
||||||
|
<!-- GM Rank for newly created characters - should be changed to 0 for public servers -->
|
||||||
|
<DefaultGMRank>255</DefaultGMRank>
|
||||||
|
</Parameters>
|
||||||
</Settings>
|
</Settings>
|
|
@ -18,7 +18,11 @@
|
||||||
</General>
|
</General>
|
||||||
|
|
||||||
<Parameters>
|
<Parameters>
|
||||||
<!-- Message players see upon logging in -->
|
<!-- Messages players see upon logging in - These *must* be smaller than 307 characters -->
|
||||||
|
<MotDArray>
|
||||||
<MotD><<<Welcome to Sapphire>>></MotD>
|
<MotD><<<Welcome to Sapphire>>></MotD>
|
||||||
|
<MotD>This is a very good server</MotD>
|
||||||
|
<MotD>You can change these messages by editing MotDArray in config/settings_zone.xml</MotD>
|
||||||
|
</MotdArray>
|
||||||
</Parameters>
|
</Parameters>
|
||||||
</Settings>
|
</Settings>
|
||||||
|
|
|
@ -69,6 +69,7 @@ CREATE TABLE IF NOT EXISTS `charadetail` (
|
||||||
`PathId` int(10) DEFAULT NULL,
|
`PathId` int(10) DEFAULT NULL,
|
||||||
`StepIndex` int(5) DEFAULT NULL,
|
`StepIndex` int(5) DEFAULT NULL,
|
||||||
`ChocoboTaxiStandFlags` binary(8) DEFAULT NULL,
|
`ChocoboTaxiStandFlags` binary(8) DEFAULT NULL,
|
||||||
|
`GMRank` int(3) DEFAULT '0',
|
||||||
`unlocks` binary(64) DEFAULT NULL,
|
`unlocks` binary(64) DEFAULT NULL,
|
||||||
`CharacterId` int(20) NOT NULL DEFAULT '0',
|
`CharacterId` int(20) NOT NULL DEFAULT '0',
|
||||||
`IS_DELETE` int(3) DEFAULT '0',
|
`IS_DELETE` int(3) DEFAULT '0',
|
||||||
|
|
|
@ -218,7 +218,7 @@ void Core::Network::GameConnection::enterWorld( FFXIVARR_PACKET_RAW& packet, uin
|
||||||
|
|
||||||
uint64_t lookupId = *reinterpret_cast< uint64_t* >( &packet.data[0] + 0x18 );
|
uint64_t lookupId = *reinterpret_cast< uint64_t* >( &packet.data[0] + 0x18 );
|
||||||
|
|
||||||
uint32_t logInCharId;
|
uint32_t logInCharId = -1;
|
||||||
std::string logInCharName;
|
std::string logInCharName;
|
||||||
auto charList = g_restConnector.getCharList( ( char * )m_pSession->getSessionId() );
|
auto charList = g_restConnector.getCharList( ( char * )m_pSession->getSessionId() );
|
||||||
for( uint32_t i = 0; i < charList.size(); i++ )
|
for( uint32_t i = 0; i < charList.size(); i++ )
|
||||||
|
@ -233,6 +233,8 @@ void Core::Network::GameConnection::enterWorld( FFXIVARR_PACKET_RAW& packet, uin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( logInCharId == -1 )
|
||||||
|
return;
|
||||||
|
|
||||||
g_log.info( "[" + std::to_string( m_pSession->getAccountID() ) + "] Logging in as " + logInCharName + "(" + std::to_string( logInCharId ) + ")" );
|
g_log.info( "[" + std::to_string( m_pSession->getAccountID() ) + "] Logging in as " + logInCharName + "(" + std::to_string( logInCharId ) + ")" );
|
||||||
|
|
||||||
|
|
|
@ -270,6 +270,7 @@ namespace Core {
|
||||||
" unlocks, "
|
" unlocks, "
|
||||||
" QuestTracking, "
|
" QuestTracking, "
|
||||||
" Aetheryte, "
|
" Aetheryte, "
|
||||||
|
" GMRank, "
|
||||||
" UPDATE_DATE ) "
|
" UPDATE_DATE ) "
|
||||||
" VALUES (" + std::to_string( m_iD ) + ", "
|
" VALUES (" + std::to_string( m_iD ) + ", "
|
||||||
+ std::to_string( m_guardianDeity ) + ", "
|
+ std::to_string( m_guardianDeity ) + ", "
|
||||||
|
@ -283,7 +284,8 @@ namespace Core {
|
||||||
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)questComplete, 200 ) ) + "'), "
|
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)questComplete, 200 ) ) + "'), "
|
||||||
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)unlocks, 64 ) ) + "'), "
|
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)unlocks, 64 ) ) + "'), "
|
||||||
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)questTracking, 10 ) ) + "'), "
|
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)questTracking, 10 ) ) + "'), "
|
||||||
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)aetherytes, 12 ) ) + "'), NOW());" );
|
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)aetherytes, 12 ) ) + "'),"
|
||||||
|
+ std::to_string( m_gmRank ) + ", NOW());" );
|
||||||
|
|
||||||
|
|
||||||
g_database.execute( "INSERT INTO characlass (CharacterId, Lv_" + std::to_string( g_exdData.m_classJobInfoMap[m_class].exp_idx ) + ", UPDATE_DATE ) "
|
g_database.execute( "INSERT INTO characlass (CharacterId, Lv_" + std::to_string( g_exdData.m_classJobInfoMap[m_class].exp_idx ) + ", UPDATE_DATE ) "
|
||||||
|
|
|
@ -140,6 +140,16 @@ namespace Core {
|
||||||
m_tribe = tribe;
|
m_tribe = tribe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t getGmRank()
|
||||||
|
{
|
||||||
|
return m_birthMonth;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setGmRank( uint8_t rank )
|
||||||
|
{
|
||||||
|
m_gmRank = rank;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t m_modelEquip[10];
|
uint32_t m_modelEquip[10];
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -162,6 +172,8 @@ namespace Core {
|
||||||
std::map<uint8_t, uint16_t> m_classMap;
|
std::map<uint8_t, uint16_t> m_classMap;
|
||||||
uint8_t m_look[26];
|
uint8_t m_look[26];
|
||||||
|
|
||||||
|
uint8_t m_gmRank;
|
||||||
|
|
||||||
char m_name[34];
|
char m_name[34];
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ bool Core::Network::SapphireAPI::createAccount( const std::string& username, con
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Core::Network::SapphireAPI::createCharacter( const int& accountId, const std::string& name, const std::string& infoJson )
|
int Core::Network::SapphireAPI::createCharacter( const int& accountId, const std::string& name, const std::string& infoJson, const int& gmRank )
|
||||||
{
|
{
|
||||||
Core::PlayerMinimal newPlayer;
|
Core::PlayerMinimal newPlayer;
|
||||||
|
|
||||||
|
@ -166,6 +166,7 @@ int Core::Network::SapphireAPI::createCharacter( const int& accountId, const std
|
||||||
newPlayer.setBirthDay( tmpVector2.at( 3 ), tmpVector2.at( 2 ) );
|
newPlayer.setBirthDay( tmpVector2.at( 3 ), tmpVector2.at( 2 ) );
|
||||||
newPlayer.setClass( tmpVector2.at( 4 ) );
|
newPlayer.setClass( tmpVector2.at( 4 ) );
|
||||||
newPlayer.setTribe( tmpVector2.at( 5 ) );
|
newPlayer.setTribe( tmpVector2.at( 5 ) );
|
||||||
|
newPlayer.setGmRank( gmRank );
|
||||||
|
|
||||||
newPlayer.saveAsNew();
|
newPlayer.saveAsNew();
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace Core
|
||||||
|
|
||||||
bool createAccount( const std::string& username, const std::string& pass, std::string& sId );
|
bool createAccount( const std::string& username, const std::string& pass, std::string& sId );
|
||||||
|
|
||||||
int32_t createCharacter( const int& accountId, const std::string& name, const std::string& infoJson );
|
int32_t createCharacter( const int& accountId, const std::string& name, const std::string& infoJson, const int& gmRank );
|
||||||
|
|
||||||
void deleteCharacter( std::string name, uint32_t accountId );
|
void deleteCharacter( std::string name, uint32_t accountId );
|
||||||
|
|
||||||
|
|
|
@ -331,7 +331,7 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int32_t charId = g_sapphireAPI.createCharacter( result, name, finalJson );
|
int32_t charId = g_sapphireAPI.createCharacter( result, name, finalJson, m_pConfig->getValue< uint8_t >( "Settings.Parameters.DefaultGMRank", 255 ) );
|
||||||
|
|
||||||
std::string json_string = "{\"result\":\"" + std::to_string( charId ) + "\"}";
|
std::string json_string = "{\"result\":\"" + std::to_string( charId ) + "\"}";
|
||||||
*response << "HTTP/1.1 200\r\nContent-Length: " << json_string.length() << "\r\n\r\n" << json_string;
|
*response << "HTTP/1.1 200\r\nContent-Length: " << json_string.length() << "\r\n\r\n" << json_string;
|
||||||
|
|
|
@ -110,6 +110,16 @@ uint16_t Core::Entity::Player::getZoneId() const
|
||||||
return m_zoneId;
|
return m_zoneId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t Core::Entity::Player::getGmRank() const
|
||||||
|
{
|
||||||
|
return m_gmRank;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::Entity::Player::setGmRank( uint8_t rank )
|
||||||
|
{
|
||||||
|
m_gmRank = rank;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t Core::Entity::Player::getMode() const
|
uint8_t Core::Entity::Player::getMode() const
|
||||||
{
|
{
|
||||||
return m_mode;
|
return m_mode;
|
||||||
|
@ -780,11 +790,6 @@ void Core::Entity::Player::setLevelForClass( uint8_t level, Core::Common::ClassJ
|
||||||
setSyncFlag( PlayerSyncFlags::ExpLevel );
|
setSyncFlag( PlayerSyncFlags::ExpLevel );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Core::Entity::Player::getUserLevel() const
|
|
||||||
{
|
|
||||||
return m_userLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::Player::eventActionStart( uint32_t eventId,
|
void Core::Entity::Player::eventActionStart( uint32_t eventId,
|
||||||
uint32_t action,
|
uint32_t action,
|
||||||
ActionCallback finishCallback,
|
ActionCallback finishCallback,
|
||||||
|
|
|
@ -478,6 +478,9 @@ public:
|
||||||
|
|
||||||
uint16_t getZoneId() const;
|
uint16_t getZoneId() const;
|
||||||
|
|
||||||
|
uint8_t getGmRank() const;
|
||||||
|
void setGmRank( uint8_t rank );
|
||||||
|
|
||||||
uint8_t getMode() const;
|
uint8_t getMode() const;
|
||||||
void setMode( uint8_t mode );
|
void setMode( uint8_t mode );
|
||||||
|
|
||||||
|
@ -589,7 +592,7 @@ private:
|
||||||
boost::shared_ptr< Common::QuestActive > m_activeQuests[30];
|
boost::shared_ptr< Common::QuestActive > m_activeQuests[30];
|
||||||
int16_t m_questTracking[5];
|
int16_t m_questTracking[5];
|
||||||
uint8_t m_stateFlags[7];
|
uint8_t m_stateFlags[7];
|
||||||
uint8_t m_userLevel;
|
uint8_t m_gmRank;
|
||||||
uint16_t zoneId;
|
uint16_t zoneId;
|
||||||
|
|
||||||
bool m_bInCombat;
|
bool m_bInCombat;
|
||||||
|
|
|
@ -234,9 +234,9 @@ void Core::Entity::Player::eventFinish( uint32_t eventId, uint32_t freePlayer )
|
||||||
|
|
||||||
void Core::Entity::Player::onLogin()
|
void Core::Entity::Player::onLogin()
|
||||||
{
|
{
|
||||||
;
|
for( auto& child : g_serverZone.getConfig()->getChild( "Settings.Parameters.MotDArray" ) ) {
|
||||||
// TODO: Replace this with MoTD from config
|
sendNotice( child.second.data() );
|
||||||
sendNotice( g_serverZone.getConfig()->getValue< std::string >( "Settings.Parameters.MotD", " <<<Welcome to Sapphire >>>" ) );
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::onZoneStart()
|
void Core::Entity::Player::onZoneStart()
|
||||||
|
|
|
@ -80,7 +80,8 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
||||||
"cd.GrandCompany, "
|
"cd.GrandCompany, "
|
||||||
"cd.GrandCompanyRank, "
|
"cd.GrandCompanyRank, "
|
||||||
"cd.CFPenaltyUntil, "
|
"cd.CFPenaltyUntil, "
|
||||||
"cd.OpeningSequence "
|
"cd.OpeningSequence, "
|
||||||
|
"cd.GMRank "
|
||||||
"FROM charabase AS c "
|
"FROM charabase AS c "
|
||||||
" INNER JOIN charadetail AS cd "
|
" INNER JOIN charadetail AS cd "
|
||||||
" ON c.CharacterId = cd.CharacterId "
|
" ON c.CharacterId = cd.CharacterId "
|
||||||
|
@ -171,13 +172,13 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
||||||
|
|
||||||
m_openingSequence = field[36].getUInt32();
|
m_openingSequence = field[36].getUInt32();
|
||||||
|
|
||||||
|
m_gmRank = field[37].getUInt8();
|
||||||
|
|
||||||
m_pCell = nullptr;
|
m_pCell = nullptr;
|
||||||
|
|
||||||
if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() )
|
if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() )
|
||||||
g_log.error( "Player id " + char_id_str + " data corrupt!" );
|
g_log.error( "Player id " + char_id_str + " data corrupt!" );
|
||||||
|
|
||||||
m_userLevel = 1;
|
|
||||||
|
|
||||||
m_maxHp = getMaxHp();
|
m_maxHp = getMaxHp();
|
||||||
m_maxMp = getMaxMp();
|
m_maxMp = getMaxMp();
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,12 @@ void Core::DebugCommandHandler::registerCommand( const std::string& n, Core::Deb
|
||||||
void Core::DebugCommandHandler::execCommand( char * data, Core::Entity::PlayerPtr pPlayer )
|
void Core::DebugCommandHandler::execCommand( char * data, Core::Entity::PlayerPtr pPlayer )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if( pPlayer->getGmRank() <= 0 )
|
||||||
|
{
|
||||||
|
pPlayer->sendUrgent( "You are not allowed to use debug commands." );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// define callback pointer
|
// define callback pointer
|
||||||
void ( DebugCommandHandler::*pf )( char *, Entity::PlayerPtr, boost::shared_ptr< DebugCommand > );
|
void ( DebugCommandHandler::*pf )( char *, Entity::PlayerPtr, boost::shared_ptr< DebugCommand > );
|
||||||
|
|
||||||
|
|
|
@ -86,9 +86,11 @@ enum GmCommand
|
||||||
Jump = 0x025E,
|
Jump = 0x025E,
|
||||||
JumpNpc = 0x025F,
|
JumpNpc = 0x025F,
|
||||||
};
|
};
|
||||||
void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPacket,
|
void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPacket, Entity::PlayerPtr pPlayer )
|
||||||
Entity::PlayerPtr pPlayer )
|
|
||||||
{
|
{
|
||||||
|
if( pPlayer->getGmRank() <= 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
uint32_t commandId = inPacket.getValAt< uint32_t >( 0x20 );
|
uint32_t commandId = inPacket.getValAt< uint32_t >( 0x20 );
|
||||||
uint32_t param1 = inPacket.getValAt< uint32_t >( 0x24 );
|
uint32_t param1 = inPacket.getValAt< uint32_t >( 0x24 );
|
||||||
uint32_t param2 = inPacket.getValAt< uint32_t >( 0x28 );
|
uint32_t param2 = inPacket.getValAt< uint32_t >( 0x28 );
|
||||||
|
@ -330,11 +332,16 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pPlayer->setSyncFlag( Common::PlayerSyncFlags::All );
|
||||||
|
targetPlayer->setSyncFlag( Common::PlayerSyncFlags::All );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPacket,
|
void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPacket, Entity::PlayerPtr pPlayer )
|
||||||
Entity::PlayerPtr pPlayer )
|
|
||||||
{
|
{
|
||||||
|
if( pPlayer->getGmRank() <= 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
uint32_t commandId = inPacket.getValAt< uint32_t >( 0x20 );
|
uint32_t commandId = inPacket.getValAt< uint32_t >( 0x20 );
|
||||||
std::string param1 = inPacket.getStringAt( 0x34 );
|
std::string param1 = inPacket.getStringAt( 0x34 );
|
||||||
|
|
||||||
|
@ -418,4 +425,8 @@ void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPac
|
||||||
pPlayer->sendUrgent( "GM2 Command not implemented: " + std::to_string( commandId ) );
|
pPlayer->sendUrgent( "GM2 Command not implemented: " + std::to_string( commandId ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pPlayer->setSyncFlag( Common::PlayerSyncFlags::All );
|
||||||
|
targetPlayer->setSyncFlag( Common::PlayerSyncFlags::All );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace Server {
|
||||||
m_data.tPCurr = pPlayer->getTp();
|
m_data.tPCurr = pPlayer->getTp();
|
||||||
m_data.hPMax = pPlayer->getMaxHp();
|
m_data.hPMax = pPlayer->getMaxHp();
|
||||||
m_data.mPMax = pPlayer->getMaxMp();
|
m_data.mPMax = pPlayer->getMaxMp();
|
||||||
m_data.gmRank = 0xff;
|
m_data.gmRank = pPlayer->getGmRank();
|
||||||
//m_data.tPMax = 3000;
|
//m_data.tPMax = 3000;
|
||||||
m_data.level = pPlayer->getLevel();
|
m_data.level = pPlayer->getLevel();
|
||||||
memcpy( m_data.look, pPlayer->getLookArray(), 26 );
|
memcpy( m_data.look, pPlayer->getLookArray(), 26 );
|
||||||
|
|
147
src/tools/Script/ce_dump_vfs_path_406.lua
Normal file
147
src/tools/Script/ce_dump_vfs_path_406.lua
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
-- init global variable
|
||||||
|
g_dump = io.open(os.date("dump_%Y-%m-%d-%H-%M-%S.txt"), "a")
|
||||||
|
g_dump:write("ptr, name\n")
|
||||||
|
g_count = 0
|
||||||
|
|
||||||
|
-- relative virtual address(rva) to register_whatever function
|
||||||
|
-- this assume ffxiv sb benchmark
|
||||||
|
-- YOU MUST EDIT THIS TO RIGHT VALUE TO WORK
|
||||||
|
-- check http://imgur.com/a/nJCef for disasm
|
||||||
|
g_addr = {}
|
||||||
|
-- signature: 4053 4881EC60010000 488B??????????4833C4 4889842450010000 C70100000000 488BD9 4585C0 7514
|
||||||
|
g_addr.load_master = 0x166140 -- looks like below function is called from this
|
||||||
|
|
||||||
|
-- signature: 48895C2408 48896C2410 4889742418 57 4883EC40 498BD9 498BF8 488BF2 488BE9 4D85C9 740A
|
||||||
|
-- rva on benchmark was at 0x1624B0 and it's now located at 0x1663E0 (offseted by 0x3F30)
|
||||||
|
g_addr.load1 = 0x1663E0 -- mostly loads gfx stuff but does calc in it?
|
||||||
|
|
||||||
|
-- these were just calculated from load1 offset (didn't tested)
|
||||||
|
g_addr.load2 = 0x162410 + 0x3F30 -- mostly loads gfx stuff
|
||||||
|
g_addr.load3 = 0x1626B0 + 0x3F30 -- mostly loads exd data
|
||||||
|
g_addr.load4 = 0x162540 + 0x3F30 -- from this on found it because there are next to each other
|
||||||
|
g_addr.load5 = 0x162360 + 0x3F30 -- umm, vfx?
|
||||||
|
|
||||||
|
g_loadseen = {}
|
||||||
|
|
||||||
|
g_xiv = {}
|
||||||
|
g_xiv.proc_name = "ffxiv_dx11.exe"
|
||||||
|
g_xiv.path = "C:\\Users\\Mino\\Desktop\\FFXIV-SB\\game\\" .. g_xiv.proc_name
|
||||||
|
-- because I don't want to login and out every single try
|
||||||
|
g_xiv.arg = "SYS.Language=1 SYS.Fps=0 SYS.MainAdapter=\"AMD_Radeon_HD_7800_Series(\\\\.\\DISPLAY1)\" SYS.ScreenMode=0 SYS.ScreenWidth=1280 SYS.ScreenHeight=720 SYS.FullScreenWidth=1280 SYS.FullScreenHeight=720 SYS.Gamma=50 SYS.IsSoundAlways=0 SYS.SoundMaster=100 SYS.SoundBgm=100 SYS.SoundSe=100 SYS.SoundVoice=100 SYS.SoundSystem=100 SYS.SoundEnv=100 SYS.IsSndMaster=0 SYS.IsSndBgm=0 SYS.IsSndSe=0 SYS.IsSndVoice=0 SYS.IsSndSystem=0 SYS.IsSndEnv=0 SYS.WaterWet_DX11=1 SYS.OcclusionCulling_DX11=1 SYS.LodType_DX11=1 SYS.ReflectionType_DX11=0 SYS.AntiAliasing_DX11=0 SYS.TranslucentQuality_DX11=0 SYS.GrassQuality_DX11=2 SYS.ShadowLOD_DX11=1 SYS.ShadowVisibilityTypeSelf_DX11=1 SYS.ShadowVisibilityTypeOther_DX11=0 SYS.ShadowTextureSizeType_DX11=1 SYS.ShadowCascadeCountType_DX11=2 SYS.ShadowSoftShadowType_DX11=1 SYS.PhysicsTypeSelf_DX11=2 SYS.PhysicsTypeOther_DX11=2 SYS.TextureFilterQuality_DX11=2 SYS.TextureAnisotropicQuality_DX11=0 SYS.Vignetting_DX11=1 SYS.RadialBlur_DX11=1 SYS.SSAO_DX11=1 SYS.Glare_DX11=2 SYS.DepthOfField_DX11=1 SYS.ParallaxOcclusion_DX11=0 SYS.Tessellation_DX11=0 SYS.GlareRepresentation_DX11=0"
|
||||||
|
g_mode = "attach"
|
||||||
|
|
||||||
|
function init()
|
||||||
|
-- attach debugger
|
||||||
|
if g_mode == "create" then
|
||||||
|
print(string.format("Launching ffxiv.exe w/ arg %s", g_xiv.arg))
|
||||||
|
createProcess(g_xiv.path, g_xiv.arg, true, true)
|
||||||
|
elseif g_mode == "attach" then
|
||||||
|
print("Looking for ffxiv.exe..")
|
||||||
|
while not openProcess("ffxiv.exe") do sleep(1) end
|
||||||
|
print("Attaching...")
|
||||||
|
debugProcess()
|
||||||
|
while not getAddress(g_xiv.proc_name) do sleep(1) end
|
||||||
|
print("Module loaded")
|
||||||
|
else
|
||||||
|
print("Unsupported mode!")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for k, v in pairs(g_addr) do
|
||||||
|
-- k = name
|
||||||
|
-- v = rva
|
||||||
|
print(string.format("Attaching %s breakpoint on 0x%X", k, v))
|
||||||
|
debug_setBreakpoint(get_va(v))
|
||||||
|
end
|
||||||
|
|
||||||
|
print("Now waiting for breakpoints..")
|
||||||
|
end
|
||||||
|
|
||||||
|
function debugger_onBreakpoint()
|
||||||
|
if RIP == get_va(g_addr.load1) then
|
||||||
|
-- dump_message("1>>")
|
||||||
|
dump_addr(R8)
|
||||||
|
elseif RIP == get_va(g_addr.load2) then
|
||||||
|
-- dump_message("2>>")
|
||||||
|
dump_addr(R8)
|
||||||
|
elseif RIP == get_va(g_addr.load3) then
|
||||||
|
-- dump_message("3>>")
|
||||||
|
dump_addr(RCX)
|
||||||
|
elseif RIP == get_va(g_addr.load4) then
|
||||||
|
-- dump_message("4>>")
|
||||||
|
dump_addr(RCX)
|
||||||
|
elseif RIP == get_va(g_addr.load5) then
|
||||||
|
-- dump_message("5>>")
|
||||||
|
dump_addr(RDX)
|
||||||
|
elseif RIP == get_va(g_addr.load_master) then
|
||||||
|
-- dump_message("master>>")
|
||||||
|
dump_addr(RDX)
|
||||||
|
else
|
||||||
|
-- user bp, update gui on ce, but who gives a shit?
|
||||||
|
-- continue execution anyway
|
||||||
|
debug_continueFromBreakpoint("co_run")
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
-- something is missing on the text file because it takes ageeeeeeeeees to write to file
|
||||||
|
-- let just wait it
|
||||||
|
|
||||||
|
|
||||||
|
-- continue execution
|
||||||
|
debug_continueFromBreakpoint("co_run")
|
||||||
|
--return 0 -- update gui
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function dump_addr(addr)
|
||||||
|
local vfspath = readString(addr, 256)
|
||||||
|
if not g_loadseen[vfspath] then
|
||||||
|
g_loadseen[vfspath] = true -- set seen flag
|
||||||
|
|
||||||
|
local message = string.format("%X, %s", addr, vfspath)
|
||||||
|
dump_line(message)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function dump_line(message)
|
||||||
|
dump_message(message .. "\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
function dump_message(message)
|
||||||
|
g_dump:write(message)
|
||||||
|
g_dump:flush()
|
||||||
|
print(message)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- mod_base + rva = va
|
||||||
|
function get_va(rva)
|
||||||
|
return getAddress(g_xiv.proc_name) + rva
|
||||||
|
end
|
||||||
|
|
||||||
|
-- rva = va - mod_base
|
||||||
|
function get_rva(va)
|
||||||
|
return va - getAddress(g_xiv.proc_name)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- check mod_base <= va <= mod_base + mod_size
|
||||||
|
function is_mmod_addr(va)
|
||||||
|
local mod_base = getAddress(g_xiv.proc_name)
|
||||||
|
local mod_size = getModuleSize(g_xiv.proc_name)
|
||||||
|
|
||||||
|
if mod_base <= va and va <= mod_base + mod_size then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function split(str)
|
||||||
|
local result = {}
|
||||||
|
for token in string.gmatch(str..",", "([^,]+),%s*") do
|
||||||
|
table.insert(result, all_trim(token))
|
||||||
|
end
|
||||||
|
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
init()
|
Loading…
Add table
Reference in a new issue