Skip to content

Commit

Permalink
test ci format check
Browse files Browse the repository at this point in the history
  • Loading branch information
GeckoEidechse committed Sep 16, 2023
1 parent b782349 commit 5cbe9f7
Show file tree
Hide file tree
Showing 75 changed files with 2,551 additions and 2,551 deletions.
88 changes: 44 additions & 44 deletions NorthstarDLL/client/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ EventOverrideData::EventOverrideData()

// Empty stereo 48000 WAVE file
unsigned char EMPTY_WAVE[45] = {0x52, 0x49, 0x46, 0x46, 0x25, 0x00, 0x00, 0x00, 0x57, 0x41, 0x56, 0x45, 0x66, 0x6D, 0x74,
0x20, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x44, 0xAC, 0x00, 0x00, 0x88, 0x58,
0x01, 0x00, 0x02, 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61, 0x74, 0x00, 0x00, 0x00, 0x00};
0x20, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x44, 0xAC, 0x00, 0x00, 0x88, 0x58,
0x01, 0x00, 0x02, 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61, 0x74, 0x00, 0x00, 0x00, 0x00};

EventOverrideData::EventOverrideData(const std::string& data, const fs::path& path)
{
Expand All @@ -45,9 +45,9 @@ EventOverrideData::EventOverrideData(const std::string& data, const fs::path& pa
if (!fs::exists(samplesFolder))
{
spdlog::error(
"Failed reading audio override file {}: samples folder doesn't exist; should be named the same as the definition file without "
"JSON extension.",
path.string());
"Failed reading audio override file {}: samples folder doesn't exist; should be named the same as the definition file without "
"JSON extension.",
path.string());
return;
}

Expand All @@ -58,10 +58,10 @@ EventOverrideData::EventOverrideData(const std::string& data, const fs::path& pa
if (dataJson.HasParseError())
{
spdlog::error(
"Failed reading audio override file {}: encountered parse error \"{}\" at offset {}",
path.string(),
GetParseError_En(dataJson.GetParseError()),
dataJson.GetErrorOffset());
"Failed reading audio override file {}: encountered parse error \"{}\" at offset {}",
path.string(),
GetParseError_En(dataJson.GetParseError()),
dataJson.GetErrorOffset());
return;
}

Expand All @@ -87,7 +87,7 @@ EventOverrideData::EventOverrideData(const std::string& data, const fs::path& pa
if (!eventId.IsString())
{
spdlog::error(
"Failed reading audio override file {}: EventId array has a value of invalid type, all must be strings", path.string());
"Failed reading audio override file {}: EventId array has a value of invalid type, all must be strings", path.string());
return;
}

Expand All @@ -103,8 +103,8 @@ EventOverrideData::EventOverrideData(const std::string& data, const fs::path& pa
else
{
spdlog::error(
"Failed reading audio override file {}: EventId property is of invalid type (must be a string or an array of strings)",
path.string());
"Failed reading audio override file {}: EventId property is of invalid type (must be a string or an array of strings)",
path.string());
return;
}

Expand All @@ -118,8 +118,8 @@ EventOverrideData::EventOverrideData(const std::string& data, const fs::path& pa
if (!eventId.IsString())
{
spdlog::error(
"Failed reading audio override file {}: EventIdRegex array has a value of invalid type, all must be strings",
path.string());
"Failed reading audio override file {}: EventIdRegex array has a value of invalid type, all must be strings",
path.string());
return;
}

Expand Down Expand Up @@ -154,8 +154,8 @@ EventOverrideData::EventOverrideData(const std::string& data, const fs::path& pa
else
{
spdlog::error(
"Failed reading audio override file {}: EventIdRegex property is of invalid type (must be a string or an array of strings)",
path.string());
"Failed reading audio override file {}: EventIdRegex property is of invalid type (must be a string or an array of strings)",
path.string());
return;
}
}
Expand All @@ -181,8 +181,8 @@ EventOverrideData::EventOverrideData(const std::string& data, const fs::path& pa
else
{
spdlog::error(
"Failed reading audio override file {}: AudioSelectionStrategy string must be either \"sequential\" or \"random\"",
path.string());
"Failed reading audio override file {}: AudioSelectionStrategy string must be either \"sequential\" or \"random\"",
path.string());
return;
}
}
Expand Down Expand Up @@ -217,25 +217,25 @@ EventOverrideData::EventOverrideData(const std::string& data, const fs::path& pa
// thread off the file read
// should we spawn one thread per read? or should there be a cap to the number of reads at once?
std::thread readThread(
[pathString, fileSize, data]
{
std::shared_lock lock(g_CustomAudioManager.m_loadingMutex);
std::ifstream wavStream(pathString, std::ios::binary);

// would be weird if this got hit, since it would've worked previously
if (wavStream.fail())
{
spdlog::error("Failed async read of audio sample {}", pathString);
return;
}

// read from after the header first to preserve the empty header, then read the header last
wavStream.seekg(0, std::ios::beg);
wavStream.read(reinterpret_cast<char*>(data), fileSize);
wavStream.close();

spdlog::info("Finished async read of audio sample {}", pathString);
});
[pathString, fileSize, data]
{
std::shared_lock lock(g_CustomAudioManager.m_loadingMutex);
std::ifstream wavStream(pathString, std::ios::binary);

// would be weird if this got hit, since it would've worked previously
if (wavStream.fail())
{
spdlog::error("Failed async read of audio sample {}", pathString);
return;
}

// read from after the header first to preserve the empty header, then read the header last
wavStream.seekg(0, std::ios::beg);
wavStream.read(reinterpret_cast<char*>(data), fileSize);
wavStream.close();

spdlog::info("Finished async read of audio sample {}", pathString);
});

readThread.detach();
}
Expand All @@ -244,13 +244,13 @@ EventOverrideData::EventOverrideData(const std::string& data, const fs::path& pa
/*
if (dataJson.HasMember("EnableOnLoopedSounds"))
{
if (!dataJson["EnableOnLoopedSounds"].IsBool())
{
spdlog::error("Failed reading audio override file {}: EnableOnLoopedSounds property is of invalid type (must be a bool)",
if (!dataJson["EnableOnLoopedSounds"].IsBool())
{
spdlog::error("Failed reading audio override file {}: EnableOnLoopedSounds property is of invalid type (must be a bool)",
path.string()); return;
}
}
EnableOnLoopedSounds = dataJson["EnableOnLoopedSounds"].GetBool();
EnableOnLoopedSounds = dataJson["EnableOnLoopedSounds"].GetBool();
}
*/

Expand Down Expand Up @@ -367,7 +367,7 @@ bool ShouldPlayAudioEvent(const char* eventName, const std::shared_ptr<EventOver

// forward declare
bool __declspec(noinline) __fastcall LoadSampleMetadata_Internal(
uintptr_t parentEvent, void* sample, void* audioBuffer, unsigned int audioBufferLength, int audioType);
uintptr_t parentEvent, void* sample, void* audioBuffer, unsigned int audioBufferLength, int audioType);

// DO NOT TOUCH THIS FUNCTION
// The actual logic of it in a separate function (forcefully not inlined) to preserve the r12 register, which holds the event pointer.
Expand All @@ -388,7 +388,7 @@ bool, __fastcall, (void* sample, void* audioBuffer, unsigned int audioBufferLeng
// DO NOT INLINE THIS FUNCTION
// See comment below.
bool __declspec(noinline) __fastcall LoadSampleMetadata_Internal(
uintptr_t parentEvent, void* sample, void* audioBuffer, unsigned int audioBufferLength, int audioType)
uintptr_t parentEvent, void* sample, void* audioBuffer, unsigned int audioBufferLength, int audioType)
{
char* eventName = (char*)parentEvent + 0x110;

Expand Down
2 changes: 1 addition & 1 deletion NorthstarDLL/client/chatcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void ConCommand_log(const CCommand& args)
ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", ClientChatCommand, ConCommand, (CModule module))
{
ClientSayText =
module.Offset(0x54780).RCast<void(__fastcall*)(void* a1, const char* message, uint64_t isIngameChat, bool isTeamChat)>();
module.Offset(0x54780).RCast<void(__fastcall*)(void* a1, const char* message, uint64_t isIngameChat, bool isTeamChat)>();
RegisterConCommand("say", ConCommand_say, "Enters a message in public chat", FCVAR_CLIENTDLL);
RegisterConCommand("say_team", ConCommand_say_team, "Enters a message in team chat", FCVAR_CLIENTDLL);
RegisterConCommand("log", ConCommand_log, "Log a message to the local chat window", FCVAR_CLIENTDLL);
Expand Down
10 changes: 5 additions & 5 deletions NorthstarDLL/client/clientauthhooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void, __fastcall, (void* a1))
{
// if player has agreed to send token and we aren't already authing, try to auth
if (Cvar_ns_has_agreed_to_send_token->GetInt() == AGREED_TO_SEND_TOKEN &&
!g_pMasterServerManager->m_bOriginAuthWithMasterServerInProgress)
!g_pMasterServerManager->m_bOriginAuthWithMasterServerInProgress)
g_pMasterServerManager->AuthenticateOriginWithMasterServer(R2::g_pLocalPlayerUserID, R2::g_pLocalPlayerOriginToken);

// invalidate key so auth will fail
Expand Down Expand Up @@ -56,8 +56,8 @@ ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", ClientAuthHooks, ConVar, (CModule modu

// this cvar will save to cfg once initially agreed with
Cvar_ns_has_agreed_to_send_token = new ConVar(
"ns_has_agreed_to_send_token",
"0",
FCVAR_ARCHIVE_PLAYERPROFILE,
"whether the user has agreed to send their origin token to the northstar masterserver");
"ns_has_agreed_to_send_token",
"0",
FCVAR_ARCHIVE_PLAYERPROFILE,
"whether the user has agreed to send their origin token to the northstar masterserver");
}
28 changes: 14 additions & 14 deletions NorthstarDLL/client/debugoverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,24 +98,24 @@ void, __fastcall, (OverlayBase_t * pOverlay))
if (pCurrBox->a > 0)
{
RenderBox(
pCurrBox->origin,
pCurrBox->angles,
pCurrBox->mins,
pCurrBox->maxs,
Color(pCurrBox->r, pCurrBox->g, pCurrBox->b, pCurrBox->a),
false,
false);
pCurrBox->origin,
pCurrBox->angles,
pCurrBox->mins,
pCurrBox->maxs,
Color(pCurrBox->r, pCurrBox->g, pCurrBox->b, pCurrBox->a),
false,
false);
}
if (pCurrBox->a < 255)
{
RenderWireframeBox(
pCurrBox->origin,
pCurrBox->angles,
pCurrBox->mins,
pCurrBox->maxs,
Color(pCurrBox->r, pCurrBox->g, pCurrBox->b, 255),
false,
false);
pCurrBox->origin,
pCurrBox->angles,
pCurrBox->mins,
pCurrBox->maxs,
Color(pCurrBox->r, pCurrBox->g, pCurrBox->b, 255),
false,
false);
}
}
break;
Expand Down
14 changes: 7 additions & 7 deletions NorthstarDLL/client/languagehooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ char*, __fastcall, ())
if (!CheckLangAudioExists((char*)forcedLanguage))
{
spdlog::info(
"User tried to force the language (-language) to \"{}\", but audio for this language doesn't exist and the game is bound "
"to error, falling back to next option...",
forcedLanguage);
"User tried to force the language (-language) to \"{}\", but audio for this language doesn't exist and the game is bound "
"to error, falling back to next option...",
forcedLanguage);
}
else
{
Expand All @@ -80,9 +80,9 @@ char*, __fastcall, ())
if (!CheckLangAudioExists(lang))
{
if (strcmp(lang, "russian") !=
0) // don't log for "russian" since it's the default and that means Origin detection just didn't change it most likely
0) // don't log for "russian" since it's the default and that means Origin detection just didn't change it most likely
spdlog::info(
"Origin detected language \"{}\", but we do not have audio for it installed, falling back to the next option", lang);
"Origin detected language \"{}\", but we do not have audio for it installed, falling back to the next option", lang);
}
else
{
Expand All @@ -92,14 +92,14 @@ char*, __fastcall, ())
}

Tier0_DetectDefaultLanguageType(); // force the global in tier0 to be populated with language inferred from user's system rather than
// defaulting to Russian
// defaulting to Russian
canOriginDictateLang = false; // Origin has no say anymore, we will fallback to user's system setup language
auto lang = GetGameLanguage();
spdlog::info("Detected system language: {}", lang);
if (!CheckLangAudioExists(lang))
{
spdlog::warn("Caution, audio for this language does NOT exist. You might want to override your game language with -language "
"command line option.");
"command line option.");
auto lang = GetAnyInstalledAudioLanguage();
spdlog::warn("Falling back to the first installed audio language: {}", lang.c_str());
strncpy(ingameLang1, lang.c_str(), 256);
Expand Down
4 changes: 2 additions & 2 deletions NorthstarDLL/client/latencyflex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ ON_DLL_LOAD_CLIENT_RELIESON("client.dll", LatencyFlex, ConVar, (CModule module))

if (pLfxModule = LoadLibraryA("latencyflex_layer.dll"))
m_winelfx_WaitAndBeginFrame =
reinterpret_cast<void (*)()>(reinterpret_cast<void*>(GetProcAddress(pLfxModule, "lfx_WaitAndBeginFrame")));
reinterpret_cast<void (*)()>(reinterpret_cast<void*>(GetProcAddress(pLfxModule, "lfx_WaitAndBeginFrame")));
else if (pLfxModule = LoadLibraryA("latencyflex_wine.dll"))
m_winelfx_WaitAndBeginFrame =
reinterpret_cast<void (*)()>(reinterpret_cast<void*>(GetProcAddress(pLfxModule, "winelfx_WaitAndBeginFrame")));
reinterpret_cast<void (*)()>(reinterpret_cast<void*>(GetProcAddress(pLfxModule, "winelfx_WaitAndBeginFrame")));
else
{
spdlog::info("Unable to load LatencyFleX library, LatencyFleX disabled.");
Expand Down
40 changes: 20 additions & 20 deletions NorthstarDLL/client/localchatwriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,31 +73,31 @@ typedef void(__fastcall* ConvertANSIToUnicodeType)(LPCSTR ansi, int ansiCharLeng
ConvertANSIToUnicodeType ConvertANSIToUnicode;

LocalChatWriter::SwatchColor swatchColors[4] = {
LocalChatWriter::MainTextColor,
LocalChatWriter::SameTeamNameColor,
LocalChatWriter::EnemyTeamNameColor,
LocalChatWriter::NetworkNameColor,
LocalChatWriter::MainTextColor,
LocalChatWriter::SameTeamNameColor,
LocalChatWriter::EnemyTeamNameColor,
LocalChatWriter::NetworkNameColor,
};

Color darkColors[8] = {
Color {0, 0, 0, 255},
Color {205, 49, 49, 255},
Color {13, 188, 121, 255},
Color {229, 229, 16, 255},
Color {36, 114, 200, 255},
Color {188, 63, 188, 255},
Color {17, 168, 205, 255},
Color {229, 229, 229, 255}};
Color {0, 0, 0, 255},
Color {205, 49, 49, 255},
Color {13, 188, 121, 255},
Color {229, 229, 16, 255},
Color {36, 114, 200, 255},
Color {188, 63, 188, 255},
Color {17, 168, 205, 255},
Color {229, 229, 229, 255}};

Color lightColors[8] = {
Color {102, 102, 102, 255},
Color {241, 76, 76, 255},
Color {35, 209, 139, 255},
Color {245, 245, 67, 255},
Color {59, 142, 234, 255},
Color {214, 112, 214, 255},
Color {41, 184, 219, 255},
Color {255, 255, 255, 255}};
Color {102, 102, 102, 255},
Color {241, 76, 76, 255},
Color {35, 209, 139, 255},
Color {245, 245, 67, 255},
Color {59, 142, 234, 255},
Color {214, 112, 214, 255},
Color {41, 184, 219, 255},
Color {255, 255, 255, 255}};

class AnsiEscapeParser
{
Expand Down
4 changes: 2 additions & 2 deletions NorthstarDLL/core/convar/concommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ char* ConCommandBase::CopyString(const char* szFrom) const
}

typedef void (*ConCommandConstructorType)(
ConCommand* newCommand, const char* name, FnCommandCallback_t callback, const char* helpString, int flags, void* parent);
ConCommand* newCommand, const char* name, FnCommandCallback_t callback, const char* helpString, int flags, void* parent);
ConCommandConstructorType ConCommandConstructor;

void RegisterConCommand(const char* name, FnCommandCallback_t callback, const char* helpString, int flags)
Expand All @@ -136,7 +136,7 @@ void RegisterConCommand(const char* name, FnCommandCallback_t callback, const ch
}

void RegisterConCommand(
const char* name, FnCommandCallback_t callback, const char* helpString, int flags, FnCommandCompletionCallback completionCallback)
const char* name, FnCommandCallback_t callback, const char* helpString, int flags, FnCommandCompletionCallback completionCallback)
{
spdlog::info("Registering ConCommand {}", name);

Expand Down
4 changes: 2 additions & 2 deletions NorthstarDLL/core/convar/concommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ typedef void (*FnCommandCallback_t)(const CCommand& command);
// Returns 0 to COMMAND_COMPLETION_MAXITEMS worth of completion strings
//-----------------------------------------------------------------------------
typedef int (*__fastcall FnCommandCompletionCallback)(
const char* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH]);
const char* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH]);

// From r5reloaded
class ConCommandBase
Expand Down Expand Up @@ -137,4 +137,4 @@ class ConCommand : public ConCommandBase

void RegisterConCommand(const char* name, void (*callback)(const CCommand&), const char* helpString, int flags);
void RegisterConCommand(
const char* name, void (*callback)(const CCommand&), const char* helpString, int flags, FnCommandCompletionCallback completionCallback);
const char* name, void (*callback)(const CCommand&), const char* helpString, int flags, FnCommandCompletionCallback completionCallback);
Loading

0 comments on commit 5cbe9f7

Please sign in to comment.