Commit Graph

6467 Commits

Author SHA1 Message Date
thesource 79abd40913 Update menu state on setting frameskip value and also print new value 2021-11-01 21:46:18 +00:00
zeromus 8461e2f08d fix bug where windows frontend stopped processing hotkey input from gamepads while paused (fixes #479) 2021-10-28 03:15:15 -04:00
zeromus 021fcdd0de
Merge pull request #478 from rofl0r/cli_fix
fix/improve CLI frontend
2021-10-27 10:06:40 -04:00
rofl0r 7db8f4fcd6 sdl: use emu_halt before loading savestates, just like win32 2021-10-26 16:56:42 +00:00
rofl0r d3dee7ce9c cli: disable jit when using gdb stub 2021-10-26 16:56:42 +00:00
rofl0r 65a280618b cli: turn off sound when entering gdb stub 2021-10-26 16:56:42 +00:00
rofl0r 9f4e6992fb simplify/fix sdl2 sound backend, fixes no audio in CLI
- simplified ring-buffer mechanism
- added proper locking for all variables accessed by 2 different threads
- fixed oob writes that occassionally crashed SDL's "Alsa Hotplug thread"
- make buffer sufficiently large to prebuffer enough samples to survive
  the occassional SDL_Delay(1) in the frontend.
- fixed ignoring volume set by the SPU.
- improved speed and robustness by not calling malloc over and over in
  SDL callback, and copying directly to the SDL buffer if volume is max
  (no need to use mixer to lower the volume in that case).
2021-10-26 16:56:42 +00:00
rofl0r 09506c9a19 cli: add fullscreen toggle with alt-enter 2021-10-26 16:56:42 +00:00
rofl0r 9868c00fca cli: add --horizontal command line option
this option puts the touchscreen to the right, allowing higher scales
on widescreen monitors.
2021-10-26 16:56:42 +00:00
rofl0r 90326ea1f9 cli: add scaling
the new command line parameter --scale allows to scale the window by
a floating point factor. SDL2 stretches it in hardware to the desired
size, which makes the scaled window run at almost identical speed to
1x scale.
2021-10-26 16:56:42 +00:00
rofl0r b685818413 cli: fix FPS display
1) the float format displayed like 50.123456789123456 wouldn't fit
   into the window title bar, and
2) most likely not into the char buffer of length 20, of which half
   was already used for the desmume string.
2021-10-26 16:56:42 +00:00
rofl0r 699f63d688 cli: user proper SDL2 OpenGL-accelerated rendering primitives
additionally:
- don't allocate memory for surfaces and textures over and over
- use one texture for each NDS screen - this allows to easily
  add support for horizontal screen layout.
2021-10-26 16:56:42 +00:00
rofl0r 7e0336d57d cli: re-add ability to set frameskip
the command line option existed once, but was turned off when a
new generic commandline parser class was introduced. the entire
array in main.cpp using custom commandline options is currently
unused.
2021-10-26 16:56:42 +00:00
rofl0r d07bdedbd6 cli: remove unused and broken OPENGL2D code
this code was broken since the switch to SDL2, but nobody noticed
because the new meson build system doesn't set HAVE_GL_GL_H.
2021-10-26 16:56:42 +00:00
rofl0r a2c6a789ad cli frontend: fix mouse input
there were 2 logical issues which caused reproducible misbehaviour.
for example when starting up pokemon soulsilver, one can click away
the intro, but it's not possible to click on the "load savegame"
icon.
the issues were:

1) failure to record whether the down event has been
passed to the emulator before abandoning it and turning it into
a click event (on a fast click, both events would happen during
the same SDL_Pollevent loop), and
2) mouse coordinates were discarded and unless the mouse down
event was registered. that means if the down and up events happen
on the exact same coordinate, the .x and .y of the mouse weren't
updated at all.
2021-10-26 16:56:42 +00:00
zeromus 086112c4b5 isSwapBuffers is savestated with a size set to 4, so it needs to be a u32 and not a BOOL 2021-10-25 23:00:25 -04:00
zeromus 43b00fb2a0 fix some sloppy stuff in wifi that made its savestates unreliable 2021-10-25 20:07:51 -04:00
zeromus fe8c424c4a fix gdbstub compiling on windows 2021-10-25 20:04:35 -04:00
zeromus b8bed7082b
Merge pull request #477 from rofl0r/gdbstub_block
Gdbstub improvement, fix 100% cpu use in cli frontend
2021-10-24 21:07:12 -04:00
rofl0r 339ea16b15 gdbstub_wait(): add timeout parameter
this is probably helpful for frontends other than cli that have to repaint
and react on events in the user interface, so they can set a timeout like
100 ms, or simply poll whether the stub is active using timeout 0.
2021-10-24 15:39:01 +00:00
rofl0r ed5ff51c0c gdb stub: since debug info is printed anyway, show the actual command 2021-10-24 15:38:55 +00:00
rofl0r d5693c54cf cli frontend: fix 100% cpu when using gdb stub
the emulator thread was consuming 100% cpu even when the debugger was
active and execution paused.

a second pipe was added to gdb stub, which allows communication in
direction stub -> emulator/frontend, and also to infinitely block
in the frontend until the debugger returns control, for example
by typing "c" (continue) in gdb.

the other frontends use an inefficient method of running usleep(1000)
or similar in a loop, which will cause high cpu usage too, albeit not
a full 100% but more like 10-20%.

in order not to fill up the pipe with data for frontends that don't use
this mechanism, the functionality needs to be explicitly enabled.
(see functions added to gdbstub.h)

the functions added could in theory also be used to communicate
other data to the frontend, and optimally even replace all the locking
between the 2 sides.
2021-10-24 15:38:50 +00:00
rofl0r dbc1f06662 gdbstub: remove more WIN32 ifdefs, refactor pipe setup code to be re-usable 2021-10-24 15:38:44 +00:00
rofl0r 747f7b114b NDSSystem: replace GDB_STUB ifdefs with macro 2021-10-24 15:38:38 +00:00
rofl0r 70a1727bd5 gdbstub: improve readability by using less ifdef WIN32 2021-10-24 15:38:31 +00:00
rogerman 7fc2e4b6b6 GPU: Only perform window testing when the relevant window states actually change. 2021-09-22 13:24:05 -07:00
zeromus 2fb06cf4cc
Merge pull request #472 from MathyFurret/patch-1
Disassembler: Fix LDR/STR immediate offset
2021-09-21 15:52:18 -04:00
rogerman f42975aa4d GPU: Remove some dubious or now obsolete templates for OUTPUTFORMAT. Shouldn't affect performance, but does slightly decrease the code size. 2021-09-21 11:40:09 -07:00
Alexander B db7bfdb185
Disassembler: Fix LDR/STR immediate offset 2021-09-21 12:10:58 -05:00
rogerman b02dd3afaf GPU: Do some more refactoring, mostly related to applying the master brightness. 2021-09-20 23:14:49 -07:00
rogerman 173e2ae6e7 GPU: Do some code refactoring. 2021-09-20 19:10:29 -07:00
rogerman 4afbb18eab GPU: Correctly resolve the 18-bit and 24-bit colorspaces to 32-bit when auto-resolving is enabled. Fixes #471.
- Also revert commits e1cadfe and 77d38b1. Using masterNativeBuffer16 was the correct choice here after all.
2021-09-20 15:06:34 -07:00
rogerman d6e80e7864 OpenEmu Plug-in: This frame buffer also needs to use masterCustomBuffer because it's running 18-bit color space. 2021-09-20 11:12:19 -07:00
rogerman e1cadfe112 Linux Port (CLI): Oops! Wrong buffer... 2021-09-20 11:04:12 -07:00
rogerman 77d38b15b1 Linux Port (CLI): Take a shot in the dark at #471, but I have no way to test it.
- It's a regression from commit 4578728. I'm suspecting that this particular buffer is to be read as 32-bit since all of the other Linux frontends explicitly used 16-bit except for this one.
2021-09-20 11:02:24 -07:00
rogerman 004ec526aa GPU: Completely revert commit a948838. I forgot that Zelda PH and Zelda ST could use both GPU engines for the same display when moving the map to and from the touch screen, and so native line tracking MUST be performed at the display level in order to account for this.
- Added some additional comments so that I'm not tempted to change the native line tracking paradigm ever again.
- Do some refactoring to make GPUEngineBase::_targetDisplay handle more buffer associations itself instead of relying on GPUEngineBase's copies of the associations.
2021-09-20 01:23:06 -07:00
rogerman d626bad6bd Fix broken builds due to commit 45787281. 2021-09-18 23:01:20 -07:00
rogerman 4578728120 GPU: Change the rendering paradigm where, rather than performing inline colorspace conversions during rendering, all rendering is performed at 15-bit until 3D rendering or 24-bit custom VRAM creates the need for a color space conversion.
- For purposes of maintaining a record and make for easier reversions, the code has NOT been fully optimized or cleaned up. This will happen over a period of time as the code settles down through testing.
- All "native" buffers are no longer assumed to be in any color space and are now assumed to always be 15-bit. The native buffers are now referenced using uint16_t pointers and are now suffixed with "16" in order to reflect this change.
- Of note, all clients that reference masterNativeBuffer or nativeBuffer via NDSDisplayInfo must now assume that these native buffers will always be in the 16-bit color space.
- Any 18-bit and 24-bit rendering now happens in the custom buffers.
2021-09-18 22:36:40 -07:00
rogerman c082782fa9 GPU: Fix main memory capture on big-endian systems when running 15-bit and 18-bit mode.
- 24-bit mode is still bugged on big-endian systems. This will be fixed at a later date.
2021-09-18 20:35:51 -07:00
rogerman 7dd98ddb45 GPU Operations: Fix a bug where running 18-bit color, 24-bit color, or a custom framebuffer size would cause a crash on systems without SSE2 or AVX2. (Regression from commit 0db9872.) 2021-09-18 15:44:42 -07:00
rogerman 5b1eb55351 GPU Operations (SSE2): Apply the same code optimizations to the PixelOperation_SSE2::_unknownEffectMask16() and PixelOperation_SSE2::_unknownEffectMask32() methods as their corresponding AVX2 versions.
- Also fixes a bug in PixelOperation_SSE2::_unknownEffectMask32() that would cause 3D layers to appear black if the user was running 15-bit color mode. (Regression from commit 0db9872.)
2021-09-18 13:57:07 -07:00
rogerman 9ace87207d FIFO: Fix a bug where running 18-bit or 24-bit color depth would cause a buffer overrun. (Regression from commit 329eade.) 2021-09-16 18:36:42 -07:00
rogerman 07aadb462e GPU: Partially revert commit a948838. It still bothered me that native line tracking wasn't individually handled for rendered lines and displayed lines, and so this paradigm has been restored. However, native line tracking continues to be handled purely with GPUEngineBase.
- GPUSubsystem::ClearWithColor() also now handles clearing the master framebuffer with better specificity.
2021-09-16 15:24:23 -07:00
rogerman c6d35f9894 Cocoa Port: Metal display views can now handle the possibility where the fetched main and touch display framebuffers are in different colorspaces. 2021-09-16 15:16:37 -07:00
zeromus ff28ca6df5
Merge pull request #468 from anlsh/master
Enable "Save state to" and "Load state from" functionality in GTK
2021-09-14 23:16:48 -04:00
Anish Moorthy 4754987279 Suggest proper file extension for save dialog 2021-09-14 23:11:49 -04:00
Anish Moorthy 71ed1ca073 Redraw screen in after loading state from file 2021-09-14 23:11:49 -04:00
Anish Moorthy fffd574aae Disable save/load actions when there is no ROM, but menu is still clickable 2021-09-14 23:11:49 -04:00
Anish Moorthy 98a1c58db7 Make "Load state from" pressable on linux 2021-09-14 23:11:49 -04:00
Anish Moorthy 91b2e22894 Make "Save State To" pressable, even if sometimes broken 2021-09-14 23:11:49 -04:00