Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cubeboot/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,11 @@ int main(int argc, char **argv) {
// iprintf("Copying cube_logo_path: %p\n", cube_logo_ptr);
// strcpy(cube_logo_ptr, settings.cube_logo);
// }
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

strcpy(default_folder_ptr, settings.default_folder);
}

// Copy other variables
set_patch_value(symshdr, syment, symstringdata, "is_running_dolphin", is_running_dolphin);
Expand Down
7 changes: 7 additions & 0 deletions cubeboot/source/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ void load_settings() {
settings.default_program = (char*)default_program;
}

// default folder
const char *default_folder = ini_get(conf, "cubeboot", "default_folder");
if (default_folder != NULL) {
iprintf("Found default_folder = %s\n", default_folder);
settings.default_folder = (char*)default_folder;
}

// swiss enable
int force_swiss_default = 0;
if (!ini_sget(conf, "cubeboot", "force_swiss_default", "%d", &force_swiss_default)) {
Expand Down
1 change: 1 addition & 0 deletions cubeboot/source/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ typedef struct settings {
u32 preboot_delay_ms;
u32 postboot_delay_ms;
char *default_program;
char *default_folder;
char *boot_buttons[MAX_BUTTONS];
} settings_t;

Expand Down
9 changes: 8 additions & 1 deletion patches/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ __attribute_data__ static u8 *cube_text_tex = NULL;
__attribute_data__ char cube_logo_path[MAX_FILE_NAME] = {0};
__attribute_data__ u32 force_progressive = 0;
__attribute_data__ u32 force_swiss_boot = 0;
__attribute_data__ char default_folder[MAX_FILE_NAME] = {0};

// used if we are switching to 60Hz on a PAL IPL
__attribute_data__ static int fix_pal_ntsc = 0;
Expand Down Expand Up @@ -353,8 +354,14 @@ __attribute_used__ void pre_thread_init() {

gm_init_heap();
gm_init_thread();

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.

dvd_custom_close(dvd_custom_status()->fd);
gm_start_thread(default_folder);
} else {
gm_start_thread("/");
}
}
}

Expand Down