• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

Completed Easy Developer Mode Toggle

Punkline

Dr. Frankenstack
Joined
May 15, 2015
Messages
423
This code creates a :GCD:+:GCB: hotkey at the title screen that can be used to easily toggle developer mode on and off in a way that is saved to the memory card.

The title scene’s fog object is modified to create a visual indication that the game has been set to developer mode, which can be configured from the <devtoggle_settings> function:




By default, the code uses down+B for the hotkey, but it can be changed to any combination of buttons.

The code also disables the debug menu hotkey (Y), disables the debug quick match hotkey (A), disables the ugly debug timestamp, and disables the demo/video transition timer.

These default settings should make it easy to use the debug menu code memory region in MCM without sacrificing developer mode controller hotkeys.
All of this vanilla title screen hotkey logic may be re-configured as desired through <devtoggle_settings>


To install the DOL Mod, use the latest version of Melee Code Manager.

Easy Developer Mode Toggle:
Uses part of trophy 266 in memory card.

Code:
-==-

Easy Developer Mode Toggle
Edit <devtoggle_settings> to configure title menu effects and hotkey logic.

By default, settings will:
- Enable quick devmode toggle with down+B hotkey
-- Change background color to indicate game mode type
-- Memorize devmode setting using memory card
- Disable Y hotkey to prevent debug menu transition
- Disable A hotkey to prevent debug match transition
- Disable demo/video scene transition timer
- Disable the ugly devmode timestamp
[Punkline]
<devtoggle_settings> All
# devmode OFF settings:
.long  2         # fog type
.float 80.0      # Z Depth of fog color start (no color)
.float 300.0     # Z Depth of fog color end (full color)
.long 0x262626FF # background color
.long 0xB5 # SFX ID

# devmode ON settings:
.long  6         # fog type
.float -16.0     # Z Depth of fog color start (no color)
.float  64.0     # Z Depth of fog color end (full color)
.long 0xE0A020FF # background color
.long 0x12B # SFX ID

# 0x28: other settings:
.byte restore | enableX | devstate | quickkey | color
# combine any of the boolean options together with '|'
.align 2

# boolean option names:
restore   = 1    # restore devmode state from memory card?
enableY   = 2    # enable Y hotkey for debug menu?
enableX   = 4    # enable X hotkey for sound test menu?
enableA   = 8    # enable A hotkey for debug quick match?
timestamp = 16   # enable timestamp display in developer mode?
devstate  = 32   # enable devmode requirement for hotkeys and timestamp?
quickkey  = 64   # enable quick developer mode toggle with custom hotkey?
color     = 128  # enable background color changes to indicate devmode state?

# 0x2C: Quick devmode hotkey button masks:

.long 0x00020200 # pressing EQ mask
# ex: 0x00020200 = down + B
# -- these buttons must be all pressed when trigger is pressed to trigger hotkey logic

.long 0x00000200 # trigger  OR mask
# ex: 0x00000200 = B
# -- if EQ mask is true, and any of these trigger buttons have just been pressed, trigger hotkey

# 0x34: Demo transition timer threshold:
.long 0
# set this to any number below 60 to disable


1.02 ------ 801a1c2c --- 48001a75 -> Branch
lis r0, <<devtoggle_settings>>@h
ori r12, r0, <<devtoggle_settings>>@l
7C7F1B78 3C608048 814D8840 80039D60 892A1EE8 2C000000 816D9368 880C0028 7C007120 41A10024 71240004 4EF7B842 40BF004C 4FFFF842 7C8B2378 7C000026 980C0028 48000038 40990090 3C00804C 60031FAC 80A30000 80CC002C 80830008 80EC0030 7C843839 7C853000 4EC23342 41B60068 38000004 7D6B0279 5169077A 556B077A 41A20008 398C0014 916D9368 992A1EE8 806DC18C 800C0000 8083000C 806C0010 80840028 40980018 90040008 E00C0004 80AC000C F0040010 90A40018 41970018 388000FF 38A00080 38C00000 38E00007
bl 0x8038cff4
7FE3FB78
bl    0x801A36A0
00000000
1.02 ------ 801a1c5c --- 28000258 -> branch
806C0034 2C03003C 41A10008 3803FFFF 7C001800 00000000
1.02 ------ 801a1cc8 --- 57e00529 -> branch
4C5EF042 41A20008 57E00529 00000000
1.02 ------ 801a1d08 --- 57e0056b -> branch
800D9368 2C000000 4C42E842 41A20008 57E0056B 00000000
1.02 ------ 801a1ce8 --- 57e005ef -> branch
4C5CE042 41A20008 57E005EF 00000000
1.02 ------ 801a1cc0 --- 2c000003 -> branch
4C1AD382 40A00008 2C000003 00000000
1.02 ------ 801a2188 --- 2c000001 -> branch
lis r12, <<devtoggle_settings>>@h
ori r12, r12, <<devtoggle_settings>>@l
898C0028 7D803120 41BA0008 38000004 4C1BD842 41A00008 2C000001 00000000
#
Code:
-==-

!
ASM - Easy Developer Mode Toggle
Edit <devtoggle_settings> to configure title menu effects and hotkey logic.

By default, settings will:
- Enable quick devmode toggle with down+B hotkey
-- Change background color to indicate game mode type
-- Memorize devmode setting using memory card
- Disable Y hotkey to prevent debug menu transition
- Disable A hotkey to prevent debug match transition
- Disable demo/video scene transition timer
- Disable the ugly devmode timestamp
[Punkline]
<devtoggle_settings> All
# devmode OFF settings:
.long  2         # fog type
.float 80.0      # Z Depth of fog color start (no color)
.float 300.0     # Z Depth of fog color end (full color)
.long 0x262626FF # background color
.long 0xB5 # SFX ID

# devmode ON settings:
.long  6         # fog type
.float -16.0     # Z Depth of fog color start (no color)
.float  64.0     # Z Depth of fog color end (full color)
.long 0xE0A020FF # background color
.long 0x12B # SFX ID

# 0x28: other settings:
.byte restore | enableX | devstate | quickkey | color
# combine any of the boolean options together with '|'
.align 2

# boolean option names:
restore   = 1    # restore devmode state from memory card?
enableY   = 2    # enable Y hotkey for debug menu?
enableX   = 4    # enable X hotkey for sound test menu?
enableA   = 8    # enable A hotkey for debug quick match?
timestamp = 16   # enable timestamp display in developer mode?
devstate  = 32   # enable devmode requirement for hotkeys and timestamp?
quickkey  = 64   # enable quick developer mode toggle with custom hotkey?
color     = 128  # enable background color changes to indicate devmode state?

# 0x2C: Quick devmode hotkey button masks:

.long 0x00020200 # pressing EQ mask
# ex: 0x00020200 = down + B
# -- these buttons must be all pressed when trigger is pressed to trigger hotkey logic

.long 0x00000200 # trigger  OR mask
# ex: 0x00000200 = B
# -- if EQ mask is true, and any of these trigger buttons have just been pressed, trigger hotkey

# 0x34: Demo transition timer threshold:
.long 0
# set this to any number below 60 to disable


1.02 ------ 801a1c2c --- 48001a75 -> Branch
# on title screen update

# registers
rParams = 12; rMode = 11; rMem = 10; rData = 9

# bools:
bMode = 21; bNoToggle = 22; bNoSound = 23; bColor = 24; bQuickKey = 25; bRestore = 31; eq = 2

lis r0, <<devtoggle_settings>>@h
ori rParams, r0, <<devtoggle_settings>>@l
mr r31, r3
lis r3, 0x8048
lwz rMem, -0x77C0(r13)
lwz r0, 0x80479D60@l -0x10000(r3)
lbz rData, 0x1CD4 + (266<<1) (rMem)
cmpwi r0, 0
lwz rMode, -0x6C98(r13)
lbz r0, 0x28(rParams)
mtcrf 0x07, r0
bgt+ _check_toggling
# rMode   = devmode game state value
# rParams = parameter data from <devtoggle_settings>
# rMem    = memorycard region base
# rData   = trophy 266 padding bits from memorycard
# cr5 has been cleared
# cr6 and cr7 hold our rParam bools; and will continue to hold them for duration of host func

# if this is the first frame of the scene, then update the display and game state without hotkeys

    _initial_frame:
    andi. r4, rData, 4
    crnot bNoSound, bNoSound
    bf+ bRestore, _update
    # if game has alrady loaded static devmode value
    # avoid reloading it to prevent conflicts with other codes that modify game state

      _initial_load:
      crnot bRestore, bRestore
      mr rMode, r4
      mfcr r0
      stb r0, 0x28(rParams)
      b _update
      # else, apply 1-time memory card retrieval of state for this runtime
      # this is only done once per power-on


_check_toggling:
bf- bQuickKey, _return
# if quick developer mode toggle hotkey is disabled, then don't check for it

lis r0, 0x804C1FAC@h
ori r3, r0, 0x804C1FAC@l
lwz r5, 0x0(r3)
lwz r6, 0x2C(rParams)
lwz r4, 0x8(r3)
lwz r7, 0x30(rParams)
and. r4, r4, r7   # cr0 = is trigger false?
cmpw cr1, r5, r6  # cr1 = is pressing mask EQ?
crorc bNoToggle, eq, eq+4  # bNoToggle = trigger is false or (pressing mask is NOT EQ)
bt+ bNoToggle, _return
# if hotkey combination is not being pressed, or trigger is not being pressed this frame
# then skip to end of code

  _if_toggling:
  li r0, 4
  xor. rMode, rMode, r0
  # xor handles toggle logic

  _update:
  rlwimi rData, rMode, 0, 4
  rlwinm rMode, rMode, 0, 4
  # rMode = value ready to store in devmode variable
  # rData = value ready to store in memorycard
  # cr0 = comparison of rMode to 0

  beq+ 0x8
    addi rParams, rParams, 0x14
    # select different parameters for OFF/ON

  stw rMode, -0x6C98(r13)
  stb rData, 0x1CD4 + (266<<1) (rMem)
  # devmode has been toggled, and state has been memorized

  lwz r3, -0x3e74(r13)
  lwz r0, 0x0(rParams)
  lwz r4, 0xC(r3)
  lwz r3, 0x10(rParams)
  lwz r4, 0x28(r4)
  # r3 = SFX ID
  # r4 = title screen fog object

  bf- bColor, _playSound
  # if not updating background color, then skip to sound

    stw r0, 0x8(r4)            # update fog type
    psq_l f0, 0x4(rParams), 0, 0
    lwz r5, 0xC(rParams)
    psq_st f0, 0x10(r4), 0, 0  # update fog depth range
    stw r5, 0x18(r4)           # update color
    # Fog object has been updated

  _playSound:
  bt- bNoSound, _return
    li r4, 0xFF
    li r5, 0x80
    li r6, 0
    li r7, 7
    bl 0x8038cff4
    # play sound effect if bNoSound is still cleared
    # we only play sounds when using hotkeys to update the main menu state

_return:
mr r3, r31
bl    0x801A36A0
.long 0


1.02 ------ 801a1c5c --- 28000258 -> branch
# override demo timer
rParams = 12
lwz r3, 0x34(rParams)
cmpwi r3, 60
bgt+ _return
  subi r0, r3, 1
  # if demo timer is less than 1 second, then disable it

_return:
cmpw r0, r3
.long 0


1.02 ------ 801a1cc8 --- 57e00529 -> branch
# for enable Y check
bEnableY = 30  # enable Y hotkey for debug menu?
eq = 2

crnot eq, bEnableY
beq+ _return
# override cr0 eq with bEnableY

  _default:
  rlwinm.    r0, r31, 0, 20, 20
  # if enabled, then default comparison is made, else override takes precidence

_return:
.long 0


1.02 ------ 801a1d08 --- 57e0056b -> branch
# for enable X check
bEnableX = 29  # enable X hotkey for sound test menu?
eq = 2
lwz r0, -0x6C98(r13)
cmpwi r0, 0
crnor eq, eq, bEnableX
beq+ _return
# override cr0 eq with bEnableX and bMode

  _default:
  rlwinm.    r0, r31, 0, 21, 21
  # if enabled, then default comparison is made, else override takes precidence

_return:
.long 0


1.02 ------ 801a1ce8 --- 57e005ef -> branch
# for enable A check
bEnableA = 28  # enable A hotkey for debug quick match?
eq = 2

crnot eq, bEnableA
beq+ _return
# override cr0 eq with bEnableA

  _default:
  rlwinm.    r0, r31, 0, 23, 23
  # if enabled, then default comparison is made, else override takes precidence

_return:
.long 0


1.02 ------ 801a1cc0 --- 2c000003 -> branch
# for devmode hotkey check
bDevhotkey = 26  # enable devmode requirement for hotkeys and timestamp?
lt = 0

crmove lt, bDevhotkey
bge+ _return
# override cr0 lt with bDevhotkey

  _default:
  cmpwi    r0, 3
  # if enabled, the default comparison is made, else override takes precidence

_return:
.long 0


1.02 ------ 801a2188 --- 2c000001 -> branch
# when title screen initializes
bTimestamp = 27  # enable timestamp display in developer mode?
bDevhotkey = 26  # enable devmode requirement for hotkeys and timestamp?
lt = 0

lis r12, <<devtoggle_settings>>@h
ori r12, r12, <<devtoggle_settings>>@l
lbz r12, 0x28(r12)
mtcrf 0x3, r12
# load param bools

bt+ bDevhotkey, 8
  li r0, 4
  # ignore devmode state if bDevhotkey

crnot lt, bTimestamp
blt+ _return
# override cr0 lt with bTimestamp

  _default:
  cmpwi    r0, 1
  # if enabled, the default comparison is made, else override takes precidence
  # if ignoring devmode state, then comparison will always be gt

_return:
.long 0
 
Last edited:
Top Bottom