* 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.
* 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>
* 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
This may not work, as I'm not sure why the code originally did as it
did. But this at least lets it compile, we'll need someone with a real
Windows ARM device to test this as I only have a VM with no GPU
acceleration.
* WIP: use Duckstation's context code to directly render into QT Widget from separate thread without two OpenGL contexts
currently only works on Windows
* reenable gay OSD
* add back vsync
* make it atleast a little more thread safe
* linux support
* don't segfault on closing
* reorganise and cleanup build system
it's still not good, but better than before
* macos?
* try to get it working on Ubuntu CI
also update instructions
* let's try this
* ok how about this
* try creating an OGL 4.3 context first
(https://i.kym-cdn.com/photos/images/original/001/264/842/220.png)
* fix Ubuntu
* hm
* try again for Windows
* let's try this
* make the OpenGL renderer work again
that was stupid
* do OGL surface resizing from the mainthread
* Fix small mistake in GL context creation on macOS causing version 3.2 to
be considered invalid
* C stupidness
* cleanup
* don't let the emuthread deinit OGL if there's no OGL
* reset lastScreenWidth/Height when deiniting OpenGL
* disable stencil test while drawing framebuffers
* macOS: Link Cocoa framework explicitly when not building with Qt6
Seems to be needed for the classes used by DuckStation's GL context
code.
* Set ScreenPanelGL's minimum size immediately
Fixes GL context creation for OpenGL display on macOS using the wrong
size as the underlying window was not resized to the correct size by Qt
yet.
* don't emit window updates when OGL display is used
* stuff Arisotura said
Co-authored-by: Nadia Holmquist Pedersen <nadia@nhp.sh>
* attempt at betterer wifi
* add preliminary sync mechanism
* fix gaps in wifi implementation
* move local-MP comm to its own module instead of cramping Platform.cpp
* remove some stupid cruft
* as you wish, Sorer
(starting work on shared-memory system)
* shared-memory IPC that actually works (albeit Windows-only for now)
* shut up logging from NULL writes on ARM7 (ffs Nintendo learn to code)
* get this somewhat good
* leave client sync mode when host deauths. makes download play actually work.
* start implementing MP-comm error handling
* * add MP-reply error counters
* feeble attempt at fixing slowdown/desync/etc problems
* somewhat better exchange/sync method
* * when entering power-saving mode, be sure to finish transferring the current frame first
* fix misc bug due to old cruft leftover
makes for a more stable connection
* remove a bunch of cruft
* set wifi time interval to 34 cycles instead of 33. games seem sensitive to the general timing of wifi vs the rest of the system, and this seems to make things run better, atleast until I rewrite this to use a proper scheduler.
* more graceful handling of disconnects
* deal with FIFO overflow more gracefully
* BAHAHAHAHAHAHAHAHHHH
THE SNEAKY BASTARDS
so, when the DS receives a beacon with the right BSSID
that beacon's timestamp is copied to USCOUNTER
* attempt at making the connection process smoother for weird games
* * begin adding POWCNT2, only applies to wifi for now
* begin work on wifi scheduler
* implement the shitty timers
* add the RF wakeup thing
* begin work on receiving frames. for now it can just receive melonAP beacons, but hey, it's a start.
* add enough TX functionality that online wifi is a possibility again.
* there are problems with this scheduler thing. committing it anyway
* kind of a rollback... we're gonna work out a compromise on this, I guess
* don't transmit shit if RXCNT.bit15 isn't set
* move RX-finish to its own function. more accurate filtering. implement RXFILTER.
* remove some cruft
* fix some of the shittiness when trying to connect more than two players
* fix some more shittiness
* fix more wifi shittiness (mainly don't try to receive shit while sending a frame)
* run wifi every 8µs. improves performance.
* fix IRQ14/IRQ15
* make this work under Linux
* Make it work on macOS, for now using a custom sem_timedwait
implementation.
If anyone knows anything about mach ports and have an idea for how to
make this work using mach IPC, please do let me know.
* 25ms seems like a good timeout
* begin work on proper multiplayer UI shito.
for now, determine a global instance ID, and derivate the system MAC from it. remove 'randomize MAC' option.
* finish removing RandomizeMAC
* lay groundwork for instance-unique config
* work some on the UI... make it not labelled Fart
* more UI work: make it explicit that some things are instance-unique
* separate firmware files for multiplayer instances
* make instances save to different save files, too
* more UI work, make things somewhat less shitty
* lay base for the multiplayer settings dialog
* actually hook up most of that dialog
* actually implement the fun audio settings
* ensure all the wifi shit is properly savestated and reset. properly update timings for the wifi region when wifi is disabled.
* add more fun labels
* * ignore WEP frames if WEP is off
* implement RX_LEN_CROP
* fake enough of WEP processing to make Inazuma Eleven work
* * do not copy more ROM banner data than actually needed
* avoid trying to read out of bounds if the banner offset is bad
* Fix oversight with the preferences action causing the build to fail on macOS
Co-authored-by: Nadia Holmquist Pedersen <nadia@nhp.sh>
Title strings should be null-terminated.
Read the string up until this point instead of reading the full 128 characters.
(Also fix the .ui file of ROMInfoDialog to prevent it from being too wide.)
These changes modernize the CMake build system to (hopefully) match newer best practices
* Library linking is simpler and more automatic because of using imported targets
* Multi-configuration builds should be supported (Ninja Multi-Config, Visual Studio, etc. generators)
* Clean up build options using cmake_dependent_option
* Let CMake do its job in more cases, like finding the math/dl libraries and detecting and enabling LTO support
* Remove platform-specific kludges like the Fedora/flatpak LTO workaround and a bunch of Windows stuff
* Simplify Windows static builds
* Consistent formatting
The DS battery level is configured via the SPI Power Management Device,
and the DSi's is configured via the I2C BPTWL. Add support for changing
these registers and add the "Power Management" dialog in the UI.
* Implement MainRAM management dialog
* Modify RAMInfoDialog
- use emuThread to avoid a race condition.
- replace RAMUpdateThread to QTimer
Co-Authored-By: RSDuck <RSDuck@users.noreply.github.com>
* Update src/frontend/qt_sdl/RAMInfoDialog.cpp
small typo
Co-authored-by: Rayyan Ansari <68647953+RayyanAnsari@users.noreply.github.com>
* Update src/frontend/qt_sdl/RAMInfoDialog.h
small typo
Co-authored-by: Rayyan Ansari <68647953+RayyanAnsari@users.noreply.github.com>
* typo errors in RAMInfoDialog
Rrevious->Previous
* add new line to the end of the file
Co-authored-by: Rayyan Ansari <rayyan@ansari.sh>
* enable raminfo when cart is inserted
* Modify that only the 'value' item can be edited in RAMinfoDialog
* fix: function name incorrect error
* fix: function name incorrect error2
* fix: wrong way to get ram value
Co-authored-by: RSDuck <RSDuck@users.noreply.github.com>
Co-authored-by: Rayyan Ansari <68647953+RayyanAnsari@users.noreply.github.com>
Co-authored-by: Rayyan Ansari <rayyan@ansari.sh>
On GNOME, the Group Box's titles don't align with the text in the buttons.
This commit removes the Group Box titles and instead uses Labels to fix this.
also including:
* getting rid of shitty strings
* all new, cleaner ROM handling code
* base for DSi savestates
* GBA slot addons (for now, memory cart)
Qt's default window positioning is somewhat unreliable, and since we
don't currently remember the window position, let's at least make sure
that it's properly centered on open.
Treating the fail of SDL_INIT_JOYSTICK as non-critical, because on some systems that SDL feature can for some reason fail. This leads to the emulator closing with a critical error, even though it would work perfectly fine with just a keyboard.
* non-defined CPU modes are actually possible
* bit4 of all PSRs is forced to one (modes 00-0F aren't possible)
* modes 14/15/16 and 18/19/1A share a SPSR with modes 17 and 1B respectively (but they don't share the register banks)
* modes 10 and 1C/1D/1E don't have a SPSR (MRS returns the CPSR always)
* Generate a simple non-bootable firmware when not provided.
* Expose Username and Language into settings dialog.
* Add firmware overrides for more settings. Also make override optionals when a firmware is provided.
* Refactor firmware settings into separate dialog.
* use usernameLength instead of u16Username.length() (#3)
* Fix curly braces code-style.
* LoadUserSettingsFromConfig: convert from UTF-8 to UTF-16 via wstring_convert
* Fix firmware username capitalization.
* cleanup firmware backup logic
* Put brace where it should be
Co-authored-by: Rayyan Ansari <68647953+RayyanAnsari@users.noreply.github.com>
Co-authored-by: Filippo Scognamiglio <flscogna@gmail.com>
Co-authored-by: kyandora <71771686+kyandora@users.noreply.github.com>
Co-authored-by: Filippo Scognamiglio <filippo.scognamiglio@felgo.com>
Co-authored-by: RSDuck <RSDuck@users.noreply.github.com>
Co-authored-by: Rayyan Ansari <68647953+RayyanAnsari@users.noreply.github.com>