Commit Graph

48 Commits

Author SHA1 Message Date
Jesse Talavera-Greenberg d4e51f8060
Refactor DSi_NAND (#1844)
* Refactor diskio's contents

- Change ff_disk_read_cb/write_cb into a std::function instead of a raw pointer
- Add const specifiers as needed

* Refactor DSi_NAND to manage the file system's mounted lifetime with RAII

* Split NANDMount into NANDMount and NANDImage

- NANDImage is used for information about the NAND that doesn't require decryption or filesystem access
- NANDMount is used to actually access the file system
- Both classes manage their respective resources (the NAND file handle and the NAND's mount) with RAII
- Also split the file loading into another function that I will remove in a later PR

* Make NANDMount immovable

* Remove NAND-loading code that I had sectioned off into a function

- Incomplete copypasta
- I must have gotten distracted

* Tidy up NANDImage's initialization

- Don't unmount the disk image if the constructor fails (that's NANDMount's job now)
- Only assign CurFile if the constructor succeeds

* Add some const-correctness

* Move DSi NAND initialization to the frontend

- The NANDImage is now installed via a unique_ptr in DSi

* Remove Platform::DSi_NANDPath

- Not Config::DSiNANDPath; that can still be configured as usual
- The core no longer needs to care
2023-10-11 17:20:05 +02:00
Jesse Talavera-Greenberg 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
RSDuck 4b170b94d5 pointless micro optimisations 2023-04-28 17:05:34 +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 86786738cc properly make the DSi NAND instance-unique 2022-09-23 22:53:23 +02:00
RSDuck 4c97731468 fix last commit for when no SD is inserted 2022-08-21 19:55:23 +02:00
RSDuck 334fc1717d fix DSi SD newly inserted/removed IRQ bits
we don't support SD card hot swapping and SDIO wifi is always inserted, so those bits are always zero
special thanks to Evie
2022-08-21 19:52:23 +02:00
Arisotura 35cc79787d update copyright headers 2022-01-09 02:15:50 +01:00
Arisotura e665e25bd3
Custom path support (#1333)
also including:
* getting rid of shitty strings
* all new, cleaner ROM handling code
* base for DSi savestates
* GBA slot addons (for now, memory cart)
2022-01-07 14:00:43 +01:00
Arisotura 19ddaee13b finally decouple Config from the core. baahhahahahah 2021-11-18 01:17:51 +01:00
Arisotura 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
Nadia Holmquist Pedersen b92622b765 Revert "Misc fixes for dsiwifi BMI stage (#1216)"
This reverts commit a54b076b06.
2021-10-02 13:57:52 +02:00
Max Thomas a54b076b06
Misc fixes for dsiwifi BMI stage (#1216) 2021-09-06 12:52:33 +02:00
Arisotura 1846a71265
Cart refactor (#1073)
complete cart-interface refactor, will make this code a lot easier to deal with
2021-04-25 00:48:02 +02:00
RSDuck 436b3c4c1d update copyright year and add missing GPL headers 2021-03-12 20:07:40 +01:00
WaluigiWare64 43348210f9 Fix some compiler warnings 2021-01-25 14:12:13 +00:00
RSDuck 1d6cc3c6ef keep only one handle of the NAND file around 2021-01-17 19:56:02 +01:00
RSDuck fa4363ede6 make FIFO size static whene possible 2020-12-30 23:37:46 +01:00
Arisotura af0a9e92c4 make unlaunch'd NANDs work 2020-10-25 18:25:09 +01:00
Arisotura 4be68aafe0 make SD support actually be a thing 2020-08-25 00:34:57 +02:00
Arisotura fc5eedc716 * take nwifi forward some
* shut up CP15 printf's for Fx0
* fix bugs
2020-06-15 13:39:33 +02:00
Arisotura 5cd1177e34 huh. all DSi files had outdated copyright years 2020-06-05 20:44:18 +02:00
Arisotura 1abcb4e6ac I'm a major derp 2020-06-02 14:36:15 +02:00
Arisotura b84edfb321 silence pointless and spammy printf 2020-06-01 16:35:09 +02:00
Arisotura 6326ddd172 reset SD controllers during a soft-reset 2020-06-01 16:32:44 +02:00
Arisotura 77f4663f49 betterer SD/MMC code. Flipnote can save shit! 2020-06-01 16:24:59 +02:00
Arisotura e82364f010 * some fixes to SD controller support, make it clear that there is no SD inserted, makes Flipnote work somewhat better
* immediately clear AES busy flag when the block count is zero (occurs when loading DSi cart games)
* implement NDMA start modes that have an old-DMA equivalent (except for GXFIFO mode)

now it boots DSi carts!
2019-10-19 16:03:59 +02:00
Arisotura dcda848cdf * base for potentially re-encrypting modcrypt, doesn't seem to be required? but can also serve to decrypt it
* revise SD IRQ behavior (fixing potential hang when loading DS games)
2019-08-07 12:57:12 +02:00
Arisotura 36c741241a support DSi-mode carts
except they need to have the DSi-mode shit encrypted
2019-08-04 16:46:02 +02:00
Arisotura f7f4ff0519 wifi: take this shit further. complete wifi init 2019-08-04 02:16:16 +02:00
Arisotura 06716794a1 lots of things. attempting to make wifi init work. not there yet. 2019-07-24 18:48:52 +02:00
Arisotura ec042000cf lay base for DSi wifi 2019-07-03 00:07:51 +02:00
Arisotura 851e255b40 * AES-CCM decrypt
* fix a bunch of bugs
2019-07-02 23:46:39 +02:00
Arisotura 8c64290958 make it work better 2019-06-21 00:07:57 +02:00
Arisotura 1bd7243edc make it actually not crapo the NAND 2019-06-20 23:20:08 +02:00
Arisotura ed6b85bf33 implement SD/MMC write (cmd25) 2019-06-20 23:05:32 +02:00
Arisotura d943a51b96 ayyy
getting there!
2019-06-20 03:19:51 +02:00
Arisotura d5a7c0bab8 there, PSISP 2019-06-19 15:58:50 +02:00
Arisotura 2a60fad0a5 fix moar bugs, get furtherer (add support for SDHC addressing) 2019-06-19 15:54:07 +02:00
Arisotura 6e5879f8bb fix more bugs, get further 2019-06-19 15:26:38 +02:00
Arisotura 78b28f6a5c fix bug with SD reads going a bit too far 2019-06-19 14:44:00 +02:00
Arisotura 81dde71eba add AES, fix a bunch of bugs
we're getting an error screen! wee
2019-06-19 14:24:49 +02:00
Arisotura f0131cfac9 plug it to the SD/MMC FIFO.
now half the shit is done.
2019-06-18 23:10:55 +02:00
Arisotura eb18643762 add data32 IRQ thing 2019-06-18 18:39:13 +02:00
Arisotura dc3c9f5bf8 take all the SDMMC shit further. now it's completing MMC init and trying to read shit. 2019-06-18 14:12:37 +02:00
Arisotura 6c75275593 moar SD/MMC commands 2019-06-17 18:40:45 +02:00
Arisotura bedc0220fc take this shit further 2019-06-17 13:24:37 +02:00
Arisotura d4dd97638d lay base for SD shit 2019-06-16 17:01:49 +02:00