Les membres ayant 30 points peuvent parler sur les canaux annonces, projets et hs du chat.
La shoutbox n'est pas chargée par défaut pour des raisons de performances. Cliquez pour charger.

Forum Casio - Autres questions


Index du Forum » Autres questions » Problèmes SDK divers et variés
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Problèmes SDK divers et variés

Posté le 26/10/2013 11:00

Salut j'ai fait un petit programme mais je comprends pas pourquoi la fonction Print ne veut pas afficher la chaine que je lui demande ...

Le code
Cliquer pour enrouler
#include "fxlib.h"
#include "stdio.h"

unsigned int key;
int caractere, caractere2;
char chaine[21];
char ident[21];
char domaine[30];
char mdp[30];
char destinataire[40];
char sujet[30];
char corps[50];


int AddIn_main(int isAppli, unsigned short OptionNum){
    Bdisp_AllClr_DDVRAM();
    demmarage();
    identif();
    
    return 1;
}

demmarage(){
    int key;
    Bdisp_AllClr_DDVRAM();
    PrintMini(80,58,"Version 1.0",0);
    Bdisp_DrawLineVRAM(10,10,10,50);
    Bdisp_DrawLineVRAM(10,50,117,50);
    Bdisp_DrawLineVRAM(117,50,117,10);
    Bdisp_DrawLineVRAM(10,10,117,10);
    Bdisp_DrawLineVRAM(10,10,63,25);
    Bdisp_DrawLineVRAM(117,10,63,25);
    locate(7,5);
    Print("Messagerie");
    do{
        GetKey(&key);
    } while(key != 30004);
    
    Bdisp_AllClr_DDVRAM();
}

identif(){
    Bdisp_AllClr_DDVRAM();
    locate(1,1);
    Print("Identifiant:");
    locate(1,2);
    Print("+------------------+");
    locate(1,3);
    Print("|                  |");
    locate(1,4);
    Print("+------------------+");
    remplichaine();
    
    caractere2=0;
    do{
        caractere2++;
        ident[caractere2] = chaine[caractere2];
    } while(caractere2+1 != caractere);
    ========================== > ICI < ========
    locate(2,3);
    Print(ident);
    do{
        GetKey(&key);
    } while(key != 30004);
    
}

remplichaine(){
    caractere=0;
    do{
        caractere++;
    ======================= > ET ICI < ========
        locate(2,3);
        Print(chaine);
        GetKey(&key);
        //==========Conversion==========
        if (key==48)key= 71;
        if (key==46)key= 61;
        if (key==15)key= 51;
        if (key==135)key= 41;
        if (key==30004)key= 31;
        if (key==49)key= 72;
        if (key==50)key= 62;
        if (key==51)key= 52;
        if (key==137)key= 42;
        if (key==153)key= 32;
        if (key==52)key= 73;
        if (key==53)key= 63;
        if (key==54)key= 53;
        if (key==169)key= 43;
        if (key==185)key= 33;
        if (key==55)key= 74;
        if (key==56)key= 64;
        if (key==57)key= 54;
        if (key==30025)key= 44;
        if (key==30015)key= 34;
        if (key==187)key= 75;
        if (key==30046)key= 65;
        if (key==40)key= 55;
        if (key==41)key= 45;
        if (key==44)key= 35;
        if (key==14)key= 25;
        if (key==30001)key= 76;
        if (key==149)key= 66;
        if (key==133)key= 56;
        if (key==129)key= 46;
        if (key==130)key= 36;
        if (key==131)key= 26;
        if (key==30007)key= 77;
        if (key==205)key= 67;
        if (key==168)key= 57;
        if (key==30002)key= 47;
        if (key==30023)key= 37;
        if (key==30021)key= 27;
        if (key==30006)key= 78;
        if (key==30008)key= 68;
        if (key==30016)key= 58;
        if (key==30020)key= 38;
        if (key==30018)key= 28;
        if (key==30009)key= 79;
        if (key==30010)key= 69;
        if (key==30011)key= 59;
        if (key==30012)key= 49;
        if (key==30013)key= 39;
        if (key==30014)key= 29;
        //==============================
        if(key==31)caractere=19;
        if(key==76)chaine[caractere]='a';
        if(key==66)chaine[caractere]='b';
        if(key==56)chaine[caractere]='c';
        if(key==46)chaine[caractere]='d';
        if(key==36)chaine[caractere]='e';
        if(key==26)chaine[caractere]='f';
        if(key==75)chaine[caractere]='g';
        if(key==65)chaine[caractere]='h';
        if(key==55)chaine[caractere]='i';
        if(key==45)chaine[caractere]='j';
        if(key==35)chaine[caractere]='k';
        if(key==25)chaine[caractere]='l';
        if(key==74)chaine[caractere]='m';
        if(key==64)chaine[caractere]='n';
        if(key==54)chaine[caractere]='o';
        if(key==73)chaine[caractere]='p';
        if(key==63)chaine[caractere]='q';
        if(key==53)chaine[caractere]='r';
        if(key==43)chaine[caractere]='s';
        if(key==33)chaine[caractere]='t';
        if(key==72)chaine[caractere]='u';
        if(key==62)chaine[caractere]='v';
        if(key==52)chaine[caractere]='w';
        if(key==42)chaine[caractere]='x';
        if(key==32)chaine[caractere]='y';
        if(key==71)chaine[caractere]='z';
        if(key==61)chaine[caractere]='.';
        if(key==57)chaine[caractere]='@';
    } while(caractere!=19);
    
    if(key==31)chaine[caractere]='\0';
    if(key!=31)chaine[caractere+1]='\0';
}


#pragma section _BR_Size
unsigned long BR_Size;
#pragma section
#pragma section _TOP
int InitializeSystem(int isAppli, unsigned short OptionNum){return INIT_ADDIN_APPLICATION(isAppli, OptionNum);}
#pragma section


la chaine ident fait 21 caracteres


Précédente 1, 2, 3 ··· 7, 8, 9, 10, 11, 12, 13 ··· 20, 21, 22, 23 Suivante
Lephenixnoir Hors ligne Administrateur Points: 24670 Défis: 170 Message

Citer : Posté le 07/05/2014 14:45 | #


Modifié aussi dans la fonction lecture_piaf ?
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 07/05/2014 14:46 | #


oui mais l'erreur n'est pas a la compilation
Lephenixnoir Hors ligne Administrateur Points: 24670 Défis: 170 Message

Citer : Posté le 07/05/2014 14:51 | #


En fait, je pense que si l'erreur ne vient que lorsque tu appelles la fonction piaf(), c'est parce que tu en modifies le contenu.
Vérifie que tu n'as plus aucune variable de ce nom.
Si ça bugge toujours, remets-moi le code, s'il te plaît.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 07/05/2014 14:55 | #


Voila le code en entier modifié...
Plus de variable du meme nom que des fonctions, j'ai recompilé tout, et toujours SE
Le code
Cliquer pour enrouler
#include "fxlib.h"
#include "MonochromeLib.h"
#include "AGBS.h"
#include <stdio.h>
#include <stdlib.h>



int AddIn_main(int isAppli, unsigned short OptionNum)
{
    unsigned int key;
    int handle;
    
    Bdisp_AllClr_DDVRAM();

    demmarage(&handle);
    menu(&handle);
    
    
    Bfile_CloseFile(handle);
    while(1){
        GetKey(&key);
    }

    return 1;
}


void demmarage(int* handle)
{
    const unsigned char fond[]={
        0x0,0x0,0x0,0x0,0x0,0x6,0x0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0xe,0x0,0xe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1c,0x0,0x70,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0x0,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0x7c,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0xd6,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1d,0xbb,0x70,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x3f,0x6d,0xf8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x23,0xd7,0x88,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x3f,0x6d,0xf8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1d,0xbb,0x70,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0xd6,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0x7c,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0x0,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1c,0x0,0x70,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0xe,0x0,0xe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x6,0x0,0xc0,0x0,0x0,0x1,0x80,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x80,0x0,0xf,0xf0,0x0,
        0x0,0x0,0x0,0x0,0x1e,0x0,0x0,0x0,0xf,0x18,0x1,0x80,0x0,0x7f,0xfe,0x0,
        0x0,0x3,0x80,0x0,0x33,0x0,0x0,0x0,0xd,0x80,0x1,0x80,0x0,0x7f,0xfe,0x0,
        0x0,0x4,0x40,0x0,0x33,0x78,0xf3,0xed,0x8d,0x9b,0xef,0x9e,0x0,0xff,0xff,0x0,
        0x0,0x3c,0x20,0x0,0x3f,0x6d,0x9b,0x6d,0x8f,0x9b,0x6d,0xb0,0x1,0xff,0xff,0x80,
        0x0,0x40,0x10,0x0,0x33,0x6d,0x9b,0xd,0x8c,0xdb,0xd,0x9c,0x1,0xff,0xff,0x80,
        0x0,0x40,0x8,0x0,0x33,0x6d,0x9b,0xd,0x8c,0xdb,0xd,0x86,0x1,0xff,0xff,0x80,
        0x0,0x38,0x4,0x0,0x33,0x6c,0xfb,0x7,0x8f,0x9b,0xf,0xbc,0x1,0xff,0xff,0x80,
        0x0,0x40,0x2,0x0,0x0,0x0,0x18,0x1,0x80,0x0,0x0,0x0,0x3,0xff,0xff,0xc0,
        0x0,0x80,0x1,0x0,0x0,0x0,0xd8,0xd,0x80,0x0,0x0,0x0,0x3,0xff,0xff,0xc0,
        0x0,0x80,0x0,0x80,0x0,0x0,0xd8,0xd,0x80,0x0,0x0,0x0,0x3,0xe1,0x87,0xc0,
        0x1,0x7,0x83,0xc0,0x0,0x0,0xd8,0xd,0x80,0x0,0x0,0x0,0x3,0xdd,0xbb,0xc0,
        0x1,0x3,0xe7,0xa0,0x0,0x0,0x70,0x7,0x0,0x0,0x0,0x0,0x3,0xbe,0x7d,0xc0,
        0x3a,0x2,0x7f,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x7f,0xfe,0xc0,
        0x36,0x2,0x25,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x7f,0xfe,0xe0,
        0x1e,0x1,0x19,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x7d,0xbe,0x60,
        0x1e,0x0,0xe6,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe,0x83,0xc1,0x70,
        0x6,0x0,0x81,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0xfe,0x7f,0xb0,
        0x1b,0x80,0xb0,0x90,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0xfe,0x7f,0xb0,
        0x3,0xe0,0x4f,0x10,0x7,0xb0,0x0,0x6,0x1,0x80,0x0,0x0,0xd,0xef,0xf7,0xb0,
        0x1,0x78,0x38,0x70,0xc,0x30,0x0,0x6,0x1,0x80,0x0,0x0,0xa,0xdd,0xbb,0x50,
        0x0,0x9f,0x3,0xf0,0xc,0x3c,0xe7,0xc3,0x3,0x1c,0xf9,0xe0,0xb,0x3d,0xbc,0xd0,
        0x0,0x47,0xff,0xa0,0x7,0x31,0xb6,0xc3,0x33,0x36,0xdb,0x0,0x1b,0xf5,0xaf,0xd8,
        0x0,0x20,0xcc,0x40,0x1,0xb1,0xb6,0x1,0xfe,0x36,0xc1,0xc0,0x11,0xf5,0xaf,0x88,
        0x0,0x18,0x78,0x80,0x1,0xb1,0xb6,0x1,0xfe,0x36,0xc0,0x60,0x10,0xd5,0xab,0x8,
        0x0,0x7,0xff,0x0,0xf,0x30,0xd6,0x0,0xcc,0x1a,0xc3,0xc0,0x30,0x7d,0xbe,0xc,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3f,0xfd,0xbf,0xfc,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1f,0xf8,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xe0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1e,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0xc0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0xff,0xe0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xff,0xf0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xdf,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x8f,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x7,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf,0x8f,0xfc,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf,0xdf,0xfc,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x9,0xff,0xe4,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe,0x3f,0x1c,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xc0,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xff,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xff,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xff,0xf0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0xff,0xe0,0x0,0x0,0x0,0x0,0x0
    };
    unsigned int key;
    unsigned char buffer[NBR_NIVEAUX+1];
    FONTCHARACTER filename[]={'\\','\\','f','l','s','0','\\','a','g','r','y','s','w','.','r','g','l',0};
    
    // GESTION FICHIER
    Bdisp_AllClr_DDVRAM();
    *handle = Bfile_OpenFile(filename,_OPENMODE_READWRITE);
    if( *handle == -1 ){
        Bfile_CreateFile(filename, NBR_NIVEAUX+1);
        *handle = Bfile_OpenFile(filename,_OPENMODE_READWRITE);
        buffer[0] = '1';
        for(key = 1; key<NBR_NIVEAUX+1; key++){
            buffer[key] = '0';
        }
        Bfile_WriteFile(*handle,buffer,NBR_NIVEAUX+1);
        PrintMini(20,10,"Un fichier a ete cree:",0);
        PrintMini(35,17,"angrysw.rgl",0);
        PrintMini(1,30,"  Merci de ne pas le supprimer",0);
        PrintMini(1,36,"sous peine de vous exposer a la",0);
        PrintMini(1,42,"colere des oiseaux.",0);
        PrintMini(50,56,"[EXE]",0);
        do{
            GetKey(&key);
        }while(key != 30004);
    }
    
    // AFFICHAGE ECRAN D'ACCEUIL
    Bdisp_AllClr_DDVRAM();
    ML_bmp_or(fond, 0, 0, 128, 64);
    PrintMini(1,59,"TheProg",0);
    Bdisp_PutDisp_DD();
    GetKeyWait(KEYWAIT_HALTON_TIMERON, 2, 0, &key);
    Bdisp_AllClr_DDVRAM();
}


void menu(int* handle)
{
    // SPRITES
    const unsigned char fond[]={
        0x0,0x0,0x0,0x0,0x0,0x0,0xc,0x60,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0xe,0xe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0xd,0x6f,0x79,0xb0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0xc,0x6c,0x6d,0xb0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0xc,0x6e,0x6d,0xb0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0xc,0x6c,0x6d,0xb0,0x0,0x0,0x0,0x7,0xf0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0xc,0x6f,0x6c,0xe0,0x0,0x0,0x0,0x38,0xe,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0x1,0x80,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0x58,0x0,0x0,0x0,0x1,0x0,0x0,0x40,
        0x0,0x0,0x0,0x0,0x0,0x7f,0xff,0xfe,0xbf,0xff,0xfe,0x0,0x2,0x0,0x0,0x20,
        0x0,0x0,0x0,0x0,0x0,0xc0,0x0,0xe,0xb8,0x0,0x1,0x0,0x4,0x0,0x0,0x10,
        0x0,0x0,0x0,0x0,0x0,0x7f,0xff,0xfe,0xbf,0xff,0xfe,0x0,0x8,0x0,0x0,0x8,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0x58,0x0,0x0,0x0,0x10,0x0,0x0,0x8,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x0,0x8,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x0,0x4,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x4,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x4,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x3,0xe0,0x4,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x3c,0x1f,0xc8,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x13,0xd0,0x4,0x38,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0xd3,0x65,0xd4,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x16,0xb2,0x26,0x34,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3f,0x80,0x0,0x0,0x0,0x0,0x16,0x30,0x6,0xb4,
        0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x0,0x0,0x0,0x0,0x0,0x25,0xcc,0x9,0xd2,
        0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x39,0xb7,0xbe,0x0,0x0,0x2a,0xb,0x10,0x34,
        0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x6d,0xb6,0x36,0x0,0x0,0x11,0x8,0xe0,0x48,
        0x0,0x0,0x0,0x0,0x0,0x0,0x36,0x6d,0xb7,0x30,0x0,0x0,0x0,0x87,0x0,0x80,
        0x0,0x0,0x0,0x0,0x0,0x0,0x36,0x6d,0xb6,0x30,0x0,0x0,0x0,0x60,0x3,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x1c,0x38,0xe7,0xb0,0x0,0x0,0x0,0x18,0xc,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xf0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x4,0x0,0x0,0x0,0x1,0xc0,0x31,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x6,0x80,0x0,0x0,0x3,0x60,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x3f,0x80,0x0,0x0,0x3,0x67,0x3d,0x9c,0xf1,0xe0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x3f,0x80,0x0,0x0,0x3,0x6d,0xb1,0xb6,0xdb,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x1f,0x80,0x0,0x0,0x3,0x6d,0xb1,0xb6,0xd9,0xc0,0x0,0x0,0x0,0x0,0x0,
        0x0,0xf,0x80,0x0,0x0,0x3,0x6d,0xb1,0xb6,0xd8,0x60,0x0,0x0,0x0,0x0,0x0,
        0x0,0xf,0x80,0x0,0x0,0x1,0xcf,0x31,0x9c,0xdb,0xc0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x8,0x80,0x0,0x0,0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x10,0x40,0x0,0x0,0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x20,0x20,0x0,0x0,0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x20,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x40,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x80,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x80,0x2,0x0,0x0,0x1,0xf0,0xd,0x8c,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1,0x0,0x1,0x0,0x0,0x3,0x8,0x1,0x8c,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1,0x3c,0x1,0x80,0x0,0x3,0xb,0x6d,0xef,0x7b,0xe0,0x0,0x0,0x0,0x0,0x0,
        0x2,0xf,0x87,0x0,0x0,0x3,0xb,0x6d,0x8c,0x63,0x60,0x0,0x0,0x0,0x0,0x0,
        0x4,0x0,0xea,0x80,0x0,0x3,0x6b,0x6d,0x8c,0x73,0x0,0x0,0x0,0x0,0x0,0x0,
        0x24,0x0,0xbe,0x40,0x0,0x3,0x33,0x6d,0x8c,0x63,0x0,0x0,0x0,0x0,0x0,0x0,
        0x34,0x0,0x41,0x20,0x0,0x1,0xd9,0xcd,0x8c,0x7b,0x0,0x0,0x0,0x0,0x0,0x0,
        0x38,0x0,0x5f,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x38,0x0,0x44,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x18,0x0,0x38,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x6,0x0,0x0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1,0xff,0xff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
    };
    const unsigned char pointeur_g[]={
        0x36,
        0x7c,
        0xff,
        0xff,
        0x7c,
        0x30
    };
    const unsigned char pointeur_d[]={
        0x6c,
        0x3e,
        0xff,
        0xff,
        0x3e,
        0xc
    };
    
    unsigned int choix, key;
    unsigned int x_g, x_d, y;
    
    choix = 0;
    x_g = 40;
    x_d = 82;
    y = 23;
    do{
        // AFFICHAGE
        Bdisp_AllClr_DDVRAM();
        ML_bmp_or(fond, 0, 0, 128, 64);
        ML_bmp_or(pointeur_g, x_g, y, 8, 6);
        ML_bmp_or(pointeur_d, x_d, y, 8, 6);
        
        // GESTION TOUCHES
        GetKey(&key);
        if(key == KEY_CTRL_UP) choix--;
        if(key == KEY_CTRL_DOWN) choix++;
        if(key == KEY_CTRL_EXE){
            // if(choix == 0) menu_jeu(&handle);
            if(choix == 1) options(&handle);
            if(choix == 2) break;
        }
        if(choix == -1) choix = 2;
        if(choix == 3) choix = 0;
        
        if(choix == 0){
            x_g = 40;
            x_d = 82;
            y = 23;
        }
        if(choix == 1){
            x_g = 36;
            x_d = 86;
            y = 35;
        }
        if(choix == 2){
            x_g = 36;
            x_d = 86;
            y = 48;
        }
        Sleep(50);
    }while(1);
}


void options(int* handle)
{
    // SPRITES
    const unsigned char fond[]={
        0x0,0x0,0x0,0x0,0x0,0x1,0xc0,0x31,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x3,0x60,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1,0xff,0x80,0x0,0x0,0x3,0x67,0x3d,0x9c,0xf1,0xe0,0x0,0x0,0x0,0x0,0x0,
        0x7,0x0,0xe0,0x0,0x0,0x3,0x6d,0xb1,0xb6,0xdb,0x0,0x0,0x0,0x0,0x0,0x0,
        0x8,0x0,0x10,0x0,0x0,0x3,0x6d,0xb1,0xb6,0xd9,0xc0,0x0,0x0,0x0,0x0,0x0,
        0x18,0x0,0x18,0x0,0x0,0x3,0x6d,0xb1,0xb6,0xd8,0x60,0x0,0x0,0x0,0x0,0x0,
        0x18,0x0,0x18,0x0,0x0,0x1,0xcf,0x31,0x9c,0xdb,0xc0,0x0,0x0,0x0,0x0,0x0,
        0x18,0x0,0x18,0x0,0x0,0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x10,0x0,0x8,0x0,0x0,0x0,0xc,0xd,0x58,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x3f,0xff,0xfc,0x0,0x0,0x7f,0xff,0xfe,0xbf,0xff,0xfe,0x0,0x0,0x0,0x0,0x0,
        0x20,0x0,0x4,0x0,0x0,0xc0,0x0,0xe,0xb8,0x0,0x1,0x0,0x0,0x0,0x0,0x0,
        0x27,0xc3,0xe4,0x0,0x0,0x7f,0xff,0xfe,0xbf,0xff,0xfe,0x0,0x0,0x0,0x0,0x0,
        0x23,0x81,0xc4,0x0,0x0,0x0,0x0,0xd,0x58,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x20,0x42,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x20,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x30,0x18,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x30,0x7e,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x40,0xc3,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x40,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x40,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x41,0x18,0x82,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x33,0xbd,0xcc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x9,0x3c,0x90,0x1,0xf0,0x18,0x0,0x36,0x30,0x1b,0x0,0x0,0x0,0x0,0x0,0x0,
        0x8,0x3c,0x10,0x1,0x98,0x0,0x0,0x6,0x0,0x18,0x0,0x0,0x0,0x0,0x0,0x0,
        0x7,0xff,0xe0,0x1,0x9b,0xdb,0xcf,0x37,0xb3,0xdb,0x3d,0xef,0x80,0x0,0x0,0x0,
        0x0,0x0,0x0,0x1,0xf3,0x1b,0x6d,0xb6,0x36,0xdb,0x61,0x8d,0x80,0x0,0x0,0x0,
        0x0,0x0,0x0,0x1,0xb3,0x9b,0x6d,0xb6,0x36,0xdb,0x39,0xcc,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x1,0x9b,0x1b,0x6d,0xb6,0x36,0xdb,0xd,0x8c,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x1,0x9b,0xdb,0x6d,0xb6,0x33,0x5b,0x79,0xec,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xe6,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x36,0x7b,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xe6,0xdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x6,0xdb,0x80,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x6,0xdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x6,0x6b,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x80,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0x60,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x13,0x90,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x21,0x8,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x8,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1,0xf0,0x18,0x0,0x0,0x0,0x0,0x0,0x44,0x24,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1,0x98,0x18,0x0,0x0,0x0,0x0,0x0,0x4e,0x74,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1,0x9b,0xde,0x73,0x6f,0x0,0x0,0x0,0x40,0x4,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1,0xf3,0x18,0xdb,0x6d,0x0,0x0,0x1,0xff,0xff,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1,0xb3,0x98,0xdb,0x6c,0x0,0x0,0x2,0x44,0x44,0x80,
        0x0,0x0,0x0,0x0,0x0,0x1,0x9b,0x18,0xdb,0x6c,0x0,0x0,0x3,0x47,0xc5,0x80,
        0x0,0x0,0x0,0x0,0x0,0x1,0x9b,0xd8,0x71,0xcc,0x0,0x0,0x2,0x70,0x1c,0x80,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x53,0x95,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x50,0x15,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x73,0x9d,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x40,0x5,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0xf7,0xdf,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x20,0x9,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x3f,0xf9,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xe4,0x4f,0x80,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x4f,0xe4,0x80,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x29,0x28,0x80,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xef,0xef,0x80
    };
    const unsigned char pointeur_g[]={
        0x36,
        0x7c,
        0xff,
        0xff,
        0x7c,
        0x30
    };
    const unsigned char pointeur_d[]={
        0x6c,
        0x3e,
        0xff,
        0xff,
        0x3e,
        0xc
    };
    
    unsigned int choix, key;
    unsigned int x_g, x_d, y;
    
    choix = 0;
    x_g = 21;
    x_d = 100;
    y = 23;
    do{
        // AFFICHAGE
        Bdisp_AllClr_DDVRAM();
        ML_bmp_or(fond, 0, 0, 128, 64);
        ML_bmp_or(pointeur_g, x_g, y, 8, 6);
        ML_bmp_or(pointeur_d, x_d, y, 8, 6);
        
        // GESTION TOUCHES
        GetKey(&key);
        if(key == KEY_CTRL_UP) choix--;
        if(key == KEY_CTRL_DOWN) choix++;
        if(key == KEY_CTRL_EXE){
            if(choix == 0) reinitialiser(&handle);
            if(choix == 1) piaf(&handle);
            if(choix == 2) break;
        }
        if(choix == -1) choix = 2;
        if(choix == 3) choix = 0;
        
        if(choix == 0){
            x_g = 21;
            x_d = 100;
            y = 23;
        }
        if(choix == 1){
            x_g = 44;
            x_d = 77;
            y = 35;
        }
        if(choix == 2){
            x_g = 37;
            x_d = 84;
            y = 47;
        }
        Sleep(50);
    }while(1);
}

void reinitialiser(int* handle)
{
    unsigned char buffer[NBR_NIVEAUX+1];
    unsigned int nbr;
    FONTCHARACTER filename[]={'\\','\\','f','l','s','0','\\','a','g','r','y','s','w','.','r','g','l',0};
    
    Bdisp_AllClr_DDVRAM();
    PrintXY(1,1," Voulez-vous vraiment",0);
    PrintXY(1,8,"supprimer tout votre ",0);
    PrintXY(1,16,"avancement ?",0);
    PrintXY(47,36,"[EXE]",0);
    
    GetKey(&nbr);
    if(nbr != KEY_CTRL_EXE) return;
    
    Bfile_CloseFile(*handle);
    Bfile_DeleteFile(filename);
    Bfile_CreateFile(filename, NBR_NIVEAUX+1);
    *handle = Bfile_OpenFile(filename,_OPENMODE_READWRITE);
    buffer[0] = '1';
    for(nbr = 1; nbr<NBR_NIVEAUX+1; nbr++){
        buffer[nbr] = '0';
    }
    Bfile_WriteFile(*handle,buffer,NBR_NIVEAUX+1);
}

void piaf(int* handle)
{
    // SPRITES
    const unsigned char fond[]={
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xe6,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x36,0x7b,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xe6,0xdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x6,0xdb,0x80,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x6,0xdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x6,0x6b,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0x58,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x7f,0xff,0xfe,0xbf,0xff,0xfe,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0xc0,0x0,0xe,0xb8,0x0,0x1,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x7f,0xff,0xfe,0xbf,0xff,0xfe,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0x58,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1e,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x33,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe,0x7,0x21,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x11,0x18,0xc0,0x80,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0xa0,0x4c,0x80,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x26,0x40,0xd,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x26,0x0,0x3,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x4,0x0,
        0x0,0x0,0x0,0x0,0x0,0x3,0xe6,0x0,0x0,0x0,0x0,0x0,0xc,0x7,0x3,0x0,
        0x0,0x0,0x0,0x0,0x0,0x3,0x30,0x0,0x6,0x0,0x0,0x0,0x4,0x18,0xe0,0x80,
        0x0,0x0,0x0,0x0,0x0,0x3,0x36,0x7b,0xce,0x30,0x0,0x0,0x8,0x20,0x10,0x80,
        0x0,0x0,0x0,0x0,0x0,0x3,0xe6,0xdb,0x6,0x30,0x80,0x0,0x10,0x40,0x8,0x40,
        0x0,0x0,0x0,0x0,0x0,0x3,0x6,0xdb,0x86,0x1,0xc0,0x0,0x2e,0x8d,0x8b,0xa0,
        0x0,0x0,0x0,0x0,0x0,0x3,0x6,0xdb,0x6,0x30,0x80,0x0,0x51,0x9d,0xcc,0x50,
        0x0,0x0,0x0,0x0,0x0,0x3,0x6,0x6b,0xf,0x30,0x0,0x0,0x53,0x98,0xcc,0xd0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x51,0xc0,0x14,0x50,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4e,0x20,0x23,0x90,
        0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x1f,0xc0,0x10,
        0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x8,0x80,0x10,
        0x0,0x1c,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x7,0x0,0x20,
        0x0,0x3f,0x0,0x0,0x0,0x3,0xe6,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x0,0x40,
        0x0,0x1e,0x0,0x0,0x0,0x3,0x30,0x0,0x6,0x0,0x0,0x0,0x8,0x0,0x0,0x80,
        0x0,0x33,0x0,0x0,0x0,0x3,0x36,0x7b,0xc9,0x30,0x0,0x0,0x6,0x0,0x3,0x0,
        0x0,0x40,0x80,0x0,0x0,0x3,0xe6,0xdb,0x1,0x31,0x80,0x0,0x1,0xe0,0xfc,0x0,
        0x3,0xe0,0x40,0x0,0x0,0x3,0x6,0xdb,0x82,0x1,0xc0,0x0,0x0,0x1f,0x0,0x0,
        0x1,0x97,0xfe,0x0,0x0,0x3,0x6,0xdb,0x4,0x31,0x80,0x0,0x0,0x0,0x0,0x0,
        0x3,0x28,0x1,0x80,0x0,0x3,0x6,0x6b,0xf,0x30,0x0,0x0,0x0,0x0,0x0,0x0,
        0x2,0x88,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x4,0x73,0xe0,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x14,0x10,0x1e,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x18,0x10,0x1,0xe8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x18,0x8,0x0,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x18,0x7,0x0,0x10,0x0,0x1,0xf0,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x18,0x0,0xfe,0x20,0x0,0x1,0x98,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x4,0x0,0x21,0xc0,0x0,0x1,0x9b,0xde,0x73,0x6f,0x0,0x0,0x0,0x0,0x0,0x0,
        0x2,0x0,0x20,0x0,0x0,0x1,0xf3,0x18,0xdb,0x6d,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1,0x0,0x40,0x0,0x0,0x1,0xb3,0x98,0xdb,0x6c,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0xc1,0x80,0x0,0x0,0x1,0x9b,0x18,0xdb,0x6c,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x3e,0x0,0x0,0x0,0x1,0x9b,0xd8,0x71,0xcc,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
    };
    const unsigned char pointeur_g[]={
        0x36,
        0x7c,
        0xff,
        0xff,
        0x7c,
        0x30
    };
    const unsigned char pointeur_d[]={
        0x6c,
        0x3e,
        0xff,
        0xff,
        0x3e,
        0xc
    };
    
    unsigned int choix, key, n_piaf;
    unsigned int x_g, x_d, y;
    
    unsigned char buffer[NBR_NIVEAUX+1];
    FONTCHARACTER filename[]={'\\','\\','f','l','s','0','\\','a','g','r','y','s','w','.','r','g','l',0};
    
    lecture_piaf(&n_piaf, *handle);
    choix = 0;
    x_g = 35;
    x_d = 86;
    y = 23;
    do{
        // AFFICHAGE
        Bdisp_AllClr_DDVRAM();
        ML_bmp_or(fond, 0, 0, 128, 64);
        ML_bmp_or(pointeur_g, x_g, y, 8, 6);
        ML_bmp_or(pointeur_d, x_d, y, 8, 6);
        
        // GESTION TOUCHES
        GetKey(&key);
        if(key == KEY_CTRL_UP) choix--;
        if(key == KEY_CTRL_DOWN) choix++;
        if(key == KEY_CTRL_EXE){
            if(choix == 0) n_piaf = 1;
            if(choix == 1) n_piaf = 2;
            if(choix == 2) break;
            choix = 2;
        }
        
        if(choix == -1) choix = 2;
        if(choix == 3) choix = 0;
        
        if(choix == 0){
            x_g = 35;
            x_d = 86;
            y = 23;
        }
        if(choix == 1){
            x_g = 35;
            x_d = 86;
            y = 35;
        }
        if(choix == 2){
            x_g = 36;
            x_d = 84;
            y = 47;
        }
        Sleep(50);
    }while(1);
    
    // ENREGISTREMENT DANS LE FICHIER
    Bfile_ReadFile(*handle,buffer,NBR_NIVEAUX+1,0);
    if(n_piaf == 1) buffer[0] = '1';
    else buffer[0] = '2';
    Bfile_CloseFile(*handle);
    Bfile_DeleteFile(filename);
    Bfile_CreateFile(filename, NBR_NIVEAUX+1);
    *handle = Bfile_OpenFile(filename,_OPENMODE_READWRITE);
    Bfile_WriteFile(*handle,buffer,NBR_NIVEAUX+1);
}

void lecture_piaf(int* n_piaf, int handle)
{
    unsigned char buffer[2];

    Bfile_ReadFile(handle,buffer,1,0);
    if(buffer[0] == '1') *n_piaf = 1;
    else *n_piaf = 2;
}


#pragma section _BR_Size
unsigned long BR_Size;
#pragma section
#pragma section _TOP
int InitializeSystem(int isAppli, unsigned short OptionNum){return INIT_ADDIN_APPLICATION(isAppli, OptionNum);}
#pragma section

Lephenixnoir Hors ligne Administrateur Points: 24670 Défis: 170 Message

Citer : Posté le 07/05/2014 15:05 | #


Alors, je pense que pour pouvoir contenir NBR_NIVEAUX+1 octets, ton buffer ferait mieux d'en faire NBR_NIVEAUX+2.
Et tu ne fermes pas ton fichier ?

À part ça, je ne vois rien.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 07/05/2014 15:13 | # | Fichier joint


Le fichier se ferme quand tu quitte l'add-in, j'ai déjà essayé d'augmenter le buffer ça change rien...
Ça commence a m’énerver sérieusement ces erreurs en carton
Si tu compiles toi ça te sort une erreur ou pas
(Je te mets tout le projet en PJ)
Lephenixnoir Hors ligne Administrateur Points: 24670 Défis: 170 Message

Citer : Posté le 07/05/2014 15:16 | #


Il faut toujours fermer les fichiers, car sur la calculatrice, ils resteront ouverts. Négliger ce genre de choses est source de bugs indétectables.

Mais il y a un breakpoint sur le Sleep(50) !?
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 07/05/2014 15:18 | #


Ben oui le fichier se ferme: Bfile_CloseFile(handle);
Tu peux enlever le BP c'etait pour debugger
Lephenixnoir Hors ligne Administrateur Points: 24670 Défis: 170 Message

Citer : Posté le 07/05/2014 15:18 | #


Je vois. Le bug ne se produit pas si le fichier n'existe pas.
Vérifie tes fonctions de lecture et tes buffers.

Ajouté le 07/05/2014 à 15:19 :
Ah, j'avais compris que tu disais "Le fichier se ferme automatiquement lorsque l'émulateur s'arrête"
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 07/05/2014 17:17 | #


Toujours le même soucis, j'ai tout changé, tout verifié, ...
Le code
Cliquer pour enrouler
#include "fxlib.h"
#include "MonochromeLib.h"
#include "memory.h"
#include "AGBS.h"
#include <stdio.h>
#include <stdlib.h>



int AddIn_main(int isAppli, unsigned short OptionNum)
{
    unsigned int key;
    int handle;
    
    Bdisp_AllClr_DDVRAM();

    demmarage(&handle);
    menu(&handle);
    
    
    Bfile_CloseFile(handle);
    while(1){
        GetKey(&key);
    }

    return 1;
}


void demmarage(int* handle)
{
    const unsigned char fond[]={
        0x0,0x0,0x0,0x0,0x0,0x6,0x0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0xe,0x0,0xe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1c,0x0,0x70,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0x0,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0x7c,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0xd6,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1d,0xbb,0x70,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x3f,0x6d,0xf8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x23,0xd7,0x88,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x3f,0x6d,0xf8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1d,0xbb,0x70,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0xd6,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0x7c,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0x0,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1c,0x0,0x70,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0xe,0x0,0xe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x6,0x0,0xc0,0x0,0x0,0x1,0x80,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x80,0x0,0xf,0xf0,0x0,
        0x0,0x0,0x0,0x0,0x1e,0x0,0x0,0x0,0xf,0x18,0x1,0x80,0x0,0x7f,0xfe,0x0,
        0x0,0x3,0x80,0x0,0x33,0x0,0x0,0x0,0xd,0x80,0x1,0x80,0x0,0x7f,0xfe,0x0,
        0x0,0x4,0x40,0x0,0x33,0x78,0xf3,0xed,0x8d,0x9b,0xef,0x9e,0x0,0xff,0xff,0x0,
        0x0,0x3c,0x20,0x0,0x3f,0x6d,0x9b,0x6d,0x8f,0x9b,0x6d,0xb0,0x1,0xff,0xff,0x80,
        0x0,0x40,0x10,0x0,0x33,0x6d,0x9b,0xd,0x8c,0xdb,0xd,0x9c,0x1,0xff,0xff,0x80,
        0x0,0x40,0x8,0x0,0x33,0x6d,0x9b,0xd,0x8c,0xdb,0xd,0x86,0x1,0xff,0xff,0x80,
        0x0,0x38,0x4,0x0,0x33,0x6c,0xfb,0x7,0x8f,0x9b,0xf,0xbc,0x1,0xff,0xff,0x80,
        0x0,0x40,0x2,0x0,0x0,0x0,0x18,0x1,0x80,0x0,0x0,0x0,0x3,0xff,0xff,0xc0,
        0x0,0x80,0x1,0x0,0x0,0x0,0xd8,0xd,0x80,0x0,0x0,0x0,0x3,0xff,0xff,0xc0,
        0x0,0x80,0x0,0x80,0x0,0x0,0xd8,0xd,0x80,0x0,0x0,0x0,0x3,0xe1,0x87,0xc0,
        0x1,0x7,0x83,0xc0,0x0,0x0,0xd8,0xd,0x80,0x0,0x0,0x0,0x3,0xdd,0xbb,0xc0,
        0x1,0x3,0xe7,0xa0,0x0,0x0,0x70,0x7,0x0,0x0,0x0,0x0,0x3,0xbe,0x7d,0xc0,
        0x3a,0x2,0x7f,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x7f,0xfe,0xc0,
        0x36,0x2,0x25,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x7f,0xfe,0xe0,
        0x1e,0x1,0x19,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x7d,0xbe,0x60,
        0x1e,0x0,0xe6,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe,0x83,0xc1,0x70,
        0x6,0x0,0x81,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0xfe,0x7f,0xb0,
        0x1b,0x80,0xb0,0x90,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0xfe,0x7f,0xb0,
        0x3,0xe0,0x4f,0x10,0x7,0xb0,0x0,0x6,0x1,0x80,0x0,0x0,0xd,0xef,0xf7,0xb0,
        0x1,0x78,0x38,0x70,0xc,0x30,0x0,0x6,0x1,0x80,0x0,0x0,0xa,0xdd,0xbb,0x50,
        0x0,0x9f,0x3,0xf0,0xc,0x3c,0xe7,0xc3,0x3,0x1c,0xf9,0xe0,0xb,0x3d,0xbc,0xd0,
        0x0,0x47,0xff,0xa0,0x7,0x31,0xb6,0xc3,0x33,0x36,0xdb,0x0,0x1b,0xf5,0xaf,0xd8,
        0x0,0x20,0xcc,0x40,0x1,0xb1,0xb6,0x1,0xfe,0x36,0xc1,0xc0,0x11,0xf5,0xaf,0x88,
        0x0,0x18,0x78,0x80,0x1,0xb1,0xb6,0x1,0xfe,0x36,0xc0,0x60,0x10,0xd5,0xab,0x8,
        0x0,0x7,0xff,0x0,0xf,0x30,0xd6,0x0,0xcc,0x1a,0xc3,0xc0,0x30,0x7d,0xbe,0xc,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3f,0xfd,0xbf,0xfc,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1f,0xf8,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xe0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1e,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0xc0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0xff,0xe0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xff,0xf0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xdf,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x8f,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x7,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf,0x8f,0xfc,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf,0xdf,0xfc,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x9,0xff,0xe4,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe,0x3f,0x1c,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xc0,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xff,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xff,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xff,0xf0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0xff,0xe0,0x0,0x0,0x0,0x0,0x0
    };
    unsigned int key;
    unsigned char buffer[NBR_NIVEAUX+1];
    
    // GESTION FICHIER
    Bdisp_AllClr_DDVRAM();
    *handle = memory_openfile("\\\\fls0\\angrysw.rgl",_OPENMODE_READWRITE);
    if( *handle < 0 ){
        // CREATION
        memory_createfile("\\\\fls0\\angrysw.rgl", T_FICHIER);
        // OUVERTURE
        *handle = memory_openfile("\\\\fls0\\angrysw.rgl",_OPENMODE_READWRITE);
        // ECRITURE
        buffer[0] = '1';
        for(key = 1; key<NBR_NIVEAUX+1; key++){
            buffer[key] = '0';
        }
        memory_writefile(*handle,buffer,NBR_NIVEAUX+1);
        
        PrintMini(20,10,"Un fichier a ete cree:",0);
        PrintMini(35,17,"angrysw.rgl",0);
        PrintMini(1,30,"  Merci de ne pas le supprimer",0);
        PrintMini(1,36,"sous peine de vous exposer a la",0);
        PrintMini(1,42,"colere des oiseaux.",0);
        PrintMini(50,56,"[EXE]",0);
        do{
            GetKey(&key);
        }while(key != 30004);
    }
    
    // AFFICHAGE ECRAN D'ACCEUIL
    Bdisp_AllClr_DDVRAM();
    ML_bmp_or(fond, 0, 0, 128, 64);
    PrintMini(1,59,"TheProg",0);
    Bdisp_PutDisp_DD();
    GetKeyWait(KEYWAIT_HALTON_TIMERON, 2, 0, &key);
    Bdisp_AllClr_DDVRAM();
}


void menu(int* handle)
{
    // SPRITES
    const unsigned char fond[]={
        0x0,0x0,0x0,0x0,0x0,0x0,0xc,0x60,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0xe,0xe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0xd,0x6f,0x79,0xb0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0xc,0x6c,0x6d,0xb0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0xc,0x6e,0x6d,0xb0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0xc,0x6c,0x6d,0xb0,0x0,0x0,0x0,0x7,0xf0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0xc,0x6f,0x6c,0xe0,0x0,0x0,0x0,0x38,0xe,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0x1,0x80,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0x58,0x0,0x0,0x0,0x1,0x0,0x0,0x40,
        0x0,0x0,0x0,0x0,0x0,0x7f,0xff,0xfe,0xbf,0xff,0xfe,0x0,0x2,0x0,0x0,0x20,
        0x0,0x0,0x0,0x0,0x0,0xc0,0x0,0xe,0xb8,0x0,0x1,0x0,0x4,0x0,0x0,0x10,
        0x0,0x0,0x0,0x0,0x0,0x7f,0xff,0xfe,0xbf,0xff,0xfe,0x0,0x8,0x0,0x0,0x8,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0x58,0x0,0x0,0x0,0x10,0x0,0x0,0x8,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x0,0x8,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x0,0x4,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x4,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x4,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x3,0xe0,0x4,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x3c,0x1f,0xc8,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x13,0xd0,0x4,0x38,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0xd3,0x65,0xd4,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x16,0xb2,0x26,0x34,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3f,0x80,0x0,0x0,0x0,0x0,0x16,0x30,0x6,0xb4,
        0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x0,0x0,0x0,0x0,0x0,0x25,0xcc,0x9,0xd2,
        0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x39,0xb7,0xbe,0x0,0x0,0x2a,0xb,0x10,0x34,
        0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x6d,0xb6,0x36,0x0,0x0,0x11,0x8,0xe0,0x48,
        0x0,0x0,0x0,0x0,0x0,0x0,0x36,0x6d,0xb7,0x30,0x0,0x0,0x0,0x87,0x0,0x80,
        0x0,0x0,0x0,0x0,0x0,0x0,0x36,0x6d,0xb6,0x30,0x0,0x0,0x0,0x60,0x3,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x1c,0x38,0xe7,0xb0,0x0,0x0,0x0,0x18,0xc,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xf0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x4,0x0,0x0,0x0,0x1,0xc0,0x31,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x6,0x80,0x0,0x0,0x3,0x60,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x3f,0x80,0x0,0x0,0x3,0x67,0x3d,0x9c,0xf1,0xe0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x3f,0x80,0x0,0x0,0x3,0x6d,0xb1,0xb6,0xdb,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x1f,0x80,0x0,0x0,0x3,0x6d,0xb1,0xb6,0xd9,0xc0,0x0,0x0,0x0,0x0,0x0,
        0x0,0xf,0x80,0x0,0x0,0x3,0x6d,0xb1,0xb6,0xd8,0x60,0x0,0x0,0x0,0x0,0x0,
        0x0,0xf,0x80,0x0,0x0,0x1,0xcf,0x31,0x9c,0xdb,0xc0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x8,0x80,0x0,0x0,0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x10,0x40,0x0,0x0,0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x20,0x20,0x0,0x0,0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x20,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x40,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x80,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x80,0x2,0x0,0x0,0x1,0xf0,0xd,0x8c,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1,0x0,0x1,0x0,0x0,0x3,0x8,0x1,0x8c,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1,0x3c,0x1,0x80,0x0,0x3,0xb,0x6d,0xef,0x7b,0xe0,0x0,0x0,0x0,0x0,0x0,
        0x2,0xf,0x87,0x0,0x0,0x3,0xb,0x6d,0x8c,0x63,0x60,0x0,0x0,0x0,0x0,0x0,
        0x4,0x0,0xea,0x80,0x0,0x3,0x6b,0x6d,0x8c,0x73,0x0,0x0,0x0,0x0,0x0,0x0,
        0x24,0x0,0xbe,0x40,0x0,0x3,0x33,0x6d,0x8c,0x63,0x0,0x0,0x0,0x0,0x0,0x0,
        0x34,0x0,0x41,0x20,0x0,0x1,0xd9,0xcd,0x8c,0x7b,0x0,0x0,0x0,0x0,0x0,0x0,
        0x38,0x0,0x5f,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x38,0x0,0x44,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x18,0x0,0x38,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x6,0x0,0x0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1,0xff,0xff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
    };
    const unsigned char pointeur_g[]={
        0x36,
        0x7c,
        0xff,
        0xff,
        0x7c,
        0x30
    };
    const unsigned char pointeur_d[]={
        0x6c,
        0x3e,
        0xff,
        0xff,
        0x3e,
        0xc
    };
    
    unsigned int choix, key;
    unsigned int x_g, x_d, y;
    
    choix = 0;
    x_g = 40;
    x_d = 82;
    y = 23;
    do{
        // AFFICHAGE
        Bdisp_AllClr_DDVRAM();
        ML_bmp_or(fond, 0, 0, 128, 64);
        ML_bmp_or(pointeur_g, x_g, y, 8, 6);
        ML_bmp_or(pointeur_d, x_d, y, 8, 6);
        
        // GESTION TOUCHES
        GetKey(&key);
        if(key == KEY_CTRL_UP) choix--;
        if(key == KEY_CTRL_DOWN) choix++;
        if(key == KEY_CTRL_EXE){
            // if(choix == 0) menu_jeu(&handle);
            if(choix == 1) options(&handle);
            if(choix == 2) break;
        }
        if(choix == -1) choix = 2;
        if(choix == 3) choix = 0;
        
        if(choix == 0){
            x_g = 40;
            x_d = 82;
            y = 23;
        }
        if(choix == 1){
            x_g = 36;
            x_d = 86;
            y = 35;
        }
        if(choix == 2){
            x_g = 36;
            x_d = 86;
            y = 48;
        }
        Sleep(50);
    }while(1);
}


// OPTIONS
void options(int* handle)
{
    // SPRITES
    const unsigned char fond[]={
        0x0,0x0,0x0,0x0,0x0,0x1,0xc0,0x31,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x3,0x60,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1,0xff,0x80,0x0,0x0,0x3,0x67,0x3d,0x9c,0xf1,0xe0,0x0,0x0,0x0,0x0,0x0,
        0x7,0x0,0xe0,0x0,0x0,0x3,0x6d,0xb1,0xb6,0xdb,0x0,0x0,0x0,0x0,0x0,0x0,
        0x8,0x0,0x10,0x0,0x0,0x3,0x6d,0xb1,0xb6,0xd9,0xc0,0x0,0x0,0x0,0x0,0x0,
        0x18,0x0,0x18,0x0,0x0,0x3,0x6d,0xb1,0xb6,0xd8,0x60,0x0,0x0,0x0,0x0,0x0,
        0x18,0x0,0x18,0x0,0x0,0x1,0xcf,0x31,0x9c,0xdb,0xc0,0x0,0x0,0x0,0x0,0x0,
        0x18,0x0,0x18,0x0,0x0,0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x10,0x0,0x8,0x0,0x0,0x0,0xc,0xd,0x58,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x3f,0xff,0xfc,0x0,0x0,0x7f,0xff,0xfe,0xbf,0xff,0xfe,0x0,0x0,0x0,0x0,0x0,
        0x20,0x0,0x4,0x0,0x0,0xc0,0x0,0xe,0xb8,0x0,0x1,0x0,0x0,0x0,0x0,0x0,
        0x27,0xc3,0xe4,0x0,0x0,0x7f,0xff,0xfe,0xbf,0xff,0xfe,0x0,0x0,0x0,0x0,0x0,
        0x23,0x81,0xc4,0x0,0x0,0x0,0x0,0xd,0x58,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x20,0x42,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x20,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x30,0x18,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x30,0x7e,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x40,0xc3,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x40,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x40,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x41,0x18,0x82,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x33,0xbd,0xcc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x9,0x3c,0x90,0x1,0xf0,0x18,0x0,0x36,0x30,0x1b,0x0,0x0,0x0,0x0,0x0,0x0,
        0x8,0x3c,0x10,0x1,0x98,0x0,0x0,0x6,0x0,0x18,0x0,0x0,0x0,0x0,0x0,0x0,
        0x7,0xff,0xe0,0x1,0x9b,0xdb,0xcf,0x37,0xb3,0xdb,0x3d,0xef,0x80,0x0,0x0,0x0,
        0x0,0x0,0x0,0x1,0xf3,0x1b,0x6d,0xb6,0x36,0xdb,0x61,0x8d,0x80,0x0,0x0,0x0,
        0x0,0x0,0x0,0x1,0xb3,0x9b,0x6d,0xb6,0x36,0xdb,0x39,0xcc,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x1,0x9b,0x1b,0x6d,0xb6,0x36,0xdb,0xd,0x8c,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x1,0x9b,0xdb,0x6d,0xb6,0x33,0x5b,0x79,0xec,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xe6,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x36,0x7b,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xe6,0xdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x6,0xdb,0x80,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x6,0xdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x6,0x6b,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x80,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0x60,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x13,0x90,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x21,0x8,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x8,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1,0xf0,0x18,0x0,0x0,0x0,0x0,0x0,0x44,0x24,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1,0x98,0x18,0x0,0x0,0x0,0x0,0x0,0x4e,0x74,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1,0x9b,0xde,0x73,0x6f,0x0,0x0,0x0,0x40,0x4,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1,0xf3,0x18,0xdb,0x6d,0x0,0x0,0x1,0xff,0xff,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1,0xb3,0x98,0xdb,0x6c,0x0,0x0,0x2,0x44,0x44,0x80,
        0x0,0x0,0x0,0x0,0x0,0x1,0x9b,0x18,0xdb,0x6c,0x0,0x0,0x3,0x47,0xc5,0x80,
        0x0,0x0,0x0,0x0,0x0,0x1,0x9b,0xd8,0x71,0xcc,0x0,0x0,0x2,0x70,0x1c,0x80,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x53,0x95,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x50,0x15,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x73,0x9d,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x40,0x5,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0xf7,0xdf,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x20,0x9,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x3f,0xf9,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xe4,0x4f,0x80,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x4f,0xe4,0x80,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x29,0x28,0x80,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xef,0xef,0x80
    };
    const unsigned char pointeur_g[]={
        0x36,
        0x7c,
        0xff,
        0xff,
        0x7c,
        0x30
    };
    const unsigned char pointeur_d[]={
        0x6c,
        0x3e,
        0xff,
        0xff,
        0x3e,
        0xc
    };
    
    unsigned int choix, key;
    unsigned int x_g, x_d, y;
    
    choix = 0;
    x_g = 21;
    x_d = 100;
    y = 23;
    do{
        // AFFICHAGE
        Bdisp_AllClr_DDVRAM();
        ML_bmp_or(fond, 0, 0, 128, 64);
        ML_bmp_or(pointeur_g, x_g, y, 8, 6);
        ML_bmp_or(pointeur_d, x_d, y, 8, 6);
        
        // GESTION TOUCHES
        GetKey(&key);
        if(key == KEY_CTRL_UP) choix--;
        if(key == KEY_CTRL_DOWN) choix++;
        if(key == KEY_CTRL_EXE){
            if(choix == 0) reinitialiser(&handle);
            if(choix == 1) piaf(&handle);
            if(choix == 2) break;
        }
        if(choix == -1) choix = 2;
        if(choix == 3) choix = 0;
        
        if(choix == 0){
            x_g = 21;
            x_d = 100;
            y = 23;
        }
        if(choix == 1){
            x_g = 44;
            x_d = 77;
            y = 35;
        }
        if(choix == 2){
            x_g = 37;
            x_d = 84;
            y = 47;
        }
        Sleep(50);
    }while(1);
}

void reinitialiser(int* handle)
{
    unsigned char buffer[NBR_NIVEAUX+1];
    unsigned int nbr;
    
    Bdisp_AllClr_DDVRAM();
    PrintXY(1,1," Voulez-vous vraiment",0);
    PrintXY(1,8,"supprimer tout votre ",0);
    PrintXY(1,16,"avancement ?",0);
    PrintXY(47,36,"[EXE]",0);
    
    GetKey(&nbr);
    if(nbr != KEY_CTRL_EXE) return;
    
    memory_closefile(*handle);
    memory_deletefile("\\\\fls0\\angrysw.rgl");
    memory_createfile("\\\\fls0\\angrysw.rgl", T_FICHIER);
    *handle = memory_openfile("\\\\fls0\\angrysw.rgl",_OPENMODE_READWRITE);
    buffer[0] = '1';
    for(nbr = 1; nbr<NBR_NIVEAUX+1; nbr++){
        buffer[nbr] = '0';
    }
    memory_writefile(*handle,buffer,NBR_NIVEAUX+1);
}

void piaf(int* handle)
{
    // SPRITES
    const unsigned char fond[]={
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xe6,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x36,0x7b,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xe6,0xdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x6,0xdb,0x80,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x6,0xdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x6,0x6b,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0x58,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x7f,0xff,0xfe,0xbf,0xff,0xfe,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0xc0,0x0,0xe,0xb8,0x0,0x1,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x7f,0xff,0xfe,0xbf,0xff,0xfe,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0x58,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1e,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x33,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe,0x7,0x21,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x11,0x18,0xc0,0x80,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0xa0,0x4c,0x80,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x26,0x40,0xd,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x26,0x0,0x3,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x4,0x0,
        0x0,0x0,0x0,0x0,0x0,0x3,0xe6,0x0,0x0,0x0,0x0,0x0,0xc,0x7,0x3,0x0,
        0x0,0x0,0x0,0x0,0x0,0x3,0x30,0x0,0x6,0x0,0x0,0x0,0x4,0x18,0xe0,0x80,
        0x0,0x0,0x0,0x0,0x0,0x3,0x36,0x7b,0xce,0x30,0x0,0x0,0x8,0x20,0x10,0x80,
        0x0,0x0,0x0,0x0,0x0,0x3,0xe6,0xdb,0x6,0x30,0x80,0x0,0x10,0x40,0x8,0x40,
        0x0,0x0,0x0,0x0,0x0,0x3,0x6,0xdb,0x86,0x1,0xc0,0x0,0x2e,0x8d,0x8b,0xa0,
        0x0,0x0,0x0,0x0,0x0,0x3,0x6,0xdb,0x6,0x30,0x80,0x0,0x51,0x9d,0xcc,0x50,
        0x0,0x0,0x0,0x0,0x0,0x3,0x6,0x6b,0xf,0x30,0x0,0x0,0x53,0x98,0xcc,0xd0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x51,0xc0,0x14,0x50,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4e,0x20,0x23,0x90,
        0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x1f,0xc0,0x10,
        0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x8,0x80,0x10,
        0x0,0x1c,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x7,0x0,0x20,
        0x0,0x3f,0x0,0x0,0x0,0x3,0xe6,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x0,0x40,
        0x0,0x1e,0x0,0x0,0x0,0x3,0x30,0x0,0x6,0x0,0x0,0x0,0x8,0x0,0x0,0x80,
        0x0,0x33,0x0,0x0,0x0,0x3,0x36,0x7b,0xc9,0x30,0x0,0x0,0x6,0x0,0x3,0x0,
        0x0,0x40,0x80,0x0,0x0,0x3,0xe6,0xdb,0x1,0x31,0x80,0x0,0x1,0xe0,0xfc,0x0,
        0x3,0xe0,0x40,0x0,0x0,0x3,0x6,0xdb,0x82,0x1,0xc0,0x0,0x0,0x1f,0x0,0x0,
        0x1,0x97,0xfe,0x0,0x0,0x3,0x6,0xdb,0x4,0x31,0x80,0x0,0x0,0x0,0x0,0x0,
        0x3,0x28,0x1,0x80,0x0,0x3,0x6,0x6b,0xf,0x30,0x0,0x0,0x0,0x0,0x0,0x0,
        0x2,0x88,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x4,0x73,0xe0,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x14,0x10,0x1e,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x18,0x10,0x1,0xe8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x18,0x8,0x0,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x18,0x7,0x0,0x10,0x0,0x1,0xf0,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x18,0x0,0xfe,0x20,0x0,0x1,0x98,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x4,0x0,0x21,0xc0,0x0,0x1,0x9b,0xde,0x73,0x6f,0x0,0x0,0x0,0x0,0x0,0x0,
        0x2,0x0,0x20,0x0,0x0,0x1,0xf3,0x18,0xdb,0x6d,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1,0x0,0x40,0x0,0x0,0x1,0xb3,0x98,0xdb,0x6c,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0xc1,0x80,0x0,0x0,0x1,0x9b,0x18,0xdb,0x6c,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x3e,0x0,0x0,0x0,0x1,0x9b,0xd8,0x71,0xcc,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
    };
    const unsigned char pointeur_g[]={
        0x36,
        0x7c,
        0xff,
        0xff,
        0x7c,
        0x30
    };
    const unsigned char pointeur_d[]={
        0x6c,
        0x3e,
        0xff,
        0xff,
        0x3e,
        0xc
    };
    
    unsigned int choix, key, n_piaf;
    unsigned int x_g, x_d, y;
    
    unsigned char buffer[NBR_NIVEAUX+2];
    
    lecture_piaf(&n_piaf, *handle);
    choix = 0;
    x_g = 35;
    x_d = 86;
    y = 23;
    do{
        // AFFICHAGE
        Bdisp_AllClr_DDVRAM();
        ML_bmp_or(fond, 0, 0, 128, 64);
        ML_bmp_or(pointeur_g, x_g, y, 8, 6);
        ML_bmp_or(pointeur_d, x_d, y, 8, 6);
        
        // GESTION TOUCHES
        GetKey(&key);
        if(key == KEY_CTRL_UP) choix--;
        if(key == KEY_CTRL_DOWN) choix++;
        if(key == KEY_CTRL_EXE){
            if(choix == 0) n_piaf = 1;
            if(choix == 1) n_piaf = 2;
            if(choix == 2) break;
            choix = 2;
        }
        
        if(choix == -1) choix = 2;
        if(choix == 3) choix = 0;
        
        if(choix == 0){
            x_g = 35;
            x_d = 86;
            y = 23;
        }
        if(choix == 1){
            x_g = 35;
            x_d = 86;
            y = 35;
        }
        if(choix == 2){
            x_g = 36;
            x_d = 84;
            y = 47;
        }
        Sleep(50);
    }while(1);
    
    // ENREGISTREMENT DANS LE FICHIER
    memory_readfile(*handle,buffer,NBR_NIVEAUX+1,0);
    if(n_piaf == 1) buffer[0] = '1';
    else buffer[0] = '2';
    memory_closefile(*handle);
    memory_deletefile("\\\\fls0\\angrysw.rgl");
    memory_createfile("\\\\fls0\\angrysw.rgl", T_FICHIER);
    *handle = memory_openfile("\\\\fls0\\angrysw.rgl",_OPENMODE_READWRITE);
    memory_writefile(*handle,buffer,NBR_NIVEAUX+1);
}

void lecture_piaf(int* n_piaf, int handle)
{
    unsigned char buffer[2];

    memory_readfile(handle,buffer,1,0);
    if(buffer[0] == '1') *n_piaf = 1;
    else *n_piaf = 2;
}


#pragma section _BR_Size
unsigned long BR_Size;
#pragma section
#pragma section _TOP
int InitializeSystem(int isAppli, unsigned short OptionNum){return INIT_ADDIN_APPLICATION(isAppli, OptionNum);}
#pragma section


Ajouté le 07/05/2014 à 17:19 :
Par contre il y a du mieux, c'est une fois de temps en temps...
Quand le fichier vient d’être créer
Lephenixnoir Hors ligne Administrateur Points: 24670 Défis: 170 Message

Citer : Posté le 07/05/2014 17:23 | #


C'est encore pire si ce n'est que de temps en temps.
Pourquoi est-ce que tu ne refermes pas le fichier à chaque utilisation ? Ton handle va finir par en plus rien valoir du tout.

Ajouté le 07/05/2014 à 17:24 :
En fait ça doit être parce que sinon il n'existe pas... donc ça ne fonctionne pas du tout.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 07/05/2014 17:35 | #


Bon je pense en avoir enfin fini de ce **** de bug
Le code
Cliquer pour enrouler
void demmarage(int* handle)
{
    const unsigned char fond[]={
        0x0,0x0,0x0,0x0,0x0,0x6,0x0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0xe,0x0,0xe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1c,0x0,0x70,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0x0,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0x7c,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0xd6,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1d,0xbb,0x70,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x3f,0x6d,0xf8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x23,0xd7,0x88,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x3f,0x6d,0xf8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1d,0xbb,0x70,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0xd6,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0x7c,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0x0,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x1c,0x0,0x70,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0xe,0x0,0xe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x6,0x0,0xc0,0x0,0x0,0x1,0x80,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x80,0x0,0xf,0xf0,0x0,
        0x0,0x0,0x0,0x0,0x1e,0x0,0x0,0x0,0xf,0x18,0x1,0x80,0x0,0x7f,0xfe,0x0,
        0x0,0x3,0x80,0x0,0x33,0x0,0x0,0x0,0xd,0x80,0x1,0x80,0x0,0x7f,0xfe,0x0,
        0x0,0x4,0x40,0x0,0x33,0x78,0xf3,0xed,0x8d,0x9b,0xef,0x9e,0x0,0xff,0xff,0x0,
        0x0,0x3c,0x20,0x0,0x3f,0x6d,0x9b,0x6d,0x8f,0x9b,0x6d,0xb0,0x1,0xff,0xff,0x80,
        0x0,0x40,0x10,0x0,0x33,0x6d,0x9b,0xd,0x8c,0xdb,0xd,0x9c,0x1,0xff,0xff,0x80,
        0x0,0x40,0x8,0x0,0x33,0x6d,0x9b,0xd,0x8c,0xdb,0xd,0x86,0x1,0xff,0xff,0x80,
        0x0,0x38,0x4,0x0,0x33,0x6c,0xfb,0x7,0x8f,0x9b,0xf,0xbc,0x1,0xff,0xff,0x80,
        0x0,0x40,0x2,0x0,0x0,0x0,0x18,0x1,0x80,0x0,0x0,0x0,0x3,0xff,0xff,0xc0,
        0x0,0x80,0x1,0x0,0x0,0x0,0xd8,0xd,0x80,0x0,0x0,0x0,0x3,0xff,0xff,0xc0,
        0x0,0x80,0x0,0x80,0x0,0x0,0xd8,0xd,0x80,0x0,0x0,0x0,0x3,0xe1,0x87,0xc0,
        0x1,0x7,0x83,0xc0,0x0,0x0,0xd8,0xd,0x80,0x0,0x0,0x0,0x3,0xdd,0xbb,0xc0,
        0x1,0x3,0xe7,0xa0,0x0,0x0,0x70,0x7,0x0,0x0,0x0,0x0,0x3,0xbe,0x7d,0xc0,
        0x3a,0x2,0x7f,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x7f,0xfe,0xc0,
        0x36,0x2,0x25,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x7f,0xfe,0xe0,
        0x1e,0x1,0x19,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x7d,0xbe,0x60,
        0x1e,0x0,0xe6,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe,0x83,0xc1,0x70,
        0x6,0x0,0x81,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0xfe,0x7f,0xb0,
        0x1b,0x80,0xb0,0x90,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd,0xfe,0x7f,0xb0,
        0x3,0xe0,0x4f,0x10,0x7,0xb0,0x0,0x6,0x1,0x80,0x0,0x0,0xd,0xef,0xf7,0xb0,
        0x1,0x78,0x38,0x70,0xc,0x30,0x0,0x6,0x1,0x80,0x0,0x0,0xa,0xdd,0xbb,0x50,
        0x0,0x9f,0x3,0xf0,0xc,0x3c,0xe7,0xc3,0x3,0x1c,0xf9,0xe0,0xb,0x3d,0xbc,0xd0,
        0x0,0x47,0xff,0xa0,0x7,0x31,0xb6,0xc3,0x33,0x36,0xdb,0x0,0x1b,0xf5,0xaf,0xd8,
        0x0,0x20,0xcc,0x40,0x1,0xb1,0xb6,0x1,0xfe,0x36,0xc1,0xc0,0x11,0xf5,0xaf,0x88,
        0x0,0x18,0x78,0x80,0x1,0xb1,0xb6,0x1,0xfe,0x36,0xc0,0x60,0x10,0xd5,0xab,0x8,
        0x0,0x7,0xff,0x0,0xf,0x30,0xd6,0x0,0xcc,0x1a,0xc3,0xc0,0x30,0x7d,0xbe,0xc,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3f,0xfd,0xbf,0xfc,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1f,0xf8,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xe0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1e,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0xc0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0xff,0xe0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xff,0xf0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xdf,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x8f,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x7,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf,0x8f,0xfc,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf,0xdf,0xfc,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x9,0xff,0xe4,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe,0x3f,0x1c,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xc0,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xff,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xff,0xf8,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xff,0xf0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0xff,0xe0,0x0,0x0,0x0,0x0,0x0
    };
    unsigned int key, erreur;
    unsigned char buffer[NBR_NIVEAUX+1];
    
    // GESTION FICHIER
    Bdisp_AllClr_DDVRAM();
    *handle = memory_openfile("\\\\fls0\\angrysw.rgl",_OPENMODE_READWRITE);
    if( *handle < 0 ){
        // CREATION
        memory_createfile("\\\\fls0\\angrysw.rgl", T_FICHIER);
        // OUVERTURE
        *handle = memory_openfile("\\\\fls0\\angrysw.rgl",_OPENMODE_READWRITE);
        // ECRITURE
        buffer[0] = '1';
        for(key = 1; key<NBR_NIVEAUX+1; key++){
            buffer[key] = '0';
        }
        [big][b][red]do{
            erreur = memory_writefile(*handle,buffer,NBR_NIVEAUX+1);
        }while(erreur < 0);[/red][/b][/big]
        
        PrintMini(20,10,"Un fichier a ete cree:",0);
        PrintMini(35,17,"angrysw.rgl",0);
        PrintMini(1,30,"  Merci de ne pas le supprimer",0);
        PrintMini(1,36,"sous peine de vous exposer a la",0);
        PrintMini(1,42,"colere des oiseaux.",0);
        PrintMini(50,56,"[EXE]",0);
        do{
            GetKey(&key);
        }while(key != 30004);
    }
    
    // AFFICHAGE ECRAN D'ACCEUIL
    Bdisp_AllClr_DDVRAM();
    ML_bmp_or(fond, 0, 0, 128, 64);
    PrintMini(1,59,"TheProg",0);
    Bdisp_PutDisp_DD();
    GetKeyWait(KEYWAIT_HALTON_TIMERON, 2, 0, &key);
    Bdisp_AllClr_DDVRAM();
}

Une simple boucle qui te fait gagner 2 heures

Ajouté le 07/05/2014 à 17:38 :
En fait si ca bug toujours
TheProg jette son ordi par la fenêtre, saute dessus à pieds joinds

Ajouté le 08/05/2014 à 11:20 :
memory_closefile(*handle); me donne un magnifique IML_FILEERR_ILLEGALDEVICE ...
Je me demande si c'est pas du au fait que je fait passer des pointeurs 2 fois ?
Une première fois dans options puis une seconde dans piaf ...
Mais ca n'esplique pas pourquoi ca marche une fois sur 2
Lephenixnoir Hors ligne Administrateur Points: 24670 Défis: 170 Message

Citer : Posté le 08/05/2014 11:22 | #


Parce que quand tu reset l'émulateur (après la compilation, en appuyant sur F5), il retire le fichier qui du coup n'existe plus.
En fait, ce n'est pas qu'un fois sur 2 ça ne bugge pas, c'est qu'il ne fait rien puisque le fichier n'existe pas.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 08/05/2014 11:28 | #


c'est qu'il ne fait rien puisque le fichier n'existe pas.

Le fichier existe forcement vu que soit il est déjà présent soit il le crée, bref je comprend pas ce point la
Mais je t'accorde que ça bug pas quand le fichier vient d’être créé

Ajouté le 08/05/2014 à 11:30 :
Non en fait il bug meme quand il vient de le créer
Lephenixnoir Hors ligne Administrateur Points: 24670 Défis: 170 Message

Citer : Posté le 08/05/2014 11:32 | #


C'est à cause de tes lectures/écritures.
Je me tue à te le dire
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 08/05/2014 12:02 | #


Le Header
Cliquer pour enrouler
#define NBR_NIVEAUX 20
#define T_FICHIER NBR_NIVEAUX+40

void demmarage();
void menu();
void options();
void reinitialiser();
void piaf();
void lecture_piaf(int* piaf);


Ajouté le 11/05/2014 à 11:08 :
Le code
Cliquer pour enrouler
#include "fxlib.h"
#include "MonochromeLib.h"
#include "memory.h"
#include "jeu.h"
#include "AGBS.h"
#include <stdio.h>
#include <stdlib.h>


void level(int monde, int niveau)
{
    int victoire = 0;

    Vaisseau piaf={5.,32.,0.,0.,1};
    Corps corps_1={0,0,0,0};
    Corps corps_2={0,0,0,0};
    Corps corps_3={0,0,0,0};
    Corps cible={0,32,0,0};
    
    lecture_piaf(&piaf.type);
    
    if(monde == 1){
        // faire tuto !
        if(niveau == 1){
            // POS INITIALE PIAF
            piaf.x = 5.;
            piaf.y = 32.;
            piaf.vx = 0.;
            piaf.vy = 0.;
            
            // POS CIBLE
            cible.x = 120;
            cible.y = 64;
            cible.rayon = 5;
            cible.gmm = 3;
            
            // POS CORPS
            corps_1.x = 64;
            corps_1.y = 32;
            corps_1.rayon = 5;
            corps_1.gmm = 3;
            
            victoire = jeu_1C(&piaf ,cible, corps_1);
            
            
        }
        
    }
}


int jeu_1C(Vaisseau *piaf, Corps cible, Corps corps)
{
    unsigned int xg, yg;
    
    
    while(1){
        integre_2C(&piaf, cible, corps);
        
        if (piaf->x<1) xg = 1;
        if (piaf->x>XMAX) xg = XMAX;
        if (piaf->y<1) yg = 1;
        if (piaf->y>YMAX) yg = YMAX;
        
        Bdisp_AllClr_DDVRAM();
        ML_filled_circle(corps.x, corps.y, corps.rayon, ML_BLACK);
        ML_circle(cible.x, cible.y, cible.rayon, ML_BLACK);
        Bdisp_SetPoint_VRAM((int)(xg+0.5),(int)(yg+0.5),1);
        Bdisp_PutDisp_DD();
        
    }
}

void integre_2C(Vaisseau *piaf, Corps cible, Corps corps)
{
    double fx, fy;
    double bfx, bfy;
    forceSubie(*piaf, cible, &fx, &fy);
    bfx = fx;
    bfy = fy;
    forceSubie(*piaf, corps, &fx, &fy);
    fx+=bfx;
    fy+=bfy;
    
    piaf->x += fx/2;
    piaf->y += fy/2;
    piaf->vx += piaf->vx+fx/2;
    piaf->vy += piaf->vy+fy/2;
}

void forceSubie(Vaisseau piaf, Corps corps, double *fx, double *fy)
{
    double xSatCorps = (double)(corps.x)-piaf.x;
    double ySatCorps = (double)(corps.y)-piaf.y;
    double r = sqrt(xSatCorps*xSatCorps+ySatCorps*ySatCorps);
    *fx = xSatCorps*(corps.gmm)/r/r/r;
    *fy = ySatCorps*(corps.gmm)/r/r/r;
}

Le header
Cliquer pour enrouler
#define XMAX 127
#define YMAX 63

// STRUCTURES
typedef struct Corps Corps;
struct Corps
{
    int x;
    int y;
    int rayon;
    int gmm;
};

typedef struct Vaisseau Vaisseau;
struct Vaisseau
{
    double x;
    double y;
    double vx;
    double vy;
    int type;
};

void level(int monde, int niveau);
int jeu_1C(Vaisseau* piaf, Corps cible, Corps corps);
void integre_2C(Vaisseau* piaf, Corps cible, Corps corps);
void forceSubie(Vaisseau piaf, Corps corps, double *fx, double *fy);

J'ai un SE dès l'entrée dans level(); ...

Ajouté le 11/05/2014 à 11:09 :
et aussi:
void lecture_piaf(int* n_piaf, int handle)
{
    unsigned char buffer[2];

    memory_readfile(handle,buffer,1,0);
    if(buffer[0] == '1') *n_piaf = 1;
    else *n_piaf = 2;
}

Lephenixnoir Hors ligne Administrateur Points: 24670 Défis: 170 Message

Citer : Posté le 11/05/2014 11:10 | #


&piaf.type

Je ne me souviens plus de l'ordre des opérateurs. Peut-être
&(piaf.type)

Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 11/05/2014 11:16 | #


Ya surement du mieux mais j'ai toujours le SE au alentour de: cible.gmm = 3;
Lephenixnoir Hors ligne Administrateur Points: 24670 Défis: 170 Message

Citer : Posté le 11/05/2014 11:21 | #


Pourquoi m'as-tu mis le deuxième morceau de code ? J'éspère qu'il ne génère pas d'erreur.
Sauf si n_piaf est nul
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 11/05/2014 11:25 | #


parce qu'il n'est pas dans le même fichier mais il est appelé, pour que tu vois ce qu'il attend mais normalement il n'y a pas de bugs a ce niveau.

Ajouté le 11/05/2014 à 12:27 :
Bon j'ai trouvé pour le premier SE (il manquait math.h). MAis un SE en cache un autre.
Donc j'ai un SE au niveau de "if (piaf->x <1) xg = 1;". Je dois avoir un probleme avec la structure...
Le code
Cliquer pour enrouler
#include "fxlib.h"
#include "MonochromeLib.h"
#include "memory.h"
#include "jeu.h"
#include "AGBS.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>


void level(int monde, int niveau)
{
    int victoire = 0;

    Vaisseau piaf={5.,32.,0.,0.,1};
    Corps corps_1={0,0,0,0};
    Corps corps_2={0,0,0,0};
    Corps corps_3={0,0,0,0};
    Corps cible={0,32,0,0};
    
    lecture_piaf(&(piaf.type));
    
    if(monde == 1){
        // faire tuto !
        if(niveau == 2){
            // POS INITIALE PIAF
            piaf.x = 5.;
            piaf.y = 32.;
            piaf.vx = 0.;
            piaf.vy = 0.;
            
            // POS CIBLE
            cible.x = 120;
            cible.y = 64;
            cible.rayon = 5;
            cible.gmm = 3.;
            
            // POS CORPS
            corps_1.x = 64;
            corps_1.y = 32;
            corps_1.rayon = 5;
            corps_1.gmm = 3.;
            
            victoire = jeu_1C(&piaf ,cible, corps_1);
            
            
        }
    }
}


int jeu_1C(Vaisseau *piaf, Corps cible, Corps corps)
{
    unsigned int xg, yg;
    
    
    while(1){
        integre_2C(&piaf, cible, corps);
        
        if (piaf->x <1) xg = 1;
        if (piaf->x >XMAX) xg = XMAX;
        if (piaf->y <1) yg = 1;
        if (piaf->y >YMAX) yg = YMAX;
        
        Bdisp_AllClr_DDVRAM();
        ML_filled_circle(corps.x, corps.y, corps.rayon, ML_BLACK);
        ML_circle(cible.x, cible.y, cible.rayon, ML_BLACK);
        Bdisp_SetPoint_VRAM((int)(xg+0.5),(int)(yg+0.5),1);
        Bdisp_PutDisp_DD();
        
    }
}

void integre_2C(Vaisseau *piaf, Corps cible, Corps corps)
{
    double fx, fy;
    double bfx, bfy;
    forceSubie(*piaf, cible, &fx, &fy);
    bfx = fx;
    bfy = fy;
    forceSubie(*piaf, corps, &fx, &fy);
    fx+=bfx;
    fy+=bfy;
    
    piaf->x += fx/2;
    piaf->y += fy/2;
    piaf->vx += piaf->vx+fx/2;
    piaf->vy += piaf->vy+fy/2;
}

void forceSubie(Vaisseau piaf, Corps corps, double *fx, double *fy)
{
    double xSatCorps = (double)(corps.x)-piaf.x;
    double ySatCorps = (double)(corps.y)-piaf.y;
    double r = sqrt(xSatCorps*xSatCorps+ySatCorps*ySatCorps);
    *fx = xSatCorps*(corps.gmm)/r/r/r;
    *fy = ySatCorps*(corps.gmm)/r/r/r;
}


Ajouté le 11/05/2014 à 14:52 :
bon ben j'ai a peut pres tout essayer mais rien a faire...
Soit vaisseau prend des valeurs incongrues, soit l'initialisation plante, soit j'ai des systemes error, ...
Bref je maitrise pas encore bien les structures
Donc voila
Le code
Cliquer pour enrouler
#include "fxlib.h"
#include "MonochromeLib.h"
#include "memory.h"
#include "jeu.h"
#include "AGBS.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>


void level(int monde, int niveau)
{
    int victoire = 0;

    Vaisseau vaisseau={5.,32.,0.,0.,1};
    Corps corps_1={0,0,0,0};
    Corps corps_2={0,0,0,0};
    Corps corps_3={0,0,0,0};
    Corps cible={0,32,0,0};
    
    lecture_piaf(&(vaisseau.type));
    
    if(monde == 1){
        // faire tuto !
        if(niveau == 2){
            // POS INITIALE vaisseau
            vaisseau.x = 5.;
            vaisseau.y = 32.;
            vaisseau.vx = 2.;
            vaisseau.vy = 0.;
            
            // POS CIBLE
            cible.x = 120;
            cible.y = 64;
            cible.rayon = 5;
            cible.gmm = 3.;
            
            // POS CORPS
            corps_1.x = 64;
            corps_1.y = 32;
            corps_1.rayon = 5;
            corps_1.gmm = 3.;
            
            victoire = jeu_1C(&vaisseau ,cible, corps_1);
            
            
        }
    }
}


int jeu_1C(Vaisseau *vaisseau, Corps cible, Corps corps)
{

    while(1){
    
        Bdisp_AllClr_DDVRAM();
        ML_filled_circle(corps.x, corps.y, corps.rayon, ML_BLACK);
        ML_circle(cible.x, cible.y, cible.rayon, ML_BLACK);
        affiche_piaf(*vaisseau);
        Bdisp_PutDisp_DD();
        Sleep(1000);
        
        integre_2C(&vaisseau, cible, corps);
    }
}

void integre_2C(Vaisseau *vaisseau, Corps cible, Corps corps)
{
    double fx, fy;
    double bfx, bfy;
    forceSubie(*vaisseau, cible, &fx, &fy);
    bfx = fx;
    bfy = fy;
    forceSubie(*vaisseau, corps, &fx, &fy);
    fx+=bfx;
    fy+=bfy;
    
    vaisseau->x += fx/2;
    vaisseau->y += fy/2;
    vaisseau->vx += vaisseau->vx+fx/2;
    vaisseau->vy += vaisseau->vy+fy/2;
}

void forceSubie(Vaisseau vaisseau, Corps corps, double *fx, double *fy)
{
    double xSatCorps = (double)(corps.x)-vaisseau.x;
    double ySatCorps = (double)(corps.y)-vaisseau.y;
    double r = sqrt(xSatCorps*xSatCorps+ySatCorps*ySatCorps);
    *fx = xSatCorps*(corps.gmm)/r/r/r;
    *fy = ySatCorps*(corps.gmm)/r/r/r;
}

void affiche_piaf(Vaisseau vaisseau)
{
    double x, y;
    
    x = vaisseau.x;
    y = vaisseau.y;
    
    if (x <1) x = 1.;
    if (x >128) x = 128.;
    if (y <1) y = 1.;
    if (y >64) y = 64.;
    
    Bdisp_SetPoint_VRAM((int)(x+0.5)+1,(int)(y+0.5),1);
    Bdisp_SetPoint_VRAM((int)(x+0.5)-1,(int)(y+0.5),1);
    Bdisp_SetPoint_VRAM((int)(x+0.5),(int)(y+0.5)+1,1);
    Bdisp_SetPoint_VRAM((int)(x+0.5),(int)(y+0.5)-1,1);
}

Le header
Cliquer pour enrouler
// STRUCTURES
typedef struct Corps Corps;
struct Corps
{
    int x;
    int y;
    int rayon;
    double gmm;
};

typedef struct Vaisseau Vaisseau;
struct Vaisseau
{
    double x;
    double y;
    double vx;
    double vy;
    int type;
};

void level(int monde, int niveau);
int jeu_1C(Vaisseau *vaisseau, Corps cible, Corps corps);
void integre_2C(Vaisseau *vaisseau, Corps cible, Corps corps);
void forceSubie(Vaisseau vaisseau, Corps corps, double *fx, double *fy);
void affiche_piaf(Vaisseau vaisseau);

Lephenixnoir Hors ligne Administrateur Points: 24670 Défis: 170 Message

Citer : Posté le 11/05/2014 14:55 | #


À quel niveau est-ce que ça bugge ?
Au pire, teste avec des commentaires pour repérer que fonction plante.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Précédente 1, 2, 3 ··· 7, 8, 9, 10, 11, 12, 13 ··· 20, 21, 22, 23 Suivante

LienAjouter une imageAjouter une vidéoAjouter un lien vers un profilAjouter du codeCiterAjouter un spoiler(texte affichable/masquable par un clic)Ajouter une barre de progressionItaliqueGrasSoulignéAfficher du texte barréCentréJustifiéPlus petitPlus grandPlus de smileys !
Cliquez pour épingler Cliquez pour détacher Cliquez pour fermer
Alignement de l'image: Redimensionnement de l'image (en pixel):
Afficher la liste des membres
:bow: :cool: :good: :love: ^^
:omg: :fusil: :aie: :argh: :mdr:
:boulet2: :thx: :champ: :whistle: :bounce:
valider
 :)  ;)  :D  :p
 :lol:  8)  :(  :@
 0_0  :oops:  :grr:  :E
 :O  :sry:  :mmm:  :waza:
 :'(  :here:  ^^  >:)

Σ π θ ± α β γ δ Δ σ λ
Veuillez donner la réponse en chiffre
Vous devez activer le Javascript dans votre navigateur pour pouvoir valider ce formulaire.

Si vous n'avez pas volontairement désactivé cette fonctionnalité de votre navigateur, il s'agit probablement d'un bug : contactez l'équipe de Planète Casio.

Planète Casio v4.3 © créé par Neuronix et Muelsaco 2004 - 2024 | Il y a 230 connectés | Nous contacter | Qui sommes-nous ? | Licences et remerciements

Planète Casio est un site communautaire non affilié à Casio. Toute reproduction de Planète Casio, même partielle, est interdite.
Les programmes et autres publications présentes sur Planète Casio restent la propriété de leurs auteurs et peuvent être soumis à des licences ou copyrights.
CASIO est une marque déposée par CASIO Computer Co., Ltd