mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 05:17:40 -07:00
Compare commits
8 Commits
78eb40d03d
...
b4f56d4e01
Author | SHA1 | Date | |
---|---|---|---|
|
b4f56d4e01 | ||
|
7c1d2a64f4 | ||
|
b2f6fab6f4 | ||
|
341f403061 | ||
|
546e8c4ad8 | ||
|
c33cd1f35f | ||
|
ea4293f40b | ||
|
7ba7422ff8 |
@ -127,6 +127,8 @@ if (ENABLE_JIT)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
target_include_directories(core INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
|
||||||
set(MELONDS_VERSION_SUFFIX "$ENV{MELONDS_VERSION_SUFFIX}" CACHE STRING "Suffix to add to displayed melonDS version")
|
set(MELONDS_VERSION_SUFFIX "$ENV{MELONDS_VERSION_SUFFIX}" CACHE STRING "Suffix to add to displayed melonDS version")
|
||||||
option(MELONDS_EMBED_BUILD_INFO "Embed detailed build info into the binary" OFF)
|
option(MELONDS_EMBED_BUILD_INFO "Embed detailed build info into the binary" OFF)
|
||||||
set(MELONDS_GIT_BRANCH "$ENV{MELONDS_GIT_BRANCH}" CACHE STRING "The Git branch used for this build")
|
set(MELONDS_GIT_BRANCH "$ENV{MELONDS_GIT_BRANCH}" CACHE STRING "The Git branch used for this build")
|
||||||
@ -178,13 +180,14 @@ endif()
|
|||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries(core PRIVATE ole32 comctl32 wsock32 ws2_32)
|
target_link_libraries(core PRIVATE ole32 comctl32 wsock32 ws2_32)
|
||||||
|
target_compile_definitions(core PUBLIC WIN32_LEAN_AND_MEAN NOMINMAX)
|
||||||
elseif(NOT APPLE AND NOT HAIKU)
|
elseif(NOT APPLE AND NOT HAIKU)
|
||||||
check_library_exists(rt shm_open "" NEED_LIBRT)
|
check_library_exists(rt shm_open "" NEED_LIBRT)
|
||||||
if (NEED_LIBRT)
|
if (NEED_LIBRT)
|
||||||
target_link_libraries(core PRIVATE rt)
|
target_link_libraries(core PRIVATE rt)
|
||||||
endif()
|
endif()
|
||||||
elseif(HAIKU)
|
elseif(HAIKU)
|
||||||
target_link_libraries(core PRIVATE network)
|
target_link_libraries(core PRIVATE network)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ENABLE_JIT_PROFILING)
|
if (ENABLE_JIT_PROFILING)
|
||||||
|
@ -598,6 +598,20 @@ void SoftRenderer::PlotTranslucentPixel(const GPU3D& gpu3d, u32 pixeladdr, u32 c
|
|||||||
AttrBuffer[pixeladdr] = attr;
|
AttrBuffer[pixeladdr] = attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SoftRenderer::CheckForLine(RendererPolygon* rp) const
|
||||||
|
{
|
||||||
|
Polygon* polygon = rp->PolyData;
|
||||||
|
|
||||||
|
// check for line polygons
|
||||||
|
if (polygon->Vertices[rp->CurVL]->FinalPosition[0] == polygon->Vertices[rp->CurVR]->FinalPosition[0]
|
||||||
|
&& polygon->Vertices[rp->CurVL]->FinalPosition[1] == polygon->Vertices[rp->CurVR]->FinalPosition[1]
|
||||||
|
&& polygon->Vertices[rp->NextVL]->FinalPosition[0] == polygon->Vertices[rp->NextVR]->FinalPosition[0]
|
||||||
|
&& polygon->Vertices[rp->NextVL]->FinalPosition[1] == polygon->Vertices[rp->NextVR]->FinalPosition[1])
|
||||||
|
rp->Line = true;
|
||||||
|
else
|
||||||
|
rp->Line = false;
|
||||||
|
}
|
||||||
|
|
||||||
void SoftRenderer::SetupPolygonLeftEdge(SoftRenderer::RendererPolygon* rp, s32 y) const
|
void SoftRenderer::SetupPolygonLeftEdge(SoftRenderer::RendererPolygon* rp, s32 y) const
|
||||||
{
|
{
|
||||||
Polygon* polygon = rp->PolyData;
|
Polygon* polygon = rp->PolyData;
|
||||||
@ -702,6 +716,7 @@ void SoftRenderer::SetupPolygon(SoftRenderer::RendererPolygon* rp, Polygon* poly
|
|||||||
{
|
{
|
||||||
SetupPolygonLeftEdge(rp, ytop);
|
SetupPolygonLeftEdge(rp, ytop);
|
||||||
SetupPolygonRightEdge(rp, ytop);
|
SetupPolygonRightEdge(rp, ytop);
|
||||||
|
CheckForLine(rp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -730,15 +745,23 @@ void SoftRenderer::RenderShadowMaskScanline(const GPU3D& gpu3d, RendererPolygon*
|
|||||||
|
|
||||||
if (polygon->YTop != polygon->YBottom)
|
if (polygon->YTop != polygon->YBottom)
|
||||||
{
|
{
|
||||||
if (y >= polygon->Vertices[rp->NextVL]->FinalPosition[1] && rp->CurVL != polygon->VBottom)
|
bool updateLeftSlope = (y >= polygon->Vertices[rp->NextVL]->FinalPosition[1] && rp->CurVL != polygon->VBottom);
|
||||||
|
bool updateRightSlope = (y >= polygon->Vertices[rp->NextVR]->FinalPosition[1] && rp->CurVR != polygon->VBottom);
|
||||||
|
|
||||||
|
if (updateLeftSlope)
|
||||||
{
|
{
|
||||||
SetupPolygonLeftEdge(rp, y);
|
SetupPolygonLeftEdge(rp, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y >= polygon->Vertices[rp->NextVR]->FinalPosition[1] && rp->CurVR != polygon->VBottom)
|
if (updateRightSlope)
|
||||||
{
|
{
|
||||||
SetupPolygonRightEdge(rp, y);
|
SetupPolygonRightEdge(rp, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (updateLeftSlope || updateRightSlope)
|
||||||
|
{
|
||||||
|
CheckForLine(rp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vertex *vlcur, *vlnext, *vrcur, *vrnext;
|
Vertex *vlcur, *vlnext, *vrcur, *vrnext;
|
||||||
@ -819,7 +842,7 @@ void SoftRenderer::RenderShadowMaskScanline(const GPU3D& gpu3d, RendererPolygon*
|
|||||||
{
|
{
|
||||||
l_filledge = ((rp->SlopeL.Negative || !rp->SlopeL.XMajor)
|
l_filledge = ((rp->SlopeL.Negative || !rp->SlopeL.XMajor)
|
||||||
|| (y == polygon->YBottom-1) && rp->SlopeL.XMajor && (vlnext->FinalPosition[0] != vrnext->FinalPosition[0]))
|
|| (y == polygon->YBottom-1) && rp->SlopeL.XMajor && (vlnext->FinalPosition[0] != vrnext->FinalPosition[0]))
|
||||||
|| (rp->SlopeL.Increment == rp->SlopeR.Increment) && (xstart+l_edgelen == xend+1);
|
|| rp->Line;
|
||||||
r_filledge = (!rp->SlopeR.Negative && rp->SlopeR.XMajor) || (rp->SlopeR.Increment==0)
|
r_filledge = (!rp->SlopeR.Negative && rp->SlopeR.XMajor) || (rp->SlopeR.Increment==0)
|
||||||
|| (y == polygon->YBottom-1) && rp->SlopeR.XMajor && (vlnext->FinalPosition[0] != vrnext->FinalPosition[0]);
|
|| (y == polygon->YBottom-1) && rp->SlopeR.XMajor && (vlnext->FinalPosition[0] != vrnext->FinalPosition[0]);
|
||||||
}
|
}
|
||||||
@ -955,15 +978,23 @@ void SoftRenderer::RenderPolygonScanline(const GPU& gpu, RendererPolygon* rp, s3
|
|||||||
|
|
||||||
if (polygon->YTop != polygon->YBottom)
|
if (polygon->YTop != polygon->YBottom)
|
||||||
{
|
{
|
||||||
if (y >= polygon->Vertices[rp->NextVL]->FinalPosition[1] && rp->CurVL != polygon->VBottom)
|
bool updateLeftSlope = (y >= polygon->Vertices[rp->NextVL]->FinalPosition[1] && rp->CurVL != polygon->VBottom);
|
||||||
|
bool updateRightSlope = (y >= polygon->Vertices[rp->NextVR]->FinalPosition[1] && rp->CurVR != polygon->VBottom);
|
||||||
|
|
||||||
|
if (updateLeftSlope)
|
||||||
{
|
{
|
||||||
SetupPolygonLeftEdge(rp, y);
|
SetupPolygonLeftEdge(rp, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y >= polygon->Vertices[rp->NextVR]->FinalPosition[1] && rp->CurVR != polygon->VBottom)
|
if (updateRightSlope)
|
||||||
{
|
{
|
||||||
SetupPolygonRightEdge(rp, y);
|
SetupPolygonRightEdge(rp, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (updateLeftSlope || updateRightSlope)
|
||||||
|
{
|
||||||
|
CheckForLine(rp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vertex *vlcur, *vlnext, *vrcur, *vrnext;
|
Vertex *vlcur, *vlnext, *vrcur, *vrnext;
|
||||||
@ -1016,7 +1047,7 @@ void SoftRenderer::RenderPolygonScanline(const GPU& gpu, RendererPolygon* rp, s3
|
|||||||
// * the bottom-most pixel of negative x-major slopes are filled if they are next to a flat bottom edge
|
// * the bottom-most pixel of negative x-major slopes are filled if they are next to a flat bottom edge
|
||||||
// edges are always filled if antialiasing/edgemarking are enabled,
|
// edges are always filled if antialiasing/edgemarking are enabled,
|
||||||
// if the pixels are translucent and alpha blending is enabled, or if the polygon is wireframe
|
// if the pixels are translucent and alpha blending is enabled, or if the polygon is wireframe
|
||||||
// checkme: do swapped line polygons exist?
|
// checkme: do swapped line polygons exist? if they do then they likely should also be filled
|
||||||
if ((gpu.GPU3D.RenderDispCnt & ((1<<4)|(1<<5))) || ((polyalpha < 31) && (gpu.GPU3D.RenderDispCnt & (1<<3))) || wireframe)
|
if ((gpu.GPU3D.RenderDispCnt & ((1<<4)|(1<<5))) || ((polyalpha < 31) && (gpu.GPU3D.RenderDispCnt & (1<<3))) || wireframe)
|
||||||
{
|
{
|
||||||
l_filledge = true;
|
l_filledge = true;
|
||||||
@ -1061,7 +1092,7 @@ void SoftRenderer::RenderPolygonScanline(const GPU& gpu, RendererPolygon* rp, s3
|
|||||||
{
|
{
|
||||||
l_filledge = ((rp->SlopeL.Negative || !rp->SlopeL.XMajor)
|
l_filledge = ((rp->SlopeL.Negative || !rp->SlopeL.XMajor)
|
||||||
|| (y == polygon->YBottom-1) && rp->SlopeL.XMajor && (vlnext->FinalPosition[0] != vrnext->FinalPosition[0]))
|
|| (y == polygon->YBottom-1) && rp->SlopeL.XMajor && (vlnext->FinalPosition[0] != vrnext->FinalPosition[0]))
|
||||||
|| (rp->SlopeL.Increment == rp->SlopeR.Increment) && (xstart+l_edgelen == xend+1);
|
|| rp->Line;
|
||||||
r_filledge = (!rp->SlopeR.Negative && rp->SlopeR.XMajor) || (rp->SlopeR.Increment==0)
|
r_filledge = (!rp->SlopeR.Negative && rp->SlopeR.XMajor) || (rp->SlopeR.Increment==0)
|
||||||
|| (y == polygon->YBottom-1) && rp->SlopeR.XMajor && (vlnext->FinalPosition[0] != vrnext->FinalPosition[0]);
|
|| (y == polygon->YBottom-1) && rp->SlopeR.XMajor && (vlnext->FinalPosition[0] != vrnext->FinalPosition[0]);
|
||||||
}
|
}
|
||||||
|
@ -441,6 +441,7 @@ private:
|
|||||||
s32 XL, XR;
|
s32 XL, XR;
|
||||||
u32 CurVL, CurVR;
|
u32 CurVL, CurVR;
|
||||||
u32 NextVL, NextVR;
|
u32 NextVL, NextVR;
|
||||||
|
bool Line;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -448,6 +449,7 @@ private:
|
|||||||
void TextureLookup(const GPU& gpu, u32 texparam, u32 texpal, s16 s, s16 t, u16* color, u8* alpha) const;
|
void TextureLookup(const GPU& gpu, u32 texparam, u32 texpal, s16 s, s16 t, u16* color, u8* alpha) const;
|
||||||
u32 RenderPixel(const GPU& gpu, const Polygon* polygon, u8 vr, u8 vg, u8 vb, s16 s, s16 t) const;
|
u32 RenderPixel(const GPU& gpu, const Polygon* polygon, u8 vr, u8 vg, u8 vb, s16 s, s16 t) const;
|
||||||
void PlotTranslucentPixel(const GPU3D& gpu3d, u32 pixeladdr, u32 color, u32 z, u32 polyattr, u32 shadow);
|
void PlotTranslucentPixel(const GPU3D& gpu3d, u32 pixeladdr, u32 color, u32 z, u32 polyattr, u32 shadow);
|
||||||
|
void CheckForLine(RendererPolygon* rp) const;
|
||||||
void SetupPolygonLeftEdge(RendererPolygon* rp, s32 y) const;
|
void SetupPolygonLeftEdge(RendererPolygon* rp, s32 y) const;
|
||||||
void SetupPolygonRightEdge(RendererPolygon* rp, s32 y) const;
|
void SetupPolygonRightEdge(RendererPolygon* rp, s32 y) const;
|
||||||
void SetupPolygon(RendererPolygon* rp, Polygon* polygon) const;
|
void SetupPolygon(RendererPolygon* rp, Polygon* polygon) const;
|
||||||
|
@ -91,8 +91,7 @@ add_compile_definitions(ARCHIVE_SUPPORT_ENABLED)
|
|||||||
add_executable(melonDS ${SOURCES_QT_SDL})
|
add_executable(melonDS ${SOURCES_QT_SDL})
|
||||||
|
|
||||||
add_subdirectory("../../net"
|
add_subdirectory("../../net"
|
||||||
"${CMAKE_BINARY_DIR}/net"
|
${CMAKE_BINARY_DIR}/net)
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(melonDS PRIVATE net-utils)
|
target_link_libraries(melonDS PRIVATE net-utils)
|
||||||
|
|
||||||
@ -171,10 +170,10 @@ if (BUILD_STATIC)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
target_include_directories(melonDS PUBLIC
|
||||||
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../..")
|
"${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||||
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../../net")
|
|
||||||
if (USE_QT6)
|
if (USE_QT6)
|
||||||
target_include_directories(melonDS PUBLIC ${Qt6Gui_PRIVATE_INCLUDE_DIRS})
|
target_include_directories(melonDS PUBLIC ${Qt6Gui_PRIVATE_INCLUDE_DIRS})
|
||||||
else()
|
else()
|
||||||
|
@ -11,9 +11,9 @@ add_library(net-utils STATIC
|
|||||||
MPInterface.cpp
|
MPInterface.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(net-utils PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
target_include_directories(net-utils PUBLIC
|
||||||
target_include_directories(net-utils PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||||
|
|
||||||
option(USE_SYSTEM_LIBSLIRP "Use system libslirp instead of the bundled version" OFF)
|
option(USE_SYSTEM_LIBSLIRP "Use system libslirp instead of the bundled version" OFF)
|
||||||
if (USE_SYSTEM_LIBSLIRP)
|
if (USE_SYSTEM_LIBSLIRP)
|
||||||
|
Loading…
Reference in New Issue
Block a user