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


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


About the author
On the bus again... :)
#22
03/26/2009 (6:54 pm)
Hi Javier Canon! I have done following your advise. compile ok, but play game.exe don't work. I don't know why it dose't work. I am very glad to see your replay, Tks
#23
06/07/2009 (11:19 pm)
i can't download llmozlib, the link is broken, please give me another link, thanks
#24
10/25/2009 (2:40 pm)
@Yadhi, download link updated.
#25
I'm having problems with the those functions like glDeleteTextures, glGenTextures, glTexImage2D, glTexSubImage2D among others.
Any helps greatly appreciated.
Thanks
11/09/2009 (2:58 am)
Can somebody tell me how to port the opengl codes in this resource for tgea 1.7.1 build?I'm having problems with the those functions like glDeleteTextures, glGenTextures, glTexImage2D, glTexSubImage2D among others.
Any helps greatly appreciated.
Thanks
#26
01/28/2010 (7:50 am)
thanks for the update 
Torque Owner Americo Amorim
Thanks in advance!