diff --git a/doxygen b/doxygen index 10b608cc..580671e2 100644 --- a/doxygen +++ b/doxygen @@ -14,207 +14,207 @@ # Project related configuration options #--------------------------------------------------------------------------- -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. -PROJECT_NAME = +PROJECT_NAME = -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = +PROJECT_NUMBER = -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = docs -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, -# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, -# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, -# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, +# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, +# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, +# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, # Swedish, and Ukrainian. OUTPUT_LANGUAGE = English -# This tag can be used to specify the encoding used in the generated output. -# The encoding is not always determined by the language that is chosen, -# but also whether or not the output is meant for Windows or non-Windows users. -# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES -# forces the Windows encoding (this is the default for the Windows binary), -# whereas setting the tag to NO uses a Unix-style encoding (the default for +# This tag can be used to specify the encoding used in the generated output. +# The encoding is not always determined by the language that is chosen, +# but also whether or not the output is meant for Windows or non-Windows users. +# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES +# forces the Windows encoding (this is the default for the Windows binary), +# whereas setting the tag to NO uses a Unix-style encoding (the default for # all platforms other than Windows). USE_WINDOWS_ENCODING = NO -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" -ABBREVIATE_BRIEF = +ABBREVIATE_BRIEF = -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the # path to strip. -STRIP_FROM_PATH = +STRIP_FROM_PATH = -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. -STRIP_FROM_INC_PATH = +STRIP_FROM_INC_PATH = -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an # explicit @brief command for a brief description. JAVADOC_AUTOBRIEF = NO -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO -# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# If the DETAILS_AT_TOP tag is set to YES then Doxygen # will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member +# If set to NO, the detailed description appears after the member # documentation. DETAILS_AT_TOP = NO -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO -# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. -ALIASES = +ALIASES = -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes # will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to -# include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES @@ -223,326 +223,326 @@ SUBGROUPING = YES # Build related configuration options #--------------------------------------------------------------------------- -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = YES -# If the EXTRACT_STATIC tag is set to YES all static members of a file +# If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the +# Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES -# The ENABLED_SECTIONS tag can be used to enable conditional +# The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. -ENABLED_SECTIONS = +ENABLED_SECTIONS = -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = YES -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from the -# version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. -FILE_VERSION_FILTER = +FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- -# The QUIET tag can be used to turn on/off the messages that are generated +# The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written # to stderr. -WARN_LOGFILE = +WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = src src/mappers src/boards src/drivers/common src/drivers/win src/drivers/sdl src/input src/utils +INPUT = src src/boards src/drivers/common src/drivers/win src/drivers/sdl src/input src/utils -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py FILE_PATTERNS = *.cpp *.h *.c *.inc -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = +EXCLUDE = -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* -EXCLUDE_PATTERNS = +EXCLUDE_PATTERNS = -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see # the \include command). -EXAMPLE_PATH = +EXAMPLE_PATH = -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left # blank all files are included. -EXAMPLE_PATTERNS = +EXAMPLE_PATTERNS = -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see # the \image command). -IMAGE_PATH = +IMAGE_PATH = -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. -INPUT_FILTER = +INPUT_FILTER = -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. -FILTER_PATTERNS = +FILTER_PATTERNS = -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO @@ -551,46 +551,46 @@ FILTER_SOURCE_FILES = NO # configuration options related to source browsing #--------------------------------------------------------------------------- -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO -# Setting the INLINE_SOURCES tag to YES will include the body +# Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES @@ -599,133 +599,133 @@ VERBATIM_HEADERS = YES # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. -IGNORE_PREFIX = +IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a # standard header. -HTML_HEADER = +HTML_HEADER = -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a # standard footer. -HTML_FOOTER = +HTML_FOOTER = -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! -HTML_STYLESHEET = +HTML_STYLESHEET = -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be # written to the html output directory. -CHM_FILE = +CHM_FILE = -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. -HHC_LOCATION = +HHC_LOCATION = -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO -# The TOC_EXPAND flag can be set to YES to add extra items for group members +# The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO -# This tag can be used to set the number of enum values (range [1..20]) +# This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. GENERATE_TREEVIEW = NO -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 @@ -734,74 +734,74 @@ TREEVIEW_WIDTH = 250 # configuration options related to the LaTeX output #--------------------------------------------------------------------------- -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. -EXTRA_PACKAGES = +EXTRA_PACKAGES = -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! -LATEX_HEADER = +LATEX_HEADER = -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO @@ -810,68 +810,68 @@ LATEX_HIDE_INDICES = NO # configuration options related to the RTF output #--------------------------------------------------------------------------- -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. -RTF_STYLESHEET_FILE = +RTF_STYLESHEET_FILE = -# Set optional variables used in the generation of an rtf document. +# Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. -RTF_EXTENSIONS_FILE = +RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man -# The MAN_EXTENSION tag determines the extension that is added to +# The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO @@ -880,33 +880,33 @@ MAN_LINKS = NO # configuration options related to the XML output #--------------------------------------------------------------------------- -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the # syntax of the XML files. -XML_SCHEMA = +XML_SCHEMA = -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the # syntax of the XML files. -XML_DTD = +XML_DTD = -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES @@ -915,10 +915,10 @@ XML_PROGRAMLISTING = YES # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO @@ -927,311 +927,311 @@ GENERATE_AUTOGEN_DEF = NO # configuration options related to the Perl module output #--------------------------------------------------------------------------- -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. -PERLMOD_MAKEVAR_PREFIX = +PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- -# Configuration options related to the preprocessor +# Configuration options related to the preprocessor #--------------------------------------------------------------------------- -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by # the preprocessor. -INCLUDE_PATH = +INCLUDE_PATH = -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. -INCLUDE_FILE_PATTERNS = +INCLUDE_FILE_PATTERNS = -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator # instead of the = operator. -PREDEFINED = +PREDEFINED = -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. -EXPAND_AS_DEFINED = +EXPAND_AS_DEFINED = -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- -# Configuration::additions related to external references +# Configuration::additions related to external references #--------------------------------------------------------------------------- -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen +# If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. -TAGFILES = +TAGFILES = -# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. -GENERATE_TAGFILE = +GENERATE_TAGFILE = -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES -# The PERL_PATH should be the absolute path and name of the perl script +# The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- -# Configuration options related to the dot tool +# Configuration options related to the dot tool #--------------------------------------------------------------------------- -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO -# If set to YES, the inheritance and collaboration graphs will show the +# If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES -# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected # functions only using the \callgraph command. CALL_GRAPH = NO -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png -# The tag DOT_PATH can be used to specify the path where the dot tool can be +# The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. -DOT_PATH = +DOT_PATH = -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the # \dotfile command). -DOTFILE_DIRS = +DOTFILE_DIRS = -# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_WIDTH = 1024 -# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_HEIGHT = 1024 -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that a graph may be further truncated if the graph's -# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH -# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that a graph may be further truncated if the graph's +# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH +# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), # the graph is not depth-constrained. MAX_DOT_GRAPH_DEPTH = 0 -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, which results in a white background. -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to # read). DOT_TRANSPARENT = NO -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- -# Configuration::additions related to the search engine +# Configuration::additions related to the search engine #--------------------------------------------------------------------------- -# The SEARCHENGINE tag specifies whether or not a search engine should be +# The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO diff --git a/src/SConscript b/src/SConscript index 7751dd58..4713e155 100644 --- a/src/SConscript +++ b/src/SConscript @@ -8,7 +8,6 @@ drivers/common fir input utils -mappers """) #palettes diff --git a/src/boards/164.cpp b/src/boards/164.cpp index a55e6f8a..7cde0a3a 100644 --- a/src/boards/164.cpp +++ b/src/boards/164.cpp @@ -17,235 +17,213 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * Actually, all this may be the same mapper with different switcheable banking modes, maybe it's just an subtypes - * of the same one board with various modes locked just like SuperGame boards, based on 215 mapper - * + * It seems that 162/163/164 mappers are the same mapper with just different + * mapper modes enabled or disabled in software or hardware, need more nanjing + * carts */ #include "mapinc.h" static uint8 laststrobe, trigger; static uint8 reg[8]; -static uint8 *WRAM=NULL; +static uint8 *WRAM = NULL; static uint32 WRAMSIZE; -static void(*WSync)(void); +static writefunc pcmwrite; -static SFORMAT StateRegs[]= +static void (*WSync)(void); + +static SFORMAT StateRegs[] = { - {&laststrobe, 1, "STB"}, - {&trigger, 1, "TRG"}, - {reg, 8, "REGS"}, - {0} + { &laststrobe, 1, "STB" }, + { &trigger, 1, "TRG" }, + { reg, 8, "REGS" }, + { 0 } }; -static void Sync(void) -{ - setprg8r(0x10,0x6000,0); - setprg32(0x8000,(reg[0]<<4)|(reg[1]&0xF)); +static void Sync(void) { + setprg8r(0x10, 0x6000, 0); + setprg32(0x8000, (reg[0] << 4) | (reg[1] & 0xF)); setchr8(0); } -static void StateRestore(int version) -{ +static void StateRestore(int version) { WSync(); } -static DECLFR(ReadLow) -{ - switch (A&0x7700) - { - case 0x5100: - return reg[2]|reg[0]|reg[1]|reg[3]^0xff; break; - case 0x5500: - if(trigger) - return reg[2]|reg[1]; // Lei Dian Huang Bi Ka Qiu Chuan Shuo (NJ046) may broke other games - else - return 0; +static DECLFR(ReadLow) { + switch (A & 0x7700) { + case 0x5100: return reg[2] | reg[0] | reg[1] | reg[3] ^ 0xff; break; + case 0x5500: + if (trigger) + return reg[2] | reg[1]; // Lei Dian Huang Bi Ka Qiu Chuan Shuo (NJ046) may broke other games + else + return 0; } return 4; } -static void M163HB(void) -{ - if(reg[1]&0x80) - { - if(scanline==239) - { - setchr4(0x0000,0); - setchr4(0x1000,0); - } - else if(scanline==127) - { - setchr4(0x0000,1); - setchr4(0x1000,1); +static void M163HB(void) { + if (reg[1] & 0x80) { + if (scanline == 239) { + setchr4(0x0000, 0); + setchr4(0x1000, 0); + } else if (scanline == 127) { + setchr4(0x0000, 1); + setchr4(0x1000, 1); } /* - if(scanline>=127) // Hu Lu Jin Gang (NJ039) (Ch) [!] don't like it - { - setchr4(0x0000,1); - setchr4(0x1000,1); - } - else - { - setchr4(0x0000,0); - setchr4(0x1000,0); - } + if(scanline>=127) // Hu Lu Jin Gang (NJ039) (Ch) [!] don't like it + { + setchr4(0x0000,1); + setchr4(0x1000,1); + } + else + { + setchr4(0x0000,0); + setchr4(0x1000,0); + } */ } } -static DECLFW(Write) -{ - switch (A&0x7300) - { - case 0x5100: reg[0]=V; WSync(); break; - case 0x5000: reg[1]=V; WSync(); break; - case 0x5300: reg[2]=V; break; - case 0x5200: reg[3]=V; WSync(); break; +static DECLFW(Write) { + switch (A & 0x7300) { + case 0x5100: reg[0] = V; WSync(); break; + case 0x5000: reg[1] = V; WSync(); break; + case 0x5300: reg[2] = V; break; + case 0x5200: reg[3] = V; WSync(); break; } } -static void Power(void) -{ - memset(reg,0,8); - reg[1]=0xFF; - SetWriteHandler(0x5000,0x5FFF,Write); - SetReadHandler(0x6000,0xFFFF,CartBR); - SetWriteHandler(0x6000,0x7FFF,CartBW); +static void Power(void) { + memset(reg, 0, 8); + reg[1] = 0xFF; + SetWriteHandler(0x5000, 0x5FFF, Write); + SetReadHandler(0x6000, 0xFFFF, CartBR); + SetWriteHandler(0x6000, 0x7FFF, CartBW); WSync(); } -static void Close(void) -{ - if(WRAM) +static void Close(void) { + if (WRAM) FCEU_gfree(WRAM); - WRAM=NULL; + WRAM = NULL; } -void Mapper164_Init(CartInfo *info) -{ - info->Power=Power; - info->Close=Close; +void Mapper164_Init(CartInfo *info) { + info->Power = Power; + info->Close = Close; WSync = Sync; WRAMSIZE = 8192; - WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE); - SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1); + WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); - if(info->battery) - { - info->SaveGame[0]=WRAM; - info->SaveGameLen[0]=WRAMSIZE; + if (info->battery) { + info->SaveGame[0] = WRAM; + info->SaveGameLen[0] = WRAMSIZE; } - GameStateRestore=StateRestore; + GameStateRestore = StateRestore; AddExState(&StateRegs, ~0, 0, 0); } -static DECLFW(Write2) -{ - if(A==0x5101) - { - if(laststrobe&&!V) - trigger^=1; - laststrobe=V; - }else if(A==0x5100&&V==6) //damn thoose protected games - setprg32(0x8000,3); +static DECLFW(Write2) { + if (A == 0x5101) { + if (laststrobe && !V) { + trigger ^= 1; + } + laststrobe = V; + } else if (A == 0x5100 && V == 6) //damn thoose protected games + setprg32(0x8000, 3); else - switch (A&0x7300) - { - case 0x5200: reg[0]=V; WSync(); break; - case 0x5000: reg[1]=V; WSync(); if(!(reg[1]&0x80)&&(scanline<128)) setchr8(0); /* setchr8(0); */ break; - case 0x5300: reg[2]=V; break; - case 0x5100: reg[3]=V; WSync(); break; - } + switch (A & 0x7300) { + case 0x5200: reg[0] = V; WSync(); break; + case 0x5000: reg[1] = V; WSync(); if (!(reg[1] & 0x80) && (scanline < 128)) setchr8(0); /* setchr8(0); */ break; + case 0x5300: reg[2] = V; break; + case 0x5100: reg[3] = V; WSync(); break; + } } -static void Power2(void) -{ - memset(reg,0,8); - laststrobe=1; - SetReadHandler(0x5000,0x5FFF,ReadLow); - SetWriteHandler(0x5000,0x5FFF,Write2); - SetReadHandler(0x6000,0xFFFF,CartBR); - SetWriteHandler(0x6000,0x7FFF,CartBW); +static void Power2(void) { + memset(reg, 0, 8); + laststrobe = 1; + pcmwrite = GetWriteHandler(0x4011); + SetReadHandler(0x5000, 0x5FFF, ReadLow); + SetWriteHandler(0x5000, 0x5FFF, Write2); + SetReadHandler(0x6000, 0xFFFF, CartBR); + SetWriteHandler(0x6000, 0x7FFF, CartBW); WSync(); } -void Mapper163_Init(CartInfo *info) -{ - info->Power=Power2; - info->Close=Close; +void Mapper163_Init(CartInfo *info) { + info->Power = Power2; + info->Close = Close; WSync = Sync; - GameHBIRQHook=M163HB; + GameHBIRQHook = M163HB; WRAMSIZE = 8192; - WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE); - SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1); + WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); - if(info->battery) - { - info->SaveGame[0]=WRAM; - info->SaveGameLen[0]=WRAMSIZE; + if (info->battery) { + info->SaveGame[0] = WRAM; + info->SaveGameLen[0] = WRAMSIZE; } - GameStateRestore=StateRestore; + GameStateRestore = StateRestore; AddExState(&StateRegs, ~0, 0, 0); } -static void Sync3(void) -{ +static void Sync3(void) { setchr8(0); - setprg8r(0x10,0x6000,0); - switch(reg[3]&7){ - case 0: - case 2: setprg32(0x8000,(reg[0]&0xc)|(reg[1]&2)|((reg[2]&0xf)<<4)); break; - case 1: - case 3: setprg32(0x8000,(reg[0]&0xc)|(reg[2]&0xf)<<4); break; - case 4: - case 6: setprg32(0x8000,(reg[0]&0xe)|((reg[1]>>1)&1)|((reg[2]&0xf)<<4)); break; - case 5: - case 7: setprg32(0x8000,(reg[0]&0xf)|((reg[2]&0xf)<<4)); break; + setprg8r(0x10, 0x6000, 0); + switch (reg[3] & 7) { + case 0: + case 2: setprg32(0x8000, (reg[0] & 0xc) | (reg[1] & 2) | ((reg[2] & 0xf) << 4)); break; + case 1: + case 3: setprg32(0x8000, (reg[0] & 0xc) | (reg[2] & 0xf) << 4); break; + case 4: + case 6: setprg32(0x8000, (reg[0] & 0xe) | ((reg[1] >> 1) & 1) | ((reg[2] & 0xf) << 4)); break; + case 5: + case 7: setprg32(0x8000, (reg[0] & 0xf) | ((reg[2] & 0xf) << 4)); break; } } -static DECLFW(Write3) -{ - reg[(A>>8)&3]=V; +static DECLFW(Write3) { +// FCEU_printf("bs %04x %02x\n",A,V); + reg[(A >> 8) & 3] = V; WSync(); } -static void Power3(void) -{ - reg[0]=3; - reg[1]=0; - reg[2]=0; - reg[3]=7; - SetWriteHandler(0x5000,0x5FFF,Write3); - SetReadHandler(0x6000,0xFFFF,CartBR); - SetWriteHandler(0x6000,0x7FFF,CartBW); +static void Power3(void) { + reg[0] = 3; + reg[1] = 0; + reg[2] = 0; + reg[3] = 7; + SetWriteHandler(0x5000, 0x5FFF, Write3); + SetReadHandler(0x6000, 0xFFFF, CartBR); + SetWriteHandler(0x6000, 0x7FFF, CartBW); WSync(); } -void UNLFS304_Init(CartInfo *info) -{ - info->Power=Power3; - info->Close=Close; +void UNLFS304_Init(CartInfo *info) { + info->Power = Power3; + info->Close = Close; WSync = Sync3; WRAMSIZE = 8192; - WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE); - SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1); + WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); - if(info->battery) - { - info->SaveGame[0]=WRAM; - info->SaveGameLen[0]=WRAMSIZE; + if (info->battery) { + info->SaveGame[0] = WRAM; + info->SaveGameLen[0] = WRAMSIZE; } - GameStateRestore=StateRestore; + GameStateRestore = StateRestore; AddExState(&StateRegs, ~0, 0, 0); } diff --git a/src/boards/17.cpp b/src/boards/17.cpp deleted file mode 100644 index c29a9791..00000000 --- a/src/boards/17.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2012 CaH4e3 - * - * 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 - */ - -#include "mapinc.h" - -static uint8 preg[4], creg[8]; -static uint8 IRQa, mirr; -static int32 IRQCount, IRQLatch; - -static SFORMAT StateRegs[]= -{ - {preg, 4, "PREG"}, - {creg, 8, "CREG"}, - {&mirr, 1, "MIRR"}, - {&IRQa, 1, "IRQA"}, - {&IRQCount, 4, "IRQC"}, - {&IRQLatch, 4, "IRQL"}, - {0} -}; - -static void Sync(void) -{ - int i; - for(i=0; i<8; i++) setchr1(i<<10,creg[i]); - setprg8(0x8000,preg[0]); - setprg8(0xA000,preg[1]); - setprg8(0xC000,preg[2]); - setprg8(0xE000,preg[3]); - switch(mirr) { - case 0: setmirror(MI_0); break; - case 1: setmirror(MI_1); break; - case 2: setmirror(MI_H); break; - case 3: setmirror(MI_V); break; - } -} - -static DECLFW(M17WriteMirr) -{ - mirr = ((A << 1) & 2)|((V >> 4) & 1); - Sync(); -} - -static DECLFW(M17WriteIRQ) -{ - switch(A) { - case 0x4501: IRQa=0; X6502_IRQEnd(FCEU_IQEXT); break; - case 0x4502: IRQCount&=0xFF00; IRQCount|=V; break; - case 0x4503: IRQCount&=0x00FF; IRQCount|=V<<8; IRQa=1; break; - } -} - -static DECLFW(M17WritePrg) -{ - preg[A & 3] = V; - Sync(); -} - -static DECLFW(M17WriteChr) -{ - creg[A & 7] = V; - Sync(); -} - -static void M17Power(void) -{ - preg[3] = ~0; - Sync(); - SetReadHandler(0x8000,0xFFFF,CartBR); - SetWriteHandler(0x42FE,0x42FF,M17WriteMirr); - SetWriteHandler(0x4500,0x4503,M17WriteIRQ); - SetWriteHandler(0x4504,0x4507,M17WritePrg); - SetWriteHandler(0x4510,0x4517,M17WriteChr); -} - -static void M17IRQHook(int a) -{ - if(IRQa) - { - IRQCount+=a; - if(IRQCount>=0x10000) - { - X6502_IRQBegin(FCEU_IQEXT); - IRQa=0; - IRQCount=0; - } - } -} - -static void StateRestore(int version) -{ - Sync(); -} - -void Mapper17_Init(CartInfo *info) -{ - info->Power=M17Power; - MapIRQHook=M17IRQHook; - GameStateRestore=StateRestore; - - AddExState(&StateRegs, ~0, 0, 0); -} - diff --git a/src/boards/176.cpp b/src/boards/176.cpp index 3334436f..a0e8e116 100644 --- a/src/boards/176.cpp +++ b/src/boards/176.cpp @@ -31,7 +31,7 @@ static SFORMAT StateRegs[]= { {prg, 4, "PRG"}, {&chr, 1, "CHR"}, - {&sbw, 1, "SBW"}, + {&sbw, 1, "SBW"}, {0} }; diff --git a/src/boards/65.cpp b/src/boards/65.cpp new file mode 100644 index 00000000..67f050d3 --- /dev/null +++ b/src/boards/65.cpp @@ -0,0 +1,104 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2012 CaH4e3 + * + * 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 + */ + +#include "mapinc.h" + +static uint8 preg[3], creg[8], mirr; +static uint8 IRQa; +static int16 IRQCount, IRQLatch; + +static SFORMAT StateRegs[] = +{ + { preg, 3, "PREG" }, + { creg, 8, "CREG" }, + { &mirr, 1, "MIRR" }, + { &IRQa, 1, "IRQA" }, + { &IRQCount, 2, "IRQC" }, + { &IRQLatch, 2, "IRQL" }, + { 0 } +}; + +static void Sync(void) { + setmirror(mirr); + setprg8(0x8000, preg[0]); + setprg8(0xA000, preg[1]); + setprg8(0xC000, preg[2]); + setprg8(0xE000, ~0); + setchr1(0x0000, creg[0]); + setchr1(0x0400, creg[1]); + setchr1(0x0800, creg[2]); + setchr1(0x0C00, creg[3]); + setchr1(0x1000, creg[4]); + setchr1(0x1400, creg[5]); + setchr1(0x1800, creg[6]); + setchr1(0x1C00, creg[7]); + setmirror(mirr); +} + +static DECLFW(M65Write) { + switch (A) { + case 0x8000: preg[0] = V; Sync(); break; + case 0xA000: preg[1] = V; Sync(); break; + case 0xC000: preg[2] = V; Sync(); break; + case 0x9001: mirr = ((V >> 7) & 1) ^ 1; Sync(); break; + case 0x9003: IRQa = V & 0x80; X6502_IRQEnd(FCEU_IQEXT); break; + case 0x9004: IRQCount = IRQLatch; break; + case 0x9005: IRQLatch &= 0x00FF; IRQLatch |= V << 8; break; + case 0x9006: IRQLatch &= 0xFF00; IRQLatch |= V; break; + case 0xB000: creg[0] = V; Sync(); break; + case 0xB001: creg[1] = V; Sync(); break; + case 0xB002: creg[2] = V; Sync(); break; + case 0xB003: creg[3] = V; Sync(); break; + case 0xB004: creg[4] = V; Sync(); break; + case 0xB005: creg[5] = V; Sync(); break; + case 0xB006: creg[6] = V; Sync(); break; + case 0xB007: creg[7] = V; Sync(); break; + } +} + +static void M65Power(void) { + preg[2] = ~1; + Sync(); + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, M65Write); +} + +void M65IRQ(int a) { + if (IRQa) { + IRQCount -= a; + if (IRQCount < -4) { + X6502_IRQBegin(FCEU_IQEXT); + IRQa = 0; + IRQCount = 0xFFFF; + } + } +} + +static void StateRestore(int version) { + Sync(); +} + +void Mapper65_Init(CartInfo *info) { + info->Power = M65Power; + MapIRQHook = M65IRQ; + GameStateRestore = StateRestore; + AddExState(&StateRegs, ~0, 0, 0); +} + diff --git a/src/boards/67.cpp b/src/boards/67.cpp new file mode 100644 index 00000000..aff0a16c --- /dev/null +++ b/src/boards/67.cpp @@ -0,0 +1,105 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2012 CaH4e3 + * + * 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 + */ + +#include "mapinc.h" + +static uint8 preg, creg[4], mirr, suntoggle = 0; +static uint8 IRQa; +static int16 IRQCount, IRQLatch; + +static SFORMAT StateRegs[] = +{ + { &preg, 1, "PREG" }, + { &suntoggle, 1, "STOG" }, + { creg, 4, "CREG" }, + { &mirr, 1, "MIRR" }, + { &IRQa, 1, "IRQA" }, + { &IRQCount, 2, "IRQC" }, + { &IRQLatch, 2, "IRQL" }, + { 0 } +}; + +static void Sync(void) { + setmirror(mirr); + setprg16(0x8000, preg); + setprg16(0xC000, ~0); + setchr2(0x0000, creg[0]); + setchr2(0x0800, creg[1]); + setchr2(0x1000, creg[2]); + setchr2(0x1800, creg[3]); + switch (mirr) { + case 0: setmirror(MI_V); break; + case 1: setmirror(MI_H); break; + case 2: setmirror(MI_0); break; + case 3: setmirror(MI_1); break; + } +} + +static DECLFW(M67Write) { + switch (A & 0xF800) { + case 0x8800: creg[0] = V; Sync(); break; + case 0x9800: creg[1] = V; Sync(); break; + case 0xA800: creg[2] = V; Sync(); break; + case 0xB800: creg[3] = V; Sync(); break; + case 0xC000: + case 0xC800: + IRQCount &= 0xFF << (suntoggle << 3); + IRQCount |= V << ((suntoggle ^ 1) << 3); + suntoggle ^= 1; + break; + case 0xD800: + suntoggle = 0; + IRQa = V & 0x10; + X6502_IRQEnd(FCEU_IQEXT); + break; + case 0xE800: mirr = V & 3; Sync(); break; + case 0xF800: preg = V; Sync(); break; + } +} + +static void M67Power(void) { + suntoggle = 0; + Sync(); + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, M67Write); +} + +void M67IRQ(int a) { + if (IRQa) { + IRQCount -= a; + if (IRQCount <= 0) { + X6502_IRQBegin(FCEU_IQEXT); + IRQa = 0; + IRQCount = 0xFFFF; + } + } +} + +static void StateRestore(int version) { + Sync(); +} + +void Mapper67_Init(CartInfo *info) { + info->Power = M67Power; + MapIRQHook = M67IRQ; + GameStateRestore = StateRestore; + AddExState(&StateRegs, ~0, 0, 0); +} + diff --git a/src/boards/69.cpp b/src/boards/69.cpp new file mode 100644 index 00000000..c7daab8d --- /dev/null +++ b/src/boards/69.cpp @@ -0,0 +1,278 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2012 CaH4e3 + * + * 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 + */ + +#include "mapinc.h" + +static uint8 cmdreg, preg[4], creg[8], mirr; +static uint8 IRQa; +static int32 IRQCount; +static uint8 *WRAM=NULL; +static uint32 WRAMSIZE; + +static SFORMAT StateRegs[] = +{ + { &cmdreg, 1, "CMDR" }, + { preg, 4, "PREG" }, + { creg, 8, "CREG" }, + { &mirr, 1, "MIRR" }, + { &IRQa, 1, "IRQA" }, + { &IRQCount, 4, "IRQC" }, + { 0 } +}; + +static void Sync(void) { + uint8 i; + if ((preg[3] & 0xC0) == 0xC0) + setprg8r(0x10, 0x6000, 0); + else + setprg8(0x6000, preg[3] & 0x3F); + setprg8(0x8000, preg[0]); + setprg8(0xA000, preg[1]); + setprg8(0xC000, preg[2]); + setprg8(0xE000, ~0); + for (i = 0; i < 8; i++) + setchr1(i << 10, creg[i]); + switch (mirr & 3) { + case 0: setmirror(MI_V); break; + case 1: setmirror(MI_H); break; + case 2: setmirror(MI_0); break; + case 3: setmirror(MI_1); break; + } +} + +static DECLFW(M69WRAMWrite) { + if ((preg[3] & 0xC0) == 0xC0) + CartBW(A, V); +} + +static DECLFR(M69WRAMRead) { + if ((preg[3] & 0xC0) == 0x40) + return X.DB; + else + return CartBR(A); +} + +static DECLFW(M69Write0) { + cmdreg = V & 0xF; +} + +static DECLFW(M69Write1) { + switch(cmdreg) { + case 0x0: creg[0] = V; Sync(); break; + case 0x1: creg[1] = V; Sync(); break; + case 0x2: creg[2] = V; Sync(); break; + case 0x3: creg[3] = V; Sync(); break; + case 0x4: creg[4] = V; Sync(); break; + case 0x5: creg[5] = V; Sync(); break; + case 0x6: creg[6] = V; Sync(); break; + case 0x7: creg[7] = V; Sync(); break; + case 0x8: preg[3] = V; Sync(); break; + case 0x9: preg[0] = V; Sync(); break; + case 0xA: preg[1] = V; Sync(); break; + case 0xB: preg[2] = V; Sync(); break; + case 0xC: mirr = V & 3; Sync(); break; + case 0xD: IRQa = V; X6502_IRQEnd(FCEU_IQEXT); break; + case 0xE: IRQCount &= 0xFF00; IRQCount |= V; X6502_IRQEnd(FCEU_IQEXT); break; + case 0xF: IRQCount &= 0x00FF; IRQCount |= V << 8; X6502_IRQEnd(FCEU_IQEXT); break; + } +} + +// SUNSOFT-5/FME-7 Sound + +static void AYSound(int Count); +static void AYSoundHQ(void); +static void DoAYSQ(int x); +static void DoAYSQHQ(int x); + +static uint8 sndcmd, sreg[14]; +static int32 vcount[3]; +static int32 dcount[3]; +static int CAYBC[3]; + +static SFORMAT SStateRegs[] = +{ + { &sndcmd, 1, "SCMD" }, + { sreg, 14, "SREG" }, + { 0 } +}; + +static DECLFW(M69SWrite0) { + sndcmd = V % 14; +} + +static DECLFW(M69SWrite1) { + int x; + GameExpSound.Fill = AYSound; + GameExpSound.HiFill = AYSoundHQ; + if (FSettings.SndRate) + switch (sndcmd) { + case 0: + case 1: + case 8: if (FSettings.soundq >= 1) DoAYSQHQ(0); else DoAYSQ(0); break; + case 2: + case 3: + case 9: if (FSettings.soundq >= 1) DoAYSQHQ(1); else DoAYSQ(1); break; + case 4: + case 5: + case 10: if (FSettings.soundq >= 1) DoAYSQHQ(2); else DoAYSQ(2); break; + case 7: + for (x = 0; x < 2; x++) + if (FSettings.soundq >= 1) DoAYSQHQ(x); else DoAYSQ(x); + break; + } + sreg[sndcmd] = V; +} + +static void DoAYSQ(int x) { + int32 freq = ((sreg[x << 1] | ((sreg[(x << 1) + 1] & 15) << 8)) + 1) << (4 + 17); + int32 amp = (sreg[0x8 + x] & 15) << 2; + int32 start, end; + int V; + + amp += amp >> 1; + + start = CAYBC[x]; + end = (SOUNDTS << 16) / soundtsinc; + if (end <= start) return; + CAYBC[x] = end; + + if (amp) + for (V = start; V < end; V++) { + if (dcount[x]) + Wave[V >> 4] += amp; + vcount[x] -= nesincsize; + while (vcount[x] <= 0) { + dcount[x] ^= 1; + vcount[x] += freq; + } + } +} + +static void DoAYSQHQ(int x) { + int32 V; + int32 freq = ((sreg[x << 1] | ((sreg[(x << 1) + 1] & 15) << 8)) + 1) << 4; + int32 amp = (sreg[0x8 + x] & 15) << 6; + + amp += amp >> 1; + + if (!(sreg[0x7] & (1 << x))) { + for (V = CAYBC[x]; V < SOUNDTS; V++) { + if (dcount[x]) + WaveHi[V] += amp; + vcount[x]--; + if (vcount[x] <= 0) { + dcount[x] ^= 1; + vcount[x] = freq; + } + } + } + CAYBC[x] = SOUNDTS; +} + +static void AYSound(int Count) { + int x; + DoAYSQ(0); + DoAYSQ(1); + DoAYSQ(2); + for (x = 0; x < 3; x++) + CAYBC[x] = Count; +} + +static void AYSoundHQ(void) { + DoAYSQHQ(0); + DoAYSQHQ(1); + DoAYSQHQ(2); +} + +static void AYHiSync(int32 ts) { + int x; + + for (x = 0; x < 3; x++) + CAYBC[x] = ts; +} + +void Mapper69_ESI(void) { + GameExpSound.RChange = Mapper69_ESI; + GameExpSound.HiSync = AYHiSync; + memset(dcount, 0, sizeof(dcount)); + memset(vcount, 0, sizeof(vcount)); + memset(CAYBC, 0, sizeof(CAYBC)); + AddExState(&SStateRegs, ~0, 0, 0); +} + +// SUNSOFT-5/FME-7 Sound + +static void M69Power(void) { + cmdreg = sndcmd = 0; + IRQCount = 0xFFFF; + IRQa = 0; + Sync(); + SetReadHandler(0x6000, 0x7FFF, M69WRAMRead); + SetWriteHandler(0x6000, 0x7FFF, M69WRAMWrite); + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0x9FFF, M69Write0); + SetWriteHandler(0xA000, 0xBFFF, M69Write1); + SetWriteHandler(0xC000, 0xDFFF, M69SWrite0); + SetWriteHandler(0xE000, 0xFFFF, M69SWrite1); +} + +static void M69Close(void) +{ + if (WRAM) + FCEU_gfree(WRAM); + WRAM = NULL; +} + +static void M69IRQHook(int a) { + if (IRQa) { + IRQCount -= a; + if (IRQCount <= 0) { + X6502_IRQBegin(FCEU_IQEXT); IRQa = 0; IRQCount = 0xFFFF; + } + } +} + +static void StateRestore(int version) { + Sync(); +} + +void Mapper69_Init(CartInfo *info) { + info->Power = M69Power; + info->Close = M69Close; + MapIRQHook = M69IRQHook; + WRAMSIZE = 8192; + WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); + AddExState(WRAM, WRAMSIZE, 0, "WRAM"); + if (info->battery) { + info->SaveGame[0] = WRAM; + info->SaveGameLen[0] = WRAMSIZE; + } + GameStateRestore = StateRestore; + Mapper69_ESI(); + AddExState(&StateRegs, ~0, 0, 0); +} + +void NSFAY_Init(void) { + sndcmd = 0; + SetWriteHandler(0xC000, 0xDFFF, M69SWrite0); + SetWriteHandler(0xE000, 0xFFFF, M69SWrite1); + Mapper69_ESI(); +} diff --git a/src/boards/82.cpp b/src/boards/82.cpp index 0bf589cc..033e6ff6 100644 --- a/src/boards/82.cpp +++ b/src/boards/82.cpp @@ -16,87 +16,82 @@ * 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 + * + * Taito X1-017 board, battery backed + * */ #include "mapinc.h" static uint8 regs[9], ctrl; -static uint8 *WRAM=NULL; +static uint8 *WRAM = NULL; static uint32 WRAMSIZE; -static SFORMAT StateRegs[]= +static SFORMAT StateRegs[] = { - {regs, 9, "REGS"}, - {&ctrl, 1, "CTRL"}, - {0} + { regs, 9, "REGS" }, + { &ctrl, 1, "CTRL" }, + { 0 } }; -static void Sync(void) -{ - uint32 swap = ((ctrl & 2) << 11); - setchr2(0x0000^swap,regs[0]>>1); - setchr2(0x0800^swap,regs[1]>>1); - setchr1(0x1000^swap,regs[2]); - setchr1(0x1400^swap,regs[3]); - setchr1(0x1800^swap,regs[4]); - setchr1(0x1c00^swap,regs[5]); - setprg8r(0x10,0x6000,0); - setprg8(0x8000,regs[6]); - setprg8(0xA000,regs[7]); - setprg8(0xC000,regs[8]); - setprg8(0xE000,~0); - setmirror(ctrl & 1); +static void Sync(void) { + uint32 swap = ((ctrl & 2) << 11); + setchr2(0x0000 ^ swap, regs[0] >> 1); + setchr2(0x0800 ^ swap, regs[1] >> 1); + setchr1(0x1000 ^ swap, regs[2]); + setchr1(0x1400 ^ swap, regs[3]); + setchr1(0x1800 ^ swap, regs[4]); + setchr1(0x1c00 ^ swap, regs[5]); + setprg8r(0x10, 0x6000, 0); + setprg8(0x8000, regs[6]); + setprg8(0xA000, regs[7]); + setprg8(0xC000, regs[8]); + setprg8(0xE000, ~0); + setmirror(ctrl & 1); } -static DECLFW(M82Write) -{ - if(A <= 0x7ef5) - regs[A & 7] = V; - else - switch(A) - { - case 0x7ef6: ctrl = V & 3; break; - case 0x7efa: regs[6] = V >> 2; break; - case 0x7efb: regs[7] = V >> 2; break; - case 0x7efc: regs[8] = V >> 2; break; - } - Sync(); +static DECLFW(M82Write) { + if (A <= 0x7ef5) + regs[A & 7] = V; + else + switch (A) { + case 0x7ef6: ctrl = V & 3; break; + case 0x7efa: regs[6] = V >> 2; break; + case 0x7efb: regs[7] = V >> 2; break; + case 0x7efc: regs[8] = V >> 2; break; + } + Sync(); } -static void M82Power(void) -{ - Sync(); - SetReadHandler(0x6000,0xffff,CartBR); - SetWriteHandler(0x6000,0x7fff,CartBW); - SetWriteHandler(0x7ef0,0x7efc,M82Write); // external WRAM might end at $73FF +static void M82Power(void) { + Sync(); + SetReadHandler(0x6000, 0xffff, CartBR); + SetWriteHandler(0x6000, 0x7fff, CartBW); + SetWriteHandler(0x7ef0, 0x7efc, M82Write); // external WRAM might end at $73FF } -static void M82Close(void) -{ - if(WRAM) - FCEU_gfree(WRAM); - WRAM=NULL; +static void M82Close(void) { + if (WRAM) + FCEU_gfree(WRAM); + WRAM = NULL; } -static void StateRestore(int version) -{ - Sync(); +static void StateRestore(int version) { + Sync(); } -void Mapper82_Init(CartInfo *info) -{ - info->Power=M82Power; - info->Power=M82Close; +void Mapper82_Init(CartInfo *info) { + info->Power = M82Power; + info->Close = M82Close; - WRAMSIZE=8192; - WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE); - SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1); - AddExState(WRAM, WRAMSIZE, 0, "WRAM"); - if(info->battery) - { - info->SaveGame[0]=WRAM; - info->SaveGameLen[0]=WRAMSIZE; - } - GameStateRestore=StateRestore; - AddExState(&StateRegs, ~0, 0, 0); + WRAMSIZE = 8192; + WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); + AddExState(WRAM, WRAMSIZE, 0, "WRAM"); + if (info->battery) { + info->SaveGame[0] = WRAM; + info->SaveGameLen[0] = WRAMSIZE; + } + GameStateRestore = StateRestore; + AddExState(&StateRegs, ~0, 0, 0); } diff --git a/src/mappers/emu2413.c b/src/boards/emu2413.c similarity index 99% rename from src/mappers/emu2413.c rename to src/boards/emu2413.c index e4f4e47a..c7e6b164 100644 --- a/src/mappers/emu2413.c +++ b/src/boards/emu2413.c @@ -820,7 +820,7 @@ static INLINE int16 calc(OPLL * opll) { return (int16)out; } -void moocow(OPLL* opll, int32 *buf, int32 len, int shift) { +void OPLL_fillbuf(OPLL* opll, int32 *buf, int32 len, int shift) { while (len > 0) { *buf += (calc(opll) + 32768) << shift; buf++; diff --git a/src/mappers/emu2413.h b/src/boards/emu2413.h similarity index 96% rename from src/mappers/emu2413.h rename to src/boards/emu2413.h index 20e0e7d2..c895f30f 100644 --- a/src/mappers/emu2413.h +++ b/src/boards/emu2413.h @@ -130,7 +130,7 @@ uint32 OPLL_setMask(OPLL *, uint32 mask); uint32 OPLL_toggleMask(OPLL *, uint32 mask); -void moocow(OPLL* opll, int32 *buf, int32 len, int shift); +void OPLL_fillbuf(OPLL* opll, int32 *buf, int32 len, int shift); #ifdef __cplusplus } diff --git a/src/boards/ffe.cpp b/src/boards/ffe.cpp new file mode 100644 index 00000000..0c498ebc --- /dev/null +++ b/src/boards/ffe.cpp @@ -0,0 +1,153 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2012 CaH4e3 + * + * 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 + * + * FFE Copier Mappers + * + */ + +#include "mapinc.h" + +static uint8 preg[4], creg[8], latch, ffemode; +static uint8 IRQa, mirr; +static int32 IRQCount, IRQLatch; +static uint8 *WRAM=NULL; +static uint32 WRAMSIZE; + +static SFORMAT StateRegs[] = +{ + { preg, 4, "PREG" }, + { creg, 8, "CREG" }, + { &mirr, 1, "MIRR" }, + { &IRQa, 1, "IRQA" }, + { &IRQCount, 4, "IRQC" }, + { &IRQLatch, 4, "IRQL" }, + { 0 } +}; + +static void Sync(void) { + setprg8r(0x10, 0x6000, 0); + if (ffemode) { + int i; + for (i = 0; i < 8; i++) setchr1(i << 10, creg[i]); + setprg8(0x8000, preg[0]); + setprg8(0xA000, preg[1]); + setprg8(0xC000, preg[2]); + setprg8(0xE000, preg[3]); + } else { + setchr8(latch & 3); + setprg16(0x8000, (latch >> 2) & 0x3F); + setprg16(0xc000, 0x7); + } + switch (mirr) { + case 0: setmirror(MI_0); break; + case 1: setmirror(MI_1); break; + case 2: setmirror(MI_V); break; + case 3: setmirror(MI_H); break; + } +} + +static DECLFW(FFEWriteMirr) { + mirr = ((A << 1) & 2) | ((V >> 4) & 1); + Sync(); +} + +static DECLFW(FFEWriteIRQ) { + switch (A) { + case 0x4501: IRQa = 0; X6502_IRQEnd(FCEU_IQEXT); break; + case 0x4502: IRQCount &= 0xFF00; IRQCount |= V; X6502_IRQEnd(FCEU_IQEXT); break; + case 0x4503: IRQCount &= 0x00FF; IRQCount |= V << 8; IRQa = 1; X6502_IRQEnd(FCEU_IQEXT); break; + } +} + +static DECLFW(FFEWritePrg) { + preg[A & 3] = V; + Sync(); +} + +static DECLFW(FFEWriteChr) { + creg[A & 7] = V; + Sync(); +} + +static DECLFW(FFEWriteLatch) { + latch = V; + Sync(); +} + +static void FFEPower(void) { + preg[3] = ~0; + Sync(); + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x42FE, 0x42FF, FFEWriteMirr); + SetWriteHandler(0x4500, 0x4503, FFEWriteIRQ); + SetWriteHandler(0x4504, 0x4507, FFEWritePrg); + SetWriteHandler(0x4510, 0x4517, FFEWriteChr); + SetWriteHandler(0x4510, 0x4517, FFEWriteChr); + SetWriteHandler(0x6000, 0x7FFF, CartBW); + SetReadHandler(0x6000, 0x7FFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, FFEWriteLatch); +} + +static void FFEIRQHook(int a) { + if (IRQa) { + IRQCount += a; + if (IRQCount >= 0x10000) { + X6502_IRQBegin(FCEU_IQEXT); + IRQa = 0; + IRQCount = 0; + } + } +} + +static void FFEClose(void) +{ + if (WRAM) + FCEU_gfree(WRAM); + WRAM = NULL; +} + +static void StateRestore(int version) { + Sync(); +} + +void Mapper6_Init(CartInfo *info) { + ffemode = 0; + mirr = ((info->mirror & 1) ^ 1) | 2; + + info->Power = FFEPower; + info->Close = FFEClose; + MapIRQHook = FFEIRQHook; + GameStateRestore = StateRestore; + + WRAMSIZE = 8192; + WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); + AddExState(WRAM, WRAMSIZE, 0, "WRAM"); + if (info->battery) { + info->SaveGame[0] = WRAM; + info->SaveGameLen[0] = WRAMSIZE; + } + + AddExState(&StateRegs, ~0, 0, 0); +} + +void Mapper17_Init(CartInfo *info) { + ffemode = 1; + Mapper6_Init(info); +} diff --git a/src/boards/mmc2and4.cpp b/src/boards/mmc2and4.cpp new file mode 100644 index 00000000..e90fef86 --- /dev/null +++ b/src/boards/mmc2and4.cpp @@ -0,0 +1,136 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2012 CaH4e3 + * + * 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 + * + */ + +#include "mapinc.h" + +static uint8 is10; +static uint8 creg[4], latch0, latch1, preg, mirr; +static uint8 *WRAM=NULL; +static uint32 WRAMSIZE; + +static SFORMAT StateRegs[] = +{ + { creg, 4, "CREG" }, + { &preg, 1, "PREG" }, + { &mirr, 1, "MIRR" }, + { &latch0, 1, "LAT0" }, + { &latch1, 1, "LAT1" }, + { 0 } +}; + +static void Sync(void) { + if (is10) { + setprg8r(0x10, 0x6000, 0); + setprg16(0x8000, preg); + setprg16(0xC000, ~0); + } else { + setprg8(0x8000, preg); + setprg8(0xA000, ~2); + setprg8(0xC000, ~1); + setprg8(0xE000, ~0); + } + setchr4(0x0000, creg[latch0]); + setchr4(0x1000, creg[latch1 + 2]); + setmirror(mirr); +} + +DECLFW(MMC2and4Write) { + switch (A & 0xF000) { + case 0xA000: preg = V; Sync(); break; + case 0xB000: creg[0] = V; Sync(); break; + case 0xC000: creg[1] = V; Sync(); break; + case 0xD000: creg[2] = V; Sync(); break; + case 0xE000: creg[3] = V; Sync(); break; + case 0xF000: mirr = (V & 1) ^ 1; Sync(); break; + } +} + +static void MMC2and4PPUHook(uint32 A) { + uint8 l, h = A >> 8; + if (h >= 0x20 || ((h & 0xF) != 0xF)) + return; + l = A & 0xF0; + if (h < 0x10) { + if (l == 0xD0) { + latch0 = 0; + setchr4(0x0000, creg[0]); + } else if (l == 0xE0) { + latch0 = 1; + setchr4(0x0000, creg[1]); + } + } else { + if (l == 0xD0) { + latch1 = 0; + setchr4(0x1000, creg[2]); + } else if (l == 0xE0) { + latch1 = 1; + setchr4(0x1000, creg[3]); + } + } +} + +static void MMC2and4Power(void) { + preg = 0; + latch0 = latch1 = 1; + Sync(); + if (is10) { + SetReadHandler(0x6000, 0x7FFF, CartBR); + SetWriteHandler(0x6000, 0x7FFF, CartBW); + } + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0xA000, 0xFFFF, MMC2and4Write); +} + +static void StateRestore(int version) { + Sync(); +} + +static void MMC2and4Close(void) +{ + if (WRAM) + FCEU_gfree(WRAM); + WRAM = NULL; +} + +void Mapper9_Init(CartInfo *info) { + is10 = 0; + info->Power = MMC2and4Power; + PPU_hook = MMC2and4PPUHook; + GameStateRestore = StateRestore; + AddExState(&StateRegs, ~0, 0, 0); +} + +void Mapper10_Init(CartInfo *info) { + is10 = 1; + info->Power = MMC2and4Power; + info->Close = MMC2and4Close; + PPU_hook = MMC2and4PPUHook; + WRAMSIZE = 8192; + WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); + AddExState(WRAM, WRAMSIZE, 0, "WRAM"); + if (info->battery) { + info->SaveGame[0] = WRAM; + info->SaveGameLen[0] = WRAMSIZE; + } + GameStateRestore = StateRestore; + AddExState(&StateRegs, ~0, 0, 0); +} diff --git a/src/boards/subor.cpp b/src/boards/subor.cpp index 3442cd2e..00d9a997 100644 --- a/src/boards/subor.cpp +++ b/src/boards/subor.cpp @@ -17,83 +17,72 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ - + #include "mapinc.h" -static uint8 mode; -static uint8 DRegs[4]; +static uint8 is167, regs[4]; -static SFORMAT StateRegs[]= +static SFORMAT StateRegs[] = { - {DRegs, 4, "DREG"}, - {0} + { regs, 4, "DREG" }, + { 0 } }; -static void Sync(void) -{ - int base, bank; - base = ((DRegs[0]^DRegs[1])&0x10)<<1; - bank = (DRegs[2]^DRegs[3])&0x1f; +static void Sync(void) { + int base, bank; + base = ((regs[0] ^ regs[1]) & 0x10) << 1; + bank = (regs[2] ^ regs[3]) & 0x1f; - if(DRegs[1]&0x08) - { - bank &= 0xfe; - if(mode==0) - { - setprg16(0x8000,base+bank+1); - setprg16(0xC000,base+bank+0); - } - else - { - setprg16(0x8000,base+bank+0); - setprg16(0xC000,base+bank+1); - } - } - else - { - if(DRegs[1]&0x04) - { - setprg16(0x8000,0x1f); - setprg16(0xC000,base+bank); - } - else - { - setprg16(0x8000,base+bank); - if(mode==0) - setprg16(0xC000,0x20); - else - setprg16(0xC000,0x07); - } - } + if (regs[1] & 0x08) { + bank &= 0xFE; + if (is167) { + setprg16(0x8000, base + bank + 1); + setprg16(0xC000, base + bank + 0); + } else { + setprg16(0x8000, base + bank + 0); + setprg16(0xC000, base + bank + 1); + } + } else { + if (regs[1] & 0x04) { + setprg16(0x8000, 0x1F); + setprg16(0xC000, base + bank); + } else { + setprg16(0x8000, base + bank); + if (is167) + setprg16(0xC000, 0x20); + else + setprg16(0xC000, 0x07); + } + } + setchr8(0); } -static DECLFW(Mapper167_write) -{ - DRegs[(A>>13)&0x03]=V; - Sync(); +static DECLFW(M166Write) { + regs[(A >> 13) & 0x03] = V; + Sync(); } -static void StateRestore(int version) -{ - Sync(); +static void M166Power(void) { + regs[0] = regs[1] = regs[2] = regs[3] = 0; + Sync(); + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, M166Write); } -void Mapper166_init(void) -{ - mode=1; - DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0; - Sync(); - SetWriteHandler(0x8000,0xFFFF,Mapper167_write); - GameStateRestore=StateRestore; - AddExState(&StateRegs, ~0, 0, 0); +static void StateRestore(int version) { + Sync(); } -void Mapper167_init(void) -{ - mode=0; - DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0; - Sync(); - SetWriteHandler(0x8000,0xFFFF,Mapper167_write); - GameStateRestore=StateRestore; - AddExState(&StateRegs, ~0, 0, 0); +void Mapper166_Init(CartInfo *info) { + is167 = 0; + info->Power = M166Power; + GameStateRestore = StateRestore; + AddExState(&StateRegs, ~0, 0, 0); +} + +void Mapper167_Init(CartInfo *info) { + is167 = 1; + info->Power = M166Power; + GameStateRestore = StateRestore; + AddExState(&StateRegs, ~0, 0, 0); } diff --git a/src/boards/t-262.cpp b/src/boards/t-262.cpp index 0804d520..0b419992 100644 --- a/src/boards/t-262.cpp +++ b/src/boards/t-262.cpp @@ -20,65 +20,52 @@ #include "mapinc.h" -static uint16 addrreg; -static uint8 datareg; -static uint8 busy; -static SFORMAT StateRegs[]= +static uint8 bank, base, lock, mirr; +static SFORMAT StateRegs[] = { - {&addrreg, 2, "AREG"}, - {&datareg, 1, "DREG"}, - {&busy, 1, "BUSY"}, - {0} + { &bank, 1, "BANK" }, + { &base, 1, "BASE" }, + { &lock, 1, "LOCK" }, + { &mirr, 1, "MIRR" }, + { 0 } }; -static void Sync(void) -{ - uint16 base=((addrreg&0x60)>>2)|((addrreg&0x100)>>3); - setprg16(0x8000,(datareg&7)|base); - setprg16(0xC000,7|base); - setmirror(((addrreg&2)>>1)^1); +static void Sync(void) { + setchr8(0); + setprg16(0x8000, base | bank); + setprg16(0xC000, base | 7); + setmirror(mirr); } -static DECLFW(BMCT262Write) -{ - if(busy||(A==0x8000)) - datareg=V; - else - { - addrreg=A; - busy=1; - } - Sync(); +static DECLFW(BMCT262Write) { + if (!lock) { + base = ((A & 0x60) >> 2) | ((A & 0x100) >> 3); + mirr = ((A & 2) >> 1) ^ 1; + lock = (A & 0x2000) >> 13; + } + bank = V & 7; + Sync(); } -static void BMCT262Power(void) -{ - setchr8(0); - SetWriteHandler(0x8000,0xFFFF,BMCT262Write); - SetReadHandler(0x8000,0xFFFF,CartBR); - busy=0; - addrreg=0; - datareg=0xff; - Sync(); +static void BMCT262Power(void) { + lock = bank = base = 0; + Sync(); + SetWriteHandler(0x8000, 0xFFFF, BMCT262Write); + SetReadHandler(0x8000, 0xFFFF, CartBR); } -static void BMCT262Reset(void) -{ - busy=0; - addrreg=0; - datareg=0; - Sync(); +static void BMCT262Reset(void) { + lock = bank = base = 0; + Sync(); } -static void BMCT262Restore(int version) -{ - Sync(); +static void BMCT262Restore(int version) { + Sync(); } -void BMCT262_Init(CartInfo *info) -{ - info->Power=BMCT262Power; - info->Reset=BMCT262Reset; - GameStateRestore=BMCT262Restore; - AddExState(&StateRegs, ~0, 0, 0); +void BMCT262_Init(CartInfo *info) { + info->Power = BMCT262Power; + info->Reset = BMCT262Reset; + GameStateRestore = BMCT262Restore; + AddExState(&StateRegs, ~0, 0, 0); } diff --git a/src/boards/tengen.cpp b/src/boards/tengen.cpp index 38816226..b47afff2 100644 --- a/src/boards/tengen.cpp +++ b/src/boards/tengen.cpp @@ -20,181 +20,120 @@ #include "mapinc.h" -static uint8 cmd,mir,rmode,IRQmode; -static uint8 DRegs[11]; -static uint8 IRQCount,IRQa,IRQLatch; +static uint8 cmd, mirr, regs[11]; +static uint8 rmode, IRQmode, IRQCount, IRQa, IRQLatch; -static SFORMAT Rambo_StateRegs[]={ - {&cmd, 1, "CMD"}, - {&mir, 1, "MIR"}, - {&rmode, 1, "RMOD"}, - {&IRQmode, 1, "IRQM"}, - {&IRQCount, 1, "IRQC"}, - {&IRQa, 1, "IRQA"}, - {&IRQLatch, 1, "IRQL"}, - {DRegs, 11, "DREG"}, - {0} +static SFORMAT StateRegs[] = { + { regs, 11, "REGS" }, + { &cmd, 1, "CMDR" }, + { &mirr, 1, "MIRR" }, + { &rmode, 1, "RMOD" }, + { &IRQmode, 1, "IRQM" }, + { &IRQCount, 1, "IRQC" }, + { &IRQa, 1, "IRQA" }, + { &IRQLatch, 1, "IRQL" }, + { 0 } }; -static void (*setchr1wrap)(unsigned int A, unsigned int V); -//static int nomirror; - -static void RAMBO1_IRQHook(int a) -{ - static int smallcount; - if(!IRQmode) return; - - smallcount+=a; - while(smallcount>=4) - { - smallcount-=4; - IRQCount--; - if(IRQCount==0xFF) - if(IRQa) X6502_IRQBegin(FCEU_IQEXT); - } +static void M64IRQHook(int a) { + static int32 smallcount; + if (IRQmode) { + smallcount += a; + while (smallcount >= 4) { + smallcount -= 4; + IRQCount--; + if (IRQCount == 0xFF) + if (IRQa) X6502_IRQBegin(FCEU_IQEXT); + } + } } -static void RAMBO1_hb(void) -{ - if(IRQmode) return; - if(scanline==240) return; /* hmm. Maybe that should be an mmc3-only call in fce.c. */ - rmode=0; - IRQCount--; - if(IRQCount==0xFF) - { - if(IRQa) - { - rmode = 1; - X6502_IRQBegin(FCEU_IQEXT); - } - } +static void M64HBHook(void) { + if ((!IRQmode) && (scanline != 240)) { + rmode = 0; + IRQCount--; + if (IRQCount == 0xFF) { + if (IRQa) { + rmode = 1; + X6502_IRQBegin(FCEU_IQEXT); + } + } + } } -static void Synco(void) -{ - int x; - - if(cmd&0x20) - { - setchr1wrap(0x0000,DRegs[0]); - setchr1wrap(0x0800,DRegs[1]); - setchr1wrap(0x0400,DRegs[8]); - setchr1wrap(0x0c00,DRegs[9]); - } - else - { - setchr1wrap(0x0000,(DRegs[0]&0xFE)); - setchr1wrap(0x0400,(DRegs[0]&0xFE)|1); - setchr1wrap(0x0800,(DRegs[1]&0xFE)); - setchr1wrap(0x0C00,(DRegs[1]&0xFE)|1); - } - - for(x=0;x<4;x++) - setchr1wrap(0x1000+x*0x400,DRegs[2+x]); - - setprg8(0x8000,DRegs[6]); - setprg8(0xA000,DRegs[7]); - - setprg8(0xC000,DRegs[10]); +static void Sync(void) { + if (cmd & 0x20) { + setchr1(0x0000, regs[0]); + setchr1(0x0400, regs[8]); + setchr1(0x0800, regs[1]); + setchr1(0x0C00, regs[9]); + } else { + setchr2(0x0000, regs[0] >> 1); + setchr2(0x0800, regs[1] >> 1); + } + setchr1(0x1000, regs[2]); + setchr1(0x1400, regs[3]); + setchr1(0x1800, regs[4]); + setchr1(0x1C00, regs[5]); + setprg8(0x8000, regs[6]); + setprg8(0xA000, regs[7]); + setprg8(0xC000, regs[10]); + setprg8(0xE000, ~0); + setmirror(mirr); } - -static DECLFW(RAMBO1_write) -{ - switch(A&0xF001) - { - case 0xa000: mir=V&1; -// if(!nomirror) - setmirror(mir^1); - break; - case 0x8000: cmd = V; - break; - case 0x8001: if((cmd&0xF)<10) - DRegs[cmd&0xF]=V; - else if((cmd&0xF)==0xF) - DRegs[10]=V; - Synco(); - break; - case 0xc000: IRQLatch=V; - if(rmode==1) - IRQCount=IRQLatch; - break; - case 0xc001: rmode=1; - IRQCount=IRQLatch; - IRQmode=V&1; - break; - case 0xE000: IRQa=0; - X6502_IRQEnd(FCEU_IQEXT); - if(rmode==1) - IRQCount=IRQLatch; - break; - case 0xE001: IRQa=1; - if(rmode==1) - IRQCount=IRQLatch; - break; - } +static DECLFW(M64Write) { + switch (A & 0xF001) { + case 0xA000: mirr = (V & 1) ^ 1; Sync(); break;\ + case 0x8000: cmd = V; break; + case 0x8001: + if ((cmd & 0xF) < 10) + regs[cmd & 0xF] = V; + else if ((cmd & 0xF) == 0xF) + regs[10] = V; + Sync(); + break; + case 0xC000: + IRQLatch = V; + if (rmode == 1) + IRQCount = IRQLatch; + break; + case 0xC001: + rmode = 1; + IRQCount = IRQLatch; + IRQmode = V & 1; + break; + case 0xE000: + IRQa = 0; + X6502_IRQEnd(FCEU_IQEXT); + if (rmode == 1) + IRQCount = IRQLatch; + break; + case 0xE001: + IRQa = 1; + if (rmode == 1) + IRQCount = IRQLatch; + break; + } } -static void RAMBO1_Restore(int version) -{ - Synco(); -// if(!nomirror) - setmirror(mir^1); +static void M64Power(void) { + cmd = mirr = 0; + regs[0] = regs[1] = regs[2] = regs[3] = regs[4] = regs[5] = ~0; + regs[6] = regs[7] = regs[8] = regs[9] = regs[10] = ~0; + Sync(); + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, M64Write); } -static void RAMBO1_init(void) -{ - int x; - for(x=0;x<11;x++) - DRegs[x]=~0; - cmd=mir=0; -// if(!nomirror) - setmirror(1); - Synco(); - GameHBIRQHook=RAMBO1_hb; - MapIRQHook=RAMBO1_IRQHook; - GameStateRestore=RAMBO1_Restore; - SetWriteHandler(0x8000,0xffff,RAMBO1_write); - AddExState(Rambo_StateRegs, ~0, 0, 0); +static void StateRestore(int version) { + Sync(); } -static void CHRWrap(unsigned int A, unsigned int V) -{ - setchr1(A,V); +void Mapper64_Init(CartInfo *info) { + info->Power = M64Power; + GameHBIRQHook = M64HBHook; + MapIRQHook = M64IRQHook; + GameStateRestore = StateRestore; + AddExState(&StateRegs, ~0, 0, 0); } - -void Mapper64_init(void) -{ - setchr1wrap=CHRWrap; -// nomirror=0; - RAMBO1_init(); -} -/* -static int MirCache[8]; -static unsigned int PPUCHRBus; - -static void MirWrap(unsigned int A, unsigned int V) -{ - MirCache[A>>10]=(V>>7)&1; - if(PPUCHRBus==(A>>10)) - setmirror(MI_0+((V>>7)&1)); - setchr1(A,V); -} - -static void MirrorFear(uint32 A) -{ - A&=0x1FFF; - A>>=10; - PPUCHRBus=A; - setmirror(MI_0+MirCache[A]); -} - -void Mapper158_init(void) -{ - setchr1wrap=MirWrap; - PPU_hook=MirrorFear; - nomirror=1; - RAMBO1_init(); -} -*/ - diff --git a/src/boards/vrc6.cpp b/src/boards/vrc6.cpp new file mode 100644 index 00000000..35014e9d --- /dev/null +++ b/src/boards/vrc6.cpp @@ -0,0 +1,357 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2009 CaH4e3 + * + * 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 + * + * VRC-6 + * + */ + +#include "mapinc.h" + +static uint8 is26; +static uint8 prg[2], chr[8], mirr; +static uint8 IRQLatch, IRQa, IRQd; +static uint32 IRQCount, CycleCount; + +static SFORMAT StateRegs[] = +{ + { prg, 2, "PRG" }, + { chr, 8, "CHR" }, + { &mirr, 1, "MIRR" }, + { &IRQa, 1, "IRQA" }, + { &IRQd, 1, "IRQD" }, + { &IRQLatch, 1, "IRQL" }, + { &IRQCount, 4, "IRQC" }, + { &CycleCount, 4, "CYCC" }, + { 0 } +}; + +static void(*sfun[3]) (void); +static uint8 vpsg2[4]; +static uint8 vpsg1[4]; +static int32 cvbc[3]; +static int32 vcount[3]; +static int32 dcount[2]; + +static SFORMAT SStateRegs[] = +{ + { vpsg1, 4, "PSG1" }, + { vpsg2, 4, "PSG2" }, + { 0 } +}; + +static void Sync(void) { + uint8 i; + setprg16(0x8000, prg[0]); + setprg8(0xc000, prg[1]); + setprg8(0xe000, ~0); + for (i = 0; i < 8; i++) + setchr1(i << 10, chr[i]); + switch (mirr & 3) { + case 0: setmirror(MI_V); break; + case 1: setmirror(MI_H); break; + case 2: setmirror(MI_0); break; + case 3: setmirror(MI_1); break; + } +} + +static DECLFW(VRC6SW) { + A &= 0xF003; + if (A >= 0x9000 && A <= 0x9002) { + vpsg1[A & 3] = V; + if (sfun[0]) sfun[0](); + } else if (A >= 0xA000 && A <= 0xA002) { + vpsg1[4 | (A & 3)] = V; + if (sfun[1]) sfun[1](); + } else if (A >= 0xB000 && A <= 0xB002) { + vpsg2[A & 3] = V; + if (sfun[2]) sfun[2](); + } +} + +static DECLFW(VRC6Write) { + if (is26) + A = (A & 0xFFFC) | ((A >> 1) & 1) | ((A << 1) & 2); + if (A >= 0x9000 && A <= 0xB002) { + VRC6SW(A, V); + return; + } + switch (A & 0xF003) { + case 0x8000: prg[0] = V; Sync(); break; + case 0xB003: mirr = (V >> 2) & 3; Sync(); break; + case 0xC000: prg[1] = V; Sync(); break; + case 0xD000: chr[0] = V; Sync(); break; + case 0xD001: chr[1] = V; Sync(); break; + case 0xD002: chr[2] = V; Sync(); break; + case 0xD003: chr[3] = V; Sync(); break; + case 0xE000: chr[4] = V; Sync(); break; + case 0xE001: chr[5] = V; Sync(); break; + case 0xE002: chr[6] = V; Sync(); break; + case 0xE003: chr[7] = V; Sync(); break; + case 0xF000: IRQLatch = V; break; + case 0xF001: + IRQa = V & 2; + IRQd = V & 1; + if (V & 2) { + IRQCount = IRQLatch; + CycleCount = 0; + } + X6502_IRQEnd(FCEU_IQEXT); + break; + case 0xF002: + IRQa = IRQd; + X6502_IRQEnd(FCEU_IQEXT); + } +} + +static void VRC6Power(void) { + Sync(); + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, VRC6Write); +} + +static void VRC6IRQHook(int a) { + if (IRQa) { + CycleCount += a * 3; + if (CycleCount >= 341) { + while(CycleCount >= 341) { + CycleCount -= 341; + IRQCount++; + if (IRQCount == 0x100) { + X6502_IRQBegin(FCEU_IQEXT); + IRQCount = IRQLatch; + } + } + } + } +} + +static void StateRestore(int version) { + Sync(); +} + +// VRC6 Sound + +static void DoSQV1(void); +static void DoSQV2(void); +static void DoSawV(void); + +static INLINE void DoSQV(int x) { + int32 V; + int32 amp = (((vpsg1[x << 2] & 15) << 8) * 6 / 8) >> 4; + int32 start, end; + + start = cvbc[x]; + end = (SOUNDTS << 16) / soundtsinc; + if (end <= start) return; + cvbc[x] = end; + + if (vpsg1[(x << 2) | 0x2] & 0x80) { + if (vpsg1[x << 2] & 0x80) { + for (V = start; V < end; V++) + Wave[V >> 4] += amp; + } else { + int32 thresh = (vpsg1[x << 2] >> 4) & 7; + int32 freq = ((vpsg1[(x << 2) | 0x1] | ((vpsg1[(x << 2) | 0x2] & 15) << 8)) + 1) << 17; + for (V = start; V < end; V++) { + if (dcount[x] > thresh) + Wave[V >> 4] += amp; + vcount[x] -= nesincsize; + while (vcount[x] <= 0) { + vcount[x] += freq; + dcount[x] = (dcount[x] + 1) & 15; + } + } + } + } +} + +static void DoSQV1(void) { + DoSQV(0); +} + +static void DoSQV2(void) { + DoSQV(1); +} + +static void DoSawV(void) { + int V; + int32 start, end; + + start = cvbc[2]; + end = (SOUNDTS << 16) / soundtsinc; + if (end <= start) return; + cvbc[2] = end; + + if (vpsg2[2] & 0x80) { + static int32 saw1phaseacc = 0; + uint32 freq3; + static uint8 b3 = 0; + static int32 phaseacc = 0; + static uint32 duff = 0; + + freq3 = (vpsg2[1] + ((vpsg2[2] & 15) << 8) + 1); + + for (V = start; V < end; V++) { + saw1phaseacc -= nesincsize; + if (saw1phaseacc <= 0) { + int32 t; + rea: + t = freq3; + t <<= 18; + saw1phaseacc += t; + phaseacc += vpsg2[0] & 0x3f; + b3++; + if (b3 == 7) { + b3 = 0; + phaseacc = 0; + } + if (saw1phaseacc <= 0) + goto rea; + duff = (((phaseacc >> 3) & 0x1f) << 4) * 6 / 8; + } + Wave[V >> 4] += duff; + } + } +} + +static INLINE void DoSQVHQ(int x) { + int32 V; + int32 amp = ((vpsg1[x << 2] & 15) << 8) * 6 / 8; + + if (vpsg1[(x << 2) | 0x2] & 0x80) { + if (vpsg1[x << 2] & 0x80) { + for (V = cvbc[x]; V < SOUNDTS; V++) + WaveHi[V] += amp; + } else { + int32 thresh = (vpsg1[x << 2] >> 4) & 7; + for (V = cvbc[x]; V < SOUNDTS; V++) { + if (dcount[x] > thresh) + WaveHi[V] += amp; + vcount[x]--; + if (vcount[x] <= 0) { + vcount[x] = (vpsg1[(x << 2) | 0x1] | ((vpsg1[(x << 2) | 0x2] & 15) << 8)) + 1; + dcount[x] = (dcount[x] + 1) & 15; + } + } + } + } + cvbc[x] = SOUNDTS; +} + +static void DoSQV1HQ(void) { + DoSQVHQ(0); +} + +static void DoSQV2HQ(void) { + DoSQVHQ(1); +} + +static void DoSawVHQ(void) { + static uint8 b3 = 0; + static int32 phaseacc = 0; + int32 V; + + if (vpsg2[2] & 0x80) { + for (V = cvbc[2]; V < SOUNDTS; V++) { + WaveHi[V] += (((phaseacc >> 3) & 0x1f) << 8) * 6 / 8; + vcount[2]--; + if (vcount[2] <= 0) { + vcount[2] = (vpsg2[1] + ((vpsg2[2] & 15) << 8) + 1) << 1; + phaseacc += vpsg2[0] & 0x3f; + b3++; + if (b3 == 7) { + b3 = 0; + phaseacc = 0; + } + } + } + } + cvbc[2] = SOUNDTS; +} + + +void VRC6Sound(int Count) { + int x; + + DoSQV1(); + DoSQV2(); + DoSawV(); + for (x = 0; x < 3; x++) + cvbc[x] = Count; +} + +void VRC6SoundHQ(void) { + DoSQV1HQ(); + DoSQV2HQ(); + DoSawVHQ(); +} + +void VRC6SyncHQ(int32 ts) { + int x; + for (x = 0; x < 3; x++) cvbc[x] = ts; +} + +static void VRC6_ESI(void) { + GameExpSound.RChange = VRC6_ESI; + GameExpSound.Fill = VRC6Sound; + GameExpSound.HiFill = VRC6SoundHQ; + GameExpSound.HiSync = VRC6SyncHQ; + + memset(cvbc, 0, sizeof(cvbc)); + memset(vcount, 0, sizeof(vcount)); + memset(dcount, 0, sizeof(dcount)); + if (FSettings.SndRate) { + if (FSettings.soundq >= 1) { + sfun[0] = DoSQV1HQ; + sfun[1] = DoSQV2HQ; + sfun[2] = DoSawVHQ; + } else { + sfun[0] = DoSQV1; + sfun[1] = DoSQV2; + sfun[2] = DoSawV; + } + } else + memset(sfun, 0, sizeof(sfun)); + AddExState(&SStateRegs, ~0, 0, 0); +} + +// VRC6 Sound + +void Mapper24_Init(CartInfo *info) { + is26 = 0; + info->Power = VRC6Power; + MapIRQHook = VRC6IRQHook; + VRC6_ESI(); + GameStateRestore = StateRestore; + AddExState(&StateRegs, ~0, 0, 0); +} + +void Mapper26_Init(CartInfo *info) { + is26 = 1; + info->Power = VRC6Power; + MapIRQHook = VRC6IRQHook; + VRC6_ESI(); + GameStateRestore = StateRestore; + AddExState(&StateRegs, ~0, 0, 0); +} + +void NSFVRC6_Init(void) { + VRC6_ESI(); + SetWriteHandler(0x8000, 0xbfff, VRC6SW); +} diff --git a/src/boards/vrc7.cpp b/src/boards/vrc7.cpp index 674b82b9..56e2864a 100644 --- a/src/boards/vrc7.cpp +++ b/src/boards/vrc7.cpp @@ -1,7 +1,7 @@ /* FCE Ultra - NES/Famicom Emulator * * Copyright notice for this file: - * Copyright (C) 2009 CaH4e3 + * Copyright (C) 2012 CaH4e3 * * 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 @@ -20,113 +20,185 @@ #include "mapinc.h" -static uint8 prg[3], chr[8], mirr; +static uint8 vrc7idx, preg[3], creg[8], mirr; static uint8 IRQLatch, IRQa, IRQd; static uint32 IRQCount, CycleCount; +static uint8 *WRAM=NULL; +static uint32 WRAMSIZE; -static SFORMAT StateRegs[]= +static SFORMAT StateRegs[] = { - {prg, 3, "PRG"}, - {chr, 8, "CHR"}, - {&mirr, 1, "MIRR"}, - {&IRQa, 1, "IRQA"}, - {&IRQd, 1, "IRQD"}, - {&IRQLatch, 1, "IRQC"}, - {&IRQCount, 4, "IRQC"}, - {&CycleCount, 4, "CYCC"}, - {0} + { &vrc7idx, 1, "VRCI" }, + { preg, 3, "PREG" }, + { creg, 8, "CREG" }, + { &mirr, 1, "MIRR" }, + { &IRQa, 1, "IRQA" }, + { &IRQd, 1, "IRQD" }, + { &IRQLatch, 1, "IRQL" }, + { &IRQCount, 4, "IRQC" }, + { &CycleCount, 4, "CYCC" }, + { 0 } }; -static void Sync(void) -{ - uint8 i; - setprg8(0x8000,prg[0]); - setprg8(0xa000,prg[1]); - setprg8(0xc000,prg[2]); - setprg8(0xe000,~0); - for(i=0; i<8; i++) - setchr1(i<<10,chr[i]); - switch(mirr&3) - { - case 0: setmirror(MI_V); break; - case 1: setmirror(MI_H); break; - case 2: setmirror(MI_0); break; - case 3: setmirror(MI_1); break; - } +// VRC7 Sound + +#include "emu2413.h" + +static int32 dwave = 0; +static OPLL *VRC7Sound = NULL; + +void DoVRC7Sound(void) { + int32 z, a; + if (FSettings.soundq >= 1) + return; + z = ((SOUNDTS << 16) / soundtsinc) >> 4; + a = z - dwave; + OPLL_fillbuf(VRC7Sound, &Wave[dwave], a, 1); + dwave += a; } -static DECLFW(UNLVRC7Write) -{ - switch(A&0xF008) - { - case 0x8000: prg[0]=V; Sync(); break; - case 0x8008: prg[1]=V; Sync(); break; - case 0x9000: prg[2]=V; Sync(); break; - case 0xa000: chr[0]=V; Sync(); break; - case 0xa008: chr[1]=V; Sync(); break; - case 0xb000: chr[2]=V; Sync(); break; - case 0xb008: chr[3]=V; Sync(); break; - case 0xc000: chr[4]=V; Sync(); break; - case 0xc008: chr[5]=V; Sync(); break; - case 0xd000: chr[6]=V; Sync(); break; - case 0xd008: chr[7]=V; Sync(); break; - case 0xe000: mirr=V; Sync(); break; - case 0xe008: - IRQLatch=V; - X6502_IRQEnd(FCEU_IQEXT); - break; - case 0xf000: - IRQa=V&2; - IRQd=V&1; - if(V&2) - IRQCount=IRQLatch; - CycleCount=0; - X6502_IRQEnd(FCEU_IQEXT); - break; - case 0xf008: - if(IRQd) - IRQa=1; - else - IRQa=0; - X6502_IRQEnd(FCEU_IQEXT); - break; - } +void UpdateOPLNEO(int32 *Wave, int Count) { + OPLL_fillbuf(VRC7Sound, Wave, Count, 4); } -static void UNLVRC7Power(void) -{ - Sync(); - SetReadHandler(0x8000,0xFFFF,CartBR); - SetWriteHandler(0x8000,0xFFFF,UNLVRC7Write); +void UpdateOPL(int Count) { + int32 z, a; + z = ((SOUNDTS << 16) / soundtsinc) >> 4; + a = z - dwave; + if (VRC7Sound && a) + OPLL_fillbuf(VRC7Sound, &Wave[dwave], a, 1); + dwave = 0; } -static void UNLVRC7IRQHook(int a) -{ - if(IRQa) - { - CycleCount+=a*3; - while(CycleCount>=341) - { - CycleCount-=341; - IRQCount++; - if(IRQCount==248) - { - X6502_IRQBegin(FCEU_IQEXT); - IRQCount=IRQLatch; - } - } - } +static void VRC7SC(void) { + if (VRC7Sound) + OPLL_set_rate(VRC7Sound, FSettings.SndRate); } -static void StateRestore(int version) -{ - Sync(); +static void VRC7SKill(void) { + if (VRC7Sound) + OPLL_delete(VRC7Sound); + VRC7Sound = NULL; } -void UNLVRC7_Init(CartInfo *info) -{ - info->Power=UNLVRC7Power; - MapIRQHook=UNLVRC7IRQHook; - GameStateRestore=StateRestore; - AddExState(&StateRegs, ~0, 0, 0); +static void VRC7_ESI(void) { + GameExpSound.RChange = VRC7SC; + GameExpSound.Kill = VRC7SKill; + VRC7Sound = OPLL_new(3579545, FSettings.SndRate ? FSettings.SndRate : 44100); + OPLL_reset(VRC7Sound); + OPLL_reset(VRC7Sound); +} + +// VRC7 Sound + +static void Sync(void) { + uint8 i; + setprg8r(0x10, 0x6000, 0); + setprg8(0x8000, preg[0]); + setprg8(0xA000, preg[1]); + setprg8(0xC000, preg[2]); + setprg8(0xE000, ~0); + for (i = 0; i < 8; i++) + setchr1(i << 10, creg[i]); + switch (mirr & 3) { + case 0: setmirror(MI_V); break; + case 1: setmirror(MI_H); break; + case 2: setmirror(MI_0); break; + case 3: setmirror(MI_1); break; + } +} + +static DECLFW(VRC7SW) { + if (FSettings.SndRate) { + OPLL_writeReg(VRC7Sound, vrc7idx, V); + GameExpSound.Fill = UpdateOPL; + GameExpSound.NeoFill = UpdateOPLNEO; + } +} + +static DECLFW(VRC7Write) { + A |= (A & 8) << 1; // another two-in-oooone + if (A >= 0xA000 && A <= 0xDFFF) { + A &= 0xF010; + creg[((A >> 4) & 1) | ((A - 0xA000) >> 11)] = V; + Sync(); + } else if (A == 0x9030) { + VRC7SW(A, V); + } else switch (A & 0xF010) { + case 0x8000: preg[0] = V; Sync(); break; + case 0x8010: preg[1] = V; Sync(); break; + case 0x9000: preg[2] = V; Sync(); break; + case 0x9010: vrc7idx = V; break; + case 0xE000: mirr = V & 3; Sync(); break; + case 0xE010: IRQLatch = V; X6502_IRQEnd(FCEU_IQEXT); break; + case 0xF000: + IRQa = V & 2; + IRQd = V & 1; + if (V & 2) + IRQCount = IRQLatch; + CycleCount = 0; + X6502_IRQEnd(FCEU_IQEXT); + break; + case 0xF010: + IRQa = IRQd; + X6502_IRQEnd(FCEU_IQEXT); + break; + } +} + +static void VRC7Power(void) { + Sync(); + SetWriteHandler(0x6000, 0x7FFF, CartBW); + SetReadHandler(0x6000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, VRC7Write); +} + +static void VRC7Close(void) +{ + if (WRAM) + FCEU_gfree(WRAM); + WRAM = NULL; +} + +static void VRC7IRQHook(int a) { + if (IRQa) { + CycleCount += a * 3; + if (CycleCount >= 341) { + while(CycleCount >= 341) { + CycleCount -= 341; + IRQCount++; + if (IRQCount & 0x100) { + IRQCount = IRQLatch; + X6502_IRQBegin(FCEU_IQEXT); + } + } + } + } +} + +static void StateRestore(int version) { + Sync(); +} + +void Mapper85_Init(CartInfo *info) { + info->Power = VRC7Power; + info->Close = VRC7Close; + MapIRQHook = VRC7IRQHook; + WRAMSIZE = 8192; + WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); + AddExState(WRAM, WRAMSIZE, 0, "WRAM"); + if (info->battery) { + info->SaveGame[0] = WRAM; + info->SaveGameLen[0] = WRAMSIZE; + } + GameStateRestore = StateRestore; + VRC7_ESI(); + AddExState(&StateRegs, ~0, 0, 0); +} + +void NSFVRC7_Init(void) { + SetWriteHandler(0x9010, 0x901F, VRC7Write); + SetWriteHandler(0x9030, 0x903F, VRC7Write); + VRC7_ESI(); } diff --git a/src/boards/vrc7p.cpp b/src/boards/vrc7p.cpp new file mode 100644 index 00000000..079a001e --- /dev/null +++ b/src/boards/vrc7p.cpp @@ -0,0 +1,123 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2009 CaH4e3 + * + * 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 + * + * YOKO Mortal Kombat V Pro, VRC7 pirate clone + */ + +#include "mapinc.h" + +static uint8 prg[3], chr[8], mirr; +static uint8 IRQLatch, IRQa, IRQd; +static uint32 IRQCount, CycleCount; + +static SFORMAT StateRegs[] = +{ + { prg, 3, "PRG" }, + { chr, 8, "CHR" }, + { &mirr, 1, "MIRR" }, + { &IRQa, 1, "IRQA" }, + { &IRQd, 1, "IRQD" }, + { &IRQLatch, 1, "IRQL" }, + { &IRQCount, 4, "IRQC" }, + { &CycleCount, 4, "CYCC" }, + { 0 } +}; + +static void Sync(void) { + uint8 i; + setprg8(0x8000, prg[0]); + setprg8(0xa000, prg[1]); + setprg8(0xc000, prg[2]); + setprg8(0xe000, ~0); + for (i = 0; i < 8; i++) + setchr1(i << 10, chr[i]); + switch (mirr & 3) { + case 0: setmirror(MI_V); break; + case 1: setmirror(MI_H); break; + case 2: setmirror(MI_0); break; + case 3: setmirror(MI_1); break; + } +} + +static DECLFW(UNLVRC7Write) { + switch (A & 0xF008) { + case 0x8000: prg[0] = V; Sync(); break; + case 0x8008: prg[1] = V; Sync(); break; + case 0x9000: prg[2] = V; Sync(); break; + case 0xa000: chr[0] = V; Sync(); break; + case 0xa008: chr[1] = V; Sync(); break; + case 0xb000: chr[2] = V; Sync(); break; + case 0xb008: chr[3] = V; Sync(); break; + case 0xc000: chr[4] = V; Sync(); break; + case 0xc008: chr[5] = V; Sync(); break; + case 0xd000: chr[6] = V; Sync(); break; + case 0xd008: chr[7] = V; Sync(); break; + case 0xe000: mirr = V; Sync(); break; + case 0xe008: + IRQLatch = V; + X6502_IRQEnd(FCEU_IQEXT); + break; + case 0xf000: + IRQa = V & 2; + IRQd = V & 1; + if (V & 2) + IRQCount = IRQLatch; + CycleCount = 0; + X6502_IRQEnd(FCEU_IQEXT); + break; + case 0xf008: + if (IRQd) + IRQa = 1; + else + IRQa = 0; + X6502_IRQEnd(FCEU_IQEXT); + break; + } +} + +static void UNLVRC7Power(void) { + Sync(); + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, UNLVRC7Write); +} + +static void UNLVRC7IRQHook(int a) { + if (IRQa) { + CycleCount += a * 3; + while (CycleCount >= 341) { + CycleCount -= 341; + IRQCount++; + if (IRQCount == 248) { + X6502_IRQBegin(FCEU_IQEXT); + IRQCount = IRQLatch; + } + } + } +} + +static void StateRestore(int version) { + Sync(); +} + +void UNLVRC7_Init(CartInfo *info) { + info->Power = UNLVRC7Power; + MapIRQHook = UNLVRC7IRQHook; + GameStateRestore = StateRestore; + AddExState(&StateRegs, ~0, 0, 0); +} diff --git a/src/boards/yoko.cpp b/src/boards/yoko.cpp index bdf9307b..d2b4e05b 100644 --- a/src/boards/yoko.cpp +++ b/src/boards/yoko.cpp @@ -16,245 +16,221 @@ * 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 + * + * YOKO mapper, almost the same as 83, TODO: figure out difference + * Mapper 83 - 30-in-1 mapper, two modes for single game carts, one mode for + * multigame Dragon Ball Z Party + * + * Mortal Kombat 2 YOKO + * N-CXX(M), XX - PRG+CHR, 12 - 128+256, 22 - 256+256, 14 - 128+512 + * */ #include "mapinc.h" static uint8 mode, bank, reg[11], low[4], dip, IRQa; static int32 IRQCount; -static uint8 *WRAM=NULL; +static uint8 *WRAM = NULL; static uint32 WRAMSIZE; static uint8 is2kbank, isnot2kbank; -static SFORMAT StateRegs[]= +static SFORMAT StateRegs[] = { - {&mode, 1, "MODE"}, - {&bank, 1, "BANK"}, - {&IRQCount, 4, "IRQC"}, - {&IRQa, 1, "IRQA"}, - {reg, 11, "REGS"}, - {low, 4, "LOWR"}, - {&is2kbank, 1, "IS2K"}, - {&isnot2kbank, 1, "NT2K"}, - {0} + { &mode, 1, "MODE" }, + { &bank, 1, "BANK" }, + { &IRQCount, 4, "IRQC" }, + { &IRQa, 1, "IRQA" }, + { reg, 11, "REGS" }, + { low, 4, "LOWR" }, + { &is2kbank, 1, "IS2K" }, + { &isnot2kbank, 1, "NT2K" }, + { 0 } }; -static void UNLYOKOSync(void) -{ - setmirror((mode & 1)^1); - setchr2(0x0000,reg[3]); - setchr2(0x0800,reg[4]); - setchr2(0x1000,reg[5]); - setchr2(0x1800,reg[6]); - if(mode & 0x10) - { - uint32 base = (bank & 8) << 1; - setprg8(0x8000,(reg[0]&0x0f)|base); - setprg8(0xA000,(reg[1]&0x0f)|base); - setprg8(0xC000,(reg[2]&0x0f)|base); - setprg8(0xE000,0x0f|base); - } - else - { - if(mode & 8) - setprg32(0x8000,bank >> 1); - else - { - setprg16(0x8000,bank); - setprg16(0xC000,~0); - } - } +static void UNLYOKOSync(void) { + setmirror((mode & 1) ^ 1); + setchr2(0x0000, reg[3]); + setchr2(0x0800, reg[4]); + setchr2(0x1000, reg[5]); + setchr2(0x1800, reg[6]); + if (mode & 0x10) { + uint32 base = (bank & 8) << 1; + setprg8(0x8000, (reg[0] & 0x0f) | base); + setprg8(0xA000, (reg[1] & 0x0f) | base); + setprg8(0xC000, (reg[2] & 0x0f) | base); + setprg8(0xE000, 0x0f | base); + } else { + if (mode & 8) + setprg32(0x8000, bank >> 1); + else{ + setprg16(0x8000, bank); + setprg16(0xC000, ~0); + } + } } -static void M83Sync(void) -{ - switch(mode & 3) // check if it is truth - { - case 0: setmirror(MI_V); break; - case 1: setmirror(MI_H); break; - case 2: setmirror(MI_0); break; - case 3: setmirror(MI_1); break; - } - if(is2kbank&&!isnot2kbank) - { - setchr2(0x0000,reg[0]); - setchr2(0x0800,reg[1]); - setchr2(0x1000,reg[6]); - setchr2(0x1800,reg[7]); - } - else - { - int x; - for(x=0;x<8;x++) - setchr1(x<<10, reg[x] | ((bank&0x30)<<4)); - } - setprg8r(0x10,0x6000,0); - if(mode & 0x40) - { - setprg16(0x8000,(bank&0x3F)); // DBZ Party [p1] - setprg16(0xC000,(bank&0x30)|0xF); - } - else - { - setprg8(0x8000,reg[8]); - setprg8(0xA000,reg[9]); - setprg8(0xC000,reg[10]); - setprg8(0xE000,~0); - } +static void M83Sync(void) { + switch (mode & 3) { // check if it is truth + case 0: setmirror(MI_V); break; + case 1: setmirror(MI_H); break; + case 2: setmirror(MI_0); break; + case 3: setmirror(MI_1); break; + } + if (is2kbank && !isnot2kbank) { + setchr2(0x0000, reg[0]); + setchr2(0x0800, reg[1]); + setchr2(0x1000, reg[6]); + setchr2(0x1800, reg[7]); + } else { + int x; + for (x = 0; x < 8; x++) + setchr1(x << 10, reg[x] | ((bank & 0x30) << 4)); + } + setprg8r(0x10, 0x6000, 0); + if (mode & 0x40) { + setprg16(0x8000, (bank & 0x3F)); // DBZ Party [p1] + setprg16(0xC000, (bank & 0x30) | 0xF); + } else { + setprg8(0x8000, reg[8]); + setprg8(0xA000, reg[9]); + setprg8(0xC000, reg[10]); + setprg8(0xE000, ~0); + } } -static DECLFW(UNLYOKOWrite) -{ - switch(A & 0x8C17) - { - case 0x8000: bank=V; UNLYOKOSync(); break; - case 0x8400: mode=V; UNLYOKOSync(); break; - case 0x8800: IRQCount&=0xFF00; IRQCount|=V; X6502_IRQEnd(FCEU_IQEXT); break; - case 0x8801: IRQa=mode&0x80; IRQCount&=0xFF; IRQCount|=V<<8; break; - case 0x8c00: reg[0]=V; UNLYOKOSync(); break; - case 0x8c01: reg[1]=V; UNLYOKOSync(); break; - case 0x8c02: reg[2]=V; UNLYOKOSync(); break; - case 0x8c10: reg[3]=V; UNLYOKOSync(); break; - case 0x8c11: reg[4]=V; UNLYOKOSync(); break; - case 0x8c16: reg[5]=V; UNLYOKOSync(); break; - case 0x8c17: reg[6]=V; UNLYOKOSync(); break; - } +static DECLFW(UNLYOKOWrite) { + switch (A & 0x8C17) { + case 0x8000: bank = V; UNLYOKOSync(); break; + case 0x8400: mode = V; UNLYOKOSync(); break; + case 0x8800: IRQCount &= 0xFF00; IRQCount |= V; X6502_IRQEnd(FCEU_IQEXT); break; + case 0x8801: IRQa = mode & 0x80; IRQCount &= 0xFF; IRQCount |= V << 8; break; + case 0x8c00: reg[0] = V; UNLYOKOSync(); break; + case 0x8c01: reg[1] = V; UNLYOKOSync(); break; + case 0x8c02: reg[2] = V; UNLYOKOSync(); break; + case 0x8c10: reg[3] = V; UNLYOKOSync(); break; + case 0x8c11: reg[4] = V; UNLYOKOSync(); break; + case 0x8c16: reg[5] = V; UNLYOKOSync(); break; + case 0x8c17: reg[6] = V; UNLYOKOSync(); break; + } } -static DECLFW(M83Write) -{ - switch(A) - { - case 0x8000: is2kbank = 1; - case 0xB000: // Dragon Ball Z Party [p1] BMC - case 0xB0FF: // Dragon Ball Z Party [p1] BMC - case 0xB1FF: bank=V; mode |= 0x40; M83Sync(); break; // Dragon Ball Z Party [p1] BMC - case 0x8100: mode=V|(mode&0x40); M83Sync(); break; - case 0x8200: IRQCount&=0xFF00; IRQCount|=V; X6502_IRQEnd(FCEU_IQEXT); break; - case 0x8201: IRQa=mode&0x80; IRQCount&=0xFF; IRQCount|=V<<8; break; - case 0x8300: reg[8]=V; mode &= 0xBF; M83Sync(); break; - case 0x8301: reg[9]=V; mode &= 0xBF; M83Sync(); break; - case 0x8302: reg[10]=V; mode &= 0xBF; M83Sync(); break; - case 0x8310: reg[0]=V; M83Sync(); break; - case 0x8311: reg[1]=V; M83Sync(); break; - case 0x8312: reg[2]=V; isnot2kbank = 1; M83Sync(); break; - case 0x8313: reg[3]=V; isnot2kbank = 1; M83Sync(); break; - case 0x8314: reg[4]=V; isnot2kbank = 1; M83Sync(); break; - case 0x8315: reg[5]=V; isnot2kbank = 1; M83Sync(); break; - case 0x8316: reg[6]=V; M83Sync(); break; - case 0x8317: reg[7]=V; M83Sync(); break; - } +static DECLFW(M83Write) { + switch (A) { + case 0x8000: is2kbank = 1; + case 0xB000: // Dragon Ball Z Party [p1] BMC + case 0xB0FF: // Dragon Ball Z Party [p1] BMC + case 0xB1FF: bank = V; mode |= 0x40; M83Sync(); break; // Dragon Ball Z Party [p1] BMC + case 0x8100: mode = V | (mode & 0x40); M83Sync(); break; + case 0x8200: IRQCount &= 0xFF00; IRQCount |= V; X6502_IRQEnd(FCEU_IQEXT); break; + case 0x8201: IRQa = mode & 0x80; IRQCount &= 0xFF; IRQCount |= V << 8; break; + case 0x8300: reg[8] = V; mode &= 0xBF; M83Sync(); break; + case 0x8301: reg[9] = V; mode &= 0xBF; M83Sync(); break; + case 0x8302: reg[10] = V; mode &= 0xBF; M83Sync(); break; + case 0x8310: reg[0] = V; M83Sync(); break; + case 0x8311: reg[1] = V; M83Sync(); break; + case 0x8312: reg[2] = V; isnot2kbank = 1; M83Sync(); break; + case 0x8313: reg[3] = V; isnot2kbank = 1; M83Sync(); break; + case 0x8314: reg[4] = V; isnot2kbank = 1; M83Sync(); break; + case 0x8315: reg[5] = V; isnot2kbank = 1; M83Sync(); break; + case 0x8316: reg[6] = V; M83Sync(); break; + case 0x8317: reg[7] = V; M83Sync(); break; + } } -static DECLFR(UNLYOKOReadDip) -{ - return (X.DB&0xFC)|dip; +static DECLFR(UNLYOKOReadDip) { + return (X.DB & 0xFC) | dip; } -static DECLFR(UNLYOKOReadLow) -{ - return low[A & 3]; +static DECLFR(UNLYOKOReadLow) { + return low[A & 3]; } -static DECLFW(UNLYOKOWriteLow) -{ - low[A & 3] = V; +static DECLFW(UNLYOKOWriteLow) { + low[A & 3] = V; } -static void UNLYOKOPower(void) -{ - mode = bank = 0; - dip = 3; - UNLYOKOSync(); - SetReadHandler(0x5000,0x53FF,UNLYOKOReadDip); - SetReadHandler(0x5400,0x5FFF,UNLYOKOReadLow); - SetWriteHandler(0x5400,0x5FFF,UNLYOKOWriteLow); - SetReadHandler(0x8000,0xFFFF,CartBR); - SetWriteHandler(0x8000,0xFFFF,UNLYOKOWrite); +static void UNLYOKOPower(void) { + mode = bank = 0; + dip = 3; + UNLYOKOSync(); + SetReadHandler(0x5000, 0x53FF, UNLYOKOReadDip); + SetReadHandler(0x5400, 0x5FFF, UNLYOKOReadLow); + SetWriteHandler(0x5400, 0x5FFF, UNLYOKOWriteLow); + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, UNLYOKOWrite); } -static void M83Power(void) -{ - is2kbank = 0; - isnot2kbank = 0; - mode = bank = 0; - dip = 0; - M83Sync(); - SetReadHandler(0x5000,0x5000,UNLYOKOReadDip); - SetReadHandler(0x5100,0x5103,UNLYOKOReadLow); - SetWriteHandler(0x5100,0x5103,UNLYOKOWriteLow); - SetReadHandler(0x6000,0x7fff,CartBR); - SetWriteHandler(0x6000,0x7fff,CartBW); // Pirate Dragon Ball Z Party [p1] used if for saves instead of seraial EEPROM - SetReadHandler(0x8000,0xffff,CartBR); - SetWriteHandler(0x8000,0xffff,M83Write); +static void M83Power(void) { + is2kbank = 0; + isnot2kbank = 0; + mode = bank = 0; + dip = 0; + M83Sync(); + SetReadHandler(0x5000, 0x5000, UNLYOKOReadDip); + SetReadHandler(0x5100, 0x5103, UNLYOKOReadLow); + SetWriteHandler(0x5100, 0x5103, UNLYOKOWriteLow); + SetReadHandler(0x6000, 0x7fff, CartBR); + SetWriteHandler(0x6000, 0x7fff, CartBW); // Pirate Dragon Ball Z Party [p1] used if for saves instead of seraial EEPROM + SetReadHandler(0x8000, 0xffff, CartBR); + SetWriteHandler(0x8000, 0xffff, M83Write); } -static void UNLYOKOReset(void) -{ - dip = (dip + 1) & 3; - mode = bank = 0; - UNLYOKOSync(); +static void UNLYOKOReset(void) { + dip = (dip + 1) & 3; + mode = bank = 0; + UNLYOKOSync(); } -static void M83Reset(void) -{ - dip ^= 1; - M83Sync(); +static void M83Reset(void) { + dip ^= 1; + M83Sync(); } -static void M83Close(void) -{ - if(WRAM) - FCEU_gfree(WRAM); - WRAM=NULL; +static void M83Close(void) { + if (WRAM) + FCEU_gfree(WRAM); + WRAM = NULL; } -static void UNLYOKOIRQHook(int a) -{ - if(IRQa) - { - IRQCount-=a; - if(IRQCount<0) - { - X6502_IRQBegin(FCEU_IQEXT); - IRQa=0; - IRQCount=0xFFFF; - } - } +static void UNLYOKOIRQHook(int a) { + if (IRQa) { + IRQCount -= a; + if (IRQCount < 0) { + X6502_IRQBegin(FCEU_IQEXT); + IRQa = 0; + IRQCount = 0xFFFF; + } + } } -static void UNLYOKOStateRestore(int version) -{ - UNLYOKOSync(); +static void UNLYOKOStateRestore(int version) { + UNLYOKOSync(); } -static void M83StateRestore(int version) -{ - M83Sync(); +static void M83StateRestore(int version) { + M83Sync(); } -void UNLYOKO_Init(CartInfo *info) -{ - info->Power=UNLYOKOPower; - info->Reset=UNLYOKOReset; - MapIRQHook=UNLYOKOIRQHook; - GameStateRestore=UNLYOKOStateRestore; - AddExState(&StateRegs, ~0, 0, 0); +void UNLYOKO_Init(CartInfo *info) { + info->Power = UNLYOKOPower; + info->Reset = UNLYOKOReset; + MapIRQHook = UNLYOKOIRQHook; + GameStateRestore = UNLYOKOStateRestore; + AddExState(&StateRegs, ~0, 0, 0); } -void Mapper83_Init(CartInfo *info) -{ - info->Power=M83Power; - info->Reset=M83Reset; - info->Close=M83Close; - MapIRQHook=UNLYOKOIRQHook; - GameStateRestore=M83StateRestore; +void Mapper83_Init(CartInfo *info) { + info->Power = M83Power; + info->Reset = M83Reset; + info->Close = M83Close; + MapIRQHook = UNLYOKOIRQHook; + GameStateRestore = M83StateRestore; - WRAMSIZE=8192; - WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE); - SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1); - AddExState(WRAM, WRAMSIZE, 0, "WRAM"); + WRAMSIZE = 8192; + WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); + AddExState(WRAM, WRAMSIZE, 0, "WRAM"); - AddExState(&StateRegs, ~0, 0, 0); + AddExState(&StateRegs, ~0, 0, 0); } diff --git a/src/ines.cpp b/src/ines.cpp index c1dca2cb..eb7d1b42 100644 --- a/src/ines.cpp +++ b/src/ines.cpp @@ -46,101 +46,96 @@ extern SFORMAT FCEUVSUNI_STATEINFO[]; //mbg merge 6/29/06 - these need to be global -uint8 *trainerpoo=0; +uint8 *trainerpoo = 0; uint8 *ROM = NULL; uint8 *VROM = NULL; -iNES_HEADER head ; +iNES_HEADER head; static CartInfo iNESCart; -uint8 iNESMirroring=0; -uint16 iNESCHRBankList[8]={0,0,0,0,0,0,0,0}; -int32 iNESIRQLatch=0,iNESIRQCount=0; -uint8 iNESIRQa=0; +uint8 iNESMirroring = 0; +uint16 iNESCHRBankList[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +int32 iNESIRQLatch = 0, iNESIRQCount = 0; +uint8 iNESIRQa = 0; -uint32 ROM_size=0; -uint32 VROM_size=0; +uint32 ROM_size = 0; +uint32 VROM_size = 0; char LoadedRomFName[2048]; //mbg merge 7/17/06 added static int CHRRAMSize = -1; static void iNESPower(void); static int NewiNES_Init(int num); -void (*MapClose)(void); void (*MapperReset)(void); -static int MapperNo=0; +static int MapperNo = 0; -/* MapperReset() is called when the NES is reset(with the reset button). -Mapperxxx_init is called when the NES has been powered on. +/* MapperReset() is called when the NES is reset(with the reset button). + Mapperxxx_init is called when the NES has been powered on. */ - -static DECLFR(TrainerRead) -{ - return(trainerpoo[A&0x1FF]); +static DECLFR(TrainerRead) { + return(trainerpoo[A & 0x1FF]); } -static void iNES_ExecPower() -{ - if(CHRRAMSize != -1) - FCEU_MemoryRand(VROM,CHRRAMSize); +static void iNES_ExecPower() { + if (CHRRAMSize != -1) + FCEU_MemoryRand(VROM, CHRRAMSize); - if(iNESCart.Power) + if (iNESCart.Power) iNESCart.Power(); - if(trainerpoo) - { + if (trainerpoo) { int x; - for(x=0;x<512;x++) - { - X6502_DMW(0x7000+x,trainerpoo[x]); - if(X6502_DMR(0x7000+x)!=trainerpoo[x]) - { - SetReadHandler(0x7000,0x71FF,TrainerRead); + for (x = 0; x < 512; x++) { + X6502_DMW(0x7000 + x, trainerpoo[x]); + if (X6502_DMR(0x7000 + x) != trainerpoo[x]) { + SetReadHandler(0x7000, 0x71FF, TrainerRead); break; } } } } -void iNESGI(GI h) //bbit edited: removed static keyword -{ - switch(h) - { +void iNESGI(GI h) { //bbit edited: removed static keyword + switch (h) { case GI_RESETSAVE: FCEU_ClearGameSave(&iNESCart); break; case GI_RESETM2: - if(MapperReset) + if (MapperReset) MapperReset(); - if(iNESCart.Reset) + if (iNESCart.Reset) iNESCart.Reset(); break; case GI_POWER: iNES_ExecPower(); - break; case GI_CLOSE: - { - FCEU_SaveGameSave(&iNESCart); + { + FCEU_SaveGameSave(&iNESCart); - if(iNESCart.Close) iNESCart.Close(); - if(ROM) {free(ROM); ROM = NULL;} - if(VROM) {free(VROM); VROM = NULL;} - if(MapClose) MapClose(); - if(trainerpoo) {FCEU_gfree(trainerpoo);trainerpoo=0;} + if (iNESCart.Close) iNESCart.Close(); + if (ROM) { + free(ROM); ROM = NULL; } - break; + if (VROM) { + free(VROM); VROM = NULL; + } + if (trainerpoo) { + FCEU_gfree(trainerpoo); trainerpoo = 0; + } + } + break; } } -uint32 iNESGameCRC32=0; +uint32 iNESGameCRC32 = 0; -struct CRCMATCH { +struct CRCMATCH { uint32 crc; char *name; }; @@ -152,92 +147,91 @@ struct INPSEL { ESIFC inputfc; }; -static void SetInput(void) -{ - static struct INPSEL moo[]= - { - {0x29de87af, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Aerobics Studio - {0xd89e5a67, SI_UNSET, SI_UNSET, SIFC_ARKANOID }, // Arkanoid (J) - {0x0f141525, SI_UNSET, SI_UNSET, SIFC_ARKANOID }, // Arkanoid 2(J) - {0x32fb0583, SI_UNSET, SI_ARKANOID, SIFC_NONE }, // Arkanoid(NES) - {0x60ad090a, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERA }, // Athletic World - {0x48ca0ee1, SI_GAMEPAD, SI_GAMEPAD, SIFC_BWORLD }, // Barcode World - {0x4318a2f8, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Barker Bill's Trick Shooting - {0x6cca1c1f, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Dai Undoukai - {0x24598791, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Duck Hunt - {0xd5d6eac4, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Edu (As) +static void SetInput(void) { + static struct INPSEL moo[] = + { + {0x19b0a9f1, SI_GAMEPAD, SI_ZAPPER, SIFC_NONE }, // 6-in-1 (MGC-023)(Unl)[!] + {0x29de87af, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Aerobics Studio + {0xd89e5a67, SI_UNSET, SI_UNSET, SIFC_ARKANOID }, // Arkanoid (J) + {0x0f141525, SI_UNSET, SI_UNSET, SIFC_ARKANOID }, // Arkanoid 2(J) + {0x32fb0583, SI_UNSET, SI_ARKANOID, SIFC_NONE }, // Arkanoid(NES) + {0x60ad090a, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERA }, // Athletic World + {0x48ca0ee1, SI_GAMEPAD, SI_GAMEPAD, SIFC_BWORLD }, // Barcode World + {0x4318a2f8, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Barker Bill's Trick Shooting + {0x6cca1c1f, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Dai Undoukai + {0x24598791, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Duck Hunt + {0xd5d6eac4, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Edu (As) {0xe9a7fe9e, SI_UNSET, SI_MOUSE, SIFC_NONE }, // Educational Computer 2000 {0x8f7b1669, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // FP BASIC 3.3 by maxzhou88 - {0xf7606810, SI_UNSET, SI_UNSET, SIFC_FKB }, // Family BASIC 2.0A - {0x895037bc, SI_UNSET, SI_UNSET, SIFC_FKB }, // Family BASIC 2.1a - {0xb2530afc, SI_UNSET, SI_UNSET, SIFC_FKB }, // Family BASIC 3.0 - {0xea90f3e2, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Family Trainer: Running Stadium - {0xbba58be5, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Family Trainer: Manhattan Police - {0x3e58a87e, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Freedom Force - {0xd9f45be9, SI_GAMEPAD, SI_GAMEPAD, SIFC_QUIZKING }, // Gimme a Break ... - {0x1545bd13, SI_GAMEPAD, SI_GAMEPAD, SIFC_QUIZKING }, // Gimme a Break ... 2 - {0x4e959173, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Gotcha! - The Sport! - {0xbeb8ab01, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Gumshoe - {0xff24d794, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Hogan's Alley - {0x21f85681, SI_GAMEPAD, SI_GAMEPAD, SIFC_HYPERSHOT }, // Hyper Olympic (Gentei Ban) + {0xf7606810, SI_UNSET, SI_UNSET, SIFC_FKB }, // Family BASIC 2.0A + {0x895037bc, SI_UNSET, SI_UNSET, SIFC_FKB }, // Family BASIC 2.1a + {0xb2530afc, SI_UNSET, SI_UNSET, SIFC_FKB }, // Family BASIC 3.0 + {0xea90f3e2, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Family Trainer: Running Stadium + {0xbba58be5, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Family Trainer: Manhattan Police + {0x3e58a87e, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Freedom Force + {0xd9f45be9, SI_GAMEPAD, SI_GAMEPAD, SIFC_QUIZKING }, // Gimme a Break ... + {0x1545bd13, SI_GAMEPAD, SI_GAMEPAD, SIFC_QUIZKING }, // Gimme a Break ... 2 + {0x4e959173, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Gotcha! - The Sport! + {0xbeb8ab01, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Gumshoe + {0xff24d794, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Hogan's Alley + {0x21f85681, SI_GAMEPAD, SI_GAMEPAD, SIFC_HYPERSHOT }, // Hyper Olympic (Gentei Ban) {0x980be936, SI_GAMEPAD, SI_GAMEPAD, SIFC_HYPERSHOT }, // Hyper Olympic - {0x915a53a7, SI_GAMEPAD, SI_GAMEPAD, SIFC_HYPERSHOT }, // Hyper Sports - {0x9fae4d46, SI_GAMEPAD, SI_GAMEPAD, SIFC_MAHJONG }, // Ide Yousuke Meijin no Jissen Mahjong - {0x7b44fb2a, SI_GAMEPAD, SI_GAMEPAD, SIFC_MAHJONG }, // Ide Yousuke Meijin no Jissen Mahjong 2 - {0x2f128512, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERA }, // Jogging Race + {0x915a53a7, SI_GAMEPAD, SI_GAMEPAD, SIFC_HYPERSHOT }, // Hyper Sports + {0x9fae4d46, SI_GAMEPAD, SI_GAMEPAD, SIFC_MAHJONG }, // Ide Yousuke Meijin no Jissen Mahjong + {0x7b44fb2a, SI_GAMEPAD, SI_GAMEPAD, SIFC_MAHJONG }, // Ide Yousuke Meijin no Jissen Mahjong 2 + {0x2f128512, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERA }, // Jogging Race {0xbb33196f, SI_UNSET, SI_UNSET, SIFC_FKB }, // Keyboard Transformer {0x8587ee00, SI_UNSET, SI_UNSET, SIFC_FKB }, // Keyboard Transformer - {0x543ab532, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // LIKO Color Lines - {0x368c19a8, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // LIKO Study Cartridge - {0x5ee6008e, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Mechanized Attack - {0x370ceb65, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Meiro Dai Sakusen - {0x3a1694f9, SI_GAMEPAD, SI_GAMEPAD, SIFC_4PLAYER }, // Nekketsu Kakutou Densetsu - {0x9d048ea4, SI_GAMEPAD, SI_GAMEPAD, SIFC_OEKAKIDS }, // Oeka Kids - {0x2a6559a1, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Operation Wolf (J) + {0x543ab532, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // LIKO Color Lines + {0x368c19a8, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // LIKO Study Cartridge + {0x5ee6008e, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Mechanized Attack + {0x370ceb65, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Meiro Dai Sakusen + {0x3a1694f9, SI_GAMEPAD, SI_GAMEPAD, SIFC_4PLAYER }, // Nekketsu Kakutou Densetsu + {0x9d048ea4, SI_GAMEPAD, SI_GAMEPAD, SIFC_OEKAKIDS }, // Oeka Kids + {0x2a6559a1, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Operation Wolf (J) {0xedc3662b, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Operation Wolf - {0x912989dc, SI_UNSET, SI_UNSET, SIFC_FKB }, // Playbox BASIC - {0x9044550e, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERA }, // Rairai Kyonshizu - {0xea90f3e2, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Running Stadium - {0x851eb9be, SI_GAMEPAD, SI_ZAPPER, SIFC_NONE }, // Shooting Range - {0x6435c095, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, // Short Order/Eggsplode + {0x912989dc, SI_UNSET, SI_UNSET, SIFC_FKB }, // Playbox BASIC + {0x9044550e, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERA }, // Rairai Kyonshizu + {0xea90f3e2, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Running Stadium + {0x851eb9be, SI_GAMEPAD, SI_ZAPPER, SIFC_NONE }, // Shooting Range + {0x6435c095, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, // Short Order/Eggsplode {0xc043a8df, SI_UNSET, SI_MOUSE, SIFC_NONE }, // Shu Qi Yu - Shu Xue Xiao Zhuan Yuan (Ch) {0x2cf5db05, SI_UNSET, SI_MOUSE, SIFC_NONE }, // Shu Qi Yu - Zhi Li Xiao Zhuan Yuan (Ch) - {0xad9c63e2, SI_GAMEPAD, SI_UNSET, SIFC_SHADOW }, // Space Shadow - {0x61d86167, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, // Street Cop - {0xabb2f974, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Study and Game 32-in-1 - {0x41ef9ac4, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Subor + {0xad9c63e2, SI_GAMEPAD, SI_UNSET, SIFC_SHADOW }, // Space Shadow + {0x61d86167, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, // Street Cop + {0xabb2f974, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Study and Game 32-in-1 + {0x41ef9ac4, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Subor {0x8b265862, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Subor - {0x82f1fb96, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Subor 1.0 Russian - {0x9f8f200a, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERA }, // Super Mogura Tataki!! - Pokkun Moguraa - {0xd74b2719, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, // Super Team Games - {0x74bea652, SI_GAMEPAD, SI_ZAPPER, SIFC_NONE }, // Supergun 3-in-1 - {0x5e073a1b, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Supor English (Chinese) - {0x589b6b0d, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // SuporV20 - {0x41401c6d, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // SuporV40 - {0x23d17f5e, SI_GAMEPAD, SI_ZAPPER, SIFC_NONE }, // The Lone Ranger - {0xc3c0811d, SI_GAMEPAD, SI_GAMEPAD, SIFC_OEKAKIDS }, // The two "Oeka Kids" games - {0xde8fd935, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // To the Earth - {0x47232739, SI_GAMEPAD, SI_GAMEPAD, SIFC_TOPRIDER }, // Top Rider - {0x8a12a7d9, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Totsugeki Fuuun Takeshi Jou - {0xb8b9aca3, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Wild Gunman - {0x5112dc21, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Wild Gunman - {0xaf4010ea, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, // World Class Track Meet - {0x00000000, SI_UNSET, SI_UNSET, SIFC_UNSET } - }; - int x=0; - - while(moo[x].input1>=0 || moo[x].input2>=0 || moo[x].inputfc>=0) - { - if(moo[x].crc32==iNESGameCRC32) - { - GameInfo->input[0]=moo[x].input1; - GameInfo->input[1]=moo[x].input2; - GameInfo->inputfc=moo[x].inputfc; - break; - } - x++; - } + {0x82f1fb96, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Subor 1.0 Russian + {0x9f8f200a, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERA }, // Super Mogura Tataki!! - Pokkun Moguraa + {0xd74b2719, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, // Super Team Games + {0x74bea652, SI_GAMEPAD, SI_ZAPPER, SIFC_NONE }, // Supergun 3-in-1 + {0x5e073a1b, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // Supor English (Chinese) + {0x589b6b0d, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // SuporV20 + {0x41401c6d, SI_UNSET, SI_UNSET, SIFC_SUBORKB }, // SuporV40 + {0x23d17f5e, SI_GAMEPAD, SI_ZAPPER, SIFC_NONE }, // The Lone Ranger + {0xc3c0811d, SI_GAMEPAD, SI_GAMEPAD, SIFC_OEKAKIDS }, // The two "Oeka Kids" games + {0xde8fd935, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // To the Earth + {0x47232739, SI_GAMEPAD, SI_GAMEPAD, SIFC_TOPRIDER }, // Top Rider + {0x8a12a7d9, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Totsugeki Fuuun Takeshi Jou + {0xb8b9aca3, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Wild Gunman + {0x5112dc21, SI_UNSET, SI_ZAPPER, SIFC_NONE }, // Wild Gunman + {0xaf4010ea, SI_GAMEPAD, SI_POWERPADB, SIFC_UNSET }, // World Class Track Meet + {0x00000000, SI_UNSET, SI_UNSET, SIFC_UNSET } + }; + int x = 0; + + while (moo[x].input1 >= 0 || moo[x].input2 >= 0 || moo[x].inputfc >= 0) { + if (moo[x].crc32 == iNESGameCRC32) { + GameInfo->input[0] = moo[x].input1; + GameInfo->input[1] = moo[x].input2; + GameInfo->inputfc = moo[x].inputfc; + break; + } + x++; + } } + #define INESB_INCOMPLETE 1 #define INESB_CORRUPT 2 #define INESB_HACKED 4 @@ -249,27 +243,23 @@ struct BADINF { }; -static struct BADINF BadROMImages[]= +static struct BADINF BadROMImages[] = { -#include "ines-bad.h" + #include "ines-bad.h" }; -void CheckBad(uint64 md5partial) -{ +void CheckBad(uint64 md5partial) { int x; - x=0; + x = 0; //printf("0x%llx\n",md5partial); - while(BadROMImages[x].name) - { - if(BadROMImages[x].md5partial == md5partial) - { + while (BadROMImages[x].name) { + if (BadROMImages[x].md5partial == md5partial) { FCEU_PrintError("The copy game you have loaded, \"%s\", is bad, and will not work properly in FCEUX.", BadROMImages[x].name); return; } x++; } - } @@ -280,19 +270,14 @@ struct CHINF { const char* params; }; -void MapperInit() -{ - if(NewiNES_Init(MapperNo)) - { - - } - else - { - iNESCart.Power=iNESPower; - if(head.ROM_type&2) - { - iNESCart.SaveGame[0]=WRAM; - iNESCart.SaveGameLen[0]=8192; +void MapperInit() { + if (NewiNES_Init(MapperNo)) { + } else { + iNESCart.Power = iNESPower; + SetupCartPRGMapping(1, WRAM, 8192, 1); + if (head.ROM_type & 2) { + iNESCart.SaveGame[0] = WRAM; + iNESCart.SaveGameLen[0] = 8192; } } } @@ -311,8 +296,7 @@ static const TMasterRomInfo sMasterRomInfo[] = { const TMasterRomInfo* MasterRomInfo; TMasterRomInfoParams MasterRomInfoParams; -static void CheckHInfo(void) -{ +static void CheckHInfo(void) { /* ROM images that have the battery-backed bit set in the header that really don't have battery-backed RAM is not that big of a problem, so I'll treat this differently by only listing games that should have battery-backed RAM. @@ -320,7 +304,7 @@ static void CheckHInfo(void) Lower 64 bits of the MD5 hash. */ - static uint64 savie[]= + static uint64 savie[] = { 0xc04361e499748382LL, /* AD&D Heroes of the Lance */ 0xb72ee2337ced5792LL, /* AD&D Hillsfar */ @@ -343,7 +327,7 @@ static void CheckHInfo(void) 0x2ee3417ba8b69706LL, /* Hydlide 3*/ 0xebbce5a54cf3ecc0LL, /* Justbreed */ 0x6a858da551ba239eLL, /* Kaijuu Monogatari */ - 0x2db8f5d16c10b925LL, /* Kyonshiizu 2 */ + 0x2db8f5d16c10b925LL, /* Kyonshiizu 2 */ 0x04a31647de80fdabLL, /* Legend of Zelda */ 0x94b9484862a26cbaLL, /* Legend of Zelda */ 0xa40666740b7d22feLL, /* Mindseeker */ @@ -357,96 +341,80 @@ static void CheckHInfo(void) 0 /* Abandon all hope if the game has 0 in the lower 64-bits of its MD5 hash */ }; - static struct CHINF moo[]= + static struct CHINF moo[] = { -#include "ines-correct.h" + #include "ines-correct.h" }; - int tofix=0; + int tofix = 0; int x; - uint64 partialmd5=0; + uint64 partialmd5 = 0; - for(x=0;x<8;x++) - { - partialmd5 |= (uint64)iNESCart.MD5[15-x] << (x*8); + for (x = 0; x < 8; x++) { + partialmd5 |= (uint64)iNESCart.MD5[15 - x] << (x * 8); //printf("%16llx\n",partialmd5); } CheckBad(partialmd5); MasterRomInfo = NULL; - for(int i=0;i toks = tokenize_str(info.params,","); - for(int j=0;j<(int)toks.size();j++) - { - std::vector parts = tokenize_str(toks[j],"="); + std::vector toks = tokenize_str(info.params, ","); + for (int j = 0; j < (int)toks.size(); j++) { + std::vector parts = tokenize_str(toks[j], "="); MasterRomInfoParams[parts[0]] = parts[1]; } break; } - x=0; + x = 0; - do - { - if(moo[x].crc32==iNESGameCRC32) - { - if(moo[x].mapper>=0) - { - if(moo[x].mapper&0x800 && VROM_size) - { - VROM_size=0; + do { + if (moo[x].crc32 == iNESGameCRC32) { + if (moo[x].mapper >= 0) { + if (moo[x].mapper & 0x800 && VROM_size) { + VROM_size = 0; free(VROM); VROM = NULL; - tofix|=8; + tofix |= 8; } - if(MapperNo!=(moo[x].mapper&0xFF)) - { - tofix|=1; - MapperNo=moo[x].mapper&0xFF; + if (MapperNo != (moo[x].mapper & 0xFF)) { + tofix |= 1; + MapperNo = moo[x].mapper & 0xFF; } } - if(moo[x].mirror>=0) - { - if(moo[x].mirror==8) - { - if(Mirroring==2) /* Anything but hard-wired(four screen). */ - { - tofix|=2; - Mirroring=0; + if (moo[x].mirror >= 0) { + if (moo[x].mirror == 8) { + if (Mirroring == 2) { /* Anything but hard-wired(four screen). */ + tofix |= 2; + Mirroring = 0; } - } - else if(Mirroring!=moo[x].mirror) - { - if(Mirroring!=(moo[x].mirror&~4)) - if((moo[x].mirror&~4)<=2) /* Don't complain if one-screen mirroring - needs to be set(the iNES header can't - hold this information). - */ - tofix|=2; - Mirroring=moo[x].mirror; + } else if (Mirroring != moo[x].mirror) { + if (Mirroring != (moo[x].mirror & ~4)) + if ((moo[x].mirror & ~4) <= 2) /* Don't complain if one-screen mirroring + needs to be set(the iNES header can't + hold this information). + */ + tofix |= 2; + Mirroring = moo[x].mirror; } } break; } x++; - } while(moo[x].mirror>=0 || moo[x].mapper>=0); + } while (moo[x].mirror >= 0 || moo[x].mapper >= 0); - x=0; - while(savie[x] != 0) - { - if(savie[x] == partialmd5) - { - if(!(head.ROM_type&2)) - { - tofix|=4; - head.ROM_type|=2; + x = 0; + while (savie[x] != 0) { + if (savie[x] == partialmd5) { + if (!(head.ROM_type & 2)) { + tofix |= 4; + head.ROM_type |= 2; } } x++; @@ -455,33 +423,30 @@ static void CheckHInfo(void) /* Games that use these iNES mappers tend to have the four-screen bit set when it should not be. */ - if((MapperNo==118 || MapperNo==24 || MapperNo==26) && (Mirroring==2)) - { - Mirroring=0; - tofix|=2; + if ((MapperNo == 118 || MapperNo == 24 || MapperNo == 26) && (Mirroring == 2)) { + Mirroring = 0; + tofix |= 2; } /* Four-screen mirroring implicitly set. */ - if(MapperNo==99) - Mirroring=2; + if (MapperNo == 99) + Mirroring = 2; - if(tofix) - { + if (tofix) { char gigastr[768]; - strcpy(gigastr,"The iNES header contains incorrect information. For now, the information will be corrected in RAM. "); - if(tofix&1) - sprintf(gigastr+strlen(gigastr),"The mapper number should be set to %d. ",MapperNo); - if(tofix&2) - { - char *mstr[3]={"Horizontal","Vertical","Four-screen"}; - sprintf(gigastr+strlen(gigastr),"Mirroring should be set to \"%s\". ",mstr[Mirroring&3]); + strcpy(gigastr, "The iNES header contains incorrect information. For now, the information will be corrected in RAM. "); + if (tofix & 1) + sprintf(gigastr + strlen(gigastr), "The mapper number should be set to %d. ", MapperNo); + if (tofix & 2) { + char *mstr[3] = { "Horizontal", "Vertical", "Four-screen" }; + sprintf(gigastr + strlen(gigastr), "Mirroring should be set to \"%s\". ", mstr[Mirroring & 3]); } - if(tofix&4) - strcat(gigastr,"The battery-backed bit should be set. "); - if(tofix&8) - strcat(gigastr,"This game should not have any CHR ROM. "); - strcat(gigastr,"\n"); - FCEU_printf("%s",gigastr); + if (tofix & 4) + strcat(gigastr, "The battery-backed bit should be set. "); + if (tofix & 8) + strcat(gigastr, "This game should not have any CHR ROM. "); + strcat(gigastr, "\n"); + FCEU_printf("%s", gigastr); } } @@ -498,7 +463,7 @@ typedef struct { //size static int not_power2[] = { - 228 + 228 }; typedef struct { char* name; @@ -507,368 +472,348 @@ typedef struct { } BMAPPINGLocal; static BMAPPINGLocal bmap[] = { - {"NROM", 0, NROM_Init}, - {"MMC1", 1, Mapper1_Init}, - {"UNROM", 2, UNROM_Init}, - {"CNROM", 3, CNROM_Init}, - {"MMC3", 4, Mapper4_Init}, - {"MMC5", 5, Mapper5_Init}, -// {"", 6, Mapper6_Init}, - {"ANROM", 7, ANROM_Init}, - {"", 8, Mapper8_Init}, // Nogaems, it's worthless -// {"", 9, Mapper9_Init}, -// {"", 10, Mapper10_Init}, - {"Color Dreams", 11, Mapper11_Init}, - {"", 12, Mapper12_Init}, - {"CPROM", 13, CPROM_Init}, -// {"", 14, Mapper14_Init}, - {"100-in-1", 15, Mapper15_Init}, - {"Bandai", 16, Mapper16_Init}, - {"", 17, Mapper17_Init}, - {"", 18, Mapper18_Init}, - {"Namcot 106", 19, Mapper19_Init}, -// {"", 20, Mapper20_Init}, - {"Konami VRC2/VRC4", 21, Mapper21_Init}, - {"Konami VRC2/VRC4", 22, Mapper22_Init}, - {"Konami VRC2/VRC4", 23, Mapper23_Init}, -// {"", 24, Mapper24_Init}, - {"Konami VRC2/VRC4", 25, Mapper25_Init}, -// {"", 26, Mapper26_Init}, -// {"", 27, Mapper27_Init}, // Deprecated, dupe for VRC2/VRC4 mapper -// {"", 28, Mapper28_Init}, -// {"", 29, Mapper29_Init}, -// {"", 30, Mapper30_Init}, -// {"", 31, Mapper31_Init}, - {"IREM G-101", 32, Mapper32_Init}, - {"TC0190FMC/TC0350FMR", 33, Mapper33_Init}, - {"", 34, Mapper34_Init}, - {"Wario Land 2", 35, UNLSC127_Init}, - {"TXC Policeman", 36, Mapper36_Init}, - {"", 37, Mapper37_Init}, - {"Bit Corp.", 38, Mapper38_Init}, // Crime Busters -// {"", 39, Mapper39_Init}, - {"SMB2j FDS", 40, Mapper40_Init}, - {"CALTRON 6-in-1", 41, Mapper41_Init}, - {"BIO MIRACLE FDS", 42, Mapper42_Init}, - {"", 43, Mapper43_Init}, - {"", 44, Mapper44_Init}, - {"", 45, Mapper45_Init}, - {"RUMBLESTATION 15-in-1",46, Mapper46_Init}, - {"", 47, Mapper47_Init}, - {"TAITO TCxxx", 48, Mapper48_Init}, - {"", 49, Mapper49_Init}, - {"SMB2j FDS REV A", 50, Mapper50_Init}, - {"11-in-1 BALL SERIES", 51, Mapper51_Init}, // 1993 year version - {"", 52, Mapper52_Init}, -// {"", 53, Mapper53_Init}, // iNES version of complex UNIF board, can't emulate properly as iNES -// {"", 54, Mapper54_Init}, -// {"", 55, Mapper55_Init}, -// {"", 56, Mapper56_Init}, - {"", 57, Mapper57_Init}, - {"", 58, BMCGK192_Init}, - {"", 59, Mapper59_Init}, // Check this out - {"", 60, BMCD1038_Init}, - {"20-in-1 KAISER REV A", 61, Mapper61_Init}, - {"700-in-1", 62, Mapper62_Init}, -// {"", 63, Mapper63_Init}, -// {"", 64, Mapper64_Init}, -// {"", 65, Mapper65_Init}, - {"MHOM", 66, MHROM_Init}, -// {"", 67, Mapper67_Init}, - {"Sunsoft Mapper #4", 68, Mapper68_Init}, -// {"", 69, Mapper69_Init}, - {"", 70, Mapper70_Init}, - {"CAMERICA BF9093", 71, Mapper71_Init}, - {"JALECO JF-17", 72, Mapper72_Init}, - {"KONAMI VRC3", 73, Mapper73_Init}, - {"", 74, Mapper74_Init}, - {"KONAMI VRC1", 75, Mapper75_Init}, - {"NAMCOT 108 VER. A", 76, Mapper76_Init}, - {"IREM LROG017", 77, Mapper77_Init}, - {"Irem 74HC161/32", 78, Mapper78_Init}, - {"AVE/C&E/TXC BOARD", 79, Mapper79_Init}, - {"TAITO X1-005 VER. A", 80, Mapper80_Init}, -// {"", 81, Mapper81_Init}, - {"", 82, Mapper82_Init}, - {"", 83, Mapper83_Init}, -// {"", 84, Mapper84_Init}, -// {"", 85, Mapper85_Init}, - {"", 86, Mapper86_Init}, - {"", 87, Mapper87_Init}, - {"", 88, Mapper88_Init}, - {"", 89, Mapper89_Init}, - {"", 90, Mapper90_Init}, - {"", 91, Mapper91_Init}, - {"", 92, Mapper92_Init}, - {"Sunsoft UNROM", 93, SUNSOFT_UNROM_Init}, - {"", 94, Mapper94_Init}, - {"NAMCOT 108 VER. B", 95, Mapper95_Init}, - {"", 96, Mapper96_Init}, - {"", 97, Mapper97_Init}, -// {"", 98, Mapper98_Init}, - {"", 99, Mapper99_Init}, -// {"", 100, Mapper100_Init}, - {"", 101, Mapper101_Init}, -// {"", 102, Mapper102_Init}, - {"", 103, Mapper103_Init}, -// {"", 104, Mapper104_Init}, - {"", 105, Mapper105_Init}, - {"", 106, Mapper106_Init}, - {"", 107, Mapper107_Init}, - {"", 108, Mapper108_Init}, -// {"", 109, Mapper109_Init}, -// {"", 110, Mapper110_Init}, -// {"", 111, Mapper111_Init}, - {"", 112, Mapper112_Init}, - {"", 113, Mapper113_Init}, - {"", 114, Mapper114_Init}, - {"", 115, Mapper115_Init}, - {"", 116, UNLSL12_Init}, - {"", 117, Mapper117_Init}, - {"TSKROM", 118, TKSROM_Init}, - {"", 119, Mapper119_Init}, - {"", 120, Mapper120_Init}, - {"", 121, Mapper121_Init}, -// {"", 122, Mapper122_Init}, - {"UNLH2288", 123, UNLH2288_Init}, -// {"", 124, Mapper124_Init}, - {"", 125, LH32_Init}, -// {"", 126, Mapper126_Init}, -// {"", 127, Mapper127_Init}, -// {"", 128, Mapper128_Init}, -// {"", 129, Mapper129_Init}, -// {"", 130, Mapper130_Init}, -// {"", 131, Mapper131_Init}, - {"UNL22211", 132, UNL22211_Init}, - {"SA72008", 133, SA72008_Init}, - {"", 134, Mapper134_Init}, -// {"", 135, Mapper135_Init}, - {"TCU02", 136, TCU02_Init}, - {"S8259D", 137, S8259D_Init}, - {"S8259B", 138, S8259B_Init}, - {"S8259C", 139, S8259C_Init}, - {"", 140, Mapper140_Init}, - {"S8259A", 141, S8259A_Init}, - {"UNLKS7032", 142, UNLKS7032_Init}, - {"TCA01", 143, TCA01_Init}, - {"", 144, Mapper144_Init}, - {"SA72007", 145, SA72007_Init}, - {"SA0161M", 146, SA0161M_Init}, - {"TCU01", 147, TCU01_Init}, - {"SA0037", 148, SA0037_Init}, - {"SA0036", 149, SA0036_Init}, - {"S74LS374N", 150, S74LS374N_Init}, - {"", 151, Mapper151_Init}, - {"", 152, Mapper152_Init}, - {"", 153, Mapper153_Init}, - {"", 154, Mapper154_Init}, - {"", 155, Mapper155_Init}, - {"", 156, Mapper156_Init}, - {"", 157, Mapper157_Init}, -// {"", 158, Mapper158_Init}, -// {"", 159, Mapper159_Init}, - {"SA009", 160, SA009_Init}, -// {"", 161, Mapper161_Init}, - {"", 162, UNLFS304_Init}, - {"", 163, Mapper163_Init}, - {"", 164, Mapper164_Init}, - {"", 165, Mapper165_Init}, -// {"", 166, Mapper166_Init}, -// {"", 167, Mapper167_Init}, - {"", 168, Mapper168_Init}, -// {"", 169, Mapper169_Init}, - {"", 170, Mapper170_Init}, - {"", 171, Mapper171_Init}, - {"", 172, Mapper172_Init}, - {"", 173, Mapper173_Init}, -// {"", 174, Mapper174_Init}, - {"", 175, Mapper175_Init}, - {"BMCFK23C", 176, BMCFK23C_Init}, //zero 26-may-2012 - well, i have some WXN junk games that use 176 for instance ????. i dont know what game uses this BMCFK23C as mapper 176. we'll have to make a note when we find it. - {"", 177, Mapper177_Init}, - {"", 178, Mapper178_Init}, -// {"", 179, Mapper179_Init}, - {"", 180, Mapper180_Init}, - {"", 181, Mapper181_Init}, -// {"", 182, Mapper182_Init}, // Deprecated, dupe - {"", 183, Mapper183_Init}, - {"", 184, Mapper184_Init}, - {"", 185, Mapper185_Init}, - {"", 186, Mapper186_Init}, - {"", 187, Mapper187_Init}, - {"", 188, Mapper188_Init}, - {"", 189, Mapper189_Init}, -// {"", 190, Mapper190_Init}, - {"", 191, Mapper191_Init}, - {"", 192, Mapper192_Init}, - {"", 193, Mapper193_Init}, - {"", 194, Mapper194_Init}, - {"", 195, Mapper195_Init}, - {"", 196, Mapper196_Init}, - {"", 197, Mapper197_Init}, - {"", 198, Mapper198_Init}, - {"", 199, Mapper199_Init}, - {"", 200, Mapper200_Init}, - {"", 201, Mapper201_Init}, - {"", 202, Mapper202_Init}, - {"", 203, Mapper203_Init}, - {"", 204, Mapper204_Init}, - {"", 205, Mapper205_Init}, - {"NAMCOT 108 VER. C", 206, Mapper206_Init}, // Deprecated, Used to be "DEIROM" whatever it means, but actually simple version of MMC3 - {"TAITO X1-005 VER. B", 207, Mapper207_Init}, - {"", 208, Mapper208_Init}, - {"", 209, Mapper209_Init}, - {"", 210, Mapper210_Init}, - {"", 211, Mapper211_Init}, - {"", 212, Mapper212_Init}, - {"", 213, Mapper213_Init}, - {"", 214, Mapper214_Init}, - {"", 215, UNL8237_Init}, - {"", 216, Mapper216_Init}, - {"", 217, Mapper217_Init}, // Redefined to a new Discrete BMC mapper -// {"", 218, Mapper218_Init}, - {"UNLA9746", 219, UNLA9746_Init}, - {"Debug Mapper", 220, UNLKS7057_Init}, - {"UNLN625092", 221, UNLN625092_Init}, - {"", 222, Mapper222_Init}, -// {"", 223, Mapper223_Init}, -// {"", 224, Mapper224_Init}, - {"", 225, Mapper225_Init}, - {"BMC 22+20-in-1", 226, Mapper226_Init}, - {"", 227, Mapper227_Init}, - {"", 228, Mapper228_Init}, - {"", 229, Mapper229_Init}, - {"BMC 22-in-1+Contra", 230, Mapper230_Init}, - {"", 231, Mapper231_Init}, - {"BMC QUATTRO", 232, Mapper232_Init}, - {"BMC 22+20-in-1 RST", 233, Mapper233_Init}, - {"BMC MAXI", 234, Mapper234_Init}, - {"", 235, Mapper235_Init}, -// {"", 236, Mapper236_Init}, -// {"", 237, Mapper237_Init}, - {"UNL6035052", 238, UNL6035052_Init}, -// {"", 239, Mapper239_Init}, - {"", 240, Mapper240_Init}, - {"", 241, Mapper241_Init}, - {"", 242, Mapper242_Init}, - {"S74LS374NA", 243, S74LS374NA_Init}, - {"DECATHLON", 244, Mapper244_Init}, - {"", 245, Mapper245_Init}, - {"FONG SHEN BANG", 246, Mapper246_Init}, -// {"", 247, Mapper247_Init}, -// {"", 248, Mapper248_Init}, - {"", 249, Mapper249_Init}, - {"", 250, Mapper250_Init}, -// {"", 251, Mapper251_Init}, // No good dumps for this mapper, use UNIF version - {"SAN GUO ZHI PIRATE", 252, Mapper252_Init}, - {"DRAGON BALL PIRATE", 253, Mapper253_Init}, - {"", 254, Mapper254_Init}, -// {"", 255, Mapper255_Init}, // No good dumps for this mapper - {"", 0, NULL} + {"NROM", 0, NROM_Init}, + {"MMC1", 1, Mapper1_Init}, + {"UNROM", 2, UNROM_Init}, + {"CNROM", 3, CNROM_Init}, + {"MMC3", 4, Mapper4_Init}, + {"MMC5", 5, Mapper5_Init}, + {"FFE", 6, Mapper6_Init}, + {"ANROM", 7, ANROM_Init}, + {"", 8, Mapper8_Init}, // Nogaems, it's worthless + {"MMC2", 9, Mapper9_Init}, + {"MMC4", 10, Mapper10_Init}, + {"Color Dreams", 11, Mapper11_Init}, + {"", 12, Mapper12_Init}, + {"CPROM", 13, CPROM_Init}, +// {"", 14, Mapper14_Init}, + {"100-in-1", 15, Mapper15_Init}, + {"Bandai", 16, Mapper16_Init}, + {"", 17, Mapper17_Init}, + {"", 18, Mapper18_Init}, + {"Namcot 106", 19, Mapper19_Init}, +// {"", 20, Mapper20_Init}, + {"Konami VRC2/VRC4 A", 21, Mapper21_Init}, + {"Konami VRC2/VRC4 B", 22, Mapper22_Init}, + {"Konami VRC2/VRC4 C", 23, Mapper23_Init}, + {"Konami VRC6 Rev. A", 24, Mapper24_Init}, + {"Konami VRC2/VRC4 D", 25, Mapper25_Init}, + {"Konami VRC6 Rev. B", 26, Mapper26_Init}, +// {"", 27, Mapper27_Init}, // Deprecated, dupe for VRC2/VRC4 mapper +// {"", 28, Mapper28_Init}, +// {"", 29, Mapper29_Init}, +// {"", 30, Mapper30_Init}, +// {"", 31, Mapper31_Init}, + {"IREM G-101", 32, Mapper32_Init}, + {"TC0190FMC/TC0350FMR", 33, Mapper33_Init}, + {"", 34, Mapper34_Init}, + {"Wario Land 2", 35, UNLSC127_Init}, + {"TXC Policeman", 36, Mapper36_Init}, + {"", 37, Mapper37_Init}, + {"Bit Corp.", 38, Mapper38_Init}, // Crime Busters +// {"", 39, Mapper39_Init}, + {"SMB2j FDS", 40, Mapper40_Init}, + {"CALTRON 6-in-1", 41, Mapper41_Init}, + {"BIO MIRACLE FDS", 42, Mapper42_Init}, + {"", 43, Mapper43_Init}, + {"", 44, Mapper44_Init}, + {"", 45, Mapper45_Init}, + {"RUMBLESTATION 15-in-1",46, Mapper46_Init}, + {"", 47, Mapper47_Init}, + {"TAITO TCxxx", 48, Mapper48_Init}, + {"", 49, Mapper49_Init}, + {"SMB2j FDS REV A", 50, Mapper50_Init}, + {"11-in-1 BALL SERIES", 51, Mapper51_Init}, // 1993 year version + {"", 52, Mapper52_Init}, +// {"", 53, Mapper53_Init}, // iNES version of complex UNIF board, can't emulate properly as iNES +// {"", 54, Mapper54_Init}, +// {"", 55, Mapper55_Init}, +// {"", 56, Mapper56_Init}, + {"", 57, Mapper57_Init}, + {"", 58, BMCGK192_Init}, + {"", 59, Mapper59_Init}, // Check this out + {"", 60, BMCD1038_Init}, + {"20-in-1 KAISER REV A", 61, Mapper61_Init}, + {"700-in-1", 62, Mapper62_Init}, +// {"", 63, Mapper63_Init}, + {"TENGEN RAMBO1", 64, Mapper64_Init}, + {"IREM-H3001", 65, Mapper65_Init}, + {"MHOM", 66, MHROM_Init}, + {"SUNSOFT-FZII", 67, Mapper67_Init}, + {"Sunsoft Mapper #4", 68, Mapper68_Init}, + {"SUNSOFT-5/FME-7", 69, Mapper69_Init}, + {"BA KAMEN DISCRETE", 70, Mapper70_Init}, + {"CAMERICA BF9093", 71, Mapper71_Init}, + {"JALECO JF-17", 72, Mapper72_Init}, + {"KONAMI VRC3", 73, Mapper73_Init}, + {"TW MMC3+VRAM VER. A", 74, Mapper74_Init}, + {"KONAMI VRC1", 75, Mapper75_Init}, + {"NAMCOT 108 VER. A", 76, Mapper76_Init}, + {"IREM LROG017", 77, Mapper77_Init}, + {"Irem 74HC161/32", 78, Mapper78_Init}, + {"AVE/C&E/TXC BOARD", 79, Mapper79_Init}, + {"TAITO X1-005 VER. A", 80, Mapper80_Init}, +// {"", 81, Mapper81_Init}, + {"", 82, Mapper82_Init}, + {"", 83, Mapper83_Init}, +// {"", 84, Mapper84_Init}, + {"KONAMI VRC7", 85, Mapper85_Init}, + {"", 86, Mapper86_Init}, + {"", 87, Mapper87_Init}, + {"", 88, Mapper88_Init}, + {"SUNSOFT-3", 89, Mapper89_Init}, // SUNSOFT-2 mapper + {"", 90, Mapper90_Init}, + {"", 91, Mapper91_Init}, + {"", 92, Mapper92_Init}, + {"SUNSOFT-3R", 93, SUNSOFT_UNROM_Init}, // SUNSOFT-2 mapper with VRAM, different wiring + {"", 94, Mapper94_Init}, + {"NAMCOT 108 VER. B", 95, Mapper95_Init}, + {"", 96, Mapper96_Init}, + {"", 97, Mapper97_Init}, +// {"", 98, Mapper98_Init}, + {"", 99, Mapper99_Init}, +// {"", 100, Mapper100_Init}, + {"", 101, Mapper101_Init}, +// {"", 102, Mapper102_Init}, + {"", 103, Mapper103_Init}, +// {"", 104, Mapper104_Init}, + {"", 105, Mapper105_Init}, + {"", 106, Mapper106_Init}, + {"", 107, Mapper107_Init}, + {"", 108, Mapper108_Init}, +// {"", 109, Mapper109_Init}, +// {"", 110, Mapper110_Init}, +// {"", 111, Mapper111_Init}, + {"", 112, Mapper112_Init}, + {"", 113, Mapper113_Init}, + {"", 114, Mapper114_Init}, + {"", 115, Mapper115_Init}, + {"", 116, UNLSL12_Init}, + {"", 117, Mapper117_Init}, + {"TSKROM", 118, TKSROM_Init}, + {"", 119, Mapper119_Init}, + {"", 120, Mapper120_Init}, + {"", 121, Mapper121_Init}, +// {"", 122, Mapper122_Init}, + {"UNLH2288", 123, UNLH2288_Init}, +// {"", 124, Mapper124_Init}, + {"", 125, LH32_Init}, +// {"", 126, Mapper126_Init}, +// {"", 127, Mapper127_Init}, +// {"", 128, Mapper128_Init}, +// {"", 129, Mapper129_Init}, +// {"", 130, Mapper130_Init}, +// {"", 131, Mapper131_Init}, + {"UNL22211", 132, UNL22211_Init}, + {"SA72008", 133, SA72008_Init}, + {"", 134, Mapper134_Init}, +// {"", 135, Mapper135_Init}, + {"TCU02", 136, TCU02_Init}, + {"S8259D", 137, S8259D_Init}, + {"S8259B", 138, S8259B_Init}, + {"S8259C", 139, S8259C_Init}, + {"", 140, Mapper140_Init}, + {"S8259A", 141, S8259A_Init}, + {"UNLKS7032", 142, UNLKS7032_Init}, + {"TCA01", 143, TCA01_Init}, + {"", 144, Mapper144_Init}, + {"SA72007", 145, SA72007_Init}, + {"SA0161M", 146, SA0161M_Init}, + {"TCU01", 147, TCU01_Init}, + {"SA0037", 148, SA0037_Init}, + {"SA0036", 149, SA0036_Init}, + {"S74LS374N", 150, S74LS374N_Init}, + {"", 151, Mapper151_Init}, + {"", 152, Mapper152_Init}, + {"", 153, Mapper153_Init}, + {"", 154, Mapper154_Init}, + {"", 155, Mapper155_Init}, + {"", 156, Mapper156_Init}, + {"", 157, Mapper157_Init}, +// {"", 158, Mapper158_Init}, +// {"", 159, Mapper159_Init}, + {"SA009", 160, SA009_Init}, +// {"", 161, Mapper161_Init}, + {"", 162, UNLFS304_Init}, + {"", 163, Mapper163_Init}, + {"", 164, Mapper164_Init}, + {"", 165, Mapper165_Init}, + {"SUBOR Rev. A", 166, Mapper166_Init}, + {"SUBOR Rev. B", 167, Mapper167_Init}, + {"", 168, Mapper168_Init}, +// {"", 169, Mapper169_Init}, + {"", 170, Mapper170_Init}, + {"", 171, Mapper171_Init}, + {"", 172, Mapper172_Init}, + {"", 173, Mapper173_Init}, +// {"", 174, Mapper174_Init}, + {"", 175, Mapper175_Init}, + {"BMCFK23C", 176, BMCFK23C_Init}, //zero 26-may-2012 - well, i have some WXN junk games that use 176 for instance ????. i dont know what game uses this BMCFK23C as mapper 176. we'll have to make a note when we find it. + {"", 177, Mapper177_Init}, + {"", 178, Mapper178_Init}, +// {"", 179, Mapper179_Init}, + {"", 180, Mapper180_Init}, + {"", 181, Mapper181_Init}, +// {"", 182, Mapper182_Init}, // Deprecated, dupe + {"", 183, Mapper183_Init}, + {"", 184, Mapper184_Init}, + {"", 185, Mapper185_Init}, + {"", 186, Mapper186_Init}, + {"", 187, Mapper187_Init}, + {"", 188, Mapper188_Init}, + {"", 189, Mapper189_Init}, +// {"", 190, Mapper190_Init}, + {"", 191, Mapper191_Init}, + {"TW MMC3+VRAM VER. B", 192, Mapper192_Init}, + {"NTDEC TC-112", 193, Mapper193_Init}, // War in the Gulf + {"TW MMC3+VRAM VER. C", 194, Mapper194_Init}, + {"TW MMC3+VRAM VER. D", 195, Mapper195_Init}, + {"", 196, Mapper196_Init}, + {"", 197, Mapper197_Init}, + {"", 198, Mapper198_Init}, + {"", 199, Mapper199_Init}, + {"", 200, Mapper200_Init}, + {"", 201, Mapper201_Init}, + {"", 202, Mapper202_Init}, + {"", 203, Mapper203_Init}, + {"", 204, Mapper204_Init}, + {"", 205, Mapper205_Init}, + {"NAMCOT 108 VER. C", 206, Mapper206_Init}, // Deprecated, Used to be "DEIROM" whatever it means, but actually simple version of MMC3 + {"TAITO X1-005 VER. B", 207, Mapper207_Init}, + {"", 208, Mapper208_Init}, + {"", 209, Mapper209_Init}, + {"", 210, Mapper210_Init}, + {"", 211, Mapper211_Init}, + {"", 212, Mapper212_Init}, + {"", 213, Mapper213_Init}, + {"", 214, Mapper214_Init}, + {"", 215, UNL8237_Init}, + {"", 216, Mapper216_Init}, + {"", 217, Mapper217_Init}, // Redefined to a new Discrete BMC mapper +// {"", 218, Mapper218_Init}, + {"UNLA9746", 219, UNLA9746_Init}, + {"Debug Mapper", 220, UNLKS7057_Init}, + {"UNLN625092", 221, UNLN625092_Init}, + {"", 222, Mapper222_Init}, +// {"", 223, Mapper223_Init}, +// {"", 224, Mapper224_Init}, + {"", 225, Mapper225_Init}, + {"BMC 22+20-in-1", 226, Mapper226_Init}, + {"", 227, Mapper227_Init}, + {"", 228, Mapper228_Init}, + {"", 229, Mapper229_Init}, + {"BMC Contra+22-in-1", 230, Mapper230_Init}, + {"", 231, Mapper231_Init}, + {"BMC QUATTRO", 232, Mapper232_Init}, + {"BMC 22+20-in-1 RST", 233, Mapper233_Init}, + {"BMC MAXI", 234, Mapper234_Init}, + {"", 235, Mapper235_Init}, +// {"", 236, Mapper236_Init}, +// {"", 237, Mapper237_Init}, + {"UNL6035052", 238, UNL6035052_Init}, +// {"", 239, Mapper239_Init}, + {"", 240, Mapper240_Init}, + {"", 241, Mapper241_Init}, + {"", 242, Mapper242_Init}, + {"S74LS374NA", 243, S74LS374NA_Init}, + {"DECATHLON", 244, Mapper244_Init}, + {"", 245, Mapper245_Init}, + {"FONG SHEN BANG", 246, Mapper246_Init}, +// {"", 247, Mapper247_Init}, +// {"", 248, Mapper248_Init}, + {"", 249, Mapper249_Init}, + {"", 250, Mapper250_Init}, +// {"", 251, Mapper251_Init}, // No good dumps for this mapper, use UNIF version + {"SAN GUO ZHI PIRATE", 252, Mapper252_Init}, + {"DRAGON BALL PIRATE", 253, Mapper253_Init}, + {"", 254, Mapper254_Init}, +// {"", 255, Mapper255_Init}, // No good dumps for this mapper + {"", 0, NULL} }; - -int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) -{ +int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) { struct md5_context md5; - if(FCEU_fread(&head,1,16,fp)!=16) + if (FCEU_fread(&head, 1, 16, fp) != 16) return 0; - if(memcmp(&head,"NES\x1a",4)) + if (memcmp(&head, "NES\x1a", 4)) return 0; head.cleanup(); - memset(&iNESCart,0,sizeof(iNESCart)); + memset(&iNESCart, 0, sizeof(iNESCart)); - MapperNo = (head.ROM_type>>4); - MapperNo|=(head.ROM_type2&0xF0); - Mirroring = (head.ROM_type&1); + MapperNo = (head.ROM_type >> 4); + MapperNo |= (head.ROM_type2 & 0xF0); + Mirroring = (head.ROM_type & 1); - - // int ROM_size=0; - if(!head.ROM_size) - { - // FCEU_PrintError("No PRG ROM!"); - // return(0); - ROM_size=256; - //head.ROM_size++; - } + if (!head.ROM_size) + ROM_size = 256; else - ROM_size=uppow2(head.ROM_size); + ROM_size = uppow2(head.ROM_size); - // ROM_size = head.ROM_size; - VROM_size = head.VROM_size; + VROM_size = uppow2(head.VROM_size); int round = true; - for (int i = 0; i != sizeof(not_power2)/sizeof(not_power2[0]); ++i) - { + for (int i = 0; i != sizeof(not_power2) / sizeof(not_power2[0]); ++i) { //for games not to the power of 2, so we just read enough //prg rom from it, but we have to keep ROM_size to the power of 2 //since PRGCartMapping wants ROM_size to be to the power of 2 //so instead if not to power of 2, we just use head.ROM_size when //we use FCEU_read - if (not_power2[i] == MapperNo) - { + if (not_power2[i] == MapperNo) { round = false; break; } } - if(VROM_size) - VROM_size=uppow2(VROM_size); + if (head.ROM_type & 8) Mirroring = 2; + if ((ROM = (uint8*)FCEU_malloc(ROM_size << 14)) == NULL) + return 0; - if(head.ROM_type&8) Mirroring=2; - - if((ROM = (uint8 *)FCEU_malloc(ROM_size<<14)) == NULL) return 0; - - if(VROM_size) - { - if((VROM = (uint8 *)FCEU_malloc(VROM_size<<13)) == NULL) - { + if (VROM_size) { + if ((VROM = (uint8*)FCEU_malloc(VROM_size << 13)) == NULL) { free(ROM); ROM = NULL; return 0; } } - memset(ROM,0xFF,ROM_size<<14); - if(VROM_size) memset(VROM,0xFF,VROM_size<<13); - if(head.ROM_type&4) /* Trainer */ - { - trainerpoo=(uint8 *)FCEU_gmalloc(512); - FCEU_fread(trainerpoo,512,1,fp); + memset(ROM, 0xFF, ROM_size << 14); + if (VROM_size) memset(VROM, 0xFF, VROM_size << 13); + if (head.ROM_type & 4) { /* Trainer */ + trainerpoo = (uint8*)FCEU_gmalloc(512); + FCEU_fread(trainerpoo, 512, 1, fp); } ResetCartMapping(); - ResetExState(0,0); + ResetExState(0, 0); - SetupCartPRGMapping(0,ROM,ROM_size*0x4000,0); -// SetupCartPRGMapping(1,WRAM,8192,1); + SetupCartPRGMapping(0, ROM, ROM_size * 0x4000, 0); - FCEU_fread(ROM,0x4000,(round) ? ROM_size : head.ROM_size,fp); + FCEU_fread(ROM, 0x4000, (round) ? ROM_size : head.ROM_size, fp); - if(VROM_size) - FCEU_fread(VROM,0x2000,head.VROM_size,fp); + if (VROM_size) + FCEU_fread(VROM, 0x2000, head.VROM_size, fp); md5_starts(&md5); - md5_update(&md5,ROM,ROM_size<<14); + md5_update(&md5, ROM, ROM_size << 14); - iNESGameCRC32=CalcCRC32(0,ROM,ROM_size<<14); + iNESGameCRC32 = CalcCRC32(0, ROM, ROM_size << 14); - if(VROM_size) - { - iNESGameCRC32=CalcCRC32(iNESGameCRC32,VROM,VROM_size<<13); - md5_update(&md5,VROM,VROM_size<<13); + if (VROM_size) { + iNESGameCRC32 = CalcCRC32(iNESGameCRC32, VROM, VROM_size << 13); + md5_update(&md5, VROM, VROM_size << 13); } - md5_finish(&md5,iNESCart.MD5); - memcpy(&GameInfo->MD5,&iNESCart.MD5,sizeof(iNESCart.MD5)); + md5_finish(&md5, iNESCart.MD5); + memcpy(&GameInfo->MD5, &iNESCart.MD5, sizeof(iNESCart.MD5)); - iNESCart.CRC32=iNESGameCRC32; - - FCEU_printf(" PRG ROM: %3d x 16KiB\n CHR ROM: %3d x 8KiB\n ROM CRC32: 0x%08lx\n", - (round) ? ROM_size : head.ROM_size, head.VROM_size,iNESGameCRC32); + iNESCart.CRC32 = iNESGameCRC32; + FCEU_printf(" PRG ROM: %3d x 16KiB\n", (round) ? ROM_size: head.ROM_size); + FCEU_printf(" CHR ROM: %3d x 8KiB\n", head.VROM_size); + FCEU_printf(" ROM CRC32: 0x%08lx\n", iNESGameCRC32); { int x; FCEU_printf(" ROM MD5: 0x"); @@ -879,30 +824,27 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) char* mappername = "Not Listed"; - for(int mappertest=0;mappertest< (sizeof bmap / sizeof bmap[0]) - 1;mappertest++) - { + for (int mappertest = 0; mappertest < (sizeof bmap / sizeof bmap[0]) - 1; mappertest++) { if (bmap[mappertest].number == MapperNo) { mappername = bmap[mappertest].name; break; } } - FCEU_printf(" Mapper #: %d\n Mapper name: %s\n Mirroring: %s\n", - MapperNo, mappername, Mirroring==2?"None (Four-screen)":Mirroring?"Vertical":"Horizontal"); - - FCEU_printf(" Battery-backed: %s\n", (head.ROM_type&2)?"Yes":"No"); - FCEU_printf(" Trained: %s\n", (head.ROM_type&4)?"Yes":"No"); -// (head.ROM_type&8) = Mirroring: None(Four-screen) + FCEU_printf(" Mapper #: %d\n", MapperNo); + FCEU_printf(" Mapper name: %s\n", mappername); + FCEU_printf(" Mirroring: %s\n", Mirroring == 2 ? "None (Four-screen)" : Mirroring ? "Vertical" : "Horizontal"); + FCEU_printf(" Battery-backed: %s\n", (head.ROM_type & 2) ? "Yes" : "No"); + FCEU_printf(" Trained: %s\n", (head.ROM_type & 4) ? "Yes" : "No"); SetInput(); CheckHInfo(); { int x; - uint64 partialmd5=0; + uint64 partialmd5 = 0; - for(x=0;x<8;x++) - { - partialmd5 |= (uint64)iNESCart.MD5[7-x] << (x*8); + for (x = 0; x < 8; x++) { + partialmd5 |= (uint64)iNESCart.MD5[7 - x] << (x * 8); } FCEU_VSUniCheck(partialmd5, &MapperNo, &Mirroring); @@ -910,53 +852,45 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) /* Must remain here because above functions might change value of VROM_size and free(VROM). */ - if(VROM_size) - SetupCartCHRMapping(0,VROM,VROM_size*0x2000,0); + if (VROM_size) + SetupCartCHRMapping(0, VROM, VROM_size * 0x2000, 0); - if(Mirroring==2) - SetupCartMirroring(4,1,ExtraNTARAM); - else if(Mirroring>=0x10) - SetupCartMirroring(2+(Mirroring&1),1,0); + if (Mirroring == 2) + SetupCartMirroring(4, 1, ExtraNTARAM); + else if (Mirroring >= 0x10) + SetupCartMirroring(2 + (Mirroring & 1), 1, 0); else - SetupCartMirroring(Mirroring&1,(Mirroring&4)>>2,0); + SetupCartMirroring(Mirroring & 1, (Mirroring & 4) >> 2, 0); - iNESCart.battery=(head.ROM_type&2)?1:0; - iNESCart.mirror=Mirroring; - -// if(MapperNo != 18) { -// if(ROM) free(ROM); -// if(VROM) free(VROM); -// ROM=VROM=0; -// return(0); -// } + iNESCart.battery = (head.ROM_type & 2) ? 1 : 0; + iNESCart.mirror = Mirroring; GameInfo->mappernum = MapperNo; MapperInit(); FCEU_LoadGameSave(&iNESCart); - strcpy(LoadedRomFName,name); //bbit edited: line added + strcpy(LoadedRomFName, name); //bbit edited: line added // Extract Filename only. Should account for Windows/Unix this way. if (strrchr(name, '/')) { - name = strrchr(name, '/') + 1; - } else if(strrchr(name, '\\')) { - name = strrchr(name, '\\') + 1; + name = strrchr(name, '/') + 1; + } else if (strrchr(name, '\\')) { + name = strrchr(name, '\\') + 1; } - GameInterface=iNESGI; + GameInterface = iNESGI; FCEU_printf("\n"); // since apparently the iNES format doesn't store this information, // guess if the settings should be PAL or NTSC from the ROM name // TODO: MD5 check against a list of all known PAL games instead? - if(OverwriteVidMode) - { - if(strstr(name,"(E)") || strstr(name,"(e)") - || strstr(name,"(Europe)") || strstr(name,"(PAL)") - || strstr(name,"(F)") || strstr(name,"(f)") - || strstr(name,"(G)") || strstr(name,"(g)") - || strstr(name,"(I)") || strstr(name,"(i)")) + if (OverwriteVidMode) { + if (strstr(name, "(E)") || strstr(name, "(e)") + || strstr(name, "(Europe)") || strstr(name, "(PAL)") + || strstr(name, "(F)") || strstr(name, "(f)") + || strstr(name, "(G)") || strstr(name, "(g)") + || strstr(name, "(I)") || strstr(name, "(i)")) FCEUI_SetVidSystem(1); else FCEUI_SetVidSystem(0); @@ -964,65 +898,59 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) return 1; } - // bbit edited: the whole function below was added -int iNesSave(){ +int iNesSave() { FILE *fp; char name[2048]; - if(GameInfo->type != GIT_CART)return 0; - if(GameInterface!=iNESGI)return 0; + if (GameInfo->type != GIT_CART) return 0; + if (GameInterface != iNESGI) return 0; - strcpy(name,LoadedRomFName); - if (strcmp(name+strlen(name)-4,".nes") != 0) { //para edit - strcat(name,".nes"); + strcpy(name, LoadedRomFName); + if (strcmp(name + strlen(name) - 4, ".nes") != 0) { //para edit + strcat(name, ".nes"); } - fp = fopen(name,"wb"); + fp = fopen(name, "wb"); - if(fwrite(&head,1,16,fp)!=16) - { + if (fwrite(&head, 1, 16, fp) != 16) { fclose(fp); return 0; } - if(head.ROM_type&4) /* Trainer */ - { - fwrite(trainerpoo,512,1,fp); + if (head.ROM_type & 4) { /* Trainer */ + fwrite(trainerpoo, 512, 1, fp); } - fwrite(ROM,0x4000,ROM_size,fp); + fwrite(ROM, 0x4000, ROM_size, fp); - if(head.VROM_size)fwrite(VROM,0x2000,head.VROM_size,fp); + if (head.VROM_size) fwrite(VROM, 0x2000, head.VROM_size, fp); fclose(fp); return 1; } -int iNesSaveAs(char* name) -{ +int iNesSaveAs(char* name) { //adelikat: TODO: iNesSave() and this have pretty much the same code, outsource the common code to a single function FILE *fp; - if(GameInfo->type != GIT_CART)return 0; - if(GameInterface != iNESGI)return 0; + if (GameInfo->type != GIT_CART) return 0; + if (GameInterface != iNESGI) return 0; - fp = fopen(name,"wb"); + fp = fopen(name, "wb"); - if(fwrite(&head,1,16,fp)!=16) - { + if (fwrite(&head, 1, 16, fp) != 16) { fclose(fp); return 0; } - if(head.ROM_type&4) /* Trainer */ - { - fwrite(trainerpoo,512,1,fp); + if (head.ROM_type & 4) { /* Trainer */ + fwrite(trainerpoo, 512, 1, fp); } - fwrite(ROM,0x4000,ROM_size,fp); + fwrite(ROM, 0x4000, ROM_size, fp); - if(head.VROM_size)fwrite(VROM,0x2000,head.VROM_size,fp); + if (head.VROM_size) fwrite(VROM, 0x2000, head.VROM_size, fp); fclose(fp); return 1; @@ -1032,519 +960,493 @@ int iNesSaveAs(char* name) char *iNesShortFName() { char *ret; - if (!(ret = strrchr(LoadedRomFName,'\\'))) { - if (!(ret = strrchr(LoadedRomFName,'/'))) return 0; + if (!(ret = strrchr(LoadedRomFName, '\\'))) { + if (!(ret = strrchr(LoadedRomFName, '/'))) return 0; } - return ret+1; + return ret + 1; } -void VRAM_BANK1(uint32 A, uint8 V) -{ - V&=7; - PPUCHRRAM|=(1<<(A>>10)); - CHRBankList[(A)>>10]=V; - VPage[(A)>>10]=&CHRRAM[V<<10]-(A); +void VRAM_BANK1(uint32 A, uint8 V) { + V &= 7; + PPUCHRRAM |= (1 << (A >> 10)); + CHRBankList[(A) >> 10] = V; + VPage[(A) >> 10] = &CHRRAM[V << 10] - (A); } -void VRAM_BANK4(uint32 A, uint32 V) -{ - V&=1; - PPUCHRRAM|=(0xF<<(A>>10)); - CHRBankList[(A)>>10]=(V<<2); - CHRBankList[((A)>>10)+1]=(V<<2)+1; - CHRBankList[((A)>>10)+2]=(V<<2)+2; - CHRBankList[((A)>>10)+3]=(V<<2)+3; - VPage[(A)>>10]=&CHRRAM[V<<10]-(A); +void VRAM_BANK4(uint32 A, uint32 V) { + V &= 1; + PPUCHRRAM |= (0xF << (A >> 10)); + CHRBankList[(A) >> 10] = (V << 2); + CHRBankList[((A) >> 10) + 1] = (V << 2) + 1; + CHRBankList[((A) >> 10) + 2] = (V << 2) + 2; + CHRBankList[((A) >> 10) + 3] = (V << 2) + 3; + VPage[(A) >> 10] = &CHRRAM[V << 10] - (A); } -void VROM_BANK1(uint32 A,uint32 V) -{ - setchr1(A,V); - CHRBankList[(A)>>10]=V; +void VROM_BANK1(uint32 A, uint32 V) { + setchr1(A, V); + CHRBankList[(A) >> 10] = V; } -void VROM_BANK2(uint32 A,uint32 V) -{ - setchr2(A,V); - CHRBankList[(A)>>10]=(V<<1); - CHRBankList[((A)>>10)+1]=(V<<1)+1; +void VROM_BANK2(uint32 A, uint32 V) { + setchr2(A, V); + CHRBankList[(A) >> 10] = (V << 1); + CHRBankList[((A) >> 10) + 1] = (V << 1) + 1; } -void VROM_BANK4(uint32 A, uint32 V) -{ - setchr4(A,V); - CHRBankList[(A)>>10]=(V<<2); - CHRBankList[((A)>>10)+1]=(V<<2)+1; - CHRBankList[((A)>>10)+2]=(V<<2)+2; - CHRBankList[((A)>>10)+3]=(V<<2)+3; +void VROM_BANK4(uint32 A, uint32 V) { + setchr4(A, V); + CHRBankList[(A) >> 10] = (V << 2); + CHRBankList[((A) >> 10) + 1] = (V << 2) + 1; + CHRBankList[((A) >> 10) + 2] = (V << 2) + 2; + CHRBankList[((A) >> 10) + 3] = (V << 2) + 3; } -void VROM_BANK8(uint32 V) -{ +void VROM_BANK8(uint32 V) { setchr8(V); - CHRBankList[0]=(V<<3); - CHRBankList[1]=(V<<3)+1; - CHRBankList[2]=(V<<3)+2; - CHRBankList[3]=(V<<3)+3; - CHRBankList[4]=(V<<3)+4; - CHRBankList[5]=(V<<3)+5; - CHRBankList[6]=(V<<3)+6; - CHRBankList[7]=(V<<3)+7; + CHRBankList[0] = (V << 3); + CHRBankList[1] = (V << 3) + 1; + CHRBankList[2] = (V << 3) + 2; + CHRBankList[3] = (V << 3) + 3; + CHRBankList[4] = (V << 3) + 4; + CHRBankList[5] = (V << 3) + 5; + CHRBankList[6] = (V << 3) + 6; + CHRBankList[7] = (V << 3) + 7; } -void ROM_BANK8(uint32 A, uint32 V) -{ - setprg8(A,V); - if(A>=0x8000) - PRGBankList[((A-0x8000)>>13)]=V; +void ROM_BANK8(uint32 A, uint32 V) { + setprg8(A, V); + if (A >= 0x8000) + PRGBankList[((A - 0x8000) >> 13)] = V; } -void ROM_BANK16(uint32 A, uint32 V) -{ - setprg16(A,V); - if(A>=0x8000) - { - PRGBankList[((A-0x8000)>>13)]=V<<1; - PRGBankList[((A-0x8000)>>13)+1]=(V<<1)+1; +void ROM_BANK16(uint32 A, uint32 V) { + setprg16(A, V); + if (A >= 0x8000) { + PRGBankList[((A - 0x8000) >> 13)] = V << 1; + PRGBankList[((A - 0x8000) >> 13) + 1] = (V << 1) + 1; } } -void ROM_BANK32(uint32 V) -{ - setprg32(0x8000,V); - PRGBankList[0]=V<<2; - PRGBankList[1]=(V<<2)+1; - PRGBankList[2]=(V<<2)+2; - PRGBankList[3]=(V<<2)+3; +void ROM_BANK32(uint32 V) { + setprg32(0x8000, V); + PRGBankList[0] = V << 2; + PRGBankList[1] = (V << 2) + 1; + PRGBankList[2] = (V << 2) + 2; + PRGBankList[3] = (V << 2) + 3; } -void onemir(uint8 V) -{ - if(Mirroring==2) return; - if(V>1) - V=1; - Mirroring=0x10|V; - setmirror(MI_0+V); +void onemir(uint8 V) { + if (Mirroring == 2) return; + if (V > 1) + V = 1; + Mirroring = 0x10 | V; + setmirror(MI_0 + V); } -void MIRROR_SET2(uint8 V) -{ - if(Mirroring==2) return; - Mirroring=V; +void MIRROR_SET2(uint8 V) { + if (Mirroring == 2) return; + Mirroring = V; setmirror(V); } -void MIRROR_SET(uint8 V) -{ - if(Mirroring==2) return; - V^=1; - Mirroring=V; +void MIRROR_SET(uint8 V) { + if (Mirroring == 2) return; + V ^= 1; + Mirroring = V; setmirror(V); } -static void NONE_init(void) -{ - ROM_BANK16(0x8000,0); - ROM_BANK16(0xC000,~0); +static void NONE_init(void) { + ROM_BANK16(0x8000, 0); + ROM_BANK16(0xC000, ~0); - if(VROM_size) + if (VROM_size) VROM_BANK8(0); else setvram8(CHRRAM); } -void (*MapInitTab[256])(void)= +void(*MapInitTab[256]) (void) = { - 0, - 0, - 0, //Mapper2_init, - 0, //Mapper3_init, - 0, - 0, - Mapper6_init, - 0, //Mapper7_init, - 0, //Mapper8_init, - Mapper9_init, - Mapper10_init, - 0, //Mapper11_init, - 0, - 0, //Mapper13_init, - 0, - 0, //Mapper15_init, - 0, //Mapper16_init, - 0, //Mapper17_init, - 0, //Mapper18_init, - 0, - 0, - 0, //Mapper21_init, - 0, //Mapper22_init, - 0, //Mapper23_init, - Mapper24_init, - 0, //Mapper25_init, - Mapper26_init, - 0, //Mapper27_init, - 0, - 0, - 0, - 0, - 0, //Mapper32_init, - 0, //Mapper33_init, - 0, //Mapper34_init, - 0, - 0, - 0, - 0, - 0, - 0, //Mapper40_init, - 0, //Mapper41_init, - 0, //Mapper42_init, - 0, //Mapper43_init, - 0, - 0, - 0, //Mapper46_init, - 0, - 0, //Mapper48_init, - 0, - 0, //Mapper50_init, - 0, //Mapper51_init, - 0, - 0, - 0, - 0, - 0, - 0, //Mapper57_init, - 0, //Mapper58_init, - 0, //Mapper59_init, - 0, //Mapper60_init, - 0, //Mapper61_init, - 0, //Mapper62_init, - 0, - Mapper64_init, - Mapper65_init, - 0, //Mapper66_init, - Mapper67_init, - 0, //Mapper68_init, - Mapper69_init, - 0, //Mapper70_init, - 0, //Mapper71_init, - 0, //Mapper72_init, - 0, //Mapper73_init, - 0, - 0, //Mapper75_init, - 0, //Mapper76_init, - 0, //Mapper77_init, - 0, //Mapper78_init, - 0, //Mapper79_init, - 0, //Mapper80_init, - 0, - 0, //Mapper82_init, - 0, //Mapper83_init, - 0, - Mapper85_init, - 0, //Mapper86_init, - 0, //Mapper87_init, - 0, //Mapper88_init, - 0, //Mapper89_init, - 0, - 0, //Mapper91_init, - 0, //Mapper92_init, - 0, //Mapper93_init, - 0, //Mapper94_init, - 0, - 0, //Mapper96_init, - 0, //Mapper97_init, - 0, - 0, //Mapper99_init, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, //Mapper107_init, - 0, - 0, - 0, - 0, - 0, - 0, //Mapper113_init, - 0, - 0, - 0, //Mapper116_init, - 0, //Mapper117_init, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, //Mapper140_init, - 0, - 0, - 0, - 0, //Mapper144_init, - 0, - 0, - 0, - 0, - 0, - 0, - 0, //Mapper151_init, - 0, //Mapper152_init, - 0, //Mapper153_init, - 0, //Mapper154_init, - 0, - 0, //Mapper156_init, - 0, //Mapper157_init, - 0, //Mapper158_init, removed - 0, - 0, - 0, - 0, - 0, - 0, - 0, - Mapper166_init, - Mapper167_init, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, //Mapper180_init, - 0, - 0, - 0, - 0, //Mapper184_init, - 0, //Mapper185_init, - 0, - 0, - 0, - 0, //Mapper189_init, - 0, - 0, //Mapper191_init, - 0, - 0, //Mapper193_init, - 0, - 0, - 0, - 0, - 0, - 0, - 0, //Mapper200_init, - 0, //Mapper201_init, - 0, //Mapper202_init, - 0, //Mapper203_init, - 0, //Mapper204_init, - 0, - 0, - 0, //Mapper207_init, - 0, - 0, - 0, - 0, //Mapper211_init, - 0, //Mapper212_init, - 0, //Mapper213_init, - 0, //Mapper214_init, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, //Mapper225_init, - 0, //Mapper226_init, - 0, //Mapper227_init, - 0, //Mapper228_init, - 0, //Mapper229_init, - 0, //Mapper230_init, - 0, //Mapper231_init, - 0, //Mapper232_init, - 0, - 0, //Mapper234_init, - 0, //Mapper235_init, - 0, - 0, - 0, - 0, - 0, //Mapper240_init, - 0, //Mapper241_init, - 0, //Mapper242_init, - 0, - 0, //Mapper244_init, - 0, - 0, //Mapper246_init, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, //Mapper255_init + 0, + 0, + 0, //Mapper2_init, + 0, //Mapper3_init, + 0, + 0, + 0, //Mapper6_init, + 0, //Mapper7_init, + 0, //Mapper8_init, + 0, //Mapper9_init, + 0, //Mapper10_init, + 0, //Mapper11_init, + 0, + 0, //Mapper13_init, + 0, + 0, //Mapper15_init, + 0, //Mapper16_init, + 0, //Mapper17_init, + 0, //Mapper18_init, + 0, + 0, + 0, //Mapper21_init, + 0, //Mapper22_init, + 0, //Mapper23_init, + 0, //Mapper24_init, + 0, //Mapper25_init, + 0, //Mapper26_init, + 0, //Mapper27_init, + 0, + 0, + 0, + 0, + 0, //Mapper32_init, + 0, //Mapper33_init, + 0, //Mapper34_init, + 0, + 0, + 0, + 0, + 0, + 0, //Mapper40_init, + 0, //Mapper41_init, + 0, //Mapper42_init, + 0, //Mapper43_init, + 0, + 0, + 0, //Mapper46_init, + 0, + 0, //Mapper48_init, + 0, + 0, //Mapper50_init, + 0, //Mapper51_init, + 0, + 0, + 0, + 0, + 0, + 0, //Mapper57_init, + 0, //Mapper58_init, + 0, //Mapper59_init, + 0, //Mapper60_init, + 0, //Mapper61_init, + 0, //Mapper62_init, + 0, + 0, //Mapper64_init, + 0, //Mapper65_init, + 0, //Mapper66_init, + 0, //Mapper67_init, + 0, //Mapper68_init, + 0, //Mapper69_init, + 0, //Mapper70_init, + 0, //Mapper71_init, + 0, //Mapper72_init, + 0, //Mapper73_init, + 0, + 0, //Mapper75_init, + 0, //Mapper76_init, + 0, //Mapper77_init, + 0, //Mapper78_init, + 0, //Mapper79_init, + 0, //Mapper80_init, + 0, + 0, //Mapper82_init, + 0, //Mapper83_init, + 0, + 0, //Mapper85_init, + 0, //Mapper86_init, + 0, //Mapper87_init, + 0, //Mapper88_init, + 0, //Mapper89_init, + 0, + 0, //Mapper91_init, + 0, //Mapper92_init, + 0, //Mapper93_init, + 0, //Mapper94_init, + 0, + 0, //Mapper96_init, + 0, //Mapper97_init, + 0, + 0, //Mapper99_init, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, //Mapper107_init, + 0, + 0, + 0, + 0, + 0, + 0, //Mapper113_init, + 0, + 0, + 0, //Mapper116_init, + 0, //Mapper117_init, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, //Mapper140_init, + 0, + 0, + 0, + 0, //Mapper144_init, + 0, + 0, + 0, + 0, + 0, + 0, + 0, //Mapper151_init, + 0, //Mapper152_init, + 0, //Mapper153_init, + 0, //Mapper154_init, + 0, + 0, //Mapper156_init, + 0, //Mapper157_init, + 0, //Mapper158_init, removed + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, //Mapper166_init, + 0, //Mapper167_init, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, //Mapper180_init, + 0, + 0, + 0, + 0, //Mapper184_init, + 0, //Mapper185_init, + 0, + 0, + 0, + 0, //Mapper189_init, + 0, + 0, //Mapper191_init, + 0, + 0, //Mapper193_init, + 0, + 0, + 0, + 0, + 0, + 0, + 0, //Mapper200_init, + 0, //Mapper201_init, + 0, //Mapper202_init, + 0, //Mapper203_init, + 0, //Mapper204_init, + 0, + 0, + 0, //Mapper207_init, + 0, + 0, + 0, + 0, //Mapper211_init, + 0, //Mapper212_init, + 0, //Mapper213_init, + 0, //Mapper214_init, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, //Mapper225_init, + 0, //Mapper226_init, + 0, //Mapper227_init, + 0, //Mapper228_init, + 0, //Mapper229_init, + 0, //Mapper230_init, + 0, //Mapper231_init, + 0, //Mapper232_init, + 0, + 0, //Mapper234_init, + 0, //Mapper235_init, + 0, + 0, + 0, + 0, + 0, //Mapper240_init, + 0, //Mapper241_init, + 0, //Mapper242_init, + 0, + 0, //Mapper244_init, + 0, + 0, //Mapper246_init, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, //Mapper255_init }; -static DECLFW(BWRAM) -{ - WRAM[A-0x6000]=V; +static DECLFW(BWRAM) { + WRAM[A - 0x6000] = V; } -static DECLFR(AWRAM) -{ - return WRAM[A-0x6000]; +static DECLFR(AWRAM) { + return WRAM[A - 0x6000]; } void (*MapStateRestore)(int version); -void iNESStateRestore(int version) -{ +void iNESStateRestore(int version) { int x; - if(!MapperNo) return; + if (!MapperNo) return; - for(x=0;x<4;x++) - setprg8(0x8000+x*8192,PRGBankList[x]); + for (x = 0; x < 4; x++) + setprg8(0x8000 + x * 8192, PRGBankList[x]); - if(VROM_size) - for(x=0;x<8;x++) - setchr1(0x400*x,CHRBankList[x]); + if (VROM_size) + for (x = 0; x < 8; x++) + setchr1(0x400 * x, CHRBankList[x]); - if(0) switch(Mirroring) - { - case 0:setmirror(MI_H);break; - case 1:setmirror(MI_V);break; + if (0) switch (Mirroring) { + case 0: setmirror(MI_H); break; + case 1: setmirror(MI_V); break; case 0x12: - case 0x10:setmirror(MI_0);break; + case 0x10: setmirror(MI_0); break; case 0x13: - case 0x11:setmirror(MI_1);break; - } - if(MapStateRestore) MapStateRestore(version); + case 0x11: setmirror(MI_1); break; + } + if (MapStateRestore) MapStateRestore(version); } -static void iNESPower(void) -{ +static void iNESPower(void) { int x; - int type=MapperNo; + int type = MapperNo; - SetReadHandler(0x8000,0xFFFF,CartBR); - GameStateRestore=iNESStateRestore; - MapClose=0; - MapperReset=0; - MapStateRestore=0; + SetReadHandler(0x8000, 0xFFFF, CartBR); + GameStateRestore = iNESStateRestore; + MapperReset = 0; + MapStateRestore = 0; - setprg8r(1,0x6000,0); + setprg8r(1, 0x6000, 0); - SetReadHandler(0x6000,0x7FFF,AWRAM); - SetWriteHandler(0x6000,0x7FFF,BWRAM); - FCEU_CheatAddRAM(8,0x6000,WRAM); + SetReadHandler(0x6000, 0x7FFF, AWRAM); + SetWriteHandler(0x6000, 0x7FFF, BWRAM); + FCEU_CheatAddRAM(8, 0x6000, WRAM); /* This statement represents atrocious code. I need to rewrite all of the iNES mapper code... */ - IRQCount=IRQLatch=IRQa=0; - if(head.ROM_type&2) - memset(GameMemBlock+8192,0,GAME_MEM_BLOCK_SIZE-8192); + IRQCount = IRQLatch = IRQa = 0; + if (head.ROM_type & 2) + memset(GameMemBlock + 8192, 0, GAME_MEM_BLOCK_SIZE - 8192); else - memset(GameMemBlock,0,GAME_MEM_BLOCK_SIZE); + memset(GameMemBlock, 0, GAME_MEM_BLOCK_SIZE); NONE_init(); - ResetExState(0,0); + ResetExState(0, 0); - if(GameInfo->type == GIT_VSUNI) + if (GameInfo->type == GIT_VSUNI) AddExState(FCEUVSUNI_STATEINFO, ~0, 0, 0); AddExState(WRAM, 8192, 0, "WRAM"); - if(type==19 || type==6 || type==69 || type==85 || type==96) + if (type == 85) AddExState(MapperExRAM, 32768, 0, "MEXR"); - if((!VROM_size || type==6 || type==19) && (type!=13 && type!=96)) - AddExState(CHRRAM, 8192, 0, "CHRR"); - if(head.ROM_type&8) + if ((!VROM_size || type == 6 || type == 19) && (type != 13)) + AddExState(CHRRAM, 8192 * 4, 0, "CHRR"); + if (head.ROM_type & 8) AddExState(ExtraNTARAM, 2048, 0, "EXNR"); /* Exclude some mappers whose emulation code handle save state stuff themselves. */ - if(type && type!=13 && type!=96) - { + if (type && type != 13) { AddExState(mapbyte1, 32, 0, "MPBY"); AddExState(&Mirroring, 1, 0, "MIRR"); AddExState(&IRQCount, 4, 1, "IRQC"); AddExState(&IRQLatch, 4, 1, "IQL1"); AddExState(&IRQa, 1, 0, "IRQA"); AddExState(PRGBankList, 4, 0, "PBL"); - for(x=0;x<8;x++) - { + for (x = 0; x < 8; x++) { char tak[8]; - sprintf(tak,"CBL%d",x); - AddExState(&CHRBankList[x], 2, 1,tak); + sprintf(tak, "CBL%d", x); + AddExState(&CHRBankList[x], 2, 1, tak); } } - if(MapInitTab[type]) MapInitTab[type](); - else if(type) - { - FCEU_PrintError("iNES mapper #%d is not supported at all.",type); + if (MapInitTab[type]) + MapInitTab[type](); + else + if (type) { + FCEU_PrintError("iNES mapper #%d is not supported at all.", type); } } -static int NewiNES_Init(int num) -{ - BMAPPINGLocal *tmp=bmap; +static int NewiNES_Init(int num) { + BMAPPINGLocal *tmp = bmap; CHRRAMSize = -1; - if(GameInfo->type == GIT_VSUNI) + if (GameInfo->type == GIT_VSUNI) AddExState(FCEUVSUNI_STATEINFO, ~0, 0, 0); - while(tmp->init) - { - if(num==tmp->number) - { - UNIFchrrama=0; // need here for compatibility with UNIF mapper code - if(!VROM_size) - { - if(num==13) - { - CHRRAMSize=16384; + while (tmp->init) { + if (num == tmp->number) { + UNIFchrrama = 0; // need here for compatibility with UNIF mapper code + if (!VROM_size) { + switch (num) { // FIXME, mapper or game data base with the board parameters and ROM/RAM sizes + case 13: CHRRAMSize = 16 * 1024; break; + case 6: + case 96: CHRRAMSize = 32 * 1024; break; + case 176: CHRRAMSize = 128 * 1024; break; + default: CHRRAMSize = 8 * 1024; break; } - else - { - CHRRAMSize=8192; - } - if((VROM = (uint8 *)FCEU_dmalloc(CHRRAMSize)) == NULL) return 0; - FCEU_MemoryRand(VROM,CHRRAMSize); + if ((VROM = (uint8*)FCEU_dmalloc(CHRRAMSize)) == NULL) return 0; + FCEU_MemoryRand(VROM, CHRRAMSize); - UNIFchrrama=VROM; - SetupCartCHRMapping(0,VROM,CHRRAMSize,1); - AddExState(VROM,CHRRAMSize, 0, "CHRR"); + UNIFchrrama = VROM; + SetupCartCHRMapping(0, VROM, CHRRAMSize, 1); + AddExState(VROM, CHRRAMSize, 0, "CHRR"); } - if(head.ROM_type&8) + if (head.ROM_type & 8) AddExState(ExtraNTARAM, 2048, 0, "EXNR"); tmp->init(&iNESCart); return 1; diff --git a/src/ines.h b/src/ines.h index a3a9f55b..9d5a9428 100644 --- a/src/ines.h +++ b/src/ines.h @@ -147,15 +147,15 @@ void onemir(uint8 V); void MIRROR_SET2(uint8 V); void MIRROR_SET(uint8 V); -void Mapper0_init(void); -void Mapper1_init(void); +//void Mapper0_init(void); +//void Mapper1_init(void); //void Mapper2_init(void); //void Mapper3_init(void); -void Mapper6_init(void); +//void Mapper6_init(void); //void Mapper7_init(void); //void Mapper8_init(void); -void Mapper9_init(void); -void Mapper10_init(void); +//void Mapper9_init(void); +//void Mapper10_init(void); //void Mapper11_init(void); void Mapper12_init(void); //void Mapper13_init(void); @@ -169,9 +169,9 @@ void Mapper20_init(void); //void Mapper21_init(void); //void Mapper22_init(void); //void Mapper23_init(void); -void Mapper24_init(void); +//void Mapper24_init(void); //void Mapper25_init(void); -void Mapper26_init(void); +//void Mapper26_init(void); //void Mapper27_init(void); void Mapper28_init(void); void Mapper29_init(void); @@ -206,12 +206,12 @@ void Mapper60_init(void); //void Mapper61_init(void); //void Mapper62_init(void); void Mapper63_init(void); -void Mapper64_init(void); -void Mapper65_init(void); +//void Mapper64_init(void); +//void Mapper65_init(void); //void Mapper66_init(void); -void Mapper67_init(void); +//void Mapper67_init(void); //void Mapper68_init(void); -void Mapper69_init(void); +//void Mapper69_init(void); //void Mapper70_init(void); //void Mapper71_init(void); //void Mapper72_init(void); @@ -227,7 +227,7 @@ void Mapper81_init(void); //void Mapper82_init(void); void Mapper83_init(void); void Mapper84_init(void); -void Mapper85_init(void); +//void Mapper85_init(void); //void Mapper86_init(void); //void Mapper87_init(void); void Mapper88_init(void); @@ -288,8 +288,8 @@ void Mapper154_init(void); void Mapper160_init(void); void Mapper161_init(void); void Mapper162_init(void); -void Mapper166_init(void); -void Mapper167_init(void); +//void Mapper166_init(void); +//void Mapper167_init(void); void Mapper168_init(void); //void Mapper169_init(void); void Mapper170_init(void); @@ -328,7 +328,7 @@ void Mapper199_init(void); //void Mapper218_init(void); void Mapper219_init(void); //void Mapper220_init(void); -void Mapper221_init(void); +//void Mapper221_init(void); //void Mapper222_init(void); void Mapper223_init(void); void Mapper224_init(void); @@ -370,7 +370,10 @@ void Mapper19_ESI(void); void Mapper1_Init(CartInfo *); void Mapper4_Init(CartInfo *); void Mapper5_Init(CartInfo *); +void Mapper6_Init(CartInfo *); void Mapper8_Init(CartInfo *); +void Mapper9_Init(CartInfo *); +void Mapper10_Init(CartInfo *); void Mapper11_Init(CartInfo *); void Mapper12_Init(CartInfo *); void Mapper15_Init(CartInfo *); @@ -381,8 +384,9 @@ void Mapper19_Init(CartInfo *); void Mapper21_Init(CartInfo *); void Mapper22_Init(CartInfo *); void Mapper23_Init(CartInfo *); +void Mapper24_Init(CartInfo *); void Mapper25_Init(CartInfo *); -void Mapper28_Init(CartInfo *); +void Mapper26_Init(CartInfo *); void Mapper32_Init(CartInfo *); void Mapper33_Init(CartInfo *); void Mapper34_Init(CartInfo *); @@ -406,7 +410,11 @@ void Mapper57_Init(CartInfo *); void Mapper59_Init(CartInfo *); void Mapper61_Init(CartInfo *); void Mapper62_Init(CartInfo *); +void Mapper64_Init(CartInfo *); +void Mapper65_Init(CartInfo *); +void Mapper67_Init(CartInfo *); void Mapper68_Init(CartInfo *); +void Mapper69_Init(CartInfo *); void Mapper70_Init(CartInfo *); void Mapper71_Init(CartInfo *); void Mapper72_Init(CartInfo *); @@ -420,6 +428,7 @@ void Mapper79_Init(CartInfo *); void Mapper80_Init(CartInfo *); void Mapper82_Init(CartInfo *); void Mapper83_Init(CartInfo *); +void Mapper85_Init(CartInfo *); void Mapper86_Init(CartInfo *); void Mapper87_Init(CartInfo *); void Mapper88_Init(CartInfo *); @@ -461,6 +470,8 @@ void Mapper157_Init(CartInfo *); void Mapper163_Init(CartInfo *); void Mapper164_Init(CartInfo *); void Mapper165_Init(CartInfo *); +void Mapper166_Init(CartInfo *); +void Mapper167_Init(CartInfo *); void Mapper168_Init(CartInfo *); void Mapper170_Init(CartInfo *); void Mapper171_Init(CartInfo *); diff --git a/src/mappers/24and26.cpp b/src/mappers/24and26.cpp deleted file mode 100644 index 115ead0f..00000000 --- a/src/mappers/24and26.cpp +++ /dev/null @@ -1,369 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2002 Xodnizel - * - * 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 - */ - -#include "mapinc.h" - -static void (*sfun[3])(void); - -#define vrctemp mapbyte1[0] -#define VPSG2 mapbyte3 -#define VPSG mapbyte2 - -static void DoSQV1(void); -static void DoSQV2(void); -static void DoSawV(void); - -static int swaparoo; - -static int acount=0; - -static void KonamiIRQHook(int a) -{ - #define LCYCS 341 -// #define LCYCS ((227*2)+1) - if(IRQa) - { - acount+=a*3; - if(acount>=LCYCS) - { - doagainbub:acount-=LCYCS;IRQCount++; - if(IRQCount==0x100) - { - X6502_IRQBegin(FCEU_IQEXT); - IRQCount=IRQLatch; - } - if(acount>=LCYCS) goto doagainbub; - } - } -} - -static DECLFW(VRC6SW) -{ - A&=0xF003; - if(A>=0x9000 && A<=0x9002) - { - VPSG[A&3]=V; - if(sfun[0]) sfun[0](); - } - else if(A>=0xa000 && A<=0xa002) - { - VPSG[4|(A&3)]=V; - if(sfun[1]) sfun[1](); - } - else if(A>=0xb000 && A<=0xb002) - { - VPSG2[A&3]=V; - if(sfun[2]) sfun[2](); - } - -} - -static DECLFW(Mapper24_write) -{ - if(swaparoo) - A=(A&0xFFFC)|((A>>1)&1)|((A<<1)&2); - if(A>=0x9000 && A<=0xb002) - { - VRC6SW(A,V); - return; - } - A&=0xF003; -// if(A>=0xF000) printf("%d, %d, $%04x:$%02x\n",scanline,timestamp,A,V); - switch(A&0xF003) - { - case 0x8000:ROM_BANK16(0x8000,V);break; - case 0xB003: - switch(V&0xF) - { - case 0x0:MIRROR_SET2(1);break; - case 0x4:MIRROR_SET2(0);break; - case 0x8:onemir(0);break; - case 0xC:onemir(1);break; - } - break; - case 0xC000:ROM_BANK8(0xC000,V);break; - case 0xD000:VROM_BANK1(0x0000,V);break; - case 0xD001:VROM_BANK1(0x0400,V);break; - case 0xD002:VROM_BANK1(0x0800,V);break; - case 0xD003:VROM_BANK1(0x0c00,V);break; - case 0xE000:VROM_BANK1(0x1000,V);break; - case 0xE001:VROM_BANK1(0x1400,V);break; - case 0xE002:VROM_BANK1(0x1800,V);break; - case 0xE003:VROM_BANK1(0x1c00,V);break; - case 0xF000:IRQLatch=V; - //acount=0; - break; - case 0xF001:IRQa=V&2; - vrctemp=V&1; - if(V&2) - { - IRQCount=IRQLatch; - acount=0; - } - X6502_IRQEnd(FCEU_IQEXT); - break; - case 0xf002:IRQa=vrctemp; - X6502_IRQEnd(FCEU_IQEXT);break; - case 0xF003:break; - } -} - -static int32 CVBC[3]; -static int32 vcount[3]; -static int32 dcount[2]; - -static INLINE void DoSQV(int x) -{ - int32 V; - int32 amp=(((VPSG[x<<2]&15)<<8)*6/8)>>4; - int32 start,end; - - start=CVBC[x]; - end=(SOUNDTS<<16)/soundtsinc; - if(end<=start) return; - CVBC[x]=end; - - if(VPSG[(x<<2)|0x2]&0x80) - { - if(VPSG[x<<2]&0x80) - { - for(V=start;V>4]+=amp; - } - else - { - int32 thresh=(VPSG[x<<2]>>4)&7; - int32 freq=((VPSG[(x<<2)|0x1]|((VPSG[(x<<2)|0x2]&15)<<8))+1)<<17; - for(V=start;Vthresh) /* Greater than, not >=. Important. */ - Wave[V>>4]+=amp; - vcount[x]-=nesincsize; - while(vcount[x]<=0) /* Should only be <0 in a few circumstances. */ - { - vcount[x]+=freq; - dcount[x]=(dcount[x]+1)&15; - } - } - } - } -} - -static void DoSQV1(void) -{ - DoSQV(0); -} - -static void DoSQV2(void) -{ - DoSQV(1); -} - -static void DoSawV(void) -{ - int V; - int32 start,end; - - start=CVBC[2]; - end=(SOUNDTS<<16)/soundtsinc; - if(end<=start) return; - CVBC[2]=end; - - if(VPSG2[2]&0x80) - { - static int32 saw1phaseacc=0; - uint32 freq3; - static uint8 b3=0; - static int32 phaseacc=0; - static uint32 duff=0; - - freq3=(VPSG2[1]+((VPSG2[2]&15)<<8)+1); - - for(V=start;V>3)&0x1f)<<4)*6/8; - } - Wave[V>>4]+=duff; - } - } -} - -static INLINE void DoSQVHQ(int x) -{ - uint32 V; //mbg merge 7/17/06 made uint - int32 amp=((VPSG[x<<2]&15)<<8)*6/8; - - if(VPSG[(x<<2)|0x2]&0x80) - { - if(VPSG[x<<2]&0x80) - { - for(V=CVBC[x];V>4)&7; - for(V=CVBC[x];Vthresh) /* Greater than, not >=. Important. */ - WaveHi[V]+=amp; - vcount[x]--; - if(vcount[x]<=0) /* Should only be <0 in a few circumstances. */ - { - vcount[x]=(VPSG[(x<<2)|0x1]|((VPSG[(x<<2)|0x2]&15)<<8))+1; - dcount[x]=(dcount[x]+1)&15; - } - } - } - } - CVBC[x]=SOUNDTS; -} - -static void DoSQV1HQ(void) -{ - DoSQVHQ(0); -} - -static void DoSQV2HQ(void) -{ - DoSQVHQ(1); -} - -static void DoSawVHQ(void) -{ - static uint8 b3=0; - static int32 phaseacc=0; - uint32 V; //mbg merge 7/17/06 made uint32 - - if(VPSG2[2]&0x80) - { - for(V=CVBC[2];V>3)&0x1f)<<8)*6/8; - vcount[2]--; - if(vcount[2]<=0) - { - vcount[2]=(VPSG2[1]+((VPSG2[2]&15)<<8)+1)<<1; - phaseacc+=VPSG2[0]&0x3f; - b3++; - if(b3==7) - { - b3=0; - phaseacc=0; - } - - } - } - } - CVBC[2]=SOUNDTS; -} - - -void VRC6Sound(int Count) -{ - int x; - - DoSQV1(); - DoSQV2(); - DoSawV(); - for(x=0;x<3;x++) - CVBC[x]=Count; -} - -void VRC6SoundHQ(void) -{ - DoSQV1HQ(); - DoSQV2HQ(); - DoSawVHQ(); -} - -void VRC6SyncHQ(int32 ts) -{ - int x; - for(x=0;x<3;x++) CVBC[x]=ts; -} - -static void VRC6_ESI(void) -{ - GameExpSound.RChange=VRC6_ESI; - GameExpSound.Fill=VRC6Sound; - GameExpSound.HiFill=VRC6SoundHQ; - GameExpSound.HiSync=VRC6SyncHQ; - - memset(CVBC,0,sizeof(CVBC)); - memset(vcount,0,sizeof(vcount)); - memset(dcount,0,sizeof(dcount)); - if(FSettings.SndRate) - { - if(FSettings.soundq>=1) - { - sfun[0]=DoSQV1HQ; - sfun[1]=DoSQV2HQ; - sfun[2]=DoSawVHQ; - } - else - { - sfun[0]=DoSQV1; - sfun[1]=DoSQV2; - sfun[2]=DoSawV; - } - } - else - memset(sfun,0,sizeof(sfun)); -} - -void Mapper24_init(void) -{ - SetWriteHandler(0x8000,0xffff,Mapper24_write); - VRC6_ESI(); - MapIRQHook=KonamiIRQHook; - swaparoo=0; -} - -void Mapper26_init(void) -{ - SetWriteHandler(0x8000,0xffff,Mapper24_write); - VRC6_ESI(); - MapIRQHook=KonamiIRQHook; - swaparoo=1; -} - -void NSFVRC6_Init(void) -{ - VRC6_ESI(); - SetWriteHandler(0x8000,0xbfff,VRC6SW); -} diff --git a/src/mappers/6.cpp b/src/mappers/6.cpp deleted file mode 100644 index 35fd9000..00000000 --- a/src/mappers/6.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2002 Xodnizel - * - * 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 - */ - -#include "mapinc.h" - -static uint8 FFEmode; - -#define FVRAM_BANK8(A,V) {VPage[0]=VPage[1]=VPage[2]=VPage[3]=VPage[4]=VPage[5]=VPage[6]=VPage[7]=V?&MapperExRAM[(V)<<13]-(A):&CHRRAM[(V)<<13]-(A);CHRBankList[0]=((V)<<3);CHRBankList[1]=((V)<<3)+1;CHRBankList[2]=((V)<<3)+2;CHRBankList[3]=((V)<<3)+3;CHRBankList[4]=((V)<<3)+4;CHRBankList[5]=((V)<<3)+5;CHRBankList[6]=((V)<<3)+6;CHRBankList[7]=((V)<<3)+7;PPUCHRRAM=0xFF;} - -static void FFEIRQHook(int a) -{ - if(IRQa) - { - IRQCount+=a; - if(IRQCount>=0x10000) - { - X6502_IRQBegin(FCEU_IQEXT); - IRQa=0; - IRQCount=0; - } - } -} - -DECLFW(Mapper6_write) -{ - if(A<0x8000) - { - switch(A){ - case 0x42FF:MIRROR_SET((V>>4)&1);break; - case 0x42FE:onemir((V>>3)&2); FFEmode=V&0x80;break; - case 0x4501:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break; - case 0x4502:IRQCount&=0xFF00;IRQCount|=V;break; - case 0x4503:IRQCount&=0xFF;IRQCount|=V<<8;IRQa=1;break; - } - } else { - switch (FFEmode) - { - case 0x80: setchr8(V); break; - default: ROM_BANK16(0x8000,V>>2); - FVRAM_BANK8(0x0000,V&3); - } - } -} -void Mapper6_StateRestore(int version) -{ - int x; - for(x=0;x<8;x++) - if(PPUCHRRAM&(1<7) - VPage[x]=&MapperExRAM[(CHRBankList[x]&31)*0x400]-(x*0x400); - else VPage[x]=&CHRRAM[(CHRBankList[x]&7)*0x400]-(x*0x400); - } -} -void Mapper6_init(void) -{ -MapIRQHook=FFEIRQHook; -ROM_BANK16(0xc000,7); - -SetWriteHandler(0x4020,0x5fff,Mapper6_write); -SetWriteHandler(0x8000,0xffff,Mapper6_write); -MapStateRestore=Mapper6_StateRestore; -} diff --git a/src/mappers/65.cpp b/src/mappers/65.cpp deleted file mode 100644 index 1a8cb8b1..00000000 --- a/src/mappers/65.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2002 Xodnizel - * - * 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 - */ - -#include "mapinc.h" - - -void IREMIRQHook(int a) -{ - if(IRQa) - { - IRQCount-=a; - if(IRQCount<-4) - { - X6502_IRQBegin(FCEU_IQEXT); - IRQa=0; - IRQCount=0xFFFF; - } - } -} - -static DECLFW(Mapper65_write) -{ - //if(A>=0x9000 && A<=0x9006) - // printf("$%04x:$%02x, %d\n",A,V,scanline); - switch(A) - { - //default: printf("$%04x:$%02x\n",A,V); - // break; - case 0x8000:ROM_BANK8(0x8000,V);break; - // case 0x9000:printf("$%04x:$%02x\n",A,V);MIRROR_SET2((V>>6)&1);break; - case 0x9001:MIRROR_SET(V>>7);break; - case 0x9003:IRQa=V&0x80;X6502_IRQEnd(FCEU_IQEXT);break; - case 0x9004:IRQCount=IRQLatch;break; - case 0x9005: IRQLatch&=0x00FF; - IRQLatch|=V<<8; - break; - case 0x9006: IRQLatch&=0xFF00;IRQLatch|=V; - break; - case 0xB000:VROM_BANK1(0x0000,V);break; - case 0xB001:VROM_BANK1(0x0400,V);break; - case 0xB002:VROM_BANK1(0x0800,V);break; - case 0xB003:VROM_BANK1(0x0C00,V);break; - case 0xB004:VROM_BANK1(0x1000,V);break; - case 0xB005:VROM_BANK1(0x1400,V);break; - case 0xB006:VROM_BANK1(0x1800,V);break; - case 0xB007:VROM_BANK1(0x1C00,V);break; - case 0xa000:ROM_BANK8(0xA000,V);break; - case 0xC000:ROM_BANK8(0xC000,V);break; - } - //MIRROR_SET2(1); -} - -void Mapper65_init(void) -{ - MapIRQHook=IREMIRQHook; - SetWriteHandler(0x8000,0xffff,Mapper65_write); -} diff --git a/src/mappers/67.cpp b/src/mappers/67.cpp deleted file mode 100644 index ee2390a9..00000000 --- a/src/mappers/67.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2002 Xodnizel - * - * 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 - */ - -#include "mapinc.h" - - -#define suntoggle mapbyte1[0] - -static DECLFW(Mapper67_write) -{ - A&=0xF800; - if((A&0x800) && A<=0xb800) - { - VROM_BANK2((A-0x8800)>>1,V); - } - else switch(A) - { - case 0xc800: - case 0xc000:if(!suntoggle) - { - IRQCount&=0xFF; - IRQCount|=V<<8; - } - else - { - IRQCount&=0xFF00; - IRQCount|=V; - } - suntoggle^=1; - break; - case 0xd800:suntoggle=0;IRQa=V&0x10;X6502_IRQEnd(FCEU_IQEXT);break; - - case 0xe800:switch(V&3) - { - case 0:MIRROR_SET2(1);break; - case 1:MIRROR_SET2(0);break; - case 2:onemir(0);break; - case 3:onemir(1);break; - } - break; - case 0xf800:ROM_BANK16(0x8000,V);break; - } -} -static void SunIRQHook(int a) -{ - if(IRQa) - { - IRQCount-=a; - if(IRQCount<=0) - { - X6502_IRQBegin(FCEU_IQEXT); - IRQa=0; - IRQCount=0xFFFF; - } - } -} -void Mapper67_init(void) -{ -SetWriteHandler(0x8000,0xffff,Mapper67_write); -MapIRQHook=SunIRQHook; -} diff --git a/src/mappers/69.cpp b/src/mappers/69.cpp deleted file mode 100644 index 5d152433..00000000 --- a/src/mappers/69.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2002 Xodnizel - * - * 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 - */ - -#include "mapinc.h" - -static void AYSound(int Count); -static void AYSoundHQ(void); -static void DoAYSQ(int x); -static void DoAYSQHQ(int x); - -#define sunselect mapbyte1[0] -#define sungah mapbyte1[1] -static uint8 sunindex; - -static DECLFW(SUN5BWRAM) -{ - if((sungah&0xC0)==0xC0) - (WRAM-0x6000)[A]=V; -} - -static DECLFR(SUN5AWRAM) -{ - if((sungah&0xC0)==0x40) - return X.DB; - return CartBROB(A); -} - -static DECLFW(Mapper69_SWL) -{ - sunindex=V%14; -} - -static DECLFW(Mapper69_SWH) -{ - int x; - GameExpSound.Fill=AYSound; - GameExpSound.HiFill=AYSoundHQ; - if(FSettings.SndRate) - switch(sunindex) - { - case 0: - case 1: - case 8:if(FSettings.soundq>=1) DoAYSQHQ(0); else DoAYSQ(0);break; - case 2: - case 3: - case 9:if(FSettings.soundq>=1) DoAYSQHQ(1); else DoAYSQ(1);break; - case 4: - case 5: - case 10:if(FSettings.soundq>=1) DoAYSQHQ(2); else DoAYSQ(2);break; - case 7: - for(x=0;x<2;x++) - if(FSettings.soundq>=1) DoAYSQHQ(x); else DoAYSQ(x); - break; - } - MapperExRAM[sunindex]=V; -} - -static DECLFW(Mapper69_write) -{ - switch(A&0xE000) - { - case 0x8000:sunselect=V;break; - case 0xa000: - sunselect&=0xF; - if(sunselect<=7) - VROM_BANK1(sunselect<<10,V); - else - switch(sunselect&0x0f) - { - case 8: - sungah=V; - if(V&0x40) - { - if(V&0x80) // Select WRAM - setprg8r(0x10,0x6000,0); - } - else - setprg8(0x6000,V); - break; - case 9:ROM_BANK8(0x8000,V);break; - case 0xa:ROM_BANK8(0xa000,V);break; - case 0xb:ROM_BANK8(0xc000,V);break; - case 0xc: - switch(V&3) - { - case 0:MIRROR_SET2(1);break; - case 1:MIRROR_SET2(0);break; - case 2:onemir(0);break; - case 3:onemir(1);break; - } - break; - case 0xd:IRQa=V;X6502_IRQEnd(FCEU_IQEXT);break; - case 0xe:IRQCount&=0xFF00;IRQCount|=V;X6502_IRQEnd(FCEU_IQEXT);break; - case 0xf:IRQCount&=0x00FF;IRQCount|=V<<8;X6502_IRQEnd(FCEU_IQEXT);break; - } - break; - } -} - -static int32 vcount[3]; -static int32 dcount[3]; -static int CAYBC[3]; - -static void DoAYSQ(int x) -{ - int32 freq=((MapperExRAM[x<<1]|((MapperExRAM[(x<<1)+1]&15)<<8))+1)<<(4+17); - int32 amp=(MapperExRAM[0x8+x]&15)<<2; - int32 start,end; - int V; - - amp+=amp>>1; - - start=CAYBC[x]; - end=(SOUNDTS<<16)/soundtsinc; - if(end<=start) return; - CAYBC[x]=end; - - if(amp) - for(V=start;V>4]+=amp; - vcount[x]-=nesincsize; - while(vcount[x]<=0) - { - dcount[x]^=1; - vcount[x]+=freq; - } - } -} - -static void DoAYSQHQ(int x) -{ - uint32 V; //mbg merge 7/17/06 made uitn32 - int32 freq=((MapperExRAM[x<<1]|((MapperExRAM[(x<<1)+1]&15)<<8))+1)<<4; - int32 amp=(MapperExRAM[0x8+x]&15)<<6; - - amp+=amp>>1; - - if(!(MapperExRAM[0x7]&(1<=1) return; - z=((SOUNDTS<<16)/soundtsinc)>>4; - a=z-dwave; - - moocow(VRC7Sound, &Wave[dwave], a, 1); - - dwave+=a; -} - -void UpdateOPLNEO(int32 *Wave, int Count) -{ - moocow(VRC7Sound, Wave, Count, 4); -} - -void UpdateOPL(int Count) -{ - int32 z,a; - - z=((SOUNDTS<<16)/soundtsinc)>>4; - a=z-dwave; - - if(VRC7Sound && a) - moocow(VRC7Sound, &Wave[dwave], a, 1); - - dwave=0; -} - -static INLINE void DaMirror(int V) -{ - int salpo[4]={MI_V,MI_H,MI_0,MI_1}; - setmirror(salpo[V&3]); -} - -DECLFW(Mapper85_write) -{ - A|=(A&8)<<1; - - if(A>=0xa000 && A<=0xDFFF) - { - // printf("$%04x, $%04x\n",X.PC,A); - A&=0xF010; - { - int x=((A>>4)&1)|((A-0xA000)>>11); - mapbyte3[x]=V; - setchr1(x<<10,V); - } - } - else if(A==0x9030) - { - if(FSettings.SndRate) - { - OPLL_writeReg(VRC7Sound, indox, V); - GameExpSound.Fill=UpdateOPL; - GameExpSound.NeoFill=UpdateOPLNEO; - } - } - else switch(A&0xF010) - { - case 0x8000:mapbyte2[0]=V;setprg8(0x8000,V);break; - case 0x8010:mapbyte2[1]=V;setprg8(0xa000,V);break; - case 0x9000:mapbyte2[2]=V;setprg8(0xc000,V);break; - case 0x9010:indox=V;break; - case 0xe000:mapbyte2[3]=V;DaMirror(V);break; - case 0xE010:IRQLatch=V; - X6502_IRQEnd(FCEU_IQEXT); - break; - case 0xF000:IRQa=V&2; - vrctemp=V&1; - if(V&2) {IRQCount=IRQLatch;} - acount=0; - X6502_IRQEnd(FCEU_IQEXT); - break; - case 0xf010:if(vrctemp) IRQa=1; - else IRQa=0; - X6502_IRQEnd(FCEU_IQEXT); - break; - } -} - -static void KonamiIRQHook(int a) -{ - #define ACBOO 341 -// #define ACBOO ((227*2)+1) - if(IRQa) - { - acount+=a*3; - - if(acount>=ACBOO) - { - doagainbub:acount-=ACBOO; - IRQCount++; - if(IRQCount&0x100) {X6502_IRQBegin(FCEU_IQEXT);IRQCount=IRQLatch;} - if(acount>=ACBOO) goto doagainbub; - } - } -} - -void Mapper85_StateRestore(int version) -{ - int x; - - if(version<7200) - { - for(x=0;x<8;x++) - mapbyte3[x]=CHRBankList[x]; - for(x=0;x<3;x++) - mapbyte2[x]=PRGBankList[x]; - mapbyte2[3]=(Mirroring<0x10)?Mirroring:Mirroring-0xE; - } - - for(x=0;x<8;x++) - setchr1(x*0x400,mapbyte3[x]); - for(x=0;x<3;x++) - setprg8(0x8000+x*8192,mapbyte2[x]); - DaMirror(mapbyte2[3]); - //LoadOPL(); -} - -static void M85SC(void) -{ - if(VRC7Sound) - OPLL_set_rate(VRC7Sound, FSettings.SndRate); -} - -static void M85SKill(void) -{ - if(VRC7Sound) - OPLL_delete(VRC7Sound); - VRC7Sound=NULL; -} - -static void VRC7SI(void) -{ - GameExpSound.RChange=M85SC; - GameExpSound.Kill=M85SKill; - - VRC7Sound=OPLL_new(3579545, FSettings.SndRate?FSettings.SndRate:44100); - OPLL_reset(VRC7Sound); - OPLL_reset(VRC7Sound); -} - -void NSFVRC7_Init(void) -{ - SetWriteHandler(0x9010,0x901F,Mapper85_write); - SetWriteHandler(0x9030,0x903F,Mapper85_write); - VRC7SI(); -} - -void Mapper85_init(void) -{ - MapIRQHook=KonamiIRQHook; - SetWriteHandler(0x8000,0xffff,Mapper85_write); - GameStateRestore=Mapper85_StateRestore; - if(!VROM_size) - SetupCartCHRMapping(0, CHRRAM, 8192, 1); - //AddExState(VRC7Instrument, 16, 0, "VC7I"); - //AddExState(VRC7Chan, sizeof(VRC7Chan), 0, "V7CH"); - VRC7SI(); -} diff --git a/src/mappers/SConscript b/src/mappers/SConscript deleted file mode 100644 index 554bd08e..00000000 --- a/src/mappers/SConscript +++ /dev/null @@ -1,6 +0,0 @@ -import glob -source_list = glob.glob('*.cpp') + glob.glob('*.c') - -for x in range(len(source_list)): - source_list[x] = 'mappers/' + source_list[x] -Return('source_list') diff --git a/src/mappers/mapinc.h b/src/mappers/mapinc.h deleted file mode 100644 index b14e2c22..00000000 --- a/src/mappers/mapinc.h +++ /dev/null @@ -1,11 +0,0 @@ -#include "../types.h" -#include "../x6502.h" -#include "../fceu.h" -#include "../ppu.h" -#define INESPRIV -#include "../cart.h" -#include "../ines.h" -#include "../utils/memory.h" -#include "../sound.h" -#include "../state.h" - diff --git a/src/mappers/mmc2and4.cpp b/src/mappers/mmc2and4.cpp deleted file mode 100644 index d34cc6bb..00000000 --- a/src/mappers/mmc2and4.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2002 Xodnizel - * - * 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 - */ - -#include "mapinc.h" - -#define MMC4reg mapbyte1 -#define latcha1 mapbyte2[0] -#define latcha2 mapbyte2[1] - - -static void latchcheck(uint32 VAddr) -{ - uint8 l,h; - - h=VAddr>>8; - - if(h>=0x20 || ((h&0xF)!=0xF)) - return; - - l=VAddr&0xF0; - - if(h<0x10) - { - if(l==0xD0) - { - VROM_BANK4(0x0000,MMC4reg[0]); - latcha1=0xFD; - } - else if(l==0xE0) - { - VROM_BANK4(0x0000,MMC4reg[1]); - latcha1=0xFE; - } - } - else - { - if(l==0xD0) - { - VROM_BANK4(0x1000,MMC4reg[2]); - latcha2=0xFD; - } - else if(l==0xE0) - { - VROM_BANK4(0x1000,MMC4reg[3]); - latcha2=0xFE; - } - } -} - -DECLFW(Mapper9_write) // $Axxx -{ - ROM_BANK8(0x8000,V); -} - -DECLFW(Mapper10_write) -{ - ROM_BANK16(0x8000,V); -} - -DECLFW(Mapper9and10_write) -{ - switch(A&0xF000) - { - case 0xB000: - if(latcha1==0xFD) { VROM_BANK4(0x0000,V);} - MMC4reg[0]=V; - break; - case 0xC000: - if(latcha1==0xFE) {VROM_BANK4(0x0000,V);} - MMC4reg[1]=V; - break; - case 0xD000: - if(latcha2==0xFD) {VROM_BANK4(0x1000,V);} - MMC4reg[2]=V; - break; - case 0xE000: - if(latcha2==0xFE) {VROM_BANK4(0x1000,V);} - MMC4reg[3]=V; - break; - case 0xF000: - MIRROR_SET(V&1); - break; - } -} - -void Mapper9_init(void) -{ - latcha1=0xFE; - latcha2=0xFE; - ROM_BANK8(0xA000,~2); - ROM_BANK8(0x8000,0); - SetWriteHandler(0xA000,0xAFFF,Mapper9_write); - SetWriteHandler(0xB000,0xFFFF,Mapper9and10_write); - PPU_hook=latchcheck; -} - -void Mapper10_init(void) -{ - latcha1=latcha2=0xFE; - SetWriteHandler(0xA000,0xAFFF,Mapper10_write); - SetWriteHandler(0xB000,0xFFFF,Mapper9and10_write); - PPU_hook=latchcheck; -} - diff --git a/src/unif.cpp b/src/unif.cpp index b4b52674..f8aff5ba 100644 --- a/src/unif.cpp +++ b/src/unif.cpp @@ -1,22 +1,22 @@ /* FCE Ultra - NES/Famicom Emulator -* -* Copyright notice for this file: -* Copyright (C) 2002 Xodnizel -* -* 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 -*/ + * + * Copyright notice for this file: + * Copyright (C) 2002 Xodnizel + * + * 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 + */ /* TODO: Battery backup file saving, mirror force */ /* **INCOMPLETE** */ @@ -64,7 +64,7 @@ static uint8 *boardname; static uint8 *sboardname; static uint32 CHRRAMSize; -uint8 *UNIFchrrama=0; +uint8 *UNIFchrrama = 0; static UNIF_HEADER unhead; static UNIF_HEADER uchead; @@ -73,250 +73,228 @@ static UNIF_HEADER uchead; static uint8 *malloced[32]; static uint32 mallocedsizes[32]; -static int FixRomSize(uint32 size, uint32 minimum) -{ - uint32 x=1; //mbg merge 7/17/06 made uint +static int FixRomSize(uint32 size, uint32 minimum) { + uint32 x = 1; //mbg merge 7/17/06 made uint - if(size0) - if(index<99) - namebuf[index++]=t; + while ((t = FCEU_fgetc(fp)) > 0) + if (index < 99) + namebuf[index++] = t; - namebuf[index]=0; - FCEU_printf("%s\n",namebuf); + namebuf[index] = 0; + FCEU_printf("%s\n", namebuf); - if(!GameInfo->name) - { - GameInfo->name=(uint8*)malloc(strlen(namebuf)+1); //mbg merge 7/17/06 added cast - strcpy((char*)GameInfo->name,namebuf); //mbg merge 7/17/06 added cast + if (!GameInfo->name) { + GameInfo->name = (uint8*)malloc(strlen(namebuf) + 1); //mbg merge 7/17/06 added cast + strcpy((char*)GameInfo->name, namebuf); //mbg merge 7/17/06 added cast } return(1); } -static int DINF(FCEUFILE *fp) -{ + +static int DINF(FCEUFILE *fp) { char name[100], method[100]; uint8 d, m; uint16 y; int t; - if(FCEU_fread(name,1,100,fp)!=100) + if (FCEU_fread(name, 1, 100, fp) != 100) return(0); - if((t=FCEU_fgetc(fp))==EOF) return(0); - d=t; - if((t=FCEU_fgetc(fp))==EOF) return(0); - m=t; - if((t=FCEU_fgetc(fp))==EOF) return(0); - y=t; - if((t=FCEU_fgetc(fp))==EOF) return(0); - y|=t<<8; - if(FCEU_fread(method,1,100,fp)!=100) + if ((t = FCEU_fgetc(fp)) == EOF) return(0); + d = t; + if ((t = FCEU_fgetc(fp)) == EOF) return(0); + m = t; + if ((t = FCEU_fgetc(fp)) == EOF) return(0); + y = t; + if ((t = FCEU_fgetc(fp)) == EOF) return(0); + y |= t << 8; + if (FCEU_fread(method, 1, 100, fp) != 100) return(0); - name[99]=method[99]=0; - FCEU_printf(" Dumped by: %s\n",name); - FCEU_printf(" Dumped with: %s\n",method); + name[99] = method[99] = 0; + FCEU_printf(" Dumped by: %s\n", name); + FCEU_printf(" Dumped with: %s\n", method); { - char *months[12]={"January","February","March","April","May","June","July", - "August","September","October","November","December"}; - FCEU_printf(" Dumped on: %s %d, %d\n",months[(m-1)%12],d,y); + char *months[12] = { + "January", "February", "March", "April", "May", "June", "July", + "August", "September", "October", "November", "December" + }; + FCEU_printf(" Dumped on: %s %d, %d\n", months[(m - 1) % 12], d, y); } return(1); } -static int CTRL(FCEUFILE *fp) -{ +static int CTRL(FCEUFILE *fp) { int t; - if((t=FCEU_fgetc(fp))==EOF) + if ((t = FCEU_fgetc(fp)) == EOF) return(0); /* The information stored in this byte isn't very helpful, but it's better than nothing...maybe. */ - if(t&1) GameInfo->input[0]=GameInfo->input[1]=SI_GAMEPAD; - else GameInfo->input[0]=GameInfo->input[1]=SI_NONE; + if (t & 1) GameInfo->input[0] = GameInfo->input[1] = SI_GAMEPAD; + else GameInfo->input[0] = GameInfo->input[1] = SI_NONE; - if(t&2) GameInfo->input[1]=SI_ZAPPER; - //else if(t&0x10) GameInfo->input[1]=SI_POWERPAD; + if (t & 2) GameInfo->input[1] = SI_ZAPPER; return(1); } -static int TVCI(FCEUFILE *fp) -{ +static int TVCI(FCEUFILE *fp) { int t; - if( (t=FCEU_fgetc(fp)) ==EOF) + if ((t = FCEU_fgetc(fp)) == EOF) return(0); - if(t<=2) - { - char *stuffo[3]={"NTSC","PAL","NTSC and PAL"}; - if(t==0) - { - GameInfo->vidsys=GIV_NTSC; + if (t <= 2) { + char *stuffo[3] = { "NTSC", "PAL", "NTSC and PAL" }; + if (t == 0) { + GameInfo->vidsys = GIV_NTSC; FCEUI_SetVidSystem(0); - } - else if(t==1) - { - GameInfo->vidsys=GIV_PAL; + } else if (t == 1) { + GameInfo->vidsys = GIV_PAL; FCEUI_SetVidSystem(1); } - FCEU_printf(" TV Standard Compatibility: %s\n",stuffo[t]); + FCEU_printf(" TV Standard Compatibility: %s\n", stuffo[t]); } return(1); } -static int EnableBattery(FCEUFILE *fp) -{ +static int EnableBattery(FCEUFILE *fp) { FCEU_printf(" Battery-backed.\n"); - if(FCEU_fgetc(fp)==EOF) + if (FCEU_fgetc(fp) == EOF) return(0); - UNIFCart.battery=1; + UNIFCart.battery = 1; return(1); } -static int LoadPRG(FCEUFILE *fp) -{ - int z,t; - z=uchead.ID[3]-'0'; +static int LoadPRG(FCEUFILE *fp) { + int z, t; + z = uchead.ID[3] - '0'; - if(z<0 || z>15) + if (z < 0 || z > 15) return(0); - FCEU_printf(" PRG ROM %d size: %d",z,(int) uchead.info); - if(malloced[z]) + FCEU_printf(" PRG ROM %d size: %d", z, (int)uchead.info); + if (malloced[z]) free(malloced[z]); - t=FixRomSize(uchead.info,2048); - if(!(malloced[z]=(uint8 *)FCEU_malloc(t))) + t = FixRomSize(uchead.info, 2048); + if (!(malloced[z] = (uint8*)FCEU_malloc(t))) return(0); - mallocedsizes[z]=t; - memset(malloced[z]+uchead.info,0xFF,t-uchead.info); - if(FCEU_fread(malloced[z],1,uchead.info,fp)!=uchead.info) - { + mallocedsizes[z] = t; + memset(malloced[z] + uchead.info, 0xFF, t - uchead.info); + if (FCEU_fread(malloced[z], 1, uchead.info, fp) != uchead.info) { FCEU_printf("Read Error!\n"); return(0); - } - else + } else FCEU_printf("\n"); - SetupCartPRGMapping(z,malloced[z],t,0); + SetupCartPRGMapping(z, malloced[z], t, 0); return(1); } -static int SetBoardName(FCEUFILE *fp) -{ - if(!(boardname=(uint8 *)FCEU_malloc(uchead.info+1))) +static int SetBoardName(FCEUFILE *fp) { + if (!(boardname = (uint8*)FCEU_malloc(uchead.info + 1))) return(0); - FCEU_fread(boardname,1,uchead.info,fp); - boardname[uchead.info]=0; - FCEU_printf(" Board name: %s\n",boardname); - sboardname=boardname; - if(!memcmp(boardname,"NES-",4) || !memcmp(boardname,"UNL-",4) || !memcmp(boardname,"HVC-",4) || !memcmp(boardname,"BTL-",4) || !memcmp(boardname,"BMC-",4)) - sboardname+=4; + FCEU_fread(boardname, 1, uchead.info, fp); + boardname[uchead.info] = 0; + FCEU_printf(" Board name: %s\n", boardname); + sboardname = boardname; + if (!memcmp(boardname, "NES-", 4) || !memcmp(boardname, "UNL-", 4) || !memcmp(boardname, "HVC-", 4) || !memcmp(boardname, "BTL-", 4) || !memcmp(boardname, "BMC-", 4)) + sboardname += 4; return(1); } -static int LoadCHR(FCEUFILE *fp) -{ - int z,t; - z=uchead.ID[3]-'0'; - if(z<0 || z>15) +static int LoadCHR(FCEUFILE *fp) { + int z, t; + z = uchead.ID[3] - '0'; + if (z < 0 || z > 15) return(0); - FCEU_printf(" CHR ROM %d size: %d",z,(int) uchead.info); - if(malloced[16+z]) - free(malloced[16+z]); - t=FixRomSize(uchead.info,8192); - if(!(malloced[16+z]=(uint8 *)FCEU_malloc(t))) + FCEU_printf(" CHR ROM %d size: %d", z, (int)uchead.info); + if (malloced[16 + z]) + free(malloced[16 + z]); + t = FixRomSize(uchead.info, 8192); + if (!(malloced[16 + z] = (uint8*)FCEU_malloc(t))) return(0); - mallocedsizes[16+z]=t; - memset(malloced[16+z]+uchead.info,0xFF,t-uchead.info); - if(FCEU_fread(malloced[16+z],1,uchead.info,fp)!=uchead.info) - { + mallocedsizes[16 + z] = t; + memset(malloced[16 + z] + uchead.info, 0xFF, t - uchead.info); + if (FCEU_fread(malloced[16 + z], 1, uchead.info, fp) != uchead.info) { FCEU_printf("Read Error!\n"); return(0); - } - else + } else FCEU_printf("\n"); - SetupCartCHRMapping(z,malloced[16+z],t,0); + SetupCartCHRMapping(z, malloced[16 + z], t, 0); return(1); } - #define BMCFLAG_FORCE4 1 #define BMCFLAG_16KCHRR 2 #define BMCFLAG_32KCHRR 4 -#define BMCFLAG_EXPCHRR 8 +#define BMCFLAG_EXPCHRR 8 static BMAPPING bmap[] = { - { "11160", BMC11160_Init, 0 }, { "12-IN-1", BMC12IN1_Init, 0 }, { "13in1JY110", BMC13in1JY110_Init, 0 }, @@ -416,7 +394,7 @@ static BMAPPING bmap[] = { { "SNROM", SNROM_Init, 0 }, { "SOROM", SOROM_Init, 0 }, { "SSS-NROM-256", SSSNROM_Init, 0 }, - { "SUNSOFT_UNROM", SUNSOFT_UNROM_Init, 0 }, + { "SUNSOFT_UNROM", SUNSOFT_UNROM_Init, 0 }, // fix me, real pcb name, real pcb type { "Sachen-74LS374N", S74LS374N_Init, 0 }, { "Sachen-74LS374NA", S74LS374NA_Init, 0 }, //seems to be custom mapper { "Sachen-8259A", S8259A_Init, 0 }, @@ -450,7 +428,7 @@ static BMAPPING bmap[] = { { "VRC7", UNLVRC7_Init, 0 }, { "YOKO", UNLYOKO_Init, 0 }, - {0,0,0} + { 0, 0, 0 } }; static BFMAPPING bfunc[] = { @@ -458,79 +436,67 @@ static BFMAPPING bfunc[] = { { "TVCI", TVCI }, { "BATR", EnableBattery }, { "MIRR", DoMirroring }, - { "PRG", LoadPRG }, - { "CHR", LoadCHR }, - { "NAME", NAME }, + { "PRG", LoadPRG }, + { "CHR", LoadCHR }, + { "NAME", NAME }, { "MAPR", SetBoardName }, { "DINF", DINF }, - { 0, 0 } + { NULL, NULL } }; -int LoadUNIFChunks(FCEUFILE *fp) -{ +int LoadUNIFChunks(FCEUFILE *fp) { int x; int t; - for(;;) - { - t=FCEU_fread(&uchead,1,4,fp); - if(t<4) - { - if(t>0) + for (;; ) { + t = FCEU_fread(&uchead, 1, 4, fp); + if (t < 4) { + if (t > 0) return 0; return 1; } - if(!(FCEU_read32le(&uchead.info,fp))) + if (!(FCEU_read32le(&uchead.info, fp))) return 0; - t=0; - x=0; - //printf("Funky: %s\n",((uint8 *)&uchead)); - while(bfunc[x].name) - { - if(!memcmp(&uchead,bfunc[x].name,strlen(bfunc[x].name))) - { - if(!bfunc[x].init(fp)) + t = 0; + x = 0; + while (bfunc[x].name) { + if (!memcmp(&uchead, bfunc[x].name, strlen(bfunc[x].name))) { + if (!bfunc[x].init(fp)) return 0; - t=1; + t = 1; break; } x++; } - if(!t) - if(FCEU_fseek(fp,uchead.info,SEEK_CUR)<0) + if (!t) + if (FCEU_fseek(fp, uchead.info, SEEK_CUR) < 0) return(0); } } -static int InitializeBoard(void) -{ - int x=0; +static int InitializeBoard(void) { + int x = 0; - if(!sboardname) return(0); + if (!sboardname) return(0); - while(bmap[x].name) - { - if(!strcmp((char *)sboardname,(char *)bmap[x].name)) - { - if(!malloced[16]) - { - if(bmap[x].flags & BMCFLAG_16KCHRR) - CHRRAMSize = 16384; - else if(bmap[x].flags & BMCFLAG_32KCHRR) - CHRRAMSize = 32768; - else if(bmap[x].flags & BMCFLAG_EXPCHRR) - CHRRAMSize = 128 * 1024; - else - CHRRAMSize = 8192; - if((UNIFchrrama=(uint8 *)FCEU_malloc(CHRRAMSize))) - { - SetupCartCHRMapping(0,UNIFchrrama,CHRRAMSize,1); - AddExState(UNIFchrrama, CHRRAMSize, 0,"CHRR"); - } + while (bmap[x].name) { + if (!strcmp((char*)sboardname, (char*)bmap[x].name)) { + if (!malloced[16]) { + if (bmap[x].flags & BMCFLAG_16KCHRR) + CHRRAMSize = 16384; + else if (bmap[x].flags & BMCFLAG_32KCHRR) + CHRRAMSize = 32768; + else if (bmap[x].flags & BMCFLAG_EXPCHRR) + CHRRAMSize = 128 * 1024; else + CHRRAMSize = 8192; + if ((UNIFchrrama = (uint8*)FCEU_malloc(CHRRAMSize))) { + SetupCartCHRMapping(0, UNIFchrrama, CHRRAMSize, 1); + AddExState(UNIFchrrama, CHRRAMSize, 0, "CHRR"); + } else return(-1); } - if(bmap[x].flags&BMCFLAG_FORCE4) - mirrortodo=4; + if (bmap[x].flags & BMCFLAG_FORCE4) + mirrortodo = 4; MooMirroring(); bmap[x].init(&UNIFCart); return(1); @@ -541,48 +507,45 @@ static int InitializeBoard(void) return(0); } -static void UNIFGI(GI h) -{ - switch(h) - { +static void UNIFGI(GI h) { + switch (h) { case GI_RESETSAVE: FCEU_ClearGameSave(&UNIFCart); break; case GI_RESETM2: - if(UNIFCart.Reset) + if (UNIFCart.Reset) UNIFCart.Reset(); break; case GI_POWER: - if(UNIFCart.Power) + if (UNIFCart.Power) UNIFCart.Power(); - if(UNIFchrrama) memset(UNIFchrrama,0,8192); + if (UNIFchrrama) memset(UNIFchrrama, 0, 8192); break; case GI_CLOSE: FCEU_SaveGameSave(&UNIFCart); - if(UNIFCart.Close) + if (UNIFCart.Close) UNIFCart.Close(); FreeUNIF(); break; } } -int UNIFLoad(const char *name, FCEUFILE *fp) -{ - FCEU_fseek(fp,0,SEEK_SET); - FCEU_fread(&unhead,1,4,fp); - if(memcmp(&unhead,"UNIF",4)) +int UNIFLoad(const char *name, FCEUFILE *fp) { + FCEU_fseek(fp, 0, SEEK_SET); + FCEU_fread(&unhead, 1, 4, fp); + if (memcmp(&unhead, "UNIF", 4)) return 0; ResetCartMapping(); - ResetExState(0,0); + ResetExState(0, 0); ResetUNIF(); - if(!FCEU_read32le(&unhead.info,fp)) + if (!FCEU_read32le(&unhead.info, fp)) goto aborto; - if(FCEU_fseek(fp,0x20,SEEK_SET)<0) + if (FCEU_fseek(fp, 0x20, SEEK_SET) < 0) goto aborto; - if(!LoadUNIFChunks(fp)) + if (!LoadUNIFChunks(fp)) goto aborto; { int x; @@ -590,29 +553,28 @@ int UNIFLoad(const char *name, FCEUFILE *fp) md5_starts(&md5); - for(x=0;x<32;x++) - if(malloced[x]) - { - md5_update(&md5,malloced[x],mallocedsizes[x]); + for (x = 0; x < 32; x++) + if (malloced[x]) { + md5_update(&md5, malloced[x], mallocedsizes[x]); } - md5_finish(&md5,UNIFCart.MD5); - FCEU_printf(" ROM MD5: 0x"); - for(x=0;x<16;x++) - FCEU_printf("%02x",UNIFCart.MD5[x]); - FCEU_printf("\n"); - memcpy(&GameInfo->MD5,&UNIFCart.MD5,sizeof(UNIFCart.MD5)); + md5_finish(&md5, UNIFCart.MD5); + FCEU_printf(" ROM MD5: 0x"); + for (x = 0; x < 16; x++) + FCEU_printf("%02x", UNIFCart.MD5[x]); + FCEU_printf("\n"); + memcpy(&GameInfo->MD5, &UNIFCart.MD5, sizeof(UNIFCart.MD5)); } - if(!InitializeBoard()) + if (!InitializeBoard()) goto aborto; FCEU_LoadGameSave(&UNIFCart); - strcpy(LoadedRomFName,name); //For the debugger list - GameInterface=UNIFGI; + strcpy(LoadedRomFName, name); //For the debugger list + GameInterface = UNIFGI; return 1; -aborto: + aborto: FreeUNIF(); ResetUNIF(); diff --git a/vc/.gitignore b/vc/.gitignore index f889d992..7bf00996 100644 --- a/vc/.gitignore +++ b/vc/.gitignore @@ -1,6 +1,7 @@ /Release /ipch /vc10_bin_Debug +/vc10_fceux.sdf /vc10_fceux.vcxproj.user /vc10_obj_Debug /vc10_obj_Release diff --git a/vc/vc10_fceux.vcxproj b/vc/vc10_fceux.vcxproj index 6f4560f0..1ff39dde 100644 --- a/vc/vc10_fceux.vcxproj +++ b/vc/vc10_fceux.vcxproj @@ -243,7 +243,6 @@ - @@ -287,7 +286,10 @@ + + + @@ -307,6 +309,7 @@ + @@ -317,6 +320,7 @@ + @@ -324,7 +328,9 @@ + + true @@ -593,13 +599,7 @@ - - - - - - - + $(IntDir)%(Filename)1.obj $(IntDir)%(Filename)1.xdc CompileAsC @@ -611,7 +611,6 @@ $(IntDir)%(Filename)1.obj $(IntDir)%(Filename)1.xdc - $(IntDir)%(Filename)1.obj @@ -826,8 +825,7 @@ - - + diff --git a/vc/vc10_fceux.vcxproj.filters b/vc/vc10_fceux.vcxproj.filters index 7fc90c2b..eed42057 100644 --- a/vc/vc10_fceux.vcxproj.filters +++ b/vc/vc10_fceux.vcxproj.filters @@ -37,9 +37,6 @@ {5f356733-cee3-4440-aa40-cf138dcfbd8c} - - {13cb7bca-c196-4896-b88a-581e99d86457} - {2a047eb3-7b56-41d4-b228-5df54bc1809d} @@ -635,29 +632,8 @@ drivers\win\lua - - mappers - - - mappers - - - mappers - - - mappers - - - mappers - - - mappers - - - mappers - - - mappers + + boards @@ -784,9 +760,6 @@ boards - - boards - boards @@ -961,6 +934,27 @@ boards + + boards + + + boards + + + boards + + + boards + + + boards + + + boards + + + boards + @@ -1281,12 +1275,6 @@ drivers\win\lua - - mappers - - - mappers - include files @@ -1456,6 +1444,9 @@ drivers\win\taseditor + + include files +