diff options
Diffstat (limited to 'src/KingSystem/System/PlayReportMgr.cpp')
| -rw-r--r-- | src/KingSystem/System/PlayReportMgr.cpp | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/src/KingSystem/System/PlayReportMgr.cpp b/src/KingSystem/System/PlayReportMgr.cpp index 29f34e53..706535ca 100644 --- a/src/KingSystem/System/PlayReportMgr.cpp +++ b/src/KingSystem/System/PlayReportMgr.cpp @@ -1,7 +1,4 @@ #include "KingSystem/System/PlayReportMgr.h" -#include <nn/account.h> -#include <nn/prepo.h> -#include "KingSystem/System/Account.h" #include "KingSystem/System/ProductReporter.h" namespace ksys { @@ -47,97 +44,4 @@ void PlayReportMgr::setPlayerTrackReporter30() { reporter->_30 = true; } -bool PlayReport::setEventId(sead::BufferedSafeString& event_id) { - if (!mHasNinPrepoReport) - return false; - - event_id.replaceCharList("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"); - return mNinPlayReport->SetEventId(event_id.cstr()).IsSuccess(); -} - -[[gnu::noinline]] bool PlayReport::add(const sead::FixedSafeString<48>& key, u32 value) { - return mHasNinPrepoReport && mNinPlayReport->Add(key.cstr(), s64(value)).IsSuccess(); -} - -[[gnu::noinline]] bool PlayReport::add(const sead::FixedSafeString<48>& key, s32 value) { - return mHasNinPrepoReport && mNinPlayReport->Add(key.cstr(), s64(value)).IsSuccess(); -} - -[[gnu::noinline]] bool PlayReport::add(const sead::FixedSafeString<48>& key, f32 value) { - return mHasNinPrepoReport && mNinPlayReport->Add(key.cstr(), value).IsSuccess(); -} - -[[gnu::noinline]] bool PlayReport::add(const sead::FixedSafeString<48>& key, - const sead::SafeString& value) { - return mHasNinPrepoReport && mNinPlayReport->Add(key.cstr(), value.cstr()).IsSuccess(); -} - -void PlayReport::addPlayTimes() { - if (!gdt::Manager::instance()) - return; - - if (!PlayReportMgr::instance()) - return; - - if (!PlayReportMgr::instance()->getReporter()) - return; - - s32 playTime = - PlayReportMgr::instance()->getReporter()->getS32(PlayReportKey::PlayReport_PlayTime); - - s32 allPlayTime = - PlayReportMgr::instance()->getReporter()->getS32(PlayReportKey::PlayReport_AllPlayTime); - - add(sead::SafeString("PlayTime"), u32(playTime)); - add(sead::SafeString("AllPlayTime"), u32(allPlayTime)); -} - -void PlayReport::addPosition(const sead::Vector2f& position) { - add(sead::SafeString("PosX"), position.x); - add(sead::SafeString("PosZ"), position.y); -} - -bool PlayReport::save() { - if (!mHasNinPrepoReport) - return false; - - nn::account::Uid uid; - Account::instance()->getUserId(&uid); - if (uid.IsValid()) { - static_cast<void>(mNinPlayReport->GetCount()); - return mNinPlayReport->Save(uid).IsSuccess(); - } - static_cast<void>(ProductReporter::getSomeBool()); - static_cast<void>(mNinPlayReport->GetCount()); - return mNinPlayReport->Save().IsSuccess(); -} - -void PlayReport::init(s32 num_entries, sead::Heap* heap) { - if (mHasNinPrepoReport) - return; - - auto* report = new (heap) nn::prepo::PlayReport; - const u32 buffer_size = nn::prepo::PlayReport::CalcBufferSize(num_entries); - mNinPlayReport = report; - if (buffer_size > 0 && mBuffer.tryAllocBuffer(buffer_size, heap)) { - mNinPlayReport->SetBuffer(mBuffer.getBufferPtr(), buffer_size); - mHasNinPrepoReport = true; - } -} - -PlayReport::~PlayReport() { - if (!mHasNinPrepoReport) - return; - - if (mNinPlayReport) { - delete mNinPlayReport; - mNinPlayReport = nullptr; - } - - if (mHasNinPrepoReport) - mBuffer.freeBuffer(); - - mHasNinPrepoReport = false; -} - } // namespace ksys |
