First of all,i did it on Windows 8.1 x64.
QDLoader HS USB Driver : x64 driver or x32 driver
I9505 Pit file : Pit file download
Boot repair tool : I9505 Boot repair tool
Needed files to enter download mode to flash a stock rom : Files for Download Mode
Stock ROM to flash.I used this one but IT IS FOR THE LTE VERSION. Please download the stock rom for the Non - LTE version if you have it.
And lastly,Odin : Download here
Make sure that your device is connected and in Device Manager , it show as QHSUSB_DLOAD .If it does,disconnect it from your computer.
Before installing the drivers,we need to disable driver signature enforcement.
First,press WinKey + C and choose Settings
or if you prefer the modern one in Windows 8.1 or Windows 10,choose Change PC Settings
Choose Update & recovery
Then,at Advanced Startup,click Restart now.
Your PC will restart.
Once entered here,it will ask for us to restart.Click Restart
When at the list,press F7 to disable Driver signature enforcement and boot.
Install the 64 bit or 32 bit driver depending on your OS WITH YOUR DEVICE DISCONNECTED.
Now plug your device to your computer via USB and it should pop up in Device Manager as Qualcomm HS-USB QDLoader 9008
Next,go to Control Panel,choose Folder Options and check Show hidden files.
Make a new folder on your desktop and put the galaxy_S4_9505 boot repair QHUSB in that folder and nothing else.
Now extract the needed files for Download Mode in another folder and leave it open and the folder you have galaxy_S4_9505 boot repair QHUSB open aswell.
Open galaxy_S4_9505 boot repair QHUSB and do not click Recover Device until you read the next step.
This is the most important step because we will flash the stock boot files for our device.
With galaxy_S4_9505 boot repair QHUSB open and the two folders above open, select all the files in the needed files for Download Mode folder and be ready because when you click Recover device,you will need to drag those files in the folder where galaxy_S4_9505 boot repair QHUSB is and you have to be very fast when doing it.
Click Recover Device and drag the files in the folder mentioned above and click overwrite very fast.This should be done in 3 seconds max. and if it won´t work,repeat the last step until you do it right.
Your phone should now boot in Download Mode.
Download Odin and click on AP and select the .tar file and wait a few minutes.
Click on Options and check Auto Reboot , Re-Partition and F. Reset Time. Make sure that these are the only checked options.
Now go to Pit tab and select the downloaded pit file.
Click start and wait for it to finish.
That is it.
Final note :
If your device is restarting and it does not boots in Download mode and shows up that the battery is charging,disconnect it and pull the baterry and the press Vol. down , Home button and Power to enter Download mode.If you do not flash a stock ROM with Odin,after your first restart,it will become hardbricked again.
Don´t forget to hit that thanks button if it helped you.