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>
* make timers usable for measurement shito without being assfuckingly unreliable
* bürp
* Arisotura can you ever clean up your goddamn code
also regroup the timer code instead of having it split weirdly
* make the set-timing functions a tad less hacky
* congrats Arisotura you made an ass-enum
* add timing region tables, and separate timings for ARM9 DMA (exempt of 3c penalty)
* temp work on DMA timings, not finished
also, did you know? 'increment/reload' is also a thing for the source address
* begin work
* add some of the GBA slot/wifi timings
* complete it, I guess
* make some progress
* getting somewhere
* sdsdfs
* see, Arisotura, was it that hard? blarg.
* Fix for https://github.com/Arisotura/melonDS/issues/1169
LoadNAND was storing the stage 2 bootloader, while NWRAM access was disabled by Bit25 of SCFG_EXT putting the stage 2 into old shared WRAM, while executing it later with the bit enabled and fetching from an empty NWRAM.
* Fixed bug, where access to the NWRAM Bank A used the wrong page mask for write access
* Remove spaces before comma
Co-authored-by: Tim Seidel <t.seidel@kts-systeme.de>
Co-authored-by: RSDuck <RSDuck@users.noreply.github.com>
* SCFG_BIOS now selects between NDS and DSi BIOS
Allowing experimental direct boot.
* - making NWRAM Priorities work as in the HW
- fixed loading DSi stage2 Bootloader when in direct boot (should not be loaded) and might interfere with the image loaded into the (N)WRAM previously
* NWRAM and SCFG Registers are now write-guarded by the corresponding SCFG_EXT7/9 Bits
* removed debugging remainder
* Moved NDSHeader dependent SCFG initialization into the new DSi::SetupDirectBoot function called from NDS::SetupDirectBoot when ConsoleType is DSi
* removed redundant SCFG_BIOS bit checks
* Set of changes from RSDuck's review
* removed a forgotten comment
* - removed the guarded debug outputs for NWRAM
- NWRAM writes to bank and window registers now apply their write masks.
- added comment on an existing TODO within the code describing, why this is OK
- fixed initial NWRAM bank reset just accessing set A
* NWRAM not mapped to 03... range if bit25 in SCFG_EXT is cleared
* removed NWRAM write block on cleared bit25 in SCFG_EXT
* changed type of iterator for MapNWRAM_x functions from s8 to int
* - reduced calculations/comparisons on NWRAM write operations
- changed u8 to unsigned int for an iterator MapNWRAM_x
Co-authored-by: Tim Seidel <t.seidel@kts-systeme.de>
* - added fallback to DSi footer copy at 000FF800h if reading footer at end of file failed. See https://problemkaputt.de/gbatek.htm#dsisdmmcimages
- changed output of ConsoleID to use PRIx64 to be consistent with all other tools working with the consoleID (readability/cosmetic improvement)
* Remove extra space
Co-authored-by: Tim Seidel <t.seidel@kts-systeme.de>
Co-authored-by: RSDuck <RSDuck@users.noreply.github.com>
* Add PoroCYon's DSP code.
* Remove some teakra iles that we dont need.
* make some requested changes.
* move DataMemoryOffset into namespace.
* use deault param.
* ad the switch change
* <Generic> forget about the default parameter
* Implement NO$GBA debug registers.
NO$GBA comes with 4 debug registers that allow a ROM to print text to
the emulator terminal and 2 other status registers, one with the name of the
emulator and the other with the clock cycles count. This commit
implements them for the ARMv5 processor.
Some small things to note:
- `NocashPrint` was changed and now it takes an address to _the string_ instead of the flags before it (those
don't do anything anyways).
- The "Emulation ID" register contains the string "melonDS " followed by version, _not_ "NO$GBA"
* Fix styling issue and improve comment regarding NO$GBA message flags
Turns out my system was affected by a bug with modifier remapping in
macOS causing some of my left/right modifiers to be swapped. This commit
fixes them to be the correct values.
* Improve macOS bundling
* Bundle libs for macOS CI
* Add MACOS_BUILD_DMG CMake option and make the CI upload the DMG so we don't lose executable permissions.
* Manually copy plugins if macdeployqt doesn't
* Ad-hoc codesign the app
* Allow SRAMManager to save to/load from a buffer.
* Don't delete what doesn't exist. Don't create a thread that will do absolutely nothing.
* Update SRAMManager's SecondaryBuffer when loading a savestate.
* Fixed division edge case: Div64/32 and Div64/64 set the remainder to 0 if dividend == INT64_MIN && divisor == -1
* Fixed CPU edge case where ARM9 ALU ops would switch to Thumb even when they shouldn't
* Only clear the lowest bit of the jump address in ALU ops with rd==15 (on recommendation of RSDuck)
* Draft GPU3D renderer modularization
* Update sources C++ standard to C++17
The top-level `CMakeLists.txt` is already using the C++17 standard.
* Move GLCompositor into class type
Some other misc fixes to push towards better modularity
* Make renderer-implementation types move-only
These types are going to be holding onto handles
of GPU-side resources and shouldn't ever be copied around.
* Fix OSX: Remove 'register' storage class specifier
`register` has been removed in C++17...
But this keyword hasn't done anything in years anyways.
OSX builds consider this "warning" an error and it
stops the whole build.
* Add RestartFrame to Renderer3D interface
* Move Accelerated property to Renderer3D interface
There are points in the code base where we do:
`renderer != 0` to know if we are feeding
an openGL renderer. Rather than that we can instead just have this be
a property of the renderer itself.
With this pattern a renderer can just say how it wants its data to come
in rather than have everyone know that they're talking to an OpenGL
renderer.
* Remove Accelerated flag from GPU
* Move 2D_Soft interface in separate header
Also make the current 2D engine an "owned" unique_ptr.
* Update alignment attribute to standard alignas
Uses standardized `alignas` rather than compiler-specific
attributes.
https://en.cppreference.com/w/cpp/language/alignas
* Fix Clang: alignas specifier
Alignment must be specified before the array to align the entire array.
https://en.cppreference.com/w/cpp/language/alignas
* Converted Renderer3D Accelerated to variable
This flag is checked a lot during scanline rasterization. So rather
than having an expensive vtable-lookup call during mainline rendering
code, it is now a public constant bool type that is written to only once
during Renderer3D initialization.
* Use libepoxy to load in OpenGL functions
Prevents having to load them in manually
* Install libepoxy in the CI
* Do not link OpenGL libraries, libepoxy opens them itself
* Add libepoxy to build instructions
* Add FreeBSD support
* Fix indentation
* Fix Linux not finding OpenGL
* Link POSIX Realtime Extensions library
* Link POSIX Realtime Extensions when OpenGL is enabled too
* Fail if shm_open memory exists and also check for errors
* fix the last commit
* (try to) Setup FreeBSD CI
* Fix some issues with FreeBSD CI
* Make with all cores
* Remove FreeBSD CI
It doesn't want to work for some reason
* Fix directory path when extracting from archive
* Don't create new dir in execution dir of melonds
* Create it beside the archive instead
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* ArchiveUtil : Use QT functions for I/O
* Make it more platform independent, cleaner
* Fixes permission related crash on linux
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* NDSCart : Abstract out common code in LoadROM()
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* Extract nds roms to memory
* Some stuff is still broken in the frontend
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* GBACart : Abstract out common code in LoadROM()
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* Extract gba roms to memory
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* Integrate archive support with recent files
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* onClickRecentFile : Pause emu thread conditionally
* Don't pause at start of the function
* If user opens an archive and hits cancel, it won't pause
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* Handle Resets when loading from archives
* Ask user to pick the rom(s) again (i.e. GBA & NDS)
when there are multiple files in the archive(s)
* Directly load if only 1 file
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* Archive support for drag-n-drop
* Also recent files support for drag-n-drop
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* main : Allocate rombuffer objects on stack
* Less messy, decreases chances of memory leaks
* Underlying implementation of qbytearray uses heap (hopefully?)
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* GetSavestateName : Archive support
* Construct ssname from srampath (since rompath has archive name)
NOTE: In general, archive name != rom file name !!!!!!!!!!
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* Add srl and dsi as "direct-load" formats
* Direct-load = anything not in an archive
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* Don't use static functions
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* Remove QT stuff from Util_ROM
* Also, during reset, directly load file from archive (no rom picker)
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* Remove QT includes from FrontendUtil.h
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* Util_ROM/LoadROM() : Use SetupDSiNAND()
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* Util_ROM/Reset() : Use strrchr()
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* Util_ROM : Put Archive stuff behind ifdefs
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* main: Set parent widget for archive dialog boxes
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* Revert "Util_ROM/Reset() : Use strrchr()"
This reverts commit c8af6f066f.
* Implement "lag frame" flag and counter, and expose flag and both frame counters. BizHawk wants these.
* Track frame count and lag frames while the system isn't running.
* Offload NDS SRAM writing to separate thread, debounce writes to two seconds after last flush or DeInit.
* Fixed printf messages.
* Fixes after CR.
* Fixed potential portability issue with time_t
* Set menubar height to 0 in fullscreen
* Avoid using hide() on the mainwindow's menubar as it breaks menubar
actions.
* Fixes save/load state shortcuts not working in fullscreen (#922)
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
* Don't modify menubar width when exiting fullscreen
* Fixes weird looking menubar on Windows
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
Squashed commit of the following:
commit b463a05d4b909372f0cd1ad91caa0c77a25e5901
Author: RSDuck <rsduck@users.noreply.github.com>
Date: Mon Nov 30 01:55:35 2020 +0100
minor fix
commit ce73cebbdf5da243d7ebade82d8799ded9cd6b28
Author: RSDuck <rsduck@users.noreply.github.com>
Date: Mon Nov 30 00:43:08 2020 +0100
fix dirty flags of BG/OBJ mappings not being reset
commit fc5d73a6178e3adc444398bdd23de8314b5ca8f8
Author: RSDuck <rsduck@users.noreply.github.com>
Date: Mon Nov 30 00:11:13 2020 +0100
use flat vram for gpu2d everywhere
commit 34ee9fe2bf04fcfa2a5a1c8d78d70007e606f1a2
Author: RSDuck <rsduck@users.noreply.github.com>
Date: Sat Nov 28 19:10:34 2020 +0100
mark VRAM dirty for display capture
commit e8778fa2f429c6df0eece19d6a5ee83ae23a0cf4
Author: RSDuck <rsduck@users.noreply.github.com>
Date: Sat Nov 28 18:59:31 2020 +0100
use flat VRAM for textures and texpals
also skip rendering if nothing changed and a bunch of fixes
commit 53f2041e2e1a28b35702a2ed51de885c36689f71
Author: RSDuck <rsduck@users.noreply.github.com>
Date: Fri Nov 27 18:29:56 2020 +0100
use vram dirty tracking for extpals
also preparations to take this further
commit 4cdfa329e95aed26d3b21319c8fd86a04abf20f7
Author: RSDuck <rsduck@users.noreply.github.com>
Date: Mon Nov 16 23:32:22 2020 +0100
VRAM dirty tracking
* Use ashmem instead of memfd_create on Android.
* Fix code styling issues.
* fix small mistake in merge commit
Co-authored-by: RSDuck <RSDuck@users.noreply.github.com>
* use shm_open() instead of memfd_create() on macOS
malloc.h isn't a header on macOS
* Change OpenGL headers + create ifdef for DO_PROCLIST
macOS seems to already have the OpenGL functions defined, without the ifdef, it gives "ambiguous references" errors.
* macOS doesn't have ->gregs in uc_mcontext
and it doesn't have REG_RIP either
https://github.com/gperftools/gperftools/blob/master/m4/pc_from_ucontext.m4
* use getpid() to make memory file name unique
* #ifndef __APPLE__ for AF_PACKET and linux/if_packet.h
* Add include and link directories for macOS and link the OpenGL framework
* Add macOS CI
* Use newly added libslirp package from Homebrew
https://github.com/Homebrew/homebrew-core/pull/63412
* Use Apple's Clang instead of GNU GCC on macOS
* Add macOS build instructions to README
* Try to fix macOS undefined symbol
* snprintf doesn't take null terminator into account
* Map new memory on macOS for JIT
* Only use gcc-ar if using GNU Compiler
* re-add fastmem code - whoops!
* Fix style issue - use camelCase not snake_case
* Set Minimum macOS version
* Switch Minimum OS X version to 10.9
* Add macOS libpcap library name
* fix memory leak
* Fix binding keys in macOS
* Allow getting MAC address on macOS
melonDS on Linux uses AF_PACKET, which doesn't exist on macOS. Instead, this commit uses AF_LINK on macOS to get the MAC address.
* Remove unneeded macOS CI dependencies
* Build melonDS app bundle on macOS
Now it is no longer required to install the libraries on macOS, they come with the app bundle.
* fix macOS CI not being able to find macdeployqt
* copy melonDS.app with recursive because it's a folder
* Disable fastmem checkbox on macOS
* Disable fastmem by default in config
* forgot a semicolon
* Don't bundle libraries, causes issues on macOS <10.15
* Update README + allow finding version in Finder on macOS
* Make sure fastmem checkbox stays uncheckable
- fix fastmem problems on linux
- small fix memory leak
- SlowWrite functions always take in a 32-bit variable so that the C compiler knows that the values aren't necessary zero extended
- a few other stylistic things
- handle SIGBUS as well (for macos)
Typically, modifiers are masked out of keypresses to distinguish
between hotkeys and keypresses. This patch prevents the numpad
modifier from getting masked out in KeyPress() and KeyRelease().
Signed-off-by: Madhav Kanbur <abcdjdj@gmail.com>
- savestates used to read a four bytes from a single byte value
- a few unassigned variables
- some other things
- also make the ROR macro an inline function