Commit Graph

2159 Commits

Author SHA1 Message Date
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
Nikos Chantziaras 1d1140db1c
libretro: Fix 4:3 aspect ratio to actually be 4:3 regardless of cropping 2022-02-02 20:13:17 +02:00
BearOso 8b1f127404 Add scanline timing for Full Throttle Racing. 2022-01-31 19:47:21 -06:00
BearOso d4cec8eb2a Gtk: Wayland: Use older wayland API for compatibility. 2022-01-31 16:56:17 -06:00
BearOso 41fb9eb4c4 Set SRAM initialization to set whole buffer, not just a few bytes.
Add a TODO comment at allocation. These never change, so they should
ideally be static.
2022-01-31 16:39:04 -06:00
BearOso da23559f2f Gtk: Add wayland-client as wayland dep. 2022-01-31 16:32:27 -06:00
BearOso 8ed8fdab86 Update changes.txt. 2022-01-31 16:21:29 -06:00
BearOso 12e19abbe9 Unix: Regenerate configure. 2022-01-31 16:18:33 -06:00
BearOso 111b92ca58 Unix: xvideo: Prefer RGB then YUY2 then I420. 2022-01-31 16:15:42 -06:00
bearoso 951de39c87
Merge pull request #727 from cjacker/master
Add alsa sound output and I420 Xvideo image format support for unix CLI.
2022-01-31 16:10:44 -06:00
OV2 13d68ad3cc Update changes.txt 2022-01-31 17:59:50 +01:00
OV2 bdb27635e0 win32: fix frame advance hotkey no longer working after 25 days
(fixes #716)
2022-01-31 17:29:01 +01:00
BearOso f56b1e7668 Gtk: Wayland: Add idle inhibitor. 2022-01-30 21:23:33 -06:00
BearOso 2bc5302478 Add ability of FastROM hacks to use SuperFX. 2022-01-30 20:17:52 -06:00
BearOso a4efafbd2e libretro: Fix interaction with Blargg filter and hires. 2022-01-30 20:03:34 -06:00
BearOso 82891ce976 changes.txt: Add some unix port changes. 2022-01-30 18:40:32 -06:00
BearOso c8ffda83e7 Gtk: Set default background to starfield. 2022-01-30 18:34:51 -06:00
BearOso 71da4e3c07 Update changes.txt. 2022-01-30 18:30:11 -06:00
BearOso eb2c993a91 Update version and copyright for 1.61. 2022-01-30 17:52:50 -06:00
BearOso 34b6160805 pulseaudio: Fix potential stall with Pipewire
Pipewire allows very small buffer sizes. It's possible that Snes9x
will accumulate enough samples in fast-forward to exceed this.
Instead of waiting forever for the buffer capacity to free up, just
write the number of samples for the free space after one small wait.
2021-12-20 12:21:43 -06:00
OV2 a283596722
Merge pull request #728 from Jamiras/custom_frame_advance
fix custom key bind for frame advance
2021-12-13 21:40:10 +01:00
Jamiras 32f3f81a2c fix custom key bind for frame advance 2021-12-13 13:24:45 -07:00
Cjacker a57531b9f8 fix realloc error 2021-11-25 21:34:51 +08:00
Cjacker bd996da4af Add I420 Xvideo image format support, with both libyuv hardware acceleration and software conversion support. 2021-11-23 15:59:38 +08:00