-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FLHook compiling once again, made logger a static class with a theade…
…d queue to allow for multi-threaded logging
- Loading branch information
Showing
75 changed files
with
2,719 additions
and
2,476 deletions.
There are no files selected for viewing
Submodule FLHookSDK
updated
from 521e49 to ec46db
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#pragma once | ||
|
||
class PersonalityHelper | ||
{ | ||
friend FLHook; | ||
|
||
std::map<std::wstring, pub::AI::Personality> pilots; | ||
std::map<std::wstring, pub::AI::Personality::EvadeDodgeUseStruct> evadeDodge; | ||
std::map<std::wstring, pub::AI::Personality::EvadeBreakUseStruct> evadeBreak; | ||
std::map<std::wstring, pub::AI::Personality::BuzzHeadTowardUseStruct> buzzHead; | ||
std::map<std::wstring, pub::AI::Personality::BuzzPassByUseStruct> buzzPass; | ||
std::map<std::wstring, pub::AI::Personality::TrailUseStruct> trail; | ||
std::map<std::wstring, pub::AI::Personality::StrafeUseStruct> strafe; | ||
std::map<std::wstring, pub::AI::Personality::EngineKillUseStruct> engineKill; | ||
std::map<std::wstring, pub::AI::Personality::RepairUseStruct> repair; | ||
std::map<std::wstring, pub::AI::Personality::GunUseStruct> gun; | ||
std::map<std::wstring, pub::AI::Personality::MissileUseStruct> missile; | ||
std::map<std::wstring, pub::AI::Personality::MineUseStruct> mine; | ||
std::map<std::wstring, pub::AI::Personality::MissileReactionStruct> missileReaction; | ||
std::map<std::wstring, pub::AI::Personality::DamageReactionStruct> damageReaction; | ||
std::map<std::wstring, pub::AI::Personality::CountermeasureUseStruct> cm; | ||
std::map<std::wstring, pub::AI::Personality::FormationUseStruct> formation; | ||
std::map<std::wstring, pub::AI::Personality::JobStruct> job; | ||
|
||
Action<pub::AI::Personality, Error> GetPersonality(const std::wstring& pilotNickname); | ||
static void SetDirection(INI_Reader& ini, float (&direction)[4]); | ||
|
||
void LoadEvadeDodge(INI_Reader& ini); | ||
void LoadEvadeBreak(INI_Reader& ini); | ||
void LoadBuzzHead(INI_Reader& ini); | ||
void LoadBuzzPass(INI_Reader& ini); | ||
void LoadTrail(INI_Reader& ini); | ||
void LoadStrafe(INI_Reader& ini); | ||
void LoadEngineKill(INI_Reader& ini); | ||
void LoadRepair(INI_Reader& ini); | ||
void LoadGun(INI_Reader& ini); | ||
void LoadMine(INI_Reader& ini); | ||
void LoadMissileReaction(INI_Reader& ini); | ||
void LoadDamageReaction(INI_Reader& ini); | ||
void LoadCM(INI_Reader& ini); | ||
void LoadFormation(INI_Reader& ini); | ||
static void GetDifficulty(INI_Reader& ini, int& difficulty); | ||
void LoadJob(INI_Reader& ini); | ||
void LoadMissile(INI_Reader& ini); | ||
void LoadPilot(INI_Reader& ini); | ||
|
||
PersonalityHelper(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#pragma once | ||
|
||
#include <Singleton.hpp> | ||
|
||
#include <Core/Templates/Macros.hpp> | ||
#include <concurrent_queue.h> | ||
#include <optional> | ||
#include <spdlog/spdlog.h> | ||
|
||
enum class LogLevel | ||
{ | ||
Trace = spdlog::level::trace, | ||
Debug = spdlog::level::debug, | ||
Info = spdlog::level::info, | ||
Warn = spdlog::level::warn, | ||
Err = spdlog::level::err, | ||
}; | ||
|
||
enum class LogFile | ||
{ | ||
// Log to FLHook.log & Console | ||
Default, | ||
// Only log to console | ||
ConsoleOnly, | ||
}; | ||
|
||
class FLHook; | ||
class DLL Logger final | ||
{ | ||
struct LogMessage | ||
{ | ||
LogLevel level; | ||
LogFile file; | ||
std::wstring message; | ||
void* retAddress; | ||
}; | ||
|
||
friend FLHook; | ||
inline static bool consoleAllocated = true; | ||
inline static HANDLE consoleInput; | ||
inline static HANDLE consoleOutput; | ||
|
||
inline static std::jthread commandThread; | ||
inline static std::jthread loggingThread; | ||
inline static concurrency::concurrent_queue<LogMessage> logQueue; | ||
inline static concurrency::concurrent_queue<std::wstring> commandQueue; | ||
|
||
static std::wstring SetLogSource(void* addr); | ||
|
||
// Thread Funcs | ||
|
||
static void GetConsoleInput(std::stop_token st); | ||
static void PrintToConsole(std::stop_token st); | ||
|
||
static void Init(); | ||
|
||
public: | ||
static void Log(LogFile file, LogLevel level, std::wstring_view str); | ||
static void Log(LogLevel level, std::wstring_view str); | ||
|
||
static std::optional<std::wstring> GetCommand(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
|
||
class DebugTools | ||
{ | ||
inline static std::unordered_map<std::string, uint> hashMap; | ||
inline static std::allocator<BYTE> allocator; | ||
|
||
static uint CreateIdDetour(const char* str); | ||
|
||
public: | ||
DebugTools() = delete; | ||
static void Init(); | ||
}; |
Oops, something went wrong.