aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest
diff options
context:
space:
mode:
authorBarichello <artur@barichello.me>2022-02-12 14:03:25 -0300
committerBarichello <artur@barichello.me>2022-02-12 14:03:25 -0300
commit1cc6381800f6f10a71eafcde1a4ba4412dfb5eb8 (patch)
treec6095dec6c69e5049abefb879ab2740a5717f71c /NorthstarDedicatedTest
parent8ee04102e767e106640881faca59e797e0958803 (diff)
downloadNorthstarLauncher-1cc6381800f6f10a71eafcde1a4ba4412dfb5eb8.tar.gz
NorthstarLauncher-1cc6381800f6f10a71eafcde1a4ba4412dfb5eb8.zip
Format buildainfile.cpp and masterserver.cpp
Diffstat (limited to 'NorthstarDedicatedTest')
-rw-r--r--NorthstarDedicatedTest/buildainfile.cpp23
-rw-r--r--NorthstarDedicatedTest/masterserver.cpp11
2 files changed, 20 insertions, 14 deletions
diff --git a/NorthstarDedicatedTest/buildainfile.cpp b/NorthstarDedicatedTest/buildainfile.cpp
index cbffb332..b4277128 100644
--- a/NorthstarDedicatedTest/buildainfile.cpp
+++ b/NorthstarDedicatedTest/buildainfile.cpp
@@ -21,7 +21,7 @@ struct CAI_NodeLink
int64_t flags;
};
-#pragma pack (push, 1)
+#pragma pack(push, 1)
struct CAI_NodeLinkDisk
{
short srcId;
@@ -51,8 +51,8 @@ struct CAI_Node
CAI_NodeLink** links;
char unk5[16];
int linkcount;
- int unk11; // bad name lmao
- short unk6; // should match up to unk4 on disk
+ int unk11; // bad name lmao
+ short unk6; // should match up to unk4 on disk
char unk7[16]; // padding until next bit
short unk8; // should match up to unk5 on disk
char unk9[8]; // padding until next bit
@@ -60,7 +60,7 @@ struct CAI_Node
};
// the way CAI_Nodes are represented in on-disk ain files
-#pragma pack (push, 1)
+#pragma pack(push, 1)
struct CAI_NodeDisk
{
float x;
@@ -150,7 +150,8 @@ void DumpAINInfo(CAI_Network* aiNetwork)
memcpy(diskNode.unk3, aiNetwork->nodes[i]->unk3, sizeof(diskNode.unk3));
diskNode.unk4 = aiNetwork->nodes[i]->unk6;
- diskNode.unk5 = -1; // aiNetwork->nodes[i]->unk8; // this field is wrong, however, it's always -1 in vanilla navmeshes anyway, so no biggie
+ diskNode.unk5 =
+ -1; // aiNetwork->nodes[i]->unk8; // this field is wrong, however, it's always -1 in vanilla navmeshes anyway, so no biggie
memcpy(diskNode.unk6, aiNetwork->nodes[i]->unk10, sizeof(diskNode.unk6));
spdlog::info("writing node {} from {} to {:x}", aiNetwork->nodes[i]->index, (void*)aiNetwork->nodes[i], writeStream.tellp());
@@ -169,7 +170,7 @@ void DumpAINInfo(CAI_Network* aiNetwork)
spdlog::info("caculated linkcount is normal!");
else
spdlog::warn("calculated linkcount has weird value! this is expected on build!");
- }
+ }
spdlog::info("writing linkcount: {}", calculatedLinkcount);
writeStream.write((char*)&calculatedLinkcount, sizeof(int));
@@ -207,7 +208,7 @@ void DumpAINInfo(CAI_Network* aiNetwork)
writeStream.close();
}
-typedef void(*CAI_NetworkBuilder__BuildType)(void* builder, CAI_Network* aiNetwork, void* unknown);
+typedef void (*CAI_NetworkBuilder__BuildType)(void* builder, CAI_Network* aiNetwork, void* unknown);
CAI_NetworkBuilder__BuildType CAI_NetworkBuilder__Build;
void CAI_NetworkBuilder__BuildHook(void* builder, CAI_Network* aiNetwork, void* unknown)
@@ -217,7 +218,7 @@ void CAI_NetworkBuilder__BuildHook(void* builder, CAI_Network* aiNetwork, void*
DumpAINInfo(aiNetwork);
}
-typedef void(*LoadAINFileType)(void* aimanager, void* buf, const char* filename);
+typedef void (*LoadAINFileType)(void* aimanager, void* buf, const char* filename);
LoadAINFileType LoadAINFile;
void LoadAINFileHook(void* aimanager, void* buf, const char* filename)
@@ -233,10 +234,12 @@ void LoadAINFileHook(void* aimanager, void* buf, const char* filename)
void InitialiseBuildAINFileHooks(HMODULE baseAddress)
{
- Cvar_ns_ai_dumpAINfileFromLoad = RegisterConVar("ns_ai_dumpAINfileFromLoad", "0", FCVAR_NONE, "For debugging: whether we should dump ain data for ains loaded from disk");
+ Cvar_ns_ai_dumpAINfileFromLoad = RegisterConVar(
+ "ns_ai_dumpAINfileFromLoad", "0", FCVAR_NONE, "For debugging: whether we should dump ain data for ains loaded from disk");
HookEnabler hook;
- ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x385E20, &CAI_NetworkBuilder__BuildHook, reinterpret_cast<LPVOID*>(&CAI_NetworkBuilder__Build));
+ ENABLER_CREATEHOOK(
+ hook, (char*)baseAddress + 0x385E20, &CAI_NetworkBuilder__BuildHook, reinterpret_cast<LPVOID*>(&CAI_NetworkBuilder__Build));
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x3933A0, &LoadAINFileHook, reinterpret_cast<LPVOID*>(&LoadAINFile));
// remove a check that prevents a logging function in link generation from working
diff --git a/NorthstarDedicatedTest/masterserver.cpp b/NorthstarDedicatedTest/masterserver.cpp
index 701395d3..cfb92409 100644
--- a/NorthstarDedicatedTest/masterserver.cpp
+++ b/NorthstarDedicatedTest/masterserver.cpp
@@ -92,10 +92,12 @@ std::string unescape_unicode(const std::string& str)
result.push_back(cp & ((1 << 6) - 1) | 0b10000000 & (~(1 << 6)));
}
}
- if (!last_match.ready()) {
+ if (!last_match.ready())
+ {
return str;
}
- else {
+ else
+ {
result.append(last_match.suffix());
}
return result;
@@ -392,8 +394,9 @@ void MasterServerManager::RequestServerList()
newServer->requiredMods.push_back(modInfo);
}
- // Can probably re-enable this later with a -verbose flag, but slows down loading of the server browser quite a bit as is
- //spdlog::info(
+ // Can probably re-enable this later with a -verbose flag, but slows down loading of the server browser quite a bit as
+ // is
+ // spdlog::info(
// "Server {} on map {} with playlist {} has {}/{} players", serverObj["name"].GetString(),
// serverObj["map"].GetString(), serverObj["playlist"].GetString(), serverObj["playerCount"].GetInt(),
// serverObj["maxPlayers"].GetInt());