Previous Blog Next Blog
Prev/Next Blog
by date

TGE embedded Web Browser

TGE embedded Web Browser
Name:Javier Canon
Date Posted:Oct 13, 2007
Rating:4.7 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Javier Canon

Blog post
This is my first contribution to this great community, some minor bugs need to be fixed...

I am based in the work of:
www.mmoworkshop.com/trac/mom/wiki/TGBBrowser
ubrowser.com/downloads.php

You need:

- Compile of mozilla with VC8 download link: www.softcannon.com/llmozlibVC8_ver1.zip
- guibrowserctrl From www.mmoworkshop.com/trac/mom/wiki/TGBBrowser

--------------------------------------------------------

The instructions for VS 2005 -VC8:

1. Copy llmozlib to your engine/lib folder

2. Make a folder called "browser" in your engine/source/gui folder and copy guiBrowserCtrl.h and guiBrowserCtrl.cc into it

3. Open up engine/compilers/VisualStudio.net/TGE SDK.sln in Visual Studio .NET 2005

4. Add a "browser" folder to the TGE project under Source Files/gui, then add the guiBrowserCtrl.h and guiBrowserCtrl.cc to this folder. (from http://www.mmoworkshop.com/trac/mom/wiki/TGBBrowser )

5. Select the Release build of TGE as the active project

6. Open the Properties for the TGE project

7. Navigate to C++ -> General and add ../../lib/llmozlib/include to Additional Include Directories

8. Navigate to C++ -> Preprocessor and add TORQUE_DISABLE_MEMORY_MANAGER to Preprocessor Definitions (see notes in source about this)

9. Navigate to Linker->General and add ../../lib/llmozlib/win32 to Additional Library Directories

10. Navigate to Linker->Input and add llmozlib.lib to Additional Dependencies

11. In engine/source/platformWin32/winMemory.cc comment out:

/* void* FN_CDECL operator new(dsize_t, void* ptr) {

return (ptr);

} */

12. In engine/source/platform.h make this change:

//extern void* FN_CDECL operator new(dsize_t size, void* ptr);
#include <new>

13. For each project in the TGE SDK solution, change to use Multithreaded DLL Runtime Libraries ( Properties->C/C++->Code Generation->Runtime Library->Multi-threaded DLL):
projects: zlib, lpng, ljpg, lungif, opengl2d3d, glu2d2d, and your game...


14. Clean and then build the TGE project

15. Open games/main.cs and add the below to the onStart and onExit functions:

function onStart() {

initEmbeddedBrowser("WebBrowser");

}

function onExit() {

shutdownEmbeddedBrowser();

}

16. Append to GUI:

new GuiBrowserCtrl(WebBrowser) {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "center";
VertSizing = "center";
Position = "94 75";
Extent = "600 400";
MinExtent = "600 400";
canSave = "1";
Visible = "1";
hovertime = "1000";
defaultWebPage = "http://www.garagegames.com";
};

17. Copy the mozilla "runtime folder" to your game (dlls and subfolders)

18. If you dont have VS 2005 SP1 (better install it...) and you get the error when try to run your game.exe "the app is not configurate correctly":


18.1. include vcredist_x86.exe (or vcredist_IA64.exe or vcredist_x64.exe, depending on what your application is built for) in your application package, so when the user installs your product this will be installed too;

18.2. in the main project of your VC++ 2005 Express application solution make sure you select "Properties > Configuration Properties > Manifest Tool > Input and Output > Embed Manifest > NO" so that the manifest is not included in the output file, but as separate file so you can edit it; it will look something like "game.exe.manifest";

18.3. now in most cases the source of this stupid error is that the version of the msvcr80.dll deployed by the vcredist_x86.exe is 8.00.50727.42 while the version required by your application through that manifest is bigger than that (mine was 8.00.50727.762) - when you install VC++ 2005 Express on your system you get the latest msvcr80.dll but it seems that vcredist_x86.exe has not been updated anymore so you have to use the older version instead (8.00.50727.42), by editing that manifest (with Notepad or something);

18.4. next make sure you don't forget to include the manifest file in your application package or it will spit out an error like "msvcr80.dll not found" even if vcredist_x86.exe was installed on that system...
------------------------------------------------------------------------




Submit ResourceSubmit your own resources!

Stephan (viKKing) Bondier   (Oct 13, 2007 at 06:26 GMT)   Resource Rating: 4
Thanks Javier.
Very useful.

Martin Schultz   (Oct 13, 2007 at 06:50 GMT)
Wow, awesome! Thanks.

Does it work on the Mac too?
(need to add: Yes, I saw it's for Visual Studio, but maybe you already thought of a Mac port?) :-)
Edited on Oct 13, 2007 06:51 GMT

Stephan (viKKing) Bondier   (Oct 13, 2007 at 07:19 GMT)   Resource Rating: 4
@Martin: Sam is working on it, but he is not familiar with the Mac interface code enough.
Any help on the Mac port would be greatly appreciated. :)
Edited on Oct 13, 2007 07:29 GMT

Sam Redfern   (Oct 13, 2007 at 09:14 GMT)
Javier, there's a couple of bugs/incomplete bits I found in Josh's excellent resource, BTW. For example, the embedded Mozilla object never releases the keyboard after it has acquired it from TGE. I'll post some more info later.

Leslie Young   (Oct 13, 2007 at 09:29 GMT)   Resource Rating: 5
Thanks so much.

Martin Schultz   (Oct 13, 2007 at 12:21 GMT)
@Stephan: Hehe, got the message :-) But I know too less at the moment about the Mac, haven't done anything big but compiling Torque. Hopefully some Mac expert can jump in as this is a useful resource.

Ron Nelson   (Oct 13, 2007 at 20:44 GMT)
Has anyone who has tried this had massive problems with textures displaying? Even my loading screens come up pink.

Some of the textures for my interiors, vehicles, and player characters don't show up with this installed. They just show up white.

Funny thing is that the browser is working fine.

Don't suppose this is anything in terms of bugs you guys have seen?

Peter Simard   (Oct 21, 2007 at 02:00 GMT)
Quick FYI:

If you are getting the incorrect version error, you should use the Version:8.0.50727.42 insead of 8.00.50727.42. With the extra zero, it throws an error.

Javier Canon   (Nov 27, 2007 at 14:08 GMT)
@Ron Nelson
I dont have any error with textures...


I cant fix in this moment the keyboard bug, the problem is when the mozilla takes de focus. You can comment the focus line, and use only the mouse.

Tyler Slabinski   (Dec 14, 2007 at 22:23 GMT)
I was trying to to this but then I realized... I'm using a Mac so it doesn't have the lib folder.
Edited on Dec 14, 2007 22:24 GMT

Scott Doerrfeld   (Feb 22, 2008 at 16:21 GMT)
One thing I noticed among it's limitations --- HTTPS doesn't seem to be supported (NOTE: It does seem to be supported in uBrowser). Can someone clue me in as to whether there has been any talk about this on the TGB forums? Is it feasible to have HTTPS support with an in-game browser? Would anyone be interested in collaborating on adding this feature? I think it would be incredibly useful from a client login/payment standpoint.
Edited on Feb 22, 2008 16:29 GMT

Scott Doerrfeld   (Feb 22, 2008 at 18:28 GMT)
@Javier - Can you host the llmozlibvc8 file somewhere or can I get it from you thru e-mail? It seems the previous link is dead.
Edited on Feb 22, 2008 18:29 GMT

Zergcow   (Mar 13, 2008 at 20:03 GMT)
I am trying to do this using 1.5.2 and VS2005. I keep getting conflicts with other .lib files. what should i do?


Linking...
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >::`vbase destructor'(void)" (??_D?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >::str(void)const " (?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >(int)" (??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::operator<<(int)" (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@H@Z) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::basic_ios<char,struct std::char_traits<char> >::setstate(int,bool)" (?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: int __thiscall std::ios_base::width(int)" (?width@ios_base@std@@QAEHH@Z) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,int)" (?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: static bool __cdecl std::char_traits<char>::eq_int_type(int const &,int const &)" (?eq_int_type@?$char_traits@D@std@@SA_NABH0@Z) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: static int __cdecl std::char_traits<char>::eof(void)" (?eof@?$char_traits@D@std@@SAHXZ) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputc(char)" (?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_streambuf<char,struct std::char_traits<char> > * __thiscall std::basic_ios<char,struct std::char_traits<char> >::rdbuf(void)const " (?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: char __thiscall std::basic_ios<char,struct std::char_traits<char> >::fill(void)const " (?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDXZ) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: int __thiscall std::ios_base::flags(void)const " (?flags@ios_base@std@@QBEHXZ) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: int __thiscall std::ios_base::width(void)const " (?width@ios_base@std@@QBEHXZ) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: static unsigned int __cdecl std::char_traits<char>::length(char const *)" (?length@?$char_traits@D@std@@SAIPBD@Z) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::flush(void)" (?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > * __thiscall std::basic_ios<char,struct std::char_traits<char> >::tie(void)const " (?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: bool __thiscall std::ios_base::good(void)const " (?good@ios_base@std@@QBE_NXZ) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::basic_ostream<char,struct std::char_traits<char> >::_Osfx(void)" (?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Lock(void)" (?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in llmozlib_d.lib(llmozlib.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Unlock(void)" (?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in llmozlib_d.lib(llmozlib.obj)
LINK : fatal error LNK1104: cannot open file 'libcpd.lib'


Zergcow   (Mar 14, 2008 at 14:22 GMT)
could someone please mirror the files needed for this? the llmozlibVC8.zip is what i need. the torque build of it i mean. I cant go to "biguploads.com" because that is FAR from work safe.

I think the reason i am getting those errors is because i dont have the torque build of this thing.

Zergcow   (Mar 14, 2008 at 14:31 GMT)
I am using the llmozlib.lib from tgb_pro_guibrowserctrl and now i get 3 errors. so i KNOW my problem is this .lib file. I just need to get the one for TGE not TGB. anyone want to help me out here?

Zergcow   (Mar 15, 2008 at 14:29 GMT)
if someone wants to e-mail me the files for this i can host them from my stie for a long while.

Javier Canon   (Mar 17, 2008 at 14:58 GMT)
Sorrry for the response delay, in this moment i dont have an broad band internet connection (new city), when i will have someone, i submit or send you the files. Meanwhile, maybe you can find the llmozlibVC8.zip in google groups.

Zergcow   (Mar 24, 2008 at 11:52 GMT)
hey thats cool, just let me know. I could really use those files.

Javier Canon   (Apr 28, 2008 at 23:58 GMT)
I update the link of mozilla lib, try to download now.

Joti Carroll   (May 11, 2008 at 09:15 GMT)
I've done a TGEA port of this that I can compile but when I execute I get this error.

The procedure entry point ?sEmptyBuffer@?$nsCharTraits@_W@@2PB_WB could not be located in the dynamic link library xul.dll

I was thinking this may be a missing unicode version of a text function or something. Trouble is I don't seem to be able to compile TGEA 1.7 without unicode so I can't test it. On another note does any one have a debug version of llmozlibVC8.

You must be a member and be logged in to either append comments or rate this resource.