diff --git a/include/firmwriter.h b/include/firmwriter.h index 404d6e4..1d6c02a 100644 --- a/include/firmwriter.h +++ b/include/firmwriter.h @@ -28,8 +28,8 @@ { UPDATE_ERR_INVALID_FIRM = -2, // Corrupted FIRM UPDATE_ERR_INVALID_SIG = -3, // Signature verification error - UPDATE_ERR_DOWNGRADE = -5, // Update file is a lower version than installed - UPDATE_ERR_NOT_INSTALLED = -10 // fastboot3DS is not installed in firm0:/ + UPDATE_ERR_NOT_INSTALLED = -9, // fastboot3DS is not installed in firm0:/ + UPDATE_ERR_DOWNGRADE = -10 // Update file is a lower version than installed }; diff --git a/source/arm9/firmwriter.c b/source/arm9/firmwriter.c index d78608e..7f85801 100644 --- a/source/arm9/firmwriter.c +++ b/source/arm9/firmwriter.c @@ -140,18 +140,17 @@ // Check version const u32 vers = *(u32*)((void*)updateBuffer + 0x210); if(version) *version = vers; - if(vers < ((u32)VERS_MAJOR<<16 | VERS_MINOR)) return UPDATE_ERR_DOWNGRADE; size_t partInd, sector; - if(!partitionGetIndex("firm0", &partInd)) return -6; - if(!partitionGetSectorOffset(partInd, §or)) return -7; + if(!partitionGetIndex("firm0", &partInd)) return -5; + if(!partitionGetSectorOffset(partInd, §or)) return -6; u8 *firm0Buf = (u8*)malloc(0x200); - if(!firm0Buf) return -8; + if(!firm0Buf) return -7; if(!dev_decnand->read_sector(sector + 1, 1, firm0Buf)) { free(firm0Buf); - return -9; + return -8; } // verify fastboot is installed to firm0:/ @@ -163,5 +162,7 @@ free(firm0Buf); + if(vers < ((u32)VERS_MAJOR<<16 | VERS_MINOR)) return UPDATE_ERR_DOWNGRADE; + return 0; }