From d142b3ae0e73eaa2083fa49d4fba91fc3debbc60 Mon Sep 17 00:00:00 2001 From: Luke Usher Date: Wed, 28 Sep 2016 20:47:09 +0100 Subject: [PATCH] Dashboard works again --- import/OpenXDK/include/xboxkrnl/xbox.h | 5 ++--- src/CxbxKrnl/CxbxKrnl.cpp | 2 +- src/CxbxKrnl/EmuKrnl.cpp | 20 ++++++++++++++++++++ src/CxbxKrnl/KernelThunk.cpp | 4 ++-- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/import/OpenXDK/include/xboxkrnl/xbox.h b/import/OpenXDK/include/xboxkrnl/xbox.h index 9662267af..edf3057f1 100644 --- a/import/OpenXDK/include/xboxkrnl/xbox.h +++ b/import/OpenXDK/include/xboxkrnl/xbox.h @@ -121,9 +121,8 @@ XBSYSAPI EXPORTNUM(324) XBOX_KRNL_VERSION XboxKrnlVersion; XBSYSAPI EXPORTNUM(325) BYTE XboxSignatureKey[16]; XBSYSAPI EXPORTNUM(326) OBJECT_STRING XeImageFileName; - -XBSYSAPI VOID *XeLoadSection; -XBSYSAPI VOID *XeUnloadSection; +XBSYSAPI EXPORTNUM(327) NTSTATUS NTAPI XeLoadSection(void* section); +XBSYSAPI EXPORTNUM(328) NTSTATUS NTAPI XeUnloadSection(void* section); // ****************************************************************** // * XcSHAInit diff --git a/src/CxbxKrnl/CxbxKrnl.cpp b/src/CxbxKrnl/CxbxKrnl.cpp index 74618484d..c3af88c48 100644 --- a/src/CxbxKrnl/CxbxKrnl.cpp +++ b/src/CxbxKrnl/CxbxKrnl.cpp @@ -527,7 +527,7 @@ extern "C" CXBXKRNL_API void CxbxKrnlInit // Create default symbolic links : { // Arrange that the Xbe path can reside outside the partitions, and put it to g_hCurDir : - CxbxCreateSymbolicLink(DriveC, (xbeDirectory)); + CxbxCreateSymbolicLink(DriveC, xbeDirectory); EmuNtSymbolicLinkObject* xbePathSymbolicLinkObject = FindNtSymbolicLinkObjectByVolumeLetter(CxbxDefaultXbeVolumeLetter); g_hCurDir = xbePathSymbolicLinkObject->RootDirectoryHandle; diff --git a/src/CxbxKrnl/EmuKrnl.cpp b/src/CxbxKrnl/EmuKrnl.cpp index f53db86d0..2ef15f8ad 100644 --- a/src/CxbxKrnl/EmuKrnl.cpp +++ b/src/CxbxKrnl/EmuKrnl.cpp @@ -4898,6 +4898,26 @@ XBSYSAPI EXPORTNUM(326) xboxkrnl::OBJECT_STRING xboxkrnl::XeImageFileName = { }; +XBSYSAPI EXPORTNUM(327) xboxkrnl::NTSTATUS NTAPI xboxkrnl::XeLoadSection(void* section) +{ + if (((Xbe::SectionHeader*)section)->dwSectionRefCount > 0) { + ((Xbe::SectionHeader*)section)->dwSectionRefCount++; + return STATUS_SUCCESS; + } + + EmuWarning("XeLoadSection lied"); + return STATUS_SUCCESS; +} + +XBSYSAPI EXPORTNUM(328) xboxkrnl::NTSTATUS NTAPI xboxkrnl::XeUnloadSection(void* section) +{ + if (((Xbe::SectionHeader*)section)->dwSectionRefCount == 0) { + return STATUS_INVALID_PARAMETER; + } + + EmuWarning("XeUnloadSection lied"); + return STATUS_SUCCESS; +} // ****************************************************************** // * XcSHAInit diff --git a/src/CxbxKrnl/KernelThunk.cpp b/src/CxbxKrnl/KernelThunk.cpp index 8fff74676..b033b41d8 100644 --- a/src/CxbxKrnl/KernelThunk.cpp +++ b/src/CxbxKrnl/KernelThunk.cpp @@ -384,8 +384,8 @@ extern "C" CXBXKRNL_API uint32 CxbxKrnl_KernelThunkTable[367] = (uint32)&xboxkrnl::XboxKrnlVersion, // 0x0144 (324) XboxKrnlVersion (uint32)&xboxkrnl::XboxSignatureKey, // 0x0145 (325) (uint32)&xboxkrnl::XeImageFileName, // 0x0146 (326) XeImageFileName - (uint32)PANIC(0x0147), // 0x0147 (327) XeLoadSection - (uint32)PANIC(0x0148), // 0x0148 (328) XeUnloadSection + (uint32)&xboxkrnl::XeLoadSection, // 0x0147 (327) XeLoadSection + (uint32)&xboxkrnl::XeUnloadSection, // 0x0148 (328) XeUnloadSection (uint32)PANIC(0x0149), // 0x0149 (329) READ_PORT_BUFFER_UCHAR (uint32)PANIC(0x014A), // 0x014A (330) READ_PORT_BUFFER_USHORT (uint32)PANIC(0x014B), // 0x014B (331) READ_PORT_BUFFER_ULONG