Commit Graph

1985 Commits

Author SHA1 Message Date
Arisotura
f188c2cf1a hopefully get the compiler to shut up 2023-11-03 21:33:13 +01:00
Arisotura
e4f4e94694 convert RTC to OOP 2023-11-03 21:20:09 +01:00
Arisotura
440b356674 get this started: refactor SPI in OOP 2023-11-03 20:17:00 +01:00
Arisotura
70c6750561 better, less hacky, more OOP-friendly scheduler design 2023-11-02 21:04:09 +01:00
Arisotura
5ccd3916ff better be safe than sorry 2023-11-02 15:46:35 +01:00
Arisotura
2959d089fe fix weird hang when returning to the DSi menu 2023-11-02 15:31:26 +01:00
Arisotura
bff7a0d114 make linebreaks in text files not weird 2023-11-02 12:40:49 +01:00
Arisotura
eb13bce6e7 RTC: add the DSi alarm expansion registers 2023-11-02 12:21:59 +01:00
Jesse Talavera-Greenberg
d11ba63bb0
Fix compilation with the GDB stub disabled (#1863) 2023-11-01 16:02:15 +01:00
Arisotura
3b4fdea376 minor cleanup 2023-11-01 12:03:35 +01:00
Nadia Holmquist Pedersen
b8963b0738 use a grid layout in the date/time dialog so Qt will behave 2023-10-30 19:37:39 +01:00
Arisotura
e89b8a871b fdsfd 2023-10-30 18:40:26 +01:00
Arisotura
9a450f5f28
RTC revamp (#1867)
* get this started

* implement DSi RTC commands

* set up RTC clock timer. lay down basic idea of a clock.

* make the date/time registers writable

* move RTC state to its own structure, to make it easier to deal with

* more RTC work
lay base for date/time dialog

* get the bulk of the RTC functionality going

* much simpler design for RTC stuff

* aha, that is what it is

* start working on the RTC IRQ

* implement all types of RTC IRQ

* start refining sleep mode. code still kinda sucks.

* implement keypad IRQ

* refine it some more

* shut the fuck uuuuuupppppppppppppp
2023-10-30 18:37:49 +01:00
Jesse Talavera-Greenberg
21590b0709
Miscellaneous DSi NAND fixes (#1852)
* Replace some standard I/O calls with Platform equivalents

- I missed a spot when I submitted that PR a few months ago

* Include <memory> in DSi_NAND.h

- Because it uses unique_ptr

* Split DSi_NAND::ReadHardwareInfo into ReadSerialData and ReadHardwareInfoN

* Add a RegionMask enum

* Move DSi NAND patching to the frontend

* Add DSiSupportedLanguageMask

- Not currently used by the frontend, but I use it in melonDS DS

* Remove some Platform::ConfigEntry values

- The core no longer needs to know about them
- The corresponding Config values are unchanged

* Mark NANDMount's destructor as noexcept
2023-10-24 23:28:14 +02:00
Jesse Talavera-Greenberg
8c4e5af737
Slight polish to DMA (#1856)
* Slight polish to DMA

- Default-initialize members explicitly
- Mark some methods as const noexcept
- Initialize DMA::MRAMBurstTable to DMATiming::MRAMDummy
- Use the default destructor

* Move DMA_Timings definitions to a source file

- To ensure constant and unique addresses

* Include some extra DMA members in the savestate

* Simplify serializing the DMA table

- Extend the dummy table to 256 bytes (same length as the real ones)

* Revert the type change to DMA::DoSavestate

* Keep the MRAMBurstTable inside the DMA class, instead of using a pointer

- If we use a pointer to an external table, then we can't use it in savestates (else that external table gets overwritten)
2023-10-24 23:27:55 +02:00
PoroCYon
3ab752b8ca
GDB stub (#1583)
* gdbstub beginnings

* gdbstub: finish gdb impl things, next up is integration with melonDS

* holy fuck the gdbstub works

* gdb breakpoints work, but there's a mysterious crash on continue

* fix memory corruption that sometimes happened, and make resetting the console thru gdb work

* remove some gdb debug printing

* fix things in gdbstub

* separate option for enabling gdbstub

* add mode-dependent CPU registers

* C++ize the GDBstub code

* add gdbstub config in emu settings dialog

* make sure gdb is disabled when jit is enabled

* Remove unnecessary compiler flags, mark ARMJIT assembly code as no-execute-stack

This hardens the binary a little bit against common exploitation methods

* add option to wait for debugger attach on startup

* only insert GNU stack notes on linux

* disable gdbstub enable checkbox when jit is enabled

* fix non-linux incompatibilities

* enable gdbstub by default

* fix issues with gdbstub settings disable stuff

* format stuff

* update gdb test code

* Fix segfault when calling StubCallbacks->GetCPU()

C++ overrides are hard. Please I'm just a lowly C programmer.

* fix packet size not being sent correctly

Thanks to @GlowingUmbreon on Github for troubleshooting this

* fix select(2) calls (i should read docs more properly)

* fix GDB command sequencing/parsing issue (hopefully)

* [GDB] implement no-ack mode

* fix sending ack on handshake

* get lldb to work
2023-10-22 15:35:31 +02:00
RSDuck
3d58a338a1 store pc+12 when storing r15 2023-10-22 15:21:03 +02:00
Jesse Talavera-Greenberg
d4e51f8060
Refactor DSi_NAND (#1844)
* Refactor diskio's contents

- Change ff_disk_read_cb/write_cb into a std::function instead of a raw pointer
- Add const specifiers as needed

* Refactor DSi_NAND to manage the file system's mounted lifetime with RAII

* Split NANDMount into NANDMount and NANDImage

- NANDImage is used for information about the NAND that doesn't require decryption or filesystem access
- NANDMount is used to actually access the file system
- Both classes manage their respective resources (the NAND file handle and the NAND's mount) with RAII
- Also split the file loading into another function that I will remove in a later PR

* Make NANDMount immovable

* Remove NAND-loading code that I had sectioned off into a function

- Incomplete copypasta
- I must have gotten distracted

* Tidy up NANDImage's initialization

- Don't unmount the disk image if the constructor fails (that's NANDMount's job now)
- Only assign CurFile if the constructor succeeds

* Add some const-correctness

* Move DSi NAND initialization to the frontend

- The NANDImage is now installed via a unique_ptr in DSi

* Remove Platform::DSi_NANDPath

- Not Config::DSiNANDPath; that can still be configured as usual
- The core no longer needs to care
2023-10-11 17:20:05 +02:00
Jesse Talavera-Greenberg
b2fcff97c1
Add some structs for files that DSi_NAND reads (#1842)
* Add DSiFirmwareSystemSettings

* Replace DSiFirmwareSystemSettings::TouchCalibration fields with std::arrays

- So assignment can be done in one line

* Make DSiFirmwareSystemSettings a union

- So its bytes can be accessed

* Add a comment

* Use DSiFirmwareSystemSettings instead of raw byte offsets

* Add definitions for DSiSerialData and DSiHardwareInfoN

* Move DSiFirmwareSystemSettings's hash update logic into its own method
2023-10-02 17:54:17 +02:00
Jesse Talavera-Greenberg
bb09ce7d70
Replace DSi_NAND's uses of sprintf with snprintf (#1841)
- Now clang oughta stop complaining
2023-10-01 21:58:56 +02:00
Jesse Talavera-Greenberg
f8fdc77e43
Wrap CurGLCompositor cleanup in an #ifdef (#1837) 2023-09-24 18:48:37 +02:00
Jesse Talavera-Greenberg
9d9ba83731
Clean up some rendering-related resources in DeInit (#1836)
- The unique_ptr destructors will take care of the cleanup
2023-09-24 18:33:14 +02:00
Jesse Talavera-Greenberg
7d4a7969d9
Ensure that the new firmware is installed when resetting (#1834)
- It might have been changed in the settings
2023-09-21 13:54:17 +02:00
RSDuck
6ca02aab2c only recalculate extended access point checksum when firmware is a DSi one 2023-09-20 19:17:26 +02:00
Jesse Talavera-Greenberg
5bfe51e670
Refactor the core's handling of firmware and BIOS images to rely less on the file system (#1826)
* Introduce firmware-related structs

* Fix some indents

* Move the generated firmware identifier to a constant

* Document the WifiAccessPoint constructors

* Add some constants

* Remove a stray comment

* Implement Firmware::UserData

* Add Firmware::Mask

* Document Firmware::Buffer

* Add a Firmware constructor that uses a FileHandle

* Set the default username in UserData

* Update the UserData checksum

* Forgot to include Platform.h

* Remove some redundant assignments in the default Firmware constructor

* const-ify CRC16

* Replace the plain Firmware buffer with a Firmware object

- Remove some functions that were reimplemented in the Firmware constructors

* Fix some crashes due to undefined behavior

* Fix the user data initialization

- Initialize both user data objects to default
- Set both user data objects to the same touch screen calibration

* Follow the DS logic in determining which user data section is current

* Remove an unneeded include

* Remove another unneeded include

* Initialize FirmwareMask in Firmware::Firmware

* Use the DEFAULT_SSID constant

* Add SPI_Firmware::InstallFirmware and SPI_Firmware::RemoveFirmware

* Move a logging call to after the file is written

* Add a SaveManager for the firmware

* Touch up the SPI_Firmware::Firmware declaration

* Move all firmware loading and customization to the frontend

* Call Platform::WriteFirmware when it's time to write the firmware back to disk

* Fix some missing stuff

* Remove the Get* functions from SPI_Firmware in favor of GetFirmware()

* Implement SPI_Firmware::DeInit in terms of RemoveFirmware

* Add Firmware::UpdateChecksums

* Fix an incorrect length

* Update all checksums in the firmware after setting touch screen calibration data

* Use the Firmware object's Position methods

* Remove register fields from the Firmware object

* Install the firmware before seeing if direct boot is necessary

* Install the firmware before calling NDS::Reset in LoadROM

* Slight cleanup in ROMManager

* Fix the default access point name

* Shorten the various getters in Firmware

* Add qualifiers for certain uses of firmware types

- GCC can get picky if -fpermissive isn't defined

* Add an InstallFirmware overload that takes a unique_ptr

* Log when firmware is added or removed

* Don't clear the firmware in SPI_Firmware::Init

- The original code didn't, it just set the pointer to nullptr

* Fix a typo

* Write back the full firmware if it's not generated

* Move the FreeBIOS to an external file

* Load wfcsettings.bin into the correct part of the generated firmware blob

* Load BIOS files in the frontend, not in the core

* Fix logging the firmware ID

* Add some utility functions

* Mark Firmware's constructors as explicit

* Remove obsolete ConfigEntry values

* Include <locale> explicitly in ROMManager

* Fix up some includes

* Add Firmware::IsBootable()

* Add a newline to a log entry

- Whoops

* Log the number of bytes written out in SaveManager

* Mark FirmwareHeader's constructor as explicit

* Clean up GenerateDefaultFirmware and LoadFirmwareFromFile

- Now they return a pair instead of two by-ref values

* Refactor SaveManager a little bit

- Manage its buffers as unique_ptrs to mitigate leaks
- Reallocate the internal buffer if SetPath is asked to reload the file (and the new length is different)

* Remove some stray parens

* Fix some firmware-related bugs I introduced

- Firmware settings are now properly saved to disk (beforehand I misunderstood when the firmware blob was written)
- Firmware is no longer overwritten by contents of wfcsettings.bin

* Slight cleanup
2023-09-18 21:09:11 +02:00
Jesse Talavera-Greenberg
db963aa002
Make the NDS teardown more robust (#1798)
* Make cleanup a little more robust to mitigate undefined behavior

- Add some null checks before cleaning up the GPU3D renderer
- Make sure that all deleted objects are null
- Move cleanup logic out of an assert call
- Note that deleting a null pointer is a no-op, so there's no need to check for null beforehand
- Use RAII for GLCompositor instead of Init/DeInit methods

* Replace a DeInit call that I missed

* Make ARMJIT_Memory less likely to generate errors

- Set FastMem7/9Start to nullptr at the end
- Only close and unmap the file if it's initialized

* Make Renderer3D manage its resources with RAII

* Don't try to deallocate frontend resources that aren't loaded

* Make ARMJIT_Memory::DeInit more robust on the Switch

* Reset MemoryFile on Windows to INVALID_HANDLE_VALUE, not nullptr

- There is a difference

* Don't explicitly store a Valid state in GLCompositor or the 3D renderers

- Instead, create them with static methods while making the actual constructors private

* Make initialization of OpenGL resources fail if OpenGL isn't loaded

* assert that OpenGL is loaded instead of returning failure
2023-09-15 15:31:05 +02:00
RSDuck
1aaf22d181 fix last commit 2023-09-02 18:56:58 +02:00
jdp_
2a3a071216
Reduce code stink (#1818)
CRC32.cpp:
Make table initialization compile time

DSi_NAND.cpp:
Fix file close / unmount / disk close on error
~L427: Remove redundant calls, as they are immediately rendered useless by `rem` being overwritten

NDS.cpp / FreeBIOS.h:
Remove unneeded size values in header
Remove unneeded memset's as they are initialized anyway

sha1.c / sha1.h:
Fix useless warning

Wifi.cpp:
Remove unneeded includes

DSi.cpp:
Reduce ugly casts
Deduplicate code

qt_sdl/main.cpp:
silence clang switch statement warning

qt_sdl/main.h:
fix override warnings

dolphin/BitSet.h:
use msvc extensions only when appropriate, fix broken bit set count under _WIN32
2023-08-28 20:01:15 +02:00
xenticore
b4756c5944
Update macOS icon (#1609)
* Add SVG icon

* Update macOS icon

* Don't force change the application icon at runtime on macOS
2023-08-27 13:37:42 +02:00
StraDaMa
bc71618457
remove AR code size limit (#1802)
Co-authored-by: Arisotura <thetotalworm@gmail.com>
2023-08-27 13:34:11 +02:00
Jaklyy
2bd12669b2
Edge fill rules for swapped polygons + a few minor fixes to edge cases (#1815)
* fix edge fill rules for swapped polygons

also fixes translucent polygons not being always edge filled.

* fix right edge fill rule

* fix right edge fill rule for realsies

* fix a few more glitchy polygons

specifically quads similar to: (-67,40) (64, 160) (192, 160), (8, 111)

* fix one edge case pixel

i hate this so much

* fix "flat bottom" edge fill

* fix regression + apply changes to shadow masks

fix a regression with certain line polygons not rendering; there seems to be an exception made by the ds'  gpu in order for these polygons to render properly.
also apply these changes to shadow masks because i forgot to

* forgot to remove a line

---------

Co-authored-by: Arisotura <thetotalworm@gmail.com>
2023-08-27 13:32:31 +02:00
Mireille
a571fe19c3
Make sprite mosaic (more) accurate (#1687)
* Make horizontal sprite mosaic (more) accurate

* Vertical sprite mosaic should not extend the sprite's bounding area

* Vertical sprite mosaic should not extend the sprite's bounding area (2)

* OBJIndex is no longer needed
2023-08-27 13:29:23 +02:00
Jaklyy
d69745b3a8
Fix Incorrect Polygon Swapping Behavior and Implement Correct Rules for Shifting Right Edges Left (#1816)
* fix polygons being swapped incorrectly

"borrowed" this from noods
needs verification that the >= and <= signs aren't actually supposed to be > and <

* proper rules for moving vertical right slopes left

* nvm most of that was actually pointless

that's on me for not checking
2023-08-27 13:29:12 +02:00
Jaklyy
dc8efb62b8
Fix aa being upside down on swapped y-major slopes (#1803)
* fix aa being upside down on swapped y-major slopes

* further improvements to swapped aa

in addition to fixing swapped y-major slope aa, now fixes:
swapped x-major slope aa
swapped vertical slope aa

* use templates instead + style/comment tweaks

should force the compiler to precompile if statements like i want it to do, instead of just hoping it does so on its own
2023-08-27 13:28:44 +02:00
Jaklyy
d7369857c3
Small Fix to Anti-Aliasing + Edge Marking Behavior (#1680)
* Anti-Alias All Edges

Changing a bunch of 0x3s to 0xF since I figure if they're checking the left and right edge they wanna be checking the top and bottom too now that they're gonna be aa'd. also copy that if statement over since otherwise there won't be anything to blend with.

* small optimization

its probably a tiny bit faster?
idk id need actual benchmarking tools.
doesn't break anything at least.
2023-08-27 13:28:26 +02:00
Jaklyy
758b5ee7a1
fix aa calc for 1px tall 0px wide slopes (#1795) 2023-08-27 13:27:42 +02:00
Jesse Talavera-Greenberg
ee55677086
Assorted portability enhancements (#1800)
* Introduce some Platform calls for managing dynamic libraries

* Add Platform::WriteFATSectors

* Introduce some Platform calls for managing dynamic libraries

* Add Platform::WriteFATSectors

* Change includes of "../types.h" to "types.h"

- Makes it easier to directly include these headers in downstream projects

* Change an include of "../Wifi.h" to "Wifi.h"

* Allow CommonFuncs.cpp to compile on Android

* Tidy up some logging calls

- Use Platform::Log in LAN_Socket.cpp
- Soften some warnings to Debug logs (since they don't necessarily represent problems)

* Add Platform::EnterGBAMode

- Gracefully stop the emulator if trying to enter GBA mode

* Soften some logs that most players won't care about

* Soften some more logs

* Introduce Platform wrappers for file operations

* Fix pointer spacing

* Fix more style nits

* Log the errno when ftruncate fails

* Fix FileSeek offset argument

- With an s32 offset, we couldn't access files larger than 2GB

* Revise Platform::StopEmu to address feedback

- Remove Platform::EnterGBAMode in favor of adding a reason to Platform::StopEmu
- Also rename Platform::StopEmu to Platform::SignalStop
- Add an optional argument to NDS::Stop
- Use the new argument everywhere that the console stops itself

* Rename FileGetString to FileReadLine

- It conveys the meaning better

* Rename FileSeekOrigin::Set to Start

- It conveys the meaning better

* Change definition of FileGetString to FileReadLine

- Oops, almost forgot it

* Rename FlushFile to FileFlush

- To remain consistent with the other File functions

* Add a FileType usage

* Fix line break in FileSeekOrigin

* Document Platform::DeInit

* Clarify that StopReason::Unknown doesn't always mean an error

* Move and document FileType::HostFile

* Remove Platform::OpenDataFile

- Nothing currently uses it

* Refactor Platform::OpenFile and Platform::OpenLocalFile to accept a FileMode enum instead of a string

- The enum is converted to fopen flags under the hood
- The file type is used to decide whether to add the "b" flag
- Some helper functions are exposed for the benefit of consistent behavior among frontends
- Equivalent behavior is maintained

* Fix a tab that should be spaces

* Use Windows' 64-bit implementations of fseek/ftell

* Move Platform::IsBinaryFile to Platform.cpp

- It could vary by frontend

* Remove an unused FileType

* Rename an enum constant

* Document various Platform items

* Use Platform::DynamicLibrary to load libandroid

- And clean it up at the end

* Fix a typo

* Pass the correct filetype to FATStorage

- Since it can be used for DSI NAND images or for SD cards

* Remove Platform::FileType
2023-08-18 22:50:57 +02:00
Jaklyy
f454eba3c3
check lower pixel when top pixel ignores fog (#1808) 2023-08-13 05:38:26 +02:00
Jaklyy
5f9e7e19f3
Improve Interpolation Accuracy (#1686)
* Fix Up Y Interp Inputs

* Change Linear Interp Formula

Fixes a handful of pixels.
Still not perfect.

* Cleanup

remove some unnecessary code and parentheses
2023-08-10 18:00:40 +02:00
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
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
8772258fe7 attempt at making local multiplayer faster 2023-07-15 01:16:31 +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
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
Nadia Holmquist Pedersen
382155e6fe Add hotkey to toggle screen emphasis
Toggles which screen is emphasized when the screen sizing is set to
emphasize top or bottom. (Closes issue #1565)
2023-02-17 04:33:26 +01:00
patata
35f4e504f1
Increase savestate major version (#1567) 2023-01-19 15:11:42 +01:00
Janfel
3e02d3ff76
Rebase: Make archive detection more robust and add it to the CLI (#1560)
* 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>
2023-01-18 00:49:18 +01:00
RSDuck
d83172e595 fix window aspect ratio 2023-01-17 20:00:21 +01:00
RSDuck
8ec8a6ce09 ehhh got that one wrong, now it should be right 2023-01-06 20:17:04 +01:00
RSDuck
eadfeec7ab hopefully correct overflow flag for ADC and SBC
also use inline functions instead of macros to make things more neat
2023-01-06 20:11:11 +01:00
RSDuck
86d2e60df7 fix #1593 2023-01-03 18:50:03 +01:00
Rupert Carmichael
bd9c614ceb
Wifi: -Wformat warning caused by missing printf argument (#1532) 2022-12-30 21:13:39 +01:00
RSDuck
43d091361e fix #1551 2022-11-25 23:47:36 +01:00
RSDuck
3111431a3f fix #1556 2022-11-14 18:29:44 +01:00
pepper-jelly
5488e0bf3d
prevent screensaver (#1485) 2022-11-11 23:18:28 +01:00
mariomadproductions
88c1371a96
Added LEGO Batman 2 - DC Super Heroes (Canada) (En,Fr) [B6FL] to ROMList (#1422) 2022-11-11 23:08:55 +01:00
Quinn Painter
2256b64fcd
Fix nocash Char Out debug register (#1500)
To match no$gba, this register should output any ASCII character written to it, not print the number as it currently does.
2022-11-11 23:03:17 +01:00
Nadia Holmquist Pedersen
726fde4e8d Explicitly include the build/res directory so windres will find it when
using the CMake Makefile generator
2022-11-09 19:44:07 +01:00
Pk11
31a0d7ecd2
Allow import/export of .pub/.prv/.bnr saves (#1558) 2022-11-07 16:03:00 +01:00
Nadia Holmquist Pedersen
ca19ea1ce8 Windows resource/manifest fixes
* 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
2022-11-06 02:53:51 +01:00
Nadia Holmquist Pedersen
659b7214c7 Use WGL for GL context creation on Windows ARM64 as well.
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.
2022-11-05 22:38:23 +01:00
Nadia Holmquist Pedersen
9a5e884913 JIT: Add bits for Windows ARM64 support 2022-11-05 22:37:27 +01:00
Nadia Holmquist Pedersen
c387fb1819 mainWindow may be nullptr when audioMute() is called.
Fixes potential crash on launch when multiplayer audio output is set to only the current window.
2022-11-05 16:57:28 +01:00
Arisotura
019120ebb8 fix a tidbit with GXFIFO NDMA, I think 2022-11-03 20:22:46 +01:00
Arisotura
4ef2e1f4cc fix up DSi direct boot 2022-10-28 21:31:51 +02:00
patata
561781b954
CLI 2.0: Electric Boogaloo (#1546)
* CLI: begin QT reimplementation

* Add first batch of parameters
* ROM loading (no archives yet)
* --fullscreen
* --boot (non-functional???)

* fix --boot

* archives!

* Add disclaimer that a.zip|b.nds is kind of fucky

* remove shit7 debugging

* Apply requested changes
2022-10-28 12:27:55 +02:00
Arisotura
936011964c comment out semaphore shit in teakra 2022-10-25 00:09:43 +02:00
Nadia Holmquist Pedersen
9e449d902d Make clang shut up about -Wno-error=maybe-uninitialized in teakra 2022-10-23 16:52:18 +02:00
orbea
b5017caa33 fatfs: Fix -Wstrict-prototypes + -Wimplicit-function-declaration warnings
This will be required for upcoming gcc and clang versions.

Reference: https://archives.gentoo.org/gentoo-dev/message/dd9f2d3082b8b6f8dfbccb0639e6e240
2022-10-23 16:33:29 +02:00
Arisotura
dd74e936ed force-align all read/write accesses. fixes #1540 (unaligned DMA address) 2022-10-22 13:11:57 +02:00
Nadia Holmquist Pedersen
b6776bd826 getWindowInfo: handle if the Wayland window handle is null 2022-10-19 00:03:28 +02:00
RSDuck
ac3118cbc5
No more context mess (#1531)
* 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>
2022-10-17 22:55:11 +02:00
Arisotura
31ba585d39 more fun DSP fixes
* aac.a thinks it is funny to start DMA by writing to 8184 directly
* implement retd (gross hack!!)
* remove another unimplemented exception (wat)
2022-10-17 20:16:19 +02:00
Arisotura
243a02767a I don't think NWRAMMask is relevant here 2022-10-14 00:22:39 +02:00
Arisotura
cdd05c10b4 more DSP unfucking: make Teakra directly use melonDS's NWRAM banks instead of trying to translate to a flat buffer, fixes bugs with the way the memory banks are ordered etc 2022-10-14 00:02:54 +02:00
Nadia Holmquist Pedersen
349316a078 Work around a really strange issue when building teakra with -O0 on Windows 2022-10-12 20:49:15 +02:00
Arisotura
b33f0434a6 unfuck the DSP enough that it will actually run code
(don't get your hopes up, it's still pretty much a trainwreck)
2022-10-11 00:26:42 +02:00
Arisotura
b76e5adc1d unfuck the DSP code some
(still doesn't work)
2022-10-10 00:22:46 +02:00
Nadia Holmquist Pedersen
aa9a6ceed5
Merge pull request #1282 from gal20/scale_fix
Fix screen scaling error
2022-10-04 20:40:00 +02:00
Arisotura
1a602376c7 this was prolly bad 2022-10-04 19:37:49 +02:00
Arisotura
571d1c403f properly stop any started cameras upon reset/shutdown 2022-10-02 23:29:24 +02:00
Arisotura
62879c4484 add support for UYVY format (FaceTime camera) 2022-10-02 19:43:57 +02:00
Arisotura
af9a77b0b4 camera: fix x-flip crustiness 2022-10-02 18:44:47 +02:00
Arisotura
3f4573574a
actual DSi camera support (#1520)
basically feeding something that isn't a fixed stripe pattern, and emulating enough of the camera hardware to make this work
2022-10-02 16:47:57 +02:00
Nadia Holmquist Pedersen
37e5e2c3c0 Account for the screen gap being scaled with the window size
Fixes #1430
2022-09-25 20:48:40 +02:00
Arisotura
86786738cc properly make the DSi NAND instance-unique 2022-09-23 22:53:23 +02:00
Arisotura
fc11258071 remove Windows console shito we don't need anymore 2022-09-22 20:33:32 +02:00
Arisotura
b1e4bd5520
merge local_wifi (#1516)
* 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>
2022-09-22 20:32:27 +02:00
Nadia Holmquist Pedersen
b5073e6014 lol oops 2022-09-18 23:39:19 +02:00
Rayyan Ansari
61de50069b Fix handling of utf16 title strings in ROMInfoDialog
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.)
2022-09-02 11:57:49 +01:00
Rayyan Ansari
c3bd1d2e83
Fix reading banner from homebrew ROMs
Some homebrew ROMs do not have a banner, and use a null value to indicate this.
Do not attempt to read the banner when this is the case.
2022-09-02 11:47:12 +01:00
RSDuck
ce68e883c4 for all people who hate speed, here you can build melonDS again 2022-08-22 00:44:48 +02:00
RSDuck
32609bbc98 invalidate JIT blocks in ARM7 WVRAM when it's remapped 2022-08-22 00:39:08 +02:00
RSDuck
d56219c33c fix SCFG_MC cartridge inserted bit 2022-08-21 22:11:22 +02:00
RSDuck
22b312bc43 implement 8- and 16-bit DSi AES register accesses
fixes NAND access through Godmode9i
2022-08-21 21:31:11 +02:00
RSDuck
4c97731468 fix last commit for when no SD is inserted 2022-08-21 19:55:23 +02:00
RSDuck
334fc1717d fix DSi SD newly inserted/removed IRQ bits
we don't support SD card hot swapping and SDIO wifi is always inserted, so those bits are always zero
special thanks to Evie
2022-08-21 19:52:23 +02:00
RSDuck
f0657e1a9b basic implementation of SNDExCnt
isn't hooked up to the DSP or microphone though
fixes memory abort in TwilightMenu
2022-08-21 16:40:30 +02:00
Nadia Holmquist Pedersen
3ad5f3e22e Fix Windows debug builds not having a console because something, probably some library's CMake script, sets -mwindows when it shouldn't. 2022-08-17 20:04:43 +02:00
RSDuck
5baf5fe77b a bit of refactoring around ScreenHandler
also gets rid of that annoying warning about const char* being converted to char*
2022-08-05 20:22:10 +02:00
Nadia Holmquist Pedersen
2ba7f961a6 Apply strong focus policy to joystick mapping button as well. Fixes #1491 2022-07-31 21:18:08 +02:00
Valtýr Kári Daníelsson
98903f8076 fixes editor warnings about undefined types in a bunch of files 2022-07-27 18:55:59 +02:00
Valtýr Kári Daníelsson
457dd56b88
constexpr-s the DMA timing tables (#1489) 2022-07-27 17:01:31 +02:00
Nadia Holmquist Pedersen
f5c1094d03 Fix triggers being recognized as negative analog stick values when assigning an input if the axis is moved too slowly. 2022-07-07 23:18:56 +02:00
Nadia Holmquist Pedersen
35cbda9001 GL: Fix 16x resolution on macOS 2022-06-02 00:55:29 +02:00
Nadia Holmquist Pedersen
f85925fcd6 Add 3DS 16:10 aspect ratio and refactor GUI aspect ratio code 2022-05-23 16:59:50 +02:00
Nadia Holmquist Pedersen
94b33c924e
Modernize CMake build system (#1434)
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
2022-05-21 19:54:55 +02:00
Nadia Holmquist Pedersen
4cc34121b0 Update teakra (fixes #1441) 2022-05-13 20:31:24 +02:00
Nadia Holmquist Pedersen
ed2121d7ec Accomodate top/bottom only lzyout when setting screen size 2022-04-20 15:50:01 +02:00
Arisotura
529a690089 fix potential issues with 32bit GPU writes 2022-04-10 15:11:30 +02:00
Arisotura
0294bcb5f2 add support for the mainRAM mirror at 0x0C000000 in DSi mode, makes SM64DSi work correctly 2022-04-10 14:54:40 +02:00
Arisotura
b572d8cd70 add support for GXFIFO NDMA 2022-04-10 02:15:49 +02:00
Arisotura
0feed13cc4 close gaps in VRAM mapping 2022-04-09 19:40:35 +02:00
Arisotura
86f725f2f2 master brightness has different biases (are you serious, Nintendo)
also add all these biases to the OpenGL compositor
2022-04-08 01:08:19 +02:00
Arisotura
f6a55354fa remove some cruft 2022-04-08 00:34:07 +02:00
Arisotura
879695070a make blending/fade accurate too (not quite sure about the 3D one) 2022-04-01 13:57:28 +02:00
Arisotura
1dfcf2010a Merge branch 'master' of github.com:Arisotura/melonDS 2022-04-01 12:54:58 +02:00
Arisotura
d296f2832c make display-capture blending accurate to hardware 2022-04-01 12:54:47 +02:00
Nadia Holmquist Pedersen
02b859ad9d Disable firmware overrides UI when override checkbox isn't checked 2022-03-28 00:55:18 +02:00
Arisotura
5ca8728cbf save WFC settings when using default firmware. fixes #1401, also fixes #1336 2022-03-22 23:21:45 +01:00
Arisotura
599deeb2b8 default firmware: in DSi mode, emulate more compatible DWM-W015 instead of DWM-W024 2022-03-20 18:13:32 +01:00
Arisotura
709a5980ed FreeBIOS: add VRAM-compliant LZ77 decompressor. fixes #1353 2022-03-14 19:42:30 +01:00
Arisotura
3756f3cb1f make invalid SPI memory commands return 0xFF. fixes #1366 (Dementium II checks the results of RDSR, RDID and cmd 00 to determine what kind of backup memory is present) 2022-03-14 18:08:29 +01:00
Arisotura
5415f8a746 what. 2022-03-14 11:51:10 +01:00
Arisotura
d8f87df2b7 DISPCAPCNT is writable at any time 2022-03-14 01:09:07 +01:00
Arisotura
fb7bea06f8 fix some gaps in the SPI/cart implementations 2022-03-14 00:27:03 +01:00
Arisotura
f7fa0dda50 * support patching multiple DLDI interfaces
* fix the DLDI size entry
fixes the Smash demo
2022-03-12 21:52:29 +01:00
Arisotura
cce9de5ee1 BLARG 2022-03-08 14:42:02 +01:00
Arisotura
fe96944fc0 insert wacky commit message 2022-03-08 12:03:16 +01:00
Arisotura
2eec033c72 save battery levels to config 2022-03-07 21:08:54 +01:00
Arisotura
532b1c967a fix up the power management dialog 2022-03-07 21:08:54 +01:00
Arisotura
9394dde67a fix copyright headers 2022-03-07 21:08:54 +01:00
Rayyan Ansari
2569c67a13 Add support for changing the DS and DSi battery level
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.
2022-03-07 21:08:54 +01:00
Pk11
c3adf6f606
Improve DSiWare save creation (#1375) 2022-03-07 21:08:29 +01:00
2jun0
c66df57256
Implement MainRAM management dialog😁 (#1248)
* 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>
2022-03-06 22:33:11 +01:00
Nadia Holmquist Pedersen
088d49b9cb macOS: Use Qt 6 by default 2022-03-06 20:12:20 +01:00
Nadia Holmquist Pedersen
b1565ec87a macOS: Bump minimum version to 10.15 2022-03-06 20:06:11 +01:00
Arisotura
2af8e65f23 we prolly don't need to init SDL video, given we don't use it 2022-03-06 10:49:05 +01:00
Arisotura
ef7dfb8872 fix the GBA cart save shito, I guess 2022-03-04 20:54:45 +01:00
Rayyan Ansari
f4f6f6dfc5
InputConfig: change Group Box titles to Labels
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.
2022-03-04 17:52:49 +00:00
Brankale
2c21787f33
fix typo in enum for screen sizing (#1377) 2022-02-25 20:28:21 +01:00
RSDuck
550db94a87 Use enum for screen sizing 2022-02-25 16:35:21 +01:00
ZackWeinstein
e3ad78e84f
Allowing Swap screens hotkey to swap between displaying only top screen and only bottom screen. (#1283) 2022-02-25 15:58:31 +01:00
RSDuck
bb67e186df comment out debug printfs 2022-02-25 14:35:45 +01:00
RSDuck
0a1fb5ae50 Wifi power saving, hopefully enough! 2022-02-25 14:25:19 +01:00
RSDuck
03b5c48088 lower window update rate if rendering too fast 2022-02-14 00:27:00 +01:00
Arisotura
0761fe736f add support for zero-address in AR codes 3-A 2022-01-28 20:56:08 +01:00
Arisotura
915edd777e hopefully fix #1349 2022-01-24 12:16:39 +01:00
Nadia Holmquist Pedersen
2bda2f127b nifi: Set SO_REUSEPORT on BSD and macOS to prevent creation of socket failing 2022-01-12 20:40:39 +01:00
Arisotura
dff8980a27 Merge branch 'master' of github.com:Arisotura/melonDS 2022-01-09 02:16:03 +01:00
Arisotura
35cc79787d update copyright headers 2022-01-09 02:15:50 +01:00
Nadia Holmquist Pedersen
0a8f3c9344 Make the message when SDL2 fails to init more descriptive 2022-01-08 19:35:21 +01:00
Arisotura
10d7831917 can we, please, FINALLY, be done with this stupid issue 2022-01-08 12:53:06 +01:00
Arisotura
5c719a774f fdsfdfdgdfgfgdfg 2022-01-08 12:18:24 +01:00
Arisotura
80564ba947 explicitly eject the cart before a load with reset, preventing a spurious cart-eject IRQ on startup
also fix possible KEY1 issues when using internal BIOS
2022-01-08 11:20:21 +01:00
Arisotura
e665e25bd3
Custom path support (#1333)
also including:
* getting rid of shitty strings
* all new, cleaner ROM handling code
* base for DSi savestates
* GBA slot addons (for now, memory cart)
2022-01-07 14:00:43 +01:00
gal20
dfb2111a00 Fix screen scaling
The screen gap wasn't multiplied by the scaling factor, causing the result to be too low
Additionally, results of division should be rounded up
2022-01-05 21:03:13 +02:00
Charlene Campbell
c4cd9da674 don't link rt when oglrenderer disabled on apple 2021-12-29 18:28:27 +01:00
Nadia Holmquist Pedersen
f39eeeb9dd
title import: create all title/ subdirectories 2021-12-18 02:56:27 +01:00
Nadia Holmquist Pedersen
203cf5164b Create ticket subdirectory if missing during title import 2021-12-16 06:33:32 +01:00
Nadia Holmquist Pedersen
f1c9b42b45 ScreenPanelNative: Don't try to render the framebuffer if the emulator is not actually active.
This fixes an issue where the window draws with a gray background in macOS, and is see-through on Wayland-based desktops.
2021-12-09 01:57:02 +01:00
Nadia Holmquist Pedersen
14c6bba21f Manually center the window after setting its size on macOS
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.
2021-12-09 01:21:06 +01:00
andrigamerita
151610eb6c
Treat SDL_INIT_JOYSTICK fail as non-critical (#1277)
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.
2021-12-01 13:52:58 +01:00
Arisotura
3300cc8f15 really, Arisotura? 2021-11-28 13:36:00 +01:00
Arisotura
44757a8323 SPU: block reads from ARM7 BIOS region. fixes #1267 (and prolly whatever other stupid game tries to play sound from NULL) 2021-11-25 16:49:43 +01:00
Arisotura
c04e43702c SPU: correctly read negative ADPCM initial values. fixes #1261 2021-11-23 18:47:54 +01:00
Arisotura
97e599f90f what. 2021-11-22 18:59:49 +01:00
Arisotura
e24a4e5e97 ensure shit doesn't asplode atleast until this code is redone 2021-11-21 16:12:07 +01:00
Arisotura
333b1247d9 remove remains of SDIOFile 2021-11-21 16:05:48 +01:00
Arisotura
73d7bada87 add valid wifi data to the default firmware 2021-11-20 13:22:20 +01:00
Arisotura
8100b6da6b ASGYHFDUHDIUIHSJODHSIJDHSIYGDHSJKDSDSDSDSD 2021-11-20 12:16:59 +01:00
Arisotura
7a0286a43d make firmware settings override also apply in DSi mode 2021-11-20 12:09:13 +01:00
Arisotura
593eb7c81c hopefully fix Qt6 2021-11-19 17:03:45 +01:00
Arisotura
1472a0ec4b move 'randomize MAC' setting to firmware settings, and add setting for changing the MAC.
make things overall betterer.
2021-11-19 13:31:14 +01:00
Arisotura
1fc775d964 better suited entry method for the firmware birthday 2021-11-18 20:24:37 +01:00
Arisotura
08eda46706 fix potential crash with firmware dialog (when closing dialog via X and opening it again) 2021-11-18 18:25:19 +01:00
Arisotura
f73df85d1c make external-BIOS toggle also explicitly control external firmware
make things a tad more consistent and explicit
2021-11-18 18:17:48 +01:00
Arisotura
19ddaee13b finally decouple Config from the core. baahhahahahah 2021-11-18 01:17:51 +01:00
Arisotura
65c2a844ac oops 2021-11-17 23:23:22 +01:00
Arisotura
e8bae0e146 what 2021-11-17 23:09:42 +01:00
RSDuck
3be26f456b prevent out of bounds write 2021-11-17 22:59:28 +01:00
Arisotura
d5b248bb86 decouple more config shit from the core. bahahah 2021-11-17 21:44:49 +01:00
Arisotura
13afaa0303 remove some more shitty strings 2021-11-17 20:57:30 +01:00
Arisotura
5bb8f4c922 * remove more Config dependencies from the core
* also use less shitty strings
2021-11-17 20:42:11 +01:00
Arisotura
69715043ca blfdlkgdfgdf 2021-11-17 18:41:59 +01:00
Arisotura
c1dcd585be decouple JIT from Config. bahahahahah 2021-11-17 18:15:50 +01:00
Arisotura
53dfcfb18a nicerer firmware color picker
also consistency aaaaaaaaaa
2021-11-17 14:53:46 +01:00
Arisotura
c6d1977448 UI consistency!!!! 2021-11-10 23:59:54 +01:00
Arisotura
3fad5dcbbb make the firmware dialog consistent with the rest of the UI 2021-11-08 20:57:26 +01:00
RSDuck
c233d99211 dtcm not dtcb 2021-10-29 12:09:00 +02:00
RSDuck
6c2ea93173 get rid of DTCMSize 2021-10-29 01:35:47 +02:00
Arisotura
635a47014f fix more bugs in the DLDI machine 2021-10-29 01:33:37 +02:00
Arisotura
cca5615748 add the PU checks. bahahahah 2021-10-29 00:36:55 +02:00
Arisotura
ead8d1b629 more UTF8 shenanigans huh 2021-10-28 23:51:25 +02:00
Arisotura
8b59c73c01 also don't try to save if there's no folder to sync to 2021-10-28 23:48:20 +02:00
Arisotura
d25102a9c8 don't explode if the folder-sync path points to a non-existing folder 2021-10-28 23:45:14 +02:00
Arisotura
c532059cd3 oops! 2021-10-28 22:45:23 +02:00
Arisotura
15a66b1be1 more accurate DTCM check 2021-10-28 22:41:42 +02:00
Arisotura
43daa1c7d2 blarg 2021-10-28 21:24:39 +02:00
Arisotura
e121953c9a more complete (and accurate) CP15 setup for direct boot 2021-10-28 21:15:12 +02:00
Arisotura
bfe50e41b4 MCR/MRC aren't available in user mode 2021-10-28 19:47:26 +02:00
Arisotura
9d82826cdb fix some gaps in CPU modes
* 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)
2021-10-28 19:45:32 +02:00
Arisotura
ae489d9e03 zarg 2021-10-28 18:55:22 +02:00
Arisotura
ff3f661bb5
DLDI/SD folder-sync apparatus (#1251)
guess we can finally have DLDI that isn't obtuse
2021-10-28 18:47:13 +02:00
scurest
a8613af2bd
InputConfigDialog: more DRY (#1238) 2021-10-10 22:51:08 +02:00
Nadia Holmquist Pedersen
a9fc0adf96
Move resources to res/ directory (#1204)
* Move resources to res/ directory and update CMake scripts accordingly

Co-authored-by: Rayyan Ansari <68647953+RayyanAnsari@users.noreply.github.com>
2021-10-03 09:37:33 +00:00
Adrian Siekierka
d378b0252f
Generate a simple non-bootable firmware when not provided. (v2) (#1175)
* 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>
2021-10-02 20:16:27 +02:00
Nadia Holmquist Pedersen
b92622b765 Revert "Misc fixes for dsiwifi BMI stage (#1216)"
This reverts commit a54b076b06.
2021-10-02 13:57:52 +02:00
Adrian Siekierka
b7992cc084
Fallback to FreeBIOS when BIOS files are not found. (v2) (#1174)
* Fallback to FreeBIOS when BIOS files are not found.

* Add sources of drastic bios files.

* Move FreeBIOS/external BIOS choice to configuration option/checkbox.

* Fix indentation

Co-authored-by: Filippo Scognamiglio <flscogna@gmail.com>
Co-authored-by: Filippo Scognamiglio <filippo.scognamiglio@felgo.com>
2021-10-02 12:06:22 +02:00