From: ljsebald <ljs...@us...> - 2023-09-22 21:02:46
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via a8e11c4bcc9c74b2d2ff6069a221106e2465fbda (commit) from 75c3000f32ab287f3e1a6442a56968abd4e41fe2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a8e11c4bcc9c74b2d2ff6069a221106e2465fbda Author: Andress Barajas <and...@gm...> Date: Fri Sep 22 14:02:11 2023 -0700 Add functionality to enable/disable extra 41 unused blocks on VMU (#307) * Add ability to enable/disable/check the status of VMUs extra blocks * Updated changelog ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 1 + kernel/arch/dreamcast/hardware/maple/vmu.c | 26 +++++++++++++++++++++ kernel/arch/dreamcast/include/dc/maple/vmu.h | 34 ++++++++++++++++++++++++++-- 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 6ec3a10..d051ba0 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -190,6 +190,7 @@ KallistiOS version 2.1.0 ----------------------------------------------- Added yuv examples [AB] - *** Added GCC builtin functions for supporting all of C11 atomics [FG] - *** Added toolchain and KOS support for C/C++ compiler-level TLS [CP && FG] +- DC Added vmu functions to check/enable/disable the extra 41 blocks [AB] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Megan Potter == MP] diff --git a/kernel/arch/dreamcast/hardware/maple/vmu.c b/kernel/arch/dreamcast/hardware/maple/vmu.c index 784d050..0226b0e 100644 --- a/kernel/arch/dreamcast/hardware/maple/vmu.c +++ b/kernel/arch/dreamcast/hardware/maple/vmu.c @@ -170,6 +170,32 @@ int vmu_get_buttons_enabled(void) { return !!vmu_drv.periodic; } +int vmu_has_241_blocks(maple_device_t *dev) { + vmu_root_t root; + + if(vmufs_root_read(dev, &root) < 0) + return -1; + + if(root.blk_cnt == 241) + return 1; + + return 0; +} + +int vmu_toggle_241_blocks(maple_device_t *dev, int enable) { + vmu_root_t root; + + if(vmufs_root_read(dev, &root) < 0) + return -1; + + root.blk_cnt = (enable != 0) ? 241 : 200; + + if(vmufs_root_write(dev, &root) < 0) + return -1; + + return 0; +} + int vmu_use_custom_color(maple_device_t *dev, int enable) { vmu_root_t root; diff --git a/kernel/arch/dreamcast/include/dc/maple/vmu.h b/kernel/arch/dreamcast/include/dc/maple/vmu.h index da333b4..3a6f9f7 100644 --- a/kernel/arch/dreamcast/include/dc/maple/vmu.h +++ b/kernel/arch/dreamcast/include/dc/maple/vmu.h @@ -3,7 +3,7 @@ dc/maple/vmu.h Copyright (C) 2000-2002 Jordan DeLong, Megan Potter Copyright (C) 2008 Donald Haase - Copyright (C) 2023 Falco Girgis + Copyright (C) 2023 Falco Girgis, Andy Barajas */ @@ -87,13 +87,43 @@ __BEGIN_DECLS a VMU has been formatted. */ +/** \brief Get the status of a VMUs extra 41 blocks + \ingroup vmu_settings + + This function checks if the extra 41 blocks of a VMU have been + enabled. + + \param dev The device to check the status of. + + \retval 1 On success: extra blocks are enabled + \retval 0 On success: extra blocks are disabled + \retval -1 On failure +*/ +int vmu_has_241_blocks(maple_device_t *dev); + +/** \brief Enable the extra 41 blocks of a VMU + \ingroup vmu_settings + + This function enables/disables the extra 41 blocks of a specific VMU. + + \warning Enabling the extra blocks of a VMU may render it unusable + for a very few commercial games. + + \param dev The device to enable/disable 41 blocks. + \param enable Values other than 0 enables. Equal to 0 disables. + + \retval 0 On success + \retval -1 On failure +*/ +int vmu_toggle_241_blocks(maple_device_t *dev, int enable); + /** \brief Enable custom color of a VMU \ingroup vmu_settings This function enables/disables the custom color of a specific VMU. This color is only displayed in the Dreamcast's file manager. - \param dev The device to enable custom color. + \param dev The device to enable/disable custom color. \param enable Values other than 0 enables. Equal to 0 disables. \retval 0 On success hooks/post-receive -- A pseudo Operating System for the Dreamcast. |