Game Development Community

GameSWF/GuiFlash Problems

by Aaron E · in Torque Game Engine · 05/18/2006 (1:37 pm) · 21 replies

Hello all,

I've been trying to get Flash content into my Torque app for a couple of weeks now without any luck. I've lost track of the number of hours/days I've invested in this. The resource I'm referring to can be found at . . .

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7119

I've tried it several times but it doesn't want to work. Neither the original silent guiFlash component nor the audio-enabled guiFlash component seems to be compatible with my feeble brain.

Earlier today, I posted a help request at the bottom of that resource thread, but at this point, I'm willing to pay someone to help me get this in successfully. Apparently I need a lot of hand-holding with this resource.

So, I'm willing to pay $100 (USD) to the first person to help me get this working in my app. The method doesn't really matter -- IRC, E-mail, detailed "how-to" document (or all of the above).

By the way, I haven't figured out how to issue an official bounty yet, so hopefully it's ok to post it here.

Thanks
Page «Previous 1 2
#1
05/19/2006 (12:22 am)
I have get it to work incl sound for both, torque and flash.

Have asked my chef, its ok if i post it as a ressource here ;)

Save your money for a good party ;) and give me a weekend time, i will try to put it to a complete "how-to" ressource and post it here ;) as a small gift for torque-community from our company ;)
#2
05/19/2006 (7:52 am)
Wow. That is great news. Thank you.
#3
05/23/2006 (5:54 am)
... Is still in my mind, was no time this weekend ;) ...
#4
05/23/2006 (9:19 am)
No problem. I'm just really glad that you're willing to help with this.

:)
#5
05/29/2006 (7:53 am)
So, i havent tested it yet, no time, sorry ;)
But it should work.. if i havent forgot some thing ;)

This works with TGE 1.4 + TLK 1.4
Compile with VS C++ Express Edition. It will NOT work with VC6.


Get these Files:
http://www.knowhere.net/gg/guiFlash.zip (Flash-Gui for Torque)
http://www.garagegames.com/uploaded/code/7480.stl_fix.h


Copy following files, and add to you project:

gameswf (complete folder) to engine/
stl_fix.h to engine/core/
guiFlash.cc to engine/gui/

DONT ADD audioBuffer.cc and audioBuffer.h (!!!)

=====================================================================================
engine/platform/platform.h

change this:
extern void* FN_CDECL operator new(dsize_t size, const char*, const U32);
extern void* FN_CDECL operator new[](dsize_t size, const char*, const U32);
extern void FN_CDECL operator delete(void* ptr);
extern void FN_CDECL operator delete[](void* ptr);
#define new new(__FILE__, __LINE__)

to this
extern void* FN_CDECL operator new(dsize_t size);
extern void* FN_CDECL operator new[](dsize_t size);
extern void FN_CDECL operator delete(void* ptr);
extern void FN_CDECL operator delete[](void* ptr);
extern void dPopMemManFileLine( const char*&, U32& );
extern int dPushMemManFileLine( const char*, const U32 );
#define new dPushMemManFileLine( __FILE__, __LINE__ ) ? 0 : new

=====================================================================================
engine\platform\platformMemory.cc

change this:
void* FN_CDECL operator new(dsize_t, void* ptr)
{
return (ptr);
}

to this:
void* FN_CDECL operator new(dsize_t, void* ptr)
{
const char* fileName = 0;
U32 line;
dPopMemManFileLine( fileName, line ); // dummy does nothing except keep the stack in order
return (ptr);
}

=====================================================================================
engine\platform\platformMemory.cc

change this:
#if !defined(TORQUE_DISABLE_MEMORY_MANAGER)

// Manage our own memory, add overloaded memory operators and functions
void* FN_CDECL operator new(dsize_t size, const char* fileName, const U32 line)
{
return Memory::alloc(size, false, fileName, line);
}

void* FN_CDECL operator new[](dsize_t size, const char* fileName, const U32 line)
{
return Memory::alloc(size, true, fileName, line);
}

void* FN_CDECL operator new(dsize_t size)
{
return Memory::alloc(size, false, NULL, 0);
}

void* FN_CDECL operator new[](dsize_t size)
{
return Memory::alloc(size, true, NULL, 0);
}

to this:
#if !defined(TORQUE_DISABLE_MEMORY_MANAGER)

static const int NUM_NEW_STACK_SIZE = 256;
static struct { const char* filename; U32 line; } g_NewStackMemDebug[NUM_NEW_STACK_SIZE];
static int g_CurStack = -1;

int dPushMemManFileLine( const char* filename, U32 line )
{
if(g_CurStack >= NUM_NEW_STACK_SIZE )
return 0;

g_CurStack++;
g_NewStackMemDebug[g_CurStack].filename = filename;
g_NewStackMemDebug[g_CurStack].line = line;

return 0; // needed for the new passthrough trick

}

void dPopMemManFileLine( const char*& filename, U32& line )
{
if( g_CurStack < 0 )
{
filename = 0;
line = 0;
return;
} else
{
filename = g_NewStackMemDebug[g_CurStack].filename;
line = g_NewStackMemDebug[g_CurStack].line;
g_CurStack--;
}
}

// Manage our own memory, add overloaded memory operators and functions

void* FN_CDECL operator new(dsize_t size)
{
const char* fileName = 0;
U32 line;
dPopMemManFileLine( fileName, line );
return Memory::alloc(size, false, fileName, line);
}

void* FN_CDECL operator new[](dsize_t size)
{
const char* fileName = 0;
U32 line;
dPopMemManFileLine( fileName, line );
return Memory::alloc(size, true, fileName, line);
}

=====================================================================================
engine/platformWin32/winMemory.cc

change this:
void* FN_CDECL operator new(dsize_t, void* ptr)
{
return (ptr);
}

to this:
void* FN_CDECL operator new(dsize_t, void* ptr)
{
const char* fileName = 0;
U32 line;
dPopMemManFileLine( fileName, line ); // dummy does nothing except keep the stack in order
return (ptr);
}

=====================================================================================
engine/audio/audioBuffer.h

below this line:
ALuint getALBuffer();

add:
bool loadRAW(ALenum format, char* data, ALsizei size, ALsizei freq);

=====================================================================================
engine/audio/audioBuffer.cc

before this line of code:
#ifndef TORQUE_NO_OGGVORBIS

add:
bool AudioBuffer::loadRAW(ALenum format, char* data, ALsizei size, ALsizei freq)
{
alGenBuffers(1, &malBuffer);
if(alGetError() != AL_NO_ERROR)
return false;

alBufferData(malBuffer, format, data, size, freq);
return (alGetError() == AL_NO_ERROR);
}

====================================================================================
engine/gameswf/gameswf_action.cpp

comment out this line:

s_global->set_member("ASSetPropFlags", as_global_assetpropflags);

====================================================================================
engine/gameswf/gameswf_render_handler_ogl.cpp

change this:
#include "gui/guiControl.h"

to this:
#include "gui/core/guiControl.h"

====================================================================================
engine/gui/guiFlash.cc

change this:
#include "gui/guiControl.h"

to this:
#include "gui/core/guiControl.h"
====================================================================================
Compile.


Add this to your (gui) script:
===================================================================================
new GuiFlash(myFlashObj)
{
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "371 359";
minExtent = "8 2";
visible = "1";
movieName = "./project/data/flash/flash.swf";
backgroundAlpha = "1";
loopMovie = "1";
audioDescription = AudioGui; // hey look at me! I'm new! audioGui is defined in client/scripts/audioProfiles.cs
};

=================================================================================
and start it somewhere in your game with:

myFlashObj.playMovie();


Alex (Stalker) Sakablukow
Lead Programmer
VS-Digital GmbH, Hamburg, Germany.
www.vs-digital.com
#6
05/29/2006 (12:42 pm)
Alex,

Wow. This looks great. I'll get started on it right away.

Thank you for doing this.
#7
05/29/2006 (6:12 pm)
Hello again,

I have followed everything as closely as I can and still seem to be getting problems. Specifically, linker errors. Here's what it looks like . . .

Torque Demo error LNK2001: unresolved external symbol "class tu_file * __cdecl zlib_adapter::make_inflater(class tu_file *)" (?make_inflater@zlib_adapter@@YAPAVtu_file@@PAV2@@Z)
Torque Demo error LNK2001: unresolved external symbol "class tu_file * __cdecl zlib_adapter::make_inflater(class tu_file *)" (?make_inflater@zlib_adapter@@YAPAVtu_file@@PAV2@@Z)
Torque Demo error LNK2001: unresolved external symbol "double __cdecl tu_timer::profile_ticks_to_seconds(unsigned __int64)" (?profile_ticks_to_seconds@tu_timer@@YAN_K@Z)
Torque Demo error LNK2001: unresolved external symbol "public: __thiscall image::alpha::~alpha(void)" (??1alpha@image@@QAE@XZ)
Torque Demo error LNK2001: unresolved external symbol "public: __thiscall image::alpha::alpha(int,int)" (??0alpha@image@@QAE@HH@Z)
Torque Demo error LNK2001: unresolved external symbol "public: __thiscall image::rgb::~rgb(void)" (??1rgb@image@@QAE@XZ)
Torque Demo error LNK2001: unresolved external symbol "public: __thiscall image::rgb::~rgb(void)" (??1rgb@image@@QAE@XZ)
Torque Demo error LNK2001: unresolved external symbol "public: __thiscall image::rgba::~rgba(void)" (??1rgba@image@@QAE@XZ)
Torque Demo error LNK2001: unresolved external symbol "public: __thiscall image::rgba::~rgba(void)" (??1rgba@image@@QAE@XZ)
Torque Demo error LNK2001: unresolved external symbol "public: __thiscall image::rgba::~rgba(void)" (??1rgba@image@@QAE@XZ)
Torque Demo error LNK2001: unresolved external symbol "public: __thiscall tu_file::~tu_file(void)" (??1tu_file@@QAE@XZ)
Torque Demo error LNK2001: unresolved external symbol "public: __thiscall tu_file::~tu_file(void)" (??1tu_file@@QAE@XZ)
Torque Demo error LNK2001: unresolved external symbol "public: __thiscall tu_file::tu_file(char const *,char const *)" (??0tu_file@@QAE@PBD0@Z)
Torque Demo error LNK2001: unresolved external symbol "public: bool __thiscall image::alpha::operator==(struct image::alpha const &)const " (??8alpha@image@@QBE_NABU01@@Z)
Torque Demo error LNK2001: unresolved external symbol "public: class tu_string __thiscall tu_string::utf8_substring(int,int)const " (?utf8_substring@tu_string@@QBE?AV1@HH@Z)
Torque Demo error LNK2001: unresolved external symbol "public: class tu_string __thiscall tu_string::utf8_to_lower(void)const " (?utf8_to_lower@tu_string@@QBE?AV1@XZ)
Torque Demo error LNK2001: unresolved external symbol "public: class tu_string __thiscall tu_string::utf8_to_upper(void)const " (?utf8_to_upper@tu_string@@QBE?AV1@XZ)
Torque Demo error LNK2001: unresolved external symbol "public: int __thiscall tu_file::copy_bytes(class tu_file *,int)" (?copy_bytes@tu_file@@QAEHPAV1@H@Z)
Torque Demo error LNK2001: unresolved external symbol "public: static int __cdecl tu_string::stricmp(char const *,char const *)" (?stricmp@tu_string@@SAHPBD0@Z)
Torque Demo error LNK2001: unresolved external symbol "public: static int __cdecl tu_string::stricmp(char const *,char const *)" (?stricmp@tu_string@@SAHPBD0@Z)
Torque Demo error LNK2001: unresolved external symbol "public: static int __cdecl tu_string::stricmp(char const *,char const *)" (?stricmp@tu_string@@SAHPBD0@Z)
Torque Demo error LNK2001: unresolved external symbol "public: static int __cdecl tu_string::stricmp(char const *,char const *)" (?stricmp@tu_string@@SAHPBD0@Z)
Torque Demo error LNK2001: unresolved external symbol "public: static int __cdecl tu_string::stricmp(char const *,char const *)" (?stricmp@tu_string@@SAHPBD0@Z)
Torque Demo error LNK2001: unresolved external symbol "public: static int __cdecl tu_string::stricmp(char const *,char const *)" (?stricmp@tu_string@@SAHPBD0@Z)
Torque Demo error LNK2001: unresolved external symbol "public: static int __cdecl tu_string::stricmp(char const *,char const *)" (?stricmp@tu_string@@SAHPBD0@Z)
Torque Demo error LNK2001: unresolved external symbol "public: static int __cdecl tu_string::utf8_char_count(char const *,int)" (?utf8_char_count@tu_string@@SAHPBDH@Z)
Torque Demo error LNK2001: unresolved external symbol "public: static int __cdecl tu_string::utf8_char_count(char const *,int)" (?utf8_char_count@tu_string@@SAHPBDH@Z)

This is only part of the list of linker errors, but they all seem to follow the same pattern. It may be something simple that I'm leaving out, but I can't seem to discover the problem.

Thank you again
#8
05/29/2006 (11:12 pm)
Seems to be a simple linking error.
have you checked include files? What have you used to compile?
I have used VS C++ 2005 Express Edition + latest DirectX + MS Platform SDK SP2.

But maybe i have added/modifed one of the include-files without comment it.. i will compare it with a clean 1.4 version if i find time today.
#9
05/30/2006 (2:57 pm)
Hi Alex,

A few months ago, I switched from VS 6 to VS C++ 7.1. If possible, I'd like to get this working with 7.1, but if I need to go with 2005 Express, I can do that.

I've checked my includes and can't see anything I'm missing.

There was one problem with your instructions above, that I wasn't sure what to do with. I couldn't find this block of code within engine/platform/platformMemory.cc . . .

void* FN_CDECL operator new(dsize_t, void* ptr)
{
return (ptr);
}

I've made several attempts with this section of code, including a variety of locations for it and leaving it out entirely . . .

void* FN_CDECL operator new(dsize_t, void* ptr)
{
const char* fileName = 0;
U32 line;
dPopMemManFileLine( fileName, line ); // dummy does nothing except keep the stack in order
return (ptr);
}

Unfortunately, it doesn't seem to affect the outcome in any way.

Hopefully this will help some.


[Edit: Fixed a thinko]
#10
05/31/2006 (5:04 am)
What TGE version do you use? 1.4?

this peace of code:
Quote:
void* FN_CDECL operator new(dsize_t, void* ptr)
{
return (ptr);
}
you can find at line 41 in clean TGE 1.4 Version.
#11
06/01/2006 (10:35 am)
Hello again,

That bit of code is for engine/platformWin32/winMemory.cc. That one worked perfectly from your instructions. (found in your fourth code block)

However, that step was also mentioned for engine/platform/platformMemory.cc file as well. (In the second code block from your instruction post). That's where I ran into problems. I'm guessing that it's not required for platformMemory and that I should ignore the second code block entirely. I tried multiple ways of including the code for the file, but in the last attempts, I have just left it out.

I'm using a clean version of TGE (from the installer exe, not CVS) that I downloaded to apply the gameSWF/FlashGUI code to.

One more thing, in guiFlash.cc (from the offsite download), VS gave me an error because of this line of code (ln 51) . . .

#include "gui/guiControl.h"

I changed it to read . . .

#include "gui/core/guiControl.h"

Which cleared up one error.

After multiple attempts, I'm still getting the following linker errors . . .

Torque Demo error LNK2001: unresolved external symbol "public: __thiscall tu_file::tu_file(char const *,char const *)" (??0tu_file@@QAE@PBD0@Z)
Torque Demo error LNK2001: unresolved external symbol "public: void __thiscall gameswf::ref_counted::drop_ref(void)const " (?drop_ref@ref_counted@gameswf@@QBEXXZ)
Torque Demo error LNK2001: unresolved external symbol "struct gameswf::movie_definition * __cdecl gameswf::create_movie(char const *)" (?create_movie@gameswf@@YAPAUmovie_definition@1@PBD@Z)
Torque Demo error LNK2001: unresolved external symbol "struct gameswf::render_handler * __cdecl gameswf::create_render_handler_ogl(void)" (?create_render_handler_ogl@gameswf@@YAPAUrender_handler@1@XZ)
Torque Demo error LNK2001: unresolved external symbol "struct gameswf::sound_handler * __cdecl gameswf::create_sound_handler_tge(class AudioDescription *,char const *)" (?create_sound_handler_tge@gameswf@@YAPAUsound_handler@1@PAVAudioDescription@@PBD@Z)
Torque Demo error LNK2001: unresolved external symbol "void __cdecl gameswf::clear(void)" (?clear@gameswf@@YAXXZ)
Torque Demo error LNK2001: unresolved external symbol "void __cdecl gameswf::get_movie_info(char const *,int *,int *,int *,float *,int *,int *)" (?get_movie_info@gameswf@@YAXPBDPAH11PAM11@Z)
Torque Demo error LNK2001: unresolved external symbol "void __cdecl gameswf::notify_key_event(enum gameswf::key::code,bool)" (?notify_key_event@gameswf@@YAXW4code@key@1@_N@Z)
Torque Demo error LNK2001: unresolved external symbol "void __cdecl gameswf::register_file_opener_callback(class tu_file * (__cdecl*)(char const *))" (?register_file_opener_callback@gameswf@@YAXP6APAVtu_file@@PBD@Z@Z)
Torque Demo error LNK2001: unresolved external symbol "void __cdecl gameswf::register_fscommand_callback(void (__cdecl*)(struct gameswf::movie_interface *,char const *,char const *))" (?register_fscommand_callback@gameswf@@YAXP6AXPAUmovie_interface@1@PBD1@Z@Z)
Torque Demo error LNK2001: unresolved external symbol "void __cdecl gameswf::register_log_callback(void (__cdecl*)(bool,char const *))" (?register_log_callback@gameswf@@YAXP6AX_NPBD@Z@Z)
Torque Demo error LNK2001: unresolved external symbol "void __cdecl gameswf::set_render_handler(struct gameswf::render_handler *)" (?set_render_handler@gameswf@@YAXPAUrender_handler@1@@Z)
Torque Demo error LNK2001: unresolved external symbol "void __cdecl gameswf::set_sound_handler(struct gameswf::sound_handler *)" (?set_sound_handler@gameswf@@YAXPAUsound_handler@1@@Z)
Torque Demo fatal error LNK1120: 13 unresolved externals
C:\projects\tge14\engine\core\unicode.cc(17): warning C4068: unknown pragma
C:\projects\tge14\engine\core\unicode.cc(33): warning C4068: unknown pragma
C:\projects\tge14\engine\core\unicode.cc(44): warning C4068: unknown pragma
C:\projects\tge14\engine\core\unicode.cc(48): warning C4068: unknown pragma
C:\projects\tge14\engine\core\unicode.cc(51): warning C4068: unknown pragma
C:\projects\tge14\engine\core\unicode.cc(63): warning C4068: unknown pragma
C:\projects\tge14\engine\core\unicode.cc(198): warning C4068: unknown pragma
C:\projects\tge14\engine\core\unicode.cc(334): warning C4068: unknown pragma

I'll try again using VS 2005 Express today and see if that solves the problem.

I do appreciate your help with this. I'm sorry to be such a burden.
#12
06/01/2006 (11:14 pm)
Is still a linking error....

this: "create_sound_handler_tge" can you find in gameswf.. have you created all folders (with underfolder) for gameswf? And added all files to you project?

And thx to be a beta-tester for this *g* ;)
#13
06/02/2006 (12:11 am)
Hi Alex,

I tried it again, from start to finish using VS 2005 Express on a clean version of Torque and unfortunately, I'm still getting linker errors.

I think I've created or added all of the files and folders. And included them into the project.

I found the create_sound_handler_tge reference in four files (guiFlash.cc, gameswf_soundhandler_tge.cpp, gameswf.h, and guiFlash.cc).

I'm not sure what I should do now. My brain hurts. :(
#14
06/02/2006 (3:28 am)
Here a vew changes more:

====================================================================================
engine/gameswf/gameswf_action.cpp

comment out this line:

s_global->set_member("ASSetPropFlags", as_global_assetpropflags);

====================================================================================
engine/gameswf/gameswf_render_handler_ogl.cpp

change this:
#include "gui/guiControl.h"

to this:
#include "gui/core/guiControl.h"

====================================================================================
engine/gui/guiFlash.cc

change this:
#include "gui/guiControl.h"

to this:
#include "gui/core/guiControl.h"
====================================================================================
#15
06/02/2006 (3:35 pm)
Alex,

Success!!! Almost. :)

Thanks to you, I now have flash movie clips playing in my Torque application. This is very good news. Currently, the clips do not play any sounds, but I am closer to my goal now. I will try to discover what's wrong with the sound and will post my results here.

You have been a big help to me with this.

Thank you!
#16
06/05/2006 (10:58 pm)
What version of Torque you use?
audioBuffer.cc/h that you find in this ressource (http://www.knowhere.net/gg/guiFlash.zip) are incompatible with TGE 1.4
#17
06/06/2006 (7:32 am)
Hi Alex,

I'm using a fresh version of Torque 1.4 (from the download EXE file, not CVS). I didn't add the audiobuffer files from the zip, I just made the changes to the original files (from your instructions).

Also, something I didn't notice before, my in-Torque Flash movies do not detect mouse clicks of any type. So all interactivity is lost as well. I'm working on that problem too. It's just going slowly.

I will dig into it today and see what I can find. If that doesn't work for me, I may start over again from scratch.

In spite of these issues, I'm very excited about getting Flash into my app. Each step is bringing me a little closer to my goal.


[Edit: added a thought]
#18
06/07/2006 (11:00 pm)
Have you managed it now?
All dates must be packed in a single swf file, and not all flash-functions are implemented.
#19
06/08/2006 (8:03 am)
Hello,

I tried a few more times using clean 1.4 installs, and I still don't have Flash audio. Default WAV and OGG audio still work fine. Also, mouse click are now working for the Flash movies -- so that is good news. It looks like Flash audio is the only remaining problem at this point.
#20
06/09/2006 (4:18 am)
The sound files schould be includet into the swf and be in raw or ADPCM format.
Page «Previous 1 2