The PokéCommunity Forums Fan Games ROM Hacking
[ARCHIVE] Simple Questions (SEARCH BEFORE ASKING A QUESTION)

ROM Hacking Need a helping hand? You can get help on any ROM Hacking-related problems or questions you have here.

Closed Thread
 
Thread Tools
  #14626    
Old May 25th, 2010 (4:25 PM).
Diegoisawesome's Avatar
Diegoisawesome Diegoisawesome is offline
Oh god the bees
 
Join Date: Dec 2007
Location: :noitacoL
Age: 21
Gender: Male
Nature: Naive
Posts: 1,046
Quote:
Originally Posted by Team Fail View Post
Bumping this again. I really want to insert my possible firstly-looped song. Me thinks it may have to do with some new .OCX files I installed.
Do you have all of MID2AGB's files in the same folder as Sappy? If not, get them.
__________________


My other resources:
My Website
diegoisawesome's MEGA-HUGE XSE Scripting Tutorial
diegoisawesome's Miscellaneous Finds
The Ruins of Alph Puzzles
Diego's Miscellaneous Patches
GBA Intro Manager
The Secret Sauce: Triple-Layer Tiles
  #14627    
Old May 25th, 2010 (4:48 PM). Edited May 25th, 2010 by dustination.
dustination's Avatar
dustination dustination is offline
     
    Join Date: Jul 2009
    Gender: Male
    Posts: 9
    Quote:
    You need to change the way that the tiles are arranged. Try clicking "View > Block Size > Custom..." and then set both the number of Columns and Rows to 8. Also, I think the address is actually 0x39DC14, which is one tile (0x20 bytes) forward from 0x39DBF4.

    Yes! It worked! Thank you!
    __________________
    Don't underestimate the PODS
      #14628    
    Old May 26th, 2010 (11:00 AM).
    Neox-Storm Neox-Storm is offline
       
      Join Date: May 2008
      Gender:
      Posts: 6
      Is there any way to completely wipe out the tile set in Firered, automatically?

      Not the tileset as in the one I can open up in MS Paint, but the one
      I use when I'm laying out the tiles on the town map.
        #14629    
      Old May 26th, 2010 (2:35 PM).
      NikoBelic999's Avatar
      NikoBelic999 NikoBelic999 is offline
      Friendly Hometown Mugger....XD
         
        Join Date: Feb 2010
        Location: STRANGER DANGER! STALKER! We dont have to know that, now do we?
        Gender: Male
        Nature: Brave
        Posts: 136
        There is something wrong with my Ruby Rom that I was changing in Advanced Map...

        "The Position MapBankHeader can't be found!"

        "AdvanceMapError(1) Try to Read at 0!"

        "AdvanceMapError(5): The Value at $000000 is not a pointer!"

        What does this mean?
        __________________


        Machamp (カイリキ Fighting)
        Species: Superpower Pokemon
        Height: 5'03" (1.6 m)
        Weight: 286.6 (130.0 kg)


          #14630    
        Old May 26th, 2010 (3:01 PM).
        NikoBelic999's Avatar
        NikoBelic999 NikoBelic999 is offline
        Friendly Hometown Mugger....XD
           
          Join Date: Feb 2010
          Location: STRANGER DANGER! STALKER! We dont have to know that, now do we?
          Gender: Male
          Nature: Brave
          Posts: 136
          Just a plain Base, nothing added to it other than the maps...
          __________________


          Machamp (カイリキ Fighting)
          Species: Superpower Pokemon
          Height: 5'03" (1.6 m)
          Weight: 286.6 (130.0 kg)


            #14631    
          Old May 26th, 2010 (3:16 PM).
          Neox-Storm Neox-Storm is offline
             
            Join Date: May 2008
            Gender:
            Posts: 6
            Quote:
            Originally Posted by Team Fail View Post
            All you do is make a new tilemap, and overwrite the old one. No need to delete it.
            I'm pretty OCD about my workplace.

            I like to keep things neat so I can find them easily.
            And we actually plan to use absolutely 0 tiles in the game.

            Plus, when I went to write the pallete changes to the ROM it screwed up
            all the games tiles. (Like it always does) And I think its messing with the ones
            I inserted, so I think ridding myself of the other tiles might fix it.
              #14632    
            Old May 26th, 2010 (3:44 PM).
            Neox-Storm Neox-Storm is offline
               
              Join Date: May 2008
              Gender:
              Posts: 6
              I'm not gonna lie. I have no idea what that means.


              I'm the just the spriter/tile guy on my team. Other then that, I have
              no knowledge of Rom hacking for the most part.
                #14633    
              Old May 26th, 2010 (4:18 PM).
              altariaking's Avatar
              altariaking altariaking is offline
              Needs NO VMs...
                 
                Join Date: Dec 2009
                Location: Scotland, Lesmahagow
                Age: 44
                Gender: Male
                Nature: Naive
                Posts: 1,098
                i removed the sethealingplace script from the players bedroom accidently when inserting a level script, so i tried to transfer it back from another rom.
                now, however, when i die i'm warped to cinnabar gym, just beside blaine.
                sum1 hlp pls!!
                __________________
                http://www.pokecommunity.com/member.php?u=253113
                  #14634    
                Old May 26th, 2010 (6:12 PM).
                BlitŻ's Avatar
                BlitŻ BlitŻ is offline
                guahh my dog is so cute
                 
                Join Date: Feb 2009
                Location: Bay Area, Califronia.
                Age: 23
                Gender: Male
                Nature: Jolly
                Posts: 472
                I want to change the music in the Oak intro. :F As I have heard, everything about it is in ASM, which makes me even more frustrated, as I have no experience in that. I was thinking I could just replace the song that it uses with another song, but the song I want is a song that is already in the game (Fire red, i mean) Any ideas how I would go about changing it? Maybe a byte somewhere?
                __________________
                  #14635    
                Old May 27th, 2010 (4:53 AM).
                Weird's Avatar
                Weird Weird is offline
                Lazy Guy
                   
                  Join Date: May 2009
                  Location: Germany
                  Age: 24
                  Gender: Male
                  Nature: Relaxed
                  Posts: 67
                  I edited some trainers and wild encounters in Soulsilver with PPRE. Everything went well, but when I edited the Union Cave the changes disappear once I play the game. It just resets the encounters on Rattata and resets the levels of trainers, too. Is there a way to avoid this?
                  __________________
                    #14636    
                  Old May 27th, 2010 (7:13 AM).
                  Binary's Avatar
                  Binary Binary is offline
                  え?
                     
                    Join Date: Aug 2007
                    Age: 24
                    Posts: 3,992
                    @Weird:
                    It may be a glitch in the tool. Contact the maker of the tool.
                    __________________
                      #14637    
                    Old May 27th, 2010 (6:29 PM).
                    colcolstyles's Avatar
                    colcolstyles colcolstyles is offline
                    Yours truly
                     
                    Join Date: May 2008
                    Location: The Bay Area
                    Gender: Male
                    Nature: Lonely
                    Posts: 1,590
                    Quote:
                    Originally Posted by Team Fail View Post
                    Besides Hex Workshop, because my 30 day limit has been hit, what is a good hex editor that can load .tbl files?
                    WindHex works for me. Transhexlation can load .tbl files but, for me at least, it crashes every time I try to use the "search using table" feature.
                    __________________

                    Brother of Vrai
                      #14638    
                    Old May 27th, 2010 (6:54 PM).
                    Zeffy's Avatar
                    Zeffy Zeffy is offline
                    g'day
                     
                    Join Date: Apr 2009
                    Gender: Male
                    Posts: 6,404
                    Quote:
                    Originally Posted by Team Fail View Post
                    Besides Hex Workshop, because my 30 day limit has been hit, what is a good hex editor that can load .tbl files?
                    Translhextion, Windhex, HxD are a few free ones. I'm not really sure about HxD though, I haven't loaded any .tbl files on it yet. >.<
                    __________________
                      #14639    
                    Old May 28th, 2010 (12:08 PM).
                    Bigdog Bigdog is offline
                       
                      Join Date: Oct 2008
                      Gender:
                      Posts: 276
                      How do i go about changing the Pokemon sprites in the GSC generation?
                        #14640    
                      Old May 28th, 2010 (12:37 PM).
                      Sawakita's Avatar
                      Sawakita Sawakita is offline
                      Not Invented Here
                         
                        Join Date: May 2010
                        Gender: Male
                        Posts: 180
                        Quote:
                        Originally Posted by Bigdog View Post
                        How do i go about changing the Pokemon sprites in the GSC generation?
                        If you mean compressed sprite, there's AGIXP. for overworld sprite (uncompressed sprites) you can use any tile editor (tilemolester, tile editor pro..)

                        btw: How do i go about changing the Pokemon (compressed) sprites in the RBY generation?
                        __________________



                        | 1st Gen Hacking: Useful Links | A good example of REAL ROM Hacking |
                          #14641    
                        Old May 28th, 2010 (1:07 PM).
                        Bigdog Bigdog is offline
                           
                          Join Date: Oct 2008
                          Gender:
                          Posts: 276
                          Quote:
                          Originally Posted by Sawakita View Post
                          If you mean compressed sprite, there's AGIXP. for overworld sprite (uncompressed sprites) you can use any tile editor (tilemolester, tile editor pro..)

                          btw: How do i go about changing the Pokemon (compressed) sprites in the RBY generation?
                          I mean the actual pokemon in the game as well as the trainers'.

                          I know it's possible since a silver hack based on Ruby was beginning to have been developed.
                            #14642    
                          Old May 28th, 2010 (1:22 PM).
                          Jacusiek's Avatar
                          Jacusiek Jacusiek is offline
                             
                            Join Date: Apr 2009
                            Location: Poland
                            Age: 23
                            Gender: Male
                            Nature: Quiet
                            Posts: 18
                            Hi! I have a problem! When I try to hack HG or SS and try to use program (from Swampert Tools Schowcase) to edit pokemons, atacks, gyms, etc. it crashes. Every program I use to edit Heart Gold or Soul Silver crashes. What's the problem (The crash message: Unsupported room)? Please, help me.
                              #14643    
                            Old May 28th, 2010 (1:22 PM).
                            Sawakita's Avatar
                            Sawakita Sawakita is offline
                            Not Invented Here
                               
                              Join Date: May 2010
                              Gender: Male
                              Posts: 180
                              Agixp works well with pokemon in gsc. For trainers' I don' know any solution other than using ASM

                              -------------------------------------------

                              I repost my question for the new page

                              Quote:
                              Originally Posted by Sawakita View Post

                              do you know how to turn an image (.gif or .jpg or .png) like this
                              Attachment 54206
                              into hexcode like this
                              (hexcode of compressed image of "bulbasaur")
                              Spoiler:
                              557D 3C25 4CDF AAE5 3C0A 9A55 56CA
                              5052 97FF 5385 B429 27EB 9622 157A 3093
                              0BF5 AB74 6048 9092 7FE9 2962 6F48 51B2
                              25B7 8204 8811 A2D6 A308 C2A8 12B0 B5E0
                              8626 25B5 0530 9CB8 A6A2 671E 0812 D08B
                              A496 3182 38E2 2088 8D11 4E55 F52A 3A5A
                              314C 3B90 4861 4E48 88C2 74A6 D148 5918
                              DD4A 8B7E 2D08 6306 A14C 1068 8A08 B52A
                              21B5 A220 8148 759A 2152 174C 1252 EA16
                              2621 FF25 A236 18B7 6962 7414 D60B 858C
                              5614 D392 193B 7EA3 8204 8816 681C 9626
                              308E 3541 D48E 50F2 5E0A 0495 8A4E 1C70
                              E782 0B46 19A5 4652 2637 B696 41C6 2A25
                              1504


                              I found a program written in C that decompress front&back pics from pokemon red
                              Spoiler:

                              Code:
                              #include <stdio.h>
                              #include <stdlib.h>
                              #include <string.h>
                              
                              ///// Necessary Structures
                              
                              #define WIDTHBYTES(w,bpp)  (((w*bpp+31)>>5)<<2)
                              
                              #ifdef BIGENDIAN
                              #define SWAPWORD(a) \
                                 ((WORD) ((((a)>>8)&0x00FF))\
                                        |((((a)<<8)&0xFF00)))
                              #define SWAPDWORD(a) \
                                ((DWORD) ((((a)>>24)&0x000000FF))\
                                        |((((a)>>8) &0x0000FF00))\
                                        |((((a)<<8) &0x00FF0000))\
                                        |((((a)<<24)&0xFF000000)))
                              #else
                              #define SWAPWORD(a)  a
                              #define SWAPDWORD(a)  a
                              #endif
                              
                              typedef unsigned char BYTE;
                              typedef unsigned short WORD;
                              typedef unsigned long DWORD;
                              typedef signed long LONG;
                              typedef int BOOL;
                              
                              #define TRUE 1
                              #define FALSE 0
                              
                              #pragma pack(1)
                              typedef struct tagBITMAPINFOHEADER {
                                 DWORD  biSize; 
                                 LONG   biWidth; 
                                 LONG   biHeight; 
                                 WORD   biPlanes; 
                                 WORD   biBitCount;
                                 DWORD  biCompression; 
                                 DWORD  biSizeImage; 
                                 LONG   biXPelsPerMeter; 
                                 LONG   biYPelsPerMeter; 
                                 DWORD  biClrUsed; 
                                 DWORD  biClrImportant; 
                              } BITMAPINFOHEADER; 
                              
                              
                              typedef struct tagBITMAPFILEHEADER {
                                WORD    bfType; 
                                DWORD   bfSize; 
                                WORD    bfReserved1; 
                                WORD    bfReserved2; 
                                DWORD   bfOffBits; 
                              } BITMAPFILEHEADER; 
                              #pragma pack()
                              
                              /////  GB Graphics to Bitmap Files
                              
                              void GbSetTile(
                               BYTE *tile,
                               BYTE *data,
                               DWORD stride,
                               BYTE clrOrigin
                              ){
                               int y;
                               BYTE k1,k2;
                               BYTE * bits;
                               for(y=0;y<8;y++){
                                k1=tile[2*y];
                                k2=tile[2*y+1];
                                bits=data+y*stride;
                                bits[0]=clrOrigin|((k1&0x80)>>7)|((k2&0x80)>>6);
                                bits[1]=clrOrigin|((k1&0x40)>>6)|((k2&0x40)>>5);
                                bits[2]=clrOrigin|((k1&0x20)>>5)|((k2&0x20)>>4);
                                bits[3]=clrOrigin|((k1&0x10)>>4)|((k2&0x10)>>3);
                                bits[4]=clrOrigin|((k1&0x08)>>3)|((k2&0x08)>>2);
                                bits[5]=clrOrigin|((k1&0x04)>>2)|((k2&0x04)>>1);
                                bits[6]=clrOrigin|((k1&0x02)>>1)|((k2&0x02)   );
                                bits[7]=clrOrigin|((k1&0x01)   )|((k2&0x01)<<1);
                               }
                              }
                              
                              void SaveGbBitmapTiles(
                                char *filename,
                                BYTE *buffer,
                                DWORD sz,
                                DWORD cxTile,
                                DWORD cyTile,
                                BOOL orient // TRUE - ltr/utd; FALSE - utd/ltr
                              ){
                               int i;
                               DWORD xx=0,yy=0;
                               BITMAPINFOHEADER *ret;
                               BITMAPFILEHEADER bfh;
                               FILE *h;
                               BYTE *bits;
                               DWORD stride;
                               DWORD neededsz;
                               DWORD numtiles=cxTile*cyTile;
                               LONG width=cxTile*8;
                               LONG height=cyTile*8;
                               DWORD bminfo;
                               BYTE *ctbl;
                               bminfo=sizeof(BITMAPINFOHEADER)+1024;//header and palette
                               stride=WIDTHBYTES(width,8);
                               neededsz=bminfo+stride*height; //add image size
                               ret=malloc(neededsz);
                               if(!ret)return;
                               memset(ret,0,neededsz);
                               ret->biSize=sizeof(BITMAPINFOHEADER);
                               ret->biWidth=width;
                               ret->biHeight=-height;
                               ret->biPlanes=SWAPWORD(1);
                               ret->biBitCount=SWAPWORD(8);
                               ret->biSize=SWAPDWORD(ret->biSize);
                               ret->biWidth=SWAPDWORD(ret->biWidth);
                               ret->biHeight=SWAPDWORD(ret->biHeight);
                               // Calculate color table
                               ctbl=((BYTE*)ret)+sizeof(BITMAPINFOHEADER);
                               ctbl[0]=ctbl[1]=ctbl[2]   =0xFF;
                               ctbl[4]=ctbl[5]=ctbl[6]   =0xAA;
                               ctbl[8]=ctbl[9]=ctbl[10]  =0x55;
                               ctbl[12]=ctbl[13]=ctbl[14]=0x00;
                               // Calculate pointer to image
                               bits=((BYTE*)ret)+bminfo;
                               for(i=0;i<numtiles;i++){
                                BYTE *d=bits+(yy<<3)*stride+(xx<<3);
                                GbSetTile(buffer,d,stride,0);
                                buffer+=16;
                                if(orient){
                                 xx++;if(xx==cxTile){xx=0;yy++;}
                                } else {
                                 yy++;if(yy==cyTile){yy=0;xx++;}
                                }
                               }
                               bfh.bfType='B'|('M'<<8);
                               bfh.bfSize=sizeof(BITMAPFILEHEADER)+neededsz;
                               bfh.bfReserved1=0;
                               bfh.bfReserved2=0;
                               bfh.bfOffBits=sizeof(BITMAPFILEHEADER)+bminfo;
                               bfh.bfType=SWAPWORD(bfh.bfType);
                               bfh.bfSize=SWAPDWORD(bfh.bfSize);
                               bfh.bfOffBits=SWAPDWORD(bfh.bfOffBits);
                               h=fopen(filename,"wb");
                               if(!h)return;
                               fwrite(&bfh,sizeof(BITMAPFILEHEADER),1,h);
                               fwrite(ret,neededsz,1,h);
                               fclose(h);
                               free(ret);
                              }
                              
                              /////  Helper function
                              
                              int xgetc(FILE *f, DWORD o){
                               DWORD sav=ftell(f);
                               int c;
                               fseek(f,o,SEEK_SET);
                               c=getc(f);
                               fseek(f,sav,SEEK_SET);
                               return c;
                              }
                              
                              /////  Graphics compression
                              
                              #define RLC(a) \
                                ( (((a)&0x7F)<<1)|(((a)&0x80)>>7) )
                              
                              #define RRC(a) \
                                ( (((a)&0xFE)>>1)|(((a)&0x01)<<7) )
                              
                              #define SWAP(a) \
                                ( (((a)&0xF0)>>4)|(((a)&0x0F)<<4) )
                              
                              
                              #define SLA(a) \
                                (((a)<<1)&0xFE)
                              
                              #define SLA16(a) \
                                (((a)<<1)&0xFFFE)
                              
                              typedef struct{
                               BYTE *ptr;
                               BYTE cursize1;
                               BYTE cursize2;
                               BYTE size1;
                               BYTE size2;
                               BYTE curbyte;
                               BYTE curbit;
                               BYTE d084;
                               BYTE d085;
                               BYTE d086;
                               BYTE d087;
                               WORD o;
                               WORD pos0;
                               WORD pos1;
                               WORD table1;
                               WORD table2;
                               WORD maxsize;
                               WORD error;
                              } GGCONTEXT;
                              
                              WORD BitMaskTable[]={
                               0x0001,
                               0x0003,
                               0x0007,
                               0x000F,
                               0x001F,
                               0x003F,
                               0x007F,
                               0x00FF,
                               0x01FF,
                               0x03FF,
                               0x07FF,
                               0x0FFF,
                               0x1FFF,
                               0x3FFF,
                               0x7FFF,
                               0xFFFF
                              };
                              BYTE BitTables[4][8]={
                               {0x08,0xC4,0xE6,0x2A,0xF7,0x3B,0x19,0xD5},
                               {0xF7,0x3B,0x19,0xD5,0x08,0xC4,0xE6,0x2A},
                               {0x01,0x32,0x76,0x45,0xFE,0xCD,0x89,0xBA},
                               {0xFE,0xCD,0x89,0xBA,0x01,0x32,0x76,0x45} 
                              };
                              
                              BYTE Tables2[16]={
                               0x00,0x08,0x04,0x0C,0x02,0x0A,0x06,0x0E,
                               0x01,0x09,0x05,0x0D,0x03,0x0B,0x07,0x0F
                              };
                              
                              #define TESTPOS(ggc,x)\
                               if(x>=(ggc)->maxsize){\
                                (ggc)->error=1;\
                                return 0;\
                               }
                              
                              #define NEXTBIT(x) \
                               do{\
                                if(!(--ggc.curbit)){\
                                 ggc.curbyte=xgetc(f,offset+(ggc.o++));\
                                 ggc.curbit=8;\
                                }\
                                ggc.curbyte=RLC(ggc.curbyte);\
                                x=ggc.curbyte&0x01;\
                               }while(0)
                              
                              #define PUTTEMP(tmp) \
                               do{\
                                e=tmp;\
                                switch(ggc.d084){\
                                 case 1:\
                                  e=SLA(e);e=SLA(e);break;\
                                 case 2:\
                                  e=SWAP(e);break;\
                                 case 3:\
                                  e=RRC(e);e=RRC(e);break;\
                                }\
                                TESTPOS(&ggc,ggc.pos0);\
                                ggc.ptr[ggc.pos0]|=e;\
                               }while(0)
                              
                              #define INCPTR  \
                               do{\
                                ggc.cursize2++;\
                                if(ggc.cursize2!=ggc.size2){\
                                 ggc.pos0++;\
                                } else {\
                                 ggc.cursize2=0;\
                                 if(ggc.d084){\
                                  ggc.d084--;\
                                  ggc.pos0=ggc.pos1;\
                                 } else {\
                                  ggc.d084=3;\
                                  ggc.cursize1+=0x08;\
                                  if(ggc.cursize1!=ggc.size1){\
                                   ggc.pos0++;\
                                   ggc.pos1=ggc.pos0;\
                                  } else {\
                                   ggc.cursize1=0;\
                                   if(!(ggc.d085&0x02)){\
                                    ggc.d085^=0x01;\
                                    ggc.d085|=0x02;\
                                    goto label2574;\
                                   } else {\
                                    done=TRUE;\
                                   }\
                                  }\
                                 }\
                                }\
                               }while(0)
                              
                              int GetGraphicsRoutine1(GGCONTEXT *ggc, WORD hl){
                               BYTE b;
                               BYTE tmp,c,d;
                               BOOL d087Old;
                               WORD a;
                               BYTE e;
                               WORD i,j;
                               ggc->cursize1=ggc->cursize2=0;
                               ggc->pos0=ggc->pos1=hl;
                               if(ggc->d087){
                                ggc->table1=0;
                                ggc->table2=1;
                               } else {
                                ggc->table1=2;
                                ggc->table2=3;
                               }
                               e=0;
                               do{
                                do{
                                 BYTE bit;
                                 TESTPOS(ggc,ggc->pos0);
                                 a=b=ggc->ptr[ggc->pos0];
                                 a=SWAP(a)&0x0F;
                                 c=a&0x01;
                                 a>>=1;
                                 bit=(ggc->d087)?(e&0x04):(e&0x01);
                                 if(bit){
                                  a=BitTables[ggc->table2][a];
                                 } else {
                                  a=BitTables[ggc->table1][a];
                                 }
                                 if(!(c&0x01))a=SWAP(a);
                                 a&=0x0F;
                                 e=a;
                                 d=SWAP(a);
                                 a=b&0x0F;
                                 c=a&0x01;
                                 a>>=1;
                                 bit=(ggc->d087)?(e&0x04):(e&0x01);
                                 if(bit){
                                  a=BitTables[ggc->table2][a];
                                 } else {
                                  a=BitTables[ggc->table1][a];
                                 }
                                 if(!(c&0x01))a=SWAP(a);
                                 a&=0x0F;
                                 e=a;
                                 a|=d;
                                 TESTPOS(ggc,ggc->pos0);
                                 ggc->ptr[ggc->pos0]=a;
                                 ggc->pos0+=ggc->size1;
                                 ggc->cursize1+=0x08;
                                }while(ggc->cursize1!=ggc->size1);
                                e=0;
                                ggc->cursize1=0;
                                ggc->cursize2++;
                                if(ggc->cursize2!=ggc->size2){
                                 ggc->pos1++;
                                 ggc->pos0=ggc->pos1;
                                }
                               }while(ggc->cursize2!=ggc->size2);
                               ggc->cursize2=0;
                               return !(ggc->error);
                              }
                              
                              int GetGraphicsRoutine2(GGCONTEXT *ggc){
                               BYTE b;
                               BYTE tmp,c;
                               BOOL d087Old;
                               WORD a;
                               WORD mask,de,hl;
                               BYTE e;
                               WORD i,j;
                               ggc->cursize1=ggc->cursize2=0;
                               ggc->pos0=(ggc->d085&0x01)?0:0x188;
                               ggc->pos1=(ggc->d085&0x01)?0x188:0;
                               GetGraphicsRoutine1(ggc,ggc->pos0);
                               ggc->pos0=(ggc->d085&0x01)?0:0x188;
                               ggc->pos1=(ggc->d085&0x01)?0x188:0;
                               hl=ggc->pos0; 
                               de=ggc->pos1;
                               do{
                                do{
                                 if(ggc->d087){
                                  TESTPOS(ggc,de);
                                  a=ggc->ptr[de];
                                  b=a;
                                  a=SWAP(a)&0x0F;
                                  c=Tables2[a];
                                  c=SWAP(c);
                                  a=b&0x0F;
                                  a=Tables2[a];
                                  a|=c;
                                  ggc->ptr[de]=a;
                                 }
                                 TESTPOS(ggc,hl);
                                 TESTPOS(ggc,de);
                                 a=ggc->ptr[hl++]^ggc->ptr[de];
                                 ggc->ptr[de++]=a;
                                 ggc->cursize2++;
                                }while(ggc->cursize2!=ggc->size2);
                                ggc->cursize2=0;
                                ggc->cursize1+=0x08;
                               }while(ggc->cursize1!=ggc->size1);
                               ggc->cursize1=0;
                               return !(ggc->error);
                              }
                              
                              int GetGraphics(
                               FILE *f,
                               DWORD offset,
                               BYTE *ptr,
                               DWORD sz
                              ){
                               GGCONTEXT ggc;
                               BYTE b;
                               BYTE tmp,c;
                               BOOL d087Old;
                               WORD a;
                               WORD mask,de,hl;
                               BYTE e;
                               WORD i,j;
                               BOOL done=FALSE;
                               BYTE tmpbuf[0x310];
                               ggc.size1=0;
                               ggc.size2=0;
                               ggc.cursize1=0;
                               ggc.cursize2=0;
                               ggc.curbit=1;
                               ggc.d085=0;
                               ggc.d086=1;
                               ggc.d084=3;
                               ggc.d087=0;
                               ggc.pos0=0;
                               ggc.pos1=0;
                               ggc.ptr=tmpbuf;
                               ggc.table1=0;
                               ggc.table2=0;
                               ggc.o=0;
                               ggc.maxsize=0x310;
                               ggc.error=0;
                               ggc.curbyte=xgetc(f,offset+(ggc.o++));
                               if(ggc.curbyte!=0x44
                                &&ggc.curbyte!=0x55
                                &&ggc.curbyte!=0x66
                                &&ggc.curbyte!=0x77)return 0;
                               b=ggc.curbyte;
                               ggc.size1=(b&0x0F)*8;
                               b=SWAP(b);
                               ggc.size2=(b&0x0F)*8;
                               memset(tmpbuf,0,0x310);
                               NEXTBIT(tmp);
                               ggc.d085=tmp;
                              label2574:
                               ggc.pos0=ggc.pos1=(ggc.d085&0x01)?0x188:0;
                               if(ggc.d085&0x02){
                                NEXTBIT(tmp);
                                if(tmp){
                                 NEXTBIT(tmp);
                                 tmp++;
                                }
                                ggc.d086=tmp;
                               }
                               NEXTBIT(tmp);
                               while(!done){
                                if(tmp){
                                 while(1){
                                  NEXTBIT(tmp);
                                  c=tmp;
                                  NEXTBIT(tmp);
                                  tmp|=SLA(c);
                                  if(tmp){
                                   PUTTEMP(tmp);
                                   INCPTR;
                                  } else break;
                                 }
                                }
                                if(done)break;
                                c=0;
                                do{
                                 NEXTBIT(tmp);
                                 if(tmp)c++;
                                }while(tmp);
                                mask=BitMaskTable[c];
                                de=0;
                                c++;
                                do{
                                 NEXTBIT(tmp);
                                 de=tmp|de;
                                 if(--c){
                                  de=SLA16(de);
                                 }
                                }while(c);
                                de+=mask;
                                do{
                                 tmp=0;
                                 PUTTEMP(tmp);
                                 INCPTR;
                                 if(done)break;
                                 de--;
                                 if(de==0){
                                  tmp=1;//to continue upper loop
                                  break;
                                 }  
                                }while(1);
                               }
                               if(ggc.d086==0){
                                GetGraphicsRoutine1(&ggc,0);
                                GetGraphicsRoutine1(&ggc,0x188);
                               } else if(ggc.d086==1){
                                GetGraphicsRoutine2(&ggc);  
                               } else {
                                ggc.pos0=(ggc.d085&0x01)?0:0x188;
                                ggc.pos1=(ggc.d085&0x01)?0x188:0;
                                d087Old=ggc.d087;
                                ggc.d087=0;
                                GetGraphicsRoutine1(&ggc,ggc.pos1);
                                ggc.pos0=(ggc.d085&0x01)?0:0x188;
                                ggc.pos1=(ggc.d085&0x01)?0x188:0;
                                ggc.d087=d087Old;
                                GetGraphicsRoutine2(&ggc);
                               }
                               for(i=0;i<0x188;i++){
                                ptr[(i<<1)]=ggc.ptr[i];
                                ptr[(i<<1)|1]=ggc.ptr[0x188+i];
                               }
                               return !(ggc.error);
                              }
                              
                              int NumberToIndex(BYTE *ord,DWORD len,int n){
                               int i;
                               for(i=0;i<len;i++){
                                if(ord[i]==n)return i;
                               }
                               return -1;
                              }
                              
                              void RedBlueGraphics(FILE *f){
                               int i;
                               BYTE rbpkdx[28];
                               BYTE buffer[1024];
                               BYTE bmp[256];
                               BYTE pb[256];
                               WORD pal[4];
                               BYTE palno;
                               fseek(f,0x41024,SEEK_SET);
                               fread(pb,256,1,f); // read internal order
                               for(i=1;i<=151;i++){
                                DWORD wBack,wFront;
                                WORD bSize;
                                DWORD o1=0x24000;
                                BOOL have=TRUE;
                                DWORD bank;
                                int j=NumberToIndex(pb,0xBE,i)+1;
                                if(i==151){
                                 fseek(f,0x425b,SEEK_SET);
                                } else {
                                 DWORD o=0x383de;
                                 fseek(f,o+((i-1)*28),SEEK_SET);
                                }
                                if(j==0x15){
                                 bank=1;
                                } else if(j==0xB6){
                                 bank=0x0B;
                                } else if(j<0x1F){
                                 bank=0x09;
                                } else if(j<0x4A){
                                 bank=0x0A;
                                } else if(j<0x74){
                                 bank=0x0B;
                                } else if(j<0x99){
                                 bank=0x0C;
                                } else {
                                 bank=0x0D;
                                }
                                o1=(bank-1)<<14;
                                fread(rbpkdx,28,1,f);
                                bSize=rbpkdx[10]&0x0F;
                                wFront=rbpkdx[11]|(rbpkdx[12]<<8);
                                wBack=rbpkdx[13]|(rbpkdx[14]<<8);
                                memset(buffer,0,1024);
                                // Get front graphic
                                have=GetGraphics(f,o1+wFront,buffer,1024);
                                if(!have)continue;
                                sprintf(bmp,"%03d.bmp",i);
                                SaveGbBitmapTiles(bmp,buffer,bSize*bSize*16,bSize,bSize,FALSE);
                                // Get back graphic
                                have=GetGraphics(f,o1+wBack,buffer,1024);
                                sprintf(bmp,"%03db.bmp",i);
                                SaveGbBitmapTiles(bmp,buffer,16*16,4,4,FALSE);
                               }
                              }
                              
                              int main(int argc,char **argv){
                               FILE *f=fopen("red.gb","rb");
                               if(!f){
                                printf("Can't open Pokemon Red English ROM.  Please name the ROM red.gb and try again.\r\n");
                                return 1;
                               }
                               RedBlueGraphics(f);
                               fclose(f);
                               return 0;
                              }

                              but i need to know the reverse process (i.e. compressing).
                              __________________



                              | 1st Gen Hacking: Useful Links | A good example of REAL ROM Hacking |
                                #14644    
                              Old May 28th, 2010 (2:49 PM).
                              Chaos Rush's Avatar
                              Chaos Rush Chaos Rush is offline
                                 
                                Join Date: May 2007
                                Gender: Male
                                Posts: 1,312
                                Is there any tutorial on how to edit map connections for Pokemon Gold? What I mean by map connections is, where they connect.

                                EDIT: And please, don't just give me a link to GoldMap or something. I want to do it with a hex editor.
                                __________________
                                  #14645    
                                Old May 28th, 2010 (3:06 PM).
                                Sawakita's Avatar
                                Sawakita Sawakita is offline
                                Not Invented Here
                                   
                                  Join Date: May 2010
                                  Gender: Male
                                  Posts: 180
                                  i haven't a real solution but here(http://www.datacrystal.org/wiki/Pokemon_Gold:ROM_map#Maps ) you should find something useful
                                  for connections i only know a doc for r/b/y version
                                  Spoiler:
                                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

                                  RGBY Map Headers & Stuff That Goes With It
                                  Version 1.3
                                  -Feel free to distribute this document and/or edit it.
                                  -Try and credit people you get info from and/or write how you updated.

                                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

                                  Things that need adding:
                                  ------------------------
                                  More information about tilesets, and info about what sprites get loaded for
                                  which maps.

                                  Updates:
                                  --------
                                  v1.4 Complete object data info with details about picture id.
                                  v1.3 Edit by Cartmic to include almost completed tileset header information
                                  and Hat's further clarification on what the X/Y Movement of the Connection means.
                                  v1.2: By ubitux: Add some information about connections and distinction between entities (People/Trainers/Items)
                                  v1.11: Typo fixed by Hat: "01 = North" changed to "01 = East". Thanks to IIMarckus for pointing that out.
                                  v1.1: By Hat, minor improvements.
                                  v1.0: Original version typed up by Hat.

                                  Main Credits (Structure Information):
                                  -------------------------------------
                                  [Xeon]
                                  Wrote some stuff about Map Headers and Object Data.
                                  Which this document expands upon, a bit.

                                  [F-Zero] & [Tauwasser]
                                  Wrote a document (in German) explaining how GSC connection data is stored.
                                  RGBY connection data is stored almost the same way, it turns out, so
                                  that helped a great deal. All that is really different is the values you
                                  add the amount of blocks to.
                                  ...............................................................................

                                  Notes:
                                  R/B Pointers to Map Headers: 0x01AE
                                  R/B Map Header Banks: 0xC23D
                                  R/B Pointer to Tileset Headers: 0xC767

                                  Maximum tileset size in VRAM: 6 rows of 16 tiles (9000-95FF)

                                  ...............................................................................

                                  ===============================================================================

                                  Tileset Header Structure (Almost complete)

                                  ===============================================================================

                                  12 bytes per header...

                                  Format:
                                  ~~~~~~~
                                  [1 BYTE: Bank No. of Blocks/Tiles]
                                  [2 BYTES: Pointer to Blocks (-10 for some reason)]
                                  [2 BYTES: Pointer to Tiles]
                                  [7 BYTES:
                                  00 00 00 00 00 00 00
                                  || || || || || || ||
                                  || || || || || || __ Amount of animated tiles.
                                  || || || || || _____ x,y location on tileset of 'Grass' tile
                                  || || || || ________ X,Y Location of 'talking over tiles': East/West
                                  || || || ___________ X,Y Location of 'talking over tiles': North/South 1
                                  || || ______________ X,Y Location of 'talking over tiles': North/south 2
                                  || _________________ Colision Indication - Pointer?
                                  ____________________ Colision Indication - Pointer?]

                                  ===============================================================================

                                  Map Header Structure

                                  ===============================================================================

                                  Explanation:
                                  ~~~~~~~~~~~~
                                  This contains all the data (pointers count as data) to build the map.

                                  Format:
                                  ~~~~~~~
                                  #1: [Tileset Number]
                                  #2: [(Y Size) Map Height]
                                  #3: [(X Size) Map Width]
                                  #4-5: [*2 Bytes*: Pointer to Map]
                                  #6-7: [*2 Bytes*: Pointer to Maps Text Pointers]
                                  #8-9: [*2 Bytes*: Pointer to Maps "Script"]
                                  #10: [Connection Byte]
                                  ?: [*11 Bytes per Connection*, No connections? Straight to "Object Data"!]
                                  Last: [*2 Bytes*: Pointer to Object Data]

                                  ===============================================================================
                                  1) Tileset Numbers
                                  ===============================================================================

                                  The tileset descriptions are copied from a document compiled by Cartmic,
                                  called "Pokemon Red Documents", which may help you with other stuff too.

                                  Unchanged R/B Locations/Tileset No./Tileset Descriptions
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                  C7BE; 00: "Outside"
                                  C7CA; 01: "Ash's House (#1)"
                                  C7D6; 02: "Pokemon Center (#1)"
                                  C7E2; 03: "Viridian Forest"
                                  C7EE; 04: "Ash's House (#2)"
                                  C7FA; 05: "Gym (#1)"
                                  C806; 06: "Pokemon Center (#2)"
                                  C812; 07: "Gym (#2)"
                                  C81E; 08: "House"
                                  C82A; 09: "Museum (#1)"
                                  C836; 0A: "Museum (#2)"
                                  C842; 0B: "Underground Path"
                                  C84E; 0C: "Museum (#3)"
                                  C85A; 0D: "S.S. Anne"
                                  C866; 0E: "Vermilion Port"
                                  C872; 0F: "Pokemon Cemetery"
                                  C87E; 10: "Silph Co."
                                  C88A; 11: "Cave"
                                  C896; 12: "Celadon Mart"
                                  C8A2; 13: "Game Freak HQ"
                                  C8AE; 14: "Lab"
                                  C8BA; 15: "Bike Shop/Cable Center"
                                  C8C6; 16: "Cinnabar Mansion/Power Plant etc"
                                  C8D2; 17: "Indigo Plateau"

                                  NOTE: As you can see there's multiple copies of some tileset headers. They are
                                  literally copies, you only need 1 copy, but you will need to make sure all maps
                                  using that tileset are set to using that tileset number, then you can use the
                                  free space for more tilesets.

                                  ===============================================================================
                                  2 & 3) Map Height (Y) & Width (X)
                                  ===============================================================================

                                  Exactly that, the amount of blocks high and wide the map data is.

                                  ===============================================================================
                                  4 & 5) Map Data Pointer
                                  ===============================================================================

                                  You can use the GoldMap engine for hacking map data quite easily.

                                  The map you walk around on and stuff is stored as block indexes.
                                  A single block consists of 4*4 tiles.

                                  ===============================================================================
                                  6 & 7) Pointer to Maps Text Pointers
                                  ===============================================================================

                                  2 byte pointers to text that is used on that map.

                                  ===============================================================================
                                  8 & 9) Pointer to Maps "Script"
                                  ===============================================================================

                                  ASM used on that map, chances are if there's something on a map you can't find
                                  elsewhere you might easily be able to find it here, using a hex search
                                  function. You can find things like XY positions of Poke Balls and 1-time
                                  only Pokemon.

                                  ===============================================================================
                                  10) Connection Byte
                                  ===============================================================================

                                  Note:
                                  ~~~~~
                                  If this value is 00h it is immediately followed by the Object Data
                                  Pointer, no gap. Repeated list:

                                  Connection Byte:
                                  00 = No Connections
                                  01 = East
                                  02 = West
                                  03 = West + East
                                  04 = South
                                  05 = South + East
                                  06 = South + West
                                  07 = South + West + East
                                  08 = North
                                  09 = North + East
                                  0A = North + West
                                  0B = North + West + East
                                  0C = North + South
                                  0D = North + South + East
                                  0E = North + South + West
                                  0F = North + South + West + East

                                  Connections can be obtained with binary masks:

                                  1. connect_byte & (1 << 3) -> North
                                  2. connect_byte & (1 << 2) -> South
                                  3. connect_byte & (1 << 1) -> West
                                  4. connect_byte & (1 << 0) -> East

                                  You have to respect this order to get the correct list.

                                  ===============================================================================
                                  ?) Connection Data (0-44 bytes, explained in more depth: further down)
                                  ===============================================================================

                                  ===============================================================================
                                  Last) Object Data Pointer
                                  ===============================================================================

                                  The last thing in the Map Header. It points to a bunch of certain stuff that
                                  is stored in similar structures.

                                  Object Data is discussed at the end of this document.
                                  ...............................................................................


                                  ===============================================================================

                                  *** Hacking Connections ***
                                  This will certainly require planning, with no background distractions.
                                  Unless a editor gets built that can hack the connections for RGBY.

                                  ===============================================================================

                                  Explanation:
                                  ~~~~~~~~~~~~
                                  The "Connection Byte" determines how many connections are in this space,
                                  including none at all.

                                  X/Y_Movement_Of_Connection
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~

                                  A X movement is how many map blocks there are to the left of one of your north/south connections.
                                  A Y movement is how many map blocks there are above your west/east connection.

                                  Structure:
                                  ~~~~~~~~~~
                                  #1: [Map Index of Connected Map]
                                  #2-3: [Pointer to "Connection Strip"s Upperleft Block (Connected Map)]
                                  #4-5: [Pointer to "Connection Strip"s Upperleft Block (Current Map)]
                                  #6: ["Bigness"]
                                  #7: [Map Width]
                                  #8: [Y alignment]
                                  #9: [X alignment]
                                  #10-11: [Window]

                                  PKMN Red Example -- Saffron City (Header: 0x509A4) Diagram:
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                  Saffrons need-to-know stats:

                                  Block Height (Y): 12
                                  Block Width (X): 14
                                  Connection Byte: 0F (North + South + West + East)
                                  - - - -
                                  + = current maps border blocks

                                  ++++++++NNNNNNNNNN++++++++
                                  ++++++++NNNNNNNNNN++++++++
                                  ++++++++NNNNNNNNNN++++++++
                                  +++####################+++
                                  +++####################+++
                                  +++####### My #########+++
                                  +++####################+++
                                  WWW####### Name's #####EEE
                                  WWW####################EEE
                                  WWW###### Saffron #####EEE
                                  WWW####################EEE
                                  WWW###### City! #######EEE
                                  WWW####################EEE
                                  WWW####################EEE
                                  WWW####################EEE
                                  WWW####################EEE
                                  +++####################+++
                                  +++####################+++
                                  +++####################+++
                                  +++####################+++
                                  +++####################+++
                                  ++++++++SSSSSSSSSS++++++++
                                  ++++++++SSSSSSSSSS++++++++
                                  ++++++++SSSSSSSSSS++++++++

                                  Connection to Route 5 (to the North)
                                  *Y: 12
                                  *X: 0A
                                  *X_Movement_of_Connection Strip = 5
                                  Map Index: 10
                                  Connection Strip: 4668
                                  Where Connected: C6F0 (C6EB + 5)
                                  "Bigness": 0A
                                  Width: 0A
                                  Y alignment: 23 (12 * 2 - 1)
                                  X alignment: F6 (5 * -2)
                                  Window: C809 (C6E9 + (12 * (0A + 6)))

                                  Connection to Route 6 (to the South)
                                  *Y: 12
                                  *X: 0A
                                  *X_Movement_of_Connection Strip = 5
                                  Map Index: 11
                                  Connection Strip: 4079
                                  Where Connected: C912 (C6EB + ((12 + 3) * (14 + 6)) + 5)
                                  "Bigness": 0A
                                  Width: 0A
                                  Y alignment: 00
                                  X alignment: F6 (5 * -2)
                                  Window: C6F9 (C6EF + 0A)

                                  Connection to Route 7 (to the West)
                                  *Y: 09
                                  *X: 0A
                                  *Y_Movement_of_Connection Strip = 4
                                  Map Index: 12
                                  Connection Strip: 4058
                                  Where Connected: C79E (C6E8 + (14 + 6) * (4 + 3))
                                  "Bigness": 09
                                  Width: 0A
                                  Y alignment: F8 (4 * -2)
                                  X alignment: 13 ((0A * 2) - 1)
                                  Window: C702 (C6EE + (0A * 2))

                                  Connection to Route 8 (to the East)
                                  *Y: 09
                                  *X: 1E
                                  *Y_Movement_of_Connection Strip = 4
                                  Map Index: 13
                                  Connection Strip: 41C6
                                  Where Connected: C7B5 (C6E5 + (14 + 6) * (4 + 4))
                                  "Bigness": 09
                                  Width: 1E
                                  Y alignment: F8 (4 * -2)
                                  X alignment: 00
                                  Window: C70D (C6EF + 1E)

                                  ===============================================================================
                                  #1 : Map Indexes
                                  ===============================================================================

                                  Not included! Download UltraMap, the text file known as "RedEnglish.ini"
                                  contains all the Map Indexes in decimal for R/B, which you'll obviously need
                                  to convert to hex.

                                  ===============================================================================
                                  #2-#3 : "Connection Strip" Location
                                  ===============================================================================

                                  The "connection strip" pointer -- points to the area of the connected map that
                                  is visible when standing before you even enter it. Points to the upperleft
                                  block of the "connection strip".
                                  * connection strip is always 3 blocks wide (E/W connection)
                                  3 blocks high (N/S connection)

                                  ===============================================================================
                                  #4-#5 : Current Map Position
                                  ===============================================================================

                                  This points to the part of the current map (further up in RAM)
                                  that the connection strips upperleft block is placed on the current map.

                                  ____________________
                                  Connection |
                                  Direction | Formula
                                  ___________|_______

                                  North: C6EB + X_Movement_of_Connection Strip

                                  South: C6EB + (Height of Map + 3) * (Width of Map + 6) +
                                  X_Movement_of_Connection Strip

                                  West: C6E8 + (Width of Map + 6) * (Y_Movement_of_"Connection Strip" + 3)

                                  East: C6E5 + (Width of Map + 6) * (Y_Movement_of_"Connection Strip" + 4)

                                  ===============================================================================
                                  #6 : Map "Bigness"
                                  ===============================================================================

                                  North/South Connection = Connected Maps Width
                                  East/West Connection = Connected Maps Height

                                  ===============================================================================
                                  #7 : Map Width
                                  ===============================================================================

                                  The width of the connected map.

                                  ===============================================================================
                                  #8 : Y alignment
                                  ===============================================================================

                                  Relative Y-position of player after entering connected map.

                                  ____________________
                                  Connection |
                                  Direction | Formula
                                  ___________|_______
                                  North: (Height_of_connected_map * 2) - 1
                                  South: 0
                                  West/East: (Y_movement_of_connection_strip_in_blocks * -2)

                                  ===============================================================================
                                  #9 : X alignment
                                  ===============================================================================

                                  Relative X-Position of player after entering connected map.

                                  ____________________
                                  Connection |
                                  Direction | Formula
                                  ___________|_______
                                  North/South: (X_movement_of_connection_strip_in_blocks * -2)
                                  West: (Width_of_connected_map * 2) - 1
                                  East: 0

                                  ===============================================================================
                                  #10-#11 : Window
                                  ===============================================================================

                                  Position of the upper left block after entering the Map.

                                  ____________________
                                  Connection |
                                  Direction | Formula
                                  ___________|_______
                                  Above: C6E9h + Height_of_connected_map * (Width_of_connected_map + 6)
                                  South/East: C6EFh + Width_of_connected_map
                                  West: C6EEh + 2 * Width_of_connected_map
                                  ...............................................................................


                                  ===============================================================================

                                  Object Data: General Structure

                                  ===============================================================================

                                  Object Data
                                  ===========
                                  [Maps Border Tile]
                                  [Number of Warps][Warp Data]
                                  [Number of Signs][Sign Data]
                                  [Number of People/Trainers/Items]
                                  [People Data]
                                  [Trainer Data]
                                  [Item Data]
                                  [Warp-To Data]

                                  Warps:
                                  ------
                                  [Y position][X position][Warp-To Point][Warp-To Map]

                                  Signposts:
                                  ----------
                                  [Y position][X position][Text String Number]

                                  Normal People:
                                  --------------
                                  [Picture Number][Y position + 4][X position + 4]
                                  [Movement 1][Movement 2][Text String Number]

                                  Trainers:
                                  ---------
                                  [Picture Number][Y position + 4][X position + 4]
                                  [Movement 1][Movement 2][Text String Number]
                                  [Trainer Type][Pokemon Set]

                                  Items:
                                  ---------------------
                                  [Picture Number][Y position + 4][X position + 4]
                                  [Movement 1][Movement 2][Text String Number]
                                  [Item Number]

                                  Warp-To Points
                                  --------------
                                  [*2 Bytes*: Event Displacement][Y position][X position]

                                  In order to distinguish People, Trainers and Items, you must use the Text String Number:

                                  text_str_n & (1 << 6) -> Trainer (2 more byte to read, the trainer type and the pokémon set)
                                  text_str_n & (1 << 7) -> Item (just one more byte to read, the item id)

                                  Picture Numbers
                                  ~~~~~~~~~~~~~~~

                                  In order to get the ROM address of the tile relative to an entity
                                  (people/trainers/items), here is the formula to focus on the entity information:

                                  5 * 0x4000 + (0x7b27 + 4 * (picture_id - 1)) % 0x4000

                                  Then the entity information is stored according to this:

                                  [*2 Bytes*: Tile address][Unknown][Bank id]

                                  So then, address = bank_id * 0x4000 + tile_addr % 0x4000

                                  Event Displacement Formula:
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                  C6E3 + ((Map width + 8) * (rows above + 1)) + (X movement + 4)

                                  ###############################################################################
                                  __________________



                                  | 1st Gen Hacking: Useful Links | A good example of REAL ROM Hacking |
                                    #14646    
                                  Old May 29th, 2010 (10:44 AM).
                                  Chaos Rush's Avatar
                                  Chaos Rush Chaos Rush is offline
                                     
                                    Join Date: May 2007
                                    Gender: Male
                                    Posts: 1,312
                                    Quote:
                                    Originally Posted by Sawakita View Post
                                    i haven't a real solution but here(http://www.datacrystal.org/wiki/Pokemon_Gold:ROM_map#Maps ) you should find something useful
                                    for connections i only know a doc for r/b/y version
                                    Spoiler:
                                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

                                    RGBY Map Headers & Stuff That Goes With It
                                    Version 1.3
                                    -Feel free to distribute this document and/or edit it.
                                    -Try and credit people you get info from and/or write how you updated.

                                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

                                    Things that need adding:
                                    ------------------------
                                    More information about tilesets, and info about what sprites get loaded for
                                    which maps.

                                    Updates:
                                    --------
                                    v1.4 Complete object data info with details about picture id.
                                    v1.3 Edit by Cartmic to include almost completed tileset header information
                                    and Hat's further clarification on what the X/Y Movement of the Connection means.
                                    v1.2: By ubitux: Add some information about connections and distinction between entities (People/Trainers/Items)
                                    v1.11: Typo fixed by Hat: "01 = North" changed to "01 = East". Thanks to IIMarckus for pointing that out.
                                    v1.1: By Hat, minor improvements.
                                    v1.0: Original version typed up by Hat.

                                    Main Credits (Structure Information):
                                    -------------------------------------
                                    [Xeon]
                                    Wrote some stuff about Map Headers and Object Data.
                                    Which this document expands upon, a bit.

                                    [F-Zero] & [Tauwasser]
                                    Wrote a document (in German) explaining how GSC connection data is stored.
                                    RGBY connection data is stored almost the same way, it turns out, so
                                    that helped a great deal. All that is really different is the values you
                                    add the amount of blocks to.
                                    ...............................................................................

                                    Notes:
                                    R/B Pointers to Map Headers: 0x01AE
                                    R/B Map Header Banks: 0xC23D
                                    R/B Pointer to Tileset Headers: 0xC767

                                    Maximum tileset size in VRAM: 6 rows of 16 tiles (9000-95FF)

                                    ...............................................................................

                                    ===============================================================================

                                    Tileset Header Structure (Almost complete)

                                    ===============================================================================

                                    12 bytes per header...

                                    Format:
                                    ~~~~~~~
                                    [1 BYTE: Bank No. of Blocks/Tiles]
                                    [2 BYTES: Pointer to Blocks (-10 for some reason)]
                                    [2 BYTES: Pointer to Tiles]
                                    [7 BYTES:
                                    00 00 00 00 00 00 00
                                    || || || || || || ||
                                    || || || || || || __ Amount of animated tiles.
                                    || || || || || _____ x,y location on tileset of 'Grass' tile
                                    || || || || ________ X,Y Location of 'talking over tiles': East/West
                                    || || || ___________ X,Y Location of 'talking over tiles': North/South 1
                                    || || ______________ X,Y Location of 'talking over tiles': North/south 2
                                    || _________________ Colision Indication - Pointer?
                                    ____________________ Colision Indication - Pointer?]

                                    ===============================================================================

                                    Map Header Structure

                                    ===============================================================================

                                    Explanation:
                                    ~~~~~~~~~~~~
                                    This contains all the data (pointers count as data) to build the map.

                                    Format:
                                    ~~~~~~~
                                    #1: [Tileset Number]
                                    #2: [(Y Size) Map Height]
                                    #3: [(X Size) Map Width]
                                    #4-5: [*2 Bytes*: Pointer to Map]
                                    #6-7: [*2 Bytes*: Pointer to Maps Text Pointers]
                                    #8-9: [*2 Bytes*: Pointer to Maps "Script"]
                                    #10: [Connection Byte]
                                    ?: [*11 Bytes per Connection*, No connections? Straight to "Object Data"!]
                                    Last: [*2 Bytes*: Pointer to Object Data]

                                    ===============================================================================
                                    1) Tileset Numbers
                                    ===============================================================================

                                    The tileset descriptions are copied from a document compiled by Cartmic,
                                    called "Pokemon Red Documents", which may help you with other stuff too.

                                    Unchanged R/B Locations/Tileset No./Tileset Descriptions
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    C7BE; 00: "Outside"
                                    C7CA; 01: "Ash's House (#1)"
                                    C7D6; 02: "Pokemon Center (#1)"
                                    C7E2; 03: "Viridian Forest"
                                    C7EE; 04: "Ash's House (#2)"
                                    C7FA; 05: "Gym (#1)"
                                    C806; 06: "Pokemon Center (#2)"
                                    C812; 07: "Gym (#2)"
                                    C81E; 08: "House"
                                    C82A; 09: "Museum (#1)"
                                    C836; 0A: "Museum (#2)"
                                    C842; 0B: "Underground Path"
                                    C84E; 0C: "Museum (#3)"
                                    C85A; 0D: "S.S. Anne"
                                    C866; 0E: "Vermilion Port"
                                    C872; 0F: "Pokemon Cemetery"
                                    C87E; 10: "Silph Co."
                                    C88A; 11: "Cave"
                                    C896; 12: "Celadon Mart"
                                    C8A2; 13: "Game Freak HQ"
                                    C8AE; 14: "Lab"
                                    C8BA; 15: "Bike Shop/Cable Center"
                                    C8C6; 16: "Cinnabar Mansion/Power Plant etc"
                                    C8D2; 17: "Indigo Plateau"

                                    NOTE: As you can see there's multiple copies of some tileset headers. They are
                                    literally copies, you only need 1 copy, but you will need to make sure all maps
                                    using that tileset are set to using that tileset number, then you can use the
                                    free space for more tilesets.

                                    ===============================================================================
                                    2 & 3) Map Height (Y) & Width (X)
                                    ===============================================================================

                                    Exactly that, the amount of blocks high and wide the map data is.

                                    ===============================================================================
                                    4 & 5) Map Data Pointer
                                    ===============================================================================

                                    You can use the GoldMap engine for hacking map data quite easily.

                                    The map you walk around on and stuff is stored as block indexes.
                                    A single block consists of 4*4 tiles.

                                    ===============================================================================
                                    6 & 7) Pointer to Maps Text Pointers
                                    ===============================================================================

                                    2 byte pointers to text that is used on that map.

                                    ===============================================================================
                                    8 & 9) Pointer to Maps "Script"
                                    ===============================================================================

                                    ASM used on that map, chances are if there's something on a map you can't find
                                    elsewhere you might easily be able to find it here, using a hex search
                                    function. You can find things like XY positions of Poke Balls and 1-time
                                    only Pokemon.

                                    ===============================================================================
                                    10) Connection Byte
                                    ===============================================================================

                                    Note:
                                    ~~~~~
                                    If this value is 00h it is immediately followed by the Object Data
                                    Pointer, no gap. Repeated list:

                                    Connection Byte:
                                    00 = No Connections
                                    01 = East
                                    02 = West
                                    03 = West + East
                                    04 = South
                                    05 = South + East
                                    06 = South + West
                                    07 = South + West + East
                                    08 = North
                                    09 = North + East
                                    0A = North + West
                                    0B = North + West + East
                                    0C = North + South
                                    0D = North + South + East
                                    0E = North + South + West
                                    0F = North + South + West + East

                                    Connections can be obtained with binary masks:

                                    1. connect_byte & (1 << 3) -> North
                                    2. connect_byte & (1 << 2) -> South
                                    3. connect_byte & (1 << 1) -> West
                                    4. connect_byte & (1 << 0) -> East

                                    You have to respect this order to get the correct list.

                                    ===============================================================================
                                    ?) Connection Data (0-44 bytes, explained in more depth: further down)
                                    ===============================================================================

                                    ===============================================================================
                                    Last) Object Data Pointer
                                    ===============================================================================

                                    The last thing in the Map Header. It points to a bunch of certain stuff that
                                    is stored in similar structures.

                                    Object Data is discussed at the end of this document.
                                    ...............................................................................


                                    ===============================================================================

                                    *** Hacking Connections ***
                                    This will certainly require planning, with no background distractions.
                                    Unless a editor gets built that can hack the connections for RGBY.

                                    ===============================================================================

                                    Explanation:
                                    ~~~~~~~~~~~~
                                    The "Connection Byte" determines how many connections are in this space,
                                    including none at all.

                                    X/Y_Movement_Of_Connection
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~

                                    A X movement is how many map blocks there are to the left of one of your north/south connections.
                                    A Y movement is how many map blocks there are above your west/east connection.

                                    Structure:
                                    ~~~~~~~~~~
                                    #1: [Map Index of Connected Map]
                                    #2-3: [Pointer to "Connection Strip"s Upperleft Block (Connected Map)]
                                    #4-5: [Pointer to "Connection Strip"s Upperleft Block (Current Map)]
                                    #6: ["Bigness"]
                                    #7: [Map Width]
                                    #8: [Y alignment]
                                    #9: [X alignment]
                                    #10-11: [Window]

                                    PKMN Red Example -- Saffron City (Header: 0x509A4) Diagram:
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    Saffrons need-to-know stats:

                                    Block Height (Y): 12
                                    Block Width (X): 14
                                    Connection Byte: 0F (North + South + West + East)
                                    - - - -
                                    + = current maps border blocks

                                    ++++++++NNNNNNNNNN++++++++
                                    ++++++++NNNNNNNNNN++++++++
                                    ++++++++NNNNNNNNNN++++++++
                                    +++####################+++
                                    +++####################+++
                                    +++####### My #########+++
                                    +++####################+++
                                    WWW####### Name's #####EEE
                                    WWW####################EEE
                                    WWW###### Saffron #####EEE
                                    WWW####################EEE
                                    WWW###### City! #######EEE
                                    WWW####################EEE
                                    WWW####################EEE
                                    WWW####################EEE
                                    WWW####################EEE
                                    +++####################+++
                                    +++####################+++
                                    +++####################+++
                                    +++####################+++
                                    +++####################+++
                                    ++++++++SSSSSSSSSS++++++++
                                    ++++++++SSSSSSSSSS++++++++
                                    ++++++++SSSSSSSSSS++++++++

                                    Connection to Route 5 (to the North)
                                    *Y: 12
                                    *X: 0A
                                    *X_Movement_of_Connection Strip = 5
                                    Map Index: 10
                                    Connection Strip: 4668
                                    Where Connected: C6F0 (C6EB + 5)
                                    "Bigness": 0A
                                    Width: 0A
                                    Y alignment: 23 (12 * 2 - 1)
                                    X alignment: F6 (5 * -2)
                                    Window: C809 (C6E9 + (12 * (0A + 6)))

                                    Connection to Route 6 (to the South)
                                    *Y: 12
                                    *X: 0A
                                    *X_Movement_of_Connection Strip = 5
                                    Map Index: 11
                                    Connection Strip: 4079
                                    Where Connected: C912 (C6EB + ((12 + 3) * (14 + 6)) + 5)
                                    "Bigness": 0A
                                    Width: 0A
                                    Y alignment: 00
                                    X alignment: F6 (5 * -2)
                                    Window: C6F9 (C6EF + 0A)

                                    Connection to Route 7 (to the West)
                                    *Y: 09
                                    *X: 0A
                                    *Y_Movement_of_Connection Strip = 4
                                    Map Index: 12
                                    Connection Strip: 4058
                                    Where Connected: C79E (C6E8 + (14 + 6) * (4 + 3))
                                    "Bigness": 09
                                    Width: 0A
                                    Y alignment: F8 (4 * -2)
                                    X alignment: 13 ((0A * 2) - 1)
                                    Window: C702 (C6EE + (0A * 2))

                                    Connection to Route 8 (to the East)
                                    *Y: 09
                                    *X: 1E
                                    *Y_Movement_of_Connection Strip = 4
                                    Map Index: 13
                                    Connection Strip: 41C6
                                    Where Connected: C7B5 (C6E5 + (14 + 6) * (4 + 4))
                                    "Bigness": 09
                                    Width: 1E
                                    Y alignment: F8 (4 * -2)
                                    X alignment: 00
                                    Window: C70D (C6EF + 1E)

                                    ===============================================================================
                                    #1 : Map Indexes
                                    ===============================================================================

                                    Not included! Download UltraMap, the text file known as "RedEnglish.ini"
                                    contains all the Map Indexes in decimal for R/B, which you'll obviously need
                                    to convert to hex.

                                    ===============================================================================
                                    #2-#3 : "Connection Strip" Location
                                    ===============================================================================

                                    The "connection strip" pointer -- points to the area of the connected map that
                                    is visible when standing before you even enter it. Points to the upperleft
                                    block of the "connection strip".
                                    * connection strip is always 3 blocks wide (E/W connection)
                                    3 blocks high (N/S connection)

                                    ===============================================================================
                                    #4-#5 : Current Map Position
                                    ===============================================================================

                                    This points to the part of the current map (further up in RAM)
                                    that the connection strips upperleft block is placed on the current map.

                                    ____________________
                                    Connection |
                                    Direction | Formula
                                    ___________|_______

                                    North: C6EB + X_Movement_of_Connection Strip

                                    South: C6EB + (Height of Map + 3) * (Width of Map + 6) +
                                    X_Movement_of_Connection Strip

                                    West: C6E8 + (Width of Map + 6) * (Y_Movement_of_"Connection Strip" + 3)

                                    East: C6E5 + (Width of Map + 6) * (Y_Movement_of_"Connection Strip" + 4)

                                    ===============================================================================
                                    #6 : Map "Bigness"
                                    ===============================================================================

                                    North/South Connection = Connected Maps Width
                                    East/West Connection = Connected Maps Height

                                    ===============================================================================
                                    #7 : Map Width
                                    ===============================================================================

                                    The width of the connected map.

                                    ===============================================================================
                                    #8 : Y alignment
                                    ===============================================================================

                                    Relative Y-position of player after entering connected map.

                                    ____________________
                                    Connection |
                                    Direction | Formula
                                    ___________|_______
                                    North: (Height_of_connected_map * 2) - 1
                                    South: 0
                                    West/East: (Y_movement_of_connection_strip_in_blocks * -2)

                                    ===============================================================================
                                    #9 : X alignment
                                    ===============================================================================

                                    Relative X-Position of player after entering connected map.

                                    ____________________
                                    Connection |
                                    Direction | Formula
                                    ___________|_______
                                    North/South: (X_movement_of_connection_strip_in_blocks * -2)
                                    West: (Width_of_connected_map * 2) - 1
                                    East: 0

                                    ===============================================================================
                                    #10-#11 : Window
                                    ===============================================================================

                                    Position of the upper left block after entering the Map.

                                    ____________________
                                    Connection |
                                    Direction | Formula
                                    ___________|_______
                                    Above: C6E9h + Height_of_connected_map * (Width_of_connected_map + 6)
                                    South/East: C6EFh + Width_of_connected_map
                                    West: C6EEh + 2 * Width_of_connected_map
                                    ...............................................................................


                                    ===============================================================================

                                    Object Data: General Structure

                                    ===============================================================================

                                    Object Data
                                    ===========
                                    [Maps Border Tile]
                                    [Number of Warps][Warp Data]
                                    [Number of Signs][Sign Data]
                                    [Number of People/Trainers/Items]
                                    [People Data]
                                    [Trainer Data]
                                    [Item Data]
                                    [Warp-To Data]

                                    Warps:
                                    ------
                                    [Y position][X position][Warp-To Point][Warp-To Map]

                                    Signposts:
                                    ----------
                                    [Y position][X position][Text String Number]

                                    Normal People:
                                    --------------
                                    [Picture Number][Y position + 4][X position + 4]
                                    [Movement 1][Movement 2][Text String Number]

                                    Trainers:
                                    ---------
                                    [Picture Number][Y position + 4][X position + 4]
                                    [Movement 1][Movement 2][Text String Number]
                                    [Trainer Type][Pokemon Set]

                                    Items:
                                    ---------------------
                                    [Picture Number][Y position + 4][X position + 4]
                                    [Movement 1][Movement 2][Text String Number]
                                    [Item Number]

                                    Warp-To Points
                                    --------------
                                    [*2 Bytes*: Event Displacement][Y position][X position]

                                    In order to distinguish People, Trainers and Items, you must use the Text String Number:

                                    text_str_n & (1 << 6) -> Trainer (2 more byte to read, the trainer type and the pokémon set)
                                    text_str_n & (1 << 7) -> Item (just one more byte to read, the item id)

                                    Picture Numbers
                                    ~~~~~~~~~~~~~~~

                                    In order to get the ROM address of the tile relative to an entity
                                    (people/trainers/items), here is the formula to focus on the entity information:

                                    5 * 0x4000 + (0x7b27 + 4 * (picture_id - 1)) % 0x4000

                                    Then the entity information is stored according to this:

                                    [*2 Bytes*: Tile address][Unknown][Bank id]

                                    So then, address = bank_id * 0x4000 + tile_addr % 0x4000

                                    Event Displacement Formula:
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    C6E3 + ((Map width + 8) * (rows above + 1)) + (X movement + 4)

                                    ###############################################################################
                                    Thanks for the document.

                                    Also, I have another question. How do I view level G/S/C level scripts in PKSV? Also how do I find out the offsets?
                                    __________________
                                      #14647    
                                    Old May 29th, 2010 (11:09 AM).
                                    Darksun's Avatar
                                    Darksun Darksun is offline
                                    triple rainbow, yo
                                       
                                      Join Date: Jul 2008
                                      Location: 22nd floor of the Carrot Tower in Setagaya, Tokyo, Japan
                                      Gender: Male
                                      Nature: Relaxed
                                      Posts: 123
                                      Why is my menu like this? :surprised::'(

                                      Spoiler:
                                      __________________

                                        #14648    
                                      Old May 29th, 2010 (11:27 AM).
                                      Chaos Rush's Avatar
                                      Chaos Rush Chaos Rush is offline
                                         
                                        Join Date: May 2007
                                        Gender: Male
                                        Posts: 1,312
                                        Quote:
                                        Originally Posted by Darksun View Post
                                        Why is my menu like this? :surprised::'(

                                        Spoiler:
                                        AdvanceMap probably repointed something to where the data of that blue background box-thingy graphic is located. Since it's a solid color, AdvanceMap probably thought it was free space and repointed data there. What I would do is just find where the graphics are located, then fix it manually with a hex editor.
                                        __________________
                                          #14649    
                                        Old May 29th, 2010 (12:42 PM).
                                        Darksun's Avatar
                                        Darksun Darksun is offline
                                        triple rainbow, yo
                                           
                                          Join Date: Jul 2008
                                          Location: 22nd floor of the Carrot Tower in Setagaya, Tokyo, Japan
                                          Gender: Male
                                          Nature: Relaxed
                                          Posts: 123
                                          Quote:
                                          Originally Posted by Chaos Rush View Post
                                          AdvanceMap probably repointed something to where the data of that blue background box-thingy graphic is located. Since it's a solid color, AdvanceMap probably thought it was free space and repointed data there. What I would do is just find where the graphics are located, then fix it manually with a hex editor.
                                          Thanks! ;) And damn. I've tried searching the forum for a while now, but I can't seem to find out where the graphics are located, and how to fix it with a hex editor.
                                          __________________

                                            #14650    
                                          Old May 29th, 2010 (1:34 PM).
                                          Loaf's Avatar
                                          Loaf Loaf is offline
                                          Just loafing around...
                                             
                                            Join Date: May 2010
                                            Location: New Zealand
                                            Gender: Male
                                            Nature: Calm
                                            Posts: 13
                                            Hello,
                                            I have two questions. The first is, how can I delete a map in the ROM? I tried a method in Advance Map by editing the bank and setting it to -1, but its not working!

                                            Also, everyone appears to distribute their hack as an IPS. Considering all tools are for ROM, how do you create these? Is there a conversion tool or what?
                                            Closed Thread

                                            Quick Reply

                                            Join the conversation!

                                            Create an account to post a reply in this thread, participate in other discussions, and more!

                                            Create a PokéCommunity Account
                                            Thread Tools

                                            Posting Rules
                                            You may not post new threads
                                            You may not post replies
                                            You may not post attachments
                                            You may not edit your posts

                                            BB code is On
                                            Smilies are On
                                            [IMG] code is On
                                            HTML code is Off

                                            Forum Jump


                                            All times are GMT -8. The time now is 10:15 AM.