Game Development Community

dev|Pro Game Development Curriculum

TGE embedded Web Browser

by Javier Canon · 10/12/2007 (9:18 pm) · 27 comments

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

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

You need:

- Compile of mozilla with VC8
- guibrowserctrl from www.mmoworkshop.com

Download the files:
code.google.com/p/torquetools/downloads/list

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

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...
------------------------------------------------------------------------

www.dark-wind.com/images/gg/ibrowser.jpg
www.prairiegames.com/tgb_pro_guibrowserctrl.jpg
Page «Previous 1 2
#1
10/12/2007 (11:26 pm)
Thanks Javier.
Very useful.
#2
10/12/2007 (11:50 pm)
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?) :-)
#3
10/13/2007 (12:19 am)
@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. :)
#4
10/13/2007 (2:14 am)
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.
#5
10/13/2007 (2:29 am)
Thanks so much.
#6
10/13/2007 (5:21 am)
@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.
#7
10/13/2007 (1:44 pm)
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?
#8
10/20/2007 (7:00 pm)
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.
#9
11/27/2007 (6:08 am)
@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.
#10
12/14/2007 (2:23 pm)
I was trying to to this but then I realized... I'm using a Mac so it doesn't have the lib folder.
#11
02/22/2008 (8:21 am)
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.
#12
02/22/2008 (10:28 am)
@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.
#13
03/13/2008 (1:03 pm)
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'
#14
03/14/2008 (7:22 am)
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.
#15
03/14/2008 (7:31 am)
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?
#16
03/15/2008 (7:29 am)
if someone wants to e-mail me the files for this i can host them from my stie for a long while.
#17
03/17/2008 (7:58 am)
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.
#18
03/24/2008 (4:52 am)
hey thats cool, just let me know. I could really use those files.
#19
04/28/2008 (4:58 pm)
I update the link of mozilla lib, try to download now.
#20
05/11/2008 (2:15 am)
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.
Page «Previous 1 2