Commit Graph

1892 Commits

Author SHA1 Message Date
Jesse Talavera 31a7f53282
Fix a crash when using DSi mode in debug builds on macOS (#1976)
Store the BIOS images in `NDSArgs`/`DSiArgs` through pointers, not directly

- This will make it easier to keep such objects on the stack
2024-03-13 14:55:20 +01:00
RSDuck ea1755bed0 call Start again NDS object after Reset
fixes issue where game doesn't properly start after changing settings
2024-03-12 09:23:20 +01:00
RSDuck 5fdd285c9a fix aarch64 build 2024-03-12 08:41:42 +01:00
RSDuck 18d1df606f fix #1959
Use QT again for opening file so that we don't depend on locale
2024-03-12 08:35:56 +01:00
Nadia Holmquist Pedersen b117bb8f58 that should be 0x8000 2024-03-08 16:59:31 +01:00
Nadia Holmquist Pedersen faf3c0f2e0 Add Gaussian (SNES) audio interpolation
Probably not a good choice for most DS games unless you really want a
very soft sound, but it could be fun if you wanted to run lolSnes in
melonDS :p
2024-03-08 16:36:00 +01:00
Nadia Holmquist Pedersen e227902cec Util_Audio: use basic linear interpolation
Should remove the artifacts caused by the previous nearest
resampling. May be worth replacing with something better in the
future, but this is an improvement for now.
2024-03-03 16:58:59 +01:00
Nadia Holmquist Pedersen 67ca4997e2 Release all keyboard keys on focus loss (fixes #1987) 2024-02-25 14:25:50 +01:00
Nadia Holmquist Pedersen 21e2a876ec build teakra's test_generator.cpp only if building its unit tests is
enabled

speeds up builds a bit
2024-02-24 01:47:04 +01:00
λP.(P izzy) 9430502b16
fix malloc on OpenBSD targets (#1979) 2024-02-20 03:33:39 +01:00
Jaklyy a8429af131
dont make a save file on launching a game (#1974)
avoids the issue of saves being created for roms that dont use save files.
2024-02-13 20:17:29 +01:00
Luca D'Amico 646ed3cb32
Add Haiku (BeOS-like OS) support (#1858) 2024-02-07 23:15:30 +01:00
Jaklyy 5ffa642980
Check for write permissions for some key files (#1972)
* check if an nds save file can be opened for writing

also add the ability to open a file in append mode

* fix multi-instance saves

also move the check for file writability into a separate function (probably uneeded?)

* implement check for gba roms

* move rom load error messages into the functions

also finish gba slot (oops)

* improve error string

* check write perms before saving path settings

* fix memory leak

* check for writability of firmware/nand/sds

* add secondary checks for nand/firmware

* add check for config file being writable

* Return the file write error as a QString to avoid the invalid char*
causing a garbled error message.

Qt wants it as QString either way.
2024-02-07 23:04:36 +01:00
Nadia Holmquist Pedersen a7575ec7b3 Allow the user to choose the UI theme
Mainly useful for those who want dark mode on Windows.
2024-02-07 20:20:54 +01:00
Jesse Talavera d48e5f2da0
Fix DSiWare detection (#1969)
- According to GBATek, all DSiWare games have a high title ID of 0x00030004
- Some homebrew apps set the Unitcode bits to DSi mode to enable support of DSi features
2024-02-01 14:36:35 +01:00
Nadia Holmquist Pedersen 7dd4152d67 Add MaxFPS setting 2024-01-26 13:06:32 +01:00
Steveice10 4b576d066e
Add support for using a portable directory without special build flags. (#1956) 2024-01-24 10:27:25 +01:00
Arisotura 7897bd387b also add writes while we're at it, we know Gericom's gonna abuse them someday :P 2024-01-17 18:54:48 +01:00
Arisotura f4c8202b1a add missing 8/16-bit reads to ROMCnt and ROM SPICnt 2024-01-17 18:50:08 +01:00
Jesse Talavera 740305cc25
Don't reset the VRAM cache if saving a state (#1944)
- This fixes a flickering bug in melonDS DS
2024-01-08 15:20:48 +01:00
Jesse Talavera 8143f54956
Protect savestates while the threaded software renderer is running (#1864)
* First crack at ensuring the render thread doesn't touch GPU state while it's being serialized

* Get rid of the semaphore wait

* Add some extra fields into GPU3D's serialization

* Oops, TempVertexBuffer is already serialized

* Move vertex serialization into its own method

* Lock the GPU3D state when rendering on the render thread or serializing it

* Revert "Lock the GPU3D state when rendering on the render thread or serializing it"

This reverts commit 2f49a551c1.

* Add comments that describe the synchronization within GPU3D_Soft

- I need to understand it before I can solve my actual problem
- Now I do

* Revert "Revert "Lock the GPU3D state when rendering on the render thread or serializing it""

This reverts commit 1977566a6d.

* Let's try locking the GPU3D state throughout NDS::RunFrame

- Just to see what happens

* Slim down the lock's scope

* Narrow the lock's scope some more

* Remove the lock entirely

* Try protecting the GPU3D state with just a mutex

- I'll clean this up once I know it works

* Remove a duplicate method definition

* Add a missing `noexcept` specifier

* Remove an unused function

* Cut some non-hardware state from `GPU3D`'s savestate

* Assume that the next frame after loading a savestate won't be identical

* Actually, it _is_ worth it

* Don't serialize the clip matrix

- It's recalculated anyway

* Serialize `RenderPolygonRAM` as an array of indexes

* Clean up some comments

- I liked the dialogue style, but oh well

* Try restarting the render thread instead of using the lock

- Let's see what happens

* Put the lock back

* Fix some polygon and vertex indexes being saved incorrectly

- Taking the difference between two pointers results in the number of elements, not the number of bytes

* Remove `SoftRenderer::StateBusy` since it turns out we don't need it

- The real synchronization was the friends we made along the way
2024-01-07 23:39:43 +01:00
Eric Warmenhoven f68f55d002
Reset the JIT when loading savestate (#1937)
The effect of this change is simply to call JitEnableWrite(), which is
necessary on apple silicon
2024-01-03 14:42:08 +01:00
Jesse Talavera d1cbc41115
Slight fixups with `FATStorage` (#1934)
* Reload the SD card for `CartSD` and all subclasses

* Make `ROMManager::LoadDLDISDCard` delegate to `GetDLDISDCardArgs`

* Add a method overload for `CartSD::SetSDCard`

* Initialize new SD card images with the correct size

* Sync the old card to the host (if applicable) when move-assigning a new one

* Only sync the old card to the host if it's not read-only

* Remove static state in `FATStorage`

- Replace `FF_ReadStorage` and `FF_WriteStorage` with lambda functions
- Keep open and use the single `File` handle throughout the `FATStorage`'s life
2024-01-03 13:32:17 +01:00
Nadia Holmquist Pedersen 8bfc6df8de TitleManagerDialog: Fix wrong color format 2023-12-31 13:52:58 +01:00
Jesse Talavera a4b2b0c40d
Resolve or silence some warnings (#1905)
* Resolve some warnings

- Their frequent appearance in the build logs is driving me nuts

* Silence warnings about `offsetof`

* Don't apply `-Wno-invalid-offset` to C, only to C++
2023-12-28 14:54:31 +01:00
Arisotura 345b7439e4 integrate OSD into ScreenPanel and make it nicer 2023-12-28 14:40:37 +01:00
Arisotura 5a08118c87 sfjsh 2023-12-27 21:28:03 +01:00
Jesse Talavera cbd65a131e
Add `alignas` specifiers to some arrays based on how they're accessed (#1933)
* Align some two-element `u32` arrays as `u64`s

- To pacify "unaligned read/write" warnings from UBSan

* Align some more arrays based on how they're accessed
2023-12-26 22:09:39 +01:00
Arisotura ab8938a695 fix OSD scaling on hiDPI screens 2023-12-26 19:32:38 +01:00
Arisotura f905b6fb93 separate EmuThread to its own file 2023-12-26 19:24:14 +01:00
Arisotura fd1e4379b9 Merge branch 'master' of github.com:melonDS-emu/melonDS 2023-12-26 19:04:31 +01:00
Arisotura 7f437d48db start cleaning up: move OpenGL stuff out of EmuThread 2023-12-26 19:04:01 +01:00
Jesse Talavera d55a384c88
Apply some quick hotfixes (#1931) 2023-12-26 16:34:04 +01:00
Nadia Holmquist Pedersen 740489f7a4 Don't call Reset on nullptr 2023-12-26 08:49:02 +01:00
Nadia Holmquist Pedersen ac3153d86b "Incorrectly" link libslirp to stop its broken build system fucking up
our linker flags
2023-12-26 08:14:30 +01:00
Nadia Holmquist Pedersen f16de402cf Screen.cpp: include missing headers 2023-12-26 04:26:38 +01:00
Arisotura 5c90cb939d oops 2023-12-25 22:52:44 +01:00
Arisotura 80c6dd524b add convenience method to Window class for OSD messages 2023-12-25 16:34:29 +01:00
Arisotura 6a1232b9a9 move MainWindow and Screen stuff to separate files; WIP 2023-12-24 15:11:30 +01:00
Samuel Magnan f580d20a7b
Support GBA .sav file with appended .rtc (#1927)
* Support GBA .sav file with appended .rtc

* Change comment
2023-12-24 01:09:43 +01:00
Arisotura de4ae9dd92 fix possible crash 2023-12-23 23:59:59 +01:00
RSDuck 989b93c92a do not access NDS object emulation is paused 2023-12-22 23:30:59 +01:00
Nadia Holmquist Pedersen 521fc249a3 Don't try to call transferLayout on non-GL ScreenPanel 2023-12-22 02:17:26 +01:00
Nadia Holmquist Pedersen 752b37ed82 Attempt to get rid of leftover QSharedMemory instance after crash 2023-12-22 01:35:45 +01:00
RSDuck 084747abc5 Reset DS object directly after creation 2023-12-21 22:15:12 +01:00
RSDuck ed650f2b46 call Reset on 3D renderer object 2023-12-21 21:43:57 +01:00
Nadia Holmquist Pedersen fd3c349735 Check Q_OS_UNIX define instead 2023-12-20 21:38:55 +01:00
Daniel Simon 6c6318b63b Fix generic icon when using Wayland 2023-12-20 21:38:55 +01:00
Jesse Talavera 01f8ad009e
Wrap the `EnableJIT` initialization in an `#ifdef` (#1922) 2023-12-20 14:25:49 +01:00
Jesse Talavera 4b4239de62
Set `NDS::EnableJIT` in the constructor (#1921) 2023-12-19 15:15:35 +01:00