• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[ASM & Hex] Refresh player palette

88
Posts
7
Years
    • Seen Jan 16, 2020
    Hello!

    I've been trying to refresh the player palette without reloading the map (after callasm 0x805BE61). I found this page, and formulated my own assembly routine (below) to load a new palette into the appropriate RAM.

    The problem is, if I open a start menu function such as Options, the old palette reappears briefly before opening the menu. And using fadescreen after updating OWs causes the old palette to be permanently attributed to the player again.

    So my question is, where else is the player palette stored besides 0x020377F8? Im not too familiar with the OAMT or object data structures so my hunch is that opening a menu loads a palette from there somehow?

    I tried using karatekid's assembly routine in the linked post but it didn't seem to work (although chances are I messed up the insertion instructions)

    Thanks for any help you can give!

    Test Assembly:
    Code:
    .align 2
    .thumb
    
    Main:
      push {r0-r2, lr}
      ldr r0, =(0x08900000)  @new pal loc
      ldr r1, =(0x05000000)  @pal 0
      mov r2, #0x10
      swi 0xb
      ldr r1, =(0x020377F8)  @player pal
      swi 0xb
      pop {r0-r2, pc}
     
    51
    Posts
    9
    Years
    • Seen Nov 18, 2023
    This is the right code

    Code:
    .thumb
    .align 2
    
    push {lr}
    ldr r0, = 0x8xxxxxx @your palette location
    ldr r1, = 0x020377F8 @player pal
    mov r2, #16
    swi 0xb
    pop {pc}
     
    88
    Posts
    7
    Years
    • Seen Jan 16, 2020
    This is the right code

    Code:
    .thumb
    .align 2
    
    push {lr}
    ldr r0, = 0x8xxxxxx @your palette location
    ldr r1, = 0x020377F8 @player pal
    mov r2, #16
    swi 0xb
    pop {pc}

    How is this different from also applying the palette to the VRAM?
     
    51
    Posts
    9
    Years
    • Seen Nov 18, 2023
    - ldr r1, =(0x05000000) @pal 0 -> 05 loads the colors from 02. if you change the colors on 05, after 1 second, the game will search again the colors on 02 (the old ones) and load them on 05, getting the wrong colors.

    - mov r2, #0x10 -> loads 20 colors only...you must write #16, in this case the routine loads 32 colors
     
    88
    Posts
    7
    Years
    • Seen Jan 16, 2020
    - ldr r1, =(0x05000000) @pal 0 -> 05 loads the colors from 02. if you change the colors on 05, after 1 second, the game will search again the colors on 02 (the old ones) and load them on 05, getting the wrong colors.

    - mov r2, #0x10 -> loads 20 colors only...you must write #16, in this case the routine loads 32 colors

    Hm interesting. It solves the player showing up in the middle of fadescreen. Turns out I also needed to write the pal to 0x020373F8 to fix the menu problem. Also 0x10 and 16 are the same number :laugh-squinted:

    Thanks!
     
    Back
    Top