I think you should be able to fix by just flashing over the system firmware via ODIN. You will need to download the system firmware from Sammobile, refer to the model number in the battery compartment on your Samsung Galaxy S4 for the model number. E.G Gt-i9505. Make sure you choose the correct country / carrier + model number for the correct system firmware.
Once you've downloaded the system firmware. You need do download ODIN which you can download via Sammobile website from a direct download link here: http://dl.sammobile.com/Odin3_v3.10.7.zi...
Instructions, doing the steps below shouldn't lose your data as you're basically doing a system update or flashing firmware over:
- Extract (unzip) the firmware file
- Download Odin v3.10.7
- Extract Odin ZIP file
- Open Odin v3.10.7
- Reboot Phone in Download Mode (press and hold Home + Power + Volume Down buttons)
- Connect phone and wait until you get a blue sign in Odin
- Add the firmware file to AP / PDA
- Make sure re-partition is NOT ticked
- Click the start button, sit back and wait few minutes until a green PASS is displayed.