From 6d1e095a4197f8e242804d67c5c85b375505dd5e Mon Sep 17 00:00:00 2001 From: Silent Date: Fri, 5 Mar 2021 22:21:48 +0100 Subject: [PATCH 1/2] Fix XeUnloadSection errorerously zeroing memory Makes Apex/Racing Evoluzione reach menus --- src/core/kernel/exports/EmuKrnlXe.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/kernel/exports/EmuKrnlXe.cpp b/src/core/kernel/exports/EmuKrnlXe.cpp index ef30a3ee3..6a8c28f89 100644 --- a/src/core/kernel/exports/EmuKrnlXe.cpp +++ b/src/core/kernel/exports/EmuKrnlXe.cpp @@ -126,9 +126,8 @@ XBSYSAPI EXPORTNUM(328) xbox::ntstatus_xt NTAPI xbox::XeUnloadSection // Free the section and the physical memory in use if necessary if (Section->SectionReferenceCount == 0) { - memset(Section->VirtualAddress, 0, Section->VirtualSize); - // REMARK: the following can be tested with Broken Sword - The Sleeping Dragon, RalliSport Challenge, ... + // Test-case: Apex/Racing Evoluzione requires the memory NOT to be zeroed VAddr BaseAddress = (VAddr)Section->VirtualAddress; VAddr EndingAddress = (VAddr)Section->VirtualAddress + Section->VirtualSize; From 9ea0051d927ae96a9f7c44d2f1349e9612b0c782 Mon Sep 17 00:00:00 2001 From: Silent Date: Fri, 5 Mar 2021 22:30:27 +0100 Subject: [PATCH 2/2] Xbe: Read section headers and library versions in one go --- src/common/xbe/Xbe.cpp | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/src/common/xbe/Xbe.cpp b/src/common/xbe/Xbe.cpp index d98b51a77..be4947812 100644 --- a/src/common/xbe/Xbe.cpp +++ b/src/common/xbe/Xbe.cpp @@ -194,25 +194,18 @@ Xbe::Xbe(const char *x_szFilename, bool bFromGUI) // read Xbe section headers { - printf("Xbe::Xbe: Reading Section Headers...\n"); + printf("Xbe::Xbe: Reading Section Headers..."); fseek(XbeFile, m_Header.dwSectionHeadersAddr - m_Header.dwBaseAddr, SEEK_SET); m_SectionHeader = new SectionHeader[m_Header.dwSections]; - - for(uint32_t v=0;v