App run on Emulator not on NGAGE (code inside)

Login to reply to this topic.
Fri, 2004-12-03 17:11
Joined: 2004-11-24
Forum posts: 9
This part of code make the App Crash with App. Closed MAIN !


#include "stdio.h"
#include "string.h"

#include "MyApplication.h"
#include "Screen.hpp"
#include "Scroll.hpp"
#include "FighterJoy.hpp"
#include "FighterCpu.hpp"
#include "Anim.hpp"
#include "File.hpp"
//#include "Sound.hpp" **SOUND**
#include "Joy.hpp"
#include "Errors.hpp"

//------------------------------------------------------------------------------------

CWorld::CWorld(void)
{
   Graph.Init();
   Scroll=new CScroll(this);
   Intro=new CIntro(this);
   File=new CFile(this);
}

//------------------------------------------------------------------------------------

CWorld::~CWorld(void)
{
   delete File;
   delete Scroll;
   delete Intro;
}

//------------------------------------------------------------------------------------

bool
CWorld::Init(CGapiDraw *gapidraw)
{
   GapiDraw=gapidraw;
   int len;
   char filename[256];
#ifndef FILES_FROM_RES
   sprintf(filename, "Fighter.txt");
#else
   sprintf(filename, "%sRES\\Fighter.txt",ROOT);
#endif
   if (!File->OpenRead(filename, len))
   {
      return Error.InitFail("Fighter.txt Open Filed!");
   }
   char s[256];
   File->Read(s,len);
   File->Close();
   s[len]='\0';
   int lineend[32];
   int curlineend=0;
   for (int i=0; i<256; ++i)
   {
      if (s[i]=='\r')
      {
         s[i]=0;
         lineend[curlineend++]=i;
      }
   }
   strcpy(BACK_NAME,s);
   strcpy(FIGHTER_1_NAME, &s[lineend[0]+2]);
   strcpy(FIGHTER_2_NAME, &s[lineend[1]+2]);

//   Util.Debug(BACK_NAME);
//   Util.Debug(FIGHTER_1_NAME);
//   Util.Debug(FIGHTER_2_NAME);

//   Sound.Init(); **SOUND**
   if (!InitMenu())
      return false;
   return true;
}

//------------------------------------------------------------------------------------

bool
CWorld::InitMenu(void)
{
   CurMode=MODE_MENU;
   JoyPad.SetAutoRepeat(false);
   if (!Intro->Load("Start"))
      return false;
   return true;
}

//------------------------------------------------------------------------------------

bool
CWorld::InitFight(const char *backgroundName)
{
   JoyPad.SetAutoRepeat(true);
   strcpy(BackgroundName, backgroundName);
   Scroll->LoadBackground(backgroundName);
   VictoryBackLoaded=false;

/*   FighterJoy=new CFighterJoy(this, FIGHTER_1_NAME,"",-90);
   FighterCPU=new CFighterCPU(this, FIGHTER_2_NAME,"",90);
   FighterJoy->SetOpponent((CFighter*)FighterCPU);
   FighterCPU->SetOpponent((CFighter*)FighterJoy);
*/
   return true;
}

//------------------------------------------------------------------------------------

void
CWorld::EndFight(void)
{
//   delete FighterJoy;
//   delete FighterCPU;
   Graph.ReleaseSurfaces();
/*   Sound.ReleaseWaves(); **SOUND**
   Scroll->Release();*/
}

//------------------------------------------------------------------------------------

bool
CWorld::Update(void)
{
   if (CurMode==MODE_MENU)
   {
      int ret=Intro->Update(JoyPad.Get());
      if (ret>0)
      {
         Intro->Release();
         CurMode=MODE_GAME;
         if (!InitFight(BACK_NAME))
            return false;
      }
      else if (ret<0)
      {
      }
   }
   else
   {
//      FighterCPU->Update();
//      FighterJoy->Update(JoyPad.Get());
//      Scroll->Update(FighterJoy->GetPosX(), FighterCPU->GetPosX());
      Scroll->Update(160, 160);
/*      if ((FighterCPU->IsDead() || FighterJoy->IsDead()) && !VictoryBackLoaded)
      {
         Scroll->Release();      
         char name[256];
         sprintf(name,"%s_End",BackgroundName);
         Scroll->LoadBackground(name);
         VictoryBackLoaded=true;
      }
      else if (FighterCPU->IsFightFinished() || FighterJoy->IsFightFinished())
      {
         EndFight();
         CurMode=MODE_MENU;
         JoyPad.SetAutoRepeat(false);
         Intro->Load("Start");
      }*/
   }
   return true;
}

//------------------------------------------------------------------------------------

void
CWorld::Render(void)
{
   if (CurMode==MODE_MENU)
   {
      Intro->Draw();
   }
   else
   {
      Scroll->CopyBuffer();
//      FighterCPU->Render();
//      FighterJoy->Render();
      Scroll->Render();
//      FighterCPU->DrawExtra();
//      FighterJoy->DrawExtra();
   }
}

//------------------------------------------------------------------------------------

void
CWorld::Release(void)
{
   Graph.ReleaseSurfaces();
//   Sound.ReleaseWaves(); **SOUND**
}

//------------------------------------------------------------------------------------

Sat, 2004-12-04 02:56
Joined: 2004-12-02
Forum posts: 9
App run on Emulator not on NGAGE (code inside)
Maybe you lost your resource file in your sis. Or you faild in when your App initializing.

Bluerose
Mon, 2004-12-06 16:19
_NeoStrider_ (not verified)
Forum posts: 2043
App run on Emulator not on NGAGE (code inside)
Strange code, man

doesn´t look like Symbian C++...
coding this way for the device works?
Mon, 2004-12-06 16:28
Joined: 2004-02-06
Forum posts: 13
App run on Emulator not on NGAGE (code inside)
First of all I agree with _NeoStrider_, this doesn't look like Symbian C++ code at all.

Second, when you compile and link this stuff, are you targeting ARM binaries or are you just running the emulator (Windows) binaries on the device? Are you sure you know what your doing? It sounds like you've got a few things mixed up here...

- Luke
Mon, 2004-12-06 16:33
Joined: 2004-11-24
Forum posts: 9
App run on Emulator not on NGAGE (code inside)
We are using Gapidraw, so we Target WIndows, POcketPC,Palm and Symbian. The App now run on Hardware. Thanks! Smiley
  • Login to reply to this topic.