From 354b205decf33451061b5dff41e64f7535d58634 Mon Sep 17 00:00:00 2001
From: comex <comexk@gmail.com>
Date: Wed, 11 Sep 2013 22:43:12 -0400
Subject: [PATCH] Return correct value to fix libogc's IOS launch sequence.

---
 Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp
index 254fcecbd6..98e77c7695 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp
@@ -934,10 +934,11 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
 				// Lie to mem about loading a different IOS
 				// someone with an affected game should test
 				IOSv = TitleID & 0xffff;
+				bSuccess = true;
 			}
-			if (!bSuccess && IOSv >= 30 && IOSv != 0xffff)
+			if (!bSuccess)
 			{
-				PanicAlertT("IOCTL_ES_LAUNCH: Game tried to reload an IOS or a title that is not available in your NAND dump\n"
+				PanicAlertT("IOCTL_ES_LAUNCH: Game tried to reload a title that is not available in your NAND dump\n"
 					"TitleID %016llx.\n Dolphin will likely hang now.", TitleID);
 			}
 			else
@@ -984,14 +985,13 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
 			ERROR_LOG(WII_IPC_ES, "IOCTL_ES_LAUNCH %016llx %08x %016llx %08x %016llx %04x", TitleID,view,ticketid,devicetype,titleid,access);
 			//					   IOCTL_ES_LAUNCH 0001000248414341 00000001 0001c0fef3df2cfa 00000000 0001000248414341 ffff
 
-			//We have to handle the reply ourselves as this handle is not valid anymore
-			
+			// This is necessary because Reset(true) above deleted this object.  Ew.
 			
 			// It seems that the original hardware overwrites the command after it has been
 			// executed. We write 8 which is not any valid command, and what IOS does 
 			Memory::Write_U32(8, _CommandAddress);
 			// IOS seems to write back the command that was responded to
-			Memory::Write_U32(6, _CommandAddress + 8);
+			Memory::Write_U32(7, _CommandAddress + 8);
 			
 			// Generate a reply to the IPC command
 			WII_IPC_HLE_Interface::EnqReply(_CommandAddress, 0);