Dolphin, the GameCube and Wii emulator - Forums

Full Version: Why can't emulation be done 'off-line'? Decompile the game code and recompile?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Fox5

I was just wondering why Gamecube, or any emulated system's, code can't be decompiled and then recompiled directly for a new target architecture. Presumably, something like this is already happening with the JIT compilers in many emulators, so wouldn't it be faster just to do a whole recompile?
You can do a static recompiler, but it won't add any big speedups so its pointless.

Fox5

(10-14-2009, 03:57 AM)omegadox Wrote: [ -> ]You can do a static recompiler, but it won't add any big speedups so its pointless.

Oh? Why won't it be like as if the games were made for PC hardware? If they're recompiled, the compiler should take care of any possible optimizations, I would think. It wouldn't cause the code to take advantage of graphics hardware that didn't exist on the Gamecube, but I don't see why the cpu code can't perform like native.

Is there any sort of technical documentation for Dolphin available to read?
Check out Yet Another Gamecube Documentation

Meh, ask ector.
This has been asked 1000x times already and as always the answer is no, not worth it because:
* It would not bring any speedup whatsoever compared to a good JIT
* Many games load PowerPC code from disc at runtime so there has to be a JIT anyway to take care of that.

Fox5

(10-14-2009, 06:24 PM)ector Wrote: [ -> ]This has been asked 1000x times already and as always the answer is no, not worth it because:
* It would not bring any speedup whatsoever compared to a good JIT
* Many games load PowerPC code from disc at runtime so there has to be a JIT anyway to take care of that.

Thanks for the response.

Not to be rude, but I'm curious about the current JIT compiler. Is it already mostly complete? Are there any major areas left to work on? How did you learn how to write one, and how did you get started on Dolphin?

If not the JIT, what would you say is currently hampering Gamecube games from running 'like native'?
(10-15-2009, 12:44 AM)Fox5 Wrote: [ -> ]
(10-14-2009, 06:24 PM)ector Wrote: [ -> ]This has been asked 1000x times already and as always the answer is no, not worth it because:
* It would not bring any speedup whatsoever compared to a good JIT
* Many games load PowerPC code from disc at runtime so there has to be a JIT anyway to take care of that.

Thanks for the response.

Not to be rude, but I'm curious about the current JIT compiler. Is it already mostly complete? Are there any major areas left to work on? How did you learn how to write one, and how did you get started on Dolphin?

If not the JIT, what would you say is currently hampering Gamecube games from running 'like native'?

its running in a totally different environment then it is supposed to, so the cpu has to work at LEAST a couple times as fast as the gamecube to translate the game into something your computer will be able to use

Fox5

(10-15-2009, 02:28 PM)THELUKESTIR Wrote: [ -> ]
(10-15-2009, 12:44 AM)Fox5 Wrote: [ -> ]
(10-14-2009, 06:24 PM)ector Wrote: [ -> ]This has been asked 1000x times already and as always the answer is no, not worth it because:
* It would not bring any speedup whatsoever compared to a good JIT
* Many games load PowerPC code from disc at runtime so there has to be a JIT anyway to take care of that.

Thanks for the response.

Not to be rude, but I'm curious about the current JIT compiler. Is it already mostly complete? Are there any major areas left to work on? How did you learn how to write one, and how did you get started on Dolphin?

If not the JIT, what would you say is currently hampering Gamecube games from running 'like native'?

its running in a totally different environment then it is supposed to, so the cpu has to work at LEAST a couple times as fast as the gamecube to translate the game into something your computer will be able to use

Once a native compiled version of some code is found by the JIT compiler, shouldn't the code just be reused?
The Java VM doesn't seem to have a large performance impact compared to native code, but byte code certainly isn't machine code. (but it might convert easier than PPC assembly to x86)
PPC is a bit tricky to convert into efficient x86 yes, especially the slightly weird PPC version that sits in the GC. But CPU emulation isn't usually the bottleneck anymore, it's the GPU emulation. The problem is that even if we could convert the game executable into perfect x86 code, it would still produce GPU command streams arranged for the GC/wii gpu, so they still have to be translated by Dolphin, many millions of them per second. The vertices are arranged in an extremely PC-unfriendly way, too, and have to be reshuffled every time they are drawn (yes, every time, because they often change when games do software skinning etc).

Oh, and I learned by looking at other emulators, trying, and doing.