| 
 | 
 
鉴于我是条懒虫,这次也懒得翻译了。。直接拿发在老外那里的东西好了。需要注意的是图片和色板都请用unlz压缩。仅限火红 
Intro: 
In Ruby, many hackers uses the BG0 to make mugshots. However, the same way that simply writing tileset, tilemap and palette to the RAM won't work for FR & EM as it will be cleared by the MSGBOX.  
 
However, there's still a way to do it, which requires the knowledge of "rboxes". I've figured out some simple usage of the related functions, so I will show you my work:  
  
 
The most xxxxing thing should be that only 1 BG palette for FR can be used, which is the palette for the money box (the box with thinner border). Therefore, it will only be able to launch 1 mugshot at a time and you can't use it with the money box!  
 
How to use: 
The routines are provided at the bottom.  
1. Change 0x8900000 in mugshot_make.asm to free space, which is ended in 0,4,8,c. It will be the location of our custom table.  
2. Compile the 2 routines and insert them to some free space (Not the table location in step 1) 
3. Get/draw some 80x80 mugshots, here's 2 examples: 
   
They should be indexed to 16 colors.  
4. Open your UNLZ-GBA and insert your images and palettes.  
Note: the image and the palette should all be LZ77 compressed, which means that you should insert them by using "export image" and "export palette" in UNLZ-GBA. Aparrently they should all be inserted at some free space.  
5. Build the table at the offset in step 1, whose format should be [image0 pointer][image0 pal pointer][image1 pointer][image1 pal pointer][image2 pointer][image2 pal pointer]................... 
It can load up to 65536 images in algorithm, which means that it's enough.  
6. Test time! use  
setvar 0x8004 [image index in the table] 
setvar 0x8005 [0 or 1] // 0 = left, 1 = right 
callasm 0x8[mugshot_make.asm+1]  
to launch the mugshot and  
callasm 0x8[mugshot_del.asm+1] to delete it.  
 
An example:  
I insert the 2 images at 0xFA0000, 0xFA09CC and the 2 palettes at 0xFA09A4, 0xFA1484. Then the table should be:- 00 00 FA 08 A4 09 FA 08 CC 09 FA 08 84 14 FA 08
 
  复制代码 The script:- //---------------
 
 - #org 0xF00000
 
 - lock
 
 - setvar 0x8004 0x0 //image0
 
 - setvar 0x8005 0x1 //right side
 
 - callasm 0x8800001 //mugshot_make.asm+1
 
 - msgbox 0x8F00030 0x6
 
 - callasm 0x8800089 //mugshot_del.asm+1
 
 - release
 
 - end
 
  
- #org 0xF00030
 
 - = ABCD. 
 
  复制代码 The routines:  
mugshot_make.asm- /*
 
 - Note: both image and palette should be LZ77 compressed!
 
 - Table format: [image pointer][pal pointer]..........
 
 - */
 
 - .equiv table_location, 0x8900000
 
 - .thumb
 
 - push {r4-r5, lr}
 
 - sub sp, sp, #0x18
 
 - ldr r0, =0x20370C0
 
 - ldrh r0, [r0, #2]
 
 - mov r1, #0
 
 - mov r2, #0x14
 
 - mul r2, r0
 
 - mov r3, #4
 
 - mov r0, #10
 
 - str r0, [sp]
 
 - str r0, [sp, #4]
 
 - mov r0, #0xD
 
 - str r0, [sp, #8]
 
 - mov r0, #0x40
 
 - str r0, [sp, #0xC]
 
 - add r0, sp, #0x10
 
 - ldr r4, =0x810FE51
 
 - bl bx_r4
 
 - add r0, sp, #0x10
 
 - ldr r4, =0x8003CE5
 
 - bl bx_r4
 
 - ldr r4, =0x2039990
 
 - strb r0, [r4]
 
 - ldr r4, =0x8003FA1
 
 - bl bx_r4
 
 - ldr r0, =0x20370C0
 
 - ldrh r0, [r0]
 
 - ldr r1, =table_location
 
 - lsl r0, r0, #3
 
 - add r0, r0, r1
 
 - ldr r5, [r0, #4]
 
 - ldr r0, [r0]
 
 - ldr r1, =0x6008800
 
 - swi 0x12
 
 - mov r0, r5
 
 - mov r1, #0xd0
 
 - mov r2, #0x20
 
 - ldr r4, =0x80703A9
 
 - bl bx_r4
 
 - mov r0, #0
 
 - ldr r4, =0x80020BD
 
 - bl bx_r4
 
 - add sp, sp, #0x18
 
 - pop {r4-r5, pc}
 
  
- bx_r4: bx r4
 
  复制代码 mugshot_del.asm- .thumb
 
 - push {r4, lr}
 
 - ldr r4, =0x2039990
 
 - ldrb r4, [r4]
 
 - mov r1, #0
 
 - mov r0, r4
 
 - ldr r3, =0x810F4D9
 
 - bl bx_r3
 
 - mov r0, r4
 
 - mov r1, #2
 
 - ldr r3, =0x8003F21
 
 - bl bx_r3
 
 - mov r0, r4
 
 - ldr r3, =0x8003E3D
 
 - bl bx_r3
 
 - pop {r4, pc}
 
  
- bx_r3: bx r3
 
  复制代码 |   
 
 
 
 |