Introduction
In a quite a lot of games swords, bows and so forth exist on a regular basis alongside guns, and often are as powerful, if not more so, than firearms. In a realistic, non-magical setting, the plausibility of such thing ranges from "maaaaaybe it can exist", due to some weird reasons, to utterly ridiculous. But a fantasy setting things can be much more interesting, because now there's magic in the equation. Unfortunately, more often than not such things are simply handwaved with magic, and not explained, hence my question.
The Question
What I'm looking for is essentially a way to balance reality using magic, because let's be honest, having swords and not crappy guns alongside is a rather significant boost to the "coolness factor". The whole question (because title space is limited) is as follows:
How hard magic could, directly or indirectly, interact with bows, crossbows, slings, blowpipes, and throwing weapons as well as all types of swords, axes, spears, staves and other white weapons that pre-date firearms to make their usage viable alongside non-primitive firearms, whilst still affecting the latter but not rendering them useless in majority of the cases?
Possible solutions
I do, however, have some answers to my own question, which mostly touch on already existing firearm weaknesses.
Lack of resources - Sufficient explosive materials could either be rare, or entirely nonexistent and instead replaced by magical means. One of the downsides to that solution is that it would heavily rely on the setting.
Chaotic magic - The existence of magic introduces additional unpredictability, which could have an accident rate in grow significantly with the complexity of the weapon, due to more components being prone to failure. As of now I'm the most inclined towards this one.
Decentralization of society - This one is quite unique, because it relies on the production of a firearm. In a highly decentralized, from whatever reasons, world, where individuality is more prized, the production of weapon parts would be more difficult, because of lack of standardization (no manufactured goods, protected knowledge, higher unpredictability and impact of individuals if paired with Chaotic magic)
Those are the three possible solutions I came up with, and while I quite like them, I don't think that's enough
Additional notes
- I am working with a hard magic system
- The closest image to the setting I have in mind would be the overall view on the period from mid-medieval era to 1700s
- If something wasn't stated in the text, then all assumptions are viable