From b08e66855ae73751cefb8ea6315b9032ebde60bc Mon Sep 17 00:00:00 2001 From: ekeeke31 Date: Wed, 13 May 2009 14:26:55 +0000 Subject: [PATCH] +added proper license/copyright stuff ~modified file headers ~separated GUI engine from menus --- LICENSE.txt | 440 ++++++++++ source/{PORTING => PORTING.txt} | 0 source/cart_hw/cart_hw.c | 4 +- source/cart_hw/cart_hw.h | 4 +- source/cart_hw/eeprom.c | 4 +- source/cart_hw/eeprom.h | 4 +- source/cart_hw/sram.c | 6 +- source/cart_hw/sram.h | 6 +- source/cart_hw/svp/ssp16.c | 15 +- source/cart_hw/svp/ssp16.h | 13 +- source/cart_hw/svp/svp.c | 14 +- source/cart_hw/svp/svp.h | 13 +- source/gen_input.c | 4 +- source/gen_input.h | 4 +- source/gen_io.c | 4 +- source/gen_io.h | 4 +- source/genesis.c | 4 +- source/genesis.h | 4 +- source/gx/aram.c | 2 +- source/gx/aram.h | 2 +- source/gx/config.c | 2 +- source/gx/config.h | 2 +- source/gx/fileio/dvd.c | 27 +- source/gx/fileio/dvd.h | 27 +- source/gx/fileio/file_dvd.c | 27 +- source/gx/fileio/file_dvd.h | 27 +- source/gx/fileio/file_fat.c | 26 +- source/gx/fileio/file_fat.h | 26 +- source/gx/fileio/file_mem.c | 96 +- source/gx/fileio/file_mem.h | 35 + source/gx/fileio/history.c | 2 +- source/gx/fileio/history.h | 2 +- source/gx/fileio/unzip.c | 3 +- source/gx/fileio/unzip.h | 29 +- source/gx/gui/filesel.c | 7 +- source/gx/gui/filesel.h | 3 +- source/gx/gui/font.c | 14 +- source/gx/gui/font.h | 6 +- source/gx/gui/ggentry.c | 5 +- source/gx/gui/gui.c | 974 +++++++++++++++++++++ source/gx/gui/{menu.h => gui.h} | 191 ++-- source/gx/gui/legal.c | 16 +- source/gx/gui/menu.c | 949 +------------------- source/gx/gx_audio.c | 6 +- source/gx/gx_audio.h | 3 +- source/gx/gx_input.c | 4 +- source/gx/gx_input.h | 2 +- source/gx/gx_video.c | 3 +- source/gx/gx_video.h | 3 +- source/gx/main.c | 5 +- source/gx/osd.h | 14 +- source/hvc.h | 4 +- source/loadrom.c | 4 +- source/loadrom.h | 4 +- source/mem68k.c | 4 +- source/mem68k.h | 4 +- source/membnk.c | 4 +- source/membnk.h | 4 +- source/memz80.c | 4 +- source/memz80.h | 4 +- source/render.c | 4 +- source/render.h | 4 +- source/sound/sound.c | 4 +- source/sound/sound.h | 4 +- source/sound/ym2612.c | 2 +- source/state.c | 6 +- source/state.h | 6 +- source/system.c | 6 +- source/system.h | 4 +- source/unused/{CHANGELOG => CHANGELOG.txt} | 0 source/unused/{README => README.txt} | 0 source/vdp.c | 4 +- source/vdp.h | 4 +- 73 files changed, 1854 insertions(+), 1317 deletions(-) create mode 100644 LICENSE.txt rename source/{PORTING => PORTING.txt} (100%) create mode 100644 source/gx/fileio/file_mem.h create mode 100644 source/gx/gui/gui.c rename source/gx/gui/{menu.h => gui.h} (91%) rename source/unused/{CHANGELOG => CHANGELOG.txt} (100%) rename source/unused/{README => README.txt} (100%) diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..03eca29 --- /dev/null +++ b/LICENSE.txt @@ -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' +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. + + + Copyright (C) + + 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. + + , 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. diff --git a/source/PORTING b/source/PORTING.txt similarity index 100% rename from source/PORTING rename to source/PORTING.txt diff --git a/source/cart_hw/cart_hw.c b/source/cart_hw/cart_hw.c index 83de8d2..6c06731 100644 --- a/source/cart_hw/cart_hw.c +++ b/source/cart_hw/cart_hw.c @@ -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/) diff --git a/source/cart_hw/cart_hw.h b/source/cart_hw/cart_hw.h index 15be59d..492c373 100644 --- a/source/cart_hw/cart_hw.h +++ b/source/cart_hw/cart_hw.h @@ -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/) diff --git a/source/cart_hw/eeprom.c b/source/cart_hw/eeprom.c index 6fe502b..3cbd6ae 100644 --- a/source/cart_hw/eeprom.c +++ b/source/cart_hw/eeprom.c @@ -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 diff --git a/source/cart_hw/eeprom.h b/source/cart_hw/eeprom.h index 8a61405..518a262 100644 --- a/source/cart_hw/eeprom.h +++ b/source/cart_hw/eeprom.h @@ -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 diff --git a/source/cart_hw/sram.c b/source/cart_hw/sram.c index 834706b..d3e9123 100644 --- a/source/cart_hw/sram.c +++ b/source/cart_hw/sram.c @@ -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 diff --git a/source/cart_hw/sram.h b/source/cart_hw/sram.h index bdac2e5..ef2f8e2 100644 --- a/source/cart_hw/sram.h +++ b/source/cart_hw/sram.h @@ -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 diff --git a/source/cart_hw/svp/ssp16.c b/source/cart_hw/svp/ssp16.c index a31eec3..71e29ba 100644 --- a/source/cart_hw/svp/ssp16.c +++ b/source/cart_hw/svp/ssp16.c @@ -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 +*/ /* diff --git a/source/cart_hw/svp/ssp16.h b/source/cart_hw/svp/ssp16.h index 16513db..4dbc73e 100644 --- a/source/cart_hw/svp/ssp16.h +++ b/source/cart_hw/svp/ssp16.h @@ -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. + (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 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_ diff --git a/source/cart_hw/svp/svp.c b/source/cart_hw/svp/svp.c index 3c05f69..d7461da 100644 --- a/source/cart_hw/svp/svp.c +++ b/source/cart_hw/svp/svp.c @@ -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" diff --git a/source/cart_hw/svp/svp.h b/source/cart_hw/svp/svp.h index ac0fea7..af2501c 100644 --- a/source/cart_hw/svp/svp.h +++ b/source/cart_hw/svp/svp.h @@ -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. + (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 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_ diff --git a/source/gen_input.c b/source/gen_input.c index 3710873..59e65df 100644 --- a/source/gen_input.c +++ b/source/gen_input.c @@ -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 diff --git a/source/gen_input.h b/source/gen_input.h index 08a531c..344e398 100644 --- a/source/gen_input.h +++ b/source/gen_input.h @@ -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 diff --git a/source/gen_io.c b/source/gen_io.c index d6c361d..e806c79 100644 --- a/source/gen_io.c +++ b/source/gen_io.c @@ -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 diff --git a/source/gen_io.h b/source/gen_io.h index cb0730a..cca3cda 100644 --- a/source/gen_io.h +++ b/source/gen_io.h @@ -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 diff --git a/source/genesis.c b/source/genesis.c index e02e32a..7e64db1 100644 --- a/source/genesis.c +++ b/source/genesis.c @@ -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 diff --git a/source/genesis.h b/source/genesis.h index 2fa9b80..1e5bf89 100644 --- a/source/genesis.h +++ b/source/genesis.h @@ -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 diff --git a/source/gx/aram.c b/source/gx/aram.c index b3596f7..d18114c 100644 --- a/source/gx/aram.c +++ b/source/gx/aram.c @@ -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 diff --git a/source/gx/aram.h b/source/gx/aram.h index 9fb9e56..fea61cb 100644 --- a/source/gx/aram.h +++ b/source/gx/aram.h @@ -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 diff --git a/source/gx/config.c b/source/gx/config.c index 7b25237..cb0fadf 100644 --- a/source/gx/config.c +++ b/source/gx/config.c @@ -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 diff --git a/source/gx/config.h b/source/gx/config.h index 830c23a..8fde970 100644 --- a/source/gx/config.h +++ b/source/gx/config.h @@ -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 diff --git a/source/gx/fileio/dvd.c b/source/gx/fileio/dvd.c index 3e03799..296a336 100644 --- a/source/gx/fileio/dvd.c +++ b/source/gx/fileio/dvd.c @@ -1,23 +1,24 @@ /* * dvd.c * - * Low-level DVD access + * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * 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. + * 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 + * 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 * ********************************************************************************/ diff --git a/source/gx/fileio/dvd.h b/source/gx/fileio/dvd.h index 778b60e..edc74e6 100644 --- a/source/gx/fileio/dvd.h +++ b/source/gx/fileio/dvd.h @@ -1,23 +1,24 @@ /* * dvd.c * - * Low-level DVD access + * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * 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. + * 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 + * 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 * ********************************************************************************/ diff --git a/source/gx/fileio/file_dvd.c b/source/gx/fileio/file_dvd.c index 2fce9ef..8a7bf37 100644 --- a/source/gx/fileio/file_dvd.c +++ b/source/gx/fileio/file_dvd.c @@ -1,23 +1,24 @@ /* * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * 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. + * 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 + * 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 * ********************************************************************************/ diff --git a/source/gx/fileio/file_dvd.h b/source/gx/fileio/file_dvd.h index 89e500d..0b02c34 100644 --- a/source/gx/fileio/file_dvd.h +++ b/source/gx/fileio/file_dvd.h @@ -1,23 +1,24 @@ /* * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * 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. + * 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 + * 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 * ********************************************************************************/ diff --git a/source/gx/fileio/file_fat.c b/source/gx/fileio/file_fat.c index aff0913..89228ab 100644 --- a/source/gx/fileio/file_fat.c +++ b/source/gx/fileio/file_fat.c @@ -1,23 +1,23 @@ /* * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * 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. + * 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 + * 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 * ********************************************************************************/ diff --git a/source/gx/fileio/file_fat.h b/source/gx/fileio/file_fat.h index bac7a41..8f5119f 100644 --- a/source/gx/fileio/file_fat.h +++ b/source/gx/fileio/file_fat.h @@ -1,23 +1,23 @@ /* * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * 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. + * 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 + * 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 * ********************************************************************************/ diff --git a/source/gx/fileio/file_mem.c b/source/gx/fileio/file_mem.c index 8ff0727..66ec3a8 100644 --- a/source/gx/fileio/file_mem.c +++ b/source/gx/fileio/file_mem.c @@ -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 * diff --git a/source/gx/fileio/file_mem.h b/source/gx/fileio/file_mem.h new file mode 100644 index 0000000..ccacb1d --- /dev/null +++ b/source/gx/fileio/file_mem.h @@ -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 diff --git a/source/gx/fileio/history.c b/source/gx/fileio/history.c index 1338d79..50423c9 100644 --- a/source/gx/fileio/history.c +++ b/source/gx/fileio/history.c @@ -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 diff --git a/source/gx/fileio/history.h b/source/gx/fileio/history.h index abcf96c..37ac530 100644 --- a/source/gx/fileio/history.h +++ b/source/gx/fileio/history.h @@ -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 diff --git a/source/gx/fileio/unzip.c b/source/gx/fileio/unzip.c index 7202ddb..1376e9c 100644 --- a/source/gx/fileio/unzip.c +++ b/source/gx/fileio/unzip.c @@ -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 diff --git a/source/gx/fileio/unzip.h b/source/gx/fileio/unzip.h index ae389c9..7867aba 100644 --- a/source/gx/fileio/unzip.h +++ b/source/gx/fileio/unzip.h @@ -1,10 +1,31 @@ /****************************************************************************** * - * Nintendo Gamecube Zip Support + * unzip.c * - * Only partial support is included, in that only the first file within the archive - * is considered to be a ROM image. - ***************************************************************************/ + * 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_ diff --git a/source/gx/gui/filesel.c b/source/gx/gui/filesel.c index 3790da2..ce4ece1 100644 --- a/source/gx/gui/filesel.c +++ b/source/gx/gui/filesel.c @@ -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 #endif -/* this is emulator specific ! */ #define PAGESIZE 11 #define PAGEOFFSET 120 - /* Global Variables */ int maxfiles = 0; int offset = 0; diff --git a/source/gx/gui/filesel.h b/source/gx/gui/filesel.h index 176126c..2b96ec2 100644 --- a/source/gx/gui/filesel.h +++ b/source/gx/gui/filesel.h @@ -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 diff --git a/source/gx/gui/font.c b/source/gx/gui/font.c index 51473dd..bfa6371 100644 --- a/source/gx/gui/font.c +++ b/source/gx/gui/font.c @@ -1,11 +1,11 @@ /***************************************************************************** * font.c * - * IPL FONT Engine, based on Qoob MP3 Player Font + * IPL FONT Engine, using GX hardware * - * 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 * the Free Software Foundation; either version 2 of the License, or @@ -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; tback_framewidth) x=back_framewidth; + if (x>640) x=640; x = (640 - x) >> 1; write_font(x, y, string); } diff --git a/source/gx/gui/font.h b/source/gx/gui/font.h index 476d66d..615a52f 100644 --- a/source/gx/gui/font.h +++ b/source/gx/gui/font.h @@ -3,9 +3,9 @@ * * 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 * the Free Software Foundation; either version 2 of the License, or @@ -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 diff --git a/source/gx/gui/ggentry.c b/source/gx/gui/ggentry.c index e8e19f8..3d960a0 100644 --- a/source/gx/gui/ggentry.c +++ b/source/gx/gui/ggentry.c @@ -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 diff --git a/source/gx/gui/gui.c b/source/gx/gui/gui.c new file mode 100644 index 0000000..9f50a11 --- /dev/null +++ b/source/gx/gui/gui.c @@ -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; imax_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; imax_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; imax_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; imax_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; imax_buttons; i++) + { + button = &menu->buttons[i]; + if (button->data) + { + gxTextureClose(&button->data->texture[0]); + gxTextureClose(&button->data->texture[1]); + } + } + + /* menu items */ + for (i=0; imax_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; imax_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; imax_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; imax_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; imax_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; imax_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; itexture[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; itexture[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=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; itexture[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; ibuttons[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; imax_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); +} diff --git a/source/gx/gui/menu.h b/source/gx/gui/gui.h similarity index 91% rename from source/gx/gui/menu.h rename to source/gx/gui/gui.h index e909fd0..09885fb 100644 --- a/source/gx/gui/menu.h +++ b/source/gx/gui/gui.h @@ -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 #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 diff --git a/source/gx/gui/legal.c b/source/gx/gui/legal.c index 3e0f09b..b496a2f 100644 --- a/source/gx/gui/legal.c +++ b/source/gx/gui/legal.c @@ -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 - -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. diff --git a/source/gx/gui/menu.c b/source/gx/gui/menu.c index 914d6c8..0fd4d5a 100644 --- a/source/gx/gui/menu.c +++ b/source/gx/gui/menu.c @@ -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 -#include - -#ifdef HW_RVL -gx_texture *w_pointer; -#endif - #define BG_COLOR_MAX 15 /* various background colors */ @@ -53,9 +46,9 @@ static GXColor bg_colors[BG_COLOR_MAX]= {0x7d,0xa4,0x9f,0xff}, /* darker green blue */ {0x22,0x52,0x74,0xff}, /* dark blue */ {0x33,0x33,0x33,0xff}, /* dark grey */ - {0x00,0x00,0x00,0xff}, /* black */ + {0x00,0x00,0x00,0xff}, /* black */ {0xd6,0xcb,0xba,0xff}, /* light gold */ - {0xbb,0xb0,0x99,0xff} /* gold */ + {0xbb,0xb0,0x99,0xff} /* gold */ }; /*****************************************************************************/ @@ -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; imax_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; imax_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; imax_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; imax_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; imax_buttons; i++) - { - button = &menu->buttons[i]; - if (button->data) - { - gxTextureClose(&button->data->texture[0]); - gxTextureClose(&button->data->texture[1]); - } - } - - /* menu items */ - for (i=0; imax_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; imax_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; imax_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; imax_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; imax_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; imax_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; itexture[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; itexture[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=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; itexture[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; ibuttons[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; imax_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) diff --git a/source/gx/gx_audio.c b/source/gx/gx_audio.c index 07734d3..4495a88 100644 --- a/source/gx/gx_audio.c +++ b/source/gx/gx_audio.c @@ -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 -#include - /* 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: diff --git a/source/gx/gx_audio.h b/source/gx/gx_audio.h index efd0f22..92938b0 100644 --- a/source/gx/gx_audio.h +++ b/source/gx/gx_audio.h @@ -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 diff --git a/source/gx/gx_input.c b/source/gx/gx_input.c index 49fcb16..ae8cb84 100644 --- a/source/gx/gx_input.c +++ b/source/gx/gx_input.c @@ -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 diff --git a/source/gx/gx_input.h b/source/gx/gx_input.h index a6f0e5c..ead33b6 100644 --- a/source/gx/gx_input.h +++ b/source/gx/gx_input.h @@ -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 diff --git a/source/gx/gx_video.c b/source/gx/gx_video.c index 607ff8f..2a1d1ee 100644 --- a/source/gx/gx_video.c +++ b/source/gx/gx_video.c @@ -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 diff --git a/source/gx/gx_video.h b/source/gx/gx_video.h index d99959f..f374ba6 100644 --- a/source/gx/gx_video.h +++ b/source/gx/gx_video.h @@ -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 diff --git a/source/gx/main.c b/source/gx/main.c index fb08318..3ca00bc 100644 --- a/source/gx/main.c +++ b/source/gx/main.c @@ -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 -#include #endif #ifdef HW_RVL diff --git a/source/gx/osd.h b/source/gx/osd.h index 9f750cc..e353bb6 100644 --- a/source/gx/osd.h +++ b/source/gx/osd.h @@ -12,6 +12,9 @@ #include #include +#include +#include + #ifdef HW_RVL #include #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 diff --git a/source/hvc.h b/source/hvc.h index 466167d..727fc99 100644 --- a/source/hvc.h +++ b/source/hvc.h @@ -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 diff --git a/source/loadrom.c b/source/loadrom.c index 23cb0b5..99bf6de 100644 --- a/source/loadrom.c +++ b/source/loadrom.c @@ -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 diff --git a/source/loadrom.h b/source/loadrom.h index 4b17a7a..e6bb7ca 100644 --- a/source/loadrom.h +++ b/source/loadrom.h @@ -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 diff --git a/source/mem68k.c b/source/mem68k.c index 583aca5..8969a8d 100644 --- a/source/mem68k.c +++ b/source/mem68k.c @@ -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 diff --git a/source/mem68k.h b/source/mem68k.h index cba9042..35cd825 100644 --- a/source/mem68k.h +++ b/source/mem68k.h @@ -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 diff --git a/source/membnk.c b/source/membnk.c index 596d673..d5605e3 100644 --- a/source/membnk.c +++ b/source/membnk.c @@ -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 diff --git a/source/membnk.h b/source/membnk.h index 32fcd31..12cd153 100644 --- a/source/membnk.h +++ b/source/membnk.h @@ -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 diff --git a/source/memz80.c b/source/memz80.c index 368f544..5292d2b 100644 --- a/source/memz80.c +++ b/source/memz80.c @@ -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 diff --git a/source/memz80.h b/source/memz80.h index ff18629..4a5c010 100644 --- a/source/memz80.h +++ b/source/memz80.h @@ -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 diff --git a/source/render.c b/source/render.c index e311668..d8b0a27 100644 --- a/source/render.c +++ b/source/render.c @@ -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 diff --git a/source/render.h b/source/render.h index ff0c8be..e61be7f 100644 --- a/source/render.h +++ b/source/render.h @@ -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 diff --git a/source/sound/sound.c b/source/sound/sound.c index 78c8829..991be67 100644 --- a/source/sound/sound.c +++ b/source/sound/sound.c @@ -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 diff --git a/source/sound/sound.h b/source/sound/sound.h index ab2afe4..13182dd 100644 --- a/source/sound/sound.h +++ b/source/sound/sound.h @@ -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 diff --git a/source/sound/ym2612.c b/source/sound/ym2612.c index 09b56fb..3ea2794 100644 --- a/source/sound/ym2612.c +++ b/source/sound/ym2612.c @@ -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 diff --git a/source/state.c b/source/state.c index cd1be56..99a36bc 100644 --- a/source/state.c +++ b/source/state.c @@ -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 diff --git a/source/state.h b/source/state.h index 35f86b6..fdfe8a8 100644 --- a/source/state.h +++ b/source/state.h @@ -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 diff --git a/source/system.c b/source/system.c index a7dbca9..6073f3b 100644 --- a/source/system.c +++ b/source/system.c @@ -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 diff --git a/source/system.h b/source/system.h index 85af51f..aece9e5 100644 --- a/source/system.h +++ b/source/system.h @@ -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 diff --git a/source/unused/CHANGELOG b/source/unused/CHANGELOG.txt similarity index 100% rename from source/unused/CHANGELOG rename to source/unused/CHANGELOG.txt diff --git a/source/unused/README b/source/unused/README.txt similarity index 100% rename from source/unused/README rename to source/unused/README.txt diff --git a/source/vdp.c b/source/vdp.c index 096f2fb..8a8b8ac 100644 --- a/source/vdp.c +++ b/source/vdp.c @@ -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 diff --git a/source/vdp.h b/source/vdp.h index 395361c..350fcef 100644 --- a/source/vdp.h +++ b/source/vdp.h @@ -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