resonance 1.0.1
Loading...
Searching...
No Matches
MetKeyboardScreen Class Reference

On-screen keyboard. More...

#include <metkeyboardscreen.h>

Inheritance diagram for MetKeyboardScreen:
Collaboration diagram for MetKeyboardScreen:

Public Member Functions

 MetKeyboardScreen (MetRenderer *pRenderer, int nPriority)
 Construct the screen.
virtual ~MetKeyboardScreen ()
void ResetKeyStates ()
 Disable the twelve function keys.
virtual void EnterAndShow ()
 Show the keyboard and start its enter animation.
virtual void BeginExit ()
 Clear the ticker and start the exit animation.
virtual void HandleCommand (const MetScreenCommand *pCommand)
 Act on one navigation command.
virtual void PlaySlideSound (int nSelector)
 Play the key sound that accompanies sliding.
virtual void PlayHighSound (int nSelector)
 Play the key sound that accompanies the emphasised selection.
virtual void PlayCycleLeftSound (int nSelector)
 Play the key sound that accompanies cycling a value to the left.
virtual void PlayCycleRightSound (int nSelector)
 Play the key sound that accompanies cycling a value to the right.
virtual void UpdateIdle (float flTime)
 Blink the caret.
virtual void StartRepeatingSound (float flStartTime, float flInterval, Rnd::Button *pButton, int nCycles)
 Apply the pending key and then start the base's alternation.
virtual void OnRepeatingSoundFinished (Rnd::Button *pButton)
 Restore the key buttons once a press has finished alternating.
virtual void OnEnterFinished ()
 Set the ticker from the recorded text.
virtual void OnExitFinished ()
 Report the entered text and depart.
virtual void ResolveContainerViews ()
 Resolve the three key panels and the four text objects.
Public Member Functions inherited from MetScreen
 MetScreen (MetRenderer *pRenderer, int nPriority, const HxStr &name, const HxStr &directory, const HxStr &file)
 Construct a screen and start its container load.
virtual ~MetScreen ()
 Unregister from the renderer and release the container.
void DeliverCommand (const MetScreenCommand *pCommand)
 Play the sound one navigation command calls for and then act on the command.
void UpdateAnimationFrame (float flTime)
 Drive the frame of whichever animation is running and run the idle hook when none is.
void UpdateFrame (float flTime)
 Advance one screen by one frame.
virtual void PushNamedScreen (const HxStr &name)
 Bring one named screen onto the renderer's screen stack.
virtual void ActivateNamedPanel (const HxStr &name)
 Make one named screen the renderer's active panel.
virtual void OnPanelActivated ()
 Act on this screen having become the renderer's active panel.
virtual void ExitScreenByName (const HxStr &name)
 Start one named screen's exit animation.
virtual void OnUnusedHook ()
 Do nothing.
virtual void OnKeyboardDismissed ()
 Take control back after the keyboard screen has finished.
virtual void OnDrawPass ()
 Contribute to the renderer's draw pass.
virtual void OnDestroying ()
 Release what the screen acquired, ahead of the rest of destruction.
virtual int PollContainerLoad ()
 Advance this screen's container load and resolve its views once the load finishes.
virtual void OnMsgScreenDismissed (const HxStr &name, int nChoice)
 Act on the choice the user made in a message dialogue.
virtual void OnMsgScreenShown (const HxStr &name)
 Act on a message dialogue becoming visible.
virtual void SetShowing (int nShowing)
 Show or hide the view and every drawable the container loaded.
virtual void BeginContainerLoad (const HxStr &directory, const HxStr &file)
 Intern a container load under this screen's container name and enqueue it.
virtual void PlayLeaveSound (int nSelector)
 Play the sound that accompanies departing a screen.
virtual void PlayErrorSound (int nSelector)
 Play the sound that accompanies a rejected input.
virtual void UpdateIdleAnimation (float flTime)
 Advance whatever the screen animates while it is neither entering nor exiting.
virtual void UpdateRepeatingSound (float flTime)
 Advance the alternation that StartRepeatingSound() started.
virtual void StartEnterAnimation (float flTime)
 Rewind the enter animation and record the time it starts at.
virtual void UpdateEnterAnimation (float flTime)
 Drive the enter animation and finish it once it passes its end.
virtual void StartExitAnimation (float flTime)
 Record the time the exit animation starts at.
virtual void UpdateExitAnimation (float flTime)
 Drive the exit animation and hide the screen once it passes its end.
virtual void Draw ()
 Draw the view.
Public Member Functions inherited from MsgSink
void * operator new (size_t nSize)
 Allocate a sink from the tagged heap under the tag "MsgSink".
void operator delete (void *pBlock)
 Release a sink to the tagged heap.
virtual ~MsgSink ()
virtual void Dispatch (Message *pMsg)
 Accept a message.

Static Public Member Functions

static MetScreen * New (MetRenderer *pRenderer, int nPriority)
 Produce a keyboard on the heap.
static void SetKeyboardReturnScreen (const HxStr &returnScreen)
 Record the screen the registered keyboard departs to.
static std::vector< HxStr > * GetDefaultMacros ()
 Report the twelve default keyboard macros, filling the list on first use.
static HxStr DefaultMacro (int nIndex)
 Read one default keyboard macro from the configuration.
static void Open (const MetKeyboardRequest &request)
 Fill the registered keyboard from a request and bring it up over the requesting screen.
Static Public Member Functions inherited from MetScreen
static std::map< HxStr, MetContainerLoad * > & ContainerLoaderMap ()
 Shared table of container loads, interned under the container name.
static std::map< HxStr, MetScreenEntry > & ScreenRegistry ()
 Shared table of live screens, interned under the screen registry key.
static MetScreen * FindScreenByName (const HxStr &name)
 Resolve one screen by its registry key.
static MetScreen * FindEndScreen (MetRenderer *pRenderer, const HxStr &name)
 Resolve one end-of-game screen by its registry key, failing fatally when it is absent.
static void CreateMainMenuScreens (MetRenderer *pRenderer)
 Create the main-menu screens.
static void DestroyAllScreens ()
 Delete every registered screen and release every container loader.
static void CreateStartupScreens (MetRenderer *pRenderer)
 Create the four screens the front end needs before its containers have loaded.
static void CreateFrontEndScreens (MetRenderer *pRenderer)
 Create every remaining front-end screen, once.
static void DestroyCategory2Screens ()
 Delete and unregister every screen in category 2.
static void DestroyCategory1Screens ()
 Delete and unregister every screen in category 1.
static void DestroyNonDefaultScreens ()
 Delete and unregister every screen outside category 0, then rewind the rndMetLocAndNet zone.
static void PollContainerLoads ()
 Poll every container load that has not finished, and hide the drawables of each that does.

Additional Inherited Members

Public Attributes inherited from MetScreen
Rnd::View * mView
 The container's root view.
int mEnterPending
 Set when the screen was pushed before its container load finished.
int mActivatePending
 Set when the screen was activated as a panel before its container load finished.
float mRepeatScale
 Scale on the input auto-repeat interval.
Protected Member Functions inherited from MetScreen
virtual void DispatchPriv (Message *pMsg)
 Act on a message.
void ResolveAnimationViews ()
 Resolves the two animation views from the screen name and records the enter animation's end frame.
Protected Attributes inherited from MetScreen
float mAnimEndFrame
float mEnterStartTime
MetRenderer * mRenderer
int mExitChoice
int mAcceptsCommands
Rnd::View * mEnterAnim
std::vector< HxStr > mHelpKeys
int mViewsUnresolved
int mPlaysCommandSounds
int mShowsLoadedDrawables

Detailed Description

On-screen keyboard.

Its RTTI descriptor is at 0x008f29f0. It has MetScreen as its one public non-virtual base at offset 0.

The 39-entry primary vtable is at 0x007f5390, the same length as the MetScreen table, so the class declares no virtual of its own.

The constructor at 0x00282660 takes only the renderer and the load priority, and supplies kb for the screen name, metagame/Shared for the directory, and keyboard for the container. The screen registers under the literal MetKeyboardScreen at 0x007f5128, which slot 30 uses to make itself the active panel again.

The object is 0x130 bytes, the size New() requests. The constructor builds an HxStr in place at +0xb4, writes 1.0 into the padding word of both offsets at +0xe0 and +0xf0, clears +0x100 to +0x118, writes 1 into +0x11c and 5 into +0x124, overwrites two members of its own base at +0x58 and +0x5c, and then runs GetDefaultMacros(), discarding the result.

Slot 38 resolves seven container objects by name and runs each through the runtime cast helper at 0x005570e0, with Rnd::View and Rnd::Text as the two target names the translation unit records at 0x007f5118 and 0x007f5108. That pairing is what types the seven members. keypanel_regular.view, keypanel_shift.view, and keypanel_caps.view become the three views, and cursor.txt, text entry window.txt, title bar.txt, and macro_display.txt become the four texts.

Apart from the type function and the destructor, the slots that differ from the MetScreen table are 5 0x00283868, 9 0x0028c550, 19 0x00283268, 20 0x0028c518, 22 0x0028c4e0, 23 0x0028c470, 24 0x0028c4a8, 26 0x0028c708, 28 0x0028c5e0, 30 0x00283968, 33 0x0028c808, 36 0x00283aa0, 38 0x00282948.

The keys are named by the HxStr globals the unit's static initialiser at 0x0028a088 builds from 0x00891b20 onward. Each key's button in the container is key_<name>.but, or key_<name>_cap.but and key_<name>_low.but for a letter. Three layouts of six rows of sixteen names, the regular, shifted, and caps layouts at 0x006a7c98, 0x006a7cb0, and 0x006a7cc8, place the names on the grid mRow and mColumn walk. A key wider than one cell repeats its name in every cell it covers, which is why the movers step until the name changes.

Every member is private. Nothing outside the class touches one directly.

Constructor & Destructor Documentation

◆ MetKeyboardScreen()

MetKeyboardScreen::MetKeyboardScreen ( MetRenderer * pRenderer,
int nPriority )

Construct the screen.

Parameters
pRendererThe front-end renderer this screen registers on.
nPriorityThe load priority.
Ghidra address:
NTSC-U/C: 0x00282660
Ghidra address:
PAL: 0x0029c3e0

◆ ~MetKeyboardScreen()

virtual MetKeyboardScreen::~MetKeyboardScreen ( )
virtual
Ghidra address:
NTSC-U/C: 0x00282e30
Ghidra address:
PAL: 0x0029dbe0

Member Function Documentation

◆ New()

MetScreen * MetKeyboardScreen::New ( MetRenderer * pRenderer,
int nPriority )
static

Produce a keyboard on the heap.

The front end's screen factory at 0x00385180 is the caller.

Parameters
pRendererThe front-end renderer the screen registers on.
nPriorityThe load priority.
Returns
The screen.
Ghidra address:
NTSC-U/C: 0x0028c358
Ghidra address:
PAL: 0x002a8040

◆ SetKeyboardReturnScreen()

void MetKeyboardScreen::SetKeyboardReturnScreen ( const HxStr & returnScreen)
static

Record the screen the registered keyboard departs to.

No call site exists. The title is inferred.

Parameters
returnScreenThe registry key of the screen.
Ghidra address:
NTSC-U/C: 0x0028c2c0
Ghidra address:
PAL: 0x002a7f88

◆ GetDefaultMacros()

std::vector< HxStr > * MetKeyboardScreen::GetDefaultMacros ( )
static

Report the twelve default keyboard macros, filling the list on first use.

The list is a namespace-scope object of the translation unit at 0x006a7c80. While it does not have exactly twelve entries, it is resized to twelve and each entry is replaced with DefaultMacro() for its index. The constructor and GlobalSettings' constructor both run it.

Returns
The list.
Ghidra address:
NTSC-U/C: 0x00284d30
Ghidra address:
PAL: 0x0029ffd8

◆ DefaultMacro()

HxStr MetKeyboardScreen::DefaultMacro ( int nIndex)
static

Read one default keyboard macro from the configuration.

The key is kb_macro_f followed by the one-based index, read under configuration code 0x258.

Parameters
nIndexThe zero-based macro index.
Returns
The macro text.
Ghidra address:
NTSC-U/C: 0x0028cbb8
Ghidra address:
PAL: 0x002a88d8

◆ Open()

void MetKeyboardScreen::Open ( const MetKeyboardRequest & request)
static

Fill the registered keyboard from a request and bring it up over the requesting screen.

The screen registered as MetKeyboardScreen receives the text, the prompt, the receiver, the controller, the ticker text, and the return screen through its setters. The two limits go to the namespace-scope globals at 0x006a7c8c and 0x006a7c90, which the key handlers read, and the macro list falls back to the default list when the request has none. The return screen then pushes the keyboard and makes it the active panel. Neither screen lookup is checked for null. MetSaveRemixScreen, MetRemixDelScreen, and MetLoadNewFreqScreen call it. The title is inferred.

Parameters
requestThe request.
Ghidra address:
NTSC-U/C: 0x00282468
Ghidra address:
PAL: 0x0029c188

◆ ResetKeyStates()

void MetKeyboardScreen::ResetKeyStates ( )

Disable the twelve function keys.

Sets mMacrosDisabled and puts the button of each of the twelve function keys in state 3. ResolveContainerViews() and MetFreqMakerButtonsScreen::HandleCommand() call it. The title is inferred.

Ghidra address:
NTSC-U/C: 0x00283c10
Ghidra address:
PAL: 0x0029eb08

◆ EnterAndShow()

virtual void MetKeyboardScreen::EnterAndShow ( )
virtual

Show the keyboard and start its enter animation.

Slot 5. Hands the prompt to the title bar and the entered text to the text entry window, puts the caret at the end of the text, selects row 3 column 13, toggles the shift key twice to restore the regular layout and the highlight, starts the caret blink, and runs MetScreen::EnterAndShow().

Ghidra address:
NTSC-U/C: 0x00283868
Ghidra address:
PAL: 0x0029e6f8

Reimplemented from MetScreen.

◆ BeginExit()

virtual void MetKeyboardScreen::BeginExit ( )
virtual

Clear the ticker and start the exit animation.

Slot 9. Sets the ticker text to the literal keyboard_clear_ticker and then runs MetScreen::BeginExit().

Ghidra address:
NTSC-U/C: 0x0028c550
Ghidra address:
PAL: 0x002a8238

Reimplemented from MetScreen.

◆ HandleCommand()

virtual void MetKeyboardScreen::HandleCommand ( const MetScreenCommand * pCommand)
virtual

Act on one navigation command.

Slot 19. Ignores a command from a controller other than mSelector unless mSelector is -1. Every accepted command first clears the pending key. The four directions play the slide sound and move the selection, select presses the selected key, back departs without committing, and codes 7, 8, 11, 12, and 13 press ENTER, SPACE, the left arrow, BACKSPACE, and the right arrow. Codes 20 and 21 act on SHIFT and CAPS at once rather than pressing them.

Parameters
pCommandThe command.
Ghidra address:
NTSC-U/C: 0x00283268
Ghidra address:
PAL: 0x0029e060

Reimplemented from MetScreen.

◆ PlaySlideSound()

virtual void MetKeyboardScreen::PlaySlideSound ( int nSelector)
virtual

Play the key sound that accompanies sliding.

Slot 20. Plays SND_MET_KEY1 rather than the base's slide sound, and only when the selector matches or the screen accepts every selector.

Parameters
nSelectorThe value the override compares against its own recorded selector.
Ghidra address:
NTSC-U/C: 0x0028c518
Ghidra address:
PAL: 0x002a8200

Reimplemented from MetScreen.

◆ PlayHighSound()

virtual void MetKeyboardScreen::PlayHighSound ( int nSelector)
virtual

Play the key sound that accompanies the emphasised selection.

Slot 22. Plays SND_MET_KEY2, restricted the same way as slot 20.

Parameters
nSelectorThe value the override compares against its own recorded selector.
Ghidra address:
NTSC-U/C: 0x0028c4e0
Ghidra address:
PAL: 0x002a81c8

Reimplemented from MetScreen.

◆ PlayCycleLeftSound()

virtual void MetKeyboardScreen::PlayCycleLeftSound ( int nSelector)
virtual

Play the key sound that accompanies cycling a value to the left.

Slot 23. Plays SND_MET_KEY2, restricted the same way as slot 20.

Parameters
nSelectorThe value the override compares against its own recorded selector.
Ghidra address:
NTSC-U/C: 0x0028c470
Ghidra address:
PAL: 0x002a8158

Reimplemented from MetScreen.

◆ PlayCycleRightSound()

virtual void MetKeyboardScreen::PlayCycleRightSound ( int nSelector)
virtual

Play the key sound that accompanies cycling a value to the right.

Slot 24. Plays SND_MET_KEY2, restricted the same way as slot 20.

Parameters
nSelectorThe value the override compares against its own recorded selector.
Ghidra address:
NTSC-U/C: 0x0028c4a8
Ghidra address:
PAL: 0x002a8190

Reimplemented from MetScreen.

◆ UpdateIdle()

virtual void MetKeyboardScreen::UpdateIdle ( float flTime)
virtual

Blink the caret.

Slot 26. Returns at once while mBlinkTime is zero, and otherwise waits until the time has passed mBlinkTime plus 240. The caret then toggles, and mBlinkTime advances by 240 from the time rather than from its previous value.

Parameters
flTimeThe current renderer time.
Ghidra address:
NTSC-U/C: 0x0028c708
Ghidra address:
PAL: 0x002a8408

Reimplemented from MetScreen.

◆ StartRepeatingSound()

virtual void MetKeyboardScreen::StartRepeatingSound ( float flStartTime,
float flInterval,
Rnd::Button * pButton,
int nCycles )
virtual

Apply the pending key and then start the base's alternation.

Slot 28. Hides the caret, returns at once when no key is pending, and otherwise dispatches the pending key. The sound mLastAction selects then plays, mLastAction becomes idle, and MetScreen::StartRepeatingSound() runs with the arguments received.

Parameters
flStartTimeThe time the first step runs at.
flIntervalThe interval between steps.
pButtonThe button whose state alternates.
nCyclesThe number of full cycles to run.
Ghidra address:
NTSC-U/C: 0x0028c5e0
Ghidra address:
PAL: 0x002a82e0

Reimplemented from MetScreen.

◆ OnRepeatingSoundFinished()

virtual void MetKeyboardScreen::OnRepeatingSoundFinished ( Rnd::Button * pButton)
virtual

Restore the key buttons once a press has finished alternating.

Slot 30. Returns at once when no key is pending. Otherwise it restores the pending key's button and the selected key's button, highlights the selected key again, clears the pending key, and makes itself the renderer's active panel again under the literal MetKeyboardScreen. The argument the base passes is ignored.

Parameters
pButtonThe button slot 29 finished with, ignored.
Ghidra address:
NTSC-U/C: 0x00283968
Ghidra address:
PAL: 0x0029e7f8

Reimplemented from MetScreen.

◆ OnEnterFinished()

virtual void MetKeyboardScreen::OnEnterFinished ( )
virtual

Set the ticker from the recorded text.

Slot 33.

Ghidra address:
NTSC-U/C: 0x0028c808
Ghidra address:
PAL: 0x002a8508

Reimplemented from MetScreen.

◆ OnExitFinished()

virtual void MetKeyboardScreen::OnExitFinished ( )
virtual

Report the entered text and depart.

Slot 36. Stops the caret blink and restores the selected key's button. When MetScreen::mExitChoice is set, every trailing space is stripped from the entered text and the text goes to mUser. The screen recorded in mReturnScreen is then told the keyboard was dismissed and made the active panel, and the shift state returns to regular.

Ghidra address:
NTSC-U/C: 0x00283aa0
Ghidra address:
PAL: 0x0029e970

Reimplemented from MetScreen.

◆ ResolveContainerViews()

virtual void MetKeyboardScreen::ResolveContainerViews ( )
virtual

Resolve the three key panels and the four text objects.

Slot 38. Runs MetScreen::ResolveContainerViews() first and then resolves each of the seven container objects by name, casting three to Rnd::View and four to Rnd::Text. It records the two caption offsets, selects the regular layout and panel, and runs ResetKeyStates(). The European release then runs LocalizeKeyLabels().

Ghidra address:
NTSC-U/C: 0x00282948
Ghidra address:
PAL: 0x0029d620

Reimplemented from MetScreen.


The documentation for this class was generated from the following file: