mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	PTM & CFG: use the correct path and error code according to the new FileSys policy
This commit is contained in:
		@@ -359,7 +359,7 @@ ResultCode CreateConfigInfoBlk(u32 block_id, u16 size, u16 flags, const void* da
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ResultCode DeleteConfigNANDSaveFile() {
 | 
					ResultCode DeleteConfigNANDSaveFile() {
 | 
				
			||||||
    FileSys::Path path("config");
 | 
					    FileSys::Path path("/config");
 | 
				
			||||||
    return Service::FS::DeleteFileFromArchive(cfg_system_save_data_archive, path);
 | 
					    return Service::FS::DeleteFileFromArchive(cfg_system_save_data_archive, path);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -368,7 +368,7 @@ ResultCode UpdateConfigNANDSavegame() {
 | 
				
			|||||||
    mode.write_flag.Assign(1);
 | 
					    mode.write_flag.Assign(1);
 | 
				
			||||||
    mode.create_flag.Assign(1);
 | 
					    mode.create_flag.Assign(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FileSys::Path path("config");
 | 
					    FileSys::Path path("/config");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    auto config_result = Service::FS::OpenFileFromArchive(cfg_system_save_data_archive, path, mode);
 | 
					    auto config_result = Service::FS::OpenFileFromArchive(cfg_system_save_data_archive, path, mode);
 | 
				
			||||||
    ASSERT_MSG(config_result.Succeeded(), "could not open file");
 | 
					    ASSERT_MSG(config_result.Succeeded(), "could not open file");
 | 
				
			||||||
@@ -382,8 +382,9 @@ ResultCode UpdateConfigNANDSavegame() {
 | 
				
			|||||||
ResultCode FormatConfig() {
 | 
					ResultCode FormatConfig() {
 | 
				
			||||||
    ResultCode res = DeleteConfigNANDSaveFile();
 | 
					    ResultCode res = DeleteConfigNANDSaveFile();
 | 
				
			||||||
    // The delete command fails if the file doesn't exist, so we have to check that too
 | 
					    // The delete command fails if the file doesn't exist, so we have to check that too
 | 
				
			||||||
    if (!res.IsSuccess() && res.description != ErrorDescription::FS_NotFound)
 | 
					    if (!res.IsSuccess() && res.description != ErrorDescription::FS_FileNotFound) {
 | 
				
			||||||
        return res;
 | 
					        return res;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    // Delete the old data
 | 
					    // Delete the old data
 | 
				
			||||||
    cfg_config_file_buffer.fill(0);
 | 
					    cfg_config_file_buffer.fill(0);
 | 
				
			||||||
    // Create the header
 | 
					    // Create the header
 | 
				
			||||||
@@ -504,7 +505,7 @@ ResultCode LoadConfigNANDSaveFile() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    cfg_system_save_data_archive = *archive_result;
 | 
					    cfg_system_save_data_archive = *archive_result;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FileSys::Path config_path("config");
 | 
					    FileSys::Path config_path("/config");
 | 
				
			||||||
    FileSys::Mode open_mode = {};
 | 
					    FileSys::Mode open_mode = {};
 | 
				
			||||||
    open_mode.read_flag.Assign(1);
 | 
					    open_mode.read_flag.Assign(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -128,7 +128,7 @@ void Init() {
 | 
				
			|||||||
            Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path);
 | 
					            Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path);
 | 
				
			||||||
        ASSERT_MSG(archive_result.Succeeded(), "Could not open the PTM SharedExtSaveData archive!");
 | 
					        ASSERT_MSG(archive_result.Succeeded(), "Could not open the PTM SharedExtSaveData archive!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        FileSys::Path gamecoin_path("gamecoin.dat");
 | 
					        FileSys::Path gamecoin_path("/gamecoin.dat");
 | 
				
			||||||
        FileSys::Mode open_mode = {};
 | 
					        FileSys::Mode open_mode = {};
 | 
				
			||||||
        open_mode.write_flag.Assign(1);
 | 
					        open_mode.write_flag.Assign(1);
 | 
				
			||||||
        open_mode.create_flag.Assign(1);
 | 
					        open_mode.create_flag.Assign(1);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user