finalize 4.0.0

This commit is contained in:
dborth 2009-04-05 01:51:56 +00:00
parent 632e1b2232
commit 6191d5f741
15 changed files with 532 additions and 106 deletions

View File

@ -48,17 +48,20 @@ guides on how to install and get homebrew working on your Nintendo Wii.
| UPDATE HISTORY |
•˜———–—––-- - —————————––––– ———–—––-- - —————————––––– ———–—––-- - ————————•
[4.0.0]
[4.0.0 - April 4, 2009]
* New GX-based menu, with a completely redesigned layout. Has Wiimote IR
support, sounds, graphics, animation effects, and more
* Thanks to the3seashells for designing some top-notch artwork, to
Peter de Man for composing the music, and a special thanks to shagkur for
fixing libogc bugs that would have otherwise prevented the release
* Onscreen keyboard for changing save/load folders and network settings
* Menu configuration options (configurable exit button, wiimote orientation,
volumes)
* Configurable button mapping for superscope, mouse and justifier
* New save manager, allowing multiple saves and save browsing. Shows
screenshots for Snapshot saves, and save dates/times
* Experimental hq2x filter
* Experimental hq2x filter, contributed by michniewski
[009 - January 27, 2009]

View File

@ -3,9 +3,10 @@
*
* Tantric January 2009
*
* imagelist.h
* filelist.h
*
* Contains a list of all of the images in the images/ folder
* Contains a list of all of the files stored in the images/, fonts/, and
* sounds/ folders
***************************************************************************/
#ifndef _FILELIST_H_
@ -19,9 +20,18 @@ extern const u32 font_ttf_size;
extern const u8 bg_music_ogg[];
extern const u32 bg_music_ogg_size;
extern const u8 enter_ogg[];
extern const u32 enter_ogg_size;
extern const u8 exit_ogg[];
extern const u32 exit_ogg_size;
extern const u8 button_over_pcm[];
extern const u32 button_over_pcm_size;
extern const u8 button_click_pcm[];
extern const u32 button_click_pcm_size;
extern const u8 logo_png[];
extern const u32 logo_png_size;

View File

@ -1,15 +1,35 @@
/****************************************************************************
* Snes9x 1.51 Nintendo Wii/Gamecube Port
/*!\mainpage libwiigui Documentation
*
* Tantric February 2009
* \section Introduction
* libwiigui is a GUI library for the Wii, created to help structure the
* design of a complicated GUI interface, and to enable an author to create
* a sophisticated, feature-rich GUI. It was originally conceived and written
* after I started to design a GUI for Snes9x GX, and found libwiisprite and
* GRRLIB inadequate for the purpose. It uses GX for drawing, and makes use
* of PNGU for displaying images and FreeTypeGX for text. It was designed to
* be flexible and is easy to modify - don't be afraid to change the way it
* works or expand it to suit your GUI's purposes! If you do, and you think
* your changes might benefit others, please share them so they might be
* added to the project!
*
* gui.h
*
* GUI class definitions
***************************************************************************/
* \section Quickstart
* Start from the supplied template example. For more advanced uses, see the
* source code for Snes9x GX, FCE Ultra GX, and Visual Boy Advance GX.
#ifndef GUI_H
#define GUI_H
* \section Contact
* If you have any suggestions for the library or documentation, or want to
* contribute, please visit the libwiigui website:
* http://code.google.com/p/libwiigui/
* \section Credits
* This library was wholly designed and written by Tantric. Thanks to the
* authors of PNGU and FreeTypeGX, of which this library makes use. Thanks
* also to the authors of GRRLIB and libwiisprite for laying the foundations.
*
*/
#ifndef LIBWIIGUI_H
#define LIBWIIGUI_H
#include <gccore.h>
#include <malloc.h>
@ -78,233 +98,478 @@ enum
#define EFFECT_SCALE 128
#define EFFECT_COLOR_TRANSITION 256
//!Sound conversion and playback. A wrapper for other sound libraries - ASND, libmad, ltremor, etc
class GuiSound
{
public:
//!Constructor
//!\param s Pointer to the sound data
//!\param l Length of sound data
//!\param t Sound format type (SOUND_PCM or SOUND_OGG)
GuiSound(const u8 * s, int l, int t);
//!Destructor
~GuiSound();
//!Start sound playback
void Play();
//!Stop sound playback
void Stop();
//!Pause sound playback
void Pause();
//!Resume sound playback
void Resume();
//!Checks if the sound is currently playing
//!\return true if sound is playing, false otherwise
bool IsPlaying();
//!Set sound volume
//!\param v Sound volume (0-100)
void SetVolume(int v);
//!Set the sound to loop playback (only applies to OGG)
//!\param l Loop (true to loop)
void SetLoop(bool l);
protected:
const u8 * sound;
int type;
s32 length;
s32 voice;
s32 volume;
const u8 * sound; //!< Pointer to the sound data
int type; //!< Sound format type (SOUND_PCM or SOUND_OGG)
s32 length; //!< Length of sound data
s32 voice; //!< Currently assigned ASND voice channel
s32 volume; //!< Sound volume (0-100)
bool loop; //!< Loop sound playback
};
//!Primary Gui class
class GuiElement
{
public:
//!Constructor
GuiElement();
//!Destructor
~GuiElement();
//!Set the element's parent
//!\param e Pointer to parent element
void SetParent(GuiElement * e);
//!Gets the current leftmost coordinate of the element
//!Considers horizontal alignment, x offset, width, and parent element's GetLeft() / GetWidth() values
//!\return left coordinate
int GetLeft();
//!Gets the current topmost coordinate of the element
//!Considers vertical alignment, y offset, height, and parent element's GetTop() / GetHeight() values
//!\return top coordinate
int GetTop();
//!Gets the current width of the element. Does not currently consider the scale
//!\return width
int GetWidth();
//!Gets the height of the element. Does not currently consider the scale
//!\return height
int GetHeight();
//!Sets the size (width/height) of the element
//!\param w Width of element
//!\param h Height of element
void SetSize(int w, int h);
//!Checks whether or not the element is visible
//!\return true if visible, false otherwise
bool IsVisible();
//!Checks whether or not the element is selectable
//!\return true if selectable, false otherwise
bool IsSelectable();
//!Checks whether or not the element is clickable
//!\return true if clickable, false otherwise
bool IsClickable();
//!Sets whether or not the element is selectable
//!\param s Selectable
void SetSelectable(bool s);
//!Sets whether or not the element is clickable
//!\param c Clickable
void SetClickable(bool c);
//!Gets the element's current state
//!\return state
int GetState();
//!Sets the element's alpha value
//!\param a alpha value
void SetAlpha(int a);
//!Gets the element's alpha value
//!Considers alpha, alphaDyn, and the parent element's GetAlpha() value
//!\return alpha
int GetAlpha();
//!Sets the element's scale
//!\param s scale (1 is 100%)
void SetScale(float s);
//!Gets the element's current scale
//!Considers scale, scaleDyn, and the parent element's GetScale() value
float GetScale();
//!Set a new GuiTrigger for the element
//!\param t Pointer to GuiTrigger
void SetTrigger(GuiTrigger * t);
//!\overload
//!\param i Index of trigger array to set
//!\param t Pointer to GuiTrigger
void SetTrigger(u8 i, GuiTrigger * t);
//!Checks whether rumble was requested by the element
//!\return true is rumble was requested, false otherwise
bool Rumble();
//!Sets whether or not the element is requesting a rumble event
//!\param r true if requesting rumble, false if not
void SetRumble(bool r);
//!Set an effect for the element
//!\param e Effect to enable
//!\param a Amount of the effect (usage varies on effect)
//!\param t Target amount of the effect (usage varies on effect)
void SetEffect(int e, int a, int t=0);
//!Sets an effect to be enabled on wiimote cursor over
//!\param e Effect to enable
//!\param a Amount of the effect (usage varies on effect)
//!\param t Target amount of the effect (usage varies on effect)
void SetEffectOnOver(int e, int a, int t=0);
//!Shortcut to SetEffectOnOver(EFFECT_SCALE, 4, 110)
void SetEffectGrow();
//!Gets the current element effects
//!\return element effects
int GetEffect();
//!Checks whether the specified coordinates are within the element's boundaries
//!\param x X coordinate
//!\param y Y coordinate
//!\return true if contained within, false otherwise
bool IsInside(int x, int y);
//!Sets the element's position
//!\param x X coordinate
//!\param y Y coordinate
void SetPosition(int x, int y);
//!Updates the element's effects (dynamic values)
//!Called by Draw(), used for animation purposes
void UpdateEffects();
//!Sets a function to called after after Update()
//!Callback function can be used to response to changes in the state of the element, and/or update the element's attributes
void SetUpdateCallback(UpdateCallback u);
//!Checks whether the element is in focus
//!\return true if element is in focus, false otherwise
int IsFocused();
//!Sets the element's visibility
//!\param v Visibility (true = visible)
virtual void SetVisible(bool v);
//!Sets the element's focus
//!\param v Focus (true = in focus)
virtual void SetFocus(int f);
//!Sets the element's state
//!\param v State (STATE_DEFAULT, STATE_SELECTED, STATE_CLICKED, STATE_DISABLED)
virtual void SetState(int s);
//!Resets the element's state to STATE_DEFAULT
virtual void ResetState();
//!Gets whether or not the element is in STATE_SELECTED
//!\return true if selected, false otherwise
virtual int GetSelected();
//!Sets the element's alignment respective to its parent element
//!\param hor Horizontal alignment (ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTRE)
//!\param vert Vertical alignment (ALIGN_TOP, ALIGN_BOTTOM, ALIGN_MIDDLE)
virtual void SetAlignment(int hor, int vert);
//!Called constantly to allow the element to respond to the current input data
//!\param t Pointer to a GuiTrigger, containing the current input data from PAD/WPAD
virtual void Update(GuiTrigger * t);
//!Called constantly to redraw the element
virtual void Draw();
protected:
bool visible;
int focus; // -1 = cannot focus, 0 = not focused, 1 = focused
int width;
int height;
int xoffset;
int yoffset;
int xoffsetDyn;
int yoffsetDyn;
int alpha;
f32 scale;
int alphaDyn;
f32 scaleDyn;
bool rumble;
int effects;
int effectAmount;
int effectTarget;
int effectsOver;
int effectAmountOver;
int effectTargetOver;
int alignmentHor; // LEFT, RIGHT, CENTRE
int alignmentVert; // TOP, BOTTOM, MIDDLE
int state; // DEFAULT, SELECTED, CLICKED, DISABLED
bool selectable; // is SELECTED a valid state?
bool clickable; // is CLICKED a valid state?
GuiTrigger * trigger[2];
GuiElement * parentElement;
UpdateCallback updateCB;
bool visible; //!< Visibility of the element. If false, Draw() is skipped
int focus; //!< Element focus (-1 = focus disabled, 0 = not focused, 1 = focused)
int width; //!< Element width
int height; //!< Element height
int xoffset; //!< Element X offset
int yoffset; //!< Element Y offset
int xoffsetDyn; //!< Element X offset, dynamic (added to xoffset value for animation effects)
int yoffsetDyn; //!< Element Y offset, dynamic (added to yoffset value for animation effects)
int alpha; //!< Element alpha value (0-255)
f32 scale; //!< Element scale (1 = 100%)
int alphaDyn; //!< Element alpha, dynamic (multiplied by alpha value for blending/fading effects)
f32 scaleDyn; //!< Element scale, dynamic (multiplied by alpha value for blending/fading effects)
bool rumble; //!< Wiimote rumble (on/off) - set to on when this element requests a rumble event
int effects; //!< Currently enabled effect(s). 0 when no effects are enabled
int effectAmount; //!< Effect amount. Used by different effects for different purposes
int effectTarget; //!< Effect target amount. Used by different effects for different purposes
int effectsOver; //!< Effects to enable when wiimote cursor is over this element. Copied to effects variable on over event
int effectAmountOver; //!< EffectAmount to set when wiimote cursor is over this element
int effectTargetOver; //!< EffectTarget to set when wiimote cursor is over this element
int alignmentHor; //!< Horizontal element alignment, respective to parent element (LEFT, RIGHT, CENTRE)
int alignmentVert; //!< Horizontal element alignment, respective to parent element (TOP, BOTTOM, MIDDLE)
int state; //!< Element state (DEFAULT, SELECTED, CLICKED, DISABLED)
bool selectable; //!< Whether or not this element selectable (can change to SELECTED state)
bool clickable; //!< Whether or not this element is clickable (can change to CLICKED state)
GuiTrigger * trigger[2]; //!< GuiTriggers (input actions) that this element responds to
GuiElement * parentElement; //!< Parent element
UpdateCallback updateCB; //!< Callback function to call when this element is updated
};
//!Groups elements into one window in which they can be managed.
//!Allows GuiElements to be grouped together into a "window"
class GuiWindow : public GuiElement
{
public:
//!Constructor
GuiWindow();
//!\overload
//!\param w Width of window
//!\param h Height of window
GuiWindow(int w, int h);
//!Destructor.
//!Destructor
~GuiWindow();
//!Appends a element at the end, thus drawing it at last.
//!\param element The element to append. If it is already in the list, it gets removed first.
//!Appends a GuiElement to the GuiWindow
//!\param e The GuiElement to append. If it is already in the GuiWindow, it is removed first
void Append(GuiElement* e);
//!Inserts a element into the manager.
//!\param element The element to insert. If it is already in the list, it gets removed first.
//!\param index The new index of the element.
void Insert(GuiElement* e, u32 index);
//!Removes a element from the list.
//!\param element A element that is in the list.
//!Inserts a GuiElement into the GuiWindow at the specified index
//!\param e The GuiElement to insert. If it is already in the GuiWindow, it is removed first
//!\param i Index in which to insert the element
void Insert(GuiElement* e, u32 i);
//!Removes the specified GuiElement from the GuiWindow
//!\param e GuiElement to be removed
void Remove(GuiElement* e);
//!Clears the whole GuiWindow from all GuiElement.
//!Removes all GuiElements
void RemoveAll();
//!Returns a element at a specified index.
//!\param index The index from where to poll the element.
//!\return A pointer to the element at the index. NULL if index is out of bounds.
//!Returns the GuiElement at the specified index
//!\param index The index of the element
//!\return A pointer to the element at the index, NULL on error (eg: out of bounds)
GuiElement* GetGuiElementAt(u32 index) const;
//!Returns the size of the list of elements.
//!\return The size of the current elementlist.
//!Returns the size of the list of elements
//!\return The size of the current element list
u32 GetSize();
//!Sets the visibility of the window
//!\param v visibility (true = visible)
void SetVisible(bool v);
//!Resets the window's state to STATE_DEFAULT
void ResetState();
//!Sets the window's state
//!\param s State
void SetState(int s);
//!Gets the index of the GuiElement inside the window that is currently selected
//!\return index of selected GuiElement
int GetSelected();
//!Sets the window focus
//!\param f Focus
void SetFocus(int f);
//!Change the focus to the specified element
//!This is intended for the primary GuiWindow only
//!\param e GuiElement that should have focus
void ChangeFocus(GuiElement * e);
//!Changes window focus to the next focusable window or element
//!If no element is in focus, changes focus to the first available element
//!If B or 1 button is pressed, changes focus to the next available element
//!This is intended for the primary GuiWindow only
//!\param t Pointer to a GuiTrigger, containing the current input data from PAD/WPAD
void ToggleFocus(GuiTrigger * t);
//!Moves the selected element to the element to the left or right
//!\param d Direction to move (-1 = left, 1 = right)
void MoveSelectionHor(int d);
//!Moves the selected element to the element above or below
//!\param d Direction to move (-1 = up, 1 = down)
void MoveSelectionVert(int d);
//!Draws all the elements in this GuiWindow.
//!Draws all the elements in this GuiWindow
void Draw();
//!Updates the window and all elements contains within
//!Allows the GuiWindow and all elements to respond to the input data specified
//!\param t Pointer to a GuiTrigger, containing the current input data from PAD/WPAD
void Update(GuiTrigger * t);
protected:
std::vector<GuiElement*> _elements;
std::vector<GuiElement*> _elements; //!< Contains all elements within the GuiWindow
};
//!Converts image data into GX-useable RGBA8
//!Currently designed for use only with PNG files
class GuiImageData
{
public:
//!Constructor
//!Converts the image data to RGBA8 - expects PNG format
//!\param i Image data
GuiImageData(const u8 * i);
//!Destructor
~GuiImageData();
//!Gets a pointer to the image data
//!\return pointer to image data
u8 * GetImage();
//!Gets the image width
//!\return image width
int GetWidth();
//!Gets the image height
//!\return image height
int GetHeight();
protected:
u8 * data;
int height;
int width;
u8 * data; //!< Image data
int height; //!< Height of image
int width; //!< Width of image
};
//!Display, manage, and manipulate images in the Gui
class GuiImage : public GuiElement
{
public:
//!Constructor
//!\param img Pointer to GuiImageData element
GuiImage(GuiImageData * img);
//!\overload
//!Sets up a new image from the image data specified
//!\param img
//!\param w Image width
//!\param h Image height
GuiImage(u8 * img, int w, int h);
//!\overload
//!Creates an image filled with the specified color
//!\param w Image width
//!\param h Image height
//!\param c Image color
GuiImage(int w, int h, GXColor c);
//!Destructor
~GuiImage();
//!Sets the image rotation angle for drawing
//!\param a Angle (in degrees)
void SetAngle(float a);
//!Sets the number of times to draw the image horizontally
//!\param t Number of times to draw the image
void SetTile(int t);
//!Constantly called to draw the image
void Draw();
//!Gets the image data
//!\return pointer to image data
u8 * GetImage();
//!Sets up a new image using the GuiImageData object specified
//!\param img Pointer to GuiImageData object
void SetImage(GuiImageData * img);
//!\overload
//!\param img Pointer to image data
//!\param w Width
//!\param h Height
void SetImage(u8 * img, int w, int h);
//!Gets the pixel color at the specified coordinates of the image
//!\param x X coordinate
//!\param y Y coordinate
GXColor GetPixel(int x, int y);
//!Sets the pixel color at the specified coordinates of the image
//!\param x X coordinate
//!\param y Y coordinate
//!\param color Pixel color
void SetPixel(int x, int y, GXColor color);
//!Directly modifies the image data to create a color-striped effect
//!Alters the RGB values by the specified amount
//!\param s Amount to increment/decrement the RGB values in the image
void ColorStripe(int s);
//!Sets a stripe effect on the image, overlaying alpha blended rectangles
//!Does not alter the image data
//!\param s Alpha amount to draw over the image
void SetStripe(int s);
protected:
int imgType;
u8 * image;
f32 imageangle;
int tile;
int stripe;
int imgType; //!< Type of image data (IMAGE_TEXTURE, IMAGE_COLOR, IMAGE_DATA)
u8 * image; //!< Poiner to image data. May be shared with GuiImageData data
f32 imageangle; //!< Angle to draw the image
int tile; //!< Number of times to draw (tile) the image horizontally
int stripe; //!< Alpha value (0-255) to apply a stripe effect to the texture
};
//!Display, manage, and manipulate text in the Gui
class GuiText : public GuiElement
{
public:
//!Constructor
//!\param t Text
//!\param s Font size
//!\param c Font color
GuiText(const char * t, int s, GXColor c);
//!\overload
//!\Assumes SetPresets() has been called to setup preferred text attributes
//!\param t Text
GuiText(const char * t);
//!Destructor
~GuiText();
//!Sets the text of the GuiText element
//!\param t Text
void SetText(const char * t);
//!Sets up preset values to be used by GuiText(t)
//!Useful when printing multiple text elements, all with the same attributes set
//!\param sz Font size
//!\param c Font color
//!\param w Maximum width of texture image (for text wrapping)
//!\param s Font size
//!\param h Text alignment (horizontal)
//!\param v Text alignment (vertical)
void SetPresets(int sz, GXColor c, int w, u16 s, int h, int v);
//!Sets the font size
//!\param s Font size
void SetFontSize(int s);
//!Sets the maximum width of the drawn texture image
//!If the text exceeds this, it is wrapped to the next line
//!\param w Maximum width
void SetMaxWidth(int w);
//!Sets the font color
//!\param c Font color
void SetColor(GXColor c);
//!Sets the FreeTypeGX style attributes
//!\param s Style attributes
void SetStyle(u16 s);
//!Sets the text alignment
//!\param hor Horizontal alignment (ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTRE)
//!\param vert Vertical alignment (ALIGN_TOP, ALIGN_BOTTOM, ALIGN_MIDDLE)
void SetAlignment(int hor, int vert);
//!Constantly called to draw the text
void Draw();
protected:
wchar_t* text;
int size;
int maxWidth;
u16 style;
GXColor color;
wchar_t* text; //!< Unicode text value
int size; //!< Font size
int maxWidth; //!< Maximum width of the generated text object (for text wrapping)
u16 style; //!< FreeTypeGX style attributes
GXColor color; //!< Font color
};
//!Display, manage, and manipulate buttons in the Gui
//!Buttons can have images, icons, text, and sound set (all of which are optional)
class GuiButton : public GuiElement
{
public:
//!Constructor
//!\param w Width
//!\param h Height
GuiButton(int w, int h);
//!Destructor
~GuiButton();
//!Sets the button's image
//!\param i Pointer to GuiImage object
void SetImage(GuiImage* i);
//!Sets the button's image on over
//!\param i Pointer to GuiImage object
void SetImageOver(GuiImage* i);
//!Sets the button's icon
//!\param i Pointer to GuiImage object
void SetIcon(GuiImage* i);
//!Sets the button's icon on over
//!\param i Pointer to GuiImage object
void SetIconOver(GuiImage* i);
//!Sets the button's label
//!\param t Pointer to GuiText object
void SetLabel(GuiText* t);
void SetLabelOver(GuiText* t);
//!\overload
//!\param t Pointer to GuiText object
//!\param n Index of label to set
void SetLabel(GuiText* t, int n);
//!Sets the button's label on over (eg: different colored text)
//!\param t Pointer to GuiText object
void SetLabelOver(GuiText* t);
//!\overload
//!\param t Pointer to GuiText object
//!\param n Index of label to set
void SetLabelOver(GuiText* t, int n);
//!Sets the sound to play on over
//!\param s Pointer to GuiSound object
void SetSoundOver(GuiSound * s);
//!Sets the sound to play on click
//!\param s Pointer to GuiSound object
void SetSoundClick(GuiSound * s);
//!Constantly called to draw the GuiButton
void Draw();
//!Constantly called to allow the GuiButton to respond to updated input data
//!\param t Pointer to a GuiTrigger, containing the current input data from PAD/WPAD
void Update(GuiTrigger * t);
protected:
GuiImage * image;
GuiImage * imageOver;
GuiImage * icon;
GuiImage * iconOver;
GuiText * label[3];
GuiText * labelOver[3];
GuiSound * soundOver;
GuiSound * soundClick;
GuiImage * image; //!< Button image
GuiImage * imageOver; //!< Button image on wiimote cursor over
GuiImage * icon; //!< Button icon (drawn after button image)
GuiImage * iconOver; //!< Button icon on wiimote cursor over
GuiText * label[3]; //!< Label(s) to display
GuiText * labelOver[3]; //!< Label(s) to display on wiimote cursor over
GuiSound * soundOver; //!< Sound to play on wiimote cursor over
GuiSound * soundClick; //!< Sound to play on click
};
//!Display a list of files
class GuiFileBrowser : public GuiElement
{
public:
@ -348,6 +613,8 @@ class GuiFileBrowser : public GuiElement
GuiImageData * scrollbarBox;
GuiImageData * scrollbarBoxOver;
GuiSound * btnSoundOver;
GuiSound * btnSoundClick;
GuiTrigger * trigA;
};
@ -357,6 +624,7 @@ typedef struct _optionlist {
char value[MAX_OPTIONS][150];
} OptionList;
//!Display a list of menu options
class GuiOptionBrowser : public GuiElement
{
public:
@ -403,6 +671,8 @@ class GuiOptionBrowser : public GuiElement
GuiImageData * scrollbarBox;
GuiImageData * scrollbarBoxOver;
GuiSound * btnSoundOver;
GuiSound * btnSoundClick;
GuiTrigger * trigA;
};
@ -416,6 +686,7 @@ typedef struct _savelist {
int files[2][100];
} SaveList;
//!Display a list of game save files, with screenshots and file information
class GuiSaveBrowser : public GuiElement
{
public:
@ -464,6 +735,8 @@ class GuiSaveBrowser : public GuiElement
GuiImageData * scrollbarBox;
GuiImageData * scrollbarBoxOver;
GuiSound * btnSoundOver;
GuiSound * btnSoundClick;
GuiTrigger * trigA;
};
@ -471,6 +744,7 @@ typedef struct _keytype {
char ch, chShift;
} Key;
//!On-screen keyboard
class GuiKeyboard : public GuiWindow
{
public:
@ -512,6 +786,7 @@ class GuiKeyboard : public GuiWindow
GuiImageData * keyLarge;
GuiImageData * keyLargeOver;
GuiSound * keySoundOver;
GuiSound * keySoundClick;
GuiTrigger * trigA;
};

View File

@ -29,6 +29,9 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
else
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
btnSoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, SOUND_PCM);
btnSoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, SOUND_PCM);
bgGameSelection = new GuiImageData(bg_game_selection_png);
bgGameSelectionImg = new GuiImage(bgGameSelection);
bgGameSelectionImg->SetParent(this);
@ -63,6 +66,8 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
arrowUpBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
arrowUpBtn->SetSelectable(false);
arrowUpBtn->SetTrigger(trigA);
arrowUpBtn->SetSoundOver(btnSoundOver);
arrowUpBtn->SetSoundClick(btnSoundClick);
arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight());
arrowDownBtn->SetParent(this);
@ -71,6 +76,8 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
arrowDownBtn->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
arrowDownBtn->SetSelectable(false);
arrowDownBtn->SetTrigger(trigA);
arrowDownBtn->SetSoundOver(btnSoundOver);
arrowDownBtn->SetSoundClick(btnSoundClick);
scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight());
scrollbarBoxBtn->SetParent(this);
@ -94,6 +101,7 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
gameList[i]->SetImageOver(gameListBg[i]);
gameList[i]->SetPosition(2,30*i+3);
gameList[i]->SetTrigger(trigA);
gameList[i]->SetSoundClick(btnSoundClick);
}
}
@ -126,6 +134,8 @@ GuiFileBrowser::~GuiFileBrowser()
delete scrollbarBox;
delete scrollbarBoxOver;
delete btnSoundOver;
delete btnSoundClick;
delete trigA;
for(int i=0; i<PAGESIZE; i++)

View File

@ -99,6 +99,7 @@ GuiKeyboard::GuiKeyboard(char * t, u16 max)
keyLargeOver = new GuiImageData(keyboard_largekey_over_png);
keySoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, SOUND_PCM);
keySoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, SOUND_PCM);
trigA = new GuiTrigger;
if(GCSettings.WiimoteOrientation)
@ -114,6 +115,7 @@ GuiKeyboard::GuiKeyboard(char * t, u16 max)
keyBack->SetImageOver(keyBackOverImg);
keyBack->SetLabel(keyBackText);
keyBack->SetSoundOver(keySoundOver);
keyBack->SetSoundClick(keySoundClick);
keyBack->SetTrigger(trigA);
keyBack->SetPosition(10*42+40, 0*42+80);
keyBack->SetEffectGrow();
@ -127,6 +129,7 @@ GuiKeyboard::GuiKeyboard(char * t, u16 max)
keyCaps->SetImageOver(keyCapsOverImg);
keyCaps->SetLabel(keyCapsText);
keyCaps->SetSoundOver(keySoundOver);
keyCaps->SetSoundClick(keySoundClick);
keyCaps->SetTrigger(trigA);
keyCaps->SetPosition(0, 2*42+80);
keyCaps->SetEffectGrow();
@ -140,6 +143,7 @@ GuiKeyboard::GuiKeyboard(char * t, u16 max)
keyShift->SetImageOver(keyShiftOverImg);
keyShift->SetLabel(keyShiftText);
keyShift->SetSoundOver(keySoundOver);
keyShift->SetSoundClick(keySoundClick);
keyShift->SetTrigger(trigA);
keyShift->SetPosition(21, 3*42+80);
keyShift->SetEffectGrow();
@ -151,6 +155,7 @@ GuiKeyboard::GuiKeyboard(char * t, u16 max)
keySpace->SetImage(keySpaceImg);
keySpace->SetImageOver(keySpaceOverImg);
keySpace->SetSoundOver(keySoundOver);
keySpace->SetSoundClick(keySoundClick);
keySpace->SetTrigger(trigA);
keySpace->SetPosition(0, 4*42+80);
keySpace->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
@ -170,6 +175,7 @@ GuiKeyboard::GuiKeyboard(char * t, u16 max)
keyBtn[i][j]->SetImage(keyImg[i][j]);
keyBtn[i][j]->SetImageOver(keyImgOver[i][j]);
keyBtn[i][j]->SetSoundOver(keySoundOver);
keyBtn[i][j]->SetSoundClick(keySoundClick);
keyBtn[i][j]->SetTrigger(trigA);
keyBtn[i][j]->SetLabel(keyTxt[i][j]);
keyBtn[i][j]->SetPosition(j*42+21*i+40, i*42+80);
@ -209,6 +215,7 @@ GuiKeyboard::~GuiKeyboard()
delete keyLarge;
delete keyLargeOver;
delete keySoundOver;
delete keySoundClick;
delete trigA;
for(int i=0; i<4; i++)

View File

@ -30,6 +30,9 @@ GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l)
else
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
btnSoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, SOUND_PCM);
btnSoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, SOUND_PCM);
bgOptions = new GuiImageData(bg_options_png);
bgOptionsImg = new GuiImage(bgOptions);
bgOptionsImg->SetParent(this);
@ -63,6 +66,8 @@ GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l)
arrowUpBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
arrowUpBtn->SetSelectable(false);
arrowUpBtn->SetTrigger(trigA);
arrowUpBtn->SetSoundOver(btnSoundOver);
arrowUpBtn->SetSoundClick(btnSoundClick);
arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight());
arrowDownBtn->SetParent(this);
@ -71,6 +76,8 @@ GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l)
arrowDownBtn->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
arrowDownBtn->SetSelectable(false);
arrowDownBtn->SetTrigger(trigA);
arrowDownBtn->SetSoundOver(btnSoundOver);
arrowDownBtn->SetSoundClick(btnSoundClick);
scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight());
scrollbarBoxBtn->SetParent(this);
@ -98,6 +105,7 @@ GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l)
optionBtn[i]->SetImageOver(optionBg[i]);
optionBtn[i]->SetPosition(0,30*i+3);
optionBtn[i]->SetTrigger(trigA);
optionBtn[i]->SetSoundClick(btnSoundClick);
}
}
@ -130,6 +138,8 @@ GuiOptionBrowser::~GuiOptionBrowser()
delete scrollbarBoxOver;
delete trigA;
delete btnSoundOver;
delete btnSoundClick;
for(int i=0; i<PAGESIZE; i++)
{

View File

@ -37,6 +37,9 @@ GuiSaveBrowser::GuiSaveBrowser(int w, int h, SaveList * s, int a)
else
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
btnSoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, SOUND_PCM);
btnSoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, SOUND_PCM);
gameSave = new GuiImageData(button_gamesave_png);
gameSaveOver = new GuiImageData(button_gamesave_over_png);
gameSaveBlank = new GuiImageData(button_gamesave_blank_png);
@ -67,6 +70,8 @@ GuiSaveBrowser::GuiSaveBrowser(int w, int h, SaveList * s, int a)
arrowUpBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
arrowUpBtn->SetSelectable(false);
arrowUpBtn->SetTrigger(trigA);
arrowUpBtn->SetSoundOver(btnSoundOver);
arrowUpBtn->SetSoundClick(btnSoundClick);
arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight());
arrowDownBtn->SetParent(this);
@ -75,6 +80,8 @@ GuiSaveBrowser::GuiSaveBrowser(int w, int h, SaveList * s, int a)
arrowDownBtn->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
arrowDownBtn->SetSelectable(false);
arrowDownBtn->SetTrigger(trigA);
arrowDownBtn->SetSoundOver(btnSoundOver);
arrowDownBtn->SetSoundClick(btnSoundClick);
scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight());
scrollbarBoxBtn->SetParent(this);
@ -116,6 +123,8 @@ GuiSaveBrowser::GuiSaveBrowser(int w, int h, SaveList * s, int a)
saveBtn[i]->SetState(STATE_DISABLED);
saveBtn[i]->SetEffectGrow();
saveBtn[i]->SetVisible(false);
saveBtn[i]->SetSoundOver(btnSoundOver);
saveBtn[i]->SetSoundClick(btnSoundClick);
}
}
@ -147,6 +156,8 @@ GuiSaveBrowser::~GuiSaveBrowser()
delete scrollbarBox;
delete scrollbarBoxOver;
delete btnSoundOver;
delete btnSoundClick;
delete trigA;
for(int i=0; i<SAVELISTSIZE; i++)

View File

@ -20,6 +20,7 @@ GuiSound::GuiSound(const u8 * snd, s32 len, int t)
type = t;
voice = -1;
volume = 100;
loop = false;
}
/**
@ -27,6 +28,10 @@ GuiSound::GuiSound(const u8 * snd, s32 len, int t)
*/
GuiSound::~GuiSound()
{
#ifndef NO_SOUND
if(type == SOUND_OGG)
StopOgg();
#endif
}
void GuiSound::Play()
@ -40,13 +45,16 @@ void GuiSound::Play()
vol = 255*(volume/100.0)*(GCSettings.SFXVolume/100.0);
voice = ASND_GetFirstUnusedVoice();
if(voice >= 0)
ASND_SetVoice(voice, VOICE_MONO_8BIT, 8000, 0,
ASND_SetVoice(voice, VOICE_STEREO_16BIT, 48000, 0,
(u8 *)sound, length, vol, vol, NULL);
break;
case SOUND_OGG:
voice = 0;
if(loop)
PlayOgg(mem_open((char *)sound, length), 0, OGG_INFINITE_TIME);
else
PlayOgg(mem_open((char *)sound, length), 0, OGG_ONE_TIME);
SetVolumeOgg(255*(volume/100.0));
break;
}
@ -110,6 +118,14 @@ void GuiSound::Resume()
#endif
}
bool GuiSound::IsPlaying()
{
if(ASND_StatusVoice(voice) == SND_WORKING || ASND_StatusVoice(voice) == SND_WAITING)
return true;
else
return false;
}
void GuiSound::SetVolume(int vol)
{
#ifndef NO_SOUND
@ -132,3 +148,8 @@ void GuiSound::SetVolume(int vol)
}
#endif
}
void GuiSound::SetLoop(bool l)
{
loop = l;
}

View File

@ -67,6 +67,8 @@ static GuiImage * bgImg = NULL;
static GuiImage * bgTopImg = NULL;
static GuiImage * bgBottomImg = NULL;
static GuiSound * bgMusic = NULL;
static GuiSound * enterSound = NULL;
static GuiSound * exitSound = NULL;
static GuiWindow * mainWindow = NULL;
static GuiText * settingText = NULL;
static int lastMenu = MENU_NONE;
@ -133,6 +135,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, const ch
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
GuiImageData btnOutlineOver(button_over_png);
GuiTrigger trigA;
@ -172,6 +175,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, const ch
btn1.SetImage(&btn1Img);
btn1.SetImageOver(&btn1ImgOver);
btn1.SetSoundOver(&btnSoundOver);
btn1.SetSoundClick(&btnSoundClick);
btn1.SetTrigger(&trigA);
btn1.SetState(STATE_SELECTED);
btn1.SetEffectGrow();
@ -186,6 +190,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, const ch
btn2.SetImage(&btn2Img);
btn2.SetImageOver(&btn2ImgOver);
btn2.SetSoundOver(&btnSoundOver);
btn2.SetSoundClick(&btnSoundClick);
btn2.SetTrigger(&trigA);
btn2.SetEffectGrow();
@ -335,6 +340,7 @@ ProgressWindow(char *title, char *msg)
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
GuiImageData btnOutlineOver(button_over_png);
GuiTrigger trigA;
@ -572,6 +578,7 @@ static void OnScreenKeyboard(char * var, u16 maxlen)
GuiKeyboard keyboard(var, maxlen);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
GuiImageData btnOutlineOver(button_over_png);
GuiTrigger trigA;
@ -592,6 +599,7 @@ static void OnScreenKeyboard(char * var, u16 maxlen)
okBtn.SetImage(&okBtnImg);
okBtn.SetImageOver(&okBtnImgOver);
okBtn.SetSoundOver(&btnSoundOver);
okBtn.SetSoundClick(&btnSoundClick);
okBtn.SetTrigger(&trigA);
okBtn.SetEffectGrow();
@ -605,6 +613,7 @@ static void OnScreenKeyboard(char * var, u16 maxlen)
cancelBtn.SetImage(&cancelBtnImg);
cancelBtn.SetImageOver(&cancelBtnImgOver);
cancelBtn.SetSoundOver(&btnSoundOver);
cancelBtn.SetSoundClick(&btnSoundClick);
cancelBtn.SetTrigger(&trigA);
cancelBtn.SetEffectGrow();
@ -652,6 +661,7 @@ SettingWindow(const char * title, GuiWindow * w)
GuiWindow promptWindow(448,288);
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
GuiImageData btnOutlineOver(button_over_png);
GuiTrigger trigA;
@ -679,6 +689,7 @@ SettingWindow(const char * title, GuiWindow * w)
okBtn.SetImage(&okBtnImg);
okBtn.SetImageOver(&okBtnImgOver);
okBtn.SetSoundOver(&btnSoundOver);
okBtn.SetSoundClick(&btnSoundClick);
okBtn.SetTrigger(&trigA);
okBtn.SetEffectGrow();
@ -692,6 +703,7 @@ SettingWindow(const char * title, GuiWindow * w)
cancelBtn.SetImage(&cancelBtnImg);
cancelBtn.SetImageOver(&cancelBtnImgOver);
cancelBtn.SetSoundOver(&btnSoundOver);
cancelBtn.SetSoundClick(&btnSoundClick);
cancelBtn.SetTrigger(&trigA);
cancelBtn.SetEffectGrow();
@ -891,6 +903,7 @@ static int MenuGameSelection()
titleTxt.SetPosition(50,50);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData iconHome(icon_home_png);
GuiImageData iconSettings(icon_settings_png);
GuiImageData btnOutline(button_png);
@ -917,6 +930,7 @@ static int MenuGameSelection()
settingsBtn.SetImage(&settingsBtnImg);
settingsBtn.SetImageOver(&settingsBtnImgOver);
settingsBtn.SetSoundOver(&btnSoundOver);
settingsBtn.SetSoundClick(&btnSoundClick);
settingsBtn.SetTrigger(&trigA);
settingsBtn.SetEffectGrow();
@ -934,6 +948,7 @@ static int MenuGameSelection()
exitBtn.SetImage(&exitBtnImg);
exitBtn.SetImageOver(&exitBtnImgOver);
exitBtn.SetSoundOver(&btnSoundOver);
exitBtn.SetSoundClick(&btnSoundClick);
exitBtn.SetTrigger(&trigA);
exitBtn.SetTrigger(&trigHome);
exitBtn.SetEffectGrow();
@ -1118,6 +1133,7 @@ static int MenuGame()
titleTxt.SetPosition(50,50);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
GuiImageData btnOutlineOver(button_over_png);
GuiImageData btnCloseOutline(button_small_png);
@ -1155,6 +1171,7 @@ static int MenuGame()
saveBtn.SetImageOver(&saveBtnImgOver);
saveBtn.SetIcon(&saveBtnIcon);
saveBtn.SetSoundOver(&btnSoundOver);
saveBtn.SetSoundClick(&btnSoundClick);
saveBtn.SetTrigger(&trigA);
saveBtn.SetEffectGrow();
@ -1170,6 +1187,7 @@ static int MenuGame()
loadBtn.SetImageOver(&loadBtnImgOver);
loadBtn.SetIcon(&loadBtnIcon);
loadBtn.SetSoundOver(&btnSoundOver);
loadBtn.SetSoundClick(&btnSoundClick);
loadBtn.SetTrigger(&trigA);
loadBtn.SetEffectGrow();
@ -1185,6 +1203,7 @@ static int MenuGame()
resetBtn.SetImageOver(&resetBtnImgOver);
resetBtn.SetIcon(&resetBtnIcon);
resetBtn.SetSoundOver(&btnSoundOver);
resetBtn.SetSoundClick(&btnSoundClick);
resetBtn.SetTrigger(&trigA);
resetBtn.SetEffectGrow();
@ -1200,6 +1219,7 @@ static int MenuGame()
controllerBtn.SetImageOver(&controllerBtnImgOver);
controllerBtn.SetIcon(&controllerBtnIcon);
controllerBtn.SetSoundOver(&btnSoundOver);
controllerBtn.SetSoundClick(&btnSoundClick);
controllerBtn.SetTrigger(&trigA);
controllerBtn.SetEffectGrow();
@ -1215,6 +1235,7 @@ static int MenuGame()
cheatsBtn.SetImageOver(&cheatsBtnImgOver);
cheatsBtn.SetIcon(&cheatsBtnIcon);
cheatsBtn.SetSoundOver(&btnSoundOver);
cheatsBtn.SetSoundClick(&btnSoundClick);
cheatsBtn.SetTrigger(&trigA);
cheatsBtn.SetEffectGrow();
@ -1228,6 +1249,7 @@ static int MenuGame()
mainmenuBtn.SetImage(&mainmenuBtnImg);
mainmenuBtn.SetImageOver(&mainmenuBtnImgOver);
mainmenuBtn.SetSoundOver(&btnSoundOver);
mainmenuBtn.SetSoundClick(&btnSoundClick);
mainmenuBtn.SetTrigger(&trigA);
mainmenuBtn.SetEffectGrow();
@ -1241,6 +1263,7 @@ static int MenuGame()
closeBtn.SetImage(&closeBtnImg);
closeBtn.SetImageOver(&closeBtnImgOver);
closeBtn.SetSoundOver(&btnSoundOver);
closeBtn.SetSoundClick(&btnSoundClick);
closeBtn.SetTrigger(&trigA);
closeBtn.SetTrigger(&trigHome);
closeBtn.SetEffectGrow();
@ -1310,6 +1333,7 @@ static int MenuGame()
if(lastMenu == MENU_NONE)
{
enterSound->Play();
bgTopImg->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 35);
closeBtn.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 35);
titleTxt.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 35);
@ -1411,6 +1435,7 @@ static int MenuGame()
{
menu = MENU_EXIT;
exitSound->Play();
bgTopImg->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 35);
closeBtn.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 35);
titleTxt.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 35);
@ -1424,13 +1449,13 @@ static int MenuGame()
batteryBtn[3]->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 35);
#endif
saveBtn.SetEffect(EFFECT_FADE, -15);
loadBtn.SetEffect(EFFECT_FADE, -15);
resetBtn.SetEffect(EFFECT_FADE, -15);
controllerBtn.SetEffect(EFFECT_FADE, -15);
cheatsBtn.SetEffect(EFFECT_FADE, -15);
saveBtn.SetEffect(EFFECT_FADE, -20);
loadBtn.SetEffect(EFFECT_FADE, -20);
resetBtn.SetEffect(EFFECT_FADE, -20);
controllerBtn.SetEffect(EFFECT_FADE, -20);
cheatsBtn.SetEffect(EFFECT_FADE, -20);
usleep(150000); // wait for effects to finish
usleep(200000); // wait for effects to finish
}
}
@ -1485,6 +1510,7 @@ static int MenuGameSaves(int action)
titleTxt.SetText("Save Game");
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
GuiImageData btnOutlineOver(button_over_png);
GuiImageData btnCloseOutline(button_small_png);
@ -1509,6 +1535,7 @@ static int MenuGameSaves(int action)
backBtn.SetImage(&backBtnImg);
backBtn.SetImageOver(&backBtnImgOver);
backBtn.SetSoundOver(&btnSoundOver);
backBtn.SetSoundClick(&btnSoundClick);
backBtn.SetTrigger(&trigA);
backBtn.SetEffectGrow();
@ -1522,6 +1549,7 @@ static int MenuGameSaves(int action)
closeBtn.SetImage(&closeBtnImg);
closeBtn.SetImageOver(&closeBtnImgOver);
closeBtn.SetSoundOver(&btnSoundOver);
closeBtn.SetSoundClick(&btnSoundClick);
closeBtn.SetTrigger(&trigA);
closeBtn.SetTrigger(&trigHome);
closeBtn.SetEffectGrow();
@ -1704,6 +1732,7 @@ static int MenuGameSaves(int action)
{
menu = MENU_EXIT;
exitSound->Play();
bgTopImg->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 35);
closeBtn.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 35);
titleTxt.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 35);
@ -1711,9 +1740,9 @@ static int MenuGameSaves(int action)
bgBottomImg->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 35);
btnLogo->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 35);
w.SetEffect(EFFECT_FADE, -15);
w.SetEffect(EFFECT_FADE, -20);
usleep(150000); // wait for effects to finish
usleep(200000); // wait for effects to finish
}
}
@ -1752,6 +1781,7 @@ static int MenuGameCheats()
titleTxt.SetPosition(50,50);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
GuiImageData btnOutlineOver(button_over_png);
GuiImageData btnCloseOutline(button_small_png);
@ -1776,6 +1806,7 @@ static int MenuGameCheats()
backBtn.SetImage(&backBtnImg);
backBtn.SetImageOver(&backBtnImgOver);
backBtn.SetSoundOver(&btnSoundOver);
backBtn.SetSoundClick(&btnSoundClick);
backBtn.SetTrigger(&trigA);
backBtn.SetEffectGrow();
@ -1789,6 +1820,7 @@ static int MenuGameCheats()
closeBtn.SetImage(&closeBtnImg);
closeBtn.SetImageOver(&closeBtnImgOver);
closeBtn.SetSoundOver(&btnSoundOver);
closeBtn.SetSoundClick(&btnSoundClick);
closeBtn.SetTrigger(&trigA);
closeBtn.SetTrigger(&trigHome);
closeBtn.SetEffectGrow();
@ -1828,6 +1860,7 @@ static int MenuGameCheats()
{
menu = MENU_EXIT;
exitSound->Play();
bgTopImg->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 35);
closeBtn.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 35);
titleTxt.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 35);
@ -1835,9 +1868,9 @@ static int MenuGameCheats()
bgBottomImg->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 35);
btnLogo->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 35);
w.SetEffect(EFFECT_FADE, -15);
w.SetEffect(EFFECT_FADE, -20);
usleep(150000); // wait for effects to finish
usleep(200000); // wait for effects to finish
}
}
HaltGui();
@ -1859,6 +1892,7 @@ static int MenuSettings()
titleTxt.SetPosition(50,50);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
GuiImageData btnOutlineOver(button_over_png);
GuiImageData btnLargeOutline(button_large_png);
@ -1888,6 +1922,7 @@ static int MenuSettings()
mappingBtn.SetImageOver(&mappingBtnImgOver);
mappingBtn.SetIcon(&mappingBtnIcon);
mappingBtn.SetSoundOver(&btnSoundOver);
mappingBtn.SetSoundClick(&btnSoundClick);
mappingBtn.SetTrigger(&trigA);
mappingBtn.SetEffectGrow();
@ -1904,6 +1939,7 @@ static int MenuSettings()
videoBtn.SetImageOver(&videoBtnImgOver);
videoBtn.SetIcon(&videoBtnIcon);
videoBtn.SetSoundOver(&btnSoundOver);
videoBtn.SetSoundClick(&btnSoundClick);
videoBtn.SetTrigger(&trigA);
videoBtn.SetEffectGrow();
@ -1925,6 +1961,7 @@ static int MenuSettings()
savingBtn.SetImageOver(&savingBtnImgOver);
savingBtn.SetIcon(&fileBtnIcon);
savingBtn.SetSoundOver(&btnSoundOver);
savingBtn.SetSoundClick(&btnSoundClick);
savingBtn.SetTrigger(&trigA);
savingBtn.SetEffectGrow();
@ -1941,6 +1978,7 @@ static int MenuSettings()
menuBtn.SetImageOver(&menuBtnImgOver);
menuBtn.SetIcon(&menuBtnIcon);
menuBtn.SetSoundOver(&btnSoundOver);
menuBtn.SetSoundClick(&btnSoundClick);
menuBtn.SetTrigger(&trigA);
menuBtn.SetEffectGrow();
@ -1957,6 +1995,7 @@ static int MenuSettings()
networkBtn.SetImageOver(&networkBtnImgOver);
networkBtn.SetIcon(&networkBtnIcon);
networkBtn.SetSoundOver(&btnSoundOver);
networkBtn.SetSoundClick(&btnSoundClick);
networkBtn.SetTrigger(&trigA);
networkBtn.SetEffectGrow();
@ -1970,6 +2009,7 @@ static int MenuSettings()
backBtn.SetImage(&backBtnImg);
backBtn.SetImageOver(&backBtnImgOver);
backBtn.SetSoundOver(&btnSoundOver);
backBtn.SetSoundClick(&btnSoundClick);
backBtn.SetTrigger(&trigA);
backBtn.SetEffectGrow();
@ -1983,6 +2023,7 @@ static int MenuSettings()
resetBtn.SetImage(&resetBtnImg);
resetBtn.SetImageOver(&resetBtnImgOver);
resetBtn.SetSoundOver(&btnSoundOver);
resetBtn.SetSoundClick(&btnSoundClick);
resetBtn.SetTrigger(&trigA);
resetBtn.SetEffectGrow();
@ -2068,6 +2109,7 @@ static int MenuSettingsMappings()
titleTxt.SetPosition(50,50);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
GuiImageData btnOutlineOver(button_over_png);
GuiImageData btnLargeOutline(button_large_png);
@ -2096,6 +2138,7 @@ static int MenuSettingsMappings()
snesBtn.SetImageOver(&snesBtnImgOver);
snesBtn.SetIcon(&snesBtnIcon);
snesBtn.SetSoundOver(&btnSoundOver);
snesBtn.SetSoundClick(&btnSoundClick);
snesBtn.SetTrigger(&trigA);
snesBtn.SetEffectGrow();
@ -2112,6 +2155,7 @@ static int MenuSettingsMappings()
superscopeBtn.SetImageOver(&superscopeBtnImgOver);
superscopeBtn.SetIcon(&superscopeBtnIcon);
superscopeBtn.SetSoundOver(&btnSoundOver);
superscopeBtn.SetSoundClick(&btnSoundClick);
superscopeBtn.SetTrigger(&trigA);
superscopeBtn.SetEffectGrow();
@ -2128,6 +2172,7 @@ static int MenuSettingsMappings()
mouseBtn.SetImageOver(&mouseBtnImgOver);
mouseBtn.SetIcon(&mouseBtnIcon);
mouseBtn.SetSoundOver(&btnSoundOver);
mouseBtn.SetSoundClick(&btnSoundClick);
mouseBtn.SetTrigger(&trigA);
mouseBtn.SetEffectGrow();
@ -2143,6 +2188,7 @@ static int MenuSettingsMappings()
justifierBtn.SetImageOver(&justifierBtnImgOver);
justifierBtn.SetIcon(&justifierBtnIcon);
justifierBtn.SetSoundOver(&btnSoundOver);
justifierBtn.SetSoundClick(&btnSoundClick);
justifierBtn.SetTrigger(&trigA);
justifierBtn.SetEffectGrow();
@ -2156,6 +2202,7 @@ static int MenuSettingsMappings()
backBtn.SetImage(&backBtnImg);
backBtn.SetImageOver(&backBtnImgOver);
backBtn.SetSoundOver(&btnSoundOver);
backBtn.SetSoundClick(&btnSoundClick);
backBtn.SetTrigger(&trigA);
backBtn.SetEffectGrow();
@ -2224,6 +2271,7 @@ static int MenuSettingsMappingsController()
subtitleTxt.SetPosition(50,60);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
GuiImageData btnOutlineOver(button_over_png);
GuiImageData btnLargeOutline(button_large_png);
@ -2252,6 +2300,7 @@ static int MenuSettingsMappingsController()
gamecubeBtn.SetImageOver(&gamecubeBtnImgOver);
gamecubeBtn.SetIcon(&gamecubeBtnIcon);
gamecubeBtn.SetSoundOver(&btnSoundOver);
gamecubeBtn.SetSoundClick(&btnSoundClick);
gamecubeBtn.SetTrigger(&trigA);
gamecubeBtn.SetEffectGrow();
@ -2267,6 +2316,7 @@ static int MenuSettingsMappingsController()
wiimoteBtn.SetImageOver(&wiimoteBtnImgOver);
wiimoteBtn.SetIcon(&wiimoteBtnIcon);
wiimoteBtn.SetSoundOver(&btnSoundOver);
wiimoteBtn.SetSoundClick(&btnSoundClick);
wiimoteBtn.SetTrigger(&trigA);
wiimoteBtn.SetEffectGrow();
@ -2283,6 +2333,7 @@ static int MenuSettingsMappingsController()
classicBtn.SetImageOver(&classicBtnImgOver);
classicBtn.SetIcon(&classicBtnIcon);
classicBtn.SetSoundOver(&btnSoundOver);
classicBtn.SetSoundClick(&btnSoundClick);
classicBtn.SetTrigger(&trigA);
classicBtn.SetEffectGrow();
@ -2304,6 +2355,7 @@ static int MenuSettingsMappingsController()
nunchukBtn.SetImageOver(&nunchukBtnImgOver);
nunchukBtn.SetIcon(&nunchukBtnIcon);
nunchukBtn.SetSoundOver(&btnSoundOver);
nunchukBtn.SetSoundClick(&btnSoundClick);
nunchukBtn.SetTrigger(&trigA);
nunchukBtn.SetEffectGrow();
@ -2317,6 +2369,7 @@ static int MenuSettingsMappingsController()
backBtn.SetImage(&backBtnImg);
backBtn.SetImageOver(&backBtnImgOver);
backBtn.SetSoundOver(&btnSoundOver);
backBtn.SetSoundClick(&btnSoundClick);
backBtn.SetTrigger(&trigA);
backBtn.SetEffectGrow();
@ -2386,6 +2439,7 @@ ButtonMappingWindow()
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
GuiImageData btnOutlineOver(button_over_png);
GuiTrigger trigA;
@ -2520,6 +2574,7 @@ static int MenuSettingsMappingsMap()
subtitleTxt.SetPosition(50,60);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
GuiImageData btnOutlineOver(button_over_png);
@ -2539,6 +2594,7 @@ static int MenuSettingsMappingsMap()
backBtn.SetImage(&backBtnImg);
backBtn.SetImageOver(&backBtnImgOver);
backBtn.SetSoundOver(&btnSoundOver);
backBtn.SetSoundClick(&btnSoundClick);
backBtn.SetTrigger(&trigA);
backBtn.SetEffectGrow();
@ -2865,6 +2921,7 @@ static int MenuSettingsVideo()
titleTxt.SetPosition(50,50);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
GuiImageData btnOutlineOver(button_over_png);
@ -2884,6 +2941,7 @@ static int MenuSettingsVideo()
backBtn.SetImage(&backBtnImg);
backBtn.SetImageOver(&backBtnImgOver);
backBtn.SetSoundOver(&btnSoundOver);
backBtn.SetSoundClick(&btnSoundClick);
backBtn.SetTrigger(&trigA);
backBtn.SetEffectGrow();
@ -2991,6 +3049,7 @@ static int MenuSettingsFile()
titleTxt.SetPosition(50,50);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
GuiImageData btnOutlineOver(button_over_png);
@ -3010,6 +3069,7 @@ static int MenuSettingsFile()
backBtn.SetImage(&backBtnImg);
backBtn.SetImageOver(&backBtnImgOver);
backBtn.SetSoundOver(&btnSoundOver);
backBtn.SetSoundClick(&btnSoundClick);
backBtn.SetTrigger(&trigA);
backBtn.SetEffectGrow();
@ -3171,6 +3231,7 @@ static int MenuSettingsMenu()
titleTxt.SetPosition(50,50);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
GuiImageData btnOutlineOver(button_over_png);
@ -3190,6 +3251,7 @@ static int MenuSettingsMenu()
backBtn.SetImage(&backBtnImg);
backBtn.SetImageOver(&backBtnImgOver);
backBtn.SetSoundOver(&btnSoundOver);
backBtn.SetSoundClick(&btnSoundClick);
backBtn.SetTrigger(&trigA);
backBtn.SetEffectGrow();
@ -3303,6 +3365,7 @@ static int MenuSettingsNetwork()
titleTxt.SetPosition(50,50);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
GuiImageData btnOutlineOver(button_over_png);
@ -3322,6 +3385,7 @@ static int MenuSettingsNetwork()
backBtn.SetImage(&backBtnImg);
backBtn.SetImageOver(&backBtnImgOver);
backBtn.SetSoundOver(&btnSoundOver);
backBtn.SetSoundClick(&btnSoundClick);
backBtn.SetTrigger(&trigA);
backBtn.SetEffectGrow();
@ -3419,6 +3483,8 @@ MainMenu (int menu)
else
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
GuiImageData bgTop(bg_top_png);
bgTopImg = new GuiImage(&bgTop);
GuiImageData bgBottom(bg_bottom_png);
@ -3437,6 +3503,8 @@ MainMenu (int menu)
btnLogo->SetImage(&logoImg);
btnLogo->SetImageOver(&logoImgOver);
btnLogo->SetLabel(&logoTxt);
btnLogo->SetSoundOver(&btnSoundOver);
btnLogo->SetSoundClick(&btnSoundClick);
btnLogo->SetTrigger(&trigA);
btnLogo->SetUpdateCallback(WindowCredits);
@ -3460,6 +3528,11 @@ MainMenu (int menu)
#ifndef NO_SOUND
bgMusic = new GuiSound(bg_music_ogg, bg_music_ogg_size, SOUND_OGG);
bgMusic->SetVolume(GCSettings.MusicVolume);
bgMusic->SetLoop(true);
enterSound = new GuiSound(enter_ogg, enter_ogg_size, SOUND_OGG);
enterSound->SetVolume(GCSettings.SFXVolume);
exitSound = new GuiSound(exit_ogg, exit_ogg_size, SOUND_OGG);
exitSound->SetVolume(GCSettings.SFXVolume);
if(currentMenu == MENU_GAMESELECTION) bgMusic->Play(); // startup music
#endif
@ -3517,12 +3590,18 @@ MainMenu (int menu)
ShutoffRumble();
#endif
#ifndef NO_SOUND
if(exitSound->IsPlaying())
usleep(150000); // give sound more time to play
#endif
CancelAction();
HaltGui();
#ifndef NO_SOUND
bgMusic->Stop();
delete bgMusic;
delete enterSound;
delete exitSound;
#endif
//delete memTxt;

Binary file not shown.

Binary file not shown.

BIN
source/ngc/sounds/enter.ogg Normal file

Binary file not shown.

BIN
source/ngc/sounds/exit.ogg Normal file

Binary file not shown.

View File

@ -582,8 +582,8 @@ InitGCVideo ()
// widescreen fix
if(CONF_GetAspectRatio() == CONF_ASPECT_16_9)
{
vmode->viWidth = 688;
vmode->viXOrigin = (VI_MAX_WIDTH_PAL - 688) / 2;
vmode->viWidth = VI_MAX_WIDTH_PAL-12;
vmode->viXOrigin = ((VI_MAX_WIDTH_PAL - vmode->viWidth) / 2) + 2;
}
#endif

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<app version="009">
<file url="http://snes9x-gx.googlecode.com/files/Snes9x%20GX%20009%20-%20Wii.zip"></file>
<app version="010">
<file url="http://snes9x-gx.googlecode.com/files/Snes9x%20GX%204.0.0%20-%20Wii.zip"></file>
</app>