Complete menu modification!

Completed patches for Keen1.
Post Reply
Dr. Kylstein
Posts: 120
Joined: Wed Dec 16, 2009 5:20 pm

Complete menu modification!

Post by Dr. Kylstein »

Working from Levellord's patch, I've figured out how to modify several properties of the cursor:

Code: Select all

#first frame of cursor idle animation
%patch $92FB $09 $00
#number of frames in cursor idle animation minus one
%patch $9316 $02 $00

# top menu item
# when moving up
%patch $9331 $00
# when wrapping around from bottom
%patch $9472 $00 $00

# bottom menu item
# when moving down
%patch $9414 $07
# when wrapping from top
%patch $938F $07 $00

#first frame of cursor animation for moving up
%patch $933E $09 $00
#Tile the cursor leaves behind when moving up [blank space]
%patch $9361 $20 $00
#number of frames in cursor animation for moving up minus one
%patch $937E $02 $00
#tile to draw when done sliding upwards
%patch $93B5 $09 $00

#first frame of cursor animation for moving down
%patch $9421 $09 $00
#Tile the cursor leaves behind when moving down [blank space]
%patch $9444 $20 $00
#number of frames in cursor animation for moving down minus one
%patch $9461 $02 $00
#tile to draw when done sliding down
%patch $9498 $09 $00
I've also figured out how to prevent items of the menu from being displayed:

Code: Select all

#disable drawing of menu items
#%patch $9628 $90 $90 $90	#New Game
#%patch $9631 $90 $90 $90	#Continue Game
#%patch $963A $90 $90 $90	#Story
#%patch $9643 $90 $90 $90	#About Id
#%patch $964C $90 $90 $90	#High Scores
#%patch $9655 $90 $90 $90	#Ordering Info
#%patch $965E $90 $90 $90	#Previews!
#%patch $9667 $90 $90 $90	#Restart Demo
which can be combined with Levellord's info and the patch above to shorten the menu:

Code: Select all

%ext ck1
%version 1.31
#Menu box height in lines of text
%patch $9601 $07 $00

# top menu item
# when moving up
%patch $9331 $00
# when wrapping around from bottom
%patch $9472 $00 $00

# bottom menu item
# when moving down
%patch $9414 $04
# when wrapping from top
%patch $938F $04 $00

%patch $9655 $90 $90 $90	#Ordering Info
%patch $965E $90 $90 $90	#Previews!
%patch $9667 $90 $90 $90	#Restart Demo

%end
Note that removing an item from the middle causes the labels to shift up, but not the functions.

I can change the functions of the menu items and even make a new game start after any of them. (with the limitation that the function replaced may become inaccessible.) Unlike Levellord's attempt, which only worked through the benevolence of the computer pixies, my way is reliable and works for nearly anything. However, it's a different patch for every item pair, so I will only post particular replacements by request.
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

How does your method work? I am working on adding menu support to Startext, so a modder could start with a blank menu and add the items and only the items they wanted, as well as resizing the menu to their liking.

Currently of course I can only stop items, not remove them entirely so I am interested in your methods. I would have assumed it would simply be a case of changing the pointers to various menu functions, making say the New Game pointer point to Story instead, which should be a simple two-byte patch.
Dr. Kylstein
Posts: 120
Joined: Wed Dec 16, 2009 5:20 pm

Post by Dr. Kylstein »

I actually haven't been able to track down the pointer table, which would be the ideal way to do it. I just insert a jump at the destination to change the function and modify the return value to make it start a new game.

Edit: Breaking news! I have found the jump table! The reason this was so hard to find was that it was addressed with a negative value:

Code: Select all

jmp  near word cs:[bx-6A13]
bx is the current menu item times two, so item 0 makes the pointer equal to -6A13, which is not a valid address. However, in two's compliment that is equal to 95ED, which turns out to be the actual address of the table. Here's the patch, just swap the values around to re-arrange things:

Code: Select all

%patch $95ED 
  $9570W # New Game
  $9577W # Continue Game
  $957FW # Story
  $9589W # About ID...
  $9596W # High Scores
  $95A3W # Ordering Info
  $95B5W # Previews!
  $95C2W # Restart Demo
Post Reply