aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspicyjpeg <thatspicyjpeg@gmail.com>2022-12-18 16:19:31 +0100
committerspicyjpeg <thatspicyjpeg@gmail.com>2022-12-18 16:19:31 +0100
commita3359c0e7d85bf4752cda3b00892ecd5ef691077 (patch)
tree5888e4a77b207f24ccd9ad148d1c74e9c33400e9
parentb58a37bdac753ceace35761ef474c198a3f18e12 (diff)
downloadpsn00bsdk-a3359c0e7d85bf4752cda3b00892ecd5ef691077.tar.gz
Bump to v0.22, update CMake scripts and docs
-rw-r--r--CHANGELOG.md31
-rw-r--r--CMakeLists.txt2
-rw-r--r--cpack/setup.cmake12
-rw-r--r--doc/cmake_reference.md46
-rw-r--r--doc/known_bugs.md7
-rw-r--r--libpsn00b/cmake/flags.cmake16
-rw-r--r--libpsn00b/cmake/internal_setup.cmake47
7 files changed, 107 insertions, 54 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d6b49e9..74395d0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,37 @@ to ensure the changelog can be parsed correctly.
-------------------------------------------------------------------------------
+# 2022-12-18: 0.22
+
+spicyjpeg:
+
+- libc: Fixed `assert()` macro and removed redundant type definitions. Added
+ GTE-accelerated leading zero count intrinsics (`__builtin_clz()`).
+
+- psxcd: Rewritten some parts of the library in pure C. Added `CdCommand()` and
+ `CdCommandF()` for advanced usage of the CD-ROM, as well as `CdReadRetry()`,
+ `CdReadBreak()` and `CdGetRegion()`.
+
+- psxgpu: `PutDrawEnv()` and `DrawOTagEnv()` now properly apply the texture
+ page and window attributes in the `DRAWENV` structure. RECTs passed to
+ `LoadImage()` and `StoreImage()` are now copied into a private buffer. Added
+ `setColor*()` macros.
+
+- psxspu: Fixed setting of bus wait states when using `SpuRead()`.
+
+- psxetc: Fixed several critical bugs in the dynamic linker. GOT relocation and
+ linking of variables and objects are now handled properly.
+
+- psxapi: Added `FastEnterCriticalSection()` and `FastExitCriticalSection()`
+ inline macros for quick enabling and disabling of interrupts.
+
+- Renamed some registers in `hwregs_c.h`, `hwregs_a.inc` and updated examples
+ accordingly.
+
+- All projects are now compiled with `-Og` in debug mode and `-O2` in release
+ mode by default. CD images created using `psn00bsdk_add_cd_image()` are now
+ only rebuilt if necessary (i.e. if any of their dependencies change).
+
# 2022-10-27
spicyjpeg:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3ce6573..19050f8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,7 +12,7 @@ include(ExternalProject)
project(
PSn00bSDK
LANGUAGES NONE
- VERSION 0.21
+ VERSION 0.22
DESCRIPTION "Open source PlayStation 1 SDK"
HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk"
)
diff --git a/cpack/setup.cmake b/cpack/setup.cmake
index d585641..1d66066 100644
--- a/cpack/setup.cmake
+++ b/cpack/setup.cmake
@@ -101,16 +101,16 @@ endif()
## Variables common to all package types
if(NOT DEFINED CPACK_GENERATOR)
- if(WIN32)
- set(CPACK_GENERATOR ZIP NSIS)
- elseif(APPLE)
+ #if(WIN32)
+ #set(CPACK_GENERATOR ZIP NSIS)
+ #elseif(APPLE)
# TODO: add a macOS installer and related options
- set(CPACK_GENERATOR ZIP)
+ #set(CPACK_GENERATOR ZIP)
#elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
#set(CPACK_GENERATOR ZIP DEB RPM)
- else()
+ #else()
set(CPACK_GENERATOR ZIP)
- endif()
+ #endif()
endif()
set(CPACK_VERBATIM_VARIABLES ON)
diff --git a/doc/cmake_reference.md b/doc/cmake_reference.md
index bceaac9..ef3f5dc 100644
--- a/doc/cmake_reference.md
+++ b/doc/cmake_reference.md
@@ -172,33 +172,31 @@ psn00bsdk_add_cd_image(
```
Creates a new virtual target that will build a CD image using `mkpsxiso`. The
-CD image will always be considered out-of-date and built, even if none of its
-dependencies or any other files have been modified.
-
-The first argument is the name of the target to create; next up is the name of
-the generated image file (`<image name>.bin` + `<image name>.cue`). The third
-argument is the path to the XML file (relative to the source directory) passed
-to `mkpsxiso`.
+CD image will be added to the top-level target and rebuilt automatically if any
+of its dependencies have been modified since the last build.
+
+The first argument is the name of the target to create and associate with the
+CD image. This target does not actually build the image but depends on it,
+ensuring CMake will build it if necessary. Note that the target, along with any
+other targets depending on it, are always considered out-of-date by CMake
+*even if the CD image is actually up-to-date*.
+
+The second argument specifies the name of the generated image files
+(`<image name>.bin` + `<image name>.cue`) and is followed to the path to the
+XML file (relative to the source directory) to be passed to `mkpsxiso`. Note
+that the `image_name` and `cue_sheet` fields specified in the `<iso_project>`
+root tag (see `mkpsxiso` documentation) are ignored and overridden by the image
+name provided.
The XML file is "configured" by CMake, i.e. any `${var}` or `@var@` expressions
-are replaced with the values of the respective variables. In particular
-`${CD_IMAGE_NAME}` is replaced with the second argument passed to
-`psn00bsdk_add_cd_image()`; the file must properly set the output file names
-like this:
-
-```xml
-<?xml version="1.0" encoding="utf-8"?>
-<iso_project
- image_name="${CD_IMAGE_NAME}.bin"
- cue_sheet="${CD_IMAGE_NAME}.cue"
->
- <!-- ... -->
-</iso_project>
-```
+are replaced with the values of the respective CMake variables. Paths to source
+files are interpreted as relative to the build directory. In order to include a
+file from the source directory, `${PROJECT_SOURCE_DIR}` shall be prepended to
+the path specified in the XML file (e.g. `${PROJECT_SOURCE_DIR}/system.cnf`).
Any additional argument is passed through to the underlying call to
-`add_custom_target()`, so most of the options supported by
-`add_custom_target()` (including `DEPENDS`) are also supported here.
+`add_custom_command()`, so most of the options supported by
+`add_custom_command()` (including `DEPENDS`) are also supported here.
### `psn00bsdk_target_incbin`
@@ -396,4 +394,4 @@ CMake's `add_custom_command()` and `add_custom_target()` to convert models and
generate LZP archives as part of the build pipeline.
-----------------------------------------
-_Last updated on 2022-10-11 by spicyjpeg_
+_Last updated on 2022-12-18 by spicyjpeg_
diff --git a/doc/known_bugs.md b/doc/known_bugs.md
index 5aabaf1..40b3c32 100644
--- a/doc/known_bugs.md
+++ b/doc/known_bugs.md
@@ -37,9 +37,14 @@ fixed.
due to the SPU status register being emulated incorrectly. They work as
expected on other emulators as well as on real hardware.
+`psxcd`:
+
+- The library seems to get into an unpredictable state when removing discs on
+ pcsx-redux (and possibly real hardware?).
+
## Examples
See [README.md in the examples directory](../examples/README.md#examples-summary).
-----------------------------------------
-_Last updated on 2022-10-30 by spicyjpeg_
+_Last updated on 2022-12-18 by spicyjpeg_
diff --git a/libpsn00b/cmake/flags.cmake b/libpsn00b/cmake/flags.cmake
index 1ca25c2..fdc479e 100644
--- a/libpsn00b/cmake/flags.cmake
+++ b/libpsn00b/cmake/flags.cmake
@@ -14,7 +14,6 @@ target_compile_options(
# Options common to all target types
-g
-Wa,--strip-local-absolute
- -O2
-ffreestanding
-fno-builtin
-nostdlib
@@ -29,7 +28,6 @@ target_compile_options(
-mabi=32
-mno-mt
-mno-llsc
- -mdivide-breaks
$<$<COMPILE_LANGUAGE:CXX>:
# Options common to all target types (C++)
-fno-exceptions
@@ -38,6 +36,14 @@ target_compile_options(
-fno-threadsafe-statics
-fno-use-cxa-atexit
>
+ $<IF:$<CONFIG:Debug>,
+ # Options for debug builds
+ -Og
+ -mdivide-breaks
+ ,
+ # Options for release builds
+ -O2
+ >
$<$<STREQUAL:$<UPPER_CASE:$<TARGET_PROPERTY:PSN00BSDK_TARGET_TYPE>>,EXECUTABLE_GPREL>:
# Options for executables with $gp-relative addressing
-G8
@@ -86,5 +92,9 @@ target_link_options(
target_compile_definitions(
psn00bsdk INTERFACE
PSN00BSDK=1
- $<$<CONFIG:Release>:NDEBUG=1>
+ $<IF:$<CONFIG:Debug>,
+ #NDEBUG=0
+ ,
+ NDEBUG=1
+ >
)
diff --git a/libpsn00b/cmake/internal_setup.cmake b/libpsn00b/cmake/internal_setup.cmake
index b21451e..9e7a4d3 100644
--- a/libpsn00b/cmake/internal_setup.cmake
+++ b/libpsn00b/cmake/internal_setup.cmake
@@ -173,6 +173,7 @@ function(psn00bsdk_add_executable name type)
#$<${_repl},${PSN00BSDK_SYMBOL_MAP_SUFFIX}>
${CMAKE_CURRENT_BINARY_DIR}/${name}${PSN00BSDK_EXECUTABLE_SUFFIX}
${CMAKE_CURRENT_BINARY_DIR}/${name}${PSN00BSDK_SYMBOL_MAP_SUFFIX}
+ #VERBATIM
)
endfunction()
@@ -200,6 +201,7 @@ function(psn00bsdk_add_library name type)
$<SHELL_PATH:${CMAKE_CURRENT_BINARY_DIR}/${name}${PSN00BSDK_SHARED_LIBRARY_SUFFIX}>
#BYPRODUCTS $<${_repl},${PSN00BSDK_SHARED_LIBRARY_SUFFIX}>
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/${name}${PSN00BSDK_SHARED_LIBRARY_SUFFIX}
+ VERBATIM
)
else()
message(FATAL_ERROR "Invalid library type: ${type} (must be STATIC, OBJECT, SHARED or MODULE)")
@@ -209,8 +211,8 @@ endfunction()
## Linking helpers
function(psn00bsdk_target_incbin_a name type symbol_name size_name path section align)
- string(MAKE_C_IDENTIFIER ${symbol_name} _id)
- string(MAKE_C_IDENTIFIER ${size_name} _size)
+ string(MAKE_C_IDENTIFIER "${symbol_name}" _id)
+ string(MAKE_C_IDENTIFIER "${size_name}" _size)
cmake_path(ABSOLUTE_PATH path OUTPUT_VARIABLE _path)
string(SHA1 _hash "${name} ${_id}")
@@ -223,11 +225,12 @@ function(psn00bsdk_target_incbin_a name type symbol_name size_name path section
CONFIGURE
OUTPUT ${_asm_file}
CONTENT [[
-.section ${section}
+.section ${section}.${_id}, "aw"
.balign ${align}
.global ${_id}
.type ${_id}, @object
+.size ${_id}, (${_id}_end - ${_id})
${_id}:
.incbin "${_path}"
@@ -235,34 +238,32 @@ ${_id}:
${_id}_end:
.balign ${align}
+
+.section ${section}.${_size}, "aw"
.balign 4
.global ${_size}
.type ${_size}, @object
+.size ${_size}, 4
${_size}:
.int (${_id}_end - ${_id})
-
-.size ${_id}, (${_id}_end - ${_id})
-.size ${_size}, 4
]]
ESCAPE_QUOTES
NEWLINE_STYLE LF
)
target_sources(${name} ${type} ${_asm_file})
- set_source_files_properties(${_asm_file} PROPERTIES OBJECT_DEPENDS ${_path})
+ set_source_files_properties(${_asm_file} PROPERTIES OBJECT_DEPENDS "${_path}")
endfunction()
function(psn00bsdk_target_incbin name type symbol_name path)
- string(MAKE_C_IDENTIFIER ${symbol_name} _id)
-
psn00bsdk_target_incbin_a(
${name}
${type}
- ${_id}
- ${_id}_size
- ${path}
- .data.${_id}
+ "${symbol_name}"
+ "${symbol_name}_size"
+ "${path}"
+ .data
4
)
endfunction()
@@ -280,14 +281,22 @@ function(psn00bsdk_add_cd_image name image_name config_file)
cmake_path(HASH config_file _hash)
set(CD_IMAGE_NAME ${image_name})
- set(CD_CONFIG_FILE cd_image_${_hash}.xml)
- configure_file(${config_file} ${CD_CONFIG_FILE})
+ set(CD_CONFIG_FILE ${CMAKE_CURRENT_BINARY_DIR}/cd_image_${_hash}.xml)
+ configure_file("${config_file}" ${CD_CONFIG_FILE})
+ add_custom_command(
+ OUTPUT ${CD_IMAGE_NAME}.bin ${CD_IMAGE_NAME}.cue
+ COMMAND
+ ${MKPSXISO} -y
+ -o ${CD_IMAGE_NAME}.bin -c ${CD_IMAGE_NAME}.cue ${CD_CONFIG_FILE}
+ COMMENT "Building CD image ${CD_IMAGE_NAME}"
+ VERBATIM
+ ${ARGN}
+ )
add_custom_target(
${name} ALL
- COMMAND ${MKPSXISO} -y ${CD_CONFIG_FILE}
- BYPRODUCTS ${image_name}.bin ${image_name}.cue
- COMMENT "Building CD image ${image_name}"
- ${ARGN}
+ DEPENDS
+ ${CMAKE_CURRENT_BINARY_DIR}/${CD_IMAGE_NAME}.bin
+ ${CMAKE_CURRENT_BINARY_DIR}/${CD_IMAGE_NAME}.cue
)
endfunction()