├── data └── font.ttf ├── tools ├── joymodel.png ├── m64p_helper_scripts.tar.gz ├── gen_asm_defines.awk ├── osx_build_instructions.txt ├── gen_asm_script.sh ├── savestate_convert.txt ├── osx_build_bundle.sh ├── build_modules_src.sh └── build_bundle_src.sh ├── .gitignore ├── .github └── workflows │ └── scripts │ ├── ci_backup_mingw_deps.sh │ ├── ci_get_libglew_i386.sh │ ├── ci_backup_msvc_deps.cmd │ ├── ci_nightly_artifacts.sh │ ├── ci_install_ubuntu_deps.sh │ └── ci_msvc_build.cmd ├── .gitattributes ├── doc ├── emuwiki-api-doc │ └── Home.mediawiki └── font-license ├── src ├── device │ ├── r4300 │ │ ├── new_dynarec │ │ │ ├── x86 │ │ │ │ ├── assem_x86.h │ │ │ │ ├── asm_defines_gas.h │ │ │ │ └── asm_defines_nasm.h │ │ │ ├── arm │ │ │ │ ├── assem_arm.h │ │ │ │ ├── asm_defines_gas.h │ │ │ │ ├── asm_defines_nasm.h │ │ │ │ └── arm_cpu_features.h │ │ │ ├── arm64 │ │ │ │ ├── assem_arm64.h │ │ │ │ ├── asm_defines_gas.h │ │ │ │ └── asm_defines_nasm.h │ │ │ └── x64 │ │ │ │ ├── assem_x64.h │ │ │ │ ├── asm_defines_gas.h │ │ │ │ └── asm_defines_nasm.h │ │ ├── pure_interp.h │ │ ├── instr_counters.h │ │ ├── cp2.h │ │ ├── x86 │ │ │ ├── assemble_struct.h │ │ │ └── regcache.h │ │ ├── cp2.c │ │ ├── tlb.h │ │ ├── x86_64 │ │ │ ├── assemble_struct.h │ │ │ └── regcache.h │ │ └── recomp.h │ ├── pif │ │ ├── bootrom_hle.h │ │ └── cic.h │ ├── controllers │ │ ├── paks │ │ │ ├── biopak.h │ │ │ ├── rumblepak.h │ │ │ ├── transferpak.h │ │ │ ├── mempak.h │ │ │ └── biopak.c │ │ └── vru_controller.h │ ├── cart │ │ ├── is_viewer.h │ │ ├── eeprom.h │ │ ├── af_rtc.h │ │ ├── sram.h │ │ └── cart_rom.h │ ├── gb │ │ ├── m64282fp.h │ │ └── mbc3_rtc.h │ ├── rcp │ │ ├── ri │ │ │ ├── ri_controller.c │ │ │ └── ri_controller.h │ │ ├── rdp │ │ │ └── fb.h │ │ └── mi │ │ │ └── mi_controller.h │ └── rdram │ │ └── rdram.h ├── main │ ├── lirc.h │ ├── screenshot.h │ ├── sdl_key_converter.h │ ├── eventloop.h │ ├── version.h │ ├── profile.h │ ├── cheat.h │ ├── workqueue.h │ └── savestates.h ├── osal │ ├── dynamiclib.h │ ├── dynamiclib_unix.c │ ├── dynamiclib_win32.c │ └── files.h ├── backends │ ├── clock_ctime_plus_delta.h │ ├── api │ │ ├── clock_backend.h │ │ ├── rumble_backend.h │ │ ├── audio_out_backend.h │ │ ├── storage_backend.h │ │ ├── video_capture_backend.c │ │ └── controller_input_backend.h │ ├── clock_ctime_plus_delta.c │ ├── file_storage.h │ ├── plugins_compat │ │ └── plugins_compat.h │ └── dummy_video_capture.c ├── api │ ├── config.h │ ├── api_export.ver │ ├── vidext.h │ ├── debugger.h │ ├── callbacks.h │ └── callbacks.c ├── plugin │ ├── dummy_rsp.h │ ├── dummy_rsp.c │ ├── dummy_audio.h │ ├── dummy_video.h │ └── dummy_input.h └── debugger │ ├── dbg_debugger.h │ ├── dbg_decoder.h │ └── dbg_breakpoints.h ├── INSTALL ├── appveyor.yml └── LICENSES /data/font.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/mupen64plus-core/HEAD/data/font.ttf -------------------------------------------------------------------------------- /tools/joymodel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/mupen64plus-core/HEAD/tools/joymodel.png -------------------------------------------------------------------------------- /tools/m64p_helper_scripts.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/mupen64plus-core/HEAD/tools/m64p_helper_scripts.tar.gz -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /projects/unix/_obj*/ 2 | /projects/unix/libmupen64plus*.so* 3 | /.vscode 4 | /projects/unix/*.dll 5 | /src/asm_defines/*.h 6 | -------------------------------------------------------------------------------- /tools/gen_asm_defines.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | nasm_file = dest_dir"/asm_defines_nasm.h"; 3 | gas_file = dest_dir"/asm_defines_gas.h"; 4 | } 5 | 6 | /@ASM_DEFINE offsetof_struct_[a-zA-Z_0-9]+ 0x[0-9a-fA-F]+/ { 7 | print "%define "$2" ("$3")" > nasm_file; 8 | print "#define "$2" ("$3")" > gas_file; 9 | } 10 | 11 | END {} 12 | -------------------------------------------------------------------------------- /.github/workflows/scripts/ci_backup_mingw_deps.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e +u 3 | 4 | if [[ ${#} -ne 1 ]]; then exit 9; fi 5 | 6 | export ENV_MSYS="$(echo "${1}" | tr [A-Z] [a-z])" 7 | export DEPS="$(LC_ALL=C grep "${ENV_MSYS}" pkg/ldd.log | tr -s '\t' ' ' | sort | cut -d ' ' -f4 | tr '\\' '/' | tr -d ':')" 8 | 9 | rm -f pkg/ldd.log 10 | 11 | if [[ "${DEPS}" == "" ]]; then 12 | echo ":: None..." 13 | exit 0 14 | fi 15 | 16 | for LIB in ${DEPS}; do 17 | echo ":: Copying ${LIB##*/}" 18 | cp "/${LIB}" pkg/ 19 | done 20 | 21 | exit 0 22 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | # normal text files 4 | *.6 text 5 | AUTHORS text 6 | *.c text 7 | *.cfg text 8 | *.cht text 9 | *.conf text 10 | COPYING text 11 | *.cpp text 12 | *.def text 13 | *-license text 14 | *.h text 15 | *.html text 16 | *.ini text 17 | INSTALL text 18 | LICENSES text 19 | Makefile text 20 | *.py text 21 | README text 22 | RELEASE text 23 | *.S text 24 | *.sh text 25 | *.txt text 26 | *.ver text 27 | 28 | # windows specific text files 29 | *.cmd text eol=crlf 30 | *.sln text eol=crlf 31 | *.vcproj text eol=crlf 32 | *.vcxproj text eol=crlf 33 | *.vcxproj.filters text eol=crlf 34 | 35 | # binary files 36 | *.gz binary 37 | *.ttf binary 38 | cursor.tex binary 39 | font.tex binary 40 | -------------------------------------------------------------------------------- /doc/emuwiki-api-doc/Home.mediawiki: -------------------------------------------------------------------------------- 1 | =User Documentation= 2 | == Configuration Parameters == 3 | === [[Mupen64Plus Core Parameters|Core Parameters]] === 4 | 5 | This section lists the names and descriptions of all of the configuration parameters used by the Core library. 6 | 7 | === [[Mupen64Plus Plugin Parameters|Plugin Parameters]] === 8 | 9 | This section lists the names and descriptions of all of the configuration parameters used by the Plugin libraries. 10 | 11 | =Developer Documentation= 12 | 13 | == [[Mupen64Plus v2.0 Core API v1.0|Mupen64Plus v2.0 API]] == 14 | 15 | The interface between Mupen64Plus and its compatible plugins is (slightly) different from other N64 emulators. The new API is described in detail in the documentation here. 16 | 17 | -------------------------------------------------------------------------------- /.github/workflows/scripts/ci_get_libglew_i386.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e +u 3 | 4 | # NOTE: There is no native "libglew-dev:i386" in Ubuntu 22.04, we will use Debian ones... 5 | 6 | export GLEWVER="$(apt list libglew-dev | grep "amd64" | cut -d ' ' -f2)" 7 | export PKGS="$(apt list libglew* | grep "${GLEWVER}" | cut -d '/' -f1)" 8 | export DEBSOURCE="http://http.us.debian.org/debian/pool/main/g/glew/" 9 | export PKGVER_LS="$(curl -sS ${DEBSOURCE} | grep "${GLEWVER}" | grep "amd64" | cut -d '_' -f2 | sort)" 10 | if [[ "${PKGVER_LS}" != "" ]]; then 11 | for VER in ${PKGVER_LS}; do export PKGVER="${VER}"; done 12 | cd /tmp 13 | for PKG in ${PKGS}; do 14 | for ARCH in amd64 i386; do curl -L -O "${DEBSOURCE}${PKG}_${PKGVER}_${ARCH}.deb"; done 15 | done 16 | sudo dpkg -i libglew*${PKGVER}*.deb 17 | else 18 | exit 9 19 | fi 20 | 21 | sudo ldconfig 22 | 23 | exit 0 24 | -------------------------------------------------------------------------------- /src/device/r4300/new_dynarec/x86/assem_x86.h: -------------------------------------------------------------------------------- 1 | #ifndef M64P_DEVICE_R4300_NEW_DYNAREC_X86_ASSEM_X86_H 2 | #define M64P_DEVICE_R4300_NEW_DYNAREC_X86_ASSEM_X86_H 3 | 4 | #define EAX 0 5 | #define ECX 1 6 | #define EDX 2 7 | #define EBX 3 8 | #define ESP 4 9 | #define EBP 5 10 | #define ESI 6 11 | #define EDI 7 12 | 13 | #define HOST_REGS 8 14 | #define HOST_CCREG ESI 15 | #define HOST_BTREG EBP 16 | #define EXCLUDE_REG ESP 17 | 18 | //#define IMM_PREFETCH 1 19 | #define HOST_IMM_ADDR32 1 20 | #define INVERTED_CARRY 1 21 | #define DESTRUCTIVE_WRITEBACK 1 22 | #define DESTRUCTIVE_SHIFT 1 23 | 24 | #define USE_MINI_HT 1 25 | 26 | #define TARGET_SIZE_2 25 // 2^25 = 32 megabytes 27 | #define JUMP_TABLE_SIZE 0 // Not needed for 32-bit x86 28 | 29 | /* x86 calling convention: 30 | caller-save: %eax %ecx %edx 31 | callee-save: %ebp %ebx %esi %edi */ 32 | 33 | #endif /* M64P_DEVICE_R4300_NEW_DYNAREC_X86_ASSEM_X86_H */ 34 | -------------------------------------------------------------------------------- /tools/osx_build_instructions.txt: -------------------------------------------------------------------------------- 1 | Mupen64plus build under OSX 10.9.5 (Mavericks) with Xcode 6.1.1 2 | 3 | 1. Install command-line tools through xcode 4 | - Xcode --> Preferences... --> Downloads tab --> Components page --> Command Line Tools 5 | 2. Install mac ports 6 | - download page: http://www.macports.org/install.php 7 | - .pkg installer for Mavericks 8 | 3. Install Git via macports 9 | - command line: "sudo port install git” 10 | 4. Get m64p_helper_scripts.tar.gz from https://mupen64plus.org/wiki/index.php/CompilingFromGit 11 | - unzip into build folder 12 | - run "./m64p_get.sh" 13 | 5. Install other build dependencies: 14 | - sudo port install pkgconfig 15 | - sudo port install libpng 16 | - edit /opt/local/etc/macports/variants.conf: 17 | - add: +no_x11 +quartz 18 | - sudo port install libSDL2 19 | - sudo port install freetype 20 | - sudo port install boost 21 | 6. Run "./m64p_build.sh" 22 | 23 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Mupen64Plus-Core INSTALL 2 | ------------------------ 3 | 4 | This text file was written to explain the installation process of the 5 | Mupen64Plus-Core module. 6 | 7 | If this module is part of a Mupen64Plus source code bundle, the user should run 8 | the "m64p_install.sh" script in the root of the unzipped bundle to install all 9 | of the included modules in the bundle. 10 | 11 | If this module is a standalone source code release, you should build the library 12 | from source code and install it via the makefile, like this: 13 | 14 | $ cd projects/unix 15 | $ make all 16 | $ sudo make install 17 | 18 | If you want to build the Mupen64Plus-Core module for installation in a home 19 | folder for a single user, you may build it like this (replacing 20 | with your desired local installation path): 21 | 22 | $ cd projects/unix 23 | $ make all SHAREDIR= 24 | $ make install LIBDIR= SHAREDIR= 25 | 26 | 27 | -------------------------------------------------------------------------------- /.github/workflows/scripts/ci_backup_msvc_deps.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal enableextensions enabledelayedexpansion 3 | cls 4 | if not exist "projects\msvc\" exit /b 9 5 | 6 | set ARCH= 7 | set DEPS= 8 | if "%*" == "" exit /b 8 9 | for %%P in (%*) do ( 10 | if /i "%%P" == "x86" (set ARCH=x86) else ( 11 | if /i "%%P" == "x64" (set ARCH=x64) else ( 12 | set "DEPS=!DEPS! %%P") ) 13 | ) 14 | 15 | if not defined ARCH exit /b 7 16 | 17 | if exist "data\" xcopy /e data pkg 18 | if errorlevel 1 exit /b 6 19 | if exist "pkg\mupen64plus.desktop" del /f /q pkg\mupen64plus.desktop 20 | 21 | if not defined DEPS ( 22 | echo :: None... 23 | exit /b 0 24 | ) 25 | 26 | set PKG=%CD%\pkg 27 | cd ..\mupen64plus-win32-deps 28 | if errorlevel 1 exit /b 5 29 | for %%D in (%DEPS%) do ( 30 | for /f "tokens=*" %%T in ('dir /b /s %%D ^| findstr "%ARCH%"') do ( 31 | if exist "%%T" xcopy "%%T" "%PKG%\" 32 | if errorlevel 1 exit /b 4 33 | ) 34 | ) 35 | 36 | exit /b 0 37 | -------------------------------------------------------------------------------- /.github/workflows/scripts/ci_nightly_artifacts.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e +u 3 | 4 | export REPO="${PWD##*/}" 5 | if [[ "${REPO}" == "" ]]; then exit 9; fi 6 | 7 | rm -fr pkg 8 | mkdir pkg 9 | cd binaries 10 | for BIN in *; do 11 | cd "${BIN}" 12 | case "${BIN}" in 13 | *msvc* | *msys2* ) 14 | echo ":: Creating ${BIN}.zip" 15 | zip -r "../../pkg/${BIN}.zip" * 16 | ;; 17 | * ) 18 | echo ":: Recovering ${BIN}.tar.gz" 19 | mv *.tar.gz ../../pkg/ 20 | ;; 21 | esac 22 | cd .. 23 | done 24 | cd ../pkg 25 | echo "" 26 | 27 | for ZIP in *; do 28 | ls -gG ${ZIP} 29 | tigerdeep -lz ${ZIP} >> ../${REPO}.tiger.txt 30 | sha256sum ${ZIP} >> ../${REPO}.sha256.txt 31 | sha512sum ${ZIP} >> ../${REPO}.sha512.txt 32 | b2sum ${ZIP} >> ../${REPO}.blake2.txt 33 | done 34 | mv ../${REPO}.*.txt . 35 | echo "" 36 | 37 | for HASH in tiger sha256 sha512 blake2; do 38 | echo "${HASH}:" | tr [a-z] [A-Z] 39 | cat *.${HASH}.txt 40 | echo "" 41 | done 42 | 43 | if [[ -f "${GITHUB_ENV}" ]]; then 44 | git tag -f nightly-build 45 | git push -f origin nightly-build 46 | fi 47 | 48 | exit 0 49 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.0.{build} 2 | 3 | image: Visual Studio 2022 4 | 5 | skip_tags: true 6 | 7 | skip_commits: 8 | files: 9 | - '**/*.md' 10 | - .github/ 11 | - data/* 12 | - .gitattributes 13 | - .gitignore 14 | - .travis.yml 15 | - README 16 | 17 | configuration: 18 | - New_Dynarec_Release 19 | - Release 20 | platform: 21 | - Win32 22 | - x64 23 | 24 | before_build: 25 | - git tag --delete nightly-build 26 | - git clone --depth 1 https://github.com/mupen64plus/mupen64plus-win32-deps.git ..\mupen64plus-win32-deps 27 | 28 | build_script: 29 | - msbuild projects\msvc\mupen64plus-core.vcxproj /p:Configuration=%configuration%;Platform=%platform% 30 | 31 | after_build: 32 | - ps: $env:rev1 = git describe --tags 33 | - set rev2=%platform% 34 | - if "%rev2%"=="Win32" set rev2=x86 35 | - set rev3=%configuration% 36 | - if "%rev3%" NEQ "Release" set rev3=NewDynarec 37 | - set filepkg=mupen64plus-core_v%rev1%_%rev2%-%rev3% 38 | - cd projects\msvc\%platform%\%configuration% 39 | - 7z a -t7z ..\..\..\..\build\%filepkg%.7z *.dll 40 | 41 | artifacts: 42 | - path: build\$(filepkg).7z 43 | name: $(filepkg) 44 | -------------------------------------------------------------------------------- /src/main/lirc.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | lirc.h - description 3 | ------------------- 4 | begin : Friday 11 Jan 2008 5 | copyright : (C) 2008 by DarkJezter 6 | ***************************************************************************/ 7 | 8 | /*************************************************************************** 9 | * * 10 | * This program is free software; you can redistribute it and/or modify * 11 | * it under the terms of the GNU General Public License as published by * 12 | * the Free Software Foundation; either version 2 of the License, or * 13 | * (at your option) any later version. * 14 | * * 15 | ***************************************************************************/ 16 | 17 | #ifndef __LIRC_H__ 18 | #define __LIRC_H__ 19 | 20 | extern void lircStart(void); 21 | extern void lircStop(void); 22 | extern void lircCheckInput(void); 23 | 24 | #endif //__LIRC_H__ 25 | 26 | -------------------------------------------------------------------------------- /src/device/r4300/new_dynarec/arm/assem_arm.h: -------------------------------------------------------------------------------- 1 | #ifndef M64P_DEVICE_R4300_NEW_DYNAREC_ARM_ASSEM_ARM_H 2 | #define M64P_DEVICE_R4300_NEW_DYNAREC_ARM_ASSEM_ARM_H 3 | 4 | #define HOST_REGS 13 5 | #define HOST_CCREG 10 6 | #define HOST_BTREG 8 7 | #define EXCLUDE_REG 11 8 | 9 | #define HOST_IMM8 1 10 | #define HAVE_CMOV_IMM 1 11 | #define CORTEX_A8_BRANCH_PREDICTION_HACK 1 12 | #define USE_MINI_HT 1 13 | //#define REG_PREFETCH 1 14 | #define HAVE_CONDITIONAL_CALL 1 15 | #define RAM_OFFSET 1 16 | 17 | /* ARM calling convention: 18 | r0-r3, r12: caller-save 19 | r4-r11: callee-save */ 20 | 21 | #define ARG1_REG 0 22 | #define ARG2_REG 1 23 | #define ARG3_REG 2 24 | #define ARG4_REG 3 25 | 26 | /* GCC register naming convention: 27 | r10 = sl (base) 28 | r11 = fp (frame pointer) 29 | r12 = ip (scratch) 30 | r13 = sp (stack pointer) 31 | r14 = lr (link register) 32 | r15 = pc (program counter) */ 33 | 34 | #define FP 11 35 | #define LR 14 36 | #define CALLER_SAVED_REGS 0x100f 37 | #define HOST_TEMPREG 14 38 | 39 | // Note: FP is set to &dynarec_local when executing generated code. 40 | // Thus the local variables are actually global and not on the stack. 41 | 42 | #define TARGET_SIZE_2 25 // 2^25 = 32 megabytes 43 | #define JUMP_TABLE_SIZE (sizeof(jump_table_symbols)*2) 44 | 45 | #endif /* M64P_DEVICE_R4300_NEW_DYNAREC_ARM_ASSEM_ARM_H */ 46 | -------------------------------------------------------------------------------- /src/device/r4300/new_dynarec/arm64/assem_arm64.h: -------------------------------------------------------------------------------- 1 | #ifndef M64P_DEVICE_R4300_NEW_DYNAREC_ARM_ASSEM_ARM64_H 2 | #define M64P_DEVICE_R4300_NEW_DYNAREC_ARM_ASSEM_ARM64_H 3 | 4 | #define HOST_REGS 29 5 | #define HOST_CCREG 20 /* callee-save */ 6 | #define HOST_BTREG 19 /* callee-save */ 7 | #define EXCLUDE_REG 29 /* FP */ 8 | 9 | //#define DISABLE_BLOCK_LINKING 1 10 | #define NATIVE_64 1 11 | #define HOST_IMM8 1 12 | //#define HAVE_CMOV_IMM 1 13 | //#define CORTEX_A8_BRANCH_PREDICTION_HACK 1 14 | //#define REG_PREFETCH 1 15 | //#define HAVE_CONDITIONAL_CALL 1 16 | #define RAM_OFFSET 1 17 | #define USE_MINI_HT 1 18 | 19 | /* ARM calling convention: 20 | x0-x18: caller-save 21 | x19-x28: callee-save */ 22 | 23 | #define ARG1_REG 0 24 | #define ARG2_REG 1 25 | #define ARG3_REG 2 26 | #define ARG4_REG 3 27 | 28 | /* GCC register naming convention: 29 | x16 = ip0 (scratch) 30 | x17 = ip1 (scratch) 31 | x29 = fp (frame pointer) 32 | x30 = lr (link register) 33 | x31 = sp (stack pointer) */ 34 | 35 | #define FP 29 36 | #define LR 30 37 | #define WZR 31 38 | #define XZR WZR 39 | #define CALLER_SAVED_REGS 0x7ffff 40 | #define HOST_TEMPREG 30 41 | 42 | // Note: FP is set to &dynarec_local when executing generated code. 43 | // Thus the local variables are actually global and not on the stack. 44 | 45 | #define TARGET_SIZE_2 25 // 2^25 = 32 megabytes 46 | #define JUMP_TABLE_SIZE (sizeof(jump_table_symbols)*2) 47 | 48 | #endif /* M64P_DEVICE_R4300_NEW_DYNAREC_ARM_ASSEM_ARM64_H */ 49 | -------------------------------------------------------------------------------- /tools/gen_asm_script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | set +f 4 | 5 | # Set the "print" outputs 6 | NASM_FILE="$1/asm_defines_nasm.h" 7 | GAS_FILE="$1/asm_defines_gas.h" 8 | rm -f "$1/asm_defines_*" 9 | 10 | # Adaptation of 'gen_asm_defines.awk' / 'gen_asm_script.cmd': 11 | # 12 | # 1. Display 'asm_defines.o' as a list, looking only for 13 | # patterns '@ASM_DEFINE' 14 | # 2. Sort for easy reading, the result is interpreted as an array or 15 | # worksheet with ' ' as a self-imposed delimiter in the 'cut' command 16 | # 3. The cut's '-f2,3' discards column "1" (@ASM_DEFINE) and anything 17 | # beyond "3", take "2" (offset* column), the delimiters and 18 | # "3" (hex* column) to be kept 19 | # 4. After setting 'GAS_OBJSTR', all the next lines (LF) are degraded 20 | # to ' ' and thus all patterns in columns "2" and "3" become a 21 | # predictable text sequence 22 | GAS_OBJSTR=$(LC_ALL=C grep -a "@ASM_DEFINE" "$2" | sort | cut -d ' ' -f2,3) 23 | for GAS_CURSTR in ${GAS_OBJSTR}; do 24 | 25 | # 5. If the current value doesn't contain a hex glob (pattern matching), 26 | # it must be a "offset* value" 27 | if [ "${GAS_CURSTR:0:2}" != "0x" ]; then 28 | 29 | # 6. Save current value and repeat step 5 on the next value 30 | GAS_OFFSET=${GAS_CURSTR} 31 | else 32 | 33 | # 7. Print current values and repeat steps 5-7 on the next value 34 | # until EOL is reached 35 | echo "%define ${GAS_OFFSET} (${GAS_CURSTR})" >> "$NASM_FILE" 36 | echo "#define ${GAS_OFFSET} (${GAS_CURSTR})" >> "$GAS_FILE" 37 | fi 38 | done 39 | -------------------------------------------------------------------------------- /.github/workflows/scripts/ci_install_ubuntu_deps.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e +u 3 | 4 | if [[ ${#} -lt 2 ]]; then exit 9; fi 5 | 6 | unset ARCH_DEP CC_DEP 7 | export BUILD_DEPS_I386="crossbuild-essential-i386 g++${C_GCC_SUFFIX}-i686-linux-gnu gcc${C_GCC_SUFFIX}-i686-linux-gnu libc6-i386" 8 | export HOTFIX_I386="libatomic1:i386 libgcc-s1:i386 libstdc++6:i386 ${HOTFIX_I386}" 9 | export ENV_ARGS="$(echo "${*}" | tr [A-Z] [a-z])" 10 | 11 | for ARG in ${ENV_ARGS}; do 12 | case "${ARG}" in 13 | clang ) 14 | export CC_DEP="clang${C_CLANG_SUFFIX}" 15 | ;; 16 | gcc ) 17 | export CC_DEP="g++${C_GCC_SUFFIX} gcc${C_GCC_SUFFIX}" 18 | ;; 19 | multilib ) 20 | export BUILD_DEPS_I386="g++${C_GCC_SUFFIX}-multilib gcc${C_GCC_SUFFIX}-multilib libc6-dev-i386" 21 | ;; 22 | x64 ) 23 | export ARCH_DEP="x64" 24 | ;; 25 | x86 ) 26 | export ARCH_DEP="x86" 27 | ;; 28 | esac 29 | done 30 | 31 | if [[ -z ${ARCH_DEP} ]]; then exit 8; fi 32 | if [[ -z ${CC_DEP} ]]; then exit 7; fi 33 | 34 | sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test 35 | if [[ "${ARCH_DEP}" == "x86" ]]; then sudo dpkg --add-architecture i386; fi 36 | sudo apt-get update 37 | sudo apt-get -y install build-essential git nasm pkg-config ${CC_DEP} ${BUILD_DEPS} 38 | if [[ "${ARCH_DEP}" == "x86" ]]; then 39 | if [[ "${BUILD_DEPS}" != "" ]]; then 40 | for DEP in ${BUILD_DEPS}; do 41 | if [[ "${DEP}" != "libglew-dev" ]]; then export BUILD_DEPS_I386="${BUILD_DEPS_I386} ${DEP}:i386"; fi 42 | done 43 | fi 44 | sudo apt-get --reinstall -y install ${BUILD_DEPS_I386} ${HOTFIX_I386} 45 | fi 46 | sudo ldconfig 47 | 48 | exit 0 49 | -------------------------------------------------------------------------------- /tools/savestate_convert.txt: -------------------------------------------------------------------------------- 1 | ============================================================================== 2 | savestate_convert.txt - Mupen64Plus - July 12th, 2008 3 | 4 | This conversion tool was written to help users migrate their savestate files 5 | when there are changes to the savestate file format which break backward 6 | compatibility. 7 | 8 | To compile the conversion tool, open a console window, go to the root of your 9 | Mupen64Plus source code, and type: 10 | 11 | gcc -o savestate_convert -lz tools/savestate_convert.c 12 | 13 | This will create a small command-line application called 'savestate_convert'. 14 | This program takes only one command-line parameter, which is a path to the 15 | savestate file that you want to update. The old savestate file will be 16 | overwritten with the new one, so you may wish to first make a backup copy 17 | of the savestate file. If you update a savestate file to a newer version, 18 | older versions of Mupen64Plus will not be able to load it. 19 | 20 | If you wish to update all of the savestate files in your home directory, you 21 | may do so with the following bash command: 22 | 23 | for file in ~/.mupen64plus/save/*.st*; do ./savestate_convert "${file}"; done 24 | 25 | ============================================================================== 26 | Savestate File Format History: 27 | 28 | version 0: 29 | - Original (Unversioned) file format 30 | - used by Mupen64 v0.5 and Mupen64Plus up to v1.4 31 | 32 | version 1.0: 33 | - bugfix: TLB was not being entirely saved and restored 34 | - added small header with magic number and version number 35 | - introduced in rev 758 of Mupen64Plus SVN repository (trunk) 36 | 37 | -------------------------------------------------------------------------------- /src/main/screenshot.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - screenshot.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2008 Richard42 * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_MAIN_SCREENSHOT_H 23 | #define M64P_MAIN_SCREENSHOT_H 24 | 25 | void ScreenshotRomOpen(void); 26 | void TakeScreenshot(int iFrameNumber); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/device/r4300/pure_interp.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - pure_interp.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2002 Hacktarux * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_R4300_PURE_INTERP_H 23 | #define M64P_DEVICE_R4300_PURE_INTERP_H 24 | 25 | struct r4300_core; 26 | 27 | void run_pure_interpreter(struct r4300_core* r4300); 28 | 29 | #endif /* M64P_DEVICE_R4300_PURE_INTERP_H */ 30 | -------------------------------------------------------------------------------- /src/device/r4300/instr_counters.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - instr_counters.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2002 Hacktarux * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_R4300_INSTR_COUNTERS_H 23 | #define M64P_DEVICE_R4300_INSTR_COUNTERS_H 24 | 25 | extern unsigned int instr_count[132]; 26 | 27 | void instr_counters_print(void); 28 | 29 | #endif /* M64P_DEVICE_R4300_INSTR_COUNTERS_H */ 30 | -------------------------------------------------------------------------------- /src/osal/dynamiclib.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus-core - osal/dynamiclib.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2009 Richard Goedeken * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #if !defined(OSAL_DYNAMICLIB_H) 23 | #define OSAL_DYNAMICLIB_H 24 | 25 | #include "api/m64p_types.h" 26 | 27 | m64p_function osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName); 28 | 29 | #endif /* #define OSAL_DYNAMICLIB_H */ 30 | 31 | -------------------------------------------------------------------------------- /src/backends/clock_ctime_plus_delta.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - clock_ctime_plus_delta.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_BACKENDS_CLOCK_CTIME_PLUS_DELTA_H 23 | #define M64P_BACKENDS_CLOCK_CTIME_PLUS_DELTA_H 24 | 25 | #include "backends/api/clock_backend.h" 26 | 27 | extern const struct clock_backend_interface g_iclock_ctime_plus_delta; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/backends/api/clock_backend.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - clock_backend.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2016 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_BACKENDS_API_CLOCK_BACKEND_H 23 | #define M64P_BACKENDS_API_CLOCK_BACKEND_H 24 | 25 | #include 26 | 27 | struct clock_backend_interface 28 | { 29 | /* Returns the current time 30 | */ 31 | time_t (*get_time)(void* clock); 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/device/pif/bootrom_hle.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - bootrom_hle.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2016 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_PIF_BOOTROM_HLE_H 23 | #define M64P_DEVICE_PIF_BOOTROM_HLE_H 24 | 25 | struct r4300_core; 26 | 27 | /* Simulates end result of PIFBootROM execution. 28 | * This bypasses entirely the execution of real PIFBootROM */ 29 | void pif_bootrom_hle_execute(struct r4300_core* r4300); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/api/config.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus-core - api/config.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2009 Richard Goedeken * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | /* This file contains the Core configuration functions 23 | */ 24 | 25 | #include "m64p_types.h" 26 | 27 | /* these functions are only to be used within the Core library */ 28 | 29 | m64p_error ConfigInit(const char *ConfigDirOverride, const char *DataDirOverride); 30 | m64p_error ConfigShutdown(void); 31 | -------------------------------------------------------------------------------- /src/device/controllers/paks/biopak.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - biopak.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2017 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_CONTROLLERS_PAKS_BIOPAK_H 23 | #define M64P_DEVICE_CONTROLLERS_PAKS_BIOPAK_H 24 | 25 | #include "device/controllers/game_controller.h" 26 | 27 | struct biopak 28 | { 29 | unsigned int bpm; 30 | }; 31 | 32 | void init_biopak(struct biopak* bpk, 33 | unsigned int bpm); 34 | 35 | extern const struct pak_interface g_ibiopak; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/main/sdl_key_converter.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - sdl_key_converter.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2013 Mupen64plus development team * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #include 23 | 24 | #include "osal/preproc.h" 25 | 26 | uint16_t sdl_keysym2scancode(uint16_t keysym); 27 | uint16_t sdl_scancode2keysym(uint16_t scancode); 28 | 29 | static osal_inline uint16_t sdl_keysym2native(uint16_t keysym) 30 | { 31 | return keysym; 32 | } 33 | 34 | static osal_inline uint16_t sdl_native2keysym(uint16_t native) 35 | { 36 | return native; 37 | } 38 | -------------------------------------------------------------------------------- /src/backends/api/rumble_backend.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - rumble_backend.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2016 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_BACKENDS_API_RUMBLE_BACKEND_H 23 | #define M64P_BACKENDS_API_RUMBLE_BACKEND_H 24 | 25 | #include 26 | 27 | enum rumble_action 28 | { 29 | RUMBLE_STOP, 30 | RUMBLE_START 31 | }; 32 | 33 | struct rumble_backend_interface 34 | { 35 | /* Start or stop rumbling 36 | */ 37 | void (*exec)(void* rumble, enum rumble_action action); 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/main/eventloop.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - eventloop.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2009 Richard Goedeken * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #if !defined(EVENTLOOP_H) 23 | #define EVENTLOOP_H 24 | 25 | extern int event_set_core_defaults(void); 26 | extern void event_initialize(void); 27 | extern void event_sdl_keydown(int keysym, int keymod); 28 | extern void event_sdl_keyup(int keysym, int keymod); 29 | extern int event_gameshark_active(void); 30 | extern void event_set_gameshark(int active); 31 | 32 | #endif /* define(EVENTLOOP_H) */ 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/backends/clock_ctime_plus_delta.c: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - get_time_using_time_plus_delta.c * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #include "clock_ctime_plus_delta.h" 23 | 24 | #include 25 | 26 | 27 | time_t ctime_plus_delta_get_time(void* clock) 28 | { 29 | time_t user_delta = (clock == NULL) 30 | ? 0 31 | : *(time_t*)clock; 32 | 33 | return user_delta + time(NULL); 34 | } 35 | 36 | const struct clock_backend_interface g_iclock_ctime_plus_delta = 37 | { 38 | ctime_plus_delta_get_time 39 | }; 40 | -------------------------------------------------------------------------------- /.github/workflows/scripts/ci_msvc_build.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal enableextensions disabledelayedexpansion 3 | cls 4 | if not exist "projects\msvc\" exit /b 9 5 | 6 | set ARCH= 7 | set CONF=Release 8 | if "%*" == "" exit /b 8 9 | for %%P in (%*) do ( 10 | if /i "%%P" == "x86" set ARCH_ARG=x86& set ARCH=Win32 11 | if /i "%%P" == "x64" set ARCH_ARG=x64& set ARCH=x64 12 | if /i "%%P" == "newdyn" set CONF=New_Dynarec_Release 13 | ) 14 | 15 | if not defined ARCH exit /b 7 16 | 17 | for %%T in (.) do set REPO=%%~nxT 18 | if not defined REPO exit /b 6 19 | 20 | set ARTIFACT= 21 | set FPROJ= 22 | set EXT=dll 23 | echo %REPO% | findstr "ui-console" >nul 2>&1 24 | if not errorlevel 1 set EXT=exe 25 | if not defined TOOLSET set TOOLSET=v143 26 | 27 | for /f "tokens=1" %%R in ('git rev-parse --short HEAD') do set G_REV=%%R 28 | set PKG_NAME=%REPO%-msvc-%ARCH_ARG%-g%G_REV% 29 | if exist "%GITHUB_ENV%" ( 30 | type "%GITHUB_ENV%" | findstr "PKG_NAME=%PKG_NAME%" >nul 2>&1 31 | if errorlevel 1 echo PKG_NAME=%PKG_NAME%>> "%GITHUB_ENV%" 32 | ) 33 | 34 | echo. 35 | msbuild --version 36 | echo. 37 | 38 | if not exist "..\mupen64plus-win32-deps\" git clone --depth 1 https://github.com/mupen64plus/mupen64plus-win32-deps.git ..\mupen64plus-win32-deps 39 | 40 | pushd projects\msvc\ 41 | for /f "tokens=*" %%F in ('dir /b *.vcxproj') do set FPROJ=%%F 42 | popd 43 | if not defined FPROJ exit /b 5 44 | 45 | echo. 46 | msbuild "projects\msvc\%FPROJ%" /p:Configuration=%CONF%;Platform=%ARCH%;PlatformToolset=%TOOLSET% /t:Rebuild 47 | if errorlevel 1 exit /b 4 48 | echo. 49 | 50 | if exist "projects\msvc\%ARCH%\Release\mupen64plus.dll" ren "projects\msvc\%ARCH%\Release\mupen64plus.dll" mupen64plus-old.dll 51 | 52 | pushd projects\msvc\%ARCH%\%CONF%\ 53 | for /f "tokens=*" %%S in ('dir /b mupen64plus*%EXT%') do set ARTIFACT=%%S 54 | popd 55 | if not defined ARTIFACT exit /b 3 56 | 57 | md pkg 2>nul 58 | xcopy "projects\msvc\%ARCH%\%CONF%\%ARTIFACT%" pkg\ 59 | if errorlevel 1 exit /b 2 60 | dir "pkg\%ARTIFACT%" 61 | 62 | exit /b 0 63 | -------------------------------------------------------------------------------- /src/device/controllers/vru_controller.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - vru_controller.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_SI_VRU_CONTROLLER_H 23 | #define M64P_DEVICE_SI_VRU_CONTROLLER_H 24 | 25 | #include "backends/api/joybus.h" 26 | 27 | #include 28 | #include 29 | 30 | /* Controller Joybus interface */ 31 | extern const struct joybus_device_interface 32 | g_ijoybus_vru_controller; 33 | 34 | /* Controller flavors */ 35 | extern const struct game_controller_flavor g_vru_controller_flavor; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /tools/osx_build_bundle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ./m64p_build.sh 4 | 5 | APP_CONTENTS="./mupen64plus.app/Contents" 6 | 7 | rm -rf $APP_CONTENTS 8 | mkdir -p $APP_CONTENTS/MacOS/ 9 | mkdir -p $APP_CONTENTS/Frameworks/ 10 | 11 | mv test/mupen64plus $APP_CONTENTS/MacOS/ 12 | mv test/*.dylib $APP_CONTENTS/Frameworks/ 13 | 14 | FIX_LIST="-x $APP_CONTENTS/MacOS/mupen64plus \ 15 | -x $APP_CONTENTS/Frameworks/libmupen64plus.dylib \ 16 | -x $APP_CONTENTS/Frameworks/mupen64plus-audio-sdl.dylib \ 17 | -x $APP_CONTENTS/Frameworks/mupen64plus-input-sdl.dylib \ 18 | -x $APP_CONTENTS/Frameworks/mupen64plus-rsp-hle.dylib \ 19 | -x $APP_CONTENTS/Frameworks/mupen64plus-video-rice.dylib \ 20 | -x $APP_CONTENTS/Frameworks/mupen64plus-video-glide64mk2.dylib" 21 | 22 | dylibbundler -of -b $FIX_LIST -p @executable_path/../Frameworks/ -d $APP_CONTENTS/Frameworks/ 23 | 24 | mkdir -p $APP_CONTENTS/Resources 25 | mv test/*.ini test/*.ttf $APP_CONTENTS/Resources 26 | mv test/mupen* $APP_CONTENTS/Resources 27 | mv test $APP_CONTENTS/SharedSupport 28 | 29 | mv $APP_CONTENTS/SharedSupport/m64p_test_rom.v64 ./example.v64 30 | echo './mupen64plus.app/Contents/MacOS/mupen64plus --gfx mupen64plus-video-rice "$@"' > run_rice.sh 31 | echo './mupen64plus.app/Contents/MacOS/mupen64plus --gfx mupen64plus-video-glide64mk2 "$@"' > run_glide.sh 32 | echo "Note that Mupen64Plus requires an Intel mac and will not run on PPC macs.\nIt also requires OS X 10.9 or later.\n\nThis application can NOT be opened in the Finder by double-clicking.\n To use, launch the terminal, then cd into the directory that contains mupen64plus.app and use a command like :\n\n $ ./run_rice.sh example.v64 # for the Rice video plugin\n $ ./run_glide.sh example.v64 # for the Glide64mk2 video plugin\n\n Note that at this point, the only way to configure Mupen64Plus is to edit the config files in ~/Library/Application Support/Mupen64Plus/\n\n" > Readme.txt 33 | chmod +x run_rice.sh run_glide.sh 34 | CURDATE=`date +%Y%m%d` 35 | zip -r mupen64plus-bundle-osx-$CURDATE.zip mupen64plus.app Readme.txt run_rice.sh run_glide.sh example.v64 36 | 37 | -------------------------------------------------------------------------------- /src/api/api_export.ver: -------------------------------------------------------------------------------- 1 | { global: 2 | ConfigExternalGetParameter; 3 | ConfigExternalOpen; 4 | ConfigExternalClose; 5 | ConfigDeleteSection; 6 | ConfigGetParamBool; 7 | ConfigGetParameter; 8 | ConfigGetParameterHelp; 9 | ConfigGetParameterType; 10 | ConfigGetParamFloat; 11 | ConfigGetParamInt; 12 | ConfigGetParamString; 13 | ConfigGetSharedDataFilepath; 14 | ConfigGetUserCachePath; 15 | ConfigGetUserConfigPath; 16 | ConfigGetUserDataPath; 17 | ConfigHasUnsavedChanges; 18 | ConfigListParameters; 19 | ConfigListSections; 20 | ConfigOpenSection; 21 | ConfigRevertChanges; 22 | ConfigSaveFile; 23 | ConfigSaveSection; 24 | ConfigSetDefaultBool; 25 | ConfigSetDefaultFloat; 26 | ConfigSetDefaultInt; 27 | ConfigSetDefaultString; 28 | ConfigSetParameter; 29 | ConfigSetParameterHelp; 30 | ConfigSendNetplayConfig; 31 | ConfigReceiveNetplayConfig; 32 | ConfigOverrideUserPaths; 33 | CoreAddCheat; 34 | CoreAttachPlugin; 35 | CoreCheatEnabled; 36 | CoreDetachPlugin; 37 | CoreDoCommand; 38 | CoreErrorMessage; 39 | CoreGetAPIVersions; 40 | CoreGetRomSettings; 41 | CoreOverrideVidExt; 42 | CoreShutdown; 43 | CoreStartup; 44 | DebugBreakpointCommand; 45 | DebugBreakpointLookup; 46 | DebugBreakpointTriggeredBy; 47 | DebugDecodeOp; 48 | DebugGetCPUDataPtr; 49 | DebugGetState; 50 | DebugMemGetMemInfo; 51 | DebugMemGetPointer; 52 | DebugMemGetRecompInfo; 53 | DebugMemRead16; 54 | DebugMemRead32; 55 | DebugMemRead64; 56 | DebugMemRead8; 57 | DebugMemWrite16; 58 | DebugMemWrite32; 59 | DebugMemWrite64; 60 | DebugMemWrite8; 61 | DebugSetCallbacks; 62 | DebugSetCoreCompare; 63 | DebugSetRunState; 64 | DebugStep; 65 | DebugVirtualToPhysical; 66 | PluginGetVersion; 67 | VidExt_GL_GetProcAddress; 68 | VidExt_GL_SetAttribute; 69 | VidExt_GL_GetAttribute; 70 | VidExt_GL_SwapBuffers; 71 | VidExt_Init; 72 | VidExt_InitWithRenderMode; 73 | VidExt_ListFullscreenModes; 74 | VidExt_ListFullscreenRates; 75 | VidExt_Quit; 76 | VidExt_SetCaption; 77 | VidExt_SetVideoMode; 78 | VidExt_SetVideoModeWithRate; 79 | VidExt_ToggleFullScreen; 80 | VidExt_ResizeWindow; 81 | VidExt_GL_GetDefaultFramebuffer; 82 | VidExt_VK_GetSurface; 83 | VidExt_VK_GetInstanceExtensions; 84 | local: *; }; 85 | -------------------------------------------------------------------------------- /src/device/pif/cic.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - cic.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_SI_CIC_H 23 | #define M64P_DEVICE_SI_CIC_H 24 | 25 | enum cic_version 26 | { 27 | CIC_X101, 28 | CIC_X102, 29 | CIC_X103, 30 | CIC_X105, 31 | CIC_X106, 32 | CIC_5101, 33 | CIC_5167, 34 | CIC_8303, 35 | CIC_8401, 36 | CIC_8501 37 | }; 38 | 39 | struct cic 40 | { 41 | const char* name; 42 | enum cic_version version; 43 | unsigned int seed; 44 | }; 45 | 46 | void init_cic_using_ipl3(struct cic* cic, const void* ipl3); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/backends/api/audio_out_backend.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - audio_out_backend.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2016 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_BACKENDS_API_AUDIO_OUT_BACKEND_H 23 | #define M64P_BACKENDS_API_AUDIO_OUT_BACKEND_H 24 | 25 | #include 26 | 27 | struct audio_out_backend_interface 28 | { 29 | /* Allow the backend to be notified of sample frequency. 30 | */ 31 | void (*set_frequency)(void* aout, unsigned int frequency); 32 | 33 | /* Push samples to be played by the backend 34 | */ 35 | void (*push_samples)(void* aout, const void* samples, size_t size); 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/main/version.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - version.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2008-2012 Richard42 DarkJeztr Tillin9 * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | /* Version macros automatically replaced by Makefiles. */ 23 | 24 | #ifndef __VERSION_H__ 25 | #define __VERSION_H__ 26 | 27 | #define MUPEN_CORE_NAME "Mupen64Plus Core" 28 | #define MUPEN_CORE_VERSION 0x020600 29 | 30 | #define FRONTEND_API_VERSION 0x020106 31 | #define CONFIG_API_VERSION 0x020302 32 | #define DEBUG_API_VERSION 0x020001 33 | #define VIDEXT_API_VERSION 0x030300 34 | #define NETPLAY_API_VERSION 0x010001 35 | 36 | #define VERSION_PRINTF_SPLIT(x) (((x) >> 16) & 0xffff), (((x) >> 8) & 0xff), ((x) & 0xff) 37 | 38 | #endif /* __VERSION_H__ */ 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/device/cart/is_viewer.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - is_viewer.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2021 loganmc10 * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_PI_IS_VIEWER_H 23 | #define M64P_DEVICE_PI_IS_VIEWER_H 24 | 25 | #include 26 | #include 27 | 28 | #define IS_BUFFER_SIZE 0x1000 29 | 30 | struct is_viewer 31 | { 32 | char data[IS_BUFFER_SIZE]; 33 | char output_buffer[IS_BUFFER_SIZE]; 34 | uint32_t buffer_pos; 35 | }; 36 | 37 | void poweron_is_viewer(struct is_viewer* is_viewer); 38 | 39 | void read_is_viewer(void* opaque, uint32_t address, uint32_t* value); 40 | void write_is_viewer(void* opaque, uint32_t address, uint32_t value, uint32_t mask); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/plugin/dummy_rsp.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - dummy_rsp.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2009 Richard42 * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #if !defined(DUMMY_RSP_H) 23 | #define DUMMY_RSP_H 24 | 25 | #include "api/m64p_plugin.h" 26 | #include "api/m64p_types.h" 27 | 28 | extern m64p_error dummyrsp_PluginGetVersion(m64p_plugin_type *PluginType, int *PluginVersion, 29 | int *APIVersion, const char **PluginNamePtr, int *Capabilities); 30 | extern unsigned int dummyrsp_DoRspCycles(unsigned int Cycles); 31 | extern void dummyrsp_InitiateRSP(RSP_INFO Rsp_Info, unsigned int *CycleCount); 32 | extern void dummyrsp_RomClosed(void); 33 | 34 | #endif /* DUMMY_RSP_H */ 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/api/vidext.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus-core - api/vidext.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2009 Richard Goedeken * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | /* This file contains the definitions for the video extension functions which 23 | * will be called from other Core modules. 24 | */ 25 | 26 | #if !defined(API_VIDEXT_H) 27 | #define API_VIDEXT_H 28 | 29 | #include "m64p_types.h" 30 | 31 | /* global function for use by frontend.c */ 32 | extern m64p_error OverrideVideoFunctions(m64p_video_extension_functions *VideoFunctionStruct); 33 | 34 | /* these functions are only used by the core */ 35 | extern int VidExt_InFullscreenMode(void); 36 | extern int VidExt_VideoRunning(void); 37 | 38 | #endif /* API_VIDEXT_H */ 39 | -------------------------------------------------------------------------------- /src/device/r4300/new_dynarec/x64/assem_x64.h: -------------------------------------------------------------------------------- 1 | #ifndef M64P_DEVICE_R4300_NEW_DYNAREC_X64_ASSEM_X64_H 2 | #define M64P_DEVICE_R4300_NEW_DYNAREC_X64_ASSEM_X64_H 3 | 4 | #define EAX 0 5 | #define ECX 1 6 | #define EDX 2 7 | #define EBX 3 8 | #define ESP 4 9 | #define EBP 5 10 | #define ESI 6 11 | #define EDI 7 12 | 13 | #define RAX 0 14 | #define RCX 1 15 | #define RDX 2 16 | #define RBX 3 17 | #define RSP 4 18 | #define RBP 5 19 | #define RSI 6 20 | #define RDI 7 21 | #define R8 8 22 | #define R9 9 23 | #define R10 10 24 | #define R11 11 25 | #define R12 12 26 | #define R13 13 27 | #define R14 14 28 | #define R15 15 29 | 30 | #define HOST_REGS 8 31 | #define HOST_BTREG EBP 32 | #define EXCLUDE_REG ESP 33 | #define HOST_TEMPREG R15 34 | 35 | //#define IMM_PREFETCH 1 36 | #define NATIVE_64 1 37 | #define RAM_OFFSET 1 38 | #define NEED_INVC_PTR 1 39 | #define INVERTED_CARRY 1 40 | //#define DESTRUCTIVE_WRITEBACK 1 41 | #define DESTRUCTIVE_SHIFT 1 42 | #define USE_MINI_HT 1 43 | 44 | #define TARGET_SIZE_2 25 // 2^25 = 32 megabytes 45 | #define JUMP_TABLE_SIZE 0 // Not needed for x86 46 | 47 | #ifdef _WIN32 48 | /* Microsoft x64 calling convention: 49 | func(rcx, rdx, r8, r9) {return rax;} 50 | callee-save: %rbx %rbp %rdi %rsi %rsp %r12-%r15 51 | 52 | The registers RAX, RCX, RDX, R8, R9, R10, R11 are considered volatile (caller-saved). 53 | The registers RBX, RBP, RDI, RSI, RSP, R12, R13, R14, and R15 are considered nonvolatile (callee-saved).*/ 54 | 55 | #define ARG1_REG ECX 56 | #define ARG2_REG EDX 57 | #define ARG3_REG R8 58 | #define ARG4_REG R9 59 | #define CALLER_SAVED_REGS 0xF07 60 | #define HOST_CCREG ESI 61 | #else 62 | /* amd64 calling convention: 63 | func(rdi, rsi, rdx, rcx, r8, r9) {return rax;} 64 | callee-save: %rbp %rbx %r12-%r15 65 | 66 | The registers RAX, RCX, RDX, RSI, RDI, R8, R9, R10, R11 are considered volatile (caller-saved). 67 | The registers RBX, RBP, RSP, R12, R13, R14, and R15 are considered nonvolatile (callee-saved).*/ 68 | 69 | #define ARG1_REG EDI 70 | #define ARG2_REG ESI 71 | #define ARG3_REG EDX 72 | #define ARG4_REG ECX 73 | #define CALLER_SAVED_REGS 0xFC7 74 | #define HOST_CCREG EBX 75 | #endif 76 | 77 | #endif /* M64P_DEVICE_R4300_NEW_DYNAREC_X64_ASSEM_X64_H */ 78 | -------------------------------------------------------------------------------- /src/main/profile.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - profile.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * Copyright (C) 2012 CasualJames * 6 | * Copyright (C) 2002 Hacktarux * 7 | * * 8 | * This program is free software; you can redistribute it and/or modify * 9 | * it under the terms of the GNU General Public License as published by * 10 | * the Free Software Foundation; either version 2 of the License, or * 11 | * (at your option) any later version. * 12 | * * 13 | * This program is distributed in the hope that it will be useful, * 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 16 | * GNU General Public License for more details. * 17 | * * 18 | * You should have received a copy of the GNU General Public License * 19 | * along with this program; if not, write to the * 20 | * Free Software Foundation, Inc., * 21 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 22 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 23 | 24 | #ifndef PROFILE_H 25 | #define PROFILE_H 26 | 27 | enum timed_section 28 | { 29 | TIMED_SECTION_ALL, 30 | TIMED_SECTION_GFX, 31 | TIMED_SECTION_AUDIO, 32 | TIMED_SECTION_COMPILER, 33 | TIMED_SECTION_IDLE, 34 | NUM_TIMED_SECTIONS 35 | }; 36 | 37 | void timed_section_start(enum timed_section section); 38 | void timed_section_end(enum timed_section section); 39 | void timed_sections_refresh(void); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/backends/api/storage_backend.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - storage_backend.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2016 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_BACKENDS_API_STORAGE_BACKEND_H 23 | #define M64P_BACKENDS_API_STORAGE_BACKEND_H 24 | 25 | #include 26 | #include 27 | 28 | struct storage_backend_interface 29 | { 30 | /* Returns a pointer to storage data 31 | */ 32 | uint8_t* (*data)(const void* storage); 33 | 34 | /* Returns the size of the storage 35 | */ 36 | size_t (*size)(const void* storage); 37 | 38 | /* Notify the storage backend that data should be persisted 39 | */ 40 | void (*save)(void* storage, size_t start, size_t size); 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/osal/dynamiclib_unix.c: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus-core - osal/dynamiclib_unix.c * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2009 Richard Goedeken * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #include 23 | #include 24 | 25 | #include "api/callbacks.h" 26 | #include "api/m64p_types.h" 27 | #include "osal/preproc.h" 28 | #include "dynamiclib.h" 29 | 30 | m64p_function osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName) 31 | { 32 | if (pccProcedureName == NULL) 33 | return NULL; 34 | 35 | /* WARN: assume cast to m64p_function is supported by platform and disable warning accordingly */ 36 | OSAL_WARNING_PUSH 37 | OSAL_NO_WARNING_FPTR_VOIDP_CAST 38 | return (m64p_function)dlsym(LibHandle, pccProcedureName); 39 | OSAL_WARNING_POP 40 | } 41 | -------------------------------------------------------------------------------- /src/osal/dynamiclib_win32.c: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus-ui-console - osal_dynamiclib_win32.c * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2009 Richard Goedeken * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #include "api/m64p_types.h" 27 | #include "osal/preproc.h" 28 | #include "dynamiclib.h" 29 | 30 | m64p_function osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName) 31 | { 32 | if (pccProcedureName == NULL) 33 | return NULL; 34 | 35 | /* WARN: assume cast to m64p_function is supported by platform and disable warning accordingly */ 36 | OSAL_WARNING_PUSH 37 | OSAL_NO_WARNING_FPTR_VOIDP_CAST 38 | return (m64p_function)GetProcAddress(LibHandle, pccProcedureName); 39 | OSAL_WARNING_POP 40 | } 41 | -------------------------------------------------------------------------------- /src/debugger/dbg_debugger.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - dbg_debugger.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2008 DarkJeztr * 5 | * Copyright (C) 2002 davFr * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 2 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the * 19 | * Free Software Foundation, Inc., * 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 21 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 22 | 23 | #ifndef __DBG_DEBUGGER_H__ 24 | #define __DBG_DEBUGGER_H__ 25 | 26 | #include "api/m64p_types.h" 27 | 28 | extern int g_DebuggerActive; /* True if the debugger is running */ 29 | 30 | extern m64p_dbg_runstate g_dbg_runstate; 31 | 32 | extern uint32_t previousPC; 33 | 34 | extern uint32_t breakpointAccessed; 35 | extern uint32_t breakpointFlag; 36 | 37 | void init_debugger(void); 38 | void update_debugger(uint32_t pc); 39 | void destroy_debugger(void); 40 | void debugger_step(void); 41 | 42 | #endif /* __DBG_DEBUGGER_H__ */ 43 | 44 | -------------------------------------------------------------------------------- /src/device/gb/m64282fp.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - m64282fp.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2017 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_GB_M64282FP_H 23 | #define M64P_DEVICE_GB_M64282FP_H 24 | 25 | #include 26 | 27 | enum 28 | { 29 | M64282FP_SENSOR_W = 128, 30 | M64282FP_SENSOR_H = 128, 31 | }; 32 | 33 | enum m64282fp_registers 34 | { 35 | M64282FP_Z_O, 36 | M64282FP_N_VH_G, 37 | M64282FP_C_LO, 38 | M64282FP_C_HI, 39 | M64282FP_P, 40 | M64282FP_M, 41 | M64282FP_X, 42 | M64282FP_E_I_V, 43 | M64282FP_REGS_COUNT 44 | }; 45 | 46 | void process_m64282fp_image( 47 | uint8_t img[M64282FP_SENSOR_H][M64282FP_SENSOR_W], 48 | const uint8_t regs[M64282FP_REGS_COUNT]); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/device/r4300/cp2.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - cp2.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2002 Hacktarux * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_R4300_CP2_H 23 | #define M64P_DEVICE_R4300_CP2_H 24 | 25 | #include 26 | #include "osal/preproc.h" 27 | #include "new_dynarec/new_dynarec.h" 28 | 29 | struct cp2 30 | { 31 | uint64_t latch; 32 | 33 | #ifdef NEW_DYNAREC 34 | /* New dynarec uses a different memory layout */ 35 | struct new_dynarec_hot_state* new_dynarec_hot_state; 36 | #endif 37 | }; 38 | 39 | void init_cp2(struct cp2* cp2, struct new_dynarec_hot_state* new_dynarec_hot_state); 40 | void poweron_cp2(struct cp2* cp2); 41 | 42 | uint64_t* r4300_cp2_latch(struct cp2* cp2); 43 | 44 | #endif /* M64P_DEVICE_R4300_CP2_H */ 45 | 46 | -------------------------------------------------------------------------------- /src/device/controllers/paks/rumblepak.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - rumblepak.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_SI_RUMBLEPAK_H 23 | #define M64P_DEVICE_SI_RUMBLEPAK_H 24 | 25 | #include 26 | #include 27 | 28 | struct rumble_backend_interface; 29 | 30 | struct rumblepak 31 | { 32 | uint8_t state; 33 | void* rumble; 34 | const struct rumble_backend_interface* irumble; 35 | }; 36 | 37 | void init_rumblepak(struct rumblepak* rpk, 38 | void* rumble, const struct rumble_backend_interface* irumble); 39 | 40 | void poweron_rumblepak(struct rumblepak* rpk); 41 | 42 | void set_rumble_reg(struct rumblepak* rpk, uint8_t value); 43 | 44 | extern const struct pak_interface g_irumblepak; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/device/r4300/x86/assemble_struct.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - assemble_struct.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2002 Hacktarux * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_R4300_X86_ASSEMBLE_STRUCT_H 23 | #define M64P_DEVICE_R4300_X86_ASSEMBLE_STRUCT_H 24 | 25 | struct precomp_instr; 26 | 27 | struct regcache_state { 28 | unsigned int* reg_content[8]; 29 | struct precomp_instr* last_access[8]; 30 | struct precomp_instr* free_since[8]; 31 | int dirty[8]; 32 | int r64[8]; 33 | unsigned int* r0; 34 | }; 35 | 36 | struct reg_cache 37 | { 38 | int need_map; 39 | void *needed_registers[8]; 40 | unsigned char jump_wrapper[62]; 41 | int need_cop1_check; 42 | }; 43 | 44 | struct jump_table 45 | { 46 | unsigned int mi_addr; 47 | unsigned int pc_addr; 48 | }; 49 | 50 | #endif /* M64P_DEVICE_R4300_X86_ASSEMBLE_STRUCT_H */ 51 | -------------------------------------------------------------------------------- /src/backends/file_storage.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - file_storage.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2016 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_MAIN_FILE_STORAGE_H 23 | #define M64P_MAIN_FILE_STORAGE_H 24 | 25 | #include 26 | #include 27 | 28 | struct file_storage 29 | { 30 | uint8_t* data; 31 | size_t size; 32 | const char* filename; 33 | int first_access; 34 | }; 35 | 36 | 37 | int open_file_storage(struct file_storage* storage, size_t size, const char* filename); 38 | int open_rom_file_storage(struct file_storage* storage, const char* filename); 39 | void close_file_storage(struct file_storage* storage); 40 | 41 | extern const struct storage_backend_interface g_ifile_storage; 42 | extern const struct storage_backend_interface g_ifile_storage_ro; 43 | extern const struct storage_backend_interface g_isubfile_storage; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/device/r4300/new_dynarec/arm/asm_defines_gas.h: -------------------------------------------------------------------------------- 1 | #define offsetof_struct_device_r4300 (0x00000000) 2 | #define offsetof_struct_r4300_core_cp0 (0x029014dc) 3 | #define offsetof_struct_cp0_last_addr (0x00000194) 4 | #define offsetof_struct_cp0_count_per_op (0x00000198) 5 | #define offsetof_struct_cp0_tlb (0x000001a0) 6 | #define offsetof_struct_tlb_entries (0x00000000) 7 | #define offsetof_struct_tlb_LUT_r (0x00000680) 8 | #define offsetof_struct_tlb_LUT_w (0x00400680) 9 | #define offsetof_struct_r4300_core_cached_interp (0x00000098) 10 | #define offsetof_struct_cached_interp_invalid_code (0x00000000) 11 | #define offsetof_struct_r4300_core_new_dynarec_hot_state (0x02501000) 12 | #define offsetof_struct_r4300_core_extra_memory (0x00501000) 13 | #define offsetof_struct_new_dynarec_hot_state_dynarec_local (0x00000000) 14 | #define offsetof_struct_new_dynarec_hot_state_cycle_count (0x00000040) 15 | #define offsetof_struct_new_dynarec_hot_state_pending_exception (0x00000044) 16 | #define offsetof_struct_new_dynarec_hot_state_pcaddr (0x00000048) 17 | #define offsetof_struct_new_dynarec_hot_state_stop (0x0000004c) 18 | #define offsetof_struct_new_dynarec_hot_state_invc_ptr (0x00000050) 19 | #define offsetof_struct_new_dynarec_hot_state_cp1_fcr0 (0x0000006c) 20 | #define offsetof_struct_new_dynarec_hot_state_cp1_fcr31 (0x00000070) 21 | #define offsetof_struct_new_dynarec_hot_state_regs (0x00000078) 22 | #define offsetof_struct_new_dynarec_hot_state_hi (0x00000178) 23 | #define offsetof_struct_new_dynarec_hot_state_lo (0x00000180) 24 | #define offsetof_struct_new_dynarec_hot_state_cp0_regs (0x00000188) 25 | #define offsetof_struct_new_dynarec_hot_state_cp1_regs_simple (0x00000210) 26 | #define offsetof_struct_new_dynarec_hot_state_cp1_regs_double (0x00000290) 27 | #define offsetof_struct_new_dynarec_hot_state_rounding_modes (0x00000318) 28 | #define offsetof_struct_new_dynarec_hot_state_branch_target (0x00000328) 29 | #define offsetof_struct_new_dynarec_hot_state_pc (0x0000032c) 30 | #define offsetof_struct_new_dynarec_hot_state_fake_pc (0x00000330) 31 | #define offsetof_struct_new_dynarec_hot_state_rs (0x000003b8) 32 | #define offsetof_struct_new_dynarec_hot_state_rt (0x000003c0) 33 | #define offsetof_struct_new_dynarec_hot_state_rd (0x000003c8) 34 | #define offsetof_struct_new_dynarec_hot_state_mini_ht (0x000003d4) 35 | #define offsetof_struct_new_dynarec_hot_state_memory_map (0x000004d4) 36 | -------------------------------------------------------------------------------- /src/device/r4300/new_dynarec/arm/asm_defines_nasm.h: -------------------------------------------------------------------------------- 1 | %define offsetof_struct_device_r4300 (0x00000000) 2 | %define offsetof_struct_r4300_core_cp0 (0x029014dc) 3 | %define offsetof_struct_cp0_last_addr (0x00000194) 4 | %define offsetof_struct_cp0_count_per_op (0x00000198) 5 | %define offsetof_struct_cp0_tlb (0x000001a0) 6 | %define offsetof_struct_tlb_entries (0x00000000) 7 | %define offsetof_struct_tlb_LUT_r (0x00000680) 8 | %define offsetof_struct_tlb_LUT_w (0x00400680) 9 | %define offsetof_struct_r4300_core_cached_interp (0x00000098) 10 | %define offsetof_struct_cached_interp_invalid_code (0x00000000) 11 | %define offsetof_struct_r4300_core_new_dynarec_hot_state (0x02501000) 12 | %define offsetof_struct_r4300_core_extra_memory (0x00501000) 13 | %define offsetof_struct_new_dynarec_hot_state_dynarec_local (0x00000000) 14 | %define offsetof_struct_new_dynarec_hot_state_cycle_count (0x00000040) 15 | %define offsetof_struct_new_dynarec_hot_state_pending_exception (0x00000044) 16 | %define offsetof_struct_new_dynarec_hot_state_pcaddr (0x00000048) 17 | %define offsetof_struct_new_dynarec_hot_state_stop (0x0000004c) 18 | %define offsetof_struct_new_dynarec_hot_state_invc_ptr (0x00000050) 19 | %define offsetof_struct_new_dynarec_hot_state_cp1_fcr0 (0x0000006c) 20 | %define offsetof_struct_new_dynarec_hot_state_cp1_fcr31 (0x00000070) 21 | %define offsetof_struct_new_dynarec_hot_state_regs (0x00000078) 22 | %define offsetof_struct_new_dynarec_hot_state_hi (0x00000178) 23 | %define offsetof_struct_new_dynarec_hot_state_lo (0x00000180) 24 | %define offsetof_struct_new_dynarec_hot_state_cp0_regs (0x00000188) 25 | %define offsetof_struct_new_dynarec_hot_state_cp1_regs_simple (0x00000210) 26 | %define offsetof_struct_new_dynarec_hot_state_cp1_regs_double (0x00000290) 27 | %define offsetof_struct_new_dynarec_hot_state_rounding_modes (0x00000318) 28 | %define offsetof_struct_new_dynarec_hot_state_branch_target (0x00000328) 29 | %define offsetof_struct_new_dynarec_hot_state_pc (0x0000032c) 30 | %define offsetof_struct_new_dynarec_hot_state_fake_pc (0x00000330) 31 | %define offsetof_struct_new_dynarec_hot_state_rs (0x000003b8) 32 | %define offsetof_struct_new_dynarec_hot_state_rt (0x000003c0) 33 | %define offsetof_struct_new_dynarec_hot_state_rd (0x000003c8) 34 | %define offsetof_struct_new_dynarec_hot_state_mini_ht (0x000003d4) 35 | %define offsetof_struct_new_dynarec_hot_state_memory_map (0x000004d4) 36 | -------------------------------------------------------------------------------- /src/device/r4300/new_dynarec/arm64/asm_defines_gas.h: -------------------------------------------------------------------------------- 1 | #define offsetof_struct_device_r4300 (0x00000000) 2 | #define offsetof_struct_r4300_core_cp0 (0x031017e8) 3 | #define offsetof_struct_cp0_last_addr (0x000002a8) 4 | #define offsetof_struct_cp0_count_per_op (0x000002ac) 5 | #define offsetof_struct_cp0_tlb (0x000002b4) 6 | #define offsetof_struct_tlb_entries (0x00000000) 7 | #define offsetof_struct_tlb_LUT_r (0x00000680) 8 | #define offsetof_struct_tlb_LUT_w (0x00400680) 9 | #define offsetof_struct_r4300_core_cached_interp (0x000000e0) 10 | #define offsetof_struct_cached_interp_invalid_code (0x00000000) 11 | #define offsetof_struct_r4300_core_new_dynarec_hot_state (0x02901000) 12 | #define offsetof_struct_r4300_core_extra_memory (0x00901000) 13 | #define offsetof_struct_new_dynarec_hot_state_dynarec_local (0x00000000) 14 | #define offsetof_struct_new_dynarec_hot_state_cycle_count (0x00000100) 15 | #define offsetof_struct_new_dynarec_hot_state_pending_exception (0x00000104) 16 | #define offsetof_struct_new_dynarec_hot_state_pcaddr (0x00000108) 17 | #define offsetof_struct_new_dynarec_hot_state_stop (0x0000010c) 18 | #define offsetof_struct_new_dynarec_hot_state_invc_ptr (0x00000110) 19 | #define offsetof_struct_new_dynarec_hot_state_cp1_fcr0 (0x00000134) 20 | #define offsetof_struct_new_dynarec_hot_state_cp1_fcr31 (0x00000138) 21 | #define offsetof_struct_new_dynarec_hot_state_regs (0x00000140) 22 | #define offsetof_struct_new_dynarec_hot_state_hi (0x00000240) 23 | #define offsetof_struct_new_dynarec_hot_state_lo (0x00000248) 24 | #define offsetof_struct_new_dynarec_hot_state_cp0_regs (0x00000250) 25 | #define offsetof_struct_new_dynarec_hot_state_cp1_regs_simple (0x000002d8) 26 | #define offsetof_struct_new_dynarec_hot_state_cp1_regs_double (0x000003d8) 27 | #define offsetof_struct_new_dynarec_hot_state_rounding_modes (0x000004e0) 28 | #define offsetof_struct_new_dynarec_hot_state_branch_target (0x000004f0) 29 | #define offsetof_struct_new_dynarec_hot_state_pc (0x000004f8) 30 | #define offsetof_struct_new_dynarec_hot_state_fake_pc (0x00000500) 31 | #define offsetof_struct_new_dynarec_hot_state_rs (0x000005c0) 32 | #define offsetof_struct_new_dynarec_hot_state_rt (0x000005c8) 33 | #define offsetof_struct_new_dynarec_hot_state_rd (0x000005d0) 34 | #define offsetof_struct_new_dynarec_hot_state_mini_ht (0x000005e0) 35 | #define offsetof_struct_new_dynarec_hot_state_memory_map (0x000007e0) 36 | -------------------------------------------------------------------------------- /src/device/r4300/new_dynarec/arm64/asm_defines_nasm.h: -------------------------------------------------------------------------------- 1 | %define offsetof_struct_device_r4300 (0x00000000) 2 | %define offsetof_struct_r4300_core_cp0 (0x031017e8) 3 | %define offsetof_struct_cp0_last_addr (0x000002a8) 4 | %define offsetof_struct_cp0_count_per_op (0x000002ac) 5 | %define offsetof_struct_cp0_tlb (0x000002b4) 6 | %define offsetof_struct_tlb_entries (0x00000000) 7 | %define offsetof_struct_tlb_LUT_r (0x00000680) 8 | %define offsetof_struct_tlb_LUT_w (0x00400680) 9 | %define offsetof_struct_r4300_core_cached_interp (0x000000e0) 10 | %define offsetof_struct_cached_interp_invalid_code (0x00000000) 11 | %define offsetof_struct_r4300_core_new_dynarec_hot_state (0x02901000) 12 | %define offsetof_struct_r4300_core_extra_memory (0x00901000) 13 | %define offsetof_struct_new_dynarec_hot_state_dynarec_local (0x00000000) 14 | %define offsetof_struct_new_dynarec_hot_state_cycle_count (0x00000100) 15 | %define offsetof_struct_new_dynarec_hot_state_pending_exception (0x00000104) 16 | %define offsetof_struct_new_dynarec_hot_state_pcaddr (0x00000108) 17 | %define offsetof_struct_new_dynarec_hot_state_stop (0x0000010c) 18 | %define offsetof_struct_new_dynarec_hot_state_invc_ptr (0x00000110) 19 | %define offsetof_struct_new_dynarec_hot_state_cp1_fcr0 (0x00000134) 20 | %define offsetof_struct_new_dynarec_hot_state_cp1_fcr31 (0x00000138) 21 | %define offsetof_struct_new_dynarec_hot_state_regs (0x00000140) 22 | %define offsetof_struct_new_dynarec_hot_state_hi (0x00000240) 23 | %define offsetof_struct_new_dynarec_hot_state_lo (0x00000248) 24 | %define offsetof_struct_new_dynarec_hot_state_cp0_regs (0x00000250) 25 | %define offsetof_struct_new_dynarec_hot_state_cp1_regs_simple (0x000002d8) 26 | %define offsetof_struct_new_dynarec_hot_state_cp1_regs_double (0x000003d8) 27 | %define offsetof_struct_new_dynarec_hot_state_rounding_modes (0x000004e0) 28 | %define offsetof_struct_new_dynarec_hot_state_branch_target (0x000004f0) 29 | %define offsetof_struct_new_dynarec_hot_state_pc (0x000004f8) 30 | %define offsetof_struct_new_dynarec_hot_state_fake_pc (0x00000500) 31 | %define offsetof_struct_new_dynarec_hot_state_rs (0x000005c0) 32 | %define offsetof_struct_new_dynarec_hot_state_rt (0x000005c8) 33 | %define offsetof_struct_new_dynarec_hot_state_rd (0x000005d0) 34 | %define offsetof_struct_new_dynarec_hot_state_mini_ht (0x000005e0) 35 | %define offsetof_struct_new_dynarec_hot_state_memory_map (0x000007e0) 36 | -------------------------------------------------------------------------------- /src/device/r4300/new_dynarec/x64/asm_defines_gas.h: -------------------------------------------------------------------------------- 1 | #define offsetof_struct_device_r4300 (0x00000000) 2 | #define offsetof_struct_r4300_core_cp0 (0x031017f8) 3 | #define offsetof_struct_cp0_last_addr (0x000002a8) 4 | #define offsetof_struct_cp0_count_per_op (0x000002ac) 5 | #define offsetof_struct_cp0_tlb (0x000002b4) 6 | #define offsetof_struct_tlb_entries (0x00000000) 7 | #define offsetof_struct_tlb_LUT_r (0x00000680) 8 | #define offsetof_struct_tlb_LUT_w (0x00400680) 9 | #define offsetof_struct_r4300_core_cached_interp (0x000000f0) 10 | #define offsetof_struct_cached_interp_invalid_code (0x00000000) 11 | #define offsetof_struct_r4300_core_new_dynarec_hot_state (0x02901000) 12 | #define offsetof_struct_r4300_core_extra_memory (0x00901000) 13 | #define offsetof_struct_new_dynarec_hot_state_dynarec_local (0x00000000) 14 | #define offsetof_struct_new_dynarec_hot_state_cycle_count (0x00000100) 15 | #define offsetof_struct_new_dynarec_hot_state_pending_exception (0x00000104) 16 | #define offsetof_struct_new_dynarec_hot_state_pcaddr (0x00000108) 17 | #define offsetof_struct_new_dynarec_hot_state_stop (0x0000010c) 18 | #define offsetof_struct_new_dynarec_hot_state_invc_ptr (0x00000110) 19 | #define offsetof_struct_new_dynarec_hot_state_cp1_fcr0 (0x00000134) 20 | #define offsetof_struct_new_dynarec_hot_state_cp1_fcr31 (0x00000138) 21 | #define offsetof_struct_new_dynarec_hot_state_regs (0x00000140) 22 | #define offsetof_struct_new_dynarec_hot_state_hi (0x00000240) 23 | #define offsetof_struct_new_dynarec_hot_state_lo (0x00000248) 24 | #define offsetof_struct_new_dynarec_hot_state_cp0_regs (0x00000250) 25 | #define offsetof_struct_new_dynarec_hot_state_cp1_regs_simple (0x000002d8) 26 | #define offsetof_struct_new_dynarec_hot_state_cp1_regs_double (0x000003d8) 27 | #define offsetof_struct_new_dynarec_hot_state_rounding_modes (0x000004e0) 28 | #define offsetof_struct_new_dynarec_hot_state_branch_target (0x000004f0) 29 | #define offsetof_struct_new_dynarec_hot_state_pc (0x000004f8) 30 | #define offsetof_struct_new_dynarec_hot_state_fake_pc (0x00000500) 31 | #define offsetof_struct_new_dynarec_hot_state_rs (0x000005d0) 32 | #define offsetof_struct_new_dynarec_hot_state_rt (0x000005d8) 33 | #define offsetof_struct_new_dynarec_hot_state_rd (0x000005e0) 34 | #define offsetof_struct_new_dynarec_hot_state_mini_ht (0x000005f0) 35 | #define offsetof_struct_new_dynarec_hot_state_memory_map (0x000007f0) 36 | -------------------------------------------------------------------------------- /src/device/r4300/new_dynarec/x64/asm_defines_nasm.h: -------------------------------------------------------------------------------- 1 | %define offsetof_struct_device_r4300 (0x00000000) 2 | %define offsetof_struct_r4300_core_cp0 (0x031017f8) 3 | %define offsetof_struct_cp0_last_addr (0x000002a8) 4 | %define offsetof_struct_cp0_count_per_op (0x000002ac) 5 | %define offsetof_struct_cp0_tlb (0x000002b4) 6 | %define offsetof_struct_tlb_entries (0x00000000) 7 | %define offsetof_struct_tlb_LUT_r (0x00000680) 8 | %define offsetof_struct_tlb_LUT_w (0x00400680) 9 | %define offsetof_struct_r4300_core_cached_interp (0x000000f0) 10 | %define offsetof_struct_cached_interp_invalid_code (0x00000000) 11 | %define offsetof_struct_r4300_core_new_dynarec_hot_state (0x02901000) 12 | %define offsetof_struct_r4300_core_extra_memory (0x00901000) 13 | %define offsetof_struct_new_dynarec_hot_state_dynarec_local (0x00000000) 14 | %define offsetof_struct_new_dynarec_hot_state_cycle_count (0x00000100) 15 | %define offsetof_struct_new_dynarec_hot_state_pending_exception (0x00000104) 16 | %define offsetof_struct_new_dynarec_hot_state_pcaddr (0x00000108) 17 | %define offsetof_struct_new_dynarec_hot_state_stop (0x0000010c) 18 | %define offsetof_struct_new_dynarec_hot_state_invc_ptr (0x00000110) 19 | %define offsetof_struct_new_dynarec_hot_state_cp1_fcr0 (0x00000134) 20 | %define offsetof_struct_new_dynarec_hot_state_cp1_fcr31 (0x00000138) 21 | %define offsetof_struct_new_dynarec_hot_state_regs (0x00000140) 22 | %define offsetof_struct_new_dynarec_hot_state_hi (0x00000240) 23 | %define offsetof_struct_new_dynarec_hot_state_lo (0x00000248) 24 | %define offsetof_struct_new_dynarec_hot_state_cp0_regs (0x00000250) 25 | %define offsetof_struct_new_dynarec_hot_state_cp1_regs_simple (0x000002d8) 26 | %define offsetof_struct_new_dynarec_hot_state_cp1_regs_double (0x000003d8) 27 | %define offsetof_struct_new_dynarec_hot_state_rounding_modes (0x000004e0) 28 | %define offsetof_struct_new_dynarec_hot_state_branch_target (0x000004f0) 29 | %define offsetof_struct_new_dynarec_hot_state_pc (0x000004f8) 30 | %define offsetof_struct_new_dynarec_hot_state_fake_pc (0x00000500) 31 | %define offsetof_struct_new_dynarec_hot_state_rs (0x000005d0) 32 | %define offsetof_struct_new_dynarec_hot_state_rt (0x000005d8) 33 | %define offsetof_struct_new_dynarec_hot_state_rd (0x000005e0) 34 | %define offsetof_struct_new_dynarec_hot_state_mini_ht (0x000005f0) 35 | %define offsetof_struct_new_dynarec_hot_state_memory_map (0x000007f0) 36 | -------------------------------------------------------------------------------- /src/device/r4300/new_dynarec/x86/asm_defines_gas.h: -------------------------------------------------------------------------------- 1 | #define offsetof_struct_device_r4300 (0x00000000) 2 | #define offsetof_struct_r4300_core_cp0 (0x029014d0) 3 | #define offsetof_struct_cp0_last_addr (0x00000194) 4 | #define offsetof_struct_cp0_count_per_op (0x00000198) 5 | #define offsetof_struct_cp0_tlb (0x000001a0) 6 | #define offsetof_struct_tlb_entries (0x00000000) 7 | #define offsetof_struct_tlb_LUT_r (0x00000680) 8 | #define offsetof_struct_tlb_LUT_w (0x00400680) 9 | #define offsetof_struct_r4300_core_cached_interp (0x00000098) 10 | #define offsetof_struct_cached_interp_invalid_code (0x00000000) 11 | #define offsetof_struct_r4300_core_new_dynarec_hot_state (0x02501000) 12 | #define offsetof_struct_r4300_core_extra_memory (0x00501000) 13 | #define offsetof_struct_new_dynarec_hot_state_dynarec_local (0x00000000) 14 | #define offsetof_struct_new_dynarec_hot_state_cycle_count (0x00000040) 15 | #define offsetof_struct_new_dynarec_hot_state_pending_exception (0x00000044) 16 | #define offsetof_struct_new_dynarec_hot_state_pcaddr (0x00000048) 17 | #define offsetof_struct_new_dynarec_hot_state_stop (0x0000004c) 18 | #define offsetof_struct_new_dynarec_hot_state_invc_ptr (0x00000050) 19 | #define offsetof_struct_new_dynarec_hot_state_cp1_fcr0 (0x0000006c) 20 | #define offsetof_struct_new_dynarec_hot_state_cp1_fcr31 (0x00000070) 21 | #define offsetof_struct_new_dynarec_hot_state_regs (0x00000074) 22 | #define offsetof_struct_new_dynarec_hot_state_hi (0x00000174) 23 | #define offsetof_struct_new_dynarec_hot_state_lo (0x0000017c) 24 | #define offsetof_struct_new_dynarec_hot_state_cp0_regs (0x00000184) 25 | #define offsetof_struct_new_dynarec_hot_state_cp1_regs_simple (0x0000020c) 26 | #define offsetof_struct_new_dynarec_hot_state_cp1_regs_double (0x0000028c) 27 | #define offsetof_struct_new_dynarec_hot_state_rounding_modes (0x00000314) 28 | #define offsetof_struct_new_dynarec_hot_state_branch_target (0x00000324) 29 | #define offsetof_struct_new_dynarec_hot_state_pc (0x00000328) 30 | #define offsetof_struct_new_dynarec_hot_state_fake_pc (0x0000032c) 31 | #define offsetof_struct_new_dynarec_hot_state_rs (0x000003b0) 32 | #define offsetof_struct_new_dynarec_hot_state_rt (0x000003b8) 33 | #define offsetof_struct_new_dynarec_hot_state_rd (0x000003c0) 34 | #define offsetof_struct_new_dynarec_hot_state_mini_ht (0x000003cc) 35 | #define offsetof_struct_new_dynarec_hot_state_memory_map (0x000004cc) 36 | -------------------------------------------------------------------------------- /src/device/r4300/new_dynarec/x86/asm_defines_nasm.h: -------------------------------------------------------------------------------- 1 | %define offsetof_struct_device_r4300 (0x00000000) 2 | %define offsetof_struct_r4300_core_cp0 (0x029014d0) 3 | %define offsetof_struct_cp0_last_addr (0x00000194) 4 | %define offsetof_struct_cp0_count_per_op (0x00000198) 5 | %define offsetof_struct_cp0_tlb (0x000001a0) 6 | %define offsetof_struct_tlb_entries (0x00000000) 7 | %define offsetof_struct_tlb_LUT_r (0x00000680) 8 | %define offsetof_struct_tlb_LUT_w (0x00400680) 9 | %define offsetof_struct_r4300_core_cached_interp (0x00000098) 10 | %define offsetof_struct_cached_interp_invalid_code (0x00000000) 11 | %define offsetof_struct_r4300_core_new_dynarec_hot_state (0x02501000) 12 | %define offsetof_struct_r4300_core_extra_memory (0x00501000) 13 | %define offsetof_struct_new_dynarec_hot_state_dynarec_local (0x00000000) 14 | %define offsetof_struct_new_dynarec_hot_state_cycle_count (0x00000040) 15 | %define offsetof_struct_new_dynarec_hot_state_pending_exception (0x00000044) 16 | %define offsetof_struct_new_dynarec_hot_state_pcaddr (0x00000048) 17 | %define offsetof_struct_new_dynarec_hot_state_stop (0x0000004c) 18 | %define offsetof_struct_new_dynarec_hot_state_invc_ptr (0x00000050) 19 | %define offsetof_struct_new_dynarec_hot_state_cp1_fcr0 (0x0000006c) 20 | %define offsetof_struct_new_dynarec_hot_state_cp1_fcr31 (0x00000070) 21 | %define offsetof_struct_new_dynarec_hot_state_regs (0x00000074) 22 | %define offsetof_struct_new_dynarec_hot_state_hi (0x00000174) 23 | %define offsetof_struct_new_dynarec_hot_state_lo (0x0000017c) 24 | %define offsetof_struct_new_dynarec_hot_state_cp0_regs (0x00000184) 25 | %define offsetof_struct_new_dynarec_hot_state_cp1_regs_simple (0x0000020c) 26 | %define offsetof_struct_new_dynarec_hot_state_cp1_regs_double (0x0000028c) 27 | %define offsetof_struct_new_dynarec_hot_state_rounding_modes (0x00000314) 28 | %define offsetof_struct_new_dynarec_hot_state_branch_target (0x00000324) 29 | %define offsetof_struct_new_dynarec_hot_state_pc (0x00000328) 30 | %define offsetof_struct_new_dynarec_hot_state_fake_pc (0x0000032c) 31 | %define offsetof_struct_new_dynarec_hot_state_rs (0x000003b0) 32 | %define offsetof_struct_new_dynarec_hot_state_rt (0x000003b8) 33 | %define offsetof_struct_new_dynarec_hot_state_rd (0x000003c0) 34 | %define offsetof_struct_new_dynarec_hot_state_mini_ht (0x000003cc) 35 | %define offsetof_struct_new_dynarec_hot_state_memory_map (0x000004cc) 36 | -------------------------------------------------------------------------------- /LICENSES: -------------------------------------------------------------------------------- 1 | Mupen64Plus-Core LICENSES 2 | ------------------------- 3 | 4 | Mupen64Plus-Core is licensed under the GNU General Public License version 2. Please see the 5 | included doc/gpl-license file for the terms and conditions of the GNU General Public License. 6 | The authors of Mupen64Plus-Core are: 7 | * Richard Goedeken (Richard42) 8 | * Sven Eckelmann (ecsv) 9 | * John Chadwick (NMN) 10 | * James Hood (Ebenblues) 11 | * Scott Gorman (okaygo) 12 | * Scott Knauert (Tillin9) 13 | * Jesse Dean (DarkJezter) 14 | * Louai Al-Khanji (slougi) 15 | * Bob Forder (orbitaldecay) 16 | * Jason Espinosa (hasone) 17 | * Bobby Smiles (bsmiles32) 18 | * Dorian Fevrier (Narann) 19 | * Richard Hender (ricrpi) 20 | * Will Nayes (wnayes) 21 | * Conchur Navid 22 | * Gillou68310 23 | * HyperHacker 24 | * littleguy77 25 | * Nebuleon 26 | * and others. 27 | 28 | The Mupen64Plus API documentation (located in doc/emuwiki-api-doc/*) is Copyright(C) 2009-2011 29 | by Richard Goedeken and is licensed under the GNU General Public License version 2. 30 | 31 | Mupen64Plus is based on GPL-licensed source code from Mupen64 v0.5, originally written by: 32 | * Hacktarux 33 | * Dave2001 34 | * Zilmar 35 | * Gregor Anich (Blight) 36 | * Juha Luotio (JttL) 37 | * and others. 38 | 39 | The OGLFT library used for the On-Screen Display is based on GPL/LGPL-licensed code Copyright 2002 lignum Computing. Please see the included doc/lgpl-license file for the terms and conditions of the GNU Lesser General Public License. More information about this library is available at the following websites: 40 | - http://oglft.sourceforge.net/index.html 41 | - http://directory.fsf.org/project/OGLFT/ 42 | 43 | Additionally, mupen includes a number of components licensed under other OSI approved licenses: 44 | 45 | The BSD license: 46 | * minizip by Gilles Vollant and others, ftp://ftp.info-zip.org/pub/infozip/license.html 47 | * src/memory/n64_cic_nus_6105.c/.h, by X-Scale 48 | 49 | The zlib/libpng license: 50 | * Adler-32 by Mark Adler 51 | * libpng by Glenn Randers-Pehrson, Peter Deutsch, and Guy Eric Schalnat 52 | * MD5 hasing code by Peter Deutsch 53 | 54 | The Bitstream license: 55 | * The TrueType font (data/font.ttf) is licensed by the Bitstream license. Please see the included doc/font-license file for the terms and conditions of the Bitstream license. 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/device/cart/eeprom.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - eeprom.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_SI_EEPROM_H 23 | #define M64P_DEVICE_SI_EEPROM_H 24 | 25 | #include 26 | #include 27 | 28 | struct storage_backend_interface; 29 | 30 | struct eeprom 31 | { 32 | uint16_t type; 33 | void* storage; 34 | const struct storage_backend_interface* istorage; 35 | }; 36 | 37 | 38 | void format_eeprom(uint8_t* eeprom, size_t size); 39 | 40 | void init_eeprom(struct eeprom* eeprom, 41 | uint16_t type, 42 | void* storage, 43 | const struct storage_backend_interface* istorage); 44 | 45 | void eeprom_read_block(struct eeprom* eeprom, 46 | uint8_t block, uint8_t* data); 47 | 48 | void eeprom_write_block(struct eeprom* eeprom, 49 | uint8_t block, const uint8_t* data, uint8_t* status); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/device/r4300/cp2.c: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - cp2.c * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2002 Hacktarux * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #include 23 | #include 24 | 25 | #include "cp0.h" 26 | #include "cp1.h" 27 | #include "cp2.h" 28 | 29 | #include "new_dynarec/new_dynarec.h" 30 | 31 | #define FCR31_FS_BIT UINT32_C(0x2000000) 32 | 33 | void init_cp2(struct cp2* cp2, struct new_dynarec_hot_state* new_dynarec_hot_state) 34 | { 35 | #ifdef NEW_DYNAREC 36 | cp2->new_dynarec_hot_state = new_dynarec_hot_state; 37 | #endif 38 | } 39 | 40 | void poweron_cp2(struct cp2* cp2) 41 | { 42 | *r4300_cp2_latch(cp2) = 0; 43 | } 44 | 45 | uint64_t* r4300_cp2_latch(struct cp2* cp2) 46 | { 47 | #ifndef NEW_DYNAREC 48 | /* New dynarec uses a different memory layout */ 49 | return &cp2->latch; 50 | #else 51 | return &cp2->new_dynarec_hot_state->cp2_latch; 52 | #endif 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/api/debugger.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus-core - api/debugger.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2009 Richard Goedeken * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | /* This file contains the definitions for debugger functions which will be 23 | * called from the other Core modules 24 | */ 25 | 26 | #if !defined(API_DEBUGGER_H) 27 | #define API_DEBUGGER_H 28 | 29 | #include "m64p_types.h" 30 | 31 | /* Debugger Definitions */ 32 | 33 | typedef enum { 34 | DEBUG_UI_INIT = 1, 35 | DEBUG_UI_UPDATE, 36 | DEBUG_UI_VI, 37 | DEBUG_CORE_COMPARE 38 | } eDbgCallbackType; 39 | 40 | /* Functions for use by the Core, to send information back to the front-end app */ 41 | extern int DebuggerCallbacksAreSet(void); 42 | extern void DebuggerCallback(eDbgCallbackType type, unsigned int param); 43 | extern void CoreCompareCallback(void); 44 | extern void CoreCompareDataSync(int length, void *ptr); 45 | 46 | #endif /* API_DEBUGGER_H */ 47 | 48 | -------------------------------------------------------------------------------- /src/device/r4300/new_dynarec/arm/arm_cpu_features.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - arm_cpu_features.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2015 Gilles Siberlin * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_R4300_NEW_DYNAREC_ARM_ARM_CPU_FEATURES_H 23 | #define M64P_DEVICE_R4300_NEW_DYNAREC_ARM_ARM_CPU_FEATURES_H 24 | 25 | typedef struct 26 | { 27 | unsigned char SWP; 28 | unsigned char Half; 29 | unsigned char Thumb; 30 | unsigned char FastMult; 31 | unsigned char VFP; 32 | unsigned char EDSP; 33 | unsigned char ThumbEE; 34 | unsigned char NEON; 35 | unsigned char VFPv3; 36 | unsigned char TLS; 37 | unsigned char VFPv4; 38 | unsigned char IDIVa; 39 | unsigned char IDIVt; 40 | }arm_cpu_features_t; 41 | 42 | extern arm_cpu_features_t arm_cpu_features; 43 | void detect_arm_cpu_features(void); 44 | void print_arm_cpu_features(void); 45 | 46 | #endif /* M64P_DEVICE_R4300_NEW_DYNAREC_ARM_ARM_CPU_FEATURES_H */ 47 | -------------------------------------------------------------------------------- /src/device/controllers/paks/transferpak.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - transferpak.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_SI_TRANSFERPAK_H 23 | #define M64P_DEVICE_SI_TRANSFERPAK_H 24 | 25 | #include 26 | #include 27 | 28 | struct gb_cart; 29 | 30 | enum cart_access_mode 31 | { 32 | CART_NOT_INSERTED = 0x40, 33 | CART_ACCESS_MODE_0 = 0x80, 34 | CART_ACCESS_MODE_1 = 0x89 35 | }; 36 | 37 | struct transferpak 38 | { 39 | unsigned int enabled; 40 | unsigned int bank; 41 | unsigned int access_mode; 42 | unsigned int access_mode_changed; 43 | 44 | struct gb_cart* gb_cart; 45 | }; 46 | 47 | void init_transferpak(struct transferpak* tpk, struct gb_cart* gb_cart); 48 | void poweron_transferpak(struct transferpak* tpk); 49 | 50 | void change_gb_cart(struct transferpak* tpk, struct gb_cart* gb_cart); 51 | 52 | extern const struct pak_interface g_itransferpak; 53 | #endif 54 | -------------------------------------------------------------------------------- /tools/build_modules_src.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3 | # * Mupen64plus - build_modules_src.sh * 4 | # * Mupen64Plus homepage: https://mupen64plus.org/ * 5 | # * Copyright (C) 2009-2013 Richard Goedeken * 6 | # * * 7 | # * This program is free software; you can redistribute it and/or modify * 8 | # * it under the terms of the GNU General Public License as published by * 9 | # * the Free Software Foundation; either version 2 of the License, or * 10 | # * (at your option) any later version. * 11 | # * * 12 | # * This program is distributed in the hope that it will be useful, * 13 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | # * GNU General Public License for more details. * 16 | # * * 17 | # * You should have received a copy of the GNU General Public License * 18 | # * along with this program; if not, write to the * 19 | # * Free Software Foundation, Inc., * 20 | # * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 21 | # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 22 | 23 | # terminate the script if any commands return a non-zero error code 24 | set -e 25 | 26 | if [ $# -lt 2 ]; then 27 | echo "Usage: build_modules_src.sh " 28 | exit 1 29 | fi 30 | 31 | modules='mupen64plus-core mupen64plus-rom mupen64plus-ui-console mupen64plus-audio-sdl mupen64plus-input-sdl mupen64plus-rsp-hle mupen64plus-video-rice mupen64plus-video-glide64mk2' 32 | for modname in ${modules}; do 33 | echo "************************************ Downloading and packaging module source code: ${modname}" 34 | rm -rf "tmp" 35 | OUTPUTDIR="${modname}-$2" 36 | git clone --bare "https://github.com/mupen64plus/${modname}.git" "tmp" 37 | git --git-dir="$(pwd)/tmp/" archive --format=tar --prefix="${OUTPUTDIR}/" $1 | gzip -n --best > "${OUTPUTDIR}.tar.gz" 38 | rm -rf "tmp" 39 | done 40 | -------------------------------------------------------------------------------- /src/device/cart/af_rtc.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - af_rtc.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_SI_AF_RTC_H 23 | #define M64P_DEVICE_SI_AF_RTC_H 24 | 25 | #include 26 | #include 27 | 28 | struct clock_backend_interface; 29 | 30 | struct af_rtc 31 | { 32 | /* block 0 */ 33 | uint16_t control; 34 | /* block 2 */ 35 | time_t now; 36 | 37 | time_t last_update_rtc; 38 | void* clock; 39 | const struct clock_backend_interface* iclock; 40 | }; 41 | 42 | void init_af_rtc(struct af_rtc* rtc, 43 | void* clock, 44 | const struct clock_backend_interface* iclock); 45 | 46 | void poweron_af_rtc(struct af_rtc* rtc); 47 | 48 | void af_rtc_read_block(struct af_rtc* rtc, 49 | uint8_t block, uint8_t* data, uint8_t* status); 50 | 51 | void af_rtc_write_block(struct af_rtc* rtc, 52 | uint8_t block, const uint8_t* data, uint8_t* status); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/device/rcp/ri/ri_controller.c: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - ri_controller.c * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #include "ri_controller.h" 23 | 24 | #include 25 | 26 | #include "device/memory/memory.h" 27 | 28 | void init_ri(struct ri_controller* ri, struct rdram* rdram) 29 | { 30 | ri->rdram = rdram; 31 | } 32 | 33 | void poweron_ri(struct ri_controller* ri) 34 | { 35 | memset(ri->regs, 0, RI_REGS_COUNT*sizeof(uint32_t)); 36 | } 37 | 38 | 39 | void read_ri_regs(void* opaque, uint32_t address, uint32_t* value) 40 | { 41 | struct ri_controller* ri = (struct ri_controller*)opaque; 42 | uint32_t reg = ri_reg(address); 43 | 44 | *value = ri->regs[reg]; 45 | } 46 | 47 | void write_ri_regs(void* opaque, uint32_t address, uint32_t value, uint32_t mask) 48 | { 49 | struct ri_controller* ri = (struct ri_controller*)opaque; 50 | uint32_t reg = ri_reg(address); 51 | 52 | masked_write(&ri->regs[reg], value, mask); 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/device/cart/sram.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - sram.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_PI_SRAM_H 23 | #define M64P_DEVICE_PI_SRAM_H 24 | 25 | #include 26 | 27 | struct storage_backend_interface; 28 | 29 | enum { SRAM_SIZE = 0x8000 }; 30 | 31 | struct sram 32 | { 33 | void* storage; 34 | const struct storage_backend_interface* istorage; 35 | }; 36 | 37 | void format_sram(uint8_t* sram); 38 | 39 | void init_sram(struct sram* sram, 40 | void* storage, const struct storage_backend_interface* istorage); 41 | 42 | unsigned int sram_dma_read(void* opaque, const uint8_t* dram, uint32_t dram_addr, uint32_t cart_addr, uint32_t length); 43 | unsigned int sram_dma_write(void* opaque, uint8_t* dram, uint32_t dram_addr, uint32_t cart_addr, uint32_t length); 44 | void read_sram(void* opaque, uint32_t address, uint32_t* value); 45 | void write_sram(void* opaque, uint32_t address, uint32_t value, uint32_t mask); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/device/controllers/paks/mempak.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - mempak.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_SI_MEMPAK_H 23 | #define M64P_DEVICE_SI_MEMPAK_H 24 | 25 | #include 26 | #include 27 | 28 | struct storage_backend_interface; 29 | 30 | #define DEFAULT_MEMPAK_DEVICEID UINT16_C(0x0001) 31 | #define DEFAULT_MEMPAK_BANKS UINT8_C(0x01) 32 | #define DEFAULT_MEMPAK_VERSION UINT8_C(0x00) 33 | 34 | struct mempak 35 | { 36 | void* storage; 37 | const struct storage_backend_interface* istorage; 38 | }; 39 | 40 | enum { MEMPAK_SIZE = 0x8000 }; 41 | 42 | void format_mempak(uint8_t* mem, 43 | const uint32_t serial[6], 44 | uint16_t device_id, 45 | uint8_t banks, 46 | uint8_t version); 47 | 48 | void init_mempak(struct mempak* mpk, 49 | void* storage, 50 | const struct storage_backend_interface* istorage); 51 | 52 | extern const struct pak_interface g_imempak; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/main/cheat.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - cheat.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2008 Okaygo * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_MAIN_CHEAT_H 23 | #define M64P_MAIN_CHEAT_H 24 | 25 | #include "api/m64p_types.h" 26 | 27 | #include "list.h" 28 | 29 | #include 30 | 31 | #define ENTRY_BOOT 0 32 | #define ENTRY_VI 1 33 | 34 | struct SDL_mutex; 35 | struct r4300_core; 36 | 37 | struct cheat_ctx 38 | { 39 | struct SDL_mutex* mutex; 40 | struct list_head active_cheats; 41 | }; 42 | 43 | void cheat_apply_cheats(struct cheat_ctx* ctx, struct r4300_core* r4300, int entry); 44 | 45 | void cheat_init(struct cheat_ctx* ctx); 46 | void cheat_uninit(struct cheat_ctx* ctx); 47 | int cheat_add_new(struct cheat_ctx* ctx, const char* name, m64p_cheat_code* code_list, int num_codes); 48 | int cheat_set_enabled(struct cheat_ctx* ctx, const char* name, int enabled); 49 | void cheat_delete_all(struct cheat_ctx* ctx); 50 | int cheat_add_hacks(struct cheat_ctx* ctx, const char* rom_cheats); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/api/callbacks.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus-core - api/callbacks.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2009 Richard Goedeken * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | /* This file contains the definitions for callback functions which will be 23 | * called from the other Core modules 24 | */ 25 | 26 | #if !defined(API_CALLBACKS_H) 27 | #define API_CALLBACKS_H 28 | 29 | #include "m64p_frontend.h" 30 | #include "m64p_types.h" 31 | 32 | #if defined(__GNUC__) 33 | #define ATTR_FMT(fmtpos, attrpos) __attribute__ ((format (printf, fmtpos, attrpos))) 34 | #else 35 | #define ATTR_FMT(fmtpos, attrpos) 36 | #endif 37 | 38 | /* Functions for use by the Core, to send information back to the front-end app */ 39 | extern m64p_error SetDebugCallback(ptr_DebugCallback pFunc, void *Context); 40 | extern m64p_error SetStateCallback(ptr_StateCallback pFunc, void *Context); 41 | extern void DebugMessage(int level, const char *message, ...) ATTR_FMT(2,3); 42 | extern void StateChanged(m64p_core_param param_type, int new_value); 43 | 44 | #endif /* API_CALLBACKS_H */ 45 | 46 | -------------------------------------------------------------------------------- /src/debugger/dbg_decoder.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - dbg_decoder.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2010 Marshall B. Rogers * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef __DECODER_H__ 23 | #define __DECODER_H__ 24 | 25 | #if defined(WIN32) 26 | typedef unsigned int uint32_t; 27 | typedef unsigned char bool; 28 | #define false 0 29 | #define true 1 30 | #else 31 | #include 32 | #include 33 | #endif 34 | 35 | /* Disassembler lookup handler */ 36 | typedef char * (*r4k_lookup_func)(uint32_t, void *); 37 | 38 | /* Disassembler state */ 39 | typedef 40 | struct r4k_dis_t 41 | { 42 | r4k_lookup_func lookup_sym; 43 | void * lookup_sym_d; 44 | r4k_lookup_func lookup_rel_hi16; 45 | void * lookup_rel_hi16_d; 46 | r4k_lookup_func lookup_rel_lo16; 47 | void * lookup_rel_lo16_d; 48 | 49 | /* Private */ 50 | char * dest; 51 | int length; 52 | } 53 | R4kDis; 54 | 55 | extern void r4300_decode_op (uint32_t, char *, char *, uint32_t); 56 | 57 | 58 | #endif /* __DECODER_H__ */ 59 | 60 | -------------------------------------------------------------------------------- /src/main/workqueue.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - util.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2012 Mupen64plus development team * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef __WORKQUEUE_H__ 23 | #define __WORKQUEUE_H__ 24 | 25 | #include "list.h" 26 | #include "osal/preproc.h" 27 | 28 | struct work_struct; 29 | 30 | typedef void (*work_func_t)(struct work_struct *work); 31 | struct work_struct { 32 | work_func_t func; 33 | struct list_head list; 34 | }; 35 | 36 | static osal_inline void init_work(struct work_struct *work, work_func_t func) 37 | { 38 | INIT_LIST_HEAD(&work->list); 39 | work->func = func; 40 | } 41 | 42 | #ifdef M64P_PARALLEL 43 | 44 | int workqueue_init(void); 45 | void workqueue_shutdown(void); 46 | int queue_work(struct work_struct *work); 47 | 48 | #else 49 | 50 | static osal_inline int workqueue_init(void) 51 | { 52 | return 0; 53 | } 54 | 55 | static osal_inline void workqueue_shutdown(void) 56 | { 57 | } 58 | 59 | static osal_inline int queue_work(struct work_struct *work) 60 | { 61 | work->func(work); 62 | return 0; 63 | } 64 | 65 | #endif 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /doc/font-license: -------------------------------------------------------------------------------- 1 | Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. 2 | 3 | Bitstream Vera Sans 4 | Bitstream Vera Sans - Roman Release 1.10 Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. 5 | 6 | Bitstream Vera is a trademark of Bitstream, Inc. 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts 9 | accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to 10 | reproduce and distribute the Font Software, including without limitation the rights to use, copy, 11 | merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom 12 | the Font Software is furnished to do so, subject to the following conditions: 13 | 14 | The above copyright and trademark notices and this permission notice shall be included in all copies 15 | of one or more of the Font Software typefaces. 16 | 17 | The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or 18 | characters in the Fonts may be modified and additional glyphs or characters may be added to the 19 | Fonts, only if the fonts are renamed to names not containing either the words "Bitstream" or the word 20 | "Vera". 21 | 22 | This License becomes null and void to the extent applicable to Fonts or Font Software that has been 23 | modified and is distributed under the "Bitstream Vera" names. 24 | 25 | The Font Software may be sold as part of a larger software package but no copy of one or more of the 26 | Font Software typefaces may be sold by itself. 27 | 28 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 29 | BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 30 | NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE 31 | GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, 32 | SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR 33 | OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER 34 | DEALINGS IN THE FONT SOFTWARE. 35 | 36 | Except as contained in this notice, the names of Gnome, the Gnome Foundation, and Bitstream Inc., 37 | shall not be used in advertising or otherwise to promote the sale, use or other dealings in this 38 | Font Software without prior written authorization from the Gnome Foundation or Bitstream Inc., 39 | respectively. For further information, contact: fonts at gnome dot org.http://www.bitstream.com 40 | 41 | -------------------------------------------------------------------------------- /src/plugin/dummy_rsp.c: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - dummy_rsp.c * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2009 Richard Goedeken * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #include 23 | 24 | #include "api/m64p_types.h" 25 | #include "dummy_rsp.h" 26 | #include "plugin.h" 27 | 28 | m64p_error dummyrsp_PluginGetVersion(m64p_plugin_type *PluginType, int *PluginVersion, 29 | int *APIVersion, const char **PluginNamePtr, int *Capabilities) 30 | { 31 | if (PluginType != NULL) 32 | *PluginType = M64PLUGIN_RSP; 33 | 34 | if (PluginVersion != NULL) 35 | *PluginVersion = 0x00010000; 36 | 37 | if (APIVersion != NULL) 38 | *APIVersion = RSP_API_VERSION; 39 | 40 | if (PluginNamePtr != NULL) 41 | *PluginNamePtr = "Mupen64Plus-NoRSP"; 42 | 43 | if (Capabilities != NULL) 44 | *Capabilities = 0; 45 | 46 | return M64ERR_SUCCESS; 47 | } 48 | 49 | unsigned int dummyrsp_DoRspCycles(unsigned int Cycles) 50 | { 51 | return Cycles; 52 | } 53 | 54 | void dummyrsp_InitiateRSP(RSP_INFO Rsp_Info, unsigned int * CycleCount) 55 | { 56 | } 57 | 58 | void dummyrsp_RomClosed(void) 59 | { 60 | } 61 | 62 | -------------------------------------------------------------------------------- /src/plugin/dummy_audio.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - dummy_audio.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2008-2009 Richard Goedeken * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #if !defined(DUMMY_AUDIO_H) 23 | #define DUMMY_AUDIO_H 24 | 25 | #include "api/m64p_plugin.h" 26 | #include "api/m64p_types.h" 27 | 28 | extern m64p_error dummyaudio_PluginGetVersion(m64p_plugin_type *PluginType, int *PluginVersion, 29 | int *APIVersion, const char **PluginNamePtr, int *Capabilities); 30 | extern void dummyaudio_AiDacrateChanged(int SystemType); 31 | extern void dummyaudio_AiLenChanged(void); 32 | extern int dummyaudio_InitiateAudio(AUDIO_INFO Audio_Info); 33 | extern void dummyaudio_ProcessAList(void); 34 | extern int dummyaudio_RomOpen(void); 35 | extern void dummyaudio_RomClosed(void); 36 | extern void dummyaudio_SetSpeedFactor(int percent); 37 | extern void dummyaudio_VolumeUp(void); 38 | extern void dummyaudio_VolumeDown(void); 39 | extern int dummyaudio_VolumeGetLevel(void); 40 | extern void dummyaudio_VolumeSetLevel(int level); 41 | extern void dummyaudio_VolumeMute(void); 42 | extern const char * dummyaudio_VolumeGetString(void); 43 | 44 | #endif /* DUMMY_AUDIO_H */ 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/debugger/dbg_breakpoints.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - dbg_breakpoints.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2008 DarkJeztr HyperHacker * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef __BREAKPOINTS_H__ 23 | #define __BREAKPOINTS_H__ 24 | 25 | #include "../api/m64p_types.h" 26 | 27 | #include 28 | 29 | struct memory; 30 | 31 | extern int g_NumBreakpoints; 32 | extern m64p_breakpoint g_Breakpoints[]; 33 | 34 | int add_breakpoint(struct memory* mem, uint32_t address); 35 | int add_breakpoint_struct(struct memory* mem, m64p_breakpoint *newbp); 36 | void remove_breakpoint_by_address(struct memory* mem, uint32_t address); 37 | void remove_breakpoint_by_num(struct memory* mem, int bpt); 38 | void enable_breakpoint(struct memory* mem, int breakpoint); 39 | void disable_breakpoint(struct memory* mem, int breakpoint); 40 | int check_breakpoints(uint32_t address); 41 | int check_breakpoints_on_mem_access(uint32_t pc, uint32_t address, uint32_t size, uint32_t flags); 42 | int lookup_breakpoint(uint32_t address, uint32_t size, uint32_t flags); 43 | int log_breakpoint(uint32_t PC, uint32_t Flag, uint32_t Access); 44 | void replace_breakpoint_num(struct memory* mem, int, m64p_breakpoint*); 45 | 46 | #endif /* __BREAKPOINTS_H__ */ 47 | 48 | -------------------------------------------------------------------------------- /src/device/r4300/tlb.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - tlb.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2002 Hacktarux * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_R4300_TLB_H 23 | #define M64P_DEVICE_R4300_TLB_H 24 | 25 | #include 26 | #include 27 | 28 | struct r4300_core; 29 | 30 | struct tlb_entry 31 | { 32 | short mask; 33 | unsigned int vpn2; 34 | char g; 35 | unsigned char asid; 36 | unsigned int pfn_even; 37 | char c_even; 38 | char d_even; 39 | char v_even; 40 | unsigned int pfn_odd; 41 | char c_odd; 42 | char d_odd; 43 | char v_odd; 44 | char r; 45 | //int check_parity_mask; 46 | 47 | unsigned int start_even; 48 | unsigned int end_even; 49 | unsigned int phys_even; 50 | unsigned int start_odd; 51 | unsigned int end_odd; 52 | unsigned int phys_odd; 53 | }; 54 | 55 | struct tlb 56 | { 57 | struct tlb_entry entries[32]; 58 | uint32_t LUT_r[0x100000]; 59 | uint32_t LUT_w[0x100000]; 60 | }; 61 | 62 | void poweron_tlb(struct tlb* tlb); 63 | 64 | void tlb_unmap(struct tlb* tlb, size_t entry); 65 | void tlb_map(struct tlb* tlb, size_t entry); 66 | 67 | uint32_t virtual_to_physical_address(struct r4300_core* r4300, uint32_t address, int w); 68 | 69 | #endif /* M64P_DEVICE_R4300_TLB_H */ 70 | -------------------------------------------------------------------------------- /src/device/rcp/rdp/fb.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - fb.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_RCP_RDP_FB_H 23 | #define M64P_DEVICE_RCP_RDP_FB_H 24 | 25 | #include 26 | 27 | #include "api/m64p_plugin.h" 28 | 29 | struct memory; 30 | struct rdram; 31 | struct r4300_core; 32 | 33 | enum { FB_INFOS_COUNT = 6 }; 34 | enum { FB_DIRTY_PAGES_COUNT = 0x800 }; 35 | 36 | struct fb 37 | { 38 | struct memory* mem; 39 | struct rdram* rdram; 40 | struct r4300_core* r4300; 41 | 42 | unsigned char dirty_page[FB_DIRTY_PAGES_COUNT]; 43 | FrameBufferInfo infos[FB_INFOS_COUNT]; 44 | unsigned int once; 45 | }; 46 | 47 | void init_fb(struct fb* fb, 48 | struct memory* mem, 49 | struct rdram* rdram, 50 | struct r4300_core* r4300); 51 | 52 | void poweron_fb(struct fb* fb); 53 | 54 | void read_rdram_fb(void* opaque, uint32_t address, uint32_t* value); 55 | void write_rdram_fb(void* opaque, uint32_t address, uint32_t value, uint32_t mask); 56 | 57 | void protect_framebuffers(struct fb* fb); 58 | void unprotect_framebuffers(struct fb* fb); 59 | 60 | void pre_framebuffer_read(struct fb* fb, uint32_t address); 61 | void post_framebuffer_write(struct fb* fb, uint32_t address, uint32_t length); 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/backends/api/video_capture_backend.c: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - video_capture_backend.c * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2018 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #include "video_capture_backend.h" 23 | 24 | #include 25 | 26 | /* exported video capture backends */ 27 | extern const struct video_capture_backend_interface g_idummy_video_capture_backend; 28 | #if defined(M64P_OPENCV) 29 | extern const struct video_capture_backend_interface g_iopencv_video_capture_backend; 30 | #endif 31 | 32 | 33 | const struct video_capture_backend_interface* g_video_capture_backend_interfaces[] = 34 | { 35 | #if defined(M64P_OPENCV) 36 | &g_iopencv_video_capture_backend, 37 | #endif 38 | &g_idummy_video_capture_backend, 39 | NULL /* sentinel - must be last element */ 40 | }; 41 | 42 | 43 | const struct video_capture_backend_interface* get_video_capture_backend(const char* name) 44 | { 45 | const struct video_capture_backend_interface** i; 46 | 47 | /* passing NULL or empty string gives the dummy video input backend interface */ 48 | if (!name || strlen(name) == 0) { return &g_idummy_video_capture_backend; } 49 | 50 | /* iterate through interfaces to find matching name */ 51 | for (i = g_video_capture_backend_interfaces; (*i) != NULL; ++i) { 52 | if (strcmp((*i)->name, name) == 0) { return (*i); } 53 | } 54 | 55 | return NULL; 56 | } 57 | -------------------------------------------------------------------------------- /src/device/r4300/x86_64/assemble_struct.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - assemble_struct.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2007 Richard Goedeken (Richard42) * 5 | * Copyright (C) 2002 Hacktarux * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 2 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the * 19 | * Free Software Foundation, Inc., * 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 21 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 22 | 23 | #ifndef M64P_DEVICE_R4300_X86_64_ASSEMBLE_STRUCT_H 24 | #define M64P_DEVICE_R4300_X86_64_ASSEMBLE_STRUCT_H 25 | 26 | struct precomp_instr; 27 | 28 | struct regcache_state { 29 | unsigned long long * reg_content[8]; 30 | struct precomp_instr* last_access[8]; 31 | struct precomp_instr* free_since[8]; 32 | int dirty[8]; 33 | int is64bits[8]; 34 | unsigned long long *r0; 35 | }; 36 | 37 | struct reg_cache 38 | { 39 | int need_map; 40 | void *needed_registers[8]; 41 | unsigned char jump_wrapper[84]; 42 | int need_cop1_check; 43 | }; 44 | 45 | struct jump_table 46 | { 47 | unsigned int mi_addr; 48 | unsigned int pc_addr; 49 | unsigned int absolute64; 50 | }; 51 | 52 | struct riprelative_table 53 | { 54 | unsigned int pc_addr; /* index in bytes from start of x86_64 code block to the displacement value to write */ 55 | unsigned int extra_bytes; /* number of remaining instruction bytes (immediate data) after 4-byte displacement */ 56 | unsigned char *global_dst; /* 64-bit pointer to the data object */ 57 | }; 58 | 59 | 60 | #endif /* M64P_DEVICE_R4300_X86_64_ASSEMBLE_STRUCT_H */ 61 | -------------------------------------------------------------------------------- /src/device/cart/cart_rom.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - cart_rom.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_PI_CART_ROM_H 23 | #define M64P_DEVICE_PI_CART_ROM_H 24 | 25 | #include 26 | #include 27 | 28 | #include "osal/preproc.h" 29 | 30 | struct r4300_core; 31 | struct pi_controller; 32 | 33 | struct cart_rom 34 | { 35 | uint8_t* rom; 36 | size_t rom_size; 37 | 38 | uint32_t last_write; 39 | 40 | struct r4300_core* r4300; 41 | struct pi_controller* pi; 42 | }; 43 | 44 | static osal_inline uint32_t rom_address(uint32_t address) 45 | { 46 | return (address & 0x03fffffc); 47 | } 48 | 49 | void init_cart_rom(struct cart_rom* cart_rom, 50 | uint8_t* rom, size_t rom_size, 51 | struct r4300_core* r4300, 52 | struct pi_controller* pi); 53 | 54 | void poweron_cart_rom(struct cart_rom* cart_rom); 55 | 56 | void read_cart_rom(void* opaque, uint32_t address, uint32_t* value); 57 | void write_cart_rom(void* opaque, uint32_t address, uint32_t value, uint32_t mask); 58 | 59 | unsigned int cart_rom_dma_read(void* opaque, const uint8_t* dram, uint32_t dram_addr, uint32_t cart_addr, uint32_t length); 60 | unsigned int cart_rom_dma_write(void* opaque, uint8_t* dram, uint32_t dram_addr, uint32_t cart_addr, uint32_t length); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/device/rcp/mi/mi_controller.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - mi_controller.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_RCP_MI_MI_CONTROLLER_H 23 | #define M64P_DEVICE_RCP_MI_MI_CONTROLLER_H 24 | 25 | #include 26 | 27 | #include "osal/preproc.h" 28 | 29 | struct r4300_core; 30 | 31 | enum mi_registers 32 | { 33 | MI_INIT_MODE_REG, 34 | MI_VERSION_REG, 35 | MI_INTR_REG, 36 | MI_INTR_MASK_REG, 37 | MI_REGS_COUNT 38 | }; 39 | 40 | 41 | enum mi_intr 42 | { 43 | MI_INTR_SP = 0x01, 44 | MI_INTR_SI = 0x02, 45 | MI_INTR_AI = 0x04, 46 | MI_INTR_VI = 0x08, 47 | MI_INTR_PI = 0x10, 48 | MI_INTR_DP = 0x20 49 | }; 50 | 51 | struct mi_controller 52 | { 53 | uint32_t regs[MI_REGS_COUNT]; 54 | 55 | struct r4300_core* r4300; 56 | }; 57 | 58 | static osal_inline uint32_t mi_reg(uint32_t address) 59 | { 60 | return (address & 0xffff) >> 2; 61 | } 62 | 63 | void init_mi(struct mi_controller* mi, struct r4300_core* r4300); 64 | void poweron_mi(struct mi_controller* mi); 65 | 66 | void read_mi_regs(void* opaque, uint32_t address, uint32_t* value); 67 | void write_mi_regs(void* opaque, uint32_t address, uint32_t value, uint32_t mask); 68 | 69 | void raise_rcp_interrupt(struct mi_controller* mi, uint32_t mi_intr); 70 | void signal_rcp_interrupt(struct mi_controller* mi, uint32_t mi_intr); 71 | void clear_rcp_interrupt(struct mi_controller* mi, uint32_t mi_intr); 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /src/plugin/dummy_video.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - dummy_video.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2009 Richard Goedeken * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #if !defined(DUMMY_VIDEO_H) 23 | #define DUMMY_VIDEO_H 24 | 25 | #include "api/m64p_plugin.h" 26 | #include "api/m64p_types.h" 27 | 28 | extern m64p_error dummyvideo_PluginGetVersion(m64p_plugin_type *PluginType, int *PluginVersion, 29 | int *APIVersion, const char **PluginNamePtr, int *Capabilities); 30 | extern void dummyvideo_ChangeWindow(void); 31 | extern int dummyvideo_InitiateGFX(GFX_INFO Gfx_Info); 32 | extern void dummyvideo_MoveScreen(int xpos, int ypos); 33 | extern void dummyvideo_ProcessDList(void); 34 | extern void dummyvideo_ProcessRDPList(void); 35 | extern void dummyvideo_RomClosed(void); 36 | extern int dummyvideo_RomOpen(void); 37 | extern void dummyvideo_ShowCFB(void); 38 | extern void dummyvideo_UpdateScreen(void); 39 | extern void dummyvideo_ViStatusChanged(void); 40 | extern void dummyvideo_ViWidthChanged(void); 41 | extern void dummyvideo_ReadScreen2(void *dest, int *width, int *height, int front); 42 | extern void dummyvideo_SetRenderingCallback(void (*callback)(int)); 43 | extern void dummyvideo_ResizeVideoOutput(int width, int height); 44 | 45 | extern void dummyvideo_FBRead(unsigned int addr); 46 | extern void dummyvideo_FBWrite(unsigned int addr, unsigned int size); 47 | extern void dummyvideo_FBGetFrameBufferInfo(void *p); 48 | 49 | #endif /* DUMMY_VIDEO_H */ 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/backends/api/controller_input_backend.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - controller_input_backend.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2016 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_BACKENDS_API_CONTROLLER_INPUT_BACKEND_H 23 | #define M64P_BACKENDS_API_CONTROLLER_INPUT_BACKEND_H 24 | 25 | #include "api/m64p_types.h" 26 | 27 | #include 28 | 29 | enum standard_controller_input { 30 | CI_STD_R_DPAD = 0x0001, 31 | CI_STD_L_DPAD = 0x0002, 32 | CI_STD_D_DPAD = 0x0004, 33 | CI_STD_U_DPAD = 0x0008, 34 | CI_STD_START = 0x0010, 35 | CI_STD_Z = 0x0020, 36 | CI_STD_B = 0x0040, 37 | CI_STD_A = 0x0080, 38 | CI_STD_R_CBTN = 0x0100, 39 | CI_STD_L_CBTN = 0x0200, 40 | CI_STD_D_CBTN = 0x0400, 41 | CI_STD_U_CBTN = 0x0800, 42 | CI_STD_R = 0x1000, 43 | CI_STD_L = 0x2000, 44 | /* bits 14 and 15 are reserved */ 45 | /* bits 23-16 are for X-axis */ 46 | /* bits 31-24 are for Y-axis */ 47 | }; 48 | 49 | enum mouse_controller_input { 50 | CI_MOUSE_RIGHT = 0x0040, 51 | CI_MOUSE_LEFT = 0x0080, 52 | /* bits 23-16 are for X-axis */ 53 | /* bits 31-24 are for Y-axis */ 54 | }; 55 | 56 | 57 | struct controller_input_backend_interface 58 | { 59 | /* Get emulated controller input status (32-bit) 60 | * Encoding of the input status depends on the emulated controller flavor. 61 | * Returns M64ERR_SUCCESS on success 62 | */ 63 | m64p_error (*get_input)(void* cin, uint32_t* input); 64 | }; 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/osal/files.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus-core - osal/files.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2009 Richard Goedeken * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | /* This file contains the declarations for OS-dependent file handling 23 | * functions 24 | */ 25 | 26 | #if !defined (OSAL_FILES_H) 27 | #define OSAL_FILES_H 28 | 29 | /* some file-related preprocessor definitions */ 30 | #if defined(WIN32) 31 | #include // For _unlink() 32 | 33 | #define unlink _unlink 34 | 35 | #define OSAL_DIR_SEPARATORS "\\/" 36 | #define WIDE_OSAL_DIR_SEPARATORS L"\\/" 37 | 38 | #ifndef PATH_MAX 39 | #define PATH_MAX _MAX_PATH 40 | #endif 41 | #else /* Not WIN32 */ 42 | #include // for PATH_MAX 43 | #include // for unlink() 44 | 45 | #define OSAL_DIR_SEPARATORS "/" 46 | 47 | /* PATH_MAX only may be defined by limits.h */ 48 | #ifndef PATH_MAX 49 | #define PATH_MAX 4096 50 | #endif 51 | #endif 52 | 53 | /* Create a directory path recursively. 54 | * Returns zero on success, nonzero on failure. 55 | * Note that, unlike mkdir(), this function succeeds if the path already exists. 56 | */ 57 | extern int osal_mkdirp(const char *dirpath, int mode); 58 | 59 | extern const char * osal_get_shared_filepath(const char *filename, const char *firstsearch, const char *secondsearch); 60 | extern const char * osal_get_user_configpath(void); 61 | extern const char * osal_get_user_datapath(void); 62 | extern const char * osal_get_user_cachepath(void); 63 | 64 | #endif /* OSAL_FILES_H */ 65 | 66 | -------------------------------------------------------------------------------- /src/device/rcp/ri/ri_controller.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - ri_controller.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_RCP_RI_RI_CONTROLLER_H 23 | #define M64P_DEVICE_RCP_RI_RI_CONTROLLER_H 24 | 25 | #include 26 | #include 27 | 28 | #include "osal/preproc.h" 29 | 30 | struct rdram; 31 | 32 | enum ri_registers 33 | { 34 | RI_MODE_REG, 35 | RI_CONFIG_REG, 36 | RI_CURRENT_LOAD_REG, 37 | RI_SELECT_REG, 38 | RI_REFRESH_REG, 39 | RI_LATENCY_REG, 40 | RI_ERROR_REG, 41 | RI_WERROR_REG, 42 | RI_REGS_COUNT 43 | }; 44 | 45 | struct ri_controller 46 | { 47 | uint32_t regs[RI_REGS_COUNT]; 48 | 49 | struct rdram* rdram; 50 | }; 51 | 52 | static osal_inline uint32_t ri_reg(uint32_t address) 53 | { 54 | return (address & 0xffff) >> 2; 55 | } 56 | 57 | static osal_inline uint16_t ri_address_to_id_field(uint32_t address) 58 | { 59 | /* XXX: pure guessing, need harware test */ 60 | return (uint16_t)(((address >> 20) == 0x03f) 61 | ? (address & 0x0007fc00) >> 10 /* RDRAM registers id_field: [19..10] */ 62 | : (address & 0x00f00000) >> 20); /* RDRAM memory id_field: [23..20] */ 63 | } 64 | 65 | 66 | 67 | void init_ri(struct ri_controller* ri, struct rdram* rdram); 68 | 69 | void poweron_ri(struct ri_controller* ri); 70 | 71 | void read_ri_regs(void* opaque, uint32_t address, uint32_t* value); 72 | void write_ri_regs(void* opaque, uint32_t address, uint32_t value, uint32_t mask); 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /src/backends/plugins_compat/plugins_compat.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - plugins_compat.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2017 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_BACKENDS_PLUGINS_COMPAT_PLUGINS_COMPAT_H 23 | #define M64P_BACKENDS_PLUGINS_COMPAT_PLUGINS_COMPAT_H 24 | 25 | #include "backends/api/audio_out_backend.h" 26 | #include "backends/api/controller_input_backend.h" 27 | #include "backends/api/rumble_backend.h" 28 | #include "backends/api/joybus.h" 29 | 30 | #include 31 | 32 | /* Audio Out backend interface */ 33 | 34 | extern const struct audio_out_backend_interface 35 | g_iaudio_out_backend_plugin_compat; 36 | 37 | /* Controller Input backend interface */ 38 | 39 | struct controller_input_compat 40 | { 41 | int control_id; 42 | 43 | struct game_controller* cont; 44 | struct transferpak* tpk; 45 | 46 | uint32_t last_input; 47 | int last_pak_type; 48 | void (*main_switch_pak)(int control_id); 49 | unsigned int pak_switch_delay; 50 | unsigned int gb_switch_delay; 51 | 52 | unsigned int gb_cart_switch_enabled; 53 | 54 | uint32_t netplay_count; 55 | struct netplay_event* event_first; 56 | }; 57 | 58 | extern const struct controller_input_backend_interface 59 | g_icontroller_input_backend_plugin_compat; 60 | 61 | /* Rumble backend interface */ 62 | 63 | extern const struct rumble_backend_interface 64 | g_irumble_backend_plugin_compat; 65 | 66 | /* PIF data processing functions */ 67 | 68 | extern const struct joybus_device_interface 69 | g_ijoybus_device_plugin_compat; 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/device/gb/mbc3_rtc.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - mbc3_rtc.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2016 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_GB_MBC3_RTC_H 23 | #define M64P_DEVICE_GB_MBC3_RTC_H 24 | 25 | #include 26 | #include 27 | 28 | struct clock_backend_interface; 29 | 30 | enum mbc3_rtc_registers 31 | { 32 | MBC3_RTC_SECONDS, /* 0-59 */ 33 | MBC3_RTC_MINUTES, /* 0-59 */ 34 | MBC3_RTC_HOURS, /* 0-23 */ 35 | MBC3_RTC_DAYS_L, /* Days Counter is 16 bit wide */ 36 | MBC3_RTC_DAYS_H, /* bits 0-8: days counter (0-511) */ 37 | /* bits 9-13: zeros ? */ 38 | /* bits 14: halt (0: stop timer, 1: active timer) */ 39 | /* bits 15: carry (0: no overflow, 1: couter overflowed) */ 40 | MBC3_RTC_REGS_COUNT 41 | }; 42 | 43 | struct mbc3_rtc 44 | { 45 | uint8_t regs[MBC3_RTC_REGS_COUNT]; 46 | 47 | unsigned int latch; 48 | uint8_t latched_regs[MBC3_RTC_REGS_COUNT]; 49 | 50 | time_t last_time; 51 | 52 | void* clock; 53 | const struct clock_backend_interface* iclock; 54 | }; 55 | 56 | void init_mbc3_rtc(struct mbc3_rtc* rtc, 57 | void* clock, 58 | const struct clock_backend_interface* iclock); 59 | 60 | void poweron_mbc3_rtc(struct mbc3_rtc* rtc); 61 | 62 | uint8_t read_mbc3_rtc_regs(struct mbc3_rtc* rtc, unsigned int reg); 63 | void write_mbc3_rtc_regs(struct mbc3_rtc* rtc, unsigned int reg, uint8_t value); 64 | void latch_mbc3_rtc_regs(struct mbc3_rtc* rtc, uint8_t data); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/device/r4300/recomp.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - recomp.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2002 Hacktarux * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_R4300_RECOMP_H 23 | #define M64P_DEVICE_R4300_RECOMP_H 24 | 25 | #include 26 | #include 27 | 28 | struct r4300_core; 29 | struct precomp_block; 30 | 31 | void dynarec_init_block(struct r4300_core* r4300, uint32_t address); 32 | void dynarec_free_block(struct precomp_block* block); 33 | void dynarec_recompile_block(struct r4300_core* r4300, const uint32_t* source, struct precomp_block* block, uint32_t func); 34 | void recompile_opcode(struct r4300_core* r4300); 35 | void dyna_jump(void); 36 | void dyna_start(void (*code)(void)); 37 | void dyna_stop(struct r4300_core* r4300); 38 | void *realloc_exec(void *ptr, size_t oldsize, size_t newsize); 39 | 40 | void dynarec_jump_to(struct r4300_core* r4300, uint32_t address); 41 | 42 | void dynarec_fin_block(void); 43 | void dynarec_notcompiled(void); 44 | void dynarec_notcompiled2(void); 45 | void dynarec_setup_code(void); 46 | void dynarec_jump_to_recomp_address(void); 47 | void dynarec_exception_general(void); 48 | int dynarec_check_cop1_unusable(void); 49 | void dynarec_cp0_update_count(void); 50 | void dynarec_gen_interrupt(void); 51 | int dynarec_read_aligned_word(void); 52 | int dynarec_write_aligned_word(void); 53 | int dynarec_read_aligned_dword(void); 54 | int dynarec_write_aligned_dword(void); 55 | 56 | 57 | #if defined(PROFILE_R4300) 58 | void profile_write_end_of_code_blocks(struct r4300_core* r4300); 59 | #endif 60 | 61 | #endif /* M64P_DEVICE_R4300_RECOMP_H */ 62 | 63 | -------------------------------------------------------------------------------- /src/main/savestates.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - savestates.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2012 CasualJames * 5 | * Copyright (C) 2009 Olejl Tillin9 * 6 | * Copyright (C) 2008 Richard42 Tillin9 * 7 | * Copyright (C) 2002 Hacktarux * 8 | * * 9 | * This program is free software; you can redistribute it and/or modify * 10 | * it under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation; either version 2 of the License, or * 12 | * (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, * 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 17 | * GNU General Public License for more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License * 20 | * along with this program; if not, write to the * 21 | * Free Software Foundation, Inc., * 22 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 23 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 24 | 25 | #ifndef __SAVESTAVES_H__ 26 | #define __SAVESTAVES_H__ 27 | 28 | typedef enum _savestates_job 29 | { 30 | savestates_job_nothing, 31 | savestates_job_load, 32 | savestates_job_save 33 | } savestates_job; 34 | 35 | typedef enum _savestates_type 36 | { 37 | savestates_type_unknown, 38 | savestates_type_m64p, 39 | savestates_type_pj64_zip, 40 | savestates_type_pj64_unc 41 | } savestates_type; 42 | 43 | savestates_job savestates_get_job(void); 44 | void savestates_set_job(savestates_job j, savestates_type t, const char *fn); 45 | void savestates_init(void); 46 | void savestates_deinit(void); 47 | 48 | int savestates_load(void); 49 | int savestates_save(void); 50 | 51 | void savestates_select_slot(unsigned int s); 52 | unsigned int savestates_get_slot(void); 53 | void savestates_set_autoinc_slot(int b); 54 | void savestates_inc_slot(void); 55 | 56 | #ifndef __LIBRETRO__ 57 | int savestates_save_m64p(const struct device* dev, char *filepath); 58 | int savestates_load_m64p(struct device* dev, char *filepath); 59 | #else 60 | int savestates_save_m64p(const struct device* dev, void *data); 61 | int savestates_load_m64p(struct device* dev, const void *data); 62 | #endif 63 | 64 | #endif /* __SAVESTAVES_H__ */ 65 | 66 | -------------------------------------------------------------------------------- /src/api/callbacks.c: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus-core - api/callbacks.c * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2009 Richard Goedeken * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | /* This file contains the Core functions for handling callbacks to the 23 | * front-end application 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include "api/m64p_frontend.h" 31 | #include "callbacks.h" 32 | #include "m64p_types.h" 33 | 34 | /* local variables */ 35 | static ptr_DebugCallback pDebugFunc = NULL; 36 | static ptr_StateCallback pStateFunc = NULL; 37 | static void * DebugContext = NULL; 38 | static void * StateContext = NULL; 39 | 40 | /* global Functions for use by the Core */ 41 | m64p_error SetDebugCallback(ptr_DebugCallback pFunc, void *Context) 42 | { 43 | pDebugFunc = pFunc; 44 | DebugContext = Context; 45 | return M64ERR_SUCCESS; 46 | } 47 | 48 | m64p_error SetStateCallback(ptr_StateCallback pFunc, void *Context) 49 | { 50 | pStateFunc = pFunc; 51 | StateContext = Context; 52 | return M64ERR_SUCCESS; 53 | } 54 | 55 | void DebugMessage(int level, const char *message, ...) 56 | { 57 | char msgbuf[512]; 58 | va_list args; 59 | 60 | if (pDebugFunc == NULL) 61 | return; 62 | 63 | va_start(args, message); 64 | vsnprintf(msgbuf, 512, message, args); 65 | 66 | (*pDebugFunc)(DebugContext, level, msgbuf); 67 | 68 | va_end(args); 69 | } 70 | 71 | void StateChanged(m64p_core_param param_type, int new_value) 72 | { 73 | if (pStateFunc == NULL) 74 | return; 75 | 76 | (*pStateFunc)(StateContext, param_type, new_value); 77 | } 78 | 79 | 80 | -------------------------------------------------------------------------------- /src/plugin/dummy_input.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - dummy_input.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2009 Richard Goedeken * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #if !defined(DUMMY_INPUT_H) 23 | #define DUMMY_INPUT_H 24 | 25 | #include "api/m64p_plugin.h" 26 | #include "api/m64p_types.h" 27 | 28 | extern m64p_error dummyinput_PluginGetVersion(m64p_plugin_type *PluginType, int *PluginVersion, 29 | int *APIVersion, const char **PluginNamePtr, int *Capabilities); 30 | extern void dummyinput_InitiateControllers (CONTROL_INFO ControlInfo); 31 | extern void dummyinput_GetKeys(int Control, BUTTONS * Keys ); 32 | extern void dummyinput_ControllerCommand(int Control, unsigned char *Command); 33 | extern void dummyinput_GetKeys(int Control, BUTTONS * Keys); 34 | extern void dummyinput_InitiateControllers(CONTROL_INFO ControlInfo); 35 | extern void dummyinput_ReadController(int Control, unsigned char *Command); 36 | extern int dummyinput_RomOpen(void); 37 | extern void dummyinput_RomClosed(void); 38 | extern void dummyinput_SDL_KeyDown(int keymod, int keysym); 39 | extern void dummyinput_SDL_KeyUp(int keymod, int keysym); 40 | extern void dummyinput_RenderCallback(void); 41 | extern void dummy_SendVRUWord(uint16_t length, uint16_t *word, uint8_t lang); 42 | extern void dummy_SetMicState(int state); 43 | extern void dummy_ReadVRUResults(uint16_t *error_flags, uint16_t *num_results, uint16_t *mic_level, uint16_t *voice_level, uint16_t *voice_length, uint16_t *matches); 44 | extern void dummy_ClearVRUWords(uint8_t length); 45 | extern void dummy_SetVRUWordMask(uint8_t length, uint8_t *mask); 46 | 47 | #endif /* DUMMY_INPUT_H */ 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/device/controllers/paks/biopak.c: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - biopak.c * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2017 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | /* Implementation based on notes from raphnet 23 | * See http://www.raphnet.net/divers/n64_bio_sensor/index_en.php 24 | */ 25 | 26 | #include "biopak.h" 27 | 28 | #include "api/m64p_types.h" 29 | #include "api/callbacks.h" 30 | 31 | #ifdef HAVE_LIBNX 32 | #include 33 | #endif 34 | 35 | #include 36 | #include 37 | 38 | void init_biopak(struct biopak* bpk, 39 | unsigned int bpm) 40 | { 41 | bpk->bpm = bpm; 42 | } 43 | 44 | static void plug_biopak(void* pak) 45 | { 46 | } 47 | 48 | static void unplug_biopak(void* pak) 49 | { 50 | } 51 | 52 | static void read_biopak(void* pak, uint16_t address, uint8_t* data, size_t size) 53 | { 54 | struct biopak* bpk = (struct biopak*)pak; 55 | 56 | if (address == 0xc000) { 57 | time_t now = time(NULL) * 1000; 58 | uint32_t period = UINT32_C(60*1000) / bpk->bpm; 59 | uint32_t k = now % period; 60 | 61 | memset(data, (2*k < period) ? 0x00 : 0x03, size); 62 | } 63 | else { 64 | DebugMessage(M64MSG_WARNING, "Unexpected bio sensor read address %04x", address); 65 | } 66 | } 67 | 68 | static void write_biopak(void* pak, uint16_t address, const uint8_t* data, size_t size) 69 | { 70 | DebugMessage(M64MSG_WARNING, "Unexpected bio sensor write address %04x", address); 71 | } 72 | 73 | 74 | /* bio pak definition */ 75 | const struct pak_interface g_ibiopak = 76 | { 77 | "Bio pak", 78 | plug_biopak, 79 | unplug_biopak, 80 | read_biopak, 81 | write_biopak 82 | }; 83 | -------------------------------------------------------------------------------- /src/device/r4300/x86_64/regcache.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - regcache.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2007 Richard Goedeken (Richard42) * 5 | * Copyright (C) 2002 Hacktarux * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 2 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, write to the * 19 | * Free Software Foundation, Inc., * 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 21 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 22 | 23 | #ifndef M64P_DEVICE_R4300_X86_64_REGCACHE_H 24 | #define M64P_DEVICE_R4300_X86_64_REGCACHE_H 25 | 26 | struct r4300_core; 27 | struct precomp_instr; 28 | struct precomp_block; 29 | 30 | void init_cache(struct r4300_core* r4300, struct precomp_instr* start); 31 | void free_registers_move_start(struct r4300_core* r4300); 32 | void free_all_registers(struct r4300_core* r4300); 33 | void free_register(struct r4300_core* r4300, int reg); 34 | int is64(struct r4300_core* r4300, unsigned int *addr); 35 | int lru_register(struct r4300_core* r4300); 36 | int lru_base_register(struct r4300_core* r4300); 37 | void set_register_state(struct r4300_core* r4300, int reg, unsigned int *addr, int dirty, int is64bits); 38 | int lock_register(struct r4300_core* r4300, int reg); 39 | void unlock_register(struct r4300_core* r4300, int reg); 40 | int allocate_register_32(struct r4300_core* r4300, unsigned int *addr); 41 | int allocate_register_64(struct r4300_core* r4300, unsigned long long *addr); 42 | int allocate_register_32_w(struct r4300_core* r4300, unsigned int *addr); 43 | int allocate_register_64_w(struct r4300_core* r4300, unsigned long long *addr); 44 | void allocate_register_32_manually(struct r4300_core* r4300, int reg, unsigned int *addr); 45 | void allocate_register_32_manually_w(struct r4300_core* r4300, int reg, unsigned int *addr); 46 | void build_wrappers(struct r4300_core* r4300, struct precomp_instr*, int, int, struct precomp_block*); 47 | 48 | #endif /* M64P_DEVICE_R4300_X86_64_REGCACHE_H */ 49 | 50 | -------------------------------------------------------------------------------- /src/device/r4300/x86/regcache.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - regcache.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2002 Hacktarux * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_R4300_X86_REGCACHE_H 23 | #define M64P_DEVICE_R4300_X86_REGCACHE_H 24 | 25 | struct r4300_core; 26 | struct precomp_instr; 27 | struct precomp_block; 28 | 29 | void init_cache(struct r4300_core* r4300, struct precomp_instr* start); 30 | void free_all_registers(struct r4300_core* r4300); 31 | void free_register(struct r4300_core* r4300, int reg); 32 | int allocate_register(struct r4300_core* r4300, unsigned int *addr); 33 | int allocate_64_register1(struct r4300_core* r4300, unsigned int *addr); 34 | int allocate_64_register2(struct r4300_core* r4300, unsigned int *addr); 35 | int is64(struct r4300_core* r4300, unsigned int *addr); 36 | void build_wrappers(struct r4300_core* r4300, struct precomp_instr*, int, int, struct precomp_block*); 37 | int lru_register(struct r4300_core* r4300); 38 | int allocate_register_w(struct r4300_core* r4300, unsigned int *addr); 39 | int allocate_64_register1_w(struct r4300_core* r4300, unsigned int *addr); 40 | int allocate_64_register2_w(struct r4300_core* r4300, unsigned int *addr); 41 | void set_register_state(struct r4300_core* r4300, int reg, unsigned int *addr, int dirty); 42 | void set_64_register_state(struct r4300_core* r4300, int reg1, int reg2, unsigned int *addr, int dirty); 43 | void allocate_register_manually(struct r4300_core* r4300, int reg, unsigned int *addr); 44 | void allocate_register_manually_w(struct r4300_core* r4300, int reg, unsigned int *addr, int load); 45 | int lru_register_exc1(struct r4300_core* r4300, int exc1); 46 | void simplify_access(struct r4300_core* r4300); 47 | 48 | #endif /* M64P_DEVICE_R4300_X86_REGCACHE_H */ 49 | 50 | -------------------------------------------------------------------------------- /src/backends/dummy_video_capture.c: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - dummy_video_capture.c * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2017 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #include "backends/api/video_capture_backend.h" 23 | 24 | #include 25 | #include 26 | 27 | /* Dummy video capture backend 28 | * 29 | * Returns a black frame 30 | */ 31 | struct dummy_video_capture 32 | { 33 | /* BGR frame size (no stride) */ 34 | size_t size; 35 | }; 36 | 37 | static m64p_error dummy_init(void** vcap, const char* config) 38 | { 39 | struct dummy_video_capture* dummy = malloc(sizeof(*dummy)); 40 | if (dummy == NULL) { 41 | *vcap = NULL; 42 | return M64ERR_NO_MEMORY; 43 | } 44 | 45 | memset(dummy, 0, sizeof(*dummy)); 46 | 47 | *vcap = dummy; 48 | return M64ERR_SUCCESS; 49 | } 50 | 51 | static void dummy_release(void* vcap) 52 | { 53 | free(vcap); 54 | } 55 | 56 | static m64p_error dummy_open(void* vcap, unsigned int width, unsigned int height) 57 | { 58 | struct dummy_video_capture* dummy = (struct dummy_video_capture*)vcap; 59 | dummy->size = 3 * width * height; 60 | return M64ERR_SUCCESS; 61 | } 62 | 63 | static void dummy_close(void* vcap) 64 | { 65 | struct dummy_video_capture* dummy = (struct dummy_video_capture*)vcap; 66 | dummy->size = 0; 67 | } 68 | 69 | static m64p_error dummy_grab_image(void* vcap, void* data) 70 | { 71 | struct dummy_video_capture* dummy = (struct dummy_video_capture*)vcap; 72 | memset(data, 0, dummy->size); 73 | return M64ERR_SUCCESS; 74 | } 75 | 76 | const struct video_capture_backend_interface g_idummy_video_capture_backend = 77 | { 78 | "dummy", 79 | dummy_init, 80 | dummy_release, 81 | dummy_open, 82 | dummy_close, 83 | dummy_grab_image 84 | }; 85 | -------------------------------------------------------------------------------- /tools/build_bundle_src.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3 | # * Mupen64plus - build_bundle_src.sh * 4 | # * Mupen64Plus homepage: https://mupen64plus.org/ * 5 | # * Copyright (C) 2009-2013 Richard Goedeken * 6 | # * * 7 | # * This program is free software; you can redistribute it and/or modify * 8 | # * it under the terms of the GNU General Public License as published by * 9 | # * the Free Software Foundation; either version 2 of the License, or * 10 | # * (at your option) any later version. * 11 | # * * 12 | # * This program is distributed in the hope that it will be useful, * 13 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | # * GNU General Public License for more details. * 16 | # * * 17 | # * You should have received a copy of the GNU General Public License * 18 | # * along with this program; if not, write to the * 19 | # * Free Software Foundation, Inc., * 20 | # * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 21 | # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 22 | 23 | # terminate the script if any commands return a non-zero error code 24 | set -e 25 | 26 | if [ $# -lt 2 ]; then 27 | echo "Usage: build_bundle_src.sh " 28 | exit 1 29 | fi 30 | 31 | OUTPUTDIR="mupen64plus-bundle-$2" 32 | 33 | echo "************************************ Creating directory: " ${OUTPUTDIR} 34 | rm -rf ${OUTPUTDIR} 35 | mkdir -p ${OUTPUTDIR}/source 36 | cd ${OUTPUTDIR}/source 37 | 38 | echo "************************************ Downloading Mupen64Plus module source code" 39 | git clone --branch $1 https://github.com/mupen64plus/mupen64plus-core.git 40 | git clone --branch $1 https://github.com/mupen64plus/mupen64plus-rom.git 41 | git clone --branch $1 https://github.com/mupen64plus/mupen64plus-ui-console.git 42 | git clone --branch $1 https://github.com/mupen64plus/mupen64plus-audio-sdl.git 43 | git clone --branch $1 https://github.com/mupen64plus/mupen64plus-input-sdl.git 44 | git clone --branch $1 https://github.com/mupen64plus/mupen64plus-rsp-hle.git 45 | git clone --branch $1 https://github.com/mupen64plus/mupen64plus-video-rice.git 46 | git clone --branch $1 https://github.com/mupen64plus/mupen64plus-video-glide64mk2.git 47 | for dirname in ./mupen64plus-*; do rm -rf ${dirname}/.git*; done 48 | 49 | # unzip the helper scripts and remove the Mercurial scripts 50 | cd .. 51 | tar xzvf source/mupen64plus-core/tools/m64p_helper_scripts.tar.gz 52 | rm -f m64p_get.sh m64p_update.sh 53 | 54 | echo "************************************ Creating archive" 55 | cd .. 56 | tar c "${OUTPUTDIR}" --owner 0 --group 0 --numeric-owner | gzip -n > "${OUTPUTDIR}.tar.gz" 57 | rm -rf "${OUTPUTDIR}" 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/device/rdram/rdram.h: -------------------------------------------------------------------------------- 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | * Mupen64plus - rdram.h * 3 | * Mupen64Plus homepage: https://mupen64plus.org/ * 4 | * Copyright (C) 2014 Bobby Smiles * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 | 22 | #ifndef M64P_DEVICE_RCP_RI_RDRAM_H 23 | #define M64P_DEVICE_RCP_RI_RDRAM_H 24 | 25 | #include 26 | #include 27 | 28 | #include "osal/preproc.h" 29 | 30 | struct r4300_core; 31 | 32 | enum rdram_registers 33 | { 34 | RDRAM_CONFIG_REG, 35 | RDRAM_DEVICE_ID_REG, 36 | RDRAM_DELAY_REG, 37 | RDRAM_MODE_REG, 38 | RDRAM_REF_INTERVAL_REG, 39 | RDRAM_REF_ROW_REG, 40 | RDRAM_RAS_INTERVAL_REG, 41 | RDRAM_MIN_INTERVAL_REG, 42 | RDRAM_ADDR_SELECT_REG, 43 | RDRAM_DEVICE_MANUF_REG, 44 | RDRAM_REGS_COUNT 45 | }; 46 | 47 | /* IPL3 rdram initialization accepts up to 8 RDRAM modules */ 48 | enum { RDRAM_MAX_MODULES_COUNT = 8 }; 49 | 50 | struct rdram 51 | { 52 | uint32_t regs[RDRAM_MAX_MODULES_COUNT][RDRAM_REGS_COUNT]; 53 | 54 | uint32_t* dram; 55 | size_t dram_size; 56 | 57 | struct r4300_core* r4300; 58 | }; 59 | 60 | static osal_inline uint32_t rdram_reg(uint32_t address) 61 | { 62 | return (address & 0x3ff) >> 2; 63 | } 64 | 65 | static osal_inline uint32_t rdram_dram_address(uint32_t address) 66 | { 67 | return (address & 0xffffff) >> 2; 68 | } 69 | 70 | void init_rdram(struct rdram* rdram, 71 | uint32_t* dram, 72 | size_t dram_size, 73 | struct r4300_core* r4300); 74 | 75 | void poweron_rdram(struct rdram* rdram); 76 | 77 | void read_rdram_regs(void* opaque, uint32_t address, uint32_t* value); 78 | void write_rdram_regs(void* opaque, uint32_t address, uint32_t value, uint32_t mask); 79 | 80 | void read_rdram_dram(void* opaque, uint32_t address, uint32_t* value); 81 | void write_rdram_dram(void* opaque, uint32_t address, uint32_t value, uint32_t mask); 82 | 83 | #endif 84 | --------------------------------------------------------------------------------