I know that you have to connect same devices with cross cable and differents with straight. Although, that's the common idea, in Cisco Packet Tracer you have to connect a PC and a router with cross cable. What's the correct logic in this?
Switches and hubs (for the few that are still left) can be viewed as network infrastructure devices in which everything else plugs into them with a straight cable. All other connections, including switch-to-switch, hub-to-hub and hub-to-switch, will be accomplished with a crossover cable - hence the crossover between the PC and router within Packet Tracer.
These days a lot more equipment is showing up with "auto-detect" (sometimes referred to as auto-DIX or auto-MDI/MDIX) where the network port is able to determine its configuration, so it will work regardless of the cabling and equipment combination.
It's down to the actual wiring of the ports; you will find that a crossover has two pairs swapped around and the intention of this is to permit you to directly connect two hosts together (as originally they wouldn't physically be able to autodiscover their wiring and thus would require this)
In reality however, it's pretty much an archaic novelty; providing you're using cat5e cable or better, it's very unlikely to be an issue.
There is a small curio that on 1000BASE-T if you are missing one of those pairs, it will negotiate 1Gbps but never actually be able to transmit any data; fortunately a most modern Gbps interfaces will even handle this sort of foolishness and drop down to a slower speed if they don't see anything on the wire.