Skip to content

Add default_folder config setting#2

Open
wins1ey wants to merge 4 commits intomakeo:mainfrom
wins1ey:default-folder
Open

Add default_folder config setting#2
wins1ey wants to merge 4 commits intomakeo:mainfrom
wins1ey:default-folder

Conversation

@wins1ey
Copy link

@wins1ey wins1ey commented Nov 7, 2025

Set the default folder in config.ini with the key default_folder.
Example:

default_folder = games

Cubiboot will start with that folder open instead of in the root of the SD card.

I tested the cubiboot.dol on a GameCube with picoboot v0.5.0.

All of these opened the games folder on boot correctly:

default_folder = games
default_folder = games/
default_folder = /games
default_folder = /games/

Setting default_folder to a directory that doesn't exist will just open the root of the SD like normal.

Set the default folder in config.ini with the key `default_folder`.
For e.g. `default_folder = games`.
Cubiboot will start with that folder open instead of in the root of the
SD card.
// }
void *default_folder_ptr = (void*)get_symbol_value(symshdr, syment, symstringdata, "default_folder");
if (default_folder_ptr != NULL && settings.default_folder != NULL) {
iprintf("Copying cube_logo_path: %p\n", default_folder_ptr);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update print string

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


if (!start_passthrough_game) {
gm_start_thread("/");
if (dvd_custom_open(default_folder, FILE_ENTRY_TYPE_DIR, 0) == 0) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using an uninitialized string without checking if it is empty

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorted this and refactored the whole thing whilst doing it because I wasn't liking the nested if statements. I'm rubbish at naming functions and variables.

@wins1ey
Copy link
Author

wins1ey commented Nov 7, 2025

I realised that if you didn't use a / at the start of the path in the config then you couldn't press b to go back to the previous directory, it would just refresh.
So I made it add a / to the start of the path if it's missing.

- Added get_valid_path() helper to safely check default_folder.
- Handles NULL, empty, and missing leading '/' cases.
- Falls back to root '/' if folder does not exist.
- Renamed get_valid_path() to resolve_default_folder() for clarity
- Switched to using a local path_buf to safely build folder paths
- Moved default_folder initialisation to below cube_logo
@wins1ey wins1ey closed this Nov 9, 2025
@wins1ey wins1ey deleted the default-folder branch November 9, 2025 16:31
@wins1ey wins1ey restored the default-folder branch November 9, 2025 16:31
@wins1ey
Copy link
Author

wins1ey commented Nov 9, 2025

Didn't mean to do that

@wins1ey wins1ey reopened this Nov 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants