Commit Graph

57 Commits

Author SHA1 Message Date
Arisotura 0ea0af3abf make it possible to change gdb stub settings without destroying/recreating a NDS 2024-11-17 20:00:52 +01:00
fincs 584508230f
Assortment of fixes related to libnds v2/calico (#2197)
* Support 8-bit writes to REG_IPCSYNC

* Support CP15 Trace Process ID register

* NWifi: expose correct manfid information in CIS0/CIS1 area

* NWifi: basic support for WMI_SET_PROBED_SSID

# Conflicts:
#	src/DSi_NWifi.cpp

* DSi_NAND: fix incorrect CTR IV calculation code
2024-11-17 15:57:00 +01:00
RSDuck dd386d12a9 use templates to only execute GDB stub related code if enabled 2024-08-05 03:23:49 +02:00
Arisotura 8fc403cdad update copyright headers 2024-06-15 17:01:19 +02:00
Jesse Talavera 9bfc9c08ff
Sprinkle `const` around where appropriate (#1909)
* Sprinkle `const` around where appropriate

- This will make it easier to use `NDS` objects in `const` contexts (e.g. `const` parameters or methods)

* Remove the `const` qualifier on `DSi_DSP::DSPRead16`

- MMIO reads can be non-pure, so this may not be `const` in the future
2023-12-12 11:07:22 +01:00
Jesse Talavera-Greenberg 399a6af91c Move some constants to `MemConstants.h` 2023-12-08 17:19:00 +01:00
Jesse Talavera 090627b3c1
Remove the last `ConfigEntry` state (#1902)
* Get rid of `ConfigEntry::ExternalBIOSEnable`

- Now the BIOS files themselves are checked
- The frontend's `Config::ExternalBIOSEnable` is not affected

* Add `JITArgs`

* Pass the JIT status to the `ARM` constructors

* Encapsulate `NDS::EnableJIT`

* Pass `JITArgs` to `ARMJIT`'s constructor

* Remove the `JIT_*` `ConfigEntry`s in favor of members

- Allow all the JIT args to be set with `NDS::SetJITArgs`
- Encapsulate the JIT-related parameters in `ARMJIT` so they can reset the block cache if changed
- Update the active (or newly-created) console in the frontend with adjusted JIT args

* Make audio bit depth and interpolation configurable in `NDSArgs`

- Define enums for both
- Give those settings default values in `NDSArgs`
- Remove `ConfigEntry::AudioBitDepth`
- Initialize these settings in the relevant SPU constructors

* Move the last DSi-specific logic in `Reset` to its own subclass

* Remove `ConfigEntry::DSi_FullBIOSBoot`

- Add members to `DSi` instead for getting and setting this
- Update the frontend to accommodate these changes

* Oops, missed a spot

* Remove `ConfigEntry::Firm_MAC` and `Platform::GetConfigArray`

- Also move the MAC parsing code to `ROMManager`

* Remove the last `ConfigEntry` state

- Make GDB support configurable via members

* Add some `#ifdef`s that I'd almost forgotten
2023-12-05 16:47:16 +01:00
Jesse Talavera-Greenberg e973236203
Refactor `NDS` and `DSi` to be objects (#1893)
* First crack at refactoring NDS and DSi into objects

- Remove all global/`static` variables in `NDS` and related classes
- Rely more on virtual dispatch when we need to pick methods at runtime
- Pass `NDS&` or `DSi&` to its constituent components where necessary
- Introduce some headers or move some definitions to break `#include` cycles

* Refactor the frontend to accommodate the core's changes

* Move up `SchedList`'s declaration

- Move it to before the components are initialized so the `map`s inside are initialized
- Fields in C++ are initialized in the order they're declared

* Fix a crash when allocating memory

* Fix JIT-free builds

* Fix GDB-free builds

* Fix Linux builds

- Explicitly qualify some member types in NDS, since they share the same name as their classes

* Remove an unnecessary template argument

- This was causing the build to fail on macOS

* Fix ARM and Android builds

* Rename `Constants.h` to `MemConstants.h`

* Add `NDS::IsRunning()`

* Use an `#include` guard instead of `#pragma once`
2023-11-28 23:16:41 +01:00
Jesse Talavera-Greenberg 346dd4006e
Move all core types into namespaces (#1886)
* Reorganize namespaces

- Most types are now moved into the `melonDS` namespace
- Only good chance to do this for a while, since a big refactor is next

* Fix the build
2023-11-25 18:32:09 +01:00
Jesse Talavera-Greenberg 544fefa27f
Refactor the JIT to be object-oriented (#1879)
* Move TinyVector to a new file

- So it's less sensitive to #include ordering

* Forgot to include assert.h

* Refactor ARMJIT_Memory into an object

* Oops, forgot a declaration

* Refactor ARMJIT to be contained in an object

* Remove an unused function declaration

* Add a missing #include

* Remove a now-unused global

* Use ARMJIT_Memory's own memory access functions

* Fix some omissions in the ARM JIT

* Move libandroid to be a member of ARMJIT_Memory instead of a global

* Default-initialize most fields in ARMJIT_Compiler.h

* Define NOOP_IF_NO_JIT

* Finish refactoring the JIT to be object-oriented
2023-11-18 16:40:54 +01:00
Jesse Talavera-Greenberg 4558be0d8e
Refactor the GPU to be object-oriented (#1873)
* Refactor GPU3D to be an object

- Who has two thumbs and is the sworn enemy of global state? This guy!

* Refactor GPU itself to be an object

- Wow, it's used in a lot of places
- Also introduce a new `Melon` namespace for a few classes
- I expect other classes will be moved into `Melon` over time

* Change signature of Renderer3D::SetRenderSettings

- Make it noexcept, and its argument const

* Remove some stray whitespace
2023-11-09 21:54:51 +01:00
Arisotura ac38faef14 update copyright years 2023-11-04 00:21:46 +01:00
PoroCYon 3ab752b8ca
GDB stub (#1583)
* gdbstub beginnings

* gdbstub: finish gdb impl things, next up is integration with melonDS

* holy fuck the gdbstub works

* gdb breakpoints work, but there's a mysterious crash on continue

* fix memory corruption that sometimes happened, and make resetting the console thru gdb work

* remove some gdb debug printing

* fix things in gdbstub

* separate option for enabling gdbstub

* add mode-dependent CPU registers

* C++ize the GDBstub code

* add gdbstub config in emu settings dialog

* make sure gdb is disabled when jit is enabled

* Remove unnecessary compiler flags, mark ARMJIT assembly code as no-execute-stack

This hardens the binary a little bit against common exploitation methods

* add option to wait for debugger attach on startup

* only insert GNU stack notes on linux

* disable gdbstub enable checkbox when jit is enabled

* fix non-linux incompatibilities

* enable gdbstub by default

* fix issues with gdbstub settings disable stuff

* format stuff

* update gdb test code

* Fix segfault when calling StubCallbacks->GetCPU()

C++ overrides are hard. Please I'm just a lowly C programmer.

* fix packet size not being sent correctly

Thanks to @GlowingUmbreon on Github for troubleshooting this

* fix select(2) calls (i should read docs more properly)

* fix GDB command sequencing/parsing issue (hopefully)

* [GDB] implement no-ack mode

* fix sending ack on handshake

* get lldb to work
2023-10-22 15:35:31 +02:00
Arisotura 35cc79787d update copyright headers 2022-01-09 02:15:50 +01:00
RSDuck 6c2ea93173 get rid of DTCMSize 2021-10-29 01:35:47 +02:00
Arisotura 15a66b1be1 more accurate DTCM check 2021-10-28 22:41:42 +02:00
Arisotura 43daa1c7d2 blarg 2021-10-28 21:24:39 +02:00
Arisotura e121953c9a more complete (and accurate) CP15 setup for direct boot 2021-10-28 21:15:12 +02:00
RSDuck 436b3c4c1d update copyright year and add missing GPL headers 2021-03-12 20:07:40 +01:00
RSDuck 9772201345 remove some UB
- savestates used to read a four bytes from a single byte value
- a few unassigned variables
- some other things
- also make the ROR macro an inline function
2020-09-04 20:37:14 +02:00
RSDuck 5903b11bda subtract cycles after checking IRQ and Halt
also switch back to adding to ARM::Cycles instead of subtracting from them
2020-07-27 23:14:39 +02:00
RSDuck 8a96dfce18 fix build with JIT disabled
fixes #675 and #674
2020-07-25 20:59:53 +02:00
RSDuck c5381d2911 reconcile DSi and JIT, fastmem for x64 and Windows 2020-06-30 23:50:41 +02:00
RSDuck e335a8ca76 first steps in bringing over the JIT refactor/fastmem 2020-06-16 12:11:19 +02:00
RSDuck 052ff73672 rewrite JIT memory emulation 2020-06-16 12:01:08 +02:00
RSDuck 1c07932b40 implement block linking + some refactoring
currently only supported for x64
2020-06-16 11:59:06 +02:00
RSDuck 1ad90cb334 include more information in DataRegion 2020-06-16 11:58:46 +02:00
RSDuck 99b34efe2d move ARM64 JIT backend here 2020-06-16 11:57:51 +02:00
RSDuck 441869a105 integrate changes from ARM64 backend and more
- better handle LDM/STM in reg alloc
- unify Halted and IRQ in anticipation for branch inlining
- literal optimisations can be disabled in gui
- jit blocks follow simple returns
- fix idle loop detection
- break jit blocks on IRQ (fixes saving in Pokemon White)
2020-06-16 11:57:45 +02:00
RSDuck 40b88ab05a new block cache and much more...
- more reliable code invalidation detection
- blocks aren't stopped at any branch, but are being followed
if possible to get larger blocks
- idle loop recognition
- optimised literal loads, load/store cycle counting
 and loads/stores from constant addresses
2020-06-16 11:56:36 +02:00
RSDuck 316378092a abandon pipelining on jit
fixes Golden Sun Dawn
this makes the cpu state incompatible between interpreter and JIT. That's why switching cpu mode requires a restart(not requiring is stupid anyway) and the pipeline is manually filled when making a save state.
2020-06-16 11:55:24 +02:00
RSDuck 86f2be7260 jit: add compile option 2020-06-16 11:54:03 +02:00
RSDuck d13d625f73 jit: make everything configurable 2020-06-16 11:53:21 +02:00
Arisotura 43e045357f make it able to switch between DS and DSi modes 2020-06-01 20:36:30 +02:00
Arisotura 2327de2423 Merge commit '4b57416552ec2fa95216e2b044559f215723bf70' into melonDSi 2020-05-30 03:12:42 +02:00
Arisotura b44570eba1 merge moar 2020-05-30 03:04:14 +02:00
Arisotura 83f8e11bc1 update copyright years 2020-02-14 20:18:08 +01:00
Arisotura e117da235e smarter CP15 PU region updates. disable some useless logging.
fixes #528
2019-10-21 23:14:34 +02:00
Arisotura 83d23939db melonDSi: skeleton in place 2019-06-15 13:09:11 +02:00
Arisotura 00a5576492 fasterer IRQ check. clean up code. 2019-06-08 22:16:51 +02:00
Arisotura b0efde8bf7 also, update copyright name 2019-01-22 15:58:29 +01:00
StapleButter 669247e8c8 redesign main emu loop to use timestamps instead of being a trainwreck
* cleaner code
* faster in some cases
* more accurate (on-demand compensation for timers and GPU)
* less prone to desyncs
* overall betterer
2019-01-05 05:28:58 +01:00
StapleButter 90f2c0834e add PoC ARM9 instruction cache logic. not actually in use, but it's there as a reference (and if we ever need it). 2019-01-04 21:47:06 +01:00
StapleButter 4aafdee14d more sensible cache timings
(still a big fat hack)
2018-12-11 17:59:52 +01:00
StapleButter 29bca33bc6 take it somewhere.
still need to speed it up a tad.
2018-12-09 01:17:05 +01:00
StapleButter 86dae1a25c make this other branch where we're going to actually make it usable
but it'll be a gross hack
2018-12-08 20:27:00 +01:00
StapleButter 0b1c2f9691 begin PU work 2018-12-04 18:32:19 +01:00
StapleButter 172fb4876a begin work on general timing renovation. way shitty because it behaves as if caches were off, so everything will be slow as shit. 2018-12-04 17:54:10 +01:00
StapleButter 7ba32ea076 make the ARM clock shift configurable. nothing fancy there, just paving the way for DSi support later. 2018-11-07 18:38:54 +01:00
StapleButter b4165cc0a9 3D: keep the rasterizer from accidentally going out of bounds when given very flat X-major edge slopes.
this, by a fucking shitshow of butterfly effect, ends up fixing #234. technically, the rasterizer was going out of bounds, which, under certain circumstances, caused interpolation to shit itself and generate Z values that were out of range (but still ended up in the zbuffer). sometimes those values ended up negative, which caused these glitches when polygons had to be drawn over those.

about fucking time.
2018-11-04 23:21:58 +01:00