Compare commits

...

9 Commits

Author SHA1 Message Date
abaresk
659073867e
Merge 95e0b2e525 into 7c1d2a64f4 2024-11-11 10:50:10 -08:00
Nadia Holmquist Pedersen
7c1d2a64f4 Set WIN32_LEAN_AND_MEAN, gets rid of the winsock2 warnings and probably
Some checks failed
macOS / ${{ matrix.arch }} (arm64) (push) Has been cancelled
macOS / ${{ matrix.arch }} (x86_64) (push) Has been cancelled
Ubuntu / x86_64 (push) Has been cancelled
Ubuntu / aarch64 (push) Has been cancelled
Windows / build (push) Has been cancelled
macOS / Universal binary (push) Has been cancelled
speeds up compilation a tiny bit

oh and NOMINMAX too for good measure while we're at it
2024-11-11 14:18:05 +01:00
Nadia Holmquist Pedersen
b2f6fab6f4 cmake: use interface include directories properly
and fix an indent I guess
2024-11-11 12:06:12 +01:00
Abaresk
95e0b2e525 Add details on debug print to EmuSettingsDialog 2024-11-05 01:11:12 -08:00
Abaresk
07008d3024 Merge branch 'master' into printf-debug 2024-11-05 00:35:13 -08:00
Abaresk
28d6ab36f0 Add debug printing for ARM mode 2024-06-09 14:13:11 -07:00
Abaresk
c6a2436a69 Place debug printing behind a toggle 2024-06-08 14:50:04 -07:00
Abaresk
d17900fdf7 Use Platform::log 2024-01-09 13:04:41 -05:00
Abaresk
e5ebc7679e Print r0 to terminal on 'swi 0xFC' 2024-01-09 12:40:58 -05:00
10 changed files with 88 additions and 22 deletions

View File

@ -266,6 +266,22 @@ void A_MRC(ARM* cpu)
void A_SVC(ARM* cpu)
{
// Print from game. Execute `svc 0xFC` with the null-terminated string address in `r0`.
if ((cpu->CurInstr & 0xFF) == 0xFC && cpu->NDS.GetDebugPrint())
{
u32 addr = cpu->R[0];
std::string output;
for (;;)
{
u32 c;
cpu->DataRead8(addr++, &c);
if (!c) break;
output += c;
}
Platform::Log(LogLevel::Info, "%s", output.c_str());
return;
}
u32 oldcpsr = cpu->CPSR;
cpu->CPSR &= ~0xBF;
cpu->CPSR |= 0x93;
@ -278,6 +294,22 @@ void A_SVC(ARM* cpu)
void T_SVC(ARM* cpu)
{
// Print from game. Execute `svc 0xFC` with the null-terminated string address in `r0`.
if ((cpu->CurInstr & 0xFF) == 0xFC && cpu->NDS.GetDebugPrint())
{
u32 addr = cpu->R[0];
std::string output;
for (;;)
{
u32 c;
cpu->DataRead8(addr++, &c);
if (!c) break;
output += c;
}
Platform::Log(LogLevel::Info, "%s", output.c_str());
return;
}
u32 oldcpsr = cpu->CPSR;
cpu->CPSR &= ~0xBF;
cpu->CPSR |= 0x93;

View File

@ -127,6 +127,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,6 +180,7 @@ 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)

View File

@ -752,6 +752,11 @@ void NDS::SetGBASave(const u8* savedata, u32 savelen)
}
void NDS::SetDebugPrint(bool enabled) noexcept
{
DebugPrint = enabled;
}
void NDS::LoadGBAAddon(int type)
{
GBACartSlot.LoadAddon(UserData, type);

View File

@ -275,6 +275,7 @@ protected:
std::array<u8, ARM7BIOSSize> ARM7BIOS;
bool ARM9BIOSNative;
bool ARM7BIOSNative;
bool DebugPrint;
public: // TODO: Encapsulate the rest of these members
u16 ARM7BIOSProt;
@ -384,6 +385,9 @@ public: // TODO: Encapsulate the rest of these members
u32 GetGBASaveLength() const { return GBACartSlot.GetSaveMemoryLength(); }
void SetGBASave(const u8* savedata, u32 savelen);
bool GetDebugPrint() const { return DebugPrint; }
void SetDebugPrint(bool enabled) noexcept;
void LoadGBAAddon(int type);
std::unique_ptr<GBACart::CartCommon> EjectGBACart() { return GBACartSlot.EjectCart(); }

View File

@ -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()

View File

@ -308,6 +308,8 @@ LegacyEntry LegacyFile[] =
{"DSiFullBIOSBoot", 1, "DSi.FullBIOSBoot", true},
{"DebugPrintEnabled", 1, "DS.DebugPrintEnabled", true},
#ifdef GDBSTUB_ENABLED
{"GdbEnabled", 1, "Gdb.Enabled", false},
{"GdbPortARM7", 0, "Gdb.ARM7.Port", true},

View File

@ -1384,6 +1384,7 @@ bool EmuInstance::updateConsole(UpdateConsoleNDSArgs&& _ndsargs, UpdateConsoleGB
dsi->EjectGBACart();
}
}
nds->SetDebugPrint(globalCfg.GetBool("DS.DebugPrintEnabled"));
renderLock.unlock();
return true;

View File

@ -61,6 +61,8 @@ EmuSettingsDialog::EmuSettingsDialog(QWidget* parent) : QDialog(parent), ui(new
lastBIOSFolder = cfg.GetQString("LastBIOSFolder");
ui->cbDebugPrintEnabled->setChecked(cfg.GetBool("DS.DebugPrintEnabled"));
ui->chkExternalBIOS->setChecked(cfg.GetBool("Emu.ExternalBIOSEnable"));
ui->txtBIOS9Path->setText(cfg.GetQString("DS.BIOS9Path"));
ui->txtBIOS7Path->setText(cfg.GetQString("DS.BIOS7Path"));
@ -108,6 +110,8 @@ EmuSettingsDialog::EmuSettingsDialog(QWidget* parent) : QDialog(parent), ui(new
ui->cbGdbBOSA9->setDisabled(true);
#endif
ui->cbDebugPrintEnabled->setChecked(cfg.GetBool("DS.DebugPrintEnabled"));
on_chkEnableJIT_toggled();
on_cbGdbEnabled_toggled();
on_chkExternalBIOS_toggled();
@ -272,6 +276,8 @@ void EmuSettingsDialog::done(int r)
cfg.SetBool("DLDI.FolderSync", ui->cbDLDIFolder->isChecked());
cfg.SetQString("DLDI.FolderPath", ui->txtDLDIFolder->text());
cfg.SetBool("DS.DebugPrintEnabled", ui->cbDebugPrintEnabled->isChecked());
cfg.SetQString("DSi.BIOS9Path", ui->txtDSiBIOS9Path->text());
cfg.SetQString("DSi.BIOS7Path", ui->txtDSiBIOS7Path->text());
cfg.SetQString("DSi.FirmwarePath", ui->txtDSiFirmwarePath->text());

View File

@ -573,14 +573,14 @@
<string>Devtools</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>ARM9 port</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -593,7 +593,7 @@
</property>
</spacer>
</item>
<item row="2" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_17">
<property name="text">
<string>ARM7 port</string>
@ -607,28 +607,42 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="7">
<widget class="QLabel" name="label_18">
<item row="0" column="2" colspan="3">
<widget class="QCheckBox" name="cbDebugPrintEnabled">
<property name="text">
<string>Note: melonDS must be restarted in order for these changes to have effect</string>
<string>Enable debug print</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="7">
<widget class="QLabel" name="label_19">
<item row="1" column="0" colspan="7">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Note: GDB stub cannot be used together with the JIT recompiler</string>
</property>
</widget>
</item>
<item row="1" column="6">
<item row="2" column="0" colspan="7">
<widget class="QLabel" name="label_19">
<property name="text">
<string>Note: Debug print outputs to terminal on SVC 0xFC</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="7">
<widget class="QLabel" name="label_20">
<property name="text">
<string>Note: melonDS must be restarted in order for these changes to have effect</string>
</property>
</widget>
</item>
<item row="3" column="6">
<widget class="QCheckBox" name="cbGdbBOSA9">
<property name="text">
<string>Break on startup</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="5">
<item row="3" column="1" colspan="5">
<widget class="QSpinBox" name="intGdbPortA9">
<property name="minimum">
<number>1000</number>
@ -641,7 +655,7 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="5">
<item row="4" column="1" colspan="5">
<widget class="QSpinBox" name="intGdbPortA7">
<property name="minimum">
<number>1000</number>
@ -654,7 +668,7 @@
</property>
</widget>
</item>
<item row="2" column="6">
<item row="4" column="6">
<widget class="QCheckBox" name="cbGdbBOSA7">
<property name="text">
<string>Break on startup</string>

View File

@ -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)