From 4745be5668b2d3d259ae31eed10f3fd60d3a8846 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 20 Oct 2019 19:23:34 +0100 Subject: [PATCH] Add targets for Wii using DevKitPPC. --- .gitignore | 3 +- .idea/codeStyles/Project.xml | 71 +++++++++ .idea/codeStyles/codeStyleConfig.xml | 5 + .idea/dicremote.iml | 2 + .idea/inspectionProfiles/Project_Default.xml | 157 +++++++++++++++++++ .idea/misc.xml | 7 + .idea/modules.xml | 28 ++++ .idea/runConfigurations/dicremote.xml | 7 + .idea/runConfigurations/dicremote_wii.xml | 7 + .idea/runConfigurations/dicremote_x86_64.xml | 7 + .idea/vcs.xml | 6 + CMakeLists.txt | 35 ++--- build.sh | 12 ++ linux/CMakeLists.txt | 22 +++ wii/CMakeLists.txt | 12 ++ wii/wii.c | 17 ++ 16 files changed, 372 insertions(+), 26 deletions(-) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/dicremote.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/runConfigurations/dicremote.xml create mode 100644 .idea/runConfigurations/dicremote_wii.xml create mode 100644 .idea/runConfigurations/dicremote_x86_64.xml create mode 100644 .idea/vcs.xml create mode 100755 build.sh create mode 100644 linux/CMakeLists.txt create mode 100644 wii/CMakeLists.txt create mode 100644 wii/wii.c diff --git a/.gitignore b/.gitignore index 8f0fb4f..263c078 100644 --- a/.gitignore +++ b/.gitignore @@ -561,4 +561,5 @@ atlassian-ide-plugin.xml com_crashlytics_export_strings.xml crashlytics.properties crashlytics-build.properties -fabric.properties \ No newline at end of file +fabric.properties +!.idea/ \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..f5b76c0 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/dicremote.iml b/.idea/dicremote.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/.idea/dicremote.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..58bba51 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,157 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..8822db8 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..e0016cd --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/dicremote.xml b/.idea/runConfigurations/dicremote.xml new file mode 100644 index 0000000..cd26567 --- /dev/null +++ b/.idea/runConfigurations/dicremote.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/dicremote_wii.xml b/.idea/runConfigurations/dicremote_wii.xml new file mode 100644 index 0000000..67d0f33 --- /dev/null +++ b/.idea/runConfigurations/dicremote_wii.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/dicremote_x86_64.xml b/.idea/runConfigurations/dicremote_x86_64.xml new file mode 100644 index 0000000..abe3df7 --- /dev/null +++ b/.idea/runConfigurations/dicremote_x86_64.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 19f91ba..7d2627e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,30 +7,15 @@ set(CMAKE_C_STANDARD 90) set(MAIN_SOURCES main.c list_devices.c device.c scsi.c hex2bin.c usb.c ieee1394.c pcmcia.c ata.c sdhci.c) -if ("${CMAKE_SYSTEM}" MATCHES "Linux") - set(PLATFORM_SOURCES linux/list_devices.c linux/linux.h linux/device.c linux/scsi.c linux/usb.c linux/ieee1394.c linux/pcmcia.c linux/ata.c linux/sdhci.c) - CHECK_LIBRARY_EXISTS("udev" udev_new "" HAS_UDEV) - CHECK_INCLUDE_FILES("linux/mmc/ioctl.h" HAVE_MMC_IOCTL_H) +add_library(dicremote ${MAIN_SOURCES}) + +if (WII) + set(CMAKE_C_FLAGS "-mrvl -mcpu=750 -meabi -mhard-float") + add_definitions(-DGEKKO=1) + include_directories($ENV{DEVKITPRO}/libogc/include/) endif () -add_executable(dicremote-${CMAKE_SYSTEM_PROCESSOR} ${MAIN_SOURCES} ${PLATFORM_SOURCES}) - -if (HAS_UDEV) - target_link_libraries(dicremote-${CMAKE_SYSTEM_PROCESSOR} udev) - add_definitions(-DHAS_UDEV) -endif () - -if (HAVE_MMC_IOCTL_H) - add_definitions(-DHAS_UAPI_MMC) -endif () - -if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64") - add_executable(dicremote-x86 ${MAIN_SOURCES} ${PLATFORM_SOURCES}) - set_target_properties(dicremote-x86 PROPERTIES LINK_FLAGS -m32) - target_compile_options(dicremote-x86 PUBLIC -m32) - - if (HAS_UDEV) - target_link_libraries(dicremote-x86 udev) - add_definitions(-DHAS_UDEV) - endif () -endif () +set(DIC_PORTS "linux;wii" CACHE STRING "List of ports to build") +foreach (PORT IN LISTS DIC_PORTS) + add_subdirectory(${PORT}) +endforeach (PORT) \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..b510c8e --- /dev/null +++ b/build.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +cmake . +make +if [ -f $DEVKITPRO/wii.cmake ]; then + rm -R ./*/CMakeFiles CMakeCache.txt CMakeFiles ./*/Makefile Makefile ./*/cmake_install.cmake cmake_install.cmake + . $DEVKITPRO/ppcvars.sh + cmake . -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/wii.cmake + make +fi + +# Clean +rm -R ./*/CMakeFiles CMakeCache.txt CMakeFiles ./*/Makefile Makefile ./*/cmake_install.cmake cmake_install.cmake diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt new file mode 100644 index 0000000..108a68a --- /dev/null +++ b/linux/CMakeLists.txt @@ -0,0 +1,22 @@ +project(dicremote-linux C) + +if (NOT "${CMAKE_SYSTEM}" MATCHES "Linux") + return() +endif () + +set(PLATFORM_SOURCES list_devices.c linux.h device.c scsi.c usb.c ieee1394.c pcmcia.c ata.c sdhci.c) +CHECK_LIBRARY_EXISTS("udev" udev_new "" HAS_UDEV) +CHECK_INCLUDE_FILES("linux/mmc/ioctl.h" HAVE_MMC_IOCTL_H) + +add_executable(dicremote-${CMAKE_SYSTEM_PROCESSOR} ${PLATFORM_SOURCES}) + +if (HAS_UDEV) + target_link_libraries(dicremote-${CMAKE_SYSTEM_PROCESSOR} udev) + add_definitions(-DHAS_UDEV) +endif () + +if (HAVE_MMC_IOCTL_H) + add_definitions(-DHAS_UAPI_MMC) +endif () + +target_link_libraries(dicremote-${CMAKE_SYSTEM_PROCESSOR} dicremote) \ No newline at end of file diff --git a/wii/CMakeLists.txt b/wii/CMakeLists.txt new file mode 100644 index 0000000..2c31eec --- /dev/null +++ b/wii/CMakeLists.txt @@ -0,0 +1,12 @@ +project(dicremote-wii C) + +if (NOT WII) + return() +endif () + +set(PLATFORM_SOURCES wii.c) + +add_executable(dicremote-wii ${PLATFORM_SOURCES}) +set_target_properties(dicremote-wii PROPERTIES LINK_FLAGS -L$ENV{DEVKITPRO}/libogc/lib/wii/) +set_target_properties(dicremote-wii PROPERTIES OUTPUT_NAME dicremote.elf) +target_link_libraries(dicremote-wii dicremote -logc) \ No newline at end of file diff --git a/wii/wii.c b/wii/wii.c new file mode 100644 index 0000000..758133c --- /dev/null +++ b/wii/wii.c @@ -0,0 +1,17 @@ +/* + * This file is part of the DiscImageChef Remote Server. + * Copyright (c) 2019 Natalia Portillo. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +