Compare commits

...

8 Commits

Author SHA1 Message Date
Tilka c6ae656704
Merge 3701c0234e into 795e78685f 2025-01-17 17:50:10 -05: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 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
Tillmann Karras 3701c0234e VideoCommon: cache the per-vertex position/normal matrix index 2024-12-24 02:25:56 +01:00
14 changed files with 99 additions and 90 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

@ -70,7 +70,6 @@ struct alignas(16) VertexShaderConstants
u32 missing_color_hex; // .w, used for change detection but not directly by shaders
float4 missing_color_value;
std::array<float4, 6> posnormalmatrix;
std::array<float4, 4> projection;
std::array<int4, 4> materials;
struct Light
@ -93,6 +92,8 @@ struct alignas(16) VertexShaderConstants
// .x - texMtxInfo, .y - postMtxInfo, [0..1].z = color, [0..1].w = alpha
std::array<uint4, 8> xfmem_pack1;
// TODO: only first element is currently used
std::array<u32, 4> cached_posmtxidx;
float4 cached_normal;
float4 cached_tangent;
float4 cached_binormal;

View File

@ -273,7 +273,6 @@ void WriteSwitch(ShaderCode& out, APIType ApiType, std::string_view variable,
#define I_ZSLOPE "czslope"
#define I_EFBSCALE "cefbscale"
#define I_POSNORMALMATRIX "cpnmtx"
#define I_PROJECTION "cproj"
#define I_MATERIALS "cmtrl"
#define I_LIGHTS "clights"
@ -283,6 +282,7 @@ void WriteSwitch(ShaderCode& out, APIType ApiType, std::string_view variable,
#define I_POSTTRANSFORMMATRICES "cpostmtx"
#define I_PIXELCENTERCORRECTION "cpixelcenter"
#define I_VIEWPORT_SIZE "cviewport"
#define I_CACHED_POSMTXIDX "cposmtxidx"
#define I_CACHED_NORMAL "cnormal"
#define I_CACHED_TANGENT "ctangent"
#define I_CACHED_BINORMAL "cbinormal"
@ -296,7 +296,6 @@ static const char s_shader_uniforms[] = "\tuint components;\n"
"\tuint xfmem_numColorChans;\n"
"\tuint missing_color_hex;\n"
"\tfloat4 missing_color_value;\n"
"\tfloat4 " I_POSNORMALMATRIX "[6];\n"
"\tfloat4 " I_PROJECTION "[4];\n"
"\tint4 " I_MATERIALS "[4];\n"
"\tLight " I_LIGHTS "[8];\n"
@ -307,6 +306,7 @@ static const char s_shader_uniforms[] = "\tuint components;\n"
"\tfloat4 " I_PIXELCENTERCORRECTION ";\n"
"\tfloat2 " I_VIEWPORT_SIZE ";\n"
"\tuint4 xfmem_pack1[8];\n"
"\tuint4 " I_CACHED_POSMTXIDX ";\n"
"\tfloat4 " I_CACHED_NORMAL ";\n"
"\tfloat4 " I_CACHED_TANGENT ";\n"
"\tfloat4 " I_CACHED_BINORMAL ";\n"

View File

@ -223,28 +223,23 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
"float3 N1;\n"
"float3 N2;\n"
"\n"
"uint posidx;\n"
"if ((components & {}u) != 0u) {{ // VB_HAS_POSMTXIDX\n",
Common::ToUnderlying(VB_HAS_POSMTXIDX));
LoadVertexAttribute(out, host_config, 2, "posmtx", "uint4", "ubyte4");
out.Write(" // Vertex format has a per-vertex matrix\n"
" int posidx = int(posmtx.r);\n"
" P0 = " I_TRANSFORMMATRICES "[posidx];\n"
" P1 = " I_TRANSFORMMATRICES "[posidx+1];\n"
" P2 = " I_TRANSFORMMATRICES "[posidx+2];\n"
"\n"
" int normidx = posidx >= 32 ? (posidx - 32) : posidx;\n"
" N0 = " I_NORMALMATRICES "[normidx].xyz;\n"
" N1 = " I_NORMALMATRICES "[normidx+1].xyz;\n"
" N2 = " I_NORMALMATRICES "[normidx+2].xyz;\n"
" posidx = int(posmtx.r);\n"
"}} else {{\n"
" // One shared matrix\n"
" P0 = " I_POSNORMALMATRIX "[0];\n"
" P1 = " I_POSNORMALMATRIX "[1];\n"
" P2 = " I_POSNORMALMATRIX "[2];\n"
" N0 = " I_POSNORMALMATRIX "[3].xyz;\n"
" N1 = " I_POSNORMALMATRIX "[4].xyz;\n"
" N2 = " I_POSNORMALMATRIX "[5].xyz;\n"
" posidx = " I_CACHED_POSMTXIDX ".r;\n"
"}}\n"
"P0 = " I_TRANSFORMMATRICES "[posidx];\n"
"P1 = " I_TRANSFORMMATRICES "[posidx+1];\n"
"P2 = " I_TRANSFORMMATRICES "[posidx+2];\n"
"\n"
"uint normidx = posidx >= 32 ? (posidx - 32) : posidx;\n"
"N0 = " I_NORMALMATRICES "[normidx].xyz;\n"
"N1 = " I_NORMALMATRICES "[normidx+1].xyz;\n"
"N2 = " I_NORMALMATRICES "[normidx+2].xyz;\n"
"\n"
"// Multiply the position vector by the position matrix\n"
"float4 pos = float4(dot(P0, rawpos), dot(P1, rawpos), dot(P2, rawpos), 1.0);\n"

View File

@ -559,6 +559,13 @@ void VertexManagerBase::Flush()
pixel_shader_manager.constants.time_ms = seconds_elapsed * 1000;
}
if (VertexLoaderManager::GetCurrentVertexFormat()->GetVertexDeclaration().posmtx.enable)
{
u32 posmtx = VertexLoaderManager::position_matrix_index_cache[0];
u32 texmtx = xfmem.MatrixIndexA.Hex & 0xFFFF'FFC0;
xf_state_manager.SetTexMatrixChangedA(texmtx | posmtx);
xfmem.MatrixIndexA.PosNormalMtxIdx = posmtx;
}
CalculateNormals(VertexLoaderManager::GetCurrentVertexFormat());
// Calculate ZSlope for zfreeze
const auto used_textures = UsedTextures();

View File

@ -306,29 +306,25 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const ShaderHostConfig& ho
}
// transforms
if ((uid_data->components & VB_HAS_POSMTXIDX) != 0)
if (uid_data->components & VB_HAS_POSMTXIDX)
{
// Vertex format has a per-vertex matrix
out.Write("int posidx = int(posmtx.r);\n"
"float4 P0 = " I_TRANSFORMMATRICES "[posidx];\n"
"float4 P1 = " I_TRANSFORMMATRICES "[posidx + 1];\n"
"float4 P2 = " I_TRANSFORMMATRICES "[posidx + 2];\n"
"int normidx = posidx & 31;\n"
"float3 N0 = " I_NORMALMATRICES "[normidx].xyz;\n"
"float3 N1 = " I_NORMALMATRICES "[normidx + 1].xyz;\n"
"float3 N2 = " I_NORMALMATRICES "[normidx + 2].xyz;\n");
// per-vertex position/normal matrix index
out.Write("uint posidx = int(posmtx.r);\n");
}
else
{
// One shared matrix
out.Write("float4 P0 = " I_POSNORMALMATRIX "[0];\n"
"float4 P1 = " I_POSNORMALMATRIX "[1];\n"
"float4 P2 = " I_POSNORMALMATRIX "[2];\n"
"float3 N0 = " I_POSNORMALMATRIX "[3].xyz;\n"
"float3 N1 = " I_POSNORMALMATRIX "[4].xyz;\n"
"float3 N2 = " I_POSNORMALMATRIX "[5].xyz;\n");
// shared position/normal matrix index
out.Write("uint posidx = " I_CACHED_POSMTXIDX ".r;\n");
}
out.Write("float4 P0 = " I_TRANSFORMMATRICES "[posidx];\n"
"float4 P1 = " I_TRANSFORMMATRICES "[posidx + 1];\n"
"float4 P2 = " I_TRANSFORMMATRICES "[posidx + 2];\n"
"uint normidx = posidx & 31;\n"
"float3 N0 = " I_NORMALMATRICES "[normidx].xyz;\n"
"float3 N1 = " I_NORMALMATRICES "[normidx + 1].xyz;\n"
"float3 N2 = " I_NORMALMATRICES "[normidx + 2].xyz;\n");
out.Write("// Multiply the position vector by the position matrix\n"
"float4 pos = float4(dot(P0, rawpos), dot(P1, rawpos), dot(P2, rawpos), 1.0);\n");
if ((uid_data->components & VB_HAS_NORMAL) == 0)

View File

@ -289,23 +289,10 @@ void VertexShaderManager::SetConstants(const std::vector<std::string>& textures,
}
xf_state_manager.ResetMaterialChanges();
if (xf_state_manager.DidPosNormalChange())
{
xf_state_manager.ResetPosNormalChange();
const float* pos = &xfmem.posMatrices[g_main_cp_state.matrix_index_a.PosNormalMtxIdx * 4];
const float* norm =
&xfmem.normalMatrices[3 * (g_main_cp_state.matrix_index_a.PosNormalMtxIdx & 31)];
memcpy(constants.posnormalmatrix.data(), pos, 3 * sizeof(float4));
memcpy(constants.posnormalmatrix[3].data(), norm, 3 * sizeof(float));
memcpy(constants.posnormalmatrix[4].data(), norm + 3, 3 * sizeof(float));
memcpy(constants.posnormalmatrix[5].data(), norm + 6, 3 * sizeof(float));
dirty = true;
}
if (xf_state_manager.DidTexMatrixAChange())
{
xf_state_manager.ResetTexMatrixAChange();
constants.cached_posmtxidx[0] = g_main_cp_state.matrix_index_a.PosNormalMtxIdx;
const std::array<const float*, 4> pos_matrix_ptrs{
&xfmem.posMatrices[g_main_cp_state.matrix_index_a.Tex0MtxIdx * 4],
&xfmem.posMatrices[g_main_cp_state.matrix_index_a.Tex1MtxIdx * 4],

View File

@ -14,7 +14,6 @@ void XFStateManager::Init()
// Initialize state tracking variables
ResetTexMatrixAChange();
ResetTexMatrixBChange();
ResetPosNormalChange();
ResetProjection();
ResetViewportChange();
ResetTexMatrixInfoChange();
@ -37,7 +36,6 @@ void XFStateManager::DoState(PointerWrap& p)
p.Do(m_materials_changed);
p.DoArray(m_tex_matrices_changed);
p.Do(m_pos_normal_matrix_changed);
p.Do(m_projection_changed);
p.Do(m_viewport_changed);
p.Do(m_tex_mtx_info_changed);
@ -53,16 +51,6 @@ void XFStateManager::DoState(PointerWrap& p)
void XFStateManager::InvalidateXFRange(int start, int end)
{
if (((u32)start >= (u32)g_main_cp_state.matrix_index_a.PosNormalMtxIdx * 4 &&
(u32)start < (u32)g_main_cp_state.matrix_index_a.PosNormalMtxIdx * 4 + 12) ||
((u32)start >=
XFMEM_NORMALMATRICES + ((u32)g_main_cp_state.matrix_index_a.PosNormalMtxIdx & 31) * 3 &&
(u32)start < XFMEM_NORMALMATRICES +
((u32)g_main_cp_state.matrix_index_a.PosNormalMtxIdx & 31) * 3 + 9))
{
m_pos_normal_matrix_changed = true;
}
if (((u32)start >= (u32)g_main_cp_state.matrix_index_a.Tex0MtxIdx * 4 &&
(u32)start < (u32)g_main_cp_state.matrix_index_a.Tex0MtxIdx * 4 + 12) ||
((u32)start >= (u32)g_main_cp_state.matrix_index_a.Tex1MtxIdx * 4 &&
@ -174,8 +162,6 @@ void XFStateManager::SetTexMatrixChangedA(u32 Value)
if (g_main_cp_state.matrix_index_a.Hex != Value)
{
g_vertex_manager->Flush();
if (g_main_cp_state.matrix_index_a.PosNormalMtxIdx != (Value & 0x3f))
m_pos_normal_matrix_changed = true;
m_tex_matrices_changed[0] = true;
g_main_cp_state.matrix_index_a.Hex = Value;
}
@ -201,11 +187,6 @@ void XFStateManager::ResetTexMatrixBChange()
m_tex_matrices_changed[1] = false;
}
void XFStateManager::ResetPosNormalChange()
{
m_pos_normal_matrix_changed = false;
}
void XFStateManager::SetProjectionChanged()
{
m_projection_changed = true;

View File

@ -27,9 +27,6 @@ public:
bool DidTexMatrixBChange() const { return m_tex_matrices_changed[1]; }
void ResetTexMatrixBChange();
bool DidPosNormalChange() const { return m_pos_normal_matrix_changed; }
void ResetPosNormalChange();
void SetProjectionChanged();
bool DidProjectionChange() const { return m_projection_changed; }
void ResetProjection();
@ -74,7 +71,6 @@ public:
private:
// track changes
std::array<bool, 2> m_tex_matrices_changed{};
bool m_pos_normal_matrix_changed = false;
bool m_projection_changed = false;
bool m_viewport_changed = false;
bool m_tex_mtx_info_changed = false;