Commit Graph

22 Commits

Author SHA1 Message Date
Jesse Talavera-Greenberg 346dd4006e
Move all core types into namespaces (#1886)
* 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
2023-11-25 18:32:09 +01:00
Arisotura ac38faef14 update copyright years 2023-11-04 00:21:46 +01:00
jdp_ 2a3a071216
Reduce code stink (#1818)
CRC32.cpp:
Make table initialization compile time

DSi_NAND.cpp:
Fix file close / unmount / disk close on error
~L427: Remove redundant calls, as they are immediately rendered useless by `rem` being overwritten

NDS.cpp / FreeBIOS.h:
Remove unneeded size values in header
Remove unneeded memset's as they are initialized anyway

sha1.c / sha1.h:
Fix useless warning

Wifi.cpp:
Remove unneeded includes

DSi.cpp:
Reduce ugly casts
Deduplicate code

qt_sdl/main.cpp:
silence clang switch statement warning

qt_sdl/main.h:
fix override warnings

dolphin/BitSet.h:
use msvc extensions only when appropriate, fix broken bit set count under _WIN32
2023-08-28 20:01:15 +02:00
Jesse Talavera-Greenberg b659bce3c1
Split the cart parsing and loading steps (#1707)
* 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
2023-06-30 13:28:52 +02:00
mariomadproductions 88c1371a96
Added LEGO Batman 2 - DC Super Heroes (Canada) (En,Fr) [B6FL] to ROMList (#1422) 2022-11-11 23:08:55 +01:00
Valtýr Kári Daníelsson 98903f8076 fixes editor warnings about undefined types in a bunch of files 2022-07-27 18:55:59 +02:00
Arisotura 35cc79787d update copyright headers 2022-01-09 02:15:50 +01:00
Arisotura f219318292 Over the Hedge uses a tiny EEPROM, too.
fixes #899
2021-05-01 12:12:28 +02:00
Arisotura 18b1f79b44 Spider-Man 3 uses a tiny EEPROM, not a regular one 2021-04-30 22:59:50 +02:00
Arisotura 25ab02c650 fix another bad entry 2021-04-30 21:06:03 +02:00
Arisotura 414c608678 add ROMlist entry for Power Rangers Go-Busters (Korea) 2021-04-30 20:40:57 +02:00
Arisotura 5e648a8db3 fill most gaps in ROM list 2021-04-30 03:01:52 +02:00
Arisotura 8a5078abe3 support savemem for Face Training (NAND, atleast 32MB, likely 64MB) 2021-04-30 01:13:35 +02:00
Arisotura 1afb8bfa46 that game is actually a tiny EEPROM 2021-04-26 15:30:00 +02:00
Arisotura 7ab19f157d add ROM entry for Clueless Fashion (#1050) 2021-04-26 13:23:29 +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
RSDuck 7d448d911d use C++ style structs everywhere 2021-01-02 11:38:06 +01:00
RSDuck d6b0ff1eda fix last commit, account for little endian 2020-12-24 12:34:40 +01:00
RSDuck 0e304441e4 add eCDP to romlist
closes #885
2020-12-24 12:22:38 +01:00
Arisotura c106bec1a0 correct save type for Jelly Belly - Ballistic Beans (USA)
fixes #852
2020-12-14 11:34:40 +01:00
Arisotura c45068da0e embed romlist.bin 2020-05-30 00:28:21 +02:00