From e339810462f84cc780b857b30811a1fff01562d7 Mon Sep 17 00:00:00 2001 From: trixie Date: Sun, 21 Apr 2024 19:32:39 -0400 Subject: [PATCH 1/7] add reportQuestStep --- data/uking_functions.csv | 2 +- src/Game/gamePlayReport.cpp | 23 +++++++++++++++++++++-- src/Game/gamePlayReport.h | 6 ++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/data/uking_functions.csv b/data/uking_functions.csv index b66ed8d92..638df4181 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -61183,7 +61183,7 @@ Address,Quality,Size,Name 0x0000007100a86ec8,O,000360,_ZN5uking10PlayReportC1ERKN4sead15FixedSafeStringILi32EEEiPNS1_4HeapE 0x0000007100a87030,O,001116,_ZN5uking10PlayReport10addMapTypeEv 0x0000007100a8748c,O,000908,_ZN5uking13reportDungeonERKN4sead14SafeStringBaseIcEES4_ -0x0000007100a87818,U,001256,uking::reportQuestEvent +0x0000007100a87818,U,001256,uking::reportQuestStep 0x0000007100a87d00,U,002908,getQuestId 0x0000007100a8885c,U,000528,uking::reportGanonQuestFinished 0x0000007100a88a6c,U,001740,uking::reportGameOver diff --git a/src/Game/gamePlayReport.cpp b/src/Game/gamePlayReport.cpp index 865668475..896e4c4a9 100644 --- a/src/Game/gamePlayReport.cpp +++ b/src/Game/gamePlayReport.cpp @@ -5,7 +5,7 @@ #include "KingSystem/GameData/gdtTriggerParam.h" #include "KingSystem/System/ProductReporter.h" #include "KingSystem/System/StageInfo.h" - +#include "KingSystem/Quest/qstQuest.h" namespace uking { void reportKorok(const sead::Vector3f& position) { @@ -30,7 +30,6 @@ void reportKorok(const sead::Vector3f& position) { void reportDungeon(const sead::SafeString& name, const sead::SafeString& event) { ksys::ProductReporter::getSomeBool(); - if (name.findIndex("Remains") == -1 && name.findIndex("Dungeon") == -1 && name.findIndex("FinalTrial") == -1) return; @@ -51,7 +50,27 @@ void reportDungeon(const sead::SafeString& name, const sead::SafeString& event) reporter->saveReport(&report); } } +void reportQuestStep(const ksys::qst::Quest* quest, int step_index) { + + ksys::ProductReporter::getSomeBool(); + const sead::SafeString quest_name = quest->mName; + // TODO + int getQuestId(const sead::SafeString& quest_name); + + PlayReport report(sead::SafeString("challenge"), 7, ksys::PlayReportMgr::instance()->getReporter()->getHeap()); + + report.addMapType(); + report.add(sead::SafeString("Step"), step_index); + report.add(sead::SafeString("Name"), quest_name); + report.addPlayTimes(); + + if (ksys::PlayReportMgr::instance()) { + auto* reporter = ksys::PlayReportMgr::instance()->getReporter(); + if (reporter && reporter->isEnabled()) + reporter->saveReport(&report); + } +} 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 edce5191b..58f2abe35 100644 --- a/src/Game/gamePlayReport.h +++ b/src/Game/gamePlayReport.h @@ -2,12 +2,14 @@ #include #include "KingSystem/System/PlayReportMgr.h" - +namespace ksys::qst { +class 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); // TODO: More functions class PlayReport : public ksys::PlayReport { From ddac569402945b5cfc16885093d0ccb8a6d1fa62 Mon Sep 17 00:00:00 2001 From: trixie Date: Sun, 21 Apr 2024 20:00:42 -0400 Subject: [PATCH 2/7] change reportQuestStep --- data/uking_functions.csv | 2 +- src/Game/gamePlayReport.cpp | 34 ++++++++++++++++++++-------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 638df4181..266c6d39b 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -61183,7 +61183,7 @@ Address,Quality,Size,Name 0x0000007100a86ec8,O,000360,_ZN5uking10PlayReportC1ERKN4sead15FixedSafeStringILi32EEEiPNS1_4HeapE 0x0000007100a87030,O,001116,_ZN5uking10PlayReport10addMapTypeEv 0x0000007100a8748c,O,000908,_ZN5uking13reportDungeonERKN4sead14SafeStringBaseIcEES4_ -0x0000007100a87818,U,001256,uking::reportQuestStep +0x0000007100a87818,W,001256,_ZN5uking15reportQuestStepEPKN4ksys3qst5QuestEi 0x0000007100a87d00,U,002908,getQuestId 0x0000007100a8885c,U,000528,uking::reportGanonQuestFinished 0x0000007100a88a6c,U,001740,uking::reportGameOver diff --git a/src/Game/gamePlayReport.cpp b/src/Game/gamePlayReport.cpp index 896e4c4a9..3bd593f5f 100644 --- a/src/Game/gamePlayReport.cpp +++ b/src/Game/gamePlayReport.cpp @@ -7,7 +7,7 @@ #include "KingSystem/System/StageInfo.h" #include "KingSystem/Quest/qstQuest.h" namespace uking { - +int getQuestId(const sead::SafeString& quest_name); void reportKorok(const sead::Vector3f& position) { ksys::ProductReporter::getSomeBool(); s32 id = ksys::gdt::getFlag_HiddenKorok_Number(); @@ -51,25 +51,31 @@ void reportDungeon(const sead::SafeString& name, const sead::SafeString& event) } } void reportQuestStep(const ksys::qst::Quest* quest, int step_index) { + if (quest && (step_index >= 0) == 0 && quest->mSteps.size() > step_index) { + ksys::ProductReporter::getSomeBool(); - ksys::ProductReporter::getSomeBool(); - const sead::SafeString quest_name = quest->mName; - // TODO - int getQuestId(const sead::SafeString& quest_name); + const sead::SafeString step_name = quest->mSteps[step_index]->name; + const sead::SafeString quest_name = quest->mName; + const int quest_id = getQuestId(quest_name); - PlayReport report(sead::SafeString("challenge"), 7, ksys::PlayReportMgr::instance()->getReporter()->getHeap()); - report.addMapType(); - report.add(sead::SafeString("Step"), step_index); - report.add(sead::SafeString("Name"), quest_name); - report.addPlayTimes(); + PlayReport report(sead::SafeString("challenge"), 7, ksys::PlayReportMgr::instance()->getReporter()->getHeap()); - if (ksys::PlayReportMgr::instance()) { - auto* reporter = ksys::PlayReportMgr::instance()->getReporter(); - if (reporter && reporter->isEnabled()) - reporter->saveReport(&report); + report.addMapType(); + report.add(sead::SafeString("Step"), step_index); + report.add(sead::SafeString("Id"), quest_id); + report.add(sead::SafeString("StepName"), step_name); + report.add(sead::SafeString("Name"), quest_name); + report.addPlayTimes(); + + if (ksys::PlayReportMgr::instance()) { + auto* reporter = ksys::PlayReportMgr::instance()->getReporter(); + if (reporter && reporter->isEnabled()) + reporter->saveReport(&report); + } } + } PlayReport::PlayReport(const sead::FixedSafeString<32>& event_id, s32 num_entries, sead::Heap* heap) : ksys::PlayReport(event_id, num_entries, heap) {} From 420af1c0d2fcc48111b623bcdad634b14eeb474c Mon Sep 17 00:00:00 2001 From: trixie Date: Sun, 21 Apr 2024 20:10:59 -0400 Subject: [PATCH 3/7] matching reportQuestStep --- src/Game/gamePlayReport.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Game/gamePlayReport.cpp b/src/Game/gamePlayReport.cpp index 3bd593f5f..84a2f32f5 100644 --- a/src/Game/gamePlayReport.cpp +++ b/src/Game/gamePlayReport.cpp @@ -51,22 +51,22 @@ void reportDungeon(const sead::SafeString& name, const sead::SafeString& event) } } void reportQuestStep(const ksys::qst::Quest* quest, int step_index) { - if (quest && (step_index >= 0) == 0 && quest->mSteps.size() > step_index) { - ksys::ProductReporter::getSomeBool(); - - + if (quest && step_index >= 0 && step_index < quest->mSteps.size()) { + const sead::SafeString& name = quest->mName; const sead::SafeString step_name = quest->mSteps[step_index]->name; - const sead::SafeString quest_name = quest->mName; - const int quest_id = getQuestId(quest_name); + ksys::ProductReporter::getSomeBool(); + + const int quest_id = getQuestId(name); - PlayReport report(sead::SafeString("challenge"), 7, ksys::PlayReportMgr::instance()->getReporter()->getHeap()); + PlayReport report(sead::SafeString("challenge"), 7, + ksys::PlayReportMgr::instance()->getReporter()->getHeap()); report.addMapType(); - report.add(sead::SafeString("Step"), step_index); report.add(sead::SafeString("Id"), quest_id); + report.add(sead::SafeString("Name"), name); + report.add(sead::SafeString("Step"), step_index); report.add(sead::SafeString("StepName"), step_name); - report.add(sead::SafeString("Name"), quest_name); report.addPlayTimes(); if (ksys::PlayReportMgr::instance()) { @@ -75,7 +75,6 @@ void reportQuestStep(const ksys::qst::Quest* quest, int step_index) { reporter->saveReport(&report); } } - } PlayReport::PlayReport(const sead::FixedSafeString<32>& event_id, s32 num_entries, sead::Heap* heap) : ksys::PlayReport(event_id, num_entries, heap) {} From bb9c6bfc94e5b23bd44152a44d50b6fd1fbe6100 Mon Sep 17 00:00:00 2001 From: trixie Date: Sun, 21 Apr 2024 20:21:27 -0400 Subject: [PATCH 4/7] matching reportQuestStep --- data/uking_functions.csv | 2 +- src/Game/gamePlayReport.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 266c6d39b..f6f905fad 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -61183,7 +61183,7 @@ Address,Quality,Size,Name 0x0000007100a86ec8,O,000360,_ZN5uking10PlayReportC1ERKN4sead15FixedSafeStringILi32EEEiPNS1_4HeapE 0x0000007100a87030,O,001116,_ZN5uking10PlayReport10addMapTypeEv 0x0000007100a8748c,O,000908,_ZN5uking13reportDungeonERKN4sead14SafeStringBaseIcEES4_ -0x0000007100a87818,W,001256,_ZN5uking15reportQuestStepEPKN4ksys3qst5QuestEi +0x0000007100a87818,O,001256,_ZN5uking15reportQuestStepEPKN4ksys3qst5QuestEi 0x0000007100a87d00,U,002908,getQuestId 0x0000007100a8885c,U,000528,uking::reportGanonQuestFinished 0x0000007100a88a6c,U,001740,uking::reportGameOver diff --git a/src/Game/gamePlayReport.cpp b/src/Game/gamePlayReport.cpp index 84a2f32f5..eb484a5e8 100644 --- a/src/Game/gamePlayReport.cpp +++ b/src/Game/gamePlayReport.cpp @@ -7,7 +7,7 @@ #include "KingSystem/System/StageInfo.h" #include "KingSystem/Quest/qstQuest.h" namespace uking { -int getQuestId(const sead::SafeString& quest_name); +unsigned int getQuestId(const sead::SafeString& quest_name); void reportKorok(const sead::Vector3f& position) { ksys::ProductReporter::getSomeBool(); s32 id = ksys::gdt::getFlag_HiddenKorok_Number(); @@ -57,7 +57,7 @@ void reportQuestStep(const ksys::qst::Quest* quest, int step_index) { ksys::ProductReporter::getSomeBool(); - const int quest_id = getQuestId(name); + const unsigned int quest_id = getQuestId(name); PlayReport report(sead::SafeString("challenge"), 7, ksys::PlayReportMgr::instance()->getReporter()->getHeap()); From d008efa8750aef404ce5018bc8a50cba93fdc217 Mon Sep 17 00:00:00 2001 From: trixie Date: Sun, 21 Apr 2024 20:37:21 -0400 Subject: [PATCH 5/7] fix the warning --- src/Game/gamePlayReport.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Game/gamePlayReport.h b/src/Game/gamePlayReport.h index 58f2abe35..69bdc8fcd 100644 --- a/src/Game/gamePlayReport.h +++ b/src/Game/gamePlayReport.h @@ -3,7 +3,7 @@ #include #include "KingSystem/System/PlayReportMgr.h" namespace ksys::qst { -class Quest; +struct Quest; } namespace uking { From d680dcdfac4ee6ad9eb384746253acf1807d743e Mon Sep 17 00:00:00 2001 From: trixie Date: Sun, 21 Apr 2024 20:42:07 -0400 Subject: [PATCH 6/7] reformatted --- 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 eb484a5e8..76da9d4ff 100644 --- a/src/Game/gamePlayReport.cpp +++ b/src/Game/gamePlayReport.cpp @@ -3,9 +3,9 @@ #include "KingSystem/GameData/gdtCommonFlagsUtils.h" #include "KingSystem/GameData/gdtManager.h" #include "KingSystem/GameData/gdtTriggerParam.h" +#include "KingSystem/Quest/qstQuest.h" #include "KingSystem/System/ProductReporter.h" #include "KingSystem/System/StageInfo.h" -#include "KingSystem/Quest/qstQuest.h" namespace uking { unsigned int getQuestId(const sead::SafeString& quest_name); void reportKorok(const sead::Vector3f& position) { From 51fed4abb32b32223551e31addb3ba1ab7578d88 Mon Sep 17 00:00:00 2001 From: trixie Date: Sun, 21 Apr 2024 20:53:10 -0400 Subject: [PATCH 7/7] add newlines --- src/Game/gamePlayReport.cpp | 2 ++ src/Game/gamePlayReport.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/Game/gamePlayReport.cpp b/src/Game/gamePlayReport.cpp index 76da9d4ff..165010c53 100644 --- a/src/Game/gamePlayReport.cpp +++ b/src/Game/gamePlayReport.cpp @@ -6,6 +6,7 @@ #include "KingSystem/Quest/qstQuest.h" #include "KingSystem/System/ProductReporter.h" #include "KingSystem/System/StageInfo.h" + namespace uking { unsigned int getQuestId(const sead::SafeString& quest_name); void reportKorok(const sead::Vector3f& position) { @@ -50,6 +51,7 @@ void reportDungeon(const sead::SafeString& name, const sead::SafeString& event) 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; diff --git a/src/Game/gamePlayReport.h b/src/Game/gamePlayReport.h index 69bdc8fcd..c6a188fda 100644 --- a/src/Game/gamePlayReport.h +++ b/src/Game/gamePlayReport.h @@ -2,6 +2,7 @@ #include #include "KingSystem/System/PlayReportMgr.h" + namespace ksys::qst { struct Quest; }