circleseverywhere - Today at 2:56 PM
cool stuff
thanks
post that on feu at some point
{
PUSH; ORG 0xA20164
POIN (prFixedDifficulty+1)
POP
prFixedDifficulty:
SHORT (0x2200 | DIFFICULTY) // Difficulty: 0 for easy, 1 for normal, 2 for hard
SHORT 0x2300
SHORT 0x212A
SHORT 0x5442
SHORT 0x213D
SHORT 0x5443
SHORT 0x4770
ALIGN 4
}
Replace DIFFICULTY
with 0, 1 or 2 depending on which difficulty you wish to set.
Source
.thumb
mov r2, #2 @ 0 for easy, 1 for normal, 2 for hard
mov r3, #0
mov r1, #0x2A
strb r2, [r0, r1]
mov r1, #0x3D
strb r3, [r0, r1]
bx lr
HOW IT WORKS AND WHY
(If you’re just interested in the do part you can stop reading now)
Ok so, 0xA20160 is part of the savemenu
6C code (savemenu
manages save & new game menu stuff), and at this point the 6C code is like so:
CALL(MakeDifficultySelect6C), with MakeDifficultySelect6C as follows:
MakeDifficultySelect6C:
push {lr}
mov r1, r0
ldr r0, =p6C_DifficultySelection
bl NewBlocking6C
pop {r0}
bx r0
This is interesting because this means that the savemenu 6C relies on the fact that the difficulty selection 6C is blocking to wait for the difficulty to be set. The following code is SLEEP(0) (what I usually alias to YIELD, because it stops the execution of the 6C until the next frame it is active), which means that this would be where the difficulty selection does its thing, and in the end will write to savemenu
and destroy itself (unblocking savemenu
in the process).
What we do, is skip that 6C entirely, and write the parameters directly to the savemenu
6C. Since no blocking 6C has been created, it will just continue its execution next frame as if it has existed (and execute according to the saved parameters, you can tryout this by setting the difficulty to 3, which was the code for “cancel”, and if you do things right it should prevent you to start a new game entirely because that’s a good idea right).
See here for more 6C doc stuff
I guess you could expand all that to only allow the difficulty selection screen under certain circumstances (?)
VoilĂ !