Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a special message for Kor if Home menu patch isn't installed #299

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions include/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ Result buf_to_file(u32 size, FS_Path path, FS_Archive archive, char *buf);
void remake_file(FS_Path path, FS_Archive archive, u32 size);
void save_zip_to_sd(char * filename, u32 size, char * buf, EntryMode mode);

Result korPatchInstalled(Result archive_result);

#endif
11 changes: 11 additions & 0 deletions source/fs.c
Copy link
Collaborator

Choose a reason for hiding this comment

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

This method of checking for the patch assumes that the user has Luma3DS/the KOR patch installed to the SD card rather than SysNAND or EmuNAND - is there a way we can detect that?

Copy link
Contributor Author

@cooolgamer cooolgamer Apr 24, 2024

Choose a reason for hiding this comment

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

There should be a way to detect this but I don't really see the point because themes only work with an sdcard inserted

Copy link
Contributor Author

@cooolgamer cooolgamer Apr 24, 2024

Choose a reason for hiding this comment

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

I got it, that's when the user use luma from ctrnand (or firm0?) and not on the sdcard, which not many people do but it's still best to think about this case, I see now. The way to detect it would be just a check to see where luma booted from by using this feature

Original file line number Diff line number Diff line change
Expand Up @@ -468,3 +468,14 @@ void save_zip_to_sd(char * filename, u32 size, char * buf, EntryMode mode)
remake_file(path, ArchiveSD, size);
buf_to_file(size, path, ArchiveSD, buf);
}

Result korPatchInstalled(Result archive_result){
Handle handle;
Result res = 0;
if (R_FAILED(res = FSUSER_OpenFile(&handle, ArchiveSD, fsMakePath(PATH_ASCII, "/luma/titles/000400300000A902/code.ips"), FS_OPEN_READ, 0))) return res;
Copy link
Collaborator

Choose a reason for hiding this comment

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

prefer: assignment to be done on declaration if possible. helps readability

FSFILE_Close(handle);
// The following file is needed to get the "change theme" button on the Home Menu allowing to create extdata, not needed if extdata is already created
if (R_FAILED(archive_result) && R_FAILED(res = FSUSER_OpenFile(&handle, ArchiveSD, fsMakePath(PATH_ASCII, "/luma/titles/000400300000A902/romfs/petit_LZ.bin"), FS_OPEN_READ, 0))) return res;
Copy link
Collaborator

Choose a reason for hiding this comment

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

as above, though in this case;
prefer: assignment to be done as a statement rather than an expression

FSFILE_Close(handle);
return 0;
}
12 changes: 12 additions & 0 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,12 @@ int main(void)
load_lists(lists);
#endif

u8 regionCode;
Result korCheck = 0;
CFGU_SecureInfoGetRegion(&regionCode);
if(regionCode == 5)
korCheck = korPatchInstalled(archive_result);

EntryMode current_mode = MODE_THEMES;

bool preview_mode = false;
Expand All @@ -380,6 +386,12 @@ int main(void)
return 0;
}

if (R_FAILED(korCheck) && current_mode == MODE_THEMES){
throw_error("Korean HOME Menu patch not found.\nYou must install it in order\nto use themes.", ERROR_LEVEL_ERROR);
quit = true;
continue;
}

#ifndef CITRA_MODE
if(R_FAILED(archive_result) && current_mode == MODE_THEMES)
{
Expand Down