diff --git a/core/libs/prx/libSceNpTrophy2/src/GameInfo.cpp b/core/libs/prx/libSceNpTrophy2/src/GameInfo.cpp index 6a41aa647..0c5b320f6 100644 --- a/core/libs/prx/libSceNpTrophy2/src/GameInfo.cpp +++ b/core/libs/prx/libSceNpTrophy2/src/GameInfo.cpp @@ -9,7 +9,7 @@ extern "C" { int APS5_VABI sceNpTrophy2GetGameInfo(int context, int handle, NpTrophy2GameDetails* details, NpTrophy2GameData* data) { - if (details == nullptr || data == nullptr) { + if (details == nullptr && data == nullptr) { APS5_INVALID_ARG_EX; } (void)context; diff --git a/core/libs/tests/GuestNpTrophy2.cpp b/core/libs/tests/GuestNpTrophy2.cpp index 5a286ab35..d52cc50ba 100644 --- a/core/libs/tests/GuestNpTrophy2.cpp +++ b/core/libs/tests/GuestNpTrophy2.cpp @@ -1,9 +1,12 @@ #include "prx/libc/include/general/VabiMacros.hpp" +#include "prx/libSceNpTrophy2/include/NpTrophy2Types.hpp" #include +#include extern "C" { int APS5_VABI sceNpTrophy2RegisterUnlockCallback(void*, void*); int APS5_VABI sceNpTrophy2UnregisterUnlockCallback(); +int APS5_VABI sceNpTrophy2GetGameInfo(int, int, NpTrophy2GameDetails*, NpTrophy2GameData*); } static void Require(bool value) { if (!value) std::abort(); } @@ -17,4 +20,17 @@ int main() { Require(sceNpTrophy2UnregisterUnlockCallback() == 0); Require(sceNpTrophy2RegisterUnlockCallback(reinterpret_cast(&OnUnlock), &userdata) == 0); Require(sceNpTrophy2UnregisterUnlockCallback() == 0); + + NpTrophy2GameDetails details{}; + NpTrophy2GameData data{}; + Require(sceNpTrophy2GetGameInfo(1, 1, &details, nullptr) == 0); + Require(details.num_trophies != 0); + Require(sceNpTrophy2GetGameInfo(1, 1, nullptr, &data) == 0); + bool threw = false; + try { + sceNpTrophy2GetGameInfo(1, 1, nullptr, nullptr); + } catch (const std::invalid_argument&) { + threw = true; + } + Require(threw); }