summaryrefslogtreecommitdiff
path: root/src/KingSystem/System
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2026-09-28 03:39:31 +0200
committerLéo Lam <leo@leolam.fr>2026-10-13 01:53:08 +0200
commitfa2b8b7d4738e5ee098fc105adc60e10356dd410 (patch)
tree2c8e3a8180401385f6e24c1e26ac58ef839d30c6 /src/KingSystem/System
parentb26086477c7d8897c76e328c89d718b3c02a9ae9 (diff)
Move code to the TUs that match link order and rename files
Rename classes and files so that they sort where their code is linked, and move code that is linked inside another TU into that TU's file. | Old | New | TU start | |---|---|---| | ActorAreaInOutSendMessage | AreaInOutSendMessage | 0x710009fa64 | | AreaTagAction | AreaActionBase | 0x7100e21e64 | | sndResource.{h,cpp} | sndSound.{h,cpp} | | | Code | From | To | |---|---|---| | SoundMgr | sndMgr.h | sndSound.h | | PlayReport | PlayReportMgr.cpp | PlayReport.cpp | | PlayReport::addPlayTimes, addPosition | PlayReportMgr.cpp | ProductReporter.cpp | (AI assisted using Claude Fable 5.1 and Claude Opus 5.5)
Diffstat (limited to 'src/KingSystem/System')
-rw-r--r--src/KingSystem/System/CMakeLists.txt1
-rw-r--r--src/KingSystem/System/OverlayArenaSystem.cpp2
-rw-r--r--src/KingSystem/System/PlayReport.cpp77
-rw-r--r--src/KingSystem/System/PlayReportMgr.cpp96
-rw-r--r--src/KingSystem/System/ProductReporter.cpp27
5 files changed, 105 insertions, 98 deletions
diff --git a/src/KingSystem/System/CMakeLists.txt b/src/KingSystem/System/CMakeLists.txt
index a2eb28ba..333d110d 100644
--- a/src/KingSystem/System/CMakeLists.txt
+++ b/src/KingSystem/System/CMakeLists.txt
@@ -39,6 +39,7 @@ target_sources(uking PRIVATE
OverlayArenaSystemS2.h
Patrol.cpp
Patrol.h
+ PlayReport.cpp
PlayReportMgr.cpp
PlayReportMgr.h
ProductReporter.cpp
diff --git a/src/KingSystem/System/OverlayArenaSystem.cpp b/src/KingSystem/System/OverlayArenaSystem.cpp
index 82a59aaf..206aa1de 100644
--- a/src/KingSystem/System/OverlayArenaSystem.cpp
+++ b/src/KingSystem/System/OverlayArenaSystem.cpp
@@ -4,7 +4,7 @@
#include <heap/seadHeap.h>
#include <thread/seadThreadUtil.h>
#include "KingSystem/Resource/resSystem.h"
-#include "KingSystem/Sound/sndResource.h"
+#include "KingSystem/Sound/sndSound.h"
#include "KingSystem/System/OverlayArena.h"
#include "KingSystem/Terrain/teraSystem.h"
#include "KingSystem/Utils/Thread/Task.h"
diff --git a/src/KingSystem/System/PlayReport.cpp b/src/KingSystem/System/PlayReport.cpp
new file mode 100644
index 00000000..1ff33d08
--- /dev/null
+++ b/src/KingSystem/System/PlayReport.cpp
@@ -0,0 +1,77 @@
+#include <nn/account.h>
+#include <nn/prepo.h>
+#include "KingSystem/System/Account.h"
+#include "KingSystem/System/PlayReportMgr.h"
+#include "KingSystem/System/ProductReporter.h"
+
+namespace ksys {
+
+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();
+}
+
+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
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
diff --git a/src/KingSystem/System/ProductReporter.cpp b/src/KingSystem/System/ProductReporter.cpp
index 4812734a..194a0b91 100644
--- a/src/KingSystem/System/ProductReporter.cpp
+++ b/src/KingSystem/System/ProductReporter.cpp
@@ -9,7 +9,7 @@
#include "KingSystem/Camera/CameraMgr.h"
#include "KingSystem/Framework/frmFramework.h"
#include "KingSystem/Map/mapPlacementMgr.h"
-#include "KingSystem/Sound/sndMgr.h"
+#include "KingSystem/Sound/sndSound.h"
#include "KingSystem/System/PlayReportMgr.h"
#include "KingSystem/System/VFR.h"
@@ -220,6 +220,31 @@ bool ProductReporter::incrementSceneAndRomWorkTime() {
return true;
}
+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);
+}
+
#define PRODUCT_REPORTER_S32_GETTER(NAME, PLAY_REPORT_KEY) \
s32 ProductReporter::NAME() const { \
s32 out = 0; \