Commit Graph

2014 Commits

Author SHA1 Message Date
Nadia Holmquist Pedersen 53c58bd777 fix potential issue with glib shim min/max defines 2024-08-07 17:49:29 +02:00
Nadia Holmquist Pedersen 4359bccfcb fix the slirp shit some more 2024-08-07 17:45:56 +02:00
Nadia Holmquist Pedersen b47563e888 Apply FixInterfaceIncludes to the slirp package again to work around
package inconsistencies
2024-08-07 17:28:25 +02:00
Nadia Holmquist Pedersen a174901412 fix building with system libslirp 2024-08-07 17:24:07 +02:00
Nadia Holmquist Pedersen 8423dae6ff Add "Open melonDS directory" menu option 2024-08-07 15:53:58 +02:00
RSDuck dd386d12a9 use templates to only execute GDB stub related code if enabled 2024-08-05 03:23:49 +02:00
pants64DS 76c2723f5c
Fix console output on Windows (#2122)
Co-authored-by: pants64DS <pants64DS@users.noreply.github.com>
2024-08-02 02:21:37 +02:00
CasualPokePlayer 757a608b6e
Fix a few compiler warnings (#2063) 2024-08-01 23:26:46 +02:00
Jakly 54e87c915f
fix a couple polygons (#1920)
hw prioritizes the earlier vertex instead of leftmost
2024-08-01 22:55:00 +02:00
Jakly 12be06beb6
fix gdb stub causing the emulator to hang on undefined instructions (#2054)
* dont hang on undefined instruction

* Add spaces

---------

Co-authored-by: Kemal Afzal <RSDuck@users.noreply.github.com>
2024-08-01 22:48:52 +02:00
Jakly 161bd9d3d2
Default zero dot display register to the 24 bit integer limit (#1968)
* 0 dot disp defaults to the 24 bit integer limit

* useless correction

it goes through the reset function to set the variable on boot anyway but why not have the initialized state be correct too
2024-08-01 22:46:05 +02:00
Jakly d0a7239f15
fix some bugs with compressed texture look up (#2051) 2024-08-01 22:44:04 +02:00
Jakly 29c67f2140
implement 16 bit r/w IF and DISPCAPCNT (#2061) 2024-08-01 22:41:21 +02:00
Jesse Talavera 327ce45124
Refactor network implementations to be more reusable and less buggy (#2107)
encapsulate network interfaces
2024-08-01 22:02:45 +02:00
Jesse Talavera c6bf5d5181
Allow `AREngine` to be used independently of `ARCodeFile` (#2108)
* Make `EmuInstance::cheatFile` use a `unique_ptr`

- Fixes a memory leak, as the cheat file wasn't cleaned up in the destructor

* Split `AREngine` and `ARCodeFile` apart

- Suitable for frontends that have their own way of storing cheats
- Store the cheats in `AREngine` in a `std::vector`
- Apparently cheats are _supposed_ to be executed each frame; I didn't understand this until recently
2024-08-01 22:01:00 +02:00
Nadia Holmquist Pedersen f3f6a6a194 Fix building on i686 Linux
I doubt anyone actually cares about support for it but hey may as well?
2024-08-01 21:57:32 +02:00
pants64DS 37c0320cbe
Fix an inaccuracy with the No$gba debug registers 04fffa14 and 04fffa18 (#2119)
Writing to either of the two registers would print one newline too many

Co-authored-by: pants64DS <pants64DS@users.noreply.github.com>
2024-07-31 01:13:06 +02:00
RSDuck b778fbaad1 attempt at correct utf8 decoding for toml config file path 2024-07-30 17:48:41 +02:00
Nadia Holmquist Pedersen 01c2d65f07 Explicitly include QModernWindowsStylePlugin in static builds
I hope this'll make it look right.
2024-07-30 03:10:01 +02:00
RSDuck 12563fb636 use platform file functions for savestates and NAND importing file check
should fix character encoding issues on Windows
2024-07-29 00:15:19 +02:00
Nadia Holmquist Pedersen d31eabb6fa Don't disable firmware settings controls when override external firmware
settings is disabled
2024-07-27 16:56:29 +02:00
Jesse Talavera 837a582087
Expose some fields of `DSi_BPTWL` needed to support direct boot (#2103)
expose boot flag
2024-07-21 17:23:19 +02:00
Jesse Talavera 821f5f5f29
Allow frontends to use different headers for OpenGL declarations (#2102) 2024-07-21 17:02:31 +02:00
BueniaDev 9b828c2cde
Implement Rumble Pak support. (#2101) 2024-07-21 17:01:30 +02:00
Nadia Holmquist Pedersen 5eadd67df6 EmuInstance: Use GetLocalFilePath to get the wfcsettings path
Fixes the file being created in the current working directory.
2024-07-17 15:44:47 +02:00
Nadia Holmquist Pedersen 4b17de7e8c Fix annoying Qt touch event deprecations for real this time 2024-07-15 14:37:37 +02:00
Nadia Holmquist Pedersen 71f4d7b222 deviceType doesn't exist in Qt5 apparently 2024-07-15 14:04:40 +02:00
Nadia Holmquist Pedersen 6d2ad2a3f0 Ignore touch events originating from trackpads
Fixes multi-finger gestures causing spurious touch screen presses
Also fix some deprecations when we're at it anyway
2024-07-15 13:57:21 +02:00
Arisotura 2031f491f0 fix some Qt6 bugs (buttonClicked -> idClicked) 2024-07-15 13:00:40 +02:00
Arisotura d92c9fcd90 do not immediately create a core when creating an EmuInstance. fixes some nasty potential bugs. watch out for bugs this may introduce though... 2024-07-15 12:57:18 +02:00
Jesse Talavera 94ba7c1594
Split networking code into its own target (#2091) 2024-07-14 17:03:21 +02:00
CasualPokePlayer a812a43bda
Fix various issues with firmware generation (#2058) 2024-07-11 15:55:06 +02:00
OverdueWeevil2 a82b5758bc
Update EmuInstance.cpp (#2090) 2024-07-11 13:48:27 +02:00
Nadia Holmquist Pedersen b55eb431bd ensure that we actually link the OpenGL library on macOS 2024-07-07 13:45:45 +02:00
Nadia Holmquist Pedersen 1302cbdd64 frontend: Restore linear interpolation for audio output resampling
Also, do it smarter this time. This seems to have gone missing with the
doublemelon merge.
2024-07-07 08:19:49 +02:00
Antonio Niño Díaz 25b5ac91bd
Fix horizontal mosaic on sprites (#2084)
The code itself is correct, but the variable being read is the Y mosaic
coordinate, not the X coordinate.
2024-07-04 00:24:29 +02:00
RSDuck 613569a2ab append newline to nocash logging
makes behaviour consistent with no$gba
2024-07-02 19:09:32 +02:00
Nadia Holmquist Pedersen 4e3592f2d4 Fix loading GBA carts
UpdateConsole forgot to reinsert it when messing with the NDS.
2024-07-02 08:18:44 +02:00
Nadia Holmquist Pedersen f2611680ca EmuInstance: check consoleType from NDS rather than the instance's when
updating console, fixes crash on console type switch

EmuInstance::consoleType is already updated, so the check for whether we
should recreate the NDS to switch console type never succeeds.
2024-07-02 06:23:21 +02:00
Nadia Holmquist Pedersen db20771ef3 slirp: Add -fvisibility=hidden to glib stub
On Linux, our stubbed glib functions were conflicting with the ones from
real glib, which gets used by Qt when we're running on a GTK-based
desktop. Avoid a crash by not exposing them.
2024-06-24 05:25:00 +02:00
Nadia Holmquist Pedersen cbb0f4b872 Tell the compiler that we want wrapping signed arithmetic
The core relies on this and without -fwrapv there will be rendering
issues on some targets. Thanks CasualPokePlayer for noticing this.
2024-06-18 15:51:08 +02:00
Arisotura e234385c20 OpenGL: add support for changing BG0HOFS midframe. fixes #2072 2024-06-18 13:11:42 +02:00
Arisotura 626d2379bc * fix default for audio volume
* add default bools for battery settings
2024-06-17 14:51:32 +02:00
Nadia Holmquist Pedersen eb2bd73c7d ensure teakra is always static linked even in dynamically linked builds 2024-06-15 21:31:23 +02:00
Arisotura ae44ba2475 blarg 2024-06-15 21:01:27 +02:00
Arisotura 649462ff5c fix more bugs and crap 2024-06-15 20:57:26 +02:00
Arisotura 890dc4f228 fix other bugs with these regexes 2024-06-15 19:23:18 +02:00
Arisotura d449888405 fix up the regexes in Config.cpp 2024-06-15 19:10:28 +02:00
Arisotura ccc5c955e9 fix one potential crash bug 2024-06-15 17:42:26 +02:00
Arisotura 8fc403cdad update copyright headers 2024-06-15 17:01:19 +02:00
Arisotura 25a7b1ca1d
merge doublemelon (#2067)
non-exhaustive (but exhausting) list of changes:

* base laid for multiple window support, but will likely require more work to work correctly
* encapsulation of frontend state for proper multi-instance support
* (JIT still needs a fix for the NDS::Current workaround but we can get there later)
* new, more flexible configuration system
2024-06-15 13:52:47 +02:00
CasualPokePlayer 8e9b88d01d
Actually generate DownscaleFramebuffer (#2059) 2024-06-08 20:48:42 +02:00
Nadia Holmquist Pedersen a72b79a55a that needs to be public actually 2024-05-15 19:43:34 +02:00
Nadia Holmquist Pedersen cfc49eb286 Revert slirp dynamic/static check, and make it not use dllimport/export
when building statically
2024-05-15 19:37:14 +02:00
Nadia Holmquist Pedersen d21bc64cb3 MinGW build portability fixes
AKA you can build melonDS for Windows on Fedora now
2024-05-15 18:57:49 +02:00
Nadia Holmquist Pedersen a2406e3c0e
Vendored libslirp (#2045)
Add vendored libslirp into the repo with a shim to remove its dependency on glib.
2024-05-15 18:00:55 +02:00
Nadia Holmquist Pedersen 5ab8161a21 Prevent turning on compute renderer on macOS 2024-05-14 11:39:06 +02:00
RSDuck 442661747e add assert to make sure all shaders were compiled 2024-05-14 04:09:20 +02:00
RSDuck 5df83c97c7 bump up compute shader renderer tile amount factor to 16
also why did I think DS could render 4096 polygons? Use that extra bit for larger work offset
2024-05-13 19:15:48 +02:00
RSDuck 347f4a79fd Fix division by zero 2024-05-13 17:23:05 +02:00
RSDuck 043244a56d
Compute shader renderer (#2041)
* nothing works yet

* don't double buffer 3D framebuffers for the GL Renderer
looks like leftovers from when 3D+2D composition was done in the frontend

* oops

* it works!

* implement display capture for compute renderer
it's actually just all stolen from the regular OpenGL renderer

* fix bad indirect call

* handle cleanup properly

* add hires rendering to the compute shader renderer

* fix UB
also misc changes to use more unsigned multiplication
also fix framebuffer resize

* correct edge filling behaviour when AA is disabled

* fix full color textures

* fix edge marking (polygon id is 6-bit not 5)
also make the code a bit nicer

* take all edge cases into account for XMin/XMax calculation

* use hires coordinate again

* stop using fixed size buffers based on scale factor in shaders
this makes shader compile times tolerable on Wintel
- beginning of the shader cache
- increase size of tile idx in workdesc to 20 bits

* apparently & is not defined on bvec4
why does this even compile on Intel and Nvidia?

* put the texture cache into it's own file

* add compute shader renderer properly to the GUI
also add option to toggle using high resolution vertex coordinates

* unbind sampler object in compute shader renderer

* fix GetRangedBitMask for 64 bit aligned 64 bits
pretty embarassing

* convert NonStupidBitfield.h back to LF only new lines

* actually adapt to latest changes

* fix stupid merge

* actually make compute shader renderer work with newest changes

* show progress on shader compilation

* remove merge leftover
2024-05-13 17:17:39 +02:00
Nadia Holmquist Pedersen c85a2103bb Allow adding a suffix to the displayed melonDS version 2024-05-11 22:40:45 +02:00
Nadia Holmquist Pedersen 35cea5e1d7 Fix zstd ROM loading issues
* fix use-after-free of inContent
* don't try to free the DStream twice
2024-05-04 18:16:24 +02:00
Jakly 6112aa120a
Pu region sizing/bounds fix (#2024)
* fix the pu region's end point overflowing

According to gericom it cannot overflow at all

* set a minimum and a better maximum for the pu region size

* fix pu logging

* PU regions with a size of 31 always take up the entire address space

also tweak some logging a little more

* start is actually force aligned by size, oops

* small tweaks

* hopefully more clear code

* math is for nerds
2024-05-02 17:44:59 +02:00
RealAstolfo 84474105e2
ssize_t is not defined in stddef.h (#1999)
i had to add sys/types.h and patch my gentoo ebuilds for a successful compilation.
2024-04-18 13:40:38 +02:00
Rayyan Ansari 5a852cb00d
ROMManager: optimise ROMIcon function
Precompute all 16 5-bit RGB palette colours into 8-bit RGBA to avoid
repeated and superfluous calculation within the nested loop at the
point of index lookup.

A speedup was observed, from ~7ms, to a consistent 1ms
(i.e. now practically instantaneous) through timing with
std::chrono::high_resolution_clock.

Also improve comprehensibility, by using meaningful names, where
appropriate, for loop counter variables.
2024-04-16 23:39:22 +01:00
Arisotura 95adc87f6d wifi: try ignoring MP frames if not engaging in MP comm 2024-04-13 12:17:16 +02:00
Arisotura 8feeee6103 Input: only check joystick input if a joystick actually exists 2024-04-12 20:02:16 +02:00
Arisotura d99c571f94 FATStorage: make sure to always properly unmount the volume (fixes evil bug) 2024-04-12 19:43:02 +02:00
Arisotura 111dc7a563 wifi improvements:
* implement channels
* rework power-down support, fixing bugs
* fix bug when W_BeaconInterval is zero
* fix potential missing IRQs when writing to W_IE
2024-04-12 17:28:51 +02:00
Arisotura 0b87dd5fa6 fix touchscreen bug on Wayland 2024-04-09 12:54:31 +02:00
Arisotura 968bd26d85 fix generation of instance-unique MAC address when using an external firmware 2024-04-09 11:38:38 +02:00
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