Split librpcpu into librpbyteswap and librpcpuid.

librpbyteswap is still embedded into libromdata and has exported
functions.

librpcpuid is a standalone static library and will be linked into
anything that needs CPU flags, instead of using __builtin_cpu_supports().
librpcpuid's version is more efficient because it has fewer tests and
it doesn't do string comparisons.

Remove #include "byteorder.h" from a few files, since it isn't actually used:
- librpbase/img/RpPng.cpp
- librpbase/img/RpPngWriter.cpp
- libromdata/disc/xdvdfs_structs.h
- libromdata/Media/hsfs_structs.h

[gtk,librpbase] Remove #include "librpcpu/cpu_dispatch.h" from stdafx.h,
since it's only used by a few files.

[gtk3] CMakeLists.txt: Removed SSSE3 checks. SSSE3 is only used by
GdkImageConv, which is only used by the XFCE (GTK2) UI frontend.

[gtk3] CairoImageConv.hpp: Remove #include "librpcpu/cpu_dispatch.h",
since it isn't actually used here.

[xfce] GdkImageConv_ifunc.cpp, [librpbyteswap] byteswap_ifunc.c:
- #include "config.librpcpuid.h" before checking for HAVE_IFUNC.
  This was indirectly included before, but explicitly including it
  allows us to skip the other inclusion if IFUNC is not available.
This commit is contained in:
David Korth 2024-03-14 21:56:58 -04:00
parent efee165ce4
commit 4c64309bc5
67 changed files with 241 additions and 190 deletions

View File

@ -16,9 +16,9 @@
#include <cassert>
#include <vector>
// rom-properties: Use librpcpu's byteorder macros.
// rom-properties: Use librpbyteswap's byteorder macros.
// NOTE: Not able to detect built-in byteswapping intrinsics here.
#include "../../src/librpcpu/byteorder.h"
#include "../../src/librpbyteswap/byteorder.h"
#define __swab32(x) \
((uint32_t)((((uint32_t)x) << 24) | (((uint32_t)x) >> 24) | \
((((uint32_t)x) & 0x0000FF00UL) << 8) | \

View File

@ -57,8 +57,9 @@ typedef uint64_t deUint64;
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
// rom-properties
#include "../../src/librpcpu/byteorder.h"
// rom-properties: Use librpbyteswap's byteorder macros.
// NOTE: Not able to detect built-in byteswapping intrinsics here.
#include "../../src/librpbyteswap/byteorder.h"
namespace basisu_astc
{

View File

@ -129,7 +129,8 @@ ADD_SUBDIRECTORY(libi18n)
ADD_SUBDIRECTORY(librpthreads)
ADD_SUBDIRECTORY(libcachecommon)
ADD_SUBDIRECTORY(rp-download)
ADD_SUBDIRECTORY(librpcpu)
ADD_SUBDIRECTORY(librpcpuid)
ADD_SUBDIRECTORY(librpbyteswap)
ADD_SUBDIRECTORY(librpfile)
ADD_SUBDIRECTORY(librptext)
ADD_SUBDIRECTORY(librpbase)

View File

@ -25,7 +25,7 @@ ELSE(CMAKE_CROSSCOMPILING)
#SET_WINDOWS_NO_MANIFEST(amiiboc)
SET_WINDOWS_ENTRYPOINT(amiiboc wmain OFF)
TARGET_LINK_LIBRARIES(amiiboc PRIVATE rpsecure rpcpu)
TARGET_LINK_LIBRARIES(amiiboc PRIVATE rpsecure rpbyteswap)
TARGET_INCLUDE_DIRECTORIES(amiiboc
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> # amiibo-data
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> # amiibo-data

View File

@ -82,29 +82,11 @@ IF(ENABLE_ACHIEVEMENTS)
SET(${PROJECT_NAME}-notify_SRCS ${${PROJECT_NAME}-notify_SRCS})
ENDIF(ENABLE_ACHIEVEMENTS)
# CPU-specific and optimized sources.
IF(${PROJECT_NAME}_SSSE3_SRCS)
STRING(REGEX REPLACE "([^;]+)" "../\\1" ${PROJECT_NAME}_SSSE3_SRCS "${${PROJECT_NAME}_SSSE3_SRCS}")
IF(MSVC AND NOT CMAKE_CL_64)
SET(SSSE3_FLAG "/arch:SSE2")
ELSEIF(NOT MSVC)
# TODO: Other compilers?
SET(SSSE3_FLAG "-mssse3")
ENDIF()
IF(SSSE3_FLAG)
SET_SOURCE_FILES_PROPERTIES(${${PROJECT_NAME}_SSSE3_SRCS}
APPEND_STRING PROPERTIES COMPILE_FLAGS " ${SSSE3_FLAG} ")
ENDIF(SSSE3_FLAG)
ENDIF()
UNSET(arch)
# Sources and headers. (GTK3-specific)
SET(${PROJECT_NAME}_SRCS
${${PROJECT_NAME}_SRCS} ${${PROJECT_NAME}_H}
${${PROJECT_NAME}-notify_SRCS} ${${PROJECT_NAME}-notify_H}
${${PROJECT_NAME}_IFUNC_SRCS}
${${PROJECT_NAME}_SSSE3_SRCS}
NautilusPlugin.cpp
NautilusPropertyPageProvider.cpp
NautilusMenuProvider.cpp

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (GTK+ common) *
* CairoImageConv.hpp: Helper functions to convert from rp_image to Cairo. *
* *
* Copyright (c) 2017-2023 by David Korth. *
* Copyright (c) 2017-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -12,7 +12,6 @@
// we can't simply make a cairo_surface_t rp_image backend.
#include "common.h"
#include "librpcpu/cpu_dispatch.h"
namespace LibRpTexture {
class rp_image;

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (GTK+ common) *
* GdkTextureConv.hpp: Helper functions to convert from rp_image to GDK4. *
* *
* Copyright (c) 2017-2023 by David Korth. *
* Copyright (c) 2017-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -12,7 +12,7 @@
// allow for raw data access. Because of this, we can't simply
// make a GdkTexture rp_image backend.
#include "librpcpu/cpu_dispatch.h"
#include "librpcpuid/cpu_dispatch.h"
namespace LibRpTexture {
class rp_image;
}

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (GTK+ common) *
* stdafx.h: Common definitions and includes. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -92,9 +92,6 @@
#include "ctypex.h"
#include "dll-macros.h"
// librpcpu
#include "librpcpu/cpu_dispatch.h"
#ifdef __cplusplus
// librpbase C++ headers
#include "librpbase/RomData.hpp"

View File

@ -131,6 +131,7 @@ IF(BUILD_XFCE)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE rom-properties-glib)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE romdata)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE rpcpuid) # for CPU dispatch
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE GdkPixbuf2::gdkpixbuf2)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC GTK2::gtk GTK2::gdk GTK2::pango)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC GLib2::gio-unix GLib2::gio GLib2::gobject GLib2::glib)

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (GTK+ common) *
* GdkImageConv.hpp: Helper functions to convert from rp_image to GDK. *
* *
* Copyright (c) 2017-2023 by David Korth. *
* Copyright (c) 2017-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -11,14 +11,14 @@
// NOTE: GdkPixbuf doesn't natively support 8bpp. Because of this,
// we can't simply make a GdkPixbuf rp_image backend.
#include "librpcpu/cpu_dispatch.h"
#include "librpcpuid/cpu_dispatch.h"
namespace LibRpTexture {
class rp_image;
}
#include <gdk-pixbuf/gdk-pixbuf.h>
#if defined(RP_CPU_I386) || defined(RP_CPU_AMD64)
# include "librpcpu/cpuflags_x86.h"
# include "librpcpuid/cpuflags_x86.h"
# define GDKIMAGECONV_HAS_SSSE3 1
#endif

View File

@ -2,12 +2,12 @@
* ROM Properties Page shell extension. (GTK+ common) *
* GdkImageConv_ifunc.cpp: GdkImageConv IFUNC resolution functions. *
* *
* Copyright (c) 2016-2022 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
#include "stdafx.h"
#include "config.librpcpu.h"
#include "config.librpcpuid.h"
#ifdef HAVE_IFUNC

View File

@ -548,11 +548,12 @@ IF(${PROJECT_NAME}_LINKAGE STREQUAL SHARED)
# should be linked in as PRIVATE, and include directories added
# manually. Otherwise, the .a libraries get linked in to the
# UI frontend plugins.
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE rpcpu-dll rptexture-dll rpfile-dll rpbase-dll rptext-dll)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE rpbyteswap-dll rptexture-dll rpfile-dll rpbase-dll rptext-dll)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE rpthreads-dll cachecommon-dll)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE rpcpuid) # for CPU dispatch
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../librpcpu>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../librpcpu>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../librpbyteswap>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../librpbyteswap>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../librptexture>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../librptexture>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../librpfile>
@ -600,6 +601,7 @@ IF(${PROJECT_NAME}_LINKAGE STREQUAL SHARED)
ELSE()
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC rpcpu rptexture rpfile rpbase rptext)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC rpthreads cachecommon)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE rpcpuid) # for CPU dispatch
IF(ENABLE_NLS)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC i18n)
ENDIF(ENABLE_NLS)

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (libromdata) *
* xbox360_common_structs.h: Microsoft Xbox 360 common data structures. *
* *
* Copyright (c) 2019-2023 by David Korth. *
* Copyright (c) 2019-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -11,7 +11,7 @@
#include <stdint.h>
#include "common.h"
#include "librpcpu/byteorder.h"
#include "librpbyteswap/byteorder.h"
/**
* Xbox 360: Vesion number

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (libromdata) *
* hsfs_structs.h: High Sierra structs for old CD-ROM images. *
* *
* Copyright (c) 2017-2023 by David Korth. *
* Copyright (c) 2017-2024 by David Korth. *
* Copyright (c) 2020 by Egor. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -14,7 +14,6 @@
#include <stdint.h>
#include "common.h"
#include "librpcpu/byteorder.h"
#include "../iso_structs.h"
#ifdef __cplusplus

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (libromdata) *
* N3DSVerifyKeys.hpp: Nintendo 3DS key verification data. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -15,8 +15,8 @@
#include "common.h"
// librpcpu
#include "librpcpu/byteswap_rp.h"
// librpbyteswap
#include "librpbyteswap/byteswap_rp.h"
#include "librpbase/crypto/KeyManager.hpp"
#include "../Handheld/n3ds_structs.h"

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (libromdata) *
* xdvdfs_structs.h: Xbox XDVDFS structs. *
* *
* Copyright (c) 2019-2023 by David Korth. *
* Copyright (c) 2019-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -15,9 +15,7 @@
#pragma once
#include <stdint.h>
#include "common.h"
#include "librpcpu/byteorder.h"
#ifdef __cplusplus
extern "C" {

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (libromdata) *
* iso9660.h: ISO-9660 structs for CD-ROM images. *
* *
* Copyright (c) 2017-2023 by David Korth. *
* Copyright (c) 2017-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -15,7 +15,7 @@
#include <stdint.h>
#include "common.h"
#include "librpcpu/byteswap_rp.h"
#include "librpbyteswap/byteswap_rp.h"
#ifdef __cplusplus
extern "C" {

View File

@ -2,15 +2,16 @@
* ROM Properties Page shell extension. (libromdata) *
* nintendo_system_id.h: Nintendo system IDs. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
#pragma once
#include <stdint.h>
#include "byteorder.h"
#include "common.h"
#include "librpbyteswap/byteorder.h"
#ifdef __cplusplus
extern "C" {

View File

@ -58,9 +58,9 @@
#include "ctypex.h"
#include "dll-macros.h"
// librpcpu
#include "librpcpu/byteswap_rp.h"
#include "librpcpu/bitstuff.h"
// librpbyteswap
#include "librpbyteswap/byteswap_rp.h"
#include "librpbyteswap/bitstuff.h"
#ifdef __cplusplus
// librpbase C++ headers

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (libromdata/tests) *
* NintendoSystemIDTest.cpp: Nintendo System ID structs test. *
* *
* Copyright (c) 2016-2022 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -10,7 +10,7 @@
#include "gtest/gtest.h"
#include "tcharx.h"
#include "byteswap_rp.h"
#include "librpbyteswap/byteswap_rp.h"
#include "nintendo_system_id.h"
// C includes. (C++ namespace)

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (libromdata) *
* SuperMagicDrive.cpp: Super Magic Drive deinterleaving function. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -13,9 +13,9 @@
#include <stdint.h>
#include "librpcpu/cpu_dispatch.h"
#include "librpcpuid/cpu_dispatch.h"
#if defined(RP_CPU_I386) || defined(RP_CPU_AMD64)
# include "librpcpu/cpuflags_x86.h"
# include "librpcpuid/cpuflags_x86.h"
/* MSVC does not support MMX intrinsics in 64-bit builds. */
/* Reference: https://docs.microsoft.com/en-us/cpp/cpp/m64?view=msvc-160 */
/* In addition, amd64 CPUs all support SSE2 as a minimum, */

View File

@ -2,13 +2,13 @@
* ROM Properties Page shell extension. (librpbase) *
* SuperMagicDrive_ifunc.cpp: SuperMagicDrive IFUNC resolution functions. *
* *
* Copyright (c) 2016-2022 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
#include "stdafx.h"
#include "config.librpbase.h"
#include "config.librpcpu.h"
#include "config.librpcpuid.h"
#ifdef HAVE_IFUNC

View File

@ -223,9 +223,10 @@ FOREACH(_target ${TARGETS})
# Other libraries
TARGET_LINK_LIBRARIES(${_target} PRIVATE
rpcpu${_target_suffix} rpfile${_target_suffix} rptext${_target_suffix}
rpbyteswap${_target_suffix} rpfile${_target_suffix} rptext${_target_suffix}
rptexture${_target_suffix} rpthreads${_target_suffix}
cachecommon${_target_suffix})
TARGET_LINK_LIBRARIES(${_target} PRIVATE rpcpuid) # for CPU dispatch
TARGET_LINK_LIBRARIES(${_target} PRIVATE inih)
IF(ZLIB_FOUND)

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (librpbase) *
* RpJpeg.cpp: JPEG image handler. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -16,12 +16,12 @@
// libi18n
#include "libi18n/i18n.h"
// librpfile, librptexture
// Other rom-properties libraries
using namespace LibRpFile;
using namespace LibRpTexture;
#ifdef RPJPEG_HAS_SSSE3
# include "librpcpu/cpuflags_x86.h"
# include "librpcpuid/cpuflags_x86.h"
#endif /* RPJPEG_HAS_SSSE3 */
// C includes (C++ namespace)

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (librpbase) *
* RpPng.cpp: PNG image handler. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -11,8 +11,7 @@
#include "RpPng.hpp"
// librpcpu, librpfile, librptexture
#include "librpcpu/byteorder.h"
// Other rom-properties libraries
#include "librpfile/IRpFile.hpp"
#include "librptexture/img/rp_image.hpp"
using namespace LibRpFile;

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (librpbase) *
* RpPngWriter.cpp: PNG image writer. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -11,7 +11,6 @@
#include "RpPngWriter.hpp"
// Other rom-properties libraries
#include "librpcpu/byteorder.h"
#include "librpfile/RpFile.hpp"
#include "img/rp_image.hpp"
using namespace LibRpText;

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (librpbase) *
* stdafx.h: Common definitions and includes. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -62,16 +62,15 @@
# include "libwin32common/RpWin32_sdk.h"
#endif /* _WIN32 */
// librpcpu
#include "librpcpu/byteswap_rp.h"
#include "librpcpu/bitstuff.h"
// librpbyteswap
#include "librpbyteswap/byteswap_rp.h"
#include "librpbyteswap/bitstuff.h"
// librpbase common headers
#include "common.h"
#include "aligned_malloc.h"
#include "ctypex.h"
#include "dll-macros.h"
#include "librpcpu/cpu_dispatch.h"
#ifdef __cplusplus
// librpbase C++ headers

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (librpbase/tests) *
* RpPngFormatTest.cpp: RpPng format test. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -35,7 +35,7 @@
#include "uvector.h"
// Other rom-properties libraries
#include "librpcpu/byteswap_rp.h"
#include "librpbyteswap/byteswap_rp.h"
#include "librpfile/FileSystem.hpp"
#include "librpfile/MemFile.hpp"
#include "librpfile/RpFile.hpp"

View File

@ -1,27 +1,23 @@
# rom-properties CPU support library
PROJECT(rpcpu LANGUAGES C)
# rom-properties byteswapping library
PROJECT(rpbyteswap LANGUAGES C)
# Check for C headers.
CHECK_INCLUDE_FILES("features.h" HAVE_FEATURES_H)
CHECK_INCLUDE_FILES("cpuid.h" HAVE_CPUID_H)
# Sources.
# Sources
SET(${PROJECT_NAME}_SRCS
byteswap.c
)
# Headers.
# Headers
SET(${PROJECT_NAME}_H
byteorder.h
byteswap_rp.h
bitstuff.h
)
# CPU-specific and optimized sources.
# CPU-specific and optimized sources
INCLUDE(CPUInstructionSetFlags)
IF(CPU_i386 OR CPU_amd64)
SET(${PROJECT_NAME}_CPU_SRCS cpuflags_x86.c)
SET(${PROJECT_NAME}_CPU_H cpuflags_x86.h)
# MSVC does not support MMX intrinsics in 64-bit builds.
# Reference: https://docs.microsoft.com/en-us/cpp/cpp/m64?view=msvc-160
#
@ -65,8 +61,7 @@ IF(NOT MSVC)
CHECK_C_SOURCE_COMPILES("int main(int argc, char *argv[]) { return __builtin_bswap64((unsigned long long)argc); }" HAVE___BUILTIN_BSWAP64)
ENDIF(NOT MSVC)
# Write the config.h files.
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/config.librpcpu.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.librpcpu.h")
# Write the config.h files
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/config.byteswap.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.byteswap.h")
######################
@ -87,8 +82,6 @@ ENDIF()
FOREACH(_target ${TARGETS})
ADD_LIBRARY(${_target} STATIC
${${PROJECT_NAME}_SRCS} ${${PROJECT_NAME}_H}
${${PROJECT_NAME}_OS_SRCS} ${${PROJECT_NAME}_OS_H}
${${PROJECT_NAME}_CPU_SRCS} ${${PROJECT_NAME}_CPU_H}
${${PROJECT_NAME}_IFUNC_SRCS}
${${PROJECT_NAME}_MMX_SRCS}
${${PROJECT_NAME}_SSE2_SRCS}
@ -110,6 +103,8 @@ FOREACH(_target ${TARGETS})
UNSET(_target_suffix)
ENDIF()
# rpcpuid is needed for CPU identification.
TARGET_LINK_LIBRARIES(${_target} PRIVATE rpcpuid)
# rpthreads is needed for atomic functions.
TARGET_LINK_LIBRARIES(${_target} PRIVATE rpthreads${_target_suffix})
@ -118,8 +113,8 @@ FOREACH(_target ${TARGETS})
# - Private: Parent source and binary directories,
# and top-level binary directory for git_version.h.
TARGET_INCLUDE_DIRECTORIES(${_target}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> # librpcpu
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> # librpcpu
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> # librpbyteswap
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> # librpbyteswap
PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..> # src
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/..> # src
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}> # build

View File

@ -1,8 +1,8 @@
/***************************************************************************
* ROM Properties Page shell extension. (librpcpu) *
* ROM Properties Page shell extension. (librpbyteswap) *
* bitstuff.h: Bit manipulation inline functions. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/

View File

@ -1,8 +1,8 @@
/***************************************************************************
* ROM Properties Page shell extension. (librpcpu) *
* ROM Properties Page shell extension. (librpbyteswap) *
* byteorder.h: System byte order header. *
* *
* Copyright (c) 2011-2023 by David Korth. *
* Copyright (c) 2011-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/

View File

@ -1,9 +1,9 @@
/***************************************************************************
* ROM Properties Page shell extension. (librpcpu) *
* ROM Properties Page shell extension. (librpbyteswap) *
* byteswap.c: Byteswapping functions. *
* Standard version. (C code only) *
* *
* Copyright (c) 2008-2022 by David Korth *
* Copyright (c) 2008-2024 by David Korth *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/

View File

@ -1,16 +1,18 @@
/***************************************************************************
* ROM Properties Page shell extension. (librpcpu) *
* ROM Properties Page shell extension. (librpbyteswap) *
* byteswap_ifunc.c: Byteswapping functions. (IFUNC) *
* *
* Copyright (c) 2016-2022 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
#include "byteswap_rp.h"
#include "cpu_dispatch.h"
#include "config.librpcpuid.h"
#ifdef HAVE_IFUNC
#include "byteswap_rp.h"
#include "cpu_dispatch.h"
// NOTE: llvm/clang 14.0.0 fails to detect the resolver functions
// if they're marked static, even though the docs say this is okay.
// In C code, it merely warns that the resolvers aren't used, but

View File

@ -1,9 +1,9 @@
/***************************************************************************
* ROM Properties Page shell extension. (librpcpu) *
* ROM Properties Page shell extension. (librpbyteswap) *
* byteswap_mmx.c: Byteswapping functions. *
* MMX-optimized version. *
* *
* Copyright (c) 2008-2022 by David Korth *
* Copyright (c) 2008-2024 by David Korth *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/

View File

@ -1,8 +1,8 @@
/***************************************************************************
* ROM Properties Page shell extension. (librpcpu) *
* ROM Properties Page shell extension. (librpbyteswap) *
* byteswap_rp.h: Byteswapping functions. *
* *
* Copyright (c) 2008-2023 by David Korth. *
* Copyright (c) 2008-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -11,16 +11,16 @@
// C includes.
#include <stdint.h>
#include "config.librpcpu.h"
#include "config.byteswap.h"
#include "librpcpuid/config.librpcpuid.h"
#include "librpcpuid/cpu_dispatch.h"
#include "byteorder.h"
#include "cpu_dispatch.h"
#include "librpbyteswap/config.byteswap.h"
#include "librpbyteswap/byteorder.h"
#include "dll-macros.h"
#include "force_inline.h"
#if defined(RP_CPU_I386) || defined(RP_CPU_AMD64)
# include "cpuflags_x86.h"
# include "librpcpuid/cpuflags_x86.h"
/* MSVC does not support MMX intrinsics in 64-bit builds. */
/* Reference: https://docs.microsoft.com/en-us/cpp/cpp/m64?view=msvc-160 */
/* In addition, amd64 CPUs all support SSE2 as a minimum, */

View File

@ -1,9 +1,9 @@
/***************************************************************************
* ROM Properties Page shell extension. (librpcpu) *
* ROM Properties Page shell extension. (librpbyteswap) *
* byteswap_sse2.c: Byteswapping functions. *
* SSE2-optimized version. *
* *
* Copyright (c) 2008-2022 by David Korth *
* Copyright (c) 2008-2024 by David Korth *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/

View File

@ -1,9 +1,9 @@
/***************************************************************************
* ROM Properties Page shell extension. (librpcpu) *
* ROM Properties Page shell extension. (librpbyteswap) *
* byteswap_ssse3.c: Byteswapping functions. *
* SSSE3-optimized version. *
* *
* Copyright (c) 2008-2022 by David Korth *
* Copyright (c) 2008-2024 by David Korth *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/

View File

@ -1,8 +1,8 @@
/***************************************************************************
* ROM Properties Page shell extension. (librpcpu) *
* ROM Properties Page shell extension. (librpbyteswap) *
* config.byteswap.h.in: Byteswap intrinsics configuration. (source file) *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/

View File

@ -1,8 +1,8 @@
/***************************************************************************
* ROM Properties Page shell extension. (librpcpu/tests) *
* ROM Properties Page shell extension. (librpbyteswap/tests) *
* BitstuffTest.cpp: bitstuff.h functions test *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -11,7 +11,7 @@
#include "tcharx.h"
// bit stuff
#include "librpcpu/bitstuff.h"
#include "librpbyteswap/bitstuff.h"
// C includes. (C++ namespace)
#include <cstdio>

View File

@ -1,8 +1,8 @@
/***************************************************************************
* ROM Properties Page shell extension. (librpcpu/tests) *
* ROM Properties Page shell extension. (librpbyteswap/tests) *
* ByteswapTest.cpp: Byteswap functions test. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -11,7 +11,7 @@
#include "tcharx.h"
// Byteswap functions.
#include "librpcpu/byteswap_rp.h"
#include "librpbyteswap/byteswap_rp.h"
#include "aligned_malloc.h"
// C includes (C++ namespace)

View File

@ -1,8 +1,8 @@
/***************************************************************************
* ROM Properties Page shell extension. (librpcpu/tests) *
* ROM Properties Page shell extension. (librpbyteswap/tests) *
* ByteswapTest_data.hpp: Data for ByteswapTest. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/

View File

@ -1,11 +1,11 @@
# librpcpu test suite
# librpbyteswap test suite
CMAKE_POLICY(SET CMP0048 NEW)
IF(POLICY CMP0063)
# CMake 3.3: Enable symbol visibility presets for all
# target types, including static libraries and executables.
CMAKE_POLICY(SET CMP0063 NEW)
ENDIF(POLICY CMP0063)
PROJECT(librpcpu-tests LANGUAGES CXX)
PROJECT(librpbyteswap-tests LANGUAGES CXX)
# Top-level src directory.
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../..)
@ -15,7 +15,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../..)
ADD_EXECUTABLE(ByteswapTest
ByteswapTest.cpp
ByteswapTest_data.hpp)
TARGET_LINK_LIBRARIES(ByteswapTest PRIVATE rptest rpcpu)
TARGET_LINK_LIBRARIES(ByteswapTest PRIVATE rptest rpbyteswap)
DO_SPLIT_DEBUG(ByteswapTest)
SET_WINDOWS_SUBSYSTEM(ByteswapTest CONSOLE)
SET_WINDOWS_ENTRYPOINT(ByteswapTest wmain OFF)
@ -23,7 +23,7 @@ ADD_TEST(NAME ByteswapTest COMMAND ByteswapTest --gtest_brief --gtest_filter=-*b
# BitstuffTest
ADD_EXECUTABLE(BitstuffTest BitstuffTest.cpp)
TARGET_LINK_LIBRARIES(BitstuffTest PRIVATE rptest rpcpu)
TARGET_LINK_LIBRARIES(BitstuffTest PRIVATE rptest rpbyteswap)
DO_SPLIT_DEBUG(BitstuffTest)
SET_WINDOWS_SUBSYSTEM(BitstuffTest CONSOLE)
SET_WINDOWS_ENTRYPOINT(BitstuffTest wmain OFF)

View File

@ -0,0 +1,62 @@
# rom-properties CPU identification library
# NOTE: This is intended to be statically linked to every
# library or executable that needs it, NOT exported from
# libromdata.so.X / romdata-X.dll.
PROJECT(rpcpuid LANGUAGES C)
# Check for C headers.
CHECK_INCLUDE_FILES("features.h" HAVE_FEATURES_H)
CHECK_INCLUDE_FILES("cpuid.h" HAVE_CPUID_H)
# Sources
SET(${PROJECT_NAME}_SRCS dummy.c)
# CPU-specific and optimized sources
INCLUDE(CPUInstructionSetFlags)
IF(CPU_i386 OR CPU_amd64)
SET(${PROJECT_NAME}_CPU_SRCS cpuflags_x86.c)
SET(${PROJECT_NAME}_CPU_H cpuflags_x86.h)
ENDIF()
# Write the config.h file.
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/config.librpcpuid.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.librpcpuid.h")
######################
# Build the library. #
######################
ADD_LIBRARY(${PROJECT_NAME} STATIC
${${PROJECT_NAME}_SRCS} ${${PROJECT_NAME}_H}
${${PROJECT_NAME}_OS_SRCS} ${${PROJECT_NAME}_OS_H}
${${PROJECT_NAME}_CPU_SRCS} ${${PROJECT_NAME}_CPU_H}
${${PROJECT_NAME}_IFUNC_SRCS}
${${PROJECT_NAME}_MMX_SRCS}
${${PROJECT_NAME}_SSE2_SRCS}
${${PROJECT_NAME}_SSSE3_SRCS}
)
INCLUDE(SetMSVCDebugPath)
SET_MSVC_DEBUG_PATH(${PROJECT_NAME})
# Exclude from ALL builds.
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE)
# rpthreads is needed for atomic functions.
# FIXME: Not using it in the static rpcpuid library right now.
#TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE rpthreads)
# Include paths:
# - Public: Current source and binary directories.
# - Private: Parent source and binary directories,
# and top-level binary directory for git_version.h.
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> # librpcpuid
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> # librpcpuid
PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..> # src
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/..> # src
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}> # build
)
# Unix: Add -fpic/-fPIC in order to use this static library in plugins.
IF(UNIX AND NOT APPLE)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpic -fPIC")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic -fPIC")
ENDIF(UNIX AND NOT APPLE)

View File

@ -1,8 +1,8 @@
/***************************************************************************
* ROM Properties Page shell extension. (librpcpu) *
* config.librpcpu.h.in: LibRpCpu configuration. (source file) *
* ROM Properties Page shell extension. (librpcpuid) *
* config.librpcpuid.h.in: librpcpuid configuration. (source file) *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/

View File

@ -1,14 +1,14 @@
/***************************************************************************
* ROM Properties Page shell extension. (librpcpu) *
* ROM Properties Page shell extension. (librpcpuid) *
* cpu_dispatch.h: CPU dispatch macros. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
#pragma once
#include "librpcpu/config.librpcpu.h"
#include "librpcpuid/config.librpcpuid.h"
// Check for certain CPUs.
// Reference: https://sourceforge.net/p/predef/wiki/Architectures/

View File

@ -1,6 +1,6 @@
/***************************************************************************
* ROM Properties Page shell extension. (librpcpu) *
* cpuflags_x86.h: x86 CPU flags detection. *
* ROM Properties Page shell extension. (librpcpuid) *
* cpuflags_x86.c: x86 CPU flags detection. *
* *
* Copyright (c) 2017-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
@ -11,11 +11,12 @@
# error Do not compile byteswap_x86.c on non-x86 CPUs!
#endif
#include "config.librpcpu.h"
#include "config.librpcpuid.h"
#include "cpuflags_x86.h"
// librpthreads
#include "librpthreads/pthread_once.h"
// FIXME: Cannot use librpthreads at the moment due to static linkage.
//#include "librpthreads/pthread_once.h"
#ifdef HAVE_CPUID_H
# include <cpuid.h>
@ -326,6 +327,12 @@ static void RP_CPU_InitCPUFlags_int(void)
*/
void RP_C_API RP_CPU_InitCPUFlags(void)
{
static pthread_once_t cpu_once_control = PTHREAD_ONCE_INIT;
pthread_once(&cpu_once_control, RP_CPU_InitCPUFlags_int);
// FIXME: Cannot use librpthreads at the moment due to static linkage.
//static pthread_once_t cpu_once_control = PTHREAD_ONCE_INIT;
//pthread_once(&cpu_once_control, RP_CPU_InitCPUFlags_int);
static uint8_t cpu_once_control = 0;
if (cpu_once_control == 0) {
RP_CPU_InitCPUFlags_int();
cpu_once_control = 1;
}
}

View File

@ -1,8 +1,8 @@
/***************************************************************************
* ROM Properties Page shell extension. (librpcpu) *
* ROM Properties Page shell extension. (librpcpuid) *
* cpuflags_x86.h: x86 CPU flags detection. *
* *
* Copyright (c) 2017-2023 by David Korth. *
* Copyright (c) 2017-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -10,7 +10,7 @@
#include <stdint.h>
#include "common.h"
#include "dll-macros.h" // for RP_LIBROMDATA_PUBLIC
#include "dll-macros.h" // for RP_C_API
#ifdef __cplusplus
extern "C" {
@ -33,13 +33,12 @@ extern "C" {
#endif /* _M_IX86) || __i386__ || _M_X64 || _M_AMD64 || __amd64__ || __x86_64__ */
// Don't modify these!
RP_LIBROMDATA_PUBLIC extern uint32_t RP_CPU_Flags;
RP_LIBROMDATA_PUBLIC extern int RP_CPU_Flags_Init; // 1 if RP_CPU_Flags has been initialized.
extern uint32_t RP_CPU_Flags;
extern int RP_CPU_Flags_Init; // 1 if RP_CPU_Flags has been initialized.
/**
* Initialize RP_CPU_Flags.
*/
RP_LIBROMDATA_PUBLIC
void RP_C_API RP_CPU_InitCPUFlags(void);
/**

1
src/librpcpuid/dummy.c Normal file
View File

@ -0,0 +1 @@
/* dummy file to get cmake to recognize this project as a C project */

View File

@ -176,7 +176,7 @@ FOREACH(_target ${TARGETS})
ENDIF()
# rpthreads is needed for atomic functions.
TARGET_LINK_LIBRARIES(${_target} PRIVATE rpcpu${_target_suffix} rpthreads${_target_suffix})
TARGET_LINK_LIBRARIES(${_target} PRIVATE rpbyteswap${_target_suffix} rpthreads${_target_suffix})
TARGET_LINK_LIBRARIES(${_target} PRIVATE cachecommon${_target_suffix})
IF(ENABLE_NLS)
TARGET_LINK_LIBRARIES(${_target} PRIVATE i18n${_target_suffix})

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (librpfile) *
* stdafx.h: Common definitions and includes. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -53,6 +53,6 @@
#include "common.h"
#include "ctypex.h"
// librpcpu
#include "librpcpu/byteswap_rp.h"
#include "librpcpu/bitstuff.h"
// librpbyteswap
#include "librpbyteswap/byteswap_rp.h"
#include "librpbyteswap/bitstuff.h"

View File

@ -11,7 +11,8 @@
#include "XAttrReader.hpp"
#include "XAttrReader_p.hpp"
#include "librpcpu/byteswap_rp.h"
// BEFORE COMMIT: is this needed?
//#include "librpbyteswap/byteswap_rp.h"
#include <fcntl.h> // AT_FDCWD
#include <sys/stat.h> // stat(), statx()

View File

@ -151,7 +151,7 @@ FOREACH(_target ${TARGETS})
ENDIF(HAVE_WCWIDTH)
# Other libraries
TARGET_LINK_LIBRARIES(${_target} PRIVATE rpthreads${_target_suffix} rpcpu${_target_suffix})
TARGET_LINK_LIBRARIES(${_target} PRIVATE rpthreads${_target_suffix} rpbyteswap${_target_suffix})
IF(Iconv_LIBRARY AND NOT Iconv_IS_BUILT_IN)
TARGET_LINK_LIBRARIES(${_target} PRIVATE Iconv::Iconv)

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (librptext) *
* conversion.cpp: Text encoding functions *
* *
* Copyright (c) 2009-2023 by David Korth. *
* Copyright (c) 2009-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -12,7 +12,7 @@
// Other rom-properties libraries
#include "libi18n/i18n.h"
#include "librpcpu/byteswap_rp.h"
#include "librpbyteswap/byteswap_rp.h"
#include "librpthreads/pthread_once.h"
// C includes

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (librptext) *
* conversion.hpp: Text encoding functions *
* *
* Copyright (c) 2009-2023 by David Korth. *
* Copyright (c) 2009-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -12,7 +12,7 @@
// System byteorder is needed for conversions from UTF-16.
// Conversions to UTF-16 always use host-endian.
#include "librpcpu/byteorder.h"
#include "librpbyteswap/byteorder.h"
#include "common.h"
#include "dll-macros.h" // for RP_LIBROMDATA_PUBLIC

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (librptext) *
* conversion_iconv.cpp: Text encoding functions (iconv version) *
* *
* Copyright (c) 2009-2023 by David Korth. *
* Copyright (c) 2009-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -17,7 +17,7 @@
#endif
// Determine the system encodings.
#include "librpcpu/byteorder.h"
#include "librpbyteswap/byteorder.h"
#if SYS_BYTEORDER == SYS_BIG_ENDIAN
# define RP_ICONV_UTF16_ENCODING "UTF-16BE"
#else

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (librptext/tests) *
* TextFuncsTest.cpp: Text conversion functions test *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -13,7 +13,7 @@
// TextFuncs
#include "../conversion.hpp"
#include "../utf8_strlen.hpp"
#include "librpcpu/byteorder.h"
#include "librpbyteswap/byteorder.h"
using namespace LibRpText;
// C includes. (C++ namespace)

View File

@ -251,8 +251,9 @@ FOREACH(_target ${TARGETS})
ENDIF()
# TODO: More public/private library stuff.
TARGET_LINK_LIBRARIES(${_target} PUBLIC rpcpu${_target_suffix} rpfile${_target_suffix} rptext${_target_suffix})
TARGET_LINK_LIBRARIES(${_target} PUBLIC rpbyteswap${_target_suffix} rpfile${_target_suffix} rptext${_target_suffix})
TARGET_LINK_LIBRARIES(${_target} PRIVATE rpthreads${_target_suffix})
TARGET_LINK_LIBRARIES(${_target} PRIVATE rpcpuid) # for CPU dispatch
# Include paths:
# - Public: Current source and binary directories.

View File

@ -2,13 +2,13 @@
* ROM Properties Page shell extension. (librptexture) *
* ImageSizeCalc.hpp: Image size calculation functions. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
#pragma once
#include "bitstuff.h"
#include "librpbyteswap/bitstuff.h"
// C includes (C++ namespace)
#include <cassert>

View File

@ -2,14 +2,14 @@
* ROM Properties Page shell extension. (librptexture) *
* argb32_t.hpp: ARGB32 value with byte accessors. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
#pragma once
#include "common.h"
#include "librpcpu/byteorder.h"
#include "librpbyteswap/byteorder.h"
// C includes (C++ namespace)
#include <cassert>

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (librptexture) *
* ImageDecoder_common.hpp: Common image decoder definitions. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -11,7 +11,7 @@
#include "config.librptexture.h"
#include "common.h"
#include "librpcpu/cpu_dispatch.h"
#include "librpcpuid/cpu_dispatch.h"
// C includes
#include <stdint.h>
@ -23,7 +23,7 @@
#include "common.h"
#if defined(RP_CPU_I386) || defined(RP_CPU_AMD64)
# include "librpcpu/cpuflags_x86.h"
# include "librpcpuid/cpuflags_x86.h"
# define IMAGEDECODER_HAS_SSE2 1
# define IMAGEDECODER_HAS_SSSE3 1
#endif

View File

@ -2,14 +2,14 @@
* ROM Properties Page shell extension. (librptexture) *
* PixelConversion.hpp: Pixel conversion inline functions. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
#pragma once
// librpcpu
#include "byteswap_rp.h"
// librpbyteswap
#include "librpbyteswap/byteswap_rp.h"
// argb32_t
#include "argb32_t.hpp"

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (librptexture) *
* rp_image.hpp: Image class. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -18,9 +18,9 @@
// C++ includes
#include <memory>
#include "librpcpu/cpu_dispatch.h"
#include "librpcpuid/cpu_dispatch.h"
#if defined(RP_CPU_I386) || defined(RP_CPU_AMD64)
# include "librpcpu/cpuflags_x86.h"
# include "librpcpuid/cpuflags_x86.h"
# define RP_IMAGE_HAS_SSE2 1
# define RP_IMAGE_HAS_SSSE3 1
# define RP_IMAGE_HAS_SSE41 1

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (librptexture) *
* stdafx.h: Common definitions and includes. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -43,9 +43,9 @@
#include "ctypex.h"
#include "aligned_malloc.h"
// librpcpu
#include "librpcpu/byteswap_rp.h"
#include "librpcpu/bitstuff.h"
// librpbyteswap
#include "librpbyteswap/byteswap_rp.h"
#include "librpbyteswap/bitstuff.h"
#ifdef __cplusplus
// C++ headers

View File

@ -9,6 +9,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../..)
# TODO: Move to libromdata, or move libromdata stuff here?
ADD_EXECUTABLE(ImageDecoderLinearTest ImageDecoderLinearTest.cpp)
TARGET_LINK_LIBRARIES(ImageDecoderLinearTest PRIVATE rptest romdata)
TARGET_LINK_LIBRARIES(ImageDecoderLinearTest PRIVATE rpcpuid) # for CPU dispatch
TARGET_COMPILE_DEFINITIONS(ImageDecoderLinearTest PRIVATE RP_BUILDING_FOR_DLL=1)
TARGET_LINK_LIBRARIES(ImageDecoderLinearTest PRIVATE ${ZLIB_LIBRARIES})
TARGET_INCLUDE_DIRECTORIES(ImageDecoderLinearTest PRIVATE ${ZLIB_INCLUDE_DIRS})
@ -26,6 +27,7 @@ ADD_TEST(NAME ImageDecoderLinearTest COMMAND ImageDecoderLinearTest --gtest_brie
# UnPremultiplyTest
ADD_EXECUTABLE(UnPremultiplyTest UnPremultiplyTest.cpp)
TARGET_LINK_LIBRARIES(UnPremultiplyTest PRIVATE rptest romdata)
TARGET_LINK_LIBRARIES(UnPremultiplyTest PRIVATE rpcpuid) # for CPU dispatch
TARGET_COMPILE_DEFINITIONS(UnPremultiplyTest PRIVATE RP_BUILDING_FOR_DLL=1)
DO_SPLIT_DEBUG(UnPremultiplyTest)
SET_WINDOWS_SUBSYSTEM(UnPremultiplyTest CONSOLE)

View File

@ -11,8 +11,8 @@
#include "tcharx.h"
#include "common.h"
// librpcpu, librpbase
#include "librpcpu/byteswap_rp.h"
// librpbyteswap, librpbase
#include "librpbyteswap/byteswap_rp.h"
#include "aligned_malloc.h"
// librptexture

View File

@ -3,7 +3,7 @@
* rpcli.cpp: Command-line interface for properties. *
* *
* Copyright (c) 2016-2018 by Egor. *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -16,9 +16,11 @@
// OS-specific security options.
#include "rpcli_secure.h"
// librpbyteswap
#include "librpbyteswap/byteswap_rp.h"
// librpbase
#include "libi18n/i18n.h"
#include "librpcpu/byteswap_rp.h"
#include "librpbase/RomData.hpp"
#include "librpbase/SystemRegion.hpp"
#include "librpbase/img/RpPng.hpp"

View File

@ -2,7 +2,7 @@
* ROM Properties Page shell extension. (Win32) *
* RpFile_IStream.hpp: IRpFile using an IStream*. *
* *
* Copyright (c) 2016-2023 by David Korth. *
* Copyright (c) 2016-2024 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -11,8 +11,8 @@
#include "config.librpbase.h"
#include "RpFile_IStream.hpp"
// librpbase, librpcpu
#include "librpcpu/byteswap_rp.h"
// Other rom-properties libraries
#include "librpbyteswap/byteswap_rp.h"
using namespace LibRpBase;
// C++ STL classes.