mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-12-26 19:21:49 +01:00
----------------------
Genesis Plus GX 1.6.0 ---------------------- [Core/Sound] --------------- * added YM2413 emulation in Master System compatibility mode. * fixed SN76489 noise boost initialization. * minor YM2612 core optimizations. [Core/VDP] --------------- * added accurate emulation of SG-1000, Master System (315-5124, 315-5246) & Game Gear VDP. * added support for all TMS9918 rendering modes. * improved Mega Drive VDP timings accuracy in Master System Compatibility mode. * fixed color palette initialization. * fixed shifted sprites rendering in Mode 4. * modified pixel rendering support (pixel depth is now forced at compilation time). [Core/CPU] --------------- * optimized 68k core (rewrote 68k interrupt handling, removed multiple CPU types support & unused code) for 5~8% speed improvment [Core/IO] --------------- * added accurate emulation of Master System (315-5216, 315-5237, 315-5297) & Game Gear I/O controllers. * added Terebi Oekaki tablet emulation. * improved Mouse emulation (fixes mouse support in Cannon Fodder). * improved Justifier emulation (fixes gun support in Lethal Enforcers 2). * improved 6-Buttons control pad emulation (fixes Duke Nukem 3D) * modified lightgun emulation to use common key inputs for all devices. * 2-buttons controller is now picked by default for Master System games. [Core/MD] --------------- * added copy-protection hardware emulation for some new dumped games (Tiny Toon Adventures 3, Mighty Morphin Power Rangers & The Battle of Red Cliffs). * added Game Toshokan in EEPROM database (verified on real cartridge). * fixed Micro Machines 2 - Turbo Tournament EEPROM size (verified on real cartridge). * modified SRAM banswitch hardware emulation to be more compatible with some hacks. [Core/MS] --------------- * added Cyborg Z to Korean mapper database. [Core/GG] --------------- * added 93C46 EEPROM emulation (Majors Pro Baseball, World Series Baseball & World Series Baseball 95). [Core/General] --------------- * added support for .mdx ROM format. * added Game Gear & SG-1000 ROM support. * added accurate emulation of SG-1000, Master System (I, II) & Game Gear hardware models for 100% compatibility. * updated to new Genesis Plus license (see http://cgfm2.emuviews.com/) * removed DOS port * various code cleanup. [Gamecube/Wii] --------------- * IMPORTANT: cheats, screenshots & save files are now stored in console-specific directories (ex: /snaps/md, /cheats/ms, /saves/gg, ...) * added 8-bit Action Replay & Game Genie codes support (for Master System & Game Gear games). * improved audio/video synchronization for PAL games in 50Hz TV modes (now use VSYNC like NTSC games in 60hz modes). * improved gun cursor positioning accuracy. * improved horizontal scaling & screenshots rendering in H32 mode. * fixed a bug with ROM file extension handling that would affect cheats, snapshots, sram & savestate files. * removed ARAM/injected ROM support (unused). * removed WPAD_ and PAD_ update from VSYNC callback. * increased GCC inlining limits for some speed improvment. * compiled with devkitPPC r24 & libogc 1.8.7.
This commit is contained in:
parent
651e91ece6
commit
62f1204476
440
LICENSE.txt
440
LICENSE.txt
@ -1,440 +0,0 @@
|
|||||||
MAME License:
|
|
||||||
-------------
|
|
||||||
|
|
||||||
Redistribution and use of this code or any derivative works are permitted
|
|
||||||
provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions may not be sold, nor may they be used in a commercial
|
|
||||||
product or activity.
|
|
||||||
|
|
||||||
* Redistributions that are modified from the original source must include the
|
|
||||||
complete source code, including the source code for all components used by a
|
|
||||||
binary built from the modified sources. However, as a special exception, the
|
|
||||||
source code distributed need not include anything that is normally distributed
|
|
||||||
(in either source or binary form) with the major components (compiler, kernel,
|
|
||||||
and so on) of the operating system on which the executable runs, unless that
|
|
||||||
component itself accompanies the executable.
|
|
||||||
|
|
||||||
* Redistributions must reproduce the above copyright notice, this list of
|
|
||||||
conditions and the following disclaimer in the documentation and/or other
|
|
||||||
materials provided with the distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LIBTREMOR license:
|
|
||||||
------------------
|
|
||||||
|
|
||||||
Copyright (c) 2002, Xiph.org Foundation
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions
|
|
||||||
are met:
|
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived from
|
|
||||||
this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
|
|
||||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ASNDLIB License:
|
|
||||||
----------------
|
|
||||||
|
|
||||||
Copyright (c) 2008 Francisco Muñoz 'Hermes' <www.elotrolado.net>
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are
|
|
||||||
permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright notice, this list of
|
|
||||||
conditions and the following disclaimer.
|
|
||||||
- Redistributions in binary form must reproduce the above copyright notice, this list
|
|
||||||
of conditions and the following disclaimer in the documentation and/or other
|
|
||||||
materials provided with the distribution.
|
|
||||||
- The names of the contributors may not be used to endorse or promote products derived
|
|
||||||
from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
||||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
||||||
THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
||||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
|
||||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GNU License:
|
|
||||||
------------
|
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 2, June 1991
|
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
|
||||||
License is intended to guarantee your freedom to share and change free
|
|
||||||
software--to make sure the software is free for all its users. This
|
|
||||||
General Public License applies to most of the Free Software
|
|
||||||
Foundation's software and to any other program whose authors commit to
|
|
||||||
using it. (Some other Free Software Foundation software is covered by
|
|
||||||
the GNU Lesser General Public License instead.) You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
this service if you wish), that you receive source code or can get it
|
|
||||||
if you want it, that you can change the software or use pieces of it
|
|
||||||
in new free programs; and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid
|
|
||||||
anyone to deny you these rights or to ask you to surrender the rights.
|
|
||||||
These restrictions translate to certain responsibilities for you if you
|
|
||||||
distribute copies of the software, or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must give the recipients all the rights that
|
|
||||||
you have. You must make sure that they, too, receive or can get the
|
|
||||||
source code. And you must show them these terms so they know their
|
|
||||||
rights.
|
|
||||||
|
|
||||||
We protect your rights with two steps: (1) copyright the software, and
|
|
||||||
(2) offer you this license which gives you legal permission to copy,
|
|
||||||
distribute and/or modify the software.
|
|
||||||
|
|
||||||
Also, for each author's protection and ours, we want to make certain
|
|
||||||
that everyone understands that there is no warranty for this free
|
|
||||||
software. If the software is modified by someone else and passed on, we
|
|
||||||
want its recipients to know that what they have is not the original, so
|
|
||||||
that any problems introduced by others will not reflect on the original
|
|
||||||
authors' reputations.
|
|
||||||
|
|
||||||
Finally, any free program is threatened constantly by software
|
|
||||||
patents. We wish to avoid the danger that redistributors of a free
|
|
||||||
program will individually obtain patent licenses, in effect making the
|
|
||||||
program proprietary. To prevent this, we have made it clear that any
|
|
||||||
patent must be licensed for everyone's free use or not licensed at all.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
||||||
|
|
||||||
0. This License applies to any program or other work which contains
|
|
||||||
a notice placed by the copyright holder saying it may be distributed
|
|
||||||
under the terms of this General Public License. The "Program", below,
|
|
||||||
refers to any such program or work, and a "work based on the Program"
|
|
||||||
means either the Program or any derivative work under copyright law:
|
|
||||||
that is to say, a work containing the Program or a portion of it,
|
|
||||||
either verbatim or with modifications and/or translated into another
|
|
||||||
language. (Hereinafter, translation is included without limitation in
|
|
||||||
the term "modification".) Each licensee is addressed as "you".
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not
|
|
||||||
covered by this License; they are outside its scope. The act of
|
|
||||||
running the Program is not restricted, and the output from the Program
|
|
||||||
is covered only if its contents constitute a work based on the
|
|
||||||
Program (independent of having been made by running the Program).
|
|
||||||
Whether that is true depends on what the Program does.
|
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Program's
|
|
||||||
source code as you receive it, in any medium, provided that you
|
|
||||||
conspicuously and appropriately publish on each copy an appropriate
|
|
||||||
copyright notice and disclaimer of warranty; keep intact all the
|
|
||||||
notices that refer to this License and to the absence of any warranty;
|
|
||||||
and give any other recipients of the Program a copy of this License
|
|
||||||
along with the Program.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy, and
|
|
||||||
you may at your option offer warranty protection in exchange for a fee.
|
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Program or any portion
|
|
||||||
of it, thus forming a work based on the Program, and copy and
|
|
||||||
distribute such modifications or work under the terms of Section 1
|
|
||||||
above, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) You must cause the modified files to carry prominent notices
|
|
||||||
stating that you changed the files and the date of any change.
|
|
||||||
|
|
||||||
b) You must cause any work that you distribute or publish, that in
|
|
||||||
whole or in part contains or is derived from the Program or any
|
|
||||||
part thereof, to be licensed as a whole at no charge to all third
|
|
||||||
parties under the terms of this License.
|
|
||||||
|
|
||||||
c) If the modified program normally reads commands interactively
|
|
||||||
when run, you must cause it, when started running for such
|
|
||||||
interactive use in the most ordinary way, to print or display an
|
|
||||||
announcement including an appropriate copyright notice and a
|
|
||||||
notice that there is no warranty (or else, saying that you provide
|
|
||||||
a warranty) and that users may redistribute the program under
|
|
||||||
these conditions, and telling the user how to view a copy of this
|
|
||||||
License. (Exception: if the Program itself is interactive but
|
|
||||||
does not normally print such an announcement, your work based on
|
|
||||||
the Program is not required to print an announcement.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
|
||||||
identifiable sections of that work are not derived from the Program,
|
|
||||||
and can be reasonably considered independent and separate works in
|
|
||||||
themselves, then this License, and its terms, do not apply to those
|
|
||||||
sections when you distribute them as separate works. But when you
|
|
||||||
distribute the same sections as part of a whole which is a work based
|
|
||||||
on the Program, the distribution of the whole must be on the terms of
|
|
||||||
this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest
|
|
||||||
your rights to work written entirely by you; rather, the intent is to
|
|
||||||
exercise the right to control the distribution of derivative or
|
|
||||||
collective works based on the Program.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Program
|
|
||||||
with the Program (or with a work based on the Program) on a volume of
|
|
||||||
a storage or distribution medium does not bring the other work under
|
|
||||||
the scope of this License.
|
|
||||||
|
|
||||||
3. You may copy and distribute the Program (or a work based on it,
|
|
||||||
under Section 2) in object code or executable form under the terms of
|
|
||||||
Sections 1 and 2 above provided that you also do one of the following:
|
|
||||||
|
|
||||||
a) Accompany it with the complete corresponding machine-readable
|
|
||||||
source code, which must be distributed under the terms of Sections
|
|
||||||
1 and 2 above on a medium customarily used for software interchange; or,
|
|
||||||
|
|
||||||
b) Accompany it with a written offer, valid for at least three
|
|
||||||
years, to give any third party, for a charge no more than your
|
|
||||||
cost of physically performing source distribution, a complete
|
|
||||||
machine-readable copy of the corresponding source code, to be
|
|
||||||
distributed under the terms of Sections 1 and 2 above on a medium
|
|
||||||
customarily used for software interchange; or,
|
|
||||||
|
|
||||||
c) Accompany it with the information you received as to the offer
|
|
||||||
to distribute corresponding source code. (This alternative is
|
|
||||||
allowed only for noncommercial distribution and only if you
|
|
||||||
received the program in object code or executable form with such
|
|
||||||
an offer, in accord with Subsection b above.)
|
|
||||||
|
|
||||||
The source code for a work means the preferred form of the work for
|
|
||||||
making modifications to it. For an executable work, complete source
|
|
||||||
code means all the source code for all modules it contains, plus any
|
|
||||||
associated interface definition files, plus the scripts used to
|
|
||||||
control compilation and installation of the executable. However, as a
|
|
||||||
special exception, the source code distributed need not include
|
|
||||||
anything that is normally distributed (in either source or binary
|
|
||||||
form) with the major components (compiler, kernel, and so on) of the
|
|
||||||
operating system on which the executable runs, unless that component
|
|
||||||
itself accompanies the executable.
|
|
||||||
|
|
||||||
If distribution of executable or object code is made by offering
|
|
||||||
access to copy from a designated place, then offering equivalent
|
|
||||||
access to copy the source code from the same place counts as
|
|
||||||
distribution of the source code, even though third parties are not
|
|
||||||
compelled to copy the source along with the object code.
|
|
||||||
|
|
||||||
4. You may not copy, modify, sublicense, or distribute the Program
|
|
||||||
except as expressly provided under this License. Any attempt
|
|
||||||
otherwise to copy, modify, sublicense or distribute the Program is
|
|
||||||
void, and will automatically terminate your rights under this License.
|
|
||||||
However, parties who have received copies, or rights, from you under
|
|
||||||
this License will not have their licenses terminated so long as such
|
|
||||||
parties remain in full compliance.
|
|
||||||
|
|
||||||
5. You are not required to accept this License, since you have not
|
|
||||||
signed it. However, nothing else grants you permission to modify or
|
|
||||||
distribute the Program or its derivative works. These actions are
|
|
||||||
prohibited by law if you do not accept this License. Therefore, by
|
|
||||||
modifying or distributing the Program (or any work based on the
|
|
||||||
Program), you indicate your acceptance of this License to do so, and
|
|
||||||
all its terms and conditions for copying, distributing or modifying
|
|
||||||
the Program or works based on it.
|
|
||||||
|
|
||||||
6. Each time you redistribute the Program (or any work based on the
|
|
||||||
Program), the recipient automatically receives a license from the
|
|
||||||
original licensor to copy, distribute or modify the Program subject to
|
|
||||||
these terms and conditions. You may not impose any further
|
|
||||||
restrictions on the recipients' exercise of the rights granted herein.
|
|
||||||
You are not responsible for enforcing compliance by third parties to
|
|
||||||
this License.
|
|
||||||
|
|
||||||
7. If, as a consequence of a court judgment or allegation of patent
|
|
||||||
infringement or for any other reason (not limited to patent issues),
|
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot
|
|
||||||
distribute so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you
|
|
||||||
may not distribute the Program at all. For example, if a patent
|
|
||||||
license would not permit royalty-free redistribution of the Program by
|
|
||||||
all those who receive copies directly or indirectly through you, then
|
|
||||||
the only way you could satisfy both it and this License would be to
|
|
||||||
refrain entirely from distribution of the Program.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under
|
|
||||||
any particular circumstance, the balance of the section is intended to
|
|
||||||
apply and the section as a whole is intended to apply in other
|
|
||||||
circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any
|
|
||||||
patents or other property right claims or to contest validity of any
|
|
||||||
such claims; this section has the sole purpose of protecting the
|
|
||||||
integrity of the free software distribution system, which is
|
|
||||||
implemented by public license practices. Many people have made
|
|
||||||
generous contributions to the wide range of software distributed
|
|
||||||
through that system in reliance on consistent application of that
|
|
||||||
system; it is up to the author/donor to decide if he or she is willing
|
|
||||||
to distribute software through any other system and a licensee cannot
|
|
||||||
impose that choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
|
||||||
be a consequence of the rest of this License.
|
|
||||||
|
|
||||||
8. If the distribution and/or use of the Program is restricted in
|
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
|
||||||
original copyright holder who places the Program under this License
|
|
||||||
may add an explicit geographical distribution limitation excluding
|
|
||||||
those countries, so that distribution is permitted only in or among
|
|
||||||
countries not thus excluded. In such case, this License incorporates
|
|
||||||
the limitation as if written in the body of this License.
|
|
||||||
|
|
||||||
9. The Free Software Foundation may publish revised and/or new versions
|
|
||||||
of the General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Program
|
|
||||||
specifies a version number of this License which applies to it and "any
|
|
||||||
later version", you have the option of following the terms and conditions
|
|
||||||
either of that version or of any later version published by the Free
|
|
||||||
Software Foundation. If the Program does not specify a version number of
|
|
||||||
this License, you may choose any version ever published by the Free Software
|
|
||||||
Foundation.
|
|
||||||
|
|
||||||
10. If you wish to incorporate parts of the Program into other free
|
|
||||||
programs whose distribution conditions are different, write to the author
|
|
||||||
to ask for permission. For software which is copyrighted by the Free
|
|
||||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
|
||||||
make exceptions for this. Our decision will be guided by the two goals
|
|
||||||
of preserving the free status of all derivatives of our free software and
|
|
||||||
of promoting the sharing and reuse of software generally.
|
|
||||||
|
|
||||||
NO WARRANTY
|
|
||||||
|
|
||||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
|
||||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
|
||||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
|
||||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
|
||||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
|
||||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
|
||||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
|
||||||
REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
|
||||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
|
||||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
|
||||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
|
||||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
|
||||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
|
||||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGES.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
convey the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along
|
|
||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program is interactive, make it output a short notice like this
|
|
||||||
when it starts in an interactive mode:
|
|
||||||
|
|
||||||
Gnomovision version 69, Copyright (C) year name of author
|
|
||||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, the commands you use may
|
|
||||||
be called something other than `show w' and `show c'; they could even be
|
|
||||||
mouse-clicks or menu items--whatever suits your program.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or your
|
|
||||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
|
||||||
necessary. Here is a sample; alter the names:
|
|
||||||
|
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
|
||||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
|
||||||
|
|
||||||
<signature of Ty Coon>, 1 April 1989
|
|
||||||
Ty Coon, President of Vice
|
|
||||||
|
|
||||||
This General Public License does not permit incorporating your program into
|
|
||||||
proprietary programs. If your program is a subroutine library, you may
|
|
||||||
consider it more useful to permit linking proprietary applications with the
|
|
||||||
library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License.
|
|
@ -27,7 +27,7 @@ INCLUDES := source source/m68k source/z80 source/sound source/ntsc source/input_
|
|||||||
# options for code generation
|
# options for code generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
CFLAGS = -O3 -fomit-frame-pointer -Wall -Wno-strict-aliasing $(MACHDEP) $(INCLUDE) -DALT_RENDERER -DNGC -DHW_DOL
|
CFLAGS = -O3 -fomit-frame-pointer --param large-function-growth=800 --param inline-unit-growth=200 -Wall -Winline -Wno-strict-aliasing $(MACHDEP) $(INCLUDE) -DUSE_16BPP_RENDERING -DALT_RENDERER -DNGC -DHW_DOL
|
||||||
CXXFLAGS = $(CFLAGS)
|
CXXFLAGS = $(CFLAGS)
|
||||||
|
|
||||||
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||||
|
@ -27,7 +27,7 @@ INCLUDES := source source/m68k source/z80 source/sound source/ntsc source/input_
|
|||||||
# options for code generation
|
# options for code generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
CFLAGS = -O3 -fomit-frame-pointer -Wall -Wno-strict-aliasing $(MACHDEP) $(INCLUDE) -DALT_RENDERER -DNGC -DHW_RVL
|
CFLAGS = -O3 -fomit-frame-pointer --param large-function-growth=800 --param inline-unit-growth=200 -Wall -Winline -Wno-strict-aliasing $(MACHDEP) $(INCLUDE) -DUSE_16BPP_RENDERING -DALT_RENDERER -DNGC -DHW_RVL
|
||||||
CXXFLAGS = $(CFLAGS)
|
CXXFLAGS = $(CFLAGS)
|
||||||
|
|
||||||
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||||
|
133
Makefile.win32
Normal file
133
Makefile.win32
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
|
||||||
|
# Makefile for genplus SDL
|
||||||
|
#
|
||||||
|
# (c) 1999, 2000, 2001, 2002, 2003 Charles MacDonald
|
||||||
|
# modified by Eke-Eke <eke_eke31@yahoo.fr>
|
||||||
|
#
|
||||||
|
# Defines :
|
||||||
|
# -DLSB_FIRST : for little endian systems.
|
||||||
|
# -DLOGERROR : enable message logging
|
||||||
|
# -DLOGVDP : enable VDP debug messages
|
||||||
|
# -DLOGSOUND : enable AUDIO debug messages
|
||||||
|
# -D8BPP_RENDERING - configure for 8-bit pixels (RGB332)
|
||||||
|
# -D15BPP_RENDERING - configure for 15-bit pixels (RGB555)
|
||||||
|
# -D16BPP_RENDERING - configure for 16-bit pixels (RGB565)
|
||||||
|
# -D32BPP_RENDERING - configure for 32-bit pixels (RGB888)
|
||||||
|
|
||||||
|
NAME = gen_sdl.exe
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CFLAGS = `sdl-config --cflags` -march=i686 -O6 -fomit-frame-pointer -Wall -Wno-strict-aliasing
|
||||||
|
#-g -ggdb -pg
|
||||||
|
#-fomit-frame-pointer
|
||||||
|
#LDFLAGS = -pg
|
||||||
|
DEFINES = -DLSB_FIRST -DUSE_16BPP_RENDERING
|
||||||
|
|
||||||
|
INCLUDES = -Isource -Isource/z80 -Isource/m68k -Isource/sound -Isource/input_hw -Isource/cart_hw -Isource/cart_hw/svp -Isource/ntsc -Isource/win
|
||||||
|
LIBS = `sdl-config --libs` -lz -lm
|
||||||
|
|
||||||
|
OBJDIR = ./build_sdl
|
||||||
|
|
||||||
|
OBJECTS = $(OBJDIR)/z80.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/m68kcpu.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/genesis.o \
|
||||||
|
$(OBJDIR)/vdp_ctrl.o \
|
||||||
|
$(OBJDIR)/vdp_render.o \
|
||||||
|
$(OBJDIR)/system.o \
|
||||||
|
$(OBJDIR)/io_ctrl.o \
|
||||||
|
$(OBJDIR)/mem68k.o \
|
||||||
|
$(OBJDIR)/memz80.o \
|
||||||
|
$(OBJDIR)/membnk.o \
|
||||||
|
$(OBJDIR)/state.o \
|
||||||
|
$(OBJDIR)/loadrom.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/input.o \
|
||||||
|
$(OBJDIR)/gamepad.o \
|
||||||
|
$(OBJDIR)/lightgun.o \
|
||||||
|
$(OBJDIR)/mouse.o \
|
||||||
|
$(OBJDIR)/activator.o \
|
||||||
|
$(OBJDIR)/xe_a1p.o \
|
||||||
|
$(OBJDIR)/teamplayer.o \
|
||||||
|
$(OBJDIR)/paddle.o \
|
||||||
|
$(OBJDIR)/sportspad.o \
|
||||||
|
$(OBJDIR)/terebi_oekaki.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/sound.o \
|
||||||
|
$(OBJDIR)/sn76489.o \
|
||||||
|
$(OBJDIR)/ym2413.o \
|
||||||
|
$(OBJDIR)/ym2612.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/Fir_Resampler.o
|
||||||
|
OBJECTS += $(OBJDIR)/blip.o
|
||||||
|
OBJECTS += $(OBJDIR)/eq.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/sram.o \
|
||||||
|
$(OBJDIR)/svp.o \
|
||||||
|
$(OBJDIR)/ssp16.o \
|
||||||
|
$(OBJDIR)/ggenie.o \
|
||||||
|
$(OBJDIR)/areplay.o \
|
||||||
|
$(OBJDIR)/gg_eeprom.o \
|
||||||
|
$(OBJDIR)/md_eeprom.o \
|
||||||
|
$(OBJDIR)/md_cart.o \
|
||||||
|
$(OBJDIR)/sms_cart.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/sms_ntsc.o \
|
||||||
|
$(OBJDIR)/md_ntsc.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/main.o \
|
||||||
|
$(OBJDIR)/config.o \
|
||||||
|
$(OBJDIR)/error.o \
|
||||||
|
$(OBJDIR)/unzip.o \
|
||||||
|
$(OBJDIR)/fileio.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/icon.o
|
||||||
|
|
||||||
|
all: $(NAME)
|
||||||
|
|
||||||
|
$(NAME): $(OBJDIR) $(OBJECTS)
|
||||||
|
$(CC) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@
|
||||||
|
|
||||||
|
$(OBJDIR) :
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : source/%.c source/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : source/sound/%.c source/sound/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : source/input_hw/%.c source/input_hw/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : source/cart_hw/%.c source/cart_hw/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : source/cart_hw/svp/%.c
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : source/cart_hw/svp/%.c source/cart_hw/svp/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : source/z80/%.c source/z80/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : source/m68k/%.c source/m68k/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : source/ntsc/%.c source/ntsc/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : source/win/%.c source/win/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/icon.o :
|
||||||
|
windres source/win/icon.rc $@
|
||||||
|
|
||||||
|
pack :
|
||||||
|
strip $(NAME)
|
||||||
|
upx -9 $(NAME)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJECTS) $(NAME)
|
@ -2,22 +2,39 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Action Replay / Pro Action Replay emulation
|
* Action Replay / Pro Action Replay emulation
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Eke-Eke (GCN/Wii port)
|
* Copyright (C) 2009-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
|
||||||
|
@ -2,22 +2,39 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* DATEL Action Replay / Pro Action Replay emulation
|
* DATEL Action Replay / Pro Action Replay emulation
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Eke-Eke (GCN/Wii port)
|
* Copyright (C) 2009-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _AREPLAY_H_
|
#ifndef _AREPLAY_H_
|
||||||
#define _AREPLAY_H_
|
#define _AREPLAY_H_
|
||||||
|
@ -1,462 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
* Genesis Plus
|
|
||||||
* I2C EEPROM support
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* 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"
|
|
||||||
|
|
||||||
#define GAME_CNT 30
|
|
||||||
|
|
||||||
T_EEPROM eeprom;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
char game_id[16];
|
|
||||||
uint16 chk;
|
|
||||||
T_EEPROM_TYPE type;
|
|
||||||
} T_GAME_ENTRY;
|
|
||||||
|
|
||||||
static const T_GAME_ENTRY database[GAME_CNT] =
|
|
||||||
{
|
|
||||||
/* ACCLAIM mappers */
|
|
||||||
/* 24C02 (old mapper) */
|
|
||||||
{{"T-081326" }, 0, {8, 0xFF, 0xFF, 0x200001, 0x200001, 0x200001, 0, 1, 1}}, /* NBA Jam (UE) */
|
|
||||||
{{"T-81033" }, 0, {8, 0xFF, 0xFF, 0x200001, 0x200001, 0x200001, 0, 1, 1}}, /* NBA Jam (J) */
|
|
||||||
/* 24C02 */
|
|
||||||
{{"T-081276" }, 0, {8, 0xFF, 0xFF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* NFL Quarterback Club */
|
|
||||||
/* 24C04 */
|
|
||||||
{{"T-81406" }, 0, {8, 0x1FF, 0x1FF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* NBA Jam TE */
|
|
||||||
/* 24C16 */
|
|
||||||
{{"T-081586" }, 0, {8, 0x7FF, 0x7FF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* NFL Quarterback Club '96 */
|
|
||||||
/* 24C65 */
|
|
||||||
{{"T-81576" }, 0, {16, 0x1FFF, 0x1FFF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* College Slam */
|
|
||||||
{{"T-81476" }, 0, {16, 0x1FFF, 0x1FFF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* Frank Thomas Big Hurt Baseball */
|
|
||||||
|
|
||||||
/* EA mapper (24C01 only) */
|
|
||||||
{{"T-50176" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* Rings of Power */
|
|
||||||
{{"T-50396" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* NHLPA Hockey 93 */
|
|
||||||
{{"T-50446" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* John Madden Football 93 */
|
|
||||||
{{"T-50516" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* John Madden Football 93 (Championship Ed.) */
|
|
||||||
{{"T-50606" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* Bill Walsh College Football */
|
|
||||||
|
|
||||||
/* SEGA mapper (24C01 only) */
|
|
||||||
{{"T-12046" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Megaman - The Wily Wars */
|
|
||||||
{{"T-12053" }, 0xEA80, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Rockman Mega World (J) [A] */
|
|
||||||
{{"MK-1215" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Evander 'Real Deal' Holyfield's Boxing */
|
|
||||||
{{"MK-1228" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Greatest Heavyweights of the Ring (U) */
|
|
||||||
{{"G-5538" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Greatest Heavyweights of the Ring (J) */
|
|
||||||
{{"PR-1993" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Greatest Heavyweights of the Ring (E) */
|
|
||||||
{{"G-4060" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Wonderboy in Monster World */
|
|
||||||
{{"00001211-00"}, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Sports Talk Baseball */
|
|
||||||
{{"00004076-00"}, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Honoo no Toukyuuji Dodge Danpei */
|
|
||||||
{{"G-4524" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Ninja Burai Densetsu */
|
|
||||||
{{"00054503-00"}, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Game Toshokan */
|
|
||||||
|
|
||||||
/* CODEMASTERS mapper */
|
|
||||||
/* 24C08 */
|
|
||||||
{{"T-120106" }, 0, {8, 0x3FF, 0x3FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Brian Lara Cricket */
|
|
||||||
{{"00000000-00"}, 0x168B, {8, 0x3FF, 0x3FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines Military */
|
|
||||||
{{"00000000-00"}, 0xCEE0, {8, 0x3FF, 0x3FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines Military (Bad)*/
|
|
||||||
/* 24C16 */
|
|
||||||
{{"T-120096" }, 0, {8, 0x7FF, 0x7FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines 2 - Turbo Tournament (E) */
|
|
||||||
{{"00000000-00"}, 0x165E, {8, 0x7FF, 0x7FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines Turbo Tournament 96 */
|
|
||||||
{{"00000000-00"}, 0x2C41, {8, 0x7FF, 0x7FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines Turbo Tournament 96 (Bad)*/
|
|
||||||
/* 24C65 */
|
|
||||||
{{"T-120146-50"}, 0, {16, 0x1FFF, 0x1FFF, 0x300000, 0x380001, 0x300000, 0, 7, 1}} /* Brian Lara Cricket 96, Shane Warne Cricket */
|
|
||||||
};
|
|
||||||
|
|
||||||
void eeprom_init()
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
/* initialize eeprom */
|
|
||||||
memset(&eeprom, 0, sizeof(T_EEPROM));
|
|
||||||
eeprom.sda = eeprom.old_sda = 1;
|
|
||||||
eeprom.scl = eeprom.old_scl = 1;
|
|
||||||
eeprom.state = STAND_BY;
|
|
||||||
|
|
||||||
/* no eeprom by default */
|
|
||||||
sram.custom = 0;
|
|
||||||
|
|
||||||
/* look into game database */
|
|
||||||
while (i<GAME_CNT)
|
|
||||||
{
|
|
||||||
if (strstr(rominfo.product,database[i].game_id) != NULL)
|
|
||||||
{
|
|
||||||
/* additional check (Micro Machines, Rockman Mega World) */
|
|
||||||
if ((database[i].chk == 0) || (database[i].chk == rominfo.checksum))
|
|
||||||
{
|
|
||||||
sram.custom = 1;
|
|
||||||
sram.on = 1;
|
|
||||||
memcpy(&eeprom.type, &database[i].type, sizeof(T_EEPROM_TYPE));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Game not found in database but header seems to indicate it uses EEPROM */
|
|
||||||
if (sram.detected)
|
|
||||||
{
|
|
||||||
if ((sram.end - sram.start) < 2)
|
|
||||||
{
|
|
||||||
/* set SEGA mapper as default */
|
|
||||||
sram.custom = 1;
|
|
||||||
memcpy(&eeprom.type, &database[9].type, sizeof(T_EEPROM_TYPE));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void Detect_START()
|
|
||||||
{
|
|
||||||
if (eeprom.old_scl && eeprom.scl)
|
|
||||||
{
|
|
||||||
if (eeprom.old_sda && !eeprom.sda)
|
|
||||||
{
|
|
||||||
eeprom.cycles = 0;
|
|
||||||
eeprom.slave_mask = 0;
|
|
||||||
if (eeprom.type.address_bits == 7)
|
|
||||||
{
|
|
||||||
eeprom.word_address = 0;
|
|
||||||
eeprom.state = GET_WORD_ADR_7BITS;
|
|
||||||
}
|
|
||||||
else eeprom.state = GET_SLAVE_ADR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void Detect_STOP()
|
|
||||||
{
|
|
||||||
if (eeprom.old_scl && eeprom.scl)
|
|
||||||
{
|
|
||||||
if (!eeprom.old_sda && eeprom.sda)
|
|
||||||
{
|
|
||||||
eeprom.state = STAND_BY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void eeprom_write(unsigned int address, unsigned int data, int word_access)
|
|
||||||
{
|
|
||||||
/* decode SCL and SDA value */
|
|
||||||
if (word_access)
|
|
||||||
{
|
|
||||||
/* 16-bits access */
|
|
||||||
if (eeprom.type.sda_in_adr == address) eeprom.sda = (data >> (8 + eeprom.type.sda_in_bit)) & 1; /* MSB */
|
|
||||||
else if (eeprom.type.sda_in_adr == (address | 1)) eeprom.sda = (data >> eeprom.type.sda_in_bit) & 1; /* LSB */
|
|
||||||
else eeprom.sda = eeprom.old_sda;
|
|
||||||
|
|
||||||
if (eeprom.type.scl_adr == address) eeprom.scl = (data >> (8 + eeprom.type.scl_bit)) & 1; /* MSB */
|
|
||||||
else if (eeprom.type.scl_adr == (address | 1)) eeprom.scl = (data >> eeprom.type.scl_bit) & 1; /* LSB */
|
|
||||||
else eeprom.scl = eeprom.old_scl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (eeprom.type.sda_in_adr == address) eeprom.sda = (data >> eeprom.type.sda_in_bit) & 1;
|
|
||||||
else eeprom.sda = eeprom.old_sda;
|
|
||||||
|
|
||||||
if (eeprom.type.scl_adr == address) eeprom.scl = (data >> eeprom.type.scl_bit) & 1;
|
|
||||||
else eeprom.scl = eeprom.old_scl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EEPROM current state */
|
|
||||||
switch (eeprom.state)
|
|
||||||
{
|
|
||||||
/* Standby Mode */
|
|
||||||
case STAND_BY:
|
|
||||||
Detect_START();
|
|
||||||
Detect_STOP();
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* Suspended Mode */
|
|
||||||
case WAIT_STOP:
|
|
||||||
Detect_STOP();
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* Get Word Address 7 bits: MODE-1 only (24C01)
|
|
||||||
* and R/W bit
|
|
||||||
*/
|
|
||||||
case GET_WORD_ADR_7BITS:
|
|
||||||
Detect_START();
|
|
||||||
Detect_STOP();
|
|
||||||
|
|
||||||
/* look for SCL LOW to HIGH transition */
|
|
||||||
if (!eeprom.old_scl && eeprom.scl)
|
|
||||||
{
|
|
||||||
if (eeprom.cycles == 0) eeprom.cycles ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* look for SCL HIGH to LOW transition */
|
|
||||||
if (eeprom.old_scl && !eeprom.scl && (eeprom.cycles > 0))
|
|
||||||
{
|
|
||||||
if (eeprom.cycles < 8)
|
|
||||||
{
|
|
||||||
eeprom.word_address |= (eeprom.old_sda << (7 - eeprom.cycles));
|
|
||||||
}
|
|
||||||
else if (eeprom.cycles == 8)
|
|
||||||
{
|
|
||||||
eeprom.rw = eeprom.old_sda;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ /* ACK CYCLE */
|
|
||||||
eeprom.cycles = 0;
|
|
||||||
eeprom.word_address &= eeprom.type.size_mask;
|
|
||||||
eeprom.state = eeprom.rw ? READ_DATA : WRITE_DATA;
|
|
||||||
}
|
|
||||||
|
|
||||||
eeprom.cycles ++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
/* Get Slave Address (3bits) : MODE-2 & MODE-3 only (24C01 - 24C512) (0-3bits, depending on the array size)
|
|
||||||
* or/and Word Address MSB: MODE-2 only (24C04 - 24C16) (0-3bits, depending on the array size)
|
|
||||||
* and R/W bit
|
|
||||||
*/
|
|
||||||
case GET_SLAVE_ADR:
|
|
||||||
|
|
||||||
Detect_START();
|
|
||||||
Detect_STOP();
|
|
||||||
|
|
||||||
/* look for SCL LOW to HIGH transition */
|
|
||||||
if (!eeprom.old_scl && eeprom.scl)
|
|
||||||
{
|
|
||||||
if (eeprom.cycles == 0) eeprom.cycles ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* look for SCL HIGH to LOW transition */
|
|
||||||
if (eeprom.old_scl && !eeprom.scl && (eeprom.cycles > 0))
|
|
||||||
{
|
|
||||||
if ((eeprom.cycles > 4) && (eeprom.cycles <8))
|
|
||||||
{
|
|
||||||
if ((eeprom.type.address_bits == 16) ||
|
|
||||||
(eeprom.type.size_mask < (1 << (15 - eeprom.cycles))))
|
|
||||||
{
|
|
||||||
/* this is a SLAVE ADDRESS bit */
|
|
||||||
eeprom.slave_mask |= (eeprom.old_sda << (7 - eeprom.cycles));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* this is a WORD ADDRESS high bit */
|
|
||||||
if (eeprom.old_sda) eeprom.word_address |= (1 << (15 - eeprom.cycles));
|
|
||||||
else eeprom.word_address &= ~(1 << (15 - eeprom.cycles));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (eeprom.cycles == 8) eeprom.rw = eeprom.old_sda;
|
|
||||||
else if (eeprom.cycles > 8)
|
|
||||||
{
|
|
||||||
/* ACK CYCLE */
|
|
||||||
eeprom.cycles = 0;
|
|
||||||
if (eeprom.type.address_bits == 16)
|
|
||||||
{
|
|
||||||
/* two ADDRESS bytes */
|
|
||||||
eeprom.state = eeprom.rw ? READ_DATA : GET_WORD_ADR_HIGH;
|
|
||||||
eeprom.slave_mask <<= 16;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* one ADDRESS byte */
|
|
||||||
eeprom.state = eeprom.rw ? READ_DATA : GET_WORD_ADR_LOW;
|
|
||||||
eeprom.slave_mask <<= 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
eeprom.cycles ++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* Get Word Address MSB (4-8bits depending on the array size)
|
|
||||||
* MODE-3 only (24C32 - 24C512)
|
|
||||||
*/
|
|
||||||
case GET_WORD_ADR_HIGH:
|
|
||||||
|
|
||||||
Detect_START();
|
|
||||||
Detect_STOP();
|
|
||||||
|
|
||||||
/* look for SCL HIGH to LOW transition */
|
|
||||||
if (eeprom.old_scl && !eeprom.scl)
|
|
||||||
{
|
|
||||||
if (eeprom.cycles < 9)
|
|
||||||
{
|
|
||||||
if ((eeprom.type.size_mask + 1) < (1 << (17 - eeprom.cycles)))
|
|
||||||
{
|
|
||||||
/* ignored bit: slave mask should be right-shifted by one */
|
|
||||||
eeprom.slave_mask >>= 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* this is a WORD ADDRESS high bit */
|
|
||||||
if (eeprom.old_sda) eeprom.word_address |= (1 << (16 - eeprom.cycles));
|
|
||||||
else eeprom.word_address &= ~(1 << (16 - eeprom.cycles));
|
|
||||||
}
|
|
||||||
|
|
||||||
eeprom.cycles ++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* ACK CYCLE */
|
|
||||||
eeprom.cycles = 1;
|
|
||||||
eeprom.state = GET_WORD_ADR_LOW;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
/* Get Word Address LSB: 7bits (24C01) or 8bits (24C02-24C512)
|
|
||||||
* MODE-2 and MODE-3 only (24C01 - 24C512)
|
|
||||||
*/
|
|
||||||
case GET_WORD_ADR_LOW:
|
|
||||||
|
|
||||||
Detect_START();
|
|
||||||
Detect_STOP();
|
|
||||||
|
|
||||||
/* look for SCL HIGH to LOW transition */
|
|
||||||
if (eeprom.old_scl && !eeprom.scl)
|
|
||||||
{
|
|
||||||
if (eeprom.cycles < 9)
|
|
||||||
{
|
|
||||||
if ((eeprom.type.size_mask + 1) < (1 << (9 - eeprom.cycles)))
|
|
||||||
{
|
|
||||||
/* ignored bit (X24C01): slave mask should be right-shifted by one */
|
|
||||||
eeprom.slave_mask >>= 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* this is a WORD ADDRESS high bit */
|
|
||||||
if (eeprom.old_sda) eeprom.word_address |= (1 << (8 - eeprom.cycles));
|
|
||||||
else eeprom.word_address &= ~(1 << (8 - eeprom.cycles));
|
|
||||||
}
|
|
||||||
|
|
||||||
eeprom.cycles ++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* ACK CYCLE */
|
|
||||||
eeprom.cycles = 1;
|
|
||||||
eeprom.word_address &= eeprom.type.size_mask;
|
|
||||||
eeprom.state = WRITE_DATA;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Read Cycle
|
|
||||||
*/
|
|
||||||
case READ_DATA:
|
|
||||||
|
|
||||||
Detect_START();
|
|
||||||
Detect_STOP();
|
|
||||||
|
|
||||||
/* look for SCL HIGH to LOW transition */
|
|
||||||
if (eeprom.old_scl && !eeprom.scl)
|
|
||||||
{
|
|
||||||
if (eeprom.cycles < 9) eeprom.cycles ++;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
eeprom.cycles = 1;
|
|
||||||
|
|
||||||
/* ACK not received */
|
|
||||||
if (eeprom.old_sda) eeprom.state = WAIT_STOP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Write Cycle
|
|
||||||
*/
|
|
||||||
case WRITE_DATA:
|
|
||||||
|
|
||||||
Detect_START();
|
|
||||||
Detect_STOP();
|
|
||||||
|
|
||||||
/* look for SCL HIGH to LOW transition */
|
|
||||||
if (eeprom.old_scl && !eeprom.scl)
|
|
||||||
{
|
|
||||||
if (eeprom.cycles < 9)
|
|
||||||
{
|
|
||||||
/* Write DATA bits (max 64kBytes) */
|
|
||||||
uint16 sram_address = (eeprom.slave_mask | eeprom.word_address) & 0xFFFF;
|
|
||||||
if (eeprom.old_sda) sram.sram[sram_address] |= (1 << (8 - eeprom.cycles));
|
|
||||||
else sram.sram[sram_address] &= ~(1 << (8 - eeprom.cycles));
|
|
||||||
|
|
||||||
if (eeprom.cycles == 8)
|
|
||||||
{
|
|
||||||
/* WORD ADDRESS is incremented (roll up at maximum pagesize) */
|
|
||||||
eeprom.word_address = (eeprom.word_address & (0xFFFF - eeprom.type.pagewrite_mask)) |
|
|
||||||
((eeprom.word_address + 1) & eeprom.type.pagewrite_mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
eeprom.cycles ++;
|
|
||||||
}
|
|
||||||
else eeprom.cycles = 1; /* ACK cycle */
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
eeprom.old_scl = eeprom.scl;
|
|
||||||
eeprom.old_sda = eeprom.sda;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int eeprom_read(int word_access)
|
|
||||||
{
|
|
||||||
uint8 sda_out = eeprom.sda;
|
|
||||||
|
|
||||||
/* EEPROM state */
|
|
||||||
switch (eeprom.state)
|
|
||||||
{
|
|
||||||
case READ_DATA:
|
|
||||||
if (eeprom.cycles < 9)
|
|
||||||
{
|
|
||||||
/* Return DATA bits (max 64kBytes) */
|
|
||||||
uint16 sram_address = (eeprom.slave_mask | eeprom.word_address) & 0xffff;
|
|
||||||
sda_out = (sram.sram[sram_address] >> (8 - eeprom.cycles)) & 1;
|
|
||||||
|
|
||||||
if (eeprom.cycles == 8)
|
|
||||||
{
|
|
||||||
/* WORD ADDRESS is incremented (roll up at maximum array size) */
|
|
||||||
eeprom.word_address ++;
|
|
||||||
eeprom.word_address &= eeprom.type.size_mask;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GET_WORD_ADR_7BITS:
|
|
||||||
case GET_SLAVE_ADR:
|
|
||||||
case GET_WORD_ADR_HIGH:
|
|
||||||
case GET_WORD_ADR_LOW:
|
|
||||||
case WRITE_DATA:
|
|
||||||
if (eeprom.cycles == 9) sda_out = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* memory access */
|
|
||||||
if (word_access)
|
|
||||||
{
|
|
||||||
/* 16-bits access */
|
|
||||||
if (eeprom.type.sda_out_adr & 1) return (sda_out << eeprom.type.sda_out_bit); /* LSB */
|
|
||||||
else return (sda_out << (eeprom.type.sda_out_bit + 8)); /* MSB */
|
|
||||||
}
|
|
||||||
else return (sda_out << eeprom.type.sda_out_bit);
|
|
||||||
}
|
|
259
source/cart_hw/gg_eeprom.c
Normal file
259
source/cart_hw/gg_eeprom.c
Normal file
@ -0,0 +1,259 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Genesis Plus
|
||||||
|
* Microwire Serial EEPROM (93C46) support
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 Eke-Eke (Genesis Plus GX)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#include "shared.h"
|
||||||
|
|
||||||
|
#define BIT_DATA (0)
|
||||||
|
#define BIT_CLK (1)
|
||||||
|
#define BIT_CS (2)
|
||||||
|
|
||||||
|
|
||||||
|
T_EEPROM_93C gg_eeprom;
|
||||||
|
|
||||||
|
void gg_eeprom_init()
|
||||||
|
{
|
||||||
|
/* default eeprom state */
|
||||||
|
memset(&gg_eeprom, 0, sizeof(T_EEPROM_93C));
|
||||||
|
gg_eeprom.data = 1;
|
||||||
|
gg_eeprom.state = WAIT_START;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gg_eeprom_ctrl(unsigned char data)
|
||||||
|
{
|
||||||
|
/* Reset EEPROM */
|
||||||
|
if (data & 0x80)
|
||||||
|
{
|
||||||
|
gg_eeprom_init();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Enable EEPROM */
|
||||||
|
gg_eeprom.enabled = data & 0x08;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gg_eeprom_write(unsigned char data)
|
||||||
|
{
|
||||||
|
/* Make sure CS is HIGH */
|
||||||
|
if (data & (1 << BIT_CS))
|
||||||
|
{
|
||||||
|
/* Data latched on CLK postive edge */
|
||||||
|
if ((data & (1 << BIT_CLK)) && !gg_eeprom.clk)
|
||||||
|
{
|
||||||
|
/* Current EEPROM state */
|
||||||
|
switch (gg_eeprom.state)
|
||||||
|
{
|
||||||
|
case WAIT_START:
|
||||||
|
{
|
||||||
|
/* Wait for START bit */
|
||||||
|
if (data & (1 << BIT_DATA))
|
||||||
|
{
|
||||||
|
gg_eeprom.opcode = 0;
|
||||||
|
gg_eeprom.cycles = 0;
|
||||||
|
gg_eeprom.state = GET_OPCODE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case GET_OPCODE:
|
||||||
|
{
|
||||||
|
/* 8-bit buffer (opcode + address) */
|
||||||
|
gg_eeprom.opcode |= ((data >> BIT_DATA) & 1) << (7 - gg_eeprom.cycles);
|
||||||
|
gg_eeprom.cycles++;
|
||||||
|
|
||||||
|
if (gg_eeprom.cycles == 8)
|
||||||
|
{
|
||||||
|
/* Decode instruction */
|
||||||
|
switch ((gg_eeprom.opcode >> 6) & 3)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
/* WRITE */
|
||||||
|
gg_eeprom.buffer = 0;
|
||||||
|
gg_eeprom.cycles = 0;
|
||||||
|
gg_eeprom.state = WRITE_WORD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
/* READ */
|
||||||
|
gg_eeprom.buffer = *(uint16 *)(sram.sram + ((gg_eeprom.opcode & 0x3F) << 1));
|
||||||
|
gg_eeprom.cycles = 0;
|
||||||
|
gg_eeprom.state = READ_WORD;
|
||||||
|
|
||||||
|
/* Force DATA OUT */
|
||||||
|
gg_eeprom.data = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
{
|
||||||
|
/* ERASE */
|
||||||
|
if (gg_eeprom.we)
|
||||||
|
{
|
||||||
|
*(uint16 *)(sram.sram + ((gg_eeprom.opcode & 0x3F) << 1)) = 0xFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* wait for next command */
|
||||||
|
gg_eeprom.state = WAIT_STANDBY;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
/* special command */
|
||||||
|
switch ((gg_eeprom.opcode >> 4) & 3)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
/* WRITE ALL */
|
||||||
|
gg_eeprom.buffer = 0;
|
||||||
|
gg_eeprom.cycles = 0;
|
||||||
|
gg_eeprom.state = WRITE_WORD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
/* ERASE ALL */
|
||||||
|
if (gg_eeprom.we)
|
||||||
|
{
|
||||||
|
memset(sram.sram, 0xFF, 128);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* wait for next command */
|
||||||
|
gg_eeprom.state = WAIT_STANDBY;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
/* WRITE ENABLE/DISABLE */
|
||||||
|
gg_eeprom.we = (gg_eeprom.opcode >> 4) & 1;
|
||||||
|
|
||||||
|
/* wait for next command */
|
||||||
|
gg_eeprom.state = WAIT_STANDBY;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WRITE_WORD:
|
||||||
|
{
|
||||||
|
/* 16-bit data buffer */
|
||||||
|
gg_eeprom.buffer |= ((data >> BIT_DATA) & 1) << (15 - gg_eeprom.cycles);
|
||||||
|
gg_eeprom.cycles++;
|
||||||
|
|
||||||
|
if (gg_eeprom.cycles == 16)
|
||||||
|
{
|
||||||
|
/* check EEPROM write protection */
|
||||||
|
if (gg_eeprom.we)
|
||||||
|
{
|
||||||
|
if (gg_eeprom.opcode & 0x40)
|
||||||
|
{
|
||||||
|
/* write one word */
|
||||||
|
*(uint16 *)(sram.sram + ((gg_eeprom.opcode & 0x3F) << 1)) = gg_eeprom.buffer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* write 64 words */
|
||||||
|
int i;
|
||||||
|
for (i=0; i<64; i++)
|
||||||
|
{
|
||||||
|
*(uint16 *)(sram.sram + (i << 1)) = gg_eeprom.buffer;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* wait for next command */
|
||||||
|
gg_eeprom.state = WAIT_STANDBY;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case READ_WORD:
|
||||||
|
{
|
||||||
|
/* set DATA OUT */
|
||||||
|
gg_eeprom.data = ((gg_eeprom.buffer >> (15 - gg_eeprom.cycles)) & 1);
|
||||||
|
gg_eeprom.cycles++;
|
||||||
|
|
||||||
|
if (gg_eeprom.cycles == 16)
|
||||||
|
{
|
||||||
|
/* read next word (93C46B) */
|
||||||
|
gg_eeprom.opcode++;
|
||||||
|
gg_eeprom.cycles = 0;
|
||||||
|
gg_eeprom.buffer = *(uint16 *)(sram.sram + ((gg_eeprom.opcode & 0x3F) << 1));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
/* wait for STANDBY mode */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* CS HIGH->LOW transition */
|
||||||
|
if (gg_eeprom.cs)
|
||||||
|
{
|
||||||
|
/* standby mode */
|
||||||
|
gg_eeprom.data = 1;
|
||||||
|
gg_eeprom.state = WAIT_START;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update input lines */
|
||||||
|
gg_eeprom.cs = (data >> BIT_CS) & 1;
|
||||||
|
gg_eeprom.clk = (data >> BIT_CLK) & 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char gg_eeprom_read(void)
|
||||||
|
{
|
||||||
|
return ((gg_eeprom.cs << BIT_CS) | (gg_eeprom.data << BIT_DATA) | (1 << BIT_CLK));
|
||||||
|
}
|
||||||
|
|
75
source/cart_hw/gg_eeprom.h
Normal file
75
source/cart_hw/gg_eeprom.h
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Genesis Plus
|
||||||
|
* Microwire Serial EEPROM (93C46) support
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 Eke-Eke (Genesis Plus GX)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _GG_EEPROM_H_
|
||||||
|
#define _GG_EEPROM_H_
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
WAIT_STANDBY,
|
||||||
|
WAIT_START,
|
||||||
|
GET_OPCODE,
|
||||||
|
WRITE_WORD,
|
||||||
|
READ_WORD,
|
||||||
|
|
||||||
|
} T_STATE;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8 enabled; /* 1: chip enabled */
|
||||||
|
uint8 cs; /* CHIP SELECT line state */
|
||||||
|
uint8 clk; /* CLK line state */
|
||||||
|
uint8 data; /* DATA OUT line state */
|
||||||
|
uint8 cycles; /* current operation cycle */
|
||||||
|
uint8 we; /* 1: write enabled */
|
||||||
|
uint8 opcode; /* 8-bit opcode + address */
|
||||||
|
uint16 buffer; /* 16-bit data buffer */
|
||||||
|
T_STATE state; /* current operation state */
|
||||||
|
|
||||||
|
} T_EEPROM_93C;
|
||||||
|
|
||||||
|
/* global variables */
|
||||||
|
extern T_EEPROM_93C gg_eeprom;
|
||||||
|
|
||||||
|
/* Function prototypes */
|
||||||
|
extern void gg_eeprom_init();
|
||||||
|
extern void gg_eeprom_ctrl(unsigned char data);
|
||||||
|
extern void gg_eeprom_write(unsigned char data);
|
||||||
|
extern unsigned char gg_eeprom_read(void);
|
||||||
|
|
||||||
|
#endif
|
@ -2,25 +2,42 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Game Genie Hardware emulation
|
* Game Genie Hardware emulation
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Eke-Eke (GCN/Wii port)
|
* Copyright (C) 2009-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Based on documentation from Charles McDonald
|
* Based on documentation from Charles McDonald
|
||||||
* (http://cgfm2.emuviews.com/txt/genie.txt)
|
* (http://cgfm2.emuviews.com/txt/genie.txt)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
|
||||||
@ -44,12 +61,17 @@ void ggenie_init(void)
|
|||||||
{
|
{
|
||||||
memset(&ggenie,0,sizeof(ggenie));
|
memset(&ggenie,0,sizeof(ggenie));
|
||||||
|
|
||||||
/* Open Game Genie ROM */
|
/* Open Game Genie ROM file */
|
||||||
FILE *f = fopen(GG_ROM,"rb");
|
FILE *f = fopen(GG_ROM,"rb");
|
||||||
if (!f) return;
|
if (!f) return;
|
||||||
|
|
||||||
/* store Game Genie ROM above cartridge ROM + SRAM */
|
/* Store Game Genie ROM above cartridge ROM + SRAM */
|
||||||
if (cart.romsize > 0x600000) return;
|
if (cart.romsize > 0x600000)
|
||||||
|
{
|
||||||
|
fclose(f);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ggenie.rom = cart.rom + 0x600000;
|
ggenie.rom = cart.rom + 0x600000;
|
||||||
|
|
||||||
/* Load ROM */
|
/* Load ROM */
|
||||||
@ -59,6 +81,8 @@ void ggenie_init(void)
|
|||||||
fread(ggenie.rom+i,0x1000,1,f);
|
fread(ggenie.rom+i,0x1000,1,f);
|
||||||
i += 0x1000;
|
i += 0x1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Close ROM file */
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
#ifdef LSB_FIRST
|
#ifdef LSB_FIRST
|
||||||
|
@ -2,25 +2,42 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Game Genie Hardware emulation
|
* Game Genie Hardware emulation
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Eke-Eke (GCN/Wii port)
|
* Copyright (C) 2009-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Based on documentation from Charles McDonald
|
* Based on documentation from Charles McDonald
|
||||||
* (http://cgfm2.emuviews.com/txt/genie.txt)
|
* (http://cgfm2.emuviews.com/txt/genie.txt)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _GGENIE_H_
|
#ifndef _GGENIE_H_
|
||||||
#define _GGENIE_H_
|
#define _GGENIE_H_
|
||||||
|
@ -1,34 +1,50 @@
|
|||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Mega Drive cartridge hardware support
|
* Mega Drive cartridge hardware support
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2011 Eke-Eke (GCN/Wii port)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Most cartridge protections documented by Haze
|
* Most cartridge protections were initially documented by Haze
|
||||||
* (http://haze.mameworld.info/)
|
* (http://haze.mameworld.info/)
|
||||||
*
|
*
|
||||||
* Realtec mapper documented by TascoDeluxe
|
* Realtec mapper was documented by TascoDeluxe
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "gamepad.h"
|
#include "gamepad.h"
|
||||||
|
|
||||||
#define CART_CNT (44)
|
#define CART_CNT (48)
|
||||||
|
|
||||||
/* Cart database entry */
|
/* Cart database entry */
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -60,8 +76,10 @@ static uint32 default_regs_r(uint32 address);
|
|||||||
static uint32 default_regs_r_16(uint32 address);
|
static uint32 default_regs_r_16(uint32 address);
|
||||||
static void custom_regs_w(uint32 address, uint32 data);
|
static void custom_regs_w(uint32 address, uint32 data);
|
||||||
static void custom_alt_regs_w(uint32 address, uint32 data);
|
static void custom_alt_regs_w(uint32 address, uint32 data);
|
||||||
static uint32 topshooter_read(uint32 address);
|
static uint32 topshooter_r(uint32 address);
|
||||||
static void topshooter_write(uint32 address, uint32 data);
|
static void topshooter_w(uint32 address, uint32 data);
|
||||||
|
static uint32 sega_channel_r(uint32 address);
|
||||||
|
static void sega_channel_w(uint32 address, uint32 data);
|
||||||
|
|
||||||
/* Games that need extra hardware emulation:
|
/* Games that need extra hardware emulation:
|
||||||
- copy protection device
|
- copy protection device
|
||||||
@ -81,10 +99,12 @@ static const T_CART_ENTRY rom_database[CART_CNT] =
|
|||||||
{0x4f10,0x0836,0x00,0x00,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,0,mapper_radica_r,NULL,NULL,NULL}},
|
{0x4f10,0x0836,0x00,0x00,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,0,mapper_radica_r,NULL,NULL,NULL}},
|
||||||
/* RADICA (Volume 1) (byteswapped version) */
|
/* RADICA (Volume 1) (byteswapped version) */
|
||||||
{0xf424,0x9f82,0x00,0x00,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,0,mapper_radica_r,NULL,NULL,NULL}},
|
{0xf424,0x9f82,0x00,0x00,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,0,mapper_radica_r,NULL,NULL,NULL}},
|
||||||
/* Chinese Fighters III */
|
/* Tenchi wo Kurau III: Sangokushi Gaiden - Chinese Fighter */
|
||||||
{0x9490,0x8180,0x40,0x6f,{{0x00,0x00,0x00,0x00},{0xf0000c,0xf0000c,0xf0000c,0xf0000c},{0x400000,0x400004,0x400008,0x40000c},0,1,NULL,NULL,default_regs_r,custom_alt_regs_w}},
|
{0x9490,0x8180,0x40,0x6f,{{0x00,0x00,0x00,0x00},{0xf0000c,0xf0000c,0xf0000c,0xf0000c},{0x400000,0x400004,0x400008,0x40000c},0,1,NULL,NULL,default_regs_r,custom_alt_regs_w}},
|
||||||
/* Top Fighter */
|
/* Top Fighter */
|
||||||
{0x4eb9,0x5d8b,0x60,0x7f,{{0x00,0x00,0x00,0x00},{0xf00007,0xf00007,0xf00007,0xffffff},{0x600001,0x600003,0x600005,0x000000},0,1,NULL,NULL,default_regs_r,custom_regs_w}},
|
{0x4eb9,0x5d8b,0x60,0x7f,{{0x00,0x00,0x00,0x00},{0xf00007,0xf00007,0xf00007,0xffffff},{0x600001,0x600003,0x600005,0x000000},0,1,NULL,NULL,default_regs_r,custom_regs_w}},
|
||||||
|
/* Soul Edge VS Samurai Spirits */
|
||||||
|
{0x00ff,0x5d34,0x60,0x7f,{{0x00,0x00,0x00,0x00},{0xf00007,0xf00007,0xf00007,0xf00007},{0x600001,0x600003,0x600005,0x600007},0,1,NULL,NULL,default_regs_r,custom_regs_w}},
|
||||||
/* Mulan */
|
/* Mulan */
|
||||||
{0x0404,0x1b40,0x60,0x7f,{{0x00,0x00,0x00,0x00},{0xf00007,0xf00007,0xf00007,0xffffff},{0x600001,0x600003,0x600005,0x000000},0,1,NULL,NULL,default_regs_r,custom_regs_w}},
|
{0x0404,0x1b40,0x60,0x7f,{{0x00,0x00,0x00,0x00},{0xf00007,0xf00007,0xf00007,0xffffff},{0x600001,0x600003,0x600005,0x000000},0,1,NULL,NULL,default_regs_r,custom_regs_w}},
|
||||||
/* Pocket Monsters II */
|
/* Pocket Monsters II */
|
||||||
@ -99,6 +119,8 @@ static const T_CART_ENTRY rom_database[CART_CNT] =
|
|||||||
{0xffff,0x1d9b,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xfffffd,0xfffffd,0xffffff,0xffffff},{0x400000,0x400004,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,default_regs_w}},
|
{0xffff,0x1d9b,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xfffffd,0xfffffd,0xffffff,0xffffff},{0x400000,0x400004,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,default_regs_w}},
|
||||||
/* Squirell King */
|
/* Squirell King */
|
||||||
{0x0000,0x8ec8,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xfffffd,0xfffffd,0xffffff,0xffffff},{0x400000,0x400004,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,default_regs_w}},
|
{0x0000,0x8ec8,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xfffffd,0xfffffd,0xffffff,0xffffff},{0x400000,0x400004,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,default_regs_w}},
|
||||||
|
/* Tiny Toon Adventures 3 */
|
||||||
|
{0x2020,0xed9c,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xfffffd,0xfffffd,0xffffff,0xffffff},{0x400000,0x400004,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,default_regs_w}},
|
||||||
/* Lian Huan Pao - Barver Battle Saga (registers accessed by Z80, related to sound engine ?) */
|
/* Lian Huan Pao - Barver Battle Saga (registers accessed by Z80, related to sound engine ?) */
|
||||||
{0x30b9,0x1c2a,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xfffffd,0xfffffd,0xffffff,0xffffff},{0x400000,0x400004,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,default_regs_w}},
|
{0x30b9,0x1c2a,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xfffffd,0xfffffd,0xffffff,0xffffff},{0x400000,0x400004,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,default_regs_w}},
|
||||||
/* Shui Hu Zhuan (registers accessed by Z80, related to sound engine ?) */
|
/* Shui Hu Zhuan (registers accessed by Z80, related to sound engine ?) */
|
||||||
@ -121,12 +143,16 @@ static const T_CART_ENTRY rom_database[CART_CNT] =
|
|||||||
{0xfb40,0x4bed,0x40,0x40,{{0x00,0xaa,0x00,0xf0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x400002,0x000000,0x400006},0,0,NULL,NULL,default_regs_r_16,NULL}},
|
{0xfb40,0x4bed,0x40,0x40,{{0x00,0xaa,0x00,0xf0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x400002,0x000000,0x400006},0,0,NULL,NULL,default_regs_r_16,NULL}},
|
||||||
/* King of Fighter 98 */
|
/* King of Fighter 98 */
|
||||||
{0x0000,0xd0a0,0x48,0x4f,{{0x00,0x00,0xaa,0xf0},{0xffffff,0xffffff,0xfc0000,0xfc0000},{0x000000,0x000000,0x480000,0x4c0000},0,0,NULL,NULL,default_regs_r,NULL}},
|
{0x0000,0xd0a0,0x48,0x4f,{{0x00,0x00,0xaa,0xf0},{0xffffff,0xffffff,0xfc0000,0xfc0000},{0x000000,0x000000,0x480000,0x4c0000},0,0,NULL,NULL,default_regs_r,NULL}},
|
||||||
/* Supper Bubble Bobble */
|
/* Super Bubble Bobble */
|
||||||
{0x0000,0x16cd,0x40,0x40,{{0x55,0x0f,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,NULL}},
|
{0x0000,0x16cd,0x40,0x40,{{0x55,0x0f,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,NULL}},
|
||||||
|
/* Tenchi wo Kurau II - The Battle of Red Cliffs (Unl) */
|
||||||
|
{0x0000,0xed61,0x40,0x40,{{0x55,0x0f,0xaa,0xf0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,NULL,NULL,default_regs_r,NULL}},
|
||||||
/* Huan Le Tao Qi Shu - Smart Mouse */
|
/* Huan Le Tao Qi Shu - Smart Mouse */
|
||||||
{0x0000,0x1a28,0x40,0x40,{{0x55,0x0f,0xaa,0xf0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,NULL,NULL,default_regs_r,NULL}},
|
{0x0000,0x1a28,0x40,0x40,{{0x55,0x0f,0xaa,0xf0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,NULL,NULL,default_regs_r,NULL}},
|
||||||
/* (*) Hei Tao 2 - Super Big 2 (patched ROM, unused registers) */
|
/* (*) Hei Tao 2 - Super Big 2 (patched ROM, unused registers) */
|
||||||
{0x0000,0x5843,0x40,0x40,{{0x55,0x0f,0xaa,0xf0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,NULL,NULL,default_regs_r,NULL}},
|
{0x0000,0x5843,0x40,0x40,{{0x55,0x0f,0xaa,0xf0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,NULL,NULL,default_regs_r,NULL}},
|
||||||
|
/* Mighty Morphin Power Rangers - The Fighting Edition */
|
||||||
|
{0x0000,0x2288,0x40,0x40,{{0x55,0x0f,0xc9,0x18},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,NULL,NULL,default_regs_r,NULL}},
|
||||||
/* Elf Wor */
|
/* Elf Wor */
|
||||||
{0x0080,0x3dba,0x40,0x40,{{0x55,0x0f,0xc9,0x18},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,NULL,NULL,default_regs_r,NULL}},
|
{0x0080,0x3dba,0x40,0x40,{{0x55,0x0f,0xc9,0x18},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,NULL,NULL,default_regs_r,NULL}},
|
||||||
/* Ya-Se Chuanshuo */
|
/* Ya-Se Chuanshuo */
|
||||||
@ -156,7 +182,7 @@ static const T_CART_ENTRY rom_database[CART_CNT] =
|
|||||||
/* Game no Kanzume Otokuyou */
|
/* Game no Kanzume Otokuyou */
|
||||||
{0x0000,0xf9d1,0x00,0x00,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,0,NULL,mapper_seganet_w,NULL,NULL}},
|
{0x0000,0xf9d1,0x00,0x00,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,0,NULL,mapper_seganet_w,NULL,NULL}},
|
||||||
/* Top Shooter (arcade hardware) */
|
/* Top Shooter (arcade hardware) */
|
||||||
{0xffff,0x3632,0x20,0x20,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,0,NULL,NULL,topshooter_read,topshooter_write}}
|
{0xffff,0x3632,0x20,0x20,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,0,NULL,NULL,topshooter_r,topshooter_w}}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -278,21 +304,21 @@ void md_cart_init(void)
|
|||||||
BACKUP MEMORY
|
BACKUP MEMORY
|
||||||
***********************************************/
|
***********************************************/
|
||||||
sram_init();
|
sram_init();
|
||||||
eeprom_init();
|
md_eeprom_init();
|
||||||
if (sram.on)
|
if (sram.on)
|
||||||
{
|
{
|
||||||
if (sram.custom)
|
if (sram.custom)
|
||||||
{
|
{
|
||||||
/* Serial EEPROM */
|
/* Serial EEPROM */
|
||||||
m68k_memory_map[eeprom.type.sda_out_adr >> 16].read8 = eeprom_read_byte;
|
m68k_memory_map[md_eeprom.type.sda_out_adr >> 16].read8 = md_eeprom_read_byte;
|
||||||
m68k_memory_map[eeprom.type.sda_out_adr >> 16].read16 = eeprom_read_word;
|
m68k_memory_map[md_eeprom.type.sda_out_adr >> 16].read16 = md_eeprom_read_word;
|
||||||
m68k_memory_map[eeprom.type.sda_in_adr >> 16].read8 = eeprom_read_byte;
|
m68k_memory_map[md_eeprom.type.sda_in_adr >> 16].read8 = md_eeprom_read_byte;
|
||||||
m68k_memory_map[eeprom.type.sda_in_adr >> 16].read16 = eeprom_read_word;
|
m68k_memory_map[md_eeprom.type.sda_in_adr >> 16].read16 = md_eeprom_read_word;
|
||||||
m68k_memory_map[eeprom.type.scl_adr >> 16].write8 = eeprom_write_byte;
|
m68k_memory_map[md_eeprom.type.scl_adr >> 16].write8 = md_eeprom_write_byte;
|
||||||
m68k_memory_map[eeprom.type.scl_adr >> 16].write16 = eeprom_write_word;
|
m68k_memory_map[md_eeprom.type.scl_adr >> 16].write16 = md_eeprom_write_word;
|
||||||
zbank_memory_map[eeprom.type.sda_out_adr >> 16].read = eeprom_read_byte;
|
zbank_memory_map[md_eeprom.type.sda_out_adr >> 16].read = md_eeprom_read_byte;
|
||||||
zbank_memory_map[eeprom.type.sda_in_adr >> 16].read = eeprom_read_byte;
|
zbank_memory_map[md_eeprom.type.sda_in_adr >> 16].read = md_eeprom_read_byte;
|
||||||
zbank_memory_map[eeprom.type.scl_adr >> 16].write = eeprom_write_byte;
|
zbank_memory_map[md_eeprom.type.scl_adr >> 16].write = md_eeprom_write_byte;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -632,6 +658,13 @@ void md_cart_init(void)
|
|||||||
cart.hw.time_w = mapper_ssf2_w;
|
cart.hw.time_w = mapper_ssf2_w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Sega Channel mapped hardware (?) */
|
||||||
|
if (strstr(rominfo.international,"Sega Channel") != NULL)
|
||||||
|
{
|
||||||
|
cart.hw.time_r = sega_channel_r;
|
||||||
|
cart.hw.time_w = sega_channel_w;
|
||||||
|
}
|
||||||
|
|
||||||
/* default write handler for !TIME range ($A130xx)*/
|
/* default write handler for !TIME range ($A130xx)*/
|
||||||
if (!cart.hw.time_w)
|
if (!cart.hw.time_w)
|
||||||
{
|
{
|
||||||
@ -1120,7 +1153,9 @@ static void custom_alt_regs_w(uint32 address, uint32 data)
|
|||||||
default_regs_w(address, data);
|
default_regs_w(address, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32 topshooter_read(uint32 address)
|
|
||||||
|
/* Top Shooter arcade board hardware */
|
||||||
|
static uint32 topshooter_r(uint32 address)
|
||||||
{
|
{
|
||||||
if (address < 0x202000)
|
if (address < 0x202000)
|
||||||
{
|
{
|
||||||
@ -1174,12 +1209,58 @@ static uint32 topshooter_read(uint32 address)
|
|||||||
return READ_BYTE(sram.sram , address & 0xffff);
|
return READ_BYTE(sram.sram , address & 0xffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void topshooter_write(uint32 address, uint32 data)
|
static void topshooter_w(uint32 address, uint32 data)
|
||||||
{
|
{
|
||||||
if (address >= 0x202000)
|
if (address >= 0x202000)
|
||||||
{
|
{
|
||||||
WRITE_BYTE(sram.sram , address & 0xffff, data);
|
WRITE_BYTE(sram.sram , address & 0xffff, data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m68k_unused_8_w(address, data);
|
m68k_unused_8_w(address, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Sega Channel hardware (not emulated) */
|
||||||
|
/*
|
||||||
|
|
||||||
|
$A13004: BUSY ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
|
||||||
|
|
||||||
|
Unused read16 00A13004 (00005B54)
|
||||||
|
Unused read16 00A13004 (00005B70)
|
||||||
|
Unused read16 00A13006 (00005B7C)
|
||||||
|
|
||||||
|
Unused read16 00A13004 (00005BC4)
|
||||||
|
Unused read16 00A13004 (00005BDA)
|
||||||
|
|
||||||
|
Unused write16 00A13032 = 0004 (00005706)
|
||||||
|
Unused write16 00A130F0 = 0000 (0000570E)
|
||||||
|
|
||||||
|
Unused write16 00A130F0 = 0000 (0000463E)
|
||||||
|
Unused write16 00A130F2 = 0001 (00004646)
|
||||||
|
Unused write16 00A130F4 = 0002 (0000464E)
|
||||||
|
Unused write16 00A130F6 = 0003 (00004656)
|
||||||
|
Unused write16 00A130F8 = 0004 (0000465E)
|
||||||
|
Unused write16 00A130FA = 0005 (00004666)
|
||||||
|
|
||||||
|
Unused write16 00A13032 = 0004 (00005706)
|
||||||
|
Unused write16 00A13032 = 0104 (0000579E)
|
||||||
|
|
||||||
|
Unused write16 00380000 = ACDC (00005718)
|
||||||
|
Unused write16 00380002 = 0000 (00005722)
|
||||||
|
Unused read16 00380000 (0000572C)
|
||||||
|
Unused write16 00A13032 = 0104 (0000579E)
|
||||||
|
Unused write16 00300000 = ACDC (000057B2)
|
||||||
|
Unused write16 00380000 = 0000 (000057BC)
|
||||||
|
Unused read16 00300000 (000057C6)
|
||||||
|
|
||||||
|
*/
|
||||||
|
static uint32 sega_channel_r(uint32 address)
|
||||||
|
{
|
||||||
|
return m68k_read_bus_16(address);;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void sega_channel_w(uint32 address, uint32 data)
|
||||||
|
{
|
||||||
|
m68k_unused_16_w(address, data);
|
||||||
|
}
|
||||||
|
@ -2,27 +2,44 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Mega Drive cartridge hardware support
|
* Mega Drive cartridge hardware support
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2011 Eke-Eke (GCN/Wii port)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Lots of protection mechanism have been discovered by Haze
|
* Most cartridge protections were initially documented by Haze
|
||||||
* (http://haze.mameworld.info/)
|
* (http://haze.mameworld.info/)
|
||||||
*
|
*
|
||||||
* Realtec mapper has been figured out by TascoDeluxe
|
* Realtec mapper was documented by TascoDeluxe
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _MD_CART_H_
|
#ifndef _MD_CART_H_
|
||||||
#define _MD_CART_H_
|
#define _MD_CART_H_
|
||||||
@ -32,9 +49,9 @@
|
|||||||
#define TYPE_AR 0x02 /* (Pro) Action Replay */
|
#define TYPE_AR 0x02 /* (Pro) Action Replay */
|
||||||
#define TYPE_SK 0x03 /* Sonic & Knuckles */
|
#define TYPE_SK 0x03 /* Sonic & Knuckles */
|
||||||
|
|
||||||
/* Special hardware (0x01 reserved for SMS 3-D glasses) */
|
/* Special hardware (0x01 & 0x02 reserved for Master System 3-D glasses & Terebi Oekaki) */
|
||||||
#define HW_J_CART 0x02
|
#define HW_J_CART 0x04
|
||||||
#define HW_LOCK_ON 0x04
|
#define HW_LOCK_ON 0x08
|
||||||
|
|
||||||
/* Cartridge extra hardware */
|
/* Cartridge extra hardware */
|
||||||
typedef struct
|
typedef struct
|
||||||
|
554
source/cart_hw/md_eeprom.c
Normal file
554
source/cart_hw/md_eeprom.c
Normal file
@ -0,0 +1,554 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Genesis Plus
|
||||||
|
* I2C Serial EEPROM (24Cxx) support
|
||||||
|
*
|
||||||
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#include "shared.h"
|
||||||
|
|
||||||
|
#define GAME_CNT 30
|
||||||
|
|
||||||
|
T_EEPROM_24C md_eeprom;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
char game_id[16];
|
||||||
|
uint16 chk;
|
||||||
|
T_EEPROM_TYPE type;
|
||||||
|
} T_GAME_ENTRY;
|
||||||
|
|
||||||
|
static const T_GAME_ENTRY database[GAME_CNT] =
|
||||||
|
{
|
||||||
|
/* ACCLAIM mappers */
|
||||||
|
/* 24C02 (old mapper) */
|
||||||
|
{{"T-081326" }, 0, {8, 0xFF, 0xFF, 0x200001, 0x200001, 0x200001, 0, 1, 1}}, /* NBA Jam (UE) */
|
||||||
|
{{"T-81033" }, 0, {8, 0xFF, 0xFF, 0x200001, 0x200001, 0x200001, 0, 1, 1}}, /* NBA Jam (J) */
|
||||||
|
/* 24C02 */
|
||||||
|
{{"T-081276" }, 0, {8, 0xFF, 0xFF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* NFL Quarterback Club */
|
||||||
|
/* 24C04 */
|
||||||
|
{{"T-81406" }, 0, {8, 0x1FF, 0x1FF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* NBA Jam TE */
|
||||||
|
/* 24C16 */
|
||||||
|
{{"T-081586" }, 0, {8, 0x7FF, 0x7FF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* NFL Quarterback Club '96 */
|
||||||
|
/* 24C65 */
|
||||||
|
{{"T-81576" }, 0, {16, 0x1FFF, 0x1FFF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* College Slam */
|
||||||
|
{{"T-81476" }, 0, {16, 0x1FFF, 0x1FFF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* Frank Thomas Big Hurt Baseball */
|
||||||
|
|
||||||
|
/* EA mapper (24C01 only) */
|
||||||
|
{{"T-50176" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* Rings of Power */
|
||||||
|
{{"T-50396" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* NHLPA Hockey 93 */
|
||||||
|
{{"T-50446" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* John Madden Football 93 */
|
||||||
|
{{"T-50516" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* John Madden Football 93 (Championship Ed.) */
|
||||||
|
{{"T-50606" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* Bill Walsh College Football */
|
||||||
|
|
||||||
|
/* SEGA mapper (24C01 only) */
|
||||||
|
{{"T-12046" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Megaman - The Wily Wars */
|
||||||
|
{{"T-12053" }, 0xEA80, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Rockman Mega World (J) [A] */
|
||||||
|
{{"MK-1215" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Evander 'Real Deal' Holyfield's Boxing */
|
||||||
|
{{"MK-1228" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Greatest Heavyweights of the Ring (U) */
|
||||||
|
{{"G-5538" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Greatest Heavyweights of the Ring (J) */
|
||||||
|
{{"PR-1993" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Greatest Heavyweights of the Ring (E) */
|
||||||
|
{{"G-4060" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Wonderboy in Monster World */
|
||||||
|
{{"00001211-00"}, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Sports Talk Baseball */
|
||||||
|
{{"00004076-00"}, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Honoo no Toukyuuji Dodge Danpei */
|
||||||
|
{{"G-4524" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Ninja Burai Densetsu */
|
||||||
|
{{"00054503-00"}, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Game Toshokan */
|
||||||
|
|
||||||
|
/* CODEMASTERS mapper */
|
||||||
|
/* 24C08 */
|
||||||
|
{{"T-120106" }, 0, {8, 0x3FF, 0x3FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Brian Lara Cricket */
|
||||||
|
{{"00000000-00"}, 0x168B, {8, 0x3FF, 0x3FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines Military */
|
||||||
|
{{"00000000-00"}, 0xCEE0, {8, 0x3FF, 0x3FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines Military (Bad)*/
|
||||||
|
/* 24C16 */
|
||||||
|
{{"T-120096" }, 0, {8, 0x7FF, 0x7FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines 2 - Turbo Tournament (E) */
|
||||||
|
{{"00000000-00"}, 0x165E, {8, 0x7FF, 0x7FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines Turbo Tournament 96 */
|
||||||
|
{{"00000000-00"}, 0x2C41, {8, 0x7FF, 0x7FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines Turbo Tournament 96 (Bad)*/
|
||||||
|
/* 24C65 */
|
||||||
|
{{"T-120146-50"}, 0, {16, 0x1FFF, 0x1FFF, 0x300000, 0x380001, 0x300000, 0, 7, 1}} /* Brian Lara Cricket 96, Shane Warne Cricket */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static void eeprom_update(void);
|
||||||
|
static unsigned char eeprom_out(void);
|
||||||
|
|
||||||
|
void md_eeprom_init()
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
/* initialize eeprom */
|
||||||
|
memset(&md_eeprom, 0, sizeof(T_EEPROM_24C));
|
||||||
|
md_eeprom.sda = md_eeprom.old_sda = 1;
|
||||||
|
md_eeprom.scl = md_eeprom.old_scl = 1;
|
||||||
|
md_eeprom.state = STAND_BY;
|
||||||
|
|
||||||
|
/* no eeprom by default */
|
||||||
|
sram.custom = 0;
|
||||||
|
|
||||||
|
/* look into game database */
|
||||||
|
while (i<GAME_CNT)
|
||||||
|
{
|
||||||
|
if (strstr(rominfo.product,database[i].game_id) != NULL)
|
||||||
|
{
|
||||||
|
/* additional check (Micro Machines, Rockman Mega World) */
|
||||||
|
if ((database[i].chk == 0) || (database[i].chk == rominfo.checksum))
|
||||||
|
{
|
||||||
|
sram.custom = 1;
|
||||||
|
sram.on = 1;
|
||||||
|
memcpy(&md_eeprom.type, &database[i].type, sizeof(T_EEPROM_TYPE));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Game not found in database but header seems to indicate it uses EEPROM */
|
||||||
|
if (sram.detected)
|
||||||
|
{
|
||||||
|
if ((sram.end - sram.start) < 2)
|
||||||
|
{
|
||||||
|
/* set SEGA mapper as default */
|
||||||
|
sram.custom = 1;
|
||||||
|
memcpy(&md_eeprom.type, &database[9].type, sizeof(T_EEPROM_TYPE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int md_eeprom_read_byte(unsigned int address)
|
||||||
|
{
|
||||||
|
if (address == md_eeprom.type.sda_out_adr)
|
||||||
|
{
|
||||||
|
return eeprom_out();
|
||||||
|
}
|
||||||
|
|
||||||
|
return READ_BYTE(cart.rom, address);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int md_eeprom_read_word(unsigned int address)
|
||||||
|
{
|
||||||
|
if (address == md_eeprom.type.sda_out_adr)
|
||||||
|
{
|
||||||
|
return (eeprom_out() << 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (address == (md_eeprom.type.sda_out_adr ^ 1))
|
||||||
|
{
|
||||||
|
return eeprom_out();
|
||||||
|
}
|
||||||
|
|
||||||
|
return *(uint16 *)(cart.rom + address);
|
||||||
|
}
|
||||||
|
|
||||||
|
void md_eeprom_write_byte(unsigned int address, unsigned int data)
|
||||||
|
{
|
||||||
|
int do_update = 0;
|
||||||
|
|
||||||
|
if (address == md_eeprom.type.sda_in_adr)
|
||||||
|
{
|
||||||
|
md_eeprom.sda = (data >> md_eeprom.type.sda_in_bit) & 1;
|
||||||
|
do_update = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (address == md_eeprom.type.scl_adr)
|
||||||
|
{
|
||||||
|
md_eeprom.scl = (data >> md_eeprom.type.scl_bit) & 1;
|
||||||
|
do_update = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (do_update)
|
||||||
|
{
|
||||||
|
eeprom_update();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m68k_unused_8_w(address, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void md_eeprom_write_word(unsigned int address, unsigned int data)
|
||||||
|
{
|
||||||
|
int do_update = 0;
|
||||||
|
|
||||||
|
if (address == md_eeprom.type.sda_in_adr)
|
||||||
|
{
|
||||||
|
md_eeprom.sda = (data >> (8 + md_eeprom.type.sda_in_bit)) & 1;
|
||||||
|
do_update = 1;
|
||||||
|
}
|
||||||
|
else if (address == (md_eeprom.type.sda_in_adr ^1))
|
||||||
|
{
|
||||||
|
md_eeprom.sda = (data >> md_eeprom.type.sda_in_bit) & 1;
|
||||||
|
do_update = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (address == md_eeprom.type.scl_adr)
|
||||||
|
{
|
||||||
|
md_eeprom.scl = (data >> (8 + md_eeprom.type.scl_bit)) & 1;
|
||||||
|
do_update = 1;
|
||||||
|
}
|
||||||
|
else if (address == (md_eeprom.type.scl_adr ^1))
|
||||||
|
{
|
||||||
|
md_eeprom.scl = (data >> md_eeprom.type.scl_bit) & 1;
|
||||||
|
do_update = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (do_update)
|
||||||
|
{
|
||||||
|
eeprom_update();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m68k_unused_16_w(address, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void Detect_START()
|
||||||
|
{
|
||||||
|
if (md_eeprom.old_scl && md_eeprom.scl)
|
||||||
|
{
|
||||||
|
if (md_eeprom.old_sda && !md_eeprom.sda)
|
||||||
|
{
|
||||||
|
md_eeprom.cycles = 0;
|
||||||
|
md_eeprom.slave_mask = 0;
|
||||||
|
if (md_eeprom.type.address_bits == 7)
|
||||||
|
{
|
||||||
|
md_eeprom.word_address = 0;
|
||||||
|
md_eeprom.state = GET_WORD_ADR_7BITS;
|
||||||
|
}
|
||||||
|
else md_eeprom.state = GET_SLAVE_ADR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void Detect_STOP()
|
||||||
|
{
|
||||||
|
if (md_eeprom.old_scl && md_eeprom.scl)
|
||||||
|
{
|
||||||
|
if (!md_eeprom.old_sda && md_eeprom.sda)
|
||||||
|
{
|
||||||
|
md_eeprom.state = STAND_BY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void eeprom_update(void)
|
||||||
|
{
|
||||||
|
/* EEPROM current state */
|
||||||
|
switch (md_eeprom.state)
|
||||||
|
{
|
||||||
|
/* Standby Mode */
|
||||||
|
case STAND_BY:
|
||||||
|
{
|
||||||
|
Detect_START();
|
||||||
|
Detect_STOP();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Suspended Mode */
|
||||||
|
case WAIT_STOP:
|
||||||
|
{
|
||||||
|
Detect_STOP();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get Word Address 7 bits: MODE-1 only (24C01)
|
||||||
|
* and R/W bit
|
||||||
|
*/
|
||||||
|
case GET_WORD_ADR_7BITS:
|
||||||
|
{
|
||||||
|
Detect_START();
|
||||||
|
Detect_STOP();
|
||||||
|
|
||||||
|
/* look for SCL LOW to HIGH transition */
|
||||||
|
if (!md_eeprom.old_scl && md_eeprom.scl)
|
||||||
|
{
|
||||||
|
if (md_eeprom.cycles == 0) md_eeprom.cycles ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* look for SCL HIGH to LOW transition */
|
||||||
|
if (md_eeprom.old_scl && !md_eeprom.scl && (md_eeprom.cycles > 0))
|
||||||
|
{
|
||||||
|
if (md_eeprom.cycles < 8)
|
||||||
|
{
|
||||||
|
md_eeprom.word_address |= (md_eeprom.old_sda << (7 - md_eeprom.cycles));
|
||||||
|
}
|
||||||
|
else if (md_eeprom.cycles == 8)
|
||||||
|
{
|
||||||
|
md_eeprom.rw = md_eeprom.old_sda;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ /* ACK CYCLE */
|
||||||
|
md_eeprom.cycles = 0;
|
||||||
|
md_eeprom.word_address &= md_eeprom.type.size_mask;
|
||||||
|
md_eeprom.state = md_eeprom.rw ? READ_DATA : WRITE_DATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
md_eeprom.cycles ++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get Slave Address (3bits) : MODE-2 & MODE-3 only (24C01 - 24C512) (0-3bits, depending on the array size)
|
||||||
|
* or/and Word Address MSB: MODE-2 only (24C04 - 24C16) (0-3bits, depending on the array size)
|
||||||
|
* and R/W bit
|
||||||
|
*/
|
||||||
|
case GET_SLAVE_ADR:
|
||||||
|
{
|
||||||
|
Detect_START();
|
||||||
|
Detect_STOP();
|
||||||
|
|
||||||
|
/* look for SCL LOW to HIGH transition */
|
||||||
|
if (!md_eeprom.old_scl && md_eeprom.scl)
|
||||||
|
{
|
||||||
|
if (md_eeprom.cycles == 0) md_eeprom.cycles ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* look for SCL HIGH to LOW transition */
|
||||||
|
if (md_eeprom.old_scl && !md_eeprom.scl && (md_eeprom.cycles > 0))
|
||||||
|
{
|
||||||
|
if ((md_eeprom.cycles > 4) && (md_eeprom.cycles <8))
|
||||||
|
{
|
||||||
|
if ((md_eeprom.type.address_bits == 16) ||
|
||||||
|
(md_eeprom.type.size_mask < (1 << (15 - md_eeprom.cycles))))
|
||||||
|
{
|
||||||
|
/* this is a SLAVE ADDRESS bit */
|
||||||
|
md_eeprom.slave_mask |= (md_eeprom.old_sda << (7 - md_eeprom.cycles));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* this is a WORD ADDRESS high bit */
|
||||||
|
if (md_eeprom.old_sda) md_eeprom.word_address |= (1 << (15 - md_eeprom.cycles));
|
||||||
|
else md_eeprom.word_address &= ~(1 << (15 - md_eeprom.cycles));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (md_eeprom.cycles == 8) md_eeprom.rw = md_eeprom.old_sda;
|
||||||
|
else if (md_eeprom.cycles > 8)
|
||||||
|
{
|
||||||
|
/* ACK CYCLE */
|
||||||
|
md_eeprom.cycles = 0;
|
||||||
|
if (md_eeprom.type.address_bits == 16)
|
||||||
|
{
|
||||||
|
/* two ADDRESS bytes */
|
||||||
|
md_eeprom.state = md_eeprom.rw ? READ_DATA : GET_WORD_ADR_HIGH;
|
||||||
|
md_eeprom.slave_mask <<= 16;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* one ADDRESS byte */
|
||||||
|
md_eeprom.state = md_eeprom.rw ? READ_DATA : GET_WORD_ADR_LOW;
|
||||||
|
md_eeprom.slave_mask <<= 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
md_eeprom.cycles ++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get Word Address MSB (4-8bits depending on the array size)
|
||||||
|
* MODE-3 only (24C32 - 24C512)
|
||||||
|
*/
|
||||||
|
case GET_WORD_ADR_HIGH:
|
||||||
|
{
|
||||||
|
Detect_START();
|
||||||
|
Detect_STOP();
|
||||||
|
|
||||||
|
/* look for SCL HIGH to LOW transition */
|
||||||
|
if (md_eeprom.old_scl && !md_eeprom.scl)
|
||||||
|
{
|
||||||
|
if (md_eeprom.cycles < 9)
|
||||||
|
{
|
||||||
|
if ((md_eeprom.type.size_mask + 1) < (1 << (17 - md_eeprom.cycles)))
|
||||||
|
{
|
||||||
|
/* ignored bit: slave mask should be right-shifted by one */
|
||||||
|
md_eeprom.slave_mask >>= 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* this is a WORD ADDRESS high bit */
|
||||||
|
if (md_eeprom.old_sda) md_eeprom.word_address |= (1 << (16 - md_eeprom.cycles));
|
||||||
|
else md_eeprom.word_address &= ~(1 << (16 - md_eeprom.cycles));
|
||||||
|
}
|
||||||
|
|
||||||
|
md_eeprom.cycles ++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* ACK CYCLE */
|
||||||
|
md_eeprom.cycles = 1;
|
||||||
|
md_eeprom.state = GET_WORD_ADR_LOW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get Word Address LSB: 7bits (24C01) or 8bits (24C02-24C512)
|
||||||
|
* MODE-2 and MODE-3 only (24C01 - 24C512)
|
||||||
|
*/
|
||||||
|
case GET_WORD_ADR_LOW:
|
||||||
|
{
|
||||||
|
Detect_START();
|
||||||
|
Detect_STOP();
|
||||||
|
|
||||||
|
/* look for SCL HIGH to LOW transition */
|
||||||
|
if (md_eeprom.old_scl && !md_eeprom.scl)
|
||||||
|
{
|
||||||
|
if (md_eeprom.cycles < 9)
|
||||||
|
{
|
||||||
|
if ((md_eeprom.type.size_mask + 1) < (1 << (9 - md_eeprom.cycles)))
|
||||||
|
{
|
||||||
|
/* ignored bit (X24C01): slave mask should be right-shifted by one */
|
||||||
|
md_eeprom.slave_mask >>= 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* this is a WORD ADDRESS high bit */
|
||||||
|
if (md_eeprom.old_sda) md_eeprom.word_address |= (1 << (8 - md_eeprom.cycles));
|
||||||
|
else md_eeprom.word_address &= ~(1 << (8 - md_eeprom.cycles));
|
||||||
|
}
|
||||||
|
|
||||||
|
md_eeprom.cycles ++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* ACK CYCLE */
|
||||||
|
md_eeprom.cycles = 1;
|
||||||
|
md_eeprom.word_address &= md_eeprom.type.size_mask;
|
||||||
|
md_eeprom.state = WRITE_DATA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read Cycle
|
||||||
|
*/
|
||||||
|
case READ_DATA:
|
||||||
|
{
|
||||||
|
Detect_START();
|
||||||
|
Detect_STOP();
|
||||||
|
|
||||||
|
/* look for SCL HIGH to LOW transition */
|
||||||
|
if (md_eeprom.old_scl && !md_eeprom.scl)
|
||||||
|
{
|
||||||
|
if (md_eeprom.cycles < 9) md_eeprom.cycles ++;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
md_eeprom.cycles = 1;
|
||||||
|
|
||||||
|
/* ACK not received */
|
||||||
|
if (md_eeprom.old_sda) md_eeprom.state = WAIT_STOP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write Cycle
|
||||||
|
*/
|
||||||
|
case WRITE_DATA:
|
||||||
|
{
|
||||||
|
Detect_START();
|
||||||
|
Detect_STOP();
|
||||||
|
|
||||||
|
/* look for SCL HIGH to LOW transition */
|
||||||
|
if (md_eeprom.old_scl && !md_eeprom.scl)
|
||||||
|
{
|
||||||
|
if (md_eeprom.cycles < 9)
|
||||||
|
{
|
||||||
|
/* Write DATA bits (max 64kBytes) */
|
||||||
|
uint16 sram_address = (md_eeprom.slave_mask | md_eeprom.word_address) & 0xFFFF;
|
||||||
|
if (md_eeprom.old_sda) sram.sram[sram_address] |= (1 << (8 - md_eeprom.cycles));
|
||||||
|
else sram.sram[sram_address] &= ~(1 << (8 - md_eeprom.cycles));
|
||||||
|
|
||||||
|
if (md_eeprom.cycles == 8)
|
||||||
|
{
|
||||||
|
/* WORD ADDRESS is incremented (roll up at maximum pagesize) */
|
||||||
|
md_eeprom.word_address = (md_eeprom.word_address & (0xFFFF - md_eeprom.type.pagewrite_mask)) |
|
||||||
|
((md_eeprom.word_address + 1) & md_eeprom.type.pagewrite_mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
md_eeprom.cycles ++;
|
||||||
|
}
|
||||||
|
else md_eeprom.cycles = 1; /* ACK cycle */
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
md_eeprom.old_scl = md_eeprom.scl;
|
||||||
|
md_eeprom.old_sda = md_eeprom.sda;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned char eeprom_out(void)
|
||||||
|
{
|
||||||
|
uint8 sda_out = md_eeprom.sda;
|
||||||
|
|
||||||
|
/* EEPROM state */
|
||||||
|
switch (md_eeprom.state)
|
||||||
|
{
|
||||||
|
case READ_DATA:
|
||||||
|
{
|
||||||
|
if (md_eeprom.cycles < 9)
|
||||||
|
{
|
||||||
|
/* Return DATA bits (max 64kBytes) */
|
||||||
|
uint16 sram_address = (md_eeprom.slave_mask | md_eeprom.word_address) & 0xffff;
|
||||||
|
sda_out = (sram.sram[sram_address] >> (8 - md_eeprom.cycles)) & 1;
|
||||||
|
|
||||||
|
if (md_eeprom.cycles == 8)
|
||||||
|
{
|
||||||
|
/* WORD ADDRESS is incremented (roll up at maximum array size) */
|
||||||
|
md_eeprom.word_address ++;
|
||||||
|
md_eeprom.word_address &= md_eeprom.type.size_mask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case GET_WORD_ADR_7BITS:
|
||||||
|
case GET_SLAVE_ADR:
|
||||||
|
case GET_WORD_ADR_HIGH:
|
||||||
|
case GET_WORD_ADR_LOW:
|
||||||
|
case WRITE_DATA:
|
||||||
|
{
|
||||||
|
if (md_eeprom.cycles == 9) sda_out = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (sda_out << md_eeprom.type.sda_out_bit);
|
||||||
|
}
|
@ -1,26 +1,43 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* I2C EEPROM support
|
* I2C Serial EEPROM (24Cxx) support
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008, 2009 Eke-Eke (GCN/Wii port)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _EEPROM_H_
|
#ifndef _MD_EEPROM_H_
|
||||||
#define _EEPROM_H_
|
#define _MD_EEPROM_H_
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@ -79,14 +96,16 @@ typedef struct
|
|||||||
T_EEPROM_STATE state; /* current operation state */
|
T_EEPROM_STATE state; /* current operation state */
|
||||||
T_EEPROM_TYPE type; /* EEPROM characteristics for this game */
|
T_EEPROM_TYPE type; /* EEPROM characteristics for this game */
|
||||||
|
|
||||||
} T_EEPROM;
|
} T_EEPROM_24C;
|
||||||
|
|
||||||
/* global variables */
|
/* global variables */
|
||||||
extern T_EEPROM eeprom;
|
extern T_EEPROM_24C md_eeprom;
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
extern void eeprom_init();
|
extern void md_eeprom_init();
|
||||||
extern void eeprom_write(unsigned int address, unsigned int data, int word_access);
|
extern unsigned int md_eeprom_read_byte(unsigned int address);
|
||||||
extern unsigned int eeprom_read(int word_access);
|
extern unsigned int md_eeprom_read_word(unsigned int address);
|
||||||
|
extern void md_eeprom_write_byte(unsigned int address, unsigned int data);
|
||||||
|
extern void md_eeprom_write_word(unsigned int address, unsigned int data);
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -1,48 +1,66 @@
|
|||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Master System cartridge hardware support
|
* SG-1000, Master System & Game Gear cartridge hardware support
|
||||||
*
|
*
|
||||||
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998-2007 Charles MacDonald (SMS Plus original code)
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* Eke-Eke (2007-2011), additional code & fixes for the GCN/Wii port
|
* provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* Most cartridge protections documented by Haze
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* (http://haze.mameworld.info/)
|
* product or activity.
|
||||||
*
|
*
|
||||||
* Realtec mapper documented by TascoDeluxe
|
* - 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.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* - Redistributions must reproduce the above copyright notice, this list of
|
||||||
* it under the terms of the GNU General Public License as published by
|
* conditions and the following disclaimer in the documentation and/or other
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* materials provided with the distribution.
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* GNU General Public License for more details.
|
* 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.
|
||||||
*
|
*
|
||||||
* 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 "shared.h"
|
||||||
|
#include "terebi_oekaki.h"
|
||||||
|
#ifdef NGC
|
||||||
|
#include "cheats.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAPPER_NONE (0)
|
#define MAPPER_TEREBI (0)
|
||||||
#define MAPPER_SEGA (1)
|
#define MAPPER_NONE (1)
|
||||||
#define MAPPER_CODIES (2)
|
#define MAPPER_SEGA (2)
|
||||||
#define MAPPER_KOREA (3)
|
#define MAPPER_SEGA_X (3)
|
||||||
#define MAPPER_MSX (4)
|
#define MAPPER_CODIES (4)
|
||||||
|
#define MAPPER_KOREA (5)
|
||||||
|
#define MAPPER_MSX (6)
|
||||||
|
#define MAPPER_93C46 (7)
|
||||||
|
|
||||||
#define GAME_DATABASE_CNT (75)
|
#define GAME_DATABASE_CNT (183)
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32 crc;
|
uint32 crc;
|
||||||
uint8 glasses_3d;
|
uint8 g_3d;
|
||||||
|
uint8 fm;
|
||||||
uint8 peripheral;
|
uint8 peripheral;
|
||||||
uint8 mapper;
|
uint8 mapper;
|
||||||
|
uint8 system;
|
||||||
uint8 region;
|
uint8 region;
|
||||||
} rominfo_t;
|
} rominfo_t;
|
||||||
|
|
||||||
@ -52,105 +70,229 @@ static struct
|
|||||||
uint8 mapper;
|
uint8 mapper;
|
||||||
} slot;
|
} slot;
|
||||||
|
|
||||||
/* SMS game database */
|
|
||||||
static const rominfo_t game_list[GAME_DATABASE_CNT] =
|
static const rominfo_t game_list[GAME_DATABASE_CNT] =
|
||||||
{
|
{
|
||||||
/* games requiring CODEMASTER mapper (NOTE: extended video modes don't work on Genesis VDP !) */
|
/* games requiring Mega Drive VDP (Mode 5) */
|
||||||
{0x29822980, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, REGION_EUROPE}, /* Cosmic Spacehead */
|
{0x47FA618D, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_PBC, REGION_USA}, /* Charles MacDonald's Mode 5 Demo Program */
|
||||||
{0xA577CE46, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, REGION_EUROPE}, /* Micro Machines */
|
|
||||||
{0xF7C524F6, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, REGION_EUROPE}, /* Micro Machines [BAD DUMP] */
|
|
||||||
{0xDBE8895C, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, REGION_EUROPE}, /* Micro Machines 2 - Turbo Tournament */
|
|
||||||
{0xC1756BEE, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, REGION_EUROPE}, /* Pete Sampras Tennis */
|
|
||||||
{0x8813514B, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, REGION_EUROPE}, /* Excellent Dizzy Collection, The [Proto] */
|
|
||||||
{0xEA5C3A6F, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, REGION_USA}, /* Dinobasher - Starring Bignose the Caveman [Proto] */
|
|
||||||
{0x152F0DCC, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, REGION_USA}, /* Drop Zone" */
|
|
||||||
{0xAA140C9C, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, REGION_USA}, /* Excellent Dizzy Collection, The [SMS-GG] */
|
|
||||||
{0xB9664AE1, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, REGION_USA}, /* Fantastic Dizzy */
|
|
||||||
{0xC888222B, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, REGION_USA}, /* Fantastic Dizzy [SMS-GG] */
|
|
||||||
{0x76C5BDFB, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, REGION_USA}, /* Jang Pung 2 [SMS-GG] */
|
|
||||||
{0xD9A7F170, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, REGION_USA}, /* Man Overboard! */
|
|
||||||
|
|
||||||
/* games requiring KOREA mappers (NOTE: TMS9918 video modes don't work on Genesis VDP !) */
|
/* games requiring 315-5124 VDP (Mark-III, Master System I) */
|
||||||
{0x17AB6883, 0, SYSTEM_MS_GAMEPAD, MAPPER_NONE, REGION_JAPAN_NTSC}, /* FA Tetris (KR) */
|
{0x32759751, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Y's (J) */
|
||||||
{0x61E8806F, 0, SYSTEM_MS_GAMEPAD, MAPPER_NONE, REGION_JAPAN_NTSC}, /* Flash Point (KR) */
|
|
||||||
{0x445525E2, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, REGION_JAPAN_NTSC}, /* Penguin Adventure (KR) */
|
/* games requiring Sega 315-5235 mapper without bank shifting */
|
||||||
{0x83F0EEDE, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, REGION_JAPAN_NTSC}, /* Street Master (KR) */
|
{0x23BAC434, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA_X, SYSTEM_GG, REGION_USA}, /* Shining Force Gaiden - Final Conflict (JP) [T-Eng] */
|
||||||
{0xA05258F5, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, REGION_JAPAN_NTSC}, /* Won-Si-In (KR) */
|
|
||||||
{0x06965ED9, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, REGION_JAPAN_NTSC}, /* F-1 Spirit - The way to Formula-1 (KR) */
|
/* games using Korean mappers */
|
||||||
{0x89B79E77, 0, SYSTEM_MS_GAMEPAD, MAPPER_KOREA, REGION_JAPAN_NTSC}, /* Dodgeball King (KR) */
|
{0x17AB6883, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_NONE, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* FA Tetris (KR) */
|
||||||
{0x18FB98A3, 0, SYSTEM_MS_GAMEPAD, MAPPER_KOREA, REGION_JAPAN_NTSC}, /* Jang Pung 3 (KR) */
|
{0x61E8806F, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_NONE, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Flash Point (KR) */
|
||||||
{0x97D03541, 0, SYSTEM_MS_GAMEPAD, MAPPER_KOREA, REGION_JAPAN_NTSC}, /* Sangokushi 3 (KR)"} */
|
{0x445525E2, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Penguin Adventure (KR) */
|
||||||
{0x67C2F0FF, 0, SYSTEM_MS_GAMEPAD, MAPPER_KOREA, REGION_JAPAN_NTSC}, /* Super Boy 2 (KR) */
|
{0x83F0EEDE, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Street Master (KR) */
|
||||||
|
{0xA05258F5, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Won-Si-In (KR) */
|
||||||
|
{0x06965ED9, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* F-1 Spirit - The way to Formula-1 (KR) */
|
||||||
|
{0x77EFE84A, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Cyborg Z (KR) */
|
||||||
|
{0x89B79E77, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_KOREA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Dodgeball King (KR) */
|
||||||
|
{0x18FB98A3, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_KOREA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Jang Pung 3 (KR) */
|
||||||
|
{0x97D03541, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_KOREA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Sangokushi 3 (KR)"} */
|
||||||
|
{0x67C2F0FF, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_KOREA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Super Boy 2 (KR) */
|
||||||
|
|
||||||
|
/* games using Codemaster mapper */
|
||||||
|
{0x29822980, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Cosmic Spacehead */
|
||||||
|
{0x8813514B, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Excellent Dizzy Collection, The [Proto] */
|
||||||
|
{0xB9664AE1, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Fantastic Dizzy */
|
||||||
|
{0xA577CE46, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Micro Machines */
|
||||||
|
{0xEA5C3A6F, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_SMS2, REGION_USA}, /* Dinobasher - Starring Bignose the Caveman [Proto] */
|
||||||
|
{0xAA140C9C, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GGMS, REGION_USA}, /* Excellent Dizzy Collection, The [SMS-GG] */
|
||||||
|
{0xC888222B, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GGMS, REGION_USA}, /* Fantastic Dizzy [SMS-GG] */
|
||||||
|
{0x76C5BDFB, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GGMS, REGION_USA}, /* Jang Pung 2 [SMS-GG] */
|
||||||
|
{0x6CAA625B, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Cosmic Spacehead [GG]*/
|
||||||
|
{0x152F0DCC, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Drop Zone" */
|
||||||
|
{0x5E53C7F7, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Ernie Els Golf */
|
||||||
|
{0xD9A7F170, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Man Overboard! */
|
||||||
|
{0xF7C524F6, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Micro Machines [GG] */
|
||||||
|
{0xDBE8895C, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Micro Machines 2 - Turbo Tournament */
|
||||||
|
{0xC1756BEE, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Pete Sampras Tennis */
|
||||||
|
|
||||||
|
/* games using Serial EEPROM */
|
||||||
|
{0x36EBCD6D, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* Majors Pro Baseball */
|
||||||
|
{0x3D8D0DD6, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* World Series Baseball [v0] */
|
||||||
|
{0xBB38CFD7, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* World Series Baseball [v1] */
|
||||||
|
{0x578A8A38, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* World Series Baseball '95 */
|
||||||
|
|
||||||
|
/* games using Terebi Oekaki graphic board */
|
||||||
|
{0xDD4A661B, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_TEREBI, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Terebi Oekaki */
|
||||||
|
|
||||||
|
/* games requiring JAPANESE region setting */
|
||||||
|
{0x71DEBA5A, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GG, REGION_JAPAN_NTSC}, /* Pop Breaker */
|
||||||
|
|
||||||
|
/* games requiring Mark-III hardware (no Memory Control port) */
|
||||||
|
{0xBD1CC7DF, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_MARKIII, REGION_USA}, /* Super Tetris (K) */
|
||||||
|
|
||||||
/* games requiring PAL timings */
|
/* games requiring PAL timings */
|
||||||
{0x72420F38, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* Addams Familly */
|
{0x72420F38, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Addams Familly */
|
||||||
{0x2D48C1D3, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* Back to the Future Part III */
|
{0x2D48C1D3, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Back to the Future Part III */
|
||||||
{0x1CBB7BF1, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* Battlemaniacs (BR) */
|
{0x1CBB7BF1, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Battlemaniacs (BR) */
|
||||||
{0x1B10A951, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* Bram Stoker's Dracula */
|
{0x1B10A951, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Bram Stoker's Dracula */
|
||||||
{0xC0E25D62, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* California Games II */
|
{0xC0E25D62, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* California Games II */
|
||||||
{0x45C50294, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* Jogos de Verao II (BR) */
|
{0x45C50294, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Jogos de Verao II (BR) */
|
||||||
{0xC9DBF936, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* Home Alone */
|
{0xC9DBF936, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Home Alone */
|
||||||
{0x0047B615, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* Predator2 */
|
{0x0047B615, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Predator2 */
|
||||||
{0xF42E145C, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* Quest for the Shaven Yak Starring Ren Hoek & Stimpy (BR) */
|
{0xF42E145C, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Quest for the Shaven Yak Starring Ren Hoek & Stimpy (BR) */
|
||||||
{0x9F951756, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* RoboCop 3 */
|
{0x9F951756, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* RoboCop 3 */
|
||||||
{0xF8176918, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* Sensible Soccer */
|
{0xF8176918, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sensible Soccer */
|
||||||
{0x1575581D, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* Shadow of the Beast */
|
{0x1575581D, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Shadow of the Beast */
|
||||||
{0x96B3F29E, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* Sonic Blast (BR) */
|
{0x96B3F29E, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sonic Blast (BR) */
|
||||||
{0x5B3B922C, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* Sonic the Hedgehog 2 [V0] */
|
{0x5B3B922C, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sonic the Hedgehog 2 [V0] */
|
||||||
{0xD6F2BFCA, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* Sonic the Hedgehog 2 [V1] */
|
{0xD6F2BFCA, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sonic the Hedgehog 2 [V1] */
|
||||||
{0xCA1D3752, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* Space Harrier [50 Hz] */
|
{0xCA1D3752, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Space Harrier [50 Hz] */
|
||||||
{0x85CFC9C9, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_EUROPE}, /* Taito Chase H.Q. */
|
{0x85CFC9C9, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Taito Chase H.Q. */
|
||||||
|
|
||||||
|
/* games running in Game Gear MS compatibility mode */
|
||||||
|
{0x59840FD6, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Castle of Illusion - Starring Mickey Mouse [SMS-GG] */
|
||||||
|
{0x9C76FB3A, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Rastan Saga [SMS-GG] */
|
||||||
|
{0xC8381DEF, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Taito Chase H.Q [SMS-GG] */
|
||||||
|
{0xDA8E95A9, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* WWF Wrestlemania Steel Cage Challenge [SMS-GG] */
|
||||||
|
{0x1D93246E, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Olympic Gold [A][SMS-GG] */
|
||||||
|
{0xA2F9C7AF, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Olympic Gold [B][SMS-GG] */
|
||||||
|
{0x01EAB89D, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Out Run Europa [SMS-GG] */
|
||||||
|
{0xF037EC00, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Out Run Europa (US) [SMS-GG] */
|
||||||
|
{0xE5F789B9, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Predator 2 [SMS-GG] */
|
||||||
|
{0x311D2863, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Prince of Persia [A][SMS-GG] */
|
||||||
|
{0x45F058D6, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Prince of Persia [B][SMS-GG] */
|
||||||
|
{0x56201996, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* R.C. Grand Prix [SMS-GG] */
|
||||||
|
{0x10DBBEF4, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Super Kick Off [SMS-GG] */
|
||||||
|
{0xBD1CC7DF, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Super Tetris (KR) [SMS-GG] */
|
||||||
|
{0x9942B69B, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Castle of Illusion - Starring Mickey Mouse (J) [SMS-GG] */
|
||||||
|
{0x7BB81E3D, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Taito Chase H.Q (J) [SMS-GG] */
|
||||||
|
{0x6F8E46CF, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Alex Kidd in Miracle World (TW) [SMS-GG] */
|
||||||
|
{0x3382D73F, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Olympic Gold (TW) [SMS-GG] */
|
||||||
|
|
||||||
/* games requiring 3-D Glasses */
|
/* games requiring 3-D Glasses */
|
||||||
{0x871562b0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_JAPAN_NTSC}, /* Maze Walker */
|
{0x6BD5C2BF, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Space Harrier 3-D */
|
||||||
{0x156948f9, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_JAPAN_NTSC}, /* Space Harrier 3-D (J) */
|
{0x8ECD201C, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Blade Eagle 3-D */
|
||||||
{0x6BD5C2BF, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_USA}, /* Space Harrier 3-D */
|
{0xFBF96C81, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Blade Eagle 3-D (BR) */
|
||||||
{0x8ECD201C, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_USA}, /* Blade Eagle 3-D */
|
{0x58D5FC48, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Blade Eagle 3-D [Proto] */
|
||||||
{0xFBF96C81, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_USA}, /* Blade Eagle 3-D (BR) */
|
{0x31B8040B, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Maze Hunter 3-D */
|
||||||
{0x58D5FC48, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_USA}, /* Blade Eagle 3-D [Proto] */
|
{0xABD48AD2, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Poseidon Wars 3-D */
|
||||||
{0x31B8040B, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_USA}, /* Maze Hunter 3-D */
|
{0xA3EF13CB, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Zaxxon 3-D */
|
||||||
{0xABD48AD2, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_USA}, /* Poseidon Wars 3-D */
|
{0xBBA74147, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Zaxxon 3-D [Proto] */
|
||||||
{0xA3EF13CB, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_USA}, /* Zaxxon 3-D */
|
{0xD6F43DDA, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Out Run 3-D */
|
||||||
{0xBBA74147, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_USA}, /* Zaxxon 3-D [Proto] */
|
{0x871562b0, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Maze Walker */
|
||||||
{0xD6F43DDA, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, REGION_USA}, /* Out Run 3-D */
|
{0x156948f9, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Space Harrier 3-D (J) */
|
||||||
|
|
||||||
/* games requiring 3-D Glasses & Sega Light Phaser */
|
/* games requiring 3-D Glasses & Sega Light Phaser */
|
||||||
{0xFBE5CFBB, 1, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Missile Defense 3D */
|
{0xFBE5CFBB, 1, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Missile Defense 3D */
|
||||||
{0xE79BB689, 1, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Missile Defense 3D [BIOS] */
|
{0xE79BB689, 1, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Missile Defense 3D [BIOS] */
|
||||||
|
|
||||||
/* games requiring Sega Light Phaser */
|
/* games requiring Sega Light Phaser */
|
||||||
{0x861B6E79, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Assault City [Light Phaser] */
|
{0x861B6E79, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Assault City [Light Phaser] */
|
||||||
{0x5FC74D2A, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Gangster Town */
|
{0x5FC74D2A, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Gangster Town */
|
||||||
{0xE167A561, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Hang-On / Safari Hunt */
|
{0xE167A561, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Hang-On / Safari Hunt */
|
||||||
{0xC5083000, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Hang-On / Safari Hunt [BAD DUMP] */
|
{0x91E93385, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Hang-On / Safari Hunt [BIOS] */
|
||||||
{0x91E93385, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Hang-On / Safari Hunt [BIOS] */
|
{0xE8EA842C, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Marksman Shooting / Trap Shooting */
|
||||||
{0xE8EA842C, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Marksman Shooting / Trap Shooting */
|
{0xE8215C2E, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Marksman Shooting / Trap Shooting / Safari Hunt */
|
||||||
{0xE8215C2E, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Marksman Shooting / Trap Shooting / Safari Hunt */
|
{0x205CAAE8, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Operation Wolf */
|
||||||
{0x205CAAE8, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Operation Wolf (can be played with gamepad in port B)*/
|
{0x23283F37, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Operation Wolf [A] */
|
||||||
{0x23283F37, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Operation Wolf [A] (can be played with gamepad in port B) */
|
{0xDA5A7013, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Rambo 3 */
|
||||||
{0xDA5A7013, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Rambo 3 */
|
{0x79AC8E7F, 0, 1, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Rescue Mission */
|
||||||
{0x79AC8E7F, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Rescue Mission */
|
{0x4B051022, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Shooting Gallery */
|
||||||
{0x4B051022, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Shooting Gallery */
|
{0xA908CFF5, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Spacegun */
|
||||||
{0xA908CFF5, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Spacegun */
|
{0x5359762D, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Wanted */
|
||||||
{0x5359762D, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Wanted */
|
{0x0CA95637, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Laser Ghost */
|
||||||
{0x0CA95637, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, REGION_USA}, /* Laser Ghost */
|
|
||||||
|
|
||||||
/* games requiring Sega Paddle */
|
/* games requiring Sega Paddle */
|
||||||
{0xF9DBB533, 0, SYSTEM_PADDLE, MAPPER_SEGA, REGION_JAPAN_NTSC}, /* Alex Kidd BMX Trial */
|
{0xF9DBB533, 0, 1, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Alex Kidd BMX Trial */
|
||||||
{0xA6FA42D0, 0, SYSTEM_PADDLE, MAPPER_SEGA, REGION_JAPAN_NTSC}, /* Galactic Protector */
|
{0xA6FA42D0, 0, 1, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Galactic Protector */
|
||||||
{0x29BC7FAD, 0, SYSTEM_PADDLE, MAPPER_SEGA, REGION_JAPAN_NTSC}, /* Megumi Rescue */
|
{0x29BC7FAD, 0, 1, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Megumi Rescue */
|
||||||
{0x315917D4, 0, SYSTEM_PADDLE, MAPPER_SEGA, REGION_JAPAN_NTSC}, /* Woody Pop */
|
{0x315917D4, 0, 0, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Woody Pop */
|
||||||
|
|
||||||
/* games requiring Sega Sport Pad */
|
/* games requiring Sega Sport Pad */
|
||||||
{0x0CB7E21F, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, REGION_USA}, /* Great Ice Hockey */
|
{0x0CB7E21F, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Great Ice Hockey */
|
||||||
{0xE42E4998, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, REGION_USA}, /* Sports Pad Football */
|
{0xE42E4998, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Sports Pad Football */
|
||||||
{0x41C948BF, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, REGION_USA} /* Sports Pad Soccer */
|
{0x41C948BF, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Sports Pad Soccer */
|
||||||
|
|
||||||
|
/* games supporting YM2413 FM */
|
||||||
|
{0x1C951F8E, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* After Burner */
|
||||||
|
{0xC13896D5, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Alex Kidd: The Lost Stars */
|
||||||
|
{0x5CBFE997, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Alien Syndrome */
|
||||||
|
{0xBBA2FE98, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Altered Beast */
|
||||||
|
{0xFF614EB3, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Aztec Adventure */
|
||||||
|
{0x3084CF11, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Bomber Raid */
|
||||||
|
{0xAC6009A7, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* California Games */
|
||||||
|
{0xA4852757, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Captain Silver */
|
||||||
|
{0xB81F6FA5, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Captain Silver (U) */
|
||||||
|
{0x3CFF6E80, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Casino Games */
|
||||||
|
{0xE7F62E6D, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Cloud Master */
|
||||||
|
{0x908E7524, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Cyborg Hunter */
|
||||||
|
{0xA55D89F3, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Double Dragon */
|
||||||
|
{0xB8B141F9, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Fantasy Zone II */
|
||||||
|
{0xD29889AD, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Fantasy Zone: The Maze */
|
||||||
|
{0xA4AC35D8, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Galaxy Force */
|
||||||
|
{0x6C827520, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Galaxy Force (U) */
|
||||||
|
{0x1890F407, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Game Box Série Esportes Radicais (BR) */
|
||||||
|
{0xB746A6F5, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Global Defense */
|
||||||
|
{0x91A0FC4E, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Global Defense [Proto] */
|
||||||
|
{0x48651325, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Golfamania */
|
||||||
|
{0x5DABFDC3, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Golfamania [Proto] */
|
||||||
|
{0xA51376FE, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Golvellius - Valley of Doom */
|
||||||
|
{0x98E4AE4A, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Great Golf */
|
||||||
|
{0x516ED32E, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Kenseiden */
|
||||||
|
{0xE8511B08, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Lord of The Sword */
|
||||||
|
{0x0E333B6E, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Miracle Warriors - Seal of The Dark Lord */
|
||||||
|
{0x301A59AA, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Miracle Warriors - Seal of The Dark Lord [Proto] */
|
||||||
|
{0x01D67C0B, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Mônica no Castelo do Dragão (BR) */
|
||||||
|
{0x5589D8D2, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Out Run */
|
||||||
|
{0xE030E66C, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Parlour Games */
|
||||||
|
{0xF97E9875, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Penguin Land */
|
||||||
|
{0x4077EFD9, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Power Strike */
|
||||||
|
{0xBB54B6B0, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* R-Type */
|
||||||
|
{0x42FC47EE, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Rampage */
|
||||||
|
{0xC547EB1B, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Rastan */
|
||||||
|
{0x9A8B28EC, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Scramble Spirits */
|
||||||
|
{0xAAB67EC3, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Shanghai */
|
||||||
|
{0x0C6FAC4E, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Shinobi */
|
||||||
|
{0x4752CAE7, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* SpellCaster */
|
||||||
|
{0x1A390B93, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Tennis Ace */
|
||||||
|
{0xAE920E4B, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Thunder Blade */
|
||||||
|
{0x51BD14BE, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Time Soldiers */
|
||||||
|
{0x22CCA9BB, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Turma da Mônica em: O Resgate (BR) */
|
||||||
|
{0xB52D60C8, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Ultima IV */
|
||||||
|
{0xDE9F8517, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Ultima IV [Proto] */
|
||||||
|
{0xDFB0B161, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Vigilante */
|
||||||
|
{0x679E1676, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Wonder Boy III: The Dragon's Trap */
|
||||||
|
{0x8CBEF0C1, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Wonder Boy in Monster Land */
|
||||||
|
{0x2F2E3BC9, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Zillion II - The Tri Formation */
|
||||||
|
{0x48D44A13, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_NONE, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Master System Bios (J) */
|
||||||
|
{0xD8C4165B, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Aleste */
|
||||||
|
{0x4CC11DF9, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Alien Syndrome (J) */
|
||||||
|
{0xE421E466, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Chouon Senshi Borgman */
|
||||||
|
{0x2BCDB8FA, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Doki Doki Penguin Land - Uchuu-Daibouken */
|
||||||
|
{0x56BD2455, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Doki Doki Penguin Land - Uchuu-Daibouken [Proto] */
|
||||||
|
{0xC722FB42, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Fantasy Zone II (J) */
|
||||||
|
{0x7ABC70E9, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Family Games (Party Games) */
|
||||||
|
{0x6586BD1F, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Masters Golf */
|
||||||
|
{0x4847BC91, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Masters Golf [Proto] */
|
||||||
|
{0xB9FDF6D9, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Haja no Fuuin */
|
||||||
|
{0x955A009E, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Hoshi wo Sagashite */
|
||||||
|
{0x05EA5353, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Kenseiden (J) */
|
||||||
|
{0xD11D32E4, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Kujakuou */
|
||||||
|
{0xAA7D6F45, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Lord of Sword */
|
||||||
|
{0xBF0411AD, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Maou Golvellius */
|
||||||
|
{0x21A21352, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Maou Golvellius [Proto] */
|
||||||
|
{0x5B5F9106, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Nekyuu Kousien */
|
||||||
|
{0xBEA27D5C, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Opa Opa */
|
||||||
|
{0x6605D36A, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Phantasy Star (J) */
|
||||||
|
{0xE1FFF1BB, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Shinobi (J) */
|
||||||
|
{0x11645549, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Solomon no Kagi - Oujo Rihita no Namida */
|
||||||
|
{0x7E0EF8CB, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Super Racing */
|
||||||
|
{0xB1DA6A30, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Super Wonder Boy Monster World */
|
||||||
|
{0x8132AB2C, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Tensai Bakabon */
|
||||||
|
{0xC0CE19B1, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_JAPAN_NTSC}, /* Thunder Blade (J) */
|
||||||
|
{0x07301F83, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_PBC, REGION_JAPAN_NTSC} /* Phantasy Star [Megadrive] (J) */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 1K trash buffer */
|
/* 1K trash buffer */
|
||||||
static uint8 dummy[0x400];
|
static uint8 dummy[0x400];
|
||||||
|
|
||||||
/* Function prorotypes */
|
/* Function prototypes */
|
||||||
static void mapper_8k_w(int offset, unsigned int data);
|
static void mapper_8k_w(int offset, unsigned int data);
|
||||||
static void mapper_16k_w(int offset, unsigned int data);
|
static void mapper_16k_w(int offset, unsigned int data);
|
||||||
static void write_mapper_none(unsigned int address, unsigned char data);
|
static void write_mapper_none(unsigned int address, unsigned char data);
|
||||||
@ -158,58 +300,106 @@ static void write_mapper_sega(unsigned int address, unsigned char data);
|
|||||||
static void write_mapper_codies(unsigned int address, unsigned char data);
|
static void write_mapper_codies(unsigned int address, unsigned char data);
|
||||||
static void write_mapper_korea(unsigned int address, unsigned char data);
|
static void write_mapper_korea(unsigned int address, unsigned char data);
|
||||||
static void write_mapper_msx(unsigned int address, unsigned char data);
|
static void write_mapper_msx(unsigned int address, unsigned char data);
|
||||||
|
static void write_mapper_93c46(unsigned int address, unsigned char data);
|
||||||
|
static void write_mapper_terebi(unsigned int address, unsigned char data);
|
||||||
|
static unsigned char read_mapper_93c46(unsigned int address);
|
||||||
|
static unsigned char read_mapper_terebi(unsigned int address);
|
||||||
|
static unsigned char read_mapper_default(unsigned int address);
|
||||||
|
|
||||||
void sms_cart_init(void)
|
void sms_cart_init(void)
|
||||||
{
|
{
|
||||||
/* default mapper */
|
/* default mapper */
|
||||||
slot.mapper = MAPPER_SEGA;
|
slot.mapper = (cart.romsize > 0xC000) ? MAPPER_SEGA : MAPPER_NONE;
|
||||||
|
|
||||||
/* default supported peripheral */
|
/* use Master System controller by default */
|
||||||
uint8 device = SYSTEM_MS_GAMEPAD;
|
uint8 device = SYSTEM_MS_GAMEPAD;
|
||||||
|
|
||||||
|
/* disable 3-D Glasses by default */
|
||||||
cart.special = 0;
|
cart.special = 0;
|
||||||
|
|
||||||
|
/* disable YM2413 chip disabled by default in AUTO mode */
|
||||||
|
if (config.ym2413 & 2)
|
||||||
|
{
|
||||||
|
config.ym2413 = 2;
|
||||||
|
}
|
||||||
|
|
||||||
/* compute CRC */
|
/* compute CRC */
|
||||||
uint32 crc = crc32(0, cart.rom, cart.romsize);
|
uint32 crc = crc32(0, cart.rom, cart.romsize);
|
||||||
|
|
||||||
/* detect cartridge mapper */
|
/* auto-detect game settings */
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<GAME_DATABASE_CNT; i++)
|
for (i=0; i<GAME_DATABASE_CNT; i++)
|
||||||
{
|
{
|
||||||
if (crc == game_list[i].crc)
|
if (crc == game_list[i].crc)
|
||||||
{
|
{
|
||||||
cart.special = game_list[i].glasses_3d;
|
/* auto-detect cartridge mapper */
|
||||||
slot.mapper = game_list[i].mapper;
|
slot.mapper = game_list[i].mapper;
|
||||||
|
|
||||||
|
/* auto-detect required peripherals */
|
||||||
device = game_list[i].peripheral;
|
device = game_list[i].peripheral;
|
||||||
|
|
||||||
|
/* auto-detect 3D glasses support */
|
||||||
|
cart.special = game_list[i].g_3d;
|
||||||
|
|
||||||
|
/* auto-detect system hardware */
|
||||||
|
if (!config.system || ((config.system == SYSTEM_GG) && (game_list[i].system == SYSTEM_GGMS)))
|
||||||
|
{
|
||||||
|
system_hw = game_list[i].system;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* auto-detect YM2413 chip support in AUTO mode */
|
||||||
|
if (config.ym2413 & 2)
|
||||||
|
{
|
||||||
|
config.ym2413 |= game_list[i].fm;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* game found, leave loop */
|
||||||
i = GAME_DATABASE_CNT;
|
i = GAME_DATABASE_CNT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize Z80 write handler */
|
/* initialize Z80 memory handlers */
|
||||||
switch(slot.mapper)
|
switch(slot.mapper)
|
||||||
{
|
{
|
||||||
case MAPPER_NONE:
|
case MAPPER_NONE:
|
||||||
|
z80_readmem = read_mapper_default;
|
||||||
z80_writemem = write_mapper_none;
|
z80_writemem = write_mapper_none;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MAPPER_CODIES:
|
case MAPPER_CODIES:
|
||||||
|
z80_readmem = read_mapper_default;
|
||||||
z80_writemem = write_mapper_codies;
|
z80_writemem = write_mapper_codies;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MAPPER_KOREA:
|
case MAPPER_KOREA:
|
||||||
|
z80_readmem = read_mapper_default;
|
||||||
z80_writemem = write_mapper_korea;
|
z80_writemem = write_mapper_korea;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MAPPER_MSX:
|
case MAPPER_MSX:
|
||||||
|
z80_readmem = read_mapper_default;
|
||||||
z80_writemem = write_mapper_msx;
|
z80_writemem = write_mapper_msx;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MAPPER_93C46:
|
||||||
|
gg_eeprom_init();
|
||||||
|
z80_readmem = read_mapper_93c46;
|
||||||
|
z80_writemem = write_mapper_93c46;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MAPPER_TEREBI:
|
||||||
|
cart.special |= HW_TEREBI_OEKAKI;
|
||||||
|
z80_readmem = read_mapper_terebi;
|
||||||
|
z80_writemem = write_mapper_terebi;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
z80_readmem = read_mapper_default;
|
||||||
z80_writemem = write_mapper_sega;
|
z80_writemem = write_mapper_sega;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize default SRAM (32K max.) */
|
/* initialize SRAM */
|
||||||
sram_init();
|
sram_init();
|
||||||
|
|
||||||
/* restore previous input settings */
|
/* restore previous input settings */
|
||||||
@ -226,24 +416,25 @@ void sms_cart_init(void)
|
|||||||
input.x_offset = 20;
|
input.x_offset = 20;
|
||||||
input.y_offset = 0;
|
input.y_offset = 0;
|
||||||
|
|
||||||
/* detect if game requires specific peripheral */
|
/* save current settings */
|
||||||
if (device != SYSTEM_MS_GAMEPAD)
|
|
||||||
{
|
|
||||||
/* save port A setting */
|
|
||||||
if (old_system[0] == -1)
|
if (old_system[0] == -1)
|
||||||
{
|
{
|
||||||
old_system[0] = input.system[0];
|
old_system[0] = input.system[0];
|
||||||
}
|
}
|
||||||
|
if (old_system[1] == -1)
|
||||||
|
{
|
||||||
|
old_system[1] = input.system[1];
|
||||||
|
}
|
||||||
|
|
||||||
/* force port A configuration */
|
/* force port A & port B configuration */
|
||||||
input.system[0] = device;
|
input.system[0] = device;
|
||||||
|
input.system[1] = SYSTEM_MS_GAMEPAD;
|
||||||
|
|
||||||
/* SpaceGun & Gangster Town use different gun offset */
|
/* SpaceGun & Gangster Town use different gun offset */
|
||||||
if ((crc == 0x5359762D) || (crc == 0x5FC74D2A))
|
if ((crc == 0x5359762D) || (crc == 0x5FC74D2A))
|
||||||
{
|
{
|
||||||
input.x_offset = 16;
|
input.x_offset = 16;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sms_cart_reset(void)
|
void sms_cart_reset(void)
|
||||||
@ -253,24 +444,52 @@ void sms_cart_reset(void)
|
|||||||
/* Unmapped memory return $FF */
|
/* Unmapped memory return $FF */
|
||||||
memset(dummy, 0xFF, 0x400);
|
memset(dummy, 0xFF, 0x400);
|
||||||
|
|
||||||
/* Reset Z80 memory mapping at $0000-$BFFF (first 32k of ROM mirrored) */
|
/* $0000-$7FFF mapped to Cartridge ROM (32K) */
|
||||||
for(i = 0x00; i < 0x30; i++)
|
for(i = 0x00; i < 0x20; i++)
|
||||||
{
|
{
|
||||||
z80_readmap[i] = &cart.rom[(i & 0x1F) << 10];
|
z80_readmap[i] = &cart.rom[i << 10];
|
||||||
z80_writemap[i] = dummy;
|
z80_writemap[i] = dummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset Z80 memory mapping at $C000-$FFFF (first 8K of 68k RAM mirrored) */
|
/* $8000-$BFFF mapped to Cartridge ROM or RAM (16K) */
|
||||||
|
if (cart.romsize > 0x8000)
|
||||||
|
{
|
||||||
|
for(i = 0x20; i < 0x30; i++)
|
||||||
|
{
|
||||||
|
z80_readmap[i] = &cart.rom[i << 10];
|
||||||
|
z80_writemap[i] = dummy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(i = 0x20; i < 0x30; i++)
|
||||||
|
{
|
||||||
|
z80_readmap[i] = z80_writemap[i] = &sram.sram[(i & 0x0F) << 10];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (system_hw == SYSTEM_SG)
|
||||||
|
{
|
||||||
|
/* $C000-$FFFF mapped to internal RAM (2K mirrored) */
|
||||||
|
for(i = 0x30; i < 0x40; i++)
|
||||||
|
{
|
||||||
|
z80_readmap[i] = z80_writemap[i] = &work_ram[(i & 0x01) << 10];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* $C000-$FFFF mapped to internal RAM (8K mirrored) */
|
||||||
for(i = 0x30; i < 0x40; i++)
|
for(i = 0x30; i < 0x40; i++)
|
||||||
{
|
{
|
||||||
z80_readmap[i] = z80_writemap[i] = &work_ram[(i & 0x07) << 10];
|
z80_readmap[i] = z80_writemap[i] = &work_ram[(i & 0x07) << 10];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Reset cartridge paging registers */
|
/* Reset cartridge paging registers */
|
||||||
switch(slot.mapper)
|
switch(slot.mapper)
|
||||||
{
|
{
|
||||||
case MAPPER_NONE:
|
|
||||||
case MAPPER_SEGA:
|
case MAPPER_SEGA:
|
||||||
|
case MAPPER_SEGA_X:
|
||||||
{
|
{
|
||||||
slot.fcr[0] = 0;
|
slot.fcr[0] = 0;
|
||||||
slot.fcr[1] = 0;
|
slot.fcr[1] = 0;
|
||||||
@ -289,30 +508,31 @@ void sms_cart_reset(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Set default memory map */
|
/* Set default memory map */
|
||||||
if (slot.mapper != MAPPER_MSX)
|
if (slot.mapper == MAPPER_MSX)
|
||||||
{
|
|
||||||
mapper_16k_w(0,slot.fcr[0]);
|
|
||||||
mapper_16k_w(1,slot.fcr[1]);
|
|
||||||
mapper_16k_w(2,slot.fcr[2]);
|
|
||||||
mapper_16k_w(3,slot.fcr[3]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
mapper_8k_w(0,slot.fcr[0]);
|
mapper_8k_w(0,slot.fcr[0]);
|
||||||
mapper_8k_w(1,slot.fcr[1]);
|
mapper_8k_w(1,slot.fcr[1]);
|
||||||
mapper_8k_w(2,slot.fcr[2]);
|
mapper_8k_w(2,slot.fcr[2]);
|
||||||
mapper_8k_w(3,slot.fcr[3]);
|
mapper_8k_w(3,slot.fcr[3]);
|
||||||
}
|
}
|
||||||
|
else if (slot.mapper > MAPPER_NONE)
|
||||||
|
{
|
||||||
|
mapper_16k_w(0,slot.fcr[0]);
|
||||||
|
mapper_16k_w(1,slot.fcr[1]);
|
||||||
|
mapper_16k_w(2,slot.fcr[2]);
|
||||||
|
mapper_16k_w(3,slot.fcr[3]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sms_cart_switch(int enabled)
|
void sms_cart_switch(int enabled)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
{
|
{
|
||||||
/* Enable cartdige ROM at $0000-$BFFF */
|
/* Enable cartridge ROM at $0000-$BFFF */
|
||||||
for(i = 0x00; i < 0x30; i++)
|
for(i = 0x00; i < 0x30; i++)
|
||||||
{
|
{
|
||||||
z80_readmap[i] = &cart.rom[(i & 0x1F) << 10];
|
z80_readmap[i] = &cart.rom[(i & 0x1F) << 10];
|
||||||
@ -340,6 +560,12 @@ int sms_cart_region_detect(void)
|
|||||||
{
|
{
|
||||||
if (crc == game_list[i].crc)
|
if (crc == game_list[i].crc)
|
||||||
{
|
{
|
||||||
|
/* Turma da Mônica em: O Resgate & Wonder Boy III enable FM support on japanese hardware only */
|
||||||
|
if (config.ym2413 && ((crc == 0x22CCA9BB) || (crc == 0x679E1676)))
|
||||||
|
{
|
||||||
|
return REGION_JAPAN_NTSC;
|
||||||
|
}
|
||||||
|
|
||||||
return game_list[i].region;
|
return game_list[i].region;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,20 +587,20 @@ int sms_cart_context_load(uint8 *state)
|
|||||||
load_param(slot.fcr, sizeof(slot.fcr));
|
load_param(slot.fcr, sizeof(slot.fcr));
|
||||||
|
|
||||||
/* Set default memory map */
|
/* Set default memory map */
|
||||||
if (slot.mapper != MAPPER_MSX)
|
if (slot.mapper == MAPPER_MSX)
|
||||||
{
|
|
||||||
mapper_16k_w(0,slot.fcr[0]);
|
|
||||||
mapper_16k_w(1,slot.fcr[1]);
|
|
||||||
mapper_16k_w(2,slot.fcr[2]);
|
|
||||||
mapper_16k_w(3,slot.fcr[3]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
mapper_8k_w(0,slot.fcr[0]);
|
mapper_8k_w(0,slot.fcr[0]);
|
||||||
mapper_8k_w(1,slot.fcr[1]);
|
mapper_8k_w(1,slot.fcr[1]);
|
||||||
mapper_8k_w(2,slot.fcr[2]);
|
mapper_8k_w(2,slot.fcr[2]);
|
||||||
mapper_8k_w(3,slot.fcr[3]);
|
mapper_8k_w(3,slot.fcr[3]);
|
||||||
}
|
}
|
||||||
|
else if (slot.mapper > MAPPER_NONE)
|
||||||
|
{
|
||||||
|
mapper_16k_w(0,slot.fcr[0]);
|
||||||
|
mapper_16k_w(1,slot.fcr[1]);
|
||||||
|
mapper_16k_w(2,slot.fcr[2]);
|
||||||
|
mapper_16k_w(3,slot.fcr[3]);
|
||||||
|
}
|
||||||
|
|
||||||
return bufferptr;
|
return bufferptr;
|
||||||
}
|
}
|
||||||
@ -429,6 +655,11 @@ void mapper_8k_w(int offset, unsigned int data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NGC
|
||||||
|
/* update ROM patches */
|
||||||
|
ROMCheatUpdate();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void mapper_16k_w(int offset, unsigned int data)
|
void mapper_16k_w(int offset, unsigned int data)
|
||||||
@ -439,7 +670,7 @@ void mapper_16k_w(int offset, unsigned int data)
|
|||||||
uint8 page = data % (cart.romsize >> 14);
|
uint8 page = data % (cart.romsize >> 14);
|
||||||
|
|
||||||
/* page index increment (SEGA mapper) */
|
/* page index increment (SEGA mapper) */
|
||||||
if (slot.fcr[0] & 0x03)
|
if ((slot.fcr[0] & 0x03) && (slot.mapper == MAPPER_SEGA))
|
||||||
{
|
{
|
||||||
page = (page + ((4 - (slot.fcr[0] & 0x03)) << 3)) % (cart.romsize >> 14);
|
page = (page + ((4 - (slot.fcr[0] & 0x03)) << 3)) % (cart.romsize >> 14);
|
||||||
}
|
}
|
||||||
@ -454,7 +685,7 @@ void mapper_16k_w(int offset, unsigned int data)
|
|||||||
if(data & 0x08)
|
if(data & 0x08)
|
||||||
{
|
{
|
||||||
/* external RAM (upper or lower 16K) mapped at $8000-$BFFF */
|
/* external RAM (upper or lower 16K) mapped at $8000-$BFFF */
|
||||||
for(i = 0x20; i <= 0x2F; i++)
|
for(i = 0x20; i < 0x30; i++)
|
||||||
{
|
{
|
||||||
z80_readmap[i] = z80_writemap[i] = &sram.sram[((data & 0x04) << 12) + ((i & 0x0F) << 10)];
|
z80_readmap[i] = z80_writemap[i] = &sram.sram[((data & 0x04) << 12) + ((i & 0x0F) << 10)];
|
||||||
}
|
}
|
||||||
@ -465,7 +696,7 @@ void mapper_16k_w(int offset, unsigned int data)
|
|||||||
page = slot.fcr[3] % (cart.romsize >> 14);
|
page = slot.fcr[3] % (cart.romsize >> 14);
|
||||||
|
|
||||||
/* page index increment (SEGA mapper) */
|
/* page index increment (SEGA mapper) */
|
||||||
if (data & 0x03)
|
if ((data & 0x03) && (slot.mapper == MAPPER_SEGA))
|
||||||
{
|
{
|
||||||
page = (page + ((4 - (data & 0x03)) << 3)) % (cart.romsize >> 14);
|
page = (page + ((4 - (data & 0x03)) << 3)) % (cart.romsize >> 14);
|
||||||
}
|
}
|
||||||
@ -568,6 +799,11 @@ void mapper_16k_w(int offset, unsigned int data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NGC
|
||||||
|
/* update ROM patches */
|
||||||
|
ROMCheatUpdate();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_mapper_none(unsigned int address, unsigned char data)
|
static void write_mapper_none(unsigned int address, unsigned char data)
|
||||||
@ -629,3 +865,65 @@ static void write_mapper_msx(unsigned int address, unsigned char data)
|
|||||||
|
|
||||||
z80_writemap[address >> 10][address & 0x03FF] = data;
|
z80_writemap[address >> 10][address & 0x03FF] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void write_mapper_93c46(unsigned int address, unsigned char data)
|
||||||
|
{
|
||||||
|
if ((address == 0x8000) && gg_eeprom.enabled)
|
||||||
|
{
|
||||||
|
gg_eeprom_write(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (address == 0xFFFC)
|
||||||
|
{
|
||||||
|
gg_eeprom_ctrl(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(address > 0xFFFC)
|
||||||
|
{
|
||||||
|
mapper_16k_w(address & 3, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
z80_writemap[address >> 10][address & 0x03FF] = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void write_mapper_terebi(unsigned int address, unsigned char data)
|
||||||
|
{
|
||||||
|
if (address == 0x6000)
|
||||||
|
{
|
||||||
|
terebi_oekaki_write(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
z80_writemap[address >> 10][address & 0x03FF] = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned char read_mapper_93c46(unsigned int address)
|
||||||
|
{
|
||||||
|
if ((address == 0x8000) && gg_eeprom.enabled)
|
||||||
|
{
|
||||||
|
return gg_eeprom_read();
|
||||||
|
}
|
||||||
|
|
||||||
|
return z80_readmap[address >> 10][address & 0x03FF];
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned char read_mapper_terebi(unsigned int address)
|
||||||
|
{
|
||||||
|
if (address == 0x8000)
|
||||||
|
{
|
||||||
|
return (terebi_oekaki_read() >> 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (address == 0xA000)
|
||||||
|
{
|
||||||
|
return (terebi_oekaki_read() & 0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
return z80_readmap[address >> 10][address & 0x03FF];
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned char read_mapper_default(unsigned int address)
|
||||||
|
{
|
||||||
|
return z80_readmap[address >> 10][address & 0x03FF];
|
||||||
|
}
|
||||||
|
@ -1,30 +1,47 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Master System cartridge hardware support
|
* SG-1000, Master System & Game Gear cartridge hardware support
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998-2007 Charles MacDonald (SMS Plus original code)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
* Eke-Eke (2007-2011), additional code & fixes for the GCN/Wii port
|
|
||||||
*
|
*
|
||||||
* Realtec mapper has been figured out by TascoDeluxe
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
|
* provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* it under the terms of the GNU General Public License as published by
|
* product or activity.
|
||||||
* 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,
|
* - Redistributions that are modified from the original source must include the
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* complete source code, including the source code for all components used by a
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* binary built from the modified sources. However, as a special exception, the
|
||||||
* GNU General Public License for more details.
|
* 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.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* - Redistributions must reproduce the above copyright notice, this list of
|
||||||
* along with this program; if not, write to the Free Software
|
* conditions and the following disclaimer in the documentation and/or other
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _SMS_CART_H_
|
#ifndef _SMS_CART_H_
|
||||||
#define _SMS_CART_H_
|
#define _SMS_CART_H_
|
||||||
|
|
||||||
|
/* Special hardware (0x01 reserved for Master System 3-D glasses) */
|
||||||
|
#define HW_TEREBI_OEKAKI 0x02
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
extern void sms_cart_init(void);
|
extern void sms_cart_init(void);
|
||||||
extern void sms_cart_reset(void);
|
extern void sms_cart_reset(void);
|
||||||
|
@ -2,21 +2,37 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Backup RAM support
|
* Backup RAM support
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008, 2009 Eke-Eke (GCN/Wii port)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
@ -48,7 +64,7 @@ void sram_init()
|
|||||||
sram.sram = cart.rom + 0x500000;
|
sram.sram = cart.rom + 0x500000;
|
||||||
|
|
||||||
/* initialize SRAM */
|
/* initialize SRAM */
|
||||||
memset(sram.sram, 0xff, 0x10000);
|
memset(sram.sram, 0xFF, 0x10000);
|
||||||
sram.crc = crc32(0, sram.sram, 0x10000);
|
sram.crc = crc32(0, sram.sram, 0x10000);
|
||||||
|
|
||||||
/* retrieve informations from header */
|
/* retrieve informations from header */
|
||||||
|
@ -2,21 +2,37 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Backup RAM support
|
* Backup RAM support
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008, 2009 Eke-Eke (GCN/Wii port)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
@ -461,7 +461,9 @@ static u32 pm_io(int reg, int write, u32 d)
|
|||||||
#ifdef LOG_SVP
|
#ifdef LOG_SVP
|
||||||
elprintf(EL_SVP, "PM%i (%c) set to %08x @ %04x", reg, write ? 'w' : 'r', rPMC.v, GET_PPC_OFFS());
|
elprintf(EL_SVP, "PM%i (%c) set to %08x @ %04x", reg, write ? 'w' : 'r', rPMC.v, GET_PPC_OFFS());
|
||||||
#endif
|
#endif
|
||||||
ssp->pmac_read[write ? reg + 6 : reg] = rPMC.v;
|
|
||||||
|
unsigned int *pmac = &ssp->pmac_read[reg];
|
||||||
|
pmac[6*write] = rPMC.v;
|
||||||
ssp->emu_status &= ~SSP_PMC_SET;
|
ssp->emu_status &= ~SSP_PMC_SET;
|
||||||
#ifdef LOG_SVP
|
#ifdef LOG_SVP
|
||||||
if ((rPMC.v & 0x7f) == 0x1c && (rPMC.v & 0x7fff0000) == 0) {
|
if ((rPMC.v & 0x7f) == 0x1c && (rPMC.v & 0x7fff0000) == 0) {
|
||||||
@ -582,7 +584,8 @@ static u32 pm_io(int reg, int write, u32 d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PMC value corresponds to last PMR accessed (not sure).
|
// PMC value corresponds to last PMR accessed (not sure).
|
||||||
rPMC.v = ssp->pmac_read[write ? reg + 6 : reg];
|
unsigned int *pmac = &ssp->pmac_read[reg];
|
||||||
|
rPMC.v = pmac[6*write];
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
@ -1089,7 +1092,7 @@ void ssp1601_run(int cycles)
|
|||||||
SET_PC(rPC);
|
SET_PC(rPC);
|
||||||
g_cycles = cycles;
|
g_cycles = cycles;
|
||||||
|
|
||||||
while (g_cycles > 0 && !(ssp->emu_status & SSP_WAIT_MASK))
|
do
|
||||||
{
|
{
|
||||||
int op;
|
int op;
|
||||||
u32 tmpv;
|
u32 tmpv;
|
||||||
@ -1317,8 +1320,8 @@ void ssp1601_run(int cycles)
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
g_cycles--;
|
|
||||||
}
|
}
|
||||||
|
while (--g_cycles > 0 && !(ssp->emu_status & SSP_WAIT_MASK));
|
||||||
|
|
||||||
read_P(); // update P
|
read_P(); // update P
|
||||||
rPC = GET_PC();
|
rPC = GET_PC();
|
||||||
|
210
source/genesis.c
210
source/genesis.c
@ -2,22 +2,40 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Internal Hardware & Bus controllers
|
* Internal Hardware & Bus controllers
|
||||||
*
|
*
|
||||||
|
* Support for SG-1000, Mark-III, Master System, Game Gear & Mega Drive hardware
|
||||||
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
||||||
* Eke-Eke (2007-2011), additional code & fixes for the GCN/Wii port
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
@ -43,17 +61,30 @@ void gen_init(void)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* initialize 68k */
|
/* initialize 68k */
|
||||||
m68k_set_cpu_type(M68K_CPU_TYPE_68000);
|
|
||||||
m68k_init();
|
m68k_init();
|
||||||
|
|
||||||
/* initialize Z80 */
|
/* initialize Z80 */
|
||||||
z80_init(0,z80_irq_callback);
|
z80_init(0,z80_irq_callback);
|
||||||
|
|
||||||
/* initialize 68k memory map */
|
/* initialize default 68k memory map */
|
||||||
/* $000000-$7FFFFF is affected to cartridge area (see md_cart.c) */
|
|
||||||
for (i=0x80; i<0x100; i++)
|
/* $000000-$7FFFFF : cartridge area (md_cart.c) */
|
||||||
|
|
||||||
|
/* $800000-$DFFFFF : illegal access by default */
|
||||||
|
for (i=0x80; i<0xe0; i++)
|
||||||
|
{
|
||||||
|
m68k_memory_map[i].base = work_ram; /* for VDP DMA */
|
||||||
|
m68k_memory_map[i].read8 = m68k_lockup_r_8;
|
||||||
|
m68k_memory_map[i].read16 = m68k_lockup_r_16;
|
||||||
|
m68k_memory_map[i].write8 = m68k_lockup_w_8;
|
||||||
|
m68k_memory_map[i].write16 = m68k_lockup_w_16;
|
||||||
|
zbank_memory_map[i].read = zbank_lockup_r;
|
||||||
|
zbank_memory_map[i].write = zbank_lockup_w;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* $E00000-$FFFFFF : Work RAM */
|
||||||
|
for (i=0xe0; i<0x100; i++)
|
||||||
{
|
{
|
||||||
/* $800000-$FFFFFF is affected to WRAM (see VDP DMA) */
|
|
||||||
m68k_memory_map[i].base = work_ram;
|
m68k_memory_map[i].base = work_ram;
|
||||||
m68k_memory_map[i].read8 = NULL;
|
m68k_memory_map[i].read8 = NULL;
|
||||||
m68k_memory_map[i].read16 = NULL;
|
m68k_memory_map[i].read16 = NULL;
|
||||||
@ -63,18 +94,6 @@ void gen_init(void)
|
|||||||
zbank_memory_map[i].write = NULL;
|
zbank_memory_map[i].write = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize 68k memory handlers */
|
|
||||||
for (i=0x80; i<0xe0; i++)
|
|
||||||
{
|
|
||||||
/* $800000-$DFFFFF : illegal area by default */
|
|
||||||
m68k_memory_map[i].read8 = m68k_lockup_r_8;
|
|
||||||
m68k_memory_map[i].read16 = m68k_lockup_r_16;
|
|
||||||
m68k_memory_map[i].write8 = m68k_lockup_w_8;
|
|
||||||
m68k_memory_map[i].write16 = m68k_lockup_w_16;
|
|
||||||
zbank_memory_map[i].read = zbank_lockup_r;
|
|
||||||
zbank_memory_map[i].write = zbank_lockup_w;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* $A10000-$A1FFFF : I/O & Control registers */
|
/* $A10000-$A1FFFF : I/O & Control registers */
|
||||||
m68k_memory_map[0xa1].read8 = ctrl_io_read_byte;
|
m68k_memory_map[0xa1].read8 = ctrl_io_read_byte;
|
||||||
m68k_memory_map[0xa1].read16 = ctrl_io_read_word;
|
m68k_memory_map[0xa1].read16 = ctrl_io_read_word;
|
||||||
@ -94,24 +113,31 @@ void gen_init(void)
|
|||||||
zbank_memory_map[i].write = zbank_write_vdp;
|
zbank_memory_map[i].write = zbank_write_vdp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MS COMPATIBILITY mode */
|
/* 68k mode */
|
||||||
if (system_hw == SYSTEM_PBC)
|
if (system_hw == SYSTEM_MD)
|
||||||
{
|
{
|
||||||
/* initialize Z80 read handler */
|
/* initialize Z80 memory map */
|
||||||
/* NB: memory map & write handler are defined by cartridge hardware */
|
/* $0000-$3FFF is mapped to Z80 RAM (8K mirrored) */
|
||||||
z80_readmem = z80_sms_memory_r;
|
/* $4000-$FFFF is mapped to hardware but Z80.PC should never point there */
|
||||||
|
for (i=0; i<64; i++)
|
||||||
/* initialize Z80 ports handlers */
|
{
|
||||||
z80_writeport = z80_sms_port_w;
|
z80_readmap[i] = &zram[(i & 7) << 10];
|
||||||
z80_readport = z80_sms_port_r;
|
|
||||||
|
|
||||||
/* initialize MS cartridge hardware */
|
|
||||||
sms_cart_init();
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
/* initialize Z80 memory handlers */
|
||||||
|
z80_writemem = z80_memory_w;
|
||||||
|
z80_readmem = z80_memory_r;
|
||||||
|
|
||||||
|
/* initialize Z80 port handlers */
|
||||||
|
z80_writeport = z80_unused_port_w;
|
||||||
|
z80_readport = z80_unused_port_r;
|
||||||
|
|
||||||
|
/* initialize MD cartridge hardware */
|
||||||
|
md_cart_init();
|
||||||
|
}
|
||||||
|
|
||||||
/* PICO hardware */
|
/* PICO hardware */
|
||||||
if (system_hw == SYSTEM_PICO)
|
else if (system_hw == SYSTEM_PICO)
|
||||||
{
|
{
|
||||||
/* additional registers mapped to $800000-$80FFFF */
|
/* additional registers mapped to $800000-$80FFFF */
|
||||||
m68k_memory_map[0x80].read8 = pico_read_byte;
|
m68k_memory_map[0x80].read8 = pico_read_byte;
|
||||||
@ -134,27 +160,58 @@ void gen_init(void)
|
|||||||
pico_page[4] = 0x0F;
|
pico_page[4] = 0x0F;
|
||||||
pico_page[5] = 0x1F;
|
pico_page[5] = 0x1F;
|
||||||
pico_page[6] = 0x3F;
|
pico_page[6] = 0x3F;
|
||||||
}
|
|
||||||
|
|
||||||
/* initialize Z80 memory map */
|
/* initialize cartridge hardware */
|
||||||
/* $0000-$3FFF is mapped to Z80 RAM (8K mirrored) */
|
|
||||||
/* $4000-$FFFF is mapped to hardware but Z80.PC should never point there */
|
|
||||||
for (i=0; i<64; i++)
|
|
||||||
{
|
|
||||||
z80_readmap[i] = &zram[(i & 7) << 10];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initialize Z80 memory handlers */
|
|
||||||
z80_writemem = z80_md_memory_w;
|
|
||||||
z80_readmem = z80_md_memory_r;
|
|
||||||
|
|
||||||
/* initialize Z80 port handlers */
|
|
||||||
z80_writeport = z80_unused_port_w;
|
|
||||||
z80_readport = z80_unused_port_r;
|
|
||||||
|
|
||||||
/* initialize MD cartridge hardware */
|
|
||||||
md_cart_init();
|
md_cart_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Z80 mode */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* initialize cartridge hardware (memory handlers are also initialized) */
|
||||||
|
sms_cart_init();
|
||||||
|
|
||||||
|
/* initialize Z80 ports handlers */
|
||||||
|
switch (system_hw)
|
||||||
|
{
|
||||||
|
case SYSTEM_PBC:
|
||||||
|
{
|
||||||
|
z80_writeport = z80_md_port_w;
|
||||||
|
z80_readport = z80_md_port_r;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case SYSTEM_GG:
|
||||||
|
case SYSTEM_GGMS:
|
||||||
|
{
|
||||||
|
z80_writeport = z80_gg_port_w;
|
||||||
|
z80_readport = z80_gg_port_r;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case SYSTEM_SMS:
|
||||||
|
case SYSTEM_SMS2:
|
||||||
|
{
|
||||||
|
z80_writeport = z80_ms_port_w;
|
||||||
|
z80_readport = z80_ms_port_r;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case SYSTEM_MARKIII:
|
||||||
|
{
|
||||||
|
z80_writeport = z80_m3_port_w;
|
||||||
|
z80_readport = z80_m3_port_r;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case SYSTEM_SG:
|
||||||
|
{
|
||||||
|
z80_writeport = z80_sg_port_w;
|
||||||
|
z80_readport = z80_sg_port_r;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gen_reset(int hard_reset)
|
void gen_reset(int hard_reset)
|
||||||
@ -175,20 +232,9 @@ void gen_reset(int hard_reset)
|
|||||||
/* 68k & Z80 could restart anywhere in VDP frame (Bonkers, Eternal Champions, X-Men 2) */
|
/* 68k & Z80 could restart anywhere in VDP frame (Bonkers, Eternal Champions, X-Men 2) */
|
||||||
mcycles_68k = mcycles_z80 = (uint32)((MCYCLES_PER_LINE * lines_per_frame) * ((double)rand() / (double)RAND_MAX));
|
mcycles_68k = mcycles_z80 = (uint32)((MCYCLES_PER_LINE * lines_per_frame) * ((double)rand() / (double)RAND_MAX));
|
||||||
|
|
||||||
if (system_hw == SYSTEM_PBC)
|
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||||
{
|
{
|
||||||
/* reset MS cartridge hardware */
|
/* reset cartridge hardware */
|
||||||
sms_cart_reset();
|
|
||||||
|
|
||||||
/* Z80 is running */
|
|
||||||
zstate = 1;
|
|
||||||
|
|
||||||
/* 68k is halted */
|
|
||||||
m68k_pulse_halt();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* reset MD cartridge hardware */
|
|
||||||
md_cart_reset(hard_reset);
|
md_cart_reset(hard_reset);
|
||||||
|
|
||||||
/* Z80 bus is released & Z80 is reseted */
|
/* Z80 bus is released & Z80 is reseted */
|
||||||
@ -233,6 +279,20 @@ void gen_reset(int hard_reset)
|
|||||||
/* reset 68k */
|
/* reset 68k */
|
||||||
m68k_pulse_reset();
|
m68k_pulse_reset();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Z80 cycles should a multiple of 15 to avoid rounding errors */
|
||||||
|
mcycles_z80 = (mcycles_z80 / 15) * 15;
|
||||||
|
|
||||||
|
/* reset cartridge hardware */
|
||||||
|
sms_cart_reset();
|
||||||
|
|
||||||
|
/* Z80 is running */
|
||||||
|
zstate = 1;
|
||||||
|
|
||||||
|
/* 68k is halted (/VRES is forced low) */
|
||||||
|
m68k_pulse_halt();
|
||||||
|
}
|
||||||
|
|
||||||
/* reset Z80 */
|
/* reset Z80 */
|
||||||
z80_reset();
|
z80_reset();
|
||||||
|
@ -2,22 +2,40 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Internal hardware & Bus controllers
|
* Internal hardware & Bus controllers
|
||||||
*
|
*
|
||||||
|
* Support for SG-1000, Mark-III, Master System, Game Gear & Mega Drive hardware
|
||||||
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
||||||
* Eke-Eke (2007-2011), additional code & fixes for the GCN/Wii port
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
@ -1,64 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
* aram.c
|
|
||||||
*
|
|
||||||
* ARAM wrapper for libogc
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* 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"
|
|
||||||
|
|
||||||
#define ARAMSTART 0x8000
|
|
||||||
#define ARAM_READ 1
|
|
||||||
#define ARAM_WRITE 0
|
|
||||||
|
|
||||||
/**
|
|
||||||
* StartARAM
|
|
||||||
* This simply sets up the call to internal libOGC.
|
|
||||||
* Passing NULL for array list, and 0 items to allocate.
|
|
||||||
* Required so libOGC knows to handle any interrupts etc.
|
|
||||||
*/
|
|
||||||
void StartARAM ()
|
|
||||||
{
|
|
||||||
AR_Init (NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ARAMPut
|
|
||||||
*
|
|
||||||
* Move data from MAIN memory to ARAM
|
|
||||||
*/
|
|
||||||
void ARAMPut (char *src, char *dst, int len)
|
|
||||||
{
|
|
||||||
DCFlushRange (src, len);
|
|
||||||
AR_StartDMA( ARAM_WRITE, (u32)src, (u32)dst, len);
|
|
||||||
while (AR_GetDMAStatus());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ARAMFetch
|
|
||||||
*
|
|
||||||
* This function will move data from ARAM to MAIN memory
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
ARAMFetch (char *dst, char *src, int len)
|
|
||||||
{
|
|
||||||
DCInvalidateRange(dst, len);
|
|
||||||
AR_StartDMA( ARAM_READ, (u32) dst, (u32) src, len);
|
|
||||||
while (AR_GetDMAStatus());
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
* aram.c
|
|
||||||
*
|
|
||||||
* ARAM wrapper for libogc
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* 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 _ARAM_H
|
|
||||||
#define _ARAM_H
|
|
||||||
|
|
||||||
extern void StartARAM ();
|
|
||||||
extern void ARAMFetch (char *src, char *dst, int len);
|
|
||||||
extern void ARAMPut (char *src, char *dst, int len);
|
|
||||||
|
|
||||||
#endif
|
|
@ -3,23 +3,40 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX configuration file support
|
* Genesis Plus GX configuration file support
|
||||||
*
|
*
|
||||||
* Eke-Eke (2008)
|
* Copyright Eke-Eke (2007-2011)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
@ -76,19 +93,20 @@ void config_default(void)
|
|||||||
config.fm_preamp = 100;
|
config.fm_preamp = 100;
|
||||||
config.hq_fm = 1;
|
config.hq_fm = 1;
|
||||||
config.psgBoostNoise = 0;
|
config.psgBoostNoise = 0;
|
||||||
config.filter = 1;
|
config.filter = 0;
|
||||||
config.lp_range = 50;
|
config.lp_range = 50;
|
||||||
config.low_freq = 880;
|
config.low_freq = 880;
|
||||||
config.high_freq = 5000;
|
config.high_freq = 5000;
|
||||||
config.lg = 1.0;
|
config.lg = 1.0;
|
||||||
config.mg = 1.0;
|
config.mg = 1.0;
|
||||||
config.hg = 1.0;
|
config.hg = 1.0;
|
||||||
config.rolloff = 0.995;
|
config.rolloff = 0.990;
|
||||||
config.dac_bits = 14;
|
config.dac_bits = 14;
|
||||||
config.ym2413_enabled = 1;
|
config.ym2413 = 2; /* AUTO */
|
||||||
|
|
||||||
/* system options */
|
/* system options */
|
||||||
config.region_detect = 0;
|
config.system = 0; /* AUTO */
|
||||||
|
config.region_detect = 0; /* AUTO */
|
||||||
config.force_dtack = 0;
|
config.force_dtack = 0;
|
||||||
config.addr_error = 1;
|
config.addr_error = 1;
|
||||||
config.tmss = 0;
|
config.tmss = 0;
|
||||||
@ -102,26 +120,21 @@ void config_default(void)
|
|||||||
config.xscale = 0;
|
config.xscale = 0;
|
||||||
config.yscale = 0;
|
config.yscale = 0;
|
||||||
config.aspect = 1;
|
config.aspect = 1;
|
||||||
config.overscan = 3;
|
config.overscan = 3; /* FULL */
|
||||||
config.ntsc = 0;
|
config.ntsc = 0;
|
||||||
if (VIDEO_HaveComponentCable())
|
if (VIDEO_HaveComponentCable())
|
||||||
{
|
{
|
||||||
config.render = 2;
|
config.render = 2;
|
||||||
config.bilinear = 1;
|
config.bilinear = 1;
|
||||||
#ifdef HW_RVL
|
|
||||||
config.trap = 1;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
config.render = 0;
|
config.render = 0;
|
||||||
config.bilinear = 0;
|
config.bilinear = 0;
|
||||||
#ifdef HW_RVL
|
|
||||||
config.trap = 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
|
config.trap = 0;
|
||||||
config.gamma = VI_GM_1_0 / 10.0;
|
config.gamma = VI_GM_1_0 / 10.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3,28 +3,44 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX configuration file support
|
* Genesis Plus GX configuration file support
|
||||||
*
|
*
|
||||||
* Eke-Eke (2008)
|
* Copyright Eke-Eke (2007-2011)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _CONFIG_H_
|
#ifndef _CONFIG_H_
|
||||||
#define _CONFIG_H_
|
#define _CONFIG_H_
|
||||||
|
|
||||||
#define CONFIG_VERSION "GENPLUS-GX 1.5.1"
|
#define CONFIG_VERSION "GENPLUS-GX 1.6.0"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Config Option
|
* Config Option
|
||||||
@ -37,7 +53,7 @@ typedef struct
|
|||||||
uint8 filter;
|
uint8 filter;
|
||||||
uint8 psgBoostNoise;
|
uint8 psgBoostNoise;
|
||||||
uint8 dac_bits;
|
uint8 dac_bits;
|
||||||
uint8 ym2413_enabled;
|
uint8 ym2413;
|
||||||
int16 psg_preamp;
|
int16 psg_preamp;
|
||||||
int16 fm_preamp;
|
int16 fm_preamp;
|
||||||
int16 lp_range;
|
int16 lp_range;
|
||||||
@ -47,6 +63,7 @@ typedef struct
|
|||||||
int16 mg;
|
int16 mg;
|
||||||
int16 hg;
|
int16 hg;
|
||||||
float rolloff;
|
float rolloff;
|
||||||
|
uint8 system;
|
||||||
uint8 region_detect;
|
uint8 region_detect;
|
||||||
uint8 force_dtack;
|
uint8 force_dtack;
|
||||||
uint8 addr_error;
|
uint8 addr_error;
|
||||||
|
@ -3,30 +3,46 @@
|
|||||||
*
|
*
|
||||||
* ROM File loading support
|
* ROM File loading support
|
||||||
*
|
*
|
||||||
* Eke-Eke (2010)
|
* Copyright Eke-Eke (2008-2011)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "file_load.h"
|
#include "file_load.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "history.h"
|
#include "history.h"
|
||||||
#include "unzip.h"
|
|
||||||
#include "filesel.h"
|
#include "filesel.h"
|
||||||
|
#include "file_slot.h"
|
||||||
|
|
||||||
#include <iso9660.h>
|
#include <iso9660.h>
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
@ -97,7 +113,7 @@ static int MountDVD(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* FileSortCallback (code by Marty Disibio)
|
* FileSortCallback (thanks to Marty Disibio)
|
||||||
*
|
*
|
||||||
* Quick sort callback to sort file entries with the following order:
|
* Quick sort callback to sort file entries with the following order:
|
||||||
* .
|
* .
|
||||||
@ -117,12 +133,22 @@ static int FileSortCallback(const void *f1, const void *f2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If one is a file and one is a directory the directory is first. */
|
/* If one is a file and one is a directory the directory is first. */
|
||||||
if(((FILEENTRIES *)f1)->flags == 1 && ((FILEENTRIES *)f2)->flags == 0) return -1;
|
if(((FILEENTRIES *)f1)->flags && !((FILEENTRIES *)f2)->flags) return -1;
|
||||||
if(((FILEENTRIES *)f1)->flags == 0 && ((FILEENTRIES *)f2)->flags == 1) return 1;
|
if(!((FILEENTRIES *)f1)->flags && ((FILEENTRIES *)f2)->flags) return 1;
|
||||||
|
|
||||||
return stricmp(((FILEENTRIES *)f1)->filename, ((FILEENTRIES *)f2)->filename);
|
return stricmp(((FILEENTRIES *)f1)->filename, ((FILEENTRIES *)f2)->filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* GetCurrentDirectory
|
||||||
|
*
|
||||||
|
* Return current browser directory
|
||||||
|
***************************************************************************/
|
||||||
|
char *GetCurrentDirectory(int selection)
|
||||||
|
{
|
||||||
|
return (deviceType == TYPE_RECENT) ? history.entries[selection].filepath : fileDir;
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* UpdateDirectory
|
* UpdateDirectory
|
||||||
*
|
*
|
||||||
@ -176,30 +202,36 @@ int UpdateDirectory(bool go_up, char *dirname)
|
|||||||
int ParseDirectory(void)
|
int ParseDirectory(void)
|
||||||
{
|
{
|
||||||
int nbfiles = 0;
|
int nbfiles = 0;
|
||||||
char filename[MAXPATHLEN];
|
|
||||||
struct stat filestat;
|
|
||||||
|
|
||||||
/* open directory */
|
/* open directory */
|
||||||
DIR_ITER *dir = diropen(fileDir);
|
DIR *dir = opendir(fileDir);
|
||||||
if (dir == NULL)
|
if (dir == NULL)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* list files */
|
struct dirent *entry = readdir(dir);
|
||||||
while ((dirnext(dir, filename, &filestat) == 0) && (nbfiles < MAXFILES))
|
|
||||||
|
/* list entries */
|
||||||
|
while ((entry != NULL)&& (nbfiles < MAXFILES))
|
||||||
{
|
{
|
||||||
if (filename[0] != '.')
|
if (entry->d_name[0] != '.')
|
||||||
{
|
{
|
||||||
memset(&filelist[nbfiles], 0, sizeof (FILEENTRIES));
|
memset(&filelist[nbfiles], 0, sizeof (FILEENTRIES));
|
||||||
sprintf(filelist[nbfiles].filename,"%s",filename);
|
sprintf(filelist[nbfiles].filename,"%s",entry->d_name);
|
||||||
filelist[nbfiles].flags = (filestat.st_mode & S_IFDIR) ? 1 : 0;
|
if (entry->d_type == DT_DIR)
|
||||||
|
{
|
||||||
|
filelist[nbfiles].flags = 1;
|
||||||
|
}
|
||||||
nbfiles++;
|
nbfiles++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* next entry */
|
||||||
|
entry = readdir(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* close directory */
|
/* close directory */
|
||||||
dirclose(dir);
|
closedir(dir);
|
||||||
|
|
||||||
/* Sort the file list */
|
/* Sort the file list */
|
||||||
qsort(filelist, nbfiles, sizeof(FILEENTRIES), FileSortCallback);
|
qsort(filelist, nbfiles, sizeof(FILEENTRIES), FileSortCallback);
|
||||||
@ -214,86 +246,32 @@ int ParseDirectory(void)
|
|||||||
* This functions return the actual size of data copied into the buffer
|
* This functions return the actual size of data copied into the buffer
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int LoadFile(u8 *buffer, u32 selection, char *filename)
|
int LoadFile(int selection)
|
||||||
{
|
{
|
||||||
char fname[MAXPATHLEN];
|
char filename[MAXPATHLEN];
|
||||||
char *filepath;
|
|
||||||
int done = 0;
|
|
||||||
struct stat filestat;
|
|
||||||
|
|
||||||
/* file path */
|
/* file path */
|
||||||
filepath = (deviceType == TYPE_RECENT) ? history.entries[selection].filepath : fileDir;
|
char *filepath = GetCurrentDirectory(selection);
|
||||||
|
|
||||||
/* full filename */
|
/* full filename */
|
||||||
sprintf(fname, "%s%s", filepath, filelist[selection].filename);
|
sprintf(filename, "%s%s", filepath, filelist[selection].filename);
|
||||||
|
|
||||||
/* retrieve file status */
|
/* DVD hot swap */
|
||||||
if(stat(fname, &filestat) != 0)
|
|
||||||
{
|
|
||||||
/* only DVD hot swap is supported */
|
|
||||||
if (!strncmp(filepath, rootdir[TYPE_DVD], strlen(rootdir[TYPE_DVD])))
|
if (!strncmp(filepath, rootdir[TYPE_DVD], strlen(rootdir[TYPE_DVD])))
|
||||||
{
|
{
|
||||||
/* mount DVD */
|
/* Check if file is still accessible */
|
||||||
|
struct stat filestat;
|
||||||
|
if(stat(filename, &filestat) != 0)
|
||||||
|
{
|
||||||
|
/* If not, try to mount DVD */
|
||||||
if (!MountDVD()) return 0;
|
if (!MountDVD()) return 0;
|
||||||
|
|
||||||
/* retrieve file status */
|
|
||||||
stat(fname, &filestat);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get file length */
|
/* try to load ROM file */
|
||||||
int length = filestat.st_size;
|
int size = load_rom(filename);
|
||||||
|
|
||||||
if (length > 0)
|
if (size > 0)
|
||||||
{
|
|
||||||
/* open file */
|
|
||||||
FILE *fd = fopen(fname, "rb");
|
|
||||||
if (!fd)
|
|
||||||
{
|
|
||||||
GUI_WaitPrompt("Error","Unable to open file !");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read first data chunk */
|
|
||||||
unsigned char temp[FILECHUNK];
|
|
||||||
fread(temp, FILECHUNK, 1, fd);
|
|
||||||
fseek(fd, 0, SEEK_SET);
|
|
||||||
|
|
||||||
/* Determine file type */
|
|
||||||
if (!IsZipFile ((char *) temp))
|
|
||||||
{
|
|
||||||
if (length > MAXROMSIZE)
|
|
||||||
{
|
|
||||||
GUI_WaitPrompt("Error","File is too large !");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read file */
|
|
||||||
sprintf((char *)temp,"Loading %d bytes ...", length);
|
|
||||||
GUI_MsgBoxOpen("Information", (char *)temp, 1);
|
|
||||||
while (length > FILECHUNK)
|
|
||||||
{
|
|
||||||
fread(buffer + done, FILECHUNK, 1, fd);
|
|
||||||
length -= FILECHUNK;
|
|
||||||
done += FILECHUNK;
|
|
||||||
}
|
|
||||||
fread(buffer + done, length, 1, fd);
|
|
||||||
done += length;
|
|
||||||
GUI_MsgBoxClose();
|
|
||||||
|
|
||||||
/* update ROM filename (with extension) */
|
|
||||||
sprintf(filename, "%s", filelist[selection].filename);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* unzip file */
|
|
||||||
done = UnZipBuffer(buffer, fd, filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* close file */
|
|
||||||
fclose(fd);
|
|
||||||
|
|
||||||
if (done)
|
|
||||||
{
|
{
|
||||||
/* add/move the file to the top of the history. */
|
/* add/move the file to the top of the history. */
|
||||||
history_add_file(filepath, filelist[selection].filename);
|
history_add_file(filepath, filelist[selection].filename);
|
||||||
@ -301,9 +279,41 @@ int LoadFile(u8 *buffer, u32 selection, char *filename)
|
|||||||
/* recent file list has changed */
|
/* recent file list has changed */
|
||||||
if (deviceType == TYPE_RECENT) deviceType = -1;
|
if (deviceType == TYPE_RECENT) deviceType = -1;
|
||||||
|
|
||||||
/* return loaded size */
|
/* auto-save previous game state */
|
||||||
return done;
|
if (config.s_auto & 2)
|
||||||
|
{
|
||||||
|
slot_autosave(config.s_default,config.s_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ROM pathname for screenshot, save & cheat files */
|
||||||
|
if (!strnicmp(".sms", &filename[strlen(filename) - 4], 4))
|
||||||
|
{
|
||||||
|
/* Master System ROM file */
|
||||||
|
sprintf(rom_filename,"ms/%s",filelist[selection].filename);
|
||||||
|
}
|
||||||
|
else if (!strnicmp(".gg", &filename[strlen(filename) - 3], 3))
|
||||||
|
{
|
||||||
|
/* Game Gear ROM file */
|
||||||
|
sprintf(rom_filename,"gg/%s",filelist[selection].filename);
|
||||||
|
}
|
||||||
|
else if (!strnicmp(".sg", &filename[strlen(filename) - 3], 3))
|
||||||
|
{
|
||||||
|
/* SG-1000 ROM file */
|
||||||
|
sprintf(rom_filename,"sg/%s",filelist[selection].filename);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* otherwise, it's Genesis ROM file */
|
||||||
|
sprintf(rom_filename,"md/%s",filelist[selection].filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* remove file extension */
|
||||||
|
int i = strlen(rom_filename) - 1;
|
||||||
|
while ((i > 0) && (rom_filename[i] != '.')) i--;
|
||||||
|
if (i > 0) rom_filename[i] = 0;
|
||||||
|
|
||||||
|
/* valid ROM has been loaded */
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -344,7 +354,7 @@ int OpenDirectory(int device)
|
|||||||
if (device == TYPE_DVD)
|
if (device == TYPE_DVD)
|
||||||
{
|
{
|
||||||
/* try to access root directory */
|
/* try to access root directory */
|
||||||
DIR_ITER *dir = diropen(rootdir[TYPE_DVD]);
|
DIR *dir = opendir(rootdir[TYPE_DVD]);
|
||||||
if (dir == NULL)
|
if (dir == NULL)
|
||||||
{
|
{
|
||||||
/* mount DVD */
|
/* mount DVD */
|
||||||
@ -353,7 +363,7 @@ int OpenDirectory(int device)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dirclose(dir);
|
closedir(dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,25 +1,41 @@
|
|||||||
/*
|
/*
|
||||||
* file_fat.c
|
* file_load.c
|
||||||
*
|
*
|
||||||
* FAT loading support
|
* ROM File loading support
|
||||||
*
|
*
|
||||||
* Eke-Eke (2008,2009)
|
* Copyright Eke-Eke (2008-2011)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _FILE_FAT_H
|
#ifndef _FILE_FAT_H
|
||||||
#define _FILE_FAT_H
|
#define _FILE_FAT_H
|
||||||
@ -34,11 +50,12 @@
|
|||||||
#endif
|
#endif
|
||||||
#define TYPE_RECENT (TYPE_DVD + 1)
|
#define TYPE_RECENT (TYPE_DVD + 1)
|
||||||
|
|
||||||
#define FILECHUNK (2048)
|
#define CHUNKSIZE (2048)
|
||||||
|
|
||||||
extern int OpenDirectory(int device);
|
extern int OpenDirectory(int device);
|
||||||
|
extern char *GetCurrentDirectory(int selection);
|
||||||
extern int UpdateDirectory(bool go_up, char *filename);
|
extern int UpdateDirectory(bool go_up, char *filename);
|
||||||
extern int ParseDirectory(void);
|
extern int ParseDirectory(void);
|
||||||
extern int LoadFile(u8* buffer,u32 selection, char *filename);
|
extern int LoadFile(int selection);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,24 +3,39 @@
|
|||||||
*
|
*
|
||||||
* FAT and Memory Card SRAM/State slots managment
|
* FAT and Memory Card SRAM/State slots managment
|
||||||
*
|
*
|
||||||
* Softdev (2006)
|
* Copyright Eke-Eke (2008-2011), based on original code from Softdev (2006)
|
||||||
* Eke-Eke (2007,2008,2009)
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "file_slot.h"
|
#include "file_slot.h"
|
||||||
@ -71,7 +86,7 @@ static int CardMount(int slot)
|
|||||||
|
|
||||||
void slot_autoload(int slot, int device)
|
void slot_autoload(int slot, int device)
|
||||||
{
|
{
|
||||||
if (!cart.romsize)
|
if (!strlen(rom_filename))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SILENT = 1;
|
SILENT = 1;
|
||||||
@ -81,7 +96,7 @@ void slot_autoload(int slot, int device)
|
|||||||
|
|
||||||
void slot_autosave(int slot, int device)
|
void slot_autosave(int slot, int device)
|
||||||
{
|
{
|
||||||
if (!cart.romsize)
|
if (!strlen(rom_filename))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* only save if SRAM changed */
|
/* only save if SRAM changed */
|
||||||
@ -183,7 +198,9 @@ int slot_delete(int slot, int device)
|
|||||||
sprintf (filename,"%s/saves/%s.gp%d", DEFAULT_PATH, rom_filename, slot - 1);
|
sprintf (filename,"%s/saves/%s.gp%d", DEFAULT_PATH, rom_filename, slot - 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sprintf (filename,"%s/saves/%s.srm", DEFAULT_PATH, rom_filename);
|
sprintf (filename,"%s/saves/%s.srm", DEFAULT_PATH, rom_filename);
|
||||||
|
}
|
||||||
|
|
||||||
/* Delete file */
|
/* Delete file */
|
||||||
ret = remove(filename);
|
ret = remove(filename);
|
||||||
@ -268,11 +285,11 @@ int slot_load(int slot, int device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Read into buffer (2k blocks) */
|
/* Read into buffer (2k blocks) */
|
||||||
while (filesize > FILECHUNK)
|
while (filesize > CHUNKSIZE)
|
||||||
{
|
{
|
||||||
fread(savebuffer + done, FILECHUNK, 1, fp);
|
fread(savebuffer + done, CHUNKSIZE, 1, fp);
|
||||||
done += FILECHUNK;
|
done += CHUNKSIZE;
|
||||||
filesize -= FILECHUNK;
|
filesize -= CHUNKSIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read remaining bytes */
|
/* Read remaining bytes */
|
||||||
@ -436,11 +453,11 @@ int slot_save(int slot, int device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Write from buffer (2k blocks) */
|
/* Write from buffer (2k blocks) */
|
||||||
while (filesize > FILECHUNK)
|
while (filesize > CHUNKSIZE)
|
||||||
{
|
{
|
||||||
fwrite(savebuffer + done, FILECHUNK, 1, fp);
|
fwrite(savebuffer + done, CHUNKSIZE, 1, fp);
|
||||||
done += FILECHUNK;
|
done += CHUNKSIZE;
|
||||||
filesize -= FILECHUNK;
|
filesize -= CHUNKSIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write remaining bytes */
|
/* Write remaining bytes */
|
||||||
|
@ -3,24 +3,39 @@
|
|||||||
*
|
*
|
||||||
* FAT and Memory Card SRAM/Savestate files managment
|
* FAT and Memory Card SRAM/Savestate files managment
|
||||||
*
|
*
|
||||||
* Softdev (2006)
|
* Copyright Eke-Eke (2008-2011), based on original code from Softdev (2006)
|
||||||
* Eke-Eke (2007,2008,2009)
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _FILE_SLOT_H
|
#ifndef _FILE_SLOT_H
|
||||||
#define _FILE_SLOT_H
|
#define _FILE_SLOT_H
|
||||||
|
265
source/gx/fileio/fileio.c
Normal file
265
source/gx/fileio/fileio.c
Normal file
@ -0,0 +1,265 @@
|
|||||||
|
/*
|
||||||
|
* fileio.c
|
||||||
|
*
|
||||||
|
* Load a normal file, or ZIP/GZ archive into ROM buffer.
|
||||||
|
* Returns loaded ROM size (zero if an error occured).
|
||||||
|
*
|
||||||
|
* Copyright Eke-Eke (2007-2011), based on original work from Softdev (2006)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#include "shared.h"
|
||||||
|
#include "file_load.h"
|
||||||
|
#include "gui.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Zip file header definition
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned int zipid __attribute__ ((__packed__)); // 0x04034b50
|
||||||
|
unsigned short zipversion __attribute__ ((__packed__));
|
||||||
|
unsigned short zipflags __attribute__ ((__packed__));
|
||||||
|
unsigned short compressionMethod __attribute__ ((__packed__));
|
||||||
|
unsigned short lastmodtime __attribute__ ((__packed__));
|
||||||
|
unsigned short lastmoddate __attribute__ ((__packed__));
|
||||||
|
unsigned int crc32 __attribute__ ((__packed__));
|
||||||
|
unsigned int compressedSize __attribute__ ((__packed__));
|
||||||
|
unsigned int uncompressedSize __attribute__ ((__packed__));
|
||||||
|
unsigned short filenameLength __attribute__ ((__packed__));
|
||||||
|
unsigned short extraDataLength __attribute__ ((__packed__));
|
||||||
|
} PKZIPHEADER;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Zip files are stored little endian
|
||||||
|
* Support functions for short and int types
|
||||||
|
*/
|
||||||
|
static inline u32 FLIP32 (u32 b)
|
||||||
|
{
|
||||||
|
unsigned int c;
|
||||||
|
c = (b & 0xff000000) >> 24;
|
||||||
|
c |= (b & 0xff0000) >> 8;
|
||||||
|
c |= (b & 0xff00) << 8;
|
||||||
|
c |= (b & 0xff) << 24;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline u16 FLIP16 (u16 b)
|
||||||
|
{
|
||||||
|
u16 c;
|
||||||
|
c = (b & 0xff00) >> 8;
|
||||||
|
c |= (b & 0xff) << 8;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
void get_zipfilename(char *filename)
|
||||||
|
{
|
||||||
|
char in[CHUNKSIZE];
|
||||||
|
|
||||||
|
/* Open file */
|
||||||
|
FILE *fd = fopen(filename, "rb");
|
||||||
|
if (!fd) return;
|
||||||
|
|
||||||
|
/* Read first 2 bytes */
|
||||||
|
fread(in, 2, 1, fd);
|
||||||
|
|
||||||
|
/* Detect Zip file */
|
||||||
|
if (memcmp(in, "PK", 2) == 0)
|
||||||
|
{
|
||||||
|
/* Read remaining header data */
|
||||||
|
fread(in + 2, sizeof(PKZIPHEADER) - 2, 1, fd);
|
||||||
|
|
||||||
|
/* Zip header pointer */
|
||||||
|
PKZIPHEADER *pkzip = (PKZIPHEADER *) in;
|
||||||
|
|
||||||
|
/* Return compressed file name */
|
||||||
|
int len = FLIP16(pkzip->filenameLength);
|
||||||
|
if (len >= MAXPATHLEN) len = MAXPATHLEN - 1;
|
||||||
|
fread(filename, len, 1, fd);
|
||||||
|
filename[len] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
int load_archive(char *filename)
|
||||||
|
{
|
||||||
|
int size = 0;
|
||||||
|
char in[CHUNKSIZE];
|
||||||
|
char msg[64];
|
||||||
|
|
||||||
|
/* ROM buffer should be allocated first ! */
|
||||||
|
unsigned char *buf = cart.rom;
|
||||||
|
|
||||||
|
/* Open file */
|
||||||
|
FILE *fd = fopen(filename, "rb");
|
||||||
|
if (!fd)
|
||||||
|
{
|
||||||
|
GUI_WaitPrompt("Error","Unable to open file !");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* clear existing patches before loading new ROM file */
|
||||||
|
ggenie_shutdown();
|
||||||
|
areplay_shutdown();
|
||||||
|
|
||||||
|
/* Read first chunk */
|
||||||
|
fread(in, CHUNKSIZE, 1, fd);
|
||||||
|
|
||||||
|
/* Detect Zip file */
|
||||||
|
if (memcmp(in, "PK", 2) == 0)
|
||||||
|
{
|
||||||
|
/* Inflate buffer */
|
||||||
|
char out[CHUNKSIZE];
|
||||||
|
|
||||||
|
/* PKZip header pointer */
|
||||||
|
PKZIPHEADER *pkzip = (PKZIPHEADER *) in;
|
||||||
|
|
||||||
|
/* Retrieve uncompressed ROM size */
|
||||||
|
size = FLIP32(pkzip->uncompressedSize);
|
||||||
|
|
||||||
|
/* Check ROM size */
|
||||||
|
if (size > MAXROMSIZE)
|
||||||
|
{
|
||||||
|
fclose(fd);
|
||||||
|
GUI_WaitPrompt("Error","File is too large !");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf (msg, "Unzipping %d bytes ...", size);
|
||||||
|
GUI_MsgBoxOpen("Information",msg,1);
|
||||||
|
|
||||||
|
/* Initialize zip stream */
|
||||||
|
z_stream zs;
|
||||||
|
memset (&zs, 0, sizeof (z_stream));
|
||||||
|
zs.zalloc = Z_NULL;
|
||||||
|
zs.zfree = Z_NULL;
|
||||||
|
zs.opaque = Z_NULL;
|
||||||
|
zs.avail_in = 0;
|
||||||
|
zs.next_in = Z_NULL;
|
||||||
|
int res = inflateInit2(&zs, -MAX_WBITS);
|
||||||
|
|
||||||
|
if (res != Z_OK)
|
||||||
|
{
|
||||||
|
fclose(fd);
|
||||||
|
GUI_WaitPrompt("Error","Unable to unzip file !");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initial Zip buffer offset */
|
||||||
|
int offset = sizeof (PKZIPHEADER) + FLIP16(pkzip->filenameLength) + FLIP16(pkzip->extraDataLength);
|
||||||
|
zs.next_in = (Bytef *)&in[offset];
|
||||||
|
|
||||||
|
/* Initial Zip remaining chunk size */
|
||||||
|
zs.avail_in = CHUNKSIZE - offset;
|
||||||
|
|
||||||
|
/* Get compressed file name */
|
||||||
|
offset = FLIP16(pkzip->filenameLength);
|
||||||
|
if (offset >= MAXPATHLEN) offset = MAXPATHLEN - 1;
|
||||||
|
strncpy(filename, &in[sizeof(PKZIPHEADER)], offset);
|
||||||
|
filename[offset] = 0;
|
||||||
|
|
||||||
|
/* Start unzipping file */
|
||||||
|
do
|
||||||
|
{
|
||||||
|
/* Inflate data until output buffer is empty */
|
||||||
|
do
|
||||||
|
{
|
||||||
|
zs.avail_out = CHUNKSIZE;
|
||||||
|
zs.next_out = (Bytef *) out;
|
||||||
|
res = inflate(&zs, Z_NO_FLUSH);
|
||||||
|
|
||||||
|
if (res == Z_MEM_ERROR)
|
||||||
|
{
|
||||||
|
inflateEnd(&zs);
|
||||||
|
fclose(fd);
|
||||||
|
GUI_WaitPrompt("Error","Unable to unzip file !");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
offset = CHUNKSIZE - zs.avail_out;
|
||||||
|
if (offset)
|
||||||
|
{
|
||||||
|
memcpy(buf, out, offset);
|
||||||
|
buf += offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (zs.avail_out == 0);
|
||||||
|
|
||||||
|
/* Read next chunk of zipped data */
|
||||||
|
fread(in, CHUNKSIZE, 1, fd);
|
||||||
|
zs.next_in = (Bytef *)&in[0];
|
||||||
|
zs.avail_in = CHUNKSIZE;
|
||||||
|
}
|
||||||
|
while (res != Z_STREAM_END);
|
||||||
|
inflateEnd (&zs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Get file size */
|
||||||
|
fseek(fd, 0, SEEK_END);
|
||||||
|
size = ftell(fd);
|
||||||
|
fseek(fd, 0, SEEK_SET);
|
||||||
|
|
||||||
|
/* Check file size */
|
||||||
|
if(size > MAXROMSIZE)
|
||||||
|
{
|
||||||
|
fclose(fd);
|
||||||
|
GUI_WaitPrompt("Error","File is too large !");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf((char *)msg,"Loading %d bytes ...", size);
|
||||||
|
GUI_MsgBoxOpen("Information", (char *)msg, 1);
|
||||||
|
|
||||||
|
/* Read into buffer */
|
||||||
|
int left = size;
|
||||||
|
while (left > CHUNKSIZE)
|
||||||
|
{
|
||||||
|
fread(buf, CHUNKSIZE, 1, fd);
|
||||||
|
buf += CHUNKSIZE;
|
||||||
|
left -= CHUNKSIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read remaining bytes */
|
||||||
|
fread(buf, left, 1, fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Close file */
|
||||||
|
fclose(fd);
|
||||||
|
|
||||||
|
/* Return loaded ROM size */
|
||||||
|
GUI_MsgBoxClose();
|
||||||
|
return size;
|
||||||
|
}
|
48
source/gx/fileio/fileio.h
Normal file
48
source/gx/fileio/fileio.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* fileio.c
|
||||||
|
*
|
||||||
|
* Load a normal file, or ZIP/GZ archive into ROM buffer.
|
||||||
|
* Returns loaded ROM size (zero if an error occured).
|
||||||
|
*
|
||||||
|
* Copyright Eke-Eke (2007-2011), based on original work from Softdev (2006)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _FILEIO_H_
|
||||||
|
#define _FILEIO_H_
|
||||||
|
|
||||||
|
/* Function prototypes */
|
||||||
|
void get_zipfilename(char *filename);
|
||||||
|
int load_archive(char *filename);
|
||||||
|
|
||||||
|
#endif /* _FILEIO_H_ */
|
@ -3,23 +3,39 @@
|
|||||||
*
|
*
|
||||||
* Generic ROM history list managment
|
* Generic ROM history list managment
|
||||||
*
|
*
|
||||||
* Martin Disibio (6/17/08)
|
* Copyright Eke-Eke (2008-2011), based on original code from Martin Disibio (2008)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "history.h"
|
#include "history.h"
|
||||||
|
@ -3,23 +3,39 @@
|
|||||||
*
|
*
|
||||||
* Generic ROM history list managment
|
* Generic ROM history list managment
|
||||||
*
|
*
|
||||||
* Martin Disibio (6/17/08)
|
* Copyright Eke-Eke (2008-2011), based on original code from Martin Disibio (2008)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _HISTORY_H
|
#ifndef _HISTORY_H
|
||||||
#define _HISTORY_H
|
#define _HISTORY_H
|
||||||
|
@ -3,24 +3,39 @@
|
|||||||
*
|
*
|
||||||
* Cheats menu
|
* Cheats menu
|
||||||
*
|
*
|
||||||
* Softdev (2006)
|
* Copyright Eke-Eke (2010-2011)
|
||||||
* Eke-Eke (2010)
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "cheats.h"
|
#include "cheats.h"
|
||||||
@ -34,7 +49,7 @@
|
|||||||
#define BG_COLOR_1 {0x49,0x49,0x49,0xff}
|
#define BG_COLOR_1 {0x49,0x49,0x49,0xff}
|
||||||
#define BG_COLOR_2 {0x66,0x66,0x66,0xff}
|
#define BG_COLOR_2 {0x66,0x66,0x66,0xff}
|
||||||
|
|
||||||
#define MAX_CHEATS (250)
|
#define MAX_CHEATS (150)
|
||||||
#define MAX_DESC_LENGTH (63)
|
#define MAX_DESC_LENGTH (63)
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
@ -54,23 +69,21 @@ typedef struct
|
|||||||
u16 data;
|
u16 data;
|
||||||
u16 old;
|
u16 old;
|
||||||
u32 address;
|
u32 address;
|
||||||
|
u8 *prev;
|
||||||
} CHEATENTRY;
|
} CHEATENTRY;
|
||||||
|
|
||||||
static u32 decode_cheat(char *string, u32 *address, u32 *data);
|
|
||||||
static void apply_cheats(void);
|
|
||||||
static void clear_cheats(void);
|
|
||||||
static void cheatmenu_cb(void);
|
|
||||||
static void switch_chars(void);
|
|
||||||
|
|
||||||
static int string_offset = 0;
|
static int string_offset = 0;
|
||||||
static int selection = 0;
|
static int selection = 0;
|
||||||
static int offset = 0;
|
static int offset = 0;
|
||||||
static int type = 0;
|
static int type = 0;
|
||||||
static int maxcheats = 0;
|
static int maxcheats = 0;
|
||||||
|
static int maxROMcheats = 0;
|
||||||
static int maxRAMcheats = 0;
|
static int maxRAMcheats = 0;
|
||||||
|
|
||||||
static CHEATENTRY cheatlist[MAX_CHEATS];
|
static CHEATENTRY cheatlist[MAX_CHEATS];
|
||||||
static u8 RAMcheatlist[MAX_CHEATS];
|
static u8 cheatIndexes[MAX_CHEATS];
|
||||||
|
|
||||||
|
static void cheatmenu_cb(void);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* GUI Buttons data */
|
/* GUI Buttons data */
|
||||||
@ -158,7 +171,7 @@ static gui_item items_cheats[30] =
|
|||||||
{NULL,NULL,"D","Add Character" ,486,274,40,40},
|
{NULL,NULL,"D","Add Character" ,486,274,40,40},
|
||||||
{NULL,NULL,"E","Add Character" ,532,274,40,40},
|
{NULL,NULL,"E","Add Character" ,532,274,40,40},
|
||||||
{NULL,NULL,"F","Add Character" ,578,274,40,40},
|
{NULL,NULL,"F","Add Character" ,578,274,40,40},
|
||||||
{NULL,NULL,"del","Delete Entry" ,440,338,40,40},
|
{NULL,NULL,"del","Backspace" ,440,338,40,40},
|
||||||
{NULL,NULL,":","Add Separator" ,486,338,40,40},
|
{NULL,NULL,":","Add Separator" ,486,338,40,40},
|
||||||
{NULL,NULL,"+","Next Characters",532,338,40,40},
|
{NULL,NULL,"+","Next Characters",532,338,40,40},
|
||||||
{NULL,NULL,"ok","Save Entry" ,578,338,40,40}
|
{NULL,NULL,"ok","Save Entry" ,578,338,40,40}
|
||||||
@ -221,18 +234,24 @@ static char ggvalidchars[] = "ABCDEFGHJKLMNPRSTVWXYZ0123456789";
|
|||||||
|
|
||||||
static char arvalidchars[] = "0123456789ABCDEF";
|
static char arvalidchars[] = "0123456789ABCDEF";
|
||||||
|
|
||||||
static u32 decode_cheat(char *string, u32 *address, u32 *data)
|
static u32 decode_cheat(char *string, int index)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
int i,n;
|
int i,n;
|
||||||
|
u32 len = 0;
|
||||||
|
u32 address = 0;
|
||||||
|
u16 data = 0;
|
||||||
|
u8 ref = 0;
|
||||||
|
|
||||||
/* reset address & data values */
|
/* 16-bit Game Genie code (ABCD-EFGH) */
|
||||||
*address = 0;
|
|
||||||
*data = 0;
|
|
||||||
|
|
||||||
/* Game Genie type code (XXXX-YYYY) */
|
|
||||||
if ((strlen(string) >= 9) && (string[4] == '-'))
|
if ((strlen(string) >= 9) && (string[4] == '-'))
|
||||||
{
|
{
|
||||||
|
/* 16-bit system only */
|
||||||
|
if ((system_hw & SYSTEM_PBC) != SYSTEM_MD)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
if (i == 4) string++;
|
if (i == 4) string++;
|
||||||
@ -243,79 +262,191 @@ static u32 decode_cheat(char *string, u32 *address, u32 *data)
|
|||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
*data |= n << 3;
|
data |= n << 3;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
*data |= n >> 2;
|
data |= n >> 2;
|
||||||
*address |= (n & 3) << 14;
|
address |= (n & 3) << 14;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
*address |= n << 9;
|
address |= n << 9;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
*address |= (n & 0xF) << 20 | (n >> 4) << 8;
|
address |= (n & 0xF) << 20 | (n >> 4) << 8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
*data |= (n & 1) << 12;
|
data |= (n & 1) << 12;
|
||||||
*address |= (n >> 1) << 16;
|
address |= (n >> 1) << 16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
*data |= (n & 1) << 15 | (n >> 1) << 8;
|
data |= (n & 1) << 15 | (n >> 1) << 8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
*data |= (n >> 3) << 13;
|
data |= (n >> 3) << 13;
|
||||||
*address |= (n & 7) << 5;
|
address |= (n & 7) << 5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
*address |= n;
|
address |= n;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return code length */
|
/* code length */
|
||||||
return 9;
|
len = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Action Replay type code (AAAAAA:DDDD) */
|
/* 8-bit Game Genie code (DDA-AAA-XXX) */
|
||||||
else if ((strlen(string) >= 11) && (string[6] == ':'))
|
else if ((strlen(string) >= 11) && (string[3] == '-') && (string[7] == '-'))
|
||||||
{
|
{
|
||||||
/* decode address */
|
/* 8-bit system only */
|
||||||
|
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* decode 8-bit data */
|
||||||
|
for (i=0; i<2; i++)
|
||||||
|
{
|
||||||
|
p = strchr (arvalidchars, *string++);
|
||||||
|
if (p == NULL) return 0;
|
||||||
|
n = (p - arvalidchars) & 0xF;
|
||||||
|
data |= (n << ((1 - i) * 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* decode 16-bit address (low 12-bits) */
|
||||||
|
for (i=0; i<3; i++)
|
||||||
|
{
|
||||||
|
if (i==1) string++; /* skip separator */
|
||||||
|
p = strchr (arvalidchars, *string++);
|
||||||
|
if (p == NULL) return 0;
|
||||||
|
n = (p - arvalidchars) & 0xF;
|
||||||
|
address |= (n << ((2 - i) * 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* decode 16-bit address (high 4-bits) */
|
||||||
|
p = strchr (arvalidchars, *string++);
|
||||||
|
if (p == NULL) return 0;
|
||||||
|
n = (p - arvalidchars) & 0xF;
|
||||||
|
n ^= 0xF; /* bits inversion */
|
||||||
|
address |= (n << 12);
|
||||||
|
|
||||||
|
/* RAM address are also supported */
|
||||||
|
if (address >= 0xC000)
|
||||||
|
{
|
||||||
|
/* convert to 24-bit Work RAM address */
|
||||||
|
address = 0xFF0000 | (address & 0x1FFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* decode reference 8-bit data */
|
||||||
|
for (i=0; i<2; i++)
|
||||||
|
{
|
||||||
|
string++; /* skip separator and 2nd digit */
|
||||||
|
p = strchr (arvalidchars, *string++);
|
||||||
|
if (p == NULL) return 0;
|
||||||
|
n = (p - arvalidchars) & 0xF;
|
||||||
|
ref |= (n << ((1 - i) * 4));
|
||||||
|
}
|
||||||
|
ref = (ref >> 2) | ((ref & 0x03) << 6); /* 2-bit right rotation */
|
||||||
|
ref ^= 0xBA; /* XOR */
|
||||||
|
|
||||||
|
/* update old data value */
|
||||||
|
cheatlist[index].old = ref;
|
||||||
|
|
||||||
|
/* code length */
|
||||||
|
len = 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Action Replay code */
|
||||||
|
else if (string[6] == ':')
|
||||||
|
{
|
||||||
|
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||||
|
{
|
||||||
|
/* 16-bit code (AAAAAA:DDDD) */
|
||||||
|
if (strlen(string) < 11) return 0;
|
||||||
|
|
||||||
|
/* decode 24-bit address */
|
||||||
for (i=0; i<6; i++)
|
for (i=0; i<6; i++)
|
||||||
{
|
{
|
||||||
p = strchr (arvalidchars, *string++);
|
p = strchr (arvalidchars, *string++);
|
||||||
if (p == NULL) return 0;
|
if (p == NULL) return 0;
|
||||||
n = (p - arvalidchars) & 15;
|
n = (p - arvalidchars) & 0xF;
|
||||||
*address |= (n << ((5 - i) * 4));
|
address |= (n << ((5 - i) * 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* decode data */
|
/* decode 16-bit data */
|
||||||
string++;
|
string++;
|
||||||
for (i=0; i<4; i++)
|
for (i=0; i<4; i++)
|
||||||
{
|
{
|
||||||
p = strchr (arvalidchars, *string++);
|
p = strchr (arvalidchars, *string++);
|
||||||
if (p == NULL) return 0;
|
if (p == NULL) return 0;
|
||||||
n = p - arvalidchars;
|
n = (p - arvalidchars) & 0xF;
|
||||||
*data |= (n & 15) << ((3 - i) * 4);
|
data |= (n << ((3 - i) * 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return code length */
|
/* code length */
|
||||||
return 11;
|
len = 11;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* 8-bit code (xxAAAA:DD) */
|
||||||
|
if (strlen(string) < 9) return 0;
|
||||||
|
|
||||||
|
/* decode 16-bit address */
|
||||||
|
string+=2;
|
||||||
|
for (i=0; i<4; i++)
|
||||||
|
{
|
||||||
|
p = strchr (arvalidchars, *string++);
|
||||||
|
if (p == NULL) return 0;
|
||||||
|
n = (p - arvalidchars) & 0xF;
|
||||||
|
address |= (n << ((3 - i) * 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
/* ROM addresses are not supported */
|
||||||
|
if (address < 0xC000) return 0;
|
||||||
|
|
||||||
|
/* convert to 24-bit Work RAM address */
|
||||||
|
address = 0xFF0000 | (address & 0x1FFF);
|
||||||
|
|
||||||
|
/* decode 8-bit data */
|
||||||
|
string++;
|
||||||
|
for (i=0; i<2; i++)
|
||||||
|
{
|
||||||
|
p = strchr (arvalidchars, *string++);
|
||||||
|
if (p == NULL) return 0;
|
||||||
|
n = (p - arvalidchars) & 0xF;
|
||||||
|
data |= (n << ((1 - i) * 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* code length */
|
||||||
|
len = 9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Valid code found ? */
|
||||||
|
if (len)
|
||||||
|
{
|
||||||
|
/* update cheat address & data values */
|
||||||
|
cheatlist[index].address = address;
|
||||||
|
cheatlist[index].data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* return code length (0 = invalid) */
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void apply_cheats(void)
|
static void apply_cheats(void)
|
||||||
{
|
{
|
||||||
/* clear RAM patches counter */
|
u8 *ptr;
|
||||||
maxRAMcheats = 0;
|
|
||||||
|
/* clear ROM&RAM patches counter */
|
||||||
|
maxROMcheats = maxRAMcheats = 0;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < maxcheats; i++)
|
for (i = 0; i < maxcheats; i++)
|
||||||
@ -323,15 +454,42 @@ static void apply_cheats(void)
|
|||||||
if (cheatlist[i].enable)
|
if (cheatlist[i].enable)
|
||||||
{
|
{
|
||||||
if (cheatlist[i].address < cart.romsize)
|
if (cheatlist[i].address < cart.romsize)
|
||||||
|
{
|
||||||
|
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||||
{
|
{
|
||||||
/* patch ROM data */
|
/* patch ROM data */
|
||||||
cheatlist[i].old = *(u16 *)(cart.rom + (cheatlist[i].address & 0xFFFFFE));
|
cheatlist[i].old = *(u16 *)(cart.rom + (cheatlist[i].address & 0xFFFFFE));
|
||||||
*(u16 *)(cart.rom + (cheatlist[i].address & 0xFFFFFE)) = cheatlist[i].data;
|
*(u16 *)(cart.rom + (cheatlist[i].address & 0xFFFFFE)) = cheatlist[i].data;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* add ROM patch */
|
||||||
|
maxROMcheats++;
|
||||||
|
cheatIndexes[MAX_CHEATS - maxROMcheats] = i;
|
||||||
|
|
||||||
|
/* get current banked ROM address */
|
||||||
|
ptr = &z80_readmap[(cheatlist[i].address) >> 10][cheatlist[i].address & 0x03FF];
|
||||||
|
|
||||||
|
/* check if reference matches original ROM data */
|
||||||
|
if (((u8)cheatlist[i].old) == *ptr)
|
||||||
|
{
|
||||||
|
/* patch data */
|
||||||
|
*ptr = cheatlist[i].data;
|
||||||
|
|
||||||
|
/* save patched ROM address */
|
||||||
|
cheatlist[i].prev = ptr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* no patched ROM address yet */
|
||||||
|
cheatlist[i].prev = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (cheatlist[i].address >= 0xFF0000)
|
else if (cheatlist[i].address >= 0xFF0000)
|
||||||
{
|
{
|
||||||
/* patch RAM data */
|
/* add RAM patch */
|
||||||
RAMcheatlist[maxRAMcheats++] = i;
|
cheatIndexes[maxRAMcheats++] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -344,11 +502,29 @@ static void clear_cheats(void)
|
|||||||
/* disable cheats in reversed order in case the same address is used by multiple patches */
|
/* disable cheats in reversed order in case the same address is used by multiple patches */
|
||||||
while (i > 0)
|
while (i > 0)
|
||||||
{
|
{
|
||||||
/* restore original ROM data */
|
if (cheatlist[i-1].enable)
|
||||||
if (cheatlist[i-1].enable && (cheatlist[i-1].address < cart.romsize))
|
|
||||||
{
|
{
|
||||||
|
if (cheatlist[i-1].address < cart.romsize)
|
||||||
|
{
|
||||||
|
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||||
|
{
|
||||||
|
/* restore original ROM data */
|
||||||
*(u16 *)(cart.rom + (cheatlist[i-1].address & 0xFFFFFE)) = cheatlist[i-1].old;
|
*(u16 *)(cart.rom + (cheatlist[i-1].address & 0xFFFFFE)) = cheatlist[i-1].old;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* check if previous banked ROM address has been patched */
|
||||||
|
if (cheatlist[i-1].prev != NULL)
|
||||||
|
{
|
||||||
|
/* restore original data */
|
||||||
|
*cheatlist[i-1].prev = cheatlist[i-1].old;
|
||||||
|
|
||||||
|
/* no more patched ROM address */
|
||||||
|
cheatlist[i-1].prev = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
@ -646,7 +822,6 @@ void CheatMenu(void)
|
|||||||
int max = 0;
|
int max = 0;
|
||||||
char temp[256];
|
char temp[256];
|
||||||
char *str = NULL;
|
char *str = NULL;
|
||||||
u32 address, data;
|
|
||||||
gui_menu *m = &menu_cheats;
|
gui_menu *m = &menu_cheats;
|
||||||
|
|
||||||
/* clear existing ROM patches */
|
/* clear existing ROM patches */
|
||||||
@ -720,14 +895,6 @@ void CheatMenu(void)
|
|||||||
/* update menu */
|
/* update menu */
|
||||||
update = GUI_UpdateMenu(m);
|
update = GUI_UpdateMenu(m);
|
||||||
|
|
||||||
/* save offset then restore default */
|
|
||||||
if (!(menu_cheats.bg_images[6].state & IMAGE_VISIBLE))
|
|
||||||
{
|
|
||||||
offset = m->offset;
|
|
||||||
m->offset = 0;
|
|
||||||
m->max_items = m->max_buttons = 30;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* update selected cheat */
|
/* update selected cheat */
|
||||||
if ((m->selected < 10) && (selection != m->selected))
|
if ((m->selected < 10) && (selection != m->selected))
|
||||||
{
|
{
|
||||||
@ -735,6 +902,15 @@ void CheatMenu(void)
|
|||||||
string_offset = 0;
|
string_offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* save offset then restore default */
|
||||||
|
if (!(m->bg_images[6].state & IMAGE_VISIBLE))
|
||||||
|
{
|
||||||
|
offset = m->offset;
|
||||||
|
m->offset = 0;
|
||||||
|
m->max_items = m->max_buttons = 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* handle pressed buttons */
|
/* handle pressed buttons */
|
||||||
if (update > 0)
|
if (update > 0)
|
||||||
{
|
{
|
||||||
@ -786,16 +962,32 @@ void CheatMenu(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* code type */
|
/* code type */
|
||||||
if (str[4] == '-')
|
if (str[6] == ':')
|
||||||
{
|
{
|
||||||
/* GG code */
|
/* Action Replay code */
|
||||||
|
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||||
|
{
|
||||||
|
/* 16-bit code */
|
||||||
|
max = 10;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* 8-bit code */
|
||||||
|
max = 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (str[4] == '-')
|
||||||
|
{
|
||||||
|
/* 16-bit Game Genie code */
|
||||||
max = 8;
|
max = 8;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* AR code */
|
/* 8-bit Game Genie code */
|
||||||
max = 10;
|
max = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set cursor to end of code */
|
||||||
digit_cnt = max + 1;
|
digit_cnt = max + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -843,9 +1035,12 @@ void CheatMenu(void)
|
|||||||
/* code separator is being deleted */
|
/* code separator is being deleted */
|
||||||
if ((str[digit_cnt] == ':') || (str[digit_cnt] == '-'))
|
if ((str[digit_cnt] == ':') || (str[digit_cnt] == '-'))
|
||||||
{
|
{
|
||||||
/* reset detected code type */
|
/* reset detected code type (except 8-bit Game Genie code using 2 separators) */
|
||||||
|
if (((system_hw & SYSTEM_PBC) == SYSTEM_MD) || (digit_cnt != 7))
|
||||||
|
{
|
||||||
max = 0;
|
max = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* edit mark */
|
/* edit mark */
|
||||||
str[digit_cnt] = '*';
|
str[digit_cnt] = '*';
|
||||||
@ -874,28 +1069,56 @@ void CheatMenu(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Separator character (only if code type has not yet been determined) */
|
/* Separator character */
|
||||||
if (max == 0)
|
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||||
{
|
{
|
||||||
|
/* 16-bit codes */
|
||||||
if (digit_cnt == 4)
|
if (digit_cnt == 4)
|
||||||
{
|
{
|
||||||
/* GG code */
|
/* Game Genie code */
|
||||||
max = 8;
|
max = 8;
|
||||||
str[4] = '-';
|
str[4] = '-';
|
||||||
str[5] = '*';
|
|
||||||
str[6] = 0;
|
|
||||||
digit_cnt++;
|
|
||||||
}
|
}
|
||||||
else if (digit_cnt == 6)
|
else if ((digit_cnt == 6) && (max != 8))
|
||||||
{
|
{
|
||||||
/* AR code */
|
/* Action Replay code */
|
||||||
max = 10;
|
max = 10;
|
||||||
str[6] = ':';
|
str[6] = ':';
|
||||||
str[7] = '*';
|
}
|
||||||
str[8] = 0;
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* 8-bit codes */
|
||||||
|
if (digit_cnt == 3)
|
||||||
|
{
|
||||||
|
/* Game Genie code */
|
||||||
|
max = 10;
|
||||||
|
str[3] = '-';
|
||||||
|
}
|
||||||
|
else if ((digit_cnt == 7) && (max == 10))
|
||||||
|
{
|
||||||
|
/* Game Genie code (last part) */
|
||||||
|
str[7] = '-';
|
||||||
|
}
|
||||||
|
else if ((digit_cnt == 6) && (max != 10))
|
||||||
|
{
|
||||||
|
/* Action Replay code */
|
||||||
|
max = 8;
|
||||||
|
str[6] = ':';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
digit_cnt++;
|
digit_cnt++;
|
||||||
}
|
str[digit_cnt] = '*';
|
||||||
}
|
str[digit_cnt+1] = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -918,13 +1141,8 @@ void CheatMenu(void)
|
|||||||
}
|
}
|
||||||
else if (max && (digit_cnt > max))
|
else if (max && (digit_cnt > max))
|
||||||
{
|
{
|
||||||
address = data = 0;
|
if (decode_cheat(cheatlist[offset + selection].code, offset + selection))
|
||||||
if (decode_cheat(cheatlist[offset + selection].code, &address, &data))
|
|
||||||
{
|
{
|
||||||
/* update cheat address & data values */
|
|
||||||
cheatlist[offset + selection].address = address;
|
|
||||||
cheatlist[offset + selection].data = data;
|
|
||||||
|
|
||||||
/* new cheat ? */
|
/* new cheat ? */
|
||||||
if ((offset + selection) == maxcheats)
|
if ((offset + selection) == maxcheats)
|
||||||
{
|
{
|
||||||
@ -954,6 +1172,9 @@ void CheatMenu(void)
|
|||||||
/* force code separator if none has been set yet */
|
/* force code separator if none has been set yet */
|
||||||
if ((max == 0) && (digit_cnt == 6)) break;
|
if ((max == 0) && (digit_cnt == 6)) break;
|
||||||
|
|
||||||
|
/* force 8-bit Game Genie code last separator */
|
||||||
|
if (((system_hw & SYSTEM_PBC) != SYSTEM_MD) && (max == 10) && (digit_cnt == 7)) break;
|
||||||
|
|
||||||
/* add character */
|
/* add character */
|
||||||
if ((digit_cnt <= max) || (max == 0))
|
if ((digit_cnt <= max) || (max == 0))
|
||||||
{
|
{
|
||||||
@ -1136,7 +1357,6 @@ void CheatLoad(void)
|
|||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
u32 address, data;
|
|
||||||
char temp[256];
|
char temp[256];
|
||||||
|
|
||||||
/* reset cheat count */
|
/* reset cheat count */
|
||||||
@ -1160,15 +1380,10 @@ void CheatLoad(void)
|
|||||||
else temp[strlen(temp) - 1] = 0;
|
else temp[strlen(temp) - 1] = 0;
|
||||||
|
|
||||||
/* check cheat validty */
|
/* check cheat validty */
|
||||||
address = data = 0;
|
len = decode_cheat(temp, maxcheats);
|
||||||
len = decode_cheat(temp, &address, &data);
|
|
||||||
|
|
||||||
if (len)
|
if (len)
|
||||||
{
|
{
|
||||||
/* update cheat address & data values */
|
|
||||||
cheatlist[maxcheats].address = address;
|
|
||||||
cheatlist[maxcheats].data = data;
|
|
||||||
|
|
||||||
/* copy cheat code */
|
/* copy cheat code */
|
||||||
strncpy(cheatlist[maxcheats].code, temp, len);
|
strncpy(cheatlist[maxcheats].code, temp, len);
|
||||||
cheatlist[maxcheats].code[len] = 0;
|
cheatlist[maxcheats].code[len] = 0;
|
||||||
@ -1231,19 +1446,19 @@ void CheatLoad(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* CheatUpdate
|
* RAMCheatUpdate
|
||||||
*
|
*
|
||||||
* Apply RAM patches
|
* Apply RAM patches (this should be called once per frame)
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void CheatUpdate(void)
|
void RAMCheatUpdate(void)
|
||||||
{
|
{
|
||||||
int index, cnt = maxRAMcheats;
|
int index, cnt = maxRAMcheats;
|
||||||
|
|
||||||
while (cnt)
|
while (cnt)
|
||||||
{
|
{
|
||||||
/* get cheat index */
|
/* get cheat index */
|
||||||
index = RAMcheatlist[--cnt];
|
index = cheatIndexes[--cnt];
|
||||||
|
|
||||||
/* apply RAM patch */
|
/* apply RAM patch */
|
||||||
if (cheatlist[index].data & 0xFF00)
|
if (cheatlist[index].data & 0xFF00)
|
||||||
@ -1258,3 +1473,48 @@ void CheatUpdate(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* ROMCheatUpdate
|
||||||
|
*
|
||||||
|
* Apply ROM patches (this should be called each time banking is changed)
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
void ROMCheatUpdate(void)
|
||||||
|
{
|
||||||
|
int index, cnt = maxROMcheats;
|
||||||
|
u8 *ptr;
|
||||||
|
|
||||||
|
while (cnt)
|
||||||
|
{
|
||||||
|
/* get cheat index */
|
||||||
|
index = cheatIndexes[MAX_CHEATS - cnt];
|
||||||
|
|
||||||
|
/* check if previous banked ROM address was patched */
|
||||||
|
if (cheatlist[index].prev != NULL)
|
||||||
|
{
|
||||||
|
/* restore original data */
|
||||||
|
*cheatlist[index].prev = cheatlist[index].old;
|
||||||
|
|
||||||
|
/* no more patched ROM address */
|
||||||
|
cheatlist[index].prev = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get current banked ROM address */
|
||||||
|
ptr = &z80_readmap[(cheatlist[index].address) >> 10][cheatlist[index].address & 0x03FF];
|
||||||
|
|
||||||
|
/* check if reference matches original ROM data */
|
||||||
|
if (((u8)cheatlist[index].old) == *ptr)
|
||||||
|
{
|
||||||
|
/* patch data */
|
||||||
|
*ptr = cheatlist[index].data;
|
||||||
|
|
||||||
|
/* save patched ROM address */
|
||||||
|
cheatlist[index].prev = ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* next ROM patch */
|
||||||
|
cnt--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -3,30 +3,46 @@
|
|||||||
*
|
*
|
||||||
* Cheats menu
|
* Cheats menu
|
||||||
*
|
*
|
||||||
* Softdev (2006)
|
* Copyright Eke-Eke (2010-2011)
|
||||||
* Eke-Eke (2010)
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _CHEATS_H
|
#ifndef _CHEATS_H
|
||||||
#define _CHEATS_H
|
#define _CHEATS_H
|
||||||
|
|
||||||
extern void CheatMenu(void);
|
extern void CheatMenu(void);
|
||||||
extern void CheatLoad(void);
|
extern void CheatLoad(void);
|
||||||
extern void CheatUpdate(void);
|
extern void RAMCheatUpdate(void);
|
||||||
|
extern void ROMCheatUpdate(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,30 +3,45 @@
|
|||||||
*
|
*
|
||||||
* ROM File Browser
|
* ROM File Browser
|
||||||
*
|
*
|
||||||
* Eke-Eke (2009,2010)
|
* Copyright Eke-Eke (2009-2011)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "filesel.h"
|
#include "filesel.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "file_load.h"
|
#include "file_load.h"
|
||||||
#include "file_slot.h"
|
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
@ -35,6 +50,8 @@
|
|||||||
#define BG_COLOR_1 {0x49,0x49,0x49,0xff}
|
#define BG_COLOR_1 {0x49,0x49,0x49,0xff}
|
||||||
#define BG_COLOR_2 {0x66,0x66,0x66,0xff}
|
#define BG_COLOR_2 {0x66,0x66,0x66,0xff}
|
||||||
|
|
||||||
|
#define SCROLL_SPEED 10
|
||||||
|
|
||||||
extern const u8 Browser_dir_png[];
|
extern const u8 Browser_dir_png[];
|
||||||
extern const u8 Snap_empty_png[];
|
extern const u8 Snap_empty_png[];
|
||||||
extern const u8 Snap_frame_png[];
|
extern const u8 Snap_frame_png[];
|
||||||
@ -160,15 +177,15 @@ static void selector_cb(void)
|
|||||||
gxDrawTexture(bar_over.texture,bar_over.x,yoffset+bar_over.y,bar_over.w,bar_over.h,255);
|
gxDrawTexture(bar_over.texture,bar_over.x,yoffset+bar_over.y,bar_over.w,bar_over.h,255);
|
||||||
|
|
||||||
/* scrolling text */
|
/* scrolling text */
|
||||||
if ((string_offset/10) >= strlen(filelist[i].filename))
|
if ((string_offset/SCROLL_SPEED) >= strlen(filelist[i].filename))
|
||||||
{
|
{
|
||||||
string_offset = 0;
|
string_offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string_offset)
|
if (string_offset)
|
||||||
{
|
{
|
||||||
sprintf(text,"%s ",filelist[i].filename+string_offset/10);
|
sprintf(text,"%s ",filelist[i].filename+string_offset/SCROLL_SPEED);
|
||||||
strncat(text, filelist[i].filename, string_offset/10);
|
strncat(text, filelist[i].filename, string_offset/SCROLL_SPEED);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -182,7 +199,7 @@ static void selector_cb(void)
|
|||||||
gxDrawTexture(dir_icon.texture,dir_icon.x,yoffset+dir_icon.y,dir_icon.w,dir_icon.h,255);
|
gxDrawTexture(dir_icon.texture,dir_icon.x,yoffset+dir_icon.y,dir_icon.w,dir_icon.h,255);
|
||||||
if (FONT_write(text,18,dir_icon.x+dir_icon.w+6,yoffset+22,bar_over.w-dir_icon.w-26,(GXColor)WHITE))
|
if (FONT_write(text,18,dir_icon.x+dir_icon.w+6,yoffset+22,bar_over.w-dir_icon.w-26,(GXColor)WHITE))
|
||||||
{
|
{
|
||||||
/* string is too large -> scroll text */
|
/* text scrolling */
|
||||||
string_offset ++;
|
string_offset ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,11 +245,9 @@ int FileSelector(void)
|
|||||||
{
|
{
|
||||||
short p;
|
short p;
|
||||||
int i;
|
int i;
|
||||||
int size = 0;
|
|
||||||
int old = -1;
|
int old = -1;
|
||||||
char fname[MAXPATHLEN];
|
char fname[MAXPATHLEN];
|
||||||
char text[MAXPATHLEN];
|
FILE *snap;
|
||||||
FILE *xml,*snap;
|
|
||||||
gui_menu *m = &menu_selector;
|
gui_menu *m = &menu_selector;
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
@ -279,39 +294,74 @@ int FileSelector(void)
|
|||||||
/* ROM file snapshot/database */
|
/* ROM file snapshot/database */
|
||||||
if (old != selection)
|
if (old != selection)
|
||||||
{
|
{
|
||||||
|
/* close any existing texture first */
|
||||||
|
gxTextureClose(&bg_filesel[8].texture);
|
||||||
|
bg_filesel[8].state &= ~IMAGE_VISIBLE;
|
||||||
|
|
||||||
old = selection;
|
old = selection;
|
||||||
string_offset = 0;
|
string_offset = 0;
|
||||||
|
|
||||||
/* delete previous texture if any */
|
|
||||||
gxTextureClose(&bg_filesel[8].texture);
|
|
||||||
bg_filesel[8].state &= ~IMAGE_VISIBLE;
|
|
||||||
bg_filesel[6].state &= ~IMAGE_VISIBLE;
|
|
||||||
|
|
||||||
if (!filelist[selection].flags)
|
if (!filelist[selection].flags)
|
||||||
{
|
{
|
||||||
/* get ROM filename without extension */
|
/* get compressed file name */
|
||||||
sprintf (text, "%s", filelist[selection].filename);
|
sprintf(fname, "%s/%s", GetCurrentDirectory(selection), filelist[selection].filename);
|
||||||
int i = strlen(text) - 1;
|
get_zipfilename(fname);
|
||||||
while ((i > 0) && (text[i] != '.')) i--;
|
|
||||||
if (i > 0) text[i] = 0;
|
|
||||||
|
|
||||||
/* ROM database informations */
|
/* auto-detect file type */
|
||||||
sprintf (fname, "%s/db/%s.xml", DEFAULT_PATH, text);
|
if (!strnicmp(".sms", &fname[strlen(fname) - 4], 4))
|
||||||
xml = fopen(fname, "rb");
|
|
||||||
if (xml)
|
|
||||||
{
|
{
|
||||||
bg_filesel[6].state |= IMAGE_VISIBLE;
|
/* Master System ROM file */
|
||||||
fclose(xml); /* TODO */
|
sprintf(fname, "%s/snaps/ms/%s", DEFAULT_PATH, filelist[selection].filename);
|
||||||
|
}
|
||||||
|
else if (!strnicmp(".gg", &fname[strlen(fname) - 3], 3))
|
||||||
|
{
|
||||||
|
/* Game Gear ROM file */
|
||||||
|
sprintf(fname, "%s/snaps/gg/%s", DEFAULT_PATH, filelist[selection].filename);
|
||||||
|
}
|
||||||
|
else if (!strnicmp(".sg", &fname[strlen(fname) - 3], 3))
|
||||||
|
{
|
||||||
|
/* SG-1000 ROM file */
|
||||||
|
sprintf(fname, "%s/snaps/sg/%s", DEFAULT_PATH, filelist[selection].filename);
|
||||||
|
}
|
||||||
|
else if ((!strnicmp(".md", &fname[strlen(fname) - 3], 3)) ||
|
||||||
|
(!strnicmp(".gen", &fname[strlen(fname) - 4], 4)) ||
|
||||||
|
(!strnicmp(".bin", &fname[strlen(fname) - 4], 4)) ||
|
||||||
|
(!strnicmp(".mdx", &fname[strlen(fname) - 4], 4)) ||
|
||||||
|
(!strnicmp(".smd", &fname[strlen(fname) - 4], 4)))
|
||||||
|
{
|
||||||
|
/* Genesis ROM file */
|
||||||
|
sprintf(fname, "%s/snaps/md/%s", DEFAULT_PATH, filelist[selection].filename);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fname[0] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fname[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open screenshot file */
|
/* Supported ROM file found ? */
|
||||||
sprintf (fname, "%s/snaps/%s.png", DEFAULT_PATH, text);
|
if (fname[0])
|
||||||
|
{
|
||||||
|
/* remove original file extension */
|
||||||
|
i = strlen(fname) - 1;
|
||||||
|
while ((i > 0) && (fname[i] != '.')) i--;
|
||||||
|
if (i > 0) fname[i] = 0;
|
||||||
|
|
||||||
|
/* add PNG file extension */
|
||||||
|
strcat(fname, ".png");
|
||||||
|
|
||||||
|
/* try to load screenshot */
|
||||||
snap = fopen(fname, "rb");
|
snap = fopen(fname, "rb");
|
||||||
if (snap)
|
if (snap)
|
||||||
{
|
{
|
||||||
bg_filesel[8].texture = gxTextureOpenPNG(0,snap);
|
bg_filesel[8].texture = gxTextureOpenPNG(0,snap);
|
||||||
if (bg_filesel[8].texture)
|
if (bg_filesel[8].texture)
|
||||||
|
{
|
||||||
bg_filesel[8].state |= IMAGE_VISIBLE;
|
bg_filesel[8].state |= IMAGE_VISIBLE;
|
||||||
|
}
|
||||||
fclose(snap);
|
fclose(snap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -330,7 +380,7 @@ int FileSelector(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* this is a file */
|
/* this is a ROM file */
|
||||||
strcpy(action_select.comment,"Load ROM File");
|
strcpy(action_select.comment,"Load ROM File");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,7 +527,7 @@ int FileSelector(void)
|
|||||||
/* select previous directory */
|
/* select previous directory */
|
||||||
for (i=0; i<maxfiles; i++)
|
for (i=0; i<maxfiles; i++)
|
||||||
{
|
{
|
||||||
if (filelist[i].flags && !strcmp(prev_folder,filelist[i].filename))
|
if ((filelist[i].flags) && !strcmp(prev_folder,filelist[i].filename))
|
||||||
{
|
{
|
||||||
selection = i;
|
selection = i;
|
||||||
offset = (i / 10) * 10;
|
offset = (i / 10) * 10;
|
||||||
@ -498,9 +548,42 @@ int FileSelector(void)
|
|||||||
{
|
{
|
||||||
string_offset = 0;
|
string_offset = 0;
|
||||||
|
|
||||||
|
/* ensure we are in focus area */
|
||||||
|
if (m->selected < m->max_buttons)
|
||||||
|
{
|
||||||
|
if (filelist[selection].flags)
|
||||||
|
{
|
||||||
|
/* get new directory */
|
||||||
|
UpdateDirectory(0, filelist[selection].filename);
|
||||||
|
|
||||||
|
/* get directory entries */
|
||||||
|
maxfiles = ParseDirectory();
|
||||||
|
|
||||||
|
/* clear selection by default */
|
||||||
|
selection = offset = 0;
|
||||||
|
old = -1;
|
||||||
|
}
|
||||||
|
else if (fname[0])
|
||||||
|
{
|
||||||
|
/* load ROM file from device */
|
||||||
|
int ret = LoadFile(selection);
|
||||||
|
|
||||||
|
/* exit menu */
|
||||||
|
GUI_DeleteMenu(m);
|
||||||
|
|
||||||
|
/* return ROM size (or zero if an error occured) */
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Unsupported ROM file */
|
||||||
|
GUI_WaitPrompt("Error","Unsupported ROM type !");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
/* arrow buttons selected */
|
/* arrow buttons selected */
|
||||||
if (m->selected == m->max_buttons)
|
else if (m->selected == m->max_buttons)
|
||||||
{
|
{
|
||||||
/* up arrow */
|
/* up arrow */
|
||||||
selection--;
|
selection--;
|
||||||
@ -523,49 +606,6 @@ int FileSelector(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ensure we are in focus area */
|
|
||||||
if (m->selected < m->max_buttons)
|
|
||||||
{
|
|
||||||
if (filelist[selection].flags)
|
|
||||||
{
|
|
||||||
/* get new directory */
|
|
||||||
UpdateDirectory(0, filelist[selection].filename);
|
|
||||||
|
|
||||||
/* get directory entries */
|
|
||||||
maxfiles = ParseDirectory();
|
|
||||||
|
|
||||||
/* clear selection by default */
|
|
||||||
selection = offset = 0;
|
|
||||||
old = -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* clear existing patches before loading new ROM file */
|
|
||||||
ggenie_shutdown();
|
|
||||||
areplay_shutdown();
|
|
||||||
|
|
||||||
/* load ROM file from device */
|
|
||||||
size = LoadFile(cart.rom, selection, fname);
|
|
||||||
|
|
||||||
/* exit menu */
|
|
||||||
GUI_DeleteMenu(m);
|
|
||||||
|
|
||||||
/* load new game */
|
|
||||||
if (size)
|
|
||||||
{
|
|
||||||
/* save previous game state */
|
|
||||||
if (config.s_auto & 2)
|
|
||||||
{
|
|
||||||
slot_autosave(config.s_default,config.s_device);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* reinitialize emulation */
|
|
||||||
reloadrom(size,fname);
|
|
||||||
}
|
|
||||||
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,23 +3,39 @@
|
|||||||
*
|
*
|
||||||
* ROM File Browser
|
* ROM File Browser
|
||||||
*
|
*
|
||||||
* Eke-Eke (2009,2010)
|
* Copyright Eke-Eke (2009-2011)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _FILESEL_H
|
#ifndef _FILESEL_H
|
||||||
#define _FILESEL_H
|
#define _FILESEL_H
|
||||||
@ -30,7 +46,7 @@
|
|||||||
/* Filelist structure */
|
/* Filelist structure */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char flags;
|
u8 flags;
|
||||||
char filename[MAXJOLIET];
|
char filename[MAXJOLIET];
|
||||||
}FILEENTRIES;
|
}FILEENTRIES;
|
||||||
|
|
||||||
|
@ -3,23 +3,39 @@
|
|||||||
*
|
*
|
||||||
* IPL font engine (using GX rendering)
|
* IPL font engine (using GX rendering)
|
||||||
*
|
*
|
||||||
* Eke-Eke (2009,2010)
|
* Copyright Eke-Eke (2009-2010)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
@ -220,7 +236,7 @@ static void DrawChar(unsigned char c, int xpos, int ypos, int size, GXColor colo
|
|||||||
GX_Position2s16(xpos, ypos);
|
GX_Position2s16(xpos, ypos);
|
||||||
GX_Color4u8(color.r, color.g, color.b, 0xff);
|
GX_Color4u8(color.r, color.g, color.b, 0xff);
|
||||||
GX_TexCoord2f32(0.0, 1.0);
|
GX_TexCoord2f32(0.0, 1.0);
|
||||||
GX_End ();
|
GX_End();
|
||||||
GX_DrawDone();
|
GX_DrawDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,23 +3,39 @@
|
|||||||
*
|
*
|
||||||
* IPL font engine (using GX rendering)
|
* IPL font engine (using GX rendering)
|
||||||
*
|
*
|
||||||
* Eke-Eke (2009,2010)
|
* Copyright Eke-Eke (2009-2010)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _FONT_H
|
#ifndef _FONT_H
|
||||||
#define _FONT_H
|
#define _FONT_H
|
||||||
|
@ -3,23 +3,39 @@
|
|||||||
*
|
*
|
||||||
* generic GUI Engine (using GX rendering)
|
* generic GUI Engine (using GX rendering)
|
||||||
*
|
*
|
||||||
* Eke-Eke (2009,2010)
|
* Copyright Eke-Eke (2009-2010)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
@ -3,23 +3,39 @@
|
|||||||
*
|
*
|
||||||
* generic GUI Engine (using GX rendering)
|
* generic GUI Engine (using GX rendering)
|
||||||
*
|
*
|
||||||
* Eke-Eke (2009,2010)
|
* Copyright Eke-Eke (2009-2010)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _GUI_H
|
#ifndef _GUI_H
|
||||||
#define _GUI_H
|
#define _GUI_H
|
||||||
|
@ -3,24 +3,39 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX Disclaimer
|
* Genesis Plus GX Disclaimer
|
||||||
*
|
*
|
||||||
* Softdev (2006)
|
* Copyright Eke-Eke (2009-2011)
|
||||||
* Eke-Eke (2007,2008,2009,2010)
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
@ -36,27 +51,26 @@ extern const u8 Bg_intro_c5_png[];
|
|||||||
* This is the legal stuff - which must be shown at program startup
|
* This is the legal stuff - which must be shown at program startup
|
||||||
* Any derivative work MUST include the same textual output.
|
* Any derivative work MUST include the same textual output.
|
||||||
*
|
*
|
||||||
* In other words, play nice and give credit where it's due.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void show_disclaimer(int ypos)
|
static void show_disclaimer(int ypos)
|
||||||
{
|
{
|
||||||
FONT_writeCenter ("DISCLAIMER",22,0,640,ypos,(GXColor)WHITE);
|
FONT_writeCenter ("DISCLAIMER",22,0,640,ypos,(GXColor)WHITE);
|
||||||
ypos += 32;
|
ypos += 32;
|
||||||
FONT_writeCenter ("This is free software, and you are welcome to",20,0,640,ypos,(GXColor)WHITE);
|
FONT_writeCenter ("This is a free software, and you are welcome",20,0,640,ypos,(GXColor)WHITE);
|
||||||
ypos += 20;
|
ypos += 20;
|
||||||
FONT_writeCenter ("redistribute it under the conditions of the",20,0,640,ypos,(GXColor)WHITE);
|
FONT_writeCenter ("to redistribute it under the conditions of the",20,0,640,ypos,(GXColor)WHITE);
|
||||||
ypos += 20;
|
ypos += 20;
|
||||||
FONT_writeCenter ("GNU GENERAL PUBLIC LICENSE Version 2.",20,0,640,ypos,(GXColor)WHITE);
|
FONT_writeCenter ("license that you should have received with this",20,0,640,ypos,(GXColor)WHITE);
|
||||||
|
ypos += 20;
|
||||||
|
FONT_writeCenter ("program. You may not sell, lease, rent or generally",20,0,640,ypos,(GXColor)WHITE);
|
||||||
|
ypos += 20;
|
||||||
|
FONT_writeCenter ("use this software in any commercial product or activity.",20,0,640,ypos,(GXColor)WHITE);
|
||||||
ypos += 20;
|
ypos += 20;
|
||||||
FONT_writeCenter ("Authors can not be held responsible for any damage or",20,0,640,ypos,(GXColor)WHITE);
|
FONT_writeCenter ("Authors can not be held responsible for any damage or",20,0,640,ypos,(GXColor)WHITE);
|
||||||
ypos += 20;
|
ypos += 20;
|
||||||
FONT_writeCenter ("or dysfunction that could occur while using this port.",20,0,640,ypos,(GXColor)WHITE);
|
FONT_writeCenter ("or dysfunction that could occur while using this port.",20,0,640,ypos,(GXColor)WHITE);
|
||||||
ypos += 20;
|
ypos += 20;
|
||||||
FONT_writeCenter ("You may not sell, lease, rent or generally use",20,0,640,ypos,(GXColor)WHITE);
|
|
||||||
ypos += 20;
|
|
||||||
FONT_writeCenter ("this software in any commercial product or activity.",20,0,640,ypos,(GXColor)WHITE);
|
|
||||||
ypos += 20;
|
|
||||||
FONT_writeCenter ("You may not distribute this software with any ROM image",20,0,640,ypos,(GXColor)WHITE);
|
FONT_writeCenter ("You may not distribute this software with any ROM image",20,0,640,ypos,(GXColor)WHITE);
|
||||||
ypos += 20;
|
ypos += 20;
|
||||||
FONT_writeCenter ("unless you have the legal right to distribute them.",20,0,640,ypos,(GXColor)WHITE);
|
FONT_writeCenter ("unless you have the legal right to distribute them.",20,0,640,ypos,(GXColor)WHITE);
|
||||||
|
@ -3,23 +3,39 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX menu
|
* Genesis Plus GX menu
|
||||||
*
|
*
|
||||||
* Eke-Eke (2009,2010)
|
* Copyright Eke-Eke (2009-2011)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
@ -31,6 +47,7 @@
|
|||||||
#include "file_slot.h"
|
#include "file_slot.h"
|
||||||
|
|
||||||
#include <ogc/lwp_threads.h>
|
#include <ogc/lwp_threads.h>
|
||||||
|
#include <ogc/lwp_watchdog.h>
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
#include <ogc/usbmouse.h>
|
#include <ogc/usbmouse.h>
|
||||||
@ -323,7 +340,7 @@ static gui_item items_options[5] =
|
|||||||
/* Audio options */
|
/* Audio options */
|
||||||
static gui_item items_audio[13] =
|
static gui_item items_audio[13] =
|
||||||
{
|
{
|
||||||
{NULL,NULL,"Master System FM: ON", "Enable/disable YM2413 chip", 56,132,276,48},
|
{NULL,NULL,"Master System FM: AUTO", "Enable/disable YM2413 chip", 56,132,276,48},
|
||||||
{NULL,NULL,"High-Quality FM: ON", "Enable/disable YM2612/YM2413 resampling", 56,132,276,48},
|
{NULL,NULL,"High-Quality FM: ON", "Enable/disable YM2612/YM2413 resampling", 56,132,276,48},
|
||||||
{NULL,NULL,"FM Roll-off: 0.999", "Adjust FIR low-pass filtering", 56,132,276,48},
|
{NULL,NULL,"FM Roll-off: 0.999", "Adjust FIR low-pass filtering", 56,132,276,48},
|
||||||
{NULL,NULL,"FM Resolution: MAX", "Adjust YM2612 DAC precision", 56,132,276,48},
|
{NULL,NULL,"FM Resolution: MAX", "Adjust YM2612 DAC precision", 56,132,276,48},
|
||||||
@ -339,8 +356,9 @@ static gui_item items_audio[13] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* System options */
|
/* System options */
|
||||||
static gui_item items_system[7] =
|
static gui_item items_system[8] =
|
||||||
{
|
{
|
||||||
|
{NULL,NULL,"Console Hardware: AUTO", "Select system hardware model", 56,132,276,48},
|
||||||
{NULL,NULL,"Console Region: AUTO", "Select system region", 56,132,276,48},
|
{NULL,NULL,"Console Region: AUTO", "Select system region", 56,132,276,48},
|
||||||
{NULL,NULL,"System Lockups: OFF", "Enable/disable original system lock-ups", 56,132,276,48},
|
{NULL,NULL,"System Lockups: OFF", "Enable/disable original system lock-ups", 56,132,276,48},
|
||||||
{NULL,NULL,"68k Address Error: ON", "Enable/disable 68k Address Error", 56,132,276,48},
|
{NULL,NULL,"68k Address Error: ON", "Enable/disable 68k Address Error", 56,132,276,48},
|
||||||
@ -557,7 +575,7 @@ static gui_menu menu_system =
|
|||||||
{
|
{
|
||||||
"System Settings",
|
"System Settings",
|
||||||
0,0,
|
0,0,
|
||||||
6,4,6,0,
|
7,4,7,0,
|
||||||
items_system,
|
items_system,
|
||||||
buttons_list,
|
buttons_list,
|
||||||
bg_list,
|
bg_list,
|
||||||
@ -828,7 +846,10 @@ static void soundmenu ()
|
|||||||
float hg = (float)config.hg/100.0;
|
float hg = (float)config.hg/100.0;
|
||||||
|
|
||||||
int offset = update_snd_items();
|
int offset = update_snd_items();
|
||||||
sprintf (items[0].text, "Master System FM: %s", config.ym2413_enabled ? "ON":"OFF");
|
|
||||||
|
if (config.ym2413 == 0) sprintf (items[0].text, "Master System FM: OFF");
|
||||||
|
else if (config.ym2413 == 1) sprintf (items[0].text, "Master System FM: ON");
|
||||||
|
else sprintf (items[0].text, "Master System FM: AUTO");
|
||||||
|
|
||||||
GUI_InitMenu(m);
|
GUI_InitMenu(m);
|
||||||
GUI_SlideMenuTitle(m,strlen("Audio "));
|
GUI_SlideMenuTitle(m,strlen("Audio "));
|
||||||
@ -857,43 +878,72 @@ static void soundmenu ()
|
|||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
config.ym2413_enabled ^= 1;
|
{
|
||||||
sprintf (items[0].text, "Master System FM: %s", config.ym2413_enabled ? "ON":"OFF");
|
config.ym2413++;
|
||||||
|
if (config.ym2413 > 2) config.ym2413 = 0;
|
||||||
|
if (config.ym2413 == 0) sprintf (items[0].text, "Master System FM: OFF");
|
||||||
|
else if (config.ym2413 == 1) sprintf (items[0].text, "Master System FM: ON");
|
||||||
|
else sprintf (items[0].text, "Master System FM: AUTO");
|
||||||
|
|
||||||
|
/* Automatic detection */
|
||||||
|
if ((config.ym2413 & 2) && cart.romsize && ((system_hw & SYSTEM_PBC) != SYSTEM_MD))
|
||||||
|
{
|
||||||
|
/* detect if game is using YM2413 */
|
||||||
|
sms_cart_init();
|
||||||
|
|
||||||
|
/* restore SRAM */
|
||||||
|
if (config.s_auto & 1)
|
||||||
|
{
|
||||||
|
slot_autoload(0,config.s_device);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
{
|
||||||
config.hq_fm ^= 1;
|
config.hq_fm ^= 1;
|
||||||
reinit = 1;
|
reinit = 1;
|
||||||
offset = update_snd_items();
|
offset = update_snd_items();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
{
|
||||||
config.dac_bits++;
|
config.dac_bits++;
|
||||||
if (config.dac_bits > 14) config.dac_bits = 7;
|
if (config.dac_bits > 14) config.dac_bits = 7;
|
||||||
else sprintf (items[offset].text, "FM Resolution: MAX");
|
|
||||||
if (config.dac_bits < 14) sprintf (items[offset].text, "FM Resolution: %d bits", config.dac_bits);
|
if (config.dac_bits < 14) sprintf (items[offset].text, "FM Resolution: %d bits", config.dac_bits);
|
||||||
|
else sprintf (items[offset].text, "FM Resolution: MAX");
|
||||||
reinit = 1;
|
reinit = 1;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
|
{
|
||||||
GUI_OptionBox(m,0,"FM Volume",(void *)&fm_volume,0.01,0.0,5.0,0);
|
GUI_OptionBox(m,0,"FM Volume",(void *)&fm_volume,0.01,0.0,5.0,0);
|
||||||
sprintf (items[offset+1].text, "FM Volume: %1.2f", fm_volume);
|
sprintf (items[offset+1].text, "FM Volume: %1.2f", fm_volume);
|
||||||
config.fm_preamp = (int)(fm_volume * 100.0 + 0.5);
|
config.fm_preamp = (int)(fm_volume * 100.0 + 0.5);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
|
{
|
||||||
GUI_OptionBox(m,0,"PSG Volume",(void *)&psg_volume,0.01,0.0,5.0,0);
|
GUI_OptionBox(m,0,"PSG Volume",(void *)&psg_volume,0.01,0.0,5.0,0);
|
||||||
sprintf (items[offset+2].text, "PSG Volume: %1.2f", psg_volume);
|
sprintf (items[offset+2].text, "PSG Volume: %1.2f", psg_volume);
|
||||||
config.psg_preamp = (int)(psg_volume * 100.0 + 0.5);
|
config.psg_preamp = (int)(psg_volume * 100.0 + 0.5);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
|
{
|
||||||
config.psgBoostNoise ^= 1;
|
config.psgBoostNoise ^= 1;
|
||||||
sprintf (items[offset+3].text, "PSG Noise Boost: %s", config.psgBoostNoise ? "ON":"OFF");
|
sprintf (items[offset+3].text, "PSG Noise Boost: %s", config.psgBoostNoise ? "ON":"OFF");
|
||||||
SN76489_BoostNoise(config.psgBoostNoise);
|
SN76489_BoostNoise(config.psgBoostNoise);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
|
{
|
||||||
config.filter = (config.filter + 1) % 3;
|
config.filter = (config.filter + 1) % 3;
|
||||||
if (config.filter == 2)
|
if (config.filter == 2)
|
||||||
{
|
{
|
||||||
@ -922,8 +972,10 @@ static void soundmenu ()
|
|||||||
m->selected++;
|
m->selected++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
|
{
|
||||||
if (config.filter == 1)
|
if (config.filter == 1)
|
||||||
{
|
{
|
||||||
GUI_OptionBox(m,0,"Low-Pass Rate",(void *)&config.lp_range,1,0,100,1);
|
GUI_OptionBox(m,0,"Low-Pass Rate",(void *)&config.lp_range,1,0,100,1);
|
||||||
@ -937,42 +989,53 @@ static void soundmenu ()
|
|||||||
audio_set_equalizer();
|
audio_set_equalizer();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
|
{
|
||||||
GUI_OptionBox(m,0,"Middle Gain",(void *)&mg,0.01,0.0,2.0,0);
|
GUI_OptionBox(m,0,"Middle Gain",(void *)&mg,0.01,0.0,2.0,0);
|
||||||
sprintf (items[offset+6].text, "Middle Gain: %1.2f", mg);
|
sprintf (items[offset+6].text, "Middle Gain: %1.2f", mg);
|
||||||
config.mg = (int)(mg * 100.0);
|
config.mg = (int)(mg * 100.0);
|
||||||
audio_set_equalizer();
|
audio_set_equalizer();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 9:
|
case 9:
|
||||||
|
{
|
||||||
GUI_OptionBox(m,0,"High Gain",(void *)&hg,0.01,0.0,2.0,0);
|
GUI_OptionBox(m,0,"High Gain",(void *)&hg,0.01,0.0,2.0,0);
|
||||||
sprintf (items[offset+7].text, "High Gain: %1.2f", hg);
|
sprintf (items[offset+7].text, "High Gain: %1.2f", hg);
|
||||||
config.hg = (int)(hg * 100.0);
|
config.hg = (int)(hg * 100.0);
|
||||||
audio_set_equalizer();
|
audio_set_equalizer();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 10:
|
case 10:
|
||||||
|
{
|
||||||
GUI_OptionBox(m,0,"Low Frequency",(void *)&config.low_freq,10,0,config.high_freq,1);
|
GUI_OptionBox(m,0,"Low Frequency",(void *)&config.low_freq,10,0,config.high_freq,1);
|
||||||
sprintf (items[offset+8].text, "Low Freq: %d", config.low_freq);
|
sprintf (items[offset+8].text, "Low Freq: %d", config.low_freq);
|
||||||
audio_set_equalizer();
|
audio_set_equalizer();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 11:
|
case 11:
|
||||||
|
{
|
||||||
GUI_OptionBox(m,0,"High Frequency",(void *)&config.high_freq,100,config.low_freq,30000,1);
|
GUI_OptionBox(m,0,"High Frequency",(void *)&config.high_freq,100,config.low_freq,30000,1);
|
||||||
sprintf (items[offset+9].text, "High Freq: %d", config.high_freq);
|
sprintf (items[offset+9].text, "High Freq: %d", config.high_freq);
|
||||||
audio_set_equalizer();
|
audio_set_equalizer();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
|
{
|
||||||
quit = 1;
|
quit = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (reinit && cart.romsize)
|
if (reinit && cart.romsize)
|
||||||
{
|
{
|
||||||
audio_init(snd.sample_rate,snd.frame_rate);
|
audio_init(snd.sample_rate, snd.frame_rate);
|
||||||
sound_restore();
|
sound_restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -998,38 +1061,53 @@ static void systemmenu ()
|
|||||||
gui_menu *m = &menu_system;
|
gui_menu *m = &menu_system;
|
||||||
gui_item *items = m->items;
|
gui_item *items = m->items;
|
||||||
|
|
||||||
if (config.region_detect == 0)
|
if (config.system == 0)
|
||||||
sprintf (items[0].text, "Console Region: AUTO");
|
sprintf (items[0].text, "Console Hardware: AUTO");
|
||||||
else if (config.region_detect == 1)
|
else if (config.system == SYSTEM_SG)
|
||||||
sprintf (items[0].text, "Console Region: USA");
|
sprintf (items[0].text, "Console Hardware: SG-1000");
|
||||||
else if (config.region_detect == 2)
|
else if (config.system == SYSTEM_MARKIII)
|
||||||
sprintf (items[0].text, "Console Region: EUR");
|
sprintf (items[0].text, "Console Hardware: MARK-III");
|
||||||
else if (config.region_detect == 3)
|
else if (config.system == SYSTEM_SMS)
|
||||||
sprintf (items[0].text, "Console Region: JAPAN");
|
sprintf (items[0].text, "Console Hardware: SMS");
|
||||||
|
else if (config.system == SYSTEM_SMS2)
|
||||||
|
sprintf (items[0].text, "Console Hardware: SMS-II");
|
||||||
|
else if (config.system == SYSTEM_GG)
|
||||||
|
sprintf (items[0].text, "Console Hardware: GG");
|
||||||
|
else if (config.system == SYSTEM_MD)
|
||||||
|
sprintf (items[0].text, "Console Hardware: MD");
|
||||||
|
|
||||||
sprintf (items[1].text, "System Lockups: %s", config.force_dtack ? "OFF" : "ON");
|
if (config.region_detect == 0)
|
||||||
sprintf (items[2].text, "68k Address Error: %s", config.addr_error ? "ON" : "OFF");
|
sprintf (items[1].text, "Console Region: AUTO");
|
||||||
sprintf (items[3].text, "System TMSS: %s", (config.tmss & 1) ? "ON":"OFF");
|
else if (config.region_detect == 1)
|
||||||
|
sprintf (items[1].text, "Console Region: USA");
|
||||||
|
else if (config.region_detect == 2)
|
||||||
|
sprintf (items[1].text, "Console Region: EUR");
|
||||||
|
else if (config.region_detect == 3)
|
||||||
|
sprintf (items[1].text, "Console Region: JAPAN");
|
||||||
|
|
||||||
|
sprintf (items[2].text, "System Lockups: %s", config.force_dtack ? "OFF" : "ON");
|
||||||
|
sprintf (items[3].text, "68k Address Error: %s", config.addr_error ? "ON" : "OFF");
|
||||||
|
sprintf (items[4].text, "System TMSS: %s", (config.tmss & 1) ? "ON":"OFF");
|
||||||
|
|
||||||
if (config.lock_on == TYPE_GG)
|
if (config.lock_on == TYPE_GG)
|
||||||
sprintf (items[4].text, "Lock-On: GAME GENIE");
|
sprintf (items[5].text, "Lock-On: GAME GENIE");
|
||||||
else if (config.lock_on == TYPE_AR)
|
else if (config.lock_on == TYPE_AR)
|
||||||
sprintf (items[4].text, "Lock-On: ACTION REPLAY");
|
sprintf (items[5].text, "Lock-On: ACTION REPLAY");
|
||||||
else if (config.lock_on == TYPE_SK)
|
else if (config.lock_on == TYPE_SK)
|
||||||
sprintf (items[4].text, "Lock-On: SONIC&KNUCKLES");
|
sprintf (items[5].text, "Lock-On: SONIC&KNUCKLES");
|
||||||
else
|
else
|
||||||
sprintf (items[4].text, "Lock-On: OFF");
|
sprintf (items[5].text, "Lock-On: OFF");
|
||||||
|
|
||||||
sprintf (items[5].text, "Cartridge Swap: %s", config.hot_swap ? "ON":"OFF");
|
sprintf (items[6].text, "Cartridge Swap: %s", config.hot_swap ? "ON":"OFF");
|
||||||
|
|
||||||
if (svp)
|
if (svp)
|
||||||
{
|
{
|
||||||
sprintf (items[6].text, "SVP Cycles: %d", SVP_cycles);
|
sprintf (items[7].text, "SVP Cycles: %d", SVP_cycles);
|
||||||
m->max_items = 7;
|
m->max_items = 8;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m->max_items = 6;
|
m->max_items = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI_InitMenu(m);
|
GUI_InitMenu(m);
|
||||||
@ -1041,21 +1119,118 @@ static void systemmenu ()
|
|||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
case 0: /*** Force Region ***/
|
case 0: /*** Force System Hardware ***/
|
||||||
|
{
|
||||||
|
if (config.system == SYSTEM_MD)
|
||||||
|
{
|
||||||
|
config.system = 0;
|
||||||
|
sprintf (items[0].text, "Console Hardware: AUTO");
|
||||||
|
|
||||||
|
/* Default system hardware (auto) */
|
||||||
|
system_hw = romtype;
|
||||||
|
}
|
||||||
|
else if (config.system == 0)
|
||||||
|
{
|
||||||
|
config.system = SYSTEM_SG;
|
||||||
|
sprintf (items[0].text, "Console Hardware: SG-1000");
|
||||||
|
|
||||||
|
/* Force system hardware */
|
||||||
|
system_hw = SYSTEM_SG;
|
||||||
|
}
|
||||||
|
else if (config.system == SYSTEM_SG)
|
||||||
|
{
|
||||||
|
config.system = SYSTEM_MARKIII;
|
||||||
|
sprintf (items[0].text, "Console Hardware: MARK-III");
|
||||||
|
|
||||||
|
/* Force system hardware */
|
||||||
|
system_hw = SYSTEM_MARKIII;
|
||||||
|
}
|
||||||
|
else if (config.system == SYSTEM_MARKIII)
|
||||||
|
{
|
||||||
|
config.system = SYSTEM_SMS;
|
||||||
|
sprintf (items[0].text, "Console Hardware: SMS");
|
||||||
|
|
||||||
|
/* Force system hardware */
|
||||||
|
system_hw = SYSTEM_SMS;
|
||||||
|
}
|
||||||
|
else if (config.system == SYSTEM_SMS)
|
||||||
|
{
|
||||||
|
config.system = SYSTEM_SMS2;
|
||||||
|
sprintf (items[0].text, "Console Hardware: SMS-II");
|
||||||
|
|
||||||
|
/* Force system hardware */
|
||||||
|
system_hw = SYSTEM_SMS2;
|
||||||
|
}
|
||||||
|
else if (config.system == SYSTEM_SMS2)
|
||||||
|
{
|
||||||
|
config.system = SYSTEM_GG;
|
||||||
|
sprintf (items[0].text, "Console Hardware: GG");
|
||||||
|
|
||||||
|
if (romtype == SYSTEM_GG)
|
||||||
|
{
|
||||||
|
/* Game Gear mode */
|
||||||
|
system_hw = SYSTEM_GG;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Game Gear in MS compatibility mode */
|
||||||
|
system_hw = SYSTEM_GGMS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (config.system == SYSTEM_GG)
|
||||||
|
{
|
||||||
|
config.system = SYSTEM_MD;
|
||||||
|
sprintf (items[0].text, "Console Hardware: MD");
|
||||||
|
|
||||||
|
if (romtype & SYSTEM_MD)
|
||||||
|
{
|
||||||
|
/* Default mode */
|
||||||
|
system_hw = romtype;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Mega Drive in MS compatibility mode */
|
||||||
|
system_hw = SYSTEM_PBC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* restart emulation */
|
||||||
|
system_init();
|
||||||
|
system_reset();
|
||||||
|
|
||||||
|
/* restore SRAM */
|
||||||
|
if (config.s_auto & 1)
|
||||||
|
{
|
||||||
|
slot_autoload(0,config.s_device);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 1: /*** Force Region ***/
|
||||||
|
{
|
||||||
config.region_detect = (config.region_detect + 1) % 4;
|
config.region_detect = (config.region_detect + 1) % 4;
|
||||||
if (config.region_detect == 0)
|
if (config.region_detect == 0)
|
||||||
sprintf (items[0].text, "Console Region: AUTO");
|
sprintf (items[1].text, "Console Region: AUTO");
|
||||||
else if (config.region_detect == 1)
|
else if (config.region_detect == 1)
|
||||||
sprintf (items[0].text, "Console Region: USA");
|
sprintf (items[1].text, "Console Region: USA");
|
||||||
else if (config.region_detect == 2)
|
else if (config.region_detect == 2)
|
||||||
sprintf (items[0].text, "Console Region: EUR");
|
sprintf (items[1].text, "Console Region: EUR");
|
||||||
else if (config.region_detect == 3)
|
else if (config.region_detect == 3)
|
||||||
sprintf (items[0].text, "Console Region: JAPAN");
|
sprintf (items[1].text, "Console Region: JAPAN");
|
||||||
|
|
||||||
if (cart.romsize)
|
if (cart.romsize)
|
||||||
{
|
{
|
||||||
/* reset console region */
|
/* reset console region */
|
||||||
region_autodetect();
|
region_autodetect();
|
||||||
|
if (system_hw == SYSTEM_MD)
|
||||||
|
{
|
||||||
|
io_reg[0x00] = 0x20 | region_code | (config.tmss & 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
io_reg[0x00] = 0x80 | (region_code >> 1);
|
||||||
|
}
|
||||||
|
|
||||||
/* reinitialize audio timings */
|
/* reinitialize audio timings */
|
||||||
if (vdp_pal)
|
if (vdp_pal)
|
||||||
@ -1067,35 +1242,64 @@ static void systemmenu ()
|
|||||||
audio_init(snd.sample_rate, (config.tv_mode == 1) ? 60.0 : ((config.render || interlaced) ? 59.94 : (1000000.0/16715.0)));
|
audio_init(snd.sample_rate, (config.tv_mode == 1) ? 60.0 : ((config.render || interlaced) ? 59.94 : (1000000.0/16715.0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reinitialize system emulation */
|
/* reintialize VDP */
|
||||||
vdp_init();
|
vdp_init();
|
||||||
io_init();
|
|
||||||
sound_restore();
|
/* reintialize VDP Status flag */
|
||||||
|
if (system_hw & SYSTEM_MD)
|
||||||
|
{
|
||||||
|
status = (status & ~1) | vdp_pal;
|
||||||
|
}
|
||||||
|
|
||||||
/* reinitialize VC max value */
|
/* reinitialize VC max value */
|
||||||
vc_max = vc_table[(reg[1] >> 2) & 3][vdp_pal];
|
switch (bitmap.viewport.h)
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1: /*** force DTACK ***/
|
|
||||||
config.force_dtack ^= 1;
|
|
||||||
sprintf (items[1].text, "System Lockups: %s", config.force_dtack ? "OFF" : "ON");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2: /*** 68k Address Error ***/
|
|
||||||
config.addr_error ^= 1;
|
|
||||||
if (system_hw != SYSTEM_PBC)
|
|
||||||
{
|
{
|
||||||
md_cart_init ();
|
case 192:
|
||||||
}
|
vc_max = vc_table[0][vdp_pal];
|
||||||
sprintf (items[2].text, "68k Address Error: %s", config.addr_error ? "ON" : "OFF");
|
|
||||||
break;
|
break;
|
||||||
|
case 224:
|
||||||
|
vc_max = vc_table[1][vdp_pal];
|
||||||
|
break;
|
||||||
|
case 240:
|
||||||
|
vc_max = vc_table[3][vdp_pal];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* reinitialize sound emulation */
|
||||||
|
sound_restore();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 3: /*** BIOS support ***/
|
case 2: /*** force DTACK ***/
|
||||||
|
{
|
||||||
|
config.force_dtack ^= 1;
|
||||||
|
sprintf (items[2].text, "System Lockups: %s", config.force_dtack ? "OFF" : "ON");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 3: /*** 68k Address Error ***/
|
||||||
|
{
|
||||||
|
config.addr_error ^= 1;
|
||||||
|
if (cart.romsize && ((system_hw & SYSTEM_PBC) == SYSTEM_MD))
|
||||||
|
{
|
||||||
|
md_cart_init();
|
||||||
|
|
||||||
|
/* restore SRAM */
|
||||||
|
if (config.s_auto & 1)
|
||||||
|
{
|
||||||
|
slot_autoload(0,config.s_device);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sprintf (items[3].text, "68k Address Error: %s", config.addr_error ? "ON" : "OFF");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 4: /*** BIOS support ***/
|
||||||
|
{
|
||||||
config.tmss ^= 1;
|
config.tmss ^= 1;
|
||||||
sprintf (items[3].text, "System TMSS: %s", (config.tmss & 1) ? "ON":"OFF");
|
sprintf (items[4].text, "System TMSS: %s", (config.tmss & 1) ? "ON":"OFF");
|
||||||
if (cart.romsize)
|
if (cart.romsize && ((system_hw & SYSTEM_PBC) == SYSTEM_MD))
|
||||||
{
|
{
|
||||||
/* restart emulation */
|
/* restart emulation */
|
||||||
system_init();
|
system_init();
|
||||||
@ -1108,21 +1312,23 @@ static void systemmenu ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 4: /*** Cart Lock-On ***/
|
case 5: /*** Cart Lock-On ***/
|
||||||
|
{
|
||||||
config.lock_on++;
|
config.lock_on++;
|
||||||
if (config.lock_on > TYPE_SK)
|
if (config.lock_on > TYPE_SK)
|
||||||
config.lock_on = 0;
|
config.lock_on = 0;
|
||||||
if (config.lock_on == TYPE_GG)
|
if (config.lock_on == TYPE_GG)
|
||||||
sprintf (items[4].text, "Lock-On: GAME GENIE");
|
sprintf (items[5].text, "Lock-On: GAME GENIE");
|
||||||
else if (config.lock_on == TYPE_AR)
|
else if (config.lock_on == TYPE_AR)
|
||||||
sprintf (items[4].text, "Lock-On: ACTION REPLAY");
|
sprintf (items[5].text, "Lock-On: ACTION REPLAY");
|
||||||
else if (config.lock_on == TYPE_SK)
|
else if (config.lock_on == TYPE_SK)
|
||||||
sprintf (items[4].text, "Lock-On: SONIC&KNUCKLES");
|
sprintf (items[5].text, "Lock-On: SONIC&KNUCKLES");
|
||||||
else
|
else
|
||||||
sprintf (items[4].text, "Lock-On: OFF");
|
sprintf (items[5].text, "Lock-On: OFF");
|
||||||
|
|
||||||
if (cart.romsize)
|
if (cart.romsize && ((system_hw & SYSTEM_PBC) == SYSTEM_MD))
|
||||||
{
|
{
|
||||||
/* restart emulation */
|
/* restart emulation */
|
||||||
system_init();
|
system_init();
|
||||||
@ -1155,22 +1361,29 @@ static void systemmenu ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 5: /*** Cartridge Hot Swap ***/
|
case 6: /*** Cartridge Hot Swap ***/
|
||||||
|
{
|
||||||
config.hot_swap ^= 1;
|
config.hot_swap ^= 1;
|
||||||
sprintf (items[5].text, "Cartridge Swap: %s", config.hot_swap ? "ON":"OFF");
|
sprintf (items[6].text, "Cartridge Swap: %s", config.hot_swap ? "ON":"OFF");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 6: /*** SVP cycles per line ***/
|
case 7: /*** SVP cycles per line ***/
|
||||||
|
{
|
||||||
GUI_OptionBox(m,0,"SVP Cycles",(void *)&SVP_cycles,1,1,1500,1);
|
GUI_OptionBox(m,0,"SVP Cycles",(void *)&SVP_cycles,1,1,1500,1);
|
||||||
sprintf (items[6].text, "SVP Cycles: %d", SVP_cycles);
|
sprintf (items[7].text, "SVP Cycles: %d", SVP_cycles);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
|
{
|
||||||
quit = 1;
|
quit = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GUI_DeleteMenu(m);
|
GUI_DeleteMenu(m);
|
||||||
}
|
}
|
||||||
@ -1352,7 +1565,7 @@ static void videomenu ()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
case VI_OFFSET: /*** NTSC filter ***/
|
case VI_OFFSET: /*** NTSC filter ***/
|
||||||
config.ntsc = (config.ntsc + 1) % 4;
|
config.ntsc = (config.ntsc + 1) & 3;
|
||||||
if (config.ntsc == 1)
|
if (config.ntsc == 1)
|
||||||
sprintf (items[VI_OFFSET].text, "NTSC Filter: COMPOSITE");
|
sprintf (items[VI_OFFSET].text, "NTSC Filter: COMPOSITE");
|
||||||
else if (config.ntsc == 2)
|
else if (config.ntsc == 2)
|
||||||
@ -1364,7 +1577,7 @@ static void videomenu ()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VI_OFFSET+1: /*** overscan emulation ***/
|
case VI_OFFSET+1: /*** overscan emulation ***/
|
||||||
config.overscan = (config.overscan + 1) % 4;
|
config.overscan = (config.overscan + 1) & 3;
|
||||||
if (config.overscan == 3)
|
if (config.overscan == 3)
|
||||||
sprintf (items[VI_OFFSET+1].text, "Borders: ALL");
|
sprintf (items[VI_OFFSET+1].text, "Borders: ALL");
|
||||||
else if (config.overscan == 2)
|
else if (config.overscan == 2)
|
||||||
@ -1766,6 +1979,21 @@ static void ctrlmenu(void)
|
|||||||
{
|
{
|
||||||
case 0: /* update port 1 system */
|
case 0: /* update port 1 system */
|
||||||
{
|
{
|
||||||
|
/* fixed configurations */
|
||||||
|
if (cart.romsize)
|
||||||
|
{
|
||||||
|
if (cart.special & HW_TEREBI_OEKAKI)
|
||||||
|
{
|
||||||
|
GUI_WaitPrompt("Error","Terebi Oekaki detected !");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (system_hw == SYSTEM_PICO)
|
||||||
|
{
|
||||||
|
GUI_WaitPrompt("Error","PICO hardware detected !");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* next connected device */
|
/* next connected device */
|
||||||
input.system[0]++;
|
input.system[0]++;
|
||||||
|
|
||||||
@ -1784,7 +2012,7 @@ static void ctrlmenu(void)
|
|||||||
/* allow only one gun type */
|
/* allow only one gun type */
|
||||||
if ((input.system[0] == SYSTEM_LIGHTPHASER) && ((input.system[1] == SYSTEM_MENACER) || (input.system[1] == SYSTEM_JUSTIFIER)))
|
if ((input.system[0] == SYSTEM_LIGHTPHASER) && ((input.system[1] == SYSTEM_MENACER) || (input.system[1] == SYSTEM_JUSTIFIER)))
|
||||||
{
|
{
|
||||||
input.system[0] ++;
|
input.system[0]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 4-wayplay uses both ports */
|
/* 4-wayplay uses both ports */
|
||||||
@ -1844,16 +2072,33 @@ static void ctrlmenu(void)
|
|||||||
|
|
||||||
case 1: /* update port 2 system */
|
case 1: /* update port 2 system */
|
||||||
{
|
{
|
||||||
/* J-CART uses fixed configuration */
|
/* fixed configurations */
|
||||||
if (cart.special & HW_J_CART) break;
|
if (cart.romsize)
|
||||||
|
{
|
||||||
|
if (cart.special & HW_J_CART)
|
||||||
|
{
|
||||||
|
GUI_WaitPrompt("Error","J-CART detected !");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (cart.special & HW_TEREBI_OEKAKI)
|
||||||
|
{
|
||||||
|
GUI_WaitPrompt("Error","Terebi Oekaki detected !");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (system_hw == SYSTEM_PICO)
|
||||||
|
{
|
||||||
|
GUI_WaitPrompt("Error","PICO hardware detected !");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* next connected device */
|
/* next connected device */
|
||||||
input.system[1] ++;
|
input.system[1]++;
|
||||||
|
|
||||||
/* allow only one connected mouse */
|
/* allow only one connected mouse */
|
||||||
if ((input.system[0] == SYSTEM_MOUSE) && (input.system[1] == SYSTEM_MOUSE))
|
if ((input.system[0] == SYSTEM_MOUSE) && (input.system[1] == SYSTEM_MOUSE))
|
||||||
{
|
{
|
||||||
input.system[1] ++;
|
input.system[1]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allow only one gun type */
|
/* allow only one gun type */
|
||||||
@ -1871,7 +2116,7 @@ static void ctrlmenu(void)
|
|||||||
/* XE-1AP on port A only */
|
/* XE-1AP on port A only */
|
||||||
if (input.system[1] == SYSTEM_XE_A1P)
|
if (input.system[1] == SYSTEM_XE_A1P)
|
||||||
{
|
{
|
||||||
input.system[1] ++;
|
input.system[1]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 4-wayplay uses both ports */
|
/* 4-wayplay uses both ports */
|
||||||
@ -2230,16 +2475,6 @@ static void ctrlmenu(void)
|
|||||||
config.input[player].port = player%4;
|
config.input[player].port = player%4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* force 3-buttons gamepad when using Wiimote */
|
|
||||||
if (config.input[player].device == 1)
|
|
||||||
{
|
|
||||||
config.input[player].padtype = DEVICE_PAD3B;
|
|
||||||
if (special)
|
|
||||||
{
|
|
||||||
memcpy(&m->items[10],&items[*special],sizeof(gui_item));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* update menu items */
|
/* update menu items */
|
||||||
@ -2830,6 +3065,7 @@ static int loadgamemenu ()
|
|||||||
static void showrominfo (void)
|
static void showrominfo (void)
|
||||||
{
|
{
|
||||||
char items[15][64];
|
char items[15][64];
|
||||||
|
char msg[32];
|
||||||
|
|
||||||
/* fill ROM infos */
|
/* fill ROM infos */
|
||||||
sprintf (items[0], "Console Type: %s", rominfo.consoletype);
|
sprintf (items[0], "Console Type: %s", rominfo.consoletype);
|
||||||
@ -2881,14 +3117,14 @@ static void showrominfo (void)
|
|||||||
sprintf (items[11], "ROM end: $%06X", rominfo.romend);
|
sprintf (items[11], "ROM end: $%06X", rominfo.romend);
|
||||||
|
|
||||||
if (sram.custom)
|
if (sram.custom)
|
||||||
sprintf (items[12], "EEPROM(%dK): $%06X", ((eeprom.type.size_mask+1)* 8) /1024, eeprom.type.sda_in_adr);
|
sprintf (items[12], "EEPROM(%dK): $%06X", ((md_eeprom.type.size_mask+1)* 8) /1024, md_eeprom.type.sda_in_adr);
|
||||||
else if (sram.detected)
|
else if (sram.detected)
|
||||||
sprintf (items[12], "SRAM Start: $%06X", sram.start);
|
sprintf (items[12], "SRAM Start: $%06X", sram.start);
|
||||||
else
|
else
|
||||||
sprintf (items[12], "No Backup Memory specified");
|
sprintf (items[12], "No Backup Memory specified");
|
||||||
|
|
||||||
if (sram.custom)
|
if (sram.custom)
|
||||||
sprintf (items[13], "EEPROM(%dK): $%06X", ((eeprom.type.size_mask+1)* 8) /1024, eeprom.type.sda_out_adr);
|
sprintf (items[13], "EEPROM(%dK): $%06X", ((md_eeprom.type.size_mask+1)* 8) /1024, md_eeprom.type.sda_out_adr);
|
||||||
else if (sram.detected)
|
else if (sram.detected)
|
||||||
sprintf (items[13], "SRAM End: $%06X", sram.end);
|
sprintf (items[13], "SRAM End: $%06X", sram.end);
|
||||||
else if (sram.on)
|
else if (sram.on)
|
||||||
@ -2905,7 +3141,28 @@ static void showrominfo (void)
|
|||||||
else if (region_code == REGION_JAPAN_PAL)
|
else if (region_code == REGION_JAPAN_PAL)
|
||||||
sprintf (items[14], "Region Code: %s (JPN-PAL)", rominfo.country);
|
sprintf (items[14], "Region Code: %s (JPN-PAL)", rominfo.country);
|
||||||
|
|
||||||
GUI_TextWindow(&menu_main, "ROM Header Info", items, 15, 15);
|
#ifdef USE_BENCHMARK
|
||||||
|
/* ROM benchmark */
|
||||||
|
if (!config.ntsc)
|
||||||
|
{
|
||||||
|
int frames = 0;
|
||||||
|
u64 start = gettime();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
system_frame(0);
|
||||||
|
audio_update();
|
||||||
|
}
|
||||||
|
while (++frames < 300);
|
||||||
|
u64 end = gettime();
|
||||||
|
sprintf(msg,"ROM Header Info (%d fps)", (300 * 1000000) / diff_usec(start,end));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
strcpy(msg,"ROM Header Info");
|
||||||
|
}
|
||||||
|
|
||||||
|
GUI_TextWindow(&menu_main, msg, items, 15, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -2926,10 +3183,10 @@ static void showcredits(void)
|
|||||||
|
|
||||||
FONT_writeCenter("Genesis Plus Core", 24, 0, 640, 480 - offset, (GXColor)LIGHT_BLUE);
|
FONT_writeCenter("Genesis Plus Core", 24, 0, 640, 480 - offset, (GXColor)LIGHT_BLUE);
|
||||||
FONT_writeCenter("improved emulation code, fixes & extra features by Eke-Eke", 18, 0, 640, 516 - offset, (GXColor)WHITE);
|
FONT_writeCenter("improved emulation code, fixes & extra features by Eke-Eke", 18, 0, 640, 516 - offset, (GXColor)WHITE);
|
||||||
FONT_writeCenter("original 1.2a version by Charles MacDonald", 18, 0, 640, 534 - offset, (GXColor)WHITE);
|
FONT_writeCenter("original 1.3 version by Charles MacDonald", 18, 0, 640, 534 - offset, (GXColor)WHITE);
|
||||||
FONT_writeCenter("original Z80 core by Juergen Buchmueller", 18, 0, 640, 552 - offset, (GXColor)WHITE);
|
FONT_writeCenter("original Z80 core by Juergen Buchmueller", 18, 0, 640, 552 - offset, (GXColor)WHITE);
|
||||||
FONT_writeCenter("original 68k Musashi core by Karl Stenerud", 18, 0, 640, 570 - offset, (GXColor)WHITE);
|
FONT_writeCenter("original 68k Musashi core by Karl Stenerud", 18, 0, 640, 570 - offset, (GXColor)WHITE);
|
||||||
FONT_writeCenter("original YM2612 core by Jarek Burczynski & Tatsuyuki Satoh", 18, 0, 640, 588 - offset, (GXColor)WHITE);
|
FONT_writeCenter("original YM2612/YM2413 cores by Jarek Burczynski & Tatsuyuki Satoh", 18, 0, 640, 588 - offset, (GXColor)WHITE);
|
||||||
FONT_writeCenter("SN76489 core by Maxim", 18, 0, 640, 606 - offset, (GXColor)WHITE);
|
FONT_writeCenter("SN76489 core by Maxim", 18, 0, 640, 606 - offset, (GXColor)WHITE);
|
||||||
FONT_writeCenter("SVP core by Gravydas Ignotas (Notaz)", 18, 0, 640, 624 - offset, (GXColor)WHITE);
|
FONT_writeCenter("SVP core by Gravydas Ignotas (Notaz)", 18, 0, 640, 624 - offset, (GXColor)WHITE);
|
||||||
FONT_writeCenter("FIR Resampler & NTSC Video Filter by Shay Green (Blargg)", 18, 0, 640, 642 - offset, (GXColor)WHITE);
|
FONT_writeCenter("FIR Resampler & NTSC Video Filter by Shay Green (Blargg)", 18, 0, 640, 642 - offset, (GXColor)WHITE);
|
||||||
@ -2960,7 +3217,7 @@ static void showcredits(void)
|
|||||||
|
|
||||||
gxSetScreen();
|
gxSetScreen();
|
||||||
p = m_input.keys;
|
p = m_input.keys;
|
||||||
VIDEO_WaitVSync();
|
gxSetScreen();
|
||||||
p |= m_input.keys;
|
p |= m_input.keys;
|
||||||
offset ++;
|
offset ++;
|
||||||
if (offset > 1144)
|
if (offset > 1144)
|
||||||
@ -3063,7 +3320,7 @@ static void mainmenu_cb(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_execute(void)
|
int menu_execute(void)
|
||||||
{
|
{
|
||||||
char filename[MAXPATHLEN];
|
char filename[MAXPATHLEN];
|
||||||
int status, quit = 0;
|
int status, quit = 0;
|
||||||
@ -3129,7 +3386,7 @@ void menu_execute(void)
|
|||||||
{
|
{
|
||||||
/*** Load Game Menu ***/
|
/*** Load Game Menu ***/
|
||||||
case 0:
|
case 0:
|
||||||
|
{
|
||||||
GUI_DrawMenuFX(m,30,1);
|
GUI_DrawMenuFX(m,30,1);
|
||||||
GUI_DeleteMenu(m);
|
GUI_DeleteMenu(m);
|
||||||
|
|
||||||
@ -3144,39 +3401,39 @@ void menu_execute(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* exit to game */
|
/* exit to game and reinitialize emulation */
|
||||||
gxClearScreen((GXColor)BLACK);
|
gxClearScreen((GXColor)BLACK);
|
||||||
gxSetScreen();
|
gxSetScreen();
|
||||||
quit = 1;
|
quit = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI_InitMenu(m);
|
GUI_InitMenu(m);
|
||||||
GUI_DrawMenuFX(m,30,0);
|
GUI_DrawMenuFX(m,30,0);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/*** Options Menu */
|
/*** Options Menu */
|
||||||
case 1:
|
case 1:
|
||||||
|
{
|
||||||
GUI_DrawMenuFX(m,30,1);
|
GUI_DrawMenuFX(m,30,1);
|
||||||
GUI_DeleteMenu(m);
|
GUI_DeleteMenu(m);
|
||||||
optionmenu();
|
optionmenu();
|
||||||
GUI_InitMenu(m);
|
GUI_InitMenu(m);
|
||||||
GUI_DrawMenuFX(m,30,0);
|
GUI_DrawMenuFX(m,30,0);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/*** Exit Menu ***/
|
/*** Exit Menu ***/
|
||||||
case 2:
|
case 2:
|
||||||
|
{
|
||||||
exitmenu();
|
exitmenu();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/*** Save Manager ***/
|
/*** Save Manager ***/
|
||||||
case 3:
|
case 3:
|
||||||
|
{
|
||||||
GUI_DrawMenuFX(m,30,1);
|
GUI_DrawMenuFX(m,30,1);
|
||||||
GUI_DeleteMenu(m);
|
GUI_DeleteMenu(m);
|
||||||
|
|
||||||
@ -3199,11 +3456,11 @@ void menu_execute(void)
|
|||||||
GUI_InitMenu(m);
|
GUI_InitMenu(m);
|
||||||
GUI_DrawMenuFX(m,30,0);
|
GUI_DrawMenuFX(m,30,0);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/*** Virtual system hard reset ***/
|
/*** Virtual system hard reset ***/
|
||||||
case 4:
|
case 4:
|
||||||
|
{
|
||||||
/* check current controller configuration */
|
/* check current controller configuration */
|
||||||
if (!gx_input_FindDevices())
|
if (!gx_input_FindDevices())
|
||||||
{
|
{
|
||||||
@ -3228,22 +3485,22 @@ void menu_execute(void)
|
|||||||
/* exit to game */
|
/* exit to game */
|
||||||
quit = 1;
|
quit = 1;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/*** Cheats menu ***/
|
/*** Cheats menu ***/
|
||||||
case 5:
|
case 5:
|
||||||
|
{
|
||||||
GUI_DrawMenuFX(m,30,1);
|
GUI_DrawMenuFX(m,30,1);
|
||||||
GUI_DeleteMenu(m);
|
GUI_DeleteMenu(m);
|
||||||
CheatMenu();
|
CheatMenu();
|
||||||
GUI_InitMenu(m);
|
GUI_InitMenu(m);
|
||||||
GUI_DrawMenuFX(m,30,0);
|
GUI_DrawMenuFX(m,30,0);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/*** Action Replay switch ***/
|
/*** Action Replay switch ***/
|
||||||
case 6:
|
case 6:
|
||||||
|
{
|
||||||
status = (areplay_get_status() + 1) % (AR_SWITCH_TRAINER + 1);
|
status = (areplay_get_status() + 1) % (AR_SWITCH_TRAINER + 1);
|
||||||
areplay_set_status(status);
|
areplay_set_status(status);
|
||||||
status = areplay_get_status();
|
status = areplay_get_status();
|
||||||
@ -3253,12 +3510,12 @@ void menu_execute(void)
|
|||||||
else m->items[6].data = Button_sm_grey_png;
|
else m->items[6].data = Button_sm_grey_png;
|
||||||
GUI_InitMenu(m);
|
GUI_InitMenu(m);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/*** Return to Game ***/
|
/*** Return to Game ***/
|
||||||
case 7:
|
case 7:
|
||||||
case -1:
|
case -1:
|
||||||
|
{
|
||||||
if (cart.romsize)
|
if (cart.romsize)
|
||||||
{
|
{
|
||||||
/* check current controller configuration */
|
/* check current controller configuration */
|
||||||
@ -3274,23 +3531,27 @@ void menu_execute(void)
|
|||||||
quit = 1;
|
quit = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/*** Game Capture ***/
|
/*** Game Capture ***/
|
||||||
case 8:
|
case 8:
|
||||||
|
{
|
||||||
|
/* PNG filename */
|
||||||
sprintf(filename,"%s/snaps/%s.png", DEFAULT_PATH, rom_filename);
|
sprintf(filename,"%s/snaps/%s.png", DEFAULT_PATH, rom_filename);
|
||||||
|
|
||||||
|
/* Save file and return */
|
||||||
gxSaveScreenshot(filename);
|
gxSaveScreenshot(filename);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/*** ROM information screen ***/
|
/*** ROM information screen ***/
|
||||||
case 9:
|
case 9:
|
||||||
|
{
|
||||||
showrominfo();
|
showrominfo();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*** Remove any still held buttons ***/
|
/*** Remove any still held buttons ***/
|
||||||
while (PAD_ButtonsHeld(0)) PAD_ScanPads();
|
while (PAD_ButtonsHeld(0)) PAD_ScanPads();
|
||||||
@ -3308,6 +3569,8 @@ void menu_execute(void)
|
|||||||
MOUSE_Deinit();
|
MOUSE_Deinit();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return (quit >> 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_configure(void)
|
void menu_configure(void)
|
||||||
|
@ -3,28 +3,44 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX menus
|
* Genesis Plus GX menus
|
||||||
*
|
*
|
||||||
* Eke-Eke (2009)
|
* Copyright Eke-Eke (2009-2011)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _MENU_H
|
#ifndef _MENU_H
|
||||||
#define _MENU_H
|
#define _MENU_H
|
||||||
|
|
||||||
extern void menu_execute(void);
|
extern int menu_execute(void);
|
||||||
extern void menu_configure(void);
|
extern void menu_configure(void);
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,24 +3,39 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX audio support
|
* Genesis Plus GX audio support
|
||||||
*
|
*
|
||||||
* Softdev (2006)
|
* Copyright Eke-Eke (2007-2011), based on original work from Softdev (2006)
|
||||||
* Eke-Eke (2007,2008,2009)
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
|
||||||
@ -50,7 +65,7 @@ static u32 Bg_music_ogg_size = 0;
|
|||||||
/* Audio DMA callback */
|
/* Audio DMA callback */
|
||||||
static void ai_callback(void)
|
static void ai_callback(void)
|
||||||
{
|
{
|
||||||
frameticker++;
|
frameticker ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* AUDIO engine initialization */
|
/* AUDIO engine initialization */
|
||||||
|
@ -3,24 +3,39 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX audio support
|
* Genesis Plus GX audio support
|
||||||
*
|
*
|
||||||
* Softdev (2006)
|
* Copyright Eke-Eke (2007-2011), based on original work from Softdev (2006)
|
||||||
* Eke-Eke (2007,2008,2009)
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _GC_AUDIO_H_
|
#ifndef _GC_AUDIO_H_
|
||||||
#define _GC_AUDIO_H_
|
#define _GC_AUDIO_H_
|
||||||
|
@ -3,23 +3,39 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX input support
|
* Genesis Plus GX input support
|
||||||
*
|
*
|
||||||
* Eke-Eke (2008,2009)
|
* Copyright Eke-Eke (2007-2011)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
@ -71,6 +87,7 @@ static u32 wpad_dirmap[3][4] =
|
|||||||
static char keyname[MAX_KEYS][16];
|
static char keyname[MAX_KEYS][16];
|
||||||
|
|
||||||
static int held_cnt = 0;
|
static int held_cnt = 0;
|
||||||
|
static int inputs_disabled = 0;
|
||||||
|
|
||||||
/***************************************************************************************/
|
/***************************************************************************************/
|
||||||
/* Gamecube PAD support */
|
/* Gamecube PAD support */
|
||||||
@ -80,23 +97,24 @@ static void pad_config(int chan, int first_key, int last_key)
|
|||||||
u16 p,key;
|
u16 p,key;
|
||||||
char msg[64];
|
char msg[64];
|
||||||
|
|
||||||
/* reset VSYNC callback */
|
/* Disable menu inputs update */
|
||||||
VIDEO_SetPostRetraceCallback(NULL);
|
inputs_disabled = 1;
|
||||||
VIDEO_Flush();
|
|
||||||
|
|
||||||
/* Check if PAD is connected */
|
/* Check if PAD is connected */
|
||||||
if (!(PAD_ScanPads() & (1<<chan)))
|
if (!(PAD_ScanPads() & (1<<chan)))
|
||||||
{
|
{
|
||||||
/* restore inputs update callback */
|
/* restore inputs update callback */
|
||||||
VIDEO_SetPostRetraceCallback(gx_input_UpdateMenu);
|
|
||||||
VIDEO_Flush();
|
|
||||||
sprintf(msg, "PAD #%d is not connected !", chan+1);
|
sprintf(msg, "PAD #%d is not connected !", chan+1);
|
||||||
GUI_WaitPrompt("Error",msg);
|
GUI_WaitPrompt("Error",msg);
|
||||||
|
inputs_disabled = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Configure each keys */
|
/* Configure each keys */
|
||||||
do
|
do
|
||||||
|
{
|
||||||
|
/* check for unused keys */
|
||||||
|
if (strcmp(keyname[first_key], "N.A"))
|
||||||
{
|
{
|
||||||
/* remove any pending keys */
|
/* remove any pending keys */
|
||||||
while (PAD_ButtonsHeld(chan))
|
while (PAD_ButtonsHeld(chan))
|
||||||
@ -135,6 +153,7 @@ static void pad_config(int chan, int first_key, int last_key)
|
|||||||
/* update key mapping */
|
/* update key mapping */
|
||||||
config.pad_keymap[chan][first_key] = key;
|
config.pad_keymap[chan][first_key] = key;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
while (first_key++ < last_key);
|
while (first_key++ < last_key);
|
||||||
|
|
||||||
/* remove any pending keys */
|
/* remove any pending keys */
|
||||||
@ -144,9 +163,8 @@ static void pad_config(int chan, int first_key, int last_key)
|
|||||||
PAD_ScanPads();
|
PAD_ScanPads();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* restore inputs update callback */
|
/* enable menu inputs update */
|
||||||
VIDEO_SetPostRetraceCallback(gx_input_UpdateMenu);
|
inputs_disabled = 0;
|
||||||
VIDEO_Flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pad_update(s8 chan, u8 i)
|
static void pad_update(s8 chan, u8 i)
|
||||||
@ -305,7 +323,7 @@ static void pad_update(s8 chan, u8 i)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case DEVICE_TABLET:
|
case DEVICE_PICO:
|
||||||
{
|
{
|
||||||
/* D-PAD */
|
/* D-PAD */
|
||||||
if (p & PAD_BUTTON_UP) input.pad[i] |= INPUT_UP;
|
if (p & PAD_BUTTON_UP) input.pad[i] |= INPUT_UP;
|
||||||
@ -330,6 +348,24 @@ static void pad_update(s8 chan, u8 i)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case DEVICE_TEREBI:
|
||||||
|
{
|
||||||
|
/* PEN screen position (x,y) */
|
||||||
|
input.analog[0][0] += x / ANALOG_SENSITIVITY;
|
||||||
|
input.analog[0][1] -= y / ANALOG_SENSITIVITY;
|
||||||
|
|
||||||
|
/* Limits */
|
||||||
|
if (input.analog[0][0] < 0) input.analog[0][0] = 0;
|
||||||
|
else if (input.analog[0][0] > 250) input.analog[0][0] = 250;
|
||||||
|
if (input.analog[0][1] < 0) input.analog[0][1] = 0;
|
||||||
|
else if (input.analog[0][1] > 250) input.analog[0][1] = 250;
|
||||||
|
|
||||||
|
/* PEN button */
|
||||||
|
if (p & pad_keymap[KEY_BUTTONA]) input.pad[i] |= INPUT_B;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case DEVICE_ACTIVATOR:
|
case DEVICE_ACTIVATOR:
|
||||||
{
|
{
|
||||||
/* Left & right analog stick angle [0-360] */
|
/* Left & right analog stick angle [0-360] */
|
||||||
@ -475,27 +511,26 @@ static void wpad_config(u8 exp, int chan, int first_key, int last_key)
|
|||||||
char msg[64];
|
char msg[64];
|
||||||
u32 key,p = 255;
|
u32 key,p = 255;
|
||||||
|
|
||||||
/* remove inputs update callback */
|
/* Disable menu inputs update */
|
||||||
VIDEO_SetPostRetraceCallback(NULL);
|
inputs_disabled = 1;
|
||||||
VIDEO_Flush();
|
|
||||||
|
|
||||||
/* Check if device is connected */
|
/* Check if device is connected */
|
||||||
WPAD_Probe(chan, &p);
|
WPAD_Probe(chan, &p);
|
||||||
if (((exp > WPAD_EXP_NONE) && (p != exp)) || (p == 255))
|
if (((exp > WPAD_EXP_NONE) && (p != exp)) || (p == 255))
|
||||||
{
|
{
|
||||||
/* restore inputs update callback */
|
|
||||||
VIDEO_SetPostRetraceCallback(gx_input_UpdateMenu);
|
|
||||||
VIDEO_Flush();
|
|
||||||
|
|
||||||
if (exp == WPAD_EXP_NONE) sprintf(msg, "WIIMOTE #%d is not connected !", chan+1);
|
if (exp == WPAD_EXP_NONE) sprintf(msg, "WIIMOTE #%d is not connected !", chan+1);
|
||||||
if (exp == WPAD_EXP_NUNCHUK) sprintf(msg, "NUNCHUK #%d is not connected !", chan+1);
|
if (exp == WPAD_EXP_NUNCHUK) sprintf(msg, "NUNCHUK #%d is not connected !", chan+1);
|
||||||
if (exp == WPAD_EXP_CLASSIC) sprintf(msg, "CLASSIC #%d is not connected !", chan+1);
|
if (exp == WPAD_EXP_CLASSIC) sprintf(msg, "CLASSIC #%d is not connected !", chan+1);
|
||||||
GUI_WaitPrompt("Error",msg);
|
GUI_WaitPrompt("Error",msg);
|
||||||
|
inputs_disabled = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* loop on each mapped keys */
|
/* loop on each mapped keys */
|
||||||
do
|
do
|
||||||
|
{
|
||||||
|
/* check for unused keys */
|
||||||
|
if (strcmp(keyname[first_key], "N.A"))
|
||||||
{
|
{
|
||||||
/* remove any pending buttons */
|
/* remove any pending buttons */
|
||||||
while (WPAD_ButtonsHeld(chan))
|
while (WPAD_ButtonsHeld(chan))
|
||||||
@ -577,6 +612,7 @@ static void wpad_config(u8 exp, int chan, int first_key, int last_key)
|
|||||||
/* update key mapping */
|
/* update key mapping */
|
||||||
config.wpad_keymap[exp + (chan * 3)][first_key] = key;
|
config.wpad_keymap[exp + (chan * 3)][first_key] = key;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
while (first_key++ < last_key);
|
while (first_key++ < last_key);
|
||||||
|
|
||||||
/* remove any pending buttons */
|
/* remove any pending buttons */
|
||||||
@ -586,9 +622,8 @@ static void wpad_config(u8 exp, int chan, int first_key, int last_key)
|
|||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* restore inputs update callback */
|
/* Enable menu inputs update */
|
||||||
VIDEO_SetPostRetraceCallback(gx_input_UpdateMenu);
|
inputs_disabled = 0;
|
||||||
VIDEO_Flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wpad_update(s8 chan, u8 i, u32 exp)
|
static void wpad_update(s8 chan, u8 i, u32 exp)
|
||||||
@ -860,7 +895,7 @@ static void wpad_update(s8 chan, u8 i, u32 exp)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case DEVICE_TABLET:
|
case DEVICE_PICO:
|
||||||
{
|
{
|
||||||
/* D-PAD */
|
/* D-PAD */
|
||||||
if (p & PAD_BUTTON_UP) input.pad[i] |= INPUT_UP;
|
if (p & PAD_BUTTON_UP) input.pad[i] |= INPUT_UP;
|
||||||
@ -897,6 +932,36 @@ static void wpad_update(s8 chan, u8 i, u32 exp)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case DEVICE_TEREBI:
|
||||||
|
{
|
||||||
|
/* PEN screen position (x,y) */
|
||||||
|
input.analog[0][0] += x / ANALOG_SENSITIVITY;
|
||||||
|
input.analog[0][1] -= y / ANALOG_SENSITIVITY;
|
||||||
|
|
||||||
|
/* Limits */
|
||||||
|
if (input.analog[0][0] < 0) input.analog[0][0] = 0;
|
||||||
|
else if (input.analog[0][0] > 250) input.analog[0][0] = 250;
|
||||||
|
if (input.analog[0][1] < 0) input.analog[0][1] = 0;
|
||||||
|
else if (input.analog[0][1] > 250) input.analog[0][1] = 250;
|
||||||
|
|
||||||
|
/* Wiimote IR */
|
||||||
|
if (exp != WPAD_EXP_CLASSIC)
|
||||||
|
{
|
||||||
|
struct ir_t ir;
|
||||||
|
WPAD_IR(chan, &ir);
|
||||||
|
if (ir.valid)
|
||||||
|
{
|
||||||
|
input.analog[0][0] = (ir.x * 250) / 640;
|
||||||
|
input.analog[0][1] = (ir.y * 250) / 480;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PEN button */
|
||||||
|
if (p & wpad_keymap[KEY_BUTTONA]) input.pad[i] |= INPUT_B;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case DEVICE_ACTIVATOR:
|
case DEVICE_ACTIVATOR:
|
||||||
{
|
{
|
||||||
/* Classic Controller only */
|
/* Classic Controller only */
|
||||||
@ -949,17 +1014,13 @@ static void wpad_update(s8 chan, u8 i, u32 exp)
|
|||||||
/***************************************************************************************/
|
/***************************************************************************************/
|
||||||
void gx_input_Init(void)
|
void gx_input_Init(void)
|
||||||
{
|
{
|
||||||
PAD_Init ();
|
PAD_Init();
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
WPAD_Init();
|
WPAD_Init();
|
||||||
WPAD_SetIdleTimeout(60);
|
WPAD_SetIdleTimeout(60);
|
||||||
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
||||||
WPAD_SetVRes(WPAD_CHAN_ALL,640,480);
|
WPAD_SetVRes(WPAD_CHAN_ALL,640,480);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
VIDEO_SetPostRetraceCallback(gx_input_UpdateMenu);
|
|
||||||
VIDEO_Flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int gx_input_FindDevices(void)
|
int gx_input_FindDevices(void)
|
||||||
@ -1232,28 +1293,34 @@ void gx_input_Config(u8 chan, u8 device, u8 type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case DEVICE_LIGHTGUN:
|
case DEVICE_LIGHTGUN:
|
||||||
{
|
|
||||||
if ((input.system[1] == SYSTEM_MENACER) || (input.system[1] == SYSTEM_JUSTIFIER))
|
|
||||||
{
|
{
|
||||||
first_key = KEY_BUTTONA;
|
first_key = KEY_BUTTONA;
|
||||||
last_key = KEY_START;
|
last_key = KEY_START;
|
||||||
sprintf(keyname[KEY_BUTTONA],"Button A");
|
if (input.system[1] == SYSTEM_MENACER)
|
||||||
|
{
|
||||||
|
sprintf(keyname[KEY_BUTTONA],"TRIGGER Button");
|
||||||
sprintf(keyname[KEY_BUTTONB],"Button B");
|
sprintf(keyname[KEY_BUTTONB],"Button B");
|
||||||
sprintf(keyname[KEY_BUTTONC],"Button C");
|
sprintf(keyname[KEY_BUTTONC],"Button C");
|
||||||
sprintf(keyname[KEY_START],"START Button");
|
sprintf(keyname[KEY_START],"START Button");
|
||||||
}
|
}
|
||||||
|
else if (input.system[1] == SYSTEM_JUSTIFIER)
|
||||||
|
{
|
||||||
|
sprintf(keyname[KEY_BUTTONA],"TRIGGER Button");
|
||||||
|
sprintf(keyname[KEY_BUTTONB],"N.A");
|
||||||
|
sprintf(keyname[KEY_BUTTONC],"N.A");
|
||||||
|
sprintf(keyname[KEY_START],"START Button");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
first_key = KEY_BUTTONB;
|
sprintf(keyname[KEY_BUTTONA],"TRIGGER Button");
|
||||||
last_key = KEY_START;
|
sprintf(keyname[KEY_BUTTONB],"N.A");
|
||||||
sprintf(keyname[KEY_BUTTONB],"Button 1 (Fire)");
|
sprintf(keyname[KEY_BUTTONC],"N.A");
|
||||||
sprintf(keyname[KEY_BUTTONC],"Button 2");
|
|
||||||
sprintf(keyname[KEY_START],"PAUSE Button");
|
sprintf(keyname[KEY_START],"PAUSE Button");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case DEVICE_TABLET:
|
case DEVICE_PICO:
|
||||||
{
|
{
|
||||||
first_key = KEY_BUTTONA;
|
first_key = KEY_BUTTONA;
|
||||||
last_key = KEY_BUTTONB;
|
last_key = KEY_BUTTONB;
|
||||||
@ -1262,6 +1329,14 @@ void gx_input_Config(u8 chan, u8 device, u8 type)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case DEVICE_TEREBI:
|
||||||
|
{
|
||||||
|
first_key = KEY_BUTTONA;
|
||||||
|
last_key = KEY_BUTTONA;
|
||||||
|
sprintf(keyname[KEY_BUTTONA],"PEN Button");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
GUI_WaitPrompt("Info","Activator is not configurable !");
|
GUI_WaitPrompt("Info","Activator is not configurable !");
|
||||||
@ -1322,12 +1397,15 @@ void gx_input_UpdateEmu(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Update RAM patches */
|
/* Update RAM patches */
|
||||||
CheatUpdate();
|
RAMCheatUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Menu inputs update function (done by Video Interrupt callback) */
|
/* Menu inputs update function (done by Video Interrupt callback) */
|
||||||
void gx_input_UpdateMenu(u32 cnt)
|
void gx_input_UpdateMenu(void)
|
||||||
{
|
{
|
||||||
|
/* Check if inputs update are disabled */
|
||||||
|
if (inputs_disabled) return;
|
||||||
|
|
||||||
/* PAD status update */
|
/* PAD status update */
|
||||||
PAD_ScanPads();
|
PAD_ScanPads();
|
||||||
|
|
||||||
|
@ -3,23 +3,39 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX input support
|
* Genesis Plus GX input support
|
||||||
*
|
*
|
||||||
* Eke-Eke (2008,2009)
|
* Copyright Eke-Eke (2007-2011)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _GC_INPUT_H_
|
#ifndef _GC_INPUT_H_
|
||||||
#define _GC_INPUT_H_
|
#define _GC_INPUT_H_
|
||||||
@ -48,6 +64,6 @@ extern int gx_input_FindDevices(void);
|
|||||||
extern void gx_input_SetDefault(void);
|
extern void gx_input_SetDefault(void);
|
||||||
extern void gx_input_Config(u8 chan, u8 device, u8 type);
|
extern void gx_input_Config(u8 chan, u8 device, u8 type);
|
||||||
extern void gx_input_UpdateEmu(void);
|
extern void gx_input_UpdateEmu(void);
|
||||||
extern void gx_input_UpdateMenu(u32 cnt);
|
extern void gx_input_UpdateMenu(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,30 +3,45 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX video & rendering support
|
* Genesis Plus GX video & rendering support
|
||||||
*
|
*
|
||||||
* Softdev (2006)
|
* Copyright Eke-Eke (2007-2011), based on original work from Softdev (2006)
|
||||||
* Eke-Eke (2007,2008,2009)
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "aram.h"
|
|
||||||
#include "md_ntsc.h"
|
#include "md_ntsc.h"
|
||||||
#include "sms_ntsc.h"
|
#include "sms_ntsc.h"
|
||||||
|
#include "gx_input.h"
|
||||||
|
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
|
|
||||||
@ -53,7 +68,7 @@ u8 *texturemem; /* Texture Data */
|
|||||||
u8 *screenshot; /* Texture Data */
|
u8 *screenshot; /* Texture Data */
|
||||||
|
|
||||||
/*** 50/60hz flag ***/
|
/*** 50/60hz flag ***/
|
||||||
u32 gc_pal = 0;
|
u32 gc_pal;
|
||||||
|
|
||||||
/*** NTSC Filters ***/
|
/*** NTSC Filters ***/
|
||||||
sms_ntsc_t *sms_ntsc;
|
sms_ntsc_t *sms_ntsc;
|
||||||
@ -336,7 +351,7 @@ static camera cam = {
|
|||||||
/* VSYNC callback */
|
/* VSYNC callback */
|
||||||
static void vi_callback(u32 cnt)
|
static void vi_callback(u32 cnt)
|
||||||
{
|
{
|
||||||
frameticker++;
|
frameticker ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Vertex Rendering */
|
/* Vertex Rendering */
|
||||||
@ -354,7 +369,7 @@ static inline void draw_square(void)
|
|||||||
draw_vert(2, 1.0, 0.0);
|
draw_vert(2, 1.0, 0.0);
|
||||||
draw_vert(1, 1.0, 1.0);
|
draw_vert(1, 1.0, 1.0);
|
||||||
draw_vert(0, 0.0, 1.0);
|
draw_vert(0, 0.0, 1.0);
|
||||||
GX_End ();
|
GX_End();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize GX */
|
/* Initialize GX */
|
||||||
@ -466,7 +481,7 @@ static void gxSetAspectRatio(int *xscale, int *yscale)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* overscan is simulated (black) */
|
/* overscan is simulated (black) */
|
||||||
*yscale = bitmap.viewport.h / 2;
|
*yscale = vheight / 2;
|
||||||
if (vdp_pal && (!gc_pal || config.render))
|
if (vdp_pal && (!gc_pal || config.render))
|
||||||
*yscale = *yscale * 240 / 288;
|
*yscale = *yscale * 240 / 288;
|
||||||
else if (!vdp_pal && gc_pal && !config.render)
|
else if (!vdp_pal && gc_pal && !config.render)
|
||||||
@ -476,23 +491,23 @@ static void gxSetAspectRatio(int *xscale, int *yscale)
|
|||||||
/* horizontal borders */
|
/* horizontal borders */
|
||||||
if (config.overscan & 2)
|
if (config.overscan & 2)
|
||||||
{
|
{
|
||||||
/* max visible range is ~712 pixels, not 720 */
|
/* max visible range is ~712 pixels (= 348 'H40' pixels) */
|
||||||
*xscale = (reg[12] & 1) ? 356 : 360;
|
*xscale = (reg[12] & 1) ? 356 : 363;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* overscan is simulated (black) */
|
/* overscan is simulated (black) */
|
||||||
*xscale = 327;
|
*xscale = (system_hw == SYSTEM_GG) ? 204 : 327;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 16/9 correction */
|
/* aspect correction for 16:9 screens */
|
||||||
if (config.aspect & 2)
|
if (config.aspect & 2)
|
||||||
{
|
{
|
||||||
*xscale = (*xscale * 3) / 4;
|
*xscale = (*xscale * 3) / 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* manual aspect ratio (default is unscaled raw) */
|
/* manual aspect ratio (default is full screen & not scaled if possible) */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* vertical borders */
|
/* vertical borders */
|
||||||
@ -508,7 +523,7 @@ static void gxSetAspectRatio(int *xscale, int *yscale)
|
|||||||
/* horizontal borders */
|
/* horizontal borders */
|
||||||
if (config.overscan & 2)
|
if (config.overscan & 2)
|
||||||
{
|
{
|
||||||
*xscale = 348;
|
*xscale = (reg[12] & 1) ? 348 : 355;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -639,7 +654,7 @@ static void gxDrawCrosshair(gx_texture *texture, int x, int y)
|
|||||||
GX_Position2s16(x,y);
|
GX_Position2s16(x,y);
|
||||||
GX_Color4u8(0xff,0xff,0xff,0xff);
|
GX_Color4u8(0xff,0xff,0xff,0xff);
|
||||||
GX_TexCoord2f32(0.0, 0.0);
|
GX_TexCoord2f32(0.0, 0.0);
|
||||||
GX_End ();
|
GX_End();
|
||||||
|
|
||||||
/* restore GX rendering */
|
/* restore GX rendering */
|
||||||
gxResetRendering(0);
|
gxResetRendering(0);
|
||||||
@ -675,7 +690,7 @@ void gxDrawRectangle(s32 x, s32 y, s32 w, s32 h, u8 alpha, GXColor color)
|
|||||||
GX_Color4u8(color.r,color.g,color.b,alpha);
|
GX_Color4u8(color.r,color.g,color.b,alpha);
|
||||||
GX_Position2s16(x,y);
|
GX_Position2s16(x,y);
|
||||||
GX_Color4u8(color.r,color.g,color.b,alpha);
|
GX_Color4u8(color.r,color.g,color.b,alpha);
|
||||||
GX_End ();
|
GX_End();
|
||||||
GX_DrawDone();
|
GX_DrawDone();
|
||||||
|
|
||||||
/* restore GX rendering */
|
/* restore GX rendering */
|
||||||
@ -714,7 +729,7 @@ void gxDrawTexture(gx_texture *texture, s32 x, s32 y, s32 w, s32 h, u8 alpha)
|
|||||||
GX_Position2s16(x,y);
|
GX_Position2s16(x,y);
|
||||||
GX_Color4u8(0xff,0xff,0xff,alpha);
|
GX_Color4u8(0xff,0xff,0xff,alpha);
|
||||||
GX_TexCoord2f32(0.0, 0.0);
|
GX_TexCoord2f32(0.0, 0.0);
|
||||||
GX_End ();
|
GX_End();
|
||||||
GX_DrawDone();
|
GX_DrawDone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -759,7 +774,7 @@ void gxDrawTextureRotate(gx_texture *texture, s32 x, s32 y, s32 w, s32 h, f32 an
|
|||||||
GX_Position2s16(-w/2,h/2);
|
GX_Position2s16(-w/2,h/2);
|
||||||
GX_Color4u8(0xff,0xff,0xff,alpha);
|
GX_Color4u8(0xff,0xff,0xff,alpha);
|
||||||
GX_TexCoord2f32(0.0, 1.0);
|
GX_TexCoord2f32(0.0, 1.0);
|
||||||
GX_End ();
|
GX_End();
|
||||||
GX_DrawDone();
|
GX_DrawDone();
|
||||||
|
|
||||||
/* restore default Modelview */
|
/* restore default Modelview */
|
||||||
@ -802,7 +817,7 @@ void gxDrawTextureRepeat(gx_texture *texture, s32 x, s32 y, s32 w, s32 h, u8 alp
|
|||||||
GX_Position2s16(x,y);
|
GX_Position2s16(x,y);
|
||||||
GX_Color4u8(0xff,0xff,0xff,alpha);
|
GX_Color4u8(0xff,0xff,0xff,alpha);
|
||||||
GX_TexCoord2f32(0.0, 0.0);
|
GX_TexCoord2f32(0.0, 0.0);
|
||||||
GX_End ();
|
GX_End();
|
||||||
GX_DrawDone();
|
GX_DrawDone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -834,6 +849,12 @@ void gxDrawScreenshot(u8 alpha)
|
|||||||
s32 w = xscale * 2;
|
s32 w = xscale * 2;
|
||||||
s32 h = yscale * 4;
|
s32 h = yscale * 4;
|
||||||
|
|
||||||
|
/* black out surrounding area if necessary (Game Gear without borders) */
|
||||||
|
if ((w < 640) || (h < 480))
|
||||||
|
{
|
||||||
|
gxDrawRectangle(0, 0, 640, 480, 255, (GXColor)BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
/* draw textured quad */
|
/* draw textured quad */
|
||||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||||
GX_Position2s16(x,y+h);
|
GX_Position2s16(x,y+h);
|
||||||
@ -848,7 +869,7 @@ void gxDrawScreenshot(u8 alpha)
|
|||||||
GX_Position2s16(x,y);
|
GX_Position2s16(x,y);
|
||||||
GX_Color4u8(0xff,0xff,0xff,alpha);
|
GX_Color4u8(0xff,0xff,0xff,alpha);
|
||||||
GX_TexCoord2f32(0.0, 0.0);
|
GX_TexCoord2f32(0.0, 0.0);
|
||||||
GX_End ();
|
GX_End();
|
||||||
GX_DrawDone();
|
GX_DrawDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -861,11 +882,17 @@ void gxCopyScreenshot(gx_texture *texture)
|
|||||||
GX_InvalidateTexAll();
|
GX_InvalidateTexAll();
|
||||||
|
|
||||||
/* scale texture to EFB width */
|
/* scale texture to EFB width */
|
||||||
s32 w = bitmap.viewport.x ? 696 : 640;
|
s32 w = ((bitmap.viewport.w + 2*bitmap.viewport.x) * 640) / bitmap.viewport.w;
|
||||||
s32 h = (bitmap.viewport.h + 2*bitmap.viewport.y) * 2;
|
s32 h = (bitmap.viewport.h + 2*bitmap.viewport.y) * 2;
|
||||||
s32 x = -w/2;
|
s32 x = -w/2;
|
||||||
s32 y = -(240+ 2*bitmap.viewport.y);
|
s32 y = -(240+ 2*bitmap.viewport.y);
|
||||||
|
|
||||||
|
/* black out surrounding area if necessary (Game Gear without borders) */
|
||||||
|
if ((w < 640) || (h < 480))
|
||||||
|
{
|
||||||
|
gxDrawRectangle(0, 0, 640, 480, 255, (GXColor)BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
/* draw textured quad */
|
/* draw textured quad */
|
||||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||||
GX_Position2s16(x,y+h);
|
GX_Position2s16(x,y+h);
|
||||||
@ -880,7 +907,7 @@ void gxCopyScreenshot(gx_texture *texture)
|
|||||||
GX_Position2s16(x,y);
|
GX_Position2s16(x,y);
|
||||||
GX_Color4u8(0xff,0xff,0xff,0xff);
|
GX_Color4u8(0xff,0xff,0xff,0xff);
|
||||||
GX_TexCoord2f32(0.0, 0.0);
|
GX_TexCoord2f32(0.0, 0.0);
|
||||||
GX_End ();
|
GX_End();
|
||||||
|
|
||||||
/* copy EFB to texture */
|
/* copy EFB to texture */
|
||||||
texture->format = GX_TF_RGBA8;
|
texture->format = GX_TF_RGBA8;
|
||||||
@ -928,6 +955,7 @@ void gxSetScreen(void)
|
|||||||
VIDEO_SetNextFramebuffer (xfb[whichfb]);
|
VIDEO_SetNextFramebuffer (xfb[whichfb]);
|
||||||
VIDEO_Flush ();
|
VIDEO_Flush ();
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
gx_input_UpdateMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
void gxClearScreen(GXColor color)
|
void gxClearScreen(GXColor color)
|
||||||
@ -1315,7 +1343,6 @@ void gx_video_Stop(void)
|
|||||||
|
|
||||||
/* default VI settings */
|
/* default VI settings */
|
||||||
VIDEO_SetPreRetraceCallback(NULL);
|
VIDEO_SetPreRetraceCallback(NULL);
|
||||||
VIDEO_SetPostRetraceCallback(gx_input_UpdateMenu);
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
VIDEO_SetTrapFilter(1);
|
VIDEO_SetTrapFilter(1);
|
||||||
VIDEO_SetGamma(VI_GM_1_0);
|
VIDEO_SetGamma(VI_GM_1_0);
|
||||||
@ -1355,9 +1382,8 @@ void gx_video_Start(void)
|
|||||||
if (gc_pal == vdp_pal)
|
if (gc_pal == vdp_pal)
|
||||||
{
|
{
|
||||||
VIDEO_SetPreRetraceCallback(vi_callback);
|
VIDEO_SetPreRetraceCallback(vi_callback);
|
||||||
}
|
|
||||||
VIDEO_SetPostRetraceCallback(NULL);
|
|
||||||
VIDEO_Flush();
|
VIDEO_Flush();
|
||||||
|
}
|
||||||
|
|
||||||
/* set interlaced or progressive video mode */
|
/* set interlaced or progressive video mode */
|
||||||
if (config.render == 2)
|
if (config.render == 2)
|
||||||
@ -1371,8 +1397,17 @@ void gx_video_Start(void)
|
|||||||
tvmodes[2]->xfbMode = VI_XFBMODE_DF;
|
tvmodes[2]->xfbMode = VI_XFBMODE_DF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* force viewport update */
|
/* update horizontal border width */
|
||||||
|
if (system_hw == SYSTEM_GG)
|
||||||
|
{
|
||||||
|
bitmap.viewport.x = (config.overscan & 2) ? 14 : -48;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
bitmap.viewport.x = (config.overscan & 2) * 7;
|
bitmap.viewport.x = (config.overscan & 2) * 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* force viewport update */
|
||||||
bitmap.viewport.changed = 3;
|
bitmap.viewport.changed = 3;
|
||||||
|
|
||||||
/* NTSC filter */
|
/* NTSC filter */
|
||||||
@ -1407,19 +1442,46 @@ void gx_video_Start(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* lightgun textures */
|
/* lightgun textures */
|
||||||
if (config.gun_cursor[0] && ((input.system[1] == SYSTEM_MENACER) || (input.system[1] == SYSTEM_JUSTIFIER) || (input.system[0] == SYSTEM_LIGHTPHASER)))
|
int i, player = 0;
|
||||||
|
for (i=0; i<MAX_DEVICES; i++)
|
||||||
|
{
|
||||||
|
/* Check for emulated lightguns */
|
||||||
|
if (input.dev[i] == DEVICE_LIGHTGUN)
|
||||||
|
{
|
||||||
|
/* Check if input device is affected to player */
|
||||||
|
if (config.input[player].device >= 0)
|
||||||
|
{
|
||||||
|
if ((i == 0) || ((i == 4) && (input.system[1] != SYSTEM_LIGHTPHASER)))
|
||||||
|
{
|
||||||
|
/* Lightgun #1 */
|
||||||
|
if (config.gun_cursor[0])
|
||||||
{
|
{
|
||||||
crosshair[0] = gxTextureOpenPNG(Crosshair_p1_png,0);
|
crosshair[0] = gxTextureOpenPNG(Crosshair_p1_png,0);
|
||||||
}
|
}
|
||||||
if (config.gun_cursor[1] && ((input.system[1] == SYSTEM_JUSTIFIER) || (input.system[1] == SYSTEM_LIGHTPHASER)))
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Lightgun #2 */
|
||||||
|
if (config.gun_cursor[1])
|
||||||
{
|
{
|
||||||
crosshair[1] = gxTextureOpenPNG(Crosshair_p2_png,0);
|
crosshair[1] = gxTextureOpenPNG(Crosshair_p2_png,0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for any emulated device */
|
||||||
|
if (input.dev[i] != NO_DEVICE)
|
||||||
|
{
|
||||||
|
/* increment player index */
|
||||||
|
player++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* GX emulation rendering */
|
/* GX emulation rendering */
|
||||||
gxResetRendering(0);
|
gxResetRendering(0);
|
||||||
|
|
||||||
/* resynchronize emulation with VSYNC*/
|
/* resynchronize emulation with VSYNC */
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1493,7 +1555,7 @@ void gx_video_Update(void)
|
|||||||
/* render textured quad */
|
/* render textured quad */
|
||||||
draw_square();
|
draw_square();
|
||||||
|
|
||||||
/* Lightgun # 1 screen mark */
|
/* lightgun # 1 screen mark */
|
||||||
if (crosshair[0])
|
if (crosshair[0])
|
||||||
{
|
{
|
||||||
if (input.system[0] == SYSTEM_LIGHTPHASER)
|
if (input.system[0] == SYSTEM_LIGHTPHASER)
|
||||||
@ -1506,12 +1568,12 @@ void gx_video_Update(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lightgun # 2 screen mark */
|
/* lightgun #2 screen mark */
|
||||||
if (crosshair[1])
|
if (crosshair[1])
|
||||||
{
|
{
|
||||||
if (input.system[1] == SYSTEM_LIGHTPHASER)
|
if (input.system[1] == SYSTEM_LIGHTPHASER)
|
||||||
{
|
{
|
||||||
gxDrawCrosshair(crosshair[1], input.analog[1][0],input.analog[1][1]);
|
gxDrawCrosshair(crosshair[1], input.analog[4][0],input.analog[4][1]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1533,7 +1595,7 @@ void gx_video_Update(void)
|
|||||||
|
|
||||||
if (update)
|
if (update)
|
||||||
{
|
{
|
||||||
/* Clear update flags */
|
/* clear update flags */
|
||||||
bitmap.viewport.changed &= ~1;
|
bitmap.viewport.changed &= ~1;
|
||||||
|
|
||||||
/* field synchronization */
|
/* field synchronization */
|
||||||
@ -1561,19 +1623,6 @@ void gx_video_Init(void)
|
|||||||
*/
|
*/
|
||||||
VIDEO_Init();
|
VIDEO_Init();
|
||||||
|
|
||||||
/*
|
|
||||||
* Before any memory is allocated etc.
|
|
||||||
* Rescue any tagged ROM in data 2
|
|
||||||
*/
|
|
||||||
int *romptr = (int *)0x80700000;
|
|
||||||
StartARAM();
|
|
||||||
cart.romsize = 0;
|
|
||||||
if (memcmp((char *)romptr,"GENPLUSR",8) == 0)
|
|
||||||
{
|
|
||||||
cart.romsize = romptr[2];
|
|
||||||
ARAMPut((char *) 0x80700000 + 0x20, (char *) 0x8000, cart.romsize);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the current VIDEO mode then :
|
/* Get the current VIDEO mode then :
|
||||||
- set menu VIDEO mode (480p, 480i or 576i)
|
- set menu VIDEO mode (480p, 480i or 576i)
|
||||||
- set emulator rendering TV modes (PAL/MPAL/NTSC/EURGB60)
|
- set emulator rendering TV modes (PAL/MPAL/NTSC/EURGB60)
|
||||||
@ -1647,32 +1696,11 @@ void gx_video_Init(void)
|
|||||||
gxResetMode(vmode);
|
gxResetMode(vmode);
|
||||||
|
|
||||||
/* initialize FONT */
|
/* initialize FONT */
|
||||||
if (!FONT_Init())
|
FONT_Init();
|
||||||
{
|
|
||||||
#ifdef HW_RVL
|
|
||||||
DI_Close();
|
|
||||||
SYS_ResetSystem(SYS_RESTART,0,0);
|
|
||||||
#else
|
|
||||||
SYS_ResetSystem(SYS_HOTRESET,0,0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize textures */
|
/* Initialize textures */
|
||||||
texturemem = memalign(32, TEX_SIZE);
|
texturemem = memalign(32, TEX_SIZE);
|
||||||
screenshot = memalign(32, HASPECT*VASPECT*4);
|
screenshot = memalign(32, HASPECT*VASPECT*4);
|
||||||
if (!texturemem || !screenshot)
|
|
||||||
{
|
|
||||||
FONT_writeCenter("Failed to allocate textures memory... Rebooting",18,0,640,200,(GXColor)WHITE);
|
|
||||||
gxSetScreen();
|
|
||||||
sleep(2);
|
|
||||||
gx_video_Shutdown();
|
|
||||||
#ifdef HW_RVL
|
|
||||||
DI_Close();
|
|
||||||
SYS_ResetSystem(SYS_RESTART,0,0);
|
|
||||||
#else
|
|
||||||
SYS_ResetSystem(SYS_HOTRESET,0,0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gx_video_Shutdown(void)
|
void gx_video_Shutdown(void)
|
||||||
|
@ -3,24 +3,39 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX video support
|
* Genesis Plus GX video support
|
||||||
*
|
*
|
||||||
* Softdev (2006)
|
* Copyright Eke-Eke (2007-2011), based on original work from Softdev (2006)
|
||||||
* Eke-Eke (2007,2008,2009)
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _GC_VIDEO_H_
|
#ifndef _GC_VIDEO_H_
|
||||||
#define _GC_VIDEO_H_
|
#define _GC_VIDEO_H_
|
||||||
@ -47,7 +62,6 @@ extern GXRModeObj *vmode;
|
|||||||
extern u8 *texturemem;
|
extern u8 *texturemem;
|
||||||
extern u32 gc_pal;
|
extern u32 gc_pal;
|
||||||
|
|
||||||
|
|
||||||
/* GX rendering */
|
/* GX rendering */
|
||||||
extern void gxDrawRectangle(s32 x, s32 y, s32 w, s32 h, u8 alpha, GXColor color);
|
extern void gxDrawRectangle(s32 x, s32 y, s32 w, s32 h, u8 alpha, GXColor color);
|
||||||
extern void gxDrawTexture(gx_texture *texture, s32 x, s32 y, s32 w, s32 h, u8 alpha);
|
extern void gxDrawTexture(gx_texture *texture, s32 x, s32 y, s32 w, s32 h, u8 alpha);
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 23 KiB |
311
source/gx/main.c
311
source/gx/main.c
@ -3,30 +3,44 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX
|
* Genesis Plus GX
|
||||||
*
|
*
|
||||||
* Softdev (2006)
|
* Copyright Eke-Eke (2007-2011), based on original work from Softdev (2006)
|
||||||
* Eke-Eke (2007-2010)
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "aram.h"
|
|
||||||
#include "history.h"
|
#include "history.h"
|
||||||
#include "file_slot.h"
|
#include "file_slot.h"
|
||||||
#include "file_load.h"
|
#include "file_load.h"
|
||||||
@ -37,6 +51,7 @@
|
|||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
|
#include <ogc/machine/processor.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* audio "exact" samplerate, measured on real hardware */
|
/* audio "exact" samplerate, measured on real hardware */
|
||||||
@ -48,6 +63,7 @@
|
|||||||
|
|
||||||
u32 Shutdown = 0;
|
u32 Shutdown = 0;
|
||||||
u32 ConfigRequested = 1;
|
u32 ConfigRequested = 1;
|
||||||
|
u32 frameticker;
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -65,7 +81,16 @@ static void PowerOff_cb(void)
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static void Reset_cb(void)
|
static void Reset_cb(void)
|
||||||
{
|
{
|
||||||
|
if (system_hw & SYSTEM_MD)
|
||||||
|
{
|
||||||
|
/* SOFT-RESET */
|
||||||
gen_reset(0);
|
gen_reset(0);
|
||||||
|
}
|
||||||
|
else if (system_hw == SYSTEM_SMS)
|
||||||
|
{
|
||||||
|
/* assert RESET input */
|
||||||
|
io_reg[0x0D] &= ~IO_RESET_HI;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -97,31 +122,15 @@ static void init_machine(void)
|
|||||||
{
|
{
|
||||||
/* allocate cart.rom here (10 MBytes) */
|
/* allocate cart.rom here (10 MBytes) */
|
||||||
cart.rom = memalign(32, MAXROMSIZE);
|
cart.rom = memalign(32, MAXROMSIZE);
|
||||||
if (!cart.rom)
|
|
||||||
{
|
|
||||||
FONT_writeCenter("Failed to allocate ROM buffer... Rebooting",18,0,640,200,(GXColor)WHITE);
|
|
||||||
gxSetScreen();
|
|
||||||
sleep(2);
|
|
||||||
gx_audio_Shutdown();
|
|
||||||
gx_video_Shutdown();
|
|
||||||
#ifdef HW_RVL
|
|
||||||
DI_Close();
|
|
||||||
SYS_ResetSystem(SYS_RESTART,0,0);
|
|
||||||
#else
|
|
||||||
SYS_ResetSystem(SYS_HOTRESET,0,0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* BIOS support */
|
/* BIOS support */
|
||||||
load_bios();
|
load_bios();
|
||||||
|
|
||||||
/* allocate global work bitmap */
|
/* allocate global work bitmap */
|
||||||
memset (&bitmap, 0, sizeof (bitmap));
|
memset(&bitmap, 0, sizeof (bitmap));
|
||||||
bitmap.width = 720;
|
bitmap.width = 720;
|
||||||
bitmap.height = 576;
|
bitmap.height = 576;
|
||||||
bitmap.depth = 16;
|
bitmap.pitch = bitmap.width * 2;
|
||||||
bitmap.granularity = 2;
|
|
||||||
bitmap.pitch = bitmap.width * bitmap.granularity;
|
|
||||||
bitmap.viewport.w = 256;
|
bitmap.viewport.w = 256;
|
||||||
bitmap.viewport.h = 224;
|
bitmap.viewport.h = 224;
|
||||||
bitmap.viewport.x = 0;
|
bitmap.viewport.x = 0;
|
||||||
@ -129,6 +138,63 @@ static void init_machine(void)
|
|||||||
bitmap.data = texturemem;
|
bitmap.data = texturemem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*******************************************
|
||||||
|
Restart emulation when loading a new game
|
||||||
|
********************************************/
|
||||||
|
static void reload(void)
|
||||||
|
{
|
||||||
|
/* Cartridge Hot Swap (make sure system has already been inited once) */
|
||||||
|
if (config.hot_swap && snd.enabled)
|
||||||
|
{
|
||||||
|
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||||
|
{
|
||||||
|
md_cart_init();
|
||||||
|
md_cart_reset(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sms_cart_init();
|
||||||
|
sms_cart_reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Initialize audio emulation */
|
||||||
|
/* To prevent any sound skipping, sound chips must run at the exact same speed as the rest of emulation (see sound.c) */
|
||||||
|
/* When TV output mode matches emulated video mode, we use video hardware interrupt (VSYNC) and exact framerates for perfect synchronization */
|
||||||
|
/* In 60Hz TV modes, Wii & GC framerates have been measured to be 59.94 (interlaced or progressive) and ~59.825 fps (non-interlaced) */
|
||||||
|
/* In 50Hz TV modes, Wii & GC framerates have been measured to be 50.00 (interlaced) and ~50.845 fps (non-interlaced) */
|
||||||
|
/* When modes does not match, emulation is synchronized with audio hardware interrupt (DMA) and we use default framerates (50Hz for PAL, 60Hz for NTSC). */
|
||||||
|
if (vdp_pal)
|
||||||
|
{
|
||||||
|
audio_init(SAMPLERATE_48KHZ, (config.tv_mode == 0) ? 50.0 : (config.render ? 50.00 : (1000000.0/19968.0)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
audio_init(SAMPLERATE_48KHZ, (config.tv_mode == 1) ? 60.0 : (config.render ? 59.94 : (1000000.0/16715.0)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Switch virtual system on */
|
||||||
|
system_init();
|
||||||
|
system_reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Auto-Load SRAM file */
|
||||||
|
if (config.s_auto & 1)
|
||||||
|
{
|
||||||
|
slot_autoload(0,config.s_device);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Auto-Load State file */
|
||||||
|
if (config.s_auto & 2)
|
||||||
|
{
|
||||||
|
slot_autoload(config.s_default,config.s_device);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Load Cheat file */
|
||||||
|
CheatLoad();
|
||||||
|
}
|
||||||
|
|
||||||
static void run_emulation(void)
|
static void run_emulation(void)
|
||||||
{
|
{
|
||||||
/* main emulation loop */
|
/* main emulation loop */
|
||||||
@ -142,8 +208,12 @@ static void run_emulation(void)
|
|||||||
gx_video_Stop();
|
gx_video_Stop();
|
||||||
|
|
||||||
/* show menu */
|
/* show menu */
|
||||||
menu_execute();
|
|
||||||
ConfigRequested = 0;
|
ConfigRequested = 0;
|
||||||
|
if (menu_execute())
|
||||||
|
{
|
||||||
|
/* new ROM has been loaded */
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
/* start video & audio */
|
/* start video & audio */
|
||||||
gx_video_Start();
|
gx_video_Start();
|
||||||
@ -151,7 +221,7 @@ static void run_emulation(void)
|
|||||||
frameticker = 1;
|
frameticker = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* automatic frame skipping */
|
/* automatic frame skipping (only necessary for Virtua Racing in Gamecube mode) */
|
||||||
if (frameticker > 1)
|
if (frameticker > 1)
|
||||||
{
|
{
|
||||||
/* skip frame */
|
/* skip frame */
|
||||||
@ -200,77 +270,6 @@ static void run_emulation(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************
|
|
||||||
Load a new rom and performs some initialization
|
|
||||||
***************************************************/
|
|
||||||
void reloadrom (int size, char *name)
|
|
||||||
{
|
|
||||||
/* hot-swap previous & current cartridge */
|
|
||||||
bool hotswap = config.hot_swap && cart.romsize;
|
|
||||||
|
|
||||||
/* ROM size */
|
|
||||||
cart.romsize = size;
|
|
||||||
|
|
||||||
/* load ROM file */
|
|
||||||
load_rom(name);
|
|
||||||
|
|
||||||
/* ROM filename without extension*/
|
|
||||||
sprintf(rom_filename,"%s",name);
|
|
||||||
int i = strlen(rom_filename) - 1;
|
|
||||||
while ((i > 0) && (rom_filename[i] != '.')) i--;
|
|
||||||
if (i > 0) rom_filename[i] = 0;
|
|
||||||
|
|
||||||
if (hotswap)
|
|
||||||
{
|
|
||||||
if (system_hw == SYSTEM_PBC)
|
|
||||||
{
|
|
||||||
sms_cart_init();
|
|
||||||
sms_cart_reset();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
md_cart_init();
|
|
||||||
md_cart_reset(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Initialize audio emulation */
|
|
||||||
/* To prevent any sound skipping, sound chips must run at the exact same speed as the rest of emulation (see sound.c) */
|
|
||||||
/* When TV output mode matches emulated video mode, we use video hardware interrupt (VSYNC) and exact framerates for perfect synchronization */
|
|
||||||
/* In 60Hz TV modes, Wii & GC framerates have been measured to be 59.94 (interlaced or progressive) and ~59.825 fps (non-interlaced) */
|
|
||||||
/* In 50Hz TV modes, Wii & GC framerates have been measured to be 50.00 (interlaced) and ~50.845 fps (non-interlaced) */
|
|
||||||
/* When modes does not match, emulation is synchronized with audio hardware interrupt (DMA) and we use default framerates (50Hz for PAL, 60Hz for NTSC). */
|
|
||||||
if (vdp_pal)
|
|
||||||
{
|
|
||||||
audio_init(SAMPLERATE_48KHZ, (config.tv_mode == 0) ? 50.0 : (config.render ? 50.00 : (1000000.0/19968.0)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
audio_init(SAMPLERATE_48KHZ, (config.tv_mode == 1) ? 60.0 : (config.render ? 59.94 : (1000000.0/16715.0)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* system power ON */
|
|
||||||
system_init ();
|
|
||||||
system_reset ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* load Cheats */
|
|
||||||
CheatLoad();
|
|
||||||
|
|
||||||
/* load SRAM */
|
|
||||||
if (config.s_auto & 1)
|
|
||||||
{
|
|
||||||
slot_autoload(0,config.s_device);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* load State */
|
|
||||||
if (config.s_auto & 2)
|
|
||||||
{
|
|
||||||
slot_autoload(config.s_default,config.s_device);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
Shutdown everything properly
|
Shutdown everything properly
|
||||||
***************************************************/
|
***************************************************/
|
||||||
@ -300,13 +299,12 @@ void shutdown(void)
|
|||||||
* M A I N
|
* M A I N
|
||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
u32 frameticker = 0;
|
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char pathname[MAXPATHLEN];
|
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
|
/* enable 64-byte fetch mode for L2 cache */
|
||||||
|
L2Enhance();
|
||||||
|
|
||||||
/* initialize DI interface */
|
/* initialize DI interface */
|
||||||
DI_UseCache(0);
|
DI_UseCache(0);
|
||||||
DI_Init();
|
DI_Init();
|
||||||
@ -317,7 +315,7 @@ int main (int argc, char *argv[])
|
|||||||
|
|
||||||
#ifdef HW_DOL
|
#ifdef HW_DOL
|
||||||
/* initialize DVD interface */
|
/* initialize DVD interface */
|
||||||
DVD_Init ();
|
DVD_Init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* initialize input engine */
|
/* initialize input engine */
|
||||||
@ -338,27 +336,76 @@ int main (int argc, char *argv[])
|
|||||||
if (fatMounted)
|
if (fatMounted)
|
||||||
{
|
{
|
||||||
/* base directory */
|
/* base directory */
|
||||||
|
char pathname[MAXPATHLEN];
|
||||||
sprintf (pathname, DEFAULT_PATH);
|
sprintf (pathname, DEFAULT_PATH);
|
||||||
DIR_ITER *dir = diropen(pathname);
|
DIR *dir = opendir(pathname);
|
||||||
if (dir) dirclose(dir);
|
if (dir) closedir(dir);
|
||||||
else mkdir(pathname,S_IRWXU);
|
else mkdir(pathname,S_IRWXU);
|
||||||
|
|
||||||
/* default SRAM & Savestate files directory */
|
/* default SRAM & Savestate files directories */
|
||||||
sprintf (pathname, "%s/saves",DEFAULT_PATH);
|
sprintf (pathname, "%s/saves",DEFAULT_PATH);
|
||||||
dir = diropen(pathname);
|
dir = opendir(pathname);
|
||||||
if (dir) dirclose(dir);
|
if (dir) closedir(dir);
|
||||||
|
else mkdir(pathname,S_IRWXU);
|
||||||
|
sprintf (pathname, "%s/saves/md",DEFAULT_PATH);
|
||||||
|
dir = opendir(pathname);
|
||||||
|
if (dir) closedir(dir);
|
||||||
|
else mkdir(pathname,S_IRWXU);
|
||||||
|
sprintf (pathname, "%s/saves/ms",DEFAULT_PATH);
|
||||||
|
dir = opendir(pathname);
|
||||||
|
if (dir) closedir(dir);
|
||||||
|
else mkdir(pathname,S_IRWXU);
|
||||||
|
sprintf (pathname, "%s/saves/gg",DEFAULT_PATH);
|
||||||
|
dir = opendir(pathname);
|
||||||
|
if (dir) closedir(dir);
|
||||||
|
else mkdir(pathname,S_IRWXU);
|
||||||
|
sprintf (pathname, "%s/saves/sg",DEFAULT_PATH);
|
||||||
|
dir = opendir(pathname);
|
||||||
|
if (dir) closedir(dir);
|
||||||
else mkdir(pathname,S_IRWXU);
|
else mkdir(pathname,S_IRWXU);
|
||||||
|
|
||||||
/* default Snapshot files directory */
|
/* default Snapshot files directories */
|
||||||
sprintf (pathname, "%s/snaps",DEFAULT_PATH);
|
sprintf (pathname, "%s/snaps",DEFAULT_PATH);
|
||||||
dir = diropen(pathname);
|
dir = opendir(pathname);
|
||||||
if (dir) dirclose(dir);
|
if (dir) closedir(dir);
|
||||||
|
else mkdir(pathname,S_IRWXU);
|
||||||
|
sprintf (pathname, "%s/snaps/md",DEFAULT_PATH);
|
||||||
|
dir = opendir(pathname);
|
||||||
|
if (dir) closedir(dir);
|
||||||
|
else mkdir(pathname,S_IRWXU);
|
||||||
|
sprintf (pathname, "%s/snaps/ms",DEFAULT_PATH);
|
||||||
|
dir = opendir(pathname);
|
||||||
|
if (dir) closedir(dir);
|
||||||
|
else mkdir(pathname,S_IRWXU);
|
||||||
|
sprintf (pathname, "%s/snaps/gg",DEFAULT_PATH);
|
||||||
|
dir = opendir(pathname);
|
||||||
|
if (dir) closedir(dir);
|
||||||
|
else mkdir(pathname,S_IRWXU);
|
||||||
|
sprintf (pathname, "%s/snaps/sg",DEFAULT_PATH);
|
||||||
|
dir = opendir(pathname);
|
||||||
|
if (dir) closedir(dir);
|
||||||
else mkdir(pathname,S_IRWXU);
|
else mkdir(pathname,S_IRWXU);
|
||||||
|
|
||||||
/* default Cheat files directory */
|
/* default Cheat files directories */
|
||||||
sprintf (pathname, "%s/cheats",DEFAULT_PATH);
|
sprintf (pathname, "%s/cheats",DEFAULT_PATH);
|
||||||
dir = diropen(pathname);
|
dir = opendir(pathname);
|
||||||
if (dir) dirclose(dir);
|
if (dir) closedir(dir);
|
||||||
|
else mkdir(pathname,S_IRWXU);
|
||||||
|
sprintf (pathname, "%s/cheats/md",DEFAULT_PATH);
|
||||||
|
dir = opendir(pathname);
|
||||||
|
if (dir) closedir(dir);
|
||||||
|
else mkdir(pathname,S_IRWXU);
|
||||||
|
sprintf (pathname, "%s/cheats/ms",DEFAULT_PATH);
|
||||||
|
dir = opendir(pathname);
|
||||||
|
if (dir) closedir(dir);
|
||||||
|
else mkdir(pathname,S_IRWXU);
|
||||||
|
sprintf (pathname, "%s/cheats/gg",DEFAULT_PATH);
|
||||||
|
dir = opendir(pathname);
|
||||||
|
if (dir) closedir(dir);
|
||||||
|
else mkdir(pathname,S_IRWXU);
|
||||||
|
sprintf (pathname, "%s/cheats/sg",DEFAULT_PATH);
|
||||||
|
dir = opendir(pathname);
|
||||||
|
if (dir) closedir(dir);
|
||||||
else mkdir(pathname,S_IRWXU);
|
else mkdir(pathname,S_IRWXU);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,27 +418,15 @@ int main (int argc, char *argv[])
|
|||||||
history_default();
|
history_default();
|
||||||
init_machine();
|
init_machine();
|
||||||
|
|
||||||
/* run any injected rom */
|
/* auto-load last ROM file */
|
||||||
if (cart.romsize)
|
if (config.autoload)
|
||||||
{
|
|
||||||
int size = cart.romsize;
|
|
||||||
cart.romsize = 0;
|
|
||||||
ARAMFetch((char *)cart.rom, (void *)0x8000, size);
|
|
||||||
reloadrom(size,"INJECT.bin");
|
|
||||||
ConfigRequested = 0;
|
|
||||||
gx_video_Start();
|
|
||||||
gx_audio_Start();
|
|
||||||
frameticker = 1;
|
|
||||||
}
|
|
||||||
else if (config.autoload)
|
|
||||||
{
|
{
|
||||||
SILENT = 1;
|
SILENT = 1;
|
||||||
if (OpenDirectory(TYPE_RECENT))
|
if (OpenDirectory(TYPE_RECENT))
|
||||||
{
|
{
|
||||||
int size = LoadFile(cart.rom,0,pathname);
|
if (LoadFile(0))
|
||||||
if (size)
|
|
||||||
{
|
{
|
||||||
reloadrom(size,pathname);
|
reload();
|
||||||
gx_video_Start();
|
gx_video_Start();
|
||||||
gx_audio_Start();
|
gx_audio_Start();
|
||||||
frameticker = 1;
|
frameticker = 1;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <sys/dir.h>
|
#include <sys/dir.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <asndlib.h>
|
#include <asndlib.h>
|
||||||
#include <oggplayer.h>
|
#include <oggplayer.h>
|
||||||
|
|
||||||
@ -22,6 +22,7 @@
|
|||||||
#include "gx_audio.h"
|
#include "gx_audio.h"
|
||||||
#include "gx_video.h"
|
#include "gx_video.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "fileio.h"
|
||||||
|
|
||||||
#define DEFAULT_PATH "/genplus"
|
#define DEFAULT_PATH "/genplus"
|
||||||
#define GG_ROM "/genplus/ggenie.bin"
|
#define GG_ROM "/genplus/ggenie.bin"
|
||||||
@ -31,20 +32,18 @@
|
|||||||
#define SK_UPMEM "/genplus/sk2chip.bin"
|
#define SK_UPMEM "/genplus/sk2chip.bin"
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
#define VERSION "Genesis Plus GX 1.5.0 (WII)"
|
#define VERSION "Genesis Plus GX 1.6.0 (WII)"
|
||||||
#else
|
#else
|
||||||
#define VERSION "Genesis Plus GX 1.5.0 (GCN)"
|
#define VERSION "Genesis Plus GX 1.6.0 (GCN)"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define osd_input_Update() gx_input_UpdateEmu()
|
#define osd_input_Update() gx_input_UpdateEmu()
|
||||||
|
|
||||||
/* globals */
|
/* globals */
|
||||||
extern void error(char *format, ...);
|
extern void error(char *format, ...);
|
||||||
extern void ClearGGCodes();
|
extern void legal(void);
|
||||||
extern void GetGGEntries();
|
extern void reloadrom (char *name);
|
||||||
extern void legal();
|
extern void shutdown(void);
|
||||||
extern void reloadrom (int size, char *name);
|
|
||||||
extern void shutdown();
|
|
||||||
extern u32 frameticker;
|
extern u32 frameticker;
|
||||||
extern u32 Shutdown;
|
extern u32 Shutdown;
|
||||||
extern u32 ConfigRequested;
|
extern u32 ConfigRequested;
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
Copyright (c) 2008 Francisco Muñoz 'Hermes' <www.elotrolado.net>
|
Copyright (c) 2008 Francisco Muñoz 'Hermes' <www.elotrolado.net>
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
Proper (standard) vorbis usage by Tantric, 2009
|
||||||
|
Threading modifications/corrections by Tantric, 2009
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are
|
Redistribution and use in source and binary forms, with or without modification, are
|
||||||
permitted provided that the following conditions are met:
|
permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
@ -3,24 +3,40 @@
|
|||||||
*
|
*
|
||||||
* Wii Audio/Video Encoder support
|
* Wii Audio/Video Encoder support
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Hector Martin (marcan)
|
* Copyright (C) 2009 Eke-Eke, with some code from libogc (C) Hector Martin
|
||||||
* Additional code by Eke-Eke
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -3,24 +3,39 @@
|
|||||||
*
|
*
|
||||||
* Wii Audio/Video Encoder support
|
* Wii Audio/Video Encoder support
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Hector Martin (marcan)
|
* Copyright (C) 2009 Eke-Eke, with some code from libogc (C) Hector Martin
|
||||||
* Additional code by Eke-Eke
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
40
source/hvc.h
40
source/hvc.h
@ -3,21 +3,37 @@
|
|||||||
* HV Counters
|
* HV Counters
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald
|
||||||
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
@ -2,21 +2,37 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Sega Activator support
|
* Sega Activator support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2011)
|
* Copyright (C) 2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
@ -2,21 +2,37 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Sega Activator support
|
* Sega Activator support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2011)
|
* Copyright (C) 2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
@ -1,23 +1,39 @@
|
|||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* 3-Buttons & 6-Buttons pad support (incl. 4-WayPlay & J-Cart handlers)
|
* 3-Buttons & 6-Buttons pad support
|
||||||
|
* Support for J-CART & 4-Way Play adapters
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
* Eke-Eke (2007-2011), additional code & fixes for the GCN/Wii port
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
@ -64,7 +80,7 @@ static inline unsigned char gamepad_read(int port)
|
|||||||
unsigned int val = input.pad[port];
|
unsigned int val = input.pad[port];
|
||||||
|
|
||||||
/* get current step (TH state) */
|
/* get current step (TH state) */
|
||||||
unsigned int step = (gamepad[port].Counter & 6) | ((data >> 6) & 1);
|
unsigned int step = gamepad[port].Counter | ((data >> 6) & 1);
|
||||||
|
|
||||||
switch (step)
|
switch (step)
|
||||||
{
|
{
|
||||||
@ -133,10 +149,10 @@ static inline void gamepad_write(int port, unsigned char data, unsigned char mas
|
|||||||
|
|
||||||
if (input.dev[port] == DEVICE_PAD6B)
|
if (input.dev[port] == DEVICE_PAD6B)
|
||||||
{
|
{
|
||||||
/* check TH transitions */
|
/* TH=0 to TH=1 transition */
|
||||||
if ((gamepad[port].State ^ data) & 0x40)
|
if (!(gamepad[port].State & 0x40) && (data & 0x40))
|
||||||
{
|
{
|
||||||
gamepad[port].Counter++;
|
gamepad[port].Counter = (gamepad[port].Counter + 2) & 6;
|
||||||
gamepad[port].Timeout = 0;
|
gamepad[port].Timeout = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,39 @@
|
|||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* 3-Buttons & 6-Buttons pad support (incl. 4-WayPlay & J-Cart handlers)
|
* 3-Buttons & 6-Buttons pad support
|
||||||
|
* Support for J-CART & 4-Way Play adapters
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
* Eke-Eke (2007-2011), additional code & fixes for the GCN/Wii port
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
@ -3,21 +3,37 @@
|
|||||||
* Input peripherals support
|
* Input peripherals support
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
||||||
* Eke-Eke (2007-2011), additional code & fixes for the GCN/Wii port
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
@ -30,6 +46,7 @@
|
|||||||
#include "teamplayer.h"
|
#include "teamplayer.h"
|
||||||
#include "paddle.h"
|
#include "paddle.h"
|
||||||
#include "sportspad.h"
|
#include "sportspad.h"
|
||||||
|
#include "terebi_oekaki.h"
|
||||||
|
|
||||||
t_input input;
|
t_input input;
|
||||||
int old_system[2] = {-1,-1};
|
int old_system[2] = {-1,-1};
|
||||||
@ -46,10 +63,17 @@ void input_init(void)
|
|||||||
input.pad[i] = 0;
|
input.pad[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PICO tablet & pen */
|
/* PICO tablet */
|
||||||
if (system_hw == SYSTEM_PICO)
|
if (system_hw == SYSTEM_PICO)
|
||||||
{
|
{
|
||||||
input.dev[0] = DEVICE_TABLET;
|
input.dev[0] = DEVICE_PICO;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Terebi Oekaki tablet */
|
||||||
|
if (cart.special & HW_TEREBI_OEKAKI)
|
||||||
|
{
|
||||||
|
input.dev[0] = DEVICE_TEREBI;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +81,6 @@ void input_init(void)
|
|||||||
{
|
{
|
||||||
case SYSTEM_MS_GAMEPAD:
|
case SYSTEM_MS_GAMEPAD:
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
|
||||||
input.dev[0] = DEVICE_PAD2B;
|
input.dev[0] = DEVICE_PAD2B;
|
||||||
player++;
|
player++;
|
||||||
break;
|
break;
|
||||||
@ -65,7 +88,6 @@ void input_init(void)
|
|||||||
|
|
||||||
case SYSTEM_MD_GAMEPAD:
|
case SYSTEM_MD_GAMEPAD:
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
|
||||||
input.dev[0] = config.input[player].padtype;
|
input.dev[0] = config.input[player].padtype;
|
||||||
player++;
|
player++;
|
||||||
break;
|
break;
|
||||||
@ -73,7 +95,6 @@ void input_init(void)
|
|||||||
|
|
||||||
case SYSTEM_MOUSE:
|
case SYSTEM_MOUSE:
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
|
||||||
input.dev[0] = DEVICE_MOUSE;
|
input.dev[0] = DEVICE_MOUSE;
|
||||||
player++;
|
player++;
|
||||||
break;
|
break;
|
||||||
@ -81,7 +102,6 @@ void input_init(void)
|
|||||||
|
|
||||||
case SYSTEM_ACTIVATOR:
|
case SYSTEM_ACTIVATOR:
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
|
||||||
input.dev[0] = DEVICE_ACTIVATOR;
|
input.dev[0] = DEVICE_ACTIVATOR;
|
||||||
player++;
|
player++;
|
||||||
break;
|
break;
|
||||||
@ -89,7 +109,6 @@ void input_init(void)
|
|||||||
|
|
||||||
case SYSTEM_XE_A1P:
|
case SYSTEM_XE_A1P:
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
|
||||||
input.dev[0] = DEVICE_XE_A1P;
|
input.dev[0] = DEVICE_XE_A1P;
|
||||||
player++;
|
player++;
|
||||||
break;
|
break;
|
||||||
@ -99,10 +118,12 @@ void input_init(void)
|
|||||||
{
|
{
|
||||||
for (i=0; i< 4; i++)
|
for (i=0; i< 4; i++)
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
if (player < MAX_INPUTS)
|
||||||
|
{
|
||||||
input.dev[i] = config.input[player].padtype;
|
input.dev[i] = config.input[player].padtype;
|
||||||
player++;
|
player++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,17 +131,18 @@ void input_init(void)
|
|||||||
{
|
{
|
||||||
for (i=0; i<4; i++)
|
for (i=0; i<4; i++)
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
if (player < MAX_INPUTS)
|
||||||
|
{
|
||||||
input.dev[i] = config.input[player].padtype;
|
input.dev[i] = config.input[player].padtype;
|
||||||
player++;
|
player++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
teamplayer_init(0);
|
teamplayer_init(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SYSTEM_LIGHTPHASER:
|
case SYSTEM_LIGHTPHASER:
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
|
||||||
input.dev[0] = DEVICE_LIGHTGUN;
|
input.dev[0] = DEVICE_LIGHTGUN;
|
||||||
player++;
|
player++;
|
||||||
break;
|
break;
|
||||||
@ -128,7 +150,6 @@ void input_init(void)
|
|||||||
|
|
||||||
case SYSTEM_PADDLE:
|
case SYSTEM_PADDLE:
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
|
||||||
input.dev[0] = DEVICE_PADDLE;
|
input.dev[0] = DEVICE_PADDLE;
|
||||||
player++;
|
player++;
|
||||||
break;
|
break;
|
||||||
@ -136,18 +157,21 @@ void input_init(void)
|
|||||||
|
|
||||||
case SYSTEM_SPORTSPAD:
|
case SYSTEM_SPORTSPAD:
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
|
||||||
input.dev[0] = DEVICE_SPORTSPAD;
|
input.dev[0] = DEVICE_SPORTSPAD;
|
||||||
player++;
|
player++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player == MAX_INPUTS)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (input.system[1])
|
switch (input.system[1])
|
||||||
{
|
{
|
||||||
case SYSTEM_MS_GAMEPAD:
|
case SYSTEM_MS_GAMEPAD:
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
|
||||||
input.dev[4] = DEVICE_PAD2B;
|
input.dev[4] = DEVICE_PAD2B;
|
||||||
player++;
|
player++;
|
||||||
break;
|
break;
|
||||||
@ -155,7 +179,6 @@ void input_init(void)
|
|||||||
|
|
||||||
case SYSTEM_MD_GAMEPAD:
|
case SYSTEM_MD_GAMEPAD:
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
|
||||||
input.dev[4] = config.input[player].padtype;
|
input.dev[4] = config.input[player].padtype;
|
||||||
player++;
|
player++;
|
||||||
break;
|
break;
|
||||||
@ -163,7 +186,6 @@ void input_init(void)
|
|||||||
|
|
||||||
case SYSTEM_MOUSE:
|
case SYSTEM_MOUSE:
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
|
||||||
input.dev[4] = DEVICE_MOUSE;
|
input.dev[4] = DEVICE_MOUSE;
|
||||||
player++;
|
player++;
|
||||||
break;
|
break;
|
||||||
@ -171,7 +193,6 @@ void input_init(void)
|
|||||||
|
|
||||||
case SYSTEM_ACTIVATOR:
|
case SYSTEM_ACTIVATOR:
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
|
||||||
input.dev[4] = DEVICE_ACTIVATOR;
|
input.dev[4] = DEVICE_ACTIVATOR;
|
||||||
player++;
|
player++;
|
||||||
break;
|
break;
|
||||||
@ -179,7 +200,6 @@ void input_init(void)
|
|||||||
|
|
||||||
case SYSTEM_MENACER:
|
case SYSTEM_MENACER:
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
|
||||||
input.dev[4] = DEVICE_LIGHTGUN;
|
input.dev[4] = DEVICE_LIGHTGUN;
|
||||||
player++;
|
player++;
|
||||||
break;
|
break;
|
||||||
@ -189,10 +209,12 @@ void input_init(void)
|
|||||||
{
|
{
|
||||||
for (i=4; i<6; i++)
|
for (i=4; i<6; i++)
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
if (player < MAX_INPUTS)
|
||||||
|
{
|
||||||
input.dev[i] = DEVICE_LIGHTGUN;
|
input.dev[i] = DEVICE_LIGHTGUN;
|
||||||
player++;
|
player++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,17 +222,18 @@ void input_init(void)
|
|||||||
{
|
{
|
||||||
for (i=4; i<8; i++)
|
for (i=4; i<8; i++)
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
if (player < MAX_INPUTS)
|
||||||
|
{
|
||||||
input.dev[i] = config.input[player].padtype;
|
input.dev[i] = config.input[player].padtype;
|
||||||
player++;
|
player++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
teamplayer_init(1);
|
teamplayer_init(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SYSTEM_LIGHTPHASER:
|
case SYSTEM_LIGHTPHASER:
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
|
||||||
input.dev[4] = DEVICE_LIGHTGUN;
|
input.dev[4] = DEVICE_LIGHTGUN;
|
||||||
player++;
|
player++;
|
||||||
break;
|
break;
|
||||||
@ -218,7 +241,6 @@ void input_init(void)
|
|||||||
|
|
||||||
case SYSTEM_PADDLE:
|
case SYSTEM_PADDLE:
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
|
||||||
input.dev[4] = DEVICE_PADDLE;
|
input.dev[4] = DEVICE_PADDLE;
|
||||||
player++;
|
player++;
|
||||||
break;
|
break;
|
||||||
@ -226,7 +248,6 @@ void input_init(void)
|
|||||||
|
|
||||||
case SYSTEM_SPORTSPAD:
|
case SYSTEM_SPORTSPAD:
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
|
||||||
input.dev[4] = DEVICE_SPORTSPAD;
|
input.dev[4] = DEVICE_SPORTSPAD;
|
||||||
player++;
|
player++;
|
||||||
break;
|
break;
|
||||||
@ -239,11 +260,13 @@ void input_init(void)
|
|||||||
/* two additional gamepads */
|
/* two additional gamepads */
|
||||||
for (i=5; i<7; i++)
|
for (i=5; i<7; i++)
|
||||||
{
|
{
|
||||||
if (player == MAX_INPUTS) return;
|
if (player < MAX_INPUTS)
|
||||||
|
{
|
||||||
input.dev[i] = config.input[player].padtype;
|
input.dev[i] = config.input[player].padtype;
|
||||||
player ++;
|
player ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void input_reset(void)
|
void input_reset(void)
|
||||||
@ -298,6 +321,12 @@ void input_reset(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case DEVICE_TEREBI:
|
||||||
|
{
|
||||||
|
terebi_oekaki_reset();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -3,21 +3,37 @@
|
|||||||
* Input peripherals support
|
* Input peripherals support
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
||||||
* Eke-Eke (2007-2011), additional code & fixes for the GCN/Wii port
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
@ -39,21 +55,22 @@
|
|||||||
#define SYSTEM_LIGHTPHASER (8) /* Sega Light Phaser (Master System) */
|
#define SYSTEM_LIGHTPHASER (8) /* Sega Light Phaser (Master System) */
|
||||||
#define SYSTEM_PADDLE (9) /* Sega Paddle Control (Master System) */
|
#define SYSTEM_PADDLE (9) /* Sega Paddle Control (Master System) */
|
||||||
#define SYSTEM_SPORTSPAD (10) /* Sega Sports Pad (Master System) */
|
#define SYSTEM_SPORTSPAD (10) /* Sega Sports Pad (Master System) */
|
||||||
#define SYSTEM_TEAMPLAYER (11) /* Sega TeamPlayer */
|
#define SYSTEM_TEAMPLAYER (11) /* Multi Tap -- Sega TeamPlayer */
|
||||||
#define SYSTEM_WAYPLAY (12) /* EA 4-Way Play (use both ports) */
|
#define SYSTEM_WAYPLAY (12) /* Multi Tap -- EA 4-Way Play (use both ports) */
|
||||||
|
|
||||||
/* Device type */
|
/* Device type */
|
||||||
#define DEVICE_PAD3B (0x00) /* 3-buttons Control Pad */
|
#define NO_DEVICE (0xff) /* unconnected device (fixed ID for Team Player) */
|
||||||
#define DEVICE_PAD6B (0x01) /* 6-buttons Control Pad */
|
#define DEVICE_PAD3B (0x00) /* 3-buttons Control Pad (fixed ID for Team Player)*/
|
||||||
#define DEVICE_MOUSE (0x02) /* Sega Mouse */
|
#define DEVICE_PAD6B (0x01) /* 6-buttons Control Pad (fixed ID for Team Player) */
|
||||||
#define DEVICE_XE_A1P (0x03) /* XE-A1P analog controller */
|
#define DEVICE_PAD2B (0x02) /* 2-buttons Control Pad */
|
||||||
#define DEVICE_ACTIVATOR (0x04) /* Activator */
|
#define DEVICE_MOUSE (0x03) /* Sega Mouse */
|
||||||
#define DEVICE_LIGHTGUN (0x05) /* Sega Light Phaser, Menacer or Konami Justifiers */
|
#define DEVICE_LIGHTGUN (0x04) /* Sega Light Phaser, Menacer or Konami Justifiers */
|
||||||
#define DEVICE_PAD2B (0x06) /* 2-buttons Control Pad */
|
#define DEVICE_PADDLE (0x05) /* Sega Paddle Control */
|
||||||
#define DEVICE_PADDLE (0x07) /* Sega Paddle Control */
|
#define DEVICE_SPORTSPAD (0x06) /* Sega Sports Pad */
|
||||||
#define DEVICE_SPORTSPAD (0x08) /* Sega Sports Pad */
|
#define DEVICE_PICO (0x07) /* PICO tablet */
|
||||||
#define DEVICE_TABLET (0x09) /* PICO tablet & pen */
|
#define DEVICE_TEREBI (0x08) /* Terebi Oekaki tablet */
|
||||||
#define NO_DEVICE (0xff) /* unconnected device */
|
#define DEVICE_XE_A1P (0x09) /* XE-A1P analog controller */
|
||||||
|
#define DEVICE_ACTIVATOR (0x0a) /* Activator */
|
||||||
|
|
||||||
/* Default Input bitmasks */
|
/* Default Input bitmasks */
|
||||||
#define INPUT_MODE (0x0800)
|
#define INPUT_MODE (0x0800)
|
||||||
|
@ -2,21 +2,37 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Sega Light Phaser, Menacer & Konami Justifiers support
|
* Sega Light Phaser, Menacer & Konami Justifiers support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2011)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
@ -96,7 +112,7 @@ void lightgun_refresh(int port)
|
|||||||
/* External Interrupt ? */
|
/* External Interrupt ? */
|
||||||
if (reg[11] & 0x08)
|
if (reg[11] & 0x08)
|
||||||
{
|
{
|
||||||
m68k_irq_state |= 0x12;
|
m68k_update_irq(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* HV Counter Latch:
|
/* HV Counter Latch:
|
||||||
@ -126,14 +142,14 @@ void lightgun_refresh(int port)
|
|||||||
|
|
||||||
static inline unsigned char phaser_read(int port)
|
static inline unsigned char phaser_read(int port)
|
||||||
{
|
{
|
||||||
/* FIRE button status (active low) */
|
/* TL returns TRIGGER (INPUT_A) button status (active low) */
|
||||||
unsigned char temp = ~(input.pad[port] & 0x10);
|
unsigned char temp = ~((input.pad[port] >> 2) & 0x10);
|
||||||
|
|
||||||
/* Check that TH is set as an input */
|
/* Check that TH is set as an input */
|
||||||
if (io_reg[0] & (0x02 << (port >> 1)))
|
if (io_reg[0x0F] & (0x02 << (port >> 1)))
|
||||||
{
|
{
|
||||||
/* Get current X position (phaser is only used in MS compatiblity mode) */
|
/* Get current X position (phaser is only used in MS compatiblity mode) */
|
||||||
int hcounter = hctab[(mcycles_z80 + Z80_CYCLE_OFFSET) % MCYCLES_PER_LINE];
|
int hcounter = hctab[(mcycles_z80 + SMS_CYCLE_OFFSET) % MCYCLES_PER_LINE];
|
||||||
|
|
||||||
/* Compare with gun position */
|
/* Compare with gun position */
|
||||||
int dx = input.analog[port][0] - (hcounter << 1);
|
int dx = input.analog[port][0] - (hcounter << 1);
|
||||||
@ -179,9 +195,11 @@ unsigned char phaser_2_read(void)
|
|||||||
|
|
||||||
unsigned char menacer_read(void)
|
unsigned char menacer_read(void)
|
||||||
{
|
{
|
||||||
/* Return START,A,B,C buttons status in D0-D3 (active high) */
|
/* D0=??? (INPUT_B), D1=TRIGGER (INPUT_A), D2=??? (INPUT_C), D3= START (INPUT_START) (active high) */
|
||||||
/* TL & TR pins always return 0 (normally set as output) */
|
/* TL & TR pins always return 0 (normally set as output) */
|
||||||
return ((input.pad[4] >> 4) & 0x0F);
|
/* TH always return 1 (0 on active pixel but button acquisition is always done during VBLANK) */
|
||||||
|
unsigned data = input.pad[4] >> 4;
|
||||||
|
return ((data & 0x09) | ((data >> 1) & 0x02) | ((data << 1) & 0x04) | 0x40);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -197,7 +215,7 @@ unsigned char justifier_read(void)
|
|||||||
return 0x30;
|
return 0x30;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return A & START button status in D0-D1 (active low) */
|
/* Return TRIGGER (INPUT_A) & START (INPUT_START) button status in D0-D1 (active low) */
|
||||||
/* TL & TR pins should always return 1 (normally set as output) */
|
/* TL & TR pins should always return 1 (normally set as output) */
|
||||||
/* LEFT & RIGHT pins should always return 0 */
|
/* LEFT & RIGHT pins should always return 0 */
|
||||||
return (((~input.pad[lightgun.Port] >> 6) & 0x03) | 0x70);
|
return (((~input.pad[lightgun.Port] >> 6) & 0x03) | 0x70);
|
||||||
@ -205,8 +223,8 @@ unsigned char justifier_read(void)
|
|||||||
|
|
||||||
void justifier_write(unsigned char data, unsigned char mask)
|
void justifier_write(unsigned char data, unsigned char mask)
|
||||||
{
|
{
|
||||||
/* update bits set as output only */
|
/* update bits set as output only, other bits are cleared (fixes Lethal Enforcers 2) */
|
||||||
data = (lightgun.State & ~mask) | (data & mask);
|
data &= mask;
|
||||||
|
|
||||||
/* gun index */
|
/* gun index */
|
||||||
lightgun.Port = 4 + ((data >> 5) & 1);
|
lightgun.Port = 4 + ((data >> 5) & 1);
|
||||||
|
@ -2,21 +2,37 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Sega Light Phaser, Menacer & Konami Justifiers support
|
* Sega Light Phaser, Menacer & Konami Justifiers support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2011)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
@ -2,21 +2,37 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Sega Mouse support
|
* Sega Mouse support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2011)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
@ -2,21 +2,37 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Sega Mouse support
|
* Sega Mouse support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2011)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
@ -2,21 +2,37 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Sega Paddle Control support
|
* Sega Paddle Control support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2011)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
@ -2,21 +2,37 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Sega Paddle Control support
|
* Sega Paddle Control support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2011)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
@ -2,21 +2,37 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Sega Sports Pad support
|
* Sega Sports Pad support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2011)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
@ -2,21 +2,37 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Sega Sports Pad support
|
* Sega Sports Pad support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2011)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
@ -2,21 +2,37 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Team Player support
|
* Team Player support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2011)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
|
||||||
* 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,
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* provided that the following conditions are met:
|
||||||
* 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
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* along with this program; if not, write to the Free Software
|
* product or activity.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
*
|
||||||
|
* - 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
@ -2,21 +2,37 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Team Player support
|
* Team Player support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2011)
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
77
source/input_hw/terebi_oekaki.c
Normal file
77
source/input_hw/terebi_oekaki.c
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/***************************************************************************************
|
||||||
|
* Genesis Plus
|
||||||
|
* Terebi Oekaki graphic board support
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 Eke-Eke (Genesis Plus GX)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#include "shared.h"
|
||||||
|
|
||||||
|
static struct
|
||||||
|
{
|
||||||
|
uint8 axis;
|
||||||
|
uint8 busy;
|
||||||
|
} tablet;
|
||||||
|
|
||||||
|
void terebi_oekaki_reset(void)
|
||||||
|
{
|
||||||
|
input.analog[0][0] = 128;
|
||||||
|
input.analog[0][1] = 128;
|
||||||
|
tablet.axis = 1;
|
||||||
|
tablet.busy = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned short terebi_oekaki_read(void)
|
||||||
|
{
|
||||||
|
uint16 data = (tablet.busy << 15) | input.analog[0][tablet.axis];
|
||||||
|
|
||||||
|
if (!(input.pad[0] & INPUT_B))
|
||||||
|
{
|
||||||
|
data |= 0x100;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* clear BUSY flag */
|
||||||
|
tablet.busy = 0;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void terebi_oekaki_write(unsigned char data)
|
||||||
|
{
|
||||||
|
/* X (1) or Y (0) axis */
|
||||||
|
tablet.axis = (data & 1) ^ 1;
|
||||||
|
|
||||||
|
/* set BUSY flag */
|
||||||
|
tablet.busy = 1;
|
||||||
|
}
|
47
source/input_hw/terebi_oekaki.h
Normal file
47
source/input_hw/terebi_oekaki.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/***************************************************************************************
|
||||||
|
* Genesis Plus
|
||||||
|
* Sega Paddle Control support
|
||||||
|
*
|
||||||
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _TEREBI_H_
|
||||||
|
#define _TEREBI_H_
|
||||||
|
|
||||||
|
/* Function prototypes */
|
||||||
|
extern void terebi_oekaki_reset(void);
|
||||||
|
extern unsigned short terebi_oekaki_read(void);
|
||||||
|
extern void terebi_oekaki_write(unsigned char data);
|
||||||
|
|
||||||
|
#endif
|
@ -2,21 +2,37 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* XE-A1P analog controller support
|
* XE-A1P analog controller support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2011)
|
* Copyright (C) 2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
@ -2,21 +2,37 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* XE-A1P analog controller support
|
* XE-A1P analog controller support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2011)
|
* Copyright (C) 2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
216
source/io_ctrl.c
216
source/io_ctrl.c
@ -1,23 +1,41 @@
|
|||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* I/O controller (MD & MS compatibility modes)
|
* I/O controller (Genesis & Master System modes)
|
||||||
|
*
|
||||||
|
* Support for Master System (315-5216, 315-5237 & 315-5297), Game Gear & Mega Drive I/O chips
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
||||||
* Eke-Eke (2007-2011), additional code & fixes for the GCN/Wii port
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
@ -51,7 +69,7 @@ static unsigned char dummy_read(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* I/O chip functions *
|
* I/O chip initialization *
|
||||||
* *
|
* *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void io_init(void)
|
void io_init(void)
|
||||||
@ -236,15 +254,9 @@ void io_init(void)
|
|||||||
void io_reset(void)
|
void io_reset(void)
|
||||||
{
|
{
|
||||||
/* Reset I/O registers */
|
/* Reset I/O registers */
|
||||||
if (system_hw == SYSTEM_PBC)
|
if (system_hw == SYSTEM_MD)
|
||||||
{
|
{
|
||||||
/* SMS compatibility mode control register */
|
io_reg[0x00] = 0x20 | region_code | (config.tmss & 1);
|
||||||
io_reg[0x00] = 0xFF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Genesis mode registers */
|
|
||||||
io_reg[0x00] = region_code | 0x20 | (config.tmss & 1);
|
|
||||||
io_reg[0x01] = 0x00;
|
io_reg[0x01] = 0x00;
|
||||||
io_reg[0x02] = 0x00;
|
io_reg[0x02] = 0x00;
|
||||||
io_reg[0x03] = 0x00;
|
io_reg[0x03] = 0x00;
|
||||||
@ -261,11 +273,41 @@ void io_reset(void)
|
|||||||
io_reg[0x0E] = 0x00;
|
io_reg[0x0E] = 0x00;
|
||||||
io_reg[0x0F] = 0x00;
|
io_reg[0x0F] = 0x00;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Game Gear specific registers */
|
||||||
|
io_reg[0x00] = 0x80 | (region_code >> 1);
|
||||||
|
io_reg[0x01] = 0x00;
|
||||||
|
io_reg[0x02] = 0xFF;
|
||||||
|
io_reg[0x03] = 0x00;
|
||||||
|
io_reg[0x04] = 0xFF;
|
||||||
|
io_reg[0x05] = 0x00;
|
||||||
|
io_reg[0x06] = 0xFF;
|
||||||
|
|
||||||
|
/* initial !RESET input */
|
||||||
|
io_reg[0x0D] = IO_RESET_HI;
|
||||||
|
|
||||||
|
/* default !CONT input */
|
||||||
|
if (system_hw != SYSTEM_PBC)
|
||||||
|
{
|
||||||
|
io_reg[0x0D] |= IO_CONT1_HI;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Control registers */
|
||||||
|
io_reg[0x0E] = 0x00;
|
||||||
|
io_reg[0x0F] = 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
/* Reset connected peripherals */
|
/* Reset connected peripherals */
|
||||||
input_reset();
|
input_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* I/O ports access from 68k (Genesis mode) *
|
||||||
|
* *
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
void io_68k_write(unsigned int offset, unsigned int data)
|
void io_68k_write(unsigned int offset, unsigned int data)
|
||||||
{
|
{
|
||||||
switch (offset)
|
switch (offset)
|
||||||
@ -334,9 +376,17 @@ unsigned int io_68k_read(unsigned int offset)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void io_z80_write(unsigned int data)
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* I/O ports access from Z80 *
|
||||||
|
* *
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
void io_z80_write(unsigned int offset, unsigned int data, unsigned int cycles)
|
||||||
{
|
{
|
||||||
/* pins can't be configured as output on japanese models */
|
if (offset)
|
||||||
|
{
|
||||||
|
/* I/O Control register */
|
||||||
if (region_code & REGION_USA)
|
if (region_code & REGION_USA)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -353,26 +403,51 @@ void io_z80_write(unsigned int data)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Send TR/TH state to connected peripherals */
|
/* Send TR/TH state to connected peripherals */
|
||||||
port[0].data_w((data << 1) & 0x60, (~io_reg[0] << 5) & 0x60);
|
port[0].data_w((data << 1) & 0x60, (~io_reg[0x0F] << 5) & 0x60);
|
||||||
port[1].data_w((data >> 1) & 0x60, (~io_reg[0] << 3) & 0x60);
|
port[1].data_w((data >> 1) & 0x60, (~io_reg[0x0F] << 3) & 0x60);
|
||||||
|
|
||||||
|
|
||||||
/* Check for TH low-to-high transitions on both ports */
|
/* Check for TH low-to-high transitions on both ports */
|
||||||
if ((!(io_reg[0] & 0x80) && (data & 0x80)) ||
|
if ((!(io_reg[0x0F] & 0x80) && (data & 0x80)) ||
|
||||||
(!(io_reg[0] & 0x20) && (data & 0x20)))
|
(!(io_reg[0x0F] & 0x20) && (data & 0x20)))
|
||||||
{
|
{
|
||||||
/* Latch new HVC */
|
/* Latch new HVC */
|
||||||
hvc_latch = hctab[(mcycles_z80 + Z80_CYCLE_OFFSET) % MCYCLES_PER_LINE] | 0x10000;
|
hvc_latch = hctab[cycles % MCYCLES_PER_LINE] | 0x10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update I/O Control register */
|
||||||
|
io_reg[0x0F] = data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* TH output is fixed to 0 & TR is always an input on japanese hardware */
|
||||||
|
io_reg[0x0F] = (data | 0x05) & 0x5F;
|
||||||
|
|
||||||
|
/* Port $DD bits D4-D5 return D0-D2 (cf. http://www2.odn.ne.jp/~haf09260/Sms/EnrSms.htm) */
|
||||||
|
io_reg[0x0D] = ((data & 0x01) << 4) | ((data & 0x04) << 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* outputs return fixed value */
|
/* Memory Control register */
|
||||||
data &= 0x0F;
|
if (data & 0x40)
|
||||||
|
{
|
||||||
|
/* Assume only BIOS would disable Cartridge ROM */
|
||||||
|
if (data & 0x08)
|
||||||
|
{
|
||||||
|
/* BIOS ROM disabled */
|
||||||
|
sms_cart_switch(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* BIOS ROM enabled */
|
||||||
|
sms_cart_switch(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update control register */
|
/* Update Memory Control register */
|
||||||
io_reg[0] = data;
|
io_reg[0x0E] = data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int io_z80_read(unsigned int offset)
|
unsigned int io_z80_read(unsigned int offset)
|
||||||
@ -380,8 +455,8 @@ unsigned int io_z80_read(unsigned int offset)
|
|||||||
/* Read port A & port B input data */
|
/* Read port A & port B input data */
|
||||||
unsigned int data = (port[0].data_r()) | (port[1].data_r() << 8);
|
unsigned int data = (port[0].data_r()) | (port[1].data_r() << 8);
|
||||||
|
|
||||||
/* Read control register value */
|
/* I/O control register value */
|
||||||
unsigned int ctrl = io_reg[0];
|
unsigned int ctrl = io_reg[0x0F];
|
||||||
|
|
||||||
/* I/O ports */
|
/* I/O ports */
|
||||||
if (offset)
|
if (offset)
|
||||||
@ -391,14 +466,17 @@ unsigned int io_z80_read(unsigned int offset)
|
|||||||
--------------
|
--------------
|
||||||
D7 : Port B TH pin input
|
D7 : Port B TH pin input
|
||||||
D6 : Port A TH pin input
|
D6 : Port A TH pin input
|
||||||
D5 : Unused (0 on Mega Drive, 1 otherwise)
|
D5 : CONT input (0 on Mega Drive hardware, 1 otherwise)
|
||||||
D4 : RESET button (always 1 on Mega Drive)
|
D4 : RESET button (1: default, 0: pressed, only on Master System hardware)
|
||||||
D3 : Port B TR pin input
|
D3 : Port B TR pin input
|
||||||
D2 : Port B TL pin input
|
D2 : Port B TL pin input
|
||||||
D1 : Port B Right pin input
|
D1 : Port B Right pin input
|
||||||
D0 : Port B Left pin input
|
D0 : Port B Left pin input
|
||||||
*/
|
*/
|
||||||
data = ((data >> 10) & 0x0F) | (data & 0x40) | ((data >> 7) & 0x80) | 0x10;
|
data = ((data >> 10) & 0x0F) | (data & 0x40) | ((data >> 7) & 0x80) | io_reg[0x0D];
|
||||||
|
|
||||||
|
/* clear !RESET input */
|
||||||
|
io_reg[0x0D] |= IO_RESET_HI;
|
||||||
|
|
||||||
/* Adjust port B TH state if configured as output */
|
/* Adjust port B TH state if configured as output */
|
||||||
if (!(ctrl & 0x08))
|
if (!(ctrl & 0x08))
|
||||||
@ -448,3 +526,65 @@ unsigned int io_z80_read(unsigned int offset)
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Game Gear communication ports access *
|
||||||
|
* *
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
void io_gg_write(unsigned int offset, unsigned int data)
|
||||||
|
{
|
||||||
|
switch (offset)
|
||||||
|
{
|
||||||
|
case 1: /* Parallel data register */
|
||||||
|
io_reg[1] = data;
|
||||||
|
return;
|
||||||
|
|
||||||
|
case 2: /* Data direction register and NMI enable */
|
||||||
|
io_reg[2] = data;
|
||||||
|
return;
|
||||||
|
|
||||||
|
case 3: /* Transmit data buffer */
|
||||||
|
io_reg[3] = data;
|
||||||
|
return;
|
||||||
|
|
||||||
|
case 5: /* Serial control (bits 0-2 are read-only) */
|
||||||
|
io_reg[5] = data & 0xF8;
|
||||||
|
return;
|
||||||
|
|
||||||
|
case 6: /* PSG Stereo output control (unsupported) */
|
||||||
|
io_reg[6] = data;
|
||||||
|
return;
|
||||||
|
|
||||||
|
default: /* Read-only */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int io_gg_read(unsigned int offset)
|
||||||
|
{
|
||||||
|
switch (offset)
|
||||||
|
{
|
||||||
|
case 0: /* Mode Register */
|
||||||
|
return (io_reg[0] & ~(input.pad[0] & INPUT_START));
|
||||||
|
|
||||||
|
case 1: /* Parallel data register (not connected) */
|
||||||
|
return ((io_reg[1] & ~(io_reg[2] & 0x7F)) | (io_reg[2] & 0x7F));
|
||||||
|
|
||||||
|
case 2: /* Data direction register and NMI enable */
|
||||||
|
return io_reg[2];
|
||||||
|
|
||||||
|
case 3: /* Transmit data buffer */
|
||||||
|
return io_reg[3];
|
||||||
|
|
||||||
|
case 4: /* Receive data buffer */
|
||||||
|
return io_reg[4];
|
||||||
|
|
||||||
|
case 5: /* Serial control */
|
||||||
|
return io_reg[5];
|
||||||
|
|
||||||
|
default: /* Write-Only */
|
||||||
|
return 0xFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,28 +1,49 @@
|
|||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* I/O controller (MD & MS compatibility modes)
|
* I/O controller
|
||||||
|
*
|
||||||
|
* Support for Master System (315-5216, 315-5237 & 315-5297), Game Gear & Mega Drive I/O chips
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
||||||
* Eke-Eke (2007-2011), additional code & fixes for the GCN/Wii port
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _GEN_IO_H_
|
#ifndef _IO_CTRL_H_
|
||||||
#define _GEN_IO_H_
|
#define _IO_CTRL_H_
|
||||||
|
|
||||||
|
#define IO_RESET_HI 0x10
|
||||||
|
#define IO_CONT1_HI 0x20
|
||||||
|
|
||||||
#define REGION_JAPAN_NTSC 0x00
|
#define REGION_JAPAN_NTSC 0x00
|
||||||
#define REGION_JAPAN_PAL 0x40
|
#define REGION_JAPAN_PAL 0x40
|
||||||
@ -38,8 +59,10 @@ extern void io_init(void);
|
|||||||
extern void io_reset(void);
|
extern void io_reset(void);
|
||||||
extern void io_68k_write(unsigned int offset, unsigned int data);
|
extern void io_68k_write(unsigned int offset, unsigned int data);
|
||||||
extern unsigned int io_68k_read(unsigned int offset);
|
extern unsigned int io_68k_read(unsigned int offset);
|
||||||
extern void io_z80_write(unsigned int data);
|
extern void io_z80_write(unsigned int offset, unsigned int data, unsigned int cycles);
|
||||||
extern unsigned int io_z80_read(unsigned int offset);
|
extern unsigned int io_z80_read(unsigned int offset);
|
||||||
|
extern void io_gg_write(unsigned int offset, unsigned int data);
|
||||||
|
extern unsigned int io_gg_read(unsigned int offset);
|
||||||
|
|
||||||
#endif /* _IO_H_ */
|
#endif /* _IO_CTRL_H_ */
|
||||||
|
|
||||||
|
148
source/loadrom.c
148
source/loadrom.c
@ -3,21 +3,37 @@
|
|||||||
* ROM Loading Support
|
* ROM Loading Support
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
||||||
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
@ -75,7 +91,7 @@ typedef struct
|
|||||||
|
|
||||||
ROMINFO rominfo;
|
ROMINFO rominfo;
|
||||||
char rom_filename[256];
|
char rom_filename[256];
|
||||||
|
uint8 romtype;
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Genesis ROM Manufacturers
|
* Genesis ROM Manufacturers
|
||||||
@ -220,9 +236,6 @@ static void getrominfo(char *romheader)
|
|||||||
/* If found, assume this is a SMS game */
|
/* If found, assume this is a SMS game */
|
||||||
if (offset)
|
if (offset)
|
||||||
{
|
{
|
||||||
/* force SMS compatibilty mode */
|
|
||||||
system_hw = SYSTEM_PBC;
|
|
||||||
|
|
||||||
/* checksum */
|
/* checksum */
|
||||||
rominfo.checksum = cart.rom[offset + 0x0a] | (cart.rom[offset + 0x0b] << 8);
|
rominfo.checksum = cart.rom[offset + 0x0a] | (cart.rom[offset + 0x0b] << 8);
|
||||||
|
|
||||||
@ -291,7 +304,7 @@ static void getrominfo(char *romheader)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Some SMS games don't have any header */
|
/* Some SMS games don't have any header */
|
||||||
if (system_hw == SYSTEM_PBC) return;
|
if (system_hw != SYSTEM_MD) return;
|
||||||
|
|
||||||
/* Genesis ROM header support */
|
/* Genesis ROM header support */
|
||||||
memcpy (&rominfo.consoletype, romheader + ROMCONSOLE, 16);
|
memcpy (&rominfo.consoletype, romheader + ROMCONSOLE, 16);
|
||||||
@ -367,38 +380,48 @@ static void deinterleave_block(uint8 * src)
|
|||||||
* load_rom
|
* load_rom
|
||||||
*
|
*
|
||||||
* Load a new ROM file.
|
* Load a new ROM file.
|
||||||
|
*
|
||||||
|
* Return 0 on error, 1 on success
|
||||||
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int load_rom(char *filename)
|
int load_rom(char *filename)
|
||||||
{
|
{
|
||||||
int i, size;
|
int i;
|
||||||
|
|
||||||
#ifdef NGC
|
/* Load file into ROM buffer */
|
||||||
size = cart.romsize;
|
int size = load_archive(filename);
|
||||||
#else
|
if (!size) return(0);
|
||||||
uint8 *ptr;
|
|
||||||
ptr = load_archive(filename, &size);
|
|
||||||
if(!ptr) return (0);
|
|
||||||
memcpy(cart.rom, ptr, size);
|
|
||||||
free(ptr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Minimal ROM size */
|
/* Auto-detect system mode from ROM file extension */
|
||||||
if (size < 0x4000)
|
|
||||||
{
|
|
||||||
memset(cart.rom + size, 0xFF, 0x4000 - size);
|
|
||||||
size = 0x4000;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get file extension */
|
|
||||||
if (!strnicmp(".sms", &filename[strlen(filename) - 4], 4))
|
if (!strnicmp(".sms", &filename[strlen(filename) - 4], 4))
|
||||||
{
|
{
|
||||||
/* Force SMS compatibility mode */
|
/* Master System II hardware */
|
||||||
system_hw = SYSTEM_PBC;
|
system_hw = SYSTEM_SMS2;
|
||||||
|
}
|
||||||
|
else if (!strnicmp(".gg", &filename[strlen(filename) - 3], 3))
|
||||||
|
{
|
||||||
|
/* Game Gear hardware (GG mode) */
|
||||||
|
system_hw = SYSTEM_GG;
|
||||||
|
}
|
||||||
|
else if (!strnicmp(".sg", &filename[strlen(filename) - 3], 3))
|
||||||
|
{
|
||||||
|
/* SG-1000 hardware */
|
||||||
|
system_hw = SYSTEM_SG;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Assume Genesis mode */
|
/* Mega Drive hardware (Genesis mode) */
|
||||||
system_hw = SYSTEM_GENESIS;
|
system_hw = SYSTEM_MD;
|
||||||
|
|
||||||
|
/* Decode .MDX format */
|
||||||
|
if (!strnicmp(".mdx", &filename[strlen(filename) - 4], 4))
|
||||||
|
{
|
||||||
|
for (i = 4; i < size - 1; i++)
|
||||||
|
{
|
||||||
|
cart.rom[i-4] = cart.rom[i] ^ 0x40;
|
||||||
|
}
|
||||||
|
size = size - 5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Take care of 512 byte header, if present */
|
/* Take care of 512 byte header, if present */
|
||||||
@ -408,7 +431,7 @@ int load_rom(char *filename)
|
|||||||
memcpy (cart.rom, cart.rom + 512, size);
|
memcpy (cart.rom, cart.rom + 512, size);
|
||||||
|
|
||||||
/* interleaved ROM format (.smd) */
|
/* interleaved ROM format (.smd) */
|
||||||
if (system_hw != SYSTEM_PBC)
|
if (system_hw == SYSTEM_MD)
|
||||||
{
|
{
|
||||||
for (i = 0; i < (size / 0x4000); i++)
|
for (i = 0; i < (size / 0x4000); i++)
|
||||||
{
|
{
|
||||||
@ -427,14 +450,45 @@ int load_rom(char *filename)
|
|||||||
/* get infos from ROM header */
|
/* get infos from ROM header */
|
||||||
getrominfo((char *)cart.rom);
|
getrominfo((char *)cart.rom);
|
||||||
|
|
||||||
|
/* PICO hardware */
|
||||||
|
if (strstr(rominfo.consoletype, "SEGA PICO") != NULL)
|
||||||
|
{
|
||||||
|
system_hw = SYSTEM_PICO;
|
||||||
|
}
|
||||||
|
|
||||||
/* detect console region */
|
/* detect console region */
|
||||||
region_autodetect();
|
region_autodetect();
|
||||||
|
|
||||||
/* Genesis ROM specific */
|
/* Save ROM type for later use */
|
||||||
if (system_hw != SYSTEM_PBC)
|
romtype = system_hw;
|
||||||
|
|
||||||
|
/* Force system if requested */
|
||||||
|
if (config.system == SYSTEM_MD)
|
||||||
|
{
|
||||||
|
if (!(system_hw & SYSTEM_MD))
|
||||||
|
{
|
||||||
|
/* Mega Drive in MS compatibility mode */
|
||||||
|
system_hw = SYSTEM_PBC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (config.system == SYSTEM_GG)
|
||||||
|
{
|
||||||
|
if (!(system_hw == SYSTEM_GG))
|
||||||
|
{
|
||||||
|
/* Game Gear in MS compatibility mode */
|
||||||
|
system_hw = SYSTEM_GGMS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (config.system)
|
||||||
|
{
|
||||||
|
system_hw = config.system;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Genesis mode specific */
|
||||||
|
if (system_hw == SYSTEM_MD)
|
||||||
{
|
{
|
||||||
#ifdef LSB_FIRST
|
#ifdef LSB_FIRST
|
||||||
/* Byteswap ROM */
|
/* Byteswap ROM to optimize 16-bit access */
|
||||||
uint8 temp;
|
uint8 temp;
|
||||||
for(i = 0; i < size; i += 2)
|
for(i = 0; i < size; i += 2)
|
||||||
{
|
{
|
||||||
@ -456,12 +510,6 @@ int load_rom(char *filename)
|
|||||||
cart.rom[i+1] = temp;
|
cart.rom[i+1] = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PICO hardware */
|
|
||||||
if (strstr(rominfo.consoletype, "SEGA PICO") != NULL)
|
|
||||||
{
|
|
||||||
system_hw = SYSTEM_PICO;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
@ -475,7 +523,7 @@ int load_rom(char *filename)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void region_autodetect(void)
|
void region_autodetect(void)
|
||||||
{
|
{
|
||||||
if (system_hw == SYSTEM_PBC)
|
if (system_hw != SYSTEM_MD)
|
||||||
{
|
{
|
||||||
region_code = sms_cart_region_detect();
|
region_code = sms_cart_region_detect();
|
||||||
}
|
}
|
||||||
|
@ -3,23 +3,40 @@
|
|||||||
* ROM Loading Support
|
* ROM Loading Support
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
||||||
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _LOADROM_H_
|
#ifndef _LOADROM_H_
|
||||||
#define _LOADROM_H_
|
#define _LOADROM_H_
|
||||||
|
|
||||||
@ -45,6 +62,7 @@ typedef struct
|
|||||||
/* Global variables */
|
/* Global variables */
|
||||||
extern ROMINFO rominfo;
|
extern ROMINFO rominfo;
|
||||||
extern char rom_filename[256];
|
extern char rom_filename[256];
|
||||||
|
extern uint8 romtype;
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
extern int load_rom(char *filename);
|
extern int load_rom(char *filename);
|
||||||
|
@ -22,6 +22,18 @@
|
|||||||
* http://kstenerud.cjb.net
|
* http://kstenerud.cjb.net
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Modified by Eke-Eke for Genesis Plus GX:
|
||||||
|
|
||||||
|
- removed unused stuff to reduce memory usage / optimize execution (multiple CPU types support, NMI support, ...)
|
||||||
|
- moved stuff to compile statically in a single object file
|
||||||
|
- implemented support for global cycle count (shared by 68k & Z80 CPU)
|
||||||
|
- added support for interrupt latency (Sesame's Street Counting Cafe, Fatal Rewind)
|
||||||
|
- added proper cycle use on reset
|
||||||
|
- added cycle accurate timings for MUL/DIV instructions (thanks to Jorge Cwik !)
|
||||||
|
- fixed undocumented flags for DIV instructions (Blood Shot)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
/* ======================================================================== */
|
/* ======================================================================== */
|
||||||
/* ============================= CONFIGURATION ============================ */
|
/* ============================= CONFIGURATION ============================ */
|
||||||
/* ======================================================================== */
|
/* ======================================================================== */
|
||||||
@ -66,19 +78,6 @@
|
|||||||
#define M68K_INT_ACK_SPURIOUS 0xfffffffe
|
#define M68K_INT_ACK_SPURIOUS 0xfffffffe
|
||||||
|
|
||||||
|
|
||||||
/* CPU types for use in m68k_set_cpu_type() */
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
M68K_CPU_TYPE_INVALID,
|
|
||||||
M68K_CPU_TYPE_68000,
|
|
||||||
M68K_CPU_TYPE_68008,
|
|
||||||
M68K_CPU_TYPE_68010,
|
|
||||||
M68K_CPU_TYPE_68EC020,
|
|
||||||
M68K_CPU_TYPE_68020,
|
|
||||||
M68K_CPU_TYPE_68030, /* Supported by disassembler ONLY */
|
|
||||||
M68K_CPU_TYPE_68040 /* Supported by disassembler ONLY */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Registers used by m68k_get_reg() and m68k_set_reg() */
|
/* Registers used by m68k_get_reg() and m68k_set_reg() */
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@ -104,80 +103,40 @@ typedef enum
|
|||||||
M68K_REG_SP, /* The current Stack Pointer (located in A7) */
|
M68K_REG_SP, /* The current Stack Pointer (located in A7) */
|
||||||
M68K_REG_USP, /* User Stack Pointer */
|
M68K_REG_USP, /* User Stack Pointer */
|
||||||
M68K_REG_ISP, /* Interrupt Stack Pointer */
|
M68K_REG_ISP, /* Interrupt Stack Pointer */
|
||||||
M68K_REG_MSP, /* Master Stack Pointer */
|
|
||||||
M68K_REG_SFC, /* Source Function Code */
|
|
||||||
M68K_REG_DFC, /* Destination Function Code */
|
|
||||||
M68K_REG_VBR, /* Vector Base Register */
|
|
||||||
M68K_REG_CACR, /* Cache Control Register */
|
|
||||||
M68K_REG_CAAR, /* Cache Address Register */
|
|
||||||
|
|
||||||
|
#if M68K_EMULATE_PREFETCH
|
||||||
/* Assumed registers */
|
/* Assumed registers */
|
||||||
/* These are cheat registers which emulate the 1-longword prefetch
|
/* These are cheat registers which emulate the 1-longword prefetch
|
||||||
* present in the 68000 and 68010.
|
* present in the 68000 and 68010.
|
||||||
*/
|
*/
|
||||||
M68K_REG_PREF_ADDR, /* Last prefetch address */
|
M68K_REG_PREF_ADDR, /* Last prefetch address */
|
||||||
M68K_REG_PREF_DATA, /* Last prefetch data */
|
M68K_REG_PREF_DATA, /* Last prefetch data */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Convenience registers */
|
/* Convenience registers */
|
||||||
M68K_REG_PPC, /* Previous value in the program counter */
|
|
||||||
M68K_REG_IR, /* Instruction register */
|
M68K_REG_IR, /* Instruction register */
|
||||||
M68K_REG_CPU_TYPE /* Type of CPU being run */
|
|
||||||
} m68k_register_t;
|
} m68k_register_t;
|
||||||
|
|
||||||
|
|
||||||
/* ======================================================================== */
|
/* ======================================================================== */
|
||||||
/* ====================== FUNCTIONS CALLED BY THE CPU ===================== */
|
/* ====================== FUNCTIONS CALLED BY THE CPU ===================== */
|
||||||
/* ======================================================================== */
|
/* ======================================================================== */
|
||||||
|
|
||||||
/* You will have to implement these functions */
|
|
||||||
|
|
||||||
/* read/write functions called by the CPU to access memory.
|
|
||||||
* while values used are 32 bits, only the appropriate number
|
|
||||||
* of bits are relevant (i.e. in write_memory_8, only the lower 8 bits
|
|
||||||
* of value should be written to memory).
|
|
||||||
*
|
|
||||||
* NOTE: I have separated the immediate and PC-relative memory fetches
|
|
||||||
* from the other memory fetches because some systems require
|
|
||||||
* differentiation between PROGRAM and DATA fetches (usually
|
|
||||||
* for security setups such as encryption).
|
|
||||||
* This separation can either be achieved by setting
|
|
||||||
* M68K_SEPARATE_READS in m68kconf.h and defining
|
|
||||||
* the read functions, or by setting M68K_EMULATE_FC and
|
|
||||||
* making a function code callback function.
|
|
||||||
* Using the callback offers better emulation coverage
|
|
||||||
* because you can also monitor whether the CPU is in SYSTEM or
|
|
||||||
* USER mode, but it is also slower.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Read from anywhere */
|
|
||||||
unsigned int m68k_read_memory_8(unsigned int address);
|
|
||||||
unsigned int m68k_read_memory_16(unsigned int address);
|
|
||||||
unsigned int m68k_read_memory_32(unsigned int address);
|
|
||||||
|
|
||||||
/* Memory access for the disassembler */
|
|
||||||
unsigned int m68k_read_disassembler_8 (unsigned int address);
|
|
||||||
unsigned int m68k_read_disassembler_16 (unsigned int address);
|
|
||||||
unsigned int m68k_read_disassembler_32 (unsigned int address);
|
|
||||||
|
|
||||||
/* Write to anywhere */
|
|
||||||
void m68k_write_memory_8(unsigned int address, unsigned int value);
|
|
||||||
void m68k_write_memory_16(unsigned int address, unsigned int value);
|
|
||||||
void m68k_write_memory_32(unsigned int address, unsigned int value);
|
|
||||||
|
|
||||||
|
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
|
/* 68k memory map structure */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned char *base;
|
unsigned char *base; /* direct memory access (ROM, RAM) */
|
||||||
unsigned int (*read8)(unsigned int address);
|
unsigned int (*read8)(unsigned int address); /* I/O byte read access */
|
||||||
unsigned int (*read16)(unsigned int address);
|
unsigned int (*read16)(unsigned int address); /* I/O word read access */
|
||||||
void (*write8)(unsigned int address, unsigned int data);
|
void (*write8)(unsigned int address, unsigned int data); /* I/O byte write access */
|
||||||
void (*write16)(unsigned int address, unsigned int data);
|
void (*write16)(unsigned int address, unsigned int data); /* I/O word write access */
|
||||||
} _m68k_memory_map;
|
} _m68k_memory_map;
|
||||||
|
|
||||||
|
/* 68k memory map */
|
||||||
_m68k_memory_map m68k_memory_map[256];
|
_m68k_memory_map m68k_memory_map[256];
|
||||||
|
|
||||||
|
|
||||||
/* Read data immediately following the PC */
|
/* Read data immediately following the PC */
|
||||||
#define m68k_read_immediate_16(address) *(uint16 *)(m68k_memory_map[((address)>>16)&0xff].base + ((address) & 0xffff))
|
#define m68k_read_immediate_16(address) *(uint16 *)(m68k_memory_map[((address)>>16)&0xff].base + ((address) & 0xffff))
|
||||||
#define m68k_read_immediate_32(address) (m68k_read_immediate_16(address) << 16) | (m68k_read_immediate_16(address+2))
|
#define m68k_read_immediate_32(address) (m68k_read_immediate_16(address) << 16) | (m68k_read_immediate_16(address+2))
|
||||||
@ -187,16 +146,6 @@ _m68k_memory_map m68k_memory_map[256];
|
|||||||
#define m68k_read_pcrelative_16(address) m68k_read_immediate_16(address)
|
#define m68k_read_pcrelative_16(address) m68k_read_immediate_16(address)
|
||||||
#define m68k_read_pcrelative_32(address) m68k_read_immediate_32(address)
|
#define m68k_read_pcrelative_32(address) m68k_read_immediate_32(address)
|
||||||
|
|
||||||
/* Special call to simulate undocumented 68k behavior when move.l with a
|
|
||||||
* predecrement destination mode is executed.
|
|
||||||
* To simulate real 68k behavior, first write the high word to
|
|
||||||
* [address+2], and then write the low word to [address].
|
|
||||||
*
|
|
||||||
* Enable this functionality with M68K_SIMULATE_PD_WRITES in m68kconf.h.
|
|
||||||
*/
|
|
||||||
void m68k_write_memory_32_pd(unsigned int address, unsigned int value);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ======================================================================== */
|
/* ======================================================================== */
|
||||||
/* ============================== CALLBACKS =============================== */
|
/* ============================== CALLBACKS =============================== */
|
||||||
@ -210,6 +159,7 @@ void m68k_write_memory_32_pd(unsigned int address, unsigned int value);
|
|||||||
* callback or have assigned a callback of NULL.
|
* callback or have assigned a callback of NULL.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if M68K_EMULATE_INT_ACK == OPT_ON
|
||||||
/* Set the callback for an interrupt acknowledge.
|
/* Set the callback for an interrupt acknowledge.
|
||||||
* You must enable M68K_EMULATE_INT_ACK in m68kconf.h.
|
* You must enable M68K_EMULATE_INT_ACK in m68kconf.h.
|
||||||
* The CPU will call the callback with the interrupt level being acknowledged.
|
* The CPU will call the callback with the interrupt level being acknowledged.
|
||||||
@ -221,58 +171,27 @@ void m68k_write_memory_32_pd(unsigned int address, unsigned int value);
|
|||||||
* Default behavior: return M68K_INT_ACK_AUTOVECTOR.
|
* Default behavior: return M68K_INT_ACK_AUTOVECTOR.
|
||||||
*/
|
*/
|
||||||
void m68k_set_int_ack_callback(int (*callback)(int int_level));
|
void m68k_set_int_ack_callback(int (*callback)(int int_level));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if M68K_EMULATE_RESET == OPT_ON
|
||||||
/* Set the callback for a breakpoint acknowledge (68010+).
|
|
||||||
* You must enable M68K_EMULATE_BKPT_ACK in m68kconf.h.
|
|
||||||
* The CPU will call the callback with whatever was in the data field of the
|
|
||||||
* BKPT instruction for 68020+, or 0 for 68010.
|
|
||||||
* Default behavior: do nothing.
|
|
||||||
*/
|
|
||||||
void m68k_set_bkpt_ack_callback(void (*callback)(unsigned int data));
|
|
||||||
|
|
||||||
|
|
||||||
/* Set the callback for the RESET instruction.
|
/* Set the callback for the RESET instruction.
|
||||||
* You must enable M68K_EMULATE_RESET in m68kconf.h.
|
* You must enable M68K_EMULATE_RESET in m68kconf.h.
|
||||||
* The CPU calls this callback every time it encounters a RESET instruction.
|
* The CPU calls this callback every time it encounters a RESET instruction.
|
||||||
* Default behavior: do nothing.
|
* Default behavior: do nothing.
|
||||||
*/
|
*/
|
||||||
void m68k_set_reset_instr_callback(void (*callback)(void));
|
void m68k_set_reset_instr_callback(void (*callback)(void));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if M68K_TAS_HAS_CALLBACK == OPT_ON
|
||||||
/* Set the callback for the CMPI.L #v, Dn instruction.
|
|
||||||
* You must enable M68K_CMPILD_HAS_CALLBACK in m68kconf.h.
|
|
||||||
* The CPU calls this callback every time it encounters a CMPI.L #v, Dn instruction.
|
|
||||||
* Default behavior: do nothing.
|
|
||||||
*/
|
|
||||||
void m68k_set_cmpild_instr_callback(void (*callback)(unsigned int val, int reg));
|
|
||||||
|
|
||||||
|
|
||||||
/* Set the callback for the RTE instruction.
|
|
||||||
* You must enable M68K_RTE_HAS_CALLBACK in m68kconf.h.
|
|
||||||
* The CPU calls this callback every time it encounters a RTE instruction.
|
|
||||||
* Default behavior: do nothing.
|
|
||||||
*/
|
|
||||||
void m68k_set_rte_instr_callback(void (*callback)(void));
|
|
||||||
|
|
||||||
/* Set the callback for the TAS instruction.
|
/* Set the callback for the TAS instruction.
|
||||||
* You must enable M68K_TAS_HAS_CALLBACK in m68kconf.h.
|
* You must enable M68K_TAS_HAS_CALLBACK in m68kconf.h.
|
||||||
* The CPU calls this callback every time it encounters a TAS instruction.
|
* The CPU calls this callback every time it encounters a TAS instruction.
|
||||||
* Default behavior: return 1, allow writeback.
|
* Default behavior: return 1, allow writeback.
|
||||||
*/
|
*/
|
||||||
void m68k_set_tas_instr_callback(int (*callback)(void));
|
void m68k_set_tas_instr_callback(int (*callback)(void));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if M68K_EMULATE_FC == OPT_ON
|
||||||
|
|
||||||
/* Set the callback for informing of a large PC change.
|
|
||||||
* You must enable M68K_MONITOR_PC in m68kconf.h.
|
|
||||||
* The CPU calls this callback with the new PC value every time the PC changes
|
|
||||||
* by a large value (currently set for changes by longwords).
|
|
||||||
* Default behavior: do nothing.
|
|
||||||
*/
|
|
||||||
void m68k_set_pc_changed_callback(void (*callback)(unsigned int new_pc));
|
|
||||||
|
|
||||||
|
|
||||||
/* Set the callback for CPU function code changes.
|
/* Set the callback for CPU function code changes.
|
||||||
* You must enable M68K_EMULATE_FC in m68kconf.h.
|
* You must enable M68K_EMULATE_FC in m68kconf.h.
|
||||||
* The CPU calls this callback with the function code before every memory
|
* The CPU calls this callback with the function code before every memory
|
||||||
@ -281,115 +200,46 @@ void m68k_set_pc_changed_callback(void (*callback)(unsigned int new_pc));
|
|||||||
* Default behavior: do nothing.
|
* Default behavior: do nothing.
|
||||||
*/
|
*/
|
||||||
void m68k_set_fc_callback(void (*callback)(unsigned int new_fc));
|
void m68k_set_fc_callback(void (*callback)(unsigned int new_fc));
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set a callback for the instruction cycle of the CPU.
|
|
||||||
* You must enable M68K_INSTRUCTION_HOOK in m68kconf.h.
|
|
||||||
* The CPU calls this callback just before fetching the opcode in the
|
|
||||||
* instruction cycle.
|
|
||||||
* Default behavior: do nothing.
|
|
||||||
*/
|
|
||||||
void m68k_set_instr_hook_callback(void (*callback)(unsigned int pc));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ======================================================================== */
|
/* ======================================================================== */
|
||||||
/* ====================== FUNCTIONS TO ACCESS THE CPU ===================== */
|
/* ====================== FUNCTIONS TO ACCESS THE CPU ===================== */
|
||||||
/* ======================================================================== */
|
/* ======================================================================== */
|
||||||
|
|
||||||
/* Use this function to set the CPU type you want to emulate.
|
|
||||||
* Currently supported types are: M68K_CPU_TYPE_68000, M68K_CPU_TYPE_68008,
|
|
||||||
* M68K_CPU_TYPE_68010, M68K_CPU_TYPE_EC020, and M68K_CPU_TYPE_68020.
|
|
||||||
*/
|
|
||||||
void m68k_set_cpu_type(unsigned int cpu_type);
|
|
||||||
|
|
||||||
/* Do whatever initialisations the core requires. Should be called
|
/* Do whatever initialisations the core requires. Should be called
|
||||||
* at least once at init time.
|
* at least once at init time.
|
||||||
*/
|
*/
|
||||||
void m68k_init(void);
|
extern void m68k_init(void);
|
||||||
|
|
||||||
/* Pulse the RESET pin on the CPU.
|
/* Pulse the RESET pin on the CPU.
|
||||||
* You *MUST* reset the CPU at least once to initialize the emulation
|
* You *MUST* reset the CPU at least once to initialize the emulation
|
||||||
* Note: If you didn't call m68k_set_cpu_type() before resetting
|
|
||||||
* the CPU for the first time, the CPU will be set to
|
|
||||||
* M68K_CPU_TYPE_68000.
|
|
||||||
*/
|
*/
|
||||||
void m68k_pulse_reset(void);
|
extern void m68k_pulse_reset(void);
|
||||||
|
|
||||||
/* execute num_cycles worth of instructions. returns number of cycles used */
|
/* Run until given cycle count is reached */
|
||||||
//int m68k_execute(int num_cycles);
|
extern void m68k_run(unsigned int cycles);
|
||||||
|
|
||||||
/* run until global cycle count is reached */
|
|
||||||
void m68k_run(unsigned int cycles);
|
|
||||||
|
|
||||||
/* These functions let you read/write/modify the number of cycles left to run
|
|
||||||
* while m68k_execute() is running.
|
|
||||||
* These are useful if the 68k accesses a memory-mapped port on another device
|
|
||||||
* that requires immediate processing by another CPU.
|
|
||||||
*/
|
|
||||||
//int m68k_cycles_run(void); /* Number of cycles run so far */
|
|
||||||
//int m68k_cycles_remaining(void); /* Number of cycles left */
|
|
||||||
//void m68k_modify_timeslice(int cycles); /* Modify cycles left */
|
|
||||||
//void m68k_end_timeslice(void); /* End timeslice now */
|
|
||||||
|
|
||||||
/* Set the IPL0-IPL2 pins on the CPU (IRQ).
|
/* Set the IPL0-IPL2 pins on the CPU (IRQ).
|
||||||
* A transition from < 7 to 7 will cause a non-maskable interrupt (NMI).
|
* A transition from < 7 to 7 will cause a non-maskable interrupt (NMI).
|
||||||
* Setting IRQ to 0 will clear an interrupt request.
|
* Setting IRQ to 0 will clear an interrupt request.
|
||||||
*/
|
*/
|
||||||
void m68k_set_irq(unsigned int int_level);
|
extern void m68k_update_irq(unsigned int mask);
|
||||||
|
extern void m68k_set_irq(unsigned int int_level);
|
||||||
|
extern void m68k_set_irq_delay(unsigned int int_level);
|
||||||
|
|
||||||
/* Halt the CPU as if you pulsed the HALT pin. */
|
/* Halt the CPU as if you pulsed the HALT pin. */
|
||||||
void m68k_pulse_halt(void);
|
extern void m68k_pulse_halt(void);
|
||||||
|
|
||||||
|
|
||||||
/* Context switching to allow multiple CPUs */
|
|
||||||
|
|
||||||
/* Get the size of the cpu context in bytes */
|
|
||||||
unsigned int m68k_context_size(void);
|
|
||||||
|
|
||||||
/* Get a cpu context */
|
|
||||||
unsigned int m68k_get_context(void* dst);
|
|
||||||
|
|
||||||
/* set the current cpu context */
|
|
||||||
void m68k_set_context(void* dst);
|
|
||||||
|
|
||||||
/* Register the CPU state information */
|
|
||||||
void m68k_state_register(const char *type, int index);
|
|
||||||
|
|
||||||
|
|
||||||
/* Peek at the internals of a CPU context. This can either be a context
|
/* Peek at the internals of a CPU context. This can either be a context
|
||||||
* retrieved using m68k_get_context() or the currently running context.
|
* retrieved using m68k_get_context() or the currently running context.
|
||||||
* If context is NULL, the currently running CPU context will be used.
|
* If context is NULL, the currently running CPU context will be used.
|
||||||
*/
|
*/
|
||||||
unsigned int m68k_get_reg(void* context, m68k_register_t reg);
|
extern unsigned int m68k_get_reg(m68k_register_t reg);
|
||||||
|
|
||||||
/* Poke values into the internals of the currently running CPU context */
|
/* Poke values into the internals of the currently running CPU context */
|
||||||
void m68k_set_reg(m68k_register_t reg, unsigned int value);
|
extern void m68k_set_reg(m68k_register_t reg, unsigned int value);
|
||||||
|
|
||||||
/* Check if an instruction is valid for the specified CPU type */
|
|
||||||
unsigned int m68k_is_valid_instruction(unsigned int instruction, unsigned int cpu_type);
|
|
||||||
|
|
||||||
/* Disassemble 1 instruction using the epecified CPU type at pc. Stores
|
|
||||||
* disassembly in str_buff and returns the size of the instruction in bytes.
|
|
||||||
*/
|
|
||||||
unsigned int m68k_disassemble(char* str_buff, unsigned int pc, unsigned int cpu_type);
|
|
||||||
|
|
||||||
/* Same as above but accepts raw opcode data directly rather than fetching
|
|
||||||
* via the read/write interfaces.
|
|
||||||
*/
|
|
||||||
unsigned int m68k_disassemble_raw(char* str_buff, unsigned int pc, const unsigned char* opdata, const unsigned char* argdata, unsigned int cpu_type);
|
|
||||||
|
|
||||||
/*** Not really required, but makes for clean compile under DevkitPPC ***/
|
|
||||||
extern int vdp_68k_irq_ack(int int_level);
|
|
||||||
|
|
||||||
/* ======================================================================== */
|
|
||||||
/* ============================== MAME STUFF ============================== */
|
|
||||||
/* ======================================================================== */
|
|
||||||
|
|
||||||
#if M68K_COMPILE_FOR_MAME == OPT_ON
|
|
||||||
#include "m68kmame.h"
|
|
||||||
#endif /* M68K_COMPILE_FOR_MAME */
|
|
||||||
|
|
||||||
|
|
||||||
/* ======================================================================== */
|
/* ======================================================================== */
|
||||||
|
@ -1,213 +0,0 @@
|
|||||||
/*
|
|
||||||
* Compute exact number of CPU cycles taken
|
|
||||||
* by DIVU and DIVS on a 68000 processor.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2005 by Jorge Cwik, pasti@fxatari.com
|
|
||||||
*
|
|
||||||
* Added MULU and MULS accurate timings (Eke-Eke)
|
|
||||||
*
|
|
||||||
* This 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 software 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 software; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
The routines below take dividend and divisor as parameters.
|
|
||||||
They return 0 if division by zero, or exact number of cycles otherwise.
|
|
||||||
|
|
||||||
The number of cycles returned assumes a register operand.
|
|
||||||
Effective address time must be added if memory operand.
|
|
||||||
|
|
||||||
For 68000 only (not 68010, 68012, 68020, etc).
|
|
||||||
Probably valid for 68008 after adding the extra prefetch cycle.
|
|
||||||
|
|
||||||
|
|
||||||
Best and worst cases for register operand:
|
|
||||||
(Note the difference with the documented range.)
|
|
||||||
|
|
||||||
|
|
||||||
DIVU:
|
|
||||||
|
|
||||||
Overflow (always): 10 cycles.
|
|
||||||
Worst case: 136 cycles.
|
|
||||||
Best case: 76 cycles.
|
|
||||||
|
|
||||||
|
|
||||||
DIVS:
|
|
||||||
|
|
||||||
Absolute overflow: 16-18 cycles.
|
|
||||||
Signed overflow is not detected prematurely.
|
|
||||||
|
|
||||||
Worst case: 156 cycles.
|
|
||||||
Best case without signed overflow: 122 cycles.
|
|
||||||
Best case with signed overflow: 120 cycles
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
// Change this depending on architecture
|
|
||||||
// This code assumes long is 32 bits and short is 16 bits
|
|
||||||
|
|
||||||
typedef unsigned long DWORD;
|
|
||||||
typedef unsigned short WORD;
|
|
||||||
typedef signed long LONG;
|
|
||||||
typedef signed short SHORT;
|
|
||||||
|
|
||||||
//
|
|
||||||
// DIVU
|
|
||||||
// Unsigned division
|
|
||||||
//
|
|
||||||
|
|
||||||
INLINE unsigned getDivu68kCycles( DWORD dividend, WORD divisor)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
//if( (WORD) divisor == 0)
|
|
||||||
// return 0;
|
|
||||||
|
|
||||||
// Overflow
|
|
||||||
//if( (dividend >> 16) >= divisor)
|
|
||||||
// return (mcycles = 5) * 2;
|
|
||||||
|
|
||||||
unsigned mcycles = 38;
|
|
||||||
DWORD hdivisor = ((DWORD) divisor) << 16;
|
|
||||||
|
|
||||||
for( i = 0; i < 15; i++)
|
|
||||||
{
|
|
||||||
DWORD temp;
|
|
||||||
temp = dividend;
|
|
||||||
|
|
||||||
dividend <<= 1;
|
|
||||||
|
|
||||||
// If carry from shift
|
|
||||||
if( (LONG) temp < 0)
|
|
||||||
{
|
|
||||||
dividend -= hdivisor;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mcycles += 2;
|
|
||||||
if( dividend >= hdivisor)
|
|
||||||
{
|
|
||||||
dividend -= hdivisor;
|
|
||||||
mcycles--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return mcycles * 14;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// DIVS
|
|
||||||
// Signed division
|
|
||||||
//
|
|
||||||
|
|
||||||
INLINE unsigned getDivs68kCycles( LONG dividend, SHORT divisor)
|
|
||||||
{
|
|
||||||
|
|
||||||
//if( (SHORT) divisor == 0)
|
|
||||||
// return 0;
|
|
||||||
|
|
||||||
unsigned mcycles = 6;
|
|
||||||
|
|
||||||
if( dividend < 0)
|
|
||||||
mcycles++;
|
|
||||||
|
|
||||||
// Check for absolute overflow
|
|
||||||
if( ((DWORD) abs( dividend) >> 16) >= (WORD) abs( divisor))
|
|
||||||
{
|
|
||||||
return (mcycles + 2) * 14;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Absolute quotient
|
|
||||||
unsigned aquot = (DWORD) abs( dividend) / (WORD) abs( divisor);
|
|
||||||
|
|
||||||
mcycles += 55;
|
|
||||||
|
|
||||||
if( divisor >= 0)
|
|
||||||
{
|
|
||||||
if( dividend >= 0)
|
|
||||||
mcycles--;
|
|
||||||
else
|
|
||||||
mcycles++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Count 15 msbits in absolute of quotient
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for( i = 0; i < 15; i++)
|
|
||||||
{
|
|
||||||
if( (SHORT) aquot >= 0)
|
|
||||||
mcycles++;
|
|
||||||
aquot <<= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mcycles * 14;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// MULU
|
|
||||||
// Unsigned multiplication
|
|
||||||
//
|
|
||||||
|
|
||||||
INLINE unsigned getMulu68kCycles( WORD source)
|
|
||||||
{
|
|
||||||
unsigned mcycles = 266;
|
|
||||||
|
|
||||||
/* count number of bits set to 1 */
|
|
||||||
while (source)
|
|
||||||
{
|
|
||||||
if (source & 1)
|
|
||||||
{
|
|
||||||
mcycles += 14;
|
|
||||||
}
|
|
||||||
source >>= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 38 + 2*N */
|
|
||||||
return mcycles;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// MULS
|
|
||||||
// Signed multiplication
|
|
||||||
//
|
|
||||||
|
|
||||||
INLINE unsigned getMuls68kCycles( SHORT source)
|
|
||||||
{
|
|
||||||
unsigned mcycles = 266;
|
|
||||||
|
|
||||||
/* detect 01 or 10 patterns */
|
|
||||||
LONG temp = source << 1;
|
|
||||||
temp = (temp ^ source) & 0xFFFF;
|
|
||||||
|
|
||||||
/* count number of bits set to 1 */
|
|
||||||
while (temp)
|
|
||||||
{
|
|
||||||
if (temp & 1)
|
|
||||||
{
|
|
||||||
mcycles += 14;
|
|
||||||
}
|
|
||||||
temp >>= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 38 + 2*N */
|
|
||||||
return mcycles;
|
|
||||||
}
|
|
@ -19,6 +19,17 @@
|
|||||||
* http://kstenerud.cjb.net
|
* http://kstenerud.cjb.net
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Modified by Eke-Eke for Genesis Plus GX:
|
||||||
|
|
||||||
|
- removed unused stuff to reduce memory usage / optimize execution (multiple CPU types support, NMI support, ...)
|
||||||
|
- moved stuff to compile statically in a single object file
|
||||||
|
- implemented support for global cycle count (shared by 68k & Z80 CPU)
|
||||||
|
- added support for interrupt latency (Sesame's Street Counting Cafe, Fatal Rewind)
|
||||||
|
- added proper cycle use on reset
|
||||||
|
- added cycle accurate timings for MUL/DIV instructions (thanks to Jorge Cwik !)
|
||||||
|
- fixed undocumented flags for DIV instructions (Blood Shot)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef M68KCONF__HEADER
|
#ifndef M68KCONF__HEADER
|
||||||
@ -35,40 +46,10 @@
|
|||||||
#define OPT_ON 1
|
#define OPT_ON 1
|
||||||
#define OPT_SPECIFY_HANDLER 2
|
#define OPT_SPECIFY_HANDLER 2
|
||||||
|
|
||||||
|
|
||||||
/* ======================================================================== */
|
|
||||||
/* ============================== MAME STUFF ============================== */
|
|
||||||
/* ======================================================================== */
|
|
||||||
|
|
||||||
/* If you're compiling this for MAME, only change M68K_COMPILE_FOR_MAME
|
|
||||||
* to OPT_ON and use m68kmame.h to configure the 68k core.
|
|
||||||
*/
|
|
||||||
#ifndef M68K_COMPILE_FOR_MAME
|
|
||||||
#define M68K_COMPILE_FOR_MAME OPT_OFF
|
|
||||||
#endif /* M68K_COMPILE_FOR_MAME */
|
|
||||||
|
|
||||||
|
|
||||||
#if M68K_COMPILE_FOR_MAME == OPT_OFF
|
|
||||||
|
|
||||||
|
|
||||||
/* ======================================================================== */
|
/* ======================================================================== */
|
||||||
/* ============================= CONFIGURATION ============================ */
|
/* ============================= CONFIGURATION ============================ */
|
||||||
/* ======================================================================== */
|
/* ======================================================================== */
|
||||||
|
|
||||||
/* Turn ON if you want to use the following M68K variants */
|
|
||||||
#define M68K_EMULATE_008 OPT_OFF
|
|
||||||
#define M68K_EMULATE_010 OPT_OFF
|
|
||||||
#define M68K_EMULATE_EC020 OPT_OFF
|
|
||||||
#define M68K_EMULATE_020 OPT_OFF
|
|
||||||
#define M68K_EMULATE_040 OPT_OFF
|
|
||||||
|
|
||||||
|
|
||||||
/* If ON, the CPU will call m68k_read_immediate_xx() for immediate addressing
|
|
||||||
* and m68k_read_pcrelative_xx() for PC-relative addressing.
|
|
||||||
* If off, all read requests from the CPU will be redirected to m68k_read_xx()
|
|
||||||
*/
|
|
||||||
#define M68K_SEPARATE_READS OPT_ON
|
|
||||||
|
|
||||||
/* If ON, the CPU will call m68k_write_32_pd() when it executes move.l with a
|
/* If ON, the CPU will call m68k_write_32_pd() when it executes move.l with a
|
||||||
* predecrement destination EA mode instead of m68k_write_32().
|
* predecrement destination EA mode instead of m68k_write_32().
|
||||||
* To simulate real 68k behavior, m68k_write_32_pd() must first write the high
|
* To simulate real 68k behavior, m68k_write_32_pd() must first write the high
|
||||||
@ -84,46 +65,18 @@
|
|||||||
#define M68K_EMULATE_INT_ACK OPT_SPECIFY_HANDLER
|
#define M68K_EMULATE_INT_ACK OPT_SPECIFY_HANDLER
|
||||||
#define M68K_INT_ACK_CALLBACK(A) vdp_68k_irq_ack(A)
|
#define M68K_INT_ACK_CALLBACK(A) vdp_68k_irq_ack(A)
|
||||||
|
|
||||||
|
|
||||||
/* If ON, CPU will call the breakpoint acknowledge callback when it encounters
|
|
||||||
* a breakpoint instruction and it is running a 68010+.
|
|
||||||
*/
|
|
||||||
#define M68K_EMULATE_BKPT_ACK OPT_OFF
|
|
||||||
#define M68K_BKPT_ACK_CALLBACK() your_bkpt_ack_handler_function()
|
|
||||||
|
|
||||||
|
|
||||||
/* If ON, the CPU will monitor the trace flags and take trace exceptions
|
|
||||||
*/
|
|
||||||
#define M68K_EMULATE_TRACE OPT_OFF
|
|
||||||
|
|
||||||
|
|
||||||
/* If ON, CPU will call the output reset callback when it encounters a reset
|
/* If ON, CPU will call the output reset callback when it encounters a reset
|
||||||
* instruction.
|
* instruction.
|
||||||
*/
|
*/
|
||||||
#define M68K_EMULATE_RESET OPT_OFF
|
#define M68K_EMULATE_RESET OPT_OFF
|
||||||
#define M68K_RESET_CALLBACK() your_reset_handler_function()
|
#define M68K_RESET_CALLBACK() your_reset_handler_function()
|
||||||
|
|
||||||
|
|
||||||
/* If ON, CPU will call the callback when it encounters a cmpi.l #v, dn
|
|
||||||
* instruction.
|
|
||||||
*/
|
|
||||||
#define M68K_CMPILD_HAS_CALLBACK OPT_OFF
|
|
||||||
#define M68K_CMPILD_CALLBACK(v,r) your_cmpild_handler_function(v,r)
|
|
||||||
|
|
||||||
|
|
||||||
/* If ON, CPU will call the callback when it encounters a rte
|
|
||||||
* instruction.
|
|
||||||
*/
|
|
||||||
#define M68K_RTE_HAS_CALLBACK OPT_OFF
|
|
||||||
#define M68K_RTE_CALLBACK() your_rte_handler_function()
|
|
||||||
|
|
||||||
/* If ON, CPU will call the callback when it encounters a tas
|
/* If ON, CPU will call the callback when it encounters a tas
|
||||||
* instruction.
|
* instruction.
|
||||||
*/
|
*/
|
||||||
#define M68K_TAS_HAS_CALLBACK OPT_OFF
|
#define M68K_TAS_HAS_CALLBACK OPT_OFF
|
||||||
#define M68K_TAS_CALLBACK() your_tas_handler_function()
|
#define M68K_TAS_CALLBACK() your_tas_handler_function()
|
||||||
|
|
||||||
|
|
||||||
/* If ON, CPU will call the set fc callback on every memory access to
|
/* If ON, CPU will call the set fc callback on every memory access to
|
||||||
* differentiate between user/supervisor, program/data access like a real
|
* differentiate between user/supervisor, program/data access like a real
|
||||||
* 68000 would. This should be enabled and the callback should be set if you
|
* 68000 would. This should be enabled and the callback should be set if you
|
||||||
@ -133,48 +86,26 @@
|
|||||||
#define M68K_EMULATE_FC OPT_OFF
|
#define M68K_EMULATE_FC OPT_OFF
|
||||||
#define M68K_SET_FC_CALLBACK(A) your_set_fc_handler_function(A)
|
#define M68K_SET_FC_CALLBACK(A) your_set_fc_handler_function(A)
|
||||||
|
|
||||||
|
/* If ON, the CPU will monitor the trace flags and take trace exceptions
|
||||||
/* If ON, CPU will call the pc changed callback when it changes the PC by a
|
|
||||||
* large value. This allows host programs to be nicer when it comes to
|
|
||||||
* fetching immediate data and instructions on a banked memory system.
|
|
||||||
*/
|
*/
|
||||||
#define M68K_MONITOR_PC OPT_OFF
|
#define M68K_EMULATE_TRACE OPT_OFF
|
||||||
#define M68K_SET_PC_CALLBACK(A) your_pc_changed_handler_function(A)
|
|
||||||
|
|
||||||
|
|
||||||
/* If ON, CPU will call the instruction hook callback before every
|
|
||||||
* instruction.
|
|
||||||
*/
|
|
||||||
#define M68K_INSTRUCTION_HOOK OPT_OFF
|
|
||||||
#define M68K_INSTRUCTION_CALLBACK() your_instruction_hook_function()
|
|
||||||
|
|
||||||
|
|
||||||
/* If ON, the CPU will emulate the 4-byte prefetch queue of a real 68000 */
|
/* If ON, the CPU will emulate the 4-byte prefetch queue of a real 68000 */
|
||||||
#define M68K_EMULATE_PREFETCH OPT_OFF
|
#define M68K_EMULATE_PREFETCH OPT_OFF
|
||||||
|
|
||||||
|
|
||||||
/* If ON, the CPU will generate address error exceptions if it tries to
|
/* If ON, the CPU will generate address error exceptions if it tries to
|
||||||
* access a word or longword at an odd address.
|
* access a word or longword at an odd address.
|
||||||
* NOTE: This is only emulated properly for 68000 mode.
|
* NOTE: This is only emulated properly for 68000 mode.
|
||||||
*/
|
*/
|
||||||
#define M68K_EMULATE_ADDRESS_ERROR OPT_ON
|
#define M68K_EMULATE_ADDRESS_ERROR OPT_ON
|
||||||
|
|
||||||
|
/* If ON and previous option is also ON, address error exceptions will
|
||||||
/* If ON, branch instructions will check for infinite loop and
|
also be checked when fetching instructions. Disabling this can help
|
||||||
* freeze current CPU execution .
|
speeding up emulation while still emulating address error exceptions
|
||||||
* Unnecessary checking might be disabled to improve instruction
|
on other memory access if needed.
|
||||||
* emulation speed since infinite loops are going to "lock" the CPU
|
* NOTE: This is only emulated properly for 68000 mode.
|
||||||
* execution anyway.
|
|
||||||
*/
|
*/
|
||||||
#define M68K_CHECK_INFINITE_LOOP OPT_OFF
|
#define M68K_CHECK_PC_ADDRESS_ERROR OPT_OFF
|
||||||
|
|
||||||
/* Turn ON to enable logging of illegal instruction calls.
|
|
||||||
* M68K_LOG_FILEHANDLE must be #defined to a stdio file stream.
|
|
||||||
* Turn on M68K_LOG_1010_1111 to log all 1010 and 1111 calls.
|
|
||||||
*/
|
|
||||||
#define M68K_LOG_ENABLE OPT_OFF
|
|
||||||
#define M68K_LOG_1010_1111 OPT_OFF
|
|
||||||
#define M68K_LOG_FILEHANDLE some_file_handle
|
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------- COMPATIBILITY ---------------------------- */
|
/* ----------------------------- COMPATIBILITY ---------------------------- */
|
||||||
@ -199,8 +130,6 @@
|
|||||||
#define INLINE static __inline__
|
#define INLINE static __inline__
|
||||||
#endif /* INLINE */
|
#endif /* INLINE */
|
||||||
|
|
||||||
#endif /* M68K_COMPILE_FOR_MAME */
|
|
||||||
|
|
||||||
|
|
||||||
/* ======================================================================== */
|
/* ======================================================================== */
|
||||||
/* ============================== END OF FILE ============================= */
|
/* ============================== END OF FILE ============================= */
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
37084
source/m68k/m68kops.c
37084
source/m68k/m68kops.c
File diff suppressed because it is too large
Load Diff
25425
source/m68k/m68kops.h
25425
source/m68k/m68kops.h
File diff suppressed because it is too large
Load Diff
112
source/mem68k.c
112
source/mem68k.c
@ -1,28 +1,44 @@
|
|||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* 68k bus controller
|
* 68k bus handlers
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
||||||
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "m68kcpu.h"
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
#include "m68kcpu.h"
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@ -31,7 +47,7 @@
|
|||||||
unsigned int m68k_read_bus_8(unsigned int address)
|
unsigned int m68k_read_bus_8(unsigned int address)
|
||||||
{
|
{
|
||||||
#ifdef LOGERROR
|
#ifdef LOGERROR
|
||||||
error("Unused read8 %08X (%08X)\n", address, m68k_get_reg (NULL, M68K_REG_PC));
|
error("Unused read8 %08X (%08X)\n", address, m68k_get_reg(M68K_REG_PC));
|
||||||
#endif
|
#endif
|
||||||
return m68k_read_pcrelative_8(REG_PC | (address & 1));
|
return m68k_read_pcrelative_8(REG_PC | (address & 1));
|
||||||
}
|
}
|
||||||
@ -39,7 +55,7 @@ unsigned int m68k_read_bus_8(unsigned int address)
|
|||||||
unsigned int m68k_read_bus_16(unsigned int address)
|
unsigned int m68k_read_bus_16(unsigned int address)
|
||||||
{
|
{
|
||||||
#ifdef LOGERROR
|
#ifdef LOGERROR
|
||||||
error("Unused read16 %08X (%08X)\n", address, m68k_get_reg (NULL, M68K_REG_PC));
|
error("Unused read16 %08X (%08X)\n", address, m68k_get_reg(M68K_REG_PC));
|
||||||
#endif
|
#endif
|
||||||
return m68k_read_pcrelative_16(REG_PC);
|
return m68k_read_pcrelative_16(REG_PC);
|
||||||
}
|
}
|
||||||
@ -48,14 +64,14 @@ unsigned int m68k_read_bus_16(unsigned int address)
|
|||||||
void m68k_unused_8_w (unsigned int address, unsigned int data)
|
void m68k_unused_8_w (unsigned int address, unsigned int data)
|
||||||
{
|
{
|
||||||
#ifdef LOGERROR
|
#ifdef LOGERROR
|
||||||
error("Unused write8 %08X = %02X (%08X)\n", address, data, m68k_get_reg (NULL, M68K_REG_PC));
|
error("Unused write8 %08X = %02X (%08X)\n", address, data, m68k_get_reg(M68K_REG_PC));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void m68k_unused_16_w (unsigned int address, unsigned int data)
|
void m68k_unused_16_w (unsigned int address, unsigned int data)
|
||||||
{
|
{
|
||||||
#ifdef LOGERROR
|
#ifdef LOGERROR
|
||||||
error("Unused write16 %08X = %04X (%08X)\n", address, data, m68k_get_reg (NULL, M68K_REG_PC));
|
error("Unused write16 %08X = %04X (%08X)\n", address, data, m68k_get_reg(M68K_REG_PC));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +82,7 @@ void m68k_unused_16_w (unsigned int address, unsigned int data)
|
|||||||
void m68k_lockup_w_8 (unsigned int address, unsigned int data)
|
void m68k_lockup_w_8 (unsigned int address, unsigned int data)
|
||||||
{
|
{
|
||||||
#ifdef LOGERROR
|
#ifdef LOGERROR
|
||||||
error ("Lockup %08X = %02X (%08X)\n", address, data, m68k_get_reg (NULL, M68K_REG_PC));
|
error ("Lockup %08X = %02X (%08X)\n", address, data, m68k_get_reg(M68K_REG_PC));
|
||||||
#endif
|
#endif
|
||||||
if (!config.force_dtack)
|
if (!config.force_dtack)
|
||||||
{
|
{
|
||||||
@ -77,7 +93,7 @@ void m68k_lockup_w_8 (unsigned int address, unsigned int data)
|
|||||||
void m68k_lockup_w_16 (unsigned int address, unsigned int data)
|
void m68k_lockup_w_16 (unsigned int address, unsigned int data)
|
||||||
{
|
{
|
||||||
#ifdef LOGERROR
|
#ifdef LOGERROR
|
||||||
error ("Lockup %08X = %04X (%08X)\n", address, data, m68k_get_reg (NULL, M68K_REG_PC));
|
error ("Lockup %08X = %04X (%08X)\n", address, data, m68k_get_reg(M68K_REG_PC));
|
||||||
#endif
|
#endif
|
||||||
if (!config.force_dtack)
|
if (!config.force_dtack)
|
||||||
{
|
{
|
||||||
@ -88,7 +104,7 @@ void m68k_lockup_w_16 (unsigned int address, unsigned int data)
|
|||||||
unsigned int m68k_lockup_r_8 (unsigned int address)
|
unsigned int m68k_lockup_r_8 (unsigned int address)
|
||||||
{
|
{
|
||||||
#ifdef LOGERROR
|
#ifdef LOGERROR
|
||||||
error ("Lockup %08X.b (%08X)\n", address, m68k_get_reg (NULL, M68K_REG_PC));
|
error ("Lockup %08X.b (%08X)\n", address, m68k_get_reg(M68K_REG_PC));
|
||||||
#endif
|
#endif
|
||||||
if (!config.force_dtack)
|
if (!config.force_dtack)
|
||||||
{
|
{
|
||||||
@ -100,7 +116,7 @@ unsigned int m68k_lockup_r_8 (unsigned int address)
|
|||||||
unsigned int m68k_lockup_r_16 (unsigned int address)
|
unsigned int m68k_lockup_r_16 (unsigned int address)
|
||||||
{
|
{
|
||||||
#ifdef LOGERROR
|
#ifdef LOGERROR
|
||||||
error ("Lockup %08X.w (%08X)\n", address, m68k_get_reg (NULL, M68K_REG_PC));
|
error ("Lockup %08X.w (%08X)\n", address, m68k_get_reg(M68K_REG_PC));
|
||||||
#endif
|
#endif
|
||||||
if (!config.force_dtack)
|
if (!config.force_dtack)
|
||||||
{
|
{
|
||||||
@ -110,48 +126,6 @@ unsigned int m68k_lockup_r_16 (unsigned int address)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
/* cartridge EEPROM */
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
unsigned int eeprom_read_byte(unsigned int address)
|
|
||||||
{
|
|
||||||
if (address == eeprom.type.sda_out_adr)
|
|
||||||
{
|
|
||||||
return eeprom_read(0);
|
|
||||||
}
|
|
||||||
return READ_BYTE(cart.rom, address);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int eeprom_read_word(unsigned int address)
|
|
||||||
{
|
|
||||||
if (address == (eeprom.type.sda_out_adr & 0xFFFFFE))
|
|
||||||
{
|
|
||||||
return eeprom_read(1);
|
|
||||||
}
|
|
||||||
return *(uint16 *)(cart.rom + address);
|
|
||||||
}
|
|
||||||
|
|
||||||
void eeprom_write_byte(unsigned int address, unsigned int data)
|
|
||||||
{
|
|
||||||
if ((address == eeprom.type.sda_in_adr) || (address == eeprom.type.scl_adr))
|
|
||||||
{
|
|
||||||
eeprom_write(address, data, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m68k_unused_8_w(address, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void eeprom_write_word(unsigned int address, unsigned int data)
|
|
||||||
{
|
|
||||||
if ((address == (eeprom.type.sda_in_adr & 0xFFFFFE)) || (address == (eeprom.type.scl_adr & 0xFFFFFE)))
|
|
||||||
{
|
|
||||||
eeprom_write(address, data, 1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m68k_unused_16_w (address, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
/* Z80 bus (accessed through I/O chip) */
|
/* Z80 bus (accessed through I/O chip) */
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@ -256,6 +230,7 @@ unsigned int ctrl_io_read_byte(unsigned int address)
|
|||||||
{
|
{
|
||||||
if (!(address & 1))
|
if (!(address & 1))
|
||||||
{
|
{
|
||||||
|
/* Unused bits return prefetched bus data (Time Killers) */
|
||||||
unsigned int data = m68k_read_pcrelative_8(REG_PC) & 0xFE;
|
unsigned int data = m68k_read_pcrelative_8(REG_PC) & 0xFE;
|
||||||
if (zstate == 3)
|
if (zstate == 3)
|
||||||
{
|
{
|
||||||
@ -323,6 +298,7 @@ unsigned int ctrl_io_read_word(unsigned int address)
|
|||||||
|
|
||||||
case 0x11: /* BUSACK */
|
case 0x11: /* BUSACK */
|
||||||
{
|
{
|
||||||
|
/* Unused bits return prefetched bus data (Time Killers) */
|
||||||
unsigned int data = m68k_read_pcrelative_16(REG_PC) & 0xFEFF;
|
unsigned int data = m68k_read_pcrelative_16(REG_PC) & 0xFEFF;
|
||||||
if (zstate == 3)
|
if (zstate == 3)
|
||||||
{
|
{
|
||||||
@ -541,12 +517,13 @@ unsigned int vdp_read_byte(unsigned int address)
|
|||||||
|
|
||||||
case 0x04: /* CTRL */
|
case 0x04: /* CTRL */
|
||||||
{
|
{
|
||||||
return (((vdp_ctrl_r(mcycles_68k) >> 8) & 3) | (m68k_read_pcrelative_8(REG_PC) & 0xFC));
|
/* Unused bits return prefetched bus data */
|
||||||
|
return (((vdp_68k_ctrl_r(mcycles_68k) >> 8) & 3) | (m68k_read_pcrelative_8(REG_PC) & 0xFC));
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x05: /* CTRL */
|
case 0x05: /* CTRL */
|
||||||
{
|
{
|
||||||
return (vdp_ctrl_r(mcycles_68k) & 0xFF);
|
return (vdp_68k_ctrl_r(mcycles_68k) & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x08: /* HVC */
|
case 0x08: /* HVC */
|
||||||
@ -587,7 +564,8 @@ unsigned int vdp_read_word(unsigned int address)
|
|||||||
|
|
||||||
case 0x04: /* CTRL */
|
case 0x04: /* CTRL */
|
||||||
{
|
{
|
||||||
return ((vdp_ctrl_r(mcycles_68k) & 0x3FF) | (m68k_read_pcrelative_16(REG_PC) & 0xFC00));
|
/* Unused bits return prefetched bus data */
|
||||||
|
return ((vdp_68k_ctrl_r(mcycles_68k) & 0x3FF) | (m68k_read_pcrelative_16(REG_PC) & 0xFC00));
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x08: /* HVC */
|
case 0x08: /* HVC */
|
||||||
|
@ -1,23 +1,39 @@
|
|||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* 68k bus controller
|
* 68k bus handlers
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
||||||
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
@ -36,12 +52,6 @@ extern unsigned int m68k_lockup_r_16(unsigned int address);
|
|||||||
extern void m68k_lockup_w_8(unsigned int address, unsigned int data);
|
extern void m68k_lockup_w_8(unsigned int address, unsigned int data);
|
||||||
extern void m68k_lockup_w_16(unsigned int address, unsigned int data);
|
extern void m68k_lockup_w_16(unsigned int address, unsigned int data);
|
||||||
|
|
||||||
/* eeprom */
|
|
||||||
extern unsigned int eeprom_read_byte(unsigned int address);
|
|
||||||
extern unsigned int eeprom_read_word(unsigned int address);
|
|
||||||
extern void eeprom_write_byte(unsigned int address, unsigned int data);
|
|
||||||
extern void eeprom_write_word(unsigned int address, unsigned int data);
|
|
||||||
|
|
||||||
/* Z80 bus */
|
/* Z80 bus */
|
||||||
extern unsigned int z80_read_byte(unsigned int address);
|
extern unsigned int z80_read_byte(unsigned int address);
|
||||||
extern unsigned int z80_read_word(unsigned int address);
|
extern unsigned int z80_read_word(unsigned int address);
|
||||||
|
@ -3,23 +3,40 @@
|
|||||||
* Z80 bank access to 68k bus
|
* Z80 bank access to 68k bus
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
||||||
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -221,12 +238,12 @@ unsigned int zbank_read_vdp(unsigned int address)
|
|||||||
|
|
||||||
case 0x04: /* CTRL */
|
case 0x04: /* CTRL */
|
||||||
{
|
{
|
||||||
return (((vdp_ctrl_r(mcycles_z80) >> 8) & 3) | 0xFC);
|
return (((vdp_68k_ctrl_r(mcycles_z80) >> 8) & 3) | 0xFC);
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x05: /* CTRL */
|
case 0x05: /* CTRL */
|
||||||
{
|
{
|
||||||
return (vdp_ctrl_r(mcycles_z80) & 0xFF);
|
return (vdp_68k_ctrl_r(mcycles_z80) & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x08: /* HVC */
|
case 0x08: /* HVC */
|
||||||
|
@ -3,23 +3,40 @@
|
|||||||
* Z80 bank access to 68k bus
|
* Z80 bank access to 68k bus
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
||||||
* Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _MEMBNK_H_
|
#ifndef _MEMBNK_H_
|
||||||
#define _MEMBNK_H_
|
#define _MEMBNK_H_
|
||||||
|
|
||||||
|
501
source/memz80.c
501
source/memz80.c
@ -1,27 +1,47 @@
|
|||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Z80 bus controller (MD & MS compatibility modes)
|
* Z80 bus handlers (Genesis & Master System modes)
|
||||||
|
*
|
||||||
|
* Support for SG-1000, Mark-III, Master System, Game Gear & Mega Drive ports access
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
||||||
* Eke-Eke (2007-2011), additional code & fixes for the GCN/Wii port
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
/* Handlers for access to unused addresses and those which make the */
|
/* Handlers for access to unused addresses and those which make the */
|
||||||
/* machine lock up. */
|
/* machine lock up. */
|
||||||
@ -72,7 +92,7 @@ static inline unsigned char z80_lockup_r(unsigned int address)
|
|||||||
/* Z80 Memory handlers (Genesis mode) */
|
/* Z80 Memory handlers (Genesis mode) */
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
unsigned char z80_md_memory_r(unsigned int address)
|
unsigned char z80_memory_r(unsigned int address)
|
||||||
{
|
{
|
||||||
switch((address >> 13) & 7)
|
switch((address >> 13) & 7)
|
||||||
{
|
{
|
||||||
@ -110,7 +130,7 @@ unsigned char z80_md_memory_r(unsigned int address)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void z80_md_memory_w(unsigned int address, unsigned char data)
|
void z80_memory_w(unsigned int address, unsigned char data)
|
||||||
{
|
{
|
||||||
switch((address >> 13) & 7)
|
switch((address >> 13) & 7)
|
||||||
{
|
{
|
||||||
@ -166,31 +186,26 @@ void z80_md_memory_w(unsigned int address, unsigned char data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
/* Z80 Memory handlers (Master System mode) */
|
/* Unused Port handlers */
|
||||||
|
/* */
|
||||||
|
/* Ports are unused when not in Mark III compatibility mode. */
|
||||||
|
/* */
|
||||||
|
/* Genesis games that access ports anyway: */
|
||||||
|
/* Thunder Force IV reads port $BF in it's interrupt handler. */
|
||||||
|
/* */
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
unsigned char z80_sms_memory_r(unsigned int address)
|
|
||||||
{
|
|
||||||
return z80_readmap[(address) >> 10][(address) & 0x03FF];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
/* Z80 Port handlers */
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
/*
|
|
||||||
Ports are unused when not in Mark III compatibility mode.
|
|
||||||
|
|
||||||
Genesis games that access ports anyway:
|
|
||||||
Thunder Force IV reads port $BF in it's interrupt handler.
|
|
||||||
*/
|
|
||||||
|
|
||||||
unsigned char z80_unused_port_r(unsigned int port)
|
unsigned char z80_unused_port_r(unsigned int port)
|
||||||
{
|
{
|
||||||
#if LOGERROR
|
#if LOGERROR
|
||||||
error("Z80 unused read from port %04X (%x)\n", port, Z80.pc.w.l);
|
error("Z80 unused read from port %04X (%x)\n", port, Z80.pc.w.l);
|
||||||
#endif
|
#endif
|
||||||
|
if (system_hw == SYSTEM_SMS)
|
||||||
|
{
|
||||||
|
unsigned int address = (Z80.pc.w.l - 1) & 0xFFFF;
|
||||||
|
return z80_readmap[address >> 10][address & 0x3FF];
|
||||||
|
}
|
||||||
return 0xFF;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,13 +216,17 @@ void z80_unused_port_w(unsigned int port, unsigned char data)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void z80_sms_port_w(unsigned int port, unsigned char data)
|
/*--------------------------------------------------------------------------*/
|
||||||
|
/* MegaDrive / Genesis port handlers (Master System compatibility mode) */
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void z80_md_port_w(unsigned int port, unsigned char data)
|
||||||
{
|
{
|
||||||
switch (port & 0xC1)
|
switch (port & 0xC1)
|
||||||
{
|
{
|
||||||
case 0x01:
|
case 0x01:
|
||||||
{
|
{
|
||||||
io_z80_write(data);
|
io_z80_write(1, data, mcycles_z80 + PBC_CYCLE_OFFSET);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,28 +251,9 @@ void z80_sms_port_w(unsigned int port, unsigned char data)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if ((port & 0xFF) == 0x3E)
|
port &= 0xFF;
|
||||||
{
|
|
||||||
/* Memory Control Register */
|
|
||||||
/* NB: this register does not exist on MD hardware but is partially emulated to support BIOS ROM image files */
|
|
||||||
if (data & 0x40)
|
|
||||||
{
|
|
||||||
/* Assume only BIOS would disable Cartridge ROM */
|
|
||||||
if (data & 0x08)
|
|
||||||
{
|
|
||||||
/* BIOS ROM disabled */
|
|
||||||
sms_cart_switch(0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* BIOS ROM enabled */
|
|
||||||
sms_cart_switch(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((port >= 0xF0) && (config.ym2413_enabled))
|
if ((port >= 0xF0) && (config.ym2413 & 1))
|
||||||
{
|
{
|
||||||
fm_write(mcycles_z80, port&3, data);
|
fm_write(mcycles_z80, port&3, data);
|
||||||
return;
|
return;
|
||||||
@ -265,10 +265,127 @@ void z80_sms_port_w(unsigned int port, unsigned char data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char z80_sms_port_r(unsigned int port)
|
unsigned char z80_md_port_r(unsigned int port)
|
||||||
{
|
{
|
||||||
switch (port & 0xC1)
|
switch (port & 0xC1)
|
||||||
{
|
{
|
||||||
|
case 0x40:
|
||||||
|
{
|
||||||
|
return ((vdp_hvc_r(mcycles_z80 - 15) >> 8) & 0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x41:
|
||||||
|
{
|
||||||
|
return (vdp_hvc_r(mcycles_z80 - 15) & 0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x80:
|
||||||
|
{
|
||||||
|
return vdp_z80_data_r();
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x81:
|
||||||
|
{
|
||||||
|
return vdp_z80_ctrl_r(mcycles_z80);
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
port &= 0xFF;
|
||||||
|
|
||||||
|
if ((port == 0xC0) || (port == 0xC1) || (port == 0xDC) || (port == 0xDD))
|
||||||
|
{
|
||||||
|
return io_z80_read(port & 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* read FM chip if enabled */
|
||||||
|
if ((port >= 0xF0) && (config.ym2413 & 1))
|
||||||
|
{
|
||||||
|
return YM2413Read(port & 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
return z80_unused_port_r(port);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
/* Game Gear port handlers */
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void z80_gg_port_w(unsigned int port, unsigned char data)
|
||||||
|
{
|
||||||
|
switch(port & 0xC1)
|
||||||
|
{
|
||||||
|
case 0x00:
|
||||||
|
case 0x01:
|
||||||
|
{
|
||||||
|
port &= 0xFF;
|
||||||
|
|
||||||
|
if (port < 0x07)
|
||||||
|
{
|
||||||
|
if (system_hw == SYSTEM_GG)
|
||||||
|
{
|
||||||
|
io_gg_write(port, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
z80_unused_port_w(port & 0xFF, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
io_z80_write(port & 1, data, mcycles_z80 + SMS_CYCLE_OFFSET);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x40:
|
||||||
|
case 0x41:
|
||||||
|
{
|
||||||
|
psg_write(mcycles_z80, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x80:
|
||||||
|
{
|
||||||
|
vdp_z80_data_w(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x81:
|
||||||
|
{
|
||||||
|
vdp_sms_ctrl_w(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
z80_unused_port_w(port & 0xFF, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char z80_gg_port_r(unsigned int port)
|
||||||
|
{
|
||||||
|
switch(port & 0xC1)
|
||||||
|
{
|
||||||
|
case 0x00:
|
||||||
|
case 0x01:
|
||||||
|
{
|
||||||
|
port &= 0xFF;
|
||||||
|
|
||||||
|
if (port < 0x07)
|
||||||
|
{
|
||||||
|
if (system_hw == SYSTEM_GG)
|
||||||
|
{
|
||||||
|
return io_gg_read(port);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return z80_unused_port_r(port);
|
||||||
|
}
|
||||||
|
|
||||||
case 0x40:
|
case 0x40:
|
||||||
{
|
{
|
||||||
return ((vdp_hvc_r(mcycles_z80) >> 8) & 0xFF);
|
return ((vdp_hvc_r(mcycles_z80) >> 8) & 0xFF);
|
||||||
@ -286,23 +403,281 @@ unsigned char z80_sms_port_r(unsigned int port)
|
|||||||
|
|
||||||
case 0x81:
|
case 0x81:
|
||||||
{
|
{
|
||||||
return (vdp_ctrl_r(mcycles_z80) & 0xFF);
|
return vdp_z80_ctrl_r(mcycles_z80);
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
port &= 0xFF;
|
port &= 0xFF;
|
||||||
|
|
||||||
if ((port == 0xC0) || (port == 0xC1) || (port == 0xDC) || (port == 0xDD) || (port == 0xDE) || (port == 0xDF))
|
if ((port == 0xC0) || (port == 0xC1) || (port == 0xDC) || (port == 0xDD))
|
||||||
{
|
{
|
||||||
return io_z80_read(port & 1);
|
return io_z80_read(port & 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((port >= 0xF0) && (config.ym2413_enabled))
|
return z80_unused_port_r(port);
|
||||||
{
|
}
|
||||||
return YM2413Read(port & 3);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
/* Master System port handlers */
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void z80_ms_port_w(unsigned int port, unsigned char data)
|
||||||
|
{
|
||||||
|
switch (port & 0xC1)
|
||||||
|
{
|
||||||
|
case 0x00:
|
||||||
|
case 0x01:
|
||||||
|
{
|
||||||
|
io_z80_write(port & 1, data, mcycles_z80 + SMS_CYCLE_OFFSET);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x40:
|
||||||
|
case 0x41:
|
||||||
|
{
|
||||||
|
psg_write(mcycles_z80, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x80:
|
||||||
|
{
|
||||||
|
vdp_z80_data_w(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x81:
|
||||||
|
{
|
||||||
|
vdp_sms_ctrl_w(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
if (!(port & 4) && (config.ym2413 & 1))
|
||||||
|
{
|
||||||
|
fm_write(mcycles_z80, port & 3, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
z80_unused_port_w(port & 0xFF, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char z80_ms_port_r(unsigned int port)
|
||||||
|
{
|
||||||
|
switch (port & 0xC1)
|
||||||
|
{
|
||||||
|
case 0x00:
|
||||||
|
case 0x01:
|
||||||
|
{
|
||||||
|
return z80_unused_port_r(port & 0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x40:
|
||||||
|
{
|
||||||
|
return ((vdp_hvc_r(mcycles_z80) >> 8) & 0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x41:
|
||||||
|
{
|
||||||
|
return (vdp_hvc_r(mcycles_z80) & 0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x80:
|
||||||
|
{
|
||||||
|
return vdp_z80_data_r();
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x81:
|
||||||
|
{
|
||||||
|
return vdp_z80_ctrl_r(mcycles_z80);
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
/* read FM chip if enabled */
|
||||||
|
if (!(port & 4) && (config.ym2413 & 1))
|
||||||
|
{
|
||||||
|
/* check if I/O ports are disabled */
|
||||||
|
if (io_reg[0x0E] & 0x04)
|
||||||
|
{
|
||||||
|
return YM2413Read(port & 3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return YM2413Read(port & 3) & io_z80_read(port & 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check if I/O ports are enabled */
|
||||||
|
if (!(io_reg[0x0E] & 0x04))
|
||||||
|
{
|
||||||
|
return io_z80_read(port & 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return z80_unused_port_r(port & 0xFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
/* Mark III port handlers */
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void z80_m3_port_w(unsigned int port, unsigned char data)
|
||||||
|
{
|
||||||
|
switch (port & 0xC1)
|
||||||
|
{
|
||||||
|
case 0x00:
|
||||||
|
case 0x01:
|
||||||
|
{
|
||||||
|
z80_unused_port_w(port, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x40:
|
||||||
|
case 0x41:
|
||||||
|
{
|
||||||
|
psg_write(mcycles_z80, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x80:
|
||||||
|
{
|
||||||
|
vdp_z80_data_w(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x81:
|
||||||
|
{
|
||||||
|
vdp_sms_ctrl_w(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
if (!(port & 4) && (config.ym2413 & 1))
|
||||||
|
{
|
||||||
|
fm_write(mcycles_z80, port & 3, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
z80_unused_port_w(port & 0xFF, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char z80_m3_port_r(unsigned int port)
|
||||||
|
{
|
||||||
|
switch (port & 0xC1)
|
||||||
|
{
|
||||||
|
case 0x00:
|
||||||
|
case 0x01:
|
||||||
|
{
|
||||||
|
return z80_unused_port_r(port & 0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x40:
|
||||||
|
{
|
||||||
|
return ((vdp_hvc_r(mcycles_z80) >> 8) & 0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x41:
|
||||||
|
{
|
||||||
|
return (vdp_hvc_r(mcycles_z80) & 0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x80:
|
||||||
|
{
|
||||||
|
return vdp_z80_data_r();
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x81:
|
||||||
|
{
|
||||||
|
return vdp_z80_ctrl_r(mcycles_z80);
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
/* read FM chip if enabled */
|
||||||
|
if (!(port & 4) && (config.ym2413 & 1))
|
||||||
|
{
|
||||||
|
/* I/O ports are automatically disabled */
|
||||||
|
return YM2413Read(port & 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* read I/O ports */
|
||||||
|
return io_z80_read(port & 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
/* SG-1000 port handlers */
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void z80_sg_port_w(unsigned int port, unsigned char data)
|
||||||
|
{
|
||||||
|
switch(port & 0xC1)
|
||||||
|
{
|
||||||
|
case 0x40:
|
||||||
|
case 0x41:
|
||||||
|
{
|
||||||
|
psg_write(mcycles_z80, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x80:
|
||||||
|
{
|
||||||
|
vdp_z80_data_w(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x81:
|
||||||
|
{
|
||||||
|
vdp_tms_ctrl_w(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
z80_unused_port_w(port & 0xFF, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char z80_sg_port_r(unsigned int port)
|
||||||
|
{
|
||||||
|
switch (port & 0xC1)
|
||||||
|
{
|
||||||
|
case 0x80:
|
||||||
|
{
|
||||||
|
return vdp_z80_data_r();
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x81:
|
||||||
|
{
|
||||||
|
return vdp_z80_ctrl_r(mcycles_z80);
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0xC0:
|
||||||
|
case 0xC1:
|
||||||
|
{
|
||||||
|
return io_z80_read(port & 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
return z80_unused_port_r(port);
|
return z80_unused_port_r(port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,60 @@
|
|||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Z80 bus controller (MD & MS compatibility mode)
|
* Z80 bus handlers (Genesis & Master System modes)
|
||||||
|
*
|
||||||
|
* Support for SG-1000, Mark-III, Master System, Game Gear & Mega Drive ports access
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
||||||
* Eke-Eke (2007-2011), additional code & fixes for the GCN/Wii port
|
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* it under the terms of the GNU General Public License as published by
|
* provided that the following conditions are met:
|
||||||
* 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,
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* product or activity.
|
||||||
* 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
|
* - Redistributions that are modified from the original source must include the
|
||||||
* along with this program; if not, write to the Free Software
|
* complete source code, including the source code for all components used by a
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
#ifndef _MEMZ80_H_
|
#ifndef _MEMZ80_H_
|
||||||
#define _MEMZ80_H_
|
#define _MEMZ80_H_
|
||||||
|
|
||||||
extern unsigned char z80_md_memory_r(unsigned int address);
|
extern unsigned char z80_memory_r(unsigned int address);
|
||||||
extern void z80_md_memory_w(unsigned int address, unsigned char data);
|
extern void z80_memory_w(unsigned int address, unsigned char data);
|
||||||
extern unsigned char z80_sms_memory_r(unsigned int address);
|
|
||||||
|
|
||||||
extern unsigned char z80_unused_port_r(unsigned int port);
|
extern unsigned char z80_unused_port_r(unsigned int port);
|
||||||
extern void z80_unused_port_w(unsigned int port, unsigned char data);
|
extern void z80_unused_port_w(unsigned int port, unsigned char data);
|
||||||
extern unsigned char z80_sms_port_r(unsigned int port);
|
extern unsigned char z80_md_port_r(unsigned int port);
|
||||||
extern void z80_sms_port_w(unsigned int port, unsigned char data);
|
extern void z80_md_port_w(unsigned int port, unsigned char data);
|
||||||
|
extern unsigned char z80_gg_port_r(unsigned int port);
|
||||||
|
extern void z80_gg_port_w(unsigned int port, unsigned char data);
|
||||||
|
extern unsigned char z80_ms_port_r(unsigned int port);
|
||||||
|
extern void z80_ms_port_w(unsigned int port, unsigned char data);
|
||||||
|
extern unsigned char z80_m3_port_r(unsigned int port);
|
||||||
|
extern void z80_m3_port_w(unsigned int port, unsigned char data);
|
||||||
|
extern unsigned char z80_sg_port_r(unsigned int port);
|
||||||
|
extern void z80_sg_port_w(unsigned int port, unsigned char data);
|
||||||
|
|
||||||
#endif /* _MEMZ80_H_ */
|
#endif /* _MEMZ80_H_ */
|
||||||
|
@ -26,7 +26,8 @@
|
|||||||
#include "loadrom.h"
|
#include "loadrom.h"
|
||||||
#include "sms_cart.h"
|
#include "sms_cart.h"
|
||||||
#include "md_cart.h"
|
#include "md_cart.h"
|
||||||
#include "eeprom.h"
|
#include "md_eeprom.h"
|
||||||
|
#include "gg_eeprom.h"
|
||||||
#include "sram.h"
|
#include "sram.h"
|
||||||
#include "ggenie.h"
|
#include "ggenie.h"
|
||||||
#include "areplay.h"
|
#include "areplay.h"
|
||||||
|
@ -1,6 +1,19 @@
|
|||||||
|
/* Finite impulse response (FIR) resampler with adjustable FIR size */
|
||||||
|
|
||||||
/* Game_Music_Emu 0.5.2. http://www.slack.net/~ant/ */
|
/* Game_Music_Emu 0.5.2. http://www.slack.net/~ant/ */
|
||||||
/* Copyright (C) 2004-2006 Shay Green. */
|
|
||||||
/* C Conversion by Eke-Eke for use in Genesis Plus (2009). */
|
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
||||||
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
General Public License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version. This
|
||||||
|
module 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 Lesser General Public License for more
|
||||||
|
details. You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this module; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||||
|
|
||||||
|
/* C Conversion by Eke-Eke for use in Genesis Plus GX (2009). */
|
||||||
|
|
||||||
#include "Fir_Resampler.h"
|
#include "Fir_Resampler.h"
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
@ -34,7 +47,7 @@ static void gen_sinc(double rolloff, int width, double offset, double spacing, d
|
|||||||
|
|
||||||
double angle = (count / 2 - 1 + offset) * -fstep;
|
double angle = (count / 2 - 1 + offset) * -fstep;
|
||||||
|
|
||||||
while ( count-- )
|
do
|
||||||
{
|
{
|
||||||
*out++ = 0;
|
*out++ = 0;
|
||||||
w = angle * to_w;
|
w = angle * to_w;
|
||||||
@ -51,6 +64,7 @@ static void gen_sinc(double rolloff, int width, double offset, double spacing, d
|
|||||||
}
|
}
|
||||||
angle += fstep;
|
angle += fstep;
|
||||||
}
|
}
|
||||||
|
while(--count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static int available( long input_count )
|
/*static int available( long input_count )
|
||||||
@ -149,10 +163,6 @@ double Fir_Resampler_time_ratio( double new_factor, double rolloff )
|
|||||||
double pos = 0.0;
|
double pos = 0.0;
|
||||||
res = -1;
|
res = -1;
|
||||||
|
|
||||||
#ifdef NGC
|
|
||||||
u32 level = IRQ_Disable();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for ( r = 1; r <= MAX_RES; r++ )
|
for ( r = 1; r <= MAX_RES; r++ )
|
||||||
{
|
{
|
||||||
pos += ratio;
|
pos += ratio;
|
||||||
@ -195,10 +205,6 @@ double Fir_Resampler_time_ratio( double new_factor, double rolloff )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NGC
|
|
||||||
IRQ_Restore(level);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Fir_Resampler_clear();
|
Fir_Resampler_clear();
|
||||||
|
|
||||||
return ratio;
|
return ratio;
|
||||||
|
@ -1,6 +1,20 @@
|
|||||||
/* Finite impulse response (FIR) resampler with adjustable FIR size */
|
/* Finite impulse response (FIR) resampler with adjustable FIR size */
|
||||||
|
|
||||||
/* Game_Music_Emu 0.5.2 */
|
/* Game_Music_Emu 0.5.2. http://www.slack.net/~ant/ */
|
||||||
|
|
||||||
|
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
||||||
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
General Public License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version. This
|
||||||
|
module 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 Lesser General Public License for more
|
||||||
|
details. You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this module; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||||
|
|
||||||
|
/* C Conversion by Eke-Eke for use in Genesis Plus GX (2009). */
|
||||||
|
|
||||||
#ifndef FIR_RESAMPLER_H
|
#ifndef FIR_RESAMPLER_H
|
||||||
#define FIR_RESAMPLER_H
|
#define FIR_RESAMPLER_H
|
||||||
|
|
||||||
|
@ -68,13 +68,12 @@ typedef struct
|
|||||||
int chan_amp[4]; /* current channel amplitudes in delta buffers */
|
int chan_amp[4]; /* current channel amplitudes in delta buffers */
|
||||||
} SN76489_Context;
|
} SN76489_Context;
|
||||||
|
|
||||||
static const int PSGVolumeValues[16] = {
|
static const uint16 PSGVolumeValues[16] =
|
||||||
|
{
|
||||||
/* These values are taken from a real SMS2's output */
|
/* These values are taken from a real SMS2's output */
|
||||||
/*{892,892,892,760,623,497,404,323,257,198,159,123,96,75,60,0}, */
|
/*{892,892,892,760,623,497,404,323,257,198,159,123,96,75,60,0}, */
|
||||||
/* I can't remember why 892... :P some scaling I did at some point */
|
/* I can't remember why 892... :P some scaling I did at some point */
|
||||||
|
|
||||||
/* these values are true volumes for 2dB drops at each step (multiply previous by 10^-0.1) */
|
/* these values are true volumes for 2dB drops at each step (multiply previous by 10^-0.1) */
|
||||||
|
|
||||||
1516,1205,957,760,603,479,381,303,240,191,152,120,96,76,60,0
|
1516,1205,957,760,603,479,381,303,240,191,152,120,96,76,60,0
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -140,7 +139,6 @@ void SN76489_BoostNoise(int boost)
|
|||||||
|
|
||||||
void SN76489_SetContext(uint8 *data)
|
void SN76489_SetContext(uint8 *data)
|
||||||
{
|
{
|
||||||
|
|
||||||
memcpy(&SN76489, data, sizeof(SN76489_Context));
|
memcpy(&SN76489, data, sizeof(SN76489_Context));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +193,7 @@ void SN76489_Write(int data)
|
|||||||
SN76489.Channels[LatchedRegister>>1] = PSGVolumeValues[data&0x0f];
|
SN76489.Channels[LatchedRegister>>1] = PSGVolumeValues[data&0x0f];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6: /* Noise */
|
case 6: /* Noise control */
|
||||||
SN76489.Registers[6] = data & 0x0f;
|
SN76489.Registers[6] = data & 0x0f;
|
||||||
SN76489.NoiseShiftRegister = NoiseInitialState; /* reset shift register */
|
SN76489.NoiseShiftRegister = NoiseInitialState; /* reset shift register */
|
||||||
SN76489.NoiseFreq = 0x10 << (data&0x3); /* set noise signal generator frequency */
|
SN76489.NoiseFreq = 0x10 << (data&0x3); /* set noise signal generator frequency */
|
||||||
@ -232,7 +230,6 @@ static void UpdateNoiseAmplitude(int time)
|
|||||||
|
|
||||||
/* Runs tone channel for clock_length clocks */
|
/* Runs tone channel for clock_length clocks */
|
||||||
static void RunTone(int i, int clock_length)
|
static void RunTone(int i, int clock_length)
|
||||||
|
|
||||||
{
|
{
|
||||||
int time;
|
int time;
|
||||||
|
|
||||||
@ -264,7 +261,6 @@ static void RunTone(int i, int clock_length)
|
|||||||
|
|
||||||
/* Runs noise channel for clock_length clocks */
|
/* Runs noise channel for clock_length clocks */
|
||||||
static void RunNoise(int clock_length)
|
static void RunNoise(int clock_length)
|
||||||
|
|
||||||
{
|
{
|
||||||
int time;
|
int time;
|
||||||
|
|
||||||
|
@ -20,4 +20,3 @@ extern void SN76489_Update(INT16 *buffer, int length);
|
|||||||
extern void SN76489_BoostNoise(int boost);
|
extern void SN76489_BoostNoise(int boost);
|
||||||
|
|
||||||
#endif /* _SN76489_H_ */
|
#endif /* _SN76489_H_ */
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user