×

Discussion Board

Results 1 to 1 of 1
  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Location
    IL/USA
    Posts
    341

    Would Be Nice if someone answered this question

    Hello,
    I've worked very hard on debugging my program and I seemed to isolated the bug. (Running on Emulator) Here is it:

    RResourceFile resourceFile;
    _LIT(KLevelResourceFilename,"C:\\system\\data\\levels.rsc");
    RFs fsSession;
    User::LeaveIfError (fsSession.Connect());

    resourceFile.OpenL (fsSession,
    KLevelResourceFilename);
    dataBuffer = resourceFile.AllocReadLC (LEVEL1);

    Firstly, I verified that "C:\\system\\data\\levels.rsc" was located at E:\Symbian\6.1\Series60\Epoc32\Wins\c\system\data and it was (I installed Symbian on E: drive).

    As pointed out above after I run the function 'resourceFile.AllocLC(LEVEL1)' generates "System: system error!" that is displayed on the Emulator screen.

    I checked the File Levels.rsg to see if LEVEL1 was defined and it was defined as "#define LEVEL1 0x3daa1002".

    Next I tried getting a Detail message by add the following code after the resourceAllocLC(LEVEL1) function call:

    CErrorUI* iErrorUI=CErrorUI::NewL();
    TRAPD(err, User::Leave(KErrCancel));
    iErrorUI->ShowGlobalErrorNoteL(KErrCancel)

    I get the following result:
    "System Error!"

    I have exhausted all of my options.What am I doing wrong?
    I listed the contents of Levels.hrh, levels.rh and Levels.rss.

    ============ LEVELS.HRH ==================
    /*!
    @constants
    @discussion define the constants for iFlags
    */

    // build flags
    #define EBugFlg 0x01
    #define EWeaponFlg 0x02
    #define EBugOnEdgeFlg 0x08

    // tokens
    enum
    {
    ELASTX1,
    ELASTX2,
    ELASTY1,
    ELASTX1_PLUS_LASTWIDTH_DIV_2,
    ELASTX1_PLUS_WIDTH,
    ELASTX1_PLUS_WIDTH_X_2,
    ELASTX2_PLUS_WIDTH_DIV_2,
    ELASTX2_PLUS_WIDTH_DIV_4,
    EHEIGHT_X_4,
    ELASTWIDTH_X_2,
    ELASTX2_MIN_WIDTH,
    ELASTY1_MIN_HEIGHT,
    ELASTY2_MIN_HEIGHT,
    ESCR_YMAX_DIV_HEIGHT
    };
    ======== LEVELS.RH =======================
    #include "levels.hrh"

    STRUCT SPRITE BYTE
    {
    BYTE typeIdx = 0;
    WORD x = 0;
    WORD y = 0;
    LONG flags = 0;
    BYTE buildflags = 0;
    }
    STRUCT BUGSPRITE BYTE
    {
    BYTE typeIdx = 0;
    }
    STRUCT WEAPON
    {
    BYTE typeIdx = 0;
    WORD x = 0;
    WORD y = 0;
    BYTE width = 0;
    BYTE height = 0;
    }
    STRUCT LEVELDATA BYTE
    {
    LEN BYTE STRUCT weapons[];
    LEN BYTE STRUCT edges[];
    LEN BYTE STRUCT killer_sprites[];
    LEN BYTE STRUCT static_sprites[];
    }
    ================== Levels.rss ================
    /* Copyright (c) 2003, Erica A Ramsey. All rights reserved */

    NAME LVLS

    #include <eikon.rh>
    #include <eikon.rsg>
    #include <avkon.rh>
    #include <avkon.rsg>

    #include "bb.hrh"
    #include "levels.hrh"
    #include "levels.rh"


    // ---------------------------------------------------------
    //
    // Define the resource file signature
    // This resource should be empty.
    //
    // ---------------------------------------------------------

    RESOURCE RSS_SIGNATURE {}

    RESOURCE LEVELDATA LEVEL1
    {
    weapons =
    {
    // positions of weapons are determined by static sprites
    WEAPON
    {
    typeIdx = EHammerIdx;
    },
    WEAPON
    {
    typeIdx = EGasgunIdx;
    }
    };
    killer_sprites =
    {
    // positions of bugs are determined by static sprites
    BUGSPRITE
    {
    typeIdx = EBugTypeAIdx;
    },
    BUGSPRITE
    {
    typeIdx = EBugTypeBIdx;
    },
    BUGSPRITE
    {
    typeIdx = EBugTypeAIdx;
    },
    BUGSPRITE
    {
    typeIdx = EBugTypeCIdx;
    },
    BUGSPRITE
    {
    typeIdx = EBugTypeDIdx;
    }
    };
    static_sprites =
    {
    // Grass1
    SPRITE
    {
    typeIdx = EGrassIdx;
    x = 0;
    y = ESCR_YMAX_DIV_HEIGHT;
    flags = EStepFlg;
    },
    // Bush1 -- does NOT change ELast2
    SPRITE
    {
    typeIdx = EBushIdx;
    x = ELASTX2_PLUS_WIDTH_DIV_2;
    y = ELASTY1_MIN_HEIGHT;
    flags = EStepFlg;
    },
    // Grass2
    SPRITE
    {
    typeIdx = EGrassIdx;
    x = ELASTX2;
    y = ELASTY1;
    flags = EStepFlg;
    },
    // Tree1 TYPE1 -- does not change ELASTX2
    SPRITE
    {
    typeIdx = ETree1Idx;
    x = ELASTX2_MIN_WIDTH;
    y = ELASTY1_MIN_HEIGHT;
    },
    // Grass3
    SPRITE
    {
    typeIdx = EGrassIdx;
    x = ELASTX2;
    y = ELASTY1;
    flags = EStepFlg;
    buildflags = EBugFlg;
    },
    // Grass4
    SPRITE
    {
    typeIdx = EGrassIdx;
    x = ELASTX2;
    y = ELASTY1;
    flags = EStepFlg;
    },
    // Bush2
    SPRITE
    {
    typeIdx = EBushIdx;
    x = ELASTX2_PLUS_WIDTH_DIV_4;
    y = ELASTY1_MIN_HEIGHT;
    },
    // Grass5
    SPRITE
    {
    typeIdx = EGrassIdx;
    x = ELASTX2;
    y = ELASTY1;
    flags = EStepFlg;
    },
    // Platform1
    SPRITE
    {
    typeIdx = EPlatformIdx;
    x = ELASTX1_PLUS_LASTWIDTH_DIV_2;
    y = EHEIGHT_X_4;
    flags = EStepFlg + ELeftEdgeFlg + ERightEdgeFlg;
    },
    // Platform2
    SPRITE
    {
    typeIdx = EPlatformIdx;
    x = ELASTWIDTH_X_2;
    y = EHEIGHT_X_4;
    flags = EStepFlg + ELeftEdgeFlg + ERightEdgeFlg;
    buildflags = EBugFlg + EWeaponFlg + EBugOnEdgeFlg;
    },
    // WaterFall
    SPRITE
    {
    typeIdx = EWaterfallIdx;
    x = ELASTX2;
    y = ELASTY1;
    flags = EKillerFlg;
    },
    // Grass6
    SPRITE
    {
    typeIdx = EGrassIdx;
    x = ELASTX2;
    y = ELASTY1;
    flags = EStepFlg;
    buildflags = EBugFlg;
    },
    // Bush3
    SPRITE
    {
    typeIdx = EBushIdx;
    x = ELASTX1;
    y = ELASTY1_MIN_HEIGHT;
    },
    // Grass8
    SPRITE
    {
    typeIdx = EGrassIdx;
    x = ELASTX2;
    y = ELASTY1;
    flags = EStepFlg;
    },
    // Tree2 TYPE2
    SPRITE
    {
    typeIdx = ETree2Idx;
    x = ELASTX2;
    y = ELASTY1_MIN_HEIGHT;
    },
    // Grass9
    SPRITE
    {
    typeIdx = EGrassIdx;
    x = ELASTX2;
    y = ELASTY1;
    flags = EStepFlg;
    },
    // Wall1
    SPRITE
    {
    typeIdx = EWallIdx;
    x = ELASTX1;
    y = ELASTY1_MIN_HEIGHT;
    flags = EStepFlg + EObstacleFlg;
    },
    // Grass10
    SPRITE
    {
    typeIdx = EGrassIdx;
    x = ELASTX2;
    y = ELASTY1;
    flags = EStepFlg;
    buildflags = EBugFlg;
    },
    // Grass11
    SPRITE
    {
    typeIdx = EGrassIdx;
    x = ELASTX2;
    y = ELASTY1;
    flags = EStepFlg;
    },
    // Wall2
    SPRITE
    {
    typeIdx = EWallIdx;
    x = ELASTX2_MIN_WIDTH;
    y = ELASTY1_MIN_HEIGHT;
    flags = EStepFlg + EObstacleFlg + ELeftEdgeFlg + ERightEdgeFlg;
    },
    // Fire1
    SPRITE
    {
    typeIdx = EFireIdx;
    x = ELASTX2;
    y = ELASTY1_MIN_HEIGHT;
    },
    // Grass12
    SPRITE
    {
    typeIdx = EGrassIdx;
    x = ELASTX2;
    y = ELASTY2_MIN_HEIGHT;
    flags = EStepFlg;
    },
    // Stair1 TYPE1
    SPRITE
    {
    typeIdx = EStair1Idx;
    x = ELASTX1;
    y = ELASTY1_MIN_HEIGHT;
    flags = EStepFlg + EObstacleFlg + ERightEdgeFlg;
    },
    // Stair2 TYPE2
    SPRITE
    {
    typeIdx = EStair2Idx;
    x = ELASTX1_PLUS_WIDTH;
    y = ELASTY1_MIN_HEIGHT;
    flags = EStepFlg + EObstacleFlg + ERightEdgeFlg;
    },
    // Stair3 TYPE3
    SPRITE
    {
    typeIdx = EStair3Idx;
    x = ELASTX1_PLUS_WIDTH_X_2;
    y = ELASTY1_MIN_HEIGHT;
    flags = EStepFlg + EObstacleFlg + ERightEdgeFlg;
    },
    // Grass13
    SPRITE
    {
    typeIdx = EGrassIdx;
    x = ELASTX2;
    y = ELASTY1;
    flags = EStepFlg;
    },
    // Grass14
    SPRITE
    {
    typeIdx = EGrassIdx;
    x = ELASTX2;
    y = ELASTY1;
    flags = EStepFlg;
    },
    // Grass15
    SPRITE
    {
    typeIdx = EGrassIdx;
    x = ELASTX2;
    y = ELASTY1;
    flags = EStepFlg;
    buildflags = EBugFlg;
    },
    // FLAG 1
    SPRITE
    {
    typeIdx = EFlagIdx;
    x = ELASTX2;
    y = ELASTY1_MIN_HEIGHT;
    flags = EFlagFlg;
    }
    };
    }
    ==============================================

    Thank you!
    EARamsey
    Last edited by earamsey; 2003-06-03 at 19:24.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×