Little endien to Big endien

You must understand the Game Editor concepts, before post here.

Little endien to Big endien

Postby Game A Gogo » Tue Jul 10, 2007 1:32 am

Some of you knows what it is right?

Well, for those who doesn't, Big endien is all natural and beautiful, while little endien is nasty and is a nature disaster...in my opinion xD

In more comprehensive word, Big endien would be normal I.e.: FF3B5A66 would actually be FF3B5A66
But, in revenge, little endien wants to pranks us, he wants to confuse us I.e.: FF3B5A66 would be 665A3BFF, which means, bytes are reversed D:

And I need a code that can take all those byte (four in total, Bytes are two Hexadecimal letters) and transform then into an array of 4 char*?

in other words, I need to flip bytes! (Or digits, or Chars)

Its easy to flip an image, because of course, their are stored into different memory addresses, but what to do when their are stored in one addresses!

I tried doing it myself, but whit no apparent succsess


Code: Select all
void Little_Big(char*Finput)
{
    FILE*output=fopen("data", "w+b");
    FILE*input= fopen("data", "r+b");
    FILE*FIoutput=fopen("sub_data", "w+b");
    FILE*FIinput= fopen("sub_data", "r+b");
    char ByteChk[4];
    char TempChk[4];
    char*Fouput;
    fputs(Finput, output);
    fgets(&ByteChk[0], 1, input);
    fgets(&ByteChk[1], 1, input);
    fgets(&ByteChk[2], 1, input);
    fgets(&ByteChk[3], 1, input);
    TempChk[0]=ByteChk[0];
    TempChk[1]=ByteChk[1];
    TempChk[2]=ByteChk[2];
    TempChk[3]=ByteChk[3];
    ByteChk[0]=TempChk[3];
    ByteChk[1]=TempChk[2];
    ByteChk[2]=TempChk[1];
    ByteChk[3]=TempChk[0];
    fputs(&ByteChk[0], FIoutput);
    fputs(&ByteChk[1], FIoutput);
    fputs(&ByteChk[2], FIoutput);
    fputs(&ByteChk[3], FIoutput);
    fclose(FIoutput);
    fgets(Fouput, 4, FIinput);
    fclose(output);
    fclose(input);
    fclose(FIoutput);
    fclose(FIinput);
    strcpy(text, Fouput);
}


PLEASE HELP!!!!!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Sorry gogo!

Postby kyensoftware » Tue Jul 10, 2007 6:50 am

Sorry gogo, cannot help you flip them here.
I can do it with 6502 (c64, NES, etc.), ARM7 (NDS 1st processor) and ARM9 (DS 2nd processor) instruction sets in assembly.
I cannot do X86 flipping in ASM or C. Sorry.
I will try recover my ASM so you can have a look!
Games for Windows, Linux, and PPC
Bin dosnt stand for "Binary";
it stands for Bin.
You know, where the junk goes...
User avatar
kyensoftware
 
Posts: 198
Joined: Thu Oct 26, 2006 7:49 am
Score: 5 Give a positive score

Postby Game A Gogo » Tue Jul 10, 2007 2:15 pm

its ok, lets just hope someone will
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: Little endien to Big endien

Postby Sgt. Sparky » Tue Jul 10, 2007 4:53 pm

Game A Gogo wrote:Some of you knows what it is right?

Well, for those who doesn't, Big endien is all natural and beautiful, while little endien is nasty and is a nature disaster...in my opinion xD

In more comprehensive word, Big endien would be normal I.e.: FF3B5A66 would actually be FF3B5A66
But, in revenge, little endien wants to pranks us, he wants to confuse us I.e.: FF3B5A66 would be 665A3BFF, which means, bytes are reversed D:

And I need a code that can take all those byte (four in total, Bytes are two Hexadecimal letters) and transform then into an array of 4 char*?

in other words, I need to flip bytes! (Or digits, or Chars)

Its easy to flip an image, because of course, their are stored into different memory addresses, but what to do when their are stored in one addresses!

I tried doing it myself, but whit no apparent succsess


Code: Select all
void Little_Big(char*Finput)
{
    FILE*output=fopen("data", "w+b");
    FILE*input= fopen("data", "r+b");
    FILE*FIoutput=fopen("sub_data", "w+b");
    FILE*FIinput= fopen("sub_data", "r+b");
    char ByteChk[4];
    char TempChk[4];
    char*Fouput;
    fputs(Finput, output);
    fgets(&ByteChk[0], 1, input);
    fgets(&ByteChk[1], 1, input);
    fgets(&ByteChk[2], 1, input);
    fgets(&ByteChk[3], 1, input);
    TempChk[0]=ByteChk[0];
    TempChk[1]=ByteChk[1];
    TempChk[2]=ByteChk[2];
    TempChk[3]=ByteChk[3];
    ByteChk[0]=TempChk[3];
    ByteChk[1]=TempChk[2];
    ByteChk[2]=TempChk[1];
    ByteChk[3]=TempChk[0];
    fputs(&ByteChk[0], FIoutput);
    fputs(&ByteChk[1], FIoutput);
    fputs(&ByteChk[2], FIoutput);
    fputs(&ByteChk[3], FIoutput);
    fclose(FIoutput);
    fgets(Fouput, 4, FIinput);
    fclose(output);
    fclose(input);
    fclose(FIoutput);
    fclose(FIinput);
    strcpy(text, Fouput);
}


PLEASE HELP!!!!!

I will make a text flipping function. :D it will be similar to my text reversing function, I will just make it so you can select to reverse the text between to points on one address. :D
EDIT: nevermind, I will make one that is specailly for what you want to do. (I got confused previously on what you wanted to do.)
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Sgt. Sparky » Tue Jul 10, 2007 7:36 pm

Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest