Merge branch 'master' of https://github.com/86Box/86Box into qt

This commit is contained in:
ts-korhonen
2021-12-20 22:30:50 +02:00
44 changed files with 751 additions and 584 deletions

View File

@@ -20,3 +20,11 @@ tab_width = 8
[*.manifest]
indent_style = space
indent_size = 2
[*.yml]
indent_style = space
indent_size = 2
[**/CMakeLists.txt]
indent_style = space
indent_size = 4

View File

@@ -84,7 +84,7 @@ jobs:
- uses: actions/upload-artifact@v2
with:
name: '86Box-${{ matrix.build.name }}-MSYS2-${{ matrix.environment.msystem }}-${{ github.sha }}'
path: build/artifacts/bin/**
path: build/artifacts/**
vs2019:
name: VS2019 ${{ matrix.build.name }} ${{ matrix.target-arch }} build (${{ matrix.toolset }})
@@ -130,7 +130,7 @@ jobs:
- uses: actions/upload-artifact@v2
with:
name: '86Box-${{ matrix.build.name }}-VS2019-${{ matrix.target-arch }}-${{ matrix.toolset }}-${{ github.sha }}'
path: build/artifacts/bin/**
path: build/artifacts/**
linux:
name: "Linux GCC 11"

2
.gitignore vendored
View File

@@ -5,7 +5,6 @@
CMakeFiles
Makefile
*.a
*.cmake
/src/*.exe
/src/86Box
/src/include/86box/version.h
@@ -22,7 +21,6 @@ Makefile
/src/*.log
/src/*.dmp
/src/nvr/
/src/printer/
/src/roms/
/src/screenshots/

View File

@@ -18,16 +18,22 @@ cmake_minimum_required(VERSION 3.16)
cmake_policy(SET CMP0091 NEW)
cmake_policy(SET CMP0079 NEW)
if(VCPKG_TOOLCHAIN AND VCPKG_TARGET_TRIPLET MATCHES "static")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
project(86Box
VERSION 3.1
DESCRIPTION "Emulator of x86-based systems"
HOMEPAGE_URL "https://86box.net"
LANGUAGES C CXX)
if(WIN32 AND VCPKG_TOOLCHAIN)
if(VCPKG_TARGET_TRIPLET MATCHES "-windows-static$")
# `-static` triplet, use the statically linked CRT
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
else()
# Regular triplet (or `-static-md`), use the dynamically linked CRT
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
endif()
endif()
# Detect the target architecture by trying to compile `src/arch_detect.c`
try_compile(RESULT_VAR ${CMAKE_BINARY_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/src/arch_detect.c" OUTPUT_VARIABLE ARCH)
string(REGEX MATCH "ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}")
@@ -56,6 +62,10 @@ endif()
set(CMAKE_CXX_STANDARD 11)
# Optional features
#
# Option Description Def.
# ------ ----------- ----
option(RELEASE "Release build" OFF)
option(USB "USB support" OFF)
option(DYNAREC "Dynamic recompiler" ON)
@@ -64,62 +74,67 @@ option(MUNT "MUNT" ON)
option(VRAMDUMP "Video RAM dumping" OFF)
option(DINPUT "DirectInput" OFF)
option(DISCORD "Discord integration" ON)
option(QT "QT GUI" ON)
option(CPPTHREADS "C++11 threads" ON)
option(NEW_DYNAREC "Use the PCem v15 (\"new\") dynamic recompiler" OFF)
option(MINITRACE "Enable Chrome tracing using the modified minitrace library" OFF)
option(DEV_BRANCH "Development branch" OFF)
CMAKE_DEPENDENT_OPTION(AMD_K5 "AMD K5" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(CYRIX_6X86 "Cyrix 6x86" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(GUSMAX "Gravis UltraSound MAX" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(HEDAKA "Hedaka HED-919" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(I450KX "Intel i450KX" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(LASERXT "VTech Laser XT" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(MGA "Matrox Mystique graphics adapters" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(NO_SIO "Machines without emulated Super I/O chips" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(OLIVETTI "Olivetti M290" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(OPEN_AT "OpenAT" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(OPENGL "OpenGL 3.0 Core renderer" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(PAS16 "Pro Audio Spectrum 16" OFF "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(PS2M70T4 "IBM PS/2 model 70 (type 4)" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(S3TRIO3D2X "S3 Trio3D/2X" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(SIO_DETECT "Super I/O Detection Helper" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(M154X "ALi ALADDiN IV" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(M6117 "ALi M6117" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(VGAWONDER "ATI VGA Wonder (ATI-18800)" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(VNC "VNC renderer" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(XL24 "ATI VGA Wonder XL24 (ATI-28800-6)" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(VECT486VL "HP Vectra 486VL" ON "DEV_BRANCH" OFF)
option(QT "QT GUI" ON)
# Development branch features
#
# Option Description Def. Condition Otherwise
# ------ ----------- ---- --------- ---------
cmake_dependent_option(AMD_K5 "AMD K5" ON "DEV_BRANCH" OFF)
cmake_dependent_option(CYRIX_6X86 "Cyrix 6x86" ON "DEV_BRANCH" OFF)
cmake_dependent_option(GUSMAX "Gravis UltraSound MAX" ON "DEV_BRANCH" OFF)
cmake_dependent_option(HEDAKA "Hedaka HED-919" ON "DEV_BRANCH" OFF)
cmake_dependent_option(I450KX "Intel i450KX" ON "DEV_BRANCH" OFF)
cmake_dependent_option(LASERXT "VTech Laser XT" ON "DEV_BRANCH" OFF)
cmake_dependent_option(MGA "Matrox Mystique graphics adapters" ON "DEV_BRANCH" OFF)
cmake_dependent_option(NO_SIO "Machines without emulated Super I/O chips" ON "DEV_BRANCH" OFF)
cmake_dependent_option(OLIVETTI "Olivetti M290" ON "DEV_BRANCH" OFF)
cmake_dependent_option(OPEN_AT "OpenAT" ON "DEV_BRANCH" OFF)
cmake_dependent_option(OPENGL "OpenGL 3.0 Core renderer" ON "DEV_BRANCH" OFF)
cmake_dependent_option(PAS16 "Pro Audio Spectrum 16" OFF "DEV_BRANCH" OFF)
cmake_dependent_option(PS2M70T4 "IBM PS/2 model 70 (type 4)" ON "DEV_BRANCH" OFF)
cmake_dependent_option(S3TRIO3D2X "S3 Trio3D/2X" ON "DEV_BRANCH" OFF)
cmake_dependent_option(SIO_DETECT "Super I/O Detection Helper" ON "DEV_BRANCH" OFF)
cmake_dependent_option(M154X "ALi ALADDiN IV" ON "DEV_BRANCH" OFF)
cmake_dependent_option(M6117 "ALi M6117" ON "DEV_BRANCH" OFF)
cmake_dependent_option(VGAWONDER "ATI VGA Wonder (ATI-18800)" ON "DEV_BRANCH" OFF)
cmake_dependent_option(VNC "VNC renderer" OFF "DEV_BRANCH" OFF)
cmake_dependent_option(XL24 "ATI VGA Wonder XL24 (ATI-28800-6)" ON "DEV_BRANCH" OFF)
cmake_dependent_option(VECT486VL "HP Vectra 486VL" ON "DEV_BRANCH" OFF)
# Determine the build type
set(RELEASE_BUILD OFF)
set(BETA_BUILD OFF)
set(ALPHA_BUILD OFF)
string(TOLOWER "${BUILD_TYPE}" BUILD_TYPE_LOWER)
if(BUILD_TYPE_LOWER STREQUAL "release")
# Release build
set(RELEASE_BUILD ON)
add_compile_definitions(RELEASE_BUILD)
elseif(BUILD_TYPE_LOWER STREQUAL "beta")
# Beta build
set(BETA_BUILD ON)
add_compile_definitions(BETA_BUILD)
elseif(BUILD_TYPE_LOWER STREQUAL "alpha")
# Alpha build
set(ALPHA_BUILD ON)
add_compile_definitions(ALPHA_BUILD)
endif()
# HACK: Avoid a MSVC2019 compiler bug on ARM64 Debug builds
if(MSVC_TOOLSET_VERSION GREATER_EQUAL 142 AND ARCH STREQUAL "arm64")
# Define a cache option in case somebody wants to disable this workaround
set(AVOID_LNK1322 ON CACHE BOOL "Prevent LNK1322 on MSVC2019 ARM64 debug builds")
if(AVOID_LNK1322)
message(STATUS "Working around LNK1322 (86Box#1268)")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Gy")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Gy")
# Variables introduced by richardg867 for versioning stuff
if(NOT CMAKE_PROJECT_VERSION_PATCH)
set(CMAKE_PROJECT_VERSION_PATCH 0)
endif()
if(NOT EMU_BUILD_NUM)
set(EMU_BUILD_NUM 0)
endif()
# HACK: MinGW and macOS <10.15 does not have `timespec_get`
include(CheckSymbolExists)
check_symbol_exists(timespec_get time.h HAS_TIMESPEC_GET)
if(HAS_TIMESPEC_GET)
add_compile_definitions(HAS_TIMESPEC_GET)
if(NOT EMU_COPYRIGHT_YEAR)
set(EMU_COPYRIGHT_YEAR 2021)
endif()
add_subdirectory(src)

View File

@@ -0,0 +1,4 @@
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake)
set(CMAKE_C_FLAGS "-march=armv8-a -mfloat-abi=hard ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-march=armv8-a -mfloat-abi=hard ${CMAKE_CXX_FLAGS}")

View File

@@ -0,0 +1,4 @@
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake)
set(CMAKE_C_FLAGS "-march=armv7-a -mfloat-abi=hard ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-march=armv7-a -mfloat-abi=hard ${CMAKE_CXX_FLAGS}")

View File

@@ -0,0 +1,4 @@
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake)
set(CMAKE_C_FLAGS "-m32 -march=i686 -msse2 -mfpmath=sse ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-m32 -march=i686 -msse2 -mfpmath=sse ${CMAKE_CXX_FLAGS}")

View File

@@ -0,0 +1,4 @@
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake)
set(CMAKE_C_FLAGS "-m64 -march=x86-64 -msse2 -mfpmath=sse ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-m64 -march=x86-64 -msse2 -mfpmath=sse ${CMAKE_CXX_FLAGS}")

10
cmake/flags-gcc.cmake Normal file
View File

@@ -0,0 +1,10 @@
set(CMAKE_CONFIGURATION_TYPES Debug;Release;Optimized)
set(CMAKE_C_FLAGS "-fomit-frame-pointer -mstackrealign -Wall -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
set(CMAKE_C_FLAGS_RELEASE "-g0 -O3")
set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
set(CMAKE_C_FLAGS_DEBUG "-ggdb -Og")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_C_FLAGS_OPTIMIZED "-march=native -mtune=native -O3 -ffp-contract=fast -flto")
set(CMAKE_CXX_FLAGS_OPTIMIZED ${CMAKE_C_FLAGS_OPTIMIZED})

View File

@@ -0,0 +1,10 @@
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc-arm64.cmake)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_RC_COMPILER rc)
set(CMAKE_C_COMPILER_TARGET aarch64-pc-windows-msvc)
set(CMAKE_CXX_COMPILER_TARGET aarch64-pc-windows-msvc)
set(CMAKE_SYSTEM_PROCESSOR ARM64)

View File

@@ -0,0 +1,10 @@
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc-i686.cmake)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_RC_COMPILER rc)
set(CMAKE_C_COMPILER_TARGET i686-pc-windows-msvc)
set(CMAKE_CXX_COMPILER_TARGET i686-pc-windows-msvc)
set(CMAKE_SYSTEM_PROCESSOR X86)

View File

@@ -0,0 +1,10 @@
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc-x86_64.cmake)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_RC_COMPILER rc)
set(CMAKE_C_COMPILER_TARGET x86_64-pc-windows-msvc)
set(CMAKE_CXX_COMPILER_TARGET x86_64-pc-windows-msvc)
set(CMAKE_SYSTEM_PROCESSOR AMD64)

View File

@@ -15,37 +15,15 @@
# Copyright 2021 dob205.
#
# Prepare the macOS app bundle icon depending on the release channel
set(APP_ICON_MACOSX)
if (APPLE)
if(RELEASE_BUILD)
set(APP_ICON_MACOSX ${CMAKE_CURRENT_SOURCE_DIR}/mac/icons/release/86Box.icns)
elseif(BETA_BUILD)
set(APP_ICON_MACOSX ${CMAKE_CURRENT_SOURCE_DIR}/mac/icons/beta/86Box.icns)
elseif(ALPHA_BUILD)
set(APP_ICON_MACOSX ${CMAKE_CURRENT_SOURCE_DIR}/mac/icons/dev/86Box.icns)
else()
set(APP_ICON_MACOSX ${CMAKE_CURRENT_SOURCE_DIR}/mac/icons/branch/86Box.icns)
endif()
set_source_files_properties(${APP_ICON_MACOSX} PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources")
endif()
# WIN32 marks us as a GUI app on Windows
# MACOSX_BUNDLE prepares a macOS application bundle including with the app icon
add_executable(86Box WIN32 MACOSX_BUNDLE 86box.c config.c log.c random.c timer.c io.c acpi.c apm.c
dma.c ddma.c nmi.c pic.c pit.c port_6x.c port_92.c ppi.c pci.c mca.c usb.c fifo8.c
device.c nvr.c nvr_at.c nvr_ps2.c ${APP_ICON_MACOSX})
device.c nvr.c nvr_at.c nvr_ps2.c)
if(CPPTHREADS)
target_sources(86Box PRIVATE thread.cpp)
endif()
if(APPLE)
target_link_libraries(86Box "-framework AppKit")
endif()
if(NEW_DYNAREC)
add_compile_definitions(USE_NEW_DYNAREC)
endif()
@@ -79,10 +57,10 @@ target_link_libraries(86Box cpu chipset mch dev mem fdd game cdrom zip mo hdd
net print scsi sio snd vid voodoo plat ui)
if(WIN32 AND ARCH STREQUAL "i386")
if(MSVC)
target_link_options(86Box PRIVATE "/LARGEADDRESSAWARE")
else()
if(MINGW)
target_link_options(86Box PRIVATE "LINKER:--large-address-aware")
else()
target_link_options(86Box PRIVATE "LINKER:/LARGEADDRESSAWARE")
endif()
endif()
@@ -91,46 +69,12 @@ if(MINGW)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ".dll.a")
endif()
# Variables introduced by richardg867 for versioning stuff
if(NOT CMAKE_PROJECT_VERSION_PATCH)
set(CMAKE_PROJECT_VERSION_PATCH 0)
endif()
if(NOT EMU_BUILD_NUM)
set(EMU_BUILD_NUM 0)
endif()
if(NOT EMU_COPYRIGHT_YEAR)
set(EMU_COPYRIGHT_YEAR 2021)
endif()
#some macOS specific configuration steps
if(APPLE)
# Force using the newest library if it's installed by homebrew
set(CMAKE_FIND_FRAMEWORK LAST)
# prepare stuff for macOS app bundles
set(CMAKE_MACOSX_BUNDLE 1)
# setting our compilation target to macOS 10.13 High Sierra
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13")
# set the Info.plist properly
set_target_properties(86Box PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist.in)
set(MACOSX_BUNDLE_GUI_IDENTIFIER net.86Box.86Box)
set(MACOSX_BUNDLE_BUNDLE_NAME 86Box)
set(MACOSX_BUNDLE_BUNDLE_VERSION 3.1.${EMU_BUILD_NUM})
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "3.1.${EMU_BUILD_NUM}")
set(MACOSX_BUNDLE_LONG_VERSION_STRING "3.1.${EMU_BUILD_NUM}")
set(MACOSX_BUNDLE_ICON_FILE 86Box.icns)
set(MACOSX_BUNDLE_INFO_STRING "A emulator of old computers")
set(MACOSX_BUNDLE_COPYRIGHT "© 2007-${EMU_COPYRIGHT_YEAR} 86Box contributors")
# preparing the code signing for easier distribution, Apple dev certificate needed at one point
#set(XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "YES")
#set(XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "-")
#set(XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${CMAKE_CURRENT_SOURCE_DIR}/mac/codesign/dev/app.entitlements)
endif()
if(QT)
@@ -149,7 +93,9 @@ endif()
find_package(Freetype REQUIRED)
include_directories(${FREETYPE_INCLUDE_DIRS})
if(APPLE)
target_link_libraries(86Box Freetype::Freetype) # bundles freetype for the macOS app bundle
# Freetype is dynamically loaded by the emulator, however, we link it
# on macOS so it gets copied to the bundle by the installation process
target_link_libraries(86Box Freetype::Freetype)
endif()
find_package(OpenAL REQUIRED)
@@ -158,17 +104,13 @@ target_link_libraries(86Box ${OPENAL_LIBRARY})
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
if(MINGW)
if(WIN32 AND TARGET SDL2::SDL2-static)
target_link_libraries(86Box SDL2::SDL2-static)
elseif(WIN32)
target_link_libraries(86Box SDL2::SDL2)
else()
if (TARGET SDL2::SDL2)
elseif(TARGET SDL2::SDL2)
target_link_libraries(86Box SDL2::SDL2)
else()
target_link_libraries(86Box ${SDL2_LIBRARIES})
endif()
endif()
find_package(PNG REQUIRED)
include_directories(${PNG_INCLUDE_DIRS})
@@ -214,21 +156,23 @@ if(MINITRACE)
target_link_libraries(86Box minitrace)
endif()
if(APPLE)
install(TARGETS 86Box DESTINATION "bin")
if(WIN32 OR APPLE)
# Copy the binary to the root of the install prefix on Windows and macOS
install(TARGETS 86Box DESTINATION ".")
else()
# On Linux we want to copy the binary to the `bin` folder.
install(TARGETS 86Box)
endif()
# adjustments for macOS app bundles
# Install our dependencies to the macOS bundle
if(APPLE)
set(APPS ${CMAKE_CURRENT_BINARY_DIR}/86Box.app)
install(CODE "
include(InstallRequiredSystemLibraries)
include(BundleUtilities)
fixup_bundle(\"${APPS}\" \"\" \"\")"
get_filename_component(CMAKE_INSTALL_PREFIX_ABSOLUTE \${CMAKE_INSTALL_PREFIX} ABSOLUTE)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/86Box.app\" \"\" \"\")"
COMPONENT Runtime)
if (QT)
# needed for Qt packaging
# get the macdeployqt path
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
@@ -243,15 +187,28 @@ if(APPLE)
COMMENT "Running macdeployqt..."
)
endif()
if(VCPKG_TOOLCHAIN)
x_vcpkg_install_local_dependencies(TARGETS 86Box DESTINATION "bin")
endif()
# Install our dependencies if using vcpkg
if(VCPKG_TOOLCHAIN)
x_vcpkg_install_local_dependencies(TARGETS 86Box DESTINATION ".")
endif()
# Install the PDB file on Windows builds
if(MSVC)
# CMake fully supports PDB files on MSVC-compatible compilers
install(FILES $<TARGET_PDB_FILE:86Box>
CONFIGURATIONS Debug RelWithDebInfo
DESTINATION "bin")
DESTINATION ".")
elseif(WIN32)
# Other compilers/linkers (such as Clang in GCC-compatible mode) also
# emit PDB files when targeting Windows, however, CMake only supports
# the relevant properties with MSVC and clones. Try to install
# the PDB file assuming it's in the same path as the EXE.
install(FILES "$<TARGET_FILE_DIR:86Box>/$<TARGET_FILE_BASE_NAME:86Box>.pdb"
CONFIGURATIONS Debug RelWithDebInfo
DESTINATION "."
OPTIONAL)
endif()
add_subdirectory(device)

View File

@@ -81,10 +81,12 @@ static const struct {
const joystick_if_t *joystick;
} joysticks[] = {
{ "none", &joystick_none },
{ "standard_2button", &joystick_standard },
{ "standard_4button", &joystick_standard_4button },
{ "standard_6button", &joystick_standard_6button },
{ "standard_8button", &joystick_standard_8button },
{ "2axis_2button", &joystick_2axis_2button },
{ "2axis_4button", &joystick_2axis_4button },
{ "2axis_6button", &joystick_2axis_6button },
{ "2axis_8button", &joystick_2axis_8button },
{ "3axis_2button", &joystick_3axis_2button },
{ "3axis_4button", &joystick_3axis_4button },
{ "4axis_4button", &joystick_4axis_4button },
{ "ch_flighstick_pro", &joystick_ch_flightstick_pro },
{ "sidewinder_pad", &joystick_sw_pad },
@@ -452,6 +454,15 @@ const device_t gameport_201_device = {
NULL
};
const device_t gameport_208_device = {
"Game port (Port 208h-20fh)",
0, 0x080208,
gameport_init,
gameport_close,
NULL, { NULL }, NULL,
NULL
};
const device_t gameport_pnp_device = {
"Game port (Plug and Play only)",
0, 0x080000,

View File

@@ -145,6 +145,26 @@ static int joystick_standard_read_axis_4button(void *p, int axis)
}
}
static int joystick_standard_read_axis_3axis(void *p, int axis)
{
if (!JOYSTICK_PRESENT(0))
return AXIS_NOT_PRESENT;
switch (axis)
{
case 0:
return joystick_state[0].axis[0];
case 1:
return joystick_state[0].axis[1];
case 2:
return joystick_state[0].axis[2];
case 3:
return 0;
default:
return 0;
}
}
static int joystick_standard_read_axis_4axis(void *p, int axis)
{
if (!JOYSTICK_PRESENT(0))
@@ -216,9 +236,9 @@ static void joystick_standard_a0_over(void *p)
{
}
const joystick_if_t joystick_standard =
const joystick_if_t joystick_2axis_2button =
{
"Standard 2-button joystick(s)",
"2-axis, 2-button joystick(s)",
joystick_standard_init,
joystick_standard_close,
joystick_standard_read,
@@ -232,9 +252,9 @@ const joystick_if_t joystick_standard =
{"X axis", "Y axis"},
{"Button 1", "Button 2"}
};
const joystick_if_t joystick_standard_4button =
const joystick_if_t joystick_2axis_4button =
{
"Standard 4-button joystick",
"2-axis, 4-button joystick",
joystick_standard_init,
joystick_standard_close,
joystick_standard_read_4button,
@@ -248,9 +268,41 @@ const joystick_if_t joystick_standard_4button =
{"X axis", "Y axis"},
{"Button 1", "Button 2", "Button 3", "Button 4"}
};
const joystick_if_t joystick_3axis_2button =
{
"3-axis, 2-button joystick",
joystick_standard_init,
joystick_standard_close,
joystick_standard_read,
joystick_standard_write,
joystick_standard_read_axis_3axis,
joystick_standard_a0_over,
3,
2,
0,
1,
{"X axis", "Y axis", "Z axis"},
{"Button 1", "Button 2"}
};
const joystick_if_t joystick_3axis_4button =
{
"3-axis, 4-button joystick",
joystick_standard_init,
joystick_standard_close,
joystick_standard_read_4button,
joystick_standard_write,
joystick_standard_read_axis_3axis,
joystick_standard_a0_over,
3,
4,
0,
1,
{"X axis", "Y axis", "Z axis"},
{"Button 1", "Button 2", "Button 3", "Button 4"}
};
const joystick_if_t joystick_4axis_4button =
{
"4-axis 4-button joystick",
"4-axis, 4-button joystick",
joystick_standard_init,
joystick_standard_close,
joystick_standard_read_4button,
@@ -264,9 +316,9 @@ const joystick_if_t joystick_4axis_4button =
{"X axis", "Y axis", "Z axis", "zX axis"},
{"Button 1", "Button 2", "Button 3", "Button 4"}
};
const joystick_if_t joystick_standard_6button =
const joystick_if_t joystick_2axis_6button =
{
"Standard 6-button joystick",
"2-axis, 6-button joystick",
joystick_standard_init,
joystick_standard_close,
joystick_standard_read_4button,
@@ -280,9 +332,9 @@ const joystick_if_t joystick_standard_6button =
{"X axis", "Y axis"},
{"Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6"}
};
const joystick_if_t joystick_standard_8button =
const joystick_if_t joystick_2axis_8button =
{
"Standard 8-button joystick",
"2-axis, 8-button joystick",
joystick_standard_init,
joystick_standard_close,
joystick_standard_read_4button,

View File

@@ -108,6 +108,7 @@ extern "C" {
#ifdef EMU_DEVICE_H
extern const device_t gameport_device;
extern const device_t gameport_201_device;
extern const device_t gameport_208_device;
extern const device_t gameport_pnp_device;
extern const device_t gameport_pnp_6io_device;
extern const device_t gameport_sio_device;

View File

@@ -35,8 +35,10 @@
* USA.
*/
extern const joystick_if_t joystick_standard;
extern const joystick_if_t joystick_standard_4button;
extern const joystick_if_t joystick_2axis_2button;
extern const joystick_if_t joystick_2axis_4button;
extern const joystick_if_t joystick_3axis_2button;
extern const joystick_if_t joystick_3axis_4button;
extern const joystick_if_t joystick_4axis_4button;
extern const joystick_if_t joystick_standard_6button;
extern const joystick_if_t joystick_standard_8button;
extern const joystick_if_t joystick_2axis_6button;
extern const joystick_if_t joystick_2axis_8button;

View File

@@ -1,3 +1,53 @@
include_directories("./mac")
target_sources(86Box PUBLIC "./macOSXGlue.m")
#
# 86Box A hypervisor and IBM PC system emulator that specializes in
# running old operating systems and software designed for IBM
# PC systems and compatibles from 1981 through fairly recent
# system designs based on the PCI bus.
#
# This file is part of the 86Box distribution.
#
# CMake build script.
#
# Authors: dob205,
# Jerome Vernet
# David Hrdlička, <hrdlickadavid@outlook.com>
#
# Copyright 2021 dob205.
# Copyright 2021 Jerome Vernet.
# Copyright 2021 David Hrdlička.
#
# Pick the bundle icon depending on the release channel
if(RELEASE_BUILD)
set(APP_ICON_MACOSX icons/release/86Box.icns)
elseif(BETA_BUILD)
set(APP_ICON_MACOSX icons/beta/86Box.icns)
elseif(ALPHA_BUILD)
set(APP_ICON_MACOSX icons/dev/86Box.icns)
else()
set(APP_ICON_MACOSX icons/branch/86Box.icns)
endif()
target_link_libraries(86Box "-framework AppKit")
target_sources(86Box PRIVATE macOSXGlue.m ${APP_ICON_MACOSX})
# Make sure the icon is copied to the bundle
set_source_files_properties(${APP_ICON_MACOSX}
TARGET_DIRECTORY 86Box
PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
# Prepare long version string
if(EMU_BUILD)
set(LONG_VER_STRING "${CMAKE_PROJECT_VERSION} [${EMU_BUILD}]")
else()
set(LONG_VER_STRING "${CMAKE_PROJECT_VERSION}")
endif()
# Generate Info.plist
configure_file(Info.plist.in Info.plist @ONLY)
set_target_properties(86Box
PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
#set(XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "YES")
#set(XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "-")
#set(XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${CMAKE_CURRENT_SOURCE_DIR}/mac/codesign/dev/app.entitlements)

View File

@@ -7,29 +7,29 @@
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleGetInfoString</key>
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
<string>An emulator of old computers</string>
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<string>86Box.icns</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
<string>net.86Box.86Box</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
<string>@LONG_VER_STRING@</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<string>86Box</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<string>@CMAKE_PROJECT_VERSION@</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<string>@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@.@CMAKE_PROJECT_VERSION_PATCH@.@EMU_BUILD_NUM@</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<string>© 2007-@EMU_COPYRIGHT_YEAR@ 86Box contributors</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>

View File

@@ -1,3 +1,20 @@
#
# 86Box A hypervisor and IBM PC system emulator that specializes in
# running old operating systems and software designed for IBM
# PC systems and compatibles from 1981 through fairly recent
# system designs based on the PCI bus.
#
# This file is part of the 86Box distribution.
#
# CMake build script.
#
# Authors: Cacodemon345
# David Hrdlička, <hrdlickadavid@outlook.com>
#
# Copyright 2021 Cacodemon345.
# Copyright 2021 David Hrdlička.
#
add_library(plat OBJECT unix.c)
if (NOT CPPTHREADS)

View File

@@ -27,18 +27,18 @@ if(NOT CPPTHREADS)
target_sources(plat PRIVATE win_thread.c)
endif()
if(MSVC)
# MSVC complains when we include the manifest from 86Box.rc...
# On the bright side, CMake supports passing the manifest as a source
# file when using MSVC, so we might just as well do that!
target_compile_definitions(ui PRIVATE NO_INCLUDE_MANIFEST)
if(NOT MINGW)
# MSVC linker adds its own manifest to the executable, which fails if
# we include ours in 86Box.rc. We therefore need to pass the manifest
# directly as as a source file, so the linker can use that instead.
set_property(SOURCE 86Box.rc PROPERTY COMPILE_DEFINITIONS NO_INCLUDE_MANIFEST)
target_sources(86Box PRIVATE 86Box.manifest)
# Append null to resource strings (fixes file dialogs)
set_property(SOURCE 86Box.rc PROPERTY COMPILE_FLAGS -n)
endif()
if(NOT MINGW)
# `opendir` is only included in MinGW, so include an implementation
# for other builds.
target_sources(plat PRIVATE win_opendir.c)
endif()

View File

@@ -1,6 +1,6 @@
{
"name": "86box",
"version-string": "3.0",
"version-string": "3.1",
"homepage": "https://86box.net/",
"documentation": "http://86box.readthedocs.io/",
"license": "GPL-2.0-only",