Compare commits

...

16 Commits
master ... dev

Author SHA1 Message Date
Simon Chan
c27d116a66 Fix AudioRecord package name for Android 16
Since commit 9f91a5eebb4520b9333576e946b3911d0f946a04 in frameworks/av
(AOSP), an AudioRecord can be created only if the declared package name
in the AttributionSource is "shell" (for the shell UID):
 - <7c4e6991ac/services/audiopolicy/permission/NativePermissionController.cpp (129)>
 - <7c4e6991ac/services/audiopolicy/permission/NativePermissionController.cpp (40)>

Refs <9f91a5eebb%5E%21/>
Fixes #5698 <https://github.com/Genymobile/scrcpy/issues/5698>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2024-12-23 19:41:25 +01:00
Romain Vimont
eac711ace6 Remove unused rotation and fold listeners
IRotationWatcher and IDisplayFoldListener are no longer used since
commit 39d51ff2cc2f3e201ad433d48372b548e5dd11d3.
2024-12-23 12:51:27 +01:00
Romain Vimont
af15c72f9c Cleanup includes
Improved manually with the help of neovim LSP warnings and iwyu:

    iwyu -Ibuilddir/app/ -Iapp/src/ app/src/XXX.c
2024-12-23 12:19:47 +01:00
Simon Chan
5b1229a55f Support older macOS versions in CI build
Fixes #5649 <https://github.com/Genymobile/scrcpy/issues/5649>
Fixes #5697<https://github.com/Genymobile/scrcpy/pull/5697>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2024-12-23 11:58:06 +01:00
Romain Vimont
69858c6f43 Build static linux binary on Ubuntu 20.04
Use the oldest Ubuntu version currently available in GitHub Actions to
ensure maximum compatibility with older systems.

Refs 95c4f03c1bfd566b383780977b3473ebad6477ee
Refs #5689 <https://github.com/Genymobile/scrcpy/issues/5689>
2024-12-23 11:01:42 +01:00
Romain Vimont
e0423653c8 Remove useless null check
The method CameraManager.getCameraIdList() is annotated with @NonNull.

This fixes a warning reported by Android Studio.
2024-12-23 10:58:59 +01:00
Romain Vimont
5387644160 Ignore low-FPS ranges if not available
Do not report an error if the returned FPS ranges array is null.

Refs #5669 <https://github.com/Genymobile/scrcpy/pull/5669>
2024-12-22 21:17:51 +01:00
Simon Chan
2f44da76f4 Filter out non-backward-compatible cameras
PR #5669 <https://github.com/Genymobile/scrcpy/pull/5669>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2024-12-22 21:17:05 +01:00
Romain Vimont
95c4f03c1b Build static linux binary on Ubuntu 22.04
On Github Actions, ubuntu-latest now points to ubuntu-24.04, which uses
a newer version of glibc (2.39). As a result, the binaries fail to work
on systems with older versions of glibc, such as Debian Bookworm.

To ensure better compatibility, continue building the static Linux
binary on Ubuntu 22.04 (with glibc 2.35).

Fixes #5689 <https://github.com/Genymobile/scrcpy/issues/5689>
2024-12-22 15:49:46 +01:00
Romain Vimont
fb47b87eeb Fix pipe read return value
The function incorrectly returned false, whereas its return type is
ssize_t.
2024-12-20 20:57:20 +01:00
Romain Vimont
dc2fcc46f5 Add workaround for Pico 4 Ultra
Make ActivityThread.isSystem() return true to avoid a
NullPointerException later.

Refs #5659 comment <https://github.com/Genymobile/scrcpy/issues/5659#issuecomment-2540963953>
Fixes #5659 <https://github.com/Genymobile/scrcpy/issues/5659>
2024-12-14 10:27:38 +01:00
Romain Vimont
69264703b1 Add missing comments in workarounds
The implementation of workarounds uses a lot of reflection code. For
better readability, always write the equivalent using direct Java code.
2024-12-14 10:27:38 +01:00
Colin Kinloch
ec4e826976 Set icon and server env paths for meson devenv
This allows users to compile and run the project in a dev environment.

    meson setup x
    meson compile -C x
    meson devenv -C x
    scrcpy

This is an alternative to `./run x`.

PR #5658 <https://github.com/Genymobile/scrcpy/pull/5658>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2024-12-12 18:15:26 +01:00
Romain Vimont
17e205e54f Replace meson join_paths() by '/'
A new '/' operator was introduced in Meson 0.49 to replace join_paths():
 - <https://mesonbuild.com/Reference-manual_functions.html#join_paths>
 - <https://mesonbuild.com/Syntax.html#string-path-building>

Refs #5658 <https://github.com/Genymobile/scrcpy/pull/5658>
2024-12-12 18:15:26 +01:00
Romain Vimont
f751274b17 Define both pkg-config and pkgconfig for meson
In Meson cross-files, "pkgconfig" was deprecated in favor of
"pkg-config" in meson 1.3.0.

The new name is used since 85a94dd4b563e961304b2d9082932c5c1cc2e582 to
avoid a warning, but then it fails with older versions of meson.

To avoid the problem, define both pkg-config and pkgconfig.

> For backward compatibility it is still allowed to define both with the
> same value, in that case no deprecation warning is printed.

<https://mesonbuild.com/Release-notes-for-1-3-0.html#machine-files-pkgconfig-field-deprecated-and-replaced-by-pkgconfig>
2024-12-12 18:09:31 +01:00
Romain Vimont
6469054b15 Revert "Remove apt update on GitHub Actions"
This reverts commit 678025b31672c230575fe2dbc4a0d487d5010bb1.

This avoids spurious errors on the CI:

    E: Unable to fetch some archives, maybe run apt-get update or try
    with --fix-missing?
2024-12-12 18:09:31 +01:00
124 changed files with 305 additions and 272 deletions

View File

@ -74,6 +74,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt update
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \ sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \ libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \ libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
@ -83,7 +84,7 @@ jobs:
run: release/test_client.sh run: release/test_client.sh
build-linux-x86_64: build-linux-x86_64:
runs-on: ubuntu-latest runs-on: ubuntu-20.04
steps: steps:
- name: Check architecture - name: Check architecture
run: | run: |
@ -99,6 +100,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt update
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \ sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \ libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \ libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
@ -129,14 +131,12 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt update
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \ sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \ libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \ libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
mingw-w64 mingw-w64-tools libz-mingw-w64-dev mingw-w64 mingw-w64-tools libz-mingw-w64-dev
- name: Workaround for old meson version run by Github Actions
run: sed -i 's/^pkg-config/pkgconfig/' cross_win32.txt
- name: Build - name: Build
run: release/build_windows.sh 32 run: release/build_windows.sh 32
@ -162,14 +162,12 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt update
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \ sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \ libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \ libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
mingw-w64 mingw-w64-tools libz-mingw-w64-dev mingw-w64 mingw-w64-tools libz-mingw-w64-dev
- name: Workaround for old meson version run by Github Actions
run: sed -i 's/^pkg-config/pkgconfig/' cross_win64.txt
- name: Build - name: Build
run: release/build_windows.sh 64 run: release/build_windows.sh 64
@ -208,6 +206,13 @@ jobs:
libtool libtool
- name: Build - name: Build
env:
# the default Xcode (and macOS SDK) version can be found at
# <https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md#xcode>
#
# then the minimal supported deployment target of that macOS SDK can be found at
# <https://developer.apple.com/support/xcode/#minimum-requirements>
MACOSX_DEPLOYMENT_TARGET: 10.13
run: release/build_macos.sh aarch64 run: release/build_macos.sh aarch64
# upload-artifact does not preserve permissions # upload-artifact does not preserve permissions
@ -244,6 +249,13 @@ jobs:
# autoconf and libtool are already installed on macos-13 # autoconf and libtool are already installed on macos-13
- name: Build - name: Build
env:
# the default Xcode (and macOS SDK) version can be found at
# <https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode>
#
# then the minimal supported deployment target of that macOS SDK can be found at
# <https://developer.apple.com/support/xcode/#minimum-requirements>
MACOSX_DEPLOYMENT_TARGET: 10.13
run: release/build_macos.sh x86_64 run: release/build_macos.sh x86_64
# upload-artifact does not preserve permissions # upload-artifact does not preserve permissions

View File

@ -192,19 +192,19 @@ datadir = get_option('datadir') # by default 'share'
install_man('scrcpy.1') install_man('scrcpy.1')
install_data('data/icon.png', install_data('data/icon.png',
rename: 'scrcpy.png', rename: 'scrcpy.png',
install_dir: join_paths(datadir, 'icons/hicolor/256x256/apps')) install_dir: datadir / 'icons/hicolor/256x256/apps')
install_data('data/zsh-completion/_scrcpy', install_data('data/zsh-completion/_scrcpy',
install_dir: join_paths(datadir, 'zsh/site-functions')) install_dir: datadir / 'zsh/site-functions')
install_data('data/bash-completion/scrcpy', install_data('data/bash-completion/scrcpy',
install_dir: join_paths(datadir, 'bash-completion/completions')) install_dir: datadir / 'bash-completion/completions')
# Desktop entry file for application launchers # Desktop entry file for application launchers
if host_machine.system() == 'linux' if host_machine.system() == 'linux'
# Install a launcher (ex: /usr/local/share/applications/scrcpy.desktop) # Install a launcher (ex: /usr/local/share/applications/scrcpy.desktop)
install_data('data/scrcpy.desktop', install_data('data/scrcpy.desktop',
install_dir: join_paths(datadir, 'applications')) install_dir: datadir / 'applications')
install_data('data/scrcpy-console.desktop', install_data('data/scrcpy-console.desktop',
install_dir: join_paths(datadir, 'applications')) install_dir: datadir / 'applications')
endif endif
@ -279,3 +279,9 @@ if get_option('buildtype') == 'debug'
test(t[0], exe) test(t[0], exe)
endforeach endforeach
endif endif
if meson.version().version_compare('>= 0.58.0')
devenv = environment()
devenv.set('SCRCPY_ICON_PATH', meson.current_source_dir() / 'data/icon.png')
meson.add_devenv(devenv)
endif

View File

@ -4,9 +4,10 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h>
#include "adb_device.h" #include "adb/adb_device.h"
#include "adb_parser.h" #include "adb/adb_parser.h"
#include "util/env.h" #include "util/env.h"
#include "util/file.h" #include "util/file.h"
#include "util/log.h" #include "util/log.h"

View File

@ -6,7 +6,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <inttypes.h> #include <inttypes.h>
#include "adb_device.h" #include "adb/adb_device.h"
#include "util/intr.h" #include "util/intr.h"
#define SC_ADB_NO_STDOUT (1 << 0) #define SC_ADB_NO_STDOUT (1 << 0)

View File

@ -4,7 +4,6 @@
#include "common.h" #include "common.h"
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h>
#include "util/vector.h" #include "util/vector.h"

View File

@ -3,6 +3,7 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h>
#include "util/log.h" #include "util/log.h"
#include "util/str.h" #include "util/str.h"

View File

@ -3,9 +3,9 @@
#include "common.h" #include "common.h"
#include <stddef.h> #include <stdbool.h>
#include "adb_device.h" #include "adb/adb_device.h"
/** /**
* Parse the available devices from the output of `adb devices` * Parse the available devices from the output of `adb devices`

View File

@ -1,11 +1,11 @@
#include "adb_tunnel.h" #include "adb_tunnel.h"
#include <assert.h> #include <assert.h>
#include <inttypes.h>
#include "adb.h" #include "adb/adb.h"
#include "util/log.h" #include "util/log.h"
#include "util/net_intr.h" #include "util/net_intr.h"
#include "util/process_intr.h"
static bool static bool
listen_on_port(struct sc_intr *intr, sc_socket socket, uint16_t port) { listen_on_port(struct sc_intr *intr, sc_socket socket, uint16_t port) {

View File

@ -3,9 +3,7 @@
#include "common.h" #include "common.h"
#include <stdatomic.h> #include <SDL2/SDL_audio.h>
#include <stdbool.h>
#include <SDL2/SDL.h>
#include "audio_regulator.h" #include "audio_regulator.h"
#include "trait/frame_sink.h" #include "trait/frame_sink.h"

View File

@ -1,5 +1,9 @@
#include "audio_regulator.h" #include "audio_regulator.h"
#include <assert.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#include <libavutil/opt.h> #include <libavutil/opt.h>

View File

@ -5,6 +5,8 @@
#include <stdatomic.h> #include <stdatomic.h>
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#include <libswresample/swresample.h> #include <libswresample/swresample.h>
#include "util/audiobuf.h" #include "util/audiobuf.h"

View File

@ -5,6 +5,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <unistd.h> #include <unistd.h>
#include "options.h" #include "options.h"
@ -13,6 +14,7 @@
#include "util/str.h" #include "util/str.h"
#include "util/strbuf.h" #include "util/strbuf.h"
#include "util/term.h" #include "util/term.h"
#include "util/tick.h"
#define STR_IMPL_(x) #x #define STR_IMPL_(x) #x
#define STR(x) STR_IMPL_(x) #define STR(x) STR_IMPL_(x)

View File

@ -1,11 +1,9 @@
#include "decoder.h" #include "decoder.h"
#include <libavcodec/avcodec.h> #include <errno.h>
#include <libavformat/avformat.h> #include <libavcodec/packet.h>
#include <libavutil/channel_layout.h> #include <libavutil/avutil.h>
#include "events.h"
#include "trait/frame_sink.h"
#include "util/log.h" #include "util/log.h"
/** Downcast packet_sink to decoder */ /** Downcast packet_sink to decoder */

View File

@ -3,13 +3,11 @@
#include "common.h" #include "common.h"
#include <libavcodec/avcodec.h>
#include "trait/frame_source.h" #include "trait/frame_source.h"
#include "trait/packet_sink.h" #include "trait/packet_sink.h"
#include <stdbool.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
struct sc_decoder { struct sc_decoder {
struct sc_packet_sink packet_sink; // packet sink trait struct sc_packet_sink packet_sink; // packet sink trait
struct sc_frame_source frame_source; // frame source trait struct sc_frame_source frame_source; // frame source trait

View File

@ -2,9 +2,7 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <libavcodec/avcodec.h>
#include <libavutil/avutil.h>
#include <libavformat/avformat.h>
#include "util/log.h" #include "util/log.h"

View File

@ -4,6 +4,7 @@
#include "common.h" #include "common.h"
#include <stdbool.h> #include <stdbool.h>
#include <libavutil/frame.h>
#include "clock.h" #include "clock.h"
#include "trait/frame_source.h" #include "trait/frame_source.h"

View File

@ -1,14 +1,11 @@
#include "demuxer.h" #include "demuxer.h"
#include <assert.h> #include <assert.h>
#include <inttypes.h>
#include <libavcodec/avcodec.h>
#include <libavutil/channel_layout.h> #include <libavutil/channel_layout.h>
#include <libavutil/time.h>
#include <unistd.h>
#include "decoder.h"
#include "events.h"
#include "packet_merger.h" #include "packet_merger.h"
#include "recorder.h"
#include "util/binary.h" #include "util/binary.h"
#include "util/log.h" #include "util/log.h"

View File

@ -4,12 +4,8 @@
#include "common.h" #include "common.h"
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include "trait/packet_source.h" #include "trait/packet_source.h"
#include "trait/packet_sink.h"
#include "util/net.h" #include "util/net.h"
#include "util/thread.h" #include "util/thread.h"

View File

@ -3,9 +3,9 @@
#include "common.h" #include "common.h"
#include <stdbool.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <unistd.h> #include <sys/types.h>
#define DEVICE_MSG_MAX_SIZE (1 << 18) // 256k #define DEVICE_MSG_MAX_SIZE (1 << 18) // 256k
// type: 1 byte; length: 4 bytes // type: 1 byte; length: 4 bytes

View File

@ -1,6 +1,8 @@
#include "display.h" #include "display.h"
#include <assert.h> #include <assert.h>
#include <inttypes.h>
#include <string.h>
#include <libavutil/pixfmt.h> #include <libavutil/pixfmt.h>
#include "util/log.h" #include "util/log.h"

View File

@ -4,7 +4,8 @@
#include "common.h" #include "common.h"
#include <stdbool.h> #include <stdbool.h>
#include <libavformat/avformat.h> #include <stdint.h>
#include <libavutil/frame.h>
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "coords.h" #include "coords.h"

View File

@ -1,5 +1,7 @@
#include "events.h" #include "events.h"
#include <assert.h>
#include "util/log.h" #include "util/log.h"
#include "util/thread.h" #include "util/thread.h"

View File

@ -1,11 +1,11 @@
#include "file_pusher.h" #include "file_pusher.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "adb/adb.h" #include "adb/adb.h"
#include "util/log.h" #include "util/log.h"
#include "util/process_intr.h"
#define DEFAULT_PUSH_TARGET "/sdcard/Download/" #define DEFAULT_PUSH_TARGET "/sdcard/Download/"

View File

@ -1,6 +1,7 @@
#include "fps_counter.h" #include "fps_counter.h"
#include <assert.h> #include <assert.h>
#include <stdint.h>
#include "util/log.h" #include "util/log.h"

View File

@ -5,9 +5,9 @@
#include <stdatomic.h> #include <stdatomic.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include "util/thread.h" #include "util/thread.h"
#include "util/tick.h"
struct sc_fps_counter { struct sc_fps_counter {
sc_thread thread; sc_thread thread;

View File

@ -1,8 +1,6 @@
#include "frame_buffer.h" #include "frame_buffer.h"
#include <assert.h> #include <assert.h>
#include <libavutil/avutil.h>
#include <libavformat/avformat.h>
#include "util/log.h" #include "util/log.h"

View File

@ -4,6 +4,7 @@
#include "common.h" #include "common.h"
#include <stdbool.h> #include <stdbool.h>
#include <libavutil/frame.h>
#include "util/thread.h" #include "util/thread.h"

View File

@ -3,6 +3,7 @@
#include "common.h" #include "common.h"
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
#define SC_HID_MAX_SIZE 15 #define SC_HID_MAX_SIZE 15

View File

@ -2,6 +2,8 @@
#include <assert.h> #include <assert.h>
#include <inttypes.h> #include <inttypes.h>
#include <stddef.h>
#include <sys/types.h>
#include "util/binary.h" #include "util/binary.h"
#include "util/log.h" #include "util/log.h"

View File

@ -4,6 +4,7 @@
#include "common.h" #include "common.h"
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include "hid/hid_event.h" #include "hid/hid_event.h"
#include "input_events.h" #include "input_events.h"

View File

@ -1,5 +1,6 @@
#include "hid_keyboard.h" #include "hid_keyboard.h"
#include <assert.h>
#include <string.h> #include <string.h>
#include "util/log.h" #include "util/log.h"

View File

@ -4,6 +4,7 @@
#include "common.h" #include "common.h"
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include "hid/hid_event.h" #include "hid/hid_event.h"
#include "input_events.h" #include "input_events.h"

View File

@ -1,5 +1,7 @@
#include "hid_mouse.h" #include "hid_mouse.h"
#include <stdint.h>
// 1 byte for buttons + padding, 1 byte for X position, 1 byte for Y position, // 1 byte for buttons + padding, 1 byte for X position, 1 byte for Y position,
// 1 byte for wheel motion // 1 byte for wheel motion
#define SC_HID_MOUSE_INPUT_SIZE 4 #define SC_HID_MOUSE_INPUT_SIZE 4

View File

@ -3,8 +3,6 @@
#include "common.h" #include "common.h"
#include <stdbool.h>
#include "hid/hid_event.h" #include "hid/hid_event.h"
#include "input_events.h" #include "input_events.h"

View File

@ -2,17 +2,22 @@
#include <assert.h> #include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
#include <libavutil/avutil.h>
#include <libavutil/pixdesc.h> #include <libavutil/pixdesc.h>
#include <libavutil/pixfmt.h> #include <libavutil/pixfmt.h>
#include <SDL2/SDL.h>
#include "config.h" #include "config.h"
#include "compat.h"
#include "util/env.h" #include "util/env.h"
#ifdef PORTABLE
# include "util/file.h" # include "util/file.h"
#endif
#include "util/log.h" #include "util/log.h"
#include "util/str.h"
#define SCRCPY_PORTABLE_ICON_FILENAME "icon.png" #define SCRCPY_PORTABLE_ICON_FILENAME "icon.png"
#define SCRCPY_DEFAULT_ICON_PATH \ #define SCRCPY_DEFAULT_ICON_PATH \

View File

@ -3,9 +3,7 @@
#include "common.h" #include "common.h"
#include <stdbool.h> #include <SDL2/SDL_surface.h>
#include <SDL2/SDL.h>
#include <libavformat/avformat.h>
SDL_Surface * SDL_Surface *
scrcpy_icon_load(void); scrcpy_icon_load(void);

View File

@ -9,7 +9,6 @@
#include <SDL2/SDL_events.h> #include <SDL2/SDL_events.h>
#include "coords.h" #include "coords.h"
#include "options.h"
/* The representation of input events in scrcpy is very close to the SDL API, /* The representation of input events in scrcpy is very close to the SDL API,
* for simplicity. * for simplicity.

View File

@ -1,8 +1,12 @@
#include "input_manager.h" #include "input_manager.h"
#include <assert.h> #include <assert.h>
#include <SDL2/SDL_keycode.h> #include <stdlib.h>
#include <string.h>
#include <SDL2/SDL.h>
#include "android/input.h"
#include "android/keycodes.h"
#include "input_events.h" #include "input_events.h"
#include "screen.h" #include "screen.h"
#include "shortcut_mod.h" #include "shortcut_mod.h"

View File

@ -4,12 +4,12 @@
#include "common.h" #include "common.h"
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include <SDL2/SDL.h> #include <SDL2/SDL_events.h>
#include <SDL2/SDL_keycode.h>
#include "controller.h" #include "controller.h"
#include "file_pusher.h" #include "file_pusher.h"
#include "fps_counter.h"
#include "options.h" #include "options.h"
#include "trait/gamepad_processor.h" #include "trait/gamepad_processor.h"
#include "trait/key_processor.h" #include "trait/key_processor.h"

View File

@ -1,8 +1,13 @@
#include "keyboard_sdk.h" #include "keyboard_sdk.h"
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "android/input.h" #include "android/input.h"
#include "android/keycodes.h"
#include "control_msg.h" #include "control_msg.h"
#include "controller.h" #include "controller.h"
#include "input_events.h" #include "input_events.h"

View File

@ -1,9 +1,6 @@
#include "common.h" #include "common.h"
#include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include <unistd.h>
#include <libavformat/avformat.h>
#ifdef HAVE_V4L2 #ifdef HAVE_V4L2
# include <libavdevice/avdevice.h> # include <libavdevice/avdevice.h>
#endif #endif

View File

@ -1,12 +1,12 @@
#include "mouse_sdk.h" #include "mouse_sdk.h"
#include <assert.h> #include <assert.h>
#include <stdint.h>
#include "android/input.h" #include "android/input.h"
#include "control_msg.h" #include "control_msg.h"
#include "controller.h" #include "controller.h"
#include "input_events.h" #include "input_events.h"
#include "util/intmap.h"
#include "util/log.h" #include "util/log.h"
/** Downcast mouse processor to sc_mouse_sdk */ /** Downcast mouse processor to sc_mouse_sdk */

View File

@ -6,7 +6,6 @@
#include <stdbool.h> #include <stdbool.h>
#include "controller.h" #include "controller.h"
#include "screen.h"
#include "trait/mouse_processor.h" #include "trait/mouse_processor.h"
struct sc_mouse_sdk { struct sc_mouse_sdk {

View File

@ -2,7 +2,8 @@
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include "SDL2/SDL.h" #include <string.h>
#include <SDL2/SDL.h>
void void
sc_opengl_init(struct sc_opengl *gl) { sc_opengl_init(struct sc_opengl *gl) {

View File

@ -1,5 +1,7 @@
#include "options.h" #include "options.h"
#include <stddef.h>
const struct scrcpy_options scrcpy_options_default = { const struct scrcpy_options scrcpy_options_default = {
.serial = NULL, .serial = NULL,
.crop = NULL, .crop = NULL,

View File

@ -5,7 +5,6 @@
#include <assert.h> #include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include "util/tick.h" #include "util/tick.h"

View File

@ -1,5 +1,9 @@
#include "packet_merger.h" #include "packet_merger.h"
#include <stdlib.h>
#include <string.h>
#include <libavutil/avutil.h>
#include "util/log.h" #include "util/log.h"
void void

View File

@ -5,7 +5,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <libavcodec/avcodec.h> #include <libavcodec/packet.h>
/** /**
* Config packets (containing the SPS/PPS) are sent in-band. A new config * Config packets (containing the SPS/PPS) are sent in-band. A new config

View File

@ -2,7 +2,6 @@
#include <assert.h> #include <assert.h>
#include <inttypes.h> #include <inttypes.h>
#include <stdint.h>
#include <SDL2/SDL_clipboard.h> #include <SDL2/SDL_clipboard.h>
#include "device_msg.h" #include "device_msg.h"

View File

@ -1,6 +1,9 @@
#include "recorder.h" #include "recorder.h"
#include <assert.h> #include <assert.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
#include <libavutil/time.h> #include <libavutil/time.h>

View File

@ -4,9 +4,10 @@
#include "common.h" #include "common.h"
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include <libavcodec/packet.h>
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
#include "coords.h"
#include "options.h" #include "options.h"
#include "trait/packet_sink.h" #include "trait/packet_sink.h"
#include "util/thread.h" #include "util/thread.h"

View File

@ -1,10 +1,11 @@
#include "scrcpy.h" #include "scrcpy.h"
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include <libavformat/avformat.h>
#include <sys/time.h>
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#ifdef _WIN32 #ifdef _WIN32
@ -37,9 +38,9 @@
#endif #endif
#include "util/acksync.h" #include "util/acksync.h"
#include "util/log.h" #include "util/log.h"
#include "util/net.h"
#include "util/rand.h" #include "util/rand.h"
#include "util/timeout.h" #include "util/timeout.h"
#include "util/tick.h"
#ifdef HAVE_V4L2 #ifdef HAVE_V4L2
# include "v4l2_sink.h" # include "v4l2_sink.h"
#endif #endif

View File

@ -3,7 +3,6 @@
#include "common.h" #include "common.h"
#include <stdbool.h>
#include "options.h" #include "options.h"
enum scrcpy_exit_code { enum scrcpy_exit_code {

View File

@ -1,11 +1,14 @@
#ifndef SCREEN_H #ifndef SC_SCREEN_H
#define SCREEN_H #define SC_SCREEN_H
#include "common.h" #include "common.h"
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <libavformat/avformat.h> #include <libavcodec/avcodec.h>
#include <libavutil/frame.h>
#include <libavutil/pixfmt.h>
#include "controller.h" #include "controller.h"
#include "coords.h" #include "coords.h"
@ -14,7 +17,6 @@
#include "frame_buffer.h" #include "frame_buffer.h"
#include "input_manager.h" #include "input_manager.h"
#include "mouse_capture.h" #include "mouse_capture.h"
#include "opengl.h"
#include "options.h" #include "options.h"
#include "trait/key_processor.h" #include "trait/key_processor.h"
#include "trait/frame_sink.h" #include "trait/frame_sink.h"

View File

@ -1,19 +1,18 @@
#include "server.h" #include "server.h"
#include <assert.h> #include <assert.h>
#include <errno.h>
#include <inttypes.h> #include <inttypes.h>
#include <stdio.h> #include <stdio.h>
#include <SDL2/SDL_timer.h> #include <stdlib.h>
#include <SDL2/SDL_platform.h> #include <string.h>
#include <sys/types.h>
#include "adb/adb.h" #include "adb/adb.h"
#include "util/binary.h"
#include "util/env.h" #include "util/env.h"
#include "util/file.h" #include "util/file.h"
#include "util/log.h" #include "util/log.h"
#include "util/net_intr.h" #include "util/net_intr.h"
#include "util/process_intr.h" #include "util/process.h"
#include "util/str.h" #include "util/str.h"
#define SC_SERVER_FILENAME "scrcpy-server" #define SC_SERVER_FILENAME "scrcpy-server"

View File

@ -1,19 +1,17 @@
#ifndef SERVER_H #ifndef SC_SERVER_H
#define SERVER_H #define SC_SERVER_H
#include "common.h" #include "common.h"
#include <stdatomic.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include "adb/adb_tunnel.h" #include "adb/adb_tunnel.h"
#include "coords.h"
#include "options.h" #include "options.h"
#include "util/intr.h" #include "util/intr.h"
#include "util/log.h"
#include "util/net.h" #include "util/net.h"
#include "util/thread.h" #include "util/thread.h"
#include "util/tick.h"
#define SC_DEVICE_NAME_FIELD_LENGTH 64 #define SC_DEVICE_NAME_FIELD_LENGTH 64
struct sc_server_info { struct sc_server_info {

View File

@ -3,6 +3,7 @@
#include "common.h" #include "common.h"
#include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <SDL2/SDL_keycode.h> #include <SDL2/SDL_keycode.h>

View File

@ -1,10 +1,11 @@
#include "util/file.h" #include "util/file.h"
#include <limits.h> #include <limits.h>
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#ifdef __APPLE__ #ifdef __APPLE__
# include <mach-o/dyld.h> // for _NSGetExecutablePath() # include <mach-o/dyld.h> // for _NSGetExecutablePath()

View File

@ -4,6 +4,8 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <signal.h> #include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>

View File

@ -3,7 +3,6 @@
#include "common.h" #include "common.h"
#include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>

View File

@ -1,5 +1,7 @@
#include "frame_source.h" #include "frame_source.h"
#include <assert.h>
void void
sc_frame_source_init(struct sc_frame_source *source) { sc_frame_source_init(struct sc_frame_source *source) {
source->sink_count = 0; source->sink_count = 0;

View File

@ -3,7 +3,9 @@
#include "common.h" #include "common.h"
#include "frame_sink.h" #include <stdbool.h>
#include "trait/frame_sink.h"
#define SC_FRAME_SOURCE_MAX_SINKS 2 #define SC_FRAME_SOURCE_MAX_SINKS 2

View File

@ -3,9 +3,6 @@
#include "common.h" #include "common.h"
#include <assert.h>
#include <stdbool.h>
#include "input_events.h" #include "input_events.h"
/** /**

View File

@ -3,7 +3,6 @@
#include "common.h" #include "common.h"
#include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include "input_events.h" #include "input_events.h"

View File

@ -3,7 +3,6 @@
#include "common.h" #include "common.h"
#include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include "input_events.h" #include "input_events.h"

View File

@ -3,7 +3,6 @@
#include "common.h" #include "common.h"
#include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>

View File

@ -1,5 +1,7 @@
#include "packet_source.h" #include "packet_source.h"
#include <assert.h>
void void
sc_packet_source_init(struct sc_packet_source *source) { sc_packet_source_init(struct sc_packet_source *source) {
source->sink_count = 0; source->sink_count = 0;

View File

@ -3,7 +3,9 @@
#include "common.h" #include "common.h"
#include "packet_sink.h" #include <stdbool.h>
#include "trait/packet_sink.h"
#define SC_PACKET_SOURCE_MAX_SINKS 2 #define SC_PACKET_SOURCE_MAX_SINKS 2

View File

@ -1,5 +1,10 @@
#include "gamepad_uhid.h" #include "gamepad_uhid.h"
#include <assert.h>
#include <inttypes.h>
#include <string.h>
#include <SDL2/SDL_gamecontroller.h>
#include "hid/hid_gamepad.h" #include "hid/hid_gamepad.h"
#include "input_events.h" #include "input_events.h"
#include "util/log.h" #include "util/log.h"

View File

@ -3,8 +3,6 @@
#include "common.h" #include "common.h"
#include <stdbool.h>
#include "controller.h" #include "controller.h"
#include "hid/hid_gamepad.h" #include "hid/hid_gamepad.h"
#include "trait/gamepad_processor.h" #include "trait/gamepad_processor.h"

View File

@ -1,6 +1,12 @@
#include "keyboard_uhid.h" #include "keyboard_uhid.h"
#include <assert.h>
#include <string.h>
#include <SDL2/SDL_keyboard.h>
#include <SDL2/SDL_keycode.h>
#include "util/log.h" #include "util/log.h"
#include "util/thread.h"
/** Downcast key processor to keyboard_uhid */ /** Downcast key processor to keyboard_uhid */
#define DOWNCAST(KP) container_of(KP, struct sc_keyboard_uhid, key_processor) #define DOWNCAST(KP) container_of(KP, struct sc_keyboard_uhid, key_processor)

View File

@ -1,5 +1,8 @@
#include "mouse_uhid.h" #include "mouse_uhid.h"
#include <assert.h>
#include <string.h>
#include "hid/hid_mouse.h" #include "hid/hid_mouse.h"
#include "input_events.h" #include "input_events.h"
#include "util/log.h" #include "util/log.h"

View File

@ -1,6 +1,5 @@
#include "uhid_output.h" #include "uhid_output.h"
#include <assert.h>
#include <inttypes.h> #include <inttypes.h>
#include "uhid/keyboard_uhid.h" #include "uhid/keyboard_uhid.h"

View File

@ -3,7 +3,7 @@
#include "common.h" #include "common.h"
#include <stdbool.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
/** /**

View File

@ -1,13 +1,16 @@
#include "util/log.h" #include "aoa_hid.h"
#include <assert.h> #include <assert.h>
#include <inttypes.h> #include <inttypes.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <libusb-1.0/libusb.h>
#include "aoa_hid.h"
#include "events.h" #include "events.h"
#include "util/log.h" #include "util/log.h"
#include "util/str.h" #include "util/str.h"
#include "util/tick.h"
#include "util/vector.h" #include "util/vector.h"
// See <https://source.android.com/devices/accessories/aoa2#hid-support>. // See <https://source.android.com/devices/accessories/aoa2#hid-support>.

View File

@ -3,16 +3,13 @@
#include "common.h" #include "common.h"
#include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include <libusb-1.0/libusb.h>
#include "hid/hid_event.h" #include "hid/hid_event.h"
#include "usb.h" #include "usb/usb.h"
#include "util/acksync.h" #include "util/acksync.h"
#include "util/thread.h" #include "util/thread.h"
#include "util/tick.h"
#include "util/vecdeque.h" #include "util/vecdeque.h"
enum sc_aoa_event_type { enum sc_aoa_event_type {

View File

@ -1,5 +1,7 @@
#include "gamepad_aoa.h" #include "gamepad_aoa.h"
#include <stdbool.h>
#include "input_events.h" #include "input_events.h"
#include "util/log.h" #include "util/log.h"

View File

@ -3,10 +3,8 @@
#include "common.h" #include "common.h"
#include <stdbool.h>
#include "aoa_hid.h"
#include "hid/hid_gamepad.h" #include "hid/hid_gamepad.h"
#include "usb/aoa_hid.h"
#include "trait/gamepad_processor.h" #include "trait/gamepad_processor.h"
struct sc_gamepad_aoa { struct sc_gamepad_aoa {

View File

@ -5,8 +5,8 @@
#include <stdbool.h> #include <stdbool.h>
#include "aoa_hid.h"
#include "hid/hid_keyboard.h" #include "hid/hid_keyboard.h"
#include "usb/aoa_hid.h"
#include "trait/key_processor.h" #include "trait/key_processor.h"
struct sc_keyboard_aoa { struct sc_keyboard_aoa {

View File

@ -1,6 +1,7 @@
#include "mouse_aoa.h" #include "mouse_aoa.h"
#include <assert.h> #include <assert.h>
#include <stddef.h>
#include "hid/hid_mouse.h" #include "hid/hid_mouse.h"
#include "input_events.h" #include "input_events.h"

View File

@ -5,7 +5,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "aoa_hid.h" #include "usb/aoa_hid.h"
#include "trait/mouse_processor.h" #include "trait/mouse_processor.h"
struct sc_mouse_aoa { struct sc_mouse_aoa {

View File

@ -1,10 +1,19 @@
#include "scrcpy_otg.h" #include "scrcpy_otg.h"
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#ifdef _WIN32
# include "adb/adb.h" # include "adb/adb.h"
#endif
#include "events.h" #include "events.h"
#include "screen_otg.h" #include "usb/screen_otg.h"
#include "usb/aoa_hid.h"
#include "usb/gamepad_aoa.h"
#include "usb/keyboard_aoa.h"
#include "usb/mouse_aoa.h"
#include "util/log.h" #include "util/log.h"
struct scrcpy_otg { struct scrcpy_otg {

View File

@ -1,7 +1,11 @@
#include "screen_otg.h" #include "screen_otg.h"
#include <assert.h>
#include <stddef.h>
#include "icon.h" #include "icon.h"
#include "options.h" #include "options.h"
#include "util/acksync.h"
#include "util/log.h" #include "util/log.h"
static void static void

View File

@ -4,12 +4,13 @@
#include "common.h" #include "common.h"
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "keyboard_aoa.h"
#include "mouse_aoa.h"
#include "mouse_capture.h" #include "mouse_capture.h"
#include "gamepad_aoa.h" #include "usb/gamepad_aoa.h"
#include "usb/keyboard_aoa.h"
#include "usb/mouse_aoa.h"
struct sc_screen_otg { struct sc_screen_otg {
struct sc_keyboard_aoa *keyboard; struct sc_keyboard_aoa *keyboard;

View File

@ -1,7 +1,6 @@
#include "acksync.h" #include "acksync.h"
#include <assert.h> #include <assert.h>
#include "util/log.h"
bool bool
sc_acksync_init(struct sc_acksync *as) { sc_acksync_init(struct sc_acksync *as) {

View File

@ -3,7 +3,10 @@
#include "common.h" #include "common.h"
#include "thread.h" #include <stdbool.h>
#include <stdint.h>
#include "util/thread.h"
#include "util/tick.h"
#define SC_SEQUENCE_INVALID 0 #define SC_SEQUENCE_INVALID 0

View File

@ -6,6 +6,7 @@
#include <assert.h> #include <assert.h>
#include <stdatomic.h> #include <stdatomic.h>
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
/** /**

View File

@ -3,9 +3,6 @@
#include "common.h" #include "common.h"
#include <stdbool.h>
#include <stdint.h>
struct sc_average { struct sc_average {
// Current average value // Current average value
float avg; float avg;

View File

@ -4,7 +4,6 @@
#include "common.h" #include "common.h"
#include <assert.h> #include <assert.h>
#include <stdbool.h>
#include <stdint.h> #include <stdint.h>
static inline void static inline void

View File

@ -2,7 +2,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifdef _WIN32
# include "util/str.h" # include "util/str.h"
#endif
char * char *
sc_get_env(const char *varname) { sc_get_env(const char *varname) {

View File

@ -3,6 +3,7 @@
#include "common.h" #include "common.h"
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
struct sc_intmap_entry { struct sc_intmap_entry {

View File

@ -1,9 +1,9 @@
#include "intr.h" #include "intr.h"
#include "util/log.h"
#include <assert.h> #include <assert.h>
#include "util/log.h"
bool bool
sc_intr_init(struct sc_intr *intr) { sc_intr_init(struct sc_intr *intr) {
bool ok = sc_mutex_init(&intr->mutex); bool ok = sc_mutex_init(&intr->mutex);

View File

@ -6,9 +6,9 @@
#include <stdatomic.h> #include <stdatomic.h>
#include <stdbool.h> #include <stdbool.h>
#include "net.h" #include "util/net.h"
#include "process.h" #include "util/process.h"
#include "thread.h" #include "util/thread.h"
/** /**
* Interruptor to wake up a blocking call from another thread * Interruptor to wake up a blocking call from another thread

View File

@ -4,7 +4,10 @@
# include <windows.h> # include <windows.h>
#endif #endif
#include <assert.h> #include <assert.h>
#include <libavformat/avformat.h> #include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <libavutil/log.h>
static SDL_LogPriority static SDL_LogPriority
log_level_sc_to_sdl(enum sc_log_level level) { log_level_sc_to_sdl(enum sc_log_level level) {

View File

@ -1,28 +1,27 @@
#include "net.h" #include "net.h"
#include <assert.h> #include <assert.h>
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include "log.h"
#ifdef _WIN32 #ifdef _WIN32
# include <ws2tcpip.h> # include <ws2tcpip.h>
typedef int socklen_t; typedef int socklen_t;
#else #else
# include <sys/types.h> # include <arpa/inet.h>
# include <sys/socket.h> # include <fcntl.h>
# include <netinet/in.h> # include <netinet/in.h>
# include <netinet/tcp.h> # include <netinet/tcp.h>
# include <arpa/inet.h>
# include <unistd.h> # include <unistd.h>
# include <fcntl.h> # include <sys/socket.h>
# include <sys/types.h>
# define SOCKET_ERROR -1 # define SOCKET_ERROR -1
typedef struct sockaddr_in SOCKADDR_IN; typedef struct sockaddr_in SOCKADDR_IN;
typedef struct sockaddr SOCKADDR; typedef struct sockaddr SOCKADDR;
typedef struct in_addr IN_ADDR; typedef struct in_addr IN_ADDR;
#endif #endif
#include "util/log.h"
bool bool
net_init(void) { net_init(void) {
#ifdef _WIN32 #ifdef _WIN32

View File

@ -4,14 +4,15 @@
#include "common.h" #include "common.h"
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <sys/types.h>
#ifdef _WIN32 #ifdef _WIN32
# include <winsock2.h> # include <winsock2.h>
typedef SOCKET sc_raw_socket; typedef SOCKET sc_raw_socket;
# define SC_RAW_SOCKET_NONE INVALID_SOCKET # define SC_RAW_SOCKET_NONE INVALID_SOCKET
#else // not _WIN32 #else // not _WIN32
# include <sys/socket.h>
typedef int sc_raw_socket; typedef int sc_raw_socket;
# define SC_RAW_SOCKET_NONE -1 # define SC_RAW_SOCKET_NONE -1
#endif #endif

View File

@ -3,8 +3,13 @@
#include "common.h" #include "common.h"
#include "intr.h" #include <stdbool.h>
#include "net.h" #include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
#include "util/intr.h"
#include "util/net.h"
bool bool
net_connect_intr(struct sc_intr *intr, sc_socket socket, uint32_t addr, net_connect_intr(struct sc_intr *intr, sc_socket socket, uint32_t addr,

View File

@ -1,8 +1,6 @@
#include "process.h" #include "process.h"
#include <assert.h> #include <assert.h>
#include <libgen.h>
#include "log.h"
enum sc_process_result enum sc_process_result
sc_process_execute(const char *const argv[], sc_pid *pid, unsigned flags) { sc_process_execute(const char *const argv[], sc_pid *pid, unsigned flags) {

View File

@ -4,7 +4,9 @@
#include "common.h" #include "common.h"
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h>
#include "util/thread.h" #include "util/thread.h"
#include "util/tick.h"
#ifdef _WIN32 #ifdef _WIN32

View File

@ -5,7 +5,7 @@ sc_pipe_read_intr(struct sc_intr *intr, sc_pid pid, sc_pipe pipe, char *data,
size_t len) { size_t len) {
if (intr && !sc_intr_set_process(intr, pid)) { if (intr && !sc_intr_set_process(intr, pid)) {
// Already interrupted // Already interrupted
return false; return -1;
} }
ssize_t ret = sc_pipe_read(pipe, data, len); ssize_t ret = sc_pipe_read(pipe, data, len);
@ -22,7 +22,7 @@ sc_pipe_read_all_intr(struct sc_intr *intr, sc_pid pid, sc_pipe pipe,
char *data, size_t len) { char *data, size_t len) {
if (intr && !sc_intr_set_process(intr, pid)) { if (intr && !sc_intr_set_process(intr, pid)) {
// Already interrupted // Already interrupted
return false; return -1;
} }
ssize_t ret = sc_pipe_read_all(pipe, data, len); ssize_t ret = sc_pipe_read_all(pipe, data, len);

Some files were not shown because too many files have changed in this diff Show More