Commit Graph

2298 Commits

Author SHA1 Message Date
RSDuck
7731f66e55 fix some UB 2023-08-01 03:00:41 +02:00
RSDuck
3efbf1b813 a bit of frontend refactoring 2023-07-29 21:27:28 +02:00
Arisotura
8fd46e5f8c wifi: attempt two at optimizing the sync mechanism. this time it should be far less prone to problems. 2023-07-28 10:14:33 +02:00
Arisotura
9c5cde8109 wifi: implement CMD retries 2023-07-27 21:54:30 +02:00
Arisotura
c3943b29ec wifi:
* rework and clean up frame transfer code
* disable melonAP during local multiplayer comm
2023-07-27 21:11:30 +02:00
Arisotura
b04c250e2f cancel CMD transfer if there isn't enough time left 2023-07-25 23:45:10 +02:00
Arisotura
a87dc83279 wifi: mystery ack value is CMD_COUNT 2023-07-25 20:50:07 +02:00
Arisotura
c7afa8d3f6 keep that one extra line in, tho
(remind me to rename these with the proper reg names)
2023-07-25 20:32:54 +02:00
Arisotura
193c7ed97b Revert "attempt at making local multiplayer faster"
This reverts commit 8772258fe7.
2023-07-25 20:32:01 +02:00
Nadia Holmquist Pedersen
75ae38ec7b codesign the final universal macOS app bundle
otherwise the code signature in it will be invalid, and macOS won't run
it witohout manually removing xattrs
2023-07-24 11:29:43 +02:00
Nadia Holmquist Pedersen
e6cc4b14b0 Work around a strange bug in Qt5 that causes melonDS to crash on launch
...but only with LTO enabled
...but only on some UNIX systems
...but only with some additional build options except when it breaks
   without any as well
2023-07-16 15:49:51 +02:00
PoroCYon
fbb41bd73d
DSi: add option to boot the full boot ROMs (#1581)
* DSi: add option to boot the full boot ROMs

added a config option for this so that this can be enabled or disabled

also added IO regs for DSi GPIO, but those don't do anything yet.

* reset GPIO regs on reset
2023-07-16 02:40:50 +02:00
Arisotura
cf7375f9ea Merge branch 'master' of github.com:Arisotura/melonDS 2023-07-15 01:16:46 +02:00
Arisotura
8772258fe7 attempt at making local multiplayer faster 2023-07-15 01:16:31 +02:00
TGP17
24a4cacaae
Add AppImage Builds (#1670)
* Create build-appimage.yml

* Update build-appimage.yml

This Adds the new Dependencies for MelonDS
2023-07-14 22:40:35 +02:00
Arisotura
4b7c2ba8c2 fix bad seqno bug with MP replies (oops) 2023-07-14 12:03:58 +02:00
Arisotura
a2033a62fd wifi: only allow setting TXSLOT_CMD bit15 if CMDCOUNT is nonzero, as per GBAtek 2023-07-14 11:39:58 +02:00
Nadia Holmquist Pedersen
f432e559d4 Add a fallback to streaming decompression when loading zstd-compressed ROMs.
Because of course some compression programs aren't nice enough to tell
you the decompressed size up front in the file, so the other approach
will fail. Things just can't ever be easy and straight forward, can they?
2023-07-14 03:05:34 +02:00
Nadia Holmquist Pedersen
ca5e8792c8 Don't try to open the mic device every time if SDL says it has none
Fixes the UI hanging up on Windows 11 when there are no mics, but the mic
input is set to external device as it is by default.
2023-07-14 02:32:09 +02:00
Jesse Talavera-Greenberg
0947e941b8
Modest cleanups for DSi_NAND (#1714)
* 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
2023-07-08 22:17:30 +02:00
Jesse Talavera-Greenberg
d1ff103259
Make linking librt conditional on it containing shm_open
Fixes building on UNIX platforms with no librt.

Co-authored-by: Nadia Holmquist Pedersen <nadia@nhp.sh>
2023-07-08 01:36:22 +02:00
Jesse Talavera-Greenberg
3c6359837d
Forgot an #include (#1712) 2023-06-30 14:28:53 +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
Nadia Holmquist Pedersen
7b948e6ec9 Assign Qt standard Quit keyboard shortcut 2023-06-29 19:12:07 +02:00
falsidge
52d6265b58
Add microphone combobox using SDL (#1709) 2023-06-27 21:31:41 +02:00
Nadia Holmquist Pedersen
4b32fb802c actually rename that setting 2023-06-24 16:34:23 +02:00
Nadia Holmquist Pedersen
74b166cba3 Add a description to the wifi settings dialog
Explains that the settings only affect online play, not local
multiplayer
2023-06-24 16:14:13 +02:00
Jesse Talavera-Greenberg
391ad8c95e
Implement in-memory savestates (#1693)
* 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
2023-06-12 23:56:09 +02:00
RSDuck
ca7fb4f55e disable DSi mode cartridge protection when DSi header is borked 2023-05-11 13:24:01 +02:00
RSDuck
758db2b986 disable screen filtering when drawing with QT
it can bring everything to a crawl and OpenGL display can be used as an alternative
2023-05-06 19:41:28 +02:00
Nadia Holmquist Pedersen
5f991d07a3 Fix tab ordering everywhere 2023-05-01 06:24:53 +02:00
Nadia Holmquist Pedersen
c6778bc6d5 Fix the layout of the video settings dialog a bit 2023-05-01 05:36:44 +02:00
RSDuck
787227b9ae add missing GPL header 2023-05-01 03:07:56 +02:00
RSDuck
e4586e53ad fix UB 2023-05-01 02:34:59 +02:00
RSDuck
81c284b7cf refactor frontend audio functionality 2023-05-01 02:30:26 +02:00
Nadia Holmquist Pedersen
38b0d21c22
Support loading Zstandard-compressed ROMs (#1667)
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.
2023-04-28 19:19:58 +02:00
RSDuck
4b170b94d5 pointless micro optimisations 2023-04-28 17:05:34 +02:00
Nadia Holmquist Pedersen
3ada5b9bc8 Add the missing extensions we support to the macOS app info
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.
2023-04-15 21:02:35 +02:00
RSDuck
e8967a937c fix JIT backjump detection
pretty embarrassing to loop variable mixup
2023-04-13 01:49:32 +02:00
RSDuck
a864f845e0 fix JIT profiling with VTune 2023-04-13 01:49:32 +02:00
Ed_IT
613280d3b4
DSi power button and volume switch support (#1630)
* Add proper BPTWL interrupts

* Added DSi power button and volume switch hotkeys

* Added hardware reset workaround

* Adjusted syntax to follow guidelines

* Added DSi output volume synchronization

* Fix trivial member function error
2023-04-04 12:31:58 +02:00
DarkOK
350292fb3c
Allow toggling Wayland support (#1654) 2023-04-03 16:02:50 +02:00
RSDuck
41b95b9c8f I'm stupid 2023-03-28 05:29:08 +02:00
RSDuck
5999fddccb comment out JIT debug code 2023-03-28 04:23:36 +02:00
Jesse Talavera-Greenberg
b078ca802f
Expose SRAM pointers for frontends that manage save data their own way (#1643)
* 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
2023-03-27 22:36:26 +02:00
Sergio
808292e424
Fixed unhandled error status for LastSep(std::string) (#1645) 2023-03-25 13:15:47 +01: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
Gloria
19280cff2d
BIOS/NAND UI changes (#1587)
* 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>
2023-03-20 16:56:14 +01:00
RSDuck
4ba7a2c5e6 tiny refactoring around the input config dialog 2023-03-02 14:41:46 +01:00
RSDuck
ca221381e9 gotta blow harder 2023-03-02 08:36:03 +01:00