Commit Graph

89 Commits

Author SHA1 Message Date
8f1b0d4a05 convert AREngine 2023-11-04 17:28:16 +01:00
ac38faef14 update copyright years 2023-11-04 00:21:46 +01:00
d11ba63bb0 Fix compilation with the GDB stub disabled (#1863) 2023-11-01 16:02:15 +01:00
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
ee55677086 Assorted portability enhancements (#1800)
* Introduce some Platform calls for managing dynamic libraries

* Add Platform::WriteFATSectors

* Introduce some Platform calls for managing dynamic libraries

* Add Platform::WriteFATSectors

* Change includes of "../types.h" to "types.h"

- Makes it easier to directly include these headers in downstream projects

* Change an include of "../Wifi.h" to "Wifi.h"

* Allow CommonFuncs.cpp to compile on Android

* Tidy up some logging calls

- Use Platform::Log in LAN_Socket.cpp
- Soften some warnings to Debug logs (since they don't necessarily represent problems)

* Add Platform::EnterGBAMode

- Gracefully stop the emulator if trying to enter GBA mode

* Soften some logs that most players won't care about

* Soften some more logs

* Introduce Platform wrappers for file operations

* Fix pointer spacing

* Fix more style nits

* Log the errno when ftruncate fails

* Fix FileSeek offset argument

- With an s32 offset, we couldn't access files larger than 2GB

* Revise Platform::StopEmu to address feedback

- Remove Platform::EnterGBAMode in favor of adding a reason to Platform::StopEmu
- Also rename Platform::StopEmu to Platform::SignalStop
- Add an optional argument to NDS::Stop
- Use the new argument everywhere that the console stops itself

* Rename FileGetString to FileReadLine

- It conveys the meaning better

* Rename FileSeekOrigin::Set to Start

- It conveys the meaning better

* Change definition of FileGetString to FileReadLine

- Oops, almost forgot it

* Rename FlushFile to FileFlush

- To remain consistent with the other File functions

* Add a FileType usage

* Fix line break in FileSeekOrigin

* Document Platform::DeInit

* Clarify that StopReason::Unknown doesn't always mean an error

* Move and document FileType::HostFile

* Remove Platform::OpenDataFile

- Nothing currently uses it

* Refactor Platform::OpenFile and Platform::OpenLocalFile to accept a FileMode enum instead of a string

- The enum is converted to fopen flags under the hood
- The file type is used to decide whether to add the "b" flag
- Some helper functions are exposed for the benefit of consistent behavior among frontends
- Equivalent behavior is maintained

* Fix a tab that should be spaces

* Use Windows' 64-bit implementations of fseek/ftell

* Move Platform::IsBinaryFile to Platform.cpp

- It could vary by frontend

* Remove an unused FileType

* Rename an enum constant

* Document various Platform items

* Use Platform::DynamicLibrary to load libandroid

- And clean it up at the end

* Fix a typo

* Pass the correct filetype to FATStorage

- Since it can be used for DSI NAND images or for SD cards

* Remove Platform::FileType
2023-08-18 22:50:57 +02:00
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
86d2e60df7 fix #1593 2023-01-03 18:50:03 +01:00
35cc79787d update copyright headers 2022-01-09 02:15:50 +01:00
19ddaee13b finally decouple Config from the core. baahhahahahah 2021-11-18 01:17:51 +01:00
c1dcd585be decouple JIT from Config. bahahahahah 2021-11-17 18:15:50 +01:00
cca5615748 add the PU checks. bahahahah 2021-10-29 00:36:55 +02:00
43daa1c7d2 blarg 2021-10-28 21:24:39 +02:00
e121953c9a more complete (and accurate) CP15 setup for direct boot 2021-10-28 21:15:12 +02:00
9d82826cdb fix some gaps in CPU modes
* non-defined CPU modes are actually possible
* bit4 of all PSRs is forced to one (modes 00-0F aren't possible)
* modes 14/15/16 and 18/19/1A share a SPSR with modes 17 and 1B respectively (but they don't share the register banks)
* modes 10 and 1C/1D/1E don't have a SPSR (MRS returns the CPSR always)
2021-10-28 19:45:32 +02:00
ff3f661bb5 DLDI/SD folder-sync apparatus (#1251)
guess we can finally have DLDI that isn't obtuse
2021-10-28 18:47:13 +02:00
883fceb6ce use std::swap 🔃 2021-08-21 01:54:45 +02:00
436b3c4c1d update copyright year and add missing GPL headers 2021-03-12 20:07:40 +01:00
1dbe69c6be remove some debug crap 2020-12-10 18:09:11 +01:00
81964a0f89 make things function atleast somewhat
no pciture is being actually sent yet
2020-10-26 21:54:08 +01:00
8d42b1c7d7 messin' around 2020-09-08 20:19:37 +02:00
f56aa60eb6 check IRQ first then Idle loop
apparently I put it this way for a reason
2020-07-28 00:44:58 +02:00
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
8a96dfce18 fix build with JIT disabled
fixes #675 and #674
2020-07-25 20:59:53 +02:00
c5381d2911 reconcile DSi and JIT, fastmem for x64 and Windows 2020-06-30 23:50:41 +02:00
e335a8ca76 first steps in bringing over the JIT refactor/fastmem 2020-06-16 12:11:19 +02:00
052ff73672 rewrite JIT memory emulation 2020-06-16 12:01:08 +02:00
6d217e1010 fix build with JIT disabled and set default JIT maxblock size to 32 2020-06-16 11:59:09 +02:00
1c07932b40 implement block linking + some refactoring
currently only supported for x64
2020-06-16 11:59:06 +02:00
baed0ac0d5 remove debug leftovers 2020-06-16 11:57:50 +02:00
ec965c6014 improve nop handling and proper behaviour for LDM^
fixes dslinux
2020-06-16 11:57:49 +02:00
1cfbbcbb2a make savestates 100% compatible again 2020-06-16 11:57:48 +02:00
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
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
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
00cd9af033 fix uninitialised memory mapping 2020-06-16 11:54:47 +02:00
4deecc7d65 jit: decrease blockcache AddrMapping size for ARM9 2020-06-16 11:54:05 +02:00
86f2be7260 jit: add compile option 2020-06-16 11:54:03 +02:00
d13d625f73 jit: make everything configurable 2020-06-16 11:53:21 +02:00
f22521a43d jit: LDM/STM finally(!) working + MUL, MLA and CLZ 2020-06-16 11:53:10 +02:00
83bd863361 jit: branch instructions 2020-06-16 11:53:09 +02:00
10e386fe50 JIT: most mem instructions working
+ branching
2020-06-16 11:53:08 +02:00
2f6b46fd4f JIT: implemented most ALU instructions 2020-06-16 11:53:06 +02:00
c692287eba JIT: base
all instructions are interpreted
2020-06-16 11:53:05 +02:00
43e045357f make it able to switch between DS and DSi modes 2020-06-01 20:36:30 +02:00
2327de2423 Merge commit '4b57416552ec2fa95216e2b044559f215723bf70' into melonDSi 2020-05-30 03:12:42 +02:00
5f99a68151 detect whether we are running the game 2020-02-24 18:31:44 +01:00
85a6a5bb38 * add support for a bunch of codes (all of them minus the loop shit, really)
* hook it betterer so it doesn't asplode
2020-02-14 23:34:26 +01:00
83f8e11bc1 update copyright years 2020-02-14 20:18:08 +01:00
81dde71eba add AES, fix a bunch of bugs
we're getting an error screen! wee
2019-06-19 14:24:49 +02:00
606a40e6b8 y'know, actually running the DMA units might yield better results. 2019-06-18 22:57:37 +02:00