Releases: blocksds/sdk
Version 1.7.0
IMPORTANT NOTICE
If you're updating your previous BlocksDS installation with wf-pacman
, run this command twice instead of once:
wf-pacman -Syu
This is required because of the new repository that contains the BlocksDS pacman packages.
Changelog
-
libnds:
- An exception handler has been added to the ARM7. This one is a lot less useful than the ARM9 one because it's only called on undefined instructions and internal libnds errors.
- Add
dldiRelocate()
, which allows relocating a DLDI driver to a different memory address. - Fix DLDI memory pointers not being relocated for non-BSS/noinit areas.
- Update FatFs to R0.15a.
glColorSubTableEXT()
now supports allocating empty palettes by passing a NULL pointer in thetable
argument. This is a small compatibility break because this used to free the palette. However, the old behaviour stays as long aswidth
is 0. In most cases,table
would be NULL andwidth
would be 0, so this change is only a problem in unusual cases.- Disable MPU safely before calling the exit-to-loader ARM9 hook in case the hook doesn't do it properly.
-
maxmod:
- Remove non-standard
.struct
directives.
- Remove non-standard
-
SDK:
-
picolibc:
- Add
asnprintf()
andvasnprintf()
, matching newlib. - Fix memory leak in
asprintf()
andvasprintf()
.
- Add
-
Docker:
- curl has been added to both the development and slim images.
- Add new BlocksDS pacman repository during setup.
-
pacman:
-
The pacman server of BlocksDS is now independent from Wonderful Toolchain.
-
The repository with the package build files is now in the BlocksDS GitHub organization in this URL: https://github.com/blocksds/packages
-
BlocksDS still uses Wonderful Toolchain as source for the compiler and the standard C and C++ libraries. It will keep using wf-pacman for the forseeable future as well.
-
Special thanks to asie for all his help.
-
Updating old installations requires the user to run the following commands:
wf-pacman -Sy wf-pacman wf-pacman -Syu wf-pacman -Syu
-
-
New libraries are now available as pacman packages (µLibrary, libwoopsi, dsmi) as well as the tool ptexconv.
-
The GitHub pipeline of the SDK repository has been removed and added to the packages repository.
-
-
Documentation:
- Update documentation with the instructions to use the new pacman repository.
- Some outdated licensing information has been updated.
- The docs generation script has been split into a script that generates it and a script that pushes the built documentation to the repository.
- The updating guide has been updated for versions between 1.3.0 and 1.7.0.
-
Examples:
- New example of gesture recognition using the $N Multistroke Recognizer.
- New example of how to use CMake to build a project with BlocksDS.
- Update the exception handler example to also support triggering ARM7 exceptions.
-
Other:
- BlocksDS now has a dedicated URL (https://blocksds.skylyrac.net/) which means that it doesn't rely on GitHub URLs anymore. This main page redirects to the documentation, GitHub organization, and a NDS homebrew development manual.
- A new prototype CMake build system has been added to the repository.
CC
makefile variables have been renamed toHOSTCC
when they refer to building host tools. This will make it possible to overwrite the host toolchain without also overwriting the ARM toolchain.- Use standard C types and fix includes in mkfatimg.
- bin2c now has an option (
--noext
) that lets it export files excluding the extension from the name, the way some very old homebrew projects expect it. - Some sample defines have been added to the makefiles of the templates to clarify its syntax.
-
Version 1.6.3
-
libnds:
- Add compile-time warnings about unused result values to various library methods.
- Ensure
nitroFSInit()
checks for successful FAT initialization. - Protect the alternate vector base region (
0x0000000
onwards) from writing and, if said base is not explicitly enabled, reading. This allows catching null pointer accesses at runtime as data aborts.
-
SDK:
-
crt0:
- Fix thread-local storage not being initialized properly during global constructor initialization.
- Fix thread-local storage not being initialized at all on ARM7.
-
picolibc:
- Add
memset_explicit()
. - Improve wctype compatibility.
- Update ctype case conversion table to Unicode 15.1.0 .
- Add
-
Other:
- Add regression test for
setVectorBase()
. - Modify templates to use toolchain
gcc-ar
over hostar
for packaging libraries; this ensures correct operation on systems withoutbinutils
installed, as well as when building libraries with link-time optimized objects. - Update ARM assembly code to always use UAL syntax.
- Update official Docker image to Ubuntu 24.04.
- Add regression test for
-
Version 1.6.2
-
libnds:
-
Filesystem:
- Fixed a bug involving incorrect reads of recently written sectors.
-
-
SDK:
-
Changes to examples:
- Clean the 8-bit double-buffered bitmap example.
-
Other:
- Improve FAQ and updating guide.
-
Version 1.6.1
-
libnds:
-
Filesystem:
- This version was supposed to include a fix for a bug involving incorrect reads of recently written sectors, but the submodule wasn't updated correctly so the fix was left out.
-
Version 1.6.0
-
libnds:
-
Peripherals:
- Add support for the "retail" (ATTiny-based) Motion Pack accelerometer to the DS Motion Card/Pak driver.
- Clean up the DS Motion Card/Pak driver.
- Fix the DS Motion Card driver not working on DSi consoles.
- Fix the solar sensor not being detected on Boktai 1 cartridges.
- Fix
peripheralSlot2SolarScanFast()
not working correctly.
-
GL2D:
- Fix off-by-one errors when drawing textures with GL2D when the textures aren't flipped.
- Reorganize GL2D setup code to reduce code duplication.
-
Other:
- Fix return types and improve performance of integer square root helpers.
- In
initSystem()
, fix video register clearing ranges and remove redundant VRAM configuration. - The GRF "HDR" RIFF chunk has been deprecated and it has been replaced by a new chunk called "HDRX", which is exactly the same, but it includes a version field so that it is future-proof.
- Fix some issues that prevented LLVM from building the library. Add missing arguments to UDF instructions in the codebase. Add some explicit casts. Use
inttypes.h
definitions inprintf()
instead of explicit size modifiers. - Fix undefined behaviour warnings due to left shifts of signed integers.
-
-
grit:
- Update GRF export code to match the new format used by libnds.
-
ndstool:
- Use
git describe
output as version string instead of a hardcoded outdated version number.
- Use
-
SDK:
-
crt0 and linker script files:
- It is now possible to place DTCM variables and data at the end of DTCM instead of the beginning. This means the stack can grow downwards without affecting the variables at the beginning of DTCM. This is done by setting the value of the new symbol
__dtcm_data_size
to a non-zero value. The linker will helpfully point out if the data area is too small for a given program. - The user-configurable symbol
__shared_wram_size
has been added. - Assertions have been added to check that the user-defined sizes produce a valid executable.
- Support for
.noinit
sections has been added. - Missing copyright notices have been added to linker scripts.
- Minor cleanups and adjustments have been done to the crt0 code.
- It is now possible to place DTCM variables and data at the end of DTCM instead of the beginning. This means the stack can grow downwards without affecting the variables at the beginning of DTCM. This is done by setting the value of the new symbol
-
picolibc:
- Add implementation of
<uchar.h>
. - Improve
powf()
accuracy.
- Add implementation of
-
Documentation:
- Provide information about the build process of .nds files.
- Add a FAQ to the documentation.
- Add IRC channels to the support channels page.
- Add notes about what to do after installing BlocksDS.
- Credit all known contributors to all repositories of BlocksDS.
-
Examples:
- Add NDS Motion card example.
- Add example of scaling and rotating GL2D sprites.
- Add
inttypes.h
include in some examples that require it after picolibc changes.
-
Version 1.5.0
-
libnds:
-
Exception handling:
- Add trivial crash handler to inform the user of unrecoverable error conditions, such as stack corruptions with stack smash protection enabled.
- Add trivial release exception handler to inform the user of data aborts and other exception conditions even in release builds. This is enabled by default; this implementation omits stack and register dumps, making the
.nds
size increase negligible. - Tweak default exception handler to use a darker red for the background.
-
Filesystem:
- Fix using Slot-2 direct access on
.nds
files over 32 MB. In particular, this fixes accessing large NitroFS filesystems under NO$GBA.
- Fix using Slot-2 direct access on
-
GRF loader:
- Improve performance by using fast
memcpy()
overswiCopy()
. - Rework loader to only read requested chunks from the filesystem, as opposed to reading all chunks and filtering them at a later stage.
- Improve performance by using fast
-
Sound:
- Add functions to play PSG, noise and sound samples on specific channels.
- Add
soundCaptureStart
andsoundCaptureStop
high-level helpers for the sound capture functionality.
-
Other:
- Add additional error checks to NitroFS and GRF functions.
- Add unused result warnings to functions which can cause memory leaks if their result is not deallocated.
- Document high-level DSi camera functions.
- Fix console 'K' ANSI escape code not clearing characters on the line.
- Fix includes for the latest picolibc commits.
-
-
SDK:
-
New examples:
- Add ANSI escape code tests.
- Add sound capture example.
-
Changes to examples:
- Add
.MOD
files to LibXM7 examples. - Add missing
fclose()
error checks. - Adjust examples using GRF files to showcase the loader's built-in asset decompression functionality.
- Clean up camera and LibXM7 examples.
- Add
-
picolibc:
- Add support for C11 Annex K functions (
_s
-suffixed functions). - Deprecate BSD-specific
<sys/tree.h>
. - Fix handling
NaN
inscanf()
andstrtod()
. - Fix return values for
glob()
. - Fix the
FD_ZERO()
macro. - Initial support for POSIX.1-2024 in header files.
- Other minor header file cleanups.
- Replace
<_ansi.h>
with<sys/cdefs.h>
.
- Add support for C11 Annex K functions (
-
Other:
- Fix support for placing the Maxmod soundbank file in the NitroFS file system.
- Make the SD card root directory configurable in default Makefile templates.
- Remove Teak LLVM from the
-slim
Docker image. Most people don't need this toolchain, as it is in a highly experimental and unmaintained state; in addition, removing it from the image does not prevent people from installing it on top, but significantly reduces the download size for everyone else. - Remove usage of
__DATE__
in teaktool.
-
Version 1.4.0
-
libnds:
-
Console:
- Fix 'D' ANSI escape code, which was broken in version 1.3.1.
- Document console struct fields. Some of them are only meant to be used by libnds, which has been documented.
- The size of some fields in the console struct has been reduced, and the fields have been reordered to reduce padding in the struct. Some fields were unused, and they have been removed.
- Now it's possible to specify the 16-color palette to be used when loading custom fonts with their own palette.
fontCharOffset
now works, which means that it is possible to specify that a font should be loaded after another font, so that two fonts can use the same tile block and save VRAM.- In order to be able to specify the palette and the
fontCharOffset
, a new function has been created:consoleInitEx()
. - Mark the defaultConsole struct as const. It is needed to keep that data untouched because the user may initialize the default console several times in a program, and it's important to be able to return to the right initial state.
- Some variables have been made private.
- When a character outside of the character set of the font is printed, a space is now printed instead. Previously, it printed tiles outside of the font, which could result in garbage being printed on the screen.
- New functions have been added to control the console without using awkward ANSI escape sequences:
consoleSetCursor()
,consoleGetCursor()
,consoleAddToCursor()
andconsoleSetColor()
.
-
Keyboard:
- Make custom keyboards work. This seems to have never worked because libnds overwrote the custom keyboard struct with the default keyboard struct.
- Keyboard struct fields have been refactored. Some field sizes are now smaller, some fields are now const. The order has been changed to reduce padding between fields and save even more RAM.
- Ensure that the keyboard is always initialized to the right state with
keyboardShow()
. This lets you make a keyboard start in uppercase or lowercase state depending on your preferences. - Prevent keyboard functions from hanging if no keyboard is actually visible.
-
Other:
- Fix crash when calling
peripheralSlot2InitDefault()
in a DSi retail unit. This didn't happen in DS, or in debugger DSi units. - Add helper to tell the GPU to apply fog to the clear buffer.
- Flush RAM before copying console graphics to VRAM.
- Implement
assert()
in the ARM9 and ARM7. In the ARM9 it works likesassert()
, in the ARM7 it prints a no$gba debug message. - Clarify some comments about decompression routines of the BIOS.
- Stop using ANSI escape sequences everywhere. Use direct console API functions instead, which are more self-explanatory.
- The functions
sysGetCartOwner()
andsysGetCardOwner()
have been added to be able to check the CPU owner of the Slot-1 and Slot-2 buses. - Add documentation to some functions without it, and fix some Doxygen comments.
- Fix crash when calling
-
-
DSWiFi:
- Stop generating
dswifi_version.h
as part of the build process. - Some warnings have been fixed.
- Stop generating
-
LibXM7:
- Fix a crash when unloading MOD files.
-
ndstool:
- Fix NitroFS filesystem corruption when no banner is generated.
-
grit:
- Fix
libplum
build error with LLVM.
- Fix
-
mmutil:
- Fix some incorrect types.
-
SDK:
-
New examples:
- Using fog in a 3D scene.
- Sorting 3D translucent objects based on their distance to the camera and drawing them in the correct order.
- How to use Maxmod song events.
- How to stream a WAV file from the filesystem using Maxmod.
- How to use the sound API of libnds to play PSG, noise and PCM audio.
- How to use custom keyboards with libnds.
-
Changes to examples:
- The basic Maxmod example now also shows how to play sound effects.
- The example that loads custom fonts with the libnds console has been improved to load 2 fonts with custom 16-color graphics on one screen and one font with 256-color graphics on the other one.
- Examples and test now don't use ANSI escape sequences. This makes the code a lot harder to understand.
-
Other:
- Add page to the documentation about how to debug programs with libnds.
- dlditool: Use
stdbool.h
instead of a custom boolean type. - Doxygen comments have been reorganized in all repositories so that they are uniform across all the codebase.
- All Doxyfiles have been updated.
-
Version 1.3.1
-
libnds:
- Added memory barriers to libnds functions which remap user-accessible memory.
consolePrintChar()
has been exposed in the public API. Coupled with internal refactors, this allows using the built-in console without pulling in printf/scanf as a dependency.- Fixed function parameters and improved parameters for BIOS RSA functions.
- Fixed potential memory corruption when
micStopRecording()
was called twice. - Fixed regression in new touchscreen driver on CDC (TWL).
- Improved documentation for the BIOS CRC-16 calculation function.
- Minor optimizations to videoGL and console code.
-
SDK:
-
New examples:
- Added a 3D billboard drawing example.
- Added a 3D spot lights example.
- Added a 3D two-pass rendering example.
- Added a BIOS bit unpacking example.
- Added a BIOS CRC-16 calculation example.
- Added a BIOS RSA decruption example.
- Added a microphone recording example.
- Added a Maxmod audio modes example.
- Added a Maxmod reverb example.
- Fixed a regression in the exception handler example.
-
picolibc:
- The bundled version of picolibc has been updated.
- Added an implementation of
posix_memalign()
. - Added support for
%a
and%A
formats inscanf()
. - Fixed
freopen()
not resetting the unget buffer. - Fixed hexadecimal string conversion in
strtod()
,strtof()
andstrtold()
. - Fixed
lgammal()
corrupting the application-definedsigngam
value. - Fixed potential issue when calling
fclose()
more than once. - Fixed
printf()
rounding issues for%a
and%f
formats. - General header cleanups have been performed.
-
Other:
- Expanded the touch input test to allow sampling input on initial pen press only, as opposed to every frame while the pen is touching the display.
-
Version 1.3.0
-
libnds:
-
New touchscreen driver:
- The touchscreen driver has been rewritten from the ground up.
- A new routine for filtering measurements is now used for both TSC (NTR) and CDC (TWL) touch inputs. This should provide more accurate results, particularly on more worn down displays and screen protectors. More testing is required, however.
- On TSC (NTR),
tscMeasure()
now uses the 16-clock-per-conversion method to speed up measurement readouts. - The duration of the critical (interrupt-blocking) section of the touch driver has been reduced, and the TSC (NTR) driver has had its performance optimized on top of that compared to 1.2.0 and below.
- On the ARM7 side,
touchApplyCalibration
andtouchReadData
have been added to allow more granular access to the touchscreen driver's logic. - As these commands were only intended for TSC (NTR),
touchRead
andtouchReadTemperature
were moved to a new header,tsc.h
, and renamed totscRead
andtscReadTemperature
respectively.
-
Interrupt handling:
- The interrupt dispatcher has been optimized to use
O(1)
as opposed toO(n)
lookups. This is always faster on ARM9, and faster for more than 2-3 defined IRQ handlers on ARM7, which is the common scenario. - Fixed a bug where
irqClearAUX()
would disable the non-auxillary interrupt of the same bit mask on ARM7. - Fixed behaviour in setting and clearing of multiple interrupt handlers at a time (bit masks with more than one bit set). Now, setting multiple bits at once with
irqSet()
orirqClear()
acts the same as setting one bit at a time.
- The interrupt dispatcher has been optimized to use
-
Memory usage:
- ITCM use has been reduced by about 320-380 bytes, depending on your codebase's use of libnds.
- DTCM use has been reduced by 192 bytes - the size of the reserved section at the end of memory is now 64 bytes by default and can be controlled with the
__dtcm_reserved_size
linker
symbol. - ARM7 IWRAM use has been reduced by 192 bytes - the size of the reserved section at the end of memory is now 64 bytes by default and can be controlled with the
__iwram_reserved_size
linker symbol. - The size of the supervisor and IRQ stack can now be controlled by defining the
__svc_stack_size
and__irq_stack_size
linker symbols.
-
Graphics:
- A new function has been added to set the object mode (regular, bitmap, window, blended):
oamSetBlendMode()
. - A new function has been added to get a SpriteSize entry from the size of a sprite in pixels:
oamDimensionsToSize()
. Also,SpriteSize_Invalid
has been introduced to represent dimensions that aren't valid 2D sprite sizes. - New definitions have been added for the bit fields of the
BLDALPHA
andBLDY
registers. - The following functions now return error codes:
glBindTexture()
,glAssignColorTable()
,glGetColorTableParameterEXT()
, andglTexParameter()
, making it easier to handle errors gracefully when using them. - There has been a big refactor in videoGL to handle allocation errors gracefully (or at least crash with an assertion if the code can't recover from the error).
- A new function has been added to set the object mode (regular, bitmap, window, blended):
-
Code refactoring:
RTC_CR
,RTC_CR8
andHALT_CR
have been renamed toREG_RTCCNT
,REG_RTCCNT8
andREG_HALTCNT
, respectively.- GL2D now uses existing
videoGL.h
helpers instead of reimplementing its own copies. - Many fields and functions have been documented, including firmware flash commands, DLDI driver structures.
- Missing
DMA_START
constants have been added. - The constants used in
tscReadTemperature
have been documented. SerialWaitBusy
has been renamed tospiWaitBusy
.oamSetGfx()
has been moved away from the header to fix C++ builds.
-
Other:
- ARM7 SPI bus helper functions have been added:
spiExchange
,spiRead
andspiWrite
. consoleLoadFont()
has been cleaned up. Note that theconvertSingleColor
option has been removed, as 1bpp fonts are now supported.- Decompression of Huffman-compressed data has been implemented. To faciliate this,
decompressStreamStruct()
has been added. - Decompression utility functions are now available in both the ARM9 and ARM7 build of libnds.
glCallList()
andcardStartTransfer()
now use the safe helper functiondmaSetParams()
.- wf-fatfs has been updated, bringing minor performance improvements to directory lookups.
- The magic numbers used to represent MPU memory regions have been replaced by definitions.
- A missing include has been added to
grf.h
.
- ARM7 SPI bus helper functions have been added:
-
-
SDK:
-
New examples:
- Added an 8-bit bitmap background loading example.
- Added an example of combining 3D, 2D sprite, and 2D background display.
- Added an example of loading sprites of all graphics types from GRF files.
- Added an example of loading bitmap sprites.
- Added an example of loading and using affine sprites.
- Added examples of using regular windows and windows using objects as mask.
- Added examples of using extended palettes for sprites and backgrounds.
- Added an example of using a text console in an extended affine background.
- Added an example of using the mosaic effect in sprites and backgrounds.
- Added an example of animating 2D sprites by updating frames in real time or by pre-loading all frames to VRAM from the start.
- Added an example of using 2D alpha blending and fade effects.
- Added a BIOS decompression example.
- Added a NitroFS paletted texture loading example.
- Added a touch input test, and two examples.
- Added an example of creating graphics effects using the horizontal blanking interrupt.
- Added a sample minigame based on Space Invaders.
-
Changes to examples:
- OAM memory and textures is now freed in all examples that allocate them. While this isn't needed in examples as short as ours, it's good practice to show developers how to free resources when they aren't needed anymore.
- The names of the ROMs and the titles and subtitles in the ROM header have been modified to make them consistent across all examples.
- Background IDs returned by
bgInit()
are now used instead of hardcoded layer numbers. videoSetMode()
is no longer used to enable sprites or to set sprite mapping modes, that should be done by thelibnds
sprite API.- Tilemaps are now explicitly excluded from grit generation in all the grit files that are used to convert sprites.
-
grit:
- Fixed reading data from assembly files as input.
- Fixed uninitialized memory use when loading a picture with an odd width.
-
picolibc:
- The bundled version of picolibc has been updated.
- Added an implementation of
funopen
. - Added bounds checking to
asctime_r
andctime_r
. - Added implementations of
fgetpos
andfsetpos
. - Added stub implementations for POSIX unlocked file functions.
- Fixed
fgetwc
andfputwc
not setting the file stream to wide orientation. - Fixed
regex.h
not being usable when compiling C++ code.
-
Other:
- Fixed NitroFS generation in the combined ARM7+ARM9 ROM template.
- The BlocksDS SDK now depends on the
wf-nnpack
package, which provides standalone, command-line compressors for the decompression methods supported by the console's BIOS. - The code style of
libteak
andDSWiFi
has been changed usingclang-format
to improve readability. - The documentation has been updated with additional notes about migrating from older and current versions of devkitARM, covering further potential issues.
- The Teak LLVM toolchain is no longer mentioned in the Windows setup instructions, as it is not available there.
-
Version 1.2.0
-
libnds:
-
videoGL:
- Add
glGetColorTablePointer()
(returns pointer in VRAM to the palette of a texture). - Add
glGetTextureExtPointer()
(returns pointer in VRAM to the additional texture data ofGL_COMPRESSED
textures). - Fix allocation of
GL_COMPRESSED
textures whenVRAM_A
is not allocated to the 3D engine. - Fix crash in
glTexImage2D()
with no active texture. - Fix error checking in
glColorTableEXT()
andglTexImage2D()
. - General code cleanup and improvements.
- Minor optimization to loading
GL_RGB
textures usingglTexImage2D()
. Note that using this format is not recommended; see documentation for additional details. TEXTURE_SIZE_INVALID
has been added to GL_TEXTURE_SIZE_ENUM.glTexImage2D()
now fails correctly when invalid sizes are used.- Some minor comment improvements.
- Add
-
GL2D:
- Improve error checking when loading textures.
- Modify sprite sets to use
uint16_t
arrays for texture coordinates.
-
Add
hw_sqrtf()
- a hardware-accelerated alternative tosqrtf()
. -
Small optimizations to functions that use the hardware accelerators of division and square root.
-
Add support for detecting stack smash canaries.
- As a result, the debug versions of libnds are now built with the stack protector enabled.
-
Add support for printing standard output to the debug console if the on-display console is not initialized.
-
Change
SOUND_FREQ
(ARM7) andTIMER_FREQ
to always return the correct frequency value, rounded to the nearest achievable one.- This has been found in user research to be the most intuitive default; if you'd like alternate options, please let us know.
-
Fix
swiSwitchToGBAMode()
. -
Improve documentation of RTC structs.
-
-
SDK:
- Add error code checks to 3D engine examples.
- Add GL2D spriteset and tileset examples.
- Add new tool: squeezer (by @huxingyi), used for generating packed textures for GL2D sprite sets. It has been forked to easily export formats used by GL2D instead of generic formats.
- Add tests for
hw_sqrtf()
. - Avoid using
GL_RGB
andTEXTURE_SIZE_n
defines in 3D engine examples. - Fix VRAM bank setup in "text over 3D" example.
- Improve timer example.
- Add a test for the videoGL functions that allocate textures and palettes.