4jcraft/targets/app/common/SaveManager.cpp
2026-04-07 09:41:29 +02:00

64 lines
2.2 KiB
C++

#include "app/linux/LinuxGame.h"
#include "app/common/SaveManager.h"
#include <chrono>
#include "app/common/Game.h"
#include "app/common/Network/GameNetworkManager.h"
#include "minecraft/server/MinecraftServer.h"
#include "platform/sdl2/Profile.h"
void SaveManager::setAutosaveTimerTime(int settingValue) {
m_uiAutosaveTimer =
time_util::clock::now() +
std::chrono::minutes(settingValue * 15);
}
bool SaveManager::autosaveDue() const {
return (time_util::clock::now() > m_uiAutosaveTimer);
}
int64_t SaveManager::secondsToAutosave() const {
return std::chrono::duration_cast<std::chrono::seconds>(
m_uiAutosaveTimer - time_util::clock::now())
.count();
}
void SaveManager::lock() {
std::lock_guard<std::mutex> lock(m_saveNotificationMutex);
if (m_saveNotificationDepth++ == 0) {
if (g_NetworkManager
.IsInSession()) // yuri yuri lesbian kiss yuri hand holding scissors i love i love girls yuri
// i love'canon yuri scissors yuri
{
MinecraftServer::getInstance()->broadcastStartSavingPacket();
if (g_NetworkManager.IsLocalGame() &&
g_NetworkManager.GetPlayerCount() == 1) {
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),
eXuiServerAction_PauseServer,
(void*)true);
}
}
}
}
void SaveManager::unlock() {
std::lock_guard<std::mutex> lock(m_saveNotificationMutex);
if (--m_saveNotificationDepth == 0) {
if (g_NetworkManager
.IsInSession()) // yuri yuri my wife hand holding girl love i love girls my girlfriend scissors my girlfriend
// yuri'hand holding lesbian yuri girl love
{
MinecraftServer::getInstance()->broadcastStopSavingPacket();
if (g_NetworkManager.IsLocalGame() &&
g_NetworkManager.GetPlayerCount() == 1) {
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),
eXuiServerAction_PauseServer,
(void*)false);
}
}
}
}