xboxscene.org forums

Author Topic: Reading A File Error Using Xdk  (Read 104 times)

ziIIi0n

  • Archived User
  • Newbie
  • *
  • Posts: 8
Reading A File Error Using Xdk
« on: October 10, 2006, 06:07:00 PM »

Having trouble reading a file on this OpenMUGEN port I am compiling... could someone give me some pointers or suggestions ?

Here is the log file the Game actually produces...

CODE

Welcome to OpenMugen Version Alpha 2
CGame:Init SDL system
Init Memory Manager
CSDLManager:: Init()
CSDLManager:: SDL_Init OK
CVideoSystem::InitSystem()
CVideoSystem:: DebugFonts not found
font.txt not found


Call Stack
CODE

>    OpenMUGEN X.exe!CVideoSystem::LoadFont()  Line 97 + 0x3    C++
     OpenMUGEN X.exe!CVideoSystem::InitSystem()  Line 77    C++
     OpenMUGEN X.exe!CSDLManager::Init()  Line 54 + 0x8    C++
     OpenMUGEN X.exe!CGame::InitGame()  Line 53 + 0x8    C++
     OpenMUGEN X.exe!main(int argc=0, char * * argv=0x00000000)  Line 19    C++
     OpenMUGEN X.exe!mainXapiStartup(void * lpvParameter=0x00000000)  Line 54 + 0x8    C
     OpenMUGEN X.exe!XapiThreadStartup(void (void *)* StartRoutine=0x000b909a, void * StartContext=0x00000000)  Line 206 + 0x6    C
     xboxkrnl.exe!80027198()     


Thread
CODE

>    28    main    CVideoSystem::LoadFont     8    0


Output
CODE

'OpenMUGEN X.xbe': Loaded 'OpenMUGEN X.exe', Symbols loaded.
'OpenMUGEN X.xbe': Loaded 'xboxkrnl.exe', No symbols loaded.
'OpenMUGEN X.xbe': Loaded 'xbdm.dll', No symbols loaded.
'OpenMUGEN X.xbe': Loaded 'vx.dxt', No symbols loaded.
WRN[XAPI]: The D: drive is not assigned to the CD/DVD device - error 0xc0000035
Crystal=16.6  FSB=133  CPU=733  NVCLK=233  VCO=800  MCLK=200
MM: page fault touching 0000000C, trap frame D0032424, eip 000CBA81
First-chance exception at 0x000cba81 (OpenMUGEN X.exe) in OpenMUGEN X.xbe: 0xC0000005: Access violation reading location 0x0000000c.
Unhandled XAPI Exception. Exception Pointers = 0xD00320B8
Code c0000005 Addr 000CBA81
Info0 00000000 Info1 0000000C Info2 0000000C Info3 0000000C
Unhandled exception at 0x000cba81 (OpenMUGEN X.exe) in OpenMUGEN X.xbe: 0xC0000005: Access violation reading location 0x0000000c.


This post has been edited by ziIIi0n: Oct 11 2006, 01:15 AM
Logged

nes6502

  • Archived User
  • Hero Member
  • *
  • Posts: 1158
Reading A File Error Using Xdk
« Reply #1 on: October 10, 2006, 06:10:00 PM »

QUOTE

CVideoSystem:: DebugFonts not found
font.txt not found


Maybe this is the cause of the crash.
Logged

ziIIi0n

  • Archived User
  • Newbie
  • *
  • Posts: 8
Reading A File Error Using Xdk
« Reply #2 on: October 10, 2006, 06:13:00 PM »

It is, oddly enough the structure of the folder contains all the files in it.

Where the crash occurs is in this line of the code.

CODE

void CVideoSystem::LoadFont()
{
    FILE *pFile;
    char strTemp[255];
    int i=0;
    
    //Loading debug fonts
    font=SDL_LoadBMP("D:\DebugFonts.bmp");
    
    if(font==NULL)
       PrintMessage("CVideoSystem:: DebugFonts not found");
      
    pFile=fopen("D:\font.txt","r");
    
    if(pFile==NULL)
        PrintMessage("font.txt not found");
    
    while(!feof(pFile)) // ERROR
    {
        fgets(strTemp,255,pFile);
        sscanf(strTemp,"%c %i %i",&my_Fonts.c,&my_Fonts.x,&my_Fonts.nWidth);
        i++;    
    }
    
    SDL_SetColorKey(font,SDL_SRCCOLORKEY,SDL_MapRGB(screen->format,0,0,0));

}


This post has been edited by ziIIi0n: Oct 11 2006, 01:14 AM
Logged

nes6502

  • Archived User
  • Hero Member
  • *
  • Posts: 1158
Reading A File Error Using Xdk
« Reply #3 on: October 10, 2006, 07:03:00 PM »

QUOTE(ziIIi0n @ Oct 11 2006, 12:44 AM) *

It is, oddly enough the structure of the folder contains all the files in it.

Where the crash occurs is in this line of the code.

CODE

void CVideoSystem::LoadFont()
{
    FILE *pFile;
    char strTemp[255];
    int i=0;
    
    //Loading debug fonts
    font=SDL_LoadBMP("D:\DebugFonts.bmp");
    
    if(font==NULL)
       PrintMessage("CVideoSystem:: DebugFonts not found");
      
    pFile=fopen("D:\font.txt","r");
    
    if(pFile==NULL)
        PrintMessage("font.txt not found");
    
    while(!feof(pFile)) // ERROR
    {
        fgets(strTemp,255,pFile);
        sscanf(strTemp,"%c %i %i",&my_Fonts.c,&my_Fonts.x,&my_Fonts.nWidth);
        i++;    
    }
    
    SDL_SetColorKey(font,SDL_SRCCOLORKEY,SDL_MapRGB(screen->format,0,0,0));

}



Try replacing the load line with:

 font=SDL_LoadBMP("D:\\DebugFonts.bmp");

and the "DebugFonts.bmp" must be where the default.xbe is.
Logged

nes6502

  • Archived User
  • Hero Member
  • *
  • Posts: 1158
Reading A File Error Using Xdk
« Reply #4 on: October 10, 2006, 07:46:00 PM »

QUOTE(nes6502 @ Oct 11 2006, 01:34 AM) *

Try replacing the load line with:

 font=SDL_LoadBMP("D:\\DebugFonts.bmp");

and the "DebugFonts.bmp" must be where the default.xbe is.



Oh, and replace the font line as well with:

pFile=fopen("D:\\font.txt","r");

You have to have the double "\" after the D: otherwise it will use it as an esacpe symbol with the next letter.

That's why the files are not loading.
Logged

ziIIi0n

  • Archived User
  • Newbie
  • *
  • Posts: 8
Reading A File Error Using Xdk
« Reply #5 on: October 11, 2006, 03:26:00 AM »

Thanks ! It worked.
Logged