Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #20 from idietmoran/dev-cli
Browse files Browse the repository at this point in the history
Updated for patch 4.2
  • Loading branch information
Stateford authored Feb 7, 2018
2 parents 3046296 + c7097ba commit 54cbdfe
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 55 deletions.
20 changes: 20 additions & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# UPDATING
------------
This is a checklist of things to do while UPDATING the program for a new patch

#### DIRECTX 11 (x64)
--------------

- [x] Number of Party Members `arch\\x64.cpp : 14`
- [x] You `arch\\x64.cpp : 41`
- [x] Normal Party Allies (find one and add 0x220 to each) `arch\\x64.cpp : 43-50`
- [x] Cross-World Party Boolean `arch\\x64.cpp : 79`
- [x] First Cross-World Party Ally `arch\\x64.cpp : 57`

#### DIRECTX 9 (x86)
----------------------------
- [x] Number of Party Members `arch\\x64.cpp : 13`
- [x] You `arch\\x64.cpp : 41`
- [x] Normal Party Allies (find one and add 0x220 to each) `arch\\x64.cpp : 42-49`
- [x] Cross-World Party Boolean `arch\\x64.cpp : 78`
- [ ] First Cross-World Party Ally `arch\\x64.cpp : 55`
39 changes: 22 additions & 17 deletions src/arch/x64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ x64::x64(Process* proc)
// get window name
exe_ = new Module("ffxiv_dx11.exe");
// memory offests for dx11 number of party members
numberOfPartyMembers_ = new Offset({ 0x0180A038, 0x38, 0x18, 0x20, 0x20, 0x10 });
numberOfPartyMembers_ = new Offset({ 0x018AE778, 0x38, 0x18, 0x20, 0x20, 0x10 });

// if dx11 (64-bit) set static x64 true
if (exe_->getModule(proc))
Expand All @@ -35,23 +35,28 @@ x64::~x64()
// create allies
void x64::createAllies(Process* proc)
{
// A7128
// 18F30F8
// dx11 64-bit offsets
allies_.push_back(new YOU(0x182AB51));
allies_.push_back(new Ally(0x184BFD0));
allies_.push_back(new Ally(0x184C1F0));
allies_.push_back(new Ally(0X184C410));
allies_.push_back(new Ally(0x184C630));
allies_.push_back(new Ally(0x184C850));
allies_.push_back(new Ally(0x184CA70));
allies_.push_back(new Ally(0x184CC90));
allies_.push_back(new Ally(0X184CEB0));

allies_.push_back(new YOU(0x18D1C79));
// each address is 0x220 away
allies_.push_back(new Ally(0x18F3540));
allies_.push_back(new Ally(0x18F3760));
allies_.push_back(new Ally(0X18F3980));
allies_.push_back(new Ally(0x18F3BA0));
allies_.push_back(new Ally(0x18F3DC0));
allies_.push_back(new Ally(0x18F3FE0));
allies_.push_back(new Ally(0x18F4200));
allies_.push_back(new Ally(0X18F3320));
// 18F3320
// create crossworld allies
alliesCW_.push_back(allies_[0]); // YOU
DWORD64 address = exe_->getAddress();
address += 0x017E86A0;
alliesCW_.push_back(allies_[0]); // YOU

ReadProcessMemory(proc->getHandle(), (void*)address, &address, sizeof(DWORD64), 0);
DWORD64 address = exe_->getAddress(); // exe base address
// 0x0188C540 #NEW ADDRESS
address += 0x0188C540; // address offset

ReadProcessMemory(proc->getHandle(), reinterpret_cast<LPCVOID>(address), &address, sizeof(DWORD64), 0);
address += 0x2E8;
alliesCW_.push_back(new AllyCW(address));

Expand All @@ -65,11 +70,11 @@ void x64::createAllies(Process* proc)
// get the number of party members
void x64::updateNumberOfPartyMembers(Process* proc, int &partyMembers)
{
ReadProcessMemory(proc->getHandle(), (void*)(numberOfPartyMembers_->getMemoryAddress64(proc, exe_)), &partyMembers, sizeof(int), 0);
ReadProcessMemory(proc->getHandle(), reinterpret_cast<LPCVOID>(numberOfPartyMembers_->getMemoryAddress64(proc, exe_)), &partyMembers, sizeof(int), 0);
}

// check if currently crossworld party
void x64::checkCrossWorldParty(Process* proc)
{
ReadProcessMemory(proc->getHandle(), (void*)(exe_->getAddress() + 0x184AF8C), &inCrossWorldParty_, 1, 0);
ReadProcessMemory(proc->getHandle(), reinterpret_cast<LPCVOID>(exe_->getAddress() + 0x18F22C4), &inCrossWorldParty_, 1, 0);
}
28 changes: 14 additions & 14 deletions src/arch/x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
x86::x86(Process* proc)
{
// handle error when getting invalid module
numberOfPartyMembers_ = new Offset({ 0x114151C, 0x1C, 0x10, 0x10, 0x1C, 0x10 });
numberOfPartyMembers_ = new Offset({ 0x011B6D74, 0x1C, 0x10, 0x10, 0x1C, 0x10 });
exe_ = new Module("ffxiv.exe");
if (!exe_->getModule32bit(proc))
{
Expand Down Expand Up @@ -38,23 +38,23 @@ x86::~x86()
void x86::createAllies(Process* proc)
{
// dx9 32-bit offsets
allies_.push_back(new YOU(0x115F441));
allies_.push_back(new Ally(0x117BA40));
allies_.push_back(new Ally(0x117BC60));
allies_.push_back(new Ally(0x117BE80));
allies_.push_back(new Ally(0x117C0A0));
allies_.push_back(new Ally(0x117C2C0));
allies_.push_back(new Ally(0x117C4E0));
allies_.push_back(new Ally(0x117C700));
allies_.push_back(new Ally(0x117C920));
allies_.push_back(new YOU(0x11D7411));
allies_.push_back(new Ally(0x11F3C00)); // 11F3C00
allies_.push_back(new Ally(0x11F3E20)); // 11F3E20
allies_.push_back(new Ally(0x11F4040));
allies_.push_back(new Ally(0x11F4260));
allies_.push_back(new Ally(0x11F4480)); //
allies_.push_back(new Ally(0x11F46A0));
allies_.push_back(new Ally(0x11F48C0));
allies_.push_back(new Ally(0x11F4AE0));

// create crossworld allies
alliesCW_.push_back(allies_[0]); // YOU

DWORD address = exe_->getAddress();
address += 0x10297A4;
address += 0x0109E5A4;

ReadProcessMemory(proc->getHandle(), (void*)address, &address, sizeof(DWORD64), 0);
ReadProcessMemory(proc->getHandle(), reinterpret_cast<LPCVOID>(address), &address, sizeof(DWORD), 0);
address += 0x2E0;
alliesCW_.push_back(new AllyCW(address));

Expand All @@ -68,12 +68,12 @@ void x86::createAllies(Process* proc)
// get the number of party members
void x86::updateNumberOfPartyMembers(Process *proc, int &partyMembers)
{
ReadProcessMemory(proc->getHandle(), (void*)(numberOfPartyMembers_->getMemoryAddress(proc, exe_)), &partyMembers, sizeof(int), 0);
ReadProcessMemory(proc->getHandle(), reinterpret_cast<LPCVOID>(numberOfPartyMembers_->getMemoryAddress(proc, exe_)), &partyMembers, sizeof(int), 0);
}

// check if currently crossworld party
void x86::checkCrossWorldParty(Process* proc)
{
// do nothing for the time being
ReadProcessMemory(proc->getHandle(), (void*)(exe_->getAddress() + 0x117ABF4), &inCrossWorldParty_, 1, 0);
ReadProcessMemory(proc->getHandle(), reinterpret_cast<LPCVOID>(exe_->getAddress() + 0x11F2DA4), &inCrossWorldParty_, 1, 0);
}
4 changes: 2 additions & 2 deletions src/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void Menu::displayAllies()

if(fflogs_->arch_->getFilteredAlliesCW().size() < fflogs_->partyMembers_)
{
partyMembers = fflogs_->arch_->getFilteredAlliesCW().size();
partyMembers = static_cast<int>(fflogs_->arch_->getFilteredAlliesCW().size());
}

for (int i = 0; i < partyMembers; i++)
Expand All @@ -68,7 +68,7 @@ void Menu::displayAllies()

if (fflogs_->arch_->getFilteredAllies().size() < fflogs_->partyMembers_)
{
partyMembers = fflogs_->arch_->getFilteredAllies().size();
partyMembers = static_cast<int>(fflogs_->arch_->getFilteredAllies().size());
}

for (int i = 0; i < partyMembers; i++)
Expand Down
2 changes: 1 addition & 1 deletion src/player/ally.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ void Ally::display()

void Ally::updateName(Process* proc, Module* exe)
{
ReadProcessMemory(proc->getHandle(), (void*)(exe->getAddress() + address_), &name_, 80, 0);
ReadProcessMemory(proc->getHandle(), reinterpret_cast<LPCVOID>(exe->getAddress() + address_), &name_, 80, 0);
}
2 changes: 1 addition & 1 deletion src/player/allyCW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ void AllyCW::display()

void AllyCW::updateName(Process* proc, Module* exe)
{
ReadProcessMemory(proc->getHandle(), (void*)(address_), &name_, 80, 0);
ReadProcessMemory(proc->getHandle(), reinterpret_cast<LPCVOID>(address_), &name_, 80, 0);
}
12 changes: 4 additions & 8 deletions src/player/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ bool Player::getCharId()

if (!body.empty())
{
std::wstring tempBody;


if (body.find(L"/character/id/") == std::string::npos)
{
return false;
}

tempBody = body.substr(body.find(L"/character/id/"), body.size());
std::wstring tempBody = body.substr(body.find(L"/character/id/"), body.size());
std::wstring tempBody2 = tempBody;
body = tempBody.substr(0, tempBody.find_first_of(L"\""));
tempBody2 = tempBody2.substr(tempBody2.find(L"</a>"), tempBody2.size());
Expand Down Expand Up @@ -56,7 +56,7 @@ void Player::openBrowser()
{
std::wstring url = L"https://www.fflogs.com/character/id/" + characterId_;
//url += characterId_;
ShellExecuteW(NULL, L"open", url.c_str(), NULL, NULL, SW_SHOWNORMAL);
ShellExecuteW(nullptr, L"open", url.c_str(), nullptr, nullptr, SW_SHOWNORMAL);
}
else
{
Expand All @@ -74,9 +74,5 @@ void Player::openBrowser()

bool Player::compare(Player* player)
{
if(name_ == player->name_)
{
return true;
}
return false;
return name_ == player->name_;
}
2 changes: 1 addition & 1 deletion src/player/you.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ void YOU::display()

void YOU::updateName(Process* proc, Module* exe)
{
ReadProcessMemory(proc->getHandle(), (void*)(exe->getAddress() + address_), &name_, 80, 0);
ReadProcessMemory(proc->getHandle(), reinterpret_cast<LPCVOID>(exe->getAddress() + address_), &name_, 80, 0);
}
4 changes: 2 additions & 2 deletions src/process/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bool Module::getModule(Process *proc)
{
if (!strcmp(nModule.szModule, moduleName_))
{
address_ = (DWORD64)nModule.modBaseAddr;
address_ = reinterpret_cast<DWORD64>(nModule.modBaseAddr);
return true;
}
} while (Module32Next(hSnapshot, &nModule));
Expand All @@ -48,7 +48,7 @@ bool Module::getModule32bit(Process *proc)
{
if (!strcmp(nModule.szModule, moduleName_))
{
address_ = (DWORD64)nModule.modBaseAddr;
address_ = reinterpret_cast<DWORD64>(nModule.modBaseAddr);
return true;
}
} while (Module32Next(hSnapshot, &nModule));
Expand Down
4 changes: 2 additions & 2 deletions src/process/offset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ DWORD64 Offset::getMemoryAddress(Process* proc, Module* module)
for(int i = 0; i < offsets_.size() - 1; i++)
{
address += offsets_[i];
ReadProcessMemory(proc->getHandle(), (void*)(address), &address, sizeof(DWORD), 0);
ReadProcessMemory(proc->getHandle(), reinterpret_cast<LPCVOID>(address), &address, sizeof(DWORD), 0);
}
address += offsets_[offsets_.size() - 1];
return address;
Expand All @@ -35,7 +35,7 @@ DWORD64 Offset::getMemoryAddress64(Process* proc, Module* module)
for (int i = 0; i < offsets_.size() - 1; i++)
{
address += offsets_[i];
ReadProcessMemory(proc->getHandle(), (void*)(address), &address, sizeof(DWORD64), 0);
ReadProcessMemory(proc->getHandle(), reinterpret_cast<LPCVOID>(address), &address, sizeof(DWORD64), 0);
}
address += offsets_[offsets_.size() - 1];

Expand Down
9 changes: 5 additions & 4 deletions src/process/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <iostream>

// constructor
Process::Process(std::string processName)
Process::Process(const std::string &processName)
{
getProcessId(processName);
}
Expand All @@ -15,14 +15,15 @@ Process::~Process()
}

// Gets the process id of the processname
void Process::getProcessId(std::string processName)
void Process::getProcessId(const std::string &processName)
{
hWnd_ = FindWindow(0, processName.c_str());
hWnd_ = FindWindow(nullptr, processName.c_str());
GetWindowThreadProcessId(hWnd_, &pid_);
pHandle_ = OpenProcess(PROCESS_VM_READ, FALSE, pid_);

if(pHandle_ == NULL)
if(pHandle_ == nullptr)
{
std::cout << GetLastError() << std::endl;
std::cout << "FFXIV is not currently running...\n";
std::cout << "Please restart the program while FFXIV is running.\n";
Sleep(1300);
Expand Down
4 changes: 2 additions & 2 deletions src/process/process.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class Process
HWND hWnd_;
HANDLE pHandle_;
public:
Process(std::string processName);
Process(const std::string &processName);
~Process();
void getProcessId(std::string processName);
void getProcessId(const std::string &processName);
HANDLE getHandle();
DWORD getPid();
};
2 changes: 1 addition & 1 deletion src/updater/updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void Updater::displayUpdate()
if(!compareVersion())
{
std::cout << "Update has been found...\n";
std::cout << "Press enter to update...";
std::cout << "Press any key to update...";

while(true)
{
Expand Down

0 comments on commit 54cbdfe

Please sign in to comment.