Commit Graph

235 Commits

Author SHA1 Message Date
145c1639fb remove unneeded file. make sure you can't insert a GBA cart in DSi mode. 2022-01-07 12:10:06 +01:00
8c2cd2beaf add some of the savestate shit 2022-01-07 01:31:40 +01:00
1e2982481c properly report savestate-load failure 2022-01-06 22:43:00 +01:00
211a1ed5f2 add stupid cast
also lay base for DSi savestates
2022-01-06 22:29:45 +01:00
43b551b042 remove old cruft 2022-01-06 21:57:30 +01:00
7c104310d7 re-add SRAM import 2022-01-04 12:02:52 +01:00
b0a22e4ce9 re-add 'open file' event, whatever that is
also remove a bunch of cruft
2022-01-04 02:10:06 +01:00
f2ba4f8239 some more shit working 2022-01-04 02:00:36 +01:00
52a9abde6f reconnect the save manager thing 2022-01-03 19:12:11 +01:00
46656eccda proof-of-concept system for GBA slot addons 2022-01-03 10:05:37 +01:00
cdff61c209 make things work, sorta kinda (I lost track) 2022-01-02 23:46:58 +01:00
18c7629451 * proper check for whether direct boot is required
* proof-of-concept cart insert/eject. it works!
2022-01-02 15:09:09 +01:00
9529356062 more WIP. ROM loading working, sorta. not loading saves or anything yet. 2021-12-29 15:42:30 +01:00
aa443c6bce more work. also, make archive shito somewhat better. 2021-12-26 00:46:24 +01:00
3383c396cd committing WIP. won't build or anything. 2021-12-23 13:20:26 +01:00
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
19ddaee13b finally decouple Config from the core. baahhahahahah 2021-11-18 01:17:51 +01:00
65c2a844ac oops 2021-11-17 23:23:22 +01:00
5bb8f4c922 * remove more Config dependencies from the core
* also use less shitty strings
2021-11-17 20:42:11 +01:00
c1dcd585be decouple JIT from Config. bahahahahah 2021-11-17 18:15:50 +01:00
e121953c9a more complete (and accurate) CP15 setup for direct boot 2021-10-28 21:15:12 +02:00
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
737171c906 implement margins for scheduler
hopefully this does not break anything
2021-09-27 03:30:15 +02:00
d20543c119 DMA timing renovation (#1207)
* 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.
2021-08-31 02:28:34 +02:00
e7f0923623 maybe don't leave in debug code, you derp 2021-08-30 20:28:51 +02:00
523552a92d actually make DSi-mode direct boot work to some extent 2021-08-30 20:26:49 +02:00
418b351986 SPU: Emulate SOUNDBIAS and 10-bit degrade 2021-08-17 01:01:15 +02:00
bba14b2bb0 fix pissfucking touchscreen (again) 2021-08-08 14:45:16 +02:00
b1c2665c39 NWRAM & Direct Boot (#1149)
* 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>
2021-07-23 12:21:54 +02:00
98072d82bf shut up DSi-IO warnings 2021-07-17 18:26:56 +02:00
dd53b01f76 only recalculate GBA slot timing if necessary 2021-06-27 00:45:21 +02:00
f94b784c4d Use printf format macro here 2021-06-07 20:51:51 +01:00
21f5477450 PRIu64 requires inttypes.h to be included 2021-06-05 03:34:39 +02:00
f74387a8c1 Implement NO$GBA debug registers. (#1110)
* 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
2021-05-27 12:15:16 +02:00
50721719d2 GBACart: simulate open-bus decay roughly. fixes #1093 2021-05-04 12:58:59 +02:00
2ff065e5ea Fix some compiler warnings 2021-05-03 13:40:44 +01:00
1846a71265 Cart refactor (#1073)
complete cart-interface refactor, will make this code a lot easier to deal with
2021-04-25 00:48:02 +02:00
436b3c4c1d update copyright year and add missing GPL headers 2021-03-12 20:07:40 +01:00
a046eb5038 separate GPU2D registers and renderer 2021-02-27 22:25:42 +01:00
03b465c5e2 Fix edge case in the division engine, fix edge case in the CPU (#1003)
* 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)
2021-02-19 23:58:41 +01:00
a7029aebae Allow for a more modular renderer backends (#990)
* 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.
2021-02-09 23:38:51 +01:00
b78bc4cb66 fixes to the threadedness of the sw rasteriser
also fix #639 and fix #880
2021-01-26 16:42:27 +01:00
1e4c0c9d72 Polish up archive support (#930)
* 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.
2021-01-22 11:22:32 +01:00
d42ca1ec4b Implement "lag frame" flag and counter (#949)
* 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.
2021-01-21 21:26:27 +01:00
bf97387f26 Improved SRAM performance (#925)
* 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
2021-01-09 22:18:57 +01:00
fa4363ede6 make FIFO size static whene possible 2020-12-30 23:37:46 +01:00
0f353e0d5f add palette and OAM dirty flag
currently not used anywhere
2020-12-23 09:23:46 +01:00
49317e9165 don't axe error bits when writing to IPCFIFOCNT. fixes #801 2020-12-11 18:06:26 +01:00
1dbe69c6be remove some debug crap 2020-12-10 18:09:11 +01:00
129018a662 Merge remote-tracking branch 'remotes/origin/master' into dsi_camera 2020-12-04 18:28:15 +01:00