Compare commits

...

8 Commits

Author SHA1 Message Date
OatmealDome a9203bd2a7
Merge d5dbb0b285 into 795e78685f 2025-01-18 00:22:14 +01:00
OatmealDome 795e78685f
Merge pull request #13187 from OatmealDome/flatpak-appinfo
Flatpak: Use ScmRevGen to generate metainfo XML
2025-01-17 17:47:10 -05:00
JMC47 f65465b96c
Merge pull request #13250 from Charlese2/fix-sound-system-crash
GameINI: fix `Summoner: Goddess Reborn` sound system crash during transitions
2025-01-17 16:42:21 -05:00
OatmealDome d5dbb0b285 MemArena: Add Darwin implementation 2025-01-08 12:46:31 -05:00
OatmealDome 5578160880 Flatpak: Include link to the manifest within the metainfo for Flathub 2025-01-07 15:35:21 -05:00
OatmealDome 4fc259710f Flatpak: Use ScmRevGen to generate metainfo XML 2025-01-07 02:35:14 -05:00
OatmealDome 89016834cf Flatpak: Don't do an in-tree build 2025-01-07 02:34:45 -05:00
Charlese2 635f588690 fix `Summoner: Goddess Reborn` sound system crash during transitions 2024-12-27 18:33:54 -07:00
9 changed files with 304 additions and 17 deletions

View File

@ -30,6 +30,8 @@ if(GIT_FOUND)
ERROR_QUIET)
endif()
string(TIMESTAMP DOLPHIN_WC_BUILD_DATE "%Y-%m-%d" UTC)
# version number
set(DOLPHIN_VERSION_MAJOR "2412")
set(DOLPHIN_VERSION_MINOR "0")
@ -67,3 +69,7 @@ configure_source_file("Source/Core/Common/scmrev.h")
if(APPLE)
configure_source_file("Source/Core/VersionInfo.plist")
endif()
if(LINUX)
configure_source_file("Flatpak/org.DolphinEmu.dolphin-emu.metainfo.xml")
endif()

View File

@ -789,6 +789,13 @@ if(APPLE)
endif()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Flatpak)
if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/Flatpak/org.DolphinEmu.dolphin-emu.metainfo.xml)
file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/Flatpak/org.DolphinEmu.dolphin-emu.metainfo.xml)
endif()
endif()
find_package(Git)
if(NOT GIT_FOUND)
set(GIT_EXECUTABLE "")
@ -796,7 +803,7 @@ endif()
add_custom_target(
dolphin_scmrev
${CMAKE_COMMAND} -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} -DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR} -DDISTRIBUTOR=${DISTRIBUTOR} -DDOLPHIN_DEFAULT_UPDATE_TRACK=${DOLPHIN_DEFAULT_UPDATE_TRACK} -DGIT_FOUND=${GIT_FOUND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DDOLPHIN_WC_REVISION=${DOLPHIN_WC_REVISION} -DDOLPHIN_WC_DESCRIBE=${DOLPHIN_WC_DESCRIBE} -DDOLPHIN_WC_BRANCH=${DOLPHIN_WC_BRANCH} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} -P ${CMAKE_CURRENT_SOURCE_DIR}/CMake/ScmRevGen.cmake
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Source/Core/Common/scmrev.h" "${CMAKE_CURRENT_BINARY_DIR}/Source/Core/DolphinQt/Info.plist" "${CMAKE_CURRENT_BINARY_DIR}/Source/Core/MacUpdater/Info.plist"
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Source/Core/Common/scmrev.h" "${CMAKE_CURRENT_BINARY_DIR}/Source/Core/DolphinQt/Info.plist" "${CMAKE_CURRENT_BINARY_DIR}/Source/Core/MacUpdater/Info.plist" "${CMAKE_CURRENT_BINARY_DIR}/Flatpak/org.DolphinEmu.dolphin-emu.metainfo.xml"
VERBATIM
)

View File

@ -1,7 +1,48 @@
# GS2E78 - Summoner 2
[OnFrame]
# Add memory patches to be applied every frame here.
# This game will reinitialize the sound system buffers during transitions while
# sounds are still being played. There are still pointers in the sound list to
# sounds in those buffers when the buffers get cleared, so the game crashes with
# a null pointer dereference.
#
# This patch will clean up the pending sound list during sound system
# reinitialization before continuing to the sound system initialization call
# previously at 0x8017E338.
$Fix Sound System Crash
0x8017E338:dword:0x480954C9
0x80213800:dword:0x9421FFE0
0x80213804:dword:0x7C0802A6
0x80213808:dword:0x90010024
0x8021380C:dword:0x93E1001C
0x80213810:dword:0x93C10018
0x80213814:dword:0x93A10014
0x80213818:dword:0x7C7D1B78
0x8021381C:dword:0x4BF7A7D1
0x80213820:dword:0x83CDA0C0
0x80213824:dword:0x7C7F1B78
0x80213828:dword:0x48000010
0x8021382C:dword:0x807E0008
0x80213830:dword:0x4BF8C721
0x80213834:dword:0x83DE0000
0x80213838:dword:0x281E0000
0x8021383C:dword:0x4082FFF0
0x80213840:dword:0x38000000
0x80213844:dword:0x7FE3FB78
0x80213848:dword:0x900DA0C0
0x8021384C:dword:0x4BF7A7C9
0x80213850:dword:0x7FA3EB78
0x80213854:dword:0x4BF6A49D
0x80213858:dword:0x80010024
0x8021385C:dword:0x83E1001C
0x80213860:dword:0x83C10018
0x80213864:dword:0x83A10014
0x80213868:dword:0x7C0803A6
0x8021386C:dword:0x38210020
0x80213870:dword:0x4E800020
[OnFrame_Enabled]
$Fix Sound System Crash
[ActionReplay]
# Add action replay cheats here.

View File

@ -1,8 +0,0 @@
#!/usr/bin/env bash
DATE=$(git log -1 --pretty=%cd --date=iso8601 --date=format:'%Y-%m-%d')
sed -i -e "s/@DATE_PLACEHOLDER/${DATE}/" org.DolphinEmu.dolphin-emu.metainfo.xml
VERSION=$(git describe --tags | sed -E 's/^([0-9]+-[0-9]+).*/\1/')
sed -i -e "s/@VERSION_PLACEHOLDER/${VERSION}/" org.DolphinEmu.dolphin-emu.metainfo.xml

View File

@ -36,7 +36,7 @@
<id>dolphin-emu.desktop</id>
</provides>
<releases>
<release version="@VERSION_PLACEHOLDER" date="@DATE_PLACEHOLDER"/>
<release version="${DOLPHIN_WC_DESCRIBE}" date="${DOLPHIN_WC_BUILD_DATE}"/>
</releases>
<url type="homepage">https://dolphin-emu.org</url>
<url type="bugtracker">https://bugs.dolphin-emu.org/projects/emulator/issues</url>
@ -46,4 +46,7 @@
<url type="contact">https://dolphin-emu.org/docs/faq/#ive-got-idea-make-dolphin-better-how-should-i-tell</url>
<url type="vcs-browser">https://github.com/dolphin-emu/dolphin</url>
<url type="contribute">https://github.com/dolphin-emu/dolphin/blob/master/Contributing.md</url>
<custom>
<value key="flathub::manifest">https://github.com/dolphin-emu/dolphin/blob/${DOLPHIN_WC_REVISION}/Flatpak/org.DolphinEmu.dolphin-emu.yml</value>
</custom>
</component>

View File

@ -52,6 +52,7 @@ modules:
- name: dolphin-emu
buildsystem: cmake-ninja
builddir: true
config-opts:
- -DCMAKE_BUILD_TYPE=Release
- -DENABLE_ALSA=OFF
@ -61,17 +62,13 @@ modules:
cleanup:
- /share/man
post-install:
- install -D -t ${FLATPAK_DEST}/bin/ dolphin-emu-wrapper
- "${FLATPAK_BUILDER_BUILDDIR}/Flatpak/fill_release_node.sh"
- install -Dm644 -t ${FLATPAK_DEST}/share/metainfo/ org.DolphinEmu.dolphin-emu.metainfo.xml
- install -D -t ${FLATPAK_DEST}/bin/ ../dolphin-emu-wrapper
- install -Dm644 -t ${FLATPAK_DEST}/share/metainfo/ Flatpak/org.DolphinEmu.dolphin-emu.metainfo.xml
- desktop-file-edit --set-key=Exec --set-value='/app/bin/dolphin-emu-wrapper'
/app/share/applications/dolphin-emu.desktop
sources:
- type: dir
path: ..
- type: file
path: org.DolphinEmu.dolphin-emu.metainfo.xml.in
dest-filename: org.DolphinEmu.dolphin-emu.metainfo.xml
- type: script
commands:
- |

View File

@ -228,6 +228,11 @@ elseif(WIN32)
Logging/ConsoleListenerWin.cpp
MemArenaWin.cpp
)
elseif(APPLE)
target_sources(common PRIVATE
Logging/ConsoleListenerNix.cpp
MemArenaDarwin.cpp
)
else()
target_sources(common PRIVATE
Logging/ConsoleListenerNix.cpp

View File

@ -7,6 +7,10 @@
#include <string_view>
#include <vector>
#ifdef __APPLE__
#include <mach/mach.h>
#endif
#include "Common/CommonTypes.h"
#include "Common/DynamicLibrary.h"
@ -120,6 +124,13 @@ private:
void* m_reserved_region = nullptr;
void* m_memory_handle = nullptr;
WindowsMemoryFunctions m_memory_functions;
#elif defined(__APPLE__)
vm_address_t m_shm_address = 0;
vm_size_t m_shm_size = 0;
mem_entry_name_port_t m_shm_entry = MACH_PORT_NULL;
vm_address_t m_region_address = 0;
vm_size_t m_region_size = 0;
#else
int m_shm_fd = 0;
void* m_reserved_region = nullptr;

View File

@ -0,0 +1,225 @@
// Copyright 2025 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "Common/MemArena.h"
#include "Common/Assert.h"
#include "Common/Logging/Log.h"
namespace Common
{
MemArena::MemArena() = default;
MemArena::~MemArena() = default;
void MemArena::GrabSHMSegment(size_t size, std::string_view base_name)
{
kern_return_t retval = vm_allocate(mach_task_self(), &m_shm_address, size, VM_FLAGS_ANYWHERE);
if (retval != KERN_SUCCESS)
{
ERROR_LOG_FMT(MEMMAP, "GrabSHMSegment failed: vm_allocate returned {0:#x}", retval);
m_shm_address = 0;
return;
}
memory_object_size_t entry_size = size;
constexpr vm_prot_t prot = VM_PROT_READ | VM_PROT_WRITE;
retval = mach_make_memory_entry_64(mach_task_self(), &entry_size, m_shm_address, prot,
&m_shm_entry, MACH_PORT_NULL);
if (retval != KERN_SUCCESS)
{
ERROR_LOG_FMT(MEMMAP, "GrabSHMSegment failed: mach_make_memory_entry_64 returned {0:#x}",
retval);
m_shm_address = 0;
m_shm_entry = MACH_PORT_NULL;
return;
}
m_shm_size = size;
}
void MemArena::ReleaseSHMSegment()
{
if (m_shm_entry != MACH_PORT_NULL)
{
mach_port_deallocate(mach_task_self(), m_shm_entry);
}
if (m_shm_address != 0)
{
vm_deallocate(mach_task_self(), m_shm_address, m_shm_size);
}
m_shm_address = 0;
m_shm_size = 0;
m_shm_entry = MACH_PORT_NULL;
}
void* MemArena::CreateView(s64 offset, size_t size)
{
if (m_shm_address == 0)
{
ERROR_LOG_FMT(MEMMAP, "CreateView failed: no shared memory segment allocated");
return nullptr;
}
vm_address_t address;
constexpr vm_prot_t prot = VM_PROT_READ | VM_PROT_WRITE;
kern_return_t retval = vm_map(mach_task_self(), &address, size, 0, VM_FLAGS_ANYWHERE, m_shm_entry,
offset, false, prot, prot, VM_INHERIT_DEFAULT);
if (retval != KERN_SUCCESS)
{
ERROR_LOG_FMT(MEMMAP, "CreateView failed: vm_map returned {0:#x}", retval);
return nullptr;
}
return reinterpret_cast<void*>(address);
}
void MemArena::ReleaseView(void* view, size_t size)
{
vm_deallocate(mach_task_self(), reinterpret_cast<vm_address_t>(view), size);
}
u8* MemArena::ReserveMemoryRegion(size_t memory_size)
{
vm_address_t address;
kern_return_t retval = vm_allocate(mach_task_self(), &address, memory_size, VM_FLAGS_ANYWHERE);
if (retval != KERN_SUCCESS)
{
ERROR_LOG_FMT(MEMMAP, "ReserveMemoryRegion: vm_allocate returned {0:#x}", retval);
return nullptr;
}
retval = vm_protect(mach_task_self(), address, memory_size, true, VM_PROT_NONE);
if (retval != KERN_SUCCESS)
{
ERROR_LOG_FMT(MEMMAP, "ReserveMemoryRegion failed: vm_prot returned {0:#x}", retval);
return nullptr;
}
m_region_address = address;
m_region_size = memory_size;
return reinterpret_cast<u8*>(m_region_address);
}
void MemArena::ReleaseMemoryRegion()
{
if (m_region_address != 0)
{
vm_deallocate(mach_task_self(), m_region_address, m_region_size);
}
m_region_address = 0;
m_region_size = 0;
}
void* MemArena::MapInMemoryRegion(s64 offset, size_t size, void* base)
{
if (m_shm_address == 0)
{
ERROR_LOG_FMT(MEMMAP, "MapInMemoryRegion failed: no shared memory segment allocated");
return nullptr;
}
vm_address_t address = reinterpret_cast<vm_address_t>(base);
constexpr vm_prot_t prot = VM_PROT_READ | VM_PROT_WRITE;
kern_return_t retval =
vm_map(mach_task_self(), &address, size, 0, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE, m_shm_entry,
offset, false, prot, prot, VM_INHERIT_DEFAULT);
if (retval != KERN_SUCCESS)
{
ERROR_LOG_FMT(MEMMAP, "MapInMemoryRegion failed: vm_map returned {0:#x}", retval);
return nullptr;
}
return reinterpret_cast<void*>(address);
}
void MemArena::UnmapFromMemoryRegion(void* view, size_t size)
{
vm_address_t address = reinterpret_cast<vm_address_t>(view);
kern_return_t retval =
vm_allocate(mach_task_self(), &address, size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE);
if (retval != KERN_SUCCESS)
{
ERROR_LOG_FMT(MEMMAP, "UnmapFromMemoryRegion failed: vm_allocate returned {0:#x}", retval);
return;
}
retval = vm_protect(mach_task_self(), address, size, true, VM_PROT_NONE);
if (retval != KERN_SUCCESS)
{
ERROR_LOG_FMT(MEMMAP, "UnmapFromMemoryRegion failed: vm_prot returned {0:#x}", retval);
}
}
LazyMemoryRegion::LazyMemoryRegion() = default;
LazyMemoryRegion::~LazyMemoryRegion()
{
Release();
}
void* LazyMemoryRegion::Create(size_t size)
{
ASSERT(!m_memory);
if (size == 0)
return nullptr;
vm_address_t memory = 0;
kern_return_t retval = vm_allocate(mach_task_self(), &memory, size, VM_FLAGS_ANYWHERE);
if (retval != KERN_SUCCESS)
{
ERROR_LOG_FMT(MEMMAP, "Failed to allocate memory space: {0:#x}", retval);
return nullptr;
}
m_memory = reinterpret_cast<void*>(memory);
m_size = size;
return m_memory;
}
void LazyMemoryRegion::Clear()
{
ASSERT(m_memory);
vm_address_t new_memory = reinterpret_cast<vm_address_t>(m_memory);
kern_return_t retval =
vm_allocate(mach_task_self(), &new_memory, m_size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE);
if (retval != KERN_SUCCESS)
{
ERROR_LOG_FMT(MEMMAP, "Failed to reallocate memory space: {0:#x}", retval);
m_memory = nullptr;
return;
}
m_memory = reinterpret_cast<void*>(new_memory);
}
void LazyMemoryRegion::Release()
{
if (m_memory)
{
vm_deallocate(mach_task_self(), reinterpret_cast<vm_address_t>(m_memory), m_size);
}
m_memory = nullptr;
m_size = 0;
}
} // namespace Common