• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
April 16, 2024, 07:52:16 pm

News:

Use of ePSXe before 2.0 is highly discouraged. Mednafen, RetroArch, and Duckstation are recommended for playing/testing, pSX is recommended for debugging.


Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Darthatron

1
Quote from: ShanaNyx on September 19, 2020, 07:16:40 amSadly... the Editor is locked to the US Version of the Game
Sure i could play the US Rom... but my Friends cant read English very well...
sad
Feel free to reverse engineer the EU version yourself if you want it to be less sad
2
I have no interest in adding Save Editing functionality to AIO at this time
3
FFTA/FFTA2 Hacking / Re: FFTA AIO Editor help
April 28, 2020, 01:59:16 am
That is indeed a repo of a version of a map editor I was working on a few years ago, but some of that code isn't mine. My version was capable of exporting animated gifs of the maps, but I never added the ability to actually edit anything, and it doesn't appear capable of doing so either.

Some of the comments are in Russian which I don't know so they certainly aren't mine. I didn't do a lot of commenting on any of my code actually so it may be difficult to understand it lol

EDIT: I've attached a build of the version I have on a HDD instead of this repo

FFTA_MapViewer.zip
4
Here is a new build of the Text Editor, which has:

  • improved reading compatibility
  • updates the bookmarks without ruining your selection when you save a String
  • displays an approximation of what will show in game

5
New build with a lot more strings added to the bookmarks and some bug fixes. Same rules apply: don't overwrite anything that looks weird and/or is a larger size than the Read Size

https://www.mediafire.com/file/ror5uudmcmiu3mj/FFTA_TextEditor.zip/file

I will probably start working on a way to import full lists of strings all at once rather than just replacing the strings individually.
6


Get it here!
New Version
The latest build

So here it is, after several years of not being touched. It's not perfect, since it can't read every string in the game, but a lot of them work fine. I just wanted to get this out in case I'm unavailable to work on it again...

Currently there is no safe-guards for replacing data that is bigger than the original so please be careful and don't press "Save String" if the "Write Size" is bigger than the "Read Size".

Some strings (in "Other Strings" bookmarks) shouldn't be touched at this stage. LZSS Compressed strings should (mostly) be fine to edit though (this includes Ability Descriptions.) You can toggle LZSS Compression on strings with a Header which can sometimes reduce the size of strings with repeat substrings.

BACK UP YOUR ROM BEFORE USING

There is an XML file in the /Resources folder that tells the bookmarks where to read from. You can add known string tables on there. Hopefully it's self-explanatory

Good luck and happy modding

Let me know when/if you run into problems or have suggestions for future updates.

Currently I am chipping away at getting everything to load/save properly
7
Yo! Recent global events have given me some time over the next few weeks to look into this stuff again, I have managed to find most of the source code for the editor and will see if I can whip up new features or something. What should I work on first?

I'll upload a copy of the source somewhere too in case I go AWOL again, sorry!
8
FFTA/FFTA2 Hacking / Re: Animation pointers
July 09, 2016, 12:54:01 am
I imagine there is some correlation between these index values and some code (or maybe even an unknonw byte??) in a-abilty data?
9
Not unlikely in the distant future. I never really played it much so I don't have any interest in hacking it (bar a few minor things that were requested) Plus, DS was never my forte.

But someone could come around at any moment and do something. That's what happened with me and FFTA.
10
Hahahahaha
Okay I will look into it better. :P
11
Try this one. Only the 4th and 3rd last bytes are different. This will make him use all of Cid's dialogue.
5E 20 31 79 81 42 01 D1 50 24 29 E0 09 29 01 D1
38 24 25 E0 0A 29 01 D1 30 24 21 E0 0D 29 0A D1
50 24 1D E0


Sorry about the confusion. :(
12
This will fix the game breaking mission dialog. Change the bytes at 0x08047978 to:

Original change thay didn't work. Was setting the wrong register. Whoops.
5E 20 31 79 81 42 01 D1 50 24 29 E0 09 29 01 D1
38 24 25 E0 0A 29 01 D1 30 24 21 E0 0D 29 0A D1
02 20 1D E0


Try this one. Only the 4th and 3rd last bytes are different. This will make him use all of Cid's dialogue. Leave the 4th last as 02 to use Hume's.
5E 20 31 79 81 42 01 D1 50 24 29 E0 09 29 01 D1
38 24 25 E0 0A 29 01 D1 30 24 21 E0 0D 29 0A D1
50 24 1D E0


This just adds Llednar into the checks for special characters.

ROM:08047952                 MOVS    R0, R6          ; RAMchar
ROM:08047954                 MOVS    R1, #SpecUnit.Marche ; CharacterID
ROM:08047956                 BL      Unit.CheckSpecificSpecialUnit
ROM:0804795A                 LSLS    R0, R0, #0x18
ROM:0804795C                 CMP     R0, #0
ROM:0804795E                 BEQ     CheckCid
ROM:08047960                 MOVS    R4, #0
ROM:08047962                 B       MissionCompleteText
ROM:08047962 ; END OF FUNCTION CHUNK FOR BattleJustFinished
ROM:08047962 ; ---------------------------------------------------------------------------
ROM:08047964 off_8047964     DCD word_201F514        ; DATA XREF: BattleJustFinished+EE4r
ROM:08047968 off_8047968     DCD OptionsMaybe        ; DATA XREF: BattleJustFinished:loc_8047938r
ROM:0804796C off_804796C     DCD word_201F4FC        ; DATA XREF: BattleJustFinished+EEEr
ROM:08047970 dword_8047970   DCD -0x2050             ; DATA XREF: BattleJustFinished+EF8r
ROM:08047974 off_8047974     DCD byte_201F4F2        ; DATA XREF: BattleJustFinished+F00r
ROM:08047978 ; ---------------------------------------------------------------------------
ROM:08047978 ; START OF FUNCTION CHUNK FOR BattleJustFinished
ROM:08047978
ROM:08047978 CheckCid                                ; CODE XREF: BattleJustFinished+F12j
ROM:08047978                 MOVS    R0, R6          ; RAMchar
ROM:0804797A                 MOVS    R1, #SpecUnit.Cid ; CharacterID
ROM:0804797C                 BL      Unit.CheckSpecificSpecialUnit
ROM:08047980                 LSLS    R0, R0, #0x18
ROM:08047982                 CMP     R0, #0
ROM:08047984                 BEQ     CheckEzel
ROM:08047986                 MOVS    R4, #0x50
ROM:08047988                 B       MissionCompleteText
ROM:0804798A ; ---------------------------------------------------------------------------
ROM:0804798A
ROM:0804798A CheckEzel                               ; CODE XREF: BattleJustFinished+F38j
ROM:0804798A                 MOVS    R0, R6          ; RAMchar
ROM:0804798C                 MOVS    R1, #SpecUnit.Ezel ; CharacterID
ROM:0804798E                 BL      Unit.CheckSpecificSpecialUnit
ROM:08047992                 LSLS    R0, R0, #0x18
ROM:08047994                 CMP     R0, #0
ROM:08047996                 BEQ     CheckBabus
ROM:08047998                 MOVS    R4, #0x30
ROM:0804799A                 B       MissionCompleteText
ROM:0804799C ; ---------------------------------------------------------------------------
ROM:0804799C
ROM:0804799C CheckBabus                              ; CODE XREF: BattleJustFinished+F4Aj
ROM:0804799C                 MOVS    R0, R6          ; RAMchar
ROM:0804799E                 MOVS    R1, #SpecUnit.Babus ; CharacterID
ROM:080479A0                 BL      Unit.CheckSpecificSpecialUnit
ROM:080479A4                 LSLS    R0, R0, #0x18
ROM:080479A6                 CMP     R0, #0
ROM:080479A8                 BEQ     CheckRitz
ROM:080479AA                 MOVS    R4, #0x38
ROM:080479AC                 B       MissionCompleteText
ROM:080479AE ; ---------------------------------------------------------------------------
ROM:080479AE
ROM:080479AE CheckRitz                               ; CODE XREF: BattleJustFinished+F5Cj
ROM:080479AE                 MOVS    R0, R6          ; RAMchar
ROM:080479B0                 MOVS    R1, #SpecUnit.Ritz ; CharacterID
ROM:080479B2                 BL      Unit.CheckSpecificSpecialUnit
ROM:080479B6                 LSLS    R0, R0, #0x18
ROM:080479B8                 CMP     R0, #0
ROM:080479BA                 BEQ     CheckShara
ROM:080479BC                 MOVS    R4, #0x40
ROM:080479BE                 B       MissionCompleteText
ROM:080479C0 ; ---------------------------------------------------------------------------
ROM:080479C0
ROM:080479C0 CheckShara                              ; CODE XREF: BattleJustFinished+F6Ej
ROM:080479C0                 MOVS    R0, R6          ; RAMchar
ROM:080479C2                 MOVS    R1, #SpecUnit.Shara ; CharacterID
ROM:080479C4                 BL      Unit.CheckSpecificSpecialUnit
ROM:080479C8                 LSLS    R0, R0, #0x18
ROM:080479CA                 CMP     R0, #0
ROM:080479CC                 BEQ     NotSpecial
ROM:080479CE                 MOVS    R4, #0x48
ROM:080479D0                 B       MissionCompleteText
ROM:080479D2 ; ---------------------------------------------------------------------------
ROM:080479D2
ROM:080479D2 NotSpecial                              ; CODE XREF: BattleJustFinished+F80j
ROM:080479D2                 LDRB    R0, [R6,#RAM_Unit.Race]
ROM:080479D4                 LSLS    R0, R0, #0x1B
ROM:080479D6                 LSRS    R4, R0, #0x18
13
I'm afraid if I don't do it sooner, rather than later, it would never get done. Ask Eternal ;)

Okay so the (stupid) reason that this is happening is that there is a check to see if the unit is Ezel, Cid, Babus or a guest/enemy and displays the Hume default jobs unless one of those conditions is met. After initially changing that condition (by re-writing the whole function; a 76 byte change) to include Llednar, I realised that the same thing can be achieved by just assuming that one of those conditions in met; a two byte change.

Both changes start at 080C8ECE.

2 byte:
1E E0

76 byte:
FF F7 B7 F9 00 28 1C D1 38 1C FF F7 C2 F9 00 28
17 D1 38 1C 09 21 FF F7 56 F9 00 28 11 D1 38 1C
0A 21 FF F7 50 F9 00 28 0B D1 38 1C 0D 21 FF F7
4A F9 00 28 05 D1 38 1C 5E 21 FF F7 44 F9 00 28
66 D0 38 1C 03 21 FE F7 C6 FF 00 00


Take your pick!

(I feel pretty stupid)
14
ROM:0812F3E6                 CMP     R0, #0x16
ROM:0812F3E8                 BEQ     CheckLlednar
ROM:0812F3EA                 CMP     R0, #0x1A
ROM:0812F3EC                 BNE     Return0

change those 8 bytes to 00 and it will work fine all the time. You'll just need to change those 4 bytes to their original values. Then you can make that byte (0D for Llednar) any index you like.

As for the icon thing, I will look into it tomorrow morning and I am totally exhausted.
15
Could you send me a .SAV (not save state) from inside of the battle with three Llednar's? One an ally. One an enemy. And one a guest. Then I will look into it :)
16
Oh I know what's happening. VBA just duplicates those 0x40000 bytes afterwards, and editing them edits the originals. The actual "Clan Funds" value is stored at 0x02001F64.

I still can't find any references to 02002190 at all, though. Except in a function that is called just before a script is run:

ROM:08121F38 ; =============== S U B R O U T I N E =======================================
ROM:08121F38
ROM:08121F38
ROM:08121F38 sub_8121F38                             ; CODE XREF: Scene.LoadScript+CEp
ROM:08121F38                 PUSH    {LR}
ROM:08121F3A                 LDR     R3, =unk_2002190
ROM:08121F3C                 LDRB    R0, [R3,#(byte_200219C - 0x2002190)]
ROM:08121F3E                 SUBS    R0, #1
ROM:08121F40                 STRB    R0, [R3,#(byte_200219C - 0x2002190)]
ROM:08121F42                 MOVS    R2, #0
ROM:08121F44                 CMP     R2, R0
ROM:08121F46                 BGE     loc_8121F58
ROM:08121F48                 ADDS    R1, R3, #4
ROM:08121F4A
ROM:08121F4A loc_8121F4A                             ; CODE XREF: sub_8121F38+1Ej
ROM:08121F4A                 LDRH    R0, [R1,#2]
ROM:08121F4C                 STRH    R0, [R1]
ROM:08121F4E                 ADDS    R1, #2
ROM:08121F50                 ADDS    R2, #1
ROM:08121F52                 LDRB    R0, [R3,#(byte_200219C - 0x2002190)]
ROM:08121F54                 CMP     R2, R0
ROM:08121F56                 BLT     loc_8121F4A
ROM:08121F58
ROM:08121F58 loc_8121F58                             ; CODE XREF: sub_8121F38+Ej
ROM:08121F58                 LDRB    R0, [R3,#0xC]
ROM:08121F5A                 LSLS    R0, R0, #1
ROM:08121F5C                 ADDS    R1, R3, #4
ROM:08121F5E                 ADDS    R1, R1, R0
ROM:08121F60                 MOVS    R0, #0
ROM:08121F62                 STRH    R0, [R1]
ROM:08121F64                 LDRB    R0, [R3,#0xC]
ROM:08121F66                 CMP     R0, #0
ROM:08121F68                 BNE     loc_8121F74
ROM:08121F6A                 MOVS    R0, #0
ROM:08121F6C                 B       loc_8121F7A
ROM:08121F6C ; ---------------------------------------------------------------------------
ROM:08121F6E                 DCB    0
ROM:08121F6F                 DCB    0
ROM:08121F70 off_8121F70     DCD unk_2002190         ; DATA XREF: sub_8121F38+2r
ROM:08121F74 ; ---------------------------------------------------------------------------
ROM:08121F74
ROM:08121F74 loc_8121F74                             ; CODE XREF: sub_8121F38+30j
ROM:08121F74                 BL      sub_8009FD0
ROM:08121F78                 MOVS    R0, #1
ROM:08121F7A
ROM:08121F7A loc_8121F7A                             ; CODE XREF: sub_8121F38+34j
ROM:08121F7A                 POP     {R1}
ROM:08121F7C                 BX      R1
ROM:08121F7C ; End of function sub_8121F38
ROM:08121F7C
ROM:08121F7C ; ---------------------------------------------------------------------------


But that doesn't even edit that byte. It's actually 0xC bytes after. As far as I can tell, nothing else even touches that byte.

EDIT: Nevermind... It's always referenced as so:
ROM:080CF7FA                 LDR     R1, =WRAM_Base
ROM:080CF7FC                 LDR     R2, =0x2190
ROM:080CF7FE                 ADDS    R0, R1, R2


Very annoying to pin point references.

EDIT 2: I think this will work... Change the 4 bytes at 08130870 to 00 20 00 00

This will make Llednar always killable.

Change the first byte to 01 to make him never killable.

For future reference (Mainly for you, bcrobert)

ROM:0812F3CC ; =============== S U B R O U T I N E =======================================
ROM:0812F3CC
ROM:0812F3CC
ROM:0812F3CC CheckInvulnerability_Llednar            ; CODE XREF: sub_8130868+8p
ROM:0812F3CC                 PUSH    {R4,LR}
ROM:0812F3CE                 MOVS    R4, R0
ROM:0812F3D0                 MOVS    R0, #0xD        ; ID
ROM:0812F3D2                 BL      LoadByte        ; r0 = [02002030 + r0] (byte)
ROM:0812F3D6                 LSLS    R0, R0, #0x18
ROM:0812F3D8                 LSRS    R0, R0, #0x18
ROM:0812F3DA                 CMP     R0, #1
ROM:0812F3DC                 BEQ     Return0
ROM:0812F3DE                 LDR     R0, =WRAM_Base
ROM:0812F3E0                 LDR     R1, =0x2190
ROM:0812F3E2                 ADDS    R0, R0, R1
ROM:0812F3E4                 LDRB    R0, [R0]
ROM:0812F3E6                 CMP     R0, #0x16
ROM:0812F3E8                 BEQ     CheckLlednar
ROM:0812F3EA                 CMP     R0, #0x1A
ROM:0812F3EC                 BNE     Return0
ROM:0812F3EE
ROM:0812F3EE CheckLlednar                            ; CODE XREF: CheckInvulnerability_Llednar+1Cj
ROM:0812F3EE                 MOVS    R0, R4          ; pRAMCharacter
ROM:0812F3F0                 MOVS    R1, #UnitGet_bSpecialIndex ; index
ROM:0812F3F2                 BL      Unit.Get
ROM:0812F3F6                 CMP     R0, #0xD
ROM:0812F3F8                 BNE     Return0
ROM:0812F3FA                 MOVS    R0, #1
ROM:0812F3FC                 B       End
ROM:0812F3FC ; ---------------------------------------------------------------------------
ROM:0812F3FE                 DCB    0
ROM:0812F3FF                 DCB    0
ROM:0812F400 off_812F400     DCD WRAM_Base           ; DATA XREF: CheckInvulnerability_Llednar+12r
ROM:0812F404 dword_812F404   DCD 0x2190              ; DATA XREF: CheckInvulnerability_Llednar+14r
ROM:0812F408 ; ---------------------------------------------------------------------------
ROM:0812F408
ROM:0812F408 Return0                                 ; CODE XREF: CheckInvulnerability_Llednar+10j
ROM:0812F408                                         ; CheckInvulnerability_Llednar+20j ...
ROM:0812F408                 MOVS    R0, #0
ROM:0812F40A
ROM:0812F40A End                                     ; CODE XREF: CheckInvulnerability_Llednar+30j
ROM:0812F40A                 POP     {R4}
ROM:0812F40C                 POP     {R1}
ROM:0812F40E                 BX      R1
ROM:0812F40E ; End of function CheckInvulnerability_Llednar
17
That doesn't seem quite right. Could you link me to that page? WRAM only goes up to 0x203FFFF on the GBA system. But that byte would be very helpful to my research.
18
Law Cards work in a similar fashion to items.
ROM:080D21A8 ; =============== S U B R O U T I N E =======================================
ROM:080D21A8
ROM:080D21A8
ROM:080D21A8 GetRandomBattle_Card                    ; CODE XREF: sub_8045DF4+354p
ROM:080D21A8                                         ; sub_8045DF4+3A0p ...
ROM:080D21A8                 PUSH    {R4-R7,LR}
ROM:080D21AA                 MOV     R7, R9
ROM:080D21AC                 MOV     R6, R8
ROM:080D21AE                 PUSH    {R6,R7}
ROM:080D21B0                 LDR     R0, =0x206      ; flag
ROM:080D21B2                 BL      Flags.Get
ROM:080D21B6                 LSLS    R0, R0, #0x18
ROM:080D21B8                 LSRS    R0, R0, #0x18
ROM:080D21BA                 NEGS    R1, R0
ROM:080D21BC                 ORRS    R1, R0
ROM:080D21BE                 LSRS    R5, R1, #0x1F
ROM:080D21C0                 LDR     R0, =0x209      ; flag
ROM:080D21C2                 BL      Flags.Get
ROM:080D21C6                 LSLS    R0, R0, #0x18
ROM:080D21C8                 CMP     R0, #0
ROM:080D21CA                 BEQ     loc_80D21CE
ROM:080D21CC                 MOVS    R5, #2
ROM:080D21CE
ROM:080D21CE loc_80D21CE                             ; CODE XREF: GetRandomBattle_Card+22j
ROM:080D21CE                 MOVS    R0, 0x20C       ; flag
ROM:080D21D2                 BL      Flags.Get
ROM:080D21D6                 LSLS    R0, R0, #0x18
ROM:080D21D8                 CMP     R0, #0
ROM:080D21DA                 BEQ     loc_80D21DE
ROM:080D21DC                 MOVS    R5, #3
ROM:080D21DE
ROM:080D21DE loc_80D21DE                             ; CODE XREF: GetRandomBattle_Card+32j
ROM:080D21DE                 LDR     R0, =0x211      ; flag
ROM:080D21E0                 BL      Flags.Get
ROM:080D21E4                 LSLS    R0, R0, #0x18
ROM:080D21E6                 CMP     R0, #0
ROM:080D21E8                 BEQ     loc_80D21EC
ROM:080D21EA                 MOVS    R5, #4
ROM:080D21EC
ROM:080D21EC loc_80D21EC                             ; CODE XREF: GetRandomBattle_Card+40j
ROM:080D21EC                 LDR     R0, =0x215      ; flag
ROM:080D21EE                 BL      Flags.Get
ROM:080D21F2                 LSLS    R0, R0, #0x18
ROM:080D21F4                 CMP     R0, #0
ROM:080D21F6                 BEQ     loc_80D21FA
ROM:080D21F8                 MOVS    R5, #5
ROM:080D21FA
ROM:080D21FA loc_80D21FA                             ; CODE XREF: GetRandomBattle_Card+4Ej
ROM:080D21FA                 LDR     R0, =0x21D      ; flag
ROM:080D21FC                 BL      Flags.Get
ROM:080D2200                 LSLS    R0, R0, #0x18
ROM:080D2202                 CMP     R0, #0
ROM:080D2204                 BEQ     loc_80D2208
ROM:080D2206                 MOVS    R5, #6
ROM:080D2208
ROM:080D2208 loc_80D2208                             ; CODE XREF: GetRandomBattle_Card+5Cj
ROM:080D2208                 MOVS    R4, #0
ROM:080D220A                 MOVS    R6, #0
ROM:080D220C                 ADDS    R5, #1
ROM:080D220E                 MOV     R8, R5
ROM:080D2210                 CMP     R6, R8
ROM:080D2212                 BGE     loc_80D2256
ROM:080D2214                 LDR     R0, =LawTable1
ROM:080D2216                 MOV     R9, R0
ROM:080D2218                 LDR     R1, =LawBreakChecksMaybe
ROM:080D221A                 MOV     R12, R1
ROM:080D221C
ROM:080D221C loc_80D221C                             ; CODE XREF: GetRandomBattle_Card+ACj
ROM:080D221C                 ADDS    R4, #1
ROM:080D221E                 LSLS    R0, R6, #2
ROM:080D2220                 ADDS    R7, R6, #1
ROM:080D2222                 ADDS    R0, R0, R6
ROM:080D2224                 LSLS    R0, R0, #3
ROM:080D2226                 MOV     R1, R9
ROM:080D2228                 ADDS    R3, R0, R1
ROM:080D222A                 MOVS    R5, #19
ROM:080D222C
ROM:080D222C loc_80D222C                             ; CODE XREF: GetRandomBattle_Card+A6j
ROM:080D222C                 LDRH    R2, [R3]
ROM:080D222E                 LSLS    R0, R2, #4
ROM:080D2230                 ADD     R0, R12
ROM:080D2232                 LDRH    R1, [R0,#LawData.Flags]
ROM:080D2234                 MOVS    R0, #0x80 ; 'Ç'
ROM:080D2236                 ANDS    R0, R1
ROM:080D2238                 CMP     R0, #0
ROM:080D223A                 BEQ     loc_80D223E
ROM:080D223C                 ADDS    R4, #1
ROM:080D223E
ROM:080D223E loc_80D223E                             ; CODE XREF: GetRandomBattle_Card+92j
ROM:080D223E                 MOVS    R0, #0x40 ; '@'
ROM:080D2240                 ANDS    R0, R1
ROM:080D2242                 CMP     R0, #0
ROM:080D2244                 BEQ     loc_80D2248
ROM:080D2246                 ADDS    R4, #1
ROM:080D2248
ROM:080D2248 loc_80D2248                             ; CODE XREF: GetRandomBattle_Card+9Cj
ROM:080D2248                 ADDS    R3, #2
ROM:080D224A                 SUBS    R5, #1
ROM:080D224C                 CMP     R5, #0
ROM:080D224E                 BGE     loc_80D222C
ROM:080D2250                 MOVS    R6, R7
ROM:080D2252                 CMP     R6, R8
ROM:080D2254                 BLT     loc_80D221C
ROM:080D2256
ROM:080D2256 loc_80D2256                             ; CODE XREF: GetRandomBattle_Card+6Aj
ROM:080D2256                 BL      Rand            ; r0 = random val between 0 and 32767 (0x7FFF)
ROM:080D225A                 LSLS    R0, R0, #0x10
ROM:080D225C                 ASRS    R0, R0, #0x10
ROM:080D225E                 MOVS    R1, R4
ROM:080D2260                 BL      Mod_r0_by_r1    ; r0 = r0 % r1
ROM:080D2264                 MOVS    R3, R0
ROM:080D2266                 MOVS    R6, #0
ROM:080D2268                 CMP     R6, R8
ROM:080D226A                 BGE     loc_80D22F2
ROM:080D226C                 MOV     R12, R6
ROM:080D226E                 LDR     R0, =LawTable1
ROM:080D2270                 MOV     R9, R0
ROM:080D2272
ROM:080D2272 loc_80D2272                             ; CODE XREF: GetRandomBattle_Card+148j
ROM:080D2272                 CMP     R3, #0
ROM:080D2274                 BNE     loc_80D2298
ROM:080D2276                 MOVS    R0, R6
ROM:080D2278                 ADDS    R0, #0xAB ; '½'
ROM:080D227A                 B       loc_80D22D8
ROM:080D227A ; ---------------------------------------------------------------------------
ROM:080D227C ; __int8 off_80D227C
ROM:080D227C off_80D227C     DCD 0x206               ; DATA XREF: GetRandomBattle_Card+8r
ROM:080D2280 ; __int8 off_80D2280
ROM:080D2280 off_80D2280     DCD 0x209               ; DATA XREF: GetRandomBattle_Card+18r
ROM:080D2284 ; __int8 off_80D2284
ROM:080D2284 off_80D2284     DCD 0x211               ; DATA XREF: GetRandomBattle_Card:loc_80D21DEr
ROM:080D2288 ; __int8 off_80D2288
ROM:080D2288 off_80D2288     DCD 0x215               ; DATA XREF: GetRandomBattle_Card:loc_80D21ECr
ROM:080D228C ; __int8 off_80D228C
ROM:080D228C off_80D228C     DCD 0x21D               ; DATA XREF: GetRandomBattle_Card:loc_80D21FAr
ROM:080D2290 off_80D2290     DCD LawTable1           ; DATA XREF: GetRandomBattle_Card+6Cr
ROM:080D2290                                         ; GetRandomBattle_Card+C6r
ROM:080D2294 off_80D2294     DCD LawBreakChecksMaybe ; DATA XREF: GetRandomBattle_Card+70r
ROM:080D2298 ; ---------------------------------------------------------------------------
ROM:080D2298
ROM:080D2298 loc_80D2298                             ; CODE XREF: GetRandomBattle_Card+CCj
ROM:080D2298                 SUBS    R3, #1
ROM:080D229A                 MOVS    R5, #0
ROM:080D229C                 LDR     R7, =LawBreakChecksMaybe
ROM:080D229E                 MOV     R4, R12
ROM:080D22A0                 ADD     R4, R9
ROM:080D22A2
ROM:080D22A2 loc_80D22A2                             ; CODE XREF: GetRandomBattle_Card+13Ej
ROM:080D22A2                 LDRH    R2, [R4]
ROM:080D22A4                 LSLS    R0, R2, #4
ROM:080D22A6                 ADDS    R0, R0, R7
ROM:080D22A8                 LDRH    R1, [R0,#LawData.Flags]
ROM:080D22AA                 MOVS    R0, #0x80 ; 'Ç'
ROM:080D22AC                 ANDS    R0, R1
ROM:080D22AE                 CMP     R0, #0
ROM:080D22B0                 BEQ     loc_80D22C2
ROM:080D22B2                 CMP     R3, #0
ROM:080D22B4                 BNE     loc_80D22C0
ROM:080D22B6                 MOVS    R0, R2
ROM:080D22B8                 B       loc_80D22F4
ROM:080D22B8 ; ---------------------------------------------------------------------------
ROM:080D22BA                 DCB    0
ROM:080D22BB                 DCB    0
ROM:080D22BC off_80D22BC     DCD LawBreakChecksMaybe ; DATA XREF: GetRandomBattle_Card+F4r
ROM:080D22C0 ; ---------------------------------------------------------------------------
ROM:080D22C0
ROM:080D22C0 loc_80D22C0                             ; CODE XREF: GetRandomBattle_Card+10Cj
ROM:080D22C0                 SUBS    R3, #1
ROM:080D22C2
ROM:080D22C2 loc_80D22C2                             ; CODE XREF: GetRandomBattle_Card+108j
ROM:080D22C2                 LSLS    R0, R2, #4
ROM:080D22C4                 ADDS    R0, R0, R7
ROM:080D22C6                 LDRH    R1, [R0,#2]
ROM:080D22C8                 MOVS    R0, #0x40 ; '@'
ROM:080D22CA                 ANDS    R0, R1
ROM:080D22CC                 CMP     R0, #0
ROM:080D22CE                 BEQ     loc_80D22E0
ROM:080D22D0                 CMP     R3, #0
ROM:080D22D2                 BNE     loc_80D22DE
ROM:080D22D4                 MOVS    R0, R2
ROM:080D22D6                 ADDS    R0, #0x55 ; 'U'
ROM:080D22D8
ROM:080D22D8 loc_80D22D8                             ; CODE XREF: GetRandomBattle_Card+D2j
ROM:080D22D8                 LSLS    R0, R0, #0x10
ROM:080D22DA                 LSRS    R0, R0, #0x10
ROM:080D22DC                 B       loc_80D22F4
ROM:080D22DE ; ---------------------------------------------------------------------------
ROM:080D22DE
ROM:080D22DE loc_80D22DE                             ; CODE XREF: GetRandomBattle_Card+12Aj
ROM:080D22DE                 SUBS    R3, #1
ROM:080D22E0
ROM:080D22E0 loc_80D22E0                             ; CODE XREF: GetRandomBattle_Card+126j
ROM:080D22E0                 ADDS    R4, #2
ROM:080D22E2                 ADDS    R5, #1
ROM:080D22E4                 CMP     R5, #0x13
ROM:080D22E6                 BLE     loc_80D22A2
ROM:080D22E8                 MOVS    R1, #0x28 ; '('
ROM:080D22EA                 ADD     R12, R1
ROM:080D22EC                 ADDS    R6, #1
ROM:080D22EE                 CMP     R6, R8
ROM:080D22F0                 BLT     loc_80D2272
ROM:080D22F2
ROM:080D22F2 loc_80D22F2                             ; CODE XREF: GetRandomBattle_Card+C2j
ROM:080D22F2                 MOVS    R0, #0
ROM:080D22F4
ROM:080D22F4 loc_80D22F4                             ; CODE XREF: GetRandomBattle_Card+110j
ROM:080D22F4                                         ; GetRandomBattle_Card+134j
ROM:080D22F4                 POP     {R3,R4}
ROM:080D22F6                 MOV     R8, R3
ROM:080D22F8                 MOV     R9, R4
ROM:080D22FA                 POP     {R4-R7}
ROM:080D22FC                 POP     {R1}
ROM:080D22FE                 BX      R1
ROM:080D22FE ; End of function GetRandomBattle_Card


Gold is a random value between 1000 and 2999.
ROM:080D2EE8 ; =============== S U B R O U T I N E =======================================
ROM:080D2EE8
ROM:080D2EE8
ROM:080D2EE8 GetRandomBattle_Gold                    ; CODE XREF: sub_8046A4C+1108p
ROM:080D2EE8                 PUSH    {LR}
ROM:080D2EEA                 BL      Rand            ; r0 = random val between 0 and 32767 (0x7FFF)
ROM:080D2EEE                 LSLS    R0, R0, #0x10
ROM:080D2EF0                 ASRS    R0, R0, #0x10
ROM:080D2EF2                 MOVS    R1, 2000
ROM:080D2EF6                 BL      Mod_r0_by_r1    ; r0 = r0 % r1
ROM:080D2EFA                 MOVS    R1, 1000
ROM:080D2EFE                 ADDS    R0, R0, R1
ROM:080D2F00                 LSLS    R0, R0, #0x10
ROM:080D2F02                 LSRS    R0, R0, #0x10
ROM:080D2F04                 POP     {R1}
ROM:080D2F06                 BX      R1
ROM:080D2F06 ; End of function GetRandomBattle_Gold


AP is 50 (shown as 50 in game. Actual value is 5.)
ROM:080D2F08 ; =============== S U B R O U T I N E =======================================
ROM:080D2F08
ROM:080D2F08
ROM:080D2F08 GetRandomBattle_AP                      ; CODE XREF: sub_8046A4C+1112p
ROM:080D2F08                 MOVS    R0, #5
ROM:080D2F0A                 BX      LR
ROM:080D2F0A ; End of function GetRandomBattle_AP
19
So the way it currently works is that it randomly picks an item and then checks it can be dropped from the "Shop" byte (0xC) in the Item Data. Depending on where you are up to in the game it will drop an item that is either currently available in the shop OR has the up-most bit set (0x80). That's the last "Unknown" byte in the AIO Item Editor which all the Mythril items and generic healing items have set.

So it goes through all the items and works out how many can potentional drops there could be, then it randomly selects one of those items (Rand[1, X]) and that is the dropped item.

As for AP given, it is hard coded to 50AP by the looks of it.

Codez below for reference.
ROM:080D2114 ; =============== S U B R O U T I N E =======================================
ROM:080D2114
ROM:080D2114
ROM:080D2114 GetRandomLoot                           ; CODE XREF: sub_8046A4C+10FAp
ROM:080D2114                 PUSH    {R4,R5,LR}
ROM:080D2116                 LDR     R0, =WRAM_Base
ROM:080D2118                 LDR     R1, =0x1F6C
ROM:080D211A                 ADDS    R0, R0, R1
ROM:080D211C                 LDRH    R0, [R0]
ROM:080D211E                 MOVS    R5, #0b10010000
ROM:080D2120                 CMP     R0, #10
ROM:080D2122                 BLS     GetItemDatabase
ROM:080D2124                 MOVS    R5, #0b11000000
ROM:080D2126                 CMP     R0, #20
ROM:080D2128                 BHI     GetItemDatabase
ROM:080D212A                 MOVS    R5, #0b10100000
ROM:080D212C
ROM:080D212C GetItemDatabase                         ; CODE XREF: GetRandomLoot+Ej
ROM:080D212C                                         ; GetRandomLoot+14j
ROM:080D212C                 MOVS    R4, #0
ROM:080D212E                 LDR     R0, =ItemDataBase
ROM:080D2130                 MOVS    R1, R0
ROM:080D2132                 ADDS    R1, #0x20 ; ' '
ROM:080D2134                 LDR     R2, =0x177
ROM:080D2136
ROM:080D2136 loc_80D2136                             ; CODE XREF: GetRandomLoot+32j
ROM:080D2136                 LDRB    R0, [R1,#0xC]
ROM:080D2138                 ANDS    R0, R5
ROM:080D213A                 CMP     R0, #0
ROM:080D213C                 BEQ     loc_80D2140
ROM:080D213E                 ADDS    R4, #1
ROM:080D2140
ROM:080D2140 loc_80D2140                             ; CODE XREF: GetRandomLoot+28j
ROM:080D2140                 ADDS    R1, #0x20 ; ' '
ROM:080D2142                 SUBS    R2, #1
ROM:080D2144                 CMP     R2, #0
ROM:080D2146                 BNE     loc_80D2136
ROM:080D2148                 CMP     R4, #0
ROM:080D214A                 BNE     loc_80D2166
ROM:080D214C                 B       loc_80D2196
ROM:080D214C ; ---------------------------------------------------------------------------
ROM:080D214E                 DCB    0
ROM:080D214F                 DCB    0
ROM:080D2150 off_80D2150     DCD WRAM_Base           ; DATA XREF: GetRandomLoot+2r
ROM:080D2154 off_80D2154     DCD 0x1F6C              ; DATA XREF: GetRandomLoot+4r
ROM:080D2158 off_80D2158     DCD ItemDataBase        ; DATA XREF: GetRandomLoot+1Ar
ROM:080D215C off_80D215C     DCD 0x177               ; DATA XREF: GetRandomLoot+20r
ROM:080D2160 ; ---------------------------------------------------------------------------
ROM:080D2160
ROM:080D2160 FixAndReturn                            ; CODE XREF: GetRandomLoot+76j
ROM:080D2160                 LSLS    R0, R2, #0x10
ROM:080D2162                 LSRS    R0, R0, #0x10
ROM:080D2164                 B       Return
ROM:080D2166 ; ---------------------------------------------------------------------------
ROM:080D2166
ROM:080D2166 loc_80D2166                             ; CODE XREF: GetRandomLoot+36j
ROM:080D2166                 BL      Rand            ; r0 = random val between 0 and 32767 (0x7FFF)
ROM:080D216A                 LSLS    R0, R0, #0x10
ROM:080D216C                 ASRS    R0, R0, #0x10
ROM:080D216E                 MOVS    R1, R4
ROM:080D2170                 BL      Mod_r0_by_r1    ; r0 = r0 % r1
ROM:080D2174                 MOVS    R1, R0
ROM:080D2176                 MOVS    R2, #1
ROM:080D2178                 LDR     R0, =ItemDataBase
ROM:080D217A                 LDR     R4, =0x177
ROM:080D217C                 MOVS    R3, R0
ROM:080D217E                 ADDS    R3, #0x20 ; ' '
ROM:080D2180
ROM:080D2180 loc_80D2180                             ; CODE XREF: GetRandomLoot+80j
ROM:080D2180                 LDRB    R0, [R3,#0xC]
ROM:080D2182                 ANDS    R0, R5
ROM:080D2184                 CMP     R0, #0
ROM:080D2186                 BEQ     loc_80D218E
ROM:080D2188                 CMP     R1, #0
ROM:080D218A                 BEQ     FixAndReturn
ROM:080D218C                 SUBS    R1, #1
ROM:080D218E
ROM:080D218E loc_80D218E                             ; CODE XREF: GetRandomLoot+72j
ROM:080D218E                 ADDS    R3, #0x20 ; ' '
ROM:080D2190                 ADDS    R2, #1
ROM:080D2192                 CMP     R2, R4
ROM:080D2194                 BLE     loc_80D2180
ROM:080D2196
ROM:080D2196 loc_80D2196                             ; CODE XREF: GetRandomLoot+38j
ROM:080D2196                 MOVS    R0, #0
ROM:080D2198
ROM:080D2198 Return                                  ; CODE XREF: GetRandomLoot+50j
ROM:080D2198                 POP     {R4,R5}
ROM:080D219A                 POP     {R1}
ROM:080D219C                 BX      R1
ROM:080D219C ; End of function GetRandomLoot
ROM:080D219C
ROM:080D219C ; ---------------------------------------------------------------------------
20
The EU game is harder to hack because it has 5(?) different languages, so displaying text is hard.