No direct connection exists. N64 controller port uses a proprietary serial protocol; PS2 uses USB (or PS2 protocol). You need an adapter or emulator.
Skip the PS2 controller. A 8BitDo Pro 2, GuliKit KK3 Max, or Xbox/PS4/PS5 controller works natively via USB/Bluetooth on PC, RetroPie, MiSTer, Analogue, and modern emulators. Better ergonomics, analog sticks, no adapter hassle.
Downloading ROMs for games you don't own is copyright infringement. Dump your own carts (e.g., Retrode, GB Operator for GBA, but N64 needs N64 Dumper or parallel port methods).