Blah
Free supporter
- 1,924
- Posts
- 12
- Years
- Unknown Island
- Seen Feb 19, 2025
Scrolling Multi-choice boxes
Multiple choice boxes have been a really cool, yet in my opinion, a very unmastered feature in ROM hacks. Most people use JPAN's patch to make multichoice boxes, others edit the existing ones in the ROM. However, it seems like there is no solution for when the multiple choice box needs to hold more than just 8 or so options. Most competent hackers seem to have the last option be something which opens another box. It seems clunky and quite troublesome, so I decided to hack it and make it support scrolling and customization :)
Here are some things which are in some popular hacks which use a work around that can be avoided altogether with this hack:
![[PokeCommunity.com] ASM Resource Thread [PokeCommunity.com] ASM Resource Thread](https://i35.photobucket.com/albums/d178/prossy/20.png)
![[PokeCommunity.com] ASM Resource Thread [PokeCommunity.com] ASM Resource Thread](https://i.imgur.com/7xjCAol.png)
![[PokeCommunity.com] ASM Resource Thread [PokeCommunity.com] ASM Resource Thread](https://i.imgur.com/CnolW43.png)
The hack in action:
How to insert:
Before getting started with the hack there is a little bit of setting up which is required.
You need to set up a table of pointers somewhere in your ROM. This table will be a table of pointers to possible mulitchoice boxes in your ROM. Each pointer in that table will point to a location of another table. The second table will have pointers to 0xFF terminated strings which will appear in your multichoice box. Visually this is what it should look like:
Spoiler:
![[PokeCommunity.com] ASM Resource Thread [PokeCommunity.com] ASM Resource Thread](https://i.imgur.com/oZfTLDB.png)
I suggest first setting up atleast the first table before inserting the actual routine itself.
Once you've configured the above tables, take a look at the routine in the spoilers.
Code:
table:
.word 0x8[Location of your table, do not +1]
Once that's done compile and insert the routine into free word-aligned space!
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
@hook via r1
main:
ldr r4, =(0x20370BA) @var 0x8001
ldrh r4, [r4]
mov r1, #0xA
strh r4, [r5, r1]
ldrsh r0, [r5, r1]
lsl r0, r0, #0x3
ldr r2, malloc
bl linker
ldr r4, =(0x2039A14) @RAM to hold pointer to malloc data
str r0, [r4]
ldr r2, boxProperties
bl linker
mov r6, #0x0
mov r4, #0x0
mov r2, #0xA
ldrsh r0, [r5, r2]
lsl r3, r7, #0x2
mov r10, r3
add r1, SP, #0x18
mov r9, r1
cmp r6, r0
bge loop
ldr r2, table
ldr r1, =(0x20370B8) @var 0x8000
ldrh r1, [r1]
lsl r1, r1, #0x2
add r2, r2, r1
ldr r2, [r2]
mov r8, r2
ldr r0, =(0x80CB974 +1)
bx r0
loop:
ldr r0, =(0x80CB9AE +1)
bx r0
linker:
bx r2
.align 2
table:
.word 0x8[Location of your table, do not +1]
malloc:
.word 0x8002BB0 +1
boxProperties:
.word 0x80CBA7C +1
Now navigate to 080CB94C and insert the following byte changes:
Code:
00 49 08 47 XX XX XX 08
Usage:
So this is a hack of special 0x158. I've essentially fixed the hard coded table read, and removed limitters as well as recoded the size readings to read of a variable instead. So the script usage of this implementation is quite simple, yet there are some complications which arise along the way. I'll talk about those complications later and first describe usage!
Code:
Paramaters:
var 0x8000 = which multichoice box should be shown from the table of multichoice boxes
var 0x8001 = How many options are supposed to be shown
var 0x8004 = leave as 0x0 for expected output. It does more, but don't play with it for now (I'll document it on a later day!).
Return value:
var 0x800D = Which option was selected, where 0x0 is the first option and 0x1 is the second options....ect.
Sample script snipplet.
Code:
#dyn 0x740000
#org @start
lock
faceplayer
msgbox 0x874001B
callstd MSG_NORMAL
setvar 0x8000 0x0 'Use first multichoice box
setvar 0x8001 0x12 ' First box has 18 options
setvar 0x8004 0x0 ' standard
special 0x158
waitspecial
release
end
#org 0x874001B
= Hello here's some tough choices
Note, after the waitspecial command finishes, variable 0x800D will have the selected option's index number inside it. From there you can do your own checks to verify which option the user had selected.
Some usage requirements:
- 0x8004 = 0. Keep it like this for now until I explain it more a later day. You can play with it too if you want, but it will likely cause a game crash.
- The menu does not close unless the "B" button is pressed inplace of an option, OR the last option is selected. FR counters this by having an "EXIT" option as the last option of the multichoice box, and any scripts which use the multichoice box are looped as well. I have a fix for this:
Code:
@ 080CBB84 insert the following byte changes:
@ 00 00 00 00