From c61d83010a1d83513623724f908f0903e90966e2 Mon Sep 17 00:00:00 2001 From: spicyjpeg <88942473+spicyjpeg@users.noreply.github.com> Date: Mon, 8 Nov 2021 13:59:21 +0100 Subject: Rolled back minimum required CMake version to 3.20 --- examples/beginner/cppdemo/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/beginner/cppdemo') diff --git a/examples/beginner/cppdemo/CMakeLists.txt b/examples/beginner/cppdemo/CMakeLists.txt index 83f0f0a..3b6a53e 100644 --- a/examples/beginner/cppdemo/CMakeLists.txt +++ b/examples/beginner/cppdemo/CMakeLists.txt @@ -1,7 +1,7 @@ # PSn00bSDK example CMake script # (C) 2021 spicyjpeg - MPL licensed -cmake_minimum_required(VERSION 3.21) +cmake_minimum_required(VERSION 3.20) if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{PSN00BSDK_LIBS}) set(CMAKE_TOOLCHAIN_FILE $ENV{PSN00BSDK_LIBS}/cmake/sdk.cmake) -- cgit v1.2.3 From b55bc88017aac1bbe9eab21b480093459c0fd0e1 Mon Sep 17 00:00:00 2001 From: spicyjpeg <88942473+spicyjpeg@users.noreply.github.com> Date: Wed, 10 Nov 2021 17:11:44 +0100 Subject: Fixed examples directory hierarchy not being preserved --- INSTALL.md | 2 +- cpack/setup.cmake | 4 ++-- examples/CMakeLists.txt | 22 +++++++++++++++++++--- examples/beginner/cppdemo/CMakeLists.txt | 2 +- examples/beginner/hello/CMakeLists.txt | 2 +- examples/cdrom/cdbrowse/CMakeLists.txt | 2 +- examples/cdrom/cdxa/CMakeLists.txt | 2 +- examples/demos/n00bdemo/CMakeLists.txt | 2 +- examples/graphics/balls/CMakeLists.txt | 2 +- examples/graphics/billboard/CMakeLists.txt | 2 +- examples/graphics/fpscam/CMakeLists.txt | 4 ++-- examples/graphics/gte/CMakeLists.txt | 4 ++-- examples/graphics/hdtv/CMakeLists.txt | 2 +- examples/graphics/render2tex/CMakeLists.txt | 2 +- examples/graphics/rgb24/CMakeLists.txt | 2 +- examples/io/pads/CMakeLists.txt | 2 +- examples/sound/vagsample/CMakeLists.txt | 2 +- examples/system/childexec/CMakeLists.txt | 2 +- examples/system/console/CMakeLists.txt | 2 +- examples/system/dynlink/CMakeLists.txt | 2 +- examples/system/timer/CMakeLists.txt | 2 +- examples/system/tty/CMakeLists.txt | 2 +- libpsn00b/cmake/internal_setup.cmake | 4 +--- 23 files changed, 44 insertions(+), 30 deletions(-) (limited to 'examples/beginner/cppdemo') diff --git a/INSTALL.md b/INSTALL.md index 8fa7889..d0a2cd7 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -12,7 +12,7 @@ tested. - `git` - `build-essential`, `base-devel` or similar - `ninja-build` - - `cmake` (3.21+ is required, download it from + - `cmake` (3.20+ is required, download it from [here](https://cmake.org/download) if your package manager only provides older versions) diff --git a/cpack/setup.cmake b/cpack/setup.cmake index 0c4f3cb..33f127e 100644 --- a/cpack/setup.cmake +++ b/cpack/setup.cmake @@ -111,11 +111,11 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY PSn00bSDK) ## DEB/RPM variables -set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.28), cmake (>= 3.21)") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.28), cmake (>= 3.20)") set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "ninja-build (>= 1.10)") set(CPACK_DEBIAN_PACKAGE_SUGGESTS "git (>= 2.25)") set(CPACK_DEBIAN_PACKAGE_SECTION devel) -set(CPACK_RPM_PACKAGE_REQUIRES "cmake >= 3.21") +set(CPACK_RPM_PACKAGE_REQUIRES "cmake >= 3.20") set(CPACK_RPM_PACKAGE_SUGGESTS "ninja-build >= 1.10, git >= 2.25") #set(CPACK_RPM_PACKAGE_RELOCATABLE ON) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 87210b9..15212c8 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -10,16 +10,32 @@ project( HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk" ) +include(GNUInstallDirs) + +# Find all subdirectories that contain a CMake build script. This includes the +# top-level examples directory and this file as well, however we're going to +# skip it. file( GLOB_RECURSE _examples + RELATIVE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/CMakeLists.txt ) foreach(_script IN LISTS _examples) - cmake_path(GET _script PARENT_PATH _dir) - if(_dir STREQUAL PROJECT_SOURCE_DIR) + if(_script STREQUAL "CMakeLists.txt") continue() endif() - add_subdirectory(${_dir}) + # CMake provides no way to override the install prefix of a subdirectory, + # as it "imports" its targets into the main project rather than treating it + # as a separate project. However, as the example subdirectories use + # install(... TYPE BIN) to install executables, it is possible to override + # CMAKE_INSTALL_BINDIR temporarily to place them in any directory within + # the install prefix. This is a hack, but it allows us to preserve the + # examples' folder hierarchy in the installation directory (it is already + # preserved by CMake in the build tree!) with minimal effort. + cmake_path(GET _script PARENT_PATH _dir) + cmake_path(GET _dir PARENT_PATH CMAKE_INSTALL_BINDIR) + + add_subdirectory(${PROJECT_SOURCE_DIR}/${_dir}) endforeach() diff --git a/examples/beginner/cppdemo/CMakeLists.txt b/examples/beginner/cppdemo/CMakeLists.txt index 3b6a53e..becf464 100644 --- a/examples/beginner/cppdemo/CMakeLists.txt +++ b/examples/beginner/cppdemo/CMakeLists.txt @@ -19,4 +19,4 @@ file(GLOB _sources *.cpp) psn00bsdk_add_executable(cppdemo STATIC ${_sources}) #psn00bsdk_add_cd_image(cppdemo_iso cppdemo iso.xml DEPENDS cppdemo) -install(FILES ${PROJECT_BINARY_DIR}/cppdemo.exe DESTINATION .) +install(FILES ${PROJECT_BINARY_DIR}/cppdemo.exe TYPE BIN) diff --git a/examples/beginner/hello/CMakeLists.txt b/examples/beginner/hello/CMakeLists.txt index 81ed0f7..7fb7c22 100644 --- a/examples/beginner/hello/CMakeLists.txt +++ b/examples/beginner/hello/CMakeLists.txt @@ -19,4 +19,4 @@ file(GLOB _sources *.c) psn00bsdk_add_executable(hello STATIC ${_sources}) #psn00bsdk_add_cd_image(hello_iso hello iso.xml DEPENDS hello) -install(FILES ${PROJECT_BINARY_DIR}/hello.exe DESTINATION .) +install(FILES ${PROJECT_BINARY_DIR}/hello.exe TYPE BIN) diff --git a/examples/cdrom/cdbrowse/CMakeLists.txt b/examples/cdrom/cdbrowse/CMakeLists.txt index d587f5a..e5ec759 100644 --- a/examples/cdrom/cdbrowse/CMakeLists.txt +++ b/examples/cdrom/cdbrowse/CMakeLists.txt @@ -23,5 +23,5 @@ install( FILES ${PROJECT_BINARY_DIR}/cdbrowse.bin ${PROJECT_BINARY_DIR}/cdbrowse.cue - DESTINATION . + TYPE BIN ) diff --git a/examples/cdrom/cdxa/CMakeLists.txt b/examples/cdrom/cdxa/CMakeLists.txt index d95a40d..18dcc69 100644 --- a/examples/cdrom/cdxa/CMakeLists.txt +++ b/examples/cdrom/cdxa/CMakeLists.txt @@ -25,5 +25,5 @@ install( #${PROJECT_BINARY_DIR}/cdxa.bin #${PROJECT_BINARY_DIR}/cdxa.cue ${PROJECT_BINARY_DIR}/cdxa.exe - DESTINATION . + TYPE BIN ) diff --git a/examples/demos/n00bdemo/CMakeLists.txt b/examples/demos/n00bdemo/CMakeLists.txt index 02c7b35..c62c4ef 100644 --- a/examples/demos/n00bdemo/CMakeLists.txt +++ b/examples/demos/n00bdemo/CMakeLists.txt @@ -47,4 +47,4 @@ target_include_directories(n00bdemo PRIVATE ${PROJECT_SOURCE_DIR}) add_custom_target(n00bdemo_data DEPENDS data.lzp) add_dependencies(n00bdemo n00bdemo_data) -install(FILES ${PROJECT_BINARY_DIR}/n00bdemo.exe DESTINATION .) +install(FILES ${PROJECT_BINARY_DIR}/n00bdemo.exe TYPE BIN) diff --git a/examples/graphics/balls/CMakeLists.txt b/examples/graphics/balls/CMakeLists.txt index 5afb2b1..5886484 100644 --- a/examples/graphics/balls/CMakeLists.txt +++ b/examples/graphics/balls/CMakeLists.txt @@ -19,4 +19,4 @@ file(GLOB _sources *.c) psn00bsdk_add_executable(balls STATIC ${_sources}) #psn00bsdk_add_cd_image(balls_iso balls iso.xml DEPENDS balls) -install(FILES ${PROJECT_BINARY_DIR}/balls.exe DESTINATION .) +install(FILES ${PROJECT_BINARY_DIR}/balls.exe TYPE BIN) diff --git a/examples/graphics/billboard/CMakeLists.txt b/examples/graphics/billboard/CMakeLists.txt index 1d9df78..8cd31a9 100644 --- a/examples/graphics/billboard/CMakeLists.txt +++ b/examples/graphics/billboard/CMakeLists.txt @@ -25,4 +25,4 @@ psn00bsdk_add_executable( ) #psn00bsdk_add_cd_image(billboard_iso billboard iso.xml DEPENDS billboard) -install(FILES ${PROJECT_BINARY_DIR}/billboard.exe DESTINATION .) +install(FILES ${PROJECT_BINARY_DIR}/billboard.exe TYPE BIN) diff --git a/examples/graphics/fpscam/CMakeLists.txt b/examples/graphics/fpscam/CMakeLists.txt index b2becb9..791f6c2 100644 --- a/examples/graphics/fpscam/CMakeLists.txt +++ b/examples/graphics/fpscam/CMakeLists.txt @@ -8,7 +8,7 @@ if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{PSN00BSDK_LIBS}) endif() project( - hello + fpscam LANGUAGES C VERSION 1.0.0 DESCRIPTION "PSn00bSDK 3D camera controls example" @@ -19,4 +19,4 @@ file(GLOB _sources *.c) psn00bsdk_add_executable(fpscam STATIC ${_sources}) #psn00bsdk_add_cd_image(fpscam_iso fpscam iso.xml DEPENDS fpscam) -install(FILES ${PROJECT_BINARY_DIR}/fpscam.exe DESTINATION .) +install(FILES ${PROJECT_BINARY_DIR}/fpscam.exe TYPE BIN) diff --git a/examples/graphics/gte/CMakeLists.txt b/examples/graphics/gte/CMakeLists.txt index 5fdf4d1..85b2942 100644 --- a/examples/graphics/gte/CMakeLists.txt +++ b/examples/graphics/gte/CMakeLists.txt @@ -8,7 +8,7 @@ if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{PSN00BSDK_LIBS}) endif() project( - hello + gte LANGUAGES C VERSION 1.0.0 DESCRIPTION "PSn00bSDK GTE 3D cube example" @@ -19,4 +19,4 @@ file(GLOB _sources *.c) psn00bsdk_add_executable(gte STATIC ${_sources}) #psn00bsdk_add_cd_image(gte_iso gte iso.xml DEPENDS gte) -install(FILES ${PROJECT_BINARY_DIR}/gte.exe DESTINATION .) +install(FILES ${PROJECT_BINARY_DIR}/gte.exe TYPE BIN) diff --git a/examples/graphics/hdtv/CMakeLists.txt b/examples/graphics/hdtv/CMakeLists.txt index 899f963..f92faeb 100644 --- a/examples/graphics/hdtv/CMakeLists.txt +++ b/examples/graphics/hdtv/CMakeLists.txt @@ -19,4 +19,4 @@ file(GLOB _sources *.c) psn00bsdk_add_executable(hdtv STATIC ${_sources}) #psn00bsdk_add_cd_image(hdtv_iso hdtv iso.xml DEPENDS hdtv) -install(FILES ${PROJECT_BINARY_DIR}/hdtv.exe DESTINATION .) +install(FILES ${PROJECT_BINARY_DIR}/hdtv.exe TYPE BIN) diff --git a/examples/graphics/render2tex/CMakeLists.txt b/examples/graphics/render2tex/CMakeLists.txt index db30377..360840d 100644 --- a/examples/graphics/render2tex/CMakeLists.txt +++ b/examples/graphics/render2tex/CMakeLists.txt @@ -25,4 +25,4 @@ psn00bsdk_add_executable( ) #psn00bsdk_add_cd_image(render2tex_iso render2tex iso.xml DEPENDS render2tex) -install(FILES ${PROJECT_BINARY_DIR}/render2tex.exe DESTINATION .) +install(FILES ${PROJECT_BINARY_DIR}/render2tex.exe TYPE BIN) diff --git a/examples/graphics/rgb24/CMakeLists.txt b/examples/graphics/rgb24/CMakeLists.txt index 71e2cfa..bf8a8fa 100644 --- a/examples/graphics/rgb24/CMakeLists.txt +++ b/examples/graphics/rgb24/CMakeLists.txt @@ -25,4 +25,4 @@ psn00bsdk_add_executable( ) #psn00bsdk_add_cd_image(rgb24_iso rgb24 iso.xml DEPENDS rgb24) -install(FILES ${PROJECT_BINARY_DIR}/rgb24.exe DESTINATION .) +install(FILES ${PROJECT_BINARY_DIR}/rgb24.exe TYPE BIN) diff --git a/examples/io/pads/CMakeLists.txt b/examples/io/pads/CMakeLists.txt index 62c06a2..5bd7f5d 100644 --- a/examples/io/pads/CMakeLists.txt +++ b/examples/io/pads/CMakeLists.txt @@ -19,4 +19,4 @@ file(GLOB _sources *.c *.s) psn00bsdk_add_executable(pads STATIC ${_sources}) #psn00bsdk_add_cd_image(pads_iso pads iso.xml DEPENDS pads) -install(FILES ${PROJECT_BINARY_DIR}/pads.exe DESTINATION .) +install(FILES ${PROJECT_BINARY_DIR}/pads.exe TYPE BIN) diff --git a/examples/sound/vagsample/CMakeLists.txt b/examples/sound/vagsample/CMakeLists.txt index 54305ab..1a15d9c 100644 --- a/examples/sound/vagsample/CMakeLists.txt +++ b/examples/sound/vagsample/CMakeLists.txt @@ -19,4 +19,4 @@ file(GLOB _sources *.c) psn00bsdk_add_executable(vagsample STATIC ${_sources}) #psn00bsdk_add_cd_image(vagsample_iso vagsample iso.xml DEPENDS vagsample) -install(FILES ${PROJECT_BINARY_DIR}/vagsample.exe DESTINATION .) +install(FILES ${PROJECT_BINARY_DIR}/vagsample.exe TYPE BIN) diff --git a/examples/system/childexec/CMakeLists.txt b/examples/system/childexec/CMakeLists.txt index f28a136..88168e0 100644 --- a/examples/system/childexec/CMakeLists.txt +++ b/examples/system/childexec/CMakeLists.txt @@ -38,4 +38,4 @@ target_link_options(child PRIVATE -Ttext=0x80030000) # embedded via child_exe.s). add_dependencies(parent child) -install(FILES ${PROJECT_BINARY_DIR}/parent.exe DESTINATION .) +install(FILES ${PROJECT_BINARY_DIR}/parent.exe TYPE BIN) diff --git a/examples/system/console/CMakeLists.txt b/examples/system/console/CMakeLists.txt index 024c7a4..6dc6154 100644 --- a/examples/system/console/CMakeLists.txt +++ b/examples/system/console/CMakeLists.txt @@ -19,4 +19,4 @@ file(GLOB _sources *.c) psn00bsdk_add_executable(console STATIC ${_sources}) #psn00bsdk_add_cd_image(console_iso console iso.xml DEPENDS console) -install(FILES ${PROJECT_BINARY_DIR}/console.exe DESTINATION .) +install(FILES ${PROJECT_BINARY_DIR}/console.exe TYPE BIN) diff --git a/examples/system/dynlink/CMakeLists.txt b/examples/system/dynlink/CMakeLists.txt index e7188de..5834647 100644 --- a/examples/system/dynlink/CMakeLists.txt +++ b/examples/system/dynlink/CMakeLists.txt @@ -28,5 +28,5 @@ install( FILES ${PROJECT_BINARY_DIR}/dynlink.bin ${PROJECT_BINARY_DIR}/dynlink.cue - DESTINATION . + TYPE BIN ) diff --git a/examples/system/timer/CMakeLists.txt b/examples/system/timer/CMakeLists.txt index 6dc5ec3..58daf9b 100644 --- a/examples/system/timer/CMakeLists.txt +++ b/examples/system/timer/CMakeLists.txt @@ -19,4 +19,4 @@ file(GLOB _sources *.c) psn00bsdk_add_executable(timer STATIC ${_sources}) #psn00bsdk_add_cd_image(timer_iso timer iso.xml DEPENDS timer) -install(FILES ${PROJECT_BINARY_DIR}/timer.exe DESTINATION .) +install(FILES ${PROJECT_BINARY_DIR}/timer.exe TYPE BIN) diff --git a/examples/system/tty/CMakeLists.txt b/examples/system/tty/CMakeLists.txt index b8b5738..4e0ca36 100644 --- a/examples/system/tty/CMakeLists.txt +++ b/examples/system/tty/CMakeLists.txt @@ -19,4 +19,4 @@ file(GLOB _sources *.c) psn00bsdk_add_executable(tty STATIC ${_sources}) #psn00bsdk_add_cd_image(tty_iso tty iso.xml DEPENDS tty) -install(FILES ${PROJECT_BINARY_DIR}/tty.exe DESTINATION .) +install(FILES ${PROJECT_BINARY_DIR}/tty.exe TYPE BIN) diff --git a/libpsn00b/cmake/internal_setup.cmake b/libpsn00b/cmake/internal_setup.cmake index 732294c..f485ec2 100644 --- a/libpsn00b/cmake/internal_setup.cmake +++ b/libpsn00b/cmake/internal_setup.cmake @@ -93,9 +93,7 @@ function(psn00bsdk_add_executable name type) target_include_directories(${name} PRIVATE ${PSN00BSDK_INCLUDE}) # Add post-build steps to generate the .exe and symbol map once the - # executable is built. CMake 3.21 added support for target-dependent - # generator expressions (catchy name lol) in add_custom_command(), so I'm - # making heavy use of those here. + # executable is built. add_custom_command( TARGET ${name} POST_BUILD COMMAND ${ELF2X} -q ${name}.elf ${name}${PSN00BSDK_EXECUTABLE_SUFFIX} -- cgit v1.2.3 From 619fa016bbc4ddd8d4a670cf3f8aa63617473b2f Mon Sep 17 00:00:00 2001 From: spicyjpeg <88942473+spicyjpeg@users.noreply.github.com> Date: Thu, 18 Nov 2021 17:23:25 +0100 Subject: Deprecated malloc.h, moved int*_t types to stdint.h --- examples/beginner/cppdemo/main.cpp | 2 +- examples/cdrom/cdbrowse/main.c | 1 - examples/cdrom/cdxa/main.c | 1 - examples/demos/n00bdemo/logo.c | 1 - examples/demos/n00bdemo/main.c | 1 - examples/io/pads/main.c | 2 +- examples/io/pads/spi.c | 4 ++-- examples/io/pads/spi.h | 1 + examples/system/dynlink/library/balls.c | 2 +- examples/system/dynlink/library/cube.c | 2 +- examples/system/dynlink/library/dll_common.h | 1 + examples/system/dynlink/main.c | 3 +-- indev/psxmdec/main.c | 2 +- indev/psxpad/main.c | 1 - libpsn00b/include/malloc.h | 14 ++------------ libpsn00b/include/stdint.h | 16 ++++++++++++++++ libpsn00b/include/stdlib.h | 28 +++++++++------------------- libpsn00b/include/sys/types.h | 16 ++++------------ libpsn00b/libc/c++-support.cxx | 3 +-- libpsn00b/libc/string.c | 2 +- libpsn00b/lzp/compress.c | 1 - libpsn00b/psxcd/isofs.c | 2 +- libpsn00b/psxetc/dl.c | 4 ++-- libpsn00b/psxgpu/font.c | 2 +- tools/util/elf2cpe.c | 2 +- 25 files changed, 48 insertions(+), 66 deletions(-) create mode 100644 libpsn00b/include/stdint.h (limited to 'examples/beginner/cppdemo') diff --git a/examples/beginner/cppdemo/main.cpp b/examples/beginner/cppdemo/main.cpp index 58bfcda..fd2e3a8 100644 --- a/examples/beginner/cppdemo/main.cpp +++ b/examples/beginner/cppdemo/main.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include diff --git a/examples/cdrom/cdbrowse/main.c b/examples/cdrom/cdbrowse/main.c index ead2df0..9a1dbd0 100644 --- a/examples/cdrom/cdbrowse/main.c +++ b/examples/cdrom/cdbrowse/main.c @@ -67,7 +67,6 @@ #include #include -#include #include "ball16c.h" diff --git a/examples/cdrom/cdxa/main.c b/examples/cdrom/cdxa/main.c index 16f1c82..5f11d8d 100644 --- a/examples/cdrom/cdxa/main.c +++ b/examples/cdrom/cdxa/main.c @@ -129,7 +129,6 @@ #include #include -#include #include "ball16c.h" diff --git a/examples/demos/n00bdemo/logo.c b/examples/demos/n00bdemo/logo.c index d10b5b4..40160e7 100644 --- a/examples/demos/n00bdemo/logo.c +++ b/examples/demos/n00bdemo/logo.c @@ -5,7 +5,6 @@ #include #include #include -#include "malloc.h" #include "smd.h" #include diff --git a/examples/demos/n00bdemo/main.c b/examples/demos/n00bdemo/main.c index e9dd336..d2fe317 100644 --- a/examples/demos/n00bdemo/main.c +++ b/examples/demos/n00bdemo/main.c @@ -32,7 +32,6 @@ #include #include -#include "malloc.h" #include "smd.h" #include "data.h" #include "disp.h" diff --git a/examples/io/pads/main.c b/examples/io/pads/main.c index ea7219b..92beb1c 100644 --- a/examples/io/pads/main.c +++ b/examples/io/pads/main.c @@ -23,7 +23,7 @@ * zerofilled responses, slow replies) for maximum compatibility. */ -#include +#include #include #include #include diff --git a/examples/io/pads/spi.c b/examples/io/pads/spi.c index 5fc2648..e01b3f6 100644 --- a/examples/io/pads/spi.c +++ b/examples/io/pads/spi.c @@ -26,9 +26,9 @@ * card APIs) alongside it. */ -#include +#include #include -#include +#include #include #include #include diff --git a/examples/io/pads/spi.h b/examples/io/pads/spi.h index 09223e2..1c473cd 100644 --- a/examples/io/pads/spi.h +++ b/examples/io/pads/spi.h @@ -6,6 +6,7 @@ #ifndef __SPI_H #define __SPI_H +#include #include //#define SPI_BUFF_LEN 34 diff --git a/examples/system/dynlink/library/balls.c b/examples/system/dynlink/library/balls.c index 2a4d9f4..ef6993e 100644 --- a/examples/system/dynlink/library/balls.c +++ b/examples/system/dynlink/library/balls.c @@ -3,7 +3,7 @@ * (C) 2021 spicyjpeg - MPL licensed */ -#include +#include #include #include #include diff --git a/examples/system/dynlink/library/cube.c b/examples/system/dynlink/library/cube.c index 57f3e56..84fe552 100644 --- a/examples/system/dynlink/library/cube.c +++ b/examples/system/dynlink/library/cube.c @@ -3,7 +3,7 @@ * (C) 2021 spicyjpeg - MPL licensed */ -#include +#include #include #include #include diff --git a/examples/system/dynlink/library/dll_common.h b/examples/system/dynlink/library/dll_common.h index 4f9314b..315a993 100644 --- a/examples/system/dynlink/library/dll_common.h +++ b/examples/system/dynlink/library/dll_common.h @@ -6,6 +6,7 @@ #ifndef __DLL_COMMON_H #define __DLL_COMMON_H +#include #include /* Common structures shared by the main executable and DLLs */ diff --git a/examples/system/dynlink/main.c b/examples/system/dynlink/main.c index 33f6f44..6d93e71 100644 --- a/examples/system/dynlink/main.c +++ b/examples/system/dynlink/main.c @@ -36,12 +36,11 @@ * as plugins/mods/patches stored on a memory card. */ -#include +#include #include #include #include #include -#include #include #include #include diff --git a/indev/psxmdec/main.c b/indev/psxmdec/main.c index c9fd678..f4f0f51 100644 --- a/indev/psxmdec/main.c +++ b/indev/psxmdec/main.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include diff --git a/indev/psxpad/main.c b/indev/psxpad/main.c index e8a6181..afd801e 100644 --- a/indev/psxpad/main.c +++ b/indev/psxpad/main.c @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include diff --git a/libpsn00b/include/malloc.h b/libpsn00b/include/malloc.h index d94823f..75c3711 100644 --- a/libpsn00b/include/malloc.h +++ b/libpsn00b/include/malloc.h @@ -1,18 +1,8 @@ #ifndef _MALLOC_H #define _MALLOC_H -#ifdef __cplusplus -extern "C" { -#endif +#warning " is deprecated, include instead" -unsigned int *GetBSSend(); -void InitHeap(unsigned int *addr, int size); -int SetHeapSize(int size); -void *malloc(int size); -void free(void *ptr); - -#ifdef __cplusplus -} -#endif +#include #endif // _MALLOC_H \ No newline at end of file diff --git a/libpsn00b/include/stdint.h b/libpsn00b/include/stdint.h new file mode 100644 index 0000000..83acb00 --- /dev/null +++ b/libpsn00b/include/stdint.h @@ -0,0 +1,16 @@ +#ifndef _STDINT_H +#define _STDINT_H + +typedef unsigned int size_t; + +typedef char int8_t; +typedef short int16_t; +typedef int int32_t; +typedef long long int64_t; + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; + +#endif // _STDINT_H \ No newline at end of file diff --git a/libpsn00b/include/stdlib.h b/libpsn00b/include/stdlib.h index 474eba6..de3ab47 100644 --- a/libpsn00b/include/stdlib.h +++ b/libpsn00b/include/stdlib.h @@ -19,34 +19,16 @@ extern long atol(char *s); extern char atob(char *s); // Is this right? */ -// Random number functions (not yet implemented) - -/* -int rand(); -void srand(unsigned int seed); -*/ - // Quick sort (not yet implemented) //void qsort(void *base , int nel , int width , int (*cmp)(const void *,const void *)); -// Memory allocation functions (not yet implemented, avoid using BIOS as they are reportedly buggy) - -/* -#warning "malloc() family of functions NEEDS MORE TESTING" - -void *malloc(int size); -void free(void *buf); -void *calloc(int number, int size); -void *realloc(void *buf , int n); -*/ - #ifdef __cplusplus extern "C" { #endif extern int __argc; -extern char __argv[]; +extern const char **__argv; int rand(); void srand(unsigned long seed); @@ -64,6 +46,14 @@ long atol(const char *s); double strtod(const char *nptr, char **endptr); float strtof(const char *nptr, char **endptr); +// Memory allocation functions +unsigned int *GetBSSend(); +void InitHeap(unsigned int *addr, int size); +int SetHeapSize(int size); +void *malloc(int size); +void *calloc(int number, int size); +void free(void *ptr); + #ifdef __cplusplus } #endif diff --git a/libpsn00b/include/sys/types.h b/libpsn00b/include/sys/types.h index aee197e..da43590 100644 --- a/libpsn00b/include/sys/types.h +++ b/libpsn00b/include/sys/types.h @@ -1,21 +1,13 @@ #ifndef _TYPES_H #define _TYPES_H +//#warning " and u_* types are deprecated, include instead" + +//#include + typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; -typedef unsigned int size_t; - -typedef char int8_t; -typedef short int16_t; -typedef int int32_t; -typedef long long int64_t; - -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long long uint64_t; - #endif // _TYPES_H \ No newline at end of file diff --git a/libpsn00b/libc/c++-support.cxx b/libpsn00b/libc/c++-support.cxx index fcf7cfc..d169fdb 100644 --- a/libpsn00b/libc/c++-support.cxx +++ b/libpsn00b/libc/c++-support.cxx @@ -1,7 +1,6 @@ #include -#include +#include #include -#include extern "C" diff --git a/libpsn00b/libc/string.c b/libpsn00b/libc/string.c index e11ed67..445b227 100644 --- a/libpsn00b/libc/string.c +++ b/libpsn00b/libc/string.c @@ -6,7 +6,7 @@ #include #include -#include +#include int tolower(int chr) { diff --git a/libpsn00b/lzp/compress.c b/libpsn00b/lzp/compress.c index 5969dd6..9cfc64d 100644 --- a/libpsn00b/lzp/compress.c +++ b/libpsn00b/lzp/compress.c @@ -3,7 +3,6 @@ #include #if LZP_USE_MALLOC == TRUE #include -#include #endif #include "lzconfig.h" diff --git a/libpsn00b/psxcd/isofs.c b/libpsn00b/psxcd/isofs.c index dc0c5ca..40a40af 100644 --- a/libpsn00b/psxcd/isofs.c +++ b/libpsn00b/psxcd/isofs.c @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include diff --git a/libpsn00b/psxetc/dl.c b/libpsn00b/psxetc/dl.c index 586e7e1..e43374f 100644 --- a/libpsn00b/psxetc/dl.c +++ b/libpsn00b/psxetc/dl.c @@ -23,9 +23,9 @@ * of entries */ -#include +#include #include -#include +#include #include #include #include diff --git a/libpsn00b/psxgpu/font.c b/libpsn00b/psxgpu/font.c index 7d0dd89..4c715a9 100644 --- a/libpsn00b/psxgpu/font.c +++ b/libpsn00b/psxgpu/font.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include diff --git a/tools/util/elf2cpe.c b/tools/util/elf2cpe.c index 46b0a37..210f25b 100644 --- a/tools/util/elf2cpe.c +++ b/tools/util/elf2cpe.c @@ -1,6 +1,6 @@ #include #include -#include +#include #include "elf.h" #ifdef WIN32 -- cgit v1.2.3