From aa2a5f2a34507cabaef80a98077dfe012a7d01ba Mon Sep 17 00:00:00 2001
From: Aikku93 <aik@aol.com.au>
Date: Mon, 23 May 2022 18:35:25 +1000
Subject: [PATCH] check `gameCode==####` for homebrew

---
 desmume/src/NDSSystem.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp
index bdfc9701d..58cbb57d9 100644
--- a/desmume/src/NDSSystem.cpp
+++ b/desmume/src/NDSSystem.cpp
@@ -635,7 +635,8 @@ bool GameInfo::isDSiEnhanced()
 
 bool GameInfo::isHomebrew()
 {
-	return ((header.ARM9src < 0x4000) && (T1ReadLong(header.logo, 0) != 0x51AEFF24) && (T1ReadLong(header.logo, 4) != 0x699AA221));
+	return ((header.ARM9src < 0x4000) && (T1ReadLong(header.logo, 0) != 0x51AEFF24) && (T1ReadLong(header.logo, 4) != 0x699AA221)) ||
+	       (!memcmp(header.gameCode, "####", 4)); // <- ndstool default signature
 }
 
 static int rom_init_path(const char *filename, const char *physicalName, const char *logicalFilename)