From 0b0d8538c9b58349ee5ff8429d46345dd410cd74 Mon Sep 17 00:00:00 2001 From: trixie Date: Mon, 22 Apr 2024 17:38:58 -0400 Subject: [PATCH 1/8] add reportGetItem add reportGetItem --- data/uking_functions.csv | 2 +- src/Game/gamePlayReport.cpp | 32 ++++++++++++++++++++++++++++++++ src/Game/gamePlayReport.h | 1 + 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 1dcd13c4a..8b840a54c 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,_ZN5uking13reportGetItemERKN4sead7Vector3IfEEPKNS0_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..51991a5d5 100644 --- a/src/Game/gamePlayReport.cpp +++ b/src/Game/gamePlayReport.cpp @@ -9,6 +9,12 @@ namespace uking { +<<<<<<< HEAD +======= +unsigned int getQuestId(const sead::SafeString& quest_name); +int positionFunc(const sead::Vector2i& pos); + +>>>>>>> cda9dce7 (add reportGetItem) void reportKorok(const sead::Vector3f& position) { ksys::ProductReporter::getSomeBool(); s32 id = ksys::gdt::getFlag_HiddenKorok_Number(); @@ -52,6 +58,7 @@ void reportDungeon(const sead::SafeString& name, const sead::SafeString& event) } } +<<<<<<< HEAD unsigned int getQuestId(const sead::SafeString& quest_name) { const sead::SafeString names[] = { "UnknownEvent", @@ -234,6 +241,30 @@ unsigned int getQuestId(const sead::SafeString& quest_name) { } } return 0; +======= +void reportGetItem(const sead::Vector3f& pos, const sead::SafeString* targetActorName) { + ksys::ProductReporter::getSomeBool(); + PlayReport report(sead::SafeString("getitem"), 7, + ksys::PlayReportMgr::instance()->getReporter()->getHeap()); + report.addMapType(); + + int name = sead::HashCRC32::calcStringHash(*targetActorName); + + ksys::ProductReporter::getSomeBool(); + + report.add(sead::SafeString("name"), name); + + int position = positionFunc({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); + } +>>>>>>> cda9dce7 (add reportGetItem) } void reportQuestStep(const ksys::qst::Quest* quest, int step_index) { @@ -262,6 +293,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..c2e5462fd 100644 --- a/src/Game/gamePlayReport.h +++ b/src/Game/gamePlayReport.h @@ -11,6 +11,7 @@ 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* targetActorName); // TODO: More functions class PlayReport : public ksys::PlayReport { From c7b722212a34230e71ddaeb7669848fbc297e7ee Mon Sep 17 00:00:00 2001 From: trixie Date: Mon, 22 Apr 2024 18:07:04 -0400 Subject: [PATCH 2/8] add reportGetItem --- src/Game/gamePlayReport.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Game/gamePlayReport.cpp b/src/Game/gamePlayReport.cpp index 51991a5d5..2541159b2 100644 --- a/src/Game/gamePlayReport.cpp +++ b/src/Game/gamePlayReport.cpp @@ -248,7 +248,7 @@ void reportGetItem(const sead::Vector3f& pos, const sead::SafeString* targetActo ksys::PlayReportMgr::instance()->getReporter()->getHeap()); report.addMapType(); - int name = sead::HashCRC32::calcStringHash(*targetActorName); + int name = (int)sead::HashCRC32::calcStringHash(*targetActorName); ksys::ProductReporter::getSomeBool(); From 594fa8a03666153a70fc80207e17c5e2b0c41595 Mon Sep 17 00:00:00 2001 From: trixie Date: Mon, 22 Apr 2024 18:25:35 -0400 Subject: [PATCH 3/8] trying to fix things --- src/Game/gamePlayReport.h | 2 ++ tools/common | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Game/gamePlayReport.h b/src/Game/gamePlayReport.h index c2e5462fd..19406ed4f 100644 --- a/src/Game/gamePlayReport.h +++ b/src/Game/gamePlayReport.h @@ -6,12 +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* targetActorName); + // TODO: More functions class PlayReport : public ksys::PlayReport { diff --git a/tools/common b/tools/common index 3217db1ed..795289ef9 160000 --- a/tools/common +++ b/tools/common @@ -1 +1 @@ -Subproject commit 3217db1ed4db73165b0d2d6f424e9a0a2a0e08fc +Subproject commit 795289ef92e728ec535fa981b531da6768931d3a From d95b708359c0fb0ef351e836738e342a63074ebc Mon Sep 17 00:00:00 2001 From: trixie Date: Mon, 22 Apr 2024 18:41:04 -0400 Subject: [PATCH 4/8] add reportGetItem --- src/Game/gamePlayReport.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Game/gamePlayReport.cpp b/src/Game/gamePlayReport.cpp index 2541159b2..029131fb4 100644 --- a/src/Game/gamePlayReport.cpp +++ b/src/Game/gamePlayReport.cpp @@ -9,12 +9,9 @@ namespace uking { -<<<<<<< HEAD -======= unsigned int getQuestId(const sead::SafeString& quest_name); int positionFunc(const sead::Vector2i& pos); ->>>>>>> cda9dce7 (add reportGetItem) void reportKorok(const sead::Vector3f& position) { ksys::ProductReporter::getSomeBool(); s32 id = ksys::gdt::getFlag_HiddenKorok_Number(); @@ -58,7 +55,6 @@ void reportDungeon(const sead::SafeString& name, const sead::SafeString& event) } } -<<<<<<< HEAD unsigned int getQuestId(const sead::SafeString& quest_name) { const sead::SafeString names[] = { "UnknownEvent", @@ -241,7 +237,8 @@ unsigned int getQuestId(const sead::SafeString& quest_name) { } } return 0; -======= +} + void reportGetItem(const sead::Vector3f& pos, const sead::SafeString* targetActorName) { ksys::ProductReporter::getSomeBool(); PlayReport report(sead::SafeString("getitem"), 7, @@ -264,7 +261,6 @@ void reportGetItem(const sead::Vector3f& pos, const sead::SafeString* targetActo if (reporter && reporter->isEnabled()) reporter->saveReport(&report); } ->>>>>>> cda9dce7 (add reportGetItem) } void reportQuestStep(const ksys::qst::Quest* quest, int step_index) { @@ -294,7 +290,8 @@ void reportQuestStep(const ksys::qst::Quest* quest, int step_index) { } } -PlayReport::PlayReport(const sead::FixedSafeString<32>& event_id, s32 num_entries, sead::Heap* heap) +PlayReport::PlayReport(const sead::FixedSafeString<32>& event_id, s32 num_entries, + sead::Heap* heap) : ksys::PlayReport(event_id, num_entries, heap) {} void PlayReport::addMapType() { From 5f7c8885be60716c4c93ef0de5d625b166bda679 Mon Sep 17 00:00:00 2001 From: trixie Date: Mon, 22 Apr 2024 18:46:11 -0400 Subject: [PATCH 5/8] why does clang-format hate me --- src/Game/gamePlayReport.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Game/gamePlayReport.cpp b/src/Game/gamePlayReport.cpp index 029131fb4..b0ce3523a 100644 --- a/src/Game/gamePlayReport.cpp +++ b/src/Game/gamePlayReport.cpp @@ -290,8 +290,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) +PlayReport::PlayReport(const sead::FixedSafeString<32>& event_id, s32 num_entries, sead::Heap* heap) : ksys::PlayReport(event_id, num_entries, heap) {} void PlayReport::addMapType() { From f7b427f9ef510575dcbdb19e73b3a5da2b1158fc Mon Sep 17 00:00:00 2001 From: trixie Date: Mon, 22 Apr 2024 19:14:16 -0400 Subject: [PATCH 6/8] review changes --- src/Game/gamePlayReport.cpp | 9 ++++----- src/Game/gamePlayReport.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Game/gamePlayReport.cpp b/src/Game/gamePlayReport.cpp index b0ce3523a..cf9b5cf2e 100644 --- a/src/Game/gamePlayReport.cpp +++ b/src/Game/gamePlayReport.cpp @@ -9,8 +9,7 @@ namespace uking { -unsigned int getQuestId(const sead::SafeString& quest_name); -int positionFunc(const sead::Vector2i& pos); +int convertPositionToInt(const sead::Vector2i& pos); void reportKorok(const sead::Vector3f& position) { ksys::ProductReporter::getSomeBool(); @@ -239,19 +238,19 @@ unsigned int getQuestId(const sead::SafeString& quest_name) { return 0; } -void reportGetItem(const sead::Vector3f& pos, const sead::SafeString* targetActorName) { +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(); - int name = (int)sead::HashCRC32::calcStringHash(*targetActorName); + auto name = static_cast(sead::HashCRC32::calcStringHash(item_name)); ksys::ProductReporter::getSomeBool(); report.add(sead::SafeString("name"), name); - int position = positionFunc({int(pos.x), int(pos.y)}); + int position = convertPositionToInt({int(pos.x), int(pos.y)}); report.add(sead::SafeString("Position"), position); report.addPlayTimes(); diff --git a/src/Game/gamePlayReport.h b/src/Game/gamePlayReport.h index 19406ed4f..bb3365208 100644 --- a/src/Game/gamePlayReport.h +++ b/src/Game/gamePlayReport.h @@ -12,7 +12,7 @@ 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* targetActorName); +void reportGetItem(const sead::Vector3f& pos, const sead::SafeString& item_name); // TODO: More functions From 336a446fb67cbde411baf8b41bd366d16a444778 Mon Sep 17 00:00:00 2001 From: trixie Date: Mon, 22 Apr 2024 19:16:46 -0400 Subject: [PATCH 7/8] might work now --- data/uking_functions.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 8b840a54c..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,O,000852,_ZN5uking13reportGetItemERKN4sead7Vector3IfEEPKNS0_14SafeStringBaseIcEE +0x0000007100a896a0,O,000852,_ZN5uking13reportGetItemERKN4sead7Vector3IfEERKNS0_14SafeStringBaseIcEE 0x0000007100a899f4,U,008496,uking::reportOptionsFromTitleStage 0x0000007100a8bb24,U,000176,PosTrackerUploader::dtor 0x0000007100a8bbd4,U,000184,PosTrackerUploader::dtorDelete From 370555150cc1686884471845749834b203f445c1 Mon Sep 17 00:00:00 2001 From: trixie Date: Mon, 22 Apr 2024 19:35:57 -0400 Subject: [PATCH 8/8] revert tools update --- tools/common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/common b/tools/common index 795289ef9..3217db1ed 160000 --- a/tools/common +++ b/tools/common @@ -1 +1 @@ -Subproject commit 795289ef92e728ec535fa981b531da6768931d3a +Subproject commit 3217db1ed4db73165b0d2d6f424e9a0a2a0e08fc