More endianness fixes. Now runs both on big and little endian :)
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@27 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
97c2c93537
commit
ec9e5a33d2
10
init.c
10
init.c
@ -345,10 +345,11 @@ void Charger_DAT(void)
|
|||||||
if (read(Handle,&Mot_temporaire,2)!=2)
|
if (read(Handle,&Mot_temporaire,2)!=2)
|
||||||
Erreur(ERREUR_DAT_CORROMPU);
|
Erreur(ERREUR_DAT_CORROMPU);
|
||||||
|
|
||||||
#ifdef __BIG_ENDIAN
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
Mot_temporaire=bswap_16(Mot_temporaire);
|
Mot_temporaire=bswap_16(Mot_temporaire);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
printf("%d Nb Lignes: %x ",Indice,Mot_temporaire);
|
||||||
// On copie ce nombre de lignes dans la table:
|
// On copie ce nombre de lignes dans la table:
|
||||||
Table_d_aide[Indice].Nombre_de_lignes=Mot_temporaire;
|
Table_d_aide[Indice].Nombre_de_lignes=Mot_temporaire;
|
||||||
|
|
||||||
@ -356,10 +357,11 @@ void Charger_DAT(void)
|
|||||||
if (read(Handle,&Mot_temporaire,2)!=2)
|
if (read(Handle,&Mot_temporaire,2)!=2)
|
||||||
Erreur(ERREUR_DAT_CORROMPU);
|
Erreur(ERREUR_DAT_CORROMPU);
|
||||||
|
|
||||||
#ifdef __BIG_ENDIAN
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
Mot_temporaire=bswap_16(Mot_temporaire);
|
Mot_temporaire=bswap_16(Mot_temporaire);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
printf("Taille: %x\n",Mot_temporaire);
|
||||||
// On alloue la mémoire correspondante:
|
// On alloue la mémoire correspondante:
|
||||||
if (!(Table_d_aide[Indice].Debut_de_la_liste=(byte *)malloc(Mot_temporaire)))
|
if (!(Table_d_aide[Indice].Debut_de_la_liste=(byte *)malloc(Mot_temporaire)))
|
||||||
Erreur(ERREUR_MEMOIRE);
|
Erreur(ERREUR_MEMOIRE);
|
||||||
@ -1795,7 +1797,7 @@ int Charger_CFG(int Tout_charger)
|
|||||||
while (read(Handle,&(Chunk.Numero),sizeof(byte))==sizeof(byte))
|
while (read(Handle,&(Chunk.Numero),sizeof(byte))==sizeof(byte))
|
||||||
{
|
{
|
||||||
read(Handle,&(Chunk.Taille),sizeof(word));
|
read(Handle,&(Chunk.Taille),sizeof(word));
|
||||||
#ifdef __BIG_ENDIAN
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
Chunk.Taille=bswap_16(Chunk.Taille);
|
Chunk.Taille=bswap_16(Chunk.Taille);
|
||||||
#endif
|
#endif
|
||||||
switch (Chunk.Numero)
|
switch (Chunk.Numero)
|
||||||
@ -1811,7 +1813,7 @@ int Charger_CFG(int Tout_charger)
|
|||||||
goto Erreur_lecture_config;
|
goto Erreur_lecture_config;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef __BIG_ENDIAN
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
CFG_Infos_touche.Touche=bswap_16(CFG_Infos_touche.Touche);
|
CFG_Infos_touche.Touche=bswap_16(CFG_Infos_touche.Touche);
|
||||||
CFG_Infos_touche.Touche2=bswap_16(CFG_Infos_touche.Touche2);
|
CFG_Infos_touche.Touche2=bswap_16(CFG_Infos_touche.Touche2);
|
||||||
CFG_Infos_touche.Numero=bswap_16(CFG_Infos_touche.Numero);
|
CFG_Infos_touche.Numero=bswap_16(CFG_Infos_touche.Numero);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user