diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 51e2acbeb..6d13f5b72 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -46,7 +46,6 @@ jobs: make ${{ matrix.environment.prefix }}-gcc ${{ matrix.environment.prefix }}-pkg-config - ${{ matrix.environment.prefix }}-openal ${{ matrix.environment.prefix }}-freetype ${{ matrix.environment.prefix }}-SDL2 ${{ matrix.environment.prefix }}-zlib diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2e4753927..ec26581d9 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -5,6 +5,7 @@ on: push: paths: - src/** + - cmake/** - "**/CMakeLists.txt" - "CMakePresets.json" - .github/workflows/cmake.yml @@ -14,6 +15,7 @@ on: pull_request: paths: - src/** + - cmake/** - "**/CMakeLists.txt" - "CMakePresets.json" - .github/workflows/** @@ -81,7 +83,6 @@ jobs: ${{ matrix.environment.prefix }}-ninja ${{ matrix.environment.prefix }}-cc ${{ matrix.environment.prefix }}-pkg-config - ${{ matrix.environment.prefix }}-openal ${{ matrix.environment.prefix }}-freetype ${{ matrix.environment.prefix }}-SDL2 ${{ matrix.environment.prefix }}-zlib @@ -94,7 +95,7 @@ jobs: cmake -S . -B build --preset ${{ matrix.build.preset }} -D CMAKE_INSTALL_PREFIX=./build/artifacts - -D VNC=OFF + -D QT=OFF - name: Build run: cmake --build build --target ${{ matrix.build.target }} - uses: actions/upload-artifact@v2 @@ -180,6 +181,7 @@ jobs: -name "GitHub" -username "86Box" -password "${{ secrets.GITHUB_TOKEN }}" + - run: dir "C:/Program Files/Microsoft Visual Studio/2022/*/VC/Tools/MSVC/*/include" -include stdatomic.h -recurse | del - name: vcpkg package restore if: false run: vcpkg install freetype libpng openal-soft sdl2 rtmidi --triplet ${{ matrix.target.triplet }} @@ -194,6 +196,7 @@ jobs: -D CMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -D VCPKG_CHAINLOAD_TOOLCHAIN_FILE=${{ github.workspace }}/${{ matrix.target.toolchain }} -D VCPKG_TARGET_TRIPLET=${{ matrix.target.triplet }} + -D QT=OFF shell: cmd - name: Build run: | @@ -252,14 +255,13 @@ jobs: steps: - uses: actions/checkout@v2 - name: Install dependencies - run: sudo apt update && sudo apt install gcc-11 g++-11 libfreetype-dev libsdl2-dev libpng-dev libopenal-dev libc6-dev librtmidi-dev qtbase5-dev qttools5-dev libfaudio-dev + run: sudo apt update && sudo apt install gcc-11 g++-11 libfreetype-dev libsdl2-dev libpng-dev libc6-dev librtmidi-dev qtbase5-dev qttools5-dev libfaudio-dev - name: Configure CMake run: >- cmake -S . -B build -D CMAKE_INSTALL_PREFIX=./build/artifacts -D DEV_BRANCH=${{ matrix.build.dev-build }} -D NEW_DYNAREC=${{ matrix.build.new-dynarec }} - -D QT=ON -D CMAKE_BUILD_TYPE=${{ matrix.build.type }} -D CMAKE_C_COMPILER=gcc-11 -D CMAKE_CXX_COMPILER=g++-11 - name: Build @@ -316,18 +318,16 @@ jobs: steps: - uses: actions/checkout@v2 - name: Install dependencies - run: brew install freetype sdl2 libpng openal-soft rtmidi qt@5 faudio + run: brew install freetype sdl2 libpng rtmidi qt@5 faudio - name: Configure CMake run: >- cmake -S . -B build --toolchain cmake/flags-gcc-x86_64.cmake -D DEV_BRANCH=${{ matrix.build.dev-build }} -D NEW_DYNAREC=${{ matrix.build.new-dynarec }} - -D VNC=OFF -D CMAKE_BUILD_TYPE=${{ matrix.build.type }} - -D QT=ON - -D Qt5_DIR=/usr/local/Cellar/qt@5/5.15.2_1/lib/cmake/Qt5 - -D Qt5LinguistTools_DIR=/usr/local/Cellar/qt@5/5.15.2_1/lib/cmake/Qt5LinguistTools/ + -D Qt5_DIR=/usr/local/opt/qt@5/lib/cmake/Qt5 + -D Qt5LinguistTools_DIR=/usr/local/opt/qt@5/lib/cmake/Qt5LinguistTools/ - name: Build run: cmake --build build - name: Generate package diff --git a/CMakeLists.txt b/CMakeLists.txt index ac268dea5..667aac765 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,10 +18,14 @@ cmake_minimum_required(VERSION 3.16) cmake_policy(SET CMP0091 NEW) cmake_policy(SET CMP0079 NEW) -if(QT) +if(NOT DEFINED QT OR QT) list(APPEND VCPKG_MANIFEST_FEATURES "qt-ui") endif() +if(OPENAL) + list(APPEND VCPKG_MANIFEST_FEATURES "openal") +endif() + if(SLIRP_EXTERNAL) list(APPEND VCPKG_MANIFEST_FEATURES "slirp") endif() @@ -105,6 +109,11 @@ if(WIN32) add_compile_definitions(_WINSOCK_DEPRECATED_NO_WARNINGS) endif() +if(HAIKU) + set(OPENAL ON) + set(RTMIDI OFF) +endif() + set(CMAKE_CXX_STANDARD 11) set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON) @@ -115,6 +124,7 @@ set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON) option(RELEASE "Release build" OFF) option(DYNAREC "Dynamic recompiler" ON) option(OPENAL "OpenAL" OFF) +option(RTMIDI "RtMidi" ON) option(FLUIDSYNTH "FluidSynth" ON) option(MUNT "MUNT" ON) option(DINPUT "DirectInput" OFF) @@ -123,11 +133,7 @@ option(NEW_DYNAREC "Use the PCem v15 (\"new\") dynamic recompiler" option(MINITRACE "Enable Chrome tracing using the modified minitrace library" OFF) option(GDBSTUB "Enable GDB stub server for debugging" OFF) option(DEV_BRANCH "Development branch" OFF) -if(NOT WIN32) option(QT "QT GUI" ON) -else() -option(QT "QT GUI" OFF) -endif() # Development branch features # @@ -152,7 +158,7 @@ cmake_dependent_option(VNC "VNC renderer" cmake_dependent_option(XL24 "ATI VGA Wonder XL24 (ATI-28800-6)" ON "DEV_BRANCH" OFF) # Ditto but for Qt -if (QT) +if(QT) option(USE_QT6 "Use Qt6 instead of Qt5" OFF) endif() diff --git a/cmake/flags-gcc-aarch64.cmake b/cmake/flags-gcc-aarch64.cmake index d1f36af9c..34ddaf3e6 100644 --- a/cmake/flags-gcc-aarch64.cmake +++ b/cmake/flags-gcc-aarch64.cmake @@ -14,7 +14,7 @@ # Copyright 2021 David Hrdlička. # -string(APPEND CMAKE_C_FLAGS_INIT " -march=armv8-a ${CMAKE_C_FLAGS_INIT}") -string(APPEND CMAKE_CXX_FLAGS_INIT " -march=armv8-a ${CMAKE_CXX_FLAGS_INIT}") +string(APPEND CMAKE_C_FLAGS_INIT " -march=armv8-a") +string(APPEND CMAKE_CXX_FLAGS_INIT " -march=armv8-a") include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake) \ No newline at end of file diff --git a/cmake/flags-gcc-armv7.cmake b/cmake/flags-gcc-armv7.cmake index bd49fdfce..e73f55edd 100644 --- a/cmake/flags-gcc-armv7.cmake +++ b/cmake/flags-gcc-armv7.cmake @@ -14,7 +14,7 @@ # Copyright 2021 David Hrdlička. # -string(APPEND CMAKE_C_FLAGS_INIT " -march=armv7-a -mfloat-abi=hard ${CMAKE_C_FLAGS_INIT}") -string(APPEND CMAKE_CXX_FLAGS_INIT " -march=armv7-a -mfloat-abi=hard ${CMAKE_CXX_FLAGS_INIT}") +string(APPEND CMAKE_C_FLAGS_INIT " -march=armv7-a -mfloat-abi=hard") +string(APPEND CMAKE_CXX_FLAGS_INIT " -march=armv7-a -mfloat-abi=hard") include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake) \ No newline at end of file diff --git a/cmake/flags-gcc-i686.cmake b/cmake/flags-gcc-i686.cmake index 870fbc5df..2d12b7937 100644 --- a/cmake/flags-gcc-i686.cmake +++ b/cmake/flags-gcc-i686.cmake @@ -14,7 +14,7 @@ # Copyright 2021 David Hrdlička. # -string(APPEND CMAKE_C_FLAGS_INIT " -m32 -march=i686 -msse2 -mfpmath=sse -mstackrealign ${CMAKE_C_FLAGS_INIT}") -string(APPEND CMAKE_CXX_FLAGS_INIT " -m32 -march=i686 -msse2 -mfpmath=sse -mstackrealign ${CMAKE_CXX_FLAGS_INIT}") +string(APPEND CMAKE_C_FLAGS_INIT " -m32 -march=i686 -msse2 -mfpmath=sse -mstackrealign") +string(APPEND CMAKE_CXX_FLAGS_INIT " -m32 -march=i686 -msse2 -mfpmath=sse -mstackrealign") include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake) diff --git a/cmake/flags-gcc-x86_64.cmake b/cmake/flags-gcc-x86_64.cmake index 9099d8749..f9f39eb97 100644 --- a/cmake/flags-gcc-x86_64.cmake +++ b/cmake/flags-gcc-x86_64.cmake @@ -14,7 +14,7 @@ # Copyright 2021 David Hrdlička. # -string(APPEND CMAKE_C_FLAGS_INIT " -m64 -march=x86-64 -msse2 -mfpmath=sse -mstackrealign ${CMAKE_C_FLAGS_INIT}") -string(APPEND CMAKE_CXX_FLAGS_INIT " -m64 -march=x86-64 -msse2 -mfpmath=sse -mstackrealign ${CMAKE_CXX_FLAGS_INIT}") +string(APPEND CMAKE_C_FLAGS_INIT " -m64 -march=x86-64 -msse2 -mfpmath=sse -mstackrealign") +string(APPEND CMAKE_CXX_FLAGS_INIT " -m64 -march=x86-64 -msse2 -mfpmath=sse -mstackrealign") include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake) diff --git a/src/86box.c b/src/86box.c index 2d6095560..db0182d84 100644 --- a/src/86box.c +++ b/src/86box.c @@ -938,7 +938,9 @@ pc_reset_hard_close(void) scsi_device_close_all(); - midi_close(); + midi_out_close(); + + midi_in_close(); cdrom_close(); @@ -1161,7 +1163,9 @@ pc_close(thread_t *ptr) scsi_device_close_all(); - midi_close(); + midi_out_close(); + + midi_in_close(); network_close(); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8be7580e0..06cebf82b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -105,20 +105,6 @@ find_package(PNG REQUIRED) include_directories(${PNG_INCLUDE_DIRS}) target_link_libraries(86Box PNG::PNG) -if(VCPKG_TOOLCHAIN) - # vcpkg includes a config file for rtmidi - find_package(RtMidi REQUIRED) - target_link_libraries(86Box RtMidi::rtmidi) -else() - find_package(PkgConfig REQUIRED) - pkg_check_modules(RTMIDI REQUIRED IMPORTED_TARGET rtmidi) - target_link_libraries(86Box PkgConfig::RTMIDI) - - if(WIN32) - target_link_libraries(PkgConfig::RTMIDI INTERFACE winmm) - endif() -endif() - configure_file(include/86box/version.h.in include/86box/version.h @ONLY) include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) @@ -193,6 +179,7 @@ elseif(WIN32) OPTIONAL) endif() + add_subdirectory(device) add_subdirectory(disk) add_subdirectory(floppy) diff --git a/src/acpi.c b/src/acpi.c index 7db4d0e26..11d991f63 100644 --- a/src/acpi.c +++ b/src/acpi.c @@ -1613,79 +1613,72 @@ acpi_init(const device_t *info) return dev; } -const device_t acpi_ali_device = -{ - "ALi M7101 ACPI", - "acpi_ali", - DEVICE_PCI, - VEN_ALI, - acpi_init, - acpi_close, - acpi_reset, - { NULL }, - acpi_speed_changed, - NULL, - NULL +const device_t acpi_ali_device = { + .name = "ALi M7101 ACPI", + .internal_name = "acpi_ali", + .flags = DEVICE_PCI, + .local = VEN_ALI, + .init = acpi_init, + .close = acpi_close, + .reset = acpi_reset, + { .available = NULL }, + .speed_changed = acpi_speed_changed, + .force_redraw = NULL, + .config = NULL }; -const device_t acpi_intel_device = -{ - "Intel ACPI", - "acpi_intel", - DEVICE_PCI, - VEN_INTEL, - acpi_init, - acpi_close, - acpi_reset, - { NULL }, - acpi_speed_changed, - NULL, - NULL +const device_t acpi_intel_device = { + .name = "Intel ACPI", + .internal_name = "acpi_intel", + .flags = DEVICE_PCI, + .local = VEN_INTEL, + .init = acpi_init, + .close = acpi_close, + .reset = acpi_reset, + { .available = NULL }, + .speed_changed = acpi_speed_changed, + .force_redraw = NULL, + .config = NULL }; -const device_t acpi_via_device = -{ - "VIA ACPI", - "acpi_via", - DEVICE_PCI, - VEN_VIA, - acpi_init, - acpi_close, - acpi_reset, - { NULL }, - acpi_speed_changed, - NULL, - NULL +const device_t acpi_via_device = { + .name = "VIA ACPI", + .internal_name = "acpi_via", + .flags = DEVICE_PCI, + .local = VEN_VIA, + .init = acpi_init, + .close = acpi_close, + .reset = acpi_reset, + { .available = NULL }, + .speed_changed = acpi_speed_changed, + .force_redraw = NULL, + .config = NULL }; - -const device_t acpi_via_596b_device = -{ - "VIA VT82C596 ACPI", - "acpi_via_596b", - DEVICE_PCI, - VEN_VIA_596B, - acpi_init, - acpi_close, - acpi_reset, - { NULL }, - acpi_speed_changed, - NULL, - NULL +const device_t acpi_via_596b_device = { + .name = "VIA VT82C596 ACPI", + .internal_name = "acpi_via_596b", + .flags = DEVICE_PCI, + .local = VEN_VIA_596B, + .init = acpi_init, + .close = acpi_close, + .reset = acpi_reset, + { .available = NULL }, + .speed_changed = acpi_speed_changed, + .force_redraw = NULL, + .config = NULL }; - -const device_t acpi_smc_device = -{ - "SMC FDC73C931APM ACPI", - "acpi_smc", - DEVICE_PCI, - VEN_SMC, - acpi_init, - acpi_close, - acpi_reset, - { NULL }, - acpi_speed_changed, - NULL, - NULL +const device_t acpi_smc_device = { + .name = "SMC FDC73C931APM ACPI", + .internal_name = "acpi_smc", + .flags = DEVICE_PCI, + .local = VEN_SMC, + .init = acpi_init, + .close = acpi_close, + .reset = acpi_reset, + { .available = NULL }, + .speed_changed = acpi_speed_changed, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/apm.c b/src/apm.c index def8db7bc..9bee70e78 100644 --- a/src/apm.c +++ b/src/apm.c @@ -123,49 +123,44 @@ static void } -const device_t apm_device = -{ - "Advanced Power Management", - "apm", - 0, - 0, - apm_init, - apm_close, - NULL, - { NULL }, - NULL, - NULL, - NULL +const device_t apm_device = { + .name = "Advanced Power Management", + .internal_name = "apm", + .flags = 0, + .local = 0, + .init = apm_init, + .close = apm_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t apm_pci_device = -{ - "Advanced Power Management (PCI)", - "apm_pci", - DEVICE_PCI, - 0, - apm_init, - apm_close, - apm_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t apm_pci_device = { + .name = "Advanced Power Management (PCI)", + .internal_name = "apm_pci", + .flags = DEVICE_PCI, + .local = 0, + .init = apm_init, + .close = apm_close, + .reset = apm_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t apm_pci_acpi_device = -{ - "Advanced Power Management (PCI)", - "apm_pci_acpi", - DEVICE_PCI, - 1, - apm_init, - apm_close, - apm_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t apm_pci_acpi_device = { + .name = "Advanced Power Management (PCI)", + .internal_name = "apm_pci_acpi", + .flags = DEVICE_PCI, + .local = 1, + .init = apm_init, + .close = apm_close, + .reset = apm_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/82c100.c b/src/chipset/82c100.c index 76a6590bf..8b2259374 100644 --- a/src/chipset/82c100.c +++ b/src/chipset/82c100.c @@ -397,11 +397,15 @@ ct_82c100_init(const device_t *info) const device_t ct_82c100_device = { - "C&T 82C100", - "ct_82c100", - 0, - 0, - ct_82c100_init, ct_82c100_close, ct_82c100_reset, - { NULL }, NULL, NULL, - NULL + .name = "C&T 82C100", + .internal_name = "ct_82c100", + .flags = 0, + .local = 0, + .init = ct_82c100_init, + .close = ct_82c100_close, + .reset = ct_82c100_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/acc2168.c b/src/chipset/acc2168.c index ba8331447..9b8865784 100644 --- a/src/chipset/acc2168.c +++ b/src/chipset/acc2168.c @@ -193,14 +193,15 @@ acc2168_init(const device_t *info) } const device_t acc2168_device = { - "ACC 2046/2168", - "acc2168", - 0, - 0, - acc2168_init, - acc2168_close, - NULL, - {NULL}, - NULL, - NULL, - NULL}; + .name = "ACC 2046/2168", + .internal_name = "acc2168", + .flags = 0, + .local = 0, + .init = acc2168_init, + .close = acc2168_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; diff --git a/src/chipset/ali1429.c b/src/chipset/ali1429.c index ccd7e5007..468ed4f00 100644 --- a/src/chipset/ali1429.c +++ b/src/chipset/ali1429.c @@ -339,21 +339,29 @@ ali1429_init(const device_t *info) } const device_t ali1429_device = { - "ALi M1429", - "ali1429", - 0, - 0, - ali1429_init, ali1429_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "ALi M1429", + .internal_name = "ali1429", + .flags = 0, + .local = 0, + .init = ali1429_init, + .close = ali1429_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t ali1429g_device = { - "ALi M1429G", - "ali1429g", - 0, - 1, - ali1429_init, ali1429_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "ALi M1429G", + .internal_name = "ali1429g", + .flags = 0, + .local = 1, + .init = ali1429_init, + .close = ali1429_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/ali1489.c b/src/chipset/ali1489.c index 1ab245b40..5ba53f34c 100644 --- a/src/chipset/ali1489.c +++ b/src/chipset/ali1489.c @@ -626,16 +626,16 @@ ali1489_init(const device_t *info) return dev; } - const device_t ali1489_device = { - "ALi M1489", - "ali1489", - 0, - 0, - ali1489_init, - ali1489_close, - ali1489_reset, - {NULL}, - NULL, - NULL, - NULL}; + .name = "ALi M1489", + .internal_name = "ali1489", + .flags = 0, + .local = 0, + .init = ali1489_init, + .close = ali1489_close, + .reset = ali1489_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; diff --git a/src/chipset/ali1531.c b/src/chipset/ali1531.c index 12f425c36..350ec146f 100644 --- a/src/chipset/ali1531.c +++ b/src/chipset/ali1531.c @@ -376,17 +376,16 @@ ali1531_init(const device_t *info) return dev; } - const device_t ali1531_device = { - "ALi M1531 CPU-to-PCI Bridge", - "ali1531", - DEVICE_PCI, - 0, - ali1531_init, - ali1531_close, - ali1531_reset, - {NULL}, - NULL, - NULL, - NULL + .name = "ALi M1531 CPU-to-PCI Bridge", + .internal_name = "ali1531", + .flags = DEVICE_PCI, + .local = 0, + .init = ali1531_init, + .close = ali1531_close, + .reset = ali1531_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/ali1541.c b/src/chipset/ali1541.c index 3f94ec694..097726106 100644 --- a/src/chipset/ali1541.c +++ b/src/chipset/ali1541.c @@ -641,17 +641,16 @@ ali1541_init(const device_t *info) return dev; } - const device_t ali1541_device = { - "ALi M1541 CPU-to-PCI Bridge", - "ali1541", - DEVICE_PCI, - 0, - ali1541_init, - ali1541_close, - ali1541_reset, - {NULL}, - NULL, - NULL, - NULL + .name = "ALi M1541 CPU-to-PCI Bridge", + .internal_name = "ali1541", + .flags = DEVICE_PCI, + .local = 0, + .init = ali1541_init, + .close = ali1541_close, + .reset = ali1541_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/ali1543.c b/src/chipset/ali1543.c index a454b6a20..9811b198c 100644 --- a/src/chipset/ali1543.c +++ b/src/chipset/ali1543.c @@ -1465,7 +1465,7 @@ ali1533_sio_write(uint16_t addr, uint8_t val, void *priv) ali1543_t *dev = (ali1543_t *)priv; switch (addr) { - case 0x3f0: + case FDC_PRIMARY_ADDR: dev->sio_index = val; if (dev->sio_index == 0x51) dev->in_configuration_mode = 1; @@ -1501,7 +1501,7 @@ ali1533_sio_write(uint16_t addr, uint8_t val, void *priv) break; } - if ((!dev->in_configuration_mode) && (dev->sio_regs[0x07] <= 7) && (addr == 0x03f0)) + if ((!dev->in_configuration_mode) && (dev->sio_regs[0x07] <= 7) && (addr == FDC_PRIMARY_ADDR)) ali1533_sio_ldn(dev->sio_regs[0x07], dev); } @@ -1686,7 +1686,7 @@ ali1543_init(const device_t *info) dev->usb_slot = pci_add_card(PCI_ADD_SOUTHBRIDGE, ali5237_read, ali5237_write, dev); /* Ports 3F0-1h: M1543 Super I/O */ - io_sethandler(0x03f0, 0x0002, ali1533_sio_read, NULL, NULL, ali1533_sio_write, NULL, NULL, dev); + io_sethandler(FDC_PRIMARY_ADDR, 0x0002, ali1533_sio_read, NULL, NULL, ali1533_sio_write, NULL, NULL, dev); /* ACPI */ dev->acpi = device_add(&acpi_ali_device); @@ -1741,31 +1741,30 @@ ali1543_init(const device_t *info) return dev; } - const device_t ali1543_device = { - "ALi M1543 Desktop South Bridge", - "ali1543", - DEVICE_PCI, - 0, - ali1543_init, - ali1543_close, - ali1543_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "ALi M1543 Desktop South Bridge", + .internal_name = "ali1543", + .flags = DEVICE_PCI, + .local = 0, + .init = ali1543_init, + .close = ali1543_close, + .reset = ali1543_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t ali1543c_device = { - "ALi M1543C Desktop South Bridge", - "ali1543c", - DEVICE_PCI, - 1, - ali1543_init, - ali1543_close, - ali1543_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "ALi M1543C Desktop South Bridge", + .internal_name = "ali1543c", + .flags = DEVICE_PCI, + .local = 1, + .init = ali1543_init, + .close = ali1543_close, + .reset = ali1543_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/ali1621.c b/src/chipset/ali1621.c index 65cee2fd6..c234e65ce 100644 --- a/src/chipset/ali1621.c +++ b/src/chipset/ali1621.c @@ -670,17 +670,16 @@ ali1621_init(const device_t *info) return dev; } - const device_t ali1621_device = { - "ALi M1621 CPU-to-PCI Bridge", - "ali1621", - DEVICE_PCI, - 0, - ali1621_init, - ali1621_close, - ali1621_reset, - {NULL}, - NULL, - NULL, - NULL + .name = "ALi M1621 CPU-to-PCI Bridge", + .internal_name = "ali1621", + .flags = DEVICE_PCI, + .local = 0, + .init = ali1621_init, + .close = ali1621_close, + .reset = ali1621_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/ali6117.c b/src/chipset/ali6117.c index 04869fe50..815085ee8 100644 --- a/src/chipset/ali6117.c +++ b/src/chipset/ali6117.c @@ -375,34 +375,30 @@ ali6117_init(const device_t *info) return dev; } - -const device_t ali1217_device = -{ - "ALi M1217", - "ali1217", - DEVICE_AT, - 0x8, - ali6117_init, - ali6117_close, - ali6117_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t ali1217_device = { + .name = "ALi M1217", + .internal_name = "ali1217", + .flags = DEVICE_AT, + .local = 0x8, + .init = ali6117_init, + .close = ali6117_close, + .reset = ali6117_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t ali6117d_device = -{ - "ALi M6117D", - "ali6117d", - DEVICE_AT, - 0x2, - ali6117_init, - ali6117_close, - ali6117_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t ali6117d_device = { + .name = "ALi M6117D", + .internal_name = "ali6117d", + .flags = DEVICE_AT, + .local = 0x2, + .init = ali6117_init, + .close = ali6117_close, + .reset = ali6117_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/contaq_82c59x.c b/src/chipset/contaq_82c59x.c index 0abab7f02..6763202d0 100644 --- a/src/chipset/contaq_82c59x.c +++ b/src/chipset/contaq_82c59x.c @@ -346,32 +346,30 @@ contaq_82c59x_init(const device_t *info) return dev; } - const device_t contaq_82c596a_device = { - "Contaq 82C596A", - "contaq_82c596a", - 0, - 0, - contaq_82c59x_init, - contaq_82c59x_close, - NULL, - { NULL }, - NULL, - NULL, - NULL + .name = "Contaq 82C596A", + .internal_name = "contaq_82c596a", + .flags = 0, + .local = 0, + .init = contaq_82c59x_init, + .close = contaq_82c59x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t contaq_82c597_device = { - "Contaq 82C597", - "contaq_82c597", - 0, - 1, - contaq_82c59x_init, - contaq_82c59x_close, - NULL, - { NULL }, - NULL, - NULL, - NULL + .name = "Contaq 82C597", + .internal_name = "contaq_82c597", + .flags = 0, + .local = 1, + .init = contaq_82c59x_init, + .close = contaq_82c59x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/cs4031.c b/src/chipset/cs4031.c index 01e3edc18..d5970b048 100644 --- a/src/chipset/cs4031.c +++ b/src/chipset/cs4031.c @@ -176,14 +176,15 @@ cs4031_init(const device_t *info) } const device_t cs4031_device = { - "Chips & Technogies CS4031", - "cs4031", - 0, - 0, - cs4031_init, - cs4031_close, - NULL, - {NULL}, - NULL, - NULL, - NULL}; + .name = "Chips & Technogies CS4031", + .internal_name = "cs4031", + .flags = 0, + .local = 0, + .init = cs4031_init, + .close = cs4031_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; diff --git a/src/chipset/cs8230.c b/src/chipset/cs8230.c index 3718a93ca..f6a77cabc 100644 --- a/src/chipset/cs8230.c +++ b/src/chipset/cs8230.c @@ -156,13 +156,16 @@ static void return cs8230; } - const device_t cs8230_device = { - "C&T CS8230 (386/AT)", - "cs8230", - 0, - 0, - cs8230_init, cs8230_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "C&T CS8230 (386/AT)", + .internal_name = "cs8230", + .flags = 0, + .local = 0, + .init = cs8230_init, + .close = cs8230_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/et6000.c b/src/chipset/et6000.c index 4dd00bdf3..1d7541c7e 100644 --- a/src/chipset/et6000.c +++ b/src/chipset/et6000.c @@ -149,14 +149,15 @@ et6000_init(const device_t *info) } const device_t et6000_device = { - "ETEQ Cheetah ET6000", - "et6000", - 0, - 0, - et6000_init, - et6000_close, - NULL, - {NULL}, - NULL, - NULL, - NULL}; + .name = "ETEQ Cheetah ET6000", + .internal_name = "et6000", + .flags = 0, + .local = 0, + .init = et6000_init, + .close = et6000_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; diff --git a/src/chipset/gc100.c b/src/chipset/gc100.c index 6618534af..09df87856 100644 --- a/src/chipset/gc100.c +++ b/src/chipset/gc100.c @@ -230,23 +230,30 @@ gc100_init(const device_t *info) return dev; } - const device_t gc100_device = { - "G2 GC100", - "gc100", - 0, - 0, - gc100_init, gc100_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "G2 GC100", + .internal_name = "gc100", + .flags = 0, + .local = 0, + .init = gc100_init, + .close = gc100_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t gc100a_device = { - "G2 GC100A", - "gc100a", - 0, - 1, - gc100_init, gc100_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "G2 GC100A", + .internal_name = "gc100a", + .flags = 0, + .local = 1, + .init = gc100_init, + .close = gc100_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/headland.c b/src/chipset/headland.c index 8a67df9b1..ed2e318fc 100644 --- a/src/chipset/headland.c +++ b/src/chipset/headland.c @@ -684,43 +684,58 @@ headland_init(const device_t *info) return(dev); } - const device_t headland_gc10x_device = { - "Headland GC101/102/103", - "headland_gc10x", - 0, - 0, - headland_init, headland_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Headland GC101/102/103", + .internal_name = "headland_gc10x", + .flags = 0, + .local = 0, + .init = headland_init, + .close = headland_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t headland_ht18a_device = { - "Headland HT18 Rev. A", - "headland_ht18a", - 0, - 1, - headland_init, headland_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Headland HT18 Rev. A", + .internal_name = "headland_ht18a", + .flags = 0, + .local = 1, + .init = headland_init, + .close = headland_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t headland_ht18b_device = { - "Headland HT18 Rev. B", - "headland_ht18b", - 0, - 2, - headland_init, headland_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Headland HT18 Rev. B", + .internal_name = "headland_ht18b", + .flags = 0, + .local = 2, + .init = headland_init, + .close = headland_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t headland_ht18c_device = { - "Headland HT18 Rev. C", - "headland_ht18c", - 0, - 8, - headland_init, headland_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Headland HT18 Rev. C", + .internal_name = "headland_ht18c", + .flags = 0, + .local = 8, + .init = headland_init, + .close = headland_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/ims8848.c b/src/chipset/ims8848.c index d96c53508..10e87b530 100644 --- a/src/chipset/ims8848.c +++ b/src/chipset/ims8848.c @@ -400,13 +400,16 @@ ims8848_init(const device_t *info) return dev; } - const device_t ims8848_device = { - "IMS 8848/8849", - "ims8848", - 0, - 0, - ims8848_init, ims8848_close, ims8848_reset, - { NULL }, NULL, NULL, - NULL + .name = "IMS 8848/8849", + .internal_name = "ims8848", + .flags = 0, + .local = 0, + .init = ims8848_init, + .close = ims8848_close, + .reset = ims8848_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/intel_420ex.c b/src/chipset/intel_420ex.c index aed5a6e6d..187e6f636 100644 --- a/src/chipset/intel_420ex.c +++ b/src/chipset/intel_420ex.c @@ -528,34 +528,30 @@ i420ex_init(const device_t *info) return dev; } - -const device_t i420ex_device = -{ - "Intel 82420EX", - "i420ex", - DEVICE_PCI, - 0x00, - i420ex_init, - i420ex_close, - i420ex_reset, - { NULL }, - i420ex_speed_changed, - NULL, - NULL +const device_t i420ex_device = { + .name = "Intel 82420EX", + .internal_name = "i420ex", + .flags = DEVICE_PCI, + .local = 0x00, + .init = i420ex_init, + .close = i420ex_close, + .reset = i420ex_reset, + { .available = NULL }, + .speed_changed = i420ex_speed_changed, + .force_redraw = NULL, + .config = NULL }; - -const device_t i420ex_ide_device = -{ - "Intel 82420EX (With IDE)", - "i420ex_ide", - DEVICE_PCI, - 0x01, - i420ex_init, - i420ex_close, - i420ex_reset, - { NULL }, - i420ex_speed_changed, - NULL, - NULL +const device_t i420ex_ide_device = { + .name = "Intel 82420EX (With IDE)", + .internal_name = "i420ex_ide", + .flags = DEVICE_PCI, + .local = 0x01, + .init = i420ex_init, + .close = i420ex_close, + .reset = i420ex_reset, + { .available = NULL }, + .speed_changed = i420ex_speed_changed, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/intel_4x0.c b/src/chipset/intel_4x0.c index b0e043613..7e8ff9405 100644 --- a/src/chipset/intel_4x0.c +++ b/src/chipset/intel_4x0.c @@ -1633,252 +1633,226 @@ static void return dev; } - -const device_t i420tx_device = -{ - "Intel 82424TX", - "i420tx", - DEVICE_PCI, - INTEL_420TX, - i4x0_init, - i4x0_close, - i4x0_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i420tx_device = { + .name = "Intel 82424TX", + .internal_name = "i420tx", + .flags = DEVICE_PCI, + .local = INTEL_420TX, + .init = i4x0_init, + .close = i4x0_close, + .reset = i4x0_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t i420zx_device = -{ - "Intel 82424ZX", - "i420zx", - DEVICE_PCI, - INTEL_420ZX, - i4x0_init, - i4x0_close, - i4x0_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i420zx_device = { + .name = "Intel 82424ZX", + .internal_name = "i420zx", + .flags = DEVICE_PCI, + .local = INTEL_420ZX, + .init = i4x0_init, + .close = i4x0_close, + .reset = i4x0_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t i430lx_device = -{ - "Intel 82434LX", - "i430lx", - DEVICE_PCI, - INTEL_430LX, - i4x0_init, - i4x0_close, - i4x0_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i430lx_device = { + .name = "Intel 82434LX", + .internal_name = "i430lx", + .flags = DEVICE_PCI, + .local = INTEL_430LX, + .init = i4x0_init, + .close = i4x0_close, + .reset = i4x0_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t i430nx_device = -{ - "Intel 82434NX", - "i430nx", - DEVICE_PCI, - INTEL_430NX, - i4x0_init, - i4x0_close, - i4x0_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i430nx_device = { + .name = "Intel 82434NX", + .internal_name = "i430nx", + .flags = DEVICE_PCI, + .local = INTEL_430NX, + .init = i4x0_init, + .close = i4x0_close, + .reset = i4x0_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t i430fx_device = -{ - "Intel SB82437FX-66", - "i430fx", - DEVICE_PCI, - INTEL_430FX, - i4x0_init, - i4x0_close, - i4x0_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i430fx_device = { + .name = "Intel SB82437FX-66", + .internal_name = "i430fx", + .flags = DEVICE_PCI, + .local = INTEL_430FX, + .init = i4x0_init, + .close = i4x0_close, + .reset = i4x0_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t i430fx_rev02_device = -{ - "Intel SB82437FX-66 (Rev. 02)", - "i430fx_rev02", - DEVICE_PCI, - 0x0200 | INTEL_430FX, - i4x0_init, - i4x0_close, - i4x0_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i430fx_rev02_device = { + .name = "Intel SB82437FX-66 (Rev. 02)", + .internal_name = "i430fx_rev02", + .flags = DEVICE_PCI, + .local = 0x0200 | INTEL_430FX, + .init = i4x0_init, + .close = i4x0_close, + .reset = i4x0_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t i430hx_device = -{ - "Intel 82439HX", - "i430hx", - DEVICE_PCI, - INTEL_430HX, - i4x0_init, - i4x0_close, - i4x0_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i430hx_device = { + .name = "Intel 82439HX", + .internal_name = "i430hx", + .flags = DEVICE_PCI, + .local = INTEL_430HX, + .init = i4x0_init, + .close = i4x0_close, + .reset = i4x0_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t i430vx_device = -{ - "Intel 82437VX", - "i430vx", - DEVICE_PCI, - INTEL_430VX, - i4x0_init, - i4x0_close, - i4x0_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i430vx_device = { + .name = "Intel 82437VX", + .internal_name = "i430vx", + .flags = DEVICE_PCI, + .local = INTEL_430VX, + .init = i4x0_init, + .close = i4x0_close, + .reset = i4x0_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t i430tx_device = -{ - "Intel 82439TX", - "i430tx", - DEVICE_PCI, - INTEL_430TX, - i4x0_init, - i4x0_close, - i4x0_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i430tx_device = { + .name = "Intel 82439TX", + .internal_name = "i430tx", + .flags = DEVICE_PCI, + .local = INTEL_430TX, + .init = i4x0_init, + .close = i4x0_close, + .reset = i4x0_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t i440fx_device = -{ - "Intel 82441FX", - "i440fx", - DEVICE_PCI, - INTEL_440FX, - i4x0_init, - i4x0_close, - i4x0_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i440fx_device = { + .name = "Intel 82441FX", + .internal_name = "i440fx", + .flags = DEVICE_PCI, + .local = INTEL_440FX, + .init = i4x0_init, + .close = i4x0_close, + .reset = i4x0_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t i440lx_device = -{ - "Intel 82443LX", - "i440lx", - DEVICE_PCI, - INTEL_440LX, - i4x0_init, - i4x0_close, - i4x0_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i440lx_device = { + .name = "Intel 82443LX", + .internal_name = "i440lx", + .flags = DEVICE_PCI, + .local = INTEL_440LX, + .init = i4x0_init, + .close = i4x0_close, + .reset = i4x0_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t i440ex_device = -{ - "Intel 82443EX", - "i440ex", - DEVICE_PCI, - INTEL_440EX, - i4x0_init, - i4x0_close, - i4x0_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i440ex_device = { + .name = "Intel 82443EX", + .internal_name = "i440ex", + .flags = DEVICE_PCI, + .local = INTEL_440EX, + .init = i4x0_init, + .close = i4x0_close, + .reset = i4x0_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t i440bx_device = -{ - "Intel 82443BX", - "i440bx", - DEVICE_PCI, - 0x8000 | INTEL_440BX, - i4x0_init, - i4x0_close, - i4x0_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i440bx_device = { + .name = "Intel 82443BX", + .internal_name = "i440bx", + .flags = DEVICE_PCI, + .local = 0x8000 | INTEL_440BX, + .init = i4x0_init, + .close = i4x0_close, + .reset = i4x0_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t i440bx_no_agp_device = -{ - "Intel 82443BX", - "i440bx_no_agp", - DEVICE_PCI, - 0x8200 | INTEL_440BX, - i4x0_init, - i4x0_close, - i4x0_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i440bx_no_agp_device = { + .name = "Intel 82443BX", + .internal_name = "i440bx_no_agp", + .flags = DEVICE_PCI, + .local = 0x8200 | INTEL_440BX, + .init = i4x0_init, + .close = i4x0_close, + .reset = i4x0_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t i440gx_device = -{ - "Intel 82443GX", - "i440gx", - DEVICE_PCI, - 0x8000 | INTEL_440GX, - i4x0_init, - i4x0_close, - i4x0_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i440gx_device = { + .name = "Intel 82443GX", + .internal_name = "i440gx", + .flags = DEVICE_PCI, + .local = 0x8000 | INTEL_440GX, + .init = i4x0_init, + .close = i4x0_close, + .reset = i4x0_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t i440zx_device = -{ - "Intel 82443ZX", - "i440zx", - DEVICE_PCI, - 0x8000 | INTEL_440ZX, - i4x0_init, - i4x0_close, - i4x0_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i440zx_device = { + .name = "Intel 82443ZX", + .internal_name = "i440zx", + .flags = DEVICE_PCI, + .local = 0x8000 | INTEL_440ZX, + .init = i4x0_init, + .close = i4x0_close, + .reset = i4x0_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/intel_82335.c b/src/chipset/intel_82335.c index 6dbe0ea4f..2c018d3ef 100644 --- a/src/chipset/intel_82335.c +++ b/src/chipset/intel_82335.c @@ -197,14 +197,15 @@ intel_82335_init(const device_t *info) } const device_t intel_82335_device = { - "Intel 82335", - "intel_82335", - 0, - 0, - intel_82335_init, - intel_82335_close, - NULL, - {NULL}, - NULL, - NULL, - NULL}; + .name = "Intel 82335", + .internal_name = "intel_82335", + .flags = 0, + .local = 0, + .init = intel_82335_init, + .close = intel_82335_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; diff --git a/src/chipset/intel_i450kx.c b/src/chipset/intel_i450kx.c index 315947108..ad92218f8 100644 --- a/src/chipset/intel_i450kx.c +++ b/src/chipset/intel_i450kx.c @@ -806,17 +806,16 @@ i450kx_init(const device_t *info) return dev; } - const device_t i450kx_device = { - "Intel 450KX (Mars)", - "i450kx", - DEVICE_PCI, - 0, - i450kx_init, - i450kx_close, - i450kx_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "Intel 450KX (Mars)", + .internal_name = "i450kx", + .flags = DEVICE_PCI, + .local = 0, + .init = i450kx_init, + .close = i450kx_close, + .reset = i450kx_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/intel_piix.c b/src/chipset/intel_piix.c index 0a6204b19..025862c44 100644 --- a/src/chipset/intel_piix.c +++ b/src/chipset/intel_piix.c @@ -1599,108 +1599,100 @@ static void return dev; } - -const device_t piix_device = -{ - "Intel 82371FB (PIIX)", - "piix", - DEVICE_PCI, - 0x122e0101, - piix_init, - piix_close, - piix_reset, - { NULL }, - piix_speed_changed, - NULL, - NULL +const device_t piix_device = { + .name = "Intel 82371FB (PIIX)", + .internal_name = "piix", + .flags = DEVICE_PCI, + .local = 0x122e0101, + .init = piix_init, + .close = piix_close, + .reset = piix_reset, + { .available = NULL }, + .speed_changed = piix_speed_changed, + .force_redraw = NULL, + .config = NULL }; -const device_t piix_rev02_device = -{ - "Intel 82371FB (PIIX) (Faulty BusMastering!!)", - "piix_rev02", - DEVICE_PCI, - 0x122e0121, - piix_init, - piix_close, - piix_reset, - { NULL }, - piix_speed_changed, - NULL, - NULL +const device_t piix_rev02_device = { + .name = "Intel 82371FB (PIIX) (Faulty BusMastering!!)", + .internal_name = "piix_rev02", + .flags = DEVICE_PCI, + .local = 0x122e0121, + .init = piix_init, + .close = piix_close, + .reset = piix_reset, + { .available = NULL }, + .speed_changed = piix_speed_changed, + .force_redraw = NULL, + .config = NULL }; -const device_t piix3_device = -{ - "Intel 82371SB (PIIX3)", - "piix3", - DEVICE_PCI, - 0x70000403, - piix_init, - piix_close, - piix_reset, - { NULL }, - piix_speed_changed, - NULL, - NULL +const device_t piix3_device = { + .name = "Intel 82371SB (PIIX3)", + .internal_name = "piix3", + .flags = DEVICE_PCI, + .local = 0x70000403, + .init = piix_init, + .close = piix_close, + .reset = piix_reset, + { .available = NULL }, + .speed_changed = piix_speed_changed, + .force_redraw = NULL, + .config = NULL }; -const device_t piix3_ioapic_device = -{ - "Intel 82371SB (PIIX3) (Boards with I/O APIC)", - "piix3_ioapic", - DEVICE_PCI, - 0x70001403, - piix_init, - piix_close, - piix_reset, - { NULL }, - piix_speed_changed, - NULL, - NULL +const device_t piix3_ioapic_device = { + .name = "Intel 82371SB (PIIX3) (Boards with I/O APIC)", + .internal_name = "piix3_ioapic", + .flags = DEVICE_PCI, + .local = 0x70001403, + .init = piix_init, + .close = piix_close, + .reset = piix_reset, + { .available = NULL }, + .speed_changed = piix_speed_changed, + .force_redraw = NULL, + .config = NULL }; -const device_t piix4_device = -{ - "Intel 82371AB/EB (PIIX4/PIIX4E)", - "piix4", - DEVICE_PCI, - 0x71100004, - piix_init, - piix_close, - piix_reset, - { NULL }, - piix_speed_changed, - NULL, - NULL +const device_t piix4_device = { + .name = "Intel 82371AB/EB (PIIX4/PIIX4E)", + .internal_name = "piix4", + .flags = DEVICE_PCI, + .local = 0x71100004, + .init = piix_init, + .close = piix_close, + .reset = piix_reset, + { .available = NULL }, + .speed_changed = piix_speed_changed, + .force_redraw = NULL, + .config = NULL }; -const device_t piix4e_device = -{ - "Intel 82371EB (PIIX4E)", - "piix4e", - DEVICE_PCI, - 0x71100094, - piix_init, - piix_close, - piix_reset, - { NULL }, - piix_speed_changed, - NULL, - NULL +const device_t piix4e_device = { + .name = "Intel 82371EB (PIIX4E)", + .internal_name = "piix4e", + .flags = DEVICE_PCI, + .local = 0x71100094, + .init = piix_init, + .close = piix_close, + .reset = piix_reset, + { .available = NULL }, + .speed_changed = piix_speed_changed, + .force_redraw = NULL, + .config = NULL }; -const device_t slc90e66_device = -{ - "SMSC SLC90E66 (Victory66)", - "slc90e66", - DEVICE_PCI, - 0x94600005, - piix_init, - piix_close, - piix_reset, - { NULL }, - piix_speed_changed, - NULL, - NULL +const device_t slc90e66_device = { + .name = "SMSC SLC90E66 (Victory66)", + .internal_name = "slc90e66", + .flags = DEVICE_PCI, + .local = 0x94600005, + .init = piix_init, + .close = piix_close, + .reset = piix_reset, + { .available = NULL }, + .speed_changed = piix_speed_changed, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/intel_sio.c b/src/chipset/intel_sio.c index df8bb8e61..ab535cb65 100644 --- a/src/chipset/intel_sio.c +++ b/src/chipset/intel_sio.c @@ -545,33 +545,31 @@ sio_init(const device_t *info) } -const device_t sio_device = -{ - "Intel 82378IB (SIO)", - "sio", - DEVICE_PCI, - 0x00, - sio_init, - sio_close, - sio_reset, - { NULL }, - sio_speed_changed, - NULL, - NULL +const device_t sio_device = { + .name = "Intel 82378IB (SIO)", + .internal_name = "sio", + .flags = DEVICE_PCI, + .local = 0x00, + .init = sio_init, + .close = sio_close, + .reset = sio_reset, + { .available = NULL }, + .speed_changed = sio_speed_changed, + .force_redraw = NULL, + .config = NULL }; -const device_t sio_zb_device = -{ - "Intel 82378ZB (SIO)", - "sio_zb", - DEVICE_PCI, - 0x03, - sio_init, - sio_close, - sio_reset, - { NULL }, - sio_speed_changed, - NULL, - NULL +const device_t sio_zb_device = { + .name = "Intel 82378ZB (SIO)", + .internal_name = "sio_zb", + .flags = DEVICE_PCI, + .local = 0x03, + .init = sio_init, + .close = sio_close, + .reset = sio_reset, + { .available = NULL }, + .speed_changed = sio_speed_changed, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/neat.c b/src/chipset/neat.c index 258982ea7..8e7bc1937 100644 --- a/src/chipset/neat.c +++ b/src/chipset/neat.c @@ -824,13 +824,16 @@ neat_init(const device_t *info) return dev; } - const device_t neat_device = { - "C&T CS8121 (NEAT)", - "neat", - 0, - 0, - neat_init, neat_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "C&T CS8121 (NEAT)", + .internal_name = "neat", + .flags = 0, + .local = 0, + .init = neat_init, + .close = neat_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/olivetti_eva.c b/src/chipset/olivetti_eva.c index 2f31458be..0728d44e5 100644 --- a/src/chipset/olivetti_eva.c +++ b/src/chipset/olivetti_eva.c @@ -157,11 +157,15 @@ olivetti_eva_init(const device_t *info) } const device_t olivetti_eva_device = { - "Olivetti EVA Gate Array", - "olivetta_eva", - 0, - 0, - olivetti_eva_init, olivetti_eva_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Olivetti EVA Gate Array", + .internal_name = "olivetta_eva", + .flags = 0, + .local = 0, + .init = olivetti_eva_init, + .close = olivetti_eva_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/opti283.c b/src/chipset/opti283.c index d02ea4add..8e9403c29 100644 --- a/src/chipset/opti283.c +++ b/src/chipset/opti283.c @@ -302,17 +302,16 @@ opti283_init(const device_t *info) return dev; } - const device_t opti283_device = { - "OPTi 82C283", - "opti283", - 0, - 0, - opti283_init, - opti283_close, - NULL, - { NULL }, - NULL, - NULL, - NULL + .name = "OPTi 82C283", + .internal_name = "opti283", + .flags = 0, + .local = 0, + .init = opti283_init, + .close = opti283_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/opti291.c b/src/chipset/opti291.c index c981f6b36..6bf8851e7 100644 --- a/src/chipset/opti291.c +++ b/src/chipset/opti291.c @@ -147,14 +147,15 @@ opti291_init(const device_t *info) } const device_t opti291_device = { - "OPTi 82C291", - "opti291", - 0, - 0, - opti291_init, - opti291_close, - NULL, - {NULL}, - NULL, - NULL, - NULL}; + .name = "OPTi 82C291", + .internal_name = "opti291", + .flags = 0, + .local = 0, + .init = opti291_init, + .close = opti291_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; diff --git a/src/chipset/opti391.c b/src/chipset/opti391.c index fde71fe3e..51c8d9daa 100644 --- a/src/chipset/opti391.c +++ b/src/chipset/opti391.c @@ -211,17 +211,16 @@ opti391_init(const device_t *info) return dev; } - const device_t opti391_device = { - "OPTi 82C391", - "opti391", - 0, - 0, - opti391_init, - opti391_close, - NULL, - { NULL }, - NULL, - NULL, - NULL + .name = "OPTi 82C391", + .internal_name = "opti391", + .flags = 0, + .local = 0, + .init = opti391_init, + .close = opti391_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/opti495.c b/src/chipset/opti495.c index 605d0fb8d..c02f9cc1f 100644 --- a/src/chipset/opti495.c +++ b/src/chipset/opti495.c @@ -236,24 +236,30 @@ opti495_init(const device_t *info) return dev; } - const device_t opti493_device = { - "OPTi 82C493", - "opti493", - 0, - 0, - opti495_init, opti495_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "OPTi 82C493", + .internal_name = "opti493", + .flags = 0, + .local = 0, + .init = opti495_init, + .close = opti495_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t opti495_device = { - "OPTi 82C495", - "opti495", - 0, - 1, - opti495_init, opti495_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "OPTi 82C495", + .internal_name = "opti495", + .flags = 0, + .local = 1, + .init = opti495_init, + .close = opti495_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/opti499.c b/src/chipset/opti499.c index ca9692964..08c06d58c 100644 --- a/src/chipset/opti499.c +++ b/src/chipset/opti499.c @@ -253,13 +253,16 @@ opti499_init(const device_t *info) return dev; } - const device_t opti499_device = { - "OPTi 82C499", - "opti499", - 0, - 1, - opti499_init, opti499_close, opti499_reset, - { NULL }, NULL, NULL, - NULL + .name = "OPTi 82C499", + .internal_name = "opti499", + .flags = 0, + .local = 1, + .init = opti499_init, + .close = opti499_close, + .reset = opti499_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/opti5x7.c b/src/chipset/opti5x7.c index 54ecd6c76..f0459a97f 100644 --- a/src/chipset/opti5x7.c +++ b/src/chipset/opti5x7.c @@ -176,14 +176,15 @@ opti5x7_init(const device_t *info) } const device_t opti5x7_device = { - "OPTi 82C5x6/82C5x7", - "opti5x7", - 0, - 0, - opti5x7_init, - opti5x7_close, - NULL, - {NULL}, - NULL, - NULL, - NULL}; + .name = "OPTi 82C5x6/82C5x7", + .internal_name = "opti5x7", + .flags = 0, + .local = 0, + .init = opti5x7_init, + .close = opti5x7_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; diff --git a/src/chipset/opti822.c b/src/chipset/opti822.c index 42a7c89cd..0235e3ee9 100644 --- a/src/chipset/opti822.c +++ b/src/chipset/opti822.c @@ -310,14 +310,15 @@ opti822_init(const device_t *info) } const device_t opti822_device = { - "OPTi 82C822 PCIB", - "opti822", - DEVICE_PCI, - 0, - opti822_init, - opti822_close, - opti822_reset, - {NULL}, - NULL, - NULL, - NULL}; + .name = "OPTi 82C822 PCIB", + .internal_name = "opti822", + .flags = DEVICE_PCI, + .local = 0, + .init = opti822_init, + .close = opti822_close, + .reset = opti822_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; diff --git a/src/chipset/opti895.c b/src/chipset/opti895.c index 14b0080fd..00f632f59 100644 --- a/src/chipset/opti895.c +++ b/src/chipset/opti895.c @@ -273,24 +273,30 @@ opti895_init(const device_t *info) return dev; } - const device_t opti802g_device = { - "OPTi 82C802G", - "opti802g", - 0, - 0, - opti895_init, opti895_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "OPTi 82C802G", + .internal_name = "opti802g", + .flags = 0, + .local = 0, + .init = opti895_init, + .close = opti895_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t opti895_device = { - "OPTi 82C895", - "opti895", - 0, - 0, - opti895_init, opti895_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "OPTi 82C895", + .internal_name = "opti895", + .flags = 0, + .local = 0, + .init = opti895_init, + .close = opti895_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/scamp.c b/src/chipset/scamp.c index 42f579dca..621f7d9c5 100644 --- a/src/chipset/scamp.c +++ b/src/chipset/scamp.c @@ -955,13 +955,16 @@ scamp_init(const device_t *info) return dev; } - const device_t vlsi_scamp_device = { - "VLSI SCAMP", - "vlsi_scamp", - 0, - 0, - scamp_init, scamp_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "VLSI SCAMP", + .internal_name = "vlsi_scamp", + .flags = 0, + .local = 0, + .init = scamp_init, + .close = scamp_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/scat.c b/src/chipset/scat.c index 0780ec507..1e7ba9263 100644 --- a/src/chipset/scat.c +++ b/src/chipset/scat.c @@ -1542,33 +1542,44 @@ scat_init(const device_t *info) return(dev); } - const device_t scat_device = { - "C&T SCAT (v1)", - "scat", - 0, - 0, - scat_init, scat_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "C&T SCAT (v1)", + .internal_name = "scat", + .flags = 0, + .local = 0, + .init = scat_init, + .close = scat_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t scat_4_device = { - "C&T SCAT (v4)", - "scat_4", - 0, - 4, - scat_init, scat_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "C&T SCAT (v4)", + .internal_name = "scat_4", + .flags = 0, + .local = 4, + .init = scat_init, + .close = scat_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t scat_sx_device = { - "C&T SCATsx", - "scat_sx", - 0, - 32, - scat_init, scat_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "C&T SCATsx", + .internal_name = "scat_sx", + .flags = 0, + .local = 32, + .init = scat_init, + .close = scat_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/sis_5511.c b/src/chipset/sis_5511.c index 44e8f98de..63950d47a 100644 --- a/src/chipset/sis_5511.c +++ b/src/chipset/sis_5511.c @@ -740,14 +740,15 @@ sis_5511_init(const device_t *info) } const device_t sis_5511_device = { - "SiS 5511", - "sis_5511", - DEVICE_PCI, - 0, - sis_5511_init, - sis_5511_close, - sis_5511_reset, - {NULL}, - NULL, - NULL, - NULL}; + .name = "SiS 5511", + .internal_name = "sis_5511", + .flags = DEVICE_PCI, + .local = 0, + .init = sis_5511_init, + .close = sis_5511_close, + .reset = sis_5511_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; diff --git a/src/chipset/sis_5571.c b/src/chipset/sis_5571.c index 4cc99319f..3f678d87b 100644 --- a/src/chipset/sis_5571.c +++ b/src/chipset/sis_5571.c @@ -742,14 +742,15 @@ sis_5571_init(const device_t *info) } const device_t sis_5571_device = { - "SiS 5571", - "sis_5571", - DEVICE_PCI, - 0, - sis_5571_init, - sis_5571_close, - sis_5571_reset, - {NULL}, - NULL, - NULL, - NULL}; + .name = "SiS 5571", + .internal_name = "sis_5571", + .flags = DEVICE_PCI, + .local = 0, + .init = sis_5571_init, + .close = sis_5571_close, + .reset = sis_5571_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; diff --git a/src/chipset/sis_85c310.c b/src/chipset/sis_85c310.c index e1130b733..2e83e3367 100644 --- a/src/chipset/sis_85c310.c +++ b/src/chipset/sis_85c310.c @@ -135,13 +135,16 @@ rabbit_init(const device_t *info) return dev; } - const device_t rabbit_device = { - "SiS Rabbit", - "rabbit", - 0, - 0, - rabbit_init, rabbit_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SiS Rabbit", + .internal_name = "rabbit", + .flags = 0, + .local = 0, + .init = rabbit_init, + .close = rabbit_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/sis_85c496.c b/src/chipset/sis_85c496.c index a649f5053..b900d4443 100644 --- a/src/chipset/sis_85c496.c +++ b/src/chipset/sis_85c496.c @@ -618,34 +618,30 @@ static void return dev; } - -const device_t sis_85c496_device = -{ - "SiS 85c496/85c497", - "sis_85c496", - DEVICE_PCI, - 0, - sis_85c496_init, - sis_85c496_close, - sis_85c496_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t sis_85c496_device = { + .name = "SiS 85c496/85c497", + .internal_name = "sis_85c496", + .flags = DEVICE_PCI, + .local = 0, + .init = sis_85c496_init, + .close = sis_85c496_close, + .reset = sis_85c496_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t sis_85c496_ls486e_device = -{ - "SiS 85c496/85c497 (Lucky Star LS-486E)", - "sis_85c496_ls486e", - DEVICE_PCI, - 1, - sis_85c496_init, - sis_85c496_close, - sis_85c496_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t sis_85c496_ls486e_device = { + .name = "SiS 85c496/85c497 (Lucky Star LS-486E)", + .internal_name = "sis_85c496_ls486e", + .flags = DEVICE_PCI, + .local = 1, + .init = sis_85c496_init, + .close = sis_85c496_close, + .reset = sis_85c496_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/sis_85c4xx.c b/src/chipset/sis_85c4xx.c index c679c1dad..b705eb32e 100644 --- a/src/chipset/sis_85c4xx.c +++ b/src/chipset/sis_85c4xx.c @@ -358,44 +358,59 @@ sis_85c4xx_init(const device_t *info) return dev; } - const device_t sis_85c401_device = { - "SiS 85c401/85c402", - "sis_85c401", - 0, - 0x060, - sis_85c4xx_init, sis_85c4xx_close, sis_85c4xx_reset, - { NULL }, NULL, NULL, - NULL + .name = "SiS 85c401/85c402", + .internal_name = "sis_85c401", + .flags = 0, + .local = 0x060, + .init = sis_85c4xx_init, + .close = sis_85c4xx_close, + .reset = sis_85c4xx_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t sis_85c460_device = { - "SiS 85c460", - "sis_85c460", - 0, - 0x050, - sis_85c4xx_init, sis_85c4xx_close, sis_85c4xx_reset, - { NULL }, NULL, NULL, - NULL + .name = "SiS 85c460", + .internal_name = "sis_85c460", + .flags = 0, + .local = 0x050, + .init = sis_85c4xx_init, + .close = sis_85c4xx_close, + .reset = sis_85c4xx_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; /* TODO: Log to make sure the registers are correct. */ const device_t sis_85c461_device = { - "SiS 85c461", - "sis_85c461", - 0, - 0x050, - sis_85c4xx_init, sis_85c4xx_close, sis_85c4xx_reset, - { NULL }, NULL, NULL, - NULL + .name = "SiS 85c461", + .internal_name = "sis_85c461", + .flags = 0, + .local = 0x050, + .init = sis_85c4xx_init, + .close = sis_85c4xx_close, + .reset = sis_85c4xx_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t sis_85c471_device = { - "SiS 85c407/85c471", - "sis_85c471", - 0, - 0x150, - sis_85c4xx_init, sis_85c4xx_close, sis_85c4xx_reset, - { NULL }, NULL, NULL, - NULL + .name = "SiS 85c407/85c471", + .internal_name = "sis_85c471", + .flags = 0, + .local = 0x150, + .init = sis_85c4xx_init, + .close = sis_85c4xx_close, + .reset = sis_85c4xx_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/sis_85c50x.c b/src/chipset/sis_85c50x.c index 93bbcb745..9d5dddebd 100644 --- a/src/chipset/sis_85c50x.c +++ b/src/chipset/sis_85c50x.c @@ -390,14 +390,16 @@ sis_85c50x_init(const device_t *info) return dev; } - const device_t sis_85c50x_device = { - "SiS 85C50x", - "sis_85c50x", - DEVICE_PCI, - 0, - sis_85c50x_init, sis_85c50x_close, - sis_85c50x_reset, { NULL }, - NULL, NULL, - NULL + .name = "SiS 85C50x", + .internal_name = "sis_85c50x", + .flags = DEVICE_PCI, + .local = 0, + .init = sis_85c50x_init, + .close = sis_85c50x_close, + .reset = sis_85c50x_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/stpc.c b/src/chipset/stpc.c index 8dcfc2862..f9bd8faff 100644 --- a/src/chipset/stpc.c +++ b/src/chipset/stpc.c @@ -1055,95 +1055,88 @@ stpc_lpt_init(const device_t *info) return dev; } - /* STPC SoCs */ -const device_t stpc_client_device = -{ - "STPC Client", - "stpc_client", - DEVICE_PCI, - STPC_CLIENT, - stpc_init, - stpc_close, - stpc_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t stpc_client_device = { + .name = "STPC Client", + .internal_name = "stpc_client", + .flags = DEVICE_PCI, + .local = STPC_CLIENT, + .init = stpc_init, + .close = stpc_close, + .reset = stpc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t stpc_consumer2_device = -{ - "STPC Consumer-II", - "stpc_consumer2", - DEVICE_PCI, - STPC_CONSUMER2, - stpc_init, - stpc_close, - stpc_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t stpc_consumer2_device = { + .name = "STPC Consumer-II", + .internal_name = "stpc_consumer2", + .flags = DEVICE_PCI, + .local = STPC_CONSUMER2, + .init = stpc_init, + .close = stpc_close, + .reset = stpc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t stpc_elite_device = -{ - "STPC Elite", - "stpc_elite", - DEVICE_PCI, - STPC_ELITE, - stpc_init, - stpc_close, - stpc_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t stpc_elite_device = { + .name = "STPC Elite", + .internal_name = "stpc_elite", + .flags = DEVICE_PCI, + .local = STPC_ELITE, + .init = stpc_init, + .close = stpc_close, + .reset = stpc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t stpc_atlas_device = -{ - "STPC Atlas", - "stpc_atlas", - DEVICE_PCI, - STPC_ATLAS, - stpc_init, - stpc_close, - stpc_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t stpc_atlas_device = { + .name = "STPC Atlas", + .internal_name = "stpc_atlas", + .flags = DEVICE_PCI, + .local = STPC_ATLAS, + .init = stpc_init, + .close = stpc_close, + .reset = stpc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; /* Auxiliary devices */ -const device_t stpc_serial_device = -{ - "STPC Serial UARTs", - "stpc_serial", - 0, - 0, - stpc_serial_init, - stpc_serial_close, - NULL, - { NULL }, - NULL, - NULL, - NULL +const device_t stpc_serial_device = { + .name = "STPC Serial UARTs", + .internal_name = "stpc_serial", + .flags = 0, + .local = 0, + .init = stpc_serial_init, + .close = stpc_serial_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t stpc_lpt_device = -{ - "STPC Parallel Port", - "stpc_lpt", - 0, - 0, - stpc_lpt_init, - stpc_lpt_close, - stpc_lpt_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t stpc_lpt_device = { + .name = "STPC Parallel Port", + .internal_name = "stpc_lpt", + .flags = 0, + .local = 0, + .init = stpc_lpt_init, + .close = stpc_lpt_close, + .reset = stpc_lpt_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/umc_8886.c b/src/chipset/umc_8886.c index ea99460d7..72dc8778b 100644 --- a/src/chipset/umc_8886.c +++ b/src/chipset/umc_8886.c @@ -377,23 +377,30 @@ umc_8886_init(const device_t *info) return dev; } - const device_t umc_8886f_device = { - "UMC 8886F", - "umc_8886f", - DEVICE_PCI, - 0x8886, - umc_8886_init, umc_8886_close, umc_8886_reset, - { NULL }, NULL, NULL, - NULL + .name = "UMC 8886F", + .internal_name = "umc_8886f", + .flags = DEVICE_PCI, + .local = 0x8886, + .init = umc_8886_init, + .close = umc_8886_close, + .reset = umc_8886_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t umc_8886af_device = { - "UMC 8886AF/8886BF", - "umc_8886af", - DEVICE_PCI, - 0x886a, - umc_8886_init, umc_8886_close, umc_8886_reset, - { NULL }, NULL, NULL, - NULL + .name = "UMC 8886AF/8886BF", + .internal_name = "umc_8886af", + .flags = DEVICE_PCI, + .local = 0x886a, + .init = umc_8886_init, + .close = umc_8886_close, + .reset = umc_8886_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/umc_hb4.c b/src/chipset/umc_hb4.c index 6bb7b13d3..4440b7eef 100644 --- a/src/chipset/umc_hb4.c +++ b/src/chipset/umc_hb4.c @@ -416,13 +416,16 @@ hb4_init(const device_t *info) return dev; } - const device_t umc_hb4_device = { - "UMC HB4(8881F)", - "umc_hb4", - DEVICE_PCI, - 0x886a, - hb4_init, hb4_close, hb4_reset, - { NULL }, NULL, NULL, - NULL + .name = "UMC HB4(8881F)", + .internal_name = "umc_hb4", + .flags = DEVICE_PCI, + .local = 0x886a, + .init = hb4_init, + .close = hb4_close, + .reset = hb4_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/via_apollo.c b/src/chipset/via_apollo.c index 60aa83a47..9a491478f 100644 --- a/src/chipset/via_apollo.c +++ b/src/chipset/via_apollo.c @@ -760,118 +760,114 @@ via_apollo_close(void *priv) free(dev); } -const device_t via_vpx_device = -{ - "VIA Apollo VPX", - "via_vpx", - DEVICE_PCI, - VIA_585, /*VT82C585*/ - via_apollo_init, - via_apollo_close, - via_apollo_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t via_vpx_device = { + .name = "VIA Apollo VPX", + .internal_name = "via_vpx", + .flags = DEVICE_PCI, + .local = VIA_585, /*VT82C585*/ + .init = via_apollo_init, + .close = via_apollo_close, + .reset = via_apollo_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t amd640_device = -{ - "AMD 640 System Controller", - "amd640", - DEVICE_PCI, - VIA_595, /*VT82C595*/ - via_apollo_init, - via_apollo_close, - via_apollo_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t amd640_device = { + .name = "AMD 640 System Controller", + .internal_name = "amd640", + .flags = DEVICE_PCI, + .local = VIA_595, /*VT82C595*/ + .init = via_apollo_init, + .close = via_apollo_close, + .reset = via_apollo_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t via_vp3_device = -{ - "VIA Apollo VP3", - "via_vp3", - DEVICE_PCI, - VIA_597, /*VT82C597*/ - via_apollo_init, - via_apollo_close, - via_apollo_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t via_vp3_device = { + .name = "VIA Apollo VP3", + .internal_name = "via_vp3", + .flags = DEVICE_PCI, + .local = VIA_597, /*VT82C597*/ + .init = via_apollo_init, + .close = via_apollo_close, + .reset = via_apollo_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t via_mvp3_device = -{ - "VIA Apollo MVP3", - "via_mvp3", - DEVICE_PCI, - VIA_598, /*VT82C598MVP*/ - via_apollo_init, - via_apollo_close, - via_apollo_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t via_mvp3_device = { + .name = "VIA Apollo MVP3", + .internal_name = "via_mvp3", + .flags = DEVICE_PCI, + .local = VIA_598, /*VT82C598MVP*/ + .init = via_apollo_init, + .close = via_apollo_close, + .reset = via_apollo_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t via_apro_device = { - "VIA Apollo Pro", - "via_apro", - DEVICE_PCI, - VIA_691, /*VT82C691*/ - via_apollo_init, - via_apollo_close, - via_apollo_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "VIA Apollo Pro", + .internal_name = "via_apro", + .flags = DEVICE_PCI, + .local = VIA_691, /*VT82C691*/ + .init = via_apollo_init, + .close = via_apollo_close, + .reset = via_apollo_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t via_apro133_device = { - "VIA Apollo Pro133", - "via_apro133", - DEVICE_PCI, - VIA_693A, /*VT82C693A*/ - via_apollo_init, - via_apollo_close, - via_apollo_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "VIA Apollo Pro133", + .internal_name = "via_apro133", + .flags = DEVICE_PCI, + .local = VIA_693A, /*VT82C693A*/ + .init = via_apollo_init, + .close = via_apollo_close, + .reset = via_apollo_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t via_apro133a_device = { - "VIA Apollo Pro133A", - "via_apro_133a", - DEVICE_PCI, - VIA_694, /*VT82C694X*/ - via_apollo_init, - via_apollo_close, - via_apollo_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "VIA Apollo Pro133A", + .internal_name = "via_apro_133a", + .flags = DEVICE_PCI, + .local = VIA_694, /*VT82C694X*/ + .init = via_apollo_init, + .close = via_apollo_close, + .reset = via_apollo_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t via_vt8601_device = { - "VIA Apollo ProMedia", - "via_vt8601", - DEVICE_PCI, - VIA_8601, /*VT8601*/ - via_apollo_init, - via_apollo_close, - via_apollo_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "VIA Apollo ProMedia", + .internal_name = "via_vt8601", + .flags = DEVICE_PCI, + .local = VIA_8601, /*VT8601*/ + .init = via_apollo_init, + .close = via_apollo_close, + .reset = via_apollo_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/via_pipc.c b/src/chipset/via_pipc.c index b985b2ba8..076328a00 100644 --- a/src/chipset/via_pipc.c +++ b/src/chipset/via_pipc.c @@ -1631,97 +1631,86 @@ pipc_close(void *p) free(dev); } - -const device_t via_vt82c586b_device = -{ - "VIA VT82C586B", - "via_vt82c586b", - DEVICE_PCI, - VIA_PIPC_586B, - pipc_init, - pipc_close, - pipc_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t via_vt82c586b_device = { + .name = "VIA VT82C586B", + .internal_name = "via_vt82c586b", + .flags = DEVICE_PCI, + .local = VIA_PIPC_586B, + .init = pipc_init, + .close = pipc_close, + .reset = pipc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t via_vt82c596a_device = -{ - "VIA VT82C596A", - "via_vt82c596a", - DEVICE_PCI, - VIA_PIPC_596A, - pipc_init, - pipc_close, - pipc_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t via_vt82c596a_device = { + .name = "VIA VT82C596A", + .internal_name = "via_vt82c596a", + .flags = DEVICE_PCI, + .local = VIA_PIPC_596A, + .init = pipc_init, + .close = pipc_close, + .reset = pipc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t via_vt82c596b_device = -{ - "VIA VT82C596B", - "via_vt82c596b", - DEVICE_PCI, - VIA_PIPC_596B, - pipc_init, - pipc_close, - pipc_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t via_vt82c596b_device = { + .name = "VIA VT82C596B", + .internal_name = "via_vt82c596b", + .flags = DEVICE_PCI, + .local = VIA_PIPC_596B, + .init = pipc_init, + .close = pipc_close, + .reset = pipc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t via_vt82c686a_device = -{ - "VIA VT82C686A", - "via_vt82c686a", - DEVICE_PCI, - VIA_PIPC_686A, - pipc_init, - pipc_close, - pipc_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t via_vt82c686a_device = { + .name = "VIA VT82C686A", + .internal_name = "via_vt82c686a", + .flags = DEVICE_PCI, + .local = VIA_PIPC_686A, + .init = pipc_init, + .close = pipc_close, + .reset = pipc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t via_vt82c686b_device = -{ - "VIA VT82C686B", - "via_vt82c686b", - DEVICE_PCI, - VIA_PIPC_686B, - pipc_init, - pipc_close, - pipc_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t via_vt82c686b_device = { + .name = "VIA VT82C686B", + .internal_name = "via_vt82c686b", + .flags = DEVICE_PCI, + .local = VIA_PIPC_686B, + .init = pipc_init, + .close = pipc_close, + .reset = pipc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t via_vt8231_device = -{ - "VIA VT8231", - "via_vt8231", - DEVICE_PCI, - VIA_PIPC_8231, - pipc_init, - pipc_close, - pipc_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t via_vt8231_device = { + .name = "VIA VT8231", + .internal_name = "via_vt8231", + .flags = DEVICE_PCI, + .local = VIA_PIPC_8231, + .init = pipc_init, + .close = pipc_close, + .reset = pipc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/via_vt82c49x.c b/src/chipset/via_vt82c49x.c index 80a00e606..7efa76d01 100644 --- a/src/chipset/via_vt82c49x.c +++ b/src/chipset/via_vt82c49x.c @@ -358,46 +358,58 @@ vt82c49x_init(const device_t *info) return dev; } - const device_t via_vt82c49x_device = { - "VIA VT82C49X", - "via_vt82c49x", - 0, - 0, - vt82c49x_init, vt82c49x_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "VIA VT82C49X", + .internal_name = "via_vt82c49x", + .flags = 0, + .local = 0, + .init = vt82c49x_init, + .close = vt82c49x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t via_vt82c49x_pci_device = { - "VIA VT82C49X PCI", - "via_vt82c49x_pci", - DEVICE_PCI, - 0, - vt82c49x_init, vt82c49x_close, vt82c49x_reset, - { NULL }, NULL, NULL, - NULL + .name = "VIA VT82C49X PCI", + .internal_name = "via_vt82c49x_pci", + .flags = DEVICE_PCI, + .local = 0, + .init = vt82c49x_init, + .close = vt82c49x_close, + .reset = vt82c49x_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t via_vt82c49x_ide_device = { - "VIA VT82C49X (With IDE)", - "via_vt82c49x_ide", - 0, - 1, - vt82c49x_init, vt82c49x_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "VIA VT82C49X (With IDE)", + .internal_name = "via_vt82c49x_ide", + .flags = 0, + .local = 1, + .init = vt82c49x_init, + .close = vt82c49x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t via_vt82c49x_pci_ide_device = { - "VIA VT82C49X PCI (With IDE)", - "via_vt82c49x_pci_ide", - DEVICE_PCI, - 1, - vt82c49x_init, vt82c49x_close, vt82c49x_reset, - { NULL }, NULL, NULL, - NULL + .name = "VIA VT82C49X PCI (With IDE)", + .internal_name = "via_vt82c49x_pci_ide", + .flags = DEVICE_PCI, + .local = 1, + .init = vt82c49x_init, + .close = vt82c49x_close, + .reset = vt82c49x_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/via_vt82c505.c b/src/chipset/via_vt82c505.c index 6dea85d80..5ce799ab6 100644 --- a/src/chipset/via_vt82c505.c +++ b/src/chipset/via_vt82c505.c @@ -216,17 +216,16 @@ vt82c505_init(const device_t *info) return dev; } - const device_t via_vt82c505_device = { - "VIA VT82C505", - "via_vt82c505", - DEVICE_PCI, - 0, - vt82c505_init, - vt82c505_close, - vt82c505_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "VIA VT82C505", + .internal_name = "via_vt82c505", + .flags = DEVICE_PCI, + .local = 0, + .init = vt82c505_init, + .close = vt82c505_close, + .reset = vt82c505_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/vl82c480.c b/src/chipset/vl82c480.c index 455e8bf16..ec4703399 100644 --- a/src/chipset/vl82c480.c +++ b/src/chipset/vl82c480.c @@ -188,24 +188,30 @@ vl82c480_init(const device_t *info) return dev; } - const device_t vl82c480_device = { - "VLSI VL82c480", - "vl82c480", - 0, - 0x90, - vl82c480_init, vl82c480_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "VLSI VL82c480", + .internal_name = "vl82c480", + .flags = 0, + .local = 0x90, + .init = vl82c480_init, + .close = vl82c480_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t vl82c486_device = { - "VLSI VL82c486", - "vl82c486", - 0, - 0x98, - vl82c480_init, vl82c480_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "VLSI VL82c486", + .internal_name = "vl82c486", + .flags = 0, + .local = 0x98, + .init = vl82c480_init, + .close = vl82c480_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/chipset/wd76c10.c b/src/chipset/wd76c10.c index 82e5d57d5..138349955 100644 --- a/src/chipset/wd76c10.c +++ b/src/chipset/wd76c10.c @@ -172,7 +172,7 @@ static void wd76c10_disk_chip_select(wd76c10_t *dev) fdc_remove(dev->fdc_controller); if (!(dev->disk_chip_select & 2)) - fdc_set_base(dev->fdc_controller, !(dev->disk_chip_select & 0x0010) ? 0x3f0 : 0x370); + fdc_set_base(dev->fdc_controller, !(dev->disk_chip_select & 0x0010) ? FDC_PRIMARY_ADDR : FDC_SECONDARY_ADDR); } static void wd76c10_shadow_recalc(wd76c10_t *dev) @@ -538,14 +538,15 @@ wd76c10_init(const device_t *info) } const device_t wd76c10_device = { - "Western Digital WD76C10", - "wd76c10", - 0, - 0, - wd76c10_init, - wd76c10_close, - NULL, - {NULL}, - NULL, - NULL, - NULL}; + .name = "Western Digital WD76C10", + .internal_name = "wd76c10", + .flags = 0, + .local = 0, + .init = wd76c10_init, + .close = wd76c10_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; diff --git a/src/codegen/codegen_x86-64.c b/src/codegen/codegen_x86-64.c index a1d4ba07c..0559cc06d 100644 --- a/src/codegen/codegen_x86-64.c +++ b/src/codegen/codegen_x86-64.c @@ -21,7 +21,7 @@ #include "codegen_ops.h" #include "codegen_ops_x86-64.h" -#if defined(__unix__) || defined(__APPLE__) +#if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__) #include #include #endif @@ -66,7 +66,7 @@ void codegen_init() #if _WIN64 codeblock = VirtualAlloc(NULL, BLOCK_SIZE * sizeof(codeblock_t), MEM_COMMIT, PAGE_EXECUTE_READWRITE); -#elif defined(__unix__) || defined(__APPLE__) +#elif defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__) codeblock = mmap(NULL, BLOCK_SIZE * sizeof(codeblock_t), PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0); #else codeblock = malloc(BLOCK_SIZE * sizeof(codeblock_t)); diff --git a/src/codegen_new/codegen_allocator.c b/src/codegen_new/codegen_allocator.c index e85271fef..baeea52b6 100644 --- a/src/codegen_new/codegen_allocator.c +++ b/src/codegen_new/codegen_allocator.c @@ -1,4 +1,4 @@ -#if defined(__linux__) || defined(__APPLE__) +#if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__) #include #include #include diff --git a/src/config.c b/src/config.c index ccd949278..4dbbb4a21 100644 --- a/src/config.c +++ b/src/config.c @@ -300,6 +300,27 @@ config_detect_bom(char *fn) return 0; } +#ifdef __HAIKU__ +/* Local version of fgetws to avoid a crash */ +static wchar_t* +config_fgetws(wchar_t *str, int count, FILE* stream) +{ + int i = 0; + if (feof(stream)) return NULL; + for (i = 0; i < count; i++) { + wint_t curChar = fgetwc(stream); + if (curChar == WEOF) { + if (i + 1 < count) str[i + 1] = 0; + return feof(stream) ? str : NULL; + } + str[i] = curChar; + if (curChar == '\n') break; + } + if (i + 1 < count) str[i + 1] = 0; + return str; +} +#endif + /* Read and parse the configuration file into memory. */ static int config_read(char *fn) @@ -328,7 +349,11 @@ config_read(char *fn) while (1) { memset(buff, 0x00, sizeof(buff)); +#ifdef __HAIKU__ + config_fgetws(buff, sizeof_w(buff), f); +#else fgetws(buff, sizeof_w(buff), f); +#endif if (feof(f)) break; /* Make sure there are no stray newlines or hard-returns in there. */ @@ -1011,9 +1036,9 @@ load_sound(void) p = config_get_string(cat, "midi_device", NULL); if (p != NULL) - midi_device_current = midi_device_get_from_internal_name(p); + midi_output_device_current = midi_out_device_get_from_internal_name(p); else - midi_device_current = 0; + midi_output_device_current = 0; p = config_get_string(cat, "midi_in_device", NULL); if (p != NULL) @@ -2081,13 +2106,17 @@ config_load(void) video_fullscreen_first = 1; time_sync = TIME_SYNC_ENABLED; hdc_current = hdc_get_from_internal_name("none"); + serial_enabled[0] = 1; serial_enabled[1] = 1; - serial_enabled[2] = 0; - serial_enabled[3] = 0; + for (i = 2 ; i < SERIAL_MAX; i++) + serial_enabled[i] = 0; + lpt_ports[0].enabled = 1; - lpt_ports[1].enabled = 0; - lpt_ports[2].enabled = 0; + + for (i = 1 ; i < PARALLEL_MAX; i++) + lpt_ports[i].enabled = 0; + for (i = 0; i < FDD_NUM; i++) { if (i < 2) fdd_set_type(i, 2); @@ -2501,10 +2530,10 @@ save_sound(void) else config_set_string(cat, "sndcard", sound_card_get_internal_name(sound_card_current)); - if (!strcmp(midi_device_get_internal_name(midi_device_current), "none")) + if (!strcmp(midi_out_device_get_internal_name(midi_output_device_current), "none")) config_delete_var(cat, "midi_device"); else - config_set_string(cat, "midi_device", midi_device_get_internal_name(midi_device_current)); + config_set_string(cat, "midi_device", midi_out_device_get_internal_name(midi_output_device_current)); if (!strcmp(midi_in_device_get_internal_name(midi_input_device_current), "none")) config_delete_var(cat, "midi_in_device"); diff --git a/src/ddma.c b/src/ddma.c index c99225150..2993add52 100644 --- a/src/ddma.c +++ b/src/ddma.c @@ -184,18 +184,16 @@ ddma_init(const device_t *info) return dev; } - -const device_t ddma_device = -{ - "Distributed DMA", - "ddma", - DEVICE_PCI, - 0, - ddma_init, - ddma_close, - NULL, - { NULL }, - NULL, - NULL, - NULL +const device_t ddma_device = { + .name = "Distributed DMA", + .internal_name = "ddma", + .flags = DEVICE_PCI, + .local = 0, + .init = ddma_init, + .close = ddma_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/device/bugger.c b/src/device/bugger.c index 214f8acb8..bcea70af3 100644 --- a/src/device/bugger.c +++ b/src/device/bugger.c @@ -354,13 +354,16 @@ bug_close(UNUSED(void *priv)) bug_read, NULL, NULL, bug_write, NULL, NULL, NULL); } - const device_t bugger_device = { - "ISA/PCI Bus Bugger", - "bugger", - DEVICE_ISA | DEVICE_AT, - 0, - bug_init, bug_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "ISA/PCI Bus Bugger", + .internal_name = "bugger", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 0, + .init = bug_init, + .close = bug_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/device/cassette.c b/src/device/cassette.c index 2874971f5..211909dcb 100644 --- a/src/device/cassette.c +++ b/src/device/cassette.c @@ -714,11 +714,15 @@ cassette_init(const device_t *info) const device_t cassette_device = { - "IBM PC/PCjr Cassette Device", - "cassette", - 0, - 0, - cassette_init, cassette_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "IBM PC/PCjr Cassette Device", + .internal_name = "cassette", + .flags = 0, + .local = 0, + .init = cassette_init, + .close = cassette_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/device/hasp.c b/src/device/hasp.c index 60dae74c6..299796a6d 100644 --- a/src/device/hasp.c +++ b/src/device/hasp.c @@ -301,6 +301,7 @@ hasp_close(void *priv) const lpt_device_t lpt_hasp_savquest_device = { .name = "Protection Dongle for Savage Quest", + .internal_name = "dongle_savquest", .init = hasp_init_savquest, .close = hasp_close, .write_data = hasp_write_data, diff --git a/src/device/hwm_gl518sm.c b/src/device/hwm_gl518sm.c index 126ad182f..4afe016f2 100644 --- a/src/device/hwm_gl518sm.c +++ b/src/device/hwm_gl518sm.c @@ -296,25 +296,32 @@ gl518sm_init(const device_t *info) return dev; } - /* GL518SM on SMBus address 2Ch */ const device_t gl518sm_2c_device = { - "Genesys Logic GL518SM Hardware Monitor", - "gl518sm_2c", - DEVICE_ISA, - 0x2c, - gl518sm_init, gl518sm_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Genesys Logic GL518SM Hardware Monitor", + .internal_name = "gl518sm_2c", + .flags = DEVICE_ISA, + .local = 0x2c, + .init = gl518sm_init, + .close = gl518sm_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; /* GL518SM on SMBus address 2Dh */ const device_t gl518sm_2d_device = { - "Genesys Logic GL518SM Hardware Monitor", - "gl518sm_2d", - DEVICE_ISA, - 0x2d, - gl518sm_init, gl518sm_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Genesys Logic GL518SM Hardware Monitor", + .internal_name = "gl518sm_2d", + .flags = DEVICE_ISA, + .local = 0x2d, + .init = gl518sm_init, + .close = gl518sm_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/device/hwm_lm75.c b/src/device/hwm_lm75.c index f9bfa397b..b169d8e9e 100644 --- a/src/device/hwm_lm75.c +++ b/src/device/hwm_lm75.c @@ -243,24 +243,32 @@ lm75_init(const device_t *info) /* LM75 on SMBus address 4Ah, reporting temperatures[1]. */ const device_t lm75_1_4a_device = { - "National Semiconductor LM75 Temperature Sensor", - "lm75_1_4a", - DEVICE_ISA, - 0x14a, - lm75_init, lm75_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "National Semiconductor LM75 Temperature Sensor", + .internal_name = "lm75_1_4a", + .flags = DEVICE_ISA, + .local = 0x14a, + .init = lm75_init, + .close = lm75_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; /* LM75 secondary/tertiary temperature sensors built into the Winbond W83781D family. Not to be used stand-alone. */ const device_t lm75_w83781d_device = { - "Winbond W83781D Secondary Temperature Sensor", - "lm75_w83781d", - DEVICE_ISA, - 0, - lm75_init, lm75_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83781D Secondary Temperature Sensor", + .internal_name = "lm75_w83781d", + .flags = DEVICE_ISA, + .local = 0, + .init = lm75_init, + .close = lm75_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/device/hwm_lm78.c b/src/device/hwm_lm78.c index 87793bbac..627a0e15e 100644 --- a/src/device/hwm_lm78.c +++ b/src/device/hwm_lm78.c @@ -783,75 +783,93 @@ lm78_init(const device_t *info) return dev; } - /* National Semiconductor LM78 on ISA and SMBus. */ const device_t lm78_device = { - "National Semiconductor LM78 Hardware Monitor", - "lm78", - DEVICE_ISA, - 0x290 | LM78_I2C, - lm78_init, lm78_close, lm78_reset, - { NULL }, NULL, NULL, - NULL + .name = "National Semiconductor LM78 Hardware Monitor", + .internal_name = "lm78", + .flags = DEVICE_ISA, + .local = 0x290 | LM78_I2C, + .init = lm78_init, + .close = lm78_close, + .reset = lm78_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - /* Winbond W83781D on ISA and SMBus. */ const device_t w83781d_device = { - "Winbond W83781D Hardware Monitor", - "w83781d", - DEVICE_ISA, - 0x290 | LM78_I2C | LM78_W83781D, - lm78_init, lm78_close, lm78_reset, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83781D Hardware Monitor", + .internal_name = "w83781d", + .flags = DEVICE_ISA, + .local = 0x290 | LM78_I2C | LM78_W83781D, + .init = lm78_init, + .close = lm78_close, + .reset = lm78_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - /* Winbond W83781D on ISA and SMBus. */ const device_t w83781d_p5a_device = { - "Winbond W83781D Hardware Monitor (ASUS P5A)", - "w83781d_p5a", - DEVICE_ISA, - 0x290 | LM78_I2C | LM78_W83781D | LM78_P5A, - lm78_init, lm78_close, lm78_reset, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83781D Hardware Monitor (ASUS P5A)", + .internal_name = "w83781d_p5a", + .flags = DEVICE_ISA, + .local = 0x290 | LM78_I2C | LM78_W83781D | LM78_P5A, + .init = lm78_init, + .close = lm78_close, + .reset = lm78_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - /* The AS99127F is an ASIC manufactured by Holtek for ASUS, containing an I2C-only W83781D clone with additional voltages, GPIOs and fan control. */ const device_t as99127f_device = { - "ASUS AS99127F Rev. 1 Hardware Monitor", - "as99137f", - DEVICE_ISA, - LM78_I2C | LM78_AS99127F_REV1, - lm78_init, lm78_close, lm78_reset, - { NULL }, NULL, NULL, - NULL + .name = "ASUS AS99127F Rev. 1 Hardware Monitor", + .internal_name = "as99137f", + .flags = DEVICE_ISA, + .local = LM78_I2C | LM78_AS99127F_REV1, + .init = lm78_init, + .close = lm78_close, + .reset = lm78_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - /* Rev. 2 is manufactured by Winbond and differs only in GPI registers. */ const device_t as99127f_rev2_device = { - "ASUS AS99127F Rev. 2 Hardware Monitor", - "as99127f_rev2", - DEVICE_ISA, - LM78_I2C | LM78_AS99127F_REV2, - lm78_init, lm78_close, lm78_reset, - { NULL }, NULL, NULL, - NULL + .name = "ASUS AS99127F Rev. 2 Hardware Monitor", + .internal_name = "as99127f_rev2", + .flags = DEVICE_ISA, + .local = LM78_I2C | LM78_AS99127F_REV2, + .init = lm78_init, + .close = lm78_close, + .reset = lm78_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - /* Winbond W83782D on ISA and SMBus. */ const device_t w83782d_device = { - "Winbond W83782D Hardware Monitor", - "w83783d", - DEVICE_ISA, - 0x290 | LM78_I2C | LM78_W83782D, - lm78_init, lm78_close, lm78_reset, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83782D Hardware Monitor", + .internal_name = "w83783d", + .flags = DEVICE_ISA, + .local = 0x290 | LM78_I2C | LM78_W83782D, + .init = lm78_init, + .close = lm78_close, + .reset = lm78_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/device/hwm_vt82c686.c b/src/device/hwm_vt82c686.c index d2a1d00dc..83e67b66e 100644 --- a/src/device/hwm_vt82c686.c +++ b/src/device/hwm_vt82c686.c @@ -204,13 +204,16 @@ vt82c686_init(const device_t *info) return dev; } - const device_t via_vt82c686_hwm_device = { - "VIA VT82C686 Integrated Hardware Monitor", - "via_vt82c686_hwm", - DEVICE_ISA, - 0, - vt82c686_init, vt82c686_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "VIA VT82C686 Integrated Hardware Monitor", + .internal_name = "via_vt82c686_hwm", + .flags = DEVICE_ISA, + .local = 0, + .init = vt82c686_init, + .close = vt82c686_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/device/ibm_5161.c b/src/device/ibm_5161.c index d18b93cc2..3da5a2797 100644 --- a/src/device/ibm_5161.c +++ b/src/device/ibm_5161.c @@ -111,18 +111,16 @@ ibm_5161_init(const device_t *info) return dev; } - -const device_t ibm_5161_device = -{ - "IBM Expansion Unit (5161)", - "ibm_5161", - DEVICE_ISA, - 0, - ibm_5161_init, - ibm_5161_close, - NULL, - { NULL }, - NULL, - NULL, - NULL +const device_t ibm_5161_device = { + .name = "IBM Expansion Unit (5161)", + .internal_name = "ibm_5161", + .flags = DEVICE_ISA, + .local = 0, + .init = ibm_5161_init, + .close = ibm_5161_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/device/isamem.c b/src/device/isamem.c index 9b1ee7090..063595197 100644 --- a/src/device/isamem.c +++ b/src/device/isamem.c @@ -693,13 +693,17 @@ static const device_config_t ibmxt_config[] = { }; static const device_t ibmxt_device = { - "IBM PC/XT Memory Expansion", - "ibmxt", - DEVICE_ISA, - ISAMEM_IBMXT_CARD, - isamem_init, isamem_close, NULL, - { NULL }, NULL, NULL, - ibmxt_config + .name = "IBM PC/XT Memory Expansion", + .internal_name = "ibmxt", + .flags = DEVICE_ISA, + .local = ISAMEM_IBMXT_CARD, + .init = isamem_init, + .close = isamem_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ibmxt_config }; static const device_config_t genericxt_config[] = { @@ -719,16 +723,19 @@ static const device_config_t genericxt_config[] = { }; static const device_t genericxt_device = { - "Generic PC/XT Memory Expansion", - "genericxt", - DEVICE_ISA, - ISAMEM_GENXT_CARD, - isamem_init, isamem_close, NULL, - { NULL }, NULL, NULL, - genericxt_config + .name = "Generic PC/XT Memory Expansion", + .internal_name = "genericxt", + .flags = DEVICE_ISA, + .local = ISAMEM_GENXT_CARD, + .init = isamem_init, + .close = isamem_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = genericxt_config }; - static const device_config_t ibmat_config[] = { // clang-format off { @@ -746,16 +753,19 @@ static const device_config_t ibmat_config[] = { }; static const device_t ibmat_device = { - "IBM PC/AT Memory Expansion", - "ibmat", - DEVICE_ISA, - ISAMEM_IBMAT_CARD, - isamem_init, isamem_close, NULL, - { NULL }, NULL, NULL, - ibmat_config + .name = "IBM PC/AT Memory Expansion", + .internal_name = "ibmat", + .flags = DEVICE_ISA, + .local = ISAMEM_IBMAT_CARD, + .init = isamem_init, + .close = isamem_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ibmat_config }; - static const device_config_t genericat_config[] = { // clang-format off { @@ -773,16 +783,19 @@ static const device_config_t genericat_config[] = { }; static const device_t genericat_device = { - "Generic PC/AT Memory Expansion", - "genericat", - DEVICE_ISA, - ISAMEM_GENAT_CARD, - isamem_init, isamem_close, NULL, - { NULL }, NULL, NULL, - genericat_config + .name = "Generic PC/AT Memory Expansion", + .internal_name = "genericat", + .flags = DEVICE_ISA, + .local = ISAMEM_GENAT_CARD, + .init = isamem_init, + .close = isamem_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = genericat_config }; - static const device_config_t p5pak_config[] = { // clang-format off { @@ -800,13 +813,17 @@ static const device_config_t p5pak_config[] = { }; static const device_t p5pak_device = { - "Paradise Systems 5-PAK", - "p5pak", - DEVICE_ISA, - ISAMEM_P5PAK_CARD, - isamem_init, isamem_close, NULL, - { NULL }, NULL, NULL, - p5pak_config + .name = "Paradise Systems 5-PAK", + .internal_name = "p5pak", + .flags = DEVICE_ISA, + .local = ISAMEM_P5PAK_CARD, + .init = isamem_init, + .close = isamem_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = p5pak_config }; @@ -827,16 +844,19 @@ static const device_config_t a6pak_config[] = { }; static const device_t a6pak_device = { - "AST SixPakPlus", - "a6pak", - DEVICE_ISA, - ISAMEM_A6PAK_CARD, - isamem_init, isamem_close, NULL, - { NULL }, NULL, NULL, - a6pak_config + .name = "AST SixPakPlus", + .internal_name = "a6pak", + .flags = DEVICE_ISA, + .local = ISAMEM_A6PAK_CARD, + .init = isamem_init, + .close = isamem_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = a6pak_config }; - static const device_config_t ems5150_config[] = { // clang-format off { @@ -860,13 +880,17 @@ static const device_config_t ems5150_config[] = { }; static const device_t ems5150_device = { - "Micro Mainframe EMS-5150(T)", - "ems5150", - DEVICE_ISA, - ISAMEM_EMS5150_CARD, - isamem_init, isamem_close, NULL, - { NULL }, NULL, NULL, - ems5150_config + .name = "Micro Mainframe EMS-5150(T)", + .internal_name = "ems5150", + .flags = DEVICE_ISA, + .local = ISAMEM_EMS5150_CARD, + .init = isamem_init, + .close = isamem_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ems5150_config }; static const device_config_t ev159_config[] = { @@ -928,13 +952,17 @@ static const device_config_t ev159_config[] = { }; static const device_t ev159_device = { - "Everex EV-159 RAM 3000 Deluxe", - "ev159", - DEVICE_ISA, - ISAMEM_EV159_CARD, - isamem_init, isamem_close, NULL, - { NULL }, NULL, NULL, - ev159_config + .name = "Everex EV-159 RAM 3000 Deluxe", + .internal_name = "ev159", + .flags = DEVICE_ISA, + .local = ISAMEM_EV159_CARD, + .init = isamem_init, + .close = isamem_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ev159_config }; #if defined(DEV_BRANCH) && defined(USE_ISAMEM_BRAT) @@ -986,13 +1014,17 @@ static const device_config_t brat_config[] = { }; static const device_t brat_device = { - "BocaRAM/AT", - "brat", - DEVICE_ISA, - ISAMEM_BRAT_CARD, - isamem_init, isamem_close, NULL, - { NULL }, NULL, NULL, - brat_config + .name = "BocaRAM/AT", + .internal_name = "brat", + .flags = DEVICE_ISA, + .local = ISAMEM_BRAT_CARD, + .init = isamem_init, + .close = isamem_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = brat_config }; #endif @@ -1048,17 +1080,20 @@ static const device_config_t rampage_config[] = { }; static const device_t rampage_device = { - "AST RAMpage/XT", - "rampage", - DEVICE_ISA, - ISAMEM_RAMPAGEXT_CARD, - isamem_init, isamem_close, NULL, - { NULL }, NULL, NULL, - rampage_config + .name = "AST RAMpage/XT", + .internal_name = "rampage", + .flags = DEVICE_ISA, + .local = ISAMEM_RAMPAGEXT_CARD, + .init = isamem_init, + .close = isamem_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = rampage_config }; #endif - #if defined(DEV_BRANCH) && defined(USE_ISAMEM_IAB) static const device_config_t iab_config[] = { // clang-format off @@ -1111,23 +1146,32 @@ static const device_config_t iab_config[] = { }; static const device_t iab_device = { - "Intel AboveBoard", - "iab", - DEVICE_ISA, - ISAMEM_ABOVEBOARD_CARD, - isamem_init, isamem_close, NULL, - { NULL }, NULL, NULL, - iab_config + .name = "Intel AboveBoard", + .internal_name = "iab", + .flags = DEVICE_ISA, + .local = ISAMEM_ABOVEBOARD_CARD, + .init = isamem_init, + .close = isamem_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = iab_config }; #endif static const device_t isa_none_device = { - "None", - "none", - 0, 0, - NULL, NULL, NULL, - { NULL }, NULL, NULL, - NULL + .name = "None", + .internal_name = "none", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; static const struct { diff --git a/src/device/isartc.c b/src/device/isartc.c index 6acf01f0c..dc9557e3e 100644 --- a/src/device/isartc.c +++ b/src/device/isartc.c @@ -592,7 +592,6 @@ isartc_close(void *priv) free(dev); } - static const device_config_t ev170_config[] = { // clang-format off { @@ -618,16 +617,19 @@ static const device_config_t ev170_config[] = { }; static const device_t ev170_device = { - "Everex EV-170 Magic I/O", - "ev170", - DEVICE_ISA, - ISARTC_EV170, - isartc_init, isartc_close, NULL, - { NULL }, NULL, NULL, - ev170_config + .name = "Everex EV-170 Magic I/O", + .internal_name = "ev170", + .flags = DEVICE_ISA, + .local = ISARTC_EV170, + .init = isartc_init, + .close = isartc_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ev170_config }; - static const device_config_t pii147_config[] = { // clang-format off { @@ -643,16 +645,19 @@ static const device_config_t pii147_config[] = { }; static const device_t pii147_device = { - "DTK PII-147 Hexa I/O Plus", - "pii147", - DEVICE_ISA, - ISARTC_DTK, - isartc_init, isartc_close, NULL, - { NULL }, NULL, NULL, - pii147_config + .name = "DTK PII-147 Hexa I/O Plus", + .internal_name = "pii147", + .flags = DEVICE_ISA, + .local = ISARTC_DTK, + .init = isartc_init, + .close = isartc_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = pii147_config }; - static const device_config_t p5pak_config[] = { // clang-format off { @@ -670,16 +675,19 @@ static const device_config_t p5pak_config[] = { }; static const device_t p5pak_device = { - "Paradise Systems 5-PAK", - "p5pak", - DEVICE_ISA, - ISARTC_P5PAK, - isartc_init, isartc_close, NULL, - { NULL }, NULL, NULL, - p5pak_config + .name = "Paradise Systems 5-PAK", + .internal_name = "p5pak", + .flags = DEVICE_ISA, + .local = ISARTC_P5PAK, + .init = isartc_init, + .close = isartc_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = p5pak_config }; - static const device_config_t a6pak_config[] = { // clang-format off { @@ -697,22 +705,31 @@ static const device_config_t a6pak_config[] = { }; static const device_t a6pak_device = { - "AST SixPakPlus", - "a6pak", - DEVICE_ISA, - ISARTC_A6PAK, - isartc_init, isartc_close, NULL, - { NULL }, NULL, NULL, - a6pak_config + .name = "AST SixPakPlus", + .internal_name = "a6pak", + .flags = DEVICE_ISA, + .local = ISARTC_A6PAK, + .init = isartc_init, + .close = isartc_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = a6pak_config }; static const device_t isartc_none_device = { - "None", - "none", - 0, 0, - NULL, NULL, NULL, - { NULL }, NULL, NULL, - NULL + .name = "None", + .internal_name = "none", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; static const struct { diff --git a/src/device/keyboard_at.c b/src/device/keyboard_at.c index 7d35a4046..087fa2b96 100644 --- a/src/device/keyboard_at.c +++ b/src/device/keyboard_at.c @@ -2340,228 +2340,286 @@ kbd_init(const device_t *info) return(dev); } - const device_t keyboard_at_device = { - "PC/AT Keyboard", - "keyboard_at", - 0, - KBC_TYPE_ISA | KBC_VEN_GENERIC, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PC/AT Keyboard", + .internal_name = "keyboard_at", + .flags = 0, + .local = KBC_TYPE_ISA | KBC_VEN_GENERIC, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_at_ami_device = { - "PC/AT Keyboard (AMI)", - "keyboard_at_ami", - 0, - KBC_TYPE_ISA | KBC_VEN_AMI, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PC/AT Keyboard (AMI)", + .internal_name = "keyboard_at_ami", + .flags = 0, + .local = KBC_TYPE_ISA | KBC_VEN_AMI, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_at_samsung_device = { - "PC/AT Keyboard (Samsung)", - "keyboard_at_samsung", - 0, - KBC_TYPE_ISA | KBC_VEN_SAMSUNG, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PC/AT Keyboard (Samsung)", + .internal_name = "keyboard_at_samsung", + .flags = 0, + .local = KBC_TYPE_ISA | KBC_VEN_SAMSUNG, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_at_toshiba_device = { - "PC/AT Keyboard (Toshiba)", - "keyboard_at_toshiba", - 0, - KBC_TYPE_ISA | KBC_VEN_TOSHIBA, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PC/AT Keyboard (Toshiba)", + .internal_name = "keyboard_at_toshiba", + .flags = 0, + .local = KBC_TYPE_ISA | KBC_VEN_TOSHIBA, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_at_olivetti_device = { - "PC/AT Keyboard (Olivetti)", - "keyboard_at_olivetti", - 0, - KBC_TYPE_ISA | KBC_VEN_OLIVETTI, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PC/AT Keyboard (Olivetti)", + .internal_name = "keyboard_at_olivetti", + .flags = 0, + .local = KBC_TYPE_ISA | KBC_VEN_OLIVETTI, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_at_ncr_device = { - "PC/AT Keyboard (NCR)", - "keyboard_at_ncr", - 0, - KBC_TYPE_ISA | KBC_VEN_NCR, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PC/AT Keyboard (NCR)", + .internal_name = "keyboard_at_ncr", + .flags = 0, + .local = KBC_TYPE_ISA | KBC_VEN_NCR, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_ps2_device = { - "PS/2 Keyboard", - "keyboard_ps2", - 0, - KBC_TYPE_PS2_NOREF | KBC_VEN_GENERIC, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PS/2 Keyboard", + .internal_name = "keyboard_ps2", + .flags = 0, + .local = KBC_TYPE_PS2_NOREF | KBC_VEN_GENERIC, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_ps2_ps2_device = { - "PS/2 Keyboard", - "keyboard_ps2_ps2", - 0, - KBC_TYPE_PS2_1 | KBC_VEN_GENERIC, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PS/2 Keyboard", + .internal_name = "keyboard_ps2_ps2", + .flags = 0, + .local = KBC_TYPE_PS2_1 | KBC_VEN_GENERIC, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_ps2_ps1_device = { - "PS/2 Keyboard (IBM PS/1)", - "keyboard_ps2_ps1", - 0, - KBC_TYPE_PS2_NOREF | KBC_VEN_IBM_PS1, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PS/2 Keyboard (IBM PS/1)", + .internal_name = "keyboard_ps2_ps1", + .flags = 0, + .local = KBC_TYPE_PS2_NOREF | KBC_VEN_IBM_PS1, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_ps2_ps1_pci_device = { - "PS/2 Keyboard (IBM PS/1)", - "keyboard_ps2_ps1_pci", - DEVICE_PCI, - KBC_TYPE_PS2_NOREF | KBC_VEN_IBM_PS1, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PS/2 Keyboard (IBM PS/1)", + .internal_name = "keyboard_ps2_ps1_pci", + .flags = DEVICE_PCI, + .local = KBC_TYPE_PS2_NOREF | KBC_VEN_IBM_PS1, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_ps2_xi8088_device = { - "PS/2 Keyboard (Xi8088)", - "keyboard_ps2_xi8088", - 0, - KBC_TYPE_PS2_1 | KBC_VEN_XI8088, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PS/2 Keyboard (Xi8088)", + .internal_name = "keyboard_ps2_xi8088", + .flags = 0, + .local = KBC_TYPE_PS2_1 | KBC_VEN_XI8088, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_ps2_ami_device = { - "PS/2 Keyboard (AMI)", - "keyboard_ps2_ami", - 0, - KBC_TYPE_PS2_NOREF | KBC_VEN_AMI, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PS/2 Keyboard (AMI)", + .internal_name = "keyboard_ps2_ami", + .flags = 0, + .local = KBC_TYPE_PS2_NOREF | KBC_VEN_AMI, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_ps2_olivetti_device = { - "PS/2 Keyboard (Olivetti)", - "keyboard_ps2_olivetti", - 0, - KBC_TYPE_PS2_NOREF | KBC_VEN_OLIVETTI, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PS/2 Keyboard (Olivetti)", + .internal_name = "keyboard_ps2_olivetti", + .flags = 0, + .local = KBC_TYPE_PS2_NOREF | KBC_VEN_OLIVETTI, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_ps2_mca_device = { - "PS/2 Keyboard", - "keyboard_ps2_mca", - 0, - KBC_TYPE_PS2_1 | KBC_VEN_IBM_MCA, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PS/2 Keyboard", + .internal_name = "keyboard_ps2_mca", + .flags = 0, + .local = KBC_TYPE_PS2_1 | KBC_VEN_IBM_MCA, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_ps2_mca_2_device = { - "PS/2 Keyboard", - "keyboard_ps2_mca_2", - 0, - KBC_TYPE_PS2_2 | KBC_VEN_IBM_MCA, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PS/2 Keyboard", + .internal_name = "keyboard_ps2_mca_2", + .flags = 0, + .local = KBC_TYPE_PS2_2 | KBC_VEN_IBM_MCA, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_ps2_quadtel_device = { - "PS/2 Keyboard (Quadtel/MegaPC)", - "keyboard_ps2_quadtel", - 0, - KBC_TYPE_PS2_NOREF | KBC_VEN_QUADTEL, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PS/2 Keyboard (Quadtel/MegaPC)", + .internal_name = "keyboard_ps2_quadtel", + .flags = 0, + .local = KBC_TYPE_PS2_NOREF | KBC_VEN_QUADTEL, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_ps2_pci_device = { - "PS/2 Keyboard", - "keyboard_ps2_pci", - DEVICE_PCI, - KBC_TYPE_PS2_NOREF | KBC_VEN_GENERIC, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PS/2 Keyboard", + .internal_name = "keyboard_ps2_pci", + .flags = DEVICE_PCI, + .local = KBC_TYPE_PS2_NOREF | KBC_VEN_GENERIC, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_ps2_ami_pci_device = { - "PS/2 Keyboard (AMI)", - "keyboard_ps2_ami_pci", - DEVICE_PCI, - KBC_TYPE_PS2_NOREF | KBC_VEN_AMI, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PS/2 Keyboard (AMI)", + .internal_name = "keyboard_ps2_ami_pci", + .flags = DEVICE_PCI, + .local = KBC_TYPE_PS2_NOREF | KBC_VEN_AMI, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_ps2_intel_ami_pci_device = { - "PS/2 Keyboard (AMI)", - "keyboard_ps2_intel_ami_pci", - DEVICE_PCI, - KBC_TYPE_PS2_NOREF | KBC_VEN_INTEL_AMI, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PS/2 Keyboard (AMI)", + .internal_name = "keyboard_ps2_intel_ami_pci", + .flags = DEVICE_PCI, + .local = KBC_TYPE_PS2_NOREF | KBC_VEN_INTEL_AMI, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_ps2_acer_pci_device = { - "PS/2 Keyboard (Acer 90M002A)", - "keyboard_ps2_acer_pci", - DEVICE_PCI, - KBC_TYPE_PS2_NOREF | KBC_VEN_ACER, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL, NULL + .name = "PS/2 Keyboard (Acer 90M002A)", + .internal_name = "keyboard_ps2_acer_pci", + .flags = DEVICE_PCI, + .local = KBC_TYPE_PS2_NOREF | KBC_VEN_ACER, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - void keyboard_at_set_mouse(void (*func)(uint8_t val, void *priv), void *priv) { diff --git a/src/device/keyboard_xt.c b/src/device/keyboard_xt.c index b4e6c0e28..9b19669e2 100644 --- a/src/device/keyboard_xt.c +++ b/src/device/keyboard_xt.c @@ -871,115 +871,144 @@ kbd_close(void *priv) free(kbd); } - const device_t keyboard_pc_device = { - "IBM PC Keyboard (1981)", - "keyboard_pc", - 0, - KBD_TYPE_PC81, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL + .name = "IBM PC Keyboard (1981)", + .internal_name = "keyboard_pc", + .flags = 0, + .local = KBD_TYPE_PC81, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_pc82_device = { - "IBM PC Keyboard (1982)", - "keyboard_pc82", - 0, - KBD_TYPE_PC82, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL + .name = "IBM PC Keyboard (1982)", + .internal_name = "keyboard_pc82", + .flags = 0, + .local = KBD_TYPE_PC82, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_xt_device = { - "XT (1982) Keyboard", - "keyboard_xt", - 0, - KBD_TYPE_XT82, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL + .name = "XT (1982) Keyboard", + .internal_name = "keyboard_xt", + .flags = 0, + .local = KBD_TYPE_XT82, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_xt86_device = { - "XT (1986) Keyboard", - "keyboard_xt86", - 0, - KBD_TYPE_XT86, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL + .name = "XT (1986) Keyboard", + .internal_name = "keyboard_xt86", + .flags = 0, + .local = KBD_TYPE_XT86, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_xt_compaq_device = { - "Compaq Portable Keyboard", - "keyboard_xt_compaq", - 0, - KBD_TYPE_COMPAQ, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL + .name = "Compaq Portable Keyboard", + .internal_name = "keyboard_xt_compaq", + .flags = 0, + .local = KBD_TYPE_COMPAQ, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_tandy_device = { - "Tandy 1000 Keyboard", - "keyboard_tandy", - 0, - KBD_TYPE_TANDY, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL + .name = "Tandy 1000 Keyboard", + .internal_name = "keyboard_tandy", + .flags = 0, + .local = KBD_TYPE_TANDY, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_xt_t1x00_device = { - "Toshiba T1x00 Keyboard", - "keyboard_xt_t1x00", - 0, - KBD_TYPE_TOSHIBA, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL + .name = "Toshiba T1x00 Keyboard", + .internal_name = "keyboard_xt_t1x00", + .flags = 0, + .local = KBD_TYPE_TOSHIBA, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; #if defined(DEV_BRANCH) && defined(USE_LASERXT) const device_t keyboard_xt_lxt3_device = { - "VTech Laser XT3 Keyboard", - "keyboard_xt_lxt3", - 0, - KBD_TYPE_VTECH, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL + .name = "VTech Laser XT3 Keyboard", + .internal_name = "keyboard_xt_lxt3", + .flags = 0, + .local = KBD_TYPE_VTECH, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; #endif const device_t keyboard_xt_olivetti_device = { - "Olivetti XT Keyboard", - "keyboard_xt_olivetti", - 0, - KBD_TYPE_OLIVETTI, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL + .name = "Olivetti XT Keyboard", + .internal_name = "keyboard_xt_olivetti", + .flags = 0, + .local = KBD_TYPE_OLIVETTI, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t keyboard_xt_zenith_device = { - "Zenith XT Keyboard", - "keyboard_xt_zenith", - 0, - KBD_TYPE_ZENITH, - kbd_init, - kbd_close, - kbd_reset, - { NULL }, NULL, NULL + .name = "Zenith XT Keyboard", + .internal_name = "keyboard_xt_zenith", + .flags = 0, + .local = KBD_TYPE_ZENITH, + .init = kbd_init, + .close = kbd_close, + .reset = kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/device/mouse.c b/src/device/mouse.c index 295f0b8fb..4fc9b5378 100644 --- a/src/device/mouse.c +++ b/src/device/mouse.c @@ -41,24 +41,33 @@ int mouse_x, mouse_z, mouse_buttons; - static const device_t mouse_none_device = { - "None", - "none", - 0, MOUSE_TYPE_NONE, - NULL, NULL, NULL, - { NULL }, NULL, NULL, - NULL -}; -static const device_t mouse_internal_device = { - "Internal", - "internal", - 0, MOUSE_TYPE_INTERNAL, - NULL, NULL, NULL, - { NULL }, NULL, NULL, - NULL + .name = "None", + .internal_name = "none", + .flags = 0, + .local = MOUSE_TYPE_NONE, + .init = NULL, + .close = NULL, + .reset = NULL, + { .poll = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; +static const device_t mouse_internal_device = { + .name = "Internal", + .internal_name = "internal", + .flags = 0, + .local = MOUSE_TYPE_INTERNAL, + .init = NULL, + .close = NULL, + .reset = NULL, + { .poll = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; static mouse_t mouse_devices[] = { // clang-format off diff --git a/src/device/mouse_bus.c b/src/device/mouse_bus.c index de2183b4d..f201c4f1f 100644 --- a/src/device/mouse_bus.c +++ b/src/device/mouse_bus.c @@ -765,30 +765,43 @@ static const device_config_t ms_config[] = { }; const device_t mouse_logibus_device = { - "Logitech/Microsoft Bus Mouse", - "logibus", - DEVICE_ISA, - MOUSE_TYPE_LOGIBUS, - bm_init, bm_close, NULL, - { .poll = bm_poll }, NULL, NULL, - lt_config + .name = "Logitech/Microsoft Bus Mouse", + .internal_name = "logibus", + .flags = DEVICE_ISA, + .local = MOUSE_TYPE_LOGIBUS, + .init = bm_init, + .close = bm_close, + .reset = NULL, + { .poll = bm_poll }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = lt_config }; const device_t mouse_logibus_onboard_device = { - "Logitech Bus Mouse (On-Board)", - "logibus_onboard", - DEVICE_ISA, - MOUSE_TYPE_LOGIBUS | MOUSE_TYPE_ONBOARD, - bm_init, bm_close, NULL, - { .poll = bm_poll }, NULL, NULL + .name = "Logitech Bus Mouse (On-Board)", + .internal_name = "logibus_onboard", + .flags = DEVICE_ISA, + .local = MOUSE_TYPE_LOGIBUS | MOUSE_TYPE_ONBOARD, + .init = bm_init, + .close = bm_close, + .reset = NULL, + { .poll = bm_poll }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t mouse_msinport_device = { - "Microsoft Bus Mouse (InPort)", - "msbus", - DEVICE_ISA, - MOUSE_TYPE_INPORT, - bm_init, bm_close, NULL, - { .poll = bm_poll }, NULL, NULL, - ms_config + .name = "Microsoft Bus Mouse (InPort)", + .internal_name = "msbus", + .flags = DEVICE_ISA, + .local = MOUSE_TYPE_INPORT, + .init = bm_init, + .close = bm_close, + .reset = NULL, + { .poll = bm_poll }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ms_config }; diff --git a/src/device/mouse_ps2.c b/src/device/mouse_ps2.c index 04653661b..8757f01ee 100644 --- a/src/device/mouse_ps2.c +++ b/src/device/mouse_ps2.c @@ -329,7 +329,6 @@ ps2_close(void *priv) free(dev); } - static const device_config_t ps2_config[] = { // clang-format off { @@ -347,11 +346,15 @@ static const device_config_t ps2_config[] = { }; const device_t mouse_ps2_device = { - "Standard PS/2 Mouse", - "ps2", - DEVICE_PS2, - MOUSE_TYPE_PS2, - mouse_ps2_init, ps2_close, NULL, - { .poll = ps2_poll }, NULL, NULL, - ps2_config + .name = "Standard PS/2 Mouse", + .internal_name = "ps2", + .flags = DEVICE_PS2, + .local = MOUSE_TYPE_PS2, + .init = mouse_ps2_init, + .close = ps2_close, + .reset = NULL, + { .poll = ps2_poll }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ps2_config }; diff --git a/src/device/mouse_serial.c b/src/device/mouse_serial.c index 32365fffe..71d628558 100644 --- a/src/device/mouse_serial.c +++ b/src/device/mouse_serial.c @@ -876,31 +876,43 @@ static const device_config_t ltsermouse_config[] = { }; const device_t mouse_mssystems_device = { - "Mouse Systems Serial Mouse", - "mssystems", - 0, - MOUSE_TYPE_MSYSTEMS, - sermouse_init, sermouse_close, NULL, - { .poll = sermouse_poll }, sermouse_speed_changed, NULL, - mssermouse_config + .name = "Mouse Systems Serial Mouse", + .internal_name = "mssystems", + .flags = DEVICE_COM, + .local = MOUSE_TYPE_MSYSTEMS, + .init = sermouse_init, + .close = sermouse_close, + .reset = NULL, + { .poll = sermouse_poll }, + .speed_changed = sermouse_speed_changed, + .force_redraw = NULL, + .config = mssermouse_config }; const device_t mouse_msserial_device = { - "Microsoft Serial Mouse", - "msserial", - 0, - 0, - sermouse_init, sermouse_close, NULL, - { .poll = sermouse_poll }, sermouse_speed_changed, NULL, - mssermouse_config + .name = "Microsoft Serial Mouse", + .internal_name = "msserial", + .flags = DEVICE_COM, + .local = 0, + .init = sermouse_init, + .close = sermouse_close, + .reset = NULL, + { .poll = sermouse_poll }, + .speed_changed = sermouse_speed_changed, + .force_redraw = NULL, + .config = mssermouse_config }; const device_t mouse_ltserial_device = { - "Logitech Serial Mouse", - "ltserial", - 0, - 1, - sermouse_init, sermouse_close, NULL, - { .poll = sermouse_poll }, sermouse_speed_changed, NULL, - ltsermouse_config + .name = "Logitech Serial Mouse", + .internal_name = "ltserial", + .flags = DEVICE_COM, + .local = 1, + .init = sermouse_init, + .close = sermouse_close, + .reset = NULL, + { .poll = sermouse_poll }, + .speed_changed = sermouse_speed_changed, + .force_redraw = NULL, + .config = ltsermouse_config }; diff --git a/src/device/pci_bridge.c b/src/device/pci_bridge.c index 5cb13a1f5..a771dc6bb 100644 --- a/src/device/pci_bridge.c +++ b/src/device/pci_bridge.c @@ -497,156 +497,145 @@ pci_bridge_init(const device_t *info) return dev; } - /* PCI bridges */ -const device_t dec21150_device = -{ - "DEC 21150 PCI Bridge", - "dec21150", - DEVICE_PCI, - PCI_BRIDGE_DEC_21150, - pci_bridge_init, - NULL, - pci_bridge_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t dec21150_device = { + .name = "DEC 21150 PCI Bridge", + .internal_name = "dec21150", + .flags = DEVICE_PCI, + .local = PCI_BRIDGE_DEC_21150, + .init = pci_bridge_init, + .close = NULL, + .reset = pci_bridge_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; /* AGP bridges */ -const device_t ali5243_agp_device = -{ - "ALi M5243 AGP Bridge", - "ali5243_agp", - DEVICE_PCI, - AGP_BRIDGE_ALI_M5243, - pci_bridge_init, - NULL, - pci_bridge_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t ali5243_agp_device = { + .name = "ALi M5243 AGP Bridge", + .internal_name = "ali5243_agp", + .flags = DEVICE_PCI, + .local = AGP_BRIDGE_ALI_M5243, + .init = pci_bridge_init, + .close = NULL, + .reset = pci_bridge_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; /* AGP bridges */ -const device_t ali5247_agp_device = -{ - "ALi M5247 AGP Bridge", - "ali5247_agp", - DEVICE_PCI, - AGP_BRIDGE_ALI_M5247, - pci_bridge_init, - NULL, - pci_bridge_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t ali5247_agp_device = { + .name = "ALi M5247 AGP Bridge", + .internal_name = "ali5247_agp", + .flags = DEVICE_PCI, + .local = AGP_BRIDGE_ALI_M5247, + .init = pci_bridge_init, + .close = NULL, + .reset = pci_bridge_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t i440lx_agp_device = -{ - "Intel 82443LX/EX AGP Bridge", - "i440lx_agp", - DEVICE_PCI, - AGP_BRIDGE_INTEL_440LX, - pci_bridge_init, - NULL, - pci_bridge_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i440lx_agp_device = { + .name = "Intel 82443LX/EX AGP Bridge", + .internal_name = "i440lx_agp", + .flags = DEVICE_PCI, + .local = AGP_BRIDGE_INTEL_440LX, + .init = pci_bridge_init, + .close = NULL, + .reset = pci_bridge_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t i440bx_agp_device = -{ - "Intel 82443BX/ZX AGP Bridge", - "i440bx_agp", - DEVICE_PCI, - AGP_BRIDGE_INTEL_440BX, - pci_bridge_init, - NULL, - pci_bridge_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i440bx_agp_device = { + .name = "Intel 82443BX/ZX AGP Bridge", + .internal_name = "i440bx_agp", + .flags = DEVICE_PCI, + .local = AGP_BRIDGE_INTEL_440BX, + .init = pci_bridge_init, + .close = NULL, + .reset = pci_bridge_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t i440gx_agp_device = -{ - "Intel 82443GX AGP Bridge", - "i440gx_agp", - DEVICE_PCI, - AGP_BRIDGE_INTEL_440GX, - pci_bridge_init, - NULL, - pci_bridge_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t i440gx_agp_device = { + .name = "Intel 82443GX AGP Bridge", + .internal_name = "i440gx_agp", + .flags = DEVICE_PCI, + .local = AGP_BRIDGE_INTEL_440GX, + .init = pci_bridge_init, + .close = NULL, + .reset = pci_bridge_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t via_vp3_agp_device = -{ - "VIA Apollo VP3 AGP Bridge", - "via_vp3_agp", - DEVICE_PCI, - AGP_BRIDGE_VIA_597, - pci_bridge_init, - NULL, - pci_bridge_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t via_vp3_agp_device = { + .name = "VIA Apollo VP3 AGP Bridge", + .internal_name = "via_vp3_agp", + .flags = DEVICE_PCI, + .local = AGP_BRIDGE_VIA_597, + .init = pci_bridge_init, + .close = NULL, + .reset = pci_bridge_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t via_mvp3_agp_device = -{ - "VIA Apollo MVP3 AGP Bridge", - "via_mvp3_agp", - DEVICE_PCI, - AGP_BRIDGE_VIA_598, - pci_bridge_init, - NULL, - pci_bridge_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t via_mvp3_agp_device = { + .name = "VIA Apollo MVP3 AGP Bridge", + .internal_name = "via_mvp3_agp", + .flags = DEVICE_PCI, + .local = AGP_BRIDGE_VIA_598, + .init = pci_bridge_init, + .close = NULL, + .reset = pci_bridge_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t via_apro_agp_device = -{ - "VIA Apollo Pro AGP Bridge", - "via_apro_agp", - DEVICE_PCI, - AGP_BRIDGE_VIA_691, - pci_bridge_init, - NULL, - pci_bridge_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t via_apro_agp_device = { + .name = "VIA Apollo Pro AGP Bridge", + .internal_name = "via_apro_agp", + .flags = DEVICE_PCI, + .local = AGP_BRIDGE_VIA_691, + .init = pci_bridge_init, + .close = NULL, + .reset = pci_bridge_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t via_vt8601_agp_device = -{ - "VIA Apollo ProMedia AGP Bridge", - "via_vt8601_agp", - DEVICE_PCI, - AGP_BRIDGE_VIA_8601, - pci_bridge_init, - NULL, - pci_bridge_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t via_vt8601_agp_device = { + .name = "VIA Apollo ProMedia AGP Bridge", + .internal_name = "via_vt8601_agp", + .flags = DEVICE_PCI, + .local = AGP_BRIDGE_VIA_8601, + .init = pci_bridge_init, + .close = NULL, + .reset = pci_bridge_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/device/phoenix_486_jumper.c b/src/device/phoenix_486_jumper.c index 8bbbdaee1..10f37c4ce 100644 --- a/src/device/phoenix_486_jumper.c +++ b/src/device/phoenix_486_jumper.c @@ -123,24 +123,30 @@ phoenix_486_jumper_init(const device_t *info) return dev; } - const device_t phoenix_486_jumper_device = { - "Phoenix 486 Jumper Readout", - "phoenix_486_jumper", - 0, - 0, - phoenix_486_jumper_init, phoenix_486_jumper_close, phoenix_486_jumper_reset, - { NULL }, NULL, NULL, - NULL + .name = "Phoenix 486 Jumper Readout", + .internal_name = "phoenix_486_jumper", + .flags = 0, + .local = 0, + .init = phoenix_486_jumper_init, + .close = phoenix_486_jumper_close, + .reset = phoenix_486_jumper_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t phoenix_486_jumper_pci_device = { - "Phoenix 486 Jumper Readout (PCI machines)", - "phoenix_486_jumper_pci", - 0, - 1, - phoenix_486_jumper_init, phoenix_486_jumper_close, phoenix_486_jumper_reset, - { NULL }, NULL, NULL, - NULL + .name = "Phoenix 486 Jumper Readout (PCI machines)", + .internal_name = "phoenix_486_jumper_pci", + .flags = 0, + .local = 1, + .init = phoenix_486_jumper_init, + .close = phoenix_486_jumper_close, + .reset = phoenix_486_jumper_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/device/postcard.c b/src/device/postcard.c index 62d37c156..3fb06680d 100644 --- a/src/device/postcard.c +++ b/src/device/postcard.c @@ -141,11 +141,15 @@ postcard_close(UNUSED(void *priv)) const device_t postcard_device = { - "POST Card", - "postcard", - DEVICE_ISA, - 0, - postcard_init, postcard_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "POST Card", + .internal_name = "postcard", + .flags = DEVICE_ISA, + .local = 0, + .init = postcard_init, + .close = postcard_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/device/serial.c b/src/device/serial.c index cf3a84f00..c801c20f8 100644 --- a/src/device/serial.c +++ b/src/device/serial.c @@ -685,13 +685,13 @@ serial_init(const device_t *info) dev->sd->serial = dev; serial_reset_port(dev); if (next_inst == 3) - serial_setup(dev, SERIAL4_ADDR, SERIAL4_IRQ); + serial_setup(dev, COM4_ADDR, COM4_IRQ); else if (next_inst == 2) - serial_setup(dev, SERIAL3_ADDR, SERIAL3_IRQ); + serial_setup(dev, COM3_ADDR, COM3_IRQ); else if ((next_inst == 1) || (info->flags & DEVICE_PCJR)) - serial_setup(dev, SERIAL2_ADDR, SERIAL2_IRQ); + serial_setup(dev, COM2_ADDR, COM2_IRQ); else if (next_inst == 0) - serial_setup(dev, SERIAL1_ADDR, SERIAL1_IRQ); + serial_setup(dev, COM1_ADDR, COM1_IRQ); /* Default to 1200,N,7. */ dev->dlab = 96; @@ -717,87 +717,118 @@ serial_set_next_inst(int ni) void serial_standalone_init(void) { - for ( ; next_inst < 4; ) + for ( ; next_inst < SERIAL_MAX; ) device_add_inst(&ns8250_device, next_inst + 1); }; - const device_t ns8250_device = { - "National Semiconductor 8250(-compatible) UART", - "ns8250", - 0, - SERIAL_8250, - serial_init, serial_close, NULL, - { NULL }, serial_speed_changed, NULL, - NULL + .name = "National Semiconductor 8250(-compatible) UART", + .internal_name = "ns8250", + .flags = 0, + .local = SERIAL_8250, + .init = serial_init, + .close = serial_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = serial_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t ns8250_pcjr_device = { - "National Semiconductor 8250(-compatible) UART for PCjr", - "ns8250_pcjr", - DEVICE_PCJR, - SERIAL_8250_PCJR, - serial_init, serial_close, NULL, - { NULL }, serial_speed_changed, NULL, - NULL + .name = "National Semiconductor 8250(-compatible) UART for PCjr", + .internal_name = "ns8250_pcjr", + .flags = DEVICE_PCJR, + .local = SERIAL_8250_PCJR, + .init = serial_init, + .close = serial_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = serial_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t ns16450_device = { - "National Semiconductor NS16450(-compatible) UART", - "ns16450", - 0, - SERIAL_16450, - serial_init, serial_close, NULL, - { NULL }, serial_speed_changed, NULL, - NULL + .name = "National Semiconductor NS16450(-compatible) UART", + .internal_name = "ns16450", + .flags = 0, + .local = SERIAL_16450, + .init = serial_init, + .close = serial_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = serial_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t ns16550_device = { - "National Semiconductor NS16550(-compatible) UART", - "ns16550", - 0, - SERIAL_16550, - serial_init, serial_close, NULL, - { NULL }, serial_speed_changed, NULL, - NULL + .name = "National Semiconductor NS16550(-compatible) UART", + .internal_name = "ns16550", + .flags = 0, + .local = SERIAL_16550, + .init = serial_init, + .close = serial_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = serial_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t ns16650_device = { - "Startech Semiconductor 16650(-compatible) UART", - "ns16650", - 0, - SERIAL_16650, - serial_init, serial_close, NULL, - { NULL }, serial_speed_changed, NULL, - NULL + .name = "Startech Semiconductor 16650(-compatible) UART", + .internal_name = "ns16650", + .flags = 0, + .local = SERIAL_16650, + .init = serial_init, + .close = serial_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = serial_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t ns16750_device = { - "Texas Instruments 16750(-compatible) UART", - "ns16750", - 0, - SERIAL_16750, - serial_init, serial_close, NULL, - { NULL }, serial_speed_changed, NULL, - NULL + .name = "Texas Instruments 16750(-compatible) UART", + .internal_name = "ns16750", + .flags = 0, + .local = SERIAL_16750, + .init = serial_init, + .close = serial_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = serial_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t ns16850_device = { - "Exar Corporation NS16850(-compatible) UART", - "ns16850", - 0, - SERIAL_16850, - serial_init, serial_close, NULL, - { NULL }, serial_speed_changed, NULL, - NULL + .name = "Exar Corporation NS16850(-compatible) UART", + .internal_name = "ns16850", + .flags = 0, + .local = SERIAL_16850, + .init = serial_init, + .close = serial_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = serial_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t ns16950_device = { - "Oxford Semiconductor NS16950(-compatible) UART", - "ns16950", - 0, - SERIAL_16950, - serial_init, serial_close, NULL, - { NULL }, serial_speed_changed, NULL, - NULL + .name = "Oxford Semiconductor NS16950(-compatible) UART", + .internal_name = "ns16950", + .flags = 0, + .local = SERIAL_16950, + .init = serial_init, + .close = serial_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = serial_speed_changed, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/device/smbus_ali7101.c b/src/device/smbus_ali7101.c index 5733c46eb..c56ecd881 100644 --- a/src/device/smbus_ali7101.c +++ b/src/device/smbus_ali7101.c @@ -299,13 +299,16 @@ smbus_ali7101_close(void *priv) free(dev); } - const device_t ali7101_smbus_device = { - "ALi M7101-compatible SMBus Host Controller", - "ali7101_smbus", - DEVICE_AT, - 0, - smbus_ali7101_init, smbus_ali7101_close, smbus_ali7101_reset, - { NULL }, NULL, NULL, - NULL + .name = "ALi M7101-compatible SMBus Host Controller", + .internal_name = "ali7101_smbus", + .flags = DEVICE_AT, + .local = 0, + .init = smbus_ali7101_init, + .close = smbus_ali7101_close, + .reset = smbus_ali7101_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/device/smbus_piix4.c b/src/device/smbus_piix4.c index 0b2416ad7..de26b061c 100644 --- a/src/device/smbus_piix4.c +++ b/src/device/smbus_piix4.c @@ -384,23 +384,30 @@ smbus_piix4_close(void *priv) free(dev); } - const device_t piix4_smbus_device = { - "PIIX4-compatible SMBus Host Controller", - "piix4_smbus", - DEVICE_AT, - SMBUS_PIIX4, - smbus_piix4_init, smbus_piix4_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "PIIX4-compatible SMBus Host Controller", + .internal_name = "piix4_smbus", + .flags = DEVICE_AT, + .local = SMBUS_PIIX4, + .init = smbus_piix4_init, + .close = smbus_piix4_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t via_smbus_device = { - "VIA VT82C686B SMBus Host Controller", - "via_smbus", - DEVICE_AT, - SMBUS_VIA, - smbus_piix4_init, smbus_piix4_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "VIA VT82C686B SMBus Host Controller", + .internal_name = "via_smbus", + .flags = DEVICE_AT, + .local = SMBUS_VIA, + .init = smbus_piix4_init, + .close = smbus_piix4_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/disk/hdc.c b/src/disk/hdc.c index 10b9ea72a..90d46a815 100644 --- a/src/disk/hdc.c +++ b/src/disk/hdc.c @@ -52,58 +52,72 @@ hdc_log(const char *fmt, ...) #define hdc_log(fmt, ...) #endif - static void * -null_init(const device_t *info) +nullhdc_init(const device_t *info) { return(NULL); } - static void -null_close(void *priv) +nullhdc_close(void *priv) { } - static void * inthdc_init(const device_t *info) { return(NULL); } - static void inthdc_close(void *priv) { } - static const device_t hdc_none_device = { - "None", "none", 0, 0, - null_init, null_close, NULL, - { NULL }, NULL, NULL, NULL -}; -static const device_t hdc_internal_device = { - "Internal", "internal", 0, 0, - inthdc_init, inthdc_close, NULL, - { NULL }, NULL, NULL, NULL + .name = "None", + .internal_name = "none", + .flags = 0, + .local = 0, + .init = nullhdc_init, + .close = nullhdc_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; +static const device_t hdc_internal_device = { + .name = "Internal", + .internal_name = "internal", + .flags = 0, + .local = 0, + .init = inthdc_init, + .close = inthdc_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; static const struct { -// clang-format off const device_t *device; } controllers[] = { +// clang-format off { &hdc_none_device }, { &hdc_internal_device }, { &st506_xt_xebec_device }, { &st506_xt_dtc5150x_device }, { &st506_xt_st11_m_device }, { &st506_xt_wd1002a_wx1_device }, + { &st506_xt_wd1004a_wx1_device }, { &st506_at_wd1003_device }, { &st506_xt_st11_r_device }, { &st506_xt_wd1002a_27x_device }, + { &st506_xt_wd1004_27x_device }, + { &st506_xt_wd1004a_27x_device }, { &esdi_at_wd1007vse1_device }, { &ide_isa_device }, { &ide_isa_2ch_device }, @@ -118,7 +132,7 @@ static const struct { { &ide_pci_2ch_device }, { &ide_vlb_device }, { &ide_vlb_2ch_device }, - { NULL } + { NULL } // clang-format on }; diff --git a/src/disk/hdc_esdi_at.c b/src/disk/hdc_esdi_at.c index c68ec5cf3..fb9ef7479 100644 --- a/src/disk/hdc_esdi_at.c +++ b/src/disk/hdc_esdi_at.c @@ -845,12 +845,15 @@ wd1007vse1_available(void) const device_t esdi_at_wd1007vse1_device = { - "Western Digital WD1007V-SE1 (ESDI)", - "esdi_at", - DEVICE_ISA | DEVICE_AT, - 0, - wd1007vse1_init, wd1007vse1_close, NULL, - { wd1007vse1_available }, - NULL, NULL, - NULL + .name = "Western Digital WD1007V-SE1 (ESDI)", + .internal_name = "esdi_at", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 0, + .init = wd1007vse1_init, + .close = wd1007vse1_close, + .reset = NULL, + { .available = wd1007vse1_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/disk/hdc_esdi_mca.c b/src/disk/hdc_esdi_mca.c index 6a8de8075..d3c2b9e88 100644 --- a/src/disk/hdc_esdi_mca.c +++ b/src/disk/hdc_esdi_mca.c @@ -1180,9 +1180,15 @@ esdi_available(void) const device_t esdi_ps2_device = { - "IBM PS/2 ESDI Fixed Disk Adapter (MCA)", - "esdi_mca", - DEVICE_MCA, 0, - esdi_init, esdi_close, NULL, - { esdi_available }, NULL, NULL, NULL + .name = "IBM PS/2 ESDI Fixed Disk Adapter (MCA)", + .internal_name = "esdi_mca", + .flags = DEVICE_MCA, + .local = 0, + .init = esdi_init, + .close = esdi_close, + .reset = NULL, + { .available = esdi_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index 7350f6d84..d0ca2c84e 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -3064,57 +3064,87 @@ ide_close(void *priv) const device_t ide_isa_device = { - "ISA PC/AT IDE Controller", - "ide_isa", - DEVICE_ISA | DEVICE_AT, - 0, - ide_init, ide_close, ide_reset, - { NULL }, NULL, NULL, NULL + .name = "ISA PC/AT IDE Controller", + .internal_name = "ide_isa", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 0, + .init = ide_init, + .close = ide_close, + .reset = ide_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t ide_isa_2ch_device = { - "ISA PC/AT IDE Controller (Dual-Channel)", - "ide_isa_2ch", - DEVICE_ISA | DEVICE_AT, - 1, - ide_init, ide_close, ide_reset, - { NULL }, NULL, NULL, NULL + .name = "ISA PC/AT IDE Controller (Dual-Channel)", + .internal_name = "ide_isa_2ch", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 1, + .init = ide_init, + .close = ide_close, + .reset = ide_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t ide_vlb_device = { - "VLB IDE Controller", - "ide_vlb", - DEVICE_VLB | DEVICE_AT, - 2, - ide_init, ide_close, ide_reset, - { NULL }, NULL, NULL, NULL + .name = "VLB IDE Controller", + .internal_name = "ide_vlb", + .flags = DEVICE_VLB | DEVICE_AT, + .local = 2, + .init = ide_init, + .close = ide_close, + .reset = ide_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t ide_vlb_2ch_device = { - "VLB IDE Controller (Dual-Channel)", - "ide_vlb_2ch", - DEVICE_VLB | DEVICE_AT, - 3, - ide_init, ide_close, ide_reset, - { NULL }, NULL, NULL, NULL + .name = "VLB IDE Controller (Dual-Channel)", + .internal_name = "ide_vlb_2ch", + .flags = DEVICE_VLB | DEVICE_AT, + .local = 3, + .init = ide_init, + .close = ide_close, + .reset = ide_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t ide_pci_device = { - "PCI IDE Controller", - "ide_pci", - DEVICE_PCI | DEVICE_AT, - 4, - ide_init, ide_close, ide_reset, - { NULL }, NULL, NULL, NULL + .name = "PCI IDE Controller", + .internal_name = "ide_pci", + .flags = DEVICE_PCI | DEVICE_AT, + .local = 4, + .init = ide_init, + .close = ide_close, + .reset = ide_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t ide_pci_2ch_device = { - "PCI IDE Controller (Dual-Channel)", - "ide_pci_2ch", - DEVICE_PCI | DEVICE_AT, - 5, - ide_init, ide_close, ide_reset, - { NULL }, NULL, NULL, NULL + .name = "PCI IDE Controller (Dual-Channel)", + .internal_name = "ide_pci_2ch", + .flags = DEVICE_PCI | DEVICE_AT, + .local = 5, + .init = ide_init, + .close = ide_close, + .reset = ide_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; // clang-format off @@ -3160,41 +3190,57 @@ static const device_config_t ide_qua_config[] = { // clang-format on const device_t ide_ter_device = { - "Tertiary IDE Controller", - "ide_ter", - DEVICE_AT, - 0, - ide_ter_init, ide_ter_close, NULL, - { NULL }, NULL, NULL, - ide_ter_config + .name = "Tertiary IDE Controller", + .internal_name = "ide_ter", + .flags = DEVICE_AT, + .local = 0, + .init = ide_ter_init, + .close = ide_ter_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ide_ter_config }; const device_t ide_ter_pnp_device = { - "Tertiary IDE Controller (Plug and Play only)", - "ide_ter_pnp", - DEVICE_AT, - 1, - ide_ter_init, ide_ter_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Tertiary IDE Controller (Plug and Play only)", + .internal_name = "ide_ter_pnp", + .flags = DEVICE_AT, + .local = 1, + .init = ide_ter_init, + .close = ide_ter_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t ide_qua_device = { - "Quaternary IDE Controller", - "ide_qua", - DEVICE_AT, - 0, - ide_qua_init, ide_qua_close, NULL, - { NULL }, NULL, NULL, - ide_qua_config + .name = "Quaternary IDE Controller", + .internal_name = "ide_qua", + .flags = DEVICE_AT, + .local = 0, + .init = ide_qua_init, + .close = ide_qua_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ide_qua_config }; const device_t ide_qua_pnp_device = { - "Quaternary IDE Controller (Plug and Play only)", - "ide_qua_pnp", - DEVICE_AT, - 1, - ide_qua_init, ide_qua_close, NULL, - { NULL }, NULL, NULL, - ide_qua_config + .name = "Quaternary IDE Controller (Plug and Play only)", + .internal_name = "ide_qua_pnp", + .flags = DEVICE_AT, + .local = 1, + .init = ide_qua_init, + .close = ide_qua_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ide_qua_config }; diff --git a/src/disk/hdc_ide_cmd640.c b/src/disk/hdc_ide_cmd640.c index f07caa0a8..dec8fac18 100644 --- a/src/disk/hdc_ide_cmd640.c +++ b/src/disk/hdc_ide_cmd640.c @@ -493,51 +493,71 @@ cmd640_init(const device_t *info) const device_t ide_cmd640_vlb_device = { - "CMD PCI-0640B VLB", - "ide_cmd640_vlb", - DEVICE_VLB, - 0x0078, - cmd640_init, cmd640_close, cmd640_reset, - { NULL }, NULL, NULL, - NULL + .name = "CMD PCI-0640B VLB", + .internal_name = "ide_cmd640_vlb", + .flags = DEVICE_VLB, + .local = 0x0078, + .init = cmd640_init, + .close = cmd640_close, + .reset = cmd640_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t ide_cmd640_vlb_178_device = { - "CMD PCI-0640B VLB (Port 178h)", - "ide_cmd640_vlb_178", - DEVICE_VLB, - 0x0178, - cmd640_init, cmd640_close, cmd640_reset, - { NULL }, NULL, NULL, - NULL + .name = "CMD PCI-0640B VLB (Port 178h)", + .internal_name = "ide_cmd640_vlb_178", + .flags = DEVICE_VLB, + .local = 0x0178, + .init = cmd640_init, + .close = cmd640_close, + .reset = cmd640_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t ide_cmd640_pci_device = { - "CMD PCI-0640B PCI", - "ide_cmd640_pci", - DEVICE_PCI, - 0x0a, - cmd640_init, cmd640_close, cmd640_reset, - { NULL }, NULL, NULL, - NULL + .name = "CMD PCI-0640B PCI", + .internal_name = "ide_cmd640_pci", + .flags = DEVICE_PCI, + .local = 0x0a, + .init = cmd640_init, + .close = cmd640_close, + .reset = cmd640_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t ide_cmd640_pci_legacy_only_device = { - "CMD PCI-0640B PCI (Legacy Mode Only)", - "ide_cmd640_pci_legacy_only", - DEVICE_PCI, - 0x00, - cmd640_init, cmd640_close, cmd640_reset, - { NULL }, NULL, NULL, - NULL + .name = "CMD PCI-0640B PCI (Legacy Mode Only)", + .internal_name = "ide_cmd640_pci_legacy_only", + .flags = DEVICE_PCI, + .local = 0x00, + .init = cmd640_init, + .close = cmd640_close, + .reset = cmd640_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t ide_cmd640_pci_single_channel_device = { - "CMD PCI-0640B PCI", - "ide_cmd640_pci_single_channel", - DEVICE_PCI, - 0x2000a, - cmd640_init, cmd640_close, cmd640_reset, - { NULL }, NULL, NULL, - NULL + .name = "CMD PCI-0640B PCI", + .internal_name = "ide_cmd640_pci_single_channel", + .flags = DEVICE_PCI, + .local = 0x2000a, + .init = cmd640_init, + .close = cmd640_close, + .reset = cmd640_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/disk/hdc_ide_cmd646.c b/src/disk/hdc_ide_cmd646.c index d2b2fe978..960a07b16 100644 --- a/src/disk/hdc_ide_cmd646.c +++ b/src/disk/hdc_ide_cmd646.c @@ -408,31 +408,43 @@ cmd646_init(const device_t *info) const device_t ide_cmd646_device = { - "CMD PCI-0646", - "ide_cmd646", - DEVICE_PCI, - 0x8a, - cmd646_init, cmd646_close, cmd646_reset, - { NULL }, NULL, NULL, - NULL + .name = "CMD PCI-0646", + .internal_name = "ide_cmd646", + .flags = DEVICE_PCI, + .local = 0x8a, + .init = cmd646_init, + .close = cmd646_close, + .reset = cmd646_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t ide_cmd646_legacy_only_device = { - "CMD PCI-0646 (Legacy Mode Only)", - "ide_cmd646_legacy_only", - DEVICE_PCI, - 0x80, - cmd646_init, cmd646_close, cmd646_reset, - { NULL }, NULL, NULL, - NULL + .name = "CMD PCI-0646 (Legacy Mode Only)", + .internal_name = "ide_cmd646_legacy_only", + .flags = DEVICE_PCI, + .local = 0x80, + .init = cmd646_init, + .close = cmd646_close, + .reset = cmd646_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t ide_cmd646_single_channel_device = { - "CMD PCI-0646", - "ide_cmd646_single_channel", - DEVICE_PCI, - 0x2008a, - cmd646_init, cmd646_close, cmd646_reset, - { NULL }, NULL, NULL, - NULL + .name = "CMD PCI-0646", + .internal_name = "ide_cmd646_single_channel", + .flags = DEVICE_PCI, + .local = 0x2008a, + .init = cmd646_init, + .close = cmd646_close, + .reset = cmd646_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/disk/hdc_ide_opti611.c b/src/disk/hdc_ide_opti611.c index c8f5ac838..e53971768 100644 --- a/src/disk/hdc_ide_opti611.c +++ b/src/disk/hdc_ide_opti611.c @@ -313,11 +313,15 @@ opti611_init(const device_t *info) const device_t ide_opti611_vlb_device = { - "OPTi 82C611/82C611A VLB", - "ide_opti611_vlb", - 0, - 0, - opti611_init, opti611_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "OPTi 82C611/82C611A VLB", + .internal_name = "ide_opti611_vlb", + .flags = DEVICE_VLB, + .local = 0, + .init = opti611_init, + .close = opti611_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/disk/hdc_ide_sff8038i.c b/src/disk/hdc_ide_sff8038i.c index 82b417b3d..7caecc37d 100644 --- a/src/disk/hdc_ide_sff8038i.c +++ b/src/disk/hdc_ide_sff8038i.c @@ -587,15 +587,15 @@ static void const device_t sff8038i_device = { - "SFF-8038i IDE Bus Master", - "sff8038i", - DEVICE_PCI, - 0, - sff_init, - sff_close, - sff_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "SFF-8038i IDE Bus Master", + .internal_name = "sff8038i", + .flags = DEVICE_PCI, + .local = 0, + .init = sff_init, + .close = sff_close, + .reset = sff_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/disk/hdc_st506_at.c b/src/disk/hdc_st506_at.c index 7177d37bd..c510f5319 100644 --- a/src/disk/hdc_st506_at.c +++ b/src/disk/hdc_st506_at.c @@ -769,10 +769,15 @@ mfm_close(void *priv) const device_t st506_at_wd1003_device = { - "WD1003 AT MFM/RLL Controller", - "st506_at", - DEVICE_ISA | DEVICE_AT, - 0, - mfm_init, mfm_close, NULL, - { NULL }, NULL, NULL, NULL + .name = "WD1003 AT MFM/RLL Controller", + .internal_name = "st506_at", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 0, + .init = mfm_init, + .close = mfm_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/disk/hdc_st506_xt.c b/src/disk/hdc_st506_xt.c index fd2ef2b9b..4a4bb3395 100644 --- a/src/disk/hdc_st506_xt.c +++ b/src/disk/hdc_st506_xt.c @@ -96,10 +96,13 @@ #define ST11_BIOS_FILE_OLD "roms/hdd/st506/st11_bios_vers_1.7.bin" #define ST11_BIOS_FILE_NEW "roms/hdd/st506/st11_bios_vers_2.0.bin" #define WD1002A_WX1_BIOS_FILE "roms/hdd/st506/wd1002a_wx1-62-000094-032.bin" +#define WD1004A_WX1_BIOS_FILE "roms/hdd/st506/wd1002a_wx1-62-000094-032.bin" /* SuperBIOS was for both the WX1 and 27X, users jumpers readout to determine if to use 26 sectors per track, 26 -> 17 sectors per track translation, or 17 sectors per track. */ #define WD1002A_27X_BIOS_FILE "roms/hdd/st506/wd1002a_27x-62-000094-032.bin" +#define WD1004_27X_BIOS_FILE "roms/hdd/st506/western_digital_WD1004A-27X.bin" +#define WD1004A_27X_BIOS_FILE "roms/hdd/st506/western_digital_WD1004A-27X.bin" #define ST506_TIME (250 * TIMER_USEC) @@ -1614,6 +1617,24 @@ wd1002a_27x_available(void) return(rom_present(WD1002A_27X_BIOS_FILE)); } +static int +wd1004a_wx1_available(void) +{ + return(rom_present(WD1004A_WX1_BIOS_FILE)); +} + +static int +wd1004_27x_available(void) +{ + return(rom_present(WD1004_27X_BIOS_FILE)); +} + +static int +wd1004a_27x_available(void) +{ + return(rom_present(WD1004A_27X_BIOS_FILE)); +} + // clang-format off static const device_config_t dtc_config[] = { { @@ -1734,70 +1755,242 @@ static const device_config_t wd_rll_config[] = { }, { "", "", -1 } }; + +static const device_config_t wd1004a_config[] = { + { + .name = "bios_addr", + .description = "BIOS address", + .type = CONFIG_HEX20, + .default_string = "", + .default_int = 0xc8000, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "Disabled", .value = 0x00000 }, + { .description = "C800H", .value = 0xc8000 }, + { .description = "" } + } + }, + { + .name = "base", + .description = "Address", + .type = CONFIG_HEX16, + .default_string = "", + .default_int = 0x0320, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "320H", .value = 0x0320 }, + { .description = "324H", .value = 0x0324 }, + { .description = "" } + } + }, + { + .name = "irq", + .description = "IRQ", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = 5, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "IRQ 2", .value = 2 }, + { .description = "IRQ 5", .value = 5 }, + { .description = "" } + } + }, + { .name = "", .description = "", .type = -1 } +}; + +static const device_config_t wd1004_rll_config[] = { + { + .name = "bios_addr", + .description = "BIOS address", + .type = CONFIG_HEX20, + .default_string = "", + .default_int = 0xc8000, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "Disabled", .value = 0x00000 }, + { .description = "C800H", .value = 0xc8000 }, + { .description = "CA00H", .value = 0xca000 }, + { .description = "CC00H", .value = 0xcc000 }, + { .description = "CE00H", .value = 0xce000 }, + { .description = "" } + } + }, + { + .name = "base", + .description = "Address", + .type = CONFIG_HEX16, + .default_string = "", + .default_int = 0x0320, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "320H", .value = 0x0320 }, + { .description = "324H", .value = 0x0324 }, + { .description = "328H", .value = 0x0328 }, + { .description = "32CH", .value = 0x032c }, + { .description = "" } + } + }, + { + .name = "irq", + .description = "IRQ", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = 5, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "IRQ 2", .value = 2 }, + { .description = "IRQ 5", .value = 5 }, + { .description = "" } + } + }, + { + .name = "translate", + .description = "Translate 26 -> 17", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = 0, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "Off", .value = 0 }, + { .description = "On", .value = 1 }, + { .description = "" } + } + }, + { .name = "", .description = "", .type = -1 } +}; + // clang-format on const device_t st506_xt_xebec_device = { - "IBM PC Fixed Disk Adapter (MFM)", - "st506_xt", - DEVICE_ISA, - (HDD_BUS_MFM << 8) | 0, - st506_init, st506_close, NULL, - { xebec_available }, - NULL, NULL, - NULL + .name = "IBM PC Fixed Disk Adapter (MFM)", + .internal_name = "st506_xt", + .flags = DEVICE_ISA, + .local = (HDD_BUS_MFM << 8) | 0, + .init = st506_init, + .close = st506_close, + .reset = NULL, + { .available = xebec_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t st506_xt_dtc5150x_device = { - "DTC 5150X MFM Fixed Disk Adapter", - "st506_xt_dtc5150x", - DEVICE_ISA, - (HDD_BUS_MFM << 8) | 1, - st506_init, st506_close, NULL, - { dtc5150x_available }, - NULL, NULL, - dtc_config + .name = "DTC 5150X MFM Fixed Disk Adapter", + .internal_name = "st506_xt_dtc5150x", + .flags = DEVICE_ISA, + .local = (HDD_BUS_MFM << 8) | 1, + .init = st506_init, + .close = st506_close, + .reset = NULL, + { .available = dtc5150x_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = dtc_config }; const device_t st506_xt_st11_m_device = { - "ST-11M MFM Fixed Disk Adapter", - "st506_xt_st11_m", - DEVICE_ISA, - (HDD_BUS_MFM << 8) | 11, - st506_init, st506_close, NULL, - { st11_m_available }, - NULL, NULL, - st11_config + .name = "ST-11M MFM Fixed Disk Adapter", + .internal_name = "st506_xt_st11_m", + .flags = DEVICE_ISA, + .local = (HDD_BUS_MFM << 8) | 11, + .init = st506_init, + .close = st506_close, + .reset = NULL, + { .available = st11_m_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = st11_config }; const device_t st506_xt_st11_r_device = { - "ST-11R RLL Fixed Disk Adapter", - "st506_xt_st11_r", - DEVICE_ISA, - (HDD_BUS_MFM << 8) | 12, - st506_init, st506_close, NULL, - { st11_r_available }, - NULL, NULL, - st11_config + .name = "ST-11R RLL Fixed Disk Adapter", + .internal_name = "st506_xt_st11_r", + .flags = DEVICE_ISA, + .local = (HDD_BUS_MFM << 8) | 12, + .init = st506_init, + .close = st506_close, + .reset = NULL, + { .available = st11_r_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = st11_config }; const device_t st506_xt_wd1002a_wx1_device = { - "WD1002A-WX1 MFM Fixed Disk Adapter", - "st506_xt_wd1002a_wx1", - DEVICE_ISA, - (HDD_BUS_MFM << 8) | 21, - st506_init, st506_close, NULL, - { wd1002a_wx1_available }, - NULL, NULL, - wd_config + .name = "WD1002A-WX1 MFM Fixed Disk Adapter", + .internal_name = "st506_xt_wd1002a_wx1", + .flags = DEVICE_ISA, + .local = (HDD_BUS_MFM << 8) | 21, + .init = st506_init, + .close = st506_close, + .reset = NULL, + { .available = wd1002a_wx1_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = wd_config }; const device_t st506_xt_wd1002a_27x_device = { - "WD1002A-27X RLL Fixed Disk Adapter", - "st506_xt_wd1002a_27x", - DEVICE_ISA, - (HDD_BUS_MFM << 8) | 22, - st506_init, st506_close, NULL, - { wd1002a_27x_available }, - NULL, NULL, - wd_rll_config + .name = "WD1002A-27X RLL Fixed Disk Adapter", + .internal_name = "st506_xt_wd1002a_27x", + .flags = DEVICE_ISA, + .local = (HDD_BUS_MFM << 8) | 22, + .init = st506_init, + .close = st506_close, + .reset = NULL, + { .available = wd1002a_27x_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = wd_rll_config +}; + +const device_t st506_xt_wd1004a_wx1_device = { + .name = "WD1004A-WX1 MFM Fixed Disk Adapter", + .internal_name = "st506_xt_wd1004a_wx1", + .flags = DEVICE_ISA, + .local = (HDD_BUS_MFM << 8) | 21, + .init = st506_init, + .close = st506_close, + .reset = NULL, + { wd1004a_wx1_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = wd1004a_config +}; + +const device_t st506_xt_wd1004_27x_device = { + .name = "WD1004-27X RLL Fixed Disk Adapter", + .internal_name = "st506_xt_wd1004_27x", + .flags = DEVICE_ISA, + .local = (HDD_BUS_MFM << 8) | 22, + .init = st506_init, + .close = st506_close, + .reset = NULL, + { .available = wd1004_27x_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = wd1004_rll_config +}; + +const device_t st506_xt_wd1004a_27x_device = { + .name = "WD1004a-27X RLL Fixed Disk Adapter", + .internal_name = "st506_xt_wd1004a_27x", + .flags = DEVICE_ISA, + .local = (HDD_BUS_MFM << 8) | 22, + .init = st506_init, + .close = st506_close, + .reset = NULL, + { .available = wd1004a_27x_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = wd_rll_config }; diff --git a/src/disk/hdc_xta.c b/src/disk/hdc_xta.c index 03a7c6fb2..754a4114a 100644 --- a/src/disk/hdc_xta.c +++ b/src/disk/hdc_xta.c @@ -1134,21 +1134,29 @@ static const device_config_t wdxt150_config[] = { }; const device_t xta_wdxt150_device = { - "WDXT-150 XTA Fixed Disk Controller", - "xta_wdxt150", - DEVICE_ISA, - 0, - xta_init, xta_close, NULL, - { xta_available }, NULL, NULL, - wdxt150_config + .name = "WDXT-150 XTA Fixed Disk Controller", + .internal_name = "xta_wdxt150", + .flags = DEVICE_ISA, + .local = 0, + .init = xta_init, + .close = xta_close, + .reset = NULL, + { .available = xta_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = wdxt150_config }; const device_t xta_hd20_device = { - "EuroPC HD20 Fixed Disk Controller", - "xta_hd20", - DEVICE_ISA, - 1, - xta_init, xta_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "EuroPC HD20 Fixed Disk Controller", + .internal_name = "xta_hd20", + .flags = DEVICE_ISA, + .local = 1, + .init = xta_init, + .close = xta_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/disk/hdc_xtide.c b/src/disk/hdc_xtide.c index 84b31bc8d..51c8dbf4a 100644 --- a/src/disk/hdc_xtide.c +++ b/src/disk/hdc_xtide.c @@ -261,51 +261,71 @@ xtide_at_close(void *priv) const device_t xtide_device = { - "PC/XT XTIDE", - "xtide", - DEVICE_ISA, - 0, - xtide_init, xtide_close, NULL, - { xtide_available }, NULL, NULL, - NULL + .name = "PC/XT XTIDE", + .internal_name = "xtide", + .flags = DEVICE_ISA, + .local = 0, + .init = xtide_init, + .close = xtide_close, + .reset = NULL, + { .available = xtide_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t xtide_at_device = { - "PC/AT XTIDE", - "xtide_at", - DEVICE_ISA | DEVICE_AT, - 0, - xtide_at_init, xtide_at_close, NULL, - { xtide_at_available }, NULL, NULL, - NULL + .name = "PC/AT XTIDE", + .internal_name = "xtide_at", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 0, + .init = xtide_at_init, + .close = xtide_at_close, + .reset = NULL, + { .available = xtide_at_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t xtide_at_386_device = { - "PC/AT XTIDE (386)", - "xtide_at_386", - DEVICE_ISA | DEVICE_AT, - 1, - xtide_at_init, xtide_at_close, NULL, - { xtide_at_386_available }, NULL, NULL, - NULL + .name = "PC/AT XTIDE (386)", + .internal_name = "xtide_at_386", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 1, + .init = xtide_at_init, + .close = xtide_at_close, + .reset = NULL, + { .available = xtide_at_386_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t xtide_acculogic_device = { - "Acculogic XT IDE", - "xtide_acculogic", - DEVICE_ISA, - 0, - xtide_acculogic_init, xtide_close, NULL, - { xtide_acculogic_available }, NULL, NULL, - NULL + .name = "Acculogic XT IDE", + .internal_name = "xtide_acculogic", + .flags = DEVICE_ISA, + .local = 0, + .init = xtide_acculogic_init, + .close = xtide_close, + .reset = NULL, + { .available = xtide_acculogic_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t xtide_at_ps2_device = { - "PS/2 AT XTIDE (1.1.5)", - "xtide_at_ps2", - DEVICE_ISA | DEVICE_AT, - 0, - xtide_at_ps2_init, xtide_at_close, NULL, - { xtide_at_ps2_available }, NULL, NULL, - NULL + .name = "PS/2 AT XTIDE (1.1.5)", + .internal_name = "xtide_at_ps2", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 0, + .init = xtide_at_ps2_init, + .close = xtide_at_close, + .reset = NULL, + { .available = xtide_at_ps2_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index 485b8925c..171a77fa7 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -102,12 +102,17 @@ fdc_log(const char *fmt, ...) const device_t fdc_internal_device = { - "Internal", - "internal", - 0, 0, - NULL, NULL, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Internal", + .internal_name = "internal", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; @@ -117,11 +122,13 @@ typedef const struct { /* All emulated machines have at least one integrated FDC controller */ static fdc_cards_t fdc_cards[] = { - { &fdc_internal_device }, - { &fdc_b215_device }, - { &fdc_pii151b_device }, - { &fdc_pii158b_device }, - { NULL } +// clang-format off + { &fdc_internal_device }, + { &fdc_b215_device }, + { &fdc_pii151b_device }, + { &fdc_pii158b_device }, + { NULL } +// clang-format on }; @@ -2382,145 +2389,183 @@ fdc_3f1_enable(fdc_t *fdc, int enable) } const device_t fdc_xt_device = { - "PC/XT Floppy Drive Controller", - "fdc_xt", - 0, - 0, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/XT Floppy Drive Controller", + .internal_name = "fdc_xt", + .flags = 0, + .local = 0, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_xt_t1x00_device = { - "PC/XT Floppy Drive Controller (Toshiba)", - "fdc_xt_t1x00", - 0, - FDC_FLAG_TOSHIBA, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/XT Floppy Drive Controller (Toshiba)", + .internal_name = "fdc_xt_t1x00", + .flags = 0, + .local = FDC_FLAG_TOSHIBA, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_xt_amstrad_device = { - "PC/XT Floppy Drive Controller (Amstrad)", - "fdc_xt_amstrad", - 0, - FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AMSTRAD, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/XT Floppy Drive Controller (Amstrad)", + .internal_name = "fdc_xt_amstrad", + .flags = 0, + .local = FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AMSTRAD, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_xt_tandy_device = { - "PC/XT Floppy Drive Controller (Tandy)", - "fdc_xt_tandy", - 0, - FDC_FLAG_AMSTRAD, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/XT Floppy Drive Controller (Tandy)", + .internal_name = "fdc_xt_tandy", + .flags = 0, + .local = FDC_FLAG_AMSTRAD, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t fdc_pcjr_device = { - "PCjr Floppy Drive Controller", - "fdc_pcjr", - 0, - FDC_FLAG_PCJR, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PCjr Floppy Drive Controller", + .internal_name = "fdc_pcjr", + .flags = 0, + .local = FDC_FLAG_PCJR, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_at_device = { - "PC/AT Floppy Drive Controller", - "fdc_at", - 0, - FDC_FLAG_AT, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/AT Floppy Drive Controller", + .internal_name = "fdc_at", + .flags = 0, + .local = FDC_FLAG_AT, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_at_actlow_device = { - "PC/AT Floppy Drive Controller (Active low)", - "fdc_at_actlow", - 0, - FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AT, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/AT Floppy Drive Controller (Active low)", + .internal_name = "fdc_at_actlow", + .flags = 0, + .local = FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AT, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_at_ps1_device = { - "PC/AT Floppy Drive Controller (PS/1, PS/2 ISA)", - "fdc_at_ps1", - 0, - FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AT | FDC_FLAG_PS1, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/AT Floppy Drive Controller (PS/1, PS/2 ISA)", + .internal_name = "fdc_at_ps1", + .flags = 0, + .local = FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AT | FDC_FLAG_PS1, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_at_smc_device = { - "PC/AT Floppy Drive Controller (SM(s)C FDC37Cxxx)", - "fdc_at_smc", - 0, - FDC_FLAG_AT | FDC_FLAG_SUPERIO, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/AT Floppy Drive Controller (SM(s)C FDC37Cxxx)", + .internal_name = "fdc_at_smc", + .flags = 0, + .local = FDC_FLAG_AT | FDC_FLAG_SUPERIO, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_at_winbond_device = { - "PC/AT Floppy Drive Controller (Winbond W83x77F)", - "fdc_at_winbond", - 0, - FDC_FLAG_AT | FDC_FLAG_SUPERIO | FDC_FLAG_START_RWC_1 | FDC_FLAG_MORE_TRACKS, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/AT Floppy Drive Controller (Winbond W83x77F)", + .internal_name = "fdc_at_winbond", + .flags = 0, + .local = FDC_FLAG_AT | FDC_FLAG_SUPERIO | FDC_FLAG_START_RWC_1 | FDC_FLAG_MORE_TRACKS, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_at_nsc_device = { - "PC/AT Floppy Drive Controller (NSC PC8730x)", - "fdc_at_nsc", - 0, - FDC_FLAG_AT | FDC_FLAG_MORE_TRACKS | FDC_FLAG_NSC, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/AT Floppy Drive Controller (NSC PC8730x)", + .internal_name = "fdc_at_nsc", + .flags = 0, + .local = FDC_FLAG_AT | FDC_FLAG_MORE_TRACKS | FDC_FLAG_NSC, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_dp8473_device = { - "NS DP8473 Floppy Drive Controller", - "fdc_dp8473", - 0, - FDC_FLAG_AT | FDC_FLAG_NSC, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "NS DP8473 Floppy Drive Controller", + .internal_name = "fdc_dp8473", + .flags = 0, + .local = FDC_FLAG_AT | FDC_FLAG_NSC, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_um8398_device = { - "UMC UM8398 Floppy Drive Controller", - "fdc_um8398", - 0, - FDC_FLAG_UMC, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "UMC UM8398 Floppy Drive Controller", + .internal_name = "fdc_um8398", + .flags = 0, + .local = FDC_FLAG_UMC, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/floppy/fdc_magitronic.c b/src/floppy/fdc_magitronic.c index 58679a5aa..a27e19748 100644 --- a/src/floppy/fdc_magitronic.c +++ b/src/floppy/fdc_magitronic.c @@ -126,14 +126,16 @@ static const device_config_t b215_config[] = { }; const device_t fdc_b215_device = { - "Magitronic B215", - "b215", - DEVICE_ISA, - 0, - b215_init, - b215_close, - NULL, - {b215_available}, - NULL, - NULL, - b215_config}; + .name = "Magitronic B215", + .internal_name = "b215", + .flags = DEVICE_ISA, + .local = 0, + .init = b215_init, + .close = b215_close, + .reset = NULL, + { .available = b215_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = b215_config +}; + diff --git a/src/floppy/fdc_pii15xb.c b/src/floppy/fdc_pii15xb.c index 6ac6786c9..2e865ec56 100644 --- a/src/floppy/fdc_pii15xb.c +++ b/src/floppy/fdc_pii15xb.c @@ -138,27 +138,29 @@ static const device_config_t pii_config[] = { }; const device_t fdc_pii151b_device = { - "DTK PII-151B (MiniMicro) Floppy Drive Controller", - "dtk_pii151b", - DEVICE_ISA, - 151, - pii_init, - pii_close, - NULL, - {pii_151b_available}, - NULL, - NULL, - pii_config}; + .name = "DTK PII-151B (MiniMicro) Floppy Drive Controller", + .internal_name = "dtk_pii151b", + .flags = DEVICE_ISA, + .local = 151, + .init = pii_init, + .close = pii_close, + .reset = NULL, + { .available = pii_151b_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = pii_config +}; const device_t fdc_pii158b_device = { - "DTK PII-158B (MiniMicro4) Floppy Drive Controller", - "dtk_pii158b", - DEVICE_ISA, - 158, - pii_init, - pii_close, - NULL, - {pii_158_available}, - NULL, - NULL, - pii_config}; + .name = "DTK PII-158B (MiniMicro4) Floppy Drive Controller", + .internal_name = "dtk_pii158b", + .flags = DEVICE_ISA, + .local = 158, + .init = pii_init, + .close = pii_close, + .reset = NULL, + { .available = pii_158_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = pii_config +}; diff --git a/src/floppy/fdd.c b/src/floppy/fdd.c index 0c55471bc..1344c3f02 100644 --- a/src/floppy/fdd.c +++ b/src/floppy/fdd.c @@ -313,7 +313,7 @@ fdd_set_densel(int densel) { int i = 0; - for (i = 0; i < 4; i++) { + for (i = 0; i < FDD_NUM; i++) { if (drive_types[fdd[i].type].flags & FLAG_INVERT_DENSEL) fdd[i].densel = densel ^ 1; else @@ -627,7 +627,7 @@ fdd_reset(void) { int i; - for (i = 0; i < 4; i++) { + for (i = 0; i < FDD_NUM; i++) { drives[i].id = i; timer_add(&(fdd_poll_time[i]), fdd_poll, &drives[i], 0); } @@ -702,7 +702,7 @@ fdd_init(void) { int i; - for (i = 0; i < 4; i++) { + for (i = 0; i < FDD_NUM; i++) { drives[i].poll = 0; drives[i].seek = 0; drives[i].readsector = 0; @@ -714,10 +714,9 @@ fdd_init(void) imd_init(); json_init(); - fdd_load(0, floppyfns[0]); - fdd_load(1, floppyfns[1]); - fdd_load(2, floppyfns[2]); - fdd_load(3, floppyfns[3]); + for (i = 0; i < FDD_NUM; i++) { + fdd_load(i, floppyfns[i]); + } } diff --git a/src/game/gameport.c b/src/game/gameport.c index d224e7baa..20ea51ffa 100644 --- a/src/game/gameport.c +++ b/src/game/gameport.c @@ -36,7 +36,6 @@ #include <86box/joystick_sw_pad.h> #include <86box/joystick_tm_fcs.h> - typedef struct { pc_timer_t timer; int axis_nr; @@ -58,43 +57,44 @@ typedef struct _joystick_instance_ { void *dat; } joystick_instance_t; - int joystick_type = 0; - static const joystick_if_t joystick_none = { - "None", - "none", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - 0, - 0, - 0 + .name = "None", + .internal_name = "none", + .init = NULL, + .close = NULL, + .read = NULL, + .write = NULL, + .read_axis = NULL, + .a0_over = NULL, + .axis_count = 0, + .button_count = 0, + .pov_count = 0, + .max_joysticks = 0, + .axis_names = { NULL }, + .button_names = { NULL }, + .pov_names = { NULL } }; - static const struct { const joystick_if_t *joystick; } joysticks[] = { - { &joystick_none }, - { &joystick_2axis_2button }, - { &joystick_2axis_4button }, - { &joystick_2axis_6button }, - { &joystick_2axis_8button }, - { &joystick_3axis_2button }, - { &joystick_3axis_4button }, - { &joystick_4axis_4button }, - { &joystick_ch_flightstick_pro }, - { &joystick_sw_pad }, - { &joystick_tm_fcs }, - { NULL } + { &joystick_none }, + { &joystick_2axis_2button }, + { &joystick_2axis_4button }, + { &joystick_2axis_6button }, + { &joystick_2axis_8button }, + { &joystick_3axis_2button }, + { &joystick_3axis_4button }, + { &joystick_4axis_4button }, + { &joystick_ch_flightstick_pro }, + { &joystick_sw_pad }, + { &joystick_tm_fcs }, + { NULL } }; -static joystick_instance_t *joystick_instance = NULL; +static joystick_instance_t *joystick_instance = NULL; static uint8_t gameport_pnp_rom[] = { 0x09, 0xf8, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, /* BOX0002, dummy checksum (filled in by isapnp_add_card) */ @@ -120,14 +120,12 @@ static const isapnp_device_config_t gameport_pnp_defaults[] = { } }; - const device_t *standalone_gameport_type; int gameport_instance_id = 0; /* Linked list of active game ports. Only the top port responds to reads or writes, and ports at the standard 200h location are prioritized. */ static gameport_t *active_gameports = NULL; - char * joystick_get_name(int js) { @@ -136,7 +134,6 @@ joystick_get_name(int js) return (char *) joysticks[js].joystick->name; } - char * joystick_get_internal_name(int js) { @@ -146,7 +143,6 @@ joystick_get_internal_name(int js) return (char *) joysticks[js].joystick->internal_name; } - int joystick_get_from_internal_name(char *s) { @@ -161,56 +157,48 @@ joystick_get_from_internal_name(char *s) return 0; } - int joystick_get_max_joysticks(int js) { return joysticks[js].joystick->max_joysticks; } - int joystick_get_axis_count(int js) { return joysticks[js].joystick->axis_count; } - int joystick_get_button_count(int js) { return joysticks[js].joystick->button_count; } - int joystick_get_pov_count(int js) { return joysticks[js].joystick->pov_count; } - char * joystick_get_axis_name(int js, int id) { return (char *) joysticks[js].joystick->axis_names[id]; } - char * joystick_get_button_name(int js, int id) { return (char *) joysticks[js].joystick->button_names[id]; } - char * joystick_get_pov_name(int js, int id) { return (char *) joysticks[js].joystick->pov_names[id]; } - static void gameport_time(joystick_instance_t *joystick, int nr, int axis) { @@ -225,7 +213,6 @@ gameport_time(joystick_instance_t *joystick, int nr, int axis) } } - static void gameport_write(uint16_t addr, uint8_t val, void *priv) { @@ -250,7 +237,6 @@ gameport_write(uint16_t addr, uint8_t val, void *priv) cycles -= ISA_CYCLES(8); } - static uint8_t gameport_read(uint16_t addr, void *priv) { @@ -269,7 +255,6 @@ gameport_read(uint16_t addr, void *priv) return ret; } - static void timer_over(void *priv) { @@ -282,7 +267,6 @@ timer_over(void *priv) axis->joystick->intf->a0_over(axis->joystick->dat); } - void gameport_update_joystick_type(void) { @@ -298,7 +282,6 @@ gameport_update_joystick_type(void) } } - void gameport_remap(void *priv, uint16_t address) { @@ -346,7 +329,6 @@ gameport_remap(void *priv, uint16_t address) } } - static void gameport_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv) { @@ -359,7 +341,6 @@ gameport_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *pr gameport_remap(dev, (config->activate && (config->io[0].base != ISAPNP_IO_DISABLED)) ? config->io[0].base : 0); } - void * gameport_add(const device_t *gameport_type) { @@ -372,7 +353,6 @@ gameport_add(const device_t *gameport_type) return device_add_inst(gameport_type, gameport_instance_id++); } - static void * gameport_init(const device_t *info) { @@ -418,6 +398,53 @@ gameport_init(const device_t *info) return dev; } +static void * +tmacm_init(const device_t *info) +{ + uint16_t port = 0x0000; + gameport_t *dev = NULL; + + dev = malloc(sizeof(gameport_t)); + memset(dev, 0x00, sizeof(gameport_t)); + + port = device_get_config_hex16("port1_addr"); + switch(port) { + case 0x201: + dev = gameport_add(&gameport_201_device); + break; + case 0x203: + dev = gameport_add(&gameport_203_device); + break; + case 0x205: + dev = gameport_add(&gameport_205_device); + break; + case 0x207: + dev = gameport_add(&gameport_207_device); + break; + default: + break; + } + + port = device_get_config_hex16("port2_addr"); + switch(port) { + case 0x201: + dev = gameport_add(&gameport_209_device); + break; + case 0x203: + dev = gameport_add(&gameport_20b_device); + break; + case 0x205: + dev = gameport_add(&gameport_20d_device); + break; + case 0x207: + dev = gameport_add(&gameport_20f_device); + break; + default: + break; + } + + return dev; +} static void gameport_close(void *priv) @@ -439,71 +466,235 @@ gameport_close(void *priv) } const device_t gameport_device = { - "Game port", - "gameport", - 0, 0x080200, - gameport_init, - gameport_close, - NULL, { NULL }, NULL, - NULL + .name = "Game port", + .internal_name = "gameport", + .flags = 0, + .local = 0x080200, + .init = gameport_init, + .close = gameport_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t gameport_201_device = { - "Game port (Port 201h only)", - "gameport_201", - 0, 0x010201, - gameport_init, - gameport_close, - NULL, { NULL }, NULL, - NULL + .name = "Game port (Port 201h only)", + .internal_name = "gameport_201", + .flags = 0, + .local = 0x010201, + .init = gameport_init, + .close = gameport_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; + +const device_t gameport_203_device = { + .name = "Game port (Port 203h only)", + .internal_name = "gameport_203", + .flags = 0, + .local = 0x010203, + .init = gameport_init, + .close = gameport_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; + +const device_t gameport_205_device = { + .name = "Game port (Port 205h only)", + .internal_name = "gameport_205", + .flags = 0, + .local = 0x010205, + .init = gameport_init, + .close = gameport_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; + +const device_t gameport_207_device = { + .name = "Game port (Port 207h only)", + .internal_name = "gameport_207", + .flags = 0, + .local = 0x010207, + .init = gameport_init, + .close = gameport_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t gameport_208_device = { - "Game port (Port 208h-20fh)", - "gameport_208", - 0, 0x080208, - gameport_init, - gameport_close, - NULL, { NULL }, NULL, - NULL + .name = "Game port (Port 208h-20fh)", + .internal_name = "gameport_208", + .flags = 0, + .local = 0x080208, + .init = gameport_init, + .close = gameport_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t gameport_209_device = { - "Game port (Port 209h only)", - "gameport_209", - 0, 0x010209, - gameport_init, - gameport_close, - NULL, { NULL }, NULL, - NULL + .name = "Game port (Port 209h only)", + .internal_name = "gameport_209", + .flags = 0, + .local = 0x010209, + .init = gameport_init, + .close = gameport_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; + +const device_t gameport_20b_device = { + .name = "Game port (Port 20Bh only)", + .internal_name = "gameport_20b", + .flags = 0, + .local = 0x01020B, + .init = gameport_init, + .close = gameport_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; + +const device_t gameport_20d_device = { + .name = "Game port (Port 20Dh only)", + .internal_name = "gameport_20d", + .flags = 0, + .local = 0x01020D, + .init = gameport_init, + .close = gameport_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; + +const device_t gameport_20f_device = { + .name = "Game port (Port 20Fh only)", + .internal_name = "gameport_20f", + .flags = 0, + .local = 0x01020F, + .init = gameport_init, + .close = gameport_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; + +static const device_config_t tmacm_config[] = { + { + .name = "port1_addr", + .description = "Port 1 Address", + .type = CONFIG_HEX16, + .default_string = "", + .default_int = 0x0201, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "201h", .value = 0x0201 }, + { .description = "203h", .value = 0x0203 }, + { .description = "205h", .value = 0x0205 }, + { .description = "207h", .value = 0x0207 }, + { .description = "Disabled", .value = 0x0000 }, + { "" } + } + }, + { + .name = "port2_addr", + .description = "Port 2 Address", + .type = CONFIG_HEX16, + .default_string = "", + .default_int = 0x0209, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "209h", .value = 0x0209 }, + { .description = "20Bh", .value = 0x020B }, + { .description = "20Dh", .value = 0x020D }, + { .description = "20Fh", .value = 0x020F }, + { .description = "Disabled", .value = 0x0000 }, + { "" } + } + }, + { "", "", -1 } +}; + +const device_t gameport_tm_acm_device = { + .name = "Game port (ThrustMaster ACM)", + .internal_name = "gameport_tmacm", + .flags = DEVICE_ISA, + .local = 0, + .init = tmacm_init, + .close = NULL, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = tmacm_config }; const device_t gameport_pnp_device = { - "Game port (Plug and Play only)", - "gameport_pnp", - 0, 0x080000, - gameport_init, - gameport_close, - NULL, { NULL }, NULL, - NULL + .name = "Game port (Plug and Play only)", + .internal_name = "gameport_pnp", + .flags = 0, + .local = 0x080000, + .init = gameport_init, + .close = gameport_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t gameport_pnp_6io_device = { - "Game port (Plug and Play only, 6 I/O ports)", - "gameport_pnp_6io", - 0, 0x060000, - gameport_init, - gameport_close, - NULL, { NULL }, NULL, - NULL + .name = "Game port (Plug and Play only, 6 I/O ports)", + .internal_name = "gameport_pnp_6io", + .flags = 0, + .local = 0x060000, + .init = gameport_init, + .close = gameport_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t gameport_sio_device = { - "Game port (Super I/O)", - "gameport_sio", - 0, 0x1080000, - gameport_init, - gameport_close, - NULL, { NULL }, NULL, - NULL + .name = "Game port (Super I/O)", + .internal_name = "gameport_sio", + .flags = 0, + .local = 0x1080000, + .init = gameport_init, + .close = gameport_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/game/joystick_ch_flightstick_pro.c b/src/game/joystick_ch_flightstick_pro.c index 5a44c2312..5be3ce50f 100644 --- a/src/game/joystick_ch_flightstick_pro.c +++ b/src/game/joystick_ch_flightstick_pro.c @@ -115,19 +115,19 @@ static void ch_flightstick_pro_a0_over(void *p) const joystick_if_t joystick_ch_flightstick_pro = { - "CH Flightstick Pro", - "ch_flightstick_pro", - ch_flightstick_pro_init, - ch_flightstick_pro_close, - ch_flightstick_pro_read, - ch_flightstick_pro_write, - ch_flightstick_pro_read_axis, - ch_flightstick_pro_a0_over, - 3, - 4, - 1, - 1, - {"X axis", "Y axis", "Throttle"}, - {"Button 1", "Button 2", "Button 3", "Button 4"}, - {"POV"} + .name = "CH Flightstick Pro", + .internal_name = "ch_flightstick_pro", + .init = ch_flightstick_pro_init, + .close = ch_flightstick_pro_close, + .read = ch_flightstick_pro_read, + .write = ch_flightstick_pro_write, + .read_axis = ch_flightstick_pro_read_axis, + .a0_over = ch_flightstick_pro_a0_over, + .axis_count = 3, + .button_count = 4, + .pov_count = 1, + .max_joysticks = 1, + .axis_names = { "X axis", "Y axis", "Throttle" }, + .button_names = { "Button 1", "Button 2", "Button 3", "Button 4" }, + .pov_names = { "POV" } }; diff --git a/src/game/joystick_standard.c b/src/game/joystick_standard.c index f091841b0..ce2a72664 100644 --- a/src/game/joystick_standard.c +++ b/src/game/joystick_standard.c @@ -236,122 +236,128 @@ static void joystick_standard_a0_over(void *p) { } -const joystick_if_t joystick_2axis_2button = -{ - "2-axis, 2-button joystick(s)", - "2axis_2button", - joystick_standard_init, - joystick_standard_close, - joystick_standard_read, - joystick_standard_write, - joystick_standard_read_axis, - joystick_standard_a0_over, - 2, - 2, - 0, - 2, - {"X axis", "Y axis"}, - {"Button 1", "Button 2"} +const joystick_if_t joystick_2axis_2button = { + .name = "2-axis, 2-button joystick(s)", + .internal_name = "2axis_2button", + .init = joystick_standard_init, + .close = joystick_standard_close, + .read = joystick_standard_read, + .write = joystick_standard_write, + .read_axis = joystick_standard_read_axis, + .a0_over = joystick_standard_a0_over, + .axis_count = 2, + .button_count = 2, + .pov_count = 0, + .max_joysticks = 2, + .axis_names = { "X axis", "Y axis" }, + .button_names = { "Button 1", "Button 2" }, + .pov_names = { NULL } }; -const joystick_if_t joystick_2axis_4button = -{ - "2-axis, 4-button joystick", - "2axis_4button", - joystick_standard_init, - joystick_standard_close, - joystick_standard_read_4button, - joystick_standard_write, - joystick_standard_read_axis_4button, - joystick_standard_a0_over, - 2, - 4, - 0, - 1, - {"X axis", "Y axis"}, - {"Button 1", "Button 2", "Button 3", "Button 4"} + +const joystick_if_t joystick_2axis_4button = { + .name = "2-axis, 4-button joystick", + .internal_name = "2axis_4button", + .init = joystick_standard_init, + .close = joystick_standard_close, + .read = joystick_standard_read_4button, + .write = joystick_standard_write, + .read_axis = joystick_standard_read_axis_4button, + .a0_over = joystick_standard_a0_over, + .axis_count = 2, + .button_count = 4, + .pov_count = 0, + .max_joysticks = 1, + .axis_names = { "X axis", "Y axis" }, + .button_names = { "Button 1", "Button 2", "Button 3", "Button 4" }, + .pov_names = { NULL } }; -const joystick_if_t joystick_3axis_2button = -{ - "3-axis, 2-button joystick", - "3axis_2button", - 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_2button = { + .name = "3-axis, 2-button joystick", + .internal_name = "3axis_2button", + .init = joystick_standard_init, + .close = joystick_standard_close, + .read = joystick_standard_read, + .write = joystick_standard_write, + .read_axis = joystick_standard_read_axis_3axis, + .a0_over = joystick_standard_a0_over, + .axis_count = 3, + .button_count = 2, + .pov_count = 0, + .max_joysticks = 1, + .axis_names = { "X axis", "Y axis", "Z axis" }, + .button_names = { "Button 1", "Button 2" }, + .pov_names = { NULL } }; -const joystick_if_t joystick_3axis_4button = -{ - "3-axis, 4-button joystick", - "3axis_4button", - 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_3axis_4button = { + .name = "3-axis, 4-button joystick", + .internal_name = "3axis_4button", + .init = joystick_standard_init, + .close = joystick_standard_close, + .read = joystick_standard_read_4button, + .write = joystick_standard_write, + .read_axis = joystick_standard_read_axis_3axis, + .a0_over = joystick_standard_a0_over, + .axis_count = 3, + .button_count = 4, + .pov_count = 0, + .max_joysticks = 1, + .axis_names = { "X axis", "Y axis", "Z axis" }, + .button_names = { "Button 1", "Button 2", "Button 3", "Button 4" }, + .pov_names = { NULL } }; -const joystick_if_t joystick_4axis_4button = -{ - "4-axis, 4-button joystick", - "4axis_4button", - joystick_standard_init, - joystick_standard_close, - joystick_standard_read_4button, - joystick_standard_write, - joystick_standard_read_axis_4axis, - joystick_standard_a0_over, - 4, - 4, - 0, - 1, - {"X axis", "Y axis", "Z axis", "zX axis"}, - {"Button 1", "Button 2", "Button 3", "Button 4"} + +const joystick_if_t joystick_4axis_4button = { + .name = "4-axis, 4-button joystick", + .internal_name = "4axis_4button", + .init = joystick_standard_init, + .close = joystick_standard_close, + .read = joystick_standard_read_4button, + .write = joystick_standard_write, + .read_axis = joystick_standard_read_axis_4axis, + .a0_over = joystick_standard_a0_over, + .axis_count = 4, + .button_count = 4, + .pov_count = 0, + .max_joysticks = 1, + .axis_names = { "X axis", "Y axis", "Z axis", "zX axis" }, + .button_names = { "Button 1", "Button 2", "Button 3", "Button 4" }, + .pov_names = { NULL } }; -const joystick_if_t joystick_2axis_6button = -{ - "2-axis, 6-button joystick", - "2axis_6button", - joystick_standard_init, - joystick_standard_close, - joystick_standard_read_4button, - joystick_standard_write, - joystick_standard_read_axis_6button, - joystick_standard_a0_over, - 2, - 6, - 0, - 1, - {"X axis", "Y axis"}, - {"Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6"} + +const joystick_if_t joystick_2axis_6button = { + .name = "2-axis, 6-button joystick", + .internal_name = "2axis_6button", + .init = joystick_standard_init, + .close = joystick_standard_close, + .read = joystick_standard_read_4button, + .write = joystick_standard_write, + .read_axis = joystick_standard_read_axis_6button, + .a0_over = joystick_standard_a0_over, + .axis_count = 2, + .button_count = 6, + .pov_count = 0, + .max_joysticks = 1, + .axis_names = { "X axis", "Y axis" }, + .button_names = { "Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6" }, + .pov_names = { NULL } }; -const joystick_if_t joystick_2axis_8button = -{ - "2-axis, 8-button joystick", - "2axis_8button", - joystick_standard_init, - joystick_standard_close, - joystick_standard_read_4button, - joystick_standard_write, - joystick_standard_read_axis_8button, - joystick_standard_a0_over, - 2, - 8, - 0, - 1, - {"X axis", "Y axis"}, - {"Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6", "Button 7", "Button 8"} + +const joystick_if_t joystick_2axis_8button = { + .name = "2-axis, 8-button joystick", + .internal_name = "2axis_8button", + .init = joystick_standard_init, + .close = joystick_standard_close, + .read = joystick_standard_read_4button, + .write = joystick_standard_write, + .read_axis = joystick_standard_read_axis_8button, + .a0_over = joystick_standard_a0_over, + .axis_count = 2, + .button_count = 8, + .pov_count = 0, + .max_joysticks = 1, + .axis_names = { "X axis", "Y axis" }, + .button_names = { "Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6", "Button 7", "Button 8" }, + .pov_names = { NULL } }; diff --git a/src/game/joystick_sw_pad.c b/src/game/joystick_sw_pad.c index 8c0235046..718eefbb4 100644 --- a/src/game/joystick_sw_pad.c +++ b/src/game/joystick_sw_pad.c @@ -262,20 +262,20 @@ static void sw_a0_over(void *p) timer_set_delay_u64(&sw->trigger_timer, TIMER_USEC * 10000); } -const joystick_if_t joystick_sw_pad = -{ - "Microsoft SideWinder Pad", - "sidewinder_pad", - sw_init, - sw_close, - sw_read, - sw_write, - sw_read_axis, - sw_a0_over, - 2, - 10, - 0, - 4, - {"X axis", "Y axis"}, - {"A", "B", "C", "X", "Y", "Z", "L", "R", "Start", "M"} +const joystick_if_t joystick_sw_pad = { + .name = "Microsoft SideWinder Pad", + .internal_name = "sidewinder_pad", + .init = sw_init, + .close = sw_close, + .read = sw_read, + .write = sw_write, + .read_axis = sw_read_axis, + .a0_over = sw_a0_over, + .axis_count = 2, + .button_count = 10, + .pov_count = 0, + .max_joysticks = 4, + .axis_names = { "X axis", "Y axis" }, + .button_names = { "A", "B", "C", "X", "Y", "Z", "L", "R", "Start", "M" }, + .pov_names = { NULL } }; diff --git a/src/game/joystick_tm_fcs.c b/src/game/joystick_tm_fcs.c index e3dbae1e3..ee83c5ad2 100644 --- a/src/game/joystick_tm_fcs.c +++ b/src/game/joystick_tm_fcs.c @@ -114,19 +114,19 @@ static void tm_fcs_a0_over(void *p) const joystick_if_t joystick_tm_fcs = { - "Thrustmaster Flight Control System", - "thrustmaster_fcs", - tm_fcs_init, - tm_fcs_close, - tm_fcs_read, - tm_fcs_write, - tm_fcs_read_axis, - tm_fcs_a0_over, - 2, - 4, - 1, - 1, - {"X axis", "Y axis"}, - {"Button 1", "Button 2", "Button 3", "Button 4"}, - {"POV"} + .name = "Thrustmaster Flight Control System", + .internal_name = "thrustmaster_fcs", + .init = tm_fcs_init, + .close = tm_fcs_close, + .read = tm_fcs_read, + .write = tm_fcs_write, + .read_axis = tm_fcs_read_axis, + .a0_over = tm_fcs_a0_over, + .axis_count = 2, + .button_count = 4, + .pov_count = 1, + .max_joysticks = 1, + .axis_names = { "X axis", "Y axis" }, + .button_names = { "Button 1", "Button 2", "Button 3", "Button 4" }, + .pov_names = { "POV" } }; diff --git a/src/include/86box/bswap.h b/src/include/86box/bswap.h index cd5a71425..9683c395d 100644 --- a/src/include/86box/bswap.h +++ b/src/include/86box/bswap.h @@ -73,20 +73,32 @@ ) #endif /*HAVE_BYTESWAP_H*/ +#if defined __has_builtin && __has_builtin(__builtin_bswap16) +#define bswap16(x) __builtin_bswap16(x) +#else static __inline uint16_t bswap16(uint16_t x) { return bswap_16(x); } +#endif +#if defined __has_builtin && __has_builtin(__builtin_bswap32) +#define bswap32(x) __builtin_bswap32(x) +#else static __inline uint32_t bswap32(uint32_t x) { return bswap_32(x); } +#endif +#if defined __has_builtin && __has_builtin(__builtin_bswap64) +#define bswap64(x) __builtin_bswap64(x) +#else static __inline uint64_t bswap64(uint64_t x) { return bswap_64(x); } +#endif static __inline void bswap16s(uint16_t *s) { diff --git a/src/include/86box/config.h b/src/include/86box/config.h index b630d0c80..41c9900ed 100644 --- a/src/include/86box/config.h +++ b/src/include/86box/config.h @@ -108,12 +108,12 @@ typedef struct { char network_host[520]; /* PCap device */ /* Ports category */ - char parallel_devices[3][32]; /* LPT device names */ + char parallel_devices[PARALLEL_MAX][32]; /* LPT device names */ #ifdef USE_SERIAL_DEVICES - char serial_devices[4][32]; /* Serial device names */ + char serial_devices[SERIAL_MAX][32]; /* Serial device names */ #endif - int serial_enabled[4], /* Serial ports 1 and 2 enabled */ - parallel_enabled[3]; /* LPT1, LPT2, LPT3 enabled */ + int serial_enabled[SERIAL_MAX], /* Serial ports 1, 2, 3, 4 enabled */ + parallel_enabled[PARALLEL_MAX]; /* LPT1, LPT2, LPT3, LPT4 enabled */ /* Other peripherals category */ int fdc_type, /* Floppy disk controller type */ diff --git a/src/include/86box/gameport.h b/src/include/86box/gameport.h index 4bd409d3d..48b07cca6 100644 --- a/src/include/86box/gameport.h +++ b/src/include/86box/gameport.h @@ -109,8 +109,15 @@ extern "C" { #ifdef EMU_DEVICE_H extern const device_t gameport_device; extern const device_t gameport_201_device; +extern const device_t gameport_203_device; +extern const device_t gameport_205_device; +extern const device_t gameport_207_device; extern const device_t gameport_208_device; extern const device_t gameport_209_device; +extern const device_t gameport_20b_device; +extern const device_t gameport_20d_device; +extern const device_t gameport_20f_device; +extern const device_t gameport_tm_acm_device; extern const device_t gameport_pnp_device; extern const device_t gameport_pnp_6io_device; extern const device_t gameport_sio_device; diff --git a/src/include/86box/hdc.h b/src/include/86box/hdc.h index 1008b38c9..3f8426dea 100644 --- a/src/include/86box/hdc.h +++ b/src/include/86box/hdc.h @@ -39,6 +39,9 @@ extern const device_t st506_xt_st11_r_device; /* st506_xt_st11_m */ extern const device_t st506_xt_wd1002a_wx1_device; /* st506_xt_wd1002a_wx1 */ extern const device_t st506_xt_wd1002a_27x_device; /* st506_xt_wd1002a_27x */ extern const device_t st506_at_wd1003_device; /* st506_at_wd1003 */ +extern const device_t st506_xt_wd1004a_wx1_device; /* st506_xt_wd1004a_wx1 */ +extern const device_t st506_xt_wd1004_27x_device; /* st506_xt_wd1004_27x */ +extern const device_t st506_xt_wd1004a_27x_device; /* st506_xt_wd1004a_27x */ extern const device_t esdi_at_wd1007vse1_device; /* esdi_at */ extern const device_t esdi_ps2_device; /* esdi_mca */ diff --git a/src/include/86box/hdc_ide.h b/src/include/86box/hdc_ide.h index d6914b905..8f1b3551a 100644 --- a/src/include/86box/hdc_ide.h +++ b/src/include/86box/hdc_ide.h @@ -19,6 +19,18 @@ #ifndef EMU_IDE_H # define EMU_IDE_H +#define HDC_PRIMARY_BASE 0x01F0 +#define HDC_PRIMARY_SIDE 0x03F6 +#define HDC_PRIMARY_IRQ 14 +#define HDC_SECONDARY_BASE 0x0170 +#define HDC_SECONDARY_SIDE 0x0376 +#define HDC_SECONDARY_IRQ 15 +#define HDC_TERTIARY_BASE 0x0168 +#define HDC_TERTIARY_SIDE 0x036E +#define HDC_TERTIARY_IRQ 10 +#define HDC_QUATERNARY_BASE 0x01E8 +#define HDC_QUATERNARY_SIDE 0x03EE +#define HDC_QUATERNARY_IRQ 11 enum { diff --git a/src/include/86box/lpt.h b/src/include/86box/lpt.h index ae1a63388..8ddf2c805 100644 --- a/src/include/86box/lpt.h +++ b/src/include/86box/lpt.h @@ -1,9 +1,26 @@ #ifndef EMU_LPT_H # define EMU_LPT_H +#define LPT1_ADDR 0x0378 +#define LPT1_IRQ 7 +#define LPT2_ADDR 0x0278 +#define LPT2_IRQ 5 +// LPT 1 on machines when installed +#define LPT_MDA_ADDR 0x03bc +#define LPT_MDA_IRQ 7 +#define LPT4_ADDR 0x0268 +#define LPT4_IRQ 5 +/* +#define LPT5_ADDR 0x027c +#define LPT5_IRQ 7 +#define LPT6_ADDR 0x026c +#define LPT6_IRQ 5 +*/ + typedef struct { const char *name; + const char *internal_name; void * (*init)(void *lpt); void (*close)(void *p); diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 4aee1fde0..7c9e8a437 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -706,6 +706,7 @@ extern int machine_xt_mpc1600_init(const machine_t *); extern int machine_xt_pcspirit_init(const machine_t *); extern int machine_xt_pc700_init(const machine_t *); extern int machine_xt_pc500_init(const machine_t *); +extern int machine_xt_vendex_init(const machine_t *); extern int machine_xt_znic_init(const machine_t *); extern int machine_xt_iskra3104_init(const machine_t *); diff --git a/src/include/86box/midi.h b/src/include/86box/midi.h index 3eec73234..01ec88881 100644 --- a/src/include/86box/midi.h +++ b/src/include/86box/midi.h @@ -6,26 +6,26 @@ extern uint8_t MIDI_InSysexBuf[SYSEX_SIZE]; extern uint8_t MIDI_evt_len[256]; -extern int midi_device_current; +extern int midi_output_device_current; extern int midi_input_device_current; extern void (*input_msg)(void *p, uint8_t *msg, uint32_t len); extern int (*input_sysex)(void *p, uint8_t *buf, uint32_t len, int abort); extern void *midi_in_p; -extern int midi_device_available(int card); +extern int midi_out_device_available(int card); extern int midi_in_device_available(int card); #ifdef EMU_DEVICE_H -const device_t *midi_device_getdevice(int card); +const device_t *midi_out_device_getdevice(int card); const device_t *midi_in_device_getdevice(int card); #endif -extern int midi_device_has_config(int card); +extern int midi_out_device_has_config(int card); extern int midi_in_device_has_config(int card); -extern char *midi_device_get_internal_name(int card); +extern char *midi_out_device_get_internal_name(int card); extern char *midi_in_device_get_internal_name(int card); -extern int midi_device_get_from_internal_name(char *s); +extern int midi_out_device_get_from_internal_name(char *s); extern int midi_in_device_get_from_internal_name(char *s); -extern void midi_device_init(); +extern void midi_out_device_init(); extern void midi_in_device_init(); typedef struct midi_device_t { @@ -56,11 +56,11 @@ typedef struct midi_t { midi_device_t *m_out_device, *m_in_device; } midi_t; -extern midi_t *midi, *midi_in; +extern midi_t *midi_out, *midi_in; -extern void midi_init(midi_device_t *device); +extern void midi_out_init(midi_device_t *device); extern void midi_in_init(midi_device_t *device, midi_t **mididev); -extern void midi_close(); +extern void midi_out_close(); extern void midi_in_close(void); extern void midi_raw_out_rt_byte(uint8_t val); extern void midi_raw_out_thru_rt_byte(uint8_t val); @@ -90,7 +90,7 @@ extern void midi_in_sysex(uint8_t *buffer, uint32_t len); #define MIDI_INPUT_INTERNAL_NAME "midi_in" #ifdef EMU_DEVICE_H -extern const device_t rtmidi_device; +extern const device_t rtmidi_output_device; extern const device_t rtmidi_input_device; # ifdef USE_FLUIDSYNTH extern const device_t fluidsynth_device; diff --git a/src/include/86box/midi_rtmidi.h b/src/include/86box/midi_rtmidi.h index d2d3869e3..fb2074302 100644 --- a/src/include/86box/midi_rtmidi.h +++ b/src/include/86box/midi_rtmidi.h @@ -5,8 +5,8 @@ extern "C" { #endif -extern int rtmidi_get_num_devs(void); -extern void rtmidi_get_dev_name(int num, char *s); +extern int rtmidi_out_get_num_devs(void); +extern void rtmidi_out_get_dev_name(int num, char *s); extern int rtmidi_in_get_num_devs(void); extern void rtmidi_in_get_dev_name(int num, char *s); diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index ee04d0e12..71ad89927 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -40,7 +40,7 @@ extern int stricmp(const char* s1, const char* s2); extern int strnicmp(const char* s1, const char* s2, size_t n); #endif -#if (defined(__unix__) || defined(__APPLE__)) && !defined(__linux__) +#if (defined(__HAIKU__) || defined(__unix__) || defined(__APPLE__)) && !defined(__linux__) /* FreeBSD has largefile by default. */ # define fopen64 fopen # define fseeko64 fseeko diff --git a/src/include/86box/serial.h b/src/include/86box/serial.h index 7770ebb1b..3378a91b5 100644 --- a/src/include/86box/serial.h +++ b/src/include/86box/serial.h @@ -35,14 +35,14 @@ #define SERIAL_FIFO_SIZE 16 /* Default settings for the standard ports. */ -#define SERIAL1_ADDR 0x03f8 -#define SERIAL1_IRQ 4 -#define SERIAL2_ADDR 0x02f8 -#define SERIAL2_IRQ 3 -#define SERIAL3_ADDR 0x03e8 -#define SERIAL3_IRQ 4 -#define SERIAL4_ADDR 0x02e8 -#define SERIAL4_IRQ 3 +#define COM1_ADDR 0x03f8 +#define COM1_IRQ 4 +#define COM2_ADDR 0x02f8 +#define COM2_IRQ 3 +#define COM3_ADDR 0x03e8 +#define COM3_IRQ 4 +#define COM4_ADDR 0x02e8 +#define COM4_IRQ 3 struct serial_device_s; diff --git a/src/ioapic.c b/src/ioapic.c index b899beec0..e308b9a1c 100644 --- a/src/ioapic.c +++ b/src/ioapic.c @@ -121,11 +121,15 @@ ioapic_init(const device_t *info) const device_t ioapic_device = { - "I/O Advanced Programmable Interrupt Controller", - "ioapic", - DEVICE_AT, - 0, - ioapic_init, ioapic_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "I/O Advanced Programmable Interrupt Controller", + .internal_name = "ioapic", + .flags = DEVICE_AT, + .local = 0, + .init = ioapic_init, + .close = ioapic_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/lpt.c b/src/lpt.c index fa8fa458f..df8276ae1 100644 --- a/src/lpt.c +++ b/src/lpt.c @@ -16,13 +16,24 @@ lpt_port_t lpt_ports[PARALLEL_MAX]; +const lpt_device_t lpt_none_device = { + .name = "None", + .internal_name = "none", + .init = NULL, + .close = NULL, + .write_data = NULL, + .write_ctrl = NULL, + .read_data = NULL, + .read_status = NULL, + .read_ctrl = NULL +}; static const struct { const char *internal_name; const lpt_device_t *device; } lpt_devices[] = { // clang-format off - {"none", NULL }, + {"none", &lpt_none_device }, {"dss", &dss_device }, {"lpt_dac", &lpt_dac_device }, {"lpt_dac_stereo", &lpt_dac_stereo_device }, @@ -39,31 +50,29 @@ char * lpt_device_get_name(int id) { if (strlen((char *) lpt_devices[id].internal_name) == 0) - return NULL; + return NULL; if (!lpt_devices[id].device) - return "None"; + return "None"; return (char *) lpt_devices[id].device->name; } - char * lpt_device_get_internal_name(int id) { if (strlen((char *) lpt_devices[id].internal_name) == 0) - return NULL; + return NULL; return (char *) lpt_devices[id].internal_name; } - int lpt_device_get_from_internal_name(char *s) { int c = 0; while (strlen((char *) lpt_devices[c].internal_name) != 0) { - if (strcmp(lpt_devices[c].internal_name, s) == 0) - return c; - c++; + if (strcmp(lpt_devices[c].internal_name, s) == 0) + return c; + c++; } return 0; @@ -78,7 +87,7 @@ lpt_devices_init(void) for (i = 0; i < PARALLEL_MAX; i++) { lpt_ports[i].dt = (lpt_device_t *) lpt_devices[lpt_ports[i].device].device; - if (lpt_ports[i].dt) + if (lpt_ports[i].dt && lpt_ports[i].dt->init) lpt_ports[i].priv = lpt_ports[i].dt->init(&lpt_ports[i]); } } @@ -93,7 +102,7 @@ lpt_devices_close(void) for (i = 0; i < PARALLEL_MAX; i++) { dev = &lpt_ports[i]; - if (dev->dt) + if (lpt_ports[i].dt && lpt_ports[i].dt->close) dev->dt->close(dev->priv); dev->dt = NULL; @@ -177,8 +186,8 @@ void lpt_init(void) { int i; - uint16_t default_ports[PARALLEL_MAX] = { 0x378, 0x278, 0x3bc, 0x268 }; /*, 0x27c, 0x26c }; */ - uint8_t default_irqs[PARALLEL_MAX] = { 7, 5, 7, 5 }; /* , 7, 5 }; */ + uint16_t default_ports[PARALLEL_MAX] = { LPT1_ADDR, LPT2_ADDR, LPT_MDA_ADDR, LPT4_ADDR }; + uint8_t default_irqs[PARALLEL_MAX] = { LPT1_IRQ, LPT2_IRQ, LPT_MDA_IRQ, LPT4_IRQ }; for (i = 0; i < PARALLEL_MAX; i++) { lpt_ports[i].addr = 0xffff; diff --git a/src/machine/m_amstrad.c b/src/machine/m_amstrad.c index 72cb73425..511855ce9 100644 --- a/src/machine/m_amstrad.c +++ b/src/machine/m_amstrad.c @@ -670,89 +670,73 @@ vid_speed_change_1512(void *priv) } -device_config_t vid_1512_config[] = -{ - { - "display_type", "Display type", CONFIG_SELECTION, "", 0, "", { 0 }, - { - { - "PC-CM (Colour)", 0 - }, - { - "PC-MM (Monochrome)", 3 - }, - { - "" - } - } - }, - { - "codepage", "Hardware font", CONFIG_SELECTION, "", 3, "", { 0 }, - { - { - "US English", 3 - }, - { - "Danish", 1 - }, - { - "Greek", 0 - }, - { - "" - } - } - }, - { - "language", "BIOS language", CONFIG_SELECTION, "", 7, "", { 0 }, - { - { - "English", 7 - }, - { - "German", 6 - }, - { - "French", 5 - }, - { - "Spanish", 4 - }, - { - "Danish", 3 - }, - { - "Swedish", 2 - }, - { - "Italian", 1 - }, - { - "Diagnostic mode", 0 - }, - { - "" - } - } - }, - { - "", "", -1 - } +device_config_t vid_1512_config[] = { + { + .name = "display_type", + .description = "Display type", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = 0, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "PC-CM (Colour)", .value = 0 }, + { .description = "PC-MM (Monochrome)", .value = 3 }, + { .description = "" } + } + }, + { + .name = "codepage", + .description = "Hardware font", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = 3, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "US English", .value = 3 }, + { .description = "Danish", .value = 1 }, + { .description = "Greek", .value = 0 }, + { .description = "" } + } + }, + { + .name = "language", + .description = "BIOS language", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = 7, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "English", .value = 7 }, + { .description = "German", .value = 6 }, + { .description = "French", .value = 5 }, + { .description = "Spanish", .value = 4 }, + { .description = "Danish", .value = 3 }, + { .description = "Swedish", .value = 2 }, + { .description = "Italian", .value = 1 }, + { .description = "Diagnostic mode", .value = 0 }, + { .description = "" } + } + }, + { .name = "", .description = "", .type = -1 } }; - static const device_t vid_1512_device = { - "Amstrad PC1512 (video)", - "vid_1512", - 0, 0, - NULL, vid_close_1512, NULL, - { NULL }, - vid_speed_change_1512, - NULL, - vid_1512_config + .name = "Amstrad PC1512 (video)", + .internal_name = "vid_1512", + .flags = 0, + .local = 0, + .init = NULL, + .close = vid_close_1512, + .reset = NULL, + { .available = NULL }, + .speed_changed = vid_speed_change_1512, + .force_redraw = NULL, + .config = vid_1512_config }; - const device_t * pc1512_get_device(void) { @@ -898,55 +882,42 @@ vid_speed_changed_1640(void *priv) recalc_timings_1640(vid); } - -device_config_t vid_1640_config[] = -{ - { - "language", "BIOS language", CONFIG_SELECTION, "", 7, "", { 0 }, - { - { - "English", 7 - }, - { - "German", 6 - }, - { - "French", 5 - }, - { - "Spanish", 4 - }, - { - "Danish", 3 - }, - { - "Swedish", 2 - }, - { - "Italian", 1 - }, - { - "Diagnostic mode", 0 - }, - { - "" - } - } - }, - { - "", "", -1 +device_config_t vid_1640_config[] = { + { + .name = "language", + .description = "BIOS language", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = 7, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "English", .value = 7 }, + { .description = "German", .value = 6 }, + { .description = "French", .value = 5 }, + { .description = "Spanish", .value = 4 }, + { .description = "Danish", .value = 3 }, + { .description = "Swedish", .value = 2 }, + { .description = "Italian", .value = 1 }, + { .description = "Diagnostic mode", .value = 0 }, + { .description = "" } } + }, + { .name = "", .description = "", .type = -1 } }; static const device_t vid_1640_device = { - "Amstrad PC1640 (video)", - "vid_1640", - 0, 0, - NULL, vid_close_1640, NULL, - { NULL }, - vid_speed_changed_1640, - NULL, - vid_1640_config + .name = "Amstrad PC1640 (video)", + .internal_name = "vid_1640", + .flags = 0, + .local = 0, + .init = NULL, + .close = vid_close_1640, + .reset = NULL, + { .available = NULL }, + .speed_changed = vid_speed_changed_1640, + .force_redraw = NULL, + .config = vid_1640_config }; const device_t * @@ -1744,330 +1715,276 @@ vid_close_200(void *priv) } -device_config_t vid_200_config[] = -{ - /* TODO: Should have options here for: - * - * > Display port (TTL or RF) - */ - { - "video_emulation", "Display type", CONFIG_SELECTION, "", PC200_CGA, "", { 0 }, - { - { - "CGA monitor", PC200_CGA - }, - { - "MDA monitor", PC200_MDA - }, - { - "Television", PC200_TV - }, - { - "" - } - } - }, - { - "display_type", "Monitor type", CONFIG_SELECTION, "", 0, "", { 0 }, - { - { - "RGB", 0 - }, - { - "RGB (no brown)", 4 - }, - { - "Green Monochrome", 1 - }, - { - "Amber Monochrome", 2 - }, - { - "White Monochrome", 3 - }, - { - "" - } - } - }, - { - "codepage", "Hardware font", CONFIG_SELECTION, "", 3, "", { 0 }, - { - { - "US English", 3 - }, - { - "Portugese", 2 - }, - { - "Norwegian", 1 - }, - { - "Greek", 0 - }, - { - "" - } - } - }, - { - "language", "BIOS language", CONFIG_SELECTION, "", 7, "", { 0 }, - { - { - "English", 7 - }, - { - "German", 6 - }, - { - "French", 5 - }, - { - "Spanish", 4 - }, - { - "Danish", 3 - }, - { - "Swedish", 2 - }, - { - "Italian", 1 - }, - { - "Diagnostic mode", 0 - }, - { - "" - } - } - }, - { - "", "", -1 +device_config_t vid_200_config[] = { + /* TODO: Should have options here for: + * + * > Display port (TTL or RF) + */ + { + .name = "video_emulation", + .description = "Display type", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = PC200_CGA, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "CGA monitor", .value = PC200_CGA }, + { .description = "MDA monitor", .value = PC200_MDA }, + { .description = "Television", .value = PC200_TV }, + { .description = "" } } + }, + { + .name = "display_type", + .description = "Monitor type", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = 0, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "RGB", .value = 0 }, + { .description = "RGB (no brown)", .value = 4 }, + { .description = "Green Monochrome", .value = 1 }, + { .description = "Amber Monochrome", .value = 2 }, + { .description = "White Monochrome", .value = 3 }, + { .description = "" } + } + }, + { + .name = "codepage", + .description = "Hardware font", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = 3, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "US English", .value = 3 }, + { .description = "Portugese", .value = 2 }, + { .description = "Norwegian", .value = 1 }, + { .description = "Greek", .value = 0 }, + { .description = "" } + } + }, + { + .name = "language", + .description = "BIOS language", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = 7, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "English", .value = 7 }, + { .description = "German", .value = 6 }, + { .description = "French", .value = 5 }, + { .description = "Spanish", .value = 4 }, + { .description = "Danish", .value = 3 }, + { .description = "Swedish", .value = 2 }, + { .description = "Italian", .value = 1 }, + { .description = "Diagnostic mode", .value = 0 }, + { .description = "" } + } + }, + { .name = "", .description = "", .type = -1 } }; - static const device_t vid_200_device = { - "Amstrad PC200 (video)", - "vid_200", - 0, 0, - NULL, vid_close_200, NULL, - { NULL }, - vid_speed_changed_200, - NULL, - vid_200_config + .name = "Amstrad PC200 (video)", + .internal_name = "vid_200", + .flags = 0, + .local = 0, + .init = NULL, + .close = vid_close_200, + .reset = NULL, + { .available = NULL }, + .speed_changed = vid_speed_changed_200, + .force_redraw = NULL, + .config = vid_200_config }; - const device_t * pc200_get_device(void) { return(&vid_200_device); } - -device_config_t vid_ppc512_config[] = -{ - /* TODO: Should have options here for: - * - * > Display port (TTL or RF) - */ - { - "video_emulation", "Display type", CONFIG_SELECTION, "", PC200_LCDC, "", { 0 }, - { - { - "CGA monitor", PC200_CGA - }, - { - "MDA monitor", PC200_MDA - }, - { - "LCD (CGA mode)", PC200_LCDC - }, - { - "LCD (MDA mode)", PC200_LCDM - }, - { - "" - } - }, - }, - { - "display_type", "Monitor type", CONFIG_SELECTION, "", 0, "", { 0 }, - { - { - "RGB", 0 - }, - { - "RGB (no brown)", 4 - }, - { - "Green Monochrome", 1 - }, - { - "Amber Monochrome", 2 - }, - { - "White Monochrome", 3 - }, - { - "" - } - }, +device_config_t vid_ppc512_config[] = { + /* TODO: Should have options here for: + * + * > Display port (TTL or RF) + */ + { + .name = "video_emulation", + .description = "Display type", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = PC200_LCDC, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "CGA monitor", .value = PC200_CGA }, + { .description = "MDA monitor", .value = PC200_MDA }, + { .description = "LCD (CGA mode)", .value = PC200_LCDC }, + { .description = "LCD (MDA mode)", .value = PC200_LCDM }, + { .description = "" } }, - { - "codepage", "Hardware font", CONFIG_SELECTION, "", 3, "", { 0 }, - { - { - "US English", 3 - }, - { - "Portugese", 2 - }, - { - "Norwegian",1 - }, - { - "Greek", 0 - }, - { - "" - } - }, + }, + { + .name = "display_type", + .description = "Monitor type", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = 0, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "RGB", .value = 0 }, + { .description = "RGB (no brown)", .value = 4 }, + { .description = "Green Monochrome", .value = 1 }, + { .description = "Amber Monochrome", .value = 2 }, + { .description = "White Monochrome", .value = 3 }, + { .description = "" } }, - { - "language", "BIOS language", CONFIG_SELECTION, "", 7, "", { 0 }, - { - { - "English", 7 - }, - { - "German", 6 - }, - { - "French", 5 - }, - { - "Spanish", 4 - }, - { - "Danish", 3 - }, - { - "Swedish", 2 - }, - { - "Italian", 1 - }, - { - "Diagnostic mode", 0 - }, - { - "" - } - } - }, - { - "invert", "Invert LCD colors", CONFIG_BINARY, "", 0 - }, - { - "", "", -1 + }, + { + .name = "codepage", + .description = "Hardware font", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = 3, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "US English", .value = 3 }, + { .description = "Portugese", .value = 2 }, + { .description = "Norwegian", .value = 1 }, + { .description = "Greek", .value = 0 }, + { .description = "" } + }, + }, + { + .name = "language", + .description = "BIOS language", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = 7, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "English", .value = 7 }, + { .description = "German", .value = 6 }, + { .description = "French", .value = 5 }, + { .description = "Spanish", .value = 4 }, + { .description = "Danish", .value = 3 }, + { .description = "Swedish", .value = 2 }, + { .description = "Italian", .value = 1 }, + { .description = "Diagnostic mode", .value = 0 }, + { .description = "" } } + }, + { + .name = "invert", + .description = "Invert LCD colors", + .type = CONFIG_BINARY, + .default_string = "", + .default_int = 0 + }, + { .name = "", .description = "", .type = -1 } }; static const device_t vid_ppc512_device = { - "Amstrad PPC512 (video)", - "vid_ppc512", - 0, 0, - NULL, vid_close_200, NULL, - { NULL }, - vid_speed_changed_200, - NULL, - vid_ppc512_config + .name = "Amstrad PPC512 (video)", + .internal_name = "vid_ppc512", + .flags = 0, + .local = 0, + .init = NULL, + .close = vid_close_200, + .reset = NULL, + { .available = NULL }, + .speed_changed = vid_speed_changed_200, + .force_redraw = NULL, + .config = vid_ppc512_config }; - const device_t * ppc512_get_device(void) { return(&vid_ppc512_device); } - -device_config_t vid_pc2086_config[] = -{ - { - "language", "BIOS language", CONFIG_SELECTION, "", 7, "", { 0 }, - { - { - "English", 7 - }, - { - "Diagnostic mode", 0 - }, - { - "" - } - } - }, - { - "", "", -1 +device_config_t vid_pc2086_config[] = { + { + .name = "language", + .description = "BIOS language", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = 7, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "English", .value = 7 }, + { .description = "Diagnostic mode", .value = 0 }, + { .description = "" } } + }, + { "", "", -1 } }; static const device_t vid_pc2086_device = { - "Amstrad PC2086", - "vid_pc2086", - 0, 0, - NULL, NULL, NULL, - { NULL }, - NULL, - NULL, - vid_pc2086_config + .name = "Amstrad PC2086", + .internal_name = "vid_pc2086", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = vid_pc2086_config }; - const device_t * pc2086_get_device(void) { return(&vid_pc2086_device); } - -device_config_t vid_pc3086_config[] = -{ - { - "language", "BIOS language", CONFIG_SELECTION, "", 7, "", { 0 }, - { - { - "English", 7 - }, - { - "Diagnostic mode", 3 - }, - { - "" - } - } - }, - { - "", "", -1 +device_config_t vid_pc3086_config[] = { + { + .name = "language", + .description = "BIOS language", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = 7, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "English", .value = 7 }, + { .description = "Diagnostic mode", .value = 3 }, + { .description = "" } } + }, + { .name = "", .description = "", .type = -1 } }; static const device_t vid_pc3086_device = { - "Amstrad PC3086", - "vid_pc3086", - 0, 0, - NULL, NULL, NULL, - { NULL }, - NULL, - NULL, - vid_pc3086_config + .name = "Amstrad PC3086", + .internal_name = "vid_pc3086", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = vid_pc3086_config }; - const device_t * pc3086_get_device(void) { diff --git a/src/machine/m_at_commodore.c b/src/machine/m_at_commodore.c index 8aa75059f..f9afdd1ef 100644 --- a/src/machine/m_at_commodore.c +++ b/src/machine/m_at_commodore.c @@ -65,22 +65,22 @@ cbm_io_write(uint16_t port, uint8_t val, void *p) switch (val & 3) { case 1: - lpt1_init(0x3bc); + lpt1_init(LPT_MDA_ADDR); break; case 2: - lpt1_init(0x378); + lpt1_init(LPT1_ADDR); break; case 3: - lpt1_init(0x278); + lpt1_init(LPT2_ADDR); break; } switch (val & 0xc) { case 0x4: - serial_setup(cmd_uart, 0x2f8, 3); + serial_setup(cmd_uart, COM2_ADDR, COM2_IRQ); break; case 0x8: - serial_setup(cmd_uart, 0x3f8, 4); + serial_setup(cmd_uart, COM1_ADDR, COM1_IRQ); break; } } diff --git a/src/machine/m_at_compaq.c b/src/machine/m_at_compaq.c index 72c29ec07..41316bd50 100644 --- a/src/machine/m_at_compaq.c +++ b/src/machine/m_at_compaq.c @@ -670,77 +670,67 @@ compaq_plasma_speed_changed(void *p) compaq_plasma_recalctimings(self); } -const device_config_t compaq_plasma_config[] = -{ - { - "display_type", "Display type", CONFIG_SELECTION, "", CGA_RGB, "", { 0 }, - { - { - "RGB", CGA_RGB - }, - { - "Composite", CGA_COMPOSITE - }, - { - "" - } - } - }, - { - "composite_type", "Composite type", CONFIG_SELECTION, "", COMPOSITE_OLD, "", { 0 }, - { - { - "Old", COMPOSITE_OLD - }, - { - "New", COMPOSITE_NEW - }, - { - "" - } - } - }, - { - "rgb_type", "RGB type", CONFIG_SELECTION, "", 0, "", { 0 }, - { - { - "Color", 0 - }, - { - "Green Monochrome", 1 - }, - { - "Amber Monochrome", 2 - }, - { - "Gray Monochrome", 3 - }, - { - "Color (no brown)", 4 - }, - { - "" - } - } - }, - { - "", "", -1 +const device_config_t compaq_plasma_config[] = { + { + .name = "display_type", + .description = "Display type", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = CGA_RGB, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "RGB", .value = CGA_RGB }, + { .description = "Composite", .value = CGA_COMPOSITE }, + { .description = "" } } + }, + { + .name = "composite_type", + .description = "Composite type", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = COMPOSITE_OLD, + .file_filter = "", + .spinner = { 0 }, + { + { .description = "Old", .value = COMPOSITE_OLD }, + { .description = "New", .value = COMPOSITE_NEW }, + { .description = "" } + } + }, + { + .name = "rgb_type", + .description = "RGB type", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = 0, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "Color", .value = 0 }, + { .description = "Green Monochrome", .value = 1 }, + { .description = "Amber Monochrome", .value = 2 }, + { .description = "Gray Monochrome", .value = 3 }, + { .description = "Color (no brown)", .value = 4 }, + { .description = "" } + } + }, + { .name = "", .description = "", .type = -1 } }; - -static const device_t compaq_plasma_device = -{ - "Compaq Plasma", - "compaq_plasma", - 0, 0, - compaq_plasma_init, - compaq_plasma_close, - NULL, - { NULL }, - compaq_plasma_speed_changed, - NULL, - compaq_plasma_config +static const device_t compaq_plasma_device = { + .name = "Compaq Plasma", + .internal_name = "compaq_plasma", + .flags = 0, + .local = 0, + .init = compaq_plasma_init, + .close = compaq_plasma_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = compaq_plasma_speed_changed, + .force_redraw = NULL, + .config = compaq_plasma_config }; static uint8_t diff --git a/src/machine/m_at_t3100e_vid.c b/src/machine/m_at_t3100e_vid.c index 045ad7d61..88aaabdec 100644 --- a/src/machine/m_at_t3100e_vid.c +++ b/src/machine/m_at_t3100e_vid.c @@ -757,16 +757,16 @@ void t3100e_speed_changed(void *p) t3100e_recalctimings(t3100e); } -const device_t t3100e_device = -{ - "Toshiba T3100e", - "t3100e", - 0, - 0, - t3100e_init, - t3100e_close, - NULL, - { NULL }, - t3100e_speed_changed, - NULL +const device_t t3100e_device = { + .name = "Toshiba T3100e", + .internal_name = "t3100e", + .flags = 0, + .local = 0, + .init = t3100e_init, + .close = t3100e_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = t3100e_speed_changed, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/machine/m_europc.c b/src/machine/m_europc.c index 4c2f5f0b3..921feda2b 100644 --- a/src/machine/m_europc.c +++ b/src/machine/m_europc.c @@ -666,38 +666,38 @@ europc_close(void *priv) free(nvr->fn); } - static const device_config_t europc_config[] = { { - "js9", "JS9 Jumper (JIM)", CONFIG_INT, "", 0, "", { 0 }, - { - { - "Disabled (250h)", 0 - }, - { - "Enabled (350h)", 1 - }, - { - "" - } - }, + .name = "js9", + .description = "JS9 Jumper (JIM)", + .type = CONFIG_INT, + .default_string = "", + .default_int = 0, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "Disabled (250h)", .value = 0 }, + { .description = "Enabled (350h)", .value = 1 }, + { "" } + }, }, - { - "", "", -1 - } + { .name = "", .description = "", .type = -1 } }; - const device_t europc_device = { - "EuroPC System Board", - "europc", - 0, 0, - europc_boot, europc_close, NULL, - { NULL }, NULL, NULL, - europc_config + .name = "EuroPC System Board", + .internal_name = "europc", + .flags = 0, + .local = 0, + .init = europc_boot, + .close = europc_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = europc_config }; - /* * This function sets up the Scheider EuroPC machine. * diff --git a/src/machine/m_pcjr.c b/src/machine/m_pcjr.c index b38b70d44..c6b38d572 100644 --- a/src/machine/m_pcjr.c +++ b/src/machine/m_pcjr.c @@ -769,40 +769,38 @@ speed_changed(void *priv) recalc_timings(pcjr); } - static const device_config_t pcjr_config[] = { { - "display_type", "Display type", CONFIG_SELECTION, "", PCJR_RGB, "", { 0 }, - { - { - "RGB", PCJR_RGB - }, - { - "Composite", PCJR_COMPOSITE - }, - { - "" - } - } + .name = "display_type", + .description = "Display type", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = PCJR_RGB, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "RGB", .value = PCJR_RGB }, + { .description = "Composite", .value = PCJR_COMPOSITE }, + { .description = "" } + } }, - { - "", "", -1 - } + { .name = "", .description = "", .type = -1 } }; - static const device_t pcjr_device = { "IBM PCjr", "pcjr", - 0, 0, - NULL, NULL, NULL, + 0, + 0, + NULL, + NULL, + NULL, { NULL }, speed_changed, NULL, pcjr_config }; - const device_t * pcjr_get_device(void) { diff --git a/src/machine/m_ps1.c b/src/machine/m_ps1.c index e63ef6ff9..0b0182692 100644 --- a/src/machine/m_ps1.c +++ b/src/machine/m_ps1.c @@ -145,21 +145,21 @@ ps1_write(uint16_t port, uint8_t val, void *priv) serial_remove(ps->uart); if (val & 0x04) { if (val & 0x08) - serial_setup(ps->uart, SERIAL1_ADDR, SERIAL1_IRQ); + serial_setup(ps->uart, COM1_ADDR, COM1_IRQ); else - serial_setup(ps->uart, SERIAL2_ADDR, SERIAL2_IRQ); + serial_setup(ps->uart, COM2_ADDR, COM2_IRQ); } if (val & 0x10) { switch ((val >> 5) & 3) { case 0: - lpt1_init(0x3bc); + lpt1_init(LPT_MDA_ADDR); break; case 1: - lpt1_init(0x378); + lpt1_init(LPT1_ADDR); break; case 2: - lpt1_init(0x278); + lpt1_init(LPT2_ADDR); break; } } @@ -270,7 +270,7 @@ ps1_setup(int model) ps->uart = device_add_inst(&ns16450_device, 1); lpt1_remove(); - lpt1_init(0x3bc); + lpt1_init(LPT_MDA_ADDR); mem_remap_top(384); diff --git a/src/machine/m_ps1_hdc.c b/src/machine/m_ps1_hdc.c index e08e0e198..5cba0e8b5 100644 --- a/src/machine/m_ps1_hdc.c +++ b/src/machine/m_ps1_hdc.c @@ -1349,18 +1349,20 @@ ps1_hdc_close(void *priv) free(dev); } - const device_t ps1_hdc_device = { - "PS/1 2011 Fixed Disk Controller", - "ps1_hdc", - DEVICE_ISA | DEVICE_PS2, - 0, - ps1_hdc_init, ps1_hdc_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "PS/1 2011 Fixed Disk Controller", + .internal_name = "ps1_hdc", + .flags = DEVICE_ISA | DEVICE_PS2, + .local = 0, + .init = ps1_hdc_init, + .close = ps1_hdc_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - /* * Very nasty. * diff --git a/src/machine/m_ps2_isa.c b/src/machine/m_ps2_isa.c index 2604327ab..c39c4eb92 100644 --- a/src/machine/m_ps2_isa.c +++ b/src/machine/m_ps2_isa.c @@ -90,21 +90,21 @@ static void ps2_write(uint16_t port, uint8_t val, void *p) serial_remove(ps2_uart); if (val & 0x04) { if (val & 0x08) - serial_setup(ps2_uart, SERIAL1_ADDR, SERIAL1_IRQ); + serial_setup(ps2_uart, COM1_ADDR, COM1_IRQ); else - serial_setup(ps2_uart, SERIAL2_ADDR, SERIAL2_IRQ); + serial_setup(ps2_uart, COM2_ADDR, COM2_IRQ); } if (val & 0x10) { switch ((val >> 5) & 3) { case 0: - lpt1_init(0x3bc); + lpt1_init(LPT_MDA_ADDR); break; case 1: - lpt1_init(0x378); + lpt1_init(LPT1_ADDR); break; case 2: - lpt1_init(0x278); + lpt1_init(LPT2_ADDR); break; } } @@ -159,7 +159,7 @@ static void ps2board_init(void) ps2_uart = device_add_inst(&ns16450_device, 1); - lpt1_init(0x3bc); + lpt1_init(LPT_MDA_ADDR); memset(&ps2_hd, 0, sizeof(ps2_hd)); } diff --git a/src/machine/m_ps2_mca.c b/src/machine/m_ps2_mca.c index 36a0d7f0f..f74f03dad 100644 --- a/src/machine/m_ps2_mca.c +++ b/src/machine/m_ps2_mca.c @@ -359,22 +359,22 @@ static void model_50_write(uint16_t port, uint8_t val) if (val & 0x04) { if (val & 0x08) - serial_setup(ps2.uart, SERIAL1_ADDR, SERIAL1_IRQ); + serial_setup(ps2.uart, COM1_ADDR, COM1_IRQ); else - serial_setup(ps2.uart, SERIAL2_ADDR, SERIAL2_IRQ); + serial_setup(ps2.uart, COM2_ADDR, COM2_IRQ); } if (val & 0x10) { switch ((val >> 5) & 3) { case 0: - lpt1_init(0x3bc); + lpt1_init(LPT_MDA_ADDR); break; case 1: - lpt1_init(0x378); + lpt1_init(LPT1_ADDR); break; case 2: - lpt1_init(0x278); + lpt1_init(LPT2_ADDR); break; } } @@ -492,22 +492,22 @@ static void model_55sx_write(uint16_t port, uint8_t val) if (val & 0x04) { if (val & 0x08) - serial_setup(ps2.uart, SERIAL1_ADDR, SERIAL1_IRQ); + serial_setup(ps2.uart, COM1_ADDR, COM1_IRQ); else - serial_setup(ps2.uart, SERIAL2_ADDR, SERIAL2_IRQ); + serial_setup(ps2.uart, COM2_ADDR, COM2_IRQ); } if (val & 0x10) { switch ((val >> 5) & 3) { case 0: - lpt1_init(0x3bc); + lpt1_init(LPT_MDA_ADDR); break; case 1: - lpt1_init(0x378); + lpt1_init(LPT1_ADDR); break; case 2: - lpt1_init(0x278); + lpt1_init(LPT2_ADDR); break; } } @@ -552,22 +552,22 @@ static void model_70_type3_write(uint16_t port, uint8_t val) if (val & 0x04) { if (val & 0x08) - serial_setup(ps2.uart, SERIAL1_ADDR, SERIAL1_IRQ); + serial_setup(ps2.uart, COM1_ADDR, COM1_IRQ); else - serial_setup(ps2.uart, SERIAL2_ADDR, SERIAL2_IRQ); + serial_setup(ps2.uart, COM2_ADDR, COM2_IRQ); } if (val & 0x10) { switch ((val >> 5) & 3) { case 0: - lpt1_init(0x3bc); + lpt1_init(LPT_MDA_ADDR); break; case 1: - lpt1_init(0x378); + lpt1_init(LPT1_ADDR); break; case 2: - lpt1_init(0x278); + lpt1_init(LPT2_ADDR); break; } } @@ -608,22 +608,22 @@ static void model_80_write(uint16_t port, uint8_t val) if (val & 0x04) { if (val & 0x08) - serial_setup(ps2.uart, SERIAL1_ADDR, SERIAL1_IRQ); + serial_setup(ps2.uart, COM1_ADDR, COM1_IRQ); else - serial_setup(ps2.uart, SERIAL2_ADDR, SERIAL2_IRQ); + serial_setup(ps2.uart, COM2_ADDR, COM2_IRQ); } if (val & 0x10) { switch ((val >> 5) & 3) { case 0: - lpt1_init(0x3bc); + lpt1_init(LPT_MDA_ADDR); break; case 1: - lpt1_init(0x378); + lpt1_init(LPT1_ADDR); break; case 2: - lpt1_init(0x278); + lpt1_init(LPT2_ADDR); break; } } @@ -832,7 +832,7 @@ static void ps2_mca_board_common_init() ps2.setup = 0xff; - lpt1_init(0x3bc); + lpt1_init(LPT_MDA_ADDR); } static uint8_t ps2_mem_expansion_read(int port, void *p) diff --git a/src/machine/m_tandy.c b/src/machine/m_tandy.c index 293919c50..894cae784 100644 --- a/src/machine/m_tandy.c +++ b/src/machine/m_tandy.c @@ -1144,59 +1144,64 @@ vid_init(tandy_t *dev) static const device_config_t vid_config[] = { { - "display_type", "Display type", CONFIG_SELECTION, "", TANDY_RGB, "", { 0 }, - { - { - "RGB", TANDY_RGB - }, - { - "Composite", TANDY_COMPOSITE - }, - { - "" - } - } + .name = "display_type", + .description = "Display type", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = TANDY_RGB, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "RGB", .value = TANDY_RGB }, + { .description = "Composite", .value = TANDY_COMPOSITE }, + { .description = "" } + } }, - { - "", "", -1 - } + { .name = "", .description = "", .type = -1 } }; - static const device_t vid_device = { - "Tandy 1000", - "tandy1000_video", - 0, 0, - NULL, vid_close, NULL, - { NULL }, - vid_speed_changed, - NULL, - vid_config + .name = "Tandy 1000", + .internal_name = "tandy1000_video", + .flags = 0, + .local = 0, + .init = NULL, + .close = vid_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = vid_speed_changed, + .force_redraw = NULL, + .config = vid_config }; static const device_t vid_device_hx = { - "Tandy 1000 HX", - "tandy1000_hx_video", - 0, 0, - NULL, vid_close, NULL, - { NULL }, - vid_speed_changed, - NULL, - vid_config + .name = "Tandy 1000 HX", + .internal_name = "tandy1000_hx_video", + .flags = 0, + .local = 0, + .init = NULL, + .close = vid_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = vid_speed_changed, + .force_redraw = NULL, + .config = vid_config }; static const device_t vid_device_sl = { - "Tandy 1000SL2", - "tandy1000_sl_video", - 0, 1, - NULL, vid_close, NULL, - { NULL }, - vid_speed_changed, - NULL, - NULL + .name = "Tandy 1000SL2", + .internal_name = "tandy1000_sl_video", + .flags = 0, + .local = 1, + .init = NULL, + .close = vid_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = vid_speed_changed, + .force_redraw = NULL, + .config = NULL }; - const device_t * tandy1k_get_device(void) { @@ -1344,27 +1349,34 @@ eep_close(void *priv) free(eep); } - static const device_t eep_1000hx_device = { - "Tandy 1000HX EEPROM", - "eep_1000hx", - 0, TYPE_TANDY1000HX, - eep_init, eep_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Tandy 1000HX EEPROM", + .internal_name = "eep_1000hx", + .flags = 0, + .local = TYPE_TANDY1000HX, + .init = eep_init, + .close = eep_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - static const device_t eep_1000sl2_device = { - "Tandy 1000SL2 EEPROM", - "eep_1000sl2", - 0, TYPE_TANDY1000SL2, - eep_init, eep_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Tandy 1000SL2 EEPROM", + .internal_name = "eep_1000sl2", + .flags = 0, + .local = TYPE_TANDY1000SL2, + .init = eep_init, + .close = eep_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - static void tandy_write(uint16_t addr, uint8_t val, void *priv) { diff --git a/src/machine/m_xt.c b/src/machine/m_xt.c index ae580c591..dd7ba507f 100644 --- a/src/machine/m_xt.c +++ b/src/machine/m_xt.c @@ -437,3 +437,22 @@ machine_xt_pc500_init(const machine_t* model) return ret; } + +int +machine_xt_vendex_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear("roms/machines/vendex/Vendex Turbo 888 XT - ROM BIOS - VER 2.03C.bin", + 0x000fc000, 16384, 0); + + if (bios_only || !ret) + return ret; + + machine_xt_clone_init(model); + + /* On-board FDC cannot be disabled */ + device_add(&fdc_xt_device); + + return ret; +} diff --git a/src/machine/m_xt_compaq.c b/src/machine/m_xt_compaq.c index 5950ec3f9..bd355a161 100644 --- a/src/machine/m_xt_compaq.c +++ b/src/machine/m_xt_compaq.c @@ -59,7 +59,7 @@ machine_xt_compaq_deskpro_init(const machine_t *model) standalone_gameport_type = &gameport_device; lpt1_remove(); - lpt1_init(0x03bc); + lpt1_init(LPT_MDA_ADDR); return ret; } @@ -88,7 +88,7 @@ machine_xt_compaq_portable_init(const machine_t *model) device_add(&gameport_device); lpt1_remove(); - lpt1_init(0x03bc); + lpt1_init(LPT_MDA_ADDR); return ret; } diff --git a/src/machine/m_xt_olivetti.c b/src/machine/m_xt_olivetti.c index bb6ae7db5..9cb6bfc68 100644 --- a/src/machine/m_xt_olivetti.c +++ b/src/machine/m_xt_olivetti.c @@ -588,56 +588,59 @@ m19_vid_init(m19_vid_t *vid) const device_t m24_kbd_device = { - "Olivetti M24 keyboard and mouse", - "m24_kbd", - 0, - 0, - NULL, - m24_kbd_close, - m24_kbd_reset, - { NULL }, NULL, NULL + .name = "Olivetti M24 keyboard and mouse", + .internal_name = "m24_kbd", + .flags = 0, + .local = 0, + .init = NULL, + .close = m24_kbd_close, + .reset = m24_kbd_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_config_t m19_vid_config[] = -{ - { - /* Olivetti / ATT compatible displays */ - "rgb_type", "RGB type", CONFIG_SELECTION, "", CGA_RGB, "", { 0 }, - { - { - "Color", 0 - }, - { - "Green Monochrome", 1 - }, - { - "Amber Monochrome", 2 - }, - { - "Gray Monochrome", 3 - }, - { - "" - } - } - }, - { - "snow_enabled", "Snow emulation", CONFIG_BINARY, "", 1, - }, - { - "", "", -1 +const device_config_t m19_vid_config[] = { + { + /* Olivetti / ATT compatible displays */ + .name = "rgb_type", + .description = "RGB type", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = CGA_RGB, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { .description = "Color", .value = 0 }, + { .description = "Green Monochrome", .value = 1 }, + { .description = "Amber Monochrome", .value = 2 }, + { .description = "Gray Monochrome", .value = 3 }, + { .description = "" } } + }, + { + .name = "snow_enabled", + .description = "Snow emulation", + .type = CONFIG_BINARY, + .default_string = "", + .default_int = 1, + }, + { .name = "", .description = "", .type = -1 } }; const device_t m19_vid_device = { - "Olivetti M19 graphics card", - "m19_vid", - 0, 0, - NULL, m19_vid_close, NULL, - { NULL }, - m19_vid_speed_changed, - NULL, - m19_vid_config + .name = "Olivetti M19 graphics card", + .internal_name = "m19_vid", + .flags = 0, + .local = 0, + .init = NULL, + .close = m19_vid_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = m19_vid_speed_changed, + .force_redraw = NULL, + .config = m19_vid_config }; const device_t * diff --git a/src/machine/m_xt_philips.c b/src/machine/m_xt_philips.c index e3d23deb7..cafccf061 100644 --- a/src/machine/m_xt_philips.c +++ b/src/machine/m_xt_philips.c @@ -134,16 +134,19 @@ philips_init(const device_t *info) } const device_t philips_device = { - "Philips XT Mainboard", - "philips", - 0, - 0, - philips_init, philips_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Philips XT Mainboard", + .internal_name = "philips", + .flags = 0, + .local = 0, + .init = philips_init, + .close = philips_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - void machine_xt_philips_common_init(const machine_t *model) { diff --git a/src/machine/m_xt_t1000_vid.c b/src/machine/m_xt_t1000_vid.c index 158990984..b2dcce64d 100644 --- a/src/machine/m_xt_t1000_vid.c +++ b/src/machine/m_xt_t1000_vid.c @@ -740,56 +740,64 @@ static void t1000_speed_changed(void *p) t1000_recalctimings(t1000); } -static const device_config_t t1000_config[] = -{ - { - .name = "display_language", - .description = "Language", - .type = CONFIG_SELECTION, - .selection = - { - { - .description = "USA", - .value = 0 - }, - { - .description = "Danish", - .value = 1 - } - }, - .default_int = 0 - }, - { - "backlight", "Enable backlight", CONFIG_BINARY, "", 1 - }, - { - "invert", "Invert colors", CONFIG_BINARY, "", 0 - }, - { - .type = -1 - } +static const device_config_t t1000_config[] = { + { + .name = "display_language", + .description = "Language", + .type = CONFIG_SELECTION, + .selection = + { + { + .description = "USA", + .value = 0 + }, + { + .description = "Danish", + .value = 1 + } + }, + .default_int = 0 + }, + { + .name = "backlight", + .description = "Enable backlight", + .type = CONFIG_BINARY, + .default_string = "", + .default_int = 1 }, + { + .name = "invert", + .description = "Invert colors", + .type = CONFIG_BINARY, + .default_string = "", + .default_int = 0 + }, + { .type = -1 } }; - const device_t t1000_video_device = { - "Toshiba T1000 Video", - "t1000_video", - 0, 0, - t1000_init, t1000_close, NULL, - { NULL }, - t1000_speed_changed, - NULL, - t1000_config + .name = "Toshiba T1000 Video", + .internal_name = "t1000_video", + .flags = 0, + .local = 0, + .init = t1000_init, + .close = t1000_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = t1000_speed_changed, + .force_redraw = NULL, + .config = t1000_config }; - const device_t t1200_video_device = { - "Toshiba T1200 Video", - "t1200_video", - 0, 0, - t1000_init, t1000_close, NULL, - { NULL }, - t1000_speed_changed, - NULL, - t1000_config + .name = "Toshiba T1200 Video", + .internal_name = "t1200_video", + .flags = 0, + .local = 0, + .init = t1000_init, + .close = t1000_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = t1000_speed_changed, + .force_redraw = NULL, + .config = t1000_config }; diff --git a/src/machine/m_xt_xi8088.c b/src/machine/m_xt_xi8088.c index bb56b3486..ea778a023 100644 --- a/src/machine/m_xt_xi8088.c +++ b/src/machine/m_xt_xi8088.c @@ -91,101 +91,92 @@ xi8088_init(const device_t *info) return &xi8088; } - -static const device_config_t xi8088_config[] = -{ - { - .name = "turbo_setting", - .description = "Turbo", - .type = CONFIG_SELECTION, - .selection = - { - { - .description = "Always at selected speed", - .value = 0 - }, - { - .description = "BIOS setting + Hotkeys (off during POST)", - .value = 1 - } - }, - .default_int = 0 +static const device_config_t xi8088_config[] = { + { + .name = "turbo_setting", + .description = "Turbo", + .type = CONFIG_SELECTION, + .selection = { + { + .description = "Always at selected speed", + .value = 0 + }, + { + .description = "BIOS setting + Hotkeys (off during POST)", + .value = 1 + } }, - { - .name = "bios_128kb", - .description = "BIOS size", - .type = CONFIG_SELECTION, - .selection = - { - { - .description = "64KB starting from 0xF0000", - .value = 0 - }, - { - .description = "128KB starting from 0xE0000 (address MSB inverted, last 64KB first)", - .value = 1 - } - }, - .default_int = 1 + .default_int = 0 + }, + { + .name = "bios_128kb", + .description = "BIOS size", + .type = CONFIG_SELECTION, + .selection = { + { + .description = "64KB starting from 0xF0000", + .value = 0 + }, + { + .description = "128KB starting from 0xE0000 (address MSB inverted, last 64KB first)", + .value = 1 + } }, - { - .name = "umb_c0000h_c7fff", - .description = "Map 0xc0000-0xc7fff as UMB", - .type = CONFIG_BINARY, - .default_int = 0 - }, - { - .name = "umb_c8000h_cffff", - .description = "Map 0xc8000-0xcffff as UMB", - .type = CONFIG_BINARY, - .default_int = 0 - }, - { - .name = "umb_d0000h_d7fff", - .description = "Map 0xd0000-0xd7fff as UMB", - .type = CONFIG_BINARY, - .default_int = 0 - }, - { - .name = "umb_d8000h_dffff", - .description = "Map 0xd8000-0xdffff as UMB", - .type = CONFIG_BINARY, - .default_int = 0 - }, - { - .name = "umb_e0000h_e7fff", - .description = "Map 0xe0000-0xe7fff as UMB", - .type = CONFIG_BINARY, - .default_int = 0 - }, - { - .name = "umb_e8000h_effff", - .description = "Map 0xe8000-0xeffff as UMB", - .type = CONFIG_BINARY, - .default_int = 0 - }, - { - .type = -1 - } + .default_int = 1 + }, + { + .name = "umb_c0000h_c7fff", + .description = "Map 0xc0000-0xc7fff as UMB", + .type = CONFIG_BINARY, + .default_int = 0 + }, + { + .name = "umb_c8000h_cffff", + .description = "Map 0xc8000-0xcffff as UMB", + .type = CONFIG_BINARY, + .default_int = 0 + }, + { + .name = "umb_d0000h_d7fff", + .description = "Map 0xd0000-0xd7fff as UMB", + .type = CONFIG_BINARY, + .default_int = 0 + }, + { + .name = "umb_d8000h_dffff", + .description = "Map 0xd8000-0xdffff as UMB", + .type = CONFIG_BINARY, + .default_int = 0 + }, + { + .name = "umb_e0000h_e7fff", + .description = "Map 0xe0000-0xe7fff as UMB", + .type = CONFIG_BINARY, + .default_int = 0 + }, + { + .name = "umb_e8000h_effff", + .description = "Map 0xe8000-0xeffff as UMB", + .type = CONFIG_BINARY, + .default_int = 0 + }, + { .type = -1 } }; - -const device_t xi8088_device = -{ - "Xi8088", - "xi8088", - 0, - 0, - xi8088_init, - NULL, - NULL, - { NULL }, - NULL, - NULL, - xi8088_config +const device_t xi8088_device = { + .name = "Xi8088", + .internal_name = "xi8088", + .flags = 0, + .local = 0, + .init = xi8088_init, + .close = NULL, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = xi8088_config }; - const device_t * xi8088_get_device(void) { diff --git a/src/machine/m_xt_zenith.c b/src/machine/m_xt_zenith.c index 138badafa..c210d5086 100644 --- a/src/machine/m_xt_zenith.c +++ b/src/machine/m_xt_zenith.c @@ -98,18 +98,20 @@ zenith_scratchpad_close(void *p) free(dev); } - static const device_t zenith_scratchpad_device = { - "Zenith scratchpad RAM", - "zenith_scratchpad", - 0, 0, - zenith_scratchpad_init, zenith_scratchpad_close, NULL, - { NULL }, - NULL, - NULL + .name = "Zenith scratchpad RAM", + .internal_name = "zenith_scratchpad", + .flags = 0, + .local = 0, + .init = zenith_scratchpad_init, + .close = zenith_scratchpad_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - void machine_zenith_init(const machine_t *model){ diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 3cf38f235..982218e2d 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -129,6 +129,7 @@ const machine_t machines[] = { { "[8088] Tandy 1000", "tandy", MACHINE_TYPE_8088, CPU_PKG_8088_EUROPC, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED, 128, 640, 128, 0, machine_tandy_init, tandy1k_get_device }, { "[8088] Tandy 1000 HX", "tandy1000hx", MACHINE_TYPE_8088, CPU_PKG_8088_EUROPC, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED, 256, 640, 128, 0, machine_tandy1000hx_init, tandy1k_hx_get_device }, { "[8088] Toshiba T1000", "t1000", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO, 512, 1280, 768, 63, machine_xt_t1000_init, t1000_get_device }, + { "[8088] Vendex HeadStart Turbo 888-XT","vendex", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 256, 768, 256, 0, machine_xt_vendex_init, NULL }, #if defined(DEV_BRANCH) && defined(USE_LASERXT) { "[8088] VTech Laser Turbo XT", "ltxt", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 256, 640, 256, 0, machine_xt_laserxt_init, NULL }, #endif diff --git a/src/mem/catalyst_flash.c b/src/mem/catalyst_flash.c index 246063276..0a7fe2cdf 100644 --- a/src/mem/catalyst_flash.c +++ b/src/mem/catalyst_flash.c @@ -242,14 +242,16 @@ catalyst_flash_close(void *p) } -const device_t catalyst_flash_device = -{ - "Catalyst 28F010-D Flash BIOS", - "catalyst_flash", - DEVICE_PCI, - 0, - catalyst_flash_init, - catalyst_flash_close, - catalyst_flash_reset, - { NULL }, NULL, NULL, NULL +const device_t catalyst_flash_device = { + .name = "Catalyst 28F010-D Flash BIOS", + .internal_name = "catalyst_flash", + .flags = DEVICE_PCI, + .local = 0, + .init = catalyst_flash_init, + .close = catalyst_flash_close, + .reset = catalyst_flash_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/mem/intel_flash.c b/src/mem/intel_flash.c index 42da74e71..66c59914d 100644 --- a/src/mem/intel_flash.c +++ b/src/mem/intel_flash.c @@ -560,40 +560,45 @@ intel_flash_close(void *p) free(dev); } - /* For AMI BIOS'es - Intel 28F001BXT with A16 pin inverted. */ -const device_t intel_flash_bxt_ami_device = -{ - "Intel 28F001BXT/28F002BXT/28F004BXT Flash BIOS", - "intel_flash_bxt_ami", - DEVICE_PCI, - FLAG_INV_A16, - intel_flash_init, - intel_flash_close, - intel_flash_reset, - { NULL }, NULL, NULL, NULL +const device_t intel_flash_bxt_ami_device = { + .name = "Intel 28F001BXT/28F002BXT/28F004BXT Flash BIOS", + .internal_name = "intel_flash_bxt_ami", + .flags = DEVICE_PCI, + .local = FLAG_INV_A16, + .init = intel_flash_init, + .close = intel_flash_close, + .reset = intel_flash_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t intel_flash_bxt_device = -{ - "Intel 28F001BXT/28F002BXT/28F004BXT Flash BIOS", - "intel_flash_bxt", - DEVICE_PCI, 0, - intel_flash_init, - intel_flash_close, - intel_flash_reset, - { NULL }, NULL, NULL, NULL +const device_t intel_flash_bxt_device = { + .name = "Intel 28F001BXT/28F002BXT/28F004BXT Flash BIOS", + .internal_name = "intel_flash_bxt", + .flags = DEVICE_PCI, + .local = 0, + .init = intel_flash_init, + .close = intel_flash_close, + .reset = intel_flash_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t intel_flash_bxb_device = -{ - "Intel 28F001BXB/28F002BXB/28F004BXB Flash BIOS", - "intel_flash_bxb", - DEVICE_PCI, FLAG_BXB, - intel_flash_init, - intel_flash_close, - intel_flash_reset, - { NULL }, NULL, NULL, NULL +const device_t intel_flash_bxb_device = { + .name = "Intel 28F001BXB/28F002BXB/28F004BXB Flash BIOS", + .internal_name = "intel_flash_bxb", + .flags = DEVICE_PCI, + .local = FLAG_BXB, + .init = intel_flash_init, + .close = intel_flash_close, + .reset = intel_flash_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/mem/spd.c b/src/mem/spd.c index f65d72ae7..96df99867 100644 --- a/src/mem/spd.c +++ b/src/mem/spd.c @@ -578,11 +578,15 @@ spd_write_drbs_ali1621(uint8_t *regs, uint8_t reg_min, uint8_t reg_max) static const device_t spd_device = { - "Serial Presence Detect ROMs", - "spd", - DEVICE_ISA, - 0, - spd_init, spd_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Serial Presence Detect ROMs", + .internal_name = "spd", + .flags = DEVICE_ISA, + .local = 0, + .init = spd_init, + .close = spd_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/mem/sst_flash.c b/src/mem/sst_flash.c index 8988b7e14..1fc5b2082 100644 --- a/src/mem/sst_flash.c +++ b/src/mem/sst_flash.c @@ -474,79 +474,86 @@ sst_close(void *p) free(dev); } - -const device_t sst_flash_29ee010_device = -{ - "SST 29EE010 Flash BIOS", - "sst_flash_29ee010", - 0, - SST | SST29EE010 | SIZE_1M, - sst_init, - sst_close, - NULL, - { NULL }, NULL, NULL, NULL +const device_t sst_flash_29ee010_device = { + .name = "SST 29EE010 Flash BIOS", + .internal_name = "sst_flash_29ee010", + .flags = 0, + .local = SST | SST29EE010 | SIZE_1M, + .init = sst_init, + .close = sst_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t sst_flash_29ee020_device = -{ - "SST 29EE020 Flash BIOS", - "sst_flash_29ee020", - 0, - SST | SST29EE020 | SIZE_2M, - sst_init, - sst_close, - NULL, - { NULL }, NULL, NULL, NULL +const device_t sst_flash_29ee020_device = { + .name = "SST 29EE020 Flash BIOS", + .internal_name = "sst_flash_29ee020", + .flags = 0, + .local = SST | SST29EE020 | SIZE_2M, + .init = sst_init, + .close = sst_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t winbond_flash_w29c020_device = -{ - "Winbond W29C020 Flash BIOS", - "winbond_flash_w29c020", - 0, - WINBOND | W29C020 | SIZE_2M, - sst_init, - sst_close, - NULL, - { NULL }, NULL, NULL, NULL +const device_t winbond_flash_w29c020_device = { + .name = "Winbond W29C020 Flash BIOS", + .internal_name = "winbond_flash_w29c020", + .flags = 0, + .local = WINBOND | W29C020 | SIZE_2M, + .init = sst_init, + .close = sst_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t sst_flash_39sf010_device = -{ - "SST 39SF010 Flash BIOS", - "sst_flash_39sf010", - 0, - SST | SST39SF010 | SIZE_1M, - sst_init, - sst_close, - NULL, - { NULL }, NULL, NULL, NULL +const device_t sst_flash_39sf010_device = { + .name = "SST 39SF010 Flash BIOS", + .internal_name = "sst_flash_39sf010", + .flags = 0, + .local = SST | SST39SF010 | SIZE_1M, + .init = sst_init, + .close = sst_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t sst_flash_39sf020_device = -{ - "SST 39SF020 Flash BIOS", - "sst_flash_39sf020", - 0, - SST | SST39SF020 | SIZE_2M, - sst_init, - sst_close, - NULL, - { NULL }, NULL, NULL, NULL +const device_t sst_flash_39sf020_device = { + .name = "SST 39SF020 Flash BIOS", + .internal_name = "sst_flash_39sf020", + .flags = 0, + .local = SST | SST39SF020 | SIZE_2M, + .init = sst_init, + .close = sst_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t sst_flash_39sf040_device = -{ - "SST 39SF040 Flash BIOS", - "sst_flash_39sf040", - 0, - SST | SST39SF040 | SIZE_4M, - sst_init, - sst_close, - NULL, - { NULL }, NULL, NULL, NULL +const device_t sst_flash_39sf040_device = { + .name = "SST 39SF040 Flash BIOS", + .internal_name = "sst_flash_39sf040", + .flags = 0, + .local = SST | SST39SF040 | SIZE_4M, + .init = sst_init, + .close = sst_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt index ee9f9bdcc..204641947 100644 --- a/src/network/CMakeLists.txt +++ b/src/network/CMakeLists.txt @@ -27,3 +27,7 @@ else() add_subdirectory(slirp) target_link_libraries(86Box slirp) endif() + +if (HAIKU) + target_link_libraries(86Box network) +endif() diff --git a/src/network/net_3c503.c b/src/network/net_3c503.c index 7700c8039..03d224a4a 100644 --- a/src/network/net_3c503.c +++ b/src/network/net_3c503.c @@ -692,11 +692,15 @@ static const device_config_t threec503_config[] = { }; const device_t threec503_device = { - "3Com EtherLink II", - "3c503", - DEVICE_ISA, - 0, - threec503_nic_init, threec503_nic_close, NULL, - { NULL }, NULL, NULL, - threec503_config + .name = "3Com EtherLink II", + .internal_name = "3c503", + .flags = DEVICE_ISA, + .local = 0, + .init = threec503_nic_init, + .close = threec503_nic_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = threec503_config }; diff --git a/src/network/net_dp8390.c b/src/network/net_dp8390.c index 8e9b16f59..7dfcf8c34 100644 --- a/src/network/net_dp8390.c +++ b/src/network/net_dp8390.c @@ -1112,9 +1112,15 @@ dp8390_close(void *priv) const device_t dp8390_device = { - "DP8390 Network Interface Controller", - "dp8390", - 0, 0, - dp8390_init, dp8390_close, - NULL, { NULL }, NULL, NULL + .name = "DP8390 Network Interface Controller", + .internal_name = "dp8390", + .flags = 0, + .local = 0, + .init = dp8390_init, + .close = dp8390_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/network/net_ne2000.c b/src/network/net_ne2000.c index a836d5d8a..1161a5a9c 100644 --- a/src/network/net_ne2000.c +++ b/src/network/net_ne2000.c @@ -1226,51 +1226,71 @@ static const device_config_t mca_mac_config[] = { // clang-format on const device_t ne1000_device = { - "Novell NE1000", - "ne1k", - DEVICE_ISA, - NE2K_NE1000, - nic_init, nic_close, NULL, - { NULL }, NULL, NULL, - ne1000_config + .name = "Novell NE1000", + .internal_name = "ne1k", + .flags = DEVICE_ISA, + .local = NE2K_NE1000, + .init = nic_init, + .close = nic_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ne1000_config }; const device_t ne2000_device = { - "Novell NE2000", - "ne2k", - DEVICE_ISA | DEVICE_AT, - NE2K_NE2000, - nic_init, nic_close, NULL, - { NULL }, NULL, NULL, - ne2000_config + .name = "Novell NE2000", + .internal_name = "ne2k", + .flags = DEVICE_ISA | DEVICE_AT, + .local = NE2K_NE2000, + .init = nic_init, + .close = nic_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ne2000_config }; const device_t ethernext_mc_device = { - "NetWorth EtherNext/MC", - "ethernextmc", - DEVICE_MCA, - NE2K_ETHERNEXT_MC, - nic_init, nic_close, NULL, - { NULL }, NULL, NULL, - mca_mac_config + .name = "NetWorth EtherNext/MC", + .internal_name = "ethernextmc", + .flags = DEVICE_MCA, + .local = NE2K_ETHERNEXT_MC, + .init = nic_init, + .close = nic_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = mca_mac_config }; const device_t rtl8019as_device = { - "Realtek RTL8019AS", - "ne2kpnp", - DEVICE_ISA | DEVICE_AT, - NE2K_RTL8019AS, - nic_init, nic_close, NULL, - { NULL }, NULL, NULL, - rtl8019as_config + .name = "Realtek RTL8019AS", + .internal_name = "ne2kpnp", + .flags = DEVICE_ISA | DEVICE_AT, + .local = NE2K_RTL8019AS, + .init = nic_init, + .close = nic_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = rtl8019as_config }; const device_t rtl8029as_device = { - "Realtek RTL8029AS", - "ne2kpci", - DEVICE_PCI, - NE2K_RTL8029AS, - nic_init, nic_close, NULL, - { NULL }, NULL, NULL, - rtl8029as_config + .name = "Realtek RTL8029AS", + .internal_name = "ne2kpci", + .flags = DEVICE_PCI, + .local = NE2K_RTL8029AS, + .init = nic_init, + .close = nic_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = rtl8029as_config }; diff --git a/src/network/net_pcnet.c b/src/network/net_pcnet.c index 17049e2bf..6dd22315d 100644 --- a/src/network/net_pcnet.c +++ b/src/network/net_pcnet.c @@ -3144,61 +3144,85 @@ static const device_config_t pcnet_vlb_config[] = { // clang-format on const device_t pcnet_am79c960_device = { - "AMD PCnet-ISA", - "pcnetisa", - DEVICE_AT | DEVICE_ISA, - DEV_AM79C960, - pcnet_init, pcnet_close, NULL, - { NULL }, NULL, NULL, - pcnet_isa_config + .name = "AMD PCnet-ISA", + .internal_name = "pcnetisa", + .flags = DEVICE_AT | DEVICE_ISA, + .local = DEV_AM79C960, + .init = pcnet_init, + .close = pcnet_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = pcnet_isa_config }; const device_t pcnet_am79c960_eb_device = { - "Racal Interlan EtherBlaster", - "pcnetracal", - DEVICE_AT | DEVICE_ISA, - DEV_AM79C960_EB, - pcnet_init, pcnet_close, NULL, - { NULL }, NULL, NULL, - pcnet_isa_config + .name = "Racal Interlan EtherBlaster", + .internal_name = "pcnetracal", + .flags = DEVICE_AT | DEVICE_ISA, + .local = DEV_AM79C960_EB, + .init = pcnet_init, + .close = pcnet_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = pcnet_isa_config }; const device_t pcnet_am79c960_vlb_device = { - "AMD PCnet-VL", - "pcnetvlb", - DEVICE_VLB, - DEV_AM79C960_VLB, - pcnet_init, pcnet_close, NULL, - { NULL }, NULL, NULL, - pcnet_vlb_config + .name = "AMD PCnet-VL", + .internal_name = "pcnetvlb", + .flags = DEVICE_VLB, + .local = DEV_AM79C960_VLB, + .init = pcnet_init, + .close = pcnet_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = pcnet_vlb_config }; const device_t pcnet_am79c961_device = { - "AMD PCnet-ISA+", - "pcnetisaplus", - DEVICE_AT | DEVICE_ISA, - DEV_AM79C961, - pcnet_init, pcnet_close, NULL, - { NULL }, NULL, NULL, - pcnet_pci_config + .name = "AMD PCnet-ISA+", + .internal_name = "pcnetisaplus", + .flags = DEVICE_AT | DEVICE_ISA, + .local = DEV_AM79C961, + .init = pcnet_init, + .close = pcnet_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = pcnet_pci_config }; const device_t pcnet_am79c970a_device = { - "AMD PCnet-PCI II", - "pcnetpci", - DEVICE_PCI, - DEV_AM79C970A, - pcnet_init, pcnet_close, NULL, - { NULL }, NULL, NULL, - pcnet_pci_config + .name = "AMD PCnet-PCI II", + .internal_name = "pcnetpci", + .flags = DEVICE_PCI, + .local = DEV_AM79C970A, + .init = pcnet_init, + .close = pcnet_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = pcnet_pci_config }; const device_t pcnet_am79c973_device = { - "AMD PCnet-FAST III", - "pcnetfast", - DEVICE_PCI, - DEV_AM79C973, - pcnet_init, pcnet_close, NULL, - { NULL }, NULL, NULL, - pcnet_pci_config + .name = "AMD PCnet-FAST III", + .internal_name = "pcnetfast", + .flags = DEVICE_PCI, + .local = DEV_AM79C973, + .init = pcnet_init, + .close = pcnet_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = pcnet_pci_config }; diff --git a/src/network/net_plip.c b/src/network/net_plip.c index f0af9dee5..e8e7df008 100644 --- a/src/network/net_plip.c +++ b/src/network/net_plip.c @@ -493,6 +493,7 @@ plip_close(void *priv) const lpt_device_t lpt_plip_device = { .name = "Parallel Line Internet Protocol", + .internal_name = "plip", .init = plip_lpt_init, .close = plip_close, .write_data = plip_write_data, @@ -503,9 +504,15 @@ const lpt_device_t lpt_plip_device = { }; const device_t plip_device = { - "Parallel Line Internet Protocol", - "plip", - DEVICE_LPT, 0, - plip_net_init, NULL, - NULL, { NULL }, NULL, NULL + .name = "Parallel Line Internet Protocol", + .internal_name = "plip", + .flags = DEVICE_LPT, + .local = 0, + .init = plip_net_init, + .close = NULL, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/network/net_wd8003.c b/src/network/net_wd8003.c index 90cbdea2e..be6c46905 100644 --- a/src/network/net_wd8003.c +++ b/src/network/net_wd8003.c @@ -892,51 +892,71 @@ static const device_config_t mca_mac_config[] = { // clang-format on const device_t wd8003e_device = { - "Western Digital WD8003E", - "wd8003e", - DEVICE_ISA, - WD8003E, - wd_init, wd_close, NULL, - { NULL }, NULL, NULL, - wd8003_config + .name = "Western Digital WD8003E", + .internal_name = "wd8003e", + .flags = DEVICE_ISA, + .local = WD8003E, + .init = wd_init, + .close = wd_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = wd8003_config }; const device_t wd8003eb_device = { - "Western Digital WD8003EB", - "wd8003eb", - DEVICE_ISA, - WD8003EB, - wd_init, wd_close, NULL, - { NULL }, NULL, NULL, - wd8003eb_config + .name = "Western Digital WD8003EB", + .internal_name = "wd8003eb", + .flags = DEVICE_ISA, + .local = WD8003EB, + .init = wd_init, + .close = wd_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = wd8003eb_config }; const device_t wd8013ebt_device = { - "Western Digital WD8013EBT", - "wd8013ebt", - DEVICE_ISA, - WD8013EBT, - wd_init, wd_close, NULL, - { NULL }, NULL, NULL, - wd8013_config + .name = "Western Digital WD8013EBT", + .internal_name = "wd8013ebt", + .flags = DEVICE_ISA, + .local = WD8013EBT, + .init = wd_init, + .close = wd_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = wd8013_config }; const device_t wd8003eta_device = { - "Western Digital WD8003ET/A", - "wd8003eta", - DEVICE_MCA, - WD8003ETA, - wd_init, wd_close, NULL, - { NULL }, NULL, NULL, - mca_mac_config + .name = "Western Digital WD8003ET/A", + .internal_name = "wd8003eta", + .flags = DEVICE_MCA, + .local = WD8003ETA, + .init = wd_init, + .close = wd_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = mca_mac_config }; const device_t wd8003ea_device = { - "Western Digital WD8003E/A", - "wd8003ea", - DEVICE_MCA, - WD8003EA, - wd_init, wd_close, NULL, - { NULL }, NULL, NULL, - mca_mac_config + .name = "Western Digital WD8003E/A", + .internal_name = "wd8003ea", + .flags = DEVICE_MCA, + .local = WD8003EA, + .init = wd_init, + .close = wd_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = mca_mac_config }; diff --git a/src/network/network.c b/src/network/network.c index ea1ccdf46..a02000372 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -71,12 +71,17 @@ static const device_t net_none_device = { - "None", - "none", - 0, NET_TYPE_NONE, - NULL, NULL, NULL, - { NULL }, NULL, NULL, - NULL + .name = "None", + .internal_name = "none", + .flags = 0, + .local = NET_TYPE_NONE, + .init = NULL, + .close = NULL, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/network/slirp/CMakeLists.txt b/src/network/slirp/CMakeLists.txt index 5bb4bceca..f3fa9348b 100644 --- a/src/network/slirp/CMakeLists.txt +++ b/src/network/slirp/CMakeLists.txt @@ -21,14 +21,19 @@ if(WIN32) target_link_libraries(slirp wsock32 iphlpapi) endif() -option(SLIRP_GLIB "Use GLib proper with SLiRP" OFF) +# tinyglib conflicts with the real GLib used by Qt, let's just be safe +if(QT AND UNIX AND NOT APPLE) + set(SLIRP_TINYGLIB OFF) +endif() -if(SLIRP_GLIB) +option(SLIRP_TINYGLIB "Use a minimal GLib stub (`tinyglib`) with SLiRP" ON) + +if(SLIRP_TINYGLIB) + target_sources(slirp PRIVATE tinyglib.c) +else() find_package(PkgConfig REQUIRED) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) target_link_libraries(slirp PkgConfig::GLIB) target_compile_definitions(slirp PRIVATE TINYGLIB_USE_GLIB) -else() - target_sources(slirp PRIVATE tinyglib.c) endif() diff --git a/src/nvr_at.c b/src/nvr_at.c index b3c6299b3..d7b1a780f 100644 --- a/src/nvr_at.c +++ b/src/nvr_at.c @@ -1120,113 +1120,156 @@ nvr_at_close(void *priv) nvr_at_inited = 0; } - const device_t at_nvr_old_device = { - "PC/AT NVRAM (No century)", - "at_nvr_old", - DEVICE_ISA | DEVICE_AT, - 0, - nvr_at_init, nvr_at_close, nvr_at_reset, - { NULL }, nvr_at_speed_changed, - NULL + .name = "PC/AT NVRAM (No century)", + .internal_name = "at_nvr_old", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 0, + .init = nvr_at_init, + .close = nvr_at_close, + .reset = nvr_at_reset, + { .available = NULL }, + .speed_changed = nvr_at_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t at_nvr_device = { - "PC/AT NVRAM", - "at_nvr", - DEVICE_ISA | DEVICE_AT, - 1, - nvr_at_init, nvr_at_close, nvr_at_reset, - { NULL }, nvr_at_speed_changed, - NULL + .name = "PC/AT NVRAM", + .internal_name = "at_nvr", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 1, + .init = nvr_at_init, + .close = nvr_at_close, + .reset = nvr_at_reset, + { .available = NULL }, + .speed_changed = nvr_at_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t ps_nvr_device = { - "PS/1 or PS/2 NVRAM", - "ps_nvr", - DEVICE_PS2, - 2, - nvr_at_init, nvr_at_close, nvr_at_reset, - { NULL }, nvr_at_speed_changed, - NULL + .name = "PS/1 or PS/2 NVRAM", + .internal_name = "ps_nvr", + .flags = DEVICE_PS2, + .local = 2, + .init = nvr_at_init, + .close = nvr_at_close, + .reset = nvr_at_reset, + { .available = NULL }, + .speed_changed = nvr_at_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t amstrad_nvr_device = { - "Amstrad NVRAM", - "amstrad_nvr", - DEVICE_ISA | DEVICE_AT, - 3, - nvr_at_init, nvr_at_close, nvr_at_reset, - { NULL }, nvr_at_speed_changed, - NULL + .name = "Amstrad NVRAM", + .internal_name = "amstrad_nvr", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 3, + .init = nvr_at_init, + .close = nvr_at_close, + .reset = nvr_at_reset, + { .available = NULL }, + .speed_changed = nvr_at_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t ibmat_nvr_device = { - "IBM AT NVRAM", - "ibmat_nvr", - DEVICE_ISA | DEVICE_AT, - 4, - nvr_at_init, nvr_at_close, nvr_at_reset, - { NULL }, nvr_at_speed_changed, - NULL + .name = "IBM AT NVRAM", + .internal_name = "ibmat_nvr", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 4, + .init = nvr_at_init, + .close = nvr_at_close, + .reset = nvr_at_reset, + { .available = NULL }, + .speed_changed = nvr_at_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t piix4_nvr_device = { - "Intel PIIX4 PC/AT NVRAM", - "piix4_nvr", - DEVICE_ISA | DEVICE_AT, - 9, - nvr_at_init, nvr_at_close, nvr_at_reset, - { NULL }, nvr_at_speed_changed, - NULL + .name = "Intel PIIX4 PC/AT NVRAM", + .internal_name = "piix4_nvr", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 9, + .init = nvr_at_init, + .close = nvr_at_close, + .reset = nvr_at_reset, + { .available = NULL }, + .speed_changed = nvr_at_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t ami_1992_nvr_device = { - "AMI Color 1992 PC/AT NVRAM", - "ami_1992_nvr", - DEVICE_ISA | DEVICE_AT, - 12, - nvr_at_init, nvr_at_close, nvr_at_reset, - { NULL }, nvr_at_speed_changed, - NULL + .name = "AMI Color 1992 PC/AT NVRAM", + .internal_name = "ami_1992_nvr", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 12, + .init = nvr_at_init, + .close = nvr_at_close, + .reset = nvr_at_reset, + { .available = NULL }, + .speed_changed = nvr_at_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t ami_1994_nvr_device = { - "AMI WinBIOS 1994 PC/AT NVRAM", - "ami_1994_nvr", - DEVICE_ISA | DEVICE_AT, - 13, - nvr_at_init, nvr_at_close, nvr_at_reset, - { NULL }, nvr_at_speed_changed, - NULL + .name = "AMI WinBIOS 1994 PC/AT NVRAM", + .internal_name = "ami_1994_nvr", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 13, + .init = nvr_at_init, + .close = nvr_at_close, + .reset = nvr_at_reset, + { .available = NULL }, + .speed_changed = nvr_at_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t ami_1995_nvr_device = { - "AMI WinBIOS 1995 PC/AT NVRAM", - "ami_1995_nvr", - DEVICE_ISA | DEVICE_AT, - 14, - nvr_at_init, nvr_at_close, nvr_at_reset, - { NULL }, nvr_at_speed_changed, - NULL + .name = "AMI WinBIOS 1995 PC/AT NVRAM", + .internal_name = "ami_1995_nvr", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 14, + .init = nvr_at_init, + .close = nvr_at_close, + .reset = nvr_at_reset, + { .available = NULL }, + .speed_changed = nvr_at_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t via_nvr_device = { - "VIA PC/AT NVRAM", - "via_nvr", - DEVICE_ISA | DEVICE_AT, - 15, - nvr_at_init, nvr_at_close, nvr_at_reset, - { NULL }, nvr_at_speed_changed, - NULL + .name = "VIA PC/AT NVRAM", + .internal_name = "via_nvr", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 15, + .init = nvr_at_init, + .close = nvr_at_close, + .reset = nvr_at_reset, + { .available = NULL }, + .speed_changed = nvr_at_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t p6rp4_nvr_device = { - "ASUS P/I-P6RP4 PC/AT NVRAM", - "p6rp4_nvr", - DEVICE_ISA | DEVICE_AT, - 16, - nvr_at_init, nvr_at_close, nvr_at_reset, - { NULL }, nvr_at_speed_changed, - NULL + .name = "ASUS P/I-P6RP4 PC/AT NVRAM", + .internal_name = "p6rp4_nvr", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 16, + .init = nvr_at_init, + .close = nvr_at_close, + .reset = nvr_at_reset, + { .available = NULL }, + .speed_changed = nvr_at_speed_changed, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/nvr_ps2.c b/src/nvr_ps2.c index 5e38d5a57..cd6f47af7 100644 --- a/src/nvr_ps2.c +++ b/src/nvr_ps2.c @@ -153,10 +153,15 @@ ps2_nvr_close(void *priv) const device_t ps2_nvr_device = { - "PS/2 Secondary NVRAM", - "ps2_nvr", - 0, 0, - ps2_nvr_init, ps2_nvr_close, NULL, - { NULL }, NULL, - NULL + .name = "PS/2 Secondary NVRAM", + .internal_name = "ps2_nvr", + .flags = 0, + .local = 0, + .init = ps2_nvr_init, + .close = ps2_nvr_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/pit.c b/src/pit.c index 40927dea5..28fc9b3c2 100644 --- a/src/pit.c +++ b/src/pit.c @@ -841,67 +841,76 @@ pit_init(const device_t *info) return dev; } - -const device_t i8253_device = -{ - "Intel 8253/8253-5 Programmable Interval Timer", - "i8253", - DEVICE_ISA, - PIT_8253, - pit_init, pit_close, NULL, - { NULL }, NULL, NULL, - NULL +const device_t i8253_device = { + .name = "Intel 8253/8253-5 Programmable Interval Timer", + .internal_name = "i8253", + .flags = DEVICE_ISA, + .local = PIT_8253, + .init = pit_init, + .close = pit_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t i8254_device = -{ - "Intel 8254 Programmable Interval Timer", - "i8254", - DEVICE_ISA, - PIT_8254, - pit_init, pit_close, NULL, - { NULL }, NULL, NULL, - NULL +const device_t i8254_device = { + .name = "Intel 8254 Programmable Interval Timer", + .internal_name = "i8254", + .flags = DEVICE_ISA, + .local = PIT_8254, + .init = pit_init, + .close = pit_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t i8254_sec_device = -{ - "Intel 8254 Programmable Interval Timer (Secondary)", - "i8254_sec", - DEVICE_ISA, - PIT_8254 | PIT_SECONDARY, - pit_init, pit_close, NULL, - { NULL }, NULL, NULL, - NULL +const device_t i8254_sec_device = { + .name = "Intel 8254 Programmable Interval Timer (Secondary)", + .internal_name = "i8254_sec", + .flags = DEVICE_ISA, + .local = PIT_8254 | PIT_SECONDARY, + .init = pit_init, + .close = pit_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t i8254_ext_io_device = -{ - "Intel 8254 Programmable Interval Timer (External I/O)", - "i8254_ext_io", - DEVICE_ISA, - PIT_8254 | PIT_EXT_IO, - pit_init, pit_close, NULL, - { NULL }, NULL, NULL, - NULL +const device_t i8254_ext_io_device = { + .name = "Intel 8254 Programmable Interval Timer (External I/O)", + .internal_name = "i8254_ext_io", + .flags = DEVICE_ISA, + .local = PIT_8254 | PIT_EXT_IO, + .init = pit_init, + .close = pit_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - -const device_t i8254_ps2_device = -{ - "Intel 8254 Programmable Interval Timer (PS/2)", - "i8254_ps2", - DEVICE_ISA, - PIT_8254 | PIT_PS2 | PIT_EXT_IO, - pit_init, pit_close, NULL, - { NULL }, NULL, NULL, - NULL +const device_t i8254_ps2_device = { + .name = "Intel 8254 Programmable Interval Timer (PS/2)", + .internal_name = "i8254_ps2", + .flags = DEVICE_ISA, + .local = PIT_8254 | PIT_PS2 | PIT_EXT_IO, + .init = pit_init, + .close = pit_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - pit_t * pit_common_init(int type, void (*out0)(int new_out, int old_out), void (*out1)(int new_out, int old_out)) { diff --git a/src/port_6x.c b/src/port_6x.c index 365b2aff9..dafa5d987 100644 --- a/src/port_6x.c +++ b/src/port_6x.c @@ -173,46 +173,58 @@ port_6x_init(const device_t *info) return dev; } - const device_t port_6x_device = { - "Port 6x Registers", - "port_6x", - 0, - 0, - port_6x_init, port_6x_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Port 6x Registers", + .internal_name = "port_6x", + .flags = 0, + .local = 0, + .init = port_6x_init, + .close = port_6x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t port_6x_xi8088_device = { - "Port 6x Registers (Xi8088)", - "port_6x_xi8088", - 0, - PORT_6X_TURBO | PORT_6X_EXT_REF | PORT_6X_MIRROR, - port_6x_init, port_6x_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Port 6x Registers (Xi8088)", + .internal_name = "port_6x_xi8088", + .flags = 0, + .local = PORT_6X_TURBO | PORT_6X_EXT_REF | PORT_6X_MIRROR, + .init = port_6x_init, + .close = port_6x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t port_6x_ps2_device = { - "Port 6x Registers (IBM PS/2)", - "port_6x_ps2", - 0, - PORT_6X_EXT_REF, - port_6x_init, port_6x_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Port 6x Registers (IBM PS/2)", + .internal_name = "port_6x_ps2", + .flags = 0, + .local = PORT_6X_EXT_REF, + .init = port_6x_init, + .close = port_6x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t port_6x_olivetti_device = { - "Port 6x Registers (Olivetti)", - "port_6x_olivetti", - 0, - PORT_6X_SWA, - port_6x_init, port_6x_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Port 6x Registers (Olivetti)", + .internal_name = "port_6x_olivetti", + .flags = 0, + .local = PORT_6X_SWA, + .init = port_6x_init, + .close = port_6x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/port_92.c b/src/port_92.c index 6981a3596..c4c421f53 100644 --- a/src/port_92.c +++ b/src/port_92.c @@ -216,46 +216,58 @@ port_92_init(const device_t *info) return dev; } - const device_t port_92_device = { - "Port 92 Register", - "port_92", - 0, - 0, - port_92_init, port_92_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Port 92 Register", + .internal_name = "port_92", + .flags = 0, + .local = 0, + .init = port_92_init, + .close = port_92_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t port_92_inv_device = { - "Port 92 Register (inverted bits 2-7)", - "port_92_inv", - 0, - PORT_92_INV, - port_92_init, port_92_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Port 92 Register (inverted bits 2-7)", + .internal_name = "port_92_inv", + .flags = 0, + .local = PORT_92_INV, + .init = port_92_init, + .close = port_92_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t port_92_word_device = { - "Port 92 Register (16-bit)", - "port_92_word", - 0, - PORT_92_WORD, - port_92_init, port_92_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Port 92 Register (16-bit)", + .internal_name = "port_92_word", + .flags = 0, + .local = PORT_92_WORD, + .init = port_92_init, + .close = port_92_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t port_92_pci_device = { - "Port 92 Register (PCI)", - "port_92_pci", - 0, - PORT_92_PCI, - port_92_init, port_92_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Port 92 Register (PCI)", + .internal_name = "port_92_pci", + .flags = 0, + .local = PORT_92_PCI, + .init = port_92_init, + .close = port_92_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/printer/prt_escp.c b/src/printer/prt_escp.c index b788c317f..d290e295f 100644 --- a/src/printer/prt_escp.c +++ b/src/printer/prt_escp.c @@ -2143,12 +2143,13 @@ escp_close(void *priv) const lpt_device_t lpt_prt_escp_device = { - "Generic ESC/P Dot-Matrix", - escp_init, - escp_close, - write_data, - write_ctrl, - read_data, - read_status, - read_ctrl + .name = "Generic ESC/P Dot-Matrix", + .internal_name = "dot_matrix", + .init = escp_init, + .close = escp_close, + .write_data = write_data, + .write_ctrl = write_ctrl, + .read_data = read_data, + .read_status = read_status, + .read_ctrl = read_ctrl }; diff --git a/src/printer/prt_ps.c b/src/printer/prt_ps.c index fdc820a84..e90e19e82 100644 --- a/src/printer/prt_ps.c +++ b/src/printer/prt_ps.c @@ -401,6 +401,7 @@ ps_close(void *p) const lpt_device_t lpt_prt_ps_device = { .name = "Generic PostScript Printer", + .internal_name = "postscript", .init = ps_init, .close = ps_close, .write_data = ps_write_data, diff --git a/src/printer/prt_text.c b/src/printer/prt_text.c index 070e1bd4c..7c791227f 100644 --- a/src/printer/prt_text.c +++ b/src/printer/prt_text.c @@ -483,12 +483,13 @@ prnt_close(void *priv) const lpt_device_t lpt_prt_text_device = { - "Generic Text Printer", - prnt_init, - prnt_close, - write_data, - write_ctrl, - NULL, - read_status, - NULL + .name = "Generic Text Printer", + .internal_name = "text_prt", + .init = prnt_init, + .close = prnt_close, + .write_data = write_data, + .write_ctrl = write_ctrl, + .read_data = NULL, + .read_status = read_status, + .read_ctrl = NULL }; diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index 11ad8e1a9..a62032537 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -141,6 +141,11 @@ add_library(ui STATIC ) +if(RTMIDI) + target_compile_definitions(ui PRIVATE USE_RTMIDI) +endif() + + if(WIN32) enable_language(RC) target_sources(86Box PUBLIC ../win/86Box-qt.rc) @@ -259,7 +264,7 @@ if (APPLE AND CMAKE_MACOSX_BUNDLE) fixup_bundle(\"\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/86Box.app\" \"${QT_PLUGINS}\" \"${DIRS}\")") endif() -if (UNIX AND NOT APPLE) +if (UNIX AND NOT APPLE AND NOT HAIKU) find_package(X11 REQUIRED) target_link_libraries(ui PRIVATE X11::X11 X11::Xi) target_sources(ui PRIVATE xinput2_mouse.cpp) diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index c243c83cb..991b13205 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -29,7 +29,7 @@ msgid "&Hide status bar" msgstr "&Piilota tilapalkki" msgid "Hide &toolbar" -msgstr "Hide &toolbar" +msgstr "Piilota &työkalupalkki" msgid "&Resizeable window" msgstr "&Salli koon muuttaminen" @@ -59,7 +59,7 @@ msgid "Specify dimensions..." msgstr "&Määritä koko..." msgid "F&orce 4:3 display ratio" -msgstr "Pakota 4:3 näyttösuhde" +msgstr "Pakota 4:3-näyttösuhde" msgid "&Window scale factor" msgstr "&Ikkunan kokokerroin" @@ -107,19 +107,19 @@ msgid "&Integer scale" msgstr "&Kokonaislukuskaalaus" msgid "E&GA/(S)VGA settings" -msgstr "&EGA/(S)VGA asetukset" +msgstr "&EGA/(S)VGA-asetukset" msgid "&Inverted VGA monitor" msgstr "&VGA näyttö käänteisillä väreillä" msgid "VGA screen &type" -msgstr "VGA näytön &tyyppi" +msgstr "VGA-näytön &tyyppi" msgid "RGB &Color" -msgstr "RGB &värit" +msgstr "RGB, &värit" msgid "&RGB Grayscale" -msgstr "&RGB harmaasävyinen" +msgstr "&RGB, harmaasävy" msgid "&Amber monitor" msgstr "&Meripihkanvärinen" @@ -143,7 +143,7 @@ msgid "&Average" msgstr "&Keskiarvo" msgid "CGA/PCjr/Tandy/E&GA/(S)VGA overscan" -msgstr "CGA/PCjr/Tandy/E&GA/(S)VGA &yliskannaus" +msgstr "CGA/PCjr/Tandy/E&GA/(S)VGA-&yliskannaus" msgid "Change contrast for &monochrome display" msgstr "&Muuta harmaavärinäytön kontrastia" @@ -152,7 +152,7 @@ msgid "&Media" msgstr "&Media" msgid "&Tools" -msgstr "&Työkalut" +msgstr "Työ&kalut" msgid "&Settings..." msgstr "&Kokoonpano..." @@ -167,10 +167,10 @@ msgid "&Preferences..." msgstr "&Sovellusasetukset..." msgid "Enable &Discord integration" -msgstr "Käytä &Discord integraatiota" +msgstr "Käytä &Discord-integraatiota" msgid "Sound &gain..." -msgstr "&Äänen tulotaso..." +msgstr "&Äänitasot..." msgid "Begin trace\tCtrl+T" msgstr "Aloita jäljitys\tCtrl+T" @@ -182,19 +182,19 @@ msgid "&Help" msgstr "&Ohje" msgid "&Documentation..." -msgstr "&Dokumentaatio..." +msgstr "&Ohjekirja..." msgid "&About 86Box..." -msgstr "&Tietoja 86Box:sta..." +msgstr "&Tietoja 86Boxista..." msgid "&New image..." -msgstr "&Uusi kasettikuva..." +msgstr "&Uusi levykuva..." msgid "&Existing image..." -msgstr "&Olemassaoleva kasettikuva..." +msgstr "&Olemassaoleva levykuva..." msgid "Existing image (&Write-protected)..." -msgstr "Olemassaoleva kasettikuva (&kirjoitussuojattu)..." +msgstr "Olemassaoleva levykuva (&kirjoitussuojattu)..." msgid "&Record" msgstr "&Nauhoita" @@ -209,7 +209,7 @@ msgid "&Fast forward to the end" msgstr "Kelaa &loppuun" msgid "E&ject" -msgstr "&Poista kasettipesästä" +msgstr "&Poista asemasta" msgid "&Image..." msgstr "&ROM-moduulikuva..." @@ -263,7 +263,7 @@ msgid "Preferences" msgstr "Sovellusasetukset" msgid "Sound Gain" -msgstr "Äänen tulotaso" +msgstr "Äänen taso" msgid "New Image" msgstr "Uusi levykuva" @@ -302,7 +302,7 @@ msgid "Disk size:" msgstr "Levyn koko:" msgid "RPM mode:" -msgstr "RPM tila:" +msgstr "Kierroslukutila:" msgid "Progress:" msgstr "Edistyminen:" @@ -470,10 +470,10 @@ msgid "FD Controller:" msgstr "Levykeohjain:" msgid "Tertiary IDE Controller" -msgstr "Tertinäärinen IDE-ohjain" +msgstr "Kolmas IDE-ohjain" msgid "Quaternary IDE Controller" -msgstr "Kvaternaarinen IDE-ohjain" +msgstr "Neljäs IDE-ohjain" msgid "SCSI" msgstr "SCSI" @@ -521,7 +521,7 @@ msgid "Sectors:" msgstr "Sektorit:" msgid "Heads:" -msgstr "Päät:" +msgstr "Lukupäät:" msgid "Cylinders:" msgstr "Sylinterit:" @@ -599,7 +599,7 @@ msgid "Fatal error" msgstr "Vakava virhe" msgid " - PAUSED" -msgstr " - PAUSED" +msgstr " - TAUKO" msgid "Press Ctrl+Alt+PgDn to return to windowed mode." msgstr "Paina Ctrl+Alt+PgDn palataksesi ikkunoituun tilaan." @@ -614,7 +614,7 @@ msgid "ZIP images" msgstr "ZIP-levykuvat" msgid "86Box could not find any usable ROM images.\n\nPlease download a ROM set and extract it into the \"roms\" directory." -msgstr "86Box ei löytänyt käyttökelpoisia ROM-tiedostoja.\n\nVoit ladata ROM-paketin ja purkaa sen \"roms\" hakemistoon." +msgstr "86Box ei löytänyt käyttökelpoisia ROM-tiedostoja.\n\nVoit ladata ROM-paketin ja purkaa sen \"roms\"-hakemistoon." msgid "(empty)" msgstr "(tyhjä)" @@ -689,7 +689,7 @@ msgid "Press F8+F12 or middle button to release mouse" msgstr "Paina F8+F12 tai keskipainiketta vapauttaaksesi hiiren" msgid "Unable to initialize FluidSynth" -msgstr "FluidSynth:in alustus epäonnistui" +msgstr "FluidSynthin alustus epäonnistui" msgid "Bus" msgstr "Väylä" @@ -710,7 +710,7 @@ msgid "KB" msgstr "kt" msgid "Could not initialize the video renderer." -msgstr "Video-renderöijän alustus epäonnistui" +msgstr "Videorenderöijän alustus epäonnistui" msgid "Default" msgstr "Oletus" @@ -782,13 +782,13 @@ msgid "Unable to initialize SDL, SDL2.dll is required" msgstr "SDL:n alustus epäonnistui. Tarvitaan SDL2.dll" msgid "Are you sure you want to hard reset the emulated machine?" -msgstr "Oletko varma, että haluat käynnistää emuloidun tietokoneen uudelleen?" +msgstr "Haluatko varmasti käynnistää emuloidun tietokoneen uudelleen?" msgid "Are you sure you want to exit 86Box?" -msgstr "Haluatko varmasti sulkea 86Box:in?" +msgstr "Haluatko varmasti sulkea 86Boxin?" msgid "Unable to initialize Ghostscript" -msgstr "Ghostscript:in alustus epäonnistui" +msgstr "Ghostscriptin alustus epäonnistui" msgid "MO %i (%ls): %ls" msgstr "MO %i (%ls): %ls" @@ -797,7 +797,7 @@ msgid "MO images" msgstr "MO-levykuvat" msgid "Welcome to 86Box!" -msgstr "Tervetuloa 86Box:iin!" +msgstr "Tervetuloa 86Boxiin!" msgid "Internal controller" msgstr "Sisäinen ohjain" @@ -911,7 +911,7 @@ msgid "Cassette: %s" msgstr "Kasetti: %s" msgid "Cassette images" -msgstr "Kasetti-tiedostot" +msgstr "Kasettitiedostot" msgid "Cartridge %i: %ls" msgstr "ROM-moduuli %i: %ls" @@ -923,25 +923,25 @@ msgid "Error initializing renderer" msgstr "Virhe renderöijän alustuksessa" msgid "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." -msgstr "OpenGL (3.0 Core) renderöijän alustus epäonnistui. Käytä toista renderöijää." +msgstr "OpenGL (3.0 Core) -renderöijän alustus epäonnistui. Käytä toista renderöijää." msgid "Resume execution" -msgstr "Resume execution" +msgstr "Jatka suoritusta" msgid "Pause execution" -msgstr "Pause execution" +msgstr "Pysäytä suoritus" msgid "Press Ctrl+Alt+Del" -msgstr "Press Ctrl+Alt+Del" +msgstr "Paina Ctrl+Alt+Del" msgid "Press Ctrl+Alt+Esc" -msgstr "Press Ctrl+Alt+Esc" +msgstr "Paina Ctrl+Alt+Esc" msgid "Hard reset" -msgstr "Hard reset" +msgstr "Kylmä uudelleenkäynnistys" msgid "ACPI shutdown" -msgstr "ACPI shutdown" +msgstr "ACPI-sammutus" msgid "Hard disk (%s)" msgstr "Kiintolevy (%s)" @@ -953,7 +953,7 @@ msgid "%01i" msgstr "%01i" msgid "MFM/RLL or ESDI CD-ROM drives never existed" -msgstr "MFM/RLL tai ESDI CD-ROM asemia ei ole koskaan ollut olemassa" +msgstr "MFM/RLL- tai ESDI-CD-ROM-asemia ei ole koskaan ollut olemassa" msgid "Custom..." msgstr "Mukautettu..." @@ -968,7 +968,7 @@ msgid "Add Existing Hard Disk" msgstr "Lisää olemassaoleva kiintolevy" msgid "HDI disk images cannot be larger than 4 GB." -msgstr "HDI levykuvan suurin mahdollinen koko on 4 Gt." +msgstr "HDI-levykuvan suurin mahdollinen koko on 4 Gt." msgid "Disk images cannot be larger than 127 GB." msgstr "Levykuvien suurin mahdollinen koko on 127 Gt." @@ -1010,16 +1010,16 @@ msgid "Remember to partition and format the newly-created drive." msgstr "Muista osioida ja alustaa juuri luomasi asema." msgid "The selected file will be overwritten. Are you sure you want to use it?" -msgstr "Valittu tiedosto ylikirjoitetaan. Oletko varma, että haluat käyttää sitä?" +msgstr "Valittu tiedosto korvataan. Oletko varma, että haluat käyttää sitä?" msgid "Unsupported disk image" -msgstr "Levynkuvaa ei tueta" +msgstr "Levykuvaa ei tueta" msgid "Overwrite" -msgstr "Ylikirjoita" +msgstr "Korvaa" msgid "Don't overwrite" -msgstr "Älä ylikirjoita" +msgstr "Älä korvaa" msgid "Raw image (.img)" msgstr "Raaka levykuva (.img)" @@ -1169,16 +1169,16 @@ msgid "5.25\" 1.3 GB" msgstr "5.25\" 1.3 Gt" msgid "Perfect RPM" -msgstr "Täydellinen RPM" +msgstr "Täydellinen kierrosluku" msgid "1% below perfect RPM" -msgstr "1% alle täydellisen RPM:n" +msgstr "1% alle täydellisen kierrosluvun" msgid "1.5% below perfect RPM" -msgstr "1.5% alle täydellisen RPM:n" +msgstr "1.5% alle täydellisen kierrosluvun" msgid "2% below perfect RPM" -msgstr "2% alle täydellisen RPM:n" +msgstr "2% alle täydellisen kierrosluvun" msgid "(System Default)" msgstr "(Järjestelmän oletus)" diff --git a/src/qt/qt_deviceconfig.cpp b/src/qt/qt_deviceconfig.cpp index 9c5a6d9d2..faf5a6ddc 100644 --- a/src/qt/qt_deviceconfig.cpp +++ b/src/qt/qt_deviceconfig.cpp @@ -67,6 +67,7 @@ void DeviceConfig::ConfigureDevice(const _device_* device, int instance, Setting dc.ui->formLayout->addRow(config->description, cbox); break; } +#ifdef USE_RTMIDI case CONFIG_MIDI_OUT: { auto* cbox = new QComboBox(); @@ -74,9 +75,9 @@ void DeviceConfig::ConfigureDevice(const _device_* device, int instance, Setting auto* model = cbox->model(); int currentIndex = -1; int selected = config_get_int(device_context.name, const_cast(config->name), config->default_int); - for (int i = 0; i < rtmidi_get_num_devs(); i++) { + for (int i = 0; i < rtmidi_out_get_num_devs(); i++) { char midiName[512] = { 0 }; - rtmidi_get_dev_name(i, midiName); + rtmidi_out_get_dev_name(i, midiName); Models::AddEntry(model, midiName, i); if (selected == i) { @@ -107,6 +108,7 @@ void DeviceConfig::ConfigureDevice(const _device_* device, int instance, Setting cbox->setCurrentIndex(currentIndex); break; } +#endif case CONFIG_SELECTION: case CONFIG_HEX16: case CONFIG_HEX20: diff --git a/src/qt/qt_harddiskdialog.cpp b/src/qt/qt_harddiskdialog.cpp index 3e933ddab..b82f6927b 100644 --- a/src/qt/qt_harddiskdialog.cpp +++ b/src/qt/qt_harddiskdialog.cpp @@ -38,6 +38,7 @@ extern "C" { #include #include #include +#include #include "qt_harddrive_common.hpp" #include "qt_settings_bus_tracking.hpp" @@ -50,8 +51,9 @@ HarddiskDialog::HarddiskDialog(bool existing, QWidget *parent) : { ui->setupUi(this); - ui->fileField->setFilter(tr("Hard disk images") % util::DlgFilter({ "hd?","im?","vhd" }) % tr("All files") % util::DlgFilter({ "*" }, true)); if (existing) { + ui->fileField->setFilter(tr("Hard disk images") % util::DlgFilter({ "hd?", "im?", "vhd" }) % tr("All files") % util::DlgFilter({ "*" }, true)); + setWindowTitle(tr("Add Existing Hard Disk")); ui->lineEditCylinders->setEnabled(false); ui->lineEditHeads->setEnabled(false); @@ -64,8 +66,24 @@ HarddiskDialog::HarddiskDialog(bool existing, QWidget *parent) : connect(ui->fileField, &FileField::fileSelected, this, &HarddiskDialog::onExistingFileSelected); } else { + QStringList filters({ tr("Raw image") % util::DlgFilter({ "img" }, true), + tr("HDI image") % util::DlgFilter({ "hdi" }, true), + tr("HDX image") % util::DlgFilter({ "hdx" }, true), + tr("Fixed-size VHD") % util::DlgFilter({ "vhd" }, true), + tr("Dynamic-size VHD") % util::DlgFilter({ "vhd" }, true), + tr("Differencing VHD") % util::DlgFilter({ "vhd" }, true) }); + + ui->fileField->setFilter(filters.join(";;")); + setWindowTitle(tr("Add New Hard Disk")); ui->fileField->setCreateFile(true); + + connect(ui->fileField, &FileField::fileSelected, this, [this, filters] { + int filter = filters.indexOf(ui->fileField->selectedFilter()); + if (filter > -1) + ui->comboBoxFormat->setCurrentIndex(filter); + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); + }); } auto* model = ui->comboBoxFormat->model(); @@ -101,9 +119,6 @@ HarddiskDialog::HarddiskDialog(bool existing, QWidget *parent) : ui->lineEditSize->setValidator(new QIntValidator()); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); - if (!existing) connect(ui->fileField, &FileField::fileSelected, this, [this] { - ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); - }); } HarddiskDialog::~HarddiskDialog() @@ -705,6 +720,7 @@ void HarddiskDialog::on_comboBoxBus_currentIndexChanged(int index) { break; } + if (chanIdx == 0xFF) chanIdx = 0; ui->comboBoxChannel->setCurrentIndex(chanIdx); } diff --git a/src/qt/qt_harddrive_common.cpp b/src/qt/qt_harddrive_common.cpp index fa08f7f2c..a47e036c7 100644 --- a/src/qt/qt_harddrive_common.cpp +++ b/src/qt/qt_harddrive_common.cpp @@ -28,7 +28,7 @@ void Harddrives::populateBuses(QAbstractItemModel *model) { model->removeRows(0, model->rowCount()); model->insertRows(0, 6); model->setData(model->index(0, 0), "MFM/RLL"); - model->setData(model->index(1, 0), "XT IDE"); + model->setData(model->index(1, 0), "XTA"); model->setData(model->index(2, 0), "ESDI"); model->setData(model->index(3, 0), "IDE"); model->setData(model->index(4, 0), "ATAPI"); @@ -97,7 +97,7 @@ QString Harddrives::BusChannelName(uint8_t bus, uint8_t channel) { busName = QString("MFM/RLL (%1:%2)").arg(channel >> 1).arg(channel & 1); break; case HDD_BUS_XTA: - busName = QString("XT IDE (%1:%2)").arg(channel >> 1).arg(channel & 1); + busName = QString("XTA (%1:%2)").arg(channel >> 1).arg(channel & 1); break; case HDD_BUS_ESDI: busName = QString("ESDI (%1:%2)").arg(channel >> 1).arg(channel & 1); diff --git a/src/qt/qt_joystickconfiguration.cpp b/src/qt/qt_joystickconfiguration.cpp index 594a1ef17..54aec5c6d 100644 --- a/src/qt/qt_joystickconfiguration.cpp +++ b/src/qt/qt_joystickconfiguration.cpp @@ -43,7 +43,7 @@ JoystickConfiguration::JoystickConfiguration(int type, int joystick_nr, QWidget } ui->comboBoxDevice->setCurrentIndex(joystick_state[joystick_nr].plat_joystick_nr); - setFixedSize(minimumSizeHint()); + layout()->setSizeConstraint(QLayout::SetFixedSize); } JoystickConfiguration::~JoystickConfiguration() @@ -82,7 +82,9 @@ int JoystickConfiguration::selectedPov(int pov) { void JoystickConfiguration::on_comboBoxDevice_currentIndexChanged(int index) { for (auto w : widgets) { ui->ct->removeWidget(w); + w->deleteLater(); } + widgets.clear(); if (index == 0) { return; @@ -197,6 +199,4 @@ void JoystickConfiguration::on_comboBoxDevice_currentIndexChanged(int index) { ++row; } - - setFixedSize(minimumSizeHint()); } diff --git a/src/qt/qt_joystickconfiguration.ui b/src/qt/qt_joystickconfiguration.ui index abe17b5cc..7789b48c4 100644 --- a/src/qt/qt_joystickconfiguration.ui +++ b/src/qt/qt_joystickconfiguration.ui @@ -11,7 +11,7 @@ - Dialog + Joystick configuration diff --git a/src/qt/qt_machinestatus.cpp b/src/qt/qt_machinestatus.cpp index ea83b630b..75062aede 100644 --- a/src/qt/qt_machinestatus.cpp +++ b/src/qt/qt_machinestatus.cpp @@ -358,7 +358,7 @@ void MachineStatus::refresh(QStatusBar* sbar) { if (cassette_enable) { d->cassette.label = std::make_unique(); d->cassette.setEmpty(QString(cassette_fname).isEmpty()); - connect((ClickableLabel*)d->cassette.label.get(), &ClickableLabel::clicked, [this](QPoint pos) { + connect((ClickableLabel*)d->cassette.label.get(), &ClickableLabel::clicked, [](QPoint pos) { MediaMenu::ptr->cassetteMenu->popup(pos - QPoint(0, MediaMenu::ptr->cassetteMenu->sizeHint().height())); }); d->cassette.label->setToolTip(MediaMenu::ptr->cassetteMenu->title()); @@ -369,7 +369,7 @@ void MachineStatus::refresh(QStatusBar* sbar) { for (int i = 0; i < 2; ++i) { d->cartridge[i].label = std::make_unique(); d->cartridge[i].setEmpty(QString(cart_fns[i]).isEmpty()); - connect((ClickableLabel*)d->cartridge[i].label.get(), &ClickableLabel::clicked, [this, i](QPoint pos) { + connect((ClickableLabel*)d->cartridge[i].label.get(), &ClickableLabel::clicked, [i](QPoint pos) { MediaMenu::ptr->cartridgeMenus[i]->popup(pos - QPoint(0, MediaMenu::ptr->cartridgeMenus[i]->sizeHint().height())); }); d->cartridge[i].label->setToolTip(MediaMenu::ptr->cartridgeMenus[i]->title()); @@ -389,7 +389,7 @@ void MachineStatus::refresh(QStatusBar* sbar) { d->fdd[i].label = std::make_unique(); d->fdd[i].setEmpty(QString(floppyfns[i]).isEmpty()); d->fdd[i].setActive(false); - connect((ClickableLabel*)d->fdd[i].label.get(), &ClickableLabel::clicked, [this, i](QPoint pos) { + connect((ClickableLabel*)d->fdd[i].label.get(), &ClickableLabel::clicked, [i](QPoint pos) { MediaMenu::ptr->floppyMenus[i]->popup(pos - QPoint(0, MediaMenu::ptr->floppyMenus[i]->sizeHint().height())); }); d->fdd[i].label->setToolTip(MediaMenu::ptr->floppyMenus[i]->title()); @@ -400,7 +400,7 @@ void MachineStatus::refresh(QStatusBar* sbar) { d->cdrom[i].label = std::make_unique(); d->cdrom[i].setEmpty(cdrom[i].host_drive != 200 || QString(cdrom[i].image_path).isEmpty()); d->cdrom[i].setActive(false); - connect((ClickableLabel*)d->cdrom[i].label.get(), &ClickableLabel::clicked, [this, i](QPoint pos) { + connect((ClickableLabel*)d->cdrom[i].label.get(), &ClickableLabel::clicked, [i](QPoint pos) { MediaMenu::ptr->cdromMenus[i]->popup(pos - QPoint(0, MediaMenu::ptr->cdromMenus[i]->sizeHint().height())); }); d->cdrom[i].label->setToolTip(MediaMenu::ptr->cdromMenus[i]->title()); @@ -411,7 +411,7 @@ void MachineStatus::refresh(QStatusBar* sbar) { d->zip[i].label = std::make_unique(); d->zip[i].setEmpty(QString(zip_drives[i].image_path).isEmpty()); d->zip[i].setActive(false); - connect((ClickableLabel*)d->zip[i].label.get(), &ClickableLabel::clicked, [this, i](QPoint pos) { + connect((ClickableLabel*)d->zip[i].label.get(), &ClickableLabel::clicked, [i](QPoint pos) { MediaMenu::ptr->zipMenus[i]->popup(pos - QPoint(0, MediaMenu::ptr->zipMenus[i]->sizeHint().height())); }); d->zip[i].label->setToolTip(MediaMenu::ptr->zipMenus[i]->title()); @@ -422,7 +422,7 @@ void MachineStatus::refresh(QStatusBar* sbar) { d->mo[i].label = std::make_unique(); d->mo[i].setEmpty(QString(mo_drives[i].image_path).isEmpty()); d->mo[i].setActive(false); - connect((ClickableLabel*)d->mo[i].label.get(), &ClickableLabel::clicked, [this, i](QPoint pos) { + connect((ClickableLabel*)d->mo[i].label.get(), &ClickableLabel::clicked, [i](QPoint pos) { MediaMenu::ptr->moMenus[i]->popup(pos - QPoint(0, MediaMenu::ptr->moMenus[i]->sizeHint().height())); }); d->mo[i].label->setToolTip(MediaMenu::ptr->moMenus[i]->title()); @@ -471,7 +471,7 @@ void MachineStatus::refresh(QStatusBar* sbar) { d->sound = std::make_unique(); d->sound->setPixmap(d->pixmaps.sound); - connect(d->sound.get(), &ClickableLabel::doubleClicked, d->sound.get(), [this](QPoint pos) { + connect(d->sound.get(), &ClickableLabel::doubleClicked, d->sound.get(), [](QPoint pos) { SoundGain gain(main_window); gain.exec(); }); diff --git a/src/qt/qt_main.cpp b/src/qt/qt_main.cpp index 47dc52356..d14b95ae0 100644 --- a/src/qt/qt_main.cpp +++ b/src/qt/qt_main.cpp @@ -168,6 +168,8 @@ int main(int argc, char* argv[]) { { return 0; } + + fprintf(stderr, "Qt: version %s, platform \"%s\"\n", qVersion(), QApplication::platformName().toUtf8().data()); ProgSettings::loadTranslators(&app); #ifdef Q_OS_WINDOWS auto font_name = QObject::tr("FONT_NAME"); @@ -249,7 +251,7 @@ int main(int argc, char* argv[]) { { QObject::connect(&socket, &UnixManagerSocket::showsettings, main_window, &MainWindow::showSettings); QObject::connect(&socket, &UnixManagerSocket::pause, main_window, &MainWindow::togglePause); - QObject::connect(&socket, &UnixManagerSocket::reset, main_window, &MainWindow::hardReset); + QObject::connect(&socket, &UnixManagerSocket::resetVM, main_window, &MainWindow::hardReset); QObject::connect(&socket, &UnixManagerSocket::request_shutdown, main_window, &MainWindow::close); QObject::connect(&socket, &UnixManagerSocket::force_shutdown, [](){ do_stop(); diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 0c1d88fb8..b3d85ada4 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -72,7 +72,7 @@ extern "C" { #include "qt_mediamenu.hpp" #include "qt_util.hpp" -#ifdef __unix__ +#if defined __unix__ && !defined __HAIKU__ #ifdef WAYLAND #include "wl_mouse.hpp" #endif @@ -82,6 +82,32 @@ extern "C" { #undef KeyRelease #endif +#ifdef __HAIKU__ +#include +#include + +extern MainWindow* main_window; + +filter_result keyb_filter(BMessage *message, BHandler **target, BMessageFilter *filter) +{ + if (message->what == B_KEY_DOWN || message->what == B_KEY_UP + || message->what == B_UNMAPPED_KEY_DOWN || message->what == B_UNMAPPED_KEY_UP) + { + int key_state = 0, key_scancode = 0; + key_state = message->what == B_KEY_DOWN || message->what == B_UNMAPPED_KEY_DOWN; + message->FindInt32("key", &key_scancode); + QGuiApplication::postEvent(main_window, new QKeyEvent(key_state ? QEvent::KeyPress : QEvent::KeyRelease, 0, QGuiApplication::keyboardModifiers(), key_scancode, 0, 0)); + if (key_scancode == 0x68 && key_state) + { + QGuiApplication::postEvent(main_window, new QKeyEvent(QEvent::KeyRelease, 0, QGuiApplication::keyboardModifiers(), key_scancode, 0, 0)); + } + } + return B_DISPATCH_MESSAGE; +} + +static BMessageFilter* filter; +#endif + extern void qt_mouse_capture(int); extern "C" void qt_blit(int x, int y, int w, int h); @@ -93,6 +119,10 @@ MainWindow::MainWindow(QWidget *parent) : MediaMenu::ptr = mm; status = std::make_unique(this); +#ifdef __HAIKU__ + filter = new BMessageFilter(B_PROGRAMMED_DELIVERY, B_ANY_SOURCE, keyb_filter); + ((BWindow*)this->winId())->AddFilter(filter); +#endif setUnifiedTitleAndToolBarOnMac(true); ui->setupUi(this); ui->stackedWidget->setMouseTracking(true); @@ -234,9 +264,12 @@ MainWindow::MainWindow(QWidget *parent) : ui->actionHardware_Renderer_OpenGL->setVisible(QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGLES); if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES && vid_api == 1) vid_api = 0; - if (QApplication::platformName().contains("eglfs") && vid_api >= 1) { - fprintf(stderr, "OpenGL renderers are unsupported on EGLFS.\n"); + if ((QApplication::platformName().contains("eglfs") || QApplication::platformName() == "haiku")) { + if (vid_api >= 1) fprintf(stderr, "OpenGL renderers are unsupported on %s.\n", QApplication::platformName().toUtf8().data()); vid_api = 0; + ui->actionHardware_Renderer_OpenGL->setVisible(false); + ui->actionHardware_Renderer_OpenGL_ES->setVisible(false); + ui->actionOpenGL_3_0_Core->setVisible(false); } QActionGroup* actGroup = nullptr; @@ -437,6 +470,11 @@ MainWindow::MainWindow(QWidget *parent) : } void MainWindow::closeEvent(QCloseEvent *event) { + if (mouse_capture) { + event->ignore(); + return; + } + if (confirm_exit && confirm_exit_cmdl && cpu_thread_run) { QMessageBox questionbox(QMessageBox::Icon::Question, "86Box", tr("Are you sure you want to exit 86Box?"), QMessageBox::Yes | QMessageBox::No, this); @@ -464,7 +502,7 @@ void MainWindow::closeEvent(QCloseEvent *event) { } qt_nvr_save(); config_save(); -#ifdef __unix__ +#if defined __unix__ && !defined __HAIKU__ extern void xinput2_exit(); if (QApplication::platformName() == "xcb") xinput2_exit(); #endif @@ -1054,6 +1092,117 @@ static std::unordered_map evdev_to_xt = {111, 0x153} }; +#ifdef __HAIKU__ +static std::unordered_map be_to_xt = +{ + {0x01, 0x01}, + {B_F1_KEY, 0x3B}, + {B_F2_KEY, 0x3C}, + {B_F3_KEY, 0x3D}, + {B_F4_KEY, 0x3E}, + {B_F5_KEY, 0x3F}, + {B_F6_KEY, 0x40}, + {B_F7_KEY, 0x41}, + {B_F8_KEY, 0x42}, + {B_F9_KEY, 0x43}, + {B_F10_KEY, 0x44}, + {B_F11_KEY, 0x57}, + {B_F12_KEY, 0x58}, + {0x11, 0x29}, + {0x12, 0x02}, + {0x13, 0x03}, + {0x14, 0x04}, + {0x15, 0x05}, + {0x16, 0x06}, + {0x17, 0x07}, + {0x18, 0x08}, + {0x19, 0x09}, + {0x1A, 0x0A}, + {0x1B, 0x0B}, + {0x1C, 0x0C}, + {0x1D, 0x0D}, + {0x1E, 0x0E}, + {0x1F, 0x152}, + {0x20, 0x147}, + {0x21, 0x149}, + {0x22, 0x45}, + {0x23, 0x135}, + {0x24, 0x37}, + {0x25, 0x4A}, + {0x26, 0x0F}, + {0x27, 0x10}, + {0x28, 0x11}, + {0x29, 0x12}, + {0x2A, 0x13}, + {0x2B, 0x14}, + {0x2C, 0x15}, + {0x2D, 0x16}, + {0x2E, 0x17}, + {0x2F, 0x18}, + {0x30, 0x19}, + {0x31, 0x1A}, + {0x32, 0x1B}, + {0x33, 0x2B}, + {0x34, 0x153}, + {0x35, 0x14F}, + {0x36, 0x151}, + {0x37, 0x47}, + {0x38, 0x48}, + {0x39, 0x49}, + {0x3A, 0x4E}, + {0x3B, 0x3A}, + {0x3C, 0x1E}, + {0x3D, 0x1F}, + {0x3E, 0x20}, + {0x3F, 0x21}, + {0x40, 0x22}, + {0x41, 0x23}, + {0x42, 0x24}, + {0x43, 0x25}, + {0x44, 0x26}, + {0x45, 0x27}, + {0x46, 0x28}, + {0x47, 0x1C}, + {0x48, 0x4B}, + {0x49, 0x4C}, + {0x4A, 0x4D}, + {0x4B, 0x2A}, + {0x4C, 0x2C}, + {0x4D, 0x2D}, + {0x4E, 0x2E}, + {0x4F, 0x2F}, + {0x50, 0x30}, + {0x51, 0x31}, + {0x52, 0x32}, + {0x53, 0x33}, + {0x54, 0x34}, + {0x55, 0x35}, + {0x56, 0x36}, + {0x57, 0x148}, + {0x58, 0x51}, + {0x59, 0x50}, + {0x5A, 0x4F}, + {0x5B, 0x11C}, + {0x5C, 0x1D}, + {0x5D, 0x38}, + {0x5E, 0x39}, + {0x5F, 0x138}, + {0x60, 0x11D}, + {0x61, 0x14B}, + {0x62, 0x150}, + {0x63, 0x14D}, + {0x64, 0x52}, + {0x65, 0x53}, + + {0x0e, 0x137}, + {0x0f, 0x46}, + {0x66, 0x15B}, + {0x67, 0x15C}, + {0x68, 0x15D}, + {0x69, 0x56} +}; +#endif + static std::array& selected_keycode = x11_to_xt_base; uint16_t x11_keycode_to_keysym(uint32_t keycode) @@ -1063,6 +1212,8 @@ uint16_t x11_keycode_to_keysym(uint32_t keycode) finalkeycode = (keycode & 0xFFFF); #elif defined(__APPLE__) finalkeycode = darwin_to_xt[keycode]; +#elif defined(__HAIKU__) + finalkeycode = be_to_xt[keycode]; #else static Display* x11display = nullptr; if (QApplication::platformName().contains("wayland")) diff --git a/src/qt/qt_newfloppydialog.cpp b/src/qt/qt_newfloppydialog.cpp index 6eb43c960..30b0fb674 100644 --- a/src/qt/qt_newfloppydialog.cpp +++ b/src/qt/qt_newfloppydialog.cpp @@ -339,6 +339,11 @@ bool NewFloppyDialog::create86f(const QString& filename, const disk_size_t& disk return true; } +/* Ignore false positive warning caused by a bug on gcc */ +#if __GNUC__ >= 11 +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif + bool NewFloppyDialog::createSectorImage(const QString &filename, const disk_size_t& disk_size, FileType type) { uint32_t total_size = 0; diff --git a/src/qt/qt_opengloptions.cpp b/src/qt/qt_opengloptions.cpp index 73eaad98e..f90ba37c0 100644 --- a/src/qt/qt_opengloptions.cpp +++ b/src/qt/qt_opengloptions.cpp @@ -14,6 +14,7 @@ * Copyright 2022 Teemu Korhonen */ +#include #include #include #include @@ -45,9 +46,14 @@ void main() {\n\ color = texture(texsampler, tex);\n\ }\n"; -OpenGLOptions::OpenGLOptions(QObject *parent, bool loadConfig) +OpenGLOptions::OpenGLOptions(QObject *parent, bool loadConfig, const QString &glslVersion) : QObject(parent) + , m_glslVersion(glslVersion) { + m_filter = video_filter_method == 0 + ? FilterType::Nearest + : FilterType::Linear; + if (!loadConfig) return; @@ -59,10 +65,6 @@ OpenGLOptions::OpenGLOptions(QObject *parent, bool loadConfig) ? RenderBehaviorType::SyncWithVideo : RenderBehaviorType::TargetFramerate; - m_filter = video_filter_method == 0 - ? FilterType::Nearest - : FilterType::Linear; - QString shaderPath(video_shader); if (shaderPath.isEmpty()) { @@ -88,7 +90,7 @@ OpenGLOptions::save() const auto path = m_shaders.first().path().toLocal8Bit(); if (!path.isEmpty()) - strcpy(video_shader, path.constData()); + qstrncpy(video_shader, path.constData(), sizeof(video_shader)); else video_shader[0] = '\0'; } @@ -143,11 +145,14 @@ OpenGLOptions::addShader(const QString &path) shader_file.close(); + /* Remove parameter lines */ + shader_text.remove(QRegularExpression("^\\s*#pragma parameter.*?\\n", QRegularExpression::MultilineOption)); + QRegularExpression version("^\\s*(#version\\s+\\w+)", QRegularExpression::MultilineOption); auto match = version.match(shader_text); - QString version_line("#version 130"); + QString version_line(m_glslVersion); if (match.hasMatch()) { /* Extract existing version and remove it. */ @@ -155,10 +160,6 @@ OpenGLOptions::addShader(const QString &path) shader_text.remove(version); } - if (QOpenGLContext::currentContext() && QOpenGLContext::currentContext()->isOpenGLES()) { - /* Force #version 300 es (the default of #version 100 es is too old and too limited) */ - version_line = "#version 300 es"; - } auto shader = new QOpenGLShaderProgram(this); auto throw_shader_error = [path, shader](const QString &what) { @@ -169,10 +170,12 @@ OpenGLOptions::addShader(const QString &path) .toStdString()); }; - if (!shader->addShaderFromSourceCode(QOpenGLShader::Vertex, version_line % "\n#extension GL_ARB_shading_language_420pack : enable\n" % "\n#define VERTEX\n" % shader_text)) + static const char *extension = "\n#extension GL_ARB_shading_language_420pack : enable\n"; + + if (!shader->addShaderFromSourceCode(QOpenGLShader::Vertex, version_line % extension % "\n#define VERTEX\n#line 1\n" % shader_text)) throw_shader_error(tr("Error compiling vertex shader in file \"%1\"")); - if (!shader->addShaderFromSourceCode(QOpenGLShader::Fragment, version_line % "\n#extension GL_ARB_shading_language_420pack : enable\n" "\n#define FRAGMENT\n" % shader_text)) + if (!shader->addShaderFromSourceCode(QOpenGLShader::Fragment, version_line % extension % "\n#define FRAGMENT\n#line 1\n" % shader_text)) throw_shader_error(tr("Error compiling fragment shader in file \"%1\"")); if (!shader->link()) @@ -184,13 +187,9 @@ OpenGLOptions::addShader(const QString &path) void OpenGLOptions::addDefaultShader() { - QString version = QOpenGLContext::currentContext() && QOpenGLContext::currentContext()->isOpenGLES() - ? "#version 300 es\n" - : "#version 130\n"; - auto shader = new QOpenGLShaderProgram(this); - shader->addShaderFromSourceCode(QOpenGLShader::Vertex, version % vertex_shader); - shader->addShaderFromSourceCode(QOpenGLShader::Fragment, version % fragment_shader); + shader->addShaderFromSourceCode(QOpenGLShader::Vertex, m_glslVersion % "\n" % vertex_shader); + shader->addShaderFromSourceCode(QOpenGLShader::Fragment, m_glslVersion % "\n" % fragment_shader); shader->link(); m_shaders << OpenGLShaderPass(shader, QString()); } diff --git a/src/qt/qt_opengloptions.hpp b/src/qt/qt_opengloptions.hpp index 45a11377a..b88cf4b07 100644 --- a/src/qt/qt_opengloptions.hpp +++ b/src/qt/qt_opengloptions.hpp @@ -72,14 +72,14 @@ public: enum FilterType { Nearest, Linear }; - OpenGLOptions(QObject *parent = nullptr, bool loadConfig = false); + OpenGLOptions(QObject *parent, bool loadConfig, const QString &glslVersion); RenderBehaviorType renderBehavior() const { return m_renderBehavior; } int framerate() const { return m_framerate; } bool vSync() const { return m_vsync; } FilterType filter() const; - const QList &shaders() const { return m_shaders; }; + const QList &shaders() const { return m_shaders; } void setRenderBehavior(RenderBehaviorType value); void setFrameRate(int value); @@ -95,6 +95,7 @@ private: bool m_vsync = false; FilterType m_filter = Nearest; QList m_shaders; + QString m_glslVersion; }; #endif diff --git a/src/qt/qt_opengloptionsdialog.cpp b/src/qt/qt_opengloptionsdialog.cpp index d996fbd3c..c87989161 100644 --- a/src/qt/qt_opengloptionsdialog.cpp +++ b/src/qt/qt_opengloptionsdialog.cpp @@ -24,9 +24,10 @@ #include "qt_util.hpp" #include "ui_qt_opengloptionsdialog.h" -OpenGLOptionsDialog::OpenGLOptionsDialog(QWidget *parent, const OpenGLOptions &options) +OpenGLOptionsDialog::OpenGLOptionsDialog(QWidget *parent, const OpenGLOptions &options, std::function optionsFactory) : QDialog(parent) , ui(new Ui::OpenGLOptionsDialog) + , createOptions(optionsFactory) { ui->setupUi(this); @@ -54,7 +55,7 @@ OpenGLOptionsDialog::~OpenGLOptionsDialog() void OpenGLOptionsDialog::accept() { - auto options = new OpenGLOptions(); + auto options = createOptions(); options->setRenderBehavior( ui->syncWithVideo->isChecked() diff --git a/src/qt/qt_opengloptionsdialog.hpp b/src/qt/qt_opengloptionsdialog.hpp index 833c58471..6b1c673bd 100644 --- a/src/qt/qt_opengloptionsdialog.hpp +++ b/src/qt/qt_opengloptionsdialog.hpp @@ -19,6 +19,8 @@ #include +#include + #include "qt_opengloptions.hpp" namespace Ui { @@ -29,7 +31,7 @@ class OpenGLOptionsDialog : public QDialog { Q_OBJECT public: - explicit OpenGLOptionsDialog(QWidget *parent, const OpenGLOptions &options); + explicit OpenGLOptionsDialog(QWidget *parent, const OpenGLOptions &options, std::function optionsFactory); ~OpenGLOptionsDialog(); signals: @@ -41,6 +43,8 @@ public slots: private: Ui::OpenGLOptionsDialog *ui; + std::function createOptions; + private slots: void on_addShader_clicked(); }; diff --git a/src/qt/qt_openglrenderer.cpp b/src/qt/qt_openglrenderer.cpp index 9240b2604..d4724fdde 100644 --- a/src/qt/qt_openglrenderer.cpp +++ b/src/qt/qt_openglrenderer.cpp @@ -18,8 +18,8 @@ #include #include #include +#include #include -#include #include @@ -42,20 +42,18 @@ OpenGLRenderer::OpenGLRenderer(QWidget *parent) QSurfaceFormat format; +#ifdef Q_OS_MACOS + format.setVersion(4, 1); +#else + format.setVersion(3, 2); +#endif format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile); - format.setMajorVersion(3); - format.setMinorVersion(0); + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) format.setRenderableType(QSurfaceFormat::OpenGLES); setFormat(format); - context = new QOpenGLContext(this); - - context->setFormat(format); - - context->create(); - parentWidget = parent; source.setRect(0, 0, INIT_WIDTH, INIT_HEIGHT); @@ -108,64 +106,98 @@ OpenGLRenderer::event(QEvent *event) void OpenGLRenderer::initialize() { - if (!context->makeCurrent(this)) { - /* TODO: This could be done much better */ - QMessageBox::critical((QWidget *) qApp->findChild(), tr("Error initializing OpenGL"), tr("Error setting OpenGL context. Falling back to software rendering.")); + try { + context = new QOpenGLContext(this); + + context->setFormat(format()); + + if (!context->create()) + throw opengl_init_error(tr("Couldn't create OpenGL context.")); + + if (!context->makeCurrent(this)) + throw opengl_init_error(tr("Couldn't switch to OpenGL context.")); + + auto version = context->format().version(); + + if (version.first < 3) + throw opengl_init_error(tr("OpenGL version 3.0 or greater is required. Current version is %1.%2").arg(version.first).arg(version.second)); + + initializeOpenGLFunctions(); + + /* Prepare the shader version string */ + glslVersion = reinterpret_cast(glGetString(GL_SHADING_LANGUAGE_VERSION)); + glslVersion.truncate(4); + glslVersion.remove('.'); + glslVersion.prepend("#version "); + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) + glslVersion.append(" es"); + else if (context->format().profile() == QSurfaceFormat::CoreProfile) + glslVersion.append(" core"); + + initializeExtensions(); + + initializeBuffers(); + + /* Vertex, texture 2d coordinates and color (white) making a quad as triangle strip */ + const GLfloat surface[] = { + -1.f, 1.f, 0.f, 0.f, 1.f, 1.f, 1.f, 1.f, + 1.f, 1.f, 1.f, 0.f, 1.f, 1.f, 1.f, 1.f, + -1.f, -1.f, 0.f, 1.f, 1.f, 1.f, 1.f, 1.f, + 1.f, -1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f + }; + + glGenVertexArrays(1, &vertexArrayID); + + glBindVertexArray(vertexArrayID); + + glGenBuffers(1, &vertexBufferID); + glBindBuffer(GL_ARRAY_BUFFER, vertexBufferID); + glBufferData(GL_ARRAY_BUFFER, sizeof(surface), surface, GL_STATIC_DRAW); + + glGenTextures(1, &textureID); + glBindTexture(GL_TEXTURE_2D, textureID); + + const GLfloat border_color[] = { 0.f, 0.f, 0.f, 1.f }; + + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, border_color); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); + + glTexImage2D(GL_TEXTURE_2D, 0, QOpenGLTexture::RGBA8_UNorm, INIT_WIDTH, INIT_HEIGHT, 0, QOpenGLTexture::BGRA, QOpenGLTexture::UInt32_RGBA8_Rev, NULL); + + options = new OpenGLOptions(this, true, glslVersion); + + applyOptions(); + + glClearColor(0.f, 0.f, 0.f, 1.f); + + glViewport( + destination.x(), + destination.y(), + destination.width() * devicePixelRatio(), + destination.height() * devicePixelRatio()); + + GLenum error = glGetError(); + if (error != GL_NO_ERROR) + throw opengl_init_error(tr("OpenGL initialization failed. Error %1.").arg(error)); + + isInitialized = true; + + emit initialized(); + + } catch (const opengl_init_error &e) { + /* Mark all buffers as in use */ + for (auto &flag : buf_usage) + flag.test_and_set(); + + QMessageBox::critical((QWidget *) qApp->findChild(), tr("Error initializing OpenGL"), e.what() % tr("\nFalling back to software rendering.")); + context->doneCurrent(); isFinalized = true; isInitialized = true; + emit errorInitializing(); - return; } - - initializeOpenGLFunctions(); - - setupExtensions(); - - setupBuffers(); - - /* Vertex, texture 2d coordinates and color (white) making a quad as triangle strip */ - const GLfloat surface[] = { - -1.f, 1.f, 0.f, 0.f, 1.f, 1.f, 1.f, 1.f, - 1.f, 1.f, 1.f, 0.f, 1.f, 1.f, 1.f, 1.f, - -1.f, -1.f, 0.f, 1.f, 1.f, 1.f, 1.f, 1.f, - 1.f, -1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f - }; - - glGenVertexArrays(1, &vertexArrayID); - - glBindVertexArray(vertexArrayID); - - glGenBuffers(1, &vertexBufferID); - glBindBuffer(GL_ARRAY_BUFFER, vertexBufferID); - glBufferData(GL_ARRAY_BUFFER, sizeof(surface), surface, GL_STATIC_DRAW); - - glGenTextures(1, &textureID); - glBindTexture(GL_TEXTURE_2D, textureID); - - const GLfloat border_color[] = { 0.f, 0.f, 0.f, 1.f }; - - glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, border_color); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); - - glTexImage2D(GL_TEXTURE_2D, 0, QOpenGLTexture::RGBA8_UNorm, INIT_WIDTH, INIT_HEIGHT, 0, QOpenGLTexture::BGRA, QOpenGLTexture::UInt32_RGBA8_Rev, NULL); - - options = new OpenGLOptions(this, true); - - applyOptions(); - - glClearColor(0.f, 0.f, 0.f, 1.f); - - glViewport( - destination.x(), - destination.y(), - destination.width(), - destination.height()); - - isInitialized = true; - - emit initialized(); } void @@ -174,6 +206,8 @@ OpenGLRenderer::finalize() if (isFinalized) return; + renderTimer->stop(); + context->makeCurrent(this); if (hasBufferStorage) @@ -195,7 +229,7 @@ OpenGLRenderer::finalize() QDialog * OpenGLRenderer::getOptions(QWidget *parent) { - auto dialog = new OpenGLOptionsDialog(parent, *options); + auto dialog = new OpenGLOptionsDialog(parent, *options, [this]() { return new OpenGLOptions(this, false, glslVersion); }); connect(dialog, &OpenGLOptionsDialog::optionsChanged, this, &OpenGLRenderer::updateOptions); @@ -203,7 +237,7 @@ OpenGLRenderer::getOptions(QWidget *parent) } void -OpenGLRenderer::setupExtensions() +OpenGLRenderer::initializeExtensions() { #ifndef NO_BUFFER_STORAGE if (context->hasExtension("GL_ARB_buffer_storage")) { @@ -215,7 +249,7 @@ OpenGLRenderer::setupExtensions() } void -OpenGLRenderer::setupBuffers() +OpenGLRenderer::initializeBuffers() { glGenBuffers(1, &unpackBufferID); @@ -232,6 +266,9 @@ OpenGLRenderer::setupBuffers() /* Fallback; create our own buffer. */ unpackBuffer = malloc(BUFFERBYTES * BUFFERCOUNT); + if (unpackBuffer == nullptr) + throw opengl_init_error(tr("Allocating memory for unpack buffer failed.")); + glBufferData(GL_PIXEL_UNPACK_BUFFER, BUFFERBYTES * BUFFERCOUNT, NULL, GL_STREAM_DRAW); } } @@ -375,7 +412,7 @@ OpenGLRenderer::onBlit(int buf_idx, int x, int y, int w, int h) /* Resize the texture */ glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); - glTexImage2D(GL_TEXTURE_2D, 0, (GLenum)QOpenGLTexture::RGBA8_UNorm, source.width(), source.height(), 0, (GLenum)QOpenGLTexture::BGRA, (GLenum)QOpenGLTexture::UInt32_RGBA8_Rev, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, (GLenum) QOpenGLTexture::RGBA8_UNorm, source.width(), source.height(), 0, (GLenum) QOpenGLTexture::BGRA, (GLenum) QOpenGLTexture::UInt32_RGBA8_Rev, NULL); glBindBuffer(GL_PIXEL_UNPACK_BUFFER, unpackBufferID); } @@ -384,7 +421,7 @@ OpenGLRenderer::onBlit(int buf_idx, int x, int y, int w, int h) glPixelStorei(GL_UNPACK_SKIP_PIXELS, BUFFERPIXELS * buf_idx + y * ROW_LENGTH + x); glPixelStorei(GL_UNPACK_ROW_LENGTH, ROW_LENGTH); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, (GLenum)QOpenGLTexture::BGRA, (GLenum)QOpenGLTexture::UInt32_RGBA8_Rev, NULL); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, (GLenum) QOpenGLTexture::BGRA, (GLenum) QOpenGLTexture::UInt32_RGBA8_Rev, NULL); /* TODO: check if fence sync is implementable here and still has any benefit. */ glFinish(); diff --git a/src/qt/qt_openglrenderer.hpp b/src/qt/qt_openglrenderer.hpp index 47bc82c22..a83eac5dc 100644 --- a/src/qt/qt_openglrenderer.hpp +++ b/src/qt/qt_openglrenderer.hpp @@ -32,6 +32,7 @@ #endif #include +#include #include #include @@ -76,6 +77,8 @@ private: OpenGLOptions *options; QTimer *renderTimer; + QString glslVersion; + bool isInitialized = false; bool isFinalized = false; @@ -90,8 +93,8 @@ private: void *unpackBuffer = nullptr; void initialize(); - void setupExtensions(); - void setupBuffers(); + void initializeExtensions(); + void initializeBuffers(); void applyOptions(); void applyShader(const OpenGLShaderPass &shader); bool notReady() const { return !isInitialized || isFinalized; } @@ -107,4 +110,12 @@ private slots: void updateOptions(OpenGLOptions *newOptions); }; +class opengl_init_error : public std::runtime_error { +public: + opengl_init_error(const QString &what) + : std::runtime_error(what.toStdString()) + { + } +}; + #endif diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index 4ec31b842..508103169 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -74,11 +74,13 @@ private: extern "C" { #ifdef Q_OS_WINDOWS -#define NOMINMAX -#include -#include <86box/win.h> +# ifndef NOMINMAX +# define NOMINMAX +# endif +# include +# include <86box/win.h> #else -#include +# include #endif #include <86box/86box.h> #include <86box/device.h> @@ -238,10 +240,12 @@ plat_path_abs(char *path) void plat_path_normalize(char* path) { +#ifdef Q_OS_WINDOWS while (*path++ != 0) { if (*path == '\\') *path = '/'; } +#endif } void @@ -529,9 +533,11 @@ void ProgSettings::reloadStrings() translatedstrings[IDS_2078] = QCoreApplication::translate("", "Press F8+F12 to release mouse").replace("F8+F12", MOUSE_CAPTURE_KEYSEQ).replace("CTRL-END", QLocale::system().name() == "de_DE" ? "Strg+Ende" : "CTRL-END").toStdWString(); translatedstrings[IDS_2079] = QCoreApplication::translate("", "Press F8+F12 or middle button to release mouse").replace("F8+F12", MOUSE_CAPTURE_KEYSEQ).replace("CTRL-END", QLocale::system().name() == "de_DE" ? "Strg+Ende" : "CTRL-END").toStdWString(); translatedstrings[IDS_2080] = QCoreApplication::translate("", "Failed to initialize FluidSynth").toStdWString(); + translatedstrings[IDS_2130] = QCoreApplication::translate("", "Invalid configuration").toStdWString(); translatedstrings[IDS_4099] = QCoreApplication::translate("", "MFM/RLL or ESDI CD-ROM drives never existed").toStdWString(); translatedstrings[IDS_2093] = QCoreApplication::translate("", "Failed to set up PCap").toStdWString(); translatedstrings[IDS_2094] = QCoreApplication::translate("", "No PCap devices found").toStdWString(); + translatedstrings[IDS_2095] = QCoreApplication::translate("", "Invalid PCap device").toStdWString(); translatedstrings[IDS_2110] = QCoreApplication::translate("", "Unable to initialize FreeType").toStdWString(); translatedstrings[IDS_2111] = QCoreApplication::translate("", "Unable to initialize SDL, libsdl2 is required").toStdWString(); translatedstrings[IDS_2129] = QCoreApplication::translate("", "Make sure libpcap is installed and that you are on a libpcap-compatible network connection.").toStdWString(); @@ -539,6 +545,7 @@ void ProgSettings::reloadStrings() translatedstrings[IDS_2063] = QCoreApplication::translate("", "Machine \"%hs\" is not available due to missing ROMs in the roms/machines directory. Switching to an available machine.").toStdWString(); translatedstrings[IDS_2064] = QCoreApplication::translate("", "Video card \"%hs\" is not available due to missing ROMs in the roms/video directory. Switching to an available video card.").toStdWString(); translatedstrings[IDS_2128] = QCoreApplication::translate("", "Hardware not available").toStdWString(); + translatedstrings[IDS_2142] = QCoreApplication::translate("", "Monitor in sleep mode").toStdWString(); translatedstrings[IDS_2120] = QCoreApplication::translate("", "No ROMs found").toStdWString(); translatedstrings[IDS_2056] = QCoreApplication::translate("", "86Box could not find any usable ROM images.\n\nPlease download a ROM set and extract it into the \"roms\" directory.").replace("roms", ROMDIR).toStdWString(); diff --git a/src/qt/qt_rendererstack.cpp b/src/qt/qt_rendererstack.cpp index be783864d..c77e76474 100644 --- a/src/qt/qt_rendererstack.cpp +++ b/src/qt/qt_rendererstack.cpp @@ -49,7 +49,7 @@ RendererStack::RendererStack(QWidget *parent) { ui->setupUi(this); -#ifdef __unix__ +#if defined __unix__ && !defined __HAIKU__ # ifdef WAYLAND if (QApplication::platformName().contains("wayland")) { wl_init(); @@ -104,7 +104,7 @@ RendererStack::mousePoll() mousedata.deltax = mousedata.deltay = mousedata.deltaz = 0; mouse_buttons = mousedata.mousebuttons; -# ifdef __unix__ +# if defined __unix__ && !defined __HAIKU__ # ifdef WAYLAND if (QApplication::platformName().contains("wayland")) wl_mouse_poll(); @@ -206,6 +206,7 @@ RendererStack::leaveEvent(QEvent *event) } if (!mouse_capture) return; + QCursor::setPos(mapToGlobal(QPoint(width() / 2, height() / 2))); ignoreNextMouseEvent = 2; event->accept(); } @@ -237,7 +238,11 @@ RendererStack::createRenderer(Renderer renderer) auto sw = new SoftwareRenderer(this); rendererWindow = sw; connect(this, &RendererStack::blitToRenderer, sw, &SoftwareRenderer::onBlit, Qt::QueuedConnection); +#ifdef __HAIKU__ + current.reset(sw); +#else current.reset(this->createWindowContainer(sw, this)); +#endif } break; case Renderer::OpenGL: @@ -272,6 +277,7 @@ RendererStack::createRenderer(Renderer renderer) }); connect(hw, &OpenGLRenderer::errorInitializing, [=]() { /* Renderer could initialize, fallback to software. */ + imagebufs = {}; endblit(); QTimer::singleShot(0, this, [this]() { switchRenderer(Renderer::Software); }); }); @@ -299,7 +305,7 @@ RendererStack::createRenderer(Renderer renderer) void RendererStack::blit(int x, int y, int w, int h) { - if ((w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (buffer32 == NULL) || std::get(imagebufs[currentBuf])->test_and_set()) { + if ((w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (buffer32 == NULL) || imagebufs.empty() || std::get(imagebufs[currentBuf])->test_and_set()) { video_blit_complete(); return; } diff --git a/src/qt/qt_settings_bus_tracking.cpp b/src/qt/qt_settings_bus_tracking.cpp index 41c7990da..a1d8e3369 100644 --- a/src/qt/qt_settings_bus_tracking.cpp +++ b/src/qt/qt_settings_bus_tracking.cpp @@ -218,9 +218,8 @@ SettingsBusTracking::scsi_bus_full() void SettingsBusTracking::device_track(int set, uint8_t dev_type, int bus, int channel) { - int i, element; + int element; uint64_t mask; - uint8_t count = 0; switch (bus) { case HDD_BUS_MFM: diff --git a/src/qt/qt_settingsinput.cpp b/src/qt/qt_settingsinput.cpp index 7408db5d4..d5a62534f 100644 --- a/src/qt/qt_settingsinput.cpp +++ b/src/qt/qt_settingsinput.cpp @@ -54,7 +54,6 @@ void SettingsInput::onCurrentMachineChanged(int machineId) { // win_settings_video_proc, WM_INITDIALOG this->machineId = machineId; - const auto* machine = &machines[machineId]; auto* mouseModel = ui->comboBoxMouse->model(); auto removeRows = mouseModel->rowCount(); diff --git a/src/qt/qt_settingsnetwork.cpp b/src/qt/qt_settingsnetwork.cpp index 437ed3647..ec5ebbe53 100644 --- a/src/qt/qt_settingsnetwork.cpp +++ b/src/qt/qt_settingsnetwork.cpp @@ -80,7 +80,6 @@ void SettingsNetwork::save() { void SettingsNetwork::onCurrentMachineChanged(int machineId) { this->machineId = machineId; - auto* machine = &machines[machineId]; auto* model = ui->comboBoxAdapter->model(); auto removeRows = model->rowCount(); diff --git a/src/qt/qt_settingssound.cpp b/src/qt/qt_settingssound.cpp index 5cf1114b0..6b12023a6 100644 --- a/src/qt/qt_settingssound.cpp +++ b/src/qt/qt_settingssound.cpp @@ -45,7 +45,7 @@ SettingsSound::~SettingsSound() void SettingsSound::save() { sound_card_current = ui->comboBoxSoundCard->currentData().toInt(); - midi_device_current = ui->comboBoxMidiOut->currentData().toInt(); + midi_output_device_current = ui->comboBoxMidiOut->currentData().toInt(); midi_input_device_current = ui->comboBoxMidiIn->currentData().toInt(); mpu401_standalone_enable = ui->checkBoxMPU401->isChecked() ? 1 : 0; SSI2001 = ui->checkBoxSSI2001->isChecked() ? 1 : 0;; @@ -95,14 +95,14 @@ void SettingsSound::onCurrentMachineChanged(int machineId) { c = 0; selectedRow = 0; while (true) { - QString name = DeviceConfig::DeviceName(midi_device_getdevice(c), midi_device_get_internal_name(c), 0); + QString name = DeviceConfig::DeviceName(midi_out_device_getdevice(c), midi_out_device_get_internal_name(c), 0); if (name.isEmpty()) { break; } - if (midi_device_available(c)) { + if (midi_out_device_available(c)) { int row = Models::AddEntry(model, name, c); - if (c == midi_device_current) { + if (c == midi_output_device_current) { selectedRow = row - removeRows; } } @@ -118,7 +118,7 @@ void SettingsSound::onCurrentMachineChanged(int machineId) { c = 0; selectedRow = 0; while (true) { - QString name = DeviceConfig::DeviceName(midi_in_device_getdevice(c), midi_device_get_internal_name(c), 0); + QString name = DeviceConfig::DeviceName(midi_in_device_getdevice(c), midi_in_device_get_internal_name(c), 0); if (name.isEmpty()) { break; } @@ -154,7 +154,7 @@ void SettingsSound::onCurrentMachineChanged(int machineId) { } static bool allowMpu401(Ui::SettingsSound *ui) { - QString midiOut = midi_device_get_internal_name(ui->comboBoxMidiOut->currentData().toInt()); + QString midiOut = midi_out_device_get_internal_name(ui->comboBoxMidiOut->currentData().toInt()); QString midiIn = midi_in_device_get_internal_name(ui->comboBoxMidiIn->currentData().toInt()); if (midiOut.isEmpty()) { @@ -184,13 +184,13 @@ void SettingsSound::on_comboBoxMidiOut_currentIndexChanged(int index) { if (index < 0) { return; } - ui->pushButtonConfigureMidiOut->setEnabled(midi_device_has_config(ui->comboBoxMidiOut->currentData().toInt())); + ui->pushButtonConfigureMidiOut->setEnabled(midi_out_device_has_config(ui->comboBoxMidiOut->currentData().toInt())); ui->checkBoxMPU401->setEnabled(allowMpu401(ui) && (machine_has_bus(machineId, MACHINE_BUS_ISA) || machine_has_bus(machineId, MACHINE_BUS_MCA))); ui->pushButtonConfigureMPU401->setEnabled(allowMpu401(ui) && ui->checkBoxMPU401->isChecked()); } void SettingsSound::on_pushButtonConfigureMidiOut_clicked() { - DeviceConfig::ConfigureDevice(midi_device_getdevice(ui->comboBoxMidiOut->currentData().toInt()), 0, qobject_cast(Settings::settings)); + DeviceConfig::ConfigureDevice(midi_out_device_getdevice(ui->comboBoxMidiOut->currentData().toInt()), 0, qobject_cast(Settings::settings)); } void SettingsSound::on_comboBoxMidiIn_currentIndexChanged(int index) { diff --git a/src/qt/qt_settingsstoragecontrollers.cpp b/src/qt/qt_settingsstoragecontrollers.cpp index 2427b5774..114654340 100644 --- a/src/qt/qt_settingsstoragecontrollers.cpp +++ b/src/qt/qt_settingsstoragecontrollers.cpp @@ -64,7 +64,6 @@ void SettingsStorageControllers::save() { void SettingsStorageControllers::onCurrentMachineChanged(int machineId) { this->machineId = machineId; - auto* machine = &machines[machineId]; /*HD controller config*/ auto* model = ui->comboBoxHD->model(); diff --git a/src/qt/qt_softwarerenderer.cpp b/src/qt/qt_softwarerenderer.cpp index 82d33a7cb..a6cca1152 100644 --- a/src/qt/qt_softwarerenderer.cpp +++ b/src/qt/qt_softwarerenderer.cpp @@ -28,9 +28,13 @@ extern "C" { } SoftwareRenderer::SoftwareRenderer(QWidget *parent) +#ifdef __HAIKU__ + : QWidget(parent) +#else : QRasterWindow(parent->windowHandle()) +#endif { - parentWidget = parent; + RendererCommon::parentWidget = parent; images[0] = std::make_unique(QSize(2048, 2048), QImage::Format_RGB32); images[1] = std::make_unique(QSize(2048, 2048), QImage::Format_RGB32); @@ -38,6 +42,9 @@ SoftwareRenderer::SoftwareRenderer(QWidget *parent) buf_usage = std::vector(2); buf_usage[0].clear(); buf_usage[1].clear(); +#ifdef __HAIKU__ + this->setMouseTracking(true); +#endif } void SoftwareRenderer::paintEvent(QPaintEvent* event) { @@ -60,13 +67,22 @@ void SoftwareRenderer::onBlit(int buf_idx, int x, int y, int w, int h) { void SoftwareRenderer::resizeEvent(QResizeEvent *event) { onResize(width(), height()); +#ifdef __HAIKU__ + QWidget::resizeEvent(event); +#else QRasterWindow::resizeEvent(event); +#endif } bool SoftwareRenderer::event(QEvent *event) { bool res = false; - if (!eventDelegate(event, res)) return QRasterWindow::event(event); + if (!eventDelegate(event, res)) +#ifdef __HAIKU__ + return QWidget::event(event); +#else + return QRasterWindow::event(event); +#endif return res; } diff --git a/src/qt/qt_softwarerenderer.hpp b/src/qt/qt_softwarerenderer.hpp index 8e646c14d..5b0f7b0f5 100644 --- a/src/qt/qt_softwarerenderer.hpp +++ b/src/qt/qt_softwarerenderer.hpp @@ -8,7 +8,13 @@ #include #include "qt_renderercommon.hpp" -class SoftwareRenderer : public QRasterWindow, public RendererCommon +class SoftwareRenderer : + #ifdef __HAIKU__ + public QWidget, + #else + public QRasterWindow, + #endif + public RendererCommon { Q_OBJECT public: diff --git a/src/qt/qt_ui.cpp b/src/qt/qt_ui.cpp index c9f5c5451..413057334 100644 --- a/src/qt/qt_ui.cpp +++ b/src/qt/qt_ui.cpp @@ -34,6 +34,7 @@ extern "C" { #include <86box/plat.h> #include <86box/ui.h> +#include <86box/mouse.h> void plat_delay_ms(uint32_t count) @@ -72,6 +73,9 @@ void plat_setfullscreen(int on) { } void plat_mouse_capture(int on) { + if (!kbd_req_capture && (mouse_type == MOUSE_TYPE_NONE)) + return; + main_window->setMouseCapture(on > 0 ? true : false); } diff --git a/src/qt/qt_unixmanagerfilter.cpp b/src/qt/qt_unixmanagerfilter.cpp index d240e9d5f..9df6da5cb 100644 --- a/src/qt/qt_unixmanagerfilter.cpp +++ b/src/qt/qt_unixmanagerfilter.cpp @@ -31,8 +31,7 @@ void UnixManagerSocket::readyToRead() QByteArray line = readLine(); if (line.size()) { - line.resize(line.size() - 2); - line.push_back('\0'); + line.resize(line.size() - 1); if (line == "showsettings") { emit showsettings(); diff --git a/src/qt/qt_winmanagerfilter.cpp b/src/qt/qt_winmanagerfilter.cpp index dd69127d0..2c6053839 100644 --- a/src/qt/qt_winmanagerfilter.cpp +++ b/src/qt/qt_winmanagerfilter.cpp @@ -19,7 +19,7 @@ #include #include <86box/win.h> -bool WindowsManagerFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *result) +bool WindowsManagerFilter::nativeEventFilter(const QByteArray &eventType, void *message, result_t *result) { if (eventType == "windows_generic_MSG") { diff --git a/src/qt/qt_winrawinputfilter.cpp b/src/qt/qt_winrawinputfilter.cpp index 053dbbd6d..1e5ec5a71 100644 --- a/src/qt/qt_winrawinputfilter.cpp +++ b/src/qt/qt_winrawinputfilter.cpp @@ -110,19 +110,25 @@ WindowsRawInputFilter::~WindowsRawInputFilter() RegisterRawInputDevices(rid, 2, sizeof(rid[0])); } -bool WindowsRawInputFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *result) +bool WindowsRawInputFilter::nativeEventFilter(const QByteArray &eventType, void *message, result_t *result) { if (eventType == "windows_generic_MSG") { MSG *msg = static_cast(message); - if (msg->message == WM_INPUT) - { + if (msg->message == WM_INPUT) { if (window->isActiveWindow() && menus_open == 0) - handle_input((HRAWINPUT)msg->lParam); + handle_input((HRAWINPUT) msg->lParam); return true; } + + /* Stop processing of Alt-F4 */ + if (msg->message == WM_SYSKEYDOWN) { + if (msg->wParam == 0x73) { + return true; + } + } } return false; @@ -312,9 +318,9 @@ void WindowsRawInputFilter::keyboard_getkeymap() /* Get the scan code remappings from: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout */ bufSize = 32768; - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyName, 0, 1, &hKey) == ERROR_SUCCESS) + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, keyName, 0, 1, &hKey) == ERROR_SUCCESS) { - if (RegQueryValueEx(hKey, valueName, NULL, NULL, buf, &bufSize) == ERROR_SUCCESS) + if (RegQueryValueExA(hKey, valueName, NULL, NULL, buf, &bufSize) == ERROR_SUCCESS) { bufEx2 = (UINT32 *)buf; scMapCount = bufEx2[2]; diff --git a/src/qt/qt_winrawinputfilter.hpp b/src/qt/qt_winrawinputfilter.hpp index 4255440ff..dabd3f4dd 100644 --- a/src/qt/qt_winrawinputfilter.hpp +++ b/src/qt/qt_winrawinputfilter.hpp @@ -40,13 +40,12 @@ #include -#if QT_VERSION_MAJOR >= 6 +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #define result_t qintptr #else #define result_t long #endif - class WindowsRawInputFilter : public QObject, public QAbstractNativeEventFilter { Q_OBJECT diff --git a/src/scsi/scsi.c b/src/scsi/scsi.c index b898f9de8..7edfa1844 100644 --- a/src/scsi/scsi.c +++ b/src/scsi/scsi.c @@ -52,12 +52,17 @@ static uint8_t next_scsi_bus = 0; static const device_t scsi_none_device = { - "None", - "none", - 0, 0, - NULL, NULL, NULL, - { NULL }, NULL, NULL, - NULL + .name = "None", + .internal_name = "none", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; @@ -67,39 +72,41 @@ typedef const struct { static SCSI_CARD scsi_cards[] = { - { &scsi_none_device, }, - { &aha154xa_device, }, - { &aha154xb_device, }, - { &aha154xc_device, }, - { &aha154xcf_device, }, - { &aha154xcp_device, }, - { &buslogic_542b_device, }, - { &buslogic_542bh_device, }, - { &buslogic_545s_device, }, - { &buslogic_545c_device, }, - { &scsi_ls2000_device, }, - { &scsi_lcs6821n_device, }, - { &scsi_rt1000b_device, }, - { &scsi_t128_device, }, - { &scsi_t130b_device, }, +// clang-format off + { &scsi_none_device, }, + { &aha154xa_device, }, + { &aha154xb_device, }, + { &aha154xc_device, }, + { &aha154xcf_device, }, + { &aha154xcp_device, }, + { &buslogic_542b_device, }, + { &buslogic_542bh_device, }, + { &buslogic_545s_device, }, + { &buslogic_545c_device, }, + { &scsi_ls2000_device, }, + { &scsi_lcs6821n_device, }, + { &scsi_rt1000b_device, }, + { &scsi_t128_device, }, + { &scsi_t130b_device, }, #ifdef WALTJE - { &scsi_wd33c93_device, }, + { &scsi_wd33c93_device, }, #endif - { &aha1640_device, }, - { &buslogic_640a_device, }, - { &ncr53c90_mca_device, }, - { &spock_device, }, - { &buslogic_958d_pci_device, }, - { &ncr53c810_pci_device, }, - { &ncr53c815_pci_device, }, - { &ncr53c820_pci_device, }, - { &ncr53c825a_pci_device, }, - { &ncr53c860_pci_device, }, - { &ncr53c875_pci_device, }, - { &dc390_pci_device, }, - { &buslogic_445s_device, }, - { &buslogic_445c_device, }, - { NULL, }, + { &aha1640_device, }, + { &buslogic_640a_device, }, + { &ncr53c90_mca_device, }, + { &spock_device, }, + { &buslogic_958d_pci_device, }, + { &ncr53c810_pci_device, }, + { &ncr53c815_pci_device, }, + { &ncr53c820_pci_device, }, + { &ncr53c825a_pci_device, }, + { &ncr53c860_pci_device, }, + { &ncr53c875_pci_device, }, + { &dc390_pci_device, }, + { &buslogic_445s_device, }, + { &buslogic_445c_device, }, + { NULL, }, +// clang-format on }; diff --git a/src/scsi/scsi_aha154x.c b/src/scsi/scsi_aha154x.c index ab94a57be..9fac11764 100644 --- a/src/scsi/scsi_aha154x.c +++ b/src/scsi/scsi_aha154x.c @@ -197,7 +197,7 @@ aha154x_eeprom(x54x_t *dev, uint8_t cmd,uint8_t arg,uint8_t len,uint8_t off,uint if (dev->type == AHA_154xCF) { if (dev->fdc_address > 0) { fdc_remove(dev->fdc); - fdc_set_base(dev->fdc, (dev->nvr[0] & EE0_ALTFLOP) ? 0x370 : 0x3f0); + fdc_set_base(dev->fdc, (dev->nvr[0] & EE0_ALTFLOP) ? FDC_SECONDARY_ADDR : FDC_PRIMARY_ADDR); } } } @@ -901,7 +901,7 @@ aha_initnvr(x54x_t *dev) /* Initialize the on-board EEPROM. */ dev->nvr[0] = dev->HostID; /* SCSI ID 7 */ dev->nvr[0] |= (0x10 | 0x20 | 0x40); - if (dev->fdc_address == 0x370) + if (dev->fdc_address == FDC_SECONDARY_ADDR) dev->nvr[0] |= EE0_ALTFLOP; dev->nvr[1] = dev->Irq-9; /* IRQ15 */ dev->nvr[1] |= (dev->DmaChannel<<4); /* DMA6 */ @@ -939,7 +939,7 @@ aha_setnvr(x54x_t *dev) if (dev->type == AHA_154xCF) { if (dev->fdc_address > 0) { fdc_remove(dev->fdc); - fdc_set_base(dev->fdc, (dev->nvr[0] & EE0_ALTFLOP) ? 0x370 : 0x3f0); + fdc_set_base(dev->fdc, (dev->nvr[0] & EE0_ALTFLOP) ? FDC_SECONDARY_ADDR : FDC_PRIMARY_ADDR); } } } @@ -1305,12 +1305,12 @@ static const device_config_t aha_154xcf_config[] = { }, }, { - "fdc_addr", "FDC address", CONFIG_HEX16, "", 0, "", { 0 }, + "fdc_addr", "FDC address", CONFIG_HEX16, "", 0, "", { 0 }, { - { "None", 0 }, - { "0x3f0", 0x3f0 }, - { "0x370", 0x370 }, - { "" } + { "None", 0 }, + { "0x3f0", FDC_PRIMARY_ADDR }, + { "0x370", FDC_SECONDARY_ADDR }, + { "" } }, }, { @@ -1320,61 +1320,85 @@ static const device_config_t aha_154xcf_config[] = { // clang-format on const device_t aha154xa_device = { - "Adaptec AHA-154xA", - "aha154xa", - DEVICE_ISA | DEVICE_AT, - AHA_154xA, - aha_init, x54x_close, NULL, - { NULL }, NULL, NULL, - aha_154xb_config + .name = "Adaptec AHA-154xA", + .internal_name = "aha154xa", + .flags = DEVICE_ISA | DEVICE_AT, + .local = AHA_154xA, + .init = aha_init, + .close = x54x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = aha_154xb_config }; const device_t aha154xb_device = { - "Adaptec AHA-154xB", - "aha154xb", - DEVICE_ISA | DEVICE_AT, - AHA_154xB, - aha_init, x54x_close, NULL, - { NULL }, NULL, NULL, - aha_154xb_config + .name = "Adaptec AHA-154xB", + .internal_name = "aha154xb", + .flags = DEVICE_ISA | DEVICE_AT, + .local = AHA_154xB, + .init = aha_init, + .close = x54x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = aha_154xb_config }; const device_t aha154xc_device = { - "Adaptec AHA-154xC", - "aha154xc", - DEVICE_ISA | DEVICE_AT, - AHA_154xC, - aha_init, x54x_close, NULL, - { NULL }, NULL, NULL, - aha_154x_config + .name = "Adaptec AHA-154xC", + .internal_name = "aha154xc", + .flags = DEVICE_ISA | DEVICE_AT, + .local = AHA_154xC, + .init = aha_init, + .close = x54x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = aha_154x_config }; const device_t aha154xcf_device = { - "Adaptec AHA-154xCF", - "aha154xcf", - DEVICE_ISA | DEVICE_AT, - AHA_154xCF, - aha_init, x54x_close, NULL, - { NULL }, NULL, NULL, - aha_154xcf_config + .name = "Adaptec AHA-154xCF", + .internal_name = "aha154xcf", + .flags = DEVICE_ISA | DEVICE_AT, + .local = AHA_154xCF, + .init = aha_init, + .close = x54x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = aha_154xcf_config }; const device_t aha154xcp_device = { - "Adaptec AHA-154xCP", - "aha154xcp", - DEVICE_ISA | DEVICE_AT, - AHA_154xCP, - aha_init, aha1542cp_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Adaptec AHA-154xCP", + .internal_name = "aha154xcp", + .flags = DEVICE_ISA | DEVICE_AT, + .local = AHA_154xCP, + .init = aha_init, + .close = aha1542cp_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t aha1640_device = { - "Adaptec AHA-1640", - "aha1640", - DEVICE_MCA, - AHA_1640, - aha_init, x54x_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Adaptec AHA-1640", + .internal_name = "aha1640", + .flags = DEVICE_MCA, + .local = AHA_1640, + .init = aha_init, + .close = x54x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/scsi/scsi_buslogic.c b/src/scsi/scsi_buslogic.c index 84144383b..79a019821 100644 --- a/src/scsi/scsi_buslogic.c +++ b/src/scsi/scsi_buslogic.c @@ -1857,81 +1857,113 @@ static const device_config_t BT958D_Config[] = { // clang-format on const device_t buslogic_542b_device = { - "BusLogic BT-542B ISA", - "bt542b", - DEVICE_ISA | DEVICE_AT, - CHIP_BUSLOGIC_ISA_542B_1991_12_14, - buslogic_init, x54x_close, NULL, - { NULL }, NULL, NULL, - BT_ISA_Config + .name = "BusLogic BT-542B ISA", + .internal_name = "bt542b", + .flags = DEVICE_ISA | DEVICE_AT, + .local = CHIP_BUSLOGIC_ISA_542B_1991_12_14, + .init = buslogic_init, + .close = x54x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = BT_ISA_Config }; const device_t buslogic_545s_device = { - "BusLogic BT-545S ISA", - "bt545s", - DEVICE_ISA | DEVICE_AT, - CHIP_BUSLOGIC_ISA_545S_1992_10_05, - buslogic_init, x54x_close, NULL, - { NULL }, NULL, NULL, - BT_ISA_Config + .name = "BusLogic BT-545S ISA", + .internal_name = "bt545s", + .flags = DEVICE_ISA | DEVICE_AT, + .local = CHIP_BUSLOGIC_ISA_545S_1992_10_05, + .init = buslogic_init, + .close = x54x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = BT_ISA_Config }; const device_t buslogic_542bh_device = { - "BusLogic BT-542BH ISA", - "bt542bh", - DEVICE_ISA | DEVICE_AT, - CHIP_BUSLOGIC_ISA_542BH_1993_05_23, - buslogic_init, x54x_close, NULL, - { NULL }, NULL, NULL, - BT_ISA_Config + .name = "BusLogic BT-542BH ISA", + .internal_name = "bt542bh", + .flags = DEVICE_ISA | DEVICE_AT, + .local = CHIP_BUSLOGIC_ISA_542BH_1993_05_23, + .init = buslogic_init, + .close = x54x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = BT_ISA_Config }; const device_t buslogic_545c_device = { - "BusLogic BT-545C ISA", - "bt545c", - DEVICE_ISA | DEVICE_AT, - CHIP_BUSLOGIC_ISA_545C_1994_12_01, - buslogic_init, x54x_close, NULL, - { NULL }, NULL, NULL, - BT_ISA_Config + .name = "BusLogic BT-545C ISA", + .internal_name = "bt545c", + .flags = DEVICE_ISA | DEVICE_AT, + .local = CHIP_BUSLOGIC_ISA_545C_1994_12_01, + .init = buslogic_init, + .close = x54x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = BT_ISA_Config }; const device_t buslogic_640a_device = { - "BusLogic BT-640A MCA", - "bt640a", - DEVICE_MCA, - CHIP_BUSLOGIC_MCA_640A_1993_05_23, - buslogic_init, x54x_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "BusLogic BT-640A MCA", + .internal_name = "bt640a", + .flags = DEVICE_MCA, + .local = CHIP_BUSLOGIC_MCA_640A_1993_05_23, + .init = buslogic_init, + .close = x54x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t buslogic_445s_device = { - "BusLogic BT-445S VLB", - "bt445s", - DEVICE_VLB, - CHIP_BUSLOGIC_VLB_445S_1993_11_16, - buslogic_init, x54x_close, NULL, - { NULL }, NULL, NULL, - BT_ISA_Config + .name = "BusLogic BT-445S VLB", + .internal_name = "bt445s", + .flags = DEVICE_VLB, + .local = CHIP_BUSLOGIC_VLB_445S_1993_11_16, + .init = buslogic_init, + .close = x54x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = BT_ISA_Config }; const device_t buslogic_445c_device = { - "BusLogic BT-445C VLB", - "bt445c", - DEVICE_VLB, - CHIP_BUSLOGIC_VLB_445C_1994_12_01, - buslogic_init, x54x_close, NULL, - { NULL }, NULL, NULL, - BT_ISA_Config + .name = "BusLogic BT-445C VLB", + .internal_name = "bt445c", + .flags = DEVICE_VLB, + .local = CHIP_BUSLOGIC_VLB_445C_1994_12_01, + .init = buslogic_init, + .close = x54x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = BT_ISA_Config }; const device_t buslogic_958d_pci_device = { - "BusLogic BT-958D PCI", - "bt958d", - DEVICE_PCI, - CHIP_BUSLOGIC_PCI_958D_1995_12_30, - buslogic_init, x54x_close, NULL, - { NULL }, NULL, NULL, - BT958D_Config + .name = "BusLogic BT-958D PCI", + .internal_name = "bt958d", + .flags = DEVICE_PCI, + .local = CHIP_BUSLOGIC_PCI_958D_1995_12_30, + .init = buslogic_init, + .close = x54x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = BT958D_Config }; diff --git a/src/scsi/scsi_ncr5380.c b/src/scsi/scsi_ncr5380.c index 083efabe4..1fa91f8c7 100644 --- a/src/scsi/scsi_ncr5380.c +++ b/src/scsi/scsi_ncr5380.c @@ -1707,62 +1707,72 @@ static const device_config_t t128_config[] = { }; // clang-format on -const device_t scsi_lcs6821n_device = -{ - "Longshine LCS-6821N", - "lcs6821n", - DEVICE_ISA, - 0, - ncr_init, ncr_close, NULL, - { lcs6821n_available }, - NULL, NULL, - ncr5380_mmio_config +const device_t scsi_lcs6821n_device = { + .name = "Longshine LCS-6821N", + .internal_name = "lcs6821n", + .flags = DEVICE_ISA, + .local = 0, + .init = ncr_init, + .close = ncr_close, + .reset = NULL, + { .available = lcs6821n_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ncr5380_mmio_config }; -const device_t scsi_rt1000b_device = -{ - "Rancho RT1000B", - "rt1000b", - DEVICE_ISA, - 1, - ncr_init, ncr_close, NULL, - { rt1000b_available }, - NULL, NULL, - rancho_config +const device_t scsi_rt1000b_device = { + .name = "Rancho RT1000B", + .internal_name = "rt1000b", + .flags = DEVICE_ISA, + .local = 1, + .init = ncr_init, + .close = ncr_close, + .reset = NULL, + { .available = rt1000b_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = rancho_config }; -const device_t scsi_t130b_device = -{ - "Trantor T130B", - "t130b", - DEVICE_ISA, - 2, - ncr_init, ncr_close, NULL, - { t130b_available }, - NULL, NULL, - t130b_config +const device_t scsi_t130b_device = { + .name = "Trantor T130B", + .internal_name = "t130b", + .flags = DEVICE_ISA, + .local = 2, + .init = ncr_init, + .close = ncr_close, + .reset = NULL, + { .available = t130b_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = t130b_config }; -const device_t scsi_t128_device = -{ - "Trantor T128", - "t128", - DEVICE_ISA, - 3, - ncr_init, ncr_close, NULL, - { t128_available }, - NULL, NULL, - t128_config +const device_t scsi_t128_device = { + .name = "Trantor T128", + .internal_name = "t128", + .flags = DEVICE_ISA, + .local = 3, + .init = ncr_init, + .close = ncr_close, + .reset = NULL, + { .available = t128_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = t128_config }; -const device_t scsi_ls2000_device = -{ - "Corel LS2000", - "ls2000", - DEVICE_ISA, - 4, - ncr_init, ncr_close, NULL, - { corel_ls2000_available }, - NULL, NULL, - ncr5380_mmio_config +const device_t scsi_ls2000_device = { + .name = "Corel LS2000", + .internal_name = "ls2000", + .flags = DEVICE_ISA, + .local = 4, + .init = ncr_init, + .close = ncr_close, + .reset = NULL, + { .available = corel_ls2000_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ncr5380_mmio_config }; diff --git a/src/scsi/scsi_ncr53c8xx.c b/src/scsi/scsi_ncr53c8xx.c index 12439e4ee..f438a342c 100644 --- a/src/scsi/scsi_ncr53c8xx.c +++ b/src/scsi/scsi_ncr53c8xx.c @@ -2648,80 +2648,100 @@ static const device_config_t ncr53c8xx_pci_config[] = { // clang-format on }; - -const device_t ncr53c810_pci_device = -{ - "NCR 53c810", - "ncr53c810", - DEVICE_PCI, - CHIP_810, - ncr53c8xx_init, ncr53c8xx_close, NULL, - { NULL }, NULL, NULL, - NULL +const device_t ncr53c810_pci_device = { + .name = "NCR 53c810", + .internal_name = "ncr53c810", + .flags = DEVICE_PCI, + .local = CHIP_810, + .init = ncr53c8xx_init, + .close = ncr53c8xx_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t ncr53c810_onboard_pci_device = -{ - "NCR 53c810 On-Board", - "ncr53c810_onboard", - DEVICE_PCI, - 0x8001, - ncr53c8xx_init, ncr53c8xx_close, NULL, - { NULL }, NULL, NULL, - NULL +const device_t ncr53c810_onboard_pci_device = { + .name = "NCR 53c810 On-Board", + .internal_name = "ncr53c810_onboard", + .flags = DEVICE_PCI, + .local = 0x8001, + .init = ncr53c8xx_init, + .close = ncr53c8xx_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t ncr53c815_pci_device = -{ - "NCR 53c815", - "ncr53c815", - DEVICE_PCI, - CHIP_815, - ncr53c8xx_init, ncr53c8xx_close, NULL, - { NULL }, NULL, NULL, +const device_t ncr53c815_pci_device = { + .name = "NCR 53c815", + .internal_name = "ncr53c815", + .flags = DEVICE_PCI, + .local = CHIP_815, + .init = ncr53c8xx_init, + .close = ncr53c8xx_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, ncr53c8xx_pci_config }; -const device_t ncr53c820_pci_device = -{ - "NCR 53c820", - "ncr53c820", - DEVICE_PCI, - CHIP_820, - ncr53c8xx_init, ncr53c8xx_close, NULL, - { NULL }, NULL, NULL, - NULL +const device_t ncr53c820_pci_device = { + .name = "NCR 53c820", + .internal_name = "ncr53c820", + .flags = DEVICE_PCI, + .local = CHIP_820, + .init = ncr53c8xx_init, + .close = ncr53c8xx_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -const device_t ncr53c825a_pci_device = -{ - "NCR 53c825A", - "ncr53c825a", - DEVICE_PCI, - CHIP_825, - ncr53c8xx_init, ncr53c8xx_close, NULL, - { NULL }, NULL, NULL, - ncr53c8xx_pci_config +const device_t ncr53c825a_pci_device = { + .name = "NCR 53c825A", + .internal_name = "ncr53c825a", + .flags = DEVICE_PCI, + .local = CHIP_825, + .init = ncr53c8xx_init, + .close = ncr53c8xx_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ncr53c8xx_pci_config }; -const device_t ncr53c860_pci_device = -{ - "NCR 53c860", - "ncr53c860", - DEVICE_PCI, - CHIP_860, - ncr53c8xx_init, ncr53c8xx_close, NULL, - { NULL }, NULL, NULL, - ncr53c8xx_pci_config +const device_t ncr53c860_pci_device = { + .name = "NCR 53c860", + .internal_name = "ncr53c860", + .flags = DEVICE_PCI, + .local = CHIP_860, + .init = ncr53c8xx_init, + .close = ncr53c8xx_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ncr53c8xx_pci_config }; -const device_t ncr53c875_pci_device = -{ - "NCR 53c875", - "ncr53c875", - DEVICE_PCI, - CHIP_875, - ncr53c8xx_init, ncr53c8xx_close, NULL, - { NULL }, NULL, NULL, - ncr53c8xx_pci_config +const device_t ncr53c875_pci_device = { + .name = "NCR 53c875", + .internal_name = "ncr53c875", + .flags = DEVICE_PCI, + .local = CHIP_875, + .init = ncr53c8xx_init, + .close = ncr53c8xx_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ncr53c8xx_pci_config }; diff --git a/src/scsi/scsi_pcscsi.c b/src/scsi/scsi_pcscsi.c index aff95074e..74011b21b 100644 --- a/src/scsi/scsi_pcscsi.c +++ b/src/scsi/scsi_pcscsi.c @@ -2010,24 +2010,30 @@ static const device_config_t bios_enable_config[] = { // clang-format on }; -const device_t dc390_pci_device = -{ - "Tekram DC-390 PCI", - "dc390", - DEVICE_PCI, - 0, - dc390_init, esp_close, NULL, - { NULL }, NULL, NULL, - bios_enable_config +const device_t dc390_pci_device = { + .name = "Tekram DC-390 PCI", + .internal_name = "dc390", + .flags = DEVICE_PCI, + .local = 0, + .init = dc390_init, + .close = esp_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = bios_enable_config }; -const device_t ncr53c90_mca_device = -{ - "NCR 53c90 MCA", - "ncr53c90", - DEVICE_MCA, - 0, - ncr53c90_mca_init, esp_close, NULL, - { NULL }, NULL, NULL, - NULL +const device_t ncr53c90_mca_device = { + .name = "NCR 53c90 MCA", + .internal_name = "ncr53c90", + .flags = DEVICE_MCA, + .local = 0, + .init = ncr53c90_mca_init, + .close = esp_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/scsi/scsi_spock.c b/src/scsi/scsi_spock.c index 32ce2a812..f00782983 100644 --- a/src/scsi/scsi_spock.c +++ b/src/scsi/scsi_spock.c @@ -1170,14 +1170,16 @@ static const device_config_t spock_rom_config[] = { // clang-format on }; -const device_t spock_device = -{ - "IBM PS/2 SCSI Adapter (Spock)", - "spock", - DEVICE_MCA, - 0, - spock_init, spock_close, NULL, - { spock_available }, - NULL, NULL, - spock_rom_config +const device_t spock_device = { + .name = "IBM PS/2 SCSI Adapter (Spock)", + .internal_name = "spock", + .flags = DEVICE_MCA, + .local = 0, + .init = spock_init, + .close = spock_close, + .reset = NULL, + { .available = spock_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = spock_rom_config }; diff --git a/src/sio/sio_82091aa.c b/src/sio/sio_82091aa.c index f266f0a40..e385bcd2d 100644 --- a/src/sio/sio_82091aa.c +++ b/src/sio/sio_82091aa.c @@ -6,7 +6,7 @@ * * This file is part of the 86Box distribution. * - * Emulation of the Intel 82019AA Super I/O chip. + * Emulation of the Intel 82091AA Super I/O chip. * * * @@ -49,26 +49,26 @@ fdc_handler(i82091aa_t *dev) { fdc_remove(dev->fdc); if (dev->regs[0x10] & 0x01) - fdc_set_base(dev->fdc, (dev->regs[0x10] & 0x02) ? 0x0370 : 0x03f0); + fdc_set_base(dev->fdc, (dev->regs[0x10] & 0x02) ? FDC_SECONDARY_ADDR : FDC_PRIMARY_ADDR); } static void lpt1_handler(i82091aa_t *dev) { - uint16_t lpt_port = 0x378; + uint16_t lpt_port = LPT1_ADDR; lpt1_remove(); switch ((dev->regs[0x20] >> 1) & 0x03) { case 0x00: - lpt_port = 0x378; + lpt_port = LPT1_ADDR; break; case 1: - lpt_port = 0x278; + lpt_port = LPT2_ADDR; break; case 2: - lpt_port = 0x3bc; + lpt_port = LPT_MDA_ADDR; break; case 3: lpt_port = 0x000; @@ -78,7 +78,7 @@ lpt1_handler(i82091aa_t *dev) if ((dev->regs[0x20] & 0x01) && lpt_port) lpt1_init(lpt_port); - lpt1_irq((dev->regs[0x20] & 0x08) ? 7 : 5); + lpt1_irq((dev->regs[0x20] & 0x08) ? LPT1_IRQ : LPT2_IRQ); } @@ -86,16 +86,16 @@ static void serial_handler(i82091aa_t *dev, int uart) { int reg = (0x30 + (uart << 4)); - uint16_t uart_port = 0x3f8; + uint16_t uart_port = COM1_ADDR; serial_remove(dev->uart[uart]); switch ((dev->regs[reg] >> 1) & 0x07) { case 0x00: - uart_port = 0x3f8; + uart_port = COM1_ADDR; break; case 0x01: - uart_port = 0x2f8; + uart_port = COM2_ADDR; break; case 0x02: uart_port = 0x220; @@ -107,18 +107,18 @@ serial_handler(i82091aa_t *dev, int uart) uart_port = 0x238; break; case 0x05: - uart_port = 0x2e8; + uart_port = COM4_ADDR; break; case 0x06: uart_port = 0x338; break; case 0x07: - uart_port = 0x3e8; + uart_port = COM3_ADDR; break; } if (dev->regs[reg] & 0x01) - serial_setup(dev->uart[uart], uart_port, (dev->regs[reg] & 0x10) ? 4 : 3); + serial_setup(dev->uart[uart], uart_port, (dev->regs[reg] & 0x10) ? COM1_IRQ : COM2_IRQ); } @@ -275,35 +275,44 @@ i82091aa_init(const device_t *info) return dev; } - const device_t i82091aa_device = { - "Intel 82091AA Super I/O", - "i82091aa", - 0, - 0x40, - i82091aa_init, i82091aa_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Intel 82091AA Super I/O", + .internal_name = "i82091aa", + .flags = 0, + .local = 0x40, + .init = i82091aa_init, + .close = i82091aa_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t i82091aa_398_device = { - "Intel 82091AA Super I/O (Port 398h)", - "i82091aa_398", - 0, - 0x148, - i82091aa_init, i82091aa_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Intel 82091AA Super I/O (Port 398h)", + .internal_name = "i82091aa_398", + .flags = 0, + .local = 0x148, + .init = i82091aa_init, + .close = i82091aa_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t i82091aa_ide_device = { - "Intel 82091AA Super I/O (With IDE)", - "i82091aa_ide", - 0, - 0x240, - i82091aa_init, i82091aa_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Intel 82091AA Super I/O (With IDE)", + .internal_name = "i82091aa_ide", + .flags = 0, + .local = 0x240, + .init = i82091aa_init, + .close = i82091aa_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_acc3221.c b/src/sio/sio_acc3221.c index 77928a313..313bbbd1a 100644 --- a/src/sio/sio_acc3221.c +++ b/src/sio/sio_acc3221.c @@ -400,7 +400,7 @@ acc3221_write(uint16_t addr, uint8_t val, void *p) if ((old ^ val) & REG_FB_FDC_DISABLE) { fdc_remove(dev->fdc); if (!(dev->regs[0xfb] & REG_FB_FDC_DISABLE)) - fdc_set_base(dev->fdc, 0x03f0); + fdc_set_base(dev->fdc, FDC_PRIMARY_ADDR); } break; @@ -435,14 +435,14 @@ static void acc3221_reset(acc3221_t *dev) { serial_remove(dev->uart[0]); - serial_setup(dev->uart[0], SERIAL1_ADDR, SERIAL1_IRQ); + serial_setup(dev->uart[0], COM1_ADDR, COM1_IRQ); serial_remove(dev->uart[1]); - serial_setup(dev->uart[1], SERIAL2_ADDR, SERIAL2_IRQ); + serial_setup(dev->uart[1], COM2_ADDR, COM2_IRQ); lpt1_remove(); - lpt1_init(0x378); - lpt1_irq(7); + lpt1_init(LPT1_ADDR); + lpt1_irq(LPT1_IRQ); fdc_reset(dev->fdc); } @@ -476,11 +476,15 @@ acc3221_init(const device_t *info) const device_t acc3221_device = { - "ACC 3221-SP Super I/O", - "acc3221", - 0, - 0, - acc3221_init, acc3221_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "ACC 3221-SP Super I/O", + .internal_name = "acc3221", + .flags = 0, + .local = 0, + .init = acc3221_init, + .close = acc3221_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_detect.c b/src/sio/sio_detect.c index 5daa13fcd..2e3302179 100644 --- a/src/sio/sio_detect.c +++ b/src/sio/sio_detect.c @@ -92,13 +92,13 @@ sio_detect_init(const device_t *info) sio_detect_read, NULL, NULL, sio_detect_write, NULL, NULL, dev); io_sethandler(0x0279, 0x0001, sio_detect_read, NULL, NULL, sio_detect_write, NULL, NULL, dev); - io_sethandler(0x0370, 0x0002, + io_sethandler(FDC_SECONDARY_ADDR, 0x0002, sio_detect_read, NULL, NULL, sio_detect_write, NULL, NULL, dev); io_sethandler(0x0398, 0x0002, sio_detect_read, NULL, NULL, sio_detect_write, NULL, NULL, dev); io_sethandler(0x03e3, 0x0001, sio_detect_read, NULL, NULL, sio_detect_write, NULL, NULL, dev); - io_sethandler(0x03f0, 0x0002, + io_sethandler(FDC_PRIMARY_ADDR, 0x0002, sio_detect_read, NULL, NULL, sio_detect_write, NULL, NULL, dev); io_sethandler(0x0a79, 0x0001, sio_detect_read, NULL, NULL, sio_detect_write, NULL, NULL, dev); @@ -108,11 +108,15 @@ sio_detect_init(const device_t *info) const device_t sio_detect_device = { - "Super I/O Detection Helper", - "sio_detect", - 0, - 0, - sio_detect_init, sio_detect_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Super I/O Detection Helper", + .internal_name = "sio_detect", + .flags = 0, + .local = 0, + .init = sio_detect_init, + .close = sio_detect_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_f82c710.c b/src/sio/sio_f82c710.c index 06d0bf800..fadbc76e2 100644 --- a/src/sio/sio_f82c710.c +++ b/src/sio/sio_f82c710.c @@ -81,26 +81,26 @@ f82c710_update_ports(upc_t *dev, int set) if (dev->regs[0] & 4) { com_addr = dev->regs[4] * 4; - if (com_addr == SERIAL1_ADDR) - serial_setup(dev->uart[0], com_addr, 4); - else if (com_addr == SERIAL2_ADDR) - serial_setup(dev->uart[1], com_addr, 3); + if (com_addr == COM1_ADDR) + serial_setup(dev->uart[0], com_addr, COM1_IRQ); + else if (com_addr == COM2_ADDR) + serial_setup(dev->uart[1], com_addr, COM2_IRQ); } if (dev->regs[0] & 8) { lpt_addr = dev->regs[6] * 4; lpt1_init(lpt_addr); - if ((lpt_addr == 0x378) || (lpt_addr == 0x3bc)) - lpt1_irq(7); - else if (lpt_addr == 0x278) - lpt1_irq(5); + if ((lpt_addr == LPT1_ADDR) || (lpt_addr == LPT_MDA_ADDR)) + lpt1_irq(LPT1_IRQ); + else if (lpt_addr == LPT2_ADDR) + lpt1_irq(LPT2_IRQ); } if (dev->regs[12] & 0x80) ide_pri_enable(); if (dev->regs[12] & 0x20) - fdc_set_base(dev->fdc, 0x03f0); + fdc_set_base(dev->fdc, FDC_PRIMARY_ADDR); } @@ -127,26 +127,26 @@ f82c606_update_ports(upc_t *dev, int set) switch (dev->regs[8] & 0xc0) { case 0x40: nvr_int = 3; break; - case 0x80: uart1_int = 3; break; - case 0xc0: uart2_int = 3; break; + case 0x80: uart1_int = COM2_IRQ; break; + case 0xc0: uart2_int = COM2_IRQ; break; } switch (dev->regs[8] & 0x30) { case 0x10: nvr_int = 4; break; - case 0x20: uart1_int = 4; break; - case 0x30: uart2_int = 4; break; + case 0x20: uart1_int = COM1_IRQ; break; + case 0x30: uart2_int = COM1_IRQ; break; } switch (dev->regs[8] & 0x0c) { case 0x04: nvr_int = 5; break; case 0x08: uart1_int = 5; break; - case 0x0c: lpt1_int = 5; break; + case 0x0c: lpt1_int = LPT2_IRQ; break; } switch (dev->regs[8] & 0x03) { case 0x01: nvr_int = 7; break; case 0x02: uart2_int = 7; break; - case 0x03: lpt1_int = 7; break; + case 0x03: lpt1_int = LPT1_IRQ; break; } if (dev->regs[0] & 1) { @@ -340,23 +340,30 @@ f82c710_init(const device_t *info) return dev; } - const device_t f82c606_device = { - "82C606 CHIPSpak Multifunction Controller", - "f82c606", - 0, - 606, - f82c710_init, f82c710_close, f82c710_reset, - { NULL }, NULL, NULL, - NULL + .name = "82C606 CHIPSpak Multifunction Controller", + .internal_name = "f82c606", + .flags = 0, + .local = 606, + .init = f82c710_init, + .close = f82c710_close, + .reset = f82c710_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t f82c710_device = { - "F82C710 UPC Super I/O", - "f82c710", - 0, - 710, - f82c710_init, f82c710_close, f82c710_reset, - { NULL }, NULL, NULL, - NULL + .name = "F82C710 UPC Super I/O", + .internal_name = "f82c710", + .flags = 0, + .local = 710, + .init = f82c710_init, + .close = f82c710_close, + .reset = f82c710_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_fdc37c669.c b/src/sio/sio_fdc37c669.c index 689de9236..caa92fad5 100644 --- a/src/sio/sio_fdc37c669.c +++ b/src/sio/sio_fdc37c669.c @@ -246,10 +246,10 @@ static void fdc37c669_reset(fdc37c669_t *dev) { serial_remove(dev->uart[0]); - serial_setup(dev->uart[0], SERIAL1_ADDR, SERIAL1_IRQ); + serial_setup(dev->uart[0], COM1_ADDR, COM1_IRQ); serial_remove(dev->uart[1]); - serial_setup(dev->uart[1], SERIAL2_ADDR, SERIAL2_IRQ); + serial_setup(dev->uart[1], COM2_ADDR, COM2_IRQ); memset(dev->regs, 0, 42); dev->regs[0x00] = 0x28; @@ -260,27 +260,27 @@ fdc37c669_reset(fdc37c669_t *dev) dev->regs[0x0d] = 0x03; dev->regs[0x0e] = 0x02; dev->regs[0x1e] = 0x80; /* Gameport controller. */ - dev->regs[0x20] = (0x3f0 >> 2) & 0xfc; + dev->regs[0x20] = (FDC_PRIMARY_ADDR >> 2) & 0xfc; dev->regs[0x21] = (0x1f0 >> 2) & 0xfc; dev->regs[0x22] = ((0x3f6 >> 2) & 0xfc) | 1; if (dev->id == 1) { - dev->regs[0x23] = (0x278 >> 2); + dev->regs[0x23] = (LPT2_ADDR >> 2); lpt2_remove(); - lpt2_init(0x278); + lpt2_init(LPT2_ADDR); - dev->regs[0x24] = (SERIAL3_ADDR >> 2) & 0xfe; - dev->regs[0x25] = (SERIAL4_ADDR >> 2) & 0xfe; + dev->regs[0x24] = (COM3_ADDR >> 2) & 0xfe; + dev->regs[0x25] = (COM4_ADDR >> 2) & 0xfe; } else { fdc_reset(dev->fdc); lpt1_remove(); - lpt1_init(0x378); + lpt1_init(LPT1_ADDR); - dev->regs[0x23] = (0x378 >> 2); + dev->regs[0x23] = (LPT1_ADDR >> 2); - dev->regs[0x24] = (SERIAL1_ADDR >> 2) & 0xfe; - dev->regs[0x25] = (SERIAL2_ADDR >> 2) & 0xfe; + dev->regs[0x24] = (COM1_ADDR >> 2) & 0xfe; + dev->regs[0x25] = (COM2_ADDR >> 2) & 0xfe; } dev->regs[0x26] = (2 << 4) | 3; dev->regs[0x27] = (6 << 4) | (dev->id ? 5 : 7); @@ -316,7 +316,7 @@ fdc37c669_init(const device_t *info) dev->uart[0] = device_add_inst(&ns16550_device, (next_id << 1) + 1); dev->uart[1] = device_add_inst(&ns16550_device, (next_id << 1) + 2); - io_sethandler(info->local ? 0x370 : (next_id ? 0x370 : 0x3f0), 0x0002, + io_sethandler(info->local ? FDC_SECONDARY_ADDR : (next_id ? FDC_SECONDARY_ADDR : FDC_PRIMARY_ADDR), 0x0002, fdc37c669_read, NULL, NULL, fdc37c669_write, NULL, NULL, dev); fdc37c669_reset(dev); @@ -326,24 +326,31 @@ fdc37c669_init(const device_t *info) return dev; } - const device_t fdc37c669_device = { - "SMC FDC37C669 Super I/O", - "fdc37c669", - 0, - 0, - fdc37c669_init, fdc37c669_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C669 Super I/O", + .internal_name = "fdc37c669", + .flags = 0, + .local = 0, + .init = fdc37c669_init, + .close = fdc37c669_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc37c669_370_device = { - "SMC FDC37C669 Super I/O (Port 370h)", - "fdc37c669_370", - 0, - 1, - fdc37c669_init, fdc37c669_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C669 Super I/O (Port 370h)", + .internal_name = "fdc37c669_370", + .flags = 0, + .local = 1, + fdc37c669_init, + fdc37c669_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_fdc37c67x.c b/src/sio/sio_fdc37c67x.c index 727390535..098ffbb44 100644 --- a/src/sio/sio_fdc37c67x.c +++ b/src/sio/sio_fdc37c67x.c @@ -530,7 +530,7 @@ fdc37c67x_reset(fdc37c67x_t *dev) dev->ld_regs[4][0x61] = 0xf8; dev->ld_regs[4][0x70] = 4; dev->ld_regs[4][0xf0] = 3; - serial_setup(dev->uart[0], 0x3f8, dev->ld_regs[4][0x70]); + serial_setup(dev->uart[0], COM1_ADDR, dev->ld_regs[4][0x70]); /* Logical device 5: Serial Port 2 */ dev->ld_regs[5][0x30] = 1; @@ -540,7 +540,7 @@ fdc37c67x_reset(fdc37c67x_t *dev) dev->ld_regs[5][0x74] = 4; dev->ld_regs[5][0xf1] = 2; dev->ld_regs[5][0xf2] = 3; - serial_setup(dev->uart[1], 0x2f8, dev->ld_regs[5][0x70]); + serial_setup(dev->uart[1], COM2_ADDR, dev->ld_regs[5][0x70]); /* Logical device 7: Keyboard */ dev->ld_regs[7][0x30] = 1; @@ -594,9 +594,9 @@ fdc37c67x_init(const device_t *info) fdc37c67x_reset(dev); - io_sethandler(0x370, 0x0002, + io_sethandler(FDC_SECONDARY_ADDR, 0x0002, fdc37c67x_read, NULL, NULL, fdc37c67x_write, NULL, NULL, dev); - io_sethandler(0x3f0, 0x0002, + io_sethandler(FDC_PRIMARY_ADDR, 0x0002, fdc37c67x_read, NULL, NULL, fdc37c67x_write, NULL, NULL, dev); return dev; @@ -604,11 +604,15 @@ fdc37c67x_init(const device_t *info) const device_t fdc37c67x_device = { - "SMC FDC37C67X Super I/O", - "fdc37c67x", - 0, - 0x40, - fdc37c67x_init, fdc37c67x_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C67X Super I/O", + .internal_name = "fdc37c67x", + .flags = 0, + .local = 0x40, + .init = fdc37c67x_init, + .close = fdc37c67x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_fdc37c6xx.c b/src/sio/sio_fdc37c6xx.c index 89b90d332..15949c81c 100644 --- a/src/sio/sio_fdc37c6xx.c +++ b/src/sio/sio_fdc37c6xx.c @@ -56,11 +56,11 @@ set_com34_addr(fdc37c6xx_t *dev) dev->com4_addr = 0x238; break; case 0x20: - dev->com3_addr = 0x3e8; - dev->com4_addr = 0x2e8; + dev->com3_addr = COM3_ADDR; + dev->com4_addr = COM4_ADDR; break; case 0x40: - dev->com3_addr = 0x3e8; + dev->com3_addr = COM3_ADDR; dev->com4_addr = 0x2e0; break; case 0x60: @@ -84,16 +84,16 @@ set_serial_addr(fdc37c6xx_t *dev, int port) if (dev->regs[2] & (4 << shift)) { switch ((dev->regs[2] >> shift) & 3) { case 0: - serial_setup(dev->uart[port], SERIAL1_ADDR, SERIAL1_IRQ); + serial_setup(dev->uart[port], COM1_ADDR, COM1_IRQ); break; case 1: - serial_setup(dev->uart[port], SERIAL2_ADDR, SERIAL2_IRQ); + serial_setup(dev->uart[port], COM2_ADDR, COM2_IRQ); break; case 2: - serial_setup(dev->uart[port], dev->com3_addr, 4); + serial_setup(dev->uart[port], dev->com3_addr, COM3_IRQ); break; case 3: - serial_setup(dev->uart[port], dev->com4_addr, 3); + serial_setup(dev->uart[port], dev->com4_addr, COM4_IRQ); break; } } @@ -108,15 +108,15 @@ lpt1_handler(fdc37c6xx_t *dev) lpt1_remove(); switch (dev->regs[1] & 3) { case 1: - lpt1_init(0x3bc); + lpt1_init(LPT_MDA_ADDR); lpt1_irq(7); break; case 2: - lpt1_init(0x378); + lpt1_init(LPT1_ADDR); lpt1_irq(7 /*5*/); break; case 3: - lpt1_init(0x278); + lpt1_init(LPT2_ADDR); lpt1_irq(7 /*5*/); break; } @@ -128,7 +128,7 @@ fdc_handler(fdc37c6xx_t *dev) { fdc_remove(dev->fdc); if (dev->regs[0] & 0x10) - fdc_set_base(dev->fdc, (dev->regs[5] & 0x01) ? 0x0370 : 0x03f0); + fdc_set_base(dev->fdc, (dev->regs[5] & 0x01) ? FDC_SECONDARY_ADDR : FDC_PRIMARY_ADDR); } @@ -160,7 +160,7 @@ fdc37c6xx_write(uint16_t port, uint8_t val, void *priv) uint8_t valxor = 0; if (dev->tries == 2) { - if (port == 0x3f0) { + if (port == FDC_PRIMARY_ADDR) { if (val == 0xaa) dev->tries = 0; else @@ -216,7 +216,7 @@ fdc37c6xx_write(uint16_t port, uint8_t val, void *priv) break; } } - } else if ((port == 0x3f0) && (val == 0x55)) + } else if ((port == FDC_PRIMARY_ADDR) && (val == 0x55)) dev->tries++; } @@ -243,13 +243,13 @@ fdc37c6xx_reset(fdc37c6xx_t *dev) dev->com4_addr = 0x238; serial_remove(dev->uart[0]); - serial_setup(dev->uart[0], SERIAL1_ADDR, SERIAL1_IRQ); + serial_setup(dev->uart[0], COM1_ADDR, COM1_IRQ); serial_remove(dev->uart[1]); - serial_setup(dev->uart[1], SERIAL2_ADDR, SERIAL2_IRQ); + serial_setup(dev->uart[1], COM2_ADDR, COM2_IRQ); lpt1_remove(); - lpt1_init(0x378); + lpt1_init(LPT1_ADDR); fdc_reset(dev->fdc); fdc_remove(dev->fdc); @@ -325,7 +325,7 @@ fdc37c6xx_init(const device_t *info) dev->uart[1] = device_add_inst(&ns16450_device, 2); } - io_sethandler(0x03f0, 0x0002, + io_sethandler(FDC_PRIMARY_ADDR, 0x0002, fdc37c6xx_read, NULL, NULL, fdc37c6xx_write, NULL, NULL, dev); fdc37c6xx_reset(dev); @@ -333,95 +333,130 @@ fdc37c6xx_init(const device_t *info) return dev; } - /* The three appear to differ only in the chip ID, if I understood their datasheets correctly. */ const device_t fdc37c651_device = { - "SMC FDC37C651 Super I/O", - "fdc37c651", - 0, - 0x51, - fdc37c6xx_init, fdc37c6xx_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C651 Super I/O", + .internal_name = "fdc37c651", + .flags = 0, + .local = 0x51, + .init = fdc37c6xx_init, + .close = fdc37c6xx_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc37c651_ide_device = { - "SMC FDC37C651 Super I/O (With IDE)", - "fdc37c651_ide", - 0, - 0x151, - fdc37c6xx_init, fdc37c6xx_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C651 Super I/O (With IDE)", + .internal_name = "fdc37c651_ide", + .flags = 0, + .local = 0x151, + .init = fdc37c6xx_init, + .close = fdc37c6xx_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc37c661_device = { - "SMC FDC37C661 Super I/O", - "fdc37c661", - 0, - 0x61, - fdc37c6xx_init, fdc37c6xx_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C661 Super I/O", + .internal_name = "fdc37c661", + .flags = 0, + .local = 0x61, + .init = fdc37c6xx_init, + .close = fdc37c6xx_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc37c661_ide_device = { - "SMC FDC37C661 Super I/O (With IDE)", - "fdc37c661_ide", - 0, - 0x161, - fdc37c6xx_init, fdc37c6xx_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C661 Super I/O (With IDE)", + .internal_name = "fdc37c661_ide", + .flags = 0, + .local = 0x161, + .init = fdc37c6xx_init, + .close = fdc37c6xx_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc37c663_device = { - "SMC FDC37C663 Super I/O", - "fdc37c663", - 0, - 0x63, - fdc37c6xx_init, fdc37c6xx_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C663 Super I/O", + .internal_name = "fdc37c663", + .flags = 0, + .local = 0x63, + .init = fdc37c6xx_init, + .close = fdc37c6xx_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc37c663_ide_device = { - "SMC FDC37C663 Super I/O (With IDE)", - "fdc37c663_ide", - 0, - 0x163, - fdc37c6xx_init, fdc37c6xx_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C663 Super I/O (With IDE)", + .internal_name = "fdc37c663_ide", + .flags = 0, + .local = 0x163, + .init = fdc37c6xx_init, + .close = fdc37c6xx_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc37c665_device = { - "SMC FDC37C665 Super I/O", - "fdc37c665", - 0, - 0x65, - fdc37c6xx_init, fdc37c6xx_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C665 Super I/O", + .internal_name = "fdc37c665", + .flags = 0, + .local = 0x65, + .init = fdc37c6xx_init, + .close = fdc37c6xx_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc37c665_ide_device = { - "SMC FDC37C665 Super I/O (With IDE)", - "fdc37c665_ide", - 0, - 0x265, - fdc37c6xx_init, fdc37c6xx_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C665 Super I/O (With IDE)", + .internal_name = "fdc37c665_ide", + .flags = 0, + .local = 0x265, + .init = fdc37c6xx_init, + .close = fdc37c6xx_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc37c666_device = { - "SMC FDC37C666 Super I/O", - "fdc37c666", - 0, - 0x66, - fdc37c6xx_init, fdc37c6xx_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C666 Super I/O", + .internal_name = "fdc37c666", + .flags = 0, + .local = 0x66, + .init = fdc37c6xx_init, + .close = fdc37c6xx_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_fdc37c93x.c b/src/sio/sio_fdc37c93x.c index 1747df076..b9e9ef767 100644 --- a/src/sio/sio_fdc37c93x.c +++ b/src/sio/sio_fdc37c93x.c @@ -741,7 +741,7 @@ fdc37c93x_reset(fdc37c93x_t *dev) dev->ld_regs[4][0x61] = 0xf8; dev->ld_regs[4][0x70] = 4; dev->ld_regs[4][0xF0] = 3; - serial_setup(dev->uart[0], 0x3f8, dev->ld_regs[4][0x70]); + serial_setup(dev->uart[0], COM1_ADDR, dev->ld_regs[4][0x70]); /* Logical device 5: Serial Port 2 */ dev->ld_regs[5][0x30] = 1; @@ -751,7 +751,7 @@ fdc37c93x_reset(fdc37c93x_t *dev) dev->ld_regs[5][0x74] = 4; dev->ld_regs[5][0xF1] = 2; dev->ld_regs[5][0xF2] = 3; - serial_setup(dev->uart[1], 0x2f8, dev->ld_regs[5][0x70]); + serial_setup(dev->uart[1], COM2_ADDR, dev->ld_regs[5][0x70]); /* Logical device 6: RTC */ dev->ld_regs[6][0x30] = 1; @@ -873,9 +873,9 @@ fdc37c93x_init(const device_t *info) io_sethandler(0x0fb, 0x0001, fdc37c93x_read, NULL, NULL, fdc37c93x_write, NULL, NULL, dev); } else { - io_sethandler(0x370, 0x0002, + io_sethandler(FDC_SECONDARY_ADDR, 0x0002, fdc37c93x_read, NULL, NULL, fdc37c93x_write, NULL, NULL, dev); - io_sethandler(0x3f0, 0x0002, + io_sethandler(FDC_PRIMARY_ADDR, 0x0002, fdc37c93x_read, NULL, NULL, fdc37c93x_write, NULL, NULL, dev); } @@ -884,53 +884,72 @@ fdc37c93x_init(const device_t *info) return dev; } - const device_t fdc37c931apm_device = { - "SMC FDC37C932QF Super I/O", - "fdc37c931apm", - 0, - 0x130, /* Share the same ID with the 932QF. */ - fdc37c93x_init, fdc37c93x_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C932QF Super I/O", + .internal_name = "fdc37c931apm", + .flags = 0, + .local = 0x130, /* Share the same ID with the 932QF. */ + .init = fdc37c93x_init, + .close = fdc37c93x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc37c931apm_compaq_device = { - "SMC FDC37C932QF Super I/O (Compaq Presario 4500)", - "fdc37c931apm_compaq", - 0, - 0x330, /* Share the same ID with the 932QF. */ - fdc37c93x_init, fdc37c93x_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C932QF Super I/O (Compaq Presario 4500)", + .internal_name = "fdc37c931apm_compaq", + .flags = 0, + .local = 0x330, /* Share the same ID with the 932QF. */ + .init = fdc37c93x_init, + .close = fdc37c93x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc37c932fr_device = { - "SMC FDC37C932FR Super I/O", - "fdc37c932fr", - 0, - 0x03, - fdc37c93x_init, fdc37c93x_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C932FR Super I/O", + .internal_name = "fdc37c932fr", + .flags = 0, + .local = 0x03, + .init = fdc37c93x_init, + .close = fdc37c93x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc37c932qf_device = { - "SMC FDC37C932QF Super I/O", - "fdc37c932qf", - 0, - 0x30, - fdc37c93x_init, fdc37c93x_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C932QF Super I/O", + .internal_name = "fdc37c932qf", + .flags = 0, + .local = 0x30, + .init = fdc37c93x_init, + .close = fdc37c93x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc37c935_device = { - "SMC FDC37C935 Super I/O", - "fdc37c935", - 0, - 0x02, - fdc37c93x_init, fdc37c93x_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "SMC FDC37C935 Super I/O", + .internal_name = "fdc37c935", + .flags = 0, + .local = 0x02, + .init = fdc37c93x_init, + .close = fdc37c93x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_fdc37m60x.c b/src/sio/sio_fdc37m60x.c index 1b36ad996..a4433e582 100644 --- a/src/sio/sio_fdc37m60x.c +++ b/src/sio/sio_fdc37m60x.c @@ -314,31 +314,30 @@ fdc37m60x_init(const device_t *info) return dev; } - const device_t fdc37m60x_device = { - "SMSC FDC37M60X", - "fdc37m60x", - 0, - 0x03f0, - fdc37m60x_init, - fdc37m60x_close, - NULL, - { NULL }, - NULL, - NULL, - NULL + .name = "SMSC FDC37M60X", + .internal_name = "fdc37m60x", + .flags = 0, + .local = FDC_PRIMARY_ADDR, + .init = fdc37m60x_init, + .close = fdc37m60x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc37m60x_370_device = { - "SMSC FDC37M60X with 10K Pull Up Resistor", - "fdc37m60x_370", - 0, - 0x0370, - fdc37m60x_init, - fdc37m60x_close, - NULL, - { NULL }, - NULL, - NULL, - NULL + .name = "SMSC FDC37M60X with 10K Pull Up Resistor", + .internal_name = "fdc37m60x_370", + .flags = 0, + .local = FDC_SECONDARY_ADDR, + .init = fdc37m60x_init, + .close = fdc37m60x_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_it8661f.c b/src/sio/sio_it8661f.c index 565feb72c..31109df91 100644 --- a/src/sio/sio_it8661f.c +++ b/src/sio/sio_it8661f.c @@ -221,7 +221,7 @@ it8661f_write(uint16_t addr, uint8_t val, void *priv) it8661f_t *dev = (it8661f_t *)priv; switch (addr) { - case 0x370: + case FDC_SECONDARY_ADDR: if (!dev->unlocked) { (val == mb_pnp_key[dev->enumerator]) ? dev->enumerator++ : (dev->enumerator = 0); if (dev->enumerator == 31) { @@ -326,7 +326,7 @@ it8661f_init(const device_t *info) dev->uart[0] = device_add_inst(&ns16550_device, 1); dev->uart[1] = device_add_inst(&ns16550_device, 2); - io_sethandler(0x0370, 0x0002, it8661f_read, NULL, NULL, it8661f_write, NULL, NULL, dev); + io_sethandler(FDC_SECONDARY_ADDR, 0x0002, it8661f_read, NULL, NULL, it8661f_write, NULL, NULL, dev); dev->enumerator = 0; dev->unlocked = 0; @@ -335,17 +335,16 @@ it8661f_init(const device_t *info) return dev; } - const device_t it8661f_device = { - "ITE IT8661F", - "it8661f", - 0, - 0, - it8661f_init, - it8661f_close, - NULL, - { NULL }, - NULL, - NULL, - NULL + .name = "ITE IT8661F", + .internal_name = "it8661f", + .flags = 0, + .local = 0, + .init = it8661f_init, + .close = it8661f_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_pc87306.c b/src/sio/sio_pc87306.c index 2b72e3de1..5037768fd 100644 --- a/src/sio/sio_pc87306.c +++ b/src/sio/sio_pc87306.c @@ -90,27 +90,27 @@ static void lpt1_handler(pc87306_t *dev) { int temp; - uint16_t lptba, lpt_port = 0x378; - uint8_t lpt_irq = 5; + uint16_t lptba, lpt_port = LPT1_ADDR; + uint8_t lpt_irq = LPT2_IRQ; temp = dev->regs[0x01] & 3; lptba = ((uint16_t) dev->regs[0x19]) << 2; switch (temp) { case 0: - lpt_port = 0x378; - lpt_irq = (dev->regs[0x02] & 0x08) ? 7 : 5; + lpt_port = LPT1_ADDR; + lpt_irq = (dev->regs[0x02] & 0x08) ? LPT1_IRQ : LPT2_IRQ; break; case 1: if (dev->regs[0x1b] & 0x40) lpt_port = lptba; else - lpt_port = 0x3bc; - lpt_irq = 7; + lpt_port = LPT_MDA_ADDR; + lpt_irq = LPT_MDA_IRQ; break; case 2: - lpt_port = 0x278; - lpt_irq = 5; + lpt_port = LPT2_ADDR; + lpt_irq = LPT2_IRQ; break; case 3: lpt_port = 0x000; @@ -149,21 +149,21 @@ serial_handler(pc87306_t *dev, int uart) switch (temp) { case 0: - serial_setup(dev->uart[uart], SERIAL1_ADDR, irq); + serial_setup(dev->uart[uart], COM1_ADDR, irq); break; case 1: - serial_setup(dev->uart[uart], SERIAL2_ADDR, irq); + serial_setup(dev->uart[uart], COM2_ADDR, irq); break; case 2: switch ((dev->regs[1] >> 6) & 3) { case 0: - serial_setup(dev->uart[uart], 0x3e8, irq); + serial_setup(dev->uart[uart], COM3_ADDR, irq); break; case 1: serial_setup(dev->uart[uart], 0x338, irq); break; case 2: - serial_setup(dev->uart[uart], 0x2e8, irq); + serial_setup(dev->uart[uart], COM4_ADDR, irq); break; case 3: serial_setup(dev->uart[uart], 0x220, irq); @@ -173,7 +173,7 @@ serial_handler(pc87306_t *dev, int uart) case 3: switch ((dev->regs[1] >> 6) & 3) { case 0: - serial_setup(dev->uart[uart], 0x2e8, irq); + serial_setup(dev->uart[uart], COM4_ADDR, irq); break; case 1: serial_setup(dev->uart[uart], 0x238, irq); @@ -242,7 +242,7 @@ pc87306_write(uint16_t port, uint8_t val, void *priv) if (valxor & 0x28) { fdc_remove(dev->fdc); if ((val & 8) && !(dev->regs[2] & 1)) - fdc_set_base(dev->fdc, (val & 0x20) ? 0x370 : 0x3f0); + fdc_set_base(dev->fdc, (val & 0x20) ? FDC_SECONDARY_ADDR : FDC_PRIMARY_ADDR); } break; case 1: @@ -277,7 +277,7 @@ pc87306_write(uint16_t port, uint8_t val, void *priv) if (dev->regs[0] & 4) serial_handler(dev, 1); if (dev->regs[0] & 8) - fdc_set_base(dev->fdc, (dev->regs[0] & 0x20) ? 0x370 : 0x3f0); + fdc_set_base(dev->fdc, (dev->regs[0] & 0x20) ? FDC_SECONDARY_ADDR : FDC_PRIMARY_ADDR); } } if (valxor & 8) { @@ -418,13 +418,16 @@ pc87306_init(const device_t *info) return dev; } - const device_t pc87306_device = { - "National Semiconductor PC87306 Super I/O", - "pc87306", - 0, - 0, - pc87306_init, pc87306_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "National Semiconductor PC87306 Super I/O", + .internal_name = "pc87306", + .flags = 0, + .local = 0, + .init = pc87306_init, + .close = pc87306_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_pc87307.c b/src/sio/sio_pc87307.c index 24432c670..91dd1f59d 100644 --- a/src/sio/sio_pc87307.c +++ b/src/sio/sio_pc87307.c @@ -590,46 +590,58 @@ pc87307_init(const device_t *info) return dev; } - const device_t pc87307_device = { - "National Semiconductor PC87307 Super I/O", - "pc87307", - 0, - 0x1c0, - pc87307_init, pc87307_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "National Semiconductor PC87307 Super I/O", + .internal_name = "pc87307", + .flags = 0, + .local = 0x1c0, + .init = pc87307_init, + .close = pc87307_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t pc87307_15c_device = { - "National Semiconductor PC87307 Super I/O (Port 15Ch)", - "pc87307_15c", - 0, - 0x2c0, - pc87307_init, pc87307_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "National Semiconductor PC87307 Super I/O (Port 15Ch)", + .internal_name = "pc87307_15c", + .flags = 0, + .local = 0x2c0, + .init = pc87307_init, + .close = pc87307_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t pc87307_both_device = { - "National Semiconductor PC87307 Super I/O (Ports 2Eh and 15Ch)", - "pc87307_both", - 0, - 0x3c0, - pc87307_init, pc87307_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "National Semiconductor PC87307 Super I/O (Ports 2Eh and 15Ch)", + .internal_name = "pc87307_both", + .flags = 0, + .local = 0x3c0, + .init = pc87307_init, + .close = pc87307_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t pc97307_device = { - "National Semiconductor PC97307 Super I/O", - "pc97307", - 0, - 0x1cf, - pc87307_init, pc87307_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "National Semiconductor PC97307 Super I/O", + .internal_name = "pc97307", + .flags = 0, + .local = 0x1cf, + .init = pc87307_init, + .close = pc87307_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_pc87309.c b/src/sio/sio_pc87309.c index ad214ff6a..bf261a26f 100644 --- a/src/sio/sio_pc87309.c +++ b/src/sio/sio_pc87309.c @@ -471,24 +471,30 @@ pc87309_init(const device_t *info) return dev; } - const device_t pc87309_device = { - "National Semiconductor PC87309 Super I/O", - "pc87309", - 0, - 0xe0, - pc87309_init, pc87309_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "National Semiconductor PC87309 Super I/O", + .internal_name = "pc87309", + .flags = 0, + .local = 0xe0, + .init = pc87309_init, + .close = pc87309_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t pc87309_15c_device = { - "National Semiconductor PC87309 Super I/O (Port 15Ch)", - "pc87309_15c", - 0, - 0x1e0, - pc87309_init, pc87309_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "National Semiconductor PC87309 Super I/O (Port 15Ch)", + .internal_name = "pc87309_15c", + .flags = 0, + .local = 0x1e0, + .init = pc87309_init, + .close = pc87309_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_pc87310.c b/src/sio/sio_pc87310.c index 30604cf03..7817fee9d 100644 --- a/src/sio/sio_pc87310.c +++ b/src/sio/sio_pc87310.c @@ -73,8 +73,8 @@ static void lpt1_handler(pc87310_t *dev) { int temp; - uint16_t lpt_port = 0x378; - uint8_t lpt_irq = 7; + uint16_t lpt_port = LPT1_ADDR; + uint8_t lpt_irq = LPT1_IRQ; /* bits 0-1: * 00 378h @@ -86,13 +86,13 @@ lpt1_handler(pc87310_t *dev) switch (temp) { case 0: - lpt_port = 0x378; + lpt_port = LPT1_ADDR; break; case 1: - lpt_port = 0x3bc; + lpt_port = LPT_MDA_ADDR; break; case 2: - lpt_port = 0x278; + lpt_port = LPT2_ADDR; break; case 3: lpt_port = 0x000; @@ -121,10 +121,10 @@ serial_handler(pc87310_t *dev, int uart) if (!temp){ //configure serial port as COM2 if (((dev->reg >> 4) & 1) ^ uart) - serial_setup(dev->uart[uart], 0x2f8, 3); + serial_setup(dev->uart[uart], COM2_ADDR, COM2_IRQ); // configure serial port as COM1 else - serial_setup(dev->uart[uart], 0x3f8, 4); + serial_setup(dev->uart[uart], COM1_ADDR, COM1_IRQ); } } @@ -185,7 +185,7 @@ pc87310_write(uint16_t port, uint8_t val, void *priv) /* bit 6: 1 disable fdc */ if (!(val & 0x40)) { pc87310_log("SIO: FDC enabled\n"); - fdc_set_base(dev->fdc, 0x3f0); + fdc_set_base(dev->fdc, FDC_PRIMARY_ADDR); } } return; @@ -263,23 +263,30 @@ pc87310_init(const device_t *info) return dev; } - const device_t pc87310_device = { - "National Semiconductor PC87310 Super I/O", - "pc87310", - 0, - 0, - pc87310_init, pc87310_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "National Semiconductor PC87310 Super I/O", + .internal_name = "pc87310", + .flags = 0, + .local = 0, + .init = pc87310_init, + .close = pc87310_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t pc87310_ide_device = { - "National Semiconductor PC87310 Super I/O with IDE functionality", - "pc87310_ide", - 0, - 1, - pc87310_init, pc87310_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "National Semiconductor PC87310 Super I/O with IDE functionality", + .internal_name = "pc87310_ide", + .flags = 0, + .local = 1, + .init = pc87310_init, + .close = pc87310_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_pc87311.c b/src/sio/sio_pc87311.c index 6406c766d..f52b065df 100644 --- a/src/sio/sio_pc87311.c +++ b/src/sio/sio_pc87311.c @@ -119,8 +119,8 @@ pc87311_read(uint16_t addr, void *priv) void pc87311_fdc_handler(pc87311_t *dev) { fdc_remove(dev->fdc_controller); - fdc_set_base(dev->fdc_controller, (FUNCTION_ENABLE & 0x20) ? 0x0370 : 0x03f0); - pc87311_log("PC87311-FDC: BASE %04x\n", (FUNCTION_ENABLE & 0x20) ? 0x0370 : 0x03f0); + fdc_set_base(dev->fdc_controller, (FUNCTION_ENABLE & 0x20) ? FDC_SECONDARY_ADDR : FDC_PRIMARY_ADDR); + pc87311_log("PC87311-FDC: BASE %04x\n", (FUNCTION_ENABLE & 0x20) ? FDC_SECONDARY_ADDR : FDC_PRIMARY_ADDR); } uint16_t com3(pc87311_t *dev) @@ -128,15 +128,15 @@ uint16_t com3(pc87311_t *dev) switch (COM_BA) { case 0: - return 0x03e8; + return COM3_ADDR; case 1: return 0x0338; case 2: - return 0x02e8; + return COM4_ADDR; case 3: return 0x0220; default: - return 0x03e8; + return COM3_ADDR; } } @@ -145,7 +145,7 @@ uint16_t com4(pc87311_t *dev) switch (COM_BA) { case 0: - return 0x02e8; + return COM4_ADDR; case 1: return 0x0238; case 2: @@ -153,7 +153,7 @@ uint16_t com4(pc87311_t *dev) case 3: return 0x0228; default: - return 0x02e8; + return COM4_ADDR; } } @@ -164,20 +164,20 @@ void pc87311_uart_handler(uint8_t num, pc87311_t *dev) switch (!(num & 1) ? UART1_BA : UART2_BA) { case 0: - dev->base = 0x03f8; - dev->irq = 4; + dev->base = COM1_ADDR; + dev->irq = COM1_IRQ; break; case 1: - dev->base = 0x02f8; - dev->irq = 3; + dev->base = COM2_ADDR; + dev->irq = COM2_IRQ; break; case 2: dev->base = com3(dev); - dev->irq = 4; + dev->irq = COM3_IRQ; break; case 3: dev->base = com4(dev); - dev->irq = 3; + dev->irq = COM4_IRQ; break; } serial_setup(dev->uart[num & 1], dev->base, dev->irq); @@ -190,16 +190,16 @@ void pc87311_lpt_handler(pc87311_t *dev) switch (LPT_BA) { case 0: - dev->base = 0x0378; - dev->irq = (POWER_TEST & 0x08) ? 7 : 5; + dev->base = LPT1_ADDR; + dev->irq = (POWER_TEST & 0x08) ? LPT1_IRQ : LPT2_IRQ; break; case 1: - dev->base = 0x03bc; - dev->irq = 7; + dev->base = LPT_MDA_ADDR; + dev->irq = LPT_MDA_IRQ; break; case 2: - dev->base = 0x0278; - dev->irq = 5; + dev->base = LPT2_ADDR; + dev->irq = LPT2_IRQ; break; } lpt1_init(dev->base); @@ -273,27 +273,29 @@ pc87311_init(const device_t *info) } const device_t pc87311_device = { - "National Semiconductor PC87311", - "pc87311", - 0, - 0, - pc87311_init, - pc87311_close, - NULL, - {NULL}, - NULL, - NULL, - NULL}; + .name = "National Semiconductor PC87311", + .internal_name = "pc87311", + .flags = 0, + .local = 0, + .init = pc87311_init, + .close = pc87311_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; const device_t pc87311_ide_device = { - "National Semiconductor PC87311 with IDE functionality", - "pc87311_ide", - 0, - 1, - pc87311_init, - pc87311_close, - NULL, - {NULL}, - NULL, - NULL, - NULL}; + .name = "National Semiconductor PC87311 with IDE functionality", + .internal_name = "pc87311_ide", + .flags = 0, + .local = 1, + .init = pc87311_init, + .close = pc87311_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; diff --git a/src/sio/sio_pc87332.c b/src/sio/sio_pc87332.c index ea185abce..a2fd7f0d3 100644 --- a/src/sio/sio_pc87332.c +++ b/src/sio/sio_pc87332.c @@ -48,23 +48,23 @@ static void lpt1_handler(pc87332_t *dev) { int temp; - uint16_t lpt_port = 0x378; - uint8_t lpt_irq = 5; + uint16_t lpt_port = LPT1_ADDR; + uint8_t lpt_irq = LPT2_IRQ; temp = dev->regs[0x01] & 3; switch (temp) { case 0: - lpt_port = 0x378; - lpt_irq = (dev->regs[0x02] & 0x08) ? 7 : 5; + lpt_port = LPT1_ADDR; + lpt_irq = (dev->regs[0x02] & 0x08) ? LPT1_IRQ : LPT2_IRQ; break; case 1: - lpt_port = 0x3bc; - lpt_irq = 7; + lpt_port = LPT_MDA_ADDR; + lpt_irq = LPT_MDA_IRQ; break; case 2: - lpt_port = 0x278; - lpt_irq = 5; + lpt_port = LPT2_ADDR; + lpt_irq = LPT2_IRQ; break; case 3: lpt_port = 0x000; @@ -88,40 +88,40 @@ serial_handler(pc87332_t *dev, int uart) switch (temp) { case 0: - serial_setup(dev->uart[uart], SERIAL1_ADDR, 4); + serial_setup(dev->uart[uart], COM1_ADDR, 4); break; case 1: - serial_setup(dev->uart[uart], SERIAL2_ADDR, 3); + serial_setup(dev->uart[uart], COM2_ADDR, 3); break; case 2: switch ((dev->regs[1] >> 6) & 3) { case 0: - serial_setup(dev->uart[uart], 0x3e8, 4); + serial_setup(dev->uart[uart], COM3_ADDR, COM3_IRQ); break; case 1: - serial_setup(dev->uart[uart], 0x338, 4); + serial_setup(dev->uart[uart], 0x338, COM3_IRQ); break; case 2: - serial_setup(dev->uart[uart], 0x2e8, 4); + serial_setup(dev->uart[uart], COM4_ADDR, COM3_IRQ); break; case 3: - serial_setup(dev->uart[uart], 0x220, 4); + serial_setup(dev->uart[uart], 0x220, COM3_IRQ); break; } break; case 3: switch ((dev->regs[1] >> 6) & 3) { case 0: - serial_setup(dev->uart[uart], 0x2e8, 3); + serial_setup(dev->uart[uart], COM4_ADDR, COM4_IRQ); break; case 1: - serial_setup(dev->uart[uart], 0x238, 3); + serial_setup(dev->uart[uart], 0x238, COM4_IRQ); break; case 2: - serial_setup(dev->uart[uart], 0x2e0, 3); + serial_setup(dev->uart[uart], 0x2e0, COM4_IRQ); break; case 3: - serial_setup(dev->uart[uart], 0x228, 3); + serial_setup(dev->uart[uart], 0x228, COM4_IRQ); break; } break; @@ -195,7 +195,7 @@ pc87332_write(uint16_t port, uint8_t val, void *priv) if (valxor & 0x28) { fdc_remove(dev->fdc); if ((val & 8) && !(dev->regs[2] & 1)) - fdc_set_base(dev->fdc, (val & 0x20) ? 0x370 : 0x3f0); + fdc_set_base(dev->fdc, (val & 0x20) ? FDC_SECONDARY_ADDR : FDC_PRIMARY_ADDR); } if (dev->has_ide && (valxor & 0xc0)) ide_handler(dev); @@ -232,7 +232,7 @@ pc87332_write(uint16_t port, uint8_t val, void *priv) if (dev->regs[0] & 4) serial_handler(dev, 1); if (dev->regs[0] & 8) - fdc_set_base(dev->fdc, (dev->regs[0] & 0x20) ? 0x370 : 0x3f0); + fdc_set_base(dev->fdc, (dev->regs[0] & 0x20) ? FDC_SECONDARY_ADDR : FDC_PRIMARY_ADDR); } } if (valxor & 8) { @@ -335,57 +335,72 @@ pc87332_init(const device_t *info) return dev; } - const device_t pc87332_device = { - "National Semiconductor PC87332 Super I/O", - "pc87332", - 0, - 0x00, - pc87332_init, pc87332_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "National Semiconductor PC87332 Super I/O", + .internal_name = "pc87332", + .flags = 0, + .local = 0x00, + .init = pc87332_init, + .close = pc87332_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t pc87332_398_device = { - "National Semiconductor PC87332 Super I/O (Port 398h)", - "pc87332_398", - 0, - 0x01, - pc87332_init, pc87332_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "National Semiconductor PC87332 Super I/O (Port 398h)", + .internal_name = "pc87332_398", + .flags = 0, + .local = 0x01, + .init = pc87332_init, + .close = pc87332_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t pc87332_398_ide_device = { - "National Semiconductor PC87332 Super I/O (Port 398h) (With IDE)", - "pc87332_398_ide", - 0, - 0x101, - pc87332_init, pc87332_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "National Semiconductor PC87332 Super I/O (Port 398h) (With IDE)", + .internal_name = "pc87332_398_ide", + .flags = 0, + .local = 0x101, + .init = pc87332_init, + .close = pc87332_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t pc87332_398_ide_sec_device = { - "National Semiconductor PC87332 Super I/O (Port 398h) (With Secondary IDE)", - "pc87332_398_ide_sec", - 0, - 0x201, - pc87332_init, pc87332_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "National Semiconductor PC87332 Super I/O (Port 398h) (With Secondary IDE)", + .internal_name = "pc87332_398_ide_sec", + .flags = 0, + .local = 0x201, + .init = pc87332_init, + .close = pc87332_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t pc87332_398_ide_fdcon_device = { - "National Semiconductor PC87332 Super I/O (Port 398h) (With IDE and FDC on)", - "pc87332_398_ide_fdcon", - 0, - 0x10101, - pc87332_init, pc87332_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "National Semiconductor PC87332 Super I/O (Port 398h) (With IDE and FDC on)", + .internal_name = "pc87332_398_ide_fdcon", + .flags = 0, + .local = 0x10101, + .init = pc87332_init, + .close = pc87332_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_prime3b.c b/src/sio/sio_prime3b.c index 9e71f3124..ac00106d3 100644 --- a/src/sio/sio_prime3b.c +++ b/src/sio/sio_prime3b.c @@ -108,15 +108,15 @@ prime3b_write(uint16_t addr, uint8_t val, void *priv) switch ((dev->regs[0xa4] >> 6) & 3) { case 0: - dev->com3_addr = 0x3e8; - dev->com4_addr = 0x2e8; + dev->com3_addr = COM3_ADDR; + dev->com4_addr = COM4_ADDR; break; case 1: dev->com3_addr = 0x338; dev->com4_addr = 0x238; break; case 2: - dev->com3_addr = 0x2e8; + dev->com3_addr = COM4_ADDR; dev->com4_addr = 0x2e0; break; case 3: @@ -142,7 +142,7 @@ prime3b_read(uint16_t addr, void *priv) void prime3b_fdc_handler(prime3b_t *dev) { - uint16_t fdc_base = !(ASR & 0x40) ? 0x3f0 : 0x370; + uint16_t fdc_base = !(ASR & 0x40) ? FDC_PRIMARY_ADDR : FDC_SECONDARY_ADDR; fdc_remove(dev->fdc_controller); fdc_set_base(dev->fdc_controller, fdc_base); prime3b_log("Prime3B-FDC: Enabled with base %03x\n", fdc_base); @@ -154,7 +154,7 @@ void prime3b_uart_handler(uint8_t num, prime3b_t *dev) if ((ASR >> (3 + 2 * num)) & 1) uart_base = !((ASR >> (2 + 2 * num)) & 1) ? dev->com3_addr : dev->com4_addr; else - uart_base = !((ASR >> (2 + 2 * num)) & 1) ? 0x3f8 : 0x2f8; + uart_base = !((ASR >> (2 + 2 * num)) & 1) ? COM1_ADDR : COM2_ADDR; serial_remove(dev->uart[num]); serial_setup(dev->uart[num], uart_base, 4 - num); @@ -163,10 +163,10 @@ void prime3b_uart_handler(uint8_t num, prime3b_t *dev) void prime3b_lpt_handler(prime3b_t *dev) { - uint16_t lpt_base = (ASR & 2) ? 0x3bc : (!(ASR & 1) ? 0x378 : 0x278); + uint16_t lpt_base = (ASR & 2) ? LPT_MDA_ADDR : (!(ASR & 1) ? LPT1_ADDR : LPT2_ADDR); lpt1_remove(); lpt1_init(lpt_base); - lpt1_irq(7); + lpt1_irq(LPT1_IRQ); prime3b_log("Prime3B-LPT: Enabled with base %03x\n", lpt_base); } @@ -174,9 +174,10 @@ void prime3b_ide_handler(prime3b_t *dev) { ide_pri_disable(); uint16_t ide_base = !(ASR & 0x80) ? 0x1f0 : 0x170; + uint16_t ide_side = ide_base + 0x206; ide_set_base(0, ide_base); - ide_set_side(0, ide_base + 0x206); - prime3b_log("Prime3B-IDE: Enabled with base %03x and side %03x\n", ide_base, ide_base + 0x206); + ide_set_side(0, ide_side); + prime3b_log("Prime3B-IDE: Enabled with base %03x and side %03x\n", ide_base, ide_side); } void prime3b_enable(prime3b_t *dev) @@ -256,8 +257,8 @@ prime3b_init(const device_t *info) if (HAS_IDE_FUNCTIONALITY) device_add(&ide_isa_device); - dev->com3_addr = 0x3e8; - dev->com4_addr = 0x2e8; + dev->com3_addr = COM3_ADDR; + dev->com4_addr = COM4_ADDR; fdc_reset(dev->fdc_controller); prime3b_enable(dev); @@ -268,27 +269,29 @@ prime3b_init(const device_t *info) } const device_t prime3b_device = { - "Goldstar Prime3B", - "prime3b", - 0, - 0, - prime3b_init, - prime3b_close, - NULL, - {NULL}, - NULL, - NULL, - NULL}; + .name = "Goldstar Prime3B", + .internal_name = "prime3b", + .flags = 0, + .local = 0, + .init = prime3b_init, + .close = prime3b_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; const device_t prime3b_ide_device = { - "Goldstar Prime3B with IDE functionality", - "prime3b_ide", - 0, - 1, - prime3b_init, - prime3b_close, - NULL, - {NULL}, - NULL, - NULL, - NULL}; + .name = "Goldstar Prime3B with IDE functionality", + .internal_name = "prime3b_ide", + .flags = 0, + .local = 1, + .init = prime3b_init, + .close = prime3b_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; diff --git a/src/sio/sio_prime3c.c b/src/sio/sio_prime3c.c index 1b4bde5d4..ec350ece2 100644 --- a/src/sio/sio_prime3c.c +++ b/src/sio/sio_prime3c.c @@ -318,27 +318,29 @@ prime3c_init(const device_t *info) } const device_t prime3c_device = { - "Goldstar Prime3C", - "prime3c", - 0, - 0, - prime3c_init, - prime3c_close, - NULL, - {NULL}, - NULL, - NULL, - NULL}; + .name = "Goldstar Prime3C", + .internal_name = "prime3c", + .flags = 0, + .local = 0, + .init = prime3c_init, + .close = prime3c_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; const device_t prime3c_ide_device = { - "Goldstar Prime3C with IDE functionality", - "prime3c_ide", - 0, - 1, - prime3c_init, - prime3c_close, - NULL, - {NULL}, - NULL, - NULL, - NULL}; + .name = "Goldstar Prime3C with IDE functionality", + .internal_name = "prime3c_ide", + .flags = 0, + .local = 1, + .init = prime3c_init, + .close = prime3c_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; diff --git a/src/sio/sio_um8669f.c b/src/sio/sio_um8669f.c index aeef3a51e..aece09fe6 100644 --- a/src/sio/sio_um8669f.c +++ b/src/sio/sio_um8669f.c @@ -71,21 +71,21 @@ static uint8_t um8669f_pnp_rom[] = { static const isapnp_device_config_t um8669f_pnp_defaults[] = { { .activate = 1, - .io = { { .base = 0x03f0 }, }, - .irq = { { .irq = 6 }, }, - .dma = { { .dma = 2 }, } + .io = { { .base = FDC_PRIMARY_ADDR }, }, + .irq = { { .irq = FDC_PRIMARY_IRQ }, }, + .dma = { { .dma = FDC_PRIMARY_DMA }, } }, { .activate = 1, - .io = { { .base = 0x03f8 }, }, - .irq = { { .irq = 4 }, } + .io = { { .base = COM1_ADDR }, }, + .irq = { { .irq = COM1_IRQ }, } }, { .activate = 1, - .io = { { .base = 0x02f8 }, }, - .irq = { { .irq = 3 }, } + .io = { { .base = COM2_ADDR }, }, + .irq = { { .irq = COM2_IRQ }, } }, { .activate = 1, - .io = { { .base = 0x0378 }, }, - .irq = { { .irq = 7 }, } + .io = { { .base = LPT1_ADDR }, }, + .irq = { { .irq = LPT1_IRQ }, } }, { .activate = 0 }, { @@ -302,11 +302,15 @@ um8669f_init(const device_t *info) const device_t um8669f_device = { - "UMC UM8669F Super I/O", - "um8669f", - 0, - 0, - um8669f_init, um8669f_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "UMC UM8669F Super I/O", + .internal_name = "um8669f", + .flags = 0, + .local = 0, + .init = um8669f_init, + .close = um8669f_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_vt82c686.c b/src/sio/sio_vt82c686.c index 3f6229f15..8d242165e 100644 --- a/src/sio/sio_vt82c686.c +++ b/src/sio/sio_vt82c686.c @@ -239,9 +239,9 @@ vt82c686_sio_write(uint8_t addr, uint8_t val, void *priv) break; case 0x85: - io_removehandler(0x3f0, 2, vt82c686_read, NULL, NULL, vt82c686_write, NULL, NULL, dev); + io_removehandler(FDC_PRIMARY_ADDR, 2, vt82c686_read, NULL, NULL, vt82c686_write, NULL, NULL, dev); if (val & 0x02) - io_sethandler(0x3f0, 2, vt82c686_read, NULL, NULL, vt82c686_write, NULL, NULL, dev); + io_sethandler(FDC_PRIMARY_ADDR, 2, vt82c686_read, NULL, NULL, vt82c686_write, NULL, NULL, dev); break; } } @@ -261,8 +261,8 @@ vt82c686_reset(vt82c686_t *dev) fdc_reset(dev->fdc); - serial_setup(dev->uart[0], SERIAL1_ADDR, SERIAL1_IRQ); - serial_setup(dev->uart[1], SERIAL2_ADDR, SERIAL2_IRQ); + serial_setup(dev->uart[0], COM1_ADDR, COM1_IRQ); + serial_setup(dev->uart[1], COM2_ADDR, COM2_IRQ); vt82c686_lpt_handler(dev); vt82c686_serial_handler(dev, 0); @@ -303,11 +303,15 @@ vt82c686_init(const device_t *info) const device_t via_vt82c686_sio_device = { - "VIA VT82C686 Integrated Super I/O", - "via_vt82c686_sio", - 0, - 0, - vt82c686_init, vt82c686_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "VIA VT82C686 Integrated Super I/O", + .internal_name = "via_vt82c686_sio", + .flags = 0, + .local = 0, + .init = vt82c686_init, + .close = vt82c686_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_w83787f.c b/src/sio/sio_w83787f.c index a24e8695c..fe48f5d79 100644 --- a/src/sio/sio_w83787f.c +++ b/src/sio/sio_w83787f.c @@ -125,27 +125,27 @@ w83787f_serial_handler(w83787f_t *dev, int uart) int urs0 = !!(dev->regs[1] & (1 << uart)); int urs1 = !!(dev->regs[1] & (4 << uart)); int urs2 = !!(dev->regs[3] & (8 >> uart)); - int urs, irq = 4; - uint16_t addr = 0x3f8, enable = 1; + int urs, irq = COM1_IRQ; + uint16_t addr = COM1_ADDR, enable = 1; urs = (urs1 << 1) | urs0; if (urs2) { - addr = uart ? 0x3f8 : 0x2f8; - irq = uart ? 4 : 3; + addr = uart ? COM1_ADDR : COM2_ADDR; + irq = uart ? COM1_IRQ : COM2_IRQ; } else { switch (urs) { case 0: - addr = uart ? 0x3e8 : 0x2e8; - irq = uart ? 4 : 3; + addr = uart ? COM3_ADDR : COM4_ADDR; + irq = uart ? COM3_IRQ : COM4_IRQ; break; case 1: - addr = uart ? 0x2e8 : 0x3e8; - irq = uart ? 3 : 4; + addr = uart ? COM4_ADDR : COM3_ADDR; + irq = uart ? COM4_IRQ : COM3_IRQ; break; case 2: - addr = uart ? 0x2f8 : 0x3f8; - irq = uart ? 3 : 4; + addr = uart ? COM2_ADDR : COM1_ADDR; + irq = uart ? COM2_IRQ : COM1_IRQ; break; case 3: default: @@ -167,21 +167,21 @@ static void w83787f_lpt_handler(w83787f_t *dev) { int ptras = (dev->regs[1] >> 4) & 0x03; - int irq = 7; - uint16_t addr = 0x378, enable = 1; + int irq = LPT1_IRQ; + uint16_t addr = LPT1_ADDR, enable = 1; switch (ptras) { case 0x00: - addr = 0x3bc; - irq = 7; + addr = LPT_MDA_ADDR; + irq = LPT_MDA_IRQ; break; case 0x01: - addr = 0x278; - irq = 5; + addr = LPT2_ADDR; + irq = LPT2_IRQ; break; case 0x02: - addr = 0x378; - irq = 7; + addr = LPT1_ADDR; + irq = LPT1_IRQ; break; case 0x03: default: @@ -205,7 +205,7 @@ w83787f_fdc_handler(w83787f_t *dev) { fdc_remove(dev->fdc); if (!(dev->regs[0] & 0x20) && !(dev->regs[6] & 0x08)) - fdc_set_base(dev->fdc, (dev->regs[0] & 0x10) ? 0x03f0 : 0x0370); + fdc_set_base(dev->fdc, (dev->regs[0] & 0x10) ? FDC_PRIMARY_ADDR : FDC_SECONDARY_ADDR); } @@ -361,8 +361,8 @@ static void w83787f_reset(w83787f_t *dev) { lpt1_remove(); - lpt1_init(0x378); - lpt1_irq(7); + lpt1_init(LPT1_ADDR); + lpt1_irq(LPT1_IRQ); memset(dev->regs, 0, 0x2A); @@ -399,8 +399,8 @@ w83787f_reset(w83787f_t *dev) dev->regs[0x0c] = 0x2C; dev->regs[0x0d] = 0xA3; - serial_setup(dev->uart[0], SERIAL1_ADDR, SERIAL1_IRQ); - serial_setup(dev->uart[1], SERIAL2_ADDR, SERIAL2_IRQ); + serial_setup(dev->uart[0], COM1_ADDR, COM1_IRQ); + serial_setup(dev->uart[1], COM2_ADDR, COM2_IRQ); dev->key = 0x89; @@ -444,43 +444,58 @@ w83787f_init(const device_t *info) return dev; } - const device_t w83787f_device = { - "Winbond W83787F/IF Super I/O", - "w83787f", - 0, - 0x09, - w83787f_init, w83787f_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83787F/IF Super I/O", + .internal_name = "w83787f", + .flags = 0, + .local = 0x09, + .init = w83787f_init, + .close = w83787f_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t w83787f_ide_device = { - "Winbond W83787F/IF Super I/O (With IDE)", - "w83787f_ide", - 0, - 0x19, - w83787f_init, w83787f_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83787F/IF Super I/O (With IDE)", + .internal_name = "w83787f_ide", + .flags = 0, + .local = 0x19, + .init = w83787f_init, + .close = w83787f_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t w83787f_ide_en_device = { - "Winbond W83787F/IF Super I/O (With IDE Enabled)", - "w83787f_ide_en", - 0, - 0x59, - w83787f_init, w83787f_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83787F/IF Super I/O (With IDE Enabled)", + .internal_name = "w83787f_ide_en", + .flags = 0, + .local = 0x59, + .init = w83787f_init, + .close = w83787f_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t w83787f_ide_sec_device = { - "Winbond W83787F/IF Super I/O (With Secondary IDE)", - "w83787f_ide_sec", - 0, - 0x39, - w83787f_init, w83787f_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83787F/IF Super I/O (With Secondary IDE)", + .internal_name = "w83787f_ide_sec", + .flags = 0, + .local = 0x39, + .init = w83787f_init, + .close = w83787f_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_w83877f.c b/src/sio/sio_w83877f.c index 3867fec60..424414e01 100644 --- a/src/sio/sio_w83877f.c +++ b/src/sio/sio_w83877f.c @@ -81,9 +81,9 @@ w83877f_remap(w83877f_t *dev) io_removehandler(0x250, 0x0002, w83877f_read, NULL, NULL, w83877f_write, NULL, NULL, dev); - io_removehandler(0x3f0, 0x0002, + io_removehandler(FDC_PRIMARY_ADDR, 0x0002, w83877f_read, NULL, NULL, w83877f_write, NULL, NULL, dev); - dev->base_address = (hefras ? 0x3f0 : 0x250); + dev->base_address = (hefras ? FDC_PRIMARY_ADDR : 0x250); io_sethandler(dev->base_address, 0x0002, w83877f_read, NULL, NULL, w83877f_write, NULL, NULL, dev); dev->key_times = hefras + 1; @@ -127,7 +127,7 @@ make_port(w83877f_t *dev, uint8_t reg) p &= 0x3F8; else p &= 0x3FC; - if ((p < 0x100) || (p > 0x3FF)) p = 0x378; + if ((p < 0x100) || (p > 0x3FF)) p = LPT1_ADDR; /* In ECP mode, A10 is active. */ if (l & 0x80) p |= 0x400; @@ -135,12 +135,12 @@ make_port(w83877f_t *dev, uint8_t reg) case 0x24: p = ((uint16_t) (dev->regs[reg] & 0xfe)) << 2; p &= 0xFF8; - if ((p < 0x100) || (p > 0x3F8)) p = 0x3F8; + if ((p < 0x100) || (p > 0x3F8)) p = COM1_ADDR; break; case 0x25: p = ((uint16_t) (dev->regs[reg] & 0xfe)) << 2; p &= 0xFF8; - if ((p < 0x100) || (p > 0x3F8)) p = 0x2F8; + if ((p < 0x100) || (p > 0x3F8)) p = COM2_ADDR; break; } @@ -153,7 +153,7 @@ w83877f_fdc_handler(w83877f_t *dev) { fdc_remove(dev->fdc); if (!(dev->regs[6] & 0x08) && (dev->regs[0x20] & 0xc0)) - fdc_set_base(dev->fdc, 0x03f0); + fdc_set_base(dev->fdc, FDC_PRIMARY_ADDR); } @@ -219,7 +219,7 @@ w83877f_write(uint16_t port, uint8_t val, void *priv) if (val <= max) dev->cur_reg = val; return; - } else if (port == 0x03f0) { + } else if (port == FDC_PRIMARY_ADDR) { if ((val == dev->key) && !dev->locked) { if (dev->key_times == 2) { if (dev->tries) { @@ -375,7 +375,7 @@ w83877f_read(uint16_t port, void *priv) uint8_t ret = 0xff; if (dev->locked) { - if ((port == 0x3f0) || (port == 0x251)) + if ((port == FDC_PRIMARY_ADDR) || (port == 0x251)) ret = dev->cur_reg; else if ((port == 0x3f1) || (port == 0x252)) { if (dev->cur_reg == 7) @@ -403,12 +403,12 @@ w83877f_reset(w83877f_t *dev) dev->regs[0x0d] = 0xA3; dev->regs[0x16] = dev->reg_init & 0xff; dev->regs[0x1e] = 0x81; - dev->regs[0x20] = (0x3f0 >> 2) & 0xfc; + dev->regs[0x20] = (FDC_PRIMARY_ADDR >> 2) & 0xfc; dev->regs[0x21] = (0x1f0 >> 2) & 0xfc; dev->regs[0x22] = ((0x3f6 >> 2) & 0xfc) | 1; - dev->regs[0x23] = (0x378 >> 2); - dev->regs[0x24] = (0x3f8 >> 2) & 0xfe; - dev->regs[0x25] = (0x2f8 >> 2) & 0xfe; + dev->regs[0x23] = (LPT1_ADDR >> 2); + dev->regs[0x24] = (COM1_ADDR >> 2) & 0xfe; + dev->regs[0x25] = (COM2_ADDR >> 2) & 0xfe; dev->regs[0x26] = (2 << 4) | 4; dev->regs[0x27] = (2 << 4) | 5; dev->regs[0x28] = (4 << 4) | 3; @@ -421,7 +421,7 @@ w83877f_reset(w83877f_t *dev) w83877f_serial_handler(dev, 0); w83877f_serial_handler(dev, 1); - dev->base_address = 0x3f0; + dev->base_address = FDC_PRIMARY_ADDR; dev->key = 0x89; dev->key_times = 1; @@ -459,46 +459,58 @@ w83877f_init(const device_t *info) return dev; } - const device_t w83877f_device = { - "Winbond W83877F Super I/O", - "w83877f", - 0, - 0x0a05, - w83877f_init, w83877f_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83877F Super I/O", + .internal_name = "w83877f", + .flags = 0, + .local = 0x0a05, + .init = w83877f_init, + .close = w83877f_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t w83877f_president_device = { - "Winbond W83877F Super I/O (President)", - "w83877f_president", - 0, - 0x0a04, - w83877f_init, w83877f_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83877F Super I/O (President)", + .internal_name = "w83877f_president", + .flags = 0, + .local = 0x0a04, + .init = w83877f_init, + .close = w83877f_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t w83877tf_device = { - "Winbond W83877TF Super I/O", - "w83877tf", - 0, - 0x0c04, - w83877f_init, w83877f_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83877TF Super I/O", + .internal_name = "w83877tf", + .flags = 0, + .local = 0x0c04, + .init = w83877f_init, + .close = w83877f_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t w83877tf_acorp_device = { - "Winbond W83877TF Super I/O", - "w83877tf_acorp", - 0, - 0x0c05, - w83877f_init, w83877f_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83877TF Super I/O", + .internal_name = "w83877tf_acorp", + .flags = 0, + .local = 0x0c05, + .init = w83877f_init, + .close = w83877f_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sio/sio_w83977f.c b/src/sio/sio_w83977f.c index 66678d741..370bb8c68 100644 --- a/src/sio/sio_w83977f.c +++ b/src/sio/sio_w83977f.c @@ -60,12 +60,12 @@ static uint8_t w83977f_read(uint16_t port, void *priv); static void w83977f_remap(w83977f_t *dev) { - io_removehandler(0x3f0, 0x0002, + io_removehandler(FDC_PRIMARY_ADDR, 0x0002, w83977f_read, NULL, NULL, w83977f_write, NULL, NULL, dev); - io_removehandler(0x370, 0x0002, + io_removehandler(FDC_SECONDARY_ADDR, 0x0002, w83977f_read, NULL, NULL, w83977f_write, NULL, NULL, dev); - dev->base_address = (HEFRAS ? 0x370 : 0x3f0); + dev->base_address = (HEFRAS ? FDC_SECONDARY_ADDR : FDC_PRIMARY_ADDR); io_sethandler(dev->base_address, 0x0002, w83977f_read, NULL, NULL, w83977f_write, NULL, NULL, dev); @@ -507,13 +507,13 @@ w83977f_reset(w83977f_t *dev) } if (dev->id == 1) { - serial_setup(dev->uart[0], SERIAL3_ADDR, SERIAL3_IRQ); - serial_setup(dev->uart[1], SERIAL4_ADDR, SERIAL4_IRQ); + serial_setup(dev->uart[0], COM3_ADDR, COM3_IRQ); + serial_setup(dev->uart[1], COM4_ADDR, COM4_IRQ); } else { fdc_reset(dev->fdc); - serial_setup(dev->uart[0], SERIAL1_ADDR, SERIAL1_IRQ); - serial_setup(dev->uart[1], SERIAL2_ADDR, SERIAL2_IRQ); + serial_setup(dev->uart[0], COM1_ADDR, COM1_IRQ); + serial_setup(dev->uart[1], COM2_ADDR, COM2_IRQ); w83977f_fdc_handler(dev); } @@ -566,57 +566,72 @@ w83977f_init(const device_t *info) return dev; } - const device_t w83977f_device = { - "Winbond W83977F Super I/O", - "w83977f", - 0, - 0, - w83977f_init, w83977f_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83977F Super I/O", + .internal_name = "w83977f", + .flags = 0, + .local = 0, + .init = w83977f_init, + .close = w83977f_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t w83977f_370_device = { - "Winbond W83977F Super I/O (Port 370h)", - "w83977f_370", - 0, - 0x40, - w83977f_init, w83977f_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83977F Super I/O (Port 370h)", + .internal_name = "w83977f_370", + .flags = 0, + .local = 0x40, + .init = w83977f_init, + .close = w83977f_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t w83977tf_device = { - "Winbond W83977TF Super I/O", - "w83977tf", - 0, - 1, - w83977f_init, w83977f_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83977TF Super I/O", + .internal_name = "w83977tf", + .flags = 0, + .local = 1, + .init = w83977f_init, + .close = w83977f_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t w83977ef_device = { - "Winbond W83977TF Super I/O", - "w83977ef", - 0, - 2, - w83977f_init, w83977f_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83977TF Super I/O", + .internal_name = "w83977ef", + .flags = 0, + .local = 2, + .init = w83977f_init, + .close = w83977f_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t w83977ef_370_device = { - "Winbond W83977TF Super I/O (Port 370h)", - "w83977ef_370", - 0, - 0x42, - w83977f_init, w83977f_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Winbond W83977TF Super I/O (Port 370h)", + .internal_name = "w83977ef_370", + .flags = 0, + .local = 0x42, + .init = w83977f_init, + .close = w83977f_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sound/CMakeLists.txt b/src/sound/CMakeLists.txt index d47cec8d6..db700670d 100644 --- a/src/sound/CMakeLists.txt +++ b/src/sound/CMakeLists.txt @@ -14,7 +14,7 @@ # add_library(snd OBJECT sound.c snd_opl.c snd_opl_nuked.c snd_resid.cc - midi.c midi_rtmidi.cpp snd_speaker.c snd_pssj.c snd_lpt_dac.c snd_ac97_codec.c snd_ac97_via.c + midi.c snd_speaker.c snd_pssj.c snd_lpt_dac.c snd_ac97_codec.c snd_ac97_via.c snd_lpt_dss.c snd_ps1.c snd_adlib.c snd_adlibgold.c snd_ad1848.c snd_audiopci.c snd_azt2316a.c snd_cms.c snd_cmi8x38.c snd_cs423x.c snd_gus.c snd_sb.c snd_sb_dsp.c snd_emu8k.c snd_mpu401.c snd_sn76489.c snd_ssi2001.c snd_wss.c snd_ym7128.c) @@ -62,6 +62,25 @@ else() endif() endif() +if(RTMIDI) + if(VCPKG_TOOLCHAIN) + # vcpkg includes a config file for rtmidi + find_package(RtMidi REQUIRED) + target_link_libraries(86Box RtMidi::rtmidi) + else() + find_package(PkgConfig REQUIRED) + pkg_check_modules(RTMIDI REQUIRED IMPORTED_TARGET rtmidi) + target_link_libraries(86Box PkgConfig::RTMIDI) + + if(WIN32) + target_link_libraries(PkgConfig::RTMIDI INTERFACE winmm) + endif() + endif() + + target_compile_definitions(snd PRIVATE USE_RTMIDI) + target_sources(snd PRIVATE midi_rtmidi.cpp) +endif() + if(FLUIDSYNTH) target_compile_definitions(snd PRIVATE USE_FLUIDSYNTH) target_sources(snd PRIVATE midi_fluidsynth.c) diff --git a/src/sound/midi.c b/src/sound/midi.c index e225a1301..ae5cdc456 100644 --- a/src/sound/midi.c +++ b/src/sound/midi.c @@ -31,12 +31,12 @@ #include <86box/midi.h> #include <86box/plat.h> -int midi_device_current = 0; -static int midi_device_last = 0; -int midi_input_device_current = 0; -static int midi_input_device_last = 0; +int midi_output_device_current = 0; +static int midi_output_device_last = 0; +int midi_input_device_current = 0; +static int midi_input_device_last = 0; -midi_t *midi = NULL, *midi_in = NULL; +midi_t *midi_out = NULL, *midi_in = NULL; midi_in_handler_t *mih_first = NULL, *mih_last = NULL, *mih_cur = NULL; @@ -69,61 +69,65 @@ uint8_t MIDI_evt_len[256] = { typedef struct { const device_t *device; -} MIDI_DEVICE, MIDI_IN_DEVICE; +} MIDI_OUT_DEVICE, MIDI_IN_DEVICE; -static const device_t midi_none_device = { - "None", - "none", - 0, - 0, - NULL, - NULL, - NULL, - { NULL }, - NULL, - NULL, - NULL +static const device_t midi_out_none_device = { + .name = "None", + .internal_name = "none", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; -static const MIDI_DEVICE devices[] = { +static const MIDI_OUT_DEVICE devices[] = { // clang-format off - { &midi_none_device }, + { &midi_out_none_device }, #ifdef USE_FLUIDSYNTH - { &fluidsynth_device }, + { &fluidsynth_device }, #endif #ifdef USE_MUNT - { &mt32_device }, - { &cm32l_device }, + { &mt32_device }, + { &cm32l_device }, #endif - { &rtmidi_device }, - { NULL } +#ifdef USE_RTMIDI + { &rtmidi_output_device }, +#endif + { NULL } // clang-format on }; static const device_t midi_in_none_device = { - "None", - "none", - 0, - 0, - NULL, - NULL, - NULL, - { NULL }, - NULL, - NULL, - NULL + .name = "None", + .internal_name = "none", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; static const MIDI_IN_DEVICE midi_in_devices[] = { // clang-format off { &midi_in_none_device }, +#ifdef USE_RTMIDI { &rtmidi_input_device }, +#endif { NULL } // clang-format on }; int -midi_device_available(int card) +midi_out_device_available(int card) { if (devices[card].device) return device_available(devices[card].device); @@ -132,13 +136,13 @@ midi_device_available(int card) } const device_t * -midi_device_getdevice(int card) +midi_out_device_getdevice(int card) { return devices[card].device; } int -midi_device_has_config(int card) +midi_out_device_has_config(int card) { if (!devices[card].device) return 0; @@ -146,13 +150,13 @@ midi_device_has_config(int card) } char * -midi_device_get_internal_name(int card) +midi_out_device_get_internal_name(int card) { return device_get_internal_name(devices[card].device); } int -midi_device_get_from_internal_name(char *s) +midi_out_device_get_from_internal_name(char *s) { int c = 0; @@ -166,20 +170,20 @@ midi_device_get_from_internal_name(char *s) } void -midi_device_init() +midi_out_device_init() { - if (devices[midi_device_current].device) - device_add(devices[midi_device_current].device); - midi_device_last = midi_device_current; + if (devices[midi_output_device_current].device) + device_add(devices[midi_output_device_current].device); + midi_output_device_last = midi_output_device_current; } void -midi_init(midi_device_t *device) +midi_out_init(midi_device_t *device) { - midi = (midi_t *) malloc(sizeof(midi_t)); - memset(midi, 0, sizeof(midi_t)); + midi_out = (midi_t *) malloc(sizeof(midi_t)); + memset(midi_out, 0, sizeof(midi_t)); - midi->m_out_device = device; + midi_out->m_out_device = device; } void @@ -192,16 +196,16 @@ midi_in_init(midi_device_t *device, midi_t **mididev) } void -midi_close(void) +midi_out_close(void) { - if (midi && midi->m_out_device) { - free(midi->m_out_device); - midi->m_out_device = NULL; + if (midi_out && midi_out->m_out_device) { + free(midi_out->m_out_device); + midi_out->m_out_device = NULL; } - if (midi) { - free(midi); - midi = NULL; + if (midi_out) { + free(midi_out); + midi_out = NULL; } } @@ -222,22 +226,22 @@ midi_in_close(void) void midi_poll(void) { - if (midi && midi->m_out_device && midi->m_out_device->poll) - midi->m_out_device->poll(); + if (midi_out && midi_out->m_out_device && midi_out->m_out_device->poll) + midi_out->m_out_device->poll(); } void play_msg(uint8_t *msg) { - if (midi->m_out_device->play_msg) - midi->m_out_device->play_msg(msg); + if (midi_out->m_out_device->play_msg) + midi_out->m_out_device->play_msg(msg); } void play_sysex(uint8_t *sysex, unsigned int len) { - if (midi->m_out_device->play_sysex) - midi->m_out_device->play_sysex(sysex, len); + if (midi_out->m_out_device->play_sysex) + midi_out->m_out_device->play_sysex(sysex, len); } int @@ -320,69 +324,69 @@ midi_raw_out_byte(uint8_t val) { uint32_t passed_ticks; - if (!midi || !midi->m_out_device) + if (!midi_out || !midi_out->m_out_device) return; - if ((midi->m_out_device->write && midi->m_out_device->write(val))) + if ((midi_out->m_out_device->write && midi_out->m_out_device->write(val))) return; - if (midi->midi_sysex_start) { - passed_ticks = plat_get_ticks() - midi->midi_sysex_start; - if (passed_ticks < midi->midi_sysex_delay) - plat_delay_ms(midi->midi_sysex_delay - passed_ticks); + if (midi_out->midi_sysex_start) { + passed_ticks = plat_get_ticks() - midi_out->midi_sysex_start; + if (passed_ticks < midi_out->midi_sysex_delay) + plat_delay_ms(midi_out->midi_sysex_delay - passed_ticks); } /* Test for a realtime MIDI message */ if (val >= 0xf8) { - midi->midi_rt_buf[0] = val; - play_msg(midi->midi_rt_buf); + midi_out->midi_rt_buf[0] = val; + play_msg(midi_out->midi_rt_buf); return; } /* Test for a active sysex transfer */ - if (midi->midi_status == 0xf0) { + if (midi_out->midi_status == 0xf0) { if (!(val & 0x80)) { - if (midi->midi_pos < (SYSEX_SIZE - 1)) - midi->midi_sysex_data[midi->midi_pos++] = val; + if (midi_out->midi_pos < (SYSEX_SIZE - 1)) + midi_out->midi_sysex_data[midi_out->midi_pos++] = val; return; } else { - midi->midi_sysex_data[midi->midi_pos++] = 0xf7; + midi_out->midi_sysex_data[midi_out->midi_pos++] = 0xf7; - if ((midi->midi_sysex_start) && (midi->midi_pos >= 4) && (midi->midi_pos <= 9) && (midi->midi_sysex_data[1] == 0x41) && (midi->midi_sysex_data[3] == 0x16)) { + if ((midi_out->midi_sysex_start) && (midi_out->midi_pos >= 4) && (midi_out->midi_pos <= 9) && (midi_out->midi_sysex_data[1] == 0x41) && (midi_out->midi_sysex_data[3] == 0x16)) { /* pclog("MIDI: Skipping invalid MT-32 SysEx MIDI message\n"); */ } else { - play_sysex(midi->midi_sysex_data, midi->midi_pos); - if (midi->midi_sysex_start) { - if (midi->midi_sysex_data[5] == 0x7f) - midi->midi_sysex_delay = 290; /* All parameters reset */ - else if ((midi->midi_sysex_data[5] == 0x10) && (midi->midi_sysex_data[6] == 0x00) && (midi->midi_sysex_data[7] == 0x04)) - midi->midi_sysex_delay = 145; /* Viking Child */ - else if ((midi->midi_sysex_data[5] == 0x10) && (midi->midi_sysex_data[6] == 0x00) && (midi->midi_sysex_data[7] == 0x01)) - midi->midi_sysex_delay = 30; /* Dark Sun 1 */ + play_sysex(midi_out->midi_sysex_data, midi_out->midi_pos); + if (midi_out->midi_sysex_start) { + if (midi_out->midi_sysex_data[5] == 0x7f) + midi_out->midi_sysex_delay = 290; /* All parameters reset */ + else if ((midi_out->midi_sysex_data[5] == 0x10) && (midi_out->midi_sysex_data[6] == 0x00) && (midi_out->midi_sysex_data[7] == 0x04)) + midi_out->midi_sysex_delay = 145; /* Viking Child */ + else if ((midi_out->midi_sysex_data[5] == 0x10) && (midi_out->midi_sysex_data[6] == 0x00) && (midi_out->midi_sysex_data[7] == 0x01)) + midi_out->midi_sysex_delay = 30; /* Dark Sun 1 */ else - midi->midi_sysex_delay = (unsigned int) (((float) (midi->midi_pos) * 1.25f) * 1000.0f / 3125.0f) + 2; + midi_out->midi_sysex_delay = (unsigned int) (((float) (midi_out->midi_pos) * 1.25f) * 1000.0f / 3125.0f) + 2; - midi->midi_sysex_start = plat_get_ticks(); + midi_out->midi_sysex_start = plat_get_ticks(); } } } } if (val & 0x80) { - midi->midi_status = val; - midi->midi_cmd_pos = 0; - midi->midi_cmd_len = MIDI_evt_len[val]; - if (midi->midi_status == 0xf0) { - midi->midi_sysex_data[0] = 0xf0; - midi->midi_pos = 1; + midi_out->midi_status = val; + midi_out->midi_cmd_pos = 0; + midi_out->midi_cmd_len = MIDI_evt_len[val]; + if (midi_out->midi_status == 0xf0) { + midi_out->midi_sysex_data[0] = 0xf0; + midi_out->midi_pos = 1; } } - if (midi->midi_cmd_len) { - midi->midi_cmd_buf[midi->midi_cmd_pos++] = val; - if (midi->midi_cmd_pos >= midi->midi_cmd_len) { - play_msg(midi->midi_cmd_buf); - midi->midi_cmd_pos = 1; + if (midi_out->midi_cmd_len) { + midi_out->midi_cmd_buf[midi_out->midi_cmd_pos++] = val; + if (midi_out->midi_cmd_pos >= midi_out->midi_cmd_len) { + play_msg(midi_out->midi_cmd_buf); + midi_out->midi_cmd_pos = 1; } } } @@ -390,13 +394,13 @@ midi_raw_out_byte(uint8_t val) void midi_clear_buffer(void) { - if (!midi) + if (!midi_out) return; - midi->midi_pos = 0; - midi->midi_status = 0x00; - midi->midi_cmd_pos = 0; - midi->midi_cmd_len = 0; + midi_out->midi_pos = 0; + midi_out->midi_status = 0x00; + midi_out->midi_cmd_pos = 0; + midi_out->midi_cmd_len = 0; } void diff --git a/src/sound/midi_fluidsynth.c b/src/sound/midi_fluidsynth.c index 52d21ac47..23635ee1d 100644 --- a/src/sound/midi_fluidsynth.c +++ b/src/sound/midi_fluidsynth.c @@ -317,7 +317,7 @@ fluidsynth_init(const device_t *info) dev->play_sysex = fluidsynth_sysex; dev->poll = fluidsynth_poll; - midi_init(dev); + midi_out_init(dev); data->on = 1; @@ -540,17 +540,17 @@ static const device_config_t fluidsynth_config[] = { }; const device_t fluidsynth_device = { - "FluidSynth", - "fluidsynth", - 0, - 0, - fluidsynth_init, - fluidsynth_close, - NULL, - { fluidsynth_available }, - NULL, - NULL, - fluidsynth_config + .name = "FluidSynth", + .internal_name = "fluidsynth", + .flags = 0, + .local = 0, + .init = fluidsynth_init, + .close = fluidsynth_close, + .reset = NULL, + { .available = fluidsynth_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = fluidsynth_config }; #endif /*USE_FLUIDSYNTH*/ diff --git a/src/sound/midi_mt32.c b/src/sound/midi_mt32.c index c0a0bc81a..5b19aa018 100644 --- a/src/sound/midi_mt32.c +++ b/src/sound/midi_mt32.c @@ -272,7 +272,7 @@ mt32emu_init(char *control_rom, char *pcm_rom) dev->play_sysex = mt32_sysex; dev->poll = mt32_poll; - midi_init(dev); + midi_out_init(dev); mt32_on = 1; @@ -375,29 +375,29 @@ static const device_config_t mt32_config[] = { }; const device_t mt32_device = { - "Roland MT-32 Emulation", - "mt32", - 0, - 0, - mt32_init, - mt32_close, - NULL, - { mt32_available }, - NULL, - NULL, - mt32_config + .name = "Roland MT-32 Emulation", + .internal_name = "mt32", + .flags = 0, + .local = 0, + .init = mt32_init, + .close = mt32_close, + .reset = NULL, + { .available = mt32_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = mt32_config }; const device_t cm32l_device = { - "Roland CM-32L Emulation", - "cm32l", - 0, - 0, - cm32l_init, - mt32_close, - NULL, - { cm32l_available }, - NULL, - NULL, - mt32_config + .name = "Roland CM-32L Emulation", + .internal_name = "cm32l", + .flags = 0, + .local = 0, + .init = cm32l_init, + .close = mt32_close, + .reset = NULL, + { .available = cm32l_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = mt32_config }; diff --git a/src/sound/midi_rtmidi.cpp b/src/sound/midi_rtmidi.cpp index e4c292ee9..5eaf5a964 100644 --- a/src/sound/midi_rtmidi.cpp +++ b/src/sound/midi_rtmidi.cpp @@ -13,6 +13,7 @@ * Copyright 2021 Cacodemon345. * Copyright 2021 Miran Grca. */ + #if defined __has_include # if __has_include () # include @@ -35,10 +36,9 @@ extern "C" #include <86box/midi_rtmidi.h> #include <86box/config.h> - -static RtMidiOut * midiout = nullptr; -static RtMidiIn * midiin = nullptr; -static int midi_out_id = 0, midi_in_id = 0; +static RtMidiOut * midiout = nullptr; +static RtMidiIn * midiin = nullptr; +static int midi_out_id = 0, midi_in_id = 0; static const int midi_lengths[8] = {3, 3, 3, 3, 2, 2, 3, 1}; @@ -66,7 +66,7 @@ rtmidi_play_sysex(uint8_t *sysex, unsigned int len) void* -rtmidi_init(const device_t *info) +rtmidi_output_init(const device_t *info) { midi_device_t* dev = (midi_device_t*)malloc(sizeof(midi_device_t)); memset(dev, 0, sizeof(midi_device_t)); @@ -99,14 +99,14 @@ rtmidi_init(const device_t *info) } } - midi_init(dev); + midi_out_init(dev); return dev; } void -rtmidi_close(void *p) +rtmidi_output_close(void *p) { if (!midiout) return; @@ -116,12 +116,12 @@ rtmidi_close(void *p) delete midiout; midiout = nullptr; - midi_close(); + midi_out_close(); } int -rtmidi_get_num_devs(void) +rtmidi_out_get_num_devs(void) { if (!midiout) { try { @@ -136,7 +136,7 @@ rtmidi_get_num_devs(void) void -rtmidi_get_dev_name(int num, char *s) +rtmidi_out_get_dev_name(int num, char *s) { strcpy(s, midiout->getPortName(num).c_str()); } @@ -207,7 +207,7 @@ rtmidi_input_close(void* p) delete midiin; midiin = nullptr; - midi_close(); + midi_out_close(); } @@ -232,8 +232,7 @@ rtmidi_in_get_dev_name(int num, char *s) strcpy(s, midiin->getPortName(num).c_str()); } -static const device_config_t system_midi_config[] = -{ +static const device_config_t system_midi_config[] = { { "midi", "MIDI out device", CONFIG_MIDI_OUT, "", 0 }, @@ -242,8 +241,7 @@ static const device_config_t system_midi_config[] = } }; -static const device_config_t midi_input_config[] = -{ +static const device_config_t midi_input_config[] = { { "midi_input", "MIDI in device", CONFIG_MIDI_IN, "", 0 }, @@ -261,15 +259,14 @@ static const device_config_t midi_input_config[] = } }; -const device_t rtmidi_device = -{ +const device_t rtmidi_output_device = { SYSTEM_MIDI_NAME, SYSTEM_MIDI_INTERNAL_NAME, 0, 0, - rtmidi_init, - rtmidi_close, + rtmidi_output_init, + rtmidi_output_close, NULL, - { rtmidi_get_num_devs }, + { rtmidi_out_get_num_devs }, NULL, NULL, system_midi_config diff --git a/src/sound/openal.c b/src/sound/openal.c index a570e070d..5b1128cb6 100644 --- a/src/sound/openal.c +++ b/src/sound/openal.c @@ -124,7 +124,7 @@ inital(void) alutInit(0, 0); atexit(closeal); - mdn = midi_device_get_internal_name(midi_device_current); + mdn = midi_out_device_get_internal_name(midi_output_device_current); if (strcmp(mdn, "none") && strcmp(mdn, SYSTEM_MIDI_INTERNAL_NAME)) init_midi = 1; /* If the device is neither none, nor system MIDI, initialize the MIDI buffer and source, otherwise, do not. */ diff --git a/src/sound/snd_ac97_codec.c b/src/sound/snd_ac97_codec.c index d59db5656..348989180 100644 --- a/src/sound/snd_ac97_codec.c +++ b/src/sound/snd_ac97_codec.c @@ -641,113 +641,113 @@ ac97_codec_get(int model) } const device_t ad1881_device = { - "Analog Devices AD1881", - "ad1881", - DEVICE_AC97, - AC97_CODEC_AD1881, - ac97_codec_init, - ac97_codec_close, - ac97_codec_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "Analog Devices AD1881", + .internal_name = "ad1881", + .flags = DEVICE_AC97, + .local = AC97_CODEC_AD1881, + .init = ac97_codec_init, + .close = ac97_codec_close, + .reset = ac97_codec_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t ak4540_device = { - "Asahi Kasei AK4540", - "ak4540", - DEVICE_AC97, - AC97_CODEC_AK4540, - ac97_codec_init, - ac97_codec_close, - ac97_codec_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "Asahi Kasei AK4540", + .internal_name = "ak4540", + .flags = DEVICE_AC97, + .local = AC97_CODEC_AK4540, + .init = ac97_codec_init, + .close = ac97_codec_close, + .reset = ac97_codec_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t alc100_device = { - "Avance Logic ALC100", - "alc100", - DEVICE_AC97, - AC97_CODEC_ALC100, - ac97_codec_init, - ac97_codec_close, - ac97_codec_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "Avance Logic ALC100", + .internal_name = "alc100", + .flags = DEVICE_AC97, + .local = AC97_CODEC_ALC100, + .init = ac97_codec_init, + .close = ac97_codec_close, + .reset = ac97_codec_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t cs4297_device = { - "Crystal CS4297", - "cs4297", - DEVICE_AC97, - AC97_CODEC_CS4297, - ac97_codec_init, - ac97_codec_close, - ac97_codec_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "Crystal CS4297", + .internal_name = "cs4297", + .flags = DEVICE_AC97, + .local = AC97_CODEC_CS4297, + .init = ac97_codec_init, + .close = ac97_codec_close, + .reset = ac97_codec_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t cs4297a_device = { - "Crystal CS4297A", - "cs4297a", - DEVICE_AC97, - AC97_CODEC_CS4297A, - ac97_codec_init, - ac97_codec_close, - ac97_codec_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "Crystal CS4297A", + .internal_name = "cs4297a", + .flags = DEVICE_AC97, + .local = AC97_CODEC_CS4297A, + .init = ac97_codec_init, + .close = ac97_codec_close, + .reset = ac97_codec_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t stac9708_device = { - "SigmaTel STAC9708", - "stac9708", - DEVICE_AC97, - AC97_CODEC_STAC9708, - ac97_codec_init, - ac97_codec_close, - ac97_codec_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "SigmaTel STAC9708", + .internal_name = "stac9708", + .flags = DEVICE_AC97, + .local = AC97_CODEC_STAC9708, + .init = ac97_codec_init, + .close = ac97_codec_close, + .reset = ac97_codec_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t stac9721_device = { - "SigmaTel STAC9721", - "stac9721", - DEVICE_AC97, - AC97_CODEC_STAC9721, - ac97_codec_init, - ac97_codec_close, - ac97_codec_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "SigmaTel STAC9721", + .internal_name = "stac9721", + .flags = DEVICE_AC97, + .local = AC97_CODEC_STAC9721, + .init = ac97_codec_init, + .close = ac97_codec_close, + .reset = ac97_codec_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t wm9701a_device = { - "Wolfson WM9701A", - "wm9701a", - DEVICE_AC97, - AC97_CODEC_WM9701A, - ac97_codec_init, - ac97_codec_close, - ac97_codec_reset, - { NULL }, - NULL, - NULL, - NULL + .name = "Wolfson WM9701A", + .internal_name = "wm9701a", + .flags = DEVICE_AC97, + .local = AC97_CODEC_WM9701A, + .init = ac97_codec_init, + .close = ac97_codec_close, + .reset = ac97_codec_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sound/snd_ac97_via.c b/src/sound/snd_ac97_via.c index 53afbdf25..b3dbd30d8 100644 --- a/src/sound/snd_ac97_via.c +++ b/src/sound/snd_ac97_via.c @@ -804,15 +804,15 @@ ac97_via_close(void *priv) } const device_t ac97_via_device = { - "VIA VT82C686 Integrated AC97 Controller", - "ac97_via", - DEVICE_PCI, - 0, - ac97_via_init, - ac97_via_close, - NULL, - { NULL }, - ac97_via_speed_changed, - NULL, - NULL + .name = "VIA VT82C686 Integrated AC97 Controller", + .internal_name = "ac97_via", + .flags = DEVICE_PCI, + .local = 0, + .init = ac97_via_init, + .close = ac97_via_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = ac97_via_speed_changed, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sound/snd_adlib.c b/src/sound/snd_adlib.c index f4326f87b..1592131d0 100644 --- a/src/sound/snd_adlib.c +++ b/src/sound/snd_adlib.c @@ -142,29 +142,29 @@ adlib_close(void *p) } const device_t adlib_device = { - "AdLib", - "adlib", - DEVICE_ISA, - 0, - adlib_init, - adlib_close, - NULL, - { NULL }, - NULL, - NULL, - NULL + .name = "AdLib", + .internal_name = "adlib", + .flags = DEVICE_ISA, + .local = 0, + .init = adlib_init, + .close = adlib_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t adlib_mca_device = { - "AdLib (MCA)", - "adlib_mca", - DEVICE_MCA, - 0, - adlib_init, - adlib_close, - NULL, - { NULL }, - NULL, - NULL, - NULL + .name = "AdLib (MCA)", + .internal_name = "adlib_mca", + .flags = DEVICE_MCA, + .local = 0, + .init = adlib_init, + .close = adlib_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sound/snd_adlibgold.c b/src/sound/snd_adlibgold.c index fc169d5e0..2a82b3b85 100644 --- a/src/sound/snd_adlibgold.c +++ b/src/sound/snd_adlibgold.c @@ -990,15 +990,15 @@ static const device_config_t adgold_config[] = { }; const device_t adgold_device = { - "AdLib Gold", - "adlibgold", - DEVICE_ISA, - 0, - adgold_init, - adgold_close, - NULL, - { NULL }, - NULL, - NULL, - adgold_config + .name = "AdLib Gold", + .internal_name = "adlibgold", + .flags = DEVICE_ISA, + .local = 0, + .init = adgold_init, + .close = adgold_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = adgold_config }; diff --git a/src/sound/snd_audiopci.c b/src/sound/snd_audiopci.c index 03e882db8..5a64d3579 100644 --- a/src/sound/snd_audiopci.c +++ b/src/sound/snd_audiopci.c @@ -2099,29 +2099,29 @@ static const device_config_t es1371_onboard_config[] = { }; const device_t es1371_device = { - "Ensoniq AudioPCI (ES1371)", - "es1371", - DEVICE_PCI, - 0, - es1371_init, - es1371_close, - es1371_reset, - { NULL }, - es1371_speed_changed, - NULL, - es1371_config + .name = "Ensoniq AudioPCI (ES1371)", + .internal_name = "es1371", + .flags = DEVICE_PCI, + .local = 0, + .init = es1371_init, + .close = es1371_close, + .reset = es1371_reset, + { .available = NULL }, + .speed_changed = es1371_speed_changed, + .force_redraw = NULL, + .config = es1371_config }; const device_t es1371_onboard_device = { - "Ensoniq AudioPCI (ES1371) (On-Board)", - "es1371_onboard", - DEVICE_PCI, - 1, - es1371_init, - es1371_close, - es1371_reset, - { NULL }, - es1371_speed_changed, - NULL, - es1371_onboard_config + .name = "Ensoniq AudioPCI (ES1371) (On-Board)", + .internal_name = "es1371_onboard", + .flags = DEVICE_PCI, + .local = 1, + .init = es1371_init, + .close = es1371_close, + .reset = es1371_reset, + { .available = NULL }, + .speed_changed = es1371_speed_changed, + .force_redraw = NULL, + .config = es1371_onboard_config }; diff --git a/src/sound/snd_azt2316a.c b/src/sound/snd_azt2316a.c index 6a842e029..ede159219 100644 --- a/src/sound/snd_azt2316a.c +++ b/src/sound/snd_azt2316a.c @@ -1425,29 +1425,29 @@ static const device_config_t azt2316a_config[] = { }; const device_t azt2316a_device = { - "Aztech Sound Galaxy Pro 16 AB (Washington)", - "azt2316a", - DEVICE_ISA | DEVICE_AT, - SB_SUBTYPE_CLONE_AZT2316A_0X11, - azt_init, - azt_close, - NULL, - { NULL }, - azt_speed_changed, - NULL, - azt2316a_config + .name = "Aztech Sound Galaxy Pro 16 AB (Washington)", + .internal_name = "azt2316a", + .flags = DEVICE_ISA | DEVICE_AT, + .local = SB_SUBTYPE_CLONE_AZT2316A_0X11, + .init = azt_init, + .close = azt_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = azt_speed_changed, + .force_redraw = NULL, + .config = azt2316a_config }; const device_t azt1605_device = { - "Aztech Sound Galaxy Nova 16 Extra (Clinton)", - "azt1605", - DEVICE_ISA | DEVICE_AT, - SB_SUBTYPE_CLONE_AZT1605_0X0C, - azt_init, - azt_close, - NULL, - { NULL }, - azt_speed_changed, - NULL, - azt1605_config + .name = "Aztech Sound Galaxy Nova 16 Extra (Clinton)", + .internal_name = "azt1605", + .flags = DEVICE_ISA | DEVICE_AT, + .local = SB_SUBTYPE_CLONE_AZT1605_0X0C, + .init = azt_init, + .close = azt_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = azt_speed_changed, + .force_redraw = NULL, + .config = azt1605_config }; diff --git a/src/sound/snd_cms.c b/src/sound/snd_cms.c index 308af6351..2be54f4fc 100644 --- a/src/sound/snd_cms.c +++ b/src/sound/snd_cms.c @@ -207,15 +207,15 @@ static const device_config_t cms_config[] = { }; const device_t cms_device = { - "Creative Music System / Game Blaster", - "cms", - DEVICE_ISA, - 0, - cms_init, - cms_close, - NULL, - { NULL }, - NULL, - NULL, - cms_config + .name = "Creative Music System / Game Blaster", + .internal_name = "cms", + .flags = DEVICE_ISA, + .local = 0, + .init = cms_init, + .close = cms_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = cms_config }; diff --git a/src/sound/snd_cs423x.c b/src/sound/snd_cs423x.c index 6d4a5ff2e..5a4a8108e 100644 --- a/src/sound/snd_cs423x.c +++ b/src/sound/snd_cs423x.c @@ -827,71 +827,71 @@ cs423x_speed_changed(void *priv) } const device_t cs4235_device = { - "Crystal CS4235", - "cs4235", - DEVICE_ISA | DEVICE_AT, - CRYSTAL_CS4235, - cs423x_init, - cs423x_close, - cs423x_reset, - { NULL }, - cs423x_speed_changed, - NULL, - NULL + .name = "Crystal CS4235", + .internal_name = "cs4235", + .flags = DEVICE_ISA | DEVICE_AT, + .local = CRYSTAL_CS4235, + .init = cs423x_init, + .close = cs423x_close, + .reset = cs423x_reset, + { .available = NULL }, + .speed_changed = cs423x_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t cs4235_onboard_device = { - "Crystal CS4235 (On-Board)", - "cs4235_onboard", - DEVICE_ISA | DEVICE_AT, - CRYSTAL_CS4235 | CRYSTAL_NOEEPROM, - cs423x_init, - cs423x_close, - cs423x_reset, - { NULL }, - cs423x_speed_changed, - NULL, - NULL + .name = "Crystal CS4235 (On-Board)", + .internal_name = "cs4235_onboard", + .flags = DEVICE_ISA | DEVICE_AT, + .local = CRYSTAL_CS4235 | CRYSTAL_NOEEPROM, + .init = cs423x_init, + .close = cs423x_close, + .reset = cs423x_reset, + { .available = NULL }, + .speed_changed = cs423x_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t cs4236b_device = { - "Crystal CS4236B", - "cs4236b", - DEVICE_ISA | DEVICE_AT, - CRYSTAL_CS4236B, - cs423x_init, - cs423x_close, - cs423x_reset, - { NULL }, - cs423x_speed_changed, - NULL, - NULL + .name = "Crystal CS4236B", + .internal_name = "cs4236b", + .flags = DEVICE_ISA | DEVICE_AT, + .local = CRYSTAL_CS4236B, + .init = cs423x_init, + .close = cs423x_close, + .reset = cs423x_reset, + { .available = NULL }, + .speed_changed = cs423x_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t cs4237b_device = { - "Crystal CS4237B", - "cs4237b", - DEVICE_ISA | DEVICE_AT, - CRYSTAL_CS4237B, - cs423x_init, - cs423x_close, - cs423x_reset, - { NULL }, - cs423x_speed_changed, - NULL, - NULL + .name = "Crystal CS4237B", + .internal_name = "cs4237b", + .flags = DEVICE_ISA | DEVICE_AT, + .local = CRYSTAL_CS4237B, + .init = cs423x_init, + .close = cs423x_close, + .reset = cs423x_reset, + { .available = NULL }, + .speed_changed = cs423x_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t cs4238b_device = { - "Crystal CS4238B", - "cs4238b", - DEVICE_ISA | DEVICE_AT, - CRYSTAL_CS4238B, - cs423x_init, - cs423x_close, - cs423x_reset, - { NULL }, - cs423x_speed_changed, - NULL, - NULL + .name = "Crystal CS4238B", + .internal_name = "cs4238b", + .flags = DEVICE_ISA | DEVICE_AT, + .local = CRYSTAL_CS4238B, + .init = cs423x_init, + .close = cs423x_close, + .reset = cs423x_reset, + { .available = NULL }, + .speed_changed = cs423x_speed_changed, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sound/snd_gus.c b/src/sound/snd_gus.c index 95c006612..a70798555 100644 --- a/src/sound/snd_gus.c +++ b/src/sound/snd_gus.c @@ -1239,15 +1239,15 @@ static const device_config_t gus_config[] = { }; const device_t gus_device = { - "Gravis UltraSound", - "gus", - DEVICE_ISA | DEVICE_AT, - 0, - gus_init, - gus_close, - NULL, - { NULL }, - gus_speed_changed, - NULL, - gus_config + .name = "Gravis UltraSound", + .internal_name = "gus", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 0, + .init = gus_init, + .close = gus_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = gus_speed_changed, + .force_redraw = NULL, + .config = gus_config }; diff --git a/src/sound/snd_lpt_dac.c b/src/sound/snd_lpt_dac.c index e4869f397..70e02d847 100644 --- a/src/sound/snd_lpt_dac.c +++ b/src/sound/snd_lpt_dac.c @@ -109,23 +109,25 @@ dac_close(void *p) } const lpt_device_t lpt_dac_device = { - "LPT DAC / Covox Speech Thing", - dac_init, - dac_close, - dac_write_data, - dac_write_ctrl, - NULL, - dac_read_status, - NULL + .name = "LPT DAC / Covox Speech Thing", + .internal_name = "lpt_dac", + .init = dac_init, + .close = dac_close, + .write_data = dac_write_data, + .write_ctrl = dac_write_ctrl, + .read_data = NULL, + .read_status = dac_read_status, + .read_ctrl = NULL }; const lpt_device_t lpt_dac_stereo_device = { - "Stereo LPT DAC", - dac_stereo_init, - dac_close, - dac_write_data, - dac_write_ctrl, - NULL, - dac_read_status, - NULL + .name = "Stereo LPT DAC", + .internal_name = "lpt_dac_stereo", + .init = dac_stereo_init, + .close = dac_close, + .write_data = dac_write_data, + .write_ctrl = dac_write_ctrl, + .read_data = NULL, + .read_status = dac_read_status, + .read_ctrl = NULL }; diff --git a/src/sound/snd_lpt_dss.c b/src/sound/snd_lpt_dss.c index 131349141..a855425b2 100644 --- a/src/sound/snd_lpt_dss.c +++ b/src/sound/snd_lpt_dss.c @@ -132,12 +132,13 @@ dss_close(void *p) } const lpt_device_t dss_device = { - "Disney Sound Source", - dss_init, - dss_close, - dss_write_data, - dss_write_ctrl, - NULL, - dss_read_status, - NULL + .name = "Disney Sound Source", + .internal_name = "dss", + .init = dss_init, + .close = dss_close, + .write_data = dss_write_data, + .write_ctrl = dss_write_ctrl, + .read_data = NULL, + .read_status = dss_read_status, + .read_ctrl = NULL }; diff --git a/src/sound/snd_mpu401.c b/src/sound/snd_mpu401.c index 0849d702e..7b4a12aa3 100644 --- a/src/sound/snd_mpu401.c +++ b/src/sound/snd_mpu401.c @@ -1857,29 +1857,29 @@ static const device_config_t mpu401_standalone_mca_config[] = { }; const device_t mpu401_device = { - "Roland MPU-IPC-T", - "mpu401", - DEVICE_ISA, - 0, - mpu401_standalone_init, - mpu401_standalone_close, - NULL, - { NULL }, - NULL, - NULL, - mpu401_standalone_config + .name = "Roland MPU-IPC-T", + .internal_name = "mpu401", + .flags = DEVICE_ISA, + .local = 0, + .init = mpu401_standalone_init, + .close = mpu401_standalone_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = mpu401_standalone_config }; const device_t mpu401_mca_device = { - "Roland MPU-IMC", - "mpu401_mca", - DEVICE_MCA, - 0, - mpu401_standalone_init, - mpu401_standalone_close, - NULL, - { NULL }, - NULL, - NULL, - mpu401_standalone_mca_config + .name = "Roland MPU-IMC", + .internal_name = "mpu401_mca", + .flags = DEVICE_MCA, + .local = 0, + .init = mpu401_standalone_init, + .close = mpu401_standalone_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = mpu401_standalone_mca_config }; diff --git a/src/sound/snd_pas16.c b/src/sound/snd_pas16.c index 12afc3740..33bd51b34 100644 --- a/src/sound/snd_pas16.c +++ b/src/sound/snd_pas16.c @@ -743,15 +743,15 @@ pas16_close(void *p) } const device_t pas16_device = { - "Pro Audio Spectrum 16", - "pas16", - DEVICE_ISA | DEVICE_NOT_WORKING, - 0, - pas16_init, - pas16_close, - NULL, - { NULL }, - NULL, - NULL, - NULL + .name = "Pro Audio Spectrum 16", + .internal_name = "pas16", + .flags = DEVICE_ISA | DEVICE_NOT_WORKING, + .local = 0, + .init = pas16_init, + .close = pas16_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sound/snd_ps1.c b/src/sound/snd_ps1.c index ff778dfbf..308d01589 100644 --- a/src/sound/snd_ps1.c +++ b/src/sound/snd_ps1.c @@ -187,15 +187,15 @@ ps1snd_close(void *priv) } const device_t ps1snd_device = { - "IBM PS/1 Audio Card", - "ps1snd", - 0, - 0, - ps1snd_init, - ps1snd_close, - NULL, - { NULL }, - NULL, - NULL, - NULL + .name = "IBM PS/1 Audio Card", + .internal_name = "ps1snd", + .flags = 0, + .local = 0, + .init = ps1snd_init, + .close = ps1snd_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sound/snd_pssj.c b/src/sound/snd_pssj.c index 9bf1c47f5..2929baec1 100644 --- a/src/sound/snd_pssj.c +++ b/src/sound/snd_pssj.c @@ -253,43 +253,45 @@ static const device_config_t pssj_isa_config[] = { #endif const device_t pssj_device = { - "Tandy PSSJ", - "pssj", - 0, - 0, - pssj_init, - pssj_close, - NULL, - { NULL }, - NULL, - NULL + .name = "Tandy PSSJ", + .internal_name = "pssj", + .flags = 0, + .local = 0, + .init = pssj_init, + .close = pssj_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t pssj_1e0_device = { - "Tandy PSSJ (port 1e0h)", - "pssj_1e0", - 0, - 0, - pssj_1e0_init, - pssj_close, - NULL, - { NULL }, - NULL, - NULL + .name = "Tandy PSSJ (port 1e0h)", + .internal_name = "pssj_1e0", + .flags = 0, + .local = 0, + .init = pssj_1e0_init, + .close = pssj_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; #if defined(DEV_BRANCH) && defined(USE_TANDY_ISA) const device_t pssj_isa_device = { - "Tandy PSSJ Clone", - "pssj_isa", - DEVICE_ISA, - 0, - pssj_isa_init, - pssj_close, - NULL, - { NULL }, - NULL, - NULL, - pssj_isa_config + .name = "Tandy PSSJ Clone", + .internal_name = "pssj_isa", + .flags = DEVICE_ISA, + .local = 0, + .init = pssj_isa_init, + .close = pssj_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = pssj_isa_config }; #endif diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index a3110b186..2029bdd89 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -2425,143 +2425,143 @@ static const device_config_t sb_awe64_gold_config[] = { // clang-format on const device_t sb_1_device = { - "Sound Blaster v1.0", - "sb", - DEVICE_ISA, - 0, - sb_1_init, - sb_close, - NULL, - { NULL }, - sb_speed_changed, - NULL, - sb_config + .name = "Sound Blaster v1.0", + .internal_name = "sb", + .flags = DEVICE_ISA, + .local = 0, + .init = sb_1_init, + .close = sb_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = sb_config }; const device_t sb_15_device = { - "Sound Blaster v1.5", - "sb1.5", - DEVICE_ISA, - 0, - sb_15_init, - sb_close, - NULL, - { NULL }, - sb_speed_changed, - NULL, - sb15_config + .name = "Sound Blaster v1.5", + .internal_name = "sb1.5", + .flags = DEVICE_ISA, + .local = 0, + .init = sb_15_init, + .close = sb_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = sb15_config }; const device_t sb_mcv_device = { - "Sound Blaster MCV", - "sbmcv", - DEVICE_MCA, - 0, - sb_mcv_init, - sb_close, - NULL, - { NULL }, - sb_speed_changed, - NULL, - sb_mcv_config + .name = "Sound Blaster MCV", + .internal_name = "sbmcv", + .flags = DEVICE_MCA, + .local = 0, + .init = sb_mcv_init, + .close = sb_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = sb_mcv_config }; const device_t sb_2_device = { - "Sound Blaster v2.0", - "sb2.0", - DEVICE_ISA, - 0, - sb_2_init, - sb_close, - NULL, - { NULL }, - sb_speed_changed, - NULL, - sb2_config + .name = "Sound Blaster v2.0", + .internal_name = "sb2.0", + .flags = DEVICE_ISA, + .local = 0, + .init = sb_2_init, + .close = sb_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = sb2_config }; const device_t sb_pro_v1_device = { - "Sound Blaster Pro v1", - "sbprov1", - DEVICE_ISA, - 0, - sb_pro_v1_init, - sb_close, - NULL, - { NULL }, - sb_speed_changed, - NULL, - sb_pro_config + .name = "Sound Blaster Pro v1", + .internal_name = "sbprov1", + .flags = DEVICE_ISA, + .local = 0, + .init = sb_pro_v1_init, + .close = sb_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = sb_pro_config }; const device_t sb_pro_v2_device = { - "Sound Blaster Pro v2", - "sbprov2", - DEVICE_ISA, - 0, - sb_pro_v2_init, - sb_close, - NULL, - { NULL }, - sb_speed_changed, - NULL, - sb_pro_config + .name = "Sound Blaster Pro v2", + .internal_name = "sbprov2", + .flags = DEVICE_ISA, + .local = 0, + .init = sb_pro_v2_init, + .close = sb_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = sb_pro_config }; const device_t sb_pro_mcv_device = { - "Sound Blaster Pro MCV", - "sbpromcv", - DEVICE_MCA, - 0, - sb_pro_mcv_init, - sb_close, - NULL, - { NULL }, - sb_speed_changed, - NULL, - NULL + .name = "Sound Blaster Pro MCV", + .internal_name = "sbpromcv", + .flags = DEVICE_MCA, + .local = 0, + .init = sb_pro_mcv_init, + .close = sb_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t sb_pro_compat_device = { - "Sound Blaster Pro (Compatibility)", - "sbpro_compat", - DEVICE_ISA | DEVICE_AT, - 0, - sb_pro_compat_init, - sb_close, - NULL, - { NULL }, - sb_speed_changed, - NULL, - NULL + .name = "Sound Blaster Pro (Compatibility)", + .internal_name = "sbpro_compat", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 0, + .init = sb_pro_compat_init, + .close = sb_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = NULL }; const device_t sb_16_device = { - "Sound Blaster 16", - "sb16", - DEVICE_ISA | DEVICE_AT, - 0, - sb_16_init, - sb_close, - NULL, - { NULL }, - sb_speed_changed, - NULL, - sb_16_config + .name = "Sound Blaster 16", + .internal_name = "sb16", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 0, + .init = sb_16_init, + .close = sb_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = sb_16_config }; const device_t sb_16_pnp_device = { - "Sound Blaster 16 PnP", - "sb16_pnp", - DEVICE_ISA | DEVICE_AT, - 0, - sb_16_pnp_init, - sb_close, - NULL, - { NULL }, - sb_speed_changed, - NULL, - sb_16_pnp_config + .name = "Sound Blaster 16 PnP", + .internal_name = "sb16_pnp", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 0, + .init = sb_16_pnp_init, + .close = sb_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = sb_16_pnp_config }; const device_t sb_16_compat_device = @@ -2589,85 +2589,85 @@ const device_t sb_16_compat_nompu_device = }; const device_t sb_32_pnp_device = { - "Sound Blaster 32 PnP", - "sb32_pnp", - DEVICE_ISA | DEVICE_AT, - 0, - sb_awe32_pnp_init, - sb_awe32_close, - NULL, - { sb_32_pnp_available }, - sb_speed_changed, - NULL, - sb_32_pnp_config + .name = "Sound Blaster 32 PnP", + .internal_name = "sb32_pnp", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 0, + .init = sb_awe32_pnp_init, + .close = sb_awe32_close, + .reset = NULL, + { .available = sb_32_pnp_available }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = sb_32_pnp_config }; const device_t sb_awe32_device = { - "Sound Blaster AWE32", - "sbawe32", - DEVICE_ISA | DEVICE_AT, - 0, - sb_awe32_init, - sb_awe32_close, - NULL, - { sb_awe32_available }, - sb_speed_changed, - NULL, - sb_awe32_config + .name = "Sound Blaster AWE32", + .internal_name = "sbawe32", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 0, + .init = sb_awe32_init, + .close = sb_awe32_close, + .reset = NULL, + { .available = sb_awe32_available }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = sb_awe32_config }; const device_t sb_awe32_pnp_device = { - "Sound Blaster AWE32 PnP", - "sbawe32_pnp", - DEVICE_ISA | DEVICE_AT, - 1, - sb_awe32_pnp_init, - sb_awe32_close, - NULL, - { sb_awe32_pnp_available }, - sb_speed_changed, - NULL, - sb_awe32_pnp_config + .name = "Sound Blaster AWE32 PnP", + .internal_name = "sbawe32_pnp", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 1, + .init = sb_awe32_pnp_init, + .close = sb_awe32_close, + .reset = NULL, + { .available = sb_awe32_pnp_available }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = sb_awe32_pnp_config }; const device_t sb_awe64_value_device = { - "Sound Blaster AWE64 Value", - "sbawe64_value", - DEVICE_ISA | DEVICE_AT, - 2, - sb_awe32_pnp_init, - sb_awe32_close, - NULL, - { sb_awe64_value_available }, - sb_speed_changed, - NULL, - sb_awe64_value_config + .name = "Sound Blaster AWE64 Value", + .internal_name = "sbawe64_value", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 2, + .init = sb_awe32_pnp_init, + .close = sb_awe32_close, + .reset = NULL, + { .available = sb_awe64_value_available }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = sb_awe64_value_config }; const device_t sb_awe64_device = { - "Sound Blaster AWE64", - "sbawe64", - DEVICE_ISA | DEVICE_AT, - 3, - sb_awe32_pnp_init, - sb_awe32_close, - NULL, - { sb_awe64_available }, - sb_speed_changed, - NULL, - sb_awe64_config + .name = "Sound Blaster AWE64", + .internal_name = "sbawe64", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 3, + .init = sb_awe32_pnp_init, + .close = sb_awe32_close, + .reset = NULL, + { .available = sb_awe64_available }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = sb_awe64_config }; const device_t sb_awe64_gold_device = { - "Sound Blaster AWE64 Gold", - "sbawe64_gold", - DEVICE_ISA | DEVICE_AT, - 4, - sb_awe32_pnp_init, - sb_awe32_close, - NULL, - { sb_awe64_gold_available }, - sb_speed_changed, - NULL, - sb_awe64_gold_config + .name = "Sound Blaster AWE64 Gold", + .internal_name = "sbawe64_gold", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 4, + .init = sb_awe32_pnp_init, + .close = sb_awe32_close, + .reset = NULL, + { .available = sb_awe64_gold_available }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = sb_awe64_gold_config }; diff --git a/src/sound/snd_sn76489.c b/src/sound/snd_sn76489.c index 96b152b18..ad2581b33 100644 --- a/src/sound/snd_sn76489.c +++ b/src/sound/snd_sn76489.c @@ -261,43 +261,45 @@ static const device_config_t tndy_config[] = { #endif const device_t sn76489_device = { - "TI SN74689 PSG", - "sn76489", - 0, - 0, - sn76489_device_init, - sn76489_device_close, - NULL, - { NULL }, - NULL, - NULL + .name = "TI SN74689 PSG", + .internal_name = "sn76489", + .flags = 0, + .local = 0, + .init = sn76489_device_init, + .close = sn76489_device_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t ncr8496_device = { - "NCR8496 PSG", - "ncr8496", - 0, - 0, - ncr8496_device_init, - sn76489_device_close, - NULL, - { NULL }, - NULL, - NULL + .name = "NCR8496 PSG", + .internal_name = "ncr8496", + .flags = 0, + .local = 0, + .init = ncr8496_device_init, + .close = sn76489_device_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; #if defined(DEV_BRANCH) && defined(USE_TANDY_ISA) const device_t tndy_device = { - "TNDY", - "tndy", - DEVICE_ISA, - 0, - tndy_device_init, - sn76489_device_close, - NULL, - { NULL }, - NULL, - NULL, - tndy_config + .name = "TNDY", + .internal_name = "tndy", + .flags = DEVICE_ISA, + .local = 0, + .init = tndy_device_init, + .close = sn76489_device_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = tndy_config }; #endif diff --git a/src/sound/snd_ssi2001.c b/src/sound/snd_ssi2001.c index cfbdf8d49..127968d96 100644 --- a/src/sound/snd_ssi2001.c +++ b/src/sound/snd_ssi2001.c @@ -108,15 +108,15 @@ static const device_config_t ssi2001_config[] = { const device_t ssi2001_device = { - "Innovation SSI-2001", - "ssi2001", - DEVICE_ISA, - 0, - ssi2001_init, - ssi2001_close, - NULL, - { NULL }, - NULL, - NULL, - ssi2001_config + .name = "Innovation SSI-2001", + .internal_name = "ssi2001", + .flags = DEVICE_ISA, + .local = 0, + .init = ssi2001_init, + .close = ssi2001_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ssi2001_config }; diff --git a/src/sound/snd_wss.c b/src/sound/snd_wss.c index 7428d22d6..aafb7cbeb 100644 --- a/src/sound/snd_wss.c +++ b/src/sound/snd_wss.c @@ -243,29 +243,29 @@ static const device_config_t wss_config[] = { }; const device_t wss_device = { - "Windows Sound System", - "wss", - DEVICE_ISA | DEVICE_AT, - 0, - wss_init, - wss_close, - NULL, - { NULL }, - wss_speed_changed, - NULL, - wss_config + .name = "Windows Sound System", + .internal_name = "wss", + .flags = DEVICE_ISA | DEVICE_AT, + .local = 0, + .init = wss_init, + .close = wss_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = wss_speed_changed, + .force_redraw = NULL, + .config = wss_config }; const device_t ncr_business_audio_device = { - "NCR Business Audio", - "ncraudio", - DEVICE_MCA, - 0, - ncr_audio_init, - wss_close, - NULL, - { NULL }, - wss_speed_changed, - NULL, - NULL + .name = "NCR Business Audio", + .internal_name = "ncraudio", + .flags = DEVICE_MCA, + .local = 0, + .init = ncr_audio_init, + .close = wss_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = wss_speed_changed, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/sound/sound.c b/src/sound/sound.c index 2684780df..5a3e978f6 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -483,7 +483,7 @@ sound_reset(void) { sound_realloc_buffers(); - midi_device_init(); + midi_out_device_init(); midi_in_device_init(); inital(); diff --git a/src/sound/xaudio2.c b/src/sound/xaudio2.c index 114aa16da..b26bb9c9f 100644 --- a/src/sound/xaudio2.c +++ b/src/sound/xaudio2.c @@ -167,7 +167,7 @@ inital() IXAudio2SourceVoice_Start(srcvoice, 0, XAUDIO2_COMMIT_NOW); IXAudio2SourceVoice_Start(srcvoicecd, 0, XAUDIO2_COMMIT_NOW); - char *mdn = midi_device_get_internal_name(midi_device_current); + char *mdn = midi_out_device_get_internal_name(midi_output_device_current); if (strcmp(mdn, "none") && strcmp(mdn, SYSTEM_MIDI_INTERNAL_NAME)) { fmt.nSamplesPerSec = midi_freq; @@ -178,6 +178,7 @@ inital() } initialized = 1; + atexit(closeal); } void diff --git a/src/unix/CMakeLists.txt b/src/unix/CMakeLists.txt index ca0a6a6e4..1712288d2 100644 --- a/src/unix/CMakeLists.txt +++ b/src/unix/CMakeLists.txt @@ -27,4 +27,4 @@ target_link_libraries(86Box Threads::Threads) add_library(ui OBJECT unix_sdl.c unix_cdrom.c) target_compile_definitions(ui PUBLIC _FILE_OFFSET_BITS=64) -target_link_libraries(ui dl) +target_link_libraries(ui ${CMAKE_DL_LIBS}) diff --git a/src/unix/unix.c b/src/unix/unix.c index ab3f5b349..1f60ad565 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -230,19 +230,23 @@ wchar_t* plat_get_string(int i) switch (i) { case IDS_2077: - return L"Click to capture mouse."; + return L"Click to capture mouse"; case IDS_2078: return L"Press CTRL-END to release mouse"; case IDS_2079: return L"Press CTRL-END or middle button to release mouse"; case IDS_2080: return L"Failed to initialize FluidSynth"; + case IDS_2130: + return L"Invalid configuration"; case IDS_4099: return L"MFM/RLL or ESDI CD-ROM drives never existed"; case IDS_2093: return L"Failed to set up PCap"; case IDS_2094: return L"No PCap devices found"; + case IDS_2095: + return L"Invalid PCap device"; case IDS_2110: return L"Unable to initialize FreeType"; case IDS_2111: @@ -251,6 +255,8 @@ wchar_t* plat_get_string(int i) return L"libfreetype is required for ESC/P printer emulation."; case IDS_2132: return L"libgs is required for automatic conversion of PostScript files to PDF.\n\nAny documents sent to the generic PostScript printer will be saved as PostScript (.ps) files."; + case IDS_2133: + return L"libfluidsynth is required for FluidSynth MIDI output."; case IDS_2129: return L"Make sure libpcap is installed and that you are on a libpcap-compatible network connection."; case IDS_2114: @@ -261,6 +267,8 @@ wchar_t* plat_get_string(int i) return L"Video card \"%hs\" is not available due to missing ROMs in the roms/video directory. Switching to an available video card."; case IDS_2128: return L"Hardware not available"; + case IDS_2142: + return L"Monitor in sleep mode"; } return L""; } @@ -286,10 +294,7 @@ plat_path_abs(char *path) void plat_path_normalize(char* path) { - while (*path++ != 0) - { - if (*path == '\\') *path = '/'; - } + /* No-op. */ } void diff --git a/src/usb.c b/src/usb.c index d1424023e..2f8f957b5 100644 --- a/src/usb.c +++ b/src/usb.c @@ -409,18 +409,16 @@ usb_init(const device_t *info) return dev; } - -const device_t usb_device = -{ - "Universal Serial Bus", - "usb", - DEVICE_PCI, - 0, - usb_init, - usb_close, - usb_reset, - { NULL }, - NULL, - NULL, - NULL +const device_t usb_device = { + .name = "Universal Serial Bus", + .internal_name = "usb", + .flags = DEVICE_PCI, + .local = 0, + .init = usb_init, + .close = usb_close, + .reset = usb_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/win/CMakeLists.txt b/src/win/CMakeLists.txt index 89631d209..fc2e3314b 100644 --- a/src/win/CMakeLists.txt +++ b/src/win/CMakeLists.txt @@ -27,6 +27,10 @@ if(NOT CPPTHREADS) target_sources(plat PRIVATE win_thread.c) endif() +if(RTMIDI) + target_compile_definitions(ui PRIVATE USE_RTMIDI) +endif() + # CMake 3.22 messed this up for clang/clang++ # See https://gitlab.kitware.com/cmake/cmake/-/issues/23066 if(MSVC OR (NOT MINGW AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.22)) diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index f55c7d8df..325c5d5dd 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -191,6 +191,9 @@ endif ifndef CPPTHREADS CPPTHREADS := y endif +ifndef RTMIDI + RTMIDI := y +endif ifeq ($(DYNAREC), y) ifeq ($(ARM), y) ifeq ($(NEW_DYNAREC), n) @@ -650,7 +653,7 @@ SNDOBJ := sound.o \ wave6581_P_T.o wave6581_PS_.o wave6581_PST.o \ wave8580__ST.o wave8580_P_T.o wave8580_PS_.o \ wave8580_PST.o wave.o \ - midi.o midi_rtmidi.o \ + midi.o \ snd_speaker.o \ snd_pssj.o \ snd_ps1.o \ @@ -747,7 +750,13 @@ ifdef EXOBJ OBJ += $(EXOBJ) endif -LIBS := -mwindows -lcomctl32 -lSDL2 -lrtmidi -limagehlp -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid +LIBS := -mwindows -lcomctl32 -lSDL2 -limagehlp -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid + +ifeq ($(RTMIDI), y) + SNDOBJ += midi_rtmidi.o + OPTS += -DUSE_RTMIDI + LIBS += -lrtmidi +endif ifeq ($(VNC), y) LIBS += $(VNCLIB) -lws2_32 diff --git a/src/win/languages/fi-FI.rc b/src/win/languages/fi-FI.rc index 695c91353..bddde501c 100644 --- a/src/win/languages/fi-FI.rc +++ b/src/win/languages/fi-FI.rc @@ -32,7 +32,7 @@ BEGIN POPUP "&Näytä" BEGIN MENUITEM "&Piilota tilapalkki", IDM_VID_HIDE_STATUS_BAR - MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR + MENUITEM "Piilota &työkalupalkki", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "&Salli koon muuttaminen", IDM_VID_RESIZE MENUITEM "&Muista koko ja sijainti", IDM_VID_REMEMBER @@ -49,7 +49,7 @@ BEGIN END MENUITEM SEPARATOR MENUITEM "&Määritä koko...", IDM_VID_SPECIFY_DIM - MENUITEM "Pakota 4:3 näyttösuhde", IDM_VID_FORCE43 + MENUITEM "Pakota 4:3-näyttösuhde", IDM_VID_FORCE43 POPUP "&Ikkunan kokokerroin" BEGIN MENUITEM "&0.5x", IDM_VID_SCALE_1X @@ -72,13 +72,13 @@ BEGIN MENUITEM "&Tasasivuiset kuvapisteet (säilytä kuvasuhde)", IDM_VID_FS_KEEPRATIO MENUITEM "&Kokonaislukuskaalaus", IDM_VID_FS_INT END - POPUP "&EGA/(S)VGA asetukset" + POPUP "&EGA/(S)VGA-asetukset" BEGIN - MENUITEM "&VGA näyttö käänteisillä väreillä", IDM_VID_INVERT - POPUP "VGA näytön &tyyppi" + MENUITEM "&VGA-näyttö käänteisillä väreillä", IDM_VID_INVERT + POPUP "VGA-näytön &tyyppi" BEGIN - MENUITEM "RGB &värit", IDM_VID_GRAY_RGB - MENUITEM "&RGB harmaasävyinen", IDM_VID_GRAY_MONO + MENUITEM "RGB, &värit", IDM_VID_GRAY_RGB + MENUITEM "&RGB, harmaasävy", IDM_VID_GRAY_MONO MENUITEM "&Meripihkanvärinen", IDM_VID_GRAY_AMBER MENUITEM "V&ihreä", IDM_VID_GRAY_GREEN MENUITEM "V&alkoinen", IDM_VID_GRAY_WHITE @@ -95,7 +95,7 @@ BEGIN MENUITEM "&Muuta harmaavärinäytön kontrastia", IDM_VID_CGACON END MENUITEM "&Media", IDM_MEDIA - POPUP "&Työkalut" + POPUP "Työ&kalut" BEGIN MENUITEM "&Kokoonpano...", IDM_CONFIG MENUITEM "&Päivitä tilapalkin kuvakkeita", IDM_UPDATE_ICONS @@ -103,9 +103,9 @@ BEGIN MENUITEM "Ota &kuvakaappaus\tCtrl+F11", IDM_ACTION_SCREENSHOT MENUITEM SEPARATOR MENUITEM "&Sovellusasetukset...", IDM_PREFERENCES - MENUITEM "Käytä &Discord integraatiota", IDM_DISCORD + MENUITEM "Käytä &Discord-integraatiota", IDM_DISCORD MENUITEM SEPARATOR - MENUITEM "&Äänen tulotaso...", IDM_SND_GAIN + MENUITEM "&Äänitasot...", IDM_SND_GAIN #ifdef MTR_ENABLED MENUITEM SEPARATOR MENUITEM "Aloita jäljitys\tCtrl+T", IDM_ACTION_BEGIN_TRACE @@ -114,8 +114,8 @@ BEGIN END POPUP "&Ohje" BEGIN - MENUITEM "&Dokumentaatio...", IDM_DOCS - MENUITEM "&Tietoja 86Box:sta...", IDM_ABOUT + MENUITEM "&Ohjekirja...", IDM_DOCS + MENUITEM "&Tietoja 86Boxista...", IDM_ABOUT END END @@ -219,7 +219,7 @@ BEGIN MENUITEM "&60 ruutua/s", IDM_VID_GL_FPS_60 MENUITEM "&75 ruutua/s", IDM_VID_GL_FPS_75 END - MENUITEM "&VSync", IDM_VID_GL_VSYNC + MENUITEM "&VSync", IDM_VID_GL_VSYNC MENUITEM "Valitse varjostin&ohjelma...", IDM_VID_GL_SHADER MENUITEM "&Poista varjostinohjelma", IDM_VID_GL_NOSHADER END @@ -231,7 +231,7 @@ END // #define STR_PREFERENCES "Sovellusasetukset" -#define STR_SND_GAIN "Äänen tulotaso" +#define STR_SND_GAIN "Äänen taso" #define STR_NEW_FLOPPY "Uusi levykuva" #define STR_CONFIG "Kokoonpano" #define STR_SPECIFY_DIM "Määritä pääikkunan koko" @@ -247,7 +247,7 @@ END #define STR_FILE_NAME "Tiedostonimi:" #define STR_DISK_SIZE "Levyn koko:" -#define STR_RPM_MODE "RPM tila:" +#define STR_RPM_MODE "Kierroslukutila:" #define STR_PROGRESS "Edistyminen:" #define STR_WIDTH "Leveys:" @@ -311,8 +311,8 @@ END #define STR_HDC "Kiintolevyohjain:" #define STR_FDC "Levykeohjain:" -#define STR_IDE_TER "Tertinäärinen IDE-ohjain" -#define STR_IDE_QUA "Kvaternaarinen IDE-ohjain" +#define STR_IDE_TER "Kolmas IDE-ohjain" +#define STR_IDE_QUA "Neljäs IDE-ohjain" #define STR_SCSI "SCSI" #define STR_SCSI_1 "Ohjain 1:" #define STR_SCSI_2 "Ohjain 2:" @@ -330,7 +330,7 @@ END #define STR_SPECIFY "&Määritä..." #define STR_SECTORS "Sektorit:" -#define STR_HEADS "Päät:" +#define STR_HEADS "Lukupäät:" #define STR_CYLS "Sylinterit:" #define STR_SIZE_MB "Koko (Mt):" #define STR_TYPE "Tyyppi:" @@ -341,7 +341,7 @@ END #define STR_TURBO "Turbo-ajoitukset" #define STR_CHECKBPB "Tarkista BPB" #define STR_CDROM_DRIVES "CD-ROM-asemat:" -#define STR_CD_SPEED "Nopeus:" +#define STR_CD_SPEED "Nopeus:" #define STR_MO_DRIVES "Magneettisoptiset asemat (MO):" #define STR_ZIP_DRIVES "ZIP-asemat:" @@ -371,12 +371,12 @@ BEGIN 2048 "86Box" IDS_2049 "Virhe" IDS_2050 "Vakava virhe" - IDS_2051 " - PAUSED" + IDS_2051 " - TAUKO" IDS_2052 "Paina Ctrl+Alt+PgDn palataksesi ikkunoituun tilaan." IDS_2053 "Nopeus" IDS_2054 "ZIP %03i %i (%s): %ls" IDS_2055 "ZIP-levykuvat (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0" - IDS_2056 "86Box ei löytänyt käyttökelpoisia ROM-tiedostoja.\n\nVoit ladata ROM-paketin ja purkaa sen ""roms"" hakemistoon." + IDS_2056 "86Box ei löytänyt käyttökelpoisia ROM-tiedostoja.\n\nVoit ladata ROM-paketin ja purkaa sen ""roms""-hakemistoon." IDS_2057 "(tyhjä)" IDS_2058 "ZIP-levykuvat (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0Kaikki tiedostot (*.*)\0*.*\0" IDS_2059 "Turbo" @@ -408,7 +408,7 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_2080 "FluidSynth:in alustus epäonnistui" + IDS_2080 "FluidSynthin alustus epäonnistui" IDS_2081 "Väylä" IDS_2082 "Tiedosto" IDS_2083 "C" @@ -417,7 +417,7 @@ BEGIN IDS_2086 "Mt" IDS_2087 "Tarkista BPB" IDS_2088 "kt" - IDS_2089 "Video-renderöijän alustus epäonnistui" + IDS_2089 "Videorenderöijän alustus epäonnistui" IDS_2090 "Oletus" IDS_2091 "%i odotustilaa" IDS_2092 "Tyyppi" @@ -440,12 +440,12 @@ BEGIN IDS_2109 "Kaikki levykuvat (*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.MFM;*.XDF)\0*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.MFM;*.XDF\0Kehittyneet sektorilevykuvat (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0Perussektorilevykuvat (*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux-levykuvat (*.FDI)\0*.FDI\0Pintalevykuvat (*.86F;*.MFM)\0*.86F;*.MFM\0Kaikki tiedostot (*.*)\0*.*\0" IDS_2110 "FreeType:n alustus epäonnistui" IDS_2111 "SDL:n alustus epäonnistui. Tarvitaan SDL2.dll" - IDS_2112 "Oletko varma, että haluat käynnistää emuloidun tietokoneen uudelleen?" - IDS_2113 "Haluatko varmasti sulkea 86Box:in?" - IDS_2114 "Ghostscript:in alustus epäonnistui" + IDS_2112 "Haluatko varmasti käynnistää emuloidun tietokoneen uudelleen?" + IDS_2113 "Haluatko varmasti sulkea 86Boxin?" + IDS_2114 "Ghostscriptin alustus epäonnistui" IDS_2115 "MO %i (%ls): %ls" IDS_2116 "MO-levykuvat (*.IM?;*.MDI)\0*.IM?;*.MDI\0Kaikki tiedostot (*.*)\0*.*\0" - IDS_2117 "Tervetuloa 86Box:iin!" + IDS_2117 "Tervetuloa 86Boxiin!" IDS_2118 "Sisäinen ohjain" IDS_2119 "Poistu" IDS_2120 "ROM-tiedostoja ei löytynyt" @@ -498,18 +498,18 @@ BEGIN IDS_2146 "Valittuun tietokoneeseen perustuva suoritintyypin suodatus ei ole käytössä tällä emuloidulla koneella.\n\nTämä mahdollistaa muutoin yhteensopimattoman suorittimen valinnan kyseisen tietokoneen kanssa. Voit kuitenkin kohdata ongelmia tietokoneen BIOS:in tai muun ohjelmiston kanssa.\n\nTämän asetuksen käyttö ei ole virallisesti tuettua ja kaikki tehdyt virheraportit voidaan sulkea epäpätevinä." IDS_2147 "Jatka" IDS_2148 "Kasetti: %s" - IDS_2149 "Kasetti-tiedostot (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0Kaikki tiedostot (*.*)\0*.*\0" + IDS_2149 "Kasettitiedostot (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0Kaikki tiedostot (*.*)\0*.*\0" IDS_2150 "ROM-moduuli %i: %ls" IDS_2151 "ROM-moduulikuvat (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Kaikki tiedostot (*.*)\0*.*\0" IDS_2152 "Virhe renderöijän alustuksessa" - IDS_2153 "OpenGL (3.0 Core) renderöijän alustus epäonnistui. Käytä toista renderöijää." - IDS_2154 "Resume execution" - IDS_2155 "Pause execution" - IDS_2156 "Press Ctrl+Alt+Del" - IDS_2157 "Press Ctrl+Alt+Esc" - IDS_2158 "Hard reset" - IDS_2159 "ACPI shutdown" - IDS_2160 "Settings" + IDS_2153 "OpenGL (3.0 Core) -renderöijän alustus epäonnistui. Käytä toista renderöijää." + IDS_2154 "Jatka suoritusta" + IDS_2155 "Pysäytä suoritus" + IDS_2156 "Paina Ctrl+Alt+Del" + IDS_2157 "Paina Ctrl+Alt+Esc" + IDS_2158 "Kylmä uudelleenkäynnistys" + IDS_2159 "ACPI-sammutus" + IDS_2160 "Asetukset" END STRINGTABLE DISCARDABLE @@ -517,12 +517,12 @@ BEGIN IDS_4096 "Kiintolevy (%s)" IDS_4097 "%01i:%01i" IDS_4098 "%01i" - IDS_4099 "MFM/RLL tai ESDI CD-ROM asemia ei ole koskaan ollut olemassa" + IDS_4099 "MFM/RLL- tai ESDI-CD-ROM-asemia ei ole koskaan ollut olemassa" IDS_4100 "Mukautettu..." IDS_4101 "Mukautettu (suuri)..." IDS_4102 "Lisää uusi kiintolevy" IDS_4103 "Lisää olemassaoleva kiintolevy" - IDS_4104 "HDI levykuvan suurin mahdollinen koko on 4 Gt." + IDS_4104 "HDI-levykuvan suurin mahdollinen koko on 4 Gt." IDS_4105 "Levykuvien suurin mahdollinen koko on 127 Gt." IDS_4106 "Kiintolevykuvat (*.HD?;*.IM?;*.VHD)\0*.HD?;*.IM?;*.VHD\0Kaikki tiedostot (*.*)\0*.*\0" IDS_4107 "Tiedostoa ei voi lukea" @@ -536,10 +536,10 @@ BEGIN IDS_4115 "Varmista, että tiedoston tallennuskansioon on kirjoitusoikeus" IDS_4116 "Liian suuri levykuva" IDS_4117 "Muista osioida ja alustaa juuri luomasi asema." - IDS_4118 "Valittu tiedosto ylikirjoitetaan. Oletko varma, että haluat käyttää sitä?" - IDS_4119 "Levynkuvaa ei tueta" - IDS_4120 "Ylikirjoita" - IDS_4121 "Älä ylikirjoita" + IDS_4118 "Valittu tiedosto korvataan. Oletko varma, että haluat käyttää sitä?" + IDS_4119 "Levykuvaa ei tueta" + IDS_4120 "Korvaa" + IDS_4121 "Älä korvaa" IDS_4122 "Raaka levykuva (.img)" IDS_4123 "HDI-levykuva (.hdi)" IDS_4124 "HDX-levykuva (.hdx)" diff --git a/src/win/win_devconf.c b/src/win/win_devconf.c index 3c30924f7..42197ff33 100644 --- a/src/win/win_devconf.c +++ b/src/win/win_devconf.c @@ -93,13 +93,14 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) id += 2; break; +#ifdef USE_RTMIDI case CONFIG_MIDI_OUT: val_int = config_get_int((char *) config_device.name, (char *) config->name, config->default_int); - num = rtmidi_get_num_devs(); + num = rtmidi_out_get_num_devs(); for (c = 0; c < num; c++) { - rtmidi_get_dev_name(c, s); + rtmidi_out_get_dev_name(c, s); mbstowcs(lptsTemp, s, strlen(s) + 1); SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp); if (val_int == c) @@ -123,6 +124,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) id += 2; break; +#endif case CONFIG_SPINNER: val_int = config_get_int((char *) config_device.name, (char *) config->name, config->default_int); diff --git a/src/win/win_settings.c b/src/win/win_settings.c index dcd8d33ad..e6b4226b6 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -91,7 +91,7 @@ static int temp_gfxcard, temp_voodoo; static int temp_mouse, temp_joystick; /* Sound category */ -static int temp_sound_card, temp_midi_device, temp_midi_input_device, temp_mpu401, temp_SSI2001, temp_GAMEBLASTER, temp_GUS; +static int temp_sound_card, temp_midi_output_device, temp_midi_input_device, temp_mpu401, temp_SSI2001, temp_GAMEBLASTER, temp_GUS; static int temp_float; /* Network category */ @@ -339,7 +339,7 @@ win_settings_init(void) /* Sound category */ temp_sound_card = sound_card_current; - temp_midi_device = midi_device_current; + temp_midi_output_device = midi_output_device_current; temp_midi_input_device = midi_input_device_current; temp_mpu401 = mpu401_standalone_enable; temp_SSI2001 = SSI2001; @@ -463,7 +463,7 @@ win_settings_changed(void) /* Sound category */ i = i || (sound_card_current != temp_sound_card); - i = i || (midi_device_current != temp_midi_device); + i = i || (midi_output_device_current != temp_midi_output_device); i = i || (midi_input_device_current != temp_midi_input_device); i = i || (mpu401_standalone_enable != temp_mpu401); i = i || (SSI2001 != temp_SSI2001); @@ -553,7 +553,7 @@ win_settings_save(void) /* Sound category */ sound_card_current = temp_sound_card; - midi_device_current = temp_midi_device; + midi_output_device_current = temp_midi_output_device; midi_input_device_current = temp_midi_input_device; mpu401_standalone_enable = temp_mpu401; SSI2001 = temp_SSI2001; @@ -1261,7 +1261,7 @@ mpu401_standalone_allow(void) if (!machine_has_bus(temp_machine, MACHINE_BUS_ISA) && !machine_has_bus(temp_machine, MACHINE_BUS_MCA)) return 0; - md = midi_device_get_internal_name(temp_midi_device); + md = midi_out_device_get_internal_name(temp_midi_output_device); mdin = midi_in_device_get_internal_name(temp_midi_input_device); if (md != NULL) { @@ -1327,18 +1327,18 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) c = d = 0; settings_reset_content(hdlg, IDC_COMBO_MIDI_OUT); while (1) { - generate_device_name(midi_device_getdevice(c), midi_device_get_internal_name(c), 0); + generate_device_name(midi_out_device_getdevice(c), midi_out_device_get_internal_name(c), 0); if (!device_name[0]) break; - if (midi_device_available(c)) { + if (midi_out_device_available(c)) { if (c == 0) settings_add_string(hdlg, IDC_COMBO_MIDI_OUT, win_get_string(IDS_2103)); else settings_add_string(hdlg, IDC_COMBO_MIDI_OUT, (LPARAM) device_name); settings_list_to_midi[d] = c; - if ((c == 0) || (c == temp_midi_device)) + if ((c == 0) || (c == temp_midi_output_device)) settings_set_cur_sel(hdlg, IDC_COMBO_MIDI_OUT, d); d++; } @@ -1346,7 +1346,7 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) c++; } - settings_enable_window(hdlg, IDC_CONFIGURE_MIDI_OUT, midi_device_has_config(temp_midi_device)); + settings_enable_window(hdlg, IDC_CONFIGURE_MIDI_OUT, midi_out_device_has_config(temp_midi_output_device)); c = d = 0; settings_reset_content(hdlg, IDC_COMBO_MIDI_IN); @@ -1405,16 +1405,16 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) break; case IDC_COMBO_MIDI_OUT: - temp_midi_device = settings_list_to_midi[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_OUT)]; - settings_enable_window(hdlg, IDC_CONFIGURE_MIDI_OUT, midi_device_has_config(temp_midi_device)); + temp_midi_output_device = settings_list_to_midi[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_OUT)]; + settings_enable_window(hdlg, IDC_CONFIGURE_MIDI_OUT, midi_out_device_has_config(temp_midi_output_device)); settings_set_check(hdlg, IDC_CHECK_MPU401, temp_mpu401); settings_enable_window(hdlg, IDC_CHECK_MPU401, mpu401_standalone_allow()); settings_enable_window(hdlg, IDC_CONFIGURE_MPU401, mpu401_standalone_allow() && temp_mpu401); break; case IDC_CONFIGURE_MIDI_OUT: - temp_midi_device = settings_list_to_midi[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_OUT)]; - temp_deviceconfig |= deviceconfig_open(hdlg, (void *)midi_device_getdevice(temp_midi_device)); + temp_midi_output_device = settings_list_to_midi[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_OUT)]; + temp_deviceconfig |= deviceconfig_open(hdlg, (void *)midi_out_device_getdevice(temp_midi_output_device)); break; case IDC_COMBO_MIDI_IN: @@ -1474,7 +1474,7 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_SAVESETTINGS: temp_sound_card = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_SOUND)]; - temp_midi_device = settings_list_to_midi[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_OUT)]; + temp_midi_output_device = settings_list_to_midi[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_OUT)]; temp_midi_input_device = settings_list_to_midi_in[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_IN)]; temp_mpu401 = settings_get_check(hdlg, IDC_CHECK_MPU401); temp_GAMEBLASTER = settings_get_check(hdlg, IDC_CHECK_CMS); diff --git a/vcpkg.json b/vcpkg.json index 2e01d1c1f..9dcecfe5e 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -7,7 +7,6 @@ "dependencies": [ "freetype", "libpng", - "openal-soft", "sdl2", "rtmidi" ], @@ -30,6 +29,12 @@ "dependencies": [ "libslirp" ] + }, + "openal": { + "description": "OpenAL sound backend", + "dependencies": [ + "openal-soft" + ] } } }