From 3b36b3af2b2cc4bb0b5804c500fd837bd53902f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 8 Nov 2020 22:54:39 +0100 Subject: [PATCH] ksys/res: Fix EntryFactory::newResource_ return type Having a covariant return type that isn't sead::DirectResource* will cause an extra nullptr check to be emitted --- src/KingSystem/Resource/resEntryFactory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KingSystem/Resource/resEntryFactory.h b/src/KingSystem/Resource/resEntryFactory.h index 3b065d77..611a2122 100644 --- a/src/KingSystem/Resource/resEntryFactory.h +++ b/src/KingSystem/Resource/resEntryFactory.h @@ -37,7 +37,7 @@ public: u32 getResourceSize() const override { return sizeof(T); } u32 getLoadDataAlignment() const override { return T::cLoadDataAlignment; } - T* newResource_(sead::Heap* heap_, s32 alignment) override { + sead::DirectResource* newResource_(sead::Heap* heap_, s32 alignment) override { sead::Heap* heap = util::getHeapOrCurrentHeap(heap_); sead::ScopedCurrentHeapSetter setter{heap}; return new (heap, alignment, std::nothrow_t{}) T{};