Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/flarialmc/dll into mainRepo
Browse files Browse the repository at this point in the history
  • Loading branch information
FreezeEngine committed Aug 1, 2024
2 parents a0c104d + c6b7fad commit 95f4c60
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
14 changes: 11 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ DWORD WINAPI init(HMODULE real)
if(SDK::hasInstanced && SDK::clientInstance != nullptr) {
if (SDK::clientInstance->getLocalPlayer() != nullptr) {
if(elapsed >= std::chrono::seconds(60)) {
ModuleManager::onlineUsers.clear();
std::string name = SDK::clientInstance->getLocalPlayer()->playerName;

/*
ModuleManager::onlineUsers.clear();
ModuleManager::onlineUsers.push_back(Utils::removeColorCodes(name));
std::string pp = DownloadString("https://api.flarial.synthetix.host/users");
Expand All @@ -71,12 +73,16 @@ DWORD WINAPI init(HMODULE real)
std::cerr << "Invalid or missing 'lastbeat' for player: " << player.key() << std::endl;
continue;
}
ModuleManager::onlineUsers.push_back(Utils::removeNonAlphanumeric(player.key()));
std::string name2 = Utils::removeNonAlphanumeric(player.key());
name2 = replaceAll(name2, "�", "");
ModuleManager::onlineUsers.push_back(name2);
} catch (const std::exception& e) {
std::cerr << "Error processing player: " << player.key() << " - " << e.what() << std::endl;
continue;
}
}
*/

std::string ipToSend = SDK::getServerIP();

Expand All @@ -92,9 +98,11 @@ DWORD WINAPI init(HMODULE real)
if(SDK::clientInstance->getLocalPlayer() != nullptr)
if (module->isEnabled()) {
name = Utils::removeNonAlphanumeric(Utils::removeColorCodes(NickListener::original));
name = replaceAll(name, "", "");

}
// send thing
DownloadString(std::format("https://api.flarial.synthetix.host/heartbeat/{}/{}",Utils::removeColorCodes(name),ipToSend));
std::cout << DownloadString(std::format("https://api.flarial.synthetix.host/heartbeat/{}/{}",Utils::removeColorCodes(name),ipToSend)) << std::endl;

lastBeatTime = now;
}
Expand Down
26 changes: 13 additions & 13 deletions src/Client/Hook/Hooks/Render/SwapchainHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ HRESULT SwapchainHook::swapchainCallback(IDXGISwapChain3 *pSwapChain, UINT syncI
std::chrono::duration<float> elapsed = std::chrono::high_resolution_clock::now() - start;
MC::frames += 1;

if (Client::settings.getSettingByName<bool>("killdx")->value) {
SwapchainHook::queue = nullptr;
ID3D12Device5 *d3d12device3;

if (SUCCEEDED(pSwapChain->GetDevice(IID_PPV_ARGS(&d3d12device3)))) {
Logger::debug("[SwapChain] Removed d3d12 device");
pSwapChain->ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);
d3d12device3->RemoveDevice();

return funcOriginal(pSwapChain, syncInterval, flags);
}
}

if (elapsed.count() >= 0.5f) {
// Calculate frame rate based on elapsed time
Expand All @@ -118,17 +130,6 @@ HRESULT SwapchainHook::swapchainCallback(IDXGISwapChain3 *pSwapChain, UINT syncI
FlarialGUI::frameFactor = std::min(FlarialGUI::frameFactor, 1.0f);

if (!SwapchainHook::init) {
if (Client::settings.getSettingByName<bool>("killdx")->value) {
ID3D12Device5 *d3d12device3;

if (SUCCEEDED(pSwapChain->GetDevice(IID_PPV_ARGS(&d3d12device3)))) {
Logger::debug("[SwapChain] Removed d3d12 device");
pSwapChain->ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);
d3d12device3->RemoveDevice();

return funcOriginal(pSwapChain, syncInterval, flags);
}
}

if(SwapchainHook::queue == nullptr) {

Expand All @@ -154,8 +155,7 @@ HRESULT SwapchainHook::swapchainCallback(IDXGISwapChain3 *pSwapChain, UINT syncI
Memory::SafeRelease(eBackBuffer);

SwapchainHook::init = true;
}
else {
} else {

ID3D12Device5 *device;

Expand Down
3 changes: 1 addition & 2 deletions src/Utils/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ std::string Utils::removeColorCodes(const std::string &input) {
std::string Utils::removeNonAlphanumeric(const std::string &input) {
std::string result;
std::copy_if(input.begin(), input.end(), std::back_inserter(result), [](char c) {
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '_' || c == ' ' ||
c == '-';
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '_' || c == ' ';
});
return result;
}
Expand Down

0 comments on commit 95f4c60

Please sign in to comment.