In chapter 6 for the bad ending you'll get a quest that has two paths, one leads to the Den the other leads to the Immortal Harbour. It's important to have a save prior to this point if you chose the Immortal Harbour as this will lock you out of the Den route which is the bad ending. If you chose the Den just repeatedly go there until the quest finishes and watch the bad ending before continuing on to the Immortal Harbour.
The Lakshmi boss fight in chapter 7 is the point of no return so make sure you have done all the side quests and talked to all your companions to progress their stories.
For legendary weapons you can only start farming them once you reach chapter 7 as the 7-5 lair becomes available to you. A good strategy for this is to clear out all the enemies in pathways that lead to item chests but don't pickup the item chests, then fight the final boss of the lair and then leave. Once you leave you can reload an autosave that will be at the point just before you left the lair and then you're free to loot all the chests, this will help you fish for specific legendaries as you can reload the save if you get dupes or nothing.
If you're struggling with only one or two specific legendary weapon types left you can go to South 2nd Street and talk to the NPC No.453 who will bring you to a rougelike mode that you can farm a currency which you can use at the weapon vendor to buy the legendary weapons you're missing.