Commit Graph

2082 Commits

Author SHA1 Message Date
BearOso 1085ed6fad Remove Settings.SupportHires
There's no point in disabling it at this point, so it's always supported.
2022-04-13 15:06:13 -05:00
BearOso 7cbe92afa0 Use MAX_SNES_HEIGHT, not SNES_HEIGHT_EXTENDED. 2022-04-12 18:45:33 -05:00
bearoso 730b933126
Merge pull request #760 from realnc/fix-libretro-runahead-audio
libretro: Fix audio not being submitted when rendering is disabled
2022-04-12 10:19:06 -05:00
Nikos Chantziaras 1ea6ef5061
libretro: Fix audio when video rendering is disabled
In commit 6628042fe3, audio upload was
moved from retro_run() to S9xDeinitUpdate(). This breaks audio when
runahead is enabled in RetroArch.

With second-instance runahead, S9xDeinitUpdate() is not called when
video rendering is disabled and thus the core instance responsible for
audio is not uploading the audio. With single-instance runahead, audio
is uploaded twice because video rendering is always enabled and thus
S9xDeinitUpdate() gets called twice per frame.

Fix this by introducing a callback that gets called at the end of every
screen refresh, regardless of whether or not rendering is active for
this frame. We can then decide in the callback whether or not audio
should be uploaded.
2022-04-12 16:08:54 +03:00
BearOso 6628042fe3 libretro: Get audio samples during frame callback. 2022-04-11 16:04:29 -05:00
BearOso ba472fe3ef Actually use buffer_size. 2022-04-10 21:04:56 -05:00
BearOso 4f634fcfb2 Adapt to non-contiguous GFX.Screen. 2022-04-10 18:31:36 -05:00
BearOso cd3aba52dd Add cast. 2022-04-10 18:20:59 -05:00
BearOso 568991681d Attempt to blindly fix MacOS. 2022-04-10 18:16:16 -05:00
BearOso a953721967 win32: Adapt to GFX.Screen in core. 2022-04-10 17:26:32 -05:00
BearOso aa6abace40 Create output buffer in core.
TODO: Fix Windows.
2022-04-10 16:41:16 -05:00
BearOso 784667f5b2 Gtk: Update gtk_file.cpp for modern C++
Uses std::filesystem and std::string.
2022-04-09 17:19:01 -05:00
BearOso 78d006ffdb cirrus.yml: Add cmake dep to Gtk build. 2022-03-24 16:41:39 -05:00
BearOso b759ebbf19 Gtk: Lower meson required version. 2022-03-24 16:37:35 -05:00
BearOso 8b0cc9ae52 Gtk: Add missing CMake options. 2022-03-24 16:33:20 -05:00
BearOso a4cf41e879 Gtk: Add CMake as build option. 2022-03-24 12:21:52 -05:00
BearOso 17cb084df0 Gtk: Experiment with symlink. 2022-03-22 14:09:30 -05:00
BearOso 0a20681778 libretro: Send all samples at frame end. 2022-03-21 18:31:28 -05:00
BearOso 2262544c4e libretro: Sound buffering change. 2022-03-21 14:53:21 -05:00
BearOso 93d538dfaf Fix errant h. 2022-03-18 16:12:15 -05:00
BearOso 470e55650a win32: Adjust to moved external deps. 2022-03-18 15:50:05 -05:00
BearOso fe5fbb0c80 Gtk: Fix compile with moved deps. 2022-03-18 15:49:54 -05:00
BearOso 88f4d66de8 Move GPU related submodules to external. 2022-03-18 15:49:29 -05:00
BearOso a8fafcd94c Gtk: Clean up a couple sound drivers.
Make them more idiomatic C++.
2022-03-12 11:19:39 -06:00
BearOso 0a94eaa6dc Revert "LoROM: Don't map SRAM if size is 0."
This reverts commit 386bfe0aa9.
2022-03-07 11:28:19 -06:00
bearoso 7e97bb59a1
Merge pull request #738 from ds22x/master
[Libretro] Create a separate aspect ratio option for "4:3 Preserved"
2022-03-03 10:41:25 -06:00
BearOso 1041ff3e24 Gtk: Add Ukrainian translation from StanleyKid-22. 2022-03-01 18:22:03 -06:00
bearoso 29d319ad78
Merge pull request #735 from jSTE0/microopt
Microoptimisations from jSTE0
2022-02-21 17:47:02 -06:00
bearoso f9687e5350
Update changes.txt
Fix typo.
2022-02-19 13:28:33 -06:00
BearOso f95c9aacd9 Update changes.txt 2022-02-19 13:24:55 -06:00
BearOso 8f5afb1013 gtk: Initialize jd 2022-02-19 13:22:20 -06:00
bearoso 17e75b1469
Merge pull request #741 from jraby/gtk-joystick-hotplug
gtk: Support adding/removing joysticks at runtime
2022-02-19 13:20:38 -06:00
Jean Raby 65d41e7b37 joynums.fill(false); 2022-02-18 16:12:19 -05:00
Jean Raby 38b1e495ea Move joystick + related functions under JoyDevices 2022-02-18 15:43:52 -05:00
bearoso 32347eb6a9
Merge pull request #737 from jraby/fix-relative-paths-savestates
gtk: fix handling of relative paths for save states
2022-02-18 13:57:00 -06:00
Jean Raby e1685b05eb range-based for loops + simplify joynum assignment 2022-02-18 11:08:20 -05:00
Jean Raby cdbf783fc4 gtk: Support adding/removing joysticks at runtime
Reworked how/where SDL events are polled:
  - poll_joystick_events is now a static member of JoyDevice so it can be
    called from outside when needed (preference window for config and
    caliration).
  - S9xProcessEvents calls JoyDevice::poll_joystick_events directly so
    events are polled when no joysticks are attached.
  - JoyDevice::poll_joystick_events handles SDL_JOYDEVICE{ADDED,REMOVED}
    events.
  - Individual JoyDevice no longer call poll_joystick_events from
    get_events.

Reworked how attached joysticks are maintained in Snes9xConfig:
  - Use a map for joysticks keyed on SDL JoystickID (instance id in sdl
    parlance), which is stable while a joystick is attached instead of
    an array keyed on device_index.
    The instance id is what poll_joystick_events gets with every
    event (except for SDL_JOYDEVICEADDED which gets a device_index...)
    Instance id is an incrementing int starting from 0, they are never reused.
    i.e. each attach/dettach/attach cycle yields a new id.
    Whereas device index are reused and can "move".
  - On SDL_JOYDEVICEADDED the joystick is handed a "joynum", that is, an
    int from 0 to NUM_JOYPADS-1. A new joystick always get the lowest
    available joynum.
    (joynum was already a member of JoyDevice but wasn't initialized,
    this seemed like a proper way to use it.)
  - On SDL_JOYDEVICEREMOVED, the joystick associated with the instance
    id is simply removed from the map.

All this allows for the following behaviors.
It is possible to start without any joystick, add one joystick and it works.
(disconnect/reconnect cycles with a single joystick also work)

Joystick numbers are "stable" while they remain connected. For example:
 - Start with joystick0 and joystick1 connected
 - if joystick0 is disconnected, joystick1 keeps its number and keeps
   working
 - if joystick0 (or any new joystick) is connected at this time,
   it gets to become joystick0

If all joysticks are disconnected while snes9x is running, the order of
the "reconnections" will determine the joystick number of each joystick.

I think there is room for improvement still, with regards to code
organization. For instance, there could be a "JoyDevices" class which
would handle all the attached JoyDevice. This would allow moving all the
"joystick_*" methods from Snes9xConfig to that new class, and
poll_joystick_events could also be moved there.
The functionality wouldn't change, but the intent/ownership would probably be clearer.
2022-02-17 11:02:53 -05:00
ds22x 054e2f55b1 Add missing translated entry 2022-02-14 13:49:35 +01:00
ds22x eb7ddae407 Create a separate aspect ratio option for '4:3 Preserved' 2022-02-14 13:44:49 +01:00
Jean Raby e6118290e2 gtk: Simplify S9xOpenSnapshotFile
This is basically what osx and libretro do, just use the provided
filename.
The code this replaces had a hard time handling relative paths,
it would prepend the leading directories to fname, which would
most of the time resolve to an invalid path.
(e.g ./roms/romname.000 -> ./roms/roms/romname.000)
2022-02-13 21:57:58 -05:00
Jean Raby c81d3baca1 gtk: save_state_dialog - use filename without dir 2022-02-13 21:56:42 -05:00
OV2 d7dc9acf2f win32: stop trying to send audio data after device removal 2022-02-14 01:05:57 +01:00
jSTE0 96059dd45a dsp1: Optimise copying registers on LE platforms
Use {READ,WRITE}_WORD so that it copies by word on little-endian
platforms. This also fixes a bug in the assignment of Op11Xr which was
a regression introduced in snes9x-1.40.
2022-02-11 23:32:31 +00:00
jSTE0 242238a610 fx: Optimise copying registers on LE platforms
Use {READ,WRITE}_WORD so that it copies by word on little-endian
platforms. Mark a LUT const for const-correctness.
2022-02-11 22:48:10 +00:00
jSTE0 104769cec0 dsp1: Use clz CPU instruction when normalising fixed-point numbers
Use the gcc built-in GCC function, making the operation constant-time
and branch-free. Verified on x86 and ARM.
2022-02-04 22:55:06 +00:00
jSTE0 423361e4d1 dsp: Mark function-scope const arrays as static
Avoids recreating the arrays on the stack on every entry to the function
and moves them to the ro section.
2022-02-04 22:52:50 +00:00
jSTE0 305cafc8c8 gfx: Use simpler equality test for IPPU.FrameCount
As it's only incremented here and then reset to 0, avoids integer
division, which can be be expensive on CPUs without this instruction
such as pre-ARMv7 classic ARMs.
2022-02-04 22:48:48 +00:00
bearoso f1ac3dc6d3
Merge pull request #734 from realnc/fix-43-aspect-ratio-upstream
libretro: Fix 4:3 aspect ratio to actually be 4:3 regardless of cropping
2022-02-02 16:13:37 -06:00
Michael Buckley f73ef51014 Mac: Set marketing version to 1.61 2022-02-02 10:58:18 -08:00
Michael Buckley 68f536dcbe Revert "Mac: prefer integrated GPU"
This reverts commit cf1a5901fc.
2022-02-02 10:53:32 -08:00