Huichelaar's Assembly Adventures

When I was starting out with this series, I kinda appreciated what Hannah/Nils had to say. It’s nice that people can add this to their projects.

Small bugfix, details in main post under “Minimug palette fix”.
You know how when quickly switching from one character to another, the minimug uses the previous palette for one frame? This fixes that.


Left: vanilla. Right: fixed.

11 Likes

This MMB compatible? please say yes haha

Haven’t tested that. Feel free to volunteer. Otherwise, I’ll probably take a look later.

I put in my WIP hack with MMB and it worked just fine.

2 Likes

New eyecandyhack: SoundRoomBG.

2021-09-12_16-56-21

Wanna show off screenshots or promo material of the origins of your soundtracks? More details in the main post.

8 Likes

Why you make patch with the same name?

I think the implementation of hiding the UI with the L button in your patch is good.

Because I wasn’t aware there already was something that does the same thing :man_facepalming:. I have a tendency to unknowingly reinvent the wheel. Although I guess this version’s a little bit different.

I was reading your code with the intention of steal reference the implementation of the L button, but I found a slightly dangerous part, so I will report it.

ListenForL.asm

@ Display only BG3 when L is pressed.
@ Hooked at 0xAF8A4.
...
@ Vanilla overwritten stuff
add   r5, #0x37
mov   r0, #0x0
ldsb  r0, [r5, r0]

ldr   r1, =0x80AF8AD

Return:
pop   {r4-r7}
bx    r1
080AF8A0 B570   push {r4,r5,r6,lr}   //Procs SoundRoomUI CallASM
080AF8A2 1C04   mov r4 ,r0
080AF8A4 2600   mov r6, #0x0 <<< HOOK POINT
080AF8A6 3037   add r0, #0x37
080AF8A8 7800   ldrb r0, [r0, #0x0]
080AF8AA 0600   lsl r0 ,r0 ,#0x18
080AF8AC 1600   asr r0 ,r0 ,#0x18 <<back point
080AF8AE 2800   cmp r0, #0x0
080AF8B0 D170   bne #0x80af994

There are two problems.

The vanilla code initializes r6 to 0, but you haven’t done that.

You are back at 080AF8AC, but you should be back at 080AF8AE, which is one level below.
If you want to go back to 080AF8AC, you should add “lsl r0, r0, # 0x18” to the code return that also breaks.

Both of these problems are solved by replacing 080AF8AC asr r0, r0, #0x18 with mov r6, #0x0, which is what I did in the file that inserts the hook:

asm/asm.event:

...
  // Display only background if L is pressed.
  ORG 0xAF8A4
  jumpToHack(SBG_ListenForL)
  SHORT 0x2600
...

Note that opcode 0x2600 is mov r6, #0x0. In No$GBA it’ll look like this:

You didn’t bring this up, but just to avoid anyone getting confused at this, note that the alternative return in ListenForL.asm,

...
ldr   r1, =0x80AFA5D
b     Return
...

Doesn’t reach the new mov r6, #0x0 at 0x80AF8AC. This isn’t a problem because 80AFA5D is where the function ends and r6 is overwritten at that point:

1 Like

i see. I didn’t realize you were doing it outside of asm.

1 Like

I made it with reference to your L key implementation.

The features are the following three points.

  1. This patch doesn’t make procs, so it’s friendly to other patches and rebuild.
  2. You can use any key to return, not the L key.
    To rescue someone who accidentally enters this mode.
  3. It also supports Random Mode.
1 Like

Oh cool!

Just to clarify, my implementation does also allow you to display the UI again by pressing any button.

There’s another minor bug with the suspend x2 hack, if a player saves at the bottom save during a skirmish the chapter title is CH. 10: Revolt at Carcino, if they save at the top it says Prologue: The Fall of Renais instead of the chapter that the player is at.

I’m getting Prologue: The Fall of Renais for both save files, but it’s wrong either way, so I’ll look into it.

Edit: Alrighty, this should fix the issue. If you replace Suspendx2/ExpandedModularSave/ExModularSaveInternals.event with the new one I put on Github it should display the correct chapter title again when you save during a skirmish.

1 Like

Great work, the graphical bug and save bug are fixed thanks!

What I am supposed to write for the chapter intro with the gems and the characters that run from left to rigth? Where’s the assembly code?

Most of the assembly can be found in the subfolders of the Procs subdirectory. Regarding the first question, have you read the README?

1 Like

Hey. I was wondering if you’ll ever make a V2 of the custom chapter intro? It looks really cool. Maybe it could be 10 gems instead of 6, but 5 on top, and 5 on the bottom. And do they have to all be gems? (Like, the same sprite with different pelettes?) Or can they be different objects/sprites each?

I’ll probably make a different custom chapter intro at some point for my personal project, but that’s likely to be it. Most stuff here is me seeing if I could implement something and sharing the results. Now that I know making a custom intro is something I can do, it’s not as enticing to make anymore.

4 Likes