mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
Compare commits
15 Commits
1b9e7ed9ce
...
55a976fe33
Author | SHA1 | Date | |
---|---|---|---|
|
55a976fe33 | ||
|
7c1d2a64f4 | ||
|
b2f6fab6f4 | ||
|
4528441c74 | ||
|
8e3f6cc519 | ||
|
7041b52ebc | ||
|
adf143a38d | ||
|
8d4f419546 | ||
|
094af17674 | ||
|
4c9e16d5d4 | ||
|
f79eb72ca5 | ||
|
f8589d5566 | ||
|
57d1043699 | ||
|
047dccd859 | ||
|
0a908dd49d |
6
BUILD.md
6
BUILD.md
@ -12,7 +12,7 @@
|
|||||||
* 22.04: `sudo apt install qtbase6-dev qtbase6-private-dev qtmultimedia6-dev libqt6svg6-dev`
|
* 22.04: `sudo apt install qtbase6-dev qtbase6-private-dev qtmultimedia6-dev libqt6svg6-dev`
|
||||||
* Older versions: `sudo apt install qtbase5-dev qtbase5-private-dev qtmultimedia5-dev libqt5svg5-dev`
|
* Older versions: `sudo apt install qtbase5-dev qtbase5-private-dev qtmultimedia5-dev libqt5svg5-dev`
|
||||||
Also add `-DUSE_QT6=OFF` to the first CMake command below.
|
Also add `-DUSE_QT6=OFF` to the first CMake command below.
|
||||||
* Fedora: `sudo dnf install gcc-c++ cmake extra-cmake-modules SDL2-devel libarchive-devel enet-devel libzstd-devel qt6-{qtbase,qtmultimedia,qtsvg}-devel wayland-devel`
|
* Fedora: `sudo dnf install gcc-c++ cmake extra-cmake-modules SDL2-devel libarchive-devel enet-devel libzstd-devel qt6-{qtbase,qtbase-private,qtmultimedia,qtsvg}-devel wayland-devel`
|
||||||
* Arch Linux: `sudo pacman -S base-devel cmake extra-cmake-modules git libpcap sdl2 qt6-{base,multimedia,svg} libarchive enet zstd`
|
* Arch Linux: `sudo pacman -S base-devel cmake extra-cmake-modules git libpcap sdl2 qt6-{base,multimedia,svg} libarchive enet zstd`
|
||||||
2. Download the melonDS repository and prepare:
|
2. Download the melonDS repository and prepare:
|
||||||
```bash
|
```bash
|
||||||
@ -40,7 +40,7 @@
|
|||||||
5. Install dependencies:
|
5. Install dependencies:
|
||||||
Replace `<prefix>` below with `mingw-w64-ucrt-x86_64` on x64 systems, or `mingw-w64-clang-aarch64` on ARM64 systems.
|
Replace `<prefix>` below with `mingw-w64-ucrt-x86_64` on x64 systems, or `mingw-w64-clang-aarch64` on ARM64 systems.
|
||||||
```bash
|
```bash
|
||||||
pacman -S <prefix>-{toolchain,cmake,SDL2,libarchive,enet,zstd}`
|
pacman -S <prefix>-{toolchain,cmake,SDL2,libarchive,enet,zstd}
|
||||||
```
|
```
|
||||||
6. Install Qt and configure the build directory
|
6. Install Qt and configure the build directory
|
||||||
* Dynamic builds (with DLLs)
|
* Dynamic builds (with DLLs)
|
||||||
@ -78,4 +78,4 @@ If you want an app bundle that can be distributed to other computers without nee
|
|||||||
melonDS provides a Nix flake with support for both macOS and Linux. The [Nix package manager](https://nixos.org) needs to be installed to use it.
|
melonDS provides a Nix flake with support for both macOS and Linux. The [Nix package manager](https://nixos.org) needs to be installed to use it.
|
||||||
|
|
||||||
* To run melonDS, just type `nix run github:melonDS-emu/melonDS`.
|
* To run melonDS, just type `nix run github:melonDS-emu/melonDS`.
|
||||||
* To get a shell for development, clone the melonDS repository and type `nix develop` in its directory.
|
* To get a shell for development, clone the melonDS repository and type `nix develop` in its directory.
|
||||||
|
@ -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)
|
||||||
|
@ -967,50 +967,58 @@ void GPU3D::SubmitPolygon() noexcept
|
|||||||
VertexSlotCounter = 1;
|
VertexSlotCounter = 1;
|
||||||
VertexSlotsFree = 0b11110;
|
VertexSlotsFree = 0b11110;
|
||||||
|
|
||||||
// culling
|
// polygon orientation
|
||||||
// TODO: work out how it works on the real thing
|
// TODO: work out how it works on the real thing
|
||||||
// the normalization part is a wild guess
|
// the normalization part is a wild guess
|
||||||
|
|
||||||
Vertex *v0, *v1, *v2, *v3;
|
Vertex *v0, *v1, *v2;
|
||||||
s64 normalX, normalY, normalZ;
|
s64 normalX, normalY, normalZ;
|
||||||
s64 dot;
|
s64 dot;
|
||||||
|
bool facingview;
|
||||||
|
|
||||||
v0 = &TempVertexBuffer[0];
|
v0 = &TempVertexBuffer[0];
|
||||||
v1 = &TempVertexBuffer[1];
|
v1 = &TempVertexBuffer[1];
|
||||||
v2 = &TempVertexBuffer[2];
|
v2 = &TempVertexBuffer[2];
|
||||||
v3 = &TempVertexBuffer[3];
|
|
||||||
|
|
||||||
normalX = ((s64)(v0->Position[1]-v1->Position[1]) * (v2->Position[3]-v1->Position[3]))
|
|
||||||
- ((s64)(v0->Position[3]-v1->Position[3]) * (v2->Position[1]-v1->Position[1]));
|
|
||||||
normalY = ((s64)(v0->Position[3]-v1->Position[3]) * (v2->Position[0]-v1->Position[0]))
|
|
||||||
- ((s64)(v0->Position[0]-v1->Position[0]) * (v2->Position[3]-v1->Position[3]));
|
|
||||||
normalZ = ((s64)(v0->Position[0]-v1->Position[0]) * (v2->Position[1]-v1->Position[1]))
|
|
||||||
- ((s64)(v0->Position[1]-v1->Position[1]) * (v2->Position[0]-v1->Position[0]));
|
|
||||||
|
|
||||||
while ((((normalX>>31) ^ (normalX>>63)) != 0) ||
|
// setup vectors for v0->v2 and v1->v2, with w serving as the z axis
|
||||||
(((normalY>>31) ^ (normalY>>63)) != 0) ||
|
s64 vector0[3] = { (s64)v0->Position[0] - v2->Position[0], (s64)v0->Position[1] - v2->Position[1], (s64)v0->Position[3] - v2->Position[3] };
|
||||||
(((normalZ>>31) ^ (normalZ>>63)) != 0))
|
s64 vector1[3] = { (s64)v1->Position[0] - v2->Position[0], (s64)v1->Position[1] - v2->Position[1], (s64)v1->Position[3] - v2->Position[3] };
|
||||||
|
|
||||||
|
// if either vector is entirely 0, the polygon is accepted, and the front facing flag is set for the rasterizer
|
||||||
|
if (((vector0[0] | vector0[1] | vector0[2]) == 0) || ((vector1[0] | vector1[1] | vector1[2]) == 0))
|
||||||
{
|
{
|
||||||
normalX >>= 4;
|
facingview = true;
|
||||||
normalY >>= 4;
|
|
||||||
normalZ >>= 4;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
dot = ((s64)v1->Position[0] * normalX) + ((s64)v1->Position[1] * normalY) + ((s64)v1->Position[3] * normalZ);
|
|
||||||
|
|
||||||
bool facingview = (dot <= 0);
|
|
||||||
|
|
||||||
if (dot < 0)
|
|
||||||
{
|
{
|
||||||
if (!(CurPolygonAttr & (1<<7)))
|
// calculate cross product of the two vectors
|
||||||
|
normalX = ((s64)vector0[1] * vector1[2]) - ((s64)vector0[2] * vector1[1]);
|
||||||
|
normalY = ((s64)vector0[2] * vector1[0]) - ((s64)vector0[0] * vector1[2]);
|
||||||
|
normalZ = ((s64)vector0[0] * vector1[1]) - ((s64)vector0[1] * vector1[0]);
|
||||||
|
|
||||||
|
// normalization (currently a guess)
|
||||||
|
while ((((normalX>>31) ^ (normalX>>63)) != 0) ||
|
||||||
|
(((normalY>>31) ^ (normalY>>63)) != 0) ||
|
||||||
|
(((normalZ>>31) ^ (normalZ>>63)) != 0))
|
||||||
{
|
{
|
||||||
LastStripPolygon = NULL;
|
normalX >>= 4;
|
||||||
return;
|
normalY >>= 4;
|
||||||
|
normalZ >>= 4;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (dot > 0)
|
// calculate dot product against the "camera vector" (we can use any of the vertices to do that)
|
||||||
{
|
dot = (v1->Position[0] * normalX) + (v1->Position[1] * normalY) + (v1->Position[3] * normalZ);
|
||||||
if (!(CurPolygonAttr & (1<<6)))
|
|
||||||
|
// front facing flag is set for the rasterizer to be used for:
|
||||||
|
// unwinding vertices
|
||||||
|
// determining whether slopes should be treated as "swapped"
|
||||||
|
// and whether to overwrite a pixel with equal depth when using the < depth test
|
||||||
|
facingview = (dot >= 0);
|
||||||
|
|
||||||
|
// cull polygon faces
|
||||||
|
if (!(((dot >= 0) && (CurPolygonAttr & (1<<7))) || // front facing
|
||||||
|
((dot <= 0) && (CurPolygonAttr & (1<<6))))) // back facing
|
||||||
{
|
{
|
||||||
LastStripPolygon = NULL;
|
LastStripPolygon = NULL;
|
||||||
return;
|
return;
|
||||||
|
@ -681,6 +681,7 @@ void main()
|
|||||||
|
|
||||||
vec4 fpos;
|
vec4 fpos;
|
||||||
fpos.xy = (((vec2(vPosition.xy) ) * 2.0) / uScreenSize) - 1.0;
|
fpos.xy = (((vec2(vPosition.xy) ) * 2.0) / uScreenSize) - 1.0;
|
||||||
|
fpos.z = 0.0;
|
||||||
fZ = float(vPosition.z << zshift) / 16777216.0;
|
fZ = float(vPosition.z << zshift) / 16777216.0;
|
||||||
fpos.w = float(vPosition.w) / 65536.0f;
|
fpos.w = float(vPosition.w) / 65536.0f;
|
||||||
fpos.xy *= fpos.w;
|
fpos.xy *= fpos.w;
|
||||||
|
@ -113,7 +113,7 @@ Gdb::ReadResult GdbStub::ParseAndSetupPacket()
|
|||||||
ReadResult result, prevResult;
|
ReadResult result, prevResult;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
ReadResult result = TryParsePacket(i, packetStart, packetSize, packetContentSize);
|
result = TryParsePacket(i, packetStart, packetSize, packetContentSize);
|
||||||
if (result == ReadResult::NoPacket)
|
if (result == ReadResult::NoPacket)
|
||||||
break;
|
break;
|
||||||
if (result != ReadResult::CmdRecvd && result != ReadResult::Break)
|
if (result != ReadResult::CmdRecvd && result != ReadResult::Break)
|
||||||
|
@ -133,6 +133,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>By Arisotura, the melonDS team <a href="https://github.com/melonDS-emu/melonDS/graphs/contributors">and contributors</a>.</string>
|
<string>By Arisotura, the melonDS team <a href="https://github.com/melonDS-emu/melonDS/graphs/contributors">and contributors</a>.</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -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