mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-26 04:24:16 +01:00
Improve repair function
This commit is contained in:
parent
ecd131b7a4
commit
02dbcc01f5
@ -61,7 +61,17 @@ cpak_err_t cpak_overwrite_contents_from_file(char *path, uint8_t port) {
|
||||
return CONTROLLER_PAK_ERR_IO;
|
||||
}
|
||||
|
||||
cpak_err_t cpak_attempt_repair() {
|
||||
// TODO: implementation.
|
||||
return CONTROLLER_PAK_ERR_IO;
|
||||
cpak_err_t cpak_attempt_repair(uint8_t port, bool allow_formatting) {
|
||||
int result = validate_mempak(port);
|
||||
if (result == CONTROLLER_PAK_OK) {
|
||||
return CONTROLLER_PAK_OK;
|
||||
}
|
||||
|
||||
// TODO: repair implementation.
|
||||
|
||||
// last resort would be to format it completely!
|
||||
if (result == -3 && allow_formatting) {
|
||||
result = format_mempak(port);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -28,6 +28,6 @@ typedef struct {
|
||||
cpak_err_t cpak_info_load(uint8_t port, cpak_info_t *cpak_info);
|
||||
int cpak_clone_contents_to_file(char *path, uint8_t port);
|
||||
cpak_err_t cpak_overwrite_contents_from_file(char *path, uint8_t port);
|
||||
cpak_err_t cpak_attempt_repair();
|
||||
cpak_err_t cpak_attempt_repair(uint8_t port, bool allow_formatting);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user