mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 05:17:40 -07:00
Compare commits
4 Commits
d33dca0338
...
ff1fb81da3
Author | SHA1 | Date | |
---|---|---|---|
|
ff1fb81da3 | ||
|
7c1d2a64f4 | ||
|
b2f6fab6f4 | ||
|
7cddfcf018 |
@ -20,6 +20,7 @@ add_library(core STATIC
|
||||
DSi_AES.cpp
|
||||
DSi_Camera.cpp
|
||||
DSi_DSP.cpp
|
||||
DSi_DSP_UCodes.cpp
|
||||
DSi_I2C.cpp
|
||||
DSi_NAND.cpp
|
||||
DSi_NDMA.cpp
|
||||
@ -127,6 +128,8 @@ if (ENABLE_JIT)
|
||||
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")
|
||||
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")
|
||||
@ -178,13 +181,14 @@ endif()
|
||||
|
||||
if (WIN32)
|
||||
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)
|
||||
check_library_exists(rt shm_open "" NEED_LIBRT)
|
||||
if (NEED_LIBRT)
|
||||
target_link_libraries(core PRIVATE rt)
|
||||
endif()
|
||||
elseif(HAIKU)
|
||||
target_link_libraries(core PRIVATE network)
|
||||
target_link_libraries(core PRIVATE network)
|
||||
endif()
|
||||
|
||||
if (ENABLE_JIT_PROFILING)
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "DSi.h"
|
||||
#include "DSi_DSP.h"
|
||||
#include "DSi_DSP_UCodes.h"
|
||||
#include "FIFO.h"
|
||||
#include "NDS.h"
|
||||
#include "Platform.h"
|
||||
@ -113,6 +114,7 @@ DSi_DSP::DSi_DSP(melonDS::DSi& dsi) : DSi(dsi)
|
||||
|
||||
TeakraCore = new Teakra::Teakra();
|
||||
SCFG_RST = false;
|
||||
CurrentUCodeID = UCodeID::UNKNOWN;
|
||||
|
||||
// ????
|
||||
//if (!TeakraCore) return false;
|
||||
@ -188,6 +190,11 @@ bool DSi_DSP::IsRstReleased() const
|
||||
}
|
||||
void DSi_DSP::SetRstLine(bool release)
|
||||
{
|
||||
if (!SCFG_RST && release)
|
||||
{
|
||||
CurrentUCodeID = IdentifyUCode(DSi);
|
||||
}
|
||||
|
||||
SCFG_RST = release;
|
||||
Reset();
|
||||
DSPTimestamp = DSi.ARM9Timestamp; // only start now!
|
||||
|
@ -30,6 +30,7 @@ namespace Teakra { class Teakra; }
|
||||
namespace melonDS
|
||||
{
|
||||
class DSi;
|
||||
enum class UCodeID;
|
||||
class DSi_DSP
|
||||
{
|
||||
public:
|
||||
@ -74,6 +75,7 @@ private:
|
||||
u16 SNDExCnt;
|
||||
|
||||
Teakra::Teakra* TeakraCore;
|
||||
UCodeID CurrentUCodeID;
|
||||
|
||||
bool SCFG_RST;
|
||||
|
||||
|
95
src/DSi_DSP_UCodes.cpp
Normal file
95
src/DSi_DSP_UCodes.cpp
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
melonDS is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation, either version 3 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with melonDS. If not, see http://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
||||
#include "DSi.h"
|
||||
#include "DSi_DSP_UCodes.h"
|
||||
#include "CRC32.h"
|
||||
#include "Platform.h"
|
||||
|
||||
namespace melonDS
|
||||
{
|
||||
using Platform::Log;
|
||||
using Platform::LogLevel;
|
||||
|
||||
// static block of zero'd memory for unmapped DSP memory
|
||||
static const u8 DSPZeroPage[0x8000] = {};
|
||||
|
||||
UCodeID IdentifyUCode(melonDS::DSi& dsi)
|
||||
{
|
||||
u32 crc = 0;
|
||||
|
||||
// Hash NWRAM B, which contains the DSP program
|
||||
// The hash should be in the DSP's memory view
|
||||
for (u32 addr = 0; addr < 0x40000; addr += 0x8000)
|
||||
{
|
||||
const u8* ptr = dsi.NWRAMMap_B[2][(addr >> 15) & 0x7];
|
||||
if (!ptr) ptr = DSPZeroPage;
|
||||
crc = CRC32(ptr, 0x8000, crc);
|
||||
}
|
||||
|
||||
switch (crc)
|
||||
{
|
||||
case 0x7867C94B:
|
||||
Log(LogLevel::Debug, "Identified AAC Sound App DSP UCode\n");
|
||||
return UCodeID::AAC_SOUND_APP;
|
||||
case 0x0CAFEF48:
|
||||
Log(LogLevel::Debug, "Identified AAC SDK v0 DSP UCode\n");
|
||||
return UCodeID::AAC_SDK_V0;
|
||||
case 0xCD2A8B1B:
|
||||
Log(LogLevel::Debug, "Identified Graphics SDK v0 DSP UCode\n");
|
||||
return UCodeID::GRAPHICS_SDK_V0;
|
||||
case 0x7EEE19FE:
|
||||
Log(LogLevel::Debug, "Identified G711 SDK v1 DSP UCode\n");
|
||||
return UCodeID::G711_SDK_V1;
|
||||
case 0x7323B75B:
|
||||
Log(LogLevel::Debug, "Identified Graphics SDK v1 DSP UCode\n");
|
||||
return UCodeID::GRAPHICS_SDK_V1;
|
||||
case 0xBD4B63B6:
|
||||
Log(LogLevel::Debug, "Identified Graphics SDK v1 Patch DSP UCode\n");
|
||||
return UCodeID::GRAPHICS_SDK_V1_PATCH;
|
||||
case 0x6056C6FF:
|
||||
Log(LogLevel::Debug, "Identified G711 SDK v2 DSP UCode\n");
|
||||
return UCodeID::G711_SDK_V2;
|
||||
case 0x448BB6A2:
|
||||
Log(LogLevel::Debug, "Identified Graphics SDK v2 DSP UCode\n");
|
||||
return UCodeID::GRAPHICS_SDK_V2;
|
||||
case 0x2C281DAE:
|
||||
Log(LogLevel::Debug, "Identified G711 SDK v3 DSP UCode\n");
|
||||
return UCodeID::G711_SDK_V3;
|
||||
case 0x63CAEC33:
|
||||
Log(LogLevel::Debug, "Identified Graphics SDK v3 DSP UCode\n");
|
||||
return UCodeID::GRAPHICS_SDK_V3;
|
||||
case 0x2A1D7F94:
|
||||
Log(LogLevel::Debug, "Identified G711 SDK v4 DSP UCode\n");
|
||||
return UCodeID::G711_SDK_V4;
|
||||
case 0x1451EB84:
|
||||
Log(LogLevel::Debug, "Identified Graphics SDK v4 DSP UCode\n");
|
||||
return UCodeID::GRAPHICS_SDK_V4;
|
||||
case 0x4EBEB519:
|
||||
Log(LogLevel::Debug, "Identified G711 SDK v5 DSP UCode\n");
|
||||
return UCodeID::G711_SDK_V5;
|
||||
case 0x2C974FC8:
|
||||
Log(LogLevel::Debug, "Identified Graphics SDK v5 DSP UCode\n");
|
||||
return UCodeID::GRAPHICS_SDK_V5;
|
||||
default:
|
||||
Log(LogLevel::Debug, "Unknown DSP UCode (CRC = %08X)\n", crc);
|
||||
return UCodeID::UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
103
src/DSi_DSP_UCodes.h
Normal file
103
src/DSi_DSP_UCodes.h
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
Copyright 2016-2024 melonDS team
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
melonDS is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation, either version 3 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with melonDS. If not, see http://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
||||
#ifndef DSI_DSP_UCODES_H
|
||||
#define DSI_DSP_UCODES_H
|
||||
|
||||
namespace melonDS
|
||||
{
|
||||
class DSi;
|
||||
|
||||
// DSP ucodes are COFF files embed into the DSi ROM in some fashion
|
||||
// DSP ucodes all appear to simply be from the DSi's SDK (as evidenced by the build paths in the COFF)
|
||||
// Presumingly, developers could not actually make their own ucodes, that was reserved for Nintendo
|
||||
enum class UCodeID
|
||||
{
|
||||
// AAC decoder in DSi Sound app
|
||||
// COFF build timestamp: 8/4/2008
|
||||
// This appears to be from an extremely early version of the DSi's SDK
|
||||
// This SDK was presumingly never available to 3rd party developers, as the build timestamp is before the DSi's release
|
||||
// As such, nothing else appears to use this ucode
|
||||
AAC_SOUND_APP,
|
||||
|
||||
// AAC decoder present in v0 SDK
|
||||
// COFF build timestamp: 10/21/2008
|
||||
// At least 1 DSiWare app (Futo Sutando Tsuki - Banbura DX Rajio) is known to contain this
|
||||
AAC_SDK_V0,
|
||||
|
||||
// Graphics ucode present in v0 SDK
|
||||
// COFF build timestamp: 10/21/2008
|
||||
// As least 1 DSiWare app (Hobonichi Rosenzu 2010, rev 0) is known to contain this
|
||||
GRAPHICS_SDK_V0,
|
||||
|
||||
// G711 encoder/decoder present in v1 SDK
|
||||
// COFF build timestamp: 2/13/2009
|
||||
// Appears to be a replacement for the AAC decoder
|
||||
G711_SDK_V1,
|
||||
|
||||
// Graphics ucode present in v1 SDK
|
||||
// COFF build timestamp: 2/13/2009
|
||||
GRAPHICS_SDK_V1,
|
||||
|
||||
// Graphics ucode present in v1 SDK
|
||||
// COFF build timestamp: 4/3/2009
|
||||
// Appears to be a patch against the previous graphics ucode
|
||||
// Known to sometimes be present alongside the SDK v1 G711 ucode
|
||||
GRAPHICS_SDK_V1_PATCH,
|
||||
|
||||
// G711 encoder/decoder present in v2 SDK
|
||||
// COFF build timestamp: 4/8/2009
|
||||
G711_SDK_V2,
|
||||
|
||||
// Graphics ucode present in v2 SDK
|
||||
// COFF build timestamp: 4/8/2009
|
||||
GRAPHICS_SDK_V2,
|
||||
|
||||
// G711 encoder/decoder present in v3 SDK
|
||||
// COFF build timestamp: 9/16/2009
|
||||
G711_SDK_V3,
|
||||
|
||||
// Graphics ucode present in v3 SDK
|
||||
// COFF build timestamp: 9/16/2009
|
||||
GRAPHICS_SDK_V3,
|
||||
|
||||
// G711 encoder/decoder present in v4 SDK
|
||||
// COFF build timestamp: 11/9/2009
|
||||
G711_SDK_V4,
|
||||
|
||||
// Graphics ucode present in v4 SDK
|
||||
// COFF build timestamp: 11/9/2009
|
||||
GRAPHICS_SDK_V4,
|
||||
|
||||
// G711 encoder/decoder present in v5 SDK
|
||||
// COFF build timestamp: 1/13/2010
|
||||
G711_SDK_V5,
|
||||
|
||||
// Graphics ucode present in v5 SDK
|
||||
// COFF build timestamp: 1/13/2010
|
||||
GRAPHICS_SDK_V5,
|
||||
|
||||
// Unknown ucode...
|
||||
UNKNOWN = -1,
|
||||
};
|
||||
|
||||
UCodeID IdentifyUCode(melonDS::DSi& dsi);
|
||||
|
||||
}
|
||||
|
||||
#endif // DSI_DSP_UCODES_H
|
@ -91,8 +91,7 @@ add_compile_definitions(ARCHIVE_SUPPORT_ENABLED)
|
||||
add_executable(melonDS ${SOURCES_QT_SDL})
|
||||
|
||||
add_subdirectory("../../net"
|
||||
"${CMAKE_BINARY_DIR}/net"
|
||||
)
|
||||
${CMAKE_BINARY_DIR}/net)
|
||||
|
||||
target_link_libraries(melonDS PRIVATE net-utils)
|
||||
|
||||
@ -171,10 +170,10 @@ if (BUILD_STATIC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../..")
|
||||
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../../net")
|
||||
target_include_directories(melonDS PUBLIC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||
|
||||
if (USE_QT6)
|
||||
target_include_directories(melonDS PUBLIC ${Qt6Gui_PRIVATE_INCLUDE_DIRS})
|
||||
else()
|
||||
|
@ -11,9 +11,9 @@ add_library(net-utils STATIC
|
||||
MPInterface.cpp
|
||||
)
|
||||
|
||||
target_include_directories(net-utils PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
target_include_directories(net-utils PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||
|
||||
target_include_directories(net-utils PUBLIC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||
|
||||
option(USE_SYSTEM_LIBSLIRP "Use system libslirp instead of the bundled version" OFF)
|
||||
if (USE_SYSTEM_LIBSLIRP)
|
||||
|
Loading…
Reference in New Issue
Block a user