aboutsummaryrefslogtreecommitdiff
path: root/src/DSi_NAND.h
Commit message (Collapse)AuthorAge
* Sprinkle `const` around where appropriate (#1909)Jesse Talavera2023-12-12
| | | | | | | | | * 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
* Move all core types into namespaces (#1886)Jesse Talavera-Greenberg2023-11-25
| | | | | | | | * 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
* update copyright yearsArisotura2023-11-04
|
* get this started: refactor SPI in OOPArisotura2023-11-03
|
* Miscellaneous DSi NAND fixes (#1852)Jesse Talavera-Greenberg2023-10-24
| | | | | | | | | | | | | | | | | | | | | | | | | | * Replace some standard I/O calls with Platform equivalents - I missed a spot when I submitted that PR a few months ago * Include <memory> in DSi_NAND.h - Because it uses unique_ptr * Split DSi_NAND::ReadHardwareInfo into ReadSerialData and ReadHardwareInfoN * Add a RegionMask enum * Move DSi NAND patching to the frontend * Add DSiSupportedLanguageMask - Not currently used by the frontend, but I use it in melonDS DS * Remove some Platform::ConfigEntry values - The core no longer needs to know about them - The corresponding Config values are unchanged * Mark NANDMount's destructor as noexcept
* Refactor DSi_NAND (#1844)Jesse Talavera-Greenberg2023-10-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Add some structs for files that DSi_NAND reads (#1842)Jesse Talavera-Greenberg2023-10-02
| | | | | | | | | | | | | | | | | | | * Add DSiFirmwareSystemSettings * Replace DSiFirmwareSystemSettings::TouchCalibration fields with std::arrays - So assignment can be done in one line * Make DSiFirmwareSystemSettings a union - So its bytes can be accessed * Add a comment * Use DSiFirmwareSystemSettings instead of raw byte offsets * Add definitions for DSiSerialData and DSiHardwareInfoN * Move DSiFirmwareSystemSettings's hash update logic into its own method
* Assorted portability enhancements (#1800)Jesse Talavera-Greenberg2023-08-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Modest cleanups for DSi_NAND (#1714)Jesse Talavera-Greenberg2023-07-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add a definition for TMD files * Wrap TitleMetadata in a namespace * Add a comment * Remove TitleMetadataCertificate - melonDS ignores it anyway * Refactor the use of title metadata - Move bitwise operations on the title ID into helper methods - Use TitleMetadata objects instead of pointers to raw data * Slight cleanup in DSi_NAND - Replace some constants with sizeof - Use an NDSHeader object instead of a raw array of bytes * Add a DSi_NAND::ImportFile overload that loads a file from memory * Split most of ImportTitle into InitTitleFileStructure - It will be reused in the next commit * Add ability to import title from memory * Fix another potential issue * Fix broken DSiWare installation - The bytes of the title ID/category were being swapped in most places, but not all * Add some logging calls * Declare array sizes in DSi_TMD in decimal, not hex * Add a space after the #endif - To adhere to the style guide * Assert the size of TitleMetadataContent * Change the type of SignatureName * Don't mark the TMD structs as packed * Remove extraneous comments * Cut down some newlines
* properly make the DSi NAND instance-uniqueArisotura2022-09-23
|
* update copyright headersArisotura2022-01-09
|
* make firmware settings override also apply in DSi modeArisotura2021-11-20
|
* actually make DSi-mode direct boot work to some extentArisotura2021-08-30
|
* use NDSHeader struct, and expand it with the DSi shitArisotura2021-08-26
|
* having fun with fatfs (#1189)Arisotura2021-08-24
* patch TSC coords in DSi mode * DSiware importer and shit