Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi all,

int result = ISHELL_SetTimer(data->mGame.GetShell(), TickTime,
(PFNNOTIFY)(timer_tick), static_cast < void * > (data));

Throughs run time exception ..

Unhandled exception at 0x06231a5f (New_Game.dll) in BREW_Simulator.exe: 0xC0000005: Access violation reading location 0x00000000.

Please Help me fro the same...

Regards ,
San.

Make sure that you are passing valid data/Interface pointers to ISHELL_SetTimer.
I am worried about last param "data".

Make sure that you are passing valid data/Interface pointers to ISHELL_SetTimer.
I am worried about last param "data".

adhudase wrote:Make sure that you are passing valid data/Interface pointers to ISHELL_SetTimer.
I am worried about last param "data".
Hi atul,
I am passing param data for following structure
typedef struct _New_Game {
AEEApplet a;
Game mGame;
int mOldTime;
AEEDeviceInfo DeviceInfo;
New_Game;
thn wht is prob. For crash the application..
Thanx...

adhudase wrote:Make sure that you are passing valid data/Interface pointers to ISHELL_SetTimer.
I am worried about last param "data".
Hi atul,
I am passing param data for following structure
typedef struct _New_Game {
AEEApplet a;
Game mGame;
int mOldTime;
AEEDeviceInfo DeviceInfo;
New_Game;
thn wht is prob. For crash the application..
Thanx...

remove static_cast < void * > and try.

remove static_cast < void * > and try.

adhudase wrote:remove static_cast < void * > and try.
I tried for removing static_cast < void * > still it is crash....

adhudase wrote:remove static_cast < void * > and try.
I tried for removing static_cast < void * > still it is crash....

Is it possible for you to attach the source code snippet?

Is it possible for you to attach the source code snippet?

adhudase wrote:Is it possible for you to attach the source code snippet?
Hi atul,
please see following code , Please tell me mistake wht i did..
/*===========================================================================
FILE: New_Game.cpp
===========================================================================*/
/*===============================================================================
INCLUDES AND VARIABLE DEFINITIONS
=============================================================================== */
#include "AEEModGen.h" // Module interface definitions
#include "AEEAppGen.h" // Applet interface definitions
#include "AEEShell.h" // Shell interface definitions
#include "AEEFile.h" // File interface definitions
#include "AEENet.h" // Socket interface definitions
#include "AEESound.h" // Sound Interface definitions
#include "AEETapi.h" // TAPI Interface definitions
#include "AEEStdLib.h"
#include "New_Game.bid"
#include "Game.h"
typedef struct _New_Game {
AEEApplet a; // The compulsory applet structure
Game mGame; // Our game class
int mOldTime; // used to track the speed we are running at
AEEDeviceInfo DeviceInfo; // always have access to the hardware device information
} New_Game;
static boolean New_Game_HandleEvent(New_Game* pMe,
AEEEvent eCode, uint16 wParam,
uint32 dwParam);
boolean New_Game_InitAppData(New_Game* pMe);
void timer_tick(void * data);
void SetTimer(New_Game * data);
void New_Game_FreeAppData(New_Game* pMe);
//void timer_tick(void * data);
const int WantedFPS = 20;
const int TickTime = 1000000000;// WantedFPS;
int AEEClsCreateInstance(AEECLSID ClsId, IShell *pIShell, IModule *po, void **ppObj)
{
*ppObj = NULL;
if( ClsId == AEECLSID_NEW_GAME )
{
// Create the applet and make room for the applet structure
if( AEEApplet_New(sizeof(New_Game),
ClsId,
pIShell,
po,
(IApplet**)ppObj,
(AEEHANDLER)New_Game_HandleEvent,
(PFNFREEAPPDATA)New_Game_FreeAppData) ) // the FreeAppData function is called after sending EVT_APP_STOP to the HandleEvent function
{
if(New_Game_InitAppData((New_Game*)*ppObj))
{
//Data initialized successfully
return(AEE_SUCCESS);
}
else
{
//Release the applet. This will free the memory allocated for the applet when
// AEEApplet_New was called.
IAPPLET_Release((IApplet*)*ppObj);
return EFAILED;
}
} // end AEEApplet_New
}
return(EFAILED);

static boolean New_Game_HandleEvent(New_Game* pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
switch (eCode)
{
// App is told it is starting up
case EVT_APP_START:
// Add your code here...
SetTimer(pMe);
return(TRUE);
// App is told it is exiting
case EVT_APP_STOP:
// Add your code here...
return(TRUE);
// App is being suspended
case EVT_APP_SUSPEND:
// Add your code here...
return(TRUE);
// App is being resumed
case EVT_APP_RESUME:
// Add your code here...
return(TRUE);
case EVT_APP_MESSAGE:
// Add your code here...
return(TRUE);
case EVT_KEY_PRESS:
pMe->mGame.KeyPressed(wParam);
return TRUE;
case EVT_KEY_RELEASE:
pMe->mGame.KeyReleased(wParam);
return TRUE;
// If nothing fits up to this point then we'll just break out
default:
break;
}
return FALSE;

// this function is called when your application is starting up
boolean New_Game_InitAppData(New_Game * pMe)
{
pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo);
ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&pMe->DeviceInfo);
return TRUE;

// this function is called when your application is exiting
void New_Game_FreeAppData(New_Game* pMe)
{
// insert your code here for freeing any resources you have allocated...
// example to use for releasing each interface:
// if ( pMe->pIMenuCtl != NULL ) // check for NULL first
// {
// IMENUCTL_Release(pMe->pIMenuCtl) // release the interface
// pMe->pIMenuCtl = NULL; // set to NULL so no problems trying to free later
// }
//
}
void timer_tick(void * data)
{
New_Game * tp1 = static_cast < New_Game * > (data);
int TimeElapsed = GETUPTIMEMS() - tp1->mOldTime;
tp1->mOldTime = GETUPTIMEMS();
tp1->mGame.Tick(TimeElapsed);
SetTimer(tp1);

void SetTimer(New_Game * data)
{
IShell *pIShell ;
int result = ISHELL_SetTimer(
pIShell, TickTime,
timer_tick, data);
// timer_tick(data);
if (result != SUCCESS)
{
DBGPRINTF(" *** SetTimer failed");
}

Thanx.......
San.

adhudase wrote:Is it possible for you to attach the source code snippet?
Hi atul,
please see following code , Please tell me mistake wht i did..
/*===========================================================================
FILE: New_Game.cpp
===========================================================================*/
/*===============================================================================
INCLUDES AND VARIABLE DEFINITIONS
=============================================================================== */
#include "AEEModGen.h" // Module interface definitions
#include "AEEAppGen.h" // Applet interface definitions
#include "AEEShell.h" // Shell interface definitions
#include "AEEFile.h" // File interface definitions
#include "AEENet.h" // Socket interface definitions
#include "AEESound.h" // Sound Interface definitions
#include "AEETapi.h" // TAPI Interface definitions
#include "AEEStdLib.h"
#include "New_Game.bid"
#include "Game.h"
typedef struct _New_Game {
AEEApplet a; // The compulsory applet structure
Game mGame; // Our game class
int mOldTime; // used to track the speed we are running at
AEEDeviceInfo DeviceInfo; // always have access to the hardware device information
} New_Game;
static boolean New_Game_HandleEvent(New_Game* pMe,
AEEEvent eCode, uint16 wParam,
uint32 dwParam);
boolean New_Game_InitAppData(New_Game* pMe);
void timer_tick(void * data);
void SetTimer(New_Game * data);
void New_Game_FreeAppData(New_Game* pMe);
//void timer_tick(void * data);
const int WantedFPS = 20;
const int TickTime = 1000000000;// WantedFPS;
int AEEClsCreateInstance(AEECLSID ClsId, IShell *pIShell, IModule *po, void **ppObj)
{
*ppObj = NULL;
if( ClsId == AEECLSID_NEW_GAME )
{
// Create the applet and make room for the applet structure
if( AEEApplet_New(sizeof(New_Game),
ClsId,
pIShell,
po,
(IApplet**)ppObj,
(AEEHANDLER)New_Game_HandleEvent,
(PFNFREEAPPDATA)New_Game_FreeAppData) ) // the FreeAppData function is called after sending EVT_APP_STOP to the HandleEvent function
{
if(New_Game_InitAppData((New_Game*)*ppObj))
{
//Data initialized successfully
return(AEE_SUCCESS);
}
else
{
//Release the applet. This will free the memory allocated for the applet when
// AEEApplet_New was called.
IAPPLET_Release((IApplet*)*ppObj);
return EFAILED;
}
} // end AEEApplet_New
}
return(EFAILED);

static boolean New_Game_HandleEvent(New_Game* pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
switch (eCode)
{
// App is told it is starting up
case EVT_APP_START:
// Add your code here...
SetTimer(pMe);
return(TRUE);
// App is told it is exiting
case EVT_APP_STOP:
// Add your code here...
return(TRUE);
// App is being suspended
case EVT_APP_SUSPEND:
// Add your code here...
return(TRUE);
// App is being resumed
case EVT_APP_RESUME:
// Add your code here...
return(TRUE);
case EVT_APP_MESSAGE:
// Add your code here...
return(TRUE);
case EVT_KEY_PRESS:
pMe->mGame.KeyPressed(wParam);
return TRUE;
case EVT_KEY_RELEASE:
pMe->mGame.KeyReleased(wParam);
return TRUE;
// If nothing fits up to this point then we'll just break out
default:
break;
}
return FALSE;

// this function is called when your application is starting up
boolean New_Game_InitAppData(New_Game * pMe)
{
pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo);
ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&pMe->DeviceInfo);
return TRUE;

// this function is called when your application is exiting
void New_Game_FreeAppData(New_Game* pMe)
{
// insert your code here for freeing any resources you have allocated...
// example to use for releasing each interface:
// if ( pMe->pIMenuCtl != NULL ) // check for NULL first
// {
// IMENUCTL_Release(pMe->pIMenuCtl) // release the interface
// pMe->pIMenuCtl = NULL; // set to NULL so no problems trying to free later
// }
//
}
void timer_tick(void * data)
{
New_Game * tp1 = static_cast < New_Game * > (data);
int TimeElapsed = GETUPTIMEMS() - tp1->mOldTime;
tp1->mOldTime = GETUPTIMEMS();
tp1->mGame.Tick(TimeElapsed);
SetTimer(tp1);

void SetTimer(New_Game * data)
{
IShell *pIShell ;
int result = ISHELL_SetTimer(
pIShell, TickTime,
timer_tick, data);
// timer_tick(data);
if (result != SUCCESS)
{
DBGPRINTF(" *** SetTimer failed");
}

Thanx.......
San.

san wrote:Hi all,
int result = ISHELL_SetTimer(data->mGame.GetShell(), TickTime,
(PFNNOTIFY)(timer_tick), static_cast < void * > (data));
Throughs run time exception ..
Unhandled exception at 0x06231a5f (New_Game.dll) in BREW_Simulator.exe: 0xC0000005: Access violation reading location 0x00000000.
Please Help me fro the same...
Regards ,
San.
yout timer_tick fun shuld be declared static
edited...
ur shell pointer does not have proper instance, get it or instanitate it

san wrote:Hi all,
int result = ISHELL_SetTimer(data->mGame.GetShell(), TickTime,
(PFNNOTIFY)(timer_tick), static_cast < void * > (data));
Throughs run time exception ..
Unhandled exception at 0x06231a5f (New_Game.dll) in BREW_Simulator.exe: 0xC0000005: Access violation reading location 0x00000000.
Please Help me fro the same...
Regards ,
San.
yout timer_tick fun shuld be declared static
edited...
ur shell pointer does not have proper instance, get it or instanitate it

mk.manju wrote:yout timer_tick fun shuld be declared static
edited...
ur shell pointer does not have proper instance, get it or instanitate it
I get it.
Thanx mk.manju........

mk.manju wrote:yout timer_tick fun shuld be declared static
edited...
ur shell pointer does not have proper instance, get it or instanitate it
I get it.
Thanx mk.manju........