Commit Graph

495 Commits

Author SHA1 Message Date
BearOso 2e39f2f477 Modernize cheat stuff. 2023-03-07 13:58:21 -06:00
BearOso c69552ccff More cleaning. 2023-03-07 13:58:21 -06:00
BearOso 596e84af2a Start simplifying filesystem stuff. 2023-03-07 13:58:21 -06:00
BearOso 4a3f7b4d84 Gtk: Use more std::filesystem. 2023-03-07 13:58:21 -06:00
BearOso b9bb200a78 Gtk: Reorganize some of startup. 2023-03-07 13:58:21 -06:00
BearOso 19c7ce56e0 Gtk: Use fmt for string. 2023-03-07 13:58:21 -06:00
BearOso 375a263961 Gtk: Stringify some things. 2023-03-07 13:58:21 -06:00
Gutawer 7321eb3320 Gtk: Fix some keys not being usable with modifiers 2023-01-25 17:04:25 +00:00
Nick Burtner 86ab38408c Fixes issue where non-archive msu-1 files would have improper file extensions 2022-11-01 17:50:21 -04:00
BearOso 8c0a4a4168 Gtk: Fix replacing last directory component instead adding filename 2022-04-30 12:37:07 -05:00
BearOso f3fafab8b3 Remove unused logger.cpp and logger.h. 2022-04-25 15:45:39 -05:00
BearOso 3c729a9763 Gtk: Remove option to disable OpenGL.
OpenGL is the optimal display mode until Vulkan is in, and it's
mandatory on Wayland. Don't let it be disabled.
2022-04-19 17:22:42 -05:00
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 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 a4cf41e879 Gtk: Add CMake as build option. 2022-03-24 12:21:52 -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 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
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
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
BearOso d4cec8eb2a Gtk: Wayland: Use older wayland API for compatibility. 2022-01-31 16:56:17 -06:00
BearOso f56b1e7668 Gtk: Wayland: Add idle inhibitor. 2022-01-30 21:23:33 -06:00
BearOso c8ffda83e7 Gtk: Set default background to starfield. 2022-01-30 18:34:51 -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
BearOso cf2d1bf791 Gtk: OpenGL: Fix non-PBO output path. 2021-05-15 11:23:12 -05:00
BearOso da4bd2a018 Gtk: Make sound driver check a little simpler. 2021-05-15 11:23:12 -05:00
BearOso 364aa1ba5d Gtk: OpenGL: Use correct screen for fbconfig. 2020-11-04 13:11:28 -06:00
BearOso 77fb6ff958 Gtk: Unthread preferences creation. 2020-11-04 12:55:25 -06:00
BearOso 2bab4c41b1 Revert "Gtk: OpenGL: Try to ensure window is mapped."
This reverts commit c4a269b32a.
2020-11-04 12:54:44 -06:00
BearOso b4de90a0f1 Revert "Gtk: Reorder init."
This reverts commit a9a9b0fafb.
2020-11-04 12:41:55 -06:00
BearOso a9a9b0fafb Gtk: Reorder init.
This should give the window time to create, and we ensure Gtk
has a main loop iteration so it's done.
2020-11-04 12:10:30 -06:00
BearOso c4a269b32a Gtk: OpenGL: Try to ensure window is mapped. 2020-11-04 12:03:28 -06:00
BearOso c283df610c Fix misspelling.
Complement, not compliment.
2020-11-03 10:28:01 -06:00
BearOso 2fc8b40e0e Gtk: Fix '&' in rom info dialog. 2020-08-24 14:21:24 -05:00
BearOso 6d1d0ab121 Gtk: Still use theme icon if available. 2020-08-23 17:47:27 -05:00
BearOso 4c3d043880 Gtk: Update built-in mini-icon. 2020-08-23 17:46:25 -05:00
BearOso 1fc5a2d4d6 Gtk: Fix crash when no icon is found. 2020-08-23 17:17:55 -05:00
BearOso 95c7fdad1f Gtk: Thread preferences creation. 2020-08-23 16:28:01 -05:00
BearOso a3c0c4621d Gtk: Don't pass arguments to gtkmm application.
It tries to usurp the filename argument.
2020-08-09 14:28:20 -05:00
BearOso e705e71a97 Remove S9xChooseMovieFilename
This is integration of the frontend with the core. Disable
the button mappings that use it. The frontend should implement on
its own.
2020-08-07 14:08:51 -05:00
BearOso f04f1bbe44 Remove S9xChooseFilename
This is integration of the frontend with the core. Disable
the snapshot button mappings that use it. Any frontend should
implement those port commands its own.
2020-08-07 14:08:51 -05:00
BearOso 063b3a959c Move _splitpath and _makepath into core. 2020-08-07 14:08:51 -05:00
BearOso e322bbf109 Remove S9xSetPalette 2020-08-07 14:08:51 -05:00
BearOso bdd061847e Gtk: Fix recent menu. Add game name to title. 2020-07-30 18:24:54 -05:00
Brandon Wright fd88971598 Gtk: Don't expand shader parameter widgets. 2020-07-27 17:58:03 -05:00
Brandon Wright e17ff69533 Gtk: Switch codebase to gtkmm.
GTK: Remove support for GTK+ 2.0.

GTK 3 is stable and widespread enough now.

GTK: Rearrange headers to eliminate gtk_s9xcore.h

Gtk: Initial gtkmm conversion work.

Gtk: More gtkmm conversion and bug fixing.

Gtk: More gtkmm fixes.

Gtk: More Fixes

OpenGL no longer creates a second window.
Accelerators are fixed.

Gtk: More fixes

Removed GLX context dependency on Gtk.

Gtk: Fix formatting.

Gtk: Remove a #pragma once
2020-07-17 14:48:34 -05:00
Brandon Wright 3c3ea985ef GTK: Refactoring of display output code.
Moves buffer management to single location.
2020-06-30 17:28:10 -05:00
Brandon Wright 0f0914cca5 GTK: Config code cleanup. 2020-06-21 15:25:54 -05:00
AlexApps99 9e91d9d8ae Fixed sound playing while in turbo after pause
(this may break other aspects of audio around pausing)
2020-06-21 22:02:08 +12:00
AlexApps99 4f3e6681ef Added rewind to turbo mute 2020-06-21 21:46:27 +12:00
Brandon Wright 5c3fbf6740 Fix some warnings.
Removed sstrncpy function.
Changed bindings in GTK port to std::array and fixed packing nonsense.
2020-06-20 10:44:11 -05:00
Dan Church c5bd183b2b
Fix GCC unused function/variable warnings 2019-11-14 10:39:02 -06:00
Brandon Wright 0258422be8 GTK: Oops. Add particle files. 2019-11-10 12:46:40 -06:00
Brandon Wright 19f7423f42 GTK: Add a couple animated background splashes. 2019-11-08 17:05:36 -06:00
Brandon Wright 00da664a60 GTK: Don't change config directory mode every time.
This triggers something laggy in GNOME environment.
2019-10-10 18:50:36 -05:00
Brandon Wright ee6463a30f GTK: Pass a burst phase to Blargg NTSC blitter.
It's supposed to alternate 0, 1, 2.
2019-09-14 19:52:35 -05:00
Brandon Wright 673896f7aa GTK: Xv: Add a couple of error checks. 2019-09-08 12:45:18 -05:00
Brandon Wright 4a8e6f204a gtk: Add explanation to both includes. 2019-07-16 11:21:58 -05:00
Brandon Wright c3388602bb gtk: Undef vector and bool after SDL.h 2019-07-16 11:16:10 -05:00
Brandon Wright 6fbdb48c6f GTK: Tweak onscreen 'g' a bit. 2019-06-26 16:42:30 -05:00
Brandon Wright 1580c5f00f GTK: Add explicit operator= to binding
Silences a new warning in GCC 9. implicit operator= is now
deprecated.
2019-06-19 12:15:36 -05:00
Brandon Wright cb7602263f GTK: Fix a label alignment. 2019-05-31 14:53:21 -05:00
Brandon Wright f8a0fadfa1 GTK: Use C++ memory allocation. 2019-05-14 15:34:25 -05:00
Brandon Wright 124594d220 GTK: Use a struct for S9xApplyAspect output.
Reusing the parameters is likely confusing.
2019-05-14 14:59:51 -05:00
Brandon Wright 9a1d3eccfc GTK: Fix positioning, label detail. 2019-05-12 09:56:23 -05:00
Taimoor Ahmad f3da1c9496 Add show time option to GTK UI. It is disabled by default. 2019-05-11 23:30:10 -04:00
Taimoor Ahmad d16c9775a9 Only show if DisplayTime is enabled in settings 2019-05-11 23:24:17 -04:00
Brandon Wright 993ffed6a3 GTK: Tweak spin button widths. 2019-04-20 15:55:43 -05:00
Brandon Wright 7dc9ba8215 GTK: Invert invalid vram access checkbox. 2019-04-16 15:41:04 -05:00
Brandon Wright 9c733497fe GTK: Allow shutting off button and menu icons. 2019-04-16 11:47:35 -05:00
Brandon Wright 85326c8daf GTK: Update strings. Translate some español. 2019-04-13 16:28:42 -05:00
Brandon Wright a820272191 GTK: Save echo buffer hack value.
Sanitize overclock settings when UI doesn't make them available.
2019-04-13 15:54:41 -05:00
Brandon Wright c3bc6fff87 GTK: Add configurable initial background. 2019-04-13 15:47:01 -05:00
Brandon Wright e170bf66ca GTK: Add the hacks to UI. 2019-04-13 15:25:55 -05:00
Brandon Wright f70e072bd9 Revert to higher APU clock. 2019-04-12 12:10:51 -05:00
Brandon Wright b590ec10ab GTK: Use "Auto-patched" to clarify. 2019-04-10 14:51:01 -05:00
Brandon Wright ac4d458f7b Add Settings.IsPatched to know if ROM was patched. 2019-04-10 14:43:20 -05:00
Brandon Wright 0d4bcb55bc GTK: Fix up PortAudio output a bit. 2019-04-03 19:23:54 -05:00
Brandon Wright 51edec756f GTK: OpenGL: Don't spin with sync_control option. 2019-04-01 17:10:12 -05:00
Brandon Wright 656f085331 Another splash option. 2019-03-25 16:16:08 -05:00
Brandon Wright 0deed414b9 GTK: Remove mostly unused status bar.
Don't bypass compositor in UI-fullscreen mode.
2019-03-24 12:25:29 -05:00
Brandon Wright 54ba8798b5 GTK: Add right-click menu. 2019-03-22 16:51:48 -05:00
Brandon Wright 83505d88c2 GTK: Fix broken keys. 2019-03-22 11:59:50 -05:00
Brandon Wright bdf0e426e0 GTK: Allow one key for multi joypad assignments.
Lets you do stuff like Chrono Trigger L+R+A or all punch buttons in
fighting games.
2019-03-21 17:54:27 -05:00
Brandon Wright dfe66f57b3 GTK: Add new splash background options. 2019-03-21 16:37:00 -05:00
Brandon Wright cc1f6de281 GTK: Yes, we want button and menu images. 2019-03-20 11:54:16 -05:00
Brandon Wright 0306b68d2a GTK: Add some translation strings I missed. 2019-03-17 16:30:58 -05:00
Brandon Wright 4f0cc90525 GTK: Update splash background. 2019-03-16 13:45:38 -05:00
Brandon Wright 7dde81a77d GTK:OpenGL: Remove fences variable. 2019-03-06 11:10:06 -06:00
Brandon Wright 958a5d47db GTK: Fix clang-format thinking it's so smart. 2019-03-02 16:21:44 -06:00
Brandon Wright 92f2a9510f GTK: In mouse-grab mode, accumulate partial pixels. 2019-03-02 16:10:00 -06:00
Brandon Wright 7b310a0cf4 GTK: Swap glFenceSync for sync control extension. 2019-03-02 15:25:59 -06:00
Brandon Wright 70484ba612 GTK: Fix xBRZ scaler when multithreading enabled. 2019-03-01 19:57:38 -06:00
Brandon Wright 712c979771 GTK: Add icons to key bindings to clear entry. 2019-02-28 21:03:46 -06:00
Brandon Wright ef70758053 GTK: Use actual NTSC frame time. 2019-02-27 13:55:19 -06:00