[build, cmake] port to solaris (#96)

Co-authored-by: crueter <crueter@eden-emu.dev>
Reviewed-on: eden-emu/eden#96
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
lizzie 2025-07-23 10:00:29 +02:00 committed by crueter
parent 23c77a0d4f
commit e1763a726e
Signed by untrusted user: crueter
GPG key ID: 425ACD2D4830EBC6
16 changed files with 215 additions and 76 deletions

4
.gitmodules vendored
View file

@ -12,7 +12,7 @@
url = https://github.com/KhronosGroup/Vulkan-Headers.git url = https://github.com/KhronosGroup/Vulkan-Headers.git
[submodule "xbyak"] [submodule "xbyak"]
path = externals/xbyak path = externals/xbyak
url = https://github.com/herumi/xbyak.git url = https://github.com/Lizzie841/xbyak.git
[submodule "opus"] [submodule "opus"]
path = externals/opus path = externals/opus
url = https://github.com/xiph/opus.git url = https://github.com/xiph/opus.git
@ -51,7 +51,7 @@
url = https://github.com/Lizzie841/unordered_dense.git url = https://github.com/Lizzie841/unordered_dense.git
[submodule "externals/dynarmic/externals/xbyak"] [submodule "externals/dynarmic/externals/xbyak"]
path = externals/dynarmic/externals/xbyak path = externals/dynarmic/externals/xbyak
url = https://github.com/herumi/xbyak.git url = https://github.com/Lizzie841/xbyak.git
[submodule "externals/dynarmic/externals/zycore-c"] [submodule "externals/dynarmic/externals/zycore-c"]
path = externals/dynarmic/externals/zycore-c path = externals/dynarmic/externals/zycore-c
url = https://github.com/zyantific/zycore-c.git url = https://github.com/zyantific/zycore-c.git

View file

@ -61,7 +61,7 @@ endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
option(YUZU_USE_EXTERNAL_VULKAN_HEADERS "Use Vulkan-Headers from externals" OFF) option(YUZU_USE_EXTERNAL_VULKAN_HEADERS "Use Vulkan-Headers from externals" OFF)
else() else()
option(YUZU_USE_EXTERNAL_VULKAN_HEADERS "Use Vulkan-Headers from externals" ON) option(YUZU_USE_EXTERNAL_VULKAN_HEADERS "Use Vulkan-Headers from externals" ON)
endif() endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
@ -123,7 +123,7 @@ CMAKE_DEPENDENT_OPTION(YUZU_USE_FASTER_LD "Check if a faster linker is available
CMAKE_DEPENDENT_OPTION(USE_SYSTEM_MOLTENVK "Use the system MoltenVK lib (instead of the bundled one)" OFF "APPLE" OFF) CMAKE_DEPENDENT_OPTION(USE_SYSTEM_MOLTENVK "Use the system MoltenVK lib (instead of the bundled one)" OFF "APPLE" OFF)
set(DEFAULT_ENABLE_OPENSSL ON) set(DEFAULT_ENABLE_OPENSSL ON)
if (ANDROID OR WIN32 OR APPLE) if (ANDROID OR WIN32 OR APPLE OR ${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
set(DEFAULT_ENABLE_OPENSSL OFF) set(DEFAULT_ENABLE_OPENSSL OFF)
endif() endif()
option(ENABLE_OPENSSL "Enable OpenSSL backend for ISslConnection" ${DEFAULT_ENABLE_OPENSSL}) option(ENABLE_OPENSSL "Enable OpenSSL backend for ISslConnection" ${DEFAULT_ENABLE_OPENSSL})

94
docs/Solaris.md Normal file
View file

@ -0,0 +1,94 @@
# Building for Solaris
## Dependencies.
Always consult [the OpenIndiana package list](https://pkg.openindiana.org/hipster/en/index.shtml) to cross-verify availability.
Run the usual update + install of essential toolings: `sudo pkg update && sudo pkg install git cmake`.
- **gcc**: `sudo pkg install developer/gcc-14`.
- **clang**: Version 20 is broken, use `sudo pkg install developer/clang-19`.
Then install the libraies: `sudo pkg install qt6 boost glslang libzip library/lz4 nlohmann-json openssl opus sdl2 zlib compress/zstd unzip pkg-config nasm autoconf mesa library/libdrm header-drm`.
fmtlib is not available on repositories and has to be manually built:
```sh
git clone --recurisve --depth=1 https://github.com/fmtlib/fmt.git
cd fmt
cmake -DCMAKE_BUILD_TYPE=Release -B build
cmake --build build
sudo cmake --install build
```
pkg lz4 doesn't provide a proper CMakeFile to find the library, has to also be manually built:
```sh
git clone --depth=1 https://github.com/lz4/lz4.git
cd lz4
gmake
sudo gmake install
```
Same goes for zstd:
```sh
git clone --depth=1 https://github.com/facebook/zstd.git
cd zstd
cmake -DCMAKE_BUILD_TYPE=Release -B build0 -S build/cmake
cmake --build build0
cd build0
sudo gmake install
```
pkg SDL2 is also not nice to work with on CMake, save yourself some pain and compile it yourself:
```sh
git clone --depth=1 --branch=release-2.32.8 https://github.com/libsdl-org/SDL
cmake -DCMAKE_BUILD_TYPE=Release -B build
cmake --build build
sudo cmake --install build
```
Audio is broken in OpenIndiana [see this issue](https://github.com/libsdl-org/SDL/issues/13405), go into `SDL/CMakeLists.txt` and comment out lines 1468:
```diff
+# set(SDL_AUDIO_DRIVER_SUNAUDIO 1)
+# file(GLOB SUN_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sun/*.c)
+# list(APPEND SOURCE_FILES ${SUN_AUDIO_SOURCES})
+# set(HAVE_SDL_AUDIO TRUE)
```
For Solaris this issue does not exist - however PulseAudio crashes on Solaris - so use a different backend.
---
### Build preparations:
Run the following command to clone eden with git:
```sh
git clone --recursive https://git.eden-emu.dev/eden-emu/eden
```
You usually want to add the `--recursive` parameter as it also takes care of the external dependencies for you.
Now change into the eden directory and create a build directory there:
```sh
cd eden
mkdir build
```
Change into that build directory: `cd build`
Now choose one option either 1 or 2, but not both as one option overwrites the other.
### Building
```sh
# Needed for some dependencies that call cc directly (tz)
echo '#!/bin/sh' >cc
echo 'gcc $@' >>cc
chmod +x cc
export PATH="$PATH:$PWD"
```
- **Configure**: `cmake -B build -DYUZU_TESTS=OFF -DYUZU_USE_BUNDLED_SDL2=OFF -DYUZU_USE_EXTERNAL_SDL2=OFF -DYUZU_USE_LLVM_DEMANGLE=OFF -DYUZU_USE_QT_MULTIMEDIA=OFF -DYUZU_USE_QT_WEB_ENGINE=OFF -DYUZU_USE_BUNDLED_VCPKG=OFF -DYUZU_USE_BUNDLED_QT=OFF -DENABLE_QT=OFF -DSDL_AUDIO=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_QT_UPDATE_CHECKER=OFF`.
- **Build**: `cmake --build build`.
- **Installing**: `sudo cmake --install build`.
### Notes
- Modify the generated ffmpeg.make (in build dir) if using multiple threads (base system `make` doesn't use `-j4`, so change for `gmake`).
- If using OpenIndiana, due to a bug in SDL2 cmake configuration; Audio driver defaults to SunOS `<sys/audioio.h>`, which does not exist on OpenIndiana.
- Enabling OpenSSL requires compiling OpenSSL manually instead of using the provided one from repositores.

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
/* This file is part of the dynarmic project. /* This file is part of the dynarmic project.
* Copyright (c) 2019 MerryMage * Copyright (c) 2019 MerryMage
* SPDX-License-Identifier: 0BSD * SPDX-License-Identifier: 0BSD
@ -13,6 +16,9 @@
# ifndef __OpenBSD__ # ifndef __OpenBSD__
# include <ucontext.h> # include <ucontext.h>
# endif # endif
# ifdef __sun__
# include <sys/regset.h>
# endif
#endif #endif
#include <cstring> #include <cstring>
@ -145,9 +151,9 @@ void SigHandler::SigAction(int sig, siginfo_t* info, void* raw_context) {
#ifndef MCL_ARCHITECTURE_RISCV #ifndef MCL_ARCHITECTURE_RISCV
ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(raw_context); ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(raw_context);
# ifndef __OpenBSD__ #ifndef __OpenBSD__
auto& mctx = ucontext->uc_mcontext; auto& mctx = ucontext->uc_mcontext;
# endif #endif
#endif #endif
#if defined(MCL_ARCHITECTURE_X86_64) #if defined(MCL_ARCHITECTURE_X86_64)
@ -167,6 +173,9 @@ void SigHandler::SigAction(int sig, siginfo_t* info, void* raw_context) {
# elif defined(__OpenBSD__) # elif defined(__OpenBSD__)
# define CTX_RIP (ucontext->sc_rip) # define CTX_RIP (ucontext->sc_rip)
# define CTX_RSP (ucontext->sc_rsp) # define CTX_RSP (ucontext->sc_rsp)
# elif defined(__sun__)
# define CTX_RIP (mctx.gregs[REG_RIP])
# define CTX_RSP (mctx.gregs[REG_RSP])
# else # else
# error "Unknown platform" # error "Unknown platform"
# endif # endif

View file

@ -24,8 +24,8 @@ if (NOT EXISTS "${TZ_DIR}" OR NOT EXISTS "${TZIF_LIST_FILE}")
# separate directory before building. # separate directory before building.
execute_process( execute_process(
COMMAND COMMAND
${GIT_PROGRAM} clone --depth 1 "file://${TZ_SOURCE_DIR}" "${TZ_TMP_SOURCE_DIR}" ${GIT_PROGRAM} clone --depth=1 "file://${TZ_SOURCE_DIR}" "${TZ_TMP_SOURCE_DIR}"
COMMAND_ERROR_IS_FATAL ANY # No need to be fatal, on SunOS this works fine - COMMAND_ERROR_IS_FATAL ANY
) )
if (APPLE) if (APPLE)

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#include "tzif.h" #include "tzif.h"
#include <array> #include <array>
#include <cerrno> #include <cerrno>
@ -7,7 +10,7 @@
#include <getopt.h> #include <getopt.h>
#include <poll.h> #include <poll.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <cstdint>
#include <unistd.h> #include <unistd.h>
constexpr std::size_t ten_megabytes{(1 << 20) * 10}; constexpr std::size_t ten_megabytes{(1 << 20) * 10};
@ -92,7 +95,7 @@ int main(int argc, char *argv[]) {
} }
} }
u_int8_t *buf = new u_int8_t[filesize]; std::uint8_t *buf = new std::uint8_t[filesize];
filesize = read(f, buf, filesize); filesize = read(f, buf, filesize);
if (filesize == static_cast<std::size_t>(-1)) { if (filesize == static_cast<std::size_t>(-1)) {
@ -124,7 +127,7 @@ int main(int argc, char *argv[]) {
delete[] buf; delete[] buf;
std::vector<u_int8_t> output_buffer; std::vector<std::uint8_t> output_buffer;
tzif_data->ReformatNintendo(output_buffer); tzif_data->ReformatNintendo(output_buffer);
filename = "(stdout)"; filename = "(stdout)";

View file

@ -1,14 +1,17 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#include "tzif.h" #include "tzif.h"
#include <cstdint> #include <cstdint>
#include <cstring> #include <cstring>
#include <memory> #include <memory>
#include <sys/types.h> #include <cstdint>
namespace Tzif { namespace Tzif {
static std::size_t SkipToVersion2(const u_int8_t *data, std::size_t size) { static std::size_t SkipToVersion2(const std::uint8_t *data, std::size_t size) {
char magic[5]; char magic[5];
const u_int8_t *p{data}; const std::uint8_t *p{data};
std::memcpy(magic, data, 4); std::memcpy(magic, data, 4);
magic[4] = '\0'; magic[4] = '\0';
@ -28,15 +31,15 @@ static std::size_t SkipToVersion2(const u_int8_t *data, std::size_t size) {
} }
template <typename Type> constexpr static void SwapEndianess(Type *value) { template <typename Type> constexpr static void SwapEndianess(Type *value) {
u_int8_t *data = reinterpret_cast<u_int8_t *>(value); std::uint8_t *data = reinterpret_cast<std::uint8_t *>(value);
union { union {
u_int8_t data[sizeof(Type)]; std::uint8_t data[sizeof(Type)];
Type value; Type value;
} temp; } temp;
for (u_int32_t i = 0; i < sizeof(Type); i++) { for (std::uint32_t i = 0; i < sizeof(Type); i++) {
u_int32_t alt_index = sizeof(Type) - i - 1; std::uint32_t alt_index = sizeof(Type) - i - 1;
temp.data[alt_index] = data[i]; temp.data[alt_index] = data[i];
} }
@ -52,13 +55,13 @@ static void FlipHeader(Header &header) {
SwapEndianess(&header.charcnt); SwapEndianess(&header.charcnt);
} }
std::unique_ptr<DataImpl> ReadData(const u_int8_t *data, std::size_t size) { std::unique_ptr<DataImpl> ReadData(const std::uint8_t *data, std::size_t size) {
const std::size_t v2_offset = SkipToVersion2(data, size); const std::size_t v2_offset = SkipToVersion2(data, size);
if (v2_offset == static_cast<std::size_t>(-1)) { if (v2_offset == static_cast<std::size_t>(-1)) {
return nullptr; return nullptr;
} }
const u_int8_t *p = data + v2_offset; const std::uint8_t *p = data + v2_offset;
Header header; Header header;
std::memcpy(&header, p, sizeof(header)); std::memcpy(&header, p, sizeof(header));
@ -67,10 +70,10 @@ std::unique_ptr<DataImpl> ReadData(const u_int8_t *data, std::size_t size) {
FlipHeader(header); FlipHeader(header);
const std::size_t data_block_length = const std::size_t data_block_length =
header.timecnt * sizeof(int64_t) + header.timecnt * sizeof(u_int8_t) + header.timecnt * sizeof(int64_t) + header.timecnt * sizeof(std::uint8_t) +
header.typecnt * sizeof(TimeTypeRecord) + header.typecnt * sizeof(TimeTypeRecord) +
header.charcnt * sizeof(int8_t) + header.isstdcnt * sizeof(u_int8_t) + header.charcnt * sizeof(int8_t) + header.isstdcnt * sizeof(std::uint8_t) +
header.isutcnt * sizeof(u_int8_t); header.isutcnt * sizeof(std::uint8_t);
if (v2_offset + data_block_length + sizeof(Header) > size) { if (v2_offset + data_block_length + sizeof(Header) > size) {
return nullptr; return nullptr;
@ -81,7 +84,7 @@ std::unique_ptr<DataImpl> ReadData(const u_int8_t *data, std::size_t size) {
const auto copy = const auto copy =
[]<typename Type>(std::unique_ptr<Type[]> &array, int length, []<typename Type>(std::unique_ptr<Type[]> &array, int length,
const u_int8_t *const &ptr) -> const u_int8_t * { const std::uint8_t *const &ptr) -> const std::uint8_t * {
const std::size_t region_length = length * sizeof(Type); const std::size_t region_length = length * sizeof(Type);
array = std::make_unique<Type[]>(length); array = std::make_unique<Type[]>(length);
std::memcpy(array.get(), ptr, region_length); std::memcpy(array.get(), ptr, region_length);
@ -110,16 +113,16 @@ std::unique_ptr<DataImpl> ReadData(const u_int8_t *data, std::size_t size) {
return impl; return impl;
} }
static void PushToBuffer(std::vector<u_int8_t> &buffer, const void *data, static void PushToBuffer(std::vector<std::uint8_t> &buffer, const void *data,
std::size_t size) { std::size_t size) {
const u_int8_t *p{reinterpret_cast<const u_int8_t *>(data)}; const std::uint8_t *p{reinterpret_cast<const std::uint8_t *>(data)};
for (std::size_t i = 0; i < size; i++) { for (std::size_t i = 0; i < size; i++) {
buffer.push_back(*p); buffer.push_back(*p);
p++; p++;
} }
} }
void DataImpl::ReformatNintendo(std::vector<u_int8_t> &buffer) const { void DataImpl::ReformatNintendo(std::vector<std::uint8_t> &buffer) const {
buffer.clear(); buffer.clear();
Header header_copy{header}; Header header_copy{header};
@ -131,7 +134,7 @@ void DataImpl::ReformatNintendo(std::vector<u_int8_t> &buffer) const {
PushToBuffer(buffer, transition_times.get(), PushToBuffer(buffer, transition_times.get(),
header.timecnt * sizeof(int64_t)); header.timecnt * sizeof(int64_t));
PushToBuffer(buffer, transition_types.get(), PushToBuffer(buffer, transition_types.get(),
header.timecnt * sizeof(u_int8_t)); header.timecnt * sizeof(std::uint8_t));
PushToBuffer(buffer, local_time_type_records.get(), PushToBuffer(buffer, local_time_type_records.get(),
header.typecnt * sizeof(TimeTypeRecord)); header.typecnt * sizeof(TimeTypeRecord));
PushToBuffer(buffer, time_zone_designations.get(), PushToBuffer(buffer, time_zone_designations.get(),

View file

@ -1,22 +1,25 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once #pragma once
#include <array> #include <array>
#include <memory> #include <memory>
#include <sys/types.h> #include <cstdint>
#include <vector> #include <vector>
namespace Tzif { namespace Tzif {
typedef struct { typedef struct {
char magic[4]; char magic[4];
u_int8_t version; std::uint8_t version;
u_int8_t reserved[15]; std::uint8_t reserved[15];
u_int32_t isutcnt; std::uint32_t isutcnt;
u_int32_t isstdcnt; std::uint32_t isstdcnt;
u_int32_t leapcnt; std::uint32_t leapcnt;
u_int32_t timecnt; std::uint32_t timecnt;
u_int32_t typecnt; std::uint32_t typecnt;
u_int32_t charcnt; std::uint32_t charcnt;
} Header; } Header;
static_assert(sizeof(Header) == 0x2c); static_assert(sizeof(Header) == 0x2c);
@ -34,9 +37,9 @@ public:
#pragma pack(push, 1) #pragma pack(push, 1)
typedef struct { typedef struct {
u_int32_t utoff; std::uint32_t utoff;
u_int8_t dst; std::uint8_t dst;
u_int8_t idx; std::uint8_t idx;
} TimeTypeRecord; } TimeTypeRecord;
#pragma pack(pop) #pragma pack(pop)
static_assert(sizeof(TimeTypeRecord) == 0x6); static_assert(sizeof(TimeTypeRecord) == 0x6);
@ -46,7 +49,7 @@ public:
explicit Data() = default; explicit Data() = default;
virtual ~Data() = default; virtual ~Data() = default;
virtual void ReformatNintendo(std::vector<u_int8_t> &buffer) const = 0; virtual void ReformatNintendo(std::vector<std::uint8_t> &buffer) const = 0;
}; };
class DataImpl : public Data { class DataImpl : public Data {
@ -54,19 +57,19 @@ public:
explicit DataImpl() = default; explicit DataImpl() = default;
~DataImpl() override = default; ~DataImpl() override = default;
void ReformatNintendo(std::vector<u_int8_t> &buffer) const override; void ReformatNintendo(std::vector<std::uint8_t> &buffer) const override;
Header header; Header header;
Footer footer; Footer footer;
std::unique_ptr<int64_t[]> transition_times; std::unique_ptr<int64_t[]> transition_times;
std::unique_ptr<u_int8_t[]> transition_types; std::unique_ptr<std::uint8_t[]> transition_types;
std::unique_ptr<TimeTypeRecord[]> local_time_type_records; std::unique_ptr<TimeTypeRecord[]> local_time_type_records;
std::unique_ptr<int8_t[]> time_zone_designations; std::unique_ptr<int8_t[]> time_zone_designations;
std::unique_ptr<u_int8_t[]> standard_indicators; std::unique_ptr<std::uint8_t[]> standard_indicators;
std::unique_ptr<u_int8_t[]> ut_indicators; std::unique_ptr<std::uint8_t[]> ut_indicators;
}; };
std::unique_ptr<DataImpl> ReadData(const u_int8_t *data, std::size_t size); std::unique_ptr<DataImpl> ReadData(const std::uint8_t *data, std::size_t size);
} // namespace Tzif } // namespace Tzif

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Baldur Karlsson // SPDX-FileCopyrightText: Baldur Karlsson
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
@ -38,14 +41,8 @@
#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) #if defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER)
#define RENDERDOC_CC __cdecl #define RENDERDOC_CC __cdecl
#elif defined(__linux__)
#define RENDERDOC_CC
#elif defined(__APPLE__)
#define RENDERDOC_CC
#elif defined(__FreeBSD__)
#define RENDERDOC_CC
#else #else
#error "Unknown platform" #define RENDERDOC_CC
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -1,8 +1,12 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <span> #include <span>
#include <vector> #include <vector>
#include <SDL.h> #include <SDL.h>
#include "audio_core/common/common.h" #include "audio_core/common/common.h"

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
/* /*
Minimal asymmetric stackful cross-platform coroutine library in pure C. Minimal asymmetric stackful cross-platform coroutine library in pure C.
minicoro - v0.2.0 - 15/Nov/2023 minicoro - v0.2.0 - 15/Nov/2023
@ -467,7 +470,7 @@ extern "C" {
#ifdef MCO_NO_MULTITHREAD #ifdef MCO_NO_MULTITHREAD
#define MCO_THREAD_LOCAL #define MCO_THREAD_LOCAL
#else #else
#ifdef thread_local #if defined(thread_local) || __STDC_VERSION__ >= 202311L || defined(__sun__)
#define MCO_THREAD_LOCAL thread_local #define MCO_THREAD_LOCAL thread_local
#elif __STDC_VERSION__ >= 201112 && !defined(__STDC_NO_THREADS__) #elif __STDC_VERSION__ >= 201112 && !defined(__STDC_NO_THREADS__)
#define MCO_THREAD_LOCAL _Thread_local #define MCO_THREAD_LOCAL _Thread_local

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
@ -440,8 +443,8 @@ Result AlbumManager::SaveImage(ApplicationAlbumEntry& out_entry, std::span<const
const auto screenshot_path = const auto screenshot_path =
Common::FS::GetEdenPathString(Common::FS::EdenPath::ScreenshotsDir); Common::FS::GetEdenPathString(Common::FS::EdenPath::ScreenshotsDir);
const std::string formatted_date = const std::string formatted_date =
fmt::format("{:04}-{:02}-{:02}_{:02}-{:02}-{:02}-{:03}", date.year, date.month, date.day, fmt::format("{:04}-{:02}-{:02}_{:02}-{:02}-{:02}-{:03}", u16(date.year), u8(date.month), u8(date.day),
date.hour, date.minute, date.second, 0); u8(date.hour), u8(date.minute), u8(date.second), 0);
const std::string file_path = const std::string file_path =
fmt::format("{}/{:016x}_{}.png", screenshot_path, title_id, formatted_date); fmt::format("{}/{:016x}_{}.png", screenshot_path, title_id, formatted_date);

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
@ -206,9 +209,9 @@ template <>
struct fmt::formatter<Service::PSC::Time::CalendarTime> : fmt::formatter<fmt::string_view> { struct fmt::formatter<Service::PSC::Time::CalendarTime> : fmt::formatter<fmt::string_view> {
template <typename FormatContext> template <typename FormatContext>
auto format(const Service::PSC::Time::CalendarTime& calendar, FormatContext& ctx) const { auto format(const Service::PSC::Time::CalendarTime& calendar, FormatContext& ctx) const {
return fmt::format_to(ctx.out(), "[{:02}/{:02}/{:04} {:02}:{:02}:{:02}]", calendar.day, return fmt::format_to(ctx.out(), "[{:02}/{:02}/{:04} {:02}:{:02}:{:02}]", u8(calendar.day),
calendar.month, calendar.year, calendar.hour, calendar.minute, u8(calendar.month), u16(calendar.year), u8(calendar.hour), u8(calendar.minute),
calendar.second); u8(calendar.second));
} }
}; };

View file

@ -27,7 +27,7 @@ namespace Network {
#ifdef _WIN32 #ifdef _WIN32
std::vector<NetworkInterface> GetAvailableNetworkInterfaces() { std::vector<Network::NetworkInterface> GetAvailableNetworkInterfaces() {
ULONG buf_size = 0; ULONG buf_size = 0;
if (GetAdaptersAddresses( if (GetAdaptersAddresses(
@ -47,7 +47,7 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
return {}; return {};
} }
std::vector<NetworkInterface> result; std::vector<Network::NetworkInterface> result;
for (auto* a = addrs; a; a = a->Next) { for (auto* a = addrs; a; a = a->Next) {
@ -80,7 +80,7 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
break; break;
} }
result.emplace_back(NetworkInterface{ result.emplace_back(Network::NetworkInterface{
.name = Common::UTF16ToUTF8(std::wstring{a->FriendlyName}), .name = Common::UTF16ToUTF8(std::wstring{a->FriendlyName}),
.ip_address = ip, .ip_address = ip,
.subnet_mask = mask, .subnet_mask = mask,
@ -94,7 +94,7 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
#else #else
std::vector<NetworkInterface> GetAvailableNetworkInterfaces() { std::vector<Network::NetworkInterface> GetAvailableNetworkInterfaces() {
struct ifaddrs* ifaddr = nullptr; struct ifaddrs* ifaddr = nullptr;
if (getifaddrs(&ifaddr) != 0) { if (getifaddrs(&ifaddr) != 0) {
@ -103,7 +103,7 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
return {}; return {};
} }
std::vector<NetworkInterface> result; std::vector<Network::NetworkInterface> result;
for (auto ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next) { for (auto ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next) {
if (ifa->ifa_addr == nullptr || ifa->ifa_netmask == nullptr) { if (ifa->ifa_addr == nullptr || ifa->ifa_netmask == nullptr) {
@ -121,7 +121,7 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
#ifdef ANDROID #ifdef ANDROID
// On Android, we can't reliably get gateway info from /proc/net/route // On Android, we can't reliably get gateway info from /proc/net/route
// Just use 0 as the gateway address // Just use 0 as the gateway address
result.emplace_back(NetworkInterface{ result.emplace_back(Network::NetworkInterface{
.name{ifa->ifa_name}, .name{ifa->ifa_name},
.ip_address{Common::BitCast<struct sockaddr_in>(*ifa->ifa_addr).sin_addr}, .ip_address{Common::BitCast<struct sockaddr_in>(*ifa->ifa_addr).sin_addr},
.subnet_mask{Common::BitCast<struct sockaddr_in>(*ifa->ifa_netmask).sin_addr}, .subnet_mask{Common::BitCast<struct sockaddr_in>(*ifa->ifa_netmask).sin_addr},
@ -134,11 +134,15 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
if (!file.is_open()) { if (!file.is_open()) {
LOG_ERROR(Network, "Failed to open \"/proc/net/route\""); LOG_ERROR(Network, "Failed to open \"/proc/net/route\"");
result.emplace_back(NetworkInterface{ // Solaris defines s_addr as a macro, can't use special C++ shenanigans here
.name{ifa->ifa_name}, in_addr gateway_0;
.ip_address{Common::BitCast<struct sockaddr_in>(*ifa->ifa_addr).sin_addr}, gateway_0.s_addr = gateway;
.subnet_mask{Common::BitCast<struct sockaddr_in>(*ifa->ifa_netmask).sin_addr}, result.emplace_back(Network::NetworkInterface{
.gateway{in_addr{.s_addr = gateway}}}); .name = ifa->ifa_name,
.ip_address = Common::BitCast<struct sockaddr_in>(*ifa->ifa_addr).sin_addr,
.subnet_mask = Common::BitCast<struct sockaddr_in>(*ifa->ifa_netmask).sin_addr,
.gateway = gateway_0
});
continue; continue;
} }
@ -183,11 +187,14 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
gateway = 0; gateway = 0;
} }
result.emplace_back(NetworkInterface{ in_addr gateway_0;
.name{ifa->ifa_name}, gateway_0.s_addr = gateway;
.ip_address{Common::BitCast<struct sockaddr_in>(*ifa->ifa_addr).sin_addr}, result.emplace_back(Network::NetworkInterface{
.subnet_mask{Common::BitCast<struct sockaddr_in>(*ifa->ifa_netmask).sin_addr}, .name = ifa->ifa_name,
.gateway{in_addr{.s_addr = gateway}}}); .ip_address = Common::BitCast<struct sockaddr_in>(*ifa->ifa_addr).sin_addr,
.subnet_mask = Common::BitCast<struct sockaddr_in>(*ifa->ifa_netmask).sin_addr,
.gateway = gateway_0
});
#endif // ANDROID #endif // ANDROID
} }
@ -197,7 +204,7 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
#endif // _WIN32 #endif // _WIN32
std::optional<NetworkInterface> GetSelectedNetworkInterface() { std::optional<Network::NetworkInterface> GetSelectedNetworkInterface() {
const auto& selected_network_interface = Settings::values.network_interface.GetValue(); const auto& selected_network_interface = Settings::values.network_interface.GetValue();
const auto network_interfaces = Network::GetAvailableNetworkInterfaces(); const auto network_interfaces = Network::GetAvailableNetworkInterfaces();

View file

@ -25,6 +25,11 @@ if (ENABLE_WEB_SERVICE)
target_link_libraries(network PRIVATE web_service) target_link_libraries(network PRIVATE web_service)
endif() endif()
# Solaris uses /lib/amd64/libsocket.so and /lib/amd64/libnsl.so
if (${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
target_link_libraries(network PRIVATE socket nsl)
endif()
if (YUZU_USE_PRECOMPILED_HEADERS) if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(network PRIVATE precompiled_headers.h) target_precompile_headers(network PRIVATE precompiled_headers.h)
endif() endif()

View file

@ -40,6 +40,11 @@ target_include_directories(yuzu-cmd PRIVATE ${RESOURCES_DIR})
target_link_libraries(yuzu-cmd PRIVATE SDL2::SDL2 Vulkan::Headers) target_link_libraries(yuzu-cmd PRIVATE SDL2::SDL2 Vulkan::Headers)
# In Solaris needs explicit linking for ffmpeg which links to /lib/amd64/libX11.so
if (${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
target_link_libraries(yuzu-cmd PRIVATE X11)
endif()
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
install(TARGETS yuzu-cmd) install(TARGETS yuzu-cmd)
endif() endif()