mirror of https://github.com/zeldaret/botw.git
ksys: Start adding PlayReport
This commit is contained in:
parent
89137d9834
commit
2b26a9bb76
|
@ -82337,14 +82337,14 @@
|
|||
0x0000007100fd0ddc,sub_7100FD0DDC,936,
|
||||
0x0000007100fd1184,sub_7100FD1184,236,
|
||||
0x0000007100fd1270,sub_7100FD1270,32,
|
||||
0x0000007100fd1290,PlayReport::Report::setEventId,432,
|
||||
0x0000007100fd1440,PlayReport::Report::addUInt,100,
|
||||
0x0000007100fd14a4,PlayReport::Report::addInt,100,
|
||||
0x0000007100fd1508,PlayReport::Report::addFloat,100,
|
||||
0x0000007100fd156c,PlayReport::Report::addString,120,
|
||||
0x0000007100fd15e4,PlayReport::Report::saveReport,140,
|
||||
0x0000007100fd1670,PlayReport::Report::createPrepoReport,164,
|
||||
0x0000007100fd1714,PlayReport::Report::dtor,84,
|
||||
0x0000007100fd1290,PlayReport::Report::setEventId,432,_ZN4ksys10PlayReport10setEventIdERN4sead22BufferedSafeStringBaseIcEE
|
||||
0x0000007100fd1440,PlayReport::Report::addUInt,100,_ZN4ksys10PlayReport3addERKN4sead14SafeStringBaseIcEEj
|
||||
0x0000007100fd14a4,PlayReport::Report::addInt,100,_ZN4ksys10PlayReport3addERKN4sead14SafeStringBaseIcEEi
|
||||
0x0000007100fd1508,PlayReport::Report::addFloat,100,_ZN4ksys10PlayReport3addERKN4sead14SafeStringBaseIcEEf
|
||||
0x0000007100fd156c,PlayReport::Report::addString,120,_ZN4ksys10PlayReport3addERKN4sead14SafeStringBaseIcEES5_
|
||||
0x0000007100fd15e4,PlayReport::Report::saveReport,140,_ZN4ksys10PlayReport4saveEv
|
||||
0x0000007100fd1670,PlayReport::Report::createPrepoReport,164,_ZN4ksys10PlayReport4initEiPN4sead4HeapE
|
||||
0x0000007100fd1714,PlayReport::Report::dtor,84,_ZN4ksys10PlayReportD1Ev
|
||||
0x0000007100fd1768,sub_7100FD1768,32,
|
||||
0x0000007100fd1788,playReportGetSomeBool,12,
|
||||
0x0000007100fd1794,ProductReporter::isInitialized,8,
|
||||
|
@ -82378,11 +82378,11 @@
|
|||
0x0000007100fd362c,j__ZdlPv_1018,4,
|
||||
0x0000007100fd3630,_ZN4sead15FixedSafeStringILi138EEaSERKNS_14SafeStringBaseIcEE,240,
|
||||
0x0000007100fd3720,sub_7100FD3720,44,
|
||||
0x0000007100fd374c,sub_7100FD374C,100,
|
||||
0x0000007100fd37b0,sub_7100FD37B0,108,
|
||||
0x0000007100fd381c,PlayReport::createInstance,156,
|
||||
0x0000007100fd38b8,sub_7100FD38B8,40,
|
||||
0x0000007100fd38e0,sub_7100FD38E0,68,
|
||||
0x0000007100fd374c,sub_7100FD374C,100,_ZN4ksys13PlayReportMgr18SingletonDisposer_D2Ev
|
||||
0x0000007100fd37b0,sub_7100FD37B0,108,_ZN4ksys13PlayReportMgr18SingletonDisposer_D0Ev
|
||||
0x0000007100fd381c,PlayReport::createInstance,156,_ZN4ksys13PlayReportMgr14createInstanceEPN4sead4HeapE
|
||||
0x0000007100fd38b8,sub_7100FD38B8,40,_ZN4ksys13PlayReportMgrD1Ev
|
||||
0x0000007100fd38e0,sub_7100FD38E0,68,_ZN4ksys13PlayReportMgrD0Ev
|
||||
0x0000007100fd3924,PlayReport::init,264,
|
||||
0x0000007100fd3a2c,PlayReport::calc,24,
|
||||
0x0000007100fd3a44,PlayReport::__auto0,8,
|
||||
|
|
Can't render this file because it is too large.
|
|
@ -1 +1 @@
|
|||
Subproject commit 3765a6afa665dc9e787a50e46e70614a0b88ff4f
|
||||
Subproject commit cc79d90ed3632e019fe39d95e945be4cf63e7d9b
|
2
lib/sead
2
lib/sead
|
@ -1 +1 @@
|
|||
Subproject commit 8edaa1b2f55eac91301db8231285668b7d8c7b33
|
||||
Subproject commit bb63f3f5d6fc1d68e543cf76a7920006eff70910
|
|
@ -7,6 +7,10 @@ target_sources(uking PRIVATE
|
|||
OverlayArenaSystem.h
|
||||
OverlayArenaSystemS1.h
|
||||
OverlayArenaSystemS2.h
|
||||
PlayReportMgr.cpp
|
||||
PlayReportMgr.h
|
||||
ProductReporter.cpp
|
||||
ProductReporter.h
|
||||
StringBoard.h
|
||||
SystemPauseMgr.cpp
|
||||
SystemPauseMgr.h
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
#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 {
|
||||
|
||||
SEAD_SINGLETON_DISPOSER_IMPL(PlayReportMgr)
|
||||
|
||||
PlayReportMgr::~PlayReportMgr() {
|
||||
if (mReporter)
|
||||
delete mReporter;
|
||||
}
|
||||
|
||||
bool PlayReport::setEventId(sead::BufferedSafeString& event_id) {
|
||||
if (!mHasNinPrepoReport)
|
||||
return false;
|
||||
|
||||
event_id.replaceCharList("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz");
|
||||
return mNinPlayReport->SetEventId(event_id.cstr()).IsSuccess();
|
||||
}
|
||||
|
||||
bool PlayReport::add(const sead::SafeString& key, u32 value) {
|
||||
return mHasNinPrepoReport && mNinPlayReport->Add(key.cstr(), s64(value)).IsSuccess();
|
||||
}
|
||||
|
||||
bool PlayReport::add(const sead::SafeString& key, s32 value) {
|
||||
return mHasNinPrepoReport && mNinPlayReport->Add(key.cstr(), s64(value)).IsSuccess();
|
||||
}
|
||||
|
||||
bool PlayReport::add(const sead::SafeString& key, f32 value) {
|
||||
return mHasNinPrepoReport && mNinPlayReport->Add(key.cstr(), value).IsSuccess();
|
||||
}
|
||||
|
||||
bool PlayReport::add(const sead::SafeString& key, const sead::SafeString& value) {
|
||||
return mHasNinPrepoReport && mNinPlayReport->Add(key.cstr(), value.cstr()).IsSuccess();
|
||||
}
|
||||
|
||||
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
|
|
@ -0,0 +1,68 @@
|
|||
#pragma once
|
||||
|
||||
#include <container/seadBuffer.h>
|
||||
#include <heap/seadDisposer.h>
|
||||
#include <prim/seadSafeString.h>
|
||||
#include "KingSystem/Utils/Types.h"
|
||||
|
||||
namespace nn::prepo {
|
||||
class PlayReport;
|
||||
}
|
||||
|
||||
namespace ksys {
|
||||
|
||||
namespace act {
|
||||
class PlayerLink;
|
||||
}
|
||||
|
||||
class ProductReporter;
|
||||
|
||||
class PlayReportMgr {
|
||||
SEAD_SINGLETON_DISPOSER(PlayReportMgr)
|
||||
virtual ~PlayReportMgr();
|
||||
|
||||
public:
|
||||
void init(sead::Heap* heap);
|
||||
|
||||
void calc();
|
||||
|
||||
ProductReporter* getReporter() const { return mReporter; }
|
||||
|
||||
bool get30() const { return _30; }
|
||||
void set30(bool arg_30) { _30 = arg_30; }
|
||||
|
||||
private:
|
||||
ProductReporter* mReporter = nullptr;
|
||||
bool _30 = false;
|
||||
act::PlayerLink* mPlayerLink = nullptr;
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(PlayReportMgr, 0x40);
|
||||
|
||||
class PlayReport {
|
||||
public:
|
||||
PlayReport(const sead::SafeString& event_id, s32 num_entries, sead::Heap* heap) {
|
||||
init(num_entries, heap);
|
||||
sead::FixedSafeString<32> event_id_;
|
||||
event_id_.cutOffCopy(event_id);
|
||||
setEventId(event_id_);
|
||||
}
|
||||
|
||||
~PlayReport();
|
||||
|
||||
bool setEventId(sead::BufferedSafeString& event_id);
|
||||
bool add(const sead::SafeString& key, u32 value);
|
||||
bool add(const sead::SafeString& key, s32 value);
|
||||
bool add(const sead::SafeString& key, f32 value);
|
||||
bool add(const sead::SafeString& key, const sead::SafeString& value);
|
||||
bool save();
|
||||
|
||||
private:
|
||||
void init(s32 num_entries, sead::Heap* heap);
|
||||
|
||||
bool mHasNinPrepoReport = false;
|
||||
nn::prepo::PlayReport* mNinPlayReport = nullptr;
|
||||
sead::Buffer<u8> mBuffer;
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(PlayReport, 0x20);
|
||||
|
||||
} // namespace ksys
|
|
@ -0,0 +1 @@
|
|||
#include "KingSystem/System/ProductReporter.h"
|
|
@ -0,0 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
namespace ksys {
|
||||
|
||||
// FIXME: incomplete; requires GameData
|
||||
class ProductReporter {
|
||||
public:
|
||||
ProductReporter() = default;
|
||||
virtual ~ProductReporter();
|
||||
|
||||
static bool getSomeBool();
|
||||
};
|
||||
|
||||
} // namespace ksys
|
Loading…
Reference in New Issue