Commit Graph

49 Commits

Author SHA1 Message Date
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
Jesse Talavera-Greenberg db963aa002
Make the NDS teardown more robust (#1798)
* Make cleanup a little more robust to mitigate undefined behavior

- Add some null checks before cleaning up the GPU3D renderer
- Make sure that all deleted objects are null
- Move cleanup logic out of an assert call
- Note that deleting a null pointer is a no-op, so there's no need to check for null beforehand
- Use RAII for GLCompositor instead of Init/DeInit methods

* Replace a DeInit call that I missed

* Make ARMJIT_Memory less likely to generate errors

- Set FastMem7/9Start to nullptr at the end
- Only close and unmap the file if it's initialized

* Make Renderer3D manage its resources with RAII

* Don't try to deallocate frontend resources that aren't loaded

* Make ARMJIT_Memory::DeInit more robust on the Switch

* Reset MemoryFile on Windows to INVALID_HANDLE_VALUE, not nullptr

- There is a difference

* Don't explicitly store a Valid state in GLCompositor or the 3D renderers

- Instead, create them with static methods while making the actual constructors private

* Make initialization of OpenGL resources fail if OpenGL isn't loaded

* assert that OpenGL is loaded instead of returning failure
2023-09-15 15:31:05 +02:00
Jesse Talavera-Greenberg 79dfb8dc8f
Introduce `Platform::Log` (#1640)
* Add Platform::Log and Platform::LogLevel

* Replace most printf calls with Platform::Log calls

* Move a brace down

* Move some log entries to one Log call

- Some implementations of Log may assume a full line

* Log the MAC address as LogLevel::Info
2023-03-23 18:04:38 +01:00
Arisotura b1e4bd5520
merge local_wifi (#1516)
* attempt at betterer wifi

* add preliminary sync mechanism
* fix gaps in wifi implementation

* move local-MP comm to its own module instead of cramping Platform.cpp

* remove some stupid cruft

* as you wish, Sorer

(starting work on shared-memory system)

* shared-memory IPC that actually works (albeit Windows-only for now)

* shut up logging from NULL writes on ARM7 (ffs Nintendo learn to code)

* get this somewhat good

* leave client sync mode when host deauths. makes download play actually work.

* start implementing MP-comm error handling

* * add MP-reply error counters
* feeble attempt at fixing slowdown/desync/etc problems

* somewhat better exchange/sync method

* * when entering power-saving mode, be sure to finish transferring the current frame first
* fix misc bug due to old cruft leftover

makes for a more stable connection

* remove a bunch of cruft

* set wifi time interval to 34 cycles instead of 33. games seem sensitive to the general timing of wifi vs the rest of the system, and this seems to make things run better, atleast until I rewrite this to use a proper scheduler.

* more graceful handling of disconnects

* deal with FIFO overflow more gracefully

* BAHAHAHAHAHAHAHAHHHH

THE SNEAKY BASTARDS

so, when the DS receives a beacon with the right BSSID

that beacon's timestamp is copied to USCOUNTER

* attempt at making the connection process smoother for weird games

* * begin adding POWCNT2, only applies to wifi for now
* begin work on wifi scheduler

* implement the shitty timers

* add the RF wakeup thing

* begin work on receiving frames. for now it can just receive melonAP beacons, but hey, it's a start.

* add enough TX functionality that online wifi is a possibility again.

* there are problems with this scheduler thing. committing it anyway

* kind of a rollback... we're gonna work out a compromise on this, I guess

* don't transmit shit if RXCNT.bit15 isn't set

* move RX-finish to its own function. more accurate filtering. implement RXFILTER.

* remove some cruft

* fix some of the shittiness when trying to connect more than two players

* fix some more shittiness

* fix more wifi shittiness (mainly don't try to receive shit while sending a frame)

* run wifi every 8µs. improves performance.

* fix IRQ14/IRQ15

* make this work under Linux

* Make it work on macOS, for now using a custom sem_timedwait
implementation.

If anyone knows anything about mach ports and have an idea for how to
make this work using mach IPC, please do let me know.

* 25ms seems like a good timeout

* begin work on proper multiplayer UI shito.

for now, determine a global instance ID, and derivate the system MAC from it. remove 'randomize MAC' option.

* finish removing RandomizeMAC

* lay groundwork for instance-unique config

* work some on the UI... make it not labelled Fart

* more UI work: make it explicit that some things are instance-unique

* separate firmware files for multiplayer instances

* make instances save to different save files, too

* more UI work, make things somewhat less shitty

* lay base for the multiplayer settings dialog

* actually hook up most of that dialog

* actually implement the fun audio settings

* ensure all the wifi shit is properly savestated and reset. properly update timings for the wifi region when wifi is disabled.

* add more fun labels

* * ignore WEP frames if WEP is off
* implement RX_LEN_CROP

* fake enough of WEP processing to make Inazuma Eleven work

* * do not copy more ROM banner data than actually needed
* avoid trying to read out of bounds if the banner offset is bad

* Fix oversight with the preferences action causing the build to fail on macOS

Co-authored-by: Nadia Holmquist Pedersen <nadia@nhp.sh>
2022-09-22 20:32:27 +02:00
Arisotura 35cc79787d update copyright headers 2022-01-09 02:15:50 +01:00
Arisotura 44757a8323 SPU: block reads from ARM7 BIOS region. fixes #1267 (and prolly whatever other stupid game tries to play sound from NULL) 2021-11-25 16:49:43 +01:00
Arisotura c04e43702c SPU: correctly read negative ADPCM initial values. fixes #1261 2021-11-23 18:47:54 +01:00
Arisotura 19ddaee13b finally decouple Config from the core. baahhahahahah 2021-11-18 01:17:51 +01:00
Nadia Holmquist Pedersen 415ab22f3a fark 2021-08-17 01:01:15 +02:00
Nadia Holmquist Pedersen 2aeb452dfb SPU: Do clamping after applying SOUNDBIAS 2021-08-17 01:01:15 +02:00
Nadia Holmquist Pedersen 418b351986 SPU: Emulate SOUNDBIAS and 10-bit degrade 2021-08-17 01:01:15 +02:00
Arisotura 2df6b4fdc3
Audio interpolation (#1176)
add audio interpolation (emulation improvement)
2021-08-08 14:27:57 +02:00
RSDuck 436b3c4c1d update copyright year and add missing GPL headers 2021-03-12 20:07:40 +01:00
RSDuck 05b94eff66 make audio output thread safe(r?) 2020-11-15 15:29:38 +01:00
RSDuck 9ac60a840a SPU: work with scalars instead of arrays 2020-10-31 13:48:02 +01:00
Arisotura a32d997e1c SPU: don't process channels with len<4 2020-08-19 04:18:17 +02:00
Arisotura 2f9a6b7c03 SPU: delay channel start until whenever it can actually start. fixes maxmod interpolated mode. 2020-07-23 12:59:19 +02:00
Arisotura 43e045357f make it able to switch between DS and DSi modes 2020-06-01 20:36:30 +02:00
Arisotura b62d90cbe4 Merge remote-tracking branch 'remotes/origin/master' into melonDSi 2020-05-30 03:19:20 +02:00
Arisotura 2327de2423 Merge commit '4b57416552ec2fa95216e2b044559f215723bf70' into melonDSi 2020-05-30 03:12:42 +02:00
Arisotura 5eb01f1f15 begin renovating melonDSi 2020-05-30 02:40:51 +02:00
Arisotura a9b275bc25 reimplement Stop 2020-05-20 22:58:04 +02:00
Arisotura 83f8e11bc1 update copyright years 2020-02-14 20:18:08 +01:00
Arisotura 3efe90f78a deal with SPU FIFO overflow in a more pleasant manner 2019-09-04 16:40:29 +02:00
Arisotura 02a6fe182c see, Arisotura, was it that hard? 2019-09-04 16:29:40 +02:00
Arisotura 455b0e5689 more fixes to audio output
maybe by 2034 we'll finally get that shit going
2019-09-01 15:41:46 +02:00
Arisotura fbad8b0f43 * new FPS limiter
* new audio output/sync method

about fucking time
2019-08-29 15:55:18 +02:00
Arisotura 626a9c1385 my bad. 2019-08-18 11:31:03 +02:00
Arisotura ff27036b35 start botching the FPS limiter
results in shitty audio because it's overflowing the buffer
2019-07-12 22:04:55 +02:00
Arisotura 851e255b40 * AES-CCM decrypt
* fix a bunch of bugs
2019-07-02 23:46:39 +02:00
Arisotura 71ecb6a65b derping around 2019-05-14 15:10:58 +02:00
Arisotura b0efde8bf7 also, update copyright name 2019-01-22 15:58:29 +01:00
StapleButter 2077642a92 libui/GTK: remember directory in which the latest loaded ROM was, point file picker to it. behavior under Windows will likely stay unchanged as the Windows file picker already does that. 2018-12-14 22:03:34 +01:00
StapleButter a4eaf7dc19 SPU:
* support channel repeat mode 3, behaves same as mode 1 (loops)
* always clear channel buffers, so if channels 0-7 use format 3, they don't output old data over and over again (fixes #281)
2018-12-14 00:14:06 +01:00
StapleButter c6fb152d80 start devolving things.
also implement proper DMA timings.

will not build. don't try.
2018-12-08 22:33:41 +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 7bf62918cd SPU done 2018-10-18 02:45:38 +02:00
StapleButter fea7955675 fixor copyright years. 2018-09-15 02:32:13 +02:00
StapleButter 73bf4471ee audio: change output rate to 47340Hz, add resampler with small margin to elimiate pops/clicks due to output rate fluctuation
output rate is picked such that 1024 samples at that rate equal exactly 710 samples at the SPU's output rate
2017-12-11 18:41:05 +01:00
StapleButter b96ac8e000 (finally) fix sound
* reset capture position when starting capture
* reorder channel/capture handling
* implement FIFO for channel and capture
2017-11-11 18:46:42 +01:00
StapleButter 495d0ba12d add support for SPI shutdown, btw 2017-09-21 03:59:12 +02:00
StapleButter 50d2ffb207 misc. things 2017-05-09 03:54:37 +02:00
StapleButter bc70f00372 windows! 2017-04-09 03:35:32 +02:00
StapleButter 3f3b2977d7 * sound capture from left/right mixers
* support for appropriate output modes
2017-04-08 22:59:27 +02:00
StapleButter a4f436f827 * stub more wifi crap
* louder sound
* misc fixes
2017-04-07 17:37:49 +02:00
StapleButter d8bbf25431 * PCM8, PCM16, ADPCM, white noise
* volume, volume div, panning, master volume
2017-04-07 01:06:10 +02:00
StapleButter 76c4e57608 preliminary audio. only supports PSG (and handles all channels as such). drops out every once in a while. 2017-04-06 22:38:46 +02:00
StapleButter 8d66beba6b start SPU work 2017-04-06 19:44:34 +02:00
StapleButter 28cddadfbc * bump version number
* feed system time into RTC
* start laying base for sound
2017-04-04 15:32:50 +02:00