I made a lot of changes.
Code
https://cdn.discordapp.com/attachments/179027738454261760/758648745633644584/CasualModeMenu2.7z
1.The number of hooks has been reduced.
ALL DELETE.
//Setup new save to recognize casual mode
ORG $30D18
SHORT $2D01 //cmp r5, #0x1
SHORT $DD03 //ble 30D24
ORG $30D24
//leave r6 for later, it will set casual mode.
SHORT $2001 //mov r0, #0x1
SHORT $2D01 //cmp r5, #0x1
SHORT $DA00 //bge 30D2C
SHORT $2000 //mov r0, #0x0
SHORT $2142 //mov r1, #0x42
SHORT $19C9 //add r1, r1, r7
SHORT $468C //mov r12, r1
SHORT $2101 //mov r1, #0x1
SHORT $4008 //and r0, r1
SHORT $0140 //lsl r0, r0, #0x5
//r1 and r2 are scratch now
jumpToHack(CheckCasualModeInNewSave)
//In SaveNewGame (tested with ExModularSave)
ORG $A4E98
B($A4EA4)
ORG $A4EF8
SHORT $2102 //sets mode byte for new game, change to 2101 if you need FE8's "prologue-ch8" mode
//Makes sure both difficulty level and casual mode data are passed from menu to new savefile
ORG $A9250
replaceWithHack(New_SetOptionsFromDifficultySelect)
–>
//Setup new save to recognize casual mode
ORG $30DAC //{U}
// ORG $30CF8 //{J}
jumpToHack(CasualMode_SetFlag)
I stopped increasing the argument of “08030CF4 InitClearChapterState” and changed it to refer directly to the procs data.
This reduces the number of hooks and prevents them from colliding with other patches.
That’s all the code you need.
@Call 08030DAC {U}
@Call 08030CF8 {J}
CasualMode_SetFlag:
@Retransmission of breaking code.
mov r0, #0x11
neg r0 ,r0
and r1 ,r0
mov r2, r10
strb r1, [r2, #0x0]
@Set judgment of casual mode.
ldr r0, =0x080AA4F0 @Proc_SaveMenu_Main Pointer @{U}
@ ldr r0, =0x080AEFD4 @Proc_SaveMenu_Main Pointer @{J}
ldr r0, [r0]
blh 0x08002e9c @Find6C @{U}
@ blh 0x08002DEC @Find6C @{J}
@Check for errors just in case.
cmp r0,#0x0
beq CasualMode_SetFlag_Exit
add r0, #0x50 @ casual mode
ldrb r2, [r0, #0x0]
cmp r2, #0x00 @if r2==1 then casual. r2==0 then classic
beq CasualMode_SetFlag_Exit
@Set Casual mode flag
ldr r1, =0x0202BCF0 @gChapterData @{U}
@ ldr r1, =0x0202BCEC @gChapterData @{J}
add r1, #0x42
ldrb r0, [r1] @bit 40 = casual mode
mov r2, #0x40
orr r0, r2
strb r0, [r1]
CasualMode_SetFlag_Exit:
ldr r3, =0x08030DB6|1 @{U}
@ ldr r3, =0x08030D02|1 @{J}
bx r3
2.Fixed MAP 0xFF not working.
I created it because the check for MAP was not created in the CallRetreatQuote function.
Also, the hook position of CallRetreatQuote has been moved slightly forward.
This is because there is a BGM 0x3F specification.
08083620 21C0 mov r1, #0xc0 <--MOVE HERE
08083622 4008 and r0 ,r1
08083624 2800 cmp r0, #0x0
08083626 D103 bne #0x8083630
08083628 203F mov r0, #0x3f //MUSIC_悲しみの中で@ADDRESS <-OLD HOOK
0808362A 2100 mov r1, #0x0
0808362C F77E FF52 bl 0x080024d4 //BGMを切り替える(最上位) r0=BGM番号:MUSIC r1=不明
By referring to the BGM as follows, 0x3F can be obtained from the vanilla ROM address.
This is also to avoid conflicts with other patches.
ldr r0, =0x08083628 @{U}
@ ldr r0, =0x08085960 @{J}
ldrb r0 ,[r0] @Get BGM 0x3F Death songID
mov r1, #0x0
blh 0x080024d4 @SwitchBGM @{U}
@ blh 0x08002424 @SwitchBGM @{J}