+added proper license/copyright stuff

~modified file headers
~separated GUI engine from menus
This commit is contained in:
ekeeke31 2009-05-13 14:26:55 +00:00
parent dbb3645557
commit b08e66855a
73 changed files with 1854 additions and 1317 deletions

440
LICENSE.txt Normal file
View File

@ -0,0 +1,440 @@
MAME License:
-------------
Redistribution and use of this code or any derivative works are permitted
provided that the following conditions are met:
* Redistributions may not be sold, nor may they be used in a commercial
product or activity.
* Redistributions that are modified from the original source must include the
complete source code, including the source code for all components used by a
binary built from the modified sources. However, as a special exception, the
source code distributed need not include anything that is normally distributed
(in either source or binary form) with the major components (compiler, kernel,
and so on) of the operating system on which the executable runs, unless that
component itself accompanies the executable.
* Redistributions must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
LIBTREMOR license:
------------------
Copyright (c) 2002, Xiph.org Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ASNDLIB License:
----------------
Copyright (c) 2008 Francisco Muñoz 'Hermes' <www.elotrolado.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
- The names of the contributors may not be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
GNU License:
------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@ -1,9 +1,9 @@
/****************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* Cartridge Hardware support
*
* Copyright (C) Eke-Eke, GC/Wii port
* Copyright (C) 2007, 2008, 2009 Eke-Eke (GCN/Wii port)
*
* Most cartridge protections documented by Haze
* (http://haze.mameworld.info/)

View File

@ -1,8 +1,8 @@
/****************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* Cartridge Hardware support
*
* Copyright (C) Eke-Eke, GC/Wii port
* Copyright (C) 2007, 2008, 2009 Eke-Eke (GCN/Wii port)
*
* Lots of protection mechanism have been discovered by Haze
* (http://haze.mameworld.info/)

View File

@ -1,8 +1,8 @@
/****************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* Serial EEPROM support
*
* Copyright (C) Eke-Eke, GC/Wii port
* Copyright (C) 2007, 2008, 2009 Eke-Eke (GCN/Wii port)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,8 +1,8 @@
/****************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* Serial EEPROM support
*
* Copyright (C) Eke-Eke, GC/Wii port
* Copyright (C) 2007, 2008, 2009 Eke-Eke (GCN/Wii port)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,8 +1,8 @@
/***************************************************************************************
* Genesis Plus 1.2a
* SRAM Hardware
* Genesis Plus
* Backup SRAM support
*
* code by Eke-Eke, GC/Wii port
* Copyright (C) 2007, 2008, 2009 Eke-Eke (GCN/Wii port)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,8 +1,8 @@
/***************************************************************************************
* Genesis Plus 1.2a
* SRAM Hardware
* Genesis Plus
* Backup SRAM support
*
* code by Eke-Eke, GC/Wii port
* Copyright (C) 2007, 2008, 2009 Eke-Eke (GCN/Wii port)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,13 +1,14 @@
// basic, incomplete SSP160x (SSP1601?) interpreter
// with SVP memory controller emu
/*
basic, incomplete SSP160x (SSP1601?) interpreter
with SVP memory controller emu
// (c) Copyright 2008, Grazvydas "notaz" Ignotas
// Free for non-commercial use.
(c) Copyright 2008, Grazvydas "notaz" Ignotas
Free for non-commercial use.
// For commercial use, separate licencing terms must be obtained.
For commercial use, separate licencing terms must be obtained.
/* modified for Genesis Plus GCN port (EkeEke) - inverted mode&addr in ssp_PMC register (more logical ?)*/
Modified for Genesis Plus GX (Eke-Eke), added big endian support, fixed mode & addr
*/
/*

View File

@ -1,14 +1,15 @@
/* The SVP chip emulator
/*
basic, incomplete SSP160x (SSP1601?) interpreter
with SVP memory controller emu
(c) Copyright 2008, Grazvydas "notaz" Ignotas
Free for non-commercial use.
For commercial use, separate licencing terms must be obtained.
Modified for Genesis Plus GX (Eke-Eke): added BIG ENDIAN support, fixed addr/code inversion
*/
/* modified for Genesis Plus GCN port, added BIG ENDIAN support (EkeEke)*/
#ifndef _SSP16_H_
#define _SSP16_H_

View File

@ -1,12 +1,14 @@
// The SVP chip emulator
/*
basic, incomplete SSP160x (SSP1601?) interpreter
with SVP memory controller emu
// (c) Copyright 2008, Grazvydas "notaz" Ignotas
// Free for non-commercial use.
(c) Copyright 2008, Grazvydas "notaz" Ignotas
Free for non-commercial use.
// For commercial use, separate licencing terms must be obtained.
For commercial use, separate licencing terms must be obtained.
/* SVP Controller */
/* modified for Genesis Plus GCN port (eke-eke) */
Modified for Genesis Plus GX (Eke-Eke): added BIG ENDIAN support, fixed addr/code inversion
*/
#include "shared.h"

View File

@ -1,13 +1,14 @@
/* The SVP chip emulator
/*
basic, incomplete SSP160x (SSP1601?) interpreter
with SVP memory controller emu
(c) Copyright 2008, Grazvydas "notaz" Ignotas
Free for non-commercial use.
For commercial use, separate licencing terms must be obtained.
Modified for Genesis Plus GX (Eke-Eke): added BIG ENDIAN support, fixed addr/code inversion
*/
/* SVP Controller */
/* modified for Genesis Plus GCN port (eke-eke) */
#ifndef _SVP_H_
#define _SVP_H_

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* Peripheral Input Support
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* Peripheral Input Support
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* I/O Chip
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* I/O Chip
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* Genesis internals & Bus controller
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* Genesis internals & Bus controller
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
*
* ARAM wrapper for libogc
*
* code by Softdev (2006)
* Softdev (2006)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
*
* ARAM wrapper for libogc
*
* code by Softdev (2006)
* Softdev (2006)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
*
* Genesis Plus GX configuration file support
*
* code by Eke-Eke (2008)
* Eke-Eke (2008)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
*
* Genesis Plus GX configuration file support
*
* code by Eke-Eke (2008)
* Eke-Eke (2008)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,8 @@
*
* Low-level DVD access
*
* code by Softdev (2006), Eke-Eke (2007,2008)
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,8 @@
*
* Low-level DVD access
*
* code by Softdev (2006), Eke-Eke (2007,2008)
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,10 @@
/*
* file_dvd.c
*
* generic ISO9660/Joliet DVD loading support
* ISO9660/Joliet DVD loading support
*
* code by Eke-Eke (2008)
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,10 @@
/*
* file_dvd.c
*
* generic ISO9660/Joliet DVD loading support
* ISO9660/Joliet DVD loading support
*
* code by Eke-Eke (2008)
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/*
* file_fat.c
*
* generic FAT loading support
* FAT loading support
*
* code by Eke-Eke (2008)
* Eke-Eke (2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/*
* file_fat.c
*
* generic FAT loading support
* FAT loading support
*
* code by Eke-Eke (2008)
* Eke-Eke (2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,8 @@
*
* FAT and Memory Card SRAM/Savestate files managment
*
* code by Softdev (2006), Eke-Eke (2007,2008)
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,12 +23,16 @@
***************************************************************************/
#include "shared.h"
#include "file_mem.h"
#include "font.h"
#include "menu.h"
#include "filesel.h"
#include "saveicon.h"
#include "dvd.h"
/* Global ROM filename */
char rom_filename[MAXJOLIET];
/* Support for MemCards */
/**
* libOGC System Work Area
@ -43,49 +48,6 @@ static card_stat CardStatus;
* 64k SRAM + 2k Icon
*/
static u8 savebuffer[STATE_SIZE] ATTRIBUTE_ALIGN (32);
char rom_filename[MAXJOLIET];
int ManageSRAM(u8 direction, u8 device);
int ManageState(u8 direction, u8 device);
/****************************************************************************
* FILE autoload (SRAM/FreezeState or Config File)
*
*
*****************************************************************************/
void memfile_autoload(s8 autosram, s8 autostate)
{
/* this should be transparent to the user */
SILENT = 1;
/* SRAM */
if (autosram != -1)
ManageSRAM(1,autosram);
/* STATE */
if (autostate != -1)
ManageState(1,autostate);
SILENT = 0;
}
void memfile_autosave(s8 autosram, s8 autostate)
{
int crccheck = crc32 (0, sram.sram, 0x10000);
/* this should be transparent to the user */
SILENT = 1;
/* SRAM */
if ((autosram != -1) && (crccheck != sram.crc))
ManageSRAM(0, autosram);
/* STATE */
if (autostate != -1)
ManageState(0,autostate);
SILENT = 0;
}
/****************************************************************************
@ -180,7 +142,7 @@ static int FAT_ManageFile(char *filename, int direction, int filetype)
*
* Function returns TRUE on success.
*****************************************************************************/
int MountTheCard (u8 slot)
static int MountTheCard (u8 slot)
{
int tries = 0;
int CardError;
@ -205,7 +167,7 @@ int MountTheCard (u8 slot)
* Wrapper to search through the files on the card.
* Returns TRUE if found.
****************************************************************************/
int CardFileExists (char *filename, u8 slot)
static int CardFileExists (char *filename, u8 slot)
{
int CardError = CARD_FindFirst (slot, &CardDir, TRUE);
while (CardError != CARD_ERROR_NOFILE)
@ -216,6 +178,46 @@ int CardFileExists (char *filename, u8 slot)
return 0;
}
/****************************************************************************
* FILE autoload (SRAM/FreezeState or Config File)
*
*
*****************************************************************************/
void memfile_autoload(s8 autosram, s8 autostate)
{
/* this should be transparent to the user */
SILENT = 1;
/* SRAM */
if (autosram != -1)
ManageSRAM(1,autosram);
/* STATE */
if (autostate != -1)
ManageState(1,autostate);
SILENT = 0;
}
void memfile_autosave(s8 autosram, s8 autostate)
{
int crccheck = crc32 (0, sram.sram, 0x10000);
/* this should be transparent to the user */
SILENT = 1;
/* SRAM */
if ((autosram != -1) && (crccheck != sram.crc))
ManageSRAM(0, autosram);
/* STATE */
if (autostate != -1)
ManageState(0,autostate);
SILENT = 0;
}
/****************************************************************************
* ManageSRAM
*

View File

@ -0,0 +1,35 @@
/*
* file_mem.c
*
* FAT and Memory Card SRAM/Savestate files managment
*
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
***************************************************************************/
#ifndef _FILE_MEM_H
#define _FILE_MEM_H
extern int ManageSRAM(u8 direction, u8 device);
extern int ManageState(u8 direction, u8 device);
extern void memfile_autosave(s8 autosram, s8 autostate);
extern void memfile_autoload(s8 autosram, s8 autostate);
extern char rom_filename[256];
#endif

View File

@ -3,7 +3,7 @@
*
* Generic ROM history list managment
*
* code by Martin Disibio (6/17/08)
* Martin Disibio (6/17/08)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
*
* Generic ROM history list managment
*
* code by Martin Disibio (6/17/08)
* Martin Disibio (6/17/08)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -7,7 +7,8 @@
* Only partial support is included, in that only the first file within the archive
* is considered to be a ROM image.
*
* code by Softdev (2006), Eke-Eke (2007,2008)
* Softdev (2006)
* Eke-Eke (2007,2008)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,10 +1,31 @@
/******************************************************************************
*
* Nintendo Gamecube Zip Support
* unzip.c
*
* Zip Support
*
* Only partial support is included, in that only the first file within the archive
* is considered to be a ROM image.
***************************************************************************/
*
* Softdev (2006)
* Eke-Eke (2007,2008)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
********************************************************************************/
#ifndef _UNZIP_H_
#define _UNZIP_H_

View File

@ -3,7 +3,8 @@
*
* File Selection menu
*
* code by Softdev (2006), Eke-Eke (2007,2008)
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,8 +23,8 @@
********************************************************************************/
#include "shared.h"
#include "menu.h"
#include "font.h"
#include "gui.h"
#include "file_dvd.h"
#include "file_fat.h"
#include "filesel.h"
@ -32,11 +33,9 @@
#include <wiiuse/wpad.h>
#endif
/* this is emulator specific ! */
#define PAGESIZE 11
#define PAGEOFFSET 120
/* Global Variables */
int maxfiles = 0;
int offset = 0;

View File

@ -3,7 +3,8 @@
*
* File Selection menu
*
* code by Softdev (2006), Eke-Eke (2007,2008)
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,10 +1,10 @@
/*****************************************************************************
* font.c
*
* IPL FONT Engine, based on Qoob MP3 Player Font
*
* code by Softdev (2006), Eke-Eke(2007-2008)
* IPL FONT Engine, using GX hardware
*
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,10 +24,8 @@
#include "shared.h"
#include "font.h"
#include "menu.h"
#include "gui.h"
/* Backdrop Frame Width (to avoid writing outside of the background frame) */
u16 back_framewidth = 640;
int font_size[256], fheight;
#ifndef HW_RVL
@ -135,7 +133,7 @@ static void DrawChar(unsigned char c, int xpos, int ypos, int size, GXColor colo
void write_font(int x, int y, char *string)
{
int ox = x;
while (*string && (x < (ox + back_framewidth)))
while (*string && (x < (ox + 640)))
{
DrawChar(*string, x -(vmode->fbWidth/2), y-(vmode->efbHeight/2),fontHeader->cell_height,(GXColor)WHITE);
x += font_size[(u8)*string];
@ -147,7 +145,7 @@ void WriteCentre( int y, char *string)
{
int x, t;
for (x=t=0; t<strlen(string); t++) x += font_size[(u8)string[t]];
if (x>back_framewidth) x=back_framewidth;
if (x>640) x=640;
x = (640 - x) >> 1;
write_font(x, y, string);
}

View File

@ -3,8 +3,8 @@
*
* IPL Font Engine, powered by GX hardware
*
* code Eke-Eke(2009)
*
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -44,6 +44,6 @@ extern void WriteText(char *text, int size, int x, int y);
extern void fntDrawBoxFilled (int x1, int y1, int x2, int y2, int color);
extern int fheight;
extern int font_size[256];
extern u16 back_framewidth;
extern u8 SILENT;
#endif

View File

@ -3,7 +3,8 @@
*
* Genesis Plus GX Game Genie
*
* code by Softdev (2006), Eke-Eke (2007,2008)
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,7 +24,7 @@
#include "shared.h"
#include "font.h"
#include "menu.h"
#include "gui.h"
#define MAXCODES 8

974
source/gx/gui/gui.c Normal file
View File

@ -0,0 +1,974 @@
/****************************************************************************
* menu.c
*
* GUI Engine, using GX hardware
*
* Eke-Eke (2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
***************************************************************************/
#include "shared.h"
#include "gui.h"
#include "font.h"
#ifdef HW_RVL
gx_texture *w_pointer;
#endif
/* background color */
static GXColor bg_color;
/* prompt window button data */
static butn_data button_text_data =
{
{NULL,NULL},
{Button_text_png,Button_text_over_png}
};
/*****************************************************************************/
/* Generic GUI routines */
/*****************************************************************************/
/* Allocate texture images data */
void GUI_InitMenu(gui_menu *menu)
{
int i;
gui_item *item;
gui_butn *button;
gui_image *image;
/* background elements */
for (i=0; i<menu->max_images; i++)
{
image = &menu->bg_images[i];
image->texture = gxTextureOpenPNG(image->data,0);
}
for (i=0; i<2; i++)
{
/* key helpers */
item = menu->helpers[i];
if (item)
item->texture = gxTextureOpenPNG(item->data,0);
/* arrows */
button = menu->arrows[i];
if (button)
{
if (!button->data->texture[0])
button->data->texture[0] = gxTextureOpenPNG(button->data->image[0],0);
if (!button->data->texture[1])
button->data->texture[1] = gxTextureOpenPNG(button->data->image[1],0);
/* initial state */
button->state &= ~BUTTON_VISIBLE;
if (((i==0) && (menu->offset != 0)) || ((i==1) && (menu->offset + menu->max_buttons) < menu->max_items))
button->state |= BUTTON_VISIBLE;
}
}
/* menu buttons */
for (i=0; i<menu->max_buttons; i++)
{
button = &menu->buttons[i];
if (button->data)
{
if (!button->data->texture[0])
button->data->texture[0] = gxTextureOpenPNG(button->data->image[0],0);
if (!button->data->texture[1])
button->data->texture[1] = gxTextureOpenPNG(button->data->image[1],0);
}
}
/* menu items */
for (i=0; i<menu->max_items; i++)
{
item = &menu->items[i];
if (item->data)
item->texture = gxTextureOpenPNG(item->data,0);
}
}
/* release allocated memory */
void GUI_DeleteMenu(gui_menu *menu)
{
int i;
gui_butn *button;
gui_item *item;
gui_image *image;
/* background elements */
for (i=0; i<menu->max_images; i++)
{
image = &menu->bg_images[i];
gxTextureClose(&image->texture);
}
for (i=0; i<2; i++)
{
/* key helpers */
item = menu->helpers[i];
if (item)
gxTextureClose(&item->texture);
/* arrows */
button = menu->arrows[i];
if (button)
{
gxTextureClose(&button->data->texture[0]);
gxTextureClose(&button->data->texture[1]);
}
}
/* menu buttons */
for (i=0; i<menu->max_buttons; i++)
{
button = &menu->buttons[i];
if (button->data)
{
gxTextureClose(&button->data->texture[0]);
gxTextureClose(&button->data->texture[1]);
}
}
/* menu items */
for (i=0; i<menu->max_items; i++)
{
item = &menu->items[i];
gxTextureClose(&item->texture);
}
}
/* set default background */
void GUI_SetBgColor(GXColor color)
{
bg_color.r = color.r;
bg_color.g = color.g;
bg_color.b = color.b;
bg_color.a = color.a;
}
/* Menu Rendering */
void GUI_DrawMenu(gui_menu *menu)
{
int i;
gui_item *item;
gui_butn *button;
gui_image *image;
/* background color */
if (menu->screenshot)
{
gxClearScreen((GXColor)BLACK);
gxDrawScreenshot(128);
}
else
{
gxClearScreen(bg_color);
}
/* background elements */
for (i=0; i<menu->max_images; i++)
{
image = &menu->bg_images[i];
if (image->state & IMAGE_REPEAT)
gxDrawTextureRepeat(image->texture,image->x,image->y,image->w,image->h,image->alpha);
else if (image->state & IMAGE_VISIBLE)
gxDrawTexture(image->texture,image->x,image->y,image->w,image->h,image->alpha);
}
/* menu title */
FONT_write(menu->title, 22,10,56,640,(GXColor)WHITE);
/* draw buttons + items */
for (i=0; i<menu->max_buttons; i++)
{
button = &menu->buttons[i];
if (button->state & BUTTON_VISIBLE)
{
/* draw button + items */
item = &menu->items[menu->offset +i];
if ((i == menu->selected) && (button->state & BUTTON_ACTIVE))
{
if (button->data) gxDrawTexture(button->data->texture[1],button->x-4,button->y-4,button->w+8,button->h+8,255);
if (item->texture)
{
gxDrawTexture(item->texture, item->x-4,item->y-4,item->w+8,item->h+8,255);
FONT_writeCenter(item->text,18,button->x+4,item->x-4,button->y+(button->h - 36)/2+18,(GXColor)DARK_GREY);
}
else
{
FONT_writeCenter(item->text,18,item->x+2,item->x+item->w+2,button->y+(button->h-18)/2+18,(GXColor)DARK_GREY);
}
/* update help comment */
if (menu->helpers[1]) strcpy(menu->helpers[1]->comment,item->comment);
}
else
{
if (button->data)
gxDrawTexture(button->data->texture[0],button->x,button->y,button->w, button->h,255);
if (item->texture)
{
gxDrawTexture(item->texture,item->x,item->y,item->w,item->h,255);
FONT_writeCenter(item->text,16,button->x+8,item->x,button->y+(button->h - 32)/2+16,(GXColor)DARK_GREY);
}
else
{
FONT_writeCenter(item->text,16,item->x,item->x+item->w,button->y+(button->h - 16)/2+16,(GXColor)DARK_GREY);
}
}
}
}
/* draw arrow */
for (i=0; i<2; i++)
{
button = menu->arrows[i];
if (button)
{
if (button->state & BUTTON_VISIBLE)
{
if (menu->selected == (menu->max_buttons + i))
gxDrawTexture(button->data->texture[1],button->x-2,button->y-2,button->w+4,button->h+4,255);
else
gxDrawTexture(button->data->texture[0],button->x,button->y,button->w, button->h,255);
}
}
}
/* left comment */
item = menu->helpers[0];
if (item)
{
gxDrawTexture(item->texture,item->x,item->y,item->w,item->h,255);
FONT_write(item->comment,16,item->x+item->w+6,item->y+(item->h-16)/2 + 16,640,(GXColor)WHITE);
}
/* right comment */
item = menu->helpers[1];
if (item)
{
if (menu->selected < menu->max_buttons)
{
gxDrawTexture(item->texture,item->x,item->y,item->w,item->h,255);
FONT_alignRight(item->comment,16,item->x-6,item->y+(item->h-16)/2+16,(GXColor)WHITE);
}
}
}
/* Menu Transitions effect */
void GUI_DrawMenuFX(gui_menu *menu, u8 speed, u8 out)
{
int i,temp,xoffset,yoffset;
int max_offset = 0;
u8 item_alpha = 255;
GXColor text_color = DARK_GREY;
gui_item *item;
gui_butn *button;
gui_image *image;
/* find maximal offset */
for (i=0; i<menu->max_images; i++)
{
image = &menu->bg_images[i];
if (image->state & IMAGE_SLIDE_LEFT)
{
temp = image->x + image->w;
if (max_offset < temp) max_offset = temp;
}
else if (image->state & IMAGE_SLIDE_RIGHT)
{
temp = 640 - image->x;
if (max_offset < temp) max_offset = temp;
}
if (image->state & IMAGE_SLIDE_TOP)
{
temp = image->y + image->h;
if (max_offset < temp) max_offset = temp;
}
else if (image->state & IMAGE_SLIDE_BOTTOM)
{
temp = 480 - image->y;
if (max_offset < temp) max_offset = temp;
}
}
temp = max_offset;
/* Alpha steps */
int alpha = out ? 255 : 0;
int alpha_step = (255 * speed) / max_offset;
if (out) alpha_step = -alpha_step;
/* Let's loop until final position has been reached */
while (temp > 0)
{
/* background color */
if (menu->screenshot)
{
gxClearScreen((GXColor)BLACK);
if (alpha > 127) gxDrawScreenshot(128);
else gxDrawScreenshot(255 - alpha);
}
else
{
gxClearScreen(bg_color);
}
/* background images */
for (i=0; i<menu->max_images; i++)
{
image = &menu->bg_images[i];
/* X offset */
if (image->state & IMAGE_SLIDE_LEFT)
xoffset = out ? (temp - max_offset) : (-temp);
else if (image->state & IMAGE_SLIDE_RIGHT)
xoffset = out ? (max_offset - temp) : (temp);
else
xoffset = 0;
/* Y offset */
if (image->state & IMAGE_SLIDE_TOP)
yoffset = out ? (temp - max_offset) : (-temp);
else if (image->state & IMAGE_SLIDE_BOTTOM)
yoffset = out ? (max_offset - temp) : (temp);
else
yoffset = 0;
/* draw image */
if ((image->state & IMAGE_FADE) && ((out && (image->alpha > alpha)) || (!out && (image->alpha < alpha))))
{
/* FADE In-Out */
if (image->state & IMAGE_REPEAT) gxDrawTextureRepeat(image->texture,image->x+xoffset,image->y+yoffset,image->w,image->h,alpha);
else if (image->state & IMAGE_VISIBLE)gxDrawTexture(image->texture,image->x+xoffset,image->y+yoffset,image->w,image->h,alpha);
}
else
{
if (image->state & IMAGE_REPEAT) gxDrawTextureRepeat(image->texture,image->x+xoffset,image->y+yoffset,image->w,image->h,image->alpha);
else if (image->state & IMAGE_VISIBLE)gxDrawTexture(image->texture,image->x+xoffset,image->y+yoffset,image->w,image->h,image->alpha);
}
}
/* menu title */
if (menu->bg_images[2].state & IMAGE_SLIDE_TOP)
{
FONT_write(menu->title, 22,10,out ? (56 + temp - max_offset) : (56 -temp),640,(GXColor)WHITE);
}
else
{
FONT_write(menu->title, 22,10,56,640,(GXColor)WHITE);
}
/* draw buttons + items */
for (i=0; i<menu->max_buttons; i++)
{
button = &menu->buttons[i];
if (button->state & BUTTON_VISIBLE)
{
/* X offset */
if (button->state & BUTTON_SLIDE_LEFT)
xoffset = out ? (temp - max_offset) : (-temp);
else if (button->state & BUTTON_SLIDE_RIGHT)
xoffset = out ? (max_offset - temp) : (temp);
else
xoffset = 0;
/* Y offset */
if (button->state & BUTTON_SLIDE_TOP)
yoffset = out ? (temp - max_offset) : (-temp);
else if (button->state & BUTTON_SLIDE_BOTTOM)
yoffset = out ? (max_offset - temp) : (temp);
else
yoffset = 0;
/* Alpha transparency */
if (button->state & BUTTON_FADE)
{
item_alpha = alpha;
text_color.a = alpha;
}
else
{
item_alpha = 255;
text_color.a = 255;
}
/* draw button + items */
item = &menu->items[menu->offset + i];
if (button->data) gxDrawTexture(button->data->texture[0],button->x+xoffset,button->y+yoffset,button->w, button->h,item_alpha);
if (item->texture)
{
gxDrawTexture(item->texture,item->x+xoffset,item->y+yoffset,item->w,item->h,item_alpha);
FONT_writeCenter(item->text,16,button->x+xoffset+8,item->x+xoffset,button->y+yoffset+(button->h - 32)/2+16,text_color);
}
else
{
FONT_writeCenter(item->text,16,item->x+xoffset,item->x+item->w+xoffset,button->y+yoffset+(button->h - 16)/2+16,text_color);
}
}
}
/* update offset */
temp -= speed;
/* update alpha */
alpha += alpha_step;
if (alpha > 255) alpha = 255;
else if (alpha < 0) alpha = 0;
/* copy EFB to XFB */
gxSetScreen ();
}
/* final position */
if (!out)
{
GUI_DrawMenu(menu);
gxSetScreen ();
}
else if (menu->screenshot)
{
gxClearScreen((GXColor)BLACK);
gxDrawScreenshot(255);
gxSetScreen ();
}
}
/* Basic Fading */
void GUI_FadeOut()
{
int alpha = 0;
while (alpha < 256)
{
gxDrawRectangle(0, 0, 640, 480, alpha, (GXColor)BLACK);
gxSetScreen();
alpha +=3;
}
}
/* Window Prompt */
/* prompt window slides in & out */
int GUI_WindowPrompt(gui_menu *parent, char *title, char *items[], u8 nb_items)
{
int i, ret, quit = 0;
s32 selected = 0;
s32 old;
butn_data *data = &button_text_data;
s16 p;
#ifdef HW_RVL
int x,y;
struct orient_t orient;
#endif
/* initialize buttons data */
data->texture[0] = gxTextureOpenPNG(data->image[0],0);
data->texture[1] = gxTextureOpenPNG(data->image[1],0);
/* initialize texture window */
gx_texture *window = gxTextureOpenPNG(Frame_s1_png,0);
gx_texture *top = gxTextureOpenPNG(Frame_s1_title_png,0);
/* get initial positions */
int w = data->texture[0]->width;
int h = data->texture[0]->height;
int xwindow = (640 - window->width)/2;
int ywindow = (480 - window->height)/2;
int xpos = xwindow + (window->width - w)/2;
int ypos = (window->height - top->height - (h*nb_items) - (nb_items-1)*20)/2;
ypos = ypos + ywindow + top->height;
/* set initial vertical offset */
int yoffset = ywindow + window->height;
/* reset help comment */
if (parent->helpers[1]) strcpy(parent->helpers[1]->comment,"");
/* slide in */
while (yoffset > 0)
{
/* draw parent menu */
GUI_DrawMenu(parent);
/* draw window */
gxDrawTexture(window,xwindow,ywindow-yoffset,window->width,window->height,230);
gxDrawTexture(top,xwindow,ywindow-yoffset,top->width,top->height,255);
/* draw title */
FONT_writeCenter(title,20,xwindow,xwindow+window->width,ywindow+(top->height-20)/2+20-yoffset,(GXColor)WHITE);
/* draw buttons + text */
for (i=0; i<nb_items; i++)
{
gxDrawTexture(data->texture[0],xpos,ypos+i*(20 + h)-yoffset,w,h,255);
FONT_writeCenter(items[i],18,xpos,xpos+w,ypos+i*(20 + h)+(h + 18)/2- yoffset,(GXColor)DARK_GREY);
}
/* update display */
gxSetScreen ();
/* slide speed */
yoffset -= 60;
}
/* draw menu */
while (quit == 0)
{
/* draw parent menu (should have been initialized first) */
GUI_DrawMenu(parent);
/* draw window */
gxDrawTexture(window,xwindow,ywindow,window->width,window->height,230);
gxDrawTexture(top,xwindow,ywindow,top->width,top->height,255);
/* draw title */
FONT_writeCenter(title,20,xwindow,xwindow+window->width,ywindow+(top->height-20)/2+20,(GXColor)WHITE);
/* draw buttons + text */
for (i=0; i<nb_items; i++)
{
if (i==selected)
{
gxDrawTexture(data->texture[1],xpos-4,ypos+i*(20+h)-4,w+8,h+8,255);
FONT_writeCenter(items[i],22,xpos,xpos+w,ypos+i*(20+h)+(h+22)/2,(GXColor)DARK_GREY);
}
else
{
gxDrawTexture(data->texture[0],xpos,ypos+i*(20 + h),w,h,255);
FONT_writeCenter(items[i],18,xpos,xpos+w,ypos+i*(20+h)+(h+18)/2,(GXColor)DARK_GREY);
}
}
old = selected;
p = m_input.keys;
#ifdef HW_RVL
if (Shutdown)
{
gxTextureClose(&w_pointer);
GUI_DeleteMenu(parent);
GUI_FadeOut();
shutdown();
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
}
else if (m_input.ir.valid)
{
/* get cursor position */
x = m_input.ir.x;
y = m_input.ir.y;
/* draw wiimote pointer */
WPAD_Orientation(0,&orient);
gxResetAngle(orient.roll);
gxDrawTexture(w_pointer,x,y,w_pointer->width,w_pointer->height,255);
gxResetAngle(0.0);
/* check for valid buttons */
selected = -1;
for (i=0; i<nb_items; i++)
{
if ((x>=xpos)&&(x<=(xpos+w))&&(y>=ypos+i*(20 + h))&&(y<=(ypos+i*(20+h)+h)))
{
selected = i;
break;
}
}
}
else
{
/* reinitialize selection */
if (selected == -1) selected = 0;
}
#endif
/* update screen */
gxSetScreen ();
/* update selection */
if (p&PAD_BUTTON_UP)
{
if (selected > 0) selected --;
}
else if (p&PAD_BUTTON_DOWN)
{
if (selected < (nb_items -1)) selected ++;
}
/* sound fx */
if (selected != old)
{
if (selected >= 0)
{
ASND_SetVoice(ASND_GetFirstUnusedVoice(),VOICE_MONO_16BIT,22050,0,(u8 *)button_over_pcm,button_over_pcm_size,
((int)config.sfx_volume * 255) / 100,((int)config.sfx_volume * 255) / 100,NULL);
}
}
if (p & PAD_BUTTON_A)
{
if (selected >= 0)
{
quit = 1;
ret = selected;
}
}
else if (p & PAD_BUTTON_B)
{
quit = 1;
ret = -1;
}
}
/* reset initial vertical offset */
yoffset = 0;
/* slide out */
while (yoffset < (ywindow + window->height))
{
/* draw parent menu */
GUI_DrawMenu(parent);
/* draw window + header */
gxDrawTexture(window,xwindow,ywindow-yoffset,window->width,window->height,230);
gxDrawTexture(top,xwindow,ywindow-yoffset,top->width,top->height,255);
/* draw title */
FONT_writeCenter(title,20,xwindow,xwindow+window->width,ywindow+(top->height-20)/2+20-yoffset,(GXColor)WHITE);
/* draw buttons + text */
for (i=0; i<nb_items; i++)
{
gxDrawTexture(data->texture[0],xpos,ypos+i*(20+h)-yoffset,w,h,255);
FONT_writeCenter(items[i],18,xpos,xpos+w,ypos+i*(20+h)+(h+18)/2-yoffset,(GXColor)WHITE);
}
yoffset += 60;
gxSetScreen ();
}
/* final position */
GUI_DrawMenu(parent);
gxSetScreen ();
/* close textures */
gxTextureClose(&window);
gxTextureClose(&data->texture[0]);
gxTextureClose(&data->texture[1]);
return ret;
}
int GUI_UpdateMenu(gui_menu *menu)
{
u16 p;
int ret = 0;
int selected = menu->selected;
int max_items = menu->max_items;
int max_buttons = menu->max_buttons;
gui_butn *button;
#ifdef HW_RVL
int i,x,y;
struct orient_t orient;
if (Shutdown)
{
GUI_DeleteMenu(menu);
GUI_FadeOut();
shutdown();
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
}
else if (m_input.ir.valid)
{
/* get cursor position */
x = m_input.ir.x;
y = m_input.ir.y;
/* draw wiimote pointer */
WPAD_Orientation(0,&orient);
gxResetAngle(orient.roll);
gxDrawTexture(w_pointer,x,y,w_pointer->width,w_pointer->height,255);
gxResetAngle(0.0);
/* check for valid buttons */
selected = max_buttons + 2;
for (i=0; i<max_buttons; i++)
{
button = &menu->buttons[i];
if ((button->state & BUTTON_ACTIVE)&&(x>=button->x)&&(x<=(button->x+button->w))&&(y>=button->y)&&(y<=(button->y+button->h)))
{
selected = i;
break;
}
}
for (i=0; i<2; i++)
{
button = menu->arrows[i];
if (button)
{
if (button->state & BUTTON_VISIBLE)
{
if ((x<=(button->x+button->w))&&(y>=button->y)&&(y<=(button->y+button->h)))
{
selected = max_buttons + i;
break;
}
}
}
}
}
else
{
/* reinitialize selection */
if (selected >= menu->max_buttons) selected = 0;
}
#endif
/* update screen */
gxSetScreen ();
/* update menu */
p = m_input.keys;
if (selected < max_buttons)
{
button = &menu->buttons[selected];
if (p & PAD_BUTTON_UP)
{
selected -= button->shift[0];
if (selected < 0)
{
selected = 0;
if (menu->offset)
menu->offset --;
}
}
else if (p & PAD_BUTTON_DOWN)
{
selected += button->shift[1];
if (selected >= max_buttons)
{
selected = max_buttons - 1;
if ((menu->offset + selected < (max_items - 1)))
menu->offset ++;
}
}
else if (p & PAD_BUTTON_LEFT)
{
if (button->state & BUTTON_SHIFT)
{
/* menu clicked */
ret = 2;
}
else
{
selected -= button->shift[2];
if (selected < 0)
{
selected = 0;
if (menu->offset)
menu->offset --;
}
}
}
else if (p & PAD_BUTTON_RIGHT)
{
if (button->state & BUTTON_SHIFT)
{
/* menu clicked */
ret = 1;
}
else
{
selected += button->shift[3];
if (selected >= max_buttons)
{
selected = max_buttons - 1;
if ((menu->offset + selected < (max_items - 1)))
menu->offset ++;
}
}
}
}
if (p & PAD_BUTTON_A)
{
if (selected < max_buttons) ret = 1; /* menu clicked */
else if (selected == max_buttons) menu->offset --; /* up arrow */
else if (selected == (max_buttons+1))menu->offset ++; /* down arrow */
}
else if ((p & PAD_BUTTON_B) || (p & PAD_TRIGGER_Z))
{
/* quit menu */
ret = -1;
}
/* selected item has changed ? */
if (menu->selected != selected)
{
if (selected < max_buttons)
{
/* sound fx */
button = &menu->buttons[selected];
if (button->state & BUTTON_OVER_SFX)
{
ASND_SetVoice(ASND_GetFirstUnusedVoice(),VOICE_MONO_16BIT,22050,0,(u8 *)button_over_pcm,button_over_pcm_size,
((int)config.sfx_volume * 255) / 100,((int)config.sfx_volume * 255) / 100,NULL);
}
}
else if (selected < (max_buttons + 2))
{
/* sound fx */
button = menu->arrows[selected-max_buttons];
if (button->state & BUTTON_OVER_SFX)
{
ASND_SetVoice(ASND_GetFirstUnusedVoice(),VOICE_MONO_16BIT,22050,0,(u8 *)button_over_pcm,button_over_pcm_size,
((int)config.sfx_volume * 255) / 100,((int)config.sfx_volume * 255) / 100,NULL);
}
}
/* update selection */
menu->selected = selected;
}
/* update arrows buttons status (items list) */
button = menu->arrows[0];
if (button)
{
if (menu->offset > 0) button->state |= BUTTON_VISIBLE;
else button->state &= ~BUTTON_VISIBLE;
}
button = menu->arrows[1];
if (button)
{
if ((menu->offset + max_buttons) < max_items) button->state |= BUTTON_VISIBLE;
else button->state &= ~BUTTON_VISIBLE;
}
if (ret > 0)
{
if (selected < max_buttons)
{
/* sound fx */
button = &menu->buttons[selected];
if (button->state & BUTTON_SELECT_SFX)
{
ASND_SetVoice(ASND_GetFirstUnusedVoice(),VOICE_MONO_16BIT,22050,0,(u8 *)button_select_pcm,button_select_pcm_size,
((int)config.sfx_volume * 255) / 100,((int)config.sfx_volume * 255) / 100,NULL);
}
}
}
return ret;
}
int GUI_RunMenu(gui_menu *menu)
{
int update = 0;
/* update menu */
while (!update)
{
GUI_DrawMenu(menu);
update = GUI_UpdateMenu(menu);
}
if (update == 2) return (-2-menu->offset-menu->selected);
else if (update == 1) return (menu->offset + menu->selected);
else return -1;
}
/* basic slide effect for option menus */
void GUI_SlideMenuTitle(gui_menu *m, int title_offset)
{
#ifdef HW_RVL
gui_butn *button;
int i,x,y;
struct orient_t orient;
#endif
char title[64];
strcpy(title,m->title);
while (title_offset > 0)
{
strcpy(m->title,title+title_offset);
m->title[strlen(title)-title_offset-1] = 0;
GUI_DrawMenu(m);
#ifdef HW_RVL
if (m_input.ir.valid)
{
/* get cursor position */
x = m_input.ir.x;
y = m_input.ir.y;
/* draw wiimote pointer */
WPAD_Orientation(0,&orient);
gxResetAngle(orient.roll);
gxDrawTexture(w_pointer,x,y,w_pointer->width,w_pointer->height,255);
gxResetAngle(0.0);
/* check for valid buttons */
m->selected = m->max_buttons + 2;
for (i=0; i<m->max_buttons; i++)
{
button = &m->buttons[i];
if ((button->state & BUTTON_ACTIVE)&&(x>=button->x)&&(x<=(button->x+button->w))&&(y>=button->y)&&(y<=(button->y+button->h)))
{
m->selected = i;
break;
}
}
for (i=0; i<2; i++)
{
button = m->arrows[i];
if (button)
{
if (button->state & BUTTON_VISIBLE)
{
if ((x<=(button->x+button->w))&&(y>=button->y)&&(y<=(button->y+button->h)))
{
m->selected = m->max_buttons + i;
break;
}
}
}
}
}
else
{
/* reinitialize selection */
if (m->selected >= m->max_buttons) m->selected = 0;
}
#endif
gxSetScreen ();
usleep(6000);
title_offset--;
}
strcpy(m->title,title);
}

View File

@ -1,9 +1,9 @@
/****************************************************************************
* menu.c
* gui.c
*
* Genesis Plus GX menu
* GUI engine, using GX hardware
*
* code by Eke-Eke (march 2009)
* Eke-Eke (2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -21,14 +21,13 @@
*
***************************************************************************/
#ifndef _MENU_H
#define _MENU_H
#ifndef _GUI_H
#define _GUI_H
#ifdef HW_RVL
#include <wiiuse/wpad.h>
#endif
/*****************************************************************************/
/* GUI Buttons state */
/*****************************************************************************/
@ -55,9 +54,90 @@
#define IMAGE_SLIDE_BOTTOM 0x40
/*****************************************************************************/
/* GUI png data */
/* Generic GUI structures */
/*****************************************************************************/
/* Item descriptor*/
typedef struct
{
gx_texture *texture; /* temporary texture data */
const u8 *data; /* pointer to png image data (items icon only) */
char text[64]; /* item string (items list only) */
char comment[64]; /* item comment */
u16 x; /* item image or text X position (upper left corner) */
u16 y; /* item image or text Y position (upper left corner) */
u16 w; /* item image or text width */
u16 h; /* item image or text height */
} gui_item;
/* Button Data descriptor */
typedef struct
{
gx_texture *texture[2]; /* temporary texture datas */
const u8 *image[2]; /* pointer to png image datas (default) */
} butn_data;
/* Button descriptor */
typedef struct
{
butn_data *data; /* pointer to button image/texture data */
u16 state; /* button state (ACTIVE,VISIBLE,SELECTED...) */
u8 shift[4]; /* direction offsets */
u16 x; /* button image X position (upper left corner) */
u16 y; /* button image Y position (upper left corner) */
u16 w; /* button image pixels width */
u16 h; /* button image pixels height */
} gui_butn;
/* Image descriptor */
typedef struct
{
gx_texture *texture; /* temporary texture data */
const u8 *data; /* pointer to png image data */
u8 state; /* image state (VISIBLE) */
u16 x; /* image X position (upper left corner) */
u16 y; /* image Y position (upper left corner) */
u16 w; /* image width */
u16 h; /* image height */
u8 alpha; /* alpha transparency */
} gui_image;
/* Menu descriptor */
typedef struct
{
char title[64]; /* menu title */
s8 selected; /* index of selected item */
s8 offset; /* items list offset */
u8 max_items; /* total number of items */
u8 max_buttons; /* total number of buttons */
u8 max_images; /* total number of background images */
gui_item *items; /* menu items */
gui_butn *buttons; /* menu buttons */
gui_image *bg_images; /* background images */
gui_item *helpers[2]; /* left & right key comments */
gui_butn *arrows[2]; /* arrows buttons */
bool screenshot; /* use gamescreen as background */
} gui_menu;
/* Menu Inputs */
struct t_input_menu
{
u32 connected;
u16 keys;
#ifdef HW_RVL
struct ir_t ir;
#endif
} m_input;
/* PNG images */
/* Intro */
extern const u8 Bg_intro_c1_png[];
extern const u8 Bg_intro_c2_png[];
extern const u8 Bg_intro_c3_png[];
extern const u8 Bg_intro_c4_png[];
extern const u8 Bg_intro_c5_png[];
/* Generic backgrounds */
extern const u8 Bg_main_png[];
extern const u8 Bg_overlay_png[];
@ -156,105 +236,28 @@ extern const u8 Key_A_gcn_png[];
extern const u8 Key_B_gcn_png[];
#endif
/* Generic sounds */
extern const u8 button_select_pcm[];
extern const u32 button_select_pcm_size;
/* Generic Sounds */
extern const u8 button_over_pcm[];
extern const u8 button_select_pcm[];
extern const u8 intro_pcm[];
extern const u32 button_select_pcm_size;
extern const u32 button_over_pcm_size;
extern const u32 intro_pcm_size;
/*****************************************************************************/
/* Generic GUI structures */
/*****************************************************************************/
/* Item descriptor*/
typedef struct
{
gx_texture *texture; /* temporary texture data */
const u8 *data; /* pointer to png image data (items icon only) */
char text[64]; /* item string (items list only) */
char comment[64]; /* item comment */
u16 x; /* item image or text X position (upper left corner) */
u16 y; /* item image or text Y position (upper left corner) */
u16 w; /* item image or text width */
u16 h; /* item image or text height */
} gui_item;
/* Button Data descriptor */
typedef struct
{
gx_texture *texture[2]; /* temporary texture datas */
const u8 *image[2]; /* pointer to png image datas (default) */
} butn_data;
/* Button descriptor */
typedef struct
{
butn_data *data; /* pointer to button image/texture data */
u16 state; /* button state (ACTIVE,VISIBLE,SELECTED...) */
u8 shift[4]; /* direction offsets */
u16 x; /* button image X position (upper left corner) */
u16 y; /* button image Y position (upper left corner) */
u16 w; /* button image pixels width */
u16 h; /* button image pixels height */
} gui_butn;
/* Image descriptor */
typedef struct
{
gx_texture *texture; /* temporary texture data */
const u8 *data; /* pointer to png image data */
u8 state; /* image state (VISIBLE) */
u16 x; /* image X position (upper left corner) */
u16 y; /* image Y position (upper left corner) */
u16 w; /* image width */
u16 h; /* image height */
u8 alpha; /* alpha transparency */
} gui_image;
/* Menu descriptor */
typedef struct
{
char title[64]; /* menu title */
s8 selected; /* index of selected item */
s8 offset; /* items list offset */
u8 max_items; /* total number of items */
u8 max_buttons; /* total number of buttons */
u8 max_images; /* total number of background images */
gui_item *items; /* menu items */
gui_butn *buttons; /* menu buttons */
gui_image *bg_images; /* background images */
gui_item *helpers[2]; /* left & right key comments */
gui_butn *arrows[2]; /* arrows buttons */
bool screenshot; /* use gamescreen as background */
} gui_menu;
/* Menu Inputs */
struct t_input_menu
{
u32 connected;
u16 keys;
#ifdef HW_RVL
struct ir_t ir;
#endif
} m_input;
/* Global data */
extern u8 SILENT;
/* Generic textures*/
#ifdef HW_RVL
extern gx_texture *w_pointer;
#endif
extern void MainMenu(void);
extern void GUI_FadeOut();
extern void GUI_InitMenu(gui_menu *menu);
extern void GUI_DeleteMenu(gui_menu *menu);
extern void GUI_FadeOut();
extern void GUI_SetBgColor(GXColor color);
extern void GUI_DrawMenu(gui_menu *menu);
extern void GUI_DrawMenuFX(gui_menu *menu, u8 speed, u8 out);
extern void GUI_SlideMenuTitle(gui_menu *m, int title_offset);
extern int GUI_UpdateMenu(gui_menu *menu);
extern int GUI_RunMenu(gui_menu *menu);
extern int GUI_WindowPrompt(gui_menu *parent, char *title, char *items[], u8 nb_items);
#endif

View File

@ -1,9 +1,10 @@
/****************************************************************************
* legal.c
*
* legal informations screen
* Genesis Plus GX Disclaimer
*
* code by Softdev (2006), Eke-Eke (2007,2008)
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -21,19 +22,10 @@
*
***************************************************************************/
#include "shared.h"
#include "font.h"
#include "menu.h"
#include "gui.h"
#include "intro_pcm.h"
#include <asndlib.h>
extern const u8 Bg_intro_c1_png[];
extern const u8 Bg_intro_c2_png[];
extern const u8 Bg_intro_c3_png[];
extern const u8 Bg_intro_c4_png[];
extern const u8 Bg_intro_c5_png[];
/*
* This is the legal stuff - which must be shown at program startup
* Any derivative work MUST include the same textual output.

View File

@ -3,7 +3,7 @@
*
* Genesis Plus GX menus
*
* code by Eke-Eke (march 2009)
* Eke-Eke (2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,20 +22,13 @@
***************************************************************************/
#include "shared.h"
#include "dvd.h"
#include "font.h"
#include "menu.h"
#include "gui.h"
#include "dvd.h"
#include "file_dvd.h"
#include "file_fat.h"
#include "filesel.h"
#include <asndlib.h>
#include <oggplayer.h>
#ifdef HW_RVL
gx_texture *w_pointer;
#endif
#define BG_COLOR_MAX 15
/* various background colors */
@ -470,936 +463,6 @@ static gui_menu menu_prefs =
FALSE
};
/*****************************************************************************/
/* Generic GUI routines */
/*****************************************************************************/
/* Allocate texture images data */
void GUI_InitMenu(gui_menu *menu)
{
int i;
gui_item *item;
gui_butn *button;
gui_image *image;
/* background elements */
for (i=0; i<menu->max_images; i++)
{
image = &menu->bg_images[i];
image->texture = gxTextureOpenPNG(image->data,0);
}
for (i=0; i<2; i++)
{
/* key helpers */
item = menu->helpers[i];
if (item)
item->texture = gxTextureOpenPNG(item->data,0);
/* arrows */
button = menu->arrows[i];
if (button)
{
if (!button->data->texture[0])
button->data->texture[0] = gxTextureOpenPNG(button->data->image[0],0);
if (!button->data->texture[1])
button->data->texture[1] = gxTextureOpenPNG(button->data->image[1],0);
/* initial state */
button->state &= ~BUTTON_VISIBLE;
if (((i==0) && (menu->offset != 0)) || ((i==1) && (menu->offset + menu->max_buttons) < menu->max_items))
button->state |= BUTTON_VISIBLE;
}
}
/* menu buttons */
for (i=0; i<menu->max_buttons; i++)
{
button = &menu->buttons[i];
if (button->data)
{
if (!button->data->texture[0])
button->data->texture[0] = gxTextureOpenPNG(button->data->image[0],0);
if (!button->data->texture[1])
button->data->texture[1] = gxTextureOpenPNG(button->data->image[1],0);
}
}
/* menu items */
for (i=0; i<menu->max_items; i++)
{
item = &menu->items[i];
if (item->data)
item->texture = gxTextureOpenPNG(item->data,0);
}
}
/* release allocated memory */
void GUI_DeleteMenu(gui_menu *menu)
{
int i;
gui_butn *button;
gui_item *item;
gui_image *image;
/* background elements */
for (i=0; i<menu->max_images; i++)
{
image = &menu->bg_images[i];
gxTextureClose(&image->texture);
}
for (i=0; i<2; i++)
{
/* key helpers */
item = menu->helpers[i];
if (item)
gxTextureClose(&item->texture);
/* arrows */
button = menu->arrows[i];
if (button)
{
gxTextureClose(&button->data->texture[0]);
gxTextureClose(&button->data->texture[1]);
}
}
/* menu buttons */
for (i=0; i<menu->max_buttons; i++)
{
button = &menu->buttons[i];
if (button->data)
{
gxTextureClose(&button->data->texture[0]);
gxTextureClose(&button->data->texture[1]);
}
}
/* menu items */
for (i=0; i<menu->max_items; i++)
{
item = &menu->items[i];
gxTextureClose(&item->texture);
}
}
void GUI_DrawMenu(gui_menu *menu)
{
int i;
gui_item *item;
gui_butn *button;
gui_image *image;
/* background color */
if (menu->screenshot)
{
gxClearScreen((GXColor)BLACK);
gxDrawScreenshot(128);
}
else
{
gxClearScreen(bg_colors[config.bg_color]);
}
/* background elements */
for (i=0; i<menu->max_images; i++)
{
image = &menu->bg_images[i];
if (image->state & IMAGE_REPEAT)
gxDrawTextureRepeat(image->texture,image->x,image->y,image->w,image->h,image->alpha);
else if (image->state & IMAGE_VISIBLE)
gxDrawTexture(image->texture,image->x,image->y,image->w,image->h,image->alpha);
}
/* menu title */
FONT_write(menu->title, 22,10,56,640,(GXColor)WHITE);
/* draw buttons + items */
for (i=0; i<menu->max_buttons; i++)
{
button = &menu->buttons[i];
if (button->state & BUTTON_VISIBLE)
{
/* draw button + items */
item = &menu->items[menu->offset +i];
if ((i == menu->selected) && (button->state & BUTTON_ACTIVE))
{
if (button->data) gxDrawTexture(button->data->texture[1],button->x-4,button->y-4,button->w+8,button->h+8,255);
if (item->texture)
{
gxDrawTexture(item->texture, item->x-4,item->y-4,item->w+8,item->h+8,255);
FONT_writeCenter(item->text,18,button->x+4,item->x-4,button->y+(button->h - 36)/2+18,(GXColor)DARK_GREY);
}
else
{
FONT_writeCenter(item->text,18,item->x+2,item->x+item->w+2,button->y+(button->h-18)/2+18,(GXColor)DARK_GREY);
}
/* update help comment */
if (menu->helpers[1]) strcpy(menu->helpers[1]->comment,item->comment);
}
else
{
if (button->data)
gxDrawTexture(button->data->texture[0],button->x,button->y,button->w, button->h,255);
if (item->texture)
{
gxDrawTexture(item->texture,item->x,item->y,item->w,item->h,255);
FONT_writeCenter(item->text,16,button->x+8,item->x,button->y+(button->h - 32)/2+16,(GXColor)DARK_GREY);
}
else
{
FONT_writeCenter(item->text,16,item->x,item->x+item->w,button->y+(button->h - 16)/2+16,(GXColor)DARK_GREY);
}
}
}
}
/* draw arrow */
for (i=0; i<2; i++)
{
button = menu->arrows[i];
if (button)
{
if (button->state & BUTTON_VISIBLE)
{
if (menu->selected == (menu->max_buttons + i))
gxDrawTexture(button->data->texture[1],button->x-2,button->y-2,button->w+4,button->h+4,255);
else
gxDrawTexture(button->data->texture[0],button->x,button->y,button->w, button->h,255);
}
}
}
/* left comment */
item = menu->helpers[0];
if (item)
{
gxDrawTexture(item->texture,item->x,item->y,item->w,item->h,255);
FONT_write(item->comment,16,item->x+item->w+6,item->y+(item->h-16)/2 + 16,640,(GXColor)WHITE);
}
/* right comment */
item = menu->helpers[1];
if (item)
{
if (menu->selected < menu->max_buttons)
{
gxDrawTexture(item->texture,item->x,item->y,item->w,item->h,255);
FONT_alignRight(item->comment,16,item->x-6,item->y+(item->h-16)/2+16,(GXColor)WHITE);
}
}
}
/* Menu Transitions effect */
void GUI_DrawMenuFX(gui_menu *menu, u8 speed, u8 out)
{
int i,temp,xoffset,yoffset;
int max_offset = 0;
u8 item_alpha = 255;
GXColor text_color = DARK_GREY;
gui_item *item;
gui_butn *button;
gui_image *image;
/* find maximal offset */
for (i=0; i<menu->max_images; i++)
{
image = &menu->bg_images[i];
if (image->state & IMAGE_SLIDE_LEFT)
{
temp = image->x + image->w;
if (max_offset < temp) max_offset = temp;
}
else if (image->state & IMAGE_SLIDE_RIGHT)
{
temp = 640 - image->x;
if (max_offset < temp) max_offset = temp;
}
if (image->state & IMAGE_SLIDE_TOP)
{
temp = image->y + image->h;
if (max_offset < temp) max_offset = temp;
}
else if (image->state & IMAGE_SLIDE_BOTTOM)
{
temp = 480 - image->y;
if (max_offset < temp) max_offset = temp;
}
}
temp = max_offset;
/* Alpha steps */
int alpha = out ? 255 : 0;
int alpha_step = (255 * speed) / max_offset;
if (out) alpha_step = -alpha_step;
/* Let's loop until final position has been reached */
while (temp > 0)
{
/* background color */
if (menu->screenshot)
{
gxClearScreen((GXColor)BLACK);
if (alpha > 127) gxDrawScreenshot(128);
else gxDrawScreenshot(255 - alpha);
}
else
{
gxClearScreen(bg_colors[config.bg_color]);
}
/* background images */
for (i=0; i<menu->max_images; i++)
{
image = &menu->bg_images[i];
/* X offset */
if (image->state & IMAGE_SLIDE_LEFT)
xoffset = out ? (temp - max_offset) : (-temp);
else if (image->state & IMAGE_SLIDE_RIGHT)
xoffset = out ? (max_offset - temp) : (temp);
else
xoffset = 0;
/* Y offset */
if (image->state & IMAGE_SLIDE_TOP)
yoffset = out ? (temp - max_offset) : (-temp);
else if (image->state & IMAGE_SLIDE_BOTTOM)
yoffset = out ? (max_offset - temp) : (temp);
else
yoffset = 0;
/* draw image */
if ((image->state & IMAGE_FADE) && ((out && (image->alpha > alpha)) || (!out && (image->alpha < alpha))))
{
/* FADE In-Out */
if (image->state & IMAGE_REPEAT) gxDrawTextureRepeat(image->texture,image->x+xoffset,image->y+yoffset,image->w,image->h,alpha);
else if (image->state & IMAGE_VISIBLE)gxDrawTexture(image->texture,image->x+xoffset,image->y+yoffset,image->w,image->h,alpha);
}
else
{
if (image->state & IMAGE_REPEAT) gxDrawTextureRepeat(image->texture,image->x+xoffset,image->y+yoffset,image->w,image->h,image->alpha);
else if (image->state & IMAGE_VISIBLE)gxDrawTexture(image->texture,image->x+xoffset,image->y+yoffset,image->w,image->h,image->alpha);
}
}
/* menu title */
if (menu->bg_images[2].state & IMAGE_SLIDE_TOP)
{
FONT_write(menu->title, 22,10,out ? (56 + temp - max_offset) : (56 -temp),640,(GXColor)WHITE);
}
else
{
FONT_write(menu->title, 22,10,56,640,(GXColor)WHITE);
}
/* draw buttons + items */
for (i=0; i<menu->max_buttons; i++)
{
button = &menu->buttons[i];
if (button->state & BUTTON_VISIBLE)
{
/* X offset */
if (button->state & BUTTON_SLIDE_LEFT)
xoffset = out ? (temp - max_offset) : (-temp);
else if (button->state & BUTTON_SLIDE_RIGHT)
xoffset = out ? (max_offset - temp) : (temp);
else
xoffset = 0;
/* Y offset */
if (button->state & BUTTON_SLIDE_TOP)
yoffset = out ? (temp - max_offset) : (-temp);
else if (button->state & BUTTON_SLIDE_BOTTOM)
yoffset = out ? (max_offset - temp) : (temp);
else
yoffset = 0;
/* Alpha transparency */
if (button->state & BUTTON_FADE)
{
item_alpha = alpha;
text_color.a = alpha;
}
else
{
item_alpha = 255;
text_color.a = 255;
}
/* draw button + items */
item = &menu->items[menu->offset + i];
if (button->data) gxDrawTexture(button->data->texture[0],button->x+xoffset,button->y+yoffset,button->w, button->h,item_alpha);
if (item->texture)
{
gxDrawTexture(item->texture,item->x+xoffset,item->y+yoffset,item->w,item->h,item_alpha);
FONT_writeCenter(item->text,16,button->x+xoffset+8,item->x+xoffset,button->y+yoffset+(button->h - 32)/2+16,text_color);
}
else
{
FONT_writeCenter(item->text,16,item->x+xoffset,item->x+item->w+xoffset,button->y+yoffset+(button->h - 16)/2+16,text_color);
}
}
}
/* update offset */
temp -= speed;
/* update alpha */
alpha += alpha_step;
if (alpha > 255) alpha = 255;
else if (alpha < 0) alpha = 0;
/* copy EFB to XFB */
gxSetScreen ();
}
/* final position */
if (!out)
{
GUI_DrawMenu(menu);
gxSetScreen ();
}
else if (menu->screenshot)
{
gxClearScreen((GXColor)BLACK);
gxDrawScreenshot(255);
gxSetScreen ();
}
}
/* Basic Fading */
void GUI_FadeOut()
{
int alpha = 0;
while (alpha < 256)
{
gxDrawRectangle(0, 0, 640, 480, alpha, (GXColor)BLACK);
gxSetScreen();
alpha +=3;
}
}
/* Window Prompt */
/* prompt window slides in & out */
int GUI_WindowPrompt(gui_menu *parent, char *title, char *items[], u8 nb_items)
{
int i, ret, quit = 0;
s32 selected = 0;
s32 old;
butn_data *data = &button_text_data;
u8 delete_me[2];
s16 p;
#ifdef HW_RVL
int x,y;
struct orient_t orient;
#endif
/* initialize data */
for (i=0; i<2; i++)
{
delete_me[i] = 0;
if (!data->texture[i])
{
data->texture[i] = gxTextureOpenPNG(data->image[i],0);
delete_me[i] = 1;
}
}
/* initialize texture window */
gx_texture *window = gxTextureOpenPNG(Frame_s1_png,0);
gx_texture *top = gxTextureOpenPNG(Frame_s1_title_png,0);
/* get initial positions */
int w = data->texture[0]->width;
int h = data->texture[0]->height;
int xwindow = (640 - window->width)/2;
int ywindow = (480 - window->height)/2;
int xpos = xwindow + (window->width - w)/2;
int ypos = (window->height - top->height - (h*nb_items) - (nb_items-1)*20)/2;
ypos = ypos + ywindow + top->height;
/* set initial vertical offset */
int yoffset = ywindow + window->height;
/* reset help comment */
if (parent->helpers[1]) strcpy(parent->helpers[1]->comment,"");
/* slide in */
while (yoffset > 0)
{
/* draw parent menu */
GUI_DrawMenu(parent);
/* draw window */
gxDrawTexture(window,xwindow,ywindow-yoffset,window->width,window->height,230);
gxDrawTexture(top,xwindow,ywindow-yoffset,top->width,top->height,255);
/* draw title */
FONT_writeCenter(title,20,xwindow,xwindow+window->width,ywindow+(top->height-20)/2+20-yoffset,(GXColor)WHITE);
/* draw buttons + text */
for (i=0; i<nb_items; i++)
{
gxDrawTexture(data->texture[0],xpos,ypos+i*(20 + h)-yoffset,w,h,255);
FONT_writeCenter(items[i],18,xpos,xpos+w,ypos+i*(20 + h)+(h + 18)/2- yoffset,(GXColor)DARK_GREY);
}
/* update display */
gxSetScreen ();
/* slide speed */
yoffset -= 60;
}
/* draw menu */
while (quit == 0)
{
/* draw parent menu (should have been initialized first) */
GUI_DrawMenu(parent);
/* draw window */
gxDrawTexture(window,xwindow,ywindow,window->width,window->height,230);
gxDrawTexture(top,xwindow,ywindow,top->width,top->height,255);
/* draw title */
FONT_writeCenter(title,20,xwindow,xwindow+window->width,ywindow+(top->height-20)/2+20,(GXColor)WHITE);
/* draw buttons + text */
for (i=0; i<nb_items; i++)
{
if (i==selected)
{
gxDrawTexture(data->texture[1],xpos-4,ypos+i*(20+h)-4,w+8,h+8,255);
FONT_writeCenter(items[i],22,xpos,xpos+w,ypos+i*(20+h)+(h+22)/2,(GXColor)DARK_GREY);
}
else
{
gxDrawTexture(data->texture[0],xpos,ypos+i*(20 + h),w,h,255);
FONT_writeCenter(items[i],18,xpos,xpos+w,ypos+i*(20+h)+(h+18)/2,(GXColor)DARK_GREY);
}
}
old = selected;
p = m_input.keys;
#ifdef HW_RVL
if (Shutdown)
{
gxTextureClose(&w_pointer);
GUI_DeleteMenu(parent);
GUI_FadeOut();
shutdown();
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
}
else if (m_input.ir.valid)
{
/* get cursor position */
x = m_input.ir.x;
y = m_input.ir.y;
/* draw wiimote pointer */
WPAD_Orientation(0,&orient);
gxResetAngle(orient.roll);
gxDrawTexture(w_pointer,x,y,w_pointer->width,w_pointer->height,255);
gxResetAngle(0.0);
/* check for valid buttons */
selected = -1;
for (i=0; i<nb_items; i++)
{
if ((x>=xpos)&&(x<=(xpos+w))&&(y>=ypos+i*(20 + h))&&(y<=(ypos+i*(20+h)+h)))
{
selected = i;
break;
}
}
}
else
{
/* reinitialize selection */
if (selected == -1) selected = 0;
}
#endif
/* update screen */
gxSetScreen ();
/* update selection */
if (p&PAD_BUTTON_UP)
{
if (selected > 0) selected --;
}
else if (p&PAD_BUTTON_DOWN)
{
if (selected < (nb_items -1)) selected ++;
}
/* sound fx */
if (selected != old)
{
if (selected >= 0)
{
ASND_SetVoice(ASND_GetFirstUnusedVoice(),VOICE_MONO_16BIT,22050,0,(u8 *)button_over_pcm,button_over_pcm_size,
((int)config.sfx_volume * 255) / 100,((int)config.sfx_volume * 255) / 100,NULL);
}
}
if (p & PAD_BUTTON_A)
{
if (selected >= 0)
{
quit = 1;
ret = selected;
}
}
else if (p & PAD_BUTTON_B)
{
quit = 1;
ret = -1;
}
}
/* reset initial vertical offset */
yoffset = 0;
/* slide out */
while (yoffset < (ywindow + window->height))
{
/* draw parent menu */
GUI_DrawMenu(parent);
/* draw window + header */
gxDrawTexture(window,xwindow,ywindow-yoffset,window->width,window->height,230);
gxDrawTexture(top,xwindow,ywindow-yoffset,top->width,top->height,255);
/* draw title */
FONT_writeCenter(title,20,xwindow,xwindow+window->width,ywindow+(top->height-20)/2+20-yoffset,(GXColor)WHITE);
/* draw buttons + text */
for (i=0; i<nb_items; i++)
{
gxDrawTexture(data->texture[0],xpos,ypos+i*(20+h)-yoffset,w,h,255);
FONT_writeCenter(items[i],18,xpos,xpos+w,ypos+i*(20+h)+(h+18)/2-yoffset,(GXColor)WHITE);
}
yoffset += 60;
gxSetScreen ();
}
/* final position */
GUI_DrawMenu(parent);
gxSetScreen ();
/* close textures */
gxTextureClose(&window);
if (delete_me[0]) gxTextureClose(&data->texture[0]);
if (delete_me[1]) gxTextureClose(&data->texture[1]);
return ret;
}
int GUI_UpdateMenu(gui_menu *menu)
{
u16 p;
int ret = 0;
int selected = menu->selected;
int max_items = menu->max_items;
int max_buttons = menu->max_buttons;
gui_butn *button;
#ifdef HW_RVL
int i,x,y;
struct orient_t orient;
if (Shutdown)
{
GUI_DeleteMenu(menu);
GUI_FadeOut();
shutdown();
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
}
else if (m_input.ir.valid)
{
/* get cursor position */
x = m_input.ir.x;
y = m_input.ir.y;
/* draw wiimote pointer */
WPAD_Orientation(0,&orient);
gxResetAngle(orient.roll);
gxDrawTexture(w_pointer,x,y,w_pointer->width,w_pointer->height,255);
gxResetAngle(0.0);
/* check for valid buttons */
selected = max_buttons + 2;
for (i=0; i<max_buttons; i++)
{
button = &menu->buttons[i];
if ((button->state & BUTTON_ACTIVE)&&(x>=button->x)&&(x<=(button->x+button->w))&&(y>=button->y)&&(y<=(button->y+button->h)))
{
selected = i;
break;
}
}
for (i=0; i<2; i++)
{
button = menu->arrows[i];
if (button)
{
if (button->state & BUTTON_VISIBLE)
{
if ((x<=(button->x+button->w))&&(y>=button->y)&&(y<=(button->y+button->h)))
{
selected = max_buttons + i;
break;
}
}
}
}
}
else
{
/* reinitialize selection */
if (selected >= menu->max_buttons) selected = 0;
}
#endif
/* update screen */
gxSetScreen ();
/* update menu */
p = m_input.keys;
if (selected < max_buttons)
{
button = &menu->buttons[selected];
if (p & PAD_BUTTON_UP)
{
selected -= button->shift[0];
if (selected < 0)
{
selected = 0;
if (menu->offset)
menu->offset --;
}
}
else if (p & PAD_BUTTON_DOWN)
{
selected += button->shift[1];
if (selected >= max_buttons)
{
selected = max_buttons - 1;
if ((menu->offset + selected < (max_items - 1)))
menu->offset ++;
}
}
else if (p & PAD_BUTTON_LEFT)
{
if (button->state & BUTTON_SHIFT)
{
/* menu clicked */
ret = 2;
}
else
{
selected -= button->shift[2];
if (selected < 0)
{
selected = 0;
if (menu->offset)
menu->offset --;
}
}
}
else if (p & PAD_BUTTON_RIGHT)
{
if (button->state & BUTTON_SHIFT)
{
/* menu clicked */
ret = 1;
}
else
{
selected += button->shift[3];
if (selected >= max_buttons)
{
selected = max_buttons - 1;
if ((menu->offset + selected < (max_items - 1)))
menu->offset ++;
}
}
}
}
if (p & PAD_BUTTON_A)
{
if (selected < max_buttons) ret = 1; /* menu clicked */
else if (selected == max_buttons) menu->offset --; /* up arrow */
else if (selected == (max_buttons+1))menu->offset ++; /* down arrow */
}
else if ((p & PAD_BUTTON_B) || (p & PAD_TRIGGER_Z))
{
/* quit menu */
ret = -1;
}
/* selected item has changed ? */
if (menu->selected != selected)
{
if (selected < max_buttons)
{
/* sound fx */
button = &menu->buttons[selected];
if (button->state & BUTTON_OVER_SFX)
{
ASND_SetVoice(ASND_GetFirstUnusedVoice(),VOICE_MONO_16BIT,22050,0,(u8 *)button_over_pcm,button_over_pcm_size,
((int)config.sfx_volume * 255) / 100,((int)config.sfx_volume * 255) / 100,NULL);
}
}
else if (selected < (max_buttons + 2))
{
/* sound fx */
button = menu->arrows[selected-max_buttons];
if (button->state & BUTTON_OVER_SFX)
{
ASND_SetVoice(ASND_GetFirstUnusedVoice(),VOICE_MONO_16BIT,22050,0,(u8 *)button_over_pcm,button_over_pcm_size,
((int)config.sfx_volume * 255) / 100,((int)config.sfx_volume * 255) / 100,NULL);
}
}
/* update selection */
menu->selected = selected;
}
/* update arrows buttons status (items list) */
button = menu->arrows[0];
if (button)
{
if (menu->offset > 0) button->state |= BUTTON_VISIBLE;
else button->state &= ~BUTTON_VISIBLE;
}
button = menu->arrows[1];
if (button)
{
if ((menu->offset + max_buttons) < max_items) button->state |= BUTTON_VISIBLE;
else button->state &= ~BUTTON_VISIBLE;
}
if (ret > 0)
{
if (selected < max_buttons)
{
/* sound fx */
button = &menu->buttons[selected];
if (button->state & BUTTON_SELECT_SFX)
{
ASND_SetVoice(ASND_GetFirstUnusedVoice(),VOICE_MONO_16BIT,22050,0,(u8 *)button_select_pcm,button_select_pcm_size,
((int)config.sfx_volume * 255) / 100,((int)config.sfx_volume * 255) / 100,NULL);
}
}
}
return ret;
}
int GUI_RunMenu(gui_menu *menu)
{
int update = 0;
/* update menu */
while (!update)
{
GUI_DrawMenu(menu);
update = GUI_UpdateMenu(menu);
}
if (update == 2) return (-2-menu->offset-menu->selected);
else if (update == 1) return (menu->offset + menu->selected);
else return -1;
}
/* basic slide effect for option menus */
static void GUI_SlideMenuTitle(gui_menu *m, int title_offset)
{
#ifdef HW_RVL
gui_butn *button;
int i,x,y;
struct orient_t orient;
#endif
char title[64];
strcpy(title,m->title);
while (title_offset > 0)
{
strcpy(m->title,title+title_offset);
m->title[strlen(title)-title_offset-1] = 0;
GUI_DrawMenu(m);
#ifdef HW_RVL
if (m_input.ir.valid)
{
/* get cursor position */
x = m_input.ir.x;
y = m_input.ir.y;
/* draw wiimote pointer */
WPAD_Orientation(0,&orient);
gxResetAngle(orient.roll);
gxDrawTexture(w_pointer,x,y,w_pointer->width,w_pointer->height,255);
gxResetAngle(0.0);
/* check for valid buttons */
m->selected = m->max_buttons + 2;
for (i=0; i<m->max_buttons; i++)
{
button = &m->buttons[i];
if ((button->state & BUTTON_ACTIVE)&&(x>=button->x)&&(x<=(button->x+button->w))&&(y>=button->y)&&(y<=(button->y+button->h)))
{
m->selected = i;
break;
}
}
for (i=0; i<2; i++)
{
button = m->arrows[i];
if (button)
{
if (button->state & BUTTON_VISIBLE)
{
if ((x<=(button->x+button->w))&&(y>=button->y)&&(y<=(button->y+button->h)))
{
m->selected = m->max_buttons + i;
break;
}
}
}
}
}
else
{
/* reinitialize selection */
if (m->selected >= m->max_buttons) m->selected = 0;
}
#endif
gxSetScreen ();
usleep(6000);
title_offset--;
}
strcpy(m->title,title);
}
/***************************************************************************
* drawmenu (deprecated)
@ -1600,6 +663,7 @@ static void prefmenu ()
if (config.bg_color >= BG_COLOR_MAX) config.bg_color = 0;
if (config.bg_color) sprintf (items[4].text, "BG Color: Type %d", config.bg_color);
else sprintf (items[4].text, "BG Color: DEFAULT");
GUI_SetBgColor(bg_colors[config.bg_color]);
break;
case -1:
@ -2900,6 +1964,7 @@ void MainMenu (void)
}
GUI_InitMenu(m);
GUI_SetBgColor(bg_colors[config.bg_color]);
GUI_DrawMenuFX(m,10,0);
while (quit == 0)

View File

@ -3,7 +3,8 @@
*
* Genesis Plus GX audio support
*
* code by Eke-Eke (2007,2009)
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,9 +24,6 @@
#include "shared.h"
#include <asndlib.h>
#include <oggplayer.h>
/* DMA soundbuffers (required to be 32-bytes aligned)
Length is dimensionned for one frame of emulation (see below)
To prevent audio clashes, we use double buffering technique:

View File

@ -3,7 +3,8 @@
*
* Genesis Plus GX audio support
*
* code by Softdev (2006), Eke-Eke (2007,2008)
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
*
* Genesis Plus GX input support
*
* code by Eke-Eke (2008-2009)
* Eke-Eke (2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,7 +23,7 @@
#include "shared.h"
#include "font.h"
#include "menu.h"
#include "gui.h"
/* Analog sticks sensitivity */
#define ANALOG_SENSITIVITY 30

View File

@ -3,7 +3,7 @@
*
* Genesis Plus GX input support
*
* code by Eke-Eke (2008)
* Eke-Eke (2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,8 @@
*
* Genesis Plus GX video & rendering support
*
* code by Softdev (2006), Eke-Eke (2007,2009)
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,8 @@
*
* Genesis Plus GX video support
*
* code by Softdev (2006), Eke-Eke (2007,2008)
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,8 @@
*
* Genesis Plus GX
*
* code by Softdev (2006), Eke-Eke (2007,2009)
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,7 +24,6 @@
#include "shared.h"
#include "font.h"
#include "menu.h"
#include "history.h"
#include "aram.h"
#include "dvd.h"
@ -32,7 +32,6 @@
#ifdef HW_RVL
#include <wiiuse/wpad.h>
#include <di/di.h>
#endif
#ifdef HW_RVL

View File

@ -12,6 +12,9 @@
#include <malloc.h>
#include <sys/dir.h>
#include <asndlib.h>
#include <oggplayer.h>
#ifdef HW_RVL
#include <di/di.h>
#endif
@ -20,6 +23,7 @@
#include "gx_audio.h"
#include "gx_video.h"
#include "config.h"
#include "file_mem.h"
#define DEFAULT_PATH "/genplus"
#ifdef HW_RVL
@ -32,19 +36,11 @@
extern void error(char *format, ...);
extern void ClearGGCodes();
extern void GetGGEntries();
extern void MainMenu(void);
extern void legal();
extern void reloadrom (int size, char *name);
extern void shutdown();
extern int ManageSRAM(u8 direction, u8 device);
extern int ManageState(u8 direction, u8 device);
extern void memfile_autosave(s8 autosram, s8 autostate);
extern void memfile_autoload(s8 autosram, s8 autostate);
extern u32 frameticker;
extern char rom_filename[256];
#ifdef HW_RVL
extern u8 Shutdown;
#endif

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* HV Counters
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* ROM Loading Support
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* ROM Loading Support
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* 68k memory handlers
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* 68k memory handlers
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* M68k Bank access from Z80
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* M68k Bank access from Z80
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* Z80 memory handler
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* Z80 memory handler
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* Video Display Processor (Rendering)
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* Video Display Processor (Rendering)
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,8 +1,8 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,8 +1,8 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -12,7 +12,7 @@
/*
** History:
**
** 2006~2008 Eke-Eke (Genesis Plus GX):
** 2006~2009 Eke-Eke (Genesis Plus GX):
** Credits to Nemesis (@spritesmind.net), most of those fixes came from his tests on a Model 1 Sega Mega Drive
**
** - removed unused multichip support

View File

@ -1,8 +1,8 @@
/***************************************************************************************
* Genesis Plus 1.2a
* FreezeState support
* Genesis Plus
* Savestate support
*
* Copyright (C) Eke-Eke, GC/Wii port
* Copyright (C) 2007, 2008, 2009 Eke-Eke (GCN/Wii port)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,8 +1,8 @@
/***************************************************************************************
* Genesis Plus 1.2a
* FreezeState support
* Genesis Plus
* Savestate support
*
* Copyright (C) Eke-Eke, GC/Wii port
* Copyright (C) 2007, 2008, 2009 Eke-Eke (GCN/Wii port)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,10 +1,10 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* Main Emulation
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
*
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* Main Emulation
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* Video Display Processor (memory handlers)
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus 1.2a
* Genesis Plus
* Video Display Processor (memory handlers)
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by