Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/application
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-06-27 20:23:44 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-06-27 20:23:44 +1000
commit332983c97b7a729c4dc5f19aa9ee4a22c420f7d8 (patch)
treefd9c441b796b522bdd5c7f8fbd32f51b8eff2a28 /source/application
parent14b9689b6d4f4ad5276c88130dc6e449bedc0709 (diff)
The Formatting String Catastrophe
Diffstat (limited to 'source/application')
-rw-r--r--source/application/StarMainApplication_sdl.cpp22
-rw-r--r--source/application/StarP2PNetworkingService_pc.cpp98
-rw-r--r--source/application/StarPlatformServices_pc.cpp18
-rw-r--r--source/application/StarRenderer_opengl20.cpp22
-rw-r--r--source/application/StarStatisticsService_pc_steam.cpp8
5 files changed, 84 insertions, 84 deletions
diff --git a/source/application/StarMainApplication_sdl.cpp b/source/application/StarMainApplication_sdl.cpp
index 45e224d..8c05508 100644
--- a/source/application/StarMainApplication_sdl.cpp
+++ b/source/application/StarMainApplication_sdl.cpp
@@ -212,7 +212,7 @@ public:
Logger::info("Application: Initializing SDL");
if (SDL_Init(0))
- throw ApplicationException(strf("Couldn't initialize SDL: %s", SDL_GetError()));
+ throw ApplicationException(strf("Couldn't initialize SDL: {}", SDL_GetError()));
if (char* basePath = SDL_GetBasePath()) {
File::changeDirectory(basePath);
@@ -231,15 +231,15 @@ public:
Logger::info("Application: Initializing SDL Video");
if (SDL_InitSubSystem(SDL_INIT_VIDEO))
- throw ApplicationException(strf("Couldn't initialize SDL Video: %s", SDL_GetError()));
+ throw ApplicationException(strf("Couldn't initialize SDL Video: {}", SDL_GetError()));
Logger::info("Application: Initializing SDL Joystick");
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK))
- throw ApplicationException(strf("Couldn't initialize SDL Joystick: %s", SDL_GetError()));
+ throw ApplicationException(strf("Couldn't initialize SDL Joystick: {}", SDL_GetError()));
Logger::info("Application: Initializing SDL Sound");
if (SDL_InitSubSystem(SDL_INIT_AUDIO))
- throw ApplicationException(strf("Couldn't initialize SDL Sound: %s", SDL_GetError()));
+ throw ApplicationException(strf("Couldn't initialize SDL Sound: {}", SDL_GetError()));
SDL_JoystickEventState(SDL_ENABLE);
@@ -251,7 +251,7 @@ public:
m_sdlWindow = SDL_CreateWindow(m_windowTitle.utf8Ptr(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
m_windowSize[0], m_windowSize[1], SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
if (!m_sdlWindow)
- throw ApplicationException::format("Application: Could not create SDL window: %s", SDL_GetError());
+ throw ApplicationException::format("Application: Could not create SDL window: {}", SDL_GetError());
SDL_ShowWindow(m_sdlWindow);
SDL_RaiseWindow(m_sdlWindow);
@@ -263,7 +263,7 @@ public:
m_sdlGlContext = SDL_GL_CreateContext(m_sdlWindow);
if (!m_sdlGlContext)
- throw ApplicationException::format("Application: Could not create OpenGL context: %s", SDL_GetError());
+ throw ApplicationException::format("Application: Could not create OpenGL context: {}", SDL_GetError());
SDL_GL_SwapWindow(m_sdlWindow);
setVSyncEnabled(m_windowVSync);
@@ -288,7 +288,7 @@ public:
SDL_CloseAudioDevice(m_sdlAudioDevice);
Logger::error("Application: Could not open 44.1khz / 16 bit stereo audio device, no sound available!");
} else {
- Logger::info("Application: Opened default audio device with 44.1khz / 16 bit stereo audio, %s sample size buffer", obtained.samples);
+ Logger::info("Application: Opened default audio device with 44.1khz / 16 bit stereo audio, {} sample size buffer", obtained.samples);
SDL_PauseAudioDevice(m_sdlAudioDevice, 0);
}
@@ -375,14 +375,14 @@ public:
Thread::sleepPrecise(spareMilliseconds);
}
} catch (std::exception const& e) {
- Logger::error("Application: exception thrown, shutting down: %s", outputException(e, true));
+ Logger::error("Application: exception thrown, shutting down: {}", outputException(e, true));
}
try {
Logger::info("Application: shutdown...");
m_application->shutdown();
} catch (std::exception const& e) {
- Logger::error("Application: threw exception during shutdown: %s", outputException(e, true));
+ Logger::error("Application: threw exception during shutdown: {}", outputException(e, true));
}
SDL_CloseAudioDevice(m_sdlAudioDevice);
@@ -432,10 +432,10 @@ private:
parent->m_windowMode = WindowMode::Fullscreen;
SDL_SetWindowFullscreen(parent->m_sdlWindow, SDL_WINDOW_FULLSCREEN);
} else {
- Logger::warn("Failed to set resolution %s, %s", (unsigned)requestedDisplayMode.w, (unsigned)requestedDisplayMode.h);
+ Logger::warn("Failed to set resolution {}, {}", (unsigned)requestedDisplayMode.w, (unsigned)requestedDisplayMode.h);
}
} else {
- Logger::warn("Unable to set requested display resolution %s, %s", (int)fullScreenResolution[0], (int)fullScreenResolution[1]);
+ Logger::warn("Unable to set requested display resolution {}, {}", (int)fullScreenResolution[0], (int)fullScreenResolution[1]);
}
SDL_DisplayMode actualDisplayMode;
diff --git a/source/application/StarP2PNetworkingService_pc.cpp b/source/application/StarP2PNetworkingService_pc.cpp
index 2a0b876..74c48ac 100644
--- a/source/application/StarP2PNetworkingService_pc.cpp
+++ b/source/application/StarP2PNetworkingService_pc.cpp
@@ -32,13 +32,13 @@ PcP2PNetworkingService::PcP2PNetworkingService(PcPlatformServicesStatePtr state)
m_discordOnActivityJoinToken = m_state->discordCore->ActivityManager().OnActivityJoin.Connect([this](char const* peerId) {
MutexLocker serviceLocker(m_mutex);
- Logger::info("Joining discord peer at '%s'", peerId);
- addPendingJoin(strf("+platform:%s", peerId));
+ Logger::info("Joining discord peer at '{}'", peerId);
+ addPendingJoin(strf("+platform:{}", peerId));
});
m_discordOnActivityRequestToken = m_state->discordCore->ActivityManager().OnActivityJoinRequest.Connect([this](discord::User const& user) {
MutexLocker serviceLocker(m_mutex);
String userName = String(user.GetUsername());
- Logger::info("Received join request from user '%s'", userName);
+ Logger::info("Received join request from user '{}'", userName);
m_discordJoinRequests.emplace_back(make_pair(user.GetId(), userName));
});
m_discordOnReceiveMessage = m_state->discordCore->LobbyManager().OnNetworkMessage.Connect(bind(&PcP2PNetworkingService::discordOnReceiveMessage, this, _1, _2, _3, _4, _5));
@@ -54,9 +54,9 @@ PcP2PNetworkingService::~PcP2PNetworkingService() {
if (m_state->discordAvailable) {
MutexLocker discordLocker(m_state->discordMutex);
if (m_discordServerLobby) {
- Logger::info("Deleting discord server lobby %s", m_discordServerLobby->first);
+ Logger::info("Deleting discord server lobby {}", m_discordServerLobby->first);
m_state->discordCore->LobbyManager().DeleteLobby(m_discordServerLobby->first, [](discord::Result res) {
- Logger::error("Could not connect delete server lobby (err %s)", (int)res);
+ Logger::error("Could not connect delete server lobby (err {})", (int)res);
});
}
@@ -108,18 +108,18 @@ void Star::PcP2PNetworkingService::setActivityData(String const& title, Maybe<pa
}
if (auto lobby = m_discordServerLobby)
- activity.GetParty().SetId(strf("%s", lobby->first).c_str());
+ activity.GetParty().SetId(strf("{}", lobby->first).c_str());
if (m_joinLocation.is<JoinLocal>()) {
if (auto lobby = m_discordServerLobby) {
- String joinSecret = strf("connect:discord_%s_%s_%s", m_state->discordCurrentUser->GetId(), lobby->first, lobby->second);
- Logger::info("Setting discord join secret as %s", joinSecret);
+ String joinSecret = strf("connect:discord_{}_{}_{}", m_state->discordCurrentUser->GetId(), lobby->first, lobby->second);
+ Logger::info("Setting discord join secret as {}", joinSecret);
activity.GetSecrets().SetJoin(joinSecret.utf8Ptr());
}
} else if (m_joinLocation.is<JoinRemote>()) {
- String address = strf("%s", (HostAddressWithPort)m_joinLocation.get<JoinRemote>());
- String joinSecret = strf("connect:address_%s", address);
- Logger::info("Setting discord join secret as %s", joinSecret);
+ String address = strf("{}", (HostAddressWithPort)m_joinLocation.get<JoinRemote>());
+ String joinSecret = strf("connect:address_{}", address);
+ Logger::info("Setting discord join secret as {}", joinSecret);
activity.GetSecrets().SetJoin(joinSecret.utf8Ptr());
activity.GetParty().SetId(address.utf8Ptr());
@@ -128,7 +128,7 @@ void Star::PcP2PNetworkingService::setActivityData(String const& title, Maybe<pa
m_discordUpdatingActivity = true;
m_state->discordCore->ActivityManager().UpdateActivity(activity, [this](discord::Result res) {
if (res != discord::Result::Ok)
- Logger::error("failed to set discord activity (err %s)", (int)res);
+ Logger::error("failed to set discord activity (err {})", (int)res);
MutexLocker serviceLocker(m_mutex);
m_discordUpdatingActivity = false;
@@ -193,7 +193,7 @@ void Star::PcP2PNetworkingService::update() {
m_state->discordCore->ActivityManager().SendRequestReply(p.first, reply, [](discord::Result res) {
if (res != discord::Result::Ok)
- Logger::error("Could not send discord activity join response (err %s)", (int)res);
+ Logger::error("Could not send discord activity join response (err {})", (int)res);
});
}
}
@@ -230,17 +230,17 @@ Either<String, P2PSocketUPtr> PcP2PNetworkingService::connectToPeer(P2PNetworkin
}
#endif
- return makeLeft(strf("Unsupported peer type '%s'", type));
+ return makeLeft(strf("Unsupported peer type '{}'", type));
}
void PcP2PNetworkingService::addPendingJoin(String connectionString) {
MutexLocker serviceLocker(m_mutex);
if (connectionString.extract(":") != "+platform")
- throw ApplicationException::format("malformed connection string '%s'", connectionString);
+ throw ApplicationException::format("malformed connection string '{}'", connectionString);
if (connectionString.extract(":") != "connect")
- throw ApplicationException::format("malformed connection string '%s'", connectionString);
+ throw ApplicationException::format("malformed connection string '{}'", connectionString);
String target = move(connectionString);
String targetType = target.extract("_");
@@ -248,7 +248,7 @@ void PcP2PNetworkingService::addPendingJoin(String connectionString) {
if (targetType == "address")
m_pendingJoin = HostAddressWithPort(target);
else
- m_pendingJoin = P2PNetworkingPeerId(strf("%s_%s", targetType, target));
+ m_pendingJoin = P2PNetworkingPeerId(strf("{}_{}", targetType, target));
}
#ifdef STAR_ENABLE_STEAM_INTEGRATION
@@ -312,7 +312,7 @@ auto PcP2PNetworkingService::createSteamP2PSocket(CSteamID steamId) -> unique_pt
void PcP2PNetworkingService::steamOnConnectionFailure(P2PSessionConnectFail_t* callback) {
MutexLocker serviceLocker(m_mutex);
- Logger::warn("Connection with steam user %s failed", callback->m_steamIDRemote.ConvertToUint64());
+ Logger::warn("Connection with steam user {} failed", callback->m_steamIDRemote.ConvertToUint64());
if (auto socket = m_steamOpenSockets.value(callback->m_steamIDRemote.ConvertToUint64())) {
MutexLocker socketLocker(socket->mutex);
steamCloseSocket(socket);
@@ -320,7 +320,7 @@ void PcP2PNetworkingService::steamOnConnectionFailure(P2PSessionConnectFail_t* c
}
void PcP2PNetworkingService::steamOnJoinRequested(GameRichPresenceJoinRequested_t* callback) {
- Logger::info("Queueing join request with steam friend id %s to address %s", callback->m_steamIDFriend.ConvertToUint64(), callback->m_rgchConnect);
+ Logger::info("Queueing join request with steam friend id {} to address {}", callback->m_steamIDFriend.ConvertToUint64(), callback->m_rgchConnect);
addPendingJoin(callback->m_rgchConnect);
}
@@ -330,19 +330,19 @@ void PcP2PNetworkingService::steamOnSessionRequest(P2PSessionRequest_t* callback
// non-friends can even initiate P2P sessions.
if (m_acceptingP2PConnections && SteamFriends()->HasFriend(callback->m_steamIDRemote, k_EFriendFlagImmediate)) {
if (SteamNetworking()->AcceptP2PSessionWithUser(callback->m_steamIDRemote)) {
- Logger::info("Accepted steam p2p connection with user %s", callback->m_steamIDRemote.ConvertToUint64());
+ Logger::info("Accepted steam p2p connection with user {}", callback->m_steamIDRemote.ConvertToUint64());
m_pendingIncomingConnections.append(createSteamP2PSocket(callback->m_steamIDRemote));
} else {
- Logger::error("Accepting steam p2p connection from user %s failed!", callback->m_steamIDRemote.ConvertToUint64());
+ Logger::error("Accepting steam p2p connection from user {} failed!", callback->m_steamIDRemote.ConvertToUint64());
}
} else {
- Logger::error("Ignoring steam p2p connection from user %s", callback->m_steamIDRemote.ConvertToUint64());
+ Logger::error("Ignoring steam p2p connection from user {}", callback->m_steamIDRemote.ConvertToUint64());
}
}
void PcP2PNetworkingService::steamCloseSocket(SteamP2PSocket* socket) {
if (socket->connected) {
- Logger::info("Closing p2p connection with steam user %s", socket->steamId.ConvertToUint64());
+ Logger::info("Closing p2p connection with steam user {}", socket->steamId.ConvertToUint64());
m_steamOpenSockets.remove(socket->steamId.ConvertToUint64());
socket->connected = false;
}
@@ -386,7 +386,7 @@ bool PcP2PNetworkingService::DiscordP2PSocket::sendMessage(ByteArray const& mess
discord::Result res = parent->m_state->discordCore->LobbyManager().SendNetworkMessage(lobbyId, remoteUserId, DiscordMainNetworkChannel, (uint8_t*)message.ptr(), message.size());
if (res != discord::Result::Ok)
- throw ApplicationException::format("discord::Network::Send returned error (err %s)", (int)res);
+ throw ApplicationException::format("discord::Network::Send returned error (err {})", (int)res);
return true;
}
@@ -407,13 +407,13 @@ void PcP2PNetworkingService::discordCloseSocket(DiscordP2PSocket* socket) {
if (!m_joinLocation.is<JoinLocal>() && m_discordOpenSockets.empty()) {
auto res = m_state->discordCore->LobbyManager().DisconnectNetwork(socket->lobbyId);
if (res != discord::Result::Ok)
- Logger::error("failed to leave network for lobby %s (err %s)", socket->lobbyId, (int)res);
+ Logger::error("failed to leave network for lobby {} (err {})", socket->lobbyId, (int)res);
m_state->discordCore->LobbyManager().DisconnectLobby(socket->lobbyId, [this, lobbyId = socket->lobbyId](discord::Result res) {
if (res != discord::Result::Ok)
- Logger::error("failed to leave discord lobby %s", lobbyId);
+ Logger::error("failed to leave discord lobby {}", lobbyId);
- Logger::info("Left discord lobby %s", lobbyId);
+ Logger::info("Left discord lobby {}", lobbyId);
MutexLocker serviceLocker(m_mutex);
m_discordServerLobby = {};
m_discordForceUpdateActivity = true;
@@ -438,7 +438,7 @@ P2PSocketUPtr PcP2PNetworkingService::discordConnectRemote(discord::UserId remot
socket->lobbyId = lobbyId;
m_discordOpenSockets[remoteUserId] = socket.get();
- Logger::info("Connect to discord lobby %s", lobbyId);
+ Logger::info("Connect to discord lobby {}", lobbyId);
m_state->discordCore->LobbyManager().ConnectLobby(lobbyId, lobbySecret.utf8Ptr(), [this, remoteUserId, lobbyId](discord::Result res, discord::Lobby const& lobby) {
MutexLocker serviceLocker(m_mutex);
if (res == discord::Result::Ok) {
@@ -448,25 +448,25 @@ P2PSocketUPtr PcP2PNetworkingService::discordConnectRemote(discord::UserId remot
res = m_state->discordCore->LobbyManager().ConnectNetwork(lobbyId);
if (res != discord::Result::Ok) {
discordCloseSocket(socket);
- return Logger::error("Could not connect to discord lobby network (err %s)", (int)res);
+ return Logger::error("Could not connect to discord lobby network (err {})", (int)res);
}
res = m_state->discordCore->LobbyManager().OpenNetworkChannel(lobbyId, DiscordMainNetworkChannel, true);
if (res != discord::Result::Ok) {
discordCloseSocket(socket);
- return Logger::error("Could not open discord main network channel (err %s)", (int)res);
+ return Logger::error("Could not open discord main network channel (err {})", (int)res);
}
socket->mode = DiscordSocketMode::Connected;
- Logger::info("Discord p2p connection opened to remote user %s via lobby %s", remoteUserId, lobbyId);
+ Logger::info("Discord p2p connection opened to remote user {} via lobby {}", remoteUserId, lobbyId);
m_discordServerLobby = make_pair(lobbyId, String());
m_discordForceUpdateActivity = true;
} else {
- Logger::error("discord::Lobbies::Connect callback no matching remoteUserId %s found", remoteUserId);
+ Logger::error("discord::Lobbies::Connect callback no matching remoteUserId {} found", remoteUserId);
}
} else {
- Logger::error("failed to connect to remote lobby (err %s)", (int)res);
+ Logger::error("failed to connect to remote lobby (err {})", (int)res);
if (auto socket = m_discordOpenSockets.value(remoteUserId)) {
MutexLocker socketLocker(socket->mutex);
discordCloseSocket(socket);
@@ -481,17 +481,17 @@ void PcP2PNetworkingService::discordOnReceiveMessage(discord::LobbyId lobbyId, d
MutexLocker serviceLocker(m_mutex);
if (lobbyId != m_discordServerLobby->first)
- return Logger::error("Received message from unexpected lobby %s", lobbyId);
+ return Logger::error("Received message from unexpected lobby {}", lobbyId);
if (auto socket = m_discordOpenSockets.value(userId)) {
if (channel == DiscordMainNetworkChannel) {
MutexLocker socketLocker(socket->mutex);
socket->incoming.append(ByteArray((char const*)data, size));
} else {
- Logger::error("Received discord message on unexpected channel %s, ignoring", channel);
+ Logger::error("Received discord message on unexpected channel {}, ignoring", channel);
}
} else {
- Logger::error("Could not find associated discord socket for user id %s", userId);
+ Logger::error("Could not find associated discord socket for user id {}", userId);
}
}
@@ -508,7 +508,7 @@ void PcP2PNetworkingService::discordOnLobbyMemberConnect(discord::LobbyId lobbyI
m_discordOpenSockets[userId] = socket.get();
m_pendingIncomingConnections.append(move(socket));
- Logger::info("Accepted new discord connection from remote user %s", userId);
+ Logger::info("Accepted new discord connection from remote user {}", userId);
}
}
}
@@ -548,13 +548,13 @@ void PcP2PNetworkingService::setJoinLocation(JoinLocation location) {
} else if (m_joinLocation.is<JoinLocal>()) {
auto steamId = SteamUser()->GetSteamID().ConvertToUint64();
- Logger::info("Setting steam rich presence connection as steamid_%s", steamId);
- SteamFriends()->SetRichPresence("connect", strf("+platform:connect:steamid_%s", steamId).c_str());
+ Logger::info("Setting steam rich presence connection as steamid_{}", steamId);
+ SteamFriends()->SetRichPresence("connect", strf("+platform:connect:steamid_{}", steamId).c_str());
} else if (m_joinLocation.is<JoinRemote>()) {
auto address = (HostAddressWithPort)location.get<JoinRemote>();
- Logger::info("Setting steam rich presence connection as address_%s", address);
- SteamFriends()->SetRichPresence("connect", strf("+platform:connect:address_%s", address).c_str());
+ Logger::info("Setting steam rich presence connection as address_{}", address);
+ SteamFriends()->SetRichPresence("connect", strf("+platform:connect:address_{}", address).c_str());
}
}
#endif
@@ -562,9 +562,9 @@ void PcP2PNetworkingService::setJoinLocation(JoinLocation location) {
#ifdef STAR_ENABLE_DISCORD_INTEGRATION
if (m_state->discordAvailable && m_state->discordCurrentUser) {
if (m_discordServerLobby) {
- Logger::info("Deleting discord server lobby %s", m_discordServerLobby->first);
+ Logger::info("Deleting discord server lobby {}", m_discordServerLobby->first);
m_state->discordCore->LobbyManager().DeleteLobby(m_discordServerLobby->first, [](discord::Result res) {
- Logger::error("Could not connect delete server lobby (err %s)", (int)res);
+ Logger::error("Could not connect delete server lobby (err {})", (int)res);
});
}
@@ -591,21 +591,21 @@ void PcP2PNetworkingService::setJoinLocation(JoinLocation location) {
// successfully joined lobby network
return;
} else {
- Logger::error("Failed to open discord main network channel (err %s)", (int)res);
+ Logger::error("Failed to open discord main network channel (err {})", (int)res);
}
} else {
- Logger::error("Failed to join discord lobby network (err %s)", (int)res);
+ Logger::error("Failed to join discord lobby network (err {})", (int)res);
}
// Created lobby but failed to join the lobby network, delete lobby
- Logger::error("Failed to join discord lobby network (err %s)", (int)res);
+ Logger::error("Failed to join discord lobby network (err {})", (int)res);
- Logger::info("Deleting discord lobby %s", lobbyId);
+ Logger::info("Deleting discord lobby {}", lobbyId);
m_state->discordCore->LobbyManager().DeleteLobby(lobbyId, [lobbyId](discord::Result res) {
- Logger::error("failed to delete lobby %s (err %s)", lobbyId, (int)res);
+ Logger::error("failed to delete lobby {} (err {})", lobbyId, (int)res);
});
} else {
- Logger::error("failed to create discord lobby (err %s)", (int)res);
+ Logger::error("failed to create discord lobby (err {})", (int)res);
}
});
}
diff --git a/source/application/StarPlatformServices_pc.cpp b/source/application/StarPlatformServices_pc.cpp
index 7e528f0..7023129 100644
--- a/source/application/StarPlatformServices_pc.cpp
+++ b/source/application/StarPlatformServices_pc.cpp
@@ -43,26 +43,26 @@ PcPlatformServicesState::PcPlatformServicesState()
discord::User user;
auto res = discordCore->UserManager().GetCurrentUser(&user);
if (res != discord::Result::Ok)
- Logger::error("Could not get current discord user. (err %s)", (int)res);
+ Logger::error("Could not get current discord user. (err {})", (int)res);
else
discordCurrentUser = user;
});
} else {
- Logger::error("Failed to instantiate discord core (err %s)", (int)res);
+ Logger::error("Failed to instantiate discord core (err {})", (int)res);
}
if (discordAvailable) {
MutexLocker locker(discordMutex);
discordCore->SetLogHook(discord::LogLevel::Info, [](discord::LogLevel level, char const* msg) {
if (level == discord::LogLevel::Debug)
- Logger::debug("[DISCORD]: %s", msg);
+ Logger::debug("[DISCORD]: {}", msg);
else if (level == discord::LogLevel::Error)
- Logger::debug("[DISCORD]: %s", msg);
+ Logger::debug("[DISCORD]: {}", msg);
else if (level == discord::LogLevel::Info)
- Logger::info("[DISCORD]: %s", msg);
+ Logger::info("[DISCORD]: {}", msg);
else if (level == discord::LogLevel::Warn)
- Logger::warn("[DISCORD]: %s", msg);
+ Logger::warn("[DISCORD]: {}", msg);
});
discordEventShutdown = false;
discordEventThread = Thread::invoke("PcPlatformServices::discordEventThread", [this]() {
@@ -117,10 +117,10 @@ PcPlatformServicesUPtr PcPlatformServices::create(String const& path, StringList
auto p2pNetworkingService = make_shared<PcP2PNetworkingService>(services->m_state);
for (auto& argument : platformArguments) {
if (argument.beginsWith("+platform:connect:")) {
- Logger::info("PC platform services joining from command line argument '%s'", argument);
+ Logger::info("PC platform services joining from command line argument '{}'", argument);
p2pNetworkingService->addPendingJoin(move(argument));
} else {
- throw ApplicationException::format("Unrecognized PC platform services command line argument '%s'", argument);
+ throw ApplicationException::format("Unrecognized PC platform services command line argument '{}'", argument);
}
}
@@ -138,7 +138,7 @@ PcPlatformServicesUPtr PcPlatformServices::create(String const& path, StringList
#ifdef STAR_ENABLE_DISCORD_INTEGRATION
MutexLocker discordLocker(services->m_state->discordMutex);
if (services->m_state->discordAvailable) {
- Logger::debug("Registering starbound to discord at path: %s", path);
+ Logger::debug("Registering starbound to discord at path: {}", path);
services->m_state->discordCore->ActivityManager().RegisterCommand(path.utf8Ptr());
}
#endif
diff --git a/source/application/StarRenderer_opengl20.cpp b/source/application/StarRenderer_opengl20.cpp
index e80d745..82d4845 100644
--- a/source/application/StarRenderer_opengl20.cpp
+++ b/source/application/StarRenderer_opengl20.cpp
@@ -76,7 +76,7 @@ OpenGl20Renderer::OpenGl20Renderer() {
if (!GLEW_VERSION_2_0)
throw RendererException("OpenGL 2.0 not available!");
- Logger::info("OpenGL version: '%s' vendor: '%s' renderer: '%s' shader: '%s'",
+ Logger::info("OpenGL version: '{}' vendor: '{}' renderer: '{}' shader: '{}'",
(const char*)glGetString(GL_VERSION),
(const char*)glGetString(GL_VENDOR),
(const char*)glGetString(GL_RENDERER),
@@ -132,7 +132,7 @@ void OpenGl20Renderer::setEffectConfig(Json const& effectConfig, StringMap<Strin
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
if (!status) {
glGetShaderInfoLog(shader, sizeof(logBuffer), NULL, logBuffer);
- throw RendererException(strf("Failed to compile %s shader: %s\n", name, logBuffer));
+ throw RendererException(strf("Failed to compile {} shader: {}\n", name, logBuffer));
}
return shader;
@@ -158,7 +158,7 @@ void OpenGl20Renderer::setEffectConfig(Json const& effectConfig, StringMap<Strin
if (!status) {
glGetProgramInfoLog(program, sizeof(logBuffer), NULL, logBuffer);
glDeleteProgram(program);
- throw RendererException(strf("Failed to link program: %s\n", logBuffer));
+ throw RendererException(strf("Failed to link program: {}\n", logBuffer));
}
if (m_program != 0)
@@ -175,8 +175,8 @@ void OpenGl20Renderer::setEffectConfig(Json const& effectConfig, StringMap<Strin
m_textureUniforms.clear();
m_textureSizeUniforms.clear();
for (size_t i = 0; i < MultiTextureCount; ++i) {
- m_textureUniforms.append(glGetUniformLocation(m_program, strf("texture%s", i).c_str()));
- m_textureSizeUniforms.append(glGetUniformLocation(m_program, strf("textureSize%s", i).c_str()));
+ m_textureUniforms.append(glGetUniformLocation(m_program, strf("texture{}", i).c_str()));
+ m_textureSizeUniforms.append(glGetUniformLocation(m_program, strf("textureSize{}", i).c_str()));
}
m_screenSizeUniform = glGetUniformLocation(m_program, "screenSize");
m_vertexTransformUniform = glGetUniformLocation(m_program, "vertexTransform");
@@ -193,7 +193,7 @@ void OpenGl20Renderer::setEffectConfig(Json const& effectConfig, StringMap<Strin
effectParameter.parameterUniform = glGetUniformLocation(m_program, p.second.getString("uniform").utf8Ptr());
if (effectParameter.parameterUniform == -1) {
- Logger::warn("OpenGL20 effect parameter '%s' has no associated uniform, skipping", p.first);
+ Logger::warn("OpenGL20 effect parameter '{}' has no associated uniform, skipping", p.first);
} else {
String type = p.second.getString("type");
if (type == "bool") {
@@ -209,7 +209,7 @@ void OpenGl20Renderer::setEffectConfig(Json const& effectConfig, StringMap<Strin
} else if (type == "vec4") {
effectParameter.parameterType = RenderEffectParameter::typeIndexOf<Vec4F>();
} else {
- throw RendererException::format("Unrecognized effect parameter type '%s'", type);
+ throw RendererException::format("Unrecognized effect parameter type '{}'", type);
}
m_effectParameters[p.first] = effectParameter;
@@ -243,7 +243,7 @@ void OpenGl20Renderer::setEffectConfig(Json const& effectConfig, StringMap<Strin
EffectTexture effectTexture;
effectTexture.textureUniform = glGetUniformLocation(m_program, p.second.getString("textureUniform").utf8Ptr());
if (effectTexture.textureUniform == -1) {
- Logger::warn("OpenGL20 effect parameter '%s' has no associated uniform, skipping", p.first);
+ Logger::warn("OpenGL20 effect parameter '{}' has no associated uniform, skipping", p.first);
} else {
effectTexture.textureUnit = parameterTextureUnit++;
glUniform1i(effectTexture.textureUniform, effectTexture.textureUnit);
@@ -253,7 +253,7 @@ void OpenGl20Renderer::setEffectConfig(Json const& effectConfig, StringMap<Strin
if (auto tsu = p.second.optString("textureSizeUniform")) {
effectTexture.textureSizeUniform = glGetUniformLocation(m_program, tsu->utf8Ptr());
if (effectTexture.textureSizeUniform == -1)
- Logger::warn("OpenGL20 effect parameter '%s' has textureSizeUniform '%s' with no associated uniform", p.first, *tsu);
+ Logger::warn("OpenGL20 effect parameter '{}' has textureSizeUniform '{}' with no associated uniform", p.first, *tsu);
}
m_effectTextures[p.first] = effectTexture;
@@ -270,7 +270,7 @@ void OpenGl20Renderer::setEffectParameter(String const& parameterName, RenderEff
return;
if (ptr->parameterType != value.typeIndex())
- throw RendererException::format("OpenGL20Renderer::setEffectParameter '%s' parameter type mismatch", parameterName);
+ throw RendererException::format("OpenGL20Renderer::setEffectParameter '{}' parameter type mismatch", parameterName);
flushImmediatePrimitives();
@@ -354,7 +354,7 @@ TextureGroupPtr OpenGl20Renderer::createTextureGroup(TextureGroupSize textureSiz
else // TextureGroupSize::Small
atlasNumCells = 64;
- Logger::info("detected supported OpenGL texture size %s, using atlasNumCells %s", maxTextureSize, atlasNumCells);
+ Logger::info("detected supported OpenGL texture size {}, using atlasNumCells {}", maxTextureSize, atlasNumCells);
auto glTextureGroup = make_shared<GlTextureGroup>(atlasNumCells);
glTextureGroup->textureAtlasSet.textureFiltering = filtering;
diff --git a/source/application/StarStatisticsService_pc_steam.cpp b/source/application/StarStatisticsService_pc_steam.cpp
index 89239fd..bf74b7f 100644
--- a/source/application/StarStatisticsService_pc_steam.cpp
+++ b/source/application/StarStatisticsService_pc_steam.cpp
@@ -52,7 +52,7 @@ bool SteamStatisticsService::reportEvent(String const&, Json const&) {
bool SteamStatisticsService::unlockAchievement(String const& name) {
if (!SteamUserStats()->SetAchievement(name.utf8Ptr())) {
- Logger::error("Cannot set Steam achievement %s", name);
+ Logger::error("Cannot set Steam achievement {}", name);
return false;
}
return true;
@@ -94,7 +94,7 @@ void SteamStatisticsService::onUserStatsReceived(UserStatsReceived_t* callback)
return;
if (callback->m_eResult != k_EResultOK) {
- m_error = {strf("Steam RequestCurrentStats failed with code %d", (int)callback->m_eResult)};
+ m_error = {strf("Steam RequestCurrentStats failed with code {}", (int)callback->m_eResult)};
return;
}
@@ -117,14 +117,14 @@ void SteamStatisticsService::onUserStatsStored(UserStatsStored_t* callback) {
return;
}
- m_error = {strf("Steam StoreStats failed with code %d", (int)callback->m_eResult)};
+ m_error = {strf("Steam StoreStats failed with code {}", (int)callback->m_eResult)};
}
void SteamStatisticsService::onAchievementStored(UserAchievementStored_t* callback) {
if (callback->m_nGameID != m_appId)
return;
- Logger::debug("Steam achievement %s stored successfully", callback->m_rgchAchievementName);
+ Logger::debug("Steam achievement {} stored successfully", callback->m_rgchAchievementName);
}
}