I remembered that I learned this 20 years ago, but now couldn't find any information relating to it even searching the entire internet.
Ok, Here is how to use Wish (source)
Wish + (that) + past simple: We can use 'wish' to talk about something that we would like to be different in the present or the future. It's used for things which are impossible or very unlikely.
Ex: I wish that I had a big house (I don't have a big house, but it's a nice idea!).
Ex: I wish that I could speak Spanish (but, unfortunately, I can't speak Spanish)
Wish + (that) + would: On the other hand, we use 'would' with 'wish' in a little bit of a special way. It's generally used about other people who are doing (or not doing) something that we don't like and we want that person to change. It's not usually used about ourselves, or about something which nobody can change though, exceptionally, we do use it about the weather.
Ex: I wish that John wouldn't eat all the chocolate. (John does usually eat all the chocolate and I don't like it. I want him to change his behaviour!)
Ex: I wish that the neighbours would be quiet! (They are not quiet and I don't like the noise.)
Wish + (that) + past perfect: We can use 'wish' with the past perfect to talk about regrets from the past. These are things that have already happened but we wish they'd happened in a different way. This use of 'wish' is very similar to the third conditional.
Ex: I wish that I had studied harder at school. (I didn't study hard at school, and now I'm sorry about it.)
Ex: I wish that I hadn't eaten so much yesterday! (But I did eat a lot yesterday. Now I think it wasn't a good idea.)
Now, we got 6 above sentences that use "wish" in simple present tense, then the question is that how to change the verb form if "wish" in simple past?
Ex: I wish that I had a big house (I don't have a big house, but it's a nice idea!). --->I wished that I had had a big house
Ex: I wish that I could speak Spanish (but, unfortunately, I can't speak Spanish) --->I wished that I could have spoken Spanish
Ex: I wish that John wouldn't eat all the chocolate. (John does usually eat all the chocolate and I don't like it. I want him to change his behaviour!) --->I wished that John wouldn't have eaten all the chocolate.
Ex: I wish that the neighbours would be quiet! (They are not quiet and I don't like the noise.) --->*I wished that the neighbours would have been quiet!"
Ex: I wish that I had studied harder at school. (I didn't study hard at school, and now I'm sorry about it.) --->I wished that I had studied harder at school
Ex: I wish that I hadn't eaten so much yesterday! (But I did eat a lot yesterday. Now I think it wasn't a good idea.) --->I wished that I hadn't eaten so much yesterday
This is what I think:
if the verb in main clause is simple past--> change to past perfect"
if the verb in main clause is "would do" --->change to "would have done"
but if the verb "in main clause is past perfect, then don't need to change because there is no tense far further back after past perfect.