* Split ROMList into a .cpp file
- Its definition in ROMList.h was causing multiple-definition linker errors
- Introduce ROMListSize, since you can't take a sizeof() of an extern declaration
- Mark ROMList and ROMListSize as const
* Update ReadROMParams to accommodate ROMList changes
* Split parsing and loading of NDS ROMs
- Introduce an NDSCartData class for parsing a ROM file
- Introduce InsertROM for loading a NDS cart
- Refactor LoadROM to use NDSCartData and InsertROM under the hood
* Reset cart state and initialize save memory in the NDSCartData constructor
- Otherwise there's no way to know about SRAM-specific attributes before inserting the game
* Add a comment to NDSCartData
* First crack at splitting parsing and loading for GBACart
* Add some logging calls for encrypting the secure area
* Log the XXH64 hash of the inserted NDS ROM
* Log the XXH64 hash of the secure area after decryption
* Add some logging to Key1_LoadKeyBuf
* Re-encrypt the secure area when inserting the cart, not when parsing it
- This way, constructing a NDSCart doesn't imply a read from the filesystem (as is done in Key1_KeyBuf)
* Load Key1_KeyBuf from memory, not from the file system
- Now that the cart's secure area isn't re-encrypted until insertion, we can expect that the BIOS will be ready at this point
* Add some helper query methods to NDSHeader
* Query the DSi region directly from the header instead of checking the ROM again
* Introduce a CartType enum
- So CartCommon::Type doesn't have to return magic numbers
* Reset the cart in NDSCart::InsertROM instead of the NDSCartData constructor
- That way the constructor doesn't rely on the config or on file I/O when loading homebrew
- This keeps the use of global state closer to one place
* Add non-const getters for the carts
* Add InsertROM overloads that accept unique_ptrs
* Fix a comment
* Rename member functions on NDSCartData and GBACartData to adhere to the convention
* Rename members on NDSCartData and GBACartData to adhere to the convention
* Fix build errors on some platforms
* Add NDSHeader::IsDSiWare
* Add a ROMListEntry parameter to the cart constructors
- To allow for looking up details of SRAM or expected ROM size
* Add some new getters to CartCommon
* Use the Header/Banner members instead of globals
* Make CartCommon abstract
- It's not supposed to be instantiated anyway
* Change the signature of CartCommon::Checksum
- It's neither overridden nor mutating
* Add some clarifying comments to NDSHeader
* Delete CartCommon::ROM in its destructor
- ParseROM copies its input and gives that copy to the cart object, so it's okay
* Add some getters to CartCommon
* Refactor NDSCart
- Get rid of NDSCartData
- Get rid of cart-specific global state within NDSCart (so registers are untouched)
- Refactor uses of removed global variables to use the Cart pointer instead
- Refactor ROMInfoDialog's icon functions to accept const arguments
* Return the cart pointer
- So *that's* why it was crashing. Whoops
- Why is this even allowed?
* Refactor GBACart
- Delete CartGame::ROM in the destructor
- Get rid of GBACartData
- Remove some global state
* Mark NDSCart::CartCommon::Type as const
* Slightly refactor GBACart::CartCommon
- Mark Type as const
- Use enum constants
- Make CartCommon itself abstract
* Mark CRC32's data parameter as const
* Mark GBACart::CartCommon::Checksum as const
* Use assert.h instead of cassert
- As demanded by the style guide
* Fix some includes to adhere to the style guide
* Get the ARM9 entry address directly from the header object
* Use more Header fields directly
* Rename some parameters to match the style guide
* Remove some unused includes
* Slightly change NDS_Header::IsHomebrew for clarity
* Refactor Savestate::Var{8,16,32,64}
- They now delegate to VarArray
- They're declared in the class header so they're likely to be inlined
* First crack at refactoring Savestate to work in-memory
- Well, third, but who's counting?
* Implement Savestate::Finish
* Remove the VersionMajor and VersionMinor fields
- Instead, pull their values directly from the savestate buffer
* Mark a new constructor as explicit
* Rename Reset to Rewind
* Fix a linebreak
* Implement Savestate::Rewind
* Add ROMManager::ClearBackupState
* Refactor ROMManager to use the refactored Savestate
* Capitalize "Least"
- It was driving me nuts
* Add a log call
* Increase default Savestate buffer length to 32MB
* Use C-style file I/O instead of C++-style
- Dumping bytes to a file with C++'s standard library is a MONSTROUS PAIN IN THE ASS
* Quote the savestate's file path for clarity
* Write the savestate's length into the header
* Add some extra logging calls
* Fix section-loading
* Remove the deprecated Savestate constructor
* Convert a char* to a u32 with memcpy, not a cast
* Fix section-handling in loads
* Include <cstring> in Savestate.h
- This was causing a build error on Linux
This is different from the archive support in that the compressed ROMs
are standalone files, rather than archives, making it possible to use
them exactly as if they were regular ROMs, while saving a bunch of space
on disk. This is supported both for DS and GBA ROMs, though given GBA
ROMs' generally small size it's mostly useful for the former.
macOS seems to require that we declare the extensions we want to
consider those files to be droppable on the window. Additionally this is
of course needed to show melonDS as a selectable option in the "Open
with" menu and such.
Setting LSHandlerRank to Alternate appears to stop it from suggesting
melonDS as a primary handler for a file type, so we set this for GBA
ROMs and archives as the user would most likely want them always to be
associated with a more relevant app.
* Add a clarifying comment
- In case it saves some poor bastard hours of fruitless work
* Expose GBA and NDS save memory
- Add GetSaveMemory and GetSaveMemoryLength functions
- Where unsupported, they return null and zero
* 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
* Remember the last folder for BIOS files
Add .mmc to the list of NAND filename extensions
* Add .sd file extension for SD images
* Fix UI code according to the review
---------
Co-authored-by: yeah-its-serena <32610623+yeah-its-serena@users.noreply.github.com>
* Rebase/recreate my changes and add MIME support
This commit recreates the changes proposed in #1394 on top of the
current master (b069a2acf1).
This also adds support for determining filetypes using the MIME database
provided by `QMimeDatabase`.
* Move member syntax warning to a more appropriate place
* Deduplicate member syntax warning
* Change warning from "vertical bars" to "|"
* Conform brace placement to coding style
* Fix QFileDialog filter when ArchiveExtensions is empty
* Final cleanup and fixes
- Changes the NDS and GBA ROM MIME-Type constants to QStrings.
- Removes a leftover warning message.
- Uses Type() syntax instead of Type{} syntax for temporaries.
* Explain the origin of the supported archive list
Co-authored-by: Jan Felix Langenbach <insert-penguin@protonmail.com>
* CMake in MSYS2 now depends on Ninja and uses it by default, use it
instead of Make as it has much easier to read output when doing
parallel builds and doesn't need an extra program
* Ninja uses the maximum number of cores by default, so we don't have to
run nproc --all
* We don't need mesa for its headers anymore
* Report correct Windows architecture for the build in the manifest
* Output processed .rc/.manifest in the CMake binary dir to prevent
potential issues with the files conflicting if cross compiling melonDS
on the same Windows machine
* Make the original file name actually make sense