You are not logged in.

#1 2009-04-03 17:00:31

nickles
Member

Exception (DSI) occured. What is it and how to fix it?

Hi. I got a problem that i don´t understand.
The program works fine , until i press the Home-Button to get back to the HBC.
The screen turns black and i get a crash: "Exception (DSI) occured"

How do i fix it and what does it mean?

Here´s my code:

Code:

Mtx GXmodelView2D;

typedef struct ObjektFigur{
    unsigned int x;        
    unsigned int y;      
    unsigned int h;
    unsigned int w;
    unsigned int no;
    unsigned int col_w;
    unsigned int col_h;
    unsigned int col_x_offset;
    unsigned int col_y_offset;
    unsigned int anim;
    unsigned int anim2;
    unsigned int anim3;
    unsigned int anim4;    
    unsigned int framesrate;
    unsigned int framesrate2;
    unsigned int framesrate3;
    unsigned int framesrate4;
    unsigned int direction1p;
    unsigned int ruhe;
    GRRLIB_texImg move_none_down1;
    GRRLIB_texImg move_none_left1;
    GRRLIB_texImg move_none_up1;
    GRRLIB_texImg move_none_right1;
    GRRLIB_texImg stand_allsides1;
} ObjektFigur;

ObjektFigur test[2];

ObjektFigur Einrichten(ObjektFigur link){
    
    link.x=50;
    link.y=50;
    link.h=24;
    link.w=60;
    link.anim=10;
    link.anim2=10;
    link.anim3=10;
    link.anim4=10;    
    link.framesrate=0;
    link.framesrate2=0;
    link.framesrate3=0;
    link.framesrate4=0;
    link.direction1p=0;
    link.ruhe=0;
    
    link.col_w=link.w*0.6;
    link.col_h=link.h*1;
    
    link.col_x_offset=(link.w-link.col_w)/2;
    link.col_y_offset=(link.h-link.col_h)/2;
    
    link.move_none_down1=GRRLIB_LoadTexture(link_move_none_down1);
    link.move_none_left1 = GRRLIB_LoadTexture(link_move_none_left1);
    link.move_none_up1 = GRRLIB_LoadTexture(link_move_none_up1);
    link.move_none_right1 = GRRLIB_LoadTexture(link_move_none_right1);
    link.stand_allsides1 = GRRLIB_LoadTexture(link_stand_allsides);

    link.move_none_down1.tilew=30;
    link.move_none_down1.tileh=12;
    link.move_none_down1.nbtilew=10;
    link.move_none_down1.nbtileh=2;    
    link.move_none_down1.tilestart=0;        

    link.move_none_left1.tilew=30;
    link.move_none_left1.tileh=12;
    link.move_none_left1.nbtilew=10;
    link.move_none_left1.nbtileh=2;    
    link.move_none_left1.tilestart=0;
    
    link.move_none_up1.tilew=30;
    link.move_none_up1.tileh=12;
    link.move_none_up1.nbtilew=10;
    link.move_none_up1.nbtileh=2;    
    link.move_none_up1.tilestart=0;
    
    link.move_none_right1.tilew=30;
    link.move_none_right1.tileh=12;
    link.move_none_right1.nbtilew=10;
    link.move_none_right1.nbtileh=2;    
    link.move_none_right1.tilestart=0;

    link.stand_allsides1.tilew=30;
    link.stand_allsides1.tileh=12;
    link.stand_allsides1.nbtilew=10;
    link.stand_allsides1.nbtileh=2;    
    link.stand_allsides1.tilestart=0;
    
    return link;
}

short int Kollision(ObjektFigur objekt1,ObjektFigur objekt2){
    int left1, left2;
    int right1, right2;
    int top1, top2;
    int bottom1, bottom2;
    
    left1 = objekt1.x + objekt1.col_x_offset;
    left2 = objekt2.x + objekt2.col_x_offset;
    right1 = left1 + objekt1.col_w;
    right2 = left2 + objekt2.col_w;
    top1 = objekt1.y + objekt1.col_y_offset;
    top2 = objekt2.y + objekt1.col_y_offset;
    bottom1 = top1 + objekt1.col_h;
    bottom2 = top2 + objekt2.col_h;


    if (bottom1 < top2) return(0);
    if (top1 > bottom2) return(0);

    if (right1 < left2) return(0);
    if (left1 > right2) return(0);

    return(1);
}

ObjektFigur Steuerung(u32 wpaddown,u32 wpadheld,ObjektFigur player){

    player.col_w=player.w*0.6;
    player.col_h=player.h*1;
    int i=0;
    int kolli=0;
    ObjektFigur tester;
    tester=player;
    player.col_x_offset=(player.w-player.col_w)/2;
    player.col_y_offset=(player.h-player.col_h)/2;
        if (wpadheld & WPAD_BUTTON_HOME) {
        exit(0);
        }

        if (wpadheld & WPAD_BUTTON_DOWN) {
            if (player.framesrate >= 4 && player.anim<19){
                player.framesrate=0;
                player.anim+=1;
            } else if (player.framesrate >= 4 && player.anim >= 19){
                player.framesrate=0;
                player.anim=10;
            }
        
            tester.x+=2;        
            
            for (i=0;i<2;i++){
                if (player.no!=test[i].no){
                    if(Kollision(tester,test[i])){
                    kolli=1;
                    }
                }
            }
            player.framesrate+=1;
            if (kolli==0) player.x+=2;
            player.direction1p=1;
        }
    
        if (wpadheld & WPAD_BUTTON_UP) {
            if (player.framesrate2 >= 4 && player.anim2<19){
                player.framesrate2=0;
                player.anim2+=1;
            } else if (player.framesrate2 >= 4 && player.anim2 >= 19){
                player.framesrate2=0;
                player.anim2=10;    
            }
            
            tester.x-=2;        
            
            for (i=0;i<2;i++){
                if (player.no!=test[i].no){
                    if(Kollision(tester,test[i])){
                    kolli=1;
                    }
                }
            }
            
            player.framesrate2+=1;
            if (kolli==0) player.x-=2;
            player.direction1p=0;
        }
        
        if (wpadheld & WPAD_BUTTON_RIGHT) {
            if (player.framesrate3 >= 4 && player.anim3<19){
                player.framesrate3=0;
                player.anim3+=1;
            } else if (player.framesrate3 >= 4 && player.anim3 >= 19){
                player.framesrate3=0;    
                player.anim3=10;
            }
            
            tester.y-=2;        
            
            for (i=0;i<2;i++){
                if (player.no!=test[i].no){
                    if(Kollision(tester,test[i])){
                    kolli=1;
                    }
                }
            }
            
            player.framesrate3+=1; 
            if (kolli==0) player.y-=2;
            player.direction1p=2;
        }
        
        if (wpadheld & WPAD_BUTTON_LEFT) {
            if (player.framesrate4 >= 4 && player.anim4<19){
                player.anim4+=1;
                player.framesrate4=0;
            
            } else if (player.framesrate4 >= 4 && player.anim4 >= 19){
                player.anim4=10;
                player.framesrate4=0;
                
            }
            
            tester.y+=2;        
            
            for (i=0;i<2;i++){
                if (player.no!=test[i].no){
                    if(Kollision(tester,test[i])){
                    kolli=1;
                    }
                }
            }
            
            player.framesrate4+=1;
            if (kolli==0) player.y+=2;    
            player.direction1p=3;
        }
        

        
        if(!(wpadheld & WPAD_BUTTON_DOWN) && !(wpadheld & WPAD_BUTTON_UP) && !(wpadheld & WPAD_BUTTON_LEFT)  && !(wpadheld & WPAD_BUTTON_RIGHT)){
            player.ruhe=1;
        } else {
            player.ruhe=0;
        }
            
        
    if (player.ruhe==1 && player.direction1p==1) GRRLIB_DrawTile(player.x,player.y,player.stand_allsides1,0,2,2,0xFFFFFFFF,13);
    if (player.ruhe==1 && player.direction1p==0) GRRLIB_DrawTile(player.x,player.y,player.stand_allsides1,0,2,2,0xFFFFFFFF,12);
    if (player.ruhe==1 && player.direction1p==3) GRRLIB_DrawTile(player.x,player.y,player.stand_allsides1,0,2,2,0xFFFFFFFF,10);
    if (player.ruhe==1 && player.direction1p==2) GRRLIB_DrawTile(player.x,player.y,player.stand_allsides1,0,2,2,0xFFFFFFFF,11);
    if (player.ruhe==1 && player.direction1p==1) GRRLIB_DrawTile(player.x,player.y-24,player.stand_allsides1,0,2,2,0xFFFFFFFF,3);
    if (player.ruhe==1 && player.direction1p==0) GRRLIB_DrawTile(player.x,player.y-24,player.stand_allsides1,0,2,2,0xFFFFFFFF,2);
    if (player.ruhe==1 && player.direction1p==3) GRRLIB_DrawTile(player.x,player.y-24,player.stand_allsides1,0,2,2,0xFFFFFFFF,0);
    if (player.ruhe==1 && player.direction1p==2) GRRLIB_DrawTile(player.x,player.y-24,player.stand_allsides1,0,2,2,0xFFFFFFFF,1);

    if (player.ruhe==0 && player.direction1p==0) GRRLIB_DrawTile(player.x,player.y,player.move_none_left1,0,2,2,0xFFFFFFFF,player.anim2);
    if (player.ruhe==0 && player.direction1p==1) GRRLIB_DrawTile(player.x,player.y,player.move_none_right1,0,2,2,0xFFFFFFFF,player.anim);
    if (player.ruhe==0 && player.direction1p==2) GRRLIB_DrawTile(player.x,player.y,player.move_none_up1,0,2,2,0xFFFFFFFF,player.anim3);
    if (player.ruhe==0 && player.direction1p==3) GRRLIB_DrawTile(player.x,player.y,player.move_none_down1,0,2,2,0xFFFFFFFF,player.anim4);
    if (player.ruhe==0 && player.direction1p==0) GRRLIB_DrawTile(player.x,player.y-24,player.move_none_left1,0,2,2,0xFFFFFFFF,player.anim2-10);
    if (player.ruhe==0 && player.direction1p==1) GRRLIB_DrawTile(player.x,player.y-24,player.move_none_right1,0,2,2,0xFFFFFFFF,player.anim-10);
    if (player.ruhe==0 && player.direction1p==2) GRRLIB_DrawTile(player.x,player.y-24,player.move_none_up1,0,2,2,0xFFFFFFFF,player.anim3-10);
    if (player.ruhe==0 && player.direction1p==3) GRRLIB_DrawTile(player.x,player.y-24,player.move_none_down1,0,2,2,0xFFFFFFFF,player.anim4-10);      
    
    return player;
}

int main() {

    float rot=0;
    int i=0;
    
    // Erstellen der Spieler
    ObjektFigur player1;
    player1=Einrichten(player1);
    ObjektFigur player2;
    player2=Einrichten(player2);
    player2.x=200;
    //
    
    //Eintragen der Spieler in die Array
    test[0]=player1;
    test[1]=player2;    
    //
    
    // Laden der Grafiken
    GRRLIB_texImg tex_title = GRRLIB_LoadTexture(title);
    GRRLIB_texImg tex_testroom = GRRLIB_LoadTexture(testroom);
    GRRLIB_texImg tex_link_down_shield_1 = GRRLIB_LoadTexture(link_down_shield_1); //extern (unabhängig vom Objekt)
    
    // Nummerierung der Array-Einträge
        for (i=0;i<sizeof(test);i++){
                 test[i].no=i;    
        }
    //
    
    //Video Init
    VIDEO_Init();
    GRRLIB_Init();
    WPAD_Init();
    //
    
    while(1) {
        // Steuerungsinit
        WPAD_ScanPads();
        u32 wpaddown1 = WPAD_ButtonsDown(0);
        u32 wpadheld1 = WPAD_ButtonsHeld(0);    
        u32 wpaddown2 = WPAD_ButtonsDown(1);
        u32 wpadheld2 = WPAD_ButtonsHeld(1);
        //
        
        // Bildschirm grafisch gestalten
        GRRLIB_FillScreen(0xFFFFFFFF);
        GRRLIB_DrawImg(0,0, tex_title, rot, 1, 1, 0xFFFFFFFF);
        GRRLIB_DrawImg(0,0, tex_testroom, rot, 1, 1, 0xFFFFFFFF);
        //
        
        // Kleine Kollisionstester
        if (Kollision(player1,player2)){ GRRLIB_DrawImg(400,350, tex_link_down_shield_1, rot, 2, 2, 0xFFFFFFFF);}
        //
        
        // Aufrufen der Spieler und Neuverfassung im Array
        player1=Steuerung(wpaddown1,wpadheld1,player1);
        test[0]=player1;
        player2=Steuerung(wpaddown2,wpadheld2,player2);    
        test[1]=player2;
        //
        // Bildausgabe
        GRRLIB_Render();
    }

    GRRLIB_Exit(); 
    free(tex_title.data);
    free(tex_link_down_shield_1.data);
    return 0;
}

Any idea? sad

Offline

 

#2 2009-04-03 19:41:32

Crayon
Bad Mother Fucker

Re: Exception (DSI) occured. What is it and how to fix it?

I don't know if it's related but all those textures are not freed:
    GRRLIB_texImg move_none_down1;
    GRRLIB_texImg move_none_left1;
    GRRLIB_texImg move_none_up1;
    GRRLIB_texImg move_none_right1;
    GRRLIB_texImg stand_allsides1;
And this one too:
GRRLIB_texImg tex_testroom = GRRLIB_LoadTexture(testroom);

Before freeing a texture make sure they are not equal to NULL.

Offline

 

#3 2009-04-03 21:59:38

nickles
Member

Re: Exception (DSI) occured. What is it and how to fix it?

How do i do that? Making sure its not equal NULL?

I changed the last lines to:

Code:

        free(tex_title.data);
    free(tex_link_down_shield_1.data);
    free(tex_testroom.data);
    free(player1.move_none_down1.data);
    free(player1.move_none_up1.data);
    free(player1.move_none_right1.data);
    free(player1.move_none_left1.data);
    free(player2.move_none_down1.data);
    free(player2.move_none_up1.data);
    free(player2.move_none_right1.data);
    free(player2.move_none_left1.data);
    free(player2.stand_allsides1.data);
    free(player1.stand_allsides1.data);
    
    for(i=0;i<sizeof(test);i++){
        free(test[i].move_none_down1.data);
        free(test[i].move_none_up1.data);
        free(test[i].move_none_left1.data);
        free(test[i].move_none_right1.data);
        free(test[i].stand_allsides1.data);
    }

But it still crashes.
I have to add that i´m not a super coder or somethin like that. ^^°

Offline

 

#4 2009-04-03 23:04:59

Crayon
Bad Mother Fucker

Re: Exception (DSI) occured. What is it and how to fix it?

The problem is that this code is never executed:

Code:

    GRRLIB_Exit(); 
    free(tex_title.data);
    free(tex_link_down_shield_1.data);
    return 0;

In the function Steuerung you do an exit:

Code:

        if (wpadheld & WPAD_BUTTON_HOME) {
        exit(0);
        }

If WPAD_BUTTON_HOME is your only way out, you should put all the exit code there. Or make a function that you could call from different places.

Offline

 

#5 2009-04-05 11:18:21

nickles
Member

Re: Exception (DSI) occured. What is it and how to fix it?

i put the function into the main and wrote it like this:

Code:

        if (wpadheld1 & WPAD_BUTTON_HOME) {
            GRRLIB_Exit(); 
            free(tex_title.data);
            free(tex_link_down_shield_1.data);
            free(tex_testroom.data);
            free(player1.move_none_down1.data);
            free(player1.move_none_up1.data);
            free(player1.move_none_right1.data);
            free(player1.move_none_left1.data);
            free(player2.move_none_down1.data);
            free(player2.move_none_up1.data);
            free(player2.move_none_right1.data);
            free(player2.move_none_left1.data);
            free(player2.stand_allsides1.data);
            free(player1.stand_allsides1.data);
    
            free(test[0].move_none_down1.data);
            free(test[0].move_none_up1.data);
            free(test[0].move_none_left1.data);
            free(test[0].move_none_right1.data);
            free(test[0].stand_allsides1.data);
    
            free(test[1].move_none_down1.data);
            free(test[1].move_none_up1.data);
            free(test[1].move_none_left1.data);
            free(test[1].move_none_right1.data);
            free(test[1].stand_allsides1.data);
        

            exit(0);

        }

This is the only way , i found , the exception doesn´t occure.
But the game freezes instead when clicking the home button.

Offline

 

#6 2009-04-08 12:25:14

t4ils
Member

Re: Exception (DSI) occured. What is it and how to fix it?

hey smile

I have the same problem here.
I don't have the DSi error since I free every texture I use in the game after GRRLIB_Exit();  but I sometimes end up with a black screen and I have to reset the wii hmm
any idea what can cause this ?

Offline

 

#7 2009-04-08 19:03:09

Crayon
Bad Mother Fucker

Re: Exception (DSI) occured. What is it and how to fix it?

nickles wrote:

This is the only way , i found , the exception doesn´t occure.
But the game freezes instead when clicking the home button.

You need to call free only if GRRLIB_LoadTexture has been called for a variable, if that's not the case it crash.
Just for fun, try not putting any free! wink

PS: I don't understand why your code compile, maybe now tex_title is a global variable now! Because at first it was in main(), so not accessible from Steuerung.

Offline

 

#8 2009-04-10 13:48:40

nickles
Member

Re: Exception (DSI) occured. What is it and how to fix it?

I rewrote it to make  sure , that only textures are freed that have been called by LoadTexture.
I made somethin like this:

Code:

#include "GRRLIB.h"
#include <asndlib.h>
#include <stdlib.h>
#include <wiiuse/wpad.h>
#include <math.h>
#include <mp3player.h>
#include <fat.h>
#include <gccore.h>
#include <gcmodplay.h>
#include <gctypes.h>
#include <network.h>
#include <ogcsys.h>
#include <samplerate.h>
#include <smb.h>
#include <zconf.h>
#include <zlib.h>
#include <fat.h>
#include "title.h"
#include "link_down_shield_1.h"
#include "link_move_none_down1.h"
#include "link_move_none_up1.h"
#include "link_move_none_left1.h"
#include "link_move_none_right1.h"
#include "link_stand_allsides.h"
#include "space.h"
#include "spacerfull.h"
#include "testroom.h"
Mtx GXmodelView2D;

typedef struct ObjektFigur{
    unsigned int x;        
    unsigned int y;      
    unsigned int h;
    unsigned int w;
    unsigned int no;
    unsigned int col_w;
    unsigned int col_h;
    unsigned int col_x_offset;
    unsigned int col_y_offset;
    unsigned int anim;
    unsigned int anim2;
    unsigned int anim3;
    unsigned int anim4;    
    unsigned int framesrate;
    unsigned int framesrate2;
    unsigned int framesrate3;
    unsigned int framesrate4;
    unsigned int direction1p;
    unsigned int ruhe;
    GRRLIB_texImg move_none_down1;
    GRRLIB_texImg move_none_left1;
    GRRLIB_texImg move_none_up1;
    GRRLIB_texImg move_none_right1;
    GRRLIB_texImg stand_allsides1;
} ObjektFigur;

ObjektFigur test[2];

ObjektFigur Einrichten(ObjektFigur link){
    
    link.x=50;
    link.y=50;
    link.h=24;
    link.w=60;
    link.anim=10;
    link.anim2=10;
    link.anim3=10;
    link.anim4=10;    
    link.framesrate=0;
    link.framesrate2=0;
    link.framesrate3=0;
    link.framesrate4=0;
    link.direction1p=0;
    link.ruhe=0;
    
    link.col_w=link.w*0.6;
    link.col_h=link.h*1;
    
    link.col_x_offset=(link.w-link.col_w)/2;
    link.col_y_offset=(link.h-link.col_h)/2;
    

    return link;
}

short int Kollision(ObjektFigur objekt1,ObjektFigur objekt2){
    int left1, left2;
    int right1, right2;
    int top1, top2;
    int bottom1, bottom2;
    
    left1 = objekt1.x + objekt1.col_x_offset;
    left2 = objekt2.x + objekt2.col_x_offset;
    right1 = left1 + objekt1.col_w;
    right2 = left2 + objekt2.col_w;
    top1 = objekt1.y + objekt1.col_y_offset;
    top2 = objekt2.y + objekt1.col_y_offset;
    bottom1 = top1 + objekt1.col_h;
    bottom2 = top2 + objekt2.col_h;


    if (bottom1 < top2) return(0);
    if (top1 > bottom2) return(0);

    if (right1 < left2) return(0);
    if (left1 > right2) return(0);

    return(1);
}

ObjektFigur Steuerung(u32 wpaddown,u32 wpadheld,ObjektFigur player){

    player.col_w=player.w*0.6;
    player.col_h=player.h*1;
    int i=0;
    int kolli=0;
    ObjektFigur tester;
    tester=player;
    player.col_x_offset=(player.w-player.col_w)/2;
    player.col_y_offset=(player.h-player.col_h)/2;


        if (wpadheld & WPAD_BUTTON_DOWN) {
            if (player.framesrate >= 4 && player.anim<19){
                player.framesrate=0;
                player.anim+=1;
            } else if (player.framesrate >= 4 && player.anim >= 19){
                player.framesrate=0;
                player.anim=10;
            }
        
            tester.x+=2;        
            
            for (i=0;i<2;i++){
                if (player.no!=test[i].no){
                    if(Kollision(tester,test[i])){
                    kolli=1;
                    }
                }
            }
            player.framesrate+=1;
            if (kolli==0) player.x+=2;
            player.direction1p=1;
        }
    
        if (wpadheld & WPAD_BUTTON_UP) {
            if (player.framesrate2 >= 4 && player.anim2<19){
                player.framesrate2=0;
                player.anim2+=1;
            } else if (player.framesrate2 >= 4 && player.anim2 >= 19){
                player.framesrate2=0;
                player.anim2=10;    
            }
            
            tester.x-=2;        
            
            for (i=0;i<2;i++){
                if (player.no!=test[i].no){
                    if(Kollision(tester,test[i])){
                    kolli=1;
                    }
                }
            }
            
            player.framesrate2+=1;
            if (kolli==0) player.x-=2;
            player.direction1p=0;
        }
        
        if (wpadheld & WPAD_BUTTON_RIGHT) {
            if (player.framesrate3 >= 4 && player.anim3<19){
                player.framesrate3=0;
                player.anim3+=1;
            } else if (player.framesrate3 >= 4 && player.anim3 >= 19){
                player.framesrate3=0;    
                player.anim3=10;
            }
            
            tester.y-=2;        
            
            for (i=0;i<2;i++){
                if (player.no!=test[i].no){
                    if(Kollision(tester,test[i])){
                    kolli=1;
                    }
                }
            }
            
            player.framesrate3+=1; 
            if (kolli==0) player.y-=2;
            player.direction1p=2;
        }
        
        if (wpadheld & WPAD_BUTTON_LEFT) {
            if (player.framesrate4 >= 4 && player.anim4<19){
                player.anim4+=1;
                player.framesrate4=0;
            
            } else if (player.framesrate4 >= 4 && player.anim4 >= 19){
                player.anim4=10;
                player.framesrate4=0;
                
            }
            
            tester.y+=2;        
            
            for (i=0;i<2;i++){
                if (player.no!=test[i].no){
                    if(Kollision(tester,test[i])){
                    kolli=1;
                    }
                }
            }
            
            player.framesrate4+=1;
            if (kolli==0) player.y+=2;    
            player.direction1p=3;
        }
        

        
        if(!(wpadheld & WPAD_BUTTON_DOWN) && !(wpadheld & WPAD_BUTTON_UP) && !(wpadheld & WPAD_BUTTON_LEFT)  && !(wpadheld & WPAD_BUTTON_RIGHT)){
            player.ruhe=1;
        } else {
            player.ruhe=0;
        }
            
        
    if (player.ruhe==1 && player.direction1p==1) GRRLIB_DrawTile(player.x,player.y,player.stand_allsides1,0,2,2,0xFFFFFFFF,13);
    if (player.ruhe==1 && player.direction1p==0) GRRLIB_DrawTile(player.x,player.y,player.stand_allsides1,0,2,2,0xFFFFFFFF,12);
    if (player.ruhe==1 && player.direction1p==3) GRRLIB_DrawTile(player.x,player.y,player.stand_allsides1,0,2,2,0xFFFFFFFF,10);
    if (player.ruhe==1 && player.direction1p==2) GRRLIB_DrawTile(player.x,player.y,player.stand_allsides1,0,2,2,0xFFFFFFFF,11);
    if (player.ruhe==1 && player.direction1p==1) GRRLIB_DrawTile(player.x,player.y-24,player.stand_allsides1,0,2,2,0xFFFFFFFF,3);
    if (player.ruhe==1 && player.direction1p==0) GRRLIB_DrawTile(player.x,player.y-24,player.stand_allsides1,0,2,2,0xFFFFFFFF,2);
    if (player.ruhe==1 && player.direction1p==3) GRRLIB_DrawTile(player.x,player.y-24,player.stand_allsides1,0,2,2,0xFFFFFFFF,0);
    if (player.ruhe==1 && player.direction1p==2) GRRLIB_DrawTile(player.x,player.y-24,player.stand_allsides1,0,2,2,0xFFFFFFFF,1);

    if (player.ruhe==0 && player.direction1p==0) GRRLIB_DrawTile(player.x,player.y,player.move_none_left1,0,2,2,0xFFFFFFFF,player.anim2);
    if (player.ruhe==0 && player.direction1p==1) GRRLIB_DrawTile(player.x,player.y,player.move_none_right1,0,2,2,0xFFFFFFFF,player.anim);
    if (player.ruhe==0 && player.direction1p==2) GRRLIB_DrawTile(player.x,player.y,player.move_none_up1,0,2,2,0xFFFFFFFF,player.anim3);
    if (player.ruhe==0 && player.direction1p==3) GRRLIB_DrawTile(player.x,player.y,player.move_none_down1,0,2,2,0xFFFFFFFF,player.anim4);
    if (player.ruhe==0 && player.direction1p==0) GRRLIB_DrawTile(player.x,player.y-24,player.move_none_left1,0,2,2,0xFFFFFFFF,player.anim2-10);
    if (player.ruhe==0 && player.direction1p==1) GRRLIB_DrawTile(player.x,player.y-24,player.move_none_right1,0,2,2,0xFFFFFFFF,player.anim-10);
    if (player.ruhe==0 && player.direction1p==2) GRRLIB_DrawTile(player.x,player.y-24,player.move_none_up1,0,2,2,0xFFFFFFFF,player.anim3-10);
    if (player.ruhe==0 && player.direction1p==3) GRRLIB_DrawTile(player.x,player.y-24,player.move_none_down1,0,2,2,0xFFFFFFFF,player.anim4-10);      
    
    return player;
}

int main() {

    float rot=0;
    int i=0;
    
    GRRLIB_texImg tex_move_none_down1 = GRRLIB_LoadTexture(link_move_none_down1);
    GRRLIB_texImg tex_move_none_left1 = GRRLIB_LoadTexture(link_move_none_left1);
    GRRLIB_texImg tex_move_none_up1 = GRRLIB_LoadTexture(link_move_none_up1);
    GRRLIB_texImg tex_move_none_right1 = GRRLIB_LoadTexture(link_move_none_right1);
    GRRLIB_texImg tex_stand_allsides1 = GRRLIB_LoadTexture(link_stand_allsides);

    
    // Erstellen der Spieler
    ObjektFigur player1;
    player1=Einrichten(player1);
    player1.move_none_down1=tex_move_none_down1;
    player1.move_none_left1=tex_move_none_left1;
    player1.move_none_up1=tex_move_none_up1;
    player1.move_none_right1=tex_move_none_right1;
    player1.stand_allsides1=tex_stand_allsides1;    
    player1.move_none_down1.tilew=30;
    player1.move_none_down1.tileh=12;
    player1.move_none_down1.nbtilew=10;
    player1.move_none_down1.nbtileh=2;    
    player1.move_none_down1.tilestart=0;        
    player1.move_none_left1.tilew=30;
    player1.move_none_left1.tileh=12;
    player1.move_none_left1.nbtilew=10;
    player1.move_none_left1.nbtileh=2;    
    player1.move_none_left1.tilestart=0;
    player1.move_none_up1.tilew=30;
    player1.move_none_up1.tileh=12;
    player1.move_none_up1.nbtilew=10;
    player1.move_none_up1.nbtileh=2;    
    player1.move_none_up1.tilestart=0;
    player1.move_none_right1.tilew=30;
    player1.move_none_right1.tileh=12;
    player1.move_none_right1.nbtilew=10;
    player1.move_none_right1.nbtileh=2;    
    player1.move_none_right1.tilestart=0;
    player1.stand_allsides1.tilew=30;
    player1.stand_allsides1.tileh=12;
    player1.stand_allsides1.nbtilew=10;
    player1.stand_allsides1.nbtileh=2;    
    player1.stand_allsides1.tilestart=0;
    
    ObjektFigur player2;
    player2=Einrichten(player2);
    player2.move_none_down1=tex_move_none_down1;
    player2.move_none_left1=tex_move_none_left1;
    player2.move_none_up1=tex_move_none_up1;
    player2.move_none_right1=tex_move_none_right1;
    player2.stand_allsides1=tex_stand_allsides1;    
    player2.move_none_down1.tilew=30;
    player2.move_none_down1.tileh=12;
    player2.move_none_down1.nbtilew=10;
    player2.move_none_down1.nbtileh=2;    
    player2.move_none_down1.tilestart=0;        
    player2.move_none_left1.tilew=30;
    player2.move_none_left1.tileh=12;
    player2.move_none_left1.nbtilew=10;
    player2.move_none_left1.nbtileh=2;    
    player2.move_none_left1.tilestart=0;
    player2.move_none_up1.tilew=30;
    player2.move_none_up1.tileh=12;
    player2.move_none_up1.nbtilew=10;
    player2.move_none_up1.nbtileh=2;    
    player2.move_none_up1.tilestart=0;
    player2.move_none_right1.tilew=30;
    player2.move_none_right1.tileh=12;
    player2.move_none_right1.nbtilew=10;
    player2.move_none_right1.nbtileh=2;    
    player2.move_none_right1.tilestart=0;
    player2.stand_allsides1.tilew=30;
    player2.stand_allsides1.tileh=12;
    player2.stand_allsides1.nbtilew=10;
    player2.stand_allsides1.nbtileh=2;    
    player2.stand_allsides1.tilestart=0;
    player2.x=200;
    //
    
    //Eintragen der Spieler in die Array
    test[0]=player1;
    test[1]=player2;    
    //
    
    // Laden der Grafiken
    GRRLIB_texImg tex_title = GRRLIB_LoadTexture(title);
    GRRLIB_texImg tex_testroom = GRRLIB_LoadTexture(testroom);
    GRRLIB_texImg tex_link_down_shield_1 = GRRLIB_LoadTexture(link_down_shield_1); //extern (unabhängig vom Objekt)
    
    // Nummerierung der Array-Einträge
        for (i=0;i<sizeof(test);i++){
                 test[i].no=i;    
        }
    //
    
    //Video Init
    VIDEO_Init();
    GRRLIB_Init();
    WPAD_Init();
    //
    
    while(1) {
        // Steuerungsinit
        WPAD_ScanPads();
        u32 wpaddown1 = WPAD_ButtonsDown(0);
        u32 wpadheld1 = WPAD_ButtonsHeld(0);    
        u32 wpaddown2 = WPAD_ButtonsDown(1);
        u32 wpadheld2 = WPAD_ButtonsHeld(1);
        //
        
        // Bildschirm grafisch gestalten
        GRRLIB_FillScreen(0xFFFFFFFF);
        GRRLIB_DrawImg(0,0, tex_title, rot, 1, 1, 0xFFFFFFFF);
        GRRLIB_DrawImg(0,0, tex_testroom, rot, 1, 1, 0xFFFFFFFF);
        //
        
        // Kleine Kollisionstester
        if (Kollision(player1,player2)){ GRRLIB_DrawImg(400,350, tex_link_down_shield_1, rot, 2, 2, 0xFFFFFFFF);}
        //
        
        // Aufrufen der Spieler und Neuverfassung im Array
        player1=Steuerung(wpaddown1,wpadheld1,player1);
        test[0]=player1;
        player2=Steuerung(wpaddown2,wpadheld2,player2);    
        test[1]=player2;
        
        if (wpadheld1 & WPAD_BUTTON_HOME) {
            exit(0);
        }
        
        // Bildausgabe
        GRRLIB_Render();
    }
    GRRLIB_Exit(); 
    free(tex_title.data);
    free(tex_link_down_shield_1.data);
    free(tex_testroom.data);
    free(tex_move_none_down1.data);
    free(tex_move_none_up1.data);
    free(tex_move_none_right1.data);
    free(tex_move_none_left1.data);
    free(tex_stand_allsides1.data);
    return 0;
}

But i still get the same error >.>

Offline

 

#9 2009-04-10 17:18:35

RazorChrist
Member

Re: Exception (DSI) occured. What is it and how to fix it?

Instead of this:

Code:

    GRRLIB_Exit(); 
    free(tex_title.data);
    free(tex_link_down_shield_1.data);
    free(tex_testroom.data);
    free(tex_move_none_down1.data);
    free(tex_move_none_up1.data);
    free(tex_move_none_right1.data);
    free(tex_move_none_left1.data);
    free(tex_stand_allsides1.data);
    return 0;
}

Try this:

Code:

GRRLIB_Stop();
    exit(0);
    return 0;
}

If it doesn't work, check your GRRLIB.c and .h for the following functions:
GRRLIB.c

Code:

void GRRLIB_Stop() {

    GX_AbortFrame();
    GX_Flush();

    free(MEM_K1_TO_K0(xfb[0])); xfb[0] = NULL;
    free(MEM_K1_TO_K0(xfb[1])); xfb[1] = NULL;
    free(gp_fifo); gp_fifo = NULL;
}

GRRLIB.h

Code:

void GRRLIB_Stop();

Last edited by RazorChrist (2009-04-10 17:20:42)


PSP = Phat 5.00 m33-6 w/ 1.50 Kernel Addon
WII = Softmodded v3.3u w/ Homebrew Channel + IOS249
Wii Dev Projects: TronCycles

Offline

 

#10 2009-04-10 21:31:01

nickles
Member

Re: Exception (DSI) occured. What is it and how to fix it?

Doesn´t work either.
GRRLIB_stop hasn´t been in the files , so i copied it in.
But it seems like GRRLIB_Stop and GRRLIB_Exit are pretty much the same?

Guess i have to rewrite the programm hmm

Offline

 

#11 2009-04-10 21:51:02

RazorChrist
Member

Re: Exception (DSI) occured. What is it and how to fix it?

Weird. I don't use GRRLIB_Exit(), don't think it's even in my GRRLIB files, then again, I modified mine from the original. As for GRRLIB_Stop(), that's what I use in my game, and it works fine for me, so I'm not sure why it's not working for you.


PSP = Phat 5.00 m33-6 w/ 1.50 Kernel Addon
WII = Softmodded v3.3u w/ Homebrew Channel + IOS249
Wii Dev Projects: TronCycles

Offline

 

Board footer

Powered by FluxBB