I was bored the last few days, so I've been working on this.
It's finished, I'm just thinking about adding a few things
I'll make it better once I figure out why the "clz count leading zeroes" instruction freezes...
Real-time World Edit/World Viewer(Indoors and outdoors)
Differences from original RTWE:
*You don't send the message, you copy it..
*When you copy the item hex, it saves it in the code, so you can continue typing or
copying stuff without affecting which item hex you have stored. No need to retype.
*You can also read the hex code of the item directly under you or beside you.
*All these features work outdoors and in the house in every room (the code automatically determines where you're at)
---------------------------------------
Directions:
Real Time World Edit:
First, to select the item hex, type ztXXXX and copy it. XXXX is the item hex you want to use. The default stored hex is 0000, and that will be replaced by whatever hex you've chosen.
Next, stand on the space you want to place an item on, and press L+R+A. The item will appear directly under you. You can also use the dpad to place items beside you with L+R+A+Dpad
If you're in your house and want to place an item on top of another item, type a plus sign after the hex you want to place, like...ztXXXX+
Real Time World Viewer:
To view the hex code of an item, stand above or beside it, and type (and copy)
0x to view the item directly under you
0x+ to view the item one space above you
0x- to view the item one space below you
0x> to view the item one space to the right
0x< to view the item one space to the left
Once you've copied it, simply paste and the item's hex code will be pasted.
Like above, if you want to view the hex code of an item on top of another item (in the house) you must enter a hex code followed by a + sign, like ztXXXX+ and then use the above directions for Real Time World Viewer.
1.0
1.1Code:023FF090 012FFF11 E0000000 00000194 E28F2001 E12FFF12 6801A059 88093004 8B024688 D01A4211 68096881 18C98A83 8B42880B D0384293 42938B82 788BD14E 2B9A2200 3210D100 D1002B98 2B913220 3240D100 D1002B93 468A3280 46F443D1 F83DF000 46434652 422B8B05 8AC2D102 4760530A 7015258A 19093202 240F2303 3901784D 40251C28 28090900 303EDC00 70103809 D4723B01 DC002D09 3D09353E 32027055 D5EB3B01 22004760 3102800A 220F2400 780B250C 2B063101 3329DC00 DB002B35 2B203B05 3B01DC00 40AB4013 3D0418E4 82C4D5EF 7784780C 68C54770 2D05782D 6804DC4B 22A96824 1AA400D2 0B5B6823 0B5268A2 42212420 3B01D100 42212410 3301D100 42212440 3A01D100 42212480 3201D100 D0082D00 DB2E2B00 DC2C2B0F DB2A2A00 DC282A0F 2B10E007 2B50DB25 2A10DA23 2A50DB21 2D00DA1F 3B10DC01 210F3A10 4019240F 4014091B 00490912 025B0164 186402D2 18E418A4 3D016841 2145D40A 434D0109 19496901 2A917F82 2220D102 18890112 476046F7 04000130 021C6DEC 021E3124 021C5C88 021EED6C 021E5328 000079E0 2E340301 00003235 00000000 023FF090 E3520003
Code:023FF090 012FFF11 E0000000 00000194 E28F2001 E12FFF12 6801A059 88093004 8B024688 D01A4211 68096881 18C98A83 8B42880B D0384293 42938B82 788BD14E 2B9A2200 3210D100 D1002B98 2B913220 3240D100 D1002B93 468A3280 46F443D1 F83DF000 46434652 422B8B05 8AC2D102 4760530A 7015258A 19093202 240F2303 3901784D 40251C28 28090900 303EDC00 70103809 D4723B01 DC002D09 3D09353E 32027055 D5EB3B01 22004760 3102800A 220F2400 780B250C 2B063101 3329DC00 DB002B35 2B203B05 3B01DC00 40AB4013 3D0418E4 82C4D5EF 7784780C 68C54770 2D05782D 6804DC4B 22A96824 1AA400D2 0B5B6823 0B5268A2 42212420 3B01D100 42212410 3301D100 42212440 3A01D100 42212480 3201D100 D0082D00 DB2E2B00 DC2C2B0F DB2A2A00 DC282A0F 2B10E007 2B50DB25 2A10DA23 2A50DB21 2D00DA1F 3B10DC01 210F3A10 4019240F 4014091B 00490912 025B0164 186402D2 18E418A4 3D016841 2145D40A 434D0109 19496901 2A917F82 2220D102 18890112 476046F7 04000130 021C7374 021E36A4 021C6210 021EF2EC 021E58A8 000079E0 2E340301 00003235 00000000 023FF090 E3520003
ASM source:
I know I had some horrible coding habits, but...
it was more for shortness of code than readability :P
I experimented with lots of advanced things...
I'll note it soon :] and fix up a few of the routines, they could be smoother and prettier.
Code:@Convert to THUMB @to produce shorter code... add r2, pc, #0x1 bx r2 .thumb adr r0, Code_Data @load IOKeys ldr r1, [r0] add r0, r0, #4 ldrh r1, [r1] mov r8, r1 ldrh r2, [r0,#24] tst r1, r2 beq BeginBranch ldr r1, [r0,#8] ldr r1, [r1] ldrh r3, [r0,#20] add r1, r1, r3 ldrh r3, [r1] ldrh r2, [r0,#26] cmp r3, r2 beq Getitem ldrh r2, [r0,#28] cmp r3, r2 bne End ldrb r3, [r1,#2] mov r2, #0x0 @simulate dpad presses... @Right for > left for < up for + down for - CheckRight: cmp r3, #0x9A bne CheckLeft add r2, #0x10 CheckLeft: cmp r3, #0x98 bne CheckUp add r2, #0x20 CheckUp: cmp r3, #0x91 bne CheckDown add r2, #0x40 CheckDown: cmp r3, #0x93 bne AddTogether add r2, #0x80 AddTogether: mov r10, r1 mvn r1, r2 BeginBranch: mov r12, lr bl RTWE mov r2, r10 mov r3, r8 ldrh r5, [r0,#24] tst r3, r5 bne ShowValue ldrh r2, [r0,#22] strh r2, [r1,r4] bx r12 ShowValue: mov r5, #0x8A strb r5, [r2] add r2, #0x2 add r1, r4 mov r3, #0x3 mov r4, #0xF @algorithm sucks, i'll make it better soon HexToASCII: ldrb r5, [r1,#1] sub r1, #1 mov r0, r5 and r5, r4 lsr r0, #0x4 cmp r0, #0x9 bgt Letters1 add r0, #0x3E Letters1: sub r0, #0x9 strb r0, [r2] sub r3, #1 bmi exit cmp r5, #0x9 bgt Letters2 add r5, #0x3E Letters2: sub r5, #0x9 strb r5, [r2, #1] add r2, #0x2 sub r3, #1 bpl HexToASCII bx r12 Getitem: mov r2, #0 strh r2, [r1] add r1, r1, #2 mov r4, #0 mov r2, #0xF mov r5, #0xC @it's not really ASCII, but... ASCIItoHEX: ldrb r3, [r1] add r1, r1, #0x1 cmp r3, #0x6 bgt SkipThis add r3, r3, #0x29 SkipThis: cmp r3, #0x35 blt SkipThisToo sub r3, r3, #0x5 SkipThisToo: cmp r3, #0x20 bgt Finish sub r3, r3, #0x1 Finish: and r3, r3, r2 lsl r3, r3, r5 add r4, r4, r3 sub r5, r5, #0x4 bpl ASCIItoHEX strh r4, [r0,#22] ldrb r4, [r1] strb r4, [r0,#30] End: bx lr RTWE: ldr r5, [r0,#12] ldrb r5, [r5] cmp r5, #5 bgt exit ldr r4, [r0] ldr r4, [r4] mov r2, #0xA9 lsl r2, #3 sub r4, r2 ldr r3, [r4] @r3 now holds x coordinate lsr r3, #0xD ldr r2, [r4, #8] @r2 now holds y coordinate lsr r2, #0xD @---Dpad check---@ mov r4, #0x20 tst r1, r4 bne Right sub r3, r3, #1 Right: mov r4, #0x10 tst r1, r4 bne Up add r3, r3, #0x1 Up: mov r4, #0x40 tst r1, r4 bne Down sub r2, r2, #0x1 Down: mov r4, #0x80 tst r1, r4 bne None add r2, r2, #0x1 None: cmp r5, #0 beq OutdoorsCheck cmp r3, #0 blt exit cmp r3, #0xF bgt exit cmp r2, #0 blt exit cmp r2, #0xF bgt exit b Continue OutdoorsCheck: cmp r3, #0x10 blt exit cmp r3, #0x50 bge exit cmp r2, #0x10 blt exit cmp r2, #0x50 bge exit Continue: cmp r5, #0 bgt BeginDivision sub r3, #0x10 sub r2, #0x10 BeginDivision: mov r1, #0xF mov r4, #0xF @a little bit of magic Divide1: and r1, r3, r1 lsr r3, #4 Divide2: and r4, r2, r4 lsr r2, #4 lsl r1, #1 lsl r4, #5 lsl r3, #9 lsl r2, #0xB add r4, r1 add r4, r2 add r4, r3 @magically r4 holds offset for our slot ldr r1, [r0,#4] sub r5, #1 bmi Exit mov r1, #0x45 lsl r1, #0x4 mul r5, r1 ldr r1, [r0,#16] add r1, r5 ldrb r2, [r0, #30] cmp r2, #0x91 bne Exit mov r2, #0x20 lsl r2, #0x4 add r1, r2 Exit: mov pc, lr exit: bx r12 .arm Code_Data: IOKeys: .word 0x4000130 Coordinates: .word 0x21C6DEC Map_Begin: .word 0x21E3124 Copied_Text: .word 0x21C5C88 Area_Location: .word 0x21EED6C House_Begin: .word 0x21E5328 Copied_TextOffset: .hword 0x79E0 Item_Storage: .hword 0x0000 RTWE_Activator: .hword 0x301 zt_Activator: .hword 0x2E34 Viewer_Activator: .hword 0x3235 HouseUpperOrLowerLevel: .byte 0x00