pax_global_header00006660000000000000000000000064146450712740014524gustar00rootroot0000000000000052 comment=1a68327fddda71f1acbad8a63ef04288b1887d19 mupen64plus-ui-console-src-2.6.0/000077500000000000000000000000001464507127400165735ustar00rootroot00000000000000mupen64plus-ui-console-src-2.6.0/.gitattributes000066400000000000000000000007661464507127400214770ustar00rootroot00000000000000* text=auto # normal text files *.6 text AUTHORS text *.c text *.cfg text *.cht text *.conf text COPYING text *.cpp text *.def text *-license text *.h text *.html text *.ini text INSTALL text LICENSES text Makefile text *.py text README text RELEASE text *.S text *.sh text *.txt text *.ver text # windows specific text files *.sln text eol=crlf *.vcproj text eol=crlf *.vcxproj text eol=crlf *.vcxproj.filters text eol=crlf # binary files *.gz binary *.ttf binary cursor.tex binary font.tex binary mupen64plus-ui-console-src-2.6.0/.github/000077500000000000000000000000001464507127400201335ustar00rootroot00000000000000mupen64plus-ui-console-src-2.6.0/.github/workflows/000077500000000000000000000000001464507127400221705ustar00rootroot00000000000000mupen64plus-ui-console-src-2.6.0/.github/workflows/build.yml000066400000000000000000000117531464507127400240210ustar00rootroot00000000000000name: UI Console on: push: paths-ignore: - '.{gitattributes,gitignore,travis.yml}' - '*.md,appveyor.yml,README' pull_request: paths-ignore: - '.{gitattributes,gitignore,travis.yml}' - '*.md,appveyor.yml,README' workflow_dispatch: jobs: Linux: strategy: fail-fast: false matrix: include: - cc: GCC arch: x64 - cc: GCC arch: x86 - cc: Clang arch: x64 - cc: Clang arch: x86 name: Linux / ${{ matrix.cc }} / ${{ matrix.arch }} runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - name: Get build dependencies and arrange the environment run: | git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12" export BUILD_DEPS="libsdl1.2-dev libsdl2-dev" ./../mupen64plus-core/.github/workflows/scripts/ci_install_ubuntu_deps.sh ${{ matrix.arch }} ${{ matrix.cc }} - name: Build and related stuff, backup binaries run: | export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12" export PATH="$(pwd)/../mupen64plus-core/.github/workflows/scripts:${PATH}" export CONFIG_OVERRIDE="SDL_CONFIG="sdl-config"" ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }} export CONFIG_OVERRIDE="SDL_CONFIG="sdl2-config"" ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }} makepkg - name: Upload artifact if: matrix.cc == 'GCC' uses: actions/upload-artifact@v4 with: name: ${{ env.PKG_NAME }} path: pkg/*.tar.gz MSYS2: strategy: fail-fast: false matrix: include: - cc: GCC arch: x64 cross: x86_64 env: MINGW64 - cc: GCC arch: x86 cross: i686 env: MINGW32 name: Windows / MSYS2 ${{ matrix.cc }} / ${{ matrix.arch }} runs-on: windows-2022 defaults: run: shell: msys2 {0} steps: - uses: actions/checkout@v4 - uses: msys2/setup-msys2@v2 with: msystem: ${{ matrix.env }} update: true install: >- git libtool make mingw-w64-${{ matrix.cross }}-gcc mingw-w64-${{ matrix.cross }}-toolchain mingw-w64-${{ matrix.cross }}-ntldd mingw-w64-${{ matrix.cross }}-SDL2 - name: Build and related stuff, backup binaries run: | git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core ./../mupen64plus-core/.github/workflows/scripts/ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }} - name: Backup dependencies, etc... run: | ./../mupen64plus-core/.github/workflows/scripts/ci_backup_mingw_deps.sh ${{ matrix.env }} - name: Upload artifact uses: actions/upload-artifact@v4 with: name: ${{ env.PKG_NAME }} path: pkg/* MSVC: strategy: fail-fast: false matrix: include: - toolset: v143 arch: x64 vs: 2022 - toolset: v141_xp arch: x86 vs: 2019 name: Windows / MSVC with ${{ matrix.toolset }} / ${{ matrix.arch }} runs-on: windows-${{ matrix.vs }} defaults: run: shell: cmd steps: - uses: actions/checkout@v4 - uses: microsoft/setup-msbuild@v2 - name: Build and related stuff, backup binaries run: | git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ..\mupen64plus-core set TOOLSET=${{ matrix.toolset }} .\..\mupen64plus-core\.github\workflows\scripts\ci_msvc_build.cmd ${{ matrix.arch }} - name: Backup dependencies, etc... run: | .\..\mupen64plus-core\.github\workflows\scripts\ci_backup_msvc_deps.cmd ${{ matrix.arch }} SDL2.dll - name: Upload artifact uses: actions/upload-artifact@v4 with: name: ${{ env.PKG_NAME }} path: pkg/* Nightly-build: runs-on: ubuntu-latest if: github.ref_name == 'master' needs: [Linux, MSYS2, MSVC] steps: - uses: actions/checkout@v4 - name: Download artifacts uses: actions/download-artifact@v4 with: path: binaries - name: Get some tools run: | git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core sudo apt-get update sudo apt-get -y install hashdeep - name: Creating new artifacts and update nightly-build run: | ./../mupen64plus-core/.github/workflows/scripts/ci_nightly_artifacts.sh - name: Nightly-build uses: ncipollo/release-action@v1 with: prerelease: true allowUpdates: true removeArtifacts: true replacesArtifacts: false tag: nightly-build artifacts: pkg/* mupen64plus-ui-console-src-2.6.0/.github/workflows/schedule.yml000066400000000000000000000117551464507127400245200ustar00rootroot00000000000000name: UI Console - Scheduled on: schedule: - cron: '50 14 21 * *' jobs: Linux: strategy: fail-fast: false matrix: include: - cc: GCC arch: x64 - cc: GCC arch: x86 - cc: Clang arch: x64 - cc: Clang arch: x86 name: Linux / ${{ matrix.cc }} / ${{ matrix.arch }} runs-on: ubuntu-22.04 if: github.repository == 'mupen64plus/mupen64plus-ui-console' steps: - uses: actions/checkout@v4 - name: Get build dependencies and arrange the environment run: | git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12" export BUILD_DEPS="libsdl1.2-dev libsdl2-dev" ./../mupen64plus-core/.github/workflows/scripts/ci_install_ubuntu_deps.sh ${{ matrix.arch }} ${{ matrix.cc }} - name: Build and related stuff, backup binaries run: | export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12" export PATH="$(pwd)/../mupen64plus-core/.github/workflows/scripts:${PATH}" export CONFIG_OVERRIDE="SDL_CONFIG="sdl-config"" ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }} export CONFIG_OVERRIDE="SDL_CONFIG="sdl2-config"" ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }} makepkg - name: Upload artifact if: matrix.cc == 'GCC' uses: actions/upload-artifact@v4 with: name: ${{ env.PKG_NAME }} path: pkg/*.tar.gz MSYS2: strategy: fail-fast: false matrix: include: - cc: GCC arch: x64 cross: x86_64 env: MINGW64 - cc: GCC arch: x86 cross: i686 env: MINGW32 name: Windows / MSYS2 ${{ matrix.cc }} / ${{ matrix.arch }} runs-on: windows-2022 if: github.repository == 'mupen64plus/mupen64plus-ui-console' defaults: run: shell: msys2 {0} steps: - uses: actions/checkout@v4 - uses: msys2/setup-msys2@v2 with: msystem: ${{ matrix.env }} update: true install: >- git libtool make mingw-w64-${{ matrix.cross }}-gcc mingw-w64-${{ matrix.cross }}-toolchain mingw-w64-${{ matrix.cross }}-ntldd mingw-w64-${{ matrix.cross }}-SDL2 - name: Build and related stuff, backup binaries run: | git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core ./../mupen64plus-core/.github/workflows/scripts/ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }} - name: Backup dependencies, etc... run: | ./../mupen64plus-core/.github/workflows/scripts/ci_backup_mingw_deps.sh ${{ matrix.env }} - name: Upload artifact uses: actions/upload-artifact@v4 with: name: ${{ env.PKG_NAME }} path: pkg/* MSVC: strategy: fail-fast: false matrix: include: - toolset: v143 arch: x64 vs: 2022 - toolset: v141_xp arch: x86 vs: 2019 name: Windows / MSVC with ${{ matrix.toolset }} / ${{ matrix.arch }} runs-on: windows-${{ matrix.vs }} if: github.repository == 'mupen64plus/mupen64plus-ui-console' defaults: run: shell: cmd steps: - uses: actions/checkout@v4 - uses: microsoft/setup-msbuild@v2 - name: Build and related stuff, backup binaries run: | git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ..\mupen64plus-core set TOOLSET=${{ matrix.toolset }} .\..\mupen64plus-core\.github\workflows\scripts\ci_msvc_build.cmd ${{ matrix.arch }} - name: Backup dependencies, etc... run: | .\..\mupen64plus-core\.github\workflows\scripts\ci_backup_msvc_deps.cmd ${{ matrix.arch }} SDL2.dll - name: Upload artifact uses: actions/upload-artifact@v4 with: name: ${{ env.PKG_NAME }} path: pkg/* Nightly-build: runs-on: ubuntu-latest if: github.ref_name == 'master' needs: [Linux, MSYS2, MSVC] steps: - uses: actions/checkout@v4 - name: Download artifacts uses: actions/download-artifact@v4 with: path: binaries - name: Get some tools run: | git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core sudo apt-get update sudo apt-get -y install hashdeep - name: Creating new artifacts and update nightly-build run: | ./../mupen64plus-core/.github/workflows/scripts/ci_nightly_artifacts.sh - name: Nightly-build uses: ncipollo/release-action@v1 with: prerelease: true allowUpdates: true removeArtifacts: true replacesArtifacts: false tag: nightly-build artifacts: pkg/* mupen64plus-ui-console-src-2.6.0/.gitignore000066400000000000000000000000611464507127400205600ustar00rootroot00000000000000/projects/unix/_obj*/ /projects/unix/mupen64plus mupen64plus-ui-console-src-2.6.0/.travis.yml000066400000000000000000000065231464507127400207120ustar00rootroot00000000000000sudo: required dist: xenial language: cpp compiler: - gcc - clang addons: apt: packages: - git - libsdl1.2-dev - libsdl2-dev before_install: - git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core script: - make -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean && LDFLAGS="-Wl,--no-add-needed -Wl,--no-undefined" OPTFLAGS="-O2" make SDL_CONFIG=sdl-config CC="${CC}" CXX="${CXX}" -j$(nproc) -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 all - make -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean && LDFLAGS="-Wl,--no-add-needed -Wl,--no-undefined" OPTFLAGS="-O2" make SDL_CONFIG=sdl2-config CC="${CC}" CXX="${CXX}" -j$(nproc) -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 all # extra mxe build entries matrix: include: - env: - MXE_CPU=i686 - PATH="/usr/lib/mxe/usr/bin/:$PATH" before_install: - curl -sSL "https://mirror.mxe.cc/repos/apt/client-conf/mxeapt.gpg" | sudo -E apt-key add - - echo "deb https://mirror.mxe.cc/repos/apt xenial main" | sudo tee -a /etc/apt/sources.list - sudo apt-get update -qq - sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-gcc - sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-sdl2 - git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core script: - make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" SDL_CONFIG="${MXE_CPU}-w64-mingw32.shared-sdl2-config" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean && make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" SDL_CONFIG="${MXE_CPU}-w64-mingw32.shared-sdl2-config" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 -j$(nproc) all - env: - MXE_CPU=x86_64 - PATH="/usr/lib/mxe/usr/bin/:$PATH" before_install: - curl -sSL "https://mirror.mxe.cc/repos/apt/client-conf/mxeapt.gpg" | sudo -E apt-key add - - echo "deb https://mirror.mxe.cc/repos/apt xenial main" | sudo tee -a /etc/apt/sources.list - sudo apt-get update -qq - sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-gcc - sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-sdl2 - git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core script: - make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" SDL_CONFIG="${MXE_CPU}-w64-mingw32.shared-sdl2-config" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean && make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" SDL_CONFIG="${MXE_CPU}-w64-mingw32.shared-sdl2-config" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 -j$(nproc) all mupen64plus-ui-console-src-2.6.0/INSTALL000066400000000000000000000015731464507127400176320ustar00rootroot00000000000000Mupen64Plus-UI-Console INSTALL ------------------------------ This text file was written to explain the installation process of the Mupen64Plus-UI-Console front-end module. If this module is part of a Mupen64Plus source code bundle, the user should run the "m64p_install.sh" script in the root of the unzipped bundle to install all of the included modules in the bundle. If this module is a standalone source code release, you should build the program from source code and install it via the makefile, like this: $ cd projects/unix $ make all $ sudo make install If you want to build the Mupen64Plus-UI-Console for installation in a home folder for a single user, you may build it like this (replacing with your desired local installation path): $ cd projects/unix $ make all COREDIR= PLUGINDIR= $ make install BINDIR= MANDIR= mupen64plus-ui-console-src-2.6.0/LICENSES000066400000000000000000000453141464507127400177320ustar00rootroot00000000000000Mupen64Plus-ui-console LICENSE ------------------------------ Mupen64Plus-ui-console is licensed under the GNU General Public License version 2. The authors of Mupen64Plus-ui-console are: * Richard Goedeken (Richard42) * Anthony Bentley (bentley) * Dorian Fevrier (Narann) * littleguy77 * and others. Mupen64Plus is based on GPL-licensed source code from Mupen64 v0.5, originally written by: * Hacktarux * Dave2001 * Zilmar * Gregor Anich (Blight) * Juha Luotio (JttL) * and others. GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy 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., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. mupen64plus-ui-console-src-2.6.0/README000066400000000000000000000233021464507127400174530ustar00rootroot00000000000000 =============================================================================== ------------------------------------------------------------------------------- Mupen64plus-ui-console README v2.5 ------------------------------------------------------------------------------- =============================================================================== The latest documentation for this plugin can be found at: https://mupen64plus.org/wiki/index.php/UIConsoleUsage ------------------------------------------------------------------------------- Console Options ------------------------------------------------------------------------------- At startup, the mupen64plus program will look for a user configuration file called 'mupen64plus.cfg'. If this file does not exist, it will be created and default settings will be written. If desired, an alternate config directory can be specified using the --configdir commandline option. Run 'mupen64plus --help' for a complete list of commandline options: $ mupen64plus --help Usage: mupen64plus [parameter(s)] [romfile] Parameters: --noosd : disable onscreen display --osd : enable onscreen display --fullscreen : use fullscreen display mode --windowed : use windowed display mode --resolution (res) : display resolution (640x480, 800x600, 1024x768, etc) --nospeedlimit : disable core speed limiter (should be used with dummy audio plugin) --cheats (cheat-spec) : enable or list cheat codes for the given rom file --corelib (filepath) : use core library (filepath) (can be only filename or full path) --configdir (dir) : force configation directory to (dir); should contain mupen64plus.cfg --datadir (dir) : search for shared data files (.ini files, languages, etc) in (dir) --debug : launch console-based debugger (requires core lib built for debugging) --plugindir (dir) : search for plugins in (dir) --sshotdir (dir) : set screenshot directory to (dir) --gfx (plugin-spec) : use gfx plugin given by (plugin-spec) --audio (plugin-spec) : use audio plugin given by (plugin-spec) --input (plugin-spec) : use input plugin given by (plugin-spec) --rsp (plugin-spec) : use rsp plugin given by (plugin-spec) --emumode (mode) : set emu mode to: 0=Pure Interpreter 1=Interpreter 2=DynaRec --savestate (filepath) : savestate loaded at startup --testshots (list) : take screenshots at frames given in comma-separated (list), then quit --set (param-spec) : set a configuration variable, format: ParamSection[ParamName]=Value --gb-rom-{1,2,3,4} : define GB cart rom to load inside transferpak {1,2,3,4} --gb-ram-{1,2,3,4} : define GB cart ram to load inside transferpak {1,2,3,4} --dd-ipl-rom : define 64DD IPL rom --dd-disk : define disk to load into the disk drive --core-compare-send : use the Core Comparison debugging feature, in data sending mode --core-compare-recv : use the Core Comparison debugging feature, in data receiving mode --nosaveoptions : do not save the given command-line options in configuration file --pif (filepath) : use a binary PIF ROM (filepath) instead of HLE PIF --verbose : print lots of information --help : see this help message (plugin-spec): (pluginname) : filename (without path) of plugin to find in plugin directory (pluginpath) : full path and filename of plugin 'dummy' : use dummy plugin (cheat-spec): 'list' : show all of the available cheat codes 'all' : enable all of the available cheat codes (codelist) : a comma-separated list of cheat code numbers to enable, with dashes to use code variables (ex 1-2 to use cheat 1 option 2) ------------------------------------------------------------------------------- Cheats ------------------------------------------------------------------------------- To list the available cheats in the rom: mupen64plus --cheats list "/path/to/my/rom.v64" If there are cheats in the rom, you will get (in the output console): UI-Console: 3 cheat code(s) found for ROM 'MY ROM' 0: [Enable All Levels] (This is needed to be able to Play all Levels of the Game) 1: [Enable All Weapons] (This is needed to be able to Play with all Weapons of the Game) 2: etc... All you have to do to use this cheats is: mupen64plus --cheats 0,1,2 "/path/to/my/rom.v64" ------------------------------------------------------------------------------- Debugger ------------------------------------------------------------------------------- Setup ===== You must use a mupen64plus core library which was built with the DEBUGGER flag set. Running ======= Use the --debug command-line option to enable the console debugger. The emulator mode should be set to "interpreter", as the dynarec seems to cause issues when interacting with the debugging API. This can be done with the R4300Emulator config setting or with the --emumode flag. Usage ===== Once the emulator boots, it will be paused by default. You will be presented with a prompt as follows: (dbg) The following commands can be entered: run Unpauses the game. pause Pauses the game. step When paused, instructs the emulator to make a single step, or a series of steps if num-steps is provided. regs Prints out general purpose register values. pc Print current value of Program Counter register pc-1 Print previous value of Program Counter register asm Print assembly language instructions. Several forms are supported: asm Print one instruction at the Program Counter register asm Print one instruction at asm Print instructions starting at asm Print instructions starting at with flags - If flags bit-3 is set (i.e. & 0x04): also print binary instruction data - If flags bit-2 is set: prefix each instruction with its memory address - If flags bit-1 is set: prefix each instruction with a counter from mem Print memory values. Several forms are supported: mem Print one 32-bit word at mem /N Print 32-bit words at mem /Nb Print 8-bit bytes at mem /Nh Print 16-bit half-words at mem /Nw Print 32-bit words at mem /Nd Print 64-bit double-words at mem /NxM Print rows of 32-bit words at mem /NxMb Print rows of 8-bit bytes at mem /NxMh Print rows of 16-bit half-words at mem /NxMw Print rows of 32-bit words at mem /NxMd Print rows of 64-bit double-words at write Write values to memory. Several forms are supported: write Write a (1) byte value to write b Write a (1) byte value to write h Write a half-word value (2 bytes) to write w Write a word value (4 bytes) to write d Write a double-word value (8 bytes) to translate Translates virtual memory addresses to physical memory addresses. Memory read/write breakpoints must operate on physical addresses, in contrast to the memory read/write commands and execution breakpoints that operate on virtual addresses. translate Print the 32-bit physical address for the provided argument. bp add Adds a breakpoint at a given address. Several forms are supported: bp add pc Add a breakpoint at the Program Counter, triggered on EXEC, READ, and WRITE. bp add Add a breakpoint at , triggered on EXEC, READ, and WRITE. bp add Add a breakpoint starting at , extending bytes, triggered on EXEC, READ, and WRITE. bp add Add a breakpoint starting at , extending bytes, with specified trigger flags. - M64P_BKP_FLAG_READ = 0x02 - M64P_BKP_FLAG_WRITE = 0x04 - M64P_BKP_FLAG_EXEC = 0x08 bp trig Prints the reason for the most recently activated breakpoint trigger. Memory read/write breakpoints will indicate the hit address. bp rm Removes a breakpoint by address or number. bp list Lists all breakpoints. exit|quit Stop emulator and quit debugger ------------------------------------------------------------------------------- 64DD Support ------------------------------------------------------------------------------- Some compatibility with the 64DD disk drive unit has been implemented, but there are a few small usability issues of which users should be aware. When using the 64DD, you need to pass a path to a cartridge rom, even if none is strictly required. The IPL boot rom will execute first and select the disk if you have one inserted, or just show the boot menu otherwise. We can remove this requirement at a later time. For now all we need to remember is to use a Japanese ROM (otherwise some region check will fail) with same features as the 64DD game you want to play (think RumblePak, TransferPak, otherwise, they won't be available). There is a sibling issue also with 64DD games in that there are no entries in the game db (mupen64plus.ini) for them, and the core currently only relies on the cart ROM loaded to fetch the ROM infos. mupen64plus-ui-console-src-2.6.0/RELEASE000066400000000000000000000206371464507127400176060ustar00rootroot00000000000000Mupen64Plus-UI-Console RELEASE ------------------------------ --------------------------------------------------------- # Mupen64Plus-UI-Console Front-End v2.6.0 - July 14, 2024 ## Merged PRs * [83](https://github.com/mupen64plus/mupen64plus-ui-console/pull/83): CI/CD: Update to generic scripts, independent schedule, etc * [82](https://github.com/mupen64plus/mupen64plus-ui-console/pull/82): CI/CD: Fixes Ubuntu i386 builds, among other changes * [81](https://github.com/mupen64plus/mupen64plus-ui-console/pull/81): main.c: Fix 64DD ROM loading * [80](https://github.com/mupen64plus/mupen64plus-ui-console/pull/80): CI/CD: Integrate scheduled builds and other... * [78](https://github.com/mupen64plus/mupen64plus-ui-console/pull/78): CI/CD: Update MSVC * [77](https://github.com/mupen64plus/mupen64plus-ui-console/pull/77): CI/CD: Update * [74](https://github.com/mupen64plus/mupen64plus-ui-console/pull/74): README: Update parameters documentation. Savestate, 64DD and PIF options previously missing. * [72](https://github.com/mupen64plus/mupen64plus-ui-console/pull/72): CI/CD: Implement GitHub Actions and public nightly builds * [70](https://github.com/mupen64plus/mupen64plus-ui-console/pull/70): remove redundant condition about PIE value in Makefile * [69](https://github.com/mupen64plus/mupen64plus-ui-console/pull/69): fix build with mingw64 * [66](https://github.com/mupen64plus/mupen64plus-ui-console/pull/66): build: Fix the build with 'cc' on gentoo. * [64](https://github.com/mupen64plus/mupen64plus-ui-console/pull/64): build: Allow out of tree builds. * [61](https://github.com/mupen64plus/mupen64plus-ui-console/pull/61): Allow non-default compilers without resorting to symbolic links * [60](https://github.com/mupen64plus/mupen64plus-ui-console/pull/60): Allow to set custom platform toolset from commands * [59](https://github.com/mupen64plus/mupen64plus-ui-console/pull/59): Add SDL2_net dependency * [58](https://github.com/mupen64plus/mupen64plus-ui-console/pull/58): PIF binary support * [57](https://github.com/mupen64plus/mupen64plus-ui-console/pull/57): AppVeyor with artifact packaging * [56](https://github.com/mupen64plus/mupen64plus-ui-console/pull/56): Changes to have more generic project files + Other things... ## Closed Issues * [79](https://github.com/mupen64plus/mupen64plus-ui-console/issues/79): High Dpi awareness * [76](https://github.com/mupen64plus/mupen64plus-ui-console/issues/76): Unrecognized UI-Console commands * [73](https://github.com/mupen64plus/mupen64plus-ui-console/issues/73): How to view osSyncPrints? * [67](https://github.com/mupen64plus/mupen64plus-ui-console/issues/67): Fails to build with mingw64 due to usage of "PIE" option on system without explicit PIE * [65](https://github.com/mupen64plus/mupen64plus-ui-console/issues/65): gcc9 build failure * [62](https://github.com/mupen64plus/mupen64plus-ui-console/issues/62): Build error after #61 merged * [54](https://github.com/mupen64plus/mupen64plus-ui-console/issues/54): 2.5.9: Missing config API change ## Top Contributors (2 or more commits) 1. Jj0YzL5nvJ 2. richard42 3. GhostlyDark 4. orbea 5. loganmc10 6. Narann ------------------------------------------------------------- # Mupen64Plus-UI-Console Front-End v2.5.9 - February 10, 2019 ## Merged PRs * [52](https://github.com/mupen64plus/mupen64plus-ui-console/pull/52): Fix setting plugin parameters when configuration file not present. * [51](https://github.com/mupen64plus/mupen64plus-ui-console/pull/51): Enhancements to debugging interface * [48](https://github.com/mupen64plus/mupen64plus-ui-console/pull/48): Fix nosaveoptions * [47](https://github.com/mupen64plus/mupen64plus-ui-console/pull/47): Make --nosaveoptions not ever save options. * [45](https://github.com/mupen64plus/mupen64plus-ui-console/pull/45): Update homepage links * [44](https://github.com/mupen64plus/mupen64plus-ui-console/pull/44): Build MXE targets as additional tests in travis build matrix * [43](https://github.com/mupen64plus/mupen64plus-ui-console/pull/43): Add basic support for 64DD. * [41](https://github.com/mupen64plus/mupen64plus-ui-console/pull/41): Basic support for GB cart loader command. * [40](https://github.com/mupen64plus/mupen64plus-ui-console/pull/40): Fix for #39. This should fix https://github.com/mupen64plus/mupen64plus-ui-console/issues/39 * [36](https://github.com/mupen64plus/mupen64plus-ui-console/pull/36): Fix no-pie mode for compilers that default to PIE * [35](https://github.com/mupen64plus/mupen64plus-ui-console/pull/35): Use faster container based Travis CI * [29](https://github.com/mupen64plus/mupen64plus-ui-console/pull/29): Add support for VIDEXT_HEADER * [28](https://github.com/mupen64plus/mupen64plus-ui-console/pull/28): bump macosx-version-min to 10.6 for SDL2.0.5. Allows for compilation on MacOS 10.12 Sierra using packages from Homebrew (samplerate speexdsp nasm and the sdl2 packages). * [27](https://github.com/mupen64plus/mupen64plus-ui-console/pull/27): New implementation of the savestate loaded at startup option. The savestate will be loaded on the first safe state interrupt instead of being loaded on the first frame. * [26](https://github.com/mupen64plus/mupen64plus-ui-console/pull/26): Use Ubuntu Trusty as base system for Travis CI * [22](https://github.com/mupen64plus/mupen64plus-ui-console/pull/22): Added x64 configuration to VisualStudio2013 project file * [21](https://github.com/mupen64plus/mupen64plus-ui-console/pull/21): Remove unnecessary OpenBSD warning. ## Closed Issues * [50](https://github.com/mupen64plus/mupen64plus-ui-console/issues/50): COREDIR and PLUGINDIR should default to a value derived from PREFIX * [46](https://github.com/mupen64plus/mupen64plus-ui-console/issues/46): Missing definitions of m64p_media_loader and M64CMD_SET_MEDIA_LOADER * [39](https://github.com/mupen64plus/mupen64plus-ui-console/issues/39): Fails to build under windows * [34](https://github.com/mupen64plus/mupen64plus-ui-console/issues/34): [SOLVED] Bad value during make * [30](https://github.com/mupen64plus/mupen64plus-ui-console/issues/30): Setting position of window (...+%d+%d) * [23](https://github.com/mupen64plus/mupen64plus-ui-console/issues/23): Custom config folder with --configdir doesn't include save folder Mupen64Plus-UI-Console Front-End v2.5 - April 26, 2015 ------------------------------------------------------ - Update man page document - Add application desktop file and icons - Add support for loading savestate immediately on emulator startup - Compile-time flag to support building ui-console as a library (used by Android frontend) Mupen64Plus-UI-Console Front-End v2.0 - July 4, 2013 ---------------------------------------------------- - Project files for Visual Studio 2012 - Makefile changes - add support for PowerPC and MinGW32 builds - add cross-compiling support to build Win32 executables (MXE) under Linux Mupen64Plus-UI-Console Front-End v1.99.5 - March 10, 2012 --------------------------------------------------------- - New option to disable internal core speed limiter (for benchmarking) - Updated Console-UI front-end for new Mupen64plus 2.0 API versioning - Added config version number for UI-Console section - makefile fixes and improvements Mupen64Plus-UI-Console Front-End v1.99.4 - November 22, 2010 ------------------------------------------------------------ - add some parameter checking for --emumode option - new cheat file format from spinout182 - makefile fixes and improvements Mupen64Plus-UI-Console Front-End v1.99.3 - February 13, 2010 ------------------------------------------------------------ - New feature: command-line option --set for setting arbitrary configuration variables - updated MAN pgae for all the changes made in the 2.0 re-architecture - Makefile improvements: - added OS type GNU/kFreeBSD - add -lpthread to LIBS so that GDB will run the emulator without throwing a warning right after starting Mupen64Plus-UI-Console Front-End v1.99.2 - January 6, 2010 ------------------------------------------------------------ - new feature: added MSVC8 project/solution files, minor refactoring for VC compatibility - Makefile improvements: - throw error if OS/CPU not supported - use DESTDIR in install/uninstall paths - Allow user-specified CC/CXX/LD paths Mupen64Plus-UI-Console Front-End v1.99.1 - December 14, 2009 ------------------------------------------------------------ - Brand new Console-based front-end for Mupen64Plus 2.0 - New feature: R4300 Core Comparison for debugging - New feature: Cheat code support from command-line mupen64plus-ui-console-src-2.6.0/appveyor.yml000066400000000000000000000025561464507127400211730ustar00rootroot00000000000000version: 1.0.{build} image: Visual Studio 2022 skip_tags: true skip_commits: files: - '**/*.md' - .github/ - data/* - .gitattributes - .gitignore - .travis.yml - README configuration: - Release platform: - Win32 - x64 before_build: - git tag --delete nightly-build - git clone --depth 1 https://github.com/mupen64plus/mupen64plus-win32-deps.git ..\mupen64plus-win32-deps - git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ..\mupen64plus-core build_script: - msbuild projects\msvc\mupen64plus-ui-console.vcxproj /p:Configuration=%configuration%;Platform=%platform% after_build: - ps: $env:rev1 = git describe --tags - set rev2=%platform% - if "%rev2%"=="Win32" set rev2=x86 - set filepkg=mupen64plus-ui-console_v%rev1%_%rev2% - md tdata - cd tdata - copy ..\projects\msvc\%platform%\%configuration%\*.exe . - copy ..\..\mupen64plus-core\data\* . - copy ..\..\mupen64plus-win32-deps\freetype-2.13.0\lib\%rev2%\*.dll . - copy ..\..\mupen64plus-win32-deps\libpng-1.6.39\lib\%rev2%\*.dll . - copy ..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\%rev2%\*.dll . - copy ..\..\mupen64plus-win32-deps\SDL2_net-2.2.0\lib\%rev2%\*.dll . - copy ..\..\mupen64plus-win32-deps\zlib-1.2.13\lib\%rev2%\*.dll . - 7z a -t7z ..\build\%filepkg%.7z * artifacts: - path: build\$(filepkg).7z name: $(filepkg) mupen64plus-ui-console-src-2.6.0/data/000077500000000000000000000000001464507127400175045ustar00rootroot00000000000000mupen64plus-ui-console-src-2.6.0/data/icons/000077500000000000000000000000001464507127400206175ustar00rootroot00000000000000mupen64plus-ui-console-src-2.6.0/data/icons/48x48/000077500000000000000000000000001464507127400214165ustar00rootroot00000000000000mupen64plus-ui-console-src-2.6.0/data/icons/48x48/apps/000077500000000000000000000000001464507127400223615ustar00rootroot00000000000000mupen64plus-ui-console-src-2.6.0/data/icons/48x48/apps/mupen64plus.png000066400000000000000000000062611464507127400252760ustar00rootroot00000000000000‰PNG  IHDR00Wù‡ pHYs × ×B(›xtIMEÞ)P°3z PIDAThÞí™{pTu–Ç?éÛytÚ¤Ix*`”†—€Jq…€X€X¥ìªc"ƒÉꃈ ¥‰ÆFIXEyŒ¡x,øà%n 2ƒ!IwÒéîܾÝ}ïÝ?6iÓÎKÝZ·jNÕ©tÝ×ïû=ç{ÎùÝø§uhAÀ@÷ÿ ¸Xs5''GIII1›€Èÿ­(ýR ,MHHxá•W^¹OQNœ8A||XW®^]ËåÂl6cµZ f^V+Úzè!†ŽÍfÃn·£ÑhˆêÕ‹ÆFê²²¨Õé¸!Ú·ø˜ ˆf3å“'S5n}­V† BLL ¡¡¡444`6›¹UYI­ÅÂ;>ÊèØXL&i©©4ìÞF’Zô)´xÅòå,LOÇd2¶+´Z¾¿y³ÙŒÉdB«ÕÃ}C†pÁ€´`?$$Ðxò$JE¬ D@d ¹¼œò”ú­]Ë3gbihð‘@UUêõ¬œ:•ì°0ž7ŽÒ©S½ ÛnÞ$¦¶–¸ØX>xùe”¼<Ê—.ÅTSƒÃáð‘aHYµ<‚«‡Ü‚©G”677æä ;³$ù°Z­ôðA"žx‚ܱì܉F–€^qq8{õâ®§Ÿ¦qÏ >7—m;wR1mAÛ¶qâÔ)"##½òE‘pYFZ¹Ò»v ´×´DN\V+®/¾À5z4&“ɇÀC‡˜·f ¦Ù³‘€ÈÑ£ ]µŠseelZµŠ¤¤$¦ž8vÇš6n¤49Ä œ(/§ººÚ'ú¢(2ÂíÆrøp;ðÝ&@ËM‚ßߦիrà_·a[/5ŠÄ”"ßz‹ EáðÉ“ˆ¢ˆÑhÄn·³÷Ð!FM˜@âܹ°n53f°çÃÛE¤Ñˆ¸n];ð=–Ü& ­$\¨§OFII‰oΜáñ>àv¯^¸¯]Ãh4¶_(8^ÏÀ×_§¦¸¸]ô].1ªÊí£GÛÉç'üÈØV®äñ}û8täˆüÄ1cÈŒŠBHN&JQHÍÍÅžNƒÓ‰£¹™úFDvñ"iiP[ËýS¦ðÇ9sX‘ŸïþÜ'ŸÄ™›0úÐtÖ…üæv8О>Í݃a2™HIH`¡ÑHï÷ÞCP´Ë—£3ðùçŒ2„{,úŽCÄôéP[‹„>ÌäÓ§Y‘‘ÉdÂb±§×#ž9|«÷(mk 4.Ï•+€}Ý:þ°k²ÝÎÛ£F¡ËÉÁ£( ª„´îM<„ÌL¤{ï%bÊ”võ%Á……LWUÂ^{ !<÷ªU?f~à@d§ÙbñS{’ÿ(ÜäªN‡ xBŽ'') ù7<dUí4JþÎûüƒìãûôAüúkïšóóÑ%%ý´.¤ú-"ŠÃaÞ<š6løŸ÷ç?£BÚzÛ‚ïè-)¾]Gâj)\IL$Úh¤º›]¨[5à¸u‹»† #("¢C¶~]E¿£“¾YY8îv hºŠT«þšóó°`A@Àþ@ÔNžèžVKIA(*Bv»~Rü˜‹%%D ˆÙ¾?÷î~Û¶Óí$;e̘€Ñ0o Œ@ÊJO3 øeÀÔæçsWf¦Р~ýˆB˜0EÐ?÷ý331}ü1žꋞì…ü·­<@Ù;ïO¿;è=`ùû÷‹¹ï¿_º#;;1!@GòÏf³(’ö»ß]~nÆŒ~ï­^ÝO­¯Güì3¾LOçïR¹ï$4ΔäD”Fpåä7Lüæ\Ïà×FÛðöË—©ùþ{ž™>ý ü °Vñ®é@ ªªmß»wáö½{—Ο5kÁ³×¯ßQ®ªüÛòù„N¼Ô‚ „ B‰/X@Ù“~I¦«,¸ýH´hrp¾íõþÅ/w¬å:àuFãö´Þ«(8¨óº½߀5l ÄãçtÑ*•$P1ª]ôù«·+ ùGÕŸ@p7&x­ðà‰¢ââРº:nqmNº]2’¤¢ªüPUQÁõàà;€L`PÓŽ€$I¦J­–ao¿Me^Ífs» ôš8ÝìÙ|¸¿(él`­81í³7×,I¥?Ã÷¹3Š—Œ$ÉHN.If\âoÈøj'ªª2YÁ ‹È[òÒŸ.**ߎ€¢(Y/.]úAƒ=·dÁ‚±qQQBå† DÔ¬Y(S§²¹°°qËœ9ŸÉ²¼øGg[µƒ™08f°^¹ÿ2V®z#^%ÉHV.Éã%Q ý W°Œ$y\2‰¡0`À€ˆ¢¢¢€’¿TVVþeavö¿ÆE¯¾øâ¢£…]¡¡Κõw—Ëõð}wv›j7’Û'â?—$.g pIÆÕrLÔzº]{ËÊÊö-X¶ìy–-ä7ºª!@:" 6»irHÝ.9e\’§¾ûZq}Úâ]šÿ»4môT… §Aì… É.ˆ"6[­ð;4½Ñª‚ƒd¤ &²Gzd>ï]dàü¹ï®ÇïŠíƒz7ª **“y8ò?*_÷FÜ-Éü>ù þóø±&Z®q4ªêµk×J~qþ`5t¡V»téÊ”%YËÛ>bü–½›¾l²ÿ()—SæÂÅ òŠ?¼q?PÞãAÖ»|ìÂ{ðÆ''ûÈ¥õ·CðÚµ\t8 2`PTlMMV‰&«[“„¢¨?}õÀŽmܱcÂ_÷ïÿ}ƳÏN{jîܨЂT@ˆ¥yÑ"ΘL®w׬9Q]]½ØP‚²B“Õé-b—KAý9“¸‡vÎétÎܰeËÐOþö·7ÿ}öìÇ_îÝÛpjölwvnî©ŠŠŠ5ÀáÎJ(XÊS±/ Ë*²GA‘Ud§¢v¶£þ%ÿSïo ÀàLËèïÊB ÃN§o{ÐápÔÙl¶Œ®wEÿ´ÿûoß%nr¤ÚIEND®B`‚mupen64plus-ui-console-src-2.6.0/data/icons/scalable/000077500000000000000000000000001464507127400223655ustar00rootroot00000000000000mupen64plus-ui-console-src-2.6.0/data/icons/scalable/apps/000077500000000000000000000000001464507127400233305ustar00rootroot00000000000000mupen64plus-ui-console-src-2.6.0/data/icons/scalable/apps/mupen64plus.svg000066400000000000000000001475421464507127400262700ustar00rootroot00000000000000 image/svg+xml Mupen64plus Program Icon August 17, 2008 Tillin9 Copyright (C) Tillin9 GPL (v2 or later) This icon is original work created by Tillin9 for Mupen64plus. This icon 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. You may also copy it under the Creative Common Attribution-ShareAlike 3.0 license, as found here: http://creativecommons.org/licenses/by-sa/3.0/ It is the author's desire that SVG / vector format copies be GPLed and rasterizations licensed under Creative Commons. This is because there are no clear guidelines to applying the GPL to artwork, whereas vector data consitutes source. mupen64plus-ui-console-src-2.6.0/data/mupen64plus.desktop000066400000000000000000000005011464507127400232750ustar00rootroot00000000000000[Desktop Entry] Version=1.0 Type=Application Name=Mupen64Plus GenericName=N64 Emulator Comment=Nintendo 64 emulator and plugins for Linux, Mac OSX, FreeBSD, and Windows Exec=mupen64plus %f Icon=mupen64plus MimeType=application/x-n64-rom; Categories=Game;Emulator; Keywords=Emulator;Nintendo64;Mupen64plus; NoDisplay=true mupen64plus-ui-console-src-2.6.0/doc/000077500000000000000000000000001464507127400173405ustar00rootroot00000000000000mupen64plus-ui-console-src-2.6.0/doc/mupen64plus.6000066400000000000000000000143241464507127400216350ustar00rootroot00000000000000.Dd September 20, 2013 .Dt MUPEN64PLUS 6 .Os .Sh NAME .Nm mupen64plus .Nd console front\(hyend for the Mupen64Plus N64 emulator .Sh SYNOPSIS .Nm .Op parameters .Ar romfile .Sh DESCRIPTION .Nm is a plugin\(hybased N64 emulator for Linux/Unix, OSX, and Windows which is capable of accurately playing many games. Included are four MIPS R4300 CPU emulators, with dynamic recompilers for 32\(hybit x86 and 64\(hybit amd64 systems, and necessary plugins for audio, graphical rendering (RDP), signal co\(hyprocessor (RSP), and input. There are several OpenGL video plugins available: .Bl -bullet .It Rice, included with the distribution .It Glide64Mk2, included with the distribution .It .Lk https://github.com/mupen64plus/mupen64plus-video-arachnoid Arachnoid .It .Lk https://github.com/mupen64plus/mupen64plus-video-glide64 Glide64 (old) .It .Lk https://github.com/mupen64plus/mupen64plus-video-z64 Z64 (must be used with the rsp-z64 plugin) .El .Pp The most current documentation can be found at the project\(cqs .Lk https://mupen64plus.org/ homepage . .Pp The options are as follows: .Bl -tag -width x .It Fl h , Fl Fl help Print help message. .It Fl Fl noosd Disable onscreen display. .It Fl Fl osd Enable onscreen display. .It Fl Fl fullscreen Run emulator in fullscreen display mode. .It Fl Fl windowed Run emulator in windowed display mode. .It Fl Fl resolution Ar res Display resolution (640\(mu480, 800\(mu600, 1024\(mu768, etc) .It Fl Fl nospeedlimit Disable core speed limiter. This should be used with the dummy audio plugin. .It Fl Fl cheats Ar cheat\(hyspec Enable or list cheat codes for the given rom file. .It Fl Fl corelib Ar filepath Specifies a filename (optionally with a preceding directory path) to load a specific .Nm core library. .It Fl Fl configdir Ar directory Specifies a directory to look for the .Pa mupen64plus.cfg file. Default is .Pa ~/.config/mupen64plus/ . .It Fl Fl datadir Ar directory Specifies a directory to search for shared data files (fonts, cheat codes, .ini files). Default is .Pa ${PREFIX}/share/mupen64plus/ . .It Fl Fl plugindir Ar directory Specifies a directory to search for plugin files. Default is .Pa ${PREFIX}/lib/mupen64plus/ . .It Fl Fl sshotdir Ar directory Specifies a directory to save screenshots captured during gameplay. Default is .Pa ~/.local/share/mupen64plus/screenshot/ . .It Fl Fl gfx Ar plugin\(hyspec Specifies a .Ar plugin\(hyspec to select a graphics plugin for use during emulation. .It Fl Fl audio Ar plugin\(hyspec Specifies a .Ar plugin\(hyspec to select an audio plugin for use during emulation. .It Fl Fl input Ar plugin\(hyspec Specifies a .Ar plugin\(hyspec to select an input plugin for use during emulation. .It Fl Fl rsp Ar plugin\(hyspec Specifies a .Ar plugin\(hyspec to select an RSP plugin for use during emulation. .It Fl Fl emumode Ar mode Specifies which mode the emulator core should run in. .Ar mode should be set to one of the following numbers: .Bl -inset .It 0 Pure Interpreter .It 1 Cached Interpreter .It 2 Dynamic Recompiler (DynaRec) .El .It Fl Fl testshots Ar list Take screenshots at frames given in the comma\(hyseparated .Ar list , then quit. .It Fl Fl core-compare-send Use the core comparison debugging feature, in data sending mode. If the core was not compiled with support for the Core Comparison feature, then the emulator will exit with an error. .It Fl Fl core-compare-recv Use the core comparison debugging feature, in data receiving mode. If the core was not compiled with support for the Core Comparison feature, then the emulator will exit with an error. .It Fl Fl set Ar param\(hyspec Set the value of a .Nm configuration parameter. This option may be used multiple times. The format of .Ar param\(hyspec is .Dl Section\(hyName[Param\(hyName]=Value .It Fl Fl nosaveoptions Do not save the given command\(hyline options into the .Nm configuration file to use as defaults in the future. .It Fl Fl verbose Print lots of information. Useful for debugging but unnecessary for normal use. .El .Sh plugin\(hyspec .Bl -ohang .It (plugin\(hyname) Filename (without path) of plugin to use. Application will search through several directories to look for a matching plugin name. .It (plugin\(hypath) Full directory path and filename of plugin. .It Sq dummy Use the dummy plugin. .El .Sh cheat\(hyspec .Bl -ohang .It Sq list Show all of the available cheat codes. .It Sq all Enable all of the available cheat codes. .It (codelist) A comma separated list of cheat code numbers to enable. .El .Sh KEY COMMANDS The following shortcut keys can be used during emulation. These are the default key values; nearly all of them may be set to different keys by editing the .Nm configuration file. .Bl -tag -width Alt\(hyEnter .It Escape Quit the emulator. .It 0\(en9 Select virtual .Sq slot for save/load state. .It F5 Save emulator state to current slot. .It F7 Load emulator state from current slot. .It F9 Reset emulator. .It F10 Slow down emulator speed by 5 percent. .It F11 Speed up emulator speed by 5 percent. .It F12 Take screenshot. .It Alt\(hyEnter Toggle fullscreen mode. This is not supported on Windows. .It p or P Pause/continue emulation. .It m or M Mute/unmute sound. .It f or F Fast Forward (playback at 250% normal speed as long as key is pressed). .It g or G Press GameShark button (if cheats are enabled). .It / or \&? Advance one frame if paused. .It \(lB Decrease volume. .It \(rB Increase volume. .El .Sh FILES The default location for the .Nm configuration file is .Pa ~/.config/mupen64plus/ . The default location of the saved screenshots is .Pa ~/.local/share/mupen64plus/screenshot/ . The default location of the save states is .Pa ~/.local/share/mupen64plus/save/ . .Sh AUTHORS .An -nosplit .Nm was originally started by .An Richard42 and .An nmn , and is based on Mupen64 (originally written by .An Hacktarux ) . .Pp This man page was written by .An ebenblues , and updated by .An Richard42 and .An Anthony J. Bentley . .Sh COPYRIGHT Mupen64plus is \(co 2008\(en2013 The Mupen64plus Team .Pp License GPLv2+, .Lk https://gnu.org/licenses/gpl.html GNU GPL version 2 or later .Pp This is free software: you are free to change and redistribute it. There is .Em no warranty , to the extent permitted by law. .Sh BUGS To report bugs or make feature requests, use the .Lk https://github.com/mupen64plus/mupen64plus-core/issues "issue tracker" mupen64plus-ui-console-src-2.6.0/projects/000077500000000000000000000000001464507127400204245ustar00rootroot00000000000000mupen64plus-ui-console-src-2.6.0/projects/msvc/000077500000000000000000000000001464507127400213745ustar00rootroot00000000000000mupen64plus-ui-console-src-2.6.0/projects/msvc/mupen64plus-ui-console.sln000066400000000000000000000161151464507127400263730ustar00rootroot00000000000000Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.28307.852 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-ui-console", "mupen64plus-ui-console.vcxproj", "{0E29D9F8-C675-4D21-AF16-AA80EDDB264E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-core", "..\..\..\mupen64plus-core\projects\msvc\mupen64plus-core.vcxproj", "{92D3FEB9-2129-41C5-8577-BCD7D961EF41}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-input-sdl", "..\..\..\mupen64plus-input-sdl\projects\msvc\mupen64plus-input-sdl.vcxproj", "{7F3178D0-0E2E-471B-9160-69F0354F9DE9}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-rsp-hle", "..\..\..\mupen64plus-rsp-hle\projects\msvc\mupen64plus-rsp-hle.vcxproj", "{2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-rsp-cxd4", "..\..\..\mupen64plus-rsp-cxd4\projects\msvc\mupen64plus-rsp-cxd4.vcxproj", "{F597CC21-12F9-459F-A257-38BD7F102BC8}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-video-rice", "..\..\..\mupen64plus-video-rice\projects\msvc\mupen64plus-video-rice.vcxproj", "{7D4AFF6A-B7D9-4C25-975A-038B8079098E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-audio-sdl", "..\..\..\mupen64plus-audio-sdl\projects\msvc\mupen64plus-audio-sdl.vcxproj", "{96969748-EA54-43FC-8103-A346E9AD98E7}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-video-glide64mk2", "..\..\..\mupen64plus-video-glide64mk2\projects\msvc\mupen64plus-video-glide64mk2.vcxproj", "{A4D13408-A794-4199-8FC7-4A9A32505005}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {0E29D9F8-C675-4D21-AF16-AA80EDDB264E}.Debug|Win32.ActiveCfg = Debug|Win32 {0E29D9F8-C675-4D21-AF16-AA80EDDB264E}.Debug|Win32.Build.0 = Debug|Win32 {0E29D9F8-C675-4D21-AF16-AA80EDDB264E}.Debug|x64.ActiveCfg = Debug|x64 {0E29D9F8-C675-4D21-AF16-AA80EDDB264E}.Debug|x64.Build.0 = Debug|x64 {0E29D9F8-C675-4D21-AF16-AA80EDDB264E}.Release|Win32.ActiveCfg = Release|Win32 {0E29D9F8-C675-4D21-AF16-AA80EDDB264E}.Release|Win32.Build.0 = Release|Win32 {0E29D9F8-C675-4D21-AF16-AA80EDDB264E}.Release|x64.ActiveCfg = Release|x64 {0E29D9F8-C675-4D21-AF16-AA80EDDB264E}.Release|x64.Build.0 = Release|x64 {92D3FEB9-2129-41C5-8577-BCD7D961EF41}.Debug|Win32.ActiveCfg = Debug|Win32 {92D3FEB9-2129-41C5-8577-BCD7D961EF41}.Debug|Win32.Build.0 = Debug|Win32 {92D3FEB9-2129-41C5-8577-BCD7D961EF41}.Debug|x64.ActiveCfg = Debug|x64 {92D3FEB9-2129-41C5-8577-BCD7D961EF41}.Debug|x64.Build.0 = Debug|x64 {92D3FEB9-2129-41C5-8577-BCD7D961EF41}.Release|Win32.ActiveCfg = Release|Win32 {92D3FEB9-2129-41C5-8577-BCD7D961EF41}.Release|Win32.Build.0 = Release|Win32 {92D3FEB9-2129-41C5-8577-BCD7D961EF41}.Release|x64.ActiveCfg = Release|x64 {92D3FEB9-2129-41C5-8577-BCD7D961EF41}.Release|x64.Build.0 = Release|x64 {7F3178D0-0E2E-471B-9160-69F0354F9DE9}.Debug|Win32.ActiveCfg = Debug|Win32 {7F3178D0-0E2E-471B-9160-69F0354F9DE9}.Debug|Win32.Build.0 = Debug|Win32 {7F3178D0-0E2E-471B-9160-69F0354F9DE9}.Debug|x64.ActiveCfg = Debug|x64 {7F3178D0-0E2E-471B-9160-69F0354F9DE9}.Debug|x64.Build.0 = Debug|x64 {7F3178D0-0E2E-471B-9160-69F0354F9DE9}.Release|Win32.ActiveCfg = Release|Win32 {7F3178D0-0E2E-471B-9160-69F0354F9DE9}.Release|Win32.Build.0 = Release|Win32 {7F3178D0-0E2E-471B-9160-69F0354F9DE9}.Release|x64.ActiveCfg = Release|x64 {7F3178D0-0E2E-471B-9160-69F0354F9DE9}.Release|x64.Build.0 = Release|x64 {2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}.Debug|Win32.ActiveCfg = Debug|Win32 {2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}.Debug|Win32.Build.0 = Debug|Win32 {2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}.Debug|x64.ActiveCfg = Debug|x64 {2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}.Debug|x64.Build.0 = Debug|x64 {2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}.Release|Win32.ActiveCfg = Release|Win32 {2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}.Release|Win32.Build.0 = Release|Win32 {2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}.Release|x64.ActiveCfg = Release|x64 {2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}.Release|x64.Build.0 = Release|x64 {F597CC21-12F9-459F-A257-38BD7F102BC8}.Debug|Win32.ActiveCfg = Debug|Win32 {F597CC21-12F9-459F-A257-38BD7F102BC8}.Debug|Win32.Build.0 = Debug|Win32 {F597CC21-12F9-459F-A257-38BD7F102BC8}.Debug|x64.ActiveCfg = Debug|x64 {F597CC21-12F9-459F-A257-38BD7F102BC8}.Debug|x64.Build.0 = Debug|x64 {F597CC21-12F9-459F-A257-38BD7F102BC8}.Release|Win32.ActiveCfg = Release|Win32 {F597CC21-12F9-459F-A257-38BD7F102BC8}.Release|Win32.Build.0 = Release|Win32 {F597CC21-12F9-459F-A257-38BD7F102BC8}.Release|x64.ActiveCfg = Release|x64 {F597CC21-12F9-459F-A257-38BD7F102BC8}.Release|x64.Build.0 = Release|x64 {7D4AFF6A-B7D9-4C25-975A-038B8079098E}.Debug|Win32.ActiveCfg = Debug|Win32 {7D4AFF6A-B7D9-4C25-975A-038B8079098E}.Debug|Win32.Build.0 = Debug|Win32 {7D4AFF6A-B7D9-4C25-975A-038B8079098E}.Debug|x64.ActiveCfg = Debug|x64 {7D4AFF6A-B7D9-4C25-975A-038B8079098E}.Debug|x64.Build.0 = Debug|x64 {7D4AFF6A-B7D9-4C25-975A-038B8079098E}.Release|Win32.ActiveCfg = Release|Win32 {7D4AFF6A-B7D9-4C25-975A-038B8079098E}.Release|Win32.Build.0 = Release|Win32 {7D4AFF6A-B7D9-4C25-975A-038B8079098E}.Release|x64.ActiveCfg = Release|x64 {7D4AFF6A-B7D9-4C25-975A-038B8079098E}.Release|x64.Build.0 = Release|x64 {96969748-EA54-43FC-8103-A346E9AD98E7}.Debug|Win32.ActiveCfg = Debug|Win32 {96969748-EA54-43FC-8103-A346E9AD98E7}.Debug|Win32.Build.0 = Debug|Win32 {96969748-EA54-43FC-8103-A346E9AD98E7}.Debug|x64.ActiveCfg = Debug|x64 {96969748-EA54-43FC-8103-A346E9AD98E7}.Debug|x64.Build.0 = Debug|x64 {96969748-EA54-43FC-8103-A346E9AD98E7}.Release|Win32.ActiveCfg = Release|Win32 {96969748-EA54-43FC-8103-A346E9AD98E7}.Release|Win32.Build.0 = Release|Win32 {96969748-EA54-43FC-8103-A346E9AD98E7}.Release|x64.ActiveCfg = Release|x64 {96969748-EA54-43FC-8103-A346E9AD98E7}.Release|x64.Build.0 = Release|x64 {A4D13408-A794-4199-8FC7-4A9A32505005}.Debug|Win32.ActiveCfg = Debug|Win32 {A4D13408-A794-4199-8FC7-4A9A32505005}.Debug|Win32.Build.0 = Debug|Win32 {A4D13408-A794-4199-8FC7-4A9A32505005}.Debug|x64.ActiveCfg = Debug|x64 {A4D13408-A794-4199-8FC7-4A9A32505005}.Debug|x64.Build.0 = Debug|x64 {A4D13408-A794-4199-8FC7-4A9A32505005}.Release|Win32.ActiveCfg = Release|Win32 {A4D13408-A794-4199-8FC7-4A9A32505005}.Release|Win32.Build.0 = Release|Win32 {A4D13408-A794-4199-8FC7-4A9A32505005}.Release|x64.ActiveCfg = Release|x64 {A4D13408-A794-4199-8FC7-4A9A32505005}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9EB69B45-A3A7-4B0F-AEAB-76677AE895FF} EndGlobalSection EndGlobal mupen64plus-ui-console-src-2.6.0/projects/msvc/mupen64plus-ui-console.vcxproj000066400000000000000000000315421464507127400272730ustar00rootroot00000000000000 Debug Win32 Debug x64 Release Win32 Release x64 {0E29D9F8-C675-4D21-AF16-AA80EDDB264E} mupen64plusuiconsole $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) $(LatestTargetPlatformVersion) $(WindowsTargetPlatformVersion) $(DefaultPlatformToolset) Application MultiByte true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ Application MultiByte true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ Application MultiByte $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ Application MultiByte $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ Disabled ..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL Level3 ..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x86\SDL2main.lib;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x86\SDL2.lib;%(AdditionalDependencies) true Console Copying shared data and libraries to build directory... copy ..\..\..\mupen64plus-core\data\* "$(OutDir)" copy ..\..\..\mupen64plus-video-rice\data\* "$(OutDir)" copy ..\..\..\mupen64plus-video-glide64mk2\data\* "$(OutDir)" copy ..\..\..\mupen64plus-input-sdl\data\* "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\freetype-2.13.0\lib\x86\*.dll "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\libpng-1.6.39\lib\x86\*.dll "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x86\*.dll "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\SDL2_net-2.2.0\lib\x86\*.dll "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\zlib-1.2.13\lib\x86\*.dll "$(OutDir)" Disabled ..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL Level3 ..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x64\SDL2main.lib;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x64\SDL2.lib;%(AdditionalDependencies) true Console Copying shared data and libraries to build directory... copy ..\..\..\mupen64plus-core\data\* "$(OutDir)" copy ..\..\..\mupen64plus-video-rice\data\* "$(OutDir)" copy ..\..\..\mupen64plus-video-glide64mk2\data\* "$(OutDir)" copy ..\..\..\mupen64plus-input-sdl\data\* "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\freetype-2.13.0\lib\x64\*.dll "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\libpng-1.6.39\lib\x64\*.dll "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x64\*.dll "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\SDL2_net-2.2.0\lib\x64\*.dll "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\zlib-1.2.13\lib\x64\*.dll "$(OutDir)" ..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreadedDLL Level3 MaxSpeed true true ..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x86\SDL2main.lib;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x86\SDL2.lib;%(AdditionalDependencies) true Console true true Copying shared data and libraries to build directory... copy ..\..\..\mupen64plus-core\data\* "$(OutDir)" copy ..\..\..\mupen64plus-video-rice\data\* "$(OutDir)" copy ..\..\..\mupen64plus-video-glide64mk2\data\* "$(OutDir)" copy ..\..\..\mupen64plus-input-sdl\data\* "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\freetype-2.13.0\lib\x86\*.dll "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\libpng-1.6.39\lib\x86\*.dll "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x86\*.dll "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\SDL2_net-2.2.0\lib\x86\*.dll "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\zlib-1.2.13\lib\x86\*.dll "$(OutDir)" ..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreadedDLL Level3 MaxSpeed true true ..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x64\SDL2main.lib;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x64\SDL2.lib;%(AdditionalDependencies) true Console true true Copying shared data and libraries to build directory... copy ..\..\..\mupen64plus-core\data\* "$(OutDir)" copy ..\..\..\mupen64plus-video-rice\data\* "$(OutDir)" copy ..\..\..\mupen64plus-video-glide64mk2\data\* "$(OutDir)" copy ..\..\..\mupen64plus-input-sdl\data\* "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\freetype-2.13.0\lib\x64\*.dll "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\libpng-1.6.39\lib\x64\*.dll "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x64\*.dll "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\SDL2_net-2.2.0\lib\x64\*.dll "$(OutDir)" copy ..\..\..\mupen64plus-win32-deps\zlib-1.2.13\lib\x64\*.dll "$(OutDir)" mupen64plus-ui-console-src-2.6.0/projects/unix/000077500000000000000000000000001464507127400214075ustar00rootroot00000000000000mupen64plus-ui-console-src-2.6.0/projects/unix/Makefile000077500000000000000000000251431464507127400230570ustar00rootroot00000000000000#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # * Mupen64plus - Makefile * # * Mupen64Plus homepage: https://mupen64plus.org/ * # * Copyright (C) 2009 Richard42 * # * * # * 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. * # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ # Makefile for Mupen64plus-ui-console # detect operation system UNAME ?= $(shell uname -s) OS := NONE ifeq ("$(UNAME)","Linux") OS = LINUX endif ifeq ("$(UNAME)","linux") OS = LINUX endif ifneq ("$(filter GNU hurd,$(UNAME))","") OS = LINUX endif ifeq ("$(UNAME)","Darwin") OS = OSX endif ifeq ("$(UNAME)","FreeBSD") OS = FREEBSD endif ifeq ("$(UNAME)","OpenBSD") OS = FREEBSD endif ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","") OS = LINUX endif ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW") OS = MINGW endif ifeq ("$(OS)","NONE") $(error OS type "$(UNAME)" not supported. Please file bug report at 'https://github.com/mupen64plus/mupen64plus-core/issues') endif # detect system architecture, only if it matters for build flags HOST_CPU ?= $(shell uname -m) CPU := OTHER ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","") CPU := X86 ifeq ("$(BITS)", "32") ARCH_DETECTED := 64BITS_32 else ARCH_DETECTED := 64BITS endif endif ifneq ("$(filter pentium i%86,$(HOST_CPU))","") CPU := X86 ARCH_DETECTED := 32BITS endif SRCDIR = ../../src OBJDIR = _obj$(POSTFIX) # base CFLAGS, LDLIBS, and LDFLAGS OPTFLAGS ?= -O3 -flto WARNFLAGS ?= -Wall CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -I$(SRCDIR) ifeq ($(OS), MINGW) CFLAGS += -lpthread LDLIBS += -lpthread else ifneq ($(OS), OSX) CFLAGS += -pthread LDLIBS += -pthread endif endif # set special flags per-system ifeq ($(OS), LINUX) LDLIBS += -ldl endif ifeq ($(OS), OSX) OSX_SDK_PATH = $(shell xcrun --sdk macosx --show-sdk-path) LDLIBS += -framework CoreFoundation ifeq ($(CPU), X86) ifeq ($(ARCH_DETECTED), 64BITS) CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.9 -isysroot $(OSX_SDK_PATH) else CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.9 -isysroot $(OSX_SDK_PATH) endif endif endif # test for presence of SDL ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined) SDL_CONFIG = $(CROSS_COMPILE)sdl2-config ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),) SDL_CONFIG = $(CROSS_COMPILE)sdl-config ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),) $(error No SDL development libraries found!) else $(warning Using SDL 1.2 libraries) endif endif SDL_CFLAGS += $(shell $(SDL_CONFIG) --cflags) SDL_LDLIBS += $(shell $(SDL_CONFIG) --libs) endif CFLAGS += $(SDL_CFLAGS) LDLIBS += $(SDL_LDLIBS) ifeq ($(OS), MINGW) LDLIBS += -mconsole endif ifeq ($(BIG_ENDIAN), 1) CFLAGS += -DM64P_BIG_ENDIAN endif # tweak flags for 32-bit build on 64-bit system ifeq ($(ARCH_DETECTED), 64BITS_32) ifeq ($(OS), FREEBSD) $(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386) endif ifneq ($(OS), OSX) ifeq ($(OS), MINGW) LDFLAGS += -Wl,-m,i386pe else CFLAGS += -m32 LDFLAGS += -Wl,-m,elf_i386 endif endif endif ifeq ($(ARCH_DETECTED), 64BITS) ifeq ($(OS), MINGW) LDFLAGS += -Wl,-m,i386pep endif endif # set mupen64plus core API header path ifneq ("$(APIDIR)","") CFLAGS += "-I$(APIDIR)" else TRYDIR = ../../../mupen64plus-core/src/api ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","") CFLAGS += -I$(TRYDIR) else TRYDIR = /usr/local/include/mupen64plus ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","") CFLAGS += -I$(TRYDIR) else TRYDIR = /usr/include/mupen64plus ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","") CFLAGS += -I$(TRYDIR) else $(error Mupen64Plus API header files not found! Use makefile parameter APIDIR to force a location.) endif endif endif endif # reduced compile output when running make without V=1 ifneq ($(findstring $(MAKEFLAGS),s),s) ifndef V Q_CC = @echo ' CC '$@; Q_LD = @echo ' LD '$@; endif endif # set base program pointers and flags CC = $(CROSS_COMPILE)gcc CXX = $(CROSS_COMPILE)g++ RM ?= rm -f INSTALL ?= install MKDIR ?= mkdir -p COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c LINK.o = $(Q_LD)$(CC) $(CFLAGS) $(LDFLAGS) $(TARGET_ARCH) ifndef PIE ifeq ($(CC),$(CROSS_COMPILE)gcc) # check if PIE is the default for the compiler PIE_DEFAULT = $(shell $(CC) -v 2>&1 | grep enable-default-pie) ifeq ($(PIE_DEFAULT),) PIE = 1 endif endif endif ifdef PIE ifeq ($(PIE), 1) CFLAGS += -fPIE LDFLAGS += -pie else ifeq ($(PIE), 0) CFLAGS += -fno-PIE LDFLAGS += -no-pie else $(error Invalid PIE value.) endif endif endif # set installation options ifeq ($(PREFIX),) PREFIX := /usr/local endif ifeq ($(LIBDIR),) LIBDIR := $(PREFIX)/lib endif ifeq ($(BINDIR),) BINDIR := $(PREFIX)/bin endif ifeq ($(MANDIR),) MANDIR := $(PREFIX)/share/man endif ifeq ($(APPSDIR),) APPSDIR := $(PREFIX)/share/applications endif ifeq ($(ICONSDIR),) ICONSDIR := $(PREFIX)/share/icons/hicolor endif # set special flags for given Makefile parameters ifeq ($(PLUGINDIR),) CFLAGS += '-DPLUGINDIR="$(LIBDIR)/mupen64plus"' else CFLAGS += '-DPLUGINDIR="$(PLUGINDIR)"' endif # note: COREDIR _must_ end in a slash if you want it to work; not necessary for the others ifeq ($(COREDIR),) CFLAGS += '-DCOREDIR="$(LIBDIR)/"' else CFLAGS += '-DCOREDIR="$(COREDIR)"' endif ifneq ($(SHAREDIR),) CFLAGS += '-DSHAREDIR="$(SHAREDIR)"' endif ifeq ($(DEBUG),1) CFLAGS += -g INSTALL_STRIP_FLAG ?= else INSTALL_STRIP_FLAG ?= -s endif ifeq ("$(OS)","MINGW") EXEEXT = .exe else EXEEXT = endif # list of source files to compile SOURCE = \ $(SRCDIR)/cheat.c \ $(SRCDIR)/compare_core.c \ $(SRCDIR)/core_interface.c \ $(SRCDIR)/debugger.c \ $(SRCDIR)/main.c \ $(SRCDIR)/plugin.c ifeq ($(OS), MINGW) SOURCE += \ $(SRCDIR)/osal_dynamiclib_win32.c \ $(SRCDIR)/osal_files_win32.c else SOURCE += \ $(SRCDIR)/osal_dynamiclib_unix.c \ $(SRCDIR)/osal_files_unix.c endif # generate a list of object files build, make a temporary directory for them OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(filter %.c, $(SOURCE))) OBJDIRS = $(dir $(OBJECTS)) $(shell $(MKDIR) $(OBJDIRS)) # build targets TARGET = mupen64plus$(POSTFIX)$(EXEEXT) targets: @echo "Mupen64Plus-ui-console makefile." @echo " Targets:" @echo " all == Build Mupen64Plus console front-end application" @echo " clean == remove object files and build products" @echo " rebuild == clean and re-build all" @echo " install == Install Mupen64Plus console front-end application" @echo " uninstall == Uninstall Mupen64Plus console front-end application" @echo " Options:" @echo " COREDIR=path == default path to search for Mupen64Plus Core (must end with slash)" @echo " PLUGINDIR=path == default path to search for plugins" @echo " SHAREDIR=path == default path to search for shared data files" @echo " APIDIR=path == path to find Mupen64Plus Core headers" @echo " OPTFLAGS=flags == compiler optimization (default: -O3 -flto)" @echo " WARNFLAGS=flag == compiler warning levels (default: -Wall)" @echo " PIE=(1|0) == Force enable/disable of position independent executables" @echo " POSTFIX=name == String added to the name of the the build (default: '')" @echo " Install Options:" @echo " PREFIX=path == install/uninstall prefix (default: /usr/local)" @echo " BINDIR=path == path to install mupen64plus binary (default: PREFIX/bin)" @echo " MANDIR=path == path to install mupen64plus manual page (default: PREFIX/share/man)" @echo " APPSDIR=path == path to install desktop file (default: PREFIX/share/applications)" @echo " ICONSDIR=path == path to install icon files (default: PREFIX/share/icons/hicolor)" @echo " DESTDIR=path == path to prepend to all installation paths (only for packagers)" @echo " Debugging Options:" @echo " DEBUG=1 == add debugging symbols to application binary" @echo " V=1 == show verbose compiler output" all: $(TARGET) clean: $(RM) -r $(OBJDIR) $(TARGET) rebuild: clean all install: $(TARGET) $(INSTALL) -d "$(DESTDIR)$(BINDIR)" $(INSTALL) -m 0755 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(BINDIR)" $(INSTALL) -d "$(DESTDIR)$(MANDIR)/man6" $(INSTALL) -m 0644 $(SRCDIR)/../doc/mupen64plus.6 "$(DESTDIR)$(MANDIR)/man6" $(INSTALL) -d "$(DESTDIR)$(APPSDIR)" $(INSTALL) -m 0644 $(SRCDIR)/../data/mupen64plus.desktop "$(DESTDIR)$(APPSDIR)" $(INSTALL) -d "$(DESTDIR)$(ICONSDIR)/48x48/apps" $(INSTALL) -m 0644 $(SRCDIR)/../data/icons/48x48/apps/mupen64plus.png "$(DESTDIR)$(ICONSDIR)/48x48/apps" $(INSTALL) -d "$(DESTDIR)$(ICONSDIR)/scalable/apps" $(INSTALL) -m 0644 $(SRCDIR)/../data/icons/scalable/apps/mupen64plus.svg "$(DESTDIR)$(ICONSDIR)/scalable/apps" uninstall: $(RM) "$(DESTDIR)$(BINDIR)/$(TARGET)" "$(DESTDIR)$(MANDIR)/man6/mupen64plus.6" $(RM) "$(DESTDIR)$(APPSDIR)/mupen64plus.desktop" $(RM) "$(DESTDIR)$(ICONSDIR)/48x48/apps/mupen64plus.png" $(RM) "$(DESTDIR)$(ICONSDIR)/scalable/apps/mupen64plus.svg" # build dependency files CFLAGS += -MD -MP -include $(OBJECTS:.o=.d) # standard build rules $(OBJDIR)/%.o: $(SRCDIR)/%.c $(COMPILE.c) -o $@ $< $(TARGET): $(OBJECTS) $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ .PHONY: all clean install uninstall targets mupen64plus-ui-console-src-2.6.0/src/000077500000000000000000000000001464507127400173625ustar00rootroot00000000000000mupen64plus-ui-console-src-2.6.0/src/cheat.c000066400000000000000000000354131464507127400206200ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus - cheat.c * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009-2010 Richard Goedeken * * Copyright (C) 2010 Rhett Osborne (spinout) * * * * 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 #include #include #include "cheat.h" #include "core_interface.h" #include "m64p_types.h" #include "main.h" /* local definitions */ #define CHEAT_FILE "mupencheat.txt" typedef struct { int address; int *variables; char **variable_names; int var_to_use; int var_count; } cheat_code; typedef struct _sCheatInfo { int Number; int Count; int VariableLine; const char *Name; const char *Description; cheat_code *Codes; struct _sCheatInfo *Next; } sCheatInfo; /* local variables */ static m64p_rom_header l_RomHeader; static char *l_IniText = NULL; static char *l_CheatGameName = NULL; static sCheatInfo *l_CheatList = NULL; static int l_CheatCodesFound = 0; static int l_RomFound = 0; /********************************************************************************************************* * Static (Local) functions */ static int isSpace(char ch) { return (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n'); } /* Find cheat code */ static sCheatInfo *CheatFindCode(int Number) { sCheatInfo *pCur = l_CheatList; while (pCur != NULL) { if (pCur->Number == Number) break; pCur = pCur->Next; } return pCur; } /* Activate a code */ static void CheatActivate(sCheatInfo *pCheat) { int i; /* Get a m64p_cheat_code object */ m64p_cheat_code * code = (m64p_cheat_code*) calloc(pCheat->Count, sizeof(m64p_cheat_code)); if (code == NULL) { DebugMessage(M64MSG_WARNING, "could not allocate memory for code '%s'", pCheat->Name); return; } /* Fill in members */ for (i = 0; i < pCheat->Count; i++) { code[i].address = pCheat->Codes[i].address; code[i].value = pCheat->Codes[i].variables[pCheat->Codes[i].var_to_use]; } /* Enable cheat */ if (CoreAddCheat(pCheat->Name, code, pCheat->Count) != M64ERR_SUCCESS) { DebugMessage(M64MSG_WARNING, "CoreAddCheat() failed for cheat code %i (%s)", pCheat->Number, pCheat->Name); free(code); return; } free(code); DebugMessage(M64MSG_STATUS, "activated cheat code %i: %s", pCheat->Number, pCheat->Name); } static void CheatFreeAll(void) { if (l_IniText != NULL) free(l_IniText); l_IniText = NULL; sCheatInfo *pCur = l_CheatList; while (pCur != NULL) { sCheatInfo *pNext = pCur->Next; if (pCur->Codes != NULL) { int i; for (i=0; i < pCur->Count; i++) { if (pCur->Codes[i].variables != NULL) free(pCur->Codes[i].variables); if (pCur->Codes[i].variable_names != NULL) free(pCur->Codes[i].variable_names); } free(pCur->Codes); } free(pCur); pCur = pNext; } l_CheatList = NULL; } /* Append new code */ static sCheatInfo * NewCode(char *CheatName, int CheatNum) { /* allocate memory for a new sCheatInfo struct */ sCheatInfo *pNew = (sCheatInfo *) malloc(sizeof(sCheatInfo)); if (pNew == NULL) return NULL; /* fill in the data members */ pNew->Number = CheatNum; pNew->Count = 0; pNew->VariableLine = -1; pNew->Name = CheatName; pNew->Description = NULL; pNew->Codes = NULL; pNew->Next = NULL; l_CheatCodesFound++; /* stick it at the end of the list */ if (l_CheatList == NULL) { l_CheatList = pNew; return pNew; } sCheatInfo *pLast = l_CheatList; while (pLast->Next != NULL) pLast = pLast->Next; pLast->Next = pNew; return pNew; } static void CheatAddVariables(cheat_code * Code, char *varlist) { /* needs to be more verbose? */ Code->variables = NULL; Code->variable_names = NULL; Code->var_count = 0; while (*varlist != 0) { if ((Code->variables = (int*) realloc(Code->variables, sizeof(int) * (Code->var_count + 1))) == NULL) return; if ((Code->variable_names = (char**) realloc(Code->variable_names, sizeof(char*) * (Code->var_count + 1))) == NULL) return; if (sscanf(varlist, "%04X", &Code->variables[Code->var_count]) != 1) Code->variables[Code->var_count] = 0; if (strchr(varlist, '"') == NULL) return; Code->variable_names[Code->var_count] = strchr(varlist, '"') + 1; if ((varlist = strchr(Code->variable_names[Code->var_count], '"')) == NULL) return; *varlist++ = 0; if (*varlist == ',') varlist++; Code->var_count++; } } /********************************************************************************************************* * global functions */ static void ReadCheats(char *RomSection) { sCheatInfo *curr_code = NULL; const char *romdbpath = ConfigGetSharedDataFilepath(CHEAT_FILE); if (romdbpath == NULL) { DebugMessage(M64MSG_WARNING, "cheat code database file '%s' not found.", CHEAT_FILE); return; } /* read the INI file into a new buffer */ FILE *fPtr = NULL; fPtr = fopen(romdbpath, "rb"); if (fPtr == NULL) { DebugMessage(M64MSG_WARNING, "Couldn't open cheat code database file '%s'.", romdbpath); return; } fseek(fPtr, 0L, SEEK_END); long IniLength = ftell(fPtr); fseek(fPtr, 0L, SEEK_SET); l_IniText = (char *) malloc(IniLength + 1); if (l_IniText == NULL) { DebugMessage(M64MSG_WARNING, "Couldn't allocate %li bytes of memory to read cheat file.", IniLength); fclose(fPtr); return; } if (fread(l_IniText, 1, IniLength, fPtr) != IniLength) { DebugMessage(M64MSG_WARNING, "Couldn't read %li bytes from cheat file.", IniLength); free(l_IniText); l_IniText = NULL; fclose(fPtr); return; } fclose(fPtr); l_IniText[IniLength] = 0; /* null-terminate the text data */ /* parse lines from cheat database */ char *curline = NULL; char *nextline = l_IniText; while(nextline != NULL && *nextline != 0) { curline = nextline; /* get pointer to next line and NULL-terminate the current line */ nextline = strchr(curline, '\n'); if (nextline != NULL) { *nextline = 0; nextline++; } /* remove leading and trailing white space */ while(isSpace(*curline)) curline++; char *endptr = curline + strlen(curline) - 1; while(isSpace(*endptr)) *endptr-- = 0; /* ignore line if comment or empty */ if (*curline == '#' || strncmp(curline, "//", 2) == 0 || *curline == 0) continue; /* handle beginning of new rom section */ if (strncmp(curline, "crc ", 4) == 0) { /* if we have already found cheats for the given ROM file, then exit upon encountering a new ROM section */ if (l_RomFound && (l_CheatGameName != NULL || l_CheatList != NULL)) return; /* else see if this Rom Section matches */ if (strcmp(curline+4, RomSection) == 0) l_RomFound = 1; continue; } /* if we haven't found the specified ROM section, then continue looking */ if (!l_RomFound) continue; /* Game name */ if (strncmp(curline, "gn ", 3) == 0) { l_CheatGameName = curline+3; continue; } /* code name */ if (strncmp(curline, "cn ", 3) == 0) { curr_code = NewCode(curline + 3, l_CheatCodesFound); if (curr_code == NULL) DebugMessage(M64MSG_WARNING, "error getting new code (%s)", curline+3); continue; } /* if curr_code is NULL, don't do these checks */ if (curr_code == NULL) continue; /* code description */ if (strncmp(curline, "cd ", 3) == 0) { curr_code->Description = curline+3; continue; } /* code line */ int address; if (sscanf(curline, "%8X %*s", &address) == 1) { curr_code->Codes = (cheat_code*) realloc(curr_code->Codes, sizeof(cheat_code) * (curr_code->Count + 1)); if (strncmp(curline+9, "????", 4) == 0) { curr_code->Codes[curr_code->Count].var_count = 0; CheatAddVariables(&curr_code->Codes[curr_code->Count], curline+14); curr_code->VariableLine = curr_code->Count; } else { int var; curr_code->Codes[curr_code->Count].var_count = 1; curr_code->Codes[curr_code->Count].variables = (int*) malloc(sizeof(int)); if(curr_code->Codes[curr_code->Count].variables == NULL) { DebugMessage(M64MSG_WARNING, "couldn't allocate memory; ignoring line: '%s'", curline); continue; } if (sscanf(curline+9, "%04X", &var) != 1) var = 0; curr_code->Codes[curr_code->Count].variables[0] = var; curr_code->Codes[curr_code->Count].variable_names = NULL; } curr_code->Codes[curr_code->Count].var_to_use = 0; curr_code->Codes[curr_code->Count].address = address; curr_code->Count++; continue; } /* otherwise we don't know what this line is */ DebugMessage(M64MSG_WARNING, "unrecognized line in cheat file: '%s'", curline); } } void CheatStart(eCheatMode CheatMode, char *CheatNumList) { /* if cheat codes are disabled, then we don't have to do anything */ if (CheatMode == CHEAT_DISABLE || (CheatMode == CHEAT_LIST && strlen(CheatNumList) == 0)) { DebugMessage(M64MSG_STATUS, "Cheat codes disabled."); return; } /* get the ROM header for the currently loaded ROM image from the core */ if ((*CoreDoCommand)(M64CMD_ROM_GET_HEADER, sizeof(l_RomHeader), &l_RomHeader) != M64ERR_SUCCESS) { DebugMessage(M64MSG_WARNING, "couldn't get ROM header information from core library"); return; } /* generate section name from ROM's CRC and country code */ char RomSection[24]; sprintf(RomSection, "%08X-%08X-C:%X", sl(l_RomHeader.CRC1), sl(l_RomHeader.CRC2), l_RomHeader.Country_code & 0xff); /* parse through the cheat INI file and load up any cheat codes found for this ROM */ ReadCheats(RomSection); if (!l_RomFound || l_CheatCodesFound == 0) { DebugMessage(M64MSG_WARNING, "no cheat codes found for ROM image '%.20s'", l_RomHeader.Name); CheatFreeAll(); return; } /* handle the list command */ if (CheatMode == CHEAT_SHOW_LIST) { DebugMessage(M64MSG_INFO, "%i cheat code(s) found for ROM '%s'", l_CheatCodesFound, l_CheatGameName); sCheatInfo *pCur = l_CheatList; while (pCur != NULL) { if (pCur->Description == NULL) DebugMessage(M64MSG_INFO, " %i: %s", pCur->Number, pCur->Name); else DebugMessage(M64MSG_INFO, " %i: %s (%s)", pCur->Number, pCur->Name, pCur->Description); if(pCur->VariableLine != -1) { int i; for (i = 0; i < pCur->Codes[pCur->VariableLine].var_count; i++) DebugMessage(M64MSG_INFO, " %i: %s", i, pCur->Codes[pCur->VariableLine].variable_names[i]); } pCur = pCur->Next; } CheatFreeAll(); return; } /* handle all cheats enabled mode */ if (CheatMode == CHEAT_ALL) { sCheatInfo *pCur = l_CheatList; while (pCur != NULL) { CheatActivate(pCur); pCur = pCur->Next; } CheatFreeAll(); return; } /* handle list of cheats enabled mode */ if (CheatMode == CHEAT_LIST) { int option, number; char *cheat_next; sCheatInfo *pCheat; while(CheatNumList != NULL && *CheatNumList) { if ((cheat_next = strchr(CheatNumList, ',')) != NULL) { *cheat_next = 0; cheat_next ++; } if (strchr(CheatNumList, '-') != NULL) { sscanf(CheatNumList, "%i-%i", &number, &option); /* option */ } else { option=0; sscanf(CheatNumList, "%i", &number); } pCheat = CheatFindCode(number); if (pCheat == NULL) DebugMessage(M64MSG_WARNING, "invalid cheat code number %i", number); else { if (pCheat->VariableLine != -1 && pCheat->Count > pCheat->VariableLine && option < pCheat->Codes[pCheat->VariableLine].var_count) pCheat->Codes[pCheat->VariableLine].var_to_use = option; CheatActivate(pCheat); } CheatNumList = cheat_next; } CheatFreeAll(); return; } /* otherwise the mode is invalid */ DebugMessage(M64MSG_WARNING, "internal error; invalid CheatMode in CheatStart()"); return; } mupen64plus-ui-console-src-2.6.0/src/cheat.h000066400000000000000000000036211464507127400206210ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus - cheat.h * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009 Richard Goedeken * * * * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef CHEAT_H #define CHEAT_H #ifdef M64P_BIG_ENDIAN #define sl(mot) mot #else #define sl(mot) (((mot & 0xFF) << 24) | ((mot & 0xFF00) << 8) | ((mot & 0xFF0000) >> 8) | ((mot & 0xFF000000) >> 24)) #endif typedef enum { CHEAT_DISABLE, CHEAT_LIST, CHEAT_ALL, CHEAT_SHOW_LIST } eCheatMode; void CheatStart(eCheatMode CheatMode, char *CheatNumList); #endif // #define CHEAT_H mupen64plus-ui-console-src-2.6.0/src/compare_core.c000066400000000000000000000176001464507127400221700ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus - compare_core.h * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009 Richard Goedeken * * Copyright (C) 2002 Hacktarux * * * * 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 #include #include #include "compare_core.h" #include "core_interface.h" #include "m64p_types.h" #include "main.h" /* local variables */ static FILE *fPipe = NULL; static int comp_reg_32[32]; static long long comp_reg_64[32]; static unsigned int old_op = 0; static int l_CoreCompareMode = CORE_COMPARE_DISABLE; static long long *ptr_reg = NULL; /* pointer to the 64-bit general purpose registers in the core */ static int *ptr_cop0 = NULL; /* pointer to the 32-bit Co-processor 0 registers in the core */ static long long *ptr_fgr = NULL; /* pointer to the 64-bit floating-point registers in the core */ static int *ptr_PC = NULL; /* pointer to 32-bit R4300 Program Counter */ /* local functions */ static void stop_it(void) { static int errors = 0; (*CoreDoCommand)(M64CMD_STOP, 0, NULL); errors++; #if !defined(WIN32) #if defined(__i386__) || defined(__x86_64__) if (errors > 7) asm("int $3;"); #endif #endif } static void display_error(char *txt) { int i; printf("err: %6s addr:%x\t ", txt, *ptr_PC); if (!strcmp(txt, "PC")) { printf("My PC: %x Ref PC: %x\t ", *ptr_PC, *comp_reg_32); } else if (!strcmp(txt, "gpr")) { for (i=0; i<32; i++) { if (ptr_reg[i] != comp_reg_64[i]) printf("My: reg[%d]=%llx\t Ref: reg[%d]=%llx\t ", i, ptr_reg[i], i, comp_reg_64[i]); } } else if (!strcmp(txt, "cop0")) { for (i=0; i<32; i++) { if (ptr_cop0[i] != comp_reg_32[i]) printf("My: reg_cop0[%d]=%x\t Ref: reg_cop0[%d]=%x\t ", i, (unsigned int)ptr_cop0[i], i, (unsigned int)comp_reg_32[i]); } } else if (!strcmp(txt, "cop1")) { for (i=0; i<32; i++) { if (ptr_fgr[i] != comp_reg_64[i]) printf("My: reg[%d]=%llx\t Ref: reg[%d]=%llx\t ", i, ptr_fgr[i], i, comp_reg_64[i]); } } printf("\n"); /*for (i=0; i<32; i++) { if (reg_cop0[i] != comp_reg[i]) printf("reg_cop0[%d]=%llx != reg[%d]=%llx\n", i, reg_cop0[i], i, comp_reg[i]); }*/ stop_it(); } static void compare_core_sync_data(int length, void *value) { if (l_CoreCompareMode == CORE_COMPARE_RECV) { if (fread(value, 1, length, fPipe) != length) stop_it(); } else if (l_CoreCompareMode == CORE_COMPARE_SEND) { if (fwrite(value, 1, length, fPipe) != length) stop_it(); } } static void compare_core_check(unsigned int cur_opcode) { static int comparecnt = 0; int iFirst = 1; char errHead[128]; sprintf(errHead, "Compare #%i old_op: %x op: %x\n", comparecnt++, old_op, cur_opcode); /* get pointer to current R4300 Program Counter address */ ptr_PC = (int *) DebugGetCPUDataPtr(M64P_CPU_PC); /* this changes for every instruction */ if (l_CoreCompareMode == CORE_COMPARE_RECV) { if (fread(comp_reg_32, sizeof(int), 4, fPipe) != 4) printf("compare_core_check: fread() failed"); if (*ptr_PC != *comp_reg_32) { if (iFirst) { printf("%s", errHead); iFirst = 0; } display_error("PC"); } if (fread (comp_reg_64, sizeof(long long int), 32, fPipe) != 32) printf("compare_core_check: fread() failed"); if (memcmp(ptr_reg, comp_reg_64, 32*sizeof(long long int)) != 0) { if (iFirst) { printf("%s", errHead); iFirst = 0; } display_error("gpr"); } if (fread(comp_reg_32, sizeof(int), 32, fPipe) != 32) printf("compare_core_check: fread() failed"); if (memcmp(ptr_cop0, comp_reg_32, 32*sizeof(int)) != 0) { if (iFirst) { printf("%s", errHead); iFirst = 0; } display_error("cop0"); } if (fread(comp_reg_64, sizeof(long long int), 32, fPipe) != 32) printf("compare_core_check: fread() failed"); if (memcmp(ptr_fgr, comp_reg_64, 32*sizeof(long long int))) { if (iFirst) { printf("%s", errHead); iFirst = 0; } display_error("cop1"); } /*fread(comp_reg, 1, sizeof(int), f); if (memcmp(&rdram[0x31280/4], comp_reg, sizeof(int))) display_error("mem");*/ /*fread (comp_reg, 4, 1, f); if (memcmp(&FCR31, comp_reg, 4)) display_error();*/ old_op = cur_opcode; } else if (l_CoreCompareMode == CORE_COMPARE_SEND) { if (fwrite(ptr_PC, sizeof(int), 4, fPipe) != 4 || fwrite(ptr_reg, sizeof(long long int), 32, fPipe) != 32 || fwrite(ptr_cop0, sizeof(int), 32, fPipe) != 32 || fwrite(ptr_fgr, sizeof(long long int), 32, fPipe) != 32) printf("compare_core_check: fwrite() failed"); /*fwrite(&rdram[0x31280/4], 1, sizeof(int), f); fwrite(&FCR31, 4, 1, f);*/ } } /* global functions */ void compare_core_init(int mode) { #if defined(WIN32) DebugMessage(M64MSG_VERBOSE, "core comparison feature not supported on Windows platform."); return; #else /* set mode */ l_CoreCompareMode = mode; /* set callback functions in core */ if (DebugSetCoreCompare(compare_core_check, compare_core_sync_data) != M64ERR_SUCCESS) { l_CoreCompareMode = CORE_COMPARE_DISABLE; DebugMessage(M64MSG_WARNING, "DebugSetCoreCompare() failed, core comparison disabled."); return; } /* get pointers to emulated R4300 CPU registers */ ptr_reg = (long long *) DebugGetCPUDataPtr(M64P_CPU_REG_REG); ptr_cop0 = (int *) DebugGetCPUDataPtr(M64P_CPU_REG_COP0); ptr_fgr = (long long *) DebugGetCPUDataPtr(M64P_CPU_REG_COP1_FGR_64); /* open file handle to FIFO pipe */ if (l_CoreCompareMode == CORE_COMPARE_RECV) { mkfifo("compare_pipe", 0600); DebugMessage(M64MSG_INFO, "Core Comparison Waiting to read pipe."); fPipe = fopen("compare_pipe", "r"); } else if (l_CoreCompareMode == CORE_COMPARE_SEND) { DebugMessage(M64MSG_INFO, "Core Comparison Waiting to write pipe."); fPipe = fopen("compare_pipe", "w"); } #endif } mupen64plus-ui-console-src-2.6.0/src/compare_core.h000066400000000000000000000033531464507127400221750ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus - compare_core.h * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009 Richard Goedeken * * * * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #if !defined(COMPARE_CORE_H) #define COMPARE_CORE_H typedef enum { CORE_COMPARE_DISABLE = 0, CORE_COMPARE_SEND = 1, CORE_COMPARE_RECV = 2 } CoreCompareMode; void compare_core_init(int mode); #endif /* COMPARE_CORE_H */ mupen64plus-ui-console-src-2.6.0/src/core_interface.c000066400000000000000000000457031464507127400225070ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus-ui-console - core_interface.c * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009 Richard Goedeken * * * * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This file contains the routines for attaching to the Mupen64Plus core * library and pointers to the core functions */ #if defined(__APPLE__) #include #endif #include #include "core_interface.h" #include "m64p_common.h" #include "m64p_config.h" #include "m64p_debugger.h" #include "m64p_frontend.h" #include "m64p_types.h" #include "main.h" #include "osal_dynamiclib.h" #include "osal_preproc.h" #include "version.h" /* global data definitions */ int g_CoreCapabilities; int g_CoreAPIVersion; /* definitions of pointers to Core common functions */ ptr_CoreErrorMessage CoreErrorMessage = NULL; /* definitions of pointers to Core front-end functions */ ptr_CoreStartup CoreStartup = NULL; ptr_CoreShutdown CoreShutdown = NULL; ptr_CoreAttachPlugin CoreAttachPlugin = NULL; ptr_CoreDetachPlugin CoreDetachPlugin = NULL; ptr_CoreDoCommand CoreDoCommand = NULL; ptr_CoreOverrideVidExt CoreOverrideVidExt = NULL; ptr_CoreAddCheat CoreAddCheat = NULL; ptr_CoreCheatEnabled CoreCheatEnabled = NULL; /* definitions of pointers to Core config functions */ ptr_ConfigListSections ConfigListSections = NULL; ptr_ConfigOpenSection ConfigOpenSection = NULL; ptr_ConfigDeleteSection ConfigDeleteSection = NULL; ptr_ConfigSaveSection ConfigSaveSection = NULL; ptr_ConfigListParameters ConfigListParameters = NULL; ptr_ConfigSaveFile ConfigSaveFile = NULL; ptr_ConfigSetParameter ConfigSetParameter = NULL; ptr_ConfigGetParameter ConfigGetParameter = NULL; ptr_ConfigGetParameterType ConfigGetParameterType = NULL; ptr_ConfigGetParameterHelp ConfigGetParameterHelp = NULL; ptr_ConfigSetDefaultInt ConfigSetDefaultInt = NULL; ptr_ConfigSetDefaultFloat ConfigSetDefaultFloat = NULL; ptr_ConfigSetDefaultBool ConfigSetDefaultBool = NULL; ptr_ConfigSetDefaultString ConfigSetDefaultString = NULL; ptr_ConfigGetParamInt ConfigGetParamInt = NULL; ptr_ConfigGetParamFloat ConfigGetParamFloat = NULL; ptr_ConfigGetParamBool ConfigGetParamBool = NULL; ptr_ConfigGetParamString ConfigGetParamString = NULL; ptr_ConfigExternalOpen ConfigExternalOpen = NULL; ptr_ConfigExternalClose ConfigExternalClose = NULL; ptr_ConfigExternalGetParameter ConfigExternalGetParameter = NULL; ptr_ConfigHasUnsavedChanges ConfigHasUnsavedChanges = NULL; ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath = NULL; ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath = NULL; ptr_ConfigGetUserDataPath ConfigGetUserDataPath = NULL; ptr_ConfigGetUserCachePath ConfigGetUserCachePath = NULL; /* definitions of pointers to Core debugger functions */ ptr_DebugSetCallbacks DebugSetCallbacks = NULL; ptr_DebugSetCoreCompare DebugSetCoreCompare = NULL; ptr_DebugSetRunState DebugSetRunState = NULL; ptr_DebugGetState DebugGetState = NULL; ptr_DebugStep DebugStep = NULL; ptr_DebugDecodeOp DebugDecodeOp = NULL; ptr_DebugMemGetRecompInfo DebugMemGetRecompInfo = NULL; ptr_DebugMemGetMemInfo DebugMemGetMemInfo = NULL; ptr_DebugMemGetPointer DebugMemGetPointer = NULL; ptr_DebugMemRead64 DebugMemRead64 = NULL; ptr_DebugMemRead32 DebugMemRead32 = NULL; ptr_DebugMemRead16 DebugMemRead16 = NULL; ptr_DebugMemRead8 DebugMemRead8 = NULL; ptr_DebugMemWrite64 DebugMemWrite64 = NULL; ptr_DebugMemWrite32 DebugMemWrite32 = NULL; ptr_DebugMemWrite16 DebugMemWrite16 = NULL; ptr_DebugMemWrite8 DebugMemWrite8 = NULL; ptr_DebugGetCPUDataPtr DebugGetCPUDataPtr = NULL; ptr_DebugBreakpointLookup DebugBreakpointLookup = NULL; ptr_DebugBreakpointCommand DebugBreakpointCommand = NULL; ptr_DebugBreakpointTriggeredBy DebugBreakpointTriggeredBy = NULL; ptr_DebugVirtualToPhysical DebugVirtualToPhysical = NULL; /* global variables */ m64p_dynlib_handle CoreHandle = NULL; /* functions */ m64p_error AttachCoreLib(const char *CoreLibFilepath) { /* check if Core DLL is already attached */ if (CoreHandle != NULL) return M64ERR_INVALID_STATE; /* load the DLL */ m64p_error rval = M64ERR_INTERNAL; /* first, try a library path+name that was given on the command-line */ if (CoreLibFilepath != NULL) { rval = osal_dynlib_open(&CoreHandle, CoreLibFilepath); } /* then try a library path that was given at compile time */ #if defined(COREDIR) if (rval != M64ERR_SUCCESS || CoreHandle == NULL) { rval = osal_dynlib_open(&CoreHandle, COREDIR OSAL_DEFAULT_DYNLIB_FILENAME); } #endif /* for MacOS, look for the library in the Frameworks folder of the app bundle */ #if defined(__APPLE__) CFBundleRef mainBundle = CFBundleGetMainBundle(); if (mainBundle != NULL) { CFURLRef frameworksURL = CFBundleCopyPrivateFrameworksURL(mainBundle); if (frameworksURL != NULL) { char libPath[1024 + 32]; if (CFURLGetFileSystemRepresentation(frameworksURL, TRUE, (uint8_t *) libPath, 1024)) { strcat(libPath, "/" OSAL_DEFAULT_DYNLIB_FILENAME); rval = osal_dynlib_open(&CoreHandle, libPath); } CFRelease(frameworksURL); } } #endif /* then try just the filename of the shared library, to let dlopen() look through the system lib dirs */ if (rval != M64ERR_SUCCESS || CoreHandle == NULL) { rval = osal_dynlib_open(&CoreHandle, OSAL_DEFAULT_DYNLIB_FILENAME); } /* as a last-ditch effort, try loading library in current directory */ if (rval != M64ERR_SUCCESS || CoreHandle == NULL) { rval = osal_dynlib_open(&CoreHandle, OSAL_CURRENT_DIR OSAL_DEFAULT_DYNLIB_FILENAME); } /* if we haven't found a good core library by now, then we're screwed */ if (rval != M64ERR_SUCCESS || CoreHandle == NULL) { DebugMessage(M64MSG_ERROR, "AttachCoreLib() Error: failed to find Mupen64Plus Core library"); CoreHandle = NULL; return M64ERR_INPUT_NOT_FOUND; } /* attach and call the PluginGetVersion function, check the Core and API versions for compatibility with this front-end */ ptr_PluginGetVersion CoreVersionFunc; CoreVersionFunc = (ptr_PluginGetVersion) osal_dynlib_getproc(CoreHandle, "PluginGetVersion"); if (CoreVersionFunc == NULL) { DebugMessage(M64MSG_ERROR, "AttachCoreLib() Error: Shared library '%s' invalid; no PluginGetVersion() function found.", CoreLibFilepath); osal_dynlib_close(CoreHandle); CoreHandle = NULL; return M64ERR_INPUT_INVALID; } m64p_plugin_type PluginType = (m64p_plugin_type) 0; int Compatible = 0; int CoreVersion = 0; const char *CoreName = NULL; (*CoreVersionFunc)(&PluginType, &CoreVersion, &g_CoreAPIVersion, &CoreName, &g_CoreCapabilities); if (PluginType != M64PLUGIN_CORE) DebugMessage(M64MSG_ERROR, "AttachCoreLib() Error: Shared library '%s' invalid; this is not the emulator core.", CoreLibFilepath); else if (CoreVersion < MINIMUM_CORE_VERSION) DebugMessage(M64MSG_ERROR, "AttachCoreLib() Error: Shared library '%s' incompatible; core version %i.%i.%i is below minimum supported %i.%i.%i", CoreLibFilepath, VERSION_PRINTF_SPLIT(CoreVersion), VERSION_PRINTF_SPLIT(MINIMUM_CORE_VERSION)); else if ((g_CoreAPIVersion & 0xffff0000) != (CORE_API_VERSION & 0xffff0000)) DebugMessage(M64MSG_ERROR, "AttachCoreLib() Error: Shared library '%s' incompatible; core API major version %i.%i.%i doesn't match with this application (%i.%i.%i)", CoreLibFilepath, VERSION_PRINTF_SPLIT(g_CoreAPIVersion), VERSION_PRINTF_SPLIT(CORE_API_VERSION)); else Compatible = 1; /* exit if not compatible */ if (Compatible == 0) { osal_dynlib_close(CoreHandle); CoreHandle = NULL; return M64ERR_INCOMPATIBLE; } /* attach and call the CoreGetAPIVersion function, check Config API version for compatibility */ ptr_CoreGetAPIVersions CoreAPIVersionFunc; CoreAPIVersionFunc = (ptr_CoreGetAPIVersions) osal_dynlib_getproc(CoreHandle, "CoreGetAPIVersions"); if (CoreAPIVersionFunc == NULL) { DebugMessage(M64MSG_ERROR, "AttachCoreLib() Error: Library '%s' broken; no CoreAPIVersionFunc() function found.", CoreLibFilepath); osal_dynlib_close(CoreHandle); CoreHandle = NULL; return M64ERR_INPUT_INVALID; } int ConfigAPIVersion, DebugAPIVersion, VidextAPIVersion; (*CoreAPIVersionFunc)(&ConfigAPIVersion, &DebugAPIVersion, &VidextAPIVersion, NULL); if ((ConfigAPIVersion & 0xffff0000) != (CONFIG_API_VERSION & 0xffff0000) || ConfigAPIVersion < CONFIG_API_VERSION) { DebugMessage(M64MSG_ERROR, "AttachCoreLib() Error: Emulator core '%s' incompatible; Config API version %i.%i.%i doesn't match application: %i.%i.%i", CoreLibFilepath, VERSION_PRINTF_SPLIT(ConfigAPIVersion), VERSION_PRINTF_SPLIT(CONFIG_API_VERSION)); osal_dynlib_close(CoreHandle); CoreHandle = NULL; return M64ERR_INCOMPATIBLE; } /* print some information about the core library */ DebugMessage(M64MSG_INFO, "attached to core library '%s' version %i.%i.%i", CoreName, VERSION_PRINTF_SPLIT(CoreVersion)); if (g_CoreCapabilities & M64CAPS_DYNAREC) DebugMessage(M64MSG_INFO, " Includes support for Dynamic Recompiler."); if (g_CoreCapabilities & M64CAPS_DEBUGGER) DebugMessage(M64MSG_INFO, " Includes support for MIPS r4300 Debugger."); if (g_CoreCapabilities & M64CAPS_CORE_COMPARE) DebugMessage(M64MSG_INFO, " Includes support for r4300 Core Comparison."); /* get function pointers to the common and front-end functions */ CoreErrorMessage = (ptr_CoreErrorMessage) osal_dynlib_getproc(CoreHandle, "CoreErrorMessage"); CoreStartup = (ptr_CoreStartup) osal_dynlib_getproc(CoreHandle, "CoreStartup"); CoreShutdown = (ptr_CoreShutdown) osal_dynlib_getproc(CoreHandle, "CoreShutdown"); CoreAttachPlugin = (ptr_CoreAttachPlugin) osal_dynlib_getproc(CoreHandle, "CoreAttachPlugin"); CoreDetachPlugin = (ptr_CoreDetachPlugin) osal_dynlib_getproc(CoreHandle, "CoreDetachPlugin"); CoreDoCommand = (ptr_CoreDoCommand) osal_dynlib_getproc(CoreHandle, "CoreDoCommand"); CoreOverrideVidExt = (ptr_CoreOverrideVidExt) osal_dynlib_getproc(CoreHandle, "CoreOverrideVidExt"); CoreAddCheat = (ptr_CoreAddCheat) osal_dynlib_getproc(CoreHandle, "CoreAddCheat"); CoreCheatEnabled = (ptr_CoreCheatEnabled) osal_dynlib_getproc(CoreHandle, "CoreCheatEnabled"); /* get function pointers to the configuration functions */ ConfigListSections = (ptr_ConfigListSections) osal_dynlib_getproc(CoreHandle, "ConfigListSections"); ConfigOpenSection = (ptr_ConfigOpenSection) osal_dynlib_getproc(CoreHandle, "ConfigOpenSection"); ConfigDeleteSection = (ptr_ConfigDeleteSection) osal_dynlib_getproc(CoreHandle, "ConfigDeleteSection"); ConfigSaveSection = (ptr_ConfigSaveSection) osal_dynlib_getproc(CoreHandle, "ConfigSaveSection"); ConfigListParameters = (ptr_ConfigListParameters) osal_dynlib_getproc(CoreHandle, "ConfigListParameters"); ConfigSaveFile = (ptr_ConfigSaveFile) osal_dynlib_getproc(CoreHandle, "ConfigSaveFile"); ConfigSetParameter = (ptr_ConfigSetParameter) osal_dynlib_getproc(CoreHandle, "ConfigSetParameter"); ConfigGetParameter = (ptr_ConfigGetParameter) osal_dynlib_getproc(CoreHandle, "ConfigGetParameter"); ConfigGetParameterType = (ptr_ConfigGetParameterType) osal_dynlib_getproc(CoreHandle, "ConfigGetParameterType"); ConfigGetParameterHelp = (ptr_ConfigGetParameterHelp) osal_dynlib_getproc(CoreHandle, "ConfigGetParameterHelp"); ConfigSetDefaultInt = (ptr_ConfigSetDefaultInt) osal_dynlib_getproc(CoreHandle, "ConfigSetDefaultInt"); ConfigSetDefaultFloat = (ptr_ConfigSetDefaultFloat) osal_dynlib_getproc(CoreHandle, "ConfigSetDefaultFloat"); ConfigSetDefaultBool = (ptr_ConfigSetDefaultBool) osal_dynlib_getproc(CoreHandle, "ConfigSetDefaultBool"); ConfigSetDefaultString = (ptr_ConfigSetDefaultString) osal_dynlib_getproc(CoreHandle, "ConfigSetDefaultString"); ConfigGetParamInt = (ptr_ConfigGetParamInt) osal_dynlib_getproc(CoreHandle, "ConfigGetParamInt"); ConfigGetParamFloat = (ptr_ConfigGetParamFloat) osal_dynlib_getproc(CoreHandle, "ConfigGetParamFloat"); ConfigGetParamBool = (ptr_ConfigGetParamBool) osal_dynlib_getproc(CoreHandle, "ConfigGetParamBool"); ConfigGetParamString = (ptr_ConfigGetParamString) osal_dynlib_getproc(CoreHandle, "ConfigGetParamString"); ConfigExternalOpen = (ptr_ConfigExternalOpen) osal_dynlib_getproc(CoreHandle, "ConfigExternalOpen"); ConfigExternalClose = (ptr_ConfigExternalClose) osal_dynlib_getproc(CoreHandle, "ConfigExternalClose"); ConfigExternalGetParameter = (ptr_ConfigExternalGetParameter) osal_dynlib_getproc(CoreHandle, "ConfigExternalGetParameter"); ConfigHasUnsavedChanges = (ptr_ConfigHasUnsavedChanges) osal_dynlib_getproc(CoreHandle, "ConfigHasUnsavedChanges"); ConfigGetSharedDataFilepath = (ptr_ConfigGetSharedDataFilepath) osal_dynlib_getproc(CoreHandle, "ConfigGetSharedDataFilepath"); ConfigGetUserConfigPath = (ptr_ConfigGetUserConfigPath) osal_dynlib_getproc(CoreHandle, "ConfigGetUserConfigPath"); ConfigGetUserDataPath = (ptr_ConfigGetUserDataPath) osal_dynlib_getproc(CoreHandle, "ConfigGetUserDataPath"); ConfigGetUserCachePath = (ptr_ConfigGetUserCachePath) osal_dynlib_getproc(CoreHandle, "ConfigGetUserCachePath"); /* get function pointers to the debugger functions */ DebugSetCallbacks = (ptr_DebugSetCallbacks) osal_dynlib_getproc(CoreHandle, "DebugSetCallbacks"); DebugSetCoreCompare = (ptr_DebugSetCoreCompare) osal_dynlib_getproc(CoreHandle, "DebugSetCoreCompare"); DebugSetRunState = (ptr_DebugSetRunState) osal_dynlib_getproc(CoreHandle, "DebugSetRunState"); DebugGetState = (ptr_DebugGetState) osal_dynlib_getproc(CoreHandle, "DebugGetState"); DebugStep = (ptr_DebugStep) osal_dynlib_getproc(CoreHandle, "DebugStep"); DebugDecodeOp = (ptr_DebugDecodeOp) osal_dynlib_getproc(CoreHandle, "DebugDecodeOp"); DebugMemGetRecompInfo = (ptr_DebugMemGetRecompInfo) osal_dynlib_getproc(CoreHandle, "DebugMemGetRecompInfo"); DebugMemGetMemInfo = (ptr_DebugMemGetMemInfo) osal_dynlib_getproc(CoreHandle, "DebugMemGetMemInfo"); DebugMemGetPointer = (ptr_DebugMemGetPointer) osal_dynlib_getproc(CoreHandle, "DebugMemGetPointer"); DebugMemRead64 = (ptr_DebugMemRead64) osal_dynlib_getproc(CoreHandle, "DebugMemRead64"); DebugMemRead32 = (ptr_DebugMemRead32) osal_dynlib_getproc(CoreHandle, "DebugMemRead32"); DebugMemRead16 = (ptr_DebugMemRead16) osal_dynlib_getproc(CoreHandle, "DebugMemRead16"); DebugMemRead8 = (ptr_DebugMemRead8) osal_dynlib_getproc(CoreHandle, "DebugMemRead8"); DebugMemWrite64 = (ptr_DebugMemWrite64) osal_dynlib_getproc(CoreHandle, "DebugMemWrite64"); DebugMemWrite32 = (ptr_DebugMemWrite32) osal_dynlib_getproc(CoreHandle, "DebugMemWrite32"); DebugMemWrite16 = (ptr_DebugMemWrite16) osal_dynlib_getproc(CoreHandle, "DebugMemWrite16"); DebugMemWrite8 = (ptr_DebugMemWrite8) osal_dynlib_getproc(CoreHandle, "DebugMemWrite8"); DebugGetCPUDataPtr = (ptr_DebugGetCPUDataPtr) osal_dynlib_getproc(CoreHandle, "DebugGetCPUDataPtr"); DebugBreakpointLookup = (ptr_DebugBreakpointLookup) osal_dynlib_getproc(CoreHandle, "DebugBreakpointLookup"); DebugBreakpointCommand = (ptr_DebugBreakpointCommand) osal_dynlib_getproc(CoreHandle, "DebugBreakpointCommand"); DebugBreakpointTriggeredBy = (ptr_DebugBreakpointTriggeredBy) osal_dynlib_getproc(CoreHandle, "DebugBreakpointTriggeredBy"); DebugVirtualToPhysical = (ptr_DebugVirtualToPhysical) osal_dynlib_getproc(CoreHandle, "DebugVirtualToPhysical"); return M64ERR_SUCCESS; } m64p_error DetachCoreLib(void) { if (CoreHandle == NULL) return M64ERR_INVALID_STATE; /* set the core function pointers to NULL */ CoreErrorMessage = NULL; CoreStartup = NULL; CoreShutdown = NULL; CoreAttachPlugin = NULL; CoreDetachPlugin = NULL; CoreDoCommand = NULL; CoreOverrideVidExt = NULL; CoreAddCheat = NULL; CoreCheatEnabled = NULL; ConfigListSections = NULL; ConfigOpenSection = NULL; ConfigDeleteSection = NULL; ConfigSaveSection = NULL; ConfigListParameters = NULL; ConfigSetParameter = NULL; ConfigGetParameter = NULL; ConfigGetParameterType = NULL; ConfigGetParameterHelp = NULL; ConfigSetDefaultInt = NULL; ConfigSetDefaultBool = NULL; ConfigSetDefaultString = NULL; ConfigGetParamInt = NULL; ConfigGetParamBool = NULL; ConfigGetParamString = NULL; ConfigExternalOpen = NULL; ConfigExternalClose = NULL; ConfigExternalGetParameter = NULL; ConfigHasUnsavedChanges = NULL; ConfigGetSharedDataFilepath = NULL; ConfigGetUserDataPath = NULL; ConfigGetUserCachePath = NULL; DebugSetCallbacks = NULL; DebugSetCoreCompare = NULL; DebugSetRunState = NULL; DebugGetState = NULL; DebugStep = NULL; DebugDecodeOp = NULL; DebugMemGetRecompInfo = NULL; DebugMemGetMemInfo = NULL; DebugMemGetPointer = NULL; DebugMemRead64 = NULL; DebugMemRead32 = NULL; DebugMemRead16 = NULL; DebugMemRead8 = NULL; DebugMemWrite64 = NULL; DebugMemWrite32 = NULL; DebugMemWrite16 = NULL; DebugMemWrite8 = NULL; DebugGetCPUDataPtr = NULL; DebugBreakpointLookup = NULL; DebugBreakpointCommand = NULL; DebugBreakpointTriggeredBy = NULL; DebugVirtualToPhysical = NULL; /* detach the shared library */ osal_dynlib_close(CoreHandle); CoreHandle = NULL; return M64ERR_SUCCESS; } mupen64plus-ui-console-src-2.6.0/src/core_interface.h000066400000000000000000000124161464507127400225070ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus-ui-console - core_interface.h * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009 Richard Goedeken * * * * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #if !defined(CORE_INTERFACE_H) #define CORE_INTERFACE_H #include "m64p_common.h" #include "m64p_config.h" #include "m64p_debugger.h" #include "m64p_frontend.h" #include "m64p_types.h" /* function declarations */ extern m64p_error AttachCoreLib(const char *CoreLibFilepath); extern m64p_error DetachCoreLib(void); /* global variables from core_interface.c */ extern int g_CoreCapabilities; extern int g_CoreAPIVersion; /* declarations of Core library handle and pointers to common functions */ extern m64p_dynlib_handle CoreHandle; extern ptr_CoreErrorMessage CoreErrorMessage; /* declarations of pointers to Core front-end functions */ extern ptr_CoreStartup CoreStartup; extern ptr_CoreShutdown CoreShutdown; extern ptr_CoreAttachPlugin CoreAttachPlugin; extern ptr_CoreDetachPlugin CoreDetachPlugin; extern ptr_CoreDoCommand CoreDoCommand; extern ptr_CoreOverrideVidExt CoreOverrideVidExt; extern ptr_CoreAddCheat CoreAddCheat; extern ptr_CoreCheatEnabled CoreCheatEnabled; /* declarations of pointers to Core config functions */ extern ptr_ConfigListSections ConfigListSections; extern ptr_ConfigOpenSection ConfigOpenSection; extern ptr_ConfigDeleteSection ConfigDeleteSection; extern ptr_ConfigSaveSection ConfigSaveSection; extern ptr_ConfigListParameters ConfigListParameters; extern ptr_ConfigSaveFile ConfigSaveFile; extern ptr_ConfigSetParameter ConfigSetParameter; extern ptr_ConfigGetParameter ConfigGetParameter; extern ptr_ConfigGetParameterType ConfigGetParameterType; extern ptr_ConfigGetParameterHelp ConfigGetParameterHelp; extern ptr_ConfigSetDefaultInt ConfigSetDefaultInt; extern ptr_ConfigSetDefaultFloat ConfigSetDefaultFloat; extern ptr_ConfigSetDefaultBool ConfigSetDefaultBool; extern ptr_ConfigSetDefaultString ConfigSetDefaultString; extern ptr_ConfigGetParamInt ConfigGetParamInt; extern ptr_ConfigGetParamFloat ConfigGetParamFloat; extern ptr_ConfigGetParamBool ConfigGetParamBool; extern ptr_ConfigGetParamString ConfigGetParamString; extern ptr_ConfigExternalOpen ConfigExternalOpen; extern ptr_ConfigExternalClose ConfigExternalClose; extern ptr_ConfigExternalGetParameter ConfigExternalGetParameter; extern ptr_ConfigHasUnsavedChanges ConfigHasUnsavedChanges; extern ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath; extern ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath; extern ptr_ConfigGetUserDataPath ConfigGetUserDataPath; extern ptr_ConfigGetUserCachePath ConfigGetUserCachePath; /* declarations of pointers to Core debugger functions */ extern ptr_DebugSetCallbacks DebugSetCallbacks; extern ptr_DebugSetCoreCompare DebugSetCoreCompare; extern ptr_DebugSetRunState DebugSetRunState; extern ptr_DebugGetState DebugGetState; extern ptr_DebugStep DebugStep; extern ptr_DebugDecodeOp DebugDecodeOp; extern ptr_DebugMemGetRecompInfo DebugMemGetRecompInfo; extern ptr_DebugMemGetMemInfo DebugMemGetMemInfo; extern ptr_DebugMemGetPointer DebugMemGetPointer; extern ptr_DebugMemRead64 DebugMemRead64; extern ptr_DebugMemRead32 DebugMemRead32; extern ptr_DebugMemRead16 DebugMemRead16; extern ptr_DebugMemRead8 DebugMemRead8; extern ptr_DebugMemWrite64 DebugMemWrite64; extern ptr_DebugMemWrite32 DebugMemWrite32; extern ptr_DebugMemWrite16 DebugMemWrite16; extern ptr_DebugMemWrite8 DebugMemWrite8; extern ptr_DebugGetCPUDataPtr DebugGetCPUDataPtr; extern ptr_DebugBreakpointLookup DebugBreakpointLookup; extern ptr_DebugBreakpointCommand DebugBreakpointCommand; extern ptr_DebugBreakpointTriggeredBy DebugBreakpointTriggeredBy; extern ptr_DebugVirtualToPhysical DebugVirtualToPhysical; #endif /* #define CORE_INTERFACE_H */ mupen64plus-ui-console-src-2.6.0/src/debugger.c000066400000000000000000000462771464507127400213320ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus-ui-console - debugger.c * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2014 Will Nayes * * * * 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 #include #include #include "core_interface.h" #include "debugger.h" #include /* * Variables */ // General Purpose Register names const char *register_names[] = { "$r0", "$at", "v0", "v1", "a0", "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "t8", "t9", "k0", "k1", "$gp", "$sp", "sB", "$ra" }; // Holds the previous GPR values for comparison details. long long int prev_reg_values[32]; char reg_ran_previously = 0; // Used to wait for core response before requesting next command. int debugger_loop_wait = 1; // Counter indicating the number of DebugStep() calls we need to make yet. static int debugger_steps_pending = 0; // Keep track of the run state. static int cur_run_state = 0; // Remember the current program counter. static unsigned int cur_pc = 0; // Keep track of breakpoints locally. static m64p_breakpoint *breakpoints; static int num_breakpoints = 0; /* * Debugger callbacks. */ void dbg_frontend_init() { breakpoints = (m64p_breakpoint *) malloc(BREAKPOINTS_MAX_NUMBER * sizeof(m64p_breakpoint)); printf("Debugger initialized.\n"); } void dbg_frontend_update(unsigned int pc) { cur_pc = pc; if (!debugger_steps_pending) { printf("\nPC at 0x%08X.\n", pc); debugger_loop_wait = 0; cur_run_state = 0; } else { --debugger_steps_pending; debugger_step(); } } void dbg_frontend_vi() { //printf("Debugger vertical int.\n"); } /* * Debugger methods. */ int debugger_setup_callbacks() { m64p_error rval = (*DebugSetCallbacks)(dbg_frontend_init, dbg_frontend_update, dbg_frontend_vi); return rval != M64ERR_SUCCESS; } int debugger_set_run_state(int state) { m64p_error rval = (*DebugSetRunState)((m64p_dbg_runstate) state); return rval != M64ERR_SUCCESS; } int debugger_step() { m64p_error rval = (*DebugStep)(); return rval != M64ERR_SUCCESS; } // Retrieve the program counter. int debugger_get_prev_pc() { return (*DebugGetState)(M64P_DBG_PREVIOUS_PC); } int64_t debugger_read_64(unsigned int addr) { return (*DebugMemRead64)(addr); } int debugger_read_32(unsigned int addr) { return (*DebugMemRead32)(addr); } int debugger_read_16(unsigned int addr) { return (*DebugMemRead16)(addr); } int debugger_read_8(unsigned int addr) { return (*DebugMemRead8)(addr); } void debugger_write_64(unsigned int addr, unsigned long long value) { (*DebugMemWrite64)(addr, value); } void debugger_write_32(unsigned int addr, unsigned int value) { (*DebugMemWrite32)(addr, value); } void debugger_write_16(unsigned int addr, unsigned short value) { (*DebugMemWrite16)(addr, value); } void debugger_write_8(unsigned int addr, unsigned char value) { (*DebugMemWrite8)(addr, value); } int debugger_print_registers() { unsigned long long int *regs = (unsigned long long int *) (*DebugGetCPUDataPtr)(M64P_CPU_REG_REG); if (regs == NULL) return -1; printf("General Purpose Registers:\n"); int i; const char *format_padded = "%4s %016llX "; const char *format_nopad = "%4s %16llX "; for (i = 0; i < 32; ++i) { char val_changed = reg_ran_previously && regs[i] != prev_reg_values[i]; // Use bold font if the value has changed since last time. if (val_changed) printf("%c[1m", 27); // Bold on // Print the register value, no padding if it is all zeroes. printf(regs[i] == 0 ? format_nopad : format_padded, register_names[i], regs[i]); // Unset bold. if (val_changed) printf("%c[0m", 27); // Bold off reg_ran_previously = 1; prev_reg_values[i] = regs[i]; // Two registers per line. if (i % 2 != 0) printf("\n"); } return 0; } typedef enum { M64P_ASM_FLAG_INDEX = 0x01, M64P_ASM_FLAG_ADDR = 0x02, M64P_ASM_FLAG_BINARY = 0x04 } disassembly_flags; /* * Debugger main loop */ int debugger_loop(void *arg) { char input[256]; while (1) { if (debugger_loop_wait) { SDL_Delay(1); continue; } printf("(dbg) "); if (fgets(input, 256, stdin) == NULL) { break; } input[strlen(input) - 1] = 0; if (strcmp(input, "run") == 0) { cur_run_state = 2; if (debugger_set_run_state(cur_run_state)) printf("Error setting run_state: run\n"); else { debugger_step(); // Hack to kick-start the emulation. } } else if (strcmp(input, "pause") == 0) { cur_run_state = 0; if (debugger_set_run_state(cur_run_state)) printf("Error setting run_state: pause\n"); } else if (strncmp(input, "step", 4) == 0) { if (cur_run_state == 2) { printf("Cannot step while running. Type `pause' first.\n"); continue; } debugger_loop_wait = 1; debugger_steps_pending = 1; sscanf(input, "step %d", &debugger_steps_pending); if (debugger_steps_pending < 1) debugger_steps_pending = 1; --debugger_steps_pending; debugger_step(); } else if (strcmp(input, "regs") == 0) { debugger_print_registers(); } else if (strcmp(input, "pc") == 0) { printf("PC: %08X\n", cur_pc); } else if (strcmp(input, "pc-1") == 0) { printf("Previous PC: %08X\n", debugger_get_prev_pc()); } else if (strncmp(input, "asm", 3) == 0) { // simple linear sweep disassembly uint32_t addr = cur_pc, size=1, flags=0; uint32_t lookupAddr, lookupData; char op[64]; char args[64]; if (sscanf(input, "asm %i %i %i", &addr, &size, &flags) == 3) { } else if (sscanf(input, "asm %i %i", &addr, &size) == 2) { } else if (sscanf(input, "asm %i", &addr) == 1) { } else if (strcmp(input, "asm") == 0) { } else { printf("Improperly formatted disassembly command: '%s'\n", input); continue; } addr &= ~0x03; // align to 4 byte boundary printf("Disassembly of %d instruction%s @ 0x%08x:\n", size, (size == 1 ? "" : "s"), addr); for (uint32_t i = 0; i < size; i++) { lookupAddr = addr + (i * 4); lookupData = debugger_read_32(lookupAddr); (*DebugDecodeOp)(lookupData, op, args, lookupAddr); if (flags & M64P_ASM_FLAG_INDEX) { // 0x01 printf("% 3d ", i); } if (flags & M64P_ASM_FLAG_ADDR) { // 0x02 printf("%08x ", lookupAddr); } if (flags & M64P_ASM_FLAG_BINARY) { // 0x04 printf("[%08x] ", lookupData); } printf("%s %s\n", op, args); } } else if (strncmp(input, "mem", 3) == 0) { uint32_t readAddr, length=1, rows=1, size=4; uint32_t i, j; char chSize; if ((sscanf(input, "mem /%ux%u%c %x", &rows, &length, &chSize, &readAddr) == 4 || sscanf(input, "mem /%ux%u%c %u", &rows, &length, &chSize, &readAddr) == 4) && (chSize == 'b' || chSize == 'h' || chSize == 'w' || chSize == 'd')) { if (chSize == 'b') size = 1; else if (chSize == 'h') size = 2; else if (chSize == 'w') size = 4; else // chSize == 'd' size = 8; } else if (sscanf(input, "mem /%ux%u %x", &rows, &length, &readAddr) == 3 || sscanf(input, "mem /%ux%u %u", &rows, &length, &readAddr) == 3) { } else if ((sscanf(input, "mem /%u%c %x", &length, &chSize, &readAddr) == 3 || sscanf(input, "mem /%u%c %u", &length, &chSize, &readAddr) == 3) && (chSize == 'b' || chSize == 'h' || chSize == 'w' || chSize == 'd')) { rows = 1; if (chSize == 'b') size = 1; else if (chSize == 'h') size = 2; else if (chSize == 'w') size = 4; else // chSize == 'd' size = 8; } else if (sscanf(input, "mem /%u %x", &length, &readAddr) == 2 || sscanf(input, "mem /%u %u", &length, &readAddr) == 2) { rows = 1; } else if (sscanf(input, "mem %x", &readAddr) == 1 || sscanf(input, "mem %u", &readAddr) == 1) { rows = 1; length = 1; } else { printf("Improperly formatted memory read command: '%s'\n", input); continue; } for (i = 0; i < rows; i++) { for (j = 0; j < length; j++) { uint32_t thisAddr = readAddr + ((i * length) + j) * size; switch(size) { case 1: printf("%02x ", debugger_read_8(thisAddr)); break; case 2: printf("%04x ", debugger_read_16(thisAddr)); break; case 4: printf("%08x ", debugger_read_32(thisAddr)); break; case 8: printf("%016llx ", (long long unsigned int) debugger_read_64(thisAddr)); break; } } printf("\n"); } } else if (strncmp(input, "translate", 9) == 0) { uint32_t virt_addr, phys_addr; if (sscanf(input, "translate %i", &virt_addr) == 1) { } else { printf("Improperly formatted translate command: '%s'\n", input); continue; } phys_addr = (*DebugVirtualToPhysical)(virt_addr); printf("virtual 0x%08x -> physical 0x%08x\n", virt_addr, phys_addr); } else if (strncmp(input, "write", 5) == 0) { uint32_t writeAddr, size=1; long long unsigned int writeVal; char chSize; if (sscanf(input, "write %i %c %llx", &writeAddr, &chSize, &writeVal) == 3 && (chSize == 'b' || chSize == 'h' || chSize == 'w' || chSize == 'd')) { if (chSize == 'b') { size = 1; } else if (chSize == 'h') { size = 2; } else if (chSize == 'w') { size = 4; } else { size = 8; } } else if (sscanf(input, "write %i %llx", &writeAddr, &writeVal) == 2) { } else { printf("Improperly formatted memory write command: '%s'\n", input); continue; } switch(size) { case 1: debugger_write_8(writeAddr, (unsigned char)writeVal); printf("0x%08x <- 0x%02x\n", writeAddr, (unsigned char)writeVal); break; case 2: debugger_write_16(writeAddr, (unsigned short)writeVal); printf("0x%08x <- 0x%04x\n", writeAddr, (unsigned short)writeVal); break; case 4: debugger_write_32(writeAddr, (unsigned int)writeVal); printf("0x%08x <- 0x%08x\n", writeAddr, (unsigned int)writeVal); break; case 8: debugger_write_64(writeAddr, writeVal); printf("0x%08x <- 0x%016llx\n", writeAddr, writeVal); break; } } else if (strcmp(input, "bp list") == 0 || strcmp(input, "bp ls") == 0) { if (num_breakpoints == 0) { printf("No breakpoints added. Add with 'bp add 0x...'\n"); continue; } printf("Breakpoints:\n"); int i; unsigned int flags; for (i = 0; i < num_breakpoints; i++) { flags = breakpoints[i].flags; if (breakpoints[i].address == breakpoints[i].endaddr) { printf("[%d] 0x%08X [%c%c%c]", i, breakpoints[i].address, flags & M64P_BKP_FLAG_READ ? 'R' : ' ', flags & M64P_BKP_FLAG_WRITE ? 'W' : ' ', flags & M64P_BKP_FLAG_EXEC ? 'X' : ' '); } else { printf("[%d] 0x%08X - 0x%08X [%c%c%c]", i, breakpoints[i].address, breakpoints[i].endaddr, flags & M64P_BKP_FLAG_READ ? 'R' : ' ', flags & M64P_BKP_FLAG_WRITE ? 'W' : ' ', flags & M64P_BKP_FLAG_EXEC ? 'X' : ' '); } if ((breakpoints[i].flags & M64P_BKP_FLAG_ENABLED) == 0) printf(" (Disabled)"); printf("\n"); } } else if (strncmp(input, "bp add ", 7) == 0) { uint32_t addr, size = 0, flags = M64P_BKP_FLAG_READ | M64P_BKP_FLAG_WRITE | M64P_BKP_FLAG_EXEC; if (strcmp(input, "bp add pc") == 0) { addr = cur_pc; } else if (sscanf(input, "bp add %i %i %i", &addr, &size, &flags) == 3) { } else if (sscanf(input, "bp add %i %i", &addr, &size) == 2) { } else if (sscanf(input, "bp add %i", &addr) == 1) { } else { printf("Improperly formatted breakpoint add command: '%s'\n", input); continue; } if (addr == 0) { printf("Invalid breakpoint address.\n"); continue; } m64p_breakpoint bkpt; bkpt.address = addr; bkpt.endaddr = addr + size; bkpt.flags = M64P_BKP_FLAG_ENABLED | flags | M64P_BKP_FLAG_LOG; int numBkps = (*DebugBreakpointCommand)(M64P_BKP_CMD_ADD_STRUCT, 0, &bkpt); if (numBkps == -1) { printf("Maximum breakpoint limit already reached.\n"); continue; } breakpoints[num_breakpoints] = bkpt; num_breakpoints++; if (size > 0) { printf("Added breakpoint at range [0x%08X to 0x%08X].\n", addr, addr + size); } else { printf("Added breakpoint at 0x%08X.\n", addr); } if (flags & (M64P_BKP_FLAG_READ | M64P_BKP_FLAG_WRITE)) { // setting a memory read/write breakpoint -- warn if physical address differs from the user input uint32_t phys_addr = (*DebugVirtualToPhysical)(addr); if (phys_addr != 0 && addr != phys_addr) { printf("Warning: Physical address %08x != virtual address %08x for memory read/write breakpoint.\n", phys_addr, addr); } } } else if (strncmp(input, "bp trig", 7) == 0) { uint32_t flags, addr; (*DebugBreakpointTriggeredBy)(&flags, &addr); if (flags != 0) { printf("Breakpoint @ PC 0x%08x triggered on 0x%08x [%c%c%c]\n", cur_pc, addr, flags & M64P_BKP_FLAG_READ ? 'R' : ' ', flags & M64P_BKP_FLAG_WRITE ? 'W' : ' ', flags & M64P_BKP_FLAG_EXEC ? 'X' : ' '); } } else if (strncmp(input, "bp rm ", 6) == 0) { int index = -1; unsigned int addr = 0; if (strncmp(input, "bp rm 0x", 8) == 0) { sscanf(input, "bp rm 0x%X", &addr); if (addr == 0) sscanf(input, "bp rm 0x%x", &addr); int i; for (i = 0; i < num_breakpoints; i++) { if (breakpoints[i].address == addr) index = i; } } else { sscanf(input, "bp rm %d", &index); if (index >= 0 && index < num_breakpoints) addr = breakpoints[index].address; } if (index == -1 || addr == 0) { printf("Invalid value passed. "); printf("Pass an address or breakpoint number.\n"); continue; } (*DebugBreakpointCommand)(M64P_BKP_CMD_REMOVE_IDX, index, NULL); num_breakpoints--; printf("Breakpoint [%d] 0x%08X removed.\n", index, addr); // Shift the array elements ahead of index down. int j; for (j = index + 1; j < num_breakpoints; j++) { breakpoints[j - 1] = breakpoints[j]; } } else if (strcmp(input, "exit") == 0 || strcmp(input, "quit") == 0) { (*CoreDoCommand)(M64CMD_STOP, 0, NULL); break; } else if (strlen(input) == 0) continue; else printf("Unrecognized: %s\n", input); } return -1; } mupen64plus-ui-console-src-2.6.0/src/debugger.h000066400000000000000000000034251464507127400213230ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus-ui-console - debugger.h * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2014 Will Nayes * * * * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef __DEBUGGER_H__ #define __DEBUGGER_H__ extern int debugger_loop_wait; typedef struct { unsigned int addr; unsigned char enabled; } breakpoint_t; int debugger_setup_callbacks(); int debugger_step(); int debugger_loop(void *arg); #endif /* __DEBUGGER_H__ */ mupen64plus-ui-console-src-2.6.0/src/main.c000066400000000000000000001214321464507127400204550ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus-ui-console - main.c * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2007-2018 Richard42 * * Copyright (C) 2008 Ebenblues Nmn Okaygo Tillin9 * * Copyright (C) 2002 Hacktarux * * * * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This is the main application entry point for the console-only front-end * for Mupen64Plus v2.0. */ #include #include #include #include #include #include #include #include "cheat.h" #include "compare_core.h" #include "core_interface.h" #include "debugger.h" #include "m64p_types.h" #include "main.h" #include "osal_preproc.h" #include "osal_files.h" #include "plugin.h" #include "version.h" #ifdef VIDEXT_HEADER #define xstr(s) str(s) #define str(s) #s #include xstr(VIDEXT_HEADER) #endif #define PIF_ROM_SIZE 2048 /* Version number for UI-Console config section parameters */ #define CONFIG_PARAM_VERSION 1.00 /** global variables **/ int g_Verbose = 0; /** static (local) variables **/ static m64p_handle l_ConfigCore = NULL; static m64p_handle l_ConfigVideo = NULL; static m64p_handle l_ConfigUI = NULL; static m64p_handle l_ConfigTransferPak = NULL; static m64p_handle l_Config64DD = NULL; static const char *l_CoreLibPath = NULL; static const char *l_ConfigDirPath = NULL; static const char *l_ROMFilepath = NULL; // filepath of ROM to load & run at startup static const char *l_SaveStatePath = NULL; // save state to load at startup #if defined(SHAREDIR) static const char *l_DataDirPath = SHAREDIR; #else static const char *l_DataDirPath = NULL; #endif static int *l_TestShotList = NULL; // list of screenshots to take for regression test support static int l_TestShotIdx = 0; // index of next screenshot frame in list static int l_SaveOptions = 1; // save command-line options in configuration file (enabled by default) static int l_CoreCompareMode = 0; // 0 = disable, 1 = send, 2 = receive static int l_LaunchDebugger = 0; static eCheatMode l_CheatMode = CHEAT_DISABLE; static char *l_CheatNumList = NULL; /********************************************************************************************************* * Callback functions from the core */ void DebugMessage(int level, const char *message, ...) { char msgbuf[1024]; va_list args; va_start(args, message); vsnprintf(msgbuf, 1024, message, args); DebugCallback("UI-Console", level, msgbuf); va_end(args); } void DebugCallback(void *Context, int level, const char *message) { #ifdef ANDROID if (level == M64MSG_ERROR) __android_log_print(ANDROID_LOG_ERROR, (const char *) Context, "%s", message); else if (level == M64MSG_WARNING) __android_log_print(ANDROID_LOG_WARN, (const char *) Context, "%s", message); else if (level == M64MSG_INFO) __android_log_print(ANDROID_LOG_INFO, (const char *) Context, "%s", message); else if (level == M64MSG_STATUS) __android_log_print(ANDROID_LOG_DEBUG, (const char *) Context, "%s", message); else if (level == M64MSG_VERBOSE) { if (g_Verbose) __android_log_print(ANDROID_LOG_VERBOSE, (const char *) Context, "%s", message); } else __android_log_print(ANDROID_LOG_ERROR, (const char *) Context, "Unknown: %s", message); #else if (level == M64MSG_ERROR) printf("%s Error: %s\n", (const char *) Context, message); else if (level == M64MSG_WARNING) printf("%s Warning: %s\n", (const char *) Context, message); else if (level == M64MSG_INFO) printf("%s: %s\n", (const char *) Context, message); else if (level == M64MSG_STATUS) printf("%s Status: %s\n", (const char *) Context, message); else if (level == M64MSG_VERBOSE) { if (g_Verbose) printf("%s: %s\n", (const char *) Context, message); } else printf("%s Unknown: %s\n", (const char *) Context, message); #endif } static void FrameCallback(unsigned int FrameIndex) { // take a screenshot if we need to if (l_TestShotList != NULL) { int nextshot = l_TestShotList[l_TestShotIdx]; if (nextshot == FrameIndex) { (*CoreDoCommand)(M64CMD_TAKE_NEXT_SCREENSHOT, 0, NULL); /* tell the core take a screenshot */ // advance list index to next screenshot frame number. If it's 0, then quit l_TestShotIdx++; } else if (nextshot == 0) { (*CoreDoCommand)(M64CMD_STOP, 0, NULL); /* tell the core to shut down ASAP */ free(l_TestShotList); l_TestShotList = NULL; } } } static char *formatstr(const char *fmt, ...) ATTR_FMT(1, 2); char *formatstr(const char *fmt, ...) { int size = 128, ret; char *str = (char *)malloc(size), *newstr; va_list args; /* There are two implementations of vsnprintf we have to deal with: * C99 version: Returns the number of characters which would have been written * if the buffer had been large enough, and -1 on failure. * Windows version: Returns the number of characters actually written, * and -1 on failure or truncation. * NOTE: An implementation equivalent to the Windows one appears in glibc <2.1. */ while (str != NULL) { va_start(args, fmt); ret = vsnprintf(str, size, fmt, args); va_end(args); // Successful result? if (ret >= 0 && ret < size) return str; // Increment the capacity of the buffer if (ret >= size) size = ret + 1; // C99 version: We got the needed buffer size else size *= 2; // Windows version: Keep guessing newstr = (char *)realloc(str, size); if (newstr == NULL) free(str); str = newstr; } return NULL; } static int is_path_separator(char c) { return strchr(OSAL_DIR_SEPARATORS, c) != NULL; } char* combinepath(const char* first, const char *second) { size_t len_first, off_second = 0; if (first == NULL || second == NULL) return NULL; len_first = strlen(first); while (is_path_separator(first[len_first-1])) len_first--; while (is_path_separator(second[off_second])) off_second++; return formatstr("%.*s%c%s", (int) len_first, first, OSAL_DIR_SEPARATORS[0], second + off_second); } /********************************************************************************************************* * Configuration handling */ static m64p_error OpenConfigurationHandles(void) { float fConfigParamsVersion; int bSaveConfig = 0; m64p_error rval; unsigned int i; /* Open Configuration sections for core library and console User Interface */ rval = (*ConfigOpenSection)("Core", &l_ConfigCore); if (rval != M64ERR_SUCCESS) { DebugMessage(M64MSG_ERROR, "failed to open 'Core' configuration section"); return rval; } rval = (*ConfigOpenSection)("Video-General", &l_ConfigVideo); if (rval != M64ERR_SUCCESS) { DebugMessage(M64MSG_ERROR, "failed to open 'Video-General' configuration section"); return rval; } rval = (*ConfigOpenSection)("Transferpak", &l_ConfigTransferPak); if (rval != M64ERR_SUCCESS) { DebugMessage(M64MSG_ERROR, "failed to open 'Transferpak' configuration section"); return rval; } rval = (*ConfigOpenSection)("64DD", &l_Config64DD); if (rval != M64ERR_SUCCESS) { DebugMessage(M64MSG_ERROR, "failed to open '64DD' configuration section"); return rval; } rval = (*ConfigOpenSection)("UI-Console", &l_ConfigUI); if (rval != M64ERR_SUCCESS) { DebugMessage(M64MSG_ERROR, "failed to open 'UI-Console' configuration section"); return rval; } if ((*ConfigGetParameter)(l_ConfigUI, "Version", M64TYPE_FLOAT, &fConfigParamsVersion, sizeof(float)) != M64ERR_SUCCESS) { DebugMessage(M64MSG_WARNING, "No version number in 'UI-Console' config section. Setting defaults."); (*ConfigDeleteSection)("UI-Console"); (*ConfigOpenSection)("UI-Console", &l_ConfigUI); bSaveConfig = 1; } else if (((int) fConfigParamsVersion) != ((int) CONFIG_PARAM_VERSION)) { DebugMessage(M64MSG_WARNING, "Incompatible version %.2f in 'UI-Console' config section: current is %.2f. Setting defaults.", fConfigParamsVersion, (float) CONFIG_PARAM_VERSION); (*ConfigDeleteSection)("UI-Console"); (*ConfigOpenSection)("UI-Console", &l_ConfigUI); bSaveConfig = 1; } else if ((CONFIG_PARAM_VERSION - fConfigParamsVersion) >= 0.0001f) { /* handle upgrades */ float fVersion = CONFIG_PARAM_VERSION; ConfigSetParameter(l_ConfigUI, "Version", M64TYPE_FLOAT, &fVersion); DebugMessage(M64MSG_INFO, "Updating parameter set version in 'UI-Console' config section to %.2f", fVersion); bSaveConfig = 1; } /* Set default values for my Config parameters */ (*ConfigSetDefaultFloat)(l_ConfigUI, "Version", CONFIG_PARAM_VERSION, "Mupen64Plus UI-Console config parameter set version number. Please don't change this version number."); (*ConfigSetDefaultString)(l_ConfigUI, "PluginDir", OSAL_CURRENT_DIR, "Directory in which to search for plugins"); (*ConfigSetDefaultString)(l_ConfigUI, "VideoPlugin", "mupen64plus-video-rice" OSAL_DLL_EXTENSION, "Filename of video plugin"); (*ConfigSetDefaultString)(l_ConfigUI, "AudioPlugin", "mupen64plus-audio-sdl" OSAL_DLL_EXTENSION, "Filename of audio plugin"); (*ConfigSetDefaultString)(l_ConfigUI, "InputPlugin", "mupen64plus-input-sdl" OSAL_DLL_EXTENSION, "Filename of input plugin"); (*ConfigSetDefaultString)(l_ConfigUI, "RspPlugin", "mupen64plus-rsp-hle" OSAL_DLL_EXTENSION, "Filename of RSP plugin"); for(i = 1; i < 5; ++i) { char key[64]; char desc[2048]; #define SET_DEFAULT_STRING(key_fmt, default_value, desc_fmt) \ do { \ snprintf(key, sizeof(key), key_fmt, i); \ snprintf(desc, sizeof(desc), desc_fmt, i); \ (*ConfigSetDefaultString)(l_ConfigTransferPak, key, default_value, desc); \ } while(0) SET_DEFAULT_STRING("GB-rom-%u", "", "Filename of the GB ROM to load into transferpak %u"); SET_DEFAULT_STRING("GB-ram-%u", "", "Filename of the GB RAM to load into transferpak %u"); #undef SET_DEFAULT_STRING } (*ConfigSetDefaultString)(l_Config64DD, "IPL-ROM", "", "Filename of the 64DD IPL ROM"); (*ConfigSetDefaultString)(l_Config64DD, "Disk", "", "Filename of the disk to load into Disk Drive"); if (bSaveConfig && l_SaveOptions && ConfigSaveSection != NULL) { /* ConfigSaveSection was added in Config API v2.1.0 */ (*ConfigSaveSection)("UI-Console"); (*ConfigSaveSection)("Transferpak"); } return M64ERR_SUCCESS; } static m64p_error SaveConfigurationOptions(void) { /* if shared data directory was given on the command line, write it into the config file */ if (l_DataDirPath != NULL) (*ConfigSetParameter)(l_ConfigCore, "SharedDataPath", M64TYPE_STRING, l_DataDirPath); /* if any plugin filepaths were given on the command line, write them into the config file */ if (g_PluginDir != NULL) (*ConfigSetParameter)(l_ConfigUI, "PluginDir", M64TYPE_STRING, g_PluginDir); if (g_GfxPlugin != NULL) (*ConfigSetParameter)(l_ConfigUI, "VideoPlugin", M64TYPE_STRING, g_GfxPlugin); if (g_AudioPlugin != NULL) (*ConfigSetParameter)(l_ConfigUI, "AudioPlugin", M64TYPE_STRING, g_AudioPlugin); if (g_InputPlugin != NULL) (*ConfigSetParameter)(l_ConfigUI, "InputPlugin", M64TYPE_STRING, g_InputPlugin); if (g_RspPlugin != NULL) (*ConfigSetParameter)(l_ConfigUI, "RspPlugin", M64TYPE_STRING, g_RspPlugin); if ((*ConfigHasUnsavedChanges)(NULL)) return (*ConfigSaveFile)(); else return M64ERR_SUCCESS; } /********************************************************************************************************* * Command-line parsing */ static void printUsage(const char *progname) { printf("Usage: %s [parameters] [romfile]\n" "\n" "Parameters:\n" " --noosd : disable onscreen display\n" " --osd : enable onscreen display\n" " --fullscreen : use fullscreen display mode\n" " --windowed : use windowed display mode\n" " --resolution (res) : display resolution (640x480, 800x600, 1024x768, etc)\n" " --nospeedlimit : disable core speed limiter (should be used with dummy audio plugin)\n" " --cheats (cheat-spec) : enable or list cheat codes for the given rom file\n" " --corelib (filepath) : use core library (filepath) (can be only filename or full path)\n" " --configdir (dir) : force configation directory to (dir); should contain mupen64plus.cfg\n" " --datadir (dir) : search for shared data files (.ini files, languages, etc) in (dir)\n" " --debug : launch console-based debugger (requires core lib built for debugging)\n" " --plugindir (dir) : search for plugins in (dir)\n" " --sshotdir (dir) : set screenshot directory to (dir)\n" " --gfx (plugin-spec) : use gfx plugin given by (plugin-spec)\n" " --audio (plugin-spec) : use audio plugin given by (plugin-spec)\n" " --input (plugin-spec) : use input plugin given by (plugin-spec)\n" " --rsp (plugin-spec) : use rsp plugin given by (plugin-spec)\n" " --emumode (mode) : set emu mode to: 0=Pure Interpreter 1=Interpreter 2=DynaRec\n" " --savestate (filepath) : savestate loaded at startup\n" " --testshots (list) : take screenshots at frames given in comma-separated (list), then quit\n" " --set (param-spec) : set a configuration variable, format: ParamSection[ParamName]=Value\n" " --gb-rom-{1,2,3,4} : define GB cart rom to load inside transferpak {1,2,3,4}\n" " --gb-ram-{1,2,3,4} : define GB cart ram to load inside transferpak {1,2,3,4}\n" " --dd-ipl-rom : define 64DD IPL rom\n" " --dd-disk : define disk to load into the disk drive\n" " --core-compare-send : use the Core Comparison debugging feature, in data sending mode\n" " --core-compare-recv : use the Core Comparison debugging feature, in data receiving mode\n" " --nosaveoptions : do not save the given command-line options in configuration file\n" " --pif (filepath) : use a binary PIF ROM (filepath) instead of HLE PIF\n" " --verbose : print lots of information\n" " --help : see this help message\n\n" "(plugin-spec):\n" " (pluginname) : filename (without path) of plugin to find in plugin directory\n" " (pluginpath) : full path and filename of plugin\n" " 'dummy' : use dummy plugin\n\n" "(cheat-spec):\n" " 'list' : show all of the available cheat codes\n" " 'all' : enable all of the available cheat codes\n" " (codelist) : a comma-separated list of cheat code numbers to enable,\n" " with dashes to use code variables (ex 1-2 to use cheat 1 option 2)\n" "\n", progname); return; } static int SetConfigParameter(const char *ParamSpec) { char *ParsedString, *VarName, *VarValue=NULL; m64p_handle ConfigSection; m64p_type VarType; m64p_error rval; if (ParamSpec == NULL) { DebugMessage(M64MSG_ERROR, "ParamSpec is NULL in SetConfigParameter()"); return 1; } /* make a copy of the input string */ ParsedString = (char *) malloc(strlen(ParamSpec) + 1); if (ParsedString == NULL) { DebugMessage(M64MSG_ERROR, "SetConfigParameter() couldn't allocate memory for temporary string."); return 2; } strcpy(ParsedString, ParamSpec); /* parse it for the simple section[name]=value format */ VarName = strchr(ParsedString, '['); if (VarName != NULL) { *VarName++ = 0; VarValue = strchr(VarName, ']'); if (VarValue != NULL) { *VarValue++ = 0; } } if (VarName == NULL || VarValue == NULL || *VarValue != '=') { DebugMessage(M64MSG_ERROR, "invalid (param-spec) '%s'", ParamSpec); free(ParsedString); return 3; } VarValue++; /* then set the value */ rval = (*ConfigOpenSection)(ParsedString, &ConfigSection); if (rval != M64ERR_SUCCESS) { DebugMessage(M64MSG_ERROR, "SetConfigParameter failed to open config section '%s'", ParsedString); free(ParsedString); return 4; } if ((*ConfigGetParameterType)(ConfigSection, VarName, &VarType) == M64ERR_SUCCESS) { switch(VarType) { int ValueInt; float ValueFloat; case M64TYPE_INT: ValueInt = atoi(VarValue); ConfigSetParameter(ConfigSection, VarName, M64TYPE_INT, &ValueInt); break; case M64TYPE_FLOAT: ValueFloat = (float) atof(VarValue); ConfigSetParameter(ConfigSection, VarName, M64TYPE_FLOAT, &ValueFloat); break; case M64TYPE_BOOL: ValueInt = (int) (osal_insensitive_strcmp(VarValue, "true") == 0); ConfigSetParameter(ConfigSection, VarName, M64TYPE_BOOL, &ValueInt); break; case M64TYPE_STRING: ConfigSetParameter(ConfigSection, VarName, M64TYPE_STRING, VarValue); break; default: DebugMessage(M64MSG_ERROR, "invalid VarType in SetConfigParameter()"); return 5; } } else { ConfigSetParameter(ConfigSection, VarName, M64TYPE_STRING, VarValue); } free(ParsedString); return 0; } static int *ParseNumberList(const char *InputString, int *ValuesFound) { const char *str; int *OutputList; /* count the number of integers in the list */ int values = 1; str = InputString; while ((str = strchr(str, ',')) != NULL) { str++; values++; } /* create a list and populate it with the frame counter values at which to take screenshots */ if ((OutputList = (int *) malloc(sizeof(int) * (values + 1))) != NULL) { int idx = 0; str = InputString; while (str != NULL) { OutputList[idx++] = atoi(str); str = strchr(str, ','); if (str != NULL) str++; } OutputList[idx] = 0; } if (ValuesFound != NULL) *ValuesFound = values; return OutputList; } static int ParseCommandLineInitial(int argc, const char **argv) { int i; /* First phase of command line parsing: read parameters that affect the core and the ui-console behavior. */ for (i = 1; i < argc; i++) { int ArgsLeft = argc - i - 1; if (strcmp(argv[i], "--corelib") == 0 && ArgsLeft >= 1) { l_CoreLibPath = argv[i+1]; i++; } else if (strcmp(argv[i], "--configdir") == 0 && ArgsLeft >= 1) { l_ConfigDirPath = argv[i+1]; i++; } else if (strcmp(argv[i], "--datadir") == 0 && ArgsLeft >= 1) { l_DataDirPath = argv[i+1]; i++; } else if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) { printUsage(argv[0]); return 1; } else if (strcmp(argv[i], "--nosaveoptions") == 0) { l_SaveOptions = 0; } } return 0; } static m64p_error ParseCommandLineMain(int argc, const char **argv) { int i; /* Second phase of command-line parsing: read all remaining parameters except for those that set plugin options. */ for (i = 1; i < argc; i++) { int ArgsLeft = argc - i - 1; if (strcmp(argv[i], "--noosd") == 0) { int Osd = 0; (*ConfigSetParameter)(l_ConfigCore, "OnScreenDisplay", M64TYPE_BOOL, &Osd); } else if (strcmp(argv[i], "--osd") == 0) { int Osd = 1; (*ConfigSetParameter)(l_ConfigCore, "OnScreenDisplay", M64TYPE_BOOL, &Osd); } else if (strcmp(argv[i], "--fullscreen") == 0) { int Fullscreen = 1; (*ConfigSetParameter)(l_ConfigVideo, "Fullscreen", M64TYPE_BOOL, &Fullscreen); } else if (strcmp(argv[i], "--windowed") == 0) { int Fullscreen = 0; (*ConfigSetParameter)(l_ConfigVideo, "Fullscreen", M64TYPE_BOOL, &Fullscreen); } else if (strcmp(argv[i], "--nospeedlimit") == 0) { int EnableSpeedLimit = 0; if (g_CoreAPIVersion < 0x020001) DebugMessage(M64MSG_WARNING, "core library doesn't support --nospeedlimit"); else { if ((*CoreDoCommand)(M64CMD_CORE_STATE_SET, M64CORE_SPEED_LIMITER, &EnableSpeedLimit) != M64ERR_SUCCESS) DebugMessage(M64MSG_ERROR, "core gave error while setting --nospeedlimit option"); } } else if ((strcmp(argv[i], "--corelib") == 0 || strcmp(argv[i], "--configdir") == 0 || strcmp(argv[i], "--datadir") == 0) && ArgsLeft >= 1) { /* already handled in ParseCommandLineInitial (skip the value) */ i++; } else if (strcmp(argv[i], "--nosaveoptions") == 0) { /* already handled in ParseCommandLineInitial (no value to skip) */ ; } else if (strcmp(argv[i], "--resolution") == 0 && ArgsLeft >= 1) { const char *res = argv[i+1]; int xres, yres; i++; if (sscanf(res, "%ix%i", &xres, &yres) != 2) DebugMessage(M64MSG_WARNING, "couldn't parse resolution '%s'", res); else { (*ConfigSetParameter)(l_ConfigVideo, "ScreenWidth", M64TYPE_INT, &xres); (*ConfigSetParameter)(l_ConfigVideo, "ScreenHeight", M64TYPE_INT, &yres); } } else if (strcmp(argv[i], "--cheats") == 0 && ArgsLeft >= 1) { if (strcmp(argv[i+1], "all") == 0) l_CheatMode = CHEAT_ALL; else if (strcmp(argv[i+1], "list") == 0) l_CheatMode = CHEAT_SHOW_LIST; else { l_CheatMode = CHEAT_LIST; l_CheatNumList = (char*) argv[i+1]; } i++; } else if (strcmp(argv[i], "--plugindir") == 0 && ArgsLeft >= 1) { g_PluginDir = argv[i+1]; i++; } else if (strcmp(argv[i], "--sshotdir") == 0 && ArgsLeft >= 1) { (*ConfigSetParameter)(l_ConfigCore, "ScreenshotPath", M64TYPE_STRING, argv[i+1]); i++; } else if (strcmp(argv[i], "--gfx") == 0 && ArgsLeft >= 1) { g_GfxPlugin = argv[i+1]; i++; } else if (strcmp(argv[i], "--audio") == 0 && ArgsLeft >= 1) { g_AudioPlugin = argv[i+1]; i++; } else if (strcmp(argv[i], "--input") == 0 && ArgsLeft >= 1) { g_InputPlugin = argv[i+1]; i++; } else if (strcmp(argv[i], "--rsp") == 0 && ArgsLeft >= 1) { g_RspPlugin = argv[i+1]; i++; } else if (strcmp(argv[i], "--emumode") == 0 && ArgsLeft >= 1) { int emumode = atoi(argv[i+1]); i++; if (emumode < 0 || emumode > 2) { DebugMessage(M64MSG_WARNING, "invalid --emumode value '%i'", emumode); continue; } if (emumode == 2 && !(g_CoreCapabilities & M64CAPS_DYNAREC)) { DebugMessage(M64MSG_WARNING, "Emulator core doesn't support Dynamic Recompiler."); emumode = 1; } (*ConfigSetParameter)(l_ConfigCore, "R4300Emulator", M64TYPE_INT, &emumode); } else if (strcmp(argv[i], "--savestate") == 0 && ArgsLeft >= 1) { l_SaveStatePath = argv[i+1]; i++; } else if (strcmp(argv[i], "--testshots") == 0 && ArgsLeft >= 1) { l_TestShotList = ParseNumberList(argv[i+1], NULL); i++; } else if (strcmp(argv[i], "--set") == 0 && ArgsLeft >= 1) { /* skip this: it will be handled in ParseCommandLinePlugin */ i++; } else if (strcmp(argv[i], "--debug") == 0) { l_LaunchDebugger = 1; } else if (strcmp(argv[i], "--core-compare-send") == 0) { l_CoreCompareMode = 1; } else if (strcmp(argv[i], "--core-compare-recv") == 0) { l_CoreCompareMode = 2; } #define PARSE_GB_CART_PARAM(param, key) \ else if (strcmp(argv[i], param) == 0) \ { \ ConfigSetParameter(l_ConfigTransferPak, key, M64TYPE_STRING, argv[i+1]); \ i++; \ } PARSE_GB_CART_PARAM("--gb-rom-1", "GB-rom-1") PARSE_GB_CART_PARAM("--gb-ram-1", "GB-ram-1") PARSE_GB_CART_PARAM("--gb-rom-2", "GB-rom-2") PARSE_GB_CART_PARAM("--gb-ram-2", "GB-ram-2") PARSE_GB_CART_PARAM("--gb-rom-3", "GB-rom-3") PARSE_GB_CART_PARAM("--gb-ram-3", "GB-ram-3") PARSE_GB_CART_PARAM("--gb-rom-4", "GB-rom-4") PARSE_GB_CART_PARAM("--gb-ram-4", "GB-ram-4") #undef PARSE_GB_CART_PARAM else if (strcmp(argv[i], "--dd-ipl-rom") == 0) { ConfigSetParameter(l_Config64DD, "IPL-ROM", M64TYPE_STRING, argv[i+1]); i++; } else if (strcmp(argv[i], "--dd-disk") == 0) { ConfigSetParameter(l_Config64DD, "Disk", M64TYPE_STRING, argv[i+1]); i++; } else if (strcmp(argv[i], "--pif") == 0) { m64p_error pif_status = M64ERR_INVALID_STATE; /* load PIF image */ FILE *pifPtr = fopen(argv[i+1], "rb"); if (pifPtr != NULL) { unsigned char *PIF_buffer = (unsigned char *) malloc(PIF_ROM_SIZE); if (PIF_buffer != NULL) { if (fread(PIF_buffer, 1, PIF_ROM_SIZE, pifPtr) == PIF_ROM_SIZE) { pif_status = (*CoreDoCommand)(M64CMD_PIF_OPEN, PIF_ROM_SIZE, PIF_buffer); } free(PIF_buffer); } fclose(pifPtr); } if (pif_status != M64ERR_SUCCESS) { DebugMessage(M64MSG_ERROR, "core failed to open PIF ROM file '%s'.", argv[i+1]); } i++; } else if (ArgsLeft == 0) { /* this is the last arg, it should be a ROM filename */ l_ROMFilepath = argv[i]; return M64ERR_SUCCESS; } else if (strcmp(argv[i], "--verbose") == 0) { g_Verbose = 1; } else { DebugMessage(M64MSG_WARNING, "unrecognized command-line parameter '%s'", argv[i]); } /* continue argv loop */ } /* missing ROM filepath */ DebugMessage(M64MSG_ERROR, "no ROM filepath given"); return M64ERR_INPUT_INVALID; } static m64p_error ParseCommandLinePlugin(int argc, const char **argv) { int i; /* Third phase of command-line parsing: read all plugin parameters. */ for (i = 1; i < argc; i++) { int ArgsLeft = argc - i - 1; if (strcmp(argv[i], "--set") == 0 && ArgsLeft >= 1) { if (SetConfigParameter(argv[i+1]) != 0) return M64ERR_INPUT_INVALID; i++; } } return M64ERR_SUCCESS; } static char* media_loader_get_filename(void* cb_data, m64p_handle section_handle, const char* section, const char* key) { #define MUPEN64PLUS_CFG_NAME "mupen64plus.cfg" m64p_handle core_config; char value[4096]; const char* configdir = NULL; char* cfgfilepath = NULL; /* reset filename */ char* mem_filename = NULL; /* XXX: use external config API to force reload of file content */ configdir = ConfigGetUserConfigPath(); if (configdir == NULL) { DebugMessage(M64MSG_ERROR, "Can't get user config path !"); return NULL; } cfgfilepath = combinepath(configdir, MUPEN64PLUS_CFG_NAME); if (cfgfilepath == NULL) { DebugMessage(M64MSG_ERROR, "Can't get config file path: %s + %s!", configdir, MUPEN64PLUS_CFG_NAME); return NULL; } if (ConfigExternalOpen(cfgfilepath, &core_config) != M64ERR_SUCCESS) { DebugMessage(M64MSG_ERROR, "Can't open config file %s!", cfgfilepath); goto release_cfgfilepath; } if (ConfigExternalGetParameter(core_config, section, key, value, sizeof(value)) != M64ERR_SUCCESS) { DebugMessage(M64MSG_ERROR, "Can't get parameter %s", key); goto close_config; } size_t len = strlen(value); if (len < 2 || value[0] != '"' || value[len-1] != '"') { DebugMessage(M64MSG_ERROR, "Invalid string format %s", value); goto close_config; } value[len-1] = '\0'; mem_filename = strdup(value + 1); ConfigSetParameter(section_handle, key, M64TYPE_STRING, mem_filename); close_config: ConfigExternalClose(core_config); release_cfgfilepath: free(cfgfilepath); return mem_filename; } static char* media_loader_get_gb_cart_mem_file(void* cb_data, const char* mem, int control_id) { char key[64]; snprintf(key, sizeof(key), "GB-%s-%u", mem, control_id + 1); return media_loader_get_filename(cb_data, l_ConfigTransferPak, "Transferpak", key); } static char* media_loader_get_gb_cart_rom(void* cb_data, int control_id) { return media_loader_get_gb_cart_mem_file(cb_data, "rom", control_id); } static char* media_loader_get_gb_cart_ram(void* cb_data, int control_id) { return media_loader_get_gb_cart_mem_file(cb_data, "ram", control_id); } static char* media_loader_get_dd_rom(void* cb_data) { return media_loader_get_filename(cb_data, l_Config64DD, "64DD", "IPL-ROM"); } static char* media_loader_get_dd_disk(void* cb_data) { return media_loader_get_filename(cb_data, l_Config64DD, "64DD", "Disk"); } static m64p_media_loader l_media_loader = { NULL, media_loader_get_gb_cart_rom, media_loader_get_gb_cart_ram, NULL, media_loader_get_dd_rom, media_loader_get_dd_disk }; /********************************************************************************************************* * main function */ /* Allow state callback in external module to be specified via build flags (header and function name) */ #ifdef CALLBACK_HEADER #define xstr(s) str(s) #define str(s) #s #include xstr(CALLBACK_HEADER) #endif #ifndef CALLBACK_FUNC #define CALLBACK_FUNC NULL #endif #ifndef WIN32 /* Allow external modules to call the main function as a library method. This is useful for user * interfaces that simply layer on top of (rather than re-implement) UI-Console (e.g. mupen64plus-ae). */ __attribute__ ((visibility("default"))) #endif int main(int argc, char *argv[]) { int i; printf(" __ __ __ _ _ ____ _ \n"); printf("| \\/ |_ _ _ __ ___ _ __ / /_ | || | | _ \\| |_ _ ___ \n"); printf("| |\\/| | | | | '_ \\ / _ \\ '_ \\| '_ \\| || |_| |_) | | | | / __| \n"); printf("| | | | |_| | |_) | __/ | | | (_) |__ _| __/| | |_| \\__ \\ \n"); printf("|_| |_|\\__,_| .__/ \\___|_| |_|\\___/ |_| |_| |_|\\__,_|___/ \n"); printf(" |_| https://mupen64plus.org/ \n"); printf("%s Version %i.%i.%i\n\n", CONSOLE_UI_NAME, VERSION_PRINTF_SPLIT(CONSOLE_UI_VERSION)); /* bootstrap some special parameters from the command line */ if (ParseCommandLineInitial(argc, (const char **) argv) != 0) return 1; /* load the Mupen64Plus core library */ if (AttachCoreLib(l_CoreLibPath) != M64ERR_SUCCESS) return 2; /* start the Mupen64Plus core library, load the configuration file */ m64p_error rval = (*CoreStartup)(CORE_API_VERSION, l_ConfigDirPath, l_DataDirPath, "Core", DebugCallback, NULL, CALLBACK_FUNC); if (rval != M64ERR_SUCCESS) { DebugMessage(M64MSG_ERROR, "couldn't start Mupen64Plus core library."); DetachCoreLib(); return 3; } #ifdef VIDEXT_HEADER rval = CoreOverrideVidExt(&vidExtFunctions); if (rval != M64ERR_SUCCESS) { DebugMessage(M64MSG_ERROR, "couldn't start VidExt library."); DetachCoreLib(); return 14; } #endif /* Open configuration sections */ rval = OpenConfigurationHandles(); if (rval != M64ERR_SUCCESS) { (*CoreShutdown)(); DetachCoreLib(); return 4; } /* parse non-plugin command-line options */ rval = ParseCommandLineMain(argc, (const char **) argv); if (rval != M64ERR_SUCCESS) { (*CoreShutdown)(); DetachCoreLib(); return 5; } /* Ensure that the core supports comparison feature if necessary */ if (l_CoreCompareMode != 0 && !(g_CoreCapabilities & M64CAPS_CORE_COMPARE)) { DebugMessage(M64MSG_ERROR, "can't use --core-compare feature with this Mupen64Plus core library."); DetachCoreLib(); return 6; } compare_core_init(l_CoreCompareMode); /* Ensure that the core supports the debugger if necessary */ if (l_LaunchDebugger && !(g_CoreCapabilities & M64CAPS_DEBUGGER)) { DebugMessage(M64MSG_ERROR, "can't use --debug feature with this Mupen64Plus core library."); DetachCoreLib(); return 6; } /* save the given command-line options in configuration file if requested */ if (l_SaveOptions) SaveConfigurationOptions(); /* load ROM image */ FILE *fPtr = fopen(l_ROMFilepath, "rb"); if (fPtr == NULL) { DebugMessage(M64MSG_ERROR, "couldn't open ROM file '%s' for reading.", l_ROMFilepath); (*CoreShutdown)(); DetachCoreLib(); return 7; } /* get the length of the ROM, allocate memory buffer, load it from disk */ long romlength = 0; fseek(fPtr, 0L, SEEK_END); romlength = ftell(fPtr); fseek(fPtr, 0L, SEEK_SET); unsigned char *ROM_buffer = (unsigned char *) malloc(romlength); if (ROM_buffer == NULL) { DebugMessage(M64MSG_ERROR, "couldn't allocate %li-byte buffer for ROM image file '%s'.", romlength, l_ROMFilepath); fclose(fPtr); (*CoreShutdown)(); DetachCoreLib(); return 8; } else if (fread(ROM_buffer, 1, romlength, fPtr) != romlength) { DebugMessage(M64MSG_ERROR, "couldn't read %li bytes from ROM image file '%s'.", romlength, l_ROMFilepath); free(ROM_buffer); fclose(fPtr); (*CoreShutdown)(); DetachCoreLib(); return 9; } fclose(fPtr); /* Try to load the ROM image into the core */ if ((*CoreDoCommand)(M64CMD_ROM_OPEN, (int) romlength, ROM_buffer) != M64ERR_SUCCESS) { DebugMessage(M64MSG_ERROR, "core failed to open ROM image file '%s'.", l_ROMFilepath); free(ROM_buffer); (*CoreShutdown)(); DetachCoreLib(); return 10; } free(ROM_buffer); /* the core copies the ROM image, so we can release this buffer immediately */ /* handle the cheat codes */ CheatStart(l_CheatMode, l_CheatNumList); if (l_CheatMode == CHEAT_SHOW_LIST) { (*CoreDoCommand)(M64CMD_ROM_CLOSE, 0, NULL); (*CoreShutdown)(); DetachCoreLib(); return 11; } /* search for and load plugins */ rval = PluginSearchLoad(l_ConfigUI); if (rval != M64ERR_SUCCESS) { (*CoreDoCommand)(M64CMD_ROM_CLOSE, 0, NULL); (*CoreShutdown)(); DetachCoreLib(); return 12; } /* Parse and set plugin options. Doing this after loading the plugins allows the plugins to set up their own defaults first. */ rval = ParseCommandLinePlugin(argc, (const char **) argv); if (rval != M64ERR_SUCCESS) { (*CoreDoCommand)(M64CMD_ROM_CLOSE, 0, NULL); (*CoreShutdown)(); DetachCoreLib(); return 5; } /* attach plugins to core */ for (i = 0; i < 4; i++) { if ((*CoreAttachPlugin)(g_PluginMap[i].type, g_PluginMap[i].handle) != M64ERR_SUCCESS) { DebugMessage(M64MSG_ERROR, "core error while attaching %s plugin.", g_PluginMap[i].name); (*CoreDoCommand)(M64CMD_ROM_CLOSE, 0, NULL); (*CoreShutdown)(); DetachCoreLib(); return 13; } } /* set up Frame Callback if --testshots is enabled */ if (l_TestShotList != NULL) { if ((*CoreDoCommand)(M64CMD_SET_FRAME_CALLBACK, 0, FrameCallback) != M64ERR_SUCCESS) { DebugMessage(M64MSG_WARNING, "couldn't set frame callback, --testshots will not work."); } } /* set gb cart loader */ if ((*CoreDoCommand)(M64CMD_SET_MEDIA_LOADER, sizeof(l_media_loader), &l_media_loader) != M64ERR_SUCCESS) { DebugMessage(M64MSG_WARNING, "Couldn't set media loader, transferpak and GB carts will not work."); } /* load savestate at startup */ if (l_SaveStatePath != NULL) { if ((*CoreDoCommand)(M64CMD_STATE_LOAD, 0, (void *) l_SaveStatePath) != M64ERR_SUCCESS) { DebugMessage(M64MSG_WARNING, "couldn't load state, rom will run normally."); } } /* Setup debugger */ if (l_LaunchDebugger) { if (debugger_setup_callbacks()) { DebugMessage(M64MSG_ERROR, "couldn't setup debugger callbacks."); (*CoreDoCommand)(M64CMD_ROM_CLOSE, 0, NULL); (*CoreShutdown)(); DetachCoreLib(); return 14; } /* Set Core config parameter to enable debugger */ int bEnableDebugger = 1; (*ConfigSetParameter)(l_ConfigCore, "EnableDebugger", M64TYPE_BOOL, &bEnableDebugger); /* Fork the debugger input thread. */ #if SDL_VERSION_ATLEAST(2,0,0) SDL_CreateThread(debugger_loop, "DebugLoop", NULL); #else SDL_CreateThread(debugger_loop, NULL); #endif } else { /* Set Core config parameter to disable debugger */ int bEnableDebugger = 0; (*ConfigSetParameter)(l_ConfigCore, "EnableDebugger", M64TYPE_BOOL, &bEnableDebugger); } /* Save the configuration file again, if necessary, to capture updated parameters from plugins. This is the last opportunity to save changes before the relatively long-running game. */ if (l_SaveOptions && (*ConfigHasUnsavedChanges)(NULL)) (*ConfigSaveFile)(); /* run the game */ (*CoreDoCommand)(M64CMD_EXECUTE, 0, NULL); /* detach plugins from core and unload them */ for (i = 0; i < 4; i++) (*CoreDetachPlugin)(g_PluginMap[i].type); PluginUnload(); /* close the ROM image */ (*CoreDoCommand)(M64CMD_ROM_CLOSE, 0, NULL); /* save the configuration file again if --nosaveoptions was not specified, to keep any updated parameters from the core/plugins */ if (l_SaveOptions && (*ConfigHasUnsavedChanges)(NULL)) (*ConfigSaveFile)(); /* Shut down and release the Core library */ (*CoreShutdown)(); DetachCoreLib(); /* free allocated memory */ if (l_TestShotList != NULL) free(l_TestShotList); return 0; } mupen64plus-ui-console-src-2.6.0/src/main.h000066400000000000000000000036211464507127400204610ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus - main.h * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009 Richard42 * * * * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef __MAIN_H__ #define __MAIN_H__ #if defined(__GNUC__) #define ATTR_FMT(fmtpos, attrpos) __attribute__ ((format (printf, fmtpos, attrpos))) #else #define ATTR_FMT(fmtpos, attrpos) #endif extern void DebugMessage(int level, const char *message, ...) ATTR_FMT(2,3); extern void DebugCallback(void *Context, int level, const char *message); extern int g_Verbose; #endif /* __MAIN_H__ */ mupen64plus-ui-console-src-2.6.0/src/osal_dynamiclib.h000066400000000000000000000035661464507127400226760ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus-ui-console - osal_dynamiclib.h * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009 Richard Goedeken * * * * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #if !defined(OSAL_DYNAMICLIB_H) #define OSAL_DYNAMICLIB_H #include "m64p_types.h" m64p_error osal_dynlib_open(m64p_dynlib_handle *pLibHandle, const char *pccLibraryPath); void * osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName); m64p_error osal_dynlib_close(m64p_dynlib_handle LibHandle); #endif /* #define OSAL_DYNAMICLIB_H */ mupen64plus-ui-console-src-2.6.0/src/osal_dynamiclib_unix.c000066400000000000000000000054311464507127400237250ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus-ui-console - osal_dynamiclib_unix.c * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009 Richard Goedeken * * * * 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 #include #include #include #include "m64p_types.h" #include "main.h" #include "osal_dynamiclib.h" m64p_error osal_dynlib_open(m64p_dynlib_handle *pLibHandle, const char *pccLibraryPath) { if (pLibHandle == NULL || pccLibraryPath == NULL) return M64ERR_INPUT_ASSERT; *pLibHandle = dlopen(pccLibraryPath, RTLD_NOW); if (*pLibHandle == NULL) { /* only print an error message if there is a directory separator (/) in the pathname */ /* this prevents us from throwing an error for the use case where Mupen64Plus is not installed */ if (strchr(pccLibraryPath, '/') != NULL) DebugMessage(M64MSG_ERROR, "dlopen('%s') failed: %s", pccLibraryPath, dlerror()); return M64ERR_INPUT_NOT_FOUND; } return M64ERR_SUCCESS; } void * osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName) { if (pccProcedureName == NULL) return NULL; return dlsym(LibHandle, pccProcedureName); } m64p_error osal_dynlib_close(m64p_dynlib_handle LibHandle) { int rval = dlclose(LibHandle); if (rval != 0) { DebugMessage(M64MSG_ERROR, "dlclose() failed: %s", dlerror()); return M64ERR_INTERNAL; } return M64ERR_SUCCESS; } mupen64plus-ui-console-src-2.6.0/src/osal_dynamiclib_win32.c000066400000000000000000000061211464507127400237010ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus-ui-console - osal_dynamiclib_win32.c * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009 Richard Goedeken * * * * 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 #include #include #include "m64p_types.h" #include "main.h" #include "osal_dynamiclib.h" m64p_error osal_dynlib_open(m64p_dynlib_handle *pLibHandle, const char *pccLibraryPath) { if (pLibHandle == NULL || pccLibraryPath == NULL) return M64ERR_INPUT_ASSERT; *pLibHandle = LoadLibrary(pccLibraryPath); if (*pLibHandle == NULL) { char *pchErrMsg; DWORD dwErr = GetLastError(); FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pchErrMsg, 0, NULL); DebugMessage(M64MSG_ERROR, "LoadLibrary('%s') error: %s", pccLibraryPath, pchErrMsg); LocalFree(pchErrMsg); return M64ERR_INPUT_NOT_FOUND; } return M64ERR_SUCCESS; } void * osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName) { if (pccProcedureName == NULL) return NULL; return GetProcAddress(LibHandle, pccProcedureName); } m64p_error osal_dynlib_close(m64p_dynlib_handle LibHandle) { int rval = FreeLibrary(LibHandle); if (rval == 0) { char *pchErrMsg; DWORD dwErr = GetLastError(); FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pchErrMsg, 0, NULL); DebugMessage(M64MSG_ERROR, "FreeLibrary() error: %s", pchErrMsg); LocalFree(pchErrMsg); return M64ERR_INTERNAL; } return M64ERR_SUCCESS; } mupen64plus-ui-console-src-2.6.0/src/osal_files.h000066400000000000000000000053611464507127400216600ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus-ui-console - osal_files.h * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009 Richard Goedeken * * * * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This header file is for all kinds of system-dependent file handling * */ #if !defined(OSAL_FILES_H) #define OSAL_FILES_H #include "m64p_types.h" #include "osal_preproc.h" /* some file-related preprocessor definitions */ #if defined(WIN32) && !defined(__MINGW32__) #include // For _unlink() #define unlink _unlink #define snprintf _snprintf #define strdup _strdup #define OSAL_DIR_SEPARATORS "\\/" #else /* Not WIN32 */ #include // for unlink() #define OSAL_DIR_SEPARATORS "/" #endif /* data structure for linked list of shared libraries found in a directory */ typedef struct _osal_lib_search { char filepath[PATH_MAX]; char *filename; m64p_plugin_type plugin_type; struct _osal_lib_search *next; } osal_lib_search; /* const definitions for system directories to search when looking for mupen64plus plugins */ extern const int osal_libsearchdirs; extern const char *osal_libsearchpath[]; /* functions for searching for shared libraries in a given directory */ extern osal_lib_search *osal_library_search(const char *searchpath); extern void osal_free_lib_list(osal_lib_search *head); #endif /* #define OSAL_FILES_H */ mupen64plus-ui-console-src-2.6.0/src/osal_files_unix.c000066400000000000000000000101111464507127400227030ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus-ui-console - osal_files_unix.c * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009 Richard Goedeken * * * * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This implements all kinds of system-dependent file handling * */ #include // for opendir(), readdir(), closedir() #include #include #include #include #include #include "m64p_types.h" #include "main.h" #include "osal_files.h" #include "osal_preproc.h" /* definitions for system directories to search when looking for mupen64plus plugins */ #if defined(PLUGINDIR) const int osal_libsearchdirs = 4; const char *osal_libsearchpath[4] = { PLUGINDIR, "/usr/local/lib/mupen64plus", "/usr/lib/mupen64plus", "./" }; #else const int osal_libsearchdirs = 3; const char *osal_libsearchpath[3] = { "/usr/local/lib/mupen64plus", "/usr/lib/mupen64plus", "./" }; #endif osal_lib_search *osal_library_search(const char *searchpath) { osal_lib_search *head = NULL, *curr = NULL; DIR *dir; struct dirent *entry; #ifdef __APPLE__ const char* suffix = ".dylib"; #else const char* suffix = ".so"; #endif dir = opendir(searchpath); if (dir == NULL) return NULL; /* look for any shared libraries in this folder */ while ((entry = readdir(dir)) != NULL) { osal_lib_search *newlib = NULL; if (strcmp(entry->d_name + strlen(entry->d_name) - strlen(suffix), suffix) != 0) continue; /* this is a .so file, so add it to the list */ newlib = malloc(sizeof(osal_lib_search)); if (newlib == NULL) { DebugMessage(M64MSG_ERROR, "Memory allocation error in osal_library_search()!"); osal_free_lib_list(head); closedir(dir); return NULL; } if (head == NULL) { head = curr = newlib; } else { curr->next = newlib; curr = newlib; } /* set up the filepath and filename members */ strncpy(curr->filepath, searchpath, PATH_MAX-2); curr->filepath[PATH_MAX-2] = 0; if (curr->filepath[strlen(curr->filepath)-1] != '/') strcat(curr->filepath, "/"); int pathlen = strlen(curr->filepath); curr->filename = curr->filepath + pathlen; strncat(curr->filepath, entry->d_name, PATH_MAX - pathlen - 1); curr->filepath[PATH_MAX-1] = 0; /* set plugin_type and next pointer */ curr->plugin_type = 0; curr->next = NULL; } closedir(dir); return head; } void osal_free_lib_list(osal_lib_search *head) { while (head != NULL) { osal_lib_search *next = head->next; free(head); head = next; } } mupen64plus-ui-console-src-2.6.0/src/osal_files_win32.c000066400000000000000000000077071464507127400227030ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus-ui-console - osal_files_win32.c * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009 Richard Goedeken * * * * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This implements all kinds of system-dependent file handling * */ #include #include #include #include #include "m64p_types.h" #include "main.h" #include "osal_files.h" #include "osal_preproc.h" /* definitions for system directories to search when looking for mupen64plus plugins */ const int osal_libsearchdirs = 1; const char *osal_libsearchpath[1] = { ".\\" }; osal_lib_search *osal_library_search(const char *searchpath) { osal_lib_search *head = NULL, *curr = NULL; WIN32_FIND_DATA entry; HANDLE hDir; char *pchSearchPath = (char *) malloc(strlen(searchpath) + 16); if (pchSearchPath == NULL) { DebugMessage(M64MSG_ERROR, "Couldn't allocate memory for file search path in osal_library_search()!"); return NULL; } sprintf(pchSearchPath, "%s\\*.dll", searchpath); hDir = FindFirstFile(pchSearchPath, &entry); free(pchSearchPath); if (hDir == INVALID_HANDLE_VALUE) return NULL; /* look for any shared libraries in this folder */ do { osal_lib_search *newlib = NULL; /* this is a .dll file, so add it to the list */ newlib = (osal_lib_search *) malloc(sizeof(osal_lib_search)); if (newlib == NULL) { DebugMessage(M64MSG_ERROR, "Memory allocation error in osal_library_search()!"); osal_free_lib_list(head); FindClose(hDir); return NULL; } if (head == NULL) { head = curr = newlib; } else { curr->next = newlib; curr = newlib; } /* set up the filepath and filename members */ strncpy(curr->filepath, searchpath, PATH_MAX-2); curr->filepath[PATH_MAX-2] = 0; if (curr->filepath[strlen(curr->filepath)-1] != '\\') strcat(curr->filepath, "\\"); int pathlen = (int) strlen(curr->filepath); curr->filename = curr->filepath + pathlen; strncat(curr->filepath, entry.cFileName, PATH_MAX - pathlen - 1); curr->filepath[PATH_MAX-1] = 0; /* set plugin_type and next pointer */ curr->plugin_type = (m64p_plugin_type) 0; curr->next = NULL; } while (FindNextFile(hDir, &entry)); FindClose(hDir); return head; } void osal_free_lib_list(osal_lib_search *head) { while (head != NULL) { osal_lib_search *next = head->next; free(head); head = next; } } mupen64plus-ui-console-src-2.6.0/src/osal_preproc.h000066400000000000000000000055571464507127400222370ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus-ui-console - osal_preproc.h * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009 Richard Goedeken * * * * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This header file is for OS-specific #includes and #defines * */ #if !defined(OSAL_PREPROC_H) #define OSAL_PREPROC_H #if defined(WIN32) #include #define PATH_MAX 2048 #define OSAL_DEFAULT_DYNLIB_FILENAME "mupen64plus.dll" #define OSAL_DIR_SEPARATOR '\\' #define OSAL_CURRENT_DIR ".\\" #define OSAL_DLL_EXTENSION ".dll" #define osal_insensitive_strcmp(x, y) _stricmp(x, y) #elif defined(__APPLE__) #include // for PATH_MAX #define OSAL_DEFAULT_DYNLIB_FILENAME "libmupen64plus.dylib" #define OSAL_DIR_SEPARATOR '/' #define OSAL_CURRENT_DIR "./" #define OSAL_DLL_EXTENSION ".dylib" #define osal_insensitive_strcmp(x, y) strcasecmp(x, y) #else /* Linux-like UNIX */ #if defined(ANDROID) #include #define printf(...) __android_log_print(ANDROID_LOG_VERBOSE, "UI-Console", __VA_ARGS__) #endif #include // for PATH_MAX #define OSAL_DEFAULT_DYNLIB_FILENAME "libmupen64plus.so.2" #define OSAL_DIR_SEPARATOR '/' #define OSAL_CURRENT_DIR "./" #define OSAL_DLL_EXTENSION ".so" #define osal_insensitive_strcmp(x, y) strcasecmp(x, y) /* PATH_MAX only may be defined by limits.h */ #ifndef PATH_MAX #define PATH_MAX 4096 #endif #endif #endif /* #define OSAL_PREPROC_H */ mupen64plus-ui-console-src-2.6.0/src/plugin.c000066400000000000000000000275121464507127400210330ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus-ui-console - plugin.c * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009 Richard42 * * * * 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 #include #include #if defined(__APPLE__) #include #endif #include "core_interface.h" #include "m64p_common.h" #include "m64p_types.h" #include "main.h" /* for the debug callback function */ #include "osal_dynamiclib.h" #include "osal_files.h" #include "osal_preproc.h" #include "plugin.h" #include "version.h" /* global variables */ const char *g_PluginDir = NULL; const char *g_GfxPlugin = NULL; // pointer to graphics plugin specified at commandline (if any) const char *g_AudioPlugin = NULL; // pointer to audio plugin specified at commandline (if any) const char *g_InputPlugin = NULL; // pointer to input plugin specified at commandline (if any) const char *g_RspPlugin = NULL; // pointer to rsp plugin specified at commandline (if any) plugin_map_node g_PluginMap[] = {{M64PLUGIN_GFX, "Video", NULL, "", NULL, 0 }, {M64PLUGIN_AUDIO, "Audio", NULL, "", NULL, 0 }, {M64PLUGIN_INPUT, "Input", NULL, "", NULL, 0 }, {M64PLUGIN_RSP, "RSP", NULL, "", NULL, 0 } }; /* local functions */ static m64p_error PluginLoadTry(const char *filepath, int MapIndex) { /* try to open a shared library at the given filepath */ m64p_dynlib_handle handle; m64p_error rval = osal_dynlib_open(&handle, filepath); if (rval != M64ERR_SUCCESS) return rval; /* call the GetVersion function for the plugin and check compatibility */ ptr_PluginGetVersion PluginGetVersion = (ptr_PluginGetVersion) osal_dynlib_getproc(handle, "PluginGetVersion"); if (PluginGetVersion == NULL) { if (g_Verbose) DebugMessage(M64MSG_ERROR, "library '%s' is not a Mupen64Plus library.", filepath); osal_dynlib_close(handle); return M64ERR_INCOMPATIBLE; } m64p_plugin_type PluginType = (m64p_plugin_type) 0; int PluginVersion = 0; const char *PluginName = NULL; (*PluginGetVersion)(&PluginType, &PluginVersion, NULL, &PluginName, NULL); if (PluginType != g_PluginMap[MapIndex].type) { /* the type of this plugin doesn't match with the type that was requested by the caller */ osal_dynlib_close(handle); return M64ERR_INCOMPATIBLE; } /* the front-end doesn't talk to the plugins, so we don't care about the plugin version or api version */ /* call the plugin's initialization function and make sure it starts okay */ ptr_PluginStartup PluginStartup = (ptr_PluginStartup) osal_dynlib_getproc(handle, "PluginStartup"); if (PluginStartup == NULL) { DebugMessage(M64MSG_ERROR, "library '%s' broken. No PluginStartup() function found.", filepath); osal_dynlib_close(handle); return M64ERR_INCOMPATIBLE; } rval = (*PluginStartup)(CoreHandle, g_PluginMap[MapIndex].name, DebugCallback); /* DebugCallback is in main.c */ if (rval != M64ERR_SUCCESS) { DebugMessage(M64MSG_ERROR, "Error: %s plugin library '%s' failed to start.", g_PluginMap[MapIndex].name, filepath); osal_dynlib_close(handle); return rval; } /* plugin loaded successfully, so set the plugin map's members */ g_PluginMap[MapIndex].handle = handle; strcpy(g_PluginMap[MapIndex].filename, filepath); g_PluginMap[MapIndex].libname = PluginName; g_PluginMap[MapIndex].libversion = PluginVersion; return M64ERR_SUCCESS; } /* global functions */ m64p_error PluginSearchLoad(m64p_handle ConfigUI) { osal_lib_search *lib_filelist = NULL; int i; /* start by checking the directory given on the command line */ if (g_PluginDir != NULL) { lib_filelist = osal_library_search(g_PluginDir); if (lib_filelist == NULL) { DebugMessage(M64MSG_ERROR, "No plugins found in --plugindir path: %s", g_PluginDir); return M64ERR_INPUT_NOT_FOUND; } } /* if no plugins found, search the PluginDir in the UI-console section of the config file */ if (lib_filelist == NULL) { const char *plugindir = (*ConfigGetParamString)(ConfigUI, "PluginDir"); lib_filelist = osal_library_search(plugindir); } /* for MacOS, look for plugins in the Frameworks folder of the app bundle */ #if defined(__APPLE__) if (lib_filelist == NULL) { CFBundleRef mainBundle = CFBundleGetMainBundle(); if (mainBundle != NULL) { CFURLRef frameworksURL = CFBundleCopyPrivateFrameworksURL(mainBundle); if (frameworksURL != NULL) { char libPath[1024]; if (CFURLGetFileSystemRepresentation(frameworksURL, TRUE, (uint8_t *) libPath, 1024)) { strcat(libPath, "/"); DebugMessage(M64MSG_INFO, "Searching for plugins at: %s", libPath); lib_filelist = osal_library_search(libPath); } CFRelease(frameworksURL); } } } #endif /* if still no plugins found, search some common system folders */ if (lib_filelist == NULL) { for (i = 0; i < osal_libsearchdirs; i++) { lib_filelist = osal_library_search(osal_libsearchpath[i]); if (lib_filelist != NULL) break; } } /* try to load one of each type of plugin */ for (i = 0; i < 4; i++) { m64p_plugin_type type = g_PluginMap[i].type; const char *cmdline_path = NULL; const char *config_var = NULL; int use_dummy = 0; switch (type) { case M64PLUGIN_RSP: cmdline_path = g_RspPlugin; config_var = "RspPlugin"; break; case M64PLUGIN_GFX: cmdline_path = g_GfxPlugin; config_var = "VideoPlugin"; break; case M64PLUGIN_AUDIO: cmdline_path = g_AudioPlugin; config_var = "AudioPlugin"; break; case M64PLUGIN_INPUT: cmdline_path = g_InputPlugin; config_var = "InputPlugin"; break; default: cmdline_path = NULL; config_var = ""; } /* first search for a plugin matching what was given on the command line */ if (cmdline_path != NULL) { /* if full path was given, try loading exactly this file */ if (strchr(cmdline_path, OSAL_DIR_SEPARATOR) != NULL) { PluginLoadTry(cmdline_path, i); } else if (strcmp(cmdline_path, "dummy") == 0) { use_dummy = 1; } else /* otherwise search through the plugin directory to find a match with this name */ { osal_lib_search *curr = lib_filelist; while (curr != NULL && g_PluginMap[i].handle == NULL) { if (strncmp(curr->filename, cmdline_path, strlen(cmdline_path)) == 0) PluginLoadTry(curr->filepath, i); curr = curr->next; } } /* exit with error if we couldn't find the specified plugin */ if (!use_dummy && g_PluginMap[i].handle == NULL) { DebugMessage(M64MSG_ERROR, "Specified %s plugin not found: %s", g_PluginMap[i].name, cmdline_path); osal_free_lib_list(lib_filelist); return M64ERR_INPUT_NOT_FOUND; } } else /* otherwise search for a plugin specified in the config file */ { const char *config_path = (*ConfigGetParamString)(ConfigUI, config_var); if (config_path != NULL && strlen(config_path) > 0) { /* if full path was given, try loading exactly this file */ if (strchr(config_path, OSAL_DIR_SEPARATOR) != NULL) { PluginLoadTry(config_path, i); } else if (strcmp(config_path, "dummy") == 0) { use_dummy = 1; } else /* otherwise search through the plugin directory to find a match with this name */ { osal_lib_search *curr = lib_filelist; while (curr != NULL && g_PluginMap[i].handle == NULL) { if (strncmp(curr->filename, config_path, strlen(config_path)) == 0) PluginLoadTry(curr->filepath, i); curr = curr->next; } } } } /* As a last resort, search for any appropriate plugin in search directory */ if (!use_dummy && g_PluginMap[i].handle == NULL) { osal_lib_search *curr = lib_filelist; while (curr != NULL && g_PluginMap[i].handle == NULL) { PluginLoadTry(curr->filepath, i); curr = curr->next; } } /* print out the particular plugin used */ if (g_PluginMap[i].handle == NULL) { DebugMessage(M64MSG_INFO, "using %s plugin: ", g_PluginMap[i].name); } else { DebugMessage(M64MSG_INFO, "using %s plugin: '%s' v%i.%i.%i", g_PluginMap[i].name, g_PluginMap[i].libname, VERSION_PRINTF_SPLIT(g_PluginMap[i].libversion)); DebugMessage(M64MSG_VERBOSE, "%s plugin library: %s", g_PluginMap[i].name, g_PluginMap[i].filename); } } /* free up the list of library files in the plugin search directory */ osal_free_lib_list(lib_filelist); return M64ERR_SUCCESS; } m64p_error PluginUnload(void) { typedef m64p_error (*ptr_PluginShutdown)(void); ptr_PluginShutdown PluginShutdown; int i; /* shutdown each type of plugin */ for (i = 0; i < 4; i++) { if (g_PluginMap[i].handle == NULL) continue; /* call the destructor function for the plugin and release the library */ PluginShutdown = (ptr_PluginShutdown) osal_dynlib_getproc(g_PluginMap[i].handle, "PluginShutdown"); if (PluginShutdown != NULL) (*PluginShutdown)(); osal_dynlib_close(g_PluginMap[i].handle); /* clear out the plugin map's members */ g_PluginMap[i].handle = NULL; g_PluginMap[i].filename[0] = 0; g_PluginMap[i].libname = NULL; g_PluginMap[i].libversion = 0; } return M64ERR_SUCCESS; } mupen64plus-ui-console-src-2.6.0/src/plugin.h000066400000000000000000000046731464507127400210430ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus-ui-console - plugin.h * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009 Richard42 * * * * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #if !defined(PLUGIN_H) #define PLUGIN_H #include #include "m64p_types.h" #include "osal_preproc.h" extern m64p_error PluginSearchLoad(m64p_handle ConfigUI); extern m64p_error PluginUnload(void); extern const char *g_PluginDir; // directory to search for plugins extern const char *g_GfxPlugin; // graphics plugin specified at commandline (if any) extern const char *g_AudioPlugin; // audio plugin specified at commandline (if any) extern const char *g_InputPlugin; // input plugin specified at commandline (if any) extern const char *g_RspPlugin; // rsp plugin specified at commandline (if any) typedef struct { m64p_plugin_type type; char name[8]; m64p_dynlib_handle handle; char filename[PATH_MAX]; const char *libname; int libversion; } plugin_map_node; extern plugin_map_node g_PluginMap[4]; #endif /* #define PLUGIN_H */ mupen64plus-ui-console-src-2.6.0/src/version.h000066400000000000000000000036741464507127400212320ustar00rootroot00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mupen64plus-ui-console - version.h * * Mupen64Plus homepage: https://mupen64plus.org/ * * Copyright (C) 2009 Richard Goedeken * * * * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This header file is for versioning information * */ #if !defined(VERSION_H) #define VERSION_H #define CONSOLE_UI_NAME "Mupen64Plus Console User-Interface" #define CONSOLE_UI_VERSION 0x020600 #define CORE_API_VERSION 0x020001 #define CONFIG_API_VERSION 0x020301 #define MINIMUM_CORE_VERSION 0x016300 #define VERSION_PRINTF_SPLIT(x) (((x) >> 16) & 0xffff), (((x) >> 8) & 0xff), ((x) & 0xff) #endif /* #define VERSION_H */