Posts: 28
Threads: 6
Joined: Jan 2009
Reputation:
0
07-20-2009, 08:27 PM
(This post was last modified: 07-20-2009, 08:29 PM by Xelinis.)
(07-20-2009, 07:04 PM)xboxflyer Wrote: (07-20-2009, 06:57 PM)marche1990 Wrote: java is not the best platform for emulators Dx
So what is it then? C++.I think c++ is not portable language.If u develop
a software, u could run that only on a sec pc not universally from a remote
point.Even ur product is not readable on other console(mobile,ipod,psp,etc) as well.May be java is not the best only for it is harder than other.
This is actually making my head hurt.
Yes, the only way to embed a high level program into a web browser is with Java. However, that will make it impossible for the program to properly utilize the low level hardware services that PCSX2 absolutely needs. Have you ever compared the performance of software rendering vs. hardware acceleration? It's night and day. And lets not forget the lack of SSE support. Not only that but Java is extremely slow and people are still have problems running this thing with $3000 machines. Understand that Java code itself runs in an emulator, that's why it's cross-platform. Think about it, an an already slow emulator trying to run a far more intensive emulator. We also need to take into account the overhead of running programs in the browser
Embedding an emulator in a web browser can be done, it has been done in fact. But it hasn't been done with anything more intensive than a NES emulator. It may become feasible several decades down the line. So no, it's not impossible. But it is highly highly highly improbable and requires infinitely more man hours and more horsepower that any computer on the planet has to offer so stop getting so excited over the idea of this.
It's just not going to happen.
Sponsored links
Posts: 124
Threads: 25
Joined: Jul 2009
Reputation:
0
(07-20-2009, 08:27 PM)Xelinis Wrote: (07-20-2009, 07:04 PM)xboxflyer Wrote: (07-20-2009, 06:57 PM)marche1990 Wrote: java is not the best platform for emulators Dx
So what is it then? C++.I think c++ is not portable language.If u develop
a software, u could run that only on a sec pc not universally from a remote
point.Even ur product is not readable on other console(mobile,ipod,psp,etc) as well.May be java is not the best only for it is harder than other.
This is actually making my head hurt.
Yes, the only way to embed a high level program into a web browser is with Java. However, that will make it impossible for the program to properly utilize the low level hardware services that PCSX2 absolutely needs. Have you ever compared the performance of software rendering vs. hardware acceleration? It's night and day. And lets not forget the lack of SSE support. Not only that but Java is extremely slow and people are still have problems running this thing with $3000 machines. Understand that Java code itself runs in an emulator, that's why it's cross-platform. Think about it, an an already slow emulator trying to run a far more intensive emulator. We also need to take into account the overhead of running programs in the browser
Embedding an emulator in a web browser can be done, it has been done in fact. But it hasn't been done with anything more intensive than a NES emulator. It may become feasible several decades down the line. So no, it's not impossible. But it is highly highly highly improbable and requires infinitely more man hours and more horsepower that any computer on the planet has to offer so stop getting so excited over the idea of this.
It's just not going to happen.
hmm, java is too slow.but could anybody tell me that,is there a language
that is as fast as C++ and that have the power to embed.Is there no way
to modify C++ so that exe could be embeded.
Posts: 28
Threads: 6
Joined: Jan 2009
Reputation:
0
NO, FOR THE LOVE OF GOD, NO.
Posts: 919
Threads: 3
Joined: May 2009
Reputation:
3
Location: Germany
(07-20-2009, 06:50 PM)xboxflyer Wrote: would u not think about playing in a beautiful interface?
pcsx2 gui: i'm not beautiful? ;_;
CPU Core [email protected] | GPU Nvidia Geforce GTX 570 | RAM 8GB DDR-3 1600MHz CL9 | OS Win7 Ultimate (x64) SP1
EMU PCSX2 v1.1.0 r5645 | GS GSdx SSE4 r5632 | SPU2 SPU2-X r5559 | PAD LilyPad r5403 | CDVD cdvdGigaherz r5403
Posts: 1
Threads: 0
Joined: Jul 2009
Reputation:
0
I'm a Java developer, just came across this thread, thought I'd share my opinion too.
Firstly as for Java being too slow, this is a simple not true. Java has one of the worlds fastest virtual machines, it dynamically compiles code into native code, further it optimise's the hot parts of a program as it runs.
Granted that it'll never be as fast as C/C++ for stuff like emulators but since the virtual machine automatically applies a lot of optimisations that can be used for emulators, it gets some advantage over some other languages (like dynamic recompilation, which otherwise would take a while to write and manually apply). This is a long complicated discussion see the playstation or dreamcast java emulators for further discussion on this example.
As for your question for PCSX2 being embeddable in firefox this is perfectly possible with Java. Before you say OMG, rewriting PCSX2 in java, this is not what I'm suggesting that would be silly.
Your simple run a java applet, use it to download the PCSX2 binary, then use java to launch the binary. You then grab the window handle of PCSX2 (hWnd on windows, xembed on linux) and stick it on the applet canvas. This way pcsx2 will be embedded and run in the browser. You'd pass the hwnd to pcsx2 from the applet via command line when Java launches the binary.
You'd have to host binaries for all the platforms PCSX2 supports, win32/64, linux32/64 and the applet will automatically detect which system its running on and download only the needed one.
Its a few days work and you'd need to be familiar with Java and C++, theres already a few projects out that use this method.
Of course you'd have the overhead of the browser running as well as a small hit for embedding it. Why you'd want to run pcsx2 in the browser is beyond me though.
Posts: 1.452
Threads: 64
Joined: Nov 2008
Reputation:
17
Location: Meshoppen, PA
07-20-2009, 10:41 PM
(This post was last modified: 07-20-2009, 10:46 PM by Air.)
Correct. More than a few apps have made embedded frontends, mostly to get around the perceived unfriendly atmosphere of the download/install procedure. I find it amusing since the download/install procedure has been developed primarily for security reasons -- you get a prompt both when you download and install an application that it might be harmful, etc. A lot of small time software developers (namely indie game developers) are convinced this scares off potential customers. So they create ways to embed the games instead, essentially bypassing the built-in security with their own one-time embedded app installation (which can then run anything without such prompts).
... in other words, it'd be easier if we could just turn off the security prompts in the browsers themselves.
There are other minor benefits, like being able to bypass the platform/OS choice mess as you noted above, but typically that's the main reason behind the embedded native application install/run mess for browsers -- to bypass the security prompts browsers automatically associate with normal executable download/install.
As for Java: There is a problem with using any managed/JIT language for PCSX2 that would in fact severely impact performance. PCSX2 is itself a JIT compiler of MIPS assembly code, and in order to create fast results it must be able to link to compiled blocks of code together in an extremely efficient manner that bypasses all function call stack traversal. The only way to do this type of efficient block linking is with direct assembly code generation into an internal executable buffer, and then to run the generated code manually through a "chained" dispatcher (most blocks jump directly to the next block in the chain, and conditionally jump to the dispatcher if a MIPS-level exception or event has been scheduled-- which is several times faster than using call/ret to dispatch each block manually). The problem with Java or C# is that there is literally no way to create a function pointer to our internal executable buffer to start the dispatching process. I mean, there might be a way to cheat it on C# by using some unsafe code to hack-modify a delegate to point to the asm, but that's more or less breaking the core coveted rules and principles of a managed language.
Alternatively in C# you could also invoke a C++ or Managed C++ DLL function to execute the recompiled code. I suppose the same approach could be used for Java, although I'm not personally familiar with it's cross-language friendliness. But that still precludes the "pure managed language solution" condition. It'd be mostly Java or C#, but you'd still need some native features to get the job finished.
For the record, this system of block linking is so critical that for most games, PCSX2 would be less than a third of it's current speed using a call/ret system in the place of the jump chain (though even call/ret poses the same basic problem, that managed code doesn't let you create function pointer or delegates to raw memory).
Jake Stine (Air) - Programmer - PCSX2 Dev Team
Posts: 1.157
Threads: 11
Joined: Dec 2008
Reputation:
4
Java with direct rendering support is not portable too. Even more, with java you would miss directX API and get a lot of headache with openGL support.
Posts: 350
Threads: 13
Joined: Dec 2008
Reputation:
0
Location: Portugal, Oeiras
let's just say thats it takes more than 4 minutes extra to calculate a fibonacci sequence in java than in c.
C2D E6550 @ 2333 Mhz oc 3010 Mhz vcore 1.2750v | HD2600XT | P5KC | 1 + 1 GB G.Skill 6400HK 860 4.4.3.5
Posts: 619
Threads: 2
Joined: Dec 2008
Reputation:
0
I think I just heard xboxflyer volunteer to head the porting project.
Quote:let's just say thats it takes more than 4 minutes extra to calculate a fibonacci sequence in java than in c.
Java can actually come close to (or even beat) C++ in stuff like this. The Java VM is pretty good at translating the bytecode once and running it repeatedly.
What it isn't good at is self-modifying code and the like. If it has to repeatedly translate different bytecode chunks because they keep changing and no optimization can be found to speed up the process, you'll see a big difference in performance.
Interesting story: before I discovered reflection and related concepts, I wrote my own massive Java class that abused parts of the language to enable self-modifying code in much the same way I'd do it in assembler. Spent days on it, only to find the standard library provides all the utility I just rewrote.
"This thread should be closed immediately, it causes parallel imagination and multiprocess hallucination" --ardhi
Posts: 350
Threads: 13
Joined: Dec 2008
Reputation:
0
Location: Portugal, Oeiras
I am just talking about a experience in one of my college class, C vs Java made by teacher, and it happened just like i have said before.
C2D E6550 @ 2333 Mhz oc 3010 Mhz vcore 1.2750v | HD2600XT | P5KC | 1 + 1 GB G.Skill 6400HK 860 4.4.3.5
|