diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 1dcd13c4a..6e72d0ed2 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -61188,7 +61188,7 @@ Address,Quality,Size,Name 0x0000007100a8885c,U,000528,uking::reportGanonQuestFinished 0x0000007100a88a6c,U,001740,uking::reportGameOver 0x0000007100a89138,U,001384,uking::reportBloodMoon -0x0000007100a896a0,U,000852,uking::reportGetItem +0x0000007100a896a0,O,000852,_ZN5uking13reportGetItemERKN4sead7Vector3IfEERKNS0_14SafeStringBaseIcEE 0x0000007100a899f4,U,008496,uking::reportOptionsFromTitleStage 0x0000007100a8bb24,U,000176,PosTrackerUploader::dtor 0x0000007100a8bbd4,U,000184,PosTrackerUploader::dtorDelete diff --git a/src/Game/gamePlayReport.cpp b/src/Game/gamePlayReport.cpp index 2c882f168..cf9b5cf2e 100644 --- a/src/Game/gamePlayReport.cpp +++ b/src/Game/gamePlayReport.cpp @@ -9,6 +9,8 @@ namespace uking { +int convertPositionToInt(const sead::Vector2i& pos); + void reportKorok(const sead::Vector3f& position) { ksys::ProductReporter::getSomeBool(); s32 id = ksys::gdt::getFlag_HiddenKorok_Number(); @@ -236,6 +238,30 @@ unsigned int getQuestId(const sead::SafeString& quest_name) { return 0; } +void reportGetItem(const sead::Vector3f& pos, const sead::SafeString& item_name) { + ksys::ProductReporter::getSomeBool(); + PlayReport report(sead::SafeString("getitem"), 7, + ksys::PlayReportMgr::instance()->getReporter()->getHeap()); + report.addMapType(); + + auto name = static_cast(sead::HashCRC32::calcStringHash(item_name)); + + ksys::ProductReporter::getSomeBool(); + + report.add(sead::SafeString("name"), name); + + int position = convertPositionToInt({int(pos.x), int(pos.y)}); + + report.add(sead::SafeString("Position"), position); + report.addPlayTimes(); + + if (ksys::PlayReportMgr::instance()) { + auto* reporter = ksys::PlayReportMgr::instance()->getReporter(); + if (reporter && reporter->isEnabled()) + reporter->saveReport(&report); + } +} + void reportQuestStep(const ksys::qst::Quest* quest, int step_index) { if (quest && step_index >= 0 && step_index < quest->mSteps.size()) { const sead::SafeString& name = quest->mName; @@ -262,6 +288,7 @@ void reportQuestStep(const ksys::qst::Quest* quest, int step_index) { } } } + PlayReport::PlayReport(const sead::FixedSafeString<32>& event_id, s32 num_entries, sead::Heap* heap) : ksys::PlayReport(event_id, num_entries, heap) {} diff --git a/src/Game/gamePlayReport.h b/src/Game/gamePlayReport.h index c6a188fda..bb3365208 100644 --- a/src/Game/gamePlayReport.h +++ b/src/Game/gamePlayReport.h @@ -6,11 +6,14 @@ namespace ksys::qst { struct Quest; } + namespace uking { void reportKorok(const sead::Vector3f& position); void reportDungeon(const sead::SafeString& name, const sead::SafeString& event); void reportQuestStep(const ksys::qst::Quest* quest, int step_index); +void reportGetItem(const sead::Vector3f& pos, const sead::SafeString& item_name); + // TODO: More functions class PlayReport : public ksys::PlayReport {