Skip to content

Commit bef20de

Browse files
committed
A rather large fsemu update
1 parent 01a4309 commit bef20de

File tree

128 files changed

+7016
-2445
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+7016
-2445
lines changed

.vscode/c_cpp_properties.json

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"name": "Linux",
55
"includePath": [
66
"${workspaceFolder}",
7+
"${workspaceFolder}/fsemu/src",
78
"${workspaceFolder}/gen",
89
"${workspaceFolder}/src",
910
"${workspaceFolder}/src/jit",

Makefile.am

+46-21
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,12 @@ BUILT_SOURCES = \
136136
nodist_fs_uae_SOURCES =
137137

138138
fs_uae_SOURCES = \
139-
gamemode/lib/gamemode_client.h \
139+
src/fsuae/fsuae.h \
140+
src/fsuae/fs-uae.h \
140141
src/fsuae/fsuae-accelerator.c \
141142
src/fsuae/fsuae-accelerator.h \
143+
src/fsuae/fsuae-action.c \
144+
src/fsuae/fsuae-action.h \
142145
src/fsuae/fsuae-config.c \
143146
src/fsuae/fsuae-config.h \
144147
src/fsuae/fsuae-drives.c \
@@ -147,26 +150,27 @@ fs_uae_SOURCES = \
147150
src/fsuae/fsuae-graphics.h \
148151
src/fsuae/fsuae-hardware.c \
149152
src/fsuae/fsuae-hardware.h \
150-
src/fsuae/fsuae-model.c \
151-
src/fsuae/fsuae-model.h \
152-
src/fsuae/fsuae-sound.c \
153-
src/fsuae/fsuae-sound.h \
154-
src/fsuae/fs-uae.h \
155153
src/fsuae/fsuae-input.c \
154+
src/fsuae/fsuae-inputport.c \
156155
src/fsuae/fsuae-joystick.c \
157156
src/fsuae/fsuae-keyboard.c \
158157
src/fsuae/fsuae-main.c \
159158
src/fsuae/fsuae-menu.c \
159+
src/fsuae/fsuae-model.c \
160+
src/fsuae/fsuae-model.h \
160161
src/fsuae/fsuae-mouse.c \
161162
src/fsuae/fsuae-options.h \
163+
src/fsuae/fsuae-oskeyboard.c \
162164
src/fsuae/fsuae-paths.c \
163165
src/fsuae/fsuae-paths.h \
164166
src/fsuae/fsuae-plugins.c \
165167
src/fsuae/fsuae-plugins.h \
166168
src/fsuae/fsuae-recording.c \
167169
src/fsuae/fsuae-recording.h \
168-
src/fsuae/uae_config.c \
169-
src/fsuae/fsuae-video.c
170+
src/fsuae/fsuae-sound.c \
171+
src/fsuae/fsuae-sound.h \
172+
src/fsuae/fsuae-video.c\
173+
src/fsuae/uae_config.c
170174

171175

172176
if WINDOWS
@@ -812,8 +816,16 @@ if FSEMU
812816
noinst_LIBRARIES += libfsemu2.a
813817
AM_CPPFLAGS += -I$(s)/fsemu/src
814818
fs_uae_LDADD += libfsemu2.a
815-
# fs_uae_device_helper_LDADD += libfsemu2.a
819+
fs_uae_device_helper_LDADD += libfsemu2.a
816820
libfsemu2_a_SOURCES = \
821+
fsemu/gamemode/lib/gamemode_client.h \
822+
fsemu/manymouse/linux_evdev.c \
823+
fsemu/manymouse/macosx_hidmanager.c \
824+
fsemu/manymouse/macosx_hidutilities.c \
825+
fsemu/manymouse/manymouse.c \
826+
fsemu/manymouse/manymouse.h \
827+
fsemu/manymouse/windows_wminput.c \
828+
fsemu/manymouse/x11_xinput2.c \
817829
fsemu/src/fsemu-all.h \
818830
fsemu/src/fsemu-button.h \
819831
fsemu/src/fsemu-action.c \
@@ -827,6 +839,7 @@ libfsemu2_a_SOURCES = \
827839
fsemu/src/fsemu-axis.h \
828840
fsemu/src/fsemu-background.c \
829841
fsemu/src/fsemu-background.h \
842+
fsemu/src/fsemu-color.h \
830843
fsemu/src/fsemu-common.c \
831844
fsemu/src/fsemu-common.h \
832845
fsemu/src/fsemu-compat.h \
@@ -838,12 +851,16 @@ libfsemu2_a_SOURCES = \
838851
fsemu/src/fsemu-controller.h \
839852
fsemu/src/fsemu-data.c \
840853
fsemu/src/fsemu-data.h \
854+
fsemu/src/fsemu-emuthread.c \
855+
fsemu/src/fsemu-emuthread.h \
841856
fsemu/src/fsemu-events.c \
842857
fsemu/src/fsemu-events.h \
843858
fsemu/src/fsemu-fade.c \
844859
fsemu/src/fsemu-fade.h \
845860
fsemu/src/fsemu-font.c \
846861
fsemu/src/fsemu-font.h \
862+
fsemu/src/fsemu-fontcache.c \
863+
fsemu/src/fsemu-fontcache.h \
847864
fsemu/src/fsemu-frame.c \
848865
fsemu/src/fsemu-frame.h \
849866
fsemu/src/fsemu-gamemode.c \
@@ -879,8 +896,14 @@ libfsemu2_a_SOURCES = \
879896
fsemu/src/fsemu-layout.h \
880897
fsemu/src/fsemu-log.c \
881898
fsemu/src/fsemu-log.h \
899+
fsemu/src/fsemu-mainmenu.c \
900+
fsemu/src/fsemu-mainmenu.h \
901+
fsemu/src/fsemu-manymouse.c \
902+
fsemu/src/fsemu-manymouse.h \
882903
fsemu/src/fsemu-menu.c \
883904
fsemu/src/fsemu-menu.h \
905+
fsemu/src/fsemu-module.c \
906+
fsemu/src/fsemu-module.h \
884907
fsemu/src/fsemu-monitor.c \
885908
fsemu/src/fsemu-monitor.h \
886909
fsemu/src/fsemu-mouse.c \
@@ -904,6 +927,8 @@ libfsemu2_a_SOURCES = \
904927
fsemu/src/fsemu-refable.h \
905928
fsemu/src/fsemu-render.c \
906929
fsemu/src/fsemu-render.h \
930+
fsemu/src/fsemu-savestate.c \
931+
fsemu/src/fsemu-savestate.h \
907932
fsemu/src/fsemu-screenshot.c \
908933
fsemu/src/fsemu-screenshot.h \
909934
fsemu/src/fsemu-sdl.h \
@@ -953,18 +978,18 @@ fs_uae_LDADD += cef/libcef_dll/libcef_dll_wrapper.a -L $(s)/cef/Release -lcef
953978
endif
954979

955980
if BUILTIN_MANYMOUSE
956-
noinst_LIBRARIES += libmanymouse.a
957-
AM_CPPFLAGS += -I$(s)/manymouse
958-
fs_uae_LDADD += libmanymouse.a
959-
fs_uae_device_helper_LDADD += libmanymouse.a
960-
libmanymouse_a_SOURCES = \
961-
manymouse/linux_evdev.c \
962-
manymouse/macosx_hidmanager.c \
963-
manymouse/macosx_hidutilities.c \
964-
manymouse/manymouse.c \
965-
manymouse/manymouse.h \
966-
manymouse/windows_wminput.c \
967-
manymouse/x11_xinput2.c
981+
# noinst_LIBRARIES += libmanymouse.a
982+
# AM_CPPFLAGS += -I$(s)/manymouse
983+
# fs_uae_LDADD += libmanymouse.a
984+
# fs_uae_device_helper_LDADD += libmanymouse.a
985+
# libmanymouse_a_SOURCES = \
986+
# manymouse/linux_evdev.c \
987+
# manymouse/macosx_hidmanager.c \
988+
# manymouse/macosx_hidutilities.c \
989+
# manymouse/manymouse.c \
990+
# manymouse/manymouse.h \
991+
# manymouse/windows_wminput.c \
992+
# manymouse/x11_xinput2.c
968993
endif
969994

970995
if WITH_GLAD

docs/performance.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Performance
2+
3+
1. Your device must be powerful enough to run the emulation.
4+
2. The emulator must be allowed to run sufficiently often.
5+
6+
The first point is rarely a problem, modern desktop and laptop computers are
7+
usually powerful enough. The most important aspect is a relatively fast CPU,
8+
and especially how fast a single thread can run.
9+
10+
The second point is more tricky. Power saving features and other
11+
resourcy-hungry applications can interfere with the emulation. Sometimes to
12+
the point of the emulation not running fast enough, but more often the result
13+
is stuttering and un-even emulation speed.
14+
15+
## Why is stable performance so important?
16+
17+
In order to get smooth video output with stuttering (and without audio issues),
18+
the emulator must be to both emulate frames *and* display then on screen very
19+
quickly (typically 50 or 60 times per second). Modern games running on your
20+
system can typically account for small delays and uneven performance, but old
21+
computer systems ran at a fixed speed. So even quite small delays in generating
22+
and displaying a a video frame can cause noticable video stuttering (or
23+
crackling audio).
24+
25+
## How to identify performance issues?
26+
27+
Write about the performance overlay (Mod+O).
28+
29+
## Make sure the the emulator window has focus
30+
31+
On many systems, the application will get less run-time when it's not running
32+
in the foreground (meaning not having mouse and keyboard focus). So if you
33+
notice un-even performance, make sure that the emulator window is focused.
34+
35+
Running in full-screen might further ensure that the emulator gets enough
36+
resources.
37+
38+
## Switch to a performance power profile
39+
40+
Avoid powersaving, this can throttle down your CPU/GPU making them run much
41+
slower than they can. Powersaving can also cause the emulator getting too
42+
little run-time, for example by pausing the emulator slightly, but long enough
43+
to cause stuttering.
44+
45+
If you have Linux; install the gamemoded daemon to allow the emulator to
46+
automatically switch to the performance CPU governor while the emulation
47+
is running.
48+
49+
## Plug your computer to external power
50+
51+
Depending on your system, your computer may be throttled when running on
52+
battery alone. Switching to a performance power profile might alleviate this,
53+
or maybe not. You can try running with or without external power and see if
54+
it makes a difference.
55+
56+
## Close other applications
57+
58+
Especially web browsers can use more CPU and resources than you might think,
59+
depending on the open tabs. On the other hand, if the applications are idle,
60+
they should not interfere.
61+
62+
If you believe other applications might interfere, you can try closing them
63+
and see if it helps. You can also use the task monitor of your operating
64+
system to see what applications are using resources.
65+
66+
## FIXME: Performance tips when insufficient host performance is the problem
67+
68+
- ...

fsemu/gamemode/LICENSE.txt

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Copyright (c) 2017-2020, Feral Interactive
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
* Redistributions of source code must retain the above copyright notice,
8+
this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above copyright
10+
notice, this list of conditions and the following disclaimer in the
11+
documentation and/or other materials provided with the distribution.
12+
* Neither the name of Feral Interactive nor the names of its contributors
13+
may be used to endorse or promote products derived from this software
14+
without specific prior written permission.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
POSSIBILITY OF SUCH DAMAGE.

fsemu/gamemode/README.md

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# GameMode
2+
**GameMode** is a daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS and/or a game process.
3+
4+
GameMode was designed primarily as a stop-gap solution to problems with the Intel and AMD CPU powersave or ondemand governors, but is now host to a range of optimisation features and configurations.
5+
6+
Currently GameMode includes support for optimisations including:
7+
* CPU governor
8+
* I/O priority
9+
* Process niceness
10+
* Kernel scheduler (`SCHED_ISO`)
11+
* Screensaver inhibiting
12+
* GPU performance mode (NVIDIA and AMD), GPU overclocking (NVIDIA)
13+
* Custom scripts
14+
15+
GameMode packages are available for Ubuntu, Debian, Solus, the AUR, Gentoo, Fedora, OpenSUSE, Mageia and possibly more.
16+
17+
Issues with GameMode should be reported here in the issues section, and not reported to Feral directly.
18+
19+
---
20+
## Requesting GameMode
21+
22+
For games/launchers which integrate GameMode support (see list later on), simply running the game will automatically activate GameMode.
23+
24+
For others, you must manually request GameMode when running the game. This can be done by launching the game through `gamemoderun`:
25+
```bash
26+
gamemoderun ./game
27+
```
28+
Or edit the Steam launch options:
29+
```bash
30+
gamemoderun %command%
31+
```
32+
33+
Note: for older versions of GameMode (before 1.3) use this string in place of `gamemoderun`:
34+
```
35+
LD_PRELOAD="$LD_PRELOAD:/usr/\$LIB/libgamemodeauto.so.0"
36+
```
37+
**Please note the backslash here in `\$LIB` is required.**
38+
39+
---
40+
## Configuration
41+
42+
The daemon is configured with a `gamemode.ini` file. [example/gamemode.ini](https://github.com/FeralInteractive/gamemode/blob/master/example/gamemode.ini) is an example of what this file would look like, with explanations for all the variables.
43+
44+
Config files are loaded and merged from the following directories, in order:
45+
1. `/usr/share/gamemode/`
46+
2. `/etc/`
47+
3. `$XDG_CONFIG_HOME` or `$HOME/.config/`
48+
4. `$PWD`
49+
50+
---
51+
## Note for Hybrid GPU users
52+
53+
It's not possible to integrate commands like optirun automatically inside GameMode, since the GameMode request is made once the game has already started. However it is possible to use a hybrid GPU wrapper like optirun by starting the game with `gamemoderun`.
54+
55+
You can do this by setting the environment variable `GAMEMODERUNEXEC` to your wrapper's launch command, so for example `GAMEMODERUNEXEC=optirun` or `GAMEMODERUNEXEC="env DRI_PRIME=1"`. This environment variable can be set globally, so that the same prefix command does not have to be duplicated everywhere you want to use `gamemoderun`.
56+
57+
GameMode will not be injected to the wrapper.
58+
59+
---
60+
## Apps with GameMode integration
61+
62+
### Games
63+
The following games are known to integrate GameMode support (meaning they don't require any additional configuration to activate GameMode while running):
64+
* DiRT 4
65+
* Rise of the Tomb Raider
66+
* Shadow of the Tomb Raider
67+
* Total War: Three Kingdoms
68+
* Total War: WARHAMMER II
69+
* Total War Saga: Thrones of Britannia
70+
71+
### Others
72+
Other apps which can integrate with GameMode include:
73+
* GNOME Shell ([via extension](https://github.com/gicmo/gamemode-extension)) - indicates when GameMode is active in the top panel.
74+
* Lutris - Enables GameMode for all games by default if available (must have both 32- and 64-bit GameMode libraries installed), configurable in preferences.
75+
76+
---
77+
## Development [![Build Status](https://travis-ci.org/FeralInteractive/gamemode.svg?branch=master)](https://travis-ci.org/FeralInteractive/gamemode)
78+
79+
The design of GameMode has a clear-cut abstraction between the host daemon and library (`gamemoded` and `libgamemode`), and the client loaders (`libgamemodeauto` and `gamemode_client.h`) that allows for safe use without worrying about whether the daemon is installed or running. This design also means that while the host library currently relies on `systemd` for exchanging messages with the daemon, it's entirely possible to implement other internals that still work with the same clients.
80+
81+
See repository subdirectories for information on each component.
82+
83+
### Install Dependencies
84+
GameMode depends on `meson` for building and `systemd` for internal communication. This repo contains a `bootstrap.sh` script to allow for quick install to the user bus, but check `meson_options.txt` for custom settings.
85+
86+
#### Ubuntu/Debian (you may also need `dbus-user-session`)
87+
```bash
88+
apt install meson libsystemd-dev pkg-config ninja-build git libdbus-1-dev
89+
```
90+
#### Arch
91+
```bash
92+
pacman -S meson systemd git dbus
93+
```
94+
#### Fedora
95+
```bash
96+
dnf install meson systemd-devel pkg-config git dbus-devel
97+
```
98+
#### Gentoo
99+
Gentoo has an ebuild which builds a stable release from sources. It will also pull in all the dependencies so you can work on the source code.
100+
```bash
101+
emerge --ask games-util/gamemode
102+
```
103+
You can also install using the latest sources from git:
104+
```bash
105+
ACCEPT_KEYWORDS="**" emerge --ask ~games-util/gamemode-9999
106+
```
107+
108+
### Build and Install GameMode
109+
Then clone, build and install a release version of GameMode at 1.5:
110+
111+
```bash
112+
git clone https://github.com/FeralInteractive/gamemode.git
113+
cd gamemode
114+
git checkout 1.5 # omit to build the master branch
115+
./bootstrap.sh
116+
```
117+
118+
To uninstall:
119+
```bash
120+
systemctl --user stop gamemoded.service
121+
cd build/
122+
ninja uninstall
123+
```
124+
125+
### Pull Requests
126+
Pull requests must match with the coding style found in the `.clang-format` file, please run this before committing:
127+
```
128+
clang-format -i $(find . -name '*.[ch]' -not -path "*subprojects/*")
129+
```
130+
131+
### Maintained by
132+
Feral Interactive
133+
134+
See the [contributors](https://github.com/FeralInteractive/gamemode/graphs/contributors) section for an extended list of contributors.
135+
136+
---
137+
## License
138+
139+
Copyright © 2017-2020 Feral Interactive
140+
141+
GameMode is available under the terms of the BSD 3-Clause License (Revised)
142+
143+
The "inih" library is distributed under the New BSD license

0 commit comments

Comments
 (0)