Merge remote-tracking branch 'upstream/master' into slope-gap-fix
This commit is contained in:
commit
36ff3a41b9
|
@ -0,0 +1,18 @@
|
|||
# Vendored Dependencies
|
||||
src/frontend/glad/** linguist-vendored
|
||||
src/frontend/qt_sdl/gif-h/** linguist-vendored
|
||||
src/frontend/qt_sdl/toml/** linguist-vendored
|
||||
src/net/libslirp/** linguist-vendored
|
||||
src/net/pcap/** linguist-vendored
|
||||
src/sha1/** linguist-vendored
|
||||
src/teakra/** linguist-vendored
|
||||
src/tiny-AES-c/** linguist-vendored
|
||||
src/xxhash/** linguist-vendored
|
||||
|
||||
# A handful of custom files embedded in the vendored dependencies
|
||||
|
||||
## Ad-hoc CMakeLists.txt for melonDS
|
||||
src/net/libslirp/src/CMakeLists.txt -linguist-vendored
|
||||
|
||||
## glib stub
|
||||
src/net/libslirp/src/glib/** -linguist-vendored
|
|
@ -4,6 +4,7 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- master
|
||||
- ci/vcpkg-update
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
@ -27,7 +28,7 @@ jobs:
|
|||
- name: Set up vcpkg
|
||||
uses: lukka/run-vcpkg@v11
|
||||
with:
|
||||
vcpkgGitCommitId: 53bef8994c541b6561884a8395ea35715ece75db
|
||||
vcpkgGitCommitId: 1de2026f28ead93ff1773e6e680387643e914ea1
|
||||
- name: Build
|
||||
uses: lukka/run-cmake@v10
|
||||
with:
|
||||
|
|
|
@ -4,40 +4,35 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- master
|
||||
- ci/vcpkg-update
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: msys2/setup-msys2@v2
|
||||
- name: Check out sources
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up MSYS2
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: MINGW64
|
||||
update: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: pacman -Sq --noconfirm git pkgconf mingw-w64-x86_64-{cmake,SDL2,qt5-static,libarchive,toolchain}
|
||||
|
||||
msystem: ucrt64
|
||||
update: true
|
||||
pacboy: gcc:p cmake:p ninja:p make:p
|
||||
- name: Set up vcpkg
|
||||
uses: lukka/run-vcpkg@v11
|
||||
with:
|
||||
vcpkgGitCommitId: 1de2026f28ead93ff1773e6e680387643e914ea1
|
||||
- name: Configure
|
||||
working-directory: ${{runner.workspace}}
|
||||
run: cmake -B build $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_STATIC=ON -DCMAKE_PREFIX_PATH=C:/tools/msys64/mingw64/qt5-static
|
||||
|
||||
- name: Make
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
run: cmake --build .
|
||||
|
||||
- uses: actions/upload-artifact@v1
|
||||
run: cmake --preset=release-mingw-x86_64
|
||||
- name: Build
|
||||
run: cmake --build --preset=release-mingw-x86_64
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: melonDS-windows-x86_64
|
||||
path: ${{runner.workspace}}\build\melonDS.exe
|
||||
path: .\build\release-mingw-x86_64\melonDS.exe
|
||||
|
|
|
@ -7,8 +7,8 @@ endif()
|
|||
|
||||
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_SOURCE_DIR}/cmake/DefaultBuildFlags.cmake")
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/DefaultBuildFlags.cmake")
|
||||
|
||||
option(USE_VCPKG "Use vcpkg for dependency packages" OFF)
|
||||
if (USE_VCPKG)
|
||||
|
|
|
@ -20,6 +20,23 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "release-mingw-x86_64",
|
||||
"inherits": "release-vcpkg",
|
||||
"displayName": "Windows MinGW release (x86_64)",
|
||||
"binaryDir": "${sourceDir}/build/release-mingw-x86_64",
|
||||
"generator": "Ninja",
|
||||
"cacheVariables": {
|
||||
"USE_QT6": {
|
||||
"type": "BOOL",
|
||||
"value": "ON"
|
||||
},
|
||||
"BUILD_STATIC": {
|
||||
"type": "BOOL",
|
||||
"value": "ON"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "release-mac-x86_64",
|
||||
"inherits": "release-vcpkg",
|
||||
|
@ -44,6 +61,10 @@
|
|||
"name": "release-vcpkg",
|
||||
"configurePreset": "release-vcpkg"
|
||||
},
|
||||
{
|
||||
"name": "release-mingw-x86_64",
|
||||
"configurePreset": "release-mingw-x86_64"
|
||||
},
|
||||
{
|
||||
"name": "release-mac-x86_64",
|
||||
"configurePreset": "release-mac-x86_64"
|
||||
|
@ -85,4 +106,4 @@
|
|||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<a href="http://melonds.kuribo64.net/downloads.php" alt="Release: 0.9.5"><img src="https://img.shields.io/badge/release-0.9.5-%235c913b.svg"></a>
|
||||
<a href="https://www.gnu.org/licenses/gpl-3.0" alt="License: GPLv3"><img src="https://img.shields.io/badge/License-GPL%20v3-%23ff554d.svg"></a>
|
||||
<a href="https://kiwiirc.com/client/irc.badnik.net/?nick=IRC-Source_?#melonds" alt="IRC channel: #melonds"><img src="https://img.shields.io/badge/IRC%20chat-%23melonds-%23dd2e44.svg"></a>
|
||||
<a href="https://discord.gg/pAMAtExcqV" alt="Discord"><img src="https://img.shields.io/badge/Discord-Kuribo64-7289da?logo=discord&logoColor=white"></a>
|
||||
<br>
|
||||
<a href="https://github.com/melonDS-emu/melonDS/actions/workflows/build-windows.yml?query=event%3Apush"><img src="https://github.com/melonDS-emu/melonDS/actions/workflows/build-windows.yml/badge.svg" /></a>
|
||||
<a href="https://github.com/melonDS-emu/melonDS/actions/workflows/build-ubuntu.yml?query=event%3Apush"><img src="https://github.com/melonDS-emu/melonDS/actions/workflows/build-ubuntu.yml/badge.svg" /></a>
|
||||
|
|
|
@ -4,10 +4,12 @@ set(_DEFAULT_VCPKG_ROOT "${CMAKE_SOURCE_DIR}/vcpkg")
|
|||
set(VCPKG_ROOT "${_DEFAULT_VCPKG_ROOT}" CACHE STRING "The path to the vcpkg repository")
|
||||
|
||||
if (VCPKG_ROOT STREQUAL "${_DEFAULT_VCPKG_ROOT}")
|
||||
file(LOCK "${_DEFAULT_VCPKG_ROOT}" DIRECTORY GUARD FILE)
|
||||
if (APPLE) # this doesn't work on non-macOS
|
||||
file(LOCK "${_DEFAULT_VCPKG_ROOT}" DIRECTORY GUARD FILE)
|
||||
endif()
|
||||
FetchContent_Declare(vcpkg
|
||||
GIT_REPOSITORY "https://github.com/Microsoft/vcpkg.git"
|
||||
GIT_TAG 2024.01.12
|
||||
GIT_TAG 2024.07.12
|
||||
SOURCE_DIR "${CMAKE_SOURCE_DIR}/vcpkg")
|
||||
FetchContent_MakeAvailable(vcpkg)
|
||||
endif()
|
||||
|
@ -16,6 +18,18 @@ set(VCPKG_OVERLAY_TRIPLETS "${CMAKE_SOURCE_DIR}/cmake/overlay-triplets")
|
|||
|
||||
option(USE_RECOMMENDED_TRIPLETS "Use the recommended triplets that are used for official builds" ON)
|
||||
|
||||
# Duplicated here because it needs to be set before project()
|
||||
if (NOT WIN32)
|
||||
option(USE_QT6 "Build using Qt 6 instead of 5" ON)
|
||||
else()
|
||||
option(USE_QT6 "Build using Qt 6 instead of 5" OFF)
|
||||
endif()
|
||||
|
||||
if (NOT USE_QT6)
|
||||
list(APPEND VCPKG_MANIFEST_FEATURES qt5)
|
||||
set(VCPKG_MANIFEST_NO_DEFAULT_FEATURES ON)
|
||||
endif()
|
||||
|
||||
if (CMAKE_OSX_ARCHITECTURES MATCHES ";")
|
||||
message(FATAL_ERROR "macOS universal builds are not supported. Build them individually and combine afterwards instead.")
|
||||
endif()
|
||||
|
@ -47,7 +61,7 @@ if (USE_RECOMMENDED_TRIPLETS)
|
|||
elseif(WIN32)
|
||||
# TODO Windows arm64 if possible
|
||||
set(_CAN_TARGET_AS_HOST ON)
|
||||
set(_WANTED_TRIPLET x64-mingw-static)
|
||||
set(_WANTED_TRIPLET x64-mingw-static-release)
|
||||
endif()
|
||||
|
||||
# Don't override it if the user set something else
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
set(VCPKG_TARGET_ARCHITECTURE x64)
|
||||
set(VCPKG_CRT_LINKAGE dynamic)
|
||||
set(VCPKG_LIBRARY_LINKAGE static)
|
||||
set(VCPKG_ENV_PASSTHROUGH PATH)
|
||||
set(VCPKG_BUILD_TYPE release)
|
||||
|
||||
set(VCPKG_CMAKE_SYSTEM_NAME MinGW)
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -33,17 +33,26 @@ ARCodeFile::ARCodeFile(const std::string& filename)
|
|||
{
|
||||
Filename = filename;
|
||||
|
||||
Error = false;
|
||||
|
||||
Categories.clear();
|
||||
|
||||
if (!Load())
|
||||
Error = true;
|
||||
}
|
||||
|
||||
ARCodeFile::~ARCodeFile()
|
||||
std::vector<ARCode> ARCodeFile::GetCodes() const noexcept
|
||||
{
|
||||
Categories.clear();
|
||||
if (Error)
|
||||
return {};
|
||||
|
||||
std::vector<ARCode> codes;
|
||||
|
||||
for (const ARCodeCat& cat : Categories)
|
||||
{
|
||||
for (const ARCode& code : cat.Codes)
|
||||
{
|
||||
codes.push_back(code);
|
||||
}
|
||||
}
|
||||
|
||||
return codes;
|
||||
}
|
||||
|
||||
bool ARCodeFile::Load()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -48,14 +48,16 @@ class ARCodeFile
|
|||
{
|
||||
public:
|
||||
ARCodeFile(const std::string& filename);
|
||||
~ARCodeFile();
|
||||
~ARCodeFile() noexcept = default;
|
||||
|
||||
bool Error;
|
||||
[[nodiscard]] std::vector<ARCode> GetCodes() const noexcept;
|
||||
|
||||
bool Error = false;
|
||||
|
||||
bool Load();
|
||||
bool Save();
|
||||
|
||||
ARCodeCatList Categories;
|
||||
ARCodeCatList Categories {};
|
||||
|
||||
private:
|
||||
std::string Filename;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -31,7 +31,6 @@ using Platform::LogLevel;
|
|||
|
||||
AREngine::AREngine(melonDS::NDS& nds) : NDS(nds)
|
||||
{
|
||||
CodeFile = nullptr;
|
||||
}
|
||||
|
||||
#define case16(x) \
|
||||
|
@ -388,19 +387,12 @@ void AREngine::RunCheat(const ARCode& arcode)
|
|||
|
||||
void AREngine::RunCheats()
|
||||
{
|
||||
if (!CodeFile) return;
|
||||
if (Cheats.empty()) return;
|
||||
|
||||
for (ARCodeCatList::iterator i = CodeFile->Categories.begin(); i != CodeFile->Categories.end(); i++)
|
||||
for (const ARCode& code : Cheats)
|
||||
{
|
||||
ARCodeCat& cat = *i;
|
||||
|
||||
for (ARCodeList::iterator j = cat.Codes.begin(); j != cat.Codes.end(); j++)
|
||||
{
|
||||
ARCode& code = *j;
|
||||
|
||||
if (code.Enabled)
|
||||
RunCheat(code);
|
||||
}
|
||||
if (code.Enabled)
|
||||
RunCheat(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
|||
#ifndef ARENGINE_H
|
||||
#define ARENGINE_H
|
||||
|
||||
#include <vector>
|
||||
#include "ARCodeFile.h"
|
||||
|
||||
namespace melonDS
|
||||
|
@ -29,14 +30,13 @@ class AREngine
|
|||
public:
|
||||
AREngine(melonDS::NDS& nds);
|
||||
|
||||
ARCodeFile* GetCodeFile() { return CodeFile; }
|
||||
void SetCodeFile(ARCodeFile* file) { CodeFile = file; }
|
||||
|
||||
std::vector<ARCode> Cheats {};
|
||||
private:
|
||||
friend class ARM;
|
||||
void RunCheats();
|
||||
void RunCheat(const ARCode& arcode);
|
||||
private:
|
||||
|
||||
melonDS::NDS& NDS;
|
||||
ARCodeFile* CodeFile; // AR code file - frontend is responsible for managing this
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -38,7 +38,7 @@ void A_UNK(ARM* cpu)
|
|||
{
|
||||
Log(LogLevel::Warn, "undefined ARM%d instruction %08X @ %08X\n", cpu->Num?7:9, cpu->CurInstr, cpu->R[15]-8);
|
||||
#ifdef GDBSTUB_ENABLED
|
||||
cpu->GdbStub.Enter(true, Gdb::TgtStatus::FaultInsn, cpu->R[15]-8);
|
||||
cpu->GdbStub.Enter(cpu->GdbStub.IsConnected(), Gdb::TgtStatus::FaultInsn, cpu->R[15]-8);
|
||||
#endif
|
||||
//for (int i = 0; i < 16; i++) printf("R%d: %08X\n", i, cpu->R[i]);
|
||||
//NDS::Halt();
|
||||
|
@ -56,7 +56,7 @@ void T_UNK(ARM* cpu)
|
|||
{
|
||||
Log(LogLevel::Warn, "undefined THUMB%d instruction %04X @ %08X\n", cpu->Num?7:9, cpu->CurInstr, cpu->R[15]-4);
|
||||
#ifdef GDBSTUB_ENABLED
|
||||
cpu->GdbStub.Enter(true, Gdb::TgtStatus::FaultInsn, cpu->R[15]-4);
|
||||
cpu->GdbStub.Enter(cpu->GdbStub.IsConnected(), Gdb::TgtStatus::FaultInsn, cpu->R[15]-4);
|
||||
#endif
|
||||
//NDS::Halt();
|
||||
u32 oldcpsr = cpu->CPSR;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2022 melonDS team, RSDuck
|
||||
Copyright 2016-2024 melonDS team, RSDuck
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2022 melonDS team, RSDuck
|
||||
Copyright 2016-2024 melonDS team, RSDuck
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2022 melonDS team, RSDuck
|
||||
Copyright 2016-2024 melonDS team, RSDuck
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2022 melonDS team, RSDuck
|
||||
Copyright 2016-2024 melonDS team, RSDuck
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2022 melonDS team, RSDuck
|
||||
Copyright 2016-2024 melonDS team, RSDuck
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2022 melonDS team, RSDuck
|
||||
Copyright 2016-2024 melonDS team, RSDuck
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2022 melonDS team, RSDuck
|
||||
Copyright 2016-2024 melonDS team, RSDuck
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2022 melonDS team, RSDuck
|
||||
Copyright 2016-2024 melonDS team, RSDuck
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2022 melonDS team, RSDuck
|
||||
Copyright 2016-2024 melonDS team, RSDuck
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2022 melonDS team, RSDuck
|
||||
Copyright 2016-2024 melonDS team, RSDuck
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2022 melonDS team, RSDuck
|
||||
Copyright 2016-2024 melonDS team, RSDuck
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -133,6 +133,7 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.h.in" "${CMAKE_CURRENT_BINAR
|
|||
target_sources(core PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/version.h")
|
||||
target_include_directories(core PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
add_subdirectory(teakra EXCLUDE_FROM_ALL)
|
||||
# Workaround for building teakra with -O0 on Windows either failing or hanging forever
|
||||
target_compile_options(teakra PRIVATE "$<$<CONFIG:DEBUG>:-Og>")
|
||||
|
@ -140,7 +141,9 @@ target_link_libraries(core PRIVATE teakra)
|
|||
|
||||
if (NOT MSVC)
|
||||
# MSVC has its own compiler flag syntax; if we ever support it,
|
||||
# be sure to silence any equivalent warnings there.
|
||||
# be sure to add equivalent flags here.
|
||||
|
||||
target_compile_options(core PUBLIC -fwrapv)
|
||||
|
||||
target_compile_options(core PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-Wno-invalid-offsetof>")
|
||||
# These warnings are excessive, and are only triggered in the ARMJIT code
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
26
src/DSi.cpp
26
src/DSi.cpp
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -70,8 +70,28 @@ const u32 NDMAModes[] =
|
|||
0xFF, // wifi / GBA cart slot (TODO)
|
||||
};
|
||||
|
||||
DSi::DSi(DSiArgs&& args) noexcept :
|
||||
NDS(std::move(args), 1),
|
||||
/*DSi::DSi() noexcept :
|
||||
DSi(
|
||||
DSiArgs {
|
||||
NDSArgs {
|
||||
nullptr,
|
||||
nullptr,
|
||||
bios_arm9_bin,
|
||||
bios_arm7_bin,
|
||||
Firmware(0),
|
||||
},
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
false
|
||||
}
|
||||
)
|
||||
{
|
||||
}*/
|
||||
|
||||
DSi::DSi(DSiArgs&& args, void* userdata) noexcept :
|
||||
NDS(std::move(args), 1, userdata),
|
||||
NDMAs {
|
||||
DSi_NDMA(0, 0, *this),
|
||||
DSi_NDMA(0, 1, *this),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -130,7 +130,8 @@ public:
|
|||
void ARM7IOWrite32(u32 addr, u32 val) override;
|
||||
|
||||
public:
|
||||
DSi(DSiArgs&& args) noexcept;
|
||||
DSi(DSiArgs&& args, void* userdata = nullptr) noexcept;
|
||||
//DSi() noexcept;
|
||||
~DSi() noexcept override;
|
||||
DSi(const DSi&) = delete;
|
||||
DSi& operator=(const DSi&) = delete;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace melonDS
|
|||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wattributes"
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 11) // gcc 11.*
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 11) && defined(__SIZEOF_INT128__) // gcc 11.*
|
||||
// NOTE: Yes, the compiler does *not* recognize this code pattern, so it is indeed an optimization.
|
||||
__attribute((always_inline)) static void Bswap128(void* Dst, const void* Src)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -410,7 +410,7 @@ void DSi_Camera::DoSavestate(Savestate* file)
|
|||
|
||||
void DSi_Camera::Reset()
|
||||
{
|
||||
Platform::Camera_Stop(Num);
|
||||
Platform::Camera_Stop(Num, DSi.UserData);
|
||||
|
||||
DataPos = 0;
|
||||
RegAddr = 0;
|
||||
|
@ -435,7 +435,7 @@ void DSi_Camera::Reset()
|
|||
|
||||
void DSi_Camera::Stop()
|
||||
{
|
||||
Platform::Camera_Stop(Num);
|
||||
Platform::Camera_Stop(Num, DSi.UserData);
|
||||
}
|
||||
|
||||
bool DSi_Camera::IsActivated() const
|
||||
|
@ -474,7 +474,7 @@ void DSi_Camera::StartTransfer()
|
|||
FrameFormat = 0;
|
||||
}
|
||||
|
||||
Platform::Camera_CaptureFrame(Num, FrameBuffer, 640, 480, true);
|
||||
Platform::Camera_CaptureFrame(Num, FrameBuffer, 640, 480, true, DSi.UserData);
|
||||
}
|
||||
|
||||
bool DSi_Camera::TransferDone() const
|
||||
|
@ -655,8 +655,8 @@ void DSi_Camera::I2C_WriteReg(u16 addr, u16 val)
|
|||
StandbyCnt = val;
|
||||
//printf("CAM%d STBCNT=%04X (%04X)\n", Num, StandbyCnt, val);
|
||||
bool isactive = IsActivated();
|
||||
if (isactive && !wasactive) Platform::Camera_Start(Num);
|
||||
else if (wasactive && !isactive) Platform::Camera_Stop(Num);
|
||||
if (isactive && !wasactive) Platform::Camera_Start(Num, DSi.UserData);
|
||||
else if (wasactive && !isactive) Platform::Camera_Stop(Num, DSi.UserData);
|
||||
}
|
||||
return;
|
||||
case 0x001A:
|
||||
|
@ -665,8 +665,8 @@ void DSi_Camera::I2C_WriteReg(u16 addr, u16 val)
|
|||
MiscCnt = val & 0x0B7B;
|
||||
//printf("CAM%d MISCCNT=%04X (%04X)\n", Num, MiscCnt, val);
|
||||
bool isactive = IsActivated();
|
||||
if (isactive && !wasactive) Platform::Camera_Start(Num);
|
||||
else if (wasactive && !isactive) Platform::Camera_Stop(Num);
|
||||
if (isactive && !wasactive) Platform::Camera_Start(Num, DSi.UserData);
|
||||
else if (wasactive && !isactive) Platform::Camera_Stop(Num, DSi.UserData);
|
||||
}
|
||||
return;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -87,6 +87,7 @@ public:
|
|||
void DoSavestate(Savestate* file) override;
|
||||
|
||||
u8 GetBootFlag() const;
|
||||
void SetBootFlag(u8 boot) noexcept { Registers[0x70] = boot; }
|
||||
|
||||
bool GetBatteryCharging() const;
|
||||
void SetBatteryCharging(bool charging);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -1334,7 +1334,7 @@ void DSi_NWifi::WMI_SendPacket(u16 len)
|
|||
}
|
||||
printf("\n");*/
|
||||
|
||||
Platform::LAN_SendPacket(LANBuffer, lan_len);
|
||||
Platform::Net_SendPacket(LANBuffer, lan_len, DSi.UserData);
|
||||
}
|
||||
|
||||
void DSi_NWifi::SendWMIEvent(u8 ep, u16 id, u8* data, u32 len)
|
||||
|
@ -1442,20 +1442,26 @@ void DSi_NWifi::CheckRX()
|
|||
if (!Mailbox[8].CanFit(2048))
|
||||
return;
|
||||
|
||||
int rxlen = Platform::LAN_RecvPacket(LANBuffer);
|
||||
if (rxlen > 0)
|
||||
int rxlen = Platform::Net_RecvPacket(LANBuffer, DSi.UserData);
|
||||
while (rxlen > 0)
|
||||
{
|
||||
//printf("WMI packet recv %04X %04X %04X\n", *(u16*)&LANBuffer[0], *(u16*)&LANBuffer[2], *(u16*)&LANBuffer[4]);
|
||||
// check destination MAC
|
||||
if (*(u32*)&LANBuffer[0] != 0xFFFFFFFF || *(u16*)&LANBuffer[4] != 0xFFFF)
|
||||
{
|
||||
if (memcmp(&LANBuffer[0], &EEPROM[0x00A], 6))
|
||||
return;
|
||||
{
|
||||
rxlen = Platform::Net_RecvPacket(LANBuffer, DSi.UserData);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// check source MAC, in case we get a packet we just sent out
|
||||
if (!memcmp(&LANBuffer[6], &EEPROM[0x00A], 6))
|
||||
return;
|
||||
{
|
||||
rxlen = Platform::Net_RecvPacket(LANBuffer, DSi.UserData);
|
||||
continue;
|
||||
}
|
||||
|
||||
// packet is good
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
119
src/FIFO.h
119
src/FIFO.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
|||
|
||||
namespace melonDS
|
||||
{
|
||||
|
||||
template<typename T, u32 NumEntries>
|
||||
class FIFO
|
||||
{
|
||||
|
@ -191,5 +192,121 @@ private:
|
|||
u32 ReadPos, WritePos;
|
||||
};
|
||||
|
||||
template<u32 Size>
|
||||
class RingBuffer
|
||||
{
|
||||
public:
|
||||
void Clear()
|
||||
{
|
||||
NumOccupied = 0;
|
||||
ReadPos = 0;
|
||||
WritePos = 0;
|
||||
memset(Buffer, 0, Size);
|
||||
}
|
||||
|
||||
|
||||
void DoSavestate(Savestate* file)
|
||||
{
|
||||
file->Var32(&NumOccupied);
|
||||
file->Var32(&ReadPos);
|
||||
file->Var32(&WritePos);
|
||||
|
||||
file->VarArray(Buffer, Size);
|
||||
}
|
||||
|
||||
|
||||
bool Write(const void* data, u32 len)
|
||||
{
|
||||
if (!CanFit(len)) return false;
|
||||
|
||||
if ((WritePos + len) >= Size)
|
||||
{
|
||||
u32 part1 = Size - WritePos;
|
||||
memcpy(&Buffer[WritePos], data, part1);
|
||||
if (len > part1)
|
||||
memcpy(Buffer, &((u8*)data)[part1], len - part1);
|
||||
WritePos = len - part1;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&Buffer[WritePos], data, len);
|
||||
WritePos += len;
|
||||
}
|
||||
|
||||
NumOccupied += len;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Read(void* data, u32 len)
|
||||
{
|
||||
if (NumOccupied < len) return false;
|
||||
|
||||
u32 readpos = ReadPos;
|
||||
if ((readpos + len) >= Size)
|
||||
{
|
||||
u32 part1 = Size - readpos;
|
||||
memcpy(data, &Buffer[readpos], part1);
|
||||
if (len > part1)
|
||||
memcpy(&((u8*)data)[part1], Buffer, len - part1);
|
||||
ReadPos = len - part1;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(data, &Buffer[readpos], len);
|
||||
ReadPos += len;
|
||||
}
|
||||
|
||||
NumOccupied -= len;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Peek(void* data, u32 offset, u32 len)
|
||||
{
|
||||
if (NumOccupied < len) return false;
|
||||
|
||||
u32 readpos = ReadPos + offset;
|
||||
if (readpos >= Size) readpos -= Size;
|
||||
|
||||
if ((readpos + len) >= Size)
|
||||
{
|
||||
u32 part1 = Size - readpos;
|
||||
memcpy(data, &Buffer[readpos], part1);
|
||||
if (len > part1)
|
||||
memcpy(&((u8*)data)[part1], Buffer, len - part1);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(data, &Buffer[readpos], len);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Skip(u32 len)
|
||||
{
|
||||
if (NumOccupied < len) return false;
|
||||
|
||||
ReadPos += len;
|
||||
if (ReadPos >= Size)
|
||||
ReadPos -= Size;
|
||||
|
||||
NumOccupied -= len;
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 Level() const { return NumOccupied; }
|
||||
bool IsEmpty() const { return NumOccupied == 0; }
|
||||
bool IsFull() const { return NumOccupied >= Size; }
|
||||
|
||||
bool CanFit(u32 num) const { return ((NumOccupied + num) <= Size); }
|
||||
|
||||
private:
|
||||
u8 Buffer[Size] = {0};
|
||||
u32 NumOccupied = 0;
|
||||
u32 ReadPos = 0, WritePos = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -95,17 +95,18 @@ u32 CartCommon::GetSaveMemoryLength() const
|
|||
return 0;
|
||||
}
|
||||
|
||||
CartGame::CartGame(const u8* rom, u32 len, const u8* sram, u32 sramlen, GBACart::CartType type) :
|
||||
CartGame(CopyToUnique(rom, len), len, CopyToUnique(sram, sramlen), sramlen, type)
|
||||
CartGame::CartGame(const u8* rom, u32 len, const u8* sram, u32 sramlen, void* userdata, GBACart::CartType type) :
|
||||
CartGame(CopyToUnique(rom, len), len, CopyToUnique(sram, sramlen), sramlen, userdata, type)
|
||||
{
|
||||
}
|
||||
|
||||
CartGame::CartGame(std::unique_ptr<u8[]>&& rom, u32 len, std::unique_ptr<u8[]>&& sram, u32 sramlen, GBACart::CartType type) :
|
||||
CartGame::CartGame(std::unique_ptr<u8[]>&& rom, u32 len, std::unique_ptr<u8[]>&& sram, u32 sramlen, void* userdata, GBACart::CartType type) :
|
||||
CartCommon(type),
|
||||
ROM(std::move(rom)),
|
||||
ROMLength(len),
|
||||
SRAM(std::move(sram)),
|
||||
SRAMLength(sramlen)
|
||||
SRAMLength(sramlen),
|
||||
UserData(userdata)
|
||||
{
|
||||
if (SRAM && SRAMLength)
|
||||
{
|
||||
|
@ -170,7 +171,7 @@ void CartGame::DoSavestate(Savestate* file)
|
|||
file->Var8((u8*)&SRAMType);
|
||||
|
||||
if ((!file->Saving) && SRAM)
|
||||
Platform::WriteGBASave(SRAM.get(), SRAMLength, 0, SRAMLength);
|
||||
Platform::WriteGBASave(SRAM.get(), SRAMLength, 0, SRAMLength, UserData);
|
||||
}
|
||||
|
||||
void CartGame::SetupSave(u32 type)
|
||||
|
@ -223,7 +224,7 @@ void CartGame::SetSaveMemory(const u8* savedata, u32 savelen)
|
|||
|
||||
u32 len = std::min(savelen, SRAMLength);
|
||||
memcpy(SRAM.get(), savedata, len);
|
||||
Platform::WriteGBASave(savedata, len, 0, len);
|
||||
Platform::WriteGBASave(savedata, len, 0, len, UserData);
|
||||
}
|
||||
|
||||
u16 CartGame::ROMRead(u32 addr) const
|
||||
|
@ -464,7 +465,7 @@ void CartGame::SRAMWrite_FLASH(u32 addr, u8 val)
|
|||
u32 start_addr = addr + 0x10000 * SRAMFlashState.bank;
|
||||
memset((u8*)&SRAM[start_addr], 0xFF, 0x1000);
|
||||
|
||||
Platform::WriteGBASave(SRAM.get(), SRAMLength, start_addr, 0x1000);
|
||||
Platform::WriteGBASave(SRAM.get(), SRAMLength, start_addr, 0x1000, UserData);
|
||||
}
|
||||
SRAMFlashState.state = 0;
|
||||
SRAMFlashState.cmd = 0;
|
||||
|
@ -523,18 +524,18 @@ void CartGame::SRAMWrite_SRAM(u32 addr, u8 val)
|
|||
*(u8*)&SRAM[addr] = val;
|
||||
|
||||
// TODO: optimize this!!
|
||||
Platform::WriteGBASave(SRAM.get(), SRAMLength, addr, 1);
|
||||
Platform::WriteGBASave(SRAM.get(), SRAMLength, addr, 1, UserData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CartGameSolarSensor::CartGameSolarSensor(const u8* rom, u32 len, const u8* sram, u32 sramlen) :
|
||||
CartGameSolarSensor(CopyToUnique(rom, len), len, CopyToUnique(sram, sramlen), sramlen)
|
||||
CartGameSolarSensor::CartGameSolarSensor(const u8* rom, u32 len, const u8* sram, u32 sramlen, void* userdata) :
|
||||
CartGameSolarSensor(CopyToUnique(rom, len), len, CopyToUnique(sram, sramlen), sramlen, userdata)
|
||||
{
|
||||
}
|
||||
|
||||
CartGameSolarSensor::CartGameSolarSensor(std::unique_ptr<u8[]>&& rom, u32 len, std::unique_ptr<u8[]>&& sram, u32 sramlen) :
|
||||
CartGame(std::move(rom), len, std::move(sram), sramlen, CartType::GameSolarSensor)
|
||||
CartGameSolarSensor::CartGameSolarSensor(std::unique_ptr<u8[]>&& rom, u32 len, std::unique_ptr<u8[]>&& sram, u32 sramlen, void* userdata) :
|
||||
CartGame(std::move(rom), len, std::move(sram), sramlen, userdata, CartType::GameSolarSensor)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -680,7 +681,45 @@ void CartRAMExpansion::ROMWrite(u32 addr, u16 val)
|
|||
}
|
||||
}
|
||||
|
||||
GBACartSlot::GBACartSlot(std::unique_ptr<CartCommon>&& cart) noexcept : Cart(std::move(cart))
|
||||
CartRumblePak::CartRumblePak(void* userdata) :
|
||||
CartCommon(RumblePak),
|
||||
UserData(userdata)
|
||||
{
|
||||
}
|
||||
|
||||
CartRumblePak::~CartRumblePak() = default;
|
||||
|
||||
void CartRumblePak::Reset()
|
||||
{
|
||||
RumbleState = 0;
|
||||
}
|
||||
|
||||
void CartRumblePak::DoSavestate(Savestate* file)
|
||||
{
|
||||
CartCommon::DoSavestate(file);
|
||||
file->Var16(&RumbleState);
|
||||
}
|
||||
|
||||
u16 CartRumblePak::ROMRead(u32 addr) const
|
||||
{
|
||||
// A1 is pulled low on a real Rumble Pak, so return the
|
||||
// necessary detection value here,
|
||||
// and let the existing open bus implementation take care of the rest
|
||||
return 0xFFFD;
|
||||
}
|
||||
|
||||
void CartRumblePak::ROMWrite(u32 addr, u16 val)
|
||||
{
|
||||
addr &= 0x01FFFFFF;
|
||||
if (RumbleState != val)
|
||||
{
|
||||
Platform::Addon_RumbleStop(UserData);
|
||||
RumbleState = val;
|
||||
Platform::Addon_RumbleStart(16, UserData);
|
||||
}
|
||||
}
|
||||
|
||||
GBACartSlot::GBACartSlot(melonDS::NDS& nds, std::unique_ptr<CartCommon>&& cart) noexcept : NDS(nds), Cart(std::move(cart))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -723,24 +762,24 @@ void GBACartSlot::DoSavestate(Savestate* file) noexcept
|
|||
if (Cart) Cart->DoSavestate(file);
|
||||
}
|
||||
|
||||
std::unique_ptr<CartCommon> ParseROM(std::unique_ptr<u8[]>&& romdata, u32 romlen)
|
||||
std::unique_ptr<CartCommon> ParseROM(std::unique_ptr<u8[]>&& romdata, u32 romlen, void* userdata)
|
||||
{
|
||||
return ParseROM(std::move(romdata), romlen, nullptr, 0);
|
||||
return ParseROM(std::move(romdata), romlen, nullptr, 0, userdata);
|
||||
}
|
||||
|
||||
std::unique_ptr<CartCommon> ParseROM(const u8* romdata, u32 romlen, const u8* sramdata, u32 sramlen)
|
||||
std::unique_ptr<CartCommon> ParseROM(const u8* romdata, u32 romlen, const u8* sramdata, u32 sramlen, void* userdata)
|
||||
{
|
||||
auto [romcopy, romcopylen] = PadToPowerOf2(romdata, romlen);
|
||||
|
||||
return ParseROM(std::move(romcopy), romcopylen, CopyToUnique(sramdata, sramlen), sramlen);
|
||||
return ParseROM(std::move(romcopy), romcopylen, CopyToUnique(sramdata, sramlen), sramlen, userdata);
|
||||
}
|
||||
|
||||
std::unique_ptr<CartCommon> ParseROM(const u8* romdata, u32 romlen)
|
||||
std::unique_ptr<CartCommon> ParseROM(const u8* romdata, u32 romlen, void* userdata)
|
||||
{
|
||||
return ParseROM(romdata, romlen, nullptr, 0);
|
||||
return ParseROM(romdata, romlen, nullptr, 0, userdata);
|
||||
}
|
||||
|
||||
std::unique_ptr<CartCommon> ParseROM(std::unique_ptr<u8[]>&& romdata, u32 romlen, std::unique_ptr<u8[]>&& sramdata, u32 sramlen)
|
||||
std::unique_ptr<CartCommon> ParseROM(std::unique_ptr<u8[]>&& romdata, u32 romlen, std::unique_ptr<u8[]>&& sramdata, u32 sramlen, void* userdata)
|
||||
{
|
||||
if (romdata == nullptr)
|
||||
{
|
||||
|
@ -773,9 +812,9 @@ std::unique_ptr<CartCommon> ParseROM(std::unique_ptr<u8[]>&& romdata, u32 romlen
|
|||
|
||||
std::unique_ptr<CartCommon> cart;
|
||||
if (solarsensor)
|
||||
cart = std::make_unique<CartGameSolarSensor>(std::move(cartrom), cartromsize, std::move(sramdata), sramlen);
|
||||
cart = std::make_unique<CartGameSolarSensor>(std::move(cartrom), cartromsize, std::move(sramdata), sramlen, userdata);
|
||||
else
|
||||
cart = std::make_unique<CartGame>(std::move(cartrom), cartromsize, std::move(sramdata), sramlen);
|
||||
cart = std::make_unique<CartGame>(std::move(cartrom), cartromsize, std::move(sramdata), sramlen, userdata);
|
||||
|
||||
cart->Reset();
|
||||
|
||||
|
@ -820,13 +859,16 @@ void GBACartSlot::SetSaveMemory(const u8* savedata, u32 savelen) noexcept
|
|||
}
|
||||
}
|
||||
|
||||
void GBACartSlot::LoadAddon(int type) noexcept
|
||||
void GBACartSlot::LoadAddon(void* userdata, int type) noexcept
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case GBAAddon_RAMExpansion:
|
||||
Cart = std::make_unique<CartRAMExpansion>();
|
||||
break;
|
||||
case GBAAddon_RumblePak:
|
||||
Cart = std::make_unique<CartRumblePak>(userdata);
|
||||
break;
|
||||
|
||||
default:
|
||||
Log(LogLevel::Warn, "GBACart: !! invalid addon type %d\n", type);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -32,6 +32,7 @@ enum CartType
|
|||
Game = 0x101,
|
||||
GameSolarSensor = 0x102,
|
||||
RAMExpansion = 0x201,
|
||||
RumblePak = 0x202,
|
||||
};
|
||||
|
||||
// CartCommon -- base code shared by all cart types
|
||||
|
@ -72,8 +73,8 @@ private:
|
|||
class CartGame : public CartCommon
|
||||
{
|
||||
public:
|
||||
CartGame(const u8* rom, u32 len, const u8* sram, u32 sramlen, GBACart::CartType type = GBACart::CartType::Game);
|
||||
CartGame(std::unique_ptr<u8[]>&& rom, u32 len, std::unique_ptr<u8[]>&& sram, u32 sramlen, GBACart::CartType type = GBACart::CartType::Game);
|
||||
CartGame(const u8* rom, u32 len, const u8* sram, u32 sramlen, void* userdata, GBACart::CartType type = GBACart::CartType::Game);
|
||||
CartGame(std::unique_ptr<u8[]>&& rom, u32 len, std::unique_ptr<u8[]>&& sram, u32 sramlen, void* userdata, GBACart::CartType type = GBACart::CartType::Game);
|
||||
~CartGame() override;
|
||||
|
||||
u32 Checksum() const override;
|
||||
|
@ -104,6 +105,8 @@ protected:
|
|||
u8 SRAMRead_SRAM(u32 addr);
|
||||
void SRAMWrite_SRAM(u32 addr, u8 val);
|
||||
|
||||
void* UserData;
|
||||
|
||||
std::unique_ptr<u8[]> ROM;
|
||||
u32 ROMLength;
|
||||
|
||||
|
@ -147,8 +150,8 @@ private:
|
|||
class CartGameSolarSensor : public CartGame
|
||||
{
|
||||
public:
|
||||
CartGameSolarSensor(const u8* rom, u32 len, const u8* sram, u32 sramlen);
|
||||
CartGameSolarSensor(std::unique_ptr<u8[]>&& rom, u32 len, std::unique_ptr<u8[]>&& sram, u32 sramlen);
|
||||
CartGameSolarSensor(const u8* rom, u32 len, const u8* sram, u32 sramlen, void* userdata);
|
||||
CartGameSolarSensor(std::unique_ptr<u8[]>&& rom, u32 len, std::unique_ptr<u8[]>&& sram, u32 sramlen, void* userdata);
|
||||
|
||||
void Reset() override;
|
||||
|
||||
|
@ -187,6 +190,25 @@ private:
|
|||
u16 RAMEnable = 0;
|
||||
};
|
||||
|
||||
// CartRumblePak -- DS Rumble Pak (used in various NDS games)
|
||||
class CartRumblePak : public CartCommon
|
||||
{
|
||||
public:
|
||||
CartRumblePak(void* userdata);
|
||||
~CartRumblePak() override;
|
||||
|
||||
void Reset() override;
|
||||
|
||||
void DoSavestate(Savestate* file) override;
|
||||
|
||||
u16 ROMRead(u32 addr) const override;
|
||||
void ROMWrite(u32 addr, u16 val) override;
|
||||
|
||||
private:
|
||||
void* UserData;
|
||||
u16 RumbleState = 0;
|
||||
};
|
||||
|
||||
// possible inputs for GBA carts that might accept user input
|
||||
enum
|
||||
{
|
||||
|
@ -197,7 +219,7 @@ enum
|
|||
class GBACartSlot
|
||||
{
|
||||
public:
|
||||
GBACartSlot(std::unique_ptr<CartCommon>&& cart = nullptr) noexcept;
|
||||
GBACartSlot(melonDS::NDS& nds, std::unique_ptr<CartCommon>&& cart = nullptr) noexcept;
|
||||
~GBACartSlot() noexcept = default;
|
||||
void Reset() noexcept;
|
||||
void DoSavestate(Savestate* file) noexcept;
|
||||
|
@ -217,7 +239,7 @@ public:
|
|||
[[nodiscard]] CartCommon* GetCart() noexcept { return Cart.get(); }
|
||||
[[nodiscard]] const CartCommon* GetCart() const noexcept { return Cart.get(); }
|
||||
|
||||
void LoadAddon(int type) noexcept;
|
||||
void LoadAddon(void* userdata, int type) noexcept;
|
||||
|
||||
/// @return The cart that was in the cart slot if any,
|
||||
/// or \c nullptr if the cart slot was empty.
|
||||
|
@ -258,6 +280,7 @@ public:
|
|||
/// if a cart is loaded and supports SRAM, otherwise zero.
|
||||
[[nodiscard]] u32 GetSaveMemoryLength() const noexcept { return Cart ? Cart->GetSaveMemoryLength() : 0; }
|
||||
private:
|
||||
melonDS::NDS& NDS;
|
||||
std::unique_ptr<CartCommon> Cart = nullptr;
|
||||
u16 OpenBusDecay = 0;
|
||||
};
|
||||
|
@ -270,9 +293,9 @@ private:
|
|||
/// @param romlen The length of the ROM data in bytes.
|
||||
/// @returns A \c GBACart::CartCommon object representing the parsed ROM,
|
||||
/// or \c nullptr if the ROM data couldn't be parsed.
|
||||
std::unique_ptr<CartCommon> ParseROM(const u8* romdata, u32 romlen);
|
||||
std::unique_ptr<CartCommon> ParseROM(std::unique_ptr<u8[]>&& romdata, u32 romlen);
|
||||
std::unique_ptr<CartCommon> ParseROM(const u8* romdata, u32 romlen, const u8* sramdata, u32 sramlen);
|
||||
std::unique_ptr<CartCommon> ParseROM(const u8* romdata, u32 romlen, void* userdata = nullptr);
|
||||
std::unique_ptr<CartCommon> ParseROM(std::unique_ptr<u8[]>&& romdata, u32 romlen, void* userdata = nullptr);
|
||||
std::unique_ptr<CartCommon> ParseROM(const u8* romdata, u32 romlen, const u8* sramdata, u32 sramlen, void* userdata = nullptr);
|
||||
|
||||
/// @param romdata The ROM data to parse. Will be moved-from.
|
||||
/// @param romlen Length of romdata in bytes.
|
||||
|
@ -282,7 +305,7 @@ std::unique_ptr<CartCommon> ParseROM(const u8* romdata, u32 romlen, const u8* sr
|
|||
/// May be zero, in which case the cart will have no save data.
|
||||
/// @return Unique pointer to the parsed GBA cart,
|
||||
/// or \c nullptr if there was an error.
|
||||
std::unique_ptr<CartCommon> ParseROM(std::unique_ptr<u8[]>&& romdata, u32 romlen, std::unique_ptr<u8[]>&& sramdata, u32 sramlen);
|
||||
std::unique_ptr<CartCommon> ParseROM(std::unique_ptr<u8[]>&& romdata, u32 romlen, std::unique_ptr<u8[]>&& sramdata, u32 sramlen, void* userdata = nullptr);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -387,6 +387,14 @@ void Unit::Write16(u32 addr, u16 val)
|
|||
if (!Num) GPU.GPU3D.SetRenderXPos(val);
|
||||
break;
|
||||
|
||||
case 0x064:
|
||||
CaptureCnt = (CaptureCnt & 0xFFFF0000) | (val & 0xEF3F1F1F);
|
||||
return;
|
||||
|
||||
case 0x066:
|
||||
CaptureCnt = (CaptureCnt & 0xFFFF) | ((val << 16) & 0xEF3F1F1F);
|
||||
return;
|
||||
|
||||
case 0x068:
|
||||
DispFIFO[DispFIFOWritePtr] = val;
|
||||
return;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -254,7 +254,11 @@ void SoftRenderer::DrawScanline(u32 line, Unit* unit)
|
|||
|
||||
if (GPU.GPU3D.IsRendererAccelerated())
|
||||
{
|
||||
dst[256*3] = masterBrightness | (CurUnit->DispCnt & 0x30000);
|
||||
u32 xpos = GPU.GPU3D.GetRenderXPos();
|
||||
|
||||
dst[256*3] = masterBrightness |
|
||||
(CurUnit->DispCnt & 0x30000) |
|
||||
(xpos << 24) | ((xpos & 0x100) << 15);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1503,7 +1507,7 @@ void SoftRenderer::ApplySpriteMosaicX()
|
|||
|
||||
u32* objLine = OBJLine[CurUnit->Num];
|
||||
|
||||
u8* curOBJXMosaicTable = MosaicTable[CurUnit->OBJMosaicSize[1]].data();
|
||||
u8* curOBJXMosaicTable = MosaicTable[CurUnit->OBJMosaicSize[0]].data();
|
||||
|
||||
u32 lastcolor = objLine[0];
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -192,7 +192,7 @@ void GPU3D::Reset() noexcept
|
|||
|
||||
CmdStallQueue.Clear();
|
||||
|
||||
ZeroDotWLimit = 0; // CHECKME
|
||||
ZeroDotWLimit = 0xFFFFFF;
|
||||
|
||||
GXStat = 0;
|
||||
|
||||
|
@ -1279,7 +1279,7 @@ void GPU3D::SubmitPolygon() noexcept
|
|||
{
|
||||
Vertex* vtx = poly->Vertices[i];
|
||||
|
||||
if (vtx->FinalPosition[1] < ytop || (vtx->FinalPosition[1] == ytop && vtx->FinalPosition[0] < xtop))
|
||||
if (vtx->FinalPosition[1] < ytop)
|
||||
{
|
||||
xtop = vtx->FinalPosition[0];
|
||||
ytop = vtx->FinalPosition[1];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -197,7 +197,7 @@ public:
|
|||
|
||||
FIFO<CmdFIFOEntry, 64> CmdStallQueue {};
|
||||
|
||||
u32 ZeroDotWLimit = 0;
|
||||
u32 ZeroDotWLimit = 0xFFFFFF;
|
||||
|
||||
u32 GXStat = 0;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2022 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2022 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -59,7 +59,7 @@ public:
|
|||
void Blit(const GPU& gpu) override;
|
||||
void Stop(const GPU& gpu) override;
|
||||
|
||||
bool NeedsShaderCompile() { return ShaderStepIdx != 33; }
|
||||
bool NeedsShaderCompile() override { return ShaderStepIdx != 33; }
|
||||
void ShaderCompileStep(int& current, int& count) override;
|
||||
private:
|
||||
ComputeRenderer(GLCompositor&& compositor);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2022 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -233,6 +233,7 @@ std::unique_ptr<GLRenderer> GLRenderer::New() noexcept
|
|||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(IndexBuffer), nullptr, GL_DYNAMIC_DRAW);
|
||||
|
||||
glGenFramebuffers(1, &result->MainFramebuffer);
|
||||
glGenFramebuffers(1, &result->DownscaleFramebuffer);
|
||||
|
||||
// color buffers
|
||||
glGenTextures(1, &result->ColorBufferTex);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -242,13 +242,20 @@ void SoftRenderer::TextureLookup(const GPU& gpu, u32 texparam, u32 texpal, s16 s
|
|||
{
|
||||
vramaddr += ((t & 0x3FC) * (width>>2)) + (s & 0x3FC);
|
||||
vramaddr += (t & 0x3);
|
||||
vramaddr &= 0x7FFFF; // address used for all calcs wraps around after slot 3
|
||||
|
||||
u32 slot1addr = 0x20000 + ((vramaddr & 0x1FFFC) >> 1);
|
||||
if (vramaddr >= 0x40000)
|
||||
slot1addr += 0x10000;
|
||||
|
||||
u8 val = ReadVRAM_Texture<u8>(vramaddr, gpu);
|
||||
val >>= (2 * (s & 0x3));
|
||||
u8 val;
|
||||
if (vramaddr >= 0x20000 && vramaddr < 0x40000) // reading slot 1 for texels should always read 0
|
||||
val = 0;
|
||||
else
|
||||
{
|
||||
val = ReadVRAM_Texture<u8>(vramaddr, gpu);
|
||||
val >>= (2 * (s & 0x3));
|
||||
}
|
||||
|
||||
u16 palinfo = ReadVRAM_Texture<u16>(slot1addr, gpu);
|
||||
u32 paloffset = (palinfo & 0x3FFF) << 2;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -51,7 +51,6 @@ std::optional<GLCompositor> GLCompositor::New() noexcept
|
|||
GLCompositor::GLCompositor(GLuint compShader) noexcept : CompShader(compShader)
|
||||
{
|
||||
CompScaleLoc = glGetUniformLocation(CompShader, "u3DScale");
|
||||
Comp3DXPosLoc = glGetUniformLocation(CompShader, "u3DXPos");
|
||||
|
||||
glUseProgram(CompShader);
|
||||
GLuint screenTextureUniform = glGetUniformLocation(CompShader, "ScreenTex");
|
||||
|
@ -140,7 +139,6 @@ GLCompositor::GLCompositor(GLCompositor&& other) noexcept :
|
|||
ScreenH(other.ScreenH),
|
||||
ScreenW(other.ScreenW),
|
||||
CompScaleLoc(other.CompScaleLoc),
|
||||
Comp3DXPosLoc(other.Comp3DXPosLoc),
|
||||
CompVertices(other.CompVertices),
|
||||
CompShader(other.CompShader),
|
||||
CompVertexBufferID(other.CompVertexBufferID),
|
||||
|
@ -165,7 +163,6 @@ GLCompositor& GLCompositor::operator=(GLCompositor&& other) noexcept
|
|||
ScreenH = other.ScreenH;
|
||||
ScreenW = other.ScreenW;
|
||||
CompScaleLoc = other.CompScaleLoc;
|
||||
Comp3DXPosLoc = other.Comp3DXPosLoc;
|
||||
CompVertices = other.CompVertices;
|
||||
|
||||
// Clean up these resources before overwriting them
|
||||
|
@ -258,9 +255,6 @@ void GLCompositor::RenderFrame(const GPU& gpu, Renderer3D& renderer) noexcept
|
|||
glUseProgram(CompShader);
|
||||
glUniform1ui(CompScaleLoc, Scale);
|
||||
|
||||
// TODO: support setting this midframe, if ever needed
|
||||
glUniform1i(Comp3DXPosLoc, ((int)gpu.GPU3D.GetRenderXPos() << 23) >> 23);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, CompScreenInputTex);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -52,7 +52,6 @@ private:
|
|||
|
||||
GLuint CompShader {};
|
||||
GLuint CompScaleLoc = 0;
|
||||
GLuint Comp3DXPosLoc = 0;
|
||||
|
||||
GLuint CompVertexBufferID = 0;
|
||||
GLuint CompVertexArrayID = 0;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2016-2023 melonDS team
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
|
@ -43,7 +43,6 @@ void main()
|
|||
const char* kCompositorFS_Nearest = R"(#version 140
|
||||
|
||||
uniform uint u3DScale;
|
||||
uniform int u3DXPos;
|
||||
|
||||
uniform usampler2D ScreenTex;
|
||||
uniform sampler2D _3DTex;
|
||||
|
@ -56,11 +55,13 @@ void main()
|
|||
{
|
||||
ivec4 pixel = ivec4(texelFetch(ScreenTex, ivec2(fTexcoord), 0));
|
||||
|
||||
float _3dxpos = float(u3DXPos);
|
||||
|
||||
ivec4 mbright = ivec4(texelFetch(ScreenTex, ivec2(256*3, int(fTexcoord.y)), 0));
|
||||
int dispmode = mbright.b & 0x3;
|
||||
|
||||
// mbright.a == HOFS bit0..7
|
||||
// mbright.b bit7 == HOFS bit8 (sign)
|
||||
float _3dxpos = float(mbright.a - ((mbright.b & 0x80) * 2));
|
||||
|
||||
if (dispmode == 1)
|
||||
{
|
||||
ivec4 val1 = pixel;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue